seitu 0.16.0 → 0.16.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/package.json +9 -9
- package/skills/README.md +30 -53
- package/skills/seitu/SKILL.md +92 -0
- package/skills/{create-computed/SKILL.md → seitu/references/create-computed.md} +2 -15
- package/skills/{create-debounced-fn/SKILL.md → seitu/references/create-debounced-fn.md} +2 -15
- package/skills/{create-debounced/SKILL.md → seitu/references/create-debounced.md} +2 -15
- package/skills/{create-indexed-db-storage/SKILL.md → seitu/references/create-indexed-db-storage.md} +2 -15
- package/skills/{create-is-online/SKILL.md → seitu/references/create-is-online.md} +2 -15
- package/skills/{create-media-query/SKILL.md → seitu/references/create-media-query.md} +2 -15
- package/skills/{create-readable-subscription/SKILL.md → seitu/references/create-readable-subscription.md} +2 -15
- package/skills/{create-schema-store/SKILL.md → seitu/references/create-schema-store.md} +2 -15
- package/skills/{create-scroll-state/SKILL.md → seitu/references/create-scroll-state.md} +2 -15
- package/skills/{create-store/SKILL.md → seitu/references/create-store.md} +2 -15
- package/skills/{create-subscription/SKILL.md → seitu/references/create-subscription.md} +2 -14
- package/skills/{create-throttled-fn/SKILL.md → seitu/references/create-throttled-fn.md} +2 -15
- package/skills/{create-throttled/SKILL.md → seitu/references/create-throttled.md} +2 -15
- package/skills/{create-web-storage-value/SKILL.md → seitu/references/create-web-storage-value.md} +2 -15
- package/skills/{create-web-storage/SKILL.md → seitu/references/create-web-storage.md} +3 -17
- package/skills/{use-subscription-react/SKILL.md → seitu/references/react.md} +53 -24
- package/skills/{use-subscription-solid/SKILL.md → seitu/references/solid.md} +54 -26
- package/skills/{use-subscription-svelte/SKILL.md → seitu/references/svelte.md} +8 -20
- package/skills/{use-subscription-vue/SKILL.md → seitu/references/vue.md} +9 -20
- package/skills/seitu-overview/SKILL.md +9 -7
- package/skills/subscription-react/SKILL.md +0 -96
- package/skills/subscription-solid/SKILL.md +0 -97
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "seitu",
|
|
3
3
|
"displayName": "Seitu",
|
|
4
4
|
"type": "module",
|
|
5
|
-
"version": "0.16.
|
|
5
|
+
"version": "0.16.1",
|
|
6
6
|
"private": false,
|
|
7
7
|
"author": "Valerii Strilets",
|
|
8
8
|
"license": "MIT",
|
|
@@ -100,23 +100,23 @@
|
|
|
100
100
|
"devDependencies": {
|
|
101
101
|
"@solidjs/testing-library": "^0.8.10",
|
|
102
102
|
"@standard-schema/spec": "^1.1.0",
|
|
103
|
-
"@tanstack/intent": "^0.
|
|
103
|
+
"@tanstack/intent": "^0.3.2",
|
|
104
104
|
"@testing-library/jest-dom": "^6.9.1",
|
|
105
105
|
"@testing-library/react": "^16.3.2",
|
|
106
106
|
"@types/react": "^19.2.17",
|
|
107
|
-
"@vitejs/plugin-react": "^6.0.
|
|
107
|
+
"@vitejs/plugin-react": "^6.0.3",
|
|
108
108
|
"fake-indexeddb": "^6.2.5",
|
|
109
|
-
"happy-dom": "^20.10.
|
|
109
|
+
"happy-dom": "^20.10.6",
|
|
110
110
|
"react-dom": "^19.2.7",
|
|
111
111
|
"solid-js": "^1.9.13",
|
|
112
|
-
"svelte": "^5.56.
|
|
113
|
-
"tsdown": "^0.22.
|
|
112
|
+
"svelte": "^5.56.4",
|
|
113
|
+
"tsdown": "^0.22.3",
|
|
114
114
|
"type-fest": "^5.7.0",
|
|
115
115
|
"typescript": "^6.0.3",
|
|
116
|
-
"vite": "^8.
|
|
116
|
+
"vite": "^8.1.2",
|
|
117
117
|
"vite-plugin-solid": "^2.11.12",
|
|
118
|
-
"vitest": "^4.1.
|
|
119
|
-
"vue": "^3.5.
|
|
118
|
+
"vitest": "^4.1.9",
|
|
119
|
+
"vue": "^3.5.39",
|
|
120
120
|
"yaml": "^2.9.0",
|
|
121
121
|
"zod": "^4.4.3"
|
|
122
122
|
},
|
package/skills/README.md
CHANGED
|
@@ -19,7 +19,7 @@ List or load a specific skill:
|
|
|
19
19
|
|
|
20
20
|
```bash
|
|
21
21
|
pnpm dlx @tanstack/intent@latest list
|
|
22
|
-
pnpm dlx @tanstack/intent@latest load seitu#
|
|
22
|
+
pnpm dlx @tanstack/intent@latest load seitu#seitu
|
|
23
23
|
```
|
|
24
24
|
|
|
25
25
|
When you `pnpm update seitu`, skills update with the package — knowledge travels through npm, not model training cutoffs.
|
|
@@ -28,68 +28,45 @@ Start with **`seitu-overview`** — module map, mental model, and decision tree.
|
|
|
28
28
|
|
|
29
29
|
## Manual install (Cursor)
|
|
30
30
|
|
|
31
|
-
Copy skill folders into `.
|
|
31
|
+
Copy skill folders into `.agents/skills/`:
|
|
32
32
|
|
|
33
33
|
```bash
|
|
34
|
-
cp -r node_modules/seitu/skills/seitu-overview .
|
|
35
|
-
cp -r node_modules/seitu/skills/
|
|
34
|
+
cp -r node_modules/seitu/skills/seitu-overview .agents/skills/
|
|
35
|
+
cp -r node_modules/seitu/skills/seitu .agents/skills/
|
|
36
36
|
```
|
|
37
37
|
|
|
38
38
|
Restart Cursor or start a new agent chat so skills are picked up.
|
|
39
39
|
|
|
40
40
|
## Skills
|
|
41
41
|
|
|
42
|
-
### Core (`seitu`)
|
|
43
|
-
|
|
44
|
-
| Skill | Intent id | When to use |
|
|
45
|
-
|-------|-----------|-------------|
|
|
46
|
-
| [seitu-overview](./seitu-overview/SKILL.md) | `seitu#seitu-overview` | Read first — module map and primitive selection |
|
|
47
|
-
| [create-store](./create-store/SKILL.md) | `seitu#create-store` | Simple in-memory reactive state |
|
|
48
|
-
| [create-schema-store](./create-schema-store/SKILL.md) | `seitu#create-schema-store` | Schema-validated state (Zod, Valibot, ArkType) |
|
|
49
|
-
| [create-computed](./create-computed/SKILL.md) | `seitu#create-computed` | Derived read-only values |
|
|
50
|
-
| [create-debounced](./create-debounced/SKILL.md) | `seitu#create-debounced` | Debounce subscribable updates |
|
|
51
|
-
| [create-throttled](./create-throttled/SKILL.md) | `seitu#create-throttled` | Throttle subscribable updates |
|
|
52
|
-
| [create-debounced-fn](./create-debounced-fn/SKILL.md) | `seitu#create-debounced-fn` | Debounced function with reactive result |
|
|
53
|
-
| [create-throttled-fn](./create-throttled-fn/SKILL.md) | `seitu#create-throttled-fn` | Throttled function with reactive result |
|
|
54
|
-
| [create-subscription](./create-subscription/SKILL.md) | `seitu#create-subscription` | Low-level subscribe/notify |
|
|
55
|
-
| [create-readable-subscription](./create-readable-subscription/SKILL.md) | `seitu#create-readable-subscription` | Compose standard Readable & Subscribable |
|
|
56
|
-
|
|
57
|
-
### Web (`seitu/web`)
|
|
58
|
-
|
|
59
|
-
| Skill | Intent id | When to use |
|
|
60
|
-
|-------|-----------|-------------|
|
|
61
|
-
| [create-web-storage-value](./create-web-storage-value/SKILL.md) | `seitu#create-web-storage-value` | Single-key localStorage / sessionStorage |
|
|
62
|
-
| [create-web-storage](./create-web-storage/SKILL.md) | `seitu#create-web-storage` | Multi-key web storage |
|
|
63
|
-
| [create-indexed-db-storage](./create-indexed-db-storage/SKILL.md) | `seitu#create-indexed-db-storage` | Large or async IndexedDB state |
|
|
64
|
-
| [create-media-query](./create-media-query/SKILL.md) | `seitu#create-media-query` | Reactive CSS media queries |
|
|
65
|
-
| [create-is-online](./create-is-online/SKILL.md) | `seitu#create-is-online` | Online / offline status |
|
|
66
|
-
| [create-scroll-state](./create-scroll-state/SKILL.md) | `seitu#create-scroll-state` | Scroll position and edges |
|
|
67
|
-
|
|
68
|
-
### React (`seitu/react`)
|
|
69
|
-
|
|
70
|
-
| Skill | Intent id | When to use |
|
|
71
|
-
|-------|-----------|-------------|
|
|
72
|
-
| [use-subscription-react](./use-subscription-react/SKILL.md) | `seitu#use-subscription-react` | Hook for any Seitu primitive |
|
|
73
|
-
| [subscription-react](./subscription-react/SKILL.md) | `seitu#subscription-react` | Render-prop component |
|
|
74
|
-
|
|
75
|
-
### Vue (`seitu/vue`)
|
|
76
|
-
|
|
77
|
-
| Skill | Intent id | When to use |
|
|
78
|
-
|-------|-----------|-------------|
|
|
79
|
-
| [use-subscription-vue](./use-subscription-vue/SKILL.md) | `seitu#use-subscription-vue` | Composable for any Seitu primitive |
|
|
80
|
-
|
|
81
|
-
### Solid (`seitu/solid`)
|
|
82
|
-
|
|
83
|
-
| Skill | Intent id | When to use |
|
|
84
|
-
|-------|-----------|-------------|
|
|
85
|
-
| [use-subscription-solid](./use-subscription-solid/SKILL.md) | `seitu#use-subscription-solid` | Primitive returning an accessor for any Seitu primitive |
|
|
86
|
-
| [subscription-solid](./subscription-solid/SKILL.md) | `seitu#subscription-solid` | Render-prop component |
|
|
87
|
-
|
|
88
|
-
### Svelte (`seitu/svelte`)
|
|
89
|
-
|
|
90
42
|
| Skill | Intent id | When to use |
|
|
91
43
|
|-------|-----------|-------------|
|
|
92
|
-
| [
|
|
44
|
+
| [seitu-overview](./seitu-overview/SKILL.md) | `seitu#seitu-overview` | Read first — module map, mental model, decision tree |
|
|
45
|
+
| [seitu](./seitu/SKILL.md) | `seitu#seitu` | Everything past the overview: per-primitive API and framework bindings, routed through reference files |
|
|
46
|
+
|
|
47
|
+
### `seitu` reference files
|
|
48
|
+
|
|
49
|
+
| Reference | Covers |
|
|
50
|
+
|-----------|--------|
|
|
51
|
+
| [create-store.md](./seitu/references/create-store.md) | Simple in-memory reactive state |
|
|
52
|
+
| [create-schema-store.md](./seitu/references/create-schema-store.md) | Schema-validated state (Zod, Valibot, ArkType) |
|
|
53
|
+
| [create-computed.md](./seitu/references/create-computed.md) | Derived read-only values |
|
|
54
|
+
| [create-debounced.md](./seitu/references/create-debounced.md) | Debounce subscribable updates |
|
|
55
|
+
| [create-throttled.md](./seitu/references/create-throttled.md) | Throttle subscribable updates |
|
|
56
|
+
| [create-debounced-fn.md](./seitu/references/create-debounced-fn.md) | Debounced function with reactive result |
|
|
57
|
+
| [create-throttled-fn.md](./seitu/references/create-throttled-fn.md) | Throttled function with reactive result |
|
|
58
|
+
| [create-subscription.md](./seitu/references/create-subscription.md) | Low-level subscribe/notify |
|
|
59
|
+
| [create-readable-subscription.md](./seitu/references/create-readable-subscription.md) | Compose standard Readable & Subscribable |
|
|
60
|
+
| [create-web-storage-value.md](./seitu/references/create-web-storage-value.md) | Single-key localStorage / sessionStorage |
|
|
61
|
+
| [create-web-storage.md](./seitu/references/create-web-storage.md) | Multi-key web storage |
|
|
62
|
+
| [create-indexed-db-storage.md](./seitu/references/create-indexed-db-storage.md) | Large or async IndexedDB state |
|
|
63
|
+
| [create-media-query.md](./seitu/references/create-media-query.md) | Reactive CSS media queries |
|
|
64
|
+
| [create-is-online.md](./seitu/references/create-is-online.md) | Online / offline status |
|
|
65
|
+
| [create-scroll-state.md](./seitu/references/create-scroll-state.md) | Scroll position and edges |
|
|
66
|
+
| [react.md](./seitu/references/react.md) | `useSubscription` hook + `Subscription` component |
|
|
67
|
+
| [vue.md](./seitu/references/vue.md) | `useSubscription` composable |
|
|
68
|
+
| [solid.md](./seitu/references/solid.md) | `useSubscription` primitive + `Subscription` component |
|
|
69
|
+
| [svelte.md](./seitu/references/svelte.md) | `useSubscription` binding |
|
|
93
70
|
|
|
94
71
|
## Registry and version history
|
|
95
72
|
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: seitu
|
|
3
|
+
description: >-
|
|
4
|
+
Per-primitive API for Seitu: createStore, createComputed, createSchemaStore,
|
|
5
|
+
createSubscription/createReadableSubscription, createDebounced(Fn),
|
|
6
|
+
createThrottled(Fn), createWebStorage(Value), createIndexedDbStorage,
|
|
7
|
+
createMediaQuery, createIsOnline, createScrollState, and the React, Vue,
|
|
8
|
+
Solid, and Svelte useSubscription/Subscription bindings. Use once you know
|
|
9
|
+
which primitive or framework binding you need; read seitu-overview first
|
|
10
|
+
for the mental model and decision tree.
|
|
11
|
+
metadata:
|
|
12
|
+
type: core
|
|
13
|
+
library: seitu
|
|
14
|
+
library_version: "0.16.1"
|
|
15
|
+
requires:
|
|
16
|
+
- seitu-overview
|
|
17
|
+
sources:
|
|
18
|
+
- letstri/seitu:docs/content/docs/core/store.mdx
|
|
19
|
+
- letstri/seitu:docs/content/docs/core/computed.mdx
|
|
20
|
+
- letstri/seitu:docs/content/docs/core/schema-store.mdx
|
|
21
|
+
- letstri/seitu:docs/content/docs/core/debounced.mdx
|
|
22
|
+
- letstri/seitu:docs/content/docs/core/debounced-fn.mdx
|
|
23
|
+
- letstri/seitu:docs/content/docs/core/throttled.mdx
|
|
24
|
+
- letstri/seitu:docs/content/docs/core/throttled-fn.mdx
|
|
25
|
+
- letstri/seitu:docs/content/docs/web/web-storage.mdx
|
|
26
|
+
- letstri/seitu:docs/content/docs/web/web-storage-value.mdx
|
|
27
|
+
- letstri/seitu:docs/content/docs/web/indexed-db-storage.mdx
|
|
28
|
+
- letstri/seitu:docs/content/docs/web/media-query.mdx
|
|
29
|
+
- letstri/seitu:docs/content/docs/web/is-online.mdx
|
|
30
|
+
- letstri/seitu:docs/content/docs/web/scroll-state.mdx
|
|
31
|
+
- letstri/seitu:docs/content/docs/react/hooks.mdx
|
|
32
|
+
- letstri/seitu:docs/content/docs/react/components.mdx
|
|
33
|
+
- letstri/seitu:docs/content/docs/vue/composables.mdx
|
|
34
|
+
- letstri/seitu:docs/content/docs/solid/hooks.mdx
|
|
35
|
+
- letstri/seitu:docs/content/docs/solid/components.mdx
|
|
36
|
+
- letstri/seitu:docs/content/docs/svelte/hooks.mdx
|
|
37
|
+
- letstri/seitu:seitu/src/core/subscription.ts
|
|
38
|
+
---
|
|
39
|
+
|
|
40
|
+
# Seitu — primitives and framework bindings
|
|
41
|
+
|
|
42
|
+
Assumes the mental model from **seitu-overview** (`get`/`subscribe`/`set`, no
|
|
43
|
+
dispatch layer, singleton at module scope). Load the reference file for the
|
|
44
|
+
primitive or framework you need instead of reading everything.
|
|
45
|
+
|
|
46
|
+
## In-memory state
|
|
47
|
+
|
|
48
|
+
| Task | Reference |
|
|
49
|
+
|------|-----------|
|
|
50
|
+
| Minimal store — `get`/`set`/`subscribe` | [references/create-store.md](references/create-store.md) |
|
|
51
|
+
| Schema-validated store with fallback | [references/create-schema-store.md](references/create-schema-store.md) |
|
|
52
|
+
| Derived/computed value from one or many sources | [references/create-computed.md](references/create-computed.md) |
|
|
53
|
+
| Low-level subscribe/notify for custom primitives | [references/create-subscription.md](references/create-subscription.md) |
|
|
54
|
+
| Compose `get` + subscribe/notify into `Readable & Subscribable` | [references/create-readable-subscription.md](references/create-readable-subscription.md) |
|
|
55
|
+
|
|
56
|
+
## Rate limiting
|
|
57
|
+
|
|
58
|
+
| Task | Reference |
|
|
59
|
+
|------|-----------|
|
|
60
|
+
| Debounce a subscribable source | [references/create-debounced.md](references/create-debounced.md) |
|
|
61
|
+
| Debounce a plain function | [references/create-debounced-fn.md](references/create-debounced-fn.md) |
|
|
62
|
+
| Throttle a subscribable source | [references/create-throttled.md](references/create-throttled.md) |
|
|
63
|
+
| Throttle a plain function | [references/create-throttled-fn.md](references/create-throttled-fn.md) |
|
|
64
|
+
|
|
65
|
+
## Browser persistence and DOM state
|
|
66
|
+
|
|
67
|
+
| Task | Reference |
|
|
68
|
+
|------|-----------|
|
|
69
|
+
| Multi-key localStorage/sessionStorage | [references/create-web-storage.md](references/create-web-storage.md) |
|
|
70
|
+
| Single-key localStorage/sessionStorage | [references/create-web-storage-value.md](references/create-web-storage-value.md) |
|
|
71
|
+
| Async IndexedDB persistence | [references/create-indexed-db-storage.md](references/create-indexed-db-storage.md) |
|
|
72
|
+
| CSS media query | [references/create-media-query.md](references/create-media-query.md) |
|
|
73
|
+
| `navigator.onLine` status | [references/create-is-online.md](references/create-is-online.md) |
|
|
74
|
+
| Scroll position / edges of an element | [references/create-scroll-state.md](references/create-scroll-state.md) |
|
|
75
|
+
|
|
76
|
+
## Framework bindings
|
|
77
|
+
|
|
78
|
+
One hook/composable works with **any** Seitu primitive.
|
|
79
|
+
|
|
80
|
+
| Framework | Reference |
|
|
81
|
+
|-----------|-----------|
|
|
82
|
+
| React — `useSubscription` hook, `Subscription` component | [references/react.md](references/react.md) |
|
|
83
|
+
| Vue — `useSubscription` composable | [references/vue.md](references/vue.md) |
|
|
84
|
+
| Solid — `useSubscription` primitive, `Subscription` component | [references/solid.md](references/solid.md) |
|
|
85
|
+
| Svelte — `useSubscription` binding | [references/svelte.md](references/svelte.md) |
|
|
86
|
+
|
|
87
|
+
## Rules that apply everywhere
|
|
88
|
+
|
|
89
|
+
- **Create primitives at module scope, not inside components/render.** A new instance per render loses shared state and re-subscribes every time.
|
|
90
|
+
- **Reference equality gates notification.** `set()` skips notifying subscribers when the new value is `===` the old one — always return a new object/array from updaters.
|
|
91
|
+
- **Framework bindings are optional peer deps and are not interchangeable.** Importing `seitu/react` hooks/components in Vue, Solid, or Svelte code (or vice versa) breaks — use the binding matching the framework you're in.
|
|
92
|
+
- **Web/DOM primitives are SSR-safe by default** (return defaults when `window`/`navigator` is undefined) — safe to create at module level in SSR frameworks. `createMediaQuery` needs `defaultMatches` set explicitly for a correct SSR value.
|
|
@@ -1,17 +1,3 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: create-computed
|
|
3
|
-
description: >-
|
|
4
|
-
Derived read-only subscription from one or many sources.
|
|
5
|
-
type: core
|
|
6
|
-
library: seitu
|
|
7
|
-
library_version: "0.16.0"
|
|
8
|
-
requires:
|
|
9
|
-
- seitu-overview
|
|
10
|
-
sources:
|
|
11
|
-
- letstri/seitu:docs/content/docs/core/computed.mdx
|
|
12
|
-
- letstri/seitu:seitu/src/core/computed.ts
|
|
13
|
-
---
|
|
14
|
-
|
|
15
1
|
# createComputed
|
|
16
2
|
|
|
17
3
|
Derived read-only subscription from one or many sources. Lazy — only subscribes to sources when it has its own subscribers.
|
|
@@ -51,6 +37,7 @@ interface Computed<T> extends Readable<T>, Subscribable<T> {}
|
|
|
51
37
|
```
|
|
52
38
|
|
|
53
39
|
Read-only. No `set()`.
|
|
40
|
+
|
|
54
41
|
## Common Mistakes
|
|
55
42
|
|
|
56
43
|
### [HIGH] Recomputing manually in components
|
|
@@ -105,4 +92,4 @@ Computed is read-only; use the source store's set().
|
|
|
105
92
|
|
|
106
93
|
## Source
|
|
107
94
|
|
|
108
|
-
`src/core/computed.ts`
|
|
95
|
+
`src/core/computed.ts`
|
|
@@ -1,17 +1,3 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: create-debounced-fn
|
|
3
|
-
description: >-
|
|
4
|
-
Debounced callable with reactive return value.
|
|
5
|
-
type: core
|
|
6
|
-
library: seitu
|
|
7
|
-
library_version: "0.16.0"
|
|
8
|
-
requires:
|
|
9
|
-
- seitu-overview
|
|
10
|
-
sources:
|
|
11
|
-
- letstri/seitu:docs/content/docs/core/debounced-fn.mdx
|
|
12
|
-
- letstri/seitu:seitu/src/core/debounced-fn.ts
|
|
13
|
-
---
|
|
14
|
-
|
|
15
1
|
# createDebouncedFn
|
|
16
2
|
|
|
17
3
|
Wraps a plain function. The return value becomes subscribable state. Each call resets the debounce timer.
|
|
@@ -40,6 +26,7 @@ interface DebouncedFn<F> extends Readable<ReturnType<F> | undefined>, Subscribab
|
|
|
40
26
|
```
|
|
41
27
|
|
|
42
28
|
Callable + readable + subscribable. `get()` returns `undefined` until first execution.
|
|
29
|
+
|
|
43
30
|
## Common Mistakes
|
|
44
31
|
|
|
45
32
|
### [HIGH] Using createDebounced on a function
|
|
@@ -92,4 +79,4 @@ DebouncedFn is Subscribable; subscribe or useSubscription to read latest result.
|
|
|
92
79
|
|
|
93
80
|
## Source
|
|
94
81
|
|
|
95
|
-
`src/core/debounced-fn.ts`
|
|
82
|
+
`src/core/debounced-fn.ts`
|
|
@@ -1,17 +1,3 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: create-debounced
|
|
3
|
-
description: >-
|
|
4
|
-
Debounce updates from a source subscribable.
|
|
5
|
-
type: core
|
|
6
|
-
library: seitu
|
|
7
|
-
library_version: "0.16.0"
|
|
8
|
-
requires:
|
|
9
|
-
- seitu-overview
|
|
10
|
-
sources:
|
|
11
|
-
- letstri/seitu:docs/content/docs/core/debounced.mdx
|
|
12
|
-
- letstri/seitu:seitu/src/core/debounced.ts
|
|
13
|
-
---
|
|
14
|
-
|
|
15
1
|
# createDebounced
|
|
16
2
|
|
|
17
3
|
Wraps a source subscribable with debounce. Emits the latest value after `wait` ms of inactivity.
|
|
@@ -38,6 +24,7 @@ interface Debounced<T> extends Readable<T>, Subscribable<T> {}
|
|
|
38
24
|
```
|
|
39
25
|
|
|
40
26
|
Read-only. Lazy subscription — only subscribes to source when it has its own subscribers.
|
|
27
|
+
|
|
41
28
|
## Common Mistakes
|
|
42
29
|
|
|
43
30
|
### [HIGH] Debouncing the source instead of wrapping it
|
|
@@ -91,4 +78,4 @@ Invalid wait breaks timing expectations.
|
|
|
91
78
|
|
|
92
79
|
## Source
|
|
93
80
|
|
|
94
|
-
`src/core/debounced.ts`
|
|
81
|
+
`src/core/debounced.ts`
|
package/skills/{create-indexed-db-storage/SKILL.md → seitu/references/create-indexed-db-storage.md}
RENAMED
|
@@ -1,17 +1,3 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: create-indexed-db-storage
|
|
3
|
-
description: >-
|
|
4
|
-
Async IndexedDB persistence with cached sync reads.
|
|
5
|
-
type: core
|
|
6
|
-
library: seitu
|
|
7
|
-
library_version: "0.16.0"
|
|
8
|
-
requires:
|
|
9
|
-
- seitu-overview
|
|
10
|
-
sources:
|
|
11
|
-
- letstri/seitu:docs/content/docs/web/indexed-db-storage.mdx
|
|
12
|
-
- letstri/seitu:seitu/src/web/indexed-db-storage.ts
|
|
13
|
-
---
|
|
14
|
-
|
|
15
1
|
# createIndexedDbStorage
|
|
16
2
|
|
|
17
3
|
Multi-key reactive handle for IndexedDB. Async under the hood, sync `get()` via in-memory cache.
|
|
@@ -64,6 +50,7 @@ interface IndexedDbStorage<O> extends Subscribable<O>, Readable<O>, Writable<Par
|
|
|
64
50
|
clear: () => Promise<void>
|
|
65
51
|
}
|
|
66
52
|
```
|
|
53
|
+
|
|
67
54
|
## Common Mistakes
|
|
68
55
|
|
|
69
56
|
### [HIGH] Treating set as synchronous
|
|
@@ -118,4 +105,4 @@ Same as WebStorage — keys must be declared in schemas/defaultValues.
|
|
|
118
105
|
|
|
119
106
|
## Source
|
|
120
107
|
|
|
121
|
-
`src/web/indexed-db-storage.ts`
|
|
108
|
+
`src/web/indexed-db-storage.ts`
|
|
@@ -1,17 +1,3 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: create-is-online
|
|
3
|
-
description: >-
|
|
4
|
-
Reactive navigator.onLine status.
|
|
5
|
-
type: core
|
|
6
|
-
library: seitu
|
|
7
|
-
library_version: "0.16.0"
|
|
8
|
-
requires:
|
|
9
|
-
- seitu-overview
|
|
10
|
-
sources:
|
|
11
|
-
- letstri/seitu:docs/content/docs/web/is-online.mdx
|
|
12
|
-
- letstri/seitu:seitu/src/web/is-online.ts
|
|
13
|
-
---
|
|
14
|
-
|
|
15
1
|
# createIsOnline
|
|
16
2
|
|
|
17
3
|
Reactive boolean for `navigator.onLine`. Listens to `online`/`offline` window events.
|
|
@@ -31,6 +17,7 @@ interface IsOnline extends Subscribable<boolean>, Readable<boolean> {}
|
|
|
31
17
|
```
|
|
32
18
|
|
|
33
19
|
No options. Returns `true` during SSR (when `navigator` is undefined). Lazy — only listens to events while subscribed.
|
|
20
|
+
|
|
34
21
|
## Common Mistakes
|
|
35
22
|
|
|
36
23
|
### [MEDIUM] Polling navigator.onLine manually
|
|
@@ -84,4 +71,4 @@ Returns false when offline API unavailable; safe at module scope.
|
|
|
84
71
|
|
|
85
72
|
## Source
|
|
86
73
|
|
|
87
|
-
`src/web/is-online.ts`
|
|
74
|
+
`src/web/is-online.ts`
|
|
@@ -1,17 +1,3 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: create-media-query
|
|
3
|
-
description: >-
|
|
4
|
-
Reactive CSS media query with SSR defaultMatches.
|
|
5
|
-
type: core
|
|
6
|
-
library: seitu
|
|
7
|
-
library_version: "0.16.0"
|
|
8
|
-
requires:
|
|
9
|
-
- seitu-overview
|
|
10
|
-
sources:
|
|
11
|
-
- letstri/seitu:docs/content/docs/web/media-query.mdx
|
|
12
|
-
- letstri/seitu:seitu/src/web/media-query.ts
|
|
13
|
-
---
|
|
14
|
-
|
|
15
1
|
# createMediaQuery
|
|
16
2
|
|
|
17
3
|
Reactive boolean for CSS media queries. Provides type-safe query string with autocomplete for known media features.
|
|
@@ -44,6 +30,7 @@ Read-only. Lazy — listens to `change` events only while subscribed.
|
|
|
44
30
|
## Type-safe queries
|
|
45
31
|
|
|
46
32
|
The `query` option provides autocomplete for standard media features: `min-width`, `max-width`, `prefers-color-scheme`, `orientation`, `hover`, `pointer`, etc. Supports `and`/`,` combinators.
|
|
33
|
+
|
|
47
34
|
## Common Mistakes
|
|
48
35
|
|
|
49
36
|
### [CRITICAL] Missing defaultMatches for SSR
|
|
@@ -98,4 +85,4 @@ New matchMedia listener per render; use module-level singleton.
|
|
|
98
85
|
|
|
99
86
|
## Source
|
|
100
87
|
|
|
101
|
-
`src/web/media-query.ts`
|
|
88
|
+
`src/web/media-query.ts`
|
|
@@ -1,17 +1,3 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: create-readable-subscription
|
|
3
|
-
description: >-
|
|
4
|
-
Compose get + subscribe + notify into standard Readable & Subscribable.
|
|
5
|
-
type: core
|
|
6
|
-
library: seitu
|
|
7
|
-
library_version: "0.16.0"
|
|
8
|
-
requires:
|
|
9
|
-
- seitu-overview
|
|
10
|
-
- create-subscription
|
|
11
|
-
sources:
|
|
12
|
-
- letstri/seitu:seitu/src/core/subscription.ts
|
|
13
|
-
---
|
|
14
|
-
|
|
15
1
|
# createReadableSubscription
|
|
16
2
|
|
|
17
3
|
Composes a `get` function with a `subscribe`/`notify` pair into a `Readable<T> & Subscribable<T>` object. Used internally by all Seitu primitives.
|
|
@@ -45,6 +31,7 @@ An object with:
|
|
|
45
31
|
- `subscribe(cb, opts?)` — subscribes; callback receives `get()` result
|
|
46
32
|
- `~.notify` — internal notify reference
|
|
47
33
|
- `~.output` — type-level output marker
|
|
34
|
+
|
|
48
35
|
## Common Mistakes
|
|
49
36
|
|
|
50
37
|
### [HIGH] Mismatched get and notify timing
|
|
@@ -97,4 +84,4 @@ Readable subscription has no set — use createStore or compose Writable separat
|
|
|
97
84
|
|
|
98
85
|
## Source
|
|
99
86
|
|
|
100
|
-
`src/core/subscription.ts`
|
|
87
|
+
`src/core/subscription.ts`
|
|
@@ -1,17 +1,3 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: create-schema-store
|
|
3
|
-
description: >-
|
|
4
|
-
Standard Schema validated store with default fallback on invalid data.
|
|
5
|
-
type: core
|
|
6
|
-
library: seitu
|
|
7
|
-
library_version: "0.16.0"
|
|
8
|
-
requires:
|
|
9
|
-
- seitu-overview
|
|
10
|
-
sources:
|
|
11
|
-
- letstri/seitu:docs/content/docs/core/schema-store.mdx
|
|
12
|
-
- letstri/seitu:seitu/src/core/schema-store.ts
|
|
13
|
-
---
|
|
14
|
-
|
|
15
1
|
# createSchemaStore
|
|
16
2
|
|
|
17
3
|
Store validated by a Standard Schema. Falls back to `defaultValue` when validation fails.
|
|
@@ -43,6 +29,7 @@ store.subscribe(console.log)
|
|
|
43
29
|
```ts
|
|
44
30
|
interface SchemaStore<O> extends Subscribable<O>, Readable<O>, Writable<O, O> {}
|
|
45
31
|
```
|
|
32
|
+
|
|
46
33
|
## Common Mistakes
|
|
47
34
|
|
|
48
35
|
### [HIGH] Partial set without merge
|
|
@@ -95,4 +82,4 @@ Without a handler, invalid data silently falls back to defaultValue.
|
|
|
95
82
|
|
|
96
83
|
## Source
|
|
97
84
|
|
|
98
|
-
`src/core/schema-store.ts`
|
|
85
|
+
`src/core/schema-store.ts`
|
|
@@ -1,17 +1,3 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: create-scroll-state
|
|
3
|
-
description: >-
|
|
4
|
-
Scroll position, edges, and remaining distance for an element.
|
|
5
|
-
type: core
|
|
6
|
-
library: seitu
|
|
7
|
-
library_version: "0.16.0"
|
|
8
|
-
requires:
|
|
9
|
-
- seitu-overview
|
|
10
|
-
sources:
|
|
11
|
-
- letstri/seitu:docs/content/docs/web/scroll-state.mdx
|
|
12
|
-
- letstri/seitu:seitu/src/web/scroll-state.ts
|
|
13
|
-
---
|
|
14
|
-
|
|
15
1
|
# createScrollState
|
|
16
2
|
|
|
17
3
|
Reactive scroll position tracking for an element. Reports per-edge `reached` and `remaining` values.
|
|
@@ -64,6 +50,7 @@ const state = useSubscription(() =>
|
|
|
64
50
|
createScrollState({ element: () => ref.current, direction: 'vertical' })
|
|
65
51
|
)
|
|
66
52
|
```
|
|
53
|
+
|
|
67
54
|
## Common Mistakes
|
|
68
55
|
|
|
69
56
|
### [CRITICAL] Passing static element ref
|
|
@@ -116,4 +103,4 @@ Factory pattern in useSubscription recreates when element changes.
|
|
|
116
103
|
|
|
117
104
|
## Source
|
|
118
105
|
|
|
119
|
-
`src/web/scroll-state.ts`
|
|
106
|
+
`src/web/scroll-state.ts`
|
|
@@ -1,17 +1,3 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: create-store
|
|
3
|
-
description: >-
|
|
4
|
-
Minimal in-memory reactive store with get, set, and subscribe.
|
|
5
|
-
type: core
|
|
6
|
-
library: seitu
|
|
7
|
-
library_version: "0.16.0"
|
|
8
|
-
requires:
|
|
9
|
-
- seitu-overview
|
|
10
|
-
sources:
|
|
11
|
-
- letstri/seitu:docs/content/docs/core/store.mdx
|
|
12
|
-
- letstri/seitu:seitu/src/core/store.ts
|
|
13
|
-
---
|
|
14
|
-
|
|
15
1
|
# createStore
|
|
16
2
|
|
|
17
3
|
Minimal reactive store from `seitu` (core). Accepts any value type.
|
|
@@ -49,6 +35,7 @@ interface Store<T> extends Readable<T>, Writable<T, T>, Subscribable<T> {}
|
|
|
49
35
|
| `subscribe(cb, opts?)` | Subscribes to changes; returns unsubscribe fn |
|
|
50
36
|
|
|
51
37
|
`subscribe` accepts `{ immediate?: boolean }` to fire callback immediately with current value.
|
|
38
|
+
|
|
52
39
|
## Common Mistakes
|
|
53
40
|
|
|
54
41
|
### [CRITICAL] Mutating object state in place
|
|
@@ -106,4 +93,4 @@ Reference equality is the notification gate; stringify adds cost without fixing
|
|
|
106
93
|
|
|
107
94
|
## Source
|
|
108
95
|
|
|
109
|
-
`src/core/store.ts`
|
|
96
|
+
`src/core/store.ts`
|
|
@@ -1,16 +1,3 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: create-subscription
|
|
3
|
-
description: >-
|
|
4
|
-
Low-level subscribe/notify for custom primitives.
|
|
5
|
-
type: core
|
|
6
|
-
library: seitu
|
|
7
|
-
library_version: "0.16.0"
|
|
8
|
-
requires:
|
|
9
|
-
- seitu-overview
|
|
10
|
-
sources:
|
|
11
|
-
- letstri/seitu:seitu/src/core/subscription.ts
|
|
12
|
-
---
|
|
13
|
-
|
|
14
1
|
# createSubscription
|
|
15
2
|
|
|
16
3
|
Low-level building block. Returns `subscribe` + `notify` pair. Used internally by all Seitu primitives.
|
|
@@ -47,6 +34,7 @@ function createSubscription(options?: {
|
|
|
47
34
|
- Return value of `onFirstSubscribe` is called when last subscriber is removed (cleanup).
|
|
48
35
|
- `subscribe` supports `{ immediate: true }` to fire callback immediately.
|
|
49
36
|
- Lazy: no setup until first subscriber.
|
|
37
|
+
|
|
50
38
|
## Common Mistakes
|
|
51
39
|
|
|
52
40
|
### [HIGH] Not returning unsubscribe from subscribe
|
|
@@ -99,4 +87,4 @@ createReadableSubscription composes get + subscribe + notify correctly.
|
|
|
99
87
|
|
|
100
88
|
## Source
|
|
101
89
|
|
|
102
|
-
`src/core/subscription.ts`
|
|
90
|
+
`src/core/subscription.ts`
|
|
@@ -1,17 +1,3 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: create-throttled-fn
|
|
3
|
-
description: >-
|
|
4
|
-
Throttled callable with reactive return value.
|
|
5
|
-
type: core
|
|
6
|
-
library: seitu
|
|
7
|
-
library_version: "0.16.0"
|
|
8
|
-
requires:
|
|
9
|
-
- seitu-overview
|
|
10
|
-
sources:
|
|
11
|
-
- letstri/seitu:docs/content/docs/core/throttled-fn.mdx
|
|
12
|
-
- letstri/seitu:seitu/src/core/throttled-fn.ts
|
|
13
|
-
---
|
|
14
|
-
|
|
15
1
|
# createThrottledFn
|
|
16
2
|
|
|
17
3
|
Wraps a plain function. First call fires immediately, subsequent calls within `wait` are batched — only the last fires when interval elapses.
|
|
@@ -41,6 +27,7 @@ interface ThrottledFn<F> extends Readable<ReturnType<F> | undefined>, Subscribab
|
|
|
41
27
|
```
|
|
42
28
|
|
|
43
29
|
Callable + readable + subscribable. `get()` returns `undefined` until first execution.
|
|
30
|
+
|
|
44
31
|
## Common Mistakes
|
|
45
32
|
|
|
46
33
|
### [HIGH] Using createThrottled on a function
|
|
@@ -93,4 +80,4 @@ Throttled fn closure captures variables; update via args not closure mutation.
|
|
|
93
80
|
|
|
94
81
|
## Source
|
|
95
82
|
|
|
96
|
-
`src/core/throttled-fn.ts`
|
|
83
|
+
`src/core/throttled-fn.ts`
|
|
@@ -1,17 +1,3 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: create-throttled
|
|
3
|
-
description: >-
|
|
4
|
-
Throttle updates from a source subscribable.
|
|
5
|
-
type: core
|
|
6
|
-
library: seitu
|
|
7
|
-
library_version: "0.16.0"
|
|
8
|
-
requires:
|
|
9
|
-
- seitu-overview
|
|
10
|
-
sources:
|
|
11
|
-
- letstri/seitu:docs/content/docs/core/throttled.mdx
|
|
12
|
-
- letstri/seitu:seitu/src/core/throttled.ts
|
|
13
|
-
---
|
|
14
|
-
|
|
15
1
|
# createThrottled
|
|
16
2
|
|
|
17
3
|
Wraps a source subscribable with throttle. Emits at most once every `wait` ms. First update fires immediately, trailing update fires after interval.
|
|
@@ -38,6 +24,7 @@ interface Throttled<T> extends Readable<T>, Subscribable<T> {}
|
|
|
38
24
|
```
|
|
39
25
|
|
|
40
26
|
Read-only. Lazy subscription.
|
|
27
|
+
|
|
41
28
|
## Common Mistakes
|
|
42
29
|
|
|
43
30
|
### [MEDIUM] Using debounce for scroll-like high-frequency events
|
|
@@ -90,4 +77,4 @@ Resets internal timer state.
|
|
|
90
77
|
|
|
91
78
|
## Source
|
|
92
79
|
|
|
93
|
-
`src/core/throttled.ts`
|
|
80
|
+
`src/core/throttled.ts`
|