@syntrologie/adapt-faq 2.8.0-canary.42 → 2.8.0-canary.421

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.
Files changed (52) hide show
  1. package/dist/FAQWidgetLit.d.ts +280 -0
  2. package/dist/FAQWidgetLit.d.ts.map +1 -0
  3. package/dist/FAQWidgetLit.editable.d.ts +154 -0
  4. package/dist/FAQWidgetLit.editable.d.ts.map +1 -0
  5. package/dist/answerRendering.d.ts +4 -0
  6. package/dist/answerRendering.d.ts.map +1 -0
  7. package/dist/chunk-7DTOSQNC.js +43 -0
  8. package/dist/chunk-7DTOSQNC.js.map +7 -0
  9. package/dist/chunk-AKSRGHHM.js +232 -0
  10. package/dist/chunk-AKSRGHHM.js.map +7 -0
  11. package/dist/chunk-KRKRB4OL.js +598 -0
  12. package/dist/chunk-KRKRB4OL.js.map +7 -0
  13. package/dist/editor.d.ts +60 -33
  14. package/dist/editor.d.ts.map +1 -1
  15. package/dist/editor.js +5054 -313
  16. package/dist/editor.js.map +7 -0
  17. package/dist/faq-item-editor.d.ts +33 -0
  18. package/dist/faq-item-editor.d.ts.map +1 -0
  19. package/dist/faq-styles.d.ts +66 -1
  20. package/dist/faq-styles.d.ts.map +1 -1
  21. package/dist/faq-types.d.ts +4 -0
  22. package/dist/faq-types.d.ts.map +1 -1
  23. package/dist/renderHealth.d.ts +81 -0
  24. package/dist/renderHealth.d.ts.map +1 -0
  25. package/dist/runtime.d.ts +17 -5
  26. package/dist/runtime.d.ts.map +1 -1
  27. package/dist/runtime.js +1641 -64
  28. package/dist/runtime.js.map +7 -0
  29. package/dist/schema.d.ts +1232 -555
  30. package/dist/schema.d.ts.map +1 -1
  31. package/dist/schema.js +300 -207
  32. package/dist/schema.js.map +7 -0
  33. package/dist/types.d.ts +36 -0
  34. package/dist/types.d.ts.map +1 -1
  35. package/package.json +7 -12
  36. package/dist/FAQWidget.d.ts +0 -33
  37. package/dist/FAQWidget.d.ts.map +0 -1
  38. package/dist/FAQWidget.js +0 -391
  39. package/dist/cdn.d.ts +0 -70
  40. package/dist/cdn.d.ts.map +0 -1
  41. package/dist/cdn.js +0 -46
  42. package/dist/executors.js +0 -150
  43. package/dist/faq-styles.js +0 -204
  44. package/dist/faq-types.js +0 -7
  45. package/dist/state.js +0 -132
  46. package/dist/summarize.js +0 -62
  47. package/dist/types.js +0 -17
  48. package/node_modules/@syntrologie/sdk-contracts/dist/index.d.ts +0 -129
  49. package/node_modules/@syntrologie/sdk-contracts/dist/index.js +0 -15
  50. package/node_modules/@syntrologie/sdk-contracts/dist/schemas.d.ts +0 -2225
  51. package/node_modules/@syntrologie/sdk-contracts/dist/schemas.js +0 -162
  52. package/node_modules/@syntrologie/sdk-contracts/package.json +0 -33
@@ -0,0 +1,280 @@
1
+ /**
2
+ * Adaptive FAQ - FAQWidgetLit
3
+ *
4
+ * Lit web component equivalent of FAQWidget.tsx.
5
+ * Renders a collapsible Q&A accordion with search, category grouping,
6
+ * feedback, and markdown rendering — all as a custom element with no
7
+ * Shadow DOM (light DOM via createRenderRoot).
8
+ *
9
+ * Tag name: <syntro-faq-accordion>
10
+ *
11
+ * Decorator-free: uses `static override properties` (tsconfig has no
12
+ * experimentalDecorators).
13
+ */
14
+ import { LitElement, nothing } from 'lit';
15
+ import type { FAQWidgetRuntime } from './faq-types';
16
+ import type { FAQConfig, FeedbackValue } from './types';
17
+ /**
18
+ * <syntro-faq-accordion> — light-DOM Lit web component.
19
+ *
20
+ * Set properties imperatively (no attribute serialisation for objects):
21
+ * el.faqConfig = { expandBehavior: 'single', ... };
22
+ * el.runtime = runtimeInstance;
23
+ * el.instanceId = 'my-faq';
24
+ */
25
+ export declare class FAQAccordionElement extends LitElement {
26
+ #private;
27
+ static properties: {
28
+ faqConfig: {
29
+ attribute: boolean;
30
+ };
31
+ runtime: {
32
+ attribute: boolean;
33
+ };
34
+ instanceId: {
35
+ type: StringConstructor;
36
+ };
37
+ _openId: {
38
+ state: boolean;
39
+ };
40
+ _activeFace: {
41
+ state: boolean;
42
+ };
43
+ _flipAnimating: {
44
+ state: boolean;
45
+ };
46
+ _flipDir: {
47
+ state: boolean;
48
+ };
49
+ _highlightId: {
50
+ state: boolean;
51
+ };
52
+ _searchQuery: {
53
+ state: boolean;
54
+ };
55
+ _feedbackState: {
56
+ state: boolean;
57
+ };
58
+ _hoveredId: {
59
+ state: boolean;
60
+ };
61
+ };
62
+ faqConfig: FAQConfig;
63
+ runtime: FAQWidgetRuntime | null;
64
+ instanceId: string;
65
+ private _generatedUid;
66
+ _openId: string | null;
67
+ _activeFace: 'front' | 'back';
68
+ _flipAnimating: boolean;
69
+ _flipDir: 'in' | 'out';
70
+ _highlightId: string | null;
71
+ _searchQuery: string;
72
+ _feedbackState: Map<string, FeedbackValue>;
73
+ _hoveredId: string | null;
74
+ private _flipSettleTimer;
75
+ private _pendingFocus;
76
+ private _focusReturnId;
77
+ private _unsubContext;
78
+ private _unsubAccumulator;
79
+ private _unsubCta;
80
+ private _unsubDeepLink;
81
+ private _unsubSessionMetrics;
82
+ private _highlightTimer;
83
+ private _unsubCompositional;
84
+ private _tileId;
85
+ /** Instance ids already appended via the compositional bus — dedups
86
+ * the subscribe-then-replay path (and re-subscribes on runtime change). */
87
+ private _llmAppendedIds;
88
+ constructor();
89
+ createRenderRoot(): this;
90
+ connectedCallback(): void;
91
+ disconnectedCallback(): void;
92
+ updated(changedProps: Map<string, unknown>): void;
93
+ /**
94
+ * Move focus to the face that just became active after a flip (a11y). On
95
+ * flip-to-back, focus the ‹ Back button; on flip-to-front, focus the question
96
+ * row that originally opened the detail (so keyboard/AT users land back where
97
+ * they were). No-op when nothing is pending or the target isn't in the DOM
98
+ * yet (the flip-to-front row may not exist if the list changed).
99
+ */
100
+ private _applyPendingFocus;
101
+ private _subscribeAll;
102
+ /**
103
+ * Subscribe to `element.compositional_*` events targeting this accordion's
104
+ * tile, and ask the element store to replay any items it already holds for
105
+ * us (covers the case where the accordion mounts AFTER the item did — the
106
+ * inline-slot hydration race that otherwise silently drops the question).
107
+ */
108
+ private _subscribeCompositional;
109
+ /** Tile id for compositional filtering: the enclosing tile card's
110
+ * `data-tile-id` (set by SyntroTileCard), falling back to `instanceId`
111
+ * when the accordion is mounted outside a tile card. */
112
+ private _resolveTileId;
113
+ /** Append (or prepend) a faq:question the LLM mounted. The wire shape is a
114
+ * fully-formed `{kind, config}` envelope, so we store it verbatim. */
115
+ private _insertItem;
116
+ /** Replace an existing question's content (full replacement). */
117
+ private _patchItem;
118
+ /** Remove a question by instance id. */
119
+ private _removeItem;
120
+ /**
121
+ * Re-evaluate whether the open question is still visible, then re-render.
122
+ * Called from the subscription-driven re-render paths (context / accumulator /
123
+ * sessionMetric changes). Those subscriptions can flip an open question's
124
+ * `triggerWhen` to false WITHOUT a compositional patch/remove — so without
125
+ * this hook the stale-open reset (`_resetFaceIfOpenStale`, otherwise only
126
+ * invoked on patch/remove) would never fire on the triggerWhen path, and an
127
+ * open question gated out this way would snap straight to the back face on
128
+ * re-appearance. `_resetFaceIfOpenStale` mutates reactive state (which itself
129
+ * schedules an update), and we still `requestUpdate()` for the no-op case.
130
+ */
131
+ private _reevaluateOpenAndUpdate;
132
+ /**
133
+ * If `_openId` no longer resolves against the visible/ordered list (gated out
134
+ * by triggerWhen, removed, or patched away), reset BOTH `_openId` and
135
+ * `_activeFace` to the front (and clear the pending a11y focus intent).
136
+ * Resolves against the SAME `ordered` list render() uses (visible + ordered,
137
+ * NOT search-filtered). Also cancels any pending back-clear timer. Invoked on
138
+ * compositional patch/remove AND on the subscription-driven re-render paths
139
+ * (via {@link _reevaluateOpenAndUpdate}) so the triggerWhen-gated-out case is
140
+ * genuinely covered. Keeping `_activeFace` on 'back' after the open id went
141
+ * stale is the bug this guards: render() would force the front face locally
142
+ * but leave state on 'back', so a later re-appearance snaps to the back face
143
+ * with no animation.
144
+ */
145
+ private _resetFaceIfOpenStale;
146
+ private _unsubscribeAll;
147
+ /**
148
+ * Master→detail takeover: tapping a list row opens its single-Q&A detail
149
+ * view (the whole widget swaps), so a long answer fills — and never
150
+ * overflows — the bounded velvet tile. There is no simultaneous multi-expand;
151
+ * one question owns the tile at a time.
152
+ */
153
+ private _handleOpen;
154
+ /**
155
+ * Put the widget into the DETAIL (back) face for `id` and flip to it. Shared
156
+ * by the tap handler and the event-driven entry points (faq:open CTA,
157
+ * notification.deep_link) so every "open this question" path flips the same
158
+ * way. Cancels any pending back-clear timer (a re-open before the flip-out
159
+ * finishes must keep the detail mounted). Remembers the originating question
160
+ * id so focus can return to that exact row on flip-to-front (a11y), and moves
161
+ * focus to the ‹ Back button once the back face renders.
162
+ */
163
+ private _openToDetail;
164
+ /** Back affordance: FLIP from the detail (back) face to the list (front) face.
165
+ * We flip immediately but keep `_openId` (so the back face stays populated
166
+ * through the rotation, never blank mid-flip); the id clears once the
167
+ * transition completes. With reduced motion there's no transition, so it
168
+ * clears synchronously.
169
+ *
170
+ * Timer/token coupling: the tear-down delay is {@link _flipDurationMs} — the
171
+ * computed `--vc-transition-duration` token (clamped to be >= our fallback),
172
+ * NOT a hardcoded constant. A host that sets the token slower than the
173
+ * fallback would otherwise clear `_openId` (blanking the back face) before
174
+ * the rotation finished. Focus returns to the originating question row. */
175
+ private _handleBack;
176
+ /** Tear down the flip's 3D machinery so the shown face renders FLAT. Fired by
177
+ * the container's `animationend`, the belt timer, or synchronously under
178
+ * reduced motion. A flip-OUT (back→front) also clears `_openId` here — the
179
+ * moment it's finally safe to empty the back face without blanking it
180
+ * mid-rotation. */
181
+ private _settleFlip;
182
+ /** animationend on the flip container → the rotation is done, render flat. */
183
+ private _onFlipAnimationEnd;
184
+ private _clearFlipSettleTimer;
185
+ private _handleFeedback;
186
+ /**
187
+ * Unified render list. Merges compositionally-appended rows
188
+ * (`faqConfig.actions`, the container-then-stream path) with atomically
189
+ * authored rows (`faqConfig.questions`, the struct_list path) normalized
190
+ * into the same `FAQQuestionAction` shape. The atomic path is how the LLM
191
+ * mounts a complete FAQ in one call — so it renders whole, never empty.
192
+ */
193
+ private _allQuestions;
194
+ private _visibleQuestions;
195
+ private _orderedQuestions;
196
+ private _filteredQuestions;
197
+ private _categoryGroups;
198
+ /**
199
+ * The `data-adaptive-id` scope for this element's injected <style>. When
200
+ * `instanceId` is left at the shared default (`'faq-widget'`), two tiles would
201
+ * both scope to `[data-adaptive-id="faq-widget"]` and cross-style each other.
202
+ * In that case we fall back to a per-element generated uid so each default tile
203
+ * gets its own scope. A caller-provided instanceId is used verbatim.
204
+ */
205
+ private get _scopeId();
206
+ /**
207
+ * The flip transition duration in ms, coupled to the CSS. Reads the computed
208
+ * `--vc-transition-duration` token off this element at runtime so the JS timer
209
+ * that tears down the back face (see {@link _handleBack}) is ALWAYS >= the CSS
210
+ * transition — a host that sets the token slower than our hardcoded default no
211
+ * longer blanks the back face before the flip visually finishes. Falls back to
212
+ * {@link FLIP_TRANSITION_MS} when the token is absent/unreadable (no live
213
+ * layout, jsdom). We add a small buffer and take the max of the token and the
214
+ * fallback so the timer never undershoots either.
215
+ */
216
+ private _flipDurationMs;
217
+ /**
218
+ * Self-injected flip CSS. The FAQ tile is a light-DOM widget mounted across
219
+ * several canvases (velvet, default, onflow) and standalone — velvet ships a
220
+ * GENERIC, unscoped `[data-active-face]` flip rule (for the product card), but
221
+ * the other hosts don't. So the FAQ carries its own copy of the SAME 3D-flip
222
+ * technique, scoped to THIS instance (`[data-adaptive-id="…"]`) so it can't
223
+ * leak onto a sibling widget.
224
+ *
225
+ * Two deliberate departures from a naive copy of velvet's rule:
226
+ *
227
+ * 1. PERSPECTIVE goes on the PARENT viewport wrapper
228
+ * (`[data-faq-flip-viewport]`), NOT on the rotating `[data-faq-flip]`
229
+ * element. CSS `perspective` only gives depth to a DESCENDANT's transform —
230
+ * putting it on the element that itself rotates does nothing (a flat
231
+ * squash). We ALSO fold `perspective(...)` into the
232
+ * rotate transform itself as a belt-and-braces measure, so the flip has
233
+ * real 3D depth even inside velvet's bounded `overflow:hidden` deck card
234
+ * (which can otherwise flatten a parent `perspective`).
235
+ * 2. The active-face attribute is NAMESPACED (`data-faq-active-face`), so
236
+ * velvet's generic `[data-active-face]` rotate rule can't ALSO reach this
237
+ * container and double-apply its (perspective-less) transform.
238
+ *
239
+ * It mirrors the product card / velvet house style: rotateY, preserve-3d,
240
+ * backface-visibility, and the `--vc-transition-duration` / `--vc-transition-
241
+ * easing` tokens (with a ~240ms fallback) so the two tiles feel consistent.
242
+ * `prefers-reduced-motion` disables the rotation — the JS (see
243
+ * {@link _handleBack}) clears state synchronously in that case.
244
+ */
245
+ private _renderFlipStyles;
246
+ private _renderAnswer;
247
+ private _renderFeedback;
248
+ /**
249
+ * LIST-view row. A tappable question with its chevron \u2014 but NO inline answer
250
+ * body. Tapping it takes over the tile with the question's detail view (see
251
+ * {@link _renderDetail}). Keeps the per-row look/markers/highlight from the
252
+ * old accordion minus the inline-expanded answer that overflowed the tile.
253
+ */
254
+ private _renderItem;
255
+ private _renderItems;
256
+ /**
257
+ * DETAIL view \u2014 the master\u2192detail takeover. Renders ONLY the open question:
258
+ * a back affordance, the question prominently, and its full answer via the
259
+ * SAME {@link _renderAnswer}/`renderAnswerHtml` path (all answer formats still
260
+ * work). The answer area scrolls if extremely long, so a single answer fills
261
+ * the bounded velvet tile and never pushes content past the `overflow:hidden`
262
+ * clip.
263
+ */
264
+ private _renderDetail;
265
+ /**
266
+ * "Dive deeper" (items 4/5) — hand the open question's context back to the
267
+ * CHAT as a deep-dive turn, so a clamped answer never leaves the visitor
268
+ * stuck. Canvas-agnostic: dispatches the neutral DIVE_DEEPER_EVENT; the
269
+ * chat-bar mountable turns it into a user-visible turn. The answer text rides
270
+ * along as (trimmed) context so the agent grounds its fuller reply.
271
+ */
272
+ private _handleDiveDeeper;
273
+ render(): import("lit-html").TemplateResult<1> | typeof nothing;
274
+ /** The FRONT face — search box, the question list (optionally grouped by
275
+ * category), and the no-results message. Extracted so both faces can live in
276
+ * the DOM at once for the flip. */
277
+ private _renderListFace;
278
+ }
279
+ export default FAQA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G;IACH,OAAO,CAAC,iBAAiB;IAkEzB,OAAO,CAAC,aAAa;IAQrB,OAAO,CAAC,eAAe;IAsCvB;;;;;OAKG;IACH,OAAO,CAAC,WAAW;IAoDnB,OAAO,CAAC,YAAY;IAIpB;;;;;;;OAOG;IACH,OAAO,CAAC,aAAa;IA2DrB;;;;;;OAMG;IACH,OAAO,CAAC,iBAAiB;IAchB,MAAM;IAiHf;;wCAEoC;IACpC,OAAO,CAAC,eAAe;CAoExB;AAUD,eAAe,mBAAmB,CAAC"}
@@ -0,0 +1,154 @@
1
+ /**
2
+ * Adaptive FAQ - FAQWidgetLit.editable
3
+ *
4
+ * Editable variant of the FAQ accordion for the canvas editor surface.
5
+ * Renders the same Q&A rows as <syntro-faq-accordion> but adds:
6
+ * - Pencil button per row (shows on hover, calls controller.editItem on click)
7
+ * - Click on question text expands/collapses to show the answer (normal FAQ behavior)
8
+ * - Drag handle per row when items.length >= 2
9
+ * - Drag-and-drop reorder via the sortable utility (injected via mount config)
10
+ * - Read-only fallback when controller is null
11
+ *
12
+ * Tag name: <syntro-faq-accordion-editable>
13
+ *
14
+ * Decorator-free: uses `static override properties` (matches codebase convention).
15
+ * Light DOM: inherits host-page CSS variables (same as <syntro-faq-accordion>).
16
+ *
17
+ * Cross-package import safety:
18
+ * The controller is typed as a structural `ControllerLike` interface defined
19
+ * locally — NOT imported from @syntrologie/editor-sdk. This prevents a
20
+ * dependency cycle (editor-sdk imports adapt-faq's editable; adapt-faq cannot
21
+ * import editor-sdk). The real EditModeController satisfies ControllerLike
22
+ * structurally.
23
+ *
24
+ * Similarly, `makeSortable` is passed in as a `SortableFn` option rather than
25
+ * imported directly. The editor-sdk bootstrap (setupEditModeBootstrap.ts) threads
26
+ * the real makeSortable through the FAQWidgetLitEditableMountable.mount() call.
27
+ * This is Alternative C from the architecture decision log, and matches the
28
+ * structural-interface pattern already used for the controller.
29
+ */
30
+ import { LitElement } from 'lit';
31
+ import type { FAQConfig } from './types';
32
+ /**
33
+ * Structural interface — describes only the methods the editable widget needs.
34
+ * The real EditModeController satisfies this by structural subtyping.
35
+ *
36
+ * `tileId` (the host tile's id, threaded in via `instanceId` at mount) scopes
37
+ * controller calls to the active tile when a canvas has multiple FAQ tiles.
38
+ * It is optional so single-tile and v2 actions-shape canvases continue to work.
39
+ */
40
+ export interface ControllerLike {
41
+ editItem(adaptive: string, itemId: string, tileId?: string): void;
42
+ editContainer(adaptive: string, tileId?: string): void;
43
+ isModalOpen(): boolean;
44
+ reorderItems(adaptive: string, newOrder: string[], tileId?: string): void;
45
+ }
46
+ /** Return value from makeSortable. */
47
+ export interface SortableHandle {
48
+ destroy(): void;
49
+ }
50
+ /** Options subset that FAQAccordionEditableElement passes into the sortable. */
51
+ export interface SortableOptions {
52
+ itemSelector: string;
53
+ handleSelector: string;
54
+ getItems: () => string[];
55
+ onReorder: (newOrder: string[]) => void;
56
+ liveRegion: HTMLElement;
57
+ }
58
+ /**
59
+ * Structural type matching `makeSortable` from editor-sdk's sortable.ts.
60
+ * Injected at mount time by FAQWidgetLitEditableMountable.
61
+ */
62
+ export type SortableFn = (host: HTMLElement, opts: SortableOptions) => SortableHandle;
63
+ /**
64
+ * <syntro-faq-accordion-editable> — light-DOM Lit element.
65
+ *
66
+ * Set properties imperatively (no attribute serialisation for objects):
67
+ * el.faqConfig = { ... };
68
+ * el.controller = editModeControllerInstance; // null → read-only
69
+ */
70
+ export declare class FAQAccordionEditableElement extends LitElement {
71
+ static properties: {
72
+ faqConfig: {
73
+ attribute: boolean;
74
+ };
75
+ controller: {
76
+ attribute: boolean;
77
+ };
78
+ tileId: {
79
+ attribute: boolean;
80
+ };
81
+ _hoveredId: {
82
+ state: boolean;
83
+ };
84
+ _expandedId: {
85
+ state: boolean;
86
+ };
87
+ _containerHovered: {
88
+ state: boolean;
89
+ };
90
+ };
91
+ faqConfig: FAQConfig;
92
+ /** Null when loaded without an editor context — renders read-only accordion. */
93
+ controller: ControllerLike | null;
94
+ /**
95
+ * Host tile id, threaded in via the mountable's `instanceId`. Scopes every
96
+ * controller call so the right tile is targeted when the canvas has more
97
+ * than one FAQ tile (per-route FAQs). Empty string when unknown.
98
+ */
99
+ tileId: string;
100
+ /**
101
+ * The `makeSortable` factory to use. Injected by FAQWidgetLitEditableMountable
102
+ * from the editor-sdk bootstrap so there is no direct import from editor-sdk
103
+ * into this package (which would create a circular dependency).
104
+ *
105
+ * Null when running without the editor context (read-only mode).
106
+ */
107
+ sortable: SortableFn | null;
108
+ /**
109
+ * Shared aria-live region from the modal host, threaded in via mount config.
110
+ * Falls back to a detached element when running outside the editor context.
111
+ *
112
+ * TODO(phase-2-a11y): wire shared live region from modal host for real a11y.
113
+ */
114
+ liveRegion: HTMLElement | null;
115
+ _hoveredId: string | null;
116
+ _expandedId: string | null;
117
+ _containerHovered: boolean;
118
+ private _sortableHandle;
119
+ createRenderRoot(): this;
120
+ connectedCallback(): void;
121
+ /**
122
+ * Wire (or re-wire) the sortable whenever the properties it depends on change.
123
+ * `updated()` fires after every render, including the first, so we don't need
124
+ * a separate `firstUpdated()` call — using `updated()` alone avoids a double
125
+ * attach on mount (firstUpdated + updated both fire on first render).
126
+ */
127
+ protected updated(changed: Map<string, unknown>): void;
128
+ disconnectedCallback(): void;
129
+ private _attachSortable;
130
+ private _handleEdit;
131
+ private _handlePencilClick;
132
+ private _handleContainerEdit;
133
+ private _toggleExpand;
134
+ private _renderRow;
135
+ render(): import("lit-html").TemplateResult<1>;
136
+ }
137
+ /**
138
+ * Mountable for <syntro-faq-accordion-editable>.
139
+ *
140
+ * Follows the same mount pattern as FAQWidgetLitMountable in runtime.ts.
141
+ * Accepts a `controller` in addition to `faqConfig` so the editor can
142
+ * wire up the EditModeController at mount time.
143
+ */
144
+ export declare const FAQWidgetLitEditableMountable: {
145
+ mount(container: HTMLElement, config?: FAQConfig & {
146
+ instanceId?: string;
147
+ controller?: ControllerLike | null;
148
+ /** makeSortable factory injected by editor-sdk bootstrap. Null → drag disabled. */
149
+ sortable?: SortableFn | null;
150
+ /** Shared aria-live region from the modal host for sortable announcements. */
151
+ liveRegion?: HTMLElement | null;
152
+ }): () => void;
153
+ };
154
+ //# sourceMappingURL=FAQWidgetLit.editable.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FAQWidgetLit.editable.d.ts","sourceRoot":"","sources":["../src/FAQWidgetLit.editable.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,OAAO,EAAQ,UAAU,EAAW,MAAM,KAAK,CAAC;AAIhD,OAAO,KAAK,EAAE,SAAS,EAAqB,MAAM,SAAS,CAAC;AAM5D;;;;;;;GAOG;AACH,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAClE,aAAa,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACvD,WAAW,IAAI,OAAO,CAAC;IACvB,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC3E;AAMD,sCAAsC;AACtC,MAAM,WAAW,cAAc;IAC7B,OAAO,IAAI,IAAI,CAAC;CACjB;AAED,gFAAgF;AAChF,MAAM,WAAW,eAAe;IAC9B,YAAY,EAAE,MAAM,CAAC;IACrB,cAAc,EAAE,MAAM,CAAC;IACvB,QAAQ,EAAE,MAAM,MAAM,EAAE,CAAC;IACzB,SAAS,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;IACxC,UAAU,EAAE,WAAW,CAAC;CACzB;AAED;;;GAGG;AACH,MAAM,MAAM,UAAU,GAAG,CAAC,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,eAAe,KAAK,cAAc,CAAC;AAuJtF;;;;;;GAMG;AACH,qBAAa,2BAA4B,SAAQ,UAAU;IAKzD,OAAgB,UAAU;;;;;;;;;;;;;;;;;;;MASxB;IAMF,SAAS,EAAE,SAAS,CAKlB;IAEF,gFAAgF;IAChF,UAAU,EAAE,cAAc,GAAG,IAAI,CAAQ;IAEzC;;;;OAIG;IACH,MAAM,SAAM;IAEZ;;;;;;OAMG;IACH,QAAQ,EAAE,UAAU,GAAG,IAAI,CAAQ;IAEnC;;;;;OAKG;IACH,UAAU,EAAE,WAAW,GAAG,IAAI,CAAQ;IAEtC,UAAU,EAAE,MAAM,GAAG,IAAI,CAAQ;IACjC,WAAW,EAAE,MAAM,GAAG,IAAI,CAAQ;IAClC,iBAAiB,UAAS;IAM1B,OAAO,CAAC,eAAe,CAA+B;IAM7C,gBAAgB;IAIhB,iBAAiB,IAAI,IAAI;IASlC;;;;;OAKG;cACgB,OAAO,CAAC,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;IAQtD,oBAAoB,IAAI,IAAI;IAMrC,OAAO,CAAC,eAAe;IAuBvB,OAAO,CAAC,WAAW;IAMnB,OAAO,CAAC,kBAAkB;IAK1B,OAAO,CAAC,oBAAoB;IAM5B,OAAO,CAAC,aAAa;IAQrB,OAAO,CAAC,UAAU;IA2DT,MAAM;CAuEhB;AAcD;;;;;;GAMG;AACH,eAAO,MAAM,6BAA6B;qBAE3B,WAAW,WACb,SAAS,GAAG;QACnB,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,UAAU,CAAC,EAAE,cAAc,GAAG,IAAI,CAAC;QACnC,mFAAmF;QACnF,QAAQ,CAAC,EAAE,UAAU,GAAG,IAAI,CAAC;QAC7B,8EAA8E;QAC9E,UAAU,CAAC,EAAE,WAAW,GAAG,IAAI,CAAC;KACjC;CAkCJ,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { FAQAnswer } from './types';
2
+ export declare function getAnswerText(answer: FAQAnswer): string;
3
+ export declare function renderAnswerHtml(answer: FAQAnswer): string;
4
+ //# sourceMappingURL=answerRendering.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"answerRendering.d.ts","sourceRoot":"","sources":["../src/answerRendering.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAIzC,wBAAgB,aAAa,CAAC,MAAM,EAAE,SAAS,GAAG,MAAM,CAIvD;AAED,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,SAAS,GAAG,MAAM,CAQ1D"}
@@ -0,0 +1,43 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __typeError = (msg) => {
8
+ throw TypeError(msg);
9
+ };
10
+ var __commonJS = (cb, mod) => function __require() {
11
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
12
+ };
13
+ var __copyProps = (to, from, except, desc) => {
14
+ if (from && typeof from === "object" || typeof from === "function") {
15
+ for (let key of __getOwnPropNames(from))
16
+ if (!__hasOwnProp.call(to, key) && key !== except)
17
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
18
+ }
19
+ return to;
20
+ };
21
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
22
+ // If the importer is in node compatibility mode or this is not an ESM
23
+ // file that has been converted to a CommonJS file using a Babel-
24
+ // compatible transform (i.e. "__esModule" has not been set), then set
25
+ // "default" to the CommonJS "module.exports" for node compatibility.
26
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
27
+ mod
28
+ ));
29
+ var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
30
+ var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
31
+ var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
32
+ var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
33
+ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
34
+
35
+ export {
36
+ __commonJS,
37
+ __toESM,
38
+ __privateGet,
39
+ __privateAdd,
40
+ __privateSet,
41
+ __privateMethod
42
+ };
43
+ //# sourceMappingURL=chunk-7DTOSQNC.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": [],
4
+ "sourcesContent": [],
5
+ "mappings": "",
6
+ "names": []
7
+ }