@c9up/orbit 0.0.0-stage → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Cargo.lock +139 -0
- package/Cargo.toml +20 -0
- package/LICENSE +21 -0
- package/README.md +320 -2
- package/android/orbit.cmake +31 -0
- package/android/src/main/cpp/NativeOrbit.cpp +309 -0
- package/android/src/main/cpp/NativeOrbit.h +35 -0
- package/android/src/main/cpp/orbit_host.h +34 -0
- package/android/src/main/java/com/c9up/orbit/OrbitEffects.kt +286 -0
- package/android/src/main/java/com/c9up/orbit/OrbitHost.kt +258 -0
- package/android/src/main/java/com/c9up/orbit/OrbitImage.kt +346 -0
- package/android/src/main/java/com/c9up/orbit/OrbitInput.kt +161 -0
- package/android/src/main/java/com/c9up/orbit/OrbitPress.kt +110 -0
- package/android/src/main/java/com/c9up/orbit/OrbitVector.kt +115 -0
- package/android/src/main/java/com/c9up/orbit/OrbitViews.kt +362 -0
- package/crates/orbit-host/Cargo.toml +14 -0
- package/crates/orbit-host/src/gesture.rs +561 -0
- package/crates/orbit-host/src/lib.rs +2042 -0
- package/crates/orbit-host/src/motion.rs +328 -0
- package/crates/orbit-host/src/vector.rs +1173 -0
- package/dist/color.d.ts +10 -0
- package/dist/color.d.ts.map +1 -0
- package/dist/color.js +62 -0
- package/dist/color.js.map +1 -0
- package/dist/commit.d.ts +77 -0
- package/dist/commit.d.ts.map +1 -0
- package/dist/commit.js +302 -0
- package/dist/commit.js.map +1 -0
- package/dist/errors.d.ts +76 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +89 -0
- package/dist/errors.js.map +1 -0
- package/dist/host.d.ts +49 -0
- package/dist/host.d.ts.map +1 -0
- package/dist/host.js +20 -0
- package/dist/host.js.map +1 -0
- package/dist/index.d.ts +31 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +31 -0
- package/dist/index.js.map +1 -0
- package/dist/motion.d.ts +18 -0
- package/dist/motion.d.ts.map +1 -0
- package/dist/motion.js +67 -0
- package/dist/motion.js.map +1 -0
- package/dist/node.d.ts +46 -0
- package/dist/node.d.ts.map +1 -0
- package/dist/node.js +110 -0
- package/dist/node.js.map +1 -0
- package/dist/pages.d.ts +56 -0
- package/dist/pages.d.ts.map +1 -0
- package/dist/pages.js +157 -0
- package/dist/pages.js.map +1 -0
- package/dist/react-native/index.d.ts +33 -0
- package/dist/react-native/index.d.ts.map +1 -0
- package/dist/react-native/index.js +71 -0
- package/dist/react-native/index.js.map +1 -0
- package/dist/report.d.ts +13 -0
- package/dist/report.d.ts.map +1 -0
- package/dist/report.js +22 -0
- package/dist/report.js.map +1 -0
- package/dist/server.d.ts +109 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +290 -0
- package/dist/server.js.map +1 -0
- package/dist/stack.d.ts +117 -0
- package/dist/stack.d.ts.map +1 -0
- package/dist/stack.js +299 -0
- package/dist/stack.js.map +1 -0
- package/dist/styles.d.ts +138 -0
- package/dist/styles.d.ts.map +1 -0
- package/dist/styles.js +920 -0
- package/dist/styles.js.map +1 -0
- package/dist/template.d.ts +27 -0
- package/dist/template.d.ts.map +1 -0
- package/dist/template.js +1436 -0
- package/dist/template.js.map +1 -0
- package/dist/textDecoder.d.ts +29 -0
- package/dist/textDecoder.d.ts.map +1 -0
- package/dist/textDecoder.js +149 -0
- package/dist/textDecoder.js.map +1 -0
- package/dist/url.d.ts +45 -0
- package/dist/url.d.ts.map +1 -0
- package/dist/url.js +303 -0
- package/dist/url.js.map +1 -0
- package/package.json +96 -3
- package/scripts/build-android.sh +27 -0
- package/scripts/test-styles.mjs +31 -0
- package/specs/NativeOrbit.ts +34 -0
- package/src/color.ts +68 -0
- package/src/commit.ts +373 -0
- package/src/errors.ts +178 -0
- package/src/host.ts +91 -0
- package/src/index.ts +64 -0
- package/src/motion.ts +88 -0
- package/src/node.ts +133 -0
- package/src/pages.ts +207 -0
- package/src/react-native/index.ts +115 -0
- package/src/react-native/react-native.d.ts +39 -0
- package/src/report.ts +25 -0
- package/src/server.ts +395 -0
- package/src/stack.ts +428 -0
- package/src/styles.ts +1021 -0
- package/src/template.ts +1681 -0
- package/src/textDecoder.ts +162 -0
- package/src/url.ts +333 -0
package/dist/stack.js
ADDED
|
@@ -0,0 +1,299 @@
|
|
|
1
|
+
import { component, createContext, inject, provide, signal, untrack, } from "@c9up/aurora/core";
|
|
2
|
+
import { captureContext } from "@c9up/aurora/renderer";
|
|
3
|
+
import { afterCommit, treeHost } from "./commit.js";
|
|
4
|
+
import { E_ORBIT_NO_SCREEN, E_ORBIT_STACK_SHOWN } from "./errors.js";
|
|
5
|
+
import { bindMotion, MotionValue } from "./motion.js";
|
|
6
|
+
import { flatten, NativeNode, Region } from "./node.js";
|
|
7
|
+
const ScreenContext = createContext("orbit screen", undefined);
|
|
8
|
+
/** The screen this component is part of (in its setup, or in a slot it built). */
|
|
9
|
+
export function useScreen() {
|
|
10
|
+
const screen = inject(ScreenContext);
|
|
11
|
+
if (screen === undefined) {
|
|
12
|
+
throw new E_ORBIT_NO_SCREEN();
|
|
13
|
+
}
|
|
14
|
+
return screen;
|
|
15
|
+
}
|
|
16
|
+
/** How far the covered screen drifts left, in widths. */
|
|
17
|
+
const COVERED_SHIFT = 0.3;
|
|
18
|
+
// Provides the screen, then builds it: what the screen creates injects it.
|
|
19
|
+
const ScreenFrame = component((props) => {
|
|
20
|
+
provide(ScreenContext, props.screen);
|
|
21
|
+
return props.render();
|
|
22
|
+
});
|
|
23
|
+
/** Stacks shown now, in the order they were shown: the back button asks the last first. */
|
|
24
|
+
const shown = [];
|
|
25
|
+
/**
|
|
26
|
+
* The back button or gesture: pop the innermost shown stack that can.
|
|
27
|
+
* False when none can, and the platform's own back applies (leave the app).
|
|
28
|
+
*/
|
|
29
|
+
export function goBack() {
|
|
30
|
+
for (let i = shown.length - 1; i >= 0; i--) {
|
|
31
|
+
const stack = shown[i];
|
|
32
|
+
if (stack?.isShown() && stack.back())
|
|
33
|
+
return true;
|
|
34
|
+
}
|
|
35
|
+
return false;
|
|
36
|
+
}
|
|
37
|
+
export class Stack {
|
|
38
|
+
#run = captureContext();
|
|
39
|
+
#parent = inject(ScreenContext);
|
|
40
|
+
#transition;
|
|
41
|
+
#duration;
|
|
42
|
+
#background;
|
|
43
|
+
#back;
|
|
44
|
+
#depth = signal(1);
|
|
45
|
+
#entries = [];
|
|
46
|
+
#leaving = [];
|
|
47
|
+
#region = new Region();
|
|
48
|
+
#container = null;
|
|
49
|
+
#build = null;
|
|
50
|
+
constructor(initial, options) {
|
|
51
|
+
this.#transition = options.transition ?? "slide";
|
|
52
|
+
this.#duration = options.duration ?? 300;
|
|
53
|
+
this.#background = options.background;
|
|
54
|
+
this.#back = options.back;
|
|
55
|
+
this.#entries = [this.#entry(initial)];
|
|
56
|
+
}
|
|
57
|
+
push(screen, props) {
|
|
58
|
+
const entry = this.#entry(() => screen(props));
|
|
59
|
+
const below = this.#entries.at(-1);
|
|
60
|
+
this.#entries.push(entry);
|
|
61
|
+
this.#depth(this.#entries.length);
|
|
62
|
+
if (!this.#container)
|
|
63
|
+
return;
|
|
64
|
+
if (below)
|
|
65
|
+
this.#cover(below);
|
|
66
|
+
this.#show(entry, true);
|
|
67
|
+
}
|
|
68
|
+
pop() {
|
|
69
|
+
if (this.#entries.length < 2)
|
|
70
|
+
return false;
|
|
71
|
+
const top = this.#entries.pop();
|
|
72
|
+
const below = this.#entries.at(-1);
|
|
73
|
+
this.#depth(this.#entries.length);
|
|
74
|
+
if (!top || !below)
|
|
75
|
+
return false;
|
|
76
|
+
this.#leave(top, true);
|
|
77
|
+
below.top(true);
|
|
78
|
+
if (this.#container) {
|
|
79
|
+
below.visible?.set(1);
|
|
80
|
+
if (this.#animated())
|
|
81
|
+
below.x?.timing(0, { duration: this.#duration });
|
|
82
|
+
else
|
|
83
|
+
below.x?.set(0);
|
|
84
|
+
}
|
|
85
|
+
return true;
|
|
86
|
+
}
|
|
87
|
+
replace(screen, props) {
|
|
88
|
+
const entry = this.#entry(() => screen(props));
|
|
89
|
+
const old = this.#entries.pop();
|
|
90
|
+
this.#entries.push(entry);
|
|
91
|
+
if (old)
|
|
92
|
+
this.#leave(old, false);
|
|
93
|
+
if (this.#container)
|
|
94
|
+
this.#show(entry, true);
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Swap the top screen for `screen` at once, with no transition: the same
|
|
98
|
+
* place showing something new (a page reloaded with new props).
|
|
99
|
+
*/
|
|
100
|
+
replaceInPlace(screen, props) {
|
|
101
|
+
const entry = this.#entry(() => screen(props));
|
|
102
|
+
const old = this.#entries.pop();
|
|
103
|
+
this.#entries.push(entry);
|
|
104
|
+
if (old)
|
|
105
|
+
this.#leave(old, false, false);
|
|
106
|
+
if (this.#container)
|
|
107
|
+
this.#show(entry, false);
|
|
108
|
+
}
|
|
109
|
+
/** End every screen and start again from `screen`, at once. */
|
|
110
|
+
reset(screen, props) {
|
|
111
|
+
const entry = this.#entry(() => screen(props));
|
|
112
|
+
const old = this.#entries.splice(0);
|
|
113
|
+
this.#entries = [entry];
|
|
114
|
+
this.#depth(1);
|
|
115
|
+
for (const ended of old)
|
|
116
|
+
this.#leave(ended, false, false);
|
|
117
|
+
if (this.#container)
|
|
118
|
+
this.#show(entry, false);
|
|
119
|
+
}
|
|
120
|
+
/** What the back button does here: the `back` option, or `pop()`. */
|
|
121
|
+
back() {
|
|
122
|
+
return this.#back === undefined ? this.pop() : this.#back();
|
|
123
|
+
}
|
|
124
|
+
canGoBack() {
|
|
125
|
+
return this.#depth() > 1;
|
|
126
|
+
}
|
|
127
|
+
/** Whether this stack is on screen: not inside a covered screen. */
|
|
128
|
+
isShown() {
|
|
129
|
+
return this.#container !== null && (this.#parent?.focused() ?? true);
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* @internal The renderer shows the stack here, once: `build` makes a
|
|
133
|
+
* screen's native children, `ended` takes what ends the stack with the
|
|
134
|
+
* scope that shows it.
|
|
135
|
+
*/
|
|
136
|
+
attach(build, ended) {
|
|
137
|
+
if (this.#container) {
|
|
138
|
+
throw new E_ORBIT_STACK_SHOWN();
|
|
139
|
+
}
|
|
140
|
+
this.#build = build;
|
|
141
|
+
this.#container = new NativeNode("RCTView", flatten({ flex: 1, overflow: "hidden" }), [this.#region]);
|
|
142
|
+
for (const entry of this.#entries)
|
|
143
|
+
this.#show(entry, false);
|
|
144
|
+
for (const entry of this.#entries.slice(0, -1)) {
|
|
145
|
+
entry.visible?.set(0);
|
|
146
|
+
}
|
|
147
|
+
shown.push(this);
|
|
148
|
+
ended(() => this.#end());
|
|
149
|
+
return this.#container;
|
|
150
|
+
}
|
|
151
|
+
#entry(render) {
|
|
152
|
+
return {
|
|
153
|
+
render,
|
|
154
|
+
top: signal(true),
|
|
155
|
+
view: null,
|
|
156
|
+
disposers: [],
|
|
157
|
+
x: null,
|
|
158
|
+
visible: null,
|
|
159
|
+
leaving: null,
|
|
160
|
+
};
|
|
161
|
+
}
|
|
162
|
+
#screen(entry) {
|
|
163
|
+
const parent = this.#parent;
|
|
164
|
+
const stack = this;
|
|
165
|
+
return {
|
|
166
|
+
focused: () => entry.top() && (parent?.focused() ?? true),
|
|
167
|
+
push(screen, props) {
|
|
168
|
+
stack.push(screen, props);
|
|
169
|
+
},
|
|
170
|
+
pop: () => stack.pop(),
|
|
171
|
+
replace(screen, props) {
|
|
172
|
+
stack.replace(screen, props);
|
|
173
|
+
},
|
|
174
|
+
canGoBack: () => stack.canGoBack(),
|
|
175
|
+
};
|
|
176
|
+
}
|
|
177
|
+
#animated() {
|
|
178
|
+
return this.#transition === "slide" && this.#width() > 0;
|
|
179
|
+
}
|
|
180
|
+
/** The stack's width in dp, as last laid out (0 before its first commit). */
|
|
181
|
+
#width() {
|
|
182
|
+
const container = this.#container;
|
|
183
|
+
if (!container)
|
|
184
|
+
return 0;
|
|
185
|
+
const frames = JSON.parse(treeHost().layout(JSON.stringify([container.tag])));
|
|
186
|
+
const frame = Array.isArray(frames) ? frames[0] : null;
|
|
187
|
+
const width = Array.isArray(frame) ? frame[2] : 0;
|
|
188
|
+
return typeof width === "number" ? width : 0;
|
|
189
|
+
}
|
|
190
|
+
/** Build `entry`'s screen and put its view on top; `arrive` slides it in. */
|
|
191
|
+
#show(entry, arrive) {
|
|
192
|
+
const build = this.#build;
|
|
193
|
+
if (!build)
|
|
194
|
+
return;
|
|
195
|
+
const width = arrive && this.#animated() ? this.#width() : 0;
|
|
196
|
+
const screen = this.#screen(entry);
|
|
197
|
+
const [children, disposers] = untrack(() => build(this.#run(() => ScreenFrame({ screen, render: entry.render }))));
|
|
198
|
+
const view = new NativeNode("RCTView", flatten({
|
|
199
|
+
position: "absolute",
|
|
200
|
+
top: 0,
|
|
201
|
+
left: 0,
|
|
202
|
+
right: 0,
|
|
203
|
+
bottom: 0,
|
|
204
|
+
...(this.#background === undefined
|
|
205
|
+
? {}
|
|
206
|
+
: { backgroundColor: this.#background }),
|
|
207
|
+
}), children);
|
|
208
|
+
entry.view = view;
|
|
209
|
+
entry.disposers = disposers;
|
|
210
|
+
const x = new MotionValue(width);
|
|
211
|
+
const visible = new MotionValue(1);
|
|
212
|
+
entry.x = x;
|
|
213
|
+
entry.visible = visible;
|
|
214
|
+
afterCommit(() => bindMotion(view.tag, { translateX: x, visible }));
|
|
215
|
+
if (width > 0)
|
|
216
|
+
x.timing(0, { duration: this.#duration });
|
|
217
|
+
this.#layout();
|
|
218
|
+
}
|
|
219
|
+
/**
|
|
220
|
+
* `entry` is no longer on top: it drifts left, and hides the frame its
|
|
221
|
+
* cover has arrived — at once, a frame later, so the cover is mounted.
|
|
222
|
+
*/
|
|
223
|
+
#cover(entry) {
|
|
224
|
+
entry.top(false);
|
|
225
|
+
const animated = this.#animated();
|
|
226
|
+
if (animated) {
|
|
227
|
+
const width = this.#width();
|
|
228
|
+
entry.x?.timing(-COVERED_SHIFT * width, { duration: this.#duration });
|
|
229
|
+
}
|
|
230
|
+
entry.visible?.after(animated ? this.#duration : 0, 0);
|
|
231
|
+
}
|
|
232
|
+
/**
|
|
233
|
+
* `entry` ends now — its effects stop, its unmount hooks run — and its
|
|
234
|
+
* view goes once the transition is over: sliding out to the right when
|
|
235
|
+
* popped, staying under its replacement when replaced.
|
|
236
|
+
*/
|
|
237
|
+
#leave(entry, slide, animate = true) {
|
|
238
|
+
entry.top(false);
|
|
239
|
+
for (const end of entry.disposers.splice(0))
|
|
240
|
+
end();
|
|
241
|
+
if (!entry.view)
|
|
242
|
+
return;
|
|
243
|
+
this.#leaving.push(entry);
|
|
244
|
+
const animated = animate && this.#animated();
|
|
245
|
+
if (animated && slide) {
|
|
246
|
+
entry.x?.timing(this.#width(), { duration: this.#duration });
|
|
247
|
+
}
|
|
248
|
+
entry.leaving = setTimeout(() => this.#remove(entry), animated ? this.#duration : 0);
|
|
249
|
+
}
|
|
250
|
+
#remove(entry) {
|
|
251
|
+
if (entry.leaving !== null)
|
|
252
|
+
clearTimeout(entry.leaving);
|
|
253
|
+
entry.leaving = null;
|
|
254
|
+
const at = this.#leaving.indexOf(entry);
|
|
255
|
+
if (at >= 0)
|
|
256
|
+
this.#leaving.splice(at, 1);
|
|
257
|
+
entry.view = null;
|
|
258
|
+
entry.x?.dispose();
|
|
259
|
+
entry.visible?.dispose();
|
|
260
|
+
entry.x = null;
|
|
261
|
+
entry.visible = null;
|
|
262
|
+
this.#layout();
|
|
263
|
+
}
|
|
264
|
+
/**
|
|
265
|
+
* The views in drawing order: the covered screens, then those leaving
|
|
266
|
+
* (a popped screen slides out over the one it uncovers, a replaced one
|
|
267
|
+
* stays under its replacement), then the top.
|
|
268
|
+
*/
|
|
269
|
+
#layout() {
|
|
270
|
+
const views = (entries) => entries.flatMap((entry) => (entry.view ? [entry.view] : []));
|
|
271
|
+
const top = this.#entries.at(-1);
|
|
272
|
+
this.#region.set([
|
|
273
|
+
...views(this.#entries.slice(0, -1)),
|
|
274
|
+
...views(this.#leaving),
|
|
275
|
+
...(top ? views([top]) : []),
|
|
276
|
+
]);
|
|
277
|
+
}
|
|
278
|
+
#end() {
|
|
279
|
+
const at = shown.indexOf(this);
|
|
280
|
+
if (at >= 0)
|
|
281
|
+
shown.splice(at, 1);
|
|
282
|
+
for (const entry of [...this.#entries, ...this.#leaving]) {
|
|
283
|
+
entry.top(false);
|
|
284
|
+
for (const end of entry.disposers.splice(0))
|
|
285
|
+
end();
|
|
286
|
+
if (entry.leaving !== null)
|
|
287
|
+
clearTimeout(entry.leaving);
|
|
288
|
+
entry.x?.dispose();
|
|
289
|
+
entry.visible?.dispose();
|
|
290
|
+
}
|
|
291
|
+
this.#entries = [];
|
|
292
|
+
this.#leaving = [];
|
|
293
|
+
this.#container = null;
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
export function createStack(initial, options = {}) {
|
|
297
|
+
return new Stack(() => initial(options.props), options);
|
|
298
|
+
}
|
|
299
|
+
//# sourceMappingURL=stack.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stack.js","sourceRoot":"","sources":["../src/stack.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,SAAS,EACT,aAAa,EACb,MAAM,EACN,OAAO,EAEP,MAAM,EACN,OAAO,GACP,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,cAAc,EAAuB,MAAM,uBAAuB,CAAC;AAC5E,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACpD,OAAO,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AACrE,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AACtD,OAAO,EAAc,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAmEpE,MAAM,aAAa,GAAG,aAAa,CAClC,cAAc,EACd,SAAS,CACT,CAAC;AAEF,kFAAkF;AAClF,MAAM,UAAU,SAAS;IACxB,MAAM,MAAM,GAAG,MAAM,CAAC,aAAa,CAAC,CAAC;IACrC,IAAI,MAAM,KAA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import { type Signal } from "@c9up/aurora/core";
|
|
2
|
+
import type { Style } from "./node.js";
|
|
3
|
+
/**
|
|
4
|
+
* Styles from the app's own Tailwind build.
|
|
5
|
+
*
|
|
6
|
+
* `ream android:build` runs Tailwind over the app as its web build does, and
|
|
7
|
+
* compiles the stylesheet into a table (`ream css:compile`): every utility
|
|
8
|
+
* rule with its declarations already resolved against the theme (lengths in
|
|
9
|
+
* px, colours as `#rrggbbaa`, light and dark), its variant as conditions, and
|
|
10
|
+
* the custom properties classes compose at run time (`--tw-shadow`,
|
|
11
|
+
* `--tw-leading`…) left as `var()`. This applies the table to orbit's tree
|
|
12
|
+
* the way a browser applies the stylesheet: rules matched by class and
|
|
13
|
+
* condition, cascaded by specificity then order, custom properties resolved,
|
|
14
|
+
* and the result read into the host's style keys.
|
|
15
|
+
*/
|
|
16
|
+
type SchemeValue = string | {
|
|
17
|
+
light: string;
|
|
18
|
+
dark: string;
|
|
19
|
+
};
|
|
20
|
+
export type StyleCondition = {
|
|
21
|
+
attribute: string;
|
|
22
|
+
equals: string | null;
|
|
23
|
+
} | {
|
|
24
|
+
attribute: string;
|
|
25
|
+
operator: "*" | "^" | "$" | "~" | "|";
|
|
26
|
+
value: string;
|
|
27
|
+
} | {
|
|
28
|
+
state: string;
|
|
29
|
+
} | {
|
|
30
|
+
scheme: "dark";
|
|
31
|
+
} | {
|
|
32
|
+
class: string;
|
|
33
|
+
} | {
|
|
34
|
+
not: StyleCondition[];
|
|
35
|
+
} | {
|
|
36
|
+
any: StyleCondition[];
|
|
37
|
+
} | {
|
|
38
|
+
all: StyleCondition[];
|
|
39
|
+
} | {
|
|
40
|
+
ancestor: Relative;
|
|
41
|
+
} | {
|
|
42
|
+
parent: Relative;
|
|
43
|
+
} | {
|
|
44
|
+
previous: Relative;
|
|
45
|
+
} | {
|
|
46
|
+
previousAdjacent: Relative;
|
|
47
|
+
} | {
|
|
48
|
+
has: string;
|
|
49
|
+
} | {
|
|
50
|
+
position: string;
|
|
51
|
+
of?: string;
|
|
52
|
+
} | {
|
|
53
|
+
dir: string;
|
|
54
|
+
};
|
|
55
|
+
interface Relative {
|
|
56
|
+
classes: string[];
|
|
57
|
+
when: StyleCondition[];
|
|
58
|
+
}
|
|
59
|
+
type Target = "self" | {
|
|
60
|
+
pseudo: string;
|
|
61
|
+
} | {
|
|
62
|
+
relation: "child" | "descendant";
|
|
63
|
+
tag: string | null;
|
|
64
|
+
when: StyleCondition[];
|
|
65
|
+
pseudo: string | null;
|
|
66
|
+
};
|
|
67
|
+
export interface StyleRule {
|
|
68
|
+
/** The utility class it belongs to; absent for an element rule. */
|
|
69
|
+
class?: string;
|
|
70
|
+
/** A rule of the base layer: a tag, or `*` for every element. */
|
|
71
|
+
element?: string;
|
|
72
|
+
when?: StyleCondition[];
|
|
73
|
+
target?: Target;
|
|
74
|
+
media?: {
|
|
75
|
+
minWidth?: number;
|
|
76
|
+
maxWidth?: number;
|
|
77
|
+
};
|
|
78
|
+
specificity: number;
|
|
79
|
+
declarations: Array<[string, SchemeValue]>;
|
|
80
|
+
}
|
|
81
|
+
export interface StyleTable {
|
|
82
|
+
version: 1;
|
|
83
|
+
properties: {
|
|
84
|
+
[name: string]: {
|
|
85
|
+
initial: string | null;
|
|
86
|
+
inherits: boolean;
|
|
87
|
+
};
|
|
88
|
+
};
|
|
89
|
+
rules: StyleRule[];
|
|
90
|
+
inert: string[];
|
|
91
|
+
}
|
|
92
|
+
/** What the resolver reads of an element: all reactive reads. */
|
|
93
|
+
export interface StyledElement {
|
|
94
|
+
/** The tag; the root answers to `html` and `body` as well (`root`). */
|
|
95
|
+
readonly tag: string;
|
|
96
|
+
readonly root?: boolean;
|
|
97
|
+
classes(): readonly string[];
|
|
98
|
+
/** The attribute's value, `""` when present without one, null when absent. */
|
|
99
|
+
attribute(name: string): string | null;
|
|
100
|
+
readonly parent: StyledElement | null;
|
|
101
|
+
/** The element sibling just before this one, if any. */
|
|
102
|
+
readonly previous: StyledElement | null;
|
|
103
|
+
/** Custom properties this element passes down (resolved), set once computed. */
|
|
104
|
+
vars?: ReadonlyMap<string, string>;
|
|
105
|
+
}
|
|
106
|
+
/** An element's computed style, read into the host's keys. */
|
|
107
|
+
export interface Computed {
|
|
108
|
+
box: Style;
|
|
109
|
+
text: Style;
|
|
110
|
+
/** `display: flex` / `inline-flex`: each child its own item, a row by default. */
|
|
111
|
+
flex: boolean;
|
|
112
|
+
/** `overflow(-y): auto | scroll`. */
|
|
113
|
+
scroll: boolean;
|
|
114
|
+
/** `::placeholder`'s colour, for a text field. */
|
|
115
|
+
placeholder?: string;
|
|
116
|
+
vars: ReadonlyMap<string, string>;
|
|
117
|
+
}
|
|
118
|
+
/** Classes an element asked for that the app's stylesheet does not have. */
|
|
119
|
+
export declare const unknownClasses: Set<string>;
|
|
120
|
+
/** The scheme `dark:` and the theme's dark values follow. */
|
|
121
|
+
export declare const colorScheme: Signal<"light" | "dark">;
|
|
122
|
+
/** The viewport, for `sm:` / `md:` and `vw` / `vh` (set by `mount`). */
|
|
123
|
+
export declare const viewportSize: Signal<{
|
|
124
|
+
width: number;
|
|
125
|
+
height: number;
|
|
126
|
+
}>;
|
|
127
|
+
/** A table `ream css:compile` wrote, checked rather than trusted (it is a file read at run time). */
|
|
128
|
+
export declare function isStyleTable(v: unknown): v is StyleTable;
|
|
129
|
+
/** Give orbit the app's style table (`ream android:*` does it before the app runs). */
|
|
130
|
+
export declare function useStyles(table: unknown): void;
|
|
131
|
+
/**
|
|
132
|
+
* `el`'s style: the table's rules cascaded, custom properties resolved, read
|
|
133
|
+
* into the host's keys. `inherited` is the text style it inherits (and its
|
|
134
|
+
* colour, for `currentcolor`).
|
|
135
|
+
*/
|
|
136
|
+
export declare function computeStyle(el: StyledElement, inherited: Style): Computed;
|
|
137
|
+
export {};
|
|
138
|
+
//# sourceMappingURL=styles.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../src/styles.ts"],"names":[],"mappings":"A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