@hyperfixi/behaviors 2.3.0 → 2.4.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/dist/all.browser.global.js +26 -48
- package/dist/all.browser.global.js.map +1 -1
- package/dist/behaviors/autodismiss.d.cts +1 -1
- package/dist/behaviors/autodismiss.d.ts +1 -1
- package/dist/behaviors/clickoutside.d.cts +1 -1
- package/dist/behaviors/clickoutside.d.ts +1 -1
- package/dist/behaviors/clipboard.d.cts +1 -1
- package/dist/behaviors/clipboard.d.ts +1 -1
- package/dist/behaviors/draggable.d.cts +1 -1
- package/dist/behaviors/draggable.d.ts +1 -1
- package/dist/behaviors/focustrap.d.cts +1 -1
- package/dist/behaviors/focustrap.d.ts +1 -1
- package/dist/behaviors/removable.d.cts +1 -1
- package/dist/behaviors/removable.d.ts +1 -1
- package/dist/behaviors/resizable.cjs +12 -34
- package/dist/behaviors/resizable.cjs.map +1 -1
- package/dist/behaviors/resizable.d.cts +1 -1
- package/dist/behaviors/resizable.d.ts +1 -1
- package/dist/behaviors/resizable.js +2 -2
- package/dist/behaviors/scrollreveal.d.cts +1 -1
- package/dist/behaviors/scrollreveal.d.ts +1 -1
- package/dist/behaviors/sortable.cjs +7 -21
- package/dist/behaviors/sortable.cjs.map +1 -1
- package/dist/behaviors/sortable.d.cts +1 -1
- package/dist/behaviors/sortable.d.ts +1 -1
- package/dist/behaviors/sortable.js +2 -2
- package/dist/behaviors/tabs.d.cts +1 -1
- package/dist/behaviors/tabs.d.ts +1 -1
- package/dist/behaviors/toggleable.d.cts +1 -1
- package/dist/behaviors/toggleable.d.ts +1 -1
- package/dist/{chunk-MVNHMYIK.js → chunk-BBIIOGMF.js} +3 -3
- package/dist/{chunk-TLLGH5KX.js → chunk-IMDFEGIT.js} +3 -3
- package/dist/{chunk-TLLGH5KX.js.map → chunk-IMDFEGIT.js.map} +1 -1
- package/dist/{chunk-IQM32TEY.js → chunk-IT6TYVMW.js} +3 -3
- package/dist/{chunk-IQM32TEY.js.map → chunk-IT6TYVMW.js.map} +1 -1
- package/dist/{chunk-NC6I6T7T.js → chunk-V2M4W3LO.js} +7 -21
- package/dist/chunk-V2M4W3LO.js.map +1 -0
- package/dist/{chunk-U5GNXZUF.js → chunk-ZBSWTV6I.js} +12 -34
- package/dist/chunk-ZBSWTV6I.js.map +1 -0
- package/dist/index.cjs +19 -55
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +5 -5
- package/dist/loaders.cjs +19 -55
- package/dist/loaders.cjs.map +1 -1
- package/dist/loaders.js +3 -3
- package/dist/registry.d.cts +1 -1
- package/dist/registry.d.ts +1 -1
- package/dist/resizable.browser.global.js +13 -28
- package/dist/resizable.browser.global.js.map +1 -1
- package/dist/resolver.browser.global.js +20 -42
- package/dist/resolver.browser.global.js.map +1 -1
- package/dist/schemas/index.cjs +17 -53
- 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 +2 -2
- package/dist/sortable.browser.global.js +8 -15
- package/dist/sortable.browser.global.js.map +1 -1
- package/dist/{types-DCCtVQS5.d.ts → types-BY-jB5FV.d.cts} +1 -1
- package/dist/{types-DCCtVQS5.d.cts → types-BY-jB5FV.d.ts} +1 -1
- package/package.json +2 -2
- package/src/behaviors/resizable.ts +1 -1
- package/src/behaviors/sortable.ts +1 -1
- package/src/browser-resolver-bundle.ts +1 -1
- package/src/schemas/resizable.schema.ts +11 -33
- package/src/schemas/sortable.schema.ts +6 -20
- package/dist/chunk-NC6I6T7T.js.map +0 -1
- package/dist/chunk-U5GNXZUF.js.map +0 -1
- /package/dist/{chunk-MVNHMYIK.js.map → chunk-BBIIOGMF.js.map} +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var HyperFixiBehaviors=(()=>{var le=Object.defineProperty;var _t=Object.getOwnPropertyDescriptor;var Wt=Object.getOwnPropertyNames;var
|
|
1
|
+
"use strict";var HyperFixiBehaviors=(()=>{var le=Object.defineProperty;var _t=Object.getOwnPropertyDescriptor;var Wt=Object.getOwnPropertyNames;var Nt=Object.prototype.hasOwnProperty;var u=(e,t)=>()=>(e&&(t=e(e=0)),t);var y=(e,t)=>{for(var r in t)le(e,r,{get:t[r],enumerable:!0})},Yt=(e,t,r,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Wt(t))!Nt.call(e,i)&&i!==r&&le(e,i,{get:()=>t[i],enumerable:!(o=_t(t,i))||o.enumerable});return e};var qt=e=>Yt(le({},"__esModule",{value:!0}),e);var C,de=u(()=>{"use strict";C={name:"Draggable",category:"ui",tier:"core",version:"1.0.0",description:"Makes elements draggable with pointer events",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 s(){if(typeof window>"u")return null;let e=window;return e.lokascript||e.hyperfixi||null}var g=u(()=>{"use strict"});var nt={};y(nt,{default:()=>pe,draggableMetadata:()=>me,draggableSource:()=>ue,registerDraggable:()=>T});function
|
|
24
|
+
`.trim()}});function s(){if(typeof window>"u")return null;let e=window;return e.lokascript||e.hyperfixi||null}var g=u(()=>{"use strict"});var nt={};y(nt,{default:()=>pe,draggableMetadata:()=>me,draggableSource:()=>ue,registerDraggable:()=>T});function $t(e,t){let r=e;if(t.dragHandle&&t.dragHandle!=="me")if(typeof t.dragHandle=="string"){let o=e.querySelector(t.dragHandle);o instanceof HTMLElement&&(r=o)}else t.dragHandle instanceof HTMLElement&&(r=t.dragHandle);r.addEventListener("pointerdown",o=>{o.preventDefault(),o.stopPropagation(),e.dispatchEvent(new CustomEvent("draggable:start",{bubbles:!0}));let i=e.offsetLeft,m=e.offsetTop,a=o.clientX-i,c=o.clientY-m;function p(d){e.style.left=`${d.clientX-a}px`,e.style.top=`${d.clientY-c}px`,e.dispatchEvent(new CustomEvent("draggable:move",{bubbles:!0}))}function l(){document.removeEventListener("pointermove",p),document.removeEventListener("pointerup",l),e.dispatchEvent(new CustomEvent("draggable:end",{bubbles:!0}))}document.addEventListener("pointermove",p),document.addEventListener("pointerup",l)})}async function T(e){let t=e||s();if(!t)throw new Error("LokaScript not found. Make sure @hyperfixi/core is loaded before registering behaviors.");let r={type:"behavior",name:"Draggable",parameters:["dragHandle"],eventHandlers:[],imperativeInstaller:$t},o=t.createContext?t.createContext():{locals:new Map,globals:new Map};await t.execute(r,o)}var ue,me,pe,K=u(()=>{"use strict";de();g();ue=C.source,me=C;s()&&T().catch(console.error);pe={source:C.source,metadata:C,register:T}});var k,fe=u(()=>{"use strict";k={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
|
|
@@ -62,55 +62,31 @@ behavior Toggleable(cls, target)
|
|
|
62
62
|
target.dispatchEvent(new CustomEvent(eventName, { bubbles: true }));
|
|
63
63
|
end
|
|
64
64
|
end
|
|
65
|
-
end`.trim()}});var ct={};y(ct,{default:()=>we,registerToggleable:()=>R,toggleableMetadata:()=>xe,toggleableSource:()=>ye});function
|
|
66
|
-
behavior Sortable(
|
|
65
|
+
end`.trim()}});var ct={};y(ct,{default:()=>we,registerToggleable:()=>R,toggleableMetadata:()=>xe,toggleableSource:()=>ye});function jt(e,t){let r=t.cls||"active",o=e;if(t.target&&t.target!=="me")if(typeof t.target=="string"){let i=document.querySelector(t.target);i instanceof HTMLElement&&(o=i)}else t.target instanceof HTMLElement&&(o=t.target);e.addEventListener("click",()=>{let i=o.classList.contains(r);o.classList.toggle(r),o.dispatchEvent(new CustomEvent(i?"toggleable:off":"toggleable:on",{bubbles:!0}))})}async function R(e){let t=e||s();if(!t)throw new Error("LokaScript not found. Make sure @hyperfixi/core is loaded before registering behaviors.");let r={type:"behavior",name:"Toggleable",parameters:["cls","target"],eventHandlers:[],imperativeInstaller:jt},o=t.createContext?t.createContext():{locals:new Map,globals:new Map};await t.execute(r,o)}var ye,xe,we,Q=u(()=>{"use strict";ge();g();ye=A.source,xe=A;s()&&R().catch(console.error);we={source:A.source,metadata:A,register:R}});var B,Ee=u(()=>{"use strict";B={name:"Sortable",category:"ui",tier:"common",version:"1.0.0",description:"Makes child elements reorderable via drag-and-drop",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
|
+
behavior Sortable(dragClass)
|
|
67
67
|
init
|
|
68
68
|
if dragClass is undefined
|
|
69
69
|
set dragClass to "sorting"
|
|
70
70
|
end
|
|
71
71
|
end
|
|
72
72
|
on pointerdown(clientY) from me
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
var item = target.closest("li");
|
|
76
|
-
if (!item || !me.contains(item)) return false;
|
|
77
|
-
if (handle && !target.closest(handle)) return false;
|
|
78
|
-
event.preventDefault();
|
|
79
|
-
event.stopPropagation();
|
|
80
|
-
return true;
|
|
81
|
-
end
|
|
82
|
-
if it is false
|
|
73
|
+
set item to the closest <li/> to the target
|
|
74
|
+
if item is null
|
|
83
75
|
exit
|
|
84
76
|
end
|
|
85
|
-
|
|
77
|
+
halt the event
|
|
78
|
+
add .{dragClass} to item
|
|
86
79
|
trigger sortable:start on me
|
|
87
80
|
repeat until event pointerup from document
|
|
88
81
|
wait for pointermove(clientY) from document
|
|
89
82
|
trigger sortable:move on me
|
|
90
83
|
end
|
|
91
|
-
remove .{dragClass} from
|
|
84
|
+
remove .{dragClass} from item
|
|
92
85
|
trigger sortable:end on me
|
|
93
86
|
end
|
|
94
|
-
end`.trim()}});var lt={};y(lt,{default:()=>Le,registerSortable:()=>H,sortableMetadata:()=>ke,sortableSource:()=>Se});function
|
|
95
|
-
behavior Resizable(
|
|
96
|
-
|
|
97
|
-
if handle is undefined
|
|
98
|
-
set handle to me
|
|
99
|
-
end
|
|
100
|
-
if minWidth is undefined
|
|
101
|
-
set minWidth to 50
|
|
102
|
-
end
|
|
103
|
-
if minHeight is undefined
|
|
104
|
-
set minHeight to 50
|
|
105
|
-
end
|
|
106
|
-
if maxWidth is undefined
|
|
107
|
-
set maxWidth to 9999
|
|
108
|
-
end
|
|
109
|
-
if maxHeight is undefined
|
|
110
|
-
set maxHeight to 9999
|
|
111
|
-
end
|
|
112
|
-
end
|
|
113
|
-
on pointerdown(clientX, clientY) from handle
|
|
87
|
+
end`.trim()}});var lt={};y(lt,{default:()=>Le,registerSortable:()=>H,sortableMetadata:()=>ke,sortableSource:()=>Se});function Xt(e,t){let r=t.dragClass||"sorting",o=t.handle||null;e.addEventListener("pointerdown",i=>{let m=i.target,a=m.closest("li");if(!a||!e.contains(a)||o&&!m.closest(o))return;i.preventDefault(),a.classList.add(r),e.dispatchEvent(new CustomEvent("sortable:start",{bubbles:!0,detail:{item:a}}));function c(l){e.dispatchEvent(new CustomEvent("sortable:move",{bubbles:!0,detail:{clientY:l.clientY,item:a}}))}function p(){document.removeEventListener("pointermove",c),document.removeEventListener("pointerup",p),a.classList.remove(r),e.dispatchEvent(new CustomEvent("sortable:end",{bubbles:!0,detail:{item:a}}))}document.addEventListener("pointermove",c),document.addEventListener("pointerup",p)})}async function H(e){let t=e||s();if(!t)throw new Error("LokaScript not found. Make sure @hyperfixi/core is loaded before registering behaviors.");let r={type:"behavior",name:"Sortable",parameters:["dragClass"],eventHandlers:[],imperativeInstaller:Xt},o=t.createContext?t.createContext():{locals:new Map,globals:new Map};await t.execute(r,o)}var Se,ke,Le,Z=u(()=>{"use strict";Ee();g();Se=B.source,ke=B;s()&&H().catch(console.error);Le={source:B.source,metadata:B,register:H}});var I,Ce=u(()=>{"use strict";I={name:"Resizable",category:"ui",tier:"optional",version:"1.0.0",description:"Makes elements resizable by dragging",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
|
+
behavior Resizable(minWidth, minHeight, maxWidth, maxHeight)
|
|
89
|
+
on pointerdown(clientX, clientY) from me
|
|
114
90
|
halt the event
|
|
115
91
|
trigger resizable:start
|
|
116
92
|
measure width
|
|
@@ -120,19 +96,21 @@ behavior Resizable(handle, minWidth, minHeight, maxWidth, maxHeight)
|
|
|
120
96
|
set startX to clientX
|
|
121
97
|
set startY to clientY
|
|
122
98
|
repeat until event pointerup from document
|
|
123
|
-
wait for pointermove(clientX, clientY)
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
end
|
|
99
|
+
wait for pointermove(clientX, clientY) from document
|
|
100
|
+
set newWidth to startWidth + clientX - startX
|
|
101
|
+
set newHeight to startHeight + clientY - startY
|
|
102
|
+
if newWidth < minWidth then set newWidth to minWidth end
|
|
103
|
+
if newWidth > maxWidth then set newWidth to maxWidth end
|
|
104
|
+
if newHeight < minHeight then set newHeight to minHeight end
|
|
105
|
+
if newHeight > maxHeight then set newHeight to maxHeight end
|
|
106
|
+
set my style.width to newWidth + "px"
|
|
107
|
+
set my style.height to newHeight + "px"
|
|
130
108
|
trigger resizable:resize
|
|
131
109
|
end
|
|
132
110
|
trigger resizable:end
|
|
133
111
|
end
|
|
134
112
|
end
|
|
135
|
-
`.trim()}});var dt={};y(dt,{default:()=>Ae,registerResizable:()=>F,resizableMetadata:()=>Me,resizableSource:()=>Te});function Ut(e,t){let r=e;if(t.handle&&t.handle!=="me")if(typeof t.handle=="string"){let c=e.querySelector(t.handle);c instanceof HTMLElement&&(r=c)}else t.handle instanceof HTMLElement&&(r=t.handle);let o=t.minWidth??50,i=t.minHeight??50,m=t.maxWidth??9999,a=t.maxHeight??9999;r.addEventListener("pointerdown",c=>{c.preventDefault(),e.dispatchEvent(new CustomEvent("resizable:start",{bubbles:!0}));let p=e.offsetWidth,l=e.offsetHeight,d=c.clientX,w=c.clientY;function h(n){let f=Math.max(o,Math.min(m,p+(n.clientX-d))),S=Math.max(i,Math.min(a,l+(n.clientY-w)));e.style.width=`${f}px`,e.style.height=`${S}px`,e.dispatchEvent(new CustomEvent("resizable:resize",{bubbles:!0}))}function ce(){document.removeEventListener("pointermove",h),document.removeEventListener("pointerup",ce),e.dispatchEvent(new CustomEvent("resizable:end",{bubbles:!0}))}document.addEventListener("pointermove",h),document.addEventListener("pointerup",ce)})}async function F(e){let t=e||s();if(!t)throw new Error("LokaScript not found. Make sure @hyperfixi/core is loaded before registering behaviors.");let r={type:"behavior",name:"Resizable",parameters:[
|
|
113
|
+
`.trim()}});var dt={};y(dt,{default:()=>Ae,registerResizable:()=>F,resizableMetadata:()=>Me,resizableSource:()=>Te});function Ut(e,t){let r=e;if(t.handle&&t.handle!=="me")if(typeof t.handle=="string"){let c=e.querySelector(t.handle);c instanceof HTMLElement&&(r=c)}else t.handle instanceof HTMLElement&&(r=t.handle);let o=t.minWidth??50,i=t.minHeight??50,m=t.maxWidth??9999,a=t.maxHeight??9999;r.addEventListener("pointerdown",c=>{c.preventDefault(),e.dispatchEvent(new CustomEvent("resizable:start",{bubbles:!0}));let p=e.offsetWidth,l=e.offsetHeight,d=c.clientX,w=c.clientY;function h(n){let f=Math.max(o,Math.min(m,p+(n.clientX-d))),S=Math.max(i,Math.min(a,l+(n.clientY-w)));e.style.width=`${f}px`,e.style.height=`${S}px`,e.dispatchEvent(new CustomEvent("resizable:resize",{bubbles:!0}))}function ce(){document.removeEventListener("pointermove",h),document.removeEventListener("pointerup",ce),e.dispatchEvent(new CustomEvent("resizable:end",{bubbles:!0}))}document.addEventListener("pointermove",h),document.addEventListener("pointerup",ce)})}async function F(e){let t=e||s();if(!t)throw new Error("LokaScript not found. Make sure @hyperfixi/core is loaded before registering behaviors.");let r={type:"behavior",name:"Resizable",parameters:[],eventHandlers:[],imperativeInstaller:Ut},o=t.createContext?t.createContext():{locals:new Map,globals:new Map};await t.execute(r,o)}var Te,Me,Ae,ee=u(()=>{"use strict";Ce();g();Te=I.source,Me=I;s()&&F().catch(console.error);Ae={source:I.source,metadata:I,register:F}});var D,Re=u(()=>{"use strict";D={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:`
|
|
136
114
|
behavior Clipboard(text, source, feedback, feedbackDuration)
|
|
137
115
|
init
|
|
138
116
|
if feedbackDuration is undefined
|
|
@@ -248,7 +226,7 @@ behavior ClickOutside(active)
|
|
|
248
226
|
on clickoutside:deactivate
|
|
249
227
|
set active to false
|
|
250
228
|
end
|
|
251
|
-
end`.trim()}});var ft={};y(ft,{clickOutsideMetadata:()=>We,clickOutsideSource:()=>_e,default:()=>
|
|
229
|
+
end`.trim()}});var ft={};y(ft,{clickOutsideMetadata:()=>We,clickOutsideSource:()=>_e,default:()=>Ne,registerClickOutside:()=>W});function Jt(e,t){let r=t.active!==!1;function o(i){if(!e.isConnected){document.removeEventListener("pointerdown",o);return}r&&!e.contains(i.target)&&e.dispatchEvent(new CustomEvent("clickoutside",{bubbles:!0}))}document.addEventListener("pointerdown",o),e.addEventListener("clickoutside:activate",()=>{r=!0}),e.addEventListener("clickoutside:deactivate",()=>{r=!1})}async function W(e){let t=e||s();if(!t)throw new Error("LokaScript not found. Make sure @hyperfixi/core is loaded before registering behaviors.");let r={type:"behavior",name:"ClickOutside",parameters:["active"],eventHandlers:[],imperativeInstaller:Jt},o=t.createContext?t.createContext():{locals:new Map,globals:new Map};await t.execute(r,o)}var _e,We,Ne,oe=u(()=>{"use strict";ze();g();_e=_.source,We=_;s()&&W().catch(console.error);Ne={source:_.source,metadata:_,register:W}});var N,Ye=u(()=>{"use strict";N={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:`
|
|
252
230
|
behavior FocusTrap(active, initialFocus, returnFocus)
|
|
253
231
|
init
|
|
254
232
|
if active is undefined
|
|
@@ -296,7 +274,7 @@ behavior FocusTrap(active, initialFocus, returnFocus)
|
|
|
296
274
|
if (active) activate();
|
|
297
275
|
end
|
|
298
276
|
end
|
|
299
|
-
end`.trim()}});var vt={};y(vt,{default:()=>
|
|
277
|
+
end`.trim()}});var vt={};y(vt,{default:()=>je,focusTrapMetadata:()=>$e,focusTrapSource:()=>qe,registerFocusTrap:()=>Y});function Zt(e,t){return t?t instanceof HTMLElement?t:typeof t=="string"&&(e.querySelector(t)||document.querySelector(t))||null:null}function er(e,t){let r=t.returnFocus!==!1,o=!1,i=null;function m(){return Array.from(e.querySelectorAll(Qt))}function a(l){if(!o||l.key!=="Tab")return;let d=m();if(d.length===0){l.preventDefault();return}l.preventDefault();let w=d.indexOf(document.activeElement);if(l.shiftKey){let h=w<=0?d.length-1:w-1;d[h].focus()}else{let h=w>=d.length-1?0:w+1;d[h].focus()}}function c(){if(o)return;o=!0,i=document.activeElement,e.setAttribute("aria-modal","true");let l=Zt(e,t.initialFocus);if(l)l.focus();else{let d=m();d.length>0&&d[0].focus()}e.dispatchEvent(new CustomEvent("focustrap:activated",{bubbles:!0}))}function p(){o&&(o=!1,e.removeAttribute("aria-modal"),r&&i instanceof HTMLElement&&i.focus(),i=null,e.dispatchEvent(new CustomEvent("focustrap:deactivated",{bubbles:!0})))}e.addEventListener("keydown",a),e.addEventListener("focustrap:activate",()=>c()),e.addEventListener("focustrap:deactivate",()=>p()),t.active!==!1&&c()}async function Y(e){let t=e||s();if(!t)throw new Error("LokaScript not found. Make sure @hyperfixi/core is loaded before registering behaviors.");let r={type:"behavior",name:"FocusTrap",parameters:["active","initialFocus","returnFocus"],eventHandlers:[],imperativeInstaller:er},o=t.createContext?t.createContext():{locals:new Map,globals:new Map};await t.execute(r,o)}var qe,$e,Qt,je,ie=u(()=>{"use strict";Ye();g();qe=N.source,$e=N,Qt=["a[href]","button:not(:disabled)","input:not(:disabled)","select:not(:disabled)","textarea:not(:disabled)",'[tabindex]:not([tabindex="-1"])'].join(", ");s()&&Y().catch(console.error);je={source:N.source,metadata:N,register:Y}});var q,Xe=u(()=>{"use strict";q={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:`
|
|
300
278
|
behavior ScrollReveal(cls, threshold, once)
|
|
301
279
|
init
|
|
302
280
|
if cls is undefined
|
|
@@ -324,7 +302,7 @@ behavior ScrollReveal(cls, threshold, once)
|
|
|
324
302
|
obs.observe(me);
|
|
325
303
|
end
|
|
326
304
|
end
|
|
327
|
-
end`.trim()}});var bt={};y(bt,{default:()=>Ge,registerScrollReveal:()
|
|
305
|
+
end`.trim()}});var bt={};y(bt,{default:()=>Ge,registerScrollReveal:()=>$,scrollRevealMetadata:()=>Ve,scrollRevealSource:()=>Ue});function tr(e,t){let r=typeof t.cls=="string"?t.cls:"revealed",o=typeof t.threshold=="number"?t.threshold:.1,i=t.once!==!1,m=typeof t.rootMargin=="string"?t.rootMargin:"0px",a=new IntersectionObserver(c=>{for(let p of c)p.isIntersecting?(e.classList.add(r),e.dispatchEvent(new CustomEvent("scrollreveal:enter",{bubbles:!0})),i&&a.disconnect()):i||(e.classList.remove(r),e.dispatchEvent(new CustomEvent("scrollreveal:exit",{bubbles:!0})))},{threshold:o,rootMargin:m});a.observe(e)}async function $(e){let t=e||s();if(!t)throw new Error("LokaScript not found. Make sure @hyperfixi/core is loaded before registering behaviors.");let r={type:"behavior",name:"ScrollReveal",parameters:["cls","threshold","once","rootMargin"],eventHandlers:[],imperativeInstaller:tr},o=t.createContext?t.createContext():{locals:new Map,globals:new Map};await t.execute(r,o)}var Ue,Ve,Ge,ae=u(()=>{"use strict";Xe();g();Ue=q.source,Ve=q;s()&&$().catch(console.error);Ge={source:q.source,metadata:q,register:$}});var j,Ke=u(()=>{"use strict";j={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:`
|
|
328
306
|
behavior Tabs(orientation, activeTab, wrap, activeClass)
|
|
329
307
|
init
|
|
330
308
|
if orientation is undefined
|
|
@@ -403,5 +381,5 @@ behavior Tabs(orientation, activeTab, wrap, activeClass)
|
|
|
403
381
|
});
|
|
404
382
|
end
|
|
405
383
|
end
|
|
406
|
-
end`.trim()}});var gt={};y(gt,{default:()=>Ze,registerTabs:()
|
|
384
|
+
end`.trim()}});var gt={};y(gt,{default:()=>Ze,registerTabs:()=>X,tabsMetadata:()=>Qe,tabsSource:()=>Je});function ht(e,t){return e.id||(e.id=`${t}-${++rr}`),e.id}function or(e,t){let r=t.orientation==="vertical"?"vertical":"horizontal",o=t.wrap!==!1,i=t.activeClass||"active",m=typeof t.activeTab=="number"?t.activeTab:0,a=Array.from(e.querySelectorAll('[role="tab"]')),c=Array.from(e.querySelectorAll('[role="tabpanel"]'));if(a.length===0||c.length===0)return;let p=e.querySelector('[role="tablist"]')||a[0].parentElement;p&&!p.getAttribute("role")&&p.setAttribute("role","tablist"),p&&p.setAttribute("aria-orientation",r);let l=Math.min(a.length,c.length);for(let n=0;n<l;n++){let f=ht(a[n],"tab"),S=ht(c[n],"tabpanel");a[n].setAttribute("aria-controls",S),c[n].setAttribute("aria-labelledby",f)}let d=-1;function w(n,f){if(n===f||n<0||n>=l)return!1;let S={tab:a[n],panel:c[n],index:n,previousIndex:f},G=new CustomEvent("tabs:change",{bubbles:!0,cancelable:!0,detail:S});return e.dispatchEvent(G),G.defaultPrevented?!1:(f>=0&&f<l&&(a[f].setAttribute("aria-selected","false"),a[f].setAttribute("tabindex","-1"),a[f].classList.remove(i),c[f].setAttribute("aria-hidden","true"),c[f].classList.remove(i)),a[n].setAttribute("aria-selected","true"),a[n].setAttribute("tabindex","0"),a[n].classList.add(i),c[n].setAttribute("aria-hidden","false"),c[n].classList.add(i),d=n,e.dispatchEvent(new CustomEvent("tabs:changed",{bubbles:!0,detail:S})),!0)}for(let n=0;n<l;n++)a[n].setAttribute("aria-selected","false"),a[n].setAttribute("tabindex","-1"),a[n].classList.remove(i),c[n].setAttribute("aria-hidden","true"),c[n].classList.remove(i);let h=Math.max(0,Math.min(m,l-1));a[h].setAttribute("aria-selected","true"),a[h].setAttribute("tabindex","0"),a[h].classList.add(i),c[h].setAttribute("aria-hidden","false"),c[h].classList.add(i),d=h;for(let n=0;n<l;n++)a[n].addEventListener("click",()=>{w(n,d),a[n].focus()});(p||e).addEventListener("keydown",n=>{let f=r==="horizontal",S=f?"ArrowRight":"ArrowDown",G=f?"ArrowLeft":"ArrowUp",x=null;n.key===S?(x=d+1,x>=l&&(x=o?0:null)):n.key===G?(x=d-1,x<0&&(x=o?l-1:null)):n.key==="Home"?x=0:n.key==="End"&&(x=l-1),x!==null&&(n.preventDefault(),w(x,d)&&a[x].focus())}),e.addEventListener("tabs:select",(n=>{let f=n.detail?.index;typeof f=="number"&&w(f,d)}))}async function X(e){let t=e||s();if(!t)throw new Error("LokaScript not found. Make sure @hyperfixi/core is loaded before registering behaviors.");let r={type:"behavior",name:"Tabs",parameters:["orientation","activeTab","wrap","activeClass"],eventHandlers:[],imperativeInstaller:or},o=t.createContext?t.createContext():{locals:new Map,globals:new Map};await t.execute(r,o)}var Je,Qe,rr,Ze,ne=u(()=>{"use strict";Ke();g();Je=j.source,Qe=j,rr=0;s()&&X().catch(console.error);Ze={source:j.source,metadata:j,register:X}});var ir={};y(ir,{ALL_BEHAVIOR_NAMES:()=>It,AutoDismiss:()=>Pe,BEHAVIORS_BY_CATEGORY:()=>Ft,BEHAVIORS_BY_TIER:()=>Dt,BEHAVIOR_CATEGORIES:()=>Ot,BEHAVIOR_TIERS:()=>Pt,ClickOutside:()=>Ne,Clipboard:()=>Ie,Draggable:()=>pe,FocusTrap:()=>je,Removable:()=>he,Resizable:()=>Ae,ScrollReveal:()=>Ge,Sortable:()=>Le,Tabs:()=>Ze,Toggleable:()=>we,autoDismissMetadata:()=>Oe,autoDismissSource:()=>De,clickOutsideMetadata:()=>We,clickOutsideSource:()=>_e,clipboardMetadata:()=>He,clipboardSource:()=>Be,draggableMetadata:()=>me,draggableSource:()=>ue,focusTrapMetadata:()=>$e,focusTrapSource:()=>qe,getAllSchemas:()=>Ct,getAllSchemasRecord:()=>Tt,getAvailableBehaviors:()=>rt,getBehavior:()=>yt,getBehaviorsByCategory:()=>ot,getBehaviorsByTier:()=>it,getRegisteredBehaviors:()=>Lt,getSchema:()=>wt,hasLoader:()=>kt,isRegistered:()=>St,loadAll:()=>Rt,loadBehavior:()=>U,preloadCategory:()=>At,preloadTier:()=>Mt,ready:()=>se,registerAll:()=>zt,registerAllWithRuntime:()=>Ht,registerAutoDismiss:()=>z,registerBehavior:()=>tt,registerClickOutside:()=>W,registerClipboard:()=>O,registerDraggable:()=>T,registerFocusTrap:()=>Y,registerLoader:()=>b,registerRemovable:()=>M,registerResizable:()=>F,registerSchema:()=>v,registerScrollReveal:()=>$,registerSortable:()=>H,registerTabs:()=>X,registerToggleable:()=>R,registerWithRuntime:()=>Bt,removableMetadata:()=>be,removableSource:()=>ve,resizableMetadata:()=>Me,resizableSource:()=>Te,scrollRevealMetadata:()=>Ve,scrollRevealSource:()=>Ue,sortableMetadata:()=>ke,sortableSource:()=>Se,tabsMetadata:()=>Qe,tabsSource:()=>Je,toggleableMetadata:()=>xe,toggleableSource:()=>ye,tryGetBehavior:()=>xt,tryGetSchema:()=>Et});K();J();Q();Z();ee();te();re();oe();ie();ae();ne();var E=new Map,L=new Map,V=new Map,et=new Map;function tt(e,t){E.set(e,t),t.metadata&&L.set(e,t.metadata)}function v(e){L.set(e.name,e)}function b(e,t){V.set(e,t)}function yt(e){let t=E.get(e);if(!t){let r=Array.from(E.keys()).join(", ");throw new Error(`Behavior '${e}' is not registered. Registered behaviors: ${r||"none"}. Use loadBehavior('${e}') to lazy load it.`)}return t}function xt(e){return E.get(e)}function wt(e){let t=L.get(e);if(!t)throw new Error(`Schema for behavior '${e}' is not registered. Use tryGetSchema('${e}') for a non-throwing alternative.`);return t}function Et(e){return L.get(e)}function St(e){return E.has(e)}function kt(e){return V.has(e)}function Lt(){return Array.from(E.keys())}function rt(){let e=new Set([...E.keys(),...V.keys()]);return Array.from(e)}function ot(e){let t=[];for(let[r,o]of L)o.category===e&&t.push(r);return t}function it(e){let t=[];for(let[r,o]of L)o.tier===e&&t.push(r);return t}function Ct(){return Array.from(L.values())}function Tt(){let e={};for(let[t,r]of L)e[t]=r;return e}async function U(e){let t=E.get(e);if(t)return t;let r=et.get(e);if(r)return r;let o=V.get(e);if(!o)throw new Error(`No loader registered for behavior '${e}'. Available loaders: ${Array.from(V.keys()).join(", ")||"none"}`);let i=o().then(m=>{let a=m.default;return tt(e,a),et.delete(e),a});return et.set(e,i),i}async function Mt(e){let t=it(e);await Promise.all(t.map(r=>U(r).catch(o=>{console.warn(`[behaviors] Failed to preload '${r}' (tier: ${e}):`,o)})))}async function At(e){let t=ot(e);await Promise.all(t.map(r=>U(r).catch(o=>{console.warn(`[behaviors] Failed to preload '${r}' (category: ${e}):`,o)})))}async function Rt(){let e=rt();await Promise.all(e.map(t=>U(t).catch(r=>{console.warn(`[behaviors] Failed to load '${t}':`,r)})))}async function Bt(e,t){await(await U(e)).register(t)}async function Ht(e){let t=Array.from(E.values()).map(r=>r.register(e));await Promise.all(t)}de();Ee();Ce();fe();ge();Re();Fe();ze();Ye();Xe();Ke();v(C);v(B);v(I);v(k);v(A);v(D);v(P);v(_);v(N);v(q);v(j);b("Draggable",()=>Promise.resolve().then(()=>(K(),nt)));b("Sortable",()=>Promise.resolve().then(()=>(Z(),lt)));b("Resizable",()=>Promise.resolve().then(()=>(ee(),dt)));b("Removable",()=>Promise.resolve().then(()=>(J(),st)));b("Toggleable",()=>Promise.resolve().then(()=>(Q(),ct)));b("Clipboard",()=>Promise.resolve().then(()=>(te(),mt)));b("AutoDismiss",()=>Promise.resolve().then(()=>(re(),pt)));b("ClickOutside",()=>Promise.resolve().then(()=>(oe(),ft)));b("FocusTrap",()=>Promise.resolve().then(()=>(ie(),vt)));b("ScrollReveal",()=>Promise.resolve().then(()=>(ae(),bt)));b("Tabs",()=>Promise.resolve().then(()=>(ne(),gt)));var It=["Draggable","Sortable","Resizable","Removable","Toggleable","Clipboard","AutoDismiss","ClickOutside","FocusTrap","ScrollReveal","Tabs"],Ft={ui:["Draggable","Sortable","Resizable","Clipboard","AutoDismiss","ClickOutside","FocusTrap","Tabs"],data:["Removable"],animation:[],form:["Toggleable"],layout:["ScrollReveal"]},Dt={core:["Draggable","Toggleable","Clipboard","AutoDismiss","ClickOutside","FocusTrap","Tabs"],common:["Sortable","Removable","ScrollReveal"],optional:["Resizable"]},Ot={Draggable:"ui",Sortable:"ui",Resizable:"ui",Removable:"data",Toggleable:"form",Clipboard:"ui",AutoDismiss:"ui",ClickOutside:"ui",FocusTrap:"ui",ScrollReveal:"layout",Tabs:"ui"},Pt={Draggable:"core",Sortable:"common",Resizable:"optional",Removable:"common",Toggleable:"core",Clipboard:"core",AutoDismiss:"core",ClickOutside:"core",FocusTrap:"core",ScrollReveal:"common",Tabs:"core"};K();J();Q();Z();ee();te();re();oe();ie();ae();ne();g();async function zt(e){await Promise.all([T(e),M(e),R(e),H(e),F(e),O(e),z(e),W(e),Y(e),$(e),X(e)])}var se=null,at=s();if(at){let e=window;se=zt(at),e.__hyperfixi_behaviors_ready=se,se.then(()=>{let t=at,r=e.__hyperfixi_behaviors_ready;delete e.__hyperfixi_behaviors_ready,t.attributeProcessor?.scanAndProcessAll?t.attributeProcessor.scanAndProcessAll().finally(()=>{e.__hyperfixi_behaviors_ready=r}):t.processNode&&(t.processNode(document),e.__hyperfixi_behaviors_ready=r)}).catch(t=>{console.error("[behaviors] Auto-registration failed:",t)})}return qt(ir);})();
|
|
407
385
|
//# sourceMappingURL=all.browser.global.js.map
|