@zeyolabs/ui 2026.11.52 → 2026.11.54

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/form/Form.svelte CHANGED
@@ -71,6 +71,19 @@
71
71
  hidden ? Object.entries(hidden).filter(([, value]) => value != null && value !== '') : []
72
72
  );
73
73
 
74
+ // A browser extension (autofill, translation) may add its own named inputs to the form, and
75
+ // SvelteKit throws `form_field_unbound` on any field not bound to the remote form. Every
76
+ // `FormData` built from the form fires `formdata` first, so drop those entries there. Bound
77
+ // names end with `/<form id>`; the action carries the id, plus `/<key>` for a `.for(key)` form.
78
+ function dropUnboundFields(event: FormDataEvent) {
79
+ const action = new URLSearchParams(remote.action.split('?')[1] ?? '').get('/remote');
80
+ if (!action) return;
81
+ const suffix = '/' + action.split('/').slice(0, 2).join('/');
82
+ for (const name of new Set(event.formData.keys())) {
83
+ if (!name.replace(/\.[xy]$/, '').endsWith(suffix)) event.formData.delete(name);
84
+ }
85
+ }
86
+
74
87
  // Force enctype after the remote-form spread applies (which sets its own enctype).
75
88
  // Defaults to multipart when the form contains file inputs, so consumers can't forget it.
76
89
  function applyEnctype(node: HTMLFormElement) {
@@ -83,6 +96,7 @@
83
96
  <form
84
97
  class={className}
85
98
  novalidate
99
+ onformdata={dropUnboundFields}
86
100
  oninput={(event) => {
87
101
  remote.validate();
88
102
  dirty = true;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeyolabs/ui",
3
- "version": "2026.11.52",
3
+ "version": "2026.11.54",
4
4
  "description": "Shared Svelte 5 components, form fields and design tokens for SvelteKit 3 apps.",
5
5
  "type": "module",
6
6
  "license": "UNLICENSED",
@@ -157,7 +157,7 @@
157
157
  "devDependencies": {
158
158
  "@eslint/compat": "2.1.1",
159
159
  "@eslint/js": "10.0.1",
160
- "@zeyolabs/kit": "2026.11.48",
160
+ "@zeyolabs/kit": "2026.11.55",
161
161
  "@sveltejs/kit": "3.2.0",
162
162
  "@types/flickity": "2.2.12",
163
163
  "eslint": "10.15.0",
@@ -34,6 +34,10 @@
34
34
  };
35
35
  widgetId = turnstile.render(container, {
36
36
  callback: (token) => onToken(token),
37
+ // Without it Turnstile throws each failed challenge (e.g. 600010 from a bot or a
38
+ // locked-down browser) as an uncaught error; it retries by itself and the widget
39
+ // shows the failure.
40
+ 'error-callback': () => true,
37
41
  'expired-callback': restart,
38
42
  'response-field': false,
39
43
  sitekey: siteKey,
package/turnstile/load.ts CHANGED
@@ -5,6 +5,8 @@ export type TurnstileApi = {
5
5
  container: HTMLElement,
6
6
  options: {
7
7
  callback: (token: string) => void;
8
+ /** Return true to mark the error handled, so Turnstile doesn't throw it. */
9
+ 'error-callback': (code: string) => boolean;
8
10
  'expired-callback': () => void;
9
11
  'response-field': boolean;
10
12
  sitekey: string;