@syntrologie/adapt-faq 2.8.0-canary.29 → 2.8.0-canary.291

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 (59) hide show
  1. package/dist/FAQWidgetLit.d.ts +85 -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-5WRI5ZAA.js +31 -0
  8. package/dist/chunk-5WRI5ZAA.js.map +7 -0
  9. package/dist/chunk-KRKRB4OL.js +598 -0
  10. package/dist/chunk-KRKRB4OL.js.map +7 -0
  11. package/dist/chunk-NIKWJ3GQ.js +187 -0
  12. package/dist/chunk-NIKWJ3GQ.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 +198 -0
  20. package/dist/faq-styles.d.ts.map +1 -0
  21. package/dist/{FAQWidget.d.ts → faq-types.d.ts} +9 -28
  22. package/dist/faq-types.d.ts.map +1 -0
  23. package/dist/runtime.d.ts +17 -5
  24. package/dist/runtime.d.ts.map +1 -1
  25. package/dist/runtime.js +839 -64
  26. package/dist/runtime.js.map +7 -0
  27. package/dist/schema.d.ts +1090 -471
  28. package/dist/schema.d.ts.map +1 -1
  29. package/dist/schema.js +290 -207
  30. package/dist/schema.js.map +7 -0
  31. package/dist/types.d.ts +19 -0
  32. package/dist/types.d.ts.map +1 -1
  33. package/node_modules/marked/LICENSE.md +44 -0
  34. package/node_modules/marked/README.md +107 -0
  35. package/node_modules/marked/bin/main.js +283 -0
  36. package/node_modules/marked/bin/marked.js +16 -0
  37. package/node_modules/marked/lib/marked.d.ts +759 -0
  38. package/node_modules/marked/lib/marked.esm.js +72 -0
  39. package/node_modules/marked/lib/marked.esm.js.map +7 -0
  40. package/node_modules/marked/lib/marked.umd.js +74 -0
  41. package/node_modules/marked/lib/marked.umd.js.map +7 -0
  42. package/node_modules/marked/man/marked.1 +113 -0
  43. package/node_modules/marked/man/marked.1.md +93 -0
  44. package/node_modules/marked/package.json +103 -0
  45. package/package.json +13 -18
  46. package/dist/FAQWidget.d.ts.map +0 -1
  47. package/dist/FAQWidget.js +0 -581
  48. package/dist/cdn.d.ts +0 -70
  49. package/dist/cdn.d.ts.map +0 -1
  50. package/dist/cdn.js +0 -46
  51. package/dist/executors.js +0 -150
  52. package/dist/state.js +0 -132
  53. package/dist/summarize.js +0 -62
  54. package/dist/types.js +0 -17
  55. package/node_modules/@syntrologie/sdk-contracts/dist/index.d.ts +0 -129
  56. package/node_modules/@syntrologie/sdk-contracts/dist/index.js +0 -15
  57. package/node_modules/@syntrologie/sdk-contracts/dist/schemas.d.ts +0 -2225
  58. package/node_modules/@syntrologie/sdk-contracts/dist/schemas.js +0 -162
  59. package/node_modules/@syntrologie/sdk-contracts/package.json +0 -33
@@ -0,0 +1,85 @@
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 } 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
+ static properties: {
27
+ faqConfig: {
28
+ attribute: boolean;
29
+ };
30
+ runtime: {
31
+ attribute: boolean;
32
+ };
33
+ instanceId: {
34
+ type: StringConstructor;
35
+ };
36
+ _expandedIds: {
37
+ state: boolean;
38
+ };
39
+ _highlightId: {
40
+ state: boolean;
41
+ };
42
+ _searchQuery: {
43
+ state: boolean;
44
+ };
45
+ _feedbackState: {
46
+ state: boolean;
47
+ };
48
+ _hoveredId: {
49
+ state: boolean;
50
+ };
51
+ };
52
+ faqConfig: FAQConfig;
53
+ runtime: FAQWidgetRuntime | null;
54
+ instanceId: string;
55
+ _expandedIds: Set<string>;
56
+ _highlightId: string | null;
57
+ _searchQuery: string;
58
+ _feedbackState: Map<string, FeedbackValue>;
59
+ _hoveredId: string | null;
60
+ private _unsubContext;
61
+ private _unsubAccumulator;
62
+ private _unsubCta;
63
+ private _unsubDeepLink;
64
+ private _unsubSessionMetrics;
65
+ private _highlightTimer;
66
+ createRenderRoot(): this;
67
+ connectedCallback(): void;
68
+ disconnectedCallback(): void;
69
+ updated(changedProps: Map<string, unknown>): void;
70
+ private _subscribeAll;
71
+ private _unsubscribeAll;
72
+ private _handleToggle;
73
+ private _handleFeedback;
74
+ private _visibleQuestions;
75
+ private _orderedQuestions;
76
+ private _filteredQuestions;
77
+ private _categoryGroups;
78
+ private _renderAnswer;
79
+ private _renderFeedback;
80
+ private _renderItem;
81
+ private _renderItems;
82
+ render(): import("lit-html").TemplateResult<1>;
83
+ }
84
+ export default FAQAccordionElement;
85
+ //# sourceMappingURL=FAQWidgetLit.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FAQWidgetLit.d.ts","sourceRoot":"","sources":["../src/FAQWidgetLit.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAGH,OAAO,EAAQ,UAAU,EA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mHhB;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,EA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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"}
@@ -0,0 +1,31 @@
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 __commonJS = (cb, mod) => function __require() {
8
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
19
+ // If the importer is in node compatibility mode or this is not an ESM
20
+ // file that has been converted to a CommonJS file using a Babel-
21
+ // compatible transform (i.e. "__esModule" has not been set), then set
22
+ // "default" to the CommonJS "module.exports" for node compatibility.
23
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
24
+ mod
25
+ ));
26
+
27
+ export {
28
+ __commonJS,
29
+ __toESM
30
+ };
31
+ //# sourceMappingURL=chunk-5WRI5ZAA.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": [],
4
+ "sourcesContent": [],
5
+ "mappings": "",
6
+ "names": []
7
+ }