@syntrologie/adapt-chatbot 2.8.0-canary.281 → 2.8.0-canary.282

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,8 +1,8 @@
1
1
  import {
2
2
  AdaptiveChatBar
3
3
  } from "./chunk-QELVKBQV.js";
4
- import "./chunk-HZ55BLN3.js";
5
- import "./chunk-DDZFWNVM.js";
4
+ import "./chunk-XP2UFKPG.js";
5
+ import "./chunk-K2IG34L7.js";
6
6
  import "./chunk-UVKRO5ER.js";
7
7
  export {
8
8
  AdaptiveChatBar
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  AdaptiveChatTrail
3
- } from "./chunk-HZ55BLN3.js";
4
- import "./chunk-DDZFWNVM.js";
3
+ } from "./chunk-XP2UFKPG.js";
4
+ import "./chunk-K2IG34L7.js";
5
5
  import "./chunk-UVKRO5ER.js";
6
6
  export {
7
7
  AdaptiveChatTrail
@@ -2,7 +2,7 @@ import {
2
2
  ChatAssistantLitMountable,
3
3
  renderFallbackHtml
4
4
  } from "./chunk-FQ7QUZZ3.js";
5
- import "./chunk-DDZFWNVM.js";
5
+ import "./chunk-K2IG34L7.js";
6
6
  import "./chunk-435KJD27.js";
7
7
  import "./chunk-UVKRO5ER.js";
8
8
  export {
@@ -3096,8 +3096,7 @@ var SyntroChat = class extends LitElement {
3096
3096
  }
3097
3097
  connectedCallback() {
3098
3098
  super.connectedCallback();
3099
- const root = this.getRootNode();
3100
- injectChatStyles(root instanceof ShadowRoot || root instanceof Document ? root : document);
3099
+ this._ensureStylesInRoot();
3101
3100
  if (this.transport) {
3102
3101
  this._unsubscribe = this.transport.subscribe(this._handleEvent);
3103
3102
  this.transport.connect();
@@ -3110,9 +3109,42 @@ var SyntroChat = class extends LitElement {
3110
3109
  this.transport?.disconnect();
3111
3110
  }
3112
3111
  firstUpdated() {
3112
+ this._ensureStylesInRoot();
3113
3113
  this._scrollContainer = this.querySelector("[data-sc-scroll-area]");
3114
3114
  this._scrollContainer?.addEventListener("scroll", this._handleScroll);
3115
3115
  }
3116
+ /**
3117
+ * Resolve the *effective* rendering root for this chat instance.
3118
+ *
3119
+ * `this.getRootNode()` will follow shadow boundaries, but in the editor
3120
+ * surface the chat is created via `document.createElement('syntro-chat')`
3121
+ * and then committed into the smart-canvas shadow tree by Lit several
3122
+ * frames after `connectedCallback`. During that window
3123
+ * `getRootNode()` returns Document even though the element ultimately
3124
+ * lives in a shadow root (BUG-1779636600).
3125
+ *
3126
+ * Walk the parent chain manually, hopping across shadow boundaries via
3127
+ * `.host`, and return the deepest enclosing `ShadowRoot` we can reach.
3128
+ * Fall back to `getRootNode()` (Document or self) when no shadow root
3129
+ * is in the chain — that's the host-page chatbot case.
3130
+ */
3131
+ _resolveStyleRoot() {
3132
+ let node = this;
3133
+ while (node) {
3134
+ const parent = node.parentNode;
3135
+ if (parent) {
3136
+ node = parent;
3137
+ continue;
3138
+ }
3139
+ if (node instanceof ShadowRoot) return node;
3140
+ break;
3141
+ }
3142
+ const r = this.getRootNode();
3143
+ return r instanceof ShadowRoot || r instanceof Document ? r : document;
3144
+ }
3145
+ _ensureStylesInRoot() {
3146
+ injectChatStyles(this._resolveStyleRoot());
3147
+ }
3116
3148
  updated() {
3117
3149
  this._injectCodeCopyButtons();
3118
3150
  }
@@ -3238,4 +3270,4 @@ export {
3238
3270
  dompurify/dist/purify.es.mjs:
3239
3271
  (*! @license DOMPurify 3.3.1 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.3.1/LICENSE *)
3240
3272
  */
3241
- //# sourceMappingURL=chunk-DDZFWNVM.js.map
3273
+ //# sourceMappingURL=chunk-K2IG34L7.js.map