@helpai/elements 0.30.0 → 0.30.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.
- package/elements-web-component.esm.js +27 -27
- package/elements-web-component.esm.js.map +4 -4
- package/elements.cjs.js +18 -18
- package/elements.cjs.js.map +4 -4
- package/elements.esm.js +18 -18
- package/elements.esm.js.map +4 -4
- package/elements.js +19 -19
- package/elements.js.map +4 -4
- package/index.d.ts +47 -26
- package/index.mjs +554 -524
- package/package.json +1 -1
- package/schema.d.ts +1 -1
- package/web-component.d.ts +11 -5
- package/web-component.mjs +335 -333
package/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { A as Asset, B as BlocksConfig, C as ConnectionConfig, a as ConnectionConfigPartial, H as HandshakeResponse, L as Link, S as ServerConfig, b as SiteConfig, W as WidgetConfig, c as WidgetConfigPartial, d as WidgetSettings, e as WidgetSettingsPartial } from './deployment-
|
|
1
|
+
export { A as Asset, B as BlocksConfig, C as ConnectionConfig, a as ConnectionConfigPartial, H as HandshakeResponse, L as Link, S as ServerConfig, b as SiteConfig, W as WidgetConfig, c as WidgetConfigPartial, d as WidgetSettings, e as WidgetSettingsPartial } from './deployment-rva7dkso.js';
|
|
2
2
|
import 'zod';
|
|
3
3
|
|
|
4
4
|
/**
|
|
@@ -1392,6 +1392,52 @@ interface EventMap {
|
|
|
1392
1392
|
}
|
|
1393
1393
|
type EventName = keyof EventMap;
|
|
1394
1394
|
|
|
1395
|
+
/**
|
|
1396
|
+
* Derives the `data-mode` attribute value from App state.
|
|
1397
|
+
*
|
|
1398
|
+
* Kept as a pure helper (no DOM, no React) so tests can pin the critical
|
|
1399
|
+
* invariants cheaply:
|
|
1400
|
+
*
|
|
1401
|
+
* - `isOpen === false` → `"closed"` regardless of `panelSize`.
|
|
1402
|
+
* This is the reason closing from fullscreen doesn't hide the launcher:
|
|
1403
|
+
* the `[data-mode="fullscreen"] .__P__-fab { display: none }` rule never
|
|
1404
|
+
* matches when the widget is closed.
|
|
1405
|
+
* - `panelSize` is preserved across close → open, so reopening the widget
|
|
1406
|
+
* restores the user's last layout (normal / expanded / fullscreen).
|
|
1407
|
+
* - Inline + standalone are terminal modes: they override any panelSize
|
|
1408
|
+
* because the widget isn't a popover and can't be "closed".
|
|
1409
|
+
*/
|
|
1410
|
+
|
|
1411
|
+
type HostMode = "page" | "standalone" | "inline" | "modal" | "drawer" | "fullscreen" | "expanded" | "open" | "closed";
|
|
1412
|
+
|
|
1413
|
+
/**
|
|
1414
|
+
* Shared widget runtime — the one composition both entry points wrap around
|
|
1415
|
+
* `<App>`.
|
|
1416
|
+
*
|
|
1417
|
+
* `mount()` (`src/index.ts`, programmatic, `widgetId`-keyed registry, returns a
|
|
1418
|
+
* handle) and `<web-ai-chat>` (`src/web-component.ts`, declarative, N-per-page,
|
|
1419
|
+
* no registry) used to each hand-roll the same four things around the App tree:
|
|
1420
|
+
* the ErrorBoundary wrapper, the handshake-config merge, the usage tracker, and
|
|
1421
|
+
* the host-attribute application (position / theme / `data-mode`). That parallel
|
|
1422
|
+
* code drifted three separate times (mode-merge, tracker, ErrorBoundary). This
|
|
1423
|
+
* module is the single source of that composition so it can't drift again — both
|
|
1424
|
+
* entry points only own what's genuinely theirs (mount: iframe + handle + hooks
|
|
1425
|
+
* + registry; web-component: attribute parsing + the custom-element lifecycle).
|
|
1426
|
+
*/
|
|
1427
|
+
|
|
1428
|
+
/**
|
|
1429
|
+
* Determine what `data-mode` the host should start at — matching what App's
|
|
1430
|
+
* mount-time `useEffect` will produce on its first render. Used for the initial
|
|
1431
|
+
* paint in both entry points (and `mount()`'s iframe sizing); after that, App
|
|
1432
|
+
* owns `data-mode` for the lifetime of the instance.
|
|
1433
|
+
*
|
|
1434
|
+
* `resolveInitialPanelState` is the one source of truth for "what does the first
|
|
1435
|
+
* render look like" — App.tsx uses it too. If these two paths ever pick
|
|
1436
|
+
* different initial states, an iframe physically resizes between mount and App's
|
|
1437
|
+
* first effect (the closed→open→closed flicker this pins against).
|
|
1438
|
+
*/
|
|
1439
|
+
declare function resolveInitialHostMode(options: ResolvedOptions): HostMode;
|
|
1440
|
+
|
|
1395
1441
|
/**
|
|
1396
1442
|
* Global lifecycle-hook registry.
|
|
1397
1443
|
*
|
|
@@ -1437,24 +1483,6 @@ declare const HOOK_WILDCARD = "*";
|
|
|
1437
1483
|
*/
|
|
1438
1484
|
type HookListener = (instance: ChatWidgetInstance, event: EventName, data: unknown) => void;
|
|
1439
1485
|
|
|
1440
|
-
/**
|
|
1441
|
-
* Derives the `data-mode` attribute value from App state.
|
|
1442
|
-
*
|
|
1443
|
-
* Kept as a pure helper (no DOM, no React) so tests can pin the critical
|
|
1444
|
-
* invariants cheaply:
|
|
1445
|
-
*
|
|
1446
|
-
* - `isOpen === false` → `"closed"` regardless of `panelSize`.
|
|
1447
|
-
* This is the reason closing from fullscreen doesn't hide the launcher:
|
|
1448
|
-
* the `[data-mode="fullscreen"] .__P__-fab { display: none }` rule never
|
|
1449
|
-
* matches when the widget is closed.
|
|
1450
|
-
* - `panelSize` is preserved across close → open, so reopening the widget
|
|
1451
|
-
* restores the user's last layout (normal / expanded / fullscreen).
|
|
1452
|
-
* - Inline + standalone are terminal modes: they override any panelSize
|
|
1453
|
-
* because the widget isn't a popover and can't be "closed".
|
|
1454
|
-
*/
|
|
1455
|
-
|
|
1456
|
-
type HostMode = "page" | "standalone" | "inline" | "modal" | "drawer" | "fullscreen" | "expanded" | "open" | "closed";
|
|
1457
|
-
|
|
1458
1486
|
/**
|
|
1459
1487
|
* Public ESM entry for `@<brand>/elements`.
|
|
1460
1488
|
*
|
|
@@ -1652,12 +1680,5 @@ declare const brand: {
|
|
|
1652
1680
|
readonly domain: string;
|
|
1653
1681
|
readonly siteUrl: string;
|
|
1654
1682
|
};
|
|
1655
|
-
/**
|
|
1656
|
-
* Determine what `data-mode` the host should start at — matching what
|
|
1657
|
-
* App's mount-time `useEffect` will produce on its first render. Exposed
|
|
1658
|
-
* only for the initial paint path in `mount()` (and the test suite);
|
|
1659
|
-
* after that, App owns `data-mode` for the lifetime of the instance.
|
|
1660
|
-
*/
|
|
1661
|
-
declare function resolveInitialHostMode(options: ResolvedOptions): HostMode;
|
|
1662
1683
|
|
|
1663
1684
|
export { type ChatWidgetInstance, type ChatWidgetOptions, type EventMap, type EventName, HOOK_WILDCARD, type HookListener, type LogEntry, type LogLevel, type ResolvedOptions, brand, destroy, getAllInstances, getInstance, hook, init, mount, resolveInitialHostMode, version };
|