@hyperfixi/behaviors 3.2.0 → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +203 -1
- package/README.md +29 -9
- package/dist/all.browser.global.js +47 -102
- package/dist/all.browser.global.js.map +1 -1
- package/dist/autodismiss.browser.global.js +5 -11
- package/dist/autodismiss.browser.global.js.map +1 -1
- package/dist/behaviors/autodismiss.cjs +19 -22
- package/dist/behaviors/autodismiss.cjs.map +1 -1
- package/dist/behaviors/autodismiss.d.cts +4 -4
- package/dist/behaviors/autodismiss.d.ts +4 -4
- package/dist/behaviors/autodismiss.js +3 -3
- package/dist/behaviors/clickoutside.cjs +19 -18
- package/dist/behaviors/clickoutside.cjs.map +1 -1
- package/dist/behaviors/clickoutside.d.cts +4 -4
- package/dist/behaviors/clickoutside.d.ts +4 -4
- package/dist/behaviors/clickoutside.js +3 -3
- package/dist/behaviors/clipboard.cjs +18 -19
- package/dist/behaviors/clipboard.cjs.map +1 -1
- package/dist/behaviors/clipboard.d.cts +4 -4
- package/dist/behaviors/clipboard.d.ts +4 -4
- package/dist/behaviors/clipboard.js +3 -3
- package/dist/behaviors/draggable.cjs +20 -25
- package/dist/behaviors/draggable.cjs.map +1 -1
- package/dist/behaviors/draggable.d.cts +4 -4
- package/dist/behaviors/draggable.d.ts +4 -4
- package/dist/behaviors/draggable.js +3 -3
- package/dist/behaviors/focustrap.cjs +18 -19
- package/dist/behaviors/focustrap.cjs.map +1 -1
- package/dist/behaviors/focustrap.d.cts +4 -4
- package/dist/behaviors/focustrap.d.ts +4 -4
- package/dist/behaviors/focustrap.js +3 -3
- package/dist/behaviors/removable.cjs +18 -21
- package/dist/behaviors/removable.cjs.map +1 -1
- package/dist/behaviors/removable.d.cts +4 -3
- package/dist/behaviors/removable.d.ts +4 -3
- package/dist/behaviors/removable.js +3 -3
- package/dist/behaviors/resizable.cjs +21 -21
- package/dist/behaviors/resizable.cjs.map +1 -1
- package/dist/behaviors/resizable.d.cts +4 -4
- package/dist/behaviors/resizable.d.ts +4 -4
- package/dist/behaviors/resizable.js +3 -3
- package/dist/behaviors/scrollreveal.cjs +19 -22
- package/dist/behaviors/scrollreveal.cjs.map +1 -1
- package/dist/behaviors/scrollreveal.d.cts +4 -4
- package/dist/behaviors/scrollreveal.d.ts +4 -4
- package/dist/behaviors/scrollreveal.js +3 -3
- package/dist/behaviors/sortable.cjs +19 -20
- package/dist/behaviors/sortable.cjs.map +1 -1
- package/dist/behaviors/sortable.d.cts +4 -4
- package/dist/behaviors/sortable.d.ts +4 -4
- package/dist/behaviors/sortable.js +3 -3
- package/dist/behaviors/tabs.cjs +20 -25
- package/dist/behaviors/tabs.cjs.map +1 -1
- package/dist/behaviors/tabs.d.cts +4 -4
- package/dist/behaviors/tabs.d.ts +4 -4
- package/dist/behaviors/tabs.js +3 -3
- package/dist/behaviors/toggleable.cjs +25 -26
- package/dist/behaviors/toggleable.cjs.map +1 -1
- package/dist/behaviors/toggleable.d.cts +4 -4
- package/dist/behaviors/toggleable.d.ts +4 -4
- package/dist/behaviors/toggleable.js +3 -3
- package/dist/chunk-2GIS4DCY.js +30 -0
- package/dist/chunk-2GIS4DCY.js.map +1 -0
- package/dist/chunk-3BCBZR6R.js +30 -0
- package/dist/chunk-3BCBZR6R.js.map +1 -0
- package/dist/chunk-4YUIDZAO.js +30 -0
- package/dist/chunk-4YUIDZAO.js.map +1 -0
- package/dist/{chunk-XYZ7FOXJ.js → chunk-AQCOK5J5.js} +10 -14
- package/dist/chunk-AQCOK5J5.js.map +1 -0
- package/dist/chunk-ATGHQQC7.js +30 -0
- package/dist/chunk-ATGHQQC7.js.map +1 -0
- package/dist/{chunk-HQDYH45I.js → chunk-CWLAXLWR.js} +5 -13
- package/dist/chunk-CWLAXLWR.js.map +1 -0
- package/dist/chunk-DMWN52SV.js +30 -0
- package/dist/chunk-DMWN52SV.js.map +1 -0
- package/dist/{chunk-PDMOOWFW.js → chunk-EIVPVTUI.js} +4 -8
- package/dist/{chunk-PDMOOWFW.js.map → chunk-EIVPVTUI.js.map} +1 -1
- package/dist/chunk-HHTEMPIT.js +30 -0
- package/dist/chunk-HHTEMPIT.js.map +1 -0
- package/dist/{chunk-26IX7QU7.js → chunk-HJESSMKB.js} +4 -6
- package/dist/{chunk-26IX7QU7.js.map → chunk-HJESSMKB.js.map} +1 -1
- package/dist/{chunk-5LFOFVZ3.js → chunk-IFAH652L.js} +6 -9
- package/dist/chunk-IFAH652L.js.map +1 -0
- package/dist/chunk-IUGJG4RA.js +30 -0
- package/dist/chunk-IUGJG4RA.js.map +1 -0
- package/dist/{chunk-6EG2MNC7.js → chunk-JNLVXPHR.js} +13 -13
- package/dist/chunk-KEZEGPEX.js +30 -0
- package/dist/chunk-KEZEGPEX.js.map +1 -0
- package/dist/{chunk-66U2RSYJ.js → chunk-KP4GNXYS.js} +4 -10
- package/dist/chunk-KP4GNXYS.js.map +1 -0
- package/dist/chunk-KXQMCN4O.js +30 -0
- package/dist/chunk-KXQMCN4O.js.map +1 -0
- package/dist/{chunk-YXS27XM6.js → chunk-KYBOZ7C4.js} +3 -7
- package/dist/chunk-KYBOZ7C4.js.map +1 -0
- package/dist/chunk-LBWM6TTU.js +30 -0
- package/dist/chunk-LBWM6TTU.js.map +1 -0
- package/dist/{chunk-3DVDS7CT.js → chunk-LCDONZBX.js} +5 -5
- package/dist/chunk-LCDONZBX.js.map +1 -0
- package/dist/{chunk-OJ3YWO3W.js → chunk-NE76IBV2.js} +3 -7
- package/dist/chunk-NE76IBV2.js.map +1 -0
- package/dist/{chunk-HMU342XE.js → chunk-PVO6TZCZ.js} +3 -9
- package/dist/{chunk-HMU342XE.js.map → chunk-PVO6TZCZ.js.map} +1 -1
- package/dist/{chunk-URZGNPTQ.js → chunk-RILYRQ72.js} +4 -10
- package/dist/chunk-RILYRQ72.js.map +1 -0
- package/dist/{chunk-FBQ3X3UY.js → chunk-U4QMFVAM.js} +5 -13
- package/dist/chunk-U4QMFVAM.js.map +1 -0
- package/dist/chunk-VWDTOSE3.js +26 -0
- package/dist/chunk-VWDTOSE3.js.map +1 -0
- package/dist/chunk-YRQBU2OW.js +30 -0
- package/dist/chunk-YRQBU2OW.js.map +1 -0
- package/dist/clickoutside.browser.global.js +5 -7
- package/dist/clickoutside.browser.global.js.map +1 -1
- package/dist/clipboard.browser.global.js +4 -8
- package/dist/clipboard.browser.global.js.map +1 -1
- package/dist/core.browser.global.js +13 -25
- package/dist/core.browser.global.js.map +1 -1
- package/dist/draggable.browser.global.js +5 -13
- package/dist/draggable.browser.global.js.map +1 -1
- package/dist/focustrap.browser.global.js +4 -8
- package/dist/focustrap.browser.global.js.map +1 -1
- package/dist/index.cjs +98 -273
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +10 -10
- package/dist/index.d.ts +10 -10
- package/dist/index.js +42 -55
- package/dist/index.js.map +1 -1
- package/dist/loaders.cjs +77 -239
- package/dist/loaders.cjs.map +1 -1
- package/dist/loaders.js +13 -13
- package/dist/registry.cjs +4 -4
- package/dist/registry.cjs.map +1 -1
- package/dist/registry.d.cts +5 -6
- package/dist/registry.d.ts +5 -6
- package/dist/registry.js +1 -1
- package/dist/removable.browser.global.js +3 -9
- package/dist/removable.browser.global.js.map +1 -1
- package/dist/resizable.browser.global.js +6 -9
- package/dist/resizable.browser.global.js.map +1 -1
- package/dist/resolver.browser.global.js +47 -102
- package/dist/resolver.browser.global.js.map +1 -1
- package/dist/schemas/index.cjs +40 -95
- package/dist/schemas/index.cjs.map +1 -1
- package/dist/schemas/index.d.cts +2 -2
- package/dist/schemas/index.d.ts +2 -2
- package/dist/schemas/index.js +11 -11
- package/dist/schemas/index.js.map +1 -1
- package/dist/scrollreveal.browser.global.js +5 -11
- package/dist/scrollreveal.browser.global.js.map +1 -1
- package/dist/sortable.browser.global.js +5 -9
- package/dist/sortable.browser.global.js.map +1 -1
- package/dist/tabs.browser.global.js +6 -14
- package/dist/tabs.browser.global.js.map +1 -1
- package/dist/toggleable.browser.global.js +9 -13
- package/dist/toggleable.browser.global.js.map +1 -1
- package/dist/{types-DCCtVQS5.d.cts → types-CbA4L8XJ.d.cts} +16 -23
- package/dist/{types-DCCtVQS5.d.ts → types-CbA4L8XJ.d.ts} +16 -23
- package/package.json +5 -5
- package/src/behavior-resolver.ts +24 -56
- package/src/behaviors/autodismiss.test.ts +12 -20
- package/src/behaviors/autodismiss.ts +8 -23
- package/src/behaviors/clickoutside.test.ts +13 -21
- package/src/behaviors/clickoutside.ts +8 -23
- package/src/behaviors/clipboard.test.ts +12 -34
- package/src/behaviors/clipboard.ts +8 -23
- package/src/behaviors/curated-runtime.test.ts +22 -24
- package/src/behaviors/draggable.ts +10 -24
- package/src/behaviors/experimental-runtime.test.ts +19 -18
- package/src/behaviors/focustrap.test.ts +12 -20
- package/src/behaviors/focustrap.ts +8 -23
- package/src/behaviors/integration.test.ts +19 -54
- package/src/behaviors/optional-runtime.test.ts +17 -22
- package/src/behaviors/removable.ts +6 -20
- package/src/behaviors/resizable.ts +9 -24
- package/src/behaviors/scrollreveal.test.ts +13 -21
- package/src/behaviors/scrollreveal.ts +8 -23
- package/src/behaviors/sortable.ts +7 -22
- package/src/behaviors/tabs.test.ts +12 -34
- package/src/behaviors/tabs.ts +8 -23
- package/src/behaviors/toggleable.ts +10 -26
- package/src/browser-resolver-bundle.ts +20 -30
- package/src/core-bundle.ts +11 -11
- package/src/index.test.ts +2 -2
- package/src/index.ts +30 -47
- package/src/registry.test.ts +9 -34
- package/src/registry.ts +7 -11
- package/src/schemas/autodismiss.schema.ts +3 -9
- package/src/schemas/clickoutside.schema.ts +3 -5
- package/src/schemas/clipboard.schema.ts +2 -6
- package/src/schemas/draggable.schema.ts +4 -12
- package/src/schemas/focustrap.schema.ts +2 -6
- package/src/schemas/index.ts +2 -1
- package/src/schemas/removable.schema.ts +2 -8
- package/src/schemas/resizable.schema.ts +5 -8
- package/src/schemas/scrollreveal.schema.ts +3 -9
- package/src/schemas/sortable.schema.ts +3 -7
- package/src/schemas/tabs.schema.ts +4 -12
- package/src/schemas/toggleable.schema.ts +10 -13
- package/src/schemas/types.ts +37 -30
- package/dist/chunk-2HUF6RMI.js +0 -40
- package/dist/chunk-2HUF6RMI.js.map +0 -1
- package/dist/chunk-3DVDS7CT.js.map +0 -1
- package/dist/chunk-5LFOFVZ3.js.map +0 -1
- package/dist/chunk-66U2RSYJ.js.map +0 -1
- package/dist/chunk-6TJXDCAQ.js +0 -11
- package/dist/chunk-6TJXDCAQ.js.map +0 -1
- package/dist/chunk-7NGOA3T5.js +0 -40
- package/dist/chunk-7NGOA3T5.js.map +0 -1
- package/dist/chunk-7TPDLB7W.js +0 -40
- package/dist/chunk-7TPDLB7W.js.map +0 -1
- package/dist/chunk-CR3J7VV6.js +0 -40
- package/dist/chunk-CR3J7VV6.js.map +0 -1
- package/dist/chunk-EDBG2F57.js +0 -40
- package/dist/chunk-EDBG2F57.js.map +0 -1
- package/dist/chunk-FBQ3X3UY.js.map +0 -1
- package/dist/chunk-HQDYH45I.js.map +0 -1
- package/dist/chunk-HX663BJ4.js +0 -40
- package/dist/chunk-HX663BJ4.js.map +0 -1
- package/dist/chunk-KROW43CG.js +0 -40
- package/dist/chunk-KROW43CG.js.map +0 -1
- package/dist/chunk-L52AGCMP.js +0 -40
- package/dist/chunk-L52AGCMP.js.map +0 -1
- package/dist/chunk-OJ3YWO3W.js.map +0 -1
- package/dist/chunk-ORBJ7MRW.js +0 -40
- package/dist/chunk-ORBJ7MRW.js.map +0 -1
- package/dist/chunk-SLSCZV4A.js +0 -40
- package/dist/chunk-SLSCZV4A.js.map +0 -1
- package/dist/chunk-URZGNPTQ.js.map +0 -1
- package/dist/chunk-WKBRZGGL.js +0 -40
- package/dist/chunk-WKBRZGGL.js.map +0 -1
- package/dist/chunk-XYZ7FOXJ.js.map +0 -1
- package/dist/chunk-YXS27XM6.js.map +0 -1
- /package/dist/{chunk-6EG2MNC7.js.map → chunk-JNLVXPHR.js.map} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/behaviors/removable.ts","../src/schemas/removable.schema.ts","../src/schemas/types.ts"],"sourcesContent":["/**\n * Removable Behavior\n *\n * A behavior that removes an element when a trigger is clicked.\n * Supports optional confirmation and transition effects.\n *\n * @example\n * ```html\n * <div _=\"install Removable\">Click to remove</div>\n *\n * <div _=\"install Removable(confirm: true)\">With confirmation</div>\n * ```\n */\n\nimport { removableSchema } from '../schemas/removable.schema';\nimport
|
|
1
|
+
{"version":3,"sources":["../src/behaviors/removable.ts","../src/schemas/removable.schema.ts","../src/schemas/types.ts"],"sourcesContent":["/**\n * Removable Behavior\n *\n * A behavior that removes an element when a trigger is clicked.\n * Supports optional confirmation and transition effects.\n *\n * @example\n * ```html\n * <div _=\"install Removable\">Click to remove</div>\n *\n * <div _=\"install Removable(confirm: true)\">With confirmation</div>\n * ```\n */\n\nimport { removableSchema } from '../schemas/removable.schema';\nimport { defineBehavior, resolveRuntime } from '../schemas/types';\nimport type { HyperscriptHost } from '../schemas/types';\n\n// Re-export schema-derived values for backwards compatibility\nexport const removableSource = removableSchema.source;\nexport const removableMetadata = removableSchema;\n\n/**\n * Define the Removable behavior on a hyperscript host (`window.hyperfixi` when none is given)\n * from its source, as a `<script type=\"text/hyperscript\">` would.\n */\nexport async function registerRemovable(host?: HyperscriptHost): Promise<void> {\n defineBehavior(removableSchema, host);\n}\n\n// Auto-register when loaded as a script tag\nif (resolveRuntime()) {\n registerRemovable().catch(console.error);\n}\n\nexport default {\n source: removableSchema.source,\n metadata: removableSchema,\n register: registerRemovable,\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 on click from (triggerEl or me)\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`.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: a behavior's source, its schema, and the function that\n * defines it on a hyperscript host.\n */\nexport interface BehaviorModule {\n source: string;\n metadata: BehaviorSchema;\n register: (host?: HyperscriptHost) => Promise<void>;\n}\n\n/**\n * A hyperscript host, in upstream `_hyperscript`'s shape: `@hyperfixi/engine` (the\n * `hyperfixi-hs.js` bundle, `window.hyperfixi` / `window._hyperscript`) or upstream itself.\n * `evaluate(source)` of a `behavior … end` program defines the behavior; `processNode`\n * initialises the scripted elements under a node.\n */\nexport interface HyperscriptHost {\n evaluate: (source: string) => unknown;\n processNode?: (node: Node) => void;\n}\n\n/** The window globals a host installs itself as. */\nexport interface HyperscriptWindow {\n hyperfixi?: HyperscriptHost;\n _hyperscript?: HyperscriptHost;\n}\n\n/** The host on `window`: `hyperfixi` (the engine's bundle) or `_hyperscript` (upstream's name). */\nexport function resolveRuntime(): HyperscriptHost | null {\n if (typeof window === 'undefined') return null;\n const win = window as unknown as HyperscriptWindow;\n const host = win.hyperfixi ?? win._hyperscript;\n return host && typeof host.evaluate === 'function' ? host : null;\n}\n\n/**\n * Define a behavior on a host from its schema's source, as a page's\n * `<script type=\"text/hyperscript\">` would. Throws when there is no host or the source\n * does not parse.\n */\nexport function defineBehavior(schema: BehaviorSchema, host?: HyperscriptHost): void {\n const hf = host ?? resolveRuntime();\n if (!hf) {\n throw new Error(\n `No hyperscript host found: load @hyperfixi/engine (hyperfixi-hs.js) before defining ${schema.name}.`\n );\n }\n try {\n hf.evaluate(schema.source);\n } catch (e) {\n throw new Error(`Failed to define ${schema.name} behavior: ${(e as Error).message}`);\n }\n}\n"],"mappings":"scAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,aAAAE,EAAA,sBAAAC,EAAA,sBAAAC,EAAA,oBAAAC,ICYO,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;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,KAkBL,KAAK,CACV,ECoCO,SAASC,GAAyC,CACvD,GAAI,OAAO,OAAW,IAAa,OAAO,KAC1C,IAAMC,EAAM,OACNC,EAAOD,EAAI,WAAaA,EAAI,aAClC,OAAOC,GAAQ,OAAOA,EAAK,UAAa,WAAaA,EAAO,IAC9D,CAOO,SAASC,EAAeC,EAAwBF,EAA8B,CACnF,IAAMG,EAAKH,GAAQF,EAAe,EAClC,GAAI,CAACK,EACH,MAAM,IAAI,MACR,uFAAuFD,EAAO,IAAI,GACpG,EAEF,GAAI,CACFC,EAAG,SAASD,EAAO,MAAM,CAC3B,OAASE,EAAG,CACV,MAAM,IAAI,MAAM,oBAAoBF,EAAO,IAAI,cAAeE,EAAY,OAAO,EAAE,CACrF,CACF,CF1GO,IAAMC,EAAkBC,EAAgB,OAClCC,EAAoBD,EAMjC,eAAsBE,EAAkBC,EAAuC,CAC7EC,EAAeJ,EAAiBG,CAAI,CACtC,CAGIE,EAAe,GACjBH,EAAkB,EAAE,MAAM,QAAQ,KAAK,EAGzC,IAAOI,EAAQ,CACb,OAAQN,EAAgB,OACxB,SAAUA,EACV,SAAUE,CACZ","names":["removable_exports","__export","removable_default","registerRemovable","removableMetadata","removableSource","removableSchema","resolveRuntime","win","host","defineBehavior","schema","hf","e","removableSource","removableSchema","removableMetadata","registerRemovable","host","defineBehavior","resolveRuntime","removable_default"]}
|
|
@@ -1,18 +1,16 @@
|
|
|
1
|
-
"use strict";var HyperFixiBehaviors=(()=>{var
|
|
1
|
+
"use strict";var HyperFixiBehaviors=(()=>{var s=Object.defineProperty;var h=Object.getOwnPropertyDescriptor;var c=Object.getOwnPropertyNames;var d=Object.prototype.hasOwnProperty;var l=(e,t)=>{for(var i in t)s(e,i,{get:t[i],enumerable:!0})},u=(e,t,i,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of c(t))!d.call(e,n)&&n!==i&&s(e,n,{get:()=>t[n],enumerable:!(o=h(t,n))||o.enumerable});return e};var g=e=>u(s({},"__esModule",{value:!0}),e);var H={};l(H,{default:()=>x,registerResizable:()=>p,resizableMetadata:()=>y,resizableSource:()=>f});var r={name:"Resizable",category:"ui",tier:"optional",version:"1.0.0",description:"Makes elements resizable by dragging (EXPERIMENTAL \u2014 stateful async component, beyond the inline-scripting boundary; not part of the curated set)",parameters:[{name:"minWidth",type:"number",optional:!0,default:50,description:"Minimum width in pixels"},{name:"minHeight",type:"number",optional:!0,default:50,description:"Minimum height in pixels"},{name:"maxWidth",type:"number",optional:!0,default:9999,description:"Maximum width in pixels"},{name:"maxHeight",type:"number",optional:!0,default:9999,description:"Maximum height in pixels"}],events:[{name:"resizable:start",description:"Fired when resize begins"},{name:"resizable:resize",description:"Fired during resize"},{name:"resizable:end",description:"Fired when resize completes"}],source:`
|
|
2
2
|
behavior Resizable(minWidth, minHeight, maxWidth, maxHeight)
|
|
3
3
|
on pointerdown(clientX, clientY) from me
|
|
4
4
|
halt the event
|
|
5
5
|
trigger resizable:start
|
|
6
|
-
|
|
7
|
-
set
|
|
8
|
-
measure height
|
|
9
|
-
set startHeight to it
|
|
6
|
+
set startWidth to my offsetWidth
|
|
7
|
+
set startHeight to my offsetHeight
|
|
10
8
|
set startX to clientX
|
|
11
9
|
set startY to clientY
|
|
12
10
|
repeat until event pointerup from document
|
|
13
11
|
wait for pointermove(clientX, clientY) or pointerup(clientX, clientY) from document
|
|
14
|
-
set newWidth to startWidth + clientX - startX
|
|
15
|
-
set newHeight to startHeight + clientY - startY
|
|
12
|
+
set newWidth to (startWidth + clientX) - startX
|
|
13
|
+
set newHeight to (startHeight + clientY) - startY
|
|
16
14
|
if newWidth < minWidth then set newWidth to minWidth end
|
|
17
15
|
if newWidth > maxWidth then set newWidth to maxWidth end
|
|
18
16
|
if newHeight < minHeight then set newHeight to minHeight end
|
|
@@ -23,6 +21,5 @@ behavior Resizable(minWidth, minHeight, maxWidth, maxHeight)
|
|
|
23
21
|
end
|
|
24
22
|
trigger resizable:end
|
|
25
23
|
end
|
|
26
|
-
end
|
|
27
|
-
`.trim()};function s(){if(typeof window>"u")return null;let t=window;return t.lokascript||t.hyperfixi||null}var g=n.source,f=n;async function c(t){let e=t||s();if(!e)throw new Error("LokaScript not found. Make sure @hyperfixi/core is loaded before registering behaviors.");let i=e.compileSync(n.source,{traditional:!0});if(!i.ok)throw new Error(`Failed to compile Resizable behavior: ${JSON.stringify(i.errors)}`);let o=e.createContext?e.createContext():{locals:new Map,globals:new Map};await e.execute(i.ast,o)}s()&&c().catch(console.error);var x={source:n.source,metadata:n,register:c};return u(w);})();
|
|
24
|
+
end`.trim()};function a(){if(typeof window>"u")return null;let e=window,t=e.hyperfixi??e._hyperscript;return t&&typeof t.evaluate=="function"?t:null}function m(e,t){let i=t??a();if(!i)throw new Error(`No hyperscript host found: load @hyperfixi/engine (hyperfixi-hs.js) before defining ${e.name}.`);try{i.evaluate(e.source)}catch(o){throw new Error(`Failed to define ${e.name} behavior: ${o.message}`)}}var f=r.source,y=r;async function p(e){m(r,e)}a()&&p().catch(console.error);var x={source:r.source,metadata:r,register:p};return g(H);})();
|
|
28
25
|
//# 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\n *\n * Makes elements resizable by dragging.
|
|
1
|
+
{"version":3,"sources":["../src/behaviors/resizable.ts","../src/schemas/resizable.schema.ts","../src/schemas/types.ts"],"sourcesContent":["/**\n * Resizable Behavior\n *\n * Makes elements resizable by dragging. Defined from its hyperscript `source`\n * (single source of truth) — no imperative installer. The source reads the start\n * size from `my offsetWidth` / `my offsetHeight`, runs a `repeat until event pointerup` loop, clamps to\n * min/max dimensions, and writes `*width` / `*height` inline styles.\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 { defineBehavior, resolveRuntime } from '../schemas/types';\nimport type { HyperscriptHost } 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 * Define the Resizable behavior on a hyperscript host (`window.hyperfixi` when none is given)\n * from its source, as a `<script type=\"text/hyperscript\">` would.\n */\nexport async function registerResizable(host?: HyperscriptHost): Promise<void> {\n defineBehavior(resizableSchema, host);\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:\n 'Makes elements resizable by dragging (EXPERIMENTAL — stateful async component, beyond the inline-scripting boundary; not part of the curated set)',\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 set startWidth to my offsetWidth\n set startHeight to my offsetHeight\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(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 *width to newWidth + \"px\"\n set my *height to newHeight + \"px\"\n trigger resizable:resize\n end\n trigger resizable:end\n end\nend`.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: a behavior's source, its schema, and the function that\n * defines it on a hyperscript host.\n */\nexport interface BehaviorModule {\n source: string;\n metadata: BehaviorSchema;\n register: (host?: HyperscriptHost) => Promise<void>;\n}\n\n/**\n * A hyperscript host, in upstream `_hyperscript`'s shape: `@hyperfixi/engine` (the\n * `hyperfixi-hs.js` bundle, `window.hyperfixi` / `window._hyperscript`) or upstream itself.\n * `evaluate(source)` of a `behavior … end` program defines the behavior; `processNode`\n * initialises the scripted elements under a node.\n */\nexport interface HyperscriptHost {\n evaluate: (source: string) => unknown;\n processNode?: (node: Node) => void;\n}\n\n/** The window globals a host installs itself as. */\nexport interface HyperscriptWindow {\n hyperfixi?: HyperscriptHost;\n _hyperscript?: HyperscriptHost;\n}\n\n/** The host on `window`: `hyperfixi` (the engine's bundle) or `_hyperscript` (upstream's name). */\nexport function resolveRuntime(): HyperscriptHost | null {\n if (typeof window === 'undefined') return null;\n const win = window as unknown as HyperscriptWindow;\n const host = win.hyperfixi ?? win._hyperscript;\n return host && typeof host.evaluate === 'function' ? host : null;\n}\n\n/**\n * Define a behavior on a host from its schema's source, as a page's\n * `<script type=\"text/hyperscript\">` would. Throws when there is no host or the source\n * does not parse.\n */\nexport function defineBehavior(schema: BehaviorSchema, host?: HyperscriptHost): void {\n const hf = host ?? resolveRuntime();\n if (!hf) {\n throw new Error(\n `No hyperscript host found: load @hyperfixi/engine (hyperfixi-hs.js) before defining ${schema.name}.`\n );\n }\n try {\n hf.evaluate(schema.source);\n } catch (e) {\n throw new Error(`Failed to define ${schema.name} behavior: ${(e as Error).message}`);\n }\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,YACE,yJACF,WAAY,CACV,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,CACN,CAAE,KAAM,kBAAmB,YAAa,0BAA2B,EACnE,CAAE,KAAM,mBAAoB,YAAa,qBAAsB,EAC/D,CAAE,KAAM,gBAAiB,YAAa,6BAA8B,CACtE,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,KAuBL,KAAK,CACV,EC2BO,SAASC,GAAyC,CACvD,GAAI,OAAO,OAAW,IAAa,OAAO,KAC1C,IAAMC,EAAM,OACNC,EAAOD,EAAI,WAAaA,EAAI,aAClC,OAAOC,GAAQ,OAAOA,EAAK,UAAa,WAAaA,EAAO,IAC9D,CAOO,SAASC,EAAeC,EAAwBF,EAA8B,CACnF,IAAMG,EAAKH,GAAQF,EAAe,EAClC,GAAI,CAACK,EACH,MAAM,IAAI,MACR,uFAAuFD,EAAO,IAAI,GACpG,EAEF,GAAI,CACFC,EAAG,SAASD,EAAO,MAAM,CAC3B,OAASE,EAAG,CACV,MAAM,IAAI,MAAM,oBAAoBF,EAAO,IAAI,cAAeE,EAAY,OAAO,EAAE,CACrF,CACF,CFxGO,IAAMC,EAAkBC,EAAgB,OAClCC,EAAoBD,EAMjC,eAAsBE,EAAkBC,EAAuC,CAC7EC,EAAeJ,EAAiBG,CAAI,CACtC,CAGIE,EAAe,GACjBH,EAAkB,EAAE,MAAM,QAAQ,KAAK,EAGzC,IAAOI,EAAQ,CACb,OAAQN,EAAgB,OACxB,SAAUA,EACV,SAAUE,CACZ","names":["resizable_exports","__export","resizable_default","registerResizable","resizableMetadata","resizableSource","resizableSchema","resolveRuntime","win","host","defineBehavior","schema","hf","e","resizableSource","resizableSchema","resizableMetadata","registerResizable","host","defineBehavior","resolveRuntime","resizable_default"]}
|
|
@@ -1,28 +1,19 @@
|
|
|
1
|
-
"use strict";var HyperFixiBehaviors=(()=>{var a={name:"Toggleable",category:"form",tier:"core",version:"1.0.0",description:"Toggles a CSS class on click",parameters:[{name:"cls",type:"string",optional:!0,default:"active",description:"CSS class to toggle"},{name:"
|
|
2
|
-
behavior Toggleable(cls,
|
|
1
|
+
"use strict";var HyperFixiBehaviors=(()=>{var a={name:"Toggleable",category:"form",tier:"core",version:"1.0.0",description:"Toggles a CSS class on click",parameters:[{name:"cls",type:"string",optional:!0,default:"active",description:"CSS class to toggle"},{name:"targetEl",type:"selector",optional:!0,default:"me",description:"Element to toggle the class on (not `target`: that is hyperscript's name for the event target)"}],events:[{name:"toggleable:on",description:"Fired when class is added"},{name:"toggleable:off",description:"Fired when class is removed"}],source:`
|
|
2
|
+
behavior Toggleable(cls, targetEl)
|
|
3
3
|
init
|
|
4
|
-
if cls is undefined
|
|
5
|
-
|
|
6
|
-
end
|
|
7
|
-
if target is undefined
|
|
8
|
-
set target to me
|
|
9
|
-
end
|
|
4
|
+
if cls is undefined set element's cls to "active" end
|
|
5
|
+
if targetEl is undefined set element's targetEl to me end
|
|
10
6
|
end
|
|
11
7
|
on click
|
|
12
|
-
toggle .{cls} on
|
|
13
|
-
js(
|
|
14
|
-
var eventName =
|
|
15
|
-
|
|
8
|
+
toggle .{cls} on targetEl
|
|
9
|
+
js(targetEl, cls)
|
|
10
|
+
var eventName = targetEl.classList.contains(cls) ? 'toggleable:on' : 'toggleable:off';
|
|
11
|
+
targetEl.dispatchEvent(new CustomEvent(eventName, { bubbles: true }));
|
|
16
12
|
end
|
|
17
13
|
end
|
|
18
|
-
end`.trim()};var
|
|
14
|
+
end`.trim()};var o={name:"Removable",category:"data",tier:"common",version:"1.2.0",description:"Makes elements removable on click",parameters:[{name:"triggerEl",type:"selector",optional:!0,default:"me",description:"Element that triggers removal (e.g., a close button)"},{name:"confirmRemoval",type:"boolean",optional:!0,default:!1,description:"Show confirmation dialog before removal"},{name:"effect",type:"string",optional:!0,default:"none",enum:["fade","none"],description:'Transition effect: "fade" or "none"'}],events:[{name:"removable:before",description:"Fired before removal (cancelable)"},{name:"removable:removed",description:"Fired after removal"}],source:`
|
|
19
15
|
behavior Removable(triggerEl, confirmRemoval, effect)
|
|
20
|
-
|
|
21
|
-
if triggerEl is undefined
|
|
22
|
-
set triggerEl to me
|
|
23
|
-
end
|
|
24
|
-
end
|
|
25
|
-
on click from triggerEl
|
|
16
|
+
on click from (triggerEl or me)
|
|
26
17
|
if confirmRemoval
|
|
27
18
|
js(me)
|
|
28
19
|
if (!window.confirm("Are you sure?")) return "cancel";
|
|
@@ -38,19 +29,12 @@ behavior Removable(triggerEl, confirmRemoval, effect)
|
|
|
38
29
|
trigger removable:removed
|
|
39
30
|
remove me
|
|
40
31
|
end
|
|
41
|
-
end
|
|
42
|
-
`.trim()};var n={name:"AutoDismiss",category:"ui",tier:"core",version:"1.0.0",description:"Auto-removes elements after a delay with optional pause-on-hover",parameters:[{name:"delay",type:"number",optional:!0,default:5e3,description:"Time in ms before the element is removed"},{name:"pauseOnHover",type:"boolean",optional:!0,default:!0,description:"Pause the countdown when the mouse hovers over the element"},{name:"effect",type:"string",optional:!0,default:"none",enum:["fade","none"],description:'Transition effect before removal: "fade" or "none"'}],events:[{name:"autodismiss:start",description:"Fired when the countdown timer starts"},{name:"autodismiss:dismissed",description:"Fired before removal (cancelable via preventDefault)"},{name:"autodismiss:paused",description:"Fired when the timer is paused on hover"},{name:"autodismiss:resumed",description:"Fired when the timer resumes on mouseleave"}],source:`
|
|
32
|
+
end`.trim()};var s={name:"AutoDismiss",category:"ui",tier:"core",version:"1.0.0",description:"Auto-removes elements after a delay with optional pause-on-hover",parameters:[{name:"delay",type:"number",optional:!0,default:5e3,description:"Time in ms before the element is removed"},{name:"pauseOnHover",type:"boolean",optional:!0,default:!0,description:"Pause the countdown when the mouse hovers over the element"},{name:"effect",type:"string",optional:!0,default:"none",enum:["fade","none"],description:'Transition effect before removal: "fade" or "none"'}],events:[{name:"autodismiss:start",description:"Fired when the countdown timer starts"},{name:"autodismiss:dismissed",description:"Fired before removal (cancelable via preventDefault)"},{name:"autodismiss:paused",description:"Fired when the timer is paused on hover"},{name:"autodismiss:resumed",description:"Fired when the timer resumes on mouseleave"}],source:`
|
|
43
33
|
behavior AutoDismiss(delay, pauseOnHover, effect)
|
|
44
34
|
init
|
|
45
|
-
if delay is undefined
|
|
46
|
-
|
|
47
|
-
end
|
|
48
|
-
if pauseOnHover is undefined
|
|
49
|
-
set pauseOnHover to true
|
|
50
|
-
end
|
|
51
|
-
if effect is undefined
|
|
52
|
-
set effect to "none"
|
|
53
|
-
end
|
|
35
|
+
if delay is undefined set element's delay to 5000 end
|
|
36
|
+
if pauseOnHover is undefined set element's pauseOnHover to true end
|
|
37
|
+
if effect is undefined set element's effect to "none" end
|
|
54
38
|
js(me, delay, effect, pauseOnHover)
|
|
55
39
|
me.dispatchEvent(new CustomEvent('autodismiss:start', { bubbles: true }));
|
|
56
40
|
var remaining = delay;
|
|
@@ -92,15 +76,11 @@ behavior AutoDismiss(delay, pauseOnHover, effect)
|
|
|
92
76
|
}
|
|
93
77
|
end
|
|
94
78
|
end
|
|
95
|
-
end`.trim()};var
|
|
79
|
+
end`.trim()};var c={name:"Clipboard",category:"ui",tier:"core",version:"1.0.0",description:"Copies text to clipboard on click with visual feedback",parameters:[{name:"text",type:"string",optional:!0,description:"Literal text to copy (takes priority over source)"},{name:"source",type:"selector",optional:!0,default:"me",description:"Element whose textContent or value is copied"},{name:"feedback",type:"selector",optional:!0,description:"Element to show .copied feedback on (defaults to the installed element)"},{name:"feedbackDuration",type:"number",optional:!0,default:2e3,description:"Duration in ms to show .copied class feedback"}],events:[{name:"clipboard:copied",description:"Fired after text is copied successfully"},{name:"clipboard:error",description:"Fired when clipboard write fails"}],requirements:["navigator.clipboard.writeText() requires HTTPS or localhost",'Falls back to document.execCommand("copy") for older browsers'],source:`
|
|
96
80
|
behavior Clipboard(text, source, feedback, feedbackDuration)
|
|
97
81
|
init
|
|
98
|
-
if feedbackDuration is undefined
|
|
99
|
-
|
|
100
|
-
end
|
|
101
|
-
if source is undefined
|
|
102
|
-
set source to me
|
|
103
|
-
end
|
|
82
|
+
if feedbackDuration is undefined set element's feedbackDuration to 2000 end
|
|
83
|
+
if source is undefined set element's source to me end
|
|
104
84
|
end
|
|
105
85
|
on click
|
|
106
86
|
if text is not undefined
|
|
@@ -137,20 +117,13 @@ behavior Clipboard(text, source, feedback, feedbackDuration)
|
|
|
137
117
|
})();
|
|
138
118
|
end
|
|
139
119
|
end
|
|
140
|
-
end`.trim()};var
|
|
120
|
+
end`.trim()};var l={name:"Draggable",category:"ui",tier:"core",version:"1.0.0",description:"Makes elements draggable with pointer events (EXPERIMENTAL \u2014 stateful async component, beyond the inline-scripting boundary; not part of the curated set)",parameters:[{name:"dragHandle",type:"selector",optional:!0,default:"me",description:"CSS selector for the drag handle element"}],events:[{name:"draggable:start",description:"Fired when drag begins"},{name:"draggable:move",description:"Fired during each movement"},{name:"draggable:end",description:"Fired when drag completes"}],requirements:["position: absolute or position: fixed on the element"],source:`
|
|
141
121
|
behavior Draggable(dragHandle)
|
|
142
|
-
|
|
143
|
-
if no dragHandle set dragHandle to me
|
|
144
|
-
end
|
|
145
|
-
on pointerdown(clientX, clientY) from dragHandle
|
|
122
|
+
on pointerdown(clientX, clientY) from (dragHandle or me)
|
|
146
123
|
halt the event
|
|
147
124
|
trigger draggable:start
|
|
148
|
-
|
|
149
|
-
set
|
|
150
|
-
measure y
|
|
151
|
-
set startY to it
|
|
152
|
-
set xoff to clientX - startX
|
|
153
|
-
set yoff to clientY - startY
|
|
125
|
+
set xoff to clientX - my offsetLeft
|
|
126
|
+
set yoff to clientY - my offsetTop
|
|
154
127
|
repeat until event pointerup from document
|
|
155
128
|
wait for pointermove(clientX, clientY) or
|
|
156
129
|
pointerup(clientX, clientY) from document
|
|
@@ -159,13 +132,10 @@ behavior Draggable(dragHandle)
|
|
|
159
132
|
end
|
|
160
133
|
trigger draggable:end
|
|
161
134
|
end
|
|
162
|
-
end
|
|
163
|
-
`.trim()};var c={name:"ClickOutside",category:"ui",tier:"core",version:"1.0.0",description:"Fires an event when the user clicks outside the element",parameters:[{name:"active",type:"boolean",optional:!0,default:!0,description:"Whether the listener is active (can be toggled programmatically)"}],events:[{name:"clickoutside",description:"Fired when a pointer press occurs outside the element"},{name:"clickoutside:activate",description:"Listen for this event to programmatically activate detection"},{name:"clickoutside:deactivate",description:"Listen for this event to programmatically deactivate detection"}],requirements:["Uses pointerdown instead of click to avoid timing issues with removed elements"],source:`
|
|
135
|
+
end`.trim()};var d={name:"ClickOutside",category:"ui",tier:"core",version:"1.0.0",description:"Fires an event when the user clicks outside the element",parameters:[{name:"active",type:"boolean",optional:!0,default:!0,description:"Whether the listener is active (can be toggled programmatically)"}],events:[{name:"clickoutside",description:"Fired when a pointer press occurs outside the element"},{name:"clickoutside:activate",description:"Listen for this event to programmatically activate detection"},{name:"clickoutside:deactivate",description:"Listen for this event to programmatically deactivate detection"}],requirements:["Uses pointerdown instead of click to avoid timing issues with removed elements"],source:`
|
|
164
136
|
behavior ClickOutside(active)
|
|
165
137
|
init
|
|
166
|
-
if active is undefined
|
|
167
|
-
set active to true
|
|
168
|
-
end
|
|
138
|
+
if active is undefined set element's active to true end
|
|
169
139
|
end
|
|
170
140
|
on pointerdown from document
|
|
171
141
|
js(me, active, event)
|
|
@@ -176,23 +146,17 @@ behavior ClickOutside(active)
|
|
|
176
146
|
end
|
|
177
147
|
end
|
|
178
148
|
on clickoutside:activate
|
|
179
|
-
set active to true
|
|
149
|
+
set element's active to true
|
|
180
150
|
end
|
|
181
151
|
on clickoutside:deactivate
|
|
182
|
-
set active to false
|
|
152
|
+
set element's active to false
|
|
183
153
|
end
|
|
184
|
-
end`.trim()};var
|
|
154
|
+
end`.trim()};var m={name:"ScrollReveal",category:"layout",tier:"common",version:"1.0.0",description:"Adds a class when the element enters the viewport via IntersectionObserver",parameters:[{name:"cls",type:"string",optional:!0,default:"revealed",description:"CSS class added when element enters viewport"},{name:"threshold",type:"number",optional:!0,default:.1,description:"Intersection ratio threshold (0-1) for triggering"},{name:"once",type:"boolean",optional:!0,default:!0,description:"If true, disconnect observer after first intersection"}],events:[{name:"scrollreveal:enter",description:"Fired when the element enters the viewport"},{name:"scrollreveal:exit",description:"Fired when the element exits the viewport"}],requirements:["Uses IntersectionObserver API (supported in all modern browsers)"],source:`
|
|
185
155
|
behavior ScrollReveal(cls, threshold, once)
|
|
186
156
|
init
|
|
187
|
-
if cls is undefined
|
|
188
|
-
|
|
189
|
-
end
|
|
190
|
-
if threshold is undefined
|
|
191
|
-
set threshold to 0.1
|
|
192
|
-
end
|
|
193
|
-
if once is undefined
|
|
194
|
-
set once to true
|
|
195
|
-
end
|
|
157
|
+
if cls is undefined set element's cls to "revealed" end
|
|
158
|
+
if threshold is undefined set element's threshold to 0.1 end
|
|
159
|
+
if once is undefined set element's once to true end
|
|
196
160
|
js(me, cls, threshold, once)
|
|
197
161
|
var obs = new IntersectionObserver(function(entries) {
|
|
198
162
|
for (var i = 0; i < entries.length; i++) {
|
|
@@ -209,21 +173,13 @@ behavior ScrollReveal(cls, threshold, once)
|
|
|
209
173
|
obs.observe(me);
|
|
210
174
|
end
|
|
211
175
|
end
|
|
212
|
-
end`.trim()};var
|
|
176
|
+
end`.trim()};var u={name:"Tabs",category:"ui",tier:"core",version:"1.0.0",description:"WAI-ARIA compliant tabs with roving tabindex keyboard navigation. Auto-wires role, aria-selected, aria-controls, and aria-labelledby attributes.",parameters:[{name:"orientation",type:"string",optional:!0,default:"horizontal",enum:["horizontal","vertical"],description:"Arrow key direction: horizontal (Left/Right) or vertical (Up/Down)"},{name:"activeTab",type:"number",optional:!0,default:0,description:"Initial active tab index (zero-based)"},{name:"wrap",type:"boolean",optional:!0,default:!0,description:"Wrap to first/last tab when navigating past the end"},{name:"activeClass",type:"string",optional:!0,default:"active",description:"CSS class applied to the active tab and its panel"}],events:[{name:"tabs:change",description:"Fired before tab selection changes (cancelable via preventDefault)"},{name:"tabs:changed",description:"Fired after tab selection has changed"}],requirements:['Sets role="tablist" on the tab container','Sets role="tab" on tab buttons and role="tabpanel" on content panels',"Manages aria-selected, aria-controls, aria-labelledby, and tabindex","Keyboard: Arrow keys navigate, Home/End jump to first/last, Tab exits tablist"],source:`
|
|
213
177
|
behavior Tabs(orientation, activeTab, wrap, activeClass)
|
|
214
178
|
init
|
|
215
|
-
if orientation is undefined
|
|
216
|
-
|
|
217
|
-
end
|
|
218
|
-
if
|
|
219
|
-
set activeTab to 0
|
|
220
|
-
end
|
|
221
|
-
if wrap is undefined
|
|
222
|
-
set wrap to true
|
|
223
|
-
end
|
|
224
|
-
if activeClass is undefined
|
|
225
|
-
set activeClass to "active"
|
|
226
|
-
end
|
|
179
|
+
if orientation is undefined set element's orientation to "horizontal" end
|
|
180
|
+
if activeTab is undefined set element's activeTab to 0 end
|
|
181
|
+
if wrap is undefined set element's wrap to true end
|
|
182
|
+
if activeClass is undefined set element's activeClass to "active" end
|
|
227
183
|
js(me, orientation, activeTab, wrap, activeClass)
|
|
228
184
|
var tabs = Array.from(me.querySelectorAll('[role="tab"]'));
|
|
229
185
|
var panels = Array.from(me.querySelectorAll('[role="tabpanel"]'));
|
|
@@ -288,15 +244,11 @@ behavior Tabs(orientation, activeTab, wrap, activeClass)
|
|
|
288
244
|
});
|
|
289
245
|
end
|
|
290
246
|
end
|
|
291
|
-
end`.trim()};var
|
|
247
|
+
end`.trim()};var p={name:"FocusTrap",category:"ui",tier:"core",version:"1.0.0",description:"Confines Tab navigation inside an element with ARIA support",parameters:[{name:"active",type:"boolean",optional:!0,default:!0,description:"Whether the trap is active on install"},{name:"initialFocus",type:"selector",optional:!0,description:"Element to focus when the trap activates"},{name:"returnFocus",type:"boolean",optional:!0,default:!0,description:"Restore focus to the previously focused element on deactivation"}],events:[{name:"focustrap:activated",description:"Fired when the trap is activated"},{name:"focustrap:deactivated",description:"Fired when the trap is deactivated"}],requirements:['Sets aria-modal="true" on the element when active',"Listens for focustrap:activate and focustrap:deactivate custom events for programmatic control"],source:`
|
|
292
248
|
behavior FocusTrap(active, initialFocus, returnFocus)
|
|
293
249
|
init
|
|
294
|
-
if active is undefined
|
|
295
|
-
|
|
296
|
-
end
|
|
297
|
-
if returnFocus is undefined
|
|
298
|
-
set returnFocus to true
|
|
299
|
-
end
|
|
250
|
+
if active is undefined set element's active to true end
|
|
251
|
+
if returnFocus is undefined set element's returnFocus to true end
|
|
300
252
|
js(me, active, initialFocus, returnFocus)
|
|
301
253
|
var FOCUSABLE = 'a[href],button:not(:disabled),input:not(:disabled),select:not(:disabled),textarea:not(:disabled),[tabindex]:not([tabindex="-1"])';
|
|
302
254
|
var isActive = false;
|
|
@@ -336,43 +288,37 @@ behavior FocusTrap(active, initialFocus, returnFocus)
|
|
|
336
288
|
if (active) activate();
|
|
337
289
|
end
|
|
338
290
|
end
|
|
339
|
-
end`.trim()};var
|
|
291
|
+
end`.trim()};var f={name:"Sortable",category:"ui",tier:"common",version:"1.0.0",description:"Makes child elements reorderable via drag-and-drop (EXPERIMENTAL \u2014 stateful async component, beyond the inline-scripting boundary; not part of the curated set)",parameters:[{name:"dragClass",type:"string",optional:!0,default:"sorting",description:"CSS class added to item during drag"}],events:[{name:"sortable:start",description:"Fired when drag begins"},{name:"sortable:move",description:"Fired during drag \u2014 handle this event to reorder DOM elements"},{name:"sortable:end",description:"Fired when drag completes"}],requirements:["Users must handle DOM reordering in sortable:move event handlers"],source:`
|
|
340
292
|
behavior Sortable(dragClass)
|
|
341
|
-
init
|
|
342
|
-
if dragClass is undefined
|
|
343
|
-
set dragClass to "sorting"
|
|
344
|
-
end
|
|
345
|
-
end
|
|
346
293
|
on pointerdown(clientY) from me
|
|
347
294
|
set item to the target.closest("li")
|
|
348
295
|
if item is null
|
|
349
296
|
exit
|
|
350
297
|
end
|
|
351
298
|
halt the event
|
|
352
|
-
|
|
299
|
+
set cls to dragClass or "sorting"
|
|
300
|
+
add .{cls} to item
|
|
353
301
|
trigger sortable:start on me
|
|
354
302
|
repeat until event pointerup from document
|
|
355
303
|
wait for pointermove(clientY) or pointerup(clientY) from document
|
|
356
304
|
trigger sortable:move on me
|
|
357
305
|
end
|
|
358
|
-
remove .{
|
|
306
|
+
remove .{cls} from item
|
|
359
307
|
trigger sortable:end on me
|
|
360
308
|
end
|
|
361
|
-
end`.trim()};var
|
|
309
|
+
end`.trim()};var v={name:"Resizable",category:"ui",tier:"optional",version:"1.0.0",description:"Makes elements resizable by dragging (EXPERIMENTAL \u2014 stateful async component, beyond the inline-scripting boundary; not part of the curated set)",parameters:[{name:"minWidth",type:"number",optional:!0,default:50,description:"Minimum width in pixels"},{name:"minHeight",type:"number",optional:!0,default:50,description:"Minimum height in pixels"},{name:"maxWidth",type:"number",optional:!0,default:9999,description:"Maximum width in pixels"},{name:"maxHeight",type:"number",optional:!0,default:9999,description:"Maximum height in pixels"}],events:[{name:"resizable:start",description:"Fired when resize begins"},{name:"resizable:resize",description:"Fired during resize"},{name:"resizable:end",description:"Fired when resize completes"}],source:`
|
|
362
310
|
behavior Resizable(minWidth, minHeight, maxWidth, maxHeight)
|
|
363
311
|
on pointerdown(clientX, clientY) from me
|
|
364
312
|
halt the event
|
|
365
313
|
trigger resizable:start
|
|
366
|
-
|
|
367
|
-
set
|
|
368
|
-
measure height
|
|
369
|
-
set startHeight to it
|
|
314
|
+
set startWidth to my offsetWidth
|
|
315
|
+
set startHeight to my offsetHeight
|
|
370
316
|
set startX to clientX
|
|
371
317
|
set startY to clientY
|
|
372
318
|
repeat until event pointerup from document
|
|
373
319
|
wait for pointermove(clientX, clientY) or pointerup(clientX, clientY) from document
|
|
374
|
-
set newWidth to startWidth + clientX - startX
|
|
375
|
-
set newHeight to startHeight + clientY - startY
|
|
320
|
+
set newWidth to (startWidth + clientX) - startX
|
|
321
|
+
set newHeight to (startHeight + clientY) - startY
|
|
376
322
|
if newWidth < minWidth then set newWidth to minWidth end
|
|
377
323
|
if newWidth > maxWidth then set newWidth to maxWidth end
|
|
378
324
|
if newHeight < minHeight then set newHeight to minHeight end
|
|
@@ -383,6 +329,5 @@ behavior Resizable(minWidth, minHeight, maxWidth, maxHeight)
|
|
|
383
329
|
end
|
|
384
330
|
trigger resizable:end
|
|
385
331
|
end
|
|
386
|
-
end
|
|
387
|
-
`.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();})();
|
|
332
|
+
end`.trim()};var h={Toggleable:a.source,Removable:o.source,AutoDismiss:s.source,Clipboard:c.source,Draggable:l.source,ClickOutside:d.source,ScrollReveal:m.source,Tabs:u.source,FocusTrap:p.source,Sortable:f.source,Resizable:v.source};function b(e,t=Object.keys(h)){let r=[];for(let i of t){let n=h[i];if(n)try{e.evaluate(n),r.push(i)}catch(y){console.error(`[behaviors] ${i} did not parse: ${y.message}`)}}return r}function g(){if(typeof window>"u")return null;let e=window,t=e.hyperfixi??e._hyperscript;return t&&typeof t.evaluate=="function"?t:null}function w(){let e=g();if(!e){console.error("[behaviors] no hyperscript host: load hyperfixi-hs.js before this bundle");return}b(e),document.readyState!=="loading"&&e.processNode?.(document.body)}typeof window<"u"&&w();})();
|
|
388
333
|
//# sourceMappingURL=resolver.browser.global.js.map
|