postext 1.75.0 → 1.76.1
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/README.md +2 -1
- package/dist/__tests__/exports.test.js +58 -0
- package/dist/__tests__/exports.test.js.map +1 -1
- package/dist/__tests__/pipeline/text/justifiedHardBreaks.test.d.ts +2 -0
- package/dist/__tests__/pipeline/text/justifiedHardBreaks.test.d.ts.map +1 -0
- package/dist/__tests__/pipeline/text/justifiedHardBreaks.test.js +117 -0
- package/dist/__tests__/pipeline/text/justifiedHardBreaks.test.js.map +1 -0
- package/dist/defaults/text/bodyText/resolve.d.ts.map +1 -1
- package/dist/defaults/text/bodyText/resolve.js +2 -0
- package/dist/defaults/text/bodyText/resolve.js.map +1 -1
- package/dist/defaults/text/bodyText/strip.d.ts.map +1 -1
- package/dist/defaults/text/bodyText/strip.js +5 -0
- package/dist/defaults/text/bodyText/strip.js.map +1 -1
- package/dist/measure/cache.js +1 -1
- package/dist/measure/cache.js.map +1 -1
- package/dist/measure/hardBreaks.d.ts +13 -2
- package/dist/measure/hardBreaks.d.ts.map +1 -1
- package/dist/measure/hardBreaks.js +42 -6
- package/dist/measure/hardBreaks.js.map +1 -1
- package/dist/measure/rich/measure.js +1 -1
- package/dist/measure/rich/measure.js.map +1 -1
- package/dist/measure/types.d.ts +6 -0
- package/dist/measure/types.d.ts.map +1 -1
- package/dist/measure/types.js.map +1 -1
- package/dist/pipeline/blocks/measureContentBlock/measureOptions.d.ts +1 -0
- package/dist/pipeline/blocks/measureContentBlock/measureOptions.d.ts.map +1 -1
- package/dist/pipeline/blocks/measureContentBlock/measureOptions.js +3 -0
- package/dist/pipeline/blocks/measureContentBlock/measureOptions.js.map +1 -1
- package/dist/types/text/bodyText/config.d.ts +11 -0
- package/dist/types/text/bodyText/config.d.ts.map +1 -1
- package/dist/types/text/bodyText/resolved.d.ts +3 -0
- package/dist/types/text/bodyText/resolved.d.ts.map +1 -1
- package/dist/vdt/lines.d.ts +3 -1
- package/dist/vdt/lines.d.ts.map +1 -1
- package/dist/writer/index.d.ts +20 -0
- package/dist/writer/index.d.ts.map +1 -0
- package/dist/writer/index.js +21 -0
- package/dist/writer/index.js.map +1 -0
- package/package.json +4 -4
- package/dist/idml/colours.d.ts +0 -14
- package/dist/idml/colours.d.ts.map +0 -1
- package/dist/idml/colours.js +0 -53
- package/dist/idml/colours.js.map +0 -1
- package/dist/idml/fields.d.ts +0 -19
- package/dist/idml/fields.d.ts.map +0 -1
- package/dist/idml/fields.js +0 -76
- package/dist/idml/fields.js.map +0 -1
- package/dist/idml/fonts.d.ts +0 -12
- package/dist/idml/fonts.d.ts.map +0 -1
- package/dist/idml/fonts.js +0 -19
- package/dist/idml/fonts.js.map +0 -1
- package/dist/idml/geometry.d.ts +0 -25
- package/dist/idml/geometry.d.ts.map +0 -1
- package/dist/idml/geometry.js +0 -37
- package/dist/idml/geometry.js.map +0 -1
- package/dist/idml/idml.test.d.ts +0 -2
- package/dist/idml/idml.test.d.ts.map +0 -1
- package/dist/idml/idml.test.js +0 -494
- package/dist/idml/idml.test.js.map +0 -1
- package/dist/idml/images.d.ts +0 -6
- package/dist/idml/images.d.ts.map +0 -1
- package/dist/idml/images.js +0 -75
- package/dist/idml/images.js.map +0 -1
- package/dist/idml/index.d.ts +0 -5
- package/dist/idml/index.d.ts.map +0 -1
- package/dist/idml/index.js +0 -100
- package/dist/idml/index.js.map +0 -1
- package/dist/idml/paragraphs.d.ts +0 -33
- package/dist/idml/paragraphs.d.ts.map +0 -1
- package/dist/idml/paragraphs.js +0 -203
- package/dist/idml/paragraphs.js.map +0 -1
- package/dist/idml/parts.d.ts +0 -89
- package/dist/idml/parts.d.ts.map +0 -1
- package/dist/idml/parts.js +0 -136
- package/dist/idml/parts.js.map +0 -1
- package/dist/idml/shapes.d.ts +0 -21
- package/dist/idml/shapes.d.ts.map +0 -1
- package/dist/idml/shapes.js +0 -146
- package/dist/idml/shapes.js.map +0 -1
- package/dist/idml/spreads.d.ts +0 -5
- package/dist/idml/spreads.d.ts.map +0 -1
- package/dist/idml/spreads.js +0 -154
- package/dist/idml/spreads.js.map +0 -1
- package/dist/idml/story.d.ts +0 -13
- package/dist/idml/story.d.ts.map +0 -1
- package/dist/idml/story.js +0 -238
- package/dist/idml/story.js.map +0 -1
- package/dist/idml/writer.d.ts +0 -86
- package/dist/idml/writer.d.ts.map +0 -1
- package/dist/idml/writer.js +0 -8
- package/dist/idml/writer.js.map +0 -1
package/dist/idml/colours.js
DELETED
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
// Colours as swatches: authored CMYK colours become process swatches under
|
|
2
|
-
// their palette names, other colours RGB ones. Swatch names are unique, and
|
|
3
|
-
// none takes the name of one of InDesign's own (Black, Paper,
|
|
4
|
-
// Registration, None).
|
|
5
|
-
import { parseColor as parseHexColor } from '../checks/contrast/colours.js';
|
|
6
|
-
import { wordColor } from '../word/formatted/units.js';
|
|
7
|
-
import { num } from './parts.js';
|
|
8
|
-
/** InDesign's own swatches, whose names a document's swatches cannot take. */
|
|
9
|
-
export const RESERVED_SWATCH_NAMES = ['Black', 'Paper', 'Registration', 'None'];
|
|
10
|
-
/** `#rgb`, `#rrggbb`, `#rrggbbaa` (as the contrast check reads them), and
|
|
11
|
-
* `rgb()`/`rgba()` (as the Word export does) → 0–255 and alpha 0–1. */
|
|
12
|
-
export function parseColor(s) {
|
|
13
|
-
if (!s || !/^\s*rgba?\(/i.test(s))
|
|
14
|
-
return parseHexColor(s);
|
|
15
|
-
const c = wordColor(s);
|
|
16
|
-
const rgb = c && parseHexColor(`#${c.hex}`);
|
|
17
|
-
return rgb ? { ...rgb, a: c.alpha } : undefined;
|
|
18
|
-
}
|
|
19
|
-
/** `name`, or `name 2`, `name 3`… when a swatch has it already. */
|
|
20
|
-
function uniqueName(taken, name) {
|
|
21
|
-
let out = name;
|
|
22
|
-
for (let i = 2; taken.has(out.toLowerCase()); i++)
|
|
23
|
-
out = `${name} ${i}`;
|
|
24
|
-
taken.add(out.toLowerCase());
|
|
25
|
-
return out;
|
|
26
|
-
}
|
|
27
|
-
const hex2 = (n) => Math.round(n).toString(16).padStart(2, '0');
|
|
28
|
-
/** A colour as a swatch reference: authored CMYK (palette names when the
|
|
29
|
-
* configuration names it), else RGB. */
|
|
30
|
-
export function swatch(w, color) {
|
|
31
|
-
const c = parseColor(color);
|
|
32
|
-
if (!c)
|
|
33
|
-
return undefined;
|
|
34
|
-
if (c.a === 0)
|
|
35
|
-
return undefined;
|
|
36
|
-
const key = `#${hex2(c.r)}${hex2(c.g)}${hex2(c.b)}`;
|
|
37
|
-
const cmyk = w.cmyk.get(key);
|
|
38
|
-
if (cmyk && cmyk.c === 0 && cmyk.m === 0 && cmyk.y === 0 && cmyk.k === 100)
|
|
39
|
-
return { ref: 'Color/Black', opacity: c.a };
|
|
40
|
-
if (cmyk && cmyk.c === 0 && cmyk.m === 0 && cmyk.y === 0 && cmyk.k === 0)
|
|
41
|
-
return { ref: 'Color/Paper', opacity: c.a };
|
|
42
|
-
let s = w.swatches.get(key);
|
|
43
|
-
if (!s) {
|
|
44
|
-
const fallback = cmyk ? `C=${num(cmyk.c)} M=${num(cmyk.m)} Y=${num(cmyk.y)} K=${num(cmyk.k)}` : `R=${c.r} G=${c.g} B=${c.b}`;
|
|
45
|
-
const name = uniqueName(w.swatchNames, w.palette.get(key) ?? fallback);
|
|
46
|
-
s = cmyk
|
|
47
|
-
? { self: `Color/${name}`, name, space: 'CMYK', value: [cmyk.c, cmyk.m, cmyk.y, cmyk.k] }
|
|
48
|
-
: { self: `Color/${name}`, name, space: 'RGB', value: [c.r, c.g, c.b] };
|
|
49
|
-
w.swatches.set(key, s);
|
|
50
|
-
}
|
|
51
|
-
return { ref: s.self, opacity: c.a };
|
|
52
|
-
}
|
|
53
|
-
//# sourceMappingURL=colours.js.map
|
package/dist/idml/colours.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"colours.js","sourceRoot":"","sources":["../../src/idml/colours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AAC,CAAC,KAAK,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC;QAC7H,MAAM,IAAI,GAAG,UAAU,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,QAAQ,CAAC,CAAC;QACvE,CAAC,GAAG,IAAI;YACN,CAAC,CAAC,EAAE,IAAI,EAAE,SAAS,IAAI,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,IAAI,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,EAAE;YACzF,CAAC,CAAC,EAAE,IAAI,EAAE,SAAS,IAAI,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QAC1E,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;IACzB,CAAC;IACD,OAAO,EAAE,GAAG,EAAE,CAAC,CAAC,IAAI,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;AACvC,CAAC"}
|
package/dist/idml/fields.d.ts
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { type FormFieldSpec } from '../parse/formFields.js';
|
|
2
|
-
export interface FieldPaint {
|
|
3
|
-
/** Sheet box of the field, centre and half sizes in spread pt. */
|
|
4
|
-
cx: number;
|
|
5
|
-
cy: number;
|
|
6
|
-
hw: number;
|
|
7
|
-
hh: number;
|
|
8
|
-
/** `FillColor` / `StrokeColor` / `StrokeWeight` / corner attributes of the box. */
|
|
9
|
-
paint: string;
|
|
10
|
-
/** Swatch of the check mark (the chip's text colour). */
|
|
11
|
-
ink: string;
|
|
12
|
-
/** Text size, pt. */
|
|
13
|
-
sizePt: number;
|
|
14
|
-
}
|
|
15
|
-
/** A check box value that reads as ticked. */
|
|
16
|
-
export declare const checked: (value: string) => boolean;
|
|
17
|
-
/** The IDML of one form field. `next` hands out `Self` ids. */
|
|
18
|
-
export declare function fieldXml(next: () => string, field: FormFieldSpec, value: string, f: FieldPaint): string;
|
|
19
|
-
//# sourceMappingURL=fields.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"fields.d.ts","sourceRoot":"","sources":["../../src/idml/fields.ts"],"names":[],"mappings":"AAeA,OAAO,EAAmB,KAAK,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAI7E,MAAM,WAAW,UAAU;IACzB,kEAAkE;IAClE,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,mFAAmF;IACnF,KAAK,EAAE,MAAM,CAAC;IACd,yDAAyD;IACzD,GAAG,EAAE,MAAM,CAAC;IACZ,qBAAqB;IACrB,MAAM,EAAE,MAAM,CAAC;CAChB;AAgCD,8CAA8C;AAC9C,eAAO,MAAM,OAAO,GAAI,OAAO,MAAM,KAAG,OAA2E,CAAC;AAiBpH,+DAA+D;AAC/D,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,MAAM,EAAE,KAAK,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,EAAE,UAAU,GAAG,MAAM,CAoBvG"}
|
package/dist/idml/fields.js
DELETED
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
// Form fields in the IDML package (#1445): a chip that carries a `field`
|
|
2
|
-
// becomes an InDesign form field on its box, as InDesign itself writes one
|
|
3
|
-
// (InDesign 2026 exports, DOM 21): the field's own transform, its bounds in
|
|
4
|
-
// `PathBoundingBox`, and its look as page items inside it. A text or number
|
|
5
|
-
// field is a `TextBox`, a choice a `ComboBox`, a check box a `CheckBox`
|
|
6
|
-
// with its two appearances (`UpOff`, `UpOn`) as states.
|
|
7
|
-
//
|
|
8
|
-
// What InDesign's fields cannot hold travels as the field's script labels
|
|
9
|
-
// (`Label`, read with `extractLabel` in InDesign scripting): a default
|
|
10
|
-
// value (`postext:value`), a number format (`postext:format`) and a
|
|
11
|
-
// calculation (`postext:calc`, written as the `calc` attribute writes it,
|
|
12
|
-
// numbers and nested calculations included). InDesign has no default
|
|
13
|
-
// value, number format, calculation or text alignment on a form field;
|
|
14
|
-
// its PDF export writes none of them.
|
|
15
|
-
import { formatFieldCalc } from '../parse/formFields.js';
|
|
16
|
-
import { escapeXml } from '../word/xml.js';
|
|
17
|
-
import { attr, num } from './parts.js';
|
|
18
|
-
const point = (x, y) => `<PathPointType Anchor="${num(x)} ${num(y)}" LeftDirection="${num(x)} ${num(y)}" RightDirection="${num(x)} ${num(y)}"/>`;
|
|
19
|
-
function geometry(points, open) {
|
|
20
|
-
return `<Properties><PathGeometry><GeometryPathType PathOpen="${open}"><PathPointArray>${points.map(([x, y]) => point(x, y)).join('')}</PathPointArray></GeometryPathType></PathGeometry></Properties>`;
|
|
21
|
-
}
|
|
22
|
-
/** The field's box as a rectangle in the field's own frame (centred). */
|
|
23
|
-
function boxXml(next, f) {
|
|
24
|
-
const { hw, hh } = f;
|
|
25
|
-
return (`<Rectangle${attr('Self', next())} ContentType="GraphicType" ItemTransform="1 0 0 1 0 0" AppliedObjectStyle="ObjectStyle/$ID/[None]"${f.paint}>` +
|
|
26
|
-
geometry([[-hw, -hh], [-hw, hh], [hw, hh], [hw, -hh]], false) +
|
|
27
|
-
'</Rectangle>');
|
|
28
|
-
}
|
|
29
|
-
/** A check box's mark: a tick drawn in the chip's ink, inside the box. */
|
|
30
|
-
function tickXml(next, f) {
|
|
31
|
-
const s = Math.min(f.hw, f.hh);
|
|
32
|
-
return (`<Polygon${attr('Self', next())} ContentType="Unassigned" ItemTransform="1 0 0 1 0 0" AppliedObjectStyle="ObjectStyle/$ID/[None]" FillColor="Swatch/None"${attr('StrokeColor', f.ink)}${attr('StrokeWeight', Math.max(0.5, s * 0.2))} EndCap="RoundEndCap" EndJoin="RoundEndJoin">` +
|
|
33
|
-
geometry([[-0.55 * s, 0], [-0.15 * s, 0.45 * s], [0.6 * s, -0.5 * s]], true) +
|
|
34
|
-
'</Polygon>');
|
|
35
|
-
}
|
|
36
|
-
const state = (next, type, active, items) => `<State${attr('Self', next())}${attr('Active', active)} Enabled="true"><Properties><Statetype type="enumeration">${type}</Statetype></Properties>` +
|
|
37
|
-
`<Group${attr('Self', next())} ItemTransform="1 0 0 1 0 0" AppliedObjectStyle="ObjectStyle/$ID/[None]">${items}</Group></State>`;
|
|
38
|
-
/** A check box value that reads as ticked. */
|
|
39
|
-
export const checked = (value) => value.trim() !== '' && !/^(0|false|no|off)$/i.test(value.trim());
|
|
40
|
-
function labels(field, value) {
|
|
41
|
-
const pairs = [];
|
|
42
|
-
if (value && field.kind !== 'checkbox')
|
|
43
|
-
pairs.push(['postext:value', value]);
|
|
44
|
-
if (field.format)
|
|
45
|
-
pairs.push(['postext:format', field.format]);
|
|
46
|
-
if (field.calc)
|
|
47
|
-
pairs.push(['postext:calc', formatFieldCalc(field.calc)]);
|
|
48
|
-
return pairs.length ? `<Label>${pairs.map(([k, v]) => `<KeyValuePair${attr('Key', k)}${attr('Value', v)}/>`).join('')}</Label>` : '';
|
|
49
|
-
}
|
|
50
|
-
/** The `ChoiceList` of a combo box: an attribute (a list of words) when
|
|
51
|
-
* no option holds a space, otherwise a list property. */
|
|
52
|
-
function choices(options) {
|
|
53
|
-
if (!options.some((o) => /\s/.test(o)))
|
|
54
|
-
return { attr: attr('ChoiceList', options.join(' ')), prop: '' };
|
|
55
|
-
return { attr: '', prop: `<ChoiceList type="list">${options.map((o) => `<ListItem type="string">${escapeXml(o)}</ListItem>`).join('')}</ChoiceList>` };
|
|
56
|
-
}
|
|
57
|
-
/** The IDML of one form field. `next` hands out `Self` ids. */
|
|
58
|
-
export function fieldXml(next, field, value, f) {
|
|
59
|
-
const self = next();
|
|
60
|
-
const tag = field.kind === 'checkbox' ? 'CheckBox' : field.kind === 'choice' ? 'ComboBox' : 'TextBox';
|
|
61
|
-
const list = field.kind === 'choice' ? choices(field.options ?? []) : { attr: '', prop: '' };
|
|
62
|
-
const common = `${attr('Self', self)}${attr('Name', field.name)}${attr('Description', field.tooltip ?? '')}${attr('ReadOnly', !!field.readonly)}${attr('Required', !!field.required)}` +
|
|
63
|
-
' PrintableInPdf="true" HiddenUntilTriggered="false" VisibilityInPdf="VisibleInPdf" Visible="true" ItemLayer="ulayer" AppliedObjectStyle="ObjectStyle/$ID/[None]"' +
|
|
64
|
-
attr('ItemTransform', `1 0 0 1 ${num(f.cx)} ${num(f.cy)}`);
|
|
65
|
-
const own = field.kind === 'checkbox'
|
|
66
|
-
? `${attr('CheckedByDefault', checked(value))} ExportValue="Yes"`
|
|
67
|
-
: field.kind === 'choice'
|
|
68
|
-
? `${list.attr} SortChoices="false"${attr('FontSize', f.sizePt)}`
|
|
69
|
-
: `${attr('Multiline', !!field.multiline)} Password="false" Scrollable="true"${attr('FontSize', f.sizePt)}`;
|
|
70
|
-
const props = `<Properties><PathBoundingBox${attr('Left', -f.hw)}${attr('Top', -f.hh)}${attr('Right', f.hw)}${attr('Bottom', f.hh)}/>${list.prop}${labels(field, value)}</Properties>`;
|
|
71
|
-
const look = field.kind === 'checkbox'
|
|
72
|
-
? state(next, 'UpOff', !checked(value), boxXml(next, f)) + state(next, 'UpOn', checked(value), boxXml(next, f) + tickXml(next, f))
|
|
73
|
-
: boxXml(next, f);
|
|
74
|
-
return `<${tag}${common}${own}>${props}${look}</${tag}>`;
|
|
75
|
-
}
|
|
76
|
-
//# sourceMappingURL=fields.js.map
|
package/dist/idml/fields.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"fields.js","sourceRoot":"","sources":["../../src/idml/fields.ts"],"names":[],"mappings":"AAAA,yEAAyE;AACzE,2EAA2E;AAC3E,4EAA4E;AAC5E,4EAA4E;AAC5E,wEAAwE;AACxE,wDAAwD;AACxD,EAAE;AACF,0EAA0E;AAC1E,uEAAuE;AACvE,oEAAoE;AACpE,0EAA0E;AAC1E,qEAAqE;AACrE,uEAAuE;AACvE,sCAAsC;AAEtC,OAAO,EAAE,eAAe,EAAsB,MAAM,wBAAwB,CAAC;AAC7E,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AAgBvC,MAAM,KAAK,GAAG,CAAC,CAAS,EAAE,CAAS,EAAE,EAAE,CAAC,0BAA0B,GAAG,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC,oBAAoB,GAAG,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC,qBAAqB,GAAG,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC;AAEjK,SAAS,QAAQ,CAAC,MAA0B,EAAE,IAAa;IACzD,OAAO,yDAAyD,IAAI,qBAAqB,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,kEAAkE,CAAC;AAC1M,CAAC;AAED,yEAAyE;AACzE,SAAS,MAAM,CAAC,IAAkB,EAAE,CAAa;IAC/C,MAAM,EAAE,EAAE,EAAE,EAAE,EAAE,GAAG,CAAC,CAAC;IACrB,OAAO,CACL,aAAa,I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AO,IAAI,GAAG,GAAG,MAAM,GAAG,GAAG,IAAI,KAAK,GAAG,IAAI,KAAK,GAAG,GAAG,CAAC;AAC3D,CAAC"}
|
package/dist/idml/fonts.d.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
export declare function defaultFontStyleName(_family: string, weight: number, italic: boolean): string;
|
|
2
|
-
export interface CssFont {
|
|
3
|
-
family: string;
|
|
4
|
-
weight: number;
|
|
5
|
-
italic: boolean;
|
|
6
|
-
sizePx: number;
|
|
7
|
-
}
|
|
8
|
-
/** `italic 700 16px "EB Garamond", serif` → its parts, as the measurer
|
|
9
|
-
* reads them (`parseFontString`, `findPxSize`); a string with no `px`
|
|
10
|
-
* size is 16px Times. */
|
|
11
|
-
export declare function parseCssFont(s: string): CssFont;
|
|
12
|
-
//# sourceMappingURL=fonts.d.ts.map
|
package/dist/idml/fonts.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"fonts.d.ts","sourceRoot":"","sources":["../../src/idml/fonts.ts"],"names":[],"mappings":"AAOA,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,GAAG,MAAM,CAI7F;AAED,MAAM,WAAW,OAAO;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,OAAO,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;0BAE0B;AAC1B,wBAAgB,YAAY,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAI/C"}
|
package/dist/idml/fonts.js
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
// Faces: what a run's canvas font shorthand asks for, and InDesign's
|
|
2
|
-
// style name of a face.
|
|
3
|
-
import { findPxSize, parseFontString } from '../measure/fontString.js';
|
|
4
|
-
const WEIGHT_NAMES = { 100: 'Thin', 200: 'ExtraLight', 300: 'Light', 400: 'Regular', 500: 'Medium', 600: 'SemiBold', 700: 'Bold', 800: 'ExtraBold', 900: 'Black' };
|
|
5
|
-
export function defaultFontStyleName(_family, weight, italic) {
|
|
6
|
-
const w = WEIGHT_NAMES[Math.round(weight / 100) * 100] ?? 'Regular';
|
|
7
|
-
if (!italic)
|
|
8
|
-
return w;
|
|
9
|
-
return w === 'Regular' ? 'Italic' : `${w} Italic`;
|
|
10
|
-
}
|
|
11
|
-
/** `italic 700 16px "EB Garamond", serif` → its parts, as the measurer
|
|
12
|
-
* reads them (`parseFontString`, `findPxSize`); a string with no `px`
|
|
13
|
-
* size is 16px Times. */
|
|
14
|
-
export function parseCssFont(s) {
|
|
15
|
-
const face = parseFontString(s);
|
|
16
|
-
const size = findPxSize(s);
|
|
17
|
-
return { family: face?.family ?? 'Times', weight: face?.weight ?? 400, italic: face?.style === 'italic', sizePx: size ? Number(size.value) : 16 };
|
|
18
|
-
}
|
|
19
|
-
//# sourceMappingURL=fonts.js.map
|
package/dist/idml/fonts.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"fonts.js","sourceRoot":"","sources":["../../src/idml/fonts.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,wBAAwB;AAExB,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAEvE,MAAM,YAAY,GAA2B,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,YAAY,EAAE,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,SAAS,EAAE,GAAG,EAAE,QAAQ,EAAE,GAAG,EAAE,UAAU,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,WAAW,EAAE,GAAG,EAAE,OAAO,EAAE,CAAC;AAE3L,MAAM,UAAU,oBAAoB,CAAC,OAAe,EAAE,MAAc,EAAE,MAAe;IACnF,MAAM,CAAC,GAAG,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,GAAG,CAAC,GAAG,GAAG,CAAC,IAAI,SAAS,CAAC;IACpE,IAAI,CAAC,MAAM;QAAE,OAAO,CAAC,CAAC;IACtB,OAAO,CAAC,KAAK,SAAS,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,SAAS,CAAC;AACpD,CAAC;AASD;;0BAE0B;AAC1B,MAAM,UAAU,YAAY,CAAC,CAAS;IACpC,MAAM,IAAI,GAAG,eAAe,CAAC,CAAC,CAAC,CAAC;IAChC,MAAM,IAAI,GAAG,UAAU,CAAC,CAAC,CAAC,CAAC;IAC3B,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,IAAI,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,IAAI,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,KAAK,QAAQ,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC;AACpJ,CAAC"}
|
package/dist/idml/geometry.d.ts
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import type { DisplayLine, DisplayRect, DisplayRun } from '../paint/displayList/types.js';
|
|
2
|
-
import type { Writer } from './writer.js';
|
|
3
|
-
export interface Pt {
|
|
4
|
-
x: number;
|
|
5
|
-
y: number;
|
|
6
|
-
}
|
|
7
|
-
export declare const toSpread: (w: Writer, x: number, y: number) => Pt;
|
|
8
|
-
export declare const pp: (a: Pt, l?: Pt, r?: Pt) => string;
|
|
9
|
-
export declare function pathGeometry(paths: {
|
|
10
|
-
points: string[];
|
|
11
|
-
open: boolean;
|
|
12
|
-
}[]): string;
|
|
13
|
-
/** A box `r` (sheet px) turned `rotate`° clockwise about its centre: its
|
|
14
|
-
* item transform and its outline in its own frame (centred, pt). */
|
|
15
|
-
export declare function boxGeometry(w: Writer, r: DisplayRect, rotate?: number): {
|
|
16
|
-
transform: string;
|
|
17
|
-
geometry: string;
|
|
18
|
-
width: number;
|
|
19
|
-
height: number;
|
|
20
|
-
};
|
|
21
|
-
export declare function opacityXml(opacity: number): string;
|
|
22
|
-
/** The sheet box of a chip whose box starts on `run` of `line`. */
|
|
23
|
-
export declare function chipRect(run: DisplayRun, line: DisplayLine): DisplayRect | undefined;
|
|
24
|
-
export declare const union: (rects: DisplayRect[]) => DisplayRect;
|
|
25
|
-
//# sourceMappingURL=geometry.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"geometry.d.ts","sourceRoot":"","sources":["../../src/idml/geometry.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAE1F,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAE1C,MAAM,WAAW,EAAE;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX;AAED,eAAO,MAAM,QAAQ,GAAI,GAAG,MAAM,EAAE,GAAG,MAAM,EAAE,GAAG,MAAM,KAAG,EAAkE,CAAC;AAE9H,eAAO,MAAM,EAAE,GAAI,GAAG,EAAE,EAAE,IAAG,EAAM,EAAE,IAAG,EAAM,KAAG,MACqF,CAAC;AAEvI,wBAAgB,YAAY,CAAC,KAAK,EAAE;IAAE,MAAM,EAAE,MAAM,EAAE,CAAC;IAAC,IAAI,EAAE,OAAO,CAAA;CAAE,EAAE,GAAG,MAAM,CAEjF;AAED;qEACqE;AACrE,wBAAgB,WAAW,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,WAAW,EAAE,MAAM,SAAI,GAAG;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAUzI;AAED,wBAAgB,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAElD;AAED,mEAAmE;AACnE,wBAAgB,QAAQ,CAAC,GAAG,EAAE,UAAU,EAAE,IAAI,EAAE,WAAW,GAAG,WAAW,GAAG,SAAS,CAGpF;AAED,eAAO,MAAM,KAAK,GAAI,OAAO,WAAW,EAAE,KAAG,WAM5C,CAAC"}
|
package/dist/idml/geometry.js
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
// Geometry: sheet px on the page to pt on the spread, path points, a
|
|
2
|
-
// box's transform and outline.
|
|
3
|
-
import { num } from './parts.js';
|
|
4
|
-
export const toSpread = (w, x, y) => ({ x: (x - w.ox) * w.k, y: (y - w.oy) * w.k - w.pageH / 2 });
|
|
5
|
-
export const pp = (a, l = a, r = a) => `<PathPointType Anchor="${num(a.x)} ${num(a.y)}" LeftDirection="${num(l.x)} ${num(l.y)}" RightDirection="${num(r.x)} ${num(r.y)}"/>`;
|
|
6
|
-
export function pathGeometry(paths) {
|
|
7
|
-
return `<Properties><PathGeometry>${paths.map((p) => `<GeometryPathType PathOpen="${p.open}"><PathPointArray>${p.points.join('')}</PathPointArray></GeometryPathType>`).join('')}</PathGeometry></Properties>`;
|
|
8
|
-
}
|
|
9
|
-
/** A box `r` (sheet px) turned `rotate`° clockwise about its centre: its
|
|
10
|
-
* item transform and its outline in its own frame (centred, pt). */
|
|
11
|
-
export function boxGeometry(w, r, rotate = 0) {
|
|
12
|
-
const c = toSpread(w, r.x + r.width / 2, r.y + r.height / 2);
|
|
13
|
-
const hw = (r.width * w.k) / 2;
|
|
14
|
-
const hh = (r.height * w.k) / 2;
|
|
15
|
-
const t = (rotate * Math.PI) / 180;
|
|
16
|
-
const cos = Math.cos(t);
|
|
17
|
-
const sin = Math.sin(t);
|
|
18
|
-
const transform = `${num(cos)} ${num(sin)} ${num(-sin)} ${num(cos)} ${num(c.x)} ${num(c.y)}`;
|
|
19
|
-
const points = [pp({ x: -hw, y: -hh }), pp({ x: -hw, y: hh }), pp({ x: hw, y: hh }), pp({ x: hw, y: -hh })];
|
|
20
|
-
return { transform, geometry: pathGeometry([{ points, open: false }]), width: hw * 2, height: hh * 2 };
|
|
21
|
-
}
|
|
22
|
-
export function opacityXml(opacity) {
|
|
23
|
-
return opacity < 1 ? `<TransparencySetting><BlendingSetting Opacity="${num(opacity * 100)}"/></TransparencySetting>` : '';
|
|
24
|
-
}
|
|
25
|
-
/** The sheet box of a chip whose box starts on `run` of `line`. */
|
|
26
|
-
export function chipRect(run, line) {
|
|
27
|
-
const b = run.inline?.kind === 'chip' ? run.inline.box : undefined;
|
|
28
|
-
return b ? { x: run.x + b.dx, y: line.baseline - b.ascent, width: b.width, height: b.ascent + b.descent } : undefined;
|
|
29
|
-
}
|
|
30
|
-
export const union = (rects) => {
|
|
31
|
-
const x = Math.min(...rects.map((r) => r.x));
|
|
32
|
-
const y = Math.min(...rects.map((r) => r.y));
|
|
33
|
-
const right = Math.max(...rects.map((r) => r.x + r.width));
|
|
34
|
-
const bottom = Math.max(...rects.map((r) => r.y + r.height));
|
|
35
|
-
return { x, y, width: right - x, height: bottom - y };
|
|
36
|
-
};
|
|
37
|
-
//# sourceMappingURL=geometry.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"geometry.js","sourceRoot":"","sources":["../../src/idml/geometry.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,+BAA+B;AAG/B,OAAO,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AAQjC,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,CAAS,EAAE,CAAS,EAAE,CAAS,EAAM,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,GAAG,CAAC,EAAE,CAAC,CAAC;AAE9H,MAAM,CAAC,MAAM,EAAE,GA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