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/text-content.ts"],
|
|
4
|
-
"sourcesContent": ["import {
|
|
5
|
-
"mappings": "AAAA,SAAS,
|
|
4
|
+
"sourcesContent": ["import { dir } from '../def.js';\n\nexport const text = dir('text', 6, ({ el, evaluate, effect }) =>\n effect(() => {\n el.textContent = String(evaluate() ?? '');\n }),\n);\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,WAAW;AAEb,MAAM,OAAO;AAAA,EAAI;AAAA,EAAQ;AAAA,EAAG,CAAC,EAAE,IAAI,UAAU,OAAO,MACzD,OAAO,MAAM;AACX,OAAG,cAAc,OAAO,SAAS,KAAK,EAAE;AAAA,EAC1C,CAAC;AACH;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,16 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
const d = mods.get("duration");
|
|
9
|
-
const run = withViewTransition(() => evaluate(), mods);
|
|
10
|
-
if (d?.includes("leading")) run();
|
|
11
|
-
const id = setInterval(run, toMs(d, 1e3));
|
|
12
|
-
return () => clearInterval(id);
|
|
13
|
-
}
|
|
1
|
+
import { toMs } from "../../kernel/index.js";
|
|
2
|
+
import { dir } from "../def.js";
|
|
3
|
+
const onInterval = dir("on-interval", 22, ({ mods, evaluate }) => {
|
|
4
|
+
const d = mods.get("duration");
|
|
5
|
+
const run = () => evaluate();
|
|
6
|
+
const id = setInterval(run, toMs(d, 1e3));
|
|
7
|
+
return () => clearInterval(id);
|
|
14
8
|
});
|
|
15
9
|
export {
|
|
16
10
|
onInterval
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/plugins/directives/timer.ts"],
|
|
4
|
-
"sourcesContent": ["import {
|
|
5
|
-
"mappings": "AAAA,SAAS,
|
|
4
|
+
"sourcesContent": ["import { toMs } from '../../kernel/index.js';\nimport { dir } from '../def.js';\n\n/** `on-interval__duration.5s.leading=\"expr\"`. Default one second. */\nexport const onInterval = dir('on-interval', 22, ({ mods, evaluate }) => {\n const d = mods.get('duration');\n const run = () => evaluate();\n const id = setInterval(run, toMs(d, 1000));\n return () => clearInterval(id);\n});\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,YAAY;AACrB,SAAS,WAAW;AAGb,MAAM,aAAa,IAAI,eAAe,IAAI,CAAC,EAAE,MAAM,SAAS,MAAM;AACvE,QAAM,IAAI,KAAK,IAAI,UAAU;AAC7B,QAAM,MAAM,MAAM,SAAS;AAC3B,QAAM,KAAK,YAAY,KAAK,KAAK,GAAG,GAAI,CAAC;AACzC,SAAO,MAAM,cAAc,EAAE;AAC/B,CAAC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Shows and hides with a fade
|
|
3
|
-
* Modifiers: `__duration.200ms`, `__scale` (from 95%) or `__scale.90`, `__origin.top`.
|
|
2
|
+
* Shows and hides with a fade: `transition="$open"`. Modifier: `__duration.200ms`.
|
|
4
3
|
*/
|
|
5
4
|
export declare const transition: import("../../kernel/contracts.js").AttributePlugin;
|
|
@@ -1,38 +1,36 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
1
|
+
import { toMs } from "../../kernel/index.js";
|
|
2
|
+
import { dir } from "../def.js";
|
|
3
|
+
const transition = dir("transition", 6, ({ el, mods, evaluate, effect, cleanup }) => {
|
|
4
|
+
const style = el.style;
|
|
5
|
+
const duration = matchMedia("(prefers-reduced-motion: reduce)").matches ? 0 : toMs(mods.get("duration"), 200);
|
|
6
|
+
const hidden = { opacity: 0 };
|
|
7
|
+
const shown = { opacity: 1 };
|
|
8
|
+
const own = style.display;
|
|
9
|
+
const initial = own === "none" ? "" : own;
|
|
10
|
+
let anim;
|
|
11
|
+
let first = true;
|
|
12
|
+
let last;
|
|
13
|
+
effect(() => {
|
|
14
|
+
const open = !!evaluate();
|
|
15
|
+
if (open === last) return;
|
|
16
|
+
last = open;
|
|
17
|
+
anim?.cancel();
|
|
18
|
+
if (first || !el.animate) {
|
|
19
|
+
first = false;
|
|
20
|
+
style.display = open ? initial : "none";
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
if (open) style.display = initial;
|
|
24
|
+
anim = el.animate(open ? [hidden, shown] : [shown, hidden], { duration, easing: "ease-out", fill: "forwards" });
|
|
25
|
+
anim.onfinish = () => {
|
|
22
26
|
anim?.cancel();
|
|
23
|
-
if (
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
anim.onfinish = () => {
|
|
31
|
-
anim?.cancel();
|
|
32
|
-
if (!open) style.display = "none";
|
|
33
|
-
};
|
|
34
|
-
});
|
|
35
|
-
}
|
|
27
|
+
if (!open) style.display = "none";
|
|
28
|
+
};
|
|
29
|
+
});
|
|
30
|
+
cleanup(() => {
|
|
31
|
+
anim?.cancel();
|
|
32
|
+
style.display = own;
|
|
33
|
+
});
|
|
36
34
|
});
|
|
37
35
|
export {
|
|
38
36
|
transition
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/plugins/directives/transition.ts"],
|
|
4
|
-
"sourcesContent": ["import {
|
|
5
|
-
"mappings": "AAAA,SAAS,
|
|
4
|
+
"sourcesContent": ["import { toMs } from '../../kernel/index.js';\nimport { dir } from '../def.js';\n\n/**\n * Shows and hides with a fade: `transition=\"$open\"`. Modifier: `__duration.200ms`.\n */\nexport const transition = dir('transition', 6, ({ el, mods, evaluate, effect, cleanup }) => {\n const style = (el as HTMLElement).style;\n const duration = matchMedia('(prefers-reduced-motion: reduce)').matches ? 0 : toMs(mods.get('duration'), 200);\n const hidden = { opacity: 0 };\n const shown = { opacity: 1 };\n const own = style.display;\n const initial = own === 'none' ? '' : own;\n let anim: Animation | undefined;\n let first = true;\n let last: boolean | undefined;\n effect(() => {\n const open = !!evaluate();\n if (open === last) return; // a dependency changed but the outcome did not: leave the element alone\n last = open;\n anim?.cancel();\n if (first || !el.animate) {\n first = false;\n style.display = open ? initial : 'none';\n return;\n }\n if (open) style.display = initial;\n anim = el.animate(open ? [hidden, shown] : [shown, hidden], { duration, easing: 'ease-out', fill: 'forwards' });\n anim.onfinish = () => {\n anim?.cancel();\n if (!open) style.display = 'none';\n };\n });\n cleanup(() => {\n anim?.cancel();\n style.display = own; // the element's own inline display comes back when the directive goes\n });\n});\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,YAAY;AACrB,SAAS,WAAW;AAKb,MAAM,aAAa,IAAI,cAAc,GAAG,CAAC,EAAE,IAAI,MAAM,UAAU,QAAQ,QAAQ,MAAM;AAC1F,QAAM,QAAS,GAAmB;AAClC,QAAM,WAAW,WAAW,kCAAkC,EAAE,UAAU,IAAI,KAAK,KAAK,IAAI,UAAU,GAAG,GAAG;AAC5G,QAAM,SAAS,EAAE,SAAS,EAAE;AAC5B,QAAM,QAAQ,EAAE,SAAS,EAAE;AAC3B,QAAM,MAAM,MAAM;AAClB,QAAM,UAAU,QAAQ,SAAS,KAAK;AACtC,MAAI;AACJ,MAAI,QAAQ;AACZ,MAAI;AACJ,SAAO,MAAM;AACX,UAAM,OAAO,CAAC,CAAC,SAAS;AACxB,QAAI,SAAS,KAAM;AACnB,WAAO;AACP,UAAM,OAAO;AACb,QAAI,SAAS,CAAC,GAAG,SAAS;AACxB,cAAQ;AACR,YAAM,UAAU,OAAO,UAAU;AACjC;AAAA,IACF;AACA,QAAI,KAAM,OAAM,UAAU;AAC1B,WAAO,GAAG,QAAQ,OAAO,CAAC,QAAQ,KAAK,IAAI,CAAC,OAAO,MAAM,GAAG,EAAE,UAAU,QAAQ,YAAY,MAAM,WAAW,CAAC;AAC9G,SAAK,WAAW,MAAM;AACpB,YAAM,OAAO;AACb,UAAI,CAAC,KAAM,OAAM,UAAU;AAAA,IAC7B;AAAA,EACF,CAAC;AACD,UAAQ,MAAM;AACZ,UAAM,OAAO;AACb,UAAM,UAAU;AAAA,EAClB,CAAC;AACH,CAAC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* `animate:opacity="$open ? 1 : 0"` tweens a numeric CSS property
|
|
2
|
+
* `animate:opacity="$open ? 1 : 0"` tweens a numeric CSS property from its
|
|
3
3
|
* current value to the expression's value whenever the expression changes.
|
|
4
|
-
*
|
|
4
|
+
* `__duration.300ms` sets the length; the tween eases out. Non-numeric values apply immediately.
|
|
5
5
|
*/
|
|
6
6
|
export declare const animate: import("../../kernel/contracts.js").AttributePlugin;
|
|
@@ -1,56 +1,40 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
linear: (t) => t,
|
|
4
|
-
"ease-in": (t) => t * t,
|
|
5
|
-
"ease-out": (t) => 1 - (1 - t) * (1 - t),
|
|
6
|
-
"ease-in-out": (t) => t < 0.5 ? 2 * t * t : 1 - (-2 * t + 2) ** 2 / 2
|
|
7
|
-
};
|
|
1
|
+
import { toMs } from "../../kernel/index.js";
|
|
2
|
+
import { dir } from "../def.js";
|
|
8
3
|
const num = (s) => {
|
|
9
4
|
const m = /^\s*(-?\d*\.?\d+)([a-z%]*)\s*$/i.exec(s);
|
|
10
|
-
return m ?
|
|
5
|
+
return m ? [+m[1], m[2]] : void 0;
|
|
11
6
|
};
|
|
12
|
-
const animate =
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
const
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
}
|
|
38
|
-
if (
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
const b = target.n;
|
|
44
|
-
const start = performance.now();
|
|
45
|
-
const tick = (now) => {
|
|
46
|
-
const p = Math.min(1, (now - start) / duration);
|
|
47
|
-
write(`${a + (b - a) * ease(p)}${target.unit}`);
|
|
48
|
-
if (p < 1) frame = requestAnimationFrame(tick);
|
|
49
|
-
};
|
|
50
|
-
frame = requestAnimationFrame(tick);
|
|
51
|
-
});
|
|
52
|
-
cleanup(() => cancelAnimationFrame(frame));
|
|
53
|
-
}
|
|
7
|
+
const animate = dir("animate", 5, ({ el, mods, cased, evaluate, effect, cleanup }) => {
|
|
8
|
+
const prop = cased("kebab");
|
|
9
|
+
const duration = toMs(mods.get("duration"), 300);
|
|
10
|
+
const instant = matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
11
|
+
const read = () => el.style.getPropertyValue(prop) || getComputedStyle(el).getPropertyValue(prop);
|
|
12
|
+
const write = (v) => el.style.setProperty(prop, v);
|
|
13
|
+
let frame = 0;
|
|
14
|
+
let first = true;
|
|
15
|
+
let last;
|
|
16
|
+
effect(() => {
|
|
17
|
+
const to = String(evaluate());
|
|
18
|
+
if (to === last) return;
|
|
19
|
+
last = to;
|
|
20
|
+
cancelAnimationFrame(frame);
|
|
21
|
+
const from = num(read());
|
|
22
|
+
const target = num(to);
|
|
23
|
+
if (first || instant || duration <= 0 || !from || !target || from[1] !== target[1]) {
|
|
24
|
+
first = false;
|
|
25
|
+
return write(to);
|
|
26
|
+
}
|
|
27
|
+
const [a, unit] = from;
|
|
28
|
+
const b = target[0];
|
|
29
|
+
const start = performance.now();
|
|
30
|
+
const tick = (now) => {
|
|
31
|
+
const p = Math.min(1, (now - start) / duration);
|
|
32
|
+
write(`${a + (b - a) * (1 - (1 - p) ** 2)}${unit}`);
|
|
33
|
+
if (p < 1) frame = requestAnimationFrame(tick);
|
|
34
|
+
};
|
|
35
|
+
frame = requestAnimationFrame(tick);
|
|
36
|
+
});
|
|
37
|
+
cleanup(() => cancelAnimationFrame(frame));
|
|
54
38
|
});
|
|
55
39
|
export {
|
|
56
40
|
animate
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/plugins/directives/tween.ts"],
|
|
4
|
-
"sourcesContent": ["import {
|
|
5
|
-
"mappings": "AAAA,SAAS,
|
|
4
|
+
"sourcesContent": ["import { toMs } from '../../kernel/index.js';\nimport { dir } from '../def.js';\n\n/** '12.5px' \u2192 [12.5, 'px']; undefined when not numeric. */\nconst num = (s: string): [number, string] | undefined => {\n const m = /^\\s*(-?\\d*\\.?\\d+)([a-z%]*)\\s*$/i.exec(s);\n return m ? [+m[1], m[2]] : undefined;\n};\n\n/**\n * `animate:opacity=\"$open ? 1 : 0\"` tweens a numeric CSS property from its\n * current value to the expression's value whenever the expression changes.\n * `__duration.300ms` sets the length; the tween eases out. Non-numeric values apply immediately.\n */\nexport const animate = dir('animate', 5, ({ el, mods, cased, evaluate, effect, cleanup }) => {\n const prop = cased('kebab');\n const duration = toMs(mods.get('duration'), 300);\n const instant = matchMedia('(prefers-reduced-motion: reduce)').matches;\n // Prefer the inline value (which this directive wrote last time); computed styles report px only.\n const read = () => el.style.getPropertyValue(prop) || getComputedStyle(el).getPropertyValue(prop);\n const write = (v: string) => el.style.setProperty(prop, v);\n let frame = 0;\n let first = true;\n let last: string | undefined;\n effect(() => {\n const to = String(evaluate());\n if (to === last) return;\n last = to;\n cancelAnimationFrame(frame);\n const from = num(read());\n const target = num(to);\n if (first || instant || duration <= 0 || !from || !target || from[1] !== target[1]) {\n first = false;\n return write(to);\n }\n const [a, unit] = from;\n const b = target[0];\n const start = performance.now();\n const tick = (now: number) => {\n const p = Math.min(1, (now - start) / duration);\n write(`${a + (b - a) * (1 - (1 - p) ** 2)}${unit}`);\n if (p < 1) frame = requestAnimationFrame(tick);\n };\n frame = requestAnimationFrame(tick);\n });\n cleanup(() => cancelAnimationFrame(frame));\n});\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,YAAY;AACrB,SAAS,WAAW;AAGpB,MAAM,MAAM,CAAC,MAA4C;AACvD,QAAM,IAAI,kCAAkC,KAAK,CAAC;AAClD,SAAO,IAAI,CAAC,CAAC,EAAE,CAAC,GAAG,EAAE,CAAC,CAAC,IAAI;AAC7B;AAOO,MAAM,UAAU,IAAI,WAAW,GAAG,CAAC,EAAE,IAAI,MAAM,OAAO,UAAU,QAAQ,QAAQ,MAAM;AAC3F,QAAM,OAAO,MAAM,OAAO;AAC1B,QAAM,WAAW,KAAK,KAAK,IAAI,UAAU,GAAG,GAAG;AAC/C,QAAM,UAAU,WAAW,kCAAkC,EAAE;AAE/D,QAAM,OAAO,MAAM,GAAG,MAAM,iBAAiB,IAAI,KAAK,iBAAiB,EAAE,EAAE,iBAAiB,IAAI;AAChG,QAAM,QAAQ,CAAC,MAAc,GAAG,MAAM,YAAY,MAAM,CAAC;AACzD,MAAI,QAAQ;AACZ,MAAI,QAAQ;AACZ,MAAI;AACJ,SAAO,MAAM;AACX,UAAM,KAAK,OAAO,SAAS,CAAC;AAC5B,QAAI,OAAO,KAAM;AACjB,WAAO;AACP,yBAAqB,KAAK;AAC1B,UAAM,OAAO,IAAI,KAAK,CAAC;AACvB,UAAM,SAAS,IAAI,EAAE;AACrB,QAAI,SAAS,WAAW,YAAY,KAAK,CAAC,QAAQ,CAAC,UAAU,KAAK,CAAC,MAAM,OAAO,CAAC,GAAG;AAClF,cAAQ;AACR,aAAO,MAAM,EAAE;AAAA,IACjB;AACA,UAAM,CAAC,GAAG,IAAI,IAAI;AAClB,UAAM,IAAI,OAAO,CAAC;AAClB,UAAM,QAAQ,YAAY,IAAI;AAC9B,UAAM,OAAO,CAAC,QAAgB;AAC5B,YAAM,IAAI,KAAK,IAAI,IAAI,MAAM,SAAS,QAAQ;AAC9C,YAAM,GAAG,KAAK,IAAI,MAAM,KAAK,IAAI,MAAM,EAAE,GAAG,IAAI,EAAE;AAClD,UAAI,IAAI,EAAG,SAAQ,sBAAsB,IAAI;AAAA,IAC/C;AACA,YAAQ,sBAAsB,IAAI;AAAA,EACpC,CAAC;AACD,UAAQ,MAAM,qBAAqB,KAAK,CAAC;AAC3C,CAAC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Two-way binding: `bind:name` or `bind="name"`. Creates the signal from the element when missing.
|
|
3
3
|
* Checkbox groups bind to arrays, radios to the checked value, `select multiple` to arrays.
|
|
4
|
-
* `
|
|
4
|
+
* `__event.change` picks the events to listen for.
|
|
5
5
|
*/
|
|
6
6
|
export declare const bind: import("../../kernel/contracts.js").AttributePlugin;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
const
|
|
1
|
+
import { dir } from "../def.js";
|
|
2
|
+
const str = (v) => String(v ?? "");
|
|
3
3
|
const readFiles = (input) => Promise.all(
|
|
4
4
|
[...input.files ?? []].map(
|
|
5
5
|
(f) => new Promise((resolve) => {
|
|
@@ -9,72 +9,75 @@ const readFiles = (input) => Promise.all(
|
|
|
9
9
|
})
|
|
10
10
|
)
|
|
11
11
|
);
|
|
12
|
-
const bind =
|
|
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
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
effect(() => {
|
|
74
|
-
const v = current();
|
|
75
|
-
if (v !== void 0) a.b(v);
|
|
76
|
-
});
|
|
12
|
+
const bind = dir("bind", 0, ({ el, key, value, cased, mods, store, listen, effect }) => {
|
|
13
|
+
const path = key ? cased() : value.trim();
|
|
14
|
+
const current = () => store.get(path);
|
|
15
|
+
const asNumber = (s) => typeof current() === "number" ? +s : s;
|
|
16
|
+
const input = el;
|
|
17
|
+
const type = el instanceof HTMLInputElement ? input.type : "";
|
|
18
|
+
const valued = (_read, ..._events) => ({
|
|
19
|
+
a: _read,
|
|
20
|
+
b: (v) => {
|
|
21
|
+
if (str(v) !== input.value && !input.validity?.badInput) input.value = str(v);
|
|
22
|
+
},
|
|
23
|
+
c: _events
|
|
24
|
+
});
|
|
25
|
+
let a;
|
|
26
|
+
if (type === "checkbox") {
|
|
27
|
+
const own = el.hasAttribute("value") && input.value !== "on";
|
|
28
|
+
a = {
|
|
29
|
+
a: () => {
|
|
30
|
+
const cur = current();
|
|
31
|
+
if (Array.isArray(cur)) {
|
|
32
|
+
const set = new Set(cur);
|
|
33
|
+
input.checked ? set.add(input.value) : set.delete(input.value);
|
|
34
|
+
return [...set];
|
|
35
|
+
}
|
|
36
|
+
return own ? input.checked ? input.value : "" : input.checked;
|
|
37
|
+
},
|
|
38
|
+
b: (v) => {
|
|
39
|
+
input.checked = Array.isArray(v) ? v.includes(input.value) : own ? v === input.value : !!v;
|
|
40
|
+
},
|
|
41
|
+
c: ["input"]
|
|
42
|
+
};
|
|
43
|
+
} else if (type === "radio") {
|
|
44
|
+
input.name ||= path;
|
|
45
|
+
a = {
|
|
46
|
+
a: () => input.checked ? asNumber(input.value) : current(),
|
|
47
|
+
b: (v) => input.checked = String(v) === input.value,
|
|
48
|
+
c: ["input"]
|
|
49
|
+
};
|
|
50
|
+
} else if (type === "file") {
|
|
51
|
+
listen(el, "change", () => readFiles(input).then((files) => store.set(path, files)));
|
|
52
|
+
return;
|
|
53
|
+
} else if (type) {
|
|
54
|
+
const numeric = type === "number" || type === "range";
|
|
55
|
+
a = valued(() => numeric && input.value !== "" ? +input.value : input.value, "input");
|
|
56
|
+
} else if (el instanceof HTMLSelectElement) {
|
|
57
|
+
a = {
|
|
58
|
+
a: () => el.multiple ? [...el.selectedOptions].map((o) => asNumber(o.value)) : asNumber(el.value),
|
|
59
|
+
b: (v) => {
|
|
60
|
+
if (el.multiple) for (const o of el.options) o.selected = Array.isArray(v) && v.map(String).includes(o.value);
|
|
61
|
+
else el.value = str(v);
|
|
62
|
+
},
|
|
63
|
+
c: ["change"]
|
|
64
|
+
};
|
|
65
|
+
} else if ("value" in el) {
|
|
66
|
+
a = valued(() => input.value, "input", "change");
|
|
67
|
+
} else {
|
|
68
|
+
a = {
|
|
69
|
+
a: () => el.getAttribute("value"),
|
|
70
|
+
b: (v) => el.setAttribute("value", str(v)),
|
|
71
|
+
c: ["change"]
|
|
72
|
+
};
|
|
77
73
|
}
|
|
74
|
+
if (!store.has(path)) {
|
|
75
|
+
const initial = a.a();
|
|
76
|
+
if (initial !== void 0 && initial !== "") store.set(path, initial);
|
|
77
|
+
}
|
|
78
|
+
const sync = () => store.set(path, a.a());
|
|
79
|
+
for (const t of [...mods.get("event") ?? a.c, "sigmx-prop-change"]) listen(el, t, sync);
|
|
80
|
+
effect(() => a.b(current()));
|
|
78
81
|
});
|
|
79
82
|
export {
|
|
80
83
|
bind
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/plugins/directives/two-way-bind.ts"],
|
|
4
|
-
"sourcesContent": ["import {
|
|
5
|
-
"mappings": "AAAA,SAAS,
|
|
4
|
+
"sourcesContent": ["import { dir } from '../def.js';\n\ntype Adapter = { _read(): unknown; _write(v: unknown): void; _events: string[] };\n\nconst str = (v: unknown) => String(v ?? '');\n\nconst readFiles = (input: HTMLInputElement) =>\n Promise.all(\n [...(input.files ?? [])].map(\n (f) =>\n new Promise<{ name: string; type: string; size: number; contents: string }>((resolve) => {\n const r = new FileReader();\n r.onloadend = () =>\n resolve({ name: f.name, type: f.type, size: f.size, contents: String(r.result).split(',')[1] ?? '' });\n r.readAsDataURL(f);\n }),\n ),\n );\n\n/**\n * Two-way binding: `bind:name` or `bind=\"name\"`. Creates the signal from the element when missing.\n * Checkbox groups bind to arrays, radios to the checked value, `select multiple` to arrays.\n * `__event.change` picks the events to listen for.\n */\nexport const bind = dir('bind', 0, ({ el, key, value, cased, mods, store, listen, effect }) => {\n const path = key ? cased() : value.trim();\n const current = () => store.get(path);\n const asNumber = (s: string) => (typeof current() === 'number' ? +s : s);\n const input = el as HTMLInputElement;\n const type = el instanceof HTMLInputElement ? input.type : '';\n /** Adapter writing `el.value`. */\n const valued = (_read: () => unknown, ..._events: string[]): Adapter => ({\n _read,\n _write: (v) => {\n // A number field mid-entry ('-', '1e') reads as '' with badInput; do not wipe what the user is typing.\n if (str(v) !== input.value && !input.validity?.badInput) input.value = str(v);\n },\n _events,\n });\n let a: Adapter;\n\n if (type === 'checkbox') {\n const own = el.hasAttribute('value') && input.value !== 'on';\n a = {\n _read: () => {\n const cur = current();\n if (Array.isArray(cur)) {\n const set = new Set(cur);\n input.checked ? set.add(input.value) : set.delete(input.value);\n return [...set];\n }\n return own ? (input.checked ? input.value : '') : input.checked;\n },\n _write: (v) => {\n input.checked = Array.isArray(v) ? v.includes(input.value) : own ? v === input.value : !!v;\n },\n _events: ['input'],\n };\n } else if (type === 'radio') {\n input.name ||= path;\n a = {\n _read: () => (input.checked ? asNumber(input.value) : current()),\n _write: (v) => (input.checked = String(v) === input.value),\n _events: ['input'],\n };\n } else if (type === 'file') {\n listen(el, 'change', () => readFiles(input).then((files) => store.set(path, files)));\n return;\n } else if (type) {\n const numeric = type === 'number' || type === 'range';\n a = valued(() => (numeric && input.value !== '' ? +input.value : input.value), 'input');\n } else if (el instanceof HTMLSelectElement) {\n a = {\n _read: () => (el.multiple ? [...el.selectedOptions].map((o) => asNumber(o.value)) : asNumber(el.value)),\n _write: (v) => {\n if (el.multiple) for (const o of el.options) o.selected = Array.isArray(v) && v.map(String).includes(o.value);\n else el.value = str(v);\n },\n _events: ['change'],\n };\n } else if ('value' in el) {\n a = valued(() => input.value, 'input', 'change');\n } else {\n a = {\n _read: () => el.getAttribute('value'),\n _write: (v) => el.setAttribute('value', str(v)),\n _events: ['change'],\n };\n }\n\n if (!store.has(path)) {\n const initial = a._read();\n if (initial !== undefined && initial !== '') store.set(path, initial);\n }\n const sync = () => store.set(path, a._read());\n for (const t of [...(mods.get('event') ?? a._events), 'sigmx-prop-change']) listen(el, t, sync);\n effect(() => a._write(current())); // undefined (removed signal) clears the field\n});\n"],
|
|
5
|
+
"mappings": "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",
|
|
6
6
|
"names": ["_read", "_write", "_events"]
|
|
7
7
|
}
|