@syntrologie/adapt-faq 2.11.0 → 2.12.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.
@@ -0,0 +1,204 @@
1
+ /**
2
+ * Adaptive FAQ - Styles
3
+ *
4
+ * BaseStyles object (font, layout, colors, animations) and theme integration
5
+ * for the FAQWidget component.
6
+ */
7
+ import { purple, slateGrey } from '@syntro/design-system/tokens';
8
+ // ============================================================================
9
+ // Base Styles
10
+ // ============================================================================
11
+ export const baseStyles = {
12
+ container: {
13
+ fontFamily: 'var(--sc-font-family, system-ui, -apple-system, sans-serif)',
14
+ maxWidth: '800px',
15
+ margin: '0 auto',
16
+ },
17
+ searchWrapper: {
18
+ marginBottom: '8px',
19
+ },
20
+ searchInput: {
21
+ width: '100%',
22
+ padding: '12px 16px',
23
+ borderRadius: '8px',
24
+ fontSize: '14px',
25
+ outline: 'none',
26
+ transition: 'border-color 0.15s ease',
27
+ backgroundColor: 'var(--sc-content-search-background)',
28
+ color: 'var(--sc-content-search-color)',
29
+ },
30
+ accordion: {
31
+ display: 'flex',
32
+ flexDirection: 'column',
33
+ gap: 'var(--sc-content-item-gap, 6px)',
34
+ },
35
+ item: {
36
+ borderRadius: 'var(--sc-content-border-radius, 8px)',
37
+ overflow: 'hidden',
38
+ transition: 'box-shadow 0.15s ease',
39
+ },
40
+ question: {
41
+ width: '100%',
42
+ padding: 'var(--sc-content-item-padding, 12px 16px)',
43
+ display: 'flex',
44
+ alignItems: 'center',
45
+ justifyContent: 'space-between',
46
+ border: 'none',
47
+ cursor: 'pointer',
48
+ fontSize: 'var(--sc-content-item-font-size, 15px)',
49
+ fontWeight: 500,
50
+ textAlign: 'left',
51
+ transition: 'background-color 0.15s ease',
52
+ },
53
+ chevron: {
54
+ fontSize: '20px',
55
+ transition: 'transform 0.2s ease',
56
+ color: 'var(--sc-content-chevron-color, currentColor)',
57
+ },
58
+ answer: {
59
+ padding: 'var(--sc-content-body-padding, 0 16px 12px 16px)',
60
+ fontSize: 'var(--sc-content-body-font-size, 14px)',
61
+ lineHeight: 1.6,
62
+ overflow: 'hidden',
63
+ transition: 'max-height 0.2s ease, padding 0.2s ease',
64
+ },
65
+ category: {
66
+ display: 'inline-block',
67
+ fontSize: '11px',
68
+ fontWeight: 600,
69
+ textTransform: 'uppercase',
70
+ letterSpacing: '0.05em',
71
+ padding: '4px 8px',
72
+ borderRadius: '4px',
73
+ marginBottom: '8px',
74
+ },
75
+ categoryHeader: {
76
+ fontSize: 'var(--sc-content-category-font-size, 12px)',
77
+ fontWeight: 700,
78
+ textTransform: 'uppercase',
79
+ letterSpacing: '0.05em',
80
+ padding: 'var(--sc-content-category-padding, 8px 4px 4px 4px)',
81
+ marginTop: 'var(--sc-content-category-gap, 4px)',
82
+ },
83
+ feedback: {
84
+ display: 'flex',
85
+ alignItems: 'center',
86
+ gap: '8px',
87
+ marginTop: '12px',
88
+ paddingTop: '10px',
89
+ borderTop: '1px solid rgba(0, 0, 0, 0.08)',
90
+ fontSize: '13px',
91
+ },
92
+ feedbackButton: {
93
+ background: 'none',
94
+ border: '1px solid transparent',
95
+ cursor: 'pointer',
96
+ fontSize: '16px',
97
+ padding: '4px 8px',
98
+ borderRadius: '4px',
99
+ transition: 'background-color 0.15s ease, border-color 0.15s ease',
100
+ },
101
+ feedbackButtonSelected: {
102
+ borderColor: 'rgba(0, 0, 0, 0.2)',
103
+ backgroundColor: 'rgba(0, 0, 0, 0.04)',
104
+ },
105
+ emptyState: {
106
+ textAlign: 'center',
107
+ padding: '48px 24px',
108
+ fontSize: '14px',
109
+ },
110
+ noResults: {
111
+ textAlign: 'center',
112
+ padding: '32px 16px',
113
+ fontSize: '14px',
114
+ },
115
+ };
116
+ // ============================================================================
117
+ // Theme Styles
118
+ // ============================================================================
119
+ export const themeStyles = {
120
+ light: {
121
+ container: {
122
+ backgroundColor: 'transparent',
123
+ color: 'inherit',
124
+ },
125
+ searchInput: {
126
+ border: `1px solid ${slateGrey[11]}`,
127
+ },
128
+ item: {
129
+ backgroundColor: 'var(--sc-content-background)',
130
+ borderTop: 'var(--sc-content-border)',
131
+ borderRight: 'var(--sc-content-border)',
132
+ borderBottom: 'var(--sc-content-border)',
133
+ borderLeft: 'var(--sc-content-border)',
134
+ },
135
+ itemExpanded: {
136
+ boxShadow: '0 4px 12px rgba(0, 0, 0, 0.08)',
137
+ },
138
+ question: {
139
+ backgroundColor: 'transparent',
140
+ color: 'var(--sc-content-text-color)',
141
+ },
142
+ questionHover: {
143
+ backgroundColor: 'var(--sc-content-background-hover)',
144
+ },
145
+ answer: {
146
+ color: 'var(--sc-content-text-secondary-color)',
147
+ },
148
+ category: {
149
+ backgroundColor: purple[8],
150
+ color: purple[2],
151
+ },
152
+ categoryHeader: {
153
+ color: slateGrey[7],
154
+ },
155
+ emptyState: {
156
+ color: slateGrey[8],
157
+ },
158
+ feedbackPrompt: {
159
+ color: slateGrey[7],
160
+ },
161
+ },
162
+ dark: {
163
+ container: {
164
+ backgroundColor: 'transparent',
165
+ color: 'inherit',
166
+ },
167
+ searchInput: {
168
+ border: `1px solid ${slateGrey[5]}`,
169
+ },
170
+ item: {
171
+ backgroundColor: 'var(--sc-content-background)',
172
+ borderTop: 'var(--sc-content-border)',
173
+ borderRight: 'var(--sc-content-border)',
174
+ borderBottom: 'var(--sc-content-border)',
175
+ borderLeft: 'var(--sc-content-border)',
176
+ },
177
+ itemExpanded: {
178
+ boxShadow: '0 4px 12px rgba(0, 0, 0, 0.15)',
179
+ },
180
+ question: {
181
+ backgroundColor: 'transparent',
182
+ color: 'var(--sc-content-text-color)',
183
+ },
184
+ questionHover: {
185
+ backgroundColor: 'var(--sc-content-background-hover)',
186
+ },
187
+ answer: {
188
+ color: 'var(--sc-content-text-secondary-color)',
189
+ },
190
+ category: {
191
+ backgroundColor: purple[0],
192
+ color: purple[6],
193
+ },
194
+ categoryHeader: {
195
+ color: slateGrey[8],
196
+ },
197
+ emptyState: {
198
+ color: slateGrey[7],
199
+ },
200
+ feedbackPrompt: {
201
+ color: slateGrey[8],
202
+ },
203
+ },
204
+ };
@@ -0,0 +1,55 @@
1
+ /**
2
+ * Adaptive FAQ - Widget Runtime & Props Types
3
+ *
4
+ * Runtime interface, component props, and helper type definitions
5
+ * used by the FAQWidget component.
6
+ */
7
+ import type { DecisionStrategy, FAQConfig } from './types';
8
+ export interface FAQWidgetRuntime {
9
+ evaluateSync: <T>(strategy: DecisionStrategy<T>) => {
10
+ value: T;
11
+ isFallback: boolean;
12
+ };
13
+ context: {
14
+ subscribe: (callback: () => void) => () => void;
15
+ };
16
+ events: {
17
+ publish: (name: string, props?: Record<string, unknown>) => void;
18
+ subscribe?: (filterOrCallback: {
19
+ names?: string[];
20
+ patterns?: string[];
21
+ sources?: string[];
22
+ } | ((event: {
23
+ name: string;
24
+ props?: Record<string, unknown>;
25
+ ts: number;
26
+ }) => void), maybeCallback?: (event: {
27
+ name: string;
28
+ props?: Record<string, unknown>;
29
+ ts: number;
30
+ }) => void) => () => void;
31
+ getRecent?: (filter?: {
32
+ names?: string[];
33
+ patterns?: string[];
34
+ }, limit?: number) => Array<{
35
+ name: string;
36
+ props?: Record<string, unknown>;
37
+ ts: number;
38
+ }>;
39
+ };
40
+ state?: {
41
+ get: (key: string) => unknown;
42
+ set: (key: string, value: unknown) => void;
43
+ };
44
+ /** Event accumulator for reactive triggerWhen re-evaluation */
45
+ accumulator?: {
46
+ subscribe: (callback: () => void) => () => void;
47
+ register: (key: string, predicate: (event: any) => boolean) => void;
48
+ };
49
+ }
50
+ export interface FAQWidgetProps {
51
+ config: FAQConfig;
52
+ runtime: FAQWidgetRuntime;
53
+ instanceId: string;
54
+ }
55
+ //# sourceMappingURL=faq-types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"faq-types.d.ts","sourceRoot":"","sources":["../src/faq-types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC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AE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;YAAC,EAAE,EAAE,MAAM,CAAA;SAAE,CAAC,CAAC;KAC3E,CAAC;IACF,KAAK,CAAC,EAAE;QAAE,GAAG,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC;QAAC,GAAG,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,KAAK,IAAI,CAAA;KAAE,CAAC;IACtF,+DAA+D;IAC/D,WAAW,CAAC,EAAE;QACZ,SAAS,EAAE,CAAC,QAAQ,EAAE,MAAM,IAAI,KAAK,MAAM,IAAI,CAAC;QAChD,QAAQ,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,SAAS,EAAE,CAAC,KAAK,EAAE,GAAG,KAAK,OAAO,KAAK,IAAI,CAAC;KACrE,CAAC;CACH;AAMD,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,SAAS,CAAC;IAClB,OAAO,EAAE,gBAAgB,CAAC;IAC1B,UAAU,EAAE,MAAM,CAAC;CACpB"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Adaptive FAQ - Widget Runtime & Props Types
3
+ *
4
+ * Runtime interface, component props, and helper type definitions
5
+ * used by the FAQWidget component.
6
+ */
7
+ export {};
package/dist/runtime.d.ts CHANGED
@@ -36,9 +36,9 @@ export declare const runtime: {
36
36
  id: string;
37
37
  component: {
38
38
  mount(container: HTMLElement, config?: import("./types").FAQConfig & {
39
- runtime?: import("./FAQWidget").FAQWidgetRuntime;
39
+ runtime?: import("./faq-types").FAQWidgetRuntime;
40
40
  instanceId?: string;
41
- }): () => void;
41
+ }): (() => void) | undefined;
42
42
  };
43
43
  metadata: {
44
44
  name: string;
@@ -1 +1 @@
1
- {"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../src/runtime.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAUH;;;;;;GAMG;AACH,eAAO,MAAM,OAAO;;;;;IAOlB;;OAEG;;;;;;;;;;;IAGH;;OAEG;;;;;uBAuC06sB,CAAC;0BAA8B,CAAC;;;;;;;;;;IAzB78sB;;;;OAIG;0BACmB,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;;;;;;;;;;;;CAiB9C,CAAC;AAEF,eAAe,OAAO,CAAC"}
1
+ {"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../src/runtime.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAUH;;;;;;GAMG;AACH,eAAO,MAAM,OAAO;;;;;IAOlB;;OAEG;;;;;;;;;;;IAGH;;OAEG;;;;;uBAuCyqhB,CAAC;0BAA8B,CAAC;;;;;;;;;;IAzB5shB;;;;OAIG;0BACmB,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;;;;;;;;;;;;CAiB9C,CAAC;AAEF,eAAe,OAAO,CAAC"}