layoutbridge-light 0.0.0-stage → 1.0.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/CHANGELOG.md +22 -0
- package/LICENSE +26 -0
- package/README.de.md +338 -0
- package/README.md +325 -2
- package/THIRD-PARTY-NOTICES.md +2878 -0
- package/dist/src/mcp/catalog.js +126 -0
- package/dist/src/mcp/config.js +211 -0
- package/dist/src/mcp/dispatch.js +164 -0
- package/dist/src/mcp/epub-check.js +331 -0
- package/dist/src/mcp/epub-orientation.js +132 -0
- package/dist/src/mcp/license/free-tools.js +16 -0
- package/dist/src/mcp/license/gate.js +210 -0
- package/dist/src/mcp/license/index.js +107 -0
- package/dist/src/mcp/license/instance-name.js +57 -0
- package/dist/src/mcp/license/key-source.js +59 -0
- package/dist/src/mcp/license/lemonsqueezy-verifier.js +207 -0
- package/dist/src/mcp/license/placeholder-verifier.js +10 -0
- package/dist/src/mcp/license/polar-ids.js +100 -0
- package/dist/src/mcp/license/polar-verifier.js +285 -0
- package/dist/src/mcp/license/product-ids.js +73 -0
- package/dist/src/mcp/license/state-store.js +91 -0
- package/dist/src/mcp/license/types.js +11 -0
- package/dist/src/mcp/logging.js +271 -0
- package/dist/src/mcp/product-info.js +54 -0
- package/dist/src/mcp/product.js +56 -0
- package/dist/src/mcp/server.js +253 -0
- package/dist/src/mcp/setup.js +680 -0
- package/dist/src/mcp/start.cjs +117 -0
- package/dist/src/mcp/tool-definition.js +2 -0
- package/dist/src/mcp/tools.js +2425 -0
- package/dist/src/mcp/typography-rules.js +70 -0
- package/dist/src/transport/com.js +250 -0
- package/dist/src/transport/osascript.js +171 -0
- package/dist/src/transport/queue.js +19 -0
- package/dist/src/transport/script-bundle.js +92 -0
- package/dist/src/transport/transport.js +30 -0
- package/indesign/commands/10-app.js +6 -0
- package/indesign/commands/20-documents.js +517 -0
- package/indesign/commands/22-document-setup.js +204 -0
- package/indesign/commands/23-save-package.js +258 -0
- package/indesign/commands/25-export.js +448 -0
- package/indesign/commands/26-export-image.js +202 -0
- package/indesign/commands/27-textdefaults.js +151 -0
- package/indesign/commands/28-selection.js +174 -0
- package/indesign/commands/30-pages.js +1032 -0
- package/indesign/commands/31-view.js +210 -0
- package/indesign/commands/32-sections.js +203 -0
- package/indesign/commands/35-parents.js +428 -0
- package/indesign/commands/37-layout.js +837 -0
- package/indesign/commands/40-frames.js +851 -0
- package/indesign/commands/41-shapes.js +505 -0
- package/indesign/commands/42-groups.js +117 -0
- package/indesign/commands/43-layers.js +310 -0
- package/indesign/commands/44-effects.js +274 -0
- package/indesign/commands/45-frame-options.js +247 -0
- package/indesign/commands/47-anchored.js +331 -0
- package/indesign/commands/50-modify.js +781 -0
- package/indesign/commands/52-align.js +139 -0
- package/indesign/commands/55-fit.js +106 -0
- package/indesign/commands/60-images.js +1128 -0
- package/indesign/commands/62-embed.js +120 -0
- package/indesign/commands/69-placeholders.js +127 -0
- package/indesign/commands/70-text.js +675 -0
- package/indesign/commands/71-outlines.js +92 -0
- package/indesign/commands/72-place-text.js +476 -0
- package/indesign/commands/73-story-lock.js +157 -0
- package/indesign/commands/74-stories.js +121 -0
- package/indesign/commands/75-tables.js +676 -0
- package/indesign/commands/76-text-variables.js +260 -0
- package/indesign/commands/77-story-options.js +86 -0
- package/indesign/commands/78-frame-lines.js +452 -0
- package/indesign/commands/79-check-typography.js +341 -0
- package/indesign/commands/80-styles.js +1865 -0
- package/indesign/commands/81-composition.js +355 -0
- package/indesign/commands/82-object-styles.js +263 -0
- package/indesign/commands/83-drop-caps.js +87 -0
- package/indesign/commands/83-indents-tabs.js +264 -0
- package/indesign/commands/84-import-styles.js +142 -0
- package/indesign/commands/85-swatches.js +112 -0
- package/indesign/commands/86-gradients.js +185 -0
- package/indesign/commands/87-replace-swatch.js +180 -0
- package/indesign/commands/88-replace-font.js +212 -0
- package/indesign/commands/89-toc-index.js +945 -0
- package/indesign/commands/90-print-on-demand.js +495 -0
- package/indesign/commands/91-epub.js +546 -0
- package/indesign/interpreter.js +779 -0
- package/package.json +41 -4
- package/rules/typography-rules.json +31 -0
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Sitzung 38 (A-22 bis A-25, 02.10.2026) – Sperrstatus verwalteter Stories.
|
|
3
|
+
*
|
|
4
|
+
* Beleg: docs/spec/Adobe-DOM-Auszug_InCopy-Sperre_2026-10-02.md –
|
|
5
|
+
* Story.lockState (LockStateValues, r), Story.itemLink (Link, r),
|
|
6
|
+
* Link.filePath, Link.parent (kann Story sein). Welcher Wert in welchem Fall
|
|
7
|
+
* auftritt, ist NICHT belegt; das entscheidet der Integrationstest am Mac.
|
|
8
|
+
* Deshalb sind alle acht Werte abgebildet und die Sperrregel steht an genau
|
|
9
|
+
* einer Stelle (idcLockStateBlocksWriting).
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
/* LockStateValues: DOM-Name, Zahl laut Adobe-Referenz, Rueckgabewert. */
|
|
13
|
+
var IDC_LOCK_STATES = [
|
|
14
|
+
['NONE', 1852796517, 'none'],
|
|
15
|
+
['UNMANAGED_STORY', 1112700269, 'unmanaged_story'],
|
|
16
|
+
['CHECKED_IN_STORY', 1112695657, 'checked_in_story'],
|
|
17
|
+
['CHECKED_OUT_STORY', 1112695663, 'checked_out_story'],
|
|
18
|
+
['LOCKED_STORY', 1112697963, 'locked_story'],
|
|
19
|
+
['EMBEDDED_STORY', 1112696173, 'embedded_story'],
|
|
20
|
+
['MISSING_LOCK_STATE', 1112698227, 'missing_lock_state'],
|
|
21
|
+
['MIXED_LOCK_STATE', 1112698232, 'mixed_lock_state']
|
|
22
|
+
];
|
|
23
|
+
|
|
24
|
+
/* Wert von Story.lockState -> Rueckgabename; unbekannt oder nicht lesbar -> null. */
|
|
25
|
+
function idcLockStateName(value) {
|
|
26
|
+
var i, entry, known = typeof LockStateValues !== 'undefined' && LockStateValues !== null;
|
|
27
|
+
if (value === null || value === undefined) { return null; }
|
|
28
|
+
for (i = 0; i < IDC_LOCK_STATES.length; i++) {
|
|
29
|
+
entry = IDC_LOCK_STATES[i];
|
|
30
|
+
if (known) {
|
|
31
|
+
try { if (IDC.enumIs(value, LockStateValues[entry[0]])) { return entry[2]; } } catch (e0) { /* naechster Weg */ }
|
|
32
|
+
}
|
|
33
|
+
if (IDC.enumIs(value, entry[1]) || String(value) === entry[0]) { return entry[2]; }
|
|
34
|
+
}
|
|
35
|
+
return null;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function idcStoryLockState(story) {
|
|
39
|
+
try { return idcLockStateName(story.lockState); } catch (e) { return null; }
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/*
|
|
43
|
+
* DIE Sperrregel (Vorschlag Sascha, 02.10.2026; der Integrationstest kann
|
|
44
|
+
* sie aendern): schreiben verboten bei allem ausser none, unmanaged_story,
|
|
45
|
+
* checked_out_story und embedded_story. Nicht lesbar (null) gilt als frei –
|
|
46
|
+
* sonst sperrte eine InDesign-Fassung ohne lockState jedes Schreiben.
|
|
47
|
+
*/
|
|
48
|
+
function idcLockStateBlocksWriting(state) {
|
|
49
|
+
return state === 'checked_in_story' || state === 'locked_story' ||
|
|
50
|
+
state === 'missing_lock_state' || state === 'mixed_lock_state';
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/* Verwaltet = an eine Redaktionsdatei gebunden (eingecheckt, ausgecheckt, gesperrt, fehlend, gemischt). */
|
|
54
|
+
function idcLockStateIsManaged(state) {
|
|
55
|
+
return idcLockStateBlocksWriting(state) || state === 'checked_out_story';
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/* Pfad der Redaktionsdatei einer verwalteten Story (wie list_links ihn liest), sonst null. */
|
|
59
|
+
function idcStoryManagedFile(story, state) {
|
|
60
|
+
var link = null, path;
|
|
61
|
+
if (!idcLockStateIsManaged(state)) { return null; }
|
|
62
|
+
try { link = story.itemLink; } catch (e0) { link = null; }
|
|
63
|
+
if (link === null || link === undefined) { return null; }
|
|
64
|
+
try { if (link.isValid === false) { return null; } } catch (e1) { /* weiter */ }
|
|
65
|
+
try { path = String(link.filePath); } catch (e2) { return null; }
|
|
66
|
+
return path === '' ? null : path;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/* { story_id, lock_state, managed, write_locked, managed_file } einer Story. */
|
|
70
|
+
function idcStoryLockInfo(story) {
|
|
71
|
+
var state = idcStoryLockState(story);
|
|
72
|
+
var out = {
|
|
73
|
+
story_id: null,
|
|
74
|
+
lock_state: state,
|
|
75
|
+
managed: idcLockStateIsManaged(state),
|
|
76
|
+
write_locked: idcLockStateBlocksWriting(state),
|
|
77
|
+
managed_file: idcStoryManagedFile(story, state)
|
|
78
|
+
};
|
|
79
|
+
try { out.story_id = Number(story.id); } catch (e) { out.story_id = null; }
|
|
80
|
+
return out;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/*
|
|
84
|
+
* Schreibende Textwerkzeuge (A-23): gesperrte Story -> invalid_state mit
|
|
85
|
+
* details.code "story_locked", analog zu layer_locked (idcRejectLocked).
|
|
86
|
+
* Liefert die Sperrangaben, damit Aufrufer sie weiterverwenden koennen.
|
|
87
|
+
*/
|
|
88
|
+
function idcRejectStoryLocked(story, frameId, what) {
|
|
89
|
+
var info;
|
|
90
|
+
if (story === null || story === undefined) { return null; }
|
|
91
|
+
info = idcStoryLockInfo(story);
|
|
92
|
+
if (!info.write_locked) { return info; }
|
|
93
|
+
IDC.fail('invalid_state', 'The story of frame ' + frameId + ' is locked (lock_state ' + info.lock_state + ': managed by an editorial workflow and not checked out here); ' +
|
|
94
|
+
what + ' cannot change it. Check the story out in the editorial system or in InCopy first, then call ' + what + ' again.',
|
|
95
|
+
{ code: 'story_locked', frame_id: frameId, story_id: info.story_id, lock_state: info.lock_state, managed_file: info.managed_file });
|
|
96
|
+
return info;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/* Story, in der ein verankertes Objekt sitzt (Eltern bis zum Zeichen), sonst null. */
|
|
100
|
+
function idcAnchorStoryOf(item) {
|
|
101
|
+
var current = item, step, name;
|
|
102
|
+
for (step = 0; step < 8; step++) {
|
|
103
|
+
try { current = current.parent; } catch (e0) { return null; }
|
|
104
|
+
if (current === null || current === undefined) { return null; }
|
|
105
|
+
name = IDC.className(current);
|
|
106
|
+
if (name === 'Spread' || name === 'MasterSpread' || name === 'Document') { return null; }
|
|
107
|
+
if (name === 'Character' || name === 'InsertionPoint' || name === 'Text' || name === 'Story') {
|
|
108
|
+
if (name === 'Story') { return current; }
|
|
109
|
+
try { return current.parentStory; } catch (e1) { return null; }
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
return null;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/* Story, deren Inhalt ein Objekt traegt: Textrahmen -> eigene Story, verankertes Objekt -> Story des Ankers. */
|
|
116
|
+
function idcContentStoryOf(item) {
|
|
117
|
+
var story = null;
|
|
118
|
+
if (IDC.isTextFrame(item)) {
|
|
119
|
+
try { story = item.parentStory; } catch (e0) { story = null; }
|
|
120
|
+
return story === undefined ? null : story;
|
|
121
|
+
}
|
|
122
|
+
return idcAnchorStoryOf(item);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/* Anzahl verwalteter Stories eines Dokuments (A-22, A-24); nicht lesbar -> null. */
|
|
126
|
+
function idcManagedStoryCount(doc) {
|
|
127
|
+
var count = 0, i, total;
|
|
128
|
+
try { total = Number(doc.stories.length); } catch (e0) { return null; }
|
|
129
|
+
for (i = 0; i < total; i++) {
|
|
130
|
+
try {
|
|
131
|
+
if (idcLockStateIsManaged(idcStoryLockState(doc.stories.item(i)))) { count += 1; }
|
|
132
|
+
} catch (e1) { /* naechste Story */ }
|
|
133
|
+
}
|
|
134
|
+
return count;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
/* Gesperrte Stories eines Dokuments als Liste der Sperrangaben. */
|
|
138
|
+
function idcWriteLockedStories(doc) {
|
|
139
|
+
var out = [], i, total, info;
|
|
140
|
+
try { total = Number(doc.stories.length); } catch (e0) { return out; }
|
|
141
|
+
for (i = 0; i < total; i++) {
|
|
142
|
+
try {
|
|
143
|
+
info = idcStoryLockInfo(doc.stories.item(i));
|
|
144
|
+
if (info.write_locked) { out.push(info); }
|
|
145
|
+
} catch (e1) { /* naechste Story */ }
|
|
146
|
+
}
|
|
147
|
+
return out;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
/* Warnung beim Sichern (A-24): Kopie/Paket nicht an den Redaktions-Workflow gebunden. */
|
|
151
|
+
function idcManagedSaveWarning(ctx, doc, what) {
|
|
152
|
+
var count = idcManagedStoryCount(doc);
|
|
153
|
+
if (count === null || count < 1) { return 0; }
|
|
154
|
+
ctx.warn('The document contains ' + count + ' managed story/stories (linked to an editorial workflow). ' + what +
|
|
155
|
+
' Saving here does not replace saving or checking in those stories in the editorial system.');
|
|
156
|
+
return count;
|
|
157
|
+
}
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
/* Wunschliste J Nr. 10 (Sitzung 8) – Story-Uebersicht: list_stories. */
|
|
2
|
+
|
|
3
|
+
function idcStoryFrames(doc, story) {
|
|
4
|
+
var out = [], containers, i, frame, landing, entry;
|
|
5
|
+
try { containers = story.textContainers; } catch (e0) { containers = null; }
|
|
6
|
+
if (containers === null || containers === undefined) { return out; }
|
|
7
|
+
for (i = 0; i < containers.length; i++) {
|
|
8
|
+
try { frame = IDC.concrete(containers[i]); } catch (e1) { continue; }
|
|
9
|
+
landing = IDC.landing(frame);
|
|
10
|
+
entry = {
|
|
11
|
+
frame_id: null,
|
|
12
|
+
index: i,
|
|
13
|
+
page_id: landing.page_id,
|
|
14
|
+
page_name: landing.page_name,
|
|
15
|
+
on_pasteboard: landing.on_pasteboard,
|
|
16
|
+
on_parent_page: IDC.isOnParentSpread(frame),
|
|
17
|
+
class_name: IDC.className(frame),
|
|
18
|
+
bounds_mm: null
|
|
19
|
+
};
|
|
20
|
+
try { entry.frame_id = Number(frame.id); } catch (e2) { /* null */ }
|
|
21
|
+
try { entry.bounds_mm = idcItemBounds(doc, frame); } catch (e3) { entry.bounds_mm = null; }
|
|
22
|
+
out.push(entry);
|
|
23
|
+
}
|
|
24
|
+
return out;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function idcStoryOverset(story, frames) {
|
|
28
|
+
var last;
|
|
29
|
+
try { if (story.overflows === true) { return true; } } catch (e0) { /* weiter */ }
|
|
30
|
+
try {
|
|
31
|
+
last = story.textContainers[story.textContainers.length - 1];
|
|
32
|
+
if (last && last.overflows === true) { return true; }
|
|
33
|
+
} catch (e1) { /* unbekannt */ }
|
|
34
|
+
return frames.length === 0 ? null : false;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function idcDescribeStory(doc, story, snippetChars) {
|
|
38
|
+
var frames = idcStoryFrames(doc, story);
|
|
39
|
+
var ids = [], i;
|
|
40
|
+
var out = {
|
|
41
|
+
story_id: null,
|
|
42
|
+
frame_ids: ids,
|
|
43
|
+
frame_count: frames.length,
|
|
44
|
+
frames: frames,
|
|
45
|
+
character_count: null,
|
|
46
|
+
paragraph_count: null,
|
|
47
|
+
table_count: null,
|
|
48
|
+
overset: idcStoryOverset(story, frames),
|
|
49
|
+
on_parent_page: frames.length > 0 ? frames[0].on_parent_page : false,
|
|
50
|
+
first_page_id: frames.length > 0 ? frames[0].page_id : null,
|
|
51
|
+
first_page_name: frames.length > 0 ? frames[0].page_name : '',
|
|
52
|
+
first_paragraph_style: null,
|
|
53
|
+
snippet: '',
|
|
54
|
+
lock_state: null,
|
|
55
|
+
managed_file: null
|
|
56
|
+
};
|
|
57
|
+
var lockInfo = idcStoryLockInfo(story);
|
|
58
|
+
for (i = 0; i < frames.length; i++) { ids.push(frames[i].frame_id); }
|
|
59
|
+
try { out.story_id = Number(story.id); } catch (e0) { /* null */ }
|
|
60
|
+
try { out.character_count = Number(story.characters.length); } catch (e1) { /* null */ }
|
|
61
|
+
try { out.paragraph_count = Number(story.paragraphs.length); } catch (e2) { /* null */ }
|
|
62
|
+
try { out.table_count = Number(story.tables.length); } catch (e3) { /* null */ }
|
|
63
|
+
try {
|
|
64
|
+
if (out.paragraph_count !== null && out.paragraph_count > 0) {
|
|
65
|
+
out.first_paragraph_style = idcParagraphStyleName(story.paragraphs.item(0));
|
|
66
|
+
}
|
|
67
|
+
} catch (e4) { out.first_paragraph_style = null; }
|
|
68
|
+
try { out.snippet = idcSnippet(story.contents, snippetChars); } catch (e5) { out.snippet = ''; }
|
|
69
|
+
out.lock_state = lockInfo.lock_state;
|
|
70
|
+
out.managed_file = lockInfo.managed_file;
|
|
71
|
+
return out;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
IDC.register('list_stories', { needs_document: true, read_only: true, ruler: 'page' },
|
|
75
|
+
function (ctx) {
|
|
76
|
+
var args = ctx.args;
|
|
77
|
+
var doc = ctx.doc;
|
|
78
|
+
var includeParents = args.include_parent_pages === true;
|
|
79
|
+
var includeEmpty = args.include_empty !== false;
|
|
80
|
+
var snippetChars = idcCountArg(args.snippet_chars, 'snippet_chars', 0, 2000, 80);
|
|
81
|
+
var pageId = args.page_id === undefined || args.page_id === null ? null : args.page_id;
|
|
82
|
+
var out = [], i, j, story, entry, oversetCount = 0, parentsSkipped = 0, emptySkipped = 0, total = 0, onPage;
|
|
83
|
+
|
|
84
|
+
if (pageId !== null && (typeof pageId !== 'number' || Math.floor(pageId) !== pageId)) {
|
|
85
|
+
IDC.fail('invalid_argument', 'page_id must be a whole number.', { page_id: pageId });
|
|
86
|
+
}
|
|
87
|
+
if (pageId !== null && IDC.pageById(doc, pageId) === null) {
|
|
88
|
+
IDC.fail('not_found', 'No page with page_id ' + pageId + ' in this document.', { page_id: pageId });
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
try { total = Number(doc.stories.length); } catch (e0) { total = 0; }
|
|
92
|
+
for (i = 0; i < total; i++) {
|
|
93
|
+
try { story = doc.stories.item(i); } catch (e1) { continue; }
|
|
94
|
+
entry = idcDescribeStory(doc, story, snippetChars);
|
|
95
|
+
if (entry.on_parent_page && !includeParents) { parentsSkipped += 1; continue; }
|
|
96
|
+
if (entry.character_count === 0 && !includeEmpty) { emptySkipped += 1; continue; }
|
|
97
|
+
if (pageId !== null) {
|
|
98
|
+
onPage = false;
|
|
99
|
+
for (j = 0; j < entry.frames.length; j++) {
|
|
100
|
+
if (entry.frames[j].page_id === pageId) { onPage = true; break; }
|
|
101
|
+
}
|
|
102
|
+
if (!onPage) { continue; }
|
|
103
|
+
}
|
|
104
|
+
if (entry.overset === true) { oversetCount += 1; }
|
|
105
|
+
out.push(entry);
|
|
106
|
+
}
|
|
107
|
+
if (oversetCount > 0) {
|
|
108
|
+
ctx.warn(oversetCount + ' story/stories overflow (Übersatz) – enlarge the last frame or thread another one.');
|
|
109
|
+
}
|
|
110
|
+
return {
|
|
111
|
+
stories: out,
|
|
112
|
+
count: out.length,
|
|
113
|
+
total_stories: total,
|
|
114
|
+
overset_count: oversetCount,
|
|
115
|
+
parent_page_stories_skipped: parentsSkipped,
|
|
116
|
+
empty_stories_skipped: emptySkipped,
|
|
117
|
+
page_id: pageId,
|
|
118
|
+
include_parent_pages: includeParents,
|
|
119
|
+
include_empty: includeEmpty
|
|
120
|
+
};
|
|
121
|
+
});
|