@syntrologie/adapt-faq 2.8.0-canary.49 → 2.8.0-canary.490

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 (55) hide show
  1. package/dist/FAQWidgetLit.d.ts +225 -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/cdn.d.ts +27 -41
  8. package/dist/cdn.d.ts.map +1 -1
  9. package/dist/cdn.js +33 -44
  10. package/dist/cdn.js.map +7 -0
  11. package/dist/chunk-7DTOSQNC.js +43 -0
  12. package/dist/chunk-7DTOSQNC.js.map +7 -0
  13. package/dist/chunk-AJELMQH5.js +1671 -0
  14. package/dist/chunk-AJELMQH5.js.map +7 -0
  15. package/dist/chunk-KRKRB4OL.js +598 -0
  16. package/dist/chunk-KRKRB4OL.js.map +7 -0
  17. package/dist/chunk-YNDAVOD7.js +234 -0
  18. package/dist/chunk-YNDAVOD7.js.map +7 -0
  19. package/dist/editor.d.ts +60 -33
  20. package/dist/editor.d.ts.map +1 -1
  21. package/dist/editor.js +5057 -313
  22. package/dist/editor.js.map +7 -0
  23. package/dist/faq-item-editor.d.ts +33 -0
  24. package/dist/faq-item-editor.d.ts.map +1 -0
  25. package/dist/faq-styles.d.ts +66 -1
  26. package/dist/faq-styles.d.ts.map +1 -1
  27. package/dist/faq-types.d.ts +4 -0
  28. package/dist/faq-types.d.ts.map +1 -1
  29. package/dist/renderHealth.d.ts +81 -0
  30. package/dist/renderHealth.d.ts.map +1 -0
  31. package/dist/runtime.d.ts +17 -5
  32. package/dist/runtime.d.ts.map +1 -1
  33. package/dist/runtime.js +13 -65
  34. package/dist/runtime.js.map +7 -0
  35. package/dist/schema.d.ts +1372 -635
  36. package/dist/schema.d.ts.map +1 -1
  37. package/dist/schema.js +300 -207
  38. package/dist/schema.js.map +7 -0
  39. package/dist/types.d.ts +36 -0
  40. package/dist/types.d.ts.map +1 -1
  41. package/package.json +14 -12
  42. package/dist/FAQWidget.d.ts +0 -33
  43. package/dist/FAQWidget.d.ts.map +0 -1
  44. package/dist/FAQWidget.js +0 -392
  45. package/dist/executors.js +0 -150
  46. package/dist/faq-styles.js +0 -204
  47. package/dist/faq-types.js +0 -7
  48. package/dist/state.js +0 -132
  49. package/dist/summarize.js +0 -62
  50. package/dist/types.js +0 -17
  51. package/node_modules/@syntrologie/sdk-contracts/dist/index.d.ts +0 -129
  52. package/node_modules/@syntrologie/sdk-contracts/dist/index.js +0 -15
  53. package/node_modules/@syntrologie/sdk-contracts/dist/schemas.d.ts +0 -2225
  54. package/node_modules/@syntrologie/sdk-contracts/dist/schemas.js +0 -162
  55. package/node_modules/@syntrologie/sdk-contracts/package.json +0 -33
@@ -0,0 +1,225 @@
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
+ _highlightId: {
38
+ state: boolean;
39
+ };
40
+ _searchQuery: {
41
+ state: boolean;
42
+ };
43
+ _feedbackState: {
44
+ state: boolean;
45
+ };
46
+ _hoveredId: {
47
+ state: boolean;
48
+ };
49
+ };
50
+ faqConfig: FAQConfig;
51
+ runtime: FAQWidgetRuntime | null;
52
+ instanceId: string;
53
+ private _generatedUid;
54
+ private readonly _flip;
55
+ get _openId(): string | null;
56
+ get _activeFace(): 'front' | 'back';
57
+ get _flipAnimating(): boolean;
58
+ _highlightId: string | null;
59
+ _searchQuery: string;
60
+ _feedbackState: Map<string, FeedbackValue>;
61
+ _hoveredId: string | null;
62
+ private _pendingFocus;
63
+ private _focusReturnId;
64
+ private _unsubContext;
65
+ private _unsubAccumulator;
66
+ private _unsubStateChanged;
67
+ private _unsubCta;
68
+ private _unsubDeepLink;
69
+ private _unsubSessionMetrics;
70
+ private _highlightTimer;
71
+ private _unsubCompositional;
72
+ private _tileId;
73
+ /** Instance ids already appended via the compositional bus — dedups
74
+ * the subscribe-then-replay path (and re-subscribes on runtime change). */
75
+ private _llmAppendedIds;
76
+ constructor();
77
+ createRenderRoot(): this;
78
+ connectedCallback(): void;
79
+ disconnectedCallback(): void;
80
+ updated(changedProps: Map<string, unknown>): void;
81
+ /**
82
+ * Move focus to the face that just became active after a flip (a11y). On
83
+ * flip-to-back, focus the ‹ Back button; on flip-to-front, focus the question
84
+ * row that originally opened the detail (so keyboard/AT users land back where
85
+ * they were). No-op when nothing is pending or the target isn't in the DOM
86
+ * yet (the flip-to-front row may not exist if the list changed).
87
+ */
88
+ private _applyPendingFocus;
89
+ private _subscribeAll;
90
+ /**
91
+ * Subscribe to `element.compositional_*` events targeting this accordion's
92
+ * tile, and ask the element store to replay any items it already holds for
93
+ * us (covers the case where the accordion mounts AFTER the item did — the
94
+ * inline-slot hydration race that otherwise silently drops the question).
95
+ */
96
+ private _subscribeCompositional;
97
+ /** Tile id for compositional filtering: the enclosing tile card's
98
+ * `data-tile-id` (set by SyntroTileCard), falling back to `instanceId`
99
+ * when the accordion is mounted outside a tile card. */
100
+ private _resolveTileId;
101
+ /** Append (or prepend) a faq:question the LLM mounted. The wire shape is a
102
+ * fully-formed `{kind, config}` envelope, so we store it verbatim. */
103
+ private _insertItem;
104
+ /** Replace an existing question's content (full replacement). */
105
+ private _patchItem;
106
+ /** Remove a question by instance id. */
107
+ private _removeItem;
108
+ /**
109
+ * Re-evaluate whether the open question is still visible, then re-render.
110
+ * Called from the subscription-driven re-render paths (context / accumulator /
111
+ * sessionMetric changes). Those subscriptions can flip an open question's
112
+ * `triggerWhen` to false WITHOUT a compositional patch/remove — so without
113
+ * this hook the stale-open reset (`_resetFaceIfOpenStale`, otherwise only
114
+ * invoked on patch/remove) would never fire on the triggerWhen path, and an
115
+ * open question gated out this way would snap straight to the back face on
116
+ * re-appearance. `_resetFaceIfOpenStale` mutates reactive state (which itself
117
+ * schedules an update), and we still `requestUpdate()` for the no-op case.
118
+ */
119
+ private _reevaluateOpenAndUpdate;
120
+ /**
121
+ * If `_openId` no longer resolves against the visible/ordered list (gated out
122
+ * by triggerWhen, removed, or patched away), reset BOTH `_openId` and
123
+ * `_activeFace` to the front (and clear the pending a11y focus intent).
124
+ * Resolves against the SAME `ordered` list render() uses (visible + ordered,
125
+ * NOT search-filtered). Also cancels any pending back-clear timer. Invoked on
126
+ * compositional patch/remove AND on the subscription-driven re-render paths
127
+ * (via {@link _reevaluateOpenAndUpdate}) so the triggerWhen-gated-out case is
128
+ * genuinely covered. Keeping `_activeFace` on 'back' after the open id went
129
+ * stale is the bug this guards: render() would force the front face locally
130
+ * but leave state on 'back', so a later re-appearance snaps to the back face
131
+ * with no animation.
132
+ */
133
+ private _resetFaceIfOpenStale;
134
+ private _unsubscribeAll;
135
+ /**
136
+ * Master→detail takeover: tapping a list row opens its single-Q&A detail
137
+ * view (the whole widget swaps), so a long answer fills — and never
138
+ * overflows — the bounded velvet tile. There is no simultaneous multi-expand;
139
+ * one question owns the tile at a time.
140
+ */
141
+ private _handleOpen;
142
+ /**
143
+ * Put the widget into the DETAIL (back) face for `id` and flip to it. Shared
144
+ * by the tap handler and the event-driven entry points (faq:open CTA,
145
+ * notification.deep_link) so every "open this question" path flips the same
146
+ * way. Cancels any pending back-clear timer (a re-open before the flip-out
147
+ * finishes must keep the detail mounted). Remembers the originating question
148
+ * id so focus can return to that exact row on flip-to-front (a11y), and moves
149
+ * focus to the ‹ Back button once the back face renders.
150
+ */
151
+ private _openToDetail;
152
+ /** Back affordance: FLIP from the detail (back) face to the list (front) face.
153
+ * The FlipController keeps `openId` populated through the rotation (never
154
+ * blank mid-flip) and clears it on settle — with reduced motion it clears
155
+ * synchronously. Focus returns to the originating question row. */
156
+ private _handleBack;
157
+ private _handleFeedback;
158
+ /**
159
+ * Unified render list. Merges compositionally-appended rows
160
+ * (`faqConfig.actions`, the container-then-stream path) with atomically
161
+ * authored rows (`faqConfig.questions`, the struct_list path) normalized
162
+ * into the same `FAQQuestionAction` shape. The atomic path is how the LLM
163
+ * mounts a complete FAQ in one call — so it renders whole, never empty.
164
+ */
165
+ private _allQuestions;
166
+ private _visibleQuestions;
167
+ private _orderedQuestions;
168
+ private _filteredQuestions;
169
+ private _categoryGroups;
170
+ /**
171
+ * The `data-adaptive-id` scope for this element's injected <style>. When
172
+ * `instanceId` is left at the shared default (`'faq-widget'`), two tiles would
173
+ * both scope to `[data-adaptive-id="faq-widget"]` and cross-style each other.
174
+ * In that case we fall back to a per-element generated uid so each default tile
175
+ * gets its own scope. A caller-provided instanceId is used verbatim.
176
+ */
177
+ private get _scopeId();
178
+ /**
179
+ * Self-injected flip CSS, scoped to THIS instance (`[data-adaptive-id="…"]`)
180
+ * so it can't leak onto a sibling widget. The FAQ tile is a light-DOM widget
181
+ * mounted across several canvases (velvet, default, onflow) and standalone;
182
+ * velvet ships a GENERIC `[data-active-face]` flip rule (for the product card),
183
+ * but the other hosts don't — so the FAQ carries the SAME 3D-flip technique,
184
+ * now from the shared canvas primitive ({@link flipStyles}) rather than a local
185
+ * copy. The `faq` namespace keeps it on `data-faq-*` / `sc-faq-flip-*` so
186
+ * velvet's generic rule can't double-apply (the GPU/perspective + resting-flat
187
+ * contract lives in the primitive). MUST match the FlipController's
188
+ * `keyframePrefix: 'sc-faq-flip'`.
189
+ */
190
+ private _renderFlipStyles;
191
+ private _renderAnswer;
192
+ private _renderFeedback;
193
+ /**
194
+ * LIST-view row. A tappable question with its chevron \u2014 but NO inline answer
195
+ * body. Tapping it takes over the tile with the question's detail view (see
196
+ * {@link _renderDetail}). Keeps the per-row look/markers/highlight from the
197
+ * old accordion minus the inline-expanded answer that overflowed the tile.
198
+ */
199
+ private _renderItem;
200
+ private _renderItems;
201
+ /**
202
+ * DETAIL view \u2014 the master\u2192detail takeover. Renders ONLY the open question:
203
+ * a back affordance, the question prominently, and its full answer via the
204
+ * SAME {@link _renderAnswer}/`renderAnswerHtml` path (all answer formats still
205
+ * work). The answer area scrolls if extremely long, so a single answer fills
206
+ * the bounded velvet tile and never pushes content past the `overflow:hidden`
207
+ * clip.
208
+ */
209
+ private _renderDetail;
210
+ /**
211
+ * "Dive deeper" (items 4/5) — hand the open question's context back to the
212
+ * CHAT as a deep-dive turn, so a clamped answer never leaves the visitor
213
+ * stuck. Canvas-agnostic: dispatches the neutral DIVE_DEEPER_EVENT; the
214
+ * chat-bar mountable turns it into a user-visible turn. The answer text rides
215
+ * along as (trimmed) context so the agent grounds its fuller reply.
216
+ */
217
+ private _handleDiveDeeper;
218
+ render(): import("lit-html").TemplateResult<1> | typeof nothing;
219
+ /** The FRONT face — search box, the question list (optionally grouped by
220
+ * category), and the no-results message. Extracted so both faces can live in
221
+ * the DOM at once for the flip. */
222
+ private _renderListFace;
223
+ }
224
+ export default FAQAccordionElement;
225
+ //# sourceMappingURL=FAQWidgetLit.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FAQWidgetLit.d.ts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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,E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,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"}
package/dist/cdn.d.ts CHANGED
@@ -1,13 +1,16 @@
1
1
  /**
2
2
  * CDN Entry Point for Adaptive FAQ
3
3
  *
4
- * This module is bundled for CDN delivery and self-registers with the global
5
- * SynOS app registry when loaded dynamically via the AppLoader.
6
- */
7
- import FAQEditor from './editor';
8
- /**
9
- * App manifest for registry registration.
10
- * Follows the AppManifest interface expected by AppLoader/AppRegistry.
4
+ * Bundled for CDN delivery and loaded on-demand by the host runtime's
5
+ * AppLoader when a config references faq actions/widgets. Part of the
6
+ * kernel diet (ADR 2026-07-17-runtime-kernel-vs-lazy-presentation):
7
+ * this app left the builtin list — it has 1s+ loading tolerance, unlike
8
+ * adaptive-content which must act inside the anti-flicker window.
9
+ *
10
+ * Mirrors adaptive-gamification/src/cdn.ts: builds the manifest from the
11
+ * runtime export, then self-registers with the host's app registry on
12
+ * import. Without this entry, build-adaptives-only.js silently skips the
13
+ * package and the app is "lazy in name only" (no bundle on disk).
11
14
  */
12
15
  export declare const manifest: {
13
16
  id: string;
@@ -15,23 +18,16 @@ export declare const manifest: {
15
18
  name: string;
16
19
  description: string;
17
20
  runtime: {
18
- actions: readonly [{
19
- readonly kind: "faq:scroll_to";
20
- readonly executor: typeof import("./executors").executeScrollToFaq;
21
- }, {
22
- readonly kind: "faq:toggle_item";
23
- readonly executor: typeof import("./executors").executeToggleFaqItem;
24
- }, {
25
- readonly kind: "faq:update";
26
- readonly executor: typeof import("./executors").executeUpdateFaq;
27
- }];
21
+ actions: {
22
+ kind: "faq:scroll_to" | "faq:toggle_item" | "faq:update";
23
+ executor: typeof import("./executors").executeScrollToFaq | typeof import("./executors").executeToggleFaqItem | typeof import("./executors").executeUpdateFaq;
24
+ }[];
28
25
  widgets: {
29
26
  id: string;
30
27
  component: {
31
- mount(container: HTMLElement, config?: import("./types").FAQConfig & {
28
+ mount(container: HTMLElement, config?: (import("./types").FAQConfig & import("packages/sdk-contracts/dist").MountPlumbing & {
32
29
  runtime?: import("./faq-types").FAQWidgetRuntime;
33
- instanceId?: string;
34
- }): () => void;
30
+ }) | null): () => void;
35
31
  };
36
32
  metadata: {
37
33
  name: string;
@@ -40,31 +36,21 @@ export declare const manifest: {
40
36
  subtitle: string;
41
37
  };
42
38
  }[];
43
- notifyWatchers: (props: Record<string, unknown>) => {
44
- id: string;
45
- strategy: import("./types").DecisionStrategy<boolean>;
46
- eventName: string;
47
- eventProps: {
48
- questionId: string;
49
- question: string;
50
- title: string | undefined;
51
- body: string | undefined;
52
- icon: string | undefined;
53
- };
54
- }[];
55
- };
56
- editor: {
57
- component: typeof FAQEditor;
58
- panel: {
59
- title: string;
60
- icon: string;
61
- description: string;
62
- };
63
- getActionLabel(action: Record<string, unknown>): string;
39
+ notifyWatchers: unknown;
40
+ events: unknown;
64
41
  };
65
42
  metadata: {
66
43
  isBuiltIn: boolean;
67
44
  };
68
45
  };
46
+ declare global {
47
+ interface Window {
48
+ SynOS?: {
49
+ appRegistry?: {
50
+ register?: (m: unknown) => void;
51
+ };
52
+ };
53
+ }
54
+ }
69
55
  export default manifest;
70
56
  //# sourceMappingURL=cdn.d.ts.map
package/dist/cdn.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cdn.d.ts","sourceRoot":"","sources":["../src/cdn.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,SAA0B,MAAM,UAAU,CAAC;AAGlD;;;GAGG;AACH,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;2BAoCg4iB,CAAC;8BAA8B,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;+BAtB15iB,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;;;;;CAQjD,CAAC;AAaF,eAAe,QAAQ,CAAC"}
1
+ {"version":3,"file":"cdn.d.ts","sourceRoot":"","sources":["../src/cdn.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAIH,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;2BAQ+C,CAAC;;;;;;;;;;;;;;;;CAMpE,CAAC;AAEF,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,MAAM;QACd,KAAK,CAAC,EAAE;YACN,WAAW,CAAC,EAAE;gBACZ,QAAQ,CAAC,EAAE,CAAC,CAAC,EAAE,OAAO,KAAK,IAAI,CAAC;aACjC,CAAC;SACH,CAAC;KACH;CACF;AASD,eAAe,QAAQ,CAAC"}
package/dist/cdn.js CHANGED
@@ -1,46 +1,35 @@
1
- /**
2
- * CDN Entry Point for Adaptive FAQ
3
- *
4
- * This module is bundled for CDN delivery and self-registers with the global
5
- * SynOS app registry when loaded dynamically via the AppLoader.
6
- */
7
- import FAQEditor, { editorPanel } from './editor';
8
- import { runtime } from './runtime';
9
- /**
10
- * App manifest for registry registration.
11
- * Follows the AppManifest interface expected by AppLoader/AppRegistry.
12
- */
13
- export const manifest = {
14
- id: 'adaptive-faq',
15
- version: runtime.version,
16
- name: runtime.name,
17
- description: runtime.description,
18
- // biome-ignore lint: manifest shape maps runtime fields to specific interface properties
19
- runtime: {
20
- actions: runtime.executors,
21
- widgets: runtime.widgets,
22
- notifyWatchers: runtime.notifyWatchers,
23
- },
24
- editor: {
25
- component: FAQEditor,
26
- panel: editorPanel,
27
- getActionLabel(action) {
28
- const config = action.config || {};
29
- return config.question || action.kind || 'faq:update';
30
- },
31
- },
32
- metadata: {
33
- isBuiltIn: false,
34
- },
1
+ import {
2
+ runtime
3
+ } from "./chunk-AJELMQH5.js";
4
+ import "./chunk-YNDAVOD7.js";
5
+ import "./chunk-KRKRB4OL.js";
6
+ import "./chunk-7DTOSQNC.js";
7
+
8
+ // src/cdn.ts
9
+ var manifest = {
10
+ id: runtime.id,
11
+ version: runtime.version,
12
+ name: runtime.name,
13
+ description: runtime.description,
14
+ runtime: {
15
+ actions: (runtime.executors ?? []).map(({ kind, executor }) => ({ kind, executor })),
16
+ widgets: runtime.widgets,
17
+ notifyWatchers: runtime.notifyWatchers,
18
+ events: runtime.eventHandlers
19
+ },
20
+ metadata: {
21
+ isBuiltIn: false
22
+ }
35
23
  };
36
- /**
37
- * Self-register with global registry if available.
38
- * This happens when loaded via script tag (UMD).
39
- */
40
- if (typeof window !== 'undefined') {
41
- const registry = window.SynOS?.appRegistry;
42
- if (registry && typeof registry.register === 'function') {
43
- registry.register(manifest);
44
- }
24
+ if (typeof window !== "undefined") {
25
+ const registry = window.SynOS?.appRegistry;
26
+ if (registry && typeof registry.register === "function") {
27
+ registry.register(manifest);
28
+ }
45
29
  }
46
- export default manifest;
30
+ var cdn_default = manifest;
31
+ export {
32
+ cdn_default as default,
33
+ manifest
34
+ };
35
+ //# sourceMappingURL=cdn.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/cdn.ts"],
4
+ "sourcesContent": ["/**\n * CDN Entry Point for Adaptive FAQ\n *\n * Bundled for CDN delivery and loaded on-demand by the host runtime's\n * AppLoader when a config references faq actions/widgets. Part of the\n * kernel diet (ADR 2026-07-17-runtime-kernel-vs-lazy-presentation):\n * this app left the builtin list \u2014 it has 1s+ loading tolerance, unlike\n * adaptive-content which must act inside the anti-flicker window.\n *\n * Mirrors adaptive-gamification/src/cdn.ts: builds the manifest from the\n * runtime export, then self-registers with the host's app registry on\n * import. Without this entry, build-adaptives-only.js silently skips the\n * package and the app is \"lazy in name only\" (no bundle on disk).\n */\n\nimport { runtime } from './runtime';\n\nexport const manifest = {\n id: runtime.id,\n version: runtime.version,\n name: runtime.name,\n description: runtime.description,\n runtime: {\n actions: (runtime.executors ?? []).map(({ kind, executor }) => ({ kind, executor })),\n widgets: runtime.widgets,\n notifyWatchers: (runtime as { notifyWatchers?: unknown }).notifyWatchers,\n events: (runtime as { eventHandlers?: unknown }).eventHandlers,\n },\n metadata: {\n isBuiltIn: false,\n },\n};\n\ndeclare global {\n interface Window {\n SynOS?: {\n appRegistry?: {\n register?: (m: unknown) => void;\n };\n };\n }\n}\n\nif (typeof window !== 'undefined') {\n const registry = window.SynOS?.appRegistry;\n if (registry && typeof registry.register === 'function') {\n registry.register(manifest);\n }\n}\n\nexport default manifest;\n"],
5
+ "mappings": ";;;;;;;;AAiBO,IAAM,WAAW;AAAA,EACtB,IAAI,QAAQ;AAAA,EACZ,SAAS,QAAQ;AAAA,EACjB,MAAM,QAAQ;AAAA,EACd,aAAa,QAAQ;AAAA,EACrB,SAAS;AAAA,IACP,UAAU,QAAQ,aAAa,CAAC,GAAG,IAAI,CAAC,EAAE,MAAM,SAAS,OAAO,EAAE,MAAM,SAAS,EAAE;AAAA,IACnF,SAAS,QAAQ;AAAA,IACjB,gBAAiB,QAAyC;AAAA,IAC1D,QAAS,QAAwC;AAAA,EACnD;AAAA,EACA,UAAU;AAAA,IACR,WAAW;AAAA,EACb;AACF;AAYA,IAAI,OAAO,WAAW,aAAa;AACjC,QAAM,WAAW,OAAO,OAAO;AAC/B,MAAI,YAAY,OAAO,SAAS,aAAa,YAAY;AACvD,aAAS,SAAS,QAAQ;AAAA,EAC5B;AACF;AAEA,IAAO,cAAQ;",
6
+ "names": []
7
+ }
@@ -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
+ }