sigmx 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +173 -0
- package/dist/auto.d.ts +1 -0
- package/dist/auto.js +7 -0
- package/dist/auto.js.map +7 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +26 -0
- package/dist/cli.js.map +7 -0
- package/dist/core/csp.d.ts +7 -0
- package/dist/core/csp.js +20 -0
- package/dist/core/csp.js.map +7 -0
- package/dist/core/engine.d.ts +10 -0
- package/dist/core/engine.js +200 -0
- package/dist/core/engine.js.map +7 -0
- package/dist/core/expr.d.ts +12 -0
- package/dist/core/expr.js +94 -0
- package/dist/core/expr.js.map +7 -0
- package/dist/core/index.d.ts +16 -0
- package/dist/core/index.js +46 -0
- package/dist/core/index.js.map +7 -0
- package/dist/core/signals.d.ts +42 -0
- package/dist/core/signals.js +195 -0
- package/dist/core/signals.js.map +7 -0
- package/dist/core/store.d.ts +32 -0
- package/dist/core/store.js +185 -0
- package/dist/core/store.js.map +7 -0
- package/dist/core/types.d.ts +101 -0
- package/dist/core/types.js +1 -0
- package/dist/core/types.js.map +7 -0
- package/dist/kernel/compile.d.ts +16 -0
- package/dist/kernel/compile.js +96 -0
- package/dist/kernel/compile.js.map +7 -0
- package/dist/kernel/contracts.d.ts +121 -0
- package/dist/kernel/contracts.js +1 -0
- package/dist/kernel/contracts.js.map +7 -0
- package/dist/kernel/index.d.ts +20 -0
- package/dist/kernel/index.js +54 -0
- package/dist/kernel/index.js.map +7 -0
- package/dist/kernel/precompile.d.ts +25 -0
- package/dist/kernel/precompile.js +111 -0
- package/dist/kernel/precompile.js.map +7 -0
- package/dist/kernel/precompiled.d.ts +11 -0
- package/dist/kernel/precompiled.js +13 -0
- package/dist/kernel/precompiled.js.map +7 -0
- package/dist/kernel/reactive.d.ts +42 -0
- package/dist/kernel/reactive.js +201 -0
- package/dist/kernel/reactive.js.map +7 -0
- package/dist/kernel/runtime.d.ts +11 -0
- package/dist/kernel/runtime.js +210 -0
- package/dist/kernel/runtime.js.map +7 -0
- package/dist/kernel/scan.d.ts +42 -0
- package/dist/kernel/scan.js +68 -0
- package/dist/kernel/scan.js.map +7 -0
- package/dist/kernel/state.d.ts +32 -0
- package/dist/kernel/state.js +186 -0
- package/dist/kernel/state.js.map +7 -0
- package/dist/kernel/strict-csp.d.ts +7 -0
- package/dist/kernel/strict-csp.js +20 -0
- package/dist/kernel/strict-csp.js.map +7 -0
- package/dist/lib/casing.d.ts +7 -0
- package/dist/lib/casing.js +16 -0
- package/dist/lib/casing.js.map +7 -0
- package/dist/lib/objects.d.ts +9 -0
- package/dist/lib/objects.js +26 -0
- package/dist/lib/objects.js.map +7 -0
- package/dist/lib/schedule.d.ts +14 -0
- package/dist/lib/schedule.js +51 -0
- package/dist/lib/schedule.js.map +7 -0
- package/dist/lib/sse.d.ts +10 -0
- package/dist/lib/sse.js +55 -0
- package/dist/lib/sse.js.map +7 -0
- package/dist/plugins/actions/clipboard.d.ts +2 -0
- package/dist/plugins/actions/clipboard.js +11 -0
- package/dist/plugins/actions/clipboard.js.map +7 -0
- package/dist/plugins/actions/fit.d.ts +2 -0
- package/dist/plugins/actions/fit.js +14 -0
- package/dist/plugins/actions/fit.js.map +7 -0
- package/dist/plugins/actions/intl.d.ts +2 -0
- package/dist/plugins/actions/intl.js +21 -0
- package/dist/plugins/actions/intl.js.map +7 -0
- package/dist/plugins/actions/peek.d.ts +2 -0
- package/dist/plugins/actions/peek.js +6 -0
- package/dist/plugins/actions/peek.js.map +7 -0
- package/dist/plugins/actions/setAll.d.ts +2 -0
- package/dist/plugins/actions/setAll.js +11 -0
- package/dist/plugins/actions/setAll.js.map +7 -0
- package/dist/plugins/actions/toggleAll.d.ts +2 -0
- package/dist/plugins/actions/toggleAll.js +11 -0
- package/dist/plugins/actions/toggleAll.js.map +7 -0
- package/dist/plugins/attributes/attr.d.ts +2 -0
- package/dist/plugins/attributes/attr.js +20 -0
- package/dist/plugins/attributes/attr.js.map +7 -0
- package/dist/plugins/attributes/bind.d.ts +6 -0
- package/dist/plugins/attributes/bind.js +81 -0
- package/dist/plugins/attributes/bind.js.map +7 -0
- package/dist/plugins/attributes/class.d.ts +2 -0
- package/dist/plugins/attributes/class.js +22 -0
- package/dist/plugins/attributes/class.js.map +7 -0
- package/dist/plugins/attributes/computed.d.ts +2 -0
- package/dist/plugins/attributes/computed.js +20 -0
- package/dist/plugins/attributes/computed.js.map +7 -0
- package/dist/plugins/attributes/customValidity.d.ts +2 -0
- package/dist/plugins/attributes/customValidity.js +14 -0
- package/dist/plugins/attributes/customValidity.js.map +7 -0
- package/dist/plugins/attributes/effect.d.ts +2 -0
- package/dist/plugins/attributes/effect.js +12 -0
- package/dist/plugins/attributes/effect.js.map +7 -0
- package/dist/plugins/attributes/indicator.d.ts +2 -0
- package/dist/plugins/attributes/indicator.js +20 -0
- package/dist/plugins/attributes/indicator.js.map +7 -0
- package/dist/plugins/attributes/init.d.ts +2 -0
- package/dist/plugins/attributes/init.js +14 -0
- package/dist/plugins/attributes/init.js.map +7 -0
- package/dist/plugins/attributes/jsonSignals.d.ts +2 -0
- package/dist/plugins/attributes/jsonSignals.js +15 -0
- package/dist/plugins/attributes/jsonSignals.js.map +7 -0
- package/dist/plugins/attributes/matchMedia.d.ts +2 -0
- package/dist/plugins/attributes/matchMedia.js +19 -0
- package/dist/plugins/attributes/matchMedia.js.map +7 -0
- package/dist/plugins/attributes/on.d.ts +5 -0
- package/dist/plugins/attributes/on.js +28 -0
- package/dist/plugins/attributes/on.js.map +7 -0
- package/dist/plugins/attributes/onIntersect.d.ts +2 -0
- package/dist/plugins/attributes/onIntersect.js +28 -0
- package/dist/plugins/attributes/onIntersect.js.map +7 -0
- package/dist/plugins/attributes/onInterval.d.ts +2 -0
- package/dist/plugins/attributes/onInterval.js +18 -0
- package/dist/plugins/attributes/onInterval.js.map +7 -0
- package/dist/plugins/attributes/onRaf.d.ts +1 -0
- package/dist/plugins/attributes/onRaf.js +19 -0
- package/dist/plugins/attributes/onRaf.js.map +7 -0
- package/dist/plugins/attributes/onResize.d.ts +1 -0
- package/dist/plugins/attributes/onResize.js +17 -0
- package/dist/plugins/attributes/onResize.js.map +7 -0
- package/dist/plugins/attributes/onSignalPatch.d.ts +5 -0
- package/dist/plugins/attributes/onSignalPatch.js +35 -0
- package/dist/plugins/attributes/onSignalPatch.js.map +7 -0
- package/dist/plugins/attributes/persist.d.ts +6 -0
- package/dist/plugins/attributes/persist.js +16 -0
- package/dist/plugins/attributes/persist.js.map +7 -0
- package/dist/plugins/attributes/queryString.d.ts +5 -0
- package/dist/plugins/attributes/queryString.js +54 -0
- package/dist/plugins/attributes/queryString.js.map +7 -0
- package/dist/plugins/attributes/ref.d.ts +2 -0
- package/dist/plugins/attributes/ref.js +13 -0
- package/dist/plugins/attributes/ref.js.map +7 -0
- package/dist/plugins/attributes/replaceUrl.d.ts +1 -0
- package/dist/plugins/attributes/replaceUrl.js +11 -0
- package/dist/plugins/attributes/replaceUrl.js.map +7 -0
- package/dist/plugins/attributes/scrollIntoView.d.ts +2 -0
- package/dist/plugins/attributes/scrollIntoView.js +19 -0
- package/dist/plugins/attributes/scrollIntoView.js.map +7 -0
- package/dist/plugins/attributes/show.d.ts +2 -0
- package/dist/plugins/attributes/show.js +19 -0
- package/dist/plugins/attributes/show.js.map +7 -0
- package/dist/plugins/attributes/signals.d.ts +2 -0
- package/dist/plugins/attributes/signals.js +13 -0
- package/dist/plugins/attributes/signals.js.map +7 -0
- package/dist/plugins/attributes/style.d.ts +2 -0
- package/dist/plugins/attributes/style.js +25 -0
- package/dist/plugins/attributes/style.js.map +7 -0
- package/dist/plugins/attributes/text.d.ts +1 -0
- package/dist/plugins/attributes/text.js +13 -0
- package/dist/plugins/attributes/text.js.map +7 -0
- package/dist/plugins/attributes/viewTransition.d.ts +1 -0
- package/dist/plugins/attributes/viewTransition.js +11 -0
- package/dist/plugins/attributes/viewTransition.js.map +7 -0
- package/dist/plugins/directives/attribute-sync.d.ts +2 -0
- package/dist/plugins/directives/attribute-sync.js +20 -0
- package/dist/plugins/directives/attribute-sync.js.map +7 -0
- package/dist/plugins/directives/boost.d.ts +6 -0
- package/dist/plugins/directives/boost.js +35 -0
- package/dist/plugins/directives/boost.js.map +7 -0
- package/dist/plugins/directives/busy-flag.d.ts +2 -0
- package/dist/plugins/directives/busy-flag.js +21 -0
- package/dist/plugins/directives/busy-flag.js.map +7 -0
- package/dist/plugins/directives/class-toggle.d.ts +2 -0
- package/dist/plugins/directives/class-toggle.js +22 -0
- package/dist/plugins/directives/class-toggle.js.map +7 -0
- package/dist/plugins/directives/cloak.d.ts +5 -0
- package/dist/plugins/directives/cloak.js +11 -0
- package/dist/plugins/directives/cloak.js.map +7 -0
- package/dist/plugins/directives/collapse.d.ts +5 -0
- package/dist/plugins/directives/collapse.js +42 -0
- package/dist/plugins/directives/collapse.js.map +7 -0
- package/dist/plugins/directives/declare.d.ts +2 -0
- package/dist/plugins/directives/declare.js +13 -0
- package/dist/plugins/directives/declare.js.map +7 -0
- package/dist/plugins/directives/derive.d.ts +2 -0
- package/dist/plugins/directives/derive.js +20 -0
- package/dist/plugins/directives/derive.js.map +7 -0
- package/dist/plugins/directives/element-ref.d.ts +2 -0
- package/dist/plugins/directives/element-ref.js +13 -0
- package/dist/plugins/directives/element-ref.js.map +7 -0
- package/dist/plugins/directives/event-listener.d.ts +5 -0
- package/dist/plugins/directives/event-listener.js +28 -0
- package/dist/plugins/directives/event-listener.js.map +7 -0
- package/dist/plugins/directives/frame-loop.d.ts +1 -0
- package/dist/plugins/directives/frame-loop.js +19 -0
- package/dist/plugins/directives/frame-loop.js.map +7 -0
- package/dist/plugins/directives/html.d.ts +2 -0
- package/dist/plugins/directives/html.js +13 -0
- package/dist/plugins/directives/html.js.map +7 -0
- package/dist/plugins/directives/inline-style.d.ts +2 -0
- package/dist/plugins/directives/inline-style.js +25 -0
- package/dist/plugins/directives/inline-style.js.map +7 -0
- package/dist/plugins/directives/mask.d.ts +7 -0
- package/dist/plugins/directives/mask.js +47 -0
- package/dist/plugins/directives/mask.js.map +7 -0
- package/dist/plugins/directives/media-query.d.ts +2 -0
- package/dist/plugins/directives/media-query.js +19 -0
- package/dist/plugins/directives/media-query.js.map +7 -0
- package/dist/plugins/directives/on-mount.d.ts +2 -0
- package/dist/plugins/directives/on-mount.js +14 -0
- package/dist/plugins/directives/on-mount.js.map +7 -0
- package/dist/plugins/directives/patch-listener.d.ts +5 -0
- package/dist/plugins/directives/patch-listener.js +35 -0
- package/dist/plugins/directives/patch-listener.js.map +7 -0
- package/dist/plugins/directives/remove-me.d.ts +2 -0
- package/dist/plugins/directives/remove-me.js +13 -0
- package/dist/plugins/directives/remove-me.js.map +7 -0
- package/dist/plugins/directives/scroll-to.d.ts +2 -0
- package/dist/plugins/directives/scroll-to.js +19 -0
- package/dist/plugins/directives/scroll-to.js.map +7 -0
- package/dist/plugins/directives/size-watch.d.ts +1 -0
- package/dist/plugins/directives/size-watch.js +17 -0
- package/dist/plugins/directives/size-watch.js.map +7 -0
- package/dist/plugins/directives/state-dump.d.ts +2 -0
- package/dist/plugins/directives/state-dump.js +15 -0
- package/dist/plugins/directives/state-dump.js.map +7 -0
- package/dist/plugins/directives/storage-sync.d.ts +6 -0
- package/dist/plugins/directives/storage-sync.js +16 -0
- package/dist/plugins/directives/storage-sync.js.map +7 -0
- package/dist/plugins/directives/teleport.d.ts +5 -0
- package/dist/plugins/directives/teleport.js +19 -0
- package/dist/plugins/directives/teleport.js.map +7 -0
- package/dist/plugins/directives/text-content.d.ts +1 -0
- package/dist/plugins/directives/text-content.js +13 -0
- package/dist/plugins/directives/text-content.js.map +7 -0
- package/dist/plugins/directives/timer.d.ts +2 -0
- package/dist/plugins/directives/timer.js +18 -0
- package/dist/plugins/directives/timer.js.map +7 -0
- package/dist/plugins/directives/transition-name.d.ts +1 -0
- package/dist/plugins/directives/transition-name.js +11 -0
- package/dist/plugins/directives/transition-name.js.map +7 -0
- package/dist/plugins/directives/transition.d.ts +5 -0
- package/dist/plugins/directives/transition.js +40 -0
- package/dist/plugins/directives/transition.js.map +7 -0
- package/dist/plugins/directives/trap.d.ts +5 -0
- package/dist/plugins/directives/trap.js +48 -0
- package/dist/plugins/directives/trap.js.map +7 -0
- package/dist/plugins/directives/tween.d.ts +6 -0
- package/dist/plugins/directives/tween.js +58 -0
- package/dist/plugins/directives/tween.js.map +7 -0
- package/dist/plugins/directives/two-way-bind.d.ts +6 -0
- package/dist/plugins/directives/two-way-bind.js +82 -0
- package/dist/plugins/directives/two-way-bind.js.map +7 -0
- package/dist/plugins/directives/url-params.d.ts +13 -0
- package/dist/plugins/directives/url-params.js +76 -0
- package/dist/plugins/directives/url-params.js.map +7 -0
- package/dist/plugins/directives/url-replace.d.ts +1 -0
- package/dist/plugins/directives/url-replace.js +11 -0
- package/dist/plugins/directives/url-replace.js.map +7 -0
- package/dist/plugins/directives/validity.d.ts +2 -0
- package/dist/plugins/directives/validity.js +14 -0
- package/dist/plugins/directives/validity.js.map +7 -0
- package/dist/plugins/directives/viewport.d.ts +2 -0
- package/dist/plugins/directives/viewport.js +28 -0
- package/dist/plugins/directives/viewport.js.map +7 -0
- package/dist/plugins/directives/visibility.d.ts +2 -0
- package/dist/plugins/directives/visibility.js +19 -0
- package/dist/plugins/directives/visibility.js.map +7 -0
- package/dist/plugins/directives/watch.d.ts +2 -0
- package/dist/plugins/directives/watch.js +12 -0
- package/dist/plugins/directives/watch.js.map +7 -0
- package/dist/plugins/functions/bulk-set.d.ts +2 -0
- package/dist/plugins/functions/bulk-set.js +11 -0
- package/dist/plugins/functions/bulk-set.js.map +7 -0
- package/dist/plugins/functions/bulk-toggle.d.ts +2 -0
- package/dist/plugins/functions/bulk-toggle.js +11 -0
- package/dist/plugins/functions/bulk-toggle.js.map +7 -0
- package/dist/plugins/functions/confirm.d.ts +2 -0
- package/dist/plugins/functions/confirm.js +6 -0
- package/dist/plugins/functions/confirm.js.map +7 -0
- package/dist/plugins/functions/copy-text.d.ts +2 -0
- package/dist/plugins/functions/copy-text.js +11 -0
- package/dist/plugins/functions/copy-text.js.map +7 -0
- package/dist/plugins/functions/dispatch.d.ts +2 -0
- package/dist/plugins/functions/dispatch.js +9 -0
- package/dist/plugins/functions/dispatch.js.map +7 -0
- package/dist/plugins/functions/locale-format.d.ts +2 -0
- package/dist/plugins/functions/locale-format.js +21 -0
- package/dist/plugins/functions/locale-format.js.map +7 -0
- package/dist/plugins/functions/range-map.d.ts +2 -0
- package/dist/plugins/functions/range-map.js +14 -0
- package/dist/plugins/functions/range-map.js.map +7 -0
- package/dist/plugins/functions/request.d.ts +30 -0
- package/dist/plugins/functions/request.js +152 -0
- package/dist/plugins/functions/request.js.map +7 -0
- package/dist/plugins/functions/untracked-read.d.ts +2 -0
- package/dist/plugins/functions/untracked-read.js +6 -0
- package/dist/plugins/functions/untracked-read.js.map +7 -0
- package/dist/plugins/functions/websocket.d.ts +11 -0
- package/dist/plugins/functions/websocket.js +35 -0
- package/dist/plugins/functions/websocket.js.map +7 -0
- package/dist/plugins/index.d.ts +52 -0
- package/dist/plugins/index.js +108 -0
- package/dist/plugins/index.js.map +7 -0
- package/dist/plugins/server-events/apply-elements.d.ts +2 -0
- package/dist/plugins/server-events/apply-elements.js +62 -0
- package/dist/plugins/server-events/apply-elements.js.map +7 -0
- package/dist/plugins/server-events/apply-state.d.ts +2 -0
- package/dist/plugins/server-events/apply-state.js +18 -0
- package/dist/plugins/server-events/apply-state.js.map +7 -0
- package/dist/plugins/server-events/morph.d.ts +12 -0
- package/dist/plugins/server-events/morph.js +124 -0
- package/dist/plugins/server-events/morph.js.map +7 -0
- package/dist/presets/all.d.ts +3 -0
- package/dist/presets/all.js +112 -0
- package/dist/presets/all.js.map +7 -0
- package/dist/presets/essentials.d.ts +3 -0
- package/dist/presets/essentials.js +18 -0
- package/dist/presets/essentials.js.map +7 -0
- package/dist/presets/minimal.d.ts +3 -0
- package/dist/presets/minimal.js +9 -0
- package/dist/presets/minimal.js.map +7 -0
- package/dist/sigmx.auto.js +5 -0
- package/dist/sigmx.standalone.js +1 -0
- package/dist/standalone.d.ts +1 -0
- package/dist/standalone.js +8 -0
- package/dist/standalone.js.map +7 -0
- package/dist/utils/object.d.ts +9 -0
- package/dist/utils/object.js +26 -0
- package/dist/utils/object.js.map +7 -0
- package/dist/utils/text.d.ts +7 -0
- package/dist/utils/text.js +15 -0
- package/dist/utils/text.js.map +7 -0
- package/dist/utils/timing.d.ts +14 -0
- package/dist/utils/timing.js +58 -0
- package/dist/utils/timing.js.map +7 -0
- package/dist/vite.d.ts +42 -0
- package/dist/vite.js +79 -0
- package/dist/vite.js.map +7 -0
- package/package.json +111 -0
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import {
|
|
2
|
+
attr,
|
|
3
|
+
bind,
|
|
4
|
+
className,
|
|
5
|
+
computed,
|
|
6
|
+
customValidity,
|
|
7
|
+
effect,
|
|
8
|
+
indicator,
|
|
9
|
+
init,
|
|
10
|
+
jsonSignals,
|
|
11
|
+
matchMedia,
|
|
12
|
+
on,
|
|
13
|
+
onIntersect,
|
|
14
|
+
onInterval,
|
|
15
|
+
onRaf,
|
|
16
|
+
onResize,
|
|
17
|
+
onSignalPatch,
|
|
18
|
+
persist,
|
|
19
|
+
queryString,
|
|
20
|
+
ref,
|
|
21
|
+
replaceUrl,
|
|
22
|
+
scrollIntoView,
|
|
23
|
+
show,
|
|
24
|
+
signals,
|
|
25
|
+
style,
|
|
26
|
+
text,
|
|
27
|
+
viewTransition,
|
|
28
|
+
clipboard,
|
|
29
|
+
fit,
|
|
30
|
+
intl,
|
|
31
|
+
peek,
|
|
32
|
+
setAll,
|
|
33
|
+
toggleAll,
|
|
34
|
+
animate,
|
|
35
|
+
httpDelete,
|
|
36
|
+
httpGet,
|
|
37
|
+
httpPatch,
|
|
38
|
+
httpPost,
|
|
39
|
+
httpPut,
|
|
40
|
+
applyElements,
|
|
41
|
+
applyState,
|
|
42
|
+
boost,
|
|
43
|
+
cloak,
|
|
44
|
+
collapse,
|
|
45
|
+
html,
|
|
46
|
+
mask,
|
|
47
|
+
removeMe,
|
|
48
|
+
teleport,
|
|
49
|
+
transition,
|
|
50
|
+
trap,
|
|
51
|
+
confirm,
|
|
52
|
+
dispatch,
|
|
53
|
+
websocket
|
|
54
|
+
} from "../plugins/index.js";
|
|
55
|
+
const all = [
|
|
56
|
+
attr,
|
|
57
|
+
bind,
|
|
58
|
+
className,
|
|
59
|
+
computed,
|
|
60
|
+
customValidity,
|
|
61
|
+
effect,
|
|
62
|
+
indicator,
|
|
63
|
+
init,
|
|
64
|
+
jsonSignals,
|
|
65
|
+
matchMedia,
|
|
66
|
+
on,
|
|
67
|
+
onIntersect,
|
|
68
|
+
onInterval,
|
|
69
|
+
onRaf,
|
|
70
|
+
onResize,
|
|
71
|
+
onSignalPatch,
|
|
72
|
+
persist,
|
|
73
|
+
queryString,
|
|
74
|
+
ref,
|
|
75
|
+
replaceUrl,
|
|
76
|
+
scrollIntoView,
|
|
77
|
+
show,
|
|
78
|
+
signals,
|
|
79
|
+
style,
|
|
80
|
+
text,
|
|
81
|
+
viewTransition,
|
|
82
|
+
clipboard,
|
|
83
|
+
fit,
|
|
84
|
+
intl,
|
|
85
|
+
peek,
|
|
86
|
+
setAll,
|
|
87
|
+
toggleAll,
|
|
88
|
+
animate,
|
|
89
|
+
httpDelete,
|
|
90
|
+
httpGet,
|
|
91
|
+
httpPatch,
|
|
92
|
+
httpPost,
|
|
93
|
+
httpPut,
|
|
94
|
+
applyElements,
|
|
95
|
+
applyState,
|
|
96
|
+
boost,
|
|
97
|
+
cloak,
|
|
98
|
+
collapse,
|
|
99
|
+
html,
|
|
100
|
+
mask,
|
|
101
|
+
removeMe,
|
|
102
|
+
teleport,
|
|
103
|
+
transition,
|
|
104
|
+
trap,
|
|
105
|
+
confirm,
|
|
106
|
+
dispatch,
|
|
107
|
+
websocket
|
|
108
|
+
];
|
|
109
|
+
export {
|
|
110
|
+
all
|
|
111
|
+
};
|
|
112
|
+
//# sourceMappingURL=all.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/presets/all.ts"],
|
|
4
|
+
"sourcesContent": ["import type { Plugin } from '../kernel/contracts.js'\nimport {\n attr,\n bind,\n className,\n computed,\n customValidity,\n effect,\n indicator,\n init,\n jsonSignals,\n matchMedia,\n on,\n onIntersect,\n onInterval,\n onRaf,\n onResize,\n onSignalPatch,\n persist,\n queryString,\n ref,\n replaceUrl,\n scrollIntoView,\n show,\n signals,\n style,\n text,\n viewTransition,\n clipboard,\n fit,\n intl,\n peek,\n setAll,\n toggleAll,\n animate,\n httpDelete,\n httpGet,\n httpPatch,\n httpPost,\n httpPut,\n applyElements,\n applyState,\n boost,\n cloak,\n collapse,\n html,\n mask,\n removeMe,\n teleport,\n transition,\n trap,\n confirm,\n dispatch,\n websocket,\n} from '../plugins/index.js'\n\n/** Every plugin. */\nexport const all: Plugin[] = [\n attr,\n bind,\n className,\n computed,\n customValidity,\n effect,\n indicator,\n init,\n jsonSignals,\n matchMedia,\n on,\n onIntersect,\n onInterval,\n onRaf,\n onResize,\n onSignalPatch,\n persist,\n queryString,\n ref,\n replaceUrl,\n scrollIntoView,\n show,\n signals,\n style,\n text,\n viewTransition,\n clipboard,\n fit,\n intl,\n peek,\n setAll,\n toggleAll,\n animate,\n httpDelete,\n httpGet,\n httpPatch,\n httpPost,\n httpPut,\n applyElements,\n applyState,\n boost,\n cloak,\n collapse,\n html,\n mask,\n removeMe,\n teleport,\n transition,\n trap,\n confirm,\n dispatch,\n websocket,\n]\n"],
|
|
5
|
+
"mappings": "AACA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAGA,MAAM,MAAgB;AAAA,EAC3B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { applyElements } from "../plugins/server-events/apply-elements.js";
|
|
2
|
+
import { applyState } from "../plugins/server-events/apply-state.js";
|
|
3
|
+
import { attr } from "../plugins/directives/attribute-sync.js";
|
|
4
|
+
import { bind } from "../plugins/directives/two-way-bind.js";
|
|
5
|
+
import { className } from "../plugins/directives/class-toggle.js";
|
|
6
|
+
import { computed } from "../plugins/directives/derive.js";
|
|
7
|
+
import { httpDelete, httpGet, httpPatch, httpPost, httpPut } from "../plugins/functions/request.js";
|
|
8
|
+
import { indicator } from "../plugins/directives/busy-flag.js";
|
|
9
|
+
import { init } from "../plugins/directives/on-mount.js";
|
|
10
|
+
import { on } from "../plugins/directives/event-listener.js";
|
|
11
|
+
import { show } from "../plugins/directives/visibility.js";
|
|
12
|
+
import { signals } from "../plugins/directives/declare.js";
|
|
13
|
+
import { text } from "../plugins/directives/text-content.js";
|
|
14
|
+
const essentials = [signals, computed, text, show, className, attr, bind, on, init, indicator, httpGet, httpPost, httpPut, httpPatch, httpDelete, applyElements, applyState];
|
|
15
|
+
export {
|
|
16
|
+
essentials
|
|
17
|
+
};
|
|
18
|
+
//# sourceMappingURL=essentials.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/presets/essentials.ts"],
|
|
4
|
+
"sourcesContent": ["import type { Plugin } from '../kernel/contracts.js'\nimport { applyElements } from '../plugins/server-events/apply-elements.js'\nimport { applyState } from '../plugins/server-events/apply-state.js'\nimport { attr } from '../plugins/directives/attribute-sync.js'\nimport { bind } from '../plugins/directives/two-way-bind.js'\nimport { className } from '../plugins/directives/class-toggle.js'\nimport { computed } from '../plugins/directives/derive.js'\nimport { httpDelete, httpGet, httpPatch, httpPost, httpPut } from '../plugins/functions/request.js'\nimport { indicator } from '../plugins/directives/busy-flag.js'\nimport { init } from '../plugins/directives/on-mount.js'\nimport { on } from '../plugins/directives/event-listener.js'\nimport { show } from '../plugins/directives/visibility.js'\nimport { signals } from '../plugins/directives/declare.js'\nimport { text } from '../plugins/directives/text-content.js'\n\n/** What a typical server-driven app needs: state, rendering, events, forms and the request client with morphing. */\nexport const essentials: Plugin[] = [signals, computed, text, show, className, attr, bind, on, init, indicator, httpGet, httpPost, httpPut, httpPatch, httpDelete, applyElements, applyState]\n"],
|
|
5
|
+
"mappings": "AACA,SAAS,qBAAqB;AAC9B,SAAS,kBAAkB;AAC3B,SAAS,YAAY;AACrB,SAAS,YAAY;AACrB,SAAS,iBAAiB;AAC1B,SAAS,gBAAgB;AACzB,SAAS,YAAY,SAAS,WAAW,UAAU,eAAe;AAClE,SAAS,iBAAiB;AAC1B,SAAS,YAAY;AACrB,SAAS,UAAU;AACnB,SAAS,YAAY;AACrB,SAAS,eAAe;AACxB,SAAS,YAAY;AAGd,MAAM,aAAuB,CAAC,SAAS,UAAU,MAAM,MAAM,WAAW,MAAM,MAAM,IAAI,MAAM,WAAW,SAAS,UAAU,SAAS,WAAW,YAAY,eAAe,UAAU;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { on } from "../plugins/directives/event-listener.js";
|
|
2
|
+
import { show } from "../plugins/directives/visibility.js";
|
|
3
|
+
import { signals } from "../plugins/directives/declare.js";
|
|
4
|
+
import { text } from "../plugins/directives/text-content.js";
|
|
5
|
+
const minimal = [signals, text, show, on];
|
|
6
|
+
export {
|
|
7
|
+
minimal
|
|
8
|
+
};
|
|
9
|
+
//# sourceMappingURL=minimal.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/presets/minimal.ts"],
|
|
4
|
+
"sourcesContent": ["import type { Plugin } from '../kernel/contracts.js'\nimport { on } from '../plugins/directives/event-listener.js'\nimport { show } from '../plugins/directives/visibility.js'\nimport { signals } from '../plugins/directives/declare.js'\nimport { text } from '../plugins/directives/text-content.js'\n\n/** The smallest useful set: declare, read, toggle. */\nexport const minimal: Plugin[] = [signals, text, show, on]\n"],
|
|
5
|
+
"mappings": "AACA,SAAS,UAAU;AACnB,SAAS,YAAY;AACrB,SAAS,eAAe;AACxB,SAAS,YAAY;AAGd,MAAM,UAAoB,CAAC,SAAS,MAAM,MAAM,EAAE;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
var Ae=Object.defineProperty;var Re=(t,e)=>{for(var n in e)Ae(t,n,{get:e[n],enumerable:!0})};var Pt=(t,e)=>Function(...t,e),Tt=new Map,Me=t=>/[A-Za-z0-9_$]/.test(t),Et=(t,e)=>{let n=0,r=t.length;for(;n<r;){let o=t[n],i=t[n+1];if(o==='"'||o==="'"||o==="`"){let s=n+1;for(;s<r&&t[s]!==o;)s+=t[s]==="\\"?2:1;e(t.slice(n,s+1),n),n=s+1}else if(o==="/"&&i==="/"){let s=t.indexOf(`
|
|
2
|
+
`,n);n=s<0?r:s}else if(o==="/"&&i==="*"){let s=t.indexOf("*/",n+2);n=s<0?r:s+2}else{let s=e(o,n);n+=s||1}}},je=t=>{let e="";return Et(t,(n,r)=>{if(n==="@"){let o=r+1;for(;o<t.length&&Me(t[o]);)o++;let i=o;for(;i<t.length&&/\s/.test(t[i]);)i++;if(o>r+1&&t[i]==="(")return e+=`__a.${t.slice(r+1,o)}(`,i+1-r}e+=n}),e},$e=t=>{let e=[],n=0,r=0;return Et(t,(o,i)=>{o.length>1||("([{".includes(o)?n++:")]}".includes(o)?n--:o===";"&&!n&&(e.push(t.slice(r,i)),r=i+1))}),e.push(t.slice(r)),e.filter(o=>o.trim())},At=(t,e,n,r)=>{let o=`${+r}|${n.join()}|${e}`,i=Tt.get(o);if(i)return i;let s=je(e.trim()),f=g=>t(["$","__a",...n],`with($){${g}
|
|
3
|
+
}`),l;if(!r)l=f(s);else try{l=f(`return(${s}
|
|
4
|
+
)`)}catch{let g=$e(s),w=g.pop()??"";try{l=f(`${g.join(";")};return(${w}
|
|
5
|
+
)`)}catch{l=f(s)}}return Tt.set(o,l),l};var I,tt,U=0,ft=!1,Y=new Set,pt=new Set,D=class{constructor(e){this.o=0;this.i=new Set;this.t=e}get value(){return I&&(I.e.set(this,this.o),this.i.add(I)),this.t}set value(e){Object.is(e,this.t)||(this.t=e,this.bump())}peek(){return this.t}bump(){this.o++;for(let e of[...this.i])e.a();U||nt()}},Rt=t=>{for(let e of t.e.keys())e.i.delete(t);t.e.clear()},Mt=t=>{for(let[e,n]of t.e)if(e instanceof L&&e.c(),e.o!==n)return!0;return!1},jt=(t,e)=>{Rt(t);let n=I;I=t;try{return e()}finally{I=n}},L=class extends D{constructor(n){super(void 0);this.e=new Map;this.s=!0;this.n=n}c(){if(!this.s||(this.s=!1,this.e.size&&!Mt(this)))return;let n=jt(this,this.n);Object.is(n,this.t)||(this.t=n,this.o++)}get value(){return this.c(),super.value}set value(n){throw new Error("computed signals are read-only")}peek(){return this.c(),this.t}a(){if(!this.s){this.s=!0;for(let n of this.i)n.a()}}},dt=class{constructor(e,n){this.e=new Map;this.l=!1;this.u=!1;this.r=new Set;this.n=e,this.f=n}a(){!this.u&&!this.l&&(this.l=!0,Y.add(this))}d(){if(this.l=!1,this.u||this.e.size&&!Mt(this))return;for(let n of this.r)n.p();this.r.clear();let e=tt;tt=this,U++;try{jt(this,this.n)}catch(n){if(!this.f)throw n;this.f(n)}finally{U--,tt=e}}p(){this.u=!0,Rt(this);for(let e of this.r)e.p();this.r.clear(),Y.delete(this)}};var et=t=>new L(t),mt=(t,e)=>{let n=new dt(t,e);return tt?.r.add(n),n.d(),U||nt(),()=>n.p()},C=t=>{U++;try{return t()}finally{--U||nt()}},J=t=>{let e=I;I=void 0;try{return t()}finally{I=e}},gt=t=>(pt.add(t),()=>pt.delete(t)),nt=()=>{if(!(ft||U)){ft=!0;try{let t=0;for(;Y.size;){if(++t>1e5)throw new Error("effect loop: a signal is written by an effect that reads it");let e=Y.values().next().value;Y.delete(e),e.d()}}finally{ft=!1}for(let t of pt)t()}};var B=t=>{if(t===null||typeof t!="object")return!1;let e=Object.getPrototypeOf(t);return e===Object.prototype||e===null},_=(t,e,n)=>{let r=e.split("."),o=r.pop(),i=t;for(let s of r)i=B(i[s])?i[s]:i[s]={};return i[o]=n,t},$t=(t,e)=>t===void 0?e:typeof t=="string"?new RegExp(t.replace(/^\/|\/$/g,"")):t,rt=t=>{if(typeof t=="function")return t;let e=$t(t?.include,/(?:)/),n=$t(t?.exclude,/(?!)/);return r=>e.test(r)&&!n.test(r)};var ot=t=>t.slice(0,Math.max(0,t.lastIndexOf("."))),it=t=>t.slice(t.lastIndexOf(".")+1),V=(t,e)=>t?`${t}.${e}`:e,Ot=(t,e)=>!e||t===e||t.startsWith(`${e}.`),Ft=()=>{let t=new Map,e=new Map([["",new Set]]),n=new D(0),r=new Map,o=new Set,i=new Map,s=new WeakMap,f=a=>{let u=e.get(a);return u||(t.has(a)&&l(a),e.set(a,u=new Set),f(ot(a)).add(it(a)),n.bump()),u},l=a=>{let u=t.get(a);u&&(t.delete(a),e.get(ot(a))?.delete(it(a)),r.set(a,null),u.bump(),n.bump())},g=a=>{let u=e.get(a);if(u){for(let x of[...u])w(V(a,x));a&&(e.delete(a),e.get(ot(a))?.delete(it(a)),i.delete(a)),n.bump()}},w=a=>C(()=>{l(a),g(a)}),b=(a,u)=>C(()=>{e.has(a)&&g(a);let x=t.get(a);t.set(a,u),f(ot(a)).add(it(a)),x?.bump(),n.bump()}),R=(a,u)=>C(()=>{if(u==null)return w(a);if(B(u)){let S=f(a);for(let m of[...S])m in u||w(V(a,m));for(let m in u)R(V(a,m),u[m]);return}e.has(a)&&g(a);let x=t.get(a);if(x instanceof L)throw new Error(`"${a}" is a computed signal and cannot be assigned`);if(x){if(Object.is(x.peek(),u))return;x.value=u}else b(a,new D(u));r.set(a,u)}),j=(a,{at:u="",ifMissing:x=!1}={})=>C(()=>{if(B(a)){f(u);for(let S in a){let m=V(u,S),E=a[S];E===null?x||w(m):B(E)?j(E,{at:m,ifMissing:x}):!(x&&(t.has(m)||e.has(m)))&&!(t.get(m)instanceof L)&&R(m,E)}}}),h=(a,u,x)=>{let S=s.get(a);if(!S){let m=()=>{r.set(x,a),u.bump()};S=new Proxy(a,{set:(E,c,d)=>(E[c]=d,m(),!0),deleteProperty:(E,c)=>(delete E[c],m(),!0)}),s.set(a,S)}return S},v=a=>{let u=t.get(a);if(u){let x=u.value;return Array.isArray(x)?h(x,u,a):x}if(e.has(a))return P(a);n.value},P=a=>{let u=i.get(a);if(!u){let x=()=>(n.value,e.get(a));u=new Proxy(Object.create(null),{get:(S,m)=>typeof m!="string"?void 0:m==="toJSON"?()=>K(void 0,{at:a}):v(V(a,m)),set:(S,m,E)=>(typeof m=="string"&&R(V(a,m),E),!0),deleteProperty:(S,m)=>(typeof m=="string"&&w(V(a,m)),!0),has:(S,m)=>typeof m=="string"&&!!x()?.has(m),ownKeys:()=>[...x()??[]],getOwnPropertyDescriptor:(S,m)=>typeof m=="string"&&x()?.has(m)?{enumerable:!0,configurable:!0,writable:!0,value:v(V(a,m))}:void 0}),i.set(a,u)}return u},q=new Proxy(Object.create(null),{has:(a,u)=>typeof u=="string"&&u[0]==="$",get:(a,u)=>typeof u!="string"?void 0:u==="$"?P(""):v(u.slice(1)),set:(a,u,x)=>(typeof u=="string"&&(u==="$"?j(x):R(u.slice(1),x)),!0)}),M=a=>{n.value;let u=rt(a);return[...t.keys()].filter(u)},K=(a,{at:u="",computed:x=!0}={})=>{n.value;let S=rt(a),m={},E=c=>u?c.slice(u.length+1):c;for(let[c,d]of t)!Ot(c,u)||!S(c)||!x&&d instanceof L||_(m,E(c),d.value);for(let c of e.keys())c&&c!==u&&Ot(c,u)&&S(c)&&!e.get(c).size&&_(m,E(c),{});return m};return gt(()=>{if(!r.size)return;let a={};for(let[u,x]of r)_(a,u,x);r.clear();for(let u of o)u(a)}),{get:v,set:R,merge:j,remove:w,has:a=>t.has(a)||e.has(a),define:b,paths:M,snapshot:K,onPatch:a=>(o.add(a),()=>o.delete(a)),get $(){return P("")},scope:q}};var st=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1 $2").split(/[^A-Za-z0-9]+|\s+/).filter(Boolean).map(e=>e.toLowerCase()),qt=t=>t[0].toUpperCase()+t.slice(1),at=t=>st(t).join("-"),Ct=t=>st(t).join("_"),It=t=>st(t).map((e,n)=>n?qt(e):e).join(""),Lt=t=>st(t).map(qt).join(""),ht=(t,e)=>t.split(".").map(n=>({camel:It,kebab:at,snake:Ct,pascal:Lt})[e](n)).join(".");var ct=t=>t instanceof HTMLElement||t instanceof SVGElement||t instanceof MathMLElement,_t=new Map,Nt=t=>{let e=_t.get(t);if(!e){let[n,...r]=t.split("__"),o=n.indexOf(":"),i=new Map;for(let s of r){let[f,...l]=s.split(".");i.set(f,l)}e={plugin:o<0?n:n.slice(0,o),key:o<0?void 0:n.slice(o+1),mods:i},_t.set(t,e)}return e},Oe=(t,e)=>Object.assign(new Error(t),{info:e}),yt=(t={})=>{let e=[].concat(t.prefix??"data-"),n=t.store??Ft(),r=t.compile??Pt,o=t.onError??((c,d)=>console.error(c,d)),i=Object.create(null),s=Object.create(null),f=Object.create(null),l={prefixes:e,attr:c=>e[0]+c,store:n,compiler:r,emit:(c,d)=>document.dispatchEvent(new CustomEvent(`sigmx-${c}`,{detail:d})),call:(c,d,y)=>{let T=s[c];if(!T)throw d.error(`unknown action @${c}`);return T.call(d,...y)},attributes:i,actions:s,handlers:f},g=new Map,w=new Set,b=e.map(c=>`[${c}ignore__self]`).join(),R=e.map(c=>`[${c}ignore]`).join(),j=c=>c.matches(b)||!!c.closest(R),h=c=>{for(let d of e)if(c.startsWith(d))return c.slice(d.length)},v=c=>{for(let d of c){let y=g.get(d);if(y&&g.delete(d))for(let T of y.values())T()}},P=(c,d)=>{let y=g.get(c);y?.get(d)?.(),y?.delete(d)},q=(c,d,y)=>{let T={el:c,evt:d,store:n,runtime:l,error:y};return new Proxy(Object.create(null),{get:(H,O)=>(...A)=>l.call(O,T,A)})},M=(c,d,y,T,H)=>{let{plugin:O,key:A,mods:Q}=Nt(y),z=i[O];if(!z||H&&!H.has(O))return;P(c,d);let X=[],vt={plugin:O,el:c,attr:d},W=(k,Z)=>Oe(`${e[0]}${O}: ${k}`,{...vt,...Z}),lt=k=>o(k,vt),wt,Se={el:c,plugin:O,attr:d,key:A,value:T,mods:Q,cased:(k="camel")=>ht(A??"",Q.get("case")?.[0]||k),evaluate:(k,...Z)=>(wt??=At(r,T,["el","evt",...z.args??[]],z.returns??!0),wt(n.scope,q(c,k,W),c,k,...Z)),effect:k=>X.push(mt(k,lt)),listen:(k,Z,Te,kt)=>{let St=Pe=>{try{Te(Pe)}catch(Ee){lt(Ee)}};k.addEventListener(Z,St,kt),X.push(()=>k.removeEventListener(Z,St,kt))},cleanup:k=>X.push(k),error:W,store:n,runtime:l},ut=g.get(c);ut||g.set(c,ut=new Map),ut.set(d,()=>{for(let k of X.splice(0))k()});try{if(z.key==="required"&&!A)throw W("needs a key, e.g. :name");if(z.key==="forbidden"&&A)throw W("does not take a key");if(z.value==="required"&&!T)throw W("needs a value");if(z.value==="forbidden"&&T)throw W("does not take a value");let k=z.mount(Se);typeof k=="function"&&X.push(k)}catch(k){lt(k)}},K=(c,d)=>{for(let y of c)if(!j(y))for(let{name:T,value:H}of[...y.attributes]){let O=h(T);O&&M(y,T,O,H,d)}},a=new MutationObserver(c=>{for(let{type:d,target:y,attributeName:T,addedNodes:H,removedNodes:O}of c)if(d==="childList"){for(let A of O)ct(A)&&v([A,...A.querySelectorAll("*")]);for(let A of H)ct(A)&&K([A,...A.querySelectorAll("*")])}else if(T&&ct(y)&&!j(y)){let A=h(T);if(!A)continue;let Q=y.getAttribute(T);Q===null?P(y,T):M(y,T,A,Q)}}),u=!1,x=(c=document.documentElement,d=!0,y)=>{K([...ct(c)?[c]:[],...c.querySelectorAll("*")],y),d&&!w.has(c)&&(a.observe(c,{subtree:!0,childList:!0,attributes:!0}),w.add(c)),!u&&w.has(document.documentElement)&&(u=!0,l.emit("ready"))},S=(...c)=>{let d=new Set;for(let y of c)y.type==="attribute"?(i[y.name]=y,d.add(y.name)):y.type==="action"?s[y.name]=y:f[y.name]=y;if(d.size)for(let y of w)x(y,!1,d)},m=n.onPatch(c=>l.emit("signal-patch",c));S(...t.plugins??[]);let E={runtime:l,store:n,get $(){return n.$},apply:(c,d)=>x(c,d),use:S,destroy:()=>{a.disconnect(),m(),v([...g.keys()]),w.clear()}};return(t.autoStart??!0)&&(document.readyState==="loading"?document.addEventListener("DOMContentLoaded",()=>E.apply(),{once:!0}):E.apply()),E};var G=(t,e=0)=>{for(let n of t??[]){let r=/^(\d+(?:\.\d+)?)(ms|s)?$/.exec(n);if(r)return+r[1]*(r[2]==="s"?1e3:1)}return e},zt=(t,e)=>(...n)=>{setTimeout(t,e,...n)},Vt=(t,e,n=!1,r=!0)=>{let o,i;return(...s)=>{o?clearTimeout(o):n&&t(...s),i=s,o=setTimeout(()=>{o=void 0,r&&i&&t(...i),i=void 0},e)}},Ht=(t,e,n=!0,r=!1)=>{let o,i;return(...s)=>{if(o){i=s;return}n?t(...s):i=s,o=setTimeout(()=>{o=void 0,r&&i&&t(...i),i=void 0},e)}},$=(t,e)=>{let n=e.get("delay");n&&(t=zt(t,G(n)));let r=e.get("debounce");r&&(t=Vt(t,G(r,300),r.includes("leading"),!r.includes("notrailing")));let o=e.get("throttle");return o&&(t=Ht(t,G(o,300),!o.includes("noleading"),o.includes("trailing"))),t},N=(t,e)=>e.has("viewtransition")&&"startViewTransition"in document?(...n)=>{document.startViewTransition(()=>t(...n))}:t;var p=t=>({type:"attribute",...t}),F=t=>({type:"action",...t});var bt={};Re(bt,{attr:()=>Dt,bind:()=>Jt,className:()=>Wt,clipboard:()=>he,computed:()=>Zt,customValidity:()=>Bt,effect:()=>Gt,fit:()=>ye,indicator:()=>Kt,init:()=>Qt,intl:()=>xe,jsonSignals:()=>Xt,matchMedia:()=>Yt,on:()=>te,onIntersect:()=>ee,onInterval:()=>ne,onRaf:()=>re,onResize:()=>oe,onSignalPatch:()=>ie,peek:()=>be,persist:()=>se,queryString:()=>ae,ref:()=>ce,replaceUrl:()=>le,scrollIntoView:()=>ue,setAll:()=>ve,show:()=>fe,signals:()=>pe,style:()=>de,text:()=>me,toggleAll:()=>we,viewTransition:()=>ge});var Ut=(t,e,n)=>{n===!1||n==null?t.removeAttribute(e):t.setAttribute(e,n===!0?"":typeof n=="object"?JSON.stringify(n):String(n))},Dt=p({name:"attr",value:"required",mount({el:t,key:e,cased:n,evaluate:r,effect:o}){o(()=>{if(e)return Ut(t,n("kebab"),r());let i=r();for(let s in i)Ut(t,s,i[s])})}});var Fe=t=>Promise.all([...t.files??[]].map(e=>new Promise(n=>{let r=new FileReader;r.onloadend=()=>n({name:e.name,type:e.type,size:e.size,contents:String(r.result).split(",")[1]??""}),r.readAsDataURL(e)}))),Jt=p({name:"bind",mount({el:t,key:e,value:n,cased:r,mods:o,store:i,listen:s,effect:f}){let l=e?r():n.trim(),g=()=>i.get(l),w=h=>typeof g()=="number"?+h:h,b,R=o.get("prop")?.[0];if(R)b={read:()=>t[R],write:h=>t[R]=h,events:["input","change"]};else if(t instanceof HTMLInputElement){let h=t.type;if(h==="checkbox"){let v=t.hasAttribute("value")&&t.value!=="on";b={read:()=>{let P=g();if(Array.isArray(P)){let q=new Set(P);return t.checked?q.add(t.value):q.delete(t.value),[...q]}return v?t.checked?t.value:"":t.checked},write:P=>{t.checked=Array.isArray(P)?P.includes(t.value):v?P===t.value:!!P},events:["input"]}}else if(h==="radio")t.name||(t.name=l),b={read:()=>t.checked?w(t.value):g(),write:v=>t.checked=String(v)===t.value,events:["input"]};else if(h==="file"){s(t,"change",()=>Fe(t).then(v=>i.set(l,v)));return}else h==="number"||h==="range"?b={read:()=>t.value===""?"":+t.value,write:v=>t.value=String(v??""),events:["input"]}:b={read:()=>t.value,write:v=>t.value=String(v??""),events:["input"]}}else t instanceof HTMLSelectElement?b={read:()=>t.multiple?[...t.selectedOptions].map(h=>w(h.value)):w(t.value),write:h=>{if(t.multiple)for(let v of t.options)v.selected=Array.isArray(h)&&h.map(String).includes(v.value);else t.value=String(h??"")},events:["change"]}:t instanceof HTMLTextAreaElement||"value"in t?b={read:()=>t.value,write:h=>t.value=String(h??""),events:["input","change"]}:b={read:()=>t.getAttribute("value"),write:h=>t.setAttribute("value",String(h??"")),events:["change"]};if(!i.has(l)){let h=b.read();h!==void 0&&h!==""&&i.set(l,h)}let j=()=>i.set(l,b.read());for(let h of o.get("event")??b.events)s(t,h,j);s(t,"sigmx-prop-change",j),f(()=>{let h=g();h!==void 0&&b.write(h)})}});var Wt=p({name:"class",value:"required",mount({el:t,key:e,cased:n,evaluate:r,effect:o}){let i=new Set;return o(()=>{let s=e?{[n("kebab")]:r()}:r();for(let f in s)for(let l of f.split(/\s+/).filter(Boolean))t.classList.toggle(l,!!s[f]),s[f]?i.add(l):i.delete(l)}),()=>t.classList.remove(...i)}});var Zt=p({name:"computed",value:"required",mount({key:t,cased:e,evaluate:n,store:r,error:o}){if(t){r.define(e(),et(()=>n()));return}let i=n();for(let s in i){if(typeof i[s]!="function")throw o(`"${s}" must be a function`);r.define(s,et(i[s]))}}});var Bt=p({name:"custom-validity",key:"forbidden",value:"required",mount({el:t,evaluate:e,effect:n,error:r}){if(!("setCustomValidity"in t))throw r("only works on form fields");n(()=>t.setCustomValidity(String(e()??"")))}});var Gt=p({name:"effect",key:"forbidden",value:"required",returns:!1,mount:t=>t.effect(()=>t.evaluate())});var Kt=p({name:"indicator",mount({el:t,key:e,value:n,cased:r,store:o,listen:i}){let s=e?r():n.trim(),f=0;return o.set(s,!1),i(document,"sigmx-fetch",l=>{l.detail.el===t&&(l.detail.type==="started"?f++:l.detail.type==="finished"&&(f=Math.max(0,f-1)),o.set(s,f>0))}),()=>o.set(s,!1)}});var Qt=p({name:"init",key:"forbidden",value:"required",returns:!1,mount({mods:t,evaluate:e}){$(N(()=>e(),t),t)()}});var Xt=p({name:"json-signals",key:"forbidden",mount({el:t,value:e,mods:n,evaluate:r,effect:o,store:i}){let s=e?r():void 0;o(()=>{t.textContent=JSON.stringify(i.snapshot(s),null,n.has("terse")?0:2)})}});var Yt=p({name:"match-media",key:"required",value:"required",mount({cased:t,evaluate:e,store:n,listen:r}){let o=String(e()).trim();(!/^[(a-z]/.test(o)||!o.startsWith("(")&&o.includes(":")&&!/^(not|only|all|screen|print)\b/.test(o))&&(o=`(${o})`);let i=window.matchMedia(o),s=t(),f=()=>n.set(s,i.matches);f(),r(i,"change",f)}});var te=p({name:"on",key:"required",value:"required",returns:!1,mount({el:t,mods:e,cased:n,evaluate:r,listen:o}){let i=n("kebab"),s=e.has("outside"),f=e.has("window")?window:e.has("document")||s||i.startsWith("sigmx-")?document:t,l=$(N(g=>r(g),e),e);o(f,i,g=>{s&&t.contains(g.target)||((e.has("prevent")||i==="submit"&&t instanceof HTMLFormElement)&&g.preventDefault(),e.has("stop")&&g.stopPropagation(),l(g))},{capture:e.has("capture"),passive:e.has("passive"),once:e.has("once")})}});var ee=p({name:"on-intersect",key:"forbidden",value:"required",returns:!1,mount({el:t,mods:e,evaluate:n}){let r=e.get("threshold")?.[0],o=e.has("full")?1:e.has("half")?.5:r?Math.min(100,Math.max(0,+r))/100:0,i=$(N(()=>n(),e),e),s=new IntersectionObserver(f=>{for(let l of f)l.isIntersecting!==e.has("exit")&&(i(),e.has("once")&&s.disconnect())},{threshold:o});return s.observe(t),()=>s.disconnect()}});var ne=p({name:"on-interval",key:"forbidden",value:"required",returns:!1,mount({mods:t,evaluate:e}){let n=t.get("duration"),r=N(()=>e(),t);n?.includes("leading")&&r();let o=setInterval(r,G(n,1e3));return()=>clearInterval(o)}});var re=p({name:"on-raf",key:"forbidden",value:"required",returns:!1,mount({mods:t,evaluate:e}){let n=$(()=>e(),t),r=requestAnimationFrame(function o(){n(),r=requestAnimationFrame(o)});return()=>cancelAnimationFrame(r)}});var oe=p({name:"on-resize",key:"forbidden",value:"required",returns:!1,mount({el:t,mods:e,evaluate:n}){let r=$(()=>n(),e),o=new ResizeObserver(()=>r());return o.observe(t),()=>o.disconnect()}});var qe=(t,e)=>{let n=t;for(let r of e.split(".")){if(n==null||typeof n!="object"||!(r in n))return!1;n=n[r]}return!0},ie=p({name:"on-signal-patch",value:"required",returns:!1,args:["patch"],mount({key:t,cased:e,mods:n,evaluate:r,listen:o}){let i=t?e():"",s=!1,f=$(l=>{if(!s){s=!0;try{r(void 0,l)}finally{s=!1}}},n);o(document,"sigmx-signal-patch",l=>{(!i||qe(l.detail,i))&&f(l.detail)})}});var se=p({name:"persist",mount({key:t,value:e,mods:n,evaluate:r,store:o,effect:i}){let s=n.has("session")?sessionStorage:localStorage,f=t||"sigmx",l=e?r():void 0,g=s.getItem(f);g&&o.merge(JSON.parse(g)),i(()=>s.setItem(f,JSON.stringify(o.snapshot(l,{computed:!1}))))}});var Ce=t=>{try{return JSON.parse(t)}catch{return t}},ae=p({name:"query-string",key:"forbidden",mount({value:t,mods:e,evaluate:n,store:r,listen:o,effect:i}){let s=t?n():void 0,f=e.has("history"),l=()=>{let w={};for(let[b,R]of new URLSearchParams(location.search))_(w,b,Ce(R));r.merge(r.snapshot(s,{computed:!1})&&w)},g=!1;l(),i(()=>{let w=r.snapshot(s,{computed:!1});if(g)return;let b=new URLSearchParams(location.search),R=(h,v)=>{for(let P in h){let q=v?`${v}.${P}`:P,M=h[P];M&&typeof M=="object"&&!Array.isArray(M)?R(M,q):e.has("filter")&&(M===""||M==null)?b.delete(q):b.set(q,typeof M=="string"?M:JSON.stringify(M))}};R(w,"");let j=`${location.pathname}${b.size?`?${b}`:""}${location.hash}`;j!==location.pathname+location.search+location.hash&&(f?window.history.pushState(null,"",j):window.history.replaceState(null,"",j))}),f&&o(window,"popstate",()=>{g=!0;try{l()}finally{g=!1}})}});var ce=p({name:"ref",mount({el:t,key:e,value:n,cased:r,store:o}){let i=e?r():n.trim();return o.set(i,t),()=>o.remove(i)}});var le=p({name:"replace-url",key:"forbidden",value:"required",mount:({evaluate:t,effect:e})=>e(()=>history.replaceState(history.state,"",new URL(String(t()),location.href)))});var xt=(t,e,n)=>e.find(r=>t.has(r))??n,ue=p({name:"scroll-into-view",key:"forbidden",value:"forbidden",mount({el:t,mods:e}){t.scrollIntoView({behavior:xt(e,["smooth","instant","auto"],"smooth"),block:xt(e,["vstart","vcenter","vend","vnearest"],"vcenter").slice(1),inline:xt(e,["hstart","hcenter","hend","hnearest"],"hcenter").slice(1)}),e.has("focus")&&t.focus?.()}});var fe=p({name:"show",key:"forbidden",value:"required",mount({el:t,evaluate:e,effect:n}){let r=t.style.display==="none"?"":t.style.display;return n(()=>{t.style.display=e()?r:"none"}),()=>{t.style.display=r}}});var pe=p({name:"signals",value:"required",mount({key:t,cased:e,evaluate:n,store:r,mods:o}){let i=n();r.merge(t?_({},e(),i):i,{ifMissing:o.has("ifmissing")})}});var de=p({name:"style",value:"required",mount({el:t,key:e,cased:n,evaluate:r,effect:o}){let i=new Map,s=(f,l)=>{i.has(f)||i.set(f,t.style.getPropertyValue(f)),l||l===0?t.style.setProperty(f,String(l)):t.style.setProperty(f,i.get(f))};return o(()=>{let f=e?{[n("kebab")]:r()}:r();for(let l of i.keys())l in f||s(l,"");for(let l in f)s(at(l),f[l])}),()=>{for(let[f,l]of i)t.style.setProperty(f,l)}}});var me=p({name:"text",key:"forbidden",value:"required",mount:({el:t,evaluate:e,effect:n})=>n(()=>{t.textContent=String(e()??"")})});var ge=p({name:"view-transition",key:"forbidden",value:"required",mount:({el:t,evaluate:e,effect:n})=>n(()=>t.style.setProperty("view-transition-name",String(e())))});var he=F({name:"clipboard",call:(t,e,n=!1)=>navigator.clipboard.writeText(n?new TextDecoder().decode(Uint8Array.from(atob(e),r=>r.charCodeAt(0))):e)});var ye=F({name:"fit",call:(t,e,n,r,o,i,s=!1,f=!1)=>{let l=(e-n)/(r-n);s&&(l=Math.min(1,Math.max(0,l)));let g=o+l*(i-o);return f?Math.round(g):g}});var Ie={number:(t,e,n)=>new Intl.NumberFormat(t,n).format(e),datetime:(t,e,n)=>new Intl.DateTimeFormat(t,n).format(e),pluralRules:(t,e,n)=>new Intl.PluralRules(t,n).select(e),relativeTime:(t,e,n)=>new Intl.RelativeTimeFormat(t,n).format(e[0],e[1]),list:(t,e,n)=>new Intl.ListFormat(t,n).format(e),displayNames:(t,e,n)=>new Intl.DisplayNames(t,n).of(e)??""},xe=F({name:"intl",call:({error:t},e,n,r,o)=>{let i=Ie[e];if(!i)throw t(`unknown @intl type "${e}"`);return i(o,n,r)}});var be=F({name:"peek",call:(t,e)=>J(e)});var ve=F({name:"setAll",call:({store:t},e,n)=>C(()=>J(()=>{for(let r of t.paths(n))t.set(r,e)}))});var we=F({name:"toggleAll",call:({store:t},e)=>C(()=>J(()=>{for(let n of t.paths(e))t.set(n,!t.get(n))}))});var ke=Object.values(bt);var Kr=yt({plugins:ke});export{Kr as sigmx};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e,t,n=(e,t)=>Function(...e,t),r=new Map,a=e=>/[A-Za-z0-9_$]/.test(e),i=(e,t)=>{let n=0,r=e.length;for(;n<r;){let a=e[n],i=e[n+1];if('"'===a||"'"===a||"`"===a){let i=n+1;for(;i<r&&e[i]!==a;)i+="\\"===e[i]?2:1;t(e.slice(n,i+1),n),n=i+1}else if("/"===a&&"/"===i){let t=e.indexOf("\n",n);n=t<0?r:t}else if("/"===a&&"*"===i){let t=e.indexOf("*/",n+2);n=t<0?r:t+2}else n+=t(a,n)||1}},l=e=>(t,n,l)=>((e,t,n,l)=>{let o=`${+l}|${n.join()}|${t}`,s=r.get(o);if(s)return s;let u,d=(e=>{let t="";return i(e,(n,r)=>{if("@"===n){let n=r+1;for(;n<e.length&&a(e[n]);)n++;let i=n;for(;i<e.length&&/\s/.test(e[i]);)i++;if(n>r+1&&"("===e[i])return t+=`__a.${e.slice(r+1,n)}(`,i+1-r}t+=n}),t})(t.trim()),c=t=>e(["$","__a",...n],`with($.scope){${t}\n}`);if(l)try{u=c(`return(${d}\n)`)}catch{let e=(e=>{let t=[],n=0,r=0;return i(e,(a,i)=>{a.length>1||("([{".includes(a)?n++:")]}".includes(a)?n--:";"===a&&!n&&(t.push(e.slice(r,i)),r=i+1))}),t.push(e.slice(r)),t.filter(e=>e.trim())})(d),t=e.pop()??"";try{u=c(`${e.join(";")};return(${t}\n)`)}catch{u=c(d)}}else u=c(d);return r.set(o,u),u})(e,t,n,l),o=0,s=!1,u=new Set,d=new Set,c=class{e;i=0;s=new Set;constructor(e){this.e=e}get value(){return e&&(e.t.set(this,this.i),this.s.add(e)),this.e}set value(e){Object.is(e,this.e)||(this.e=e,this.bump())}peek(){return this.e}bump(){this.i++;for(let e of this.s)e.u();o||w()}},f=e=>{for(let t of e.t.keys())t.s.delete(e);e.t.clear()},m=e=>{for(let[t,n]of e.t)if(t instanceof p&&t.f(),t.i!==n)return!0;return!1},h=(t,n)=>{f(t);let r=e;e=t;try{return n()}finally{e=r}},p=class extends c{t=new Map;c=!0;r;constructor(e){super(void 0),this.r=e}f(){if(!this.c||(this.c=!1,this.t.size&&!m(this)))return;let e=h(this,this.r);Object.is(e,this.e)||(this.e=e,this.i++)}get value(){return this.f(),super.value}set value(e){throw new Error("computed signals are read-only")}peek(){return this.f(),this.e}u(){if(!this.c){this.c=!0;for(let e of this.s)e.u()}}},g=class{t=new Map;d=!1;p=!1;o=new Set;r;m;constructor(e,t){this.r=e,this.m=t}u(){!this.p&&!this.d&&(this.d=!0,u.add(this))}b(){if(this.d=!1,this.p||this.t.size&&!m(this))return;for(let e of this.o)e.g();this.o.clear();let e=t;t=this,o++;try{h(this,this.r)}catch(e){if(!this.m)throw e;this.m(e)}finally{o--,t=e}}g(){this.p=!0,f(this);for(let e of this.o)e.g();this.o.clear(),u.delete(this)}},v=e=>new p(e),y=e=>{o++;try{return e()}finally{--o||w()}},b=t=>{let n=e;e=void 0;try{return t()}finally{e=n}},w=()=>{if(!s&&!o){s=!0;try{let e=0;for(;u.size;){if(++e>1e5)throw new Error("effect loop");let t=u.values().next().value;u.delete(t),t.b()}}finally{s=!1}for(let e of d)e()}},S=e=>{if(null===e||"object"!=typeof e)return!1;let t=Object.getPrototypeOf(e);return t===Object.prototype||null===t},k=(e,t,n)=>{let r=t.split("."),a=r.pop(),i=e;for(let e of r)i=S(i[e])?i[e]:i[e]={};return i[a]=n,e},x=(e,t)=>void 0===e?t:"string"==typeof e?new RegExp(e.replace(/^\/|\/$/g,"")):e,A=e=>{if("function"==typeof e)return e;let t=x(e?.include,/(?:)/),n=x(e?.exclude,/(?!)/);return e=>t.test(e)&&!n.test(e)},E=e=>e.slice(0,Math.max(0,e.lastIndexOf("."))),T=e=>e.slice(e.lastIndexOf(".")+1),$=(e,t)=>e?`${e}.${t}`:t,M=(e,t)=>!t||e===t||e.startsWith(`${t}.`),L=e=>"string"==typeof e,q=()=>{let e=new Map,t=new Map([["",new Set]]),n=new c(0),r=new Map,a=new Set,i=new Map,l=new WeakMap,o=r=>{let a=t.get(r);return a||(e.has(r)&&s(r),t.set(r,a=new Set),o(E(r)).add(T(r)),n.bump()),a},s=a=>{let i=e.get(a);i&&(e.delete(a),t.get(E(a))?.delete(T(a)),r.set(a,null),i.bump(),n.bump())},u=e=>{let r=t.get(e);if(r){for(let t of[...r])f($(e,t));e&&(t.delete(e),t.get(E(e))?.delete(T(e)),i.delete(e)),n.bump()}},f=e=>y(()=>{s(e),u(e)}),m=(r,a)=>y(()=>{t.has(r)&&u(r);let i=e.get(r);e.set(r,a),o(E(r)).add(T(r)),i?.bump(),n.bump()}),h=(n,a)=>y(()=>{if(null==a)return f(n);if(S(a)){let e=o(n);for(let t of[...e])t in a||f($(n,t));for(let e in a)h($(n,e),a[e]);return}t.has(n)&&u(n);let i=e.get(n);if(i instanceof p)throw new Error(`"${n}" is a computed signal and cannot be assigned`);if(i){if(Object.is(i.peek(),a))return;i.value=a}else m(n,new c(a));r.set(n,a)}),g=(n,{at:r="",ifMissing:a=!1}={})=>y(()=>{if(S(n)){o(r);for(let i in n){let l=$(r,i),o=n[i];null===o?a||f(l):S(o)?g(o,{at:l,ifMissing:a}):(!a||!e.has(l)&&!t.has(l))&&!(e.get(l)instanceof p)&&h(l,o)}}}),v=a=>{let i=e.get(a);if(i){let e=i.value;return Array.isArray(e)?((e,t,n)=>{let a=l.get(e);if(!a){let i=()=>{r.set(n,e),t.bump()};a=new Proxy(e,{set:(e,t,n)=>(e[t]=n,i(),!0),deleteProperty:(e,t)=>(delete e[t],i(),!0)}),l.set(e,a)}return a})(e,i,a):e}if(t.has(a))return b(a);n.value},b=e=>{let r=i.get(e);if(!r){let a=()=>(n.value,t.get(e));r=new Proxy({},{get:(t,n)=>L(n)?"toJSON"===n?()=>x(void 0,{at:e}):v($(e,n)):void 0,set:(t,n,r)=>(L(n)&&h($(e,n),r),!0),deleteProperty:(t,n)=>(L(n)&&f($(e,n)),!0),has:(e,t)=>L(t)&&!!a()?.has(t),ownKeys:()=>[...a()??[]],getOwnPropertyDescriptor:(t,n)=>L(n)&&a()?.has(n)?{enumerable:!0,configurable:!0,writable:!0,value:v($(e,n))}:void 0}),i.set(e,r)}return r},w=new Proxy({},{has:(e,t)=>L(t)&&"$"===t[0],get:(e,t)=>L(t)?"$"===t?b(""):v(t.slice(1)):void 0,set:(e,t,n)=>(L(t)&&("$"===t?g(n):h(t.slice(1),n)),!0)}),x=(r,{at:a="",computed:i=!0}={})=>{n.value;let l=A(r),o={},s=e=>a?e.slice(a.length+1):e;for(let[t,n]of e)!M(t,a)||!l(t)||!i&&n instanceof p||k(o,s(t),n.value);for(let e of t.keys())e&&e!==a&&M(e,a)&&l(e)&&!t.get(e).size&&k(o,s(e),{});return o};return d.add(()=>{if(!r.size)return;let e={};for(let[t,n]of r)k(e,t,n);r.clear();for(let t of a)t(e)}),{get:v,set:h,merge:g,remove:f,has:n=>e.has(n)||t.has(n),define:m,paths:t=>{n.value;let r=A(t);return[...e.keys()].filter(r)},snapshot:x,onPatch:e=>(a.add(e),()=>a.delete(e)),get $(){return b("")},scope:w}},O=e=>e.replace(/([a-z0-9])([A-Z])|([A-Z]+)([A-Z][a-z])/g,"$1$3 $2$4").split(/[^A-Za-z0-9]+/).filter(Boolean).map(e=>e.toLowerCase()),P=e=>e[0].toUpperCase()+e.slice(1),N=e=>O(e).join("-"),j=e=>O(e).map((e,t)=>t?P(e):e).join(""),H={camel:j,kebab:N,snake:e=>O(e).join("_"),pascal:e=>O(e).map(P).join("")},C=e=>e instanceof HTMLElement||e instanceof SVGElement||e instanceof MathMLElement,R=e=>C(e)?[e,...e.querySelectorAll("*")]:e instanceof ShadowRoot?[...e.querySelectorAll("*")]:[],I=new Map,V=(e,t=0)=>{for(let t of e??[]){let e=/^(\d+(?:\.\d+)?)(ms|s)?$/.exec(t);if(e)return+e[1]*("s"===e[2]?1e3:1)}return t},z=(e,t,n,r,a)=>{let i,l,o=()=>{i=void 0,r&&l&&e(...l),l=void 0};return(...r)=>{if(i)return l=r,void(a&&(clearTimeout(i),i=setTimeout(o,t)));n?e(...r):l=r,i=setTimeout(o,t)}},D=(e,t)=>{let n=t.get("delay");n&&(e=((e,t)=>(...n)=>{setTimeout(e,t,...n)})(e,V(n)));let r=t.get("debounce");r&&(e=((e,t,n=!1,r=!0)=>z(e,t,n,r,!0))(e,V(r,300),r.includes("leading"),!r.includes("notrailing")));let a=t.get("throttle");return a&&(e=((e,t,n=!0,r=!1)=>z(e,t,n,r,!1))(e,V(a,300),!a.includes("noleading"),a.includes("trailing"))),e},B=(e,t)=>t.has("viewtransition")&&"startViewTransition"in document?(...t)=>{document.startViewTransition(()=>e(...t))}:e,F=e=>({type:"attribute",...e}),U=e=>({type:"action",...e}),W=e=>({type:"handler",...e}),J=(e,t,n)=>{!1===n||null==n?e.removeAttribute(t):e.setAttribute(t,!0===n?"":"object"==typeof n?JSON.stringify(n):String(n))},_=F({name:"attr",value:"required",mount({el:e,key:t,cased:n,evaluate:r,effect:a}){a(()=>{if(t)return J(e,n("kebab"),r());let a=r();for(let t in a)J(e,t,a[t])})}}),Z=(e,t,...n)=>({l:e,h:t,y:n}),K=F({name:"bind",mount({el:e,key:t,value:n,cased:r,mods:a,store:i,listen:l,effect:o}){let s,u=t?r():n.trim(),d=()=>i.get(u),c=e=>"number"==typeof d()?+e:e,f=a.get("prop")?.[0];if(f)s=Z(()=>e[f],t=>e[f]=t,"input","change");else if(e instanceof HTMLInputElement){let t=e.type;if("checkbox"===t){let t=e.hasAttribute("value")&&"on"!==e.value;s={l:()=>{let n=d();if(Array.isArray(n)){let t=new Set(n);return e.checked?t.add(e.value):t.delete(e.value),[...t]}return t?e.checked?e.value:"":e.checked},h:n=>{e.checked=Array.isArray(n)?n.includes(e.value):t?n===e.value:!!n},y:["input"]}}else if("radio"===t)e.name||(e.name=u),s=Z(()=>e.checked?c(e.value):d(),t=>e.checked=String(t)===e.value,"input");else{if("file"===t)return void l(e,"change",()=>(e=>Promise.all([...e.files??[]].map(e=>new Promise(t=>{let n=new FileReader;n.onloadend=()=>t({name:e.name,type:e.type,size:e.size,contents:String(n.result).split(",")[1]??""}),n.readAsDataURL(e)}))))(e).then(e=>i.set(u,e)));s=Z("number"===t||"range"===t?()=>""===e.value?"":+e.value:()=>e.value,t=>e.value=String(t??""),"input")}}else s=e instanceof HTMLSelectElement?{l:()=>e.multiple?[...e.selectedOptions].map(e=>c(e.value)):c(e.value),h:t=>{if(e.multiple)for(let n of e.options)n.selected=Array.isArray(t)&&t.map(String).includes(n.value);else e.value=String(t??"")},y:["change"]}:e instanceof HTMLTextAreaElement||"value"in e?Z(()=>e.value,t=>e.value=String(t??""),"input","change"):Z(()=>e.getAttribute("value"),t=>e.setAttribute("value",String(t??"")),"change");if(!i.has(u)){let e=s.l();void 0!==e&&""!==e&&i.set(u,e)}let m=()=>i.set(u,s.l());for(let t of a.get("event")??s.y)l(e,t,m);l(e,"sigmx-prop-change",m),o(()=>{let e=d();void 0!==e&&s.h(e)})}}),G=F({name:"class",value:"required",mount({el:e,key:t,cased:n,evaluate:r,effect:a}){let i=new Set;return a(()=>{let a=t?{[n("kebab")]:r()}:r();for(let t in a)for(let n of t.split(/\s+/).filter(Boolean))e.classList.toggle(n,!!a[t]),a[t]?i.add(n):i.delete(n)}),()=>e.classList.remove(...i)}}),Q=F({name:"computed",value:"required",mount({key:e,cased:t,evaluate:n,store:r,error:a}){if(e)return void r.define(t(),v(()=>n()));let i=n();for(let e in i){if("function"!=typeof i[e])throw a(`"${e}" must be a function`);r.define(e,v(i[e]))}}}),X=F({name:"custom-validity",key:"forbidden",value:"required",mount({el:e,evaluate:t,effect:n,error:r}){if(!("setCustomValidity"in e))throw r("only works on form fields");n(()=>e.setCustomValidity(String(t()??"")))}}),Y=F({name:"effect",key:"forbidden",value:"required",returns:!1,mount:e=>e.effect(()=>e.evaluate())}),ee=F({name:"indicator",mount({el:e,key:t,value:n,cased:r,store:a,listen:i}){let l=t?r():n.trim(),o=new Set;return a.set(l,!1),i(document,"sigmx-fetch",t=>{let{el:n,type:r,rid:i}=t.detail;if("started"!==r||n!==e&&!e.contains(n)){if("finished"!==r)return;o.delete(i)}else o.add(i);a.set(l,o.size>0)}),()=>a.set(l,!1)}}),te=F({name:"init",key:"forbidden",value:"required",returns:!1,mount({mods:e,evaluate:t}){D(B(()=>t(),e),e)()}}),ne=F({name:"json-signals",key:"forbidden",mount({el:e,value:t,mods:n,evaluate:r,effect:a,store:i}){let l=t?r():void 0;a(()=>{e.textContent=JSON.stringify(i.snapshot(l),null,n.has("terse")?0:2)})}}),re=F({name:"match-media",key:"required",value:"required",mount({cased:e,evaluate:t,store:n,listen:r}){let a=String(t()).trim();(!/^[(a-z]/.test(a)||!a.startsWith("(")&&a.includes(":")&&!/^(not|only|all|screen|print)\b/.test(a))&&(a=`(${a})`);let i=window.matchMedia(a),l=e(),o=()=>n.set(l,i.matches);o(),r(i,"change",o)}}),ae=F({name:"on",key:"required",value:"required",returns:!1,mount({el:e,mods:t,cased:n,evaluate:r,listen:a}){let i=n("kebab"),l=t.has("outside"),o=t.has("window")?window:t.has("document")||l||i.startsWith("sigmx-")?document:e,s=D(B(e=>r(e),t),t);a(o,i,n=>{l&&e.contains(n.target)||((t.has("prevent")||"submit"===i&&e instanceof HTMLFormElement)&&n.preventDefault(),t.has("stop")&&n.stopPropagation(),s(n))},{capture:t.has("capture"),passive:t.has("passive"),once:t.has("once")})}}),ie=F({name:"on-intersect",key:"forbidden",value:"required",returns:!1,mount({el:e,mods:t,evaluate:n}){let r=t.get("threshold")?.[0],a=t.has("full")?1:t.has("half")?.5:r?Math.min(100,Math.max(0,+r))/100:0,i=D(B(()=>n(),t),t),l=new IntersectionObserver(e=>{for(let n of e)n.isIntersecting!==t.has("exit")&&(i(),t.has("once")&&l.disconnect())},{threshold:a});return l.observe(e),()=>l.disconnect()}}),le=F({name:"on-interval",key:"forbidden",value:"required",returns:!1,mount({mods:e,evaluate:t}){let n=e.get("duration"),r=B(()=>t(),e);n?.includes("leading")&&r();let a=setInterval(r,V(n,1e3));return()=>clearInterval(a)}}),oe=F({name:"on-raf",key:"forbidden",value:"required",returns:!1,mount({mods:e,evaluate:t}){let n=D(()=>t(),e),r=requestAnimationFrame(function e(){n(),r=requestAnimationFrame(e)});return()=>cancelAnimationFrame(r)}}),se=F({name:"on-resize",key:"forbidden",value:"required",returns:!1,mount({el:e,mods:t,evaluate:n}){let r=D(()=>n(),t),a=new ResizeObserver(()=>r());return a.observe(e),()=>a.disconnect()}}),ue=F({name:"on-signal-patch",value:"required",returns:!1,args:["patch"],mount({key:e,cased:t,mods:n,evaluate:r,listen:a}){let i=e?t():"",l=!1,o=D(e=>{if(!l){l=!0;try{r(void 0,e)}finally{l=!1}}},n);a(document,"sigmx-signal-patch",e=>{(!i||((e,t)=>{let n=e;for(let e of t.split(".")){if(null==n||"object"!=typeof n||!(e in n))return!1;n=n[e]}return!0})(e.detail,i))&&o(e.detail)})}}),de=F({name:"persist",mount({key:e,value:t,mods:n,evaluate:r,store:a,effect:i}){let l=n.has("session")?sessionStorage:localStorage,o=e||"sigmx",s=t?r():void 0,u=l.getItem(o);u&&a.merge(JSON.parse(u)),i(()=>l.setItem(o,JSON.stringify(a.snapshot(s,{computed:!1}))))}}),ce=e=>{try{return JSON.parse(e)}catch{return e}},fe=F({name:"query-string",mount({key:e,value:t,mods:n,evaluate:r,cased:a,store:i,listen:l,effect:o}){let s=n.has("history"),u=e=>{e!==location.pathname+location.search+location.hash&&window.history[s?"pushState":"replaceState"](null,"",e)},d=e=>`${location.pathname}${e.size?`?${e}`:""}${location.hash}`,c=!1,f=e=>{c=!0;try{e()}finally{c=!1}};if(e){let n=a(),m=t?r():"",h=()=>{let t=new URLSearchParams(location.search).get(e);i.set(n,null===t?m:ce(t))};return(!i.has(n)||new URLSearchParams(location.search).has(e))&&h(),o(()=>{let t=i.get(n);if(c)return;let r=new URLSearchParams(location.search);void 0===t||((e,t)=>JSON.stringify(e)===JSON.stringify(t))(t,m)?r.delete(e):r.set(e,"string"==typeof t?t:JSON.stringify(t)),u(d(r))}),void(s&&l(window,"popstate",()=>f(h)))}let m=t?r():void 0,h=A(m),p=()=>{let e={};for(let[t,n]of new URLSearchParams(location.search))h(t)&&k(e,t,ce(n));i.merge(e)};p(),o(()=>{let e=i.snapshot(m,{computed:!1});if(c)return;let t=new URLSearchParams(location.search),r=(e,a)=>{for(let i in e){let l=a?`${a}.${i}`:i,o=e[i];o&&"object"==typeof o&&!Array.isArray(o)?r(o,l):!n.has("filter")||""!==o&&null!=o?t.set(l,"string"==typeof o?o:JSON.stringify(o)):t.delete(l)}};r(e,""),u(d(t))}),s&&l(window,"popstate",()=>f(p))}}),me=F({name:"ref",mount({el:e,key:t,value:n,cased:r,store:a}){let i=t?r():n.trim();return a.set(i,e),()=>a.remove(i)}}),he=F({name:"replace-url",key:"forbidden",value:"required",mount:({evaluate:e,effect:t})=>t(()=>history.replaceState(history.state,"",new URL(String(e()),location.href)))}),pe=(e,t,n)=>t.find(t=>e.has(t))??n,ge=F({name:"scroll-into-view",key:"forbidden",value:"forbidden",mount({el:e,mods:t}){e.scrollIntoView({behavior:pe(t,["smooth","instant","auto"],"smooth"),block:pe(t,["vstart","vcenter","vend","vnearest"],"vcenter").slice(1),inline:pe(t,["hstart","hcenter","hend","hnearest"],"hcenter").slice(1)}),t.has("focus")&&e.focus?.()}}),ve=F({name:"show",key:"forbidden",value:"required",mount({el:e,evaluate:t,effect:n}){let r="none"===e.style.display?"":e.style.display;return n(()=>{e.style.display=t()?r:"none"}),()=>{e.style.display=r}}}),ye=F({name:"signals",value:"required",mount({key:e,cased:t,evaluate:n,store:r,mods:a}){let i=n();r.merge(e?k({},t(),i):i,{ifMissing:a.has("ifmissing")})}}),be=F({name:"style",value:"required",mount({el:e,key:t,cased:n,evaluate:r,effect:a}){let i=new Map,l=(t,n)=>{i.has(t)||i.set(t,e.style.getPropertyValue(t)),n||0===n?e.style.setProperty(t,String(n)):e.style.setProperty(t,i.get(t))};return a(()=>{let e=t?{[n("kebab")]:r()}:r();for(let t of i.keys())t in e||l(t,"");for(let t in e)l(N(t),e[t])}),()=>{for(let[t,n]of i)e.style.setProperty(t,n)}}}),we=F({name:"text",key:"forbidden",value:"required",mount:({el:e,evaluate:t,effect:n})=>n(()=>{e.textContent=String(t()??"")})}),Se=F({name:"view-transition",key:"forbidden",value:"required",mount:({el:e,evaluate:t,effect:n})=>n(()=>e.style.setProperty("view-transition-name",String(t())))}),ke=U({name:"clipboard",call:(e,t,n=!1)=>navigator.clipboard.writeText(n?(new TextDecoder).decode(Uint8Array.from(atob(t),e=>e.charCodeAt(0))):t)}),xe=U({name:"fit",call:(e,t,n,r,a,i,l=!1,o=!1)=>{let s=(t-n)/(r-n);l&&(s=Math.min(1,Math.max(0,s)));let u=a+s*(i-a);return o?Math.round(u):u}}),Ae={number:(e,t,n)=>new Intl.NumberFormat(e,n).format(t),datetime:(e,t,n)=>new Intl.DateTimeFormat(e,n).format(t),pluralRules:(e,t,n)=>new Intl.PluralRules(e,n).select(t),relativeTime:(e,t,n)=>new Intl.RelativeTimeFormat(e,n).format(t[0],t[1]),list:(e,t,n)=>new Intl.ListFormat(e,n).format(t),displayNames:(e,t,n)=>new Intl.DisplayNames(e,n).of(t)??""},Ee=U({name:"intl",call:({error:e},t,n,r,a)=>{let i=Ae[t];if(!i)throw e(`unknown @intl type "${t}"`);return i(a,n,r)}}),Te=U({name:"peek",call:(e,t)=>b(t)}),$e=U({name:"setAll",call:({store:e},t,n)=>y(()=>b(()=>{for(let r of e.paths(n))e.set(r,t)}))}),Me=U({name:"toggleAll",call:({store:e},t)=>y(()=>b(()=>{for(let n of e.paths(t))e.set(n,!e.get(n))}))}),Le={linear:e=>e,"ease-in":e=>e*e,"ease-out":e=>1-(1-e)*(1-e),"ease-in-out":e=>e<.5?2*e*e:1-(-2*e+2)**2/2},qe=e=>{let t=/^\s*(-?\d*\.?\d+)([a-z%]*)\s*$/i.exec(e);return t?{n:+t[1],unit:t[2]}:void 0},Oe=F({name:"animate",key:"required",value:"required",mount({el:e,mods:t,cased:n,evaluate:r,effect:a,cleanup:i}){let l,o=n("kebab"),s=CSS.supports(o,"inherit"),u=V(t.get("duration"),300),d=Le[t.get("easing")?.[0]??"ease-out"]??Le["ease-out"],c=matchMedia("(prefers-reduced-motion: reduce)").matches,f=t=>s?e.style.setProperty(o,t):e.setAttribute(o,t),m=0,h=!0;a(()=>{let t=String(r());if(t===l)return;l=t,cancelAnimationFrame(m);let n=qe(s?e.style.getPropertyValue(o)||getComputedStyle(e).getPropertyValue(o):e.getAttribute(o)??""),a=qe(t);if(n&&a&&"px"===n.unit&&"%"===a.unit&&("width"===o||"height"===o)&&e.parentElement){let t="width"===o?e.parentElement.clientWidth:e.parentElement.clientHeight;t&&(n={n:n.n/t*100,unit:"%"})}if(h||c||!n||!a||n.unit!==a.unit)return h=!1,f(t);let i=n.n,p=a.n,g=performance.now(),v=e=>{let t=Math.min(1,(e-g)/u);f(`${i+(p-i)*d(t)}${a.unit}`),t<1&&(m=requestAnimationFrame(v))};m=requestAnimationFrame(v)}),i(()=>cancelAnimationFrame(m))}}),Pe=async(e,t)=>{let n,r,a=e.getReader(),i=new TextDecoder,l="",o="",s=[],u=()=>{s.length&&t({event:o||"message",data:s.join("\n"),id:n,retry:r}),o="",s=[]},d=e=>{if(!e)return u();if(":"===e[0])return;let t=e.indexOf(":"),a=t<0?e:e.slice(0,t),i=t<0?"":e.slice(t+1);" "===i[0]&&(i=i.slice(1)),"event"===a?o=i:"data"===a?s.push(i):"id"===a?n=i:"retry"===a&&/^\d+$/.test(i)&&(r=+i)};for(;;){let e,{value:t,done:n}=await a.read();if(n)break;for(l+=i.decode(t,{stream:!0});(e=l.search(/\r\n|\r|\n/))>=0;){let t=l.slice(0,e);l=l.slice(e+("\r"===l[e]&&"\n"===l[e+1]?2:1)),d(t)}}l&&d(l),u()},Ne=new Map,je=0,He=()=>new Promise(e=>document.addEventListener("visibilitychange",()=>!document.hidden&&e(),{once:!0})),Ce=(e,t,n)=>{for(let r of t){let t=e.headers.get(`sigmx-${r}`);t&&(n[j(r)]=t)}return n},Re=e=>{let t=document.createElement("script");t.text=e,document.head.append(t),t.remove()},Ie=(e,t)=>U({name:e,call:(e,n,r)=>(async(e,t,n,r={})=>{let{el:a,evt:i,store:l,runtime:o,error:s}=t;if(!n)throw s(`@${e.toLowerCase()} needs a URL`);let u=`${e} ${n}`,d=r.abort instanceof AbortController?r.abort:new AbortController;"none"!==r.abort&&(Ne.get(u)?.abort(),Ne.set(u,d)),t.cleanup(()=>d.abort());let c,f=++je,m=(t,r={})=>o.emit("fetch",{el:a,type:t,method:e,url:n,rid:f,...r}),h={attempts:5,interval:1e3,factor:2,max:3e4,onStatusError:!1,...r.retry},p=!(r.openWhenHidden??"GET"!==e),g="GET"!==e&&"DELETE"!==e,v=()=>{let t,o=new URL(n,location.href),u={Accept:"text/event-stream, text/html, application/json","Sigmx-Request":"true",...r.headers};if("json"===(r.contentType??"json")){let e=r.payload??b(()=>l.snapshot(r.filter??{exclude:/(^|\.)_/})),n=JSON.stringify(e);g?(t=n,u["Content-Type"]??="application/json"):o.searchParams.set("sigmx",n)}else{let e=r.selector?document.querySelector(r.selector):a.closest("form");if(!e)throw s("no form found",{selector:r.selector});if(!e.noValidate&&!e.checkValidity())return void e.reportValidity();let n=i instanceof SubmitEvent?i.submitter:a instanceof HTMLButtonElement?a:null,l=new FormData(e,n),d="multipart/form-data"===e.enctype;if(g)t=d?l:new URLSearchParams(l),d||(u["Content-Type"]="application/x-www-form-urlencoded");else for(let[e,t]of new URLSearchParams(l))o.searchParams.append(e,t)}return{url:o.toString(),init:{method:e,headers:u,body:t}}},y=(e,t)=>{let n=(e=>{let t={};for(let n of e.split("\n")){let e=n.indexOf(" "),r=e<0?n:n.slice(0,e),a=e<0?"":n.slice(e+1);t[r]=r in t?`${t[r]}\n${a}`:a}return t})(t);o.emit("server-event",{el:a,event:e,data:n}),o.handle(e,n)},w=0,S=h.interval,k=async()=>{if(w++>=h.attempts)throw new Error("retries exhausted");m("retrying",{attempt:w}),await((e,t)=>new Promise(n=>{let r=setTimeout(n,e);t.addEventListener("abort",()=>(clearTimeout(r),n()),{once:!0})}))(S,d.signal),S=Math.min(S*h.factor,h.max)};m("started");try{for(;!d.signal.aborted;){let e=v();if(!e)return;c&&(e.init.headers["Last-Event-ID"]=c);let t=new AbortController,n=()=>document.hidden&&t.abort();p&&document.addEventListener("visibilitychange",n);try{let n=await fetch(e.url,{...e.init,signal:AbortSignal.any([d.signal,t.signal])}),a=n.headers.get("content-type")??"";if(n.status>=400){if(m("error",{status:n.status}),!h.onStatusError)return;await k();continue}if(204===n.status||304===n.status||!n.body)return;if(a.includes("text/event-stream")){if(w=0,S=h.interval,await Pe(n.body,e=>{void 0!==e.id&&(c=e.id),e.retry&&(S=h.interval=e.retry),y(e.event,e.data)}),!r.reconnect)return;await k();continue}let i=await n.text();return void(a.includes("text/html")?o.handle("patch-elements",Ce(n,["selector","mode","use-view-transition"],{elements:i})):a.includes("application/json")?o.handle("patch-signals",Ce(n,["only-if-missing"],{signals:i})):a.includes("javascript")&&Re(i))}catch{if(d.signal.aborted)return;t.signal.aborted?await He():await k()}finally{document.removeEventListener("visibilitychange",n)}}}catch(t){throw m("error",{message:t?.message}),s(`${e} ${n}: ${t?.message??t}`)}finally{m("finished"),Ne.get(u)===d&&Ne.delete(u)}})(t,e,n,r)}),Ve=Ie("get","GET"),ze=Ie("post","POST"),De=Ie("put","PUT"),Be=Ie("patch","PATCH"),Fe=Ie("delete","DELETE"),Ue=new WeakSet,We=e=>!!e&&1===e.nodeType,Je=e=>{if(We(e))for(let t of e.matches("script")?[e]:[...e.querySelectorAll("script")]){if(Ue.has(t))continue;let e=document.createElement("script");for(let{name:n,value:r}of t.attributes)e.setAttribute(n,r);e.text=t.text,Ue.add(e),t.replaceWith(e)}},_e=e=>[...We(e)&&e.id?[e]:[],...e.querySelectorAll("[id]")],Ze=(e,t)=>We(e)&&_e(e).some(e=>t.keep.has(e.id)),Ke=(e,t)=>{Ze(e,t)?t.pantry.append(e):e.remove()},Ge=(e,t,n)=>{let r=e;try{r.moveBefore?r.moveBefore(t,n):e.insertBefore(t,n)}catch{e.insertBefore(t,n)}},Qe=(e,t,n)=>{for(let n=t;n;n=n.nextSibling)if(We(n)&&n.id===e)return n;return n.pantry.querySelector(`#${CSS.escape(e)}`)??document.getElementById(e)},Xe=(e,t,n)=>!(e.nodeType!==t.nodeType||e.nodeName!==t.nodeName||We(e)&&e.id&&e.id!==t.id||We(e)&&n.keep.has(e.id)&&e.id!==t.id),Ye=(e,t,n)=>{if(e.nodeType!==t.nodeType||e.nodeName!==t.nodeName){let n=document.importNode(t,!0);return e.replaceWith(n),void Je(n)}We(e)&&We(t)?e.hasAttribute(n.ignore)&&t.hasAttribute(n.ignore)||(((e,t,n)=>{let r=new Set((t.getAttribute(n.preserve)??e.getAttribute(n.preserve)??"").split(/\s+/).filter(Boolean)),a=!1,i=n=>!r.has(n)&&e.getAttribute(n)!==t.getAttribute(n);e instanceof HTMLInputElement&&t instanceof HTMLInputElement&&"file"!==e.type?(i("value")&&(e.value=t.getAttribute("value")??"",a=!0),i("checked")&&(e.checked=t.hasAttribute("checked"),a=!0)):e instanceof HTMLTextAreaElement&&t instanceof HTMLTextAreaElement?!r.has("value")&&e.defaultValue!==t.defaultValue&&(e.value=t.defaultValue,a=!0):e instanceof HTMLOptionElement&&t instanceof HTMLOptionElement&&i("selected")&&(e.selected=t.hasAttribute("selected"),a=!0);for(let{name:n,value:a}of t.attributes)!r.has(n)&&e.getAttribute(n)!==a&&e.setAttribute(n,a);for(let{name:n}of[...e.attributes])!r.has(n)&&!t.hasAttribute(n)&&e.removeAttribute(n);a&&(e instanceof HTMLOptionElement?e.closest("select"):e)?.dispatchEvent(new Event("sigmx-prop-change",{bubbles:!0}))})(e,t,n),e instanceof HTMLTemplateElement&&t instanceof HTMLTemplateElement?e.innerHTML=t.innerHTML:e.isEqualNode(t)||et(e,t,n)):e.nodeValue!==t.nodeValue&&(e.nodeValue=t.nodeValue)},et=(e,t,n)=>{let r=e.firstChild,a=e=>{for(;r&&r!==e;){let e=r;r=r.nextSibling,Ke(e,n)}return r===e};for(let i of[...t.childNodes]){if(We(i)&&i.id&&n.keep.has(i.id)){let t=Qe(i.id,r,n);if(t){a(t)&&r?r=t.nextSibling:Ge(e,t,r),Ye(t,i,n);continue}}let t=r;for(;t&&!Xe(t,i,n);)t=t.nextSibling;if(t)a(t),r=t.nextSibling,Ye(t,i,n);else if(We(i)&&Ze(i,n)){let t=document.createElementNS(i.namespaceURI??"http://www.w3.org/1999/xhtml",i.tagName);e.insertBefore(t,r),Ye(t,i,n)}else{let t=document.importNode(i,!0);e.insertBefore(t,r),Je(t)}}a(null)},tt=(e,t,n)=>{let r=new Set,a=new Map(_e(t).map(e=>[e.id,e.tagName]));for(let t of _e(e))a.get(t.id)===t.tagName&&r.add(t.id);return{keep:r,pantry:document.createDocumentFragment(),ignore:n.ignoreAttr??"data-ignore-morph",preserve:n.preserveAttr??"data-preserve-attr"}},nt=(e,t,n={})=>{let r=tt(e,t,n);Ye(e,t,r)},rt=(e,t,n={})=>{let r=tt(e,t,n);et(e,t,r)},at=["outer","inner","replace","prepend","append","before","after","remove"],it=e=>1===e.nodeType,lt=W({name:"patch-elements",handle(e,{elements:t="",selector:n="",mode:r="outer",useViewTransition:a}){if(!at.includes(r))throw new Error(`patch-elements: unknown mode "${r}"`);let i=()=>((e,t,n,r)=>{let a={ignoreAttr:e.attr("ignore-morph"),preserveAttr:e.attr("preserve-attr")},i=(e=>{if(/<\/(html|head|body)>/i.test(e))return(new DOMParser).parseFromString(e,"text/html");let t=document.createElement("template");return t.innerHTML=e,t.content})(t);if(i instanceof Document)return i.head.childNodes.length&&rt(document.head,i.head,a),void nt(document.body,i.body,a);let l=i;if("remove"===r){for(let e of document.querySelectorAll(n))e.remove();return}if(!n){if("outer"!==r&&"replace"!==r)throw new Error(`patch-elements mode "${r}" needs a selector`);for(let e of[...l.children]){let t=e.id&&document.getElementById(e.id);t?"outer"===r?nt(t,e,a):(t.replaceWith(e),Je(e)):console.warn("patch-elements: no element with id",e.id)}return}let o=[...document.querySelectorAll(n)];o.length||console.warn("patch-elements: no elements match",n),o.forEach((e,t)=>{let n=t===o.length-1?l:l.cloneNode(!0),i=[...n.childNodes];if("outer"===r&&1===i.length&&it(i[0]))nt(e,i[0],a);else if("inner"===r)rt(e,n,a);else{"outer"===r||"replace"===r?e.replaceWith(n):e[r](n);for(let e of i)Je(e)}})})(e,t,n,r);"true"===a&&"startViewTransition"in document?document.startViewTransition(i):i()}}),ot=W({name:"patch-signals",handle(e,{signals:t,onlyIfMissing:n}){if(!t)return;let r;try{r=JSON.parse(t)}catch{r=e.compiler([],`return (${t})`)()}e.store.merge(r,{ifMissing:"true"===n})}}),st=F({name:"boost",key:"forbidden",value:"forbidden",mount({el:e,mods:t,store:n,runtime:r,listen:a,error:i,cleanup:l}){let o={el:e,store:n,runtime:r,error:i,cleanup:l},s=(n,a="get",i,l)=>{let s=l?{contentType:"form",selector:void 0,openWhenHidden:!0}:{openWhenHidden:!0},u=r.call(a,{...o,el:l??e,evt:i},[n,s]);history[t.has("replace")?"replaceState":"pushState"](null,"",n),Promise.resolve(u).then(()=>scrollTo(0,0))};a(e,"click",e=>{let t=e.target.closest("a[href]");!t||e.defaultPrevented||e.button||e.metaKey||e.ctrlKey||e.shiftKey||t.target||t.hasAttribute("download")||t.origin!==location.origin||t.hash&&t.pathname===location.pathname||(e.preventDefault(),s(t.href,"get",e))}),a(e,"submit",e=>{let t=e.target;if(e.defaultPrevented||t.target)return;let n=new URL(t.action||location.href);n.origin===location.origin&&(e.preventDefault(),s(n.href,"post"===t.method.toLowerCase()?"post":"get",e,t))}),a(window,"popstate",()=>r.call("get",o,[location.href,{openWhenHidden:!0}]))}}),ut=F({name:"cloak",key:"forbidden",value:"forbidden",mount:({el:e,attr:t})=>e.removeAttribute(t)}),dt=F({name:"collapse",key:"forbidden",value:"required",mount({el:e,mods:t,evaluate:n,effect:r,cleanup:a}){let i,l,o=e.style,s=V(t.get("duration"),250),u=t.get("min")?.[0]??"0px",d=matchMedia("(prefers-reduced-motion: reduce)").matches,c=!0,f=e=>{o.transition="",o.overflow=e?"":"hidden",o.height=e?"":u};r(()=>{let t=!!n();if(t===l)return;if(l=t,clearTimeout(i),c||d)return c=!1,f(t);let r=`${e.getBoundingClientRect().height}px`;o.overflow="hidden",o.height=t?u:r,e.getBoundingClientRect(),o.transition=`height ${s}ms ease`,o.height=t?`${e.scrollHeight}px`:u,i=setTimeout(()=>f(t),s+20)}),a(()=>clearTimeout(i))}}),ct=F({name:"html",key:"forbidden",value:"required",mount:({el:e,evaluate:t,effect:n})=>n(()=>{e.innerHTML=String(t()??"")})}),ft={9:/\d/,a:/[a-zA-Z]/,"*":/[a-zA-Z0-9]/},mt=((e={})=>(e=>{let r=[].concat(e.prefix??"data-"),a=[].concat(e.eventPrefix??"sigmx-"),i=e.store??q(),l=e.compile??n,{expressions:s}=e,u=e.onError??((e,t)=>console.error(e,t)),d=Object.create(null),c=Object.create(null),f=Object.create(null),m={prefixes:r,attr:e=>r[0]+e,store:i,compiler:l,emit:(e,t)=>document.dispatchEvent(new CustomEvent(`sigmx-${e}`,{detail:t})),call:(e,t,n)=>{let r=c[e];if(!r)throw t.error(`unknown action @${e}`);return r.call(t,...n)},eventPrefixes:a,handle:(e,t)=>{let n=a.find(t=>e.startsWith(t)),r=f[n?e.slice(n.length):e];return r?.handle(m,t),!!r},attributes:d,actions:c,handlers:f},h=new Map,p=new Set,v=r.map(e=>`[${e}ignore__self]`).join(),y=r.map(e=>`[${e}ignore]`).join(),b=e=>e.matches(v)||!!e.closest(y),S=e=>{for(let t of r)if(e.startsWith(t))return e.slice(t.length)},k=e=>{for(let t of e){let e=h.get(t);if(e&&h.delete(t))for(let t of e.values())t()}},x=(e,t)=>{let n=h.get(e);n?.get(t)?.(),n?.delete(t)},A=(e,n,a,l,c)=>{let{plugin:f,key:p,mods:v}=(e=>{let t=I.get(e);if(!t){let[n,...r]=e.split("__"),a=n.indexOf(":"),i=new Map;for(let e of r){let[t,...n]=e.split(".");i.set(t,n)}t={plugin:a<0?n:n.slice(0,a),key:a<0?void 0:n.slice(a+1),mods:i},I.set(e,t)}return t})(a),y=d[f];if(!y||c&&!c.has(f))return;x(e,n);let b,S=[],k={plugin:f,el:e,attr:n},A=(e,t)=>((e,t)=>Object.assign(new Error(e),{info:t}))(`${r[0]}${f}: ${e}`,{...k,...t}),E=e=>u(e,k),T={el:e,plugin:f,attr:n,key:p,value:l,mods:v,cased:(e="camel")=>((e,t)=>e.split(".").map(H[t]).join("."))(p??"",v.get("case")?.[0]||e),evaluate:(t,...n)=>(b??=s(l,["el","evt",...y.args??[]],y.returns??!0),b(i,((e,t,n,r)=>{let a={el:e,evt:t,store:i,runtime:m,error:n,cleanup:r};return new Proxy({},{get:(e,t)=>(...e)=>m.call(t,a,e)})})(e,t,A,T.cleanup),e,t,...n)),effect:e=>S.push(((e,n)=>{let r=new g(e,n);return t?.o.add(r),r.b(),o||w(),()=>r.g()})(e,E)),listen:(e,t,n,r)=>{let a=e=>{try{n(e)}catch(e){E(e)}};e.addEventListener(t,a,r),S.push(()=>e.removeEventListener(t,a,r))},cleanup:e=>S.push(e),error:A,store:i,runtime:m},$=h.get(e);$||h.set(e,$=new Map),$.set(n,()=>{for(let e of S.splice(0))e()});try{if("required"===y.key&&!p)throw A("needs a key");if("forbidden"===y.key&&p)throw A("takes no key");if("required"===y.value&&!l)throw A("needs a value");if("forbidden"===y.value&&l)throw A("takes no value");let e=y.mount(T);"function"==typeof e&&S.push(e)}catch(e){E(e)}},E=(e,t)=>{for(let n of e)if(!b(n))for(let{name:e,value:r}of[...n.attributes]){let a=S(e);a&&A(n,e,a,r,t)}},T=new MutationObserver(e=>{for(let{type:t,target:n,attributeName:r,addedNodes:a,removedNodes:i}of e)if("childList"===t){for(let e of i)k(R(e));for(let e of a)E(R(e))}else if(r&&C(n)&&!b(n)){let e=S(r);if(!e)continue;let t=n.getAttribute(r);null===t?x(n,r):A(n,r,e,t)}}),$=!1,M=(e=document.documentElement,t=!0,n)=>{E(R(e),n),t&&!p.has(e)&&(T.observe(e,{subtree:!0,childList:!0,attributes:!0}),p.add(e)),!$&&p.has(document.documentElement)&&($=!0,m.emit("ready"))},L=(...e)=>{let t=new Set;for(let n of e)"attribute"===n.type?(d[n.name]=n,t.add(n.name)):"action"===n.type?c[n.name]=n:f[n.name]=n;if(t.size)for(let e of p)M(e,!1,t)},O=i.onPatch(e=>m.emit("signal-patch",e));L(...e.plugins??[]);let P={runtime:m,store:i,get $(){return i.$},apply:(e,t)=>M(e,t),use:L,destroy:()=>{T.disconnect(),O(),k([...h.keys()]),p.clear()}};return(e.autoStart??!0)&&("loading"===document.readyState?document.addEventListener("DOMContentLoaded",()=>P.apply(),{once:!0}):P.apply()),P})({...e,expressions:e.expressions??l(e.compile??n)}))({plugins:[_,K,G,Q,X,Y,ee,te,ne,re,ae,ie,le,oe,se,ue,de,fe,me,he,ge,ve,ye,be,we,Se,ke,xe,Ee,Te,$e,Me,Oe,Fe,Ve,Be,ze,De,lt,ot,st,ut,dt,ct,F({name:"mask",key:"forbidden",value:"required",mount({el:e,value:t,mods:n,evaluate:r,listen:a,effect:i}){let l=e,o=t,s=()=>{let e=((e,t)=>{let n="",r=0;for(let a of e){if(r>=t.length)break;let e=ft[a];if(e){for(;r<t.length&&!e.test(t[r]);)r++;if(r>=t.length)break;n+=t[r++]}else n+=a,t[r]===a&&r++}return n})(o,l.value);e!==l.value&&(l.value=e,l.dispatchEvent(new Event("input",{bubbles:!0})))};a(l,"input",s),n.has("dynamic")?i(()=>{o=String(r()??""),s()}):s()}}),F({name:"remove-me",key:"forbidden",mount({el:e,value:t,cleanup:n}){let r=setTimeout(()=>e.remove(),V([t],0));n(()=>clearTimeout(r))}}),F({name:"teleport",key:"forbidden",value:"required",mount({el:e,value:t,mods:n,error:r}){let a=document.querySelector(t);if(!a)throw r(`no element matches "${t}"`);if(e.parentElement===a)return;let i=n.has("prepend")?a.firstChild:null,l=a;l.moveBefore?l.moveBefore(e,i):a.insertBefore(e,i)}}),F({name:"transition",key:"forbidden",value:"required",mount({el:e,mods:t,evaluate:n,effect:r}){let a=e.style,i=matchMedia("(prefers-reduced-motion: reduce)").matches?0:V(t.get("duration"),200),l=t.has("scale")?+(t.get("scale")?.[0]??95)/100:1,o=t.get("origin")?.join(" ");o&&(a.transformOrigin=o);let s,u,d={opacity:0,transform:`scale(${l})`},c={opacity:1,transform:"scale(1)"},f="none"===a.display?"":a.display,m=!0;r(()=>{let t=!!n();if(t!==u){if(u=t,s?.cancel(),m)return m=!1,void(a.display=t?f:"none");t&&(a.display=f),s=e.animate(t?[d,c]:[c,d],{duration:i,easing:"ease-out",fill:"forwards"}),s.onfinish=()=>{s?.cancel(),t||(a.display="none")}}})}}),F({name:"trap",key:"forbidden",value:"required",mount({el:e,mods:t,evaluate:n,effect:r,listen:a,cleanup:i}){let l=null,o=!1,s=[],u=()=>[...e.querySelectorAll('a[href],button:not([disabled]),input:not([disabled]):not([type=hidden]),select:not([disabled]),textarea:not([disabled]),[tabindex]:not([tabindex="-1"]),[contenteditable]')].filter(e=>null!==e.offsetParent||e===document.activeElement),d=()=>{if(o){o=!1;for(let e of s.splice(0))e.removeAttribute("inert");l?.focus?.()}};a(document,"keydown",e=>{if(!o||"Tab"!==e.key)return;let t=u();if(!t.length)return e.preventDefault();let n=t.indexOf(document.activeElement),r=e.shiftKey?n<=0?t.length-1:n-1:n===t.length-1?0:n+1;(n<0||r!==n+(e.shiftKey?-1:1))&&(e.preventDefault(),t[r].focus())}),r(()=>{if(n()){if(o)return;if(o=!0,l=document.activeElement,t.has("inert"))for(let t=e;t&&t!==document.body;t=t.parentElement)for(let e of t.parentElement?.children??[])e!==t&&!e.hasAttribute("inert")&&(e.setAttribute("inert",""),s.push(e));queueMicrotask(()=>(u()[0]??e).focus?.())}else d()}),i(d)}}),U({name:"confirm",call:(e,t)=>window.confirm(t)}),U({name:"dispatch",call:({el:e},t,n)=>e.dispatchEvent(new CustomEvent(t,{detail:n,bubbles:!0,composed:!0}))}),U({name:"ws",call({el:e,runtime:t,cleanup:n},r,a={}){let i=new WebSocket(new URL(r,location.href.replace(/^http/,"ws")),a.protocols);return i.onmessage=n=>{for(let r of String(n.data).split(/\n\n+/)){let n="message",a={};for(let e of r.split("\n")){let t=e.indexOf(":");if(t<0)continue;let r=e.slice(0,t),i=e.slice(t+1).trimStart();if("event"===r)n=i;else if("data"===r){let e=i.indexOf(" "),t=e<0?i:i.slice(0,e),n=e<0?"":i.slice(e+1);a[t]=t in a?`${a[t]}\n${n}`:n}}t.emit("server-event",{el:e,event:n,data:a}),t.handle(n,a)}},n(()=>i.close()),{send:e=>i.send("string"==typeof e?e:JSON.stringify(e)),close:()=>i.close(),socket:i}}})]});globalThis.sigmx=mt;export{mt as sigmx};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const sigmx: import("./kernel/contracts.js").Sigmx;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/standalone.ts"],
|
|
4
|
+
"sourcesContent": ["// Script-tag entry: registers every plugin, starts on DOM ready, and exposes the instance as `window.sigmx`.\nimport { createSigmx } from './kernel/index.js'\nimport { all } from './presets/all.js'\n\nexport const sigmx = createSigmx({ plugins: all })\n;(globalThis as any).sigmx = sigmx\n"],
|
|
5
|
+
"mappings": "AACA,SAAS,mBAAmB;AAC5B,SAAS,WAAW;AAEb,MAAM,QAAQ,YAAY,EAAE,SAAS,IAAI,CAAC;AAC/C,WAAmB,QAAQ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare const isPlain: (v: unknown) => v is Record<string, any>;
|
|
2
|
+
/** Write `value` at a dotted path inside `out`, creating intermediate objects. */
|
|
3
|
+
export declare const expand: (out: Record<string, any>, path: string, value: any) => Record<string, any>;
|
|
4
|
+
export type Filter = {
|
|
5
|
+
include?: RegExp | string;
|
|
6
|
+
exclude?: RegExp | string;
|
|
7
|
+
} | ((path: string) => boolean);
|
|
8
|
+
/** Turn `{ include, exclude }` (regex or string) or a predicate into a path predicate. */
|
|
9
|
+
export declare const toPredicate: (f?: Filter) => ((path: string) => boolean);
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
const isPlain = (v) => {
|
|
2
|
+
if (v === null || typeof v !== "object") return false;
|
|
3
|
+
const proto = Object.getPrototypeOf(v);
|
|
4
|
+
return proto === Object.prototype || proto === null;
|
|
5
|
+
};
|
|
6
|
+
const expand = (out, path, value) => {
|
|
7
|
+
const keys = path.split(".");
|
|
8
|
+
const last = keys.pop();
|
|
9
|
+
let cur = out;
|
|
10
|
+
for (const k of keys) cur = isPlain(cur[k]) ? cur[k] : cur[k] = {};
|
|
11
|
+
cur[last] = value;
|
|
12
|
+
return out;
|
|
13
|
+
};
|
|
14
|
+
const re = (v, fallback) => v === void 0 ? fallback : typeof v === "string" ? new RegExp(v.replace(/^\/|\/$/g, "")) : v;
|
|
15
|
+
const toPredicate = (f) => {
|
|
16
|
+
if (typeof f === "function") return f;
|
|
17
|
+
const inc = re(f?.include, /(?:)/);
|
|
18
|
+
const exc = re(f?.exclude, /(?!)/);
|
|
19
|
+
return (p) => inc.test(p) && !exc.test(p);
|
|
20
|
+
};
|
|
21
|
+
export {
|
|
22
|
+
expand,
|
|
23
|
+
isPlain,
|
|
24
|
+
toPredicate
|
|
25
|
+
};
|
|
26
|
+
//# sourceMappingURL=object.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/utils/object.ts"],
|
|
4
|
+
"sourcesContent": ["export const isPlain = (v: unknown): v is Record<string, any> => {\n if (v === null || typeof v !== 'object') return false\n const proto = Object.getPrototypeOf(v)\n return proto === Object.prototype || proto === null\n}\n\n/** Write `value` at a dotted path inside `out`, creating intermediate objects. */\nexport const expand = (out: Record<string, any>, path: string, value: any): Record<string, any> => {\n const keys = path.split('.')\n const last = keys.pop()!\n let cur = out\n for (const k of keys) cur = isPlain(cur[k]) ? cur[k] : (cur[k] = {})\n cur[last] = value\n return out\n}\n\nexport type Filter = { include?: RegExp | string; exclude?: RegExp | string } | ((path: string) => boolean)\n\nconst re = (v: RegExp | string | undefined, fallback: RegExp): RegExp =>\n v === undefined ? fallback : typeof v === 'string' ? new RegExp(v.replace(/^\\/|\\/$/g, '')) : v\n\n/** Turn `{ include, exclude }` (regex or string) or a predicate into a path predicate. */\nexport const toPredicate = (f?: Filter): ((path: string) => boolean) => {\n if (typeof f === 'function') return f\n const inc = re(f?.include, /(?:)/)\n const exc = re(f?.exclude, /(?!)/)\n return (p) => inc.test(p) && !exc.test(p)\n}\n"],
|
|
5
|
+
"mappings": "AAAO,MAAM,UAAU,CAAC,MAAyC;AAC/D,MAAI,MAAM,QAAQ,OAAO,MAAM,SAAU,QAAO;AAChD,QAAM,QAAQ,OAAO,eAAe,CAAC;AACrC,SAAO,UAAU,OAAO,aAAa,UAAU;AACjD;AAGO,MAAM,SAAS,CAAC,KAA0B,MAAc,UAAoC;AACjG,QAAM,OAAO,KAAK,MAAM,GAAG;AAC3B,QAAM,OAAO,KAAK,IAAI;AACtB,MAAI,MAAM;AACV,aAAW,KAAK,KAAM,OAAM,QAAQ,IAAI,CAAC,CAAC,IAAI,IAAI,CAAC,IAAK,IAAI,CAAC,IAAI,CAAC;AAClE,MAAI,IAAI,IAAI;AACZ,SAAO;AACT;AAIA,MAAM,KAAK,CAAC,GAAgC,aAC1C,MAAM,SAAY,WAAW,OAAO,MAAM,WAAW,IAAI,OAAO,EAAE,QAAQ,YAAY,EAAE,CAAC,IAAI;AAGxF,MAAM,cAAc,CAAC,MAA4C;AACtE,MAAI,OAAO,MAAM,WAAY,QAAO;AACpC,QAAM,MAAM,GAAG,GAAG,SAAS,MAAM;AACjC,QAAM,MAAM,GAAG,GAAG,SAAS,MAAM;AACjC,SAAO,CAAC,MAAM,IAAI,KAAK,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC;AAC1C;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export type CaseStyle = 'camel' | 'kebab' | 'snake' | 'pascal';
|
|
2
|
+
export declare const kebab: (s: string) => string;
|
|
3
|
+
export declare const snake: (s: string) => string;
|
|
4
|
+
export declare const camel: (s: string) => string;
|
|
5
|
+
export declare const pascal: (s: string) => string;
|
|
6
|
+
/** Recase a dotted path segment by segment so `user.first-name` becomes `user.firstName`. */
|
|
7
|
+
export declare const recase: (path: string, style: CaseStyle) => string;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
const words = (s) => s.replace(/([a-z0-9])([A-Z])/g, "$1 $2").replace(/([A-Z]+)([A-Z][a-z])/g, "$1 $2").split(/[^A-Za-z0-9]+|\s+/).filter(Boolean).map((w) => w.toLowerCase());
|
|
2
|
+
const cap = (w) => w[0].toUpperCase() + w.slice(1);
|
|
3
|
+
const kebab = (s) => words(s).join("-");
|
|
4
|
+
const snake = (s) => words(s).join("_");
|
|
5
|
+
const camel = (s) => words(s).map((w, i) => i ? cap(w) : w).join("");
|
|
6
|
+
const pascal = (s) => words(s).map(cap).join("");
|
|
7
|
+
const recase = (path, style) => path.split(".").map((seg) => ({ camel, kebab, snake, pascal })[style](seg)).join(".");
|
|
8
|
+
export {
|
|
9
|
+
camel,
|
|
10
|
+
kebab,
|
|
11
|
+
pascal,
|
|
12
|
+
recase,
|
|
13
|
+
snake
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=text.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/utils/text.ts"],
|
|
4
|
+
"sourcesContent": ["export type CaseStyle = 'camel' | 'kebab' | 'snake' | 'pascal'\n\n/** Split an identifier in any common casing into lowercase words. */\nconst words = (s: string): string[] =>\n s\n .replace(/([a-z0-9])([A-Z])/g, '$1 $2')\n .replace(/([A-Z]+)([A-Z][a-z])/g, '$1 $2')\n .split(/[^A-Za-z0-9]+|\\s+/)\n .filter(Boolean)\n .map((w) => w.toLowerCase())\n\nconst cap = (w: string): string => w[0].toUpperCase() + w.slice(1)\n\nexport const kebab = (s: string): string => words(s).join('-')\nexport const snake = (s: string): string => words(s).join('_')\nexport const camel = (s: string): string => words(s).map((w, i) => (i ? cap(w) : w)).join('')\nexport const pascal = (s: string): string => words(s).map(cap).join('')\n\n/** Recase a dotted path segment by segment so `user.first-name` becomes `user.firstName`. */\nexport const recase = (path: string, style: CaseStyle): string =>\n path\n .split('.')\n .map((seg) => ({ camel, kebab, snake, pascal })[style](seg))\n .join('.')\n"],
|
|
5
|
+
"mappings": "AAGA,MAAM,QAAQ,CAAC,MACb,EACG,QAAQ,sBAAsB,OAAO,EACrC,QAAQ,yBAAyB,OAAO,EACxC,MAAM,mBAAmB,EACzB,OAAO,OAAO,EACd,IAAI,CAAC,MAAM,EAAE,YAAY,CAAC;AAE/B,MAAM,MAAM,CAAC,MAAsB,EAAE,CAAC,EAAE,YAAY,IAAI,EAAE,MAAM,CAAC;AAE1D,MAAM,QAAQ,CAAC,MAAsB,MAAM,CAAC,EAAE,KAAK,GAAG;AACtD,MAAM,QAAQ,CAAC,MAAsB,MAAM,CAAC,EAAE,KAAK,GAAG;AACtD,MAAM,QAAQ,CAAC,MAAsB,MAAM,CAAC,EAAE,IAAI,CAAC,GAAG,MAAO,IAAI,IAAI,CAAC,IAAI,CAAE,EAAE,KAAK,EAAE;AACrF,MAAM,SAAS,CAAC,MAAsB,MAAM,CAAC,EAAE,IAAI,GAAG,EAAE,KAAK,EAAE;AAG/D,MAAM,SAAS,CAAC,MAAc,UACnC,KACG,MAAM,GAAG,EACT,IAAI,CAAC,SAAS,EAAE,OAAO,OAAO,OAAO,OAAO,GAAG,KAAK,EAAE,GAAG,CAAC,EAC1D,KAAK,GAAG;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export type Mods = Map<string, string[]>;
|
|
2
|
+
type Fn = (...args: any[]) => void;
|
|
3
|
+
/** '300ms' → 300, '2s' → 2000, '150' → 150. */
|
|
4
|
+
export declare const toMs: (args: string[] | undefined, fallback?: number) => number;
|
|
5
|
+
export declare const delay: (fn: Fn, ms: number) => Fn;
|
|
6
|
+
/** Debounce: wait for a quiet period. `leading` fires on the first call, `trailing` on the last. */
|
|
7
|
+
export declare const debounce: (fn: Fn, ms: number, leading?: boolean, trailing?: boolean) => Fn;
|
|
8
|
+
/** Throttle: at most one call per window. `leading` fires immediately, `trailing` fires once at the end. */
|
|
9
|
+
export declare const throttle: (fn: Fn, ms: number, leading?: boolean, trailing?: boolean) => Fn;
|
|
10
|
+
/** Apply `__delay`, `__debounce` and `__throttle` modifiers to a callback. */
|
|
11
|
+
export declare const withTiming: (fn: Fn, mods: Mods) => Fn;
|
|
12
|
+
/** Wrap a callback in `document.startViewTransition` when `__viewtransition` is present and supported. */
|
|
13
|
+
export declare const withViewTransition: (fn: Fn, mods: Mods) => Fn;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
const toMs = (args, fallback = 0) => {
|
|
2
|
+
for (const a of args ?? []) {
|
|
3
|
+
const m = /^(\d+(?:\.\d+)?)(ms|s)?$/.exec(a);
|
|
4
|
+
if (m) return +m[1] * (m[2] === "s" ? 1e3 : 1);
|
|
5
|
+
}
|
|
6
|
+
return fallback;
|
|
7
|
+
};
|
|
8
|
+
const delay = (fn, ms) => (...args) => void setTimeout(fn, ms, ...args);
|
|
9
|
+
const debounce = (fn, ms, leading = false, trailing = true) => {
|
|
10
|
+
let timer;
|
|
11
|
+
let last;
|
|
12
|
+
return (...args) => {
|
|
13
|
+
if (timer) clearTimeout(timer);
|
|
14
|
+
else if (leading) fn(...args);
|
|
15
|
+
last = args;
|
|
16
|
+
timer = setTimeout(() => {
|
|
17
|
+
timer = void 0;
|
|
18
|
+
if (trailing && last) fn(...last);
|
|
19
|
+
last = void 0;
|
|
20
|
+
}, ms);
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
const throttle = (fn, ms, leading = true, trailing = false) => {
|
|
24
|
+
let timer;
|
|
25
|
+
let last;
|
|
26
|
+
return (...args) => {
|
|
27
|
+
if (timer) {
|
|
28
|
+
last = args;
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
if (leading) fn(...args);
|
|
32
|
+
else last = args;
|
|
33
|
+
timer = setTimeout(() => {
|
|
34
|
+
timer = void 0;
|
|
35
|
+
if (trailing && last) fn(...last);
|
|
36
|
+
last = void 0;
|
|
37
|
+
}, ms);
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
const withTiming = (fn, mods) => {
|
|
41
|
+
const d = mods.get("delay");
|
|
42
|
+
if (d) fn = delay(fn, toMs(d));
|
|
43
|
+
const db = mods.get("debounce");
|
|
44
|
+
if (db) fn = debounce(fn, toMs(db, 300), db.includes("leading"), !db.includes("notrailing"));
|
|
45
|
+
const th = mods.get("throttle");
|
|
46
|
+
if (th) fn = throttle(fn, toMs(th, 300), !th.includes("noleading"), th.includes("trailing"));
|
|
47
|
+
return fn;
|
|
48
|
+
};
|
|
49
|
+
const withViewTransition = (fn, mods) => mods.has("viewtransition") && "startViewTransition" in document ? (...args) => void document.startViewTransition(() => fn(...args)) : fn;
|
|
50
|
+
export {
|
|
51
|
+
debounce,
|
|
52
|
+
delay,
|
|
53
|
+
throttle,
|
|
54
|
+
toMs,
|
|
55
|
+
withTiming,
|
|
56
|
+
withViewTransition
|
|
57
|
+
};
|
|
58
|
+
//# sourceMappingURL=timing.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/utils/timing.ts"],
|
|
4
|
+
"sourcesContent": ["export type Mods = Map<string, string[]>\ntype Fn = (...args: any[]) => void\n\n/** '300ms' \u2192 300, '2s' \u2192 2000, '150' \u2192 150. */\nexport const toMs = (args: string[] | undefined, fallback = 0): number => {\n for (const a of args ?? []) {\n const m = /^(\\d+(?:\\.\\d+)?)(ms|s)?$/.exec(a)\n if (m) return +m[1] * (m[2] === 's' ? 1000 : 1)\n }\n return fallback\n}\n\nexport const delay = (fn: Fn, ms: number): Fn => (...args) => void setTimeout(fn, ms, ...args)\n\n/** Debounce: wait for a quiet period. `leading` fires on the first call, `trailing` on the last. */\nexport const debounce = (fn: Fn, ms: number, leading = false, trailing = true): Fn => {\n let timer: ReturnType<typeof setTimeout> | undefined\n let last: any[] | undefined\n return (...args) => {\n if (timer) clearTimeout(timer)\n else if (leading) fn(...args)\n last = args\n timer = setTimeout(() => {\n timer = undefined\n if (trailing && last) fn(...last)\n last = undefined\n }, ms)\n }\n}\n\n/** Throttle: at most one call per window. `leading` fires immediately, `trailing` fires once at the end. */\nexport const throttle = (fn: Fn, ms: number, leading = true, trailing = false): Fn => {\n let timer: ReturnType<typeof setTimeout> | undefined\n let last: any[] | undefined\n return (...args) => {\n if (timer) {\n last = args\n return\n }\n if (leading) fn(...args)\n else last = args\n timer = setTimeout(() => {\n timer = undefined\n if (trailing && last) fn(...last)\n last = undefined\n }, ms)\n }\n}\n\n/** Apply `__delay`, `__debounce` and `__throttle` modifiers to a callback. */\nexport const withTiming = (fn: Fn, mods: Mods): Fn => {\n const d = mods.get('delay')\n if (d) fn = delay(fn, toMs(d))\n const db = mods.get('debounce')\n if (db) fn = debounce(fn, toMs(db, 300), db.includes('leading'), !db.includes('notrailing'))\n const th = mods.get('throttle')\n if (th) fn = throttle(fn, toMs(th, 300), !th.includes('noleading'), th.includes('trailing'))\n return fn\n}\n\n/** Wrap a callback in `document.startViewTransition` when `__viewtransition` is present and supported. */\nexport const withViewTransition = (fn: Fn, mods: Mods): Fn =>\n mods.has('viewtransition') && 'startViewTransition' in document\n ? (...args) => void document.startViewTransition(() => fn(...args))\n : fn\n"],
|
|
5
|
+
"mappings": "AAIO,MAAM,OAAO,CAAC,MAA4B,WAAW,MAAc;AACxE,aAAW,KAAK,QAAQ,CAAC,GAAG;AAC1B,UAAM,IAAI,2BAA2B,KAAK,CAAC;AAC3C,QAAI,EAAG,QAAO,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC,MAAM,MAAM,MAAO;AAAA,EAC/C;AACA,SAAO;AACT;AAEO,MAAM,QAAQ,CAAC,IAAQ,OAAmB,IAAI,SAAS,KAAK,WAAW,IAAI,IAAI,GAAG,IAAI;AAGtF,MAAM,WAAW,CAAC,IAAQ,IAAY,UAAU,OAAO,WAAW,SAAa;AACpF,MAAI;AACJ,MAAI;AACJ,SAAO,IAAI,SAAS;AAClB,QAAI,MAAO,cAAa,KAAK;AAAA,aACpB,QAAS,IAAG,GAAG,IAAI;AAC5B,WAAO;AACP,YAAQ,WAAW,MAAM;AACvB,cAAQ;AACR,UAAI,YAAY,KAAM,IAAG,GAAG,IAAI;AAChC,aAAO;AAAA,IACT,GAAG,EAAE;AAAA,EACP;AACF;AAGO,MAAM,WAAW,CAAC,IAAQ,IAAY,UAAU,MAAM,WAAW,UAAc;AACpF,MAAI;AACJ,MAAI;AACJ,SAAO,IAAI,SAAS;AAClB,QAAI,OAAO;AACT,aAAO;AACP;AAAA,IACF;AACA,QAAI,QAAS,IAAG,GAAG,IAAI;AAAA,QAClB,QAAO;AACZ,YAAQ,WAAW,MAAM;AACvB,cAAQ;AACR,UAAI,YAAY,KAAM,IAAG,GAAG,IAAI;AAChC,aAAO;AAAA,IACT,GAAG,EAAE;AAAA,EACP;AACF;AAGO,MAAM,aAAa,CAAC,IAAQ,SAAmB;AACpD,QAAM,IAAI,KAAK,IAAI,OAAO;AAC1B,MAAI,EAAG,MAAK,MAAM,IAAI,KAAK,CAAC,CAAC;AAC7B,QAAM,KAAK,KAAK,IAAI,UAAU;AAC9B,MAAI,GAAI,MAAK,SAAS,IAAI,KAAK,IAAI,GAAG,GAAG,GAAG,SAAS,SAAS,GAAG,CAAC,GAAG,SAAS,YAAY,CAAC;AAC3F,QAAM,KAAK,KAAK,IAAI,UAAU;AAC9B,MAAI,GAAI,MAAK,SAAS,IAAI,KAAK,IAAI,GAAG,GAAG,CAAC,GAAG,SAAS,WAAW,GAAG,GAAG,SAAS,UAAU,CAAC;AAC3F,SAAO;AACT;AAGO,MAAM,qBAAqB,CAAC,IAAQ,SACzC,KAAK,IAAI,gBAAgB,KAAK,yBAAyB,WACnD,IAAI,SAAS,KAAK,SAAS,oBAAoB,MAAM,GAAG,GAAG,IAAI,CAAC,IAChE;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/dist/vite.d.ts
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { type Selection } from './kernel/scan.js';
|
|
2
|
+
export type ScanOptions = {
|
|
3
|
+
/** Project root; defaults to the current working directory. */
|
|
4
|
+
root?: string;
|
|
5
|
+
/** Directories to scan, relative to root. Default `['src']`. */
|
|
6
|
+
include?: string[];
|
|
7
|
+
extensions?: string[];
|
|
8
|
+
/** Attribute prefixes in use. Default `['data-']`. */
|
|
9
|
+
prefixes?: string[];
|
|
10
|
+
};
|
|
11
|
+
export type AutoOptions = ScanOptions & {
|
|
12
|
+
/** Export names that ship no matter what, e.g. `['signals', 'httpGet']`. */
|
|
13
|
+
always?: string[];
|
|
14
|
+
/** Custom plugins: export name → module path (absolute or root-relative), e.g. `{ upper: 'src/plugins/upper.ts' }`. */
|
|
15
|
+
custom?: Record<string, string>;
|
|
16
|
+
/** Print the selection at build time. Default true. */
|
|
17
|
+
log?: boolean;
|
|
18
|
+
};
|
|
19
|
+
export type PrecompileOptions = ScanOptions & {
|
|
20
|
+
/** Custom plugins whose expressions should be precompiled too. */
|
|
21
|
+
custom?: Record<string, string>;
|
|
22
|
+
};
|
|
23
|
+
export declare const DEFAULT_EXTENSIONS: string[];
|
|
24
|
+
export declare const walk: (dir: string, exts: string[], out?: string[]) => string[];
|
|
25
|
+
/** Scan once and pick plugins: what the Vite plugin and the CLI both do. */
|
|
26
|
+
export declare const scanProject: (o?: AutoOptions) => Selection & {
|
|
27
|
+
files: string[];
|
|
28
|
+
};
|
|
29
|
+
export declare const AUTO_ID = "virtual:sigmx-plugins";
|
|
30
|
+
export declare const EXPRESSIONS_ID = "virtual:sigmx-expressions";
|
|
31
|
+
/** Serves `virtual:sigmx-plugins`, exporting the `plugins` array your source actually uses. */
|
|
32
|
+
export declare const sigmxAuto: (o?: AutoOptions) => {
|
|
33
|
+
name: string;
|
|
34
|
+
resolveId: (id: string) => string | undefined;
|
|
35
|
+
load(this: any, id: string): string | undefined;
|
|
36
|
+
};
|
|
37
|
+
/** Serves `virtual:sigmx-expressions`, a table of every attribute expression compiled at build time. */
|
|
38
|
+
export declare const sigmxPrecompile: (o?: PrecompileOptions) => {
|
|
39
|
+
name: string;
|
|
40
|
+
resolveId: (id: string) => string | undefined;
|
|
41
|
+
load(this: any, id: string): string | undefined;
|
|
42
|
+
};
|