@hyperfixi/behaviors 2.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/dist/all.browser.global.js +116 -0
- package/dist/all.browser.global.js.map +1 -0
- package/dist/behaviors/draggable.cjs +109 -0
- package/dist/behaviors/draggable.cjs.map +1 -0
- package/dist/behaviors/draggable.d.cts +15 -0
- package/dist/behaviors/draggable.d.ts +15 -0
- package/dist/behaviors/draggable.js +14 -0
- package/dist/behaviors/draggable.js.map +1 -0
- package/dist/behaviors/removable.cjs +120 -0
- package/dist/behaviors/removable.cjs.map +1 -0
- package/dist/behaviors/removable.d.cts +15 -0
- package/dist/behaviors/removable.d.ts +15 -0
- package/dist/behaviors/removable.js +14 -0
- package/dist/behaviors/removable.js.map +1 -0
- package/dist/behaviors/resizable.cjs +146 -0
- package/dist/behaviors/resizable.cjs.map +1 -0
- package/dist/behaviors/resizable.d.cts +15 -0
- package/dist/behaviors/resizable.d.ts +15 -0
- package/dist/behaviors/resizable.js +14 -0
- package/dist/behaviors/resizable.js.map +1 -0
- package/dist/behaviors/sortable.cjs +119 -0
- package/dist/behaviors/sortable.cjs.map +1 -0
- package/dist/behaviors/sortable.d.cts +15 -0
- package/dist/behaviors/sortable.d.ts +15 -0
- package/dist/behaviors/sortable.js +14 -0
- package/dist/behaviors/sortable.js.map +1 -0
- package/dist/behaviors/toggleable.cjs +105 -0
- package/dist/behaviors/toggleable.cjs.map +1 -0
- package/dist/behaviors/toggleable.d.cts +15 -0
- package/dist/behaviors/toggleable.d.ts +15 -0
- package/dist/behaviors/toggleable.js +14 -0
- package/dist/behaviors/toggleable.js.map +1 -0
- package/dist/chunk-272NKUJ3.js +63 -0
- package/dist/chunk-272NKUJ3.js.map +1 -0
- package/dist/chunk-2NQHIHD5.js +37 -0
- package/dist/chunk-2NQHIHD5.js.map +1 -0
- package/dist/chunk-3DVDS7CT.js +170 -0
- package/dist/chunk-3DVDS7CT.js.map +1 -0
- package/dist/chunk-3Q652JQB.js +37 -0
- package/dist/chunk-3Q652JQB.js.map +1 -0
- package/dist/chunk-BWZ6EGII.js +62 -0
- package/dist/chunk-BWZ6EGII.js.map +1 -0
- package/dist/chunk-G6WR2AYR.js +52 -0
- package/dist/chunk-G6WR2AYR.js.map +1 -0
- package/dist/chunk-HMRPQWQU.js +37 -0
- package/dist/chunk-HMRPQWQU.js.map +1 -0
- package/dist/chunk-MEP6B7XW.js +37 -0
- package/dist/chunk-MEP6B7XW.js.map +1 -0
- package/dist/chunk-URBOGGW6.js +32 -0
- package/dist/chunk-URBOGGW6.js.map +1 -0
- package/dist/chunk-V5IWDPDP.js +89 -0
- package/dist/chunk-V5IWDPDP.js.map +1 -0
- package/dist/chunk-WU37DFAL.js +37 -0
- package/dist/chunk-WU37DFAL.js.map +1 -0
- package/dist/chunk-WUHHMDAA.js +48 -0
- package/dist/chunk-WUHHMDAA.js.map +1 -0
- package/dist/core.browser.global.js +39 -0
- package/dist/core.browser.global.js.map +1 -0
- package/dist/draggable.browser.global.js +25 -0
- package/dist/draggable.browser.global.js.map +1 -0
- package/dist/index.cjs +907 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +134 -0
- package/dist/index.d.ts +134 -0
- package/dist/index.js +193 -0
- package/dist/index.js.map +1 -0
- package/dist/loaders.cjs +562 -0
- package/dist/loaders.cjs.map +1 -0
- package/dist/loaders.d.cts +2 -0
- package/dist/loaders.d.ts +2 -0
- package/dist/loaders.js +8 -0
- package/dist/loaders.js.map +1 -0
- package/dist/registry.cjs +214 -0
- package/dist/registry.cjs.map +1 -0
- package/dist/registry.d.cts +116 -0
- package/dist/registry.d.ts +116 -0
- package/dist/registry.js +47 -0
- package/dist/registry.js.map +1 -0
- package/dist/removable.browser.global.js +23 -0
- package/dist/removable.browser.global.js.map +1 -0
- package/dist/resizable.browser.global.js +35 -0
- package/dist/resizable.browser.global.js.map +1 -0
- package/dist/schemas/index.cjs +353 -0
- package/dist/schemas/index.cjs.map +1 -0
- package/dist/schemas/index.d.cts +75 -0
- package/dist/schemas/index.d.ts +75 -0
- package/dist/schemas/index.js +41 -0
- package/dist/schemas/index.js.map +1 -0
- package/dist/sortable.browser.global.js +25 -0
- package/dist/sortable.browser.global.js.map +1 -0
- package/dist/toggleable.browser.global.js +16 -0
- package/dist/toggleable.browser.global.js.map +1 -0
- package/dist/types-CCc_2wAb.d.cts +100 -0
- package/dist/types-CCc_2wAb.d.ts +100 -0
- package/package.json +109 -0
- package/src/behaviors/draggable.ts +60 -0
- package/src/behaviors/index.ts +40 -0
- package/src/behaviors/integration.test.ts +80 -0
- package/src/behaviors/removable.ts +55 -0
- package/src/behaviors/resizable.ts +55 -0
- package/src/behaviors/sortable.ts +56 -0
- package/src/behaviors/toggleable.ts +55 -0
- package/src/core-bundle.ts +35 -0
- package/src/generated/index.ts +9 -0
- package/src/generated/metadata.ts +78 -0
- package/src/generated/types.ts +51 -0
- package/src/index.test.ts +180 -0
- package/src/index.ts +222 -0
- package/src/loaders.ts +39 -0
- package/src/registry.test.ts +207 -0
- package/src/registry.ts +304 -0
- package/src/schemas/draggable.schema.ts +54 -0
- package/src/schemas/index.ts +60 -0
- package/src/schemas/removable.schema.ts +69 -0
- package/src/schemas/resizable.schema.ts +91 -0
- package/src/schemas/sortable.schema.ts +68 -0
- package/src/schemas/toggleable.schema.ts +50 -0
- package/src/schemas/types.ts +107 -0
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/behaviors/resizable.ts
|
|
21
|
+
var resizable_exports = {};
|
|
22
|
+
__export(resizable_exports, {
|
|
23
|
+
default: () => resizable_default,
|
|
24
|
+
registerResizable: () => registerResizable,
|
|
25
|
+
resizableMetadata: () => resizableMetadata,
|
|
26
|
+
resizableSource: () => resizableSource
|
|
27
|
+
});
|
|
28
|
+
module.exports = __toCommonJS(resizable_exports);
|
|
29
|
+
|
|
30
|
+
// src/schemas/resizable.schema.ts
|
|
31
|
+
var resizableSchema = {
|
|
32
|
+
name: "Resizable",
|
|
33
|
+
category: "ui",
|
|
34
|
+
tier: "optional",
|
|
35
|
+
version: "1.0.0",
|
|
36
|
+
description: "Makes elements resizable by dragging",
|
|
37
|
+
parameters: [
|
|
38
|
+
{
|
|
39
|
+
name: "handle",
|
|
40
|
+
type: "selector",
|
|
41
|
+
optional: true,
|
|
42
|
+
default: "me",
|
|
43
|
+
description: "CSS selector for the resize handle (defaults to the element itself)"
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
name: "minWidth",
|
|
47
|
+
type: "number",
|
|
48
|
+
optional: true,
|
|
49
|
+
default: 50,
|
|
50
|
+
description: "Minimum width in pixels"
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
name: "minHeight",
|
|
54
|
+
type: "number",
|
|
55
|
+
optional: true,
|
|
56
|
+
default: 50,
|
|
57
|
+
description: "Minimum height in pixels"
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
name: "maxWidth",
|
|
61
|
+
type: "number",
|
|
62
|
+
optional: true,
|
|
63
|
+
default: 9999,
|
|
64
|
+
description: "Maximum width in pixels"
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
name: "maxHeight",
|
|
68
|
+
type: "number",
|
|
69
|
+
optional: true,
|
|
70
|
+
default: 9999,
|
|
71
|
+
description: "Maximum height in pixels"
|
|
72
|
+
}
|
|
73
|
+
],
|
|
74
|
+
events: [
|
|
75
|
+
{ name: "resizable:start", description: "Fired when resize begins" },
|
|
76
|
+
{ name: "resizable:resize", description: "Fired during resize" },
|
|
77
|
+
{ name: "resizable:end", description: "Fired when resize completes" }
|
|
78
|
+
],
|
|
79
|
+
source: `
|
|
80
|
+
behavior Resizable(handle, minWidth, minHeight, maxWidth, maxHeight)
|
|
81
|
+
init
|
|
82
|
+
if no handle set handle to me
|
|
83
|
+
if no minWidth set minWidth to 50
|
|
84
|
+
if no minHeight set minHeight to 50
|
|
85
|
+
if no maxWidth set maxWidth to 9999
|
|
86
|
+
if no maxHeight set maxHeight to 9999
|
|
87
|
+
end
|
|
88
|
+
on pointerdown(clientX, clientY) from handle
|
|
89
|
+
halt the event
|
|
90
|
+
trigger resizable:start
|
|
91
|
+
measure width
|
|
92
|
+
set startWidth to it
|
|
93
|
+
measure height
|
|
94
|
+
set startHeight to it
|
|
95
|
+
set startX to clientX
|
|
96
|
+
set startY to clientY
|
|
97
|
+
repeat until event pointerup from document
|
|
98
|
+
wait for pointermove(clientX, clientY) or
|
|
99
|
+
pointerup from document
|
|
100
|
+
set newWidth to startWidth + (clientX - startX)
|
|
101
|
+
set newHeight to startHeight + (clientY - startY)
|
|
102
|
+
if newWidth < minWidth set newWidth to minWidth
|
|
103
|
+
if newWidth > maxWidth set newWidth to maxWidth
|
|
104
|
+
if newHeight < minHeight set newHeight to minHeight
|
|
105
|
+
if newHeight > maxHeight set newHeight to maxHeight
|
|
106
|
+
add { width: \${newWidth}px; height: \${newHeight}px; }
|
|
107
|
+
trigger resizable:resize
|
|
108
|
+
end
|
|
109
|
+
trigger resizable:end
|
|
110
|
+
end
|
|
111
|
+
end
|
|
112
|
+
`.trim()
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
// src/behaviors/resizable.ts
|
|
116
|
+
var resizableSource = resizableSchema.source;
|
|
117
|
+
var resizableMetadata = resizableSchema;
|
|
118
|
+
async function registerResizable(hyperfixi) {
|
|
119
|
+
const hf = hyperfixi || (typeof window !== "undefined" ? window.lokascript : null);
|
|
120
|
+
if (!hf) {
|
|
121
|
+
throw new Error(
|
|
122
|
+
"LokaScript not found. Make sure @hyperfixi/core is loaded before registering behaviors."
|
|
123
|
+
);
|
|
124
|
+
}
|
|
125
|
+
const result = hf.compileSync(resizableSchema.source, { traditional: true });
|
|
126
|
+
if (!result.ok) {
|
|
127
|
+
throw new Error(`Failed to compile Resizable behavior: ${JSON.stringify(result.errors)}`);
|
|
128
|
+
}
|
|
129
|
+
const ctx = hf.createContext ? hf.createContext() : { locals: /* @__PURE__ */ new Map(), globals: /* @__PURE__ */ new Map() };
|
|
130
|
+
await hf.execute(result.ast, ctx);
|
|
131
|
+
}
|
|
132
|
+
if (typeof window !== "undefined" && window.lokascript) {
|
|
133
|
+
registerResizable().catch(console.error);
|
|
134
|
+
}
|
|
135
|
+
var resizable_default = {
|
|
136
|
+
source: resizableSchema.source,
|
|
137
|
+
metadata: resizableSchema,
|
|
138
|
+
register: registerResizable
|
|
139
|
+
};
|
|
140
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
141
|
+
0 && (module.exports = {
|
|
142
|
+
registerResizable,
|
|
143
|
+
resizableMetadata,
|
|
144
|
+
resizableSource
|
|
145
|
+
});
|
|
146
|
+
//# sourceMappingURL=resizable.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/behaviors/resizable.ts","../../src/schemas/resizable.schema.ts"],"sourcesContent":["/**\n * Resizable Behavior\n *\n * A behavior that 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, LokaScriptWindow } 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 * Register the Resizable behavior with LokaScript.\n */\nexport async function registerResizable(hyperfixi?: LokaScriptInstance): Promise<void> {\n const hf =\n hyperfixi ||\n (typeof window !== 'undefined' ? (window as unknown as LokaScriptWindow).lokascript : null);\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 result = hf.compileSync(resizableSchema.source, { traditional: true });\n\n if (!result.ok) {\n throw new Error(`Failed to compile Resizable behavior: ${JSON.stringify(result.errors)}`);\n }\n\n const ctx = hf.createContext ? hf.createContext() : { locals: new Map(), globals: new Map() };\n await hf.execute(result.ast, ctx);\n}\n\n// Auto-register when loaded as a script tag\nif (typeof window !== 'undefined' && (window as unknown as LokaScriptWindow).lokascript) {\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 no handle set handle to me\n if no minWidth set minWidth to 50\n if no minHeight set minHeight to 50\n if no maxWidth set maxWidth to 9999\n if no maxHeight set maxHeight to 9999\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\n pointerup from document\n set newWidth to startWidth + (clientX - startX)\n set newHeight to startHeight + (clientY - startY)\n if newWidth < minWidth set newWidth to minWidth\n if newWidth > maxWidth set newWidth to maxWidth\n if newHeight < minHeight set newHeight to minHeight\n if newHeight > maxHeight set newHeight to maxHeight\n add { width: \\${newWidth}px; height: \\${newHeight}px; }\n trigger resizable:resize\n end\n trigger resizable:end\n end\nend\n`.trim(),\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACQO,IAAM,kBAAkC;AAAA,EAC7C,MAAM;AAAA,EACN,UAAU;AAAA,EACV,MAAM;AAAA,EACN,SAAS;AAAA,EACT,aAAa;AAAA,EACb,YAAY;AAAA,IACV;AAAA,MACE,MAAM;AAAA,MACN,MAAM;AAAA,MACN,UAAU;AAAA,MACV,SAAS;AAAA,MACT,aAAa;AAAA,IACf;AAAA,IACA;AAAA,MACE,MAAM;AAAA,MACN,MAAM;AAAA,MACN,UAAU;AAAA,MACV,SAAS;AAAA,MACT,aAAa;AAAA,IACf;AAAA,IACA;AAAA,MACE,MAAM;AAAA,MACN,MAAM;AAAA,MACN,UAAU;AAAA,MACV,SAAS;AAAA,MACT,aAAa;AAAA,IACf;AAAA,IACA;AAAA,MACE,MAAM;AAAA,MACN,MAAM;AAAA,MACN,UAAU;AAAA,MACV,SAAS;AAAA,MACT,aAAa;AAAA,IACf;AAAA,IACA;AAAA,MACE,MAAM;AAAA,MACN,MAAM;AAAA,MACN,UAAU;AAAA,MACV,SAAS;AAAA,MACT,aAAa;AAAA,IACf;AAAA,EACF;AAAA,EACA,QAAQ;AAAA,IACN,EAAE,MAAM,mBAAmB,aAAa,2BAA2B;AAAA,IACnE,EAAE,MAAM,oBAAoB,aAAa,sBAAsB;AAAA,IAC/D,EAAE,MAAM,iBAAiB,aAAa,8BAA8B;AAAA,EACtE;AAAA,EACA,QAAQ;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,EAiCR,KAAK;AACP;;;ADxEO,IAAM,kBAAkB,gBAAgB;AACxC,IAAM,oBAAoB;AAKjC,eAAsB,kBAAkB,WAA+C;AACrF,QAAM,KACJ,cACC,OAAO,WAAW,cAAe,OAAuC,aAAa;AAExF,MAAI,CAAC,IAAI;AACP,UAAM,IAAI;AAAA,MACR;AAAA,IACF;AAAA,EACF;AAEA,QAAM,SAAS,GAAG,YAAY,gBAAgB,QAAQ,EAAE,aAAa,KAAK,CAAC;AAE3E,MAAI,CAAC,OAAO,IAAI;AACd,UAAM,IAAI,MAAM,yCAAyC,KAAK,UAAU,OAAO,MAAM,CAAC,EAAE;AAAA,EAC1F;AAEA,QAAM,MAAM,GAAG,gBAAgB,GAAG,cAAc,IAAI,EAAE,QAAQ,oBAAI,IAAI,GAAG,SAAS,oBAAI,IAAI,EAAE;AAC5F,QAAM,GAAG,QAAQ,OAAO,KAAK,GAAG;AAClC;AAGA,IAAI,OAAO,WAAW,eAAgB,OAAuC,YAAY;AACvF,oBAAkB,EAAE,MAAM,QAAQ,KAAK;AACzC;AAEA,IAAO,oBAAQ;AAAA,EACb,QAAQ,gBAAgB;AAAA,EACxB,UAAU;AAAA,EACV,UAAU;AACZ;","names":[]}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { a as BehaviorSchema, L as LokaScriptInstance } from '../types-CCc_2wAb.cjs';
|
|
2
|
+
|
|
3
|
+
declare const resizableSource: string;
|
|
4
|
+
declare const resizableMetadata: BehaviorSchema;
|
|
5
|
+
/**
|
|
6
|
+
* Register the Resizable behavior with LokaScript.
|
|
7
|
+
*/
|
|
8
|
+
declare function registerResizable(hyperfixi?: LokaScriptInstance): Promise<void>;
|
|
9
|
+
declare const _default: {
|
|
10
|
+
source: string;
|
|
11
|
+
metadata: BehaviorSchema;
|
|
12
|
+
register: typeof registerResizable;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export { _default as default, registerResizable, resizableMetadata, resizableSource };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { a as BehaviorSchema, L as LokaScriptInstance } from '../types-CCc_2wAb.js';
|
|
2
|
+
|
|
3
|
+
declare const resizableSource: string;
|
|
4
|
+
declare const resizableMetadata: BehaviorSchema;
|
|
5
|
+
/**
|
|
6
|
+
* Register the Resizable behavior with LokaScript.
|
|
7
|
+
*/
|
|
8
|
+
declare function registerResizable(hyperfixi?: LokaScriptInstance): Promise<void>;
|
|
9
|
+
declare const _default: {
|
|
10
|
+
source: string;
|
|
11
|
+
metadata: BehaviorSchema;
|
|
12
|
+
register: typeof registerResizable;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export { _default as default, registerResizable, resizableMetadata, resizableSource };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import {
|
|
2
|
+
registerResizable,
|
|
3
|
+
resizableMetadata,
|
|
4
|
+
resizableSource,
|
|
5
|
+
resizable_default
|
|
6
|
+
} from "../chunk-HMRPQWQU.js";
|
|
7
|
+
import "../chunk-V5IWDPDP.js";
|
|
8
|
+
export {
|
|
9
|
+
resizable_default as default,
|
|
10
|
+
registerResizable,
|
|
11
|
+
resizableMetadata,
|
|
12
|
+
resizableSource
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=resizable.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/behaviors/sortable.ts
|
|
21
|
+
var sortable_exports = {};
|
|
22
|
+
__export(sortable_exports, {
|
|
23
|
+
default: () => sortable_default,
|
|
24
|
+
registerSortable: () => registerSortable,
|
|
25
|
+
sortableMetadata: () => sortableMetadata,
|
|
26
|
+
sortableSource: () => sortableSource
|
|
27
|
+
});
|
|
28
|
+
module.exports = __toCommonJS(sortable_exports);
|
|
29
|
+
|
|
30
|
+
// src/schemas/sortable.schema.ts
|
|
31
|
+
var sortableSchema = {
|
|
32
|
+
name: "Sortable",
|
|
33
|
+
category: "ui",
|
|
34
|
+
tier: "common",
|
|
35
|
+
version: "1.0.0",
|
|
36
|
+
description: "Makes child elements reorderable via drag-and-drop",
|
|
37
|
+
parameters: [
|
|
38
|
+
{
|
|
39
|
+
name: "handle",
|
|
40
|
+
type: "selector",
|
|
41
|
+
optional: true,
|
|
42
|
+
default: "none",
|
|
43
|
+
description: "CSS selector for drag handles within items"
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
name: "dragClass",
|
|
47
|
+
type: "string",
|
|
48
|
+
optional: true,
|
|
49
|
+
default: "sorting",
|
|
50
|
+
description: "CSS class added to item during drag"
|
|
51
|
+
}
|
|
52
|
+
],
|
|
53
|
+
events: [
|
|
54
|
+
{ name: "sortable:start", description: "Fired when drag begins" },
|
|
55
|
+
{
|
|
56
|
+
name: "sortable:move",
|
|
57
|
+
description: "Fired during drag \u2014 handle this event to reorder DOM elements"
|
|
58
|
+
},
|
|
59
|
+
{ name: "sortable:end", description: "Fired when drag completes" }
|
|
60
|
+
],
|
|
61
|
+
requirements: ["Users must handle DOM reordering in sortable:move event handlers"],
|
|
62
|
+
source: `
|
|
63
|
+
behavior Sortable(handle, dragClass)
|
|
64
|
+
init
|
|
65
|
+
if no dragClass set dragClass to "sorting"
|
|
66
|
+
end
|
|
67
|
+
on pointerdown(target, clientY) from me
|
|
68
|
+
set item to closest <li/> in target
|
|
69
|
+
if no item exit
|
|
70
|
+
if handle
|
|
71
|
+
set handleEl to target.closest(handle)
|
|
72
|
+
if no handleEl exit
|
|
73
|
+
end
|
|
74
|
+
halt the event
|
|
75
|
+
add dragClass to item
|
|
76
|
+
trigger sortable:start on me
|
|
77
|
+
repeat until event pointerup from document
|
|
78
|
+
wait for pointermove(clientY) from document
|
|
79
|
+
trigger sortable:move on me
|
|
80
|
+
end
|
|
81
|
+
remove dragClass from item
|
|
82
|
+
trigger sortable:end on me
|
|
83
|
+
end
|
|
84
|
+
end
|
|
85
|
+
`.trim()
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
// src/behaviors/sortable.ts
|
|
89
|
+
var sortableSource = sortableSchema.source;
|
|
90
|
+
var sortableMetadata = sortableSchema;
|
|
91
|
+
async function registerSortable(hyperfixi) {
|
|
92
|
+
const hf = hyperfixi || (typeof window !== "undefined" ? window.lokascript : null);
|
|
93
|
+
if (!hf) {
|
|
94
|
+
throw new Error(
|
|
95
|
+
"LokaScript not found. Make sure @hyperfixi/core is loaded before registering behaviors."
|
|
96
|
+
);
|
|
97
|
+
}
|
|
98
|
+
const result = hf.compileSync(sortableSchema.source, { traditional: true });
|
|
99
|
+
if (!result.ok) {
|
|
100
|
+
throw new Error(`Failed to compile Sortable behavior: ${JSON.stringify(result.errors)}`);
|
|
101
|
+
}
|
|
102
|
+
const ctx = hf.createContext ? hf.createContext() : { locals: /* @__PURE__ */ new Map(), globals: /* @__PURE__ */ new Map() };
|
|
103
|
+
await hf.execute(result.ast, ctx);
|
|
104
|
+
}
|
|
105
|
+
if (typeof window !== "undefined" && window.lokascript) {
|
|
106
|
+
registerSortable().catch(console.error);
|
|
107
|
+
}
|
|
108
|
+
var sortable_default = {
|
|
109
|
+
source: sortableSchema.source,
|
|
110
|
+
metadata: sortableSchema,
|
|
111
|
+
register: registerSortable
|
|
112
|
+
};
|
|
113
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
114
|
+
0 && (module.exports = {
|
|
115
|
+
registerSortable,
|
|
116
|
+
sortableMetadata,
|
|
117
|
+
sortableSource
|
|
118
|
+
});
|
|
119
|
+
//# sourceMappingURL=sortable.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/behaviors/sortable.ts","../../src/schemas/sortable.schema.ts"],"sourcesContent":["/**\n * Sortable Behavior\n *\n * A behavior for drag-and-drop reordering of list items.\n * Apply to a container element; children become sortable.\n *\n * @example\n * ```html\n * <ul _=\"install Sortable\">\n * <li>Item 1</li>\n * <li>Item 2</li>\n * </ul>\n * ```\n */\n\nimport { sortableSchema } from '../schemas/sortable.schema';\nimport type { LokaScriptInstance, LokaScriptWindow } from '../schemas/types';\n\n// Re-export schema-derived values for backwards compatibility\nexport const sortableSource = sortableSchema.source;\nexport const sortableMetadata = sortableSchema;\n\n/**\n * Register the Sortable behavior with LokaScript.\n */\nexport async function registerSortable(hyperfixi?: LokaScriptInstance): Promise<void> {\n const hf =\n hyperfixi ||\n (typeof window !== 'undefined' ? (window as unknown as LokaScriptWindow).lokascript : null);\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 result = hf.compileSync(sortableSchema.source, { traditional: true });\n\n if (!result.ok) {\n throw new Error(`Failed to compile Sortable behavior: ${JSON.stringify(result.errors)}`);\n }\n\n const ctx = hf.createContext ? hf.createContext() : { locals: new Map(), globals: new Map() };\n await hf.execute(result.ast, ctx);\n}\n\n// Auto-register when loaded as a script tag\nif (typeof window !== 'undefined' && (window as unknown as LokaScriptWindow).lokascript) {\n registerSortable().catch(console.error);\n}\n\nexport default {\n source: sortableSchema.source,\n metadata: sortableSchema,\n register: registerSortable,\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 no dragClass set dragClass to \"sorting\"\n end\n on pointerdown(target, clientY) from me\n set item to closest <li/> in target\n if no item exit\n if handle\n set handleEl to target.closest(handle)\n if no handleEl 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\n`.trim(),\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACYO,IAAM,iBAAiC;AAAA,EAC5C,MAAM;AAAA,EACN,UAAU;AAAA,EACV,MAAM;AAAA,EACN,SAAS;AAAA,EACT,aAAa;AAAA,EACb,YAAY;AAAA,IACV;AAAA,MACE,MAAM;AAAA,MACN,MAAM;AAAA,MACN,UAAU;AAAA,MACV,SAAS;AAAA,MACT,aAAa;AAAA,IACf;AAAA,IACA;AAAA,MACE,MAAM;AAAA,MACN,MAAM;AAAA,MACN,UAAU;AAAA,MACV,SAAS;AAAA,MACT,aAAa;AAAA,IACf;AAAA,EACF;AAAA,EACA,QAAQ;AAAA,IACN,EAAE,MAAM,kBAAkB,aAAa,yBAAyB;AAAA,IAChE;AAAA,MACE,MAAM;AAAA,MACN,aAAa;AAAA,IACf;AAAA,IACA,EAAE,MAAM,gBAAgB,aAAa,4BAA4B;AAAA,EACnE;AAAA,EACA,cAAc,CAAC,kEAAkE;AAAA,EACjF,QAAQ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAuBR,KAAK;AACP;;;ADhDO,IAAM,iBAAiB,eAAe;AACtC,IAAM,mBAAmB;AAKhC,eAAsB,iBAAiB,WAA+C;AACpF,QAAM,KACJ,cACC,OAAO,WAAW,cAAe,OAAuC,aAAa;AAExF,MAAI,CAAC,IAAI;AACP,UAAM,IAAI;AAAA,MACR;AAAA,IACF;AAAA,EACF;AAEA,QAAM,SAAS,GAAG,YAAY,eAAe,QAAQ,EAAE,aAAa,KAAK,CAAC;AAE1E,MAAI,CAAC,OAAO,IAAI;AACd,UAAM,IAAI,MAAM,wCAAwC,KAAK,UAAU,OAAO,MAAM,CAAC,EAAE;AAAA,EACzF;AAEA,QAAM,MAAM,GAAG,gBAAgB,GAAG,cAAc,IAAI,EAAE,QAAQ,oBAAI,IAAI,GAAG,SAAS,oBAAI,IAAI,EAAE;AAC5F,QAAM,GAAG,QAAQ,OAAO,KAAK,GAAG;AAClC;AAGA,IAAI,OAAO,WAAW,eAAgB,OAAuC,YAAY;AACvF,mBAAiB,EAAE,MAAM,QAAQ,KAAK;AACxC;AAEA,IAAO,mBAAQ;AAAA,EACb,QAAQ,eAAe;AAAA,EACvB,UAAU;AAAA,EACV,UAAU;AACZ;","names":[]}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { a as BehaviorSchema, L as LokaScriptInstance } from '../types-CCc_2wAb.cjs';
|
|
2
|
+
|
|
3
|
+
declare const sortableSource: string;
|
|
4
|
+
declare const sortableMetadata: BehaviorSchema;
|
|
5
|
+
/**
|
|
6
|
+
* Register the Sortable behavior with LokaScript.
|
|
7
|
+
*/
|
|
8
|
+
declare function registerSortable(hyperfixi?: LokaScriptInstance): Promise<void>;
|
|
9
|
+
declare const _default: {
|
|
10
|
+
source: string;
|
|
11
|
+
metadata: BehaviorSchema;
|
|
12
|
+
register: typeof registerSortable;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export { _default as default, registerSortable, sortableMetadata, sortableSource };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { a as BehaviorSchema, L as LokaScriptInstance } from '../types-CCc_2wAb.js';
|
|
2
|
+
|
|
3
|
+
declare const sortableSource: string;
|
|
4
|
+
declare const sortableMetadata: BehaviorSchema;
|
|
5
|
+
/**
|
|
6
|
+
* Register the Sortable behavior with LokaScript.
|
|
7
|
+
*/
|
|
8
|
+
declare function registerSortable(hyperfixi?: LokaScriptInstance): Promise<void>;
|
|
9
|
+
declare const _default: {
|
|
10
|
+
source: string;
|
|
11
|
+
metadata: BehaviorSchema;
|
|
12
|
+
register: typeof registerSortable;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export { _default as default, registerSortable, sortableMetadata, sortableSource };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import {
|
|
2
|
+
registerSortable,
|
|
3
|
+
sortableMetadata,
|
|
4
|
+
sortableSource,
|
|
5
|
+
sortable_default
|
|
6
|
+
} from "../chunk-MEP6B7XW.js";
|
|
7
|
+
import "../chunk-BWZ6EGII.js";
|
|
8
|
+
export {
|
|
9
|
+
sortable_default as default,
|
|
10
|
+
registerSortable,
|
|
11
|
+
sortableMetadata,
|
|
12
|
+
sortableSource
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=sortable.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/behaviors/toggleable.ts
|
|
21
|
+
var toggleable_exports = {};
|
|
22
|
+
__export(toggleable_exports, {
|
|
23
|
+
default: () => toggleable_default,
|
|
24
|
+
registerToggleable: () => registerToggleable,
|
|
25
|
+
toggleableMetadata: () => toggleableMetadata,
|
|
26
|
+
toggleableSource: () => toggleableSource
|
|
27
|
+
});
|
|
28
|
+
module.exports = __toCommonJS(toggleable_exports);
|
|
29
|
+
|
|
30
|
+
// src/schemas/toggleable.schema.ts
|
|
31
|
+
var toggleableSchema = {
|
|
32
|
+
name: "Toggleable",
|
|
33
|
+
category: "form",
|
|
34
|
+
tier: "core",
|
|
35
|
+
version: "1.0.0",
|
|
36
|
+
description: "Toggles a CSS class on click",
|
|
37
|
+
parameters: [
|
|
38
|
+
{
|
|
39
|
+
name: "cls",
|
|
40
|
+
type: "string",
|
|
41
|
+
optional: true,
|
|
42
|
+
default: "active",
|
|
43
|
+
description: "CSS class to toggle"
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
name: "target",
|
|
47
|
+
type: "selector",
|
|
48
|
+
optional: true,
|
|
49
|
+
default: "me",
|
|
50
|
+
description: "Element to toggle the class on"
|
|
51
|
+
}
|
|
52
|
+
],
|
|
53
|
+
events: [
|
|
54
|
+
{ name: "toggleable:on", description: "Fired when class is added" },
|
|
55
|
+
{ name: "toggleable:off", description: "Fired when class is removed" }
|
|
56
|
+
],
|
|
57
|
+
source: `
|
|
58
|
+
behavior Toggleable(cls, target)
|
|
59
|
+
init
|
|
60
|
+
if cls is undefined
|
|
61
|
+
set cls to "active"
|
|
62
|
+
end
|
|
63
|
+
if target is undefined
|
|
64
|
+
set target to me
|
|
65
|
+
end
|
|
66
|
+
end
|
|
67
|
+
on click
|
|
68
|
+
toggle .{cls} on target
|
|
69
|
+
end
|
|
70
|
+
end
|
|
71
|
+
`.trim()
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
// src/behaviors/toggleable.ts
|
|
75
|
+
var toggleableSource = toggleableSchema.source;
|
|
76
|
+
var toggleableMetadata = toggleableSchema;
|
|
77
|
+
async function registerToggleable(hyperfixi) {
|
|
78
|
+
const hf = hyperfixi || (typeof window !== "undefined" ? window.lokascript : null);
|
|
79
|
+
if (!hf) {
|
|
80
|
+
throw new Error(
|
|
81
|
+
"LokaScript not found. Make sure @hyperfixi/core is loaded before registering behaviors."
|
|
82
|
+
);
|
|
83
|
+
}
|
|
84
|
+
const result = hf.compileSync(toggleableSchema.source, { traditional: true });
|
|
85
|
+
if (!result.ok) {
|
|
86
|
+
throw new Error(`Failed to compile Toggleable behavior: ${JSON.stringify(result.errors)}`);
|
|
87
|
+
}
|
|
88
|
+
const ctx = hf.createContext ? hf.createContext() : { locals: /* @__PURE__ */ new Map(), globals: /* @__PURE__ */ new Map() };
|
|
89
|
+
await hf.execute(result.ast, ctx);
|
|
90
|
+
}
|
|
91
|
+
if (typeof window !== "undefined" && window.lokascript) {
|
|
92
|
+
registerToggleable().catch(console.error);
|
|
93
|
+
}
|
|
94
|
+
var toggleable_default = {
|
|
95
|
+
source: toggleableSchema.source,
|
|
96
|
+
metadata: toggleableSchema,
|
|
97
|
+
register: registerToggleable
|
|
98
|
+
};
|
|
99
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
100
|
+
0 && (module.exports = {
|
|
101
|
+
registerToggleable,
|
|
102
|
+
toggleableMetadata,
|
|
103
|
+
toggleableSource
|
|
104
|
+
});
|
|
105
|
+
//# sourceMappingURL=toggleable.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/behaviors/toggleable.ts","../../src/schemas/toggleable.schema.ts"],"sourcesContent":["/**\n * Toggleable Behavior\n *\n * A behavior that toggles a CSS class on click.\n * Useful for accordions, dropdowns, and toggle buttons.\n *\n * @example\n * ```html\n * <button _=\"install Toggleable\">Toggle</button>\n *\n * <button _=\"install Toggleable(cls: expanded, target: #menu)\">Menu</button>\n * ```\n */\n\nimport { toggleableSchema } from '../schemas/toggleable.schema';\nimport type { LokaScriptInstance, LokaScriptWindow } from '../schemas/types';\n\n// Re-export schema-derived values for backwards compatibility\nexport const toggleableSource = toggleableSchema.source;\nexport const toggleableMetadata = toggleableSchema;\n\n/**\n * Register the Toggleable behavior with LokaScript.\n */\nexport async function registerToggleable(hyperfixi?: LokaScriptInstance): Promise<void> {\n const hf =\n hyperfixi ||\n (typeof window !== 'undefined' ? (window as unknown as LokaScriptWindow).lokascript : null);\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 result = hf.compileSync(toggleableSchema.source, { traditional: true });\n\n if (!result.ok) {\n throw new Error(`Failed to compile Toggleable behavior: ${JSON.stringify(result.errors)}`);\n }\n\n const ctx = hf.createContext ? hf.createContext() : { locals: new Map(), globals: new Map() };\n await hf.execute(result.ast, ctx);\n}\n\n// Auto-register when loaded as a script tag\nif (typeof window !== 'undefined' && (window as unknown as LokaScriptWindow).lokascript) {\n registerToggleable().catch(console.error);\n}\n\nexport default {\n source: toggleableSchema.source,\n metadata: toggleableSchema,\n register: registerToggleable,\n};\n","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 end\nend\n`.trim(),\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACQO,IAAM,mBAAmC;AAAA,EAC9C,MAAM;AAAA,EACN,UAAU;AAAA,EACV,MAAM;AAAA,EACN,SAAS;AAAA,EACT,aAAa;AAAA,EACb,YAAY;AAAA,IACV;AAAA,MACE,MAAM;AAAA,MACN,MAAM;AAAA,MACN,UAAU;AAAA,MACV,SAAS;AAAA,MACT,aAAa;AAAA,IACf;AAAA,IACA;AAAA,MACE,MAAM;AAAA,MACN,MAAM;AAAA,MACN,UAAU;AAAA,MACV,SAAS;AAAA,MACT,aAAa;AAAA,IACf;AAAA,EACF;AAAA,EACA,QAAQ;AAAA,IACN,EAAE,MAAM,iBAAiB,aAAa,4BAA4B;AAAA,IAClE,EAAE,MAAM,kBAAkB,aAAa,8BAA8B;AAAA,EACvE;AAAA,EACA,QAAQ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAcR,KAAK;AACP;;;AD/BO,IAAM,mBAAmB,iBAAiB;AAC1C,IAAM,qBAAqB;AAKlC,eAAsB,mBAAmB,WAA+C;AACtF,QAAM,KACJ,cACC,OAAO,WAAW,cAAe,OAAuC,aAAa;AAExF,MAAI,CAAC,IAAI;AACP,UAAM,IAAI;AAAA,MACR;AAAA,IACF;AAAA,EACF;AAEA,QAAM,SAAS,GAAG,YAAY,iBAAiB,QAAQ,EAAE,aAAa,KAAK,CAAC;AAE5E,MAAI,CAAC,OAAO,IAAI;AACd,UAAM,IAAI,MAAM,0CAA0C,KAAK,UAAU,OAAO,MAAM,CAAC,EAAE;AAAA,EAC3F;AAEA,QAAM,MAAM,GAAG,gBAAgB,GAAG,cAAc,IAAI,EAAE,QAAQ,oBAAI,IAAI,GAAG,SAAS,oBAAI,IAAI,EAAE;AAC5F,QAAM,GAAG,QAAQ,OAAO,KAAK,GAAG;AAClC;AAGA,IAAI,OAAO,WAAW,eAAgB,OAAuC,YAAY;AACvF,qBAAmB,EAAE,MAAM,QAAQ,KAAK;AAC1C;AAEA,IAAO,qBAAQ;AAAA,EACb,QAAQ,iBAAiB;AAAA,EACzB,UAAU;AAAA,EACV,UAAU;AACZ;","names":[]}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { a as BehaviorSchema, L as LokaScriptInstance } from '../types-CCc_2wAb.cjs';
|
|
2
|
+
|
|
3
|
+
declare const toggleableSource: string;
|
|
4
|
+
declare const toggleableMetadata: BehaviorSchema;
|
|
5
|
+
/**
|
|
6
|
+
* Register the Toggleable behavior with LokaScript.
|
|
7
|
+
*/
|
|
8
|
+
declare function registerToggleable(hyperfixi?: LokaScriptInstance): Promise<void>;
|
|
9
|
+
declare const _default: {
|
|
10
|
+
source: string;
|
|
11
|
+
metadata: BehaviorSchema;
|
|
12
|
+
register: typeof registerToggleable;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export { _default as default, registerToggleable, toggleableMetadata, toggleableSource };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { a as BehaviorSchema, L as LokaScriptInstance } from '../types-CCc_2wAb.js';
|
|
2
|
+
|
|
3
|
+
declare const toggleableSource: string;
|
|
4
|
+
declare const toggleableMetadata: BehaviorSchema;
|
|
5
|
+
/**
|
|
6
|
+
* Register the Toggleable behavior with LokaScript.
|
|
7
|
+
*/
|
|
8
|
+
declare function registerToggleable(hyperfixi?: LokaScriptInstance): Promise<void>;
|
|
9
|
+
declare const _default: {
|
|
10
|
+
source: string;
|
|
11
|
+
metadata: BehaviorSchema;
|
|
12
|
+
register: typeof registerToggleable;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export { _default as default, registerToggleable, toggleableMetadata, toggleableSource };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import {
|
|
2
|
+
registerToggleable,
|
|
3
|
+
toggleableMetadata,
|
|
4
|
+
toggleableSource,
|
|
5
|
+
toggleable_default
|
|
6
|
+
} from "../chunk-3Q652JQB.js";
|
|
7
|
+
import "../chunk-WUHHMDAA.js";
|
|
8
|
+
export {
|
|
9
|
+
toggleable_default as default,
|
|
10
|
+
registerToggleable,
|
|
11
|
+
toggleableMetadata,
|
|
12
|
+
toggleableSource
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=toggleable.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
// src/schemas/removable.schema.ts
|
|
2
|
+
var removableSchema = {
|
|
3
|
+
name: "Removable",
|
|
4
|
+
category: "data",
|
|
5
|
+
tier: "common",
|
|
6
|
+
version: "1.2.0",
|
|
7
|
+
description: "Makes elements removable on click",
|
|
8
|
+
parameters: [
|
|
9
|
+
{
|
|
10
|
+
name: "triggerEl",
|
|
11
|
+
type: "selector",
|
|
12
|
+
optional: true,
|
|
13
|
+
default: "me",
|
|
14
|
+
description: "Element that triggers removal (e.g., a close button)"
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
name: "confirm",
|
|
18
|
+
type: "boolean",
|
|
19
|
+
optional: true,
|
|
20
|
+
default: false,
|
|
21
|
+
description: "Show confirmation dialog before removal"
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
name: "effect",
|
|
25
|
+
type: "string",
|
|
26
|
+
optional: true,
|
|
27
|
+
default: "none",
|
|
28
|
+
enum: ["fade", "none"],
|
|
29
|
+
description: 'Transition effect: "fade" or "none"'
|
|
30
|
+
}
|
|
31
|
+
],
|
|
32
|
+
events: [
|
|
33
|
+
{ name: "removable:before", description: "Fired before removal (cancelable)" },
|
|
34
|
+
{ name: "removable:removed", description: "Fired after removal" }
|
|
35
|
+
],
|
|
36
|
+
source: `
|
|
37
|
+
behavior Removable(triggerEl, confirm, effect)
|
|
38
|
+
init
|
|
39
|
+
if triggerEl is undefined
|
|
40
|
+
set triggerEl to me
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
on click from triggerEl
|
|
44
|
+
if confirm
|
|
45
|
+
if not window.confirm("Are you sure?")
|
|
46
|
+
halt
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
trigger removable:before
|
|
50
|
+
if effect is "fade"
|
|
51
|
+
transition opacity to 0 over 300ms
|
|
52
|
+
end
|
|
53
|
+
trigger removable:removed
|
|
54
|
+
remove me
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
`.trim()
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
export {
|
|
61
|
+
removableSchema
|
|
62
|
+
};
|
|
63
|
+
//# sourceMappingURL=chunk-272NKUJ3.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/schemas/removable.schema.ts"],"sourcesContent":["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: 'confirm',\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, confirm, effect)\n init\n if triggerEl is undefined\n set triggerEl to me\n end\n end\n on click from triggerEl\n if confirm\n if not window.confirm(\"Are you sure?\")\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"],"mappings":";AAYO,IAAM,kBAAkC;AAAA,EAC7C,MAAM;AAAA,EACN,UAAU;AAAA,EACV,MAAM;AAAA,EACN,SAAS;AAAA,EACT,aAAa;AAAA,EACb,YAAY;AAAA,IACV;AAAA,MACE,MAAM;AAAA,MACN,MAAM;AAAA,MACN,UAAU;AAAA,MACV,SAAS;AAAA,MACT,aAAa;AAAA,IACf;AAAA,IACA;AAAA,MACE,MAAM;AAAA,MACN,MAAM;AAAA,MACN,UAAU;AAAA,MACV,SAAS;AAAA,MACT,aAAa;AAAA,IACf;AAAA,IACA;AAAA,MACE,MAAM;AAAA,MACN,MAAM;AAAA,MACN,UAAU;AAAA,MACV,SAAS;AAAA,MACT,MAAM,CAAC,QAAQ,MAAM;AAAA,MACrB,aAAa;AAAA,IACf;AAAA,EACF;AAAA,EACA,QAAQ;AAAA,IACN,EAAE,MAAM,oBAAoB,aAAa,oCAAoC;AAAA,IAC7E,EAAE,MAAM,qBAAqB,aAAa,sBAAsB;AAAA,EAClE;AAAA,EACA,QAAQ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAqBR,KAAK;AACP;","names":[]}
|