sigmx 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +54 -43
- package/dist/cli.js +3 -1
- package/dist/cli.js.map +2 -2
- package/dist/kernel/compile.d.ts +8 -9
- package/dist/kernel/compile.js +102 -67
- package/dist/kernel/compile.js.map +2 -2
- package/dist/kernel/contracts.d.ts +12 -13
- package/dist/kernel/index.d.ts +11 -12
- package/dist/kernel/index.js +14 -12
- package/dist/kernel/index.js.map +3 -3
- package/dist/kernel/precompile.d.ts +8 -12
- package/dist/kernel/precompile.js +33 -76
- package/dist/kernel/precompile.js.map +2 -2
- package/dist/kernel/precompiled.d.ts +7 -4
- package/dist/kernel/precompiled.js +5 -5
- package/dist/kernel/precompiled.js.map +2 -2
- package/dist/kernel/reactive.d.ts +13 -11
- package/dist/kernel/reactive.js +96 -71
- package/dist/kernel/reactive.js.map +3 -3
- package/dist/kernel/runtime.js +85 -63
- package/dist/kernel/runtime.js.map +3 -3
- package/dist/kernel/scan.d.ts +2 -11
- package/dist/kernel/scan.js +26 -9
- package/dist/kernel/scan.js.map +2 -2
- package/dist/kernel/state.d.ts +5 -8
- package/dist/kernel/state.js +114 -76
- package/dist/kernel/state.js.map +2 -2
- package/dist/kernel/strict-csp.d.ts +0 -5
- package/dist/kernel/strict-csp.js +2 -2
- package/dist/kernel/strict-csp.js.map +2 -2
- package/dist/lib/casing.d.ts +4 -1
- package/dist/lib/casing.js +8 -1
- package/dist/lib/casing.js.map +2 -2
- package/dist/lib/objects.d.ts +5 -4
- package/dist/lib/objects.js +13 -5
- package/dist/lib/objects.js.map +2 -2
- package/dist/lib/schedule.d.ts +3 -5
- package/dist/lib/schedule.js +12 -10
- package/dist/lib/schedule.js.map +2 -2
- package/dist/lib/sse.d.ts +10 -1
- package/dist/lib/sse.js +32 -28
- package/dist/lib/sse.js.map +2 -2
- package/dist/plugins/def.d.ts +5 -0
- package/dist/plugins/def.js +22 -0
- package/dist/plugins/def.js.map +7 -0
- package/dist/plugins/directives/attribute-sync.js +8 -12
- package/dist/plugins/directives/attribute-sync.js.map +2 -2
- package/dist/plugins/directives/boost.d.ts +1 -1
- package/dist/plugins/directives/boost.js +34 -30
- package/dist/plugins/directives/boost.js.map +2 -2
- package/dist/plugins/directives/busy-flag.js +13 -16
- package/dist/plugins/directives/busy-flag.js.map +2 -2
- package/dist/plugins/directives/class-toggle.js +17 -16
- package/dist/plugins/directives/class-toggle.js.map +2 -2
- package/dist/plugins/directives/cloak.js +2 -7
- package/dist/plugins/directives/cloak.js.map +2 -2
- package/dist/plugins/directives/collapse.js +36 -37
- package/dist/plugins/directives/collapse.js.map +2 -2
- package/dist/plugins/directives/declare.js +5 -8
- package/dist/plugins/directives/declare.js.map +2 -2
- package/dist/plugins/directives/derive.js +9 -15
- package/dist/plugins/directives/derive.js.map +2 -2
- package/dist/plugins/directives/element-ref.js +8 -8
- package/dist/plugins/directives/element-ref.js.map +2 -2
- package/dist/plugins/directives/event-listener.js +18 -23
- package/dist/plugins/directives/event-listener.js.map +2 -2
- package/dist/plugins/directives/frame-loop.js +9 -14
- package/dist/plugins/directives/frame-loop.js.map +2 -2
- package/dist/plugins/directives/html.js +6 -7
- package/dist/plugins/directives/html.js.map +2 -2
- package/dist/plugins/directives/inline-style.js +17 -20
- package/dist/plugins/directives/inline-style.js.map +2 -2
- package/dist/plugins/directives/mask.js +19 -23
- package/dist/plugins/directives/mask.js.map +2 -2
- package/dist/plugins/directives/media-query.d.ts +4 -1
- package/dist/plugins/directives/media-query.js +13 -12
- package/dist/plugins/directives/media-query.js.map +2 -2
- package/dist/plugins/directives/on-mount.js +4 -9
- package/dist/plugins/directives/on-mount.js.map +2 -2
- package/dist/plugins/directives/patch-listener.js +24 -19
- package/dist/plugins/directives/patch-listener.js.map +2 -2
- package/dist/plugins/directives/remove-me.js +7 -8
- package/dist/plugins/directives/remove-me.js.map +2 -2
- package/dist/plugins/directives/scroll-to.d.ts +4 -1
- package/dist/plugins/directives/scroll-to.js +8 -14
- package/dist/plugins/directives/scroll-to.js.map +2 -2
- package/dist/plugins/directives/size-watch.js +7 -12
- package/dist/plugins/directives/size-watch.js.map +2 -2
- package/dist/plugins/directives/state-dump.js +6 -10
- package/dist/plugins/directives/state-dump.js.map +2 -2
- package/dist/plugins/directives/storage-sync.js +13 -9
- package/dist/plugins/directives/storage-sync.js.map +2 -2
- package/dist/plugins/directives/teleport.js +8 -14
- package/dist/plugins/directives/teleport.js.map +2 -2
- package/dist/plugins/directives/text-content.js +6 -7
- package/dist/plugins/directives/text-content.js.map +2 -2
- package/dist/plugins/directives/timer.js +7 -13
- package/dist/plugins/directives/timer.js.map +2 -2
- package/dist/plugins/directives/transition.d.ts +1 -2
- package/dist/plugins/directives/transition.js +32 -34
- package/dist/plugins/directives/transition.js.map +2 -2
- package/dist/plugins/directives/tween.d.ts +2 -2
- package/dist/plugins/directives/tween.js +34 -50
- package/dist/plugins/directives/tween.js.map +2 -2
- package/dist/plugins/directives/two-way-bind.d.ts +1 -1
- package/dist/plugins/directives/two-way-bind.js +70 -67
- package/dist/plugins/directives/two-way-bind.js.map +2 -2
- package/dist/plugins/directives/url-params.js +36 -59
- package/dist/plugins/directives/url-params.js.map +3 -3
- package/dist/plugins/directives/url-replace.js +6 -7
- package/dist/plugins/directives/url-replace.js.map +2 -2
- package/dist/plugins/directives/validity.js +6 -9
- package/dist/plugins/directives/validity.js.map +2 -2
- package/dist/plugins/directives/viewport.js +18 -23
- package/dist/plugins/directives/viewport.js.map +2 -2
- package/dist/plugins/directives/visibility.js +9 -14
- package/dist/plugins/directives/visibility.js.map +2 -2
- package/dist/plugins/directives/watch.d.ts +0 -1
- package/dist/plugins/directives/watch.js +2 -8
- package/dist/plugins/directives/watch.js.map +2 -2
- package/dist/plugins/functions/bulk-set.js +10 -7
- package/dist/plugins/functions/bulk-set.js.map +2 -2
- package/dist/plugins/functions/bulk-toggle.js +10 -7
- package/dist/plugins/functions/bulk-toggle.js.map +2 -2
- package/dist/plugins/functions/confirm.js +2 -2
- package/dist/plugins/functions/confirm.js.map +2 -2
- package/dist/plugins/functions/copy-text.js +5 -5
- package/dist/plugins/functions/copy-text.js.map +2 -2
- package/dist/plugins/functions/dispatch.js +5 -5
- package/dist/plugins/functions/dispatch.js.map +2 -2
- package/dist/plugins/functions/locale-format.d.ts +4 -1
- package/dist/plugins/functions/locale-format.js +9 -16
- package/dist/plugins/functions/locale-format.js.map +2 -2
- package/dist/plugins/functions/range-map.js +6 -6
- package/dist/plugins/functions/range-map.js.map +2 -2
- package/dist/plugins/functions/request.d.ts +7 -3
- package/dist/plugins/functions/request.js +85 -80
- package/dist/plugins/functions/request.js.map +2 -2
- package/dist/plugins/functions/untracked-read.js +3 -2
- package/dist/plugins/functions/untracked-read.js.map +2 -2
- package/dist/plugins/functions/websocket.d.ts +3 -3
- package/dist/plugins/functions/websocket.js +18 -25
- package/dist/plugins/functions/websocket.js.map +2 -2
- package/dist/plugins/index.d.ts +34 -36
- package/dist/plugins/index.js +31 -35
- package/dist/plugins/index.js.map +2 -2
- package/dist/plugins/server-events/apply-elements.d.ts +1 -1
- package/dist/plugins/server-events/apply-elements.js +41 -40
- package/dist/plugins/server-events/apply-elements.js.map +2 -2
- package/dist/plugins/server-events/apply-state.js +9 -12
- package/dist/plugins/server-events/apply-state.js.map +2 -2
- package/dist/plugins/server-events/morph.d.ts +0 -2
- package/dist/plugins/server-events/morph.js +58 -55
- package/dist/plugins/server-events/morph.js.map +3 -3
- package/dist/presets/all.d.ts +0 -1
- package/dist/presets/all.js +22 -26
- package/dist/presets/all.js.map +2 -2
- package/dist/presets/essentials.d.ts +0 -1
- package/dist/presets/essentials.js +27 -9
- package/dist/presets/essentials.js.map +2 -2
- package/dist/presets/minimal.d.ts +0 -1
- package/dist/presets/minimal.js +2 -2
- package/dist/presets/minimal.js.map +2 -2
- package/dist/server.d.ts +108 -0
- package/dist/server.js +218 -0
- package/dist/server.js.map +7 -0
- package/dist/sigmx.standalone.js +1 -1
- package/dist/standalone.js.map +2 -2
- package/dist/vite.d.ts +2 -2
- package/dist/vite.js +48 -15
- package/dist/vite.js.map +2 -2
- package/package.json +21 -2
- package/dist/auto.d.ts +0 -1
- package/dist/auto.js +0 -7
- package/dist/auto.js.map +0 -7
- package/dist/core/csp.d.ts +0 -7
- package/dist/core/csp.js +0 -20
- package/dist/core/csp.js.map +0 -7
- package/dist/core/engine.d.ts +0 -10
- package/dist/core/engine.js +0 -200
- package/dist/core/engine.js.map +0 -7
- package/dist/core/expr.d.ts +0 -12
- package/dist/core/expr.js +0 -94
- package/dist/core/expr.js.map +0 -7
- package/dist/core/index.d.ts +0 -16
- package/dist/core/index.js +0 -46
- package/dist/core/index.js.map +0 -7
- package/dist/core/signals.d.ts +0 -42
- package/dist/core/signals.js +0 -195
- package/dist/core/signals.js.map +0 -7
- package/dist/core/store.d.ts +0 -32
- package/dist/core/store.js +0 -185
- package/dist/core/store.js.map +0 -7
- package/dist/core/types.d.ts +0 -101
- package/dist/core/types.js +0 -1
- package/dist/core/types.js.map +0 -7
- package/dist/plugins/actions/clipboard.d.ts +0 -2
- package/dist/plugins/actions/clipboard.js +0 -11
- package/dist/plugins/actions/clipboard.js.map +0 -7
- package/dist/plugins/actions/fit.d.ts +0 -2
- package/dist/plugins/actions/fit.js +0 -14
- package/dist/plugins/actions/fit.js.map +0 -7
- package/dist/plugins/actions/intl.d.ts +0 -2
- package/dist/plugins/actions/intl.js +0 -21
- package/dist/plugins/actions/intl.js.map +0 -7
- package/dist/plugins/actions/peek.d.ts +0 -2
- package/dist/plugins/actions/peek.js +0 -6
- package/dist/plugins/actions/peek.js.map +0 -7
- package/dist/plugins/actions/setAll.d.ts +0 -2
- package/dist/plugins/actions/setAll.js +0 -11
- package/dist/plugins/actions/setAll.js.map +0 -7
- package/dist/plugins/actions/toggleAll.d.ts +0 -2
- package/dist/plugins/actions/toggleAll.js +0 -11
- package/dist/plugins/actions/toggleAll.js.map +0 -7
- package/dist/plugins/attributes/attr.d.ts +0 -2
- package/dist/plugins/attributes/attr.js +0 -20
- package/dist/plugins/attributes/attr.js.map +0 -7
- package/dist/plugins/attributes/bind.d.ts +0 -6
- package/dist/plugins/attributes/bind.js +0 -81
- package/dist/plugins/attributes/bind.js.map +0 -7
- package/dist/plugins/attributes/class.d.ts +0 -2
- package/dist/plugins/attributes/class.js +0 -22
- package/dist/plugins/attributes/class.js.map +0 -7
- package/dist/plugins/attributes/computed.d.ts +0 -2
- package/dist/plugins/attributes/computed.js +0 -20
- package/dist/plugins/attributes/computed.js.map +0 -7
- package/dist/plugins/attributes/customValidity.d.ts +0 -2
- package/dist/plugins/attributes/customValidity.js +0 -14
- package/dist/plugins/attributes/customValidity.js.map +0 -7
- package/dist/plugins/attributes/effect.d.ts +0 -2
- package/dist/plugins/attributes/effect.js +0 -12
- package/dist/plugins/attributes/effect.js.map +0 -7
- package/dist/plugins/attributes/indicator.d.ts +0 -2
- package/dist/plugins/attributes/indicator.js +0 -20
- package/dist/plugins/attributes/indicator.js.map +0 -7
- package/dist/plugins/attributes/init.d.ts +0 -2
- package/dist/plugins/attributes/init.js +0 -14
- package/dist/plugins/attributes/init.js.map +0 -7
- package/dist/plugins/attributes/jsonSignals.d.ts +0 -2
- package/dist/plugins/attributes/jsonSignals.js +0 -15
- package/dist/plugins/attributes/jsonSignals.js.map +0 -7
- package/dist/plugins/attributes/matchMedia.d.ts +0 -2
- package/dist/plugins/attributes/matchMedia.js +0 -19
- package/dist/plugins/attributes/matchMedia.js.map +0 -7
- package/dist/plugins/attributes/on.d.ts +0 -5
- package/dist/plugins/attributes/on.js +0 -28
- package/dist/plugins/attributes/on.js.map +0 -7
- package/dist/plugins/attributes/onIntersect.d.ts +0 -2
- package/dist/plugins/attributes/onIntersect.js +0 -28
- package/dist/plugins/attributes/onIntersect.js.map +0 -7
- package/dist/plugins/attributes/onInterval.d.ts +0 -2
- package/dist/plugins/attributes/onInterval.js +0 -18
- package/dist/plugins/attributes/onInterval.js.map +0 -7
- package/dist/plugins/attributes/onRaf.d.ts +0 -1
- package/dist/plugins/attributes/onRaf.js +0 -19
- package/dist/plugins/attributes/onRaf.js.map +0 -7
- package/dist/plugins/attributes/onResize.d.ts +0 -1
- package/dist/plugins/attributes/onResize.js +0 -17
- package/dist/plugins/attributes/onResize.js.map +0 -7
- package/dist/plugins/attributes/onSignalPatch.d.ts +0 -5
- package/dist/plugins/attributes/onSignalPatch.js +0 -35
- package/dist/plugins/attributes/onSignalPatch.js.map +0 -7
- package/dist/plugins/attributes/persist.d.ts +0 -6
- package/dist/plugins/attributes/persist.js +0 -16
- package/dist/plugins/attributes/persist.js.map +0 -7
- package/dist/plugins/attributes/queryString.d.ts +0 -5
- package/dist/plugins/attributes/queryString.js +0 -54
- package/dist/plugins/attributes/queryString.js.map +0 -7
- package/dist/plugins/attributes/ref.d.ts +0 -2
- package/dist/plugins/attributes/ref.js +0 -13
- package/dist/plugins/attributes/ref.js.map +0 -7
- package/dist/plugins/attributes/replaceUrl.d.ts +0 -1
- package/dist/plugins/attributes/replaceUrl.js +0 -11
- package/dist/plugins/attributes/replaceUrl.js.map +0 -7
- package/dist/plugins/attributes/scrollIntoView.d.ts +0 -2
- package/dist/plugins/attributes/scrollIntoView.js +0 -19
- package/dist/plugins/attributes/scrollIntoView.js.map +0 -7
- package/dist/plugins/attributes/show.d.ts +0 -2
- package/dist/plugins/attributes/show.js +0 -19
- package/dist/plugins/attributes/show.js.map +0 -7
- package/dist/plugins/attributes/signals.d.ts +0 -2
- package/dist/plugins/attributes/signals.js +0 -13
- package/dist/plugins/attributes/signals.js.map +0 -7
- package/dist/plugins/attributes/style.d.ts +0 -2
- package/dist/plugins/attributes/style.js +0 -25
- package/dist/plugins/attributes/style.js.map +0 -7
- package/dist/plugins/attributes/text.d.ts +0 -1
- package/dist/plugins/attributes/text.js +0 -13
- package/dist/plugins/attributes/text.js.map +0 -7
- package/dist/plugins/attributes/viewTransition.d.ts +0 -1
- package/dist/plugins/attributes/viewTransition.js +0 -11
- package/dist/plugins/attributes/viewTransition.js.map +0 -7
- package/dist/plugins/directives/transition-name.d.ts +0 -1
- package/dist/plugins/directives/transition-name.js +0 -11
- package/dist/plugins/directives/transition-name.js.map +0 -7
- package/dist/plugins/directives/trap.d.ts +0 -5
- package/dist/plugins/directives/trap.js +0 -48
- package/dist/plugins/directives/trap.js.map +0 -7
- package/dist/sigmx.auto.js +0 -5
- package/dist/utils/object.d.ts +0 -9
- package/dist/utils/object.js +0 -26
- package/dist/utils/object.js.map +0 -7
- package/dist/utils/text.d.ts +0 -7
- package/dist/utils/text.js +0 -15
- package/dist/utils/text.js.map +0 -7
- package/dist/utils/timing.d.ts +0 -14
- package/dist/utils/timing.js +0 -58
- package/dist/utils/timing.js.map +0 -7
|
@@ -1,33 +1,37 @@
|
|
|
1
|
-
import {
|
|
2
|
-
const boost =
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
history
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
go(a.href, "get", e);
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
go(url
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
1
|
+
import { dir } from "../def.js";
|
|
2
|
+
const boost = dir("boost", 10, ({ el, store, runtime, listen, error, cleanup, report }) => {
|
|
3
|
+
const ctx = { el, store, runtime, error, cleanup, report };
|
|
4
|
+
let current = location.pathname + location.search;
|
|
5
|
+
const go = (url, method, evt, form) => {
|
|
6
|
+
evt.preventDefault();
|
|
7
|
+
const p = runtime.call(method, { ...ctx, el: form ?? el, evt }, [url.href, { contentType: form && "form" }]);
|
|
8
|
+
Promise.resolve(p).then((r) => {
|
|
9
|
+
const next = new URL(r && (r.redirected || form && method === "get") ? r.url : url.href);
|
|
10
|
+
current = next.pathname + next.search;
|
|
11
|
+
history.pushState(null, "", next.href);
|
|
12
|
+
const target = next.hash && document.querySelector(next.hash);
|
|
13
|
+
target ? target.scrollIntoView() : scrollTo(0, 0);
|
|
14
|
+
}, report);
|
|
15
|
+
};
|
|
16
|
+
listen(el, "click", (e) => {
|
|
17
|
+
const a = e.target.closest("a[href]");
|
|
18
|
+
if (a && !(e.defaultPrevented || e.button || e.metaKey || e.ctrlKey || e.shiftKey || a.target) && !a.hasAttribute("download") && a.origin === location.origin && !(a.hash && a.pathname === location.pathname && a.search === location.search))
|
|
19
|
+
go(new URL(a.href), "get", e);
|
|
20
|
+
});
|
|
21
|
+
listen(el, "submit", (e) => {
|
|
22
|
+
const form = e.target;
|
|
23
|
+
const attr = (name) => e.submitter?.getAttribute(`form${name}`) ?? form.getAttribute(name);
|
|
24
|
+
const method = (attr("method") ?? "get").toLowerCase();
|
|
25
|
+
const url = new URL(attr("action") || location.href, location.href);
|
|
26
|
+
if (!e.defaultPrevented && !form.target && method !== "dialog" && url.origin === location.origin)
|
|
27
|
+
go(url, method === "post" ? "post" : "get", e, form);
|
|
28
|
+
});
|
|
29
|
+
listen(window, "popstate", () => {
|
|
30
|
+
const now = location.pathname + location.search;
|
|
31
|
+
if (now === current) return;
|
|
32
|
+
current = now;
|
|
33
|
+
Promise.resolve(runtime.call("get", ctx, [location.href, {}])).then(void 0, report);
|
|
34
|
+
});
|
|
31
35
|
});
|
|
32
36
|
export {
|
|
33
37
|
boost
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/plugins/directives/boost.ts"],
|
|
4
|
-
"sourcesContent": ["import {
|
|
5
|
-
"mappings": "
|
|
4
|
+
"sourcesContent": ["import type { ActionCtx } from '../../kernel/index.js';\nimport { dir } from '../def.js';\n\n/**\n * Turns same-origin links and forms inside the element into requests whose full-document response\n * is morphed into the current page, with history entries: `boost` on a container (or `body`).\n * Needs `httpGet`, `httpPost` and `applyElements`.\n */\nexport const boost = dir('boost', 10, ({ el, store, runtime, listen, error, cleanup, report }) => {\n const ctx: ActionCtx = { el, store, runtime, error, cleanup, report };\n let current = location.pathname + location.search;\n const go = (url: URL, method: string, evt: Event, form?: HTMLFormElement) => {\n evt.preventDefault();\n const p = runtime.call(method, { ...ctx, el: form ?? el, evt }, [url.href, { contentType: form && 'form' }]);\n Promise.resolve(p).then((r) => {\n // The address becomes the final URL: redirects are followed, GET forms carry their fields.\n const next = new URL(r && (r.redirected || (form && method === 'get')) ? r.url : url.href);\n current = next.pathname + next.search;\n history.pushState(null, '', next.href);\n const target = next.hash && document.querySelector(next.hash);\n target ? target.scrollIntoView() : scrollTo(0, 0);\n }, report);\n };\n listen(el, 'click', (e: MouseEvent) => {\n const a = (e.target as Element).closest('a[href]') as HTMLAnchorElement | null;\n if (\n a &&\n !(e.defaultPrevented || e.button || e.metaKey || e.ctrlKey || e.shiftKey || a.target) &&\n !a.hasAttribute('download') &&\n a.origin === location.origin &&\n !(a.hash && a.pathname === location.pathname && a.search === location.search)\n )\n go(new URL(a.href), 'get', e);\n });\n listen(el, 'submit', (e: SubmitEvent) => {\n const form = e.target as HTMLFormElement;\n // Attributes, not properties: an <input name=\"action\"> shadows form.action; the submitter may override.\n const attr = (name: string) => e.submitter?.getAttribute(`form${name}`) ?? form.getAttribute(name);\n const method = (attr('method') ?? 'get').toLowerCase();\n const url = new URL(attr('action') || location.href, location.href);\n if (!e.defaultPrevented && !form.target && method !== 'dialog' && url.origin === location.origin)\n go(url, method === 'post' ? 'post' : 'get', e, form);\n });\n listen(window, 'popstate', () => {\n const now = location.pathname + location.search;\n if (now === current) return; // a hash change: nothing to fetch\n current = now;\n Promise.resolve(runtime.call('get', ctx, [location.href, {}])).then(undefined, report);\n });\n});\n"],
|
|
5
|
+
"mappings": "AACA,SAAS,WAAW;AAOb,MAAM,QAAQ,IAAI,SAAS,IAAI,CAAC,EAAE,IAAI,OAAO,SAAS,QAAQ,OAAO,SAAS,OAAO,MAAM;AAChG,QAAM,MAAiB,EAAE,IAAI,OAAO,SAAS,OAAO,SAAS,OAAO;AACpE,MAAI,UAAU,SAAS,WAAW,SAAS;AAC3C,QAAM,KAAK,CAAC,KAAU,QAAgB,KAAY,SAA2B;AAC3E,QAAI,eAAe;AACnB,UAAM,IAAI,QAAQ,KAAK,QAAQ,EAAE,GAAG,KAAK,IAAI,QAAQ,IAAI,IAAI,GAAG,CAAC,IAAI,MAAM,EAAE,aAAa,QAAQ,OAAO,CAAC,CAAC;AAC3G,YAAQ,QAAQ,CAAC,EAAE,KAAK,CAAC,MAAM;AAE7B,YAAM,OAAO,IAAI,IAAI,MAAM,EAAE,cAAe,QAAQ,WAAW,SAAU,EAAE,MAAM,IAAI,IAAI;AACzF,gBAAU,KAAK,WAAW,KAAK;AAC/B,cAAQ,UAAU,MAAM,IAAI,KAAK,IAAI;AACrC,YAAM,SAAS,KAAK,QAAQ,SAAS,cAAc,KAAK,IAAI;AAC5D,eAAS,OAAO,eAAe,IAAI,SAAS,GAAG,CAAC;AAAA,IAClD,GAAG,MAAM;AAAA,EACX;AACA,SAAO,IAAI,SAAS,CAAC,MAAkB;AACrC,UAAM,IAAK,EAAE,OAAmB,QAAQ,SAAS;AACjD,QACE,KACA,EAAE,EAAE,oBAAoB,EAAE,UAAU,EAAE,WAAW,EAAE,WAAW,EAAE,YAAY,EAAE,WAC9E,CAAC,EAAE,aAAa,UAAU,KAC1B,EAAE,WAAW,SAAS,UACtB,EAAE,EAAE,QAAQ,EAAE,aAAa,SAAS,YAAY,EAAE,WAAW,SAAS;AAEtE,SAAG,IAAI,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC;AAAA,EAChC,CAAC;AACD,SAAO,IAAI,UAAU,CAAC,MAAmB;AACvC,UAAM,OAAO,EAAE;AAEf,UAAM,OAAO,CAAC,SAAiB,EAAE,WAAW,aAAa,OAAO,IAAI,EAAE,KAAK,KAAK,aAAa,IAAI;AACjG,UAAM,UAAU,KAAK,QAAQ,KAAK,OAAO,YAAY;AACrD,UAAM,MAAM,IAAI,IAAI,KAAK,QAAQ,KAAK,SAAS,MAAM,SAAS,IAAI;AAClE,QAAI,CAAC,EAAE,oBAAoB,CAAC,KAAK,UAAU,WAAW,YAAY,IAAI,WAAW,SAAS;AACxF,SAAG,KAAK,WAAW,SAAS,SAAS,OAAO,GAAG,IAAI;AAAA,EACvD,CAAC;AACD,SAAO,QAAQ,YAAY,MAAM;AAC/B,UAAM,MAAM,SAAS,WAAW,SAAS;AACzC,QAAI,QAAQ,QAAS;AACrB,cAAU;AACV,YAAQ,QAAQ,QAAQ,KAAK,OAAO,KAAK,CAAC,SAAS,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,KAAK,QAAW,MAAM;AAAA,EACvF,CAAC;AACH,CAAC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,19 +1,16 @@
|
|
|
1
|
-
import {
|
|
2
|
-
const indicator =
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
});
|
|
15
|
-
return () => store.set(path, false);
|
|
16
|
-
}
|
|
1
|
+
import { dir } from "../def.js";
|
|
2
|
+
const indicator = dir("indicator", 0, ({ el, key, value, cased, store, listen }) => {
|
|
3
|
+
const path = key ? cased() : value.trim();
|
|
4
|
+
const mine = /* @__PURE__ */ new Set();
|
|
5
|
+
store.set(path, false);
|
|
6
|
+
listen(document, "sigmx-fetch", (e) => {
|
|
7
|
+
const { el: from, type, rid } = e.detail;
|
|
8
|
+
if (type === "started" && el.contains(from)) mine.add(rid);
|
|
9
|
+
else if (type === "finished") mine.delete(rid);
|
|
10
|
+
else return;
|
|
11
|
+
store.set(path, mine.size > 0);
|
|
12
|
+
});
|
|
13
|
+
return () => store.set(path, false);
|
|
17
14
|
});
|
|
18
15
|
export {
|
|
19
16
|
indicator
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/plugins/directives/busy-flag.ts"],
|
|
4
|
-
"sourcesContent": ["import {
|
|
5
|
-
"mappings": "AAAA,SAAS,
|
|
4
|
+
"sourcesContent": ["import { dir } from '../def.js';\n\n/** A boolean signal that is true while a request started from this element (or one inside it) is in flight. */\nexport const indicator = dir('indicator', 0, ({ el, key, value, cased, store, listen }) => {\n const path = key ? cased() : value.trim();\n // Requests are remembered by id at `started`, because the element that made one may have been\n // morphed away by the time it finishes.\n const mine = new Set<number>();\n store.set(path, false);\n listen(document, 'sigmx-fetch', (e: CustomEvent<{ el: Element; type: string; rid: number }>) => {\n const { el: from, type, rid } = e.detail;\n if (type === 'started' && el.contains(from)) mine.add(rid);\n else if (type === 'finished') mine.delete(rid);\n else return;\n store.set(path, mine.size > 0);\n });\n return () => store.set(path, false);\n});\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,WAAW;AAGb,MAAM,YAAY,IAAI,aAAa,GAAG,CAAC,EAAE,IAAI,KAAK,OAAO,OAAO,OAAO,OAAO,MAAM;AACzF,QAAM,OAAO,MAAM,MAAM,IAAI,MAAM,KAAK;AAGxC,QAAM,OAAO,oBAAI,IAAY;AAC7B,QAAM,IAAI,MAAM,KAAK;AACrB,SAAO,UAAU,eAAe,CAAC,MAA+D;AAC9F,UAAM,EAAE,IAAI,MAAM,MAAM,IAAI,IAAI,EAAE;AAClC,QAAI,SAAS,aAAa,GAAG,SAAS,IAAI,EAAG,MAAK,IAAI,GAAG;AAAA,aAChD,SAAS,WAAY,MAAK,OAAO,GAAG;AAAA,QACxC;AACL,UAAM,IAAI,MAAM,KAAK,OAAO,CAAC;AAAA,EAC/B,CAAC;AACD,SAAO,MAAM,MAAM,IAAI,MAAM,KAAK;AACpC,CAAC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,20 +1,21 @@
|
|
|
1
|
-
import {
|
|
2
|
-
const className =
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
el.classList.
|
|
12
|
-
|
|
13
|
-
}
|
|
1
|
+
import { dir } from "../def.js";
|
|
2
|
+
const className = dir("class", 4, ({ el, key, cased, evaluate, effect }) => {
|
|
3
|
+
const applied = /* @__PURE__ */ new Set();
|
|
4
|
+
effect(() => {
|
|
5
|
+
const map = key ? { [cased("kebab")]: evaluate() } : evaluate();
|
|
6
|
+
const seen = /* @__PURE__ */ new Set();
|
|
7
|
+
for (const k in map) {
|
|
8
|
+
for (const name of k.split(/\s+/).filter(Boolean)) {
|
|
9
|
+
seen.add(name);
|
|
10
|
+
if (map[k]) {
|
|
11
|
+
if (!el.classList.contains(name)) applied.add(name);
|
|
12
|
+
el.classList.add(name);
|
|
13
|
+
} else if (applied.delete(name)) el.classList.remove(name);
|
|
14
14
|
}
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
}
|
|
15
|
+
}
|
|
16
|
+
for (const name of applied) if (!seen.has(name) && applied.delete(name)) el.classList.remove(name);
|
|
17
|
+
});
|
|
18
|
+
return () => el.classList.remove(...applied);
|
|
18
19
|
});
|
|
19
20
|
export {
|
|
20
21
|
className
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/plugins/directives/class-toggle.ts"],
|
|
4
|
-
"sourcesContent": ["import {
|
|
5
|
-
"mappings": "AAAA,SAAS,
|
|
4
|
+
"sourcesContent": ["import { dir } from '../def.js';\n\n/** `class:active=\"expr\"` or `class=\"{ active: expr, 'a b': expr }\"`. */\nexport const className = dir('class', 4, ({ el, key, cased, evaluate, effect }) => {\n const applied = new Set<string>(); // classes this directive turned on (and that were not already there)\n effect(() => {\n const map: Record<string, unknown> = key ? { [cased('kebab')]: evaluate() } : evaluate();\n const seen = new Set<string>();\n for (const k in map) {\n for (const name of k.split(/\\s+/).filter(Boolean)) {\n seen.add(name);\n if (map[k]) {\n if (!el.classList.contains(name)) applied.add(name);\n el.classList.add(name);\n } else if (applied.delete(name)) el.classList.remove(name);\n }\n }\n for (const name of applied) if (!seen.has(name) && applied.delete(name)) el.classList.remove(name); // key gone from the object\n });\n return () => el.classList.remove(...applied);\n});\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,WAAW;AAGb,MAAM,YAAY,IAAI,SAAS,GAAG,CAAC,EAAE,IAAI,KAAK,OAAO,UAAU,OAAO,MAAM;AACjF,QAAM,UAAU,oBAAI,IAAY;AAChC,SAAO,MAAM;AACX,UAAM,MAA+B,MAAM,EAAE,CAAC,MAAM,OAAO,CAAC,GAAG,SAAS,EAAE,IAAI,SAAS;AACvF,UAAM,OAAO,oBAAI,IAAY;AAC7B,eAAW,KAAK,KAAK;AACnB,iBAAW,QAAQ,EAAE,MAAM,KAAK,EAAE,OAAO,OAAO,GAAG;AACjD,aAAK,IAAI,IAAI;AACb,YAAI,IAAI,CAAC,GAAG;AACV,cAAI,CAAC,GAAG,UAAU,SAAS,IAAI,EAAG,SAAQ,IAAI,IAAI;AAClD,aAAG,UAAU,IAAI,IAAI;AAAA,QACvB,WAAW,QAAQ,OAAO,IAAI,EAAG,IAAG,UAAU,OAAO,IAAI;AAAA,MAC3D;AAAA,IACF;AACA,eAAW,QAAQ,QAAS,KAAI,CAAC,KAAK,IAAI,IAAI,KAAK,QAAQ,OAAO,IAAI,EAAG,IAAG,UAAU,OAAO,IAAI;AAAA,EACnG,CAAC;AACD,SAAO,MAAM,GAAG,UAAU,OAAO,GAAG,OAAO;AAC7C,CAAC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,10 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
const cloak =
|
|
3
|
-
name: "cloak",
|
|
4
|
-
key: "forbidden",
|
|
5
|
-
value: "forbidden",
|
|
6
|
-
mount: ({ el, attr }) => el.removeAttribute(attr)
|
|
7
|
-
});
|
|
1
|
+
import { dir } from "../def.js";
|
|
2
|
+
const cloak = dir("cloak", 10, ({ el, attr }) => el.removeAttribute(attr));
|
|
8
3
|
export {
|
|
9
4
|
cloak
|
|
10
5
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/plugins/directives/cloak.ts"],
|
|
4
|
-
"sourcesContent": ["import {
|
|
5
|
-
"mappings": "AAAA,SAAS,
|
|
4
|
+
"sourcesContent": ["import { dir } from '../def.js';\n\n/**\n * Removed as soon as the element mounts. Pair it with CSS that hides cloaked markup until then:\n * `[data-cloak] { display: none !important }`.\n */\nexport const cloak = dir('cloak', 10, ({ el, attr }) => el.removeAttribute(attr));\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,WAAW;AAMb,MAAM,QAAQ,IAAI,SAAS,IAAI,CAAC,EAAE,IAAI,KAAK,MAAM,GAAG,gBAAgB,IAAI,CAAC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,40 +1,39 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
}
|
|
1
|
+
import { toMs } from "../../kernel/index.js";
|
|
2
|
+
import { dir } from "../def.js";
|
|
3
|
+
const collapse = dir("collapse", 6, ({ el, mods, evaluate, effect, cleanup }) => {
|
|
4
|
+
const style = el.style;
|
|
5
|
+
const ms = toMs(mods.get("duration"), 250);
|
|
6
|
+
const instant = matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
7
|
+
const own = [style.height, style.overflow, style.transition];
|
|
8
|
+
let timer;
|
|
9
|
+
let first = true;
|
|
10
|
+
let last;
|
|
11
|
+
const settle = (open) => {
|
|
12
|
+
style.transition = "";
|
|
13
|
+
style.overflow = open ? "" : "hidden";
|
|
14
|
+
style.height = open ? "" : "0px";
|
|
15
|
+
};
|
|
16
|
+
effect(() => {
|
|
17
|
+
const open = !!evaluate();
|
|
18
|
+
if (open === last) return;
|
|
19
|
+
last = open;
|
|
20
|
+
clearTimeout(timer);
|
|
21
|
+
if (first || instant) {
|
|
22
|
+
first = false;
|
|
23
|
+
return settle(open);
|
|
24
|
+
}
|
|
25
|
+
const from = `${el.getBoundingClientRect().height}px`;
|
|
26
|
+
style.overflow = "hidden";
|
|
27
|
+
style.height = open ? "0px" : from;
|
|
28
|
+
void el.getBoundingClientRect();
|
|
29
|
+
style.transition = `height ${ms}ms ease`;
|
|
30
|
+
style.height = open ? `${el.scrollHeight}px` : "0px";
|
|
31
|
+
timer = setTimeout(() => settle(open), ms + 20);
|
|
32
|
+
});
|
|
33
|
+
cleanup(() => {
|
|
34
|
+
clearTimeout(timer);
|
|
35
|
+
[style.height, style.overflow, style.transition] = own;
|
|
36
|
+
});
|
|
38
37
|
});
|
|
39
38
|
export {
|
|
40
39
|
collapse
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/plugins/directives/collapse.ts"],
|
|
4
|
-
"sourcesContent": ["import {
|
|
5
|
-
"mappings": "AAAA,SAAS,
|
|
4
|
+
"sourcesContent": ["import { toMs } from '../../kernel/index.js';\nimport { dir } from '../def.js';\n\n/**\n * Animates the element's height open and closed: `collapse=\"$open\"`.\n * Modifiers: `__duration.250ms`, `__min.40px` (collapsed height, default 0).\n */\nexport const collapse = dir('collapse', 6, ({ el, mods, evaluate, effect, cleanup }) => {\n const style = (el as HTMLElement).style;\n const ms = toMs(mods.get('duration'), 250);\n const instant = matchMedia('(prefers-reduced-motion: reduce)').matches;\n const own = [style.height, style.overflow, style.transition];\n let timer: ReturnType<typeof setTimeout> | undefined;\n let first = true;\n let last: boolean | undefined;\n const settle = (open: boolean) => {\n style.transition = '';\n style.overflow = open ? '' : 'hidden';\n style.height = open ? '' : '0px';\n };\n effect(() => {\n const open = !!evaluate();\n if (open === last) return;\n last = open;\n clearTimeout(timer);\n if (first || instant) {\n first = false;\n return settle(open);\n }\n const from = `${el.getBoundingClientRect().height}px`;\n style.overflow = 'hidden';\n style.height = open ? '0px' : from;\n void el.getBoundingClientRect(); // commit the start height before transitioning\n style.transition = `height ${ms}ms ease`;\n style.height = open ? `${el.scrollHeight}px` : '0px';\n timer = setTimeout(() => settle(open), ms + 20);\n });\n cleanup(() => {\n clearTimeout(timer);\n [style.height, style.overflow, style.transition] = own;\n });\n});\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,YAAY;AACrB,SAAS,WAAW;AAMb,MAAM,WAAW,IAAI,YAAY,GAAG,CAAC,EAAE,IAAI,MAAM,UAAU,QAAQ,QAAQ,MAAM;AACtF,QAAM,QAAS,GAAmB;AAClC,QAAM,KAAK,KAAK,KAAK,IAAI,UAAU,GAAG,GAAG;AACzC,QAAM,UAAU,WAAW,kCAAkC,EAAE;AAC/D,QAAM,MAAM,CAAC,MAAM,QAAQ,MAAM,UAAU,MAAM,UAAU;AAC3D,MAAI;AACJ,MAAI,QAAQ;AACZ,MAAI;AACJ,QAAM,SAAS,CAAC,SAAkB;AAChC,UAAM,aAAa;AACnB,UAAM,WAAW,OAAO,KAAK;AAC7B,UAAM,SAAS,OAAO,KAAK;AAAA,EAC7B;AACA,SAAO,MAAM;AACX,UAAM,OAAO,CAAC,CAAC,SAAS;AACxB,QAAI,SAAS,KAAM;AACnB,WAAO;AACP,iBAAa,KAAK;AAClB,QAAI,SAAS,SAAS;AACpB,cAAQ;AACR,aAAO,OAAO,IAAI;AAAA,IACpB;AACA,UAAM,OAAO,GAAG,GAAG,sBAAsB,EAAE,MAAM;AACjD,UAAM,WAAW;AACjB,UAAM,SAAS,OAAO,QAAQ;AAC9B,SAAK,GAAG,sBAAsB;AAC9B,UAAM,aAAa,UAAU,EAAE;AAC/B,UAAM,SAAS,OAAO,GAAG,GAAG,YAAY,OAAO;AAC/C,YAAQ,WAAW,MAAM,OAAO,IAAI,GAAG,KAAK,EAAE;AAAA,EAChD,CAAC;AACD,UAAQ,MAAM;AACZ,iBAAa,KAAK;AAClB,KAAC,MAAM,QAAQ,MAAM,UAAU,MAAM,UAAU,IAAI;AAAA,EACrD,CAAC;AACH,CAAC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const v = evaluate();
|
|
7
|
-
store.merge(key ? expand({}, cased(), v) : v, { ifMissing: mods.has("ifmissing") });
|
|
8
|
-
}
|
|
1
|
+
import { expand } from "../../kernel/index.js";
|
|
2
|
+
import { dir } from "../def.js";
|
|
3
|
+
const signals = dir("signals", 4, ({ key, cased, evaluate, store, mods }) => {
|
|
4
|
+
const v = evaluate();
|
|
5
|
+
store.merge(key ? expand({}, cased(), v) : v, { ifMissing: mods.has("ifmissing") });
|
|
9
6
|
});
|
|
10
7
|
export {
|
|
11
8
|
signals
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/plugins/directives/declare.ts"],
|
|
4
|
-
"sourcesContent": ["import {
|
|
5
|
-
"mappings": "AAAA,SAAS,
|
|
4
|
+
"sourcesContent": ["import { expand } from '../../kernel/index.js';\nimport { dir } from '../def.js';\n\n/** `signals:name=\"expr\"` or `signals=\"{ ... }\"`. `__ifmissing` keeps existing values. */\nexport const signals = dir('signals', 4, ({ key, cased, evaluate, store, mods }) => {\n const v = evaluate();\n store.merge(key ? expand({}, cased(), v) : v, { ifMissing: mods.has('ifmissing') });\n});\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,cAAc;AACvB,SAAS,WAAW;AAGb,MAAM,UAAU,IAAI,WAAW,GAAG,CAAC,EAAE,KAAK,OAAO,UAAU,OAAO,KAAK,MAAM;AAClF,QAAM,IAAI,SAAS;AACnB,QAAM,MAAM,MAAM,OAAO,CAAC,GAAG,MAAM,GAAG,CAAC,IAAI,GAAG,EAAE,WAAW,KAAK,IAAI,WAAW,EAAE,CAAC;AACpF,CAAC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,18 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
const obj = evaluate();
|
|
11
|
-
for (const k in obj) {
|
|
12
|
-
if (typeof obj[k] !== "function") throw error(`"${k}" must be a function`);
|
|
13
|
-
store.define(k, makeComputed(obj[k]));
|
|
14
|
-
}
|
|
15
|
-
}
|
|
1
|
+
import { computed as makeComputed } from "../../kernel/index.js";
|
|
2
|
+
import { dir } from "../def.js";
|
|
3
|
+
const computed = dir("computed", 5, ({ cased, evaluate, store }) => {
|
|
4
|
+
const path = cased();
|
|
5
|
+
store.define(
|
|
6
|
+
path,
|
|
7
|
+
makeComputed(() => evaluate())
|
|
8
|
+
);
|
|
9
|
+
return () => store.remove(path);
|
|
16
10
|
});
|
|
17
11
|
export {
|
|
18
12
|
computed
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/plugins/directives/derive.ts"],
|
|
4
|
-
"sourcesContent": ["import {
|
|
5
|
-
"mappings": "AAAA,SAAS,
|
|
4
|
+
"sourcesContent": ["import { computed as makeComputed } from '../../kernel/index.js';\nimport { dir } from '../def.js';\n\n/** `computed:name=\"expr\"` or `computed=\"{ name: () => expr }\"`. */\nexport const computed = dir('computed', 5, ({ cased, evaluate, store }) => {\n const path = cased();\n store.define(\n path,\n makeComputed(() => evaluate()),\n );\n return () => store.remove(path); // unsubscribes the computed from everything it read\n});\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,YAAY,oBAAoB;AACzC,SAAS,WAAW;AAGb,MAAM,WAAW,IAAI,YAAY,GAAG,CAAC,EAAE,OAAO,UAAU,MAAM,MAAM;AACzE,QAAM,OAAO,MAAM;AACnB,QAAM;AAAA,IACJ;AAAA,IACA,aAAa,MAAM,SAAS,CAAC;AAAA,EAC/B;AACA,SAAO,MAAM,MAAM,OAAO,IAAI;AAChC,CAAC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
}
|
|
1
|
+
import { untracked } from "../../kernel/index.js";
|
|
2
|
+
import { dir } from "../def.js";
|
|
3
|
+
const ref = dir("ref", 0, ({ el, key, value, cased, store }) => {
|
|
4
|
+
const path = key ? cased() : value.trim();
|
|
5
|
+
store.set(path, el);
|
|
6
|
+
return () => {
|
|
7
|
+
if (untracked(() => store.get(path)) === el) store.remove(path);
|
|
8
|
+
};
|
|
9
9
|
});
|
|
10
10
|
export {
|
|
11
11
|
ref
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/plugins/directives/element-ref.ts"],
|
|
4
|
-
"sourcesContent": ["import {
|
|
5
|
-
"mappings": "AAAA,SAAS,iBAAiB;
|
|
4
|
+
"sourcesContent": ["import { untracked } from '../../kernel/index.js';\nimport { dir } from '../def.js';\n\n/** Stores the element in a signal: `ref:dialog` or `ref=\"dialog\"`. */\nexport const ref = dir('ref', 0, ({ el, key, value, cased, store }) => {\n const path = key ? cased() : value.trim();\n store.set(path, el);\n return () => {\n if (untracked(() => store.get(path)) === el) store.remove(path);\n };\n});\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,iBAAiB;AAC1B,SAAS,WAAW;AAGb,MAAM,MAAM,IAAI,OAAO,GAAG,CAAC,EAAE,IAAI,KAAK,OAAO,OAAO,MAAM,MAAM;AACrE,QAAM,OAAO,MAAM,MAAM,IAAI,MAAM,KAAK;AACxC,QAAM,IAAI,MAAM,EAAE;AAClB,SAAO,MAAM;AACX,QAAI,UAAU,MAAM,MAAM,IAAI,IAAI,CAAC,MAAM,GAAI,OAAM,OAAO,IAAI;AAAA,EAChE;AACF,CAAC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,26 +1,21 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
(e)
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
run(e);
|
|
20
|
-
},
|
|
21
|
-
{ capture: mods.has("capture"), passive: mods.has("passive"), once: mods.has("once") }
|
|
22
|
-
);
|
|
23
|
-
}
|
|
1
|
+
import { withTiming } from "../../kernel/index.js";
|
|
2
|
+
import { dir } from "../def.js";
|
|
3
|
+
const on = dir("on", 21, ({ el, mods, cased, evaluate, listen, cleanup }) => {
|
|
4
|
+
const type = cased("kebab");
|
|
5
|
+
const outside = mods.has("outside");
|
|
6
|
+
const target = mods.has("window") ? window : mods.has("document") || outside || type.startsWith("sigmx-") ? document : el;
|
|
7
|
+
const run = withTiming((e) => evaluate(e), mods, cleanup);
|
|
8
|
+
listen(
|
|
9
|
+
target,
|
|
10
|
+
type,
|
|
11
|
+
(e) => {
|
|
12
|
+
if (outside && el.contains(e.target)) return;
|
|
13
|
+
if (mods.has("prevent") || type === "submit" && el instanceof HTMLFormElement) e.preventDefault();
|
|
14
|
+
if (mods.has("stop")) e.stopPropagation();
|
|
15
|
+
run(e);
|
|
16
|
+
},
|
|
17
|
+
{ once: mods.has("once") }
|
|
18
|
+
);
|
|
24
19
|
});
|
|
25
20
|
export {
|
|
26
21
|
on
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/plugins/directives/event-listener.ts"],
|
|
4
|
-
"sourcesContent": ["import {
|
|
5
|
-
"mappings": "AAAA,SAAS,
|
|
4
|
+
"sourcesContent": ["import { withTiming } from '../../kernel/index.js';\nimport { dir } from '../def.js';\n\n/**\n * `on:click=\"expr\"`. Modifiers: window, document, outside, prevent, stop, capture, passive, once,\n * delay/debounce/throttle, viewtransition, case.\n */\nexport const on = dir('on', 21, ({ el, mods, cased, evaluate, listen, cleanup }) => {\n const type = cased('kebab');\n const outside = mods.has('outside');\n const target: EventTarget = mods.has('window')\n ? window\n : mods.has('document') || outside || type.startsWith('sigmx-')\n ? document\n : el;\n const run = withTiming((e: Event) => evaluate(e), mods, cleanup);\n listen(\n target,\n type,\n (e: Event) => {\n if (outside && el.contains(e.target as Node)) return;\n if (mods.has('prevent') || (type === 'submit' && el instanceof HTMLFormElement)) e.preventDefault();\n if (mods.has('stop')) e.stopPropagation();\n run(e);\n },\n { once: mods.has('once') },\n );\n});\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,kBAAkB;AAC3B,SAAS,WAAW;AAMb,MAAM,KAAK,IAAI,MAAM,IAAI,CAAC,EAAE,IAAI,MAAM,OAAO,UAAU,QAAQ,QAAQ,MAAM;AAClF,QAAM,OAAO,MAAM,OAAO;AAC1B,QAAM,UAAU,KAAK,IAAI,SAAS;AAClC,QAAM,SAAsB,KAAK,IAAI,QAAQ,IACzC,SACA,KAAK,IAAI,UAAU,KAAK,WAAW,KAAK,WAAW,QAAQ,IACzD,WACA;AACN,QAAM,MAAM,WAAW,CAAC,MAAa,SAAS,CAAC,GAAG,MAAM,OAAO;AAC/D;AAAA,IACE;AAAA,IACA;AAAA,IACA,CAAC,MAAa;AACZ,UAAI,WAAW,GAAG,SAAS,EAAE,MAAc,EAAG;AAC9C,UAAI,KAAK,IAAI,SAAS,KAAM,SAAS,YAAY,cAAc,gBAAkB,GAAE,eAAe;AAClG,UAAI,KAAK,IAAI,MAAM,EAAG,GAAE,gBAAgB;AACxC,UAAI,CAAC;AAAA,IACP;AAAA,IACA,EAAE,MAAM,KAAK,IAAI,MAAM,EAAE;AAAA,EAC3B;AACF,CAAC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,17 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
run();
|
|
11
|
-
id = requestAnimationFrame(tick);
|
|
12
|
-
});
|
|
13
|
-
return () => cancelAnimationFrame(id);
|
|
14
|
-
}
|
|
1
|
+
import { withTiming } from "../../kernel/index.js";
|
|
2
|
+
import { dir } from "../def.js";
|
|
3
|
+
const onRaf = dir("on-raf", 22, ({ mods, evaluate, cleanup }) => {
|
|
4
|
+
const run = withTiming(() => evaluate(), mods, cleanup);
|
|
5
|
+
let id = requestAnimationFrame(function tick() {
|
|
6
|
+
run();
|
|
7
|
+
id = requestAnimationFrame(tick);
|
|
8
|
+
});
|
|
9
|
+
return () => cancelAnimationFrame(id);
|
|
15
10
|
});
|
|
16
11
|
export {
|
|
17
12
|
onRaf
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/plugins/directives/frame-loop.ts"],
|
|
4
|
-
"sourcesContent": ["import {
|
|
5
|
-
"mappings": "AAAA,SAAS,
|
|
4
|
+
"sourcesContent": ["import { withTiming } from '../../kernel/index.js';\nimport { dir } from '../def.js';\n\nexport const onRaf = dir('on-raf', 22, ({ mods, evaluate, cleanup }) => {\n const run = withTiming(() => evaluate(), mods, cleanup);\n let id = requestAnimationFrame(function tick() {\n run();\n id = requestAnimationFrame(tick);\n });\n return () => cancelAnimationFrame(id);\n});\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,kBAAkB;AAC3B,SAAS,WAAW;AAEb,MAAM,QAAQ,IAAI,UAAU,IAAI,CAAC,EAAE,MAAM,UAAU,QAAQ,MAAM;AACtE,QAAM,MAAM,WAAW,MAAM,SAAS,GAAG,MAAM,OAAO;AACtD,MAAI,KAAK,sBAAsB,SAAS,OAAO;AAC7C,QAAI;AACJ,SAAK,sBAAsB,IAAI;AAAA,EACjC,CAAC;AACD,SAAO,MAAM,qBAAqB,EAAE;AACtC,CAAC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
const html =
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
mount: ({ el, evaluate, effect }) => effect(() => {
|
|
1
|
+
import { dir } from "../def.js";
|
|
2
|
+
const html = dir(
|
|
3
|
+
"html",
|
|
4
|
+
6,
|
|
5
|
+
({ el, evaluate, effect }) => effect(() => {
|
|
7
6
|
el.innerHTML = String(evaluate() ?? "");
|
|
8
7
|
})
|
|
9
|
-
|
|
8
|
+
);
|
|
10
9
|
export {
|
|
11
10
|
html
|
|
12
11
|
};
|