@mindees/core 0.13.0 โ 0.15.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 +70 -5
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -4,12 +4,17 @@ The reactive runtime foundation of MindeesNative โ a fast, fine-grained
|
|
|
4
4
|
**signals** library (the same reactivity model behind SolidJS and modern
|
|
5
5
|
frameworks), written in strict TypeScript.
|
|
6
6
|
|
|
7
|
-
> **Status: ๐งช Experimental (
|
|
7
|
+
> **Status: ๐งช Experimental (pre-1.0).** Implemented and thoroughly tested:
|
|
8
8
|
> the **reactivity** layer (`signal`, `computed`/`memo`, `effect`, `batch`,
|
|
9
|
-
> `untrack`, `createRoot`, `onCleanup
|
|
10
|
-
>
|
|
11
|
-
>
|
|
12
|
-
>
|
|
9
|
+
> `untrack`, `createRoot`, `onCleanup`, plus `startTransition`/`deferred` and a
|
|
10
|
+
> pluggable reactive scheduler), the **component model** (element tree +
|
|
11
|
+
> selector-based, re-render-isolated context, portals, keyed regions), the
|
|
12
|
+
> **priority scheduler**, a **thread-pool** abstraction (Web Worker backend +
|
|
13
|
+
> inline fallback), the **animation engine** (reactive animated values with
|
|
14
|
+
> timing/spring drivers + `interpolate`, RN `Animated`/Reanimated + Flutter
|
|
15
|
+
> `AnimationController` parity), and **gesture recognizers** (tap, longPress,
|
|
16
|
+
> pan, pinch, swipe โ reactive state, RN Gesture Handler / Flutter
|
|
17
|
+
> `GestureDetector` parity). APIs may still change before `1.0`.
|
|
13
18
|
|
|
14
19
|
## Install
|
|
15
20
|
|
|
@@ -63,6 +68,9 @@ depend on a changed value re-run โ no virtual-DOM diffing, no manual
|
|
|
63
68
|
| `effect(fn)` | fn | Re-runs on dependency change; returns a disposer; supports `onCleanup`. |
|
|
64
69
|
| `batch(fn)` | fn | Coalesce writes; effects run once at the end. |
|
|
65
70
|
| `untrack(fn)` | fn | Read without subscribing. |
|
|
71
|
+
| `startTransition(fn)` | fn | Mark writes as low-priority (deferred) updates. |
|
|
72
|
+
| `deferred(source)` | fn | A derived accessor that lags `source` to a lower priority lane. |
|
|
73
|
+
| `setReactiveScheduler(s)` | fn | Route reactive effects through a custom `Scheduler` (or `null` to reset). |
|
|
66
74
|
| `createRoot(fn)` | fn | Non-tracked owner scope with manual `dispose`. |
|
|
67
75
|
| `onCleanup(fn)` | fn | Register teardown for the current scope. |
|
|
68
76
|
| `getOwner` / `runWithOwner` | fn | Inspect / re-enter an ownership scope. |
|
|
@@ -101,6 +109,8 @@ await pool.run((n) => fib(n), 40)
|
|
|
101
109
|
| --- | --- | --- |
|
|
102
110
|
| `createElement` / `Fragment` / `isElement` | fn | Renderer-agnostic element tree. |
|
|
103
111
|
| `createContext` / `createProvider` | fn | Selector-based, **re-render-isolated** context. |
|
|
112
|
+
| `portal` / `isPortal` | fn | Render a subtree into a different host region (overlays/modals/toasts). |
|
|
113
|
+
| `keyedRegion` / `isKeyedRegion` | fn | Keyed list region for stable, reconciled reordering. |
|
|
104
114
|
| `renderComponent` | fn | Run a component in a disposable owner scope. |
|
|
105
115
|
| `createScheduler` / `Scheduler` | fn | Two-lane priority scheduler (cancellable, dedupable). |
|
|
106
116
|
| `createWorkerPool` / `createInlineThreadPool` | fn | `ThreadPool` backends (web + fallback). |
|
|
@@ -109,6 +119,61 @@ await pool.run((n) => fib(n), 40)
|
|
|
109
119
|
> Native multi-threading is a **research track** (honest `NotImplementedError`);
|
|
110
120
|
> the Web Worker and inline backends work today.
|
|
111
121
|
|
|
122
|
+
## Animation engine
|
|
123
|
+
|
|
124
|
+
RN `Animated`/Reanimated + Flutter `AnimationController` parity, built entirely on
|
|
125
|
+
the reactive core. An `AnimatedValue` **is a signal**, so reading it inside a
|
|
126
|
+
`style` accessor re-renders only that node. One injected `FrameSource` drives a
|
|
127
|
+
single loop that ticks every active driver inside one `batch()` per frame โ so a
|
|
128
|
+
style reading several animated values recomputes once (glitch-free). With no frame
|
|
129
|
+
source (SSR / headless / tests until one is wired), animations **jump to their
|
|
130
|
+
final value** synchronously: deterministic, never a hang.
|
|
131
|
+
|
|
132
|
+
```ts
|
|
133
|
+
import { animate, timing, spring, interpolate } from '@mindees/core'
|
|
134
|
+
|
|
135
|
+
const x = animate(0)
|
|
136
|
+
timing(x, { to: 100, duration: 250 }) // duration driver
|
|
137
|
+
spring(x, { to: 100, stiffness: 180 }) // physics driver (velocity-preserving)
|
|
138
|
+
|
|
139
|
+
const opacity = interpolate(x, [0, 100], [0, 1]) // map a range to a range
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
| Export | Kind | Description |
|
|
143
|
+
| --- | --- | --- |
|
|
144
|
+
| `animate(initial)` | fn | Create a reactive `AnimatedValue` (a signal you can drive). |
|
|
145
|
+
| `timing` / `spring` | fn | Duration and physics drivers; return an `AnimationHandle` (`stop()` + awaitable `done`). |
|
|
146
|
+
| `interpolate(src, inRange, outRange)` | fn | Map an input range to an output range. |
|
|
147
|
+
| `linear` / `easeInQuad` / `easeOutQuad` / `easeInOutQuad` / `easeOutCubic` / `cubicBezier` | fn | Easing curves. |
|
|
148
|
+
| `setFrameSource` / `getFrameSource` / `rafFrameSource` / `manualFrameSource` | fn | Inject the per-frame clock (rAF on web, vsync on native, manual in tests). |
|
|
149
|
+
|
|
150
|
+
## Gesture recognizers
|
|
151
|
+
|
|
152
|
+
RN Gesture Handler / Flutter `GestureDetector` parity, built on the reactive core.
|
|
153
|
+
Each factory returns a `Recognizer`: a bag of pointer-event handlers to spread onto
|
|
154
|
+
a host element, plus **reactive state** (signals) you read in a `style` accessor or
|
|
155
|
+
feed straight into the animation engine. The only platform-aware code is
|
|
156
|
+
`normalizePointer`, so recognizers run on web (Pointer Events), native (the
|
|
157
|
+
command-backend payload), and tests (synthetic events), and SSR safely.
|
|
158
|
+
|
|
159
|
+
```ts
|
|
160
|
+
import { pan, tap, composeGestures } from '@mindees/core'
|
|
161
|
+
|
|
162
|
+
const drag = pan({ axis: 'both' })
|
|
163
|
+
// drag.state is a bag of accessor signals: drag.state.translationX(), .active(), โฆ
|
|
164
|
+
// spread drag.handlers onto a host element. Compose recognizers onto ONE element
|
|
165
|
+
// (the renderer binds a single listener per event, so spreading two would drop one):
|
|
166
|
+
const merged = composeGestures([drag, tap({})])
|
|
167
|
+
// โ spread merged.handlers; read each recognizer's own .state
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
| Export | Kind | Description |
|
|
171
|
+
| --- | --- | --- |
|
|
172
|
+
| `tap` / `longPress` / `pan` / `pinch` / `swipe` | fn | Recognizers โ `{ handlers, state }`; `state` is a bag of accessor signals. |
|
|
173
|
+
| `panAnimated(x, y, opts?)` | fn | A pan recognizer wired to drive two `AnimatedValue`s directly (with optional release snap). |
|
|
174
|
+
| `composeGestures(recognizers)` | fn | Merge an array of recognizers onto one element (one listener per event). |
|
|
175
|
+
| `normalizePointer` | fn | Platform-agnostic pointer-sample normalization. |
|
|
176
|
+
|
|
112
177
|
## License
|
|
113
178
|
|
|
114
179
|
`MIT OR Apache-2.0`
|
package/dist/index.d.ts
CHANGED
|
@@ -14,7 +14,7 @@ import { ThreadPool, WorkerLike, WorkerPoolOptions, createInlineThreadPool, crea
|
|
|
14
14
|
/** The npm package name. */
|
|
15
15
|
declare const name = "@mindees/core";
|
|
16
16
|
/** The package version. All `@mindees/*` packages share one locked version line. */
|
|
17
|
-
declare const VERSION = "0.
|
|
17
|
+
declare const VERSION = "0.15.0";
|
|
18
18
|
/**
|
|
19
19
|
* Current maturity of this package. See the repository `STATUS.md`.
|
|
20
20
|
*
|
package/dist/index.js
CHANGED
|
@@ -12,7 +12,7 @@ import { createInlineThreadPool, createNativeThreadPool, createWorkerPool } from
|
|
|
12
12
|
/** The npm package name. */
|
|
13
13
|
const name = "@mindees/core";
|
|
14
14
|
/** The package version. All `@mindees/*` packages share one locked version line. */
|
|
15
|
-
const VERSION = "0.
|
|
15
|
+
const VERSION = "0.15.0";
|
|
16
16
|
/**
|
|
17
17
|
* Current maturity of this package. See the repository `STATUS.md`.
|
|
18
18
|
*
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../src/index.ts"],"sourcesContent":["import type { Maturity, PackageInfo } from './types'\n\n/**\n * Animation engine: reactive animated values + timing/spring drivers + interpolate, driven by an\n * injected frame source (RN Animated/Reanimated + Flutter AnimationController parity).\n */\nexport {\n _activeAnimationCount,\n _resetAnimation,\n type AnimatedValue,\n type AnimationHandle,\n animate,\n cubicBezier,\n type Easing,\n easeInOutQuad,\n easeInQuad,\n easeOutCubic,\n easeOutQuad,\n type FrameSource,\n getFrameSource,\n interpolate,\n linear,\n manualFrameSource,\n rafFrameSource,\n setFrameSource,\n spring,\n timing,\n} from './animation'\n/**\n * Component model: a renderer-agnostic element tree plus selector-based,\n * re-render-isolated context. (Phase 2)\n */\nexport {\n type Component,\n type Context,\n type ContextProvider,\n createContext,\n createElement,\n createProvider,\n ELEMENT_TYPE,\n type ElementType,\n Fragment,\n hasOwner,\n isElement,\n isKeyedRegion,\n isPortal,\n KEYED_REGION,\n type KeyedRegion,\n type KeyedRegionOptions,\n keyedRegion,\n type MindeesElement,\n type MindeesNode,\n PORTAL,\n type PortalRegion,\n portal,\n renderComponent,\n type SelectorEquals,\n} from './component'\nexport { NotImplementedError } from './errors'\n/**\n * Gesture recognizers: tap/longPress/pan/pinch/swipe โ reactive state that drives styles and the\n * animation engine (RN Gesture Handler / Flutter GestureDetector parity).\n */\nexport {\n _setGestureClock,\n composeGestures,\n type GestureHandlers,\n longPress,\n normalizePointer,\n type PanEvent,\n type PanState,\n type PinchEvent,\n type PinchState,\n type PointerSample,\n pan,\n panAnimated,\n pinch,\n type Recognizer,\n type SwipeDirection,\n type SwipeEvent,\n swipe,\n type TapState,\n tap,\n} from './gesture'\nexport { notImplemented } from './not-implemented'\n/**\n * Fine-grained reactivity: signals, computed values, effects, batching, and\n * disposal scopes. This is the reactive core of MindeesNative.\n */\nexport {\n type Accessor,\n batch,\n type ComputedOptions,\n computed,\n createRoot,\n deferred,\n type EffectOptions,\n type EqualsFn,\n effect,\n getOwner,\n type Memo,\n memo,\n type Owner,\n onCleanup,\n runWithOwner,\n type Signal,\n type SignalOptions,\n setReactiveScheduler,\n signal,\n startTransition,\n untrack,\n} from './reactive'\n/**\n * Priority scheduler: two-lane (sync/normal), microtask-batched, with\n * cancellable and dedupable tasks. (Phase 2)\n */\nexport {\n createScheduler,\n type Priority,\n type ScheduledTask,\n type ScheduleOptions,\n Scheduler,\n type SchedulerOptions,\n type Task,\n} from './scheduler'\n/**\n * Threading abstraction: a {@link ThreadPool} contract with a working Web Worker\n * backend and an inline fallback. Native multi-threading is a research track. (Phase 2)\n */\nexport {\n createInlineThreadPool,\n createNativeThreadPool,\n createWorkerPool,\n type ThreadPool,\n type WorkerLike,\n type WorkerPoolOptions,\n} from './threading'\nexport type { Maturity, PackageInfo } from './types'\n\n/** The npm package name. */\nexport const name = '@mindees/core'\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":["import type { Maturity, PackageInfo } from './types'\n\n/**\n * Animation engine: reactive animated values + timing/spring drivers + interpolate, driven by an\n * injected frame source (RN Animated/Reanimated + Flutter AnimationController parity).\n */\nexport {\n _activeAnimationCount,\n _resetAnimation,\n type AnimatedValue,\n type AnimationHandle,\n animate,\n cubicBezier,\n type Easing,\n easeInOutQuad,\n easeInQuad,\n easeOutCubic,\n easeOutQuad,\n type FrameSource,\n getFrameSource,\n interpolate,\n linear,\n manualFrameSource,\n rafFrameSource,\n setFrameSource,\n spring,\n timing,\n} from './animation'\n/**\n * Component model: a renderer-agnostic element tree plus selector-based,\n * re-render-isolated context. (Phase 2)\n */\nexport {\n type Component,\n type Context,\n type ContextProvider,\n createContext,\n createElement,\n createProvider,\n ELEMENT_TYPE,\n type ElementType,\n Fragment,\n hasOwner,\n isElement,\n isKeyedRegion,\n isPortal,\n KEYED_REGION,\n type KeyedRegion,\n type KeyedRegionOptions,\n keyedRegion,\n type MindeesElement,\n type MindeesNode,\n PORTAL,\n type PortalRegion,\n portal,\n renderComponent,\n type SelectorEquals,\n} from './component'\nexport { NotImplementedError } from './errors'\n/**\n * Gesture recognizers: tap/longPress/pan/pinch/swipe โ reactive state that drives styles and the\n * animation engine (RN Gesture Handler / Flutter GestureDetector parity).\n */\nexport {\n _setGestureClock,\n composeGestures,\n type GestureHandlers,\n longPress,\n normalizePointer,\n type PanEvent,\n type PanState,\n type PinchEvent,\n type PinchState,\n type PointerSample,\n pan,\n panAnimated,\n pinch,\n type Recognizer,\n type SwipeDirection,\n type SwipeEvent,\n swipe,\n type TapState,\n tap,\n} from './gesture'\nexport { notImplemented } from './not-implemented'\n/**\n * Fine-grained reactivity: signals, computed values, effects, batching, and\n * disposal scopes. This is the reactive core of MindeesNative.\n */\nexport {\n type Accessor,\n batch,\n type ComputedOptions,\n computed,\n createRoot,\n deferred,\n type EffectOptions,\n type EqualsFn,\n effect,\n getOwner,\n type Memo,\n memo,\n type Owner,\n onCleanup,\n runWithOwner,\n type Signal,\n type SignalOptions,\n setReactiveScheduler,\n signal,\n startTransition,\n untrack,\n} from './reactive'\n/**\n * Priority scheduler: two-lane (sync/normal), microtask-batched, with\n * cancellable and dedupable tasks. (Phase 2)\n */\nexport {\n createScheduler,\n type Priority,\n type ScheduledTask,\n type ScheduleOptions,\n Scheduler,\n type SchedulerOptions,\n type Task,\n} from './scheduler'\n/**\n * Threading abstraction: a {@link ThreadPool} contract with a working Web Worker\n * backend and an inline fallback. Native multi-threading is a research track. (Phase 2)\n */\nexport {\n createInlineThreadPool,\n createNativeThreadPool,\n createWorkerPool,\n type ThreadPool,\n type WorkerLike,\n type WorkerPoolOptions,\n} from './threading'\nexport type { Maturity, PackageInfo } from './types'\n\n/** The npm package name. */\nexport const name = '@mindees/core'\n\n/** The package version. All `@mindees/*` packages share one locked version line. */\nexport const VERSION = '0.15.0'\n\n/**\n * Current maturity of this package. See the repository `STATUS.md`.\n *\n * The reactivity layer (signals/computed/effect/batch), the component model with\n * selector-isolated context, the priority scheduler, and the thread-pool\n * abstraction (Web Worker + inline) are all implemented and tested. Native\n * multi-threading remains a research track (throws `NotImplementedError`).\n */\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"],"mappings":";;;;;;;;;;;;AA4IA,MAAa,OAAO;;AAGpB,MAAa,UAAU;;;;;;;;;AAUvB,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/core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.15.0",
|
|
4
4
|
"description": "MindeesNative core โ fine-grained reactivity (signals/computed/effect/batch), component model with selector-isolated context, priority scheduler, and a thread-pool abstraction (Web Worker + inline; native is a research track).",
|
|
5
5
|
"license": "MIT OR Apache-2.0",
|
|
6
6
|
"type": "module",
|