flexily 0.3.0 → 0.3.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.
Files changed (73) hide show
  1. package/README.md +2 -0
  2. package/package.json +14 -22
  3. package/src/classic/layout.ts +2 -2
  4. package/src/layout-helpers.ts +2 -2
  5. package/dist/classic/layout.d.ts +0 -57
  6. package/dist/classic/layout.d.ts.map +0 -1
  7. package/dist/classic/layout.js +0 -1567
  8. package/dist/classic/layout.js.map +0 -1
  9. package/dist/classic/node.d.ts +0 -648
  10. package/dist/classic/node.d.ts.map +0 -1
  11. package/dist/classic/node.js +0 -1002
  12. package/dist/classic/node.js.map +0 -1
  13. package/dist/constants.d.ts +0 -59
  14. package/dist/constants.d.ts.map +0 -1
  15. package/dist/constants.js +0 -71
  16. package/dist/constants.js.map +0 -1
  17. package/dist/index-classic.d.ts +0 -30
  18. package/dist/index-classic.d.ts.map +0 -1
  19. package/dist/index-classic.js +0 -57
  20. package/dist/index-classic.js.map +0 -1
  21. package/dist/index.d.ts +0 -30
  22. package/dist/index.d.ts.map +0 -1
  23. package/dist/index.js +0 -57
  24. package/dist/index.js.map +0 -1
  25. package/dist/layout-flex-lines.d.ts +0 -77
  26. package/dist/layout-flex-lines.d.ts.map +0 -1
  27. package/dist/layout-flex-lines.js +0 -317
  28. package/dist/layout-flex-lines.js.map +0 -1
  29. package/dist/layout-helpers.d.ts +0 -45
  30. package/dist/layout-helpers.d.ts.map +0 -1
  31. package/dist/layout-helpers.js +0 -103
  32. package/dist/layout-helpers.js.map +0 -1
  33. package/dist/layout-measure.d.ts +0 -25
  34. package/dist/layout-measure.d.ts.map +0 -1
  35. package/dist/layout-measure.js +0 -231
  36. package/dist/layout-measure.js.map +0 -1
  37. package/dist/layout-stats.d.ts +0 -19
  38. package/dist/layout-stats.d.ts.map +0 -1
  39. package/dist/layout-stats.js +0 -37
  40. package/dist/layout-stats.js.map +0 -1
  41. package/dist/layout-traversal.d.ts +0 -28
  42. package/dist/layout-traversal.d.ts.map +0 -1
  43. package/dist/layout-traversal.js +0 -65
  44. package/dist/layout-traversal.js.map +0 -1
  45. package/dist/layout-zero.d.ts +0 -26
  46. package/dist/layout-zero.d.ts.map +0 -1
  47. package/dist/layout-zero.js +0 -1757
  48. package/dist/layout-zero.js.map +0 -1
  49. package/dist/logger.d.ts +0 -14
  50. package/dist/logger.d.ts.map +0 -1
  51. package/dist/logger.js +0 -61
  52. package/dist/logger.js.map +0 -1
  53. package/dist/node-zero.d.ts +0 -702
  54. package/dist/node-zero.d.ts.map +0 -1
  55. package/dist/node-zero.js +0 -1268
  56. package/dist/node-zero.js.map +0 -1
  57. package/dist/testing.d.ts +0 -69
  58. package/dist/testing.d.ts.map +0 -1
  59. package/dist/testing.js +0 -179
  60. package/dist/testing.js.map +0 -1
  61. package/dist/trace.d.ts +0 -74
  62. package/dist/trace.d.ts.map +0 -1
  63. package/dist/trace.js +0 -191
  64. package/dist/trace.js.map +0 -1
  65. package/dist/types.d.ts +0 -170
  66. package/dist/types.d.ts.map +0 -1
  67. package/dist/types.js +0 -43
  68. package/dist/types.js.map +0 -1
  69. package/dist/utils.d.ts +0 -49
  70. package/dist/utils.d.ts.map +0 -1
  71. package/dist/utils.js +0 -222
  72. package/dist/utils.js.map +0 -1
  73. package/src/beorn-logger.d.ts +0 -10
package/dist/types.d.ts DELETED
@@ -1,170 +0,0 @@
1
- /**
2
- * Flexily Types
3
- *
4
- * TypeScript interfaces for the flexbox layout engine.
5
- */
6
- /**
7
- * A value with a unit (point, percent, or auto).
8
- */
9
- export interface Value {
10
- value: number;
11
- unit: number;
12
- }
13
- /**
14
- * Measure function signature for intrinsic sizing.
15
- * Called by the layout algorithm to determine a node's natural size.
16
- */
17
- export type MeasureFunc = (width: number, widthMode: number, height: number, heightMode: number) => {
18
- width: number;
19
- height: number;
20
- };
21
- /**
22
- * Baseline function signature for baseline alignment.
23
- * Called by the layout algorithm to determine a node's baseline offset from its top edge.
24
- * Used with ALIGN_BASELINE to align text baselines across siblings.
25
- *
26
- * @param width - The computed width of the node
27
- * @param height - The computed height of the node
28
- * @returns The baseline offset from the top of the node (in points)
29
- */
30
- export type BaselineFunc = (width: number, height: number) => number;
31
- /**
32
- * Cache entry for measure results.
33
- * Stores input constraints (w, wm, h, hm) and output (rw, rh).
34
- */
35
- export interface MeasureEntry {
36
- w: number;
37
- wm: number;
38
- h: number;
39
- hm: number;
40
- rw: number;
41
- rh: number;
42
- }
43
- /**
44
- * Cache entry for layout results.
45
- * Stores input available dimensions and computed size.
46
- * Used to avoid redundant recursive layout calls during a single pass.
47
- */
48
- export interface LayoutCacheEntry {
49
- availW: number;
50
- availH: number;
51
- computedW: number;
52
- computedH: number;
53
- }
54
- /**
55
- * Per-node flex calculation state for zero-allocation layout.
56
- *
57
- * This interface enables the layout engine to avoid heap allocations during
58
- * layout passes by storing all intermediate calculation state directly on
59
- * each Node. Fields are mutated (not recreated) each pass.
60
- *
61
- * Design rationale:
62
- * - Eliminates ChildLayout object allocation (previously created per child per pass)
63
- * - Enables filtered iteration via relativeIndex (avoids temporary array allocation)
64
- * - Stores line membership for flex-wrap (avoids FlexLine[] allocation)
65
- *
66
- * All numeric fields use number (Float64 in V8) for precision. Boolean fields
67
- * track state that affects the CSS Flexbox algorithm's iterative distribution.
68
- *
69
- * @see layout.ts for usage in layoutNode() and distributeFlexSpaceForLine()
70
- */
71
- export interface FlexInfo {
72
- /** Computed main-axis size after flex distribution */
73
- mainSize: number;
74
- /** Original base size before flex distribution (used for weighted shrink) */
75
- baseSize: number;
76
- /** Total main-axis margin (non-auto margins only) */
77
- mainMargin: number;
78
- /** flex-grow factor from style */
79
- flexGrow: number;
80
- /** flex-shrink factor from style */
81
- flexShrink: number;
82
- /** Resolved min-width/height constraint on main axis */
83
- minMain: number;
84
- /** Resolved max-width/height constraint on main axis (Infinity if none) */
85
- maxMain: number;
86
- /** Whether main-start margin is auto (absorbs free space) */
87
- mainStartMarginAuto: boolean;
88
- /** Whether main-end margin is auto (absorbs free space) */
89
- mainEndMarginAuto: boolean;
90
- /** Resolved main-start margin value (0 if auto, computed later) */
91
- mainStartMarginValue: number;
92
- /** Resolved main-end margin value (0 if auto, computed later) */
93
- mainEndMarginValue: number;
94
- /** Cached resolved margin values [left, top, right, bottom] */
95
- marginL: number;
96
- marginT: number;
97
- marginR: number;
98
- marginB: number;
99
- /** Frozen in flex distribution (clamped to min/max constraint) */
100
- frozen: boolean;
101
- /** Line index for flex-wrap (0-based, which line this child belongs to) */
102
- lineIndex: number;
103
- /**
104
- * Relative index for filtered iteration.
105
- * -1 = absolute positioned or display:none (skip in flex layout)
106
- * 0+ = index among relative children (participates in flex layout)
107
- */
108
- relativeIndex: number;
109
- /** Computed baseline offset for ALIGN_BASELINE (zero-alloc: avoids per-pass array) */
110
- baseline: number;
111
- /** Last availableWidth passed to layoutNode */
112
- lastAvailW: number;
113
- /** Last availableHeight passed to layoutNode */
114
- lastAvailH: number;
115
- /** Last offsetX passed to layoutNode */
116
- lastOffsetX: number;
117
- /** Last offsetY passed to layoutNode */
118
- lastOffsetY: number;
119
- /** Whether cached layout is valid (fingerprint matched, not dirty) */
120
- layoutValid: boolean;
121
- /** Last direction passed to layoutNode */
122
- lastDir: number;
123
- }
124
- /**
125
- * Computed layout result for a node.
126
- */
127
- export interface Layout {
128
- left: number;
129
- top: number;
130
- width: number;
131
- height: number;
132
- }
133
- /**
134
- * Internal style properties for a node.
135
- */
136
- export interface Style {
137
- display: number;
138
- positionType: number;
139
- position: [Value, Value, Value, Value, Value, Value];
140
- flexDirection: number;
141
- flexWrap: number;
142
- flexGrow: number;
143
- flexShrink: number;
144
- flexBasis: Value;
145
- alignItems: number;
146
- alignSelf: number;
147
- alignContent: number;
148
- justifyContent: number;
149
- width: Value;
150
- height: Value;
151
- minWidth: Value;
152
- minHeight: Value;
153
- maxWidth: Value;
154
- maxHeight: Value;
155
- aspectRatio: number;
156
- margin: [Value, Value, Value, Value, Value, Value];
157
- padding: [Value, Value, Value, Value, Value, Value];
158
- border: [number, number, number, number, number, number];
159
- gap: [number, number];
160
- overflow: number;
161
- }
162
- /**
163
- * Create a default Value (undefined).
164
- */
165
- export declare function createValue(value?: number, unit?: number): Value;
166
- /**
167
- * Create default style.
168
- */
169
- export declare function createDefaultStyle(): Style;
170
- //# sourceMappingURL=types.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;GAEG;AACH,MAAM,WAAW,KAAK;IACpB,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,MAAM,CAAA;CACb;AAED;;;GAGG;AACH,MAAM,MAAM,WAAW,GAAG,CACxB,KAAK,EAAE,MAAM,EACb,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,MAAM,KACf;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAA;AAEtC;;;;;;;;GAQG;AACH,MAAM,MAAM,YAAY,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,KAAK,MAAM,CAAA;AAEpE;;;GAGG;AACH,MAAM,WAAW,YAAY;IAC3B,CAAC,EAAE,MAAM,CAAA;IACT,EAAE,EAAE,MAAM,CAAA;IACV,CAAC,EAAE,MAAM,CAAA;IACT,EAAE,EAAE,MAAM,CAAA;IACV,EAAE,EAAE,MAAM,CAAA;IACV,EAAE,EAAE,MAAM,CAAA;CACX;AAED;;;;GAIG;AACH,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,EAAE,MAAM,CAAA;IACd,SAAS,EAAE,MAAM,CAAA;IACjB,SAAS,EAAE,MAAM,CAAA;CAClB;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,WAAW,QAAQ;IACvB,sDAAsD;IACtD,QAAQ,EAAE,MAAM,CAAA;IAChB,6EAA6E;IAC7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
- * Flexily Types
3
- *
4
- * TypeScript interfaces for the flexbox layout engine.
5
- */
6
- /**
7
- * Create a default Value (undefined).
8
- */
9
- export function createValue(value = 0, unit = 0) {
10
- return { value, unit };
11
- }
12
- /**
13
- * Create default style.
14
- */
15
- export function createDefaultStyle() {
16
- return {
17
- display: 0, // DISPLAY_FLEX
18
- positionType: 1, // POSITION_TYPE_RELATIVE
19
- position: [createValue(), createValue(), createValue(), createValue(), createValue(), createValue()],
20
- flexDirection: 2, // FLEX_DIRECTION_ROW (CSS default)
21
- flexWrap: 0, // WRAP_NO_WRAP
22
- flexGrow: 0,
23
- flexShrink: 0, // Yoga native default (CSS uses 1)
24
- flexBasis: createValue(0, 3), // AUTO
25
- alignItems: 4, // ALIGN_STRETCH
26
- alignSelf: 0, // ALIGN_AUTO
27
- alignContent: 1, // ALIGN_FLEX_START
28
- justifyContent: 0, // JUSTIFY_FLEX_START
29
- width: createValue(0, 3), // AUTO
30
- height: createValue(0, 3), // AUTO
31
- minWidth: createValue(),
32
- minHeight: createValue(),
33
- maxWidth: createValue(),
34
- maxHeight: createValue(),
35
- aspectRatio: NaN, // undefined by default
36
- margin: [createValue(), createValue(), createValue(), createValue(), createValue(), createValue()],
37
- padding: [createValue(), createValue(), createValue(), createValue(), createValue(), createValue()],
38
- border: [0, 0, 0, 0, NaN, NaN],
39
- gap: [0, 0],
40
- overflow: 0, // OVERFLOW_VISIBLE
41
- };
42
- }
43
- //# sourceMappingURL=types.js.map
package/dist/types.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AA2LH;;GAEG;AACH,MAAM,UAAU,WAAW,CAAC,KAAK,GAAG,CAAC,EAAE,IAAI,GAAG,CAAC;IAC7C,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,CAAA;AACxB,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,kBAAkB;IAChC,OAAO;QACL,OAAO,EAA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C,CAAC,EAAE,CAAC,CAAC;QACX,QAAQ,EAAE,CAAC,EAAE,mBAAmB;KACjC,CAAA;AACH,CAAC"}
package/dist/utils.d.ts DELETED
@@ -1,49 +0,0 @@
1
- /**
2
- * Flexily Utility Functions
3
- *
4
- * Helper functions for edge value manipulation and value resolution.
5
- */
6
- import type { Value } from "./types.js";
7
- /**
8
- * Shared traversal stack for iterative tree operations.
9
- * Avoids recursion (prevents stack overflow on deep trees) and avoids
10
- * allocation during layout passes.
11
- */
12
- export declare const traversalStack: unknown[];
13
- /**
14
- * Set a value on an edge array (supports all edge types including logical START/END).
15
- */
16
- export declare function setEdgeValue(arr: [Value, Value, Value, Value, Value, Value], edge: number, value: number, unit: number): void;
17
- /**
18
- * Set a border value on an edge array.
19
- */
20
- export declare function setEdgeBorder(arr: [number, number, number, number, number, number], edge: number, value: number): void;
21
- /**
22
- * Get a value from an edge array.
23
- */
24
- export declare function getEdgeValue(arr: [Value, Value, Value, Value, Value, Value], edge: number): Value;
25
- /**
26
- * Get a border value from an edge array.
27
- */
28
- export declare function getEdgeBorderValue(arr: [number, number, number, number, number, number], edge: number): number;
29
- /**
30
- * Resolve a value (point or percent) to an absolute number.
31
- */
32
- export declare function resolveValue(value: Value, availableSize: number): number;
33
- /**
34
- * Apply min/max constraints to a size.
35
- *
36
- * CSS behavior:
37
- * - min: Floor constraint. Does NOT affect children's layout — the container expands
38
- * after shrink-wrap. When size is NaN (auto-sized), min is NOT applied here;
39
- * the post-shrink-wrap applyMinMax call (Phase 9) handles it.
40
- * - max: Ceiling constraint. DOES affect children's layout — content wraps/clips
41
- * within the max. When size is NaN (auto-sized), max constrains the container
42
- * so children are laid out within the max bound.
43
- *
44
- * Percent constraints that can't resolve (available is NaN) are skipped entirely,
45
- * since resolveValue returns 0 for percent-against-NaN, which would incorrectly
46
- * clamp sizes to 0.
47
- */
48
- export declare function applyMinMax(size: number, min: Value, max: Value, available: number): number;
49
- //# sourceMappingURL=utils.d.ts.map
@@ -1 +0,0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/dist/utils.js DELETED
@@ -1,222 +0,0 @@
1
- /**
2
- * Flexily Utility Functions
3
- *
4
- * Helper functions for edge value manipulation and value resolution.
5
- */
6
- import * as C from "./constants.js";
7
- // ============================================================================
8
- // Shared Traversal Stack
9
- // ============================================================================
10
- // Pre-allocated stack array for iterative tree traversal. Shared across all
11
- // layout functions to avoid multiple allocations. Using a single stack is safe
12
- // because layout operations are synchronous (no concurrent traversals).
13
- /**
14
- * Shared traversal stack for iterative tree operations.
15
- * Avoids recursion (prevents stack overflow on deep trees) and avoids
16
- * allocation during layout passes.
17
- */
18
- export const traversalStack = [];
19
- /**
20
- * Set a value on an edge array (supports all edge types including logical START/END).
21
- */
22
- export function setEdgeValue(arr, edge, value, unit) {
23
- const v = { value, unit };
24
- switch (edge) {
25
- case C.EDGE_LEFT:
26
- arr[0] = v;
27
- break;
28
- case C.EDGE_TOP:
29
- arr[1] = v;
30
- break;
31
- case C.EDGE_RIGHT:
32
- arr[2] = v;
33
- break;
34
- case C.EDGE_BOTTOM:
35
- arr[3] = v;
36
- break;
37
- case C.EDGE_HORIZONTAL:
38
- arr[0] = v;
39
- arr[2] = v;
40
- break;
41
- case C.EDGE_VERTICAL:
42
- arr[1] = v;
43
- arr[3] = v;
44
- break;
45
- case C.EDGE_ALL:
46
- arr[0] = v;
47
- arr[1] = v;
48
- arr[2] = v;
49
- arr[3] = v;
50
- break;
51
- case C.EDGE_START:
52
- // Store in logical START slot (resolved to physical at layout time)
53
- arr[4] = v;
54
- break;
55
- case C.EDGE_END:
56
- // Store in logical END slot (resolved to physical at layout time)
57
- arr[5] = v;
58
- break;
59
- }
60
- }
61
- /**
62
- * Set a border value on an edge array.
63
- */
64
- export function setEdgeBorder(arr, edge, value) {
65
- switch (edge) {
66
- case C.EDGE_LEFT:
67
- arr[0] = value;
68
- break;
69
- case C.EDGE_TOP:
70
- arr[1] = value;
71
- break;
72
- case C.EDGE_RIGHT:
73
- arr[2] = value;
74
- break;
75
- case C.EDGE_BOTTOM:
76
- arr[3] = value;
77
- break;
78
- case C.EDGE_HORIZONTAL:
79
- arr[0] = value;
80
- arr[2] = value;
81
- break;
82
- case C.EDGE_VERTICAL:
83
- arr[1] = value;
84
- arr[3] = value;
85
- break;
86
- case C.EDGE_ALL:
87
- arr[0] = value;
88
- arr[1] = value;
89
- arr[2] = value;
90
- arr[3] = value;
91
- break;
92
- case C.EDGE_START:
93
- // Store in logical START slot (resolved to physical at layout time)
94
- arr[4] = value;
95
- break;
96
- case C.EDGE_END:
97
- // Store in logical END slot (resolved to physical at layout time)
98
- arr[5] = value;
99
- break;
100
- }
101
- }
102
- /**
103
- * Get a value from an edge array.
104
- */
105
- export function getEdgeValue(arr, edge) {
106
- switch (edge) {
107
- case C.EDGE_LEFT:
108
- return arr[0];
109
- case C.EDGE_TOP:
110
- return arr[1];
111
- case C.EDGE_RIGHT:
112
- return arr[2];
113
- case C.EDGE_BOTTOM:
114
- return arr[3];
115
- case C.EDGE_START:
116
- return arr[4];
117
- case C.EDGE_END:
118
- return arr[5];
119
- default:
120
- return arr[0]; // Default to left
121
- }
122
- }
123
- /**
124
- * Get a border value from an edge array.
125
- */
126
- export function getEdgeBorderValue(arr, edge) {
127
- switch (edge) {
128
- case C.EDGE_LEFT:
129
- return arr[0];
130
- case C.EDGE_TOP:
131
- return arr[1];
132
- case C.EDGE_RIGHT:
133
- return arr[2];
134
- case C.EDGE_BOTTOM:
135
- return arr[3];
136
- case C.EDGE_START:
137
- return arr[4];
138
- case C.EDGE_END:
139
- return arr[5];
140
- default:
141
- return arr[0]; // Default to left
142
- }
143
- }
144
- /**
145
- * Resolve a value (point or percent) to an absolute number.
146
- */
147
- export function resolveValue(value, availableSize) {
148
- switch (value.unit) {
149
- case C.UNIT_POINT:
150
- return value.value;
151
- case C.UNIT_PERCENT:
152
- // Percentage against NaN (auto-sized parent) resolves to 0
153
- if (Number.isNaN(availableSize)) {
154
- return 0;
155
- }
156
- return availableSize * (value.value / 100);
157
- default:
158
- return 0;
159
- }
160
- }
161
- /**
162
- * Apply min/max constraints to a size.
163
- *
164
- * CSS behavior:
165
- * - min: Floor constraint. Does NOT affect children's layout — the container expands
166
- * after shrink-wrap. When size is NaN (auto-sized), min is NOT applied here;
167
- * the post-shrink-wrap applyMinMax call (Phase 9) handles it.
168
- * - max: Ceiling constraint. DOES affect children's layout — content wraps/clips
169
- * within the max. When size is NaN (auto-sized), max constrains the container
170
- * so children are laid out within the max bound.
171
- *
172
- * Percent constraints that can't resolve (available is NaN) are skipped entirely,
173
- * since resolveValue returns 0 for percent-against-NaN, which would incorrectly
174
- * clamp sizes to 0.
175
- */
176
- export function applyMinMax(size, min, max, available) {
177
- let result = size;
178
- if (min.unit !== C.UNIT_UNDEFINED) {
179
- // Skip percent min when available is NaN — can't resolve meaningfully
180
- if (min.unit === C.UNIT_PERCENT && Number.isNaN(available)) {
181
- // Skip: percent against NaN resolves to 0, which would be wrong
182
- }
183
- else {
184
- const minValue = resolveValue(min, available);
185
- if (!Number.isNaN(minValue)) {
186
- // Only apply min to definite sizes. When size is NaN (auto-sized),
187
- // skip — the post-shrink-wrap applyMinMax call will floor it.
188
- if (!Number.isNaN(result)) {
189
- result = Math.max(result, minValue);
190
- }
191
- }
192
- }
193
- }
194
- if (max.unit !== C.UNIT_UNDEFINED) {
195
- // Skip percent max when available is NaN — can't resolve meaningfully
196
- if (max.unit === C.UNIT_PERCENT && Number.isNaN(available)) {
197
- // Skip: percent against NaN resolves to 0, which would be wrong
198
- }
199
- else {
200
- const maxValue = resolveValue(max, available);
201
- if (!Number.isNaN(maxValue)) {
202
- // Apply max as ceiling even when size is NaN (auto-sized).
203
- // This constrains children's layout to the max bound.
204
- // Phase 9 shrink-wrap may reduce it further; the post-shrink-wrap
205
- // applyMinMax call ensures max is still respected.
206
- if (Number.isNaN(result)) {
207
- // For auto-sized nodes, only apply finite max constraints.
208
- // Infinity means "no real constraint" (e.g., silvery sets
209
- // maxWidth=Infinity as default) and should not replace NaN.
210
- if (maxValue !== Infinity) {
211
- result = maxValue;
212
- }
213
- }
214
- else {
215
- result = Math.min(result, maxValue);
216
- }
217
- }
218
- }
219
- }
220
- return result;
221
- }
222
- //# sourceMappingURL=utils.js.map
package/dist/utils.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,CAAC,MAAM,gBAAgB,CAAA;AAGnC,+EAA+E;AAC/E,yBAAyB;AACzB,+EAA+E;AAC/E,4EAA4E;AAC5E,+EAA+E;AAC/E,wEAAwE;AAExE;;;;GAIG;AACH,MAAM,CAAC,MAAM,cAAc,GAAc,EAAE,CAAA;AAE3C;;GAEG;AACH,MAAM,UAAU,YAAY,CAC1B,GAA+C,EAC/C,IAAY,EACZ,KAAa,EACb,IAAY;IAEZ,MAAM,CAAC,GAAG,EAAE,KAAK,EAAE,IAAI,EAAE,CAAA;IACzB,QAAQ,IAAI,EAAE,CAAC;QACb,KAAK,CAAC,CAAC,SAAS;YACd,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAA;YACV,MAAK;QACP,KAAK,CAAC,CAAC,QAAQ;YACb,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAA;YACV,MAAK;QACP,KAAK,CAAC,CAAC,UAAU;YACf,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAA;YACV,MAAK;QACP,KAAK,CAAC,CAAC,WAAW;YAChB,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAA;YACV,MAAK;QACP,KAAK,CAAC,CAAC,eAAe;YACpB,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAA;YACV,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAA;YACV,MAAK;QACP,KAAK,CAAC,CAAC,aAAa;YAClB,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAA;YACV,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAA;YACV,MAAK;QACP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IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,EAAE,CAAC;gBAC5B,mEAAmE;gBACnE,8DAA8D;gBAC9D,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC;oBAC1B,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAA;gBACrC,CAAC;YACH,CAAC;QACH,CAAC;IACH,CAAC;IAED,IAAI,GAAG,CAAC,IAAI,KAAK,CAAC,CAAC,cAAc,EAAE,CAAC;QAClC,sEAAsE;QACtE,IAAI,GAAG,CAAC,IAAI,KAAK,CAAC,CAAC,YAAY,IAAI,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,EAAE,CAAC;YAC3D,gEAAgE;QAClE,CAAC;aAAM,CAAC;YACN,MAAM,QAAQ,GAAG,YAAY,CAAC,GAAG,EAAE,SAAS,CAAC,CAAA;YAC7C,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,EAAE,CAAC;gBAC5B,2DAA2D;gBAC3D,sDAAsD;gBACtD,kEAAkE;gBAClE,mDAAmD;gBACnD,IAAI,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC;oBACzB,2DAA2D;oBAC3D,0DAA0D;oBAC1D,4DAA4D;oBAC5D,IAAI,QAAQ,KAAK,QAAQ,EAAE,CAAC;wBAC1B,MAAM,GAAG,QAAQ,CAAA;oBACnB,CAAC;gBACH,CAAC;qBAAM,CAAC;oBACN,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAA;gBACrC,CAAC;YACH,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO,MAAM,CAAA;AACf,CAAC"}
@@ -1,10 +0,0 @@
1
- // Optional dependency - resolved via km monorepo workspace, falls back at runtime
2
- declare module "loggily" {
3
- export function createLogger(namespace: string): {
4
- debug?: (msg: string) => void
5
- info?: (msg: string) => void
6
- warn?: (msg: string) => void
7
- error?: (msg: string | Error) => void
8
- trace?: (msg: string) => void
9
- }
10
- }