@atom.io/spa 0.0.5 → 0.0.7
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 +381 -10
- package/README.mdx +101 -5
- package/dist/astro-application.d.ts +1 -1
- package/dist/astro-client.d.ts +1 -1
- package/dist/astro-client.js +2 -2
- package/dist/astro-request-DRKvDjsO.js.map +1 -1
- package/dist/astro-resumability-client.d.ts +1 -1
- package/dist/astro-server.js +1 -1
- package/dist/{astro-shared-DHIpjNIG.d.ts → astro-shared-DZp1x8RQ.d.ts} +2 -2
- package/dist/{astro-shared-DHIpjNIG.d.ts.map → astro-shared-DZp1x8RQ.d.ts.map} +1 -1
- package/dist/astro.d.ts +1 -1
- package/dist/astro.js +1 -1
- package/dist/{capabilities-BCtBG-ni.d.ts → capabilities-DNcnGRv_.d.ts} +11 -5
- package/dist/capabilities-DNcnGRv_.d.ts.map +1 -0
- package/dist/{capabilities-BkQ2i0vV.js → capabilities-nOIitQ-_.js} +6 -4
- package/dist/capabilities-nOIitQ-_.js.map +1 -0
- package/dist/client.min.js +1 -1
- package/dist/{core-DjFJ0aIJ.js → core-B4rJ0xdc.js} +22 -12
- package/dist/core-B4rJ0xdc.js.map +1 -0
- package/dist/development/astro-client.js +2 -2
- package/dist/development/astro-request-DRKvDjsO.js.map +1 -1
- package/dist/development/astro-server.js +1 -1
- package/dist/development/astro.js +1 -1
- package/dist/development/{capabilities-BkQ2i0vV.js → capabilities-nOIitQ-_.js} +6 -4
- package/dist/development/capabilities-nOIitQ-_.js.map +1 -0
- package/dist/development/{core-DxPiKryn.js → core-BHA7I1nf.js} +24 -14
- package/dist/development/core-BHA7I1nf.js.map +1 -0
- package/dist/development/{dom-BytVV6Rp.js → dom-DQ0M3rLL.js} +11 -10
- package/dist/development/{dom-BytVV6Rp.js.map → dom-DQ0M3rLL.js.map} +1 -1
- package/dist/development/floating.js +148 -0
- package/dist/development/floating.js.map +1 -0
- package/dist/development/index.js +4 -4
- package/dist/development/jsx-runtime.js +2 -2
- package/dist/development/jsx-runtime.js.map +1 -1
- package/dist/development/konva.js +2 -2
- package/dist/development/motion.js +419 -25
- package/dist/development/motion.js.map +1 -1
- package/dist/development/renderer.js +2 -2
- package/dist/development/{server-renderer-CUQXh9oF.js → server-renderer-DCLoMdOX.js} +3 -3
- package/dist/development/{server-renderer-CUQXh9oF.js.map → server-renderer-DCLoMdOX.js.map} +1 -1
- package/dist/development/server.js +1 -1
- package/dist/{src-DWIqXCiz.js → development/src-DoQgCX-O.js} +2 -2
- package/dist/development/{src-WSHJxR9b.js.map → src-DoQgCX-O.js.map} +1 -1
- package/dist/development/three.js +87 -31
- package/dist/development/three.js.map +1 -1
- package/dist/development/{vite-CSHoxzXU.js → vite-Bmyb6P5w.js} +32 -7
- package/dist/development/vite-Bmyb6P5w.js.map +1 -0
- package/dist/development/vite.js +1 -1
- package/dist/{dom-B5OxgHkr.js → dom-D8g3roX9.js} +11 -10
- package/dist/{dom-B5OxgHkr.js.map → dom-D8g3roX9.js.map} +1 -1
- package/dist/floating.d.ts +16 -0
- package/dist/floating.d.ts.map +1 -0
- package/dist/floating.js +148 -0
- package/dist/floating.js.map +1 -0
- package/dist/{index-DufwkB6W.d.ts → index-BFnXIfOj.d.ts} +3 -3
- package/dist/{index-DufwkB6W.d.ts.map → index-BFnXIfOj.d.ts.map} +1 -1
- package/dist/index.d.ts +4 -4
- package/dist/index.js +4 -4
- package/dist/{jsx-runtime-DMDVr7A5.d.ts → jsx-runtime-DQnpyT_g.d.ts} +2 -2
- package/dist/{jsx-runtime-DMDVr7A5.d.ts.map → jsx-runtime-DQnpyT_g.d.ts.map} +1 -1
- package/dist/jsx-runtime.d.ts +1 -1
- package/dist/jsx-runtime.js +2 -2
- package/dist/jsx-runtime.js.map +1 -1
- package/dist/konva.d.ts +3 -3
- package/dist/konva.js +2 -2
- package/dist/motion.d.ts +39 -16
- package/dist/motion.d.ts.map +1 -1
- package/dist/motion.js +419 -25
- package/dist/motion.js.map +1 -1
- package/dist/renderer.d.ts +1 -1
- package/dist/renderer.js +2 -2
- package/dist/{server-renderer-DcU55e6s.js → server-renderer-D0rsFL_-.js} +3 -3
- package/dist/{server-renderer-DcU55e6s.js.map → server-renderer-D0rsFL_-.js.map} +1 -1
- package/dist/server.d.ts +1 -1
- package/dist/server.js +1 -1
- package/dist/size.json +12 -12
- package/dist/{development/src-WSHJxR9b.js → src-Bme1kz2b.js} +2 -2
- package/dist/{src-DWIqXCiz.js.map → src-Bme1kz2b.js.map} +1 -1
- package/dist/three.d.ts +27 -8
- package/dist/three.d.ts.map +1 -1
- package/dist/three.js +87 -31
- package/dist/three.js.map +1 -1
- package/dist/{vite-CSHoxzXU.js → vite-Bmyb6P5w.js} +32 -7
- package/dist/vite-Bmyb6P5w.js.map +1 -0
- package/dist/vite.js +1 -1
- package/package.json +18 -5
- package/src/astro-request.ts +1 -1
- package/src/capabilities.ts +11 -4
- package/src/compiler.ts +28 -9
- package/src/core.ts +26 -12
- package/src/dom.ts +12 -11
- package/src/floating.ts +234 -0
- package/src/index.ts +1 -0
- package/src/jsx-runtime.ts +4 -1
- package/src/motion-layout.ts +363 -0
- package/src/motion-transition.ts +92 -0
- package/src/motion-tween.ts +19 -2
- package/src/motion.ts +215 -77
- package/src/presence.ts +1 -1
- package/src/three-events.ts +14 -10
- package/src/three.ts +134 -39
- package/dist/capabilities-BCtBG-ni.d.ts.map +0 -1
- package/dist/capabilities-BkQ2i0vV.js.map +0 -1
- package/dist/core-DjFJ0aIJ.js.map +0 -1
- package/dist/development/capabilities-BkQ2i0vV.js.map +0 -1
- package/dist/development/core-DxPiKryn.js.map +0 -1
- package/dist/development/vite-CSHoxzXU.js.map +0 -1
- package/dist/vite-CSHoxzXU.js.map +0 -1
package/README.mdx
CHANGED
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
import StateLifetimes from "./exhibits/state-lifetimes.tsx" with {
|
|
2
|
+
type: "code",
|
|
3
|
+
};
|
|
4
|
+
import MotionKeyframes from "./exhibits/motion-keyframes.tsx" with {
|
|
5
|
+
type: "code",
|
|
6
|
+
};
|
|
7
|
+
import ConfigurableCanvas from "./exhibits/configurable-canvas.tsx" with {
|
|
8
|
+
type: "code",
|
|
9
|
+
};
|
|
1
10
|
import { Tonnage } from "tonnage";
|
|
2
11
|
import config from "./tonnage.config.ts";
|
|
3
12
|
import StoreExample from "./exhibits/store.tsx" with { type: "code" };
|
|
@@ -23,6 +32,13 @@ import MotionPanel from "./exhibits/motion.tsx" with { type: "code" };
|
|
|
23
32
|
import MotionMain from "./exhibits/motion-main.tsx" with { type: "code" };
|
|
24
33
|
import MotionExit from "./exhibits/motion-exit.tsx" with { type: "code" };
|
|
25
34
|
import MotionThree from "./exhibits/motion-three.tsx" with { type: "code" };
|
|
35
|
+
import InstallFloating from "./exhibits/install-floating.sh" with {
|
|
36
|
+
type: "code",
|
|
37
|
+
};
|
|
38
|
+
import LayoutExample from "./exhibits/layout.tsx" with { type: "code" };
|
|
39
|
+
import LayoutMain from "./exhibits/layout-main.tsx" with { type: "code" };
|
|
40
|
+
import FloatingMain from "./exhibits/floating-main.tsx" with { type: "code" };
|
|
41
|
+
import FloatingExample from "./exhibits/floating.tsx" with { type: "code" };
|
|
26
42
|
|
|
27
43
|
<p align="center">
|
|
28
44
|
<img src="https://raw.githubusercontent.com/jeremybanka/atom.io/main/apps/atom.io.fyi/public/spa/icon-512.png" alt="SPA logo" width="160" height="160" />
|
|
@@ -48,6 +64,8 @@ For manual setup, see the [Astro](https://atom.io.fyi/docs/spa/astro) and [Vite]
|
|
|
48
64
|
|
|
49
65
|
Name the getter and setter after the atom: pointAtom uses getPoint and setPoint. The getPoint getter returns the current object. Each JSX attribute reads its coordinate when evaluated. Both bindings depend on the point atom, and unchanged primitive results skip DOM writes. Reads during setup are snapshots; reads in event handlers are current and untracked. Shared derived state belongs in atom.io selectors.
|
|
50
66
|
|
|
67
|
+
Component children follow the same getter contract as named props. A component declaring string children reads a string for both literal text and expression children, including an explicit children attribute. Read props.children inside compiled JSX or a tracked binding for reactive updates; setup reads capture a snapshot. Deliberately function-valued children remain functions, including render callbacks.
|
|
68
|
+
|
|
51
69
|
## Astro
|
|
52
70
|
|
|
53
71
|
Register the Astro integration, which compiles .tsx and .jsx components by default:
|
|
@@ -84,6 +102,7 @@ The development plugin keeps SPA and atom.io outside dependency prebundling so r
|
|
|
84
102
|
| ----------------------------- | ------------------------------------------------------------------------------------------------------------------------ |
|
|
85
103
|
| useLoadable(token, fallback?) | Return a tracked accessor for loading, last-observed values, and handled errors. |
|
|
86
104
|
| useGetter(token) | Return a live accessor for an atom or selector, bound to this instance's store. |
|
|
105
|
+
| useDisposal() | Return atom.io state disposal bound to the current root's store. |
|
|
87
106
|
| useSetter(token) | Return a stable atom.io writer. |
|
|
88
107
|
| useTimeline(token) | Return a stable object with getCursor/getLength readers, undo/redo/clear commands, and transaction-group controls. |
|
|
89
108
|
| useTransaction(token) | Bind an atom.io transaction, preserving its arguments and result. |
|
|
@@ -111,7 +130,7 @@ useStore returns the current root's atom.io RootStore directly. It is the same o
|
|
|
111
130
|
|
|
112
131
|
<StoreExample />
|
|
113
132
|
|
|
114
|
-
Capture the store during component setup or an owned onMount callback, then pass it to store-aware atom.io operations or integrations. Getting the store creates no subscription. Direct reads such as getFromStore do not participate in SPA's dependency tracking; useGetter and useLoadable provide tracked reads. The returned object is a store, not a Silo or a new wrapper.
|
|
133
|
+
For family-member disposal, useDisposal() captures this store and returns a bound disposal command; see [ambient UI state](#ambient-ui-state-and-ownership). Capture the store during component setup or an owned onMount callback, then pass it to other store-aware atom.io operations or integrations. Getting the store creates no subscription. Direct reads such as getFromStore do not participate in SPA's dependency tracking; useGetter and useLoadable provide tracked reads. The returned object is a store, not a Silo or a new wrapper.
|
|
115
134
|
|
|
116
135
|
## Families
|
|
117
136
|
|
|
@@ -121,6 +140,22 @@ useGetter, useSetter, useRef, and useTimeline accept a family token followed by
|
|
|
121
140
|
|
|
122
141
|
The family and key are captured during setup and stay fixed for that component instance. To switch members, replace the component in a reactive child collection with a new application key. Ref ownership and subscription cleanup follow the member just as they do for individual tokens. useTransaction takes a transaction token; atom.io has no transaction-family token.
|
|
123
142
|
|
|
143
|
+
### Ambient UI state and ownership
|
|
144
|
+
|
|
145
|
+
Ambient state is useful for ephemeral UI flags that several components need to read or change, such as whether a popover is open. Define the family at module scope and give each popover an application identity. Its trigger and panel can bind to the same boolean without passing the value and setter through their parent.
|
|
146
|
+
|
|
147
|
+
This exhibit gives each toolbar its own formatting and keyboard-shortcut help popovers. Hiding formatting help removes its keyed instance and disposes its visibility state. Showing it again starts closed; the shortcuts popover and other toolbars keep their state:
|
|
148
|
+
|
|
149
|
+
<StateLifetimes />
|
|
150
|
+
|
|
151
|
+
The reconciliation key identifies a component among siblings. The family key identifies application state across the whole store: the tuple includes both the toolbar ID and help topic so separate toolbars do not share visibility by accident. The toolbar ID must be unique within that store. The renderer consumes key; pass the state identity as an ordinary prop.
|
|
152
|
+
|
|
153
|
+
Call useDisposal() without arguments during setup. It captures the current root's store and returns atom.io disposal, accepting either a family and key or an existing member token. Invoke it from an event handler or register it with onCleanup. It works with the implicit store, render/hydrate options.store, and isolated Astro stores without passing a disposal callback through props. Custom stores still need the module-scope definitions installed through Silo.install.
|
|
154
|
+
|
|
155
|
+
HelpPopover owns the visibility member shared by its trigger and panel, so it disposes that member after both consumers are removed. A single consumer must not dispose state that other live consumers still need. Shared session or application state belongs to the owner that knows when every consumer has finished. Standalone atoms persist for their store's lifetime; disposal removes family members, not standalone atoms.
|
|
156
|
+
|
|
157
|
+
Getter and setter bindings capture their family key during setup. Replacing a keyed instance changes its binding; changing an identity prop on an existing instance does not rebind it. Disposing a family member removes its stored value and resources; a later read recreates it from its default. Keep user-authored content in state whose owner matches its intended persistence, rather than treating it like a popover's transient visibility.
|
|
158
|
+
|
|
124
159
|
## Async state
|
|
125
160
|
|
|
126
161
|
<LoadableExample />
|
|
@@ -173,7 +208,7 @@ The checked Astro fixture demonstrates default/named slots and custom independen
|
|
|
173
208
|
|
|
174
209
|
The build audits every browser export, including the JSX runtime, from the built JavaScript. Atom.io is an external peer in the incremental measurement. Compiler, server, and integration code have separate entrypoints. The report also includes the complete client plus atom.io, the Astro client entrypoint, and the installed Preact version under the same bundling/minification settings. These are full exported surfaces, not equivalent application benchmarks.
|
|
175
210
|
|
|
176
|
-
The hard budget is under 4,
|
|
211
|
+
The hard budget is under 4,400 bytes of ordinary level-9 gzip for the complete client export surface, including hydration recovery and its production diagnostics. Tsdown builds the package JavaScript and declarations, with separate production and development outputs that each share their runtime across entrypoints. The size audit then bundles the built exports with esbuild, minifies with Oxc, and measures compression using Node's gzip and Brotli implementations. The complete client export surface measures approximately 4.3 kB with gzip; dist/size.json records the exact build measurements. Actual application bundles add atom.io and compiler-generated application code.
|
|
177
212
|
|
|
178
213
|
Build output includes the minified audit entrypoint and machine-readable dist/size.json. These audit files are a bundled measurement; use the package exports in applications so the bundler preserves one runtime instance across entrypoints. Source tests exercise development behavior; the production test executes the audited minified artifact. Chromium checks exercise the actual Astro build, island isolation, hydration, keyed identity, focus/selection, SVG namespaces, and teardown. A fresh-cache Astro development check also covers mount hooks, shared state, and ClientRouter navigation.
|
|
179
214
|
|
|
@@ -209,8 +244,16 @@ Import Canvas, Group, Mesh, PerspectiveCamera, AmbientLight, DirectionalLight, B
|
|
|
209
244
|
|
|
210
245
|
<ThreeExample />
|
|
211
246
|
|
|
247
|
+
Mesh accepts optional constructor args typed from Three.js, including custom BufferGeometry and a Material or material array. Resources supplied in args are borrowed: their application owner disposes them after all consumers finish. JSX geometry/material children and implicit Mesh defaults remain renderer-owned. Constructor args are fixed for the mounted instance; use a new reconciliation key to replace them.
|
|
248
|
+
|
|
212
249
|
Constructor args are fixed for an instance. To change them, replace the resource with a new key in a reactive child collection. Refs expose native objects. Owned geometries and materials are disposed on removal; textures passed through material properties remain borrowed. Canvas stops drawing and disposes its renderer on removal. The exported threeRenderer renders into a borrowed parent dedicated to its children without creating a WebGL renderer.
|
|
213
250
|
|
|
251
|
+
Canvas accepts rendererOptions for constructor-time settings such as alpha and powerPreference, or createRenderer to construct the renderer with the supplied canvas. Both paths are exclusively owned by Canvas: it disposes the renderer on removal or setup failure, and the factory must return a renderer using that canvas. Shared/borrowed renderers are not supported by this boundary; use threeRenderer for a separately owned renderer. Options and the factory are captured at mount; replace the keyed Canvas to reconstruct its context.
|
|
252
|
+
|
|
253
|
+
Use onCreated to configure tone mapping, output color space, scene background, or controls after the scene mounts and sizes, before the first draw. Return a cleanup callback for controls or other acquired resources. Numeric dpr selects a fixed positive ratio; a min/max tuple clamps devicePixelRatio and follows window resize events. The default remains 1. Width and height remain reactive positive CSS-pixel dimensions. Canvas updates its default perspective camera projection; supplied cameras are borrowed and retain their own projection. Use onResize to update an external perspective/orthographic camera explicitly. onFrame and pointer routing always use the current camera prop, with one frame loop using the installed Motion clock or requestAnimationFrame.
|
|
254
|
+
|
|
255
|
+
<ConfigurableCanvas />
|
|
256
|
+
|
|
214
257
|
Canvas defaults to a perspective camera at z = 5. Its optional camera prop borrows an external camera; a PerspectiveCamera child does not automatically become active. Width and height update the renderer and default camera. Canvas renders continuously and accepts an onFrame callback with scene, camera, renderer, delta seconds, and timestamp seconds. Controls, asset loading, and drawing on demand are outside this initial API.
|
|
215
258
|
|
|
216
259
|
### Three.js pointer events
|
|
@@ -233,7 +276,7 @@ Use motion:initial, motion:animate, motion:exit, motion:transition, motion:while
|
|
|
233
276
|
|
|
234
277
|
<MotionPanel />
|
|
235
278
|
|
|
236
|
-
Motion targets update reactively without rerunning component setup. The target stays in atom.io; intermediate values and velocity remain in Motion. Spring transitions preserve motion-value continuity when retargeted. Duration-based tween transitions are also supported. Set initial to false to
|
|
279
|
+
Motion targets update reactively without rerunning component setup. The target stays in atom.io; intermediate values and velocity remain in Motion. Spring transitions preserve motion-value continuity when retargeted. Duration-based tween transitions are also supported. Set initial to false to start at the animate target’s final value. DOM targets accept scalar CSS values and independent transforms, including custom CSS properties. DOM keyframe sequences and property-specific timing are supported as described below. Use motion:layout for layout changes and motion:layoutId for shared element transitions.
|
|
237
280
|
|
|
238
281
|
Motion respects the user's reduced-motion preference by default, including changes while mounted. The capability's reducedMotion option can be user, always, or never. Owner cleanup stops animations and releases effects, gesture handlers, and media-query listeners. Removing the capability properties releases that node's binding. Avoid assigning the same property through both native attributes/styles and motion targets: motion owns the properties it animates.
|
|
239
282
|
|
|
@@ -241,7 +284,7 @@ The same attributes animate numeric Konva properties and colors, or Three.js pos
|
|
|
241
284
|
|
|
242
285
|
<MotionThree />
|
|
243
286
|
|
|
244
|
-
When the motion capability is installed, Canvas draws in Motion's render phase after animated scene values update. Without it, Canvas uses requestAnimationFrame. Both drawing subscriptions and animations end with their owners. The base runtime imports no motion engine or retention coordinator. Presence hooks add approximately 300 bytes of gzip to the released 3.7 kB client surface; the optional Motion entrypoint owns the retention machinery. The full client budget is 4,
|
|
287
|
+
When the motion capability is installed, Canvas draws in Motion's render phase after animated scene values update. Without it, Canvas uses requestAnimationFrame. Both drawing subscriptions and animations end with their owners. The base runtime imports no motion engine or retention coordinator. Presence hooks add approximately 300 bytes of gzip to the released 3.7 kB client surface; the optional Motion entrypoint owns the retention machinery. The full client budget is 4,400 bytes.
|
|
245
288
|
|
|
246
289
|
### Exit animations and re-entry
|
|
247
290
|
|
|
@@ -261,8 +304,61 @@ During exit, reactive attributes, child reconciliation, user events, gestures, a
|
|
|
261
304
|
|
|
262
305
|
Exit props and transition settings are read at logical removal; later state changes do not retarget an exiting subtree. Exits use the same transition as animate, defaulting to a spring. Explicit durations, visualDuration, and delays must be finite and nonnegative; velocity must be finite, bounce must be in the range [0, 1), and stiffness, damping, mass, restDelta, and restSpeed must be finite and positive so exits can settle. Reduced motion skips retention; enabling it during an exit completes that exit. Server rendering omits capability attributes and never starts exits; hydration attaches them for later removals.
|
|
263
306
|
|
|
264
|
-
Root disposal and fatal errors bypass exits, stop active work, and release resources immediately. Stale animation completions cannot dispose a revived instance. This API covers exit retention and cancellation;
|
|
307
|
+
Root disposal and fatal errors bypass exits, stop active work, and release resources immediately. Stale animation completions cannot dispose a revived instance. This API covers exit retention and cancellation; pop-layout positioning, variants, presence wrappers, and automatic reparenting remain outside its scope.
|
|
308
|
+
|
|
309
|
+
### Layout and shared identity
|
|
310
|
+
|
|
311
|
+
Register motionCapability from @atom.io/spa/motion once to enable animated properties, exits, HTML layout changes, and shared element transitions. All use the optional Motion peer; the base SPA runtime stays independent of Motion:
|
|
312
|
+
|
|
313
|
+
<LayoutMain />
|
|
314
|
+
|
|
315
|
+
<LayoutExample />
|
|
316
|
+
|
|
317
|
+
motion:layout enables position and size projection; position or size restricts the animated dimensions. motion:layoutId enables layout animation implicitly and carries a visual identity between outgoing/incoming nodes, while reconciliation keys continue to own component instances. Shared identities are isolated by root and by an explicit motion:layoutGroup on each shared node; group is not inherited. Use distinct group values for separate boards in one root. Reusing an ID within a group coordinates a shared transition, with the latest mounted member leading.
|
|
318
|
+
|
|
319
|
+
SPA snapshots registered targets before each synchronous update batch and projects after the DOM commits. Per-target ResizeObserver subscriptions also handle external size changes; no document-wide mutation observer or consumer measurement loop is needed. Mark scrolling layout ancestors with motion:layoutScroll. Nested projections preserve authored transforms and transform origins; Floating UI retains its independent translate positioning. Avoid multiple layout/projection owners or direct writes to a projected element's transform while the capability is active.
|
|
320
|
+
|
|
321
|
+
The default transition is a 0.3-second tween; the capability option layoutTransition sets defaults and motion:layoutTransition replaces them for a target. Use finite duration/delay values or settling spring parameters. Retargeting uses the current projection. Outgoing nodes remain available for shared handoff until replacements mount in the same batch. With Motion exits, layout follows the retained node's lifetime; keyed re-entry resumes the existing instance. Shared identity transfers appearance, not component state or DOM ownership, and nodes are not automatically reparented.
|
|
322
|
+
|
|
323
|
+
Reduced motion follows the user's preference by default; always and never options override it. Enabling reduced motion finishes projections immediately. Removal, fatal errors, and root disposal cancel projection work, disconnect observers/listeners, and restore owned attributes/styles. Server rendering emits no layout attributes or animation work. Layout is limited to owned HTML nodes; scene objects, SVG projection, pop-layout positioning, and cross-document handoff are unsupported.
|
|
324
|
+
|
|
325
|
+
### Floating overlays with Motion
|
|
326
|
+
|
|
327
|
+
The optional @atom.io/spa/floating entrypoint adapts @floating-ui/dom. Install Floating UI and Motion for this example, then register both capabilities on the root:
|
|
328
|
+
|
|
329
|
+
<InstallFloating />
|
|
330
|
+
|
|
331
|
+
<FloatingMain />
|
|
332
|
+
|
|
333
|
+
Floating positions an HTML overlay using CSS translate. Motion can animate x, y, scale, rotation, and opacity on that same element through its separate transform property:
|
|
334
|
+
|
|
335
|
+
<FloatingExample />
|
|
336
|
+
|
|
337
|
+
| Attribute | Behavior |
|
|
338
|
+
| ------------------- | --------------------------------------------------------------------------------------------------- |
|
|
339
|
+
| floating:reference | A DOM or virtual reference; null releases positioning. |
|
|
340
|
+
| floating:placement | Floating UI placement, defaulting to bottom. |
|
|
341
|
+
| floating:strategy | absolute or fixed, defaulting to absolute. |
|
|
342
|
+
| floating:middleware | Standard Floating UI middleware such as offset, flip, and shift. |
|
|
343
|
+
| floating:enabled | Defaults to true; set false when a mounted overlay is closed. |
|
|
344
|
+
| floating:autoUpdate | Defaults to true; accepts observer options, or false for positioning only on SPA attribute updates. |
|
|
345
|
+
|
|
346
|
+
The capability waits for mount and ref publication before measuring, hides the overlay until its first position is available, and reconnects observers when its reference or observer options change. Updates from obsolete calculations are ignored. Server rendering omits floating attributes and starts no observers. Virtual references can supply getBoundingClientRect and an optional contextElement, as documented by Floating UI.
|
|
347
|
+
|
|
348
|
+
Give the overlay a fixed width or width: max-content and avoid margins so measurement remains stable. Floating owns position, left, top, and translate while enabled, and temporarily owns visibility until the first measurement. Do not animate translate through Motion or assign those positioning properties through another style writer on the same element. Floating restores original inline values and priorities when disabled, removed, or disposed. Keyboard behavior, focus management, dismissal, and top-layer mounting remain application responsibilities.
|
|
349
|
+
|
|
350
|
+
Reactive inline style changes preserve the current anchor position and Motion values while new measurements are pending. Temporary hiding uses !important until the first position is available, then restores the original inline visibility value and priority.
|
|
351
|
+
|
|
352
|
+
Position updates continue during Motion's retained exits, until physical disposal. If the reference itself moves through transforms, enable animationFrame in floating:autoUpdate. Run the package's example:floating script for a scrollable experiment with same-element scaling and rotation, moving anchors, viewport collisions, positioning strategies, and interrupted exits. Its test:browser:floating script checks actual Chromium geometry in both capability registration orders.
|
|
265
353
|
|
|
266
354
|
### Renderer extensions
|
|
267
355
|
|
|
268
356
|
The renderer entrypoint exposes createSceneRenderer, sceneComponent, bindScene, and onSceneFrame for imperative scene adapters. A host supplies creation, property updates, ordered child attachment, and destruction. Its children callback receives the parent, all owned children including retained exits, and the active children in that collection. Single resource slots can use active children for replacement while retaining ownership of outgoing resources. Children of an exiting parent keep their attachments until disposal. An optional target adapter exposes native property access and events to capabilities. The shared renderer supplies reactive bindings, keyed identity, refs, and cleanup. Use mount inside an owned component or mount callback to inherit its store, capabilities, and lifetime, or render with an explicit parent and optional root options to create a standalone scene root. Scene targets must be dedicated to their renderer's children. Scene subtrees do not support text nodes or hydration; their DOM boundaries defer graphics creation until browser mount. Server rendering validates and omits capability attributes without starting animations.
|
|
357
|
+
|
|
358
|
+
## Motion keyframes and property transitions
|
|
359
|
+
|
|
360
|
+
DOM motion targets accept scalar values or keyframe sequences of at least two values. A null first frame starts from the current animated value, which is useful when retargeting an interrupted sequence. Initial DOM targets remain scalar. Three position, rotation, and scale tuples retain their vector meaning; Konva and other scene targets remain scalar. Keyframe sequences use tweens by default; explicit springs support at most two frames. Reduced motion and initial:false resolve to the final frame.
|
|
361
|
+
|
|
362
|
+
Transition times are normalized, ordered values from 0 to 1 and must match the keyframe count. ease accepts a single named easing/cubic-bezier tuple or one easing for each interval. Top-level options are overridden by default options, then by properties[propertyName], with missing fields inherited in that order. This allows independent timing per property and per element. Times and easing lengths must match the effective sequence, including exit targets; invalid combinations report a spa/motion diagnostic. Sequences share the existing interruption, gesture, keyed exit/re-entry, and disposal ownership.
|
|
363
|
+
|
|
364
|
+
<MotionKeyframes />
|
package/dist/astro-client.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as Island, i as AstroStorePreparation } from "./astro-shared-
|
|
1
|
+
import { a as Island, i as AstroStorePreparation } from "./astro-shared-DZp1x8RQ.js";
|
|
2
2
|
type Props = Record<string, any>;
|
|
3
3
|
type Slots = Record<string, string>;
|
|
4
4
|
type Hydrator = (component: Island, props: Props, slots: Slots, metadata: {
|
package/dist/astro-client.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { browserApplication } from "./astro-application.js";
|
|
2
2
|
import { n as failPreparation, r as storeContext } from "./astro-context-OdlexHR4.js";
|
|
3
3
|
import { n as islandStore, t as island } from "./astro-shared-83hxw7-M.js";
|
|
4
|
-
import { c as onCleanup,
|
|
5
|
-
import { n as render, t as hydrate } from "./dom-
|
|
4
|
+
import { c as onCleanup, h as useGetter } from "./core-B4rJ0xdc.js";
|
|
5
|
+
import { n as render, t as hydrate } from "./dom-D8g3roX9.js";
|
|
6
6
|
import { IMPLICIT, createRegularAtomFamily, disposeFromStore, findInStore, getFromStore, setIntoStore } from "atom.io/internal";
|
|
7
7
|
// src/astro-client.ts
|
|
8
8
|
const roots = /* @__PURE__ */ new WeakMap();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"astro-request-DRKvDjsO.js","names":[],"sources":["../src/astro-request.ts"],"sourcesContent":["import type { RootStore } from \"atom.io/internal\"\nimport { IMPLICIT, Store } from \"atom.io/internal\"\n\nimport { applicationContext } from \"./astro-context.ts\"\n\nconst requests = new WeakMap<Request, ReturnType<typeof createRequest>>()\nfunction createRequest() {\n\tconst application = applicationContext()\n\tlet store: RootStore | undefined\n\treturn {\n\t\tapplication,\n\t\tget store(): RootStore {\n\t\t\tapplication.signal.throwIfAborted()\n\t\t\tif (!store) {\n\t\t\t\tstore = new Store(\n\t\t\t\t\t{ name: `spa-request`, lifespan: `ephemeral`, isProduction: true },\n\t\t\t\t\tIMPLICIT.STORE,\n\t\t\t\t) as RootStore\n\t\t\t\tconst selected = store\n\t\t\t\tapplication.onCleanup(() => {\n\t\t\t\t\tconst errors: unknown[] = []\n\t\t\t\t\tfor (const state of selected.atoms.values()) {\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tstate.cleanup?.()\n\t\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\t\terrors.push(error)\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tfor (const resource of selected.miscResources.values()) {\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tresource[Symbol.dispose]()\n\t\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\t\terrors.push(error)\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif (errors.length)\n\t\t\t\t\t\tthrow new AggregateError(errors, `spa: request cleanup failed`)\n\t\t\t\t})\n\t\t\t}\n\t\t\tsyncDefinitions(store)\n\t\t\treturn store\n\t\t},\n\t}\n}\nexport function requestApplication(\n\trequest: Request,\n): ReturnType<typeof createRequest> {\n\tlet app = requests.get(request)\n\tif (!app) {\n\t\tapp = createRequest()\n\t\trequests.set(request, app)\n\t\tconst dispose = () => {\n\t\t\tapp!.application.dispose()\n\t\t}\n\t\trequest.signal.addEventListener(`abort`, dispose, { once: true })\n\t\tapp.application.onCleanup(() => {\n\t\t\trequest.signal.removeEventListener(`abort`, dispose)\n\t\t})\n\t\tif (request.signal.aborted) dispose()\n\t}\n\treturn app\n}\n/** Install definitions imported after an earlier island started this request. */\
|
|
1
|
+
{"version":3,"file":"astro-request-DRKvDjsO.js","names":[],"sources":["../src/astro-request.ts"],"sourcesContent":["import type { RootStore } from \"atom.io/internal\"\nimport { IMPLICIT, Store } from \"atom.io/internal\"\n\nimport { applicationContext } from \"./astro-context.ts\"\n\nconst requests = new WeakMap<Request, ReturnType<typeof createRequest>>()\nfunction createRequest() {\n\tconst application = applicationContext()\n\tlet store: RootStore | undefined\n\treturn {\n\t\tapplication,\n\t\tget store(): RootStore {\n\t\t\tapplication.signal.throwIfAborted()\n\t\t\tif (!store) {\n\t\t\t\tstore = new Store(\n\t\t\t\t\t{ name: `spa-request`, lifespan: `ephemeral`, isProduction: true },\n\t\t\t\t\tIMPLICIT.STORE,\n\t\t\t\t) as RootStore\n\t\t\t\tconst selected = store\n\t\t\t\tapplication.onCleanup(() => {\n\t\t\t\t\tconst errors: unknown[] = []\n\t\t\t\t\tfor (const state of selected.atoms.values()) {\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tstate.cleanup?.()\n\t\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\t\terrors.push(error)\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tfor (const resource of selected.miscResources.values()) {\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tresource[Symbol.dispose]()\n\t\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\t\terrors.push(error)\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif (errors.length)\n\t\t\t\t\t\tthrow new AggregateError(errors, `spa: request cleanup failed`)\n\t\t\t\t})\n\t\t\t}\n\t\t\tsyncDefinitions(store)\n\t\t\treturn store\n\t\t},\n\t}\n}\nexport function requestApplication(\n\trequest: Request,\n): ReturnType<typeof createRequest> {\n\tlet app = requests.get(request)\n\tif (!app) {\n\t\tapp = createRequest()\n\t\trequests.set(request, app)\n\t\tconst dispose = () => {\n\t\t\tapp!.application.dispose()\n\t\t}\n\t\trequest.signal.addEventListener(`abort`, dispose, { once: true })\n\t\tapp.application.onCleanup(() => {\n\t\t\trequest.signal.removeEventListener(`abort`, dispose)\n\t\t})\n\t\tif (request.signal.aborted) dispose()\n\t}\n\treturn app\n}\n/** Install definitions imported after an earlier island started this request. */\nfunction syncDefinitions(store: RootStore): void {\n\tconst source = IMPLICIT.STORE\n\tfor (const field of [\n\t\t`families`,\n\t\t`atoms`,\n\t\t`readonlySelectors`,\n\t\t`writableSelectors`,\n\t\t`transactions`,\n\t\t`timelineFamilies`,\n\t\t`timelines`,\n\t] as const) {\n\t\tfor (const [key, resource] of source[field]) {\n\t\t\tif (!store[field].has(key)) resource.install(store)\n\t\t}\n\t}\n}\n"],"mappings":";;;AAKA,MAAM,2BAAW,IAAI,QAAmD;AACxE,SAAS,gBAAgB;CACxB,MAAM,cAAc,mBAAmB;CACvC,IAAI;CACJ,OAAO;EACN;EACA,IAAI,QAAmB;GACtB,YAAY,OAAO,eAAe;GAClC,IAAI,CAAC,OAAO;IACX,QAAQ,IAAI,MACX;KAAE,MAAM;KAAe,UAAU;KAAa,cAAc;IAAK,GACjE,SAAS,KACV;IACA,MAAM,WAAW;IACjB,YAAY,gBAAgB;KAC3B,MAAM,SAAoB,CAAC;KAC3B,KAAK,MAAM,SAAS,SAAS,MAAM,OAAO,GACzC,IAAI;MACH,MAAM,UAAU;KACjB,SAAS,OAAO;MACf,OAAO,KAAK,KAAK;KAClB;KAED,KAAK,MAAM,YAAY,SAAS,cAAc,OAAO,GACpD,IAAI;MACH,SAAS,OAAO,QAAQ,CAAC;KAC1B,SAAS,OAAO;MACf,OAAO,KAAK,KAAK;KAClB;KAED,IAAI,OAAO,QACV,MAAM,IAAI,eAAe,QAAQ,6BAA6B;IAChE,CAAC;GACF;GACA,gBAAgB,KAAK;GACrB,OAAO;EACR;CACD;AACD;AACA,SAAgB,mBACf,SACmC;CACnC,IAAI,MAAM,SAAS,IAAI,OAAO;CAC9B,IAAI,CAAC,KAAK;EACT,MAAM,cAAc;EACpB,SAAS,IAAI,SAAS,GAAG;EACzB,MAAM,gBAAgB;GACrB,IAAK,YAAY,QAAQ;EAC1B;EACA,QAAQ,OAAO,iBAAiB,SAAS,SAAS,EAAE,MAAM,KAAK,CAAC;EAChE,IAAI,YAAY,gBAAgB;GAC/B,QAAQ,OAAO,oBAAoB,SAAS,OAAO;EACpD,CAAC;EACD,IAAI,QAAQ,OAAO,SAAS,QAAQ;CACrC;CACA,OAAO;AACR;;AAEA,SAAS,gBAAgB,OAAwB;CAChD,MAAM,SAAS,SAAS;CACxB,KAAK,MAAM,SAAS;EACnB;EACA;EACA;EACA;EACA;EACA;EACA;CACD,GACC,KAAK,MAAM,CAAC,KAAK,aAAa,OAAO,QACpC,IAAI,CAAC,MAAM,MAAM,CAAC,IAAI,GAAG,GAAG,SAAS,QAAQ,KAAK;AAGrD"}
|
package/dist/astro-server.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { n as failPreparation, r as storeContext } from "./astro-context-OdlexHR4.js";
|
|
2
2
|
import { t as requestApplication } from "./astro-request-DRKvDjsO.js";
|
|
3
3
|
import { n as islandStore, t as island } from "./astro-shared-83hxw7-M.js";
|
|
4
|
-
import { t as renderToStringWithReads } from "./server-renderer-
|
|
4
|
+
import { t as renderToStringWithReads } from "./server-renderer-D0rsFL_-.js";
|
|
5
5
|
// src/astro-server.ts
|
|
6
6
|
const createRenderer = (awaitState = false) => ({
|
|
7
7
|
name: `spa`,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { o as Component, t as Capability } from "./capabilities-
|
|
1
|
+
import { o as Component, t as Capability } from "./capabilities-DNcnGRv_.js";
|
|
2
2
|
import { RootStore } from "atom.io/internal";
|
|
3
3
|
interface AstroApplicationContext {
|
|
4
4
|
/** Whether the application still represents its initial server snapshot. */
|
|
@@ -30,4 +30,4 @@ type Island<P = any> = Component<P> & {
|
|
|
30
30
|
prepareStore?: AstroStorePreparation<P>;
|
|
31
31
|
};
|
|
32
32
|
export { Island as a, AstroStorePreparation as i, AstroStoreContext as n, AstroStoreFactory as r, AstroApplicationContext as t };
|
|
33
|
-
//# sourceMappingURL=astro-shared-
|
|
33
|
+
//# sourceMappingURL=astro-shared-DZp1x8RQ.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"astro-shared-
|
|
1
|
+
{"version":3,"file":"astro-shared-DZp1x8RQ.d.ts","names":[],"sources":["../src/astro-shared.ts"],"mappings":";;UAOiB;;WAEP;WACA,QAAQ;EACjB,UAAU;;EAEV,IAAI,GAAG,cAAc,kBAAkB,IAAI;;UAE3B;;EAEhB,aAAa;;EAEb,SAAS;;EAET,QAAQ;;EAER,UAAU;;KAEC,kBAAkB,IAAI,wBACjC,OAAO,GACP,SAAS,sBACL,YAAY,QAAQ;KACb,sBAAsB,IAAI,wBACrC,OAAO,WACP,OAAO,GACP,SAAS,6BACE;KACA,OAAO,WAAW,UAAU;EACvC;;EAEA,wBAAwB;;EAExB;EACA,cAAc,kBAAkB;EAChC,eAAe,sBAAsB"}
|
package/dist/astro.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SpaPluginOptions } from "./vite.js";
|
|
2
|
-
import { a as Island, i as AstroStorePreparation, n as AstroStoreContext, r as AstroStoreFactory, t as AstroApplicationContext } from "./astro-shared-
|
|
2
|
+
import { a as Island, i as AstroStorePreparation, n as AstroStoreContext, r as AstroStoreFactory, t as AstroApplicationContext } from "./astro-shared-DZp1x8RQ.js";
|
|
3
3
|
import { AstroIntegration } from "astro";
|
|
4
4
|
export default function integration(options?: SpaPluginOptions): AstroIntegration;
|
|
5
5
|
export type { AstroApplicationContext, AstroStoreContext, AstroStoreFactory, AstroStorePreparation, Island };
|
package/dist/astro.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { RootStore } from "atom.io/internal";
|
|
2
|
-
import { ReadableFamilyToken, ReadableToken, RegularAtomFamilyToken, RegularAtomToken, Setter, TimelineFamilyToken, TimelineManageable, TimelineToken, TransactionToken, ViewOf, WritableFamilyToken, WritableToken } from "atom.io";
|
|
2
|
+
import { ReadableFamilyToken, ReadableToken, RegularAtomFamilyToken, RegularAtomToken, Setter, TimelineFamilyToken, TimelineManageable, TimelineToken, TransactionToken, ViewOf, WritableFamilyToken, WritableToken, disposeState } from "atom.io";
|
|
3
3
|
import { Canonical } from "atom.io/foundations/canonical";
|
|
4
4
|
interface ExitHandle {
|
|
5
5
|
finished: Promise<void>;
|
|
@@ -71,6 +71,8 @@ interface Root extends Scope {
|
|
|
71
71
|
}
|
|
72
72
|
/** Return the atom.io store selected by the current root. */
|
|
73
73
|
declare function useStore(): RootStore;
|
|
74
|
+
/** Return atom.io disposal bound to the current root's store. */
|
|
75
|
+
declare function useDisposal(): typeof disposeState;
|
|
74
76
|
declare function onCleanup(cleanup: Cleanup): void;
|
|
75
77
|
declare function onMount(run: Cleanup): void;
|
|
76
78
|
declare function useId(): string;
|
|
@@ -107,14 +109,18 @@ interface CapabilityTarget {
|
|
|
107
109
|
interface CapabilityBinding {
|
|
108
110
|
exit?(props: Record<string, unknown>): ExitHandle | undefined;
|
|
109
111
|
resume?(): void;
|
|
110
|
-
|
|
112
|
+
/** Inline CSS before native style replacement, for restoring capability-owned values. */
|
|
113
|
+
update(props: Record<string, unknown>, previousStyle?: string): void;
|
|
111
114
|
dispose(): void;
|
|
112
115
|
}
|
|
113
116
|
interface Capability {
|
|
114
117
|
namespace: string;
|
|
118
|
+
/** Prepare a synchronous update batch and return its commit callback. */
|
|
119
|
+
beforeUpdate?(root: Root): Cleanup;
|
|
115
120
|
presence?(root: Root): PresenceCoordinator;
|
|
116
121
|
scheduleFrame?(callback: (time: number) => void): Cleanup;
|
|
117
|
-
|
|
122
|
+
/** SPA supplies ownership for integrations that measure after mount or report async errors. */
|
|
123
|
+
attach(target: CapabilityTarget, scope?: Scope): CapabilityBinding;
|
|
118
124
|
}
|
|
119
|
-
export {
|
|
120
|
-
//# sourceMappingURL=capabilities-
|
|
125
|
+
export { useStore as _, Children as a, SpaElement as c, onMount as d, useDisposal as f, useSetter as g, useRef as h, Accessor as i, TimelineControls as l, useId as m, CapabilityBinding as n, Component as o, useGetter as p, CapabilityTarget as r, RootOptions as s, Capability as t, onCleanup as u, useTimeline as v, useTransaction as y };
|
|
126
|
+
//# sourceMappingURL=capabilities-DNcnGRv_.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"capabilities-DNcnGRv_.d.ts","names":[],"sources":["../src/presence.ts","../src/core.ts","../src/capabilities.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cAAc,gBAClB,OAAO,IAAI,OAAO;iBACN,UAAU,GAAG,UAAU,WACtC,QAAQ,oBAAoB,GAAG,SAC/B,KAAK,QAAQ,MACV,OAAO,IAAI,OAAO;iBAQN,eAAe,cAAc,qBAC5C,OAAO,iBAAiB,SAClB,MAAM,WAAW,OAAO,WAAW;iBAK1B,OAAO,UAAU,SAChC,OAAO,iBAAiB,aACrB,SAAS;iBACG,OAAO,UAAU,SAAS,UAAU,WACnD,QAAQ,uBAAuB,UAAU,IACzC,KAAK,QAAQ,MACV,SAAS;UAuBI;EAChB;EACA;EACA;EACA;EACA;EACA;IAAoB,OAAO;IAAS,OAAO;;;iBAE5B,YAAY,UAAU,oBACrC,OAAO,cAAc,KACnB;iBACa,YAAY,UAAU,WAAW,UAAU,oBAC1D,QAAQ,oBAAoB,GAAG,IAC/B,KAAK,QAAQ,KACX;;UC5Xc;EAChB;EACA;EACA,YAAY;EACZ,MAAM;EACN,OAAO,aAAa;EACpB,QAAQ,eAAe,uBAAuB;;UAE9B;EAChB,MAAM,OAAO,0BAA0B;EACvC;;EAEA,OAAO,OAAO,yBAAyB;EACvC;;UAEgB;EAChB;;EAEA,cAAc,MAAM,OAAO;EAC3B,UAAU,MAAM,OAAO;EACvB,eAAe,WAAW,wBAAwB;;EAElD,OAAO,QAAQ,kBAAkB,QAAQ,QAAQ"}
|
|
@@ -12,7 +12,7 @@ function validateCapabilities(scope, props) {
|
|
|
12
12
|
}
|
|
13
13
|
}
|
|
14
14
|
/** Separate framework properties from native attributes and own their bindings. */
|
|
15
|
-
function capabilityProps(scope, target, read) {
|
|
15
|
+
function capabilityProps(scope, target, read, applyNative) {
|
|
16
16
|
const bindings = /* @__PURE__ */ new Map();
|
|
17
17
|
scope._root._presence?.target(scope, target);
|
|
18
18
|
const cleanup = () => {
|
|
@@ -41,14 +41,16 @@ function capabilityProps(scope, target, read) {
|
|
|
41
41
|
group[key.slice(namespace.length + 1)] = props[key];
|
|
42
42
|
groups.set(namespace, group);
|
|
43
43
|
}
|
|
44
|
+
const previousStyle = applyNative?.(native);
|
|
44
45
|
for (const [namespace, values] of groups) {
|
|
45
46
|
let binding = bindings.get(namespace);
|
|
46
47
|
if (!binding) {
|
|
47
|
-
binding = scope._root._capabilities.get(namespace).attach(target);
|
|
48
|
+
binding = scope._root._capabilities.get(namespace).attach(target, scope);
|
|
48
49
|
bindings.set(namespace, binding);
|
|
49
50
|
scope._root._presence?.bind(scope, binding, read ?? (() => props), namespace);
|
|
50
51
|
}
|
|
51
|
-
binding.update(values);
|
|
52
|
+
if (previousStyle !== void 0) binding.update(values, previousStyle);
|
|
53
|
+
else binding.update(values);
|
|
52
54
|
}
|
|
53
55
|
for (const [namespace, binding] of bindings) if (!groups.has(namespace)) {
|
|
54
56
|
bindings.delete(namespace);
|
|
@@ -60,4 +62,4 @@ function capabilityProps(scope, target, read) {
|
|
|
60
62
|
}
|
|
61
63
|
export { capabilityProps as n, validateCapabilities as r, capabilityNamespace as t };
|
|
62
64
|
|
|
63
|
-
//# sourceMappingURL=capabilities-
|
|
65
|
+
//# sourceMappingURL=capabilities-nOIitQ-_.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"capabilities-nOIitQ-_.js","names":[],"sources":["../src/capabilities.ts"],"sourcesContent":["import type { Cleanup, Root, Scope } from \"./core.ts\"\nimport type { ExitHandle, PresenceCoordinator } from \"./presence.ts\"\n\n/** Native renderers expose property access without importing capability engines. */\nexport interface CapabilityTarget {\n\tkind: string\n\tnode: unknown\n\tsuspend?(): Cleanup\n\tread?(key: string): unknown\n\twrite?(key: string, value: unknown): void\n\tlisten?(event: string, listener: () => void): Cleanup\n}\nexport interface CapabilityBinding {\n\texit?(props: Record<string, unknown>): ExitHandle | undefined\n\tresume?(): void\n\t/** Inline CSS before native style replacement, for restoring capability-owned values. */\n\tupdate(props: Record<string, unknown>, previousStyle?: string): void\n\tdispose(): void\n}\nexport interface Capability {\n\tnamespace: string\n\t/** Prepare a synchronous update batch and return its commit callback. */\n\tbeforeUpdate?(root: Root): Cleanup\n\tpresence?(root: Root): PresenceCoordinator\n\tscheduleFrame?(callback: (time: number) => void): Cleanup\n\t/** SPA supplies ownership for integrations that measure after mount or report async errors. */\n\tattach(target: CapabilityTarget, scope?: Scope): CapabilityBinding\n}\n\nexport function capabilityNamespace(key: string): string | undefined {\n\tconst colon = key.indexOf(`:`)\n\tif (colon < 0) return undefined\n\tconst namespace = key.slice(0, colon)\n\treturn /^(xml|xmlns|xlink)$/.test(namespace) ? undefined : namespace\n}\nexport function validateCapabilities(\n\tscope: Scope,\n\tprops: Record<string, unknown>,\n): void {\n\tfor (const key of Object.keys(props)) {\n\t\tconst namespace = capabilityNamespace(key)\n\t\tif (namespace && !scope._root._capabilities.has(namespace))\n\t\t\tthrow new Error(\n\t\t\t\t`spa: capability \"${namespace}\" is not registered for this root`,\n\t\t\t)\n\t}\n}\n\n/** Separate framework properties from native attributes and own their bindings. */\nexport function capabilityProps(\n\tscope: Scope,\n\ttarget: CapabilityTarget,\n\tread?: () => Record<string, any>,\n\tapplyNative?: (props: Record<string, any>) => string | undefined,\n): (props: Record<string, any>) => Record<string, any> {\n\tconst bindings = new Map<string, CapabilityBinding>()\n\n\tscope._root._presence?.target(scope, target)\n\tconst cleanup: Cleanup = () => {\n\t\tconst errors: unknown[] = []\n\t\tfor (const binding of [...bindings.values()].reverse()) {\n\t\t\ttry {\n\t\t\t\tbinding.dispose()\n\t\t\t} catch (error) {\n\t\t\t\terrors.push(error)\n\t\t\t}\n\t\t}\n\t\tbindings.clear()\n\t\tif (errors.length) throw new AggregateError(errors)\n\t}\n\tscope._cleanups.add(cleanup)\n\treturn (props) => {\n\t\tvalidateCapabilities(scope, props)\n\t\tconst native: Record<string, any> = {}\n\t\tconst groups = new Map<string, Record<string, unknown>>()\n\t\tfor (const key of Object.keys(props)) {\n\t\t\tconst namespace = capabilityNamespace(key)\n\t\t\tif (!namespace) {\n\t\t\t\tconst value = props[key]\n\t\t\t\tnative[key] =\n\t\t\t\t\tkey.startsWith(`on`) && typeof value === `function`\n\t\t\t\t\t\t? (scope._root._presence?.event(scope, value) ?? value)\n\t\t\t\t\t\t: value\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tconst group = groups.get(namespace) ?? {}\n\t\t\tgroup[key.slice(namespace.length + 1)] = props[key]\n\t\t\tgroups.set(namespace, group)\n\t\t}\n\t\tconst previousStyle = applyNative?.(native)\n\t\tfor (const [namespace, values] of groups) {\n\t\t\tlet binding = bindings.get(namespace)\n\t\t\tif (!binding) {\n\t\t\t\tbinding = scope._root._capabilities.get(namespace)!.attach(target, scope)\n\t\t\t\tbindings.set(namespace, binding)\n\t\t\t\tscope._root._presence?.bind(\n\t\t\t\t\tscope,\n\t\t\t\t\tbinding,\n\t\t\t\t\tread ?? (() => props),\n\t\t\t\t\tnamespace,\n\t\t\t\t)\n\t\t\t}\n\t\t\tif (previousStyle !== undefined) binding.update(values, previousStyle)\n\t\t\telse binding.update(values)\n\t\t}\n\t\tfor (const [namespace, binding] of bindings)\n\t\t\tif (!groups.has(namespace)) {\n\t\t\t\tbindings.delete(namespace)\n\t\t\t\tscope._root._presence?.unbind(binding)\n\t\t\t\tbinding.dispose()\n\t\t\t}\n\t\treturn native\n\t}\n}\n"],"mappings":";AA6BA,SAAgB,oBAAoB,KAAiC;CACpE,MAAM,QAAQ,IAAI,QAAQ,GAAG;CAC7B,IAAI,QAAQ,GAAG,OAAO,KAAA;CACtB,MAAM,YAAY,IAAI,MAAM,GAAG,KAAK;CACpC,OAAO,sBAAsB,KAAK,SAAS,IAAI,KAAA,IAAY;AAC5D;AACA,SAAgB,qBACf,OACA,OACO;CACP,KAAK,MAAM,OAAO,OAAO,KAAK,KAAK,GAAG;EACrC,MAAM,YAAY,oBAAoB,GAAG;EACzC,IAAI,aAAa,CAAC,MAAM,MAAM,cAAc,IAAI,SAAS,GACxD,MAAM,IAAI,MACT,oBAAoB,UAAU,kCAC/B;CACF;AACD;;AAGA,SAAgB,gBACf,OAC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QAAQ,aAAa;QAChE,QAAQ,OAAO,MAAM;EAC3B;EACA,KAAK,MAAM,CAAC,WAAW,YAAY,UAClC,IAAI,CAAC,OAAO,IAAI,SAAS,GAAG;GAC3B,SAAS,OAAO,SAAS;GACzB,MAAM,MAAM,WAAW,OAAO,OAAO;GACrC,QAAQ,QAAQ;EACjB;EACD,OAAO;CACR;AACD"}
|
package/dist/client.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{IMPLICIT as e,actUponStore as t,clearTimelineInStore as n,findInStore as r,findTimelineInStore as i,getFromStore as a,getTimelineTransactionAtHead as o,setIntoStore as s,subscribeToState as c,subscribeToTimeline as l,timeTravel as u,timeTravelTransactionGroupInStore as d,withdraw as f,withdraw as p}from"atom.io/internal";var m,h,g=0;function _(e,t){let n=m;m=e;try{return t()}finally{m=n}}function v(e){let t=h;h=void 0;try{return e()}finally{h=t}}function y(e){let t={_root:e?._root,_parent:e,_cleanups:new Set,_updates:[],_dead:!1};return e?._cleanups.add(t),t}function b(e,t){try{x(e)}catch(e){throw AggregateError([t,e])}throw t}function x(e){if(e._dead)return;e._dead=!0;let t=[];try{e._root._presence?.forget(e)}catch(e){t.push(e)}for(let n of[...e._cleanups].reverse())try{typeof n==`function`?n():x(n)}catch(e){t.push(e)}if(e._parent?._cleanups.delete(e),e._cleanups.clear(),e._updates.length=0,t.length)throw AggregateError(t)}function S(e){for(let t of e._updates)C(e,t);for(let t of e._cleanups)typeof t!=`function`&&S(t)}function C(e,t){if(!L(e))return;let n=e._root;n._queue.size||queueMicrotask(()=>{try{n.flush()}catch(e){n.error(e)}}),n._queue.add(t)}function w(t={},n=!1){let r=new Map;for(let e of t.capabilities??[]){if(r.has(e.namespace))throw Error(`spa: duplicate capability ${e.namespace}`);r.set(e.namespace,e)}let i={_capabilities:r,_store:t.store??e.STORE,_prefix:t.idPrefix??`w${g++}`,_id:0,...y(),_queue:new Set,_mounts:n?void 0:[]};i._root=i,i.error=t.onError??(e=>{throw e});for(let e of r.values())if(e.presence){if(i._presence)throw Error(`spa: multiple presence coordinators`);i._presence=e.presence(i)}return i.flush=()=>{try{for(;i._queue.size||i._mounts.length;){for(let e of[...i._queue])i._queue.delete(e)&&e();for(let e of i._mounts.splice(0))e()}}catch(e){b(i,e)}},i}function T(){return m._root._store}function E(e){m._cleanups.add(e)}function D(e){let t=m;t._root._mounts?.push(()=>{t._dead||_(t,()=>{v(e)})})}function ee(){let e=m._root;return`${e._prefix}-${e._id++}`}function O(e,t,n){let r=new Map,i=()=>{if(!L(e))return;let a=new Set,o=h;h=t=>{a.add(t),r.has(t)||r.set(t,t(()=>{C(e,i)}))};let s;try{s=_(e,t)}finally{h=o;for(let[e,t]of r)a.has(e)||(t(),r.delete(e))}v(()=>{n(s)})};e._updates.push(i),e._cleanups.add(()=>{e._root._queue.delete(i);for(let e of r.values())e()}),i()}function k(e,t){let n=m._root._store;return e.type.endsWith(`_family`)?r(n,e,t):e}function A(e,t){e=k(e,t);let n=m._root,r=n._store,i=t=>c(r,e,`spa:${g++}`,t);return()=>{let t=a(r,e);return n._onRead?.(t,e),h?.(i),t}}function j(e,t){e=k(e,t);let n=m._root._store;return t=>{s(n,e,t)}}function M(e){return t(m._root._store,e,`spa:${g++}`)}var N=new WeakMap;function P(e,t){e=k(e,t);let n=m._root._store,r=N.get(n)??new Map;N.set(n,r);let i={},o=null;return t=>{t?(o=t,r.set(e.key,i),s(n,e,t)):r.get(e.key)===i&&(r.delete(e.key),a(n,e)===o&&s(n,e,null),o=null)}}function F(e,t){let r=m._root._store,a=e.type===`timeline_family`?i(r,e,t):e,s=e=>l(r,a,`spa:${g++}`,e),c=()=>{let e=f(r,a);return h?.(s),e};return{getCursor:()=>c().at,getLength:()=>c().history.length,undo:()=>{u(r,`undo`,a)},redo:()=>{u(r,`redo`,a)},clear:()=>{n(r,a)},getTransaction:()=>{let e=c(),t={};for(let n of[`undo`,`redo`]){let i=o(e,n);i&&(t[n]=()=>{d(r,n,i)})}return t}}}function I(e){return typeof e==`function`?I(e()):Array.isArray(e)?e.map(I).join(``):e==null||typeof e==`boolean`?``:String(e)}function L(e){for(let t=e;t;t=t._parent)if(t._dead||t._exiting)return!1;return!0}var R=e=>e.children;function z(e,t,n){return{type:e,props:n===void 0?t??{}:H(t??{},{key:n})}}var B=z,V=z;function H(...e){let t=()=>e.map(e=>(typeof e==`function`?e():e)??{});return new Proxy({},{get:(e,n)=>t().reverse().find(e=>Object.hasOwn(e,n))?.[n],ownKeys:()=>[...new Set(t().flatMap(Object.keys))],getOwnPropertyDescriptor:()=>({enumerable:!0,configurable:!0})})}function U(e){let t=e.indexOf(`:`);if(t<0)return;let n=e.slice(0,t);return/^(xml|xmlns|xlink)$/.test(n)?void 0:n}function W(e,t){for(let n of Object.keys(t)){let t=U(n);if(t&&!e._root._capabilities.has(t))throw Error(`spa: capability "${t}" is not registered for this root`)}}function G(e,t,n){let r=new Map;return e._root._presence?.target(e,t),e._cleanups.add(()=>{let e=[];for(let t of[...r.values()].reverse())try{t.dispose()}catch(t){e.push(t)}if(r.clear(),e.length)throw AggregateError(e)}),i=>{W(e,i);let a={},o=new Map;for(let t of Object.keys(i)){let n=U(t);if(!n){let n=i[t];a[t]=t.startsWith(`on`)&&typeof n==`function`?e._root._presence?.event(e,n)??n:n;continue}let r=o.get(n)??{};r[t.slice(n.length+1)]=i[t],o.set(n,r)}for(let[a,s]of o){let o=r.get(a);o||(o=e._root._capabilities.get(a).attach(t),r.set(a,o),e._root._presence?.bind(e,o,n??(()=>i),a)),o.update(s)}for(let[t,n]of r)o.has(t)||(r.delete(t),e._root._presence?.unbind(n),n.dispose());return a}}var K=`http://www.w3.org/1999/xhtml`,q=`http://www.w3.org/2000/svg`;function J(e){if(e?.node)for(e.report(null,e.node);e.node;){let t=e.node;e.node=t.nextSibling,t.remove()}}function Y(e,t,n,r,i){if(i&&(e.nodeType!==3||e.nodeValue||i.node?.nodeType===3)){let n=i.node;!n||n.nodeType!==e.nodeType||n.nodeName!==e.nodeName||n.namespaceURI!==e.namespaceURI||e.nodeType!==1&&n.nodeValue!==e.nodeValue?(i.report(e,n),t.insertBefore(e,n),i.node=n?.nextSibling??null,n?.remove()):(e=n,i.node=n.nextSibling)}else t.insertBefore(e,i?i.node:n);return r._cleanups.add(()=>{e.remove()}),e}function X(e,t,n,r,i){return Y(t.ownerDocument.createComment(e),t,n,r,i)}function Z(e,t,n,r){if(!/^(key|children|ref)$/.test(t)&&(t!==`innerHTML`||e.localName!==`astro-slot`)){if(/^(innerHTML|outerHTML|textContent|innerText|dangerouslySetInnerHTML)$/.test(t))throw Error(void 0);if(t.startsWith(`on`)){let i=/(?<!Pointer)Capture$/.test(t),a=t.slice(2,i?-7:void 0).toLowerCase().replace(`doubleclick`,`dblclick`);r&&e.removeEventListener(a,r,i),n!=null&&e.addEventListener(a,n,i)}else if(t===`className`&&(t=`class`),t===`htmlFor`&&(t=`for`),e.namespaceURI===K&&t in e&&!/^(style|form|list)$/.test(t)){let r=e;r[t]=n??(typeof r[t]!=`boolean`&&``)}else n==null||n===!1&&!/^(aria-|data-)/.test(t)?e.removeAttribute(t):e.setAttribute(t,n===!0&&!/^(aria-|data-)/.test(t)?``:String(n))}}function Q(e,t,n,r,i,a,o=()=>e){if(typeof e==`function`){X(`{`,t,n,r,a);let e=null,s=new Map,c=r._root._presence?.collection(e=>e._scope,(e,t)=>typeof e._value==typeof t&&e._value?.type===t?.type),l=(e,t,n,r)=>{c?c.remove(e,t,n,r,()=>{}):x(e._scope)},u=a;O(r,()=>o()(),a=>{let o=[a].flat(1/0),d=new Map,f=t.ownerDocument.activeElement;for(let a=0;a<o.length;a++){let f=o[a],p=f,m=p?.props?.key,h=m==null?a:String(m),g=s.get(h);if(g&&(typeof g._value!=typeof f||g._value?.type!==p?.type)&&(l(g,h,f==null||typeof f==`boolean`,[...s.keys()].indexOf(h)),g=void 0),g??=c?.take(h,f),g)g._value=f,r._root._presence?.resume(g._scope),S(g._scope);else{let a=y(r);g={_value:f,_scope:a,_start:X(`[`,t,e??n,a,u),_end:null};let o=g;Q(f,t,e??n,a,i,u,()=>o._value),g._end=X(`]`,t,e??n,a,u)}d.set(h,g)}for(let[e,t]of s)d.has(e)||l(t,e,!0,[...s.keys()].indexOf(e));if(!u){let r=e??n,i=c?.merge([...d.values()])??[...d.values()];for(let e of i.reverse()){if(e._end.nextSibling!==r){let n=t.ownerDocument.createRange();n.setStartBefore(e._start),n.setEndAfter(e._end),t.insertBefore(n.extractContents(),r)}r=e._start}f?.isConnected&&!f.closest(`[inert]`)&&f!==t.ownerDocument.activeElement&&f.focus({preventScroll:!0})}u=void 0,s=d}),e=X(`}`,t,n,r,a);return}if(Array.isArray(e)){for(let o of e)Q(o,t,n,r,i,a);return}if(e==null||typeof e==`boolean`)return;if(typeof e!=`object`){X(`t`,t,n,r,a);let i=Y(t.ownerDocument.createTextNode(String(e)),t,n,r,a);O(r,o,e=>{let t=String(e);i.nodeValue!==t&&(i.nodeValue=t)});return}let s=e,c=H(()=>o().props);if(!s.type||s.type===R){Q(()=>c.children,t,n,r,i,a);return}if(typeof s.type==`function`){let e=y(r);Q(_(e,()=>v(()=>s.type(c))),t,n,e,i,a);return}let l=s.type===`svg`?q:i,u=Y(t.ownerDocument.createElementNS(l,s.type),t,n,r,a);if(s.type===`astro-slot`)a||(u.innerHTML=c.innerHTML??``);else if(l===K&&/^(textarea|title|style|script)$/.test(s.type))O(r,()=>I(s.type===`textarea`?c.value??c.children:c.children),e=>{u.textContent!==e&&(u.textContent=e)});else{let e=a?{node:u.firstChild,report:a.report}:void 0;/^(area|base|br|col|embed|hr|img|input|link|meta|param|source|track|wbr)$/.test(s.type)&&l===K||Q(()=>c.children,u,null,r,s.type===`foreignObject`?K:l,e),J(e)}let d=G(r,{kind:`dom`,node:u},()=>({...c})),f={};r._cleanups.add(()=>{for(let e in f)e.startsWith(`on`)&&Z(u,e,null,f[e])}),O(r,()=>({...c}),e=>{let t=d(e);for(let e in{...f,...t})Object.is(f[e],t[e])&&typeof t[e]!=`object`||(Z(u,e,t[e],f[e]),f[e]=t[e]);f=t});let p=v(()=>c.ref);p&&r._root._mounts.unshift(()=>{r._dead||(r._cleanups.add(()=>p(null)),p(u))})}function $(e,t,n,r){let i=!1,a=r?{node:t.firstChild,report(e,n){i||(i=!0,console.warn(`spa: hydration mismatch. Repairing server HTML to match the browser view; replaced nodes may lose focus or unsaved input.`,{host:t,expected:e,found:n}))}}:void 0,o=a?.node,s=o?.nodeType===8&&o.nodeValue?.startsWith(`w:`)?o.nodeValue.slice(2):void 0,c=w(n);s!==void 0&&n.idPrefix===void 0&&(c._prefix=s);try{X(`w:${c._prefix}`,t,null,c,a),_(c,()=>{Q(v(e),t,null,c,t.namespaceURI===q?q:K,a)}),X(`/w`,t,null,c,a),J(a),c.flush()}catch(e){b(c,e)}return{dispose:()=>{x(c)},flush:c.flush}}function te(e,t,n={}){return $(e,t,n,!1)}function ne(e,t,n={}){return $(e,t,n,!0)}function re(...e){let t=m._root._store,[n]=e,r=n.type.endsWith(`_family`),i=k(n,e[1]),a=A(i),o=r?2:1,s=e[o],c=e.length>o,l=c,u=s,d;return()=>{let e=a(),n=e instanceof Promise;if(!n){u=e,l=!0;let n=p(t,i);d=c&&`catch`in n&&n.catch.some(t=>e instanceof t)?e:void 0}return l?d?{loading:n,value:s,error:d}:{loading:n,value:u}:`LOADING`}}export{R as Fragment,ne as hydrate,z as jsx,V as jsxDEV,B as jsxs,H as merge,E as onCleanup,D as onMount,te as render,A as useGetter,ee as useId,re as useLoadable,P as useRef,j as useSetter,T as useStore,F as useTimeline,M as useTransaction};
|
|
1
|
+
import{IMPLICIT as e,actUponStore as t,clearTimelineInStore as n,disposeFromStore as r,findInStore as i,findTimelineInStore as a,getFromStore as o,getTimelineTransactionAtHead as s,setIntoStore as c,subscribeToState as l,subscribeToTimeline as u,timeTravel as d,timeTravelTransactionGroupInStore as f,withdraw as p,withdraw as m}from"atom.io/internal";var h,g,_=0;function v(e,t){let n=h;h=e;try{return t()}finally{h=n}}function y(e){let t=g;g=void 0;try{return e()}finally{g=t}}function b(e){let t={_root:e?._root,_parent:e,_cleanups:new Set,_updates:[],_dead:!1};return e?._cleanups.add(t),t}function x(e,t){try{S(e)}catch(e){throw AggregateError([t,e])}throw t}function S(e){if(e._dead)return;e._dead=!0;let t=[];try{e._root._presence?.forget(e)}catch(e){t.push(e)}for(let n of[...e._cleanups].reverse())try{typeof n==`function`?n():S(n)}catch(e){t.push(e)}if(e._parent?._cleanups.delete(e),e._cleanups.clear(),e._updates.length=0,t.length)throw AggregateError(t)}function C(e){for(let t of e._updates)w(e,t);for(let t of e._cleanups)typeof t!=`function`&&C(t)}function w(e,t){if(!z(e))return;let n=e._root;n._queue.size||queueMicrotask(()=>{try{n.flush()}catch(e){n.error(e)}}),n._queue.add(t)}function T(t={},n=!1){let r=new Map;for(let e of t.capabilities??[]){if(r.has(e.namespace))throw Error(`spa: duplicate capability ${e.namespace}`);r.set(e.namespace,e)}let i={_capabilities:r,_store:t.store??e.STORE,_prefix:t.idPrefix??`w${_++}`,_id:0,...b(),_queue:new Set,_mounts:n?void 0:[]};i._root=i,i.error=t.onError??(e=>{throw e});for(let e of r.values())if(e.presence){if(i._presence)throw Error(`spa: multiple presence coordinators`);i._presence=e.presence(i)}return i.flush=()=>{if(i._queue.size||i._mounts.length)try{let e=[...r.values()].map(e=>e.beforeUpdate?.(i));try{for(;i._queue.size||i._mounts.length;){for(let e of[...i._queue])i._queue.delete(e)&&e();for(let e of i._mounts.splice(0))e()}}finally{for(let t of e)t?.()}}catch(e){x(i,e)}},i}function E(){return h._root._store}function D(){return r.bind(null,E())}function O(e){h._cleanups.add(e)}function k(e){let t=h;t._root._mounts?.push(()=>{t._dead||v(t,()=>{y(e)})})}function A(){let e=h._root;return`${e._prefix}-${e._id++}`}function j(e,t,n){let r=new Map,i=()=>{if(!z(e))return;let a=new Set,o=g;g=t=>{a.add(t),r.has(t)||r.set(t,t(()=>{w(e,i)}))};let s;try{s=v(e,t)}finally{g=o;for(let[e,t]of r)a.has(e)||(t(),r.delete(e))}y(()=>{n(s)})};e._updates.push(i),e._cleanups.add(()=>{e._root._queue.delete(i);for(let e of r.values())e()}),i()}function M(e,t){let n=E();return e.type.endsWith(`_family`)?i(n,e,t):e}function N(e,t){e=M(e,t);let n=h._root,r=E(),i=t=>l(r,e,`spa:${_++}`,t);return()=>{let t=o(r,e);return n._onRead?.(t,e),g?.(i),t}}function P(e,t){e=M(e,t);let n=E();return t=>{c(n,e,t)}}function F(e){return t(E(),e,`spa:${_++}`)}var I=new WeakMap;function ee(e,t){e=M(e,t);let n=E(),r=I.get(n)??new Map;I.set(n,r);let i={},a=null;return t=>{t?(a=t,r.set(e.key,i),c(n,e,t)):r.get(e.key)===i&&(r.delete(e.key),o(n,e)===a&&c(n,e,null),a=null)}}function L(e,t){let r=E(),i=e.type===`timeline_family`?a(r,e,t):e,o=e=>u(r,i,`spa:${_++}`,e),c=()=>{let e=p(r,i);return g?.(o),e};return{getCursor:()=>c().at,getLength:()=>c().history.length,undo:()=>{d(r,`undo`,i)},redo:()=>{d(r,`redo`,i)},clear:()=>{n(r,i)},getTransaction:()=>{let e=c(),t={};for(let n of[`undo`,`redo`]){let i=s(e,n);i&&(t[n]=()=>{f(r,n,i)})}return t}}}function R(e){return typeof e==`function`?R(e()):Array.isArray(e)?e.map(R).join(``):e==null||typeof e==`boolean`?``:String(e)}function z(e){for(let t=e;t;t=t._parent)if(t._dead||t._exiting)return!1;return!0}var B=e=>e.children;function V(e,t,n){return{type:e,props:n===void 0?t??{}:H(t??{},{key:n})}}var te=V,ne=V;function H(...e){let t=()=>e.map(e=>(typeof e==`function`?e():e)??{});return new Proxy({},{get:(e,n)=>t().reverse().find(e=>Object.hasOwn(e,n))?.[n],ownKeys:()=>[...new Set(t().flatMap(Object.keys))],getOwnPropertyDescriptor:(e,n)=>t().some(e=>Object.hasOwn(e,n))?{enumerable:!0,configurable:!0}:void 0})}function U(e){let t=e.indexOf(`:`);if(t<0)return;let n=e.slice(0,t);return/^(xml|xmlns|xlink)$/.test(n)?void 0:n}function W(e,t){for(let n of Object.keys(t)){let t=U(n);if(t&&!e._root._capabilities.has(t))throw Error(`spa: capability "${t}" is not registered for this root`)}}function G(e,t,n,r){let i=new Map;return e._root._presence?.target(e,t),e._cleanups.add(()=>{let e=[];for(let t of[...i.values()].reverse())try{t.dispose()}catch(t){e.push(t)}if(i.clear(),e.length)throw AggregateError(e)}),a=>{W(e,a);let o={},s=new Map;for(let t of Object.keys(a)){let n=U(t);if(!n){let n=a[t];o[t]=t.startsWith(`on`)&&typeof n==`function`?e._root._presence?.event(e,n)??n:n;continue}let r=s.get(n)??{};r[t.slice(n.length+1)]=a[t],s.set(n,r)}let c=r?.(o);for(let[r,o]of s){let s=i.get(r);s||(s=e._root._capabilities.get(r).attach(t,e),i.set(r,s),e._root._presence?.bind(e,s,n??(()=>a),r)),c===void 0?s.update(o):s.update(o,c)}for(let[t,n]of i)s.has(t)||(i.delete(t),e._root._presence?.unbind(n),n.dispose());return o}}var K=`http://www.w3.org/1999/xhtml`,q=`http://www.w3.org/2000/svg`;function J(e){if(e?.node)for(e.report(null,e.node);e.node;){let t=e.node;e.node=t.nextSibling,t.remove()}}function Y(e,t,n,r,i){if(i&&(e.nodeType!==3||e.nodeValue||i.node?.nodeType===3)){let n=i.node;!n||n.nodeType!==e.nodeType||n.nodeName!==e.nodeName||n.namespaceURI!==e.namespaceURI||e.nodeType!==1&&n.nodeValue!==e.nodeValue?(i.report(e,n),t.insertBefore(e,n),i.node=n?.nextSibling??null,n?.remove()):(e=n,i.node=n.nextSibling)}else t.insertBefore(e,i?i.node:n);return r._cleanups.add(()=>{e.remove()}),e}function X(e,t,n,r,i){return Y(t.ownerDocument.createComment(e),t,n,r,i)}function Z(e,t,n,r){if(!/^(key|children|ref)$/.test(t)&&(t!==`innerHTML`||e.localName!==`astro-slot`)){if(/^(innerHTML|outerHTML|textContent|innerText|dangerouslySetInnerHTML)$/.test(t))throw Error(void 0);if(t.startsWith(`on`)){let i=/(?<!Pointer)Capture$/.test(t),a=t.slice(2,i?-7:void 0).toLowerCase().replace(`doubleclick`,`dblclick`);r&&e.removeEventListener(a,r,i),n!=null&&e.addEventListener(a,n,i)}else if(t===`className`&&(t=`class`),t===`htmlFor`&&(t=`for`),e.namespaceURI===K&&t in e&&!/^(style|form|list)$/.test(t)){let r=e;r[t]=n??(typeof r[t]!=`boolean`&&``)}else n==null||n===!1&&!/^(aria-|data-)/.test(t)?e.removeAttribute(t):e.setAttribute(t,n===!0&&!/^(aria-|data-)/.test(t)?``:String(n))}}function Q(e,t,n,r,i,a,o=()=>e){if(typeof e==`function`){X(`{`,t,n,r,a);let e=null,s=new Map,c=r._root._presence?.collection(e=>e._scope,(e,t)=>typeof e._value==typeof t&&e._value?.type===t?.type),l=(e,t,n,r)=>{c?c.remove(e,t,n,r,()=>{}):S(e._scope)},u=a;j(r,()=>o()(),a=>{let o=[a].flat(1/0),d=new Map,f=t.ownerDocument.activeElement;for(let a=0;a<o.length;a++){let f=o[a],p=f,m=p?.props?.key,h=m==null?a:String(m),g=s.get(h);if(g&&(typeof g._value!=typeof f||g._value?.type!==p?.type)&&(l(g,h,f==null||typeof f==`boolean`,[...s.keys()].indexOf(h)),g=void 0),g??=c?.take(h,f),g)g._value=f,r._root._presence?.resume(g._scope),C(g._scope);else{let a=b(r);g={_value:f,_scope:a,_start:X(`[`,t,e??n,a,u),_end:null};let o=g;Q(f,t,e??n,a,i,u,()=>o._value),g._end=X(`]`,t,e??n,a,u)}d.set(h,g)}for(let[e,t]of s)d.has(e)||l(t,e,!0,[...s.keys()].indexOf(e));if(!u){let r=e??n,i=c?.merge([...d.values()])??[...d.values()];for(let e of i.reverse()){if(e._end.nextSibling!==r){let n=t.ownerDocument.createRange();n.setStartBefore(e._start),n.setEndAfter(e._end),t.insertBefore(n.extractContents(),r)}r=e._start}f?.isConnected&&!f.closest(`[inert]`)&&f!==t.ownerDocument.activeElement&&f.focus({preventScroll:!0})}u=void 0,s=d}),e=X(`}`,t,n,r,a);return}if(Array.isArray(e)){for(let o of e)Q(o,t,n,r,i,a);return}if(e==null||typeof e==`boolean`)return;if(typeof e!=`object`){X(`t`,t,n,r,a);let i=Y(t.ownerDocument.createTextNode(String(e)),t,n,r,a);j(r,o,e=>{let t=String(e);i.nodeValue!==t&&(i.nodeValue=t)});return}let s=e,c=H(()=>o().props);if(!s.type||s.type===B){Q(()=>c.children,t,n,r,i,a);return}if(typeof s.type==`function`){let e=b(r);Q(v(e,()=>y(()=>s.type(c))),t,n,e,i,a);return}let l=s.type===`svg`?q:i,u=Y(t.ownerDocument.createElementNS(l,s.type),t,n,r,a);if(s.type===`astro-slot`)a||(u.innerHTML=c.innerHTML??``);else if(l===K&&/^(textarea|title|style|script)$/.test(s.type))j(r,()=>R(s.type===`textarea`?c.value??c.children:c.children),e=>{u.textContent!==e&&(u.textContent=e)});else{let e=a?{node:u.firstChild,report:a.report}:void 0;/^(area|base|br|col|embed|hr|img|input|link|meta|param|source|track|wbr)$/.test(s.type)&&l===K||Q(()=>c.children,u,null,r,s.type===`foreignObject`?K:l,e),J(e)}let d={},f=G(r,{kind:`dom`,node:u},()=>({...c}),e=>{let t=d.style===e.style?void 0:u.getAttribute(`style`)??``;for(let t in{...d,...e})Object.is(d[t],e[t])&&typeof e[t]!=`object`||(Z(u,t,e[t],d[t]),d[t]=e[t]);return d=e,t});r._cleanups.add(()=>{for(let e in d)e.startsWith(`on`)&&Z(u,e,null,d[e])}),j(r,()=>({...c}),f);let p=y(()=>c.ref);p&&r._root._mounts.unshift(()=>{r._dead||(r._cleanups.add(()=>p(null)),p(u))})}function $(e,t,n,r){let i=!1,a=r?{node:t.firstChild,report(e,n){i||(i=!0,console.warn(`spa: hydration mismatch. Repairing server HTML to match the browser view; replaced nodes may lose focus or unsaved input.`,{host:t,expected:e,found:n}))}}:void 0,o=a?.node,s=o?.nodeType===8&&o.nodeValue?.startsWith(`w:`)?o.nodeValue.slice(2):void 0,c=T(n);s!==void 0&&n.idPrefix===void 0&&(c._prefix=s);try{X(`w:${c._prefix}`,t,null,c,a),v(c,()=>{Q(y(e),t,null,c,t.namespaceURI===q?q:K,a)}),X(`/w`,t,null,c,a),J(a),c.flush()}catch(e){x(c,e)}return{dispose:()=>{S(c)},flush:c.flush}}function re(e,t,n={}){return $(e,t,n,!1)}function ie(e,t,n={}){return $(e,t,n,!0)}function ae(...e){let t=h._root._store,[n]=e,r=n.type.endsWith(`_family`),i=M(n,e[1]),a=N(i),o=r?2:1,s=e[o],c=e.length>o,l=c,u=s,d;return()=>{let e=a(),n=e instanceof Promise;if(!n){u=e,l=!0;let n=m(t,i);d=c&&`catch`in n&&n.catch.some(t=>e instanceof t)?e:void 0}return l?d?{loading:n,value:s,error:d}:{loading:n,value:u}:`LOADING`}}export{B as Fragment,ie as hydrate,V as jsx,ne as jsxDEV,te as jsxs,H as merge,O as onCleanup,k as onMount,re as render,D as useDisposal,N as useGetter,A as useId,ae as useLoadable,ee as useRef,P as useSetter,E as useStore,L as useTimeline,F as useTransaction};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IMPLICIT, actUponStore, clearTimelineInStore, findInStore, findTimelineInStore, getFromStore, getTimelineTransactionAtHead, setIntoStore, subscribeToState, subscribeToTimeline, timeTravel, timeTravelTransactionGroupInStore, withdraw } from "atom.io/internal";
|
|
1
|
+
import { IMPLICIT, actUponStore, clearTimelineInStore, disposeFromStore, findInStore, findTimelineInStore, getFromStore, getTimelineTransactionAtHead, setIntoStore, subscribeToState, subscribeToTimeline, timeTravel, timeTravelTransactionGroupInStore, withdraw } from "atom.io/internal";
|
|
2
2
|
// src/core.ts
|
|
3
3
|
let owner;
|
|
4
4
|
let tracking;
|
|
@@ -99,10 +99,16 @@ function createRoot(options = {}, server = false) {
|
|
|
99
99
|
root._presence = capability.presence(root);
|
|
100
100
|
}
|
|
101
101
|
root.flush = () => {
|
|
102
|
+
if (!root._queue.size && !root._mounts.length) return;
|
|
102
103
|
try {
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
104
|
+
const commits = [...capabilities.values()].map((capability) => capability.beforeUpdate?.(root));
|
|
105
|
+
try {
|
|
106
|
+
while (root._queue.size || root._mounts.length) {
|
|
107
|
+
for (const run of [...root._queue]) if (root._queue.delete(run)) run();
|
|
108
|
+
for (const run of root._mounts.splice(0)) run();
|
|
109
|
+
}
|
|
110
|
+
} finally {
|
|
111
|
+
for (const commit of commits) commit?.();
|
|
106
112
|
}
|
|
107
113
|
} catch (error) {
|
|
108
114
|
fail(root, error);
|
|
@@ -114,6 +120,10 @@ function createRoot(options = {}, server = false) {
|
|
|
114
120
|
function useStore() {
|
|
115
121
|
return owner._root._store;
|
|
116
122
|
}
|
|
123
|
+
/** Return atom.io disposal bound to the current root's store. */
|
|
124
|
+
function useDisposal() {
|
|
125
|
+
return disposeFromStore.bind(null, useStore());
|
|
126
|
+
}
|
|
117
127
|
function onCleanup(cleanup) {
|
|
118
128
|
owner._cleanups.add(cleanup);
|
|
119
129
|
}
|
|
@@ -164,13 +174,13 @@ function observe(scope, read, apply) {
|
|
|
164
174
|
}
|
|
165
175
|
/** Resolve a fixed family key in the current owner's store. */
|
|
166
176
|
function resolveStateToken(token, key) {
|
|
167
|
-
const store =
|
|
177
|
+
const store = useStore();
|
|
168
178
|
return token.type.endsWith(`_family`) ? findInStore(store, token, key) : token;
|
|
169
179
|
}
|
|
170
180
|
function useGetter(token, key) {
|
|
171
181
|
token = resolveStateToken(token, key);
|
|
172
182
|
const root = owner._root;
|
|
173
|
-
const store =
|
|
183
|
+
const store = useStore();
|
|
174
184
|
const subscribe = (notify) => subscribeToState(store, token, `spa:${serial++}`, notify);
|
|
175
185
|
return () => {
|
|
176
186
|
const value = getFromStore(store, token);
|
|
@@ -181,18 +191,18 @@ function useGetter(token, key) {
|
|
|
181
191
|
}
|
|
182
192
|
function useSetter(token, key) {
|
|
183
193
|
token = resolveStateToken(token, key);
|
|
184
|
-
const store =
|
|
194
|
+
const store = useStore();
|
|
185
195
|
return (value) => {
|
|
186
196
|
setIntoStore(store, token, value);
|
|
187
197
|
};
|
|
188
198
|
}
|
|
189
199
|
function useTransaction(token) {
|
|
190
|
-
return actUponStore(
|
|
200
|
+
return actUponStore(useStore(), token, `spa:${serial++}`);
|
|
191
201
|
}
|
|
192
202
|
const refs = /* @__PURE__ */ new WeakMap();
|
|
193
203
|
function useRef(token, key) {
|
|
194
204
|
token = resolveStateToken(token, key);
|
|
195
|
-
const store =
|
|
205
|
+
const store = useStore();
|
|
196
206
|
const owners = refs.get(store) ?? /* @__PURE__ */ new Map();
|
|
197
207
|
refs.set(store, owners);
|
|
198
208
|
const identity = {};
|
|
@@ -210,7 +220,7 @@ function useRef(token, key) {
|
|
|
210
220
|
};
|
|
211
221
|
}
|
|
212
222
|
function useTimeline(token, key) {
|
|
213
|
-
const store =
|
|
223
|
+
const store = useStore();
|
|
214
224
|
const selected = token.type === `timeline_family` ? findTimelineInStore(store, token, key) : token;
|
|
215
225
|
const subscribe = (notify) => subscribeToTimeline(store, selected, `spa:${serial++}`, notify);
|
|
216
226
|
const read = () => {
|
|
@@ -253,6 +263,6 @@ function isPresent(scope) {
|
|
|
253
263
|
for (let at = scope; at; at = at._parent) if (at._dead || at._exiting) return false;
|
|
254
264
|
return true;
|
|
255
265
|
}
|
|
256
|
-
export {
|
|
266
|
+
export { within as S, useRef as _, invalidate as a, useTimeline as b, onCleanup as c, plain as d, resolveStateToken as f, useId as g, useGetter as h, fail as i, onMount as l, useDisposal as m, createScope as n, isPresent as o, untrack as p, dispose as r, observe as s, createRoot as t, owner as u, useSetter as v, useTransaction as x, useStore as y };
|
|
257
267
|
|
|
258
|
-
//# sourceMappingURL=core-
|
|
268
|
+
//# sourceMappingURL=core-B4rJ0xdc.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"core-B4rJ0xdc.js","names":[],"sources":["../src/core.ts"],"sourcesContent":["import type {\n\tdisposeState,\n\tReadableFamilyToken,\n\tReadableToken,\n\tRegularAtomFamilyToken,\n\tRegularAtomToken,\n\tSetter,\n\tTimelineFamilyToken,\n\tTimelineManageable,\n\tTimelineToken,\n\tTransactionToken,\n\tViewOf,\n\tWritableFamilyToken,\n\tWritableToken,\n} from \"atom.io\"\nimport type { Canonical } from \"atom.io/foundations/canonical\"\nimport type { RootStore } from \"atom.io/internal\"\nimport {\n\tactUponStore,\n\tclearTimelineInStore,\n\tdisposeFromStore,\n\tfindInStore,\n\tfindTimelineInStore,\n\tgetFromStore,\n\tgetTimelineTransactionAtHead,\n\tIMPLICIT,\n\tsetIntoStore,\n\tsubscribeToState,\n\tsubscribeToTimeline,\n\ttimeTravel,\n\ttimeTravelTransactionGroupInStore,\n\twithdraw,\n} from \"atom.io/internal\"\n\nimport type { Capability } from \"./capabilities.ts\"\nimport type {\n\tExitParticipant,\n\tPresenceCoordinator,\n\tPresenceTarget,\n} from \"./presence.ts\"\n\nexport type Cleanup = () => void\n// A callable interface permits the recursive Children union. A type alias does not.\n/* oxlint-disable typescript/prefer-function-type -- A callable interface is required for recursive Children. */\nexport interface Accessor<T> {\n\t(): T\n}\n/* oxlint-enable typescript/prefer-function-type */\nexport type Component<P = any> = (props: P) => Children\n/** A JSX descriptor for an intrinsic tag, component, or fragment. */\nexport interface SpaElement {\n\ttype: string | Component | null\n\tprops: Record<string, any>\n}\n/** Renderable content, including nested groups and reactive accessors. */\nexport type Children =\n\t| SpaElement\n\t| string\n\t| number\n\t| bigint\n\t| boolean\n\t| null\n\t| undefined\n\t| readonly Children[]\n\t| Accessor<Children>\nexport interface RootOptions {\n\tcapabilities?: readonly Capability[]\n\tstore?: RootStore\n\tidPrefix?: string\n\tonError?: (error: unknown) => void\n}\nexport interface Scope {\n\t_exiting?: boolean\n\t_exits?: Set<ExitParticipant>\n\t_targets?: Set<PresenceTarget>\n\t_root: Root\n\t_parent?: Scope | undefined\n\t_cleanups: Set<Cleanup | Scope>\n\t_updates: Cleanup[]\n\t_dead: boolean\n}\nexport interface Root extends Scope {\n\t_onRead?: ((value: unknown, token: ReadableToken<unknown>) => void) | undefined\n\t_presence?: PresenceCoordinator\n\t_capabilities: Map<string, Capability>\n\t_store: RootStore\n\t_prefix: string\n\t_id: number\n\t_queue: Set<Cleanup>\n\t_mounts: Cleanup[] | undefined\n\tflush: Cleanup\n\terror: (error: unknown) => void\n}\n\nexport let owner: Scope | undefined\ntype Subscribe = (notify: Cleanup) => Cleanup\nlet tracking: ((subscribe: Subscribe) => void) | undefined\nlet serial = 0\n\nexport function within<T>(scope: Scope, run: () => T): T {\n\tconst previous = owner\n\towner = scope\n\ttry {\n\t\treturn run()\n\t} finally {\n\t\towner = previous\n\t}\n}\nexport function untrack<T>(run: () => T): T {\n\tconst previous = tracking\n\ttracking = undefined\n\ttry {\n\t\treturn run()\n\t} finally {\n\t\ttracking = previous\n\t}\n}\nexport function createScope(parent?: Scope): Scope {\n\tconst child: Scope = {\n\t\t_root: parent?._root as Root,\n\t\t_parent: parent,\n\t\t_cleanups: new Set(),\n\t\t_updates: [],\n\t\t_dead: false,\n\t}\n\tparent?._cleanups.add(child)\n\treturn child\n}\nexport function fail(scope: Scope, error: unknown): never {\n\ttry {\n\t\tdispose(scope)\n\t} catch (cleanup) {\n\t\tthrow new AggregateError([error, cleanup])\n\t}\n\tthrow error\n}\nexport function dispose(scope: Scope): void {\n\tif (scope._dead) return\n\tscope._dead = true\n\tconst errors: unknown[] = []\n\ttry {\n\t\tscope._root._presence?.forget(scope)\n\t} catch (error) {\n\t\terrors.push(error)\n\t}\n\tfor (const cleanup of [...scope._cleanups].reverse()) {\n\t\ttry {\n\t\t\ttypeof cleanup === `function` ? cleanup() : dispose(cleanup)\n\t\t} catch (error) {\n\t\t\terrors.push(error)\n\t\t}\n\t}\n\tscope._parent?._cleanups.delete(scope)\n\tscope._cleanups.clear()\n\tscope._updates.length = 0\n\tif (errors.length) throw new AggregateError(errors)\n}\nexport function invalidate(scope: Scope): void {\n\tfor (const run of scope._updates) enqueue(scope, run)\n\tfor (const child of scope._cleanups)\n\t\tif (typeof child !== `function`) invalidate(child)\n}\nfunction enqueue(scope: Scope, run: Cleanup): void {\n\tif (!isPresent(scope)) return\n\tconst root = scope._root\n\tif (!root._queue.size)\n\t\tqueueMicrotask(() => {\n\t\t\ttry {\n\t\t\t\troot.flush()\n\t\t\t} catch (error) {\n\t\t\t\troot.error(error)\n\t\t\t}\n\t\t})\n\troot._queue.add(run)\n}\nexport function createRoot(options: RootOptions = {}, server = false): Root {\n\tconst capabilities = new Map<string, Capability>()\n\tfor (const capability of options.capabilities ?? []) {\n\t\tif (capabilities.has(capability.namespace))\n\t\t\tthrow new Error(`spa: duplicate capability ${capability.namespace}`)\n\t\tcapabilities.set(capability.namespace, capability)\n\t}\n\tconst root = {\n\t\t_capabilities: capabilities,\n\t\t_store: options.store ?? IMPLICIT.STORE,\n\t\t_prefix: options.idPrefix ?? `w${serial++}`,\n\t\t_id: 0,\n\t\t...createScope(),\n\t\t_queue: new Set(),\n\t\t_mounts: server ? undefined : [],\n\t} as unknown as Root\n\troot._root = root\n\troot.error =\n\t\toptions.onError ??\n\t\t((error) => {\n\t\t\tthrow error\n\t\t})\n\tfor (const capability of capabilities.values())\n\t\tif (capability.presence) {\n\t\t\tif (root._presence) throw new Error(`spa: multiple presence coordinators`)\n\t\t\troot._presence = capability.presence(root)\n\t\t}\n\troot.flush = () => {\n\t\tif (!root._queue.size && !root._mounts!.length) return\n\t\ttry {\n\t\t\tconst commits = [...capabilities.values()].map((capability) =>\n\t\t\t\tcapability.beforeUpdate?.(root),\n\t\t\t)\n\t\t\ttry {\n\t\t\t\tlet passes = 0\n\t\t\t\twhile (root._queue.size || root._mounts!.length) {\n\t\t\t\t\tif (import.meta.env.DEV && ++passes > 100)\n\t\t\t\t\t\tthrow new Error(`spa: update loop`)\n\t\t\t\t\tfor (const run of [...root._queue]) if (root._queue.delete(run)) run()\n\t\t\t\t\tfor (const run of root._mounts!.splice(0)) run()\n\t\t\t\t}\n\t\t\t} finally {\n\t\t\t\tfor (const commit of commits) commit?.()\n\t\t\t}\n\t\t} catch (error) {\n\t\t\tfail(root, error)\n\t\t}\n\t}\n\treturn root\n}\n/** Return the atom.io store selected by the current root. */\nexport function useStore(): RootStore {\n\treturn owner!._root._store\n}\n/** Return atom.io disposal bound to the current root's store. */\nexport function useDisposal(): typeof disposeState {\n\treturn disposeFromStore.bind(null, useStore()) as typeof disposeState\n}\nexport function onCleanup(cleanup: Cleanup): void {\n\towner!._cleanups.add(cleanup)\n}\nexport function onMount(run: Cleanup): void {\n\tconst scope = owner!\n\tscope._root._mounts?.push(() => {\n\t\tif (!scope._dead)\n\t\t\twithin(scope, () => {\n\t\t\t\tuntrack(run)\n\t\t\t})\n\t})\n}\nexport function useId(): string {\n\tconst root = owner!._root\n\treturn `${root._prefix}-${root._id++}`\n}\n\nexport function observe<T>(\n\tscope: Scope,\n\tread: Accessor<T>,\n\tapply: (value: T) => void,\n): void {\n\tconst subscriptions = new Map<Subscribe, Cleanup>()\n\tconst run = () => {\n\t\tif (!isPresent(scope)) return\n\t\tconst used = new Set<Subscribe>()\n\t\tconst previous = tracking\n\t\ttracking = (subscribe) => {\n\t\t\tused.add(subscribe)\n\t\t\tif (!subscriptions.has(subscribe))\n\t\t\t\tsubscriptions.set(\n\t\t\t\t\tsubscribe,\n\t\t\t\t\tsubscribe(() => {\n\t\t\t\t\t\tenqueue(scope, run)\n\t\t\t\t\t}),\n\t\t\t\t)\n\t\t}\n\t\tlet value: T\n\t\ttry {\n\t\t\tvalue = within(scope, read)\n\t\t} finally {\n\t\t\ttracking = previous\n\t\t\tfor (const [subscribe, unsubscribe] of subscriptions)\n\t\t\t\tif (!used.has(subscribe)) {\n\t\t\t\t\tunsubscribe()\n\t\t\t\t\tsubscriptions.delete(subscribe)\n\t\t\t\t}\n\t\t}\n\t\tuntrack(() => {\n\t\t\tapply(value)\n\t\t})\n\t}\n\tscope._updates.push(run)\n\tscope._cleanups.add(() => {\n\t\tscope._root._queue.delete(run)\n\t\tfor (const unsubscribe of subscriptions.values()) unsubscribe()\n\t})\n\trun()\n}\n\n/** Resolve a fixed family key in the current owner's store. */\nexport function resolveStateToken(token: any, key?: Canonical): any {\n\tconst store = useStore()\n\treturn token.type.endsWith(`_family`) ? findInStore(store, token, key!) : token\n}\n\n/** Capture a token for this instance. Change the component key to change its token. */\nexport function useGetter<T, E = never>(\n\ttoken: ReadableToken<T, any, E>,\n): Accessor<ViewOf<T | E>>\nexport function useGetter<T, K extends Canonical, E = never>(\n\tfamily: ReadableFamilyToken<T, K, E>,\n\tkey: NoInfer<K>,\n): Accessor<ViewOf<T | E>>\nexport function useGetter(token: any, key?: Canonical): Accessor<any> {\n\ttoken = resolveStateToken(token, key)\n\tconst root = owner!._root\n\tconst store = useStore()\n\tconst subscribe: Subscribe = (notify) =>\n\t\tsubscribeToState(store, token, `spa:${serial++}`, notify)\n\treturn () => {\n\t\tconst value = getFromStore(store, token)\n\t\troot._onRead?.(value, token)\n\t\ttracking?.(subscribe)\n\t\treturn value\n\t}\n}\nexport function useSetter<T>(\n\ttoken: WritableToken<T, any, any>,\n): (value: T | Setter<T>) => void\nexport function useSetter<T, K extends Canonical>(\n\tfamily: WritableFamilyToken<T, K, any>,\n\tkey: NoInfer<K>,\n): (value: T | Setter<T>) => void\nexport function useSetter(token: any, key?: Canonical): (value: any) => void {\n\ttoken = resolveStateToken(token, key)\n\tconst store = useStore()\n\treturn (value) => {\n\t\tsetIntoStore(store, token, value)\n\t}\n}\nexport function useTransaction<F extends (...args: any[]) => any>(\n\ttoken: TransactionToken<F>,\n): (...args: Parameters<F>) => ReturnType<F> {\n\treturn actUponStore(useStore(), token, `spa:${serial++}`)\n}\n\nconst refs = new WeakMap<RootStore, Map<string, object>>()\nexport function useRef<E extends Element>(\n\ttoken: RegularAtomToken<E | null>,\n): (element: E | null) => void\nexport function useRef<E extends Element, K extends Canonical>(\n\tfamily: RegularAtomFamilyToken<E | null, K>,\n\tkey: NoInfer<K>,\n): (element: E | null) => void\nexport function useRef<E extends Element>(\n\ttoken: any,\n\tkey?: Canonical,\n): (element: E | null) => void {\n\ttoken = resolveStateToken(token, key)\n\tconst store = useStore()\n\tconst owners = refs.get(store) ?? new Map<string, object>()\n\trefs.set(store, owners)\n\tconst identity = {}\n\tlet held: E | null = null\n\treturn (element) => {\n\t\tif (element) {\n\t\t\theld = element\n\t\t\towners.set(token.key, identity)\n\t\t\tsetIntoStore(store, token, element)\n\t\t} else if (owners.get(token.key) === identity) {\n\t\t\towners.delete(token.key)\n\t\t\tif (getFromStore(store, token) === held) setIntoStore(store, token, null)\n\t\t\theld = null\n\t\t}\n\t}\n}\nexport interface TimelineControls {\n\tgetCursor(): number\n\tgetLength(): number\n\tundo(): void\n\tredo(): void\n\tclear(): void\n\tgetTransaction(): { undo?: Cleanup; redo?: Cleanup }\n}\nexport function useTimeline<M extends TimelineManageable>(\n\ttoken: TimelineToken<M>,\n): TimelineControls\nexport function useTimeline<K extends Canonical, M extends TimelineManageable>(\n\tfamily: TimelineFamilyToken<K, M>,\n\tkey: NoInfer<K>,\n): TimelineControls\nexport function useTimeline(token: any, key?: Canonical): TimelineControls {\n\tconst store = useStore()\n\tconst selected: TimelineToken<any> =\n\t\ttoken.type === `timeline_family`\n\t\t\t? findTimelineInStore(store, token, key!)\n\t\t\t: token\n\tconst subscribe: Subscribe = (notify) =>\n\t\tsubscribeToTimeline(store, selected, `spa:${serial++}`, notify)\n\tconst read = () => {\n\t\tconst timeline = withdraw(store, selected)\n\t\ttracking?.(subscribe)\n\t\treturn timeline\n\t}\n\treturn {\n\t\tgetCursor: () => read().at,\n\t\tgetLength: () => read().history.length,\n\t\tundo: () => {\n\t\t\ttimeTravel(store, `undo`, selected)\n\t\t},\n\t\tredo: () => {\n\t\t\ttimeTravel(store, `redo`, selected)\n\t\t},\n\t\tclear: () => {\n\t\t\tclearTimelineInStore(store, selected)\n\t\t},\n\t\tgetTransaction: () => {\n\t\t\tconst timeline = read()\n\t\t\tconst controls: ReturnType<TimelineControls[`getTransaction`]> = {}\n\t\t\tfor (const direction of [`undo`, `redo`] as const) {\n\t\t\t\tconst group = getTimelineTransactionAtHead(timeline, direction)\n\t\t\t\tif (group)\n\t\t\t\t\tcontrols[direction] = () => {\n\t\t\t\t\t\ttimeTravelTransactionGroupInStore(store, direction, group)\n\t\t\t\t\t}\n\t\t\t}\n\t\t\treturn controls\n\t\t},\n\t}\n}\n\nexport function plain(value: Children): string {\n\tif (typeof value === `function`) return plain(value())\n\tif (Array.isArray(value)) return value.map(plain).join(``)\n\tif (value == null || typeof value === `boolean`) return ``\n\tif (import.meta.env.DEV && typeof value === `object`)\n\t\tthrow new Error(`spa: text required`)\n\t// oxlint-disable-next-line typescript/no-base-to-string -- Valid text children are primitives here; development rejects malformed object children.\n\treturn String(value)\n}\n\nexport function isPresent(scope: Scope): boolean {\n\tfor (let at: Scope | undefined = scope; at; at = at._parent)\n\t\tif (at._dead || at._exiting) return false\n\treturn true\n}\n"],"mappings":";;AA8FA,IAAW;AAEX,IAAI;AACJ,IAAI,SAAS;AAEb,SAAgB,OAAU,OAAc,KAAiB;CACxD,MAAM,WAAW;CACjB,QAAQ;CACR,IAAI;EACH,OAAO,IAAI;CACZ,UAAU;EACT,QAAQ;CACT;AACD;AACA,SAAgB,QAAW,KAAiB;CAC3C,MAAM,WAAW;CACjB,WAAW,KAAA;CACX,IAAI;EACH,OAAO,IAAI;CACZ,UAAU;EACT,WAAW;CACZ;AACD;AACA,SAAgB,YAAY,QAAuB;CAClD,MAAM,QAAe;EACpB,OAAO,QAAQ;EACf,SAAS;EACT,2BAAW,IAAI,IAAI;EACnB,UAAU,CAAC;EACX,OAAO;CACR;CACA,QAAQ,UAAU,IAAI,KAAK;CAC3B,OAAO;AACR;AACA,SAAgB,KAAK,OAAc,OAAuB;CACzD,IAAI;EACH,QAAQ,KAAK;CACd,SAAS,SAAS;EACjB,MAAM,IAAI,eAAe,CAAC,OAAO,OAAO,CAAC;CAC1C;CACA,MAAM;AACP;AACA,SAAgB,QAAQ,OAAoB;CAC3C,IAAI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W,OAAO,QAAQ,QAAQ;EACnC;EACA,aAAa;GACZ,qBAAqB,OAAO,QAAQ;EACrC;EACA,sBAAsB;GACrB,MAAM,WAAW,KAAK;GACtB,MAAM,WAA2D,CAAC;GAClE,KAAK,MAAM,aAAa,CAAC,QAAQ,MAAM,GAAY;IAClD,MAAM,QAAQ,6BAA6B,UAAU,SAAS;IAC9D,IAAI,OACH,SAAS,mBAAmB;KAC3B,kCAAkC,OAAO,WAAW,KAAK;IAC1D;GACF;GACA,OAAO;EACR;CACD;AACD;AAEA,SAAgB,MAAM,OAAyB;CAC9C,IAAI,OAAO,UAAU,YAAY,OAAO,MAAM,MAAM,CAAC;CACrD,IAAI,MAAM,QAAQ,KAAK,GAAG,OAAO,MAAM,IAAI,KAAK,CAAC,CAAC,KAAK,EAAE;CACzD,IAAI,SAAS,QAAQ,OAAO,UAAU,WAAW,OAAO;CAIxD,OAAO,OAAO,KAAK;AACpB;AAEA,SAAgB,UAAU,OAAuB;CAChD,KAAK,IAAI,KAAwB,OAAO,IAAI,KAAK,GAAG,SACnD,IAAI,GAAG,SAAS,GAAG,UAAU,OAAO;CACrC,OAAO;AACR"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { browserApplication } from "./astro-application.js";
|
|
2
2
|
import { n as failPreparation, r as storeContext } from "./astro-context-OdlexHR4.js";
|
|
3
3
|
import { n as islandStore, t as island } from "./astro-shared-83hxw7-M.js";
|
|
4
|
-
import { c as onCleanup,
|
|
5
|
-
import { n as render, t as hydrate } from "./dom-
|
|
4
|
+
import { c as onCleanup, h as useGetter } from "./core-BHA7I1nf.js";
|
|
5
|
+
import { n as render, t as hydrate } from "./dom-DQ0M3rLL.js";
|
|
6
6
|
import { IMPLICIT, createRegularAtomFamily, disposeFromStore, findInStore, getFromStore, setIntoStore } from "atom.io/internal";
|
|
7
7
|
// src/astro-client.ts
|
|
8
8
|
const roots = /* @__PURE__ */ new WeakMap();
|