@hyperfixi/behaviors 2.5.1 → 2.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +100 -0
- package/dist/all.browser.global.js +43 -40
- package/dist/all.browser.global.js.map +1 -1
- package/dist/autodismiss.browser.global.js +2 -2
- package/dist/autodismiss.browser.global.js.map +1 -1
- package/dist/behaviors/autodismiss.cjs +5 -54
- package/dist/behaviors/autodismiss.cjs.map +1 -1
- package/dist/behaviors/autodismiss.d.cts +3 -2
- package/dist/behaviors/autodismiss.d.ts +3 -2
- package/dist/behaviors/autodismiss.js +1 -1
- package/dist/behaviors/clickoutside.cjs +6 -28
- package/dist/behaviors/clickoutside.cjs.map +1 -1
- package/dist/behaviors/clickoutside.d.cts +3 -2
- package/dist/behaviors/clickoutside.d.ts +3 -2
- package/dist/behaviors/clickoutside.js +2 -2
- package/dist/behaviors/clipboard.cjs +30 -86
- package/dist/behaviors/clipboard.cjs.map +1 -1
- package/dist/behaviors/clipboard.d.cts +3 -2
- package/dist/behaviors/clipboard.d.ts +3 -2
- package/dist/behaviors/clipboard.js +2 -2
- package/dist/behaviors/draggable.cjs +6 -41
- package/dist/behaviors/draggable.cjs.map +1 -1
- package/dist/behaviors/draggable.d.cts +3 -3
- package/dist/behaviors/draggable.d.ts +3 -3
- package/dist/behaviors/draggable.js +2 -2
- package/dist/behaviors/focustrap.cjs +5 -81
- package/dist/behaviors/focustrap.cjs.map +1 -1
- package/dist/behaviors/focustrap.d.cts +3 -2
- package/dist/behaviors/focustrap.d.ts +3 -2
- package/dist/behaviors/focustrap.js +1 -1
- package/dist/behaviors/removable.d.cts +1 -1
- package/dist/behaviors/removable.d.ts +1 -1
- package/dist/behaviors/resizable.cjs +9 -49
- package/dist/behaviors/resizable.cjs.map +1 -1
- package/dist/behaviors/resizable.d.cts +3 -2
- package/dist/behaviors/resizable.d.ts +3 -2
- package/dist/behaviors/resizable.js +2 -2
- package/dist/behaviors/scrollreveal.cjs +5 -32
- package/dist/behaviors/scrollreveal.cjs.map +1 -1
- package/dist/behaviors/scrollreveal.d.cts +3 -2
- package/dist/behaviors/scrollreveal.d.ts +3 -2
- package/dist/behaviors/scrollreveal.js +1 -1
- package/dist/behaviors/sortable.cjs +8 -43
- package/dist/behaviors/sortable.cjs.map +1 -1
- package/dist/behaviors/sortable.d.cts +3 -2
- package/dist/behaviors/sortable.d.ts +3 -2
- package/dist/behaviors/sortable.js +2 -2
- package/dist/behaviors/tabs.cjs +5 -120
- package/dist/behaviors/tabs.cjs.map +1 -1
- package/dist/behaviors/tabs.d.cts +3 -2
- package/dist/behaviors/tabs.d.ts +3 -2
- package/dist/behaviors/tabs.js +1 -1
- package/dist/behaviors/toggleable.cjs +5 -27
- package/dist/behaviors/toggleable.cjs.map +1 -1
- package/dist/behaviors/toggleable.d.cts +3 -3
- package/dist/behaviors/toggleable.d.ts +3 -3
- package/dist/behaviors/toggleable.js +1 -1
- package/dist/{chunk-SLOXO6IY.js → chunk-26IX7QU7.js} +2 -2
- package/dist/{chunk-SLOXO6IY.js.map → chunk-26IX7QU7.js.map} +1 -1
- package/dist/chunk-2HUF6RMI.js +40 -0
- package/dist/chunk-2HUF6RMI.js.map +1 -0
- package/dist/{chunk-ZBSWTV6I.js → chunk-5LFOFVZ3.js} +5 -5
- package/dist/chunk-5LFOFVZ3.js.map +1 -0
- package/dist/{chunk-BBIIOGMF.js → chunk-6EG2MNC7.js} +6 -6
- package/dist/chunk-7NGOA3T5.js +40 -0
- package/dist/chunk-7NGOA3T5.js.map +1 -0
- package/dist/{chunk-ZZ2WSAX3.js → chunk-7TPDLB7W.js} +7 -29
- package/dist/chunk-7TPDLB7W.js.map +1 -0
- package/dist/chunk-CR3J7VV6.js +40 -0
- package/dist/chunk-CR3J7VV6.js.map +1 -0
- package/dist/chunk-EDBG2F57.js +40 -0
- package/dist/chunk-EDBG2F57.js.map +1 -0
- package/dist/{chunk-G6WR2AYR.js → chunk-FBQ3X3UY.js} +2 -2
- package/dist/chunk-FBQ3X3UY.js.map +1 -0
- package/dist/chunk-HX663BJ4.js +40 -0
- package/dist/chunk-HX663BJ4.js.map +1 -0
- package/dist/chunk-KROW43CG.js +40 -0
- package/dist/chunk-KROW43CG.js.map +1 -0
- package/dist/chunk-ORBJ7MRW.js +40 -0
- package/dist/chunk-ORBJ7MRW.js.map +1 -0
- package/dist/{chunk-V2M4W3LO.js → chunk-PDMOOWFW.js} +4 -4
- package/dist/chunk-PDMOOWFW.js.map +1 -0
- package/dist/chunk-SLSCZV4A.js +40 -0
- package/dist/chunk-SLSCZV4A.js.map +1 -0
- package/dist/chunk-WKBRZGGL.js +40 -0
- package/dist/chunk-WKBRZGGL.js.map +1 -0
- package/dist/{chunk-WOTZO7K4.js → chunk-YXS27XM6.js} +26 -23
- package/dist/chunk-YXS27XM6.js.map +1 -0
- package/dist/clickoutside.browser.global.js +3 -3
- package/dist/clickoutside.browser.global.js.map +1 -1
- package/dist/clipboard.browser.global.js +27 -24
- package/dist/clipboard.browser.global.js.map +1 -1
- package/dist/core.browser.global.js +3 -3
- package/dist/core.browser.global.js.map +1 -1
- package/dist/draggable.browser.global.js +2 -2
- package/dist/draggable.browser.global.js.map +1 -1
- package/dist/focustrap.browser.global.js +2 -2
- package/dist/focustrap.browser.global.js.map +1 -1
- package/dist/index.cjs +120 -563
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +41 -3
- package/dist/index.d.ts +41 -3
- package/dist/index.js +44 -16
- package/dist/index.js.map +1 -1
- package/dist/loaders.cjs +86 -563
- package/dist/loaders.cjs.map +1 -1
- package/dist/loaders.js +6 -6
- package/dist/registry.d.cts +1 -1
- package/dist/registry.d.ts +1 -1
- package/dist/resizable.browser.global.js +5 -5
- package/dist/resizable.browser.global.js.map +1 -1
- package/dist/resolver.browser.global.js +34 -31
- package/dist/resolver.browser.global.js.map +1 -1
- package/dist/schemas/index.cjs +34 -31
- package/dist/schemas/index.cjs.map +1 -1
- package/dist/schemas/index.d.cts +2 -2
- package/dist/schemas/index.d.ts +2 -2
- package/dist/schemas/index.js +5 -5
- package/dist/scrollreveal.browser.global.js +2 -2
- package/dist/scrollreveal.browser.global.js.map +1 -1
- package/dist/sortable.browser.global.js +4 -4
- package/dist/sortable.browser.global.js.map +1 -1
- package/dist/tabs.browser.global.js +2 -2
- package/dist/tabs.browser.global.js.map +1 -1
- package/dist/toggleable.browser.global.js +2 -2
- package/dist/toggleable.browser.global.js.map +1 -1
- package/dist/{types-BY-jB5FV.d.ts → types-DCCtVQS5.d.cts} +1 -1
- package/dist/{types-BY-jB5FV.d.cts → types-DCCtVQS5.d.ts} +1 -1
- package/package.json +4 -4
- package/src/behaviors/autodismiss.test.ts +15 -9
- package/src/behaviors/autodismiss.ts +15 -70
- package/src/behaviors/clickoutside.test.ts +17 -9
- package/src/behaviors/clickoutside.ts +13 -39
- package/src/behaviors/clipboard.test.ts +16 -10
- package/src/behaviors/clipboard.ts +15 -93
- package/src/behaviors/curated-runtime.test.ts +158 -0
- package/src/behaviors/draggable.ts +15 -59
- package/src/behaviors/experimental-runtime.test.ts +136 -0
- package/src/behaviors/focustrap.test.ts +15 -9
- package/src/behaviors/focustrap.ts +17 -121
- package/src/behaviors/integration.test.ts +9 -64
- package/src/behaviors/optional-runtime.test.ts +251 -0
- package/src/behaviors/resizable.ts +14 -61
- package/src/behaviors/scrollreveal.test.ts +17 -9
- package/src/behaviors/scrollreveal.ts +17 -41
- package/src/behaviors/sortable.ts +15 -58
- package/src/behaviors/tabs.test.ts +16 -10
- package/src/behaviors/tabs.ts +18 -160
- package/src/behaviors/toggleable.ts +14 -41
- package/src/curation.test.ts +45 -0
- package/src/curation.ts +58 -0
- package/src/index.ts +14 -0
- package/src/registry.test.ts +6 -11
- package/src/schemas/clickoutside.schema.ts +1 -1
- package/src/schemas/clipboard.schema.ts +25 -22
- package/src/schemas/draggable.schema.ts +2 -1
- package/src/schemas/resizable.schema.ts +5 -4
- package/src/schemas/sortable.schema.ts +4 -3
- package/dist/chunk-7O7UOSBH.js +0 -99
- package/dist/chunk-7O7UOSBH.js.map +0 -1
- package/dist/chunk-EKKJVXDZ.js +0 -67
- package/dist/chunk-EKKJVXDZ.js.map +0 -1
- package/dist/chunk-F3CASJ7Q.js +0 -116
- package/dist/chunk-F3CASJ7Q.js.map +0 -1
- package/dist/chunk-G6WR2AYR.js.map +0 -1
- package/dist/chunk-GALKOMJ5.js +0 -62
- package/dist/chunk-GALKOMJ5.js.map +0 -1
- package/dist/chunk-IMDFEGIT.js +0 -75
- package/dist/chunk-IMDFEGIT.js.map +0 -1
- package/dist/chunk-IT6TYVMW.js +0 -80
- package/dist/chunk-IT6TYVMW.js.map +0 -1
- package/dist/chunk-LQJOQTBZ.js +0 -89
- package/dist/chunk-LQJOQTBZ.js.map +0 -1
- package/dist/chunk-S4QDV2MH.js +0 -75
- package/dist/chunk-S4QDV2MH.js.map +0 -1
- package/dist/chunk-V2M4W3LO.js.map +0 -1
- package/dist/chunk-WOTZO7K4.js.map +0 -1
- package/dist/chunk-WPOQIMCC.js +0 -155
- package/dist/chunk-WPOQIMCC.js.map +0 -1
- package/dist/chunk-ZBSWTV6I.js.map +0 -1
- package/dist/chunk-ZZ2WSAX3.js.map +0 -1
- /package/dist/{chunk-BBIIOGMF.js.map → chunk-6EG2MNC7.js.map} +0 -0
package/README.md
ADDED
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
# @hyperfixi/behaviors
|
|
2
|
+
|
|
3
|
+
Reusable hyperscript behaviors for HyperFixi / LokaScript. A behavior is installed
|
|
4
|
+
on any element with `_="install BehaviorName(params)"` and is defined in **pure
|
|
5
|
+
hyperscript** (its `source`), compiled on demand.
|
|
6
|
+
|
|
7
|
+
```html
|
|
8
|
+
<script src="hyperfixi.js"></script>
|
|
9
|
+
<script src="resolver.browser.global.js"></script>
|
|
10
|
+
<!-- install X just works — behaviors compile on first use -->
|
|
11
|
+
<button _="install Toggleable(cls: 'active')">Toggle</button>
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## The boundary rule — what a behavior _is_
|
|
15
|
+
|
|
16
|
+
> **A behavior is a named, parameterized, _reusable inline script_ — `on event →
|
|
17
|
+
DOM action`. It is not a component.** When something needs an observer, a focus
|
|
18
|
+
> model, or an async pointer loop, it has left the inline-scripting lane and belongs
|
|
19
|
+
> in a web component or a plain module instead.
|
|
20
|
+
|
|
21
|
+
This rule is why the set is small and tiered. Most "behaviors" people reach for are
|
|
22
|
+
really just short inline scripts — see [Recipes](#recipes--most-things-are-inline-scripts).
|
|
23
|
+
|
|
24
|
+
A single source of truth drives every consumer: the hyperscript `source` string in
|
|
25
|
+
each `src/schemas/*.schema.ts`. The npm `register*()` functions, the CDN
|
|
26
|
+
`resolver.browser.global.js` bundle, and `@hyperfixi/patterns-reference` all compile
|
|
27
|
+
that **same source** — one runtime path, identical in the browser and Node. **Every
|
|
28
|
+
behavior compiles from `source`; there is no imperative-JS installer.** (An earlier
|
|
29
|
+
imperative-installer experiment forked a second, diverging path; it has been removed
|
|
30
|
+
for all tiers — including the three experimental components, which now run their
|
|
31
|
+
pointer loops from `source` like everything else.)
|
|
32
|
+
|
|
33
|
+
**Writing or installing a behavior?** See **[AUTHORING.md](AUTHORING.md)** — the
|
|
34
|
+
canonical guide (boundary test, anatomy, schema, install/resolver, agent checklist).
|
|
35
|
+
|
|
36
|
+
## Tiers
|
|
37
|
+
|
|
38
|
+
Curation status (`curated` / `optional` / `experimental`) is exported
|
|
39
|
+
programmatically from [`src/curation.ts`](src/curation.ts). It is orthogonal to the
|
|
40
|
+
lazy-loading `tier` (core/common/optional).
|
|
41
|
+
|
|
42
|
+
### Curated (5) — reliable, runtime-tested, the supported story
|
|
43
|
+
|
|
44
|
+
| Behavior | What it does | Notes |
|
|
45
|
+
| -------------- | ----------------------------------------- | --------------------------------------- |
|
|
46
|
+
| `Toggleable` | Toggle a class on click | accordions, dropdowns, toggle buttons |
|
|
47
|
+
| `Removable` | Remove an element on click | dismiss notifications; optional confirm |
|
|
48
|
+
| `ClickOutside` | Fire `clickoutside` on an outside press | a primitive (dropdown/menu dismissal) |
|
|
49
|
+
| `Clipboard` | Copy text on click + `.copied` feedback | JS-backed convenience (Clipboard API) |
|
|
50
|
+
| `AutoDismiss` | Auto-remove after a delay, pause-on-hover | JS-backed convenience (timers) |
|
|
51
|
+
|
|
52
|
+
`Toggleable` / `Removable` / `ClickOutside` are genuinely hyperscript-native (real
|
|
53
|
+
`on event → action` bodies) and translate meaningfully across languages.
|
|
54
|
+
`Clipboard` / `AutoDismiss` ship in the curated set for their user value but are
|
|
55
|
+
honestly JS-backed (their `js()` core stays English — fidelity-neutral).
|
|
56
|
+
|
|
57
|
+
Each curated behavior has a real-runtime DOM test in
|
|
58
|
+
[`src/behaviors/curated-runtime.test.ts`](src/behaviors/curated-runtime.test.ts)
|
|
59
|
+
asserting both the effect and its lifecycle events — "parses ≠ works".
|
|
60
|
+
|
|
61
|
+
### Optional (3) — kept, documented as primitives / nice-to-haves
|
|
62
|
+
|
|
63
|
+
`FocusTrap` · `ScrollReveal` · `Tabs`. `FocusTrap` + `ClickOutside` are the
|
|
64
|
+
primitives a Modal composes from; `Tabs` is high-value but heavy (a future
|
|
65
|
+
web-component candidate). They carry their web-API logic (a focus model, an
|
|
66
|
+
`IntersectionObserver`, ARIA/keyboard wiring) in an `init`-block `js()` body, but
|
|
67
|
+
flow through the **same single compile path** as the curated set — no
|
|
68
|
+
imperative-installer fork. Each has a real-runtime DOM test in
|
|
69
|
+
[`src/behaviors/optional-runtime.test.ts`](src/behaviors/optional-runtime.test.ts).
|
|
70
|
+
|
|
71
|
+
### Experimental (3) — beyond the boundary
|
|
72
|
+
|
|
73
|
+
`Draggable` · `Sortable` · `Resizable` — stateful async components (`repeat until
|
|
74
|
+
event` + `wait for` pointer loops). Kept working, but explicitly **outside** the
|
|
75
|
+
curated/supported/marketed story. If you need robust drag/sort/resize, prefer a
|
|
76
|
+
dedicated library or web component.
|
|
77
|
+
|
|
78
|
+
## Recipes — most things are inline scripts
|
|
79
|
+
|
|
80
|
+
Before installing a behavior, check whether a short inline script does the job. The
|
|
81
|
+
upstream \_hyperscript cookbook (`www/patterns/`) is almost entirely inline patterns,
|
|
82
|
+
not `behavior` definitions. See [`examples/behaviors/recipes.html`](../../examples/behaviors/recipes.html)
|
|
83
|
+
for adapted recipes (toggle, fade-and-remove, character counter, …). Promote a
|
|
84
|
+
recipe to an installed behavior only when it is genuinely reusable and parameterized.
|
|
85
|
+
|
|
86
|
+
## API
|
|
87
|
+
|
|
88
|
+
```javascript
|
|
89
|
+
import { registerAll } from '@hyperfixi/behaviors';
|
|
90
|
+
await registerAll(); // registers every behavior with window.hyperfixi
|
|
91
|
+
|
|
92
|
+
import { registerToggleable } from '@hyperfixi/behaviors/toggleable';
|
|
93
|
+
await registerToggleable(); // tree-shakeable single behavior
|
|
94
|
+
|
|
95
|
+
import { CURATED_BEHAVIORS, curationStatusOf } from '@hyperfixi/behaviors';
|
|
96
|
+
curationStatusOf('Draggable'); // 'experimental'
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
See [`examples/behaviors/demo.html`](../../examples/behaviors/demo.html) for a live
|
|
100
|
+
demo grouped by tier.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var HyperFixiBehaviors=(()=>{var
|
|
1
|
+
"use strict";var HyperFixiBehaviors=(()=>{var G=Object.defineProperty;var Mt=Object.getOwnPropertyDescriptor;var It=Object.getOwnPropertyNames;var Ft=Object.prototype.hasOwnProperty;var i=(t,e)=>()=>(t&&(e=t(t=0)),e);var l=(t,e)=>{for(var r in e)G(t,r,{get:e[r],enumerable:!0})},Ot=(t,e,r,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let m of It(e))!Ft.call(t,m)&&m!==r&&G(t,m,{get:()=>e[m],enumerable:!(o=Mt(e,m))||o.enumerable});return t};var Dt=t=>Ot(G({},"__esModule",{value:!0}),t);var u,K=i(()=>{"use strict";u={name:"Draggable",category:"ui",tier:"core",version:"1.0.0",description:"Makes elements draggable with pointer events (EXPERIMENTAL \u2014 stateful async component, beyond the inline-scripting boundary; not part of the curated set)",parameters:[{name:"dragHandle",type:"selector",optional:!0,default:"me",description:"CSS selector for the drag handle element"}],events:[{name:"draggable:start",description:"Fired when drag begins"},{name:"draggable:move",description:"Fired during each movement"},{name:"draggable:end",description:"Fired when drag completes"}],requirements:["position: absolute or position: fixed on the element"],source:`
|
|
2
2
|
behavior Draggable(dragHandle)
|
|
3
3
|
init
|
|
4
4
|
if no dragHandle set dragHandle to me
|
|
@@ -21,7 +21,7 @@ behavior Draggable(dragHandle)
|
|
|
21
21
|
trigger draggable:end
|
|
22
22
|
end
|
|
23
23
|
end
|
|
24
|
-
`.trim()}});function
|
|
24
|
+
`.trim()}});function a(){if(typeof window>"u")return null;let t=window;return t.lokascript||t.hyperfixi||null}var c=i(()=>{"use strict"});var Ke={};l(Ke,{default:()=>ee,draggableMetadata:()=>Z,draggableSource:()=>Q,registerDraggable:()=>E});async function E(t){let e=t||a();if(!e)throw new Error("LokaScript not found. Make sure @hyperfixi/core is loaded before registering behaviors.");let r=e.compileSync(u.source,{traditional:!0});if(!r.ok)throw new Error(`Failed to compile Draggable behavior: ${JSON.stringify(r.errors)}`);let o=e.createContext?e.createContext():{locals:new Map,globals:new Map};await e.execute(r.ast,o)}var Q,Z,ee,_=i(()=>{"use strict";K();c();Q=u.source,Z=u;a()&&E().catch(console.error);ee={source:u.source,metadata:u,register:E}});var p,te=i(()=>{"use strict";p={name:"Removable",category:"data",tier:"common",version:"1.2.0",description:"Makes elements removable on click",parameters:[{name:"triggerEl",type:"selector",optional:!0,default:"me",description:"Element that triggers removal (e.g., a close button)"},{name:"confirmRemoval",type:"boolean",optional:!0,default:!1,description:"Show confirmation dialog before removal"},{name:"effect",type:"string",optional:!0,default:"none",enum:["fade","none"],description:'Transition effect: "fade" or "none"'}],events:[{name:"removable:before",description:"Fired before removal (cancelable)"},{name:"removable:removed",description:"Fired after removal"}],source:`
|
|
25
25
|
behavior Removable(triggerEl, confirmRemoval, effect)
|
|
26
26
|
init
|
|
27
27
|
if triggerEl is undefined
|
|
@@ -45,7 +45,7 @@ behavior Removable(triggerEl, confirmRemoval, effect)
|
|
|
45
45
|
remove me
|
|
46
46
|
end
|
|
47
47
|
end
|
|
48
|
-
`.trim()}});var
|
|
48
|
+
`.trim()}});var Qe={};l(Qe,{default:()=>ae,registerRemovable:()=>C,removableMetadata:()=>oe,removableSource:()=>re});async function C(t){let e=t||a();if(!e)throw new Error("LokaScript not found. Make sure @hyperfixi/core is loaded before registering behaviors.");let r=e.compileSync(p.source,{traditional:!0});if(!r.ok)throw new Error(`Failed to compile Removable behavior: ${JSON.stringify(r.errors)}`);let o=e.createContext?e.createContext():{locals:new Map,globals:new Map};await e.execute(r.ast,o)}var re,oe,ae,H=i(()=>{"use strict";te();c();re=p.source,oe=p;a()&&C().catch(console.error);ae={source:p.source,metadata:p,register:C}});var f,ie=i(()=>{"use strict";f={name:"Toggleable",category:"form",tier:"core",version:"1.0.0",description:"Toggles a CSS class on click",parameters:[{name:"cls",type:"string",optional:!0,default:"active",description:"CSS class to toggle"},{name:"target",type:"selector",optional:!0,default:"me",description:"Element to toggle the class on"}],events:[{name:"toggleable:on",description:"Fired when class is added"},{name:"toggleable:off",description:"Fired when class is removed"}],source:`
|
|
49
49
|
behavior Toggleable(cls, target)
|
|
50
50
|
init
|
|
51
51
|
if cls is undefined
|
|
@@ -62,7 +62,7 @@ behavior Toggleable(cls, target)
|
|
|
62
62
|
target.dispatchEvent(new CustomEvent(eventName, { bubbles: true }));
|
|
63
63
|
end
|
|
64
64
|
end
|
|
65
|
-
end`.trim()}});var
|
|
65
|
+
end`.trim()}});var Ze={};l(Ze,{default:()=>ce,registerToggleable:()=>A,toggleableMetadata:()=>ne,toggleableSource:()=>se});async function A(t){let e=t||a();if(!e)throw new Error("LokaScript not found. Make sure @hyperfixi/core is loaded before registering behaviors.");let r=e.compileSync(f.source,{traditional:!0});if(!r.ok)throw new Error(`Failed to compile Toggleable behavior: ${JSON.stringify(r.errors)}`);let o=e.createContext?e.createContext():{locals:new Map,globals:new Map};await e.execute(r.ast,o)}var se,ne,ce,z=i(()=>{"use strict";ie();c();se=f.source,ne=f;a()&&A().catch(console.error);ce={source:f.source,metadata:f,register:A}});var h,le=i(()=>{"use strict";h={name:"Sortable",category:"ui",tier:"common",version:"1.0.0",description:"Makes child elements reorderable via drag-and-drop (EXPERIMENTAL \u2014 stateful async component, beyond the inline-scripting boundary; not part of the curated set)",parameters:[{name:"dragClass",type:"string",optional:!0,default:"sorting",description:"CSS class added to item during drag"}],events:[{name:"sortable:start",description:"Fired when drag begins"},{name:"sortable:move",description:"Fired during drag \u2014 handle this event to reorder DOM elements"},{name:"sortable:end",description:"Fired when drag completes"}],requirements:["Users must handle DOM reordering in sortable:move event handlers"],source:`
|
|
66
66
|
behavior Sortable(dragClass)
|
|
67
67
|
init
|
|
68
68
|
if dragClass is undefined
|
|
@@ -70,7 +70,7 @@ behavior Sortable(dragClass)
|
|
|
70
70
|
end
|
|
71
71
|
end
|
|
72
72
|
on pointerdown(clientY) from me
|
|
73
|
-
set item to the closest
|
|
73
|
+
set item to the target.closest("li")
|
|
74
74
|
if item is null
|
|
75
75
|
exit
|
|
76
76
|
end
|
|
@@ -78,13 +78,13 @@ behavior Sortable(dragClass)
|
|
|
78
78
|
add .{dragClass} to item
|
|
79
79
|
trigger sortable:start on me
|
|
80
80
|
repeat until event pointerup from document
|
|
81
|
-
wait for pointermove(clientY) from document
|
|
81
|
+
wait for pointermove(clientY) or pointerup(clientY) from document
|
|
82
82
|
trigger sortable:move on me
|
|
83
83
|
end
|
|
84
84
|
remove .{dragClass} from item
|
|
85
85
|
trigger sortable:end on me
|
|
86
86
|
end
|
|
87
|
-
end`.trim()}});var
|
|
87
|
+
end`.trim()}});var et={};l(et,{default:()=>ue,registerSortable:()=>B,sortableMetadata:()=>me,sortableSource:()=>de});async function B(t){let e=t||a();if(!e)throw new Error("LokaScript not found. Make sure @hyperfixi/core is loaded before registering behaviors.");let r=e.compileSync(h.source,{traditional:!0});if(!r.ok)throw new Error(`Failed to compile Sortable behavior: ${JSON.stringify(r.errors)}`);let o=e.createContext?e.createContext():{locals:new Map,globals:new Map};await e.execute(r.ast,o)}var de,me,ue,N=i(()=>{"use strict";le();c();de=h.source,me=h;a()&&B().catch(console.error);ue={source:h.source,metadata:h,register:B}});var v,pe=i(()=>{"use strict";v={name:"Resizable",category:"ui",tier:"optional",version:"1.0.0",description:"Makes elements resizable by dragging (EXPERIMENTAL \u2014 stateful async component, beyond the inline-scripting boundary; not part of the curated set)",parameters:[{name:"minWidth",type:"number",optional:!0,default:50,description:"Minimum width in pixels"},{name:"minHeight",type:"number",optional:!0,default:50,description:"Minimum height in pixels"},{name:"maxWidth",type:"number",optional:!0,default:9999,description:"Maximum width in pixels"},{name:"maxHeight",type:"number",optional:!0,default:9999,description:"Maximum height in pixels"}],events:[{name:"resizable:start",description:"Fired when resize begins"},{name:"resizable:resize",description:"Fired during resize"},{name:"resizable:end",description:"Fired when resize completes"}],source:`
|
|
88
88
|
behavior Resizable(minWidth, minHeight, maxWidth, maxHeight)
|
|
89
89
|
on pointerdown(clientX, clientY) from me
|
|
90
90
|
halt the event
|
|
@@ -96,21 +96,21 @@ behavior Resizable(minWidth, minHeight, maxWidth, maxHeight)
|
|
|
96
96
|
set startX to clientX
|
|
97
97
|
set startY to clientY
|
|
98
98
|
repeat until event pointerup from document
|
|
99
|
-
wait for pointermove(clientX, clientY) from document
|
|
99
|
+
wait for pointermove(clientX, clientY) or pointerup(clientX, clientY) from document
|
|
100
100
|
set newWidth to startWidth + clientX - startX
|
|
101
101
|
set newHeight to startHeight + clientY - startY
|
|
102
102
|
if newWidth < minWidth then set newWidth to minWidth end
|
|
103
103
|
if newWidth > maxWidth then set newWidth to maxWidth end
|
|
104
104
|
if newHeight < minHeight then set newHeight to minHeight end
|
|
105
105
|
if newHeight > maxHeight then set newHeight to maxHeight end
|
|
106
|
-
set my
|
|
107
|
-
set my
|
|
106
|
+
set my *width to newWidth + "px"
|
|
107
|
+
set my *height to newHeight + "px"
|
|
108
108
|
trigger resizable:resize
|
|
109
109
|
end
|
|
110
110
|
trigger resizable:end
|
|
111
111
|
end
|
|
112
112
|
end
|
|
113
|
-
`.trim()}});var
|
|
113
|
+
`.trim()}});var tt={};l(tt,{default:()=>ve,registerResizable:()=>R,resizableMetadata:()=>he,resizableSource:()=>fe});async function R(t){let e=t||a();if(!e)throw new Error("LokaScript not found. Make sure @hyperfixi/core is loaded before registering behaviors.");let r=e.compileSync(v.source,{traditional:!0});if(!r.ok)throw new Error(`Failed to compile Resizable behavior: ${JSON.stringify(r.errors)}`);let o=e.createContext?e.createContext():{locals:new Map,globals:new Map};await e.execute(r.ast,o)}var fe,he,ve,W=i(()=>{"use strict";pe();c();fe=v.source,he=v;a()&&R().catch(console.error);ve={source:v.source,metadata:v,register:R}});var b,be=i(()=>{"use strict";b={name:"Clipboard",category:"ui",tier:"core",version:"1.0.0",description:"Copies text to clipboard on click with visual feedback",parameters:[{name:"text",type:"string",optional:!0,description:"Literal text to copy (takes priority over source)"},{name:"source",type:"selector",optional:!0,default:"me",description:"Element whose textContent or value is copied"},{name:"feedback",type:"selector",optional:!0,description:"Element to show .copied feedback on (defaults to the installed element)"},{name:"feedbackDuration",type:"number",optional:!0,default:2e3,description:"Duration in ms to show .copied class feedback"}],events:[{name:"clipboard:copied",description:"Fired after text is copied successfully"},{name:"clipboard:error",description:"Fired when clipboard write fails"}],requirements:["navigator.clipboard.writeText() requires HTTPS or localhost",'Falls back to document.execCommand("copy") for older browsers'],source:`
|
|
114
114
|
behavior Clipboard(text, source, feedback, feedbackDuration)
|
|
115
115
|
init
|
|
116
116
|
if feedbackDuration is undefined
|
|
@@ -127,32 +127,35 @@ behavior Clipboard(text, source, feedback, feedbackDuration)
|
|
|
127
127
|
set copyText to source's textContent
|
|
128
128
|
end
|
|
129
129
|
js(me, copyText, feedback, feedbackDuration)
|
|
130
|
-
async
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
130
|
+
// Wrapped in an async IIFE: hyperscript's js() block has no top-level await.
|
|
131
|
+
(async function() {
|
|
132
|
+
async function copyToClipboard(t) {
|
|
133
|
+
if (navigator.clipboard && navigator.clipboard.writeText) {
|
|
134
|
+
await navigator.clipboard.writeText(t);
|
|
135
|
+
return;
|
|
136
|
+
}
|
|
137
|
+
var ta = document.createElement('textarea');
|
|
138
|
+
ta.value = t;
|
|
139
|
+
ta.style.position = 'fixed';
|
|
140
|
+
ta.style.opacity = '0';
|
|
141
|
+
document.body.appendChild(ta);
|
|
142
|
+
ta.select();
|
|
143
|
+
try { document.execCommand('copy'); } finally { document.body.removeChild(ta); }
|
|
134
144
|
}
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
if (!feedbackEl) feedbackEl = me;
|
|
147
|
-
feedbackEl.classList.add('copied');
|
|
148
|
-
me.dispatchEvent(new CustomEvent('clipboard:copied', { bubbles: true, detail: { text: copyText } }));
|
|
149
|
-
setTimeout(function() { feedbackEl.classList.remove('copied'); }, feedbackDuration);
|
|
150
|
-
} catch(err) {
|
|
151
|
-
me.dispatchEvent(new CustomEvent('clipboard:error', { bubbles: true, detail: { error: err } }));
|
|
152
|
-
}
|
|
145
|
+
try {
|
|
146
|
+
await copyToClipboard(copyText);
|
|
147
|
+
var feedbackEl = feedback ? (typeof feedback === 'string' ? document.querySelector(feedback) : feedback) : me;
|
|
148
|
+
if (!feedbackEl) feedbackEl = me;
|
|
149
|
+
feedbackEl.classList.add('copied');
|
|
150
|
+
me.dispatchEvent(new CustomEvent('clipboard:copied', { bubbles: true, detail: { text: copyText } }));
|
|
151
|
+
setTimeout(function() { feedbackEl.classList.remove('copied'); }, feedbackDuration);
|
|
152
|
+
} catch(err) {
|
|
153
|
+
me.dispatchEvent(new CustomEvent('clipboard:error', { bubbles: true, detail: { error: err } }));
|
|
154
|
+
}
|
|
155
|
+
})();
|
|
153
156
|
end
|
|
154
157
|
end
|
|
155
|
-
end`.trim()}});var
|
|
158
|
+
end`.trim()}});var rt={};l(rt,{clipboardMetadata:()=>ye,clipboardSource:()=>ge,default:()=>xe,registerClipboard:()=>T});async function T(t){let e=t||a();if(!e)throw new Error("LokaScript not found. Make sure @hyperfixi/core is loaded before registering behaviors.");let r=e.compileSync(b.source,{traditional:!0});if(!r.ok)throw new Error(`Failed to compile Clipboard behavior: ${JSON.stringify(r.errors)}`);let o=e.createContext?e.createContext():{locals:new Map,globals:new Map};await e.execute(r.ast,o)}var ge,ye,xe,$=i(()=>{"use strict";be();c();ge=b.source,ye=b;a()&&T().catch(console.error);xe={source:b.source,metadata:b,register:T}});var g,Se=i(()=>{"use strict";g={name:"AutoDismiss",category:"ui",tier:"core",version:"1.0.0",description:"Auto-removes elements after a delay with optional pause-on-hover",parameters:[{name:"delay",type:"number",optional:!0,default:5e3,description:"Time in ms before the element is removed"},{name:"pauseOnHover",type:"boolean",optional:!0,default:!0,description:"Pause the countdown when the mouse hovers over the element"},{name:"effect",type:"string",optional:!0,default:"none",enum:["fade","none"],description:'Transition effect before removal: "fade" or "none"'}],events:[{name:"autodismiss:start",description:"Fired when the countdown timer starts"},{name:"autodismiss:dismissed",description:"Fired before removal (cancelable via preventDefault)"},{name:"autodismiss:paused",description:"Fired when the timer is paused on hover"},{name:"autodismiss:resumed",description:"Fired when the timer resumes on mouseleave"}],source:`
|
|
156
159
|
behavior AutoDismiss(delay, pauseOnHover, effect)
|
|
157
160
|
init
|
|
158
161
|
if delay is undefined
|
|
@@ -205,7 +208,7 @@ behavior AutoDismiss(delay, pauseOnHover, effect)
|
|
|
205
208
|
}
|
|
206
209
|
end
|
|
207
210
|
end
|
|
208
|
-
end`.trim()}});var
|
|
211
|
+
end`.trim()}});var ot={};l(ot,{autoDismissMetadata:()=>ke,autoDismissSource:()=>we,default:()=>Ee,registerAutoDismiss:()=>L});async function L(t){let e=t||a();if(!e)throw new Error("LokaScript not found. Make sure @hyperfixi/core is loaded before registering behaviors.");let r=e.compileSync(g.source,{traditional:!0});if(!r.ok)throw new Error(`Failed to compile AutoDismiss behavior: ${JSON.stringify(r.errors)}`);let o=e.createContext?e.createContext():{locals:new Map,globals:new Map};await e.execute(r.ast,o)}var we,ke,Ee,Y=i(()=>{"use strict";Se();c();we=g.source,ke=g;a()&&L().catch(console.error);Ee={source:g.source,metadata:g,register:L}});var y,Ce=i(()=>{"use strict";y={name:"ClickOutside",category:"ui",tier:"core",version:"1.0.0",description:"Fires an event when the user clicks outside the element",parameters:[{name:"active",type:"boolean",optional:!0,default:!0,description:"Whether the listener is active (can be toggled programmatically)"}],events:[{name:"clickoutside",description:"Fired when a pointer press occurs outside the element"},{name:"clickoutside:activate",description:"Listen for this event to programmatically activate detection"},{name:"clickoutside:deactivate",description:"Listen for this event to programmatically deactivate detection"}],requirements:["Uses pointerdown instead of click to avoid timing issues with removed elements"],source:`
|
|
209
212
|
behavior ClickOutside(active)
|
|
210
213
|
init
|
|
211
214
|
if active is undefined
|
|
@@ -213,7 +216,7 @@ behavior ClickOutside(active)
|
|
|
213
216
|
end
|
|
214
217
|
end
|
|
215
218
|
on pointerdown from document
|
|
216
|
-
js(me, active)
|
|
219
|
+
js(me, active, event)
|
|
217
220
|
if (!me.isConnected) return;
|
|
218
221
|
if (active && !me.contains(event.target)) {
|
|
219
222
|
me.dispatchEvent(new CustomEvent('clickoutside', { bubbles: true }));
|
|
@@ -226,7 +229,7 @@ behavior ClickOutside(active)
|
|
|
226
229
|
on clickoutside:deactivate
|
|
227
230
|
set active to false
|
|
228
231
|
end
|
|
229
|
-
end`.trim()}});var
|
|
232
|
+
end`.trim()}});var at={};l(at,{clickOutsideMetadata:()=>Be,clickOutsideSource:()=>Ae,default:()=>Re,registerClickOutside:()=>M});async function M(t){let e=t||a();if(!e)throw new Error("LokaScript not found. Make sure @hyperfixi/core is loaded before registering behaviors.");let r=e.compileSync(y.source,{traditional:!0});if(!r.ok)throw new Error(`Failed to compile ClickOutside behavior: ${JSON.stringify(r.errors)}`);let o=e.createContext?e.createContext():{locals:new Map,globals:new Map};await e.execute(r.ast,o)}var Ae,Be,Re,j=i(()=>{"use strict";Ce();c();Ae=y.source,Be=y;a()&&M().catch(console.error);Re={source:y.source,metadata:y,register:M}});var x,Te=i(()=>{"use strict";x={name:"FocusTrap",category:"ui",tier:"core",version:"1.0.0",description:"Confines Tab navigation inside an element with ARIA support",parameters:[{name:"active",type:"boolean",optional:!0,default:!0,description:"Whether the trap is active on install"},{name:"initialFocus",type:"selector",optional:!0,description:"Element to focus when the trap activates"},{name:"returnFocus",type:"boolean",optional:!0,default:!0,description:"Restore focus to the previously focused element on deactivation"}],events:[{name:"focustrap:activated",description:"Fired when the trap is activated"},{name:"focustrap:deactivated",description:"Fired when the trap is deactivated"}],requirements:['Sets aria-modal="true" on the element when active',"Listens for focustrap:activate and focustrap:deactivate custom events for programmatic control"],source:`
|
|
230
233
|
behavior FocusTrap(active, initialFocus, returnFocus)
|
|
231
234
|
init
|
|
232
235
|
if active is undefined
|
|
@@ -274,7 +277,7 @@ behavior FocusTrap(active, initialFocus, returnFocus)
|
|
|
274
277
|
if (active) activate();
|
|
275
278
|
end
|
|
276
279
|
end
|
|
277
|
-
end`.trim()}});var
|
|
280
|
+
end`.trim()}});var it={};l(it,{default:()=>Ie,focusTrapMetadata:()=>Me,focusTrapSource:()=>Le,registerFocusTrap:()=>I});async function I(t){let e=t||a();if(!e)throw new Error("LokaScript not found. Make sure @hyperfixi/core is loaded before registering behaviors.");let r=e.compileSync(x.source,{traditional:!0});if(!r.ok)throw new Error(`Failed to compile FocusTrap behavior: ${JSON.stringify(r.errors)}`);let o=e.createContext?e.createContext():{locals:new Map,globals:new Map};await e.execute(r.ast,o)}var Le,Me,Ie,X=i(()=>{"use strict";Te();c();Le=x.source,Me=x;a()&&I().catch(console.error);Ie={source:x.source,metadata:x,register:I}});var S,Fe=i(()=>{"use strict";S={name:"ScrollReveal",category:"layout",tier:"common",version:"1.0.0",description:"Adds a class when the element enters the viewport via IntersectionObserver",parameters:[{name:"cls",type:"string",optional:!0,default:"revealed",description:"CSS class added when element enters viewport"},{name:"threshold",type:"number",optional:!0,default:.1,description:"Intersection ratio threshold (0-1) for triggering"},{name:"once",type:"boolean",optional:!0,default:!0,description:"If true, disconnect observer after first intersection"}],events:[{name:"scrollreveal:enter",description:"Fired when the element enters the viewport"},{name:"scrollreveal:exit",description:"Fired when the element exits the viewport"}],requirements:["Uses IntersectionObserver API (supported in all modern browsers)"],source:`
|
|
278
281
|
behavior ScrollReveal(cls, threshold, once)
|
|
279
282
|
init
|
|
280
283
|
if cls is undefined
|
|
@@ -302,7 +305,7 @@ behavior ScrollReveal(cls, threshold, once)
|
|
|
302
305
|
obs.observe(me);
|
|
303
306
|
end
|
|
304
307
|
end
|
|
305
|
-
end`.trim()}});var
|
|
308
|
+
end`.trim()}});var st={};l(st,{default:()=>Pe,registerScrollReveal:()=>F,scrollRevealMetadata:()=>De,scrollRevealSource:()=>Oe});async function F(t){let e=t||a();if(!e)throw new Error("LokaScript not found. Make sure @hyperfixi/core is loaded before registering behaviors.");let r=e.compileSync(S.source,{traditional:!0});if(!r.ok)throw new Error(`Failed to compile ScrollReveal behavior: ${JSON.stringify(r.errors)}`);let o=e.createContext?e.createContext():{locals:new Map,globals:new Map};await e.execute(r.ast,o)}var Oe,De,Pe,U=i(()=>{"use strict";Fe();c();Oe=S.source,De=S;a()&&F().catch(console.error);Pe={source:S.source,metadata:S,register:F}});var w,_e=i(()=>{"use strict";w={name:"Tabs",category:"ui",tier:"core",version:"1.0.0",description:"WAI-ARIA compliant tabs with roving tabindex keyboard navigation. Auto-wires role, aria-selected, aria-controls, and aria-labelledby attributes.",parameters:[{name:"orientation",type:"string",optional:!0,default:"horizontal",enum:["horizontal","vertical"],description:"Arrow key direction: horizontal (Left/Right) or vertical (Up/Down)"},{name:"activeTab",type:"number",optional:!0,default:0,description:"Initial active tab index (zero-based)"},{name:"wrap",type:"boolean",optional:!0,default:!0,description:"Wrap to first/last tab when navigating past the end"},{name:"activeClass",type:"string",optional:!0,default:"active",description:"CSS class applied to the active tab and its panel"}],events:[{name:"tabs:change",description:"Fired before tab selection changes (cancelable via preventDefault)"},{name:"tabs:changed",description:"Fired after tab selection has changed"}],requirements:['Sets role="tablist" on the tab container','Sets role="tab" on tab buttons and role="tabpanel" on content panels',"Manages aria-selected, aria-controls, aria-labelledby, and tabindex","Keyboard: Arrow keys navigate, Home/End jump to first/last, Tab exits tablist"],source:`
|
|
306
309
|
behavior Tabs(orientation, activeTab, wrap, activeClass)
|
|
307
310
|
init
|
|
308
311
|
if orientation is undefined
|
|
@@ -381,5 +384,5 @@ behavior Tabs(orientation, activeTab, wrap, activeClass)
|
|
|
381
384
|
});
|
|
382
385
|
end
|
|
383
386
|
end
|
|
384
|
-
end`.trim()}});var
|
|
387
|
+
end`.trim()}});var nt={};l(nt,{default:()=>Ne,registerTabs:()=>O,tabsMetadata:()=>ze,tabsSource:()=>He});async function O(t){let e=t||a();if(!e)throw new Error("LokaScript not found. Make sure @hyperfixi/core is loaded before registering behaviors.");let r=e.compileSync(w.source,{traditional:!0});if(!r.ok)throw new Error(`Failed to compile Tabs behavior: ${JSON.stringify(r.errors)}`);let o=e.createContext?e.createContext():{locals:new Map,globals:new Map};await e.execute(r.ast,o)}var He,ze,Ne,V=i(()=>{"use strict";_e();c();He=w.source,ze=w;a()&&O().catch(console.error);Ne={source:w.source,metadata:w,register:O}});var Pt={};l(Pt,{ALL_BEHAVIOR_NAMES:()=>wt,AutoDismiss:()=>Ee,BEHAVIORS_BY_CATEGORY:()=>kt,BEHAVIORS_BY_TIER:()=>Et,BEHAVIOR_CATEGORIES:()=>Ct,BEHAVIOR_TIERS:()=>At,CURATED_BEHAVIORS:()=>Ue,CURATION_STATUS:()=>q,ClickOutside:()=>Re,Clipboard:()=>xe,Draggable:()=>ee,EXPERIMENTAL_BEHAVIORS:()=>qe,FocusTrap:()=>Ie,OPTIONAL_BEHAVIORS:()=>Ve,Removable:()=>ae,Resizable:()=>ve,ScrollReveal:()=>Pe,Sortable:()=>ue,Tabs:()=>Ne,Toggleable:()=>ce,autoDismissMetadata:()=>ke,autoDismissSource:()=>we,clickOutsideMetadata:()=>Be,clickOutsideSource:()=>Ae,clipboardMetadata:()=>ye,clipboardSource:()=>ge,curationStatusOf:()=>Bt,draggableMetadata:()=>Z,draggableSource:()=>Q,focusTrapMetadata:()=>Me,focusTrapSource:()=>Le,getAllSchemas:()=>ht,getAllSchemasRecord:()=>vt,getAvailableBehaviors:()=>Ye,getBehavior:()=>ct,getBehaviorsByCategory:()=>je,getBehaviorsByTier:()=>Xe,getRegisteredBehaviors:()=>ft,getSchema:()=>dt,hasLoader:()=>pt,isCurated:()=>Rt,isRegistered:()=>ut,loadAll:()=>yt,loadBehavior:()=>D,preloadCategory:()=>gt,preloadTier:()=>bt,ready:()=>J,registerAll:()=>Tt,registerAllWithRuntime:()=>St,registerAutoDismiss:()=>L,registerBehavior:()=>$e,registerClickOutside:()=>M,registerClipboard:()=>T,registerDraggable:()=>E,registerFocusTrap:()=>I,registerLoader:()=>n,registerRemovable:()=>C,registerResizable:()=>R,registerSchema:()=>s,registerScrollReveal:()=>F,registerSortable:()=>B,registerTabs:()=>O,registerToggleable:()=>A,registerWithRuntime:()=>xt,removableMetadata:()=>oe,removableSource:()=>re,resizableMetadata:()=>he,resizableSource:()=>fe,scrollRevealMetadata:()=>De,scrollRevealSource:()=>Oe,sortableMetadata:()=>me,sortableSource:()=>de,tabsMetadata:()=>ze,tabsSource:()=>He,toggleableMetadata:()=>ne,toggleableSource:()=>se,tryGetBehavior:()=>lt,tryGetSchema:()=>mt});_();H();z();N();W();$();Y();j();X();U();V();var d=new Map,k=new Map,P=new Map,We=new Map;function $e(t,e){d.set(t,e),e.metadata&&k.set(t,e.metadata)}function s(t){k.set(t.name,t)}function n(t,e){P.set(t,e)}function ct(t){let e=d.get(t);if(!e){let r=Array.from(d.keys()).join(", ");throw new Error(`Behavior '${t}' is not registered. Registered behaviors: ${r||"none"}. Use loadBehavior('${t}') to lazy load it.`)}return e}function lt(t){return d.get(t)}function dt(t){let e=k.get(t);if(!e)throw new Error(`Schema for behavior '${t}' is not registered. Use tryGetSchema('${t}') for a non-throwing alternative.`);return e}function mt(t){return k.get(t)}function ut(t){return d.has(t)}function pt(t){return P.has(t)}function ft(){return Array.from(d.keys())}function Ye(){let t=new Set([...d.keys(),...P.keys()]);return Array.from(t)}function je(t){let e=[];for(let[r,o]of k)o.category===t&&e.push(r);return e}function Xe(t){let e=[];for(let[r,o]of k)o.tier===t&&e.push(r);return e}function ht(){return Array.from(k.values())}function vt(){let t={};for(let[e,r]of k)t[e]=r;return t}async function D(t){let e=d.get(t);if(e)return e;let r=We.get(t);if(r)return r;let o=P.get(t);if(!o)throw new Error(`No loader registered for behavior '${t}'. Available loaders: ${Array.from(P.keys()).join(", ")||"none"}`);let m=o().then(Lt=>{let Ge=Lt.default;return $e(t,Ge),We.delete(t),Ge});return We.set(t,m),m}async function bt(t){let e=Xe(t);await Promise.all(e.map(r=>D(r).catch(o=>{console.warn(`[behaviors] Failed to preload '${r}' (tier: ${t}):`,o)})))}async function gt(t){let e=je(t);await Promise.all(e.map(r=>D(r).catch(o=>{console.warn(`[behaviors] Failed to preload '${r}' (category: ${t}):`,o)})))}async function yt(){let t=Ye();await Promise.all(t.map(e=>D(e).catch(r=>{console.warn(`[behaviors] Failed to load '${e}':`,r)})))}async function xt(t,e){await(await D(t)).register(e)}async function St(t){let e=Array.from(d.values()).map(r=>r.register(t));await Promise.all(e)}K();le();pe();te();ie();be();Se();Ce();Te();Fe();_e();s(u);s(h);s(v);s(p);s(f);s(b);s(g);s(y);s(x);s(S);s(w);n("Draggable",()=>Promise.resolve().then(()=>(_(),Ke)));n("Sortable",()=>Promise.resolve().then(()=>(N(),et)));n("Resizable",()=>Promise.resolve().then(()=>(W(),tt)));n("Removable",()=>Promise.resolve().then(()=>(H(),Qe)));n("Toggleable",()=>Promise.resolve().then(()=>(z(),Ze)));n("Clipboard",()=>Promise.resolve().then(()=>($(),rt)));n("AutoDismiss",()=>Promise.resolve().then(()=>(Y(),ot)));n("ClickOutside",()=>Promise.resolve().then(()=>(j(),at)));n("FocusTrap",()=>Promise.resolve().then(()=>(X(),it)));n("ScrollReveal",()=>Promise.resolve().then(()=>(U(),st)));n("Tabs",()=>Promise.resolve().then(()=>(V(),nt)));var wt=["Draggable","Sortable","Resizable","Removable","Toggleable","Clipboard","AutoDismiss","ClickOutside","FocusTrap","ScrollReveal","Tabs"],kt={ui:["Draggable","Sortable","Resizable","Clipboard","AutoDismiss","ClickOutside","FocusTrap","Tabs"],data:["Removable"],animation:[],form:["Toggleable"],layout:["ScrollReveal"]},Et={core:["Draggable","Toggleable","Clipboard","AutoDismiss","ClickOutside","FocusTrap","Tabs"],common:["Sortable","Removable","ScrollReveal"],optional:["Resizable"]},Ct={Draggable:"ui",Sortable:"ui",Resizable:"ui",Removable:"data",Toggleable:"form",Clipboard:"ui",AutoDismiss:"ui",ClickOutside:"ui",FocusTrap:"ui",ScrollReveal:"layout",Tabs:"ui"},At={Draggable:"core",Sortable:"common",Resizable:"optional",Removable:"common",Toggleable:"core",Clipboard:"core",AutoDismiss:"core",ClickOutside:"core",FocusTrap:"core",ScrollReveal:"common",Tabs:"core"};var Ue=["Toggleable","Removable","ClickOutside","Clipboard","AutoDismiss"],Ve=["FocusTrap","ScrollReveal","Tabs"],qe=["Draggable","Sortable","Resizable"],q={...Object.fromEntries(Ue.map(t=>[t,"curated"])),...Object.fromEntries(Ve.map(t=>[t,"optional"])),...Object.fromEntries(qe.map(t=>[t,"experimental"]))};function Bt(t){return q[t]}function Rt(t){return q[t]==="curated"}_();H();z();N();W();$();Y();j();X();U();V();c();async function Tt(t){await Promise.all([E(t),C(t),A(t),B(t),R(t),T(t),L(t),M(t),I(t),F(t),O(t)])}var J=null,Je=a();if(Je){let t=window;J=Tt(Je),t.__hyperfixi_behaviors_ready=J,J.then(()=>{let e=Je,r=t.__hyperfixi_behaviors_ready;delete t.__hyperfixi_behaviors_ready,e.attributeProcessor?.scanAndProcessAll?e.attributeProcessor.scanAndProcessAll().finally(()=>{t.__hyperfixi_behaviors_ready=r}):e.processNode&&(e.processNode(document),t.__hyperfixi_behaviors_ready=r)}).catch(e=>{console.error("[behaviors] Auto-registration failed:",e)})}return Dt(Pt);})();
|
|
385
388
|
//# sourceMappingURL=all.browser.global.js.map
|