@syntrologie/adapt-content 2.8.0-canary.94 → 2.8.0-canary.95

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.
@@ -54,9 +54,17 @@ export declare class AnchorPickerLit extends LitElement {
54
54
  updated(changed: Map<string, unknown>): void;
55
55
  private _attachDocumentListeners;
56
56
  private _detachDocumentListeners;
57
+ /**
58
+ * Resolve the shadow host this picker lives inside, if any. When the picker
59
+ * is mounted inside a shadow root (e.g. the editor SDK mounts inside
60
+ * `<smart-canvas>`'s shadow), `document.elementFromPoint` returns the shadow
61
+ * *host*, not the host page element beneath. Temporarily disabling pointer
62
+ * events on the host lets hit-testing fall through to the host page.
63
+ */
64
+ private _getShadowHost;
57
65
  private _handleMouseMove;
58
66
  private _handleClick;
59
67
  private _handleKeyDown;
60
- render(): import("lit-html").TemplateResult<1> | typeof nothing;
68
+ render(): typeof nothing | import("lit-html").TemplateResult<1>;
61
69
  }
62
70
  //# sourceMappingURL=AnchorPickerLit.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"AnchorPickerLit.d.ts","sourceRoot":"","sources":["../../src/components/AnchorPickerLit.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAQ,UAAU,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AAahD,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;CACrB;AAgBD,qBAAa,eAAgB,SAAQ,UAAU;IAC7C,OAAgB,UAAU;;;;;;;;;;;;;;;;;;;MAOxB;IAEF,QAAQ,UAAS;IACjB,iBAAiB,UAAS;IAC1B,eAAe,EAAE,MAAM,CAA4B;IAGnD,OAAO,CAAC,eAAe,CAAwB;IAC/C,OAAO,CAAC,gBAAgB,CAAM;IAG9B,OAAO,CAAC,UAAU,CAA+B;IAIxC,gBAAgB;I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CA0GhB"}
@@ -38,16 +38,28 @@ export class AnchorPickerLit extends LitElement {
38
38
  this._hoveredSelector = '';
39
39
  // DOM ref for the overlay
40
40
  this._overlayEl = null;
41
- // ---- EVENT HANDLERS ----
42
41
  this._handleMouseMove = (e) => {
43
42
  const overlay = this._overlayEl;
43
+ const shadowHost = this._getShadowHost();
44
44
  // In passthrough mode the overlay is already pointerEvents:'none',
45
45
  // so elementFromPoint can see through it -- no toggle needed.
46
46
  // In non-passthrough mode, temporarily disable to detect elements underneath.
47
47
  if (overlay && !this.passthroughClicks) {
48
48
  overlay.style.pointerEvents = 'none';
49
49
  }
50
+ // If we're inside a shadow root, temporarily hide the host so
51
+ // elementFromPoint can reach the host page underneath. `pointer-events`
52
+ // doesn't work here because any fixed-position descendant inside the
53
+ // shadow tree with pointer-events:auto (e.g. a canvas overlay) causes
54
+ // elementFromPoint to return the shadow host regardless of what the
55
+ // host's own pointer-events is. `visibility:hidden` removes the entire
56
+ // subtree from hit-testing without triggering layout reflow.
57
+ const prevHostVis = shadowHost?.style.visibility;
58
+ if (shadowHost)
59
+ shadowHost.style.visibility = 'hidden';
50
60
  const elementAtPoint = document.elementFromPoint(e.clientX, e.clientY);
61
+ if (shadowHost)
62
+ shadowHost.style.visibility = prevHostVis ?? '';
51
63
  if (overlay && !this.passthroughClicks) {
52
64
  overlay.style.pointerEvents = 'auto';
53
65
  }
@@ -141,6 +153,20 @@ export class AnchorPickerLit extends LitElement {
141
153
  document.removeEventListener('click', this._handleClick, true);
142
154
  document.removeEventListener('keydown', this._handleKeyDown, true);
143
155
  }
156
+ // ---- EVENT HANDLERS ----
157
+ /**
158
+ * Resolve the shadow host this picker lives inside, if any. When the picker
159
+ * is mounted inside a shadow root (e.g. the editor SDK mounts inside
160
+ * `<smart-canvas>`'s shadow), `document.elementFromPoint` returns the shadow
161
+ * *host*, not the host page element beneath. Temporarily disabling pointer
162
+ * events on the host lets hit-testing fall through to the host page.
163
+ */
164
+ _getShadowHost() {
165
+ const root = this.getRootNode();
166
+ if (root instanceof ShadowRoot)
167
+ return root.host;
168
+ return null;
169
+ }
144
170
  // ---- RENDER ----
145
171
  render() {
146
172
  if (!this.isActive)
@@ -85,6 +85,6 @@ export declare class ElementHighlightLit extends LitElement {
85
85
  private _handleClick;
86
86
  private _handleKeyDown;
87
87
  private _handleRemove;
88
- render(): import("lit-html").TemplateResult<1> | typeof nothing;
88
+ render(): typeof nothing | import("lit-html").TemplateResult<1>;
89
89
  }
90
90
  //# sourceMappingURL=ElementHighlightLit.d.ts.map
@@ -5,6 +5,7 @@
5
5
  *
6
6
  * Does NOT pull in any React dependencies.
7
7
  */
8
+ import './components/AnchorPickerLit';
8
9
  import './components/EditorCardLit';
9
10
  import './components/EditorPanelShellLit';
10
11
  import './components/EditorTextareaLit';
@@ -1 +1 @@
1
- {"version":3,"file":"lit-elements.d.ts","sourceRoot":"","sources":["../src/lit-elements.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,4BAA4B,CAAC;AACpC,OAAO,kCAAkC,CAAC;AAC1C,OAAO,gCAAgC,CAAC;AACxC,OAAO,kCAAkC,CAAC;AAC1C,OAAO,4BAA4B,CAAC;AACpC,OAAO,6BAA6B,CAAC"}
1
+ {"version":3,"file":"lit-elements.d.ts","sourceRoot":"","sources":["../src/lit-elements.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,8BAA8B,CAAC;AACtC,OAAO,4BAA4B,CAAC;AACpC,OAAO,kCAAkC,CAAC;AAC1C,OAAO,gCAAgC,CAAC;AACxC,OAAO,kCAAkC,CAAC;AAC1C,OAAO,4BAA4B,CAAC;AACpC,OAAO,6BAA6B,CAAC"}
@@ -5,6 +5,7 @@
5
5
  *
6
6
  * Does NOT pull in any React dependencies.
7
7
  */
8
+ import './components/AnchorPickerLit';
8
9
  import './components/EditorCardLit';
9
10
  import './components/EditorPanelShellLit';
10
11
  import './components/EditorTextareaLit';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@syntrologie/adapt-content",
3
- "version": "2.8.0-canary.94",
3
+ "version": "2.8.0-canary.95",
4
4
  "description": "Adaptive Content app - DOM manipulation actions for text, attributes, and styles",
5
5
  "license": "Proprietary",
6
6
  "private": false,