@stacksjs/stx 0.2.665 → 0.2.668

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 (162) hide show
  1. package/dist/chunk-028ee6q5.js +2 -0
  2. package/dist/{chunk-tx6p6jnk.js → chunk-02gn092e.js} +1 -1
  3. package/dist/chunk-02ymqwmj.js +2 -0
  4. package/dist/{chunk-2q50h7zv.js → chunk-060298px.js} +5 -5
  5. package/dist/{chunk-zpc06ysq.js → chunk-0hemydnd.js} +1 -1
  6. package/dist/chunk-1e79xcc8.js +2 -0
  7. package/dist/chunk-1pnp91wx.js +2 -0
  8. package/dist/{chunk-2h8ea0we.js → chunk-1sr6c0nk.js} +2 -2
  9. package/dist/chunk-280p4q7a.js +2 -0
  10. package/dist/{chunk-hb08vrbb.js → chunk-2dp7hyv7.js} +21 -21
  11. package/dist/chunk-2ecgyqam.js +2 -0
  12. package/dist/{chunk-38b3w1y4.js → chunk-2hxwds8c.js} +1 -1
  13. package/dist/{chunk-x34scshq.js → chunk-2zzc7006.js} +2 -2
  14. package/dist/{chunk-wpm58d6p.js → chunk-30nes8ne.js} +2 -2
  15. package/dist/{chunk-d3vgtr0t.js → chunk-3641xvaw.js} +1 -1
  16. package/dist/{chunk-zaaeneq6.js → chunk-365vg0eg.js} +2 -2
  17. package/dist/{chunk-2qbvsvwc.js → chunk-3850m7ab.js} +6 -6
  18. package/dist/{chunk-ewcrsyr7.js → chunk-3hxd5td3.js} +2 -2
  19. package/dist/chunk-3n9vaxnt.js +2 -0
  20. package/dist/{chunk-pxqh758g.js → chunk-3y41efsf.js} +64 -15
  21. package/dist/chunk-41cvkdcm.js +3 -0
  22. package/dist/{chunk-s3dyzxwx.js → chunk-493x6e71.js} +4 -4
  23. package/dist/{chunk-jrf01hfv.js → chunk-4c183zem.js} +1 -1
  24. package/dist/{chunk-nm8yr8a9.js → chunk-4m1hye28.js} +1 -1
  25. package/dist/{chunk-v5916r3j.js → chunk-4teqcbw0.js} +5 -5
  26. package/dist/chunk-5zgrvj4b.js +2 -0
  27. package/dist/{chunk-cg3mvq4h.js → chunk-61n06wra.js} +6 -6
  28. package/dist/{chunk-pmwb5kaf.js → chunk-65b6cy92.js} +2 -2
  29. package/dist/{chunk-zjsyw63k.js → chunk-6by8f7n9.js} +9 -9
  30. package/dist/{chunk-vjw3qrqj.js → chunk-6tngeb4b.js} +1 -1
  31. package/dist/{chunk-bgra36az.js → chunk-6z2sdfac.js} +1 -1
  32. package/dist/{chunk-yq021b3r.js → chunk-7d4z944r.js} +3 -3
  33. package/dist/{chunk-rjh2jwxx.js → chunk-7met6yva.js} +8 -8
  34. package/dist/{chunk-2jh21f1n.js → chunk-89jbdtgw.js} +1 -1
  35. package/dist/chunk-8kskjg62.js +2 -0
  36. package/dist/{chunk-q1svy1nf.js → chunk-9edksf8x.js} +1 -1
  37. package/dist/{chunk-1z1632np.js → chunk-9k2wz3k1.js} +41 -41
  38. package/dist/{chunk-577ntqeg.js → chunk-9vaz5f9j.js} +1 -1
  39. package/dist/chunk-avph47dc.js +2 -0
  40. package/dist/{chunk-mrrrngzd.js → chunk-b4pcw34n.js} +1 -1
  41. package/dist/chunk-b7e07ybq.js +3 -0
  42. package/dist/{chunk-0jhdrgpr.js → chunk-b823zxq6.js} +2 -2
  43. package/dist/{chunk-c9k40352.js → chunk-bdg0fydw.js} +1 -1
  44. package/dist/{chunk-szyqxcfj.js → chunk-bnn7pd62.js} +2 -2
  45. package/dist/chunk-c3dk9pkf.js +2 -0
  46. package/dist/chunk-c4qebqmk.js +2 -0
  47. package/dist/chunk-ca6vx6vg.js +2 -0
  48. package/dist/{chunk-dra341c0.js → chunk-cba7953e.js} +15 -15
  49. package/dist/{chunk-p2mrba1n.js → chunk-cyq1jcg2.js} +107 -107
  50. package/dist/{chunk-w2zceynt.js → chunk-dpvxe52r.js} +1 -1
  51. package/dist/{chunk-pc48mjkc.js → chunk-dtjybwtz.js} +4 -4
  52. package/dist/{chunk-nf9bykvg.js → chunk-dy5j389v.js} +5 -5
  53. package/dist/{chunk-np1k9vsr.js → chunk-e1fetwbr.js} +1 -1
  54. package/dist/chunk-e4vpr36s.js +2 -0
  55. package/dist/{chunk-11zp67ds.js → chunk-e8gcqp8w.js} +4 -4
  56. package/dist/{chunk-yh0wb4n1.js → chunk-ecqrkyg8.js} +2 -2
  57. package/dist/chunk-fb93n9ts.js +2 -0
  58. package/dist/chunk-fmkcc7g1.js +2 -0
  59. package/dist/{chunk-edvmtk21.js → chunk-fpz59dhz.js} +5 -5
  60. package/dist/{chunk-een2wqah.js → chunk-fvtwec1r.js} +1 -1
  61. package/dist/{chunk-t9mfztcs.js → chunk-fzqj1mjz.js} +3 -3
  62. package/dist/chunk-gkmpr64n.js +2 -0
  63. package/dist/chunk-heh151bn.js +2 -0
  64. package/dist/chunk-hj0raner.js +2 -0
  65. package/dist/chunk-hkqhpckf.js +2 -0
  66. package/dist/{chunk-0g4pr7ww.js → chunk-hm9jt1p9.js} +9 -9
  67. package/dist/{chunk-5w2jy5r9.js → chunk-hvf2e7pr.js} +2 -2
  68. package/dist/chunk-hx9cn2s4.js +2 -0
  69. package/dist/{chunk-2f1bk3bg.js → chunk-k5mez1vx.js} +1 -1
  70. package/dist/{chunk-r7kmsq3n.js → chunk-ka8befem.js} +1 -1
  71. package/dist/{chunk-b6xv8jh9.js → chunk-kpeep7gq.js} +1 -1
  72. package/dist/{chunk-v2x9vzgw.js → chunk-md2jn67b.js} +2 -2
  73. package/dist/chunk-n7a33e3v.js +2 -0
  74. package/dist/{chunk-d3bsfd10.js → chunk-npa7gze7.js} +2 -2
  75. package/dist/{chunk-8nryyqb5.js → chunk-p472crv1.js} +1 -1
  76. package/dist/{chunk-4yf1w261.js → chunk-pn1ehs6a.js} +2 -2
  77. package/dist/{chunk-7rta163c.js → chunk-pxdww4rb.js} +2 -2
  78. package/dist/{chunk-eqrkhc18.js → chunk-qjtpxsyx.js} +2 -2
  79. package/dist/{chunk-gf3bxnpq.js → chunk-qxmyaajq.js} +1 -1
  80. package/dist/chunk-r7cenpxp.js +2 -0
  81. package/dist/{chunk-fzxyq6k5.js → chunk-rcefnd1g.js} +61 -61
  82. package/dist/chunk-s5w3t7xw.js +2 -0
  83. package/dist/{chunk-43gr8ggc.js → chunk-sme31jbj.js} +2 -2
  84. package/dist/chunk-sz6xdz4h.js +2 -0
  85. package/dist/{chunk-f2z8s2h9.js → chunk-t01c62y5.js} +2 -2
  86. package/dist/{chunk-jh3r0qp7.js → chunk-t7jxkrbx.js} +1 -1
  87. package/dist/{chunk-jkvr7e91.js → chunk-tp4eqfxq.js} +2 -2
  88. package/dist/{chunk-7ae140wv.js → chunk-tq0bgaae.js} +1 -1
  89. package/dist/chunk-tw0wc95k.js +2 -0
  90. package/dist/chunk-v0091n1g.js +2 -0
  91. package/dist/{chunk-qzy8ypk4.js → chunk-vdjj4vrp.js} +40 -40
  92. package/dist/{chunk-gf4e5xtr.js → chunk-vfba7nz5.js} +27 -27
  93. package/dist/{chunk-awe50wee.js → chunk-vg9bz5zs.js} +1 -1
  94. package/dist/chunk-vryzt0p0.js +2 -0
  95. package/dist/{chunk-8dcemd4a.js → chunk-w6x8m0tz.js} +1 -1
  96. package/dist/chunk-wesafj4a.js +2 -0
  97. package/dist/chunk-x986xz7h.js +2 -0
  98. package/dist/{chunk-xv43szx0.js → chunk-xqp4hstk.js} +1 -1
  99. package/dist/{chunk-c1dkh0es.js → chunk-yfvm7q6t.js} +3 -3
  100. package/dist/chunk-ynh1ppa6.js +2 -0
  101. package/dist/{chunk-eecgcj41.js → chunk-yscr04dv.js} +1 -1
  102. package/dist/{chunk-a1p327a7.js → chunk-zcz97ber.js} +9 -9
  103. package/dist/chunk-zdgsj39g.js +2 -0
  104. package/dist/{chunk-5z1n02nd.js → chunk-zwkc8yge.js} +37 -37
  105. package/dist/cli.js +36 -36
  106. package/dist/client/signals-for-runtime.js +51 -2
  107. package/dist/client/signals-process-element-runtime.js +1 -1
  108. package/dist/component-renderer.js +4 -2
  109. package/dist/craft-entry.js +1 -1
  110. package/dist/craft.js +1 -1
  111. package/dist/native/compiler/headwind-to-style.js +24 -1
  112. package/dist/native/compiler/html-to-ir.js +25 -5
  113. package/dist/native/runtime/binding-tree.d.ts +1 -0
  114. package/dist/native/runtime/binding-tree.js +5 -0
  115. package/dist/native/runtime/craft-bridge.js +1 -0
  116. package/dist/native/runtime/craft.d.ts +1 -0
  117. package/dist/native/runtime/jsc-globals.d.ts +20 -0
  118. package/dist/native/runtime/jsc-globals.js +52 -0
  119. package/dist/native/testing.d.ts +0 -1
  120. package/dist/native/testing.js +31 -4
  121. package/dist/pwa.js +3 -3
  122. package/dist/signal-processing.js +1 -2
  123. package/dist/slot-scopes.js +10 -2
  124. package/dist/slots.d.ts +2 -2
  125. package/dist/slots.js +21 -5
  126. package/dist/ssg.js +5 -5
  127. package/dist/utils.js +1 -1
  128. package/package.json +5 -5
  129. package/dist/chunk-0eepx077.js +0 -2
  130. package/dist/chunk-0fhntp63.js +0 -2
  131. package/dist/chunk-2a4szpje.js +0 -3
  132. package/dist/chunk-3d39yer3.js +0 -2
  133. package/dist/chunk-4v9x7zz5.js +0 -2
  134. package/dist/chunk-5etmsv9z.js +0 -2
  135. package/dist/chunk-773frt6c.js +0 -2
  136. package/dist/chunk-8d2f2e42.js +0 -2
  137. package/dist/chunk-a2bw46t9.js +0 -2
  138. package/dist/chunk-d5pt75tp.js +0 -2
  139. package/dist/chunk-em3aepxz.js +0 -2
  140. package/dist/chunk-g53sg7e0.js +0 -2
  141. package/dist/chunk-gsw8g2ev.js +0 -2
  142. package/dist/chunk-gz90fqn8.js +0 -2
  143. package/dist/chunk-gzd7bmp5.js +0 -2
  144. package/dist/chunk-hcqyf26s.js +0 -2
  145. package/dist/chunk-hhmj9gpk.js +0 -2
  146. package/dist/chunk-k2byvram.js +0 -2
  147. package/dist/chunk-kph7cenp.js +0 -2
  148. package/dist/chunk-papqmch6.js +0 -2
  149. package/dist/chunk-qambfx8c.js +0 -2
  150. package/dist/chunk-stfqkgfv.js +0 -2
  151. package/dist/chunk-t34ds1e3.js +0 -2
  152. package/dist/chunk-t4cbrm81.js +0 -2
  153. package/dist/chunk-t60pt4gv.js +0 -2
  154. package/dist/chunk-t6yjxhn8.js +0 -2
  155. package/dist/chunk-w89mazpv.js +0 -2
  156. package/dist/chunk-wq2fq6b7.js +0 -2
  157. package/dist/chunk-wsp8sj9v.js +0 -3
  158. package/dist/chunk-x8knte1j.js +0 -2
  159. package/dist/chunk-y7xshkqn.js +0 -2
  160. package/dist/chunk-ypsym37h.js +0 -2
  161. package/dist/chunk-z58ybwsv.js +0 -2
  162. package/dist/chunk-zteaygxc.js +0 -2
@@ -593,6 +593,24 @@ const classParsers = {
593
593
  style.aspectRatio = 1;
594
594
  return !0;
595
595
  },
596
+ "aspect-video": (_, style) => {
597
+ style.aspectRatio = 1.7777777777777777;
598
+ return !0;
599
+ },
600
+ "border-solid": (_, style) => {
601
+ style.borderStyle = "solid";
602
+ return !0;
603
+ },
604
+ "border-dashed": (_, style) => {
605
+ style.borderStyle = "dashed";
606
+ return !0;
607
+ },
608
+ "border-dotted": (_, style) => {
609
+ style.borderStyle = "dotted";
610
+ return !0;
611
+ },
612
+ group: () => !0,
613
+ peer: () => !0,
596
614
  "inset-0": (_, style) => {
597
615
  style.top = 0;
598
616
  style.right = 0;
@@ -1265,7 +1283,7 @@ function divideAsBorder(name) {
1265
1283
  return `border-${rule[3]}`;
1266
1284
  }
1267
1285
  export const NATIVE_STATE_VARIANTS = new Set(["aria-selected", "aria-pressed", "aria-checked", "aria-expanded"]);
1268
- const POINTER_ONLY_VARIANTS = new Set(["hover", "group-hover", "peer-hover", "active", "group-active", "visited", "placeholder", "selection", "print", "motion-safe"]), WEB_ONLY_UTILITY = /^(?:transition(?:-[a-z]+)?|duration-\S+|ease-\S+|delay-\S+|will-change-\S+|cursor-\S+|select-(?:none|text|all|auto)|outline-none|outline-0|appearance-none|scroll-smooth|scroll-auto|antialiased|subpixel-antialiased|touch-\S+|resize(?:-\S+)?|backdrop-blur(?:-\S+)?|isolate|contain-\S+)$/;
1286
+ const POINTER_ONLY_VARIANTS = new Set(["hover", "group-hover", "peer-hover", "active", "group-active", "visited", "placeholder", "selection", "print", "motion-safe"]), WEB_ONLY_UTILITY = /^(?:transition(?:-[a-z]+)?|animate-\S+|scroll-[mp][trblxyse]?-\S+|snap-\S+|overscroll-\S+|duration-\S+|ease-\S+|delay-\S+|will-change-\S+|cursor-\S+|select-(?:none|text|all|auto)|outline-none|outline-0|appearance-none|scroll-smooth|scroll-auto|antialiased|subpixel-antialiased|touch-\S+|resize(?:-\S+)?|backdrop-blur(?:-\S+)?|isolate|contain-\S+)$/;
1269
1287
  function splitVariants(token) {
1270
1288
  const parts = [];
1271
1289
  let depth = 0, start = 0;
@@ -1552,6 +1570,11 @@ export function compileHeadwindToStyle(classes, unknown) {
1552
1570
  continue;
1553
1571
  if (parseGridColumns(className, style))
1554
1572
  continue;
1573
+ const ratio = /^aspect-\[(\d+(?:\.\d+)?)\/(\d+(?:\.\d+)?)\]$/.exec(className);
1574
+ if (ratio && Number(ratio[2]) > 0) {
1575
+ style.aspectRatio = Number(ratio[1]) / Number(ratio[2]);
1576
+ continue;
1577
+ }
1555
1578
  const layer = /^z-\[(-?\d+)\]$/.exec(className) ?? /^z-(\d+)$/.exec(className);
1556
1579
  if (layer) {
1557
1580
  style.zIndex = Number(layer[1]);
@@ -196,7 +196,12 @@ function flattenText(node) {
196
196
  return node.children.map((child) => typeof child === "string" ? child : flattenText(child)).join("").replace(/\s+/g, " ").trim();
197
197
  }
198
198
  function settle(frame, diagnostics) {
199
- const node = frame.node, elements = node.children.filter((child) => typeof child !== "string"), text = node.children.filter((child) => typeof child === "string").join("").trim();
199
+ const node = frame.node;
200
+ if (node.props["data-stx-native-template"]) {
201
+ node.children = node.children.map((child) => typeof child === "string" ? createNode("Text", {}, {}, {}, [child]) : child);
202
+ return node;
203
+ }
204
+ const elements = node.children.filter((child) => typeof child !== "string"), text = node.children.filter((child) => typeof child === "string").join("").trim();
200
205
  if (frame.tag === "button" && node.type === "Button" && !frame.declaredNative && elements.length > 0) {
201
206
  node.type = "Pressable";
202
207
  node.props.role ??= "button";
@@ -292,9 +297,12 @@ export async function translateHtmlToIR(html, options = {}) {
292
297
  }, rules: stylesheetRules });
293
298
  if (tag === "html")
294
299
  variables = stylesheetVariables;
295
- const declared = props["data-native"];
300
+ const declared = props["data-native"], structuralTemplate = tag === "template" && attributes.some(([name]) => [":for", "x-for", "@for"].includes(name));
296
301
  let type;
297
- if (typeof declared === "string" && NATIVE_TYPES.has(declared)) {
302
+ if (structuralTemplate) {
303
+ type = "View";
304
+ props["data-stx-native-template"] = !0;
305
+ } else if (typeof declared === "string" && NATIVE_TYPES.has(declared)) {
298
306
  type = declared;
299
307
  delete props["data-native"];
300
308
  } else {
@@ -377,7 +385,7 @@ export async function translateHtmlToIR(html, options = {}) {
377
385
  declaredNative: typeof declared === "string" && NATIVE_TYPES.has(declared),
378
386
  dropped: dropped || inheritedDrop || BOX_ONLY.has(tag) || type === "Video",
379
387
  discard: dropped || inheritedDrop,
380
- unwrap: UNWRAP.has(tag)
388
+ unwrap: UNWRAP.has(tag) && !structuralTemplate
381
389
  };
382
390
  }
383
391
  function openSvg(tag, attributes, parent) {
@@ -488,8 +496,20 @@ export async function translateHtmlToIR(html, options = {}) {
488
496
  return { root, diagnostics };
489
497
  }
490
498
  function bindMustaches(node) {
491
- if (node.bindings?.text || node.children.length === 0 || !node.children.every((child) => typeof child === "string"))
499
+ if (node.props["data-stx-native-template"])
500
+ return;
501
+ if (node.bindings?.text || node.children.length === 0)
502
+ return;
503
+ const words = node.children.filter((child) => typeof child === "string");
504
+ if (words.length < node.children.length) {
505
+ const expression = node.type === "Button" || node.type === "Text" ? null : mustacheBinding(words.join(""));
506
+ if (!expression)
507
+ return;
508
+ node.bindings = { ...node.bindings, text: expression };
509
+ node._templated = [...node._templated ?? [], "text"];
510
+ node.children = node.children.filter((child) => typeof child !== "string");
492
511
  return;
512
+ }
493
513
  const expression = mustacheBinding(node.children.join(""));
494
514
  if (!expression)
495
515
  return;
@@ -19,6 +19,7 @@ export declare interface NativeBindingNode extends NativeNode {
19
19
  readonly nextElementSibling: NativeBindingNode | null
20
20
  namespaceURI: string
21
21
  isConnected: boolean
22
+ readonly content?: NativeBindingNode
22
23
  hasAttribute: (name: string) => boolean
23
24
  getAttribute: (name: string) => string | null
24
25
  setAttribute: (name: string, value: unknown) => void
@@ -29,6 +29,9 @@ function createBindingNode(id, type, bindings, connected = !0, classes = "", onC
29
29
  }
30
30
  },
31
31
  tagName: type === "TextInput" ? "INPUT" : type === "Picker" ? "SELECT" : type.toUpperCase(),
32
+ get content() {
33
+ return node.tagName === "TEMPLATE" ? node : void 0;
34
+ },
32
35
  attributes,
33
36
  parentNode: null,
34
37
  parentElement: null,
@@ -108,6 +111,8 @@ export function materializeNativeBindingTree(document, manifest, host) {
108
111
  const node = createBindingNode(id, source.type, runtimeBindings, !0, source._classes, (value) => host.setAttribute(node, "class", value));
109
112
  if (source.type === "Checkbox" && source.props.type === "checkbox")
110
113
  node.tagName = "INPUT";
114
+ if (source.props["data-stx-native-template"])
115
+ node.tagName = "TEMPLATE";
111
116
  for (const [name, value] of Object.entries(authoredTextEntryProps(authoredAccessibilityProps(source.props, source._accessibilitySource), source._textEntrySource))) {
112
117
  if (value === void 0 || value === null || name === "__stxId")
113
118
  continue;
@@ -572,6 +572,7 @@ export function installCraftBridge(protocol, nativeBridge, target = globalThis,
572
572
  getWorkouts: (options = {}) => request("Health", "getWorkouts", [options]),
573
573
  getDailyStatistics: (type, options = {}) => request("Health", "getDailyStatistics", [type, options]),
574
574
  getHeartRateSamples: (options = {}) => request("Health", "getHeartRateSamples", [options]),
575
+ getSamples: (type, options = {}) => request("Health", "getSamples", [type, options]),
575
576
  getSleepIntervals: (options = {}) => request("Health", "getSleepIntervals", [options]),
576
577
  saveMindfulSession: (session) => request("Health", "saveMindfulSession", [session]),
577
578
  getMindfulSessions: (options = {}) => request("Health", "getMindfulSessions", [options]),
@@ -251,6 +251,7 @@ export declare interface NativeCraft {
251
251
  getWorkouts: (options?: { startDate?: number, endDate?: number, limit?: number }) => Promise<Array<Record<string, unknown>>>
252
252
  getDailyStatistics: (type: string, options?: { startDate?: number, endDate?: number }) => Promise<Array<{ date: string, value: number }>>
253
253
  getHeartRateSamples: (options?: { startDate?: number, endDate?: number, limit?: number }) => Promise<Array<Record<string, unknown>>>
254
+ getSamples: (type: 'bloodGlucose' | 'insulinDelivery' | 'dietaryCarbohydrates', options?: { startDate?: number, endDate?: number, limit?: number }) => Promise<Array<Record<string, unknown>>>
254
255
  getSleepIntervals: (options?: { startDate?: number, endDate?: number }) => Promise<Array<Record<string, unknown>>>
255
256
  saveMindfulSession: (session: { id: string, startDate: number, endDate: number }) => Promise<{ id: string, externalId: string, existing: boolean }>
256
257
  getMindfulSessions: (options?: { startDate?: number, endDate?: number, limit?: number }) => Promise<Array<Record<string, unknown>>>
@@ -133,6 +133,26 @@ declare class NativeURL {
133
133
  toString(): string;
134
134
  toJSON(): string;
135
135
  }
136
+ /**
137
+ * `Headers`, which JavaScriptCore does not have: the web's shape, names folded
138
+ * to lower case and repeated values joined, iterated in name order. A web view
139
+ * drawn natively builds its requests with one (an auth store's
140
+ * `new Headers(options.headers)` before it sets the bearer token), and native
141
+ * `fetch` reads it through `forEach`.
142
+ */
143
+ export declare class NativeHeaders {
144
+ constructor(init?: Record<string, unknown> | Iterable<[unknown, unknown]> | { forEach: (callback: (value: string, name: string) => void) => void } | null);
145
+ append(name: string, value: unknown): void;
146
+ set(name: string, value: unknown): void;
147
+ get(name: string): string | null;
148
+ has(name: string): boolean;
149
+ delete(name: string): void;
150
+ forEach(callback: (value: string, name: string, headers: NativeHeaders) => void): void;
151
+ entries(): IterableIterator<[string, string]>;
152
+ keys(): IterableIterator<string>;
153
+ values(): IterableIterator<string>;
154
+ [Symbol.iterator](): IterableIterator<[string, string]>;
155
+ }
136
156
  /**
137
157
  * `FormData`, which JavaScriptCore does not have: the web's shape, holding
138
158
  * text and the files `craft.files` made (a `File` on the page). `fetch` on a
@@ -509,6 +509,57 @@ export { nativeAtob, nativeBtoa };
509
509
  export function isNativeFile(value) {
510
510
  return !!value && typeof value === "object" && typeof value.path === "string" && typeof value.name === "string";
511
511
  }
512
+
513
+ export class NativeHeaders {
514
+ map = new Map;
515
+ constructor(init) {
516
+ if (init == null)
517
+ return;
518
+ if (typeof init[Symbol.iterator] === "function") {
519
+ for (const pair of init)
520
+ this.append(String(pair[0]), pair[1]);
521
+ return;
522
+ }
523
+ if (typeof init.forEach === "function") {
524
+ init.forEach((value, name) => this.append(name, value));
525
+ return;
526
+ }
527
+ for (const [name, value] of Object.entries(init))
528
+ this.append(name, value);
529
+ }
530
+ append(name, value) {
531
+ const key = String(name).toLowerCase(), text = String(value).trim(), current = this.map.get(key);
532
+ this.map.set(key, current === void 0 ? text : `${current}, ${text}`);
533
+ }
534
+ set(name, value) {
535
+ this.map.set(String(name).toLowerCase(), String(value).trim());
536
+ }
537
+ get(name) {
538
+ return this.map.get(String(name).toLowerCase()) ?? null;
539
+ }
540
+ has(name) {
541
+ return this.map.has(String(name).toLowerCase());
542
+ }
543
+ delete(name) {
544
+ this.map.delete(String(name).toLowerCase());
545
+ }
546
+ forEach(callback) {
547
+ for (const [name, value] of this.entries())
548
+ callback(value, name, this);
549
+ }
550
+ entries() {
551
+ return [...this.map.entries()].sort(([a], [b]) => a < b ? -1 : a > b ? 1 : 0)[Symbol.iterator]();
552
+ }
553
+ keys() {
554
+ return [...this.entries()].map(([name]) => name)[Symbol.iterator]();
555
+ }
556
+ values() {
557
+ return [...this.entries()].map(([, value]) => value)[Symbol.iterator]();
558
+ }
559
+ [Symbol.iterator]() {
560
+ return this.entries();
561
+ }
562
+ }
512
563
  export const NATIVE_FORM_ENTRIES = Symbol.for("stx.native.form.entries");
513
564
 
514
565
  export class NativeFormData {
@@ -679,6 +730,7 @@ export function installJSCGlobals(target = globalThis) {
679
730
  target.Event ??= NativeEvent;
680
731
  target.CustomEvent ??= NativeEvent;
681
732
  target.FormData ??= NativeFormData;
733
+ installNativeConstructor(target, "Headers", NativeHeaders);
682
734
  target.addEventListener ??= addEventListener;
683
735
  target.removeEventListener ??= removeEventListener;
684
736
  target.dispatchEvent ??= dispatchEvent;
@@ -10,7 +10,6 @@ export declare function waitFor(check: () => boolean, description: string, timeo
10
10
  export declare function compileNativeScreen(source: string, options?: { name?: string, minify?: boolean }): Promise<{ code: string, diagnostics: Array<{ message: string }> }>;
11
11
  /** End every screen still running. Registered after each test when run under `bun test`. */
12
12
  export declare function unmountAllNativeScreens(): void;
13
- /** Mount a compiled native bundle as screen `screen`, on a fake phone. */
14
13
  export declare function mountNativeScreen(code: string, screen: string, options?: NativeScreenOptions): NativeScreen;
15
14
  /** An API answer with this status and body. */
16
15
  export declare const status: (code: number, body?: unknown) => StatusAnswer;
@@ -38,6 +38,32 @@ try {
38
38
  afterEach(unmountAllNativeScreens);
39
39
  } catch {}
40
40
  const copy = (value) => JSON.parse(JSON.stringify(value));
41
+ function plainHeaders(headers) {
42
+ if (headers == null)
43
+ return;
44
+ if (typeof headers.forEach === "function" && !Array.isArray(headers)) {
45
+ const record = {};
46
+ headers.forEach((value, name) => {
47
+ record[name] = String(value);
48
+ });
49
+ return record;
50
+ }
51
+ return headers;
52
+ }
53
+ function answered(status, body) {
54
+ const headers = { "content-type": "application/json" };
55
+ return {
56
+ ok: status >= 200 && status < 300,
57
+ status,
58
+ headers: {
59
+ get: (name) => headers[String(name).toLowerCase()] ?? null,
60
+ has: (name) => (String(name).toLowerCase() in headers),
61
+ forEach: (callback) => Object.entries(headers).forEach(([name, value]) => callback(value, name))
62
+ },
63
+ json: async () => body,
64
+ text: async () => JSON.stringify(body)
65
+ };
66
+ }
41
67
  export function mountNativeScreen(code, screen, options = {}) {
42
68
  let ended = !1, online = !0;
43
69
  const timeouts = new Set, intervals = new Set, timers = {
@@ -132,9 +158,10 @@ export function mountNativeScreen(code, screen, options = {}) {
132
158
  ...options.globals,
133
159
  __stxNativeRoute: screen,
134
160
  __stxNativeParams: options.params ?? {},
135
- fetch: async (url, init = {}) => {
161
+ fetch: async (url, given = {}) => {
136
162
  if (ended)
137
163
  throw Object.assign(TypeError("The screen has ended."), { code: "NETWORK_ERROR" });
164
+ const init = { ...given, headers: plainHeaders(given.headers) };
138
165
  fetching++;
139
166
  let counted = !0;
140
167
  try {
@@ -159,10 +186,10 @@ export function mountNativeScreen(code, screen, options = {}) {
159
186
  answer = await (signal ? Promise.race([given, new Promise((_, reject) => signal.addEventListener("abort", () => reject(Object.assign(Error("The operation was aborted."), { name: "AbortError" }))))]) : given);
160
187
  }
161
188
  if (answer === void 0)
162
- return { ok: !1, status: 404, json: async () => ({}) };
189
+ return answered(404, {});
163
190
  if (answer instanceof StatusAnswer)
164
- return { ok: answer.status < 300, status: answer.status, json: async () => answer.body };
165
- return { ok: !0, status: 200, json: async () => answer };
191
+ return answered(answer.status, answer.body);
192
+ return answered(200, answer);
166
193
  } finally {
167
194
  if (counted)
168
195
  fetching--;
package/dist/pwa.js CHANGED
@@ -1,6 +1,6 @@
1
1
  // @bun
2
- import{Es,jt,bc,gu}from"./chunk-yh0wb4n1.js";import{Cs,Xo,du,pu,fu}from"./chunk-xv43szx0.js";import{mc,hc,yc,lu,uu}from"./chunk-wpmrz872.js";import{Fe,wn,Jo}from"./chunk-wpm58d6p.js";import{mu,hu,yu,bu,Ts,qp}from"./chunk-qv6axke4.js";import B from"fs";import w from"path";import O from"fs";import u from"path";var v=[72,96,128,144,152,192,384,512],S=[120,152,167,180],P=[16,32];async function M(n,t){let e={success:!0,generatedFiles:[],errors:[],warnings:[]},r=n.pwa?.icons;if(!r?.src)return e.errors.push("No source icon specified in pwa.icons.src"),e.success=!1,e;let o=u.isAbsolute(r.src)?r.src:u.resolve(process.cwd(),r.src);if(!await Bun.file(o).exists())return e.errors.push(`Source icon not found: ${o}`),e.success=!1,e;let a=u.resolve(t,r.outputDir||"pwa-icons");try{O.mkdirSync(a,{recursive:!0})}catch{return e.errors.push(`Failed to create output directory: ${a}`),e.success=!1,e}let s=r.sizes||v,l=r.generateWebP??!0,p=r.generateAppleIcons??!0;try{let c;try{c=await import("sharp")}catch{return e.errors.push(`sharp is not installed. Install it with: bun add sharp
3
- Icon generation requires the sharp package for image processing.`),e.success=!1,e}let g=await c.default(o).metadata();if(g.width&&g.width<512)e.warnings.push(`Source icon is ${g.width}x${g.height}. Recommend using at least 512x512 for best quality.`);for(let i of s){let d=u.join(a,`icon-${i}x${i}.png`);if(await c.default(o).resize(i,i,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).png().toFile(d),e.generatedFiles.push(d),l){let x=u.join(a,`icon-${i}x${i}.webp`);await c.default(o).resize(i,i,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).webp({quality:90}).toFile(x),e.generatedFiles.push(x)}}if(p){for(let d of S){let x=u.join(a,`apple-touch-icon-${d}x${d}.png`);await c.default(o).resize(d,d,{fit:"contain",background:{r:255,g:255,b:255,alpha:1}}).png().toFile(x),e.generatedFiles.push(x)}let i=u.join(a,"apple-touch-icon.png");await c.default(o).resize(180,180,{fit:"contain",background:{r:255,g:255,b:255,alpha:1}}).png().toFile(i),e.generatedFiles.push(i)}for(let i of P){let d=u.join(a,`favicon-${i}x${i}.png`);await c.default(o).resize(i,i,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).png().toFile(d),e.generatedFiles.push(d)}let f=512,y=u.join(a,`icon-maskable-${f}x${f}.png`),m=Math.floor(f*0.1),k=f-m*2;await c.default(o).resize(k,k,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).extend({top:m,bottom:m,left:m,right:m,background:{r:255,g:255,b:255,alpha:1}}).png().toFile(y),e.generatedFiles.push(y)}catch(c){let h=c instanceof Error?c.message:String(c);e.errors.push(`Icon generation failed: ${h}`),e.success=!1}return e}function N(n){let t=n.sizes||v,e=n.outputDir?`/${n.outputDir}`:"/pwa-icons",r=n.generateWebP??!0,o=n.generateAppleIcons??!0,a=[];for(let s of t)if(a.push(`${e}/icon-${s}x${s}.png`),r)a.push(`${e}/icon-${s}x${s}.webp`);if(o){a.push(`${e}/apple-touch-icon.png`);for(let s of S)a.push(`${e}/apple-touch-icon-${s}x${s}.png`)}for(let s of P)a.push(`${e}/favicon-${s}x${s}.png`);return a.push(`${e}/icon-maskable-512x512.png`),a}async function I(){try{return await import("sharp"),!0}catch{return!1}}function A(n,t,e,r){let o=[],a=r.join(" ");for(let s of n)if(o.push({src:`${t}/icon-${s}x${s}.png`,sizes:`${s}x${s}`,type:"image/png",purpose:a}),e)o.push({src:`${t}/icon-${s}x${s}.webp`,sizes:`${s}x${s}`,type:"image/webp",purpose:a});return o}function C(n){return n.map((t)=>({name:t.name,short_name:t.shortName,description:t.description,url:t.url,icons:t.icons?.map((e)=>({src:e.src,sizes:e.sizes,type:e.type}))}))}function T(n){let t=n.pwa?.shareTarget;if(!t?.enabled)return;let e={action:t.action||"/share",method:t.method||"POST",enctype:t.enctype||"multipart/form-data",params:{title:t.params?.title||"title",text:t.params?.text||"text",url:t.params?.url||"url"}};if(t.acceptFiles&&t.acceptFiles.length>0)e.params.files=t.acceptFiles.map((r)=>({name:r.name,accept:r.accept}));return e}function H(n){let t=n.pwa?.fileHandlers;if(!t?.enabled||!t.accept)return;let e=[{action:t.action||"/",accept:t.accept,launch_type:t.launchType||"single-client"}];if(t.icons)e[0].icons=t.icons.map((r)=>({src:r.src,sizes:r.sizes,type:r.type}));return e}function W(n){let t=n.pwa?.protocolHandlers;if(!t||t.length===0)return;return t.map((e)=>({protocol:e.protocol,url:e.url}))}function j(n){let t=n.pwa;if(!t?.enabled||!t.manifest)return null;let{manifest:e,icons:r}=t,o=r?.sizes||[72,96,128,144,152,192,384,512],a=r?.outputDir?`/${r.outputDir}`:"/pwa-icons",s=r?.generateWebP??!0,l=r?.purpose||["any","maskable"],p={name:e.name,short_name:e.shortName||e.name,description:e.description,start_url:e.startUrl||"/",display:e.display||"standalone",display_override:e.displayOverride,orientation:e.orientation,theme_color:e.themeColor,background_color:e.backgroundColor,scope:e.scope||"/",lang:e.lang,dir:e.dir,id:e.id,categories:e.categories,icons:A(o,a,s,l)};if(e.shortcuts&&e.shortcuts.length>0)p.shortcuts=C(e.shortcuts);if(e.screenshots&&e.screenshots.length>0)p.screenshots=e.screenshots.map((f)=>({src:f.src,sizes:f.sizes,type:f.type,label:f.label,form_factor:f.platform}));let c=T(n);if(c)p.share_target=c;let h=H(n);if(h)p.file_handlers=h;let g=W(n);if(g)p.protocol_handlers=g;if(e.launchHandler)p.launch_handler={client_mode:e.launchHandler};if(e.handleLinks)p.handle_links=e.handleLinks;if(e.edgeSidePanel?.enabled)p.edge_side_panel={preferred_width:e.edgeSidePanel.preferredWidth};return p}function _(n){let t=j(n);if(!t)return"";let e=JSON.parse(JSON.stringify(t));return JSON.stringify(e,null,2)}function q(n,t){return{...t,...n,shortcuts:n.shortcuts||t.shortcuts,screenshots:n.screenshots||t.screenshots,categories:n.categories||t.categories}}function D(n){let t=[],e=n.pwa;if(!e?.enabled)return t;let r=e.manifest;if(!r)return t.push("PWA manifest configuration is missing"),t;if(!r.name)t.push("Manifest name is required");let o=["fullscreen","standalone","minimal-ui","browser"];if(r.display&&!o.includes(r.display))t.push(`Invalid display mode: ${r.display}. Must be one of: ${o.join(", ")}`);let a=["any","natural","landscape","landscape-primary","landscape-secondary","portrait","portrait-primary","portrait-secondary"];if(r.orientation&&!a.includes(r.orientation))t.push(`Invalid orientation: ${r.orientation}`);let s=/^#([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6})$/;if(r.themeColor&&!s.test(r.themeColor))t.push(`Invalid theme color: ${r.themeColor}. Must be a valid hex color.`);if(r.backgroundColor&&!s.test(r.backgroundColor))t.push(`Invalid background color: ${r.backgroundColor}. Must be a valid hex color.`);if(e.shareTarget?.enabled){if(!e.shareTarget.action)t.push("Share target action URL is required")}if(e.fileHandlers?.enabled){if(!e.fileHandlers.accept||Object.keys(e.fileHandlers.accept).length===0)t.push("File handlers must specify accepted MIME types")}if(e.protocolHandlers)for(let l of e.protocolHandlers){if(!l.protocol)t.push("Protocol handler missing protocol");if(!l.url||!l.url.includes("%s"))t.push(`Protocol handler URL must contain %s placeholder: ${l.protocol}`)}return t}import z from"path";async function F(n){let t=n.pwa?.offline;if(!t?.enabled)return"";if(t.page){let e=z.isAbsolute(t.page)?t.page:z.resolve(process.cwd(),t.page);if(await Bun.file(e).exists())try{let{processDirectives:r}=await import("./chunk-5etmsv9z.js"),o=await Bun.file(e).text();return await r(o,{},e,n,new Set)}catch(r){console.warn(`[PWA] Failed to process custom offline page: ${r}`)}else console.warn(`[PWA] Custom offline page not found: ${e}`)}return E(n)}function E(n){let t=n.pwa?.offline,e=n.pwa?.manifest,r=t?.fallbackTitle||"You are offline",o=t?.fallbackMessage||"Please check your internet connection and try again.",a=e?.themeColor||"#4f46e5",s=e?.shortName||e?.name||"App";return`<!DOCTYPE html>
2
+ import{Es,jt,bc,gu}from"./chunk-ecqrkyg8.js";import{Cs,Xo,du,pu,fu}from"./chunk-xqp4hstk.js";import{mc,hc,yc,lu,uu}from"./chunk-wpmrz872.js";import{ze,wn,Jo}from"./chunk-30nes8ne.js";import{mu,hu,yu,bu,Ts,qp}from"./chunk-qv6axke4.js";import B from"fs";import w from"path";import O from"fs";import u from"path";var v=[72,96,128,144,152,192,384,512],S=[120,152,167,180],P=[16,32];async function M(n,t){let e={success:!0,generatedFiles:[],errors:[],warnings:[]},r=n.pwa?.icons;if(!r?.src)return e.errors.push("No source icon specified in pwa.icons.src"),e.success=!1,e;let o=u.isAbsolute(r.src)?r.src:u.resolve(process.cwd(),r.src);if(!await Bun.file(o).exists())return e.errors.push(`Source icon not found: ${o}`),e.success=!1,e;let a=u.resolve(t,r.outputDir||"pwa-icons");try{O.mkdirSync(a,{recursive:!0})}catch{return e.errors.push(`Failed to create output directory: ${a}`),e.success=!1,e}let s=r.sizes||v,l=r.generateWebP??!0,p=r.generateAppleIcons??!0;try{let c;try{c=await import("sharp")}catch{return e.errors.push(`sharp is not installed. Install it with: bun add sharp
3
+ Icon generation requires the sharp package for image processing.`),e.success=!1,e}let g=await c.default(o).metadata();if(g.width&&g.width<512)e.warnings.push(`Source icon is ${g.width}x${g.height}. Recommend using at least 512x512 for best quality.`);for(let i of s){let d=u.join(a,`icon-${i}x${i}.png`);if(await c.default(o).resize(i,i,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).png().toFile(d),e.generatedFiles.push(d),l){let x=u.join(a,`icon-${i}x${i}.webp`);await c.default(o).resize(i,i,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).webp({quality:90}).toFile(x),e.generatedFiles.push(x)}}if(p){for(let d of S){let x=u.join(a,`apple-touch-icon-${d}x${d}.png`);await c.default(o).resize(d,d,{fit:"contain",background:{r:255,g:255,b:255,alpha:1}}).png().toFile(x),e.generatedFiles.push(x)}let i=u.join(a,"apple-touch-icon.png");await c.default(o).resize(180,180,{fit:"contain",background:{r:255,g:255,b:255,alpha:1}}).png().toFile(i),e.generatedFiles.push(i)}for(let i of P){let d=u.join(a,`favicon-${i}x${i}.png`);await c.default(o).resize(i,i,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).png().toFile(d),e.generatedFiles.push(d)}let f=512,y=u.join(a,`icon-maskable-${f}x${f}.png`),m=Math.floor(f*0.1),k=f-m*2;await c.default(o).resize(k,k,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).extend({top:m,bottom:m,left:m,right:m,background:{r:255,g:255,b:255,alpha:1}}).png().toFile(y),e.generatedFiles.push(y)}catch(c){let h=c instanceof Error?c.message:String(c);e.errors.push(`Icon generation failed: ${h}`),e.success=!1}return e}function N(n){let t=n.sizes||v,e=n.outputDir?`/${n.outputDir}`:"/pwa-icons",r=n.generateWebP??!0,o=n.generateAppleIcons??!0,a=[];for(let s of t)if(a.push(`${e}/icon-${s}x${s}.png`),r)a.push(`${e}/icon-${s}x${s}.webp`);if(o){a.push(`${e}/apple-touch-icon.png`);for(let s of S)a.push(`${e}/apple-touch-icon-${s}x${s}.png`)}for(let s of P)a.push(`${e}/favicon-${s}x${s}.png`);return a.push(`${e}/icon-maskable-512x512.png`),a}async function I(){try{return await import("sharp"),!0}catch{return!1}}function A(n,t,e,r){let o=[],a=r.join(" ");for(let s of n)if(o.push({src:`${t}/icon-${s}x${s}.png`,sizes:`${s}x${s}`,type:"image/png",purpose:a}),e)o.push({src:`${t}/icon-${s}x${s}.webp`,sizes:`${s}x${s}`,type:"image/webp",purpose:a});return o}function C(n){return n.map((t)=>({name:t.name,short_name:t.shortName,description:t.description,url:t.url,icons:t.icons?.map((e)=>({src:e.src,sizes:e.sizes,type:e.type}))}))}function T(n){let t=n.pwa?.shareTarget;if(!t?.enabled)return;let e={action:t.action||"/share",method:t.method||"POST",enctype:t.enctype||"multipart/form-data",params:{title:t.params?.title||"title",text:t.params?.text||"text",url:t.params?.url||"url"}};if(t.acceptFiles&&t.acceptFiles.length>0)e.params.files=t.acceptFiles.map((r)=>({name:r.name,accept:r.accept}));return e}function H(n){let t=n.pwa?.fileHandlers;if(!t?.enabled||!t.accept)return;let e=[{action:t.action||"/",accept:t.accept,launch_type:t.launchType||"single-client"}];if(t.icons)e[0].icons=t.icons.map((r)=>({src:r.src,sizes:r.sizes,type:r.type}));return e}function W(n){let t=n.pwa?.protocolHandlers;if(!t||t.length===0)return;return t.map((e)=>({protocol:e.protocol,url:e.url}))}function j(n){let t=n.pwa;if(!t?.enabled||!t.manifest)return null;let{manifest:e,icons:r}=t,o=r?.sizes||[72,96,128,144,152,192,384,512],a=r?.outputDir?`/${r.outputDir}`:"/pwa-icons",s=r?.generateWebP??!0,l=r?.purpose||["any","maskable"],p={name:e.name,short_name:e.shortName||e.name,description:e.description,start_url:e.startUrl||"/",display:e.display||"standalone",display_override:e.displayOverride,orientation:e.orientation,theme_color:e.themeColor,background_color:e.backgroundColor,scope:e.scope||"/",lang:e.lang,dir:e.dir,id:e.id,categories:e.categories,icons:A(o,a,s,l)};if(e.shortcuts&&e.shortcuts.length>0)p.shortcuts=C(e.shortcuts);if(e.screenshots&&e.screenshots.length>0)p.screenshots=e.screenshots.map((f)=>({src:f.src,sizes:f.sizes,type:f.type,label:f.label,form_factor:f.platform}));let c=T(n);if(c)p.share_target=c;let h=H(n);if(h)p.file_handlers=h;let g=W(n);if(g)p.protocol_handlers=g;if(e.launchHandler)p.launch_handler={client_mode:e.launchHandler};if(e.handleLinks)p.handle_links=e.handleLinks;if(e.edgeSidePanel?.enabled)p.edge_side_panel={preferred_width:e.edgeSidePanel.preferredWidth};return p}function _(n){let t=j(n);if(!t)return"";let e=JSON.parse(JSON.stringify(t));return JSON.stringify(e,null,2)}function q(n,t){return{...t,...n,shortcuts:n.shortcuts||t.shortcuts,screenshots:n.screenshots||t.screenshots,categories:n.categories||t.categories}}function D(n){let t=[],e=n.pwa;if(!e?.enabled)return t;let r=e.manifest;if(!r)return t.push("PWA manifest configuration is missing"),t;if(!r.name)t.push("Manifest name is required");let o=["fullscreen","standalone","minimal-ui","browser"];if(r.display&&!o.includes(r.display))t.push(`Invalid display mode: ${r.display}. Must be one of: ${o.join(", ")}`);let a=["any","natural","landscape","landscape-primary","landscape-secondary","portrait","portrait-primary","portrait-secondary"];if(r.orientation&&!a.includes(r.orientation))t.push(`Invalid orientation: ${r.orientation}`);let s=/^#([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6})$/;if(r.themeColor&&!s.test(r.themeColor))t.push(`Invalid theme color: ${r.themeColor}. Must be a valid hex color.`);if(r.backgroundColor&&!s.test(r.backgroundColor))t.push(`Invalid background color: ${r.backgroundColor}. Must be a valid hex color.`);if(e.shareTarget?.enabled){if(!e.shareTarget.action)t.push("Share target action URL is required")}if(e.fileHandlers?.enabled){if(!e.fileHandlers.accept||Object.keys(e.fileHandlers.accept).length===0)t.push("File handlers must specify accepted MIME types")}if(e.protocolHandlers)for(let l of e.protocolHandlers){if(!l.protocol)t.push("Protocol handler missing protocol");if(!l.url||!l.url.includes("%s"))t.push(`Protocol handler URL must contain %s placeholder: ${l.protocol}`)}return t}import z from"path";async function F(n){let t=n.pwa?.offline;if(!t?.enabled)return"";if(t.page){let e=z.isAbsolute(t.page)?t.page:z.resolve(process.cwd(),t.page);if(await Bun.file(e).exists())try{let{processDirectives:r}=await import("./chunk-r7cenpxp.js"),o=await Bun.file(e).text();return await r(o,{},e,n,new Set)}catch(r){console.warn(`[PWA] Failed to process custom offline page: ${r}`)}else console.warn(`[PWA] Custom offline page not found: ${e}`)}return E(n)}function E(n){let t=n.pwa?.offline,e=n.pwa?.manifest,r=t?.fallbackTitle||"You are offline",o=t?.fallbackMessage||"Please check your internet connection and try again.",a=e?.themeColor||"#4f46e5",s=e?.shortName||e?.name||"App";return`<!DOCTYPE html>
4
4
  <html lang="en">
5
5
  <head>
6
6
  <meta charset="UTF-8">
@@ -233,4 +233,4 @@ Icon generation requires the sharp package for image processing.`),e.success=!1,
233
233
  }, 5000);
234
234
  </script>
235
235
  </body>
236
- </html>`}function b(n){return n.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}async function re(n,t){let e={success:!0,files:{icons:[]},errors:[],warnings:[]},r=n.pwa;if(!r?.enabled)return e;try{B.mkdirSync(t,{recursive:!0})}catch{return e.errors.push(`Failed to create output directory: ${t}`),e.success=!1,e}try{let a=_(n);if(a){let s=w.join(t,"manifest.json");await Bun.write(s,a),e.files.manifest=s}}catch(a){let s=a instanceof Error?a.message:String(a);e.errors.push(`Failed to generate manifest.json: ${s}`),e.success=!1}if(r.icons?.src)if(await I()){let s=await M(n,t);if(e.files.icons=s.generatedFiles,e.warnings.push(...s.warnings),!s.success)e.errors.push(...s.errors),e.success=!1}else e.warnings.push("sharp is not installed. Skipping icon generation. Install with: bun add sharp");if(r.offline?.enabled)try{let a=await F(n);if(a){let s=w.join(t,"offline.html");await Bun.write(s,a),e.files.offlinePage=s}}catch(a){let s=a instanceof Error?a.message:String(a);e.errors.push(`Failed to generate offline page: ${s}`),e.success=!1}let o;if(r.precache?.enabled){let a=Fe(t,n);o={fileCount:a.fileCount,totalSize:a.totalSize},e.precacheStats=o}try{let a=Es(n,t);if(a){let s=jt(n),l=w.join(t,s);await Bun.write(l,a),e.files.serviceWorker=l}}catch(a){let s=a instanceof Error?a.message:String(a);e.errors.push(`Failed to generate service worker: ${s}`),e.success=!1}return e}function ae(n,t){return Xo(n,t)}function se(n){return n.pwa?.enabled===!0}export{S as APPLE_TOUCH_ICON_SIZES,v as DEFAULT_ICON_SIZES,P as FAVICON_SIZES,hc as auditBuildOutput,mc as auditConfig,re as buildPwaAssets,yc as calculateAuditResult,uu as formatAuditResult,Jo as formatSize,j as generateManifest,_ as generateManifestJson,pu as generateManifestLink,F as generateOfflinePage,Fe as generatePrecacheManifest,wn as generatePrecacheManifestJs,M as generatePwaIcons,Cs as generatePwaTags,Es as generateServiceWorker,gu as generateServiceWorkerAuto,du as generateSwRegistrationScript,fu as generateThemeColorMeta,N as getExpectedIconPaths,jt as getServiceWorkerFileName,Xo as injectPwaTags,se as isPwaEnabled,I as isSharpAvailable,bc as isWorkboxEnabled,q as mergeManifestConfig,ae as processPwaHtml,Ts as pwaDirectives,mu as pwaInstallDirective,yu as pwaOfflineDirective,bu as pwaPushDirective,hu as pwaUpdateDirective,qp as registerPwaDirectives,lu as runPwaAudit,D as validateManifest};
236
+ </html>`}function b(n){return n.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}async function re(n,t){let e={success:!0,files:{icons:[]},errors:[],warnings:[]},r=n.pwa;if(!r?.enabled)return e;try{B.mkdirSync(t,{recursive:!0})}catch{return e.errors.push(`Failed to create output directory: ${t}`),e.success=!1,e}try{let a=_(n);if(a){let s=w.join(t,"manifest.json");await Bun.write(s,a),e.files.manifest=s}}catch(a){let s=a instanceof Error?a.message:String(a);e.errors.push(`Failed to generate manifest.json: ${s}`),e.success=!1}if(r.icons?.src)if(await I()){let s=await M(n,t);if(e.files.icons=s.generatedFiles,e.warnings.push(...s.warnings),!s.success)e.errors.push(...s.errors),e.success=!1}else e.warnings.push("sharp is not installed. Skipping icon generation. Install with: bun add sharp");if(r.offline?.enabled)try{let a=await F(n);if(a){let s=w.join(t,"offline.html");await Bun.write(s,a),e.files.offlinePage=s}}catch(a){let s=a instanceof Error?a.message:String(a);e.errors.push(`Failed to generate offline page: ${s}`),e.success=!1}let o;if(r.precache?.enabled){let a=ze(t,n);o={fileCount:a.fileCount,totalSize:a.totalSize},e.precacheStats=o}try{let a=Es(n,t);if(a){let s=jt(n),l=w.join(t,s);await Bun.write(l,a),e.files.serviceWorker=l}}catch(a){let s=a instanceof Error?a.message:String(a);e.errors.push(`Failed to generate service worker: ${s}`),e.success=!1}return e}function ae(n,t){return Xo(n,t)}function se(n){return n.pwa?.enabled===!0}export{S as APPLE_TOUCH_ICON_SIZES,v as DEFAULT_ICON_SIZES,P as FAVICON_SIZES,hc as auditBuildOutput,mc as auditConfig,re as buildPwaAssets,yc as calculateAuditResult,uu as formatAuditResult,Jo as formatSize,j as generateManifest,_ as generateManifestJson,pu as generateManifestLink,F as generateOfflinePage,ze as generatePrecacheManifest,wn as generatePrecacheManifestJs,M as generatePwaIcons,Cs as generatePwaTags,Es as generateServiceWorker,gu as generateServiceWorkerAuto,du as generateSwRegistrationScript,fu as generateThemeColorMeta,N as getExpectedIconPaths,jt as getServiceWorkerFileName,Xo as injectPwaTags,se as isPwaEnabled,I as isSharpAvailable,bc as isWorkboxEnabled,q as mergeManifestConfig,ae as processPwaHtml,Ts as pwaDirectives,mu as pwaInstallDirective,yu as pwaOfflineDirective,bu as pwaPushDirective,hu as pwaUpdateDirective,qp as registerPwaDirectives,lu as runPwaAudit,D as validateManifest};
@@ -839,8 +839,7 @@ export async function processScriptSetup(template, filePath, serverData, options
839
839
  let scriptContent = signalScripts[i].bundled ?? injectBrowserCoreAutoImports(signalScripts[i].content).code;
840
840
  if (!signalScripts[i].bundled && hasUserImports(scriptContent))
841
841
  scriptContent = await bundleClientScript(scriptContent, filePath || "", {
842
- projectRoot: process.cwd(),
843
- externalizeUserModules: options.forceClientSetup ? !1 : void 0
842
+ projectRoot: process.cwd()
844
843
  });
845
844
  scriptContent = stripStxRuntimeImports(scriptContent);
846
845
  const resolved = transformStoreImports(scriptContent);
@@ -1,5 +1,5 @@
1
1
  export function collectSlotScopes(source) {
2
- if (!source.includes("#") && !source.includes("v-slot:"))
2
+ if (!source.includes("#") && !source.includes("v-slot:") && !source.includes("data-stx-slot-binding"))
3
3
  return [];
4
4
  const scopes = [], stack = [], tags = /<!--[\s\S]*?-->|<script\b(?:"[^"]*"|'[^']*'|[^'">])*>[\s\S]*?<\/script\s*>|<style\b(?:"[^"]*"|'[^']*'|[^'">])*>[\s\S]*?<\/style\s*>|<\/?[a-z][\w:-]*\b(?:"[^"]*"|'[^']*'|[^'">])*>/gi;
5
5
  for (const match of source.matchAll(tags)) {
@@ -9,7 +9,15 @@ export function collectSlotScopes(source) {
9
9
  if (scope)
10
10
  scope.end = match.index;
11
11
  } else if (/^<template\b/i.test(tag) && !/\/\s*>$/.test(tag)) {
12
- const binding = [...tag.slice(9).matchAll(/([^\s=/>]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s>]+)))?/g)].find((attr) => /^(?:#[\w-]+|v-slot:[\w-]+)$/i.test(attr[1])), value = (binding?.[2] ?? binding?.[3])?.trim(), scope = value ? { start: match.index + tag.length, end: source.length, binding: value } : void 0;
12
+ const binding = [...tag.slice(9).matchAll(/([^\s=/>]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s>]+)))?/g)].find((attr) => /^(?:#[\w-]+|v-slot:[\w-]+|data-stx-slot-binding)$/i.test(attr[1]));
13
+ let value = (binding?.[2] ?? binding?.[3])?.trim();
14
+ if (value && binding?.[1] === "data-stx-slot-binding")
15
+ try {
16
+ value = decodeURIComponent(value);
17
+ } catch {
18
+ value = void 0;
19
+ }
20
+ const scope = value ? { start: match.index + tag.length, end: source.length, binding: value } : void 0;
13
21
  stack.push(scope);
14
22
  if (scope)
15
23
  scopes.push(scope);
package/dist/slots.d.ts CHANGED
@@ -32,7 +32,7 @@ export declare function renderSlot(slotDef: SlotDefinition | undefined, slotProp
32
32
  *
33
33
  * Replaces <slot> elements with the appropriate content from parsed slots.
34
34
  */
35
- export declare function processSlots(template: string, parsedSlots: ParsedSlots, context: Record<string, unknown>): Promise<string>;
35
+ export declare function processSlots(template: string, parsedSlots: ParsedSlots, context: Record<string, unknown>, runtimeOwner?: string): Promise<string>;
36
36
  /**
37
37
  * Extract named slots from component children content.
38
38
  * This is called when processing a component to separate slot content.
@@ -45,7 +45,7 @@ export declare function extractSlotContent(childContent: string): {
45
45
  * Apply slots to a component template.
46
46
  * This replaces <slot> elements with the provided slot content.
47
47
  */
48
- export declare function applySlots(componentTemplate: string, defaultSlotContent: string, namedSlots: Map<string, SlotDefinition>, context: Record<string, unknown>): Promise<string>;
48
+ export declare function applySlots(componentTemplate: string, defaultSlotContent: string, namedSlots: Map<string, SlotDefinition>, context: Record<string, unknown>, runtimeOwner?: string): Promise<string>;
49
49
  // =============================================================================
50
50
  // Types
51
51
  // =============================================================================
package/dist/slots.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { escapeHtml } from "./expressions.js";
2
2
  import { isExpressionSafe, createSafeFunction } from "./safe-evaluator.js";
3
- import { readsAnyName } from "./loop-binding.js";
3
+ import { loopBoundNames, readsAnyName } from "./loop-binding.js";
4
4
  function findMatchingTemplateClose(content, startIndex) {
5
5
  let depth = 1, i = startIndex;
6
6
  const openTag = "<template", closeTag = "</template";
@@ -325,14 +325,30 @@ function evaluateSimpleExpression(expr, context) {
325
325
  return;
326
326
  }
327
327
  }
328
- export async function processSlots(template, parsedSlots, context) {
328
+ export async function processSlots(template, parsedSlots, context, runtimeOwner) {
329
329
  let result = template;
330
330
  result = await replaceAsync(result, /<slot\s+name\s*=\s*["']([^"']+)["']([^>]*?)(?:\/>|>([\s\S]*?)<\/slot>)/gi, async (match, name, attrs, defaultContent) => {
331
- const slotDef = parsedSlots.named.get(name), defaultFallback = defaultContent?.trim() || "", propsStr = attrs || "", props = {}, propsRegex = /:([a-zA-Z_$][\w$-]*)\s*=\s*["']([^"']+)["']/g;
331
+ const slotDef = parsedSlots.named.get(name), defaultFallback = defaultContent?.trim() || "", propsStr = attrs || "", props = {}, expressions = [], propsRegex = /:([a-zA-Z_$][\w$-]*)\s*=\s*["']([^"']+)["']/g;
332
332
  let propMatch;
333
333
  while ((propMatch = propsRegex.exec(propsStr)) !== null) {
334
334
  const propName = propMatch[1], propExpr = propMatch[2];
335
335
  props[propName] = evaluateSimpleExpression(propExpr, context);
336
+ expressions.push([propName, propExpr]);
337
+ }
338
+ if (runtimeOwner !== void 0 && slotDef?.propsBinding && Object.values(props).some((value) => value === void 0)) {
339
+ const binding = slotDef.propsBinding.trim(), names = loopBoundNames(`${binding} in []`);
340
+ let local = "__stx_slot_props";
341
+ while (names.includes(local))
342
+ local += "_";
343
+ const source = expressions.map(([key, expression]) => {
344
+ const value = props[key];
345
+ let serialized;
346
+ try {
347
+ serialized = value === void 0 ? void 0 : JSON.stringify(value);
348
+ } catch {}
349
+ return `${JSON.stringify(key)}:(${serialized ?? expression})`;
350
+ }).join(","), scope = escapeHtml(JSON.stringify({ binding, names, owner: runtimeOwner }));
351
+ return `<template :for="${escapeHtml(`${local} in [{${source}}]`)}" data-stx-slot-binding="${encodeURIComponent(binding)}" data-stx-slot-scope="${scope}">${slotDef.content}</template>`;
336
352
  }
337
353
  return await renderSlot(slotDef, props, defaultFallback, context);
338
354
  });
@@ -368,9 +384,9 @@ export function extractSlotContent(childContent) {
368
384
  namedSlots: parsed.named
369
385
  };
370
386
  }
371
- export async function applySlots(componentTemplate, defaultSlotContent, namedSlots, context) {
387
+ export async function applySlots(componentTemplate, defaultSlotContent, namedSlots, context, runtimeOwner) {
372
388
  return await processSlots(componentTemplate, {
373
389
  default: defaultSlotContent,
374
390
  named: namedSlots
375
- }, context);
391
+ }, context, runtimeOwner);
376
392
  }
package/dist/ssg.js CHANGED
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import"./chunk-v2x9vzgw.js";import"./chunk-hb08vrbb.js";import"./chunk-7rta163c.js";import"./chunk-ce6zddpf.js";import"./chunk-qzy8ypk4.js";import"./chunk-2h8ea0we.js";import"./chunk-b6xv8jh9.js";import"./chunk-a3d0g4mr.js";import{vt,wt,xt,St,kt,_t}from"./chunk-zaaeneq6.js";import{o}from"./chunk-1z1632np.js";import{Yr}from"./chunk-t9mfztcs.js";import"./chunk-04kg16qs.js";import"./chunk-43gr8ggc.js";import{_e,Gt,Kt}from"./chunk-a1p327a7.js";import"./chunk-bgra36az.js";import{h}from"./chunk-nf9bykvg.js";import{ft,s}from"./chunk-fzxyq6k5.js";import"./chunk-0g4pr7ww.js";import"./chunk-zjsyw63k.js";import"./chunk-pc48mjkc.js";import"./chunk-2q50h7zv.js";import"./chunk-prf164ct.js";import{Ji,Yi,Zi}from"./chunk-6ajahb2x.js";import{qt,jn,Bn}from"./chunk-xaa36b0x.js";import"./chunk-r7kmsq3n.js";import{V,me}from"./chunk-edvmtk21.js";import"./chunk-8nryyqb5.js";import"./chunk-q1svy1nf.js";import{c}from"./chunk-zhf01af3.js";import x from"fs";import g from"path";import{createHash as mt}from"crypto";function yt(t){try{return new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync(t).replace(/\}(var |let |const |function )/g,"};$1").trim()}catch{return t}}var bt=/<script\s+type="stx\/island"\s+data-stx-island="([^"]+)"([^>]*)>([\s\S]*?)<\/script>/g;function Pt(t){return Bun.hash(t).toString(16)}function nt(t,n={}){if(!t.includes('type="stx/island"'))return{html:t,chunks:[]};let i=new Map,r=t.replace(bt,(e,l,w,y)=>{let f=y.trim();if(!f)return e;if(/\bdata-stx-src=/.test(w))return e;if(n.minify)f=yt(f);let S=Pt(f);if(!i.has(S))i.set(S,f);let P=n.integrity?` data-stx-integrity="sha384-${mt("sha384").update(f).digest("base64")}"`:"";return`<script type="stx/island" data-stx-island="${l}" data-stx-src="/_stx/islands/${S}.js"${P}${w}></script>`}),a=Array.from(i,([e,l])=>({hash:e,code:l}));return{html:r,chunks:a}}var $t=new Set(["visible","idle"]);function it(t){if(!t.includes("data-stx-src="))return t;let n=new Map,i=/data-stx-scope="([^"]+)"[^>]*?stx-hydrate="([^"]+)"/g,r;while((r=i.exec(t))!==null)n.set(r[1],r[2]);let a=new Set,e=/data-stx-island="([^"]+)"[^>]*?data-stx-src="([^"]+)"/g,l;while((l=e.exec(t))!==null)if($t.has(n.get(l[1])||""))a.add(l[2]);let w=t.lastIndexOf("</head>");if(a.size===0||w===-1)return t;let y=Array.from(a).filter((f)=>!t.includes(`rel="prefetch" href="${f}"`)).map((f)=>`<link rel="prefetch" href="${f}" as="script">`).join("");if(!y)return t;return t.slice(0,w)+y+t.slice(w)}var Dt=["STX_SITE_URL","SITE_URL","URL","VERCEL_URL","CF_PAGES_URL"];function W(t){let n=t.trim();if(!n)return null;let i=/^https?:\/\//i.test(n)?n:`https://${n}`;try{return new URL(i).origin+new URL(i).pathname.replace(/\/$/,"")}catch{return null}}function Rt(t){for(let n of Dt){let i=t[n];if(!i)continue;let r=W(i);if(r)return{url:r,source:"env",via:n}}return null}function st(t){if(!t||typeof t!=="object")return null;let n=t,i=n.site?.url??n.url??n.app?.url;return typeof i==="string"?W(i):null}async function Ct(t){let{existsSync:n}=await import("fs"),i=await import("path");for(let r of["site.config.ts","site.config.js",".config/site.config.ts"]){let a=i.resolve(t,r);if(!n(a))continue;try{let e=await import(a),l=st(e.default??e);if(l)return l}catch{}}return null}async function at(t={}){let n=t.cwd??process.cwd(),i=t.env??process.env;if(t.explicit){let l=W(t.explicit);if(l)return{url:l,source:"option"}}let r=st(t.stxConfig);if(r)return{url:r,source:"stx.config",via:"site.url"};let a=await Ct(n);if(a)return{url:a,source:"site.config",via:"url"};let e=Rt(i);if(e)return e;return{url:"http://localhost",source:"fallback"}}function ot(){return["No site URL configured \u2014 sitemap.xml and robots.txt will point at http://localhost."," Set one in stx.config.ts (site: { url: 'https://example.com' }), in site.config.ts,"," via --domain, or with SITE_URL in the build environment."].join(`
2
+ import"./chunk-md2jn67b.js";import"./chunk-2dp7hyv7.js";import"./chunk-pxdww4rb.js";import"./chunk-ce6zddpf.js";import"./chunk-vdjj4vrp.js";import"./chunk-1sr6c0nk.js";import"./chunk-kpeep7gq.js";import"./chunk-a3d0g4mr.js";import{wt,xt,St,kt,_t,Ct}from"./chunk-365vg0eg.js";import{o}from"./chunk-9k2wz3k1.js";import{Yr}from"./chunk-fzqj1mjz.js";import"./chunk-04kg16qs.js";import"./chunk-sme31jbj.js";import{Ce,Gt,Kt}from"./chunk-zcz97ber.js";import"./chunk-6z2sdfac.js";import{h}from"./chunk-dy5j389v.js";import{gt,s}from"./chunk-rcefnd1g.js";import"./chunk-hm9jt1p9.js";import"./chunk-6by8f7n9.js";import"./chunk-dtjybwtz.js";import"./chunk-060298px.js";import"./chunk-prf164ct.js";import{Ji,Yi,Zi}from"./chunk-6ajahb2x.js";import{qt,jn,Bn}from"./chunk-xaa36b0x.js";import"./chunk-ka8befem.js";import{V,me}from"./chunk-fpz59dhz.js";import"./chunk-p472crv1.js";import"./chunk-9edksf8x.js";import{c}from"./chunk-zhf01af3.js";import x from"fs";import g from"path";import{createHash as mt}from"crypto";function yt(t){try{return new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync(t).replace(/\}(var |let |const |function )/g,"};$1").trim()}catch{return t}}var vt=/<script\s+type="stx\/island"\s+data-stx-island="([^"]+)"([^>]*)>([\s\S]*?)<\/script>/g;function bt(t){return Bun.hash(t).toString(16)}function nt(t,n={}){if(!t.includes('type="stx/island"'))return{html:t,chunks:[]};let i=new Map,r=t.replace(vt,(e,l,w,y)=>{let f=y.trim();if(!f)return e;if(/\bdata-stx-src=/.test(w))return e;if(n.minify)f=yt(f);let S=bt(f);if(!i.has(S))i.set(S,f);let P=n.integrity?` data-stx-integrity="sha384-${mt("sha384").update(f).digest("base64")}"`:"";return`<script type="stx/island" data-stx-island="${l}" data-stx-src="/_stx/islands/${S}.js"${P}${w}></script>`}),a=Array.from(i,([e,l])=>({hash:e,code:l}));return{html:r,chunks:a}}var Pt=new Set(["visible","idle"]);function it(t){if(!t.includes("data-stx-src="))return t;let n=new Map,i=/data-stx-scope="([^"]+)"[^>]*?stx-hydrate="([^"]+)"/g,r;while((r=i.exec(t))!==null)n.set(r[1],r[2]);let a=new Set,e=/data-stx-island="([^"]+)"[^>]*?data-stx-src="([^"]+)"/g,l;while((l=e.exec(t))!==null)if(Pt.has(n.get(l[1])||""))a.add(l[2]);let w=t.lastIndexOf("</head>");if(a.size===0||w===-1)return t;let y=Array.from(a).filter((f)=>!t.includes(`rel="prefetch" href="${f}"`)).map((f)=>`<link rel="prefetch" href="${f}" as="script">`).join("");if(!y)return t;return t.slice(0,w)+y+t.slice(w)}var $t=["STX_SITE_URL","SITE_URL","URL","VERCEL_URL","CF_PAGES_URL"];function W(t){let n=t.trim();if(!n)return null;let i=/^https?:\/\//i.test(n)?n:`https://${n}`;try{return new URL(i).origin+new URL(i).pathname.replace(/\/$/,"")}catch{return null}}function Dt(t){for(let n of $t){let i=t[n];if(!i)continue;let r=W(i);if(r)return{url:r,source:"env",via:n}}return null}function st(t){if(!t||typeof t!=="object")return null;let n=t,i=n.site?.url??n.url??n.app?.url;return typeof i==="string"?W(i):null}async function Rt(t){let{existsSync:n}=await import("fs"),i=await import("path");for(let r of["site.config.ts","site.config.js",".config/site.config.ts"]){let a=i.resolve(t,r);if(!n(a))continue;try{let e=await import(a),l=st(e.default??e);if(l)return l}catch{}}return null}async function at(t={}){let n=t.cwd??process.cwd(),i=t.env??process.env;if(t.explicit){let l=W(t.explicit);if(l)return{url:l,source:"option"}}let r=st(t.stxConfig);if(r)return{url:r,source:"stx.config",via:"site.url"};let a=await Rt(n);if(a)return{url:a,source:"site.config",via:"url"};let e=Dt(i);if(e)return e;return{url:"http://localhost",source:"fallback"}}function ot(){return["No site URL configured \u2014 sitemap.xml and robots.txt will point at http://localhost."," Set one in stx.config.ts (site: { url: 'https://example.com' }), in site.config.ts,"," via --domain, or with SITE_URL in the build environment."].join(`
3
3
  `)}class ct{cacheDir;cache=new Map;loaded=!1;salt;constructor(t,n=""){this.cacheDir=t,this.salt=n}async load(){if(this.loaded)return;let t=g.join(this.cacheDir,"build-cache.json");if(await Bun.file(t).exists())try{let n=JSON.parse(await Bun.file(t).text());for(let[i,r]of Object.entries(n))this.cache.set(i,r)}catch{}this.loaded=!0}async save(){await x.promises.mkdir(this.cacheDir,{recursive:!0});let t=g.join(this.cacheDir,"build-cache.json"),n={};for(let[i,r]of this.cache)n[i]=r;await Bun.write(t,JSON.stringify(n))}getHash(t,n){let i=x.statSync(t),r=`${this.salt}|${t}:${i.mtimeMs}`;for(let e of n)if(x.existsSync(e)){let l=x.statSync(e);r+=`:${e}:${l.mtimeMs}`}let a=0;for(let e=0;e<r.length;e++){let l=r.charCodeAt(e);a=(a<<5)-a+l,a=a&a}return Math.abs(a).toString(36)}get(t,n){let i=this.cache.get(t);if(!i)return null;let r=this.getHash(n,i.dependencies??[]);if(i.hash!==r)return this.cache.delete(t),null;return i.html}set(t,n,i,r){let a=this.getHash(n,i);this.cache.set(t,{hash:a,html:r,generatedAt:Date.now(),dependencies:i})}}class lt{cacheDir;constructor(t){this.cacheDir=t}getFilePath(t){let n=t.replace(/[^a-zA-Z0-9]/g,"_")+".json";return g.join(this.cacheDir,"isr",n)}async get(t){let n=this.getFilePath(t);if(!await Bun.file(n).exists())return null;try{return JSON.parse(await Bun.file(n).text())}catch{return null}}async set(t,n){let i=this.getFilePath(t);await x.promises.mkdir(g.dirname(i),{recursive:!0}),await Bun.write(i,JSON.stringify(n))}async invalidate(t){let n=this.getFilePath(t);if(await Bun.file(n).exists())await x.promises.unlink(n)}async invalidatePattern(t){let n=g.join(this.cacheDir,"isr");if(!x.existsSync(n))return;let i=await x.promises.readdir(n);for(let r of i){let a=r.replace(/_/g,"/").replace(".json","");if(t.test(a))await x.promises.unlink(g.join(n,r))}}async needsRevalidation(t){let n=await this.get(t);if(!n)return!0;return Date.now()>n.revalidateAfter}}async function Et(t){try{let i=(await Bun.file(t).text()).match(/<script\s+server\b[^>]*>([\s\S]*?)<\/script>/i);if(!i)return null;let r=i[1];if(!r.includes("getStaticPaths"))return null;let a=r.match(/(?:export\s+)?(?:async\s+)?function\s+getStaticPaths\s*\([^)]*\)\s*\{([\s\S]*?)\n[\t ]*\}/);if(!a)return null;return await Function(`
4
4
  return (async function getStaticPaths() {
5
5
  ${a[1]}
@@ -9,7 +9,7 @@ import"./chunk-v2x9vzgw.js";import"./chunk-hb08vrbb.js";import"./chunk-7rta163c.
9
9
  ${e[1]}
10
10
  })()
11
11
  `)(n)}catch(e){return console.error(`Error executing getStaticProps in ${i}:`,e),null}}function Ft(t){return/(?:^|[^\w$.])(?:export\s+)?(?:async\s+)?function\s+action\s*\(/.test(t)||/(?:^|[^\w$.])(?:export\s+)?(?:const|let|var)\s+action\s*=/.test(t)}async function ut(t,n,i={},r,a){let e=await Bun.file(t.filePath).text(),l=await Bt(t.filePath),w=await jt(e,n,t.filePath),y={...l||{},...w||{},...i,params:n,$route:{path:t.pattern,params:n}},f=new Set,S=[],P=[],D={...a,...r.partialsDir?{partialsDir:r.partialsDir}:{},...r.componentsDir?{componentsDir:r.componentsDir}:{},debug:!1,cache:!1,autoShell:!0,onIncludeError:(b)=>{S.push(`${g.relative(process.cwd(),b.templatePath)}: ${b.message}
12
- resolved against partialsDir: ${b.partialsDir}`)},onServerScriptError:(b)=>{P.push(`${g.relative(process.cwd(),b.sourcePath)} (${b.kind}): ${b.message}`)}};if(Ft(e))console.warn(`Warning: ${t.pattern} exports a page action, which cannot run in a static build. Its form will submit to a file. Serve this route with the production server, or point the form's action at a route handler.`);let p=await s(e,y,t.filePath,D,f);for(let b of[t.filePath,...f])for(let B of _e(b))f.add(B);if(Object.keys(n).length>0){let b=`<script>if(window.stx)window.stx._rp=${JSON.stringify(n)};else window.__stx_rp=${JSON.stringify(n)};</script>`;if(p.includes("</head>"))p=p.replace("</head>",`${b}
12
+ resolved against partialsDir: ${b.partialsDir}`)},onServerScriptError:(b)=>{P.push(`${g.relative(process.cwd(),b.sourcePath)} (${b.kind}): ${b.message}`)}};if(Ft(e))console.warn(`Warning: ${t.pattern} exports a page action, which cannot run in a static build. Its form will submit to a file. Serve this route with the production server, or point the form's action at a route handler.`);let p=await s(e,y,t.filePath,D,f);for(let b of[t.filePath,...f])for(let B of Ce(b))f.add(B);if(Object.keys(n).length>0){let b=`<script>if(window.stx)window.stx._rp=${JSON.stringify(n)};else window.__stx_rp=${JSON.stringify(n)};</script>`;if(p.includes("</head>"))p=p.replace("</head>",`${b}
13
13
  </head>`);else p=`${b}
14
14
  ${p}`}if(p=await me(p,{router:r.router}),p=await h(p),r.minify!==!1)return{html:Ot(p),dependencies:Array.from(f),includeFailures:S,serverScriptFailures:P};return{html:p,dependencies:Array.from(f),includeFailures:S,serverScriptFailures:P}}function Ot(t){let n=[],i=0,r=/(<script[^>]*>)([\s\S]*?)(<\/script>)/gi,a;while((a=r.exec(t))!==null){let l=t.slice(i,a.index);n.push(l.replace(/<!--(?!\[if)[\s\S]*?-->/g,"").replace(/\s+/g," ").replace(/>\s+</g,"><"));let w=a[1],y=a[2],f=a[3];y=y.replace(/([^:"\\'`])\/\/(?!\/)(?![*!])([^\n]*)/g,"$1"),n.push(w+y+f),i=a.index+a[0].length}let e=t.slice(i);return n.push(e.replace(/<!--(?!\[if)[\s\S]*?-->/g,"").replace(/\s+/g," ").replace(/>\s+</g,"><")),n.join("").trim()}function Tt(t){let n=0;for(let i=0;i<t.length;i++){let r=t.charCodeAt(i);n=(n<<5)-n+r,n=n&n}return`"${Math.abs(n).toString(36)}"`}function At(t,n,i,r){if(i?.sitemap===!1)return!0;if(/<meta[^>]+name=["']robots["'][^>]+content=["'][^"']*noindex/i.test(n))return!0;return r.some((a)=>{if(a instanceof RegExp)return a.test(t);return a.endsWith("/")?t===a.slice(0,-1)||t.startsWith(a):t===a})}function Lt(t,n){return`<?xml version="1.0" encoding="UTF-8"?>
15
15
  <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
@@ -41,10 +41,10 @@ ${t.map((r)=>{let a=new URL(r.loc,n).href,e=` <url>
41
41
  ${i.join(`
42
42
  `)}
43
43
  </channel>
44
- </rss>`}async function Ut(t={}){let n=Date.now();Kt();let i=await o(process.cwd()),r=i.build||{},a=await at({explicit:t.domain||r.domain,stxConfig:i});if(a.source==="fallback"&&(t.sitemap??r.sitemap??!0))console.warn(ot());let e={router:t.router??i?.router??{},pagesDir:t.pagesDir||r.pagesDir||"pages",outputDir:t.outputDir||r.outputDir||"dist",baseUrl:t.baseUrl||r.baseUrl||"/",domain:a.url,revalidate:t.revalidate??r.revalidate??!1,sitemap:t.sitemap??r.sitemap??!0,sitemapExclude:t.sitemapExclude||r.sitemapExclude||[],robots:t.robots??r.robots??!0,rss:t.rss??r.rss??!1,concurrency:t.concurrency||r.concurrency||10,cache:t.cache??r.cache??!0,cacheDir:t.cacheDir||r.cacheDir||c(process.cwd(),"ssg-cache"),contentLoaders:t.contentLoaders||[],hooks:t.hooks||{},minify:t.minify??r.minify??!0,generate404:t.generate404??r.generate404??!0,publicDir:t.publicDir||r.publicDir||"public",trailingSlash:t.trailingSlash??r.trailingSlash??!1,cleanOutput:t.cleanOutput??r.cleanOutput??!0,cacheSalt:t.cacheSalt??"",partialsDir:t.partialsDir||i?.partialsDir||"",componentsDir:t.componentsDir||i?.componentsDir||"",failOnIncludeError:t.failOnIncludeError??!0,failOnServerScriptError:t.failOnServerScriptError??!0,chunkIslands:t.chunkIslands===!0,prefetchIslands:t.prefetchIslands===!0,integrityIslands:t.integrityIslands===!0},l={totalPages:0,successCount:0,failedCount:0,cachedCount:0,buildTime:0,pages:[],errors:[]},w=new Set,y=0,f={},S={};await e.hooks.onBuildStart?.();try{if(e.cleanOutput&&x.existsSync(e.outputDir))await x.promises.rm(e.outputDir,{recursive:!0});await x.promises.mkdir(e.outputDir,{recursive:!0});let D=e.cacheSalt;if(!D){let{resolveUserCssConfig:u,fingerprintConfig:m}=await import("./chunk-em3aepxz.js");try{D=m(await u(process.cwd()))}catch{}}let{prepareImageDelivery:p}=await import("./chunk-vjw3qrqj.js"),b=await p(e.publicDir,e.outputDir);if(b.count>0)console.log(`Optimized ${b.count} image(s) for responsive delivery`),D=[D,b.fingerprint].filter(Boolean).join(":");let B=new ct(e.cacheDir,D);if(e.cache)await B.load();try{let{generateCss:u}=await import("./chunk-em3aepxz.js");await u('<div class="bg-black"></div>')}catch{}vt();let dt=i?.routeMiddleware?.dir||"middleware";await xt(process.cwd(),dt);let z=wt();if(z.length>0)console.log(`Loaded ${z.length} middleware: ${z.join(", ")}`);let gt=i?.routeMiddleware?.global||[];Zi(i?.layoutsDir,c(process.cwd()));let J=V(".",{pagesDir:e.pagesDir,pagesDirs:i?._layerPageDirs});console.log(`Found ${J.length} routes`);let _=[];for(let u of J){let m=await It(u);for(let v of m)_.push({route:u,url:v.url,params:v.params,props:v.props,revalidate:v.revalidate??e.revalidate})}l.totalPages=_.length,console.log(`Generating ${l.totalPages} pages...`);let A=[],K=[];for(let u=0;u<_.length;u+=e.concurrency)K.push(_.slice(u,u+e.concurrency));for(let u of K)await Promise.all(u.map(async(m)=>{let{route:v,url:d,params:L,props:pt,revalidate:Z}=m;try{await e.hooks.onPageStart?.(d);let j=await Bun.file(v.filePath).text(),F=Wt(j),ht=F?.middleware?Array.isArray(F.middleware)?F.middleware:[F.middleware]:[],Q=[...gt,...ht];if(Q.length>0){let C=St(d,L,F||{}),O=kt(C,null,void 0,{isServer:!0}),E=await _t(Q,O);if(E.redirect){let R=typeof E.redirect==="string"?E.redirect:E.redirect.path||E.redirect,U=Jt(String(R),d),T=Vt(d,e);await x.promises.mkdir(g.dirname(T),{recursive:!0}),await Bun.write(T,U),l.successCount++,l.pages.push({route:d,outputPath:T,size:Buffer.byteLength(U),cached:!1}),A.push({loc:d,lastmod:new Date().toISOString()}),console.log(` \u21B3 ${d} \u2192 redirect to ${R}`);return}if(E.abort){let R=typeof E.abort==="string"?E.abort:E.abort?.error?.message||"aborted";console.warn(` \u21B3 ${d} \u2014 middleware aborted: ${R}`);return}}let tt=j.match(/definePageMeta\s*\(\s*\{[\s\S]*?validate\s*:\s*((?:\([^)]*\)|[^,}])*(?:\{[\s\S]*?\})?)/m);if(tt)try{if(!await Function("route",`
44
+ </rss>`}async function Ut(t={}){let n=Date.now();Kt();let i=await o(process.cwd()),r=i.build||{},a=await at({explicit:t.domain||r.domain,stxConfig:i});if(a.source==="fallback"&&(t.sitemap??r.sitemap??!0))console.warn(ot());let e={router:t.router??i?.router??{},pagesDir:t.pagesDir||r.pagesDir||"pages",outputDir:t.outputDir||r.outputDir||"dist",baseUrl:t.baseUrl||r.baseUrl||"/",domain:a.url,revalidate:t.revalidate??r.revalidate??!1,sitemap:t.sitemap??r.sitemap??!0,sitemapExclude:t.sitemapExclude||r.sitemapExclude||[],robots:t.robots??r.robots??!0,rss:t.rss??r.rss??!1,concurrency:t.concurrency||r.concurrency||10,cache:t.cache??r.cache??!0,cacheDir:t.cacheDir||r.cacheDir||c(process.cwd(),"ssg-cache"),contentLoaders:t.contentLoaders||[],hooks:t.hooks||{},minify:t.minify??r.minify??!0,generate404:t.generate404??r.generate404??!0,publicDir:t.publicDir||r.publicDir||"public",trailingSlash:t.trailingSlash??r.trailingSlash??!1,cleanOutput:t.cleanOutput??r.cleanOutput??!0,cacheSalt:t.cacheSalt??"",partialsDir:t.partialsDir||i?.partialsDir||"",componentsDir:t.componentsDir||i?.componentsDir||"",failOnIncludeError:t.failOnIncludeError??!0,failOnServerScriptError:t.failOnServerScriptError??!0,chunkIslands:t.chunkIslands===!0,prefetchIslands:t.prefetchIslands===!0,integrityIslands:t.integrityIslands===!0},l={totalPages:0,successCount:0,failedCount:0,cachedCount:0,buildTime:0,pages:[],errors:[]},w=new Set,y=0,f={},S={};await e.hooks.onBuildStart?.();try{if(e.cleanOutput&&x.existsSync(e.outputDir))await x.promises.rm(e.outputDir,{recursive:!0});await x.promises.mkdir(e.outputDir,{recursive:!0});let D=e.cacheSalt;if(!D){let{resolveUserCssConfig:u,fingerprintConfig:m}=await import("./chunk-8kskjg62.js");try{D=m(await u(process.cwd()))}catch{}}let{prepareImageDelivery:p}=await import("./chunk-6tngeb4b.js"),b=await p(e.publicDir,e.outputDir);if(b.count>0)console.log(`Optimized ${b.count} image(s) for responsive delivery`),D=[D,b.fingerprint].filter(Boolean).join(":");let B=new ct(e.cacheDir,D);if(e.cache)await B.load();try{let{generateCss:u}=await import("./chunk-8kskjg62.js");await u('<div class="bg-black"></div>')}catch{}wt();let dt=i?.routeMiddleware?.dir||"middleware";await St(process.cwd(),dt);let z=xt();if(z.length>0)console.log(`Loaded ${z.length} middleware: ${z.join(", ")}`);let pt=i?.routeMiddleware?.global||[];Zi(i?.layoutsDir,c(process.cwd()));let J=V(".",{pagesDir:e.pagesDir,pagesDirs:i?._layerPageDirs});console.log(`Found ${J.length} routes`);let _=[];for(let u of J){let m=await It(u);for(let v of m)_.push({route:u,url:v.url,params:v.params,props:v.props,revalidate:v.revalidate??e.revalidate})}l.totalPages=_.length,console.log(`Generating ${l.totalPages} pages...`);let A=[],K=[];for(let u=0;u<_.length;u+=e.concurrency)K.push(_.slice(u,u+e.concurrency));for(let u of K)await Promise.all(u.map(async(m)=>{let{route:v,url:d,params:L,props:ht,revalidate:Z}=m;try{await e.hooks.onPageStart?.(d);let j=await Bun.file(v.filePath).text(),F=Wt(j),ft=F?.middleware?Array.isArray(F.middleware)?F.middleware:[F.middleware]:[],Q=[...pt,...ft];if(Q.length>0){let C=kt(d,L,F||{}),O=_t(C,null,void 0,{isServer:!0}),E=await Ct(Q,O);if(E.redirect){let R=typeof E.redirect==="string"?E.redirect:E.redirect.path||E.redirect,U=Jt(String(R),d),T=Vt(d,e);await x.promises.mkdir(g.dirname(T),{recursive:!0}),await Bun.write(T,U),l.successCount++,l.pages.push({route:d,outputPath:T,size:Buffer.byteLength(U),cached:!1}),A.push({loc:d,lastmod:new Date().toISOString()}),console.log(` \u21B3 ${d} \u2192 redirect to ${R}`);return}if(E.abort){let R=typeof E.abort==="string"?E.abort:E.abort?.error?.message||"aborted";console.warn(` \u21B3 ${d} \u2014 middleware aborted: ${R}`);return}}let tt=j.match(/definePageMeta\s*\(\s*\{[\s\S]*?validate\s*:\s*((?:\([^)]*\)|[^,}])*(?:\{[\s\S]*?\})?)/m);if(tt)try{if(!await Function("route",`
45
45
  const validate = ${tt[1]};
46
46
  return validate(route);
47
- `)({params:L})){console.warn(`Validation failed for ${d}, skipping...`);return}}catch{}let k=null,et=!1;if(e.cache){if(k=B.get(d,v.filePath),k)et=!0,l.cachedCount++}if(!k){let C=await ut(v,L,pt,e,i);if(k=C.html,e.failOnIncludeError&&C.includeFailures.length>0)throw Error(`${C.includeFailures.length} include(s) failed to resolve, so this page would have shipped with an error banner where the markup should be:
47
+ `)({params:L})){console.warn(`Validation failed for ${d}, skipping...`);return}}catch{}let k=null,et=!1;if(e.cache){if(k=B.get(d,v.filePath),k)et=!0,l.cachedCount++}if(!k){let C=await ut(v,L,ht,e,i);if(k=C.html,e.failOnIncludeError&&C.includeFailures.length>0)throw Error(`${C.includeFailures.length} include(s) failed to resolve, so this page would have shipped with an error banner where the markup should be:
48
48
  ${C.includeFailures.join(`
49
49
  `)}
50
50
  Set ssg.failOnIncludeError to false to build anyway.`);if(e.failOnServerScriptError&&C.serverScriptFailures.length>0)throw Error(`${C.serverScriptFailures.length} <script server> block(s) failed, so this page would have shipped with the content they produce missing:
@@ -82,7 +82,7 @@ Build complete!
82
82
  Failed: ${l.failedCount}
83
83
  Time: ${l.buildTime}ms${P}
84
84
  `),l}async function q(t,n){await x.promises.mkdir(n,{recursive:!0});let i=await x.promises.readdir(t,{withFileTypes:!0});for(let r of i){let a=g.join(t,r.name),e=g.join(n,r.name);if(r.isDirectory())await x.promises.mkdir(e,{recursive:!0}),await q(a,e);else await x.promises.copyFile(a,e)}}function Nt(t={}){let n=t.cacheDir||c(process.cwd(),"ssg-cache"),i=new lt(n),r=t.revalidate||3600;return{async get(a){let e=await i.get(a);if(!e)return null;if(Date.now()>e.revalidateAfter)this.revalidate(a).catch(console.error);return{html:e.html,headers:{"Cache-Control":`public, max-age=${r}, stale-while-revalidate=${r*2}`,ETag:e.etag,"X-ISR-Generated":new Date(e.generatedAt).toISOString(),...e.headers}}},async revalidate(a){let l=V(".",{pagesDir:t.pagesDir||"pages"}).find((P)=>a.match(P.regex)!==null);if(!l){console.warn(`Route not found for revalidation: ${a}`);return}let w=a.match(l.regex),y={};if(w)l.params.forEach((P,D)=>{y[P]=w[D+1]});let f=await o(),{html:S}=await ut(l,y,{},t,f);await i.set(a,{html:S,generatedAt:Date.now(),revalidateAfter:Date.now()+r*1000,etag:Tt(S)}),console.log(`Revalidated: ${a}`)},async invalidate(a){if(typeof a==="string")await i.invalidate(a);else await i.invalidatePattern(a)}}}function zt(t){return async()=>({paths:await t(),fallback:!1})}function Ht(){return{name:"markdown",extensions:[".md",".mdx"],async load(t){let n=await Bun.file(t).text(),i=n.match(/^---\n([\s\S]*?)\n---/),r={},a=n;if(i){let f=i[1];a=n.slice(i[0].length).trim();for(let S of f.split(`
85
- `)){let P=S.indexOf(":");if(P>0){let D=S.slice(0,P).trim(),p=S.slice(P+1).trim();if(p==="true")p=!0;else if(p==="false")p=!1;else if(/^\d+$/.test(p))p=parseInt(p,10);else if(/^\d+\.\d+$/.test(p))p=parseFloat(p);else if(p.startsWith("[")&&p.endsWith("]"))p=p.slice(1,-1).split(",").map((b)=>b.trim().replace(/^['"]|['"]$/g,""));r[D]=p}}}let e=a.replace(/^### (.*$)/gim,"<h3>$1</h3>").replace(/^## (.*$)/gim,"<h2>$1</h2>").replace(/^# (.*$)/gim,"<h1>$1</h1>").replace(/\*\*(.*)\*\*/gim,"<strong>$1</strong>").replace(/\*(.*)\*/gim,"<em>$1</em>").replace(/`([^`]+)`/gim,"<code>$1</code>").replace(/\[([^\]]+)\]\(([^)]+)\)/gim,'<a href="$2">$1</a>').replace(/\n/gim,"<br>"),l=[],w=/<h([1-6])>([^<]+)<\/h[1-6]>/gi,y;while((y=w.exec(e))!==null){let f=parseInt(y[1],10),S=y[2],P=S.toLowerCase().replace(/[^a-z0-9]+/g,"-");l.push({id:P,text:S,level:f})}return{content:e,data:r,toc:l}}}}function Wt(t){return ft(t)}function Jt(t,n){return`<!DOCTYPE html>
85
+ `)){let P=S.indexOf(":");if(P>0){let D=S.slice(0,P).trim(),p=S.slice(P+1).trim();if(p==="true")p=!0;else if(p==="false")p=!1;else if(/^\d+$/.test(p))p=parseInt(p,10);else if(/^\d+\.\d+$/.test(p))p=parseFloat(p);else if(p.startsWith("[")&&p.endsWith("]"))p=p.slice(1,-1).split(",").map((b)=>b.trim().replace(/^['"]|['"]$/g,""));r[D]=p}}}let e=a.replace(/^### (.*$)/gim,"<h3>$1</h3>").replace(/^## (.*$)/gim,"<h2>$1</h2>").replace(/^# (.*$)/gim,"<h1>$1</h1>").replace(/\*\*(.*)\*\*/gim,"<strong>$1</strong>").replace(/\*(.*)\*/gim,"<em>$1</em>").replace(/`([^`]+)`/gim,"<code>$1</code>").replace(/\[([^\]]+)\]\(([^)]+)\)/gim,'<a href="$2">$1</a>').replace(/\n/gim,"<br>"),l=[],w=/<h([1-6])>([^<]+)<\/h[1-6]>/gi,y;while((y=w.exec(e))!==null){let f=parseInt(y[1],10),S=y[2],P=S.toLowerCase().replace(/[^a-z0-9]+/g,"-");l.push({id:P,text:S,level:f})}return{content:e,data:r,toc:l}}}}function Wt(t){return gt(t)}function Jt(t,n){return`<!DOCTYPE html>
86
86
  <html>
87
87
  <head>
88
88
  <meta charset="utf-8">
package/dist/utils.js CHANGED
@@ -952,7 +952,7 @@ export async function renderComponentWithSlot(componentPath, props, slotContent,
952
952
  ...slot,
953
953
  content: projectRefs(slot.content)
954
954
  }]));
955
- templateContent = await applySlots(templateContent, projectRefs(defaultSlot), projectedSlots, componentContext);
955
+ templateContent = await applySlots(templateContent, projectRefs(defaultSlot), projectedSlots, componentContext, hasSignalScripts ? componentUid : "");
956
956
  const clientSignalNames = componentClientSignalNames(clientScripts), inheritedClientSignalNames = (Array.isArray(componentContext.__stx_client_signal_names) ? componentContext.__stx_client_signal_names : []).filter((name) => !ownServerNames.has(name));
957
957
  if (clientSignalNames.length > 0 || inheritedClientSignalNames.length > 0)
958
958
  componentContext.__stx_client_signal_names = [...new Set([...inheritedClientSignalNames, ...clientSignalNames])];
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@stacksjs/stx",
3
3
  "type": "module",
4
- "version": "0.2.665",
4
+ "version": "0.2.668",
5
5
  "description": "A performant UI Framework. Powered by Bun.",
6
6
  "author": "Chris Breuer <chris@stacksjs.org>",
7
7
  "license": "MIT",
@@ -128,12 +128,12 @@
128
128
  "dependencies": {
129
129
  "@stacksjs/ts-css": "^0.3.11",
130
130
  "@stacksjs/clapp": "^0.2.16",
131
- "@stacksjs/desktop": "0.2.665",
132
- "@stacksjs/sanitizer": "0.2.665",
131
+ "@stacksjs/desktop": "0.2.668",
132
+ "@stacksjs/sanitizer": "0.2.668",
133
133
  "@stacksjs/ts-i18n": "^0.1.11",
134
- "bun-plugin-stx": "0.2.665",
134
+ "bun-plugin-stx": "0.2.668",
135
135
  "bunfig": "^0.15.21",
136
- "stx-router": "0.2.665",
136
+ "stx-router": "0.2.668",
137
137
  "ts-broadcasting": "^0.0.11",
138
138
  "ts-images": "^0.2.22",
139
139
  "ts-syntax-highlighter": "^0.2.1"