resuxjs 0.4.0-beta.7 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (185) hide show
  1. package/README.md +4 -2
  2. package/dist/_virtual/_rolldown/runtime.js +4 -0
  3. package/dist/build/index.d.ts +1 -2
  4. package/dist/cli.d.ts +3 -3
  5. package/dist/cli.js +125 -31
  6. package/dist/cli.js.map +1 -1
  7. package/dist/compiler/adapter.d.ts +2 -3
  8. package/dist/compiler/adapter.js +2 -2
  9. package/dist/compiler/dev-warnings.d.ts +1 -2
  10. package/dist/compiler/directives.d.ts +1 -2
  11. package/dist/compiler/directives.js +7 -3
  12. package/dist/compiler/directives.js.map +1 -1
  13. package/dist/compiler/implementation.d.ts +4 -2
  14. package/dist/compiler/implementation.js +101 -43
  15. package/dist/compiler/index.d.ts +2 -3
  16. package/dist/compiler/index.js +2 -2
  17. package/dist/compiler/index.js.map +1 -1
  18. package/dist/core/config.d.ts +1 -2
  19. package/dist/core/hooks.d.ts +10 -2
  20. package/dist/core/hooks.js.map +1 -1
  21. package/dist/core/index.d.ts +2 -2
  22. package/dist/core/module-container.d.ts +1 -2
  23. package/dist/core/module-container.js +2 -1
  24. package/dist/core/module-container.js.map +1 -1
  25. package/dist/core/resux.d.ts +1 -2
  26. package/dist/create.d.ts +1 -2
  27. package/dist/create.js +110 -33
  28. package/dist/create.js.map +1 -1
  29. package/dist/deploy/cloudflare.d.ts +1 -2
  30. package/dist/deploy/common.d.ts +1 -2
  31. package/dist/deploy/common.js +19 -3
  32. package/dist/deploy/common.js.map +1 -1
  33. package/dist/deploy/framework-runtime.d.ts +1 -2
  34. package/dist/deploy/index.d.ts +1 -2
  35. package/dist/deploy/netlify.d.ts +1 -2
  36. package/dist/deploy/node.d.ts +1 -2
  37. package/dist/deploy/production-report.d.ts +1 -2
  38. package/dist/deploy/runtime-dependencies.d.ts +1 -2
  39. package/dist/deploy/static.d.ts +1 -2
  40. package/dist/deploy/types.d.ts +1 -2
  41. package/dist/deploy/vercel.d.ts +1 -2
  42. package/dist/deploy/vercel.js +3 -3
  43. package/dist/deploy/vercel.js.map +1 -1
  44. package/dist/fonts/index.d.ts +1 -2
  45. package/dist/fonts/index.js.map +1 -1
  46. package/dist/globals.d.ts +1 -2
  47. package/dist/halal-core/ai/classifyProject.d.ts +1 -2
  48. package/dist/halal-core/ai/classifyRuntimeContent.d.ts +1 -2
  49. package/dist/halal-core/ai/createProjectSummary.d.ts +1 -2
  50. package/dist/halal-core/ai/halalClassifierPrompt.d.ts +1 -2
  51. package/dist/halal-core/ai/redactSensitiveData.d.ts +1 -2
  52. package/dist/halal-core/ai/validateAiResponse.d.ts +1 -2
  53. package/dist/halal-core/cli/check.d.ts +1 -2
  54. package/dist/halal-core/cli/explain.d.ts +1 -2
  55. package/dist/halal-core/cli/report.d.ts +1 -2
  56. package/dist/halal-core/cli/submitReview.d.ts +1 -2
  57. package/dist/halal-core/cli/verifyReview.d.ts +1 -2
  58. package/dist/halal-core/config.d.ts +2 -2
  59. package/dist/halal-core/config.js.map +1 -1
  60. package/dist/halal-core/crypto/integrity.d.ts +1 -2
  61. package/dist/halal-core/crypto/integrity.js +1 -1
  62. package/dist/halal-core/crypto/integrity.js.map +1 -1
  63. package/dist/halal-core/enforce.d.ts +4 -3
  64. package/dist/halal-core/enforce.js +31 -4
  65. package/dist/halal-core/enforce.js.map +1 -1
  66. package/dist/halal-core/lifecycle.d.ts +1 -2
  67. package/dist/halal-core/policy.d.ts +1 -2
  68. package/dist/halal-core/report/formatBrowserOverlay.d.ts +1 -2
  69. package/dist/halal-core/report/formatTerminalReport.d.ts +1 -2
  70. package/dist/halal-core/report/generateHalalReport.d.ts +1 -2
  71. package/dist/halal-core/report/signReport.d.ts +1 -2
  72. package/dist/halal-core/report/verifyReport.d.ts +1 -2
  73. package/dist/halal-core/review/createReviewRequest.d.ts +1 -2
  74. package/dist/halal-core/review/reviewPolicy.d.ts +1 -2
  75. package/dist/halal-core/review/signedReviewFile.d.ts +1 -2
  76. package/dist/halal-core/review/verifyReviewApproval.d.ts +1 -2
  77. package/dist/halal-core/rules/adultContentRules.d.ts +1 -2
  78. package/dist/halal-core/rules/alcoholDrugVapeRules.d.ts +1 -2
  79. package/dist/halal-core/rules/childSafetyRules.d.ts +1 -2
  80. package/dist/halal-core/rules/coreCategories.d.ts +1 -2
  81. package/dist/halal-core/rules/cyberAbuseRules.d.ts +1 -2
  82. package/dist/halal-core/rules/defaultBlockedRules.d.ts +1 -2
  83. package/dist/halal-core/rules/dependencyRules.d.ts +1 -2
  84. package/dist/halal-core/rules/endpointRules.d.ts +1 -2
  85. package/dist/halal-core/rules/environmentalHarmRules.d.ts +1 -2
  86. package/dist/halal-core/rules/financeRibaRules.d.ts +1 -2
  87. package/dist/halal-core/rules/gamblingRules.d.ts +1 -2
  88. package/dist/halal-core/rules/generalHarmRules.d.ts +1 -2
  89. package/dist/halal-core/rules/healthHarmRules.d.ts +1 -2
  90. package/dist/halal-core/rules/keywordRules.d.ts +1 -2
  91. package/dist/halal-core/rules/privacyAbuseRules.d.ts +1 -2
  92. package/dist/halal-core/rules/scamFraudRules.d.ts +1 -2
  93. package/dist/halal-core/rules/selfHarmRules.d.ts +1 -2
  94. package/dist/halal-core/rules/violenceExtremismRules.d.ts +1 -2
  95. package/dist/halal-core/runtime/guard.d.ts +1 -2
  96. package/dist/halal-core/runtime/guard.js.map +1 -1
  97. package/dist/halal-core/runtime/reviewedMemory.d.ts +1 -2
  98. package/dist/halal-core/runtime/serializeRuntimeContent.d.ts +1 -2
  99. package/dist/halal-core/runtime/types.d.ts +1 -2
  100. package/dist/halal-core/scanner/scanApiRoutes.d.ts +1 -2
  101. package/dist/halal-core/scanner/scanComponents.d.ts +1 -2
  102. package/dist/halal-core/scanner/scanContent.d.ts +1 -2
  103. package/dist/halal-core/scanner/scanDependencies.d.ts +1 -2
  104. package/dist/halal-core/scanner/scanDomains.d.ts +1 -2
  105. package/dist/halal-core/scanner/scanEnvNames.d.ts +1 -2
  106. package/dist/halal-core/scanner/scanMetadata.d.ts +1 -2
  107. package/dist/halal-core/scanner/scanPages.d.ts +1 -2
  108. package/dist/halal-core/scanner/scanProject.d.ts +1 -2
  109. package/dist/halal-core/scanner/scanRoutes.d.ts +1 -2
  110. package/dist/halal-core/scanner/scanTranslations.d.ts +1 -2
  111. package/dist/halal-core/status.d.ts +1 -2
  112. package/dist/halal-core/tamper/verifyCoreIntegrity.d.ts +1 -2
  113. package/dist/halal-core/tamper/verifyLifecycleHooks.d.ts +1 -2
  114. package/dist/halal-core/tamper/verifyReportSignature.d.ts +1 -2
  115. package/dist/head/utils.d.ts +15 -0
  116. package/dist/head/utils.js +52 -0
  117. package/dist/head/utils.js.map +1 -0
  118. package/dist/i18n/index.d.ts +1 -2
  119. package/dist/i18n/index.js.map +1 -1
  120. package/dist/i18n/shared.d.ts +1 -2
  121. package/dist/icons/api-fetcher.d.ts +1 -2
  122. package/dist/icons/cache.d.ts +1 -2
  123. package/dist/icons/cache.js.map +1 -1
  124. package/dist/icons/component.d.ts +7 -8
  125. package/dist/icons/constants.d.ts +1 -2
  126. package/dist/icons/css-mode.d.ts +1 -2
  127. package/dist/icons/index.d.ts +1 -2
  128. package/dist/icons/index.js.map +1 -1
  129. package/dist/icons/local-svg.d.ts +1 -2
  130. package/dist/icons/normalize.d.ts +1 -2
  131. package/dist/icons/offline-loader.d.ts +1 -2
  132. package/dist/icons/parser.d.ts +1 -2
  133. package/dist/icons/registry.d.ts +1 -2
  134. package/dist/icons/resolver.d.ts +1 -2
  135. package/dist/icons/svg-mode.d.ts +1 -2
  136. package/dist/icons/transform.d.ts +1 -2
  137. package/dist/icons/types.d.ts +1 -2
  138. package/dist/index.d.ts +2 -2
  139. package/dist/index.js +2 -2
  140. package/dist/kit/index.d.ts +1 -2
  141. package/dist/nitro-server/index.d.ts +1 -2
  142. package/dist/node.d.ts +1 -2
  143. package/dist/reactivity/computed.d.ts +1 -2
  144. package/dist/reactivity/computed.js.map +1 -1
  145. package/dist/reactivity/effect.d.ts +3 -3
  146. package/dist/reactivity/effect.js +8 -3
  147. package/dist/reactivity/effect.js.map +1 -1
  148. package/dist/reactivity/reactive.d.ts +1 -2
  149. package/dist/reactivity/reactive.js +221 -11
  150. package/dist/reactivity/reactive.js.map +1 -1
  151. package/dist/reactivity/ref.d.ts +1 -2
  152. package/dist/reactivity/ref.js.map +1 -1
  153. package/dist/reactivity/scheduler.d.ts +1 -2
  154. package/dist/reactivity/scheduler.js +2 -0
  155. package/dist/reactivity/scheduler.js.map +1 -1
  156. package/dist/reactivity/types.d.ts +1 -2
  157. package/dist/reactivity/utils.d.ts +1 -2
  158. package/dist/reactivity/watch.d.ts +1 -2
  159. package/dist/reactivity/watch.js.map +1 -1
  160. package/dist/runtime/core.d.ts +1 -2
  161. package/dist/runtime/core.js.map +1 -1
  162. package/dist/runtime/index.d.ts +19 -2
  163. package/dist/runtime/index.js +921 -170
  164. package/dist/runtime/index.js.map +1 -1
  165. package/dist/runtime/resume.d.ts +1 -2
  166. package/dist/runtime/resume.js.map +1 -1
  167. package/dist/runtime/router.d.ts +1 -2
  168. package/dist/runtime/router.js.map +1 -1
  169. package/dist/runtime/streaming.d.ts +1 -2
  170. package/dist/runtime/streaming.js.map +1 -1
  171. package/dist/runtime/view-transitions/detect.d.ts +1 -2
  172. package/dist/runtime/view-transitions/transition.d.ts +1 -2
  173. package/dist/runtime/view-transitions/types.d.ts +1 -2
  174. package/dist/security/media-fetch.d.ts +1 -2
  175. package/dist/security/media-fetch.js.map +1 -1
  176. package/dist/security/path-boundary.d.ts +1 -2
  177. package/dist/security/path-boundary.js +10 -4
  178. package/dist/security/path-boundary.js.map +1 -1
  179. package/dist/ui/index.d.ts +41 -42
  180. package/dist/ui/verification-code.d.ts +9 -10
  181. package/dist/ui/verification-code.js.map +1 -1
  182. package/dist/vite-builder/index.d.ts +1 -2
  183. package/package.json +2 -2
  184. package/templates/default/.env.example +3 -0
  185. package/templates/default/nitro.config.ts +16 -4
@@ -1,4 +1,5 @@
1
1
  import { iconRegistry } from "../icons/registry.js";
2
+ import { cspDirectiveSources, dedupeHeadScripts } from "../head/utils.js";
2
3
  import { buildLocalePath, normalizeI18nRuntimeConfig, resolveI18nRoute, resolveLocaleDirection, resolveLocalizedValue, translateRaw, translateText } from "../i18n/shared.js";
3
4
  import { computed } from "../reactivity/computed.js";
4
5
  import { isReactive, isReadonly, reactive, readonly } from "../reactivity/reactive.js";
@@ -1023,35 +1024,8 @@ function getClientRuntimeBootPlan(result) {
1023
1024
  function shouldLoadClientRuntime(result) {
1024
1025
  return getClientRuntimeBootPlan(result).mode !== "none";
1025
1026
  }
1026
- function renderDocument(result, title = "Resux App", options = {}) {
1027
- const bootPlan = getClientRuntimeBootPlan(result);
1028
- const needsClientRuntime = bootPlan.mode !== "none";
1029
- const payload = needsClientRuntime ? escapeJsonForHtml(JSON.stringify(result.payload)) : "";
1030
- const resumeBootstrap = bootPlan.mode === "interaction" ? getResumeBootstrapSource({
1031
- eventNames: bootPlan.eventNames,
1032
- deferEnhancements: bootPlan.deferEnhancements,
1033
- deferVueIslands: bootPlan.deferVueIslands
1034
- }) : "";
1035
- const mergedHead = mergeHead([{ title }, result.head]);
1036
- const hasExplicitCharset = (mergedHead.meta ?? []).some((meta) => meta.charset !== void 0);
1037
- const hasExplicitViewport = (mergedHead.meta ?? []).some((meta) => typeof meta.name === "string" && meta.name.toLowerCase() === "viewport");
1038
- const htmlAttrs = {
1039
- lang: "en",
1040
- ...mergedHead.htmlAttrs ?? {}
1041
- };
1042
- const renderedBodyAttrs = renderAttributes(mergedHead.bodyAttrs ?? {});
1043
- const bodyOpenTag = renderedBodyAttrs ? `<body ${renderedBodyAttrs}>` : "<body>";
1044
- const defaultTeleportHtml = result.teleports?.["#teleports"] ?? "";
1045
- const renderedAppHtml = result.html;
1046
- const defaultTeleportTarget = `<div id="teleports" data-rx-teleport-fallback="true">${defaultTeleportHtml}</div>`;
1047
- return [
1048
- "<!doctype html>",
1049
- `<html ${renderAttributes(htmlAttrs)}>`,
1050
- "<head>",
1051
- ...hasExplicitCharset ? [] : ["<meta charset=\"utf-8\">"],
1052
- ...hasExplicitViewport ? [] : ["<meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">"],
1053
- renderHead(mergedHead),
1054
- `<style>
1027
+ function getBuiltinFrameworkStyles(nonce) {
1028
+ return `<style${nonce ? ` nonce="${escapeAttribute(nonce)}"` : ""}>
1055
1029
  [data-rx-block] {
1056
1030
  display: contents !important;
1057
1031
  }
@@ -1350,20 +1324,89 @@ html[dir="rtl"] [data-rx-loading-indicator] .rx-loading-progress {
1350
1324
  transition: none;
1351
1325
  }
1352
1326
  }
1353
- </style>`,
1354
- "</head>",
1355
- bodyOpenTag,
1327
+ </style>`;
1328
+ }
1329
+ function createDefaultHtmlContext(result, title = "Resux App", options = {}) {
1330
+ const bootPlan = getClientRuntimeBootPlan(result);
1331
+ const needsClientRuntime = bootPlan.mode !== "none";
1332
+ const payload = needsClientRuntime ? escapeJsonForHtml(JSON.stringify(result.payload)) : "";
1333
+ const resumeBootstrap = bootPlan.mode === "interaction" ? getResumeBootstrapSource({
1334
+ eventNames: bootPlan.eventNames,
1335
+ deferEnhancements: bootPlan.deferEnhancements,
1336
+ deferVueIslands: bootPlan.deferVueIslands
1337
+ }) : "";
1338
+ const mergedHead = mergeHead([{ title }, result.head]);
1339
+ const hasExplicitCharset = (mergedHead.meta ?? []).some((meta) => meta.charset !== void 0);
1340
+ const hasExplicitViewport = (mergedHead.meta ?? []).some((meta) => typeof meta.name === "string" && meta.name.toLowerCase() === "viewport");
1341
+ const csp = options.csp ?? extractCspFromHead(mergedHead);
1342
+ const nonce = options.nonce ?? (result.payload?.config)?.resuxSecurity?.nonce;
1343
+ const renderedHtmlAttrs = renderAttributes({
1344
+ lang: "en",
1345
+ ...mergedHead.htmlAttrs ?? {}
1346
+ });
1347
+ const renderedBodyAttrs = renderAttributes(mergedHead.bodyAttrs ?? {});
1348
+ const defaultTeleportHtml = result.teleports?.["#teleports"] ?? "";
1349
+ const renderedAppHtml = result.html;
1350
+ const defaultTeleportTarget = `<div id="teleports" data-rx-teleport-fallback="true">${defaultTeleportHtml}</div>`;
1351
+ const headElements = [
1352
+ ...hasExplicitCharset ? [] : ["<meta charset=\"utf-8\">"],
1353
+ ...hasExplicitViewport ? [] : ["<meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">"],
1354
+ renderHead(mergedHead, {
1355
+ nonce,
1356
+ csp
1357
+ }),
1358
+ getBuiltinFrameworkStyles(nonce)
1359
+ ];
1360
+ const bodyElements = [
1356
1361
  "<div id=\"__resux\">",
1357
1362
  renderedAppHtml,
1358
1363
  "</div>",
1359
1364
  defaultTeleportTarget,
1360
1365
  needsClientRuntime ? options.isStatic || typeof process !== "undefined" && process.env?.RESUX_STATIC ? `<script>window.__RESUX__=${payload};window.__RESUX_STATIC__=true;<\/script>` : `<script>window.__RESUX__=${payload}<\/script>` : "",
1361
1366
  options.devReload ? getDevReloadScript() : "",
1362
- bootPlan.mode === "eager" ? "<script type=\"module\" src=\"/__resux/runtime-client.mjs\"><\/script>" : bootPlan.mode === "interaction" ? `<script type="module">${resumeBootstrap}<\/script>` : "",
1367
+ bootPlan.mode === "eager" ? "<script type=\"module\" src=\"/__resux/runtime-client.mjs\"><\/script>" : bootPlan.mode === "interaction" ? `<script type="module">${resumeBootstrap}<\/script>` : ""
1368
+ ];
1369
+ return {
1370
+ htmlAttrs: renderedHtmlAttrs ? [renderedHtmlAttrs] : [],
1371
+ head: headElements,
1372
+ bodyPrepend: [],
1373
+ body: bodyElements,
1374
+ bodyAppend: [],
1375
+ bodyAttrs: renderedBodyAttrs ? [renderedBodyAttrs] : []
1376
+ };
1377
+ }
1378
+ function assembleHtmlDocument(htmlContext) {
1379
+ const htmlOpen = htmlContext.htmlAttrs.length ? `<html ${htmlContext.htmlAttrs.join(" ")}>` : "<html>";
1380
+ const bodyOpen = htmlContext.bodyAttrs.length ? `<body ${htmlContext.bodyAttrs.join(" ")}>` : "<body>";
1381
+ return [
1382
+ "<!doctype html>",
1383
+ htmlOpen,
1384
+ "<head>",
1385
+ ...htmlContext.head,
1386
+ "</head>",
1387
+ bodyOpen,
1388
+ ...htmlContext.bodyPrepend,
1389
+ ...htmlContext.body,
1390
+ ...htmlContext.bodyAppend,
1363
1391
  "</body>",
1364
1392
  "</html>"
1365
1393
  ].join("");
1366
1394
  }
1395
+ function renderDocument(result, title = "Resux App", options = {}) {
1396
+ const htmlContext = createDefaultHtmlContext(result, title, options);
1397
+ if (options.hooks) {
1398
+ const hookResult = options.hooks.callHook("render:html", htmlContext);
1399
+ if (hookResult && typeof hookResult.catch === "function") hookResult.catch((err) => {
1400
+ console.error("[resux] Error in render:html hook:", err);
1401
+ });
1402
+ }
1403
+ return assembleHtmlDocument(htmlContext);
1404
+ }
1405
+ async function renderDocumentAsync(result, title = "Resux App", options = {}) {
1406
+ const htmlContext = createDefaultHtmlContext(result, title, options);
1407
+ if (options.hooks) await options.hooks.callHook("render:html", htmlContext);
1408
+ return assembleHtmlDocument(htmlContext);
1409
+ }
1367
1410
  function getDevReloadScript() {
1368
1411
  return `<script type="module">
1369
1412
  if (typeof EventSource !== "undefined" && !window.__RESUX_DEV_RELOAD__) {
@@ -1379,6 +1422,34 @@ if (typeof EventSource !== "undefined" && !window.__RESUX_DEV_RELOAD__) {
1379
1422
  });
1380
1423
  events.addEventListener("reload", () => window.location.reload());
1381
1424
  }
1425
+ if (typeof window !== "undefined") {
1426
+ const checkStylesheets = () => {
1427
+ document.querySelectorAll('link[rel="stylesheet"]').forEach((link) => {
1428
+ const href = link.getAttribute("href");
1429
+ if (!href) return;
1430
+ link.addEventListener("error", () => {
1431
+ console.warn(\`[resux] Warning: Stylesheet "\${href}" failed to load.\`);
1432
+ });
1433
+ if ((!href.startsWith("http://") && !href.startsWith("https://") && !href.startsWith("//")) || href.startsWith(window.location.origin)) {
1434
+ fetch(href, { method: "HEAD" }).then((res) => {
1435
+ if (!res.ok) {
1436
+ console.warn(\`[resux] Warning: Stylesheet "\${href}" failed with HTTP \${res.status}.\`);
1437
+ return;
1438
+ }
1439
+ const ct = res.headers.get("content-type") || "";
1440
+ if (ct && !ct.includes("text/css")) {
1441
+ console.warn(\`[resux] Warning: Stylesheet "\${href}" returned non-CSS Content-Type: "\${ct}". Expected "text/css".\`);
1442
+ }
1443
+ }).catch(() => {});
1444
+ }
1445
+ });
1446
+ };
1447
+ if (document.readyState === "loading") {
1448
+ window.addEventListener("DOMContentLoaded", checkStylesheets);
1449
+ } else {
1450
+ checkStylesheets();
1451
+ }
1452
+ }
1382
1453
  <\/script>`;
1383
1454
  }
1384
1455
  function normalizeComponentRegistryKey(key, apiName) {
@@ -2156,8 +2227,11 @@ function resolveComponentDefinition(tag, components) {
2156
2227
  if (lowerName === lowerTag || lowerName.endsWith(lowerTag)) return component;
2157
2228
  }
2158
2229
  }
2230
+ function normalizeTransitionBoundaryTagName(tag) {
2231
+ return String(tag || "").replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
2232
+ }
2159
2233
  function isTransitionBoundaryTag(tag) {
2160
- const normalized = String(tag || "").toLowerCase();
2234
+ const normalized = normalizeTransitionBoundaryTagName(tag);
2161
2235
  return normalized === "transition" || normalized === "transition-group";
2162
2236
  }
2163
2237
  const unsafeTransitionContainerTags = /* @__PURE__ */ new Set([
@@ -2194,7 +2268,7 @@ function transitionBoundaryName(node, context, locals) {
2194
2268
  return normalizeTransitionName(collectComponentProps(node, context.scope, locals).name);
2195
2269
  }
2196
2270
  function transitionBoundaryTag(node, context, locals) {
2197
- if (String(node.tag || "").toLowerCase() !== "transition-group") return "span";
2271
+ if (normalizeTransitionBoundaryTagName(node.tag) !== "transition-group") return "span";
2198
2272
  const candidate = String(collectComponentProps(node, context.scope, locals).tag || "").trim().toLowerCase();
2199
2273
  if (!candidate || !/^[a-z][a-z0-9-]*$/.test(candidate) || unsafeTransitionContainerTags.has(candidate)) return "span";
2200
2274
  return candidate;
@@ -2206,7 +2280,7 @@ function directTransitionBlock(node) {
2206
2280
  }
2207
2281
  function renderTransitionBoundary(node, context, locals, children) {
2208
2282
  const name = transitionBoundaryName(node, context, locals);
2209
- const group = String(node.tag || "").toLowerCase() === "transition-group";
2283
+ const group = normalizeTransitionBoundaryTagName(node.tag) === "transition-group";
2210
2284
  const tag = transitionBoundaryTag(node, context, locals);
2211
2285
  const attrs = [`data-rx-transition="${escapeAttribute(name)}"`];
2212
2286
  if (group) attrs.push("data-rx-transition-group=\"true\"");
@@ -2347,6 +2421,7 @@ function appendNativeEventAttributes(attrs, event, context, locals) {
2347
2421
  }
2348
2422
  function collectNativeElementAttributes(node, context, locals) {
2349
2423
  const attrs = [];
2424
+ let resolvedRef;
2350
2425
  for (const attr of node.attrs) {
2351
2426
  const attrName = nativeAttributeName(node, attr.name);
2352
2427
  if (attr.kind === "static") {
@@ -2355,11 +2430,14 @@ function collectNativeElementAttributes(node, context, locals) {
2355
2430
  }
2356
2431
  const value = evaluateExpression(attr.value, context.scope, locals);
2357
2432
  if (attr.bindingId) attrs.push(`data-rx-attr-${attr.bindingId}="${context.scopeId}:${attr.bindingId}"`);
2433
+ if (attrName === "ref" && typeof value === "string" && value.trim()) resolvedRef = value.trim();
2358
2434
  const isViewTransitionAttr = attrName === "data-view-transition" || attrName === "view-transition";
2359
2435
  if (!isViewTransitionAttr && (value === false || value === null || value === void 0)) continue;
2360
2436
  if (isViewTransitionAttr && (value === null || value === void 0)) continue;
2361
2437
  attrs.push(`${attrName}="${escapeAttribute(stringifyAttributeValue(attrName, value))}"`);
2362
2438
  }
2439
+ const effectiveRef = resolvedRef ?? node.ref;
2440
+ if (effectiveRef) attrs.push(`data-rx-ref="${escapeAttribute(`${context.scopeId}:${effectiveRef}`)}"`);
2363
2441
  for (const event of node.events) appendNativeEventAttributes(attrs, event, context, locals);
2364
2442
  if (node.html) attrs.push(`data-rx-html-${node.html.bindingId}="${context.scopeId}:${node.html.bindingId}"`);
2365
2443
  appendStyleScopeAttribute(attrs, context.styleScopeId);
@@ -2512,6 +2590,11 @@ const resuxResponsiveViewportWidths = [
2512
2590
  1920,
2513
2591
  2560
2514
2592
  ];
2593
+ function normalizeClientEnhanceTag(value) {
2594
+ const candidate = String(value || "section").trim().toLowerCase();
2595
+ if (!candidate || !/^[a-z][a-z0-9-]*$/.test(candidate) || unsafeTransitionContainerTags.has(candidate)) return "section";
2596
+ return candidate;
2597
+ }
2515
2598
  function renderResuxClientEnhance(node, context, locals) {
2516
2599
  const props = collectComponentProps(node, context.scope, locals);
2517
2600
  const name = String(props.name || "").trim();
@@ -2530,12 +2613,12 @@ function renderResuxClientEnhance(node, context, locals) {
2530
2613
  const aspectRatio = String(props.aspectRatio || "").trim();
2531
2614
  const noCls = props.noCls === true || props.noCls === "true";
2532
2615
  const demo = String(props.demo || name).trim();
2533
- const tag = String(props.as || "section").trim();
2616
+ const tag = normalizeClientEnhanceTag(props.as);
2534
2617
  const styles = [];
2535
2618
  if (reserveHeight) styles.push(`min-height: ${reserveHeight};`);
2536
2619
  if (reserveWidth) styles.push(`min-width: ${reserveWidth};`);
2537
2620
  if (aspectRatio) styles.push(`aspect-ratio: ${aspectRatio};`);
2538
- const styleAttr = styles.length ? ` style="${styles.join(" ")}"` : "";
2621
+ const styleAttr = styles.length ? ` style="${escapeAttribute(styles.join(" "))}"` : "";
2539
2622
  const attrs = [
2540
2623
  `data-resux-enhancement="${escapeAttribute(name)}"`,
2541
2624
  `data-resux-trigger="${escapeAttribute(trigger)}"`,
@@ -2590,12 +2673,12 @@ async function renderResuxClientEnhanceAsync(node, context, renderComponent, loc
2590
2673
  const aspectRatio = String(props.aspectRatio || "").trim();
2591
2674
  const noCls = props.noCls === true || props.noCls === "true";
2592
2675
  const demo = String(props.demo || name).trim();
2593
- const tag = String(props.as || "section").trim();
2676
+ const tag = normalizeClientEnhanceTag(props.as);
2594
2677
  const styles = [];
2595
2678
  if (reserveHeight) styles.push(`min-height: ${reserveHeight};`);
2596
2679
  if (reserveWidth) styles.push(`min-width: ${reserveWidth};`);
2597
2680
  if (aspectRatio) styles.push(`aspect-ratio: ${aspectRatio};`);
2598
- const styleAttr = styles.length ? ` style="${styles.join(" ")}"` : "";
2681
+ const styleAttr = styles.length ? ` style="${escapeAttribute(styles.join(" "))}"` : "";
2599
2682
  const attrs = [
2600
2683
  `data-resux-enhancement="${escapeAttribute(name)}"`,
2601
2684
  `data-resux-trigger="${escapeAttribute(trigger)}"`,
@@ -2961,6 +3044,8 @@ function renderResuxVideo(node, context, locals) {
2961
3044
  attrs.push(`data-rx-video-default-speed="${escapeAttribute(String(defaultSpeed))}"`);
2962
3045
  if (ariaLabel) attrs.push(`aria-label="${escapeAttribute(ariaLabel)}"`);
2963
3046
  if (styleParts.length > 0) attrs.push(`style="${escapeAttribute(styleParts.join("; "))}"`);
3047
+ const videoRef = readStringProp(props.ref) ?? node.ref;
3048
+ if (videoRef) attrs.push(`data-rx-ref="${escapeAttribute(`${context.scopeId}:${videoRef}`)}"`);
2964
3049
  appendStyleScopeAttribute(attrs, context.styleScopeId);
2965
3050
  const attrText = attrs.length ? ` ${attrs.join(" ")}` : "";
2966
3051
  const sourceTags = hasSourceChildren ? activeSources.map((source) => {
@@ -3241,6 +3326,8 @@ function resolveResuxImageRenderInput(node, context, locals) {
3241
3326
  const densities = parseImageNumberList(props.densities) || runtimeImageConfig.densities || [1, 2];
3242
3327
  const widths = parseImageNumberList(props.widths) ?? [];
3243
3328
  const passthrough = collectResuxImagePassthroughAttributes(props);
3329
+ const imageRef = readStringProp(props.ref) ?? node.ref;
3330
+ if (imageRef) passthrough["data-rx-ref"] = `${context.scopeId}:${imageRef}`;
3244
3331
  const src = readStringProp(props.src) ?? readStringProp(props.fallbackSrc ?? props.fallback) ?? "";
3245
3332
  const alt = readStringProp(props.alt) ?? "";
3246
3333
  const placeholderSrc = resolveMediaPlaceholderSource(props.placeholder);
@@ -4348,9 +4435,10 @@ function mergeHead(entries) {
4348
4435
  htmlAttrs: {},
4349
4436
  bodyAttrs: {}
4350
4437
  };
4438
+ const metaSources = [];
4351
4439
  for (const entry of entries) {
4352
4440
  if (entry.title) merged.title = entry.title;
4353
- if (entry.meta) merged.meta.push(...entry.meta);
4441
+ if (entry.meta) metaSources.push(entry.meta);
4354
4442
  if (entry.link) merged.link.push(...entry.link);
4355
4443
  if (entry.style) merged.style.push(...entry.style);
4356
4444
  if (entry.script) merged.script.push(...entry.script);
@@ -4364,9 +4452,47 @@ function mergeHead(entries) {
4364
4452
  ...entry.bodyAttrs
4365
4453
  };
4366
4454
  }
4455
+ merged.meta = dedupeHeadMeta(metaSources);
4367
4456
  merged.link = sortHeadLinksForPriority(merged.link ?? []);
4457
+ merged.script = dedupeHeadScripts(merged.script ?? []);
4368
4458
  return merged;
4369
4459
  }
4460
+ function headMetaDedupKey(meta) {
4461
+ if (meta.charset !== void 0) return "charset";
4462
+ for (const attribute of [
4463
+ "name",
4464
+ "property",
4465
+ "http-equiv",
4466
+ "httpEquiv"
4467
+ ]) {
4468
+ const value = meta[attribute];
4469
+ if (typeof value === "string" && value.trim() !== "") return `${attribute === "httpEquiv" ? "http-equiv" : attribute}:${value.trim().toLowerCase()}`;
4470
+ }
4471
+ }
4472
+ function dedupeHeadMeta(sources) {
4473
+ const lastOwnerByKey = /* @__PURE__ */ new Map();
4474
+ sources.forEach((source, sourceIndex) => {
4475
+ for (const meta of source) {
4476
+ const key = headMetaDedupKey(meta);
4477
+ if (key !== void 0) lastOwnerByKey.set(key, sourceIndex);
4478
+ }
4479
+ });
4480
+ const output = [];
4481
+ sources.forEach((source, sourceIndex) => {
4482
+ for (const meta of source) {
4483
+ const key = headMetaDedupKey(meta);
4484
+ if (key === void 0 || lastOwnerByKey.get(key) === sourceIndex) output.push(meta);
4485
+ }
4486
+ });
4487
+ return output;
4488
+ }
4489
+ function getCriticalMetaOrder(meta) {
4490
+ if (meta.charset !== void 0) return 0;
4491
+ if (meta["http-equiv"] ?? meta.httpEquiv) return 1;
4492
+ const rawName = meta.name;
4493
+ if ((typeof rawName === "string" ? rawName.toLowerCase() : "") === "viewport") return 2;
4494
+ return 3;
4495
+ }
4370
4496
  function isCriticalHeadMeta(meta) {
4371
4497
  if (meta.charset !== void 0) return true;
4372
4498
  const rawName = meta.name;
@@ -4375,44 +4501,111 @@ function isCriticalHeadMeta(meta) {
4375
4501
  const httpEquiv = typeof rawHttpEquiv === "string" ? rawHttpEquiv.toLowerCase() : "";
4376
4502
  return name === "viewport" || Boolean(httpEquiv);
4377
4503
  }
4378
- function renderHead(head) {
4504
+ function extractCspFromHead(head) {
4505
+ for (const meta of head.meta ?? []) {
4506
+ if (!meta || typeof meta !== "object") continue;
4507
+ if (String(meta["http-equiv"] ?? meta.httpEquiv ?? "").trim().toLowerCase() === "content-security-policy") return String(meta.content ?? "");
4508
+ }
4509
+ return "";
4510
+ }
4511
+ function allowsInlineScriptElementForCsp(csp) {
4512
+ const sources = cspDirectiveSources(csp, [
4513
+ "script-src-elem",
4514
+ "script-src",
4515
+ "default-src"
4516
+ ]);
4517
+ return sources === null || sources.includes("'unsafe-inline'");
4518
+ }
4519
+ const SCRIPT_BOOLEAN_ATTRIBUTES = /* @__PURE__ */ new Set([
4520
+ "async",
4521
+ "defer",
4522
+ "nomodule"
4523
+ ]);
4524
+ function renderScriptAttributes(attributes) {
4525
+ return Object.entries(attributes).map(([key, value]) => {
4526
+ if (value === null || value === void 0 || value === false) return "";
4527
+ if (SCRIPT_BOOLEAN_ATTRIBUTES.has(key)) {
4528
+ if (value === true || value === key || value === "") return key;
4529
+ }
4530
+ const normalized = normalizeHeadAttributeValue(key, value);
4531
+ return normalized === null ? "" : `${key}="${escapeAttribute(normalized)}"`;
4532
+ }).filter(Boolean).join(" ");
4533
+ }
4534
+ function renderHead(head, options = {}) {
4379
4535
  const tags = [];
4380
- const metaList = head.meta ?? [];
4536
+ const metaList = [...head.meta ?? []];
4381
4537
  const criticalMetas = metaList.filter((meta) => isCriticalHeadMeta(meta));
4538
+ criticalMetas.sort((a, b) => getCriticalMetaOrder(a) - getCriticalMetaOrder(b));
4382
4539
  const remainingMetas = metaList.filter((meta) => !isCriticalHeadMeta(meta));
4383
4540
  for (const meta of criticalMetas) tags.push(`<meta data-rx-head="true" ${renderAttributes(meta)}>`);
4384
4541
  tags.push(`<title>${escapeHtml(head.title ?? "Resux App")}</title>`);
4385
4542
  const links = sortHeadLinksForPriority(normalizeHeadLinks(head.link ?? []));
4386
4543
  const highPriorityPreloads = links.filter((link) => isPriorityImagePreloadLink(link) || isPriorityStylePreloadLink(link));
4387
4544
  const remainingLinks = links.filter((link) => !isPriorityImagePreloadLink(link) && !isPriorityStylePreloadLink(link));
4388
- for (const link of highPriorityPreloads) tags.push(`<link data-rx-head="true" ${renderAttributes(link)}>`);
4545
+ const linkNonceAttr = options.nonce ? ` nonce="${escapeAttribute(options.nonce)}"` : "";
4546
+ for (const link of highPriorityPreloads) {
4547
+ const nonceStr = options.nonce && link.rel === "stylesheet" && !link.nonce ? linkNonceAttr : "";
4548
+ tags.push(`<link data-rx-head="true"${nonceStr} ${renderAttributes(link)}>`);
4549
+ }
4389
4550
  for (const meta of remainingMetas) tags.push(`<meta data-rx-head="true" ${renderAttributes(meta)}>`);
4390
- for (const link of remainingLinks) tags.push(`<link data-rx-head="true" ${renderAttributes(link)}>`);
4551
+ for (const link of remainingLinks) {
4552
+ const nonceStr = options.nonce && link.rel === "stylesheet" && !link.nonce ? linkNonceAttr : "";
4553
+ tags.push(`<link data-rx-head="true"${nonceStr} ${renderAttributes(link)}>`);
4554
+ }
4555
+ const styles = [];
4556
+ const styleMap = /* @__PURE__ */ new Map();
4391
4557
  for (const style of head.style ?? []) {
4392
4558
  if (!style) continue;
4559
+ const styleId = typeof style === "object" && style.id ? String(style.id) : "";
4560
+ if (styleId) {
4561
+ if (styleMap.has(styleId)) {
4562
+ const existing = styleMap.get(styleId);
4563
+ const idx = styles.indexOf(existing);
4564
+ if (idx !== -1) styles[idx] = style;
4565
+ styleMap.set(styleId, style);
4566
+ } else {
4567
+ styleMap.set(styleId, style);
4568
+ styles.push(style);
4569
+ }
4570
+ } else styles.push(style);
4571
+ }
4572
+ const styleNonceAttr = options.nonce ? ` nonce="${escapeAttribute(options.nonce)}"` : "";
4573
+ for (const style of styles) {
4393
4574
  const styleId = typeof style === "object" && style.id ? String(style.id) : "";
4394
4575
  const styleIdAttr = styleId ? ` data-rx-style="${escapeAttribute(styleId)}"` : "";
4395
4576
  const cssContent = escapeStyleContent(style);
4396
- tags.push(`<style data-rx-head="true"${styleIdAttr}>${cssContent}</style>`);
4577
+ tags.push(`<style data-rx-head="true"${styleNonceAttr}${styleIdAttr}>${cssContent}</style>`);
4397
4578
  }
4398
4579
  for (const noscript of head.noscript ?? []) {
4399
4580
  const rendered = renderHeadNoscript(noscript);
4400
4581
  if (rendered) tags.push(rendered);
4401
4582
  }
4583
+ const csp = options.csp ?? extractCspFromHead(head);
4402
4584
  for (const script of head.script ?? []) {
4403
- const rendered = renderHeadScript(script);
4585
+ const rendered = renderHeadScript(script, {
4586
+ nonce: options.nonce,
4587
+ csp
4588
+ });
4404
4589
  if (rendered) tags.push(rendered);
4405
4590
  }
4406
4591
  return tags.join("");
4407
4592
  }
4408
- function renderHeadScript(entry) {
4593
+ function renderHeadScript(entry, options = {}) {
4409
4594
  if (!entry || typeof entry !== "object" || Array.isArray(entry)) return "";
4410
4595
  const attributes = { ...entry };
4411
- const innerHTML = String(attributes.innerHTML ?? attributes.children ?? "");
4596
+ const content = String(attributes.textContent ?? attributes.innerHTML ?? attributes.children ?? "");
4412
4597
  delete attributes.innerHTML;
4598
+ delete attributes.textContent;
4413
4599
  delete attributes.children;
4414
- const renderedAttributes = renderAttributes(attributes);
4415
- return `<script data-rx-head="true"${renderedAttributes ? ` ${renderedAttributes}` : ""}>${escapeScriptContent(innerHTML)}<\/script>`;
4600
+ delete attributes.key;
4601
+ if (!attributes.nonce && options.nonce) attributes.nonce = options.nonce;
4602
+ if (!attributes.src && content.length > 0 && options.csp) {
4603
+ const hasNonce = Boolean(attributes.nonce);
4604
+ const inlineAllowed = allowsInlineScriptElementForCsp(options.csp);
4605
+ if (!hasNonce && !inlineAllowed) return "";
4606
+ }
4607
+ const renderedAttributes = renderScriptAttributes(attributes);
4608
+ return `<script data-rx-head="true"${renderedAttributes ? ` ${renderedAttributes}` : ""}>${content ? escapeScriptContent(content) : ""}<\/script>`;
4416
4609
  }
4417
4610
  function renderHeadNoscript(entry) {
4418
4611
  if (typeof entry === "string") return `<noscript data-rx-head="true">${escapeHtml(entry)}</noscript>`;
@@ -4685,12 +4878,25 @@ function collectPatches(nodes, scope, scopeId, locals, patches, styleScopeId) {
4685
4878
  value: normalizeTransitionName(evaluateExpression(attr.value, scope, locals))
4686
4879
  });
4687
4880
  } else if (node.tag !== "ResuxImg" && node.tag !== "ResuxPicture" && node.tag !== "ResuxVideo") {
4688
- for (const attr of node.attrs) if (attr.kind === "dynamic" && attr.bindingId) patches.push({
4689
- type: "attr",
4690
- id: attr.bindingId,
4691
- attr: nativeAttributeName(node, attr.name),
4692
- value: stringifyAttributeValue(nativeAttributeName(node, attr.name), evaluateExpression(attr.value, scope, locals))
4693
- });
4881
+ for (const attr of node.attrs) if (attr.kind === "dynamic" && attr.bindingId) {
4882
+ const attrName = nativeAttributeName(node, attr.name);
4883
+ const attrValue = evaluateExpression(attr.value, scope, locals);
4884
+ patches.push({
4885
+ type: "attr",
4886
+ id: attr.bindingId,
4887
+ attr: attrName,
4888
+ value: stringifyAttributeValue(attrName, attrValue)
4889
+ });
4890
+ if (attrName === "ref") {
4891
+ const refText = typeof attrValue === "string" ? attrValue.trim() : "";
4892
+ patches.push({
4893
+ type: "attr",
4894
+ id: attr.bindingId,
4895
+ attr: "data-rx-ref",
4896
+ value: refText ? `${scopeId}:${refText}` : ""
4897
+ });
4898
+ }
4899
+ }
4694
4900
  }
4695
4901
  collectPatches(node.children, scope, scopeId, locals, patches, styleScopeId);
4696
4902
  }
@@ -5069,10 +5275,12 @@ const __rxFlags = {
5069
5275
  const __rxTargetMap = new WeakMap();
5070
5276
  const __rxReactiveMap = new WeakMap();
5071
5277
  const __rxReadonlyMap = new WeakMap();
5278
+ const __rxProxyToRaw = new WeakMap();
5072
5279
  let __rxActiveEffect;
5073
5280
  let __rxShouldTrack = true;
5074
5281
  const __rxTrackStack = [];
5075
5282
  const __rxQueue = new Set();
5283
+ const __rxPostFlushQueue = new Set();
5076
5284
  let __rxFlushing = false;
5077
5285
  const __rxResolvedPromise = Promise.resolve();
5078
5286
  let __rxFlushPromise = null;
@@ -5406,11 +5614,11 @@ async function ensureClientEnhancementManifestLoaded() {
5406
5614
  }
5407
5615
 
5408
5616
  function packageCacheKey(name, options = {}) {
5617
+ const css = normalizePackageCssInput(options.css).sort().join(",");
5409
5618
  const exportName = typeof options.exportName === "string" ? options.exportName : "";
5410
- const preferDefault = options.preferDefault === false ? "named" : "default";
5411
5619
  const mode = normalizePackageMode(options.mode, options.clientOnly ? "clientOnly" : "ssr");
5412
- const css = Array.isArray(options.css) ? options.css.join(",") : String(options.css || "");
5413
- return [name, exportName, preferDefault, mode, css].join("::");
5620
+ const preferDefault = options.preferDefault === false ? "0" : "1";
5621
+ return name + "::" + mode + "::" + preferDefault + "::" + exportName + "::" + css;
5414
5622
  }
5415
5623
 
5416
5624
  function normalizePackageCssInput(value) {
@@ -6229,6 +6437,7 @@ async function activateDeclaredClientEnhancements(root = document) {
6229
6437
 
6230
6438
 
6231
6439
  const __rxIterateKey = Symbol("iterate");
6440
+ const __rxMapKeyIterateKey = Symbol("Map key iterate");
6232
6441
 
6233
6442
  function __rxIsObject(value) {
6234
6443
  return value !== null && typeof value === "object";
@@ -6238,43 +6447,74 @@ function __rxHasChanged(value, oldValue) {
6238
6447
  return !Object.is(value, oldValue);
6239
6448
  }
6240
6449
 
6241
- function __rxQueueJob(job) {
6242
- __rxQueue.add(job);
6450
+ function __rxStartFlush() {
6243
6451
  if (__rxFlushing) {
6244
6452
  return;
6245
6453
  }
6246
6454
  __rxFlushing = true;
6247
6455
  __rxFlushPromise = __rxResolvedPromise.then(__rxFlushJobs);
6456
+ // Mark the flush as handled so fire-and-forget queued jobs do not produce
6457
+ // an unhandled rejection; nextTick awaiters still observe it (mirrors the
6458
+ // server scheduler).
6459
+ __rxFlushPromise.catch(__rxNoopErrorObserver);
6460
+ }
6461
+
6462
+ function __rxNoopErrorObserver() {
6463
+ // Intentionally empty: the rejection remains visible through nextTick().
6464
+ }
6465
+
6466
+ function __rxQueueJob(job) {
6467
+ __rxQueue.add(job);
6468
+ __rxStartFlush();
6469
+ }
6470
+
6471
+ function __rxQueuePostFlushCb(job) {
6472
+ __rxPostFlushQueue.add(job);
6473
+ __rxStartFlush();
6248
6474
  }
6249
6475
 
6250
6476
  function __rxFlushJobs() {
6251
6477
  let didError = false;
6252
6478
  let firstError;
6253
6479
  const executionCounts = new Map();
6254
- try {
6255
- while (__rxQueue.size > 0) {
6256
- const currentQueue = [...__rxQueue];
6257
- __rxQueue.clear();
6258
- for (const job of currentQueue) {
6259
- const count = executionCounts.get(job) || 0;
6260
- if (count >= 100) {
6261
- if (!didError) {
6262
- didError = true;
6263
- firstError = new Error("Resux scheduler stopped a recursively queued job after 100 executions.");
6264
- }
6265
- continue;
6480
+ const runJobs = (jobs) => {
6481
+ for (const job of jobs) {
6482
+ const count = executionCounts.get(job) || 0;
6483
+ if (count >= 100) {
6484
+ if (!didError) {
6485
+ didError = true;
6486
+ firstError = new Error("Resux scheduler stopped a recursively queued job after 100 executions.");
6266
6487
  }
6267
- executionCounts.set(job, count + 1);
6268
- try {
6269
- job();
6270
- } catch (error) {
6271
- if (!didError) {
6272
- didError = true;
6273
- firstError = error;
6274
- }
6488
+ continue;
6489
+ }
6490
+ executionCounts.set(job, count + 1);
6491
+ try {
6492
+ job();
6493
+ } catch (error) {
6494
+ if (!didError) {
6495
+ didError = true;
6496
+ firstError = error;
6275
6497
  }
6276
6498
  }
6277
6499
  }
6500
+ };
6501
+ try {
6502
+ let hasJobs = true;
6503
+ while (hasJobs) {
6504
+ hasJobs = false;
6505
+ if (__rxQueue.size > 0) {
6506
+ const currentQueue = [...__rxQueue];
6507
+ __rxQueue.clear();
6508
+ runJobs(currentQueue);
6509
+ hasJobs = true;
6510
+ }
6511
+ if (__rxPostFlushQueue.size > 0) {
6512
+ const currentPostQueue = [...__rxPostFlushQueue];
6513
+ __rxPostFlushQueue.clear();
6514
+ runJobs(currentPostQueue);
6515
+ hasJobs = true;
6516
+ }
6517
+ }
6278
6518
  } finally {
6279
6519
  __rxFlushing = false;
6280
6520
  __rxFlushPromise = null;
@@ -6387,7 +6627,7 @@ function __rxTrack(target, key) {
6387
6627
  __rxActiveEffect.deps.push(dep);
6388
6628
  }
6389
6629
 
6390
- function __rxTrigger(target, key, type = "set") {
6630
+ function __rxTrigger(target, key, type = "set", newValue) {
6391
6631
  const depsMap = __rxTargetMap.get(target);
6392
6632
  if (!depsMap) {
6393
6633
  return;
@@ -6397,9 +6637,38 @@ function __rxTrigger(target, key, type = "set") {
6397
6637
  if (!dep) return;
6398
6638
  for (const effect of dep) effects.add(effect);
6399
6639
  };
6400
- addEffects(depsMap.get(key));
6401
- if (type === "add" || type === "delete") {
6402
- addEffects(depsMap.get(__rxIterateKey));
6640
+ if (type === "clear") {
6641
+ // Clearing a collection invalidates every dependency it owns.
6642
+ for (const dep of depsMap.values()) {
6643
+ addEffects(dep);
6644
+ }
6645
+ } else if (Array.isArray(target) && key === "length") {
6646
+ // Truncating or extending an array via its length invalidates the length,
6647
+ // iteration, and every index at or past the new length (mirrors the
6648
+ // server engine's trigger()).
6649
+ const nextLength = Number(newValue);
6650
+ for (const [depKey, dep] of depsMap) {
6651
+ if (
6652
+ depKey === "length"
6653
+ || depKey === __rxIterateKey
6654
+ || (__rxIsArrayIndex(depKey) && Number(depKey) >= nextLength)
6655
+ ) {
6656
+ addEffects(dep);
6657
+ }
6658
+ }
6659
+ } else {
6660
+ addEffects(depsMap.get(key));
6661
+ if (type === "add" || type === "delete") {
6662
+ addEffects(depsMap.get(__rxIterateKey));
6663
+ if (target instanceof Map) {
6664
+ addEffects(depsMap.get(__rxMapKeyIterateKey));
6665
+ }
6666
+ } else if (type === "set" && target instanceof Map) {
6667
+ // A changed value is visible to values()/entries()/forEach iteration and
6668
+ // size, which all track ITERATE_KEY on maps. keys() iteration is not
6669
+ // affected by value changes.
6670
+ addEffects(depsMap.get(__rxIterateKey));
6671
+ }
6403
6672
  }
6404
6673
  __rxTriggerEffects(effects);
6405
6674
  }
@@ -6412,85 +6681,333 @@ function readonly(target) {
6412
6681
  return __rxCreateReactiveObject(target, true, __rxReadonlyMap, false);
6413
6682
  }
6414
6683
 
6415
- function __rxCanUseBaseProxyHandlers(target) {
6416
- const rawType = Object.prototype.toString.call(target);
6417
- return rawType === "[object Object]" || rawType === "[object Array]";
6684
+ function __rxGetTargetType(target) {
6685
+ switch (Object.prototype.toString.call(target)) {
6686
+ case "[object Object]":
6687
+ case "[object Array]":
6688
+ return "common";
6689
+ case "[object Map]":
6690
+ case "[object Set]":
6691
+ case "[object WeakMap]":
6692
+ case "[object WeakSet]":
6693
+ return "collection";
6694
+ default:
6695
+ return "invalid";
6696
+ }
6418
6697
  }
6419
6698
 
6420
- function __rxCreateReactiveObject(target, isReadonlyValue, proxyMap, isShallow) {
6421
- if (!__rxIsObject(target) || !__rxCanUseBaseProxyHandlers(target)) {
6422
- return target;
6699
+ function __rxIsArrayIndex(key) {
6700
+ if (typeof key === "symbol" || key === "length") {
6701
+ return false;
6423
6702
  }
6424
- const existing = proxyMap.get(target);
6425
- if (existing) {
6426
- return existing;
6703
+ const value = String(key);
6704
+ return /^(?:0|[1-9]\d*)$/.test(value) && Number(value) < 4294967295;
6705
+ }
6706
+
6707
+ function toRaw(value) {
6708
+ let current = value;
6709
+ while (__rxIsObject(current)) {
6710
+ const raw = __rxProxyToRaw.get(current);
6711
+ if (!raw || raw === current) {
6712
+ break;
6713
+ }
6714
+ current = raw;
6427
6715
  }
6428
- const proxy = new Proxy(target, {
6429
- get(rawTarget, key, receiver) {
6430
- if (key === __rxFlags.isReactive) {
6431
- return !isReadonlyValue;
6432
- }
6433
- if (key === __rxFlags.isReadonly) {
6434
- return isReadonlyValue;
6716
+ return current;
6717
+ }
6718
+
6719
+ // --- Collection (Map / Set / WeakMap / WeakSet) instrumentation ------------
6720
+ // Mirrors src/reactivity/reactive.ts so resumed client scopes behave exactly
6721
+ // like the server engine.
6722
+
6723
+ function __rxWrapCollectionValue(value, isReadonlyValue) {
6724
+ if (!__rxIsObject(value)) {
6725
+ return value;
6726
+ }
6727
+ return isReadonlyValue ? readonly(value) : reactive(value);
6728
+ }
6729
+
6730
+ function __rxCreateIterableMethod(method, isReadonlyValue) {
6731
+ return function () {
6732
+ const target = toRaw(this);
6733
+ const isMap = target instanceof Map;
6734
+ const isKeys = method === "keys";
6735
+ __rxTrack(target, isKeys && isMap ? __rxMapKeyIterateKey : __rxIterateKey);
6736
+ const resolved = method === Symbol.iterator ? (isMap ? "entries" : "values") : method;
6737
+ const inner = target[resolved].call(target);
6738
+ const wrap = (value) => __rxWrapCollectionValue(value, isReadonlyValue);
6739
+ const isEntries = resolved === "entries";
6740
+
6741
+ return {
6742
+ next() {
6743
+ const { value, done } = inner.next();
6744
+ if (done) {
6745
+ return { value, done: true };
6746
+ }
6747
+ if (isEntries) {
6748
+ return { value: [wrap(value[0]), wrap(value[1])], done: false };
6749
+ }
6750
+ return { value: wrap(value), done: false };
6751
+ },
6752
+ [Symbol.iterator]() {
6753
+ return this;
6435
6754
  }
6436
- if (key === __rxFlags.raw) {
6437
- return rawTarget;
6755
+ };
6756
+ };
6757
+ }
6758
+
6759
+ function __rxCreateCollectionInstrumentations(isReadonlyValue) {
6760
+ const wrap = (value) => __rxWrapCollectionValue(value, isReadonlyValue);
6761
+
6762
+ return {
6763
+ get(key) {
6764
+ const target = toRaw(this);
6765
+ const rawKey = toRaw(key);
6766
+ __rxTrack(target, rawKey);
6767
+ if (rawKey !== key) {
6768
+ __rxTrack(target, key);
6438
6769
  }
6439
- const value = Reflect.get(rawTarget, key, receiver);
6440
- if (!isReadonlyValue) {
6441
- __rxTrack(rawTarget, key);
6770
+ let result = target.get(rawKey);
6771
+ if (result === undefined && rawKey !== key) {
6772
+ result = target.get(key);
6442
6773
  }
6443
- if (isShallow || !__rxIsObject(value)) {
6444
- return value;
6774
+ return wrap(result);
6775
+ },
6776
+
6777
+ has(key) {
6778
+ const target = toRaw(this);
6779
+ const rawKey = toRaw(key);
6780
+ __rxTrack(target, rawKey);
6781
+ if (rawKey !== key) {
6782
+ __rxTrack(target, key);
6445
6783
  }
6446
- return isReadonlyValue ? readonly(value) : reactive(value);
6784
+ return target.has(rawKey) || (rawKey !== key && target.has(key));
6785
+ },
6786
+
6787
+ get size() {
6788
+ // 'this' is the receiver (the proxy) because instrumentations are read
6789
+ // via Reflect.get(instrumentations, key, receiver).
6790
+ const target = toRaw(this);
6791
+ __rxTrack(target, __rxIterateKey);
6792
+ return target.size;
6447
6793
  },
6448
- set(rawTarget, key, value, receiver) {
6794
+
6795
+ set(key, value) {
6449
6796
  if (isReadonlyValue) {
6450
- return true;
6797
+ return this;
6451
6798
  }
6452
- const hadKey = Object.prototype.hasOwnProperty.call(rawTarget, key);
6453
- const oldValue = Reflect.get(rawTarget, key, receiver);
6454
- const oldLength = Array.isArray(rawTarget) ? rawTarget.length : 0;
6455
- const success = Reflect.set(rawTarget, key, value, receiver);
6456
- if (success && (!hadKey || __rxHasChanged(value, oldValue))) {
6457
- __rxTrigger(rawTarget, key, hadKey ? "set" : "add");
6458
- if (
6459
- Array.isArray(rawTarget)
6460
- && key !== "length"
6461
- && /^(?:0|[1-9]\d*)$/.test(String(key))
6462
- && Number(key) >= oldLength
6463
- && Number(key) < 4294967295
6464
- ) {
6465
- __rxTrigger(rawTarget, "length");
6466
- }
6799
+ const target = toRaw(this);
6800
+ const rawKey = toRaw(key);
6801
+ const rawValue = toRaw(value);
6802
+ const hadKey = target.has(rawKey);
6803
+ const oldValue = target.get(rawKey);
6804
+ target.set(rawKey, rawValue);
6805
+ if (!hadKey) {
6806
+ __rxTrigger(target, rawKey, "add");
6807
+ } else if (!Object.is(rawValue, toRaw(oldValue))) {
6808
+ __rxTrigger(target, rawKey, "set");
6467
6809
  }
6468
- return success;
6810
+ return this;
6469
6811
  },
6470
- ownKeys(rawTarget) {
6471
- if (!isReadonlyValue) {
6472
- __rxTrack(rawTarget, __rxIterateKey);
6812
+
6813
+ add(value) {
6814
+ if (isReadonlyValue) {
6815
+ return this;
6816
+ }
6817
+ const target = toRaw(this);
6818
+ const rawValue = toRaw(value);
6819
+ const hadKey = target.has(rawValue);
6820
+ target.add(rawValue);
6821
+ if (!hadKey) {
6822
+ __rxTrigger(target, rawValue, "add");
6473
6823
  }
6474
- return Reflect.ownKeys(rawTarget);
6824
+ return this;
6475
6825
  },
6476
- deleteProperty(rawTarget, key) {
6826
+
6827
+ delete(key) {
6477
6828
  if (isReadonlyValue) {
6478
- return true;
6829
+ return false;
6479
6830
  }
6480
- const hadKey = Object.prototype.hasOwnProperty.call(rawTarget, key);
6481
- const success = Reflect.deleteProperty(rawTarget, key);
6831
+ const target = toRaw(this);
6832
+ const rawKey = toRaw(key);
6833
+ const hadKey = target.has(rawKey);
6834
+ const success = target.delete(rawKey);
6482
6835
  if (hadKey && success) {
6483
- __rxTrigger(rawTarget, key, "delete");
6836
+ __rxTrigger(target, rawKey, "delete");
6484
6837
  }
6485
6838
  return success;
6486
- }
6487
- });
6839
+ },
6840
+
6841
+ clear() {
6842
+ if (isReadonlyValue) {
6843
+ return undefined;
6844
+ }
6845
+ const target = toRaw(this);
6846
+ const hadItems = target.size !== 0;
6847
+ target.clear();
6848
+ if (hadItems) {
6849
+ __rxTrigger(target, __rxIterateKey, "clear");
6850
+ }
6851
+ return undefined;
6852
+ },
6853
+
6854
+ forEach(callback, thisArg) {
6855
+ const target = toRaw(this);
6856
+ __rxTrack(target, __rxIterateKey);
6857
+ target.forEach((value, key) => {
6858
+ callback.call(thisArg, wrap(value), wrap(key), this);
6859
+ });
6860
+ },
6861
+
6862
+ keys: __rxCreateIterableMethod("keys", isReadonlyValue),
6863
+ values: __rxCreateIterableMethod("values", isReadonlyValue),
6864
+ entries: __rxCreateIterableMethod("entries", isReadonlyValue),
6865
+ [Symbol.iterator]: __rxCreateIterableMethod(Symbol.iterator, isReadonlyValue)
6866
+ };
6867
+ }
6868
+
6869
+ const __rxMutableCollectionInstrumentations = __rxCreateCollectionInstrumentations(false);
6870
+ const __rxReadonlyCollectionInstrumentations = __rxCreateCollectionInstrumentations(true);
6871
+
6872
+ function __rxCollectionGet(instrumentations, isReadonlyValue, rawTarget, key, receiver) {
6873
+ if (key === __rxFlags.isReactive) {
6874
+ return !isReadonlyValue;
6875
+ }
6876
+ if (key === __rxFlags.isReadonly) {
6877
+ return isReadonlyValue;
6878
+ }
6879
+ if (key === __rxFlags.raw) {
6880
+ return rawTarget;
6881
+ }
6882
+ const source = Object.prototype.hasOwnProperty.call(instrumentations, key) && key in rawTarget
6883
+ ? instrumentations
6884
+ : rawTarget;
6885
+ return Reflect.get(source, key, receiver);
6886
+ }
6887
+
6888
+ function __rxCreateReactiveObject(target, isReadonlyValue, proxyMap, isShallow) {
6889
+ const targetType = __rxIsObject(target) ? __rxGetTargetType(target) : "invalid";
6890
+ if (targetType === "invalid") {
6891
+ return target;
6892
+ }
6893
+ if (__rxProxyToRaw.has(target) && !(isReadonlyValue && isReactive(target))) {
6894
+ return target;
6895
+ }
6896
+ const existing = proxyMap.get(target);
6897
+ if (existing) {
6898
+ return existing;
6899
+ }
6900
+ let proxy;
6901
+ if (targetType === "collection") {
6902
+ const instrumentations = isReadonlyValue
6903
+ ? __rxReadonlyCollectionInstrumentations
6904
+ : __rxMutableCollectionInstrumentations;
6905
+ proxy = new Proxy(target, {
6906
+ get(rawTarget, key, receiver) {
6907
+ return __rxCollectionGet(instrumentations, isReadonlyValue, rawTarget, key, receiver);
6908
+ }
6909
+ });
6910
+ } else {
6911
+ proxy = new Proxy(target, {
6912
+ get(rawTarget, key, receiver) {
6913
+ if (key === __rxFlags.isReactive) {
6914
+ return !isReadonlyValue;
6915
+ }
6916
+ if (key === __rxFlags.isReadonly) {
6917
+ return isReadonlyValue;
6918
+ }
6919
+ if (key === __rxFlags.raw) {
6920
+ return rawTarget;
6921
+ }
6922
+ const value = Reflect.get(rawTarget, key, receiver);
6923
+ if (!isReadonlyValue) {
6924
+ __rxTrack(rawTarget, key);
6925
+ }
6926
+ // Vue-style ref unwrapping on plain object property access. Refs
6927
+ // stored at array indices stay wrapped, matching the server engine.
6928
+ if (isRef(value)) {
6929
+ return !Array.isArray(rawTarget) || !__rxIsArrayIndex(key)
6930
+ ? value.value
6931
+ : value;
6932
+ }
6933
+ if (isShallow || !__rxIsObject(value)) {
6934
+ return value;
6935
+ }
6936
+ return isReadonlyValue ? readonly(value) : reactive(value);
6937
+ },
6938
+ set(rawTarget, key, value, receiver) {
6939
+ if (isReadonlyValue) {
6940
+ return true;
6941
+ }
6942
+ const hadKey = Object.prototype.hasOwnProperty.call(rawTarget, key);
6943
+ const storedOldValue = Reflect.get(rawTarget, key, receiver);
6944
+ const oldLength = Array.isArray(rawTarget) ? rawTarget.length : 0;
6945
+ // Vue-style ref assignment: writing a plain value over a stored ref
6946
+ // updates the ref in place instead of replacing it. Arrays exempt.
6947
+ if (!Array.isArray(rawTarget) && isRef(storedOldValue) && !isRef(value)) {
6948
+ storedOldValue.value = value;
6949
+ return true;
6950
+ }
6951
+ const oldValue = toRaw(storedOldValue);
6952
+ const rawValue = toRaw(value);
6953
+ const success = Reflect.set(rawTarget, key, rawValue, receiver);
6954
+ if (success && (!hadKey || __rxHasChanged(rawValue, oldValue))) {
6955
+ __rxTrigger(rawTarget, key, hadKey ? "set" : "add", rawValue);
6956
+ if (
6957
+ Array.isArray(rawTarget)
6958
+ && key !== "length"
6959
+ && /^(?:0|[1-9]\d*)$/.test(String(key))
6960
+ && Number(key) >= oldLength
6961
+ && Number(key) < 4294967295
6962
+ ) {
6963
+ __rxTrigger(rawTarget, "length");
6964
+ }
6965
+ }
6966
+ return success;
6967
+ },
6968
+ has(rawTarget, key) {
6969
+ const result = Reflect.has(rawTarget, key);
6970
+ if (!isReadonlyValue) {
6971
+ __rxTrack(rawTarget, key);
6972
+ }
6973
+ return result;
6974
+ },
6975
+ ownKeys(rawTarget) {
6976
+ if (!isReadonlyValue) {
6977
+ __rxTrack(rawTarget, __rxIterateKey);
6978
+ }
6979
+ return Reflect.ownKeys(rawTarget);
6980
+ },
6981
+ deleteProperty(rawTarget, key) {
6982
+ if (isReadonlyValue) {
6983
+ return true;
6984
+ }
6985
+ const hadKey = Object.prototype.hasOwnProperty.call(rawTarget, key);
6986
+ const success = Reflect.deleteProperty(rawTarget, key);
6987
+ if (hadKey && success) {
6988
+ __rxTrigger(rawTarget, key, "delete");
6989
+ }
6990
+ return success;
6991
+ }
6992
+ });
6993
+ }
6488
6994
  proxyMap.set(target, proxy);
6995
+ __rxProxyToRaw.set(proxy, target);
6489
6996
  return proxy;
6490
6997
  }
6491
6998
 
6492
6999
  function isReactive(value) {
6493
- return Boolean(__rxIsObject(value) && value[__rxFlags.isReactive]);
7000
+ if (!__rxIsObject(value)) {
7001
+ return false;
7002
+ }
7003
+ if (value[__rxFlags.isReactive]) {
7004
+ return true;
7005
+ }
7006
+ if (value[__rxFlags.isReadonly]) {
7007
+ const raw = __rxProxyToRaw.get(value);
7008
+ return Boolean(raw && raw !== value && isReactive(raw));
7009
+ }
7010
+ return false;
6494
7011
  }
6495
7012
 
6496
7013
  function isReadonly(value) {
@@ -6500,7 +7017,7 @@ function isReadonly(value) {
6500
7017
  class __rxRefImpl {
6501
7018
  constructor(value) {
6502
7019
  this.__v_isRef = true;
6503
- this._rawValue = value;
7020
+ this._rawValue = toRaw(value);
6504
7021
  this._value = __rxIsObject(value) ? reactive(value) : value;
6505
7022
  this.dep = new Set();
6506
7023
  }
@@ -6516,10 +7033,11 @@ class __rxRefImpl {
6516
7033
  }
6517
7034
 
6518
7035
  set value(newValue) {
6519
- if (!__rxHasChanged(newValue, this._rawValue)) {
7036
+ const rawValue = toRaw(newValue);
7037
+ if (!__rxHasChanged(rawValue, this._rawValue)) {
6520
7038
  return;
6521
7039
  }
6522
- this._rawValue = newValue;
7040
+ this._rawValue = rawValue;
6523
7041
  this._value = __rxIsObject(newValue) ? reactive(newValue) : newValue;
6524
7042
  __rxTriggerEffects(this.dep);
6525
7043
  }
@@ -6649,8 +7167,13 @@ function __rxDoWatch(source, callback, options) {
6649
7167
  }
6650
7168
 
6651
7169
  let oldValue = __rxInitialWatchValue;
7170
+ let stopped = false;
6652
7171
 
6653
7172
  const job = () => {
7173
+ if (stopped) {
7174
+ return;
7175
+ }
7176
+
6654
7177
  if (callback === null) {
6655
7178
  runner();
6656
7179
  return;
@@ -6668,7 +7191,7 @@ function __rxDoWatch(source, callback, options) {
6668
7191
 
6669
7192
  const scheduler = flush === "sync"
6670
7193
  ? job
6671
- : () => __rxQueueJob(job);
7194
+ : () => __rxQueuePostFlushCb(job);
6672
7195
 
6673
7196
  const runner = effect(getter, {
6674
7197
  scheduler,
@@ -6684,6 +7207,10 @@ function __rxDoWatch(source, callback, options) {
6684
7207
  }
6685
7208
 
6686
7209
  return () => {
7210
+ if (stopped) {
7211
+ return;
7212
+ }
7213
+ stopped = true;
6687
7214
  if (cleanup) {
6688
7215
  cleanup();
6689
7216
  cleanup = undefined;
@@ -6837,7 +7364,11 @@ function readClientTranslation(messages, localeCode, key) {
6837
7364
 
6838
7365
  function interpolateClientTranslation(value, params = {}) {
6839
7366
  if (typeof value !== "string") return value;
6840
- return value.replace(/\{([^{}]+)\}/g, (match, key) => Object.prototype.hasOwnProperty.call(params, key) ? String(params[key]) : match);
7367
+ return value.replace(/\{([A-Za-z0-9_]+)\}/g, (match, key) => {
7368
+ const param = params[key];
7369
+ if (param === undefined || param === null) return match;
7370
+ return String(param);
7371
+ });
6841
7372
  }
6842
7373
 
6843
7374
  function buildClientLocalePath(to, localeCode, config) {
@@ -6869,7 +7400,9 @@ function useClientI18n(routeOverride) {
6869
7400
  const dir = computed(() => config.locales.find((entry) => entry.code === locale.value)?.dir || "ltr");
6870
7401
  const t = (key, params = {}) => {
6871
7402
  const value = readClientTranslation(config.messages, locale.value, key) ?? readClientTranslation(config.messages, config.fallbackLocale, key);
6872
- return typeof value === "string" ? interpolateClientTranslation(value, params) : String(key);
7403
+ if (typeof value === "string") return interpolateClientTranslation(value, params);
7404
+ if (typeof value === "number" || typeof value === "boolean") return String(value);
7405
+ return String(key);
6873
7406
  };
6874
7407
  const tm = (key) => readClientTranslation(config.messages, locale.value, key) ?? readClientTranslation(config.messages, config.fallbackLocale, key) ?? key;
6875
7408
  return {
@@ -7617,6 +8150,110 @@ function hashFetchIdentity(value) {
7617
8150
  + (second >>> 0).toString(16).padStart(8, "0");
7618
8151
  }
7619
8152
 
8153
+ function bindTemplateRefs(scope, definition, scopeId) {
8154
+ if (!scope || typeof scope !== "object") return;
8155
+ const refNames = new Set(Array.isArray(definition.templateRefs) ? definition.templateRefs : []);
8156
+ const forRefNames = new Set(Array.isArray(definition.templateForRefs) ? definition.templateForRefs : []);
8157
+ if (Array.isArray(definition.template)) {
8158
+ const collect = (nodes) => {
8159
+ for (const n of nodes) {
8160
+ if (n && n.type === "element") {
8161
+ if (n.ref) refNames.add(n.ref);
8162
+ if (Array.isArray(n.attrs)) {
8163
+ for (const a of n.attrs) {
8164
+ if (a.name === "ref" && a.kind === "static" && a.value) {
8165
+ refNames.add(a.value);
8166
+ }
8167
+ }
8168
+ }
8169
+ if (Array.isArray(n.children)) collect(n.children);
8170
+ }
8171
+ }
8172
+ };
8173
+ collect(definition.template);
8174
+ }
8175
+ const scopeRefPrefix = String(scopeId || "") + ":";
8176
+ if (scopeRefPrefix !== ":" && typeof document !== "undefined" && typeof document.querySelectorAll === "function") {
8177
+ const escapedPrefix = scopeRefPrefix.replace(/["\\]/g, "\\$&");
8178
+ for (const el of document.querySelectorAll('[data-rx-ref^="' + escapedPrefix + '"]')) {
8179
+ const attrVal = el.getAttribute("data-rx-ref");
8180
+ if (attrVal && attrVal.startsWith(scopeRefPrefix)) {
8181
+ const dynamicName = attrVal.slice(scopeRefPrefix.length).trim();
8182
+ if (dynamicName) {
8183
+ refNames.add(dynamicName);
8184
+ }
8185
+ }
8186
+ }
8187
+ }
8188
+
8189
+ for (const refName of refNames) {
8190
+ const target = scope[refName];
8191
+ if (!target || !isRef(target)) continue;
8192
+ if (target.__rx_bound_template_ref) continue;
8193
+ target.__rx_bound_template_ref = true;
8194
+
8195
+ const proto = Object.getPrototypeOf(target);
8196
+ const origDesc = Object.getOwnPropertyDescriptor(target, "value")
8197
+ || (proto ? Object.getOwnPropertyDescriptor(proto, "value") : undefined);
8198
+ const initialValue = target.value;
8199
+ let customValue;
8200
+ let hasCustomValue = false;
8201
+ let warnedMissing = false;
8202
+
8203
+ Object.defineProperty(target, "value", {
8204
+ get() {
8205
+ if (origDesc && typeof origDesc.get === "function") {
8206
+ origDesc.get.call(this);
8207
+ }
8208
+ if (hasCustomValue) {
8209
+ return customValue;
8210
+ }
8211
+ const escapedAttr = String(scopeId + ":" + refName).replace(/["\\]/g, "\\$&");
8212
+ const selector = '[data-rx-ref="' + escapedAttr + '"]';
8213
+ let elements = [];
8214
+ if (typeof document !== "undefined" && typeof document.querySelectorAll === "function") {
8215
+ elements = Array.from(document.querySelectorAll(selector));
8216
+ }
8217
+ if (Array.isArray(initialValue) || forRefNames.has(refName)) {
8218
+ warnedMissing = false;
8219
+ return elements;
8220
+ }
8221
+ if (elements.length === 1) {
8222
+ warnedMissing = false;
8223
+ return elements[0];
8224
+ }
8225
+ if (elements.length > 1) {
8226
+ warnedMissing = false;
8227
+ return elements;
8228
+ }
8229
+ if (!warnedMissing && typeof console !== "undefined" && typeof console.warn === "function" && (typeof process === "undefined" || process.env?.NODE_ENV !== "production")) {
8230
+ warnedMissing = true;
8231
+ const compName = definition?.name ? "<" + definition.name + ">" : "<Component>";
8232
+ console.warn(
8233
+ '[resux:template-ref] Template ref "' + refName + '" could not be resolved in the DOM for component ' +
8234
+ compName + '. Ensure the element is rendered and not removed by v-if.'
8235
+ );
8236
+ }
8237
+ return initialValue ?? null;
8238
+ },
8239
+ set(v) {
8240
+ hasCustomValue = true;
8241
+ customValue = v;
8242
+ if (origDesc && typeof origDesc.set === "function") {
8243
+ origDesc.set.call(this, v);
8244
+ }
8245
+ },
8246
+ configurable: true,
8247
+ enumerable: true
8248
+ });
8249
+ // Effects created during setup read the ref before this binding existed
8250
+ // and saw null. Re-run them now that reads resolve against the live DOM.
8251
+ if (target.dep) {
8252
+ __rxTriggerEffects(target.dep);
8253
+ }
8254
+ }
8255
+ }
8256
+
7620
8257
  export function createClientComponent(definition) {
7621
8258
  return {
7622
8259
  async createScope(serializedScope, route) {
@@ -7648,7 +8285,7 @@ export function createClientComponent(definition) {
7648
8285
  setRegistryValue(
7649
8286
  stateRefs,
7650
8287
  normalizedKey,
7651
- ref(hasValue ? serializedScope.state[normalizedKey] : factory?.())
8288
+ ref(hasValue ? serializedScope.state[normalizedKey] : createClientStateValue(normalizedKey, factory))
7652
8289
  );
7653
8290
  }
7654
8291
  return stateRefs[normalizedKey];
@@ -7788,11 +8425,13 @@ export function createClientComponent(definition) {
7788
8425
  $device: useDevice()
7789
8426
  };
7790
8427
  const scope = await definition.script(setupContext);
8428
+ bindTemplateRefs(scope, definition, serializedScope.id);
7791
8429
  serializedScope.globalStateKeys = [...globalStateKeys];
7792
8430
  await Promise.allSettled(mountedCallbacks.map((callback) => callback()));
7793
8431
  return { scopeId: serializedScope.id, scope, props, stateRefs, globalStateKeys, asyncDataRefs, pendingCompletions };
7794
8432
  },
7795
8433
  async run(scopeRecord, handlerName, event, eventLocals = {}) {
8434
+ bindTemplateRefs(scopeRecord.scope, definition, scopeRecord.scopeId);
7796
8435
  const handler = scopeRecord.scope[handlerName];
7797
8436
  if (typeof handler !== "function") {
7798
8437
  throw new Error("Missing resumable handler " + handlerName + ".");
@@ -10491,7 +11130,7 @@ async function navigateTo(target,options={}){
10491
11130
  else if(!options.preserveScroll&&typeof scrollTo==="function")scrollTo(0,0);
10492
11131
  if(transitionToken===routeTransitionToken){setRouteTransition("complete",{path:routePath});completed=true}
10493
11132
  }catch(error){
10494
- setRouteTransition("error",{path:routePath});dispatchManagedEvent(document,"resux:navigation-error",{path:routePath,message:error instanceof Error?error.message:String(error)});
11133
+ setRouteTransition("error",{path:routePath});dispatchManagedEvent(typeof document !== "undefined" ? document : null,"resux:navigation-error",{path:routePath,message:error instanceof Error?error.message:String(error)});
10495
11134
  }finally{
10496
11135
  styleController?.abort();if(routeStyleNavigationController===styleController)routeStyleNavigationController=null;
10497
11136
  if(!completed&&transitionToken===routeTransitionToken)setRouteTransition("idle",{path:routePath});
@@ -12400,7 +13039,15 @@ function applyHtmlAttrs(attrs){
12400
13039
  if(value===undefined||value===null||value===false){html.removeAttribute(key);continue}
12401
13040
  html.setAttribute(key,String(value));keys.push(key);
12402
13041
  }
12403
- if(!keys.includes("lang")){html.setAttribute("lang","en");keys.push("lang")}
13042
+ if(!keys.includes("lang")){
13043
+ const currentLang = html.getAttribute("lang");
13044
+ if (!currentLang) {
13045
+ html.setAttribute("lang","en");
13046
+ keys.push("lang");
13047
+ } else {
13048
+ keys.push("lang");
13049
+ }
13050
+ }
12404
13051
  html.setAttribute(marker,keys.join(","));
12405
13052
  }
12406
13053
  const VALID_CLIENT_PRELOAD_AS_VALUES=new Set(["audio","document","embed","fetch","font","image","object","script","style","track","video","worker"]);
@@ -12582,7 +13229,47 @@ function applyHead(head) {
12582
13229
  }
12583
13230
 
12584
13231
  for (const style of head.style ?? []) {
12585
- nextEntries.push({ tag: "style", attrs: { "data-rx-style": style.id }, text: style.textContent ?? style.css ?? "" });
13232
+ if (!style) continue;
13233
+ const attrs = {};
13234
+ if (typeof style === "object" && style.id) {
13235
+ attrs["data-rx-style"] = String(style.id);
13236
+ }
13237
+ const text = typeof style === "string"
13238
+ ? style
13239
+ : (style.textContent ?? style.css ?? style.content ?? style.children ?? style.innerHTML ?? "");
13240
+ nextEntries.push({ tag: "style", attrs, text });
13241
+ }
13242
+
13243
+ const scripts = [];
13244
+ const scriptMap = new Map();
13245
+ for (const item of head.script ?? []) {
13246
+ if (!item || typeof item !== "object") continue;
13247
+ const dedupeKey = item.key ?? item.id ?? item.src;
13248
+ if (dedupeKey) {
13249
+ if (scriptMap.has(dedupeKey)) {
13250
+ const existing = scriptMap.get(dedupeKey);
13251
+ const idx = scripts.indexOf(existing);
13252
+ if (idx !== -1) {
13253
+ scripts[idx] = item;
13254
+ }
13255
+ scriptMap.set(dedupeKey, item);
13256
+ } else {
13257
+ scriptMap.set(dedupeKey, item);
13258
+ scripts.push(item);
13259
+ }
13260
+ } else {
13261
+ scripts.push(item);
13262
+ }
13263
+ }
13264
+
13265
+ for (const script of scripts) {
13266
+ const attrs = { ...script };
13267
+ const text = attrs.textContent ?? attrs.innerHTML ?? attrs.children ?? undefined;
13268
+ delete attrs.textContent;
13269
+ delete attrs.innerHTML;
13270
+ delete attrs.children;
13271
+ delete attrs.key;
13272
+ nextEntries.push({ tag: "script", attrs, text: text !== undefined ? String(text) : undefined });
12586
13273
  }
12587
13274
 
12588
13275
  const existing = new Map();
@@ -12605,7 +13292,14 @@ function applyHead(head) {
12605
13292
  const element = document.createElement(entry.tag);
12606
13293
  element.setAttribute("data-rx-head", "true");
12607
13294
  for (const [key, value] of Object.entries(entry.attrs)) {
12608
- element.setAttribute(key, value);
13295
+ if (value === false || value === null || value === undefined) {
13296
+ continue;
13297
+ }
13298
+ if (value === true) {
13299
+ element.setAttribute(key, "");
13300
+ } else {
13301
+ element.setAttribute(key, String(value));
13302
+ }
12609
13303
  }
12610
13304
  if (entry.text !== undefined) {
12611
13305
  element.textContent = entry.text;
@@ -12633,6 +13327,7 @@ function headElementKey(element) {
12633
13327
 
12634
13328
  function headEntryKey(tag, attrs) {
12635
13329
  const normalized = Object.entries(attrs || {})
13330
+ .filter(([_, value]) => value !== undefined && value !== null && value !== false)
12636
13331
  .map(([key, value]) => [key, String(value)])
12637
13332
  .sort(([a], [b]) => a.localeCompare(b));
12638
13333
  return tag + ":" + JSON.stringify(normalized);
@@ -12691,7 +13386,7 @@ async function handleDelegatedEvent(eventName, event) {
12691
13386
  payload.scopes[scopeId].asyncData = serialized.asyncData;
12692
13387
  applyPatches(scopeId, patches);
12693
13388
  } catch (error) {
12694
- dispatchManagedEvent(document, "resux:handler-error", {
13389
+ dispatchManagedEvent(typeof document !== "undefined" ? document : null, "resux:handler-error", {
12695
13390
  event: eventName,
12696
13391
  scopeId,
12697
13392
  handler: handlerName,
@@ -12878,7 +13573,7 @@ function collectPatches(nodes, scope, locals, patches, styleScopeId, scopeId, mo
12878
13573
  : (isClientTeleportBooleanEnabled(value) ? "true" : "")
12879
13574
  });
12880
13575
  }
12881
- } else if (normalizedTag === "transition" || normalizedTag === "transition-group") {
13576
+ } else if (normalizeTransitionBoundaryTagName(node.tag) === "transition" || normalizeTransitionBoundaryTagName(node.tag) === "transition-group") {
12882
13577
  for (const attr of node.attrs) {
12883
13578
  if (attr.name === "name" && attr.kind === "dynamic" && attr.bindingId) {
12884
13579
  patches.push({
@@ -12893,7 +13588,12 @@ function collectPatches(nodes, scope, locals, patches, styleScopeId, scopeId, mo
12893
13588
  for (const attr of node.attrs) {
12894
13589
  if (attr.kind === "dynamic" && attr.bindingId) {
12895
13590
  const attrName = nativeAttributeName(node, attr.name);
12896
- patches.push({ type: "attr", id: attr.bindingId, attr: attrName, value: stringifyAttributeValue(attrName, evaluateExpression(attr.value, scope, locals)) });
13591
+ const attrValue = evaluateExpression(attr.value, scope, locals);
13592
+ patches.push({ type: "attr", id: attr.bindingId, attr: attrName, value: stringifyAttributeValue(attrName, attrValue) });
13593
+ if (attrName === "ref") {
13594
+ const refText = typeof attrValue === "string" ? attrValue.trim() : "";
13595
+ patches.push({ type: "attr", id: attr.bindingId, attr: "data-rx-ref", value: refText ? scopeId + ":" + refText : "" });
13596
+ }
12897
13597
  }
12898
13598
  }
12899
13599
  }
@@ -12954,6 +13654,10 @@ function normalizeClientTransitionName(value) {
12954
13654
  return /^[A-Za-z0-9_-]+$/.test(candidate) ? candidate : "v";
12955
13655
  }
12956
13656
 
13657
+ function normalizeTransitionBoundaryTagName(tag) {
13658
+ return String(tag || "").replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
13659
+ }
13660
+
12957
13661
  function normalizeClientTransitionTag(value) {
12958
13662
  const candidate = String(value || "").trim().toLowerCase();
12959
13663
  if (!candidate || !/^[a-z][a-z0-9-]*$/.test(candidate) || unsafeClientTransitionContainerTags.has(candidate)) {
@@ -12993,8 +13697,9 @@ function renderElement(node, scope, locals, styleScopeId, scopeId, moduleId) {
12993
13697
  const source = "<!--resux-teleport-source:" + metadata + "-->";
12994
13698
  return source + (disabled ? children : "") + "<!--resux-teleport-end-->";
12995
13699
  }
12996
- if (normalizedTag === "transition" || normalizedTag === "transition-group") {
12997
- const group = normalizedTag === "transition-group";
13700
+ const transitionBoundaryTagName = normalizeTransitionBoundaryTagName(node.tag);
13701
+ if (transitionBoundaryTagName === "transition" || transitionBoundaryTagName === "transition-group") {
13702
+ const group = transitionBoundaryTagName === "transition-group";
12998
13703
  const nameAttr = node.attrs.find((attr) => attr.name === "name");
12999
13704
  const rawName = nameAttr
13000
13705
  ? (nameAttr.kind === "static" ? nameAttr.value : evaluateExpression(nameAttr.value, scope, locals))
@@ -13029,19 +13734,20 @@ function renderElement(node, scope, locals, styleScopeId, scopeId, moduleId) {
13029
13734
  return "<" + tag + " " + attrs.join(" ") + ">" + children + "</" + tag + ">";
13030
13735
  }
13031
13736
  if (node.tag === "ResuxImg") {
13032
- return renderClientResuxImg(node, scope, locals, styleScopeId);
13737
+ return renderClientResuxImg(node, scope, locals, styleScopeId, scopeId);
13033
13738
  }
13034
13739
  if (node.tag === "ResuxPicture") {
13035
- return renderClientResuxPicture(node, scope, locals, styleScopeId);
13740
+ return renderClientResuxPicture(node, scope, locals, styleScopeId, scopeId);
13036
13741
  }
13037
13742
  if (node.tag === "ResuxVideo") {
13038
- return renderClientResuxVideo(node, scope, locals, styleScopeId);
13743
+ return renderClientResuxVideo(node, scope, locals, styleScopeId, scopeId);
13039
13744
  }
13040
13745
  if (node.tag === "ClientEnhance" || node.tag === "ResuxClientEnhance") {
13041
13746
  return renderClientResuxClientEnhance(node, scope, locals, styleScopeId);
13042
13747
  }
13043
13748
  const tag = nativeElementTag(node);
13044
13749
  const attrs = [];
13750
+ let resolvedRef;
13045
13751
  for (const attr of node.attrs) {
13046
13752
  const attrName = nativeAttributeName(node, attr.name);
13047
13753
  if (attr.kind === "static") {
@@ -13051,18 +13757,27 @@ function renderElement(node, scope, locals, styleScopeId, scopeId, moduleId) {
13051
13757
  if (attr.bindingId) {
13052
13758
  attrs.push('data-rx-attr-' + attr.bindingId + '="' + scopeId + ':' + attr.bindingId + '"');
13053
13759
  }
13760
+ if (attrName === "ref" && typeof value === "string" && value.trim()) {
13761
+ resolvedRef = value.trim();
13762
+ }
13054
13763
  const isViewTransitionAttr = attrName === "data-view-transition" || attrName === "view-transition";
13055
13764
  if (value !== null && value !== undefined && (value !== false || isViewTransitionAttr)) {
13056
13765
  attrs.push(attrName + '="' + escapeAttribute(stringifyAttributeValue(attrName, value)) + '"');
13057
13766
  }
13058
13767
  }
13059
13768
  }
13769
+ const effectiveRef = resolvedRef || node.ref;
13770
+ if (effectiveRef) {
13771
+ attrs.push('data-rx-ref="' + escapeAttribute(scopeId + ':' + effectiveRef) + '"');
13772
+ }
13060
13773
  for (const event of node.events) {
13061
13774
  attrs.push('data-rx-on-' + event.name + '="' + scopeId + ':' + moduleId + ':' + event.handler + '"');
13062
13775
  if (event.locals && event.locals.length) {
13063
13776
  const eventLocals = {};
13064
13777
  for (const name of event.locals) {
13065
- if (Object.prototype.hasOwnProperty.call(locals, name)) eventLocals[name] = locals[name];
13778
+ if (!Object.prototype.hasOwnProperty.call(locals, name)) continue;
13779
+ if (locals[name] !== undefined) assertJsonSerializableInDev(locals[name], 'event local "' + name + '"');
13780
+ eventLocals[name] = locals[name];
13066
13781
  }
13067
13782
  attrs.push('data-rx-locals-' + event.name + '=\"' + escapeAttribute(JSON.stringify(eventLocals)) + '\"');
13068
13783
  }
@@ -13192,6 +13907,14 @@ function formatClientVideoSkipDuration(seconds) {
13192
13907
  return Number.isInteger(normalized) ? String(Math.trunc(normalized)) + "s" : String(normalized) + "s";
13193
13908
  }
13194
13909
 
13910
+ function normalizeClientEnhanceTag(value) {
13911
+ const candidate = String(value || "section").trim().toLowerCase();
13912
+ if (!candidate || !/^[a-z][a-z0-9-]*$/.test(candidate) || unsafeClientTransitionContainerTags.has(candidate)) {
13913
+ return "section";
13914
+ }
13915
+ return candidate;
13916
+ }
13917
+
13195
13918
  function renderClientResuxClientEnhance(node, scope, locals, styleScopeId) {
13196
13919
  const props = {};
13197
13920
  for (const attr of node.attrs) {
@@ -13224,13 +13947,13 @@ function renderClientResuxClientEnhance(node, scope, locals, styleScopeId) {
13224
13947
  const aspectRatio = String(props.aspectRatio || "").trim();
13225
13948
  const noCls = props.noCls === true || props.noCls === "true" || props.noCls === "";
13226
13949
  const demo = String(props.demo || name).trim();
13227
- const tag = String(props.as || "section").trim();
13950
+ const tag = normalizeClientEnhanceTag(props.as);
13228
13951
 
13229
13952
  const styles = [];
13230
13953
  if (reserveHeight) styles.push("min-height: " + reserveHeight + ";");
13231
13954
  if (reserveWidth) styles.push("min-width: " + reserveWidth + ";");
13232
13955
  if (aspectRatio) styles.push("aspect-ratio: " + aspectRatio + ";");
13233
- const styleAttr = styles.length ? " style=\"" + styles.join(" ") + "\"" : "";
13956
+ const styleAttr = styles.length ? " style=\"" + escapeAttribute(styles.join(" ")) + "\"" : "";
13234
13957
 
13235
13958
  const attrs = [
13236
13959
  "data-resux-enhancement=\"" + escapeAttribute(name) + "\"",
@@ -13279,7 +14002,7 @@ function appendClientDeferredVideoPoster(attrs, placeholderSrc, poster, deferLaz
13279
14002
  }
13280
14003
  }
13281
14004
 
13282
- function renderClientResuxVideo(node, scope, locals, styleScopeId) {
14005
+ function renderClientResuxVideo(node, scope, locals, styleScopeId, scopeId) {
13283
14006
  const props = {};
13284
14007
  for (const attr of node.attrs) {
13285
14008
  const normalizedName = attr.name.replace(/-([a-zA-Z0-9])/g, (_, char) => char.toUpperCase());
@@ -13665,6 +14388,10 @@ function renderClientResuxVideo(node, scope, locals, styleScopeId) {
13665
14388
  if (styleParts.length > 0) {
13666
14389
  attrs.push('style="' + escapeAttribute(styleParts.join("; ")) + '"');
13667
14390
  }
14391
+ const clientVideoRef = readClientStringProp(props.ref) || node.ref;
14392
+ if (clientVideoRef && scopeId) {
14393
+ attrs.push('data-rx-ref="' + escapeAttribute(scopeId + ':' + clientVideoRef) + '"');
14394
+ }
13668
14395
  if (styleScopeId) {
13669
14396
  attrs.push(styleScopeId + '=""');
13670
14397
  }
@@ -13833,8 +14560,8 @@ function renderClientResuxVideo(node, scope, locals, styleScopeId) {
13833
14560
  return "<div " + shellAttrs.join(" ") + "><div class=\"resux-video__stage\" data-rx-video-stage data-rx-video-custom-controls=\"" + (customControls ? "true" : "false") + "\">" + videoMarkup + interactionZonesMarkup + controlsMarkup + "</div></div>";
13834
14561
  }
13835
14562
 
13836
- function renderClientResuxImg(node, scope, locals, styleScopeId) {
13837
- const input = resolveClientImageRenderInput(node, scope, locals);
14563
+ function renderClientResuxImg(node, scope, locals, styleScopeId, scopeId) {
14564
+ const input = resolveClientImageRenderInput(node, scope, locals, scopeId);
13838
14565
  if (!input.src) {
13839
14566
  return "";
13840
14567
  }
@@ -13855,8 +14582,8 @@ function renderClientResuxImg(node, scope, locals, styleScopeId) {
13855
14582
  return renderClientResuxImgTag(input, src, srcset, styleScopeId);
13856
14583
  }
13857
14584
 
13858
- function renderClientResuxPicture(node, scope, locals, styleScopeId) {
13859
- const input = resolveClientImageRenderInput(node, scope, locals);
14585
+ function renderClientResuxPicture(node, scope, locals, styleScopeId, scopeId) {
14586
+ const input = resolveClientImageRenderInput(node, scope, locals, scopeId);
13860
14587
  if (!input.src) {
13861
14588
  return "";
13862
14589
  }
@@ -13972,7 +14699,7 @@ function renderClientResuxPicture(node, scope, locals, styleScopeId) {
13972
14699
  return "<picture" + attrText + ">" + manualChildren + generatedSources + img + "</picture>";
13973
14700
  }
13974
14701
 
13975
- function resolveClientImageRenderInput(node, scope, locals) {
14702
+ function resolveClientImageRenderInput(node, scope, locals, scopeId) {
13976
14703
  const props = {};
13977
14704
  for (const attr of node.attrs) {
13978
14705
  const normalizedName = attr.name.replace(/-([a-zA-Z0-9])/g, (_, char) => char.toUpperCase());
@@ -14041,7 +14768,10 @@ function resolveClientImageRenderInput(node, scope, locals) {
14041
14768
  placeholderStyle: readClientStringProp(props.placeholderStyle),
14042
14769
  fallbackSrc: readClientStringProp(props.fallbackSrc ?? props.fallback),
14043
14770
  modifiers,
14044
- attrs: collectClientImageAttrs(props),
14771
+ attrs: Object.assign(
14772
+ collectClientImageAttrs(props),
14773
+ (readClientStringProp(props.ref) || node.ref) && scopeId ? { "data-rx-ref": scopeId + ":" + (readClientStringProp(props.ref) || node.ref) } : {}
14774
+ ),
14045
14775
  preload,
14046
14776
  deferLazy,
14047
14777
  lazyRootMargin,
@@ -15369,6 +16099,27 @@ function assertJsonSerializable(value, label) {
15369
16099
  }
15370
16100
  }
15371
16101
 
16102
+ function isClientDevMode() {
16103
+ if (!isClientRuntime()) {
16104
+ return false;
16105
+ }
16106
+ return Boolean(import.meta && import.meta.env && import.meta.env.DEV) || Boolean(window.__RESUX_DEV_RELOAD__);
16107
+ }
16108
+
16109
+ // Mirrors the server's assertJsonSerializable checks for client-created state
16110
+ // and event locals, but only in dev so production pays no extra serialization.
16111
+ function assertJsonSerializableInDev(value, label) {
16112
+ if (isClientDevMode()) {
16113
+ assertJsonSerializable(value, label);
16114
+ }
16115
+ }
16116
+
16117
+ function createClientStateValue(key, factory) {
16118
+ const value = factory?.();
16119
+ assertJsonSerializableInDev(value, 'useState("' + key + '")');
16120
+ return value;
16121
+ }
16122
+
15372
16123
  function cloneJsonSerializable(value, label) {
15373
16124
  assertJsonSerializable(value, label);
15374
16125
  return JSON.parse(JSON.stringify(value));
@@ -15619,6 +16370,6 @@ function escapeAttribute(value) {
15619
16370
  if (value === null || value === void 0) return "";
15620
16371
  return escapeHtml(value).replaceAll("\"", "&quot;");
15621
16372
  }
15622
- export { AsyncResuxRenderer, abortNavigation, clearError, computed, createError, createServerSetupContext, defineClientEnhancement, defineClientOnlyPackage, defineComponent, defineEventHandler, defineLazyPackage, definePackageAdapter, defineResuxConfig, defineResuxModule, defineResuxPlugin, defineResuxRouteMiddleware, defineServerMiddleware, disposeClientEnhancements, evaluateExpression, eventHandler, getClientEnhancement, getClientRuntimeBootPlan, getClientRuntimeSource, getQuery, hasClientEnhancement, isReactive, isReadonly, isRef, navigateTo, nextTick, parseUserAgent, reactive, readBody, readonly, ref, renderApp, renderAppAsync, renderClientPatches, renderDocument, renderTemplateNodesAsync, scanClientEnhancements, setHeader, shouldLoadClientRuntime, showError, toRef, toRefs, unref, useClientEnhancement, useClientPackage, useDevice, useError, useLazyPackage, usePackageReady, useResuxApp, useResuxImage, useRoute, useRouter, useRuntimeConfig, useViewTransition, watch, watchEffect };
16373
+ export { AsyncResuxRenderer, abortNavigation, clearError, computed, createError, createServerSetupContext, defineClientEnhancement, defineClientOnlyPackage, defineComponent, defineEventHandler, defineLazyPackage, definePackageAdapter, defineResuxConfig, defineResuxModule, defineResuxPlugin, defineResuxRouteMiddleware, defineServerMiddleware, disposeClientEnhancements, evaluateExpression, eventHandler, getClientEnhancement, getClientRuntimeBootPlan, getClientRuntimeSource, getQuery, hasClientEnhancement, isReactive, isReadonly, isRef, navigateTo, nextTick, parseUserAgent, reactive, readBody, readonly, ref, renderApp, renderAppAsync, renderClientPatches, renderDocument, renderDocumentAsync, renderTemplateNodesAsync, scanClientEnhancements, setHeader, shouldLoadClientRuntime, showError, toRef, toRefs, unref, useClientEnhancement, useClientPackage, useDevice, useError, useLazyPackage, usePackageReady, useResuxApp, useResuxImage, useRoute, useRouter, useRuntimeConfig, useViewTransition, watch, watchEffect };
15623
16374
 
15624
16375
  //# sourceMappingURL=index.js.map