@meltingspot/core 1.3.0 → 1.5.0

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.
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "description": "MeltingSpot Core SDK",
4
4
  "homepage": "https://meltingspot.io",
5
5
  "license": "BSD-3-Clause",
6
- "version": "1.3.0",
6
+ "version": "1.5.0",
7
7
  "main": "./index.umd.js",
8
8
  "module": "./index.mjs",
9
9
  "typings": "./index.d.ts",
package/utils/index.d.ts CHANGED
@@ -3,6 +3,7 @@ export * from './string/sanitizeUrl';
3
3
  export * from './ui/getHTMLElement';
4
4
  export * from './ui/createDialog';
5
5
  export * from './ui/createIframe';
6
+ export * from './ui/createIsolatedShadowHost';
6
7
  export * from './ui/isTouchDevice';
7
8
  export * from './date/date';
8
9
  export * from './date/formatDate';
@@ -0,0 +1,43 @@
1
+ export interface IsolatedShadowHostOptions {
2
+ /** Element id set on the host div (kept in the light DOM so it stays discoverable). */
3
+ id: string;
4
+ /** Stacking order — sits above the host-page content. */
5
+ zIndex: number;
6
+ /**
7
+ * Base font-family re-asserted after `all: initial` — most embedded UI
8
+ * inherits its font rather than setting it per element.
9
+ */
10
+ fontFamily: string;
11
+ /** Optional base font-size (e.g. `'14px'`); omitted leaves the initial. */
12
+ fontSize?: string;
13
+ /** Optional ownership marker attribute, set to `'true'` (e.g. `data-ms-owned`). */
14
+ ownedAttr?: string;
15
+ }
16
+ /**
17
+ * Create a light-DOM host `<div>` + its open shadow root, styled so an embedded
18
+ * UI (Coach SDK, playbook-editor, …) is fully isolated from — and neutral to —
19
+ * the host page's layout and CSS. Shared so every integration applies the exact
20
+ * same isolation recipe (COM-9421 / COM-9389).
21
+ *
22
+ * A shadow root blocks the host page's SELECTORS from matching the embedded UI,
23
+ * but two leaks remain that this host closes:
24
+ * - INHERITED properties (font, color, letter-spacing, text-transform, …)
25
+ * still cascade through the host element into the shadow tree. `all: initial`
26
+ * resets every one of them. Custom properties are exempt from `all`, so a var
27
+ * set on the host afterwards (e.g. an accent color) survives; `direction` is
28
+ * the one inherited property `all` skips, so it is pinned to `ltr`.
29
+ * - The host div would otherwise participate in the page's flow (a `display:flex`
30
+ * `<body>` would treat it as a flex item, shifting the page and the UI).
31
+ * `position: fixed` takes it out of flow; `pointer-events: none` lets clicks
32
+ * fall through empty areas (interactive descendants re-enable it).
33
+ *
34
+ * Every declaration is `!important` so an inline style beats a hostile host
35
+ * `!important` rule (e.g. a page-wide `* { … !important }`).
36
+ *
37
+ * The caller owns appending the host to the document, injecting styles/content
38
+ * into the returned shadow root, and any host-specific properties.
39
+ */
40
+ export declare const createIsolatedShadowHost: (options: IsolatedShadowHostOptions) => {
41
+ host: HTMLDivElement;
42
+ shadowRoot: ShadowRoot;
43
+ };