@molecule/app-svelte 2.0.0 → 2.0.1
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 +47 -27
- 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-26T04:14:40.834Z
|
|
7
7
|
-->
|
|
8
8
|
|
|
9
9
|
# @molecule/app-svelte
|
|
@@ -1372,7 +1372,7 @@ function setStateContext(provider: StateProvider): void
|
|
|
1372
1372
|
Sets the auth context.
|
|
1373
1373
|
|
|
1374
1374
|
```typescript
|
|
1375
|
-
function setAuthContext(client: AuthClient<T
|
|
1375
|
+
function setAuthContext<T>(client: AuthClient<T>): void
|
|
1376
1376
|
```
|
|
1377
1377
|
|
|
1378
1378
|
- `client` — The auth client to store in Svelte context.
|
|
@@ -1452,7 +1452,10 @@ function getStateProvider(): StateProvider
|
|
|
1452
1452
|
Gets the auth client from Svelte context.
|
|
1453
1453
|
|
|
1454
1454
|
```typescript
|
|
1455
|
-
function getAuthClient
|
|
1455
|
+
function getAuthClient<
|
|
1456
|
+
T = unknown,
|
|
1457
|
+
TRegister extends RegisterExtraShape<TRegister> = Record<never, never>,
|
|
1458
|
+
>(): AuthClient<T, TRegister>
|
|
1456
1459
|
```
|
|
1457
1460
|
|
|
1458
1461
|
**Returns:** The auth client instance.
|
|
@@ -1522,7 +1525,7 @@ function getLoggerProvider(): LoggerProvider
|
|
|
1522
1525
|
Creates a writable store with async-capable setState and extendState.
|
|
1523
1526
|
|
|
1524
1527
|
```typescript
|
|
1525
|
-
function createAsyncState(initialValue: T): AsyncStateStore<T>
|
|
1528
|
+
function createAsyncState<T>(initialValue: T): AsyncStateStore<T>
|
|
1526
1529
|
```
|
|
1527
1530
|
|
|
1528
1531
|
- `initialValue` — The initial state value
|
|
@@ -1534,7 +1537,12 @@ function createAsyncState(initialValue: T): AsyncStateStore<T>
|
|
|
1534
1537
|
Create auth stores from the auth client in context.
|
|
1535
1538
|
|
|
1536
1539
|
```typescript
|
|
1537
|
-
function createAuthStores
|
|
1540
|
+
function createAuthStores<
|
|
1541
|
+
T = unknown,
|
|
1542
|
+
TRegister extends RegisterExtraShape<TRegister> = Record<never, never>,
|
|
1543
|
+
>(): AuthStores<T, TRegister> & {
|
|
1544
|
+
error: Readable<string | null>
|
|
1545
|
+
}
|
|
1538
1546
|
```
|
|
1539
1547
|
|
|
1540
1548
|
**Returns:** Auth stores and actions
|
|
@@ -1546,7 +1554,10 @@ Create auth stores from a specific auth client.
|
|
|
1546
1554
|
Use this when you don't want to use context.
|
|
1547
1555
|
|
|
1548
1556
|
```typescript
|
|
1549
|
-
function createAuthStoresFromClient
|
|
1557
|
+
function createAuthStoresFromClient<
|
|
1558
|
+
T = unknown,
|
|
1559
|
+
TRegister extends RegisterExtraShape<TRegister> = Record<never, never>,
|
|
1560
|
+
>(client: AuthClient<T, TRegister>): AuthStores<T, TRegister>
|
|
1550
1561
|
```
|
|
1551
1562
|
|
|
1552
1563
|
- `client` — Auth client
|
|
@@ -1607,7 +1618,10 @@ function createDeviceStores(): {
|
|
|
1607
1618
|
Create form stores from a form provider and options.
|
|
1608
1619
|
|
|
1609
1620
|
```typescript
|
|
1610
|
-
function createFormStores
|
|
1621
|
+
function createFormStores<T extends Record<string, unknown>>(
|
|
1622
|
+
provider: FormProvider,
|
|
1623
|
+
options: FormOptions<T>,
|
|
1624
|
+
): FormStores<T>
|
|
1611
1625
|
```
|
|
1612
1626
|
|
|
1613
1627
|
- `provider` — Form provider instance
|
|
@@ -1620,7 +1634,10 @@ function createFormStores(provider: FormProvider, options: FormOptions<T>): Form
|
|
|
1620
1634
|
Create a readable store that tracks a single field's state.
|
|
1621
1635
|
|
|
1622
1636
|
```typescript
|
|
1623
|
-
function createFieldStore
|
|
1637
|
+
function createFieldStore<T extends Record<string, unknown>, K extends keyof T>(
|
|
1638
|
+
controller: FormController<T>,
|
|
1639
|
+
name: K,
|
|
1640
|
+
): Readable<FieldState<T[K]>>
|
|
1624
1641
|
```
|
|
1625
1642
|
|
|
1626
1643
|
- `controller` — Form controller
|
|
@@ -1633,7 +1650,10 @@ function createFieldStore(controller: FormController<T>, name: K): Readable<Fiel
|
|
|
1633
1650
|
Create a readable store that tracks a single field's value.
|
|
1634
1651
|
|
|
1635
1652
|
```typescript
|
|
1636
|
-
function createWatchStore
|
|
1653
|
+
function createWatchStore<T extends Record<string, unknown>, K extends keyof T>(
|
|
1654
|
+
controller: FormController<T>,
|
|
1655
|
+
name: K,
|
|
1656
|
+
): Readable<T[K]>
|
|
1637
1657
|
```
|
|
1638
1658
|
|
|
1639
1659
|
- `controller` — Form controller
|
|
@@ -1646,7 +1666,7 @@ function createWatchStore(controller: FormController<T>, name: K): Readable<T[K]
|
|
|
1646
1666
|
Create an HTTP request store.
|
|
1647
1667
|
|
|
1648
1668
|
```typescript
|
|
1649
|
-
function createHttpStore(
|
|
1669
|
+
function createHttpStore<T>(
|
|
1650
1670
|
method: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE',
|
|
1651
1671
|
url: string,
|
|
1652
1672
|
config?: RequestConfig,
|
|
@@ -1664,7 +1684,7 @@ function createHttpStore(
|
|
|
1664
1684
|
Creates a GET request store.
|
|
1665
1685
|
|
|
1666
1686
|
```typescript
|
|
1667
|
-
function createGetStore(url: string, config?: RequestConfig): HttpStore<T>
|
|
1687
|
+
function createGetStore<T>(url: string, config?: RequestConfig): HttpStore<T>
|
|
1668
1688
|
```
|
|
1669
1689
|
|
|
1670
1690
|
- `url` — The request endpoint URL.
|
|
@@ -1677,7 +1697,7 @@ function createGetStore(url: string, config?: RequestConfig): HttpStore<T>
|
|
|
1677
1697
|
Creates a POST request store.
|
|
1678
1698
|
|
|
1679
1699
|
```typescript
|
|
1680
|
-
function createPostStore(url: string, config?: RequestConfig): HttpStore<T>
|
|
1700
|
+
function createPostStore<T>(url: string, config?: RequestConfig): HttpStore<T>
|
|
1681
1701
|
```
|
|
1682
1702
|
|
|
1683
1703
|
- `url` — The request endpoint URL.
|
|
@@ -1690,7 +1710,7 @@ function createPostStore(url: string, config?: RequestConfig): HttpStore<T>
|
|
|
1690
1710
|
Creates a PUT request store.
|
|
1691
1711
|
|
|
1692
1712
|
```typescript
|
|
1693
|
-
function createPutStore(url: string, config?: RequestConfig): HttpStore<T>
|
|
1713
|
+
function createPutStore<T>(url: string, config?: RequestConfig): HttpStore<T>
|
|
1694
1714
|
```
|
|
1695
1715
|
|
|
1696
1716
|
- `url` — The request endpoint URL.
|
|
@@ -1703,7 +1723,7 @@ function createPutStore(url: string, config?: RequestConfig): HttpStore<T>
|
|
|
1703
1723
|
Creates a PATCH request store.
|
|
1704
1724
|
|
|
1705
1725
|
```typescript
|
|
1706
|
-
function createPatchStore(url: string, config?: RequestConfig): HttpStore<T>
|
|
1726
|
+
function createPatchStore<T>(url: string, config?: RequestConfig): HttpStore<T>
|
|
1707
1727
|
```
|
|
1708
1728
|
|
|
1709
1729
|
- `url` — The request endpoint URL.
|
|
@@ -1716,7 +1736,7 @@ function createPatchStore(url: string, config?: RequestConfig): HttpStore<T>
|
|
|
1716
1736
|
Creates a DELETE request store.
|
|
1717
1737
|
|
|
1718
1738
|
```typescript
|
|
1719
|
-
function createDeleteStore(url: string, config?: RequestConfig): HttpStore<T>
|
|
1739
|
+
function createDeleteStore<T>(url: string, config?: RequestConfig): HttpStore<T>
|
|
1720
1740
|
```
|
|
1721
1741
|
|
|
1722
1742
|
- `url` — The request endpoint URL.
|
|
@@ -1832,7 +1852,7 @@ function createLoggerHelpersFromProvider(provider: LoggerProvider): LoggerHelper
|
|
|
1832
1852
|
Creates a login store with async state tracking.
|
|
1833
1853
|
|
|
1834
1854
|
```typescript
|
|
1835
|
-
function createLoginStore(): LoginStore<T>
|
|
1855
|
+
function createLoginStore<T = unknown>(): LoginStore<T>
|
|
1836
1856
|
```
|
|
1837
1857
|
|
|
1838
1858
|
**Returns:** Login promise store
|
|
@@ -1897,7 +1917,9 @@ function createPlatformStores(): {
|
|
|
1897
1917
|
Creates a store that tracks async function state.
|
|
1898
1918
|
|
|
1899
1919
|
```typescript
|
|
1900
|
-
function createPromiseStore(
|
|
1920
|
+
function createPromiseStore<T extends (...args: any[]) => Promise<any>>(
|
|
1921
|
+
asyncFn: T,
|
|
1922
|
+
): PromiseStore<Awaited<ReturnType<T>>>
|
|
1901
1923
|
```
|
|
1902
1924
|
|
|
1903
1925
|
- `asyncFn` — The async function to track
|
|
@@ -1973,7 +1995,7 @@ function createRouterStoresFromRouter(router: Router): RouterStores
|
|
|
1973
1995
|
Creates a signup store with async state tracking.
|
|
1974
1996
|
|
|
1975
1997
|
```typescript
|
|
1976
|
-
function createSignupStore(): SignupStore<T>
|
|
1998
|
+
function createSignupStore<T = unknown>(): SignupStore<T>
|
|
1977
1999
|
```
|
|
1978
2000
|
|
|
1979
2001
|
**Returns:** Signup promise store
|
|
@@ -1983,7 +2005,7 @@ function createSignupStore(): SignupStore<T>
|
|
|
1983
2005
|
Create a readable Svelte store from a molecule store.
|
|
1984
2006
|
|
|
1985
2007
|
```typescript
|
|
1986
|
-
function createStoreReadable(store: MoleculeStore<T>): Readable<T>
|
|
2008
|
+
function createStoreReadable<T>(store: MoleculeStore<T>): Readable<T>
|
|
1987
2009
|
```
|
|
1988
2010
|
|
|
1989
2011
|
- `store` — The molecule store
|
|
@@ -1995,7 +2017,7 @@ function createStoreReadable(store: MoleculeStore<T>): Readable<T>
|
|
|
1995
2017
|
Create a derived Svelte store with a selector.
|
|
1996
2018
|
|
|
1997
2019
|
```typescript
|
|
1998
|
-
function createStoreSelector(store: MoleculeStore<T>, selector: (state: T) => S): Readable<S>
|
|
2020
|
+
function createStoreSelector<T, S>(store: MoleculeStore<T>, selector: (state: T) => S): Readable<S>
|
|
1999
2021
|
```
|
|
2000
2022
|
|
|
2001
2023
|
- `store` — The molecule store
|
|
@@ -2008,9 +2030,7 @@ function createStoreSelector(store: MoleculeStore<T>, selector: (state: T) => S)
|
|
|
2008
2030
|
Get the setState function from a molecule store.
|
|
2009
2031
|
|
|
2010
2032
|
```typescript
|
|
2011
|
-
function getSetStore(
|
|
2012
|
-
store: MoleculeStore<T>,
|
|
2013
|
-
): (partial: Partial<T> | ((state: T) => Partial<T>)) => void
|
|
2033
|
+
function getSetStore<T>(store: MoleculeStore<T>): MoleculeStore<T>['setState']
|
|
2014
2034
|
```
|
|
2015
2035
|
|
|
2016
2036
|
- `store` — The molecule store
|
|
@@ -2022,7 +2042,7 @@ function getSetStore(
|
|
|
2022
2042
|
Create a bound action for a store.
|
|
2023
2043
|
|
|
2024
2044
|
```typescript
|
|
2025
|
-
function createStoreAction(
|
|
2045
|
+
function createStoreAction<T, Args extends unknown[], R>(
|
|
2026
2046
|
store: MoleculeStore<T>,
|
|
2027
2047
|
action: (
|
|
2028
2048
|
setState: MoleculeStore<T>['setState'],
|
|
@@ -2041,7 +2061,7 @@ function createStoreAction(
|
|
|
2041
2061
|
Create a storage value store.
|
|
2042
2062
|
|
|
2043
2063
|
```typescript
|
|
2044
|
-
function createStorageStore(key: string, defaultValue?: T): StorageStore<T>
|
|
2064
|
+
function createStorageStore<T>(key: string, defaultValue?: T): StorageStore<T>
|
|
2045
2065
|
```
|
|
2046
2066
|
|
|
2047
2067
|
- `key` — Storage key
|
|
@@ -2064,7 +2084,7 @@ function createStorageHelpers(): StorageHelpers
|
|
|
2064
2084
|
Create storage store from a specific provider.
|
|
2065
2085
|
|
|
2066
2086
|
```typescript
|
|
2067
|
-
function createStorageStoreFromProvider(
|
|
2087
|
+
function createStorageStoreFromProvider<T>(
|
|
2068
2088
|
storage: StorageProvider,
|
|
2069
2089
|
key: string,
|
|
2070
2090
|
defaultValue?: T,
|
|
@@ -2092,7 +2112,7 @@ function createThemeStores(): ThemeStores & { colors: Readable<Theme['colors']>
|
|
|
2092
2112
|
Create a derived store that returns just the theme colors.
|
|
2093
2113
|
|
|
2094
2114
|
```typescript
|
|
2095
|
-
function createThemeColorsStore(theme: Readable<Theme>): Readable<
|
|
2115
|
+
function createThemeColorsStore(theme: Readable<Theme>): Readable<Theme['colors']>
|
|
2096
2116
|
```
|
|
2097
2117
|
|
|
2098
2118
|
- `theme` — A readable theme store (from createThemeStores or createThemeStoresFromProvider)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@molecule/app-svelte",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.1",
|
|
4
4
|
"description": "Svelte framework bindings for molecule.dev",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"svelte": "^4.0.0 || ^5.0.0"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
|
-
"@molecule/app-utilities": "1.0.
|
|
43
|
+
"@molecule/app-utilities": "1.0.6",
|
|
44
44
|
"@types/node": "26.6.5",
|
|
45
45
|
"svelte": "5.57.2",
|
|
46
46
|
"typescript": "6.0.3",
|