flexily 0.2.0 → 0.3.0
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 +14 -16
- package/dist/classic/layout.d.ts.map +1 -1
- package/dist/classic/layout.js +10 -1
- package/dist/classic/layout.js.map +1 -1
- package/dist/classic/node.js +1 -1
- package/dist/constants.d.ts +1 -0
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +2 -1
- package/dist/constants.js.map +1 -1
- package/dist/index-classic.d.ts +1 -1
- package/dist/index-classic.d.ts.map +1 -1
- package/dist/index-classic.js +5 -5
- package/dist/index-classic.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/dist/layout-helpers.d.ts +1 -4
- package/dist/layout-helpers.d.ts.map +1 -1
- package/dist/layout-helpers.js +2 -7
- package/dist/layout-helpers.js.map +1 -1
- package/dist/layout-zero.js +195 -39
- package/dist/layout-zero.js.map +1 -1
- package/dist/logger.js +2 -2
- package/dist/logger.js.map +1 -1
- package/dist/node-zero.js +1 -1
- package/dist/testing.js +4 -4
- package/dist/trace.js +1 -1
- package/dist/types.js +2 -2
- package/dist/types.js.map +1 -1
- package/dist/utils.d.ts +11 -3
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +46 -21
- package/dist/utils.js.map +1 -1
- package/package.json +11 -3
- package/src/CLAUDE.md +36 -21
- package/src/classic/layout.ts +105 -45
- package/src/classic/node.ts +60 -0
- package/src/constants.ts +2 -1
- package/src/index-classic.ts +1 -1
- package/src/index.ts +1 -1
- package/src/layout-flex-lines.ts +70 -3
- package/src/layout-helpers.ts +27 -7
- package/src/layout-stats.ts +0 -2
- package/src/layout-zero.ts +587 -160
- package/src/node-zero.ts +98 -2
- package/src/testing.ts +20 -14
- package/src/types.ts +22 -15
- package/src/utils.ts +47 -21
package/src/layout-helpers.ts
CHANGED
|
@@ -9,13 +9,8 @@ import * as C from "./constants.js"
|
|
|
9
9
|
import type { Value } from "./types.js"
|
|
10
10
|
import { resolveValue } from "./utils.js"
|
|
11
11
|
|
|
12
|
-
//
|
|
13
|
-
|
|
14
|
-
// ============================================================================
|
|
15
|
-
export const EDGE_LEFT = 0
|
|
16
|
-
export const EDGE_TOP = 1
|
|
17
|
-
export const EDGE_RIGHT = 2
|
|
18
|
-
export const EDGE_BOTTOM = 3
|
|
12
|
+
// Re-export edge constants (canonical definitions in constants.ts)
|
|
13
|
+
export { EDGE_LEFT, EDGE_TOP, EDGE_RIGHT, EDGE_BOTTOM } from "./constants.js"
|
|
19
14
|
|
|
20
15
|
// ============================================================================
|
|
21
16
|
// Helper Functions
|
|
@@ -119,6 +114,31 @@ export function isEdgeAuto(
|
|
|
119
114
|
* - LTR: START->left, END->right
|
|
120
115
|
* - RTL: START->right, END->left
|
|
121
116
|
*/
|
|
117
|
+
/**
|
|
118
|
+
* Resolve logical (START/END) position edges to physical values.
|
|
119
|
+
* Returns the resolved Value for a physical position index, considering
|
|
120
|
+
* logical EDGE_START/EDGE_END. Logical takes precedence over physical.
|
|
121
|
+
*
|
|
122
|
+
* EDGE_START/EDGE_END always resolve along the inline (horizontal) axis:
|
|
123
|
+
* - LTR: START->left, END->right
|
|
124
|
+
* - RTL: START->right, END->left
|
|
125
|
+
*/
|
|
126
|
+
export function resolvePositionEdge(
|
|
127
|
+
arr: [Value, Value, Value, Value, Value, Value],
|
|
128
|
+
physicalIndex: number, // 0=left, 1=top, 2=right, 3=bottom
|
|
129
|
+
direction: number = C.DIRECTION_LTR,
|
|
130
|
+
): Value {
|
|
131
|
+
const logicalValue = getLogicalEdgeValue(arr, physicalIndex, 0 /* unused */, direction)
|
|
132
|
+
|
|
133
|
+
// Logical takes precedence if defined
|
|
134
|
+
if (logicalValue && logicalValue.unit !== C.UNIT_UNDEFINED) {
|
|
135
|
+
return logicalValue
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
// Fall back to physical
|
|
139
|
+
return arr[physicalIndex]!
|
|
140
|
+
}
|
|
141
|
+
|
|
122
142
|
export function resolveEdgeBorderValue(
|
|
123
143
|
arr: [number, number, number, number, number, number],
|
|
124
144
|
physicalIndex: number, // 0=left, 1=top, 2=right, 3=bottom
|
package/src/layout-stats.ts
CHANGED
|
@@ -8,7 +8,6 @@
|
|
|
8
8
|
// Layout statistics for debugging
|
|
9
9
|
export let layoutNodeCalls = 0
|
|
10
10
|
export let measureNodeCalls = 0
|
|
11
|
-
export let resolveEdgeCalls = 0
|
|
12
11
|
export let layoutSizingCalls = 0 // Calls for intrinsic sizing (offset=0,0)
|
|
13
12
|
export let layoutPositioningCalls = 0 // Calls for final positioning
|
|
14
13
|
export let layoutCacheHits = 0
|
|
@@ -16,7 +15,6 @@ export let layoutCacheHits = 0
|
|
|
16
15
|
export function resetLayoutStats(): void {
|
|
17
16
|
layoutNodeCalls = 0
|
|
18
17
|
measureNodeCalls = 0
|
|
19
|
-
resolveEdgeCalls = 0
|
|
20
18
|
layoutSizingCalls = 0
|
|
21
19
|
layoutPositioningCalls = 0
|
|
22
20
|
layoutCacheHits = 0
|