@shadow-garden/bapbong-ui 0.14.0 → 0.16.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.
@@ -0,0 +1,44 @@
1
+ import type { EqNode, VectorImageSpec } from '@shadow-garden/bapbong-contracts';
2
+ /** One entry of the built-in gallery: a name and the equation it inserts. */
3
+ export interface BuiltInEquation {
4
+ name: string;
5
+ ast: EqNode[];
6
+ }
7
+ /**
8
+ * The built-in equations Insert ▸ Equation offers, the way Word's gallery
9
+ * does. Chosen for the documents bapbong is actually used on — Vietnamese
10
+ * exam papers — so the list is the secondary-school canon, not Word's
11
+ * (Fourier series has no place in a year-12 paper). Each is a real AST: what
12
+ * lands in the document is editable, exports as m:oMath, and needs no
13
+ * conversion.
14
+ */
15
+ export declare const BUILT_IN_EQUATIONS: readonly BuiltInEquation[];
16
+ /**
17
+ * A typeset equation drawn as inline SVG — the SAME display list the canvas
18
+ * painter replays, so a preview is the drawing the page will show rather
19
+ * than an approximation of it. Pure geometry from contracts: this package
20
+ * still knows nothing about the layout engine (the caller typesets and
21
+ * hands the spec over).
22
+ */
23
+ export declare function equationPreviewSvg(spec: VectorImageSpec, opts?: {
24
+ maxWidth?: number;
25
+ }): SVGSVGElement;
26
+ export interface EquationGalleryOptions {
27
+ /** Entries to offer. Defaults to {@link BUILT_IN_EQUATIONS}. */
28
+ items?: readonly BuiltInEquation[];
29
+ /**
30
+ * Typesets one entry the way the document does — hosts pass the layout
31
+ * engine bound to the editor's own measurer, so a preview matches the
32
+ * page exactly. Without it the preview falls back to the equation's
33
+ * linear spelling.
34
+ */
35
+ layout?: (ast: EqNode[], sizePt: number) => VectorImageSpec | null;
36
+ /** A gallery entry was chosen — insert this equation. */
37
+ onPick: (ast: EqNode[]) => void;
38
+ /** The footer action: start an empty equation instead. */
39
+ onNew: () => void;
40
+ /** Shortcut hint shown beside the footer action (e.g. "⌥="). */
41
+ newShortcut?: string;
42
+ }
43
+ export declare function equationGallery(options: EquationGalleryOptions): HTMLElement;
44
+ //# sourceMappingURL=equation-gallery.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"equation-gallery.d.ts","sourceRoot":"","sources":["../../src/lib/equation-gallery.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,MAAM,EACN,eAAe,EAEhB,MAAM,kCAAkC,CAAC;AAI1C,6EAA6E;AAC7E,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,EAAE,CAAC;CACf;AAkBD;;;;;;;GAOG;AACH,eAAO,MAAM,kBAAkB,EAAE,SAAS,eAAe,EAqExD,CAAC;AAIF;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAChC,IAAI,EAAE,eAAe,EACrB,IAAI,GAAE;IAAE,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAO,GAC/B,aAAa,CAYf;AAiDD,MAAM,WAAW,sBAAsB;IACrC,gEAAgE;IAChE,KAAK,CAAC,EAAE,SAAS,eAAe,EAAE,CAAC;IACnC;;;;;OAKG;IACH,MAAM,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,EAAE,MAAM,EAAE,MAAM,KAAK,eAAe,GAAG,IAAI,CAAC;IACnE,yDAAyD;IACzD,MAAM,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;IAChC,0DAA0D;IAC1D,KAAK,EAAE,MAAM,IAAI,CAAC;IAClB,gEAAgE;IAChE,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AA8BD,wBAAgB,eAAe,CAAC,OAAO,EAAE,sBAAsB,GAAG,WAAW,CA6D5E"}
@@ -0,0 +1,33 @@
1
+ import type { EqNode, EqStructure, VectorImageSpec } from '@shadow-garden/bapbong-contracts';
2
+ export interface EquationPanelOptions {
3
+ /**
4
+ * Typesets one template the way the document would — the host passes the
5
+ * layout engine bound to the editor's measurer, so a preview is the
6
+ * drawing the page will show. Without it the structure grid falls back to
7
+ * plain labels.
8
+ */
9
+ layout?: (ast: EqNode[], sizePt: number) => VectorImageSpec | null;
10
+ /** A symbol was chosen — insert this character at the slot caret. */
11
+ onSymbol: (ch: string) => void;
12
+ /** A structure was chosen — insert this template at the slot caret. */
13
+ onStructure: (s: EqStructure) => void;
14
+ }
15
+ export interface EquationPanel {
16
+ /** The panel element. The caller positions it and shows/hides it. */
17
+ readonly el: HTMLElement;
18
+ /** Fold to the tab strip alone, or open again. */
19
+ setCollapsed(collapsed: boolean): void;
20
+ readonly collapsed: boolean;
21
+ destroy(): void;
22
+ }
23
+ /**
24
+ * The equation palette: Word's Symbols and Structures galleries as ONE
25
+ * floating surface with tabs inside it, rather than a bar that opens a
26
+ * separate flyout. Switching tabs then swaps the contents while the frame
27
+ * stays put — and inserting six symbols in a row costs no re-opening.
28
+ *
29
+ * Knows nothing about the editor: it reports a chosen symbol or template and
30
+ * the host hands that to the slot editor.
31
+ */
32
+ export declare function equationPanel(options: EquationPanelOptions): EquationPanel;
33
+ //# sourceMappingURL=equation-panel.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"equation-panel.d.ts","sourceRoot":"","sources":["../../src/lib/equation-panel.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,MAAM,EACN,WAAW,EACX,eAAe,EAChB,MAAM,kCAAkC,CAAC;AAS1C,MAAM,WAAW,oBAAoB;IACnC;;;;;OAKG;IACH,MAAM,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,EAAE,MAAM,EAAE,MAAM,KAAK,eAAe,GAAG,IAAI,CAAC;IACnE,qEAAqE;IACrE,QAAQ,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IAC/B,uEAAuE;IACvE,WAAW,EAAE,CAAC,CAAC,EAAE,WAAW,KAAK,IAAI,CAAC;CACvC;AAED,MAAM,WAAW,aAAa;IAC5B,qEAAqE;IACrE,QAAQ,CAAC,EAAE,EAAE,WAAW,CAAC;IACzB,kDAAkD;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,CA8MrE"}
1
+ {"version":3,"file":"link-panel.d.ts","sourceRoot":"","sources":["../../src/lib/link-panel.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;GAaG;AAEH,MAAM,WAAW,eAAe;IAC9B,uEAAuE;IACvE,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,eAAe,CAAC;IACxB,6EAA6E;IAC7E,QAAQ,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;IACjD;;;;;+CAK2C;IAC3C,QAAQ,CAAC,EAAE;QACT,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;QACrB,SAAS,EAAE,OAAO,CAAC;QACnB,IAAI,IAAI,IAAI,CAAC;KACd,GAAG,IAAI,CAAC;IACT;qBACiB;IACjB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB;;;+DAG2D;IAC3D,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,mEAAmE;IACnE,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3C,QAAQ,CAAC,IAAI,IAAI,CAAC;CACnB;AAED,MAAM,WAAW,eAAe;IAC9B,KAAK,IAAI,IAAI,CAAC;IACd;0EACsE;IACtE,MAAM,IAAI,OAAO,CAAC;CACnB;AAyDD,wBAAgB,aAAa,CAAC,IAAI,EAAE,gBAAgB,GAAG,eAAe,CA+MrE"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shadow-garden/bapbong-ui",
3
- "version": "0.14.0",
3
+ "version": "0.16.0",
4
4
  "description": "bapbong — framework-agnostic editor UI (toolbar/menubar) that mounts into a host element and binds to editor.commands",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -56,6 +56,6 @@
56
56
  }
57
57
  },
58
58
  "dependencies": {
59
- "@shadow-garden/bapbong-contracts": "^0.13.0"
59
+ "@shadow-garden/bapbong-contracts": "^0.15.0"
60
60
  }
61
61
  }