arethesis 0.2.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +34 -0
- package/README.md +3 -2
- package/dist/arethesis.js +2 -222
- package/dist/binding/data-binder.d.ts +8 -0
- package/dist/binding/data-binder.d.ts.map +1 -1
- package/dist/binding/data-binder.js +605 -0
- package/dist/binding/data-binder.js.map +1 -0
- package/dist/binding/types.d.ts +20 -0
- package/dist/binding/types.d.ts.map +1 -1
- package/dist/binding/validation-engine.js +160 -0
- package/dist/binding/validation-engine.js.map +1 -0
- package/dist/cdn/arethesis.min.js +2 -0
- package/dist/cdn/arethesis.min.js.map +1 -0
- package/dist/cdn/chunks/CdTL-MEv.min.js +3 -0
- package/dist/cdn/chunks/CdTL-MEv.min.js.map +1 -0
- package/dist/cdn/components.min.js +81 -0
- package/dist/cdn/components.min.js.map +1 -0
- package/dist/collab/index.d.ts +22 -0
- package/dist/collab/index.d.ts.map +1 -0
- package/dist/collab/index.js +23 -0
- package/dist/collab/index.js.map +1 -0
- package/dist/components/component.d.ts +17 -0
- package/dist/components/component.d.ts.map +1 -1
- package/dist/components/component.js +765 -0
- package/dist/components/component.js.map +1 -0
- package/dist/components/decorators.js +27 -0
- package/dist/components/decorators.js.map +1 -0
- package/dist/components/form-associated.d.ts +55 -0
- package/dist/components/form-associated.d.ts.map +1 -0
- package/dist/components/form-associated.js +180 -0
- package/dist/components/form-associated.js.map +1 -0
- package/dist/components/runtime.d.ts +2 -0
- package/dist/components/runtime.d.ts.map +1 -1
- package/dist/components/runtime.js +18 -0
- package/dist/components/runtime.js.map +1 -0
- package/dist/components/template-loader.js +90 -0
- package/dist/components/template-loader.js.map +1 -0
- package/dist/components.js +2 -2810
- package/dist/core/arethesis.d.ts +13 -9
- package/dist/core/arethesis.d.ts.map +1 -1
- package/dist/core/arethesis.js +249 -0
- package/dist/core/arethesis.js.map +1 -0
- package/dist/core/hooks.d.ts +19 -0
- package/dist/core/hooks.d.ts.map +1 -0
- package/dist/core/hooks.js +23 -0
- package/dist/core/hooks.js.map +1 -0
- package/dist/core/index.d.ts +57 -0
- package/dist/core/index.d.ts.map +1 -0
- package/dist/core/index.js +25 -0
- package/dist/data/list-view-registry.js +300 -0
- package/dist/data/list-view-registry.js.map +1 -0
- package/dist/data/object-store.js +280 -0
- package/dist/data/object-store.js.map +1 -0
- package/dist/data/optimistic-updates.js +168 -0
- package/dist/data/optimistic-updates.js.map +1 -0
- package/dist/data/persistence-manager.js +233 -0
- package/dist/data/persistence-manager.js.map +1 -0
- package/dist/defaults.d.ts +1 -0
- package/dist/defaults.d.ts.map +1 -0
- package/dist/defaults.js +17 -0
- package/dist/defaults.js.map +1 -0
- package/dist/http/auth-manager.js +260 -0
- package/dist/http/auth-manager.js.map +1 -0
- package/dist/http/http-client.d.ts +7 -0
- package/dist/http/http-client.d.ts.map +1 -1
- package/dist/http/http-client.js +501 -0
- package/dist/http/http-client.js.map +1 -0
- package/dist/http/http-error.js +53 -0
- package/dist/http/http-error.js.map +1 -0
- package/dist/http/mapping.js +64 -0
- package/dist/http/mapping.js.map +1 -0
- package/dist/index.d.ts +3 -58
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +55 -0
- package/dist/kit/calendar.d.ts +43 -0
- package/dist/kit/calendar.d.ts.map +1 -0
- package/dist/kit/calendar.js +423 -0
- package/dist/kit/calendar.js.map +1 -0
- package/dist/kit/cell-editor.js +191 -0
- package/dist/kit/cell-editor.js.map +1 -0
- package/dist/kit/chart.d.ts +2 -0
- package/dist/kit/chart.d.ts.map +1 -1
- package/dist/kit/chart.js +541 -0
- package/dist/kit/chart.js.map +1 -0
- package/dist/kit/combobox.d.ts +57 -0
- package/dist/kit/combobox.d.ts.map +1 -0
- package/dist/kit/combobox.js +379 -0
- package/dist/kit/combobox.js.map +1 -0
- package/dist/kit/command-palette.d.ts +2 -0
- package/dist/kit/command-palette.d.ts.map +1 -1
- package/dist/kit/command-palette.js +315 -0
- package/dist/kit/command-palette.js.map +1 -0
- package/dist/kit/data-table.d.ts +11 -0
- package/dist/kit/data-table.d.ts.map +1 -1
- package/dist/kit/data-table.js +373 -0
- package/dist/kit/data-table.js.map +1 -0
- package/dist/kit/dialog.d.ts +31 -0
- package/dist/kit/dialog.d.ts.map +1 -0
- package/dist/kit/dialog.js +157 -0
- package/dist/kit/dialog.js.map +1 -0
- package/dist/kit/elements/calendar.d.ts +3 -0
- package/dist/kit/elements/calendar.d.ts.map +1 -0
- package/dist/kit/elements/calendar.js +11 -0
- package/dist/kit/elements/calendar.js.map +1 -0
- package/dist/kit/elements/chart.d.ts +3 -0
- package/dist/kit/elements/chart.d.ts.map +1 -0
- package/dist/kit/elements/chart.js +11 -0
- package/dist/kit/elements/chart.js.map +1 -0
- package/dist/kit/elements/combobox.d.ts +3 -0
- package/dist/kit/elements/combobox.d.ts.map +1 -0
- package/dist/kit/elements/combobox.js +11 -0
- package/dist/kit/elements/combobox.js.map +1 -0
- package/dist/kit/elements/command-palette.d.ts +3 -0
- package/dist/kit/elements/command-palette.d.ts.map +1 -0
- package/dist/kit/elements/command-palette.js +11 -0
- package/dist/kit/elements/command-palette.js.map +1 -0
- package/dist/kit/elements/data-table.d.ts +3 -0
- package/dist/kit/elements/data-table.d.ts.map +1 -0
- package/dist/kit/elements/data-table.js +11 -0
- package/dist/kit/elements/data-table.js.map +1 -0
- package/dist/kit/elements/dialog.d.ts +4 -0
- package/dist/kit/elements/dialog.d.ts.map +1 -0
- package/dist/kit/elements/dialog.js +11 -0
- package/dist/kit/elements/dialog.js.map +1 -0
- package/dist/kit/elements/flex-view.d.ts +3 -0
- package/dist/kit/elements/flex-view.d.ts.map +1 -0
- package/dist/kit/elements/flex-view.js +11 -0
- package/dist/kit/elements/flex-view.js.map +1 -0
- package/dist/kit/elements/form.d.ts +3 -0
- package/dist/kit/elements/form.d.ts.map +1 -0
- package/dist/kit/elements/form.js +11 -0
- package/dist/kit/elements/form.js.map +1 -0
- package/dist/kit/elements/kanban.d.ts +3 -0
- package/dist/kit/elements/kanban.d.ts.map +1 -0
- package/dist/kit/elements/kanban.js +11 -0
- package/dist/kit/elements/kanban.js.map +1 -0
- package/dist/kit/elements/list.d.ts +3 -0
- package/dist/kit/elements/list.d.ts.map +1 -0
- package/dist/kit/elements/list.js +11 -0
- package/dist/kit/elements/list.js.map +1 -0
- package/dist/kit/elements/markdown-editor.d.ts +3 -0
- package/dist/kit/elements/markdown-editor.d.ts.map +1 -0
- package/dist/kit/elements/markdown-editor.js +11 -0
- package/dist/kit/elements/markdown-editor.js.map +1 -0
- package/dist/kit/elements/presence.d.ts +3 -0
- package/dist/kit/elements/presence.d.ts.map +1 -0
- package/dist/kit/elements/presence.js +11 -0
- package/dist/kit/elements/presence.js.map +1 -0
- package/dist/kit/elements/sheet.d.ts +3 -0
- package/dist/kit/elements/sheet.d.ts.map +1 -0
- package/dist/kit/elements/sheet.js +11 -0
- package/dist/kit/elements/sheet.js.map +1 -0
- package/dist/kit/elements/tabs.d.ts +3 -0
- package/dist/kit/elements/tabs.d.ts.map +1 -0
- package/dist/kit/elements/tabs.js +11 -0
- package/dist/kit/elements/tabs.js.map +1 -0
- package/dist/kit/elements/toast.d.ts +4 -0
- package/dist/kit/elements/toast.d.ts.map +1 -0
- package/dist/kit/elements/toast.js +11 -0
- package/dist/kit/elements/toast.js.map +1 -0
- package/dist/kit/elements/tree.d.ts +3 -0
- package/dist/kit/elements/tree.d.ts.map +1 -0
- package/dist/kit/elements/tree.js +11 -0
- package/dist/kit/elements/tree.js.map +1 -0
- package/dist/kit/flex-view.d.ts +2 -0
- package/dist/kit/flex-view.d.ts.map +1 -1
- package/dist/kit/flex-view.js +346 -0
- package/dist/kit/flex-view.js.map +1 -0
- package/dist/kit/form.d.ts +2 -0
- package/dist/kit/form.d.ts.map +1 -1
- package/dist/kit/form.js +211 -0
- package/dist/kit/form.js.map +1 -0
- package/dist/kit/index.d.ts +15 -15
- package/dist/kit/index.d.ts.map +1 -1
- package/dist/kit/index.js +40 -0
- package/dist/kit/internal/modal.d.ts +26 -0
- package/dist/kit/internal/modal.d.ts.map +1 -0
- package/dist/kit/internal/modal.js +59 -0
- package/dist/kit/internal/modal.js.map +1 -0
- package/dist/kit/kanban.d.ts +73 -0
- package/dist/kit/kanban.d.ts.map +1 -0
- package/dist/kit/kanban.js +404 -0
- package/dist/kit/kanban.js.map +1 -0
- package/dist/kit/list.d.ts +4 -0
- package/dist/kit/list.d.ts.map +1 -1
- package/dist/kit/list.js +106 -0
- package/dist/kit/list.js.map +1 -0
- package/dist/kit/markdown/highlight.js +106 -0
- package/dist/kit/markdown/highlight.js.map +1 -0
- package/dist/kit/markdown/render.js +260 -0
- package/dist/kit/markdown/render.js.map +1 -0
- package/dist/kit/markdown-editor.d.ts +2 -0
- package/dist/kit/markdown-editor.d.ts.map +1 -1
- package/dist/kit/markdown-editor.js +797 -0
- package/dist/kit/markdown-editor.js.map +1 -0
- package/dist/kit/presence.d.ts +36 -0
- package/dist/kit/presence.d.ts.map +1 -0
- package/dist/kit/presence.js +262 -0
- package/dist/kit/presence.js.map +1 -0
- package/dist/kit/sheet/formula.js +364 -0
- package/dist/kit/sheet/formula.js.map +1 -0
- package/dist/kit/sheet/model.js +136 -0
- package/dist/kit/sheet/model.js.map +1 -0
- package/dist/kit/sheet/sheet.d.ts +2 -0
- package/dist/kit/sheet/sheet.d.ts.map +1 -1
- package/dist/kit/sheet/sheet.js +676 -0
- package/dist/kit/sheet/sheet.js.map +1 -0
- package/dist/kit/tabs.d.ts +17 -0
- package/dist/kit/tabs.d.ts.map +1 -0
- package/dist/kit/tabs.js +192 -0
- package/dist/kit/tabs.js.map +1 -0
- package/dist/kit/theme-boot.generated.js +8 -0
- package/dist/kit/theme-boot.generated.js.map +1 -0
- package/dist/kit/theme.js +89 -0
- package/dist/kit/theme.js.map +1 -0
- package/dist/kit/toast.d.ts +46 -0
- package/dist/kit/toast.d.ts.map +1 -0
- package/dist/kit/toast.js +154 -0
- package/dist/kit/toast.js.map +1 -0
- package/dist/kit/tree.d.ts +41 -0
- package/dist/kit/tree.d.ts.map +1 -0
- package/dist/kit/tree.js +422 -0
- package/dist/kit/tree.js.map +1 -0
- package/dist/mixins/context-menu.d.ts.map +1 -1
- package/dist/mixins/context-menu.js +183 -0
- package/dist/mixins/context-menu.js.map +1 -0
- package/dist/mixins/draggable.d.ts.map +1 -1
- package/dist/mixins/draggable.js +140 -0
- package/dist/mixins/draggable.js.map +1 -0
- package/dist/mixins/dropdown.d.ts.map +1 -1
- package/dist/mixins/dropdown.js +216 -0
- package/dist/mixins/dropdown.js.map +1 -0
- package/dist/mixins/editable.d.ts.map +1 -1
- package/dist/mixins/editable.js +175 -0
- package/dist/mixins/editable.js.map +1 -0
- package/dist/mixins/grid-navigation.d.ts.map +1 -1
- package/dist/mixins/grid-navigation.js +194 -0
- package/dist/mixins/grid-navigation.js.map +1 -0
- package/dist/mixins/index.d.ts +6 -2
- package/dist/mixins/index.d.ts.map +1 -1
- package/dist/mixins/index.js +38 -0
- package/dist/mixins/index.js.map +1 -0
- package/dist/mixins/infinite-scroll.d.ts.map +1 -1
- package/dist/mixins/infinite-scroll.js +83 -0
- package/dist/mixins/infinite-scroll.js.map +1 -0
- package/dist/mixins/listbox.d.ts.map +1 -1
- package/dist/mixins/listbox.js +208 -0
- package/dist/mixins/listbox.js.map +1 -0
- package/dist/mixins/popup.d.ts +36 -0
- package/dist/mixins/popup.d.ts.map +1 -0
- package/dist/mixins/popup.js +113 -0
- package/dist/mixins/popup.js.map +1 -0
- package/dist/mixins/registry.d.ts +6 -0
- package/dist/mixins/registry.d.ts.map +1 -1
- package/dist/mixins/registry.js +167 -0
- package/dist/mixins/registry.js.map +1 -0
- package/dist/mixins/resizable.d.ts.map +1 -1
- package/dist/mixins/resizable.js +128 -0
- package/dist/mixins/resizable.js.map +1 -0
- package/dist/mixins/sortable.d.ts.map +1 -1
- package/dist/mixins/sortable.js +511 -0
- package/dist/mixins/sortable.js.map +1 -0
- package/dist/mixins/tooltip.d.ts.map +1 -1
- package/dist/mixins/tooltip.js +80 -0
- package/dist/mixins/tooltip.js.map +1 -0
- package/dist/mixins/utils.js +105 -0
- package/dist/mixins/utils.js.map +1 -0
- package/dist/plugins/async-validators.js +118 -0
- package/dist/plugins/async-validators.js.map +1 -0
- package/dist/plugins/builtins.d.ts +1 -1
- package/dist/plugins/builtins.d.ts.map +1 -1
- package/dist/plugins/builtins.js +20 -0
- package/dist/plugins/builtins.js.map +1 -0
- package/dist/plugins/date-utils.js +128 -0
- package/dist/plugins/date-utils.js.map +1 -0
- package/dist/plugins/plugin-manager.d.ts.map +1 -1
- package/dist/plugins/plugin-manager.js +99 -0
- package/dist/plugins/plugin-manager.js.map +1 -0
- package/dist/plugins/rich-text.js +365 -0
- package/dist/plugins/rich-text.js.map +1 -0
- package/dist/realtime/azure-pubsub-manager.js +273 -0
- package/dist/realtime/azure-pubsub-manager.js.map +1 -0
- package/dist/realtime/collab/anchors.js +19 -0
- package/dist/realtime/collab/anchors.js.map +1 -0
- package/dist/realtime/collab/collab-session.js +396 -0
- package/dist/realtime/collab/collab-session.js.map +1 -0
- package/dist/realtime/collab/cursor-overlay.js +187 -0
- package/dist/realtime/collab/cursor-overlay.js.map +1 -0
- package/dist/realtime/collab/textarea-adapter.js +125 -0
- package/dist/realtime/collab/textarea-adapter.js.map +1 -0
- package/dist/realtime/collab/undo-manager.js +148 -0
- package/dist/realtime/collab/undo-manager.js.map +1 -0
- package/dist/realtime/index.d.ts +11 -0
- package/dist/realtime/index.d.ts.map +1 -0
- package/dist/realtime/index.js +22 -0
- package/dist/realtime/index.js.map +1 -0
- package/dist/realtime/ot/client.js +74 -0
- package/dist/realtime/ot/client.js.map +1 -0
- package/dist/realtime/ot/server.js +292 -0
- package/dist/realtime/ot/server.js.map +1 -0
- package/dist/realtime/ot/text-operation.js +282 -0
- package/dist/realtime/ot/text-operation.js.map +1 -0
- package/dist/realtime/reconnect.js +58 -0
- package/dist/realtime/reconnect.js.map +1 -0
- package/dist/realtime/sse-manager.js +172 -0
- package/dist/realtime/sse-manager.js.map +1 -0
- package/dist/realtime/websocket-manager.js +180 -0
- package/dist/realtime/websocket-manager.js.map +1 -0
- package/dist/theme.css +178 -0
- package/dist/utils/backoff.js +30 -0
- package/dist/utils/backoff.js.map +1 -0
- package/dist/utils/dates.js +67 -0
- package/dist/utils/dates.js.map +1 -0
- package/dist/utils/dom.js +30 -0
- package/dist/utils/dom.js.map +1 -0
- package/dist/utils/emitter.js +40 -0
- package/dist/utils/emitter.js.map +1 -0
- package/dist/utils/fuzzy.d.ts +2 -0
- package/dist/utils/fuzzy.d.ts.map +1 -1
- package/dist/utils/fuzzy.js +95 -0
- package/dist/utils/fuzzy.js.map +1 -0
- package/dist/utils/path.js +99 -0
- package/dist/utils/path.js.map +1 -0
- package/dist/utils/sanitize.js +161 -0
- package/dist/utils/sanitize.js.map +1 -0
- package/dist/utils/url.js +44 -0
- package/dist/utils/url.js.map +1 -0
- package/dist/utils/virtual-window.d.ts +25 -0
- package/dist/utils/virtual-window.d.ts.map +1 -0
- package/dist/utils/virtual-window.js +19 -0
- package/dist/utils/virtual-window.js.map +1 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +6 -0
- package/dist/version.js.map +1 -0
- package/package.json +61 -11
- package/dist/arethesis.js.map +0 -1
- package/dist/components.js.map +0 -1
- package/dist/fuzzy-Dnlbxdby.js +0 -5752
- package/dist/fuzzy-Dnlbxdby.js.map +0 -1
package/dist/components.js
CHANGED
|
@@ -1,2810 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
function g(t) {
|
|
4
|
-
let r = t.announce ?? e, i = t.type ?? "text", a = t.mode ?? "edit", o = !1, s = !1, c = new AbortController(), { signal: l } = c, u = document.createElement("div");
|
|
5
|
-
u.className = "ar-cell-editor", u.dataset.mode = a;
|
|
6
|
-
let d = n("ar-cell-error"), p = document.createElement("div");
|
|
7
|
-
p.className = "ar-cell-editor__error", p.id = d, p.hidden = !0;
|
|
8
|
-
let m, h = null;
|
|
9
|
-
if (i === "select") m = document.createElement("div"), m.className = "ar-cell-editor__input", m.setAttribute("aria-label", t.label), u.append(m, p), h = f(m, {
|
|
10
|
-
options: t.choices ?? [],
|
|
11
|
-
value: t.value,
|
|
12
|
-
label: t.label,
|
|
13
|
-
open: !0,
|
|
14
|
-
container: u
|
|
15
|
-
});
|
|
16
|
-
else {
|
|
17
|
-
let e = document.createElement("input");
|
|
18
|
-
e.type = i, e.className = "ar-cell-editor__input", e.setAttribute("aria-label", t.label), e.value = t.initialText ?? t.value, m = e, u.append(e, p);
|
|
19
|
-
}
|
|
20
|
-
t.host.appendChild(u);
|
|
21
|
-
let g = () => h ? h.getValue() : m.value;
|
|
22
|
-
function _() {
|
|
23
|
-
let e = t.cell.getBoundingClientRect(), n = t.host.getBoundingClientRect();
|
|
24
|
-
Object.assign(u.style, {
|
|
25
|
-
top: `${e.top - n.top + t.host.scrollTop}px`,
|
|
26
|
-
left: `${e.left - n.left + t.host.scrollLeft}px`,
|
|
27
|
-
width: `${e.width}px`,
|
|
28
|
-
height: `${e.height}px`
|
|
29
|
-
});
|
|
30
|
-
}
|
|
31
|
-
if (_(), m.focus(), m instanceof HTMLInputElement) {
|
|
32
|
-
let e = t.caret ?? "end";
|
|
33
|
-
try {
|
|
34
|
-
if (e === "all") m.select();
|
|
35
|
-
else {
|
|
36
|
-
let t = e === "end" ? m.value.length : Math.min(e, m.value.length);
|
|
37
|
-
m.setSelectionRange(t, t);
|
|
38
|
-
}
|
|
39
|
-
} catch {}
|
|
40
|
-
}
|
|
41
|
-
r(`Editing ${t.label}`);
|
|
42
|
-
function v(e) {
|
|
43
|
-
p.textContent = e, p.hidden = !1, p.setAttribute("role", "alert"), m.setAttribute("aria-invalid", "true"), m.setAttribute("aria-describedby", d), u.classList.add("is-invalid"), m.focus();
|
|
44
|
-
}
|
|
45
|
-
function y(e, n, r) {
|
|
46
|
-
o || (o = !0, c.abort(), h?.destroy(), u.remove(), t.onClose?.({
|
|
47
|
-
committed: e,
|
|
48
|
-
move: n,
|
|
49
|
-
reason: r
|
|
50
|
-
}));
|
|
51
|
-
}
|
|
52
|
-
async function b(e = "none", n = "commit") {
|
|
53
|
-
if (o || s) return o;
|
|
54
|
-
let i = g();
|
|
55
|
-
if (i === t.value) return y(!1, e, n), !0;
|
|
56
|
-
if (t.validate) {
|
|
57
|
-
s = !0;
|
|
58
|
-
let e = await t.validate(i);
|
|
59
|
-
if (s = !1, o) return !0;
|
|
60
|
-
if (e !== !0) return v(typeof e == "string" ? e : "Invalid value"), r(typeof e == "string" ? e : "Invalid value"), !1;
|
|
61
|
-
}
|
|
62
|
-
return y(!0, e, n), r(`${t.label} changed`), await t.commit(i), !0;
|
|
63
|
-
}
|
|
64
|
-
function x() {
|
|
65
|
-
o || (y(!1, "none", "cancel"), r("Edit cancelled"));
|
|
66
|
-
}
|
|
67
|
-
let S = {
|
|
68
|
-
ArrowUp: "up",
|
|
69
|
-
ArrowDown: "down",
|
|
70
|
-
ArrowLeft: "left",
|
|
71
|
-
ArrowRight: "right"
|
|
72
|
-
};
|
|
73
|
-
return u.addEventListener("keydown", (e) => {
|
|
74
|
-
if (e.stopPropagation(), e.isComposing) return;
|
|
75
|
-
let n = !0;
|
|
76
|
-
e.key === "Escape" ? x() : e.key === "Enter" ? b(t.enterMoves === "down" ? e.shiftKey ? "up" : "down" : "none") : e.key === "Tab" ? b(e.shiftKey ? "left" : "right") : e.key === "F2" ? (a = a === "enter" ? "edit" : "enter", u.dataset.mode = a, r(a === "edit" ? "Arrow keys move the cursor" : "Arrow keys move between cells")) : S[e.key] && a === "enter" && !e.shiftKey && !e.altKey ? b(S[e.key]) : n = !1, n && e.preventDefault();
|
|
77
|
-
}, { signal: l }), h && (m.addEventListener("listbox:commit", (e) => {
|
|
78
|
-
let { key: n, shiftKey: r } = e.detail;
|
|
79
|
-
b(n === "Tab" ? r ? "left" : "right" : n === "Enter" && t.enterMoves === "down" ? r ? "up" : "down" : "none");
|
|
80
|
-
}, { signal: l }), m.addEventListener("listbox:cancel", () => x(), { signal: l })), u.addEventListener("focusout", (e) => {
|
|
81
|
-
u.contains(e.relatedTarget) || queueMicrotask(() => {
|
|
82
|
-
!o && !u.contains(document.activeElement) && b("none", "blur");
|
|
83
|
-
});
|
|
84
|
-
}, { signal: l }), {
|
|
85
|
-
input: m,
|
|
86
|
-
get mode() {
|
|
87
|
-
return a;
|
|
88
|
-
},
|
|
89
|
-
get closed() {
|
|
90
|
-
return o;
|
|
91
|
-
},
|
|
92
|
-
commit: (e) => b(e),
|
|
93
|
-
cancel: x,
|
|
94
|
-
reposition: _
|
|
95
|
-
};
|
|
96
|
-
}
|
|
97
|
-
// src/kit/data-table.ts
|
|
98
|
-
var _ = "\n<template id=\"main\">\n <div class=\"ar-table\">\n <div class=\"ar-table__scroll\" tabindex=\"-1\">\n <table role=\"grid\" aria-rowcount=\"-1\">\n <caption class=\"ar-visually-hidden\"></caption>\n <thead><tr></tr></thead>\n <tbody data-items></tbody>\n </table>\n </div>\n <div class=\"ar-table__status\" role=\"status\" aria-live=\"polite\"></div>\n </div>\n</template>\n<template id=\"empty\"><tr class=\"ar-table__empty\"><td colspan=\"999\"></td></tr></template>\n<template id=\"loading\"><tr class=\"ar-table__loading\" aria-hidden=\"true\"><td colspan=\"999\"><div class=\"ar-skeleton\"></div><div class=\"ar-skeleton\"></div><div class=\"ar-skeleton\"></div></td></tr></template>\n<template id=\"error\"><tr class=\"ar-table__error\"><td colspan=\"999\"><span data-error-message></span> <button type=\"button\" class=\"ar-button\" data-retry>Retry</button></td></tr></template>\n", v = class extends t {
|
|
99
|
-
#e = null;
|
|
100
|
-
#t = null;
|
|
101
|
-
#n = [];
|
|
102
|
-
#r = null;
|
|
103
|
-
#i = null;
|
|
104
|
-
configure(e) {
|
|
105
|
-
this.#e = e;
|
|
106
|
-
let { listViews: t } = h();
|
|
107
|
-
this.#t = "ids" in e.list ? e.list : t.getOrCreate(e.list), this.ready.then(() => this.#a());
|
|
108
|
-
}
|
|
109
|
-
get view() {
|
|
110
|
-
return this.#t;
|
|
111
|
-
}
|
|
112
|
-
get selected() {
|
|
113
|
-
return this.#r;
|
|
114
|
-
}
|
|
115
|
-
setFilters(e) {
|
|
116
|
-
return this.#t ? h().listViews.update(this.#t.id, { filters: e }) : Promise.resolve();
|
|
117
|
-
}
|
|
118
|
-
setSort(e) {
|
|
119
|
-
if (!this.#t) return Promise.resolve();
|
|
120
|
-
let t = h().listViews.update(this.#t.id, { sort: e });
|
|
121
|
-
return this.#o(), t;
|
|
122
|
-
}
|
|
123
|
-
#a() {
|
|
124
|
-
let e = this.#e;
|
|
125
|
-
for (let e of this.#n.splice(0)) e.destroy();
|
|
126
|
-
let t = this.querySelector("table"), n = this.querySelector("caption");
|
|
127
|
-
n.textContent = e.caption ?? "", t.setAttribute("aria-label", e.caption ?? "Data table"), this.#o();
|
|
128
|
-
let r = {};
|
|
129
|
-
for (let t of e.columns) r[t.field] = {
|
|
130
|
-
...t.bind,
|
|
131
|
-
displayType: t.displayType ?? t.bind?.displayType,
|
|
132
|
-
selector: `[data-col="${o(t.field)}"]`
|
|
133
|
-
};
|
|
134
|
-
let a = {
|
|
135
|
-
fields: r,
|
|
136
|
-
itemTemplate: "item",
|
|
137
|
-
emptyTemplate: "empty",
|
|
138
|
-
loadingTemplate: "loading",
|
|
139
|
-
errorTemplate: "error",
|
|
140
|
-
infiniteScroll: {
|
|
141
|
-
threshold: e.threshold ?? 400,
|
|
142
|
-
root: "self"
|
|
143
|
-
}
|
|
144
|
-
};
|
|
145
|
-
this.bind(this.#t, a);
|
|
146
|
-
let s = i.apply(t, "grid-navigation", {
|
|
147
|
-
cellSelector: "td[data-col], th[data-col]",
|
|
148
|
-
rowSelector: "tr"
|
|
149
|
-
});
|
|
150
|
-
s && this.#n.push(s), this.listen(t, "grid:edit", (e) => {
|
|
151
|
-
let { cell: t, key: n } = e.detail;
|
|
152
|
-
this.#c(t, n) && e.preventDefault();
|
|
153
|
-
}), this.listen(t, "click", (e) => {
|
|
154
|
-
let t = e, n = t.target, r = n.closest("tbody tr[data-id]");
|
|
155
|
-
r && this.#s(r.getAttribute("data-id"));
|
|
156
|
-
let i = n.closest("tbody td[data-col]");
|
|
157
|
-
i && i.getAttribute("aria-readonly") === "false" && t.detail <= 1 && !n.closest("a, button, input, select, textarea") && this.#c(i, "click", y(i, t.clientX, t.clientY));
|
|
158
|
-
}), this.listen(t, "keydown", (e) => {
|
|
159
|
-
let t = e;
|
|
160
|
-
if (t.key === " " && t.target.closest("tbody td")) {
|
|
161
|
-
let e = t.target.closest("tr[data-id]");
|
|
162
|
-
e && (t.preventDefault(), this.#s(e.getAttribute("data-id")));
|
|
163
|
-
}
|
|
164
|
-
});
|
|
165
|
-
}
|
|
166
|
-
#o() {
|
|
167
|
-
let e = this.#e, t = this.querySelector("thead tr");
|
|
168
|
-
if (!e || !t) return;
|
|
169
|
-
let n = this.#t?.sort[0];
|
|
170
|
-
t.replaceChildren(...e.columns.map((e, t) => {
|
|
171
|
-
let r = document.createElement("th");
|
|
172
|
-
if (r.scope = "col", r.dataset.col = e.field, r.setAttribute("aria-colindex", String(t + 1)), e.width && (r.style.width = e.width), e.align && (r.dataset.align = e.align), e.sortable) {
|
|
173
|
-
let t = n?.field === e.field;
|
|
174
|
-
r.setAttribute("aria-sort", t ? n.direction === "asc" ? "ascending" : "descending" : "none");
|
|
175
|
-
let i = document.createElement("button");
|
|
176
|
-
i.type = "button", i.className = "ar-table__sort", i.textContent = e.label;
|
|
177
|
-
let a = document.createElement("span");
|
|
178
|
-
a.setAttribute("aria-hidden", "true"), a.className = "ar-table__sort-icon", a.textContent = t ? n.direction === "asc" ? "▲" : "▼" : "↕", i.appendChild(a), i.addEventListener("click", () => {
|
|
179
|
-
let r = t && n.direction === "asc" ? "desc" : "asc";
|
|
180
|
-
this.setSort([{
|
|
181
|
-
field: e.field,
|
|
182
|
-
direction: r
|
|
183
|
-
}]);
|
|
184
|
-
}), r.appendChild(i);
|
|
185
|
-
} else r.textContent = e.label;
|
|
186
|
-
let a = i.apply(r, "resizable", {
|
|
187
|
-
handles: ["e"],
|
|
188
|
-
minWidth: 60
|
|
189
|
-
});
|
|
190
|
-
return a && this.#n.push(a), r;
|
|
191
|
-
}));
|
|
192
|
-
}
|
|
193
|
-
async loadTemplate(e) {
|
|
194
|
-
if (e === "item" && this.#e) {
|
|
195
|
-
let e = document.createElement("tr");
|
|
196
|
-
for (let [t, n] of this.#e.columns.entries()) {
|
|
197
|
-
let r = document.createElement("td");
|
|
198
|
-
r.dataset.col = n.field, r.setAttribute("aria-colindex", String(t + 1)), n.align && (r.dataset.align = n.align), n.editable && r.setAttribute("aria-readonly", "false"), e.appendChild(r);
|
|
199
|
-
}
|
|
200
|
-
let t = document.createDocumentFragment();
|
|
201
|
-
return t.appendChild(e), t;
|
|
202
|
-
}
|
|
203
|
-
let t = await super.loadTemplate(e);
|
|
204
|
-
if (t && e === "empty") {
|
|
205
|
-
let e = t.querySelector("td");
|
|
206
|
-
e && (e.textContent = this.#e?.emptyText ?? "No results");
|
|
207
|
-
}
|
|
208
|
-
return t;
|
|
209
|
-
}
|
|
210
|
-
onItemRender(e, t) {
|
|
211
|
-
e.setAttribute("aria-selected", String(t.id === this.#r));
|
|
212
|
-
}
|
|
213
|
-
onListChange(e) {
|
|
214
|
-
let t = this.querySelector(".ar-table__status"), n = this.querySelector("table");
|
|
215
|
-
if (n && n.setAttribute("aria-rowcount", String(e.totalCount ?? -1)), i.get(n, "grid-navigation")?.refresh?.(), !t) return;
|
|
216
|
-
let r = e.ids.length;
|
|
217
|
-
t.textContent = e.status === "loading" ? "Loading…" : e.status === "loading-more" ? `Showing ${r}${e.totalCount === void 0 ? "" : ` of ${e.totalCount}`}, loading more…` : e.status === "error" ? "Could not load data." : `Showing ${r}${e.totalCount === void 0 ? "" : ` of ${e.totalCount}`}`;
|
|
218
|
-
}
|
|
219
|
-
#s(e) {
|
|
220
|
-
this.#r = e, this.querySelectorAll("tbody tr[data-id]").forEach((t) => t.setAttribute("aria-selected", String(t.getAttribute("data-id") === e))), this.emit("row-select", { id: e });
|
|
221
|
-
}
|
|
222
|
-
get editing() {
|
|
223
|
-
return this.#i && !this.#i.closed ? this.#i : null;
|
|
224
|
-
}
|
|
225
|
-
#c(t, n, r) {
|
|
226
|
-
if (this.editing) return !1;
|
|
227
|
-
let i = this.#e, a = t.dataset.col, o = t.closest("tr")?.getAttribute("data-id"), s = i?.columns.find((e) => e.field === a);
|
|
228
|
-
if (!i || !a || !o) return !1;
|
|
229
|
-
if (!s?.editable) return (n === "Enter" || n === "F2" || n && n.length === 1) && e(`${s?.label ?? "This cell"} is read only`), !1;
|
|
230
|
-
let c = typeof s.editable == "object" ? s.editable : {}, { store: l } = h(), u = this.#t.type, d = l.getData(u, o)?.[a], f = c.type === "number" || s.displayType === "number" || s.displayType === "currency", p = c.type ?? (f ? "number" : s.displayType === "date" ? "date" : "text"), m = !!n && n.length === 1, _ = this.querySelector(".ar-table__scroll");
|
|
231
|
-
return this.#i = g({
|
|
232
|
-
cell: t,
|
|
233
|
-
host: _,
|
|
234
|
-
value: d == null ? "" : String(d),
|
|
235
|
-
type: p,
|
|
236
|
-
choices: c.choices,
|
|
237
|
-
label: s.label,
|
|
238
|
-
mode: m ? "enter" : "edit",
|
|
239
|
-
initialText: m && p !== "select" ? n : void 0,
|
|
240
|
-
caret: r ?? "end",
|
|
241
|
-
enterMoves: i.enterMoves ?? "none",
|
|
242
|
-
validate: c.validation ? async (e) => {
|
|
243
|
-
let t = await h().binder.validationEngine.validateField(a, e, c.validation, { ...l.getData(u, o) });
|
|
244
|
-
return !t || t.message;
|
|
245
|
-
} : void 0,
|
|
246
|
-
commit: (e) => this.#u(u, o, { [a]: f ? Number(e) : e }),
|
|
247
|
-
onClose: ({ move: e, reason: n }) => {
|
|
248
|
-
this.#i = null, n !== "blur" && this.#l(t, e);
|
|
249
|
-
}
|
|
250
|
-
}), m && p === "select" && this.#i.input.dispatchEvent(new KeyboardEvent("keydown", {
|
|
251
|
-
key: n,
|
|
252
|
-
bubbles: !0,
|
|
253
|
-
cancelable: !0
|
|
254
|
-
})), m;
|
|
255
|
-
}
|
|
256
|
-
#l(e, t) {
|
|
257
|
-
let n = e.isConnected ? e : null, r = e.closest("tr");
|
|
258
|
-
if (r && t !== "none") {
|
|
259
|
-
let i = Array.from(r.querySelectorAll("td[data-col]")), a = i.indexOf(e);
|
|
260
|
-
if (t === "left" || t === "right") n = i[a + (t === "right" ? 1 : -1)] ?? e;
|
|
261
|
-
else {
|
|
262
|
-
let i = Array.from(this.querySelectorAll("tbody tr[data-id]"));
|
|
263
|
-
n = i[i.indexOf(r) + (t === "down" ? 1 : -1)]?.querySelectorAll("td[data-col]")[a] ?? e;
|
|
264
|
-
}
|
|
265
|
-
}
|
|
266
|
-
n?.focus(), n?.scrollIntoView?.({
|
|
267
|
-
block: "nearest",
|
|
268
|
-
inline: "nearest"
|
|
269
|
-
});
|
|
270
|
-
}
|
|
271
|
-
async #u(e, t, n) {
|
|
272
|
-
let r = this.#e?.save, i = d(), a = async () => {
|
|
273
|
-
if (!r) return;
|
|
274
|
-
if (typeof r == "function") return await r(t, n);
|
|
275
|
-
let e = i.http.getEndpoint(r.endpoint);
|
|
276
|
-
if (!e) throw Error(`Unknown endpoint "${r.endpoint}"`);
|
|
277
|
-
return i.http.request({
|
|
278
|
-
url: e.url,
|
|
279
|
-
method: r.method ?? e.method ?? "PATCH",
|
|
280
|
-
params: { id: t },
|
|
281
|
-
body: n
|
|
282
|
-
});
|
|
283
|
-
};
|
|
284
|
-
try {
|
|
285
|
-
await i.optimistic.update(e, t, n, a), this.emit("save", {
|
|
286
|
-
id: t,
|
|
287
|
-
changes: n
|
|
288
|
-
});
|
|
289
|
-
} catch (e) {
|
|
290
|
-
this.emit("save-error", {
|
|
291
|
-
id: t,
|
|
292
|
-
changes: n,
|
|
293
|
-
error: e
|
|
294
|
-
});
|
|
295
|
-
let r = this.itemElement(t);
|
|
296
|
-
r?.classList.add("is-error"), setTimeout(() => r?.classList.remove("is-error"), 1500);
|
|
297
|
-
}
|
|
298
|
-
}
|
|
299
|
-
onDisconnected() {
|
|
300
|
-
for (let e of this.#n.splice(0)) e.destroy();
|
|
301
|
-
}
|
|
302
|
-
};
|
|
303
|
-
function y(e, t, n) {
|
|
304
|
-
let r = e.ownerDocument, i = null, a = 0;
|
|
305
|
-
if (r.caretPositionFromPoint) {
|
|
306
|
-
let e = r.caretPositionFromPoint(t, n);
|
|
307
|
-
e && ({offsetNode: i, offset: a} = e);
|
|
308
|
-
} else if (r.caretRangeFromPoint) {
|
|
309
|
-
let e = r.caretRangeFromPoint(t, n);
|
|
310
|
-
e && ({startContainer: i, startOffset: a} = e);
|
|
311
|
-
}
|
|
312
|
-
if (!i || !e.contains(i)) return;
|
|
313
|
-
let o = 0, s = r.createTreeWalker(e, NodeFilter.SHOW_TEXT);
|
|
314
|
-
for (let e = s.nextNode(); e; e = s.nextNode()) {
|
|
315
|
-
if (e === i) return o + a;
|
|
316
|
-
o += e.textContent?.length ?? 0;
|
|
317
|
-
}
|
|
318
|
-
}
|
|
319
|
-
a({
|
|
320
|
-
tag: "a-data-table",
|
|
321
|
-
html: _
|
|
322
|
-
})(v);
|
|
323
|
-
// src/kit/flex-view.ts
|
|
324
|
-
var b = "ArLayout", x = 16;
|
|
325
|
-
function S(e, t, n) {
|
|
326
|
-
return e.endsWith("px") ? parseFloat(e) : e.endsWith("%") ? parseFloat(e) / 100 * t : n;
|
|
327
|
-
}
|
|
328
|
-
var ee = class extends t {
|
|
329
|
-
#e = null;
|
|
330
|
-
#t = [];
|
|
331
|
-
#n = null;
|
|
332
|
-
#r = null;
|
|
333
|
-
configure(e) {
|
|
334
|
-
this.#e = e, this.ready.then(() => this.#p());
|
|
335
|
-
}
|
|
336
|
-
resetLayout() {
|
|
337
|
-
this.#e?.id && h().store.delete(b, this.#e.id), this.#p();
|
|
338
|
-
}
|
|
339
|
-
#i() {
|
|
340
|
-
return this.#e?.id ? h().store.getData(b, this.#e.id) : void 0;
|
|
341
|
-
}
|
|
342
|
-
#a() {
|
|
343
|
-
let e = this.querySelector(".ar-flex");
|
|
344
|
-
return e ? Array.from(e.querySelectorAll(":scope > .ar-flex__panel")) : [];
|
|
345
|
-
}
|
|
346
|
-
#o() {
|
|
347
|
-
if (!this.#e?.id) return;
|
|
348
|
-
let e = this.#a(), t = {};
|
|
349
|
-
for (let n of e) {
|
|
350
|
-
let e = n.dataset.grow ? parseFloat(n.dataset.grow) : void 0, r = parseFloat(n.style.height) || void 0;
|
|
351
|
-
(e !== void 0 || r !== void 0) && (t[n.dataset.key] = {
|
|
352
|
-
grow: e,
|
|
353
|
-
height: r
|
|
354
|
-
});
|
|
355
|
-
}
|
|
356
|
-
h().store.upsert(b, this.#e.id, {
|
|
357
|
-
order: e.map((e) => e.dataset.key),
|
|
358
|
-
sizes: t
|
|
359
|
-
}, {
|
|
360
|
-
merge: "replace",
|
|
361
|
-
source: "local"
|
|
362
|
-
}), this.emit("layout-change", { order: e.map((e) => e.dataset.key) });
|
|
363
|
-
}
|
|
364
|
-
#s(e, t) {
|
|
365
|
-
let n = String(Math.round(t * 1e3) / 1e3);
|
|
366
|
-
e.style.flexGrow = n, e.dataset.grow = n;
|
|
367
|
-
}
|
|
368
|
-
#c() {
|
|
369
|
-
let e = (this.#e?.direction ?? "row") === "row", t = this.#a();
|
|
370
|
-
t.forEach((n, r) => {
|
|
371
|
-
let i = n.querySelector(":scope > .ar-flex__splitter");
|
|
372
|
-
if (!i) return;
|
|
373
|
-
let a = t[r + 1], o = !1;
|
|
374
|
-
e && a && a.querySelector(":scope > .ar-flex__splitter") && (o = Math.abs(n.offsetTop - a.offsetTop) < 1 && a.offsetLeft > n.offsetLeft);
|
|
375
|
-
let s = o && (parseFloat(getComputedStyle(n).flexGrow) || 0) + (parseFloat(getComputedStyle(a).flexGrow) || 0) > 0;
|
|
376
|
-
if (i.hidden = !s, !s) return;
|
|
377
|
-
let c = (e) => e.getAttribute("aria-label") ?? e.dataset.key;
|
|
378
|
-
i.setAttribute("aria-label", `Resize ${c(n)} and ${c(a)}`), i.setAttribute("aria-controls", `${n.id} ${a.id}`), this.#l(i, n, a);
|
|
379
|
-
});
|
|
380
|
-
}
|
|
381
|
-
#l(e, t, n) {
|
|
382
|
-
let r = this.#u(t, n);
|
|
383
|
-
r.total <= 0 || (e.setAttribute("aria-valuemin", String(Math.round(100 * r.minA / r.total))), e.setAttribute("aria-valuemax", String(Math.round(100 * r.maxA / r.total))), e.setAttribute("aria-valuenow", String(Math.round(100 * r.widthA / r.total))));
|
|
384
|
-
}
|
|
385
|
-
#u(e, t) {
|
|
386
|
-
let n = this.querySelector(".ar-flex").getBoundingClientRect().width, r = (e) => {
|
|
387
|
-
let t = getComputedStyle(e);
|
|
388
|
-
return {
|
|
389
|
-
width: e.getBoundingClientRect().width,
|
|
390
|
-
grow: parseFloat(t.flexGrow) || 0,
|
|
391
|
-
basis: S(t.flexBasis, n, 0),
|
|
392
|
-
min: S(t.minWidth, n, 0),
|
|
393
|
-
max: S(t.maxWidth, n, Infinity)
|
|
394
|
-
};
|
|
395
|
-
}, i = r(e), a = r(t), o = i.width + a.width, s = Math.max(i.min, i.basis), c = Math.max(a.min, a.basis), l = Math.max(s, o - Math.min(a.max, o)), u = Math.min(i.max, o - c);
|
|
396
|
-
return {
|
|
397
|
-
total: o,
|
|
398
|
-
widthA: i.width,
|
|
399
|
-
minA: l,
|
|
400
|
-
maxA: Math.max(l, u),
|
|
401
|
-
a: i,
|
|
402
|
-
b: a
|
|
403
|
-
};
|
|
404
|
-
}
|
|
405
|
-
#d(e, t, n, r) {
|
|
406
|
-
let i = Math.max(n.minA, Math.min(n.maxA, r)), a = n.a.grow + n.b.grow, o = n.total - n.a.basis - n.b.basis;
|
|
407
|
-
if (a <= 0 || o <= 0) return;
|
|
408
|
-
let s = a * (i - n.a.basis) / o;
|
|
409
|
-
this.#s(e, Math.max(0, s)), this.#s(t, Math.max(0, a - s));
|
|
410
|
-
}
|
|
411
|
-
#f(e, t) {
|
|
412
|
-
let n = document.createElement("div");
|
|
413
|
-
n.className = "ar-flex__splitter", n.tabIndex = 0, n.hidden = !0, n.setAttribute("role", "separator"), n.setAttribute("aria-orientation", "vertical"), e.appendChild(n);
|
|
414
|
-
let r = () => {
|
|
415
|
-
let t = this.#a();
|
|
416
|
-
return t[t.indexOf(e) + 1] ?? null;
|
|
417
|
-
}, i = () => {
|
|
418
|
-
this.#o();
|
|
419
|
-
let t = r();
|
|
420
|
-
t && this.#l(n, e, t), this.emit("panel-resize", {
|
|
421
|
-
key: e.dataset.key,
|
|
422
|
-
neighbour: t?.dataset.key
|
|
423
|
-
});
|
|
424
|
-
}, a = null;
|
|
425
|
-
n.addEventListener("pointerdown", (t) => {
|
|
426
|
-
let i = r();
|
|
427
|
-
t.button === 0 && i && !n.hidden && (t.preventDefault(), t.stopPropagation(), a = {
|
|
428
|
-
x: t.clientX,
|
|
429
|
-
pointerId: t.pointerId,
|
|
430
|
-
next: i,
|
|
431
|
-
pair: this.#u(e, i)
|
|
432
|
-
}, n.setPointerCapture?.(t.pointerId), n.classList.add("is-active"), this.classList.add("is-resizing"));
|
|
433
|
-
}, { signal: t }), n.addEventListener("pointermove", (t) => {
|
|
434
|
-
a && t.pointerId === a.pointerId && (this.#d(e, a.next, a.pair, a.pair.widthA + (t.clientX - a.x)), this.#l(n, e, a.next));
|
|
435
|
-
}, { signal: t });
|
|
436
|
-
let o = (e) => {
|
|
437
|
-
a && e.pointerId === a.pointerId && (a = null, n.classList.remove("is-active"), this.classList.remove("is-resizing"), i());
|
|
438
|
-
};
|
|
439
|
-
n.addEventListener("pointerup", o, { signal: t }), n.addEventListener("pointercancel", o, { signal: t }), n.addEventListener("keydown", (t) => {
|
|
440
|
-
let n = r();
|
|
441
|
-
if (!n) return;
|
|
442
|
-
let a = this.#u(e, n), o = t.shiftKey ? 64 : x, s = {
|
|
443
|
-
ArrowLeft: a.widthA - o,
|
|
444
|
-
ArrowRight: a.widthA + o,
|
|
445
|
-
Home: a.minA,
|
|
446
|
-
End: a.maxA
|
|
447
|
-
};
|
|
448
|
-
t.key in s && (t.preventDefault(), this.#d(e, n, a, s[t.key]), i());
|
|
449
|
-
}, { signal: t });
|
|
450
|
-
}
|
|
451
|
-
#p() {
|
|
452
|
-
let e = this.#e;
|
|
453
|
-
if (!e) return;
|
|
454
|
-
this.#m(), this.#n = new AbortController();
|
|
455
|
-
let { signal: t } = this.#n, n = this.querySelector(".ar-flex");
|
|
456
|
-
n || (n = document.createElement("div"), n.className = "ar-flex", this.replaceChildren(n)), n.replaceChildren(), Object.assign(n.style, {
|
|
457
|
-
display: "flex",
|
|
458
|
-
flexDirection: e.direction ?? "row",
|
|
459
|
-
flexWrap: e.wrap === !1 ? "nowrap" : "wrap",
|
|
460
|
-
gap: e.gap ?? "1rem"
|
|
461
|
-
}), n.style.setProperty("--ar-flex-gap", e.gap ?? "1rem"), n.setAttribute("aria-label", "Dashboard panels");
|
|
462
|
-
let r = this.#i(), a = [...e.children].sort((e, t) => {
|
|
463
|
-
let n = r?.order ?? [], i = n.indexOf(e.key), a = n.indexOf(t.key);
|
|
464
|
-
return (i === -1 ? Infinity : i) - (a === -1 ? Infinity : a);
|
|
465
|
-
});
|
|
466
|
-
for (let o of a) {
|
|
467
|
-
let a = document.createElement("section");
|
|
468
|
-
a.className = "ar-flex__panel", a.dataset.key = o.key, a.setAttribute("data-id", o.key), a.id = `${e.id ?? "flex"}-panel-${o.key}`.replace(/[^\w-]/g, "-"), Object.assign(a.style, {
|
|
469
|
-
flex: o.flex ?? "1",
|
|
470
|
-
minWidth: o.minWidth ?? "16rem",
|
|
471
|
-
maxWidth: o.maxWidth ?? "none"
|
|
472
|
-
});
|
|
473
|
-
let s = r?.sizes[o.key];
|
|
474
|
-
if (s?.grow !== void 0 && this.#s(a, s.grow), s?.height && (a.style.height = `${s.height}px`), o.title) {
|
|
475
|
-
let e = document.createElement("header");
|
|
476
|
-
e.className = "ar-flex__header";
|
|
477
|
-
let t = document.createElement("h2");
|
|
478
|
-
t.textContent = o.title, e.appendChild(t), a.appendChild(e), a.setAttribute("aria-label", o.title);
|
|
479
|
-
}
|
|
480
|
-
let c = document.createElement("div");
|
|
481
|
-
c.className = "ar-flex__body", o.scrollable && (c.tabIndex = 0, c.setAttribute("role", "region"), c.setAttribute("aria-label", o.title ?? o.key));
|
|
482
|
-
let l = document.createElement(o.component);
|
|
483
|
-
for (let [e, t] of Object.entries(o.attributes ?? {})) l.setAttribute(e, String(t));
|
|
484
|
-
if (c.appendChild(l), a.appendChild(c), n.appendChild(a), (o.binding || o.list) && customElements.whenDefined(o.component).then(() => {
|
|
485
|
-
let e = l;
|
|
486
|
-
typeof e.bind == "function" && (o.list ? e.bindList(o.list, o.bindConfig) : e.bind(o.binding, o.bindConfig));
|
|
487
|
-
}), o.resizable !== !1) {
|
|
488
|
-
this.#f(a, t);
|
|
489
|
-
let e = i.apply(a, "resizable", {
|
|
490
|
-
handles: ["s"],
|
|
491
|
-
minHeight: 120
|
|
492
|
-
});
|
|
493
|
-
e && this.#t.push(e), a.addEventListener("resizable:end", () => this.#o(), { signal: t });
|
|
494
|
-
}
|
|
495
|
-
}
|
|
496
|
-
if (e.reorderable !== !1) {
|
|
497
|
-
let e = i.apply(n, "sortable", {
|
|
498
|
-
items: ".ar-flex__panel",
|
|
499
|
-
handle: ".ar-flex__header",
|
|
500
|
-
direction: "horizontal"
|
|
501
|
-
});
|
|
502
|
-
e && this.#t.push(e), n.addEventListener("sortable:end", () => queueMicrotask(() => {
|
|
503
|
-
this.#o(), this.#c();
|
|
504
|
-
}), { signal: t });
|
|
505
|
-
}
|
|
506
|
-
this.#c(), typeof ResizeObserver < "u" && (this.#r = new ResizeObserver(() => this.#c()), this.#r.observe(n));
|
|
507
|
-
}
|
|
508
|
-
#m() {
|
|
509
|
-
for (let e of this.#t.splice(0)) e.destroy();
|
|
510
|
-
this.#n?.abort(), this.#n = null, this.#r?.disconnect(), this.#r = null;
|
|
511
|
-
}
|
|
512
|
-
onDisconnected() {
|
|
513
|
-
this.#m();
|
|
514
|
-
}
|
|
515
|
-
};
|
|
516
|
-
a({ tag: "a-flex-view" })(ee);
|
|
517
|
-
// src/kit/list.ts
|
|
518
|
-
var te = class extends t {
|
|
519
|
-
#e = /* @__PURE__ */ new Map();
|
|
520
|
-
#t = null;
|
|
521
|
-
onConnected() {
|
|
522
|
-
this.#t || this.#n();
|
|
523
|
-
}
|
|
524
|
-
#n() {
|
|
525
|
-
for (let e of Array.from(this.querySelectorAll(":scope > template"))) {
|
|
526
|
-
let t = e.hasAttribute("data-empty") ? "empty" : e.hasAttribute("data-loading") ? "loading" : e.hasAttribute("data-error") ? "error" : "item";
|
|
527
|
-
this.#e.set(t, e.content.cloneNode(!0)), e.remove();
|
|
528
|
-
}
|
|
529
|
-
let e = this.getAttribute("data-tag") ?? (this.#e.get("item")?.firstElementChild?.tagName === "LI" ? "ul" : "div");
|
|
530
|
-
this.#t = document.createElement(e), this.#t.className = "ar-list", this.#t.setAttribute("data-items", ""), this.getAttribute("aria-label") && this.#t.setAttribute("aria-label", this.getAttribute("aria-label")), this.replaceChildren(this.#t);
|
|
531
|
-
}
|
|
532
|
-
async loadTemplate(e) {
|
|
533
|
-
if (e === "main") {
|
|
534
|
-
this.#t || this.#n();
|
|
535
|
-
let e = document.createDocumentFragment();
|
|
536
|
-
return e.appendChild(this.#t), e;
|
|
537
|
-
}
|
|
538
|
-
let t = this.#e.get(e);
|
|
539
|
-
return t ? t.cloneNode(!0) : null;
|
|
540
|
-
}
|
|
541
|
-
async hasTemplate(e) {
|
|
542
|
-
return e === "main" || this.#e.has(e);
|
|
543
|
-
}
|
|
544
|
-
get bindConfig() {
|
|
545
|
-
let e = {}, t = this.#e.get("item");
|
|
546
|
-
for (let [n, r] of Array.from(t?.querySelectorAll("[data-bind]") ?? []).entries()) r.setAttribute("data-ar-field", String(n)), e[`${r.getAttribute("data-bind")}#${n}`] = {
|
|
547
|
-
field: r.getAttribute("data-bind"),
|
|
548
|
-
selector: `[data-ar-field="${n}"]`,
|
|
549
|
-
displayType: r.getAttribute("data-display") ?? void 0,
|
|
550
|
-
format: r.getAttribute("data-format") ?? void 0,
|
|
551
|
-
attribute: r.getAttribute("data-attribute") ?? void 0
|
|
552
|
-
};
|
|
553
|
-
return {
|
|
554
|
-
fields: e,
|
|
555
|
-
itemTemplate: "item",
|
|
556
|
-
emptyTemplate: this.#e.has("empty") ? "empty" : void 0,
|
|
557
|
-
loadingTemplate: this.#e.has("loading") ? "loading" : void 0,
|
|
558
|
-
errorTemplate: this.#e.has("error") ? "error" : void 0,
|
|
559
|
-
infiniteScroll: this.hasAttribute("infinite") ? { threshold: Number(this.getAttribute("data-threshold")) || 300 } : !1
|
|
560
|
-
};
|
|
561
|
-
}
|
|
562
|
-
};
|
|
563
|
-
a({ tag: "a-list" })(te);
|
|
564
|
-
// src/kit/form.ts
|
|
565
|
-
var ne = class extends t {
|
|
566
|
-
#e = null;
|
|
567
|
-
#t = null;
|
|
568
|
-
#n = !1;
|
|
569
|
-
onConnected() {
|
|
570
|
-
this.#t = this.querySelector("form"), this.#t ? (this.#t.noValidate = !0, this.#a(), this.listen(this.#t, "submit", (e) => {
|
|
571
|
-
e.preventDefault(), this.submit();
|
|
572
|
-
})) : console.error("<a-form> needs a <form> child");
|
|
573
|
-
}
|
|
574
|
-
values() {
|
|
575
|
-
return this.#e?.values() ?? {};
|
|
576
|
-
}
|
|
577
|
-
async validate() {
|
|
578
|
-
return (await this.#e?.validate())?.valid ?? !0;
|
|
579
|
-
}
|
|
580
|
-
#r() {
|
|
581
|
-
return Array.from(this.#t?.elements ?? []).filter((e) => (e instanceof HTMLInputElement || e instanceof HTMLSelectElement || e instanceof HTMLTextAreaElement) && !!e.name && e.type !== "submit" && e.type !== "button");
|
|
582
|
-
}
|
|
583
|
-
#i(e) {
|
|
584
|
-
let t = [];
|
|
585
|
-
e.required && t.push({ type: "required" }), e instanceof HTMLInputElement && (e.type === "email" && t.push({ type: "email" }), e.type === "url" && t.push({ type: "url" }), e.type === "tel" && t.push({ type: "phone" }), e.minLength > 0 && t.push({
|
|
586
|
-
type: "minLength",
|
|
587
|
-
params: { min: e.minLength }
|
|
588
|
-
}), e.maxLength > 0 && e.hasAttribute("maxlength") && t.push({
|
|
589
|
-
type: "maxLength",
|
|
590
|
-
params: { max: e.maxLength }
|
|
591
|
-
}), e.min !== "" && e.type !== "date" && t.push({
|
|
592
|
-
type: "min",
|
|
593
|
-
params: { min: Number(e.min) }
|
|
594
|
-
}), e.max !== "" && e.type !== "date" && t.push({
|
|
595
|
-
type: "max",
|
|
596
|
-
params: { max: Number(e.max) }
|
|
597
|
-
}), e.pattern && t.push({
|
|
598
|
-
type: "pattern",
|
|
599
|
-
params: { pattern: `^(?:${e.pattern})$` }
|
|
600
|
-
})), e instanceof HTMLTextAreaElement && e.minLength > 0 && t.push({
|
|
601
|
-
type: "minLength",
|
|
602
|
-
params: { min: e.minLength }
|
|
603
|
-
});
|
|
604
|
-
let n = e.getAttribute("data-rules");
|
|
605
|
-
if (n) try {
|
|
606
|
-
t.push(...JSON.parse(n));
|
|
607
|
-
} catch {
|
|
608
|
-
console.error(`<a-form>: invalid data-rules on "${e.name}"`);
|
|
609
|
-
}
|
|
610
|
-
return t;
|
|
611
|
-
}
|
|
612
|
-
#a() {
|
|
613
|
-
let e = {};
|
|
614
|
-
for (let t of this.#r()) {
|
|
615
|
-
if (t.name in e) continue;
|
|
616
|
-
let n = this.#i(t), r = t.labels?.[0]?.textContent?.trim().replace(/\s*\*$/, ""), i = n.length ? {
|
|
617
|
-
rules: n,
|
|
618
|
-
label: r
|
|
619
|
-
} : void 0;
|
|
620
|
-
e[t.name] = {
|
|
621
|
-
selector: `[name="${t.name}"]`,
|
|
622
|
-
inputType: t instanceof HTMLInputElement && t.type === "checkbox" ? "checkbox" : t.hasAttribute("data-rich-text") ? "rich-text" : void 0,
|
|
623
|
-
validation: i
|
|
624
|
-
}, t.required && t.setAttribute("aria-required", "true");
|
|
625
|
-
}
|
|
626
|
-
let t = {
|
|
627
|
-
fields: e,
|
|
628
|
-
showErrorSummary: "[data-error-summary]",
|
|
629
|
-
validateOn: ["blur", "change"]
|
|
630
|
-
}, n = this.getAttribute("data-source"), r = n?.includes(":") ? h().store.getData(n.slice(0, n.indexOf(":")), n.slice(n.indexOf(":") + 1)) ?? {} : Object.fromEntries(this.#r().map((e) => [e.name, e instanceof HTMLInputElement && e.type === "checkbox" ? e.checked : e.value]));
|
|
631
|
-
this.#e = h().binder.bind(this.#t, r, t);
|
|
632
|
-
}
|
|
633
|
-
async submit() {
|
|
634
|
-
if (this.#n || !this.#e || !this.#t) return;
|
|
635
|
-
let e = this.#t.querySelector("button:not([type=button]), [type=submit]");
|
|
636
|
-
this.#n = !0, this.#t.setAttribute("aria-busy", "true"), e?.setAttribute("aria-disabled", "true");
|
|
637
|
-
try {
|
|
638
|
-
if (!(await this.#e.validate()).valid) {
|
|
639
|
-
this.querySelector("[data-error-summary] a")?.focus();
|
|
640
|
-
return;
|
|
641
|
-
}
|
|
642
|
-
let e = this.#e.values(), t = this.getAttribute("data-endpoint");
|
|
643
|
-
if (!t) {
|
|
644
|
-
this.emit("submit-valid", { data: e });
|
|
645
|
-
return;
|
|
646
|
-
}
|
|
647
|
-
await this.#o(t, e);
|
|
648
|
-
} finally {
|
|
649
|
-
this.#n = !1, this.#t.removeAttribute("aria-busy"), e?.removeAttribute("aria-disabled");
|
|
650
|
-
}
|
|
651
|
-
}
|
|
652
|
-
async #o(e, t) {
|
|
653
|
-
let n = d(), r = n.http.getEndpoint(e);
|
|
654
|
-
if (!r) throw Error(`<a-form>: unknown endpoint "${e}"`);
|
|
655
|
-
let i = this.getAttribute("data-source"), a = i?.slice(i.indexOf(":") + 1);
|
|
656
|
-
try {
|
|
657
|
-
let e = await n.http.request({
|
|
658
|
-
url: r.url,
|
|
659
|
-
method: r.method ?? (a ? "PATCH" : "POST"),
|
|
660
|
-
params: a ? { id: a } : {},
|
|
661
|
-
body: t,
|
|
662
|
-
retry: r.retry
|
|
663
|
-
}), i = e === void 0 ? void 0 : n.http.ingest({
|
|
664
|
-
...r,
|
|
665
|
-
type: r.type ?? this.getAttribute("data-type") ?? void 0,
|
|
666
|
-
list: !1
|
|
667
|
-
}, e).data;
|
|
668
|
-
this.emit("submit-success", {
|
|
669
|
-
data: t,
|
|
670
|
-
result: i
|
|
671
|
-
}), this.hasAttribute("data-reset") && (this.#t.reset(), this.#a());
|
|
672
|
-
} catch (e) {
|
|
673
|
-
e instanceof s && (e.status === 422 || e.status === 400) && this.#s(e.body), this.emit("submit-error", { error: e });
|
|
674
|
-
}
|
|
675
|
-
}
|
|
676
|
-
#s(e) {
|
|
677
|
-
let t = e?.errors;
|
|
678
|
-
if (!t || typeof t != "object") return;
|
|
679
|
-
let { binder: n } = h();
|
|
680
|
-
for (let [e, r] of Object.entries(t)) {
|
|
681
|
-
let t = this.#t.querySelector(`[name="${e}"]`);
|
|
682
|
-
t && n.showFieldError(t, {
|
|
683
|
-
field: e,
|
|
684
|
-
rule: "server",
|
|
685
|
-
message: Array.isArray(r) ? r.join(" ") : r
|
|
686
|
-
});
|
|
687
|
-
}
|
|
688
|
-
this.#t.querySelector("[aria-invalid=\"true\"]")?.focus();
|
|
689
|
-
}
|
|
690
|
-
onDisconnected() {
|
|
691
|
-
this.#t && h().binder.unbind(this.#t), this.#e = null;
|
|
692
|
-
}
|
|
693
|
-
};
|
|
694
|
-
a({ tag: "a-form" })(ne);
|
|
695
|
-
// src/kit/chart.ts
|
|
696
|
-
var re = "http://www.w3.org/2000/svg", ie = /^(#[0-9a-f]{3,8}|(rgb|hsl|oklch|oklab)a?\([\d\s.,%/-]+\)|var\(--[\w-]+\)|[a-z]+)$/i, ae = (e) => e.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">"), C = (e) => Math.round(e * 10) / 10;
|
|
697
|
-
function oe(e, t, n = 5) {
|
|
698
|
-
if (!Number.isFinite(e) || !Number.isFinite(t)) return [0];
|
|
699
|
-
if (e === t) {
|
|
700
|
-
let n = Math.abs(e) || 1;
|
|
701
|
-
e -= n, t += n;
|
|
702
|
-
}
|
|
703
|
-
let r = (t - e) / Math.max(1, n), i = 10 ** Math.floor(Math.log10(r)), a = [
|
|
704
|
-
1,
|
|
705
|
-
2,
|
|
706
|
-
2.5,
|
|
707
|
-
5,
|
|
708
|
-
10
|
|
709
|
-
].map((e) => e * i).find((e) => e >= r) ?? 10 * i, o = Math.floor(e / a) * a, s = [];
|
|
710
|
-
for (let e = o; e <= t + a * .5 && s.length < 50; e += a) s.push(Math.round(e / a) * a);
|
|
711
|
-
return s[s.length - 1] < t && s.push(s[s.length - 1] + a), s;
|
|
712
|
-
}
|
|
713
|
-
var se = new Intl.NumberFormat(void 0, {
|
|
714
|
-
notation: "compact",
|
|
715
|
-
maximumFractionDigits: 1
|
|
716
|
-
}), ce = new Intl.NumberFormat(void 0, { maximumFractionDigits: 2 }), le = class extends t {
|
|
717
|
-
#e = null;
|
|
718
|
-
#t = [];
|
|
719
|
-
#n = /* @__PURE__ */ new Set();
|
|
720
|
-
#r = -1;
|
|
721
|
-
#i = 0;
|
|
722
|
-
#a;
|
|
723
|
-
#o;
|
|
724
|
-
#s;
|
|
725
|
-
#c;
|
|
726
|
-
#l;
|
|
727
|
-
#u;
|
|
728
|
-
#d = !1;
|
|
729
|
-
#f = 0;
|
|
730
|
-
#p = null;
|
|
731
|
-
configure(e) {
|
|
732
|
-
this.#e = e, this.#t = [...e.data ?? []], this.#m(), this.#n.clear(), this.#r = -1, this.isConnected && this.#h(), this.#b();
|
|
733
|
-
}
|
|
734
|
-
get config() {
|
|
735
|
-
return this.#e;
|
|
736
|
-
}
|
|
737
|
-
get data() {
|
|
738
|
-
return this.#t;
|
|
739
|
-
}
|
|
740
|
-
setData(e) {
|
|
741
|
-
this.#t = [...e], this.#m(), this.#b();
|
|
742
|
-
}
|
|
743
|
-
push(e) {
|
|
744
|
-
this.#t.push(e);
|
|
745
|
-
let t = this.#m();
|
|
746
|
-
this.#r >= 0 && (this.#r = Math.max(0, this.#r - t)), this.#b();
|
|
747
|
-
}
|
|
748
|
-
setSeriesVisible(e, t) {
|
|
749
|
-
t ? this.#n.delete(e) : this.#n.add(e), this.#b();
|
|
750
|
-
}
|
|
751
|
-
#m() {
|
|
752
|
-
let e = this.#e?.maxPoints;
|
|
753
|
-
if (!e || this.#t.length <= e) return 0;
|
|
754
|
-
let t = this.#t.length - e;
|
|
755
|
-
return this.#t.splice(0, t), t;
|
|
756
|
-
}
|
|
757
|
-
onConnected() {
|
|
758
|
-
if (this.#e && this.#h(), this.listen(window, "resize", () => this.#b()), typeof ResizeObserver < "u") {
|
|
759
|
-
let e = new ResizeObserver(() => this.#b());
|
|
760
|
-
e.observe(this), this.signal.addEventListener("abort", () => e.disconnect());
|
|
761
|
-
}
|
|
762
|
-
this.#b();
|
|
763
|
-
}
|
|
764
|
-
onDisconnected() {
|
|
765
|
-
cancelAnimationFrame(this.#f), this.#f = 0;
|
|
766
|
-
}
|
|
767
|
-
#h() {
|
|
768
|
-
let e = this.#e;
|
|
769
|
-
this.classList.add("ar-chart"), this.classList.toggle("ar-chart--spark", !!e.sparkline), this.#d || (this.#d = !0, this.#c = document.createElement("div"), this.#c.className = "ar-chart__legend", this.#a = document.createElement("div"), this.#a.className = "ar-chart__plot", this.#o = document.createElementNS(re, "svg"), this.#o.setAttribute("aria-hidden", "true"), this.#o.setAttribute("focusable", "false"), this.#s = document.createElement("div"), this.#s.className = "ar-chart__tooltip", this.#s.hidden = !0, this.#s.setAttribute("aria-hidden", "true"), this.#u = document.createElement("div"), this.#u.className = "ar-visually-hidden", this.#u.setAttribute("aria-live", "polite"), this.#l = document.createElement("table"), this.#l.className = "ar-chart__table ar-visually-hidden", this.#a.append(this.#o, this.#s), this.replaceChildren(this.#c, this.#a, this.#u, this.#l), this.#v()), this.#a.style.height = `${e.height ?? (e.sparkline ? 40 : 220)}px`, e.sparkline ? (this.#a.removeAttribute("tabindex"), this.#a.setAttribute("role", "img"), this.#a.setAttribute("aria-label", e.label)) : (this.#a.tabIndex = 0, this.#a.setAttribute("role", "group"), this.#a.setAttribute("aria-roledescription", "chart"), this.#a.setAttribute("aria-label", `${e.label}. Use the left and right arrow keys to read the values.`)), this.#g();
|
|
770
|
-
}
|
|
771
|
-
#g() {
|
|
772
|
-
let e = this.#e;
|
|
773
|
-
if (this.#c.replaceChildren(), e.sparkline) return;
|
|
774
|
-
e.series.length > 1 && e.series.forEach((e, t) => {
|
|
775
|
-
let n = document.createElement("button");
|
|
776
|
-
n.type = "button", n.className = "ar-chart__key", n.dataset.key = e.key, n.setAttribute("aria-pressed", String(!this.#n.has(e.key)));
|
|
777
|
-
let r = document.createElement("span");
|
|
778
|
-
r.className = "ar-chart__swatch", r.style.background = this.#_(e, t), r.setAttribute("aria-hidden", "true"), n.append(r, document.createTextNode(e.label)), this.#c.appendChild(n);
|
|
779
|
-
});
|
|
780
|
-
let t = document.createElement("button");
|
|
781
|
-
t.type = "button", t.className = "ar-chart__key ar-chart__table-toggle", t.textContent = "Table", t.setAttribute("aria-pressed", String(!this.#l.classList.contains("ar-visually-hidden"))), t.title = "Show the data as a table", this.#c.appendChild(t);
|
|
782
|
-
}
|
|
783
|
-
#_(e, t) {
|
|
784
|
-
return e.color && ie.test(e.color) ? e.color : `var(--ar-chart-${t % 6 + 1})`;
|
|
785
|
-
}
|
|
786
|
-
#v() {
|
|
787
|
-
this.listen(this.#c, "click", (e) => {
|
|
788
|
-
let t = e.target.closest("button");
|
|
789
|
-
if (!t) return;
|
|
790
|
-
if (t.classList.contains("ar-chart__table-toggle")) {
|
|
791
|
-
let e = this.#l.classList.toggle("ar-visually-hidden") === !1;
|
|
792
|
-
t.setAttribute("aria-pressed", String(e));
|
|
793
|
-
return;
|
|
794
|
-
}
|
|
795
|
-
let n = t.dataset.key, r = this.#n.has(n);
|
|
796
|
-
(r || this.#e.series.filter((e) => !this.#n.has(e.key)).length !== 1) && (this.setSeriesVisible(n, r), t.setAttribute("aria-pressed", String(r)));
|
|
797
|
-
}), this.listen(this.#a, "pointermove", (e) => {
|
|
798
|
-
let t = e;
|
|
799
|
-
if (!this.#p || this.#e?.sparkline) return;
|
|
800
|
-
let n = this.#a.getBoundingClientRect(), r = t.clientX - n.left;
|
|
801
|
-
this.#r = this.#y(r), this.#E(!1);
|
|
802
|
-
}), this.listen(this.#a, "pointerleave", () => {
|
|
803
|
-
document.activeElement !== this.#a && this.#D();
|
|
804
|
-
}), this.listen(this.#a, "focus", () => {
|
|
805
|
-
this.#r < 0 && (this.#r = this.#t.length - 1), this.#E(!0);
|
|
806
|
-
}), this.listen(this.#a, "blur", () => this.#D()), this.listen(this.#a, "keydown", (e) => {
|
|
807
|
-
let t = e, n = this.#t.length - 1, r;
|
|
808
|
-
if (t.key === "ArrowRight") r = Math.min(n, this.#r + 1);
|
|
809
|
-
else if (t.key === "ArrowLeft") r = Math.max(0, this.#r - 1);
|
|
810
|
-
else if (t.key === "Home") r = 0;
|
|
811
|
-
else if (t.key === "End") r = n;
|
|
812
|
-
else if (t.key === "Escape") {
|
|
813
|
-
this.#D();
|
|
814
|
-
return;
|
|
815
|
-
} else return;
|
|
816
|
-
t.preventDefault(), this.#r = r, this.#E(!0);
|
|
817
|
-
});
|
|
818
|
-
}
|
|
819
|
-
#y(e) {
|
|
820
|
-
let t = this.#p?.xs ?? [], n = -1, r = Infinity;
|
|
821
|
-
return t.forEach((t, i) => {
|
|
822
|
-
let a = Math.abs(t - e);
|
|
823
|
-
a < r && (r = a, n = i);
|
|
824
|
-
}), n;
|
|
825
|
-
}
|
|
826
|
-
#b() {
|
|
827
|
-
if (this.#f || !this.#e) return;
|
|
828
|
-
let e = () => {
|
|
829
|
-
this.#f = 0, this.#w();
|
|
830
|
-
};
|
|
831
|
-
this.#f = typeof requestAnimationFrame == "function" ? requestAnimationFrame(e) : setTimeout(e, 0);
|
|
832
|
-
}
|
|
833
|
-
redraw() {
|
|
834
|
-
cancelAnimationFrame(this.#f), this.#f = 0, this.#w();
|
|
835
|
-
}
|
|
836
|
-
#x(e) {
|
|
837
|
-
let t = this.#e;
|
|
838
|
-
return t.x?.format ? t.x.format(e) : t.x?.type === "time" || e instanceof Date ? new Date(e).toLocaleTimeString(void 0, {
|
|
839
|
-
hour: "numeric",
|
|
840
|
-
minute: "2-digit",
|
|
841
|
-
second: "2-digit"
|
|
842
|
-
}) : typeof e == "number" ? ce.format(e) : String(e);
|
|
843
|
-
}
|
|
844
|
-
#S(e, t = !1) {
|
|
845
|
-
let n = this.#e.y?.format;
|
|
846
|
-
return n ? n(e) : t && Math.abs(e) >= 1e4 ? se.format(e) : ce.format(e);
|
|
847
|
-
}
|
|
848
|
-
#C(e, t) {
|
|
849
|
-
let n = e[t];
|
|
850
|
-
return typeof n == "number" && Number.isFinite(n) ? n : null;
|
|
851
|
-
}
|
|
852
|
-
#w() {
|
|
853
|
-
let e = this.#e;
|
|
854
|
-
if (!e || !this.#d) return;
|
|
855
|
-
this.#i = this.#a.clientWidth || this.#i || 300;
|
|
856
|
-
let t = this.#i, n = e.height ?? (e.sparkline ? 40 : 220), r = e.series.map((e, t) => ({
|
|
857
|
-
...e,
|
|
858
|
-
color: this.#_(e, t)
|
|
859
|
-
})).filter((e) => !this.#n.has(e.key)), i = this.#t, a = e.type === "stacked-bar", o = e.type === "bar" || a, s = Infinity, c = -Infinity;
|
|
860
|
-
for (let e of i) if (a) {
|
|
861
|
-
let t = r.reduce((t, n) => t + Math.max(0, this.#C(e, n.key) ?? 0), 0);
|
|
862
|
-
c = Math.max(c, t), s = Math.min(s, 0);
|
|
863
|
-
} else for (let t of r) {
|
|
864
|
-
let n = this.#C(e, t.key);
|
|
865
|
-
n !== null && (s = Math.min(s, n), c = Math.max(c, n));
|
|
866
|
-
}
|
|
867
|
-
Number.isFinite(s) || ([s, c] = [0, 1]), (o || e.type === "area") && (s = Math.min(0, s)), e.y?.min !== void 0 && (s = e.y.min), e.y?.max !== void 0 && (c = e.y.max);
|
|
868
|
-
let l = e.sparkline ? [s, c === s ? s + 1 : c] : oe(s, c, n < 180 ? 3 : 5), u = l[0], d = l[l.length - 1], f = e.sparkline ? 0 : Math.max(...l.map((e) => this.#S(e, !0).length)) * 7 + 10, p = e.sparkline ? {
|
|
869
|
-
top: 3,
|
|
870
|
-
right: 3,
|
|
871
|
-
bottom: 3,
|
|
872
|
-
left: 3
|
|
873
|
-
} : {
|
|
874
|
-
top: 10,
|
|
875
|
-
right: 14,
|
|
876
|
-
bottom: 26,
|
|
877
|
-
left: f
|
|
878
|
-
}, m = Math.max(10, t - p.left - p.right), h = Math.max(10, n - p.top - p.bottom), g = (e) => p.top + h - (e - u) / (d - u || 1) * h, _ = i.length, v, y = _ ? m / _ : m;
|
|
879
|
-
if (o) v = i.map((e, t) => p.left + y * (t + .5));
|
|
880
|
-
else if ((e.x?.type === "time" || e.x?.type === "number") && _ > 1) {
|
|
881
|
-
let e = i.map((e) => e.x instanceof Date ? e.x.getTime() : Number(e.x)), t = e[0], n = e[_ - 1];
|
|
882
|
-
v = e.map((e) => p.left + (e - t) / (n - t || 1) * m);
|
|
883
|
-
} else v = i.map((e, t) => p.left + (_ > 1 ? t / (_ - 1) * m : m / 2));
|
|
884
|
-
this.#p = {
|
|
885
|
-
left: p.left,
|
|
886
|
-
top: p.top,
|
|
887
|
-
width: m,
|
|
888
|
-
height: h,
|
|
889
|
-
xs: v,
|
|
890
|
-
y: g
|
|
891
|
-
};
|
|
892
|
-
let b = [];
|
|
893
|
-
if (!e.sparkline) {
|
|
894
|
-
for (let e of l) {
|
|
895
|
-
let t = C(g(e));
|
|
896
|
-
b.push(`<line class="ar-chart__grid${e === 0 ? " is-zero" : ""}" x1="${p.left}" x2="${p.left + m}" y1="${t}" y2="${t}"/>`), b.push(`<text class="ar-chart__tick" x="${p.left - 8}" y="${t}" text-anchor="end" dominant-baseline="middle">${ae(this.#S(e, !0))}</text>`);
|
|
897
|
-
}
|
|
898
|
-
let e = Math.max(4, ...i.map((e) => this.#x(e.x).length)), t = Math.max(2, Math.floor(m / (e * 6.5 + 16))), n = Math.max(1, Math.ceil(_ / t));
|
|
899
|
-
for (let e = _ - 1; e >= 0; e -= n) b.push(`<text class="ar-chart__tick" x="${C(v[e])}" y="${p.top + h + 18}" text-anchor="${e === _ - 1 && !o ? "end" : e === 0 && !o ? "start" : "middle"}">${ae(this.#x(i[e].x))}</text>`);
|
|
900
|
-
}
|
|
901
|
-
if (o && _) {
|
|
902
|
-
let e = g(Math.max(u, Math.min(0, d)));
|
|
903
|
-
if (a) {
|
|
904
|
-
let t = Math.min(24, y * .7);
|
|
905
|
-
i.forEach((n, i) => {
|
|
906
|
-
let a = e, o = r.map((e) => ({
|
|
907
|
-
s: e,
|
|
908
|
-
v: Math.max(0, this.#C(n, e.key) ?? 0)
|
|
909
|
-
})).filter((e) => e.v > 0);
|
|
910
|
-
o.forEach((e, n) => {
|
|
911
|
-
let r = e.v / (d - u || 1) * h, s = n > 0 ? 2 : 0, c = a - r;
|
|
912
|
-
b.push(ue(v[i] - t / 2, c, t, r - s, a - s, n === o.length - 1, e.s.color)), a = c;
|
|
913
|
-
});
|
|
914
|
-
});
|
|
915
|
-
} else {
|
|
916
|
-
let e = Math.min(y * .8, 24 * r.length + 2 * (r.length - 1)), t = Math.max(2, (e - 2 * (r.length - 1)) / r.length);
|
|
917
|
-
i.forEach((n, i) => {
|
|
918
|
-
r.forEach((r, a) => {
|
|
919
|
-
let o = this.#C(n, r.key);
|
|
920
|
-
if (o === null) return;
|
|
921
|
-
let s = v[i] - e / 2 + a * (t + 2), c = g(Math.max(o, 0)), l = g(Math.min(o, 0));
|
|
922
|
-
b.push(ue(s, c, t, l - c, l, !0, r.color, o < 0));
|
|
923
|
-
});
|
|
924
|
-
});
|
|
925
|
-
}
|
|
926
|
-
} else for (let t of r) {
|
|
927
|
-
let n = i.map((e, n) => [v[n], this.#C(e, t.key)]).filter((e) => e[1] !== null);
|
|
928
|
-
if (!n.length) continue;
|
|
929
|
-
let r = n.map(([e, t], n) => `${n ? "L" : "M"}${C(e)},${C(g(t))}`).join("");
|
|
930
|
-
if (e.type === "area") {
|
|
931
|
-
let e = C(g(Math.max(u, 0)));
|
|
932
|
-
b.push(`<path class="ar-chart__area" style="fill:${t.color}" d="${r}L${C(n[n.length - 1][0])},${e}L${C(n[0][0])},${e}Z"/>`);
|
|
933
|
-
}
|
|
934
|
-
b.push(`<path class="ar-chart__line" style="stroke:${t.color}" d="${r}"/>`);
|
|
935
|
-
let [a, o] = n[n.length - 1];
|
|
936
|
-
b.push(`<circle class="ar-chart__dot" style="fill:${t.color}" cx="${C(a)}" cy="${C(g(o))}" r="${e.sparkline ? 2.5 : 4}"/>`);
|
|
937
|
-
}
|
|
938
|
-
b.push("<g class=\"ar-chart__cursor\"></g>"), this.#o.setAttribute("viewBox", `0 0 ${t} ${n}`), this.#o.setAttribute("width", String(t)), this.#o.setAttribute("height", String(n)), this.#o.innerHTML = b.join(""), this.#s.hidden || this.#E(!1, !0), this.#T(r);
|
|
939
|
-
}
|
|
940
|
-
#T(e) {
|
|
941
|
-
let t = this.#e, n = document.createElement("caption");
|
|
942
|
-
n.textContent = t.label;
|
|
943
|
-
let r = document.createElement("tr");
|
|
944
|
-
for (let n of [t.x?.type === "time" ? "Time" : "X", ...e.map((e) => e.label)]) {
|
|
945
|
-
let e = document.createElement("th");
|
|
946
|
-
e.scope = "col", e.textContent = n, r.appendChild(e);
|
|
947
|
-
}
|
|
948
|
-
let i = this.#t.map((t) => {
|
|
949
|
-
let n = document.createElement("tr"), r = document.createElement("th");
|
|
950
|
-
r.scope = "row", r.textContent = this.#x(t.x), n.appendChild(r);
|
|
951
|
-
for (let r of e) {
|
|
952
|
-
let e = document.createElement("td"), i = this.#C(t, r.key);
|
|
953
|
-
e.textContent = i === null ? "–" : this.#S(i), n.appendChild(e);
|
|
954
|
-
}
|
|
955
|
-
return n;
|
|
956
|
-
}), a = document.createElement("thead");
|
|
957
|
-
a.appendChild(r);
|
|
958
|
-
let o = document.createElement("tbody");
|
|
959
|
-
o.append(...i), this.#l.replaceChildren(n, a, o);
|
|
960
|
-
}
|
|
961
|
-
#E(e, t = !1) {
|
|
962
|
-
let n = this.#e, r = this.#p;
|
|
963
|
-
if (!n || !r || n.sparkline || this.#r < 0 || this.#r >= this.#t.length) return;
|
|
964
|
-
let i = this.#t[this.#r], a = r.xs[this.#r], o = n.series.map((e, t) => ({
|
|
965
|
-
...e,
|
|
966
|
-
color: this.#_(e, t)
|
|
967
|
-
})).filter((e) => !this.#n.has(e.key)), s = n.type === "bar" || n.type === "stacked-bar", c = this.#o.querySelector(".ar-chart__cursor"), l = [];
|
|
968
|
-
if (s) {
|
|
969
|
-
let e = r.width / Math.max(1, this.#t.length);
|
|
970
|
-
l.push(`<rect class="ar-chart__band" x="${C(a - e / 2)}" y="${r.top}" width="${C(e)}" height="${r.height}"/>`);
|
|
971
|
-
} else {
|
|
972
|
-
l.push(`<line class="ar-chart__crosshair" x1="${C(a)}" x2="${C(a)}" y1="${r.top}" y2="${r.top + r.height}"/>`);
|
|
973
|
-
for (let e of o) {
|
|
974
|
-
let t = this.#C(i, e.key);
|
|
975
|
-
t !== null && l.push(`<circle class="ar-chart__dot is-hover" style="fill:${e.color}" cx="${C(a)}" cy="${C(r.y(t))}" r="4.5"/>`);
|
|
976
|
-
}
|
|
977
|
-
}
|
|
978
|
-
c.innerHTML = l.join("");
|
|
979
|
-
let u = this.#s, d = document.createElement("p");
|
|
980
|
-
d.className = "ar-chart__tip-title", d.textContent = this.#x(i.x);
|
|
981
|
-
let f = document.createElement("dl");
|
|
982
|
-
for (let e of o) {
|
|
983
|
-
let t = this.#C(i, e.key), n = document.createElement("dt"), r = document.createElement("span");
|
|
984
|
-
r.className = "ar-chart__swatch", r.style.background = e.color, n.append(r, document.createTextNode(e.label));
|
|
985
|
-
let a = document.createElement("dd");
|
|
986
|
-
a.textContent = t === null ? "–" : this.#S(t), f.append(n, a);
|
|
987
|
-
}
|
|
988
|
-
u.replaceChildren(d, f), u.hidden = !1;
|
|
989
|
-
let p = this.#a.clientWidth || this.#i, m = u.offsetWidth || 160, h = a + 14 + m > p ? a - 14 - m : a + 14;
|
|
990
|
-
u.style.left = `${Math.max(0, h)}px`, u.style.top = `${r.top}px`, e && !t && (this.#u.textContent = `${this.#x(i.x)}: ${o.map((e) => {
|
|
991
|
-
let t = this.#C(i, e.key);
|
|
992
|
-
return `${e.label} ${t === null ? "no value" : this.#S(t)}`;
|
|
993
|
-
}).join(", ")}`);
|
|
994
|
-
}
|
|
995
|
-
#D() {
|
|
996
|
-
this.#s.hidden = !0;
|
|
997
|
-
let e = this.#o?.querySelector(".ar-chart__cursor");
|
|
998
|
-
e && (e.innerHTML = "");
|
|
999
|
-
}
|
|
1000
|
-
};
|
|
1001
|
-
function ue(e, t, n, r, i, a, o, s = !1) {
|
|
1002
|
-
if (r <= 0) return "";
|
|
1003
|
-
let c = a ? Math.min(4, n / 2, r) : 0, [l, u] = [C(e), C(e + n)];
|
|
1004
|
-
if (!s) {
|
|
1005
|
-
let e = C(t), n = C(i);
|
|
1006
|
-
return `<path class="ar-chart__bar" style="fill:${o}" d="M${l},${n}V${C(e + c)}Q${l},${e} ${C(l + c)},${e}H${C(u - c)}Q${u},${e} ${u},${C(e + c)}V${n}Z"/>`;
|
|
1007
|
-
}
|
|
1008
|
-
let d = C(t), f = C(t + r);
|
|
1009
|
-
return `<path class="ar-chart__bar" style="fill:${o}" d="M${l},${d}V${C(f - c)}Q${l},${f} ${C(l + c)},${f}H${C(u - c)}Q${u},${f} ${u},${C(f - c)}V${d}Z"/>`;
|
|
1010
|
-
}
|
|
1011
|
-
a({ tag: "a-chart" })(le);
|
|
1012
|
-
// src/kit/command-palette.ts
|
|
1013
|
-
var de = "ar-palette-recent";
|
|
1014
|
-
function fe() {
|
|
1015
|
-
try {
|
|
1016
|
-
return JSON.parse(localStorage.getItem(de) ?? "[]");
|
|
1017
|
-
} catch {
|
|
1018
|
-
return [];
|
|
1019
|
-
}
|
|
1020
|
-
}
|
|
1021
|
-
function pe(e) {
|
|
1022
|
-
try {
|
|
1023
|
-
localStorage.setItem(de, JSON.stringify(e.slice(0, 8)));
|
|
1024
|
-
} catch {}
|
|
1025
|
-
}
|
|
1026
|
-
function me(e) {
|
|
1027
|
-
return {
|
|
1028
|
-
id: `store:${e.type}`,
|
|
1029
|
-
label: e.label,
|
|
1030
|
-
limit: e.limit ?? 6,
|
|
1031
|
-
order: e.order,
|
|
1032
|
-
search: (t) => {
|
|
1033
|
-
if (!t.trim()) return [];
|
|
1034
|
-
let n = h().store.getByType(e.type);
|
|
1035
|
-
return m(t, n, (t) => [e.title(t.data), e.subtitle?.(t.data) ?? ""]).slice(0, e.limit ?? 6).map(({ item: t }) => ({
|
|
1036
|
-
id: `${e.type}:${t.id}`,
|
|
1037
|
-
title: e.title(t.data),
|
|
1038
|
-
subtitle: e.subtitle?.(t.data),
|
|
1039
|
-
icon: e.icon,
|
|
1040
|
-
run: () => e.run(t.data, String(t.id))
|
|
1041
|
-
}));
|
|
1042
|
-
}
|
|
1043
|
-
};
|
|
1044
|
-
}
|
|
1045
|
-
var he = class extends t {
|
|
1046
|
-
#e = /* @__PURE__ */ new Map();
|
|
1047
|
-
#t;
|
|
1048
|
-
#n;
|
|
1049
|
-
#r;
|
|
1050
|
-
#i;
|
|
1051
|
-
#a = [];
|
|
1052
|
-
#o = 0;
|
|
1053
|
-
#s = fe();
|
|
1054
|
-
#c = null;
|
|
1055
|
-
#l = 0;
|
|
1056
|
-
#u = !1;
|
|
1057
|
-
#d = n("ar-palette");
|
|
1058
|
-
static get observedAttributes() {
|
|
1059
|
-
return ["placeholder"];
|
|
1060
|
-
}
|
|
1061
|
-
attributeChangedCallback() {
|
|
1062
|
-
this.#u && (this.#n.placeholder = this.getAttribute("placeholder") ?? "Type a command or search…");
|
|
1063
|
-
}
|
|
1064
|
-
addSource(e) {
|
|
1065
|
-
return this.#e.set(e.id, e), this.isOpen && this.#m(), () => this.#e.delete(e.id);
|
|
1066
|
-
}
|
|
1067
|
-
removeSource(e) {
|
|
1068
|
-
this.#e.delete(e);
|
|
1069
|
-
}
|
|
1070
|
-
get isOpen() {
|
|
1071
|
-
return this.#u && this.#t.open;
|
|
1072
|
-
}
|
|
1073
|
-
onConnected() {
|
|
1074
|
-
this.#f(), this.listen(document, "keydown", (e) => {
|
|
1075
|
-
let t = e, n = this.getAttribute("hotkey") ?? "k";
|
|
1076
|
-
n && t.key.toLowerCase() === n && (t.ctrlKey || t.metaKey) && !t.altKey && !t.shiftKey && (t.preventDefault(), this.isOpen ? this.close() : this.open());
|
|
1077
|
-
});
|
|
1078
|
-
}
|
|
1079
|
-
#f() {
|
|
1080
|
-
this.#u || (this.#u = !0, this.innerHTML = `
|
|
1081
|
-
<dialog class="ar-palette" aria-label="Command palette">
|
|
1082
|
-
<div class="ar-palette__search">
|
|
1083
|
-
<svg class="ar-palette__icon" viewBox="0 0 20 20" aria-hidden="true"><circle cx="8.5" cy="8.5" r="5.5"/><path d="M12.6 12.6 17 17"/></svg>
|
|
1084
|
-
<input class="ar-palette__input" type="text" role="combobox" aria-expanded="true" aria-autocomplete="list" autocomplete="off" spellcheck="false">
|
|
1085
|
-
<kbd class="ar-palette__esc" aria-hidden="true">Esc</kbd>
|
|
1086
|
-
</div>
|
|
1087
|
-
<div class="ar-palette__list" role="listbox" id="${this.#d}-list" aria-label="Results"></div>
|
|
1088
|
-
<p class="ar-palette__status" role="status" aria-live="polite"></p>
|
|
1089
|
-
<p class="ar-palette__help" aria-hidden="true"><span><kbd>↑</kbd><kbd>↓</kbd> move</span><span><kbd>Enter</kbd> run</span><span><kbd>Esc</kbd> close</span></p>
|
|
1090
|
-
</dialog>`, this.#t = this.querySelector("dialog"), this.#n = this.querySelector("input"), this.#r = this.querySelector(".ar-palette__list"), this.#i = this.querySelector(".ar-palette__status"), this.#n.setAttribute("aria-controls", this.#r.id), this.#n.setAttribute("aria-label", "Search commands"), this.#n.placeholder = this.getAttribute("placeholder") ?? "Type a command or search…", this.listen(this.#n, "input", () => void this.#m()), this.listen(this.#n, "keydown", (e) => this.#_(e)), this.listen(this.#t, "close", () => this.#p()), this.listen(this.#t, "click", (e) => {
|
|
1091
|
-
e.target === this.#t && this.close();
|
|
1092
|
-
}), this.listen(this.#r, "mousedown", (e) => e.preventDefault()), this.listen(this.#r, "click", (e) => {
|
|
1093
|
-
let t = e.target.closest("[role=option]");
|
|
1094
|
-
t && this.#v(Number(t.dataset.index));
|
|
1095
|
-
}), this.listen(this.#r, "mousemove", (e) => {
|
|
1096
|
-
let t = e.target.closest("[role=option]");
|
|
1097
|
-
t && Number(t.dataset.index) !== this.#o && this.#g(Number(t.dataset.index), !1);
|
|
1098
|
-
}));
|
|
1099
|
-
}
|
|
1100
|
-
open(e = "") {
|
|
1101
|
-
this.isOpen || (this.#c = document.activeElement instanceof HTMLElement ? document.activeElement : null, this.#n.value = e, typeof this.#t.showModal == "function" ? this.#t.showModal() : this.#t.setAttribute("open", ""), this.#n.focus(), this.#m(), this.emit("palette:open", {}));
|
|
1102
|
-
}
|
|
1103
|
-
close() {
|
|
1104
|
-
this.isOpen && (typeof this.#t.close == "function" ? this.#t.close() : (this.#t.removeAttribute("open"), this.#p()));
|
|
1105
|
-
}
|
|
1106
|
-
#p() {
|
|
1107
|
-
this.#c?.focus?.(), this.#c = null, this.emit("palette:close", {});
|
|
1108
|
-
}
|
|
1109
|
-
async #m() {
|
|
1110
|
-
let e = ++this.#l, t = this.#n.value, n = [...this.#e.values()].sort((e, t) => (e.order ?? 0) - (t.order ?? 0)), r = [];
|
|
1111
|
-
if (t.trim()) for (let i of n) {
|
|
1112
|
-
let n = [];
|
|
1113
|
-
if (i.commands && (n = m(t, i.commands(), (e) => [e.title, [e.subtitle ?? "", ...e.keywords ?? []].join(" ")]).map(({ item: e, match: t, field: n }) => ({
|
|
1114
|
-
command: e,
|
|
1115
|
-
group: i.label,
|
|
1116
|
-
match: t,
|
|
1117
|
-
field: n
|
|
1118
|
-
}))), i.search) {
|
|
1119
|
-
let r = await i.search(t);
|
|
1120
|
-
if (e !== this.#l) return;
|
|
1121
|
-
n.push(...r.map((e) => ({
|
|
1122
|
-
command: e,
|
|
1123
|
-
group: i.label,
|
|
1124
|
-
match: m(t, [e], (e) => e.title)[0]?.match
|
|
1125
|
-
})));
|
|
1126
|
-
}
|
|
1127
|
-
r.push(...n.slice(0, i.limit ?? 8));
|
|
1128
|
-
}
|
|
1129
|
-
else {
|
|
1130
|
-
let e = /* @__PURE__ */ new Map();
|
|
1131
|
-
for (let t of n) for (let n of t.commands?.() ?? []) e.set(n.id, {
|
|
1132
|
-
command: n,
|
|
1133
|
-
group: t.label
|
|
1134
|
-
});
|
|
1135
|
-
let t = this.#s.map((t) => e.get(t)).filter((e) => !!e).slice(0, 5);
|
|
1136
|
-
r.push(...t.map((e) => ({
|
|
1137
|
-
...e,
|
|
1138
|
-
group: "Recent"
|
|
1139
|
-
})));
|
|
1140
|
-
for (let e of n) for (let n of (e.commands?.() ?? []).slice(0, e.limit ?? 8)) t.some((e) => e.command.id === n.id) || r.push({
|
|
1141
|
-
command: n,
|
|
1142
|
-
group: e.label
|
|
1143
|
-
});
|
|
1144
|
-
}
|
|
1145
|
-
e === this.#l && (this.#a = r, this.#h());
|
|
1146
|
-
}
|
|
1147
|
-
#h() {
|
|
1148
|
-
let e = /* @__PURE__ */ new Map();
|
|
1149
|
-
this.#r.replaceChildren(), this.#a.forEach((t, r) => {
|
|
1150
|
-
let i = e.get(t.group);
|
|
1151
|
-
if (!i) {
|
|
1152
|
-
i = document.createElement("div"), i.setAttribute("role", "group"), i.className = "ar-palette__group";
|
|
1153
|
-
let r = document.createElement("div");
|
|
1154
|
-
r.className = "ar-palette__heading", r.id = n("ar-palette-group"), r.textContent = t.group, r.setAttribute("role", "presentation"), i.setAttribute("aria-labelledby", r.id), i.appendChild(r), e.set(t.group, i), this.#r.appendChild(i);
|
|
1155
|
-
}
|
|
1156
|
-
let a = document.createElement("div");
|
|
1157
|
-
a.setAttribute("role", "option"), a.className = "ar-palette__option", a.id = `${this.#d}-${r}`, a.dataset.index = String(r);
|
|
1158
|
-
let { command: o } = t;
|
|
1159
|
-
if (o.icon) {
|
|
1160
|
-
let e = document.createElement("span");
|
|
1161
|
-
e.className = "ar-palette__glyph", e.setAttribute("aria-hidden", "true"), e.textContent = o.icon, a.appendChild(e);
|
|
1162
|
-
}
|
|
1163
|
-
let s = document.createElement("span");
|
|
1164
|
-
s.className = "ar-palette__text";
|
|
1165
|
-
let c = document.createElement("span");
|
|
1166
|
-
if (c.className = "ar-palette__title", c.append(...ge(o.title, t.field === 0 || t.field === void 0 ? t.match?.indices : void 0)), s.appendChild(c), o.subtitle) {
|
|
1167
|
-
let e = document.createElement("span");
|
|
1168
|
-
e.className = "ar-palette__subtitle", e.textContent = o.subtitle, s.appendChild(e);
|
|
1169
|
-
}
|
|
1170
|
-
if (a.appendChild(s), o.shortcut) {
|
|
1171
|
-
let e = document.createElement("kbd");
|
|
1172
|
-
e.className = "ar-palette__shortcut", e.textContent = o.shortcut, a.appendChild(e);
|
|
1173
|
-
}
|
|
1174
|
-
i.appendChild(a);
|
|
1175
|
-
}), this.#i.textContent = this.#a.length ? `${this.#a.length} result${this.#a.length === 1 ? "" : "s"}` : "No results", this.#r.toggleAttribute("data-empty", !this.#a.length), this.#g(0, !0);
|
|
1176
|
-
}
|
|
1177
|
-
#g(e, t) {
|
|
1178
|
-
if (!this.#a.length) this.#n.removeAttribute("aria-activedescendant");
|
|
1179
|
-
else {
|
|
1180
|
-
this.#o = Math.max(0, Math.min(this.#a.length - 1, e));
|
|
1181
|
-
for (let e of this.#r.querySelectorAll("[role=option]")) {
|
|
1182
|
-
let n = Number(e.dataset.index) === this.#o;
|
|
1183
|
-
e.setAttribute("aria-selected", String(n)), n && t && e.scrollIntoView?.({ block: "nearest" });
|
|
1184
|
-
}
|
|
1185
|
-
this.#n.setAttribute("aria-activedescendant", `${this.#d}-${this.#o}`);
|
|
1186
|
-
}
|
|
1187
|
-
}
|
|
1188
|
-
#_(e) {
|
|
1189
|
-
let t = !0;
|
|
1190
|
-
switch (e.key) {
|
|
1191
|
-
case "ArrowDown":
|
|
1192
|
-
this.#g(this.#o + 1 >= this.#a.length ? 0 : this.#o + 1, !0);
|
|
1193
|
-
break;
|
|
1194
|
-
case "ArrowUp":
|
|
1195
|
-
this.#g(this.#o - 1 < 0 ? this.#a.length - 1 : this.#o - 1, !0);
|
|
1196
|
-
break;
|
|
1197
|
-
case "PageDown":
|
|
1198
|
-
this.#g(this.#o + 5, !0);
|
|
1199
|
-
break;
|
|
1200
|
-
case "PageUp":
|
|
1201
|
-
this.#g(this.#o - 5, !0);
|
|
1202
|
-
break;
|
|
1203
|
-
case "Enter":
|
|
1204
|
-
this.#v(this.#o);
|
|
1205
|
-
break;
|
|
1206
|
-
case "Escape":
|
|
1207
|
-
this.#n.value ? (this.#n.value = "", this.#m()) : this.close();
|
|
1208
|
-
break;
|
|
1209
|
-
default: t = !1;
|
|
1210
|
-
}
|
|
1211
|
-
t && e.preventDefault();
|
|
1212
|
-
}
|
|
1213
|
-
async #v(e) {
|
|
1214
|
-
let t = this.#a[e];
|
|
1215
|
-
t && (this.#s = [t.command.id, ...this.#s.filter((e) => e !== t.command.id)], pe(this.#s), this.close(), this.emit("palette:run", { command: t.command }), await t.command.run());
|
|
1216
|
-
}
|
|
1217
|
-
};
|
|
1218
|
-
function ge(e, t) {
|
|
1219
|
-
if (!t?.length) return [document.createTextNode(e)];
|
|
1220
|
-
let n = new Set(t), r = [], i = "", a = !1, o = () => {
|
|
1221
|
-
if (i) {
|
|
1222
|
-
if (a) {
|
|
1223
|
-
let e = document.createElement("mark");
|
|
1224
|
-
e.textContent = i, r.push(e);
|
|
1225
|
-
} else r.push(document.createTextNode(i));
|
|
1226
|
-
i = "";
|
|
1227
|
-
}
|
|
1228
|
-
};
|
|
1229
|
-
for (let t = 0; t < e.length; t++) {
|
|
1230
|
-
let r = n.has(t);
|
|
1231
|
-
r !== a && (o(), a = r), i += e[t];
|
|
1232
|
-
}
|
|
1233
|
-
return o(), r;
|
|
1234
|
-
}
|
|
1235
|
-
a({ tag: "a-command-palette" })(he);
|
|
1236
|
-
// src/kit/sheet/formula.ts
|
|
1237
|
-
var w = class {
|
|
1238
|
-
code;
|
|
1239
|
-
constructor(e) {
|
|
1240
|
-
this.code = e;
|
|
1241
|
-
}
|
|
1242
|
-
toString() {
|
|
1243
|
-
return this.code;
|
|
1244
|
-
}
|
|
1245
|
-
};
|
|
1246
|
-
function T(e) {
|
|
1247
|
-
let t = 0;
|
|
1248
|
-
for (let n of e.toUpperCase()) t = t * 26 + (n.charCodeAt(0) - 64);
|
|
1249
|
-
return t - 1;
|
|
1250
|
-
}
|
|
1251
|
-
function E(e) {
|
|
1252
|
-
let t = e + 1, n = "";
|
|
1253
|
-
for (; t > 0;) {
|
|
1254
|
-
let e = (t - 1) % 26;
|
|
1255
|
-
n = String.fromCharCode(65 + e) + n, t = Math.floor((t - 1) / 26);
|
|
1256
|
-
}
|
|
1257
|
-
return n;
|
|
1258
|
-
}
|
|
1259
|
-
var D = (e, t) => `${E(t)}${e + 1}`;
|
|
1260
|
-
function O(e) {
|
|
1261
|
-
let t = /^\$?([A-Z]{1,3})\$?(\d+)$/i.exec(e);
|
|
1262
|
-
return !t || Number(t[2]) < 1 ? null : {
|
|
1263
|
-
row: Number(t[2]) - 1,
|
|
1264
|
-
col: T(t[1])
|
|
1265
|
-
};
|
|
1266
|
-
}
|
|
1267
|
-
var k = /\s*(?:(\d+\.?\d*(?:e[+-]?\d+)?|\.\d+)|"((?:[^"]|"")*)"|(\$?[A-Z]{1,3}\$?\d+)(?![A-Z(\d])|([A-Z_][A-Z0-9_.]*)|(<=|>=|<>|[-+*/^&=<>])|([(),:]))/iy;
|
|
1268
|
-
function _e(e) {
|
|
1269
|
-
let t = [];
|
|
1270
|
-
k.lastIndex = 0;
|
|
1271
|
-
let n = 0;
|
|
1272
|
-
for (; n < e.length && !/^\s*$/.test(e.slice(n));) {
|
|
1273
|
-
k.lastIndex = n;
|
|
1274
|
-
let r = k.exec(e);
|
|
1275
|
-
if (!r) throw new w("#ERROR!");
|
|
1276
|
-
if (n = k.lastIndex, r[1] !== void 0) t.push({
|
|
1277
|
-
t: "num",
|
|
1278
|
-
v: Number(r[1])
|
|
1279
|
-
});
|
|
1280
|
-
else if (r[2] !== void 0) t.push({
|
|
1281
|
-
t: "str",
|
|
1282
|
-
v: r[2].replace(/""/g, "\"")
|
|
1283
|
-
});
|
|
1284
|
-
else if (r[3] !== void 0) t.push({
|
|
1285
|
-
t: "ref",
|
|
1286
|
-
v: r[3].toUpperCase()
|
|
1287
|
-
});
|
|
1288
|
-
else if (r[4] !== void 0) {
|
|
1289
|
-
let e = r[4].toUpperCase();
|
|
1290
|
-
e === "TRUE" || e === "FALSE" ? t.push({
|
|
1291
|
-
t: "bool",
|
|
1292
|
-
v: e === "TRUE"
|
|
1293
|
-
}) : t.push({
|
|
1294
|
-
t: "name",
|
|
1295
|
-
v: e
|
|
1296
|
-
});
|
|
1297
|
-
} else r[5] === void 0 ? t.push({ t: r[6] }) : t.push({
|
|
1298
|
-
t: "op",
|
|
1299
|
-
v: r[5]
|
|
1300
|
-
});
|
|
1301
|
-
}
|
|
1302
|
-
return t;
|
|
1303
|
-
}
|
|
1304
|
-
var ve = {
|
|
1305
|
-
"=": 1,
|
|
1306
|
-
"<>": 1,
|
|
1307
|
-
"<": 1,
|
|
1308
|
-
">": 1,
|
|
1309
|
-
"<=": 1,
|
|
1310
|
-
">=": 1,
|
|
1311
|
-
"&": 2,
|
|
1312
|
-
"+": 3,
|
|
1313
|
-
"-": 3,
|
|
1314
|
-
"*": 4,
|
|
1315
|
-
"/": 4,
|
|
1316
|
-
"^": 6
|
|
1317
|
-
};
|
|
1318
|
-
function ye(e) {
|
|
1319
|
-
let t = _e(e), n = 0, r = () => t[n], i = () => t[n++], a = (e) => {
|
|
1320
|
-
let t = i();
|
|
1321
|
-
if (!t || t.t !== e) throw new w("#ERROR!");
|
|
1322
|
-
};
|
|
1323
|
-
function o() {
|
|
1324
|
-
let e = i();
|
|
1325
|
-
if (!e) throw new w("#ERROR!");
|
|
1326
|
-
switch (e.t) {
|
|
1327
|
-
case "num": return {
|
|
1328
|
-
k: "num",
|
|
1329
|
-
v: e.v
|
|
1330
|
-
};
|
|
1331
|
-
case "str": return {
|
|
1332
|
-
k: "str",
|
|
1333
|
-
v: e.v
|
|
1334
|
-
};
|
|
1335
|
-
case "bool": return {
|
|
1336
|
-
k: "bool",
|
|
1337
|
-
v: e.v
|
|
1338
|
-
};
|
|
1339
|
-
case "ref":
|
|
1340
|
-
if (r()?.t === ":") {
|
|
1341
|
-
i();
|
|
1342
|
-
let t = i();
|
|
1343
|
-
if (!t || t.t !== "ref") throw new w("#ERROR!");
|
|
1344
|
-
return {
|
|
1345
|
-
k: "range",
|
|
1346
|
-
from: e.v,
|
|
1347
|
-
to: t.v
|
|
1348
|
-
};
|
|
1349
|
-
}
|
|
1350
|
-
return {
|
|
1351
|
-
k: "ref",
|
|
1352
|
-
ref: e.v
|
|
1353
|
-
};
|
|
1354
|
-
case "name": {
|
|
1355
|
-
a("(");
|
|
1356
|
-
let t = [];
|
|
1357
|
-
if (r()?.t !== ")") for (t.push(s(0)); r()?.t === ",";) i(), t.push(s(0));
|
|
1358
|
-
return a(")"), {
|
|
1359
|
-
k: "call",
|
|
1360
|
-
name: e.v,
|
|
1361
|
-
args: t
|
|
1362
|
-
};
|
|
1363
|
-
}
|
|
1364
|
-
case "op":
|
|
1365
|
-
if (e.v === "-" || e.v === "+") return {
|
|
1366
|
-
k: "unary",
|
|
1367
|
-
op: e.v,
|
|
1368
|
-
arg: s(5)
|
|
1369
|
-
};
|
|
1370
|
-
throw new w("#ERROR!");
|
|
1371
|
-
case "(": {
|
|
1372
|
-
let e = s(0);
|
|
1373
|
-
return a(")"), e;
|
|
1374
|
-
}
|
|
1375
|
-
default: throw new w("#ERROR!");
|
|
1376
|
-
}
|
|
1377
|
-
}
|
|
1378
|
-
function s(e) {
|
|
1379
|
-
let t = o();
|
|
1380
|
-
for (;;) {
|
|
1381
|
-
let n = r();
|
|
1382
|
-
if (!n || n.t !== "op" || ve[n.v] === void 0 || ve[n.v] < e) break;
|
|
1383
|
-
i();
|
|
1384
|
-
let a = ve[n.v], o = s(n.v === "^" ? a : a + 1);
|
|
1385
|
-
t = {
|
|
1386
|
-
k: "bin",
|
|
1387
|
-
op: n.v,
|
|
1388
|
-
l: t,
|
|
1389
|
-
r: o
|
|
1390
|
-
};
|
|
1391
|
-
}
|
|
1392
|
-
return t;
|
|
1393
|
-
}
|
|
1394
|
-
let c = s(0);
|
|
1395
|
-
if (n !== t.length) throw new w("#ERROR!");
|
|
1396
|
-
return c;
|
|
1397
|
-
}
|
|
1398
|
-
function be(e, t) {
|
|
1399
|
-
let n = [], r = (e) => {
|
|
1400
|
-
switch (e.k) {
|
|
1401
|
-
case "ref":
|
|
1402
|
-
n.push(e.ref.replace(/\$/g, ""));
|
|
1403
|
-
break;
|
|
1404
|
-
case "range":
|
|
1405
|
-
n.push(...xe(e.from, e.to, t));
|
|
1406
|
-
break;
|
|
1407
|
-
case "unary":
|
|
1408
|
-
r(e.arg);
|
|
1409
|
-
break;
|
|
1410
|
-
case "bin":
|
|
1411
|
-
r(e.l), r(e.r);
|
|
1412
|
-
break;
|
|
1413
|
-
case "call": e.args.forEach(r);
|
|
1414
|
-
}
|
|
1415
|
-
};
|
|
1416
|
-
return r(e), n;
|
|
1417
|
-
}
|
|
1418
|
-
function xe(e, t, n) {
|
|
1419
|
-
let r = O(e), i = O(t);
|
|
1420
|
-
if (!r || !i) return [];
|
|
1421
|
-
let a = [], o = Math.min(Math.max(r.row, i.row), (n?.rows ?? Infinity) - 1), s = Math.min(Math.max(r.col, i.col), (n?.cols ?? Infinity) - 1);
|
|
1422
|
-
for (let e = Math.min(r.row, i.row); e <= o; e++) for (let t = Math.min(r.col, i.col); t <= s; t++) a.push(D(e, t));
|
|
1423
|
-
return a;
|
|
1424
|
-
}
|
|
1425
|
-
var A = (e) => e instanceof w;
|
|
1426
|
-
function j(e) {
|
|
1427
|
-
if (A(e) || typeof e == "number") return e;
|
|
1428
|
-
if (typeof e == "boolean") return +!!e;
|
|
1429
|
-
if (e === "") return 0;
|
|
1430
|
-
let t = Number(e);
|
|
1431
|
-
return Number.isFinite(t) ? t : new w("#VALUE!");
|
|
1432
|
-
}
|
|
1433
|
-
var M = (e) => typeof e == "boolean" ? e ? "TRUE" : "FALSE" : String(e), N = {
|
|
1434
|
-
SUM: (e) => F(e, (e) => e.reduce((e, t) => e + t, 0)),
|
|
1435
|
-
AVERAGE: (e) => F(e, (e) => e.length ? e.reduce((e, t) => e + t, 0) / e.length : new w("#DIV/0!")),
|
|
1436
|
-
MIN: (e) => F(e, (e) => e.length ? Math.min(...e) : 0),
|
|
1437
|
-
MAX: (e) => F(e, (e) => e.length ? Math.max(...e) : 0),
|
|
1438
|
-
COUNT: (e) => e.flat().filter((e) => typeof e == "number").length,
|
|
1439
|
-
ABS: ([e]) => {
|
|
1440
|
-
let t = j(P(e));
|
|
1441
|
-
return A(t) ? t : Math.abs(t);
|
|
1442
|
-
},
|
|
1443
|
-
ROUND: ([e, t]) => {
|
|
1444
|
-
let n = j(P(e)), r = t === void 0 ? 0 : j(P(t));
|
|
1445
|
-
if (A(n)) return n;
|
|
1446
|
-
if (A(r)) return r;
|
|
1447
|
-
let i = 10 ** Math.trunc(r);
|
|
1448
|
-
return Math.round(n * i) / i;
|
|
1449
|
-
},
|
|
1450
|
-
IF: ([e, t, n]) => {
|
|
1451
|
-
let r = P(e);
|
|
1452
|
-
return A(r) ? r : P((typeof r == "string" ? r !== "" : r) ? t ?? !0 : n ?? !1);
|
|
1453
|
-
},
|
|
1454
|
-
CONCAT: (e) => {
|
|
1455
|
-
let t = e.flat();
|
|
1456
|
-
return t.find(A) ?? t.map(M).join("");
|
|
1457
|
-
}
|
|
1458
|
-
};
|
|
1459
|
-
N.AVG = N.AVERAGE;
|
|
1460
|
-
function P(e) {
|
|
1461
|
-
return e === void 0 ? "" : Array.isArray(e) ? new w("#VALUE!") : e;
|
|
1462
|
-
}
|
|
1463
|
-
function F(e, t) {
|
|
1464
|
-
let n = [];
|
|
1465
|
-
for (let t of e) if (Array.isArray(t)) for (let e of t) {
|
|
1466
|
-
if (A(e)) return e;
|
|
1467
|
-
typeof e == "number" && n.push(e);
|
|
1468
|
-
}
|
|
1469
|
-
else {
|
|
1470
|
-
let e = j(t);
|
|
1471
|
-
if (A(e)) return e;
|
|
1472
|
-
n.push(e);
|
|
1473
|
-
}
|
|
1474
|
-
return t(n);
|
|
1475
|
-
}
|
|
1476
|
-
function I(e, t) {
|
|
1477
|
-
let n = (e) => {
|
|
1478
|
-
let n = O(e);
|
|
1479
|
-
return !n || n.row >= t.rows || n.col >= t.cols ? new w("#REF!") : t.get(e.replace(/\$/g, ""));
|
|
1480
|
-
}, r = (e) => {
|
|
1481
|
-
if (e.k !== "range") return I(e, t);
|
|
1482
|
-
for (let n of [e.from, e.to]) {
|
|
1483
|
-
let e = O(n);
|
|
1484
|
-
if (!e || e.row >= t.rows || e.col >= t.cols) return new w("#REF!");
|
|
1485
|
-
}
|
|
1486
|
-
return xe(e.from, e.to).map(n);
|
|
1487
|
-
};
|
|
1488
|
-
switch (e.k) {
|
|
1489
|
-
case "num": return e.v;
|
|
1490
|
-
case "str": return e.v;
|
|
1491
|
-
case "bool": return e.v;
|
|
1492
|
-
case "ref": return n(e.ref);
|
|
1493
|
-
case "range": return new w("#VALUE!");
|
|
1494
|
-
case "unary": {
|
|
1495
|
-
let n = j(I(e.arg, t));
|
|
1496
|
-
return A(n) ? n : e.op === "-" ? -n : n;
|
|
1497
|
-
}
|
|
1498
|
-
case "call": {
|
|
1499
|
-
let t = N[e.name];
|
|
1500
|
-
return t ? t(e.args.map(r)) : new w("#NAME?");
|
|
1501
|
-
}
|
|
1502
|
-
case "bin": {
|
|
1503
|
-
let n = I(e.l, t), r = I(e.r, t);
|
|
1504
|
-
if (A(n)) return n;
|
|
1505
|
-
if (A(r)) return r;
|
|
1506
|
-
if (e.op === "&") return M(n) + M(r);
|
|
1507
|
-
if ([
|
|
1508
|
-
"=",
|
|
1509
|
-
"<>",
|
|
1510
|
-
"<",
|
|
1511
|
-
">",
|
|
1512
|
-
"<=",
|
|
1513
|
-
">="
|
|
1514
|
-
].includes(e.op)) {
|
|
1515
|
-
let t = typeof n == "number" && typeof r == "number", i = t ? n : M(n).toLowerCase(), a = t ? r : M(r).toLowerCase();
|
|
1516
|
-
switch (e.op) {
|
|
1517
|
-
case "=": return i === a;
|
|
1518
|
-
case "<>": return i !== a;
|
|
1519
|
-
case "<": return i < a;
|
|
1520
|
-
case ">": return i > a;
|
|
1521
|
-
case "<=": return i <= a;
|
|
1522
|
-
default: return i >= a;
|
|
1523
|
-
}
|
|
1524
|
-
}
|
|
1525
|
-
let i = j(n), a = j(r);
|
|
1526
|
-
if (A(i)) return i;
|
|
1527
|
-
if (A(a)) return a;
|
|
1528
|
-
switch (e.op) {
|
|
1529
|
-
case "+": return i + a;
|
|
1530
|
-
case "-": return i - a;
|
|
1531
|
-
case "*": return i * a;
|
|
1532
|
-
case "/": return a === 0 ? new w("#DIV/0!") : i / a;
|
|
1533
|
-
default: return i ** a;
|
|
1534
|
-
}
|
|
1535
|
-
}
|
|
1536
|
-
}
|
|
1537
|
-
}
|
|
1538
|
-
function L(e, t, n) {
|
|
1539
|
-
return e.startsWith("=") ? e.replace(/"(?:[^"]|"")*"|(\$?)([A-Z]{1,3})(\$?)(\d+)(?![A-Z(\d])/gi, (e, r, i, a, o) => {
|
|
1540
|
-
if (i === void 0) return e;
|
|
1541
|
-
let s = r ? T(i) : T(i) + n, c = a ? Number(o) - 1 : Number(o) - 1 + t;
|
|
1542
|
-
return s < 0 || c < 0 ? "#REF!" : `${r}${E(s)}${a}${c + 1}`;
|
|
1543
|
-
}) : e;
|
|
1544
|
-
}
|
|
1545
|
-
// src/kit/sheet/model.ts
|
|
1546
|
-
var Se = class {
|
|
1547
|
-
rows;
|
|
1548
|
-
cols;
|
|
1549
|
-
raw = /* @__PURE__ */ new Map();
|
|
1550
|
-
values = /* @__PURE__ */ new Map();
|
|
1551
|
-
asts = /* @__PURE__ */ new Map();
|
|
1552
|
-
deps = /* @__PURE__ */ new Map();
|
|
1553
|
-
readers = /* @__PURE__ */ new Map();
|
|
1554
|
-
constructor(e, t) {
|
|
1555
|
-
this.rows = e, this.cols = t;
|
|
1556
|
-
}
|
|
1557
|
-
getRaw(e) {
|
|
1558
|
-
return this.raw.get(e) ?? "";
|
|
1559
|
-
}
|
|
1560
|
-
getValue(e) {
|
|
1561
|
-
return this.values.get(e) ?? "";
|
|
1562
|
-
}
|
|
1563
|
-
entries() {
|
|
1564
|
-
return [...this.raw.entries()];
|
|
1565
|
-
}
|
|
1566
|
-
set(e) {
|
|
1567
|
-
let t = /* @__PURE__ */ new Set();
|
|
1568
|
-
for (let [n, r] of Object.entries(e)) r === "" ? this.raw.delete(n) : this.raw.set(n, r), this.asts.delete(n), this.link(n), t.add(n);
|
|
1569
|
-
return this.recalculate(t);
|
|
1570
|
-
}
|
|
1571
|
-
parsed(e) {
|
|
1572
|
-
let t = this.getRaw(e);
|
|
1573
|
-
if (!t.startsWith("=")) return null;
|
|
1574
|
-
let n = this.asts.get(e);
|
|
1575
|
-
if (!n) {
|
|
1576
|
-
try {
|
|
1577
|
-
n = t.includes("#REF!") ? new w("#REF!") : ye(t.slice(1));
|
|
1578
|
-
} catch (e) {
|
|
1579
|
-
n = e instanceof w ? e : new w("#ERROR!");
|
|
1580
|
-
}
|
|
1581
|
-
this.asts.set(e, n);
|
|
1582
|
-
}
|
|
1583
|
-
return n;
|
|
1584
|
-
}
|
|
1585
|
-
link(e) {
|
|
1586
|
-
for (let t of this.deps.get(e) ?? []) this.readers.get(t)?.delete(e);
|
|
1587
|
-
let t = this.parsed(e), n = t && !(t instanceof w) ? new Set(be(t, this)) : /* @__PURE__ */ new Set();
|
|
1588
|
-
this.deps.set(e, n);
|
|
1589
|
-
for (let t of n) this.readers.has(t) || this.readers.set(t, /* @__PURE__ */ new Set()), this.readers.get(t).add(e);
|
|
1590
|
-
}
|
|
1591
|
-
recalculate(e) {
|
|
1592
|
-
let t = /* @__PURE__ */ new Set(), n = [...e];
|
|
1593
|
-
for (; n.length;) {
|
|
1594
|
-
let e = n.pop();
|
|
1595
|
-
if (!t.has(e)) {
|
|
1596
|
-
t.add(e);
|
|
1597
|
-
for (let t of this.readers.get(e) ?? []) n.push(t);
|
|
1598
|
-
}
|
|
1599
|
-
}
|
|
1600
|
-
let r = /* @__PURE__ */ new Map();
|
|
1601
|
-
for (let e of t) {
|
|
1602
|
-
let n = 0;
|
|
1603
|
-
for (let r of this.deps.get(e) ?? []) t.has(r) && n++;
|
|
1604
|
-
r.set(e, n);
|
|
1605
|
-
}
|
|
1606
|
-
let i = [...t].filter((e) => r.get(e) === 0), a = /* @__PURE__ */ new Set(), o = /* @__PURE__ */ new Set();
|
|
1607
|
-
for (; i.length;) {
|
|
1608
|
-
let e = i.pop();
|
|
1609
|
-
o.add(e), this.compute(e) && a.add(e);
|
|
1610
|
-
for (let n of this.readers.get(e) ?? []) {
|
|
1611
|
-
if (!t.has(n)) continue;
|
|
1612
|
-
let e = r.get(n) - 1;
|
|
1613
|
-
r.set(n, e), e === 0 && i.push(n);
|
|
1614
|
-
}
|
|
1615
|
-
}
|
|
1616
|
-
for (let e of t) {
|
|
1617
|
-
if (o.has(e)) continue;
|
|
1618
|
-
let t = this.values.get(e), n = new w("#CYCLE!");
|
|
1619
|
-
this.values.set(e, n), t instanceof w && t.code === "#CYCLE!" || a.add(e);
|
|
1620
|
-
}
|
|
1621
|
-
return a;
|
|
1622
|
-
}
|
|
1623
|
-
compute(e) {
|
|
1624
|
-
let t = this.values.get(e), n, r = this.parsed(e);
|
|
1625
|
-
if (r === null) {
|
|
1626
|
-
let t = this.getRaw(e), r = t.trim() === "" ? NaN : Number(t.replace(/,/g, ""));
|
|
1627
|
-
n = t === "" ? "" : Number.isFinite(r) ? r : t.toUpperCase() === "TRUE" || t.toUpperCase() !== "FALSE" && t;
|
|
1628
|
-
} else n = r instanceof w ? r : I(r, {
|
|
1629
|
-
get: (e) => this.getValue(e),
|
|
1630
|
-
rows: this.rows,
|
|
1631
|
-
cols: this.cols
|
|
1632
|
-
});
|
|
1633
|
-
return n === "" ? this.values.delete(e) : this.values.set(e, n), !(t instanceof w && n instanceof w ? t.code === n.code : t === n || t === void 0 && n === "");
|
|
1634
|
-
}
|
|
1635
|
-
}, R = 32, Ce = 8, z = "application/x-arethesis-sheet", we = {
|
|
1636
|
-
"#REF!": "Refers to a cell outside the sheet",
|
|
1637
|
-
"#DIV/0!": "Divides by zero",
|
|
1638
|
-
"#VALUE!": "Uses text where a number is needed",
|
|
1639
|
-
"#NAME?": "Unknown function",
|
|
1640
|
-
"#CYCLE!": "Refers to itself, directly or through other cells",
|
|
1641
|
-
"#ERROR!": "Can't read this formula"
|
|
1642
|
-
}, Te = class extends t {
|
|
1643
|
-
#e = {
|
|
1644
|
-
rows: 100,
|
|
1645
|
-
cols: 10,
|
|
1646
|
-
label: "Spreadsheet"
|
|
1647
|
-
};
|
|
1648
|
-
#t = new Se(100, 10);
|
|
1649
|
-
#n = {
|
|
1650
|
-
row: 0,
|
|
1651
|
-
col: 0
|
|
1652
|
-
};
|
|
1653
|
-
#r = {
|
|
1654
|
-
row: 0,
|
|
1655
|
-
col: 0
|
|
1656
|
-
};
|
|
1657
|
-
#i = null;
|
|
1658
|
-
#a = [];
|
|
1659
|
-
#o = [];
|
|
1660
|
-
#s = /* @__PURE__ */ new Map();
|
|
1661
|
-
#c = n("ar-sheet");
|
|
1662
|
-
#l = !1;
|
|
1663
|
-
#u = 0;
|
|
1664
|
-
#d;
|
|
1665
|
-
#f;
|
|
1666
|
-
#p;
|
|
1667
|
-
#m;
|
|
1668
|
-
#h;
|
|
1669
|
-
#g;
|
|
1670
|
-
#_ = null;
|
|
1671
|
-
configure(e) {
|
|
1672
|
-
this.#e = {
|
|
1673
|
-
rows: 100,
|
|
1674
|
-
cols: 10,
|
|
1675
|
-
label: "Spreadsheet",
|
|
1676
|
-
...e
|
|
1677
|
-
}, this.#t = new Se(this.#e.rows, this.#e.cols), e.cells && this.#t.set(e.cells), this.#a = [], this.#o = [], this.isConnected && this.#b(), this.#x();
|
|
1678
|
-
}
|
|
1679
|
-
get model() {
|
|
1680
|
-
return this.#t;
|
|
1681
|
-
}
|
|
1682
|
-
get active() {
|
|
1683
|
-
return D(this.#n.row, this.#n.col);
|
|
1684
|
-
}
|
|
1685
|
-
get selection() {
|
|
1686
|
-
let { r0: e, r1: t, c0: n, c1: r } = this.#C(), i = D(e, n), a = D(t, r);
|
|
1687
|
-
return i === a ? i : `${i}:${a}`;
|
|
1688
|
-
}
|
|
1689
|
-
getValue(e) {
|
|
1690
|
-
return this.#t.getValue(e);
|
|
1691
|
-
}
|
|
1692
|
-
setCells(e, t = {}) {
|
|
1693
|
-
let n = Object.fromEntries(Object.entries(e).filter(([e]) => this.#v(e)));
|
|
1694
|
-
if (Object.keys(n).length) {
|
|
1695
|
-
if (t.remote) {
|
|
1696
|
-
let e = Date.now() + 1500;
|
|
1697
|
-
for (let r of Object.keys(n)) if (this.#t.getRaw(r) !== n[r]) {
|
|
1698
|
-
this.#s.set(r, {
|
|
1699
|
-
by: t.by,
|
|
1700
|
-
until: e
|
|
1701
|
-
});
|
|
1702
|
-
for (let e of [this.#a, this.#o]) for (let t of e) delete t[r];
|
|
1703
|
-
}
|
|
1704
|
-
this.#t.set(n), setTimeout(() => this.#x(), 1600);
|
|
1705
|
-
} else this.#y(n);
|
|
1706
|
-
this.#x();
|
|
1707
|
-
}
|
|
1708
|
-
}
|
|
1709
|
-
select(e, t = !1) {
|
|
1710
|
-
let n = O(e);
|
|
1711
|
-
n && this.#v(e) && this.#E(n, t);
|
|
1712
|
-
}
|
|
1713
|
-
#v(e) {
|
|
1714
|
-
let t = O(e);
|
|
1715
|
-
return !!t && t.row < this.#e.rows && t.col < this.#e.cols;
|
|
1716
|
-
}
|
|
1717
|
-
#y(e, t = !0) {
|
|
1718
|
-
let n = {};
|
|
1719
|
-
for (let [t, r] of Object.entries(e)) {
|
|
1720
|
-
let e = this.#t.getRaw(t);
|
|
1721
|
-
e !== r && (n[t] = [e, r]);
|
|
1722
|
-
}
|
|
1723
|
-
let r = Object.fromEntries(Object.entries(n).map(([e, [, t]]) => [e, t]));
|
|
1724
|
-
Object.keys(r).length && (t && (this.#a.push(n), this.#a.length > 200 && this.#a.shift(), this.#o = []), this.#t.set(r), this.emit("sheet:change", { changes: r }), this.#x());
|
|
1725
|
-
}
|
|
1726
|
-
undo() {
|
|
1727
|
-
let t = this.#a.pop();
|
|
1728
|
-
return !t || !Object.keys(t).length ? !!t && this.undo() : (this.#o.push(t), this.#y(Object.fromEntries(Object.entries(t).map(([e, [t]]) => [e, t])), !1), e("Undone"), !0);
|
|
1729
|
-
}
|
|
1730
|
-
redo() {
|
|
1731
|
-
let t = this.#o.pop();
|
|
1732
|
-
return !t || !Object.keys(t).length ? !!t && this.redo() : (this.#a.push(t), this.#y(Object.fromEntries(Object.entries(t).map(([e, [, t]]) => [e, t])), !1), e("Redone"), !0);
|
|
1733
|
-
}
|
|
1734
|
-
onConnected() {
|
|
1735
|
-
this.#b(), this.listen(window, "resize", () => this.#x()), this.#x();
|
|
1736
|
-
}
|
|
1737
|
-
onDisconnected() {
|
|
1738
|
-
cancelAnimationFrame(this.#u), this.#u = 0;
|
|
1739
|
-
}
|
|
1740
|
-
#b() {
|
|
1741
|
-
let e = this.#e;
|
|
1742
|
-
this.#l || (this.#l = !0, this.classList.add("ar-sheet"), this.innerHTML = "\n <div class=\"ar-sheet__bar\">\n <span class=\"ar-sheet__name\" aria-live=\"polite\"></span>\n <span class=\"ar-sheet__fx\" aria-hidden=\"true\">ƒx</span>\n <input class=\"ar-sheet__formula\" type=\"text\" spellcheck=\"false\" autocomplete=\"off\">\n </div>\n <div class=\"ar-sheet__scroll\">\n <table class=\"ar-sheet__table\" role=\"grid\" tabindex=\"0\">\n <thead><tr class=\"ar-sheet__head\" role=\"row\"></tr></thead>\n <tbody></tbody>\n </table>\n </div>", this.#h = this.querySelector(".ar-sheet__name"), this.#g = this.querySelector(".ar-sheet__formula"), this.#d = this.querySelector(".ar-sheet__scroll"), this.#f = this.querySelector(".ar-sheet__table"), this.#p = this.#f.querySelector("tbody"), this.#m = this.#f.querySelector(".ar-sheet__head"), this.#F()), this.#f.setAttribute("aria-label", e.label), this.#f.setAttribute("aria-rowcount", String(e.rows + 1)), this.#f.setAttribute("aria-colcount", String(e.cols + 1)), this.#g.setAttribute("aria-label", "Cell contents (formula bar)");
|
|
1743
|
-
let t = Array.from({ length: e.cols }, (t, n) => {
|
|
1744
|
-
let r = E(n), i = e.widths?.[r] ?? 120;
|
|
1745
|
-
return `<th role="columnheader" scope="col" aria-colindex="${n + 2}" style="width:${i}px;min-width:${i}px" data-col="${n}">${r}</th>`;
|
|
1746
|
-
}).join("");
|
|
1747
|
-
this.#m.innerHTML = `<th class="ar-sheet__corner" role="columnheader" aria-colindex="1"><span class="ar-visually-hidden">Row</span></th>${t}`;
|
|
1748
|
-
}
|
|
1749
|
-
#x() {
|
|
1750
|
-
if (this.#u || !this.#l) return;
|
|
1751
|
-
let e = () => {
|
|
1752
|
-
this.#u = 0, this.#T();
|
|
1753
|
-
};
|
|
1754
|
-
this.#u = typeof requestAnimationFrame == "function" ? requestAnimationFrame(e) : setTimeout(e, 0);
|
|
1755
|
-
}
|
|
1756
|
-
redraw() {
|
|
1757
|
-
cancelAnimationFrame(this.#u), this.#u = 0, this.#T();
|
|
1758
|
-
}
|
|
1759
|
-
#S(e, t) {
|
|
1760
|
-
return `${this.#c}-${D(e, t)}`;
|
|
1761
|
-
}
|
|
1762
|
-
#C() {
|
|
1763
|
-
return {
|
|
1764
|
-
r0: Math.min(this.#n.row, this.#r.row),
|
|
1765
|
-
r1: Math.max(this.#n.row, this.#r.row),
|
|
1766
|
-
c0: Math.min(this.#n.col, this.#r.col),
|
|
1767
|
-
c1: Math.max(this.#n.col, this.#r.col)
|
|
1768
|
-
};
|
|
1769
|
-
}
|
|
1770
|
-
#w(e) {
|
|
1771
|
-
let t = this.#t.getValue(e);
|
|
1772
|
-
return t instanceof w ? {
|
|
1773
|
-
text: t.code,
|
|
1774
|
-
kind: "error",
|
|
1775
|
-
title: we[t.code]
|
|
1776
|
-
} : typeof t == "number" ? {
|
|
1777
|
-
text: this.#e.formatNumber?.(t, e) ?? new Intl.NumberFormat(void 0, { maximumFractionDigits: 2 }).format(t),
|
|
1778
|
-
kind: "number"
|
|
1779
|
-
} : typeof t == "boolean" ? {
|
|
1780
|
-
text: t ? "TRUE" : "FALSE",
|
|
1781
|
-
kind: "bool"
|
|
1782
|
-
} : {
|
|
1783
|
-
text: t,
|
|
1784
|
-
kind: "text"
|
|
1785
|
-
};
|
|
1786
|
-
}
|
|
1787
|
-
#T() {
|
|
1788
|
-
let e = this.#e, t = this.#d.scrollTop, n = this.#d.clientHeight || 400, r = Math.max(0, Math.floor(t / R) - Ce), i = Math.min(e.rows - 1, Math.ceil((t + n) / R) + Ce), a = [];
|
|
1789
|
-
for (let e = r; e <= i; e++) a.push(e);
|
|
1790
|
-
(this.#n.row < r || this.#n.row > i) && a.push(this.#n.row), a.sort((e, t) => e - t);
|
|
1791
|
-
let { r0: o, r1: s, c0: c, c1: l } = this.#C(), u = Date.now(), d = document.createDocumentFragment(), f = 0, p = (e) => {
|
|
1792
|
-
if (e <= 0) return;
|
|
1793
|
-
let t = document.createElement("tr");
|
|
1794
|
-
t.className = "ar-sheet__spacer", t.setAttribute("aria-hidden", "true"), t.style.height = `${e * R}px`, d.appendChild(t);
|
|
1795
|
-
};
|
|
1796
|
-
for (let t of a) {
|
|
1797
|
-
p(t - f), f = t + 1;
|
|
1798
|
-
let n = document.createElement("tr");
|
|
1799
|
-
n.setAttribute("role", "row"), n.setAttribute("aria-rowindex", String(t + 2));
|
|
1800
|
-
let r = document.createElement("th");
|
|
1801
|
-
r.setAttribute("role", "rowheader"), r.setAttribute("aria-colindex", "1"), r.className = "ar-sheet__rowhead", r.textContent = String(t + 1), t >= o && t <= s && r.classList.add("is-selected"), n.appendChild(r);
|
|
1802
|
-
for (let r = 0; r < e.cols; r++) {
|
|
1803
|
-
let i = D(t, r), a = document.createElement("td");
|
|
1804
|
-
a.id = this.#S(t, r), a.setAttribute("role", "gridcell"), a.setAttribute("aria-colindex", String(r + 2)), a.dataset.addr = i;
|
|
1805
|
-
let d = this.#w(i);
|
|
1806
|
-
a.textContent = d.text, a.dataset.kind = d.kind, d.title && (a.title = `${d.text}: ${d.title}`), t >= o && t <= s && r >= c && r <= l && a.setAttribute("aria-selected", "true"), t === this.#n.row && r === this.#n.col && a.classList.add("is-active"), e.readOnly?.(i) && a.setAttribute("aria-readonly", "true"), this.#t.getRaw(i).startsWith("=") && a.classList.add("is-formula");
|
|
1807
|
-
let f = this.#s.get(i);
|
|
1808
|
-
f && f.until > u ? (a.classList.add("is-remote"), f.by && (a.dataset.by = f.by)) : f && this.#s.delete(i), n.appendChild(a);
|
|
1809
|
-
}
|
|
1810
|
-
d.appendChild(n);
|
|
1811
|
-
}
|
|
1812
|
-
p(e.rows - f), this.#p.replaceChildren(d);
|
|
1813
|
-
for (let e of this.#m.querySelectorAll("[data-col]")) {
|
|
1814
|
-
let t = Number(e.dataset.col);
|
|
1815
|
-
e.classList.toggle("is-selected", t >= c && t <= l);
|
|
1816
|
-
}
|
|
1817
|
-
this.#f.setAttribute("aria-activedescendant", this.#S(this.#n.row, this.#n.col)), this.#h.textContent = this.selection, document.activeElement !== this.#g && (this.#g.value = this.#t.getRaw(this.active)), this.#i?.reposition();
|
|
1818
|
-
}
|
|
1819
|
-
#E(e, t = !1) {
|
|
1820
|
-
let n = this.#e, r = {
|
|
1821
|
-
row: Math.max(0, Math.min(n.rows - 1, e.row)),
|
|
1822
|
-
col: Math.max(0, Math.min(n.cols - 1, e.col))
|
|
1823
|
-
};
|
|
1824
|
-
this.#n = r, t || (this.#r = { ...r }), this.#D(r), this.redraw(), this.emit("sheet:select", {
|
|
1825
|
-
active: this.active,
|
|
1826
|
-
range: this.selection
|
|
1827
|
-
});
|
|
1828
|
-
}
|
|
1829
|
-
#D(e) {
|
|
1830
|
-
let t = this.#d, n = this.#m.offsetHeight || R, r = e.row * R;
|
|
1831
|
-
r < t.scrollTop ? t.scrollTop = r : r + R > t.scrollTop + t.clientHeight - n && (t.scrollTop = r + R - t.clientHeight + n);
|
|
1832
|
-
let i = this.#m.querySelector(`[data-col="${e.col}"]`), a = this.#m.querySelector(".ar-sheet__corner");
|
|
1833
|
-
if (i) {
|
|
1834
|
-
let e = i.offsetLeft - (a?.offsetWidth ?? 0);
|
|
1835
|
-
e < t.scrollLeft ? t.scrollLeft = e : i.offsetLeft + i.offsetWidth > t.scrollLeft + t.clientWidth && (t.scrollLeft = i.offsetLeft + i.offsetWidth - t.clientWidth);
|
|
1836
|
-
}
|
|
1837
|
-
}
|
|
1838
|
-
#O(t, n, r) {
|
|
1839
|
-
if (this.#i && !this.#i.closed) return;
|
|
1840
|
-
let i = this.active;
|
|
1841
|
-
if (this.#e.readOnly?.(i)) {
|
|
1842
|
-
e(`${i} is read only`);
|
|
1843
|
-
return;
|
|
1844
|
-
}
|
|
1845
|
-
this.redraw();
|
|
1846
|
-
let a = this.querySelector(`#${CSS.escape(this.#S(this.#n.row, this.#n.col))}`);
|
|
1847
|
-
a && (this.#i = g({
|
|
1848
|
-
cell: a,
|
|
1849
|
-
host: this.#d,
|
|
1850
|
-
value: this.#t.getRaw(i),
|
|
1851
|
-
label: i,
|
|
1852
|
-
mode: t === "type" ? "enter" : "edit",
|
|
1853
|
-
initialText: t === "type" ? n : void 0,
|
|
1854
|
-
caret: r ?? "end",
|
|
1855
|
-
enterMoves: "down",
|
|
1856
|
-
commit: (e) => this.#y({ [i]: e }),
|
|
1857
|
-
onClose: ({ move: e, reason: t }) => {
|
|
1858
|
-
this.#i = null, t === "blur" ? this.redraw() : (this.#f.focus(), this.#k(e));
|
|
1859
|
-
}
|
|
1860
|
-
}));
|
|
1861
|
-
}
|
|
1862
|
-
#k(e, t = !1) {
|
|
1863
|
-
let n = {
|
|
1864
|
-
up: [-1, 0],
|
|
1865
|
-
down: [1, 0],
|
|
1866
|
-
left: [0, -1],
|
|
1867
|
-
right: [0, 1],
|
|
1868
|
-
none: [0, 0]
|
|
1869
|
-
}[e];
|
|
1870
|
-
this.#E({
|
|
1871
|
-
row: this.#n.row + n[0],
|
|
1872
|
-
col: this.#n.col + n[1]
|
|
1873
|
-
}, t);
|
|
1874
|
-
}
|
|
1875
|
-
#A() {
|
|
1876
|
-
let { r0: t, r1: n, c0: r, c1: i } = this.#C(), a = {};
|
|
1877
|
-
for (let e = t; e <= n; e++) for (let t = r; t <= i; t++) {
|
|
1878
|
-
let n = D(e, t);
|
|
1879
|
-
this.#e.readOnly?.(n) || (a[n] = "");
|
|
1880
|
-
}
|
|
1881
|
-
this.#y(a), e(`Cleared ${this.selection}`);
|
|
1882
|
-
}
|
|
1883
|
-
#j(t) {
|
|
1884
|
-
let { r0: n, r1: r, c0: i, c1: a } = this.#C(), o = {};
|
|
1885
|
-
for (let e = n; e <= r; e++) for (let r = i; r <= a; r++) {
|
|
1886
|
-
if (t === "down" ? e === n : r === i) continue;
|
|
1887
|
-
let a = t === "down" ? D(n, r) : D(e, i), s = D(e, r);
|
|
1888
|
-
this.#e.readOnly?.(s) || (o[s] = L(this.#t.getRaw(a), t === "down" ? e - n : 0, t === "right" ? r - i : 0));
|
|
1889
|
-
}
|
|
1890
|
-
this.#y(o), e(`Filled ${this.selection}`);
|
|
1891
|
-
}
|
|
1892
|
-
#M() {
|
|
1893
|
-
let { r0: e, r1: t, c0: n, c1: r } = this.#C(), i = [], a = [];
|
|
1894
|
-
for (let o = e; o <= t; o++) {
|
|
1895
|
-
let e = [], t = [];
|
|
1896
|
-
for (let i = n; i <= r; i++) {
|
|
1897
|
-
let n = D(o, i);
|
|
1898
|
-
e.push(this.#w(n).text), t.push(this.#t.getRaw(n));
|
|
1899
|
-
}
|
|
1900
|
-
i.push(e.join(" ")), a.push(t);
|
|
1901
|
-
}
|
|
1902
|
-
return {
|
|
1903
|
-
text: i.join("\n"),
|
|
1904
|
-
json: JSON.stringify({
|
|
1905
|
-
origin: {
|
|
1906
|
-
row: e,
|
|
1907
|
-
col: n
|
|
1908
|
-
},
|
|
1909
|
-
raws: a
|
|
1910
|
-
})
|
|
1911
|
-
};
|
|
1912
|
-
}
|
|
1913
|
-
#N(t) {
|
|
1914
|
-
let { row: n, col: r } = this.#n, i = {}, a, o = null;
|
|
1915
|
-
try {
|
|
1916
|
-
let e = JSON.parse(t.getData(z));
|
|
1917
|
-
a = e.raws, o = e.origin;
|
|
1918
|
-
} catch {
|
|
1919
|
-
a = t.getData("text/plain").replace(/\r\n?/g, "\n").replace(/\n$/, "").split("\n").map((e) => e.split(" "));
|
|
1920
|
-
}
|
|
1921
|
-
a.forEach((e, t) => e.forEach((e, a) => {
|
|
1922
|
-
let s = D(n + t, r + a);
|
|
1923
|
-
this.#v(s) && !this.#e.readOnly?.(s) && (i[s] = o ? L(String(e), n - o.row, r - o.col) : String(e).trim());
|
|
1924
|
-
})), this.#y(i), this.#r = {
|
|
1925
|
-
row: Math.min(this.#e.rows - 1, n + a.length - 1),
|
|
1926
|
-
col: Math.min(this.#e.cols - 1, r + Math.max(...a.map((e) => e.length)) - 1)
|
|
1927
|
-
}, this.redraw(), e(`Pasted into ${this.selection}`);
|
|
1928
|
-
}
|
|
1929
|
-
#P(e) {
|
|
1930
|
-
let t = e?.closest?.("td[data-addr]");
|
|
1931
|
-
return t ? O(t.dataset.addr) : null;
|
|
1932
|
-
}
|
|
1933
|
-
#F() {
|
|
1934
|
-
let t = this.#f;
|
|
1935
|
-
this.listen(this.#d, "scroll", () => this.#x(), { passive: !0 }), this.listen(t, "keydown", (e) => {
|
|
1936
|
-
let n = e;
|
|
1937
|
-
if (n.target !== t) return;
|
|
1938
|
-
let r = n.ctrlKey || n.metaKey, i = Math.max(1, Math.floor((this.#d.clientHeight || 400) / R) - 1), { row: a, col: o } = this.#n, s = this.#e, c = !0;
|
|
1939
|
-
switch (n.key) {
|
|
1940
|
-
case "ArrowUp":
|
|
1941
|
-
this.#E({
|
|
1942
|
-
row: r ? 0 : a - 1,
|
|
1943
|
-
col: o
|
|
1944
|
-
}, n.shiftKey);
|
|
1945
|
-
break;
|
|
1946
|
-
case "ArrowDown":
|
|
1947
|
-
this.#E({
|
|
1948
|
-
row: r ? s.rows - 1 : a + 1,
|
|
1949
|
-
col: o
|
|
1950
|
-
}, n.shiftKey);
|
|
1951
|
-
break;
|
|
1952
|
-
case "ArrowLeft":
|
|
1953
|
-
this.#E({
|
|
1954
|
-
row: a,
|
|
1955
|
-
col: r ? 0 : o - 1
|
|
1956
|
-
}, n.shiftKey);
|
|
1957
|
-
break;
|
|
1958
|
-
case "ArrowRight":
|
|
1959
|
-
this.#E({
|
|
1960
|
-
row: a,
|
|
1961
|
-
col: r ? s.cols - 1 : o + 1
|
|
1962
|
-
}, n.shiftKey);
|
|
1963
|
-
break;
|
|
1964
|
-
case "PageUp":
|
|
1965
|
-
this.#E({
|
|
1966
|
-
row: a - i,
|
|
1967
|
-
col: o
|
|
1968
|
-
}, n.shiftKey);
|
|
1969
|
-
break;
|
|
1970
|
-
case "PageDown":
|
|
1971
|
-
this.#E({
|
|
1972
|
-
row: a + i,
|
|
1973
|
-
col: o
|
|
1974
|
-
}, n.shiftKey);
|
|
1975
|
-
break;
|
|
1976
|
-
case "Home":
|
|
1977
|
-
this.#E(r ? {
|
|
1978
|
-
row: 0,
|
|
1979
|
-
col: 0
|
|
1980
|
-
} : {
|
|
1981
|
-
row: a,
|
|
1982
|
-
col: 0
|
|
1983
|
-
}, n.shiftKey);
|
|
1984
|
-
break;
|
|
1985
|
-
case "End":
|
|
1986
|
-
this.#E(r ? {
|
|
1987
|
-
row: s.rows - 1,
|
|
1988
|
-
col: s.cols - 1
|
|
1989
|
-
} : {
|
|
1990
|
-
row: a,
|
|
1991
|
-
col: s.cols - 1
|
|
1992
|
-
}, n.shiftKey);
|
|
1993
|
-
break;
|
|
1994
|
-
case "Tab":
|
|
1995
|
-
this.#k(n.shiftKey ? "left" : "right");
|
|
1996
|
-
break;
|
|
1997
|
-
case "Enter":
|
|
1998
|
-
n.shiftKey ? this.#k("up") : this.#O("key");
|
|
1999
|
-
break;
|
|
2000
|
-
case "F2":
|
|
2001
|
-
this.#O("key");
|
|
2002
|
-
break;
|
|
2003
|
-
case "Delete":
|
|
2004
|
-
case "Backspace":
|
|
2005
|
-
this.#A();
|
|
2006
|
-
break;
|
|
2007
|
-
case "Escape":
|
|
2008
|
-
this.#r = { ...this.#n }, this.redraw();
|
|
2009
|
-
break;
|
|
2010
|
-
default: r && !n.altKey && n.key.toLowerCase() === "z" ? n.shiftKey ? this.redo() : this.undo() : r && !n.altKey && n.key.toLowerCase() === "y" ? this.redo() : r && !n.altKey && n.key.toLowerCase() === "d" ? this.#j("down") : r && !n.altKey && n.key.toLowerCase() === "r" ? this.#j("right") : r && !n.altKey && n.key.toLowerCase() === "a" ? (this.#r = {
|
|
2011
|
-
row: 0,
|
|
2012
|
-
col: 0
|
|
2013
|
-
}, this.#E({
|
|
2014
|
-
row: s.rows - 1,
|
|
2015
|
-
col: s.cols - 1
|
|
2016
|
-
}, !0)) : n.key.length === 1 && !r && !n.altKey ? this.#O("type", n.key) : c = !1;
|
|
2017
|
-
}
|
|
2018
|
-
c && n.preventDefault();
|
|
2019
|
-
}), this.listen(t, "copy", (n) => {
|
|
2020
|
-
let r = n;
|
|
2021
|
-
if (!r.clipboardData || r.target !== t) return;
|
|
2022
|
-
let { text: i, json: a } = this.#M();
|
|
2023
|
-
r.clipboardData.setData("text/plain", i), r.clipboardData.setData(z, a), r.preventDefault(), e(`Copied ${this.selection}`);
|
|
2024
|
-
}), this.listen(t, "cut", (e) => {
|
|
2025
|
-
let n = e;
|
|
2026
|
-
if (!n.clipboardData || n.target !== t) return;
|
|
2027
|
-
let { text: r, json: i } = this.#M();
|
|
2028
|
-
n.clipboardData.setData("text/plain", r), n.clipboardData.setData(z, i), n.preventDefault(), this.#A();
|
|
2029
|
-
}), this.listen(t, "paste", (e) => {
|
|
2030
|
-
let n = e;
|
|
2031
|
-
n.clipboardData && n.target === t && (n.preventDefault(), this.#N(n.clipboardData));
|
|
2032
|
-
}), this.listen(t, "pointerdown", (e) => {
|
|
2033
|
-
let n = e;
|
|
2034
|
-
if (n.button !== 0) return;
|
|
2035
|
-
let r = this.#P(n.target);
|
|
2036
|
-
r && (n.preventDefault(), t.focus(), this.#E(r, n.shiftKey), this.#_ = {
|
|
2037
|
-
start: r,
|
|
2038
|
-
moved: n.shiftKey,
|
|
2039
|
-
pointerId: n.pointerId
|
|
2040
|
-
}, t.setPointerCapture?.(n.pointerId));
|
|
2041
|
-
}), this.listen(t, "pointermove", (e) => {
|
|
2042
|
-
let t = e;
|
|
2043
|
-
if (!this.#_ || t.pointerId !== this.#_.pointerId) return;
|
|
2044
|
-
let n = document.elementFromPoint?.(t.clientX, t.clientY), r = this.#P(n ?? t.target);
|
|
2045
|
-
!r || r.row === this.#n.row && r.col === this.#n.col || (this.#_.moved = !0, this.#n = r, this.#D(r), this.redraw());
|
|
2046
|
-
}), this.listen(t, "pointerup", (n) => {
|
|
2047
|
-
let r = n, i = this.#_;
|
|
2048
|
-
this.#_ = null, t.releasePointerCapture?.(r.pointerId), i && (i.moved ? (this.emit("sheet:select", {
|
|
2049
|
-
active: this.active,
|
|
2050
|
-
range: this.selection
|
|
2051
|
-
}), e(`Selected ${this.selection}`)) : this.#O("click"));
|
|
2052
|
-
}), this.listen(this.#g, "keydown", (e) => {
|
|
2053
|
-
let n = e;
|
|
2054
|
-
n.key === "Enter" ? (n.preventDefault(), this.#y({ [this.active]: this.#g.value }), t.focus(), this.#k("down")) : n.key === "Escape" && (n.preventDefault(), this.#g.value = this.#t.getRaw(this.active), t.focus());
|
|
2055
|
-
}), this.listen(this.#g, "change", () => {
|
|
2056
|
-
this.#g.value !== this.#t.getRaw(this.active) && this.#y({ [this.active]: this.#g.value });
|
|
2057
|
-
});
|
|
2058
|
-
}
|
|
2059
|
-
};
|
|
2060
|
-
a({ tag: "a-sheet" })(Te);
|
|
2061
|
-
// src/kit/markdown/highlight.ts
|
|
2062
|
-
var B = { fence: null }, V = (e) => e.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">"), H = (e, t) => t ? `<span class="${e}">${t}</span>` : "", Ee = /^( {0,3})(`{3,}|~{3,})(.*)$/, De = /^( {0,3})(#{1,6})(\s.*|)$/, Oe = /^ {0,3}([-*_])(?:\s*\1){2,}\s*$/, ke = /^( {0,3}>)( ?)(.*)$/, Ae = /^(\s*)([-*+]|\d{1,9}[.)])(\s+)(\[[ xX]\](?=\s))?(.*)$/, je = /^\s*\|?\s*:?-{3,}:?\s*(\|\s*:?-{3,}:?\s*)*\|?\s*$/, Me = /(`+)[\s\S]*?\1|!?\[[^\]\n]*\]\([^)\n]*\)|<(?:https?|mailto):[^\s<>]+>|(\*\*|__)(?=\S)[\s\S]*?\S\2|~~(?=\S)[\s\S]*?\S~~|(?<![\w*])\*(?=\S)[^*\n]*?\S\*(?!\*)|(?<!\w)_(?=\S)[^_\n]*?\S_(?!\w)|\\[\\`*_{}[\]()#+\-.!~|<>]/g;
|
|
2063
|
-
function U(e) {
|
|
2064
|
-
let t = "", n = 0;
|
|
2065
|
-
for (let r of e.matchAll(Me)) {
|
|
2066
|
-
let i = r[0];
|
|
2067
|
-
if (t += V(e.slice(n, r.index)), n = r.index + i.length, i.startsWith("`")) {
|
|
2068
|
-
let e = r[1];
|
|
2069
|
-
t += H("md-code", H("md-punct", V(e)) + V(i.slice(e.length, -e.length)) + H("md-punct", V(e)));
|
|
2070
|
-
} else if (i.startsWith("[") || i.startsWith(", n = i.startsWith("!") ? 2 : 1;
|
|
2072
|
-
t += H("md-link", H("md-punct", V(i.slice(0, n))) + U(i.slice(n, e)) + H("md-punct", "](") + H("md-url", V(i.slice(e + 2, -1))) + H("md-punct", ")"));
|
|
2073
|
-
} else i.startsWith("<") ? t += H("md-url", V(i)) : i.startsWith("**") || i.startsWith("__") ? t += H("md-strong", H("md-punct", i.slice(0, 2)) + U(i.slice(2, -2)) + H("md-punct", i.slice(-2))) : i.startsWith("~~") ? t += H("md-del", H("md-punct", "~~") + U(i.slice(2, -2)) + H("md-punct", "~~")) : i.startsWith("\\") ? t += H("md-punct", V(i)) : t += H("md-em", H("md-punct", i[0]) + U(i.slice(1, -1)) + H("md-punct", i[0]));
|
|
2074
|
-
}
|
|
2075
|
-
return t + V(e.slice(n));
|
|
2076
|
-
}
|
|
2077
|
-
function W(e, t) {
|
|
2078
|
-
if (t.fence) {
|
|
2079
|
-
let n = Ee.exec(e);
|
|
2080
|
-
return n && n[2][0] === t.fence[0] && n[2].length >= t.fence.length && !n[3].trim() ? {
|
|
2081
|
-
html: H("md-fence", V(e)),
|
|
2082
|
-
state: B
|
|
2083
|
-
} : {
|
|
2084
|
-
html: H("md-codeblock", V(e)),
|
|
2085
|
-
state: t
|
|
2086
|
-
};
|
|
2087
|
-
}
|
|
2088
|
-
let n = Ee.exec(e);
|
|
2089
|
-
if (n && !(n[2][0] === "`" && n[3].includes("`"))) return {
|
|
2090
|
-
html: H("md-fence", V(n[1] + n[2])) + H("md-lang", V(n[3])),
|
|
2091
|
-
state: { fence: n[2] }
|
|
2092
|
-
};
|
|
2093
|
-
let r = De.exec(e);
|
|
2094
|
-
if (r) {
|
|
2095
|
-
let e = r[2].length;
|
|
2096
|
-
return {
|
|
2097
|
-
html: H(`md-h md-h${e}`, V(r[1]) + H("md-punct", r[2]) + U(r[3])),
|
|
2098
|
-
state: t
|
|
2099
|
-
};
|
|
2100
|
-
}
|
|
2101
|
-
if (Oe.test(e)) return {
|
|
2102
|
-
html: H("md-hr", V(e)),
|
|
2103
|
-
state: t
|
|
2104
|
-
};
|
|
2105
|
-
let i = ke.exec(e);
|
|
2106
|
-
if (i) {
|
|
2107
|
-
let e = W(i[3], B).html;
|
|
2108
|
-
return {
|
|
2109
|
-
html: H("md-quote", H("md-punct", V(i[1])) + i[2] + e),
|
|
2110
|
-
state: t
|
|
2111
|
-
};
|
|
2112
|
-
}
|
|
2113
|
-
let a = Ae.exec(e);
|
|
2114
|
-
if (a) {
|
|
2115
|
-
let e = a[4] ? H(/x/i.test(a[4]) ? "md-task is-done" : "md-task", V(a[4])) : "";
|
|
2116
|
-
return {
|
|
2117
|
-
html: V(a[1]) + H("md-list", V(a[2])) + a[3] + e + U(a[5]),
|
|
2118
|
-
state: t
|
|
2119
|
-
};
|
|
2120
|
-
}
|
|
2121
|
-
return je.test(e) && e.includes("|") ? {
|
|
2122
|
-
html: H("md-punct", V(e)),
|
|
2123
|
-
state: t
|
|
2124
|
-
} : e.includes("|") && /^\s*\|/.test(e) ? {
|
|
2125
|
-
html: e.split(/(?<!\\)(\|)/).map((e) => e === "|" ? H("md-punct", "|") : U(e)).join(""),
|
|
2126
|
-
state: t
|
|
2127
|
-
} : {
|
|
2128
|
-
html: U(e),
|
|
2129
|
-
state: t
|
|
2130
|
-
};
|
|
2131
|
-
}
|
|
2132
|
-
function Ne(e) {
|
|
2133
|
-
let t = B;
|
|
2134
|
-
return e.split("\n").map((e) => {
|
|
2135
|
-
let n = W(e, t);
|
|
2136
|
-
return t = n.state, n.html;
|
|
2137
|
-
});
|
|
2138
|
-
}
|
|
2139
|
-
// src/kit/markdown/render.ts
|
|
2140
|
-
var Pe = /* @__PURE__ */ "p.h1.h2.h3.h4.h5.h6.ul.ol.li.blockquote.pre.hr.table.thead.tbody.tr.th.td.a.img.em.strong.del.code.br.span".split("."), Fe = {
|
|
2141
|
-
"*": [
|
|
2142
|
-
"class",
|
|
2143
|
-
"data-line",
|
|
2144
|
-
"title"
|
|
2145
|
-
],
|
|
2146
|
-
a: ["href"],
|
|
2147
|
-
img: ["src", "alt"],
|
|
2148
|
-
ol: ["start"],
|
|
2149
|
-
span: [
|
|
2150
|
-
"role",
|
|
2151
|
-
"aria-label",
|
|
2152
|
-
"aria-checked"
|
|
2153
|
-
]
|
|
2154
|
-
}, G = (e) => e.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
2155
|
-
function K(e) {
|
|
2156
|
-
let t = [], n = (e) => `\u0000${t.push(e) - 1}\u0000`, i = e.replace(/(`+)([\s\S]*?[^`])\1(?!`)/g, (e, t, r) => n(`<code>${G(r.trim() || r)}</code>`));
|
|
2157
|
-
i = i.replace(/\\([\\`*_{}[\]()#+\-.!~|<>])/g, (e, t) => n(G(t))), i = i.replace(/!\[([^\]]*)\]\(\s*<?([^\s)>]*)>?(?:\s+"([^"]*)")?\s*\)/g, (e, t, i, a) => {
|
|
2158
|
-
let o = r(i, "image");
|
|
2159
|
-
return n(o ? `<img src="${G(o)}" alt="${G(t)}"${a ? ` title="${G(a)}"` : ""}>` : G(t));
|
|
2160
|
-
}), i = i.replace(/\[([^\]]+)\]\(\s*<?([^\s)>]*)>?(?:\s+"([^"]*)")?\s*\)/g, (e, t, i, a) => {
|
|
2161
|
-
let o = r(i), s = Ie(G(t));
|
|
2162
|
-
return n(o ? `<a href="${G(o)}"${a ? ` title="${G(a)}"` : ""}>${s}</a>` : s);
|
|
2163
|
-
}), i = i.replace(/<((?:https?|mailto):[^\s<>]+)>/g, (e, t) => {
|
|
2164
|
-
let i = r(t);
|
|
2165
|
-
return n(i ? `<a href="${G(i)}">${G(t)}</a>` : G(t));
|
|
2166
|
-
}), i = Ie(G(i)), i = i.replace(/(?: {2,}|\\)\n/g, "<br>");
|
|
2167
|
-
let a = /\u0000(\d+)\u0000/g;
|
|
2168
|
-
for (let e = 0; a.test(i) && e < 10; e++) i = i.replace(a, (e, n) => t[Number(n)]);
|
|
2169
|
-
return i;
|
|
2170
|
-
}
|
|
2171
|
-
function Ie(e) {
|
|
2172
|
-
return e.replace(/(\*\*|__)(?=\S)([\s\S]*?\S)\1/g, "<strong>$2</strong>").replace(/(^|[^\w*])\*(?=\S)([\s\S]*?\S)\*(?!\*)/g, "$1<em>$2</em>").replace(/(^|[^\w])_(?=\S)([\s\S]*?\S)_(?!\w)/g, "$1<em>$2</em>").replace(/~~(?=\S)([\s\S]*?\S)~~/g, "<del>$1</del>");
|
|
2173
|
-
}
|
|
2174
|
-
var Le = /^ {0,3}(`{3,}|~{3,})\s*([\w+-]*)/, Re = /^ {0,3}(#{1,6})(?:\s+(.*?))?\s*#*\s*$/, ze = /^ {0,3}([-*_])(?:\s*\1){2,}\s*$/, q = /^ {0,3}> ?/, J = /^(\s*)([-*+]|\d{1,9}[.)])\s+(.*)$/, Be = /^\s*\|?\s*:?-+:?\s*(\|\s*:?-+:?\s*)*\|?\s*$/, Y = (e) => e.trim() === "", Ve = (e, t) => Le.test(e) || Re.test(e) || ze.test(e) || q.test(e) || J.test(e) || e.includes("|") && t !== void 0 && Be.test(t);
|
|
2175
|
-
function He(e, t) {
|
|
2176
|
-
let n = [], r = 0;
|
|
2177
|
-
for (; r < e.length;) {
|
|
2178
|
-
let i = e[r], a = ` data-line="${t + r}"`;
|
|
2179
|
-
if (Y(i)) {
|
|
2180
|
-
r++;
|
|
2181
|
-
continue;
|
|
2182
|
-
}
|
|
2183
|
-
let o = Le.exec(i);
|
|
2184
|
-
if (o) {
|
|
2185
|
-
let t = RegExp(`^ {0,3}${o[1][0]}{${o[1].length},}\\s*$`), i = [], s = r + 1;
|
|
2186
|
-
for (; s < e.length && !t.test(e[s]);) i.push(e[s++]);
|
|
2187
|
-
n.push(`<pre${a}><code${o[2] ? ` class="language-${G(o[2])}"` : ""}>${G(i.join("\n"))}</code></pre>`), r = s + 1;
|
|
2188
|
-
continue;
|
|
2189
|
-
}
|
|
2190
|
-
let s = Re.exec(i);
|
|
2191
|
-
if (s) {
|
|
2192
|
-
let e = s[1].length;
|
|
2193
|
-
n.push(`<h${e}${a}>${K(s[2] ?? "")}</h${e}>`), r++;
|
|
2194
|
-
continue;
|
|
2195
|
-
}
|
|
2196
|
-
if (ze.test(i)) {
|
|
2197
|
-
n.push(`<hr${a}>`), r++;
|
|
2198
|
-
continue;
|
|
2199
|
-
}
|
|
2200
|
-
if (q.test(i)) {
|
|
2201
|
-
let i = [], o = r;
|
|
2202
|
-
for (; o < e.length && (q.test(e[o]) || !Y(e[o]) && !Ve(e[o]) && i.length);) i.push(e[o].replace(q, "")), o++;
|
|
2203
|
-
n.push(`<blockquote${a}>${He(i, t + r)}</blockquote>`), r = o;
|
|
2204
|
-
continue;
|
|
2205
|
-
}
|
|
2206
|
-
if (J.test(i)) {
|
|
2207
|
-
let a = [], o = J.exec(i), s = (e) => e[2].replace(/\d+/, "1"), c = (e) => {
|
|
2208
|
-
let t = J.exec(e);
|
|
2209
|
-
return !t || t[1].length > o[1].length + 1 || s(t) === s(o);
|
|
2210
|
-
}, l = r;
|
|
2211
|
-
for (; l < e.length;) {
|
|
2212
|
-
let t = e[l];
|
|
2213
|
-
if (!c(t)) break;
|
|
2214
|
-
if (J.test(t) || !Y(t) && /^\s+/.test(t) || !Y(t) && a.length && !Ve(t) && !Y(e[l - 1])) a.push(t), l++;
|
|
2215
|
-
else if (Y(t) && l + 1 < e.length && (J.test(e[l + 1]) && c(e[l + 1]) || /^\s{2,}\S/.test(e[l + 1]))) a.push(t), l++;
|
|
2216
|
-
else break;
|
|
2217
|
-
}
|
|
2218
|
-
n.push(Ue(a, t + r)), r = l;
|
|
2219
|
-
continue;
|
|
2220
|
-
}
|
|
2221
|
-
if (i.includes("|") && r + 1 < e.length && Be.test(e[r + 1])) {
|
|
2222
|
-
let a = [], o = r + 2;
|
|
2223
|
-
for (; o < e.length && e[o].includes("|") && !Y(e[o]);) a.push(e[o++]);
|
|
2224
|
-
n.push(Ge(i, e[r + 1], a, t + r)), r = o;
|
|
2225
|
-
continue;
|
|
2226
|
-
}
|
|
2227
|
-
let c = [i], l = r + 1;
|
|
2228
|
-
for (; l < e.length && !Y(e[l]) && !Ve(e[l], e[l + 1]);) c.push(e[l++]);
|
|
2229
|
-
n.push(`<p${a}>${K(c.map((e) => e.replace(/^\s+/, "")).join("\n"))}</p>`), r = l;
|
|
2230
|
-
}
|
|
2231
|
-
return n.join("");
|
|
2232
|
-
}
|
|
2233
|
-
function Ue(e, t) {
|
|
2234
|
-
let n = J.exec(e[0])[1].length, r = [];
|
|
2235
|
-
e.forEach((e, i) => {
|
|
2236
|
-
let a = J.exec(e);
|
|
2237
|
-
a && a[1].length <= n + 1 ? r.push({
|
|
2238
|
-
indent: a[1].length,
|
|
2239
|
-
ordered: /\d/.test(a[2]),
|
|
2240
|
-
start: parseInt(a[2], 10) || 1,
|
|
2241
|
-
lines: [a[3]],
|
|
2242
|
-
line: t + i
|
|
2243
|
-
}) : r[r.length - 1].lines.push(e.replace(RegExp(`^ {0,${n + 4}}`), ""));
|
|
2244
|
-
});
|
|
2245
|
-
let i = r[0].ordered, a = i ? "ol" : "ul", o = i && r[0].start !== 1 ? ` start="${r[0].start}"` : "", s = r.some((e) => /^\[[ xX]\]\s/.test(e.lines[0])), c = r.map((e) => {
|
|
2246
|
-
let t = e.lines[0], n = "", r = /^\[([ xX])\]\s+/.exec(t);
|
|
2247
|
-
if (r) {
|
|
2248
|
-
let e = r[1] !== " ";
|
|
2249
|
-
n = `<span class="md-check${e ? " is-checked" : ""}" role="img" aria-label="${e ? "Done" : "Not done"}"></span>`, t = t.slice(r[0].length);
|
|
2250
|
-
}
|
|
2251
|
-
let i = e.lines.slice(1), a = i.some((e) => !Y(e)) ? He(i, e.line + 1) : "";
|
|
2252
|
-
return `<li data-line="${e.line}"${r ? " class=\"md-task\"" : ""}>${n}${K(t)}${a}</li>`;
|
|
2253
|
-
});
|
|
2254
|
-
return `<${a} data-line="${t}"${o}${s ? " class=\"md-tasks\"" : ""}>${c.join("")}</${a}>`;
|
|
2255
|
-
}
|
|
2256
|
-
function We(e) {
|
|
2257
|
-
return e.trim().replace(/^\|/, "").replace(/(?<!\\)\|$/, "").split(/(?<!\\)\|/).map((e) => e.trim().replace(/\\\|/g, "|"));
|
|
2258
|
-
}
|
|
2259
|
-
function Ge(e, t, n, r) {
|
|
2260
|
-
let i = We(t).map((e) => e.startsWith(":") && e.endsWith(":") ? "center" : e.endsWith(":") ? "right" : e.startsWith(":") ? "left" : ""), a = (e, t, n) => `<${e}${i[n] ? ` class="md-align-${i[n]}"` : ""}>${K(t)}</${e}>`, o = We(e).map((e, t) => a("th", e, t)).join(""), s = n.map((e, t) => `<tr data-line="${r + 2 + t}">${We(e).map((e, t) => a("td", e, t)).join("")}</tr>`).join("");
|
|
2261
|
-
return `<table data-line="${r}"><thead><tr>${o}</tr></thead>${s ? `<tbody>${s}</tbody>` : ""}</table>`;
|
|
2262
|
-
}
|
|
2263
|
-
function Ke(e) {
|
|
2264
|
-
let t = He(e.replace(/\r\n?/g, "\n").split("\n"), 0);
|
|
2265
|
-
return p(t, {
|
|
2266
|
-
allowedTags: Pe,
|
|
2267
|
-
allowedAttributes: Fe
|
|
2268
|
-
});
|
|
2269
|
-
}
|
|
2270
|
-
function qe(e) {
|
|
2271
|
-
let t = [], n = null, r = 0;
|
|
2272
|
-
return e.split("\n").forEach((e, i) => {
|
|
2273
|
-
let a = Le.exec(e);
|
|
2274
|
-
if (a && (!n || e.trim().startsWith(n))) n = n ? null : a[1];
|
|
2275
|
-
else if (!n) {
|
|
2276
|
-
let n = Re.exec(e);
|
|
2277
|
-
n && n[2] && t.push({
|
|
2278
|
-
level: n[1].length,
|
|
2279
|
-
text: n[2].replace(/[*_`~]/g, ""),
|
|
2280
|
-
line: i,
|
|
2281
|
-
offset: r
|
|
2282
|
-
});
|
|
2283
|
-
}
|
|
2284
|
-
r += e.length + 1;
|
|
2285
|
-
}), t;
|
|
2286
|
-
}
|
|
2287
|
-
// src/kit/markdown-editor.ts
|
|
2288
|
-
var Je = [
|
|
2289
|
-
{
|
|
2290
|
-
id: "bold",
|
|
2291
|
-
label: "Bold",
|
|
2292
|
-
icon: "<b>B</b>",
|
|
2293
|
-
shortcut: "b"
|
|
2294
|
-
},
|
|
2295
|
-
{
|
|
2296
|
-
id: "italic",
|
|
2297
|
-
label: "Italic",
|
|
2298
|
-
icon: "<i>I</i>",
|
|
2299
|
-
shortcut: "i"
|
|
2300
|
-
},
|
|
2301
|
-
{
|
|
2302
|
-
id: "strike",
|
|
2303
|
-
label: "Strikethrough",
|
|
2304
|
-
icon: "<s>S</s>"
|
|
2305
|
-
},
|
|
2306
|
-
{
|
|
2307
|
-
id: "code",
|
|
2308
|
-
label: "Inline code",
|
|
2309
|
-
icon: "<svg viewBox=\"0 0 20 20\"><path d=\"M7 6l-4 4 4 4M13 6l4 4-4 4\"/></svg>"
|
|
2310
|
-
},
|
|
2311
|
-
"|",
|
|
2312
|
-
{
|
|
2313
|
-
id: "heading",
|
|
2314
|
-
label: "Heading (repeat for smaller)",
|
|
2315
|
-
icon: "<b>H</b>"
|
|
2316
|
-
},
|
|
2317
|
-
{
|
|
2318
|
-
id: "quote",
|
|
2319
|
-
label: "Quote",
|
|
2320
|
-
icon: "<svg viewBox=\"0 0 20 20\"><path d=\"M4 5v10M8 7h8M8 10h8M8 13h5\"/></svg>"
|
|
2321
|
-
},
|
|
2322
|
-
{
|
|
2323
|
-
id: "bullet",
|
|
2324
|
-
label: "Bulleted list",
|
|
2325
|
-
icon: "<svg viewBox=\"0 0 20 20\"><path d=\"M8 6h9M8 10h9M8 14h9\"/><circle cx=\"4\" cy=\"6\" r=\"1\"/><circle cx=\"4\" cy=\"10\" r=\"1\"/><circle cx=\"4\" cy=\"14\" r=\"1\"/></svg>"
|
|
2326
|
-
},
|
|
2327
|
-
{
|
|
2328
|
-
id: "numbered",
|
|
2329
|
-
label: "Numbered list",
|
|
2330
|
-
icon: "<svg viewBox=\"0 0 20 20\"><path d=\"M8 6h9M8 10h9M8 14h9M3 4.5l1.2-.7V7.5M2.8 12.2c.4-.6 1.8-.6 1.8.4 0 .8-1.8 1.2-1.8 2.1h1.9\"/></svg>"
|
|
2331
|
-
},
|
|
2332
|
-
{
|
|
2333
|
-
id: "task",
|
|
2334
|
-
label: "Checklist",
|
|
2335
|
-
icon: "<svg viewBox=\"0 0 20 20\"><rect x=\"3\" y=\"4\" width=\"5\" height=\"5\" rx=\"1\"/><path d=\"M4.2 13.6l1.2 1.2 2.2-2.6M11 6.5h6M11 13.5h6\"/></svg>"
|
|
2336
|
-
},
|
|
2337
|
-
"|",
|
|
2338
|
-
{
|
|
2339
|
-
id: "link",
|
|
2340
|
-
label: "Link",
|
|
2341
|
-
icon: "<svg viewBox=\"0 0 20 20\"><path d=\"M8.5 11.5a3 3 0 0 0 4.2 0l2.6-2.6a3 3 0 0 0-4.2-4.2l-1 1M11.5 8.5a3 3 0 0 0-4.2 0l-2.6 2.6a3 3 0 0 0 4.2 4.2l1-1\"/></svg>",
|
|
2342
|
-
shortcut: "k"
|
|
2343
|
-
},
|
|
2344
|
-
{
|
|
2345
|
-
id: "codeblock",
|
|
2346
|
-
label: "Code block",
|
|
2347
|
-
icon: "<svg viewBox=\"0 0 20 20\"><rect x=\"2.5\" y=\"3.5\" width=\"15\" height=\"13\" rx=\"2\"/><path d=\"M8 8l-2 2 2 2M12 8l2 2-2 2\"/></svg>"
|
|
2348
|
-
}
|
|
2349
|
-
], Ye = /^(#[0-9a-f]{3,8}|(rgb|hsl)a?\([\d\s.,%/-]+\))$/i, Xe = (e) => e.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">"), Ze = typeof navigator < "u" && /Mac|iP(hone|ad)/.test(navigator.platform) ? "⌘" : "Ctrl+", Qe = class extends t {
|
|
2350
|
-
#e = null;
|
|
2351
|
-
#t;
|
|
2352
|
-
#n;
|
|
2353
|
-
#r;
|
|
2354
|
-
#i;
|
|
2355
|
-
#a;
|
|
2356
|
-
#o;
|
|
2357
|
-
#s;
|
|
2358
|
-
#c;
|
|
2359
|
-
#l;
|
|
2360
|
-
#u;
|
|
2361
|
-
#d = [];
|
|
2362
|
-
#f = [];
|
|
2363
|
-
#p = [];
|
|
2364
|
-
#m = "";
|
|
2365
|
-
#h = new u();
|
|
2366
|
-
#g = !1;
|
|
2367
|
-
#_ = [];
|
|
2368
|
-
#v = [];
|
|
2369
|
-
#y = -1;
|
|
2370
|
-
#b = 0;
|
|
2371
|
-
#x;
|
|
2372
|
-
#S = "";
|
|
2373
|
-
#C = !1;
|
|
2374
|
-
static get observedAttributes() {
|
|
2375
|
-
return ["layout"];
|
|
2376
|
-
}
|
|
2377
|
-
attributeChangedCallback(e) {
|
|
2378
|
-
e === "layout" && this.#C && this.#j();
|
|
2379
|
-
}
|
|
2380
|
-
get textarea() {
|
|
2381
|
-
return this.#e;
|
|
2382
|
-
}
|
|
2383
|
-
get value() {
|
|
2384
|
-
return this.#e?.value ?? "";
|
|
2385
|
-
}
|
|
2386
|
-
get layout() {
|
|
2387
|
-
let e = this.getAttribute("layout");
|
|
2388
|
-
return e === "write" || e === "preview" ? e : "split";
|
|
2389
|
-
}
|
|
2390
|
-
set layout(e) {
|
|
2391
|
-
this.setAttribute("layout", e);
|
|
2392
|
-
}
|
|
2393
|
-
get outline() {
|
|
2394
|
-
return qe(this.value);
|
|
2395
|
-
}
|
|
2396
|
-
get annotations() {
|
|
2397
|
-
return this.#_;
|
|
2398
|
-
}
|
|
2399
|
-
set annotations(e) {
|
|
2400
|
-
this.#_ = e.filter((e) => e.to >= e.from), this.#E();
|
|
2401
|
-
}
|
|
2402
|
-
onConnected() {
|
|
2403
|
-
this.#C || this.#w();
|
|
2404
|
-
let e = this.#e;
|
|
2405
|
-
if (e) {
|
|
2406
|
-
this.listen(e, "input", () => this.#N()), this.listen(e, "collab:apply", (e) => this.#P(e.detail)), this.listen(e, "keydown", (e) => this.#R(e)), this.listen(e, "beforeinput", (e) => {
|
|
2407
|
-
let t = e.inputType;
|
|
2408
|
-
(t === "historyUndo" || t === "historyRedo") && (e.preventDefault(), t === "historyUndo" ? this.undo() : this.redo());
|
|
2409
|
-
});
|
|
2410
|
-
for (let t of [
|
|
2411
|
-
"keyup",
|
|
2412
|
-
"pointerup",
|
|
2413
|
-
"focus",
|
|
2414
|
-
"select"
|
|
2415
|
-
]) this.listen(e, t, () => this.#I());
|
|
2416
|
-
if (this.listen(document, "selectionchange", () => {
|
|
2417
|
-
document.activeElement === e && this.#I();
|
|
2418
|
-
}), this.listen(this.#t, "scroll", () => this.#M(), { passive: !0 }), this.listen(window, "resize", () => this.#E()), typeof ResizeObserver < "u") {
|
|
2419
|
-
let e = new ResizeObserver(() => this.#E());
|
|
2420
|
-
e.observe(this.#n), this.signal.addEventListener("abort", () => e.disconnect());
|
|
2421
|
-
}
|
|
2422
|
-
this.#m = e.value, this.refresh();
|
|
2423
|
-
}
|
|
2424
|
-
}
|
|
2425
|
-
onDisconnected() {
|
|
2426
|
-
cancelAnimationFrame(this.#b), this.#b = 0, clearTimeout(this.#x);
|
|
2427
|
-
}
|
|
2428
|
-
#w() {
|
|
2429
|
-
let e = this.querySelector("textarea");
|
|
2430
|
-
if (!e) {
|
|
2431
|
-
console.error("<a-markdown-editor> needs a <textarea> child.");
|
|
2432
|
-
return;
|
|
2433
|
-
}
|
|
2434
|
-
this.#C = !0, this.#e = e, e.classList.add("ar-md__input"), e.spellcheck = !e.hasAttribute("spellcheck") || e.spellcheck, e.setAttribute("wrap", "soft");
|
|
2435
|
-
let t = n("ar-md");
|
|
2436
|
-
this.#c = document.createElement("div"), this.#c.className = "ar-md__toolbar", this.#c.setAttribute("role", "toolbar"), this.#c.setAttribute("aria-label", "Formatting"), this.#c.setAttribute("aria-controls", e.id ||= `${t}-input`);
|
|
2437
|
-
let r = Je.map((e) => {
|
|
2438
|
-
if (e === "|") return "<span class=\"ar-md__sep\" role=\"separator\"></span>";
|
|
2439
|
-
let t = e.shortcut ? ` (${Ze}${e.shortcut.toUpperCase()})` : "";
|
|
2440
|
-
return `<button type="button" class="ar-md__button" data-command="${e.id}" aria-label="${e.label}" title="${e.label}${t}" tabindex="-1">${e.icon}</button>`;
|
|
2441
|
-
}).join("");
|
|
2442
|
-
this.#c.innerHTML = `${r}<span class="ar-md__spacer"></span>
|
|
2443
|
-
<button type="button" class="ar-md__button" data-find aria-label="Find and replace" title="Find and replace (${Ze}F)" tabindex="-1"><svg viewBox="0 0 20 20"><circle cx="8.5" cy="8.5" r="5"/><path d="M12.2 12.2L17 17"/></svg></button>
|
|
2444
|
-
<span class="ar-md__sep" role="separator"></span>
|
|
2445
|
-
<span class="ar-md__layout" role="group" aria-label="View">
|
|
2446
|
-
<button type="button" class="ar-md__button ar-md__button--text" data-layout="write" tabindex="-1">Write</button>
|
|
2447
|
-
<button type="button" class="ar-md__button ar-md__button--text" data-layout="split" tabindex="-1">Split</button>
|
|
2448
|
-
<button type="button" class="ar-md__button ar-md__button--text" data-layout="preview" tabindex="-1">Preview</button>
|
|
2449
|
-
</span>`, this.#c.querySelector("button").tabIndex = 0, this.#l = document.createElement("div"), this.#l.className = "ar-md__find", this.#l.hidden = !0, this.#l.setAttribute("role", "search"), this.#l.innerHTML = "\n <input type=\"search\" class=\"ar-md__find-input\" data-find-input aria-label=\"Find\" placeholder=\"Find\" autocomplete=\"off\">\n <input type=\"text\" class=\"ar-md__find-input\" data-replace-input aria-label=\"Replace with\" placeholder=\"Replace with\" autocomplete=\"off\">\n <label class=\"ar-md__check\"><input type=\"checkbox\" data-case> Match case</label>\n <span class=\"ar-md__find-status\" aria-live=\"polite\"></span>\n <span class=\"ar-md__find-actions\">\n <button type=\"button\" class=\"ar-md__button\" data-find-prev aria-label=\"Previous match\" title=\"Previous match (Shift+Enter)\"><svg viewBox=\"0 0 20 20\"><path d=\"M5 12l5-5 5 5\"/></svg></button>\n <button type=\"button\" class=\"ar-md__button\" data-find-next aria-label=\"Next match\" title=\"Next match (Enter)\"><svg viewBox=\"0 0 20 20\"><path d=\"M5 8l5 5 5-5\"/></svg></button>\n <button type=\"button\" class=\"ar-md__button ar-md__button--text\" data-replace>Replace</button>\n <button type=\"button\" class=\"ar-md__button ar-md__button--text\" data-replace-all>Replace all</button>\n <button type=\"button\" class=\"ar-md__button\" data-find-close aria-label=\"Close find\" title=\"Close (Escape)\"><svg viewBox=\"0 0 20 20\"><path d=\"M5 5l10 10M15 5L5 15\"/></svg></button>\n </span>", this.#u = this.#l.querySelector(".ar-md__find-status"), this.#s = document.createElement("div"), this.#s.className = "ar-md__body", this.#t = document.createElement("div"), this.#t.className = "ar-md__source", this.#a = document.createElement("div"), this.#a.className = "ar-md__gutter", this.#a.setAttribute("aria-hidden", "true"), this.#n = document.createElement("div"), this.#n.className = "ar-md__stack", this.#i = document.createElement("div"), this.#i.className = "ar-md__layer ar-md__marks", this.#i.setAttribute("aria-hidden", "true"), this.#r = document.createElement("div"), this.#r.className = "ar-md__layer ar-md__highlight", this.#r.setAttribute("aria-hidden", "true"), this.#o = document.createElement("div"), this.#o.className = "ar-md__preview ar-prose", this.#o.setAttribute("role", "region"), this.#o.setAttribute("aria-label", "Preview"), this.#o.tabIndex = 0, this.#n.append(this.#i, this.#r, e), this.#t.append(this.#a, this.#n), this.#s.append(this.#t, this.#o), this.replaceChildren(this.#c, this.#l, this.#s), this.classList.add("ar-md"), this.#H(), this.#U(), this.#j();
|
|
2450
|
-
}
|
|
2451
|
-
refresh() {
|
|
2452
|
-
this.#m = this.value, this.#T(), this.#E(), this.#k(), this.#A();
|
|
2453
|
-
}
|
|
2454
|
-
#T() {
|
|
2455
|
-
let e = this.value.split("\n"), t = this.#d, n = 0;
|
|
2456
|
-
for (; n < t.length && n < e.length && t[n] === e[n];) n++;
|
|
2457
|
-
let r = t.length, i = e.length;
|
|
2458
|
-
for (; r > n && i > n && t[r - 1] === e[i - 1];) r--, i--;
|
|
2459
|
-
let a = r > 0 ? this.#f[r - 1] : B, o = [], s = [], c = n > 0 ? this.#f[n - 1] : B;
|
|
2460
|
-
for (let t = n; t < i; t++) {
|
|
2461
|
-
let n = document.createElement("div");
|
|
2462
|
-
n.className = "ar-md__line";
|
|
2463
|
-
let r = W(e[t], c);
|
|
2464
|
-
n.innerHTML = r.html || "<br>", c = r.state, o.push(n), s.push(c);
|
|
2465
|
-
}
|
|
2466
|
-
let l = this.#p.splice(n, r - n, ...o);
|
|
2467
|
-
this.#f.splice(n, r - n, ...s);
|
|
2468
|
-
for (let e of l) e.remove();
|
|
2469
|
-
let u = this.#p[n + o.length] ?? null;
|
|
2470
|
-
for (let e of o) this.#r.insertBefore(e, u);
|
|
2471
|
-
if (this.#d = e, c.fence !== a.fence) for (let t = n + o.length; t < e.length; t++) {
|
|
2472
|
-
let n = W(e[t], c), r = this.#f[t];
|
|
2473
|
-
if (this.#p[t].innerHTML = n.html || "<br>", this.#f[t] = n.state, c = n.state, n.state.fence === r.fence) break;
|
|
2474
|
-
}
|
|
2475
|
-
}
|
|
2476
|
-
#E() {
|
|
2477
|
-
this.#b || !this.#C || (this.#b = requestAnimationFrame(() => {
|
|
2478
|
-
this.#b = 0, this.#D();
|
|
2479
|
-
}));
|
|
2480
|
-
}
|
|
2481
|
-
#D() {
|
|
2482
|
-
let e = this.#e;
|
|
2483
|
-
if (!e) return;
|
|
2484
|
-
e.style.height = `${Math.max(this.#r.offsetHeight, 0)}px`;
|
|
2485
|
-
let t = this.value.slice(0, e.selectionStart ?? 0).split("\n").length - 1, n = [];
|
|
2486
|
-
this.#p.forEach((r, i) => {
|
|
2487
|
-
r.classList.toggle("is-current", i === t && document.activeElement === e), n.push(`<span style="top:${r.offsetTop}px"${i === t ? " class=\"is-current\"" : ""}>${i + 1}</span>`);
|
|
2488
|
-
}), this.#a.innerHTML = n.join(""), this.#a.style.height = `${this.#r.offsetHeight}px`, this.#O();
|
|
2489
|
-
}
|
|
2490
|
-
#O() {
|
|
2491
|
-
let e = [...this.#_.map((e) => ({
|
|
2492
|
-
from: e.from,
|
|
2493
|
-
to: e.to,
|
|
2494
|
-
cls: `ar-md__mark${e.active ? " is-active" : ""}`,
|
|
2495
|
-
color: e.color && Ye.test(e.color) ? e.color : void 0
|
|
2496
|
-
})), ...this.#v.map((e, t) => ({
|
|
2497
|
-
...e,
|
|
2498
|
-
cls: `ar-md__match${t === this.#y ? " is-current" : ""}`
|
|
2499
|
-
}))].filter((e) => e.to > e.from);
|
|
2500
|
-
if (!e.length) {
|
|
2501
|
-
this.#i.textContent = "";
|
|
2502
|
-
return;
|
|
2503
|
-
}
|
|
2504
|
-
let t = this.value, n = [.../* @__PURE__ */ new Set([
|
|
2505
|
-
0,
|
|
2506
|
-
t.length,
|
|
2507
|
-
...e.flatMap((e) => [e.from, e.to])
|
|
2508
|
-
])].filter((e) => e >= 0 && e <= t.length).sort((e, t) => e - t), r = "";
|
|
2509
|
-
for (let i = 0; i < n.length - 1; i++) {
|
|
2510
|
-
let [a, o] = [n[i], n[i + 1]], s = Xe(t.slice(a, o));
|
|
2511
|
-
for (let t of e) t.from <= a && t.to >= o && (s = `<span class="${t.cls}"${t.color ? ` style="--mark: ${t.color}"` : ""}>${s}</span>`);
|
|
2512
|
-
r += s;
|
|
2513
|
-
}
|
|
2514
|
-
this.#i.innerHTML = r;
|
|
2515
|
-
}
|
|
2516
|
-
#k() {
|
|
2517
|
-
this.layout !== "write" && (clearTimeout(this.#x), this.#x = setTimeout(() => {
|
|
2518
|
-
this.#o.innerHTML = Ke(this.value), this.#M();
|
|
2519
|
-
}, 120));
|
|
2520
|
-
}
|
|
2521
|
-
#A() {
|
|
2522
|
-
let e = this.outline, t = JSON.stringify(e.map((e) => [
|
|
2523
|
-
e.level,
|
|
2524
|
-
e.text,
|
|
2525
|
-
e.line
|
|
2526
|
-
]));
|
|
2527
|
-
t !== this.#S && (this.#S = t, this.emit("markdown:outline", e));
|
|
2528
|
-
}
|
|
2529
|
-
#j() {
|
|
2530
|
-
let e = this.layout;
|
|
2531
|
-
this.#s.dataset.layout = e;
|
|
2532
|
-
for (let t of this.#c.querySelectorAll("[data-layout]")) t.setAttribute("aria-pressed", String(t.dataset.layout === e));
|
|
2533
|
-
this.#t.hidden = e === "preview", this.#o.hidden = e === "write", e !== "write" && this.#k(), this.#E(), this.emit("markdown:layout", { layout: e });
|
|
2534
|
-
}
|
|
2535
|
-
#M() {
|
|
2536
|
-
if (this.layout !== "split") return;
|
|
2537
|
-
let e = this.#t.scrollTop, t = 0;
|
|
2538
|
-
for (let n = 0; n < this.#p.length && !(this.#p[n].offsetTop > e); n++) t = n;
|
|
2539
|
-
let n = null;
|
|
2540
|
-
for (let e of this.#o.querySelectorAll("[data-line]")) {
|
|
2541
|
-
if (Number(e.dataset.line) > t) break;
|
|
2542
|
-
n = e;
|
|
2543
|
-
}
|
|
2544
|
-
this.#o.scrollTop = n ? n.offsetTop - this.#o.offsetTop - 8 : 0;
|
|
2545
|
-
}
|
|
2546
|
-
#N() {
|
|
2547
|
-
let e = this.value;
|
|
2548
|
-
!this.#g && e !== this.#m && this.#h.record(l.fromDiff(this.#m, e), this.#m), this.#m = e, this.#F();
|
|
2549
|
-
}
|
|
2550
|
-
#P(e) {
|
|
2551
|
-
e.op && e.remote ? this.#h.transform(e.op) : e.op || this.#h.clear(), this.#m = this.value, this.#F();
|
|
2552
|
-
}
|
|
2553
|
-
#F() {
|
|
2554
|
-
this.#T(), this.#l.hidden === !1 && this.#W(!1), this.#E(), this.#k(), this.#A();
|
|
2555
|
-
}
|
|
2556
|
-
#I() {
|
|
2557
|
-
let e = this.#e;
|
|
2558
|
-
this.#E(), this.emit("markdown:selection", {
|
|
2559
|
-
from: Math.min(e.selectionStart, e.selectionEnd),
|
|
2560
|
-
to: Math.max(e.selectionStart, e.selectionEnd)
|
|
2561
|
-
});
|
|
2562
|
-
}
|
|
2563
|
-
replaceRange(e, t, n, r) {
|
|
2564
|
-
let i = this.#e;
|
|
2565
|
-
i && !i.readOnly && (i.focus(), i.setRangeText(n, e, t, "end"), r && i.setSelectionRange(r[0], r[1]), i.dispatchEvent(new InputEvent("input", {
|
|
2566
|
-
bubbles: !0,
|
|
2567
|
-
inputType: "insertReplacementText",
|
|
2568
|
-
data: n
|
|
2569
|
-
})), this.#h.break());
|
|
2570
|
-
}
|
|
2571
|
-
undo() {
|
|
2572
|
-
return this.#L(this.#h.undo(this.value));
|
|
2573
|
-
}
|
|
2574
|
-
redo() {
|
|
2575
|
-
return this.#L(this.#h.redo(this.value));
|
|
2576
|
-
}
|
|
2577
|
-
#L(e) {
|
|
2578
|
-
let t = this.#e;
|
|
2579
|
-
if (!e || !t || t.readOnly) return !1;
|
|
2580
|
-
let n = this.value, r = e.apply(n), i = 0;
|
|
2581
|
-
for (; i < n.length && i < r.length && n[i] === r[i];) i++;
|
|
2582
|
-
let a = n.length, o = r.length;
|
|
2583
|
-
for (; a > i && o > i && n[a - 1] === r[o - 1];) a--, o--;
|
|
2584
|
-
this.#g = !0;
|
|
2585
|
-
try {
|
|
2586
|
-
t.setRangeText(r.slice(i, o), i, a, "end");
|
|
2587
|
-
let n = c(e);
|
|
2588
|
-
t.setSelectionRange(n, n), t.dispatchEvent(new InputEvent("input", {
|
|
2589
|
-
bubbles: !0,
|
|
2590
|
-
inputType: "historyUndo"
|
|
2591
|
-
}));
|
|
2592
|
-
} finally {
|
|
2593
|
-
this.#g = !1;
|
|
2594
|
-
}
|
|
2595
|
-
return this.#q(), !0;
|
|
2596
|
-
}
|
|
2597
|
-
#R(e) {
|
|
2598
|
-
if (e.defaultPrevented || e.isComposing) return;
|
|
2599
|
-
let t = e.key.toLowerCase();
|
|
2600
|
-
if ((e.ctrlKey || e.metaKey) && !e.altKey) {
|
|
2601
|
-
if (t === "z" && !e.shiftKey) this.undo();
|
|
2602
|
-
else if (t === "z" && e.shiftKey || t === "y") this.redo();
|
|
2603
|
-
else if (t === "f") this.openFind();
|
|
2604
|
-
else if (t === "b" && !e.shiftKey) this.format("bold");
|
|
2605
|
-
else if (t === "i" && !e.shiftKey) this.format("italic");
|
|
2606
|
-
else if (t === "k" && !e.shiftKey) this.format("link");
|
|
2607
|
-
else return;
|
|
2608
|
-
e.preventDefault();
|
|
2609
|
-
} else e.key === "Enter" && !e.shiftKey ? this.#z() && e.preventDefault() : e.key === "Tab" && this.#B(e.shiftKey) ? e.preventDefault() : e.key === "Escape" && !this.#l.hidden && this.closeFind(), requestAnimationFrame(() => this.#q());
|
|
2610
|
-
}
|
|
2611
|
-
#z() {
|
|
2612
|
-
let e = this.#e;
|
|
2613
|
-
if (e.selectionStart !== e.selectionEnd) return !1;
|
|
2614
|
-
let t = e.selectionStart, n = this.value.lastIndexOf("\n", t - 1) + 1, r = this.value.slice(n, t), i = /^(\s*)([-*+]|(\d+)([.)]))(\s+)(\[[ xX]\]\s+)?/.exec(r), a = /^(\s*>\s?)+/.exec(r);
|
|
2615
|
-
if (!i && !a) return !1;
|
|
2616
|
-
let o = i ? i[0] : a[0];
|
|
2617
|
-
if (r.length === o.length) return this.replaceRange(n, t, ""), !0;
|
|
2618
|
-
let s = o;
|
|
2619
|
-
return i?.[3] ? s = `${i[1]}${Number(i[3]) + 1}${i[4]}${i[5]}${i[6] ? "[ ] " : ""}` : i?.[6] && (s = `${i[1]}${i[2]}${i[5]}[ ] `), this.replaceRange(t, t, `\n${s}`), !0;
|
|
2620
|
-
}
|
|
2621
|
-
#B(e) {
|
|
2622
|
-
let t = this.#e, { start: n, end: r, text: i } = this.#V();
|
|
2623
|
-
if (!i.split("\n").every((e) => /^\s*([-*+]|\d+[.)])\s/.test(e) || !e.trim())) return !1;
|
|
2624
|
-
let a = i.split("\n").map((t) => e ? t.replace(/^ {1,2}/, "") : t.trim() ? ` ${t}` : t).join("\n"), o = t.selectionStart + (a.length - i.length) * +(t.selectionStart === t.selectionEnd);
|
|
2625
|
-
return this.replaceRange(n, r, a, t.selectionStart === t.selectionEnd ? [Math.max(n, o), Math.max(n, o)] : [n, n + a.length]), !0;
|
|
2626
|
-
}
|
|
2627
|
-
#V() {
|
|
2628
|
-
let e = this.#e, t = this.value, n = t.lastIndexOf("\n", e.selectionStart - 1) + 1, r = t.indexOf("\n", Math.max(e.selectionEnd - +(e.selectionEnd > e.selectionStart && t[e.selectionEnd - 1] === "\n"), n));
|
|
2629
|
-
return r === -1 && (r = t.length), {
|
|
2630
|
-
start: n,
|
|
2631
|
-
end: r,
|
|
2632
|
-
text: t.slice(n, r)
|
|
2633
|
-
};
|
|
2634
|
-
}
|
|
2635
|
-
format(e) {
|
|
2636
|
-
let t = this.#e;
|
|
2637
|
-
if (!t || t.readOnly) return;
|
|
2638
|
-
let n = this.value, r = t.selectionStart, i = t.selectionEnd, a = n.slice(r, i), o = (e, t = e, o = "text") => {
|
|
2639
|
-
if (n.slice(r - e.length, r) === e && n.slice(i, i + t.length) === t) {
|
|
2640
|
-
this.replaceRange(r - e.length, i + t.length, a, [r - e.length, i - e.length]);
|
|
2641
|
-
return;
|
|
2642
|
-
}
|
|
2643
|
-
let s = a || o;
|
|
2644
|
-
this.replaceRange(r, i, `${e}${s}${t}`, [r + e.length, r + e.length + s.length]);
|
|
2645
|
-
}, s = (e) => {
|
|
2646
|
-
let { start: t, end: n, text: r } = this.#V(), i = r.split("\n").map(e).join("\n");
|
|
2647
|
-
this.replaceRange(t, n, i, [t, t + i.length]);
|
|
2648
|
-
}, c = (e, t) => {
|
|
2649
|
-
let { text: n } = this.#V(), r = n.split("\n").every((t) => e.test(t) || !t.trim());
|
|
2650
|
-
s((n, i) => r ? n.replace(e, "") : n.trim() ? t(i) + n.replace(/^(\s*)([-*+]|\d+[.)])\s+(\[[ xX]\]\s+)?/, "$1") : n);
|
|
2651
|
-
};
|
|
2652
|
-
switch (e) {
|
|
2653
|
-
case "bold": return o("**");
|
|
2654
|
-
case "italic": return o("_");
|
|
2655
|
-
case "strike": return o("~~");
|
|
2656
|
-
case "code": return o("`", "`", "code");
|
|
2657
|
-
case "link": {
|
|
2658
|
-
let e = a || "link text", t = `[${e}](https://)`, n = r + e.length + 3;
|
|
2659
|
-
this.replaceRange(r, i, t, a ? [n, n + 8] : [r + 1, r + 1 + e.length]);
|
|
2660
|
-
return;
|
|
2661
|
-
}
|
|
2662
|
-
case "codeblock": {
|
|
2663
|
-
let { start: e, end: t, text: n } = this.#V(), r = n || "";
|
|
2664
|
-
this.replaceRange(e, t, `\`\`\`\n${r}\n\`\`\``, [e + 4, e + 4 + r.length]);
|
|
2665
|
-
return;
|
|
2666
|
-
}
|
|
2667
|
-
case "heading": return s((e) => {
|
|
2668
|
-
let t = /^(#{1,6})\s+/.exec(e);
|
|
2669
|
-
return t ? t[1].length >= 3 ? e.slice(t[0].length) : `${t[1]}# ${e.slice(t[0].length)}` : `# ${e}`;
|
|
2670
|
-
});
|
|
2671
|
-
case "quote": return c(/^>\s?/, () => "> ");
|
|
2672
|
-
case "bullet": return c(/^\s*[-*+]\s+(?!\[[ xX]\])/, () => "- ");
|
|
2673
|
-
case "numbered": return c(/^\s*\d+[.)]\s+/, (e) => `${e + 1}. `);
|
|
2674
|
-
case "task": return c(/^\s*[-*+]\s+\[[ xX]\]\s+/, () => "- [ ] ");
|
|
2675
|
-
}
|
|
2676
|
-
}
|
|
2677
|
-
#H() {
|
|
2678
|
-
this.listen(this.#c, "click", (e) => {
|
|
2679
|
-
let t = e.target.closest("button");
|
|
2680
|
-
t && (t.dataset.command ? this.format(t.dataset.command) : t.dataset.layout ? this.layout = t.dataset.layout : t.hasAttribute("data-find") && this.openFind());
|
|
2681
|
-
}), this.listen(this.#c, "keydown", (e) => {
|
|
2682
|
-
let t = e, n = Array.from(this.#c.querySelectorAll("button")), r = n.indexOf(document.activeElement);
|
|
2683
|
-
if (r === -1) return;
|
|
2684
|
-
let i = -1;
|
|
2685
|
-
t.key === "ArrowRight" ? i = (r + 1) % n.length : t.key === "ArrowLeft" ? i = (r - 1 + n.length) % n.length : t.key === "Home" ? i = 0 : t.key === "End" && (i = n.length - 1), i !== -1 && (t.preventDefault(), n[r].tabIndex = -1, n[i].tabIndex = 0, n[i].focus());
|
|
2686
|
-
}), this.listen(this.#c, "mousedown", (e) => {
|
|
2687
|
-
e.target.closest("[data-command]") && e.preventDefault();
|
|
2688
|
-
});
|
|
2689
|
-
}
|
|
2690
|
-
#U() {
|
|
2691
|
-
let e = this.#l.querySelector("[data-find-input]"), t = this.#l.querySelector("[data-replace-input]");
|
|
2692
|
-
this.listen(e, "input", () => this.#W(!0)), this.listen(this.#l.querySelector("[data-case]"), "change", () => this.#W(!0)), this.listen(this.#l, "keydown", (n) => {
|
|
2693
|
-
let r = n;
|
|
2694
|
-
r.key === "Escape" ? (r.preventDefault(), this.closeFind()) : r.key === "Enter" && r.target === e ? (r.preventDefault(), this.findNext(r.shiftKey ? -1 : 1)) : r.key === "Enter" && r.target === t && (r.preventDefault(), this.replaceCurrent());
|
|
2695
|
-
}), this.listen(this.#l, "click", (e) => {
|
|
2696
|
-
let t = e.target.closest("button");
|
|
2697
|
-
t && (t.hasAttribute("data-find-next") ? this.findNext(1) : t.hasAttribute("data-find-prev") ? this.findNext(-1) : t.hasAttribute("data-replace") ? this.replaceCurrent() : t.hasAttribute("data-replace-all") ? this.replaceAll() : t.hasAttribute("data-find-close") && this.closeFind());
|
|
2698
|
-
});
|
|
2699
|
-
}
|
|
2700
|
-
openFind() {
|
|
2701
|
-
let e = this.#e;
|
|
2702
|
-
this.#l.hidden = !1;
|
|
2703
|
-
let t = this.#l.querySelector("[data-find-input]"), n = e ? this.value.slice(e.selectionStart, e.selectionEnd) : "";
|
|
2704
|
-
n && !n.includes("\n") && (t.value = n), t.focus(), t.select(), this.#W(!0);
|
|
2705
|
-
}
|
|
2706
|
-
closeFind() {
|
|
2707
|
-
this.#l.hidden = !0, this.#v = [], this.#y = -1, this.#E(), this.#e?.focus();
|
|
2708
|
-
}
|
|
2709
|
-
#W(e) {
|
|
2710
|
-
let t = this.#l.querySelector("[data-find-input]").value, n = this.#l.querySelector("[data-case]").checked;
|
|
2711
|
-
if (this.#v = [], t) {
|
|
2712
|
-
let e = n ? this.value : this.value.toLowerCase(), r = n ? t : t.toLowerCase();
|
|
2713
|
-
for (let t = e.indexOf(r); t !== -1 && this.#v.length < 1e4; t = e.indexOf(r, t + r.length)) this.#v.push({
|
|
2714
|
-
from: t,
|
|
2715
|
-
to: t + r.length
|
|
2716
|
-
});
|
|
2717
|
-
}
|
|
2718
|
-
let r = this.#e?.selectionStart ?? 0;
|
|
2719
|
-
if (e || this.#y >= this.#v.length) {
|
|
2720
|
-
let e = this.#v.findIndex((e) => e.from >= r);
|
|
2721
|
-
this.#y = this.#v.length ? e === -1 ? 0 : e : -1;
|
|
2722
|
-
}
|
|
2723
|
-
this.#G(), this.#E(), e && this.#K();
|
|
2724
|
-
}
|
|
2725
|
-
#G() {
|
|
2726
|
-
let e = this.#l.querySelector("[data-find-input]").value;
|
|
2727
|
-
this.#u.textContent = e ? this.#v.length ? `${this.#y + 1} of ${this.#v.length}` : "No results" : "";
|
|
2728
|
-
}
|
|
2729
|
-
findNext(e = 1) {
|
|
2730
|
-
this.#v.length && (this.#y = (this.#y + e + this.#v.length) % this.#v.length, this.#G(), this.#E(), this.#K());
|
|
2731
|
-
}
|
|
2732
|
-
#K() {
|
|
2733
|
-
let e = this.#v[this.#y], t = this.#e;
|
|
2734
|
-
e && t && (t.setSelectionRange(e.from, e.to), this.revealOffset(e.from, !1));
|
|
2735
|
-
}
|
|
2736
|
-
replaceCurrent() {
|
|
2737
|
-
let e = this.#v[this.#y];
|
|
2738
|
-
if (!e) return;
|
|
2739
|
-
let t = this.#l.querySelector("[data-replace-input]").value;
|
|
2740
|
-
this.replaceRange(e.from, e.to, t), this.#W(!1), this.#v.length && (this.#y = Math.max(0, this.#v.findIndex((n) => n.from >= e.from + t.length)), this.#G(), this.#K()), this.#l.querySelector("[data-replace-input]").focus();
|
|
2741
|
-
}
|
|
2742
|
-
replaceAll() {
|
|
2743
|
-
if (!this.#v.length) return;
|
|
2744
|
-
let e = this.#l.querySelector("[data-replace-input]").value, t = this.#v.length, n = this.#v[0].from, r = this.#v[t - 1].to, i = "", a = n;
|
|
2745
|
-
for (let t of this.#v) i += this.value.slice(a, t.from) + e, a = t.to;
|
|
2746
|
-
this.replaceRange(n, r, i), this.#W(!1), this.#u.textContent = `Replaced ${t}`, this.#l.querySelector("[data-find-input]").focus();
|
|
2747
|
-
}
|
|
2748
|
-
revealOffset(e, t = !0) {
|
|
2749
|
-
let n = this.#e;
|
|
2750
|
-
if (!n) return;
|
|
2751
|
-
t && (n.focus(), n.setSelectionRange(e, e));
|
|
2752
|
-
let r = this.value.slice(0, e).split("\n").length - 1, i = this.#p[r];
|
|
2753
|
-
if (!i) return;
|
|
2754
|
-
let a = i.offsetTop, o = this.#t;
|
|
2755
|
-
(a < o.scrollTop || a + i.offsetHeight > o.scrollTop + o.clientHeight) && (o.scrollTop = Math.max(0, a - o.clientHeight / 3));
|
|
2756
|
-
}
|
|
2757
|
-
#q() {
|
|
2758
|
-
let e = this.#e;
|
|
2759
|
-
if (!e || document.activeElement !== e) return;
|
|
2760
|
-
let t = this.value.slice(0, e.selectionEnd).split("\n").length - 1, n = this.#p[t];
|
|
2761
|
-
if (!n) return;
|
|
2762
|
-
let r = this.#t;
|
|
2763
|
-
n.offsetTop - 24 < r.scrollTop ? r.scrollTop = n.offsetTop - 24 : n.offsetTop + n.offsetHeight + 24 > r.scrollTop + r.clientHeight && (r.scrollTop = n.offsetTop + n.offsetHeight + 24 - r.clientHeight);
|
|
2764
|
-
}
|
|
2765
|
-
};
|
|
2766
|
-
a({ tag: "a-markdown-editor" })(Qe);
|
|
2767
|
-
// src/kit/theme-boot.generated.ts
|
|
2768
|
-
var $e = ":root{background:#ffffff;color:#161a23;color-scheme:light}@media (prefers-color-scheme: dark){:root:not([data-theme='light']){background:#0f1117;color:#e8eaf1;color-scheme:dark}}:root[data-theme='dark']{background:#0f1117;color:#e8eaf1;color-scheme:dark}@media (prefers-contrast: more){:root:not([data-contrast='standard']){background:#ffffff;color:#000000;color-scheme:light}}:root[data-contrast='more']{background:#ffffff;color:#000000;color-scheme:light}@media (prefers-contrast: more) and (prefers-color-scheme: dark){:root:not([data-contrast='standard']):not([data-theme='light']){background:#000000;color:#ffffff;color-scheme:dark}}@media (prefers-contrast: more){:root[data-theme='dark']:not([data-contrast='standard']){background:#000000;color:#ffffff;color-scheme:dark}}@media (prefers-color-scheme: dark){:root[data-contrast='more']:not([data-theme='light']){background:#000000;color:#ffffff;color-scheme:dark}}:root[data-theme='dark'][data-contrast='more']{background:#000000;color:#ffffff;color-scheme:dark}", et = ":root{background:#f5eedf;color:#1d1712;color-scheme:light}@media (prefers-color-scheme: dark){:root:not([data-theme='light']){background:#14100c;color:#efe4d0;color-scheme:dark}}:root[data-theme='dark']{background:#14100c;color:#efe4d0;color-scheme:dark}@media (prefers-contrast: more){:root:not([data-contrast='standard']){background:#f5eedf;color:#000000;color-scheme:light}}:root[data-contrast='more']{background:#f5eedf;color:#000000;color-scheme:light}@media (prefers-contrast: more) and (prefers-color-scheme: dark){:root:not([data-contrast='standard']):not([data-theme='light']){background:#000000;color:#ffffff;color-scheme:dark}}@media (prefers-contrast: more){:root[data-theme='dark']:not([data-contrast='standard']){background:#000000;color:#ffffff;color-scheme:dark}}@media (prefers-color-scheme: dark){:root[data-contrast='more']:not([data-theme='light']){background:#000000;color:#ffffff;color-scheme:dark}}:root[data-theme='dark'][data-contrast='more']{background:#000000;color:#ffffff;color-scheme:dark}", X = "ar-theme", Z = "ar-contrast";
|
|
2769
|
-
function tt(e, t) {
|
|
2770
|
-
try {
|
|
2771
|
-
t === null ? localStorage.removeItem(e) : localStorage.setItem(e, t);
|
|
2772
|
-
} catch {}
|
|
2773
|
-
}
|
|
2774
|
-
var Q = () => document.documentElement, nt = (e) => typeof matchMedia == "function" && matchMedia(e).matches;
|
|
2775
|
-
function rt(e, { themeKey: t = X } = {}) {
|
|
2776
|
-
e === "system" ? Q().removeAttribute("data-theme") : Q().setAttribute("data-theme", e), tt(t, e === "system" ? null : e), Q().dispatchEvent(new CustomEvent("ar-theme-change", { detail: {
|
|
2777
|
-
theme: at(),
|
|
2778
|
-
contrast: $()
|
|
2779
|
-
} }));
|
|
2780
|
-
}
|
|
2781
|
-
function it(e, { contrastKey: t = Z } = {}) {
|
|
2782
|
-
e === "system" ? Q().removeAttribute("data-contrast") : Q().setAttribute("data-contrast", e), tt(t, e === "system" ? null : e), Q().dispatchEvent(new CustomEvent("ar-theme-change", { detail: {
|
|
2783
|
-
theme: at(),
|
|
2784
|
-
contrast: $()
|
|
2785
|
-
} }));
|
|
2786
|
-
}
|
|
2787
|
-
function at() {
|
|
2788
|
-
let e = Q().getAttribute("data-theme");
|
|
2789
|
-
return e === "light" || e === "dark" ? e : nt("(prefers-color-scheme: dark)") ? "dark" : "light";
|
|
2790
|
-
}
|
|
2791
|
-
function $() {
|
|
2792
|
-
let e = Q().getAttribute("data-contrast");
|
|
2793
|
-
return e === "more" || e === "standard" ? e : nt("(prefers-contrast: more)") ? "more" : "standard";
|
|
2794
|
-
}
|
|
2795
|
-
function ot({ themeKey: e = X, contrastKey: t = Z } = {}) {
|
|
2796
|
-
try {
|
|
2797
|
-
let n = localStorage.getItem(e), r = localStorage.getItem(t);
|
|
2798
|
-
(n === "light" || n === "dark") && Q().setAttribute("data-theme", n), (r === "more" || r === "standard") && Q().setAttribute("data-contrast", r);
|
|
2799
|
-
} catch {}
|
|
2800
|
-
}
|
|
2801
|
-
function st({ themeKey: e = X, contrastKey: t = Z } = {}) {
|
|
2802
|
-
return `try{var d=document.documentElement,t=localStorage.getItem(${JSON.stringify(e)}),c=localStorage.getItem(${JSON.stringify(t)});if(t==='light'||t==='dark')d.setAttribute('data-theme',t);if(c==='more'||c==='standard')d.setAttribute('data-contrast',c)}catch(e){}`;
|
|
2803
|
-
}
|
|
2804
|
-
function ct(e = {}) {
|
|
2805
|
-
let t = e.nonce ? ` nonce="${e.nonce.replace(/[^\w+/=-]/g, "")}"` : "";
|
|
2806
|
-
return `<style${t}>${e.palette === "polychrome" ? et : $e}</style><script${t}>${st(e)}<\/script>`;
|
|
2807
|
-
}
|
|
2808
|
-
export { Z as CONTRAST_STORAGE_KEY, $e as CRITICAL_CSS, le as Chart, he as CommandPalette, v as DataTable, ee as FlexView, ne as Form, w as FormulaError, te as List, Qe as MarkdownEditor, et as POLYCHROME_CRITICAL_CSS, Te as Sheet, Se as SheetModel, X as THEME_STORAGE_KEY, D as address, ot as applyStoredTheme, T as colIndex, E as colName, I as evaluateFormula, $ as getContrast, at as getTheme, U as highlightInline, W as highlightLine, Ne as highlightMarkdown, qe as markdownOutline, oe as niceTicks, g as openCellEditor, O as parseAddress, ye as parseFormula, K as renderInline, Ke as renderMarkdown, it as setContrast, rt as setTheme, L as shiftFormula, me as storeSource, ct as themeBootHtml, st as themeBootScript };
|
|
2809
|
-
|
|
2810
|
-
//# sourceMappingURL=components.js.map
|
|
1
|
+
// Kept for compatibility; the entry is ./kit/index.js.
|
|
2
|
+
export * from './kit/index.js';
|