Socket
Socket
Sign inDemoInstall

@psdk/cpcl

Package Overview
Dependencies
Maintainers
1
Versions
92
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@psdk/cpcl - npm Package Compare versions

Comparing version 0.3.4 to 0.4.0

LICENSE

56

build/args/bar.js

@@ -1,15 +0,24 @@

import { CPCLCommand } from "@psdk/frame-father";
import { BasicCPCLArg } from "./basic";
import { CCodeRotation, CCodeType } from "../types";
export class CBar extends BasicCPCLArg {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.CBar = void 0;
const frame_father_1 = require("@psdk/frame-father");
const basic_1 = require("./basic");
const types_1 = require("../types");
class CBar extends basic_1.BasicCPCLArg {
x;
y;
content;
lineWidth;
height;
codeRotation;
codeType;
constructor(options) {
var _a, _b, _c, _d, _e, _f, _g;
super();
this.x = (_a = options === null || options === void 0 ? void 0 : options.x) !== null && _a !== void 0 ? _a : 0;
this.y = (_b = options === null || options === void 0 ? void 0 : options.y) !== null && _b !== void 0 ? _b : 0;
this.content = (_c = options === null || options === void 0 ? void 0 : options.content) !== null && _c !== void 0 ? _c : '';
this.lineWidth = (_d = options === null || options === void 0 ? void 0 : options.lineWidth) !== null && _d !== void 0 ? _d : 0;
this.height = (_e = options === null || options === void 0 ? void 0 : options.height) !== null && _e !== void 0 ? _e : 0;
this.codeType = (_f = options === null || options === void 0 ? void 0 : options.codeType) !== null && _f !== void 0 ? _f : CCodeType.CODE128;
this.codeRotation = (_g = options.codeRotation) !== null && _g !== void 0 ? _g : CCodeRotation.ROTATION_0;
this.x = options?.x ?? 0;
this.y = options?.y ?? 0;
this.content = options?.content ?? '';
this.lineWidth = options?.lineWidth ?? 0;
this.height = options?.height ?? 0;
this.codeType = options?.codeType ?? types_1.CCodeType.CODE128;
this.codeRotation = options.codeRotation ?? types_1.CCodeRotation.ROTATION_0;
}

@@ -19,31 +28,31 @@ clause() {

switch (this.codeType) {
case CCodeType.CODE39:
case types_1.CCodeType.CODE39:
code = new CodeTypeEntity('39', '2');
break;
case CCodeType.CODE128:
case types_1.CCodeType.CODE128:
code = new CodeTypeEntity('128', '2');
break;
case CCodeType.CODE93:
case types_1.CCodeType.CODE93:
code = new CodeTypeEntity('93', '1');
break;
case CCodeType.CODABAR:
case types_1.CCodeType.CODABAR:
code = new CodeTypeEntity('CODABAR', '2');
break;
case CCodeType.EAN8:
case types_1.CCodeType.EAN8:
code = new CodeTypeEntity('EAN8', '2');
break;
case CCodeType.EAN13:
case types_1.CCodeType.EAN13:
code = new CodeTypeEntity('EAN13', '2');
break;
case CCodeType.UPCA:
case types_1.CCodeType.UPCA:
code = new CodeTypeEntity('UPCA', '2');
break;
case CCodeType.UPCE:
case types_1.CCodeType.UPCE:
code = new CodeTypeEntity('UPCE', '2');
break;
case CCodeType.I2OF5:
case types_1.CCodeType.I2OF5:
code = new CodeTypeEntity('I2OF5', '2');
break;
}
return CPCLCommand.with(this.header())
return frame_father_1.CPCLCommand.with(this.header())
.appendText(this.codeRotation.toString())

@@ -63,3 +72,6 @@ .appendText(code.type)

}
exports.CBar = CBar;
class CodeTypeEntity {
type;
width;
constructor(type, width) {

@@ -66,0 +78,0 @@ this.type = type;

@@ -1,3 +0,6 @@

import { EasyArg } from "@psdk/frame-father";
export class BasicCPCLArg extends EasyArg {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.BasicCPCLArg = void 0;
const frame_father_1 = require("@psdk/frame-father");
class BasicCPCLArg extends frame_father_1.EasyArg {
append(arg) {

@@ -12,1 +15,2 @@ super.append(arg);

}
exports.BasicCPCLArg = BasicCPCLArg;

@@ -1,11 +0,14 @@

import { CPCLCommand } from "@psdk/frame-father";
import { BasicCPCLArg } from "./basic";
export class CBold extends BasicCPCLArg {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.CBold = void 0;
const frame_father_1 = require("@psdk/frame-father");
const basic_1 = require("./basic");
class CBold extends basic_1.BasicCPCLArg {
bold;
constructor(options) {
var _a;
super();
this.bold = (_a = options === null || options === void 0 ? void 0 : options.bold) !== null && _a !== void 0 ? _a : false;
this.bold = options?.bold ?? false;
}
clause() {
return CPCLCommand.with(this.header())
return frame_father_1.CPCLCommand.with(this.header())
.appendText(this.bold ? "1" : "0")

@@ -18,1 +21,2 @@ .clause();

}
exports.CBold = CBold;

@@ -1,12 +0,19 @@

import { CPCLCommand } from "@psdk/frame-father";
import { BasicCPCLArg } from "./basic";
export class CBox extends BasicCPCLArg {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.CBox = void 0;
const frame_father_1 = require("@psdk/frame-father");
const basic_1 = require("./basic");
class CBox extends basic_1.BasicCPCLArg {
lineWidth;
topLeftX;
topLeftY;
bottomRightX;
bottomRightY;
constructor(options) {
var _a, _b, _c, _d, _e;
super();
this.lineWidth = (_a = options === null || options === void 0 ? void 0 : options.lineWidth) !== null && _a !== void 0 ? _a : 0;
this.topLeftX = (_b = options === null || options === void 0 ? void 0 : options.topLeftX) !== null && _b !== void 0 ? _b : 0;
this.topLeftY = (_c = options === null || options === void 0 ? void 0 : options.topLeftY) !== null && _c !== void 0 ? _c : 0;
this.bottomRightX = (_d = options === null || options === void 0 ? void 0 : options.bottomRightX) !== null && _d !== void 0 ? _d : 0;
this.bottomRightY = (_e = options === null || options === void 0 ? void 0 : options.bottomRightY) !== null && _e !== void 0 ? _e : 0;
this.lineWidth = options?.lineWidth ?? 0;
this.topLeftX = options?.topLeftX ?? 0;
this.topLeftY = options?.topLeftY ?? 0;
this.bottomRightX = options?.bottomRightX ?? 0;
this.bottomRightY = options?.bottomRightY ?? 0;
}

@@ -20,3 +27,3 @@ clause() {

}
return CPCLCommand.with(this.header())
return frame_father_1.CPCLCommand.with(this.header())
.appendNumber(this.topLeftX)

@@ -33,1 +40,2 @@ .appendNumber(this.topLeftY)

}
exports.CBox = CBox;

@@ -1,15 +0,18 @@

import { CPCLCommand } from "@psdk/frame-father";
import { BasicCPCLArg } from "./basic";
import { CPageWidth } from "./pagewidth";
import { CGap } from "./gap";
import { CForm } from "./form";
import { CPrint } from "./print";
import { CMode } from "../types";
export class CFeed extends BasicCPCLArg {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.CFeed = void 0;
const frame_father_1 = require("@psdk/frame-father");
const basic_1 = require("./basic");
const pagewidth_1 = require("./pagewidth");
const gap_1 = require("./gap");
const form_1 = require("./form");
const print_1 = require("./print");
const types_1 = require("../types");
class CFeed extends basic_1.BasicCPCLArg {
clause() {
super.append(new CPageWidth({ width: 576 }))
.append(new CGap())
.append(new CForm())
.append(new CPrint({ mode: CMode.NORMAL }));
return CPCLCommand.with(this.header()).clause();
super.append(new pagewidth_1.CPageWidth({ width: 576 }))
.append(new gap_1.CGap())
.append(new form_1.CForm())
.append(new print_1.CPrint({ mode: types_1.CMode.NORMAL }));
return frame_father_1.CPCLCommand.with(this.header()).clause();
}

@@ -20,1 +23,2 @@ header() {

}
exports.CFeed = CFeed;

@@ -1,3 +0,6 @@

import { OnlyTextHeaderArg } from "@psdk/frame-father";
export class CForm extends OnlyTextHeaderArg {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.CForm = void 0;
const frame_father_1 = require("@psdk/frame-father");
class CForm extends frame_father_1.OnlyTextHeaderArg {
header() {

@@ -7,1 +10,2 @@ return 'FORM';

}
exports.CForm = CForm;

@@ -1,3 +0,6 @@

import { OnlyTextHeaderArg } from "@psdk/frame-father";
export class CGap extends OnlyTextHeaderArg {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.CGap = void 0;
const frame_father_1 = require("@psdk/frame-father");
class CGap extends frame_father_1.OnlyTextHeaderArg {
header() {

@@ -7,1 +10,2 @@ return 'GAP-SENSE';

}
exports.CGap = CGap;

@@ -1,20 +0,28 @@

import { BasicCPCLArg } from "./basic";
import { Commander, Raw, CPCLCommand } from "@psdk/frame-father";
import { Pbita } from "@psdk/frame-imageb";
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.CImage = void 0;
const basic_1 = require("./basic");
const frame_father_1 = require("@psdk/frame-father");
const frame_imageb_1 = require("@psdk/frame-imageb");
/**
* Image
*/
export class CImage extends BasicCPCLArg {
class CImage extends basic_1.BasicCPCLArg {
x;
y;
compress;
image;
reverse;
threshold;
constructor(options) {
var _a, _b, _c, _d, _e;
super();
this.x = (_a = options.x) !== null && _a !== void 0 ? _a : 0;
this.y = (_b = options.y) !== null && _b !== void 0 ? _b : 0;
this.compress = (_c = options.compress) !== null && _c !== void 0 ? _c : false;
this.reverse = (_d = options.reverse) !== null && _d !== void 0 ? _d : false;
this.threshold = (_e = options.threshold) !== null && _e !== void 0 ? _e : 190;
this.x = options.x ?? 0;
this.y = options.y ?? 0;
this.compress = options.compress ?? false;
this.reverse = options.reverse ?? false;
this.threshold = options.threshold ?? 190;
this.image = options.image;
}
clause() {
const processer = new Pbita({
const processer = new frame_imageb_1.Pbita({
command: 'cpcl',

@@ -34,3 +42,3 @@ threshold: this.threshold,

const eWidth = Math.floor((width % 8 === 0) ? (width / 8) : (width / 8 + 1));
const command = Commander.make().pushClause(CPCLCommand.with(this.header())
const command = frame_father_1.Commander.make().pushClause(frame_father_1.CPCLCommand.with(this.header())
.appendNumber(eWidth)

@@ -46,3 +54,3 @@ .appendNumber(height)

.command();
return Raw.binary(command.binary()).clause();
return frame_father_1.Raw.binary(command.binary()).clause();
}

@@ -53,1 +61,2 @@ header() {

}
exports.CImage = CImage;

@@ -1,23 +0,39 @@

export * from './bar';
export * from './basic';
export * from './bold';
export * from './box';
export * from './feed';
export * from './form';
export * from './gap';
export * from './image';
export * from './inverse';
export * from './line';
export * from './mag';
export * from './page';
export * from './pageheight';
export * from './pagemode';
export * from './pagesetup';
export * from './pagewidth';
export * from './print';
export * from './qrcode';
export * from './status';
export * from './text';
export * from './underline';
export * from './watermark';
export * from './sn';
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, "__esModule", { value: true });
__exportStar(require("./bar"), exports);
__exportStar(require("./basic"), exports);
__exportStar(require("./bold"), exports);
__exportStar(require("./box"), exports);
__exportStar(require("./feed"), exports);
__exportStar(require("./form"), exports);
__exportStar(require("./gap"), exports);
__exportStar(require("./image"), exports);
__exportStar(require("./inverse"), exports);
__exportStar(require("./line"), exports);
__exportStar(require("./mag"), exports);
__exportStar(require("./page"), exports);
__exportStar(require("./pageheight"), exports);
__exportStar(require("./pagemode"), exports);
__exportStar(require("./pagesetup"), exports);
__exportStar(require("./pagewidth"), exports);
__exportStar(require("./print"), exports);
__exportStar(require("./qrcode"), exports);
__exportStar(require("./status"), exports);
__exportStar(require("./text"), exports);
__exportStar(require("./underline"), exports);
__exportStar(require("./watermark"), exports);
__exportStar(require("./sn"), exports);

@@ -1,14 +0,20 @@

import { CPCLCommand } from "@psdk/frame-father";
import { BasicCPCLArg } from "./basic";
export class CInverse extends BasicCPCLArg {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.CInverse = void 0;
const frame_father_1 = require("@psdk/frame-father");
const basic_1 = require("./basic");
class CInverse extends basic_1.BasicCPCLArg {
x;
y;
width;
height;
constructor(options) {
var _a, _b, _c, _d;
super();
this.x = (_a = options === null || options === void 0 ? void 0 : options.x) !== null && _a !== void 0 ? _a : 0;
this.y = (_b = options === null || options === void 0 ? void 0 : options.y) !== null && _b !== void 0 ? _b : 0;
this.width = (_c = options === null || options === void 0 ? void 0 : options.width) !== null && _c !== void 0 ? _c : 0;
this.height = (_d = options === null || options === void 0 ? void 0 : options.height) !== null && _d !== void 0 ? _d : 0;
this.x = options?.x ?? 0;
this.y = options?.y ?? 0;
this.width = options?.width ?? 0;
this.height = options?.height ?? 0;
}
clause() {
return CPCLCommand.with(this.header())
return frame_father_1.CPCLCommand.with(this.header())
.appendNumber(this.x)

@@ -25,1 +31,2 @@ .appendNumber(this.y)

}
exports.CInverse = CInverse;

@@ -1,16 +0,24 @@

import { CPCLCommand } from "@psdk/frame-father";
import { BasicCPCLArg } from "./basic";
export class CLine extends BasicCPCLArg {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.CLine = void 0;
const frame_father_1 = require("@psdk/frame-father");
const basic_1 = require("./basic");
class CLine extends basic_1.BasicCPCLArg {
width;
startX;
startY;
endX;
endY;
isSolidLine;
constructor(options) {
var _a, _b, _c, _d, _e, _f;
super();
this.width = (_a = options === null || options === void 0 ? void 0 : options.width) !== null && _a !== void 0 ? _a : 0;
this.startX = (_b = options === null || options === void 0 ? void 0 : options.startX) !== null && _b !== void 0 ? _b : 0;
this.startY = (_c = options === null || options === void 0 ? void 0 : options.startY) !== null && _c !== void 0 ? _c : 0;
this.endX = (_d = options === null || options === void 0 ? void 0 : options.endX) !== null && _d !== void 0 ? _d : 0;
this.endY = (_e = options === null || options === void 0 ? void 0 : options.endY) !== null && _e !== void 0 ? _e : 0;
this.isSolidLine = (_f = options === null || options === void 0 ? void 0 : options.isSolidLine) !== null && _f !== void 0 ? _f : true;
this.width = options?.width ?? 0;
this.startX = options?.startX ?? 0;
this.startY = options?.startY ?? 0;
this.endX = options?.endX ?? 0;
this.endY = options?.endY ?? 0;
this.isSolidLine = options?.isSolidLine ?? true;
}
clause() {
return CPCLCommand.with(this.header())
return frame_father_1.CPCLCommand.with(this.header())
.appendNumber(this.startX)

@@ -27,1 +35,2 @@ .appendNumber(this.startY)

}
exports.CLine = CLine;

@@ -1,9 +0,12 @@

import { CPCLCommand } from "@psdk/frame-father";
import { BasicCPCLArg } from "./basic";
import { CFont } from "../types";
export class CMag extends BasicCPCLArg {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.CMag = void 0;
const frame_father_1 = require("@psdk/frame-father");
const basic_1 = require("./basic");
const types_1 = require("../types");
class CMag extends basic_1.BasicCPCLArg {
font;
constructor(options) {
var _a;
super();
this.font = (_a = options === null || options === void 0 ? void 0 : options.font) !== null && _a !== void 0 ? _a : CFont.TSS16;
this.font = options?.font ?? types_1.CFont.TSS16;
}

@@ -13,34 +16,34 @@ clause() {

switch (this.font) {
case CFont.TSS16:
case types_1.CFont.TSS16:
fontEntity = new FontEntity(1, 1, 55, 0, 16);
break;
case CFont.TSS20:
case types_1.CFont.TSS20:
fontEntity = new FontEntity(1, 1, 6, 0, 20);
break;
case CFont.TSS20_MAX1:
case types_1.CFont.TSS20_MAX1:
fontEntity = new FontEntity(1, 1, 6, 0, 40);
break;
case CFont.TSS24:
case types_1.CFont.TSS24:
fontEntity = new FontEntity(1, 1, 24, 0, 24);
break;
case CFont.TSS32:
case types_1.CFont.TSS32:
fontEntity = new FontEntity(1, 1, 4, 0, 32);
break;
case CFont.TSS24_MAX1:
case types_1.CFont.TSS24_MAX1:
fontEntity = new FontEntity(2, 2, 24, 0, 48);
break;
case CFont.TSS24_MAX2:
case types_1.CFont.TSS24_MAX2:
fontEntity = new FontEntity(3, 3, 24, 0, 72);
break;
case CFont.TSS28_MAX1:
case types_1.CFont.TSS28_MAX1:
fontEntity = new FontEntity(1, 1, 7, 3, 56);
break;
case CFont.TSS32_MAX1:
case types_1.CFont.TSS32_MAX1:
fontEntity = new FontEntity(2, 2, 4, 0, 64);
break;
case CFont.TSS32_MAX2:
case types_1.CFont.TSS32_MAX2:
fontEntity = new FontEntity(3, 3, 4, 0, 96);
break;
}
return CPCLCommand.with(this.header())
return frame_father_1.CPCLCommand.with(this.header())
.appendNumber(fontEntity.ex)

@@ -54,3 +57,9 @@ .appendNumber(fontEntity.ey)

}
exports.CMag = CMag;
class FontEntity {
ex;
ey;
family;
size;
height;
constructor(ex, ey, family, size, height) {

@@ -57,0 +66,0 @@ this.ex = ex;

@@ -1,17 +0,22 @@

import { CPCLCommand } from "@psdk/frame-father";
import { BasicCPCLArg } from "./basic";
import { CPageHeight } from "./pageheight";
import { CPageWidth } from "./pagewidth";
export class CPage extends BasicCPCLArg {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.CPage = void 0;
const frame_father_1 = require("@psdk/frame-father");
const basic_1 = require("./basic");
const pageheight_1 = require("./pageheight");
const pagewidth_1 = require("./pagewidth");
class CPage extends basic_1.BasicCPCLArg {
width;
height;
copies;
constructor(options) {
var _a, _b, _c;
super();
this.width = (_a = options === null || options === void 0 ? void 0 : options.width) !== null && _a !== void 0 ? _a : 0;
this.height = (_b = options === null || options === void 0 ? void 0 : options.height) !== null && _b !== void 0 ? _b : 0;
this.copies = (_c = options === null || options === void 0 ? void 0 : options.copies) !== null && _c !== void 0 ? _c : 1;
this.width = options?.width ?? 0;
this.height = options?.height ?? 0;
this.copies = options?.copies ?? 1;
}
clause() {
super.prepend(new CPageHeight({ height: this.height, copies: this.copies }));
super.append(new CPageWidth({ width: this.width }));
return CPCLCommand.with(this.header())
super.prepend(new pageheight_1.CPageHeight({ height: this.height, copies: this.copies }));
super.append(new pagewidth_1.CPageWidth({ width: this.width }));
return frame_father_1.CPCLCommand.with(this.header())
.clause();

@@ -23,1 +28,2 @@ }

}
exports.CPage = CPage;

@@ -1,12 +0,16 @@

import { CPCLCommand } from "@psdk/frame-father";
import { BasicCPCLArg } from "./basic";
export class CPageHeight extends BasicCPCLArg {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.CPageHeight = void 0;
const frame_father_1 = require("@psdk/frame-father");
const basic_1 = require("./basic");
class CPageHeight extends basic_1.BasicCPCLArg {
height;
copies;
constructor(options) {
var _a, _b;
super();
this.height = (_a = options === null || options === void 0 ? void 0 : options.height) !== null && _a !== void 0 ? _a : 0;
this.copies = (_b = options === null || options === void 0 ? void 0 : options.copies) !== null && _b !== void 0 ? _b : 1;
this.height = options?.height ?? 0;
this.copies = options?.copies ?? 1;
}
clause() {
return CPCLCommand.with(this.header())
return frame_father_1.CPCLCommand.with(this.header())
.appendNumber(this.height)

@@ -20,1 +24,2 @@ .appendNumber(this.copies)

}
exports.CPageHeight = CPageHeight;

@@ -1,16 +0,19 @@

import { CPCLCommand } from "@psdk/frame-father";
import { BasicCPCLArg } from "./basic";
import { CLocation } from "../types";
import { CGap } from "./gap";
import { CForm } from "./form";
export class CPageMode extends BasicCPCLArg {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.CPageMode = void 0;
const frame_father_1 = require("@psdk/frame-father");
const basic_1 = require("./basic");
const types_1 = require("../types");
const gap_1 = require("./gap");
const form_1 = require("./form");
class CPageMode extends basic_1.BasicCPCLArg {
location;
constructor(options) {
var _a;
super();
this.location = (_a = options === null || options === void 0 ? void 0 : options.location) !== null && _a !== void 0 ? _a : CLocation.NO_LOCATION;
this.location = options?.location ?? types_1.CLocation.NO_LOCATION;
}
clause() {
if (this.location > 0)
super.prepend(new CGap()).prepend(new CForm());
return CPCLCommand.with(this.header())
super.prepend(new gap_1.CGap()).prepend(new form_1.CForm());
return frame_father_1.CPCLCommand.with(this.header())
.clause();

@@ -22,1 +25,2 @@ }

}
exports.CPageMode = CPageMode;

@@ -1,16 +0,20 @@

import { CPCLCommand } from "@psdk/frame-father";
import { BasicCPCLArg } from "./basic";
import { CPageHeight } from "./pageheight";
import { CPageWidth } from "./pagewidth";
export class CPageSetup extends BasicCPCLArg {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.CPageSetup = void 0;
const frame_father_1 = require("@psdk/frame-father");
const basic_1 = require("./basic");
const pageheight_1 = require("./pageheight");
const pagewidth_1 = require("./pagewidth");
class CPageSetup extends basic_1.BasicCPCLArg {
pageHeight;
pageWidth;
constructor(options) {
var _a, _b;
super();
this.pageHeight = (_a = options === null || options === void 0 ? void 0 : options.pageHeight) !== null && _a !== void 0 ? _a : 0;
this.pageWidth = (_b = options === null || options === void 0 ? void 0 : options.pageHeight) !== null && _b !== void 0 ? _b : 0;
this.pageHeight = options?.pageHeight ?? 0;
this.pageWidth = options?.pageHeight ?? 0;
}
clause() {
super.prepend(new CPageHeight({ height: this.pageHeight }));
super.append(new CPageWidth({ width: this.pageWidth }));
return CPCLCommand.with(this.header()).clause();
super.prepend(new pageheight_1.CPageHeight({ height: this.pageHeight }));
super.append(new pagewidth_1.CPageWidth({ width: this.pageWidth }));
return frame_father_1.CPCLCommand.with(this.header()).clause();
}

@@ -21,1 +25,2 @@ header() {

}
exports.CPageSetup = CPageSetup;

@@ -1,11 +0,14 @@

import { CPCLCommand } from "@psdk/frame-father";
import { BasicCPCLArg } from "./basic";
export class CPageWidth extends BasicCPCLArg {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.CPageWidth = void 0;
const frame_father_1 = require("@psdk/frame-father");
const basic_1 = require("./basic");
class CPageWidth extends basic_1.BasicCPCLArg {
width;
constructor(options) {
var _a;
super();
this.width = (_a = options === null || options === void 0 ? void 0 : options.width) !== null && _a !== void 0 ? _a : 0;
this.width = options?.width ?? 0;
}
clause() {
return CPCLCommand.with(this.header())
return frame_father_1.CPCLCommand.with(this.header())
.appendNumber(this.width)

@@ -18,1 +21,2 @@ .clause();

}
exports.CPageWidth = CPageWidth;

@@ -1,12 +0,16 @@

import { OnlyTextHeaderArg } from "@psdk/frame-father";
import { CMode } from "../types";
export class CPrint extends OnlyTextHeaderArg {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.CPrint = void 0;
const frame_father_1 = require("@psdk/frame-father");
const types_1 = require("../types");
class CPrint extends frame_father_1.OnlyTextHeaderArg {
mode;
constructor(options) {
var _a;
super();
this.mode = (_a = options === null || options === void 0 ? void 0 : options.mode) !== null && _a !== void 0 ? _a : CMode.NORMAL;
this.mode = options?.mode ?? types_1.CMode.NORMAL;
}
header() {
return this.mode == CMode.HORIZONTAL ? "POPRINT" : "PRINT";
return this.mode == types_1.CMode.HORIZONTAL ? "POPRINT" : "PRINT";
}
}
exports.CPrint = CPrint;

@@ -1,18 +0,27 @@

import { CPCLCommand } from "@psdk/frame-father";
import { BasicCPCLArg } from "./basic";
import { CCodeRotation, CCorrectLevel } from "../types";
export class CQRCode extends BasicCPCLArg {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.CQRCode = void 0;
const frame_father_1 = require("@psdk/frame-father");
const basic_1 = require("./basic");
const types_1 = require("../types");
class CQRCode extends basic_1.BasicCPCLArg {
x;
y;
content;
codeRotation;
width;
level;
charset;
constructor(options) {
var _a, _b, _c, _d, _e, _f, _g;
super();
this.x = (_a = options.x) !== null && _a !== void 0 ? _a : 0;
this.y = (_b = options.y) !== null && _b !== void 0 ? _b : 0;
this.content = (_c = options.content) !== null && _c !== void 0 ? _c : '';
this.codeRotation = (_d = options.codeRotation) !== null && _d !== void 0 ? _d : CCodeRotation.ROTATION_0;
this.width = (_e = options.width) !== null && _e !== void 0 ? _e : 0;
this.level = (_f = options.level) !== null && _f !== void 0 ? _f : CCorrectLevel.H;
this.charset = (_g = options.charset) !== null && _g !== void 0 ? _g : 'gbk';
this.x = options.x ?? 0;
this.y = options.y ?? 0;
this.content = options.content ?? '';
this.codeRotation = options.codeRotation ?? types_1.CCodeRotation.ROTATION_0;
this.width = options.width ?? 0;
this.level = options.level ?? types_1.CCorrectLevel.H;
this.charset = options.charset ?? 'gbk';
}
clause() {
return CPCLCommand.with(this.header(), this.charset)
return frame_father_1.CPCLCommand.with(this.header(), this.charset)
.appendText("3" + "\n" + this.codeRotation)

@@ -32,1 +41,2 @@ .appendText("QR")

}
exports.CQRCode = CQRCode;

@@ -1,3 +0,6 @@

import { OnlyBinaryHeaderArg } from "@psdk/frame-father";
export class CSN extends OnlyBinaryHeaderArg {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.CSN = void 0;
const frame_father_1 = require("@psdk/frame-father");
class CSN extends frame_father_1.OnlyBinaryHeaderArg {
constructor() {

@@ -13,1 +16,2 @@ super();

}
exports.CSN = CSN;

@@ -1,3 +0,6 @@

import { OnlyBinaryHeaderArg } from "@psdk/frame-father";
export class CStatus extends OnlyBinaryHeaderArg {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.CStatus = void 0;
const frame_father_1 = require("@psdk/frame-father");
class CStatus extends frame_father_1.OnlyBinaryHeaderArg {
constructor() {

@@ -13,1 +16,2 @@ super();

}
exports.CStatus = CStatus;

@@ -1,14 +0,22 @@

import { CPCLCommand } from "@psdk/frame-father";
import { BasicCPCLArg } from "./basic";
import { CFont, CRotation } from "../types";
export class CText extends BasicCPCLArg {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.CText = void 0;
const frame_father_1 = require("@psdk/frame-father");
const basic_1 = require("./basic");
const types_1 = require("../types");
class CText extends basic_1.BasicCPCLArg {
x;
y;
content;
font;
rotation;
charset;
constructor(options) {
var _a, _b, _c, _d, _e, _f;
super();
this.x = (_a = options === null || options === void 0 ? void 0 : options.x) !== null && _a !== void 0 ? _a : 0;
this.y = (_b = options === null || options === void 0 ? void 0 : options.y) !== null && _b !== void 0 ? _b : 0;
this.content = (_c = options === null || options === void 0 ? void 0 : options.content) !== null && _c !== void 0 ? _c : '';
this.font = (_d = options === null || options === void 0 ? void 0 : options.font) !== null && _d !== void 0 ? _d : CFont.TSS16;
this.rotation = (_e = options === null || options === void 0 ? void 0 : options.rotation) !== null && _e !== void 0 ? _e : CRotation.ROTATION_0;
this.charset = (_f = options === null || options === void 0 ? void 0 : options.charset) !== null && _f !== void 0 ? _f : 'gbk';
this.x = options?.x ?? 0;
this.y = options?.y ?? 0;
this.content = options?.content ?? '';
this.font = options?.font ?? types_1.CFont.TSS16;
this.rotation = options?.rotation ?? types_1.CRotation.ROTATION_0;
this.charset = options?.charset ?? 'gbk';
}

@@ -18,34 +26,34 @@ clause() {

switch (this.font) {
case CFont.TSS16:
case types_1.CFont.TSS16:
fontEntity = new FontEntity(1, 1, 55, 0, 16);
break;
case CFont.TSS20:
case types_1.CFont.TSS20:
fontEntity = new FontEntity(1, 1, 6, 0, 20);
break;
case CFont.TSS20_MAX1:
case types_1.CFont.TSS20_MAX1:
fontEntity = new FontEntity(1, 1, 6, 0, 40);
break;
case CFont.TSS24:
case types_1.CFont.TSS24:
fontEntity = new FontEntity(1, 1, 24, 0, 24);
break;
case CFont.TSS32:
case types_1.CFont.TSS32:
fontEntity = new FontEntity(1, 1, 4, 0, 32);
break;
case CFont.TSS24_MAX1:
case types_1.CFont.TSS24_MAX1:
fontEntity = new FontEntity(2, 2, 24, 0, 48);
break;
case CFont.TSS24_MAX2:
case types_1.CFont.TSS24_MAX2:
fontEntity = new FontEntity(3, 3, 24, 0, 72);
break;
case CFont.TSS28_MAX1:
case types_1.CFont.TSS28_MAX1:
fontEntity = new FontEntity(1, 1, 7, 3, 56);
break;
case CFont.TSS32_MAX1:
case types_1.CFont.TSS32_MAX1:
fontEntity = new FontEntity(2, 2, 4, 0, 64);
break;
case CFont.TSS32_MAX2:
case types_1.CFont.TSS32_MAX2:
fontEntity = new FontEntity(3, 3, 4, 0, 96);
break;
}
return CPCLCommand.with(this.header(), this.charset)
return frame_father_1.CPCLCommand.with(this.header(), this.charset)
.appendNumber(fontEntity.family)

@@ -62,3 +70,9 @@ .appendNumber(fontEntity.size)

}
exports.CText = CText;
class FontEntity {
ex;
ey;
family;
size;
height;
constructor(ex, ey, family, size, height) {

@@ -65,0 +79,0 @@ this.ex = ex;

@@ -1,11 +0,14 @@

import { CPCLCommand } from "@psdk/frame-father";
import { BasicCPCLArg } from "./basic";
export class CUnderLine extends BasicCPCLArg {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.CUnderLine = void 0;
const frame_father_1 = require("@psdk/frame-father");
const basic_1 = require("./basic");
class CUnderLine extends basic_1.BasicCPCLArg {
underline;
constructor(options) {
var _a;
super();
this.underline = (_a = options === null || options === void 0 ? void 0 : options.underline) !== null && _a !== void 0 ? _a : false;
this.underline = options?.underline ?? false;
}
clause() {
return CPCLCommand.with(this.header())
return frame_father_1.CPCLCommand.with(this.header())
.appendText(this.underline ? "ON" : "OFF")

@@ -18,1 +21,2 @@ .clause();

}
exports.CUnderLine = CUnderLine;

@@ -1,11 +0,14 @@

import { CPCLCommand } from "@psdk/frame-father";
import { BasicCPCLArg } from "./basic";
export class CWaterMark extends BasicCPCLArg {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.CWaterMark = void 0;
const frame_father_1 = require("@psdk/frame-father");
const basic_1 = require("./basic");
class CWaterMark extends basic_1.BasicCPCLArg {
value;
constructor(options) {
var _a;
super();
this.value = (_a = options === null || options === void 0 ? void 0 : options.value) !== null && _a !== void 0 ? _a : 0;
this.value = options?.value ?? 0;
}
clause() {
return CPCLCommand.with(this.header())
return frame_father_1.CPCLCommand.with(this.header())
.appendNumber(this.value)

@@ -18,1 +21,2 @@ .clause();

}
exports.CWaterMark = CWaterMark;

@@ -1,9 +0,22 @@

import { Commander, PSDK } from '@psdk/frame-father';
import { CBold, CPrint, CUnderLine } from "../args";
import { CMode } from "../types";
export class BasicCPCL extends PSDK {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.BasicCPCL = void 0;
const frame_father_1 = require("@psdk/frame-father");
const args_1 = require("../args");
const types_1 = require("../types");
class BasicCPCL extends frame_father_1.PSDK {
/**
* lifecycle
* @private
*/
_lifecycle;
/**
* commander
* @private
*/
_commander;
constructor(lifecycle) {
super();
this._lifecycle = lifecycle;
this._commander = Commander.make();
this._commander = frame_father_1.Commander.make();
}

@@ -33,3 +46,3 @@ connectedDevice() {

bold(bold) {
return super.push(new CBold({ bold: bold }));
return super.push(new args_1.CBold({ bold: bold }));
}

@@ -85,3 +98,3 @@ /**

print(arg) {
return super.push(arg !== null && arg !== void 0 ? arg : new CPrint({ mode: CMode.NORMAL }));
return super.push(arg ?? new args_1.CPrint({ mode: types_1.CMode.NORMAL }));
}

@@ -106,3 +119,3 @@ /**

underline(underline) {
return super.push(new CUnderLine({ underline: underline }));
return super.push(new args_1.CUnderLine({ underline: underline }));
}

@@ -129,1 +142,2 @@ /**

}
exports.BasicCPCL = BasicCPCL;

@@ -1,6 +0,9 @@

import { GenericCPCL } from "./generic";
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.CPCL = void 0;
const generic_1 = require("./generic");
/**
* CPCL entrypoint
*/
export class CPCL {
class CPCL {
/**

@@ -11,4 +14,5 @@ * Generic cpcl command

static generic(lifecycle) {
return new GenericCPCL(lifecycle);
return new generic_1.GenericCPCL(lifecycle);
}
}
exports.CPCL = CPCL;

@@ -1,3 +0,6 @@

import { BasicCPCL } from "./basic";
export class GenericCPCL extends BasicCPCL {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.GenericCPCL = void 0;
const basic_1 = require("./basic");
class GenericCPCL extends basic_1.BasicCPCL {
constructor(lifecycle) {

@@ -7,1 +10,2 @@ super(lifecycle);

}
exports.GenericCPCL = GenericCPCL;

@@ -1,2 +0,18 @@

export * from './generic';
export * from './cpcl';
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, "__esModule", { value: true });
__exportStar(require("./generic"), exports);
__exportStar(require("./cpcl"), exports);

@@ -1,3 +0,19 @@

export * from './impls';
export * from './args';
export * from './types';
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, "__esModule", { value: true });
__exportStar(require("./impls"), exports);
__exportStar(require("./args"), exports);
__exportStar(require("./types"), exports);

@@ -1,2 +0,5 @@

export var CCodeRotation;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.CCodeRotation = void 0;
var CCodeRotation;
(function (CCodeRotation) {

@@ -11,2 +14,2 @@ /**

CCodeRotation["ROTATION_90"] = "VB";
})(CCodeRotation || (CCodeRotation = {}));
})(CCodeRotation || (exports.CCodeRotation = CCodeRotation = {}));

@@ -0,5 +1,8 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.CCodeType = void 0;
/**
* CodeType
*/
export var CCodeType;
var CCodeType;
(function (CCodeType) {

@@ -42,2 +45,2 @@ /**

CCodeType[CCodeType["I2OF5"] = 8] = "I2OF5";
})(CCodeType || (CCodeType = {}));
})(CCodeType || (exports.CCodeType = CCodeType = {}));

@@ -1,2 +0,5 @@

export var CCorrectLevel;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.CCorrectLevel = void 0;
var CCorrectLevel;
(function (CCorrectLevel) {

@@ -19,2 +22,2 @@ /**

CCorrectLevel["H"] = "H";
})(CCorrectLevel || (CCorrectLevel = {}));
})(CCorrectLevel || (exports.CCorrectLevel = CCorrectLevel = {}));

@@ -0,5 +1,8 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.CFont = void 0;
/**
* font
*/
export var CFont;
var CFont;
(function (CFont) {

@@ -46,2 +49,2 @@ /**

CFont[CFont["TSS28_MAX1"] = 9] = "TSS28_MAX1";
})(CFont || (CFont = {}));
})(CFont || (exports.CFont = CFont = {}));

@@ -1,7 +0,23 @@

export * from './coderotation';
export * from './codetype';
export * from './correctlevel';
export * from './font';
export * from './location';
export * from './mode';
export * from './rotation';
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, "__esModule", { value: true });
__exportStar(require("./coderotation"), exports);
__exportStar(require("./codetype"), exports);
__exportStar(require("./correctlevel"), exports);
__exportStar(require("./font"), exports);
__exportStar(require("./location"), exports);
__exportStar(require("./mode"), exports);
__exportStar(require("./rotation"), exports);

@@ -1,2 +0,5 @@

export var CLocation;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.CLocation = void 0;
var CLocation;
(function (CLocation) {

@@ -11,2 +14,2 @@ /**

CLocation[CLocation["SKIP"] = 1] = "SKIP";
})(CLocation || (CLocation = {}));
})(CLocation || (exports.CLocation = CLocation = {}));

@@ -1,2 +0,5 @@

export var CMode;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.CMode = void 0;
var CMode;
(function (CMode) {

@@ -11,2 +14,2 @@ /**

CMode[CMode["HORIZONTAL"] = 1] = "HORIZONTAL";
})(CMode || (CMode = {}));
})(CMode || (exports.CMode = CMode = {}));

@@ -1,2 +0,5 @@

export var CRotation;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.CRotation = void 0;
var CRotation;
(function (CRotation) {

@@ -19,2 +22,2 @@ /**

CRotation["ROTATION_270"] = "270";
})(CRotation || (CRotation = {}));
})(CRotation || (exports.CRotation = CRotation = {}));
{
"name": "@psdk/cpcl",
"version": "0.3.4",
"version": "0.4.0",
"description": "psdk",

@@ -18,15 +18,13 @@ "main": "build/index.js",

"devDependencies": {
"@babel/core": "^7.24.5",
"@babel/preset-env": "^7.24.5",
"@babel/preset-typescript": "^7.24.1",
"@types/jest": "^29.5.12",
"@vercel/ncc": "^0.38.1",
"babel-jest": "^29.7.0",
"jest": "^29.7.0",
"typedoc": "^0.25.13",
"typescript": "^5.4.5"
"ts-jest": "^29.1.5",
"ts-node": "^10.9.2",
"typedoc": "^0.26.4",
"typescript": "^5.5.3"
},
"dependencies": {
"@psdk/frame-father": "0.3.4",
"@psdk/frame-imageb": "0.3.4"
"@psdk/frame-father": "0.4.0",
"@psdk/frame-imageb": "0.4.0"
},

@@ -37,3 +35,3 @@ "files": [

],
"gitHead": "b8c2fdcb52f1bd3e9d75d004d37d717bd465b4c9"
"gitHead": "13fa8cc6aacbf8f6bacb5f485da11a7610001f61"
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc