@absolutejs/absolute 0.19.0-beta.1022 → 0.19.0-beta.1024

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 (38) hide show
  1. package/dist/angular/browser.js +13 -17
  2. package/dist/angular/browser.js.map +3 -3
  3. package/dist/angular/components/core/streamingSlotRegistrar.js +1 -1
  4. package/dist/angular/components/core/streamingSlotRegistry.js +2 -2
  5. package/dist/angular/index.js +595 -267
  6. package/dist/angular/index.js.map +11 -8
  7. package/dist/angular/server.js +577 -249
  8. package/dist/angular/server.js.map +11 -8
  9. package/dist/build.js +865 -755
  10. package/dist/build.js.map +12 -11
  11. package/dist/cli/config/server.js +49 -42
  12. package/dist/client/index.js +34 -20
  13. package/dist/client/index.js.map +6 -6
  14. package/dist/index.js +922 -805
  15. package/dist/index.js.map +13 -12
  16. package/dist/islands/index.js +416 -95
  17. package/dist/islands/index.js.map +10 -7
  18. package/dist/react/browser.js +13 -17
  19. package/dist/react/browser.js.map +3 -3
  20. package/dist/react/index.js +484 -156
  21. package/dist/react/index.js.map +12 -9
  22. package/dist/react/server.js +69 -62
  23. package/dist/react/server.js.map +5 -5
  24. package/dist/src/client/preserveIslandMarkup.d.ts +4 -1
  25. package/dist/src/core/angularServerModule.d.ts +1 -0
  26. package/dist/svelte/index.js +389 -61
  27. package/dist/svelte/index.js.map +11 -8
  28. package/dist/svelte/server.js +50 -43
  29. package/dist/svelte/server.js.map +3 -3
  30. package/dist/types/angular.d.ts +3 -0
  31. package/dist/types/globals.d.ts +0 -1
  32. package/dist/vue/browser.js +13 -17
  33. package/dist/vue/browser.js.map +3 -3
  34. package/dist/vue/index.js +477 -153
  35. package/dist/vue/index.js.map +12 -9
  36. package/dist/vue/server.js +50 -43
  37. package/dist/vue/server.js.map +3 -3
  38. package/package.json +1 -1
@@ -35275,7 +35275,6 @@ var ensureConfigCert = (host) => {
35275
35275
  };
35276
35276
  // src/constants.ts
35277
35277
  var BASE_36_RADIX = 36;
35278
- var BYTES_PER_KILOBYTE = 1024;
35279
35278
  var CONFIG_DEFAULT_HOST = "config.absolute.localhost";
35280
35279
  var CONFIG_DEFAULT_PORT = 4099;
35281
35280
  var HTTP_STATUS_BAD_REQUEST = 400;
@@ -35410,61 +35409,69 @@ var pipeStreamWithHeadInjection = (stream, markup) => {
35410
35409
  var pipeStreamWithIslandMarkerDetection = (stream, markup) => {
35411
35410
  const encoder = new TextEncoder;
35412
35411
  const decoder = new TextDecoder;
35413
- const lookbehind = Math.max(ISLAND_MARKER.length, BYTES_PER_KILOBYTE);
35414
- const processPending = (controller, pending, injected) => {
35415
- if (injected) {
35416
- controller.enqueue(encoder.encode(pending));
35417
- return { injected, pending: "" };
35412
+ const headLookbehind = CLOSING_HEAD_TAG.length - 1;
35413
+ const enqueue = (controller, text) => {
35414
+ if (text.length > 0) {
35415
+ controller.enqueue(encoder.encode(text));
35418
35416
  }
35419
- const markerIndex = pending.indexOf(ISLAND_MARKER);
35420
- if (markerIndex >= 0) {
35421
- const tagStart = pending.lastIndexOf("<", markerIndex);
35422
- const injectAt = tagStart >= 0 ? tagStart : markerIndex;
35423
- const next = `${pending.slice(0, injectAt)}${markup}${pending.slice(injectAt)}`;
35424
- controller.enqueue(encoder.encode(next));
35425
- return { injected: true, pending: "" };
35417
+ };
35418
+ const processHolding = (controller, held) => {
35419
+ if (!held.includes(ISLAND_MARKER)) {
35420
+ return { held, injected: false, pending: "", sawHead: true };
35426
35421
  }
35427
- return {
35428
- injected,
35429
- pending: flushSafePendingText(controller, encoder, pending, lookbehind)
35430
- };
35422
+ enqueue(controller, `${markup}${held}`);
35423
+ return { held: "", injected: true, pending: "", sawHead: true };
35431
35424
  };
35432
- const finishIslandMarkerStream = (controller, pending) => {
35433
- const finalPending = pending + decoder.decode();
35434
- if (finalPending.length > 0) {
35435
- controller.enqueue(encoder.encode(finalPending));
35425
+ const processHead = (controller, pending) => {
35426
+ const headIndex = pending.indexOf(CLOSING_HEAD_TAG);
35427
+ if (headIndex < 0) {
35428
+ return {
35429
+ held: "",
35430
+ injected: false,
35431
+ pending: flushSafePendingText(controller, encoder, pending, headLookbehind),
35432
+ sawHead: false
35433
+ };
35436
35434
  }
35437
- controller.close();
35435
+ enqueue(controller, pending.slice(0, headIndex));
35436
+ return processHolding(controller, pending.slice(headIndex));
35438
35437
  };
35439
- const consumeIslandChunk = async (controller, reader, pending, injected) => {
35440
- const { done, value } = await readStreamChunk(reader);
35441
- if (done || !value) {
35442
- return { done, injected, pending };
35438
+ const processChunk = (controller, state, chunk) => {
35439
+ if (state.injected) {
35440
+ enqueue(controller, chunk);
35441
+ return state;
35443
35442
  }
35444
- const processed = processPending(controller, pending + streamChunkToString(value, decoder), injected);
35445
- return {
35446
- done,
35447
- injected: processed.injected,
35448
- pending: processed.pending
35449
- };
35443
+ if (!state.sawHead) {
35444
+ return processHead(controller, state.pending + chunk);
35445
+ }
35446
+ return processHolding(controller, state.held + chunk);
35450
35447
  };
35451
- const runIslandMarkerLoop = async (controller, reader) => {
35452
- const consumeNextIslandChunk = async (injected, pending) => {
35453
- const consumed = await consumeIslandChunk(controller, reader, pending, injected);
35454
- const nextState = updateInjectedState(consumed, injected, pending);
35455
- if (nextState.done) {
35456
- return { injected, pending };
35448
+ const finishMarkerStream = (controller, state) => {
35449
+ const tail = decoder.decode();
35450
+ const remainder = state.injected ? tail : (state.sawHead ? state.held : state.pending) + tail;
35451
+ enqueue(controller, remainder);
35452
+ controller.close();
35453
+ };
35454
+ const runMarkerLoop = (controller, reader) => {
35455
+ const consumeNext = async (state) => {
35456
+ const { done, value } = await readStreamChunk(reader);
35457
+ if (done || !value) {
35458
+ return state;
35457
35459
  }
35458
- return consumeNextIslandChunk(nextState.injected, nextState.pending);
35460
+ return consumeNext(processChunk(controller, state, streamChunkToString(value, decoder)));
35459
35461
  };
35460
- return consumeNextIslandChunk(false, "");
35462
+ return consumeNext({
35463
+ held: "",
35464
+ injected: false,
35465
+ pending: "",
35466
+ sawHead: false
35467
+ });
35461
35468
  };
35462
35469
  return new ReadableStream({
35463
35470
  async start(controller) {
35464
35471
  const reader = stream.getReader();
35465
35472
  try {
35466
- const { pending } = await runIslandMarkerLoop(controller, reader);
35467
- finishIslandMarkerStream(controller, pending);
35473
+ const finalState = await runMarkerLoop(controller, reader);
35474
+ finishMarkerStream(controller, finalState);
35468
35475
  } catch (error) {
35469
35476
  controller.error(error);
35470
35477
  }
@@ -259,12 +259,20 @@ __export(exports_react, {
259
259
  });
260
260
  import { createElement } from "react";
261
261
  import { hydrateRoot } from "react-dom/client";
262
- var reactIslandRoots, isPropsRecord = (value) => typeof value === "object" && value !== null, isReactComponent = (value) => typeof value === "function", hydrateReactIsland = (component, element, props) => {
262
+ var reactIslandRoots, isPropsRecord = (value) => typeof value === "object" && value !== null, HOST_REACT_EXPANDO_PREFIXES, detachFromHostReactRoot = (element) => {
263
+ for (const key of Object.keys(element)) {
264
+ const isHostExpando = HOST_REACT_EXPANDO_PREFIXES.some((prefix) => key.startsWith(prefix));
265
+ if (!isHostExpando)
266
+ continue;
267
+ Reflect.deleteProperty(element, key);
268
+ }
269
+ }, isReactComponent = (value) => typeof value === "function", hydrateReactIsland = (component, element, props) => {
263
270
  const existingRoot = reactIslandRoots.get(element);
264
271
  if (existingRoot) {
265
272
  existingRoot.render(isPropsRecord(props) ? createElement(component, props) : createElement(component));
266
273
  return;
267
274
  }
275
+ detachFromHostReactRoot(element);
268
276
  if (!isPropsRecord(props)) {
269
277
  reactIslandRoots.set(element, hydrateRoot(element, createElement(component)));
270
278
  return;
@@ -273,6 +281,14 @@ var reactIslandRoots, isPropsRecord = (value) => typeof value === "object" && va
273
281
  };
274
282
  var init_react = __esm(() => {
275
283
  reactIslandRoots = new WeakMap;
284
+ HOST_REACT_EXPANDO_PREFIXES = [
285
+ "__reactFiber$",
286
+ "__reactProps$",
287
+ "__reactContainer$",
288
+ "__reactEvents$",
289
+ "__reactListeners$",
290
+ "__reactHandles$"
291
+ ];
276
292
  });
277
293
 
278
294
  // src/client/hydrators/svelte.ts
@@ -524,9 +540,12 @@ var initDominoAdapter = (platformServer) => {
524
540
  return {
525
541
  APP_BASE_HREF: common.APP_BASE_HREF,
526
542
  bootstrapApplication: platformBrowser.bootstrapApplication,
543
+ Component: core.Component,
527
544
  DomSanitizer: platformBrowser.DomSanitizer,
528
545
  ENVIRONMENT_INITIALIZER: core.ENVIRONMENT_INITIALIZER,
529
546
  inject: core.inject,
547
+ InjectionToken: core.InjectionToken,
548
+ NgComponentOutlet: common.NgComponentOutlet,
530
549
  provideClientHydration: platformBrowser.provideClientHydration,
531
550
  provideServerRendering: platformServer.provideServerRendering,
532
551
  provideZonelessChangeDetection: core.provideZonelessChangeDetection,
@@ -782,9 +801,8 @@ var angularIslandSelector = "abs-angular-island", isAngularComponent = (value) =
782
801
  const componentName = typeof component.name === "string" && component.name.length > 0 ? component.name : "AngularIsland";
783
802
  return `${componentName}:${JSON.stringify(props)}`;
784
803
  }, buildAngularIslandWrapperMetadata = async (component, islandId, wrapperKey) => {
785
- const { Component, InjectionToken, inject } = await import("@angular/core");
786
- const { NgComponentOutlet } = await import("@angular/common");
787
804
  const deps = await getAngularDeps();
805
+ const { Component, InjectionToken, NgComponentOutlet, inject } = deps;
788
806
  const selector = getAngularIslandSelector(islandId);
789
807
  const propsToken = new InjectionToken(`${wrapperKey}:props`);
790
808
 
@@ -1014,13 +1032,6 @@ init_islands();
1014
1032
 
1015
1033
  // src/client/preserveIslandMarkup.ts
1016
1034
  init_islandMarkupAttributes();
1017
- var getClaimMap = () => {
1018
- if (typeof window === "undefined") {
1019
- return null;
1020
- }
1021
- window.__ABS_CLAIMED_ISLAND_MARKUP__ ??= new Map;
1022
- return window.__ABS_CLAIMED_ISLAND_MARKUP__;
1023
- };
1024
1035
  var getSnapshotMap = () => {
1025
1036
  if (typeof window === "undefined") {
1026
1037
  return null;
@@ -1079,19 +1090,22 @@ var preserveIslandMarkup = (props) => {
1079
1090
  innerHTML: ""
1080
1091
  };
1081
1092
  }
1082
- const claimMap = getClaimMap();
1083
1093
  const snapshotMap = getSnapshotMap();
1084
1094
  const signature = getIslandSignature(props);
1085
- const claimedCount = claimMap?.get(signature) ?? 0;
1086
- const snapshotCandidate = snapshotMap?.get(signature)?.[claimedCount];
1087
- const candidates = Array.from(document.querySelectorAll('[data-island="true"]')).filter((element) => isMatchingIslandElement(element, props));
1088
- const candidate = candidates[claimedCount];
1089
- if (claimMap) {
1090
- claimMap.set(signature, claimedCount + 1);
1095
+ const snapshotCandidate = snapshotMap?.get(signature)?.[0];
1096
+ if (snapshotCandidate) {
1097
+ return snapshotCandidate;
1098
+ }
1099
+ const liveCandidate = Array.from(document.querySelectorAll('[data-island="true"]')).find((element) => isMatchingIslandElement(element, props));
1100
+ if (!liveCandidate) {
1101
+ return {
1102
+ attributes: getIslandMarkerAttributes(props),
1103
+ innerHTML: ""
1104
+ };
1091
1105
  }
1092
1106
  return {
1093
- attributes: snapshotCandidate?.attributes ?? getIslandMarkerAttributes(props),
1094
- innerHTML: snapshotCandidate?.innerHTML ?? candidate?.innerHTML ?? ""
1107
+ attributes: Object.fromEntries(liveCandidate.getAttributeNames().map((name) => [name, liveCandidate.getAttribute(name) ?? ""])),
1108
+ innerHTML: liveCandidate.innerHTML
1095
1109
  };
1096
1110
  };
1097
1111
 
@@ -1242,5 +1256,5 @@ export {
1242
1256
  createIslandManifestResolver
1243
1257
  };
1244
1258
 
1245
- //# debugId=48A5E34EBDE550F464756E2164756E21
1259
+ //# debugId=07B15BB8DBC2C0A764756E2164756E21
1246
1260
  //# sourceMappingURL=index.js.map