@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.
Files changed (71) hide show
  1. package/dist/all.browser.global.js +26 -48
  2. package/dist/all.browser.global.js.map +1 -1
  3. package/dist/behaviors/autodismiss.d.cts +1 -1
  4. package/dist/behaviors/autodismiss.d.ts +1 -1
  5. package/dist/behaviors/clickoutside.d.cts +1 -1
  6. package/dist/behaviors/clickoutside.d.ts +1 -1
  7. package/dist/behaviors/clipboard.d.cts +1 -1
  8. package/dist/behaviors/clipboard.d.ts +1 -1
  9. package/dist/behaviors/draggable.d.cts +1 -1
  10. package/dist/behaviors/draggable.d.ts +1 -1
  11. package/dist/behaviors/focustrap.d.cts +1 -1
  12. package/dist/behaviors/focustrap.d.ts +1 -1
  13. package/dist/behaviors/removable.d.cts +1 -1
  14. package/dist/behaviors/removable.d.ts +1 -1
  15. package/dist/behaviors/resizable.cjs +12 -34
  16. package/dist/behaviors/resizable.cjs.map +1 -1
  17. package/dist/behaviors/resizable.d.cts +1 -1
  18. package/dist/behaviors/resizable.d.ts +1 -1
  19. package/dist/behaviors/resizable.js +2 -2
  20. package/dist/behaviors/scrollreveal.d.cts +1 -1
  21. package/dist/behaviors/scrollreveal.d.ts +1 -1
  22. package/dist/behaviors/sortable.cjs +7 -21
  23. package/dist/behaviors/sortable.cjs.map +1 -1
  24. package/dist/behaviors/sortable.d.cts +1 -1
  25. package/dist/behaviors/sortable.d.ts +1 -1
  26. package/dist/behaviors/sortable.js +2 -2
  27. package/dist/behaviors/tabs.d.cts +1 -1
  28. package/dist/behaviors/tabs.d.ts +1 -1
  29. package/dist/behaviors/toggleable.d.cts +1 -1
  30. package/dist/behaviors/toggleable.d.ts +1 -1
  31. package/dist/{chunk-MVNHMYIK.js → chunk-BBIIOGMF.js} +3 -3
  32. package/dist/{chunk-TLLGH5KX.js → chunk-IMDFEGIT.js} +3 -3
  33. package/dist/{chunk-TLLGH5KX.js.map → chunk-IMDFEGIT.js.map} +1 -1
  34. package/dist/{chunk-IQM32TEY.js → chunk-IT6TYVMW.js} +3 -3
  35. package/dist/{chunk-IQM32TEY.js.map → chunk-IT6TYVMW.js.map} +1 -1
  36. package/dist/{chunk-NC6I6T7T.js → chunk-V2M4W3LO.js} +7 -21
  37. package/dist/chunk-V2M4W3LO.js.map +1 -0
  38. package/dist/{chunk-U5GNXZUF.js → chunk-ZBSWTV6I.js} +12 -34
  39. package/dist/chunk-ZBSWTV6I.js.map +1 -0
  40. package/dist/index.cjs +19 -55
  41. package/dist/index.cjs.map +1 -1
  42. package/dist/index.d.cts +2 -2
  43. package/dist/index.d.ts +2 -2
  44. package/dist/index.js +5 -5
  45. package/dist/loaders.cjs +19 -55
  46. package/dist/loaders.cjs.map +1 -1
  47. package/dist/loaders.js +3 -3
  48. package/dist/registry.d.cts +1 -1
  49. package/dist/registry.d.ts +1 -1
  50. package/dist/resizable.browser.global.js +13 -28
  51. package/dist/resizable.browser.global.js.map +1 -1
  52. package/dist/resolver.browser.global.js +20 -42
  53. package/dist/resolver.browser.global.js.map +1 -1
  54. package/dist/schemas/index.cjs +17 -53
  55. package/dist/schemas/index.cjs.map +1 -1
  56. package/dist/schemas/index.d.cts +2 -2
  57. package/dist/schemas/index.d.ts +2 -2
  58. package/dist/schemas/index.js +2 -2
  59. package/dist/sortable.browser.global.js +8 -15
  60. package/dist/sortable.browser.global.js.map +1 -1
  61. package/dist/{types-DCCtVQS5.d.ts → types-BY-jB5FV.d.cts} +1 -1
  62. package/dist/{types-DCCtVQS5.d.cts → types-BY-jB5FV.d.ts} +1 -1
  63. package/package.json +2 -2
  64. package/src/behaviors/resizable.ts +1 -1
  65. package/src/behaviors/sortable.ts +1 -1
  66. package/src/browser-resolver-bundle.ts +1 -1
  67. package/src/schemas/resizable.schema.ts +11 -33
  68. package/src/schemas/sortable.schema.ts +6 -20
  69. package/dist/chunk-NC6I6T7T.js.map +0 -1
  70. package/dist/chunk-U5GNXZUF.js.map +0 -1
  71. /package/dist/{chunk-MVNHMYIK.js.map → chunk-BBIIOGMF.js.map} +0 -0
@@ -1,23 +1,6 @@
1
- "use strict";var HyperFixiBehaviors=(()=>{var s=Object.defineProperty;var w=Object.getOwnPropertyDescriptor;var H=Object.getOwnPropertyNames;var z=Object.prototype.hasOwnProperty;var W=(t,e)=>{for(var i in e)s(t,i,{get:e[i],enumerable:!0})},M=(t,e,i,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of H(e))!z.call(t,n)&&n!==i&&s(t,n,{get:()=>e[n],enumerable:!(r=w(e,n))||r.enumerable});return t};var S=t=>M(s({},"__esModule",{value:!0}),t);var Y={};W(Y,{default:()=>X,registerResizable:()=>c,resizableMetadata:()=>E,resizableSource:()=>k});var a={name:"Resizable",category:"ui",tier:"optional",version:"1.0.0",description:"Makes elements resizable by dragging",parameters:[{name:"handle",type:"selector",optional:!0,default:"me",description:"CSS selector for the resize handle (defaults to the element itself)"},{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:`
2
- behavior Resizable(handle, minWidth, minHeight, maxWidth, maxHeight)
3
- init
4
- if handle is undefined
5
- set handle to me
6
- end
7
- if minWidth is undefined
8
- set minWidth to 50
9
- end
10
- if minHeight is undefined
11
- set minHeight to 50
12
- end
13
- if maxWidth is undefined
14
- set maxWidth to 9999
15
- end
16
- if maxHeight is undefined
17
- set maxHeight to 9999
18
- end
19
- end
20
- on pointerdown(clientX, clientY) from handle
1
+ "use strict";var HyperFixiBehaviors=(()=>{var s=Object.defineProperty;var y=Object.getOwnPropertyDescriptor;var H=Object.getOwnPropertyNames;var z=Object.prototype.hasOwnProperty;var W=(t,e)=>{for(var i in e)s(t,i,{get:e[i],enumerable:!0})},S=(t,e,i,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of H(e))!z.call(t,n)&&n!==i&&s(t,n,{get:()=>e[n],enumerable:!(r=y(e,n))||r.enumerable});return t};var k=t=>S(s({},"__esModule",{value:!0}),t);var X={};W(X,{default:()=>B,registerResizable:()=>h,resizableMetadata:()=>M,resizableSource:()=>E});var a={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:`
2
+ behavior Resizable(minWidth, minHeight, maxWidth, maxHeight)
3
+ on pointerdown(clientX, clientY) from me
21
4
  halt the event
22
5
  trigger resizable:start
23
6
  measure width
@@ -27,17 +10,19 @@ behavior Resizable(handle, minWidth, minHeight, maxWidth, maxHeight)
27
10
  set startX to clientX
28
11
  set startY to clientY
29
12
  repeat until event pointerup from document
30
- wait for pointermove(clientX, clientY) or pointerup from document
31
- js(startWidth, startHeight, clientX, clientY, startX, startY, minWidth, maxWidth, minHeight, maxHeight, me)
32
- var nw = Math.max(minWidth, Math.min(maxWidth, startWidth + (clientX - startX)));
33
- var nh = Math.max(minHeight, Math.min(maxHeight, startHeight + (clientY - startY)));
34
- me.style.width = nw + 'px';
35
- me.style.height = nh + 'px';
36
- end
13
+ wait for pointermove(clientX, clientY) from document
14
+ set newWidth to startWidth + clientX - startX
15
+ set newHeight to startHeight + clientY - startY
16
+ if newWidth < minWidth then set newWidth to minWidth end
17
+ if newWidth > maxWidth then set newWidth to maxWidth end
18
+ if newHeight < minHeight then set newHeight to minHeight end
19
+ if newHeight > maxHeight then set newHeight to maxHeight end
20
+ set my style.width to newWidth + "px"
21
+ set my style.height to newHeight + "px"
37
22
  trigger resizable:resize
38
23
  end
39
24
  trigger resizable:end
40
25
  end
41
26
  end
42
- `.trim()};function d(){if(typeof window>"u")return null;let t=window;return t.lokascript||t.hyperfixi||null}var k=a.source,E=a;function L(t,e){let i=t;if(e.handle&&e.handle!=="me")if(typeof e.handle=="string"){let o=t.querySelector(e.handle);o instanceof HTMLElement&&(i=o)}else e.handle instanceof HTMLElement&&(i=e.handle);let r=e.minWidth??50,n=e.minHeight??50,p=e.maxWidth??9999,u=e.maxHeight??9999;i.addEventListener("pointerdown",o=>{o.preventDefault(),t.dispatchEvent(new CustomEvent("resizable:start",{bubbles:!0}));let g=t.offsetWidth,f=t.offsetHeight,x=o.clientX,b=o.clientY;function m(l){let v=Math.max(r,Math.min(p,g+(l.clientX-x))),y=Math.max(n,Math.min(u,f+(l.clientY-b)));t.style.width=`${v}px`,t.style.height=`${y}px`,t.dispatchEvent(new CustomEvent("resizable:resize",{bubbles:!0}))}function h(){document.removeEventListener("pointermove",m),document.removeEventListener("pointerup",h),t.dispatchEvent(new CustomEvent("resizable:end",{bubbles:!0}))}document.addEventListener("pointermove",m),document.addEventListener("pointerup",h)})}async function c(t){let e=t||d();if(!e)throw new Error("LokaScript not found. Make sure @hyperfixi/core is loaded before registering behaviors.");let i={type:"behavior",name:"Resizable",parameters:["handle","minWidth","minHeight","maxWidth","maxHeight"],eventHandlers:[],imperativeInstaller:L},r=e.createContext?e.createContext():{locals:new Map,globals:new Map};await e.execute(i,r)}d()&&c().catch(console.error);var X={source:a.source,metadata:a,register:c};return S(Y);})();
27
+ `.trim()};function c(){if(typeof window>"u")return null;let t=window;return t.lokascript||t.hyperfixi||null}var E=a.source,M=a;function L(t,e){let i=t;if(e.handle&&e.handle!=="me")if(typeof e.handle=="string"){let o=t.querySelector(e.handle);o instanceof HTMLElement&&(i=o)}else e.handle instanceof HTMLElement&&(i=e.handle);let r=e.minWidth??50,n=e.minHeight??50,p=e.maxWidth??9999,u=e.maxHeight??9999;i.addEventListener("pointerdown",o=>{o.preventDefault(),t.dispatchEvent(new CustomEvent("resizable:start",{bubbles:!0}));let g=t.offsetWidth,f=t.offsetHeight,b=o.clientX,x=o.clientY;function m(l){let v=Math.max(r,Math.min(p,g+(l.clientX-b))),w=Math.max(n,Math.min(u,f+(l.clientY-x)));t.style.width=`${v}px`,t.style.height=`${w}px`,t.dispatchEvent(new CustomEvent("resizable:resize",{bubbles:!0}))}function d(){document.removeEventListener("pointermove",m),document.removeEventListener("pointerup",d),t.dispatchEvent(new CustomEvent("resizable:end",{bubbles:!0}))}document.addEventListener("pointermove",m),document.addEventListener("pointerup",d)})}async function h(t){let e=t||c();if(!e)throw new Error("LokaScript not found. Make sure @hyperfixi/core is loaded before registering behaviors.");let i={type:"behavior",name:"Resizable",parameters:[],eventHandlers:[],imperativeInstaller:L},r=e.createContext?e.createContext():{locals:new Map,globals:new Map};await e.execute(i,r)}c()&&h().catch(console.error);var B={source:a.source,metadata:a,register:h};return k(X);})();
43
28
  //# sourceMappingURL=resizable.browser.global.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/behaviors/resizable.ts","../src/schemas/resizable.schema.ts","../src/schemas/types.ts"],"sourcesContent":["/**\n * Resizable Behavior — Imperative Implementation\n *\n * Makes elements resizable by dragging edges or corners.\n * Supports minimum/maximum dimensions and resize handles.\n *\n * @example\n * ```html\n * <div _=\"install Resizable\" style=\"width: 200px; height: 150px;\">\n * Resize me!\n * </div>\n * ```\n */\n\nimport { resizableSchema } from '../schemas/resizable.schema';\nimport type { LokaScriptInstance } from '../schemas/types';\nimport { resolveRuntime } from '../schemas/types';\n\n// Re-export schema-derived values for backwards compatibility\nexport const resizableSource = resizableSchema.source;\nexport const resizableMetadata = resizableSchema;\n\n/**\n * Imperative installer for Resizable behavior.\n */\nfunction installResizable(element: HTMLElement, params: Record<string, any>): void {\n // Resolve handle element\n let handleEl: HTMLElement = element;\n if (params.handle && params.handle !== 'me') {\n if (typeof params.handle === 'string') {\n const found = element.querySelector(params.handle);\n if (found instanceof HTMLElement) handleEl = found;\n } else if (params.handle instanceof HTMLElement) {\n handleEl = params.handle;\n }\n }\n\n const minW = params.minWidth ?? 50;\n const minH = params.minHeight ?? 50;\n const maxW = params.maxWidth ?? 9999;\n const maxH = params.maxHeight ?? 9999;\n\n handleEl.addEventListener('pointerdown', (e: PointerEvent) => {\n e.preventDefault();\n element.dispatchEvent(new CustomEvent('resizable:start', { bubbles: true }));\n\n const startWidth = element.offsetWidth;\n const startHeight = element.offsetHeight;\n const startX = e.clientX;\n const startY = e.clientY;\n\n function onMove(ev: PointerEvent) {\n const newWidth = Math.max(minW, Math.min(maxW, startWidth + (ev.clientX - startX)));\n const newHeight = Math.max(minH, Math.min(maxH, startHeight + (ev.clientY - startY)));\n\n element.style.width = `${newWidth}px`;\n element.style.height = `${newHeight}px`;\n element.dispatchEvent(new CustomEvent('resizable:resize', { bubbles: true }));\n }\n\n function onUp() {\n document.removeEventListener('pointermove', onMove);\n document.removeEventListener('pointerup', onUp);\n element.dispatchEvent(new CustomEvent('resizable:end', { bubbles: true }));\n }\n\n document.addEventListener('pointermove', onMove);\n document.addEventListener('pointerup', onUp);\n });\n}\n\n/**\n * Register the Resizable behavior with LokaScript.\n */\nexport async function registerResizable(hyperfixi?: LokaScriptInstance): Promise<void> {\n const hf = hyperfixi || resolveRuntime();\n\n if (!hf) {\n throw new Error(\n 'LokaScript not found. Make sure @hyperfixi/core is loaded before registering behaviors.'\n );\n }\n\n const syntheticNode = {\n type: 'behavior',\n name: 'Resizable',\n parameters: ['handle', 'minWidth', 'minHeight', 'maxWidth', 'maxHeight'],\n eventHandlers: [],\n imperativeInstaller: installResizable,\n };\n const ctx = hf.createContext ? hf.createContext() : { locals: new Map(), globals: new Map() };\n await hf.execute(syntheticNode, ctx);\n}\n\n// Auto-register when loaded as a script tag\nif (resolveRuntime()) {\n registerResizable().catch(console.error);\n}\n\nexport default {\n source: resizableSchema.source,\n metadata: resizableSchema,\n register: registerResizable,\n};\n","import type { BehaviorSchema } from './types';\n\n/**\n * Resizable Behavior Schema\n *\n * Makes elements resizable by dragging edges or corners.\n * Supports minimum/maximum dimensions and resize handles.\n */\nexport const resizableSchema: BehaviorSchema = {\n name: 'Resizable',\n category: 'ui',\n tier: 'optional',\n version: '1.0.0',\n description: 'Makes elements resizable by dragging',\n parameters: [\n {\n name: 'handle',\n type: 'selector',\n optional: true,\n default: 'me',\n description: 'CSS selector for the resize handle (defaults to the element itself)',\n },\n {\n name: 'minWidth',\n type: 'number',\n optional: true,\n default: 50,\n description: 'Minimum width in pixels',\n },\n {\n name: 'minHeight',\n type: 'number',\n optional: true,\n default: 50,\n description: 'Minimum height in pixels',\n },\n {\n name: 'maxWidth',\n type: 'number',\n optional: true,\n default: 9999,\n description: 'Maximum width in pixels',\n },\n {\n name: 'maxHeight',\n type: 'number',\n optional: true,\n default: 9999,\n description: 'Maximum height in pixels',\n },\n ],\n events: [\n { name: 'resizable:start', description: 'Fired when resize begins' },\n { name: 'resizable:resize', description: 'Fired during resize' },\n { name: 'resizable:end', description: 'Fired when resize completes' },\n ],\n source: `\nbehavior Resizable(handle, minWidth, minHeight, maxWidth, maxHeight)\n init\n if handle is undefined\n set handle to me\n end\n if minWidth is undefined\n set minWidth to 50\n end\n if minHeight is undefined\n set minHeight to 50\n end\n if maxWidth is undefined\n set maxWidth to 9999\n end\n if maxHeight is undefined\n set maxHeight to 9999\n end\n end\n on pointerdown(clientX, clientY) from handle\n halt the event\n trigger resizable:start\n measure width\n set startWidth to it\n measure height\n set startHeight to it\n set startX to clientX\n set startY to clientY\n repeat until event pointerup from document\n wait for pointermove(clientX, clientY) or pointerup from document\n js(startWidth, startHeight, clientX, clientY, startX, startY, minWidth, maxWidth, minHeight, maxHeight, me)\n var nw = Math.max(minWidth, Math.min(maxWidth, startWidth + (clientX - startX)));\n var nh = Math.max(minHeight, Math.min(maxHeight, startHeight + (clientY - startY)));\n me.style.width = nw + 'px';\n me.style.height = nh + 'px';\n end\n trigger resizable:resize\n end\n trigger resizable:end\n end\nend\n`.trim(),\n};\n","/**\n * Behavior Schema Types\n *\n * Defines the structure for behavior metadata used for:\n * - Code generation (TypeScript types, documentation)\n * - Runtime categorization and lazy loading\n * - Tooling and IDE integration\n */\n\n/**\n * Behavior categories for organization.\n * - ui: Visual interaction behaviors (drag, resize, sort)\n * - data: Data manipulation behaviors (remove, transform)\n * - animation: Animation and transition behaviors\n * - form: Form-related behaviors (validation, toggle states)\n * - layout: Layout behaviors (sticky, scrollspy)\n */\nexport type BehaviorCategory = 'ui' | 'data' | 'animation' | 'form' | 'layout';\n\n/**\n * Loading tiers for lazy loading optimization.\n * - core: Always loaded (essential behaviors)\n * - common: High usage (loaded for typical apps)\n * - optional: Low usage (loaded on demand)\n */\nexport type BehaviorTier = 'core' | 'common' | 'optional';\n\n/**\n * Schema for a behavior parameter.\n */\nexport interface ParameterSchema {\n name: string;\n type: 'string' | 'number' | 'boolean' | 'selector' | 'element';\n optional?: boolean;\n default?: string | number | boolean;\n /** Allowed values for constrained parameters */\n enum?: string[];\n description: string;\n}\n\n/**\n * Schema for a behavior event.\n */\nexport interface EventSchema {\n name: string;\n description: string;\n}\n\n/**\n * Complete schema for a behavior.\n * This is the source of truth for all behavior metadata.\n */\nexport interface BehaviorSchema {\n /** Behavior name (PascalCase) */\n name: string;\n /** Category for organization */\n category: BehaviorCategory;\n /** Loading tier for lazy loading */\n tier: BehaviorTier;\n /** Semantic version */\n version: string;\n /** Human-readable description */\n description: string;\n /** Parameter definitions */\n parameters: ParameterSchema[];\n /** Event definitions */\n events: EventSchema[];\n /** The hyperscript behavior source code */\n source: string;\n /** Optional requirements or notes */\n requirements?: string[];\n}\n\n/**\n * Runtime behavior module interface.\n * This is what gets registered with the hyperfixi runtime.\n */\nexport interface BehaviorModule {\n source: string;\n metadata: BehaviorSchema;\n register: (hyperfixi?: LokaScriptInstance) => Promise<void>;\n}\n\n/**\n * Minimal LokaScript instance interface for behavior registration.\n */\nexport interface LokaScriptInstance {\n compileSync: (\n code: string,\n options?: { traditional?: boolean; language?: string }\n ) => {\n ok: boolean;\n ast?: unknown;\n errors?: Array<{ message: string; line?: number; column?: number }>;\n };\n execute: (ast: unknown, ctx: unknown) => Promise<unknown>;\n createContext?: () => { locals: Map<string, unknown>; globals: Map<string, unknown> };\n}\n\n/**\n * Typed window interface for behavior auto-registration.\n * Avoids `(window as any)` casts throughout the codebase.\n * Checks both `window.lokascript` and `window.hyperfixi` for the runtime instance.\n */\nexport interface LokaScriptWindow {\n lokascript?: LokaScriptInstance;\n hyperfixi?: LokaScriptInstance;\n __hyperfixi_behaviors_ready?: Promise<void> | undefined;\n}\n\n/**\n * Resolve the LokaScript runtime from window globals.\n * Checks both `window.lokascript` and `window.hyperfixi`.\n */\nexport function resolveRuntime(): LokaScriptInstance | null {\n if (typeof window === 'undefined') return null;\n const win = window as unknown as LokaScriptWindow;\n return win.lokascript || win.hyperfixi || null;\n}\n"],"mappings":"scAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,aAAAE,EAAA,sBAAAC,EAAA,sBAAAC,EAAA,oBAAAC,ICQO,IAAMC,EAAkC,CAC7C,KAAM,YACN,SAAU,KACV,KAAM,WACN,QAAS,QACT,YAAa,uCACb,WAAY,CACV,CACE,KAAM,SACN,KAAM,WACN,SAAU,GACV,QAAS,KACT,YAAa,qEACf,EACA,CACE,KAAM,WACN,KAAM,SACN,SAAU,GACV,QAAS,GACT,YAAa,yBACf,EACA,CACE,KAAM,YACN,KAAM,SACN,SAAU,GACV,QAAS,GACT,YAAa,0BACf,EACA,CACE,KAAM,WACN,KAAM,SACN,SAAU,GACV,QAAS,KACT,YAAa,yBACf,EACA,CACE,KAAM,YACN,KAAM,SACN,SAAU,GACV,QAAS,KACT,YAAa,0BACf,CACF,EACA,OAAQ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X,EAAM,KAAK,IAAIE,EAAMG,GAAcK,EAAG,QAAUH,EAAO,CAAC,EAC5EK,EAAY,KAAK,IAAIX,EAAM,KAAK,IAAIE,EAAMG,GAAeI,EAAG,QAAUF,EAAO,CAAC,EAEpFZ,EAAQ,MAAM,MAAQ,GAAGe,CAAQ,KACjCf,EAAQ,MAAM,OAAS,GAAGgB,CAAS,KACnChB,EAAQ,cAAc,IAAI,YAAY,mBAAoB,CAAE,QAAS,EAAK,CAAC,CAAC,CAC9E,CAEA,SAASiB,GAAO,CACd,SAAS,oBAAoB,cAAeJ,CAAM,EAClD,SAAS,oBAAoB,YAAaI,CAAI,EAC9CjB,EAAQ,cAAc,IAAI,YAAY,gBAAiB,CAAE,QAAS,EAAK,CAAC,CAAC,CAC3E,CAEA,SAAS,iBAAiB,cAAea,CAAM,EAC/C,SAAS,iBAAiB,YAAaI,CAAI,CAC7C,CAAC,CACH,CAKA,eAAsBC,EAAkBC,EAA+C,CACrF,IAAMC,EAAKD,GAAaE,EAAe,EAEvC,GAAI,CAACD,EACH,MAAM,IAAI,MACR,yFACF,EAGF,IAAME,EAAgB,CACpB,KAAM,WACN,KAAM,YACN,WAAY,CAAC,SAAU,WAAY,YAAa,WAAY,WAAW,EACvE,cAAe,CAAC,EAChB,oBAAqBvB,CACvB,EACMwB,EAAMH,EAAG,cAAgBA,EAAG,cAAc,EAAI,CAAE,OAAQ,IAAI,IAAO,QAAS,IAAI,GAAM,EAC5F,MAAMA,EAAG,QAAQE,EAAeC,CAAG,CACrC,CAGIF,EAAe,GACjBH,EAAkB,EAAE,MAAM,QAAQ,KAAK,EAGzC,IAAOM,EAAQ,CACb,OAAQ3B,EAAgB,OACxB,SAAUA,EACV,SAAUqB,CACZ","names":["resizable_exports","__export","resizable_default","registerResizable","resizableMetadata","resizableSource","resizableSchema","resolveRuntime","win","resizableSource","resizableSchema","resizableMetadata","installResizable","element","params","handleEl","found","minW","minH","maxW","maxH","e","startWidth","startHeight","startX","startY","onMove","ev","newWidth","newHeight","onUp","registerResizable","hyperfixi","hf","resolveRuntime","syntheticNode","ctx","resizable_default"]}
1
+ {"version":3,"sources":["../src/behaviors/resizable.ts","../src/schemas/resizable.schema.ts","../src/schemas/types.ts"],"sourcesContent":["/**\n * Resizable Behavior — Imperative Implementation\n *\n * Makes elements resizable by dragging edges or corners.\n * Supports minimum/maximum dimensions and resize handles.\n *\n * @example\n * ```html\n * <div _=\"install Resizable\" style=\"width: 200px; height: 150px;\">\n * Resize me!\n * </div>\n * ```\n */\n\nimport { resizableSchema } from '../schemas/resizable.schema';\nimport type { LokaScriptInstance } from '../schemas/types';\nimport { resolveRuntime } from '../schemas/types';\n\n// Re-export schema-derived values for backwards compatibility\nexport const resizableSource = resizableSchema.source;\nexport const resizableMetadata = resizableSchema;\n\n/**\n * Imperative installer for Resizable behavior.\n */\nfunction installResizable(element: HTMLElement, params: Record<string, any>): void {\n // Resolve handle element\n let handleEl: HTMLElement = element;\n if (params.handle && params.handle !== 'me') {\n if (typeof params.handle === 'string') {\n const found = element.querySelector(params.handle);\n if (found instanceof HTMLElement) handleEl = found;\n } else if (params.handle instanceof HTMLElement) {\n handleEl = params.handle;\n }\n }\n\n const minW = params.minWidth ?? 50;\n const minH = params.minHeight ?? 50;\n const maxW = params.maxWidth ?? 9999;\n const maxH = params.maxHeight ?? 9999;\n\n handleEl.addEventListener('pointerdown', (e: PointerEvent) => {\n e.preventDefault();\n element.dispatchEvent(new CustomEvent('resizable:start', { bubbles: true }));\n\n const startWidth = element.offsetWidth;\n const startHeight = element.offsetHeight;\n const startX = e.clientX;\n const startY = e.clientY;\n\n function onMove(ev: PointerEvent) {\n const newWidth = Math.max(minW, Math.min(maxW, startWidth + (ev.clientX - startX)));\n const newHeight = Math.max(minH, Math.min(maxH, startHeight + (ev.clientY - startY)));\n\n element.style.width = `${newWidth}px`;\n element.style.height = `${newHeight}px`;\n element.dispatchEvent(new CustomEvent('resizable:resize', { bubbles: true }));\n }\n\n function onUp() {\n document.removeEventListener('pointermove', onMove);\n document.removeEventListener('pointerup', onUp);\n element.dispatchEvent(new CustomEvent('resizable:end', { bubbles: true }));\n }\n\n document.addEventListener('pointermove', onMove);\n document.addEventListener('pointerup', onUp);\n });\n}\n\n/**\n * Register the Resizable behavior with LokaScript.\n */\nexport async function registerResizable(hyperfixi?: LokaScriptInstance): Promise<void> {\n const hf = hyperfixi || resolveRuntime();\n\n if (!hf) {\n throw new Error(\n 'LokaScript not found. Make sure @hyperfixi/core is loaded before registering behaviors.'\n );\n }\n\n const syntheticNode = {\n type: 'behavior',\n name: 'Resizable',\n parameters: [],\n eventHandlers: [],\n imperativeInstaller: installResizable,\n };\n const ctx = hf.createContext ? hf.createContext() : { locals: new Map(), globals: new Map() };\n await hf.execute(syntheticNode, ctx);\n}\n\n// Auto-register when loaded as a script tag\nif (resolveRuntime()) {\n registerResizable().catch(console.error);\n}\n\nexport default {\n source: resizableSchema.source,\n metadata: resizableSchema,\n register: registerResizable,\n};\n","import type { BehaviorSchema } from './types';\n\n/**\n * Resizable Behavior Schema\n *\n * Makes elements resizable by dragging edges or corners.\n * Supports minimum/maximum dimensions and resize handles.\n */\nexport const resizableSchema: BehaviorSchema = {\n name: 'Resizable',\n category: 'ui',\n tier: 'optional',\n version: '1.0.0',\n description: 'Makes elements resizable by dragging',\n parameters: [\n {\n name: 'minWidth',\n type: 'number',\n optional: true,\n default: 50,\n description: 'Minimum width in pixels',\n },\n {\n name: 'minHeight',\n type: 'number',\n optional: true,\n default: 50,\n description: 'Minimum height in pixels',\n },\n {\n name: 'maxWidth',\n type: 'number',\n optional: true,\n default: 9999,\n description: 'Maximum width in pixels',\n },\n {\n name: 'maxHeight',\n type: 'number',\n optional: true,\n default: 9999,\n description: 'Maximum height in pixels',\n },\n ],\n events: [\n { name: 'resizable:start', description: 'Fired when resize begins' },\n { name: 'resizable:resize', description: 'Fired during resize' },\n { name: 'resizable:end', description: 'Fired when resize completes' },\n ],\n source: `\nbehavior Resizable(minWidth, minHeight, maxWidth, maxHeight)\n on pointerdown(clientX, clientY) from me\n halt the event\n trigger resizable:start\n measure width\n set startWidth to it\n measure height\n set startHeight to it\n set startX to clientX\n set startY to clientY\n repeat until event pointerup from document\n wait for pointermove(clientX, clientY) from document\n set newWidth to startWidth + clientX - startX\n set newHeight to startHeight + clientY - startY\n if newWidth < minWidth then set newWidth to minWidth end\n if newWidth > maxWidth then set newWidth to maxWidth end\n if newHeight < minHeight then set newHeight to minHeight end\n if newHeight > maxHeight then set newHeight to maxHeight end\n set my style.width to newWidth + \"px\"\n set my style.height to newHeight + \"px\"\n trigger resizable:resize\n end\n trigger resizable:end\n end\nend\n`.trim(),\n};\n","/**\n * Behavior Schema Types\n *\n * Defines the structure for behavior metadata used for:\n * - Code generation (TypeScript types, documentation)\n * - Runtime categorization and lazy loading\n * - Tooling and IDE integration\n */\n\n/**\n * Behavior categories for organization.\n * - ui: Visual interaction behaviors (drag, resize, sort)\n * - data: Data manipulation behaviors (remove, transform)\n * - animation: Animation and transition behaviors\n * - form: Form-related behaviors (validation, toggle states)\n * - layout: Layout behaviors (sticky, scrollspy)\n */\nexport type BehaviorCategory = 'ui' | 'data' | 'animation' | 'form' | 'layout';\n\n/**\n * Loading tiers for lazy loading optimization.\n * - core: Always loaded (essential behaviors)\n * - common: High usage (loaded for typical apps)\n * - optional: Low usage (loaded on demand)\n */\nexport type BehaviorTier = 'core' | 'common' | 'optional';\n\n/**\n * Schema for a behavior parameter.\n */\nexport interface ParameterSchema {\n name: string;\n type: 'string' | 'number' | 'boolean' | 'selector' | 'element';\n optional?: boolean;\n default?: string | number | boolean;\n /** Allowed values for constrained parameters */\n enum?: string[];\n description: string;\n}\n\n/**\n * Schema for a behavior event.\n */\nexport interface EventSchema {\n name: string;\n description: string;\n}\n\n/**\n * Complete schema for a behavior.\n * This is the source of truth for all behavior metadata.\n */\nexport interface BehaviorSchema {\n /** Behavior name (PascalCase) */\n name: string;\n /** Category for organization */\n category: BehaviorCategory;\n /** Loading tier for lazy loading */\n tier: BehaviorTier;\n /** Semantic version */\n version: string;\n /** Human-readable description */\n description: string;\n /** Parameter definitions */\n parameters: ParameterSchema[];\n /** Event definitions */\n events: EventSchema[];\n /** The hyperscript behavior source code */\n source: string;\n /** Optional requirements or notes */\n requirements?: string[];\n}\n\n/**\n * Runtime behavior module interface.\n * This is what gets registered with the hyperfixi runtime.\n */\nexport interface BehaviorModule {\n source: string;\n metadata: BehaviorSchema;\n register: (hyperfixi?: LokaScriptInstance) => Promise<void>;\n}\n\n/**\n * Minimal LokaScript instance interface for behavior registration.\n */\nexport interface LokaScriptInstance {\n compileSync: (\n code: string,\n options?: { traditional?: boolean; language?: string }\n ) => {\n ok: boolean;\n ast?: unknown;\n errors?: Array<{ message: string; line?: number; column?: number }>;\n };\n execute: (ast: unknown, ctx: unknown) => Promise<unknown>;\n createContext?: () => { locals: Map<string, unknown>; globals: Map<string, unknown> };\n}\n\n/**\n * Typed window interface for behavior auto-registration.\n * Avoids `(window as any)` casts throughout the codebase.\n * Checks both `window.lokascript` and `window.hyperfixi` for the runtime instance.\n */\nexport interface LokaScriptWindow {\n lokascript?: LokaScriptInstance;\n hyperfixi?: LokaScriptInstance;\n __hyperfixi_behaviors_ready?: Promise<void> | undefined;\n}\n\n/**\n * Resolve the LokaScript runtime from window globals.\n * Checks both `window.lokascript` and `window.hyperfixi`.\n */\nexport function resolveRuntime(): LokaScriptInstance | null {\n if (typeof window === 'undefined') return null;\n const win = window as unknown as LokaScriptWindow;\n return win.lokascript || win.hyperfixi || null;\n}\n"],"mappings":"scAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,aAAAE,EAAA,sBAAAC,EAAA,sBAAAC,EAAA,oBAAAC,ICQO,IAAMC,EAAkC,CAC7C,KAAM,YACN,SAAU,KACV,KAAM,WACN,QAAS,QACT,YAAa,uCACb,WAAY,CACV,CACE,KAAM,WACN,KAAM,SACN,SAAU,GACV,QAAS,GACT,YAAa,yBACf,EACA,CACE,KAAM,YACN,KAAM,SACN,SAAU,GAC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E,QACXI,EAASJ,EAAE,QAEjB,SAASK,EAAOC,EAAkB,CAChC,IAAMC,EAAW,KAAK,IAAIX,EAAM,KAAK,IAAIE,EAAMG,GAAcK,EAAG,QAAUH,EAAO,CAAC,EAC5EK,EAAY,KAAK,IAAIX,EAAM,KAAK,IAAIE,EAAMG,GAAeI,EAAG,QAAUF,EAAO,CAAC,EAEpFZ,EAAQ,MAAM,MAAQ,GAAGe,CAAQ,KACjCf,EAAQ,MAAM,OAAS,GAAGgB,CAAS,KACnChB,EAAQ,cAAc,IAAI,YAAY,mBAAoB,CAAE,QAAS,EAAK,CAAC,CAAC,CAC9E,CAEA,SAASiB,GAAO,CACd,SAAS,oBAAoB,cAAeJ,CAAM,EAClD,SAAS,oBAAoB,YAAaI,CAAI,EAC9CjB,EAAQ,cAAc,IAAI,YAAY,gBAAiB,CAAE,QAAS,EAAK,CAAC,CAAC,CAC3E,CAEA,SAAS,iBAAiB,cAAea,CAAM,EAC/C,SAAS,iBAAiB,YAAaI,CAAI,CAC7C,CAAC,CACH,CAKA,eAAsBC,EAAkBC,EAA+C,CACrF,IAAMC,EAAKD,GAAaE,EAAe,EAEvC,GAAI,CAACD,EACH,MAAM,IAAI,MACR,yFACF,EAGF,IAAME,EAAgB,CACpB,KAAM,WACN,KAAM,YACN,WAAY,CAAC,EACb,cAAe,CAAC,EAChB,oBAAqBvB,CACvB,EACMwB,EAAMH,EAAG,cAAgBA,EAAG,cAAc,EAAI,CAAE,OAAQ,IAAI,IAAO,QAAS,IAAI,GAAM,EAC5F,MAAMA,EAAG,QAAQE,EAAeC,CAAG,CACrC,CAGIF,EAAe,GACjBH,EAAkB,EAAE,MAAM,QAAQ,KAAK,EAGzC,IAAOM,EAAQ,CACb,OAAQ3B,EAAgB,OACxB,SAAUA,EACV,SAAUqB,CACZ","names":["resizable_exports","__export","resizable_default","registerResizable","resizableMetadata","resizableSource","resizableSchema","resolveRuntime","win","resizableSource","resizableSchema","resizableMetadata","installResizable","element","params","handleEl","found","minW","minH","maxW","maxH","e","startWidth","startHeight","startX","startY","onMove","ev","newWidth","newHeight","onUp","registerResizable","hyperfixi","hf","resolveRuntime","syntheticNode","ctx","resizable_default"]}
@@ -333,55 +333,31 @@ behavior FocusTrap(active, initialFocus, returnFocus)
333
333
  if (active) activate();
334
334
  end
335
335
  end
336
- end`.trim()};var u={name:"Sortable",category:"ui",tier:"common",version:"1.0.0",description:"Makes child elements reorderable via drag-and-drop",parameters:[{name:"handle",type:"selector",optional:!0,default:"none",description:"CSS selector for drag handles within items"},{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:`
337
- behavior Sortable(handle, dragClass)
336
+ end`.trim()};var u={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:`
337
+ behavior Sortable(dragClass)
338
338
  init
339
339
  if dragClass is undefined
340
340
  set dragClass to "sorting"
341
341
  end
342
342
  end
343
343
  on pointerdown(clientY) from me
344
- js(me, handle, event)
345
- var target = event.target;
346
- var item = target.closest("li");
347
- if (!item || !me.contains(item)) return false;
348
- if (handle && !target.closest(handle)) return false;
349
- event.preventDefault();
350
- event.stopPropagation();
351
- return true;
352
- end
353
- if it is false
344
+ set item to the closest <li/> to the target
345
+ if item is null
354
346
  exit
355
347
  end
356
- add .{dragClass} to me
348
+ halt the event
349
+ add .{dragClass} to item
357
350
  trigger sortable:start on me
358
351
  repeat until event pointerup from document
359
352
  wait for pointermove(clientY) from document
360
353
  trigger sortable:move on me
361
354
  end
362
- remove .{dragClass} from me
355
+ remove .{dragClass} from item
363
356
  trigger sortable:end on me
364
357
  end
365
- end`.trim()};var p={name:"Resizable",category:"ui",tier:"optional",version:"1.0.0",description:"Makes elements resizable by dragging",parameters:[{name:"handle",type:"selector",optional:!0,default:"me",description:"CSS selector for the resize handle (defaults to the element itself)"},{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:`
366
- behavior Resizable(handle, minWidth, minHeight, maxWidth, maxHeight)
367
- init
368
- if handle is undefined
369
- set handle to me
370
- end
371
- if minWidth is undefined
372
- set minWidth to 50
373
- end
374
- if minHeight is undefined
375
- set minHeight to 50
376
- end
377
- if maxWidth is undefined
378
- set maxWidth to 9999
379
- end
380
- if maxHeight is undefined
381
- set maxHeight to 9999
382
- end
383
- end
384
- on pointerdown(clientX, clientY) from handle
358
+ end`.trim()};var p={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:`
359
+ behavior Resizable(minWidth, minHeight, maxWidth, maxHeight)
360
+ on pointerdown(clientX, clientY) from me
385
361
  halt the event
386
362
  trigger resizable:start
387
363
  measure width
@@ -391,17 +367,19 @@ behavior Resizable(handle, minWidth, minHeight, maxWidth, maxHeight)
391
367
  set startX to clientX
392
368
  set startY to clientY
393
369
  repeat until event pointerup from document
394
- wait for pointermove(clientX, clientY) or pointerup from document
395
- js(startWidth, startHeight, clientX, clientY, startX, startY, minWidth, maxWidth, minHeight, maxHeight, me)
396
- var nw = Math.max(minWidth, Math.min(maxWidth, startWidth + (clientX - startX)));
397
- var nh = Math.max(minHeight, Math.min(maxHeight, startHeight + (clientY - startY)));
398
- me.style.width = nw + 'px';
399
- me.style.height = nh + 'px';
400
- end
370
+ wait for pointermove(clientX, clientY) from document
371
+ set newWidth to startWidth + clientX - startX
372
+ set newHeight to startHeight + clientY - startY
373
+ if newWidth < minWidth then set newWidth to minWidth end
374
+ if newWidth > maxWidth then set newWidth to maxWidth end
375
+ if newHeight < minHeight then set newHeight to minHeight end
376
+ if newHeight > maxHeight then set newHeight to maxHeight end
377
+ set my style.width to newWidth + "px"
378
+ set my style.height to newHeight + "px"
401
379
  trigger resizable:resize
402
380
  end
403
381
  trigger resizable:end
404
382
  end
405
383
  end
406
- `.trim()};var f={Toggleable:a.source,Removable:r.source,AutoDismiss:n.source,Clipboard:o.source,Draggable:s.source,ClickOutside:c.source,ScrollReveal:d.source,Tabs:l.source,FocusTrap:m.source,Sortable:u.source,Resizable:p.source};function b(){let e=window.hyperfixi;if(!e?.compileSync||!e?.execute)return;for(let[h,v]of Object.entries(f)){let i=e.compileSync(v,{traditional:!0});i?.ok&&i.ast&&e.execute(i.ast).catch(()=>{})}let t=e.attributeProcessor;t&&(t.reset(),t.init())}typeof window<"u"&&b();})();
384
+ `.trim()};var f={Toggleable:a.source,Removable:r.source,AutoDismiss:n.source,Clipboard:o.source,Draggable:s.source,ClickOutside:c.source,ScrollReveal:d.source,Tabs:l.source,FocusTrap:m.source,Sortable:u.source,Resizable:p.source};function b(){let e=window.hyperfixi;if(!e?.compileSync||!e?.execute)return;for(let v of Object.values(f)){let i=e.compileSync(v,{traditional:!0});i?.ok&&i.ast&&e.execute(i.ast).catch(()=>{})}let t=e.attributeProcessor;t&&(t.reset(),t.init())}typeof window<"u"&&b();})();
407
385
  //# sourceMappingURL=resolver.browser.global.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/schemas/toggleable.schema.ts","../src/schemas/removable.schema.ts","../src/schemas/autodismiss.schema.ts","../src/schemas/clipboard.schema.ts","../src/schemas/draggable.schema.ts","../src/schemas/clickoutside.schema.ts","../src/schemas/scrollreveal.schema.ts","../src/schemas/tabs.schema.ts","../src/schemas/focustrap.schema.ts","../src/schemas/sortable.schema.ts","../src/schemas/resizable.schema.ts","../src/behavior-resolver.ts","../src/browser-resolver-bundle.ts"],"sourcesContent":["import type { BehaviorSchema } from './types';\n\n/**\n * Toggleable Behavior Schema\n *\n * Toggles a CSS class on click.\n * Useful for accordions, dropdowns, and toggle buttons.\n */\nexport const toggleableSchema: BehaviorSchema = {\n name: 'Toggleable',\n category: 'form',\n tier: 'core',\n version: '1.0.0',\n description: 'Toggles a CSS class on click',\n parameters: [\n {\n name: 'cls',\n type: 'string',\n optional: true,\n default: 'active',\n description: 'CSS class to toggle',\n },\n {\n name: 'target',\n type: 'selector',\n optional: true,\n default: 'me',\n description: 'Element to toggle the class on',\n },\n ],\n events: [\n { name: 'toggleable:on', description: 'Fired when class is added' },\n { name: 'toggleable:off', description: 'Fired when class is removed' },\n ],\n source: `\nbehavior Toggleable(cls, target)\n init\n if cls is undefined\n set cls to \"active\"\n end\n if target is undefined\n set target to me\n end\n end\n on click\n toggle .{cls} on target\n js(target, cls)\n var eventName = target.classList.contains(cls) ? 'toggleable:on' : 'toggleable:off';\n target.dispatchEvent(new CustomEvent(eventName, { bubbles: true }));\n end\n end\nend`.trim(),\n};\n","import type { BehaviorSchema } from './types';\n\n/**\n * Removable Behavior Schema\n *\n * Removes an element when a trigger is clicked.\n * Supports optional confirmation and transition effects.\n *\n * @since 1.2.0 — `trigger` parameter renamed to `triggerEl` to avoid\n * shadowing the hyperscript `trigger` command keyword. Users migrating\n * from v1.x should update: `install Removable(triggerEl: .close-btn)`.\n */\nexport const removableSchema: BehaviorSchema = {\n name: 'Removable',\n category: 'data',\n tier: 'common',\n version: '1.2.0',\n description: 'Makes elements removable on click',\n parameters: [\n {\n name: 'triggerEl',\n type: 'selector',\n optional: true,\n default: 'me',\n description: 'Element that triggers removal (e.g., a close button)',\n },\n {\n name: 'confirmRemoval',\n type: 'boolean',\n optional: true,\n default: false,\n description: 'Show confirmation dialog before removal',\n },\n {\n name: 'effect',\n type: 'string',\n optional: true,\n default: 'none',\n enum: ['fade', 'none'],\n description: 'Transition effect: \"fade\" or \"none\"',\n },\n ],\n events: [\n { name: 'removable:before', description: 'Fired before removal (cancelable)' },\n { name: 'removable:removed', description: 'Fired after removal' },\n ],\n source: `\nbehavior Removable(triggerEl, confirmRemoval, effect)\n init\n if triggerEl is undefined\n set triggerEl to me\n end\n end\n on click from triggerEl\n if confirmRemoval\n js(me)\n if (!window.confirm(\"Are you sure?\")) return \"cancel\";\n end\n if it is \"cancel\"\n halt\n end\n end\n trigger removable:before\n if effect is \"fade\"\n transition opacity to 0 over 300ms\n end\n trigger removable:removed\n remove me\n end\nend\n`.trim(),\n};\n","import type { BehaviorSchema } from './types';\n\n/**\n * AutoDismiss Behavior Schema\n *\n * Auto-removes flash messages and toasts after a configurable delay.\n * Supports pause-on-hover and fade effect.\n */\nexport const autoDismissSchema: BehaviorSchema = {\n name: 'AutoDismiss',\n category: 'ui',\n tier: 'core',\n version: '1.0.0',\n description: 'Auto-removes elements after a delay with optional pause-on-hover',\n parameters: [\n {\n name: 'delay',\n type: 'number',\n optional: true,\n default: 5000,\n description: 'Time in ms before the element is removed',\n },\n {\n name: 'pauseOnHover',\n type: 'boolean',\n optional: true,\n default: true,\n description: 'Pause the countdown when the mouse hovers over the element',\n },\n {\n name: 'effect',\n type: 'string',\n optional: true,\n default: 'none',\n enum: ['fade', 'none'],\n description: 'Transition effect before removal: \"fade\" or \"none\"',\n },\n ],\n events: [\n { name: 'autodismiss:start', description: 'Fired when the countdown timer starts' },\n {\n name: 'autodismiss:dismissed',\n description: 'Fired before removal (cancelable via preventDefault)',\n },\n { name: 'autodismiss:paused', description: 'Fired when the timer is paused on hover' },\n { name: 'autodismiss:resumed', description: 'Fired when the timer resumes on mouseleave' },\n ],\n source: `\nbehavior AutoDismiss(delay, pauseOnHover, effect)\n init\n if delay is undefined\n set delay to 5000\n end\n if pauseOnHover is undefined\n set pauseOnHover to true\n end\n if effect is undefined\n set effect to \"none\"\n end\n js(me, delay, effect, pauseOnHover)\n me.dispatchEvent(new CustomEvent('autodismiss:start', { bubbles: true }));\n var remaining = delay;\n var startedAt = Date.now();\n var timerId = null;\n function dismiss() {\n var ev = new CustomEvent('autodismiss:dismissed', { bubbles: true, cancelable: true });\n me.dispatchEvent(ev);\n if (ev.defaultPrevented) return;\n if (effect === 'fade') {\n me.style.transition = 'opacity 300ms';\n me.style.opacity = '0';\n setTimeout(function() { me.remove(); }, 300);\n } else {\n me.remove();\n }\n }\n function start() {\n startedAt = Date.now();\n timerId = setTimeout(dismiss, remaining);\n }\n start();\n if (pauseOnHover) {\n me.addEventListener('mouseenter', function() {\n if (timerId != null) {\n clearTimeout(timerId);\n timerId = null;\n remaining -= Date.now() - startedAt;\n if (remaining < 0) remaining = 0;\n me.dispatchEvent(new CustomEvent('autodismiss:paused', { bubbles: true }));\n }\n });\n me.addEventListener('mouseleave', function() {\n if (timerId == null && me.isConnected) {\n me.dispatchEvent(new CustomEvent('autodismiss:resumed', { bubbles: true }));\n start();\n }\n });\n }\n end\n end\nend`.trim(),\n};\n","import type { BehaviorSchema } from './types';\n\n/**\n * Clipboard Behavior Schema\n *\n * Copies text to clipboard on click with visual feedback.\n * Uses the Clipboard API with execCommand fallback.\n */\nexport const clipboardSchema: BehaviorSchema = {\n name: 'Clipboard',\n category: 'ui',\n tier: 'core',\n version: '1.0.0',\n description: 'Copies text to clipboard on click with visual feedback',\n parameters: [\n {\n name: 'text',\n type: 'string',\n optional: true,\n description: 'Literal text to copy (takes priority over source)',\n },\n {\n name: 'source',\n type: 'selector',\n optional: true,\n default: 'me',\n description: 'Element whose textContent or value is copied',\n },\n {\n name: 'feedback',\n type: 'selector',\n optional: true,\n description: 'Element to show .copied feedback on (defaults to the installed element)',\n },\n {\n name: 'feedbackDuration',\n type: 'number',\n optional: true,\n default: 2000,\n description: 'Duration in ms to show .copied class feedback',\n },\n ],\n events: [\n { name: 'clipboard:copied', description: 'Fired after text is copied successfully' },\n { name: 'clipboard:error', description: 'Fired when clipboard write fails' },\n ],\n requirements: [\n 'navigator.clipboard.writeText() requires HTTPS or localhost',\n 'Falls back to document.execCommand(\"copy\") for older browsers',\n ],\n source: `\nbehavior Clipboard(text, source, feedback, feedbackDuration)\n init\n if feedbackDuration is undefined\n set feedbackDuration to 2000\n end\n if source is undefined\n set source to me\n end\n end\n on click\n if text is not undefined\n set copyText to text\n else\n set copyText to source's textContent\n end\n js(me, copyText, feedback, feedbackDuration)\n async function copyToClipboard(t) {\n if (navigator.clipboard && navigator.clipboard.writeText) {\n await navigator.clipboard.writeText(t);\n return;\n }\n var ta = document.createElement('textarea');\n ta.value = t;\n ta.style.position = 'fixed';\n ta.style.opacity = '0';\n document.body.appendChild(ta);\n ta.select();\n try { document.execCommand('copy'); } finally { document.body.removeChild(ta); }\n }\n try {\n await copyToClipboard(copyText);\n var feedbackEl = feedback ? (typeof feedback === 'string' ? document.querySelector(feedback) : feedback) : me;\n if (!feedbackEl) feedbackEl = me;\n feedbackEl.classList.add('copied');\n me.dispatchEvent(new CustomEvent('clipboard:copied', { bubbles: true, detail: { text: copyText } }));\n setTimeout(function() { feedbackEl.classList.remove('copied'); }, feedbackDuration);\n } catch(err) {\n me.dispatchEvent(new CustomEvent('clipboard:error', { bubbles: true, detail: { error: err } }));\n }\n end\n end\nend`.trim(),\n};\n","import type { BehaviorSchema } from './types';\n\n/**\n * Draggable Behavior Schema\n *\n * Makes elements draggable with pointer events.\n * Supports custom drag handles and lifecycle events.\n */\nexport const draggableSchema: BehaviorSchema = {\n name: 'Draggable',\n category: 'ui',\n tier: 'core',\n version: '1.0.0',\n description: 'Makes elements draggable with pointer events',\n parameters: [\n {\n name: 'dragHandle',\n type: 'selector',\n optional: true,\n default: 'me',\n description: 'CSS selector for the drag handle element',\n },\n ],\n events: [\n { name: 'draggable:start', description: 'Fired when drag begins' },\n { name: 'draggable:move', description: 'Fired during each movement' },\n { name: 'draggable:end', description: 'Fired when drag completes' },\n ],\n requirements: ['position: absolute or position: fixed on the element'],\n source: `\nbehavior Draggable(dragHandle)\n init\n if no dragHandle set dragHandle to me\n end\n on pointerdown(clientX, clientY) from dragHandle\n halt the event\n trigger draggable:start\n measure x\n set startX to it\n measure y\n set startY to it\n set xoff to clientX - startX\n set yoff to clientY - startY\n repeat until event pointerup from document\n wait for pointermove(clientX, clientY) or\n pointerup(clientX, clientY) from document\n add { left: \\${clientX - xoff}px; top: \\${clientY - yoff}px; }\n trigger draggable:move\n end\n trigger draggable:end\n end\nend\n`.trim(),\n};\n","import type { BehaviorSchema } from './types';\n\n/**\n * ClickOutside Behavior Schema\n *\n * Fires an event when the user clicks outside the element.\n * Uses pointerdown instead of click to avoid timing issues.\n */\nexport const clickOutsideSchema: BehaviorSchema = {\n name: 'ClickOutside',\n category: 'ui',\n tier: 'core',\n version: '1.0.0',\n description: 'Fires an event when the user clicks outside the element',\n parameters: [\n {\n name: 'active',\n type: 'boolean',\n optional: true,\n default: true,\n description: 'Whether the listener is active (can be toggled programmatically)',\n },\n ],\n events: [\n { name: 'clickoutside', description: 'Fired when a pointer press occurs outside the element' },\n {\n name: 'clickoutside:activate',\n description: 'Listen for this event to programmatically activate detection',\n },\n {\n name: 'clickoutside:deactivate',\n description: 'Listen for this event to programmatically deactivate detection',\n },\n ],\n requirements: ['Uses pointerdown instead of click to avoid timing issues with removed elements'],\n source: `\nbehavior ClickOutside(active)\n init\n if active is undefined\n set active to true\n end\n end\n on pointerdown from document\n js(me, active)\n if (!me.isConnected) return;\n if (active && !me.contains(event.target)) {\n me.dispatchEvent(new CustomEvent('clickoutside', { bubbles: true }));\n }\n end\n end\n on clickoutside:activate\n set active to true\n end\n on clickoutside:deactivate\n set active to false\n end\nend`.trim(),\n};\n","import type { BehaviorSchema } from './types';\n\n/**\n * ScrollReveal Behavior Schema\n *\n * Adds a class or fires events when the element enters or exits the viewport.\n * Uses the IntersectionObserver web standard API.\n */\nexport const scrollRevealSchema: BehaviorSchema = {\n name: 'ScrollReveal',\n category: 'layout',\n tier: 'common',\n version: '1.0.0',\n description: 'Adds a class when the element enters the viewport via IntersectionObserver',\n parameters: [\n {\n name: 'cls',\n type: 'string',\n optional: true,\n default: 'revealed',\n description: 'CSS class added when element enters viewport',\n },\n {\n name: 'threshold',\n type: 'number',\n optional: true,\n default: 0.1,\n description: 'Intersection ratio threshold (0-1) for triggering',\n },\n {\n name: 'once',\n type: 'boolean',\n optional: true,\n default: true,\n description: 'If true, disconnect observer after first intersection',\n },\n ],\n events: [\n { name: 'scrollreveal:enter', description: 'Fired when the element enters the viewport' },\n { name: 'scrollreveal:exit', description: 'Fired when the element exits the viewport' },\n ],\n requirements: ['Uses IntersectionObserver API (supported in all modern browsers)'],\n source: `\nbehavior ScrollReveal(cls, threshold, once)\n init\n if cls is undefined\n set cls to \"revealed\"\n end\n if threshold is undefined\n set threshold to 0.1\n end\n if once is undefined\n set once to true\n end\n js(me, cls, threshold, once)\n var obs = new IntersectionObserver(function(entries) {\n for (var i = 0; i < entries.length; i++) {\n if (entries[i].isIntersecting) {\n me.classList.add(cls);\n me.dispatchEvent(new CustomEvent('scrollreveal:enter', { bubbles: true }));\n if (once) obs.disconnect();\n } else if (!once) {\n me.classList.remove(cls);\n me.dispatchEvent(new CustomEvent('scrollreveal:exit', { bubbles: true }));\n }\n }\n }, { threshold: threshold });\n obs.observe(me);\n end\n end\nend`.trim(),\n};\n","import type { BehaviorSchema } from './types';\n\nexport const tabsSchema: BehaviorSchema = {\n name: 'Tabs',\n category: 'ui',\n tier: 'core',\n version: '1.0.0',\n description:\n 'WAI-ARIA compliant tabs with roving tabindex keyboard navigation. ' +\n 'Auto-wires role, aria-selected, aria-controls, and aria-labelledby attributes.',\n parameters: [\n {\n name: 'orientation',\n type: 'string',\n optional: true,\n default: 'horizontal',\n enum: ['horizontal', 'vertical'],\n description: 'Arrow key direction: horizontal (Left/Right) or vertical (Up/Down)',\n },\n {\n name: 'activeTab',\n type: 'number',\n optional: true,\n default: 0,\n description: 'Initial active tab index (zero-based)',\n },\n {\n name: 'wrap',\n type: 'boolean',\n optional: true,\n default: true,\n description: 'Wrap to first/last tab when navigating past the end',\n },\n {\n name: 'activeClass',\n type: 'string',\n optional: true,\n default: 'active',\n description: 'CSS class applied to the active tab and its panel',\n },\n ],\n events: [\n {\n name: 'tabs:change',\n description: 'Fired before tab selection changes (cancelable via preventDefault)',\n },\n { name: 'tabs:changed', description: 'Fired after tab selection has changed' },\n ],\n requirements: [\n 'Sets role=\"tablist\" on the tab container',\n 'Sets role=\"tab\" on tab buttons and role=\"tabpanel\" on content panels',\n 'Manages aria-selected, aria-controls, aria-labelledby, and tabindex',\n 'Keyboard: Arrow keys navigate, Home/End jump to first/last, Tab exits tablist',\n ],\n source: `\nbehavior Tabs(orientation, activeTab, wrap, activeClass)\n init\n if orientation is undefined\n set orientation to \"horizontal\"\n end\n if activeTab is undefined\n set activeTab to 0\n end\n if wrap is undefined\n set wrap to true\n end\n if activeClass is undefined\n set activeClass to \"active\"\n end\n js(me, orientation, activeTab, wrap, activeClass)\n var tabs = Array.from(me.querySelectorAll('[role=\"tab\"]'));\n var panels = Array.from(me.querySelectorAll('[role=\"tabpanel\"]'));\n if (tabs.length === 0 || panels.length === 0) return;\n var tablist = me.querySelector('[role=\"tablist\"]') || tabs[0].parentElement;\n if (tablist) tablist.setAttribute('aria-orientation', orientation);\n var count = Math.min(tabs.length, panels.length);\n var idN = 0;\n for (var i = 0; i < count; i++) {\n if (!tabs[i].id) tabs[i].id = 'tab-' + (++idN);\n if (!panels[i].id) panels[i].id = 'tabpanel-' + idN;\n tabs[i].setAttribute('aria-controls', panels[i].id);\n panels[i].setAttribute('aria-labelledby', tabs[i].id);\n }\n var cur = Math.max(0, Math.min(activeTab, count - 1));\n function activate(idx, prev) {\n if (idx === prev || idx < 0 || idx >= count) return false;\n var ev = new CustomEvent('tabs:change', { bubbles: true, cancelable: true, detail: { index: idx, previousIndex: prev } });\n me.dispatchEvent(ev);\n if (ev.defaultPrevented) return false;\n if (prev >= 0 && prev < count) {\n tabs[prev].setAttribute('aria-selected', 'false');\n tabs[prev].setAttribute('tabindex', '-1');\n tabs[prev].classList.remove(activeClass);\n panels[prev].setAttribute('aria-hidden', 'true');\n panels[prev].classList.remove(activeClass);\n }\n tabs[idx].setAttribute('aria-selected', 'true');\n tabs[idx].setAttribute('tabindex', '0');\n tabs[idx].classList.add(activeClass);\n panels[idx].setAttribute('aria-hidden', 'false');\n panels[idx].classList.add(activeClass);\n cur = idx;\n me.dispatchEvent(new CustomEvent('tabs:changed', { bubbles: true, detail: { index: idx } }));\n return true;\n }\n for (var j = 0; j < count; j++) {\n tabs[j].setAttribute('aria-selected', 'false');\n tabs[j].setAttribute('tabindex', '-1');\n panels[j].setAttribute('aria-hidden', 'true');\n panels[j].classList.remove(activeClass);\n }\n tabs[cur].setAttribute('aria-selected', 'true');\n tabs[cur].setAttribute('tabindex', '0');\n tabs[cur].classList.add(activeClass);\n panels[cur].setAttribute('aria-hidden', 'false');\n panels[cur].classList.add(activeClass);\n for (var k = 0; k < count; k++) {\n (function(idx) {\n tabs[idx].addEventListener('click', function() { if (activate(idx, cur)) tabs[idx].focus(); });\n })(k);\n }\n (tablist || me).addEventListener('keydown', function(e) {\n var nk = orientation === 'horizontal' ? 'ArrowRight' : 'ArrowDown';\n var pk = orientation === 'horizontal' ? 'ArrowLeft' : 'ArrowUp';\n var next = null;\n if (e.key === nk) { next = cur + 1; if (next >= count) next = wrap ? 0 : null; }\n else if (e.key === pk) { next = cur - 1; if (next < 0) next = wrap ? count - 1 : null; }\n else if (e.key === 'Home') next = 0;\n else if (e.key === 'End') next = count - 1;\n if (next !== null) { e.preventDefault(); if (activate(next, cur)) tabs[next].focus(); }\n });\n end\n end\nend`.trim(),\n};\n","import type { BehaviorSchema } from './types';\n\n/**\n * FocusTrap Behavior Schema\n *\n * Confines Tab navigation inside an element and restores focus on release.\n * Manages aria-modal for accessibility compliance.\n */\nexport const focusTrapSchema: BehaviorSchema = {\n name: 'FocusTrap',\n category: 'ui',\n tier: 'core',\n version: '1.0.0',\n description: 'Confines Tab navigation inside an element with ARIA support',\n parameters: [\n {\n name: 'active',\n type: 'boolean',\n optional: true,\n default: true,\n description: 'Whether the trap is active on install',\n },\n {\n name: 'initialFocus',\n type: 'selector',\n optional: true,\n description: 'Element to focus when the trap activates',\n },\n {\n name: 'returnFocus',\n type: 'boolean',\n optional: true,\n default: true,\n description: 'Restore focus to the previously focused element on deactivation',\n },\n ],\n events: [\n { name: 'focustrap:activated', description: 'Fired when the trap is activated' },\n { name: 'focustrap:deactivated', description: 'Fired when the trap is deactivated' },\n ],\n requirements: [\n 'Sets aria-modal=\"true\" on the element when active',\n 'Listens for focustrap:activate and focustrap:deactivate custom events for programmatic control',\n ],\n source: `\nbehavior FocusTrap(active, initialFocus, returnFocus)\n init\n if active is undefined\n set active to true\n end\n if returnFocus is undefined\n set returnFocus to true\n end\n js(me, active, initialFocus, returnFocus)\n var FOCUSABLE = 'a[href],button:not(:disabled),input:not(:disabled),select:not(:disabled),textarea:not(:disabled),[tabindex]:not([tabindex=\"-1\"])';\n var isActive = false;\n var previouslyFocused = null;\n function getFocusable() { return Array.from(me.querySelectorAll(FOCUSABLE)); }\n function activate() {\n if (isActive) return;\n isActive = true;\n previouslyFocused = document.activeElement;\n me.setAttribute('aria-modal', 'true');\n var initEl = initialFocus ? (typeof initialFocus === 'string' ? me.querySelector(initialFocus) : initialFocus) : null;\n if (initEl) { initEl.focus(); } else { var f = getFocusable(); if (f.length) f[0].focus(); }\n me.dispatchEvent(new CustomEvent('focustrap:activated', { bubbles: true }));\n }\n function deactivate() {\n if (!isActive) return;\n isActive = false;\n me.removeAttribute('aria-modal');\n if (returnFocus && previouslyFocused instanceof HTMLElement) previouslyFocused.focus();\n previouslyFocused = null;\n me.dispatchEvent(new CustomEvent('focustrap:deactivated', { bubbles: true }));\n }\n me.addEventListener('keydown', function(e) {\n if (!isActive || e.key !== 'Tab') return;\n var focusable = getFocusable();\n if (focusable.length === 0) { e.preventDefault(); return; }\n e.preventDefault();\n var idx = focusable.indexOf(document.activeElement);\n if (e.shiftKey) {\n focusable[idx <= 0 ? focusable.length - 1 : idx - 1].focus();\n } else {\n focusable[idx >= focusable.length - 1 ? 0 : idx + 1].focus();\n }\n });\n me.addEventListener('focustrap:activate', function() { activate(); });\n me.addEventListener('focustrap:deactivate', function() { deactivate(); });\n if (active) activate();\n end\n end\nend`.trim(),\n};\n","import type { BehaviorSchema } from './types';\n\n/**\n * Sortable Behavior Schema\n *\n * Drag-and-drop reordering of list items.\n * Apply to a container element; children become sortable.\n *\n * Note: This behavior fires lifecycle events but does NOT automatically\n * reorder DOM elements. Users must handle actual reordering in their\n * `sortable:move` event handlers.\n */\nexport const sortableSchema: BehaviorSchema = {\n name: 'Sortable',\n category: 'ui',\n tier: 'common',\n version: '1.0.0',\n description: 'Makes child elements reorderable via drag-and-drop',\n parameters: [\n {\n name: 'handle',\n type: 'selector',\n optional: true,\n default: 'none',\n description: 'CSS selector for drag handles within items',\n },\n {\n name: 'dragClass',\n type: 'string',\n optional: true,\n default: 'sorting',\n description: 'CSS class added to item during drag',\n },\n ],\n events: [\n { name: 'sortable:start', description: 'Fired when drag begins' },\n {\n name: 'sortable:move',\n description: 'Fired during drag — handle this event to reorder DOM elements',\n },\n { name: 'sortable:end', description: 'Fired when drag completes' },\n ],\n requirements: ['Users must handle DOM reordering in sortable:move event handlers'],\n source: `\nbehavior Sortable(handle, dragClass)\n init\n if dragClass is undefined\n set dragClass to \"sorting\"\n end\n end\n on pointerdown(clientY) from me\n js(me, handle, event)\n var target = event.target;\n var item = target.closest(\"li\");\n if (!item || !me.contains(item)) return false;\n if (handle && !target.closest(handle)) return false;\n event.preventDefault();\n event.stopPropagation();\n return true;\n end\n if it is false\n exit\n end\n add .{dragClass} to me\n trigger sortable:start on me\n repeat until event pointerup from document\n wait for pointermove(clientY) from document\n trigger sortable:move on me\n end\n remove .{dragClass} from me\n trigger sortable:end on me\n end\nend`.trim(),\n};\n","import type { BehaviorSchema } from './types';\n\n/**\n * Resizable Behavior Schema\n *\n * Makes elements resizable by dragging edges or corners.\n * Supports minimum/maximum dimensions and resize handles.\n */\nexport const resizableSchema: BehaviorSchema = {\n name: 'Resizable',\n category: 'ui',\n tier: 'optional',\n version: '1.0.0',\n description: 'Makes elements resizable by dragging',\n parameters: [\n {\n name: 'handle',\n type: 'selector',\n optional: true,\n default: 'me',\n description: 'CSS selector for the resize handle (defaults to the element itself)',\n },\n {\n name: 'minWidth',\n type: 'number',\n optional: true,\n default: 50,\n description: 'Minimum width in pixels',\n },\n {\n name: 'minHeight',\n type: 'number',\n optional: true,\n default: 50,\n description: 'Minimum height in pixels',\n },\n {\n name: 'maxWidth',\n type: 'number',\n optional: true,\n default: 9999,\n description: 'Maximum width in pixels',\n },\n {\n name: 'maxHeight',\n type: 'number',\n optional: true,\n default: 9999,\n description: 'Maximum height in pixels',\n },\n ],\n events: [\n { name: 'resizable:start', description: 'Fired when resize begins' },\n { name: 'resizable:resize', description: 'Fired during resize' },\n { name: 'resizable:end', description: 'Fired when resize completes' },\n ],\n source: `\nbehavior Resizable(handle, minWidth, minHeight, maxWidth, maxHeight)\n init\n if handle is undefined\n set handle to me\n end\n if minWidth is undefined\n set minWidth to 50\n end\n if minHeight is undefined\n set minHeight to 50\n end\n if maxWidth is undefined\n set maxWidth to 9999\n end\n if maxHeight is undefined\n set maxHeight to 9999\n end\n end\n on pointerdown(clientX, clientY) from handle\n halt the event\n trigger resizable:start\n measure width\n set startWidth to it\n measure height\n set startHeight to it\n set startX to clientX\n set startY to clientY\n repeat until event pointerup from document\n wait for pointermove(clientX, clientY) or pointerup from document\n js(startWidth, startHeight, clientX, clientY, startX, startY, minWidth, maxWidth, minHeight, maxHeight, me)\n var nw = Math.max(minWidth, Math.min(maxWidth, startWidth + (clientX - startX)));\n var nh = Math.max(minHeight, Math.min(maxHeight, startHeight + (clientY - startY)));\n me.style.width = nw + 'px';\n me.style.height = nh + 'px';\n end\n trigger resizable:resize\n end\n trigger resizable:end\n end\nend\n`.trim(),\n};\n","/**\n * Behavior Resolver — Lazy compilation of hyperscript behaviors\n *\n * Provides a resolver function that compiles behavior source strings on demand.\n * When the runtime encounters `install X` and X isn't registered, it calls\n * the resolver. If the resolver has source for X, it compiles it, registers\n * the behavior, and installation proceeds normally.\n *\n * @example\n * ```typescript\n * import { createBehaviorResolver } from '@hyperfixi/behaviors/resolver';\n *\n * const resolve = createBehaviorResolver(window.hyperfixi, window._hyperscript.behaviors);\n * window._hyperscript.behaviors.resolve = resolve;\n *\n * // Now `install Toggleable` will compile the behavior on first use\n * ```\n */\n\nimport { toggleableSchema } from './schemas/toggleable.schema';\nimport { removableSchema } from './schemas/removable.schema';\nimport { autoDismissSchema } from './schemas/autodismiss.schema';\nimport { clipboardSchema } from './schemas/clipboard.schema';\nimport { draggableSchema } from './schemas/draggable.schema';\nimport { clickOutsideSchema } from './schemas/clickoutside.schema';\nimport { scrollRevealSchema } from './schemas/scrollreveal.schema';\nimport { tabsSchema } from './schemas/tabs.schema';\nimport { focusTrapSchema } from './schemas/focustrap.schema';\nimport { sortableSchema } from './schemas/sortable.schema';\nimport { resizableSchema } from './schemas/resizable.schema';\n\nexport const BEHAVIOR_SOURCES: Record<string, string> = {\n Toggleable: toggleableSchema.source,\n Removable: removableSchema.source,\n AutoDismiss: autoDismissSchema.source,\n Clipboard: clipboardSchema.source,\n Draggable: draggableSchema.source,\n ClickOutside: clickOutsideSchema.source,\n ScrollReveal: scrollRevealSchema.source,\n Tabs: tabsSchema.source,\n FocusTrap: focusTrapSchema.source,\n Sortable: sortableSchema.source,\n Resizable: resizableSchema.source,\n};\n\ninterface CompileResult {\n ok: boolean;\n ast?: any;\n errors?: unknown[];\n}\n\ninterface BehaviorAPI {\n set(name: string, definition: any): void;\n}\n\ninterface HyperFixiAPI {\n compileSync(code: string, options?: { traditional?: boolean }): CompileResult;\n}\n\n/**\n * Create a behavior resolver that compiles hyperscript source on demand.\n *\n * The returned function is meant to be assigned to `_hyperscript.behaviors.resolve`.\n * When called with a behavior name, it looks up the source, compiles it,\n * and registers the resulting AST in the behavior registry.\n *\n * @param hyperfixi - The hyperfixi API (needs compileSync)\n * @param behaviorAPI - The behavior registry API (needs set)\n * @returns Resolver function: (name: string) => boolean\n */\nexport function createBehaviorResolver(\n hyperfixi: HyperFixiAPI,\n behaviorAPI: BehaviorAPI\n): (name: string) => boolean {\n return (name: string): boolean => {\n const source = BEHAVIOR_SOURCES[name];\n if (!source) return false;\n\n const result = hyperfixi.compileSync(source, { traditional: true });\n if (!result.ok || !result.ast) return false;\n\n const ast = result.ast as any;\n behaviorAPI.set(name, {\n name: ast.name,\n parameters: ast.parameters,\n eventHandlers: ast.eventHandlers,\n initBlock: ast.initBlock,\n });\n return true;\n };\n}\n","/**\n * Browser Behavior Resolver Bundle\n *\n * Pre-registers all standard behavior definitions with the hyperfixi runtime.\n * Include after hyperfixi.js — all standard behaviors become available.\n *\n * Usage:\n * <script src=\"hyperfixi.js\"></script>\n * <script src=\"hyperfixi-behaviors.js\"></script>\n * <!-- install Toggleable, Draggable, etc. just work -->\n */\n\nimport { BEHAVIOR_SOURCES } from './behavior-resolver';\n\nfunction init() {\n const hf = (window as any).hyperfixi;\n if (!hf?.compileSync || !hf?.execute) return;\n\n // Compile and register each behavior definition with the runtime.\n // This is equivalent to having them in a <script type=\"text/hyperscript\"> block.\n for (const [name, source] of Object.entries(BEHAVIOR_SOURCES)) {\n const result = hf.compileSync(source, { traditional: true });\n if (result?.ok && result.ast) {\n // execute() registers the behavior in the runtime's behaviorRegistry\n hf.execute(result.ast).catch(() => {\n // Async — errors handled silently\n });\n }\n }\n\n // Re-scan: the attribute processor may have already processed elements\n // and failed (behaviors weren't registered). Reset and re-init.\n const ap = hf.attributeProcessor;\n if (ap) {\n ap.reset();\n ap.init();\n }\n}\n\nif (typeof window !== 'undefined') {\n init();\n}\n"],"mappings":"0CAQO,IAAMA,EAAmC,CAC9C,KAAM,aACN,SAAU,OACV,KAAM,OACN,QAAS,QACT,YAAa,+BACb,WAAY,CACV,CACE,KAAM,MACN,KAAM,SACN,SAAU,GACV,QAAS,SACT,YAAa,qBACf,EACA,CACE,KAAM,SACN,KAAM,WACN,SAAU,GACV,QAAS,KACT,YAAa,gCACf,CACF,EACA,OAAQ,CACN,CAAE,KAAM,gBAAiB,YAAa,2BAA4B,EAClE,CAAE,KAAM,iBAAkB,YAAa,6BAA8B,CACvE,EACA,OAAQ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,KAiBL,KAAK,CACV,ECxCO,IAAMC,EAAkC,CAC7C,KAAM,YACN,SAAU,OACV,KAAM,SACN,QAAS,QACT,YAAa,oCACb,WAAY,CACV,CACE,KAAM,YACN,KAAM,WACN,SAAU,GACV,QAAS,KACT,YAAa,sDACf,EACA,CACE,KAAM,iBACN,KAAM,UACN,SAAU,GACV,QAAS,GACT,YAAa,yCACf,EACA,CACE,KAAM,SACN,KAAM,SACN,SAAU,GACV,QAAS,OACT,KAAM,CAAC,OAAQ,MAAM,EACrB,YAAa,qCACf,CACF,EACA,OAAQ,CACN,CAAE,KAAM,mBAAoB,YAAa,mCAAoC,EAC7E,CAAE,KAAM,oBAAqB,YAAa,qBAAsB,CAClE,EACA,OAAQ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA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ACtE,EACA,OAAQ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAyCR,KAAK,CACP,ECnEO,IAAMC,EAA2C,CACtD,WAAYC,EAAiB,OAC7B,UAAWC,EAAgB,OAC3B,YAAaC,EAAkB,OAC/B,UAAWC,EAAgB,OAC3B,UAAWC,EAAgB,OAC3B,aAAcC,EAAmB,OACjC,aAAcC,EAAmB,OACjC,KAAMC,EAAW,OACjB,UAAWC,EAAgB,OAC3B,SAAUC,EAAe,OACzB,UAAWC,EAAgB,MAC7B,EC7BA,SAASC,GAAO,CACd,IAAMC,EAAM,OAAe,UAC3B,GAAI,CAACA,GAAI,aAAe,CAACA,GAAI,QAAS,OAItC,OAAW,CAACC,EAAMC,CAAM,IAAK,OAAO,QAAQC,CAAgB,EAAG,CAC7D,IAAMC,EAASJ,EAAG,YAAYE,EAAQ,CAAE,YAAa,EAAK,CAAC,EACvDE,GAAQ,IAAMA,EAAO,KAEvBJ,EAAG,QAAQI,EAAO,GAAG,EAAE,MAAM,IAAM,CAEnC,CAAC,CAEL,CAIA,IAAMC,EAAKL,EAAG,mBACVK,IACFA,EAAG,MAAM,EACTA,EAAG,KAAK,EAEZ,CAEI,OAAO,OAAW,KACpBN,EAAK","names":["toggleableSchema","removableSchema","autoDismissSchema","clipboardSchema","draggableSchema","clickOutsideSchema","scrollRevealSchema","tabsSchema","focusTrapSchema","sortableSchema","resizableSchema","BEHAVIOR_SOURCES","toggleableSchema","removableSchema","autoDismissSchema","clipboardSchema","draggableSchema","clickOutsideSchema","scrollRevealSchema","tabsSchema","focusTrapSchema","sortableSchema","resizableSchema","init","hf","name","source","BEHAVIOR_SOURCES","result","ap"]}
1
+ {"version":3,"sources":["../src/schemas/toggleable.schema.ts","../src/schemas/removable.schema.ts","../src/schemas/autodismiss.schema.ts","../src/schemas/clipboard.schema.ts","../src/schemas/draggable.schema.ts","../src/schemas/clickoutside.schema.ts","../src/schemas/scrollreveal.schema.ts","../src/schemas/tabs.schema.ts","../src/schemas/focustrap.schema.ts","../src/schemas/sortable.schema.ts","../src/schemas/resizable.schema.ts","../src/behavior-resolver.ts","../src/browser-resolver-bundle.ts"],"sourcesContent":["import type { BehaviorSchema } from './types';\n\n/**\n * Toggleable Behavior Schema\n *\n * Toggles a CSS class on click.\n * Useful for accordions, dropdowns, and toggle buttons.\n */\nexport const toggleableSchema: BehaviorSchema = {\n name: 'Toggleable',\n category: 'form',\n tier: 'core',\n version: '1.0.0',\n description: 'Toggles a CSS class on click',\n parameters: [\n {\n name: 'cls',\n type: 'string',\n optional: true,\n default: 'active',\n description: 'CSS class to toggle',\n },\n {\n name: 'target',\n type: 'selector',\n optional: true,\n default: 'me',\n description: 'Element to toggle the class on',\n },\n ],\n events: [\n { name: 'toggleable:on', description: 'Fired when class is added' },\n { name: 'toggleable:off', description: 'Fired when class is removed' },\n ],\n source: `\nbehavior Toggleable(cls, target)\n init\n if cls is undefined\n set cls to \"active\"\n end\n if target is undefined\n set target to me\n end\n end\n on click\n toggle .{cls} on target\n js(target, cls)\n var eventName = target.classList.contains(cls) ? 'toggleable:on' : 'toggleable:off';\n target.dispatchEvent(new CustomEvent(eventName, { bubbles: true }));\n end\n end\nend`.trim(),\n};\n","import type { BehaviorSchema } from './types';\n\n/**\n * Removable Behavior Schema\n *\n * Removes an element when a trigger is clicked.\n * Supports optional confirmation and transition effects.\n *\n * @since 1.2.0 — `trigger` parameter renamed to `triggerEl` to avoid\n * shadowing the hyperscript `trigger` command keyword. Users migrating\n * from v1.x should update: `install Removable(triggerEl: .close-btn)`.\n */\nexport const removableSchema: BehaviorSchema = {\n name: 'Removable',\n category: 'data',\n tier: 'common',\n version: '1.2.0',\n description: 'Makes elements removable on click',\n parameters: [\n {\n name: 'triggerEl',\n type: 'selector',\n optional: true,\n default: 'me',\n description: 'Element that triggers removal (e.g., a close button)',\n },\n {\n name: 'confirmRemoval',\n type: 'boolean',\n optional: true,\n default: false,\n description: 'Show confirmation dialog before removal',\n },\n {\n name: 'effect',\n type: 'string',\n optional: true,\n default: 'none',\n enum: ['fade', 'none'],\n description: 'Transition effect: \"fade\" or \"none\"',\n },\n ],\n events: [\n { name: 'removable:before', description: 'Fired before removal (cancelable)' },\n { name: 'removable:removed', description: 'Fired after removal' },\n ],\n source: `\nbehavior Removable(triggerEl, confirmRemoval, effect)\n init\n if triggerEl is undefined\n set triggerEl to me\n end\n end\n on click from triggerEl\n if confirmRemoval\n js(me)\n if (!window.confirm(\"Are you sure?\")) return \"cancel\";\n end\n if it is \"cancel\"\n halt\n end\n end\n trigger removable:before\n if effect is \"fade\"\n transition opacity to 0 over 300ms\n end\n trigger removable:removed\n remove me\n end\nend\n`.trim(),\n};\n","import type { BehaviorSchema } from './types';\n\n/**\n * AutoDismiss Behavior Schema\n *\n * Auto-removes flash messages and toasts after a configurable delay.\n * Supports pause-on-hover and fade effect.\n */\nexport const autoDismissSchema: BehaviorSchema = {\n name: 'AutoDismiss',\n category: 'ui',\n tier: 'core',\n version: '1.0.0',\n description: 'Auto-removes elements after a delay with optional pause-on-hover',\n parameters: [\n {\n name: 'delay',\n type: 'number',\n optional: true,\n default: 5000,\n description: 'Time in ms before the element is removed',\n },\n {\n name: 'pauseOnHover',\n type: 'boolean',\n optional: true,\n default: true,\n description: 'Pause the countdown when the mouse hovers over the element',\n },\n {\n name: 'effect',\n type: 'string',\n optional: true,\n default: 'none',\n enum: ['fade', 'none'],\n description: 'Transition effect before removal: \"fade\" or \"none\"',\n },\n ],\n events: [\n { name: 'autodismiss:start', description: 'Fired when the countdown timer starts' },\n {\n name: 'autodismiss:dismissed',\n description: 'Fired before removal (cancelable via preventDefault)',\n },\n { name: 'autodismiss:paused', description: 'Fired when the timer is paused on hover' },\n { name: 'autodismiss:resumed', description: 'Fired when the timer resumes on mouseleave' },\n ],\n source: `\nbehavior AutoDismiss(delay, pauseOnHover, effect)\n init\n if delay is undefined\n set delay to 5000\n end\n if pauseOnHover is undefined\n set pauseOnHover to true\n end\n if effect is undefined\n set effect to \"none\"\n end\n js(me, delay, effect, pauseOnHover)\n me.dispatchEvent(new CustomEvent('autodismiss:start', { bubbles: true }));\n var remaining = delay;\n var startedAt = Date.now();\n var timerId = null;\n function dismiss() {\n var ev = new CustomEvent('autodismiss:dismissed', { bubbles: true, cancelable: true });\n me.dispatchEvent(ev);\n if (ev.defaultPrevented) return;\n if (effect === 'fade') {\n me.style.transition = 'opacity 300ms';\n me.style.opacity = '0';\n setTimeout(function() { me.remove(); }, 300);\n } else {\n me.remove();\n }\n }\n function start() {\n startedAt = Date.now();\n timerId = setTimeout(dismiss, remaining);\n }\n start();\n if (pauseOnHover) {\n me.addEventListener('mouseenter', function() {\n if (timerId != null) {\n clearTimeout(timerId);\n timerId = null;\n remaining -= Date.now() - startedAt;\n if (remaining < 0) remaining = 0;\n me.dispatchEvent(new CustomEvent('autodismiss:paused', { bubbles: true }));\n }\n });\n me.addEventListener('mouseleave', function() {\n if (timerId == null && me.isConnected) {\n me.dispatchEvent(new CustomEvent('autodismiss:resumed', { bubbles: true }));\n start();\n }\n });\n }\n end\n end\nend`.trim(),\n};\n","import type { BehaviorSchema } from './types';\n\n/**\n * Clipboard Behavior Schema\n *\n * Copies text to clipboard on click with visual feedback.\n * Uses the Clipboard API with execCommand fallback.\n */\nexport const clipboardSchema: BehaviorSchema = {\n name: 'Clipboard',\n category: 'ui',\n tier: 'core',\n version: '1.0.0',\n description: 'Copies text to clipboard on click with visual feedback',\n parameters: [\n {\n name: 'text',\n type: 'string',\n optional: true,\n description: 'Literal text to copy (takes priority over source)',\n },\n {\n name: 'source',\n type: 'selector',\n optional: true,\n default: 'me',\n description: 'Element whose textContent or value is copied',\n },\n {\n name: 'feedback',\n type: 'selector',\n optional: true,\n description: 'Element to show .copied feedback on (defaults to the installed element)',\n },\n {\n name: 'feedbackDuration',\n type: 'number',\n optional: true,\n default: 2000,\n description: 'Duration in ms to show .copied class feedback',\n },\n ],\n events: [\n { name: 'clipboard:copied', description: 'Fired after text is copied successfully' },\n { name: 'clipboard:error', description: 'Fired when clipboard write fails' },\n ],\n requirements: [\n 'navigator.clipboard.writeText() requires HTTPS or localhost',\n 'Falls back to document.execCommand(\"copy\") for older browsers',\n ],\n source: `\nbehavior Clipboard(text, source, feedback, feedbackDuration)\n init\n if feedbackDuration is undefined\n set feedbackDuration to 2000\n end\n if source is undefined\n set source to me\n end\n end\n on click\n if text is not undefined\n set copyText to text\n else\n set copyText to source's textContent\n end\n js(me, copyText, feedback, feedbackDuration)\n async function copyToClipboard(t) {\n if (navigator.clipboard && navigator.clipboard.writeText) {\n await navigator.clipboard.writeText(t);\n return;\n }\n var ta = document.createElement('textarea');\n ta.value = t;\n ta.style.position = 'fixed';\n ta.style.opacity = '0';\n document.body.appendChild(ta);\n ta.select();\n try { document.execCommand('copy'); } finally { document.body.removeChild(ta); }\n }\n try {\n await copyToClipboard(copyText);\n var feedbackEl = feedback ? (typeof feedback === 'string' ? document.querySelector(feedback) : feedback) : me;\n if (!feedbackEl) feedbackEl = me;\n feedbackEl.classList.add('copied');\n me.dispatchEvent(new CustomEvent('clipboard:copied', { bubbles: true, detail: { text: copyText } }));\n setTimeout(function() { feedbackEl.classList.remove('copied'); }, feedbackDuration);\n } catch(err) {\n me.dispatchEvent(new CustomEvent('clipboard:error', { bubbles: true, detail: { error: err } }));\n }\n end\n end\nend`.trim(),\n};\n","import type { BehaviorSchema } from './types';\n\n/**\n * Draggable Behavior Schema\n *\n * Makes elements draggable with pointer events.\n * Supports custom drag handles and lifecycle events.\n */\nexport const draggableSchema: BehaviorSchema = {\n name: 'Draggable',\n category: 'ui',\n tier: 'core',\n version: '1.0.0',\n description: 'Makes elements draggable with pointer events',\n parameters: [\n {\n name: 'dragHandle',\n type: 'selector',\n optional: true,\n default: 'me',\n description: 'CSS selector for the drag handle element',\n },\n ],\n events: [\n { name: 'draggable:start', description: 'Fired when drag begins' },\n { name: 'draggable:move', description: 'Fired during each movement' },\n { name: 'draggable:end', description: 'Fired when drag completes' },\n ],\n requirements: ['position: absolute or position: fixed on the element'],\n source: `\nbehavior Draggable(dragHandle)\n init\n if no dragHandle set dragHandle to me\n end\n on pointerdown(clientX, clientY) from dragHandle\n halt the event\n trigger draggable:start\n measure x\n set startX to it\n measure y\n set startY to it\n set xoff to clientX - startX\n set yoff to clientY - startY\n repeat until event pointerup from document\n wait for pointermove(clientX, clientY) or\n pointerup(clientX, clientY) from document\n add { left: \\${clientX - xoff}px; top: \\${clientY - yoff}px; }\n trigger draggable:move\n end\n trigger draggable:end\n end\nend\n`.trim(),\n};\n","import type { BehaviorSchema } from './types';\n\n/**\n * ClickOutside Behavior Schema\n *\n * Fires an event when the user clicks outside the element.\n * Uses pointerdown instead of click to avoid timing issues.\n */\nexport const clickOutsideSchema: BehaviorSchema = {\n name: 'ClickOutside',\n category: 'ui',\n tier: 'core',\n version: '1.0.0',\n description: 'Fires an event when the user clicks outside the element',\n parameters: [\n {\n name: 'active',\n type: 'boolean',\n optional: true,\n default: true,\n description: 'Whether the listener is active (can be toggled programmatically)',\n },\n ],\n events: [\n { name: 'clickoutside', description: 'Fired when a pointer press occurs outside the element' },\n {\n name: 'clickoutside:activate',\n description: 'Listen for this event to programmatically activate detection',\n },\n {\n name: 'clickoutside:deactivate',\n description: 'Listen for this event to programmatically deactivate detection',\n },\n ],\n requirements: ['Uses pointerdown instead of click to avoid timing issues with removed elements'],\n source: `\nbehavior ClickOutside(active)\n init\n if active is undefined\n set active to true\n end\n end\n on pointerdown from document\n js(me, active)\n if (!me.isConnected) return;\n if (active && !me.contains(event.target)) {\n me.dispatchEvent(new CustomEvent('clickoutside', { bubbles: true }));\n }\n end\n end\n on clickoutside:activate\n set active to true\n end\n on clickoutside:deactivate\n set active to false\n end\nend`.trim(),\n};\n","import type { BehaviorSchema } from './types';\n\n/**\n * ScrollReveal Behavior Schema\n *\n * Adds a class or fires events when the element enters or exits the viewport.\n * Uses the IntersectionObserver web standard API.\n */\nexport const scrollRevealSchema: BehaviorSchema = {\n name: 'ScrollReveal',\n category: 'layout',\n tier: 'common',\n version: '1.0.0',\n description: 'Adds a class when the element enters the viewport via IntersectionObserver',\n parameters: [\n {\n name: 'cls',\n type: 'string',\n optional: true,\n default: 'revealed',\n description: 'CSS class added when element enters viewport',\n },\n {\n name: 'threshold',\n type: 'number',\n optional: true,\n default: 0.1,\n description: 'Intersection ratio threshold (0-1) for triggering',\n },\n {\n name: 'once',\n type: 'boolean',\n optional: true,\n default: true,\n description: 'If true, disconnect observer after first intersection',\n },\n ],\n events: [\n { name: 'scrollreveal:enter', description: 'Fired when the element enters the viewport' },\n { name: 'scrollreveal:exit', description: 'Fired when the element exits the viewport' },\n ],\n requirements: ['Uses IntersectionObserver API (supported in all modern browsers)'],\n source: `\nbehavior ScrollReveal(cls, threshold, once)\n init\n if cls is undefined\n set cls to \"revealed\"\n end\n if threshold is undefined\n set threshold to 0.1\n end\n if once is undefined\n set once to true\n end\n js(me, cls, threshold, once)\n var obs = new IntersectionObserver(function(entries) {\n for (var i = 0; i < entries.length; i++) {\n if (entries[i].isIntersecting) {\n me.classList.add(cls);\n me.dispatchEvent(new CustomEvent('scrollreveal:enter', { bubbles: true }));\n if (once) obs.disconnect();\n } else if (!once) {\n me.classList.remove(cls);\n me.dispatchEvent(new CustomEvent('scrollreveal:exit', { bubbles: true }));\n }\n }\n }, { threshold: threshold });\n obs.observe(me);\n end\n end\nend`.trim(),\n};\n","import type { BehaviorSchema } from './types';\n\nexport const tabsSchema: BehaviorSchema = {\n name: 'Tabs',\n category: 'ui',\n tier: 'core',\n version: '1.0.0',\n description:\n 'WAI-ARIA compliant tabs with roving tabindex keyboard navigation. ' +\n 'Auto-wires role, aria-selected, aria-controls, and aria-labelledby attributes.',\n parameters: [\n {\n name: 'orientation',\n type: 'string',\n optional: true,\n default: 'horizontal',\n enum: ['horizontal', 'vertical'],\n description: 'Arrow key direction: horizontal (Left/Right) or vertical (Up/Down)',\n },\n {\n name: 'activeTab',\n type: 'number',\n optional: true,\n default: 0,\n description: 'Initial active tab index (zero-based)',\n },\n {\n name: 'wrap',\n type: 'boolean',\n optional: true,\n default: true,\n description: 'Wrap to first/last tab when navigating past the end',\n },\n {\n name: 'activeClass',\n type: 'string',\n optional: true,\n default: 'active',\n description: 'CSS class applied to the active tab and its panel',\n },\n ],\n events: [\n {\n name: 'tabs:change',\n description: 'Fired before tab selection changes (cancelable via preventDefault)',\n },\n { name: 'tabs:changed', description: 'Fired after tab selection has changed' },\n ],\n requirements: [\n 'Sets role=\"tablist\" on the tab container',\n 'Sets role=\"tab\" on tab buttons and role=\"tabpanel\" on content panels',\n 'Manages aria-selected, aria-controls, aria-labelledby, and tabindex',\n 'Keyboard: Arrow keys navigate, Home/End jump to first/last, Tab exits tablist',\n ],\n source: `\nbehavior Tabs(orientation, activeTab, wrap, activeClass)\n init\n if orientation is undefined\n set orientation to \"horizontal\"\n end\n if activeTab is undefined\n set activeTab to 0\n end\n if wrap is undefined\n set wrap to true\n end\n if activeClass is undefined\n set activeClass to \"active\"\n end\n js(me, orientation, activeTab, wrap, activeClass)\n var tabs = Array.from(me.querySelectorAll('[role=\"tab\"]'));\n var panels = Array.from(me.querySelectorAll('[role=\"tabpanel\"]'));\n if (tabs.length === 0 || panels.length === 0) return;\n var tablist = me.querySelector('[role=\"tablist\"]') || tabs[0].parentElement;\n if (tablist) tablist.setAttribute('aria-orientation', orientation);\n var count = Math.min(tabs.length, panels.length);\n var idN = 0;\n for (var i = 0; i < count; i++) {\n if (!tabs[i].id) tabs[i].id = 'tab-' + (++idN);\n if (!panels[i].id) panels[i].id = 'tabpanel-' + idN;\n tabs[i].setAttribute('aria-controls', panels[i].id);\n panels[i].setAttribute('aria-labelledby', tabs[i].id);\n }\n var cur = Math.max(0, Math.min(activeTab, count - 1));\n function activate(idx, prev) {\n if (idx === prev || idx < 0 || idx >= count) return false;\n var ev = new CustomEvent('tabs:change', { bubbles: true, cancelable: true, detail: { index: idx, previousIndex: prev } });\n me.dispatchEvent(ev);\n if (ev.defaultPrevented) return false;\n if (prev >= 0 && prev < count) {\n tabs[prev].setAttribute('aria-selected', 'false');\n tabs[prev].setAttribute('tabindex', '-1');\n tabs[prev].classList.remove(activeClass);\n panels[prev].setAttribute('aria-hidden', 'true');\n panels[prev].classList.remove(activeClass);\n }\n tabs[idx].setAttribute('aria-selected', 'true');\n tabs[idx].setAttribute('tabindex', '0');\n tabs[idx].classList.add(activeClass);\n panels[idx].setAttribute('aria-hidden', 'false');\n panels[idx].classList.add(activeClass);\n cur = idx;\n me.dispatchEvent(new CustomEvent('tabs:changed', { bubbles: true, detail: { index: idx } }));\n return true;\n }\n for (var j = 0; j < count; j++) {\n tabs[j].setAttribute('aria-selected', 'false');\n tabs[j].setAttribute('tabindex', '-1');\n panels[j].setAttribute('aria-hidden', 'true');\n panels[j].classList.remove(activeClass);\n }\n tabs[cur].setAttribute('aria-selected', 'true');\n tabs[cur].setAttribute('tabindex', '0');\n tabs[cur].classList.add(activeClass);\n panels[cur].setAttribute('aria-hidden', 'false');\n panels[cur].classList.add(activeClass);\n for (var k = 0; k < count; k++) {\n (function(idx) {\n tabs[idx].addEventListener('click', function() { if (activate(idx, cur)) tabs[idx].focus(); });\n })(k);\n }\n (tablist || me).addEventListener('keydown', function(e) {\n var nk = orientation === 'horizontal' ? 'ArrowRight' : 'ArrowDown';\n var pk = orientation === 'horizontal' ? 'ArrowLeft' : 'ArrowUp';\n var next = null;\n if (e.key === nk) { next = cur + 1; if (next >= count) next = wrap ? 0 : null; }\n else if (e.key === pk) { next = cur - 1; if (next < 0) next = wrap ? count - 1 : null; }\n else if (e.key === 'Home') next = 0;\n else if (e.key === 'End') next = count - 1;\n if (next !== null) { e.preventDefault(); if (activate(next, cur)) tabs[next].focus(); }\n });\n end\n end\nend`.trim(),\n};\n","import type { BehaviorSchema } from './types';\n\n/**\n * FocusTrap Behavior Schema\n *\n * Confines Tab navigation inside an element and restores focus on release.\n * Manages aria-modal for accessibility compliance.\n */\nexport const focusTrapSchema: BehaviorSchema = {\n name: 'FocusTrap',\n category: 'ui',\n tier: 'core',\n version: '1.0.0',\n description: 'Confines Tab navigation inside an element with ARIA support',\n parameters: [\n {\n name: 'active',\n type: 'boolean',\n optional: true,\n default: true,\n description: 'Whether the trap is active on install',\n },\n {\n name: 'initialFocus',\n type: 'selector',\n optional: true,\n description: 'Element to focus when the trap activates',\n },\n {\n name: 'returnFocus',\n type: 'boolean',\n optional: true,\n default: true,\n description: 'Restore focus to the previously focused element on deactivation',\n },\n ],\n events: [\n { name: 'focustrap:activated', description: 'Fired when the trap is activated' },\n { name: 'focustrap:deactivated', description: 'Fired when the trap is deactivated' },\n ],\n requirements: [\n 'Sets aria-modal=\"true\" on the element when active',\n 'Listens for focustrap:activate and focustrap:deactivate custom events for programmatic control',\n ],\n source: `\nbehavior FocusTrap(active, initialFocus, returnFocus)\n init\n if active is undefined\n set active to true\n end\n if returnFocus is undefined\n set returnFocus to true\n end\n js(me, active, initialFocus, returnFocus)\n var FOCUSABLE = 'a[href],button:not(:disabled),input:not(:disabled),select:not(:disabled),textarea:not(:disabled),[tabindex]:not([tabindex=\"-1\"])';\n var isActive = false;\n var previouslyFocused = null;\n function getFocusable() { return Array.from(me.querySelectorAll(FOCUSABLE)); }\n function activate() {\n if (isActive) return;\n isActive = true;\n previouslyFocused = document.activeElement;\n me.setAttribute('aria-modal', 'true');\n var initEl = initialFocus ? (typeof initialFocus === 'string' ? me.querySelector(initialFocus) : initialFocus) : null;\n if (initEl) { initEl.focus(); } else { var f = getFocusable(); if (f.length) f[0].focus(); }\n me.dispatchEvent(new CustomEvent('focustrap:activated', { bubbles: true }));\n }\n function deactivate() {\n if (!isActive) return;\n isActive = false;\n me.removeAttribute('aria-modal');\n if (returnFocus && previouslyFocused instanceof HTMLElement) previouslyFocused.focus();\n previouslyFocused = null;\n me.dispatchEvent(new CustomEvent('focustrap:deactivated', { bubbles: true }));\n }\n me.addEventListener('keydown', function(e) {\n if (!isActive || e.key !== 'Tab') return;\n var focusable = getFocusable();\n if (focusable.length === 0) { e.preventDefault(); return; }\n e.preventDefault();\n var idx = focusable.indexOf(document.activeElement);\n if (e.shiftKey) {\n focusable[idx <= 0 ? focusable.length - 1 : idx - 1].focus();\n } else {\n focusable[idx >= focusable.length - 1 ? 0 : idx + 1].focus();\n }\n });\n me.addEventListener('focustrap:activate', function() { activate(); });\n me.addEventListener('focustrap:deactivate', function() { deactivate(); });\n if (active) activate();\n end\n end\nend`.trim(),\n};\n","import type { BehaviorSchema } from './types';\n\n/**\n * Sortable Behavior Schema\n *\n * Drag-and-drop reordering of list items.\n * Apply to a container element; children become sortable.\n *\n * Note: This behavior fires lifecycle events but does NOT automatically\n * reorder DOM elements. Users must handle actual reordering in their\n * `sortable:move` event handlers.\n */\nexport const sortableSchema: BehaviorSchema = {\n name: 'Sortable',\n category: 'ui',\n tier: 'common',\n version: '1.0.0',\n description: 'Makes child elements reorderable via drag-and-drop',\n parameters: [\n {\n name: 'dragClass',\n type: 'string',\n optional: true,\n default: 'sorting',\n description: 'CSS class added to item during drag',\n },\n ],\n events: [\n { name: 'sortable:start', description: 'Fired when drag begins' },\n {\n name: 'sortable:move',\n description: 'Fired during drag — handle this event to reorder DOM elements',\n },\n { name: 'sortable:end', description: 'Fired when drag completes' },\n ],\n requirements: ['Users must handle DOM reordering in sortable:move event handlers'],\n source: `\nbehavior Sortable(dragClass)\n init\n if dragClass is undefined\n set dragClass to \"sorting\"\n end\n end\n on pointerdown(clientY) from me\n set item to the closest <li/> to the target\n if item is null\n exit\n end\n halt the event\n add .{dragClass} to item\n trigger sortable:start on me\n repeat until event pointerup from document\n wait for pointermove(clientY) from document\n trigger sortable:move on me\n end\n remove .{dragClass} from item\n trigger sortable:end on me\n end\nend`.trim(),\n};\n","import type { BehaviorSchema } from './types';\n\n/**\n * Resizable Behavior Schema\n *\n * Makes elements resizable by dragging edges or corners.\n * Supports minimum/maximum dimensions and resize handles.\n */\nexport const resizableSchema: BehaviorSchema = {\n name: 'Resizable',\n category: 'ui',\n tier: 'optional',\n version: '1.0.0',\n description: 'Makes elements resizable by dragging',\n parameters: [\n {\n name: 'minWidth',\n type: 'number',\n optional: true,\n default: 50,\n description: 'Minimum width in pixels',\n },\n {\n name: 'minHeight',\n type: 'number',\n optional: true,\n default: 50,\n description: 'Minimum height in pixels',\n },\n {\n name: 'maxWidth',\n type: 'number',\n optional: true,\n default: 9999,\n description: 'Maximum width in pixels',\n },\n {\n name: 'maxHeight',\n type: 'number',\n optional: true,\n default: 9999,\n description: 'Maximum height in pixels',\n },\n ],\n events: [\n { name: 'resizable:start', description: 'Fired when resize begins' },\n { name: 'resizable:resize', description: 'Fired during resize' },\n { name: 'resizable:end', description: 'Fired when resize completes' },\n ],\n source: `\nbehavior Resizable(minWidth, minHeight, maxWidth, maxHeight)\n on pointerdown(clientX, clientY) from me\n halt the event\n trigger resizable:start\n measure width\n set startWidth to it\n measure height\n set startHeight to it\n set startX to clientX\n set startY to clientY\n repeat until event pointerup from document\n wait for pointermove(clientX, clientY) from document\n set newWidth to startWidth + clientX - startX\n set newHeight to startHeight + clientY - startY\n if newWidth < minWidth then set newWidth to minWidth end\n if newWidth > maxWidth then set newWidth to maxWidth end\n if newHeight < minHeight then set newHeight to minHeight end\n if newHeight > maxHeight then set newHeight to maxHeight end\n set my style.width to newWidth + \"px\"\n set my style.height to newHeight + \"px\"\n trigger resizable:resize\n end\n trigger resizable:end\n end\nend\n`.trim(),\n};\n","/**\n * Behavior Resolver — Lazy compilation of hyperscript behaviors\n *\n * Provides a resolver function that compiles behavior source strings on demand.\n * When the runtime encounters `install X` and X isn't registered, it calls\n * the resolver. If the resolver has source for X, it compiles it, registers\n * the behavior, and installation proceeds normally.\n *\n * @example\n * ```typescript\n * import { createBehaviorResolver } from '@hyperfixi/behaviors/resolver';\n *\n * const resolve = createBehaviorResolver(window.hyperfixi, window._hyperscript.behaviors);\n * window._hyperscript.behaviors.resolve = resolve;\n *\n * // Now `install Toggleable` will compile the behavior on first use\n * ```\n */\n\nimport { toggleableSchema } from './schemas/toggleable.schema';\nimport { removableSchema } from './schemas/removable.schema';\nimport { autoDismissSchema } from './schemas/autodismiss.schema';\nimport { clipboardSchema } from './schemas/clipboard.schema';\nimport { draggableSchema } from './schemas/draggable.schema';\nimport { clickOutsideSchema } from './schemas/clickoutside.schema';\nimport { scrollRevealSchema } from './schemas/scrollreveal.schema';\nimport { tabsSchema } from './schemas/tabs.schema';\nimport { focusTrapSchema } from './schemas/focustrap.schema';\nimport { sortableSchema } from './schemas/sortable.schema';\nimport { resizableSchema } from './schemas/resizable.schema';\n\nexport const BEHAVIOR_SOURCES: Record<string, string> = {\n Toggleable: toggleableSchema.source,\n Removable: removableSchema.source,\n AutoDismiss: autoDismissSchema.source,\n Clipboard: clipboardSchema.source,\n Draggable: draggableSchema.source,\n ClickOutside: clickOutsideSchema.source,\n ScrollReveal: scrollRevealSchema.source,\n Tabs: tabsSchema.source,\n FocusTrap: focusTrapSchema.source,\n Sortable: sortableSchema.source,\n Resizable: resizableSchema.source,\n};\n\ninterface CompileResult {\n ok: boolean;\n ast?: any;\n errors?: unknown[];\n}\n\ninterface BehaviorAPI {\n set(name: string, definition: any): void;\n}\n\ninterface HyperFixiAPI {\n compileSync(code: string, options?: { traditional?: boolean }): CompileResult;\n}\n\n/**\n * Create a behavior resolver that compiles hyperscript source on demand.\n *\n * The returned function is meant to be assigned to `_hyperscript.behaviors.resolve`.\n * When called with a behavior name, it looks up the source, compiles it,\n * and registers the resulting AST in the behavior registry.\n *\n * @param hyperfixi - The hyperfixi API (needs compileSync)\n * @param behaviorAPI - The behavior registry API (needs set)\n * @returns Resolver function: (name: string) => boolean\n */\nexport function createBehaviorResolver(\n hyperfixi: HyperFixiAPI,\n behaviorAPI: BehaviorAPI\n): (name: string) => boolean {\n return (name: string): boolean => {\n const source = BEHAVIOR_SOURCES[name];\n if (!source) return false;\n\n const result = hyperfixi.compileSync(source, { traditional: true });\n if (!result.ok || !result.ast) return false;\n\n const ast = result.ast as any;\n behaviorAPI.set(name, {\n name: ast.name,\n parameters: ast.parameters,\n eventHandlers: ast.eventHandlers,\n initBlock: ast.initBlock,\n });\n return true;\n };\n}\n","/**\n * Browser Behavior Resolver Bundle\n *\n * Pre-registers all standard behavior definitions with the hyperfixi runtime.\n * Include after hyperfixi.js — all standard behaviors become available.\n *\n * Usage:\n * <script src=\"hyperfixi.js\"></script>\n * <script src=\"hyperfixi-behaviors.js\"></script>\n * <!-- install Toggleable, Draggable, etc. just work -->\n */\n\nimport { BEHAVIOR_SOURCES } from './behavior-resolver';\n\nfunction init() {\n const hf = (window as any).hyperfixi;\n if (!hf?.compileSync || !hf?.execute) return;\n\n // Compile and register each behavior definition with the runtime.\n // This is equivalent to having them in a <script type=\"text/hyperscript\"> block.\n for (const source of Object.values(BEHAVIOR_SOURCES)) {\n const result = hf.compileSync(source, { traditional: true });\n if (result?.ok && result.ast) {\n // execute() registers the behavior in the runtime's behaviorRegistry\n hf.execute(result.ast).catch(() => {\n // Async — errors handled silently\n });\n }\n }\n\n // Re-scan: the attribute processor may have already processed elements\n // and failed (behaviors weren't registered). Reset and re-init.\n const ap = hf.attributeProcessor;\n if (ap) {\n ap.reset();\n ap.init();\n }\n}\n\nif (typeof window !== 'undefined') {\n init();\n}\n"],"mappings":"0CAQO,IAAMA,EAAmC,CAC9C,KAAM,aACN,SAAU,OACV,KAAM,OACN,QAAS,QACT,YAAa,+BACb,WAAY,CACV,CACE,KAAM,MACN,KAAM,SACN,SAAU,GACV,QAAS,SACT,YAAa,qBACf,EACA,CACE,KAAM,SACN,KAAM,WACN,SAAU,GACV,QAAS,KACT,YAAa,gCACf,CACF,EACA,OAAQ,CACN,CAAE,KAAM,gBAAiB,YAAa,2BAA4B,EAClE,CAAE,KAAM,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,CAIA,IAAMC,EAAKJ,EAAG,mBACVI,IACFA,EAAG,MAAM,EACTA,EAAG,KAAK,EAEZ,CAEI,OAAO,OAAW,KACpBL,EAAK","names":["toggleableSchema","removableSchema","autoDismissSchema","clipboardSchema","draggableSchema","clickOutsideSchema","scrollRevealSchema","tabsSchema","focusTrapSchema","sortableSchema","resizableSchema","BEHAVIOR_SOURCES","toggleableSchema","removableSchema","autoDismissSchema","clipboardSchema","draggableSchema","clickOutsideSchema","scrollRevealSchema","tabsSchema","focusTrapSchema","sortableSchema","resizableSchema","init","hf","source","BEHAVIOR_SOURCES","result","ap"]}
@@ -93,13 +93,6 @@ var sortableSchema = {
93
93
  version: "1.0.0",
94
94
  description: "Makes child elements reorderable via drag-and-drop",
95
95
  parameters: [
96
- {
97
- name: "handle",
98
- type: "selector",
99
- optional: true,
100
- default: "none",
101
- description: "CSS selector for drag handles within items"
102
- },
103
96
  {
104
97
  name: "dragClass",
105
98
  type: "string",
@@ -118,32 +111,25 @@ var sortableSchema = {
118
111
  ],
119
112
  requirements: ["Users must handle DOM reordering in sortable:move event handlers"],
120
113
  source: `
121
- behavior Sortable(handle, dragClass)
114
+ behavior Sortable(dragClass)
122
115
  init
123
116
  if dragClass is undefined
124
117
  set dragClass to "sorting"
125
118
  end
126
119
  end
127
120
  on pointerdown(clientY) from me
128
- js(me, handle, event)
129
- var target = event.target;
130
- var item = target.closest("li");
131
- if (!item || !me.contains(item)) return false;
132
- if (handle && !target.closest(handle)) return false;
133
- event.preventDefault();
134
- event.stopPropagation();
135
- return true;
136
- end
137
- if it is false
121
+ set item to the closest <li/> to the target
122
+ if item is null
138
123
  exit
139
124
  end
140
- add .{dragClass} to me
125
+ halt the event
126
+ add .{dragClass} to item
141
127
  trigger sortable:start on me
142
128
  repeat until event pointerup from document
143
129
  wait for pointermove(clientY) from document
144
130
  trigger sortable:move on me
145
131
  end
146
- remove .{dragClass} from me
132
+ remove .{dragClass} from item
147
133
  trigger sortable:end on me
148
134
  end
149
135
  end`.trim()
@@ -157,13 +143,6 @@ var resizableSchema = {
157
143
  version: "1.0.0",
158
144
  description: "Makes elements resizable by dragging",
159
145
  parameters: [
160
- {
161
- name: "handle",
162
- type: "selector",
163
- optional: true,
164
- default: "me",
165
- description: "CSS selector for the resize handle (defaults to the element itself)"
166
- },
167
146
  {
168
147
  name: "minWidth",
169
148
  type: "number",
@@ -199,25 +178,8 @@ var resizableSchema = {
199
178
  { name: "resizable:end", description: "Fired when resize completes" }
200
179
  ],
201
180
  source: `
202
- behavior Resizable(handle, minWidth, minHeight, maxWidth, maxHeight)
203
- init
204
- if handle is undefined
205
- set handle to me
206
- end
207
- if minWidth is undefined
208
- set minWidth to 50
209
- end
210
- if minHeight is undefined
211
- set minHeight to 50
212
- end
213
- if maxWidth is undefined
214
- set maxWidth to 9999
215
- end
216
- if maxHeight is undefined
217
- set maxHeight to 9999
218
- end
219
- end
220
- on pointerdown(clientX, clientY) from handle
181
+ behavior Resizable(minWidth, minHeight, maxWidth, maxHeight)
182
+ on pointerdown(clientX, clientY) from me
221
183
  halt the event
222
184
  trigger resizable:start
223
185
  measure width
@@ -227,13 +189,15 @@ behavior Resizable(handle, minWidth, minHeight, maxWidth, maxHeight)
227
189
  set startX to clientX
228
190
  set startY to clientY
229
191
  repeat until event pointerup from document
230
- wait for pointermove(clientX, clientY) or pointerup from document
231
- js(startWidth, startHeight, clientX, clientY, startX, startY, minWidth, maxWidth, minHeight, maxHeight, me)
232
- var nw = Math.max(minWidth, Math.min(maxWidth, startWidth + (clientX - startX)));
233
- var nh = Math.max(minHeight, Math.min(maxHeight, startHeight + (clientY - startY)));
234
- me.style.width = nw + 'px';
235
- me.style.height = nh + 'px';
236
- end
192
+ wait for pointermove(clientX, clientY) from document
193
+ set newWidth to startWidth + clientX - startX
194
+ set newHeight to startHeight + clientY - startY
195
+ if newWidth < minWidth then set newWidth to minWidth end
196
+ if newWidth > maxWidth then set newWidth to maxWidth end
197
+ if newHeight < minHeight then set newHeight to minHeight end
198
+ if newHeight > maxHeight then set newHeight to maxHeight end
199
+ set my style.width to newWidth + "px"
200
+ set my style.height to newHeight + "px"
237
201
  trigger resizable:resize
238
202
  end
239
203
  trigger resizable:end