@mindees/atlas 0.12.0 โ 0.14.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/hooks.d.ts +32 -2
- package/dist/hooks.d.ts.map +1 -1
- package/dist/hooks.js +74 -1
- package/dist/hooks.js.map +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -6,10 +6,13 @@ The Atlas component library โ MindeesNative's batteries-included UI primitives
|
|
|
6
6
|
> separate, pre-existing React Native + Expo UI kit on npm. Atlas is this
|
|
7
7
|
> framework's own component library.
|
|
8
8
|
|
|
9
|
-
> Status: ๐งช **Experimental** โ
|
|
10
|
-
> accessible, signals-native UI primitives,
|
|
11
|
-
>
|
|
12
|
-
>
|
|
9
|
+
> Status: ๐งช **Experimental** (pre-1.0) โ v0.13.0. A 27+ component library plus 12+
|
|
10
|
+
> hooks: accessible, signals-native UI primitives, design-token theming with dark
|
|
11
|
+
> mode, a full-screen portal/overlay layer, a virtualized recycling `List`, a
|
|
12
|
+
> gesture system, an animation engine, and an animated stack navigator over the
|
|
13
|
+
> Quantum router. Web rendering is real through the Helix DOM backend; the **same**
|
|
14
|
+
> serializable tree now renders + is interactive on a real Android emulator
|
|
15
|
+
> (QuickJS bridge) and a real iOS simulator (JavaScriptCore bridge), all CI-verified.
|
|
13
16
|
> See the repository [STATUS.md](../../STATUS.md).
|
|
14
17
|
|
|
15
18
|
## What works today
|
|
@@ -17,17 +20,39 @@ The Atlas component library โ MindeesNative's batteries-included UI primitives
|
|
|
17
20
|
- **Primitives** โ `View`, `Text`, `Image`, `TextInput`, `Pressable`, `Button`,
|
|
18
21
|
`Stack`, `Row`, `Column`, `Spacer`, and `ScrollView` return renderer-agnostic
|
|
19
22
|
`MindeesNode` trees over `@mindees/core` `createElement`.
|
|
23
|
+
- **Components (27+)** โ beyond the primitives: `Card`, `Switch`, `Badge`, `Avatar`,
|
|
24
|
+
`Chip`, `Divider`, `ProgressBar`, `ActivityIndicator`, `SafeAreaView`,
|
|
25
|
+
`KeyboardAvoidingView`, `Checkbox`, `RadioGroup`, `Skeleton`, `Tabs`, `Accordion`,
|
|
26
|
+
`Stepper`, and `SegmentedControl` โ all accessible and signals-native.
|
|
27
|
+
- **Overlays** โ `@mindees/atlas` exports `Modal`, `Toast`, and `FocusScope`; these
|
|
28
|
+
render into a full-screen portal layer that overlaps the app (web today; the native
|
|
29
|
+
hosts have a matching overlay layer).
|
|
30
|
+
- **Hooks (12+)** โ state/effect hooks `useToggle`, `useCounter`, `usePrevious`,
|
|
31
|
+
`useReducer`, `useAsync`, `usePersistentSignal`, `useDebounce`, `useInterval`,
|
|
32
|
+
`useTimeout`, plus `useForm` and the device hooks `useWindowDimensions`,
|
|
33
|
+
`useColorScheme`, `useSafeAreaInsets`, and `useKeyboard` (RN-parity environment).
|
|
20
34
|
- **Styling** โ `StyleObject`, `StyleInput`, and `flattenStyle` normalize a curated
|
|
21
35
|
cross-platform style subset; numeric web styles lower to `px` through the renderer.
|
|
22
36
|
- **Accessibility** โ typed `role` / `aria-*` helpers lower into host props, and
|
|
23
37
|
`Image` requires a `label` unless explicitly marked decorative.
|
|
24
38
|
- **Interaction** โ `Pressable` and `usePressable` use real DOM events on web
|
|
25
39
|
(`click`, pointer, focus, Enter, Space), with reactive hover/press/focus state.
|
|
26
|
-
- **
|
|
27
|
-
`
|
|
40
|
+
- **Gestures + motion** โ `GestureView` attaches pan/press gestures; `motion` /
|
|
41
|
+
`animateTo` drive spring/interpolated animations on the same scene.
|
|
42
|
+
- **Theming** โ design tokens in two tiers: primitive scales (`space`, `radius`,
|
|
43
|
+
`fontSize`, `palette`, โฆ) and semantic `tokens`/`Theme` (`bg`/`surface`/`text`/
|
|
44
|
+
`primary`/โฆ). `useTheme` returns a reactive theme driven by `useColorScheme`, so
|
|
45
|
+
**dark mode** is a fine-grained token-set swap โ only the color nodes update. The
|
|
46
|
+
`@mindees/atlas/theme` subpath additionally exports a structural `createTheme()`
|
|
47
|
+
with `@mindees/core` selector isolation.
|
|
28
48
|
- **List** โ `@mindees/atlas/list` exports `List`, `createList`, and `computeWindow`.
|
|
29
49
|
It renders a fixed pool of recycled row regions for fixed-height virtualization;
|
|
30
50
|
variable-height measurement is a ๐ฌ research track.
|
|
51
|
+
- **Keyed iteration** โ `@mindees/atlas/for` exports `For`, a keyed region for
|
|
52
|
+
efficient list reconciliation (reused/disposed by key).
|
|
53
|
+
- **Stack navigator** โ `@mindees/atlas/stack` exports `createStackNavigator`, an
|
|
54
|
+
animated stack over the Quantum router: push slides/fades a screen in, an edge
|
|
55
|
+
swipe-back gesture drives the pop interactively, and surviving screens keep state.
|
|
31
56
|
|
|
32
57
|
## Quick start
|
|
33
58
|
|
|
@@ -42,7 +67,7 @@ const primary = theme.select((tokens) => tokens.colors.primary)
|
|
|
42
67
|
export const Screen = Column({
|
|
43
68
|
gap: 12,
|
|
44
69
|
children: [
|
|
45
|
-
Text({ children: 'Atlas
|
|
70
|
+
Text({ children: 'One Atlas tree โ web, Android, and iOS.' }),
|
|
46
71
|
Button({ title: 'Save', style: () => ({ backgroundColor: primary(), padding: 12 }) }),
|
|
47
72
|
List({
|
|
48
73
|
items: ['One', 'Two', 'Three'],
|
package/dist/hooks.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Accessor } from "@mindees/core";
|
|
1
|
+
import { Accessor, Signal } from "@mindees/core";
|
|
2
2
|
|
|
3
3
|
//#region src/hooks.d.ts
|
|
4
4
|
/** A boolean toggle (RN/React: bring-your-own). */
|
|
@@ -58,6 +58,36 @@ interface AsyncState<T> {
|
|
|
58
58
|
declare function useAsync<T>(fetcher: () => Promise<T>, options?: {
|
|
59
59
|
immediate?: boolean;
|
|
60
60
|
}): AsyncState<T>;
|
|
61
|
+
/** The minimal key/value store {@link usePersistentSignal} reads/writes (a Web Storage subset). */
|
|
62
|
+
interface SignalStorage {
|
|
63
|
+
getItem(key: string): string | null;
|
|
64
|
+
setItem(key: string, value: string): void;
|
|
65
|
+
}
|
|
66
|
+
/** Options for {@link usePersistentSignal}. */
|
|
67
|
+
interface PersistentSignalOptions<T> {
|
|
68
|
+
/** Where to persist. Defaults to `localStorage` on web; degrades to in-memory elsewhere (no-op). */
|
|
69
|
+
readonly storage?: SignalStorage;
|
|
70
|
+
/** Serialize before saving (default `JSON.stringify`). */
|
|
71
|
+
readonly serialize?: (value: T) => string;
|
|
72
|
+
/** Parse on restore (default `JSON.parse`). */
|
|
73
|
+
readonly deserialize?: (raw: string) => T;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* A signal that restores its initial value from a key/value store and auto-saves on every change โ
|
|
77
|
+
* persist theme/prefs/UI state with one call. On web it uses `localStorage` by default; inject a
|
|
78
|
+
* `storage` (e.g. a Continuum-backed one) for native. A corrupt/unparseable stored value falls back
|
|
79
|
+
* to `initial`; storage errors (quota/SSR) are swallowed so the signal always works.
|
|
80
|
+
*/
|
|
81
|
+
declare function usePersistentSignal<T>(key: string, initial: T, options?: PersistentSignalOptions<T>): Signal<T>;
|
|
82
|
+
/**
|
|
83
|
+
* A debounced view of `source`: it follows `source` but only after the source has stopped changing
|
|
84
|
+
* for `ms` (e.g. a search box that queries after typing settles). Rapid changes coalesce to the last.
|
|
85
|
+
*/
|
|
86
|
+
declare function useDebounce<T>(source: Accessor<T>, ms: number): Accessor<T>;
|
|
87
|
+
/** Run `callback` every `ms` while the owner is alive; pass `null` to pause. Cleared on dispose. */
|
|
88
|
+
declare function useInterval(callback: () => void, ms: number | null): void;
|
|
89
|
+
/** Run `callback` once after `ms`; pass `null` to cancel. Cleared on dispose before it fires. */
|
|
90
|
+
declare function useTimeout(callback: () => void, ms: number | null): void;
|
|
61
91
|
//#endregion
|
|
62
|
-
export { AsyncState, Counter, Toggle, useAsync, useCounter, usePrevious, useReducer, useToggle };
|
|
92
|
+
export { AsyncState, Counter, PersistentSignalOptions, SignalStorage, Toggle, useAsync, useCounter, useDebounce, useInterval, usePersistentSignal, usePrevious, useReducer, useTimeout, useToggle };
|
|
63
93
|
//# sourceMappingURL=hooks.d.ts.map
|
package/dist/hooks.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hooks.d.ts","names":[],"sources":["../src/hooks.ts"],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"hooks.d.ts","names":[],"sources":["../src/hooks.ts"],"mappings":";;;;UAqBiB,MAAA;EAUf;EAAA,SARS,KAAA,EAAO,QAAQ;EAQN;EANlB,MAAA;EAUc;EARd,EAAA;;EAEA,GAAA;EAMgD;EAJhD,GAAA,CAAI,KAAA;AAAA;;iBAIU,SAAA,CAAU,OAAA,aAAkB,MAAM;;UAYjC,OAAA;EAIf;EAAA,SAFS,KAAA,EAAO,QAAQ;EAIxB;EAFA,GAAA,CAAI,EAAA;EAIJ;EAFA,GAAA,CAAI,EAAA;EAIJ;EAFA,GAAA,CAAI,KAAA;EAEC;EAAL,KAAA;AAAA;;iBAIc,UAAA,CACd,OAAA,WACA,OAAA;EAAW,GAAA;EAAc,GAAA;EAAc,IAAA;AAAA,IACtC,OAAO;;iBAgBM,WAAA,IAAe,MAAA,EAAQ,QAAA,CAAS,CAAA,IAAK,QAAA,CAAS,CAAA;;iBAgB9C,UAAA,OACd,OAAA,GAAU,KAAA,EAAO,CAAA,EAAG,MAAA,EAAQ,CAAA,KAAM,CAAA,EAClC,OAAA,EAAS,CAAA,IACP,QAAA,CAAS,CAAA,IAAK,MAAA,EAAQ,CAAA;AAnB1B;AAAA,UAyBiB,UAAA;EAzBU;EAAA,SA2BhB,IAAA,EAAM,QAAA,CAAS,CAAA;EA3Ba;EAAA,SA6B5B,KAAA,EAAO,QAAA;EA7BmC;EAAA,SA+B1C,OAAA,EAAS,QAAA;EA/ByC;EAiC3D,GAAA;AAAA;;;;;;iBAQc,QAAA,IACd,OAAA,QAAe,OAAA,CAAQ,CAAA,GACvB,OAAA;EAAW,SAAA;AAAA,IACV,UAAA,CAAW,CAAA;;UAoCG,aAAA;EACf,OAAA,CAAQ,GAAA;EACR,OAAA,CAAQ,GAAA,UAAa,KAAA;AAAA;;UAIN,uBAAA;EAnES;EAAA,SAqEf,OAAA,GAAU,aAAA;EArEM;EAAA,SAuEhB,SAAA,IAAa,KAAA,EAAO,CAAA;EA1ED;EAAA,SA4EnB,WAAA,IAAe,GAAA,aAAgB,CAAA;AAAA;;;;;;;iBAgB1B,mBAAA,IACd,GAAA,UACA,OAAA,EAAS,CAAA,EACT,OAAA,GAAS,uBAAA,CAAwB,CAAA,IAChC,MAAA,CAAO,CAAA;;;;;iBAoCM,WAAA,IAAe,MAAA,EAAQ,QAAA,CAAS,CAAA,GAAI,EAAA,WAAa,QAAA,CAAS,CAAA;AA3H1E;AAAA,iBA0IgB,WAAA,CAAY,QAAA,cAAsB,EAAiB;;iBASnD,UAAA,CAAW,QAAA,cAAsB,EAAiB"}
|
package/dist/hooks.js
CHANGED
|
@@ -96,7 +96,80 @@ function useAsync(fetcher, options = {}) {
|
|
|
96
96
|
run
|
|
97
97
|
};
|
|
98
98
|
}
|
|
99
|
+
/** Web `localStorage` if available, else a no-op store (SSR/native without an injected storage). */
|
|
100
|
+
function defaultStorage() {
|
|
101
|
+
const ls = globalThis.localStorage;
|
|
102
|
+
if (ls && typeof ls.getItem === "function" && typeof ls.setItem === "function") return ls;
|
|
103
|
+
return {
|
|
104
|
+
getItem: () => null,
|
|
105
|
+
setItem: () => {}
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* A signal that restores its initial value from a key/value store and auto-saves on every change โ
|
|
110
|
+
* persist theme/prefs/UI state with one call. On web it uses `localStorage` by default; inject a
|
|
111
|
+
* `storage` (e.g. a Continuum-backed one) for native. A corrupt/unparseable stored value falls back
|
|
112
|
+
* to `initial`; storage errors (quota/SSR) are swallowed so the signal always works.
|
|
113
|
+
*/
|
|
114
|
+
function usePersistentSignal(key, initial, options = {}) {
|
|
115
|
+
const storage = options.storage ?? defaultStorage();
|
|
116
|
+
const serialize = options.serialize ?? JSON.stringify;
|
|
117
|
+
const deserialize = options.deserialize ?? JSON.parse;
|
|
118
|
+
let start = initial;
|
|
119
|
+
let raw = null;
|
|
120
|
+
try {
|
|
121
|
+
raw = storage.getItem(key);
|
|
122
|
+
} catch {
|
|
123
|
+
raw = null;
|
|
124
|
+
}
|
|
125
|
+
if (raw !== null) try {
|
|
126
|
+
start = deserialize(raw);
|
|
127
|
+
} catch {
|
|
128
|
+
start = initial;
|
|
129
|
+
}
|
|
130
|
+
const s = signal(start);
|
|
131
|
+
effect(() => {
|
|
132
|
+
const value = s();
|
|
133
|
+
try {
|
|
134
|
+
storage.setItem(key, serialize(value));
|
|
135
|
+
} catch {}
|
|
136
|
+
});
|
|
137
|
+
return s;
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* A debounced view of `source`: it follows `source` but only after the source has stopped changing
|
|
141
|
+
* for `ms` (e.g. a search box that queries after typing settles). Rapid changes coalesce to the last.
|
|
142
|
+
*/
|
|
143
|
+
function useDebounce(source, ms) {
|
|
144
|
+
const out = signal(untrack(source));
|
|
145
|
+
effect(() => {
|
|
146
|
+
const value = source();
|
|
147
|
+
if (typeof setTimeout !== "function") {
|
|
148
|
+
untrack(() => out.set(value));
|
|
149
|
+
return;
|
|
150
|
+
}
|
|
151
|
+
const id = setTimeout(() => out.set(value), ms);
|
|
152
|
+
onCleanup(() => clearTimeout(id));
|
|
153
|
+
});
|
|
154
|
+
return () => out();
|
|
155
|
+
}
|
|
156
|
+
/** Run `callback` every `ms` while the owner is alive; pass `null` to pause. Cleared on dispose. */
|
|
157
|
+
function useInterval(callback, ms) {
|
|
158
|
+
effect(() => {
|
|
159
|
+
if (ms === null || typeof setInterval !== "function") return;
|
|
160
|
+
const id = setInterval(() => callback(), ms);
|
|
161
|
+
onCleanup(() => clearInterval(id));
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
/** Run `callback` once after `ms`; pass `null` to cancel. Cleared on dispose before it fires. */
|
|
165
|
+
function useTimeout(callback, ms) {
|
|
166
|
+
effect(() => {
|
|
167
|
+
if (ms === null || typeof setTimeout !== "function") return;
|
|
168
|
+
const id = setTimeout(() => callback(), ms);
|
|
169
|
+
onCleanup(() => clearTimeout(id));
|
|
170
|
+
});
|
|
171
|
+
}
|
|
99
172
|
//#endregion
|
|
100
|
-
export { useAsync, useCounter, usePrevious, useReducer, useToggle };
|
|
173
|
+
export { useAsync, useCounter, useDebounce, useInterval, usePersistentSignal, usePrevious, useReducer, useTimeout, useToggle };
|
|
101
174
|
|
|
102
175
|
//# sourceMappingURL=hooks.js.map
|
package/dist/hooks.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hooks.js","names":[],"sources":["../src/hooks.ts"],"sourcesContent":["/**\n * Standard utility hooks โ the batteries RN and Flutter make you reach for a library to get. Each is\n * a thin, allocation-light wrapper over the reactive core (signals + effect), so they're\n * renderer-agnostic (web + native), tracked where it matters, and untracked where a write shouldn't\n * self-subscribe. Device/UI hooks (useWindowDimensions, useColorScheme, โฆ) live in `environment.ts`;\n * these are the stateful logic hooks.\n *\n * @module\n */\n\nimport { type Accessor, batch, effect, onCleanup, signal, untrack } from '@mindees/core'\n\n/** A boolean toggle (RN/React: bring-your-own). */\nexport interface Toggle {\n /** Reactive current value. */\n readonly value: Accessor<boolean>\n /** Flip the value. */\n toggle(): void\n /** Set `true`. */\n on(): void\n /** Set `false`. */\n off(): void\n /** Set explicitly. */\n set(value: boolean): void\n}\n\n/** A reactive boolean with toggle/on/off helpers. */\nexport function useToggle(initial = false): Toggle {\n const s = signal(initial)\n return {\n value: () => s(),\n toggle: () => s.set(!untrack(s)),\n on: () => s.set(true),\n off: () => s.set(false),\n set: (value) => s.set(value),\n }\n}\n\n/** A bounded counter. */\nexport interface Counter {\n /** Reactive current count (always within `[min, max]`). */\n readonly count: Accessor<number>\n /** Increment by `by` (default `step`). */\n inc(by?: number): void\n /** Decrement by `by` (default `step`). */\n dec(by?: number): void\n /** Set explicitly (clamped). */\n set(value: number): void\n /** Reset to the initial value (clamped). */\n reset(): void\n}\n\n/** A reactive number with inc/dec/reset + optional min/max/step clamping. */\nexport function useCounter(\n initial = 0,\n options: { min?: number; max?: number; step?: number } = {},\n): Counter {\n const step = options.step ?? 1\n const min = options.min ?? Number.NEGATIVE_INFINITY\n const max = options.max ?? Number.POSITIVE_INFINITY\n const clamp = (v: number): number => Math.min(max, Math.max(min, v))\n const s = signal(clamp(initial))\n return {\n count: () => s(),\n inc: (by = step) => s.set(clamp(untrack(s) + by)),\n dec: (by = step) => s.set(clamp(untrack(s) - by)),\n set: (value) => s.set(clamp(value)),\n reset: () => s.set(clamp(initial)),\n }\n}\n\n/** Track the PREVIOUS value of a reactive source (`undefined` until it changes once). */\nexport function usePrevious<T>(source: Accessor<T>): Accessor<T | undefined> {\n const prev = signal<T | undefined>(undefined)\n let last: T | undefined\n let first = true\n effect(() => {\n const next = source() // track the source\n untrack(() => {\n if (!first) prev.set(last)\n last = next\n first = false\n })\n })\n return () => prev()\n}\n\n/** A reducer over reactive state (React's `useReducer`, signal-backed). */\nexport function useReducer<S, A>(\n reducer: (state: S, action: A) => S,\n initial: S,\n): [Accessor<S>, (action: A) => void] {\n const s = signal(initial)\n return [() => s(), (action) => s.set(reducer(untrack(s), action))]\n}\n\n/** The reactive state of an async resource. */\nexport interface AsyncState<T> {\n /** The latest resolved value, or `undefined`. */\n readonly data: Accessor<T | undefined>\n /** The latest rejection, or `undefined`. */\n readonly error: Accessor<unknown>\n /** Whether a run is in flight. */\n readonly loading: Accessor<boolean>\n /** (Re)run the fetcher; supersedes any in-flight run (last-write-wins). */\n run(): void\n}\n\n/**\n * Run an async fetcher into reactive `data`/`error`/`loading`. The newest `run()` wins โ a stale\n * in-flight promise can never clobber a newer result โ and a run in flight when the owner disposes\n * is ignored. Runs immediately unless `immediate: false`.\n */\nexport function useAsync<T>(\n fetcher: () => Promise<T>,\n options: { immediate?: boolean } = {},\n): AsyncState<T> {\n const data = signal<T | undefined>(undefined)\n const error = signal<unknown>(undefined)\n const loading = signal(false)\n let token = 0\n const run = (): void => {\n const mine = ++token\n batch(() => {\n loading.set(true)\n error.set(undefined)\n })\n fetcher().then(\n (value) => {\n if (mine !== token) return // superseded / disposed\n batch(() => {\n data.set(value)\n loading.set(false)\n })\n },\n (err) => {\n if (mine !== token) return\n batch(() => {\n error.set(err)\n loading.set(false)\n })\n },\n )\n }\n onCleanup(() => {\n token++ // invalidate any in-flight run on dispose\n })\n if (options.immediate !== false) run()\n return { data: () => data(), error: () => error(), loading: () => loading(), run }\n}\n"],"mappings":";;;;;;;;;;;;AA2BA,SAAgB,UAAU,UAAU,OAAe;CACjD,MAAM,IAAI,OAAO,OAAO;CACxB,OAAO;EACL,aAAa,EAAE;EACf,cAAc,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;EAC/B,UAAU,EAAE,IAAI,IAAI;EACpB,WAAW,EAAE,IAAI,KAAK;EACtB,MAAM,UAAU,EAAE,IAAI,KAAK;CAC7B;AACF;;AAiBA,SAAgB,WACd,UAAU,GACV,UAAyD,CAAC,GACjD;CACT,MAAM,OAAO,QAAQ,QAAQ;CAC7B,MAAM,MAAM,QAAQ,OAAO,OAAO;CAClC,MAAM,MAAM,QAAQ,OAAO,OAAO;CAClC,MAAM,SAAS,MAAsB,KAAK,IAAI,KAAK,KAAK,IAAI,KAAK,CAAC,CAAC;CACnE,MAAM,IAAI,OAAO,MAAM,OAAO,CAAC;CAC/B,OAAO;EACL,aAAa,EAAE;EACf,MAAM,KAAK,SAAS,EAAE,IAAI,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;EAChD,MAAM,KAAK,SAAS,EAAE,IAAI,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;EAChD,MAAM,UAAU,EAAE,IAAI,MAAM,KAAK,CAAC;EAClC,aAAa,EAAE,IAAI,MAAM,OAAO,CAAC;CACnC;AACF;;AAGA,SAAgB,YAAe,QAA8C;CAC3E,MAAM,OAAO,OAAsB,KAAA,CAAS;CAC5C,IAAI;CACJ,IAAI,QAAQ;CACZ,aAAa;EACX,MAAM,OAAO,OAAO;EACpB,cAAc;GACZ,IAAI,CAAC,OAAO,KAAK,IAAI,IAAI;GACzB,OAAO;GACP,QAAQ;EACV,CAAC;CACH,CAAC;CACD,aAAa,KAAK;AACpB;;AAGA,SAAgB,WACd,SACA,SACoC;CACpC,MAAM,IAAI,OAAO,OAAO;CACxB,OAAO,OAAO,EAAE,IAAI,WAAW,EAAE,IAAI,QAAQ,QAAQ,CAAC,GAAG,MAAM,CAAC,CAAC;AACnE;;;;;;AAmBA,SAAgB,SACd,SACA,UAAmC,CAAC,GACrB;CACf,MAAM,OAAO,OAAsB,KAAA,CAAS;CAC5C,MAAM,QAAQ,OAAgB,KAAA,CAAS;CACvC,MAAM,UAAU,OAAO,KAAK;CAC5B,IAAI,QAAQ;CACZ,MAAM,YAAkB;EACtB,MAAM,OAAO,EAAE;EACf,YAAY;GACV,QAAQ,IAAI,IAAI;GAChB,MAAM,IAAI,KAAA,CAAS;EACrB,CAAC;EACD,QAAQ,EAAE,MACP,UAAU;GACT,IAAI,SAAS,OAAO;GACpB,YAAY;IACV,KAAK,IAAI,KAAK;IACd,QAAQ,IAAI,KAAK;GACnB,CAAC;EACH,IACC,QAAQ;GACP,IAAI,SAAS,OAAO;GACpB,YAAY;IACV,MAAM,IAAI,GAAG;IACb,QAAQ,IAAI,KAAK;GACnB,CAAC;EACH,CACF;CACF;CACA,gBAAgB;EACd;CACF,CAAC;CACD,IAAI,QAAQ,cAAc,OAAO,IAAI;CACrC,OAAO;EAAE,YAAY,KAAK;EAAG,aAAa,MAAM;EAAG,eAAe,QAAQ;EAAG;CAAI;AACnF"}
|
|
1
|
+
{"version":3,"file":"hooks.js","names":[],"sources":["../src/hooks.ts"],"sourcesContent":["/**\n * Standard utility hooks โ the batteries RN and Flutter make you reach for a library to get. Each is\n * a thin, allocation-light wrapper over the reactive core (signals + effect), so they're\n * renderer-agnostic (web + native), tracked where it matters, and untracked where a write shouldn't\n * self-subscribe. Device/UI hooks (useWindowDimensions, useColorScheme, โฆ) live in `environment.ts`;\n * these are the stateful logic hooks.\n *\n * @module\n */\n\nimport {\n type Accessor,\n batch,\n effect,\n onCleanup,\n type Signal,\n signal,\n untrack,\n} from '@mindees/core'\n\n/** A boolean toggle (RN/React: bring-your-own). */\nexport interface Toggle {\n /** Reactive current value. */\n readonly value: Accessor<boolean>\n /** Flip the value. */\n toggle(): void\n /** Set `true`. */\n on(): void\n /** Set `false`. */\n off(): void\n /** Set explicitly. */\n set(value: boolean): void\n}\n\n/** A reactive boolean with toggle/on/off helpers. */\nexport function useToggle(initial = false): Toggle {\n const s = signal(initial)\n return {\n value: () => s(),\n toggle: () => s.set(!untrack(s)),\n on: () => s.set(true),\n off: () => s.set(false),\n set: (value) => s.set(value),\n }\n}\n\n/** A bounded counter. */\nexport interface Counter {\n /** Reactive current count (always within `[min, max]`). */\n readonly count: Accessor<number>\n /** Increment by `by` (default `step`). */\n inc(by?: number): void\n /** Decrement by `by` (default `step`). */\n dec(by?: number): void\n /** Set explicitly (clamped). */\n set(value: number): void\n /** Reset to the initial value (clamped). */\n reset(): void\n}\n\n/** A reactive number with inc/dec/reset + optional min/max/step clamping. */\nexport function useCounter(\n initial = 0,\n options: { min?: number; max?: number; step?: number } = {},\n): Counter {\n const step = options.step ?? 1\n const min = options.min ?? Number.NEGATIVE_INFINITY\n const max = options.max ?? Number.POSITIVE_INFINITY\n const clamp = (v: number): number => Math.min(max, Math.max(min, v))\n const s = signal(clamp(initial))\n return {\n count: () => s(),\n inc: (by = step) => s.set(clamp(untrack(s) + by)),\n dec: (by = step) => s.set(clamp(untrack(s) - by)),\n set: (value) => s.set(clamp(value)),\n reset: () => s.set(clamp(initial)),\n }\n}\n\n/** Track the PREVIOUS value of a reactive source (`undefined` until it changes once). */\nexport function usePrevious<T>(source: Accessor<T>): Accessor<T | undefined> {\n const prev = signal<T | undefined>(undefined)\n let last: T | undefined\n let first = true\n effect(() => {\n const next = source() // track the source\n untrack(() => {\n if (!first) prev.set(last)\n last = next\n first = false\n })\n })\n return () => prev()\n}\n\n/** A reducer over reactive state (React's `useReducer`, signal-backed). */\nexport function useReducer<S, A>(\n reducer: (state: S, action: A) => S,\n initial: S,\n): [Accessor<S>, (action: A) => void] {\n const s = signal(initial)\n return [() => s(), (action) => s.set(reducer(untrack(s), action))]\n}\n\n/** The reactive state of an async resource. */\nexport interface AsyncState<T> {\n /** The latest resolved value, or `undefined`. */\n readonly data: Accessor<T | undefined>\n /** The latest rejection, or `undefined`. */\n readonly error: Accessor<unknown>\n /** Whether a run is in flight. */\n readonly loading: Accessor<boolean>\n /** (Re)run the fetcher; supersedes any in-flight run (last-write-wins). */\n run(): void\n}\n\n/**\n * Run an async fetcher into reactive `data`/`error`/`loading`. The newest `run()` wins โ a stale\n * in-flight promise can never clobber a newer result โ and a run in flight when the owner disposes\n * is ignored. Runs immediately unless `immediate: false`.\n */\nexport function useAsync<T>(\n fetcher: () => Promise<T>,\n options: { immediate?: boolean } = {},\n): AsyncState<T> {\n const data = signal<T | undefined>(undefined)\n const error = signal<unknown>(undefined)\n const loading = signal(false)\n let token = 0\n const run = (): void => {\n const mine = ++token\n batch(() => {\n loading.set(true)\n error.set(undefined)\n })\n fetcher().then(\n (value) => {\n if (mine !== token) return // superseded / disposed\n batch(() => {\n data.set(value)\n loading.set(false)\n })\n },\n (err) => {\n if (mine !== token) return\n batch(() => {\n error.set(err)\n loading.set(false)\n })\n },\n )\n }\n onCleanup(() => {\n token++ // invalidate any in-flight run on dispose\n })\n if (options.immediate !== false) run()\n return { data: () => data(), error: () => error(), loading: () => loading(), run }\n}\n\n/** The minimal key/value store {@link usePersistentSignal} reads/writes (a Web Storage subset). */\nexport interface SignalStorage {\n getItem(key: string): string | null\n setItem(key: string, value: string): void\n}\n\n/** Options for {@link usePersistentSignal}. */\nexport interface PersistentSignalOptions<T> {\n /** Where to persist. Defaults to `localStorage` on web; degrades to in-memory elsewhere (no-op). */\n readonly storage?: SignalStorage\n /** Serialize before saving (default `JSON.stringify`). */\n readonly serialize?: (value: T) => string\n /** Parse on restore (default `JSON.parse`). */\n readonly deserialize?: (raw: string) => T\n}\n\n/** Web `localStorage` if available, else a no-op store (SSR/native without an injected storage). */\nfunction defaultStorage(): SignalStorage {\n const ls = (globalThis as { localStorage?: SignalStorage }).localStorage\n if (ls && typeof ls.getItem === 'function' && typeof ls.setItem === 'function') return ls\n return { getItem: () => null, setItem: () => {} }\n}\n\n/**\n * A signal that restores its initial value from a key/value store and auto-saves on every change โ\n * persist theme/prefs/UI state with one call. On web it uses `localStorage` by default; inject a\n * `storage` (e.g. a Continuum-backed one) for native. A corrupt/unparseable stored value falls back\n * to `initial`; storage errors (quota/SSR) are swallowed so the signal always works.\n */\nexport function usePersistentSignal<T>(\n key: string,\n initial: T,\n options: PersistentSignalOptions<T> = {},\n): Signal<T> {\n const storage = options.storage ?? defaultStorage()\n const serialize = options.serialize ?? JSON.stringify\n const deserialize = options.deserialize ?? (JSON.parse as (raw: string) => T)\n\n let start = initial\n let raw: string | null = null\n try {\n raw = storage.getItem(key)\n } catch {\n raw = null\n }\n if (raw !== null) {\n try {\n start = deserialize(raw)\n } catch {\n start = initial // corrupt payload โ fall back\n }\n }\n\n const s = signal(start)\n effect(() => {\n const value = s()\n try {\n storage.setItem(key, serialize(value))\n } catch {\n // quota exceeded / no storage โ ignore; the in-memory signal still works\n }\n })\n return s\n}\n\n/**\n * A debounced view of `source`: it follows `source` but only after the source has stopped changing\n * for `ms` (e.g. a search box that queries after typing settles). Rapid changes coalesce to the last.\n */\nexport function useDebounce<T>(source: Accessor<T>, ms: number): Accessor<T> {\n const out = signal(untrack(source))\n effect(() => {\n const value = source() // track\n if (typeof setTimeout !== 'function') {\n untrack(() => out.set(value)) // SSR/no-timer: pass through synchronously\n return\n }\n const id = setTimeout(() => out.set(value), ms)\n onCleanup(() => clearTimeout(id))\n })\n return () => out()\n}\n\n/** Run `callback` every `ms` while the owner is alive; pass `null` to pause. Cleared on dispose. */\nexport function useInterval(callback: () => void, ms: number | null): void {\n effect(() => {\n if (ms === null || typeof setInterval !== 'function') return\n const id = setInterval(() => callback(), ms)\n onCleanup(() => clearInterval(id))\n })\n}\n\n/** Run `callback` once after `ms`; pass `null` to cancel. Cleared on dispose before it fires. */\nexport function useTimeout(callback: () => void, ms: number | null): void {\n effect(() => {\n if (ms === null || typeof setTimeout !== 'function') return\n const id = setTimeout(() => callback(), ms)\n onCleanup(() => clearTimeout(id))\n })\n}\n"],"mappings":";;;;;;;;;;;;AAmCA,SAAgB,UAAU,UAAU,OAAe;CACjD,MAAM,IAAI,OAAO,OAAO;CACxB,OAAO;EACL,aAAa,EAAE;EACf,cAAc,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;EAC/B,UAAU,EAAE,IAAI,IAAI;EACpB,WAAW,EAAE,IAAI,KAAK;EACtB,MAAM,UAAU,EAAE,IAAI,KAAK;CAC7B;AACF;;AAiBA,SAAgB,WACd,UAAU,GACV,UAAyD,CAAC,GACjD;CACT,MAAM,OAAO,QAAQ,QAAQ;CAC7B,MAAM,MAAM,QAAQ,OAAO,OAAO;CAClC,MAAM,MAAM,QAAQ,OAAO,OAAO;CAClC,MAAM,SAAS,MAAsB,KAAK,IAAI,KAAK,KAAK,IAAI,KAAK,CAAC,CAAC;CACnE,MAAM,IAAI,OAAO,MAAM,OAAO,CAAC;CAC/B,OAAO;EACL,aAAa,EAAE;EACf,MAAM,KAAK,SAAS,EAAE,IAAI,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;EAChD,MAAM,KAAK,SAAS,EAAE,IAAI,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;EAChD,MAAM,UAAU,EAAE,IAAI,MAAM,KAAK,CAAC;EAClC,aAAa,EAAE,IAAI,MAAM,OAAO,CAAC;CACnC;AACF;;AAGA,SAAgB,YAAe,QAA8C;CAC3E,MAAM,OAAO,OAAsB,KAAA,CAAS;CAC5C,IAAI;CACJ,IAAI,QAAQ;CACZ,aAAa;EACX,MAAM,OAAO,OAAO;EACpB,cAAc;GACZ,IAAI,CAAC,OAAO,KAAK,IAAI,IAAI;GACzB,OAAO;GACP,QAAQ;EACV,CAAC;CACH,CAAC;CACD,aAAa,KAAK;AACpB;;AAGA,SAAgB,WACd,SACA,SACoC;CACpC,MAAM,IAAI,OAAO,OAAO;CACxB,OAAO,OAAO,EAAE,IAAI,WAAW,EAAE,IAAI,QAAQ,QAAQ,CAAC,GAAG,MAAM,CAAC,CAAC;AACnE;;;;;;AAmBA,SAAgB,SACd,SACA,UAAmC,CAAC,GACrB;CACf,MAAM,OAAO,OAAsB,KAAA,CAAS;CAC5C,MAAM,QAAQ,OAAgB,KAAA,CAAS;CACvC,MAAM,UAAU,OAAO,KAAK;CAC5B,IAAI,QAAQ;CACZ,MAAM,YAAkB;EACtB,MAAM,OAAO,EAAE;EACf,YAAY;GACV,QAAQ,IAAI,IAAI;GAChB,MAAM,IAAI,KAAA,CAAS;EACrB,CAAC;EACD,QAAQ,EAAE,MACP,UAAU;GACT,IAAI,SAAS,OAAO;GACpB,YAAY;IACV,KAAK,IAAI,KAAK;IACd,QAAQ,IAAI,KAAK;GACnB,CAAC;EACH,IACC,QAAQ;GACP,IAAI,SAAS,OAAO;GACpB,YAAY;IACV,MAAM,IAAI,GAAG;IACb,QAAQ,IAAI,KAAK;GACnB,CAAC;EACH,CACF;CACF;CACA,gBAAgB;EACd;CACF,CAAC;CACD,IAAI,QAAQ,cAAc,OAAO,IAAI;CACrC,OAAO;EAAE,YAAY,KAAK;EAAG,aAAa,MAAM;EAAG,eAAe,QAAQ;EAAG;CAAI;AACnF;;AAmBA,SAAS,iBAAgC;CACvC,MAAM,KAAM,WAAgD;CAC5D,IAAI,MAAM,OAAO,GAAG,YAAY,cAAc,OAAO,GAAG,YAAY,YAAY,OAAO;CACvF,OAAO;EAAE,eAAe;EAAM,eAAe,CAAC;CAAE;AAClD;;;;;;;AAQA,SAAgB,oBACd,KACA,SACA,UAAsC,CAAC,GAC5B;CACX,MAAM,UAAU,QAAQ,WAAW,eAAe;CAClD,MAAM,YAAY,QAAQ,aAAa,KAAK;CAC5C,MAAM,cAAc,QAAQ,eAAgB,KAAK;CAEjD,IAAI,QAAQ;CACZ,IAAI,MAAqB;CACzB,IAAI;EACF,MAAM,QAAQ,QAAQ,GAAG;CAC3B,QAAQ;EACN,MAAM;CACR;CACA,IAAI,QAAQ,MACV,IAAI;EACF,QAAQ,YAAY,GAAG;CACzB,QAAQ;EACN,QAAQ;CACV;CAGF,MAAM,IAAI,OAAO,KAAK;CACtB,aAAa;EACX,MAAM,QAAQ,EAAE;EAChB,IAAI;GACF,QAAQ,QAAQ,KAAK,UAAU,KAAK,CAAC;EACvC,QAAQ,CAER;CACF,CAAC;CACD,OAAO;AACT;;;;;AAMA,SAAgB,YAAe,QAAqB,IAAyB;CAC3E,MAAM,MAAM,OAAO,QAAQ,MAAM,CAAC;CAClC,aAAa;EACX,MAAM,QAAQ,OAAO;EACrB,IAAI,OAAO,eAAe,YAAY;GACpC,cAAc,IAAI,IAAI,KAAK,CAAC;GAC5B;EACF;EACA,MAAM,KAAK,iBAAiB,IAAI,IAAI,KAAK,GAAG,EAAE;EAC9C,gBAAgB,aAAa,EAAE,CAAC;CAClC,CAAC;CACD,aAAa,IAAI;AACnB;;AAGA,SAAgB,YAAY,UAAsB,IAAyB;CACzE,aAAa;EACX,IAAI,OAAO,QAAQ,OAAO,gBAAgB,YAAY;EACtD,MAAM,KAAK,kBAAkB,SAAS,GAAG,EAAE;EAC3C,gBAAgB,cAAc,EAAE,CAAC;CACnC,CAAC;AACH;;AAGA,SAAgB,WAAW,UAAsB,IAAyB;CACxE,aAAa;EACX,IAAI,OAAO,QAAQ,OAAO,eAAe,YAAY;EACrD,MAAM,KAAK,iBAAiB,SAAS,GAAG,EAAE;EAC1C,gBAAgB,aAAa,EAAE,CAAC;CAClC,CAAC;AACH"}
|
package/dist/index.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ import { Accordion, AccordionProps, AccordionSection, ActivityIndicator, Activit
|
|
|
5
5
|
import { ColorScheme, KeyboardState, PlatformEnvironment, SafeAreaInsets, WindowDimensions, getEnvironment, setEnvironment, useColorScheme, useKeyboard, useSafeAreaInsets, useWindowDimensions } from "./environment.js";
|
|
6
6
|
import { Field, FormApi, UseFormOptions, useForm } from "./form.js";
|
|
7
7
|
import { AttachableGesture, GestureView, GestureViewProps } from "./gesture.js";
|
|
8
|
-
import { AsyncState, Counter, Toggle, useAsync, useCounter, usePrevious, useReducer, useToggle } from "./hooks.js";
|
|
8
|
+
import { AsyncState, Counter, PersistentSignalOptions, SignalStorage, Toggle, useAsync, useCounter, useDebounce, useInterval, usePersistentSignal, usePrevious, useReducer, useTimeout, useToggle } from "./hooks.js";
|
|
9
9
|
import { Theme, ThemeColors, duration, easing, fontSize, fontWeight, getTheme, lineHeight, palette, radius, space, tokens, useTheme } from "./tokens.js";
|
|
10
10
|
import { animateTo, motion } from "./motion.js";
|
|
11
11
|
import { FocusScope, FocusScopeProps, Modal, ModalProps, Toast, ToastProps } from "./overlay.js";
|
|
@@ -16,7 +16,7 @@ import { Maturity, NotImplementedError, PackageInfo, notImplemented } from "@min
|
|
|
16
16
|
/** The npm package name. */
|
|
17
17
|
declare const name = "@mindees/atlas";
|
|
18
18
|
/** The package version. All `@mindees/*` packages share one locked version line. */
|
|
19
|
-
declare const VERSION = "0.
|
|
19
|
+
declare const VERSION = "0.14.0";
|
|
20
20
|
/** Current maturity of this package. See the repository `STATUS.md`. */
|
|
21
21
|
declare const maturity: Maturity;
|
|
22
22
|
/**
|
|
@@ -26,5 +26,5 @@ declare const maturity: Maturity;
|
|
|
26
26
|
*/
|
|
27
27
|
declare const info: PackageInfo;
|
|
28
28
|
//#endregion
|
|
29
|
-
export { type A11yProps, type A11yState, Accordion, type AccordionProps, type AccordionSection, ActivityIndicator, type ActivityIndicatorProps, type AsyncState, type AttachableGesture, Avatar, type AvatarProps, Badge, type BadgeProps, type BaseProps, Button, type ButtonProps, Card, type CardProps, Checkbox, type CheckboxProps, Chip, type ChipProps, type ColorScheme, Column, type Counter, Divider, type DividerProps, type Field, FocusScope, type FocusScopeProps, type FormApi, GestureView, type GestureViewProps, Image, type ImageProps, type InteractionState, KeyboardAvoidingView, type KeyboardAvoidingViewProps, type KeyboardState, type Maturity, Modal, type ModalProps, NotImplementedError, type PackageInfo, type PlatformEnvironment, Pressable, type PressableProps, ProgressBar, type ProgressBarProps, RadioGroup, type RadioGroupProps, type RadioOption, type Reactive, type Role, Row, type SafeAreaInsets, SafeAreaView, type SafeAreaViewProps, ScrollView, type ScrollViewProps, type Segment, SegmentedControl, type SegmentedControlProps, Skeleton, type SkeletonProps, Spacer, type SpacerProps, Stack, type StackProps, Stepper, type StepperProps, type StyleInput, type StyleObject, type StyleValue, Switch, type SwitchProps, type TabItem, Tabs, type TabsProps, Text, TextInput, type TextInputProps, type TextProps, type Theme, type ThemeColors, Toast, type ToastProps, type Toggle, type UseFormOptions, VERSION, View, type ViewProps, type WindowDimensions, animateTo, duration, easing, flattenStyle, fontSize, fontWeight, getEnvironment, getTheme, info, lineHeight, maturity, motion, name, notImplemented, palette, radius, resolveStyle, setEnvironment, space, toA11yProps, toHostProps, tokens, useAsync, useColorScheme, useCounter, useForm, useKeyboard, usePressable, usePrevious, useReducer, useSafeAreaInsets, useTheme, useToggle, useWindowDimensions };
|
|
29
|
+
export { type A11yProps, type A11yState, Accordion, type AccordionProps, type AccordionSection, ActivityIndicator, type ActivityIndicatorProps, type AsyncState, type AttachableGesture, Avatar, type AvatarProps, Badge, type BadgeProps, type BaseProps, Button, type ButtonProps, Card, type CardProps, Checkbox, type CheckboxProps, Chip, type ChipProps, type ColorScheme, Column, type Counter, Divider, type DividerProps, type Field, FocusScope, type FocusScopeProps, type FormApi, GestureView, type GestureViewProps, Image, type ImageProps, type InteractionState, KeyboardAvoidingView, type KeyboardAvoidingViewProps, type KeyboardState, type Maturity, Modal, type ModalProps, NotImplementedError, type PackageInfo, type PersistentSignalOptions, type PlatformEnvironment, Pressable, type PressableProps, ProgressBar, type ProgressBarProps, RadioGroup, type RadioGroupProps, type RadioOption, type Reactive, type Role, Row, type SafeAreaInsets, SafeAreaView, type SafeAreaViewProps, ScrollView, type ScrollViewProps, type Segment, SegmentedControl, type SegmentedControlProps, type SignalStorage, Skeleton, type SkeletonProps, Spacer, type SpacerProps, Stack, type StackProps, Stepper, type StepperProps, type StyleInput, type StyleObject, type StyleValue, Switch, type SwitchProps, type TabItem, Tabs, type TabsProps, Text, TextInput, type TextInputProps, type TextProps, type Theme, type ThemeColors, Toast, type ToastProps, type Toggle, type UseFormOptions, VERSION, View, type ViewProps, type WindowDimensions, animateTo, duration, easing, flattenStyle, fontSize, fontWeight, getEnvironment, getTheme, info, lineHeight, maturity, motion, name, notImplemented, palette, radius, resolveStyle, setEnvironment, space, toA11yProps, toHostProps, tokens, useAsync, useColorScheme, useCounter, useDebounce, useForm, useInterval, useKeyboard, usePersistentSignal, usePressable, usePrevious, useReducer, useSafeAreaInsets, useTheme, useTimeout, useToggle, useWindowDimensions };
|
|
30
30
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.js
CHANGED
|
@@ -7,7 +7,7 @@ import { duration, easing, fontSize, fontWeight, getTheme, lineHeight, palette,
|
|
|
7
7
|
import { Accordion, ActivityIndicator, Avatar, Badge, Card, Checkbox, Chip, Divider, KeyboardAvoidingView, ProgressBar, RadioGroup, SafeAreaView, SegmentedControl, Skeleton, Stepper, Switch, Tabs } from "./components.js";
|
|
8
8
|
import { useForm } from "./form.js";
|
|
9
9
|
import { GestureView } from "./gesture.js";
|
|
10
|
-
import { useAsync, useCounter, usePrevious, useReducer, useToggle } from "./hooks.js";
|
|
10
|
+
import { useAsync, useCounter, useDebounce, useInterval, usePersistentSignal, usePrevious, useReducer, useTimeout, useToggle } from "./hooks.js";
|
|
11
11
|
import { animateTo, motion } from "./motion.js";
|
|
12
12
|
import { FocusScope, Modal, Toast } from "./overlay.js";
|
|
13
13
|
import { NotImplementedError, notImplemented } from "@mindees/core";
|
|
@@ -15,7 +15,7 @@ import { NotImplementedError, notImplemented } from "@mindees/core";
|
|
|
15
15
|
/** The npm package name. */
|
|
16
16
|
const name = "@mindees/atlas";
|
|
17
17
|
/** The package version. All `@mindees/*` packages share one locked version line. */
|
|
18
|
-
const VERSION = "0.
|
|
18
|
+
const VERSION = "0.14.0";
|
|
19
19
|
/** Current maturity of this package. See the repository `STATUS.md`. */
|
|
20
20
|
const maturity = "experimental";
|
|
21
21
|
/**
|
|
@@ -29,6 +29,6 @@ const info = Object.freeze({
|
|
|
29
29
|
maturity
|
|
30
30
|
});
|
|
31
31
|
//#endregion
|
|
32
|
-
export { Accordion, ActivityIndicator, Avatar, Badge, Button, Card, Checkbox, Chip, Column, Divider, FocusScope, GestureView, Image, KeyboardAvoidingView, Modal, NotImplementedError, Pressable, ProgressBar, RadioGroup, Row, SafeAreaView, ScrollView, SegmentedControl, Skeleton, Spacer, Stack, Stepper, Switch, Tabs, Text, TextInput, Toast, VERSION, View, animateTo, duration, easing, flattenStyle, fontSize, fontWeight, getEnvironment, getTheme, info, lineHeight, maturity, motion, name, notImplemented, palette, radius, resolveStyle, setEnvironment, space, toA11yProps, toHostProps, tokens, useAsync, useColorScheme, useCounter, useForm, useKeyboard, usePressable, usePrevious, useReducer, useSafeAreaInsets, useTheme, useToggle, useWindowDimensions };
|
|
32
|
+
export { Accordion, ActivityIndicator, Avatar, Badge, Button, Card, Checkbox, Chip, Column, Divider, FocusScope, GestureView, Image, KeyboardAvoidingView, Modal, NotImplementedError, Pressable, ProgressBar, RadioGroup, Row, SafeAreaView, ScrollView, SegmentedControl, Skeleton, Spacer, Stack, Stepper, Switch, Tabs, Text, TextInput, Toast, VERSION, View, animateTo, duration, easing, flattenStyle, fontSize, fontWeight, getEnvironment, getTheme, info, lineHeight, maturity, motion, name, notImplemented, palette, radius, resolveStyle, setEnvironment, space, toA11yProps, toHostProps, tokens, useAsync, useColorScheme, useCounter, useDebounce, useForm, useInterval, useKeyboard, usePersistentSignal, usePressable, usePrevious, useReducer, useSafeAreaInsets, useTheme, useTimeout, useToggle, useWindowDimensions };
|
|
33
33
|
|
|
34
34
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../src/index.ts"],"sourcesContent":["/**\n * `@mindees/atlas` (Atlas) โ accessible, signals-native UI primitives. Function components\n * over `@mindees/core`'s `createElement` that return renderer-agnostic `MindeesNode` trees:\n * web rendering is real via the Helix DOM backend; native is a labeled ๐ฌ research track (the\n * same serializable tree, interpreted by a native host later). A curated cross-platform\n * `StyleObject`, typed accessibility, and a structural theme (on the `@mindees/atlas/theme`\n * subpath). The virtualized recycling `List` is on the `@mindees/atlas/list` subpath.\n *\n * @module\n */\n\nimport type { Maturity, PackageInfo } from '@mindees/core'\nimport { NotImplementedError, notImplemented } from '@mindees/core'\n\n/** The npm package name. */\nexport const name = '@mindees/atlas'\n\n/** The package version. All `@mindees/*` packages share one locked version line. */\nexport const VERSION = '0.
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../src/index.ts"],"sourcesContent":["/**\n * `@mindees/atlas` (Atlas) โ accessible, signals-native UI primitives. Function components\n * over `@mindees/core`'s `createElement` that return renderer-agnostic `MindeesNode` trees:\n * web rendering is real via the Helix DOM backend; native is a labeled ๐ฌ research track (the\n * same serializable tree, interpreted by a native host later). A curated cross-platform\n * `StyleObject`, typed accessibility, and a structural theme (on the `@mindees/atlas/theme`\n * subpath). The virtualized recycling `List` is on the `@mindees/atlas/list` subpath.\n *\n * @module\n */\n\nimport type { Maturity, PackageInfo } from '@mindees/core'\nimport { NotImplementedError, notImplemented } from '@mindees/core'\n\n/** The npm package name. */\nexport const name = '@mindees/atlas'\n\n/** The package version. All `@mindees/*` packages share one locked version line. */\nexport const VERSION = '0.14.0'\n\n/** Current maturity of this package. See the repository `STATUS.md`. */\nexport const maturity: Maturity = 'experimental'\n\n/**\n * Static identity + maturity metadata for this package. Frozen so the\n * self-reported identity tooling introspects cannot be mutated at runtime,\n * matching the `readonly` fields of {@link PackageInfo}.\n */\nexport const info: PackageInfo = Object.freeze({ name, version: VERSION, maturity })\n\nexport { type A11yProps, type A11yState, type Role, toA11yProps } from './a11y'\nexport {\n Accordion,\n type AccordionProps,\n type AccordionSection,\n ActivityIndicator,\n type ActivityIndicatorProps,\n Avatar,\n type AvatarProps,\n Badge,\n type BadgeProps,\n Card,\n type CardProps,\n Checkbox,\n type CheckboxProps,\n Chip,\n type ChipProps,\n Divider,\n type DividerProps,\n KeyboardAvoidingView,\n type KeyboardAvoidingViewProps,\n ProgressBar,\n type ProgressBarProps,\n RadioGroup,\n type RadioGroupProps,\n type RadioOption,\n SafeAreaView,\n type SafeAreaViewProps,\n type Segment,\n SegmentedControl,\n type SegmentedControlProps,\n Skeleton,\n type SkeletonProps,\n Stepper,\n type StepperProps,\n Switch,\n type SwitchProps,\n type TabItem,\n Tabs,\n type TabsProps,\n} from './components'\nexport {\n type ColorScheme,\n getEnvironment,\n type KeyboardState,\n type PlatformEnvironment,\n type SafeAreaInsets,\n setEnvironment,\n useColorScheme,\n useKeyboard,\n useSafeAreaInsets,\n useWindowDimensions,\n type WindowDimensions,\n} from './environment'\nexport { type Field, type FormApi, type UseFormOptions, useForm } from './form'\nexport { type AttachableGesture, GestureView, type GestureViewProps } from './gesture'\nexport {\n type AsyncState,\n type Counter,\n type PersistentSignalOptions,\n type SignalStorage,\n type Toggle,\n useAsync,\n useCounter,\n useDebounce,\n useInterval,\n usePersistentSignal,\n usePrevious,\n useReducer,\n useTimeout,\n useToggle,\n} from './hooks'\nexport { type BaseProps, type Reactive, resolveStyle, toHostProps } from './host'\nexport { animateTo, motion } from './motion'\nexport {\n FocusScope,\n type FocusScopeProps,\n Modal,\n type ModalProps,\n Toast,\n type ToastProps,\n} from './overlay'\nexport {\n Button,\n type ButtonProps,\n Column,\n Image,\n type ImageProps,\n type InteractionState,\n Pressable,\n type PressableProps,\n Row,\n ScrollView,\n type ScrollViewProps,\n Spacer,\n type SpacerProps,\n Stack,\n type StackProps,\n Text,\n TextInput,\n type TextInputProps,\n type TextProps,\n usePressable,\n View,\n type ViewProps,\n} from './primitives'\nexport { flattenStyle, type StyleInput, type StyleObject, type StyleValue } from './style'\nexport {\n duration,\n easing,\n fontSize,\n fontWeight,\n getTheme,\n lineHeight,\n palette,\n radius,\n space,\n type Theme,\n type ThemeColors,\n tokens,\n useTheme,\n} from './tokens'\nexport type { Maturity, PackageInfo }\nexport { NotImplementedError, notImplemented }\n"],"mappings":";;;;;;;;;;;;;;;AAeA,MAAa,OAAO;;AAGpB,MAAa,UAAU;;AAGvB,MAAa,WAAqB;;;;;;AAOlC,MAAa,OAAoB,OAAO,OAAO;CAAE;CAAM,SAAS;CAAS;AAAS,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mindees/atlas",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.14.0",
|
|
4
4
|
"description": "MindeesNative Atlas - accessible, signals-native UI primitives + a virtualized recycling list. Renderer-agnostic (web real, native research track).",
|
|
5
5
|
"license": "MIT OR Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
@@ -39,12 +39,12 @@
|
|
|
39
39
|
"directory": "packages/atlas"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@mindees/core": "0.
|
|
43
|
-
"@mindees/router": "0.
|
|
42
|
+
"@mindees/core": "0.14.0",
|
|
43
|
+
"@mindees/router": "0.14.0"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
46
|
"happy-dom": "20.9.0",
|
|
47
|
-
"@mindees/renderer": "0.
|
|
47
|
+
"@mindees/renderer": "0.14.0"
|
|
48
48
|
},
|
|
49
49
|
"scripts": {
|
|
50
50
|
"build": "tsdown",
|