layoutbridge-light 0.0.0-stage → 1.0.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.
Files changed (92) hide show
  1. package/CHANGELOG.md +105 -0
  2. package/LICENSE +26 -0
  3. package/README.de.md +367 -0
  4. package/README.md +353 -2
  5. package/THIRD-PARTY-NOTICES.md +2878 -0
  6. package/dist/src/mcp/catalog.js +131 -0
  7. package/dist/src/mcp/config.js +211 -0
  8. package/dist/src/mcp/content-credentials.js +65 -0
  9. package/dist/src/mcp/dispatch.js +171 -0
  10. package/dist/src/mcp/epub-check.js +331 -0
  11. package/dist/src/mcp/epub-orientation.js +132 -0
  12. package/dist/src/mcp/license/free-tools.js +16 -0
  13. package/dist/src/mcp/license/gate.js +210 -0
  14. package/dist/src/mcp/license/index.js +107 -0
  15. package/dist/src/mcp/license/instance-name.js +57 -0
  16. package/dist/src/mcp/license/key-source.js +59 -0
  17. package/dist/src/mcp/license/lemonsqueezy-verifier.js +207 -0
  18. package/dist/src/mcp/license/placeholder-verifier.js +10 -0
  19. package/dist/src/mcp/license/polar-ids.js +100 -0
  20. package/dist/src/mcp/license/polar-verifier.js +285 -0
  21. package/dist/src/mcp/license/product-ids.js +73 -0
  22. package/dist/src/mcp/license/state-store.js +91 -0
  23. package/dist/src/mcp/license/types.js +11 -0
  24. package/dist/src/mcp/logging.js +271 -0
  25. package/dist/src/mcp/pdf-postprocess.js +798 -0
  26. package/dist/src/mcp/product-info.js +54 -0
  27. package/dist/src/mcp/product.js +56 -0
  28. package/dist/src/mcp/server.js +253 -0
  29. package/dist/src/mcp/setup.js +680 -0
  30. package/dist/src/mcp/start.cjs +117 -0
  31. package/dist/src/mcp/target-folder.js +25 -0
  32. package/dist/src/mcp/tool-definition.js +2 -0
  33. package/dist/src/mcp/tools.js +2680 -0
  34. package/dist/src/mcp/typography-rules.js +70 -0
  35. package/dist/src/transport/com.js +436 -0
  36. package/dist/src/transport/osascript.js +171 -0
  37. package/dist/src/transport/queue.js +19 -0
  38. package/dist/src/transport/script-bundle.js +92 -0
  39. package/dist/src/transport/transport.js +52 -0
  40. package/indesign/commands/10-app.js +6 -0
  41. package/indesign/commands/20-documents.js +517 -0
  42. package/indesign/commands/22-document-setup.js +204 -0
  43. package/indesign/commands/23-save-package.js +258 -0
  44. package/indesign/commands/25-export.js +695 -0
  45. package/indesign/commands/26-export-image.js +202 -0
  46. package/indesign/commands/27-textdefaults.js +151 -0
  47. package/indesign/commands/28-selection.js +174 -0
  48. package/indesign/commands/30-pages.js +1032 -0
  49. package/indesign/commands/31-view.js +310 -0
  50. package/indesign/commands/32-sections.js +203 -0
  51. package/indesign/commands/35-parents.js +448 -0
  52. package/indesign/commands/37-layout.js +837 -0
  53. package/indesign/commands/40-frames.js +886 -0
  54. package/indesign/commands/41-shapes.js +505 -0
  55. package/indesign/commands/42-groups.js +117 -0
  56. package/indesign/commands/43-layers.js +310 -0
  57. package/indesign/commands/44-effects.js +274 -0
  58. package/indesign/commands/45-frame-options.js +247 -0
  59. package/indesign/commands/47-anchored.js +473 -0
  60. package/indesign/commands/50-modify.js +803 -0
  61. package/indesign/commands/52-align.js +139 -0
  62. package/indesign/commands/55-fit.js +106 -0
  63. package/indesign/commands/60-images.js +1154 -0
  64. package/indesign/commands/62-embed.js +120 -0
  65. package/indesign/commands/69-placeholders.js +132 -0
  66. package/indesign/commands/70-text.js +710 -0
  67. package/indesign/commands/71-outlines.js +92 -0
  68. package/indesign/commands/72-place-text.js +476 -0
  69. package/indesign/commands/73-story-lock.js +157 -0
  70. package/indesign/commands/74-stories.js +121 -0
  71. package/indesign/commands/75-tables.js +702 -0
  72. package/indesign/commands/76-text-variables.js +260 -0
  73. package/indesign/commands/77-story-options.js +86 -0
  74. package/indesign/commands/78-frame-lines.js +511 -0
  75. package/indesign/commands/79-check-typography.js +480 -0
  76. package/indesign/commands/80-styles.js +1960 -0
  77. package/indesign/commands/81-composition.js +355 -0
  78. package/indesign/commands/82-object-styles.js +263 -0
  79. package/indesign/commands/83-drop-caps.js +87 -0
  80. package/indesign/commands/83-indents-tabs.js +264 -0
  81. package/indesign/commands/84-import-styles.js +142 -0
  82. package/indesign/commands/85-swatches.js +112 -0
  83. package/indesign/commands/86-gradients.js +185 -0
  84. package/indesign/commands/87-replace-swatch.js +180 -0
  85. package/indesign/commands/88-replace-font.js +212 -0
  86. package/indesign/commands/89-toc-index.js +1002 -0
  87. package/indesign/commands/90-print-on-demand.js +495 -0
  88. package/indesign/commands/91-epub.js +629 -0
  89. package/indesign/commands/92-accessibility.js +1131 -0
  90. package/indesign/interpreter.js +829 -0
  91. package/package.json +41 -4
  92. package/rules/typography-rules.json +32 -0
@@ -0,0 +1,247 @@
1
+ /* Wunschliste J (Sitzung 7) – Rahmenoptionen lesen: get_frame_options. */
2
+
3
+ /* first_baseline_offset: Name <-> FirstBaseline-Enumerator. */
4
+ function idcFirstBaselineFor(name) {
5
+ if (typeof FirstBaseline === 'undefined') { return null; }
6
+ if (name === 'ascent') { return FirstBaseline.ASCENT_OFFSET; }
7
+ if (name === 'cap_height') { return FirstBaseline.CAP_HEIGHT; }
8
+ if (name === 'leading') { return FirstBaseline.LEADING_OFFSET; }
9
+ if (name === 'x_height') { return FirstBaseline.X_HEIGHT; }
10
+ if (name === 'fixed') { return FirstBaseline.FIXED_HEIGHT; }
11
+ if (name === 'embox_top') { return FirstBaseline.EMBOX_TOP; }
12
+ return null;
13
+ }
14
+
15
+ function idcFirstBaselineName(value) {
16
+ if (value === undefined || value === null) { return null; }
17
+ if (typeof FirstBaseline === 'undefined') { return String(value); }
18
+ if (IDC.enumIs(value, FirstBaseline.ASCENT_OFFSET)) { return 'ascent'; }
19
+ if (IDC.enumIs(value, FirstBaseline.CAP_HEIGHT)) { return 'cap_height'; }
20
+ if (IDC.enumIs(value, FirstBaseline.LEADING_OFFSET)) { return 'leading'; }
21
+ if (IDC.enumIs(value, FirstBaseline.X_HEIGHT)) { return 'x_height'; }
22
+ if (IDC.enumIs(value, FirstBaseline.FIXED_HEIGHT)) { return 'fixed'; }
23
+ if (IDC.enumIs(value, FirstBaseline.EMBOX_TOP)) { return 'embox_top'; }
24
+ return String(value);
25
+ }
26
+
27
+ function idcVerticalJustificationName(value) {
28
+ if (value === undefined || value === null) { return null; }
29
+ if (typeof VerticalJustification === 'undefined') { return String(value); }
30
+ if (IDC.enumIs(value, VerticalJustification.TOP_ALIGN)) { return 'top'; }
31
+ if (IDC.enumIs(value, VerticalJustification.CENTER_ALIGN)) { return 'center'; }
32
+ if (IDC.enumIs(value, VerticalJustification.BOTTOM_ALIGN)) { return 'bottom'; }
33
+ if (IDC.enumIs(value, VerticalJustification.JUSTIFY_ALIGN)) { return 'justify'; }
34
+ return String(value);
35
+ }
36
+
37
+ /*
38
+ * Name -> VerticalJustification, null bei unbekanntem Namen. Kein
39
+ * verschachtelter ?:-Ausdruck: ExtendScript klammert ihn links (Fund 3,
40
+ * Sitzung 6, live nachgewiesen am 05.09.2026).
41
+ */
42
+ function idcVerticalJustificationFor(name) {
43
+ if (typeof VerticalJustification === 'undefined') { return null; }
44
+ if (name === 'top') { return VerticalJustification.TOP_ALIGN; }
45
+ if (name === 'center') { return VerticalJustification.CENTER_ALIGN; }
46
+ if (name === 'bottom') { return VerticalJustification.BOTTOM_ALIGN; }
47
+ if (name === 'justify') { return VerticalJustification.JUSTIFY_ALIGN; }
48
+ return null;
49
+ }
50
+
51
+ function idcColumnTypeName(value) {
52
+ if (value === undefined || value === null) { return null; }
53
+ if (typeof TextColumnType === 'undefined') { return String(value); }
54
+ if (IDC.enumIs(value, TextColumnType.FIXED_NUMBER)) { return 'fixed_number'; }
55
+ if (IDC.enumIs(value, TextColumnType.FIXED_WIDTH)) { return 'fixed_width'; }
56
+ if (IDC.enumIs(value, TextColumnType.FLEXIBLE_WIDTH)) { return 'flexible_width'; }
57
+ return String(value);
58
+ }
59
+
60
+ /*
61
+ * Spaltenart. Adobes DOM (TextFramePreference) fuehrt sie als zwei Schalter
62
+ * useFixedColumnWidth / useFlexibleColumnWidth; ein textColumnType gibt es
63
+ * dort nicht (in 21.5 wirft der Zugriff – Sitzung 7). Erst die Schalter,
64
+ * dann der Rueckfall auf textColumnType fuer Laufzeiten, die ihn kennen.
65
+ */
66
+ function idcColumnType(prefs) {
67
+ var flexible = null, fixed = null;
68
+ try { flexible = prefs.useFlexibleColumnWidth === true; } catch (e0) { flexible = null; }
69
+ try { fixed = prefs.useFixedColumnWidth === true; } catch (e1) { fixed = null; }
70
+ if (flexible === true) { return 'flexible_width'; }
71
+ if (fixed === true) { return 'fixed_width'; }
72
+ if (flexible === false || fixed === false) { return 'fixed_number'; }
73
+ try { return idcColumnTypeName(prefs.textColumnType); } catch (e2) { return null; }
74
+ }
75
+
76
+ /*
77
+ * inset_mm beim Anlegen: eine Zahl (alle Kanten) oder { top, left, bottom,
78
+ * right }; fehlende Kanten eines Objekts gelten als 0.
79
+ */
80
+ function idcInsetArg(spec, field) {
81
+ var keys = ['top', 'left', 'bottom', 'right'];
82
+ var out = {};
83
+ var i, v;
84
+ if (typeof spec === 'number') {
85
+ if (!isFinite(spec) || spec < 0) {
86
+ IDC.fail('invalid_argument', field + ' must be a number of 0 or more (mm).', { value: spec });
87
+ }
88
+ return { top: spec, left: spec, bottom: spec, right: spec };
89
+ }
90
+ if (!spec || typeof spec !== 'object') {
91
+ IDC.fail('invalid_argument', field + ' must be a number or an object { top, left, bottom, right } in mm.', null);
92
+ }
93
+ for (i = 0; i < keys.length; i++) {
94
+ v = spec[keys[i]];
95
+ if (v === undefined || v === null) { out[keys[i]] = 0; continue; }
96
+ if (typeof v !== 'number' || !isFinite(v) || v < 0) {
97
+ IDC.fail('invalid_argument', field + '.' + keys[i] + ' must be a number of 0 or more.', spec);
98
+ }
99
+ out[keys[i]] = v;
100
+ }
101
+ return out;
102
+ }
103
+
104
+ /*
105
+ * Rahmenoptionen eines Textrahmens (Objekt > Textrahmenoptionen), gelesen
106
+ * unter Millimeter; Grundlinien-Mindestabstand in Punkt.
107
+ */
108
+ function idcTextFrameOptions(doc, frame) {
109
+ var prefs = null;
110
+ var out = {
111
+ columns: { count: null, gutter_mm: null, type: null, fixed_width_mm: null },
112
+ inset_mm: null,
113
+ vertical_justification: null,
114
+ vertical_threshold_mm: null,
115
+ first_baseline_offset: null,
116
+ min_first_baseline_pt: null,
117
+ ignore_text_wrap: null,
118
+ optical_margin_alignment: null,
119
+ optical_margin_size_pt: null
120
+ };
121
+ /* A-7.4: storyweite Werte (StoryPreference) unter text, damit get_frame_options sie zeigt. */
122
+ try {
123
+ var storyOptions = idcReadStoryOptions(frame.parentStory);
124
+ out.optical_margin_alignment = storyOptions.optical_margin_alignment;
125
+ out.optical_margin_size_pt = storyOptions.optical_margin_size_pt;
126
+ } catch (eS) { /* bleibt null */ }
127
+ try { prefs = frame.textFramePreferences; } catch (e0) { prefs = null; }
128
+ if (prefs === null || prefs === undefined) { return out; }
129
+ try { out.columns.count = Number(prefs.textColumnCount); } catch (e1) { /* bleibt null */ }
130
+ try { out.columns.gutter_mm = IDC.round(Number(prefs.textColumnGutter)); } catch (e2) { /* bleibt null */ }
131
+ out.columns.type = idcColumnType(prefs);
132
+ try { out.columns.fixed_width_mm = IDC.round(Number(prefs.textColumnFixedWidth)); } catch (e4) { /* bleibt null */ }
133
+ try { out.inset_mm = idcEdgesFromArray(prefs.insetSpacing); } catch (e5) { /* bleibt null */ }
134
+ try { out.vertical_justification = idcVerticalJustificationName(prefs.verticalJustification); } catch (e6) { /* bleibt null */ }
135
+ try { out.vertical_threshold_mm = IDC.round(Number(prefs.verticalThreshold)); } catch (e7) { /* bleibt null */ }
136
+ try { out.first_baseline_offset = idcFirstBaselineName(prefs.firstBaselineOffset); } catch (e8) { /* bleibt null */ }
137
+ try {
138
+ out.min_first_baseline_pt = IDC.inPoints(function () { return IDC.round(Number(prefs.minimumFirstBaselineOffset), 3); });
139
+ } catch (e9) { /* bleibt null */ }
140
+ try { out.ignore_text_wrap = prefs.ignoreWrap === true; } catch (e10) { /* bleibt null */ }
141
+ return out;
142
+ }
143
+
144
+ /* Verkettung: Story, Stellung des Rahmens in ihr, Nachbarn, Uebersatz. */
145
+ function idcThreading(frame) {
146
+ var out = {
147
+ story_id: null,
148
+ story_length: null,
149
+ frame_index: null,
150
+ frame_count: null,
151
+ previous_frame_id: null,
152
+ next_frame_id: null,
153
+ overset: null,
154
+ story_overset: null
155
+ };
156
+ var story = null, frames, i, prev = null, next = null;
157
+ try { story = frame.parentStory; } catch (e0) { story = null; }
158
+ if (story !== null && story !== undefined) {
159
+ try { out.story_id = Number(story.id); } catch (e1) { /* null */ }
160
+ try { out.story_length = Number(story.characters.length); } catch (e2) { /* null */ }
161
+ try {
162
+ frames = story.textContainers;
163
+ out.frame_count = frames.length;
164
+ for (i = 0; i < frames.length; i++) {
165
+ if (Number(frames[i].id) === Number(frame.id)) { out.frame_index = i; break; }
166
+ }
167
+ } catch (e3) { /* null */ }
168
+ try { out.story_overset = story.overflows === true; } catch (e4) { /* null */ }
169
+ }
170
+ try { prev = frame.previousTextFrame; } catch (e5) { prev = null; }
171
+ try { next = frame.nextTextFrame; } catch (e6) { next = null; }
172
+ try { if (prev !== null && prev !== undefined && prev.isValid === true) { out.previous_frame_id = Number(prev.id); } } catch (e7) { /* null */ }
173
+ try { if (next !== null && next !== undefined && next.isValid === true) { out.next_frame_id = Number(next.id); } } catch (e8) { /* null */ }
174
+ try { out.overset = frame.overflows === true; } catch (e9) { /* null */ }
175
+ return out;
176
+ }
177
+
178
+ /*
179
+ * Grundlinie der ersten Zeile in mm ab Seitenoberkante (Lineal steht fuer
180
+ * den Aufruf auf Seiten-Nullpunkt), null ohne Text. Der direkte Weg, den
181
+ * Sitz einer Bildunterschrift im Grundlinienraster zu pruefen (Fund 3).
182
+ */
183
+ function idcFirstBaselineMm(frame) {
184
+ try {
185
+ if (frame.lines.length === 0) { return null; }
186
+ return IDC.round(Number(frame.lines.item(0).baseline), 3);
187
+ } catch (e0) { return null; }
188
+ }
189
+
190
+ /* Textumfluss eines Objekts mit Abstand. */
191
+ function idcTextWrapOptions(item) {
192
+ var out = { mode: null, offset_mm: null };
193
+ var prefs = null, mode;
194
+ try { prefs = item.textWrapPreferences; } catch (e0) { prefs = null; }
195
+ if (prefs === null || prefs === undefined) { return out; }
196
+ mode = idcTextWrapName(item);
197
+ if (mode === 'contour') { mode = 'object_shape'; }
198
+ out.mode = mode;
199
+ try { out.offset_mm = idcEdgesFromArray(prefs.textWrapOffset); } catch (e1) { out.offset_mm = null; }
200
+ return out;
201
+ }
202
+
203
+ IDC.register('get_frame_options', { needs_document: true, read_only: true, ruler: 'page' },
204
+ function (ctx) {
205
+ var args = ctx.args;
206
+ var doc = ctx.doc;
207
+ var found = idcFrameArg(doc, args, 'frame_id');
208
+ var item = found.item;
209
+ var type = IDC.itemType(item);
210
+ var landing = IDC.landing(item);
211
+ var look = idcAppearanceFull(item);
212
+ var corners = type === 'line' || type === 'group' ? null : idcReadCorners(item);
213
+ var out = {
214
+ frame_id: Number(item.id),
215
+ type: type,
216
+ page_id: landing.page_id,
217
+ page_name: landing.page_name,
218
+ on_parent_page: found.on_parent === true,
219
+ coordinate_space: idcBoundsSpace(item),
220
+ bounds_mm: idcItemBounds(doc, item),
221
+ rotation_deg: idcRotationOf(item),
222
+ text_wrap: idcTextWrapOptions(item),
223
+ appearance: look,
224
+ corners: corners === null ? null : { top_left: corners.top_left, top_right: corners.top_right, bottom_left: corners.bottom_left, bottom_right: corners.bottom_right, uniform: corners.uniform },
225
+ layer: idcLayerSummary(doc, item),
226
+ locked: idcReadBool(item, 'locked') === true,
227
+ anchored: idcAnchorInfo(item),
228
+ effects: null,
229
+ has_effects: null,
230
+ text: null
231
+ };
232
+ /* A-8.6: Effekte des Objekts und ob Flaeche, Kontur, Text abweichen. */
233
+ var effects = idcEffectsSummary(item);
234
+ out.effects = effects.effects;
235
+ out.has_effects = effects.has_effects;
236
+ var parentGroup = null;
237
+ try { if (IDC.className(item.parent) === 'Group') { parentGroup = Number(item.parent.id); } } catch (e0) { parentGroup = null; }
238
+ out.parent_group_id = parentGroup;
239
+
240
+ if (IDC.isTextFrame(item)) {
241
+ out.text = idcTextFrameOptions(doc, item);
242
+ out.text.threading = idcThreading(item);
243
+ out.text.first_baseline_mm = idcFirstBaselineMm(item);
244
+ try { out.text.character_count = Number(item.characters.length); } catch (e1) { out.text.character_count = null; }
245
+ }
246
+ return out;
247
+ });