@stacksjs/stx 0.2.195 → 0.2.197

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (129) hide show
  1. package/dist/chunk-0ae6chzd.js +4 -0
  2. package/dist/chunk-0w0mrtme.js +2 -0
  3. package/dist/chunk-0y46fbkx.js +3 -0
  4. package/dist/chunk-118a77bs.js +4471 -0
  5. package/dist/chunk-12nvcvtn.js +3 -0
  6. package/dist/chunk-14ynv5ah.js +2 -0
  7. package/dist/chunk-1e25ksp6.js +3 -0
  8. package/dist/chunk-1mhc4g86.js +43 -0
  9. package/dist/chunk-1thssz8x.js +2 -0
  10. package/dist/chunk-1yk07x7b.js +2 -0
  11. package/dist/chunk-2zkj69dg.js +13 -0
  12. package/dist/chunk-338316c2.js +2 -0
  13. package/dist/chunk-3952ykhb.js +1655 -0
  14. package/dist/chunk-3es366z4.js +3 -0
  15. package/dist/chunk-3m49eb4v.js +2 -0
  16. package/dist/chunk-3nmpfsw5.js +2 -0
  17. package/dist/chunk-3vy1q9da.js +2 -0
  18. package/dist/chunk-4a4h28pp.js +3022 -0
  19. package/dist/chunk-4pf61rcb.js +2 -0
  20. package/dist/chunk-5anpcnde.js +2 -0
  21. package/dist/chunk-5mkkre22.js +505 -0
  22. package/dist/chunk-5n0dt838.js +2 -0
  23. package/dist/chunk-5s2y052b.js +2 -0
  24. package/dist/chunk-5v64c8tr.js +2 -0
  25. package/dist/chunk-5xd7vge2.js +2 -0
  26. package/dist/chunk-6bxcjdp4.js +2 -0
  27. package/dist/chunk-6msvxnbr.js +2 -0
  28. package/dist/chunk-7kger0se.js +1280 -0
  29. package/dist/chunk-7ry55nms.js +3 -0
  30. package/dist/chunk-7s0wfa4e.js +24 -0
  31. package/dist/chunk-7w4c5w2b.js +2 -0
  32. package/dist/chunk-8src5smc.js +15 -0
  33. package/dist/chunk-937effkz.js +2 -0
  34. package/dist/chunk-9b82d4g5.js +3 -0
  35. package/dist/chunk-9xh78snm.js +3 -0
  36. package/dist/chunk-a2899x2t.js +2 -0
  37. package/dist/chunk-abpw3b39.js +2 -0
  38. package/dist/chunk-avwj12at.js +194 -0
  39. package/dist/chunk-b6jhznkh.js +71 -0
  40. package/dist/chunk-bpa2jeyw.js +3 -0
  41. package/dist/chunk-cbc56wpd.js +3 -0
  42. package/dist/chunk-dhpy0h9y.js +2 -0
  43. package/dist/chunk-dtmwr674.js +302 -0
  44. package/dist/chunk-dxfcyj8t.js +2 -0
  45. package/dist/chunk-e0460y7f.js +29 -0
  46. package/dist/chunk-ede7zpjf.js +2 -0
  47. package/dist/chunk-ehfzp7xe.js +2 -0
  48. package/dist/chunk-fd77g6t6.js +2 -0
  49. package/dist/chunk-fnkxbnka.js +30 -0
  50. package/dist/chunk-fvjh7rx0.js +84 -0
  51. package/dist/chunk-g19skgmw.js +18 -0
  52. package/dist/chunk-gcnrdgrq.js +3 -0
  53. package/dist/chunk-h2wpnxrh.js +8 -0
  54. package/dist/chunk-hb83d0qc.js +2 -0
  55. package/dist/chunk-hncp9gz6.js +8 -0
  56. package/dist/chunk-ht51fz7w.js +4 -0
  57. package/dist/chunk-hyrjade7.js +321 -0
  58. package/dist/chunk-hyyzp99b.js +2 -0
  59. package/dist/chunk-jpbk42j7.js +2 -0
  60. package/dist/chunk-jr5tp4ks.js +2 -0
  61. package/dist/chunk-k03b9z9e.js +898 -0
  62. package/dist/chunk-kjr22neh.js +3 -0
  63. package/dist/chunk-mjt5e2jy.js +2 -0
  64. package/dist/chunk-mkm91b6w.js +2 -0
  65. package/dist/chunk-mtr2f82n.js +2 -0
  66. package/dist/chunk-n8zpm7xb.js +397 -0
  67. package/dist/chunk-ndnc7k2n.js +22 -0
  68. package/dist/chunk-nenge2m2.js +2 -0
  69. package/dist/chunk-nngpktr2.js +2 -0
  70. package/dist/chunk-nsjyn31z.js +2 -0
  71. package/dist/chunk-nye9brje.js +147 -0
  72. package/dist/chunk-p5kp35dy.js +2 -0
  73. package/dist/chunk-pw0rzgpv.js +3 -0
  74. package/dist/chunk-q020t182.js +2 -0
  75. package/dist/chunk-q4gp9egt.js +4 -0
  76. package/dist/chunk-q8szpd6w.js +3 -0
  77. package/dist/chunk-q9n5swx7.js +3 -0
  78. package/dist/chunk-qpcwahse.js +2 -0
  79. package/dist/chunk-qz75kx6n.js +231 -0
  80. package/dist/chunk-r41nsgym.js +116 -0
  81. package/dist/chunk-r4qnvxhv.js +18 -0
  82. package/dist/chunk-r6p4ws0a.js +3809 -0
  83. package/dist/chunk-rdf7d42n.js +2 -0
  84. package/dist/chunk-rs2fa3g1.js +2 -0
  85. package/dist/chunk-ryjpp51z.js +499 -0
  86. package/dist/chunk-s018d32j.js +30 -0
  87. package/dist/chunk-spn8e3b3.js +2 -0
  88. package/dist/chunk-sry9atvv.js +2 -0
  89. package/dist/chunk-st5qggks.js +3 -0
  90. package/dist/chunk-tywvd1zc.js +11 -0
  91. package/dist/chunk-v3ryxw4v.js +2 -0
  92. package/dist/chunk-va9k88da.js +2 -0
  93. package/dist/chunk-vgk5v31k.js +216 -0
  94. package/dist/chunk-vj320kyr.js +2 -0
  95. package/dist/chunk-vr3qtsj4.js +2 -0
  96. package/dist/chunk-w0ng9e1m.js +341 -0
  97. package/dist/chunk-w29sv5jf.js +2 -0
  98. package/dist/chunk-whq99ytc.js +7987 -0
  99. package/dist/chunk-wnaddtv3.js +288 -0
  100. package/dist/chunk-wtengj6h.js +2 -0
  101. package/dist/chunk-x0ks1fer.js +1194 -0
  102. package/dist/chunk-x0zh76yv.js +4 -0
  103. package/dist/chunk-x13f5bbe.js +358 -0
  104. package/dist/chunk-xfp10a23.js +2 -0
  105. package/dist/chunk-xp3fp266.js +11 -0
  106. package/dist/chunk-xz019t7t.js +2 -0
  107. package/dist/chunk-y35rktea.js +12 -0
  108. package/dist/chunk-y4hkqsgw.js +4 -0
  109. package/dist/chunk-yab6d6kb.js +28 -0
  110. package/dist/chunk-yckd6ks5.js +3 -0
  111. package/dist/chunk-ycn1vnv2.js +5 -0
  112. package/dist/chunk-yf3bmmkk.js +8 -0
  113. package/dist/chunk-ygr11tgz.js +3 -0
  114. package/dist/chunk-ymccpdg6.js +351 -0
  115. package/dist/chunk-yr2wc2pa.js +3 -0
  116. package/dist/chunk-yv340gxj.js +2 -0
  117. package/dist/chunk-z2sp0k8d.js +3 -0
  118. package/dist/chunk-z5cm0bwn.js +11 -0
  119. package/dist/chunk-zda3hvde.js +14 -0
  120. package/dist/chunk-zgvga8rc.js +5 -0
  121. package/dist/chunk-zqbw8zqq.js +3 -0
  122. package/dist/cli.js +108 -27481
  123. package/dist/craft-entry.js +9 -5
  124. package/dist/craft.js +7 -18503
  125. package/dist/database.js +2 -2
  126. package/dist/pwa.js +8 -16603
  127. package/dist/ssg.js +52 -15512
  128. package/dist/visual-testing.js +1 -1
  129. package/package.json +5 -5
@@ -0,0 +1,288 @@
1
+ // @bun
2
+ import"./chunk-pw0rzgpv.js";function F(){return`<script data-stx-scoped data-stx-x-element-runtime data-stx-run="always">
3
+ (function() {
4
+ 'use strict';
5
+
6
+ class XElement {
7
+ constructor(el, data) {
8
+ this.el = el;
9
+ this.data = this.makeReactive(data);
10
+ this.watchers = new Map();
11
+ this.init();
12
+ }
13
+
14
+ makeReactive(obj) {
15
+ const self = this;
16
+ return new Proxy(obj, {
17
+ get(target, key) {
18
+ return target[key];
19
+ },
20
+ set(target, key, value) {
21
+ const oldValue = target[key];
22
+ target[key] = value;
23
+ if (oldValue !== value) {
24
+ self.update(key);
25
+ }
26
+ return true;
27
+ }
28
+ });
29
+ }
30
+
31
+ init() {
32
+ this.processElement(this.el);
33
+
34
+ // Process x-init (run expression after initialization)
35
+ const initExpr = this.el.getAttribute('x-init');
36
+ if (initExpr) {
37
+ setTimeout(() => this.execute(initExpr), 0);
38
+ }
39
+ }
40
+
41
+ processElement(el) {
42
+ // Process x-model (two-way binding)
43
+ const models = el.querySelectorAll('[x-model]');
44
+ models.forEach(input => {
45
+ const key = input.getAttribute('x-model');
46
+
47
+ // Set initial value
48
+ if (this.data[key] !== undefined) {
49
+ if (input.type === 'checkbox') {
50
+ input.checked = this.data[key];
51
+ }
52
+ else if (input.type === 'radio') {
53
+ input.checked = input.value === this.data[key];
54
+ }
55
+ else {
56
+ input.value = this.data[key];
57
+ }
58
+ }
59
+
60
+ // Listen for changes
61
+ const eventType = input.tagName === 'SELECT' || input.type === 'checkbox' || input.type === 'radio' ? 'change' : 'input';
62
+ input.addEventListener(eventType, () => {
63
+ if (input.type === 'checkbox') {
64
+ this.data[key] = input.checked;
65
+ }
66
+ else if (input.type === 'radio') {
67
+ if (input.checked) this.data[key] = input.value;
68
+ }
69
+ else if (input.type === 'number' || input.type === 'range') {
70
+ this.data[key] = parseFloat(input.value) || 0;
71
+ }
72
+ else {
73
+ this.data[key] = input.value;
74
+ }
75
+ });
76
+
77
+ // Watch for data changes
78
+ this.watch(key, (value) => {
79
+ if (input.type === 'checkbox') {
80
+ input.checked = value;
81
+ }
82
+ else if (input.type === 'radio') {
83
+ input.checked = input.value === value;
84
+ }
85
+ else if (input.value !== String(value)) {
86
+ input.value = value;
87
+ }
88
+ });
89
+ });
90
+
91
+ // Process x-text (reactive text)
92
+ const texts = el.querySelectorAll('[x-text]');
93
+ texts.forEach(elem => {
94
+ const expr = elem.getAttribute('x-text');
95
+ const update = () => {
96
+ elem.textContent = this.evaluate(expr);
97
+ };
98
+ update();
99
+ this.watchExpression(expr, update);
100
+ });
101
+
102
+ // Process x-html (reactive innerHTML)
103
+ const htmls = el.querySelectorAll('[x-html]');
104
+ htmls.forEach(elem => {
105
+ const expr = elem.getAttribute('x-html');
106
+ const update = () => {
107
+ elem.innerHTML = this.evaluate(expr);
108
+ };
109
+ update();
110
+ this.watchExpression(expr, update);
111
+ });
112
+
113
+ // Process x-show (toggle visibility)
114
+ const shows = el.querySelectorAll('[x-show]');
115
+ shows.forEach(elem => {
116
+ const expr = elem.getAttribute('x-show');
117
+ const update = () => {
118
+ elem.style.display = this.evaluate(expr) ? '' : 'none';
119
+ };
120
+ update();
121
+ this.watchExpression(expr, update);
122
+ });
123
+
124
+ // Process @event and :bind attributes
125
+ const allElements = el.querySelectorAll('*');
126
+ allElements.forEach(elem => {
127
+ Array.from(elem.attributes).forEach(attr => {
128
+ if (attr.name.startsWith('@')) {
129
+ // Event handling
130
+ const eventName = attr.name.slice(1);
131
+ const expr = attr.value;
132
+
133
+ // Handle modifiers
134
+ const parts = eventName.split('.');
135
+ const event = parts[0];
136
+ const modifiers = parts.slice(1);
137
+
138
+ // Determine target element for event listener
139
+ const useWindow = modifiers.includes('window');
140
+ const useOutside = modifiers.includes('outside');
141
+ const useOnce = modifiers.includes('once');
142
+ const target = useWindow ? window : elem;
143
+
144
+ // Check for debounce modifier (e.g., debounce.300)
145
+ let debounceMs = 0;
146
+ const debounceIdx = modifiers.indexOf('debounce');
147
+ if (debounceIdx !== -1 && modifiers[debounceIdx + 1]) {
148
+ debounceMs = parseInt(modifiers[debounceIdx + 1]) || 0;
149
+ }
150
+
151
+ let debounceTimer;
152
+ const handler = (e) => {
153
+ if (modifiers.includes('prevent')) e.preventDefault();
154
+ if (modifiers.includes('stop')) e.stopPropagation();
155
+ if (modifiers.includes('self') && e.target !== elem) return;
156
+
157
+ // For .outside modifier, only fire if click was outside the element
158
+ if (useOutside && elem.contains(e.target)) return;
159
+
160
+ // Key modifiers
161
+ if (event === 'keydown' || event === 'keyup' || event === 'keypress') {
162
+ const keyMap = { enter: 'Enter', escape: 'Escape', tab: 'Tab', space: ' ' };
163
+ for (const mod of modifiers) {
164
+ if (keyMap[mod] && e.key !== keyMap[mod]) return;
165
+ }
166
+ }
167
+
168
+ if (debounceMs > 0) {
169
+ clearTimeout(debounceTimer);
170
+ debounceTimer = setTimeout(() => this.execute(expr, { $event: e, $el: elem }), debounceMs);
171
+ }
172
+ else {
173
+ this.execute(expr, { $event: e, $el: elem });
174
+ }
175
+ };
176
+
177
+ target.addEventListener(event, handler, { once: useOnce });
178
+ }
179
+ else if (attr.name.startsWith(':')) {
180
+ // Attribute binding (:disabled, :class, :href, :src, etc.)
181
+ const bindAttr = attr.name.slice(1);
182
+ const expr = attr.value;
183
+
184
+ const update = () => {
185
+ const val = this.evaluate(expr);
186
+ if (bindAttr === 'class') {
187
+ // :class supports object syntax { className: bool }
188
+ if (val && typeof val === 'object') {
189
+ for (const [cls, active] of Object.entries(val)) {
190
+ elem.classList.toggle(cls, !!active);
191
+ }
192
+ }
193
+ else if (typeof val === 'string') {
194
+ elem.className = val;
195
+ }
196
+ }
197
+ else if (typeof val === 'boolean') {
198
+ // Boolean attributes (disabled, hidden, readonly, etc.)
199
+ if (val) {
200
+ elem.setAttribute(bindAttr, '');
201
+ }
202
+ else {
203
+ elem.removeAttribute(bindAttr);
204
+ }
205
+ }
206
+ else {
207
+ elem.setAttribute(bindAttr, val != null ? String(val) : '');
208
+ }
209
+ };
210
+ update();
211
+ this.watchExpression(expr, update);
212
+ }
213
+ });
214
+ });
215
+ }
216
+
217
+ watch(key, callback) {
218
+ if (!this.watchers.has(key)) {
219
+ this.watchers.set(key, []);
220
+ }
221
+ this.watchers.get(key).push(callback);
222
+ }
223
+
224
+ watchExpression(expr, callback) {
225
+ const vars = expr.match(/[a-zA-Z_$][a-zA-Z0-9_$]*/g) || [];
226
+ vars.forEach(v => {
227
+ if (v in this.data) {
228
+ this.watch(v, callback);
229
+ }
230
+ });
231
+ }
232
+
233
+ update(key) {
234
+ const callbacks = this.watchers.get(key) || [];
235
+ callbacks.forEach(cb => cb(this.data[key]));
236
+ }
237
+
238
+ evaluate(expr) {
239
+ try {
240
+ const fn = new Function(...Object.keys(this.data), 'return ' + expr);
241
+ return fn(...Object.values(this.data));
242
+ }
243
+ catch (e) {
244
+ console.warn('x-element: Error evaluating', expr, e);
245
+ return '';
246
+ }
247
+ }
248
+
249
+ execute(expr, extra = {}) {
250
+ try {
251
+ const allData = { ...this.data, ...extra };
252
+ const fn = new Function(...Object.keys(allData), expr);
253
+ fn.call(this.data, ...Object.values(allData));
254
+ }
255
+ catch (e) {
256
+ console.warn('x-element: Error executing', expr, e);
257
+ }
258
+ }
259
+ }
260
+
261
+ // Initialize all x-data elements
262
+ function init() {
263
+ document.querySelectorAll('[x-data]').forEach(el => {
264
+ const dataExpr = el.getAttribute('x-data');
265
+ try {
266
+ const data = new Function('return ' + dataExpr)();
267
+ new XElement(el, data);
268
+ }
269
+ catch (e) {
270
+ console.error('x-element: Error parsing x-data', e);
271
+ }
272
+ });
273
+ }
274
+
275
+ // Run on DOM ready
276
+ if (document.readyState === 'loading') {
277
+ document.addEventListener('DOMContentLoaded', init);
278
+ }
279
+ else {
280
+ init();
281
+ }
282
+
283
+ // Expose for manual initialization
284
+ window.XElement = XElement;
285
+ })();
286
+ </script>`}function G(k){return/\bx-data(?:\s|=)/.test(k)}function H(k){let z=/<script\b(?=[^>]*\bdata-stx-x-element-runtime\b)[^>]*>[\s\S]*?<\/script>\s*/gi,A=k.match(z)||[],j=A.length>0?k.replace(z,""):k;if(!G(j))return j;let B=A[0]?.trim()||F(),q=j.lastIndexOf("</body>");if(q!==-1)return j.slice(0,q)+B+`
287
+ `+j.slice(q);return j+`
288
+ `+B}export{H as processXElementDirectives,G as hasXElementDirectives,F as generateXElementRuntime};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{Ai as k,qi as a,ri as b,si as c,ti as d,ui as e,vi as f,wi as g,xi as h,yi as i,zi as j}from"./chunk-n8zpm7xb.js";import"./chunk-pw0rzgpv.js";export{i as processStaticDirectives,b as processPartialHydrationDirectives,h as onHydrated,g as isHydrated,d as hydrateIsland,e as hydrateByStrategy,f as hydrateAll,c as generatePartialHydrationCSS,j as generateIslandManifest,k as default,a as createIslandRegistry};