@marianmeres/stuic 3.181.0 → 3.183.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 +1 -1
- package/dist/components/FieldsBuilder/FieldsBuilder.svelte +101 -150
- package/dist/components/FieldsBuilder/FieldsBuilder.svelte.d.ts +10 -1
- package/dist/components/FieldsBuilder/README.md +82 -3
- package/dist/components/FieldsBuilder/_internal/ColumnsEditor.svelte +624 -0
- package/dist/components/FieldsBuilder/_internal/ColumnsEditor.svelte.d.ts +41 -0
- package/dist/components/FieldsBuilder/_internal/ExtrasEditor.svelte +174 -0
- package/dist/components/FieldsBuilder/_internal/ExtrasEditor.svelte.d.ts +20 -0
- package/dist/components/FieldsBuilder/_internal/column-meta.d.ts +27 -0
- package/dist/components/FieldsBuilder/_internal/column-meta.js +15 -0
- package/dist/components/FieldsBuilder/i18n-sk.js +17 -0
- package/dist/components/FieldsBuilder/i18n.d.ts +17 -0
- package/dist/components/FieldsBuilder/i18n.js +17 -0
- package/dist/components/FieldsBuilder/index.css +20 -0
- package/dist/components/FieldsBuilder/index.d.ts +2 -2
- package/dist/components/FieldsBuilder/types.d.ts +39 -0
- package/dist/components/FieldsBuilder/utils.d.ts +36 -1
- package/dist/components/FieldsBuilder/utils.js +180 -55
- package/dist/components/Input/FieldAssets.svelte +9 -132
- package/dist/components/Input/FieldSingleAsset.svelte +876 -0
- package/dist/components/Input/FieldSingleAsset.svelte.d.ts +135 -0
- package/dist/components/Input/FieldTable.svelte +907 -0
- package/dist/components/Input/FieldTable.svelte.d.ts +98 -0
- package/dist/components/Input/README.md +467 -20
- package/dist/components/Input/_internal/asset-helpers.d.ts +16 -0
- package/dist/components/Input/_internal/asset-helpers.js +46 -0
- package/dist/components/Input/_internal/paste-target.d.ts +15 -0
- package/dist/components/Input/_internal/paste-target.js +114 -0
- package/dist/components/Input/field-single-asset-i18n-sk.d.ts +21 -0
- package/dist/components/Input/field-single-asset-i18n-sk.js +49 -0
- package/dist/components/Input/field-single-asset-i18n.d.ts +68 -0
- package/dist/components/Input/field-single-asset-i18n.js +75 -0
- package/dist/components/Input/field-table-i18n-sk.d.ts +21 -0
- package/dist/components/Input/field-table-i18n-sk.js +41 -0
- package/dist/components/Input/field-table-i18n.d.ts +60 -0
- package/dist/components/Input/field-table-i18n.js +66 -0
- package/dist/components/Input/field-table-number.d.ts +48 -0
- package/dist/components/Input/field-table-number.js +86 -0
- package/dist/components/Input/index.css +801 -0
- package/dist/components/Input/index.d.ts +7 -0
- package/dist/components/Input/index.js +7 -0
- package/docs/domains/actions.md +3 -3
- package/docs/domains/components.md +45 -38
- package/package.json +1 -1
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
export * from "./types.js";
|
|
2
2
|
export { default as FieldAssets, type Props as FieldAssetsProps, type FieldAsset, type FieldAssetUrlObj, type FieldAssetWithBlobUrl, } from "./FieldAssets.svelte";
|
|
3
|
+
export { default as FieldSingleAsset, type Props as FieldSingleAssetProps, type FieldSingleAssetUploadContext, type FieldSingleAssetShape, type FieldSingleAssetFit, type FieldSingleAssetSize, type FieldSingleAssetFileCheck, } from "./FieldSingleAsset.svelte";
|
|
4
|
+
export { createFieldSingleAssetT, FIELD_SINGLE_ASSET_MESSAGES_EN, type FieldSingleAssetMessageKey, type FieldSingleAssetMessages, } from "./field-single-asset-i18n.js";
|
|
5
|
+
export { FIELD_SINGLE_ASSET_MESSAGES_SK } from "./field-single-asset-i18n-sk.js";
|
|
3
6
|
export { default as FieldCheckbox, type Props as FieldCheckboxProps, } from "./FieldCheckbox.svelte";
|
|
4
7
|
export { default as Honeypot, type Props as HoneypotProps } from "./Honeypot.svelte";
|
|
5
8
|
export { default as TimeTrap, type Props as TimeTrapProps, type TimeTrapSnapshot, } from "./TimeTrap.svelte";
|
|
@@ -18,6 +21,10 @@ export { default as FieldTextarea, type Props as FieldTextareaProps, } from "./F
|
|
|
18
21
|
export { default as FieldInputLocalized, type Props as FieldInputLocalizedProps, } from "./FieldInputLocalized.svelte";
|
|
19
22
|
export { default as FieldKeyValues, type Props as FieldKeyValuesProps, type KeyValueEntry, } from "./FieldKeyValues.svelte";
|
|
20
23
|
export { default as FieldObject, type Props as FieldObjectProps, } from "./FieldObject.svelte";
|
|
24
|
+
export { default as FieldTable, type Props as FieldTableProps, type FieldTableColumn, type FieldTableCellType, type FieldTableCellContext, type FieldTableRow, } from "./FieldTable.svelte";
|
|
25
|
+
export { createFieldTableT, FIELD_TABLE_MESSAGES_EN, type FieldTableMessageKey, type FieldTableMessages, } from "./field-table-i18n.js";
|
|
26
|
+
export { FIELD_TABLE_MESSAGES_SK } from "./field-table-i18n-sk.js";
|
|
27
|
+
export { parseCellNumber, formatCellNumber, type ParsedCellNumber, } from "./field-table-number.js";
|
|
21
28
|
export { default as FieldPhoneNumber, type Props as FieldPhoneNumberProps, } from "./FieldPhoneNumber.svelte";
|
|
22
29
|
export { default as FieldCountry, type Props as FieldCountryProps, } from "./FieldCountry.svelte";
|
|
23
30
|
export { validatePhoneNumber } from "./phone-validation.js";
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
export * from "./types.js";
|
|
2
2
|
export { default as FieldAssets, } from "./FieldAssets.svelte";
|
|
3
|
+
export { default as FieldSingleAsset, } from "./FieldSingleAsset.svelte";
|
|
4
|
+
export { createFieldSingleAssetT, FIELD_SINGLE_ASSET_MESSAGES_EN, } from "./field-single-asset-i18n.js";
|
|
5
|
+
export { FIELD_SINGLE_ASSET_MESSAGES_SK } from "./field-single-asset-i18n-sk.js";
|
|
3
6
|
export { default as FieldCheckbox, } from "./FieldCheckbox.svelte";
|
|
4
7
|
export { default as Honeypot } from "./Honeypot.svelte";
|
|
5
8
|
export { default as TimeTrap, } from "./TimeTrap.svelte";
|
|
@@ -18,6 +21,10 @@ export { default as FieldTextarea, } from "./FieldTextarea.svelte";
|
|
|
18
21
|
export { default as FieldInputLocalized, } from "./FieldInputLocalized.svelte";
|
|
19
22
|
export { default as FieldKeyValues, } from "./FieldKeyValues.svelte";
|
|
20
23
|
export { default as FieldObject, } from "./FieldObject.svelte";
|
|
24
|
+
export { default as FieldTable, } from "./FieldTable.svelte";
|
|
25
|
+
export { createFieldTableT, FIELD_TABLE_MESSAGES_EN, } from "./field-table-i18n.js";
|
|
26
|
+
export { FIELD_TABLE_MESSAGES_SK } from "./field-table-i18n-sk.js";
|
|
27
|
+
export { parseCellNumber, formatCellNumber, } from "./field-table-number.js";
|
|
21
28
|
export { default as FieldPhoneNumber, } from "./FieldPhoneNumber.svelte";
|
|
22
29
|
export { default as FieldCountry, } from "./FieldCountry.svelte";
|
|
23
30
|
export { validatePhoneNumber } from "./phone-validation.js";
|
package/docs/domains/actions.md
CHANGED
|
@@ -121,7 +121,7 @@ Per the HTML spec, `<input type="hidden">` is _barred from constraint
|
|
|
121
121
|
validation_ — `validity.valueMissing` stays `false` regardless of the
|
|
122
122
|
`required` attribute, and native browser submit blocking is skipped. Several
|
|
123
123
|
STUIC field components (`FieldPhoneNumber`, `FieldCountry`, `FieldObject`,
|
|
124
|
-
`FieldAssets`, `FieldInputLocalized`, `FieldKeyValues`, `FieldLikeButton`,
|
|
124
|
+
`FieldAssets`, `FieldSingleAsset`, `FieldInputLocalized`, `FieldKeyValues`, `FieldLikeButton`,
|
|
125
125
|
`FieldDate`, `FieldDateRange`) use a hidden input to participate in `FormData`, so they each enforce
|
|
126
126
|
`required` themselves inside their `customValidator`:
|
|
127
127
|
|
|
@@ -153,12 +153,12 @@ Two element types are deliberately exempt from the synthetic dispatch:
|
|
|
153
153
|
group, which is wrong.
|
|
154
154
|
- **`type="file"`** — a file input's value is read-only to script, so a
|
|
155
155
|
synthetic `change` can't re-validate it; worse, it re-triggers any dropzone /
|
|
156
|
-
upload listener bound to the input. `FieldAssets`
|
|
156
|
+
upload listener bound to the input. `FieldAssets` (and `FieldSingleAsset`) wire their hidden
|
|
157
157
|
`<input type="file">` through `fileDropzone`, so a re-fired `change` would
|
|
158
158
|
re-run `processFiles` with the previously-picked file still in `inputEl.files`
|
|
159
159
|
— duplicating the asset and firing a real re-upload on every save. File inputs
|
|
160
160
|
are still read for native constraint validation (`required`); only the event
|
|
161
|
-
dispatch is skipped. (
|
|
161
|
+
dispatch is skipped. (Both additionally clear their file input after
|
|
162
162
|
consuming a selection, both as defense-in-depth and to allow re-selecting the
|
|
163
163
|
same file twice in a row.)
|
|
164
164
|
|
|
@@ -62,24 +62,26 @@
|
|
|
62
62
|
|
|
63
63
|
### Form
|
|
64
64
|
|
|
65
|
-
| Component | Purpose
|
|
66
|
-
| --------------------------------------------- |
|
|
67
|
-
| Input (FieldInput, FieldSelect, etc.) | Form fields
|
|
68
|
-
| FieldMoney | Money input storing integer minor units (e.g. cents)
|
|
69
|
-
| Calendar | Month grid for single-date / range picking: keyboard grid, min/max, dropdown caption, i18n
|
|
70
|
-
| FieldDate, FieldDateRange | Date / date-range fields around Calendar: trigger + dialog or embedded; ISO hidden inputs
|
|
71
|
-
| FieldPhoneNumber | International phone input with country picker
|
|
72
|
-
| FieldObject | Dual-mode JSON object editor (pretty-print/raw)
|
|
73
|
-
| CronInput | Cron expression editor with presets and validation
|
|
74
|
-
| Fieldset | Field grouping with legend
|
|
75
|
-
| FieldKeyValues | Key-value pair editor
|
|
76
|
-
|
|
|
77
|
-
|
|
|
78
|
-
|
|
|
79
|
-
|
|
|
80
|
-
|
|
|
81
|
-
|
|
|
82
|
-
|
|
|
65
|
+
| Component | Purpose |
|
|
66
|
+
| --------------------------------------------- | ------------------------------------------------------------------------------------------------- |
|
|
67
|
+
| Input (FieldInput, FieldSelect, etc.) | Form fields |
|
|
68
|
+
| FieldMoney | Money input storing integer minor units (e.g. cents) |
|
|
69
|
+
| Calendar | Month grid for single-date / range picking: keyboard grid, min/max, dropdown caption, i18n |
|
|
70
|
+
| FieldDate, FieldDateRange | Date / date-range fields around Calendar: trigger + dialog or embedded; ISO hidden inputs |
|
|
71
|
+
| FieldPhoneNumber | International phone input with country picker |
|
|
72
|
+
| FieldObject | Dual-mode JSON object editor (pretty-print/raw) |
|
|
73
|
+
| CronInput | Cron expression editor with presets and validation |
|
|
74
|
+
| Fieldset | Field grouping with legend |
|
|
75
|
+
| FieldKeyValues | Key-value pair editor |
|
|
76
|
+
| FieldTable | Rows × typed columns editor (text/number/select/checkbox/date/url cells, container layout) |
|
|
77
|
+
| FieldsBuilder | Field-definition list editor ("what properties does a thing have?") |
|
|
78
|
+
| FieldAssets | File/asset management |
|
|
79
|
+
| FieldSingleAsset | One asset (avatar, logo, cover): replace-in-place tile, inline remove + undo, rollback on failure |
|
|
80
|
+
| LoginForm, LoginFormModal | Standalone login form with optional modal variant |
|
|
81
|
+
| RegisterForm | Standalone registration form with declarative extra fields |
|
|
82
|
+
| LoginOrRegisterForm, LoginOrRegisterFormModal | Composite login/register/verify form (3 modes, shared social-logins) |
|
|
83
|
+
| EmailVerifyForm | Post-registration email-verify form (OtpInput + resend cooldown) |
|
|
84
|
+
| OtpInput | Generic N-slot one-time-code input (numeric/alphanumeric, paste-distribute) |
|
|
83
85
|
|
|
84
86
|
### Display
|
|
85
87
|
|
|
@@ -156,8 +158,8 @@ failed `validate()` (imperative or event-driven) renders the inline error.
|
|
|
156
158
|
Use `validate={false}` to bypass stuic's validation entirely.
|
|
157
159
|
|
|
158
160
|
> **Why default-on?** Hidden-input field components (`FieldPhoneNumber`,
|
|
159
|
-
> `FieldCountry`, `FieldObject`, `FieldAssets`, `FieldInputLocalized`,
|
|
160
|
-
> `FieldKeyValues`, `FieldLikeButton`, `FieldDate`, `FieldDateRange`, `Rating`) _must_ be default-on because hidden
|
|
161
|
+
> `FieldCountry`, `FieldObject`, `FieldAssets`, `FieldSingleAsset`, `FieldInputLocalized`,
|
|
162
|
+
> `FieldKeyValues`, `FieldTable`, `FieldLikeButton`, `FieldDate`, `FieldDateRange`, `Rating`) _must_ be default-on because hidden
|
|
161
163
|
> inputs are excluded from native browser constraint validation — without the
|
|
162
164
|
> stuic action enforcing `required` in a `customValidator`, the attribute is a
|
|
163
165
|
> silent no-op. Plain-input field components were harmonized to the same
|
|
@@ -166,8 +168,8 @@ Use `validate={false}` to bypass stuic's validation entirely.
|
|
|
166
168
|
### Per-field methods
|
|
167
169
|
|
|
168
170
|
Available on `FieldInput`, `FieldMoney`, `FieldTextarea`, `FieldCheckbox`,
|
|
169
|
-
`FieldSelect`, `FieldFile`, `FieldObject`, `FieldAssets`, `FieldInputLocalized`,
|
|
170
|
-
`FieldKeyValues`, `FieldPhoneNumber`, `FieldCountry`, `FieldLikeButton`,
|
|
171
|
+
`FieldSelect`, `FieldFile`, `FieldObject`, `FieldAssets`, `FieldSingleAsset`, `FieldInputLocalized`,
|
|
172
|
+
`FieldKeyValues`, `FieldTable`, `FieldPhoneNumber`, `FieldCountry`, `FieldLikeButton`,
|
|
171
173
|
`FieldRadios`, `FieldSwitch`, `FieldOptions`, `FieldDate`, `FieldDateRange`, and
|
|
172
174
|
`Switch`:
|
|
173
175
|
|
|
@@ -563,8 +565,10 @@ the list is the consumer's job, server-side. Own directory: `components/FieldsBu
|
|
|
563
565
|
| `FieldDef` | type | One field definition (the value unit) |
|
|
564
566
|
| `FieldLock` | type | Per-field edit locks |
|
|
565
567
|
| `FieldOptionDef` | type | Choice-type option `{ value, label }` |
|
|
568
|
+
| `FieldColumnDef` | type | One column of a `supportsColumns` field |
|
|
566
569
|
| `FieldTypeDef` | type | Palette entry |
|
|
567
|
-
| `FieldTypeExtraDef` | type | Palette-declared boolean extra
|
|
570
|
+
| `FieldTypeExtraDef` | type | Palette-declared boolean / string / select extra |
|
|
571
|
+
| `FieldColumnErrors`, `FieldDefRowErrors` | types | `validateFieldDefs` result shapes |
|
|
568
572
|
| `LocalizedText` | type | `string \| Record<language, string>` |
|
|
569
573
|
| `FIELDS_BUILDER_DEFAULT_TYPES` | constant | Starter palette (text/longtext/number/checkbox/select/date) |
|
|
570
574
|
| `FIELDS_BUILDER_DEFAULT_KEY_PATTERN` | constant | `/^[a-z][a-z0-9_]{0,62}$/` |
|
|
@@ -572,26 +576,29 @@ the list is the consumer's job, server-side. Own directory: `components/FieldsBu
|
|
|
572
576
|
|
|
573
577
|
### Key Props
|
|
574
578
|
|
|
575
|
-
| Prop
|
|
576
|
-
|
|
|
577
|
-
| `value`
|
|
578
|
-
| `name`
|
|
579
|
-
| `types`
|
|
580
|
-
| `languages`
|
|
581
|
-
| `keysImmutable`
|
|
582
|
-
| `deriveKeyFromLabel`
|
|
583
|
-
| `reservedKeys`
|
|
584
|
-
| `deleteMode`
|
|
585
|
-
| `onBeforeDelete`
|
|
586
|
-
| `onBeforeTypeChange`
|
|
587
|
-
| `
|
|
588
|
-
| `
|
|
579
|
+
| Prop | Type | Default | Description |
|
|
580
|
+
| -------------------------------------------------- | ---------------------------------------------- | -------- | ------------------------------------------------ |
|
|
581
|
+
| `value` | `FieldDef[]` | required | Bindable ordered field list |
|
|
582
|
+
| `name` | `string` | required | Hidden-input name |
|
|
583
|
+
| `types` | `FieldTypeDef[]` | required | The type palette |
|
|
584
|
+
| `languages` | `string[]` | — | Multi-language labels/descriptions/options |
|
|
585
|
+
| `keysImmutable` | `boolean` | `true` | Freeze keys loaded from `value` |
|
|
586
|
+
| `deriveKeyFromLabel` | `boolean \| (label) => string` | `true` | Live slug derivation (diacritics transliterated) |
|
|
587
|
+
| `reservedKeys` | `string[] \| (key) => boolean` | — | Forbidden keys (derivation auto-avoids them) |
|
|
588
|
+
| `deleteMode` | `"mark" \| "immediate"` | `"mark"` | Mark+undo vs outright removal |
|
|
589
|
+
| `onBeforeDelete` | `(field) => void \| false \| Promise` | — | Delete veto (Tree `onMove`-style) |
|
|
590
|
+
| `onBeforeTypeChange` | `(field, newType) => void \| false \| Promise` | — | Type-change veto for pre-existing fields |
|
|
591
|
+
| `onBeforeColumnDelete`, `onBeforeColumnTypeChange` | `(field, column[, newType]) => …` | — | Column veto hooks (stored columns only) |
|
|
592
|
+
| `preview` | `Snippet<[{ fields }]>` | — | Live preview pane (side-by-side when wide) |
|
|
593
|
+
| `maxFields` | `number` | — | Add-limit |
|
|
589
594
|
|
|
590
595
|
Features: collapsed rows (label + key + type chip) expanding to the full editor;
|
|
591
596
|
drag reorder + Move up/down buttons with aria-live announcements; `lock.*` per-field
|
|
592
597
|
locks (label/description always editable); unknown-type rows render degraded
|
|
593
598
|
read-only and round-trip untouched; per-row inline validation with
|
|
594
|
-
focus-first-offender `validate()
|
|
599
|
+
focus-first-offender `validate()`; `supportsOptions` types get an option editor,
|
|
600
|
+
`supportsColumns` types a column editor (each column: label / type from `columnTypes` /
|
|
601
|
+
key, plus that column type's options and extras), capped by `maxColumns`.
|
|
595
602
|
|
|
596
603
|
### CSS Tokens
|
|
597
604
|
|