@bindtty/layout 0.1.0-alpha.2 → 0.1.0-alpha.4
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 +1 -3
- package/dist/basic-engine.js +0 -6
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/layout-props.d.ts +0 -1
- package/dist/layout-props.js +4 -7
- package/dist/yoga-engine.js +0 -3
- package/package.json +6 -6
package/README.md
CHANGED
|
@@ -16,9 +16,7 @@ const layoutTree = layoutRoot(runtime.root, {
|
|
|
16
16
|
|
|
17
17
|
## 已支持的 intrinsic 布局
|
|
18
18
|
|
|
19
|
-
`screen`、`box`、`vstack`、`hstack`、`text`、`spacer`,以及 `fragment` / `show` / `for`
|
|
20
|
-
|
|
21
|
-
intrinsic `button` / `input` 在 schema 有定义,但 layout 会抛 `Unsupported layout element`;交互控件请使用 `@bindtty/widgets` 的组合实现。
|
|
19
|
+
`screen`、`box`、`vstack`、`hstack`、`text`、`spacer`,以及 `fragment` / `show` / `for` 结构节点。交互控件请使用 `@bindtty/widgets` 的组合实现。
|
|
22
20
|
|
|
23
21
|
高级 layout props 见 [doc/specs/LAYOUT_PROPS.md](../../doc/specs/LAYOUT_PROPS.md)(支持矩阵;运行 `npm run gen:layout-props` 同步文档)。默认 engine 为 `YogaLayoutEngine`。
|
|
24
22
|
|
package/dist/basic-engine.js
CHANGED
|
@@ -46,9 +46,6 @@ function measureElement(node, constraint) {
|
|
|
46
46
|
return measureFlowChildren(node.children, "row", constraint);
|
|
47
47
|
case "box":
|
|
48
48
|
return measureBox(node, constraint);
|
|
49
|
-
case "button":
|
|
50
|
-
case "input":
|
|
51
|
-
throw new Error(`Unsupported layout element: ${node.tag}`);
|
|
52
49
|
}
|
|
53
50
|
}
|
|
54
51
|
function measureTextElement(node, constraint) {
|
|
@@ -147,9 +144,6 @@ function arrangeElement(node, rect, constraint) {
|
|
|
147
144
|
case "text":
|
|
148
145
|
case "spacer":
|
|
149
146
|
return createLeafLayout(node, rect);
|
|
150
|
-
case "button":
|
|
151
|
-
case "input":
|
|
152
|
-
throw new Error(`Unsupported layout element: ${node.tag}`);
|
|
153
147
|
}
|
|
154
148
|
}
|
|
155
149
|
function arrangeBox(node, rect, constraint) {
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { createBasicLayoutEngine } from "./basic-engine.js";
|
|
2
2
|
export { createYogaLayoutEngine } from "./yoga-engine.js";
|
|
3
3
|
export { layoutRoot } from "./layout.js";
|
|
4
|
-
export { basicSupportedPropsByTag, futureLayoutProps, getLayoutPropMatrixStatus, matrixLayoutProps,
|
|
4
|
+
export { basicSupportedPropsByTag, futureLayoutProps, getLayoutPropMatrixStatus, matrixLayoutProps, resolveMargin, resolvePadding, yogaSupportedPropsByTag } from "./layout-props.js";
|
|
5
5
|
export type { BoxMarginEdges, BoxPaddingEdges, LayoutElementTag, LayoutPropMatrixStatus, MatrixLayoutProp } from "./layout-props.js";
|
|
6
6
|
export { createZeroRect } from "./measure.js";
|
|
7
7
|
export type { LayoutFlow } from "./intrinsic.js";
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { createBasicLayoutEngine } from "./basic-engine.js";
|
|
2
2
|
export { createYogaLayoutEngine } from "./yoga-engine.js";
|
|
3
3
|
export { layoutRoot } from "./layout.js";
|
|
4
|
-
export { basicSupportedPropsByTag, futureLayoutProps, getLayoutPropMatrixStatus, matrixLayoutProps,
|
|
4
|
+
export { basicSupportedPropsByTag, futureLayoutProps, getLayoutPropMatrixStatus, matrixLayoutProps, resolveMargin, resolvePadding, yogaSupportedPropsByTag } from "./layout-props.js";
|
|
5
5
|
export { createZeroRect } from "./measure.js";
|
package/dist/layout-props.d.ts
CHANGED
|
@@ -2,7 +2,6 @@ import type { MountedElementNode } from "@bindtty/vnode";
|
|
|
2
2
|
export type LayoutOverflow = "visible" | "clip";
|
|
3
3
|
export type LayoutElementTag = MountedElementNode["tag"];
|
|
4
4
|
export declare const yogaSupportedPropsByTag: Record<LayoutElementTag, ReadonlySet<string>>;
|
|
5
|
-
export declare const nonLayoutElementTags: Set<import("@bindtty/vnode").IntrinsicElementTag>;
|
|
6
5
|
export declare const basicSupportedPropsByTag: Record<LayoutElementTag, ReadonlySet<string>>;
|
|
7
6
|
export declare const futureLayoutProps: Set<string>;
|
|
8
7
|
export declare const layoutPropAliases: Map<string, string>;
|
package/dist/layout-props.js
CHANGED
|
@@ -80,11 +80,8 @@ export const yogaSupportedPropsByTag = {
|
|
|
80
80
|
"flexShrink",
|
|
81
81
|
...yogaLayoutItemTags
|
|
82
82
|
]),
|
|
83
|
-
spacer: new Set(["size", "flexGrow", "flexShrink", ...yogaLayoutItemTags])
|
|
84
|
-
button: new Set(["value", "disabled", "flexGrow", "flexShrink"]),
|
|
85
|
-
input: new Set(["value", "placeholder", "flexGrow", "flexShrink"])
|
|
83
|
+
spacer: new Set(["size", "flexGrow", "flexShrink", ...yogaLayoutItemTags])
|
|
86
84
|
};
|
|
87
|
-
export const nonLayoutElementTags = new Set(["button", "input"]);
|
|
88
85
|
export const basicSupportedPropsByTag = {
|
|
89
86
|
screen: new Set(),
|
|
90
87
|
vstack: new Set(),
|
|
@@ -99,9 +96,7 @@ export const basicSupportedPropsByTag = {
|
|
|
99
96
|
"scrollY"
|
|
100
97
|
]),
|
|
101
98
|
text: new Set(["value", "wrap", "color", "bold"]),
|
|
102
|
-
spacer: new Set(["size"])
|
|
103
|
-
button: new Set(["value", "disabled"]),
|
|
104
|
-
input: new Set(["value", "placeholder"])
|
|
99
|
+
spacer: new Set(["size"])
|
|
105
100
|
};
|
|
106
101
|
export const futureLayoutProps = new Set([
|
|
107
102
|
"width",
|
|
@@ -158,6 +153,8 @@ export const layoutPropAliases = new Map([
|
|
|
158
153
|
export const nonLayoutProps = new Set([
|
|
159
154
|
"id",
|
|
160
155
|
"focusStyle",
|
|
156
|
+
"focusable",
|
|
157
|
+
"onKeyCapture",
|
|
161
158
|
"onKey",
|
|
162
159
|
"onFocusChange"
|
|
163
160
|
]);
|
package/dist/yoga-engine.js
CHANGED
|
@@ -96,9 +96,6 @@ function configureYogaElement(node, yogaNode, inheritedFlow, options) {
|
|
|
96
96
|
case "spacer":
|
|
97
97
|
configureYogaSpacer(node, yogaNode, inheritedFlow);
|
|
98
98
|
return;
|
|
99
|
-
case "button":
|
|
100
|
-
case "input":
|
|
101
|
-
throw new Error(`Unsupported layout element: ${node.tag}`);
|
|
102
99
|
}
|
|
103
100
|
}
|
|
104
101
|
function configureYogaBox(node, yogaNode) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bindtty/layout",
|
|
3
|
-
"version": "0.1.0-alpha.
|
|
3
|
+
"version": "0.1.0-alpha.4",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Layout tree generation for BindTTY mounted nodes.",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -21,14 +21,14 @@
|
|
|
21
21
|
"test": "npm run build --workspace @bindtty/text && npm run build --workspace @bindtty/vnode && npm run build --workspace @bindtty/jsx-runtime && npm run build --workspace @bindtty/runtime && npm run build && tsc -p test/tsconfig.json && node --test test/dist/*.test.js"
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@bindtty/text": "0.1.0-alpha.
|
|
25
|
-
"@bindtty/vnode": "0.1.0-alpha.
|
|
24
|
+
"@bindtty/text": "0.1.0-alpha.4",
|
|
25
|
+
"@bindtty/vnode": "0.1.0-alpha.4",
|
|
26
26
|
"yoga-layout": "3.2.1"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
|
-
"@bindtty/jsx-runtime": "0.1.0-alpha.
|
|
30
|
-
"@bindtty/runtime": "0.1.0-alpha.
|
|
31
|
-
"@bindtty/signal": "0.1.0-alpha.
|
|
29
|
+
"@bindtty/jsx-runtime": "0.1.0-alpha.4",
|
|
30
|
+
"@bindtty/runtime": "0.1.0-alpha.4",
|
|
31
|
+
"@bindtty/signal": "0.1.0-alpha.4",
|
|
32
32
|
"@types/node": "^22.0.0",
|
|
33
33
|
"typescript": "^5.5.0"
|
|
34
34
|
},
|