@hyperfixi/behaviors 3.2.0 → 4.0.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/CHANGELOG.md +203 -1
- package/README.md +29 -9
- package/dist/all.browser.global.js +47 -102
- package/dist/all.browser.global.js.map +1 -1
- package/dist/autodismiss.browser.global.js +5 -11
- package/dist/autodismiss.browser.global.js.map +1 -1
- package/dist/behaviors/autodismiss.cjs +19 -22
- package/dist/behaviors/autodismiss.cjs.map +1 -1
- package/dist/behaviors/autodismiss.d.cts +4 -4
- package/dist/behaviors/autodismiss.d.ts +4 -4
- package/dist/behaviors/autodismiss.js +3 -3
- package/dist/behaviors/clickoutside.cjs +19 -18
- package/dist/behaviors/clickoutside.cjs.map +1 -1
- package/dist/behaviors/clickoutside.d.cts +4 -4
- package/dist/behaviors/clickoutside.d.ts +4 -4
- package/dist/behaviors/clickoutside.js +3 -3
- package/dist/behaviors/clipboard.cjs +18 -19
- package/dist/behaviors/clipboard.cjs.map +1 -1
- package/dist/behaviors/clipboard.d.cts +4 -4
- package/dist/behaviors/clipboard.d.ts +4 -4
- package/dist/behaviors/clipboard.js +3 -3
- package/dist/behaviors/draggable.cjs +20 -25
- package/dist/behaviors/draggable.cjs.map +1 -1
- package/dist/behaviors/draggable.d.cts +4 -4
- package/dist/behaviors/draggable.d.ts +4 -4
- package/dist/behaviors/draggable.js +3 -3
- package/dist/behaviors/focustrap.cjs +18 -19
- package/dist/behaviors/focustrap.cjs.map +1 -1
- package/dist/behaviors/focustrap.d.cts +4 -4
- package/dist/behaviors/focustrap.d.ts +4 -4
- package/dist/behaviors/focustrap.js +3 -3
- package/dist/behaviors/removable.cjs +18 -21
- package/dist/behaviors/removable.cjs.map +1 -1
- package/dist/behaviors/removable.d.cts +4 -3
- package/dist/behaviors/removable.d.ts +4 -3
- package/dist/behaviors/removable.js +3 -3
- package/dist/behaviors/resizable.cjs +21 -21
- package/dist/behaviors/resizable.cjs.map +1 -1
- package/dist/behaviors/resizable.d.cts +4 -4
- package/dist/behaviors/resizable.d.ts +4 -4
- package/dist/behaviors/resizable.js +3 -3
- package/dist/behaviors/scrollreveal.cjs +19 -22
- package/dist/behaviors/scrollreveal.cjs.map +1 -1
- package/dist/behaviors/scrollreveal.d.cts +4 -4
- package/dist/behaviors/scrollreveal.d.ts +4 -4
- package/dist/behaviors/scrollreveal.js +3 -3
- package/dist/behaviors/sortable.cjs +19 -20
- package/dist/behaviors/sortable.cjs.map +1 -1
- package/dist/behaviors/sortable.d.cts +4 -4
- package/dist/behaviors/sortable.d.ts +4 -4
- package/dist/behaviors/sortable.js +3 -3
- package/dist/behaviors/tabs.cjs +20 -25
- package/dist/behaviors/tabs.cjs.map +1 -1
- package/dist/behaviors/tabs.d.cts +4 -4
- package/dist/behaviors/tabs.d.ts +4 -4
- package/dist/behaviors/tabs.js +3 -3
- package/dist/behaviors/toggleable.cjs +25 -26
- package/dist/behaviors/toggleable.cjs.map +1 -1
- package/dist/behaviors/toggleable.d.cts +4 -4
- package/dist/behaviors/toggleable.d.ts +4 -4
- package/dist/behaviors/toggleable.js +3 -3
- package/dist/chunk-2GIS4DCY.js +30 -0
- package/dist/chunk-2GIS4DCY.js.map +1 -0
- package/dist/chunk-3BCBZR6R.js +30 -0
- package/dist/chunk-3BCBZR6R.js.map +1 -0
- package/dist/chunk-4YUIDZAO.js +30 -0
- package/dist/chunk-4YUIDZAO.js.map +1 -0
- package/dist/{chunk-XYZ7FOXJ.js → chunk-AQCOK5J5.js} +10 -14
- package/dist/chunk-AQCOK5J5.js.map +1 -0
- package/dist/chunk-ATGHQQC7.js +30 -0
- package/dist/chunk-ATGHQQC7.js.map +1 -0
- package/dist/{chunk-HQDYH45I.js → chunk-CWLAXLWR.js} +5 -13
- package/dist/chunk-CWLAXLWR.js.map +1 -0
- package/dist/chunk-DMWN52SV.js +30 -0
- package/dist/chunk-DMWN52SV.js.map +1 -0
- package/dist/{chunk-PDMOOWFW.js → chunk-EIVPVTUI.js} +4 -8
- package/dist/{chunk-PDMOOWFW.js.map → chunk-EIVPVTUI.js.map} +1 -1
- package/dist/chunk-HHTEMPIT.js +30 -0
- package/dist/chunk-HHTEMPIT.js.map +1 -0
- package/dist/{chunk-26IX7QU7.js → chunk-HJESSMKB.js} +4 -6
- package/dist/{chunk-26IX7QU7.js.map → chunk-HJESSMKB.js.map} +1 -1
- package/dist/{chunk-5LFOFVZ3.js → chunk-IFAH652L.js} +6 -9
- package/dist/chunk-IFAH652L.js.map +1 -0
- package/dist/chunk-IUGJG4RA.js +30 -0
- package/dist/chunk-IUGJG4RA.js.map +1 -0
- package/dist/{chunk-6EG2MNC7.js → chunk-JNLVXPHR.js} +13 -13
- package/dist/chunk-KEZEGPEX.js +30 -0
- package/dist/chunk-KEZEGPEX.js.map +1 -0
- package/dist/{chunk-66U2RSYJ.js → chunk-KP4GNXYS.js} +4 -10
- package/dist/chunk-KP4GNXYS.js.map +1 -0
- package/dist/chunk-KXQMCN4O.js +30 -0
- package/dist/chunk-KXQMCN4O.js.map +1 -0
- package/dist/{chunk-YXS27XM6.js → chunk-KYBOZ7C4.js} +3 -7
- package/dist/chunk-KYBOZ7C4.js.map +1 -0
- package/dist/chunk-LBWM6TTU.js +30 -0
- package/dist/chunk-LBWM6TTU.js.map +1 -0
- package/dist/{chunk-3DVDS7CT.js → chunk-LCDONZBX.js} +5 -5
- package/dist/chunk-LCDONZBX.js.map +1 -0
- package/dist/{chunk-OJ3YWO3W.js → chunk-NE76IBV2.js} +3 -7
- package/dist/chunk-NE76IBV2.js.map +1 -0
- package/dist/{chunk-HMU342XE.js → chunk-PVO6TZCZ.js} +3 -9
- package/dist/{chunk-HMU342XE.js.map → chunk-PVO6TZCZ.js.map} +1 -1
- package/dist/{chunk-URZGNPTQ.js → chunk-RILYRQ72.js} +4 -10
- package/dist/chunk-RILYRQ72.js.map +1 -0
- package/dist/{chunk-FBQ3X3UY.js → chunk-U4QMFVAM.js} +5 -13
- package/dist/chunk-U4QMFVAM.js.map +1 -0
- package/dist/chunk-VWDTOSE3.js +26 -0
- package/dist/chunk-VWDTOSE3.js.map +1 -0
- package/dist/chunk-YRQBU2OW.js +30 -0
- package/dist/chunk-YRQBU2OW.js.map +1 -0
- package/dist/clickoutside.browser.global.js +5 -7
- package/dist/clickoutside.browser.global.js.map +1 -1
- package/dist/clipboard.browser.global.js +4 -8
- package/dist/clipboard.browser.global.js.map +1 -1
- package/dist/core.browser.global.js +13 -25
- package/dist/core.browser.global.js.map +1 -1
- package/dist/draggable.browser.global.js +5 -13
- package/dist/draggable.browser.global.js.map +1 -1
- package/dist/focustrap.browser.global.js +4 -8
- package/dist/focustrap.browser.global.js.map +1 -1
- package/dist/index.cjs +98 -273
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +10 -10
- package/dist/index.d.ts +10 -10
- package/dist/index.js +42 -55
- package/dist/index.js.map +1 -1
- package/dist/loaders.cjs +77 -239
- package/dist/loaders.cjs.map +1 -1
- package/dist/loaders.js +13 -13
- package/dist/registry.cjs +4 -4
- package/dist/registry.cjs.map +1 -1
- package/dist/registry.d.cts +5 -6
- package/dist/registry.d.ts +5 -6
- package/dist/registry.js +1 -1
- package/dist/removable.browser.global.js +3 -9
- package/dist/removable.browser.global.js.map +1 -1
- package/dist/resizable.browser.global.js +6 -9
- package/dist/resizable.browser.global.js.map +1 -1
- package/dist/resolver.browser.global.js +47 -102
- package/dist/resolver.browser.global.js.map +1 -1
- package/dist/schemas/index.cjs +40 -95
- 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 +11 -11
- package/dist/schemas/index.js.map +1 -1
- package/dist/scrollreveal.browser.global.js +5 -11
- package/dist/scrollreveal.browser.global.js.map +1 -1
- package/dist/sortable.browser.global.js +5 -9
- package/dist/sortable.browser.global.js.map +1 -1
- package/dist/tabs.browser.global.js +6 -14
- package/dist/tabs.browser.global.js.map +1 -1
- package/dist/toggleable.browser.global.js +9 -13
- package/dist/toggleable.browser.global.js.map +1 -1
- package/dist/{types-DCCtVQS5.d.cts → types-CbA4L8XJ.d.cts} +16 -23
- package/dist/{types-DCCtVQS5.d.ts → types-CbA4L8XJ.d.ts} +16 -23
- package/package.json +5 -5
- package/src/behavior-resolver.ts +24 -56
- package/src/behaviors/autodismiss.test.ts +12 -20
- package/src/behaviors/autodismiss.ts +8 -23
- package/src/behaviors/clickoutside.test.ts +13 -21
- package/src/behaviors/clickoutside.ts +8 -23
- package/src/behaviors/clipboard.test.ts +12 -34
- package/src/behaviors/clipboard.ts +8 -23
- package/src/behaviors/curated-runtime.test.ts +22 -24
- package/src/behaviors/draggable.ts +10 -24
- package/src/behaviors/experimental-runtime.test.ts +19 -18
- package/src/behaviors/focustrap.test.ts +12 -20
- package/src/behaviors/focustrap.ts +8 -23
- package/src/behaviors/integration.test.ts +19 -54
- package/src/behaviors/optional-runtime.test.ts +17 -22
- package/src/behaviors/removable.ts +6 -20
- package/src/behaviors/resizable.ts +9 -24
- package/src/behaviors/scrollreveal.test.ts +13 -21
- package/src/behaviors/scrollreveal.ts +8 -23
- package/src/behaviors/sortable.ts +7 -22
- package/src/behaviors/tabs.test.ts +12 -34
- package/src/behaviors/tabs.ts +8 -23
- package/src/behaviors/toggleable.ts +10 -26
- package/src/browser-resolver-bundle.ts +20 -30
- package/src/core-bundle.ts +11 -11
- package/src/index.test.ts +2 -2
- package/src/index.ts +30 -47
- package/src/registry.test.ts +9 -34
- package/src/registry.ts +7 -11
- package/src/schemas/autodismiss.schema.ts +3 -9
- package/src/schemas/clickoutside.schema.ts +3 -5
- package/src/schemas/clipboard.schema.ts +2 -6
- package/src/schemas/draggable.schema.ts +4 -12
- package/src/schemas/focustrap.schema.ts +2 -6
- package/src/schemas/index.ts +2 -1
- package/src/schemas/removable.schema.ts +2 -8
- package/src/schemas/resizable.schema.ts +5 -8
- package/src/schemas/scrollreveal.schema.ts +3 -9
- package/src/schemas/sortable.schema.ts +3 -7
- package/src/schemas/tabs.schema.ts +4 -12
- package/src/schemas/toggleable.schema.ts +10 -13
- package/src/schemas/types.ts +37 -30
- package/dist/chunk-2HUF6RMI.js +0 -40
- package/dist/chunk-2HUF6RMI.js.map +0 -1
- package/dist/chunk-3DVDS7CT.js.map +0 -1
- package/dist/chunk-5LFOFVZ3.js.map +0 -1
- package/dist/chunk-66U2RSYJ.js.map +0 -1
- package/dist/chunk-6TJXDCAQ.js +0 -11
- package/dist/chunk-6TJXDCAQ.js.map +0 -1
- package/dist/chunk-7NGOA3T5.js +0 -40
- package/dist/chunk-7NGOA3T5.js.map +0 -1
- package/dist/chunk-7TPDLB7W.js +0 -40
- package/dist/chunk-7TPDLB7W.js.map +0 -1
- package/dist/chunk-CR3J7VV6.js +0 -40
- package/dist/chunk-CR3J7VV6.js.map +0 -1
- package/dist/chunk-EDBG2F57.js +0 -40
- package/dist/chunk-EDBG2F57.js.map +0 -1
- package/dist/chunk-FBQ3X3UY.js.map +0 -1
- package/dist/chunk-HQDYH45I.js.map +0 -1
- package/dist/chunk-HX663BJ4.js +0 -40
- package/dist/chunk-HX663BJ4.js.map +0 -1
- package/dist/chunk-KROW43CG.js +0 -40
- package/dist/chunk-KROW43CG.js.map +0 -1
- package/dist/chunk-L52AGCMP.js +0 -40
- package/dist/chunk-L52AGCMP.js.map +0 -1
- package/dist/chunk-OJ3YWO3W.js.map +0 -1
- package/dist/chunk-ORBJ7MRW.js +0 -40
- package/dist/chunk-ORBJ7MRW.js.map +0 -1
- package/dist/chunk-SLSCZV4A.js +0 -40
- package/dist/chunk-SLSCZV4A.js.map +0 -1
- package/dist/chunk-URZGNPTQ.js.map +0 -1
- package/dist/chunk-WKBRZGGL.js +0 -40
- package/dist/chunk-WKBRZGGL.js.map +0 -1
- package/dist/chunk-XYZ7FOXJ.js.map +0 -1
- package/dist/chunk-YXS27XM6.js.map +0 -1
- /package/dist/{chunk-6EG2MNC7.js.map → chunk-JNLVXPHR.js.map} +0 -0
package/dist/loaders.cjs
CHANGED
|
@@ -37,18 +37,11 @@ var init_draggable_schema = __esm({
|
|
|
37
37
|
requirements: ["position: absolute or position: fixed on the element"],
|
|
38
38
|
source: `
|
|
39
39
|
behavior Draggable(dragHandle)
|
|
40
|
-
|
|
41
|
-
if no dragHandle set dragHandle to me
|
|
42
|
-
end
|
|
43
|
-
on pointerdown(clientX, clientY) from dragHandle
|
|
40
|
+
on pointerdown(clientX, clientY) from (dragHandle or me)
|
|
44
41
|
halt the event
|
|
45
42
|
trigger draggable:start
|
|
46
|
-
|
|
47
|
-
set
|
|
48
|
-
measure y
|
|
49
|
-
set startY to it
|
|
50
|
-
set xoff to clientX - startX
|
|
51
|
-
set yoff to clientY - startY
|
|
43
|
+
set xoff to clientX - my offsetLeft
|
|
44
|
+
set yoff to clientY - my offsetTop
|
|
52
45
|
repeat until event pointerup from document
|
|
53
46
|
wait for pointermove(clientX, clientY) or
|
|
54
47
|
pointerup(clientX, clientY) from document
|
|
@@ -57,8 +50,7 @@ behavior Draggable(dragHandle)
|
|
|
57
50
|
end
|
|
58
51
|
trigger draggable:end
|
|
59
52
|
end
|
|
60
|
-
end
|
|
61
|
-
`.trim()
|
|
53
|
+
end`.trim()
|
|
62
54
|
};
|
|
63
55
|
}
|
|
64
56
|
});
|
|
@@ -94,24 +86,20 @@ var init_sortable_schema = __esm({
|
|
|
94
86
|
requirements: ["Users must handle DOM reordering in sortable:move event handlers"],
|
|
95
87
|
source: `
|
|
96
88
|
behavior Sortable(dragClass)
|
|
97
|
-
init
|
|
98
|
-
if dragClass is undefined
|
|
99
|
-
set dragClass to "sorting"
|
|
100
|
-
end
|
|
101
|
-
end
|
|
102
89
|
on pointerdown(clientY) from me
|
|
103
90
|
set item to the target.closest("li")
|
|
104
91
|
if item is null
|
|
105
92
|
exit
|
|
106
93
|
end
|
|
107
94
|
halt the event
|
|
108
|
-
|
|
95
|
+
set cls to dragClass or "sorting"
|
|
96
|
+
add .{cls} to item
|
|
109
97
|
trigger sortable:start on me
|
|
110
98
|
repeat until event pointerup from document
|
|
111
99
|
wait for pointermove(clientY) or pointerup(clientY) from document
|
|
112
100
|
trigger sortable:move on me
|
|
113
101
|
end
|
|
114
|
-
remove .{
|
|
102
|
+
remove .{cls} from item
|
|
115
103
|
trigger sortable:end on me
|
|
116
104
|
end
|
|
117
105
|
end`.trim()
|
|
@@ -170,16 +158,14 @@ behavior Resizable(minWidth, minHeight, maxWidth, maxHeight)
|
|
|
170
158
|
on pointerdown(clientX, clientY) from me
|
|
171
159
|
halt the event
|
|
172
160
|
trigger resizable:start
|
|
173
|
-
|
|
174
|
-
set
|
|
175
|
-
measure height
|
|
176
|
-
set startHeight to it
|
|
161
|
+
set startWidth to my offsetWidth
|
|
162
|
+
set startHeight to my offsetHeight
|
|
177
163
|
set startX to clientX
|
|
178
164
|
set startY to clientY
|
|
179
165
|
repeat until event pointerup from document
|
|
180
166
|
wait for pointermove(clientX, clientY) or pointerup(clientX, clientY) from document
|
|
181
|
-
set newWidth to startWidth + clientX - startX
|
|
182
|
-
set newHeight to startHeight + clientY - startY
|
|
167
|
+
set newWidth to (startWidth + clientX) - startX
|
|
168
|
+
set newHeight to (startHeight + clientY) - startY
|
|
183
169
|
if newWidth < minWidth then set newWidth to minWidth end
|
|
184
170
|
if newWidth > maxWidth then set newWidth to maxWidth end
|
|
185
171
|
if newHeight < minHeight then set newHeight to minHeight end
|
|
@@ -190,8 +176,7 @@ behavior Resizable(minWidth, minHeight, maxWidth, maxHeight)
|
|
|
190
176
|
end
|
|
191
177
|
trigger resizable:end
|
|
192
178
|
end
|
|
193
|
-
end
|
|
194
|
-
`.trim()
|
|
179
|
+
end`.trim()
|
|
195
180
|
};
|
|
196
181
|
}
|
|
197
182
|
});
|
|
@@ -237,12 +222,7 @@ var init_removable_schema = __esm({
|
|
|
237
222
|
],
|
|
238
223
|
source: `
|
|
239
224
|
behavior Removable(triggerEl, confirmRemoval, effect)
|
|
240
|
-
|
|
241
|
-
if triggerEl is undefined
|
|
242
|
-
set triggerEl to me
|
|
243
|
-
end
|
|
244
|
-
end
|
|
245
|
-
on click from triggerEl
|
|
225
|
+
on click from (triggerEl or me)
|
|
246
226
|
if confirmRemoval
|
|
247
227
|
js(me)
|
|
248
228
|
if (!window.confirm("Are you sure?")) return "cancel";
|
|
@@ -258,8 +238,7 @@ behavior Removable(triggerEl, confirmRemoval, effect)
|
|
|
258
238
|
trigger removable:removed
|
|
259
239
|
remove me
|
|
260
240
|
end
|
|
261
|
-
end
|
|
262
|
-
`.trim()
|
|
241
|
+
end`.trim()
|
|
263
242
|
};
|
|
264
243
|
}
|
|
265
244
|
});
|
|
@@ -284,11 +263,11 @@ var init_toggleable_schema = __esm({
|
|
|
284
263
|
description: "CSS class to toggle"
|
|
285
264
|
},
|
|
286
265
|
{
|
|
287
|
-
name: "
|
|
266
|
+
name: "targetEl",
|
|
288
267
|
type: "selector",
|
|
289
268
|
optional: true,
|
|
290
269
|
default: "me",
|
|
291
|
-
description: "Element to toggle the class on"
|
|
270
|
+
description: "Element to toggle the class on (not `target`: that is hyperscript's name for the event target)"
|
|
292
271
|
}
|
|
293
272
|
],
|
|
294
273
|
events: [
|
|
@@ -296,20 +275,16 @@ var init_toggleable_schema = __esm({
|
|
|
296
275
|
{ name: "toggleable:off", description: "Fired when class is removed" }
|
|
297
276
|
],
|
|
298
277
|
source: `
|
|
299
|
-
behavior Toggleable(cls,
|
|
278
|
+
behavior Toggleable(cls, targetEl)
|
|
300
279
|
init
|
|
301
|
-
if cls is undefined
|
|
302
|
-
|
|
303
|
-
end
|
|
304
|
-
if target is undefined
|
|
305
|
-
set target to me
|
|
306
|
-
end
|
|
280
|
+
if cls is undefined set element's cls to "active" end
|
|
281
|
+
if targetEl is undefined set element's targetEl to me end
|
|
307
282
|
end
|
|
308
283
|
on click
|
|
309
|
-
toggle .{cls} on
|
|
310
|
-
js(
|
|
311
|
-
var eventName =
|
|
312
|
-
|
|
284
|
+
toggle .{cls} on targetEl
|
|
285
|
+
js(targetEl, cls)
|
|
286
|
+
var eventName = targetEl.classList.contains(cls) ? 'toggleable:on' : 'toggleable:off';
|
|
287
|
+
targetEl.dispatchEvent(new CustomEvent(eventName, { bubbles: true }));
|
|
313
288
|
end
|
|
314
289
|
end
|
|
315
290
|
end`.trim()
|
|
@@ -367,12 +342,8 @@ var init_clipboard_schema = __esm({
|
|
|
367
342
|
source: `
|
|
368
343
|
behavior Clipboard(text, source, feedback, feedbackDuration)
|
|
369
344
|
init
|
|
370
|
-
if feedbackDuration is undefined
|
|
371
|
-
|
|
372
|
-
end
|
|
373
|
-
if source is undefined
|
|
374
|
-
set source to me
|
|
375
|
-
end
|
|
345
|
+
if feedbackDuration is undefined set element's feedbackDuration to 2000 end
|
|
346
|
+
if source is undefined set element's source to me end
|
|
376
347
|
end
|
|
377
348
|
on click
|
|
378
349
|
if text is not undefined
|
|
@@ -461,15 +432,9 @@ var init_autodismiss_schema = __esm({
|
|
|
461
432
|
source: `
|
|
462
433
|
behavior AutoDismiss(delay, pauseOnHover, effect)
|
|
463
434
|
init
|
|
464
|
-
if delay is undefined
|
|
465
|
-
|
|
466
|
-
end
|
|
467
|
-
if pauseOnHover is undefined
|
|
468
|
-
set pauseOnHover to true
|
|
469
|
-
end
|
|
470
|
-
if effect is undefined
|
|
471
|
-
set effect to "none"
|
|
472
|
-
end
|
|
435
|
+
if delay is undefined set element's delay to 5000 end
|
|
436
|
+
if pauseOnHover is undefined set element's pauseOnHover to true end
|
|
437
|
+
if effect is undefined set element's effect to "none" end
|
|
473
438
|
js(me, delay, effect, pauseOnHover)
|
|
474
439
|
me.dispatchEvent(new CustomEvent('autodismiss:start', { bubbles: true }));
|
|
475
440
|
var remaining = delay;
|
|
@@ -551,9 +516,7 @@ var init_clickoutside_schema = __esm({
|
|
|
551
516
|
source: `
|
|
552
517
|
behavior ClickOutside(active)
|
|
553
518
|
init
|
|
554
|
-
if active is undefined
|
|
555
|
-
set active to true
|
|
556
|
-
end
|
|
519
|
+
if active is undefined set element's active to true end
|
|
557
520
|
end
|
|
558
521
|
on pointerdown from document
|
|
559
522
|
js(me, active, event)
|
|
@@ -564,10 +527,10 @@ behavior ClickOutside(active)
|
|
|
564
527
|
end
|
|
565
528
|
end
|
|
566
529
|
on clickoutside:activate
|
|
567
|
-
set active to true
|
|
530
|
+
set element's active to true
|
|
568
531
|
end
|
|
569
532
|
on clickoutside:deactivate
|
|
570
|
-
set active to false
|
|
533
|
+
set element's active to false
|
|
571
534
|
end
|
|
572
535
|
end`.trim()
|
|
573
536
|
};
|
|
@@ -618,12 +581,8 @@ var init_focustrap_schema = __esm({
|
|
|
618
581
|
source: `
|
|
619
582
|
behavior FocusTrap(active, initialFocus, returnFocus)
|
|
620
583
|
init
|
|
621
|
-
if active is undefined
|
|
622
|
-
|
|
623
|
-
end
|
|
624
|
-
if returnFocus is undefined
|
|
625
|
-
set returnFocus to true
|
|
626
|
-
end
|
|
584
|
+
if active is undefined set element's active to true end
|
|
585
|
+
if returnFocus is undefined set element's returnFocus to true end
|
|
627
586
|
js(me, active, initialFocus, returnFocus)
|
|
628
587
|
var FOCUSABLE = 'a[href],button:not(:disabled),input:not(:disabled),select:not(:disabled),textarea:not(:disabled),[tabindex]:not([tabindex="-1"])';
|
|
629
588
|
var isActive = false;
|
|
@@ -710,15 +669,9 @@ var init_scrollreveal_schema = __esm({
|
|
|
710
669
|
source: `
|
|
711
670
|
behavior ScrollReveal(cls, threshold, once)
|
|
712
671
|
init
|
|
713
|
-
if cls is undefined
|
|
714
|
-
|
|
715
|
-
end
|
|
716
|
-
if threshold is undefined
|
|
717
|
-
set threshold to 0.1
|
|
718
|
-
end
|
|
719
|
-
if once is undefined
|
|
720
|
-
set once to true
|
|
721
|
-
end
|
|
672
|
+
if cls is undefined set element's cls to "revealed" end
|
|
673
|
+
if threshold is undefined set element's threshold to 0.1 end
|
|
674
|
+
if once is undefined set element's once to true end
|
|
722
675
|
js(me, cls, threshold, once)
|
|
723
676
|
var obs = new IntersectionObserver(function(entries) {
|
|
724
677
|
for (var i = 0; i < entries.length; i++) {
|
|
@@ -798,18 +751,10 @@ var init_tabs_schema = __esm({
|
|
|
798
751
|
source: `
|
|
799
752
|
behavior Tabs(orientation, activeTab, wrap, activeClass)
|
|
800
753
|
init
|
|
801
|
-
if orientation is undefined
|
|
802
|
-
|
|
803
|
-
end
|
|
804
|
-
if
|
|
805
|
-
set activeTab to 0
|
|
806
|
-
end
|
|
807
|
-
if wrap is undefined
|
|
808
|
-
set wrap to true
|
|
809
|
-
end
|
|
810
|
-
if activeClass is undefined
|
|
811
|
-
set activeClass to "active"
|
|
812
|
-
end
|
|
754
|
+
if orientation is undefined set element's orientation to "horizontal" end
|
|
755
|
+
if activeTab is undefined set element's activeTab to 0 end
|
|
756
|
+
if wrap is undefined set element's wrap to true end
|
|
757
|
+
if activeClass is undefined set element's activeClass to "active" end
|
|
813
758
|
js(me, orientation, activeTab, wrap, activeClass)
|
|
814
759
|
var tabs = Array.from(me.querySelectorAll('[role="tab"]'));
|
|
815
760
|
var panels = Array.from(me.querySelectorAll('[role="tabpanel"]'));
|
|
@@ -883,7 +828,21 @@ end`.trim()
|
|
|
883
828
|
function resolveRuntime() {
|
|
884
829
|
if (typeof window === "undefined") return null;
|
|
885
830
|
const win = window;
|
|
886
|
-
|
|
831
|
+
const host = win.hyperfixi ?? win._hyperscript;
|
|
832
|
+
return host && typeof host.evaluate === "function" ? host : null;
|
|
833
|
+
}
|
|
834
|
+
function defineBehavior(schema, host) {
|
|
835
|
+
const hf = host ?? resolveRuntime();
|
|
836
|
+
if (!hf) {
|
|
837
|
+
throw new Error(
|
|
838
|
+
`No hyperscript host found: load @hyperfixi/engine (hyperfixi-hs.js) before defining ${schema.name}.`
|
|
839
|
+
);
|
|
840
|
+
}
|
|
841
|
+
try {
|
|
842
|
+
hf.evaluate(schema.source);
|
|
843
|
+
} catch (e) {
|
|
844
|
+
throw new Error(`Failed to define ${schema.name} behavior: ${e.message}`);
|
|
845
|
+
}
|
|
887
846
|
}
|
|
888
847
|
var init_types = __esm({
|
|
889
848
|
"src/schemas/types.ts"() {
|
|
@@ -899,19 +858,8 @@ __export(draggable_exports, {
|
|
|
899
858
|
draggableSource: () => draggableSource,
|
|
900
859
|
registerDraggable: () => registerDraggable
|
|
901
860
|
});
|
|
902
|
-
async function registerDraggable(
|
|
903
|
-
|
|
904
|
-
if (!hf) {
|
|
905
|
-
throw new Error(
|
|
906
|
-
"LokaScript not found. Make sure @hyperfixi/core is loaded before registering behaviors."
|
|
907
|
-
);
|
|
908
|
-
}
|
|
909
|
-
const result = hf.compileSync(draggableSchema.source, { traditional: true });
|
|
910
|
-
if (!result.ok) {
|
|
911
|
-
throw new Error(`Failed to compile Draggable behavior: ${JSON.stringify(result.errors)}`);
|
|
912
|
-
}
|
|
913
|
-
const ctx = hf.createContext ? hf.createContext() : { locals: /* @__PURE__ */ new Map(), globals: /* @__PURE__ */ new Map() };
|
|
914
|
-
await hf.execute(result.ast, ctx);
|
|
861
|
+
async function registerDraggable(host) {
|
|
862
|
+
defineBehavior(draggableSchema, host);
|
|
915
863
|
}
|
|
916
864
|
var draggableSource, draggableMetadata, draggable_default;
|
|
917
865
|
var init_draggable = __esm({
|
|
@@ -940,19 +888,8 @@ __export(sortable_exports, {
|
|
|
940
888
|
sortableMetadata: () => sortableMetadata,
|
|
941
889
|
sortableSource: () => sortableSource
|
|
942
890
|
});
|
|
943
|
-
async function registerSortable(
|
|
944
|
-
|
|
945
|
-
if (!hf) {
|
|
946
|
-
throw new Error(
|
|
947
|
-
"LokaScript not found. Make sure @hyperfixi/core is loaded before registering behaviors."
|
|
948
|
-
);
|
|
949
|
-
}
|
|
950
|
-
const result = hf.compileSync(sortableSchema.source, { traditional: true });
|
|
951
|
-
if (!result.ok) {
|
|
952
|
-
throw new Error(`Failed to compile Sortable behavior: ${JSON.stringify(result.errors)}`);
|
|
953
|
-
}
|
|
954
|
-
const ctx = hf.createContext ? hf.createContext() : { locals: /* @__PURE__ */ new Map(), globals: /* @__PURE__ */ new Map() };
|
|
955
|
-
await hf.execute(result.ast, ctx);
|
|
891
|
+
async function registerSortable(host) {
|
|
892
|
+
defineBehavior(sortableSchema, host);
|
|
956
893
|
}
|
|
957
894
|
var sortableSource, sortableMetadata, sortable_default;
|
|
958
895
|
var init_sortable = __esm({
|
|
@@ -981,19 +918,8 @@ __export(resizable_exports, {
|
|
|
981
918
|
resizableMetadata: () => resizableMetadata,
|
|
982
919
|
resizableSource: () => resizableSource
|
|
983
920
|
});
|
|
984
|
-
async function registerResizable(
|
|
985
|
-
|
|
986
|
-
if (!hf) {
|
|
987
|
-
throw new Error(
|
|
988
|
-
"LokaScript not found. Make sure @hyperfixi/core is loaded before registering behaviors."
|
|
989
|
-
);
|
|
990
|
-
}
|
|
991
|
-
const result = hf.compileSync(resizableSchema.source, { traditional: true });
|
|
992
|
-
if (!result.ok) {
|
|
993
|
-
throw new Error(`Failed to compile Resizable behavior: ${JSON.stringify(result.errors)}`);
|
|
994
|
-
}
|
|
995
|
-
const ctx = hf.createContext ? hf.createContext() : { locals: /* @__PURE__ */ new Map(), globals: /* @__PURE__ */ new Map() };
|
|
996
|
-
await hf.execute(result.ast, ctx);
|
|
921
|
+
async function registerResizable(host) {
|
|
922
|
+
defineBehavior(resizableSchema, host);
|
|
997
923
|
}
|
|
998
924
|
var resizableSource, resizableMetadata, resizable_default;
|
|
999
925
|
var init_resizable = __esm({
|
|
@@ -1022,19 +948,8 @@ __export(removable_exports, {
|
|
|
1022
948
|
removableMetadata: () => removableMetadata,
|
|
1023
949
|
removableSource: () => removableSource
|
|
1024
950
|
});
|
|
1025
|
-
async function registerRemovable(
|
|
1026
|
-
|
|
1027
|
-
if (!hf) {
|
|
1028
|
-
throw new Error(
|
|
1029
|
-
"LokaScript not found. Make sure @hyperfixi/core is loaded before registering behaviors."
|
|
1030
|
-
);
|
|
1031
|
-
}
|
|
1032
|
-
const result = hf.compileSync(removableSchema.source, { traditional: true });
|
|
1033
|
-
if (!result.ok) {
|
|
1034
|
-
throw new Error(`Failed to compile Removable behavior: ${JSON.stringify(result.errors)}`);
|
|
1035
|
-
}
|
|
1036
|
-
const ctx = hf.createContext ? hf.createContext() : { locals: /* @__PURE__ */ new Map(), globals: /* @__PURE__ */ new Map() };
|
|
1037
|
-
await hf.execute(result.ast, ctx);
|
|
951
|
+
async function registerRemovable(host) {
|
|
952
|
+
defineBehavior(removableSchema, host);
|
|
1038
953
|
}
|
|
1039
954
|
var removableSource, removableMetadata, removable_default;
|
|
1040
955
|
var init_removable = __esm({
|
|
@@ -1063,19 +978,8 @@ __export(toggleable_exports, {
|
|
|
1063
978
|
toggleableMetadata: () => toggleableMetadata,
|
|
1064
979
|
toggleableSource: () => toggleableSource
|
|
1065
980
|
});
|
|
1066
|
-
async function registerToggleable(
|
|
1067
|
-
|
|
1068
|
-
if (!hf) {
|
|
1069
|
-
throw new Error(
|
|
1070
|
-
"LokaScript not found. Make sure @hyperfixi/core is loaded before registering behaviors."
|
|
1071
|
-
);
|
|
1072
|
-
}
|
|
1073
|
-
const result = hf.compileSync(toggleableSchema.source, { traditional: true });
|
|
1074
|
-
if (!result.ok) {
|
|
1075
|
-
throw new Error(`Failed to compile Toggleable behavior: ${JSON.stringify(result.errors)}`);
|
|
1076
|
-
}
|
|
1077
|
-
const ctx = hf.createContext ? hf.createContext() : { locals: /* @__PURE__ */ new Map(), globals: /* @__PURE__ */ new Map() };
|
|
1078
|
-
await hf.execute(result.ast, ctx);
|
|
981
|
+
async function registerToggleable(host) {
|
|
982
|
+
defineBehavior(toggleableSchema, host);
|
|
1079
983
|
}
|
|
1080
984
|
var toggleableSource, toggleableMetadata, toggleable_default;
|
|
1081
985
|
var init_toggleable = __esm({
|
|
@@ -1104,19 +1008,8 @@ __export(clipboard_exports, {
|
|
|
1104
1008
|
default: () => clipboard_default,
|
|
1105
1009
|
registerClipboard: () => registerClipboard
|
|
1106
1010
|
});
|
|
1107
|
-
async function registerClipboard(
|
|
1108
|
-
|
|
1109
|
-
if (!hf) {
|
|
1110
|
-
throw new Error(
|
|
1111
|
-
"LokaScript not found. Make sure @hyperfixi/core is loaded before registering behaviors."
|
|
1112
|
-
);
|
|
1113
|
-
}
|
|
1114
|
-
const result = hf.compileSync(clipboardSchema.source, { traditional: true });
|
|
1115
|
-
if (!result.ok) {
|
|
1116
|
-
throw new Error(`Failed to compile Clipboard behavior: ${JSON.stringify(result.errors)}`);
|
|
1117
|
-
}
|
|
1118
|
-
const ctx = hf.createContext ? hf.createContext() : { locals: /* @__PURE__ */ new Map(), globals: /* @__PURE__ */ new Map() };
|
|
1119
|
-
await hf.execute(result.ast, ctx);
|
|
1011
|
+
async function registerClipboard(host) {
|
|
1012
|
+
defineBehavior(clipboardSchema, host);
|
|
1120
1013
|
}
|
|
1121
1014
|
var clipboardSource, clipboardMetadata, clipboard_default;
|
|
1122
1015
|
var init_clipboard = __esm({
|
|
@@ -1145,19 +1038,8 @@ __export(autodismiss_exports, {
|
|
|
1145
1038
|
default: () => autodismiss_default,
|
|
1146
1039
|
registerAutoDismiss: () => registerAutoDismiss
|
|
1147
1040
|
});
|
|
1148
|
-
async function registerAutoDismiss(
|
|
1149
|
-
|
|
1150
|
-
if (!hf) {
|
|
1151
|
-
throw new Error(
|
|
1152
|
-
"LokaScript not found. Make sure @hyperfixi/core is loaded before registering behaviors."
|
|
1153
|
-
);
|
|
1154
|
-
}
|
|
1155
|
-
const result = hf.compileSync(autoDismissSchema.source, { traditional: true });
|
|
1156
|
-
if (!result.ok) {
|
|
1157
|
-
throw new Error(`Failed to compile AutoDismiss behavior: ${JSON.stringify(result.errors)}`);
|
|
1158
|
-
}
|
|
1159
|
-
const ctx = hf.createContext ? hf.createContext() : { locals: /* @__PURE__ */ new Map(), globals: /* @__PURE__ */ new Map() };
|
|
1160
|
-
await hf.execute(result.ast, ctx);
|
|
1041
|
+
async function registerAutoDismiss(host) {
|
|
1042
|
+
defineBehavior(autoDismissSchema, host);
|
|
1161
1043
|
}
|
|
1162
1044
|
var autoDismissSource, autoDismissMetadata, autodismiss_default;
|
|
1163
1045
|
var init_autodismiss = __esm({
|
|
@@ -1186,19 +1068,8 @@ __export(clickoutside_exports, {
|
|
|
1186
1068
|
default: () => clickoutside_default,
|
|
1187
1069
|
registerClickOutside: () => registerClickOutside
|
|
1188
1070
|
});
|
|
1189
|
-
async function registerClickOutside(
|
|
1190
|
-
|
|
1191
|
-
if (!hf) {
|
|
1192
|
-
throw new Error(
|
|
1193
|
-
"LokaScript not found. Make sure @hyperfixi/core is loaded before registering behaviors."
|
|
1194
|
-
);
|
|
1195
|
-
}
|
|
1196
|
-
const result = hf.compileSync(clickOutsideSchema.source, { traditional: true });
|
|
1197
|
-
if (!result.ok) {
|
|
1198
|
-
throw new Error(`Failed to compile ClickOutside behavior: ${JSON.stringify(result.errors)}`);
|
|
1199
|
-
}
|
|
1200
|
-
const ctx = hf.createContext ? hf.createContext() : { locals: /* @__PURE__ */ new Map(), globals: /* @__PURE__ */ new Map() };
|
|
1201
|
-
await hf.execute(result.ast, ctx);
|
|
1071
|
+
async function registerClickOutside(host) {
|
|
1072
|
+
defineBehavior(clickOutsideSchema, host);
|
|
1202
1073
|
}
|
|
1203
1074
|
var clickOutsideSource, clickOutsideMetadata, clickoutside_default;
|
|
1204
1075
|
var init_clickoutside = __esm({
|
|
@@ -1227,19 +1098,8 @@ __export(focustrap_exports, {
|
|
|
1227
1098
|
focusTrapSource: () => focusTrapSource,
|
|
1228
1099
|
registerFocusTrap: () => registerFocusTrap
|
|
1229
1100
|
});
|
|
1230
|
-
async function registerFocusTrap(
|
|
1231
|
-
|
|
1232
|
-
if (!hf) {
|
|
1233
|
-
throw new Error(
|
|
1234
|
-
"LokaScript not found. Make sure @hyperfixi/core is loaded before registering behaviors."
|
|
1235
|
-
);
|
|
1236
|
-
}
|
|
1237
|
-
const result = hf.compileSync(focusTrapSchema.source, { traditional: true });
|
|
1238
|
-
if (!result.ok) {
|
|
1239
|
-
throw new Error(`Failed to compile FocusTrap behavior: ${JSON.stringify(result.errors)}`);
|
|
1240
|
-
}
|
|
1241
|
-
const ctx = hf.createContext ? hf.createContext() : { locals: /* @__PURE__ */ new Map(), globals: /* @__PURE__ */ new Map() };
|
|
1242
|
-
await hf.execute(result.ast, ctx);
|
|
1101
|
+
async function registerFocusTrap(host) {
|
|
1102
|
+
defineBehavior(focusTrapSchema, host);
|
|
1243
1103
|
}
|
|
1244
1104
|
var focusTrapSource, focusTrapMetadata, focustrap_default;
|
|
1245
1105
|
var init_focustrap = __esm({
|
|
@@ -1268,19 +1128,8 @@ __export(scrollreveal_exports, {
|
|
|
1268
1128
|
scrollRevealMetadata: () => scrollRevealMetadata,
|
|
1269
1129
|
scrollRevealSource: () => scrollRevealSource
|
|
1270
1130
|
});
|
|
1271
|
-
async function registerScrollReveal(
|
|
1272
|
-
|
|
1273
|
-
if (!hf) {
|
|
1274
|
-
throw new Error(
|
|
1275
|
-
"LokaScript not found. Make sure @hyperfixi/core is loaded before registering behaviors."
|
|
1276
|
-
);
|
|
1277
|
-
}
|
|
1278
|
-
const result = hf.compileSync(scrollRevealSchema.source, { traditional: true });
|
|
1279
|
-
if (!result.ok) {
|
|
1280
|
-
throw new Error(`Failed to compile ScrollReveal behavior: ${JSON.stringify(result.errors)}`);
|
|
1281
|
-
}
|
|
1282
|
-
const ctx = hf.createContext ? hf.createContext() : { locals: /* @__PURE__ */ new Map(), globals: /* @__PURE__ */ new Map() };
|
|
1283
|
-
await hf.execute(result.ast, ctx);
|
|
1131
|
+
async function registerScrollReveal(host) {
|
|
1132
|
+
defineBehavior(scrollRevealSchema, host);
|
|
1284
1133
|
}
|
|
1285
1134
|
var scrollRevealSource, scrollRevealMetadata, scrollreveal_default;
|
|
1286
1135
|
var init_scrollreveal = __esm({
|
|
@@ -1309,19 +1158,8 @@ __export(tabs_exports, {
|
|
|
1309
1158
|
tabsMetadata: () => tabsMetadata,
|
|
1310
1159
|
tabsSource: () => tabsSource
|
|
1311
1160
|
});
|
|
1312
|
-
async function registerTabs(
|
|
1313
|
-
|
|
1314
|
-
if (!hf) {
|
|
1315
|
-
throw new Error(
|
|
1316
|
-
"LokaScript not found. Make sure @hyperfixi/core is loaded before registering behaviors."
|
|
1317
|
-
);
|
|
1318
|
-
}
|
|
1319
|
-
const result = hf.compileSync(tabsSchema.source, { traditional: true });
|
|
1320
|
-
if (!result.ok) {
|
|
1321
|
-
throw new Error(`Failed to compile Tabs behavior: ${JSON.stringify(result.errors)}`);
|
|
1322
|
-
}
|
|
1323
|
-
const ctx = hf.createContext ? hf.createContext() : { locals: /* @__PURE__ */ new Map(), globals: /* @__PURE__ */ new Map() };
|
|
1324
|
-
await hf.execute(result.ast, ctx);
|
|
1161
|
+
async function registerTabs(host) {
|
|
1162
|
+
defineBehavior(tabsSchema, host);
|
|
1325
1163
|
}
|
|
1326
1164
|
var tabsSource, tabsMetadata, tabs_default;
|
|
1327
1165
|
var init_tabs = __esm({
|