@usefillo/core 0.6.0 → 0.6.2

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
@@ -38,3 +38,10 @@ Key exports: `createClient` / `FilloClient`, `defineForm`, `validateResponse`, `
38
38
  - **Website:** [fillo.so](https://fillo.so)
39
39
 
40
40
  MIT licensed.
41
+
42
+ ## 0.6.0 surface
43
+
44
+ Framework-neutral pieces the renderers share: `defineForm` / `schemaFromJsx`
45
+ (the JSX compiler), `when()` condition builder, the `FilloAppearance` styling
46
+ contract (slots + data-attribute names), `FilloStrings` localization defaults,
47
+ and `createClient({ baseUrl })` for staging/self-hosted targets.
package/dist/index.d.ts CHANGED
@@ -300,7 +300,8 @@ interface ValidationResult {
300
300
  declare function validateResponse(form: FormSchema, data: ResponseData): ValidationResult;
301
301
 
302
302
  declare const FILLO_SCHEMA_VERSION: 1;
303
- declare const FILLO_SDK_VERSION = "0.5.0";
303
+ /** Injected from package.json at build time (tsup define) — never hand-edited. */
304
+ declare const FILLO_SDK_VERSION: string;
304
305
  interface SchemaValidationResult {
305
306
  ok: boolean;
306
307
  /** Present when ok — a normalized, structurally-valid schema. */
@@ -491,7 +492,7 @@ interface SubmitMeta {
491
492
  hp?: string;
492
493
  /** Time from first render to submit. */
493
494
  elapsedMs?: number;
494
- /** Embedding surface; "headless" submissions require a paid plan (server-enforced). */
495
+ /** Embedding surface, recorded per response for measurement — never gated. */
495
496
  surface?: "default" | "headless";
496
497
  /**
497
498
  * Browser-scoped de-duplication key sent when a form opts into
@@ -572,7 +573,7 @@ declare class FilloClient {
572
573
  * is sent twice or skipped.
573
574
  *
574
575
  * Depending on the form's storage settings the server picks a transport:
575
- * Fillo's own chunk protocol, or direct-to-Google-Drive resumable
576
+ * direct-to-Google-Drive resumable
576
577
  * sessions — in which case the bytes go straight from this browser to the
577
578
  * form owner's Drive and never touch the Fillo server.
578
579
  */
@@ -764,6 +765,8 @@ declare const FILLO_DATA_ATTRS: {
764
765
  readonly field: "data-field";
765
766
  readonly invalid: "data-invalid";
766
767
  readonly required: "data-required";
768
+ /** Option id, on each choice row (pre-existing selector hook). */
769
+ readonly option: "data-option";
767
770
  /** Selected option row / active scale step / active star. */
768
771
  readonly selected: "data-selected";
769
772
  /** Checkbox / toggle checked state. */
@@ -806,6 +809,35 @@ interface FilloAppearance {
806
809
  declare function resolveSlotClass(appearance: FilloAppearance | undefined, state: SlotState): string;
807
810
  /** Append resolved consumer classes to a base fillo-* class string. */
808
811
  declare function slotClass(base: string, appearance: FilloAppearance | undefined, state: SlotState): string;
812
+ /** The CSS custom properties the default theme runs on. `themeProp` names the
813
+ * FormTheme key that sets a token (inline, synced to the hosted page); tokens
814
+ * without one are stylesheet-only and overridable from consumer CSS. */
815
+ declare const FILLO_THEME_VARS: readonly [{
816
+ readonly var: "--fillo-primary";
817
+ readonly themeProp: "primary";
818
+ }, {
819
+ readonly var: "--fillo-bg";
820
+ readonly themeProp: "background";
821
+ }, {
822
+ readonly var: "--fillo-text";
823
+ readonly themeProp: "text";
824
+ }, {
825
+ readonly var: "--fillo-radius";
826
+ readonly themeProp: "radius";
827
+ }, {
828
+ readonly var: "--fillo-font";
829
+ readonly themeProp: "fontFamily";
830
+ }, {
831
+ readonly var: "--fillo-muted";
832
+ }, {
833
+ readonly var: "--fillo-border";
834
+ }, {
835
+ readonly var: "--fillo-control-bg";
836
+ }, {
837
+ readonly var: "--fillo-error";
838
+ }, {
839
+ readonly var: "--fillo-primary-contrast";
840
+ }];
809
841
 
810
842
  /**
811
843
  * Every visitor-facing string the default renderers emit, overridable as a
@@ -1004,4 +1036,4 @@ declare class Sha1 {
1004
1036
  }
1005
1037
  declare const sha1Base64: (bytes: Uint8Array) => string;
1006
1038
 
1007
- export { type AutoSubmitContext, BLOCK_KIND_META, type BaseField, type Block, type BlockKind, CONTENT_KINDS, type CheckboxField, type ChoiceField, type CodeForm, type Condition, type ConditionOp, type ContentBlock, type ContentKind, type CustomField, DEFAULT_STRINGS, DRAFT_KINDS, type DateField, type DividerBlock, FILLO_DATA_ATTRS, FILLO_SCHEMA_VERSION, FILLO_SDK_VERSION, FILLO_SLOTS, type Field, type FieldKind, type FieldSpec, type FieldValue, type FileUploadField, type FileValue, type FilloAppearance, FilloClient, type FilloClientOptions, FilloError, FilloJsxError, type FilloSlot, type FilloStrings, type FormBranding, type FormController, type FormControllerOptions, type FormControllerState, type FormDraftSpec, type FormPage, type FormSchema, type FormSettings, type FormStatus, type FormTheme, type HeadingBlock, type HiddenField, JSX_BLOCK_COMPONENTS, JSX_BLOCK_SPECS, type JsonValue, type JsxFormMeta, type LinearScaleField, type MatrixField, type NumberField, PHONE_COUNTRIES, type ParagraphBlock, type ParsedPhone, type PhoneCountry, type PhoneField, type ProvisionWorkspaceResult, type PublishedForm, type RankingField, type RatingField, type ResponseData, type SchemaValidationResult, type SelectOption, Sha1, type SignatureField, type SlotClass, type SlotState, type SubmitMeta, type SubmitResult, type SyncFormResult, type SyncedForm, type TextField, type UploadFileOptions, type UploadProgress, type UploadSession, type UploadStatus, type UploadTransport, type ValidationResult, type WhenBuilder, allFields, assembleForm, codeFormFromJsx, contentHash, countryByDialCode, countryByIso, countryByTimeZone, createBlock, createClient, createEmptyForm, createFormController, createId, defineForm, digitsOnly, flagEmoji, formatAnswer, formatNational, isAutoSubmitBlock, isBlockVisible, isCodeForm, isField, isFilloError, isPossiblePhone, needsExplicitSubmit, normalizeFormSchema, normalizeFormTheme, parsePhone, pipeBlock, prefillFromParams, provisionWorkspace, resolveSlotClass, resolveStrings, resolveText, schemaFromJsx, sha1Base64, shouldAutoSubmit, slotClass, syncCodeForm, toE164, validateField, validateFormSchema, validateResponse, visibleBlocks, visibleFields, when };
1039
+ export { type AutoSubmitContext, BLOCK_KIND_META, type BaseField, type Block, type BlockKind, CONTENT_KINDS, type CheckboxField, type ChoiceField, type CodeForm, type Condition, type ConditionOp, type ContentBlock, type ContentKind, type CustomField, DEFAULT_STRINGS, DRAFT_KINDS, type DateField, type DividerBlock, FILLO_DATA_ATTRS, FILLO_SCHEMA_VERSION, FILLO_SDK_VERSION, FILLO_SLOTS, FILLO_THEME_VARS, type Field, type FieldKind, type FieldSpec, type FieldValue, type FileUploadField, type FileValue, type FilloAppearance, FilloClient, type FilloClientOptions, FilloError, FilloJsxError, type FilloSlot, type FilloStrings, type FormBranding, type FormController, type FormControllerOptions, type FormControllerState, type FormDraftSpec, type FormPage, type FormSchema, type FormSettings, type FormStatus, type FormTheme, type HeadingBlock, type HiddenField, JSX_BLOCK_COMPONENTS, JSX_BLOCK_SPECS, type JsonValue, type JsxFormMeta, type LinearScaleField, type MatrixField, type NumberField, PHONE_COUNTRIES, type ParagraphBlock, type ParsedPhone, type PhoneCountry, type PhoneField, type ProvisionWorkspaceResult, type PublishedForm, type RankingField, type RatingField, type ResponseData, type SchemaValidationResult, type SelectOption, Sha1, type SignatureField, type SlotClass, type SlotState, type SubmitMeta, type SubmitResult, type SyncFormResult, type SyncedForm, type TextField, type UploadFileOptions, type UploadProgress, type UploadSession, type UploadStatus, type UploadTransport, type ValidationResult, type WhenBuilder, allFields, assembleForm, codeFormFromJsx, contentHash, countryByDialCode, countryByIso, countryByTimeZone, createBlock, createClient, createEmptyForm, createFormController, createId, defineForm, digitsOnly, flagEmoji, formatAnswer, formatNational, isAutoSubmitBlock, isBlockVisible, isCodeForm, isField, isFilloError, isPossiblePhone, needsExplicitSubmit, normalizeFormSchema, normalizeFormTheme, parsePhone, pipeBlock, prefillFromParams, provisionWorkspace, resolveSlotClass, resolveStrings, resolveText, schemaFromJsx, sha1Base64, shouldAutoSubmit, slotClass, syncCodeForm, toE164, validateField, validateFormSchema, validateResponse, visibleBlocks, visibleFields, when };
package/dist/index.js CHANGED
@@ -594,7 +594,7 @@ var schemaShape = z2.object({
594
594
  });
595
595
  var MAX_SCHEMA_VERSION = 1;
596
596
  var FILLO_SCHEMA_VERSION = 1;
597
- var FILLO_SDK_VERSION = "0.5.0";
597
+ var FILLO_SDK_VERSION = true ? "0.6.2" : "0.0.0-dev";
598
598
  function str(value, max, fallback = "") {
599
599
  return typeof value === "string" ? value.trim().slice(0, max) : fallback;
600
600
  }
@@ -1463,7 +1463,7 @@ var FilloClient = class {
1463
1463
  * is sent twice or skipped.
1464
1464
  *
1465
1465
  * Depending on the form's storage settings the server picks a transport:
1466
- * Fillo's own chunk protocol, or direct-to-Google-Drive resumable
1466
+ * direct-to-Google-Drive resumable
1467
1467
  * sessions — in which case the bytes go straight from this browser to the
1468
1468
  * form owner's Drive and never touch the Fillo server.
1469
1469
  */
@@ -1806,6 +1806,14 @@ function prefillFromParams(form, params) {
1806
1806
  // src/controller.ts
1807
1807
  var EMPTY_PAGE = { id: "empty", blocks: [] };
1808
1808
  var warnedNoClient = false;
1809
+ var warnedNoFormId = false;
1810
+ function warnNoFormId() {
1811
+ if (warnedNoFormId) return;
1812
+ warnedNoFormId = true;
1813
+ console.warn(
1814
+ "[fillo] This form has a client but no submission target \u2014 a bare schema can't sync. Wrap it in defineForm({ id, pages }) (or author it with <Fillo.Form id=\u2026>) so it gets a workspace handle, or pass formId for a dashboard-built form: https://fillo.so/docs"
1815
+ );
1816
+ }
1809
1817
  function warnNoClient() {
1810
1818
  if (warnedNoClient) return;
1811
1819
  warnedNoClient = true;
@@ -2057,7 +2065,8 @@ function createFormController(options2) {
2057
2065
  emitSubmitted(void 0, result.data);
2058
2066
  return;
2059
2067
  }
2060
- warnNoClient();
2068
+ if (client && !formId) warnNoFormId();
2069
+ else warnNoClient();
2061
2070
  status = "error";
2062
2071
  notify();
2063
2072
  }
@@ -2157,6 +2166,8 @@ var FILLO_DATA_ATTRS = {
2157
2166
  field: "data-field",
2158
2167
  invalid: "data-invalid",
2159
2168
  required: "data-required",
2169
+ /** Option id, on each choice row (pre-existing selector hook). */
2170
+ option: "data-option",
2160
2171
  /** Selected option row / active scale step / active star. */
2161
2172
  selected: "data-selected",
2162
2173
  /** Checkbox / toggle checked state. */
@@ -2180,6 +2191,18 @@ function slotClass(base, appearance, state) {
2180
2191
  const extra = resolveSlotClass(appearance, state);
2181
2192
  return extra ? `${base} ${extra}` : base;
2182
2193
  }
2194
+ var FILLO_THEME_VARS = [
2195
+ { var: "--fillo-primary", themeProp: "primary" },
2196
+ { var: "--fillo-bg", themeProp: "background" },
2197
+ { var: "--fillo-text", themeProp: "text" },
2198
+ { var: "--fillo-radius", themeProp: "radius" },
2199
+ { var: "--fillo-font", themeProp: "fontFamily" },
2200
+ { var: "--fillo-muted" },
2201
+ { var: "--fillo-border" },
2202
+ { var: "--fillo-control-bg" },
2203
+ { var: "--fillo-error" },
2204
+ { var: "--fillo-primary-contrast" }
2205
+ ];
2183
2206
 
2184
2207
  // src/strings.ts
2185
2208
  var DEFAULT_STRINGS = {
@@ -2634,6 +2657,7 @@ export {
2634
2657
  FILLO_SCHEMA_VERSION,
2635
2658
  FILLO_SDK_VERSION,
2636
2659
  FILLO_SLOTS,
2660
+ FILLO_THEME_VARS,
2637
2661
  FilloClient,
2638
2662
  FilloError,
2639
2663
  FilloJsxError,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@usefillo/core",
3
- "version": "0.6.0",
3
+ "version": "0.6.2",
4
4
  "description": "Form schema, validation, logic engine and JS client for Fillo. Framework-agnostic.",
5
5
  "license": "MIT",
6
6
  "keywords": [
@@ -36,7 +36,7 @@
36
36
  "typescript": "^5.8.3"
37
37
  },
38
38
  "scripts": {
39
- "build": "tsup src/index.ts --format esm --dts --clean",
39
+ "build": "tsup",
40
40
  "dev": "tsup src/index.ts --format esm --dts --watch",
41
41
  "typecheck": "tsc --noEmit",
42
42
  "test": "node --test test/*.test.mjs"