@embedpdf/viewer-chrome 3.0.0-next.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +215 -0
- package/README.md +317 -0
- package/dist/chrome.cjs +228 -0
- package/dist/chrome.cjs.map +1 -0
- package/dist/chrome.d.cts +36 -0
- package/dist/chrome.d.ts +36 -0
- package/dist/chrome.js +224 -0
- package/dist/chrome.js.map +1 -0
- package/dist/commands.cjs +497 -0
- package/dist/commands.cjs.map +1 -0
- package/dist/commands.d.cts +22 -0
- package/dist/commands.d.ts +22 -0
- package/dist/commands.js +494 -0
- package/dist/commands.js.map +1 -0
- package/dist/es-C5084JO6.cjs +166 -0
- package/dist/es-C5084JO6.cjs.map +1 -0
- package/dist/es-D0PzYE9Z.js +166 -0
- package/dist/es-D0PzYE9Z.js.map +1 -0
- package/dist/index.cjs +3700 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +121 -0
- package/dist/index.d.ts +121 -0
- package/dist/index.js +3529 -0
- package/dist/index.js.map +1 -0
- package/package.json +61 -0
- package/src/styles.css +132 -0
package/dist/chrome.cjs
ADDED
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
let _embedpdf_react_toolbar = require("@embedpdf/react/toolbar");
|
|
3
|
+
//#region src/config/chrome.ts
|
|
4
|
+
/**
|
|
5
|
+
* The chrome — structure only. No breakpoints, no show/hide lists, no locale
|
|
6
|
+
* overrides, no dividers/spacers, no hand-written overflow menus. What fits is
|
|
7
|
+
* measured and solved at runtime (@embedpdf/core-ui); the overflow menu is
|
|
8
|
+
* derived. Compare to the v2 snippet's 1,950-line ui-schema.ts.
|
|
9
|
+
*
|
|
10
|
+
* `importance` (1 sheds first … 5 pinned) is the only responsive knob.
|
|
11
|
+
*/
|
|
12
|
+
const style = (0, _embedpdf_react_toolbar.group)("style", { importance: 4 }, [(0, _embedpdf_react_toolbar.item)("panel:annotation-style")]);
|
|
13
|
+
const history = (0, _embedpdf_react_toolbar.group)("history", { importance: 3 }, ["history:undo", "history:redo"]);
|
|
14
|
+
const mainBar = {
|
|
15
|
+
id: "main",
|
|
16
|
+
sections: {
|
|
17
|
+
start: [
|
|
18
|
+
(0, _embedpdf_react_toolbar.group)("document", { importance: 5 }, [(0, _embedpdf_react_toolbar.item)("document:menu")]),
|
|
19
|
+
(0, _embedpdf_react_toolbar.group)("workspace", { importance: 4 }, [(0, _embedpdf_react_toolbar.item)("panel:sidebar", { importance: 5 }), (0, _embedpdf_react_toolbar.item)("page:settings")]),
|
|
20
|
+
(0, _embedpdf_react_toolbar.group)("zoom", { importance: 4 }, [(0, _embedpdf_react_toolbar.custom)("zoom-controls", {
|
|
21
|
+
variants: ["inline", "button"],
|
|
22
|
+
terminal: "zoom:menu"
|
|
23
|
+
})]),
|
|
24
|
+
(0, _embedpdf_react_toolbar.group)("tools", { importance: 2 }, ["pan:toggle", "pointer:toggle"])
|
|
25
|
+
],
|
|
26
|
+
center: [(0, _embedpdf_react_toolbar.group)("modes", {
|
|
27
|
+
role: "tabs",
|
|
28
|
+
shed: true,
|
|
29
|
+
collapse: "select",
|
|
30
|
+
importance: 4,
|
|
31
|
+
labelKey: "commands.mode.group",
|
|
32
|
+
items: [
|
|
33
|
+
(0, _embedpdf_react_toolbar.item)("mode:view", {
|
|
34
|
+
variants: ["label"],
|
|
35
|
+
importance: 1
|
|
36
|
+
}),
|
|
37
|
+
(0, _embedpdf_react_toolbar.item)("mode:annotate", {
|
|
38
|
+
variants: ["label"],
|
|
39
|
+
importance: 1
|
|
40
|
+
}),
|
|
41
|
+
(0, _embedpdf_react_toolbar.item)("mode:shapes", {
|
|
42
|
+
variants: ["label"],
|
|
43
|
+
importance: 1
|
|
44
|
+
}),
|
|
45
|
+
(0, _embedpdf_react_toolbar.item)("mode:insert", {
|
|
46
|
+
variants: ["label"],
|
|
47
|
+
importance: 1
|
|
48
|
+
}),
|
|
49
|
+
(0, _embedpdf_react_toolbar.item)("mode:form", {
|
|
50
|
+
variants: ["label"],
|
|
51
|
+
importance: 1
|
|
52
|
+
}),
|
|
53
|
+
(0, _embedpdf_react_toolbar.item)("mode:redact", {
|
|
54
|
+
variants: ["label"],
|
|
55
|
+
importance: 1
|
|
56
|
+
})
|
|
57
|
+
]
|
|
58
|
+
})],
|
|
59
|
+
end: [(0, _embedpdf_react_toolbar.group)("panels", { importance: 5 }, ["panel:search", "panel:comment"])]
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
const annotateBar = {
|
|
63
|
+
id: "annotate",
|
|
64
|
+
sections: { center: [
|
|
65
|
+
(0, _embedpdf_react_toolbar.group)("comment", { importance: 4 }, ["annotation:add-note", "annotation:add-link"]),
|
|
66
|
+
(0, _embedpdf_react_toolbar.group)("markup", { importance: 4 }, [
|
|
67
|
+
"annotation:add-highlight",
|
|
68
|
+
"annotation:add-strikeout",
|
|
69
|
+
"annotation:add-underline",
|
|
70
|
+
"annotation:add-squiggly"
|
|
71
|
+
]),
|
|
72
|
+
(0, _embedpdf_react_toolbar.group)("draw", { importance: 3 }, ["annotation:add-ink", "annotation:add-ink-highlight"]),
|
|
73
|
+
(0, _embedpdf_react_toolbar.group)("text", { importance: 2 }, [
|
|
74
|
+
"annotation:add-text",
|
|
75
|
+
"annotation:add-insert-text",
|
|
76
|
+
"annotation:add-replace-text",
|
|
77
|
+
"annotation:add-callout"
|
|
78
|
+
]),
|
|
79
|
+
style,
|
|
80
|
+
history
|
|
81
|
+
] }
|
|
82
|
+
};
|
|
83
|
+
const shapesBar = {
|
|
84
|
+
id: "shapes",
|
|
85
|
+
sections: { center: [
|
|
86
|
+
(0, _embedpdf_react_toolbar.group)("shapes", { importance: 4 }, [
|
|
87
|
+
"annotation:add-rectangle",
|
|
88
|
+
"annotation:add-circle",
|
|
89
|
+
"annotation:add-line",
|
|
90
|
+
"annotation:add-arrow"
|
|
91
|
+
]),
|
|
92
|
+
(0, _embedpdf_react_toolbar.group)("polygons", { importance: 2 }, ["annotation:add-polygon", "annotation:add-polyline"]),
|
|
93
|
+
style,
|
|
94
|
+
history
|
|
95
|
+
] }
|
|
96
|
+
};
|
|
97
|
+
const insertBar = {
|
|
98
|
+
id: "insert",
|
|
99
|
+
sections: { center: [
|
|
100
|
+
(0, _embedpdf_react_toolbar.group)("stamps", { importance: 4 }, [
|
|
101
|
+
"insert:add-stamp",
|
|
102
|
+
"insert:add-attachment",
|
|
103
|
+
"insert:add-signature",
|
|
104
|
+
"insert:add-image"
|
|
105
|
+
]),
|
|
106
|
+
style,
|
|
107
|
+
history
|
|
108
|
+
] }
|
|
109
|
+
};
|
|
110
|
+
const formBar = {
|
|
111
|
+
id: "form",
|
|
112
|
+
sections: { center: [
|
|
113
|
+
(0, _embedpdf_react_toolbar.group)("fields", { importance: 4 }, [
|
|
114
|
+
"form:add-textfield",
|
|
115
|
+
"form:add-checkbox",
|
|
116
|
+
"form:add-radio"
|
|
117
|
+
]),
|
|
118
|
+
(0, _embedpdf_react_toolbar.group)("choice-fields", { importance: 2 }, ["form:add-select", "form:add-listbox"]),
|
|
119
|
+
history
|
|
120
|
+
] }
|
|
121
|
+
};
|
|
122
|
+
const redactBar = {
|
|
123
|
+
id: "redact",
|
|
124
|
+
sections: { center: [
|
|
125
|
+
(0, _embedpdf_react_toolbar.group)("redact", { importance: 4 }, ["redaction:redact", "panel:redaction"]),
|
|
126
|
+
style,
|
|
127
|
+
history
|
|
128
|
+
] }
|
|
129
|
+
};
|
|
130
|
+
const documentMenu = {
|
|
131
|
+
id: "document",
|
|
132
|
+
sections: [{ items: ["document:download", "document:print"] }, { items: ["document:fullscreen"] }]
|
|
133
|
+
};
|
|
134
|
+
const zoomMenu = {
|
|
135
|
+
id: "zoom",
|
|
136
|
+
sections: [
|
|
137
|
+
{
|
|
138
|
+
labelKey: "commands.zoom.level",
|
|
139
|
+
items: [
|
|
140
|
+
"zoom:50",
|
|
141
|
+
"zoom:100",
|
|
142
|
+
"zoom:150",
|
|
143
|
+
"zoom:200",
|
|
144
|
+
"zoom:400"
|
|
145
|
+
]
|
|
146
|
+
},
|
|
147
|
+
{ items: ["zoom:in", "zoom:out"] },
|
|
148
|
+
{ items: [
|
|
149
|
+
"zoom:fit-page",
|
|
150
|
+
"zoom:fit-width",
|
|
151
|
+
"zoom:automatic"
|
|
152
|
+
] }
|
|
153
|
+
]
|
|
154
|
+
};
|
|
155
|
+
const pageSettingsMenu = {
|
|
156
|
+
id: "page-settings",
|
|
157
|
+
sections: [
|
|
158
|
+
{
|
|
159
|
+
labelKey: "commands.spread.group",
|
|
160
|
+
items: [
|
|
161
|
+
"spread:none",
|
|
162
|
+
"spread:odd",
|
|
163
|
+
"spread:even"
|
|
164
|
+
]
|
|
165
|
+
},
|
|
166
|
+
{
|
|
167
|
+
labelKey: "commands.scroll.group",
|
|
168
|
+
items: ["scroll:vertical", "scroll:horizontal"]
|
|
169
|
+
},
|
|
170
|
+
{
|
|
171
|
+
labelKey: "commands.rotate.group",
|
|
172
|
+
items: ["rotate:clockwise", "rotate:counter-clockwise"]
|
|
173
|
+
},
|
|
174
|
+
{ items: ["document:fullscreen"] }
|
|
175
|
+
]
|
|
176
|
+
};
|
|
177
|
+
const annotationStrip = {
|
|
178
|
+
id: "annotation-strip",
|
|
179
|
+
sections: { center: [(0, _embedpdf_react_toolbar.group)("annotation-actions", { importance: 4 }, [
|
|
180
|
+
"annotation:comment",
|
|
181
|
+
"annotation:style",
|
|
182
|
+
"annotation:link",
|
|
183
|
+
"annotation:goto-link",
|
|
184
|
+
"annotation:remove-link",
|
|
185
|
+
"annotation:group",
|
|
186
|
+
"annotation:ungroup"
|
|
187
|
+
]), (0, _embedpdf_react_toolbar.group)("annotation-danger", { importance: 5 }, ["annotation:delete"])] }
|
|
188
|
+
};
|
|
189
|
+
/**
|
|
190
|
+
* The DEFAULT chrome — exported as a VALUE, which is the whole customization
|
|
191
|
+
* model: consumers pass nothing and track this, transform it, or write their
|
|
192
|
+
* own. It is never merged with anything.
|
|
193
|
+
*/
|
|
194
|
+
const defaultChrome = (0, _embedpdf_react_toolbar.defineChrome)({
|
|
195
|
+
bars: { main: mainBar },
|
|
196
|
+
modeBars: {
|
|
197
|
+
"mode:annotate": annotateBar,
|
|
198
|
+
"mode:shapes": shapesBar,
|
|
199
|
+
"mode:insert": insertBar,
|
|
200
|
+
"mode:form": formBar,
|
|
201
|
+
"mode:redact": redactBar
|
|
202
|
+
},
|
|
203
|
+
menus: {
|
|
204
|
+
document: documentMenu,
|
|
205
|
+
zoom: zoomMenu,
|
|
206
|
+
"page-settings": pageSettingsMenu
|
|
207
|
+
},
|
|
208
|
+
strips: { annotation: annotationStrip }
|
|
209
|
+
});
|
|
210
|
+
/** Menu lookup by id (arbitrary string). */
|
|
211
|
+
function getMenu(schema, id) {
|
|
212
|
+
return schema.menus?.[id];
|
|
213
|
+
}
|
|
214
|
+
/** Secondary band lookup by mode-surface id. */
|
|
215
|
+
function getModeBar(schema, id) {
|
|
216
|
+
return schema.modeBars?.[id];
|
|
217
|
+
}
|
|
218
|
+
/** Contextual strip lookup by context id ('annotation', …). */
|
|
219
|
+
function getStrip(schema, id) {
|
|
220
|
+
return schema.strips?.[id];
|
|
221
|
+
}
|
|
222
|
+
//#endregion
|
|
223
|
+
exports.defaultChrome = defaultChrome;
|
|
224
|
+
exports.getMenu = getMenu;
|
|
225
|
+
exports.getModeBar = getModeBar;
|
|
226
|
+
exports.getStrip = getStrip;
|
|
227
|
+
|
|
228
|
+
//# sourceMappingURL=chrome.cjs.map
|
|
@@ -0,0 +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,CACtB,CAAC;IAGK,GAAA,wBAAA,MAAA,CAAA,QAAQ,EAAE,YAAY,EAAE,GAAG,EAAA,GAAA,wBAAA,OAAA,CACxB,iBAAiB;IAAE,UAAU,CAAC,UAAU,QAAQ;IAAG,UAAU;GAAY,CAAC,CACnF,CAAC;IACK,GAAA,wBAAA,MAAA,CAAA,SAAS,EAAE,YAAY,EAAE,GAAG,CAAC,cAAc,gBAAgB,CAAC;EACpE;EACA,QAAQ,EAAA,GAAA,wBAAA,MAAA,CACA,SAAS;GACb,MAAM;GAMN,MAAM;GACN,UAAU;GACV,YAAY;GACZ,UAAU;GACV,OAAO;KACA,GAAA,wBAAA,KAAA,CAAA,aAAa;KAAE,UAAU,CAAC,OAAO;KAAG,YAAY;IAAE,CAAC;KACnD,GA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,OAAO,CAAC,qBAAqB,EAAE;CACnC;AACF;AAMA,MAAM,kBAA6B;CACjC,IAAI;CACJ,UAAU,EACR,QAAQ,EAAA,GAAA,wBAAA,MAAA,CACA,sBAAsB,EAAE,YAAY,EAAE,GAAG;EAC7C;EACA;EACA;EACA;EACA;EACA;EACA;CACF,CAAC,IAAA,GAAA,wBAAA,MAAA,CAEK,qBAAqB,EAAE,YAAY,EAAE,GAAG,CAAC,mBAAmB,CAAC,CACrE,EACF;AACF;;;;;;AAOA,MAAa,iBAAA,GAAA,wBAAA,aAAA,CAA6B;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,gBAAgB;AACxC,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"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { BarSchema, ChromeSchema, MenuSchema } from "@embedpdf/react/toolbar";
|
|
2
|
+
//#region src/config/chrome.d.ts
|
|
3
|
+
/**
|
|
4
|
+
* The DEFAULT chrome — exported as a VALUE, which is the whole customization
|
|
5
|
+
* model: consumers pass nothing and track this, transform it, or write their
|
|
6
|
+
* own. It is never merged with anything.
|
|
7
|
+
*/
|
|
8
|
+
declare const defaultChrome: {
|
|
9
|
+
bars: {
|
|
10
|
+
main: BarSchema;
|
|
11
|
+
};
|
|
12
|
+
modeBars: {
|
|
13
|
+
'mode:annotate': BarSchema;
|
|
14
|
+
'mode:shapes': BarSchema;
|
|
15
|
+
'mode:insert': BarSchema;
|
|
16
|
+
'mode:form': BarSchema;
|
|
17
|
+
'mode:redact': BarSchema;
|
|
18
|
+
};
|
|
19
|
+
menus: {
|
|
20
|
+
document: MenuSchema;
|
|
21
|
+
zoom: MenuSchema;
|
|
22
|
+
'page-settings': MenuSchema;
|
|
23
|
+
};
|
|
24
|
+
strips: {
|
|
25
|
+
annotation: BarSchema;
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
/** Menu lookup by id (arbitrary string). */
|
|
29
|
+
declare function getMenu(schema: ChromeSchema, id: string): MenuSchema | undefined;
|
|
30
|
+
/** Secondary band lookup by mode-surface id. */
|
|
31
|
+
declare function getModeBar(schema: ChromeSchema, id: string): BarSchema | undefined;
|
|
32
|
+
/** Contextual strip lookup by context id ('annotation', …). */
|
|
33
|
+
declare function getStrip(schema: ChromeSchema, id: string): BarSchema | undefined;
|
|
34
|
+
//#endregion
|
|
35
|
+
export { defaultChrome, getMenu, getModeBar, getStrip };
|
|
36
|
+
//# sourceMappingURL=chrome.d.cts.map
|
package/dist/chrome.d.ts
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { BarSchema, ChromeSchema, MenuSchema } from "@embedpdf/react/toolbar";
|
|
2
|
+
//#region src/config/chrome.d.ts
|
|
3
|
+
/**
|
|
4
|
+
* The DEFAULT chrome — exported as a VALUE, which is the whole customization
|
|
5
|
+
* model: consumers pass nothing and track this, transform it, or write their
|
|
6
|
+
* own. It is never merged with anything.
|
|
7
|
+
*/
|
|
8
|
+
declare const defaultChrome: {
|
|
9
|
+
bars: {
|
|
10
|
+
main: BarSchema;
|
|
11
|
+
};
|
|
12
|
+
modeBars: {
|
|
13
|
+
'mode:annotate': BarSchema;
|
|
14
|
+
'mode:shapes': BarSchema;
|
|
15
|
+
'mode:insert': BarSchema;
|
|
16
|
+
'mode:form': BarSchema;
|
|
17
|
+
'mode:redact': BarSchema;
|
|
18
|
+
};
|
|
19
|
+
menus: {
|
|
20
|
+
document: MenuSchema;
|
|
21
|
+
zoom: MenuSchema;
|
|
22
|
+
'page-settings': MenuSchema;
|
|
23
|
+
};
|
|
24
|
+
strips: {
|
|
25
|
+
annotation: BarSchema;
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
/** Menu lookup by id (arbitrary string). */
|
|
29
|
+
declare function getMenu(schema: ChromeSchema, id: string): MenuSchema | undefined;
|
|
30
|
+
/** Secondary band lookup by mode-surface id. */
|
|
31
|
+
declare function getModeBar(schema: ChromeSchema, id: string): BarSchema | undefined;
|
|
32
|
+
/** Contextual strip lookup by context id ('annotation', …). */
|
|
33
|
+
declare function getStrip(schema: ChromeSchema, id: string): BarSchema | undefined;
|
|
34
|
+
//#endregion
|
|
35
|
+
export { defaultChrome, getMenu, getModeBar, getStrip };
|
|
36
|
+
//# sourceMappingURL=chrome.d.ts.map
|
package/dist/chrome.js
ADDED
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
import { custom, defineChrome, group, item } from "@embedpdf/react/toolbar";
|
|
2
|
+
//#region src/config/chrome.ts
|
|
3
|
+
/**
|
|
4
|
+
* The chrome — structure only. No breakpoints, no show/hide lists, no locale
|
|
5
|
+
* overrides, no dividers/spacers, no hand-written overflow menus. What fits is
|
|
6
|
+
* measured and solved at runtime (@embedpdf/core-ui); the overflow menu is
|
|
7
|
+
* derived. Compare to the v2 snippet's 1,950-line ui-schema.ts.
|
|
8
|
+
*
|
|
9
|
+
* `importance` (1 sheds first … 5 pinned) is the only responsive knob.
|
|
10
|
+
*/
|
|
11
|
+
const style = group("style", { importance: 4 }, [item("panel:annotation-style")]);
|
|
12
|
+
const history = group("history", { importance: 3 }, ["history:undo", "history:redo"]);
|
|
13
|
+
const mainBar = {
|
|
14
|
+
id: "main",
|
|
15
|
+
sections: {
|
|
16
|
+
start: [
|
|
17
|
+
group("document", { importance: 5 }, [item("document:menu")]),
|
|
18
|
+
group("workspace", { importance: 4 }, [item("panel:sidebar", { importance: 5 }), item("page:settings")]),
|
|
19
|
+
group("zoom", { importance: 4 }, [custom("zoom-controls", {
|
|
20
|
+
variants: ["inline", "button"],
|
|
21
|
+
terminal: "zoom:menu"
|
|
22
|
+
})]),
|
|
23
|
+
group("tools", { importance: 2 }, ["pan:toggle", "pointer:toggle"])
|
|
24
|
+
],
|
|
25
|
+
center: [group("modes", {
|
|
26
|
+
role: "tabs",
|
|
27
|
+
shed: true,
|
|
28
|
+
collapse: "select",
|
|
29
|
+
importance: 4,
|
|
30
|
+
labelKey: "commands.mode.group",
|
|
31
|
+
items: [
|
|
32
|
+
item("mode:view", {
|
|
33
|
+
variants: ["label"],
|
|
34
|
+
importance: 1
|
|
35
|
+
}),
|
|
36
|
+
item("mode:annotate", {
|
|
37
|
+
variants: ["label"],
|
|
38
|
+
importance: 1
|
|
39
|
+
}),
|
|
40
|
+
item("mode:shapes", {
|
|
41
|
+
variants: ["label"],
|
|
42
|
+
importance: 1
|
|
43
|
+
}),
|
|
44
|
+
item("mode:insert", {
|
|
45
|
+
variants: ["label"],
|
|
46
|
+
importance: 1
|
|
47
|
+
}),
|
|
48
|
+
item("mode:form", {
|
|
49
|
+
variants: ["label"],
|
|
50
|
+
importance: 1
|
|
51
|
+
}),
|
|
52
|
+
item("mode:redact", {
|
|
53
|
+
variants: ["label"],
|
|
54
|
+
importance: 1
|
|
55
|
+
})
|
|
56
|
+
]
|
|
57
|
+
})],
|
|
58
|
+
end: [group("panels", { importance: 5 }, ["panel:search", "panel:comment"])]
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
const annotateBar = {
|
|
62
|
+
id: "annotate",
|
|
63
|
+
sections: { center: [
|
|
64
|
+
group("comment", { importance: 4 }, ["annotation:add-note", "annotation:add-link"]),
|
|
65
|
+
group("markup", { importance: 4 }, [
|
|
66
|
+
"annotation:add-highlight",
|
|
67
|
+
"annotation:add-strikeout",
|
|
68
|
+
"annotation:add-underline",
|
|
69
|
+
"annotation:add-squiggly"
|
|
70
|
+
]),
|
|
71
|
+
group("draw", { importance: 3 }, ["annotation:add-ink", "annotation:add-ink-highlight"]),
|
|
72
|
+
group("text", { importance: 2 }, [
|
|
73
|
+
"annotation:add-text",
|
|
74
|
+
"annotation:add-insert-text",
|
|
75
|
+
"annotation:add-replace-text",
|
|
76
|
+
"annotation:add-callout"
|
|
77
|
+
]),
|
|
78
|
+
style,
|
|
79
|
+
history
|
|
80
|
+
] }
|
|
81
|
+
};
|
|
82
|
+
const shapesBar = {
|
|
83
|
+
id: "shapes",
|
|
84
|
+
sections: { center: [
|
|
85
|
+
group("shapes", { importance: 4 }, [
|
|
86
|
+
"annotation:add-rectangle",
|
|
87
|
+
"annotation:add-circle",
|
|
88
|
+
"annotation:add-line",
|
|
89
|
+
"annotation:add-arrow"
|
|
90
|
+
]),
|
|
91
|
+
group("polygons", { importance: 2 }, ["annotation:add-polygon", "annotation:add-polyline"]),
|
|
92
|
+
style,
|
|
93
|
+
history
|
|
94
|
+
] }
|
|
95
|
+
};
|
|
96
|
+
const insertBar = {
|
|
97
|
+
id: "insert",
|
|
98
|
+
sections: { center: [
|
|
99
|
+
group("stamps", { importance: 4 }, [
|
|
100
|
+
"insert:add-stamp",
|
|
101
|
+
"insert:add-attachment",
|
|
102
|
+
"insert:add-signature",
|
|
103
|
+
"insert:add-image"
|
|
104
|
+
]),
|
|
105
|
+
style,
|
|
106
|
+
history
|
|
107
|
+
] }
|
|
108
|
+
};
|
|
109
|
+
const formBar = {
|
|
110
|
+
id: "form",
|
|
111
|
+
sections: { center: [
|
|
112
|
+
group("fields", { importance: 4 }, [
|
|
113
|
+
"form:add-textfield",
|
|
114
|
+
"form:add-checkbox",
|
|
115
|
+
"form:add-radio"
|
|
116
|
+
]),
|
|
117
|
+
group("choice-fields", { importance: 2 }, ["form:add-select", "form:add-listbox"]),
|
|
118
|
+
history
|
|
119
|
+
] }
|
|
120
|
+
};
|
|
121
|
+
const redactBar = {
|
|
122
|
+
id: "redact",
|
|
123
|
+
sections: { center: [
|
|
124
|
+
group("redact", { importance: 4 }, ["redaction:redact", "panel:redaction"]),
|
|
125
|
+
style,
|
|
126
|
+
history
|
|
127
|
+
] }
|
|
128
|
+
};
|
|
129
|
+
const documentMenu = {
|
|
130
|
+
id: "document",
|
|
131
|
+
sections: [{ items: ["document:download", "document:print"] }, { items: ["document:fullscreen"] }]
|
|
132
|
+
};
|
|
133
|
+
const zoomMenu = {
|
|
134
|
+
id: "zoom",
|
|
135
|
+
sections: [
|
|
136
|
+
{
|
|
137
|
+
labelKey: "commands.zoom.level",
|
|
138
|
+
items: [
|
|
139
|
+
"zoom:50",
|
|
140
|
+
"zoom:100",
|
|
141
|
+
"zoom:150",
|
|
142
|
+
"zoom:200",
|
|
143
|
+
"zoom:400"
|
|
144
|
+
]
|
|
145
|
+
},
|
|
146
|
+
{ items: ["zoom:in", "zoom:out"] },
|
|
147
|
+
{ items: [
|
|
148
|
+
"zoom:fit-page",
|
|
149
|
+
"zoom:fit-width",
|
|
150
|
+
"zoom:automatic"
|
|
151
|
+
] }
|
|
152
|
+
]
|
|
153
|
+
};
|
|
154
|
+
const pageSettingsMenu = {
|
|
155
|
+
id: "page-settings",
|
|
156
|
+
sections: [
|
|
157
|
+
{
|
|
158
|
+
labelKey: "commands.spread.group",
|
|
159
|
+
items: [
|
|
160
|
+
"spread:none",
|
|
161
|
+
"spread:odd",
|
|
162
|
+
"spread:even"
|
|
163
|
+
]
|
|
164
|
+
},
|
|
165
|
+
{
|
|
166
|
+
labelKey: "commands.scroll.group",
|
|
167
|
+
items: ["scroll:vertical", "scroll:horizontal"]
|
|
168
|
+
},
|
|
169
|
+
{
|
|
170
|
+
labelKey: "commands.rotate.group",
|
|
171
|
+
items: ["rotate:clockwise", "rotate:counter-clockwise"]
|
|
172
|
+
},
|
|
173
|
+
{ items: ["document:fullscreen"] }
|
|
174
|
+
]
|
|
175
|
+
};
|
|
176
|
+
const annotationStrip = {
|
|
177
|
+
id: "annotation-strip",
|
|
178
|
+
sections: { center: [group("annotation-actions", { importance: 4 }, [
|
|
179
|
+
"annotation:comment",
|
|
180
|
+
"annotation:style",
|
|
181
|
+
"annotation:link",
|
|
182
|
+
"annotation:goto-link",
|
|
183
|
+
"annotation:remove-link",
|
|
184
|
+
"annotation:group",
|
|
185
|
+
"annotation:ungroup"
|
|
186
|
+
]), group("annotation-danger", { importance: 5 }, ["annotation:delete"])] }
|
|
187
|
+
};
|
|
188
|
+
/**
|
|
189
|
+
* The DEFAULT chrome — exported as a VALUE, which is the whole customization
|
|
190
|
+
* model: consumers pass nothing and track this, transform it, or write their
|
|
191
|
+
* own. It is never merged with anything.
|
|
192
|
+
*/
|
|
193
|
+
const defaultChrome = defineChrome({
|
|
194
|
+
bars: { main: mainBar },
|
|
195
|
+
modeBars: {
|
|
196
|
+
"mode:annotate": annotateBar,
|
|
197
|
+
"mode:shapes": shapesBar,
|
|
198
|
+
"mode:insert": insertBar,
|
|
199
|
+
"mode:form": formBar,
|
|
200
|
+
"mode:redact": redactBar
|
|
201
|
+
},
|
|
202
|
+
menus: {
|
|
203
|
+
document: documentMenu,
|
|
204
|
+
zoom: zoomMenu,
|
|
205
|
+
"page-settings": pageSettingsMenu
|
|
206
|
+
},
|
|
207
|
+
strips: { annotation: annotationStrip }
|
|
208
|
+
});
|
|
209
|
+
/** Menu lookup by id (arbitrary string). */
|
|
210
|
+
function getMenu(schema, id) {
|
|
211
|
+
return schema.menus?.[id];
|
|
212
|
+
}
|
|
213
|
+
/** Secondary band lookup by mode-surface id. */
|
|
214
|
+
function getModeBar(schema, id) {
|
|
215
|
+
return schema.modeBars?.[id];
|
|
216
|
+
}
|
|
217
|
+
/** Contextual strip lookup by context id ('annotation', …). */
|
|
218
|
+
function getStrip(schema, id) {
|
|
219
|
+
return schema.strips?.[id];
|
|
220
|
+
}
|
|
221
|
+
//#endregion
|
|
222
|
+
export { defaultChrome, getMenu, getModeBar, getStrip };
|
|
223
|
+
|
|
224
|
+
//# sourceMappingURL=chrome.js.map
|
|
@@ -0,0 +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,YA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