@aparte/core 0.12.0 → 0.12.1

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.
@@ -46,27 +46,6 @@ export interface AparteChatHostOptions {
46
46
  */
47
47
  config?: AparteConfig;
48
48
  }
49
- /**
50
- * Framework-agnostic chat-host orchestrator.
51
- *
52
- * Owns the streaming/branch/host-method layer that previously lived inline in
53
- * the Angular wrapper: it installs the imperative method surface `AparteClient`
54
- * calls onto the host element, tracks the streaming target id from
55
- * `apartemessage*` lifecycle events, guards writes against orphan streams (late
56
- * SSE after a conversation switch), handles `aparte-path-changed` branch
57
- * navigation, keeps the viewport's repo in sync before branch ops, and
58
- * reconciles bubbles via `populateBubbleFromMessage`.
59
- *
60
- * It composes — does not replace — `AparteConversationController` (persistence /
61
- * load / lazy-create) which it instantiates internally from the same binding.
62
- *
63
- * Each framework provides an {@link AparteChatHostBinding} over its reactive
64
- * message list and calls {@link bind} after the view mounts; the framework is
65
- * responsible for rendering `<aparte-chat-bubble message-id="…">` elements inside
66
- * the viewport and calling {@link syncBubbles} whenever its message list
67
- * changes (its idiomatic reactive hook: Angular effect, React effect, Vue
68
- * watch, Svelte afterUpdate).
69
- */
70
49
  export declare class AparteChatHost {
71
50
  private readonly binding;
72
51
  private readonly options;
@@ -76,6 +55,8 @@ export declare class AparteChatHost {
76
55
  private readonly _renderedIds;
77
56
  /** Sibling info from the last path-change, applied after the next render. */
78
57
  private _pendingSiblings?;
58
+ /** How many render passes the sibling write has waited for — see `_applyPendingSiblings`. */
59
+ private _siblingRetries;
79
60
  /** Abort handle for an in-flight {@link streamTokens} loop. */
80
61
  private _streamAbort?;
81
62
  /** Segment chunks written to the bubble, awaiting one coalesced state sync. */
@@ -222,6 +203,26 @@ export declare class AparteChatHost {
222
203
  * operations (streaming fills the framework state but not the repo).
223
204
  */
224
205
  syncRepoFromMessages(): void;
206
+ /**
207
+ * Write the branch counts onto their bubbles — and RESCHEDULE for the ones that are
208
+ * not on the page yet, instead of dropping them.
209
+ *
210
+ * This used to `continue` past a missing bubble and then clear `_pendingSiblings`
211
+ * unconditionally, which lost the fork for good. That is the "1 / 1" defect: the
212
+ * bubble kept its default of one sibling, the picker hid itself, and the other version
213
+ * became unreachable for the life of the page.
214
+ *
215
+ * It needed a framework that renders LATE, which is every framework here. React's
216
+ * `afterRender` is `requestAnimationFrame(() => cb())` — a bet that the next paint
217
+ * lands after React's commit, and it does not always; the repo has lost that same bet
218
+ * before (`25f356b`, "a bet on rAF phase"). The fix is here rather than in the
219
+ * wrapper's rAF call, because ANY binding whose `afterRender` can precede its commit
220
+ * hits this, and one fix at the host covers all four.
221
+ *
222
+ * Bounded, because a sibling can legitimately never arrive — a message that left the
223
+ * path has no bubble and never will, and an unbounded retry would hold a callback for
224
+ * the page's lifetime. Six passes is far more than the one tick the race needs.
225
+ */
225
226
  private _applyPendingSiblings;
226
227
  /** Orphan-stream guard: a stream is in flight but the last msg isn't it. */
227
228
  private _isOrphan;
@@ -1 +1 @@
1
- {"version":3,"file":"aparte-chat-host.d.ts","sourceRoot":"","sources":["../../src/host/aparte-chat-host.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACR,aAAa,EACb,aAAa,EAIhB,MAAM,mBAAmB,CAAC;AAI3B,OAAO,EACH,4BAA4B,EAE/B,MAAM,6CAA6C,CAAC;AACrD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAoD/D;;;;GAIG;AACH,MAAM,WAAW,qBAAqB;IAClC,6EAA6E;IAC7E,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,4EAA4E;IAC5E,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAC;IAC3B,gFAAgF;IAChF,QAAQ,CAAC,QAAQ,EAAE,WAAW,GAAG,IAAI,CAAC;IAEtC,kDAAkD;IAClD,WAAW,IAAI,aAAa,EAAE,CAAC;IAC/B,qEAAqE;IACrE,WAAW,CAAC,QAAQ,EAAE,aAAa,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G,IAAI;IAK1E,wDAAwD;IACxD,YAAY,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI;IASrC,6EAA6E;IAC7E,sBAAsB,CAAC,aAAa,EAAE,MAAM,GAAG,IAAI;IAWnD;;;;;;;;;;;;OAYG;IACG,YAAY,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,aAAa,CAAC,MAAM,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IAwCnF;;;;OAIG;IACH,OAAO,CAAC,YAAY;IAQpB,oDAAoD;IACpD,eAAe,IAAI,IAAI;IAavB;;;;OAIG;IACH,WAAW,IAAI,IAAI;IAYnB;;;OAGG;IACH,oBAAoB,IAAI,IAAI;IAiB5B;;;;;;;;;;;;;;;;;;;OAmBG;IACH,OAAO,CAAC,qBAAqB;IAuB7B,4EAA4E;IAC5E,OAAO,CAAC,SAAS;IAIjB,OAAO,CAAC,GAAG;IAIX,OAAO,CAAC,WAAW;IAQnB,OAAO,CAAC,WAAW;IAOnB,OAAO,CAAC,mBAAmB;IAiB3B,OAAO,CAAC,0BAA0B;IAmClC,OAAO,CAAC,yBAAyB;CAqCpC"}
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
- import { a4 as subscribeConfigChange, $ as resolveConfig, a1 as runWithConfig, p as AparteElicitationAbortError, x as buildApprovalPanel, y as buildElicitationPanel, K as escapeAttr, F as cssEscape, a7 as mergeSegmentUpdate, L as escapeHtml, O as getSegmentRenderer, P as installDefaultRenderersOnce, s as AparteMessageRepository, a8 as stampSegmentActivity, a9 as stampSegmentOnInsert, aa as stampSegmentOnUpdate, ab as renumberSegments, ac as openSegmentIds, ad as isTerminalStatus, ae as adoptMessageSegments, Q as isAwaitingReply, W as populateBubbleFromMessage, a6 as uuid, a0 as revokeAttachmentUrls } from "./is-awaiting-reply-CxWRISBC.js";
2
- import { A, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, q, r, t, u, v, w, z, B, C, D, E, G, H, I, J, M, N, R, S, T, U, V, X, Y, Z, _, a2, a3, a5 } from "./is-awaiting-reply-CxWRISBC.js";
1
+ import { a4 as subscribeConfigChange, $ as resolveConfig, a1 as runWithConfig, p as AparteElicitationAbortError, x as buildApprovalPanel, y as buildElicitationPanel, K as escapeAttr, F as cssEscape, a7 as mergeSegmentUpdate, L as escapeHtml, O as getSegmentRenderer, P as installDefaultRenderersOnce, s as AparteMessageRepository, a8 as stampSegmentActivity, a9 as stampSegmentOnInsert, aa as stampSegmentOnUpdate, ab as renumberSegments, ac as openSegmentIds, ad as isTerminalStatus, ae as adoptMessageSegments, Q as isAwaitingReply, W as populateBubbleFromMessage, a6 as uuid, a0 as revokeAttachmentUrls } from "./is-awaiting-reply-BWTDvQ__.js";
2
+ import { A, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, q, r, t, u, v, w, z, B, C, D, E, G, H, I, J, M, N, R, S, T, U, V, X, Y, Z, _, a2, a3, a5 } from "./is-awaiting-reply-BWTDvQ__.js";
3
3
  class AparteOption extends HTMLElement {
4
4
  static get observedAttributes() {
5
5
  return ["value", "disabled", "selected", "data-status"];
@@ -1,4 +1,4 @@
1
- import { A, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, Z, _, $, a0, a1, a2, a3, a4, a5, a6 } from "./is-awaiting-reply-CxWRISBC.js";
1
+ import { A, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, Z, _, $, a0, a1, a2, a3, a4, a5, a6 } from "./is-awaiting-reply-BWTDvQ__.js";
2
2
  function registerAllComponents() {
3
3
  }
4
4
  export {
@@ -959,6 +959,7 @@ const SAFE_STYLE_PROPS = /* @__PURE__ */ new Set([
959
959
  "white-space"
960
960
  ]);
961
961
  function isSafeCustomProperty(prop) {
962
+ if (prop.includes("\\")) return false;
962
963
  return prop.startsWith("--") && !prop.startsWith("--aparte-");
963
964
  }
964
965
  function scrubStyle(value) {
@@ -4120,6 +4121,7 @@ class AparteConversationController {
4120
4121
  function cssEscape(value) {
4121
4122
  return value.replace(/["\\]/g, "\\$&");
4122
4123
  }
4124
+ const MAX_SIBLING_RETRIES = 6;
4123
4125
  class AparteChatHost {
4124
4126
  binding;
4125
4127
  options;
@@ -4129,6 +4131,8 @@ class AparteChatHost {
4129
4131
  _renderedIds = /* @__PURE__ */ new Set();
4130
4132
  /** Sibling info from the last path-change, applied after the next render. */
4131
4133
  _pendingSiblings;
4134
+ /** How many render passes the sibling write has waited for — see `_applyPendingSiblings`. */
4135
+ _siblingRetries = 0;
4132
4136
  /** Abort handle for an in-flight {@link streamTokens} loop. */
4133
4137
  _streamAbort;
4134
4138
  /** Segment chunks written to the bubble, awaiting one coalesced state sync. */
@@ -4630,17 +4634,48 @@ class AparteChatHost {
4630
4634
  }
4631
4635
  }
4632
4636
  }
4637
+ /**
4638
+ * Write the branch counts onto their bubbles — and RESCHEDULE for the ones that are
4639
+ * not on the page yet, instead of dropping them.
4640
+ *
4641
+ * This used to `continue` past a missing bubble and then clear `_pendingSiblings`
4642
+ * unconditionally, which lost the fork for good. That is the "1 / 1" defect: the
4643
+ * bubble kept its default of one sibling, the picker hid itself, and the other version
4644
+ * became unreachable for the life of the page.
4645
+ *
4646
+ * It needed a framework that renders LATE, which is every framework here. React's
4647
+ * `afterRender` is `requestAnimationFrame(() => cb())` — a bet that the next paint
4648
+ * lands after React's commit, and it does not always; the repo has lost that same bet
4649
+ * before (`25f356b`, "a bet on rAF phase"). The fix is here rather than in the
4650
+ * wrapper's rAF call, because ANY binding whose `afterRender` can precede its commit
4651
+ * hits this, and one fix at the host covers all four.
4652
+ *
4653
+ * Bounded, because a sibling can legitimately never arrive — a message that left the
4654
+ * path has no bubble and never will, and an unbounded retry would hold a callback for
4655
+ * the page's lifetime. Six passes is far more than the one tick the race needs.
4656
+ */
4633
4657
  _applyPendingSiblings() {
4634
4658
  if (!this._pendingSiblings) return;
4635
4659
  const msgs = this.binding.getMessages();
4660
+ const unresolved = [];
4636
4661
  for (const sib of this._pendingSiblings) {
4637
4662
  if (sib.count <= 1) continue;
4638
4663
  const bubble = this._bubbleById(sib.id);
4639
- if (!bubble) continue;
4664
+ if (!bubble) {
4665
+ unresolved.push(sib);
4666
+ continue;
4667
+ }
4640
4668
  const message = msgs.find((m) => m.id === sib.id);
4641
4669
  if (message) populateBubbleFromMessage(bubble, message, sib);
4642
4670
  }
4643
4671
  this._pendingSiblings = void 0;
4672
+ if (unresolved.length && this._siblingRetries < MAX_SIBLING_RETRIES) {
4673
+ this._siblingRetries += 1;
4674
+ this._pendingSiblings = unresolved;
4675
+ this.binding.afterRender(() => this._applyPendingSiblings());
4676
+ return;
4677
+ }
4678
+ this._siblingRetries = 0;
4644
4679
  }
4645
4680
  // ── internals ──────────────────────────────────────────────────────────
4646
4681
  /** Orphan-stream guard: a stream is in flight but the last msg isn't it. */
@@ -7462,4 +7497,4 @@ export {
7462
7497
  buildElicitationPanel as y,
7463
7498
  collectRendererStyles as z
7464
7499
  };
7465
- //# sourceMappingURL=is-awaiting-reply-CxWRISBC.js.map
7500
+ //# sourceMappingURL=is-awaiting-reply-BWTDvQ__.js.map