@qaiddev/quests-embed 1.0.1 → 1.1.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.
- package/dist/embed.d.ts +26 -0
- package/dist/qaid-quests.js +360 -272
- package/dist/qaid-quests.js.map +1 -1
- package/dist/qaid-quests.umd.cjs +6 -1
- package/dist/qaid-quests.umd.cjs.map +1 -1
- package/dist/styles.d.ts +19 -8
- package/dist/themes/index.d.ts +8 -0
- package/dist/types.d.ts +80 -7
- package/package.json +1 -1
package/dist/types.d.ts
CHANGED
|
@@ -159,13 +159,26 @@ export interface QuestsConfig {
|
|
|
159
159
|
container?: string;
|
|
160
160
|
/** z-index for modal-mode embed. Default: 50 */
|
|
161
161
|
zIndex?: number;
|
|
162
|
-
/**
|
|
162
|
+
/**
|
|
163
|
+
* Custom theme colors — quest-only, decoupled from thumbs-embed so
|
|
164
|
+
* a host that runs both can theme them independently.
|
|
165
|
+
*
|
|
166
|
+
* The legacy keys `positive` / `negative` / `marker` are still
|
|
167
|
+
* accepted as aliases for `accent` / `error` / `focus` and will be
|
|
168
|
+
* removed in a future major.
|
|
169
|
+
*/
|
|
163
170
|
colors?: {
|
|
164
|
-
/** Primary
|
|
171
|
+
/** Primary CTA, progress fill, selected option ring */
|
|
172
|
+
accent?: string;
|
|
173
|
+
/** Validation error text */
|
|
174
|
+
error?: string;
|
|
175
|
+
/** Focus ring on inputs/buttons */
|
|
176
|
+
focus?: string;
|
|
177
|
+
/** @deprecated alias for `accent` */
|
|
165
178
|
positive?: string;
|
|
166
|
-
/**
|
|
179
|
+
/** @deprecated alias for `error` */
|
|
167
180
|
negative?: string;
|
|
168
|
-
/**
|
|
181
|
+
/** @deprecated alias for `focus` */
|
|
169
182
|
marker?: string;
|
|
170
183
|
};
|
|
171
184
|
/** Modal width in pixels. Default: 480 */
|
|
@@ -199,6 +212,63 @@ export interface QuestsConfig {
|
|
|
199
212
|
* to sit as high as possible.
|
|
200
213
|
*/
|
|
201
214
|
progressPosition?: "top" | "bottom";
|
|
215
|
+
/**
|
|
216
|
+
* Color-scheme override.
|
|
217
|
+
* - "auto" (default): follows `prefers-color-scheme` via `light-dark()`
|
|
218
|
+
* - "light" / "dark": force the matching mode regardless of the system
|
|
219
|
+
* preference. Implemented as `qaid-q-theme-light` / `qaid-q-theme-dark`
|
|
220
|
+
* classes on the root element.
|
|
221
|
+
*/
|
|
222
|
+
theme?: "light" | "dark" | "auto";
|
|
223
|
+
/**
|
|
224
|
+
* When true, the embed adds `qaid-q-unstyled` to the root and the
|
|
225
|
+
* shadow stylesheet flattens its component defaults via `all: unset`.
|
|
226
|
+
* The host's `css` config string is then the only thing that paints.
|
|
227
|
+
* Off by default.
|
|
228
|
+
*/
|
|
229
|
+
unstyled?: boolean;
|
|
230
|
+
/**
|
|
231
|
+
* Built-in theme preset. Each preset only overrides Tier 3 component
|
|
232
|
+
* tokens, so they stay forward-compatible.
|
|
233
|
+
* - "default": current look (no override)
|
|
234
|
+
* - "minimal": flat surfaces, hairline borders, no shadows, sharp corners
|
|
235
|
+
* - "pill": fully rounded option cards + buttons
|
|
236
|
+
* - "dense": tighter padding for above-the-fold layouts
|
|
237
|
+
*/
|
|
238
|
+
preset?: "default" | "minimal" | "pill" | "dense";
|
|
239
|
+
/**
|
|
240
|
+
* URL of a public quest theme JSON document. The embed fetches this
|
|
241
|
+
* in parallel with the questionnaire and applies the theme's
|
|
242
|
+
* `preset` / `theme` / `unstyled` / `tokens` / `css`. Explicit fields
|
|
243
|
+
* on this config win over the theme's values; the theme fills the
|
|
244
|
+
* rest. A failure to load the theme is non-fatal — the embed renders
|
|
245
|
+
* with defaults.
|
|
246
|
+
*
|
|
247
|
+
* Themes are decoupled from quests on purpose: one theme can be
|
|
248
|
+
* reused across many quests. The host picks both at embed-init time.
|
|
249
|
+
*/
|
|
250
|
+
themeUrl?: string;
|
|
251
|
+
/**
|
|
252
|
+
* Pre-fetched theme document — for hosts that want to fetch the
|
|
253
|
+
* theme on the server side and skip the runtime round-trip.
|
|
254
|
+
* Same precedence as `themeUrl` (explicit config wins).
|
|
255
|
+
*/
|
|
256
|
+
themeDocument?: ResolvedQuestTheme;
|
|
257
|
+
}
|
|
258
|
+
/**
|
|
259
|
+
* Shape of a single quest-theme document, as served by the docs site
|
|
260
|
+
* at `/api/quest-themes/:id/public` and as accepted via
|
|
261
|
+
* `QuestsConfig.themeDocument`. Sparse — every field is optional so
|
|
262
|
+
* an author can ship a tokens-only theme (or a CSS-only theme).
|
|
263
|
+
*/
|
|
264
|
+
export interface ResolvedQuestTheme {
|
|
265
|
+
preset?: "default" | "minimal" | "pill" | "dense" | null;
|
|
266
|
+
mode?: "light" | "dark" | "auto" | null;
|
|
267
|
+
unstyled?: boolean | null;
|
|
268
|
+
/** Map of CSS variables to their values, e.g. `{ "--qaid-q-card-radius": "0" }`. */
|
|
269
|
+
tokens?: Record<string, string> | null;
|
|
270
|
+
/** Free-form CSS appended after preset CSS, before the host's `css`. */
|
|
271
|
+
css?: string | null;
|
|
202
272
|
}
|
|
203
273
|
export interface ResolvedQuestsConfig {
|
|
204
274
|
endpoint: string;
|
|
@@ -206,9 +276,9 @@ export interface ResolvedQuestsConfig {
|
|
|
206
276
|
container: string;
|
|
207
277
|
zIndex: number;
|
|
208
278
|
colors: {
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
279
|
+
accent: string;
|
|
280
|
+
error: string;
|
|
281
|
+
focus: string;
|
|
212
282
|
};
|
|
213
283
|
modalWidth: number;
|
|
214
284
|
backdropOpacity: number;
|
|
@@ -225,6 +295,9 @@ export interface ResolvedQuestsConfig {
|
|
|
225
295
|
* (then "top") when rendering.
|
|
226
296
|
*/
|
|
227
297
|
progressPosition: "top" | "bottom" | undefined;
|
|
298
|
+
theme: "light" | "dark" | "auto";
|
|
299
|
+
unstyled: boolean;
|
|
300
|
+
preset: "default" | "minimal" | "pill" | "dense";
|
|
228
301
|
}
|
|
229
302
|
/** Initial payload sent to create the response */
|
|
230
303
|
export interface CreateResponsePayload {
|