layoutbridge-light 1.0.0 → 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 (35) hide show
  1. package/CHANGELOG.md +83 -0
  2. package/README.de.md +31 -2
  3. package/README.md +31 -3
  4. package/THIRD-PARTY-NOTICES.md +2 -2
  5. package/dist/src/mcp/catalog.js +9 -4
  6. package/dist/src/mcp/content-credentials.js +65 -0
  7. package/dist/src/mcp/dispatch.js +8 -1
  8. package/dist/src/mcp/license/polar-ids.js +1 -1
  9. package/dist/src/mcp/pdf-postprocess.js +798 -0
  10. package/dist/src/mcp/server.js +1 -1
  11. package/dist/src/mcp/target-folder.js +25 -0
  12. package/dist/src/mcp/tools.js +275 -20
  13. package/dist/src/mcp/typography-rules.js +1 -1
  14. package/dist/src/transport/com.js +224 -38
  15. package/dist/src/transport/transport.js +22 -0
  16. package/indesign/commands/25-export.js +258 -11
  17. package/indesign/commands/26-export-image.js +1 -1
  18. package/indesign/commands/31-view.js +100 -0
  19. package/indesign/commands/35-parents.js +44 -24
  20. package/indesign/commands/40-frames.js +35 -0
  21. package/indesign/commands/47-anchored.js +142 -0
  22. package/indesign/commands/50-modify.js +25 -3
  23. package/indesign/commands/60-images.js +28 -2
  24. package/indesign/commands/69-placeholders.js +7 -2
  25. package/indesign/commands/70-text.js +39 -4
  26. package/indesign/commands/75-tables.js +27 -1
  27. package/indesign/commands/78-frame-lines.js +59 -0
  28. package/indesign/commands/79-check-typography.js +143 -4
  29. package/indesign/commands/80-styles.js +105 -10
  30. package/indesign/commands/89-toc-index.js +61 -4
  31. package/indesign/commands/91-epub.js +92 -9
  32. package/indesign/commands/92-accessibility.js +1131 -0
  33. package/indesign/interpreter.js +51 -1
  34. package/package.json +1 -1
  35. package/rules/typography-rules.json +3 -2
@@ -349,11 +349,29 @@ var IDC = (function () {
349
349
  return spread !== null && api.className(spread) === 'MasterSpread';
350
350
  };
351
351
 
352
+ /*
353
+ * A-73 (Sitzung 81, Integrationstest): pageItems.itemByID loest in InDesign
354
+ * 21.6 jede Objekt-ID des Dokuments auf, auch die einer Story, und meldet
355
+ * sie als gueltig; ein Befehl daran endete mit script_error
356
+ * („geometricBounds“). Gilt deshalb nur, was Seitenobjekt oder Grafik ist
357
+ * (geometricBounds mit vier Werten); die Art des Abgelehnten merkt
358
+ * api.rejectedClass fuer die Fehlermeldung.
359
+ */
360
+ function isPlaced(item) {
361
+ var bounds;
362
+ try { bounds = item.geometricBounds; } catch (e) { return false; }
363
+ return bounds !== null && bounds !== undefined && bounds.length === 4;
364
+ }
365
+
352
366
  function findInCollection(collection, wanted) {
353
367
  var item;
354
368
  try {
355
369
  item = collection.itemByID(wanted);
356
- if (item && item.isValid === true) { return api.concrete(item); }
370
+ if (item && item.isValid === true) {
371
+ item = api.concrete(item);
372
+ if (isPlaced(item)) { return item; }
373
+ try { api.rejectedClass = api.className(item); } catch (e1) { api.rejectedClass = null; }
374
+ }
357
375
  } catch (e) { /* nicht hier */ }
358
376
  return null;
359
377
  }
@@ -374,11 +392,13 @@ var IDC = (function () {
374
392
  * where: 'any' (Vorgabe) | 'document' (nur Dokumentseiten) | 'parent'
375
393
  * (nur Musterseiten). Liefert { item, on_parent } oder null.
376
394
  */
395
+ api.rejectedClass = null;
377
396
  api.itemById = function (doc, id, where) {
378
397
  var wanted = Number(id);
379
398
  var scope = where || 'any';
380
399
  var found = null;
381
400
  var i, spread;
401
+ api.rejectedClass = null;
382
402
 
383
403
  if (scope !== 'parent') {
384
404
  found = findInCollection(doc.pageItems, wanted);
@@ -578,8 +598,26 @@ var IDC = (function () {
578
598
 
579
599
  /* ------------------------------------------------------------- Ausfuehrung */
580
600
 
601
+ /*
602
+ * A-68 Befund (13), Sitzung 81: Waehrend dieser Befehle sprang die Ansicht
603
+ * auf andere Seiten, obwohl keep_view sie am Ende zurueckstellte (Anlass
604
+ * Bildschirmaufnahmen). Fuer ihre Dauer wird der Bildschirmaufbau
605
+ * abgeschaltet (scriptPreferences.enableRedraw) und danach
606
+ * zurueckgestellt – mit keep_view false nicht.
607
+ */
608
+ var QUIET_VIEW = {
609
+ place_text_file: true, autoflow_story: true, create_toc: true, generate_index: true,
610
+ add_page: true, create_parent_page: true, duplicate_parent_page: true,
611
+ apply_paragraph_style: true, apply_paragraph_style_to_range: true,
612
+ define_paragraph_style: true, define_character_style: true
613
+ };
614
+
581
615
  function restore(state) {
582
616
  var problems = [];
617
+ if (state.redrawSet) {
618
+ try { app.scriptPreferences.enableRedraw = state.prevRedraw; }
619
+ catch (e0) { problems.push('screen redraw: ' + String(e0)); }
620
+ }
583
621
  if (state.docRulerSet) {
584
622
  try { state.doc.viewPreferences.rulerOrigin = state.prevRulerOrigin; }
585
623
  catch (e1) { problems.push('ruler origin: ' + String(e1)); }
@@ -621,6 +659,8 @@ var IDC = (function () {
621
659
  interactionSet: false,
622
660
  docRulerSet: false,
623
661
  zeroPointSet: false,
662
+ redrawSet: false,
663
+ prevRedraw: null,
624
664
  prevZeroPoint: null,
625
665
  prevUnit: null,
626
666
  prevInteraction: null,
@@ -651,6 +691,16 @@ var IDC = (function () {
651
691
  app.scriptPreferences.userInteractionLevel = UserInteractionLevels.NEVER_INTERACT;
652
692
  state.interactionSet = true;
653
693
 
694
+ if (hasOwn(QUIET_VIEW, command.cmd) && args.keep_view !== false) {
695
+ try {
696
+ state.prevRedraw = app.scriptPreferences.enableRedraw;
697
+ if (state.prevRedraw !== false) {
698
+ app.scriptPreferences.enableRedraw = false;
699
+ state.redrawSet = true;
700
+ }
701
+ } catch (er) { state.redrawSet = false; }
702
+ }
703
+
654
704
  var doc = null;
655
705
  if (entry.needs_document) {
656
706
  doc = api.resolveDocument(args);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "layoutbridge-light",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "license": "SEE LICENSE IN LICENSE",
5
5
  "description": "LayoutBridge Light for Adobe InDesign® – MCP server for book typesetting in Adobe® InDesign® (npm package layoutbridge-light). Adobe and InDesign are either registered trademarks or trademarks of Adobe in the United States and/or other countries.",
6
6
  "mcpName": "com.mcp-interfaces/layoutbridge-light",
@@ -1,5 +1,5 @@
1
1
  {
2
- "_hinweis": "Regelkatalog fuer check_typography (Auftrag A-7.6, Sitzung 9). Daten, kein Code: der Server liest die Tabelle, waehlt nach locale, rules und exclude_rules aus und reicht die Zeilen an den Interpreter. kind grep = InDesign-GREP-Muster (Zeichenregeln), kind lines = Umbruchregel ueber get_frame_lines (check nennt die Pruefung). Eine Kennung darf je Sprache eine eigene Zeile haben. Quellen: Forssman/de Jong, Detailtypografie (8. Aufl.); Duden, Satz und Korrektur; DIN 5008; Bier, typokurz 1.6; Bringhurst, Elements of Typographic Style; typolexikon.de; Wikipedia Hurenkind und Schusterjunge.",
2
+ "_hinweis": "Regelkatalog fuer check_typography (Auftrag A-7.6, Sitzung 9). Daten, kein Code: der Server liest die Tabelle, waehlt nach locale, rules und exclude_rules aus und reicht die Zeilen an den Interpreter. kind grep = InDesign-GREP-Muster (Zeichenregeln), kind lines = Umbruchregel ueber get_frame_lines (check nennt die Pruefung). kind language = Sprache der Textbereiche gegen die Sprache ihres Absatzformats (A-78). Eine Kennung darf je Sprache eine eigene Zeile haben. Quellen: Forssman/de Jong, Detailtypografie (8. Aufl.); Duden, Satz und Korrektur; DIN 5008; Bier, typokurz 1.6; Bringhurst, Elements of Typographic Style; typolexikon.de; Wikipedia Hurenkind und Schusterjunge.",
3
3
  "rules": [
4
4
  { "id": "double_space", "locales": ["de", "de-CH", "en"], "category": "spacing", "severity": "warning", "kind": "grep", "pattern": "\\x{0020}{2,}", "message": "Two or more consecutive spaces (doppeltes Leerzeichen)", "suggestion": "find_replace mode grep: find \"\\x{0020}{2,}\", replace \" \"", "source": "Duden, Satz und Korrektur; typokurz 1.6" },
5
5
  { "id": "space_before_punct", "locales": ["de", "de-CH", "en"], "category": "spacing", "severity": "warning", "kind": "grep", "pattern": "[\\x{0020}\\x{00A0}\\x{202F}]+(?=[.,;:!?])", "message": "Space before a punctuation mark (Leerzeichen vor Satzzeichen)", "suggestion": "find_replace mode grep: find \"[\\x{0020}\\x{00A0}\\x{202F}]+(?=[.,;:!?])\", replace \"\"", "source": "Duden, Satz und Korrektur; typokurz 1.6" },
@@ -26,6 +26,7 @@
26
26
  { "id": "single_word_last_line", "locales": ["de", "de-CH", "en"], "category": "line_break", "severity": "info", "kind": "lines", "check": "single_word_last_line", "message": "Last line of a paragraph holds a single word or is shorter than min_last_line_chars (Einzelwort-Ausgang)", "suggestion": "Adjust the justification options or tracking of the paragraph, or ask for a small text change", "source": "Forssman/de Jong, Detailtypografie" },
27
27
  { "id": "hyphen_ladder", "locales": ["de", "de-CH", "en"], "category": "hyphenation", "severity": "warning", "kind": "lines", "check": "hyphen_ladder", "message": "More consecutive hyphenated lines than max_consecutive_hyphens allows (Trennstrichleiter)", "suggestion": "Set hyphenation_options {ladder_limit: 3} on the paragraph style", "source": "Forssman/de Jong, Detailtypografie" },
28
28
  { "id": "empty_line_at_column_start", "locales": ["de", "de-CH", "en"], "category": "line_break", "severity": "warning", "kind": "lines", "check": "empty_line_at_column_start", "message": "First line of the column is an empty paragraph (Leerzeile am Spaltenanfang)", "suggestion": "Delete the empty paragraph; use paragraph spacing instead", "source": "Forssman/de Jong, Detailtypografie" },
29
- { "id": "column_first_baselines_differ", "locales": ["de", "de-CH", "en"], "category": "line_break", "severity": "info", "kind": "lines", "check": "column_first_baselines_differ", "message": "First baselines of neighbouring columns of the same frame differ by more than 0.1 mm (Spaltenanfänge nicht auf gleicher Höhe)", "suggestion": "Align the paragraphs to the baseline grid or set the same first-baseline offset", "source": "Forssman/de Jong, Detailtypografie" }
29
+ { "id": "column_first_baselines_differ", "locales": ["de", "de-CH", "en"], "category": "line_break", "severity": "info", "kind": "lines", "check": "column_first_baselines_differ", "message": "First baselines of neighbouring columns of the same frame differ by more than 0.1 mm (Spaltenanfänge nicht auf gleicher Höhe)", "suggestion": "Align the paragraphs to the baseline grid or set the same first-baseline offset", "source": "Forssman/de Jong, Detailtypografie" },
30
+ { "id": "foreign_language_in_text", "locales": ["de", "de-CH", "en"], "category": "language", "severity": "warning", "kind": "language", "check": "foreign_language_in_text", "message": "Text range in a language other than its paragraph style – hyphenation and spelling follow that dictionary (fremde Sprache im Text)", "suggestion": "If the range is not meant to be foreign-language, set it to the language of its paragraph style with apply_character_format_to_range language; a real foreign-language quotation can stay", "source": "Forssman/de Jong, Detailtypografie (Silbentrennung nach Sprache)"}
30
31
  ]
31
32
  }