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,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/plugins/directives/html.ts"],
|
|
4
|
-
"sourcesContent": ["import {
|
|
5
|
-
"mappings": "AAAA,SAAS,
|
|
4
|
+
"sourcesContent": ["import { dir } from '../def.js';\n\n/** Sets `innerHTML` from an expression: `html=\"$markup\"`. Scripts inside are not executed. */\nexport const html = dir('html', 6, ({ el, evaluate, effect }) =>\n effect(() => {\n el.innerHTML = String(evaluate() ?? '');\n }),\n);\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,WAAW;AAGb,MAAM,OAAO;AAAA,EAAI;AAAA,EAAQ;AAAA,EAAG,CAAC,EAAE,IAAI,UAAU,OAAO,MACzD,OAAO,MAAM;AACX,OAAG,YAAY,OAAO,SAAS,KAAK,EAAE;AAAA,EACxC,CAAC;AACH;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,23 +1,20 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
for (const [prop, v] of original) el.style.setProperty(prop, v);
|
|
19
|
-
};
|
|
20
|
-
}
|
|
1
|
+
import { kebab } from "../../kernel/index.js";
|
|
2
|
+
import { dir } from "../def.js";
|
|
3
|
+
const style = dir("style", 4, ({ el, key, cased, evaluate, effect }) => {
|
|
4
|
+
const original = /* @__PURE__ */ new Map();
|
|
5
|
+
const put = (prop, v) => {
|
|
6
|
+
if (!original.has(prop)) original.set(prop, el.style.getPropertyValue(prop));
|
|
7
|
+
if (v || v === 0) el.style.setProperty(prop, String(v));
|
|
8
|
+
else el.style.setProperty(prop, original.get(prop) ?? "");
|
|
9
|
+
};
|
|
10
|
+
effect(() => {
|
|
11
|
+
const map = key ? { [cased("kebab")]: evaluate() } : evaluate();
|
|
12
|
+
for (const prop of original.keys()) if (!(prop in map)) put(prop, "");
|
|
13
|
+
for (const prop in map) put(prop.startsWith("--") ? prop : kebab(prop), map[prop]);
|
|
14
|
+
});
|
|
15
|
+
return () => {
|
|
16
|
+
for (const [prop, v] of original) el.style.setProperty(prop, v);
|
|
17
|
+
};
|
|
21
18
|
});
|
|
22
19
|
export {
|
|
23
20
|
style
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/plugins/directives/inline-style.ts"],
|
|
4
|
-
"sourcesContent": ["import {
|
|
5
|
-
"mappings": "AAAA,SAAS,
|
|
4
|
+
"sourcesContent": ["import { kebab } from '../../kernel/index.js';\nimport { dir } from '../def.js';\n\n/** `style:color=\"expr\"` or `style=\"{ color: expr }\"`. Falsy values (except 0) restore the original. */\nexport const style = dir('style', 4, ({ el, key, cased, evaluate, effect }) => {\n const original = new Map<string, string>();\n const put = (prop: string, v: unknown) => {\n if (!original.has(prop)) original.set(prop, el.style.getPropertyValue(prop));\n if (v || v === 0) el.style.setProperty(prop, String(v));\n else el.style.setProperty(prop, original.get(prop) ?? '');\n };\n effect(() => {\n const map: Record<string, unknown> = key ? { [cased('kebab')]: evaluate() } : evaluate();\n for (const prop of original.keys()) if (!(prop in map)) put(prop, '');\n for (const prop in map) put(prop.startsWith('--') ? prop : kebab(prop), map[prop]);\n });\n return () => {\n for (const [prop, v] of original) el.style.setProperty(prop, v);\n };\n});\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,aAAa;AACtB,SAAS,WAAW;AAGb,MAAM,QAAQ,IAAI,SAAS,GAAG,CAAC,EAAE,IAAI,KAAK,OAAO,UAAU,OAAO,MAAM;AAC7E,QAAM,WAAW,oBAAI,IAAoB;AACzC,QAAM,MAAM,CAAC,MAAc,MAAe;AACxC,QAAI,CAAC,SAAS,IAAI,IAAI,EAAG,UAAS,IAAI,MAAM,GAAG,MAAM,iBAAiB,IAAI,CAAC;AAC3E,QAAI,KAAK,MAAM,EAAG,IAAG,MAAM,YAAY,MAAM,OAAO,CAAC,CAAC;AAAA,QACjD,IAAG,MAAM,YAAY,MAAM,SAAS,IAAI,IAAI,KAAK,EAAE;AAAA,EAC1D;AACA,SAAO,MAAM;AACX,UAAM,MAA+B,MAAM,EAAE,CAAC,MAAM,OAAO,CAAC,GAAG,SAAS,EAAE,IAAI,SAAS;AACvF,eAAW,QAAQ,SAAS,KAAK,EAAG,KAAI,EAAE,QAAQ,KAAM,KAAI,MAAM,EAAE;AACpE,eAAW,QAAQ,IAAK,KAAI,KAAK,WAAW,IAAI,IAAI,OAAO,MAAM,IAAI,GAAG,IAAI,IAAI,CAAC;AAAA,EACnF,CAAC;AACD,SAAO,MAAM;AACX,eAAW,CAAC,MAAM,CAAC,KAAK,SAAU,IAAG,MAAM,YAAY,MAAM,CAAC;AAAA,EAChE;AACF,CAAC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { dir } from "../def.js";
|
|
2
2
|
const slots = { "9": /\d/, a: /[a-zA-Z]/, "*": /[a-zA-Z0-9]/ };
|
|
3
3
|
const applyMask = (mask2, raw) => {
|
|
4
4
|
let out = "";
|
|
@@ -17,28 +17,24 @@ const applyMask = (mask2, raw) => {
|
|
|
17
17
|
}
|
|
18
18
|
return out;
|
|
19
19
|
};
|
|
20
|
-
const mask =
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
if (
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
format();
|
|
39
|
-
});
|
|
40
|
-
} else format();
|
|
41
|
-
}
|
|
20
|
+
const mask = dir("mask", 38, ({ el, evaluate, listen, effect }) => {
|
|
21
|
+
const input = el;
|
|
22
|
+
let pattern = "";
|
|
23
|
+
const format = () => {
|
|
24
|
+
const next = applyMask(pattern, input.value);
|
|
25
|
+
if (next !== input.value) {
|
|
26
|
+
const pos = input.selectionStart;
|
|
27
|
+
const atEnd = pos === null || pos >= input.value.length;
|
|
28
|
+
input.value = next;
|
|
29
|
+
if (!atEnd) input.setSelectionRange(pos, pos);
|
|
30
|
+
input.dispatchEvent(new Event("input", { bubbles: true }));
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
listen(input, "input", format);
|
|
34
|
+
effect(() => {
|
|
35
|
+
pattern = String(evaluate() ?? "");
|
|
36
|
+
format();
|
|
37
|
+
});
|
|
42
38
|
});
|
|
43
39
|
export {
|
|
44
40
|
applyMask,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/plugins/directives/mask.ts"],
|
|
4
|
-
"sourcesContent": ["import {
|
|
5
|
-
"mappings": "AAAA,SAAS,
|
|
4
|
+
"sourcesContent": ["import { dir } from '../def.js';\n\nconst slots: Record<string, RegExp> = { '9': /\\d/, a: /[a-zA-Z]/, '*': /[a-zA-Z0-9]/ };\n\n/** Format raw input against a mask: `9` digit, `a` letter, `*` either, anything else literal. */\nexport const applyMask = (mask: string, raw: string): string => {\n let out = '';\n let i = 0;\n for (const m of mask) {\n if (i >= raw.length) break;\n const slot = slots[m];\n if (slot) {\n while (i < raw.length && !slot.test(raw[i])) i++;\n if (i >= raw.length) break;\n out += raw[i++];\n } else {\n out += m;\n if (raw[i] === m) i++;\n }\n }\n return out;\n};\n\n/**\n * Formats the input as the user types: `mask=\"(999) 999-9999\"`. The value is the mask itself;\n * add `__dynamic` to evaluate it as an expression instead (`mask__dynamic=\"$isUS ? '999-999' : '9999'\"`).\n */\nexport const mask = dir('mask', 38, ({ el, evaluate, listen, effect }) => {\n const input = el as HTMLInputElement;\n let pattern = '';\n const format = () => {\n const next = applyMask(pattern, input.value);\n if (next !== input.value) {\n const pos = input.selectionStart;\n const atEnd = pos === null || pos >= input.value.length;\n input.value = next;\n if (!atEnd) input.setSelectionRange(pos, pos);\n input.dispatchEvent(new Event('input', { bubbles: true })); // let `bind` see the formatted value\n }\n };\n listen(input, 'input', format);\n // Literal by default; with `__dynamic` the value is an expression and the mask follows its signals.\n effect(() => {\n pattern = String(evaluate() ?? '');\n format();\n });\n});\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,WAAW;AAEpB,MAAM,QAAgC,EAAE,KAAK,MAAM,GAAG,YAAY,KAAK,cAAc;AAG9E,MAAM,YAAY,CAACA,OAAc,QAAwB;AAC9D,MAAI,MAAM;AACV,MAAI,IAAI;AACR,aAAW,KAAKA,OAAM;AACpB,QAAI,KAAK,IAAI,OAAQ;AACrB,UAAM,OAAO,MAAM,CAAC;AACpB,QAAI,MAAM;AACR,aAAO,IAAI,IAAI,UAAU,CAAC,KAAK,KAAK,IAAI,CAAC,CAAC,EAAG;AAC7C,UAAI,KAAK,IAAI,OAAQ;AACrB,aAAO,IAAI,GAAG;AAAA,IAChB,OAAO;AACL,aAAO;AACP,UAAI,IAAI,CAAC,MAAM,EAAG;AAAA,IACpB;AAAA,EACF;AACA,SAAO;AACT;AAMO,MAAM,OAAO,IAAI,QAAQ,IAAI,CAAC,EAAE,IAAI,UAAU,QAAQ,OAAO,MAAM;AACxE,QAAM,QAAQ;AACd,MAAI,UAAU;AACd,QAAM,SAAS,MAAM;AACnB,UAAM,OAAO,UAAU,SAAS,MAAM,KAAK;AAC3C,QAAI,SAAS,MAAM,OAAO;AACxB,YAAM,MAAM,MAAM;AAClB,YAAM,QAAQ,QAAQ,QAAQ,OAAO,MAAM,MAAM;AACjD,YAAM,QAAQ;AACd,UAAI,CAAC,MAAO,OAAM,kBAAkB,KAAK,GAAG;AAC5C,YAAM,cAAc,IAAI,MAAM,SAAS,EAAE,SAAS,KAAK,CAAC,CAAC;AAAA,IAC3D;AAAA,EACF;AACA,SAAO,OAAO,SAAS,MAAM;AAE7B,SAAO,MAAM;AACX,cAAU,OAAO,SAAS,KAAK,EAAE;AACjC,WAAO;AAAA,EACT,CAAC;AACH,CAAC;",
|
|
6
6
|
"names": ["mask"]
|
|
7
7
|
}
|
|
@@ -1,2 +1,5 @@
|
|
|
1
|
-
/**
|
|
1
|
+
/**
|
|
2
|
+
* Keeps a boolean signal in step with a media query: `match-media:dark="(prefers-color-scheme: dark)"`.
|
|
3
|
+
* The value is a literal; `__dynamic` makes it an expression that can read signals.
|
|
4
|
+
*/
|
|
2
5
|
export declare const matchMedia: import("../../kernel/contracts.js").AttributePlugin;
|
|
@@ -1,17 +1,18 @@
|
|
|
1
|
-
import {
|
|
2
|
-
const matchMedia =
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import { dir } from "../def.js";
|
|
2
|
+
const matchMedia = dir("match-media", 37, ({ cased, evaluate, store, effect, cleanup }) => {
|
|
3
|
+
const path = cased();
|
|
4
|
+
let mql;
|
|
5
|
+
const sync = () => store.set(path, !!mql?.matches);
|
|
6
|
+
const stop = () => mql?.removeEventListener("change", sync);
|
|
7
|
+
effect(() => {
|
|
7
8
|
let q = String(evaluate()).trim();
|
|
8
|
-
if (
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
const sync = () => store.set(path, mql.matches);
|
|
9
|
+
if (/^[\w-]+\s*:/.test(q)) q = `(${q})`;
|
|
10
|
+
stop();
|
|
11
|
+
mql = window.matchMedia(q);
|
|
12
12
|
sync();
|
|
13
|
-
|
|
14
|
-
}
|
|
13
|
+
mql.addEventListener("change", sync);
|
|
14
|
+
});
|
|
15
|
+
cleanup(stop);
|
|
15
16
|
});
|
|
16
17
|
export {
|
|
17
18
|
matchMedia
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/plugins/directives/media-query.ts"],
|
|
4
|
-
"sourcesContent": ["import {
|
|
5
|
-
"mappings": "AAAA,SAAS,
|
|
4
|
+
"sourcesContent": ["import { dir } from '../def.js';\n\n/**\n * Keeps a boolean signal in step with a media query: `match-media:dark=\"(prefers-color-scheme: dark)\"`.\n * The value is a literal; `__dynamic` makes it an expression that can read signals.\n */\nexport const matchMedia = dir('match-media', 37, ({ cased, evaluate, store, effect, cleanup }) => {\n const path = cased();\n let mql: MediaQueryList | undefined;\n const sync = () => store.set(path, !!mql?.matches);\n const stop = () => mql?.removeEventListener('change', sync);\n effect(() => {\n let q = String(evaluate()).trim();\n if (/^[\\w-]+\\s*:/.test(q)) q = `(${q})`; // a bare `feature: value` pair gets its parentheses\n stop();\n mql = window.matchMedia(q);\n sync();\n mql.addEventListener('change', sync);\n });\n cleanup(stop);\n});\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,WAAW;AAMb,MAAM,aAAa,IAAI,eAAe,IAAI,CAAC,EAAE,OAAO,UAAU,OAAO,QAAQ,QAAQ,MAAM;AAChG,QAAM,OAAO,MAAM;AACnB,MAAI;AACJ,QAAM,OAAO,MAAM,MAAM,IAAI,MAAM,CAAC,CAAC,KAAK,OAAO;AACjD,QAAM,OAAO,MAAM,KAAK,oBAAoB,UAAU,IAAI;AAC1D,SAAO,MAAM;AACX,QAAI,IAAI,OAAO,SAAS,CAAC,EAAE,KAAK;AAChC,QAAI,cAAc,KAAK,CAAC,EAAG,KAAI,IAAI,CAAC;AACpC,SAAK;AACL,UAAM,OAAO,WAAW,CAAC;AACzB,SAAK;AACL,QAAI,iBAAiB,UAAU,IAAI;AAAA,EACrC,CAAC;AACD,UAAQ,IAAI;AACd,CAAC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,12 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
value: "required",
|
|
6
|
-
returns: false,
|
|
7
|
-
mount({ mods, evaluate }) {
|
|
8
|
-
withTiming(withViewTransition(() => evaluate(), mods), mods)();
|
|
9
|
-
}
|
|
1
|
+
import { withTiming } from "../../kernel/index.js";
|
|
2
|
+
import { dir } from "../def.js";
|
|
3
|
+
const init = dir("init", 22, ({ mods, evaluate, cleanup }) => {
|
|
4
|
+
withTiming(() => evaluate(), mods, cleanup)();
|
|
10
5
|
});
|
|
11
6
|
export {
|
|
12
7
|
init
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/plugins/directives/on-mount.ts"],
|
|
4
|
-
"sourcesContent": ["import {
|
|
5
|
-
"mappings": "AAAA,SAAS,
|
|
4
|
+
"sourcesContent": ["import { withTiming } from '../../kernel/index.js';\nimport { dir } from '../def.js';\n\n/** Runs once when the element is mounted. Supports `__delay.500ms` and `__viewtransition`. */\nexport const init = dir('init', 22, ({ mods, evaluate, cleanup }) => {\n withTiming(() => evaluate(), mods, cleanup)();\n});\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,kBAAkB;AAC3B,SAAS,WAAW;AAGb,MAAM,OAAO,IAAI,QAAQ,IAAI,CAAC,EAAE,MAAM,UAAU,QAAQ,MAAM;AACnE,aAAW,MAAM,SAAS,GAAG,MAAM,OAAO,EAAE;AAC9C,CAAC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,34 +1,39 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { withTiming } from "../../kernel/index.js";
|
|
2
|
+
import { dir } from "../def.js";
|
|
2
3
|
const touches = (patch, path) => {
|
|
3
4
|
let cur = patch;
|
|
4
5
|
for (const k of path.split(".")) {
|
|
5
|
-
if (cur
|
|
6
|
+
if (cur === null) return true;
|
|
7
|
+
if (typeof cur !== "object" || !(k in cur)) return false;
|
|
6
8
|
cur = cur[k];
|
|
7
9
|
}
|
|
8
10
|
return true;
|
|
9
11
|
};
|
|
10
|
-
const onSignalPatch =
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
args: ["patch"],
|
|
15
|
-
mount({ key, cased, mods, evaluate, listen }) {
|
|
12
|
+
const onSignalPatch = dir(
|
|
13
|
+
"on-signal-patch",
|
|
14
|
+
20,
|
|
15
|
+
({ key, cased, mods, evaluate, listen, cleanup }) => {
|
|
16
16
|
const path = key ? cased() : "";
|
|
17
17
|
let running = false;
|
|
18
|
-
const run = withTiming(
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
18
|
+
const run = withTiming(
|
|
19
|
+
(patch) => {
|
|
20
|
+
if (running) return;
|
|
21
|
+
running = true;
|
|
22
|
+
try {
|
|
23
|
+
evaluate(void 0, patch);
|
|
24
|
+
} finally {
|
|
25
|
+
running = false;
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
mods,
|
|
29
|
+
cleanup
|
|
30
|
+
);
|
|
27
31
|
listen(document, "sigmx-signal-patch", (e) => {
|
|
28
32
|
if (!path || touches(e.detail, path)) run(e.detail);
|
|
29
33
|
});
|
|
30
|
-
}
|
|
31
|
-
|
|
34
|
+
},
|
|
35
|
+
["patch"]
|
|
36
|
+
);
|
|
32
37
|
export {
|
|
33
38
|
onSignalPatch
|
|
34
39
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/plugins/directives/patch-listener.ts"],
|
|
4
|
-
"sourcesContent": ["import {
|
|
5
|
-
"mappings": "AAAA,SAAS,
|
|
4
|
+
"sourcesContent": ["import { withTiming } from '../../kernel/index.js';\nimport { dir } from '../def.js';\n\nconst touches = (patch: Record<string, any>, path: string): boolean => {\n let cur: any = patch;\n for (const k of path.split('.')) {\n if (cur === null) return true; // an ancestor was removed: everything under it changed\n if (typeof cur !== 'object' || !(k in cur)) return false;\n cur = cur[k];\n }\n return true;\n};\n\n/**\n * Runs after signals change, with the patch as `patch`. A key narrows it to one path:\n * `on-signal-patch:user.name=\"...\"`.\n */\nexport const onSignalPatch = dir(\n 'on-signal-patch',\n 20,\n ({ key, cased, mods, evaluate, listen, cleanup }) => {\n const path = key ? cased() : '';\n let running = false;\n const run = withTiming(\n (patch: Record<string, any>) => {\n if (running) return;\n running = true;\n try {\n evaluate(undefined, patch);\n } finally {\n running = false;\n }\n },\n mods,\n cleanup,\n );\n listen(document, 'sigmx-signal-patch', (e: CustomEvent) => {\n if (!path || touches(e.detail, path)) run(e.detail);\n });\n },\n ['patch'],\n);\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,kBAAkB;AAC3B,SAAS,WAAW;AAEpB,MAAM,UAAU,CAAC,OAA4B,SAA0B;AACrE,MAAI,MAAW;AACf,aAAW,KAAK,KAAK,MAAM,GAAG,GAAG;AAC/B,QAAI,QAAQ,KAAM,QAAO;AACzB,QAAI,OAAO,QAAQ,YAAY,EAAE,KAAK,KAAM,QAAO;AACnD,UAAM,IAAI,CAAC;AAAA,EACb;AACA,SAAO;AACT;AAMO,MAAM,gBAAgB;AAAA,EAC3B;AAAA,EACA;AAAA,EACA,CAAC,EAAE,KAAK,OAAO,MAAM,UAAU,QAAQ,QAAQ,MAAM;AACnD,UAAM,OAAO,MAAM,MAAM,IAAI;AAC7B,QAAI,UAAU;AACd,UAAM,MAAM;AAAA,MACV,CAAC,UAA+B;AAC9B,YAAI,QAAS;AACb,kBAAU;AACV,YAAI;AACF,mBAAS,QAAW,KAAK;AAAA,QAC3B,UAAE;AACA,oBAAU;AAAA,QACZ;AAAA,MACF;AAAA,MACA;AAAA,MACA;AAAA,IACF;AACA,WAAO,UAAU,sBAAsB,CAAC,MAAmB;AACzD,UAAI,CAAC,QAAQ,QAAQ,EAAE,QAAQ,IAAI,EAAG,KAAI,EAAE,MAAM;AAAA,IACpD,CAAC;AAAA,EACH;AAAA,EACA,CAAC,OAAO;AACV;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
}
|
|
1
|
+
import { toMs } from "../../kernel/index.js";
|
|
2
|
+
import { dir } from "../def.js";
|
|
3
|
+
const removeMe = dir("remove-me", 34, ({ el, evaluate, value, cleanup, error }) => {
|
|
4
|
+
const delay = value ? String(evaluate()) : "";
|
|
5
|
+
if (delay && toMs([delay], -1) < 0) throw error(`bad delay "${delay}"`);
|
|
6
|
+
const t = setTimeout(() => el.remove(), toMs([delay], 0));
|
|
7
|
+
cleanup(() => clearTimeout(t));
|
|
9
8
|
});
|
|
10
9
|
export {
|
|
11
10
|
removeMe
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/plugins/directives/remove-me.ts"],
|
|
4
|
-
"sourcesContent": ["import {
|
|
5
|
-
"mappings": "AAAA,SAAS,
|
|
4
|
+
"sourcesContent": ["import { toMs } from '../../kernel/index.js';\nimport { dir } from '../def.js';\n\n/** Removes the element after a delay: `remove-me=\"3s\"` (default immediately). Handy for toasts. */\nexport const removeMe = dir('remove-me', 34, ({ el, evaluate, value, cleanup, error }) => {\n const delay = value ? String(evaluate()) : ''; // a literal delay, or an expression with `__dynamic`\n if (delay && toMs([delay], -1) < 0) throw error(`bad delay \"${delay}\"`);\n const t = setTimeout(() => el.remove(), toMs([delay], 0));\n cleanup(() => clearTimeout(t));\n});\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,YAAY;AACrB,SAAS,WAAW;AAGb,MAAM,WAAW,IAAI,aAAa,IAAI,CAAC,EAAE,IAAI,UAAU,OAAO,SAAS,MAAM,MAAM;AACxF,QAAM,QAAQ,QAAQ,OAAO,SAAS,CAAC,IAAI;AAC3C,MAAI,SAAS,KAAK,CAAC,KAAK,GAAG,EAAE,IAAI,EAAG,OAAM,MAAM,cAAc,KAAK,GAAG;AACtE,QAAM,IAAI,WAAW,MAAM,GAAG,OAAO,GAAG,KAAK,CAAC,KAAK,GAAG,CAAC,CAAC;AACxD,UAAQ,MAAM,aAAa,CAAC,CAAC;AAC/B,CAAC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,2 +1,5 @@
|
|
|
1
|
-
/**
|
|
1
|
+
/**
|
|
2
|
+
* Scrolls the element into view when it mounts: `scroll-into-view__smooth__vcenter__focus`.
|
|
3
|
+
* Modifiers: `smooth|instant|auto`, `vstart|vcenter|vend|vnearest`, `focus`.
|
|
4
|
+
*/
|
|
2
5
|
export declare const scrollIntoView: import("../../kernel/contracts.js").AttributePlugin;
|
|
@@ -1,17 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
const pick = (mods,
|
|
3
|
-
const scrollIntoView =
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
behavior: pick(mods, ["smooth", "instant", "auto"], "smooth"),
|
|
10
|
-
block: pick(mods, ["vstart", "vcenter", "vend", "vnearest"], "vcenter").slice(1),
|
|
11
|
-
inline: pick(mods, ["hstart", "hcenter", "hend", "hnearest"], "hcenter").slice(1)
|
|
12
|
-
});
|
|
13
|
-
if (mods.has("focus")) el.focus?.();
|
|
14
|
-
}
|
|
1
|
+
import { dir } from "../def.js";
|
|
2
|
+
const pick = (mods, re, fallback) => [...mods.keys()].find((n) => re.test(n)) ?? fallback;
|
|
3
|
+
const scrollIntoView = dir("scroll-into-view", 10, ({ el, mods }) => {
|
|
4
|
+
el.scrollIntoView({
|
|
5
|
+
behavior: pick(mods, /^(smooth|instant|auto)$/, "smooth"),
|
|
6
|
+
block: pick(mods, /^v(start|center|end|nearest)$/, "vcenter").slice(1)
|
|
7
|
+
});
|
|
8
|
+
if (mods.has("focus")) el.focus?.();
|
|
15
9
|
});
|
|
16
10
|
export {
|
|
17
11
|
scrollIntoView
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/plugins/directives/scroll-to.ts"],
|
|
4
|
-
"sourcesContent": ["import {
|
|
5
|
-
"mappings": "AAAA,SAAS,
|
|
4
|
+
"sourcesContent": ["import { dir } from '../def.js';\n\nconst pick = (mods: Map<string, string[]>, re: RegExp, fallback: string) =>\n [...mods.keys()].find((n) => re.test(n)) ?? fallback;\n\n/**\n * Scrolls the element into view when it mounts: `scroll-into-view__smooth__vcenter__focus`.\n * Modifiers: `smooth|instant|auto`, `vstart|vcenter|vend|vnearest`, `focus`.\n */\nexport const scrollIntoView = dir('scroll-into-view', 10, ({ el, mods }) => {\n el.scrollIntoView({\n behavior: pick(mods, /^(smooth|instant|auto)$/, 'smooth') as ScrollBehavior,\n block: pick(mods, /^v(start|center|end|nearest)$/, 'vcenter').slice(1) as ScrollLogicalPosition,\n });\n if (mods.has('focus')) (el as HTMLElement).focus?.();\n});\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,WAAW;AAEpB,MAAM,OAAO,CAAC,MAA6B,IAAY,aACrD,CAAC,GAAG,KAAK,KAAK,CAAC,EAAE,KAAK,CAAC,MAAM,GAAG,KAAK,CAAC,CAAC,KAAK;AAMvC,MAAM,iBAAiB,IAAI,oBAAoB,IAAI,CAAC,EAAE,IAAI,KAAK,MAAM;AAC1E,KAAG,eAAe;AAAA,IAChB,UAAU,KAAK,MAAM,2BAA2B,QAAQ;AAAA,IACxD,OAAO,KAAK,MAAM,iCAAiC,SAAS,EAAE,MAAM,CAAC;AAAA,EACvE,CAAC;AACD,MAAI,KAAK,IAAI,OAAO,EAAG,CAAC,GAAmB,QAAQ;AACrD,CAAC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,15 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
const run = withTiming(() => evaluate(), mods);
|
|
9
|
-
const ro = new ResizeObserver(() => run());
|
|
10
|
-
ro.observe(el);
|
|
11
|
-
return () => ro.disconnect();
|
|
12
|
-
}
|
|
1
|
+
import { withTiming } from "../../kernel/index.js";
|
|
2
|
+
import { dir } from "../def.js";
|
|
3
|
+
const onResize = dir("on-resize", 22, ({ el, mods, evaluate, cleanup }) => {
|
|
4
|
+
const run = withTiming(() => evaluate(), mods, cleanup);
|
|
5
|
+
const ro = new ResizeObserver(() => run());
|
|
6
|
+
ro.observe(el);
|
|
7
|
+
return () => ro.disconnect();
|
|
13
8
|
});
|
|
14
9
|
export {
|
|
15
10
|
onResize
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/plugins/directives/size-watch.ts"],
|
|
4
|
-
"sourcesContent": ["import {
|
|
5
|
-
"mappings": "AAAA,SAAS,
|
|
4
|
+
"sourcesContent": ["import { withTiming } from '../../kernel/index.js';\nimport { dir } from '../def.js';\n\nexport const onResize = dir('on-resize', 22, ({ el, mods, evaluate, cleanup }) => {\n const run = withTiming(() => evaluate(), mods, cleanup);\n const ro = new ResizeObserver(() => run());\n ro.observe(el);\n return () => ro.disconnect();\n});\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,kBAAkB;AAC3B,SAAS,WAAW;AAEb,MAAM,WAAW,IAAI,aAAa,IAAI,CAAC,EAAE,IAAI,MAAM,UAAU,QAAQ,MAAM;AAChF,QAAM,MAAM,WAAW,MAAM,SAAS,GAAG,MAAM,OAAO;AACtD,QAAM,KAAK,IAAI,eAAe,MAAM,IAAI,CAAC;AACzC,KAAG,QAAQ,EAAE;AACb,SAAO,MAAM,GAAG,WAAW;AAC7B,CAAC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,13 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
const jsonSignals =
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
effect(() => {
|
|
8
|
-
el.textContent = JSON.stringify(store.snapshot(filter), null, mods.has("terse") ? 0 : 2);
|
|
9
|
-
});
|
|
10
|
-
}
|
|
1
|
+
import { dir } from "../def.js";
|
|
2
|
+
const jsonSignals = dir("json-signals", 2, ({ el, value, evaluate, effect, store }) => {
|
|
3
|
+
const filter = value ? evaluate() : void 0;
|
|
4
|
+
effect(() => {
|
|
5
|
+
el.textContent = JSON.stringify(store.snapshot(filter), null, 2);
|
|
6
|
+
});
|
|
11
7
|
});
|
|
12
8
|
export {
|
|
13
9
|
jsonSignals
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/plugins/directives/state-dump.ts"],
|
|
4
|
-
"sourcesContent": ["import {
|
|
5
|
-
"mappings": "AAAA,SAAS,
|
|
4
|
+
"sourcesContent": ["import { dir } from '../def.js';\n\n/** Renders the store (or a filtered part) as JSON. `__terse` for single-line output. */\nexport const jsonSignals = dir('json-signals', 2, ({ el, value, evaluate, effect, store }) => {\n const filter = value ? evaluate() : undefined;\n effect(() => {\n el.textContent = JSON.stringify(store.snapshot(filter), null, 2);\n });\n});\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,WAAW;AAGb,MAAM,cAAc,IAAI,gBAAgB,GAAG,CAAC,EAAE,IAAI,OAAO,UAAU,QAAQ,MAAM,MAAM;AAC5F,QAAM,SAAS,QAAQ,SAAS,IAAI;AACpC,SAAO,MAAM;AACX,OAAG,cAAc,KAAK,UAAU,MAAM,SAAS,MAAM,GAAG,MAAM,CAAC;AAAA,EACjE,CAAC;AACH,CAAC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,14 +1,18 @@
|
|
|
1
|
-
import {
|
|
2
|
-
const persist =
|
|
3
|
-
name
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const
|
|
7
|
-
const filter = value ? evaluate() : void 0;
|
|
8
|
-
const saved = storage.getItem(name);
|
|
1
|
+
import { dir } from "../def.js";
|
|
2
|
+
const persist = dir("persist", 0, ({ key, value, evaluate, store, effect }) => {
|
|
3
|
+
const name = key || "sigmx";
|
|
4
|
+
const filter = value ? evaluate() : void 0;
|
|
5
|
+
try {
|
|
6
|
+
const saved = localStorage.getItem(name);
|
|
9
7
|
if (saved) store.merge(JSON.parse(saved));
|
|
10
|
-
|
|
8
|
+
} catch {
|
|
11
9
|
}
|
|
10
|
+
effect(() => {
|
|
11
|
+
try {
|
|
12
|
+
localStorage.setItem(name, JSON.stringify(store.snapshot(filter, { computed: false })));
|
|
13
|
+
} catch {
|
|
14
|
+
}
|
|
15
|
+
});
|
|
12
16
|
});
|
|
13
17
|
export {
|
|
14
18
|
persist
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/plugins/directives/storage-sync.ts"],
|
|
4
|
-
"sourcesContent": ["import {
|
|
5
|
-
"mappings": "AAAA,SAAS,
|
|
4
|
+
"sourcesContent": ["import { dir } from '../def.js';\n\n/**\n * Saves matching signals to localStorage (`__session` for sessionStorage) and restores them on\n * mount. `persist:key` sets the storage key; the value is an optional `{ include, exclude }` filter.\n * Declare defaults with `signals:x__ifmissing` so restored values are not overwritten.\n */\nexport const persist = dir('persist', 0, ({ key, value, evaluate, store, effect }) => {\n const name = key || 'sigmx';\n const filter = value ? evaluate() : undefined;\n try {\n const saved = localStorage.getItem(name);\n if (saved) store.merge(JSON.parse(saved));\n } catch {} // corrupted or blocked storage: start from the declared defaults\n effect(() => {\n try {\n localStorage.setItem(name, JSON.stringify(store.snapshot(filter, { computed: false })));\n } catch {} // quota exceeded or storage disabled: keep working in memory\n });\n});\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,WAAW;AAOb,MAAM,UAAU,IAAI,WAAW,GAAG,CAAC,EAAE,KAAK,OAAO,UAAU,OAAO,OAAO,MAAM;AACpF,QAAM,OAAO,OAAO;AACpB,QAAM,SAAS,QAAQ,SAAS,IAAI;AACpC,MAAI;AACF,UAAM,QAAQ,aAAa,QAAQ,IAAI;AACvC,QAAI,MAAO,OAAM,MAAM,KAAK,MAAM,KAAK,CAAC;AAAA,EAC1C,QAAQ;AAAA,EAAC;AACT,SAAO,MAAM;AACX,QAAI;AACF,mBAAa,QAAQ,MAAM,KAAK,UAAU,MAAM,SAAS,QAAQ,EAAE,UAAU,MAAM,CAAC,CAAC,CAAC;AAAA,IACxF,QAAQ;AAAA,IAAC;AAAA,EACX,CAAC;AACH,CAAC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,17 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
const teleport =
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
if (el.parentElement === target) return;
|
|
10
|
-
const before = mods.has("prepend") ? target.firstChild : null;
|
|
11
|
-
const t = target;
|
|
12
|
-
if (t.moveBefore) t.moveBefore(el, before);
|
|
13
|
-
else target.insertBefore(el, before);
|
|
14
|
-
}
|
|
1
|
+
import { dir } from "../def.js";
|
|
2
|
+
const teleport = dir("teleport", 38, ({ el, evaluate, error }) => {
|
|
3
|
+
const selector = String(evaluate());
|
|
4
|
+
const target = document.querySelector(selector);
|
|
5
|
+
if (!target) throw error(`no element matches "${selector}"`);
|
|
6
|
+
if (el.parentElement === target) return;
|
|
7
|
+
const t = target;
|
|
8
|
+
(t.moveBefore ?? t.insertBefore).call(t, el, null);
|
|
15
9
|
});
|
|
16
10
|
export {
|
|
17
11
|
teleport
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/plugins/directives/teleport.ts"],
|
|
4
|
-
"sourcesContent": ["import {
|
|
5
|
-
"mappings": "AAAA,SAAS,
|
|
4
|
+
"sourcesContent": ["import { dir } from '../def.js';\n\n/**\n * Moves the element to another place in the document: `teleport=\"body\"` (a selector).\n * `__prepend` inserts at the start. The element and its signals keep working where it lands.\n */\nexport const teleport = dir('teleport', 38, ({ el, evaluate, error }) => {\n const selector = String(evaluate()); // a literal selector, or an expression with `__dynamic`\n const target = document.querySelector(selector);\n if (!target) throw error(`no element matches \"${selector}\"`);\n if (el.parentElement === target) return;\n const t = target as Node & { moveBefore?: (n: Node, b: Node | null) => void };\n // `moveBefore` keeps state and avoids an unmount/remount; fall back to a plain move.\n (t.moveBefore ?? t.insertBefore).call(t, el, null);\n});\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,WAAW;AAMb,MAAM,WAAW,IAAI,YAAY,IAAI,CAAC,EAAE,IAAI,UAAU,MAAM,MAAM;AACvE,QAAM,WAAW,OAAO,SAAS,CAAC;AAClC,QAAM,SAAS,SAAS,cAAc,QAAQ;AAC9C,MAAI,CAAC,OAAQ,OAAM,MAAM,uBAAuB,QAAQ,GAAG;AAC3D,MAAI,GAAG,kBAAkB,OAAQ;AACjC,QAAM,IAAI;AAEV,GAAC,EAAE,cAAc,EAAE,cAAc,KAAK,GAAG,IAAI,IAAI;AACnD,CAAC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
const text =
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
mount: ({ el, evaluate, effect }) => effect(() => {
|
|
1
|
+
import { dir } from "../def.js";
|
|
2
|
+
const text = dir(
|
|
3
|
+
"text",
|
|
4
|
+
6,
|
|
5
|
+
({ el, evaluate, effect }) => effect(() => {
|
|
7
6
|
el.textContent = String(evaluate() ?? "");
|
|
8
7
|
})
|
|
9
|
-
|
|
8
|
+
);
|
|
10
9
|
export {
|
|
11
10
|
text
|
|
12
11
|
};
|