@glissade/scene 0.18.0-pre.0 → 0.18.0-pre.2
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/dist/layout.d.ts +23 -1
- package/dist/layout.js +22 -1
- package/package.json +2 -2
package/dist/layout.d.ts
CHANGED
|
@@ -55,7 +55,29 @@ declare class Layout extends Group {
|
|
|
55
55
|
};
|
|
56
56
|
protected draw(out: DisplayListBuilder, ctx: EvalContext): void;
|
|
57
57
|
}
|
|
58
|
+
/**
|
|
59
|
+
* Stack-ergonomic props — a more DISCOVERABLE surface over {@link LayoutProps}.
|
|
60
|
+
* Everything `Layout` accepts (id, position, opacity, width/height, gap,
|
|
61
|
+
* padding, justify, children, …) passes through unchanged; the only difference
|
|
62
|
+
* from constructing `Layout` directly is the defaulting `Stack()` applies.
|
|
63
|
+
*/
|
|
64
|
+
interface StackProps extends LayoutProps {}
|
|
65
|
+
/**
|
|
66
|
+
* Thin convenience factory over the Yoga-backed {@link Layout} node — NOT a new
|
|
67
|
+
* class and NOT new signals, so a `Stack` inherits Layout's memoized, pure,
|
|
68
|
+
* dependency-tracked resolve verbatim: `Stack(props)` and the equivalent
|
|
69
|
+
* hand-written `Layout({...})` produce identical child positions.
|
|
70
|
+
*
|
|
71
|
+
* Stack-ergonomic defaults (the ONLY divergence from `Layout`):
|
|
72
|
+
* - `direction` defaults to `'column'` (the common vertical stack; Layout's own
|
|
73
|
+
* default is `'row'`).
|
|
74
|
+
* - `align` defaults to `'start'` — a true left edge for a label column (the
|
|
75
|
+
* dogfooding use case). This DIVERGES from `Layout`'s `'center'` default.
|
|
76
|
+
*
|
|
77
|
+
* Every other prop passes straight through to `Layout`.
|
|
78
|
+
*/
|
|
79
|
+
declare function Stack(props?: StackProps): Layout;
|
|
58
80
|
/** Load Yoga (wasm) and register it as the active LayoutEngine. Idempotent. */
|
|
59
81
|
declare function loadYogaLayoutEngine(): Promise<LayoutEngine>;
|
|
60
82
|
//#endregion
|
|
61
|
-
export { Layout, type LayoutBox, type LayoutChildSpec, type LayoutContainerSpec, type LayoutEngine, LayoutEngineMissingError, LayoutProps, type LayoutResult, getLayoutEngine, loadYogaLayoutEngine, setLayoutEngine };
|
|
83
|
+
export { Layout, type LayoutBox, type LayoutChildSpec, type LayoutContainerSpec, type LayoutEngine, LayoutEngineMissingError, LayoutProps, type LayoutResult, Stack, StackProps, getLayoutEngine, loadYogaLayoutEngine, setLayoutEngine };
|
package/dist/layout.js
CHANGED
|
@@ -149,6 +149,27 @@ var Layout = class extends Group {
|
|
|
149
149
|
}
|
|
150
150
|
}
|
|
151
151
|
};
|
|
152
|
+
/**
|
|
153
|
+
* Thin convenience factory over the Yoga-backed {@link Layout} node — NOT a new
|
|
154
|
+
* class and NOT new signals, so a `Stack` inherits Layout's memoized, pure,
|
|
155
|
+
* dependency-tracked resolve verbatim: `Stack(props)` and the equivalent
|
|
156
|
+
* hand-written `Layout({...})` produce identical child positions.
|
|
157
|
+
*
|
|
158
|
+
* Stack-ergonomic defaults (the ONLY divergence from `Layout`):
|
|
159
|
+
* - `direction` defaults to `'column'` (the common vertical stack; Layout's own
|
|
160
|
+
* default is `'row'`).
|
|
161
|
+
* - `align` defaults to `'start'` — a true left edge for a label column (the
|
|
162
|
+
* dogfooding use case). This DIVERGES from `Layout`'s `'center'` default.
|
|
163
|
+
*
|
|
164
|
+
* Every other prop passes straight through to `Layout`.
|
|
165
|
+
*/
|
|
166
|
+
function Stack(props = {}) {
|
|
167
|
+
return new Layout({
|
|
168
|
+
...props,
|
|
169
|
+
direction: props.direction ?? "column",
|
|
170
|
+
align: props.align ?? "start"
|
|
171
|
+
});
|
|
172
|
+
}
|
|
152
173
|
function initProp(sig, init) {
|
|
153
174
|
if (typeof init === "function") sig.bindSource(init);
|
|
154
175
|
else if (init !== void 0) sig.set(init);
|
|
@@ -213,4 +234,4 @@ async function loadYogaLayoutEngine() {
|
|
|
213
234
|
return engine;
|
|
214
235
|
}
|
|
215
236
|
//#endregion
|
|
216
|
-
export { Layout, LayoutEngineMissingError, getLayoutEngine, loadYogaLayoutEngine, setLayoutEngine };
|
|
237
|
+
export { Layout, LayoutEngineMissingError, Stack, getLayoutEngine, loadYogaLayoutEngine, setLayoutEngine };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@glissade/scene",
|
|
3
|
-
"version": "0.18.0-pre.
|
|
3
|
+
"version": "0.18.0-pre.2",
|
|
4
4
|
"description": "glissade scene graph: nodes, transforms, DisplayList emission. Renderer-agnostic; zero DOM/Node dependencies.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"engines": {
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
],
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"yoga-layout": "^3.2.1",
|
|
30
|
-
"@glissade/core": "0.18.0-pre.
|
|
30
|
+
"@glissade/core": "0.18.0-pre.2"
|
|
31
31
|
},
|
|
32
32
|
"repository": {
|
|
33
33
|
"type": "git",
|