@molecule/app-svelte 2.0.1 → 3.0.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 +32 -7
- package/dist/stores/forms.d.ts +5 -5
- package/dist/stores/forms.d.ts.map +1 -1
- package/dist/stores/forms.js.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -3,7 +3,7 @@ AUTO-GENERATED — DO NOT EDIT THIS FILE.
|
|
|
3
3
|
Generated by `mlcl sync-docs` from the package's src/index.ts JSDoc + mlcl/registry.json.
|
|
4
4
|
Edits here are overwritten on the next commit (molecule's pre-commit hook regenerates).
|
|
5
5
|
To change this document, edit the module-level JSDoc in src/index.ts.
|
|
6
|
-
Generated: 2026-10-
|
|
6
|
+
Generated: 2026-10-27T23:36:55.367Z
|
|
7
7
|
-->
|
|
8
8
|
|
|
9
9
|
# @molecule/app-svelte
|
|
@@ -319,7 +319,7 @@ Form controller interface.
|
|
|
319
319
|
All form providers must implement this interface.
|
|
320
320
|
|
|
321
321
|
```typescript
|
|
322
|
-
interface FormController<T extends
|
|
322
|
+
interface FormController<T extends FormValuesConstraint<T> = Record<string, unknown>> {
|
|
323
323
|
/**
|
|
324
324
|
* Gets the current form state.
|
|
325
325
|
*/
|
|
@@ -427,7 +427,7 @@ interface FormController<T extends Record<string, unknown> = Record<string, unkn
|
|
|
427
427
|
Form creation options.
|
|
428
428
|
|
|
429
429
|
```typescript
|
|
430
|
-
interface FormOptions<T extends
|
|
430
|
+
interface FormOptions<T extends FormValuesConstraint<T>> {
|
|
431
431
|
/**
|
|
432
432
|
* Default values, captured as the form's clean baseline when the controller
|
|
433
433
|
* is created. Mutating this object afterwards does not change the baseline.
|
|
@@ -1085,6 +1085,31 @@ interface StorageProvider {
|
|
|
1085
1085
|
* Removes multiple values from storage.
|
|
1086
1086
|
*/
|
|
1087
1087
|
removeMany?(keys: string[]): Promise<void>
|
|
1088
|
+
/**
|
|
1089
|
+
* Reads a value synchronously.
|
|
1090
|
+
*
|
|
1091
|
+
* Optional: only a provider backed by a SYNCHRONOUS store (browser
|
|
1092
|
+
* `localStorage`, an in-memory map) can answer without I/O. A render-time
|
|
1093
|
+
* caller reads through `getPreferenceStore()`, which uses this method to see
|
|
1094
|
+
* the persisted value on the first paint; a provider without it is read
|
|
1095
|
+
* through {@link StorageProvider.get} and subscribers update when the value
|
|
1096
|
+
* lands.
|
|
1097
|
+
* @param key - The storage key.
|
|
1098
|
+
* @returns The stored value, or `null` when it is absent, unreadable or corrupt.
|
|
1099
|
+
*/
|
|
1100
|
+
getSync?<T = unknown>(key: string): T | null
|
|
1101
|
+
/**
|
|
1102
|
+
* Subscribes to changes made to a key OUTSIDE this provider instance — for
|
|
1103
|
+
* example another browser tab's `localStorage` write.
|
|
1104
|
+
*
|
|
1105
|
+
* Writes made through the same provider instance do not re-emit here; a
|
|
1106
|
+
* synchronous caller observes them through `getPreferenceStore()`'s own
|
|
1107
|
+
* subscribers.
|
|
1108
|
+
* @param key - The storage key.
|
|
1109
|
+
* @param listener - Called with the new value, or `null` when it was removed.
|
|
1110
|
+
* @returns A function that stops the subscription.
|
|
1111
|
+
*/
|
|
1112
|
+
subscribe?(key: string, listener: (value: unknown) => void): () => void
|
|
1088
1113
|
}
|
|
1089
1114
|
```
|
|
1090
1115
|
|
|
@@ -1618,7 +1643,7 @@ function createDeviceStores(): {
|
|
|
1618
1643
|
Create form stores from a form provider and options.
|
|
1619
1644
|
|
|
1620
1645
|
```typescript
|
|
1621
|
-
function createFormStores<T extends
|
|
1646
|
+
function createFormStores<T extends FormValuesConstraint<T>>(
|
|
1622
1647
|
provider: FormProvider,
|
|
1623
1648
|
options: FormOptions<T>,
|
|
1624
1649
|
): FormStores<T>
|
|
@@ -1634,7 +1659,7 @@ function createFormStores<T extends Record<string, unknown>>(
|
|
|
1634
1659
|
Create a readable store that tracks a single field's state.
|
|
1635
1660
|
|
|
1636
1661
|
```typescript
|
|
1637
|
-
function createFieldStore<T extends
|
|
1662
|
+
function createFieldStore<T extends FormValuesConstraint<T>, K extends keyof T>(
|
|
1638
1663
|
controller: FormController<T>,
|
|
1639
1664
|
name: K,
|
|
1640
1665
|
): Readable<FieldState<T[K]>>
|
|
@@ -1650,7 +1675,7 @@ function createFieldStore<T extends Record<string, unknown>, K extends keyof T>(
|
|
|
1650
1675
|
Create a readable store that tracks a single field's value.
|
|
1651
1676
|
|
|
1652
1677
|
```typescript
|
|
1653
|
-
function createWatchStore<T extends
|
|
1678
|
+
function createWatchStore<T extends FormValuesConstraint<T>, K extends keyof T>(
|
|
1654
1679
|
controller: FormController<T>,
|
|
1655
1680
|
name: K,
|
|
1656
1681
|
): Readable<T[K]>
|
|
@@ -2160,7 +2185,7 @@ Peer dependencies:
|
|
|
2160
2185
|
|
|
2161
2186
|
- `@molecule/app-auth` ^3.0.0
|
|
2162
2187
|
- `@molecule/app-device` ^1.0.1
|
|
2163
|
-
- `@molecule/app-forms` ^
|
|
2188
|
+
- `@molecule/app-forms` ^2.0.0
|
|
2164
2189
|
- `@molecule/app-http` ^1.0.1
|
|
2165
2190
|
- `@molecule/app-i18n` ^1.0.1
|
|
2166
2191
|
- `@molecule/app-logger` ^1.0.1
|
package/dist/stores/forms.d.ts
CHANGED
|
@@ -4,11 +4,11 @@
|
|
|
4
4
|
* @module
|
|
5
5
|
*/
|
|
6
6
|
import { type Readable } from 'svelte/store';
|
|
7
|
-
import type { FieldRegistration, FieldState, FormController, FormOptions, FormProvider, FormState, RegisterOptions } from '@molecule/app-forms';
|
|
7
|
+
import type { FieldRegistration, FieldState, FormController, FormOptions, FormProvider, FormState, FormValuesConstraint, RegisterOptions } from '@molecule/app-forms';
|
|
8
8
|
/**
|
|
9
9
|
* Form stores and actions return type.
|
|
10
10
|
*/
|
|
11
|
-
interface FormStores<T extends
|
|
11
|
+
interface FormStores<T extends FormValuesConstraint<T>> {
|
|
12
12
|
formState: Readable<FormState<T>>;
|
|
13
13
|
isValid: Readable<boolean>;
|
|
14
14
|
isDirty: Readable<boolean>;
|
|
@@ -72,7 +72,7 @@ interface FormStores<T extends Record<string, unknown>> {
|
|
|
72
72
|
* </form>
|
|
73
73
|
* ```
|
|
74
74
|
*/
|
|
75
|
-
export declare function createFormStores<T extends
|
|
75
|
+
export declare function createFormStores<T extends FormValuesConstraint<T>>(provider: FormProvider, options: FormOptions<T>): FormStores<T>;
|
|
76
76
|
/**
|
|
77
77
|
* Create a readable store that tracks a single field's state.
|
|
78
78
|
*
|
|
@@ -94,7 +94,7 @@ export declare function createFormStores<T extends Record<string, unknown>>(prov
|
|
|
94
94
|
* <p>Touched: {$emailField.touched}</p>
|
|
95
95
|
* ```
|
|
96
96
|
*/
|
|
97
|
-
export declare function createFieldStore<T extends
|
|
97
|
+
export declare function createFieldStore<T extends FormValuesConstraint<T>, K extends keyof T>(controller: FormController<T>, name: K): Readable<FieldState<T[K]>>;
|
|
98
98
|
/**
|
|
99
99
|
* Create a readable store that tracks a single field's value.
|
|
100
100
|
*
|
|
@@ -116,6 +116,6 @@ export declare function createFieldStore<T extends Record<string, unknown>, K ex
|
|
|
116
116
|
* {/if}
|
|
117
117
|
* ```
|
|
118
118
|
*/
|
|
119
|
-
export declare function createWatchStore<T extends
|
|
119
|
+
export declare function createWatchStore<T extends FormValuesConstraint<T>, K extends keyof T>(controller: FormController<T>, name: K): Readable<T[K]>;
|
|
120
120
|
export {};
|
|
121
121
|
//# sourceMappingURL=forms.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"forms.d.ts","sourceRoot":"","sources":["../../src/stores/forms.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAW,KAAK,QAAQ,EAAY,MAAM,cAAc,CAAA;AAE/D,OAAO,KAAK,EACV,iBAAiB,EACjB,UAAU,EACV,cAAc,EACd,WAAW,EACX,YAAY,EACZ,SAAS,EACT,eAAe,EAChB,MAAM,qBAAqB,CAAA;AAE5B;;GAEG;AACH,UAAU,UAAU,CAAC,CAAC,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AAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAM5B;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,gBAAgB,CAAC,CAAC,SAAS,oBAAoB,CAAC,CAAC,CAAC,EAAE,CAAC,SAAS,MAAM,CAAC,EACnF,UAAU,EAAE,cAAc,CAAC,CAAC,CAAC,EAC7B,IAAI,EAAE,CAAC,GACN,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAMhB"}
|
package/dist/stores/forms.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"forms.js","sourceRoot":"","sources":["../../src/stores/forms.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,OAAO,EAAiB,QAAQ,EAAE,MAAM,cAAc,CAAA;
|
|
1
|
+
{"version":3,"file":"forms.js","sourceRoot":"","sources":["../../src/stores/forms.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,OAAO,EAAiB,QAAQ,EAAE,MAAM,cAAc,CAAA;AA0C/D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH,MAAM,UAAU,gBAAgB,CAC9B,QAAsB,EACtB,OAAuB;IAEvB,MAAM,UAAU,GAAG,QAAQ,CAAC,UAAU,CAAI,OAAO,CAAC,CAAA;IAElD,wBAAwB;IACxB,MAAM,SAAS,GAA2B,QAAQ,CAChD,UAAU,CAAC,QAAQ,EAAE,EACrB,CAAC,GAAkC,EAAE,EAAE;QACrC,OAAO,UAAU,CAAC,SAAS,CAAC,CAAC,KAAmB,EAAE,EAAE;YAClD,GAAG,CAAC,KAAK,CAAC,CAAA;QACZ,CAAC,CAAC,CAAA;IACJ,CAAC,CACF,CAAA;IAED,iBAAiB;IACjB,MAAM,OAAO,GAAG,OAAO,CAAC,SAAS,EAAE,CAAC,MAAoB,EAAE,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,CAAA;IAC5E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CAAA;AACJ,CAAC;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,UAAU,gBAAgB,CAC9B,UAA6B,EAC7B,IAAO;IAEP,OAAO,QAAQ,CAAC,UAAU,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,GAA0B,EAAE,EAAE;QACxE,OAAO,UAAU,CAAC,SAAS,CAAC,GAAG,EAAE;YAC/B,GAAG,CAAC,UAAU,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAA;QAChC,CAAC,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;AACJ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@molecule/app-svelte",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0",
|
|
4
4
|
"description": "Svelte framework bindings for molecule.dev",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"peerDependencies": {
|
|
25
25
|
"@molecule/app-auth": "^3.0.0",
|
|
26
26
|
"@molecule/app-device": "^1.0.1",
|
|
27
|
-
"@molecule/app-forms": "^
|
|
27
|
+
"@molecule/app-forms": "^2.0.0",
|
|
28
28
|
"@molecule/app-http": "^1.0.1",
|
|
29
29
|
"@molecule/app-i18n": "^1.0.1",
|
|
30
30
|
"@molecule/app-logger": "^1.0.1",
|