@qaiddev/quests-embed 1.0.0 → 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 +27 -0
- package/dist/qaid-quests.js +379 -279
- 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 +106 -8
- package/package.json +2 -2
package/dist/types.d.ts
CHANGED
|
@@ -117,6 +117,18 @@ export interface Questionnaire {
|
|
|
117
117
|
title?: string;
|
|
118
118
|
/** Optional description shown under the title */
|
|
119
119
|
description?: string;
|
|
120
|
+
/** Hide the title row entirely, even if `title` is set */
|
|
121
|
+
hideTitle?: boolean;
|
|
122
|
+
/** Hide the progress bar + step counter entirely */
|
|
123
|
+
hideProgress?: boolean;
|
|
124
|
+
/**
|
|
125
|
+
* Where to render the step counter and progress bar. Same semantics
|
|
126
|
+
* as `QuestsConfig.progressPosition`. Set on the schema so authors
|
|
127
|
+
* can choose the layout from the dashboard without changing the
|
|
128
|
+
* embed config on the host page. Config-level `progressPosition`
|
|
129
|
+
* still wins when both are set.
|
|
130
|
+
*/
|
|
131
|
+
progressPosition?: "top" | "bottom";
|
|
120
132
|
/** Text shown when the form is finished. Default "Thank you!" */
|
|
121
133
|
thankYouTitle?: string;
|
|
122
134
|
/** Subtitle shown when the form is finished */
|
|
@@ -147,13 +159,26 @@ export interface QuestsConfig {
|
|
|
147
159
|
container?: string;
|
|
148
160
|
/** z-index for modal-mode embed. Default: 50 */
|
|
149
161
|
zIndex?: number;
|
|
150
|
-
/**
|
|
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
|
+
*/
|
|
151
170
|
colors?: {
|
|
152
|
-
/** 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` */
|
|
153
178
|
positive?: string;
|
|
154
|
-
/**
|
|
179
|
+
/** @deprecated alias for `error` */
|
|
155
180
|
negative?: string;
|
|
156
|
-
/**
|
|
181
|
+
/** @deprecated alias for `focus` */
|
|
157
182
|
marker?: string;
|
|
158
183
|
};
|
|
159
184
|
/** Modal width in pixels. Default: 480 */
|
|
@@ -172,6 +197,13 @@ export interface QuestsConfig {
|
|
|
172
197
|
saveDebounceMs?: number;
|
|
173
198
|
/** Auto-focus the input on each step. Default: true. Set false in preview/embedded contexts that shouldn't steal focus. */
|
|
174
199
|
autoFocus?: boolean;
|
|
200
|
+
/**
|
|
201
|
+
* Whether to play the per-step slide-up entry animation. Default: true.
|
|
202
|
+
* Set false in the dashboard preview (or anywhere the embed gets
|
|
203
|
+
* re-mounted on every edit) so the form doesn't visibly flash on
|
|
204
|
+
* each rebuild.
|
|
205
|
+
*/
|
|
206
|
+
animate?: boolean;
|
|
175
207
|
/**
|
|
176
208
|
* Where to render the step counter ("1 / 5") and progress bar.
|
|
177
209
|
* - "top" (default): inline at the top of the card, above the question
|
|
@@ -180,6 +212,63 @@ export interface QuestsConfig {
|
|
|
180
212
|
* to sit as high as possible.
|
|
181
213
|
*/
|
|
182
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;
|
|
183
272
|
}
|
|
184
273
|
export interface ResolvedQuestsConfig {
|
|
185
274
|
endpoint: string;
|
|
@@ -187,9 +276,9 @@ export interface ResolvedQuestsConfig {
|
|
|
187
276
|
container: string;
|
|
188
277
|
zIndex: number;
|
|
189
278
|
colors: {
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
279
|
+
accent: string;
|
|
280
|
+
error: string;
|
|
281
|
+
focus: string;
|
|
193
282
|
};
|
|
194
283
|
modalWidth: number;
|
|
195
284
|
backdropOpacity: number;
|
|
@@ -199,7 +288,16 @@ export interface ResolvedQuestsConfig {
|
|
|
199
288
|
autoAdvance: boolean;
|
|
200
289
|
saveDebounceMs: number;
|
|
201
290
|
autoFocus: boolean;
|
|
202
|
-
|
|
291
|
+
animate: boolean;
|
|
292
|
+
/**
|
|
293
|
+
* Resolved progress position. `undefined` means "no config-level
|
|
294
|
+
* override" — the embed falls back to `Questionnaire.progressPosition`
|
|
295
|
+
* (then "top") when rendering.
|
|
296
|
+
*/
|
|
297
|
+
progressPosition: "top" | "bottom" | undefined;
|
|
298
|
+
theme: "light" | "dark" | "auto";
|
|
299
|
+
unstyled: boolean;
|
|
300
|
+
preset: "default" | "minimal" | "pill" | "dense";
|
|
203
301
|
}
|
|
204
302
|
/** Initial payload sent to create the response */
|
|
205
303
|
export interface CreateResponsePayload {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@qaiddev/quests-embed",
|
|
3
|
-
"version": "1.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "1.1.0",
|
|
4
|
+
"description": "Any Questions for your Users?",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/qaid-quests.umd.cjs",
|
|
7
7
|
"module": "./dist/qaid-quests.js",
|