@formless63/viewer-lbx 0.0.0-stage → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +26 -2
- package/dist/.tsbuildinfo +1 -0
- package/dist/colors.d.ts +18 -0
- package/dist/colors.d.ts.map +1 -0
- package/dist/colors.js +20 -0
- package/dist/colors.js.map +1 -0
- package/dist/definitions.d.ts +3 -0
- package/dist/definitions.d.ts.map +1 -0
- package/dist/definitions.js +10 -0
- package/dist/definitions.js.map +1 -0
- package/dist/font-metrics.d.ts +81 -0
- package/dist/font-metrics.d.ts.map +1 -0
- package/dist/font-metrics.js +65 -0
- package/dist/font-metrics.js.map +1 -0
- package/dist/fonts.d.ts +15 -0
- package/dist/fonts.d.ts.map +1 -0
- package/dist/fonts.js +31 -0
- package/dist/fonts.js.map +1 -0
- package/dist/geometry.d.ts +17 -0
- package/dist/geometry.d.ts.map +1 -0
- package/dist/geometry.js +36 -0
- package/dist/geometry.js.map +1 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +10 -0
- package/dist/index.js.map +1 -0
- package/dist/lbx-viewer.d.ts +17 -0
- package/dist/lbx-viewer.d.ts.map +1 -0
- package/dist/lbx-viewer.js +153 -0
- package/dist/lbx-viewer.js.map +1 -0
- package/dist/parse.d.ts +42 -0
- package/dist/parse.d.ts.map +1 -0
- package/dist/parse.js +90 -0
- package/dist/parse.js.map +1 -0
- package/dist/raster.d.ts +45 -0
- package/dist/raster.d.ts.map +1 -0
- package/dist/raster.js +87 -0
- package/dist/raster.js.map +1 -0
- package/dist/tape-stocks.d.ts +34 -0
- package/dist/tape-stocks.d.ts.map +1 -0
- package/dist/tape-stocks.js +99 -0
- package/dist/tape-stocks.js.map +1 -0
- package/dist/text-layout.d.ts +67 -0
- package/dist/text-layout.d.ts.map +1 -0
- package/dist/text-layout.js +88 -0
- package/dist/text-layout.js.map +1 -0
- package/package.json +55 -4
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { LbxLabel } from './parse.ts';
|
|
2
|
+
/**
|
|
3
|
+
* Bleed (in pt) added around the label on every side of the SVG viewBox, so a
|
|
4
|
+
* mark that overhangs the tape edge is still visible and the strip doesn't sit
|
|
5
|
+
* flush against the embed's border. Being INSIDE the viewBox, it scales
|
|
6
|
+
* with the label instead of eating a fixed margin at every preview size.
|
|
7
|
+
*/
|
|
8
|
+
export declare const LBX_VIEW_BLEED_PT = 4;
|
|
9
|
+
export interface LbxGeometry {
|
|
10
|
+
/** Label length in pt (SVG x axis). */
|
|
11
|
+
lengthPt: number;
|
|
12
|
+
/** Tape width in pt (SVG y axis). */
|
|
13
|
+
tapeWidthPt: number;
|
|
14
|
+
}
|
|
15
|
+
/** derive the drawable label geometry from a parsed config. */
|
|
16
|
+
export declare function resolveLbxGeometry(label: LbxLabel): LbxGeometry;
|
|
17
|
+
//# sourceMappingURL=geometry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"geometry.d.ts","sourceRoot":"","sources":["../src/geometry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAU3C;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,IAAI,CAAC;AAEnC,MAAM,WAAW,WAAW;IAC1B,uCAAuC;IACvC,QAAQ,EAAE,MAAM,CAAC;IACjB,qCAAqC;IACrC,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,+DAA+D;AAC/D,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,QAAQ,GAAG,WAAW,CAsB/D"}
|
package/dist/geometry.js
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `bil-lbx` serializes auto-length sheets with a ~1m placeholder height
|
|
3
|
+
* (2834.4pt); P-touch Editor writes similar sentinels. Any stored length
|
|
4
|
+
* beyond this is treated as "not the real label length" and the object
|
|
5
|
+
* extents win instead.
|
|
6
|
+
*/
|
|
7
|
+
const AUTO_LENGTH_SENTINEL_PT = 2000;
|
|
8
|
+
/**
|
|
9
|
+
* Bleed (in pt) added around the label on every side of the SVG viewBox, so a
|
|
10
|
+
* mark that overhangs the tape edge is still visible and the strip doesn't sit
|
|
11
|
+
* flush against the embed's border. Being INSIDE the viewBox, it scales
|
|
12
|
+
* with the label instead of eating a fixed margin at every preview size.
|
|
13
|
+
*/
|
|
14
|
+
export const LBX_VIEW_BLEED_PT = 4;
|
|
15
|
+
/** derive the drawable label geometry from a parsed config. */
|
|
16
|
+
export function resolveLbxGeometry(label) {
|
|
17
|
+
const tapeWidthPt = label.paper.width > 0 ? label.paper.width : 33.6;
|
|
18
|
+
let contentEndPt = 0;
|
|
19
|
+
for (const obj of label.objects) {
|
|
20
|
+
contentEndPt = Math.max(contentEndPt, obj.position.x + obj.position.width);
|
|
21
|
+
if (obj.type === 'line') {
|
|
22
|
+
for (const p of obj.points)
|
|
23
|
+
contentEndPt = Math.max(contentEndPt, p.x);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
const storedLength = label.paper.height ?? 0;
|
|
27
|
+
const storedUsable = storedLength > 0 && (!label.paper.autoLength || storedLength < AUTO_LENGTH_SENTINEL_PT);
|
|
28
|
+
const marginPad = (label.paper.marginLeft ?? 2.8) * 2;
|
|
29
|
+
const lengthPt = storedUsable
|
|
30
|
+
? Math.max(storedLength, contentEndPt)
|
|
31
|
+
: contentEndPt > 0
|
|
32
|
+
? contentEndPt + marginPad
|
|
33
|
+
: 100;
|
|
34
|
+
return { lengthPt, tapeWidthPt };
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=geometry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"geometry.js","sourceRoot":"","sources":["../src/geometry.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,MAAM,uBAAuB,GAAG,IAAI,CAAC;AAErC;;;;;GAKG;AACH,MAAM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ACnC,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export * from './colors.ts';
|
|
2
|
+
export { lbxDefinition } from './definitions.ts';
|
|
3
|
+
export * from './font-metrics.ts';
|
|
4
|
+
export * from './fonts.ts';
|
|
5
|
+
export * from './geometry.ts';
|
|
6
|
+
export { default as LbxViewer, type LbxViewerProps } from './lbx-viewer.tsx';
|
|
7
|
+
export type { LbxLabel, LbxObject, LbxPaper, LbxPosition, LbxTextObject } from './parse.ts';
|
|
8
|
+
export * from './raster.ts';
|
|
9
|
+
export * from './tape-stocks.ts';
|
|
10
|
+
export * from './text-layout.ts';
|
|
11
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,cAAc,mBAAmB,CAAC;AAClC,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,KAAK,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAC7E,YAAY,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAC5F,cAAc,aAAa,CAAC;AAC5B,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export * from './colors.js';
|
|
2
|
+
export { lbxDefinition } from './definitions.js';
|
|
3
|
+
export * from './font-metrics.js';
|
|
4
|
+
export * from './fonts.js';
|
|
5
|
+
export * from './geometry.js';
|
|
6
|
+
export { default as LbxViewer } from './lbx-viewer.js';
|
|
7
|
+
export * from './raster.js';
|
|
8
|
+
export * from './tape-stocks.js';
|
|
9
|
+
export * from './text-layout.js';
|
|
10
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,cAAc,mBAAmB,CAAC;AAClC,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,OAAO,EAAE,OAAO,IAAI,SAAS,EAAuB,MAAM,iBAAkB,CAAC;AAE7E,cAAc,aAAa,CAAC;AAC5B,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type ViewerProps } from '@formless63/viewer-core';
|
|
2
|
+
import { type LbxColors } from './colors.ts';
|
|
3
|
+
import { type LbxFonts } from './font-metrics.ts';
|
|
4
|
+
import type { LbxLabel } from './parse.ts';
|
|
5
|
+
export interface LbxViewerProps extends ViewerProps {
|
|
6
|
+
/** Faces the host loads, keyed by the Brother font name in the file. */
|
|
7
|
+
fonts?: LbxFonts | undefined;
|
|
8
|
+
/** Colours for files that declare no stock. Defaults to black on white. */
|
|
9
|
+
fallbackColors?: LbxColors | undefined;
|
|
10
|
+
/** Offer the tape-stock preview selector. Defaults to true. */
|
|
11
|
+
stockSelector?: boolean | undefined;
|
|
12
|
+
/** Called with the parsed label, e.g. to show its metadata. */
|
|
13
|
+
onLabel?: ((label: LbxLabel) => void) | undefined;
|
|
14
|
+
}
|
|
15
|
+
/** Brother P-touch `.lbx` labels as a two-tone SVG approximation of the print. */
|
|
16
|
+
export default function LbxViewer({ fonts, fallbackColors, stockSelector, onLabel, ...props }: LbxViewerProps): import("react").JSX.Element;
|
|
17
|
+
//# sourceMappingURL=lbx-viewer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lbx-viewer.d.ts","sourceRoot":"","sources":["../src/lbx-viewer.tsx"],"names":[],"mappings":"AAIA,OAAO,EASL,KAAK,WAAW,EACjB,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EAA4C,KAAK,SAAS,EAAE,MAAM,aAAa,CAAC;AACvF,OAAO,EAAyB,KAAK,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAGzE,OAAO,KAAK,EAAE,QAAQ,EAA4B,MAAM,YAAY,CAAC;AAarE,MAAM,WAAW,cAAe,SAAQ,WAAW;IACjD,wEAAwE;IACxE,KAAK,CAAC,EAAE,QAAQ,GAAG,SAAS,CAAC;IAC7B,2EAA2E;IAC3E,cAAc,CAAC,EAAE,SAAS,GAAG,SAAS,CAAC;IACvC,+DAA+D;IAC/D,aAAa,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IACpC,+DAA+D;IAC/D,OAAO,CAAC,EAAE,CAAC,CAAC,KAAK,EAAE,QAAQ,KAAK,IAAI,CAAC,GAAG,SAAS,CAAC;CACnD;AASD,kFAAkF;AAClF,MAAM,CAAC,OAAO,UAAU,SAAS,CAAC,EAChC,KAAgB,EAChB,cAAmC,EACnC,aAAoB,EACpB,OAAO,EACP,GAAG,KAAK,EACT,EAAE,cAAc,+BAmKhB"}
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useEffect, useId, useMemo, useState } from 'react';
|
|
4
|
+
import { PanZoom, useResolvedSource, useViewerLoad, ViewerFailure, ViewerIcon, ViewerLoading, ViewerRoot, } from '@formless63/viewer-core';
|
|
5
|
+
import { DEFAULT_LBX_COLORS, resolveLbxBaseColors } from './colors.js';
|
|
6
|
+
import { resolveLbxFontMetrics } from './font-metrics.js';
|
|
7
|
+
import { LBX_CONDENSED_STACK, resolveLbxFontStack } from './fonts.js';
|
|
8
|
+
import { LBX_VIEW_BLEED_PT, resolveLbxGeometry } from './geometry.js';
|
|
9
|
+
import { LBX_BLEND_MODE, LBX_COVERAGE, LBX_NO_COVERAGE, LBX_OP_COVERAGE, resolveLbxPaintOps, } from './raster.js';
|
|
10
|
+
import { LBX_FILE_STOCK_ID, LBX_TAPE_STOCKS, resolveLbxTapeStock } from './tape-stocks.js';
|
|
11
|
+
import { resolveLbxTextBaselines, textLines } from './text-layout.js';
|
|
12
|
+
const NO_FONTS = {};
|
|
13
|
+
async function loadLabel(source, signal) {
|
|
14
|
+
const { parseLbxLabel } = await import('./parse.js');
|
|
15
|
+
return parseLbxLabel(await source.arrayBuffer(signal));
|
|
16
|
+
}
|
|
17
|
+
/** Brother P-touch `.lbx` labels as a two-tone SVG approximation of the print. */
|
|
18
|
+
export default function LbxViewer({ fonts = NO_FONTS, fallbackColors = DEFAULT_LBX_COLORS, stockSelector = true, onLabel, ...props }) {
|
|
19
|
+
// Mask ids must be unique per mounted viewer, or two labels on one page
|
|
20
|
+
// would share a single `url(#…)` target.
|
|
21
|
+
const maskSeed = useId();
|
|
22
|
+
const source = useResolvedSource(props);
|
|
23
|
+
const { onIntrinsicAspectRatio, onStatusChange, controls = true } = props;
|
|
24
|
+
const { state, retry } = useViewerLoad(source, loadLabel, { onStatusChange });
|
|
25
|
+
const label = state.value;
|
|
26
|
+
// Preview-only: never written to the file, and reset on every mount, so a
|
|
27
|
+
// label always opens on its own declared stock.
|
|
28
|
+
const [stockId, setStockId] = useState(LBX_FILE_STOCK_ID);
|
|
29
|
+
useEffect(() => {
|
|
30
|
+
if (label)
|
|
31
|
+
onLabel?.(label);
|
|
32
|
+
}, [label, onLabel]);
|
|
33
|
+
const geometry = useMemo(() => (label ? resolveLbxGeometry(label) : null), [label]);
|
|
34
|
+
// Measured on the bled viewBox, which is exactly what the SVG paints.
|
|
35
|
+
useEffect(() => {
|
|
36
|
+
if (!geometry || !onIntrinsicAspectRatio)
|
|
37
|
+
return;
|
|
38
|
+
const width = geometry.lengthPt + LBX_VIEW_BLEED_PT * 2;
|
|
39
|
+
const height = geometry.tapeWidthPt + LBX_VIEW_BLEED_PT * 2;
|
|
40
|
+
if (width > 0 && height > 0)
|
|
41
|
+
onIntrinsicAspectRatio(width / height);
|
|
42
|
+
}, [geometry, onIntrinsicAspectRatio]);
|
|
43
|
+
const name = source.file.name;
|
|
44
|
+
const shared = {
|
|
45
|
+
className: props.className,
|
|
46
|
+
label: name ? `Label: ${name}` : 'Label',
|
|
47
|
+
style: props.style,
|
|
48
|
+
viewer: 'lbx',
|
|
49
|
+
};
|
|
50
|
+
if (state.status === 'error') {
|
|
51
|
+
return (_jsx(ViewerRoot, { ...shared, status: 'error', children: _jsx(ViewerFailure, { error: state.error, onRetry: retry, source: source }) }));
|
|
52
|
+
}
|
|
53
|
+
if (!label || !geometry) {
|
|
54
|
+
return (_jsx(ViewerRoot, { ...shared, status: 'loading', children: _jsx(ViewerLoading, { message: 'Rendering label\u2026' }) }));
|
|
55
|
+
}
|
|
56
|
+
const fileColors = resolveLbxBaseColors(label, fallbackColors);
|
|
57
|
+
const stock = resolveLbxTapeStock(stockId);
|
|
58
|
+
const { tape, ink } = stock ?? fileColors;
|
|
59
|
+
const paints = resolveLbxPaintOps(label.objects);
|
|
60
|
+
const pad = LBX_VIEW_BLEED_PT;
|
|
61
|
+
const maskId = `lbx-ink-${maskSeed.replace(/[^a-zA-Z0-9_-]/g, '')}`;
|
|
62
|
+
const fileStockLabel = `File stock (${colorName(fileColors.ink)} on ${colorName(fileColors.tape)})`;
|
|
63
|
+
const stockLabel = `Preview tape stock: ${stock ? `${stock.label} · ${stock.tze}` : fileStockLabel} (preview only, does not change the file)`;
|
|
64
|
+
return (_jsx(ViewerRoot, { ...shared, status: 'ready', style: { background: 'var(--fv-muted)', ...props.style }, children: _jsx(PanZoom, { controls: controls, label: 'Label view', toolbar: controls && stockSelector ? (_jsxs("span", { className: 'fv-button', style: { position: 'relative' }, children: [_jsx(ViewerIcon, { name: 'palette' }), _jsxs("select", { "aria-label": stockLabel, onChange: (event) => setStockId(event.target.value), style: {
|
|
65
|
+
position: 'absolute',
|
|
66
|
+
inset: 0,
|
|
67
|
+
width: '100%',
|
|
68
|
+
height: '100%',
|
|
69
|
+
opacity: 0,
|
|
70
|
+
cursor: 'pointer',
|
|
71
|
+
}, title: stockLabel, value: stockId, children: [_jsx("option", { value: LBX_FILE_STOCK_ID, children: fileStockLabel }), _jsx("optgroup", { label: 'Brother TZe stock', children: LBX_TAPE_STOCKS.map((option) => (_jsxs("option", { value: option.id, children: [option.label, " \u00B7 ", option.tze] }, option.id))) })] })] })) : null, children: _jsxs("svg", { "aria-label": shared.label, className: 'fv-fill', "data-lbx-stock": stockId, preserveAspectRatio: 'xMidYMid meet', role: 'img', viewBox: `${-pad} ${-pad} ${geometry.lengthPt + pad * 2} ${geometry.tapeWidthPt + pad * 2}`, children: [_jsx("defs", { children: _jsx("mask", { height: geometry.tapeWidthPt + pad * 2, id: maskId, maskUnits: 'userSpaceOnUse', width: geometry.lengthPt + pad * 2, x: -pad, y: -pad, children: _jsxs("g", { "data-lbx-coverage": 'true', style: { isolation: 'isolate' }, children: [_jsx("rect", { fill: LBX_NO_COVERAGE, height: geometry.tapeWidthPt + pad * 2, width: geometry.lengthPt + pad * 2, x: -pad, y: -pad }), label.objects.map((obj, i) => renderObject(obj, `obj-${i}`, paints[i] ?? { fill: null, mark: 'set' }, fonts))] }) }) }), _jsx("rect", { "data-lbx-tape": 'true', fill: tape, height: geometry.tapeWidthPt, rx: 2, stroke: '#9ca3af', strokeWidth: 0.5, width: geometry.lengthPt, x: 0, y: 0 }), _jsx("rect", { "data-lbx-ink": 'true', fill: ink, height: geometry.tapeWidthPt + pad * 2, mask: `url(#${maskId})`, width: geometry.lengthPt + pad * 2, x: -pad, y: -pad })] }) }) }));
|
|
72
|
+
}
|
|
73
|
+
/** Falls back to the raw hex for anything besides plain black and white. */
|
|
74
|
+
function colorName(hex) {
|
|
75
|
+
if (hex === '#000000' || hex === '#000')
|
|
76
|
+
return 'Black';
|
|
77
|
+
if (hex === '#ffffff' || hex === '#fff')
|
|
78
|
+
return 'White';
|
|
79
|
+
return hex;
|
|
80
|
+
}
|
|
81
|
+
function renderTextObject(obj, key, op, fonts) {
|
|
82
|
+
const { angle = 0 } = obj.position;
|
|
83
|
+
const size = obj.font.size > 0 ? obj.font.size : 12;
|
|
84
|
+
const lines = textLines(obj);
|
|
85
|
+
const { cx, cy, textX, anchor, baselines, textLength } = resolveLbxTextBaselines(obj, resolveLbxFontMetrics(obj.font.name, fonts));
|
|
86
|
+
return (_jsx("g", { "data-lbx-blend": op, "data-lbx-object": 'text', style: { mixBlendMode: LBX_BLEND_MODE[op] }, transform: angle ? `rotate(${angle} ${cx} ${cy})` : undefined, children: lines.map((line, i) => (_jsx("text", { fill: LBX_OP_COVERAGE[op], fontFamily: resolveLbxFontStack(obj.font.name, fonts), fontSize: size, fontStyle: obj.font.italic ? 'italic' : undefined, fontWeight: (obj.font.weight ?? 400) >= 600 ? 'bold' : undefined,
|
|
87
|
+
// JUSTIFY: distribute the line across the frame,
|
|
88
|
+
// stretching the glyphs with it — the measurement that settles
|
|
89
|
+
// `spacingAndGlyphs` over the default `spacing` is in
|
|
90
|
+
// `resolveLbxTextBaselines`'s comment. Skipped for an empty line,
|
|
91
|
+
// where `textLength` has nothing to stretch.
|
|
92
|
+
lengthAdjust: textLength != null && line.length > 0 ? 'spacingAndGlyphs' : undefined, textAnchor: anchor, textDecoration: obj.textStyle?.underline ? 'underline' : undefined, textLength: textLength != null && line.length > 0 ? textLength : undefined, x: textX, y: baselines[i], children: line }, i))) }, key));
|
|
93
|
+
}
|
|
94
|
+
function renderPlaceholder(obj, key, labelText) {
|
|
95
|
+
const { x, y, width, height } = obj.position;
|
|
96
|
+
const captionSize = Math.min(6, Math.max(3.5, height * 0.3));
|
|
97
|
+
return (_jsxs("g", { "data-lbx-blend": 'set', "data-lbx-object": `placeholder-${obj.type}`, style: { mixBlendMode: LBX_BLEND_MODE.set }, children: [_jsx("rect", { fill: 'none', height: Math.max(height, 1), stroke: LBX_COVERAGE, strokeDasharray: '2 2', strokeWidth: 0.5, width: Math.max(width, 1), x: x, y: y }), _jsx("text", { fill: LBX_COVERAGE, fontFamily: LBX_CONDENSED_STACK, fontSize: captionSize, textAnchor: 'middle', x: x + width / 2, y: y + height / 2 + captionSize * 0.35, children: labelText })] }, key));
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Emit one parsed object into the ink-coverage mask. The ONLY per-object
|
|
101
|
+
* decision is its raster op, which picks both the coverage value it paints
|
|
102
|
+
* (`LBX_OP_COVERAGE`) and the blend mode that composites it
|
|
103
|
+
* (`LBX_BLEND_MODE`) — see the model block above. No stock colour is ever
|
|
104
|
+
* decided here. Each object yields exactly one `[data-lbx-object]` group so
|
|
105
|
+
* DOM order stays 1:1 with paint order.
|
|
106
|
+
*/
|
|
107
|
+
function renderObject(obj, key, paint, fonts) {
|
|
108
|
+
switch (obj.type) {
|
|
109
|
+
case 'text':
|
|
110
|
+
return renderTextObject(obj, key, paint.mark, fonts);
|
|
111
|
+
case 'rect': {
|
|
112
|
+
const { x, y, width, height } = obj.position;
|
|
113
|
+
// `shape` decides, and `shape="RECTANGLE"` means SQUARE whatever the
|
|
114
|
+
// roundness says: P-touch stores an inert default of a quarter of the
|
|
115
|
+
// short side on every rect, and a printed label with those values
|
|
116
|
+
// measures hard right angles. When a rect IS rounded, roundnessX/Y are GDI
|
|
117
|
+
// `RoundRect` ellipse DIAMETERS, so SVG's radii are half. That half follows
|
|
118
|
+
// the documented Win32 convention; no reference label exercises it.
|
|
119
|
+
const roundnessX = obj.roundnessX ?? 0;
|
|
120
|
+
const roundnessY = obj.roundnessY ?? 0;
|
|
121
|
+
const rounded = obj.shape !== 'RECTANGLE' && (roundnessX > 0 || roundnessY > 0);
|
|
122
|
+
const rx = rounded ? (roundnessX || roundnessY) / 2 : undefined;
|
|
123
|
+
const ry = rounded ? (roundnessY || roundnessX) / 2 : undefined;
|
|
124
|
+
// `parseBrush` already drops `style="NULL"` brushes entirely (returns
|
|
125
|
+
// undefined), so any present brush — SOLID or PATTERN — paints a fill.
|
|
126
|
+
// PATTERN renders as a flat fill (no hatch texture); documented
|
|
127
|
+
// near-fidelity gap, see the file-level doc comment.
|
|
128
|
+
const fillOp = paint.fill;
|
|
129
|
+
// A rect with neither pen nor any brush fill would be invisible — draw
|
|
130
|
+
// the outline anyway so the reader sees what P-touch would print.
|
|
131
|
+
const penned = obj.pen != null;
|
|
132
|
+
const outlined = penned || fillOp == null;
|
|
133
|
+
// A real pen stroke obeys the object's raster op like any other paint;
|
|
134
|
+
// the pen-less "so the reader can see it" outline is viewer chrome
|
|
135
|
+
// and always sets, so it can never come out invisible.
|
|
136
|
+
const outlineOp = penned ? paint.mark : 'set';
|
|
137
|
+
return (_jsxs("g", { "data-lbx-object": 'rect', "data-lbx-rop": (obj.position.ropMode ?? 'COPYPEN').trim().toUpperCase(), children: [fillOp ? (_jsx("rect", { "data-lbx-blend": fillOp, "data-lbx-part": 'fill', fill: LBX_OP_COVERAGE[fillOp], height: height, rx: rx, ry: ry, style: { mixBlendMode: LBX_BLEND_MODE[fillOp] }, width: width, x: x, y: y })) : null, outlined ? (_jsx("rect", { "data-lbx-blend": outlineOp, "data-lbx-part": 'outline', fill: 'none', height: height, rx: rx, ry: ry, stroke: LBX_OP_COVERAGE[outlineOp], strokeWidth: Math.max(obj.pen?.widthX ?? 1, 0.4), style: { mixBlendMode: LBX_BLEND_MODE[outlineOp] }, width: width, x: x, y: y })) : null] }, key));
|
|
138
|
+
}
|
|
139
|
+
case 'line': {
|
|
140
|
+
const points = obj.points.map((p) => `${p.x},${p.y}`).join(' ');
|
|
141
|
+
if (!points)
|
|
142
|
+
return null;
|
|
143
|
+
return (_jsx("g", { "data-lbx-blend": paint.mark, "data-lbx-object": 'line', children: _jsx("polyline", { fill: 'none', points: points, stroke: LBX_OP_COVERAGE[paint.mark], strokeWidth: Math.max(obj.pen?.widthX ?? 1, 0.4), style: { mixBlendMode: LBX_BLEND_MODE[paint.mark] } }) }, key));
|
|
144
|
+
}
|
|
145
|
+
case 'barcode':
|
|
146
|
+
return renderPlaceholder(obj, key, `Barcode · ${obj.protocol}`);
|
|
147
|
+
case 'image':
|
|
148
|
+
return renderPlaceholder(obj, key, `Image${obj.originalName ? ` · ${obj.originalName}` : ''}`);
|
|
149
|
+
default:
|
|
150
|
+
return renderPlaceholder(obj, key, 'Unsupported object');
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
//# sourceMappingURL=lbx-viewer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lbx-viewer.js","sourceRoot":"","sources":["../src/lbx-viewer.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAkB,MAAM,OAAO,CAAC;AAE5E,OAAO,EACL,OAAO,EACP,iBAAiB,EACjB,aAAa,EACb,aAAa,EACb,UAAU,EACV,aAAa,EACb,UAAU,GAGX,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EAAE,kBAAkB,EAAE,oBAAoB,EAAkB,MAAM,aAAa,CAAC;AACvF,OAAO,EAAE,qBAAqB,EAAiB,MAAM,mBAAmB,CAAC;AACzE,OAAO,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AACtE,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAEtE,OAAO,EACL,cAAc,EACd,YAAY,EACZ,eAAe,EACf,eAAe,EACf,kBAAkB,GAGnB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAC3F,OAAO,EAAE,uBAAuB,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAatE,MAAM,QAAQ,GAAa,EAAE,CAAC;AAE9B,KAAK,UAAU,SAAS,CAAC,MAAsB,EAAE,MAAmB;IAClE,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C,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;YAChE,IAAI,CAAC,MAAM;gBAAE,OAAO,IAAI,CAAC;YACzB,OAAO,CACL,8BAAmB,KAAK,CAAC,IAAI,qBAAkB,MAAM,YACnD,mBACE,IAAI,EAAC,MAAM,EACX,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,eAAe,CAAC,KAAK,CAAC,IAAI,CAAC,EACnC,WAAW,EAAE,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,EAAE,MAAM,IAAI,CAAC,EAAE,GAAG,CAAC,EAChD,KAAK,EAAE,EAAE,YAAY,EAAE,cAAc,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,GACnD,IAPuD,GAAG,CAQ1D,CACL,CAAC;QACJ,CAAC;QACD,KAAK,SAAS;YACZ,OAAO,iBAAiB,CAAC,GAAG,EAAE,GAAG,EAAE,aAAa,GAAG,CAAC,QAAQ,EAAE,CAAC,CAAC;QAClE,KAAK,OAAO;YACV,OAAO,iBAAiB,CACtB,GAAG,EACH,GAAG,EACH,QAAQ,GAAG,CAAC,YAAY,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC,YAAY,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,CAC3D,CAAC;QACJ;YACE,OAAO,iBAAiB,CAAC,GAAgB,EAAE,GAAG,EAAE,oBAAoB,CAAC,CAAC;IAC1E,CAAC;AACH,CAAC"}
|
package/dist/parse.d.ts
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { type BrushConfig, type BrushStyle, type LabelConfig, type LabelObject, type ObjectPosition, type PaperConfig } from 'bil-lbx';
|
|
2
|
+
/** Attributes `bil-lbx` does not surface, read from the same `label.xml`. */
|
|
3
|
+
export interface LbxPosition extends ObjectPosition {
|
|
4
|
+
/**
|
|
5
|
+
* GDI raster-operation mode. `NOTCOPYPEN` is how P-touch renders knockout
|
|
6
|
+
* regions; without it every object paints as ink and reversed text vanishes.
|
|
7
|
+
* A string, not a union: P-touch can emit any of the sixteen ROP2 names.
|
|
8
|
+
*/
|
|
9
|
+
ropMode?: string | undefined;
|
|
10
|
+
}
|
|
11
|
+
export interface LbxPaper extends PaperConfig {
|
|
12
|
+
/** Physical stock colour, e.g. `#000000` for black tape. */
|
|
13
|
+
paperColor?: string | undefined;
|
|
14
|
+
/** Ink colour, e.g. `#FFFFFF`. */
|
|
15
|
+
paperInk?: string | undefined;
|
|
16
|
+
}
|
|
17
|
+
export interface LbxBrush extends Omit<BrushConfig, 'style'> {
|
|
18
|
+
/** Real P-touch files write `PATTERN` for a plain filled box; upstream's union omits it. */
|
|
19
|
+
style: BrushStyle | 'PATTERN';
|
|
20
|
+
}
|
|
21
|
+
type Widen<T extends LabelObject> = T extends LabelObject ? Omit<T, 'position' | 'brush'> & {
|
|
22
|
+
position: LbxPosition;
|
|
23
|
+
brush?: LbxBrush | undefined;
|
|
24
|
+
} : never;
|
|
25
|
+
export type LbxObject = Widen<LabelObject>;
|
|
26
|
+
export type LbxTextObject = Extract<LbxObject, {
|
|
27
|
+
type: 'text';
|
|
28
|
+
}>;
|
|
29
|
+
export type LbxLabel = Omit<LabelConfig, 'objects' | 'paper'> & {
|
|
30
|
+
paper: LbxPaper;
|
|
31
|
+
objects: LbxObject[];
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* Parse a `.lbx` with upstream `bil-lbx`, then add `ropMode`, `paperColor` and
|
|
35
|
+
* `paperInk`. A supplement rather than a patched dependency, because package
|
|
36
|
+
* manager patches do not travel to a library's consumers.
|
|
37
|
+
*/
|
|
38
|
+
export declare function parseLbxLabel(data: ArrayBuffer | Uint8Array): Promise<LbxLabel>;
|
|
39
|
+
/** Mutates `label` in place. Exported for tests. */
|
|
40
|
+
export declare function supplementLabel(label: LbxLabel, labelXml: string): void;
|
|
41
|
+
export {};
|
|
42
|
+
//# source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CAAC;CACtB,CAAC;AAgBF;;;;GAIG;AACH,wBAAsB,aAAa,CAAC,IAAI,EAAE,WAAW,GAAG,UAAU,GAAG,OAAO,CAAC,QAAQ,CAAC,CAQrF;AAED,oDAAoD;AACpD,wBAAgB,eAAe,CAAC,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,CA6BvE"}
|
package/dist/parse.js
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { XMLParser } from 'fast-xml-parser';
|
|
2
|
+
import JSZip from 'jszip';
|
|
3
|
+
import { parseLbx as parseUpstream, } from 'bil-lbx';
|
|
4
|
+
/** label.xml is kilobytes; this stops a hostile ZIP from inflating without bound. */
|
|
5
|
+
const MAX_LABEL_XML_BYTES = 8 * 1024 * 1024;
|
|
6
|
+
const MAX_TOTAL_BYTES = 64 * 1024 * 1024;
|
|
7
|
+
const TAG_BY_TYPE = {
|
|
8
|
+
text: 'text:text',
|
|
9
|
+
rect: 'draw:rect',
|
|
10
|
+
line: 'draw:poly',
|
|
11
|
+
image: 'image:image',
|
|
12
|
+
barcode: 'barcode:barcode',
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* Parse a `.lbx` with upstream `bil-lbx`, then add `ropMode`, `paperColor` and
|
|
16
|
+
* `paperInk`. A supplement rather than a patched dependency, because package
|
|
17
|
+
* manager patches do not travel to a library's consumers.
|
|
18
|
+
*/
|
|
19
|
+
export async function parseLbxLabel(data) {
|
|
20
|
+
const zip = await JSZip.loadAsync(data);
|
|
21
|
+
assertReasonableSize(zip);
|
|
22
|
+
const labelXml = await zip.file('label.xml')?.async('string');
|
|
23
|
+
if (labelXml === undefined)
|
|
24
|
+
throw new Error('Not a .lbx file: label.xml is missing');
|
|
25
|
+
const label = (await parseUpstream(data));
|
|
26
|
+
supplementLabel(label, labelXml);
|
|
27
|
+
return label;
|
|
28
|
+
}
|
|
29
|
+
/** Mutates `label` in place. Exported for tests. */
|
|
30
|
+
export function supplementLabel(label, labelXml) {
|
|
31
|
+
const parser = new XMLParser({
|
|
32
|
+
ignoreAttributes: false,
|
|
33
|
+
attributeNamePrefix: '@_',
|
|
34
|
+
parseAttributeValue: false,
|
|
35
|
+
parseTagValue: false,
|
|
36
|
+
});
|
|
37
|
+
const sheet = child(child(child(parser.parse(labelXml), 'pt:document'), 'pt:body'), 'style:sheet');
|
|
38
|
+
const paper = child(sheet, 'style:paper');
|
|
39
|
+
const paperColor = attr(paper, 'paperColor');
|
|
40
|
+
if (paperColor)
|
|
41
|
+
label.paper.paperColor = paperColor;
|
|
42
|
+
const paperInk = attr(paper, 'paperInk');
|
|
43
|
+
if (paperInk)
|
|
44
|
+
label.paper.paperInk = paperInk;
|
|
45
|
+
// bil-lbx restores document order across element kinds, and order WITHIN a
|
|
46
|
+
// kind always matches the document, so the nth object of a kind is that
|
|
47
|
+
// kind's nth element.
|
|
48
|
+
const objects = child(sheet, 'pt:objects');
|
|
49
|
+
const seen = {};
|
|
50
|
+
for (const obj of label.objects) {
|
|
51
|
+
const tag = TAG_BY_TYPE[obj.type];
|
|
52
|
+
const index = seen[tag] ?? 0;
|
|
53
|
+
seen[tag] = index + 1;
|
|
54
|
+
const ropMode = attr(child(asArray(objects?.[tag])[index], 'pt:objectStyle'), 'ropMode');
|
|
55
|
+
if (ropMode)
|
|
56
|
+
obj.position.ropMode = ropMode;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
function assertReasonableSize(zip) {
|
|
60
|
+
let total = 0;
|
|
61
|
+
for (const entry of Object.values(zip.files)) {
|
|
62
|
+
// Not in JSZip's public types; absent means unknown, which is not refused.
|
|
63
|
+
const size = entry._data
|
|
64
|
+
?.uncompressedSize;
|
|
65
|
+
if (typeof size !== 'number')
|
|
66
|
+
continue;
|
|
67
|
+
total += size;
|
|
68
|
+
if (entry.name === 'label.xml' && size > MAX_LABEL_XML_BYTES) {
|
|
69
|
+
throw new Error('label.xml is implausibly large');
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
if (total > MAX_TOTAL_BYTES)
|
|
73
|
+
throw new Error('The label archive is implausibly large');
|
|
74
|
+
}
|
|
75
|
+
function child(node, name) {
|
|
76
|
+
if (typeof node !== 'object' || node === null)
|
|
77
|
+
return undefined;
|
|
78
|
+
const value = node[name];
|
|
79
|
+
return typeof value === 'object' && value !== null ? value : undefined;
|
|
80
|
+
}
|
|
81
|
+
function attr(node, name) {
|
|
82
|
+
const value = node?.[`@_${name}`];
|
|
83
|
+
return value === undefined || value === null ? undefined : String(value);
|
|
84
|
+
}
|
|
85
|
+
function asArray(value) {
|
|
86
|
+
if (value === undefined || value === null)
|
|
87
|
+
return [];
|
|
88
|
+
return Array.isArray(value) ? value : [value];
|
|
89
|
+
}
|
|
90
|
+
//# sourceMappingURL=parse.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parse.js","sourceRoot":"","sources":["../src/parse.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EACL,QAAQ,IAAI,aAAa,GAO1B,MAAM,SAAS,CAAC;AAoCjB,qFAAqF;AACrF,MAAM,mBAAmB,GAAG,CAAC,GAAG,IAAI,GAAG,IAAI,CAAC;AAC5C,MAAM,eAAe,GAAG,EAAE,GAAG,IAAI,GAAG,IAAI,CAAC;AAEzC,MAAM,WAAW,GAAG;IAClB,IAAI,EAAE,WAAW;IACjB,IAAI,EAAE,WAAW;IACjB,IAAI,EAAE,WAAW;IACjB,KAAK,EAAE,aAAa;IACpB,OAAO,EAAE,iBAAiB;CAC4B,CAAC;AAIzD;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,IAA8B;IAChE,MAAM,GAAG,GAAG,MAAM,KAAK,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;IACxC,oBAAoB,CAAC,GAAG,CAAC,CAAC;IAC1B,MAAM,QA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AAC,CAAC;IACtC,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,CAAC,CAAC,CAAE,KAAiB,CAAC,CAAC,CAAC,SAAS,CAAC;AACtF,CAAC;AAED,SAAS,IAAI,CAAC,IAAyB,EAAE,IAAY;IACnD,MAAM,KAAK,GAAG,IAAI,EAAE,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC;IAClC,OAAO,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AAC3E,CAAC;AAED,SAAS,OAAO,CAAC,KAAc;IAC7B,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,IAAI;QAAE,OAAO,EAAE,CAAC;IACrD,OAAO,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;AAChD,CAAC"}
|
package/dist/raster.d.ts
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { LbxObject } from './parse.ts';
|
|
2
|
+
/** One dot of a two-tone label: bare stock, or printed. */
|
|
3
|
+
export type LbxSurface = 'tape' | 'ink';
|
|
4
|
+
/**
|
|
5
|
+
* What an object's paint does to the ink-coverage raster, straight off the
|
|
6
|
+
* Win32 `R2_*` definitions: `set` = `dst := ink` (COPYPEN), `clear` =
|
|
7
|
+
* `dst := tape` (NOTCOPYPEN, whose pen is ink so `NOT pen` is tape), `flip` =
|
|
8
|
+
* `dst := NOT dst` (NOT).
|
|
9
|
+
*/
|
|
10
|
+
export type LbxPaintOp = 'set' | 'clear' | 'flip';
|
|
11
|
+
/** CSS blend mode that realises each op inside the coverage mask. */
|
|
12
|
+
export declare const LBX_BLEND_MODE: Record<LbxPaintOp, 'normal' | 'difference'>;
|
|
13
|
+
/** Full coverage inside the mask — "fire a dot here". */
|
|
14
|
+
export declare const LBX_COVERAGE = "#ffffff";
|
|
15
|
+
/** No coverage — bare tape. */
|
|
16
|
+
export declare const LBX_NO_COVERAGE = "#000000";
|
|
17
|
+
/** the value each op paints into the coverage mask. */
|
|
18
|
+
export declare const LBX_OP_COVERAGE: Record<LbxPaintOp, string>;
|
|
19
|
+
/**
|
|
20
|
+
* The raster-op decision: COPYPEN lays ink, NOTCOPYPEN erases to tape, NOT inverts,
|
|
21
|
+
* anything else is treated as COPYPEN.
|
|
22
|
+
*
|
|
23
|
+
* The object's own `color` is deliberately not consulted. It is the same
|
|
24
|
+
* boilerplate on every object of a label, so it cannot tell a field from a badge;
|
|
25
|
+
* `printColorNumber` names the print channel, not a physical colour.
|
|
26
|
+
*/
|
|
27
|
+
export declare function resolveLbxRopOp(ropMode: string | undefined): LbxPaintOp;
|
|
28
|
+
/** The op an object's area fill applies, or null when it fills no area. */
|
|
29
|
+
export declare function resolveLbxAreaFillOp(obj: LbxObject): LbxPaintOp | null;
|
|
30
|
+
export interface LbxObjectPaint {
|
|
31
|
+
/** Op this object's area fill applies; null when it fills no area. */
|
|
32
|
+
fill: LbxPaintOp | null;
|
|
33
|
+
/** Op this object's glyphs / strokes apply — its own raster op. */
|
|
34
|
+
mark: LbxPaintOp;
|
|
35
|
+
}
|
|
36
|
+
/** Every object's operations. Per object, never geometric. */
|
|
37
|
+
export declare function resolveLbxPaintOps(objects: readonly LbxObject[]): LbxObjectPaint[];
|
|
38
|
+
/**
|
|
39
|
+
* The surface at a point, from the area fills of `objects` (or the first `upTo`).
|
|
40
|
+
* A reference evaluator for tests; rendering uses the mask.
|
|
41
|
+
*/
|
|
42
|
+
export declare function resolveLbxSurfaceAt(objects: readonly LbxObject[], x: number, y: number, upTo?: number): LbxSurface;
|
|
43
|
+
/** The tone a mark of `objects[index]` prints at a point. */
|
|
44
|
+
export declare function resolveLbxMarkSurfaceAt(objects: readonly LbxObject[], index: number, x: number, y: number): LbxSurface;
|
|
45
|
+
//# sourceMappingURL=raster.d.ts.map
|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E,SAAS,SAAS,EAAE,EAC7B,KAAK,EAAE,MAAM,EACb,CAAC,EAAE,MAAM,EACT,CAAC,EAAE,MAAM,GACR,UAAU,CAGZ"}
|
package/dist/raster.js
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/** CSS blend mode that realises each op inside the coverage mask. */
|
|
2
|
+
export const LBX_BLEND_MODE = {
|
|
3
|
+
// Opaque paints — the composite is ordered painting, not blending.
|
|
4
|
+
set: 'normal',
|
|
5
|
+
clear: 'normal',
|
|
6
|
+
// On a 0/1 raster, `difference` against white is exactly XOR.
|
|
7
|
+
flip: 'difference',
|
|
8
|
+
};
|
|
9
|
+
/** Full coverage inside the mask — "fire a dot here". */
|
|
10
|
+
export const LBX_COVERAGE = '#ffffff';
|
|
11
|
+
/** No coverage — bare tape. */
|
|
12
|
+
export const LBX_NO_COVERAGE = '#000000';
|
|
13
|
+
/** the value each op paints into the coverage mask. */
|
|
14
|
+
export const LBX_OP_COVERAGE = {
|
|
15
|
+
set: LBX_COVERAGE,
|
|
16
|
+
clear: LBX_NO_COVERAGE,
|
|
17
|
+
// `difference` needs full white to invert what is under it.
|
|
18
|
+
flip: LBX_COVERAGE,
|
|
19
|
+
};
|
|
20
|
+
/** The two-tone NOT. */
|
|
21
|
+
function opposite(s) {
|
|
22
|
+
return s === 'ink' ? 'tape' : 'ink';
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* The raster-op decision: COPYPEN lays ink, NOTCOPYPEN erases to tape, NOT inverts,
|
|
26
|
+
* anything else is treated as COPYPEN.
|
|
27
|
+
*
|
|
28
|
+
* The object's own `color` is deliberately not consulted. It is the same
|
|
29
|
+
* boilerplate on every object of a label, so it cannot tell a field from a badge;
|
|
30
|
+
* `printColorNumber` names the print channel, not a physical colour.
|
|
31
|
+
*/
|
|
32
|
+
export function resolveLbxRopOp(ropMode) {
|
|
33
|
+
switch (ropMode?.trim().toUpperCase()) {
|
|
34
|
+
case 'NOTCOPYPEN':
|
|
35
|
+
return 'clear';
|
|
36
|
+
case 'NOT':
|
|
37
|
+
return 'flip';
|
|
38
|
+
default:
|
|
39
|
+
return 'set';
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
/** Does this object paint a filled area (and therefore change the surface)? */
|
|
43
|
+
function areaFillOf(obj) {
|
|
44
|
+
return obj.type === 'rect' && obj.brush != null;
|
|
45
|
+
}
|
|
46
|
+
/** The op an object's area fill applies, or null when it fills no area. */
|
|
47
|
+
export function resolveLbxAreaFillOp(obj) {
|
|
48
|
+
if (!areaFillOf(obj))
|
|
49
|
+
return null;
|
|
50
|
+
return resolveLbxRopOp(obj.position.ropMode);
|
|
51
|
+
}
|
|
52
|
+
/** Every object's operations. Per object, never geometric. */
|
|
53
|
+
export function resolveLbxPaintOps(objects) {
|
|
54
|
+
return objects.map((obj) => ({
|
|
55
|
+
// The one and only raster-op decision — see resolveLbxRopOp.
|
|
56
|
+
fill: resolveLbxAreaFillOp(obj),
|
|
57
|
+
mark: resolveLbxRopOp(obj.position.ropMode),
|
|
58
|
+
}));
|
|
59
|
+
}
|
|
60
|
+
/** Apply one op to a surface. The whole raster model, in three cases. */
|
|
61
|
+
function applyOp(surface, op) {
|
|
62
|
+
return op === 'set' ? 'ink' : op === 'clear' ? 'tape' : opposite(surface);
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* The surface at a point, from the area fills of `objects` (or the first `upTo`).
|
|
66
|
+
* A reference evaluator for tests; rendering uses the mask.
|
|
67
|
+
*/
|
|
68
|
+
export function resolveLbxSurfaceAt(objects, x, y, upTo = objects.length) {
|
|
69
|
+
const ops = resolveLbxPaintOps(objects);
|
|
70
|
+
let surface = 'tape';
|
|
71
|
+
for (let i = 0; i < Math.min(upTo, objects.length); i++) {
|
|
72
|
+
const op = ops[i]?.fill;
|
|
73
|
+
const p = objects[i]?.position;
|
|
74
|
+
if (!op || !p)
|
|
75
|
+
continue;
|
|
76
|
+
if (x < p.x || x > p.x + p.width || y < p.y || y > p.y + p.height)
|
|
77
|
+
continue;
|
|
78
|
+
surface = applyOp(surface, op);
|
|
79
|
+
}
|
|
80
|
+
return surface;
|
|
81
|
+
}
|
|
82
|
+
/** The tone a mark of `objects[index]` prints at a point. */
|
|
83
|
+
export function resolveLbxMarkSurfaceAt(objects, index, x, y) {
|
|
84
|
+
const op = resolveLbxPaintOps(objects)[index]?.mark ?? 'set';
|
|
85
|
+
return applyOp(resolveLbxSurfaceAt(objects, x, y, index), op);
|
|
86
|
+
}
|
|
87
|
+
//# sourceMappingURL=raster.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"raster.js","sourceRoot":"","sources":["../src/raster.ts"],"names":[],"mappings":"AA6CA,qEAAqE;AACrE,MAAM,CAAC,MAAM,cAAc,GAAgD;IACzE,mEAAmE;IACnE,GAAG,EAAE,QAAQ;IACb,KAAK,EAAE,QAAQ;IACf,8DAA8D;IAC9D,IAAI,EAAE,YAAY;CACnB,CAAC;AAEF,yDAAyD;AACzD,MAAM,CAAC,MAAM,YAAY,GAAG,SAAS,CAAC;AACtC,+BAA+B;AAC/B,MAAM,CAAC,MAAM,eAAe,GAAG,SAAS,CAAC;AAEzC,uDAAuD;AACvD,MAAM,CAAC,MAAM,eAAe,GAA+B;IACzD,GAAG,EAAE,YAAY;IACjB,KAAK,EAAE,eAAe;IACtB,4DAA4D;IAC5D,IAAI,EAAE,YAAY;CACnB,CAAC;AAEF,wBAAwB;AACxB,SAAS,QAAQ,CAAC,CAAa;IAC7B,OAAO,CAAC,KAAK,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC;AACtC,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,eAAe,CAAC,OAA2B;IACzD,QAAQ,OAAO,EAAE,IAAI,EAAE,CAAC,WAAW,EAAE,EAAE,CAAC;QACtC,KAAK,YAAY;YACf,OAAO,OAAO,CAAC;QACjB,KAAK,KAAK;YACR,OAAO,MAAM,CAAC;QAChB;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EAAE,CAAC,EAAE,EAAE,CAAC;QACxD,MAAM,EAAE,GAAG,GAAG,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC;QACxB,MAAM,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,EAAE,QAAQ,CAAC;QAC/B,IAAI,CAAC,EAAE,IAAI,CAAC,CAAC;YAAE,SAAS;QACxB,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,MAAM;YAAE,SAAS;QAC5E,OAAO,GAAG,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;IACjC,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,6DAA6D;AAC7D,MAAM,UAAU,uBAAuB,CACrC,OAA6B,EAC7B,KAAa,EACb,CAAS,EACT,CAAS;IAET,MAAM,EAAE,GAAG,kBAAkB,CAAC,OAAO,CAAC,CAAC,KAAK,CAAC,EAAE,IAAI,IAAI,KAAK,CAAC;IAC7D,OAAO,OAAO,CAAC,mBAAmB,CAAC,OAAO,EAAE,CAAC,EAAE,CAAC,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,CAAC;AAChE,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Brother TZe tape stocks, for previewing a label on another cassette.
|
|
3
|
+
*
|
|
4
|
+
* Pairs, not two pickers: tape and ink are fixed together at manufacture, so a list
|
|
5
|
+
* of real cassettes can only preview what can be printed. Part numbers are
|
|
6
|
+
* Brother's published ones. Colours approximate the stock on a screen; clear tape
|
|
7
|
+
* renders as if stuck to something white.
|
|
8
|
+
*
|
|
9
|
+
* A preview only: nothing is written to the file or remembered.
|
|
10
|
+
*/
|
|
11
|
+
export interface LbxTapeStock {
|
|
12
|
+
/** Stable id used as the `<select>` value and the `data-lbx-stock` attribute. */
|
|
13
|
+
id: string;
|
|
14
|
+
/** Ink (foreground / printed dots) colour. */
|
|
15
|
+
ink: string;
|
|
16
|
+
/** Tape (background / bare stock) colour. */
|
|
17
|
+
tape: string;
|
|
18
|
+
/** Short human label, e.g. "White on black". */
|
|
19
|
+
label: string;
|
|
20
|
+
/**
|
|
21
|
+
* Representative Brother part number for the combination. Several widths
|
|
22
|
+
* (and matte/flexible/strong-adhesive variants) share a combination; the
|
|
23
|
+
* number is the common 12mm laminated cassette, quoted so the row can be
|
|
24
|
+
* verified against Brother's catalogue.
|
|
25
|
+
*/
|
|
26
|
+
tze: string;
|
|
27
|
+
}
|
|
28
|
+
/** The file's own declared stock: the default. */
|
|
29
|
+
export declare const LBX_FILE_STOCK_ID = "file";
|
|
30
|
+
/** White on black and black on white first, then grouped by tape colour. */
|
|
31
|
+
export declare const LBX_TAPE_STOCKS: readonly LbxTapeStock[];
|
|
32
|
+
/** The stock for an id, or null (the file's own colours) for anything else. */
|
|
33
|
+
export declare function resolveLbxTapeStock(id: unknown): LbxTapeStock | null;
|
|
34
|
+
//# sourceMappingURL=tape-stocks.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tape-stocks.d.ts","sourceRoot":"","sources":["../src/tape-stocks.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,MAAM,WAAW,YAAY;IAC3B,iFAAiF;IACjF,EAAE,EAAE,MAAM,CAAC;IACX,8CAA8C;IAC9C,GAAG,EAAE,MAAM,CAAC;IACZ,6CAA6C;IAC7C,IAAI,EAAE,MAAM,CAAC;IACb,gDAAgD;IAChD,KAAK,EAAE,MAAM,CAAC;IACd;;;;;OAKG;IACH,GAAG,EAAE,MAAM,CAAC;CACb;AAED,kDAAkD;AAClD,eAAO,MAAM,iBAAiB,SAAS,CAAC;AAExC,4EAA4E;AAC5E,eAAO,MAAM,eAAe,EAAE,SAAS,YAAY,EA8ElD,CAAC;AAEF,+EAA+E;AAC/E,wBAAgB,mBAAmB,CAAC,EAAE,EAAE,OAAO,GAAG,YAAY,GAAG,IAAI,CAGpE"}
|