flexily 0.3.0 → 0.3.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/README.md +2 -0
- package/package.json +16 -24
- package/src/classic/layout.ts +2 -2
- package/src/layout-helpers.ts +2 -2
- package/dist/classic/layout.d.ts +0 -57
- package/dist/classic/layout.d.ts.map +0 -1
- package/dist/classic/layout.js +0 -1567
- package/dist/classic/layout.js.map +0 -1
- package/dist/classic/node.d.ts +0 -648
- package/dist/classic/node.d.ts.map +0 -1
- package/dist/classic/node.js +0 -1002
- package/dist/classic/node.js.map +0 -1
- package/dist/constants.d.ts +0 -59
- package/dist/constants.d.ts.map +0 -1
- package/dist/constants.js +0 -71
- package/dist/constants.js.map +0 -1
- package/dist/index-classic.d.ts +0 -30
- package/dist/index-classic.d.ts.map +0 -1
- package/dist/index-classic.js +0 -57
- package/dist/index-classic.js.map +0 -1
- package/dist/index.d.ts +0 -30
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -57
- package/dist/index.js.map +0 -1
- package/dist/layout-flex-lines.d.ts +0 -77
- package/dist/layout-flex-lines.d.ts.map +0 -1
- package/dist/layout-flex-lines.js +0 -317
- package/dist/layout-flex-lines.js.map +0 -1
- package/dist/layout-helpers.d.ts +0 -45
- package/dist/layout-helpers.d.ts.map +0 -1
- package/dist/layout-helpers.js +0 -103
- package/dist/layout-helpers.js.map +0 -1
- package/dist/layout-measure.d.ts +0 -25
- package/dist/layout-measure.d.ts.map +0 -1
- package/dist/layout-measure.js +0 -231
- package/dist/layout-measure.js.map +0 -1
- package/dist/layout-stats.d.ts +0 -19
- package/dist/layout-stats.d.ts.map +0 -1
- package/dist/layout-stats.js +0 -37
- package/dist/layout-stats.js.map +0 -1
- package/dist/layout-traversal.d.ts +0 -28
- package/dist/layout-traversal.d.ts.map +0 -1
- package/dist/layout-traversal.js +0 -65
- package/dist/layout-traversal.js.map +0 -1
- package/dist/layout-zero.d.ts +0 -26
- package/dist/layout-zero.d.ts.map +0 -1
- package/dist/layout-zero.js +0 -1757
- package/dist/layout-zero.js.map +0 -1
- package/dist/logger.d.ts +0 -14
- package/dist/logger.d.ts.map +0 -1
- package/dist/logger.js +0 -61
- package/dist/logger.js.map +0 -1
- package/dist/node-zero.d.ts +0 -702
- package/dist/node-zero.d.ts.map +0 -1
- package/dist/node-zero.js +0 -1268
- package/dist/node-zero.js.map +0 -1
- package/dist/testing.d.ts +0 -69
- package/dist/testing.d.ts.map +0 -1
- package/dist/testing.js +0 -179
- package/dist/testing.js.map +0 -1
- package/dist/trace.d.ts +0 -74
- package/dist/trace.d.ts.map +0 -1
- package/dist/trace.js +0 -191
- package/dist/trace.js.map +0 -1
- package/dist/types.d.ts +0 -170
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js +0 -43
- package/dist/types.js.map +0 -1
- package/dist/utils.d.ts +0 -49
- package/dist/utils.d.ts.map +0 -1
- package/dist/utils.js +0 -222
- package/dist/utils.js.map +0 -1
- package/src/beorn-logger.d.ts +0 -10
package/README.md
CHANGED
|
@@ -71,6 +71,8 @@ Most developers should use a framework built on Flexily, not Flexily directly. F
|
|
|
71
71
|
npm install flexily
|
|
72
72
|
```
|
|
73
73
|
|
|
74
|
+
**Runtimes:** Bun >= 1.0, Node.js >= 18. Pure JavaScript — no native or WASM dependencies.
|
|
75
|
+
|
|
74
76
|
## Performance
|
|
75
77
|
|
|
76
78
|
Flexily and Yoga each win in different scenarios:
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "flexily",
|
|
3
|
-
"version": "0.3.
|
|
4
|
-
"description": "Pure JavaScript flexbox layout engine
|
|
3
|
+
"version": "0.3.1",
|
|
4
|
+
"description": "Pure JavaScript flexbox layout engine \u2014 Yoga-compatible API, faster initial layout, smaller bundle, no WASM",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"canvas-ui",
|
|
7
7
|
"css",
|
|
@@ -28,20 +28,19 @@
|
|
|
28
28
|
"url": "https://github.com/beorn/flexily.git"
|
|
29
29
|
},
|
|
30
30
|
"files": [
|
|
31
|
-
"dist",
|
|
32
31
|
"src"
|
|
33
32
|
],
|
|
34
33
|
"type": "module",
|
|
35
|
-
"main": "./
|
|
36
|
-
"types": "./
|
|
34
|
+
"main": "./src/index.ts",
|
|
35
|
+
"types": "./src/index.ts",
|
|
37
36
|
"exports": {
|
|
38
37
|
".": {
|
|
39
|
-
"types": "./
|
|
40
|
-
"import": "./
|
|
38
|
+
"types": "./src/index.ts",
|
|
39
|
+
"import": "./src/index.ts"
|
|
41
40
|
},
|
|
42
41
|
"./classic": {
|
|
43
|
-
"types": "./
|
|
44
|
-
"import": "./
|
|
42
|
+
"types": "./src/classic/index.ts",
|
|
43
|
+
"import": "./src/classic/index.ts"
|
|
45
44
|
}
|
|
46
45
|
},
|
|
47
46
|
"publishConfig": {
|
|
@@ -52,25 +51,18 @@
|
|
|
52
51
|
"test": "bun test",
|
|
53
52
|
"test:watch": "bun test --watch",
|
|
54
53
|
"bench": "bunx --bun vitest bench",
|
|
55
|
-
"bench:standalone": "bun bench/run.ts",
|
|
56
|
-
"bench:compare": "bun bench/compare.ts",
|
|
57
54
|
"typecheck": "tsc --noEmit",
|
|
58
|
-
"
|
|
59
|
-
"
|
|
60
|
-
"
|
|
61
|
-
},
|
|
62
|
-
"dependencies": {
|
|
63
|
-
"debug": "^4.4.3"
|
|
55
|
+
"docs:dev": "vitepress dev docs",
|
|
56
|
+
"docs:build": "vitepress build docs",
|
|
57
|
+
"docs:preview": "vitepress preview docs"
|
|
64
58
|
},
|
|
65
59
|
"devDependencies": {
|
|
66
|
-
"
|
|
67
|
-
"
|
|
68
|
-
"
|
|
69
|
-
"typescript": "^5.7.3",
|
|
60
|
+
"typescript": "^5.9.3",
|
|
61
|
+
"vitepress": "^1.6.3",
|
|
62
|
+
"vitest": "^3.1.0",
|
|
70
63
|
"yoga-wasm-web": "^0.3.3"
|
|
71
64
|
},
|
|
72
65
|
"engines": {
|
|
73
|
-
"
|
|
74
|
-
"node": ">=18"
|
|
66
|
+
"node": ">=23.6.0"
|
|
75
67
|
}
|
|
76
|
-
}
|
|
68
|
+
}
|
package/src/classic/layout.ts
CHANGED
|
@@ -123,9 +123,9 @@ export function resolveEdgeBorderValue(
|
|
|
123
123
|
|
|
124
124
|
// Logical takes precedence if set (NaN = not set)
|
|
125
125
|
if (logicalSlot !== undefined && !Number.isNaN(arr[logicalSlot])) {
|
|
126
|
-
return arr[logicalSlot]
|
|
126
|
+
return arr[logicalSlot]!
|
|
127
127
|
}
|
|
128
|
-
return arr[physicalIndex]
|
|
128
|
+
return arr[physicalIndex]!
|
|
129
129
|
}
|
|
130
130
|
|
|
131
131
|
export function markSubtreeLayoutSeen(node: Node): void {
|
package/src/layout-helpers.ts
CHANGED
|
@@ -154,7 +154,7 @@ export function resolveEdgeBorderValue(
|
|
|
154
154
|
|
|
155
155
|
// Logical takes precedence if set (NaN = not set)
|
|
156
156
|
if (logicalSlot !== undefined && !Number.isNaN(arr[logicalSlot])) {
|
|
157
|
-
return arr[logicalSlot]
|
|
157
|
+
return arr[logicalSlot]!
|
|
158
158
|
}
|
|
159
|
-
return arr[physicalIndex]
|
|
159
|
+
return arr[physicalIndex]!
|
|
160
160
|
}
|
package/dist/classic/layout.d.ts
DELETED
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Flexily Layout Algorithm
|
|
3
|
-
*
|
|
4
|
-
* Core flexbox layout computation extracted from node.ts.
|
|
5
|
-
* Based on Planning-nl/flexbox.js reference implementation.
|
|
6
|
-
*/
|
|
7
|
-
import type { Node } from "./node.js";
|
|
8
|
-
import type { Value } from "../types.js";
|
|
9
|
-
/**
|
|
10
|
-
* Check if flex direction is row-oriented (horizontal main axis).
|
|
11
|
-
*/
|
|
12
|
-
export declare function isRowDirection(flexDirection: number): boolean;
|
|
13
|
-
/**
|
|
14
|
-
* Check if flex direction is reversed.
|
|
15
|
-
*/
|
|
16
|
-
export declare function isReverseDirection(flexDirection: number): boolean;
|
|
17
|
-
/**
|
|
18
|
-
* Resolve logical (START/END) margins/padding to physical values.
|
|
19
|
-
* EDGE_START/EDGE_END always resolve along the inline (horizontal) axis:
|
|
20
|
-
* - LTR: START→left, END→right
|
|
21
|
-
* - RTL: START→right, END→left
|
|
22
|
-
*
|
|
23
|
-
* Physical edges (LEFT/RIGHT/TOP/BOTTOM) are used directly.
|
|
24
|
-
* When both physical and logical are set, logical takes precedence.
|
|
25
|
-
*/
|
|
26
|
-
export declare function resolveEdgeValue(arr: [Value, Value, Value, Value, Value, Value], physicalIndex: number, // 0=left, 1=top, 2=right, 3=bottom
|
|
27
|
-
flexDirection: number, availableSize: number, direction?: number): number;
|
|
28
|
-
/**
|
|
29
|
-
* Check if a logical edge margin is set to auto.
|
|
30
|
-
*/
|
|
31
|
-
export declare function isEdgeAuto(arr: [Value, Value, Value, Value, Value, Value], physicalIndex: number, flexDirection: number, direction?: number): boolean;
|
|
32
|
-
/**
|
|
33
|
-
* Resolve logical (START/END) border widths to physical values.
|
|
34
|
-
* Border values are plain numbers (always points), so resolution is simpler
|
|
35
|
-
* than for margin/padding. Uses NaN as the "not set" sentinel for logical slots.
|
|
36
|
-
* When both physical and logical are set, logical takes precedence.
|
|
37
|
-
*/
|
|
38
|
-
export declare function resolveEdgeBorderValue(arr: [number, number, number, number, number, number], physicalIndex: number, // 0=left, 1=top, 2=right, 3=bottom
|
|
39
|
-
_flexDirection: number, direction?: number): number;
|
|
40
|
-
export declare function markSubtreeLayoutSeen(node: Node): void;
|
|
41
|
-
export declare function countNodes(node: Node): number;
|
|
42
|
-
/**
|
|
43
|
-
* Compute layout for a node tree.
|
|
44
|
-
*
|
|
45
|
-
* @param root - Root node of the tree
|
|
46
|
-
* @param availableWidth - Available width for layout
|
|
47
|
-
* @param availableHeight - Available height for layout
|
|
48
|
-
* @param direction - Text direction (LTR or RTL), affects horizontal edge resolution
|
|
49
|
-
*/
|
|
50
|
-
export declare function computeLayout(root: Node, availableWidth: number, availableHeight: number, direction?: number): void;
|
|
51
|
-
export declare let layoutNodeCalls: number;
|
|
52
|
-
export declare let resolveEdgeCalls: number;
|
|
53
|
-
export declare let layoutSizingCalls: number;
|
|
54
|
-
export declare let layoutPositioningCalls: number;
|
|
55
|
-
export declare let layoutCacheHits: number;
|
|
56
|
-
export declare function resetLayoutStats(): void;
|
|
57
|
-
//# sourceMappingURL=layout.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"layout.d.ts","sourceRoot":"","sources":["../../src/classic/layout.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AACrC,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,aAAa,CAAA;AAQxC;;GAEG;AACH,wBAAgB,cAAc,CAAC,aAAa,EAAE,MAAM,GAAG,OAAO,CAE7D;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,aAAa,EAAE,MAAM,GAAG,OAAO,CAEjE;AA4BD;;;;;;;;GAQG;AACH,wBAAgB,gBAAgB,CAC9B,GAAG,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC,EAC/C,aAAa,EAAE,MAAM,EAAE,mCAAmC;AAC1D,aAAa,EAAE,MAAM,EACrB,aAAa,EAAE,MAAM,EACrB,SAAS,GAAE,MAAwB,GAClC,MAAM,CAUR;AAED;;GAEG;AACH,wBAAgB,UAAU,CACxB,GAAG,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC,EAC/C,aAAa,EAAE,MAAM,EACrB,aAAa,EAAE,MAAM,EACrB,SAAS,GAAE,MAAwB,GAClC,OAAO,CAUT;AAED;;;;;GAKG;AACH,wBAAgB,sBAAsB,CACpC,GAAG,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EACrD,aAAa,EAAE,MAAM,EAAE,mCAAmC;AAC1D,cAAc,EAAE,MAAM,EACtB,SAAS,GAAE,MAAwB,GAClC,MAAM,CAaR;AAED,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI,CAKtD;AAED,wBAAgB,UAAU,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM,CAM7C;AA6OD;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAC3B,IAAI,EAAE,IAAI,EACV,cAAc,EAAE,MAAM,EACtB,eAAe,EAAE,MAAM,EACvB,SAAS,GAAE,MAAwB,GAClC,IAAI,CAGN;AAw2CD,eAAO,IAAI,eAAe,QAAI,CAAA;AAC9B,eAAO,IAAI,gBAAgB,QAAI,CAAA;AAC/B,eAAO,IAAI,iBAAiB,QAAI,CAAA;AAChC,eAAO,IAAI,sBAAsB,QAAI,CAAA;AACrC,eAAO,IAAI,eAAe,QAAI,CAAA;AAE9B,wBAAgB,gBAAgB,IAAI,IAAI,CAMvC"}
|