@stacksjs/bun-router 0.1.7 → 0.1.8
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/chunk-4wd1d6ay.js +416 -0
- package/dist/{chunk-nf3kv7kv.js → chunk-8rrs7556.js} +1 -1
- package/dist/{chunk-3y4gaz7v.js → chunk-m4aaj9ay.js} +1 -1
- package/dist/cli.js +30 -59
- package/dist/container/index.js +1 -1
- package/dist/index.js +2 -2
- package/package.json +9 -1
- package/dist/chunk-03m2j6h7.js +0 -2
- package/dist/chunk-08cw7ejr.js +0 -3
- package/dist/chunk-0e4g0fyv.js +0 -62
- package/dist/chunk-0mmn02yw.js +0 -2
- package/dist/chunk-126c9qm3.js +0 -2
- package/dist/chunk-12p13817.js +0 -2
- package/dist/chunk-14v65c37.js +0 -4
- package/dist/chunk-1b6a7t3v.js +0 -231
- package/dist/chunk-1wenkmk0.js +0 -2
- package/dist/chunk-2152npfd.js +0 -2
- package/dist/chunk-26w23krx.js +0 -2
- package/dist/chunk-2g8m379z.js +0 -10
- package/dist/chunk-2rr178et.js +0 -1654
- package/dist/chunk-2w8f3swz.js +0 -29
- package/dist/chunk-4r1x4afz.js +0 -12
- package/dist/chunk-4wyw66zk.js +0 -2
- package/dist/chunk-4z5sf8ag.js +0 -2
- package/dist/chunk-58tfvayh.js +0 -4
- package/dist/chunk-5be9x5cq.js +0 -3
- package/dist/chunk-5dp83qcx.js +0 -397
- package/dist/chunk-5f0d9j9a.js +0 -2
- package/dist/chunk-5z52b0fc.js +0 -28
- package/dist/chunk-5zrnk2kq.js +0 -4
- package/dist/chunk-6bbmkwng.js +0 -3
- package/dist/chunk-6dmqtdnq.js +0 -2
- package/dist/chunk-6e91956t.js +0 -3
- package/dist/chunk-6rv8w5jk.js +0 -2
- package/dist/chunk-6x1feysm.js +0 -3
- package/dist/chunk-7qnxdedn.js +0 -321
- package/dist/chunk-7y72hm1x.js +0 -2
- package/dist/chunk-8hbhfh6b.js +0 -194
- package/dist/chunk-8kfzygg5.js +0 -3
- package/dist/chunk-8wpj3fqe.js +0 -351
- package/dist/chunk-8wydx2we.js +0 -2
- package/dist/chunk-8zjnjvv7.js +0 -2
- package/dist/chunk-9805tt8n.js +0 -341
- package/dist/chunk-988h4bzr.js +0 -2
- package/dist/chunk-9b6a58ac.js +0 -2
- package/dist/chunk-a8fcaywb.js +0 -2
- package/dist/chunk-bfjwn7yg.js +0 -2
- package/dist/chunk-bp2522mm.js +0 -2
- package/dist/chunk-brpgjyqg.js +0 -3
- package/dist/chunk-bswe62q4.js +0 -48
- package/dist/chunk-c3v796c8.js +0 -943
- package/dist/chunk-ccqmwdry.js +0 -2
- package/dist/chunk-ck0crwnx.js +0 -2
- package/dist/chunk-cqgkxcb4.js +0 -2
- package/dist/chunk-dntnakjy.js +0 -2
- package/dist/chunk-dxg045wj.js +0 -5
- package/dist/chunk-e3qej0jr.js +0 -4
- package/dist/chunk-ettdpnrw.js +0 -60
- package/dist/chunk-ezqwq17j.js +0 -185
- package/dist/chunk-ezx3qsez.js +0 -2
- package/dist/chunk-f72nnjy4.js +0 -15413
- package/dist/chunk-fna5n0ey.js +0 -246
- package/dist/chunk-fqhckdt8.js +0 -2
- package/dist/chunk-fr6hbx25.js +0 -2
- package/dist/chunk-g9cwng6w.js +0 -3
- package/dist/chunk-gd3za5x0.js +0 -2
- package/dist/chunk-gf28608k.js +0 -2
- package/dist/chunk-h1dj6v8q.js +0 -3
- package/dist/chunk-hjxe7k2g.js +0 -2
- package/dist/chunk-hrkgznbn.js +0 -2
- package/dist/chunk-j6h5v0br.js +0 -2
- package/dist/chunk-kjtjbcq4.js +0 -71
- package/dist/chunk-mgb01qdv.js +0 -14
- package/dist/chunk-n24c9whp.js +0 -2
- package/dist/chunk-n2j24b0h.js +0 -4540
- package/dist/chunk-nhmtg01n.js +0 -84
- package/dist/chunk-p0qhpnqh.js +0 -70
- package/dist/chunk-p0w1x8y2.js +0 -3
- package/dist/chunk-p3dk1w2w.js +0 -216
- package/dist/chunk-q4e9pxs7.js +0 -3
- package/dist/chunk-q5dv1kyy.js +0 -2
- package/dist/chunk-qnqgf9tq.js +0 -2
- package/dist/chunk-qvwy1808.js +0 -898
- package/dist/chunk-r18f77vc.js +0 -12
- package/dist/chunk-r63za1mr.js +0 -2
- package/dist/chunk-rft8gw92.js +0 -7851
- package/dist/chunk-ryvmyskt.js +0 -4211
- package/dist/chunk-sa6mx308.js +0 -2
- package/dist/chunk-sw0chtw4.js +0 -4
- package/dist/chunk-va0pc7hx.js +0 -2
- package/dist/chunk-vcp8dnjq.js +0 -412
- package/dist/chunk-vg1erq1q.js +0 -2
- package/dist/chunk-vsh4390q.js +0 -358
- package/dist/chunk-w0jv49ch.js +0 -11
- package/dist/chunk-wm805tte.js +0 -35
- package/dist/chunk-xg9xscqz.js +0 -1
- package/dist/chunk-xj9h6mc9.js +0 -2
- package/dist/chunk-ytvzwrq3.js +0 -51
- package/dist/chunk-zde7ebc4.js +0 -288
- package/dist/chunk-zmqsv2xy.js +0 -2
package/dist/chunk-8wpj3fqe.js
DELETED
|
@@ -1,351 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
var d=0;function s(){return`keep-alive-${++d}-${Date.now().toString(36)}`}function h(e,t={},o){let n=/@keepAlive(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@endkeepAlive/gi;return e.replace(n,(a,c,i)=>{let l=s(),r=u(c||"");return p(l,i.trim(),r)})}function u(e){let t={max:10},o=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,n;while((n=o.exec(e))!==null){let a=n[1],c=n[2]||n[3],i=n[4];switch(a){case"max":t.max=i?parseInt(i,10):10;break;case"include":t.include=c;break;case"exclude":t.exclude=c;break;case"id":t.id=c;break}}return t}function p(e,t,o){let{max:n,include:a,exclude:c}=o,i=o.id||e;return`
|
|
3
|
-
<div class="stx-keep-alive" data-keep-alive-id="${e}" data-custom-id="${i}">
|
|
4
|
-
<div class="stx-keep-alive-content" data-keep-alive-content="${e}">
|
|
5
|
-
${t}
|
|
6
|
-
</div>
|
|
7
|
-
<div class="stx-keep-alive-cache" data-keep-alive-cache="${e}" style="display: none;">
|
|
8
|
-
</div>
|
|
9
|
-
</div>
|
|
10
|
-
<script>
|
|
11
|
-
(function() {
|
|
12
|
-
const keepAliveId = '${e}';
|
|
13
|
-
const customId = '${i}';
|
|
14
|
-
const maxCache = ${n||10};
|
|
15
|
-
const includeFilter = ${a?JSON.stringify(a.split(",").map((l)=>l.trim())):"null"};
|
|
16
|
-
const excludeFilter = ${c?JSON.stringify(c.split(",").map((l)=>l.trim())):"null"};
|
|
17
|
-
|
|
18
|
-
const container = document.querySelector('[data-keep-alive-id="' + keepAliveId + '"]');
|
|
19
|
-
const contentEl = document.querySelector('[data-keep-alive-content="' + keepAliveId + '"]');
|
|
20
|
-
const cacheEl = document.querySelector('[data-keep-alive-cache="' + keepAliveId + '"]');
|
|
21
|
-
|
|
22
|
-
if (!container || !contentEl || !cacheEl) return;
|
|
23
|
-
|
|
24
|
-
// LRU Cache
|
|
25
|
-
const cache = new Map();
|
|
26
|
-
const cacheOrder = [];
|
|
27
|
-
|
|
28
|
-
// Check if component should be cached
|
|
29
|
-
function shouldCache(componentName) {
|
|
30
|
-
if (excludeFilter && excludeFilter.includes(componentName)) {
|
|
31
|
-
return false;
|
|
32
|
-
}
|
|
33
|
-
if (includeFilter && !includeFilter.includes(componentName)) {
|
|
34
|
-
return false;
|
|
35
|
-
}
|
|
36
|
-
return true;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
// Get component key from element
|
|
40
|
-
function getComponentKey(element) {
|
|
41
|
-
// Try various ways to identify the component
|
|
42
|
-
return element.getAttribute('data-component') ||
|
|
43
|
-
element.getAttribute('data-key') ||
|
|
44
|
-
element.id ||
|
|
45
|
-
element.className.split(' ')[0] ||
|
|
46
|
-
element.tagName.toLowerCase();
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
// Save scroll positions
|
|
50
|
-
function saveScrollPositions(element) {
|
|
51
|
-
const positions = new Map();
|
|
52
|
-
// eslint-disable-next-line pickier/no-unused-vars
|
|
53
|
-
element.querySelectorAll('[data-keep-scroll]').forEach(function(el) {
|
|
54
|
-
const key = el.getAttribute('data-keep-scroll') || el.id || 'default';
|
|
55
|
-
positions.set(key, { top: el.scrollTop, left: el.scrollLeft });
|
|
56
|
-
});
|
|
57
|
-
// Also save the element's own scroll if scrollable
|
|
58
|
-
if (element.scrollHeight > element.clientHeight || element.scrollWidth > element.clientWidth) {
|
|
59
|
-
positions.set('__self__', { top: element.scrollTop, left: element.scrollLeft });
|
|
60
|
-
}
|
|
61
|
-
return positions;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
// Restore scroll positions
|
|
65
|
-
function restoreScrollPositions(element, positions) {
|
|
66
|
-
if (!positions) return;
|
|
67
|
-
|
|
68
|
-
positions.forEach(function(pos, key) {
|
|
69
|
-
if (key === '__self__') {
|
|
70
|
-
element.scrollTop = pos.top;
|
|
71
|
-
element.scrollLeft = pos.left;
|
|
72
|
-
}
|
|
73
|
-
else {
|
|
74
|
-
const el = element.querySelector('[data-keep-scroll="' + key + '"]') ||
|
|
75
|
-
document.getElementById(key);
|
|
76
|
-
if (el) {
|
|
77
|
-
el.scrollTop = pos.top;
|
|
78
|
-
el.scrollLeft = pos.left;
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
});
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
// Save component state (form values, etc.)
|
|
85
|
-
function saveComponentState(element) {
|
|
86
|
-
const state = {};
|
|
87
|
-
|
|
88
|
-
// Save form inputs
|
|
89
|
-
// eslint-disable-next-line pickier/no-unused-vars
|
|
90
|
-
element.querySelectorAll('input, textarea, select').forEach(function(input, index) {
|
|
91
|
-
const key = input.name || input.id || 'input_' + index;
|
|
92
|
-
if (input.type === 'checkbox' || input.type === 'radio') {
|
|
93
|
-
state[key] = input.checked;
|
|
94
|
-
}
|
|
95
|
-
else {
|
|
96
|
-
state[key] = input.value;
|
|
97
|
-
}
|
|
98
|
-
});
|
|
99
|
-
|
|
100
|
-
// Save data attributes marked for keeping
|
|
101
|
-
// eslint-disable-next-line pickier/no-unused-vars
|
|
102
|
-
element.querySelectorAll('[data-keep-state]').forEach(function(el) {
|
|
103
|
-
const key = el.getAttribute('data-keep-state');
|
|
104
|
-
const value = el.getAttribute('data-state-value') || el.textContent;
|
|
105
|
-
state['__data__' + key] = value;
|
|
106
|
-
});
|
|
107
|
-
|
|
108
|
-
return state;
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
// Restore component state
|
|
112
|
-
function restoreComponentState(element, state) {
|
|
113
|
-
if (!state) return;
|
|
114
|
-
|
|
115
|
-
// Restore form inputs
|
|
116
|
-
// eslint-disable-next-line pickier/no-unused-vars
|
|
117
|
-
element.querySelectorAll('input, textarea, select').forEach(function(input, index) {
|
|
118
|
-
const key = input.name || input.id || 'input_' + index;
|
|
119
|
-
if (state[key] !== undefined) {
|
|
120
|
-
if (input.type === 'checkbox' || input.type === 'radio') {
|
|
121
|
-
input.checked = state[key];
|
|
122
|
-
}
|
|
123
|
-
else {
|
|
124
|
-
input.value = state[key];
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
});
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
// Cache a component
|
|
131
|
-
function cacheComponent(key, element) {
|
|
132
|
-
if (!shouldCache(key)) return;
|
|
133
|
-
|
|
134
|
-
// Remove from cache order if exists (for LRU)
|
|
135
|
-
const existingIndex = cacheOrder.indexOf(key);
|
|
136
|
-
if (existingIndex > -1) {
|
|
137
|
-
cacheOrder.splice(existingIndex, 1);
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
// Evict oldest if at max capacity
|
|
141
|
-
while (cacheOrder.length >= maxCache) {
|
|
142
|
-
const oldestKey = cacheOrder.shift();
|
|
143
|
-
const oldCached = cache.get(oldestKey);
|
|
144
|
-
if (oldCached && oldCached.element) {
|
|
145
|
-
oldCached.element.remove();
|
|
146
|
-
}
|
|
147
|
-
cache.delete(oldestKey);
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
// Clone and cache
|
|
151
|
-
const clone = element.cloneNode(true);
|
|
152
|
-
clone.style.display = 'none';
|
|
153
|
-
clone.setAttribute('data-cached-key', key);
|
|
154
|
-
|
|
155
|
-
const cached = {
|
|
156
|
-
key: key,
|
|
157
|
-
element: clone,
|
|
158
|
-
state: saveComponentState(element),
|
|
159
|
-
scrollPositions: saveScrollPositions(element),
|
|
160
|
-
cachedAt: Date.now()
|
|
161
|
-
};
|
|
162
|
-
|
|
163
|
-
cache.set(key, cached);
|
|
164
|
-
cacheOrder.push(key);
|
|
165
|
-
cacheEl.appendChild(clone);
|
|
166
|
-
|
|
167
|
-
// Dispatch deactivated event
|
|
168
|
-
element.dispatchEvent(new CustomEvent('stx:deactivated', {
|
|
169
|
-
detail: { key: key, keepAliveId: keepAliveId },
|
|
170
|
-
bubbles: true
|
|
171
|
-
}));
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
// Restore a component from cache
|
|
175
|
-
function restoreComponent(key) {
|
|
176
|
-
const cached = cache.get(key);
|
|
177
|
-
if (!cached) return null;
|
|
178
|
-
|
|
179
|
-
// Move to end of cache order (most recently used)
|
|
180
|
-
const index = cacheOrder.indexOf(key);
|
|
181
|
-
if (index > -1) {
|
|
182
|
-
cacheOrder.splice(index, 1);
|
|
183
|
-
cacheOrder.push(key);
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
// Clone the cached element
|
|
187
|
-
const restored = cached.element.cloneNode(true);
|
|
188
|
-
restored.style.display = '';
|
|
189
|
-
restored.removeAttribute('data-cached-key');
|
|
190
|
-
|
|
191
|
-
// Restore state after a tick (to let DOM settle)
|
|
192
|
-
setTimeout(function() {
|
|
193
|
-
restoreComponentState(restored, cached.state);
|
|
194
|
-
restoreScrollPositions(restored, cached.scrollPositions);
|
|
195
|
-
|
|
196
|
-
// Dispatch activated event
|
|
197
|
-
restored.dispatchEvent(new CustomEvent('stx:activated', {
|
|
198
|
-
detail: { key: key, keepAliveId: keepAliveId, cachedAt: cached.cachedAt },
|
|
199
|
-
bubbles: true
|
|
200
|
-
}));
|
|
201
|
-
}, 0);
|
|
202
|
-
|
|
203
|
-
return restored;
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
// Check if component is cached
|
|
207
|
-
function isCached(key) {
|
|
208
|
-
return cache.has(key);
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
// Clear cache
|
|
212
|
-
function clearCache(key) {
|
|
213
|
-
if (key) {
|
|
214
|
-
const cached = cache.get(key);
|
|
215
|
-
if (cached && cached.element) {
|
|
216
|
-
cached.element.remove();
|
|
217
|
-
}
|
|
218
|
-
cache.delete(key);
|
|
219
|
-
const index = cacheOrder.indexOf(key);
|
|
220
|
-
if (index > -1) {
|
|
221
|
-
cacheOrder.splice(index, 1);
|
|
222
|
-
}
|
|
223
|
-
}
|
|
224
|
-
else {
|
|
225
|
-
cache.forEach(function(cached) {
|
|
226
|
-
if (cached.element) {
|
|
227
|
-
cached.element.remove();
|
|
228
|
-
}
|
|
229
|
-
});
|
|
230
|
-
cache.clear();
|
|
231
|
-
cacheOrder.length = 0;
|
|
232
|
-
}
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
// Expose API
|
|
236
|
-
window.STX = window.STX || {};
|
|
237
|
-
window.STX.keepAlive = window.STX.keepAlive || { instances: {} };
|
|
238
|
-
window.STX.keepAlive.instances[keepAliveId] = {
|
|
239
|
-
id: keepAliveId,
|
|
240
|
-
customId: customId,
|
|
241
|
-
cache: cacheComponent,
|
|
242
|
-
restore: restoreComponent,
|
|
243
|
-
isCached: isCached,
|
|
244
|
-
clear: clearCache,
|
|
245
|
-
getCacheKeys: function() { return Array.from(cache.keys()); },
|
|
246
|
-
getCacheSize: function() { return cache.size; }
|
|
247
|
-
};
|
|
248
|
-
|
|
249
|
-
// Observe for component changes
|
|
250
|
-
const observer = new MutationObserver(function(mutations) {
|
|
251
|
-
mutations.forEach(function(mutation) {
|
|
252
|
-
// Handle removed nodes (cache them)
|
|
253
|
-
mutation.removedNodes.forEach(function(node) {
|
|
254
|
-
if (node.nodeType === Node.ELEMENT_NODE && node.hasAttribute && !node.hasAttribute('data-cached-key')) {
|
|
255
|
-
const key = getComponentKey(node);
|
|
256
|
-
if (key && shouldCache(key)) {
|
|
257
|
-
// Check if this removal is intentional (not just DOM restructuring)
|
|
258
|
-
if (!contentEl.contains(node)) {
|
|
259
|
-
cacheComponent(key, node);
|
|
260
|
-
}
|
|
261
|
-
}
|
|
262
|
-
}
|
|
263
|
-
});
|
|
264
|
-
|
|
265
|
-
// Handle added nodes (check if we should restore from cache)
|
|
266
|
-
mutation.addedNodes.forEach(function(node) {
|
|
267
|
-
if (node.nodeType === Node.ELEMENT_NODE && node.hasAttribute) {
|
|
268
|
-
const key = getComponentKey(node);
|
|
269
|
-
if (key && isCached(key)) {
|
|
270
|
-
const restored = restoreComponent(key);
|
|
271
|
-
if (restored) {
|
|
272
|
-
node.replaceWith(restored);
|
|
273
|
-
}
|
|
274
|
-
}
|
|
275
|
-
}
|
|
276
|
-
});
|
|
277
|
-
});
|
|
278
|
-
});
|
|
279
|
-
|
|
280
|
-
observer.observe(contentEl, { childList: true, subtree: true });
|
|
281
|
-
|
|
282
|
-
// Cleanup on removal
|
|
283
|
-
container.addEventListener('stx:destroy', function() {
|
|
284
|
-
observer.disconnect();
|
|
285
|
-
clearCache();
|
|
286
|
-
});
|
|
287
|
-
})();
|
|
288
|
-
</script>
|
|
289
|
-
`}function m(e={}){return{id:e.id||s(),cache:new Map,max:e.max||10,include:e.include?e.include.split(",").map((t)=>t.trim()):null,exclude:e.exclude?e.exclude.split(",").map((t)=>t.trim()):null}}function f(e,t){if(t.exclude&&t.exclude.includes(e))return!1;if(t.include&&!t.include.includes(e))return!1;return!0}function v(){return`
|
|
290
|
-
/* STX Keep-Alive Styles */
|
|
291
|
-
.stx-keep-alive {
|
|
292
|
-
position: relative;
|
|
293
|
-
}
|
|
294
|
-
|
|
295
|
-
.stx-keep-alive-cache {
|
|
296
|
-
display: none !important;
|
|
297
|
-
visibility: hidden;
|
|
298
|
-
position: absolute;
|
|
299
|
-
pointer-events: none;
|
|
300
|
-
}
|
|
301
|
-
|
|
302
|
-
/* Activation transition */
|
|
303
|
-
.stx-keep-alive-content > * {
|
|
304
|
-
transition: opacity 0.15s ease;
|
|
305
|
-
}
|
|
306
|
-
|
|
307
|
-
.stx-keep-alive-content > [data-activating] {
|
|
308
|
-
opacity: 0;
|
|
309
|
-
}
|
|
310
|
-
|
|
311
|
-
.stx-keep-alive-content > [data-activated] {
|
|
312
|
-
opacity: 1;
|
|
313
|
-
}
|
|
314
|
-
`}function k(){return`
|
|
315
|
-
// STX Keep-Alive Runtime
|
|
316
|
-
(function() {
|
|
317
|
-
if (typeof window === 'undefined') return;
|
|
318
|
-
|
|
319
|
-
window.STX = window.STX || {};
|
|
320
|
-
window.STX.keepAlive = window.STX.keepAlive || { instances: {} };
|
|
321
|
-
|
|
322
|
-
// Global keep-alive utilities
|
|
323
|
-
window.STX.keepAlive.clearAll = function() {
|
|
324
|
-
Object.values(window.STX.keepAlive.instances).forEach(function(instance) {
|
|
325
|
-
instance.clear();
|
|
326
|
-
});
|
|
327
|
-
};
|
|
328
|
-
|
|
329
|
-
window.STX.keepAlive.getTotalCached = function() {
|
|
330
|
-
return Object.values(window.STX.keepAlive.instances).reduce(function(total, instance) {
|
|
331
|
-
return total + instance.getCacheSize();
|
|
332
|
-
}, 0);
|
|
333
|
-
};
|
|
334
|
-
|
|
335
|
-
// Lifecycle hooks for keep-alive
|
|
336
|
-
window.STX.onActivated = function(callback) {
|
|
337
|
-
document.addEventListener('stx:activated', function(e) {
|
|
338
|
-
callback(e.detail);
|
|
339
|
-
});
|
|
340
|
-
};
|
|
341
|
-
|
|
342
|
-
window.STX.onDeactivated = function(callback) {
|
|
343
|
-
document.addEventListener('stx:deactivated', function(e) {
|
|
344
|
-
callback(e.detail);
|
|
345
|
-
});
|
|
346
|
-
};
|
|
347
|
-
|
|
348
|
-
console.log('[stx] Keep-alive runtime initialized');
|
|
349
|
-
})();
|
|
350
|
-
`}function y(e){if(typeof document<"u")document.addEventListener("stx:activated",(t)=>{e(t.detail)})}function x(e){if(typeof document<"u")document.addEventListener("stx:deactivated",(t)=>{e(t.detail)})}
|
|
351
|
-
export{h as Pe,m as Qe,f as Re,v as Se,k as Te,y as Ue,x as Ve};
|
package/dist/chunk-8wydx2we.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{V as a}from"./chunk-bswe62q4.js";import"./chunk-rft8gw92.js";import"./chunk-p0w1x8y2.js";import"./chunk-ryvmyskt.js";import"./chunk-2g8m379z.js";import"./chunk-ezqwq17j.js";import"./chunk-wm805tte.js";import"./chunk-58tfvayh.js";import"./chunk-brpgjyqg.js";import"./chunk-2rr178et.js";import"./chunk-5be9x5cq.js";import"./chunk-5zrnk2kq.js";import"./chunk-p0qhpnqh.js";import"./chunk-nf3kv7kv.js";export{a as buildForProduction};
|
package/dist/chunk-8zjnjvv7.js
DELETED
package/dist/chunk-9805tt8n.js
DELETED
|
@@ -1,341 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
var c=0;function l(){return`suspense-${++c}-${Date.now().toString(36)}`}function y(s,t={},n){let e=/@suspense(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@fallback\s*([\s\S]*?)@endsuspense/gi;return s.replace(e,(r,i,o,d)=>{let u=l(),a=p(i||"");return f(u,o.trim(),d.trim(),a)})}function p(s){let t={},n=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,e;while((e=n.exec(s))!==null){let r=e[1],i=e[2]||e[3],o=e[4];switch(r){case"id":t.id=i;break;case"timeout":t.timeout=o?parseInt(o,10):void 0;break}}return t}function f(s,t,n,e){let r=e.timeout||30000,i=e.id||s;return`
|
|
3
|
-
<div class="stx-suspense" data-suspense-id="${s}" data-custom-id="${i}" data-status="pending">
|
|
4
|
-
<div class="stx-suspense-fallback" data-suspense-fallback="${s}">
|
|
5
|
-
${n}
|
|
6
|
-
</div>
|
|
7
|
-
<div class="stx-suspense-content" data-suspense-content="${s}" style="display: none;">
|
|
8
|
-
${t}
|
|
9
|
-
</div>
|
|
10
|
-
</div>
|
|
11
|
-
<script>
|
|
12
|
-
(function() {
|
|
13
|
-
const suspenseId = '${s}';
|
|
14
|
-
const customId = '${i}';
|
|
15
|
-
const timeout = ${r};
|
|
16
|
-
|
|
17
|
-
const container = document.querySelector('[data-suspense-id="' + suspenseId + '"]');
|
|
18
|
-
const fallbackEl = document.querySelector('[data-suspense-fallback="' + suspenseId + '"]');
|
|
19
|
-
const contentEl = document.querySelector('[data-suspense-content="' + suspenseId + '"]');
|
|
20
|
-
|
|
21
|
-
if (!container || !fallbackEl || !contentEl) return;
|
|
22
|
-
|
|
23
|
-
// State
|
|
24
|
-
const pending = new Set();
|
|
25
|
-
const resolved = new Set();
|
|
26
|
-
let status = 'pending';
|
|
27
|
-
let error = null;
|
|
28
|
-
let timeoutTimer = null;
|
|
29
|
-
|
|
30
|
-
// Update UI based on state
|
|
31
|
-
function updateUI() {
|
|
32
|
-
container.setAttribute('data-status', status);
|
|
33
|
-
|
|
34
|
-
if (status === 'resolved') {
|
|
35
|
-
fallbackEl.style.display = 'none';
|
|
36
|
-
contentEl.style.display = '';
|
|
37
|
-
}
|
|
38
|
-
else if (status === 'rejected') {
|
|
39
|
-
fallbackEl.style.display = 'none';
|
|
40
|
-
contentEl.style.display = '';
|
|
41
|
-
// Show error in content area if needed
|
|
42
|
-
}
|
|
43
|
-
else {
|
|
44
|
-
fallbackEl.style.display = '';
|
|
45
|
-
contentEl.style.display = 'none';
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
// Check if all children are resolved
|
|
50
|
-
function checkResolved() {
|
|
51
|
-
if (pending.size === 0 && resolved.size > 0) {
|
|
52
|
-
clearTimeout(timeoutTimer);
|
|
53
|
-
status = 'resolved';
|
|
54
|
-
updateUI();
|
|
55
|
-
|
|
56
|
-
container.dispatchEvent(new CustomEvent('stx:suspense:resolved', {
|
|
57
|
-
detail: { suspenseId: suspenseId, customId: customId },
|
|
58
|
-
bubbles: true
|
|
59
|
-
}));
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
// Register an async child
|
|
64
|
-
function register(childId) {
|
|
65
|
-
if (status === 'resolved') {
|
|
66
|
-
// Reset if we get a new child after resolution
|
|
67
|
-
status = 'pending';
|
|
68
|
-
updateUI();
|
|
69
|
-
}
|
|
70
|
-
pending.add(childId);
|
|
71
|
-
|
|
72
|
-
// Start timeout on first registration
|
|
73
|
-
if (pending.size === 1 && !timeoutTimer) {
|
|
74
|
-
timeoutTimer = setTimeout(function() {
|
|
75
|
-
if (status === 'pending') {
|
|
76
|
-
error = new Error('Suspense timeout after ' + timeout + 'ms');
|
|
77
|
-
status = 'rejected';
|
|
78
|
-
updateUI();
|
|
79
|
-
|
|
80
|
-
container.dispatchEvent(new CustomEvent('stx:suspense:timeout', {
|
|
81
|
-
detail: { suspenseId: suspenseId, customId: customId, pending: Array.from(pending) },
|
|
82
|
-
bubbles: true
|
|
83
|
-
}));
|
|
84
|
-
}
|
|
85
|
-
}, timeout);
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
// Resolve a child
|
|
90
|
-
function resolve(childId) {
|
|
91
|
-
pending.delete(childId);
|
|
92
|
-
resolved.add(childId);
|
|
93
|
-
checkResolved();
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
// Reject a child
|
|
97
|
-
function reject(childId, err) {
|
|
98
|
-
pending.delete(childId);
|
|
99
|
-
error = err;
|
|
100
|
-
status = 'rejected';
|
|
101
|
-
clearTimeout(timeoutTimer);
|
|
102
|
-
updateUI();
|
|
103
|
-
|
|
104
|
-
container.dispatchEvent(new CustomEvent('stx:suspense:error', {
|
|
105
|
-
detail: { suspenseId: suspenseId, customId: customId, error: err, childId: childId },
|
|
106
|
-
bubbles: true
|
|
107
|
-
}));
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
// Reset the boundary
|
|
111
|
-
function reset() {
|
|
112
|
-
pending.clear();
|
|
113
|
-
resolved.clear();
|
|
114
|
-
status = 'pending';
|
|
115
|
-
error = null;
|
|
116
|
-
clearTimeout(timeoutTimer);
|
|
117
|
-
timeoutTimer = null;
|
|
118
|
-
updateUI();
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
// Expose API globally for async components to use
|
|
122
|
-
window.STX = window.STX || {};
|
|
123
|
-
window.STX.suspense = window.STX.suspense || {
|
|
124
|
-
boundaries: {},
|
|
125
|
-
// Find the nearest suspense boundary for a child
|
|
126
|
-
findBoundary: function(element) {
|
|
127
|
-
const boundary = element.closest('[data-suspense-id]');
|
|
128
|
-
if (boundary) {
|
|
129
|
-
return boundary.getAttribute('data-suspense-id');
|
|
130
|
-
}
|
|
131
|
-
return null;
|
|
132
|
-
},
|
|
133
|
-
register: function(childId, boundaryId) {
|
|
134
|
-
if (!boundaryId) {
|
|
135
|
-
// Find nearest boundary
|
|
136
|
-
const asyncEl = document.querySelector('[data-async-id="' + childId + '"]');
|
|
137
|
-
if (asyncEl) {
|
|
138
|
-
boundaryId = this.findBoundary(asyncEl);
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
if (boundaryId && this.boundaries[boundaryId]) {
|
|
142
|
-
this.boundaries[boundaryId].register(childId);
|
|
143
|
-
}
|
|
144
|
-
},
|
|
145
|
-
resolve: function(childId, boundaryId) {
|
|
146
|
-
if (!boundaryId) {
|
|
147
|
-
const asyncEl = document.querySelector('[data-async-id="' + childId + '"]');
|
|
148
|
-
if (asyncEl) {
|
|
149
|
-
boundaryId = this.findBoundary(asyncEl);
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
if (boundaryId && this.boundaries[boundaryId]) {
|
|
153
|
-
this.boundaries[boundaryId].resolve(childId);
|
|
154
|
-
}
|
|
155
|
-
},
|
|
156
|
-
reject: function(childId, error, boundaryId) {
|
|
157
|
-
if (!boundaryId) {
|
|
158
|
-
const asyncEl = document.querySelector('[data-async-id="' + childId + '"]');
|
|
159
|
-
if (asyncEl) {
|
|
160
|
-
boundaryId = this.findBoundary(asyncEl);
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
if (boundaryId && this.boundaries[boundaryId]) {
|
|
164
|
-
this.boundaries[boundaryId].reject(childId, error);
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
};
|
|
168
|
-
|
|
169
|
-
// Register this boundary
|
|
170
|
-
window.STX.suspense.boundaries[suspenseId] = {
|
|
171
|
-
id: suspenseId,
|
|
172
|
-
customId: customId,
|
|
173
|
-
getStatus: function() { return status; },
|
|
174
|
-
getPending: function() { return Array.from(pending); },
|
|
175
|
-
getResolved: function() { return Array.from(resolved); },
|
|
176
|
-
getError: function() { return error; },
|
|
177
|
-
register: register,
|
|
178
|
-
resolve: resolve,
|
|
179
|
-
reject: reject,
|
|
180
|
-
reset: reset
|
|
181
|
-
};
|
|
182
|
-
|
|
183
|
-
// Initial state - if no async children register within a tick, show content
|
|
184
|
-
setTimeout(function() {
|
|
185
|
-
if (pending.size === 0 && resolved.size === 0) {
|
|
186
|
-
status = 'resolved';
|
|
187
|
-
updateUI();
|
|
188
|
-
}
|
|
189
|
-
}, 0);
|
|
190
|
-
})();
|
|
191
|
-
</script>
|
|
192
|
-
`}function b(s,t,n){return{id:s,fallback:n,content:t}}async function m(s){let t=s.map((e)=>`
|
|
193
|
-
<div id="stx-ssr-suspense-${e.id}" class="stx-ssr-suspense">
|
|
194
|
-
${e.fallback}
|
|
195
|
-
</div>
|
|
196
|
-
`).join(`
|
|
197
|
-
`);async function*n(){for(let e of s)try{let r=await e.content;yield`
|
|
198
|
-
<script>
|
|
199
|
-
(function() {
|
|
200
|
-
const el = document.getElementById('stx-ssr-suspense-${e.id}');
|
|
201
|
-
if (el) {
|
|
202
|
-
el.innerHTML = ${JSON.stringify(r)};
|
|
203
|
-
el.classList.add('stx-ssr-suspense-resolved');
|
|
204
|
-
}
|
|
205
|
-
})();
|
|
206
|
-
</script>
|
|
207
|
-
`}catch(r){yield`
|
|
208
|
-
<script>
|
|
209
|
-
(function() {
|
|
210
|
-
const el = document.getElementById('stx-ssr-suspense-${e.id}');
|
|
211
|
-
if (el) {
|
|
212
|
-
el.classList.add('stx-ssr-suspense-error');
|
|
213
|
-
console.error('SSR Suspense error for ${e.id}:', ${JSON.stringify(String(r))});
|
|
214
|
-
}
|
|
215
|
-
})();
|
|
216
|
-
</script>
|
|
217
|
-
`}}return{initial:t,streaming:n()}}function I(){return`
|
|
218
|
-
/* STX Suspense Styles */
|
|
219
|
-
.stx-suspense {
|
|
220
|
-
position: relative;
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
.stx-suspense[data-status="pending"] .stx-suspense-fallback {
|
|
224
|
-
display: block;
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
.stx-suspense[data-status="pending"] .stx-suspense-content {
|
|
228
|
-
display: none;
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
.stx-suspense[data-status="resolved"] .stx-suspense-fallback {
|
|
232
|
-
display: none;
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
.stx-suspense[data-status="resolved"] .stx-suspense-content {
|
|
236
|
-
display: block;
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
/* SSR Suspense */
|
|
240
|
-
.stx-ssr-suspense {
|
|
241
|
-
transition: opacity 0.3s ease;
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
.stx-ssr-suspense-resolved {
|
|
245
|
-
animation: stx-suspense-fade-in 0.3s ease;
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
@keyframes stx-suspense-fade-in {
|
|
249
|
-
from { opacity: 0; }
|
|
250
|
-
to { opacity: 1; }
|
|
251
|
-
}
|
|
252
|
-
|
|
253
|
-
/* Skeleton fallback helper */
|
|
254
|
-
.stx-suspense-skeleton {
|
|
255
|
-
background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
|
|
256
|
-
background-size: 200% 100%;
|
|
257
|
-
animation: stx-suspense-shimmer 1.5s infinite;
|
|
258
|
-
border-radius: 0.25rem;
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
@keyframes stx-suspense-shimmer {
|
|
262
|
-
0% { background-position: 200% 0; }
|
|
263
|
-
100% { background-position: -200% 0; }
|
|
264
|
-
}
|
|
265
|
-
|
|
266
|
-
/* Dark mode */
|
|
267
|
-
@media (prefers-color-scheme: dark) {
|
|
268
|
-
.stx-suspense-skeleton {
|
|
269
|
-
background: linear-gradient(90deg, #374151 25%, #4b5563 50%, #374151 75%);
|
|
270
|
-
background-size: 200% 100%;
|
|
271
|
-
}
|
|
272
|
-
}
|
|
273
|
-
`}function g(){return`
|
|
274
|
-
// STX Suspense Runtime
|
|
275
|
-
(function() {
|
|
276
|
-
if (typeof window === 'undefined') return;
|
|
277
|
-
|
|
278
|
-
window.STX = window.STX || {};
|
|
279
|
-
|
|
280
|
-
// Suspense boundary management is set up per-boundary in the HTML
|
|
281
|
-
// This just provides additional utilities
|
|
282
|
-
|
|
283
|
-
window.STX.suspense = window.STX.suspense || {
|
|
284
|
-
boundaries: {},
|
|
285
|
-
findBoundary: function(element) {
|
|
286
|
-
const boundary = element.closest('[data-suspense-id]');
|
|
287
|
-
return boundary ? boundary.getAttribute('data-suspense-id') : null;
|
|
288
|
-
},
|
|
289
|
-
register: function(childId, boundaryId) {},
|
|
290
|
-
resolve: function(childId, boundaryId) {},
|
|
291
|
-
reject: function(childId, error, boundaryId) {}
|
|
292
|
-
};
|
|
293
|
-
|
|
294
|
-
// Wait for all suspense boundaries to resolve
|
|
295
|
-
window.STX.suspense.waitForAll = function() {
|
|
296
|
-
return new Promise(function(resolve, reject) {
|
|
297
|
-
const boundaries = Object.values(window.STX.suspense.boundaries);
|
|
298
|
-
if (boundaries.length === 0) {
|
|
299
|
-
resolve();
|
|
300
|
-
return;
|
|
301
|
-
}
|
|
302
|
-
|
|
303
|
-
let resolved = 0;
|
|
304
|
-
let rejected = false;
|
|
305
|
-
|
|
306
|
-
boundaries.forEach(function(boundary) {
|
|
307
|
-
if (boundary.getStatus() === 'resolved') {
|
|
308
|
-
resolved++;
|
|
309
|
-
if (resolved === boundaries.length) resolve();
|
|
310
|
-
}
|
|
311
|
-
else if (boundary.getStatus() === 'rejected') {
|
|
312
|
-
if (!rejected) {
|
|
313
|
-
rejected = true;
|
|
314
|
-
reject(boundary.getError());
|
|
315
|
-
}
|
|
316
|
-
}
|
|
317
|
-
else {
|
|
318
|
-
// Listen for resolution
|
|
319
|
-
const container = document.querySelector('[data-suspense-id="' + boundary.id + '"]');
|
|
320
|
-
if (container) {
|
|
321
|
-
container.addEventListener('stx:suspense:resolved', function() {
|
|
322
|
-
resolved++;
|
|
323
|
-
if (resolved === boundaries.length && !rejected) resolve();
|
|
324
|
-
}, { once: true });
|
|
325
|
-
|
|
326
|
-
container.addEventListener('stx:suspense:error', function(e) {
|
|
327
|
-
if (!rejected) {
|
|
328
|
-
rejected = true;
|
|
329
|
-
reject(e.detail.error);
|
|
330
|
-
}
|
|
331
|
-
}, { once: true });
|
|
332
|
-
}
|
|
333
|
-
}
|
|
334
|
-
});
|
|
335
|
-
});
|
|
336
|
-
};
|
|
337
|
-
|
|
338
|
-
console.log('[stx] Suspense runtime initialized');
|
|
339
|
-
})();
|
|
340
|
-
`}
|
|
341
|
-
export{y as Fe,b as Ge,m as He,I as Ie,g as Je};
|
package/dist/chunk-988h4bzr.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{lu as a,mu as b,nu as c,ou as d,pu as e,qu as f,ru as g,su as h,tu as i}from"./chunk-126c9qm3.js";import"./chunk-6x1feysm.js";import"./chunk-nf3kv7kv.js";export{a as ImageProcessorCache,g as applyTransformations,d as clearImageCache,h as generateResponsiveVariants,i as generateSrcset,b as getCachedImageResult,f as optimizeImage,e as processImage,c as setCachedImageResult};
|