@embedpdf/viewer-chrome 3.0.0-next.1 → 3.0.0-next.11
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/dist/chrome.cjs +8 -1
- package/dist/chrome.cjs.map +1 -1
- package/dist/chrome.d.cts +1 -0
- package/dist/chrome.d.ts +1 -0
- package/dist/chrome.js +8 -1
- package/dist/chrome.js.map +1 -1
- package/dist/commands.cjs +48 -9
- package/dist/commands.cjs.map +1 -1
- package/dist/commands.js +49 -10
- package/dist/commands.js.map +1 -1
- package/dist/{es-C5084JO6.cjs → es-B7b8KjR3.cjs} +44 -1
- package/dist/es-B7b8KjR3.cjs.map +1 -0
- package/dist/{es-D0PzYE9Z.js → es-aQlZ3hcL.js} +44 -1
- package/dist/es-aQlZ3hcL.js.map +1 -0
- package/dist/index.cjs +727 -138
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +733 -144
- package/dist/index.js.map +1 -1
- package/package.json +5 -4
- package/dist/es-C5084JO6.cjs.map +0 -1
- package/dist/es-D0PzYE9Z.js.map +0 -1
package/dist/chrome.cjs
CHANGED
|
@@ -186,6 +186,10 @@ const annotationStrip = {
|
|
|
186
186
|
"annotation:ungroup"
|
|
187
187
|
]), (0, _embedpdf_react_toolbar.group)("annotation-danger", { importance: 5 }, ["annotation:delete"])] }
|
|
188
188
|
};
|
|
189
|
+
const selectionStrip = {
|
|
190
|
+
id: "selection-strip",
|
|
191
|
+
sections: { center: [(0, _embedpdf_react_toolbar.group)("selection-actions", { importance: 4 }, ["selection:copy"])] }
|
|
192
|
+
};
|
|
189
193
|
/**
|
|
190
194
|
* The DEFAULT chrome — exported as a VALUE, which is the whole customization
|
|
191
195
|
* model: consumers pass nothing and track this, transform it, or write their
|
|
@@ -205,7 +209,10 @@ const defaultChrome = (0, _embedpdf_react_toolbar.defineChrome)({
|
|
|
205
209
|
zoom: zoomMenu,
|
|
206
210
|
"page-settings": pageSettingsMenu
|
|
207
211
|
},
|
|
208
|
-
strips: {
|
|
212
|
+
strips: {
|
|
213
|
+
annotation: annotationStrip,
|
|
214
|
+
selection: selectionStrip
|
|
215
|
+
}
|
|
209
216
|
});
|
|
210
217
|
/** Menu lookup by id (arbitrary string). */
|
|
211
218
|
function getMenu(schema, id) {
|
package/dist/chrome.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chrome.cjs","names":[],"sources":["../src/config/chrome.ts"],"sourcesContent":["/**\n * The chrome — structure only. No breakpoints, no show/hide lists, no locale\n * overrides, no dividers/spacers, no hand-written overflow menus. What fits is\n * measured and solved at runtime (@embedpdf/core-ui); the overflow menu is\n * derived. Compare to the v2 snippet's 1,950-line ui-schema.ts.\n *\n * `importance` (1 sheds first … 5 pinned) is the only responsive knob.\n */\nimport {\n defineChrome,\n group,\n item,\n custom,\n type BarSchema,\n type ChromeSchema,\n type MenuSchema,\n} from '@embedpdf/react/toolbar';\n\n// Reused across every mode band — plain values, so composition is just a const.\nconst style = group('style', { importance: 4 }, [item('panel:annotation-style')]);\nconst history = group('history', { importance: 3 }, ['history:undo', 'history:redo']);\n\n// ── main toolbar ─────────────────────────────────────────────────────────────\nconst mainBar: BarSchema = {\n id: 'main',\n sections: {\n // v2 layout: everything before the first spacer sits LEFT-aligned —\n // document menu, workspace, zoom strip, pan/pointer. Only the mode tabs\n // are truly centered.\n start: [\n group('document', { importance: 5 }, [item('document:menu')]),\n group('workspace', { importance: 4 }, [\n item('panel:sidebar', { importance: 5 }),\n item('page:settings'),\n ]),\n // The inline zoom strip; when it can't fit it renders its 'button'\n // variant, and in the overflow menu it projects through zoom:menu.\n group('zoom', { importance: 4 }, [\n custom('zoom-controls', { variants: ['inline', 'button'], terminal: 'zoom:menu' }),\n ]),\n group('tools', { importance: 2 }, ['pan:toggle', 'pointer:toggle']),\n ],\n center: [\n group('modes', {\n role: 'tabs',\n // The group ladder: full strip → trailing tabs shed behind a derived\n // in-strip chevron (v2's overflow-tabs-button) → select (v2's\n // mode-select-button) → global overflow. Tab items at importance 1 so\n // the strip is the FIRST thing to compact; the group at 4 so its\n // compact forms survive long.\n shed: true,\n collapse: 'select',\n importance: 4,\n labelKey: 'commands.mode.group',\n items: [\n item('mode:view', { variants: ['label'], importance: 1 }),\n item('mode:annotate', { variants: ['label'], importance: 1 }),\n item('mode:shapes', { variants: ['label'], importance: 1 }),\n item('mode:insert', { variants: ['label'], importance: 1 }),\n item('mode:form', { variants: ['label'], importance: 1 }),\n item('mode:redact', { variants: ['label'], importance: 1 }),\n ],\n }),\n ],\n end: [group('panels', { importance: 5 }, ['panel:search', 'panel:comment'])],\n },\n};\n\n// ── secondary bands (one per mode; which shows is derived from shell) ────────\nconst annotateBar: BarSchema = {\n id: 'annotate',\n sections: {\n center: [\n group('comment', { importance: 4 }, ['annotation:add-note', 'annotation:add-link']),\n group('markup', { importance: 4 }, [\n 'annotation:add-highlight',\n 'annotation:add-strikeout',\n 'annotation:add-underline',\n 'annotation:add-squiggly',\n ]),\n group('draw', { importance: 3 }, ['annotation:add-ink', 'annotation:add-ink-highlight']),\n group('text', { importance: 2 }, [\n 'annotation:add-text',\n 'annotation:add-insert-text',\n 'annotation:add-replace-text',\n 'annotation:add-callout',\n ]),\n style,\n history,\n ],\n },\n};\n\nconst shapesBar: BarSchema = {\n id: 'shapes',\n sections: {\n center: [\n group('shapes', { importance: 4 }, [\n 'annotation:add-rectangle',\n 'annotation:add-circle',\n 'annotation:add-line',\n 'annotation:add-arrow',\n ]),\n group('polygons', { importance: 2 }, ['annotation:add-polygon', 'annotation:add-polyline']),\n style,\n history,\n ],\n },\n};\n\nconst insertBar: BarSchema = {\n id: 'insert',\n sections: {\n center: [\n group('stamps', { importance: 4 }, [\n 'insert:add-stamp',\n 'insert:add-attachment',\n 'insert:add-signature',\n 'insert:add-image',\n ]),\n style,\n history,\n ],\n },\n};\n\nconst formBar: BarSchema = {\n id: 'form',\n sections: {\n center: [\n group('fields', { importance: 4 }, [\n 'form:add-textfield',\n 'form:add-checkbox',\n 'form:add-radio',\n ]),\n group('choice-fields', { importance: 2 }, ['form:add-select', 'form:add-listbox']),\n history,\n ],\n },\n};\n\nconst redactBar: BarSchema = {\n id: 'redact',\n sections: {\n center: [\n group('redact', { importance: 4 }, ['redaction:redact', 'panel:redaction']),\n style,\n history,\n ],\n },\n};\n\n// ── menus (command trees; separators derive between sections) ────────────────\nconst documentMenu: MenuSchema = {\n id: 'document',\n sections: [\n { items: ['document:download', 'document:print'] },\n { items: ['document:fullscreen'] },\n ],\n};\n\nconst zoomMenu: MenuSchema = {\n id: 'zoom',\n sections: [\n {\n labelKey: 'commands.zoom.level',\n items: ['zoom:50', 'zoom:100', 'zoom:150', 'zoom:200', 'zoom:400'],\n },\n { items: ['zoom:in', 'zoom:out'] },\n { items: ['zoom:fit-page', 'zoom:fit-width', 'zoom:automatic'] },\n ],\n};\n\nconst pageSettingsMenu: MenuSchema = {\n id: 'page-settings',\n sections: [\n { labelKey: 'commands.spread.group', items: ['spread:none', 'spread:odd', 'spread:even'] },\n { labelKey: 'commands.scroll.group', items: ['scroll:vertical', 'scroll:horizontal'] },\n { labelKey: 'commands.rotate.group', items: ['rotate:clockwise', 'rotate:counter-clockwise'] },\n { items: ['document:fullscreen'] },\n ],\n};\n\n// ── contextual strips (anchored to selections; same BarSchema vocabulary) ────\n// WHICH commands actually show is each command's `visible` derivation (group\n// only when groupable, style only when the kind declares editable props…), so\n// one strip serves single AND multi selection — v2 needed two schemas for that.\nconst annotationStrip: BarSchema = {\n id: 'annotation-strip',\n sections: {\n center: [\n group('annotation-actions', { importance: 4 }, [\n 'annotation:comment',\n 'annotation:style',\n 'annotation:link',\n 'annotation:goto-link',\n 'annotation:remove-link',\n 'annotation:group',\n 'annotation:ungroup',\n ]),\n // Its own group → a derived separator; delete stands apart.\n group('annotation-danger', { importance: 5 }, ['annotation:delete']),\n ],\n },\n};\n\n/**\n * The DEFAULT chrome — exported as a VALUE, which is the whole customization\n * model: consumers pass nothing and track this, transform it, or write their\n * own. It is never merged with anything.\n */\nexport const defaultChrome = defineChrome({\n bars: { main: mainBar },\n modeBars: {\n 'mode:annotate': annotateBar,\n 'mode:shapes': shapesBar,\n 'mode:insert': insertBar,\n 'mode:form': formBar,\n 'mode:redact': redactBar,\n },\n menus: { document: documentMenu, zoom: zoomMenu, 'page-settings': pageSettingsMenu },\n strips: { annotation: annotationStrip },\n});\n\n// Lookups take the RESOLVED schema (the host may have replaced the default) —\n// the typed literal widens to arbitrary string keys here, once.\n\n/** Menu lookup by id (arbitrary string). */\nexport function getMenu(schema: ChromeSchema, id: string): MenuSchema | undefined {\n return (schema.menus as Record<string, MenuSchema> | undefined)?.[id];\n}\n\n/** Secondary band lookup by mode-surface id. */\nexport function getModeBar(schema: ChromeSchema, id: string): BarSchema | undefined {\n return (schema.modeBars as Record<string, BarSchema> | undefined)?.[id];\n}\n\n/** Contextual strip lookup by context id ('annotation', …). */\nexport function getStrip(schema: ChromeSchema, id: string): BarSchema | undefined {\n return (schema.strips as Record<string, BarSchema> | undefined)?.[id];\n}\n"],"mappings":";;;;;;;;;;;AAmBA,MAAM,SAAA,GAAA,wBAAA,MAAA,CAAc,SAAS,EAAE,YAAY,EAAE,GAAG,EAAA,GAAA,wBAAA,KAAA,CAAM,wBAAwB,CAAC,CAAC;AAChF,MAAM,WAAA,GAAA,wBAAA,MAAA,CAAgB,WAAW,EAAE,YAAY,EAAE,GAAG,CAAC,gBAAgB,cAAc,CAAC;AAGpF,MAAM,UAAqB;CACzB,IAAI;CACJ,UAAU;EAIR,OAAO;IACC,GAAA,wBAAA,MAAA,CAAA,YAAY,EAAE,YAAY,EAAE,GAAG,EAAA,GAAA,wBAAA,KAAA,CAAM,eAAe,CAAC,CAAC;IACtD,GAAA,wBAAA,MAAA,CAAA,aAAa,EAAE,YAAY,EAAE,GAAG,EAAA,GAAA,wBAAA,KAAA,CAC/B,iBAAiB,EAAE,YAAY,EAAE,CAAC,IAAA,GAAA,wBAAA,KAAA,CAClC,eAAe,CACt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O,SAAmD;AACpE"}
|
|
1
|
+
{"version":3,"file":"chrome.cjs","names":[],"sources":["../src/config/chrome.ts"],"sourcesContent":["/**\n * The chrome — structure only. No breakpoints, no show/hide lists, no locale\n * overrides, no dividers/spacers, no hand-written overflow menus. What fits is\n * measured and solved at runtime (@embedpdf/core-ui); the overflow menu is\n * derived. Compare to the v2 snippet's 1,950-line ui-schema.ts.\n *\n * `importance` (1 sheds first … 5 pinned) is the only responsive knob.\n */\nimport {\n defineChrome,\n group,\n item,\n custom,\n type BarSchema,\n type ChromeSchema,\n type MenuSchema,\n} from '@embedpdf/react/toolbar';\n\n// Reused across every mode band — plain values, so composition is just a const.\nconst style = group('style', { importance: 4 }, [item('panel:annotation-style')]);\nconst history = group('history', { importance: 3 }, ['history:undo', 'history:redo']);\n\n// ── main toolbar ─────────────────────────────────────────────────────────────\nconst mainBar: BarSchema = {\n id: 'main',\n sections: {\n // v2 layout: everything before the first spacer sits LEFT-aligned —\n // document menu, workspace, zoom strip, pan/pointer. Only the mode tabs\n // are truly centered.\n start: [\n group('document', { importance: 5 }, [item('document:menu')]),\n group('workspace', { importance: 4 }, [\n item('panel:sidebar', { importance: 5 }),\n item('page:settings'),\n ]),\n // The inline zoom strip; when it can't fit it renders its 'button'\n // variant, and in the overflow menu it projects through zoom:menu.\n group('zoom', { importance: 4 }, [\n custom('zoom-controls', { variants: ['inline', 'button'], terminal: 'zoom:menu' }),\n ]),\n group('tools', { importance: 2 }, ['pan:toggle', 'pointer:toggle']),\n ],\n center: [\n group('modes', {\n role: 'tabs',\n // The group ladder: full strip → trailing tabs shed behind a derived\n // in-strip chevron (v2's overflow-tabs-button) → select (v2's\n // mode-select-button) → global overflow. Tab items at importance 1 so\n // the strip is the FIRST thing to compact; the group at 4 so its\n // compact forms survive long.\n shed: true,\n collapse: 'select',\n importance: 4,\n labelKey: 'commands.mode.group',\n items: [\n item('mode:view', { variants: ['label'], importance: 1 }),\n item('mode:annotate', { variants: ['label'], importance: 1 }),\n item('mode:shapes', { variants: ['label'], importance: 1 }),\n item('mode:insert', { variants: ['label'], importance: 1 }),\n item('mode:form', { variants: ['label'], importance: 1 }),\n item('mode:redact', { variants: ['label'], importance: 1 }),\n ],\n }),\n ],\n end: [group('panels', { importance: 5 }, ['panel:search', 'panel:comment'])],\n },\n};\n\n// ── secondary bands (one per mode; which shows is derived from shell) ────────\nconst annotateBar: BarSchema = {\n id: 'annotate',\n sections: {\n center: [\n group('comment', { importance: 4 }, ['annotation:add-note', 'annotation:add-link']),\n group('markup', { importance: 4 }, [\n 'annotation:add-highlight',\n 'annotation:add-strikeout',\n 'annotation:add-underline',\n 'annotation:add-squiggly',\n ]),\n group('draw', { importance: 3 }, ['annotation:add-ink', 'annotation:add-ink-highlight']),\n group('text', { importance: 2 }, [\n 'annotation:add-text',\n 'annotation:add-insert-text',\n 'annotation:add-replace-text',\n 'annotation:add-callout',\n ]),\n style,\n history,\n ],\n },\n};\n\nconst shapesBar: BarSchema = {\n id: 'shapes',\n sections: {\n center: [\n group('shapes', { importance: 4 }, [\n 'annotation:add-rectangle',\n 'annotation:add-circle',\n 'annotation:add-line',\n 'annotation:add-arrow',\n ]),\n group('polygons', { importance: 2 }, ['annotation:add-polygon', 'annotation:add-polyline']),\n style,\n history,\n ],\n },\n};\n\nconst insertBar: BarSchema = {\n id: 'insert',\n sections: {\n center: [\n group('stamps', { importance: 4 }, [\n 'insert:add-stamp',\n 'insert:add-attachment',\n 'insert:add-signature',\n 'insert:add-image',\n ]),\n style,\n history,\n ],\n },\n};\n\nconst formBar: BarSchema = {\n id: 'form',\n sections: {\n center: [\n group('fields', { importance: 4 }, [\n 'form:add-textfield',\n 'form:add-checkbox',\n 'form:add-radio',\n ]),\n group('choice-fields', { importance: 2 }, ['form:add-select', 'form:add-listbox']),\n history,\n ],\n },\n};\n\nconst redactBar: BarSchema = {\n id: 'redact',\n sections: {\n center: [\n group('redact', { importance: 4 }, ['redaction:redact', 'panel:redaction']),\n style,\n history,\n ],\n },\n};\n\n// ── menus (command trees; separators derive between sections) ────────────────\nconst documentMenu: MenuSchema = {\n id: 'document',\n sections: [\n { items: ['document:download', 'document:print'] },\n { items: ['document:fullscreen'] },\n ],\n};\n\nconst zoomMenu: MenuSchema = {\n id: 'zoom',\n sections: [\n {\n labelKey: 'commands.zoom.level',\n items: ['zoom:50', 'zoom:100', 'zoom:150', 'zoom:200', 'zoom:400'],\n },\n { items: ['zoom:in', 'zoom:out'] },\n { items: ['zoom:fit-page', 'zoom:fit-width', 'zoom:automatic'] },\n ],\n};\n\nconst pageSettingsMenu: MenuSchema = {\n id: 'page-settings',\n sections: [\n { labelKey: 'commands.spread.group', items: ['spread:none', 'spread:odd', 'spread:even'] },\n { labelKey: 'commands.scroll.group', items: ['scroll:vertical', 'scroll:horizontal'] },\n { labelKey: 'commands.rotate.group', items: ['rotate:clockwise', 'rotate:counter-clockwise'] },\n { items: ['document:fullscreen'] },\n ],\n};\n\n// ── contextual strips (anchored to selections; same BarSchema vocabulary) ────\n// WHICH commands actually show is each command's `visible` derivation (group\n// only when groupable, style only when the kind declares editable props…), so\n// one strip serves single AND multi selection — v2 needed two schemas for that.\nconst annotationStrip: BarSchema = {\n id: 'annotation-strip',\n sections: {\n center: [\n group('annotation-actions', { importance: 4 }, [\n 'annotation:comment',\n 'annotation:style',\n 'annotation:link',\n 'annotation:goto-link',\n 'annotation:remove-link',\n 'annotation:group',\n 'annotation:ungroup',\n ]),\n // Its own group → a derived separator; delete stands apart.\n group('annotation-danger', { importance: 5 }, ['annotation:delete']),\n ],\n },\n};\n\n// The text-selection strip: appears when a text selection SETTLES (the menu\n// component gates on `isSelecting()`). One command today; \"Highlight\" et al.\n// are one more id here + one command — no component changes.\nconst selectionStrip: BarSchema = {\n id: 'selection-strip',\n sections: {\n center: [group('selection-actions', { importance: 4 }, ['selection:copy'])],\n },\n};\n\n/**\n * The DEFAULT chrome — exported as a VALUE, which is the whole customization\n * model: consumers pass nothing and track this, transform it, or write their\n * own. It is never merged with anything.\n */\nexport const defaultChrome = defineChrome({\n bars: { main: mainBar },\n modeBars: {\n 'mode:annotate': annotateBar,\n 'mode:shapes': shapesBar,\n 'mode:insert': insertBar,\n 'mode:form': formBar,\n 'mode:redact': redactBar,\n },\n menus: { document: documentMenu, zoom: zoomMenu, 'page-settings': pageSettingsMenu },\n strips: { annotation: annotationStrip, selection: selectionStrip },\n});\n\n// Lookups take the RESOLVED schema (the host may have replaced the default) —\n// the typed literal widens to arbitrary string keys here, once.\n\n/** Menu lookup by id (arbitrary string). */\nexport function getMenu(schema: ChromeSchema, id: string): MenuSchema | undefined {\n return (schema.menus as Record<string, MenuSchema> | undefined)?.[id];\n}\n\n/** Secondary band lookup by mode-surface id. */\nexport function getModeBar(schema: ChromeSchema, id: string): BarSchema | undefined {\n return (schema.modeBars as Record<string, BarSchema> | undefined)?.[id];\n}\n\n/** Contextual strip lookup by context id ('annotation', …). */\nexport function getStrip(schema: ChromeSchema, id: string): BarSchema | undefined {\n return (schema.strips as Record<string, BarSchema> | undefined)?.[id];\n}\n"],"mappings":";;;;;;;;;;;AAmBA,MAAM,SAAA,GAAA,wBAAA,MAAA,CAAc,SAAS,EAAE,YAAY,EAAE,GAAG,EAAA,GAAA,wBAAA,KAAA,CAAM,wBAAwB,CAAC,CAAC;AAChF,MAAM,WAAA,GAAA,wBAAA,MAAA,CAAgB,WAAW,EAAE,YAAY,EAAE,GAAG,CAAC,gBAAgB,cAAc,CAAC;AAGpF,MAAM,UAAqB;CACzB,IAAI;CACJ,UAAU;EAIR,OAAO;IACC,GAAA,wBAAA,MAAA,CAAA,YAAY,EAAE,YAAY,EAAE,GAAG,EAAA,GAAA,wBAAA,KAAA,CAAM,eAAe,CAAC,CAAC;IACtD,GAAA,wBAAA,MAAA,CAAA,aAAa,EAAE,YAAY,EAAE,GAAG,EAAA,GAAA,wBAAA,KAAA,CAC/B,iBAAiB,EAAE,YAAY,EAAE,CAAC,IAAA,GAAA,wBAAA,KAAA,CAClC,eAAe,CACtB,CAAC;IAGK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AoC;CAChF,OAAQ,OAAO,QAAmD;AACpE;;AAGA,SAAgB,WAAW,QAAsB,IAAmC;CAClF,OAAQ,OAAO,WAAqD;AACtE;;AAGA,SAAgB,SAAS,QAAsB,IAAmC;CAChF,OAAQ,OAAO,SAAmD;AACpE"}
|
package/dist/chrome.d.cts
CHANGED
package/dist/chrome.d.ts
CHANGED
package/dist/chrome.js
CHANGED
|
@@ -185,6 +185,10 @@ const annotationStrip = {
|
|
|
185
185
|
"annotation:ungroup"
|
|
186
186
|
]), group("annotation-danger", { importance: 5 }, ["annotation:delete"])] }
|
|
187
187
|
};
|
|
188
|
+
const selectionStrip = {
|
|
189
|
+
id: "selection-strip",
|
|
190
|
+
sections: { center: [group("selection-actions", { importance: 4 }, ["selection:copy"])] }
|
|
191
|
+
};
|
|
188
192
|
/**
|
|
189
193
|
* The DEFAULT chrome — exported as a VALUE, which is the whole customization
|
|
190
194
|
* model: consumers pass nothing and track this, transform it, or write their
|
|
@@ -204,7 +208,10 @@ const defaultChrome = defineChrome({
|
|
|
204
208
|
zoom: zoomMenu,
|
|
205
209
|
"page-settings": pageSettingsMenu
|
|
206
210
|
},
|
|
207
|
-
strips: {
|
|
211
|
+
strips: {
|
|
212
|
+
annotation: annotationStrip,
|
|
213
|
+
selection: selectionStrip
|
|
214
|
+
}
|
|
208
215
|
});
|
|
209
216
|
/** Menu lookup by id (arbitrary string). */
|
|
210
217
|
function getMenu(schema, id) {
|
package/dist/chrome.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chrome.js","names":[],"sources":["../src/config/chrome.ts"],"sourcesContent":["/**\n * The chrome — structure only. No breakpoints, no show/hide lists, no locale\n * overrides, no dividers/spacers, no hand-written overflow menus. What fits is\n * measured and solved at runtime (@embedpdf/core-ui); the overflow menu is\n * derived. Compare to the v2 snippet's 1,950-line ui-schema.ts.\n *\n * `importance` (1 sheds first … 5 pinned) is the only responsive knob.\n */\nimport {\n defineChrome,\n group,\n item,\n custom,\n type BarSchema,\n type ChromeSchema,\n type MenuSchema,\n} from '@embedpdf/react/toolbar';\n\n// Reused across every mode band — plain values, so composition is just a const.\nconst style = group('style', { importance: 4 }, [item('panel:annotation-style')]);\nconst history = group('history', { importance: 3 }, ['history:undo', 'history:redo']);\n\n// ── main toolbar ─────────────────────────────────────────────────────────────\nconst mainBar: BarSchema = {\n id: 'main',\n sections: {\n // v2 layout: everything before the first spacer sits LEFT-aligned —\n // document menu, workspace, zoom strip, pan/pointer. Only the mode tabs\n // are truly centered.\n start: [\n group('document', { importance: 5 }, [item('document:menu')]),\n group('workspace', { importance: 4 }, [\n item('panel:sidebar', { importance: 5 }),\n item('page:settings'),\n ]),\n // The inline zoom strip; when it can't fit it renders its 'button'\n // variant, and in the overflow menu it projects through zoom:menu.\n group('zoom', { importance: 4 }, [\n custom('zoom-controls', { variants: ['inline', 'button'], terminal: 'zoom:menu' }),\n ]),\n group('tools', { importance: 2 }, ['pan:toggle', 'pointer:toggle']),\n ],\n center: [\n group('modes', {\n role: 'tabs',\n // The group ladder: full strip → trailing tabs shed behind a derived\n // in-strip chevron (v2's overflow-tabs-button) → select (v2's\n // mode-select-button) → global overflow. Tab items at importance 1 so\n // the strip is the FIRST thing to compact; the group at 4 so its\n // compact forms survive long.\n shed: true,\n collapse: 'select',\n importance: 4,\n labelKey: 'commands.mode.group',\n items: [\n item('mode:view', { variants: ['label'], importance: 1 }),\n item('mode:annotate', { variants: ['label'], importance: 1 }),\n item('mode:shapes', { variants: ['label'], importance: 1 }),\n item('mode:insert', { variants: ['label'], importance: 1 }),\n item('mode:form', { variants: ['label'], importance: 1 }),\n item('mode:redact', { variants: ['label'], importance: 1 }),\n ],\n }),\n ],\n end: [group('panels', { importance: 5 }, ['panel:search', 'panel:comment'])],\n },\n};\n\n// ── secondary bands (one per mode; which shows is derived from shell) ────────\nconst annotateBar: BarSchema = {\n id: 'annotate',\n sections: {\n center: [\n group('comment', { importance: 4 }, ['annotation:add-note', 'annotation:add-link']),\n group('markup', { importance: 4 }, [\n 'annotation:add-highlight',\n 'annotation:add-strikeout',\n 'annotation:add-underline',\n 'annotation:add-squiggly',\n ]),\n group('draw', { importance: 3 }, ['annotation:add-ink', 'annotation:add-ink-highlight']),\n group('text', { importance: 2 }, [\n 'annotation:add-text',\n 'annotation:add-insert-text',\n 'annotation:add-replace-text',\n 'annotation:add-callout',\n ]),\n style,\n history,\n ],\n },\n};\n\nconst shapesBar: BarSchema = {\n id: 'shapes',\n sections: {\n center: [\n group('shapes', { importance: 4 }, [\n 'annotation:add-rectangle',\n 'annotation:add-circle',\n 'annotation:add-line',\n 'annotation:add-arrow',\n ]),\n group('polygons', { importance: 2 }, ['annotation:add-polygon', 'annotation:add-polyline']),\n style,\n history,\n ],\n },\n};\n\nconst insertBar: BarSchema = {\n id: 'insert',\n sections: {\n center: [\n group('stamps', { importance: 4 }, [\n 'insert:add-stamp',\n 'insert:add-attachment',\n 'insert:add-signature',\n 'insert:add-image',\n ]),\n style,\n history,\n ],\n },\n};\n\nconst formBar: BarSchema = {\n id: 'form',\n sections: {\n center: [\n group('fields', { importance: 4 }, [\n 'form:add-textfield',\n 'form:add-checkbox',\n 'form:add-radio',\n ]),\n group('choice-fields', { importance: 2 }, ['form:add-select', 'form:add-listbox']),\n history,\n ],\n },\n};\n\nconst redactBar: BarSchema = {\n id: 'redact',\n sections: {\n center: [\n group('redact', { importance: 4 }, ['redaction:redact', 'panel:redaction']),\n style,\n history,\n ],\n },\n};\n\n// ── menus (command trees; separators derive between sections) ────────────────\nconst documentMenu: MenuSchema = {\n id: 'document',\n sections: [\n { items: ['document:download', 'document:print'] },\n { items: ['document:fullscreen'] },\n ],\n};\n\nconst zoomMenu: MenuSchema = {\n id: 'zoom',\n sections: [\n {\n labelKey: 'commands.zoom.level',\n items: ['zoom:50', 'zoom:100', 'zoom:150', 'zoom:200', 'zoom:400'],\n },\n { items: ['zoom:in', 'zoom:out'] },\n { items: ['zoom:fit-page', 'zoom:fit-width', 'zoom:automatic'] },\n ],\n};\n\nconst pageSettingsMenu: MenuSchema = {\n id: 'page-settings',\n sections: [\n { labelKey: 'commands.spread.group', items: ['spread:none', 'spread:odd', 'spread:even'] },\n { labelKey: 'commands.scroll.group', items: ['scroll:vertical', 'scroll:horizontal'] },\n { labelKey: 'commands.rotate.group', items: ['rotate:clockwise', 'rotate:counter-clockwise'] },\n { items: ['document:fullscreen'] },\n ],\n};\n\n// ── contextual strips (anchored to selections; same BarSchema vocabulary) ────\n// WHICH commands actually show is each command's `visible` derivation (group\n// only when groupable, style only when the kind declares editable props…), so\n// one strip serves single AND multi selection — v2 needed two schemas for that.\nconst annotationStrip: BarSchema = {\n id: 'annotation-strip',\n sections: {\n center: [\n group('annotation-actions', { importance: 4 }, [\n 'annotation:comment',\n 'annotation:style',\n 'annotation:link',\n 'annotation:goto-link',\n 'annotation:remove-link',\n 'annotation:group',\n 'annotation:ungroup',\n ]),\n // Its own group → a derived separator; delete stands apart.\n group('annotation-danger', { importance: 5 }, ['annotation:delete']),\n ],\n },\n};\n\n/**\n * The DEFAULT chrome — exported as a VALUE, which is the whole customization\n * model: consumers pass nothing and track this, transform it, or write their\n * own. It is never merged with anything.\n */\nexport const defaultChrome = defineChrome({\n bars: { main: mainBar },\n modeBars: {\n 'mode:annotate': annotateBar,\n 'mode:shapes': shapesBar,\n 'mode:insert': insertBar,\n 'mode:form': formBar,\n 'mode:redact': redactBar,\n },\n menus: { document: documentMenu, zoom: zoomMenu, 'page-settings': pageSettingsMenu },\n strips: { annotation: annotationStrip },\n});\n\n// Lookups take the RESOLVED schema (the host may have replaced the default) —\n// the typed literal widens to arbitrary string keys here, once.\n\n/** Menu lookup by id (arbitrary string). */\nexport function getMenu(schema: ChromeSchema, id: string): MenuSchema | undefined {\n return (schema.menus as Record<string, MenuSchema> | undefined)?.[id];\n}\n\n/** Secondary band lookup by mode-surface id. */\nexport function getModeBar(schema: ChromeSchema, id: string): BarSchema | undefined {\n return (schema.modeBars as Record<string, BarSchema> | undefined)?.[id];\n}\n\n/** Contextual strip lookup by context id ('annotation', …). */\nexport function getStrip(schema: ChromeSchema, id: string): BarSchema | undefined {\n return (schema.strips as Record<string, BarSchema> | undefined)?.[id];\n}\n"],"mappings":";;;;;;;;;;AAmBA,MAAM,QAAQ,MAAM,SAAS,EAAE,YAAY,EAAE,GAAG,CAAC,KAAK,wBAAwB,CAAC,CAAC;AAChF,MAAM,UAAU,MAAM,WAAW,EAAE,YAAY,EAAE,GAAG,CAAC,gBAAgB,cAAc,CAAC;AAGpF,MAAM,UAAqB;CACzB,IAAI;CACJ,UAAU;EAIR,OAAO;GACL,MAAM,YAAY,EAAE,YAAY,EAAE,GAAG,CAAC,KAAK,eAAe,CAAC,CAAC;GAC5D,MAAM,aAAa,EAAE,YAAY,EAAE,GAAG,CACpC,KAAK,iBAAiB,EAAE,YAAY,EAAE,CAAC,GACvC,KAAK,eAAe,CACtB,CAAC;GAGD,MAAM,QAAQ,EAAE,YAAY,EAAE,GAAG,CAC/B,OAAO,iBAAiB;IAAE,UAAU,CAAC,UAAU,QAAQ;IAAG,UAAU;GAAY,CAAC,CACnF,CAAC;GACD,MAAM,SAAS,EAAE,YAAY,EAAE,GAAG,CAAC,cAAc,gBAAgB,CAAC;EACpE;EACA,QAAQ,CACN,MAAM,SAAS;GACb,MAAM;GAMN,MAAM;GACN,UAAU;GACV,YAAY;GACZ,UAAU;GACV,OAAO;IACL,KAAK,aAAa;KAAE,UAAU,CAAC,OAAO;KAAG,YAAY;IAAE,CAAC;IACxD,KAAK,iBAAiB;KAAE,UAAU,CAAC,OAAO;KAAG,YAAY;IAAE,CAAC;IAC5D,KAAK,eAAe;KAAE,UAAU,CAAC,OAAO;KAAG,YAAY;IAAE,CAAC;IAC1D,KAAK,eAAe;KAAE,UAAU,CAAC,OAAO;KAAG,YAAY;IAAE,CAAC;IAC1D,KAAK,aAAa;KAAE,UAAU,CAAC,OAAO;KAAG,YAAY;IAAE,CAAC;IACxD,KAAK,eAAe;KAAE,UAAU,CAAC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IAAmC;CAClF,OAAQ,OAAO,WAAqD;AACtE;;AAGA,SAAgB,SAAS,QAAsB,IAAmC;CAChF,OAAQ,OAAO,SAAmD;AACpE"}
|
|
1
|
+
{"version":3,"file":"chrome.js","names":[],"sources":["../src/config/chrome.ts"],"sourcesContent":["/**\n * The chrome — structure only. No breakpoints, no show/hide lists, no locale\n * overrides, no dividers/spacers, no hand-written overflow menus. What fits is\n * measured and solved at runtime (@embedpdf/core-ui); the overflow menu is\n * derived. Compare to the v2 snippet's 1,950-line ui-schema.ts.\n *\n * `importance` (1 sheds first … 5 pinned) is the only responsive knob.\n */\nimport {\n defineChrome,\n group,\n item,\n custom,\n type BarSchema,\n type ChromeSchema,\n type MenuSchema,\n} from '@embedpdf/react/toolbar';\n\n// Reused across every mode band — plain values, so composition is just a const.\nconst style = group('style', { importance: 4 }, [item('panel:annotation-style')]);\nconst history = group('history', { importance: 3 }, ['history:undo', 'history:redo']);\n\n// ── main toolbar ─────────────────────────────────────────────────────────────\nconst mainBar: BarSchema = {\n id: 'main',\n sections: {\n // v2 layout: everything before the first spacer sits LEFT-aligned —\n // document menu, workspace, zoom strip, pan/pointer. Only the mode tabs\n // are truly centered.\n start: [\n group('document', { importance: 5 }, [item('document:menu')]),\n group('workspace', { importance: 4 }, [\n item('panel:sidebar', { importance: 5 }),\n item('page:settings'),\n ]),\n // The inline zoom strip; when it can't fit it renders its 'button'\n // variant, and in the overflow menu it projects through zoom:menu.\n group('zoom', { importance: 4 }, [\n custom('zoom-controls', { variants: ['inline', 'button'], terminal: 'zoom:menu' }),\n ]),\n group('tools', { importance: 2 }, ['pan:toggle', 'pointer:toggle']),\n ],\n center: [\n group('modes', {\n role: 'tabs',\n // The group ladder: full strip → trailing tabs shed behind a derived\n // in-strip chevron (v2's overflow-tabs-button) → select (v2's\n // mode-select-button) → global overflow. Tab items at importance 1 so\n // the strip is the FIRST thing to compact; the group at 4 so its\n // compact forms survive long.\n shed: true,\n collapse: 'select',\n importance: 4,\n labelKey: 'commands.mode.group',\n items: [\n item('mode:view', { variants: ['label'], importance: 1 }),\n item('mode:annotate', { variants: ['label'], importance: 1 }),\n item('mode:shapes', { variants: ['label'], importance: 1 }),\n item('mode:insert', { variants: ['label'], importance: 1 }),\n item('mode:form', { variants: ['label'], importance: 1 }),\n item('mode:redact', { variants: ['label'], importance: 1 }),\n ],\n }),\n ],\n end: [group('panels', { importance: 5 }, ['panel:search', 'panel:comment'])],\n },\n};\n\n// ── secondary bands (one per mode; which shows is derived from shell) ────────\nconst annotateBar: BarSchema = {\n id: 'annotate',\n sections: {\n center: [\n group('comment', { importance: 4 }, ['annotation:add-note', 'annotation:add-link']),\n group('markup', { importance: 4 }, [\n 'annotation:add-highlight',\n 'annotation:add-strikeout',\n 'annotation:add-underline',\n 'annotation:add-squiggly',\n ]),\n group('draw', { importance: 3 }, ['annotation:add-ink', 'annotation:add-ink-highlight']),\n group('text', { importance: 2 }, [\n 'annotation:add-text',\n 'annotation:add-insert-text',\n 'annotation:add-replace-text',\n 'annotation:add-callout',\n ]),\n style,\n history,\n ],\n },\n};\n\nconst shapesBar: BarSchema = {\n id: 'shapes',\n sections: {\n center: [\n group('shapes', { importance: 4 }, [\n 'annotation:add-rectangle',\n 'annotation:add-circle',\n 'annotation:add-line',\n 'annotation:add-arrow',\n ]),\n group('polygons', { importance: 2 }, ['annotation:add-polygon', 'annotation:add-polyline']),\n style,\n history,\n ],\n },\n};\n\nconst insertBar: BarSchema = {\n id: 'insert',\n sections: {\n center: [\n group('stamps', { importance: 4 }, [\n 'insert:add-stamp',\n 'insert:add-attachment',\n 'insert:add-signature',\n 'insert:add-image',\n ]),\n style,\n history,\n ],\n },\n};\n\nconst formBar: BarSchema = {\n id: 'form',\n sections: {\n center: [\n group('fields', { importance: 4 }, [\n 'form:add-textfield',\n 'form:add-checkbox',\n 'form:add-radio',\n ]),\n group('choice-fields', { importance: 2 }, ['form:add-select', 'form:add-listbox']),\n history,\n ],\n },\n};\n\nconst redactBar: BarSchema = {\n id: 'redact',\n sections: {\n center: [\n group('redact', { importance: 4 }, ['redaction:redact', 'panel:redaction']),\n style,\n history,\n ],\n },\n};\n\n// ── menus (command trees; separators derive between sections) ────────────────\nconst documentMenu: MenuSchema = {\n id: 'document',\n sections: [\n { items: ['document:download', 'document:print'] },\n { items: ['document:fullscreen'] },\n ],\n};\n\nconst zoomMenu: MenuSchema = {\n id: 'zoom',\n sections: [\n {\n labelKey: 'commands.zoom.level',\n items: ['zoom:50', 'zoom:100', 'zoom:150', 'zoom:200', 'zoom:400'],\n },\n { items: ['zoom:in', 'zoom:out'] },\n { items: ['zoom:fit-page', 'zoom:fit-width', 'zoom:automatic'] },\n ],\n};\n\nconst pageSettingsMenu: MenuSchema = {\n id: 'page-settings',\n sections: [\n { labelKey: 'commands.spread.group', items: ['spread:none', 'spread:odd', 'spread:even'] },\n { labelKey: 'commands.scroll.group', items: ['scroll:vertical', 'scroll:horizontal'] },\n { labelKey: 'commands.rotate.group', items: ['rotate:clockwise', 'rotate:counter-clockwise'] },\n { items: ['document:fullscreen'] },\n ],\n};\n\n// ── contextual strips (anchored to selections; same BarSchema vocabulary) ────\n// WHICH commands actually show is each command's `visible` derivation (group\n// only when groupable, style only when the kind declares editable props…), so\n// one strip serves single AND multi selection — v2 needed two schemas for that.\nconst annotationStrip: BarSchema = {\n id: 'annotation-strip',\n sections: {\n center: [\n group('annotation-actions', { importance: 4 }, [\n 'annotation:comment',\n 'annotation:style',\n 'annotation:link',\n 'annotation:goto-link',\n 'annotation:remove-link',\n 'annotation:group',\n 'annotation:ungroup',\n ]),\n // Its own group → a derived separator; delete stands apart.\n group('annotation-danger', { importance: 5 }, ['annotation:delete']),\n ],\n },\n};\n\n// The text-selection strip: appears when a text selection SETTLES (the menu\n// component gates on `isSelecting()`). One command today; \"Highlight\" et al.\n// are one more id here + one command — no component changes.\nconst selectionStrip: BarSchema = {\n id: 'selection-strip',\n sections: {\n center: [group('selection-actions', { importance: 4 }, ['selection:copy'])],\n },\n};\n\n/**\n * The DEFAULT chrome — exported as a VALUE, which is the whole customization\n * model: consumers pass nothing and track this, transform it, or write their\n * own. It is never merged with anything.\n */\nexport const defaultChrome = defineChrome({\n bars: { main: mainBar },\n modeBars: {\n 'mode:annotate': annotateBar,\n 'mode:shapes': shapesBar,\n 'mode:insert': insertBar,\n 'mode:form': formBar,\n 'mode:redact': redactBar,\n },\n menus: { document: documentMenu, zoom: zoomMenu, 'page-settings': pageSettingsMenu },\n strips: { annotation: annotationStrip, selection: selectionStrip },\n});\n\n// Lookups take the RESOLVED schema (the host may have replaced the default) —\n// the typed literal widens to arbitrary string keys here, once.\n\n/** Menu lookup by id (arbitrary string). */\nexport function getMenu(schema: ChromeSchema, id: string): MenuSchema | undefined {\n return (schema.menus as Record<string, MenuSchema> | undefined)?.[id];\n}\n\n/** Secondary band lookup by mode-surface id. */\nexport function getModeBar(schema: ChromeSchema, id: string): BarSchema | undefined {\n return (schema.modeBars as Record<string, BarSchema> | undefined)?.[id];\n}\n\n/** Contextual strip lookup by context id ('annotation', …). */\nexport function getStrip(schema: ChromeSchema, id: string): BarSchema | undefined {\n return (schema.strips as Record<string, BarSchema> | undefined)?.[id];\n}\n"],"mappings":";;;;;;;;;;AAmBA,MAAM,QAAQ,MAAM,SAAS,EAAE,YAAY,EAAE,GAAG,CAAC,KAAK,wBAAwB,CAAC,CAAC;AAChF,MAAM,UAAU,MAAM,WAAW,EAAE,YAAY,EAAE,GAAG,CAAC,gBAAgB,cAAc,CAAC;AAGpF,MAAM,UAAqB;CACzB,IAAI;CACJ,UAAU;EAIR,OAAO;GACL,MAAM,YAAY,EAAE,YAAY,EAAE,GAAG,CAAC,KAAK,eAAe,CAAC,CAAC;GAC5D,MAAM,aAAa,EAAE,YAAY,EAAE,GAAG,CACpC,KAAK,iBAAiB,EAAE,YAAY,EAAE,CAAC,GACvC,KAAK,eAAe,CACtB,CAAC;GAGD,MAAM,QAAQ,EAAE,YAAY,EAAE,GAAG,CAC/B,OAAO,iBAAiB;IAAE,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OAAO,CAAC,qBAAqB,EAAE;CACnC;AACF;AAMA,MAAM,kBAA6B;CACjC,IAAI;CACJ,UAAU,EACR,QAAQ,CACN,MAAM,sBAAsB,EAAE,YAAY,EAAE,GAAG;EAC7C;EACA;EACA;EACA;EACA;EACA;EACA;CACF,CAAC,GAED,MAAM,qBAAqB,EAAE,YAAY,EAAE,GAAG,CAAC,mBAAmB,CAAC,CACrE,EACF;AACF;AAKA,MAAM,iBAA4B;CAChC,IAAI;CACJ,UAAU,EACR,QAAQ,CAAC,MAAM,qBAAqB,EAAE,YAAY,EAAE,GAAG,CAAC,gBAAgB,CAAC,CAAC,EAC5E;AACF;;;;;;AAOA,MAAa,gBAAgB,aAAa;CACxC,MAAM,EAAE,MAAM,QAAQ;CACtB,UAAU;EACR,iBAAiB;EACjB,eAAe;EACf,eAAe;EACf,aAAa;EACb,eAAe;CACjB;CACA,OAAO;EAAE,UAAU;EAAc,MAAM;EAAU,iBAAiB;CAAiB;CACnF,QAAQ;EAAE,YAAY;EAAiB,WAAW;CAAe;AACnE,CAAC;;AAMD,SAAgB,QAAQ,QAAsB,IAAoC;CAChF,OAAQ,OAAO,QAAmD;AACpE;;AAGA,SAAgB,WAAW,QAAsB,IAAmC;CAClF,OAAQ,OAAO,WAAqD;AACtE;;AAGA,SAAgB,SAAS,QAAsB,IAAmC;CAChF,OAAQ,OAAO,SAAmD;AACpE"}
|
package/dist/commands.cjs
CHANGED
|
@@ -2,14 +2,20 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
|
2
2
|
let _embedpdf_react_runtime = require("@embedpdf/react/runtime");
|
|
3
3
|
let _embedpdf_react_stage = require("@embedpdf/react/stage");
|
|
4
4
|
let _embedpdf_react_interaction = require("@embedpdf/react/interaction");
|
|
5
|
+
let _embedpdf_react_selection = require("@embedpdf/react/selection");
|
|
5
6
|
let _embedpdf_react_annotation = require("@embedpdf/react/annotation");
|
|
7
|
+
let _embedpdf_react_redaction = require("@embedpdf/react/redaction");
|
|
8
|
+
let _embedpdf_react_actions = require("@embedpdf/react/actions");
|
|
6
9
|
let _embedpdf_react_form = require("@embedpdf/react/form");
|
|
7
10
|
let _embedpdf_react_link = require("@embedpdf/react/link");
|
|
11
|
+
let _embedpdf_react_search = require("@embedpdf/react/search");
|
|
8
12
|
let _embedpdf_react_shell = require("@embedpdf/react/shell");
|
|
9
13
|
//#region src/config/commands.ts
|
|
10
14
|
const stage = (c) => c.tryGet(_embedpdf_react_stage.StageToken);
|
|
11
15
|
const interaction = (c) => c.tryGet(_embedpdf_react_interaction.InteractionToken);
|
|
12
16
|
const anno = (c) => c.tryGet(_embedpdf_react_annotation.AnnotationToken);
|
|
17
|
+
const textSelection = (c) => c.tryGet(_embedpdf_react_selection.SelectionToken);
|
|
18
|
+
const sameTextRange = (a, b) => a === b || !!a && !!b && a.start.pon === b.start.pon && a.start.index === b.start.index && a.end.pon === b.end.pon && a.end.index === b.end.index;
|
|
13
19
|
const hasAnnotationSelection = (c) => (anno(c)?.selection().length ?? 0) > 0;
|
|
14
20
|
/** v2 gated strip items per subtype (comment hidden on links/widgets) — here
|
|
15
21
|
* it's one derivation over the selected DTOs instead of per-command lookups. */
|
|
@@ -49,6 +55,7 @@ const tool = (id, toolId, labelKey, icon, accent) => {
|
|
|
49
55
|
icon,
|
|
50
56
|
...accent ? { accent } : {}
|
|
51
57
|
};
|
|
58
|
+
const authority = id.startsWith("annotation:add") || id.startsWith("insert:add") ? (c) => anno(c)?.canCreate() ?? true : id.startsWith("form:add") ? (c) => c.tryGet(_embedpdf_react_form.FormToken)?.canDesign() ?? true : id === "redaction:redact" ? (c) => c.tryGet(_embedpdf_react_redaction.RedactionToken)?.canMark() ?? true : null;
|
|
52
59
|
return {
|
|
53
60
|
id,
|
|
54
61
|
labelKey,
|
|
@@ -56,7 +63,7 @@ const tool = (id, toolId, labelKey, icon, accent) => {
|
|
|
56
63
|
categories: ["tool"],
|
|
57
64
|
run: (c) => interaction(c)?.activateTool(toolId),
|
|
58
65
|
active: (c) => interaction(c)?.activeToolId() === toolId,
|
|
59
|
-
enabled: (c) => interaction(c) != null,
|
|
66
|
+
enabled: (c) => interaction(c) != null && (authority?.(c) ?? true),
|
|
60
67
|
iconAccent: (c) => toolAccent(c, toolId, accent)
|
|
61
68
|
};
|
|
62
69
|
};
|
|
@@ -168,6 +175,7 @@ const defaultCommands = [
|
|
|
168
175
|
id: "panel:search",
|
|
169
176
|
labelKey: "commands.search",
|
|
170
177
|
icon: "search",
|
|
178
|
+
visible: (c) => c.tryGet(_embedpdf_react_search.SearchToken)?.canSearch() ?? true,
|
|
171
179
|
categories: ["panel"],
|
|
172
180
|
panel: {
|
|
173
181
|
id: "search",
|
|
@@ -178,6 +186,7 @@ const defaultCommands = [
|
|
|
178
186
|
id: "panel:comment",
|
|
179
187
|
labelKey: "commands.comment",
|
|
180
188
|
icon: "comment",
|
|
189
|
+
visible: (c) => anno(c)?.canRead() ?? true,
|
|
181
190
|
categories: ["panel"],
|
|
182
191
|
panel: {
|
|
183
192
|
id: "comment",
|
|
@@ -215,7 +224,11 @@ const defaultCommands = [
|
|
|
215
224
|
categories: ["document"],
|
|
216
225
|
run: (c) => {
|
|
217
226
|
const id = c.documentId ?? void 0;
|
|
218
|
-
c.tryGet(_embedpdf_react_runtime.DocumentsToken)
|
|
227
|
+
const documents = c.tryGet(_embedpdf_react_runtime.DocumentsToken);
|
|
228
|
+
if (!documents) return;
|
|
229
|
+
const pull = () => documents.download(id);
|
|
230
|
+
const actions = c.tryGet(_embedpdf_react_actions.ActionsToken);
|
|
231
|
+
(actions ? actions.runDocumentVerb("save", pull) : pull()).then((bytes) => {
|
|
219
232
|
const blob = new Blob([bytes], { type: "application/pdf" });
|
|
220
233
|
const url = URL.createObjectURL(blob);
|
|
221
234
|
const a = document.createElement("a");
|
|
@@ -225,7 +238,7 @@ const defaultCommands = [
|
|
|
225
238
|
URL.revokeObjectURL(url);
|
|
226
239
|
}).catch((e) => console.warn("[snippet-react] download failed", e));
|
|
227
240
|
},
|
|
228
|
-
enabled: (c) => c.
|
|
241
|
+
enabled: (c) => c.documentId != null && (c.tryGet(_embedpdf_react_runtime.DocumentsToken)?.allows("doc.download") ?? false)
|
|
229
242
|
},
|
|
230
243
|
{
|
|
231
244
|
id: "document:print",
|
|
@@ -233,7 +246,12 @@ const defaultCommands = [
|
|
|
233
246
|
icon: "print",
|
|
234
247
|
shortcut: "Mod+p",
|
|
235
248
|
categories: ["document"],
|
|
236
|
-
run: () =>
|
|
249
|
+
run: (c) => {
|
|
250
|
+
const actions = c.documentId != null ? c.tryGet(_embedpdf_react_actions.ActionsToken) : null;
|
|
251
|
+
if (actions) actions.runDocumentVerb("print", () => window.print());
|
|
252
|
+
else window.print();
|
|
253
|
+
},
|
|
254
|
+
enabled: (c) => c.documentId == null || (c.tryGet(_embedpdf_react_runtime.DocumentsToken)?.allows("doc.print") ?? true)
|
|
237
255
|
},
|
|
238
256
|
{
|
|
239
257
|
id: "document:fullscreen",
|
|
@@ -346,6 +364,10 @@ const defaultCommands = [
|
|
|
346
364
|
id: "panel:redaction",
|
|
347
365
|
labelKey: "commands.redact.panel",
|
|
348
366
|
icon: "redactionSidebar",
|
|
367
|
+
visible: (c) => {
|
|
368
|
+
const r = c.tryGet(_embedpdf_react_redaction.RedactionToken);
|
|
369
|
+
return r ? r.canMark() || r.canApply() : true;
|
|
370
|
+
},
|
|
349
371
|
categories: ["panel"],
|
|
350
372
|
panel: {
|
|
351
373
|
id: "redaction",
|
|
@@ -422,15 +444,31 @@ const defaultCommands = [
|
|
|
422
444
|
run: (c) => void anno(c)?.ungroup(),
|
|
423
445
|
visible: (c) => anno(c)?.canUngroup() ?? false
|
|
424
446
|
},
|
|
447
|
+
{
|
|
448
|
+
id: "selection:copy",
|
|
449
|
+
labelKey: "commands.selection.copy",
|
|
450
|
+
icon: "copy",
|
|
451
|
+
categories: ["selection"],
|
|
452
|
+
visible: (c) => {
|
|
453
|
+
const s = textSelection(c);
|
|
454
|
+
return !!s && s.hasSelection() && s.canCopy();
|
|
455
|
+
},
|
|
456
|
+
run: (c) => {
|
|
457
|
+
const s = textSelection(c);
|
|
458
|
+
if (!s) return;
|
|
459
|
+
const copiedRange = s.snapshot().range;
|
|
460
|
+
(0, _embedpdf_react_selection.copySelection)(s).then((text) => {
|
|
461
|
+
if (text !== "" && sameTextRange(s.snapshot().range, copiedRange)) s.clear();
|
|
462
|
+
}, () => {});
|
|
463
|
+
}
|
|
464
|
+
},
|
|
425
465
|
{
|
|
426
466
|
id: "annotation:link",
|
|
427
467
|
labelKey: "commands.annotate.link",
|
|
428
468
|
icon: "link",
|
|
429
469
|
categories: ["annotation"],
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
exclusive: "right"
|
|
433
|
-
},
|
|
470
|
+
run: (c) => c.tryGet(_embedpdf_react_shell.ShellToken)?.toggle("link-editor"),
|
|
471
|
+
active: (c) => c.tryGet(_embedpdf_react_shell.ShellToken)?.isOpen("link-editor") ?? false,
|
|
434
472
|
visible: (c) => selectionLink(c) === null
|
|
435
473
|
},
|
|
436
474
|
{
|
|
@@ -440,7 +478,8 @@ const defaultCommands = [
|
|
|
440
478
|
categories: ["annotation"],
|
|
441
479
|
run: (c) => {
|
|
442
480
|
const target = selectionLink(c);
|
|
443
|
-
|
|
481
|
+
const link = c.tryGet(_embedpdf_react_link.LinkToken);
|
|
482
|
+
if (target && link) (0, _embedpdf_react_link.openLinkTarget)(link, target);
|
|
444
483
|
},
|
|
445
484
|
visible: (c) => selectionLink(c) != null
|
|
446
485
|
},
|
package/dist/commands.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"commands.cjs","names":["StageToken","InteractionToken","AnnotationToken","ZoomMode","DocumentsToken","ShellToken","FormToken","LinkToken"],"sources":["../src/config/commands.ts"],"sourcesContent":["/**\n * The command vocabulary — the semantic layer. Ported in spirit from the v2\n * snippet's commands.ts, but every command is a pure value: label key, icon,\n * shortcut, derivations, and a `run` (or a declarative surface target). The\n * v2 `registry.getPlugin<T>(id)?.provides()` string-and-cast dance becomes a\n * typed `ctx.get(Token)`.\n *\n * Wiring reality (chrome-parity scope):\n * zoom/pan/pointer/spread/scroll/rotate → real Stage / Interaction / PageEdit\n * modes → shell exclusive surfaces ('mode')\n * panels / menus / modals → declarative shell targets\n * annotate + shape tools → real interaction tools\n * form tools → real form plugin palette (draw-to-place)\n * insert/redact tools → inert interaction tools (demo-tools)\n * history undo/redo → disabled (no history plugin in v3 yet)\n */\nimport type { CommandDef, IconAccent } from '@embedpdf/react/commands';\nimport { DocumentsToken } from '@embedpdf/react/runtime';\nimport { StageToken, ZoomMode } from '@embedpdf/react/stage';\nimport type { SpreadMode } from '@embedpdf/react/stage';\nimport { InteractionToken } from '@embedpdf/react/interaction';\nimport { ShellToken } from '@embedpdf/react/shell';\nimport { AnnotationToken } from '@embedpdf/react/annotation';\nimport { fieldKeyOf, FormToken } from '@embedpdf/react/form';\nimport { LinkToken, type PdfLinkTarget } from '@embedpdf/react/link';\n\n// ── helpers ────────────────────────────────────────────────────────────────\ntype Ctx = Parameters<NonNullable<CommandDef['run']>>[0];\n\nconst stage = (c: Ctx) => c.tryGet(StageToken);\nconst interaction = (c: Ctx) => c.tryGet(InteractionToken);\nconst anno = (c: Ctx) => c.tryGet(AnnotationToken);\n\n// ── annotation-selection predicates (drive the floating strip's contents) ────\nconst hasAnnotationSelection = (c: Ctx) => (anno(c)?.selection().length ?? 0) > 0;\n/** v2 gated strip items per subtype (comment hidden on links/widgets) — here\n * it's one derivation over the selected DTOs instead of per-command lookups. */\nconst selectionSubtypes = (c: Ctx) => new Set((anno(c)?.getSelected() ?? []).map((a) => a.subtype));\n/**\n * The selection's `link` value: a target, `null` (linkable but none set), or\n * `undefined` when the selection cannot carry a link at all (widgets, mixed\n * link states) — the schema decides, never a subtype blocklist.\n */\nconst selectionLink = (c: Ctx): PdfLinkTarget | null | undefined => {\n const p = anno(c)?.getSelectionProps();\n if (!p || !p.specs.some((s) => s.key === 'link') || p.mixed.includes('link')) return undefined;\n return (p.values.link ?? null) as PdfLinkTarget | null;\n};\n\n// ── tool icon accents: THIS viewer's design decision ─────────────────────────\n// A tool declares which drawing default each colored part of its glyph previews.\n// This is intentionally explicit at the command definition: property-panel order\n// does not determine icon meaning, and another viewer may make a different choice.\ntype ColorKey = 'color' | 'interiorColor' | 'fontColor';\nexport interface ToolAccentDefinition {\n primary: ColorKey;\n secondary?: ColorKey;\n}\n\n/**\n * toolId → the SAME icon + accent definition its toolbar button uses, recorded\n * as a side effect of the `tool()` command definitions below — ONE source of\n * truth, so the tool cursor (ui/tool-cursor.tsx) and the button can never\n * drift apart.\n */\nexport const TOOL_ICONS: Record<string, { icon: string; accent?: ToolAccentDefinition }> = {};\n\nconst toolAccent = (\n c: Ctx,\n toolId: string,\n accent: ToolAccentDefinition | undefined,\n): IconAccent | null => {\n if (!accent) return null;\n const anno = c.tryGet(AnnotationToken);\n if (!anno) return null;\n const d = anno.currentDefaults(toolId);\n return {\n primary: d[accent.primary] ?? undefined,\n secondary: accent.secondary ? (d[accent.secondary] ?? undefined) : undefined,\n };\n};\n\n/** A tool command: activates a real interaction tool; active = it's the tool.\n * The icon previews the tool's current defaults — keyed by the SAME toolId\n * as run/active, so the accent can't drift to another tool's colors. */\nconst tool = (\n id: string,\n toolId: string,\n labelKey: string,\n icon: string,\n accent?: ToolAccentDefinition,\n): CommandDef => {\n TOOL_ICONS[toolId] = { icon, ...(accent ? { accent } : {}) };\n return {\n id,\n labelKey,\n icon,\n categories: ['tool'],\n run: (c) => interaction(c)?.activateTool(toolId),\n active: (c) => interaction(c)?.activeToolId() === toolId,\n enabled: (c) => interaction(c) != null,\n iconAccent: (c) => toolAccent(c, toolId, accent),\n };\n};\n\n/** A fixed zoom level (fraction), e.g. 1 = 100%. */\nconst zoomLevel = (id: string, level: number, label: string): CommandDef => ({\n id,\n labelKey: label,\n categories: ['zoom', 'zoom-level'],\n run: (c) => stage(c)?.zoomTo({ level }),\n enabled: (c) => stage(c) != null,\n});\n\nconst spread = (id: string, mode: SpreadMode, labelKey: string, icon: string): CommandDef => ({\n id,\n labelKey,\n icon,\n categories: ['page', 'spread'],\n run: (c) => stage(c)?.setSpread(mode),\n active: (c) => stage(c)?.spread() === mode,\n enabled: (c) => stage(c) != null,\n});\n\nexport const defaultCommands: CommandDef[] = [\n // ── zoom ───────────────────────────────────────────────────────────────\n {\n id: 'zoom:in',\n labelKey: 'commands.zoom.in',\n icon: 'zoomIn',\n shortcut: ['Mod+=', 'Mod+NumpadAdd'],\n categories: ['zoom'],\n run: (c) => stage(c)?.zoomIn(),\n enabled: (c) => stage(c) != null,\n },\n {\n id: 'zoom:out',\n labelKey: 'commands.zoom.out',\n icon: 'zoomOut',\n shortcut: ['Mod+-', 'Mod+NumpadSubtract'],\n categories: ['zoom'],\n run: (c) => stage(c)?.zoomOut(),\n enabled: (c) => stage(c) != null,\n },\n {\n id: 'zoom:fit-page',\n labelKey: 'commands.zoom.fitPage',\n icon: 'fitToPage',\n shortcut: 'Mod+0',\n categories: ['zoom'],\n run: (c) => stage(c)?.fitPage(),\n active: (c) => stage(c)?.zoomMode() === ZoomMode.FitPage,\n enabled: (c) => stage(c) != null,\n },\n {\n id: 'zoom:fit-width',\n labelKey: 'commands.zoom.fitWidth',\n icon: 'fitToWidth',\n shortcut: 'Mod+1',\n categories: ['zoom'],\n run: (c) => stage(c)?.fitWidth(),\n active: (c) => stage(c)?.zoomMode() === ZoomMode.FitWidth,\n enabled: (c) => stage(c) != null,\n },\n {\n id: 'zoom:automatic',\n labelKey: 'commands.zoom.automatic',\n categories: ['zoom'],\n run: (c) => stage(c)?.automatic(),\n active: (c) => stage(c)?.zoomMode() === ZoomMode.Automatic,\n enabled: (c) => stage(c) != null,\n },\n zoomLevel('zoom:50', 0.5, 'commands.zoom.p50'),\n zoomLevel('zoom:100', 1, 'commands.zoom.p100'),\n zoomLevel('zoom:150', 1.5, 'commands.zoom.p150'),\n zoomLevel('zoom:200', 2, 'commands.zoom.p200'),\n zoomLevel('zoom:400', 4, 'commands.zoom.p400'),\n {\n id: 'zoom:menu',\n labelKey: 'commands.zoom.menu',\n icon: 'zoomIn',\n categories: ['zoom'],\n menu: 'zoom',\n },\n\n // ── tools ──────────────────────────────────────────────────────────────\n {\n id: 'pan:toggle',\n labelKey: 'commands.pan',\n icon: 'hand',\n categories: ['tools'],\n run: (c) => interaction(c)?.activateTool('pan'),\n active: (c) => interaction(c)?.activeToolId() === 'pan',\n enabled: (c) => interaction(c) != null,\n },\n {\n id: 'pointer:toggle',\n labelKey: 'commands.pointer',\n icon: 'pointer',\n categories: ['tools'],\n run: (c) => interaction(c)?.activateTool('pointer'),\n active: (c) => interaction(c)?.activeToolId() === 'pointer',\n enabled: (c) => interaction(c) != null,\n },\n\n // ── panels (declarative shell targets) ──────────────────────────────────\n {\n id: 'panel:sidebar',\n labelKey: 'commands.sidebar',\n icon: 'sidebar',\n categories: ['panel'],\n panel: { id: 'sidebar', exclusive: 'left' },\n },\n {\n id: 'panel:search',\n labelKey: 'commands.search',\n icon: 'search',\n categories: ['panel'],\n panel: { id: 'search', exclusive: 'right' },\n },\n {\n id: 'panel:comment',\n labelKey: 'commands.comment',\n icon: 'comment',\n categories: ['panel'],\n panel: { id: 'comment', exclusive: 'right' },\n },\n {\n id: 'panel:annotation-style',\n labelKey: 'commands.style',\n icon: 'palette',\n categories: ['panel'],\n panel: { id: 'annotation-style', exclusive: 'right' },\n },\n\n // ── menus (declarative) ─────────────────────────────────────────────────\n {\n id: 'document:menu',\n labelKey: 'commands.menu',\n icon: 'menu',\n categories: ['document'],\n menu: 'document',\n },\n {\n id: 'page:settings',\n labelKey: 'commands.viewControls',\n icon: 'viewSettings',\n categories: ['page'],\n menu: 'page-settings',\n },\n\n // ── document actions ────────────────────────────────────────────────────\n {\n id: 'document:download',\n labelKey: 'commands.download',\n icon: 'download',\n categories: ['document'],\n run: (c) => {\n const id = c.documentId ?? undefined;\n c.tryGet(DocumentsToken)\n ?.download(id)\n .then((bytes) => {\n const blob = new Blob([bytes as BlobPart], { type: 'application/pdf' });\n const url = URL.createObjectURL(blob);\n const a = document.createElement('a');\n a.href = url;\n a.download = 'document.pdf';\n a.click();\n URL.revokeObjectURL(url);\n })\n .catch((e) => console.warn('[snippet-react] download failed', e));\n },\n enabled: (c) => c.tryGet(DocumentsToken) != null && c.documentId != null,\n },\n {\n id: 'document:print',\n labelKey: 'commands.print',\n icon: 'print',\n shortcut: 'Mod+p',\n categories: ['document'],\n run: () => window.print(),\n },\n {\n id: 'document:fullscreen',\n labelKey: 'commands.fullscreen',\n icon: 'externalLink',\n categories: ['document'],\n run: () => {\n if (document.fullscreenElement) document.exitFullscreen();\n else document.documentElement.requestFullscreen().catch(() => {});\n },\n active: () => Boolean(document.fullscreenElement),\n },\n\n // ── page settings (spread / scroll / rotate) ────────────────────────────\n spread('spread:none', 'none', 'commands.spread.none', 'singlePage'),\n spread('spread:odd', 'odd', 'commands.spread.odd', 'doublePage'),\n spread('spread:even', 'even', 'commands.spread.even', 'book2'),\n {\n id: 'scroll:vertical',\n labelKey: 'commands.scroll.vertical',\n icon: 'vertical',\n categories: ['page', 'scroll'],\n run: (c) => stage(c)?.setLayout('vertical'),\n active: (c) => stage(c)?.layout() === 'vertical',\n enabled: (c) => stage(c) != null,\n },\n {\n id: 'scroll:horizontal',\n labelKey: 'commands.scroll.horizontal',\n icon: 'horizontal',\n categories: ['page', 'scroll'],\n run: (c) => stage(c)?.setLayout('horizontal'),\n active: (c) => stage(c)?.layout() === 'horizontal',\n enabled: (c) => stage(c) != null,\n },\n // VIEW rotation (Adobe's \"Rotate View\"): rotates how every page displays in\n // the main stage lens — non-persistent, nothing written to the PDF. The\n // PERMANENT per-page rotation (PageEditToken.rotateBy) belongs in a\n // page-organize surface, not behind the view-settings buttons.\n {\n id: 'rotate:clockwise',\n labelKey: 'commands.rotate.clockwise',\n icon: 'rotateClockwise',\n categories: ['page', 'rotate'],\n run: (c) => stage(c)?.rotateView(90),\n enabled: (c) => stage(c) != null,\n },\n {\n id: 'rotate:counter-clockwise',\n labelKey: 'commands.rotate.counterclockwise',\n icon: 'rotateCounterClockwise',\n categories: ['page', 'rotate'],\n run: (c) => stage(c)?.rotateView(-90),\n enabled: (c) => stage(c) != null,\n },\n\n // ── modes (shell exclusive surfaces, tag 'mode') ────────────────────────\n {\n id: 'mode:view',\n labelKey: 'commands.mode.view',\n categories: ['mode'],\n // View = no mode band. Close any open mode surface and drop to pointer.\n run: (c) => {\n const shell = c.tryGet(ShellToken);\n for (const m of MODE_SURFACES) shell?.close(m);\n interaction(c)?.activateTool('pointer');\n },\n active: (c) => {\n const shell = c.tryGet(ShellToken);\n return shell ? MODE_SURFACES.every((m) => !shell.isOpen(m)) : true;\n },\n },\n modeCommand('mode:annotate', 'commands.mode.annotate'),\n modeCommand('mode:shapes', 'commands.mode.shapes'),\n modeCommand('mode:insert', 'commands.mode.insert'),\n modeCommand('mode:form', 'commands.mode.form', 'form-edit'),\n modeCommand('mode:redact', 'commands.mode.redact'),\n\n // ── annotate tools (real interaction tools) ─────────────────────────────\n tool('annotation:add-highlight', 'highlight', 'commands.annotate.highlight', 'highlight', {\n primary: 'color',\n }),\n tool('annotation:add-strikeout', 'strikeout', 'commands.annotate.strikeout', 'strikethrough', {\n primary: 'color',\n }),\n tool('annotation:add-underline', 'underline', 'commands.annotate.underline', 'underline', {\n primary: 'color',\n }),\n tool('annotation:add-squiggly', 'squiggly', 'commands.annotate.squiggly', 'squiggly', {\n primary: 'color',\n }),\n tool('annotation:add-ink', 'ink', 'commands.annotate.ink', 'pencilMarker', {\n primary: 'color',\n }),\n tool(\n 'annotation:add-ink-highlight',\n 'ink-highlight',\n 'commands.annotate.inkHighlight',\n 'inkHighlighter',\n { primary: 'color' },\n ),\n tool('annotation:add-text', 'free-text', 'commands.annotate.text', 'freeText', {\n primary: 'fontColor',\n }),\n tool('annotation:add-insert-text', 'insert-text', 'commands.annotate.insertText', 'insertText', {\n primary: 'color',\n }),\n tool(\n 'annotation:add-replace-text',\n 'replace-text',\n 'commands.annotate.replaceText',\n 'replaceText',\n { primary: 'color' },\n ),\n tool('annotation:add-callout', 'free-text-callout', 'commands.annotate.callout', 'callout', {\n primary: 'color',\n secondary: 'interiorColor',\n }),\n // Sticky note (\"comment\") — click-to-place; the icon renders from the\n // engine-baked /AP in the tool's current color.\n tool('annotation:add-note', 'note', 'commands.annotate.note', 'message'),\n // Link — drag an invisible hit rectangle, then set the target in the style\n // panel's Link control (create-then-edit). While active, existing links\n // become editable rects instead of navigating.\n tool('annotation:add-link', 'link', 'commands.annotate.link', 'link'),\n\n // ── shape tools (real interaction tools) ────────────────────────────────\n tool('annotation:add-rectangle', 'square', 'commands.shapes.rectangle', 'square', {\n primary: 'color',\n secondary: 'interiorColor',\n }),\n tool('annotation:add-circle', 'circle', 'commands.shapes.circle', 'circle', {\n primary: 'color',\n secondary: 'interiorColor',\n }),\n tool('annotation:add-line', 'line', 'commands.shapes.line', 'line', { primary: 'color' }),\n // The arrow tool is a `line` preset (a line with an arrowhead) — registered by\n // the annotationPlugin `tools` config in App.tsx, activated like any other tool.\n tool('annotation:add-arrow', 'arrow', 'commands.shapes.arrow', 'lineArrow', {\n primary: 'color',\n }),\n tool('annotation:add-polygon', 'polygon', 'commands.shapes.polygon', 'polygon', {\n primary: 'color',\n secondary: 'interiorColor',\n }),\n tool('annotation:add-polyline', 'polyline', 'commands.shapes.polyline', 'zigzag', {\n primary: 'color',\n }),\n\n // ── insert tools (stamp/attachment real; signature/image inert) ─────────\n tool('insert:add-stamp', 'stamp', 'commands.insert.stamp', 'rubberStamp'),\n // File attachment — click the spot, pick the file (the attachment provider).\n tool('insert:add-attachment', 'attachment', 'commands.insert.attachment', 'paperclip'),\n tool('insert:add-signature', 'signature', 'commands.insert.signature', 'signature'),\n tool('insert:add-image', 'image', 'commands.insert.image', 'photo'),\n\n // ── form tools (the form plugin's draw-to-place palette) ────────────────\n tool('form:add-textfield', 'form-text', 'commands.form.textfield', 'formTextfield'),\n tool('form:add-checkbox', 'form-checkbox', 'commands.form.checkbox', 'formCheckbox'),\n tool('form:add-radio', 'form-radio', 'commands.form.radio', 'formRadio'),\n tool('form:add-select', 'form-combobox', 'commands.form.select', 'formSelect'),\n tool('form:add-listbox', 'form-listbox', 'commands.form.listbox', 'formListbox'),\n\n // ── redaction (v2 parity: the toolbar arms the tool; the panel owns the\n // destructive verbs — Apply All / Clear live in the redaction sidebar) ────\n tool('redaction:redact', 'redact', 'commands.redact.mark', 'redactArea'),\n {\n id: 'panel:redaction',\n labelKey: 'commands.redact.panel',\n icon: 'redactionSidebar',\n categories: ['panel'],\n panel: { id: 'redaction', exclusive: 'right' },\n },\n\n // ── annotation selection (the floating strip's verbs) ──────────────────\n {\n id: 'annotation:delete',\n labelKey: 'commands.annotate.delete',\n icon: 'trash',\n categories: ['annotation'],\n run: (c) => {\n const a = anno(c);\n if (!a) return;\n const form = c.tryGet(FormToken);\n const dtos = a.getSelected();\n const widgets = form ? dtos.filter((d) => d.subtype === 'widget') : [];\n if (widgets.length === 0) {\n a.deleteSelection();\n return;\n }\n // Widgets are FIELD-plane citizens: deleting one goes through doc.forms\n // (the field and every widget of it cascade), never the raw annotation —\n // otherwise the /AcroForm entry would be orphaned.\n const keys = new Set<string>();\n for (const w of widgets) {\n const objnum = w.ref.kind === 'objectNumber' ? w.ref.annotObjectNumber : 0;\n const field = objnum > 0 ? form!.fieldForWidget(objnum) : null;\n if (field) keys.add(fieldKeyOf(field));\n }\n for (const key of keys) void form!.deleteField(key);\n for (const d of dtos) if (d.subtype !== 'widget') void a.delete(d.ref);\n a.deselect();\n },\n visible: hasAnnotationSelection,\n // Mirrors the engine's own authorization: locked/unauthorized annotations\n // keep the button visible but disabled (the engine still enforces).\n enabled: (c) => {\n const a = anno(c);\n const refs = a?.getSelection() ?? [];\n return refs.length > 0 && refs.every((r) => a!.canDelete(r));\n },\n },\n {\n id: 'annotation:comment',\n labelKey: 'commands.comment',\n icon: 'comment',\n categories: ['annotation'],\n // Same 'comment' surface panel:comment toggles — `active` derives from it.\n panel: { id: 'comment', exclusive: 'right' },\n visible: (c) => hasAnnotationSelection(c) && !selectionSubtypes(c).has('widget'),\n },\n {\n id: 'annotation:style',\n labelKey: 'commands.style',\n icon: 'palette',\n categories: ['annotation'],\n panel: { id: 'annotation-style', exclusive: 'right' },\n // The kind table decides: no declared editable props → no style button\n // (v2 hardcoded a subtype blocklist for this).\n visible: (c) => (anno(c)?.getSelectionProps().specs.length ?? 0) > 0,\n },\n {\n id: 'annotation:group',\n labelKey: 'commands.annotate.group',\n icon: 'group',\n categories: ['annotation'],\n run: (c) => void anno(c)?.group(),\n visible: (c) => anno(c)?.canGroup() ?? false,\n },\n {\n id: 'annotation:ungroup',\n labelKey: 'commands.annotate.ungroup',\n icon: 'ungroup',\n categories: ['annotation'],\n run: (c) => void anno(c)?.ungroup(),\n visible: (c) => anno(c)?.canUngroup() ?? false,\n },\n\n // ── link strip items (v2's \"Link / Go to link / Remove link\") ───────────\n {\n // Make the selection a link: opens the style panel, whose Link control\n // sets the target (create-then-edit — the plugin materializes the\n // attached child annotations).\n id: 'annotation:link',\n labelKey: 'commands.annotate.link',\n icon: 'link',\n categories: ['annotation'],\n panel: { id: 'annotation-style', exclusive: 'right' },\n visible: (c) => selectionLink(c) === null,\n },\n {\n id: 'annotation:goto-link',\n labelKey: 'commands.annotate.gotoLink',\n icon: 'externalLink',\n categories: ['annotation'],\n run: (c) => {\n const target = selectionLink(c);\n if (target) c.tryGet(LinkToken)?.activate(target);\n },\n visible: (c) => selectionLink(c) != null,\n },\n {\n id: 'annotation:remove-link',\n labelKey: 'commands.annotate.removeLink',\n icon: 'linkOff',\n categories: ['annotation'],\n run: (c) => anno(c)?.updateSelection({ link: null }),\n visible: (c) => selectionLink(c) != null,\n },\n\n // ── history (no plugin yet → disabled, shows the disabled styling) ──────\n {\n id: 'history:undo',\n labelKey: 'commands.undo',\n icon: 'arrowBackUp',\n categories: ['history'],\n run: () => {},\n enabled: () => false,\n },\n {\n id: 'history:redo',\n labelKey: 'commands.redo',\n icon: 'arrowForwardUp',\n categories: ['history'],\n run: () => {},\n enabled: () => false,\n },\n];\n\n// ── mode helpers ─────────────────────────────────────────────────────────────\n// Modes are exclusive shell surfaces tagged 'mode'; the secondary band renders\n// whichever one is open. Kept below the array to keep the list readable.\nexport const MODE_SURFACES = [\n 'mode:annotate',\n 'mode:shapes',\n 'mode:insert',\n 'mode:form',\n 'mode:redact',\n] as const;\n\nfunction modeCommand(\n id: (typeof MODE_SURFACES)[number],\n labelKey: string,\n toolId: string = 'pointer',\n): CommandDef {\n return {\n id,\n labelKey,\n categories: ['mode'],\n // A mode tab is a shell surface AND a tool policy: the Form tab flips the\n // pointer into form design ('form-edit' — widgets select/move/resize like\n // annotations); every other tab (and closing one) drops back to the\n // default pointer, where widgets are fill controls again.\n run: (c) => {\n const shell = c.tryGet(ShellToken);\n shell?.toggle(id, { exclusive: 'mode' });\n interaction(c)?.activateTool(shell?.isOpen(id) ? toolId : 'pointer');\n },\n active: (c) => c.tryGet(ShellToken)?.isOpen(id) ?? false,\n };\n}\n"],"mappings":";;;;;;;;;AA6BA,MAAM,SAAS,MAAW,EAAE,OAAOA,sBAAAA,UAAU;AAC7C,MAAM,eAAe,MAAW,EAAE,OAAOC,4BAAAA,gBAAgB;AACzD,MAAM,QAAQ,MAAW,EAAE,OAAOC,2BAAAA,eAAe;AAGjD,MAAM,0BAA0B,OAAY,KAAK,CAAC,CAAC,EAAE,UAAU,CAAC,CAAC,UAAU,KAAK;;;AAGhF,MAAM,qBAAqB,MAAW,IAAI,KAAK,KAAK,CAAC,CAAC,EAAE,YAAY,KAAK,CAAC,EAAA,CAAG,KAAK,MAAM,EAAE,OAAO,CAAC;;;;;;AAMlG,MAAM,iBAAiB,MAA6C;CAClE,MAAM,IAAI,KAAK,CAAC,CAAC,EAAE,kBAAkB;CACrC,IAAI,CAAC,KAAK,CAAC,EAAE,MAAM,MAAM,MAAM,EAAE,QAAQ,MAAM,KAAK,EAAE,MAAM,SAA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W,CAAC;EACZ,eAAe;CACjB;CACA;EACE,IAAI;EACJ,UAAU;EACV,MAAM;EACN,YAAY,CAAC,SAAS;EACtB,WAAW,CAAC;EACZ,eAAe;CACjB;AACF;AAKA,MAAa,gBAAgB;CAC3B;CACA;CACA;CACA;CACA;AACF;AAEA,SAAS,YACP,IACA,UACA,SAAiB,WACL;CACZ,OAAO;EACL;EACA;EACA,YAAY,CAAC,MAAM;EAKnB,MAAM,MAAM;GACV,MAAM,QAAQ,EAAE,OAAOF,sBAAAA,UAAU;GACjC,OAAO,OAAO,IAAI,EAAE,WAAW,OAAO,CAAC;GACvC,YAAY,CAAC,CAAC,EAAE,aAAa,OAAO,OAAO,EAAE,IAAI,SAAS,SAAS;EACrE;EACA,SAAS,MAAM,EAAE,OAAOA,sBAAAA,UAAU,CAAC,EAAE,OAAO,EAAE,KAAK;CACrD;AACF"}
|
|
1
|
+
{"version":3,"file":"commands.cjs","names":["StageToken","InteractionToken","AnnotationToken","SelectionToken","FormToken","RedactionToken","ZoomMode","SearchToken","DocumentsToken","ActionsToken","ShellToken","LinkToken"],"sources":["../src/config/commands.ts"],"sourcesContent":["/**\n * The command vocabulary — the semantic layer. Ported in spirit from the v2\n * snippet's commands.ts, but every command is a pure value: label key, icon,\n * shortcut, derivations, and a `run` (or a declarative surface target). The\n * v2 `registry.getPlugin<T>(id)?.provides()` string-and-cast dance becomes a\n * typed `ctx.get(Token)`.\n *\n * Wiring reality (chrome-parity scope):\n * zoom/pan/pointer/spread/scroll/rotate → real Stage / Interaction / PageEdit\n * modes → shell exclusive surfaces ('mode')\n * panels / menus / modals → declarative shell targets\n * annotate + shape tools → real interaction tools\n * form tools → real form plugin palette (draw-to-place)\n * insert/redact tools → inert interaction tools (demo-tools)\n * history undo/redo → disabled (no history plugin in v3 yet)\n */\nimport type { CommandDef, IconAccent } from '@embedpdf/react/commands';\nimport { DocumentsToken } from '@embedpdf/react/runtime';\nimport { StageToken, ZoomMode } from '@embedpdf/react/stage';\nimport type { SpreadMode } from '@embedpdf/react/stage';\nimport { InteractionToken } from '@embedpdf/react/interaction';\nimport { ShellToken } from '@embedpdf/react/shell';\nimport { AnnotationToken } from '@embedpdf/react/annotation';\nimport { copySelection, SelectionToken, type TextRange } from '@embedpdf/react/selection';\nimport { fieldKeyOf, FormToken } from '@embedpdf/react/form';\nimport { ActionsToken } from '@embedpdf/react/actions';\nimport { LinkToken, openLinkTarget, type PdfLinkTarget } from '@embedpdf/react/link';\nimport { SearchToken } from '@embedpdf/react/search';\nimport { RedactionToken } from '@embedpdf/react/redaction';\n\n// ── helpers ────────────────────────────────────────────────────────────────\ntype Ctx = Parameters<NonNullable<CommandDef['run']>>[0];\n\nconst stage = (c: Ctx) => c.tryGet(StageToken);\nconst interaction = (c: Ctx) => c.tryGet(InteractionToken);\nconst anno = (c: Ctx) => c.tryGet(AnnotationToken);\nconst textSelection = (c: Ctx) => c.tryGet(SelectionToken);\nconst sameTextRange = (a: TextRange | null, b: TextRange | null): boolean =>\n a === b ||\n (!!a &&\n !!b &&\n a.start.pon === b.start.pon &&\n a.start.index === b.start.index &&\n a.end.pon === b.end.pon &&\n a.end.index === b.end.index);\n\n// ── annotation-selection predicates (drive the floating strip's contents) ────\nconst hasAnnotationSelection = (c: Ctx) => (anno(c)?.selection().length ?? 0) > 0;\n/** v2 gated strip items per subtype (comment hidden on links/widgets) — here\n * it's one derivation over the selected DTOs instead of per-command lookups. */\nconst selectionSubtypes = (c: Ctx) => new Set((anno(c)?.getSelected() ?? []).map((a) => a.subtype));\n/**\n * The selection's `link` value: a target, `null` (linkable but none set), or\n * `undefined` when the selection cannot carry a link at all (widgets, mixed\n * link states) — the schema decides, never a subtype blocklist.\n */\nconst selectionLink = (c: Ctx): PdfLinkTarget | null | undefined => {\n const p = anno(c)?.getSelectionProps();\n if (!p || !p.specs.some((s) => s.key === 'link') || p.mixed.includes('link')) return undefined;\n return (p.values.link ?? null) as PdfLinkTarget | null;\n};\n\n// ── tool icon accents: THIS viewer's design decision ─────────────────────────\n// A tool declares which drawing default each colored part of its glyph previews.\n// This is intentionally explicit at the command definition: property-panel order\n// does not determine icon meaning, and another viewer may make a different choice.\ntype ColorKey = 'color' | 'interiorColor' | 'fontColor';\nexport interface ToolAccentDefinition {\n primary: ColorKey;\n secondary?: ColorKey;\n}\n\n/**\n * toolId → the SAME icon + accent definition its toolbar button uses, recorded\n * as a side effect of the `tool()` command definitions below — ONE source of\n * truth, so the tool cursor (ui/tool-cursor.tsx) and the button can never\n * drift apart.\n */\nexport const TOOL_ICONS: Record<string, { icon: string; accent?: ToolAccentDefinition }> = {};\n\nconst toolAccent = (\n c: Ctx,\n toolId: string,\n accent: ToolAccentDefinition | undefined,\n): IconAccent | null => {\n if (!accent) return null;\n const anno = c.tryGet(AnnotationToken);\n if (!anno) return null;\n const d = anno.currentDefaults(toolId);\n return {\n primary: d[accent.primary] ?? undefined,\n secondary: accent.secondary ? (d[accent.secondary] ?? undefined) : undefined,\n };\n};\n\n/** A tool command: activates a real interaction tool; active = it's the tool.\n * The icon previews the tool's current defaults — keyed by the SAME toolId\n * as run/active, so the accent can't drift to another tool's colors. */\nconst tool = (\n id: string,\n toolId: string,\n labelKey: string,\n icon: string,\n accent?: ToolAccentDefinition,\n): CommandDef => {\n TOOL_ICONS[toolId] = { icon, ...(accent ? { accent } : {}) };\n // Authoring tools grey out without their family's authority — the SAME\n // twin the owning plugin's gesture gate consults (permissions.md), so a\n // button can never offer a doomed paint: annotation/insert tools ask\n // annotation create authority, form-design tools ask `form.canDesign()`,\n // the redact marker asks `redaction.canMark()`. Absent plugin → ungated\n // (a build without the plugin has no authority question to ask).\n const authority: ((c: Ctx) => boolean) | null =\n id.startsWith('annotation:add') || id.startsWith('insert:add')\n ? (c) => anno(c)?.canCreate() ?? true\n : id.startsWith('form:add')\n ? (c) => c.tryGet(FormToken)?.canDesign() ?? true\n : id === 'redaction:redact'\n ? (c) => c.tryGet(RedactionToken)?.canMark() ?? true\n : null;\n return {\n id,\n labelKey,\n icon,\n categories: ['tool'],\n run: (c) => interaction(c)?.activateTool(toolId),\n active: (c) => interaction(c)?.activeToolId() === toolId,\n enabled: (c) => interaction(c) != null && (authority?.(c) ?? true),\n iconAccent: (c) => toolAccent(c, toolId, accent),\n };\n};\n\n/** A fixed zoom level (fraction), e.g. 1 = 100%. */\nconst zoomLevel = (id: string, level: number, label: string): CommandDef => ({\n id,\n labelKey: label,\n categories: ['zoom', 'zoom-level'],\n run: (c) => stage(c)?.zoomTo({ level }),\n enabled: (c) => stage(c) != null,\n});\n\nconst spread = (id: string, mode: SpreadMode, labelKey: string, icon: string): CommandDef => ({\n id,\n labelKey,\n icon,\n categories: ['page', 'spread'],\n run: (c) => stage(c)?.setSpread(mode),\n active: (c) => stage(c)?.spread() === mode,\n enabled: (c) => stage(c) != null,\n});\n\nexport const defaultCommands: CommandDef[] = [\n // ── zoom ───────────────────────────────────────────────────────────────\n {\n id: 'zoom:in',\n labelKey: 'commands.zoom.in',\n icon: 'zoomIn',\n shortcut: ['Mod+=', 'Mod+NumpadAdd'],\n categories: ['zoom'],\n run: (c) => stage(c)?.zoomIn(),\n enabled: (c) => stage(c) != null,\n },\n {\n id: 'zoom:out',\n labelKey: 'commands.zoom.out',\n icon: 'zoomOut',\n shortcut: ['Mod+-', 'Mod+NumpadSubtract'],\n categories: ['zoom'],\n run: (c) => stage(c)?.zoomOut(),\n enabled: (c) => stage(c) != null,\n },\n {\n id: 'zoom:fit-page',\n labelKey: 'commands.zoom.fitPage',\n icon: 'fitToPage',\n shortcut: 'Mod+0',\n categories: ['zoom'],\n run: (c) => stage(c)?.fitPage(),\n active: (c) => stage(c)?.zoomMode() === ZoomMode.FitPage,\n enabled: (c) => stage(c) != null,\n },\n {\n id: 'zoom:fit-width',\n labelKey: 'commands.zoom.fitWidth',\n icon: 'fitToWidth',\n shortcut: 'Mod+1',\n categories: ['zoom'],\n run: (c) => stage(c)?.fitWidth(),\n active: (c) => stage(c)?.zoomMode() === ZoomMode.FitWidth,\n enabled: (c) => stage(c) != null,\n },\n {\n id: 'zoom:automatic',\n labelKey: 'commands.zoom.automatic',\n categories: ['zoom'],\n run: (c) => stage(c)?.automatic(),\n active: (c) => stage(c)?.zoomMode() === ZoomMode.Automatic,\n enabled: (c) => stage(c) != null,\n },\n zoomLevel('zoom:50', 0.5, 'commands.zoom.p50'),\n zoomLevel('zoom:100', 1, 'commands.zoom.p100'),\n zoomLevel('zoom:150', 1.5, 'commands.zoom.p150'),\n zoomLevel('zoom:200', 2, 'commands.zoom.p200'),\n zoomLevel('zoom:400', 4, 'commands.zoom.p400'),\n {\n id: 'zoom:menu',\n labelKey: 'commands.zoom.menu',\n icon: 'zoomIn',\n categories: ['zoom'],\n menu: 'zoom',\n },\n\n // ── tools ──────────────────────────────────────────────────────────────\n {\n id: 'pan:toggle',\n labelKey: 'commands.pan',\n icon: 'hand',\n categories: ['tools'],\n run: (c) => interaction(c)?.activateTool('pan'),\n active: (c) => interaction(c)?.activeToolId() === 'pan',\n enabled: (c) => interaction(c) != null,\n },\n {\n id: 'pointer:toggle',\n labelKey: 'commands.pointer',\n icon: 'pointer',\n categories: ['tools'],\n run: (c) => interaction(c)?.activateTool('pointer'),\n active: (c) => interaction(c)?.activeToolId() === 'pointer',\n enabled: (c) => interaction(c) != null,\n },\n\n // ── panels (declarative shell targets) ──────────────────────────────────\n {\n id: 'panel:sidebar',\n labelKey: 'commands.sidebar',\n icon: 'sidebar',\n categories: ['panel'],\n panel: { id: 'sidebar', exclusive: 'left' },\n },\n {\n id: 'panel:search',\n labelKey: 'commands.search',\n icon: 'search',\n // No doc.text.search → every query would 403; the panel has no job.\n visible: (c) => c.tryGet(SearchToken)?.canSearch() ?? true,\n categories: ['panel'],\n panel: { id: 'search', exclusive: 'right' },\n },\n {\n id: 'panel:comment',\n labelKey: 'commands.comment',\n icon: 'comment',\n // No doc.annotate.read → there is nothing this panel could show.\n visible: (c) => anno(c)?.canRead() ?? true,\n categories: ['panel'],\n panel: { id: 'comment', exclusive: 'right' },\n },\n {\n id: 'panel:annotation-style',\n labelKey: 'commands.style',\n icon: 'palette',\n categories: ['panel'],\n panel: { id: 'annotation-style', exclusive: 'right' },\n },\n\n // ── menus (declarative) ─────────────────────────────────────────────────\n {\n id: 'document:menu',\n labelKey: 'commands.menu',\n icon: 'menu',\n categories: ['document'],\n menu: 'document',\n },\n {\n id: 'page:settings',\n labelKey: 'commands.viewControls',\n icon: 'viewSettings',\n categories: ['page'],\n menu: 'page-settings',\n },\n\n // ── document actions ────────────────────────────────────────────────────\n {\n id: 'document:download',\n labelKey: 'commands.download',\n icon: 'download',\n categories: ['document'],\n run: (c) => {\n const id = c.documentId ?? undefined;\n const documents = c.tryGet(DocumentsToken);\n if (!documents) return;\n const pull = () => documents.download(id);\n // The Phase-4 verb-owner contract: WS → serialize → DS as ONE queued\n // operation, so the WillSave mutations are IN the downloaded bytes\n // and two rapid saves can never interleave. Without the actions\n // plugin this degrades to a plain download.\n const actions = c.tryGet(ActionsToken);\n (actions ? actions.runDocumentVerb('save', pull) : pull())\n .then((bytes) => {\n const blob = new Blob([bytes as BlobPart], { type: 'application/pdf' });\n const url = URL.createObjectURL(blob);\n const a = document.createElement('a');\n a.href = url;\n a.download = 'document.pdf';\n a.click();\n URL.revokeObjectURL(url);\n })\n .catch((e) => console.warn('[snippet-react] download failed', e));\n },\n // The permissions.md chrome exception: a kernel verb with a 1:1\n // capability reads the kernel's `allows` directly — no owning plugin.\n enabled: (c) =>\n c.documentId != null && (c.tryGet(DocumentsToken)?.allows('doc.download') ?? false),\n },\n {\n id: 'document:print',\n labelKey: 'commands.print',\n icon: 'print',\n shortcut: 'Mod+p',\n categories: ['document'],\n // WP → window.print() → DP through the one serialized verb op (the\n // latch suppresses any nested script print); documentless chrome (or\n // no actions plugin) keeps today's direct dialog.\n run: (c) => {\n const actions = c.documentId != null ? c.tryGet(ActionsToken) : null;\n if (actions) void actions.runDocumentVerb('print', () => window.print());\n else window.print();\n },\n // Same exception; documentless chrome (no doc open) keeps print enabled\n // for whatever the host page shows.\n enabled: (c) => c.documentId == null || (c.tryGet(DocumentsToken)?.allows('doc.print') ?? true),\n },\n {\n id: 'document:fullscreen',\n labelKey: 'commands.fullscreen',\n icon: 'externalLink',\n categories: ['document'],\n run: () => {\n if (document.fullscreenElement) document.exitFullscreen();\n else document.documentElement.requestFullscreen().catch(() => {});\n },\n active: () => Boolean(document.fullscreenElement),\n },\n\n // ── page settings (spread / scroll / rotate) ────────────────────────────\n spread('spread:none', 'none', 'commands.spread.none', 'singlePage'),\n spread('spread:odd', 'odd', 'commands.spread.odd', 'doublePage'),\n spread('spread:even', 'even', 'commands.spread.even', 'book2'),\n {\n id: 'scroll:vertical',\n labelKey: 'commands.scroll.vertical',\n icon: 'vertical',\n categories: ['page', 'scroll'],\n run: (c) => stage(c)?.setLayout('vertical'),\n active: (c) => stage(c)?.layout() === 'vertical',\n enabled: (c) => stage(c) != null,\n },\n {\n id: 'scroll:horizontal',\n labelKey: 'commands.scroll.horizontal',\n icon: 'horizontal',\n categories: ['page', 'scroll'],\n run: (c) => stage(c)?.setLayout('horizontal'),\n active: (c) => stage(c)?.layout() === 'horizontal',\n enabled: (c) => stage(c) != null,\n },\n // VIEW rotation (Adobe's \"Rotate View\"): rotates how every page displays in\n // the main stage lens — non-persistent, nothing written to the PDF. The\n // PERMANENT per-page rotation (PageEditToken.rotateBy) belongs in a\n // page-organize surface, not behind the view-settings buttons.\n {\n id: 'rotate:clockwise',\n labelKey: 'commands.rotate.clockwise',\n icon: 'rotateClockwise',\n categories: ['page', 'rotate'],\n run: (c) => stage(c)?.rotateView(90),\n enabled: (c) => stage(c) != null,\n },\n {\n id: 'rotate:counter-clockwise',\n labelKey: 'commands.rotate.counterclockwise',\n icon: 'rotateCounterClockwise',\n categories: ['page', 'rotate'],\n run: (c) => stage(c)?.rotateView(-90),\n enabled: (c) => stage(c) != null,\n },\n\n // ── modes (shell exclusive surfaces, tag 'mode') ────────────────────────\n {\n id: 'mode:view',\n labelKey: 'commands.mode.view',\n categories: ['mode'],\n // View = no mode band. Close any open mode surface and drop to pointer.\n run: (c) => {\n const shell = c.tryGet(ShellToken);\n for (const m of MODE_SURFACES) shell?.close(m);\n interaction(c)?.activateTool('pointer');\n },\n active: (c) => {\n const shell = c.tryGet(ShellToken);\n return shell ? MODE_SURFACES.every((m) => !shell.isOpen(m)) : true;\n },\n },\n modeCommand('mode:annotate', 'commands.mode.annotate'),\n modeCommand('mode:shapes', 'commands.mode.shapes'),\n modeCommand('mode:insert', 'commands.mode.insert'),\n modeCommand('mode:form', 'commands.mode.form', 'form-edit'),\n modeCommand('mode:redact', 'commands.mode.redact'),\n\n // ── annotate tools (real interaction tools) ─────────────────────────────\n tool('annotation:add-highlight', 'highlight', 'commands.annotate.highlight', 'highlight', {\n primary: 'color',\n }),\n tool('annotation:add-strikeout', 'strikeout', 'commands.annotate.strikeout', 'strikethrough', {\n primary: 'color',\n }),\n tool('annotation:add-underline', 'underline', 'commands.annotate.underline', 'underline', {\n primary: 'color',\n }),\n tool('annotation:add-squiggly', 'squiggly', 'commands.annotate.squiggly', 'squiggly', {\n primary: 'color',\n }),\n tool('annotation:add-ink', 'ink', 'commands.annotate.ink', 'pencilMarker', {\n primary: 'color',\n }),\n tool(\n 'annotation:add-ink-highlight',\n 'ink-highlight',\n 'commands.annotate.inkHighlight',\n 'inkHighlighter',\n { primary: 'color' },\n ),\n tool('annotation:add-text', 'free-text', 'commands.annotate.text', 'freeText', {\n primary: 'fontColor',\n }),\n tool('annotation:add-insert-text', 'insert-text', 'commands.annotate.insertText', 'insertText', {\n primary: 'color',\n }),\n tool(\n 'annotation:add-replace-text',\n 'replace-text',\n 'commands.annotate.replaceText',\n 'replaceText',\n { primary: 'color' },\n ),\n tool('annotation:add-callout', 'free-text-callout', 'commands.annotate.callout', 'callout', {\n primary: 'color',\n secondary: 'interiorColor',\n }),\n // Sticky note (\"comment\") — click-to-place; the icon renders from the\n // engine-baked /AP in the tool's current color.\n tool('annotation:add-note', 'note', 'commands.annotate.note', 'message'),\n // Link — drag an invisible hit rectangle, then set the target in the style\n // panel's Link control (create-then-edit). While active, existing links\n // become editable rects instead of navigating.\n tool('annotation:add-link', 'link', 'commands.annotate.link', 'link'),\n\n // ── shape tools (real interaction tools) ────────────────────────────────\n tool('annotation:add-rectangle', 'square', 'commands.shapes.rectangle', 'square', {\n primary: 'color',\n secondary: 'interiorColor',\n }),\n tool('annotation:add-circle', 'circle', 'commands.shapes.circle', 'circle', {\n primary: 'color',\n secondary: 'interiorColor',\n }),\n tool('annotation:add-line', 'line', 'commands.shapes.line', 'line', { primary: 'color' }),\n // The arrow tool is a `line` preset (a line with an arrowhead) — registered by\n // the annotationPlugin `tools` config in App.tsx, activated like any other tool.\n tool('annotation:add-arrow', 'arrow', 'commands.shapes.arrow', 'lineArrow', {\n primary: 'color',\n }),\n tool('annotation:add-polygon', 'polygon', 'commands.shapes.polygon', 'polygon', {\n primary: 'color',\n secondary: 'interiorColor',\n }),\n tool('annotation:add-polyline', 'polyline', 'commands.shapes.polyline', 'zigzag', {\n primary: 'color',\n }),\n\n // ── insert tools (stamp/attachment real; signature/image inert) ─────────\n tool('insert:add-stamp', 'stamp', 'commands.insert.stamp', 'rubberStamp'),\n // File attachment — click the spot, pick the file (the attachment provider).\n tool('insert:add-attachment', 'attachment', 'commands.insert.attachment', 'paperclip'),\n tool('insert:add-signature', 'signature', 'commands.insert.signature', 'signature'),\n tool('insert:add-image', 'image', 'commands.insert.image', 'photo'),\n\n // ── form tools (the form plugin's draw-to-place palette) ────────────────\n tool('form:add-textfield', 'form-text', 'commands.form.textfield', 'formTextfield'),\n tool('form:add-checkbox', 'form-checkbox', 'commands.form.checkbox', 'formCheckbox'),\n tool('form:add-radio', 'form-radio', 'commands.form.radio', 'formRadio'),\n tool('form:add-select', 'form-combobox', 'commands.form.select', 'formSelect'),\n tool('form:add-listbox', 'form-listbox', 'commands.form.listbox', 'formListbox'),\n\n // ── redaction (v2 parity: the toolbar arms the tool; the panel owns the\n // destructive verbs — Apply All / Clear live in the redaction sidebar) ────\n tool('redaction:redact', 'redact', 'commands.redact.mark', 'redactArea'),\n {\n id: 'panel:redaction',\n labelKey: 'commands.redact.panel',\n icon: 'redactionSidebar',\n // Useful to a session that can propose marks OR apply them; with neither\n // power the panel could only display other people's pending marks.\n visible: (c) => {\n const r = c.tryGet(RedactionToken);\n return r ? r.canMark() || r.canApply() : true;\n },\n categories: ['panel'],\n panel: { id: 'redaction', exclusive: 'right' },\n },\n\n // ── annotation selection (the floating strip's verbs) ──────────────────\n {\n id: 'annotation:delete',\n labelKey: 'commands.annotate.delete',\n icon: 'trash',\n categories: ['annotation'],\n run: (c) => {\n const a = anno(c);\n if (!a) return;\n const form = c.tryGet(FormToken);\n const dtos = a.getSelected();\n const widgets = form ? dtos.filter((d) => d.subtype === 'widget') : [];\n if (widgets.length === 0) {\n a.deleteSelection();\n return;\n }\n // Widgets are FIELD-plane citizens: deleting one goes through doc.forms\n // (the field and every widget of it cascade), never the raw annotation —\n // otherwise the /AcroForm entry would be orphaned.\n const keys = new Set<string>();\n for (const w of widgets) {\n const objnum = w.ref.kind === 'objectNumber' ? w.ref.annotObjectNumber : 0;\n const field = objnum > 0 ? form!.fieldForWidget(objnum) : null;\n if (field) keys.add(fieldKeyOf(field));\n }\n for (const key of keys) void form!.deleteField(key);\n for (const d of dtos) if (d.subtype !== 'widget') void a.delete(d.ref);\n a.deselect();\n },\n visible: hasAnnotationSelection,\n // Mirrors the engine's own authorization: locked/unauthorized annotations\n // keep the button visible but disabled (the engine still enforces).\n enabled: (c) => {\n const a = anno(c);\n const refs = a?.getSelection() ?? [];\n return refs.length > 0 && refs.every((r) => a!.canDelete(r));\n },\n },\n {\n id: 'annotation:comment',\n labelKey: 'commands.comment',\n icon: 'comment',\n categories: ['annotation'],\n // Same 'comment' surface panel:comment toggles — `active` derives from it.\n panel: { id: 'comment', exclusive: 'right' },\n visible: (c) => hasAnnotationSelection(c) && !selectionSubtypes(c).has('widget'),\n },\n {\n id: 'annotation:style',\n labelKey: 'commands.style',\n icon: 'palette',\n categories: ['annotation'],\n panel: { id: 'annotation-style', exclusive: 'right' },\n // The kind table decides: no declared editable props → no style button\n // (v2 hardcoded a subtype blocklist for this).\n visible: (c) => (anno(c)?.getSelectionProps().specs.length ?? 0) > 0,\n },\n {\n id: 'annotation:group',\n labelKey: 'commands.annotate.group',\n icon: 'group',\n categories: ['annotation'],\n run: (c) => void anno(c)?.group(),\n visible: (c) => anno(c)?.canGroup() ?? false,\n },\n {\n id: 'annotation:ungroup',\n labelKey: 'commands.annotate.ungroup',\n icon: 'ungroup',\n categories: ['annotation'],\n run: (c) => void anno(c)?.ungroup(),\n visible: (c) => anno(c)?.canUngroup() ?? false,\n },\n\n // ── text selection (the selection strip's verbs) ────────────────────────\n {\n id: 'selection:copy',\n labelKey: 'commands.selection.copy',\n icon: 'copy',\n categories: ['selection'],\n // The permission story rides `visible`: a deployment denying\n // doc.text.copy shows no Copy at all — and with zero visible commands\n // the strip renders nothing, so there is never an empty bubble.\n visible: (c) => {\n const s = textSelection(c);\n return !!s && s.hasSelection() && s.canCopy();\n },\n // Async Clipboard write inside the click's activation window; instant\n // when <SelectionClipboard>'s commit prefetch already fetched the text.\n // A successful copy consumes the selection, which also dismisses its strip.\n run: (c) => {\n const s = textSelection(c);\n if (!s) return;\n const copiedRange = s.snapshot().range;\n void copySelection(s).then(\n (text) => {\n // Clipboard writes can outlive the click. Never let an older copy\n // completion clear a newer selection the user made in the meantime.\n if (text !== '' && sameTextRange(s.snapshot().range, copiedRange)) s.clear();\n },\n () => {}, // Copy failed: preserve the selection so the user can retry.\n );\n },\n },\n\n // ── link strip items (v2's \"Link / Go to link / Remove link\") ───────────\n {\n // Make the selection a link: opens the anchored POPOVER (v2's popup —\n // a link is a verb on the selection, not a style), whose editor sets\n // the target through `updateSelection({ link })`; the plugin's\n // reconciler materializes the attached child annotations.\n id: 'annotation:link',\n labelKey: 'commands.annotate.link',\n icon: 'link',\n categories: ['annotation'],\n run: (c) => c.tryGet(ShellToken)?.toggle('link-editor'),\n active: (c) => c.tryGet(ShellToken)?.isOpen('link-editor') ?? false,\n visible: (c) => selectionLink(c) === null,\n },\n {\n id: 'annotation:goto-link',\n labelKey: 'commands.annotate.gotoLink',\n icon: 'externalLink',\n categories: ['annotation'],\n run: (c) => {\n const target = selectionLink(c);\n const link = c.tryGet(LinkToken);\n // The opener PERFORMS the uri outcome (window.open) — bare `activate`\n // resolves but opens nothing for URL targets.\n if (target && link) openLinkTarget(link, target);\n },\n visible: (c) => selectionLink(c) != null,\n },\n {\n id: 'annotation:remove-link',\n labelKey: 'commands.annotate.removeLink',\n icon: 'linkOff',\n categories: ['annotation'],\n run: (c) => anno(c)?.updateSelection({ link: null }),\n visible: (c) => selectionLink(c) != null,\n },\n\n // ── history (no plugin yet → disabled, shows the disabled styling) ──────\n {\n id: 'history:undo',\n labelKey: 'commands.undo',\n icon: 'arrowBackUp',\n categories: ['history'],\n run: () => {},\n enabled: () => false,\n },\n {\n id: 'history:redo',\n labelKey: 'commands.redo',\n icon: 'arrowForwardUp',\n categories: ['history'],\n run: () => {},\n enabled: () => false,\n },\n];\n\n// ── mode helpers ─────────────────────────────────────────────────────────────\n// Modes are exclusive shell surfaces tagged 'mode'; the secondary band renders\n// whichever one is open. Kept below the array to keep the list readable.\nexport const MODE_SURFACES = [\n 'mode:annotate',\n 'mode:shapes',\n 'mode:insert',\n 'mode:form',\n 'mode:redact',\n] as const;\n\nfunction modeCommand(\n id: (typeof MODE_SURFACES)[number],\n labelKey: string,\n toolId: string = 'pointer',\n): CommandDef {\n return {\n id,\n labelKey,\n categories: ['mode'],\n // A mode tab is a shell surface AND a tool policy: the Form tab flips the\n // pointer into form design ('form-edit' — widgets select/move/resize like\n // annotations); every other tab (and closing one) drops back to the\n // default pointer, where widgets are fill controls again.\n run: (c) => {\n const shell = c.tryGet(ShellToken);\n shell?.toggle(id, { exclusive: 'mode' });\n interaction(c)?.activateTool(shell?.isOpen(id) ? toolId : 'pointer');\n },\n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