@atom.io/spa 0.0.8 → 0.0.10
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 +194 -30
- package/README.mdx +78 -20
- package/dist/BrandMarkScene-CBYk-RJ2.js +140 -0
- package/dist/BrandMarkScene-CBYk-RJ2.js.map +1 -0
- package/dist/astro-application.d.ts +1 -1
- package/dist/astro-client.d.ts +1 -1
- package/dist/astro-client.d.ts.map +1 -1
- package/dist/astro-client.js +5 -4
- package/dist/astro-client.js.map +1 -1
- package/dist/astro-resumability-client.d.ts +1 -1
- package/dist/astro-server.js +4 -4
- package/dist/astro-server.js.map +1 -1
- package/dist/{astro-shared-83hxw7-M.js → astro-shared-DBwINQav.js} +2 -2
- package/dist/{astro-shared-83hxw7-M.js.map → astro-shared-DBwINQav.js.map} +1 -1
- package/dist/{astro-shared-DZp1x8RQ.d.ts → astro-shared-KxK9OUSj.d.ts} +2 -2
- package/dist/{astro-shared-DZp1x8RQ.d.ts.map → astro-shared-KxK9OUSj.d.ts.map} +1 -1
- package/dist/astro.d.ts +1 -1
- package/dist/astro.js +1 -1
- package/dist/brand-css.d.ts +2 -0
- package/dist/brand-model.d.ts +32 -0
- package/dist/brand-model.d.ts.map +1 -0
- package/dist/brand-model.js +120 -0
- package/dist/brand-model.js.map +1 -0
- package/dist/brand.css +37 -0
- package/dist/brand.d.ts +13 -0
- package/dist/brand.d.ts.map +1 -0
- package/dist/brand.js +94 -0
- package/dist/brand.js.map +1 -0
- package/dist/{capabilities-DNcnGRv_.d.ts → capabilities-ChgSs6bp.d.ts} +34 -6
- package/dist/capabilities-ChgSs6bp.d.ts.map +1 -0
- package/dist/client.min.js +1 -1
- package/dist/core-DD2giR6E.js +451 -0
- package/dist/core-DD2giR6E.js.map +1 -0
- package/dist/development/BrandMarkScene-BDdC7K5M.js +140 -0
- package/dist/development/BrandMarkScene-BDdC7K5M.js.map +1 -0
- package/dist/development/astro-client.js +5 -4
- package/dist/development/astro-client.js.map +1 -1
- package/dist/development/astro-server.js +4 -4
- package/dist/development/astro-server.js.map +1 -1
- package/dist/development/{astro-shared-83hxw7-M.js → astro-shared-DBwINQav.js} +2 -2
- package/dist/development/{astro-shared-83hxw7-M.js.map → astro-shared-DBwINQav.js.map} +1 -1
- package/dist/development/astro.js +1 -1
- package/dist/development/brand-model.js +120 -0
- package/dist/development/brand-model.js.map +1 -0
- package/dist/development/brand.css +37 -0
- package/dist/development/brand.js +94 -0
- package/dist/development/brand.js.map +1 -0
- package/dist/development/core-DrUd8x25.js +465 -0
- package/dist/development/core-DrUd8x25.js.map +1 -0
- package/dist/development/{dom-DQ0M3rLL.js → dom-CEVtlaav.js} +152 -36
- package/dist/development/dom-CEVtlaav.js.map +1 -0
- package/dist/development/floating.js +2 -6
- package/dist/development/floating.js.map +1 -1
- package/dist/development/hot.js +164 -0
- package/dist/development/hot.js.map +1 -0
- package/dist/development/identity-B8wTFkyW.js +121 -0
- package/dist/development/identity-B8wTFkyW.js.map +1 -0
- package/dist/development/index.js +5 -5
- package/dist/development/jsx-runtime-BGDPK50B.js +49 -0
- package/dist/development/jsx-runtime-BGDPK50B.js.map +1 -0
- package/dist/development/jsx-runtime.js +1 -25
- package/dist/development/konva.js +12 -5
- package/dist/development/konva.js.map +1 -1
- package/dist/development/motion.js +41 -39
- package/dist/development/motion.js.map +1 -1
- package/dist/development/renderer.js +41 -40
- package/dist/development/renderer.js.map +1 -1
- package/dist/development/{server-renderer-DCLoMdOX.js → server-renderer-zAqEL1g1.js} +8 -18
- package/dist/development/server-renderer-zAqEL1g1.js.map +1 -0
- package/dist/development/server.js +1 -1
- package/dist/{src-Bme1kz2b.js → development/src-CB7ruwRs.js} +3 -3
- package/dist/development/src-CB7ruwRs.js.map +1 -0
- package/dist/development/three-CsZ6Od1C.js +527 -0
- package/dist/development/three-CsZ6Od1C.js.map +1 -0
- package/dist/development/three.js +1 -508
- package/dist/development/vite-WUiz1ju6.js +545 -0
- package/dist/development/vite-WUiz1ju6.js.map +1 -0
- package/dist/development/vite.js +1 -1
- package/dist/{dom-D8g3roX9.js → dom-DUpa3Sj2.js} +141 -33
- package/dist/dom-DUpa3Sj2.js.map +1 -0
- package/dist/floating.d.ts +1 -1
- package/dist/floating.d.ts.map +1 -1
- package/dist/floating.js +2 -6
- package/dist/floating.js.map +1 -1
- package/dist/hot.d.ts +15 -0
- package/dist/hot.d.ts.map +1 -0
- package/dist/hot.js +19 -0
- package/dist/hot.js.map +1 -0
- package/dist/identity-ByJswZtF.js +121 -0
- package/dist/identity-ByJswZtF.js.map +1 -0
- package/dist/{index-BFnXIfOj.d.ts → index-DdA39aMv.d.ts} +4 -4
- package/dist/{index-BFnXIfOj.d.ts.map → index-DdA39aMv.d.ts.map} +1 -1
- package/dist/index.d.ts +4 -4
- package/dist/index.js +5 -5
- package/dist/jsx-runtime-BGDPK50B.js +49 -0
- package/dist/jsx-runtime-BGDPK50B.js.map +1 -0
- package/dist/{jsx-runtime-DQnpyT_g.d.ts → jsx-runtime-CCvcEosg.d.ts} +14 -9
- package/dist/jsx-runtime-CCvcEosg.d.ts.map +1 -0
- package/dist/jsx-runtime.d.ts +1 -1
- package/dist/jsx-runtime.js +1 -25
- package/dist/konva.d.ts +46 -9
- package/dist/konva.d.ts.map +1 -1
- package/dist/konva.js +12 -5
- package/dist/konva.js.map +1 -1
- package/dist/motion.d.ts +3 -1
- package/dist/motion.d.ts.map +1 -1
- package/dist/motion.js +41 -39
- package/dist/motion.js.map +1 -1
- package/dist/renderer.d.ts +1 -1
- package/dist/renderer.d.ts.map +1 -1
- package/dist/renderer.js +39 -40
- package/dist/renderer.js.map +1 -1
- package/dist/{server-renderer-D0rsFL_-.js → server-renderer-D7CdyOMo.js} +8 -18
- package/dist/server-renderer-D7CdyOMo.js.map +1 -0
- package/dist/server.d.ts +1 -1
- package/dist/server.js +1 -1
- package/dist/size.json +12 -12
- package/dist/{development/src-DoQgCX-O.js → src-B2W_TA_X.js} +3 -3
- package/dist/src-B2W_TA_X.js.map +1 -0
- package/dist/three-DcYxRXPW.js +527 -0
- package/dist/three-DcYxRXPW.js.map +1 -0
- package/dist/three.d.ts +24 -3
- package/dist/three.d.ts.map +1 -1
- package/dist/three.js +1 -508
- package/dist/vite-WUiz1ju6.js +545 -0
- package/dist/vite-WUiz1ju6.js.map +1 -0
- package/dist/vite.d.ts.map +1 -1
- package/dist/vite.js +1 -1
- package/package.json +45 -18
- package/src/BrandMark.module.css +25 -0
- package/src/BrandMark.tsx +106 -0
- package/src/BrandMarkScene.module.css +10 -0
- package/src/BrandMarkScene.tsx +116 -0
- package/src/astro-client.ts +3 -2
- package/src/astro-server.ts +2 -2
- package/src/brand-css.d.ts +2 -0
- package/src/brand-model.ts +177 -0
- package/src/brand.ts +3 -0
- package/src/capabilities.ts +48 -21
- package/src/compiler-hmr.ts +297 -0
- package/src/compiler.ts +127 -25
- package/src/core.ts +282 -33
- package/src/dom-forms.ts +127 -0
- package/src/dom.ts +124 -53
- package/src/floating.ts +2 -6
- package/src/hot.ts +191 -0
- package/src/identity.ts +39 -0
- package/src/index.ts +2 -0
- package/src/jsx-runtime.ts +6 -26
- package/src/jsx-types.d.ts +8 -3
- package/src/konva.ts +66 -10
- package/src/lasertag.d.ts +1 -0
- package/src/motion-layout.ts +55 -26
- package/src/motion.ts +3 -0
- package/src/presence.ts +11 -23
- package/src/props.ts +55 -0
- package/src/renderer.ts +91 -71
- package/src/server-renderer.ts +18 -13
- package/src/three.ts +92 -46
- package/src/use-loadable.ts +2 -2
- package/src/vite.ts +44 -4
- package/dist/capabilities-DNcnGRv_.d.ts.map +0 -1
- package/dist/capabilities-nOIitQ-_.js +0 -65
- package/dist/capabilities-nOIitQ-_.js.map +0 -1
- package/dist/core-B4rJ0xdc.js +0 -268
- package/dist/core-B4rJ0xdc.js.map +0 -1
- package/dist/development/capabilities-nOIitQ-_.js +0 -65
- package/dist/development/capabilities-nOIitQ-_.js.map +0 -1
- package/dist/development/core-BHA7I1nf.js +0 -271
- package/dist/development/core-BHA7I1nf.js.map +0 -1
- package/dist/development/dom-DQ0M3rLL.js.map +0 -1
- package/dist/development/jsx-runtime.js.map +0 -1
- package/dist/development/server-renderer-DCLoMdOX.js.map +0 -1
- package/dist/development/src-DoQgCX-O.js.map +0 -1
- package/dist/development/three.js.map +0 -1
- package/dist/development/vite-Bmyb6P5w.js +0 -265
- package/dist/development/vite-Bmyb6P5w.js.map +0 -1
- package/dist/dom-D8g3roX9.js.map +0 -1
- package/dist/jsx-runtime-DQnpyT_g.d.ts.map +0 -1
- package/dist/jsx-runtime.js.map +0 -1
- package/dist/server-renderer-D0rsFL_-.js.map +0 -1
- package/dist/src-Bme1kz2b.js.map +0 -1
- package/dist/three.js.map +0 -1
- package/dist/vite-Bmyb6P5w.js +0 -265
- package/dist/vite-Bmyb6P5w.js.map +0 -1
package/README.mdx
CHANGED
|
@@ -10,7 +10,13 @@ import ConfigurableCanvas from "./exhibits/configurable-canvas.tsx" with {
|
|
|
10
10
|
import { Tonnage } from "tonnage";
|
|
11
11
|
import config from "./tonnage.config.ts";
|
|
12
12
|
import StoreExample from "./exhibits/store.tsx" with { type: "code" };
|
|
13
|
+
import RootBoundaryExample from "./exhibits/root-boundary.tsx" with {
|
|
14
|
+
type: "code",
|
|
15
|
+
};
|
|
16
|
+
import CommitExample from "./exhibits/hooks/on-commit.tsx" with { type: "code" };
|
|
13
17
|
import Families from "./exhibits/families.tsx" with { type: "code" };
|
|
18
|
+
import HotState from "./exhibits/hmr-state.ts" with { type: "code" };
|
|
19
|
+
import HotView from "./exhibits/hmr-view.tsx" with { type: "code" };
|
|
14
20
|
import TimelineExample from "./exhibits/timeline.tsx" with { type: "code" };
|
|
15
21
|
import LoadableExample from "./exhibits/loadable.tsx" with { type: "code" };
|
|
16
22
|
import Point from "./exhibits/point.tsx" with { type: "code" };
|
|
@@ -27,6 +33,7 @@ import CreateAstroTemplate from "./exhibits/create-astro-template.sh" with {
|
|
|
27
33
|
};
|
|
28
34
|
import Verify from "./exhibits/verify.sh" with { type: "code" };
|
|
29
35
|
import KonvaExample from "./exhibits/konva.tsx" with { type: "code" };
|
|
36
|
+
import BrandExample from "./exhibits/brand.tsx" with { type: "code" };
|
|
30
37
|
import ThreeExample from "./exhibits/three.tsx" with { type: "code" };
|
|
31
38
|
import MotionPanel from "./exhibits/motion.tsx" with { type: "code" };
|
|
32
39
|
import MotionMain from "./exhibits/motion-main.tsx" with { type: "code" };
|
|
@@ -48,7 +55,7 @@ import FloatingExample from "./exhibits/floating.tsx" with { type: "code" };
|
|
|
48
55
|
|
|
49
56
|
An experimental JSX framework whose state engine is atom.io. Components run once per mounted instance. Calls to accessors inside compiled JSX subscribe the affected DOM computations; atom.io updates those computations without rerunning component setup.
|
|
50
57
|
|
|
51
|
-
The npm package is named @atom.io/spa. Its browser runtime, Vite compiler, server renderer, and Astro integration are implemented here.
|
|
58
|
+
The npm package is named @atom.io/spa. Its browser runtime, Vite compiler, server renderer, and Astro integration are implemented here. State and general reactions belong to atom.io.
|
|
52
59
|
|
|
53
60
|
## Start with the Astro template
|
|
54
61
|
|
|
@@ -94,7 +101,19 @@ Add a host element in index.html, then mount the same counter from main.tsx:
|
|
|
94
101
|
|
|
95
102
|
<Main />
|
|
96
103
|
|
|
97
|
-
The development plugin keeps SPA and atom.io outside dependency prebundling so renderer entrypoints, component hooks, and stores share one runtime, including Astro adapter environments.
|
|
104
|
+
The development plugin keeps SPA and atom.io outside dependency prebundling so renderer entrypoints, component hooks, and stores share one runtime, including Astro adapter environments. Component-only JSX modules refresh affected roots against their existing atom.io stores; production builds omit hot registration. Components and render computations are synchronous. Modern browsers with ES2022 and DOM Range support are the target.
|
|
105
|
+
|
|
106
|
+
Hot updates rerun affected roots, including scene roots and independent Astro islands, with the same store and props source. Old scopes release subscriptions, listeners, refs, and onCleanup callbacks before replacement. Atoms, persistent family members, and timeline history remain; DOM-local values and component-owned family members disposed by cleanup reset. A failed hot setup displays an error while keeping its store available for the next edit.
|
|
107
|
+
|
|
108
|
+
Keep state definitions and Astro store factories in separate modules from component-only views. State declarations, mixed runtime exports, re-exports, changed export boundaries, and top-level side effects use full reloads. Type-only exports are allowed. The first implementation refreshes complete roots rather than replacing individual component instances.
|
|
109
|
+
|
|
110
|
+
Define persistent tokens in their own state module:
|
|
111
|
+
|
|
112
|
+
<HotState />
|
|
113
|
+
|
|
114
|
+
Import the token from a component-only view. Editing this view's JSX or handler preserves the counter value:
|
|
115
|
+
|
|
116
|
+
<HotView />
|
|
98
117
|
|
|
99
118
|
## Hooks
|
|
100
119
|
|
|
@@ -102,43 +121,74 @@ The development plugin keeps SPA and atom.io outside dependency prebundling so r
|
|
|
102
121
|
| ----------------------------- | ------------------------------------------------------------------------------------------------------------------------ |
|
|
103
122
|
| useLoadable(token, fallback?) | Return a tracked accessor for loading, last-observed values, and handled errors. |
|
|
104
123
|
| 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
|
|
124
|
+
| useDisposal() | Return atom.io state disposal bound to the current store. |
|
|
106
125
|
| useSetter(token) | Return a stable atom.io writer. |
|
|
107
126
|
| useTimeline(token) | Return a stable object with getCursor/getLength readers, undo/redo/clear commands, and transaction-group controls. |
|
|
108
127
|
| useTransaction(token) | Bind an atom.io transaction, preserving its arguments and result. |
|
|
109
128
|
| useRef(token) | Return an attachment callback for a nullable element atom. Clear it only while this attachment still owns the reference. |
|
|
110
|
-
| useId() | Allocate an instance-stable ID using the root's
|
|
129
|
+
| useId() | Allocate an instance-stable ID using the current prefix and the root's shared sequence. |
|
|
111
130
|
| onCleanup(callback) | Register synchronous teardown with the current owner. |
|
|
112
131
|
| onMount(callback) | Run once after attachment and ref publication; omitted during server rendering. |
|
|
113
|
-
|
|
|
132
|
+
| onCommit(read, apply) | Track a value and apply changes after renderer writes, within the same flush. |
|
|
133
|
+
| useStore() | Return the current atom.io store without creating a store or subscribing. |
|
|
114
134
|
|
|
115
|
-
Call setup helpers synchronously during component setup or owned mount callbacks. Capture their results for event handlers. Tokens are fixed for an instance
|
|
135
|
+
Call setup helpers synchronously during component setup or owned mount callbacks. Capture their results for event handlers. Tokens are fixed for an instance. Change the component's key when it needs to bind a different token. Read data props through the props object in JSX or a tracked binding to get updates. Destructuring data props during setup takes a snapshot.
|
|
136
|
+
|
|
137
|
+
### onCommit
|
|
138
|
+
|
|
139
|
+
Use onCommit to measure a ref after the root finishes its DOM writes.
|
|
140
|
+
|
|
141
|
+
<CommitExample />
|
|
142
|
+
|
|
143
|
+
Call onCommit during setup. Its read function tracks state and compares the result with the last applied value using Object.is. The untracked apply callback receives the value and the previous applied value, which is undefined on mount. It runs after ref publication, mount callbacks, controlled form restoration, and capability commits. A flush inside a controlled form handler defers apply until restoration can finish. Children run before parents, with sibling callbacks in setup order.
|
|
144
|
+
|
|
145
|
+
A cleanup returned by apply runs before the next apply and when the owner is disposed. State writes from apply drain in another round of the same flush. Development detects feedback loops and reports the callback's registration stack. Scene callbacks run after host updates. Server rendering skips both callbacks, and scopes retained for exit skip apply while absent.
|
|
116
146
|
|
|
117
147
|
useTimeline returns a TimelineControls object whose methods can be destructured during setup. getCursor and getLength read the current cursor position and recorded checkpoint count; calls inside JSX subscribe the computation, while calls during setup or in event handlers are untracked. undo, redo, and clear are stable commands. history.getTransaction() is a tracked reader that returns an object with optional undo and redo callbacks for the adjacent transaction groups. At a cursor between transactions, both callbacks may be present and target different groups. A missing callback means no transaction group is available in that direction; the reader returns an empty object when neither is available. Calling a returned callback travels its captured group across participating timelines where it remains at the relevant history head, leaving diverged timelines unchanged. Use history.getTransaction().undo?.() or history.getTransaction().redo?.() to retrieve and invoke the current action together.
|
|
118
148
|
|
|
119
149
|
<TimelineExample />
|
|
120
150
|
|
|
121
|
-
Arrays support keyed components and elements. Reordering preserves instances and nodes; removed ranges release subscriptions, events, refs, and cleanup callbacks. Application keys must be unique among siblings. Explicit keys are compared as strings; unkeyed positions occupy a separate namespace. Unkeyed arrays use positions. A key identifies a row in a reactive child collection; it is not an independent reactive binding.
|
|
122
|
-
|
|
123
151
|
HTML and SVG use native DOM properties and attributes, plus className/htmlFor aliases. Events use onClick/onInput-style names, with Capture suffixes and onDoubleClick support. Styles are CSS strings. Mutable atom values still invalidate their consumers; project primitive fields for precise DOM writes. Refs attach once per element instance.
|
|
124
152
|
|
|
125
153
|
HTML and SVG tags have element-specific attribute, event, and ref types. Event handlers receive native events with currentTarget typed as the attached element; target remains EventTarget because events can bubble from descendants. Ref callbacks receive the element on attachment and null on cleanup. Hyphenated custom tags use generic HTML attributes and HTMLElement refs and event targets. SVG presentation attributes use their literal markup spellings. Shared HTML/SVG tag names use HTML types because JSX cannot infer a namespace from parent elements.
|
|
126
154
|
|
|
155
|
+
Non-null value and checked props control form state: rejected edits are restored after native handlers run, and select values are reapplied after option updates. Use defaultValue/defaultChecked for uncontrolled fields. onChange follows native input events for text, number, range inputs and textareas; selects, checkboxes, radios, and file inputs use native change events. Handlers still receive native events. onFocus/onBlur bubble through focusin/focusout, including Capture variants; explicit onFocusIn/onFocusOut names remain available. autoFocus focuses newly mounted elements. Null or undefined reflected attributes are removed.
|
|
156
|
+
|
|
157
|
+
## Component identity
|
|
158
|
+
|
|
159
|
+
Keys accept the same Canonical values as atom.io families, including nested tuples, booleans, and null. Sibling keys must be unique by canonical serialization. A fresh tuple with the same contents preserves the instance, and a number and its string representation identify separate instances. Only undefined uses positional identity. Reordering preserves keyed instances and nodes. Changing a key replaces the instance in both DOM and scene trees, including when the element stands alone.
|
|
160
|
+
|
|
161
|
+
Freezing both a JSX element object and its props opts into reuse in DOM collections without refreshing unchanged descendant props. Its tracked getters remain reactive. Create a new JSX element object when replacing frozen props; the key still preserves the mounted instance. Mutable descriptors continue to refresh when their collection updates.
|
|
162
|
+
|
|
163
|
+
A component can declare a required, narrowed key in its props. The instance receives the original key by reference and can read props.key during setup, rendering, mount, and cleanup. Spreading the props forwards the key to an inner component or element. A spread follows normal JSX precedence, so forwarding the same key to multiple siblings reports a duplicate key.
|
|
164
|
+
|
|
165
|
+
Direct DOM component and root output opt into key tracking when they first mount. Include the key property initially when a direct spread needs later identity changes. An explicit key attribute or a spread containing key with an initial undefined value enables that tracking. Keyless spreads keep their data props live as the instance updates.
|
|
166
|
+
|
|
127
167
|
## Store access
|
|
128
168
|
|
|
129
|
-
useStore returns the
|
|
169
|
+
useStore returns the nearest Root boundary's atom.io store. When no boundary supplies one, it returns the store supplied to the renderer, the Astro island store, or the implicit atom.io store.
|
|
130
170
|
|
|
131
171
|
<StoreExample />
|
|
132
172
|
|
|
133
173
|
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.
|
|
134
174
|
|
|
175
|
+
### Subtree root options
|
|
176
|
+
|
|
177
|
+
Render a Root boundary around each editor to give it a separate store with the document token installed in both stores.
|
|
178
|
+
|
|
179
|
+
<RootBoundaryExample />
|
|
180
|
+
|
|
181
|
+
Root shares its parent's scheduler and uses normal child markers and adds no DOM element. Components passed as children bind their hooks to the store where they mount. The boundary captures options at setup, so give it a new key to replace its store. Removing the boundary releases owned subscriptions and refs. The borrowed store remains available.
|
|
182
|
+
|
|
183
|
+
Omitted options inherit from the parent. An idPrefix override uses the root's shared ID sequence. A capabilities list replaces the inherited list within the subtree and shares the root's update and presence coordination. An onError override receives asynchronous errors from the subtree under the usual root failure policy. Scene mounts inherit these options. For SSR and hydration, supply equivalent boundary options and store state on both sides.
|
|
184
|
+
|
|
135
185
|
## Families
|
|
136
186
|
|
|
137
187
|
useGetter, useSetter, useRef, and useTimeline accept a family token followed by its key. useLoadable accepts a family, key, and optional fallback. Keys retain their declared types, including tuples, numbers, booleans, and null. Members resolve in the component's store, so isolated roots can use the same family tokens independently.
|
|
138
188
|
|
|
139
189
|
<Families />
|
|
140
190
|
|
|
141
|
-
|
|
191
|
+
Use props.key as the family key to keep the binding and the component's identity in sync. When the key changes, the new instance binds to the new member during setup. A tuple can include a family key alongside a discriminator when the same member appears more than once among siblings. Ref ownership and subscription cleanup follow the member just as they do for individual tokens. useTransaction takes an individual transaction token.
|
|
142
192
|
|
|
143
193
|
### Ambient UI state and ownership
|
|
144
194
|
|
|
@@ -176,7 +226,7 @@ The production build omits development-only diagnostics and invalid-input checks
|
|
|
176
226
|
|
|
177
227
|
## Astro state and data
|
|
178
228
|
|
|
179
|
-
The integration compiles .tsx and .jsx files by default. Use the include option to limit compilation to SPA component directories when another JSX renderer is present. Top-level functions containing JSX are branded by the compiler for renderer detection.
|
|
229
|
+
The integration compiles .tsx and .jsx files by default. Use the include option to limit compilation to SPA component directories when another JSX renderer is present. Top-level functions containing JSX are branded by the compiler for renderer detection. Lazy JSX attributes preserve this from their enclosing function, including through nested arrows and receiver tags. Nested normal functions and methods retain their own receiver. Direct await and yield expressions in lazy attributes are compile errors naming the attribute; nested async and generator functions remain supported.
|
|
180
230
|
|
|
181
231
|
Default islands share the normal implicit atom.io store in the browser. Module-scoped tokens, SPA hooks, and ordinary getState/setState calls all address the same graph. SSR shares a separate store within each request; concurrent requests never share values. Definitions imported after an earlier island started are installed into that request's store before the next island prepares. Server reads and writes must use the selected store (through SPA hooks or store-aware atom.io operations); free getState/setState calls still target the process-global implicit store.
|
|
182
232
|
|
|
@@ -208,7 +258,7 @@ The checked Astro fixture demonstrates default/named slots and custom independen
|
|
|
208
258
|
|
|
209
259
|
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.
|
|
210
260
|
|
|
211
|
-
The hard budget is under
|
|
261
|
+
The hard budget is under 6,250 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 6.2 kB with gzip. The exact measurements appear in dist/size.json. Actual application bundles add atom.io and compiler-generated application code.
|
|
212
262
|
|
|
213
263
|
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.
|
|
214
264
|
|
|
@@ -232,7 +282,7 @@ SPA includes Konva, Three.js, and Motion integrations behind separate entrypoint
|
|
|
232
282
|
|
|
233
283
|
### Konva
|
|
234
284
|
|
|
235
|
-
Import Stage, Layer, Group, Rect, Circle, Ellipse, Line, Text, Image, Path, Star, and Transformer from @atom.io/spa/konva. Stage renders a DOM container and creates its native stage after browser mounting. Compiled atom reads update native attributes; keyed children preserve node identity. Native configuration attributes and
|
|
285
|
+
Import Stage, Layer, Group, Rect, Circle, Ellipse, Line, Text, Image, Path, Star, and Transformer from @atom.io/spa/konva. Stage renders a DOM container and creates its native stage after browser mounting. Compiled atom reads update native attributes; keyed children preserve node identity. Native configuration attributes and mouse, pointer, touch, wheel, context-menu, drag, and transform handlers are supported with typed native Konva events and node-specific currentTarget values. Use onDblClick/onDblTap for double clicks/taps. Both onGotPointerCapture and onLostPointerCapture expose PointerEvent values. onTransformEnd may receive an undefined evt when stopTransform() ends a transform programmatically; check evt before reading native event fields. Handler names and configuration fields are checked for misspellings. Refs receive native nodes and null on cleanup. Removal destroys owned nodes and listeners.
|
|
236
286
|
|
|
237
287
|
<KonvaExample />
|
|
238
288
|
|
|
@@ -240,21 +290,29 @@ Konva owns hit testing, dragging, and draw batching. Write drag results back int
|
|
|
240
290
|
|
|
241
291
|
### Three.js
|
|
242
292
|
|
|
243
|
-
Import Canvas, Group, Mesh, PerspectiveCamera, AmbientLight, DirectionalLight, BoxGeometry, SphereGeometry, PlaneGeometry, MeshStandardMaterial, MeshBasicMaterial, and
|
|
293
|
+
Import Canvas, Group, Mesh, PerspectiveCamera, AmbientLight, DirectionalLight, PointLight, BoxGeometry, SphereGeometry, PlaneGeometry, MeshStandardMaterial, MeshBasicMaterial, MeshNormalMaterial, LineSegments, BufferGeometry, and LineBasicMaterial from @atom.io/spa/three. Canvas creates a WebGL renderer after browser mounting. Geometry and material children attach to their Mesh or LineSegments, with one of each supported. Position and rotation accept three-number tuples; scale also accepts a scalar. Point lights expose color, intensity, distance and decay.
|
|
244
294
|
|
|
245
295
|
<ThreeExample />
|
|
246
296
|
|
|
247
|
-
Mesh
|
|
297
|
+
Mesh and LineSegments accept 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 drawable defaults remain renderer-owned. Constructor args are fixed for the mounted instance; use a new reconciliation key to replace them.
|
|
248
298
|
|
|
249
|
-
Constructor args are fixed for an instance.
|
|
299
|
+
Constructor args are fixed for an instance. Change the resource's key to replace it with new constructor args. 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.
|
|
250
300
|
|
|
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.
|
|
301
|
+
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. An optional onError callback handles renderer creation failures locally so an application can offer a fallback; later setup or frame errors still reach the owning error boundary. Options and the factory are captured at mount; replace the keyed Canvas to reconstruct its context.
|
|
252
302
|
|
|
253
303
|
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
304
|
|
|
255
305
|
<ConfigurableCanvas />
|
|
256
306
|
|
|
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
|
|
307
|
+
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 by default. A renderWhen predicate can skip idle GPU draws while frame callbacks and pointer updates continue; the caller makes it true when drawing is needed, and Canvas checks it before onFrame. Canvas accepts an onFrame callback with scene, camera, renderer, delta seconds, and timestamp seconds. Controls and asset loading remain application-owned.
|
|
308
|
+
|
|
309
|
+
### Shared brand mark
|
|
310
|
+
|
|
311
|
+
Import BrandMark from @atom.io/spa/brand and its stylesheet from @atom.io/spa/brand/css. The compact mark defaults to 22 CSS pixels; size sets its width and height. Use variant="splash" for the viewport backdrop used on atom.io.fyi. Both variants share the same orbital model and honor reduced motion. Three.js loads after browser mounting; server rendering, unavailable WebGL and failed graphics imports retain the static mark. Install the optional three peer to animate it. The base SPA entrypoint does not include branding or its stylesheet.
|
|
312
|
+
|
|
313
|
+
<BrandExample />
|
|
314
|
+
|
|
315
|
+
Contributor tools can import the canonical geometry, camera and lighting helpers from @atom.io/spa/brand/model without importing the component or CSS.
|
|
258
316
|
|
|
259
317
|
### Three.js pointer events
|
|
260
318
|
|
|
@@ -284,7 +342,7 @@ The same attributes animate numeric Konva properties and colors, or Three.js pos
|
|
|
284
342
|
|
|
285
343
|
<MotionThree />
|
|
286
344
|
|
|
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.
|
|
345
|
+
When the motion capability is installed, Canvas draws in Motion's post-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. The optional Motion entrypoint owns the retention machinery. The client budget includes controlled form restoration and native event normalization. The full client budget is 5,500 bytes.
|
|
288
346
|
|
|
289
347
|
### Exit animations and re-entry
|
|
290
348
|
|
|
@@ -316,7 +374,7 @@ Register motionCapability from @atom.io/spa/motion once to enable animated prope
|
|
|
316
374
|
|
|
317
375
|
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
376
|
|
|
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.
|
|
377
|
+
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. Mark a movable window or fixed layout ancestor with motion:layoutRoot so it moves immediately while its descendants animate relative to it. 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
378
|
|
|
321
379
|
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
380
|
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import { DZ2_ORBITAL_LIGHTS, DZ2_ORBITAL_Y_ROTATION_RADIANS_PER_SECOND, createDz2OrbitalCamera, createDz2OrbitalModel, disposeDz2OrbitalModel } from "./brand-model.js";
|
|
2
|
+
import { f as onMount, u as onCleanup } from "./core-DD2giR6E.js";
|
|
3
|
+
import { h as PointLight, i as Canvas, l as Mesh, o as Group, t as AmbientLight } from "./three-DcYxRXPW.js";
|
|
4
|
+
import { jsx } from "@atom.io/spa/jsx-runtime";
|
|
5
|
+
// src/BrandMarkScene.module.css
|
|
6
|
+
var BrandMarkScene_module_default = { "class": "atom-io-spa-BrandMarkScene-module-class" };
|
|
7
|
+
// src/BrandMarkScene.tsx
|
|
8
|
+
const canvas = { Canvas };
|
|
9
|
+
function BrandMarkScene(props) {
|
|
10
|
+
const view = props.view;
|
|
11
|
+
const camera = createDz2OrbitalCamera();
|
|
12
|
+
const model = createDz2OrbitalModel();
|
|
13
|
+
const mark = () => props.variant === `mark`;
|
|
14
|
+
const narrow = () => view.innerWidth < 680;
|
|
15
|
+
let orbital = null;
|
|
16
|
+
let dirty = true;
|
|
17
|
+
const preference = view.matchMedia(`(prefers-reduced-motion: reduce)`);
|
|
18
|
+
const invalidate = () => {
|
|
19
|
+
dirty = true;
|
|
20
|
+
};
|
|
21
|
+
onMount(() => {
|
|
22
|
+
preference.addEventListener(`change`, invalidate);
|
|
23
|
+
view.document.addEventListener(`visibilitychange`, invalidate);
|
|
24
|
+
onCleanup(() => {
|
|
25
|
+
preference.removeEventListener(`change`, invalidate);
|
|
26
|
+
view.document.removeEventListener(`visibilitychange`, invalidate);
|
|
27
|
+
});
|
|
28
|
+
});
|
|
29
|
+
onCleanup(() => {
|
|
30
|
+
disposeDz2OrbitalModel(model);
|
|
31
|
+
});
|
|
32
|
+
return jsx("brand-mark-scene", {
|
|
33
|
+
get "class"() {
|
|
34
|
+
return BrandMarkScene_module_default[`class`];
|
|
35
|
+
},
|
|
36
|
+
children: jsx(canvas.Canvas, {
|
|
37
|
+
get "camera"() {
|
|
38
|
+
return camera;
|
|
39
|
+
},
|
|
40
|
+
get "width"() {
|
|
41
|
+
return props.width;
|
|
42
|
+
},
|
|
43
|
+
get "height"() {
|
|
44
|
+
return props.height;
|
|
45
|
+
},
|
|
46
|
+
get "dpr"() {
|
|
47
|
+
return Math.min(view.devicePixelRatio || 1, mark() ? 2 : 1.35, mark() ? 1e400 : Math.sqrt(16e6 / (props.width * props.height)));
|
|
48
|
+
},
|
|
49
|
+
get "rendererOptions"() {
|
|
50
|
+
return {
|
|
51
|
+
alpha: true,
|
|
52
|
+
antialias: true,
|
|
53
|
+
powerPreference: mark() ? `low-power` : `high-performance`
|
|
54
|
+
};
|
|
55
|
+
},
|
|
56
|
+
get "onError"() {
|
|
57
|
+
return props.onError;
|
|
58
|
+
},
|
|
59
|
+
"onCreated": (({ scene, renderer }) => {
|
|
60
|
+
renderer.render(scene, camera);
|
|
61
|
+
props.onReady();
|
|
62
|
+
}),
|
|
63
|
+
"onResize": (({ width, height }) => {
|
|
64
|
+
camera.aspect = width / height;
|
|
65
|
+
camera.updateProjectionMatrix();
|
|
66
|
+
invalidate();
|
|
67
|
+
}),
|
|
68
|
+
"renderWhen": (() => !view.document.hidden && (dirty || !preference.matches)),
|
|
69
|
+
"onFrame": (({ delta }) => {
|
|
70
|
+
if (view.document.hidden) return;
|
|
71
|
+
if (!preference.matches) orbital.rotation.y += Math.min(delta, .1) * DZ2_ORBITAL_Y_ROTATION_RADIANS_PER_SECOND;
|
|
72
|
+
dirty = false;
|
|
73
|
+
}),
|
|
74
|
+
children: [
|
|
75
|
+
jsx(AmbientLight, {
|
|
76
|
+
get "color"() {
|
|
77
|
+
return DZ2_ORBITAL_LIGHTS.ambient.color;
|
|
78
|
+
},
|
|
79
|
+
get "intensity"() {
|
|
80
|
+
return DZ2_ORBITAL_LIGHTS.ambient.intensity;
|
|
81
|
+
}
|
|
82
|
+
}),
|
|
83
|
+
jsx(PointLight, {
|
|
84
|
+
get "color"() {
|
|
85
|
+
return DZ2_ORBITAL_LIGHTS.core.color;
|
|
86
|
+
},
|
|
87
|
+
get "intensity"() {
|
|
88
|
+
return DZ2_ORBITAL_LIGHTS.core.intensity;
|
|
89
|
+
},
|
|
90
|
+
get "distance"() {
|
|
91
|
+
return DZ2_ORBITAL_LIGHTS.core.distance;
|
|
92
|
+
},
|
|
93
|
+
get "position"() {
|
|
94
|
+
return DZ2_ORBITAL_LIGHTS.core.position;
|
|
95
|
+
}
|
|
96
|
+
}),
|
|
97
|
+
jsx(Group, {
|
|
98
|
+
get "scale"() {
|
|
99
|
+
return mark() ? 1.25 : narrow() ? .52 : .72;
|
|
100
|
+
},
|
|
101
|
+
get "position"() {
|
|
102
|
+
return [
|
|
103
|
+
0,
|
|
104
|
+
!mark() && narrow() ? -.08 : 0,
|
|
105
|
+
0
|
|
106
|
+
];
|
|
107
|
+
},
|
|
108
|
+
"ref": ((node) => {
|
|
109
|
+
orbital = node;
|
|
110
|
+
if (node) node.rotation.copy(model.orbital.rotation);
|
|
111
|
+
}),
|
|
112
|
+
get children() {
|
|
113
|
+
return model.meshes.map((mesh, index) => jsx(Mesh, {
|
|
114
|
+
get "key"() {
|
|
115
|
+
return index;
|
|
116
|
+
},
|
|
117
|
+
get "args"() {
|
|
118
|
+
return [mesh.geometry, mesh.material];
|
|
119
|
+
},
|
|
120
|
+
get "position"() {
|
|
121
|
+
return mesh.position.toArray();
|
|
122
|
+
},
|
|
123
|
+
get "rotation"() {
|
|
124
|
+
return [
|
|
125
|
+
mesh.rotation.x,
|
|
126
|
+
mesh.rotation.y,
|
|
127
|
+
mesh.rotation.z
|
|
128
|
+
];
|
|
129
|
+
}
|
|
130
|
+
}));
|
|
131
|
+
}
|
|
132
|
+
})
|
|
133
|
+
]
|
|
134
|
+
})
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
BrandMarkScene.spa = true;
|
|
138
|
+
export { BrandMarkScene };
|
|
139
|
+
|
|
140
|
+
//# sourceMappingURL=BrandMarkScene-CBYk-RJ2.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BrandMarkScene-CBYk-RJ2.js","names":["_spa","css"],"sources":["../src/BrandMarkScene.tsx"],"sourcesContent":["/** @jsxImportSource @atom.io/spa */\nimport type * as THREE from \"three\"\n\nimport {\n\tcreateDz2OrbitalCamera,\n\tcreateDz2OrbitalModel,\n\tdisposeDz2OrbitalModel,\n\tDZ2_ORBITAL_LIGHTS,\n\tDZ2_ORBITAL_Y_ROTATION_RADIANS_PER_SECOND,\n} from \"./brand-model.ts\"\nimport css from \"./BrandMarkScene.module.css\"\nimport type { SpaElement } from \"./core.ts\"\nimport { onCleanup, onMount } from \"./core.ts\"\nimport { AmbientLight, Canvas, Group, Mesh, PointLight } from \"./three.ts\"\n\nconst canvas = { Canvas }\nexport function BrandMarkScene(props: {\n\tvariant: `mark` | `splash`\n\twidth: number\n\theight: number\n\tview: Window\n\tonReady(): void\n\tonError(error: unknown): void\n}): SpaElement {\n\tconst view = props.view\n\tconst camera = createDz2OrbitalCamera()\n\tconst model = createDz2OrbitalModel()\n\tconst mark = () => props.variant === `mark`\n\tconst narrow = () => view.innerWidth < 680\n\tlet orbital: THREE.Object3D | null = null\n\tlet dirty = true\n\tconst preference = view.matchMedia(`(prefers-reduced-motion: reduce)`)\n\tconst invalidate = () => {\n\t\tdirty = true\n\t}\n\tonMount(() => {\n\t\tpreference.addEventListener(`change`, invalidate)\n\t\tview.document.addEventListener(`visibilitychange`, invalidate)\n\t\tonCleanup(() => {\n\t\t\tpreference.removeEventListener(`change`, invalidate)\n\t\t\tview.document.removeEventListener(`visibilitychange`, invalidate)\n\t\t})\n\t})\n\tonCleanup(() => {\n\t\tdisposeDz2OrbitalModel(model)\n\t})\n\treturn (\n\t\t<brand-mark-scene class={css[`class`]}>\n\t\t\t<canvas.Canvas\n\t\t\t\tcamera={camera}\n\t\t\t\twidth={props.width}\n\t\t\t\theight={props.height}\n\t\t\t\tdpr={Math.min(\n\t\t\t\t\tview.devicePixelRatio || 1,\n\t\t\t\t\tmark() ? 2 : 1.35,\n\t\t\t\t\tmark()\n\t\t\t\t\t\t? Infinity\n\t\t\t\t\t\t: Math.sqrt(16_000_000 / (props.width * props.height)),\n\t\t\t\t)}\n\t\t\t\trendererOptions={{\n\t\t\t\t\talpha: true,\n\t\t\t\t\tantialias: true,\n\t\t\t\t\tpowerPreference: mark() ? `low-power` : `high-performance`,\n\t\t\t\t}}\n\t\t\t\tonError={props.onError}\n\t\t\t\tonCreated={({ scene, renderer }) => {\n\t\t\t\t\trenderer.render(scene, camera)\n\t\t\t\t\tprops.onReady()\n\t\t\t\t}}\n\t\t\t\tonResize={({ width, height }) => {\n\t\t\t\t\tcamera.aspect = width / height\n\t\t\t\t\tcamera.updateProjectionMatrix()\n\t\t\t\t\tinvalidate()\n\t\t\t\t}}\n\t\t\t\trenderWhen={() =>\n\t\t\t\t\t!view.document.hidden && (dirty || !preference.matches)\n\t\t\t\t}\n\t\t\t\tonFrame={({ delta }) => {\n\t\t\t\t\tif (view.document.hidden) return\n\t\t\t\t\tif (!preference.matches)\n\t\t\t\t\t\torbital!.rotation.y +=\n\t\t\t\t\t\t\tMath.min(delta, 0.1) * DZ2_ORBITAL_Y_ROTATION_RADIANS_PER_SECOND\n\t\t\t\t\tdirty = false\n\t\t\t\t}}\n\t\t\t>\n\t\t\t\t<AmbientLight\n\t\t\t\t\tcolor={DZ2_ORBITAL_LIGHTS.ambient.color}\n\t\t\t\t\tintensity={DZ2_ORBITAL_LIGHTS.ambient.intensity}\n\t\t\t\t/>\n\t\t\t\t<PointLight\n\t\t\t\t\tcolor={DZ2_ORBITAL_LIGHTS.core.color}\n\t\t\t\t\tintensity={DZ2_ORBITAL_LIGHTS.core.intensity}\n\t\t\t\t\tdistance={DZ2_ORBITAL_LIGHTS.core.distance}\n\t\t\t\t\tposition={DZ2_ORBITAL_LIGHTS.core.position}\n\t\t\t\t/>\n\t\t\t\t<Group\n\t\t\t\t\tscale={mark() ? 1.25 : narrow() ? 0.52 : 0.72}\n\t\t\t\t\tposition={[0, !mark() && narrow() ? -0.08 : 0, 0]}\n\t\t\t\t\tref={(node) => {\n\t\t\t\t\t\torbital = node\n\t\t\t\t\t\tif (node) node.rotation.copy(model.orbital.rotation)\n\t\t\t\t\t}}\n\t\t\t\t>\n\t\t\t\t\t{model.meshes.map((mesh, index) => (\n\t\t\t\t\t\t<Mesh\n\t\t\t\t\t\t\tkey={index}\n\t\t\t\t\t\t\targs={[mesh.geometry, mesh.material]}\n\t\t\t\t\t\t\tposition={mesh.position.toArray()}\n\t\t\t\t\t\t\trotation={[mesh.rotation.x, mesh.rotation.y, mesh.rotation.z]}\n\t\t\t\t\t\t/>\n\t\t\t\t\t))}\n\t\t\t\t</Group>\n\t\t\t</canvas.Canvas>\n\t\t</brand-mark-scene>\n\t)\n}\n"],"mappings":"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"}
|
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-KxK9OUSj.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: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"astro-client.d.ts","names":[],"sources":["../src/astro-client.ts"],"mappings":";
|
|
1
|
+
{"version":3,"file":"astro-client.d.ts","names":[],"sources":["../src/astro-client.ts"],"mappings":";KAmBK,QAAQ;KACR,QAAQ;KACR,YACJ,WAAW,QACX,OAAO,OACP,OAAO,OACP;EAAY;MACR;qBAcQ,iBAAc,UACf,2BAAqB,SACtB,gBAAc;cAAd,WAAA,SAAA,gBAAc"}
|
package/dist/astro-client.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { browserApplication } from "./astro-application.js";
|
|
2
2
|
import { n as failPreparation, r as storeContext } from "./astro-context-OdlexHR4.js";
|
|
3
|
-
import { n as islandStore, t as island } from "./astro-shared-
|
|
4
|
-
import {
|
|
5
|
-
import { n as render, t as hydrate } from "./dom-
|
|
3
|
+
import { n as islandStore, t as island } from "./astro-shared-DBwINQav.js";
|
|
4
|
+
import { b as useGetter } from "./core-DD2giR6E.js";
|
|
5
|
+
import { n as render, t as hydrate } from "./dom-DUpa3Sj2.js";
|
|
6
|
+
import { onRootDispose } from "./hot.js";
|
|
6
7
|
import { IMPLICIT, createRegularAtomFamily, disposeFromStore, findInStore, getFromStore, setIntoStore } from "atom.io/internal";
|
|
7
8
|
// src/astro-client.ts
|
|
8
9
|
const roots = /* @__PURE__ */ new WeakMap();
|
|
@@ -60,7 +61,7 @@ const createHydrator = (prepare) => (element) => async (component, props, slots,
|
|
|
60
61
|
disposeFromStore(store, state);
|
|
61
62
|
});
|
|
62
63
|
const mount = () => {
|
|
63
|
-
|
|
64
|
+
onRootDispose(dispose);
|
|
64
65
|
const getState = useGetter(state);
|
|
65
66
|
return () => island(component, getState().props, getState().slots);
|
|
66
67
|
};
|
package/dist/astro-client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"astro-client.js","names":[],"sources":["../src/astro-client.ts"],"sourcesContent":["import type { ReadableToken, RegularAtomFamilyToken } from \"atom.io\"\nimport type { RootStore } from \"atom.io/internal\"\nimport {\n\tcreateRegularAtomFamily,\n\tdisposeFromStore,\n\tfindInStore,\n\tgetFromStore,\n\tIMPLICIT,\n\tsetIntoStore,\n} from \"atom.io/internal\"\n\nimport { browserApplication } from \"./astro-application.ts\"\nimport { failPreparation, storeContext } from \"./astro-context.ts\"\nimport type { AstroStorePreparation, Island } from \"./astro-shared.ts\"\nimport { island, islandStore } from \"./astro-shared.ts\"\nimport {
|
|
1
|
+
{"version":3,"file":"astro-client.js","names":[],"sources":["../src/astro-client.ts"],"sourcesContent":["import type { ReadableToken, RegularAtomFamilyToken } from \"atom.io\"\nimport type { RootStore } from \"atom.io/internal\"\nimport {\n\tcreateRegularAtomFamily,\n\tdisposeFromStore,\n\tfindInStore,\n\tgetFromStore,\n\tIMPLICIT,\n\tsetIntoStore,\n} from \"atom.io/internal\"\n\nimport { browserApplication } from \"./astro-application.ts\"\nimport { failPreparation, storeContext } from \"./astro-context.ts\"\nimport type { AstroStorePreparation, Island } from \"./astro-shared.ts\"\nimport { island, islandStore } from \"./astro-shared.ts\"\nimport { useGetter } from \"./core.ts\"\nimport { hydrate, render } from \"./dom.ts\"\nimport { onRootDispose } from \"./hot.ts\"\n\ntype Props = Record<string, any>\ntype Slots = Record<string, string>\ntype Hydrator = (\n\tcomponent: Island,\n\tprops: Props,\n\tslots: Slots,\n\tmetadata: { client: string },\n) => Promise<void>\nconst roots = new WeakMap<\n\tElement,\n\t{\n\t\tcomponent: Island\n\t\tready: Promise<void>\n\t\tupdate(props: Props, slots: Slots): void\n\t\tdispose(): void\n\t}\n>()\ntype State = { props: Props; slots: Slots }\nconst states = new WeakMap<RootStore, RegularAtomFamilyToken<State, number>>()\nlet serial = 0\n\nexport const createHydrator =\n\t(prepare?: AstroStorePreparation) =>\n\t(element: HTMLElement): Hydrator =>\n\tasync (component, props, slots, { client }) => {\n\t\tconst previous = roots.get(element)\n\t\tif (previous?.component === component) {\n\t\t\tprevious.update(props, slots)\n\t\t\treturn previous.ready\n\t\t}\n\t\tprevious?.dispose()\n\t\tconst shared = !component.createStore && !component.isolate\n\t\tconst application = shared\n\t\t\t? browserApplication(element.ownerDocument)\n\t\t\t: undefined\n\t\tif (application && client === `only`) application.canResume = false\n\t\tconst lifetime = storeContext(element, application)\n\t\tconst initial = { props, slots }\n\t\tlet current = initial\n\t\tlet update: ((value: State) => void) | undefined\n\t\tlet disposed = false\n\t\tconst dispose = () => {\n\t\t\tif (disposed) return\n\t\t\tdisposed = true\n\t\t\telement.removeEventListener(`astro:unmount`, dispose)\n\t\t\troots.delete(element)\n\t\t\tlifetime.dispose()\n\t\t}\n\t\t// Publish the pending owner before invoking user code. Repeated hydration\n\t\t// calls update its props and share its preparation rather than racing stores.\n\t\tconst ready = Promise.resolve().then(async () => {\n\t\t\tif (lifetime.context.signal.aborted) return\n\t\t\tlet mounting = false\n\t\t\ttry {\n\t\t\t\tconst store = await Promise.race([\n\t\t\t\t\tislandStore(\n\t\t\t\t\t\tcomponent,\n\t\t\t\t\t\tprops,\n\t\t\t\t\t\tlifetime.context,\n\t\t\t\t\t\tshared ? IMPLICIT.STORE : undefined,\n\t\t\t\t\t\tprepare,\n\t\t\t\t\t),\n\t\t\t\t\tlifetime.cancelled,\n\t\t\t\t])\n\t\t\t\tif (lifetime.context.signal.aborted) return\n\t\t\t\tmounting = true\n\t\t\t\tconst replace =\n\t\t\t\t\tclient === `only` ||\n\t\t\t\t\tprevious !== undefined ||\n\t\t\t\t\tapplication?.canResume === false ||\n\t\t\t\t\t// Server-settled state without a synchronous browser seed needs a\n\t\t\t\t\t// fresh view, whose loading state can differ from the SSR markup.\n\t\t\t\t\t(\n\t\t\t\t\t\tJSON.parse(\n\t\t\t\t\t\t\telement.getAttribute(`data-spa-reads`) ?? `[]`,\n\t\t\t\t\t\t) as ReadableToken<unknown>[]\n\t\t\t\t\t).some((token) => getFromStore(store!, token) instanceof Promise)\n\t\t\t\t// Astro leaves this sentinel on islands inserted by ClientRouter.\n\t\t\t\tconst sentinel = element.lastChild\n\t\t\t\tif (sentinel?.nodeType === 8 && sentinel.nodeValue === `astro:end`)\n\t\t\t\t\tsentinel.remove()\n\t\t\t\tlet family = states.get(store!)\n\t\t\t\tif (!family) {\n\t\t\t\t\tfamily = createRegularAtomFamily<State, number, never>(store!, {\n\t\t\t\t\t\tkey: `🔍 spa islands`,\n\t\t\t\t\t\tdefault: { props: {}, slots: {} },\n\t\t\t\t\t})\n\t\t\t\t\tstates.set(store!, family)\n\t\t\t\t}\n\t\t\t\tconst state = findInStore(store!, family, serial++)\n\t\t\t\tsetIntoStore(store!, state, replace ? current : initial)\n\t\t\t\tlifetime.context.onCleanup(() => {\n\t\t\t\t\tdisposeFromStore(store!, state)\n\t\t\t\t})\n\t\t\t\tconst mount = () => {\n\t\t\t\t\tonRootDispose(dispose)\n\t\t\t\t\tconst getState = useGetter(state)\n\t\t\t\t\treturn () => island(component, getState().props, getState().slots)\n\t\t\t\t}\n\t\t\t\tif (replace) element.replaceChildren()\n\t\t\t\tconst root = (replace ? render : hydrate)(mount, element, {\n\t\t\t\t\tstore: store!,\n\t\t\t\t\tcapabilities: component.capabilities ?? [],\n\t\t\t\t})\n\t\t\t\tlifetime.context.onCleanup(root.dispose)\n\t\t\t\tupdate = (next) => {\n\t\t\t\t\tsetIntoStore(store!, state, next)\n\t\t\t\t\troot.flush()\n\t\t\t\t}\n\t\t\t\t// Match the existing SSR tree before applying a structural prop update\n\t\t\t\t// that arrived while its store was still being prepared.\n\t\t\t\tif (!replace && current !== initial) update(current)\n\t\t\t} catch (error) {\n\t\t\t\tif (lifetime.context.signal.aborted && !mounting) return\n\t\t\t\tfailPreparation(error, dispose)\n\t\t\t}\n\t\t})\n\t\troots.set(element, {\n\t\t\tcomponent,\n\t\t\tready,\n\t\t\tupdate(nextProps, nextSlots) {\n\t\t\t\tcurrent = { props: nextProps, slots: nextSlots }\n\t\t\t\tupdate?.(current)\n\t\t\t},\n\t\t\tdispose,\n\t\t})\n\t\telement.addEventListener(`astro:unmount`, dispose, { once: true })\n\t\tlifetime.context.onCleanup(dispose)\n\t\treturn ready\n\t}\n\nexport default createHydrator()\n"],"mappings":"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"}
|
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
|
-
import { n as islandStore, t as island } from "./astro-shared-
|
|
4
|
-
import { t as renderToStringWithReads } from "./server-renderer-
|
|
3
|
+
import { n as islandStore, t as island } from "./astro-shared-DBwINQav.js";
|
|
4
|
+
import { t as renderToStringWithReads } from "./server-renderer-D7CdyOMo.js";
|
|
5
5
|
// src/astro-server.ts
|
|
6
6
|
const createRenderer = (awaitState = false) => ({
|
|
7
7
|
name: `spa`,
|
|
@@ -27,8 +27,8 @@ const createRenderer = (awaitState = false) => ({
|
|
|
27
27
|
lifetime.context.signal.throwIfAborted();
|
|
28
28
|
const reads = /* @__PURE__ */ new Map();
|
|
29
29
|
const pending = /* @__PURE__ */ new Set();
|
|
30
|
-
const html = renderToStringWithReads(() => () => island(component, props, slots), options, awaitState ? (value, token) => {
|
|
31
|
-
reads.set(token.key, token);
|
|
30
|
+
const html = renderToStringWithReads(() => () => island(component, props, slots), options, awaitState ? (value, token, readStore) => {
|
|
31
|
+
if (readStore === store) reads.set(token.key, token);
|
|
32
32
|
if (value instanceof Promise) pending.add(value);
|
|
33
33
|
} : void 0);
|
|
34
34
|
if (!pending.size) return {
|
package/dist/astro-server.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"astro-server.js","names":[],"sources":["../src/astro-server.ts"],"sourcesContent":["/* oxlint-disable typescript/require-await -- Astro requires async renderer callbacks, even for synchronous rendering. */\nimport type { NamedSSRLoadedRendererValue } from \"astro\"\nimport type { ReadableToken } from \"atom.io\"\n\nimport { failPreparation, storeContext } from \"./astro-context.ts\"\nimport { requestApplication } from \"./astro-request.ts\"\nimport type { Island } from \"./astro-shared.ts\"\nimport { island, islandStore } from \"./astro-shared.ts\"\nimport { renderToStringWithReads } from \"./server-renderer.ts\"\n\nexport const createRenderer = (\n\tawaitState = false,\n): NamedSSRLoadedRendererValue => ({\n\tname: `spa`,\n\tasync check(component: Island) {\n\t\treturn component?.spa === true\n\t},\n\tasync renderToStaticMarkup(component: Island, props, slots) {\n\t\tconst request = (this as unknown as { result?: { request: Request } }).result\n\t\t\t?.request\n\t\tconst requestOwner = request ? requestApplication(request) : undefined\n\t\tconst shared =\n\t\t\t!component.createStore && !component.isolate ? requestOwner : undefined\n\t\tconst lifetime = storeContext(undefined, shared?.application)\n\t\tif (requestOwner && !shared) {\n\t\t\tlifetime.context.onCleanup(\n\t\t\t\trequestOwner.application.onCleanup(lifetime.dispose),\n\t\t\t)\n\t\t}\n\t\ttry {\n\t\t\tlifetime.context.signal.throwIfAborted()\n\t\t\tconst store = await Promise.race([\n\t\t\t\tislandStore(component, props, lifetime.context, shared?.store),\n\t\t\t\tlifetime.cancelled,\n\t\t\t])\n\t\t\tlifetime.context.signal.throwIfAborted()\n\t\t\tconst options = {\n\t\t\t\tstore: store!,\n\t\t\t\tidPrefix: crypto.randomUUID(),\n\t\t\t\tcapabilities: component.capabilities ?? [],\n\t\t\t}\n\t\t\t// Retry only after reads made by this view settle. Each discarded render\n\t\t\t// releases its scopes; conditional branches can discover more async state.\n\t\t\tfor (;;) {\n\t\t\t\tlifetime.context.signal.throwIfAborted()\n\t\t\t\tconst reads = new Map<string, ReadableToken<unknown>>()\n\t\t\t\tconst pending = new Set<Promise<unknown>>()\n\t\t\t\tconst html = renderToStringWithReads(\n\t\t\t\t\t() => () => island(component, props, slots),\n\t\t\t\t\toptions,\n\t\t\t\t\tawaitState\n\t\t\t\t\t\t? (value, token) => {\n\t\t\t\t\t\t\t\
|
|
1
|
+
{"version":3,"file":"astro-server.js","names":[],"sources":["../src/astro-server.ts"],"sourcesContent":["/* oxlint-disable typescript/require-await -- Astro requires async renderer callbacks, even for synchronous rendering. */\nimport type { NamedSSRLoadedRendererValue } from \"astro\"\nimport type { ReadableToken } from \"atom.io\"\n\nimport { failPreparation, storeContext } from \"./astro-context.ts\"\nimport { requestApplication } from \"./astro-request.ts\"\nimport type { Island } from \"./astro-shared.ts\"\nimport { island, islandStore } from \"./astro-shared.ts\"\nimport { renderToStringWithReads } from \"./server-renderer.ts\"\n\nexport const createRenderer = (\n\tawaitState = false,\n): NamedSSRLoadedRendererValue => ({\n\tname: `spa`,\n\tasync check(component: Island) {\n\t\treturn component?.spa === true\n\t},\n\tasync renderToStaticMarkup(component: Island, props, slots) {\n\t\tconst request = (this as unknown as { result?: { request: Request } }).result\n\t\t\t?.request\n\t\tconst requestOwner = request ? requestApplication(request) : undefined\n\t\tconst shared =\n\t\t\t!component.createStore && !component.isolate ? requestOwner : undefined\n\t\tconst lifetime = storeContext(undefined, shared?.application)\n\t\tif (requestOwner && !shared) {\n\t\t\tlifetime.context.onCleanup(\n\t\t\t\trequestOwner.application.onCleanup(lifetime.dispose),\n\t\t\t)\n\t\t}\n\t\ttry {\n\t\t\tlifetime.context.signal.throwIfAborted()\n\t\t\tconst store = await Promise.race([\n\t\t\t\tislandStore(component, props, lifetime.context, shared?.store),\n\t\t\t\tlifetime.cancelled,\n\t\t\t])\n\t\t\tlifetime.context.signal.throwIfAborted()\n\t\t\tconst options = {\n\t\t\t\tstore: store!,\n\t\t\t\tidPrefix: crypto.randomUUID(),\n\t\t\t\tcapabilities: component.capabilities ?? [],\n\t\t\t}\n\t\t\t// Retry only after reads made by this view settle. Each discarded render\n\t\t\t// releases its scopes; conditional branches can discover more async state.\n\t\t\tfor (;;) {\n\t\t\t\tlifetime.context.signal.throwIfAborted()\n\t\t\t\tconst reads = new Map<string, ReadableToken<unknown>>()\n\t\t\t\tconst pending = new Set<Promise<unknown>>()\n\t\t\t\tconst html = renderToStringWithReads(\n\t\t\t\t\t() => () => island(component, props, slots),\n\t\t\t\t\toptions,\n\t\t\t\t\tawaitState\n\t\t\t\t\t\t? (value, token, readStore) => {\n\t\t\t\t\t\t\t\tif (readStore === store) reads.set(token.key, token)\n\t\t\t\t\t\t\t\tif (value instanceof Promise) {\n\t\t\t\t\t\t\t\t\tpending.add(value)\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t: undefined,\n\t\t\t\t)\n\t\t\t\tif (!pending.size)\n\t\t\t\t\treturn {\n\t\t\t\t\t\thtml,\n\t\t\t\t\t\t// Even a cached synchronous server read can be async in the browser.\n\t\t\t\t\t\t...(reads.size\n\t\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\t\tattrs: {\n\t\t\t\t\t\t\t\t\t\t\"data-spa-reads\": JSON.stringify([...reads.values()]),\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t: {}),\n\t\t\t\t\t}\n\t\t\t\t// Caught producer errors resolve as state values. An uncaught failure\n\t\t\t\t// must reject this render with its original error.\n\t\t\t\tawait Promise.race([Promise.all(pending), lifetime.cancelled])\n\t\t\t}\n\t\t} catch (error) {\n\t\t\tfailPreparation(error, lifetime.dispose)\n\t\t} finally {\n\t\t\tlifetime.dispose()\n\t\t}\n\t},\n})\nexport default createRenderer()\n"],"mappings":";;;;;AAUA,MAAa,kBACZ,aAAa,WACqB;CAClC,MAAM;CACN,MAAM,MAAM,WAAmB;EAC9B,OAAO,WAAW,QAAQ;CAC3B;CACA,MAAM,qBAAqB,WAAmB,OAAO,OAAO;EAC3D,MAAM,UAAW,KAAsD,QACpE;EACH,MAAM,eAAe,UAAU,mBAAmB,OAAO,IAAI,KAAA;EAC7D,MAAM,SACL,CAAC,UAAU,eAAe,CAAC,UAAU,UAAU,eAAe,KAAA;EAC/D,MAAM,WAAW,aAAa,KAAA,GAAW,QAAQ,WAAW;EAC5D,IAAI,gBAAgB,CAAC,QACpB,SAAS,QAAQ,UAChB,aAAa,YAAY,UAAU,SAAS,OAAO,CACpD;EAED,IAAI;GACH,SAAS,QAAQ,OAAO,eAAe;GACvC,MAAM,QAAQ,MAAM,QAAQ,KAAK,CAChC,YAAY,WAAW,OAAO,SAAS,SAAS,QAAQ,KAAK,GAC7D,SAAS,SACV,CAAC;GACD,SAAS,QAAQ,OAAO,eAAe;GACvC,MAAM,UAAU;IACR;IACP,UAAU,OAAO,WAAW;IAC5B,cAAc,UAAU,gBAAgB,CAAC;GAC1C;GAGA,SAAS;IACR,SAAS,QAAQ,OAAO,eAAe;IACvC,MAAM,wBAAQ,IAAI,IAAoC;IACtD,MAAM,0BAAU,IAAI,IAAsB;IAC1C,MAAM,OAAO,oCACA,OAAO,WAAW,OAAO,KAAK,GAC1C,SACA,cACI,OAAO,OAAO,cAAc;KAC7B,IAAI,cAAc,OAAO,MAAM,IAAI,MAAM,KAAK,KAAK;KACnD,IAAI,iBAAiB,SACpB,QAAQ,IAAI,KAAK;IAEnB,IACC,KAAA,CACJ;IACA,IAAI,CAAC,QAAQ,MACZ,OAAO;KACN;KAEA,GAAI,MAAM,OACP,EACA,OAAO,EACN,kBAAkB,KAAK,UAAU,CAAC,GAAG,MAAM,OAAO,CAAC,CAAC,EACrD,EACD,IACC,CAAC;IACL;IAGD,MAAM,QAAQ,KAAK,CAAC,QAAQ,IAAI,OAAO,GAAG,SAAS,SAAS,CAAC;GAC9D;EACD,SAAS,OAAO;GACf,gBAAgB,OAAO,SAAS,OAAO;EACxC,UAAU;GACT,SAAS,QAAQ;EAClB;CACD;AACD;AACA,IAAA,uBAAe,eAAe"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { jsx } from "./jsx-runtime.js";
|
|
1
|
+
import { n as jsx } from "./jsx-runtime-BGDPK50B.js";
|
|
2
2
|
import { IMPLICIT, Store } from "atom.io/internal";
|
|
3
3
|
// src/astro-shared.ts
|
|
4
4
|
async function islandStore(component, props, context, shared, prepare) {
|
|
@@ -28,4 +28,4 @@ function island(component, props, slots) {
|
|
|
28
28
|
}
|
|
29
29
|
export { islandStore as n, island as t };
|
|
30
30
|
|
|
31
|
-
//# sourceMappingURL=astro-shared-
|
|
31
|
+
//# sourceMappingURL=astro-shared-DBwINQav.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"astro-shared-
|
|
1
|
+
{"version":3,"file":"astro-shared-DBwINQav.js","names":[],"sources":["../src/astro-shared.ts"],"sourcesContent":["import type { RootStore } from \"atom.io/internal\"\nimport { IMPLICIT, Store } from \"atom.io/internal\"\n\nimport type { Capability } from \"./capabilities.ts\"\nimport type { Component, SpaElement } from \"./core.ts\"\nimport { jsx } from \"./jsx-runtime.ts\"\n\nexport interface AstroApplicationContext {\n\t/** Whether the application still represents its initial server snapshot. */\n\treadonly canResume: boolean\n\treadonly signal: AbortSignal\n\tonCleanup(cleanup: () => void): void\n\t/** Initialize a resource once for this application lifetime. */\n\tget<T>(key: unknown, initialize: () => T): T\n}\nexport interface AstroStoreContext {\n\t/** Shared across default islands; private for explicitly isolated islands. */\n\tapplication: AstroApplicationContext\n\t/** The browser island host; undefined during server rendering. */\n\telement: HTMLElement | undefined\n\t/** Aborted when preparation is cancelled or the island is released. */\n\tsignal: AbortSignal\n\t/** Release resources even if preparation or rendering fails. */\n\tonCleanup(cleanup: () => void): void\n}\nexport type AstroStoreFactory<P = Record<string, any>> = (\n\tprops: P,\n\tcontext: AstroStoreContext,\n) => RootStore | Promise<RootStore>\nexport type AstroStorePreparation<P = Record<string, any>> = (\n\tstore: RootStore,\n\tprops: P,\n\tcontext: AstroStoreContext,\n) => void | Promise<void>\nexport type Island<P = any> = Component<P> & {\n\tspa?: boolean\n\t/** Capabilities are scoped to this island root on the server and client. */\n\tcapabilities?: readonly Capability[]\n\t/** Opt into a private island store instead of the shared application store. */\n\tisolate?: boolean\n\tcreateStore?: AstroStoreFactory<P>\n\tprepareStore?: AstroStorePreparation<P>\n}\nexport async function islandStore(\n\tcomponent: Island,\n\tprops: Record<string, any>,\n\tcontext: AstroStoreContext,\n\tshared?: RootStore,\n\tprepare?: AstroStorePreparation,\n): Promise<RootStore> {\n\tconst store = await (component.createStore?.(props, context) ??\n\t\tshared ??\n\t\t(new Store(\n\t\t\t{ name: `spa-island`, lifespan: `ephemeral`, isProduction: true },\n\t\t\tIMPLICIT.STORE,\n\t\t) as RootStore))\n\tcontext.signal.throwIfAborted()\n\tawait prepare?.(store, props, context)\n\tcontext.signal.throwIfAborted()\n\tawait component.prepareStore?.(store, props, context)\n\tcontext.signal.throwIfAborted()\n\treturn store\n}\nexport function island(\n\tcomponent: Island,\n\tprops: Record<string, any>,\n\tslots: Record<string, string>,\n): SpaElement {\n\tconst children = Object.fromEntries(\n\t\tObject.entries(slots).map(([name, html]) => [\n\t\t\tname,\n\t\t\tjsx(`astro-slot`, {\n\t\t\t\tkey: html,\n\t\t\t\tname: name === `default` ? undefined : name,\n\t\t\t\tinnerHTML: html,\n\t\t\t}),\n\t\t]),\n\t)\n\treturn jsx(component, {\n\t\t...props,\n\t\tslots: children,\n\t\tchildren: children[`default`],\n\t})\n}\n"],"mappings":";;;AA2CA,eAAsB,YACrB,WACA,OACA,SACA,QACA,SACqB;CACrB,MAAM,QAAQ,OAAO,UAAU,cAAc,OAAO,OAAO,KAC1D,UACC,IAAI,MACJ;EAAE,MAAM;EAAc,UAAU;EAAa,cAAc;CAAK,GAChE,SAAS,KACV;CACD,QAAQ,OAAO,eAAe;CAC9B,MAAM,UAAU,OAAO,OAAO,OAAO;CACrC,QAAQ,OAAO,eAAe;CAC9B,MAAM,UAAU,eAAe,OAAO,OAAO,OAAO;CACpD,QAAQ,OAAO,eAAe;CAC9B,OAAO;AACR;AACA,SAAgB,OACf,WACA,OACA,OACa;CACb,MAAM,WAAW,OAAO,YACvB,OAAO,QAAQ,KAAK,CAAC,CAAC,KAAK,CAAC,MAAM,UAAU,CAC3C,MACA,IAAI,cAAc;EACjB,KAAK;EACL,MAAM,SAAS,YAAY,KAAA,IAAY;EACvC,WAAW;CACZ,CAAC,CACF,CAAC,CACF;CACA,OAAO,IAAI,WAAW;EACrB,GAAG;EACH,OAAO;EACP,UAAU,SAAS;CACpB,CAAC;AACF"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { o as Component, t as Capability } from "./capabilities-
|
|
1
|
+
import { o as Component, t as Capability } from "./capabilities-ChgSs6bp.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-KxK9OUSj.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"astro-shared-
|
|
1
|
+
{"version":3,"file":"astro-shared-KxK9OUSj.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-KxK9OUSj.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