@damiro/stylo 0.4.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 +21 -0
- package/README.md +144 -0
- package/dist/InPlaceView-Ba7JCZ2Y.js +2346 -0
- package/dist/InPlaceView-Ba7JCZ2Y.js.map +1 -0
- package/dist/Preview-Dxb9zPVv.js +93 -0
- package/dist/Preview-Dxb9zPVv.js.map +1 -0
- package/dist/SplitView.d.ts +23 -0
- package/dist/SplitView.d.ts.map +1 -0
- package/dist/Stylo.d.ts +15 -0
- package/dist/Stylo.d.ts.map +1 -0
- package/dist/callout-oLE630ZP.js +37 -0
- package/dist/callout-oLE630ZP.js.map +1 -0
- package/dist/callout.d.ts +18 -0
- package/dist/callout.d.ts.map +1 -0
- package/dist/config-DTBxVhtH.js +101 -0
- package/dist/config-DTBxVhtH.js.map +1 -0
- package/dist/editor/SourceView.d.ts +17 -0
- package/dist/editor/SourceView.d.ts.map +1 -0
- package/dist/editor/extensions.d.ts +20 -0
- package/dist/editor/extensions.d.ts.map +1 -0
- package/dist/editor/highlight.d.ts +19 -0
- package/dist/editor/highlight.d.ts.map +1 -0
- package/dist/editor/save.d.ts +12 -0
- package/dist/editor/save.d.ts.map +1 -0
- package/dist/editor/theme.d.ts +3 -0
- package/dist/editor/theme.d.ts.map +1 -0
- package/dist/editor/useCodeMirror.d.ts +26 -0
- package/dist/editor/useCodeMirror.d.ts.map +1 -0
- package/dist/frontmatter.d.ts +21 -0
- package/dist/frontmatter.d.ts.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/inplace/InPlaceView.d.ts +30 -0
- package/dist/inplace/InPlaceView.d.ts.map +1 -0
- package/dist/inplace/autoformat.d.ts +23 -0
- package/dist/inplace/autoformat.d.ts.map +1 -0
- package/dist/inplace/config.d.ts +57 -0
- package/dist/inplace/config.d.ts.map +1 -0
- package/dist/inplace/context-menu-actions.d.ts +53 -0
- package/dist/inplace/context-menu-actions.d.ts.map +1 -0
- package/dist/inplace/context-menu.d.ts +50 -0
- package/dist/inplace/context-menu.d.ts.map +1 -0
- package/dist/inplace/decorate.d.ts +17 -0
- package/dist/inplace/decorate.d.ts.map +1 -0
- package/dist/inplace/edit-boundaries.d.ts +59 -0
- package/dist/inplace/edit-boundaries.d.ts.map +1 -0
- package/dist/inplace/edit-insert-assoc.d.ts +17 -0
- package/dist/inplace/edit-insert-assoc.d.ts.map +1 -0
- package/dist/inplace/edit-line-prefix.d.ts +23 -0
- package/dist/inplace/edit-line-prefix.d.ts.map +1 -0
- package/dist/inplace/extension.d.ts +21 -0
- package/dist/inplace/extension.d.ts.map +1 -0
- package/dist/inplace/frontmatter.d.ts +13 -0
- package/dist/inplace/frontmatter.d.ts.map +1 -0
- package/dist/inplace/inline-md.d.ts +13 -0
- package/dist/inplace/inline-md.d.ts.map +1 -0
- package/dist/inplace/lazyInPlace.d.ts +7 -0
- package/dist/inplace/lazyInPlace.d.ts.map +1 -0
- package/dist/inplace/link-click.d.ts +24 -0
- package/dist/inplace/link-click.d.ts.map +1 -0
- package/dist/inplace/link-hover.d.ts +11 -0
- package/dist/inplace/link-hover.d.ts.map +1 -0
- package/dist/inplace/list-guides.d.ts +16 -0
- package/dist/inplace/list-guides.d.ts.map +1 -0
- package/dist/inplace/long-press.d.ts +39 -0
- package/dist/inplace/long-press.d.ts.map +1 -0
- package/dist/inplace/math.d.ts +16 -0
- package/dist/inplace/math.d.ts.map +1 -0
- package/dist/inplace/menu-plugin.d.ts +30 -0
- package/dist/inplace/menu-plugin.d.ts.map +1 -0
- package/dist/inplace/nodes.d.ts +24 -0
- package/dist/inplace/nodes.d.ts.map +1 -0
- package/dist/inplace/plugin.d.ts +21 -0
- package/dist/inplace/plugin.d.ts.map +1 -0
- package/dist/inplace/reveal.d.ts +8 -0
- package/dist/inplace/reveal.d.ts.map +1 -0
- package/dist/inplace/scan.d.ts +11 -0
- package/dist/inplace/scan.d.ts.map +1 -0
- package/dist/inplace/selection-bar.d.ts +38 -0
- package/dist/inplace/selection-bar.d.ts.map +1 -0
- package/dist/inplace/table-cell-dom.d.ts +30 -0
- package/dist/inplace/table-cell-dom.d.ts.map +1 -0
- package/dist/inplace/table-enter.d.ts +22 -0
- package/dist/inplace/table-enter.d.ts.map +1 -0
- package/dist/inplace/table-gizmos.d.ts +55 -0
- package/dist/inplace/table-gizmos.d.ts.map +1 -0
- package/dist/inplace/table-structure.d.ts +23 -0
- package/dist/inplace/table-structure.d.ts.map +1 -0
- package/dist/inplace/table-widget.d.ts +81 -0
- package/dist/inplace/table-widget.d.ts.map +1 -0
- package/dist/inplace/tables.d.ts +8 -0
- package/dist/inplace/tables.d.ts.map +1 -0
- package/dist/inplace/theme.d.ts +14 -0
- package/dist/inplace/theme.d.ts.map +1 -0
- package/dist/inplace/widgets.d.ts +25 -0
- package/dist/inplace/widgets.d.ts.map +1 -0
- package/dist/inplace/wikilinks.d.ts +10 -0
- package/dist/inplace/wikilinks.d.ts.map +1 -0
- package/dist/katex-BfiLlqfN.js +21979 -0
- package/dist/katex-BfiLlqfN.js.map +1 -0
- package/dist/katex.css +3 -0
- package/dist/markdown-N3lRmU2n.js +8524 -0
- package/dist/markdown-N3lRmU2n.js.map +1 -0
- package/dist/render/Preview.d.ts +10 -0
- package/dist/render/Preview.d.ts.map +1 -0
- package/dist/render/lazyPreview.d.ts +8 -0
- package/dist/render/lazyPreview.d.ts.map +1 -0
- package/dist/render/remark-callout.d.ts +10 -0
- package/dist/render/remark-callout.d.ts.map +1 -0
- package/dist/render/remark-wikilink.d.ts +8 -0
- package/dist/render/remark-wikilink.d.ts.map +1 -0
- package/dist/styles.css +2 -0
- package/dist/stylo.js +293 -0
- package/dist/stylo.js.map +1 -0
- package/dist/toolbar/Toolbar.d.ts +28 -0
- package/dist/toolbar/Toolbar.d.ts.map +1 -0
- package/dist/toolbar/block.d.ts +56 -0
- package/dist/toolbar/block.d.ts.map +1 -0
- package/dist/toolbar/cell-inline.d.ts +16 -0
- package/dist/toolbar/cell-inline.d.ts.map +1 -0
- package/dist/toolbar/commands.d.ts +25 -0
- package/dist/toolbar/commands.d.ts.map +1 -0
- package/dist/toolbar/config.d.ts +21 -0
- package/dist/toolbar/config.d.ts.map +1 -0
- package/dist/toolbar/fence.d.ts +28 -0
- package/dist/toolbar/fence.d.ts.map +1 -0
- package/dist/toolbar/floating-watchdog.d.ts +18 -0
- package/dist/toolbar/floating-watchdog.d.ts.map +1 -0
- package/dist/toolbar/icon-paths.d.ts +10 -0
- package/dist/toolbar/icon-paths.d.ts.map +1 -0
- package/dist/toolbar/icons.d.ts +10 -0
- package/dist/toolbar/icons.d.ts.map +1 -0
- package/dist/toolbar/inline-ops.d.ts +101 -0
- package/dist/toolbar/inline-ops.d.ts.map +1 -0
- package/dist/toolbar/inline.d.ts +38 -0
- package/dist/toolbar/inline.d.ts.map +1 -0
- package/dist/toolbar/keyboard-inset.d.ts +10 -0
- package/dist/toolbar/keyboard-inset.d.ts.map +1 -0
- package/dist/toolbar/keymap.d.ts +8 -0
- package/dist/toolbar/keymap.d.ts.map +1 -0
- package/dist/toolbar/labels.d.ts +16 -0
- package/dist/toolbar/labels.d.ts.map +1 -0
- package/dist/toolbar/table-grid.d.ts +23 -0
- package/dist/toolbar/table-grid.d.ts.map +1 -0
- package/dist/toolbar/table.d.ts +35 -0
- package/dist/toolbar/table.d.ts.map +1 -0
- package/dist/toolbar-settings/SortableRow.d.ts +15 -0
- package/dist/toolbar-settings/SortableRow.d.ts.map +1 -0
- package/dist/toolbar-settings/StyloToolbarSettings.d.ts +29 -0
- package/dist/toolbar-settings/StyloToolbarSettings.d.ts.map +1 -0
- package/dist/toolbar-settings/index.d.ts +3 -0
- package/dist/toolbar-settings/index.d.ts.map +1 -0
- package/dist/toolbar-settings/items.d.ts +24 -0
- package/dist/toolbar-settings/items.d.ts.map +1 -0
- package/dist/toolbar-settings.js +269 -0
- package/dist/toolbar-settings.js.map +1 -0
- package/dist/types.d.ts +264 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/useCodeMirror-YnIFkvKn.js +1361 -0
- package/dist/useCodeMirror-YnIFkvKn.js.map +1 -0
- package/dist/wikilink-BFpTehto.js +42 -0
- package/dist/wikilink-BFpTehto.js.map +1 -0
- package/dist/wikilink.d.ts +11 -0
- package/dist/wikilink.d.ts.map +1 -0
- package/package.json +122 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fence.d.ts","sourceRoot":"","sources":["../../src/toolbar/fence.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AACpD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAYlD;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,CA0B1D;AAED,iEAAiE;AACjE,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,WAAW,GAAG,OAAO,CAE5D;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,WAAW,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,EAAE,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAQjG;AA2BD;;;GAGG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,CA4BzD;AAED,+DAA+D;AAC/D,wBAAgB,eAAe,CAAC,KAAK,EAAE,WAAW,GAAG,OAAO,CAE3D"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { type RefObject } from "react";
|
|
2
|
+
/**
|
|
3
|
+
* Continuously re-asserts a `transform` on a `position: fixed` element,
|
|
4
|
+
* alternating an imperceptible sub-pixel jitter every animation frame,
|
|
5
|
+
* instead of trusting the browser to keep it correctly composited on its
|
|
6
|
+
* own. Several rounds of on-device testing found iOS Safari losing track of
|
|
7
|
+
* this exact kind of element — across its own address-bar animation, and in
|
|
8
|
+
* at least one report tied to the keyboard opening — in ways a one-time
|
|
9
|
+
* static fix (a plain `translateZ(0)`) did not reliably prevent. A value
|
|
10
|
+
* that never changes gives the browser nothing to recompute; alternating it
|
|
11
|
+
* every frame forces a fresh compositor pass regardless of what triggered
|
|
12
|
+
* the drift, so it can't stay wrong for more than one frame (~16ms).
|
|
13
|
+
*
|
|
14
|
+
* Writes to the DOM directly rather than through React state, so this never
|
|
15
|
+
* causes a re-render — the transform is the only thing touched.
|
|
16
|
+
*/
|
|
17
|
+
export declare function useFloatingWatchdog(ref: RefObject<HTMLElement | null>, enabled: boolean): void;
|
|
18
|
+
//# sourceMappingURL=floating-watchdog.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"floating-watchdog.d.ts","sourceRoot":"","sources":["../../src/toolbar/floating-watchdog.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,KAAK,SAAS,EAAE,MAAM,OAAO,CAAA;AAEjD;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,EAAE,OAAO,EAAE,OAAO,GAAG,IAAI,CAgB9F"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Single source of truth for the built-in glyphs: 24×24 stroke-path data,
|
|
3
|
+
* segments joined by "|". Consumed by the React toolbar (`icons.tsx`), the
|
|
4
|
+
* in-place selection bar, and the in-place right-click menu, so none of them
|
|
5
|
+
* carries its own copy.
|
|
6
|
+
*/
|
|
7
|
+
export declare const ICON_PATHS: Record<string, string>;
|
|
8
|
+
/** Build a stroke `<svg>` for `d` (as an `ICON_PATHS` value) as detached DOM. */
|
|
9
|
+
export declare function iconSvg(doc: Document, d: string): SVGElement;
|
|
10
|
+
//# sourceMappingURL=icon-paths.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"icon-paths.d.ts","sourceRoot":"","sources":["../../src/toolbar/icon-paths.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,eAAO,MAAM,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CA+B7C,CAAA;AAID,iFAAiF;AACjF,wBAAgB,OAAO,CAAC,GAAG,EAAE,QAAQ,EAAE,CAAC,EAAE,MAAM,GAAG,UAAU,CAc5D"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
import type { ToolbarCommandId } from "../types";
|
|
3
|
+
/**
|
|
4
|
+
* Built-in glyphs — the fallback when the consumer passes no `icons` override
|
|
5
|
+
* for an id. Inline SVG only; no icon package in the dependency tree (ADR-002
|
|
6
|
+
* §4). Path data is shared with the in-place UI via `./icon-paths`. Headings
|
|
7
|
+
* render as text so the level reads at a glance.
|
|
8
|
+
*/
|
|
9
|
+
export declare const DEFAULT_ICONS: Record<ToolbarCommandId, ReactNode>;
|
|
10
|
+
//# sourceMappingURL=icons.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"icons.d.ts","sourceRoot":"","sources":["../../src/toolbar/icons.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AACtC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAA;AAqBhD;;;;;GAKG;AACH,eAAO,MAAM,aAAa,EAAE,MAAM,CAAC,gBAAgB,EAAE,SAAS,CA0B7D,CAAA"}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
/** Regex-escape a literal so it can be spliced into a pattern. */
|
|
2
|
+
export declare function esc(s: string): string;
|
|
3
|
+
/** The characters that can stack as inline marks around a span. */
|
|
4
|
+
export declare const MARK_CHARS = "*~`$";
|
|
5
|
+
/** Non-overlapping edits plus the selection (post-edit coordinates) to follow. */
|
|
6
|
+
export interface InlineOp {
|
|
7
|
+
changes: {
|
|
8
|
+
from: number;
|
|
9
|
+
to: number;
|
|
10
|
+
insert: string;
|
|
11
|
+
}[];
|
|
12
|
+
from: number;
|
|
13
|
+
to: number;
|
|
14
|
+
}
|
|
15
|
+
/** A rewritten string plus the selection that should follow it. */
|
|
16
|
+
export interface InlineStr {
|
|
17
|
+
text: string;
|
|
18
|
+
from: number;
|
|
19
|
+
to: number;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Toggle an inline wrapping mark (`**`, `*`, `~~`, `` ` ``, `$`) around `[from,
|
|
23
|
+
* to)` of `text`: unwrap a span already wrapped (marks inside or just around the
|
|
24
|
+
* selection), else wrap it; an empty range gets an empty pair. Applying `*` to
|
|
25
|
+
* `**bold**` (or `**` to `*em*`) nests rather than eating a marker.
|
|
26
|
+
*/
|
|
27
|
+
export declare function wrapOp(text: string, from: number, to: number, mark: string): InlineOp;
|
|
28
|
+
/** Apply non-overlapping {@link InlineOp} changes to a string (right to left). */
|
|
29
|
+
export declare function applyChanges(text: string, changes: {
|
|
30
|
+
from: number;
|
|
31
|
+
to: number;
|
|
32
|
+
insert: string;
|
|
33
|
+
}[]): string;
|
|
34
|
+
/** {@link wrapOp} resolved against a plain string — for editing one table cell. */
|
|
35
|
+
export declare function wrapString(text: string, from: number, to: number, mark: string): InlineStr;
|
|
36
|
+
/**
|
|
37
|
+
* The span a right-click in a table cell should select so a Format toggle lands
|
|
38
|
+
* cleanly: the text between the delimiters for an inline mark run
|
|
39
|
+
* (`**bold phrase**`, `*em*`, `~~strike~~`, `` `code` ``), but the *whole*
|
|
40
|
+
* construct for a `[label](url)` link or `[[target|label]]` wikilink — its label
|
|
41
|
+
* is not a Markdown context, so Bold must wrap the link, not sit inside it.
|
|
42
|
+
* Returns `null` when `pos` is not in any run. Mirrors `wrapAt` on the canvas.
|
|
43
|
+
*/
|
|
44
|
+
export declare function markedContentAt(text: string, pos: number): {
|
|
45
|
+
from: number;
|
|
46
|
+
to: number;
|
|
47
|
+
} | null;
|
|
48
|
+
/** The `[text](url)` span of `text` covering `head`, or `null`. */
|
|
49
|
+
export declare function linkAtIn(text: string, head: number): {
|
|
50
|
+
from: number;
|
|
51
|
+
to: number;
|
|
52
|
+
label: string;
|
|
53
|
+
} | null;
|
|
54
|
+
/**
|
|
55
|
+
* Like {@link linkAtIn} but also breaks out the URL and its `[from, to)` span
|
|
56
|
+
* within `text`, for editing just the `(…)` part in place.
|
|
57
|
+
*/
|
|
58
|
+
export declare function linkPartsIn(text: string, head: number): {
|
|
59
|
+
from: number;
|
|
60
|
+
to: number;
|
|
61
|
+
label: string;
|
|
62
|
+
url: string;
|
|
63
|
+
urlFrom: number;
|
|
64
|
+
urlTo: number;
|
|
65
|
+
} | null;
|
|
66
|
+
/** Toggle `[text](url)` around `[from, to)` of `text` — wrap, or unlink to the label. */
|
|
67
|
+
export declare function linkString(text: string, from: number, to: number): InlineStr;
|
|
68
|
+
/** The `<u>…</u>` span of `text` covering `head` (case-insensitive), or `null`. */
|
|
69
|
+
export declare function underlineAtIn(text: string, head: number): {
|
|
70
|
+
from: number;
|
|
71
|
+
to: number;
|
|
72
|
+
inner: string;
|
|
73
|
+
} | null;
|
|
74
|
+
/**
|
|
75
|
+
* Toggle `<u>…</u>` around `[from, to)` of `text`. Markdown has no underline, so
|
|
76
|
+
* this is a raw HTML tag pair — it renders wherever the host renders inline HTML
|
|
77
|
+
* (Obsidian, GitHub). Wrap the slice, or unwrap a span the caret is already in
|
|
78
|
+
* to its inner text.
|
|
79
|
+
*/
|
|
80
|
+
export declare function underlineString(text: string, from: number, to: number): InlineStr;
|
|
81
|
+
/** The `[[target|label]]` span of `text` covering `head`, or `null`. */
|
|
82
|
+
export declare function wikiLinkAtIn(text: string, head: number): {
|
|
83
|
+
from: number;
|
|
84
|
+
to: number;
|
|
85
|
+
label: string;
|
|
86
|
+
} | null;
|
|
87
|
+
/**
|
|
88
|
+
* Like {@link wikiLinkAtIn} but also breaks out the target and its `[from, to)`
|
|
89
|
+
* span within `text`, for editing just the `[[…]]` target in place.
|
|
90
|
+
*/
|
|
91
|
+
export declare function wikiLinkPartsIn(text: string, head: number): {
|
|
92
|
+
from: number;
|
|
93
|
+
to: number;
|
|
94
|
+
target: string;
|
|
95
|
+
label: string;
|
|
96
|
+
targetFrom: number;
|
|
97
|
+
targetTo: number;
|
|
98
|
+
} | null;
|
|
99
|
+
/** Toggle `[[target]]` around `[from, to)` of `text` — wrap, or unwrap to the display text. */
|
|
100
|
+
export declare function wikiLinkString(text: string, from: number, to: number): InlineStr;
|
|
101
|
+
//# sourceMappingURL=inline-ops.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inline-ops.d.ts","sourceRoot":"","sources":["../../src/toolbar/inline-ops.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { EditorState } from "@codemirror/state";
|
|
2
|
+
import type { EditorView } from "@codemirror/view";
|
|
3
|
+
/**
|
|
4
|
+
* Toggle an inline wrapping mark (`**`, `*`, `~~`, `` ` ``, `$`) around each
|
|
5
|
+
* selection range. A range already wrapped — whether the marks are inside or
|
|
6
|
+
* around the selection — is unwrapped; an empty range gets an empty pair with
|
|
7
|
+
* the caret parked between the marks. Applying `*` to `**bold**` (or `**` to
|
|
8
|
+
* `*em*`) nests rather than eating a marker. The edit logic lives in
|
|
9
|
+
* {@link wrapOp}; this binds it to the view's selection(s).
|
|
10
|
+
*/
|
|
11
|
+
export declare function toggleWrap(view: EditorView, mark: string): boolean;
|
|
12
|
+
/** True when the primary selection sits within a `mark…mark` span on its line. */
|
|
13
|
+
export declare function wrapActive(state: EditorState, mark: string): boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Wrap the selection as `[text](url)` with the `url` placeholder selected — or,
|
|
16
|
+
* when the caret is already in a link, unlink it: the label text stays, the
|
|
17
|
+
* `](url)` wrapper goes.
|
|
18
|
+
*/
|
|
19
|
+
export declare function toggleLink(view: EditorView): boolean;
|
|
20
|
+
/** True when the primary caret sits inside a `[…](…)` span on its line. */
|
|
21
|
+
export declare function linkActive(state: EditorState): boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Wrap the selection as `[[target]]` with the target text selected — or, when
|
|
24
|
+
* the caret is already in a wikilink, unwrap it: the display text (the label if
|
|
25
|
+
* there is one, else the target) stays, the `[[ … ]]` and any `|label` go.
|
|
26
|
+
*/
|
|
27
|
+
export declare function toggleWikiLink(view: EditorView): boolean;
|
|
28
|
+
/** True when the primary caret sits inside a `[[…]]` span on its line. */
|
|
29
|
+
export declare function wikiLinkActive(state: EditorState): boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Wrap the selection in `<u>…</u>` — a raw HTML tag pair, since Markdown has no
|
|
32
|
+
* underline. With the caret already inside a `<u>` span, unwrap it: the inner
|
|
33
|
+
* text stays, the tags go.
|
|
34
|
+
*/
|
|
35
|
+
export declare function toggleUnderline(view: EditorView): boolean;
|
|
36
|
+
/** True when the primary caret sits inside a `<u>…</u>` span on its line. */
|
|
37
|
+
export declare function underlineActive(state: EditorState): boolean;
|
|
38
|
+
//# sourceMappingURL=inline.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inline.d.ts","sourceRoot":"","sources":["../../src/toolbar/inline.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AACpD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAGlD;;;;;;;GAOG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAiBlE;AAED,kFAAkF;AAClF,wBAAgB,UAAU,CAAC,KAAK,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAiBpE;AAUD;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,CAqBpD;AAED,2EAA2E;AAC3E,wBAAgB,UAAU,CAAC,KAAK,EAAE,WAAW,GAAG,OAAO,CAEtD;AAUD;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,CAoBxD;AAED,0EAA0E;AAC1E,wBAAgB,cAAc,CAAC,KAAK,EAAE,WAAW,GAAG,OAAO,CAE1D;AAUD;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,CAoBzD;AAED,6EAA6E;AAC7E,wBAAgB,eAAe,CAAC,KAAK,EAAE,WAAW,GAAG,OAAO,CAE3D"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* How far the on-screen keyboard eats into the window, tracked through the
|
|
3
|
+
* `visualViewport` API. 0 when `enabled` is false or the browser has no
|
|
4
|
+
* `visualViewport` (older Safari, SSR, most desktop browsers). A mobile
|
|
5
|
+
* keyboard shrinks the *visual* viewport, not the layout viewport a plain
|
|
6
|
+
* `position: fixed` bottom offset is computed against — this is what lets the
|
|
7
|
+
* sticky toolbar ride up above the keyboard instead of hiding behind it.
|
|
8
|
+
*/
|
|
9
|
+
export declare function useKeyboardInset(enabled: boolean): number;
|
|
10
|
+
//# sourceMappingURL=keyboard-inset.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"keyboard-inset.d.ts","sourceRoot":"","sources":["../../src/toolbar/keyboard-inset.ts"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,OAAO,GAAG,MAAM,CAoBzD"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Formatting shortcuts (ADR-002 §5): `Mod-b` / `Mod-i` bold and italic,
|
|
3
|
+
* `Mod-k` link, `Mod-Alt-1..3` headings. Bound on every CodeMirror surface
|
|
4
|
+
* whether or not the visible toolbar is mounted. Undo/redo stay with
|
|
5
|
+
* `historyKeymap`, so no command that declares no keys is included here.
|
|
6
|
+
*/
|
|
7
|
+
export declare const markdownKeymap: import("@codemirror/state").Extension;
|
|
8
|
+
//# sourceMappingURL=keymap.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"keymap.d.ts","sourceRoot":"","sources":["../../src/toolbar/keymap.ts"],"names":[],"mappings":"AAIA;;;;;GAKG;AACH,eAAO,MAAM,cAAc,uCAU1B,CAAA"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { ToolbarCommandId } from "../types";
|
|
2
|
+
/**
|
|
3
|
+
* Display labels for the built-in command ids — the single source of truth for
|
|
4
|
+
* the button title / accessible name. `commands.ts` owns the *behaviour* of each
|
|
5
|
+
* command and imports CodeMirror to do it; this module is pure data, so surfaces
|
|
6
|
+
* that only need to *name* a command (the toolbar customizer, docs tooling) can
|
|
7
|
+
* import it without pulling the editor in.
|
|
8
|
+
*
|
|
9
|
+
* `test/toolbar-settings.test.tsx` asserts these stay in step with
|
|
10
|
+
* `BUILTIN_COMMANDS` — a renamed command title there without a change here fails
|
|
11
|
+
* the build.
|
|
12
|
+
*/
|
|
13
|
+
export declare const BUILTIN_LABELS: Record<ToolbarCommandId, string>;
|
|
14
|
+
/** Every built-in command id, in the canonical order labels are declared above. */
|
|
15
|
+
export declare const ALL_BUILTIN_IDS: ToolbarCommandId[];
|
|
16
|
+
//# sourceMappingURL=labels.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"labels.d.ts","sourceRoot":"","sources":["../../src/toolbar/labels.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAA;AAEhD;;;;;;;;;;GAUG;AACH,eAAO,MAAM,cAAc,EAAE,MAAM,CAAC,gBAAgB,EAAE,MAAM,CA0B3D,CAAA;AAED,mFAAmF;AACnF,eAAO,MAAM,eAAe,EAAkC,gBAAgB,EAAE,CAAA"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export type Align = "" | "left" | "center" | "right";
|
|
2
|
+
export interface Grid {
|
|
3
|
+
/** Content rows, header first. The delimiter row is not included. */
|
|
4
|
+
rows: string[][];
|
|
5
|
+
aligns: Align[];
|
|
6
|
+
}
|
|
7
|
+
/** A GFM delimiter row: only pipes, dashes, colons, spaces, and at least one dash. */
|
|
8
|
+
export declare function isDelimiterLine(line: string): boolean;
|
|
9
|
+
/** Split a table row on unescaped `|`, dropping one outer pipe each side. */
|
|
10
|
+
export declare function splitRow(line: string): string[];
|
|
11
|
+
/** Parse the raw lines of a table (delimiter expected at index 1). */
|
|
12
|
+
export declare function parseGrid(lines: string[]): Grid | null;
|
|
13
|
+
/** Serialize a grid to an aligned pipe table — deterministic and idempotent. */
|
|
14
|
+
export declare function serializeGrid(grid: Grid): string;
|
|
15
|
+
export interface CellSpan {
|
|
16
|
+
start: number;
|
|
17
|
+
contentStart: number;
|
|
18
|
+
contentEnd: number;
|
|
19
|
+
end: number;
|
|
20
|
+
}
|
|
21
|
+
/** The `|`-delimited cell spans of a line (positions relative to line start). */
|
|
22
|
+
export declare function cellBounds(line: string): CellSpan[];
|
|
23
|
+
//# sourceMappingURL=table-grid.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"table-grid.d.ts","sourceRoot":"","sources":["../../src/toolbar/table-grid.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,KAAK,GAAG,EAAE,GAAG,MAAM,GAAG,QAAQ,GAAG,OAAO,CAAA;AAEpD,MAAM,WAAW,IAAI;IACnB,qEAAqE;IACrE,IAAI,EAAE,MAAM,EAAE,EAAE,CAAA;IAChB,MAAM,EAAE,KAAK,EAAE,CAAA;CAChB;AAED,sFAAsF;AACtF,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAGrD;AAED,6EAA6E;AAC7E,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAmB/C;AASD,sEAAsE;AACtE,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,IAAI,GAAG,IAAI,CAatD;AA0BD,gFAAgF;AAChF,wBAAgB,aAAa,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM,CAchD;AAED,MAAM,WAAW,QAAQ;IACvB,KAAK,EAAE,MAAM,CAAA;IACb,YAAY,EAAE,MAAM,CAAA;IACpB,UAAU,EAAE,MAAM,CAAA;IAClB,GAAG,EAAE,MAAM,CAAA;CACZ;AAED,iFAAiF;AACjF,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,QAAQ,EAAE,CAmBnD"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { EditorState, type Extension, type Text } from "@codemirror/state";
|
|
2
|
+
import type { EditorView } from "@codemirror/view";
|
|
3
|
+
interface Region {
|
|
4
|
+
from: number;
|
|
5
|
+
to: number;
|
|
6
|
+
lines: string[];
|
|
7
|
+
}
|
|
8
|
+
/** The contiguous pipe-table block containing `pos`, if it parses as a table. */
|
|
9
|
+
export declare function findTable(doc: Text, pos: number): Region | null;
|
|
10
|
+
/**
|
|
11
|
+
* Document position of the start of a table cell's content, for the pipe table
|
|
12
|
+
* that contains `tableFrom`. `row` is the content-row index (header = 0, first
|
|
13
|
+
* body row = 1, …); the delimiter row is not counted. Used to land the caret in
|
|
14
|
+
* the clicked cell when a rendered in-place table reveals its source.
|
|
15
|
+
*/
|
|
16
|
+
export declare function cellSourcePos(doc: Text, tableFrom: number, row: number, col: number): number | null;
|
|
17
|
+
/** Insert a starter table at the cursor and select the first header cell. */
|
|
18
|
+
export declare function insertTable(view: EditorView): boolean;
|
|
19
|
+
/** True when the primary caret is inside a pipe table. */
|
|
20
|
+
export declare function tableActive(state: EditorState): boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Table editing keys, live only when the caret is inside a pipe table:
|
|
23
|
+
* Tab / Shift-Tab walk the cells (Tab past the end adds a row), Enter drops to
|
|
24
|
+
* the cell below (adding a row at the bottom). Every move re-aligns the grid.
|
|
25
|
+
* Outside a table the bindings return false, so normal Tab / Enter are intact.
|
|
26
|
+
*/
|
|
27
|
+
export declare const tableKeymap: Extension;
|
|
28
|
+
/**
|
|
29
|
+
* Live pipe alignment. On every typing / deletion transaction whose caret ends
|
|
30
|
+
* up inside a table, the grid is re-serialized and the change composed into the
|
|
31
|
+
* same transaction (one undo step). Idempotent, so it does not re-trigger.
|
|
32
|
+
*/
|
|
33
|
+
export declare const tableRealign: Extension;
|
|
34
|
+
export {};
|
|
35
|
+
//# sourceMappingURL=table.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"table.d.ts","sourceRoot":"","sources":["../../src/toolbar/table.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,WAAW,EACX,KAAK,SAAS,EACd,KAAK,IAAI,EACV,MAAM,mBAAmB,CAAA;AAE1B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAGlD,UAAU,MAAM;IACd,IAAI,EAAE,MAAM,CAAA;IACZ,EAAE,EAAE,MAAM,CAAA;IACV,KAAK,EAAE,MAAM,EAAE,CAAA;CAChB;AAED,iFAAiF;AACjF,wBAAgB,SAAS,CAAC,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAoB/D;AA8CD;;;;;GAKG;AACH,wBAAgB,aAAa,CAC3B,GAAG,EAAE,IAAI,EACT,SAAS,EAAE,MAAM,EACjB,GAAG,EAAE,MAAM,EACX,GAAG,EAAE,MAAM,GACV,MAAM,GAAG,IAAI,CAIf;AAuCD,6EAA6E;AAC7E,wBAAgB,WAAW,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,CAarD;AAED,0DAA0D;AAC1D,wBAAgB,WAAW,CAAC,KAAK,EAAE,WAAW,GAAG,OAAO,CAEvD;AA2CD;;;;;GAKG;AACH,eAAO,MAAM,WAAW,EAAE,SAIxB,CAAA;AAEF;;;;GAIG;AACH,eAAO,MAAM,YAAY,EAAE,SAqBzB,CAAA"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
/**
|
|
3
|
+
* One draggable row in the "On the bar" list. The drag handle carries the
|
|
4
|
+
* `@dnd-kit` listeners (pointer and keyboard), so the row's own action buttons
|
|
5
|
+
* stay independently focusable and clickable.
|
|
6
|
+
*/
|
|
7
|
+
export declare function SortableRow({ id, label, icon, position, count, actions, }: {
|
|
8
|
+
id: string;
|
|
9
|
+
label: string;
|
|
10
|
+
icon: ReactNode;
|
|
11
|
+
position: number;
|
|
12
|
+
count: number;
|
|
13
|
+
actions: ReactNode;
|
|
14
|
+
}): import("react").JSX.Element;
|
|
15
|
+
//# sourceMappingURL=SortableRow.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SortableRow.d.ts","sourceRoot":"","sources":["../../src/toolbar-settings/SortableRow.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAKtC;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,EAC1B,EAAE,EACF,KAAK,EACL,IAAI,EACJ,QAAQ,EACR,KAAK,EACL,OAAO,GACR,EAAE;IACD,EAAE,EAAE,MAAM,CAAA;IACV,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,SAAS,CAAA;IACf,QAAQ,EAAE,MAAM,CAAA;IAChB,KAAK,EAAE,MAAM,CAAA;IACb,OAAO,EAAE,SAAS,CAAA;CACnB,+BA4BA"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
import type { ToolbarCommandId, ToolbarItem } from "../types";
|
|
3
|
+
export interface StyloToolbarSettingsProps {
|
|
4
|
+
/** The toolbar items — the same array passed to `<Stylo toolbar={{ items }}>`. */
|
|
5
|
+
value: ToolbarItem[];
|
|
6
|
+
/** Called with the next items array on every change. */
|
|
7
|
+
onChange: (next: ToolbarItem[]) => void;
|
|
8
|
+
/**
|
|
9
|
+
* Every item the user may pick from. Defaults to all built-in command ids;
|
|
10
|
+
* pass a list to add `ToolbarCustomItem`s or to hold some built-ins back.
|
|
11
|
+
*/
|
|
12
|
+
available?: ToolbarItem[];
|
|
13
|
+
/** Per-id glyph overrides, matching `<Stylo icons>`. */
|
|
14
|
+
icons?: Partial<Record<ToolbarCommandId, ReactNode>>;
|
|
15
|
+
/** Extra class on the root element. */
|
|
16
|
+
className?: string;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* A keyboard-accessible editor for the formatting bar's `items`. Controlled:
|
|
20
|
+
* the host owns `value`, persists it, and feeds it to both this component and
|
|
21
|
+
* `<Stylo>`.
|
|
22
|
+
*
|
|
23
|
+
* Reorder a row by dragging its ⠿ handle, or focus the handle and use
|
|
24
|
+
* Space + Arrow keys (`@dnd-kit`'s keyboard sensor). The ✕ / Add buttons move
|
|
25
|
+
* items between the two lists. `@dnd-kit/core`, `/sortable`, and `/utilities`
|
|
26
|
+
* are optional peer dependencies of this entry point.
|
|
27
|
+
*/
|
|
28
|
+
export declare function StyloToolbarSettings({ value, onChange, available, icons, className, }: StyloToolbarSettingsProps): import("react").JSX.Element;
|
|
29
|
+
//# sourceMappingURL=StyloToolbarSettings.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StyloToolbarSettings.d.ts","sourceRoot":"","sources":["../../src/toolbar-settings/StyloToolbarSettings.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAetC,OAAO,KAAK,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,UAAU,CAAA;AAe7D,MAAM,WAAW,yBAAyB;IACxC,kFAAkF;IAClF,KAAK,EAAE,WAAW,EAAE,CAAA;IACpB,wDAAwD;IACxD,QAAQ,EAAE,CAAC,IAAI,EAAE,WAAW,EAAE,KAAK,IAAI,CAAA;IACvC;;;OAGG;IACH,SAAS,CAAC,EAAE,WAAW,EAAE,CAAA;IACzB,wDAAwD;IACxD,KAAK,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,gBAAgB,EAAE,SAAS,CAAC,CAAC,CAAA;IACpD,uCAAuC;IACvC,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED;;;;;;;;;GASG;AACH,wBAAgB,oBAAoB,CAAC,EACnC,KAAK,EACL,QAAQ,EACR,SAAS,EACT,KAAK,EACL,SAAS,GACV,EAAE,yBAAyB,+BA4I3B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/toolbar-settings/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAA;AAC7D,YAAY,EAAE,yBAAyB,EAAE,MAAM,wBAAwB,CAAA"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
import type { ToolbarCommandId, ToolbarItem } from "../types";
|
|
3
|
+
/** The `"|"` separator slot. */
|
|
4
|
+
export declare const SEPARATOR: "|";
|
|
5
|
+
export declare function isSeparator(item: ToolbarItem): item is "|";
|
|
6
|
+
/** Stable identity of a non-separator item; `null` for a separator. */
|
|
7
|
+
export declare function itemId(item: ToolbarItem): string | null;
|
|
8
|
+
/** React key for a slot — separators fall back to their position. */
|
|
9
|
+
export declare function itemKey(item: ToolbarItem, index: number): string;
|
|
10
|
+
interface Display {
|
|
11
|
+
/** `null` for a separator. */
|
|
12
|
+
id: string | null;
|
|
13
|
+
label: string;
|
|
14
|
+
icon: ReactNode;
|
|
15
|
+
}
|
|
16
|
+
/** Icon + label for a slot, honouring a consumer `icons` override for built-ins. */
|
|
17
|
+
export declare function resolveDisplay(item: ToolbarItem, icons?: Partial<Record<ToolbarCommandId, ReactNode>>): Display;
|
|
18
|
+
/** Palette entries not already on the bar (matched by id; separators excluded). */
|
|
19
|
+
export declare function availableNotOnBar(available: readonly ToolbarItem[], onBar: readonly ToolbarItem[]): ToolbarItem[];
|
|
20
|
+
export declare function move<T>(arr: readonly T[], from: number, to: number): T[];
|
|
21
|
+
export declare function removeAt<T>(arr: readonly T[], index: number): T[];
|
|
22
|
+
export declare function append<T>(arr: readonly T[], value: T): T[];
|
|
23
|
+
export {};
|
|
24
|
+
//# sourceMappingURL=items.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"items.d.ts","sourceRoot":"","sources":["../../src/toolbar-settings/items.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AACtC,OAAO,KAAK,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,UAAU,CAAA;AAI7D,gCAAgC;AAChC,eAAO,MAAM,SAAS,EAAG,GAAY,CAAA;AAErC,wBAAgB,WAAW,CAAC,IAAI,EAAE,WAAW,GAAG,IAAI,IAAI,GAAG,CAE1D;AAED,uEAAuE;AACvE,wBAAgB,MAAM,CAAC,IAAI,EAAE,WAAW,GAAG,MAAM,GAAG,IAAI,CAGvD;AAED,qEAAqE;AACrE,wBAAgB,OAAO,CAAC,IAAI,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAEhE;AAED,UAAU,OAAO;IACf,8BAA8B;IAC9B,EAAE,EAAE,MAAM,GAAG,IAAI,CAAA;IACjB,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,SAAS,CAAA;CAChB;AAED,oFAAoF;AACpF,wBAAgB,cAAc,CAC5B,IAAI,EAAE,WAAW,EACjB,KAAK,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,gBAAgB,EAAE,SAAS,CAAC,CAAC,GACnD,OAAO,CAQT;AAED,mFAAmF;AACnF,wBAAgB,iBAAiB,CAC/B,SAAS,EAAE,SAAS,WAAW,EAAE,EACjC,KAAK,EAAE,SAAS,WAAW,EAAE,GAC5B,WAAW,EAAE,CAMf;AAED,wBAAgB,IAAI,CAAC,CAAC,EAAE,GAAG,EAAE,SAAS,CAAC,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,CAAC,EAAE,CAMxE;AAED,wBAAgB,QAAQ,CAAC,CAAC,EAAE,GAAG,EAAE,SAAS,CAAC,EAAE,EAAE,KAAK,EAAE,MAAM,GAAG,CAAC,EAAE,CAIjE;AAED,wBAAgB,MAAM,CAAC,CAAC,EAAE,GAAG,EAAE,SAAS,CAAC,EAAE,EAAE,KAAK,EAAE,CAAC,GAAG,CAAC,EAAE,CAE1D"}
|