@usefillo/dom 0.9.0 → 0.11.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/README.md CHANGED
@@ -1,9 +1,23 @@
1
- # @usefillo/dom
1
+ <p align="center">
2
+ <a href="https://fillo.so">
3
+ <img src="https://fillo.so/brand/readme-banner.png" alt="Fillo — forms inside your product, with your UI." />
4
+ </a>
5
+ </p>
6
+
7
+ <p align="center">
8
+ <a href="https://fillo.so/docs">Docs</a> ·
9
+ <a href="https://fillo.so/guides">Guides</a> ·
10
+ <a href="https://fillo.so/examples">Examples</a> ·
11
+ <a href="https://fillo.so/changelog">Changelog</a>
12
+ </p>
13
+
14
+ <p align="center">
15
+ <a href="https://www.npmjs.com/package/@usefillo/dom"><img src="https://img.shields.io/npm/v/@usefillo/dom" alt="npm version" /></a>
16
+ <img src="https://img.shields.io/npm/l/@usefillo/dom" alt="MIT license" />
17
+ </p>
2
18
 
3
19
  Framework-agnostic DOM renderer, web component, and standalone browser bundle for [Fillo](https://fillo.so) — forms that render **inside your own product**, no iframe. Use it with Vue, Svelte, Astro, or plain browser JavaScript.
4
20
 
5
- ### 📚 Full documentation → **[fillo.so/docs](https://fillo.so/docs)**
6
-
7
21
  ```sh
8
22
  npm i @usefillo/dom
9
23
  ```
@@ -51,14 +65,9 @@ Or drop it in with a single script tag — the bundle exposes a global `Fillo`:
51
65
  </script>
52
66
  ```
53
67
 
54
- For tiny feedback widgets, set `settings.submitMode: "auto"` on a select/rating/checkbox/dropdown/linear scale form. The default renderer hides the first submit button, submits after a complete discrete answer, and brings the submit button back if that answer opens a text or upload follow-up. Add `responseLimit: { by: "browser", onRepeat: "keep" }` for browser-scoped one-response feedback.
55
-
56
68
  The default stylesheet follows system dark mode for unthemed embeds. Pass `theme: { colorScheme: "dark" }` or `"light"` when the host surface is known.
57
69
 
58
- Re-exports the core pieces used by DOM integrations from
59
- [`@usefillo/core`](https://www.npmjs.com/package/@usefillo/core), including
60
- `createClient`, `defineForm`, `FilloClient`, `createFormController`, and the
61
- schema/value types.
70
+ Every rendered part carries `data-*` state attributes (`data-selected`, `data-invalid`, …) for utility CSS, and the default stylesheet is cascade-layered so your own styles win. On Tailwind v3 or reset-heavy sites import `@usefillo/dom/styles.unlayered.css` instead. Styling contract: [fillo.so/docs/styling](https://fillo.so/docs/styling).
62
71
 
63
72
  ## Links
64
73
 
@@ -66,8 +75,3 @@ schema/value types.
66
75
  - **Website:** [fillo.so](https://fillo.so)
67
76
 
68
77
  MIT licensed.
69
-
70
- On Tailwind v3 or reset-heavy sites, import `@usefillo/dom/styles.unlayered.css`
71
- instead — the cascade-layered default loses to unlayered CSS by design.
72
- State is exposed as `data-*` attributes (`data-selected`, `data-invalid`, …)
73
- for utility CSS.
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { Field, FieldValue, FormSchema, FilloClient, ResponseData, FormStatus as FormStatus$1, FormPage, Block, FilloRespondent, CodeForm, FormTheme, FieldKind, FilloError, FormControllerOptions, FormController } from '@usefillo/core';
1
+ import { Field, FieldValue, FormSchema, FilloClient, ResponseData, FormStatus as FormStatus$1, FormPage, Block, FilloRespondent, CodeForm, FormTheme, ChallengeConfig, FieldKind, FilloError, FormControllerOptions, FormController } from '@usefillo/core';
2
2
  export { CodeForm, Field, FieldKind, FieldValue, FileValue, FilloClient, FilloClientOptions, FilloError, FormController, FormControllerOptions, FormControllerState, FormSchema, FormTheme, ProvisionWorkspaceResult, ResponseData, createClient, defineForm, provisionWorkspace } from '@usefillo/core';
3
3
 
4
4
  type FormStatus = FormStatus$1 | "loading" | "closed";
@@ -34,7 +34,6 @@ interface FieldRenderContext {
34
34
  uploadFiles?: (field: Extract<Field, {
35
35
  kind: "file_upload";
36
36
  }>, files: File[]) => Promise<void>;
37
- uploadProgress?: Map<string, number>;
38
37
  }
39
38
  interface FilloDomFieldIds {
40
39
  inputId: string;
@@ -56,12 +55,34 @@ interface RenderFormOptions {
56
55
  * unverified claim. Late-bind with setRespondent() once a session loads.
57
56
  */
58
57
  respondent?: FilloRespondent;
58
+ /**
59
+ * Human-verification challenge config (public site key + provider). Normally
60
+ * read from the form fetch/sync automatically; pass it explicitly only when
61
+ * rendering an inline `form` schema and still wanting the widget (Fillo's
62
+ * hosted page does this). Wins over anything the server delivers.
63
+ */
64
+ challenge?: ChallengeConfig;
59
65
  className?: string;
60
66
  components?: Partial<Record<FieldKind, FieldRenderer>>;
61
67
  customComponents?: Record<string, FieldRenderer>;
62
68
  onChange?: (data: ResponseData) => void;
63
69
  onSubmitted?: (responseId: string | undefined, data: ResponseData) => void;
64
70
  onError?: (error: FilloError) => void;
71
+ /**
72
+ * Show the developer chrome on a surface Fillo doesn't detect as local
73
+ * development — a tunnel, a staging deploy, a production build you're
74
+ * smoke-testing. COSMETIC ONLY: it renders the dev notices, developer-grade
75
+ * submit failures, and a visible "Preview" badge, and it never changes
76
+ * where submissions go or whether they are accepted (test submissions
77
+ * authenticate with a credential, never a prop).
78
+ */
79
+ preview?: boolean;
80
+ /**
81
+ * Set false to hide the built-in dev notices (draft/staged/sync/no-client)
82
+ * when your page provides its own context. The explicit Preview badge and
83
+ * the production fail-closed states are unaffected.
84
+ */
85
+ devNotices?: boolean;
65
86
  renderSuccess?: (api: FilloDomApi) => HTMLElement;
66
87
  renderError?: (error: FilloError) => HTMLElement;
67
88
  }
@@ -107,6 +128,11 @@ declare class FilloFormElement extends HTMLElementBase {
107
128
  set theme(value: FormTheme | undefined);
108
129
  set initialData(value: ResponseData | undefined);
109
130
  private scheduleMount;
131
+ /** data-preview is on when present UNLESS its value says off ("false"/"0"):
132
+ * frameworks stringify booleans onto data-* attributes rather than omitting
133
+ * them, and a stringified `false` must never enable dev chrome for real
134
+ * respondents. Disable by removing the attribute or setting it to "false". */
135
+ private previewAttrEnabled;
110
136
  private mount;
111
137
  }
112
138
  declare function registerFilloElement(name?: string): void;