eclipsa 0.1.10 → 0.1.12

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.
@@ -1,4 +1,4 @@
1
- import { a as jsxDEV, i as isSSRTemplate, n as isSSRAttrValue, r as isSSRRawValue } from "./jsx-dev-runtime-DpbWQ4Q0.mjs";
1
+ import { a as jsxDEV, i as isSSRTemplate, n as isSSRAttrValue, r as isSSRRawValue } from "./jsx-dev-runtime-BZ-o1aUQ.mjs";
2
2
  //#region \0rolldown/runtime.js
3
3
  var __defProp = Object.defineProperty;
4
4
  var __exportAll = (all, no_symbols) => {
@@ -913,6 +913,262 @@ const __eclipsaLoader = (id, middlewares, handler) => {
913
913
  }, id));
914
914
  };
915
915
  //#endregion
916
+ //#region core/runtime/constants.ts
917
+ const CONTAINER_STACK_KEY = Symbol.for("eclipsa.container-stack");
918
+ const CONTEXT_VALUE_STACK_KEY = Symbol.for("eclipsa.context-value-stack");
919
+ const FRAME_STACK_KEY = Symbol.for("eclipsa.frame-stack");
920
+ const DIRTY_FLUSH_PROMISE_KEY = Symbol.for("eclipsa.dirty-flush-promise");
921
+ const ASYNC_SIGNAL_SNAPSHOT_CACHE_KEY = Symbol.for("eclipsa.async-signal-snapshot-cache");
922
+ const STANDALONE_SIGNAL_ID_KEY = Symbol.for("eclipsa.standalone-signal-id");
923
+ const ACTION_FORM_ATTR$1 = "data-e-action-form";
924
+ const ROUTER_EVENT_STATE_KEY = Symbol.for("eclipsa.router-event-state");
925
+ const ROUTER_CURRENT_PATH_SIGNAL_ID = "$router:path";
926
+ const ROUTER_CURRENT_URL_SIGNAL_ID = "$router:url";
927
+ const ROUTER_IS_NAVIGATING_SIGNAL_ID = "$router:isNavigating";
928
+ const ROUTER_LINK_BOUND_KEY = Symbol.for("eclipsa.router-link-bound");
929
+ const ROUTER_LINK_PREFETCH_BOUND_KEY = Symbol.for("eclipsa.router-link-prefetch-bound");
930
+ const ROUTE_NOT_FOUND_KEY = Symbol.for("eclipsa.route-not-found");
931
+ const ROUTE_PARAMS_PROP = "__eclipsa_route_params";
932
+ const ROUTE_ERROR_PROP = "__eclipsa_route_error";
933
+ const ROUTE_SLOT_ROUTE_KEY = Symbol.for("eclipsa.route-slot-route");
934
+ const RESUME_CONTAINERS_KEY = Symbol.for("eclipsa.resume-containers");
935
+ const RESUME_STATE_ELEMENT_ID = "eclipsa-resume";
936
+ const RESUME_FINAL_STATE_ELEMENT_ID = "eclipsa-resume-final";
937
+ const SCOPED_STYLE_ATTR = "data-e-scope";
938
+ const ROOT_COMPONENT_ID = "$root";
939
+ const SUSPENSE_COMPONENT_SYMBOL = "$suspense";
940
+ const ROUTE_SLOT_TYPE = "route-slot";
941
+ const PROJECTION_SLOT_TYPE = "projection-slot";
942
+ const CONTAINER_ID_KEY = Symbol.for("eclipsa.runtime-container-id");
943
+ const RENDER_COMPONENT_TYPE_KEY = Symbol.for("eclipsa.render-component-type");
944
+ const RENDER_REFERENCE_KIND = "render";
945
+ const REF_SIGNAL_ATTR = "data-e-ref";
946
+ const STREAM_STATE_KEY = "__eclipsa_stream";
947
+ const PENDING_RESUME_LINK_KEY = "__eclipsa_pending_route_link";
948
+ const BIND_VALUE_ATTR = "data-e-bind-value";
949
+ const BIND_CHECKED_ATTR = "data-e-bind-checked";
950
+ const CLIENT_INSERT_OWNER_SYMBOL = "$client-insert-root";
951
+ const CLIENT_INSERT_OWNER_ID_PREFIX = "$insert:";
952
+ const EXTERNAL_ROOT_ATTR = "data-e-external-root";
953
+ const EXTERNAL_ROOT_COMPONENT_ATTR = "data-e-external-component";
954
+ const EXTERNAL_ROOT_KIND_ATTR = "data-e-external-kind";
955
+ const getExternalSlotTag = (_kind) => "e-slot-host";
956
+ //#endregion
957
+ //#region core/runtime/routes.ts
958
+ const normalizeRoutePath = (pathname) => {
959
+ const normalizedPath = pathname.trim() || "/";
960
+ const withLeadingSlash = normalizedPath.startsWith("/") ? normalizedPath : `/${normalizedPath}`;
961
+ if (withLeadingSlash.length > 1 && withLeadingSlash.endsWith("/")) return withLeadingSlash.slice(0, -1);
962
+ return withLeadingSlash;
963
+ };
964
+ const parseLocationHref = (href) => new URL(href, "http://localhost");
965
+ const createStandaloneLocation = () => ({
966
+ get hash() {
967
+ return typeof window === "undefined" ? "" : window.location.hash;
968
+ },
969
+ get href() {
970
+ return typeof window === "undefined" ? "/" : window.location.href;
971
+ },
972
+ get pathname() {
973
+ return typeof window === "undefined" ? "/" : normalizeRoutePath(window.location.pathname);
974
+ },
975
+ get search() {
976
+ return typeof window === "undefined" ? "" : window.location.search;
977
+ }
978
+ });
979
+ const createRouterLocation = (router) => ({
980
+ get hash() {
981
+ return parseLocationHref(router.currentUrl.value).hash;
982
+ },
983
+ get href() {
984
+ return router.currentUrl.value;
985
+ },
986
+ get pathname() {
987
+ return normalizeRoutePath(parseLocationHref(router.currentUrl.value).pathname);
988
+ },
989
+ get search() {
990
+ return parseLocationHref(router.currentUrl.value).search;
991
+ }
992
+ });
993
+ const EMPTY_ROUTE_PARAMS = Object.freeze({});
994
+ const ROUTE_DOCUMENT_FALLBACK = Object.freeze({
995
+ document: true,
996
+ ok: false
997
+ });
998
+ const decodeRoutePathSegment = (segment) => {
999
+ try {
1000
+ return decodeURIComponent(segment);
1001
+ } catch {
1002
+ return segment;
1003
+ }
1004
+ };
1005
+ const splitRawRoutePath = (pathname) => normalizeRoutePath(pathname).split("/").filter(Boolean);
1006
+ const splitRoutePath = (pathname) => splitRawRoutePath(pathname).map(decodeRoutePathSegment);
1007
+ const matchRouteSegments = (segments, pathnameSegments, routeIndex = 0, pathIndex = 0, params = {}) => {
1008
+ if (routeIndex >= segments.length) return pathIndex >= pathnameSegments.length ? params : null;
1009
+ const segment = segments[routeIndex];
1010
+ switch (segment.kind) {
1011
+ case "static":
1012
+ if (pathnameSegments[pathIndex] !== segment.value) return null;
1013
+ return matchRouteSegments(segments, pathnameSegments, routeIndex + 1, pathIndex + 1, params);
1014
+ case "required":
1015
+ if (pathIndex >= pathnameSegments.length) return null;
1016
+ return matchRouteSegments(segments, pathnameSegments, routeIndex + 1, pathIndex + 1, {
1017
+ ...params,
1018
+ [segment.value]: pathnameSegments[pathIndex]
1019
+ });
1020
+ case "optional": {
1021
+ const consumed = pathIndex < pathnameSegments.length ? matchRouteSegments(segments, pathnameSegments, routeIndex + 1, pathIndex + 1, {
1022
+ ...params,
1023
+ [segment.value]: pathnameSegments[pathIndex]
1024
+ }) : null;
1025
+ if (consumed) return consumed;
1026
+ return matchRouteSegments(segments, pathnameSegments, routeIndex + 1, pathIndex, {
1027
+ ...params,
1028
+ [segment.value]: void 0
1029
+ });
1030
+ }
1031
+ case "rest": {
1032
+ const rest = pathnameSegments.slice(pathIndex);
1033
+ if (rest.length === 0) return null;
1034
+ return matchRouteSegments(segments, pathnameSegments, segments.length, pathnameSegments.length, {
1035
+ ...params,
1036
+ [segment.value]: rest
1037
+ });
1038
+ }
1039
+ }
1040
+ };
1041
+ const matchRouteManifest = (manifest, pathname) => {
1042
+ const normalizedPath = normalizeRoutePath(pathname);
1043
+ const pathnameSegments = splitRoutePath(normalizedPath);
1044
+ for (const entry of manifest) {
1045
+ const params = matchRouteSegments(entry.segments, pathnameSegments);
1046
+ if (params) return {
1047
+ entry,
1048
+ params,
1049
+ pathname: normalizedPath
1050
+ };
1051
+ }
1052
+ return null;
1053
+ };
1054
+ const scoreSpecialManifestEntry = (entry, pathname) => {
1055
+ const pathSegments = splitRoutePath(pathname);
1056
+ let score = 0;
1057
+ for (let index = 0; index < entry.segments.length && index < pathSegments.length; index += 1) {
1058
+ const segment = entry.segments[index];
1059
+ const pathnameSegment = pathSegments[index];
1060
+ if (segment.kind === "static") {
1061
+ if (segment.value !== pathnameSegment) break;
1062
+ score += 10;
1063
+ continue;
1064
+ }
1065
+ score += segment.kind === "rest" ? 1 : 2;
1066
+ if (segment.kind === "rest") break;
1067
+ }
1068
+ return score;
1069
+ };
1070
+ const findSpecialManifestEntry = (manifest, pathname, kind) => {
1071
+ const normalizedPath = normalizeRoutePath(pathname);
1072
+ const matched = matchRouteManifest(manifest, normalizedPath);
1073
+ if (matched?.entry[kind]) return matched;
1074
+ const rawPathSegments = splitRawRoutePath(normalizedPath);
1075
+ for (let length = rawPathSegments.length - 1; length >= 0; length -= 1) {
1076
+ const candidate = matchRouteManifest(manifest, length === 0 ? "/" : `/${rawPathSegments.slice(0, length).join("/")}`);
1077
+ if (candidate?.entry[kind]) return candidate;
1078
+ }
1079
+ let best = null;
1080
+ let bestScore = -1;
1081
+ for (const entry of manifest) {
1082
+ if (!entry[kind]) continue;
1083
+ const score = scoreSpecialManifestEntry(entry, pathname);
1084
+ if (score > bestScore) {
1085
+ best = {
1086
+ entry,
1087
+ params: EMPTY_ROUTE_PARAMS,
1088
+ pathname: normalizedPath
1089
+ };
1090
+ bestScore = score;
1091
+ }
1092
+ }
1093
+ return best;
1094
+ };
1095
+ const resolvePageRouteMatch = (manifest, pathname) => {
1096
+ const matched = matchRouteManifest(manifest, pathname);
1097
+ return matched?.entry.page ? matched : null;
1098
+ };
1099
+ const resolveNotFoundRouteMatch = (manifest, pathname) => {
1100
+ const matched = findSpecialManifestEntry(manifest, pathname, "notFound");
1101
+ return matched?.entry.notFound ? matched : null;
1102
+ };
1103
+ const resolveRoutableMatch = (manifest, pathname) => {
1104
+ const matched = matchRouteManifest(manifest, pathname);
1105
+ if (matched?.entry.page) return {
1106
+ kind: "page",
1107
+ matched
1108
+ };
1109
+ if (matched) return null;
1110
+ const notFoundMatch = resolveNotFoundRouteMatch(manifest, pathname);
1111
+ if (!notFoundMatch) return null;
1112
+ return {
1113
+ kind: "not-found",
1114
+ matched: notFoundMatch
1115
+ };
1116
+ };
1117
+ const resolveCurrentRouteManifestEntry = (router) => {
1118
+ const currentPath = normalizeRoutePath(router.currentPath.value);
1119
+ const matched = matchRouteManifest(router.manifest, currentPath);
1120
+ if (matched?.entry.page) return matched.entry;
1121
+ return findSpecialManifestEntry(router.manifest, currentPath, "notFound")?.entry ?? null;
1122
+ };
1123
+ const getRouteModuleUrl = (entry, variant = "page") => variant === "page" ? entry.page : variant === "loading" ? entry.loading : variant === "error" ? entry.error : entry.notFound;
1124
+ const isRouteDataSuccess = (body) => body.ok === true && typeof body.finalHref === "string" && typeof body.finalPathname === "string" && (body.kind === "page" || body.kind === "not-found") && !!body.loaders && typeof body.loaders === "object";
1125
+ const isRouteSlot = (value) => typeof value === "object" && value !== null && "__eclipsa_type" in value && value.__eclipsa_type === "route-slot";
1126
+ const createRouteSlot = (route, startLayoutIndex) => {
1127
+ const slot = {
1128
+ __eclipsa_type: ROUTE_SLOT_TYPE,
1129
+ pathname: route.pathname,
1130
+ startLayoutIndex
1131
+ };
1132
+ Object.defineProperty(slot, ROUTE_SLOT_ROUTE_KEY, {
1133
+ configurable: true,
1134
+ enumerable: false,
1135
+ value: route,
1136
+ writable: true
1137
+ });
1138
+ return slot;
1139
+ };
1140
+ const resolveRouteSlot = (container, slot) => {
1141
+ const route = slot[ROUTE_SLOT_ROUTE_KEY] ?? container?.router?.loadedRoutes.get(routeCacheKey(slot.pathname, "page"));
1142
+ if (!route) return null;
1143
+ return createRouteElement(route, slot.startLayoutIndex);
1144
+ };
1145
+ const defineHiddenRouteProp = (props, key, value) => {
1146
+ Object.defineProperty(props, key, {
1147
+ configurable: true,
1148
+ enumerable: false,
1149
+ value,
1150
+ writable: true
1151
+ });
1152
+ };
1153
+ const createRouteRenderProps = (route, props) => {
1154
+ const nextProps = { ...props };
1155
+ defineHiddenRouteProp(nextProps, ROUTE_PARAMS_PROP, route.params);
1156
+ defineHiddenRouteProp(nextProps, ROUTE_ERROR_PROP, route.error);
1157
+ return nextProps;
1158
+ };
1159
+ const createRouteElement = (route, startLayoutIndex = 0) => {
1160
+ if (startLayoutIndex >= route.layouts.length) return jsxDEV(route.page.renderer, createRouteRenderProps(route, {}), null, false, {});
1161
+ let children = null;
1162
+ for (let index = route.layouts.length - 1; index >= startLayoutIndex; index -= 1) {
1163
+ const layout = route.layouts[index];
1164
+ children = jsxDEV(layout.renderer, createRouteRenderProps(route, { children: createRouteSlot(route, index + 1) }), null, false, {});
1165
+ }
1166
+ return children;
1167
+ };
1168
+ const routeCacheKey = (pathname, variant = "page") => `${normalizeRoutePath(pathname)}::${variant}`;
1169
+ const routePrefetchKey = (url) => `${normalizeRoutePath(url.pathname)}${url.search}`;
1170
+ const isLoaderSignalId = (id) => id.startsWith("$loader:");
1171
+ //#endregion
916
1172
  //#region core/internal.ts
917
1173
  const COMPONENT_META_KEY = Symbol.for("eclipsa.component-meta");
918
1174
  const EXTERNAL_COMPONENT_META_KEY = Symbol.for("eclipsa.external-component-meta");
@@ -1108,61 +1364,20 @@ const getEventMeta = (value) => {
1108
1364
  if (typeof descriptor.symbol === "string" && typeof descriptor.captures === "function") return descriptor;
1109
1365
  }
1110
1366
  return getLazyMeta(value);
1111
- };
1112
- const setSignalMeta = (target, meta) => {
1113
- Object.defineProperty(target, SIGNAL_META_KEY, {
1114
- configurable: true,
1115
- enumerable: false,
1116
- value: meta,
1117
- writable: true
1118
- });
1119
- return target;
1120
- };
1121
- const getSignalMeta = (value) => {
1122
- if (!value || typeof value !== "object") return null;
1123
- return value[SIGNAL_META_KEY] ?? null;
1124
- };
1125
- //#endregion
1126
- //#region core/runtime/constants.ts
1127
- const CONTAINER_STACK_KEY = Symbol.for("eclipsa.container-stack");
1128
- const CONTEXT_VALUE_STACK_KEY = Symbol.for("eclipsa.context-value-stack");
1129
- const FRAME_STACK_KEY = Symbol.for("eclipsa.frame-stack");
1130
- const DIRTY_FLUSH_PROMISE_KEY = Symbol.for("eclipsa.dirty-flush-promise");
1131
- const ASYNC_SIGNAL_SNAPSHOT_CACHE_KEY = Symbol.for("eclipsa.async-signal-snapshot-cache");
1132
- const STANDALONE_SIGNAL_ID_KEY = Symbol.for("eclipsa.standalone-signal-id");
1133
- const ACTION_FORM_ATTR$1 = "data-e-action-form";
1134
- const ROUTER_EVENT_STATE_KEY = Symbol.for("eclipsa.router-event-state");
1135
- const ROUTER_CURRENT_PATH_SIGNAL_ID = "$router:path";
1136
- const ROUTER_CURRENT_URL_SIGNAL_ID = "$router:url";
1137
- const ROUTER_IS_NAVIGATING_SIGNAL_ID = "$router:isNavigating";
1138
- const ROUTER_LINK_BOUND_KEY = Symbol.for("eclipsa.router-link-bound");
1139
- const ROUTER_LINK_PREFETCH_BOUND_KEY = Symbol.for("eclipsa.router-link-prefetch-bound");
1140
- const ROUTE_NOT_FOUND_KEY = Symbol.for("eclipsa.route-not-found");
1141
- const ROUTE_PARAMS_PROP = "__eclipsa_route_params";
1142
- const ROUTE_ERROR_PROP = "__eclipsa_route_error";
1143
- const ROUTE_SLOT_ROUTE_KEY = Symbol.for("eclipsa.route-slot-route");
1144
- const RESUME_CONTAINERS_KEY = Symbol.for("eclipsa.resume-containers");
1145
- const RESUME_STATE_ELEMENT_ID = "eclipsa-resume";
1146
- const RESUME_FINAL_STATE_ELEMENT_ID = "eclipsa-resume-final";
1147
- const SCOPED_STYLE_ATTR = "data-e-scope";
1148
- const ROOT_COMPONENT_ID = "$root";
1149
- const SUSPENSE_COMPONENT_SYMBOL = "$suspense";
1150
- const ROUTE_SLOT_TYPE = "route-slot";
1151
- const PROJECTION_SLOT_TYPE = "projection-slot";
1152
- const CONTAINER_ID_KEY = Symbol.for("eclipsa.runtime-container-id");
1153
- const RENDER_COMPONENT_TYPE_KEY = Symbol.for("eclipsa.render-component-type");
1154
- const RENDER_REFERENCE_KIND = "render";
1155
- const REF_SIGNAL_ATTR = "data-e-ref";
1156
- const STREAM_STATE_KEY = "__eclipsa_stream";
1157
- const PENDING_RESUME_LINK_KEY = "__eclipsa_pending_route_link";
1158
- const BIND_VALUE_ATTR = "data-e-bind-value";
1159
- const BIND_CHECKED_ATTR = "data-e-bind-checked";
1160
- const CLIENT_INSERT_OWNER_SYMBOL = "$client-insert-root";
1161
- const CLIENT_INSERT_OWNER_ID_PREFIX = "$insert:";
1162
- const EXTERNAL_ROOT_ATTR = "data-e-external-root";
1163
- const EXTERNAL_ROOT_COMPONENT_ATTR = "data-e-external-component";
1164
- const EXTERNAL_ROOT_KIND_ATTR = "data-e-external-kind";
1165
- const getExternalSlotTag = (_kind) => "e-slot-host";
1367
+ };
1368
+ const setSignalMeta = (target, meta) => {
1369
+ Object.defineProperty(target, SIGNAL_META_KEY, {
1370
+ configurable: true,
1371
+ enumerable: false,
1372
+ value: meta,
1373
+ writable: true
1374
+ });
1375
+ return target;
1376
+ };
1377
+ const getSignalMeta = (value) => {
1378
+ if (!value || typeof value !== "object") return null;
1379
+ return value[SIGNAL_META_KEY] ?? null;
1380
+ };
1166
1381
  //#endregion
1167
1382
  //#region core/runtime/dom.ts
1168
1383
  const managedElementAttributes = /* @__PURE__ */ new WeakMap();
@@ -1448,221 +1663,6 @@ const writeAsyncSignalSnapshot$1 = (id, value, container) => {
1448
1663
  if (!container) getAsyncSignalSnapshotCache().set(id, value);
1449
1664
  };
1450
1665
  //#endregion
1451
- //#region core/runtime/routes.ts
1452
- const normalizeRoutePath = (pathname) => {
1453
- const normalizedPath = pathname.trim() || "/";
1454
- const withLeadingSlash = normalizedPath.startsWith("/") ? normalizedPath : `/${normalizedPath}`;
1455
- if (withLeadingSlash.length > 1 && withLeadingSlash.endsWith("/")) return withLeadingSlash.slice(0, -1);
1456
- return withLeadingSlash;
1457
- };
1458
- const parseLocationHref = (href) => new URL(href, "http://localhost");
1459
- const createStandaloneLocation = () => ({
1460
- get hash() {
1461
- return typeof window === "undefined" ? "" : window.location.hash;
1462
- },
1463
- get href() {
1464
- return typeof window === "undefined" ? "/" : window.location.href;
1465
- },
1466
- get pathname() {
1467
- return typeof window === "undefined" ? "/" : normalizeRoutePath(window.location.pathname);
1468
- },
1469
- get search() {
1470
- return typeof window === "undefined" ? "" : window.location.search;
1471
- }
1472
- });
1473
- const createRouterLocation = (router) => ({
1474
- get hash() {
1475
- return parseLocationHref(router.currentUrl.value).hash;
1476
- },
1477
- get href() {
1478
- return router.currentUrl.value;
1479
- },
1480
- get pathname() {
1481
- return normalizeRoutePath(parseLocationHref(router.currentUrl.value).pathname);
1482
- },
1483
- get search() {
1484
- return parseLocationHref(router.currentUrl.value).search;
1485
- }
1486
- });
1487
- const EMPTY_ROUTE_PARAMS = Object.freeze({});
1488
- const ROUTE_DOCUMENT_FALLBACK = Object.freeze({
1489
- document: true,
1490
- ok: false
1491
- });
1492
- const decodeRoutePathSegment = (segment) => {
1493
- try {
1494
- return decodeURIComponent(segment);
1495
- } catch {
1496
- return segment;
1497
- }
1498
- };
1499
- const splitRawRoutePath = (pathname) => normalizeRoutePath(pathname).split("/").filter(Boolean);
1500
- const splitRoutePath = (pathname) => splitRawRoutePath(pathname).map(decodeRoutePathSegment);
1501
- const matchRouteSegments = (segments, pathnameSegments, routeIndex = 0, pathIndex = 0, params = {}) => {
1502
- if (routeIndex >= segments.length) return pathIndex >= pathnameSegments.length ? params : null;
1503
- const segment = segments[routeIndex];
1504
- switch (segment.kind) {
1505
- case "static":
1506
- if (pathnameSegments[pathIndex] !== segment.value) return null;
1507
- return matchRouteSegments(segments, pathnameSegments, routeIndex + 1, pathIndex + 1, params);
1508
- case "required":
1509
- if (pathIndex >= pathnameSegments.length) return null;
1510
- return matchRouteSegments(segments, pathnameSegments, routeIndex + 1, pathIndex + 1, {
1511
- ...params,
1512
- [segment.value]: pathnameSegments[pathIndex]
1513
- });
1514
- case "optional": {
1515
- const consumed = pathIndex < pathnameSegments.length ? matchRouteSegments(segments, pathnameSegments, routeIndex + 1, pathIndex + 1, {
1516
- ...params,
1517
- [segment.value]: pathnameSegments[pathIndex]
1518
- }) : null;
1519
- if (consumed) return consumed;
1520
- return matchRouteSegments(segments, pathnameSegments, routeIndex + 1, pathIndex, {
1521
- ...params,
1522
- [segment.value]: void 0
1523
- });
1524
- }
1525
- case "rest": {
1526
- const rest = pathnameSegments.slice(pathIndex);
1527
- if (rest.length === 0) return null;
1528
- return matchRouteSegments(segments, pathnameSegments, segments.length, pathnameSegments.length, {
1529
- ...params,
1530
- [segment.value]: rest
1531
- });
1532
- }
1533
- }
1534
- };
1535
- const matchRouteManifest = (manifest, pathname) => {
1536
- const normalizedPath = normalizeRoutePath(pathname);
1537
- const pathnameSegments = splitRoutePath(normalizedPath);
1538
- for (const entry of manifest) {
1539
- const params = matchRouteSegments(entry.segments, pathnameSegments);
1540
- if (params) return {
1541
- entry,
1542
- params,
1543
- pathname: normalizedPath
1544
- };
1545
- }
1546
- return null;
1547
- };
1548
- const scoreSpecialManifestEntry = (entry, pathname) => {
1549
- const pathSegments = splitRoutePath(pathname);
1550
- let score = 0;
1551
- for (let index = 0; index < entry.segments.length && index < pathSegments.length; index += 1) {
1552
- const segment = entry.segments[index];
1553
- const pathnameSegment = pathSegments[index];
1554
- if (segment.kind === "static") {
1555
- if (segment.value !== pathnameSegment) break;
1556
- score += 10;
1557
- continue;
1558
- }
1559
- score += segment.kind === "rest" ? 1 : 2;
1560
- if (segment.kind === "rest") break;
1561
- }
1562
- return score;
1563
- };
1564
- const findSpecialManifestEntry = (manifest, pathname, kind) => {
1565
- const normalizedPath = normalizeRoutePath(pathname);
1566
- const matched = matchRouteManifest(manifest, normalizedPath);
1567
- if (matched?.entry[kind]) return matched;
1568
- const rawPathSegments = splitRawRoutePath(normalizedPath);
1569
- for (let length = rawPathSegments.length - 1; length >= 0; length -= 1) {
1570
- const candidate = matchRouteManifest(manifest, length === 0 ? "/" : `/${rawPathSegments.slice(0, length).join("/")}`);
1571
- if (candidate?.entry[kind]) return candidate;
1572
- }
1573
- let best = null;
1574
- let bestScore = -1;
1575
- for (const entry of manifest) {
1576
- if (!entry[kind]) continue;
1577
- const score = scoreSpecialManifestEntry(entry, pathname);
1578
- if (score > bestScore) {
1579
- best = {
1580
- entry,
1581
- params: EMPTY_ROUTE_PARAMS,
1582
- pathname: normalizedPath
1583
- };
1584
- bestScore = score;
1585
- }
1586
- }
1587
- return best;
1588
- };
1589
- const resolvePageRouteMatch = (manifest, pathname) => {
1590
- const matched = matchRouteManifest(manifest, pathname);
1591
- return matched?.entry.page ? matched : null;
1592
- };
1593
- const resolveNotFoundRouteMatch = (manifest, pathname) => {
1594
- const matched = findSpecialManifestEntry(manifest, pathname, "notFound");
1595
- return matched?.entry.notFound ? matched : null;
1596
- };
1597
- const resolveRoutableMatch = (manifest, pathname) => {
1598
- const matched = matchRouteManifest(manifest, pathname);
1599
- if (matched?.entry.page) return {
1600
- kind: "page",
1601
- matched
1602
- };
1603
- if (matched) return null;
1604
- const notFoundMatch = resolveNotFoundRouteMatch(manifest, pathname);
1605
- if (!notFoundMatch) return null;
1606
- return {
1607
- kind: "not-found",
1608
- matched: notFoundMatch
1609
- };
1610
- };
1611
- const resolveCurrentRouteManifestEntry = (router) => {
1612
- const currentPath = normalizeRoutePath(router.currentPath.value);
1613
- const matched = matchRouteManifest(router.manifest, currentPath);
1614
- if (matched?.entry.page) return matched.entry;
1615
- return findSpecialManifestEntry(router.manifest, currentPath, "notFound")?.entry ?? null;
1616
- };
1617
- const getRouteModuleUrl = (entry, variant = "page") => variant === "page" ? entry.page : variant === "loading" ? entry.loading : variant === "error" ? entry.error : entry.notFound;
1618
- const isRouteDataSuccess = (body) => body.ok === true && typeof body.finalHref === "string" && typeof body.finalPathname === "string" && (body.kind === "page" || body.kind === "not-found") && !!body.loaders && typeof body.loaders === "object";
1619
- const isRouteSlot = (value) => typeof value === "object" && value !== null && "__eclipsa_type" in value && value.__eclipsa_type === "route-slot";
1620
- const createRouteSlot = (route, startLayoutIndex) => {
1621
- const slot = {
1622
- __eclipsa_type: ROUTE_SLOT_TYPE,
1623
- pathname: route.pathname,
1624
- startLayoutIndex
1625
- };
1626
- Object.defineProperty(slot, ROUTE_SLOT_ROUTE_KEY, {
1627
- configurable: true,
1628
- enumerable: false,
1629
- value: route,
1630
- writable: true
1631
- });
1632
- return slot;
1633
- };
1634
- const resolveRouteSlot = (container, slot) => {
1635
- const route = slot[ROUTE_SLOT_ROUTE_KEY] ?? container?.router?.loadedRoutes.get(routeCacheKey(slot.pathname, "page"));
1636
- if (!route) return null;
1637
- return createRouteElement(route, slot.startLayoutIndex);
1638
- };
1639
- const defineHiddenRouteProp = (props, key, value) => {
1640
- Object.defineProperty(props, key, {
1641
- configurable: true,
1642
- enumerable: false,
1643
- value,
1644
- writable: true
1645
- });
1646
- };
1647
- const createRouteRenderProps = (route, props) => {
1648
- const nextProps = { ...props };
1649
- defineHiddenRouteProp(nextProps, ROUTE_PARAMS_PROP, route.params);
1650
- defineHiddenRouteProp(nextProps, ROUTE_ERROR_PROP, route.error);
1651
- return nextProps;
1652
- };
1653
- const createRouteElement = (route, startLayoutIndex = 0) => {
1654
- if (startLayoutIndex >= route.layouts.length) return jsxDEV(route.page.renderer, createRouteRenderProps(route, {}), null, false, {});
1655
- let children = null;
1656
- for (let index = route.layouts.length - 1; index >= startLayoutIndex; index -= 1) {
1657
- const layout = route.layouts[index];
1658
- children = jsxDEV(layout.renderer, createRouteRenderProps(route, { children: createRouteSlot(route, index + 1) }), null, false, {});
1659
- }
1660
- return children;
1661
- };
1662
- const routeCacheKey = (pathname, variant = "page") => `${normalizeRoutePath(pathname)}::${variant}`;
1663
- const routePrefetchKey = (url) => `${normalizeRoutePath(url.pathname)}${url.search}`;
1664
- const isLoaderSignalId = (id) => id.startsWith("$loader:");
1665
- //#endregion
1666
1666
  //#region core/runtime/ssr.ts
1667
1667
  const EVENT_PROP_REGEX = /^on([A-Z].+)$/;
1668
1668
  const DANGEROUSLY_SET_INNER_HTML_PROP = "dangerouslySetInnerHTML";
@@ -2780,6 +2780,10 @@ const pushContainer = (container, fn) => {
2780
2780
  }
2781
2781
  };
2782
2782
  const withRuntimeContainer = pushContainer;
2783
+ const runReactiveEffectInContainer = (effect, fn) => {
2784
+ if (!effect.container) return fn();
2785
+ return pushContainer(effect.container, fn);
2786
+ };
2783
2787
  const withRuntimeContextValue = (token, value, fn) => {
2784
2788
  const stack = getContextValueStack();
2785
2789
  stack.push({
@@ -2935,6 +2939,7 @@ const getOrCreateWatchState = (container, id, componentId) => {
2935
2939
  return existing;
2936
2940
  }
2937
2941
  const effect = {
2942
+ container,
2938
2943
  fn() {},
2939
2944
  signals: /* @__PURE__ */ new Set()
2940
2945
  };
@@ -5704,6 +5709,27 @@ const beginAsyncSSRContainer = async (symbols, render, prepare, options) => {
5704
5709
  result: pushContainer(container, () => pushFrame(rootFrame, render))
5705
5710
  };
5706
5711
  };
5712
+ const createDetachedRuntimeContainer = () => createContainer({});
5713
+ const createDetachedRuntimeComponent = (container, id = `d${container.nextComponentId++}`) => getOrCreateComponentState(container, id, id, ROOT_COMPONENT_ID);
5714
+ const runDetachedRuntimeComponent = (container, component, render) => {
5715
+ clearComponentSubscriptions(container, component.id);
5716
+ const frame = createFrame(container, component, "ssr");
5717
+ return pushContainer(container, () => pushFrame(frame, render));
5718
+ };
5719
+ const disposeDetachedRuntimeComponent = (container, component) => {
5720
+ clearComponentSubscriptions(container, component.id);
5721
+ disposeComponentMountCleanups(component);
5722
+ pruneComponentVisibles(container, component, 0);
5723
+ pruneComponentWatches(container, component, 0);
5724
+ for (const signalId of component.signalIds) {
5725
+ container.signals.delete(signalId);
5726
+ container.asyncSignalStates.delete(signalId);
5727
+ container.asyncSignalSnapshotCache.delete(signalId);
5728
+ }
5729
+ container.scopes.delete(component.scopeId);
5730
+ container.dirty.delete(component.id);
5731
+ container.components.delete(component.id);
5732
+ };
5707
5733
  const createResumePayload = (container, componentIds) => {
5708
5734
  const keepComponents = componentIds ? new Set(componentIds) : null;
5709
5735
  const componentEntries = [...container.components.entries()].filter(([id]) => !keepComponents || keepComponents.has(id));
@@ -6346,22 +6372,26 @@ const notFound = () => {
6346
6372
  };
6347
6373
  const isRouteNotFoundError = (error) => !!error && typeof error === "object" && (error.__eclipsa_not_found__ === true || error[ROUTE_NOT_FOUND_KEY] === true);
6348
6374
  const createEffect = (fn, options) => {
6375
+ const container = getCurrentContainer();
6349
6376
  const frame = getCurrentFrame();
6350
6377
  const effect = {
6378
+ container,
6351
6379
  fn() {
6352
- const dependencies = options?.dependencies;
6353
- if (!dependencies) {
6354
- collectTrackedDependencies(effect, fn);
6355
- return;
6356
- }
6357
- collectTrackedDependencies(effect, () => {
6358
- trackWatchDependencies(dependencies, options?.errorLabel);
6380
+ runReactiveEffectInContainer(effect, () => {
6381
+ const dependencies = options?.dependencies;
6382
+ if (!dependencies) {
6383
+ collectTrackedDependencies(effect, fn);
6384
+ return;
6385
+ }
6386
+ collectTrackedDependencies(effect, () => {
6387
+ trackWatchDependencies(dependencies, options?.errorLabel);
6388
+ });
6389
+ if (options?.untracked) {
6390
+ runWithoutDependencyTracking(fn);
6391
+ return;
6392
+ }
6393
+ fn();
6359
6394
  });
6360
- if (options?.untracked) {
6361
- runWithoutDependencyTracking(fn);
6362
- return;
6363
- }
6364
- fn();
6365
6395
  },
6366
6396
  signals: /* @__PURE__ */ new Set()
6367
6397
  };
@@ -6369,6 +6399,9 @@ const createEffect = (fn, options) => {
6369
6399
  clearEffectSignals(effect);
6370
6400
  });
6371
6401
  effect.fn();
6402
+ return () => {
6403
+ clearEffectSignals(effect);
6404
+ };
6372
6405
  };
6373
6406
  const createOnCleanup = (fn) => {
6374
6407
  if (!currentCleanupSlot) throw new Error("onCleanup() can only be used while running onMount(), onVisible(), or useWatch() callbacks.");
@@ -6399,8 +6432,11 @@ const createWatch = (fn, dependencies) => {
6399
6432
  if (!container || !frame || frame.component.id === "$root" || !watchMeta) {
6400
6433
  const cleanupSlot = createCleanupSlot();
6401
6434
  const effect = {
6435
+ container,
6402
6436
  fn() {
6403
- createLocalWatchRunner(effect, cleanupSlot, fn, dependencies)();
6437
+ runReactiveEffectInContainer(effect, () => {
6438
+ createLocalWatchRunner(effect, cleanupSlot, fn, dependencies)();
6439
+ });
6404
6440
  },
6405
6441
  signals: /* @__PURE__ */ new Set()
6406
6442
  };
@@ -7034,6 +7070,6 @@ const __eclipsaAction = (id, middlewares, handler) => {
7034
7070
  }, id));
7035
7071
  };
7036
7072
  //#endregion
7037
- export { shouldReconnectDetachedInsertMarkers as $, deserializeValue as $n, __eclipsaLoader as $t, getRuntimeComponentId as A, createPendingSignalError as An, getActionHookMeta as At, refreshRegisteredRouteContainers as B, createRequestFetch as Bn, getRegisteredLoaderHook as Bt, createOnCleanup as C, createContext as Cn, RESUME_FINAL_STATE_ELEMENT_ID as Ct, createStandaloneRuntimeSignal as D, materializeRuntimeContextProvider as Dn, __eclipsaLazy as Dt, createResumeContainer as E, materializeRuntimeContext as En, __eclipsaEvent as Et, notFound as F, applyActionCsrfCookie as Fn, getLoaderHandleMeta as Ft, renderSSRAttr as G, registerClientHooks as Gn, registerLoaderHook as Gt, registerRuntimeScopedStyle as H, getClientHooks as Hn, getSignalMeta as Ht, preserveReusableContentInRoots as I, ensureActionCsrfToken as In, getLoaderHookMeta as It, renderString as J, runHandleError as Jn, setExternalComponentMeta as Jt, renderSSRMap as K, resetClientHooks as Kn, setActionHandleMeta as Kt, primeLocationState as L, readActionCsrfTokenFromDocument as Ln, getNavigateMeta as Lt, getRuntimeSignalId as M, isSuspenseType as Mn, getEventMeta as Mt, getStreamingResumeBootstrapScriptContent as N, ACTION_CSRF_FIELD as Nn, getExternalComponentMeta as Nt, createWatch as O, useContext as On, __eclipsaWatch as Ot, installResumeListeners as P, ACTION_CSRF_INPUT_ATTR as Pn, getLazyMeta as Pt, restoreSignalRefs as Q, withServerRequestContext as Qn, setSignalMeta as Qt, primeRouteModules as R, APP_HOOKS_ELEMENT_ID as Rn, getRegisteredActionHook as Rt, createEffect as S, resolveRouteMetadata as Sn, ACTION_FORM_ATTR$1 as St, createOnVisible as T, getRuntimeContextReference as Tn, __eclipsaComponent as Tt, renderClientInsertable as U, getCurrentServerRequestContext as Un, getWatchMeta as Ut, registerResumeContainer as V, deserializePublicValue as Vn, getRegisteredLoaderHookIds as Vt, renderClientInsertableForOwner as W, markPublicError as Wn, registerActionHook as Wt, restoreResumedExternalComponents as X, toPublicError as Xn, setLoaderHookMeta as Xt, restoreRegisteredRpcHandles as Y, serializePublicValue as Yn, setLoaderHandleMeta as Yt, restoreResumedLocalSignalEffects as Z, transformCurrentPublicError as Zn, setNavigateMeta as Zt, beginSSRContainer as _, ROUTE_REPLACE_ATTR as _n, getRememberedInsertMarkerNodeCount as _t, action as a, loader_exports as an, IS_BROWSER as ar, useRuntimeLocation as at, collectPendingSuspenseBoundaryIds as b, composeRouteMetadata as bn, rememberManagedAttributesForNodes as bt, getActionFormSubmissionId as c, registerLoader as cn, noSerialize as cr, useRuntimeRouteParams as ct, primeActionState as d, ROUTE_DATA_REQUEST_HEADER as dn, writeAsyncSignalSnapshot as dt, consumePendingSsrLoaderIds as en, escapeInlineScriptText as er, syncRuntimeRefMarker as et, registerAction as f, ROUTE_LINK_ATTR as fn, INSERT_MARKER_PREFIX as ft, beginAsyncSSRContainer as g, ROUTE_PREFLIGHT_REQUEST_HEADER as gn, parseInsertMarker as gt, assignRuntimeRef as h, ROUTE_PREFLIGHT_ENDPOINT as hn, parseComponentBoundaryMarker as ht, __eclipsaAction as i, loader as in, serializeValue as ir, tryPatchNodeSequenceInPlace as it, getRuntimeContainer as j, isPendingSignalError as jn, getComponentMeta as jt, getResumePayloadScriptContent as k, Suspense as kn, getActionHandleMeta as kt, getNormalizedActionInput as l, resolvePendingLoaders as ln, useRuntimeSignal as lt, applyResumeHmrUpdateToRegisteredContainers as m, ROUTE_PREFETCH_ATTR as mn, createInsertMarker as mt, ACTION_FORM_ATTR as n, hasLoader as nn, parseSerializedJSON as nr, toResumePayloadSubset as nt, executeAction as o, markPendingSsrLoader as on, IS_SSR as or, useRuntimeNavigate as ot, validator as p, ROUTE_MANIFEST_ELEMENT_ID as pn, createComponentBoundaryHtmlComment as pt, renderSSRValue as q, resolveReroute as qn, setActionHookMeta as qt, ACTION_FORM_FIELD as r, isPendingSsrLoaderError as rn, serializeJSONScriptContent as rr, tryPatchElementShellInPlace as rt, executeActionSubmission as s, primeLoaderState as sn, isNoSerialize as sr, useRuntimeRouteError as st, ACTION_CONTENT_TYPE as t, executeLoader as tn, escapeJSONScriptText as tr, toResumePayload as tt, hasAction as u, ROUTE_DATA_ENDPOINT as un, withRuntimeContainer as ut, bindRuntimeEvent as v, ROUTE_RPC_URL_HEADER as vn, rememberInsertMarkerRange as vt, createOnMount as w, getContextProviderMeta as wn, RESUME_STATE_ELEMENT_ID as wt, createDetachedClientInsertOwner as x, renderRouteMetadataHead as xn, syncManagedAttributeSnapshot as xt, captureClientInsertOwner as y, ROUTE_METADATA_HEAD_ATTR as yn, rememberManagedAttributesForNode as yt, readAsyncSignalSnapshot as z, attachRequestFetch as zn, getRegisteredActionHookIds as zt };
7073
+ export { restoreResumedExternalComponents as $, resetClientHooks as $n, setSignalMeta as $t, createWatch as A, createContext as An, getActionHandleMeta as At, primeLocationState as B, ACTION_CSRF_FIELD as Bn, getRegisteredActionHookIds as Bt, createDetachedRuntimeContainer as C, ROUTE_PREFLIGHT_REQUEST_HEADER as Cn, rememberManagedAttributesForNode as Ct, createOnVisible as D, composeRouteMetadata as Dn, __eclipsaEvent as Dt, createOnMount as E, ROUTE_METADATA_HEAD_ATTR as En, __eclipsaComponent as Et, getRuntimeSignalId as F, useContext as Fn, getLazyMeta as Ft, registerRuntimeScopedStyle as G, APP_HOOKS_ELEMENT_ID as Gn, registerActionHook as Gt, readAsyncSignalSnapshot as H, applyActionCsrfCookie as Hn, getRegisteredLoaderHookIds as Ht, getStreamingResumeBootstrapScriptContent as I, Suspense as In, getLoaderHandleMeta as It, renderSSRAttr as J, deserializePublicValue as Jn, setActionHookMeta as Jt, renderClientInsertable as K, attachRequestFetch as Kn, registerLoaderHook as Kt, installResumeListeners as L, createPendingSignalError as Ln, getLoaderHookMeta as Lt, getResumePayloadScriptContent as M, getRuntimeContextReference as Mn, getComponentMeta as Mt, getRuntimeComponentId as N, materializeRuntimeContext as Nn, getEventMeta as Nt, createResumeContainer as O, renderRouteMetadataHead as On, __eclipsaLazy as Ot, getRuntimeContainer as P, materializeRuntimeContextProvider as Pn, getExternalComponentMeta as Pt, restoreRegisteredRpcHandles as Q, registerClientHooks as Qn, setNavigateMeta as Qt, notFound as R, isPendingSignalError as Rn, getNavigateMeta as Rt, createDetachedRuntimeComponent as S, ROUTE_PREFLIGHT_ENDPOINT as Sn, rememberInsertMarkerRange as St, createOnCleanup as T, ROUTE_RPC_URL_HEADER as Tn, syncManagedAttributeSnapshot as Tt, refreshRegisteredRouteContainers as U, ensureActionCsrfToken as Un, getSignalMeta as Ut, primeRouteModules as V, ACTION_CSRF_INPUT_ATTR as Vn, getRegisteredLoaderHook as Vt, registerResumeContainer as W, readActionCsrfTokenFromDocument as Wn, getWatchMeta as Wt, renderSSRValue as X, getCurrentServerRequestContext as Xn, setLoaderHandleMeta as Xt, renderSSRMap as Y, getClientHooks as Yn, setExternalComponentMeta as Yt, renderString as Z, markPublicError as Zn, setLoaderHookMeta as Zt, beginSSRContainer as _, ROUTE_DATA_ENDPOINT as _n, createComponentBoundaryHtmlComment as _t, action as a, RESUME_STATE_ELEMENT_ID as an, withServerRequestContext as ar, toResumePayload as at, collectPendingSuspenseBoundaryIds as b, ROUTE_MANIFEST_ELEMENT_ID as bn, parseInsertMarker as bt, getActionFormSubmissionId as c, executeLoader as cn, escapeJSONScriptText as cr, tryPatchNodeSequenceInPlace as ct, primeActionState as d, loader as dn, serializeValue as dr, useRuntimeRouteError as dt, createRouteElement as en, resolveReroute as er, restoreResumedLocalSignalEffects as et, registerAction as f, loader_exports as fn, IS_BROWSER as fr, useRuntimeRouteParams as ft, beginAsyncSSRContainer as g, resolvePendingLoaders as gn, INSERT_MARKER_PREFIX as gt, assignRuntimeRef as h, registerLoader as hn, noSerialize as hr, writeAsyncSignalSnapshot as ht, __eclipsaAction as i, RESUME_FINAL_STATE_ELEMENT_ID as in, transformCurrentPublicError as ir, syncRuntimeRefMarker as it, disposeDetachedRuntimeComponent as j, getContextProviderMeta as jn, getActionHookMeta as jt, createStandaloneRuntimeSignal as k, resolveRouteMetadata as kn, __eclipsaWatch as kt, getNormalizedActionInput as l, hasLoader as ln, parseSerializedJSON as lr, useRuntimeLocation as lt, applyResumeHmrUpdateToRegisteredContainers as m, primeLoaderState as mn, isNoSerialize as mr, withRuntimeContainer as mt, ACTION_FORM_ATTR as n, resolveRouteSlot as nn, serializePublicValue as nr, runDetachedRuntimeComponent as nt, executeAction as o, __eclipsaLoader as on, deserializeValue as or, toResumePayloadSubset as ot, validator as p, markPendingSsrLoader as pn, IS_SSR as pr, useRuntimeSignal as pt, renderClientInsertableForOwner as q, createRequestFetch as qn, setActionHandleMeta as qt, ACTION_FORM_FIELD as r, ACTION_FORM_ATTR$1 as rn, toPublicError as rr, shouldReconnectDetachedInsertMarkers as rt, executeActionSubmission as s, consumePendingSsrLoaderIds as sn, escapeInlineScriptText as sr, tryPatchElementShellInPlace as st, ACTION_CONTENT_TYPE as t, isRouteSlot as tn, runHandleError as tr, restoreSignalRefs as tt, hasAction as u, isPendingSsrLoaderError as un, serializeJSONScriptContent as ur, useRuntimeNavigate as ut, bindRuntimeEvent as v, ROUTE_DATA_REQUEST_HEADER as vn, createInsertMarker as vt, createEffect as w, ROUTE_REPLACE_ATTR as wn, rememberManagedAttributesForNodes as wt, createDetachedClientInsertOwner as x, ROUTE_PREFETCH_ATTR as xn, getRememberedInsertMarkerNodeCount as xt, captureClientInsertOwner as y, ROUTE_LINK_ATTR as yn, parseComponentBoundaryMarker as yt, preserveReusableContentInRoots as z, isSuspenseType as zn, getRegisteredActionHook as zt };
7038
7074
 
7039
- //# sourceMappingURL=action-DCc4fBhy.mjs.map
7075
+ //# sourceMappingURL=action-Uv02N2Rx.mjs.map