craft-native 0.0.423 → 0.0.424
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/cli.js
CHANGED
|
@@ -3047,7 +3047,7 @@ function pinCraftNativeDependency(packagePath, craftVersion) {
|
|
|
3047
3047
|
`);
|
|
3048
3048
|
}
|
|
3049
3049
|
// package.json
|
|
3050
|
-
var version = "0.0.
|
|
3050
|
+
var version = "0.0.424";
|
|
3051
3051
|
|
|
3052
3052
|
// bin/cli.ts
|
|
3053
3053
|
var spawnedFrom = process6.env[CRAFT_CLI_SPAWN_MARKER];
|
package/dist/index.cjs
CHANGED
package/dist/index.js
CHANGED
package/dist/macos/src/index.js
CHANGED
|
@@ -43,7 +43,7 @@ import process from "process";
|
|
|
43
43
|
var macosToolchain = {
|
|
44
44
|
zig: "0.18.0-dev.252+86dc5ce25",
|
|
45
45
|
sources: {
|
|
46
|
-
"zig-js": { repository: "zig-utils/zig-js", revision: "
|
|
46
|
+
"zig-js": { repository: "zig-utils/zig-js", revision: "a6739721273ae0f13d36fb3422052a588c5079a8", paths: ["src", "include", "tests", "tools", "docs", "bench", "conformance"] },
|
|
47
47
|
"zig-regex": { repository: "zig-utils/zig-regex", revision: "fdd9c2e333ea6ac2fd06d080d939ef7f11d61b1b", paths: ["src"] },
|
|
48
48
|
"zig-gc": { repository: "zig-utils/zig-gc", revision: "0285ef801dd221a4ae8e88b31a09ae31627657a3", paths: ["src"] }
|
|
49
49
|
}
|
|
@@ -9,7 +9,7 @@ export declare const macosToolchain: {
|
|
|
9
9
|
readonly sources: {
|
|
10
10
|
readonly 'zig-js': {
|
|
11
11
|
readonly repository: 'zig-utils/zig-js';
|
|
12
|
-
readonly revision: '
|
|
12
|
+
readonly revision: 'a6739721273ae0f13d36fb3422052a588c5079a8';
|
|
13
13
|
readonly paths: readonly ['src', 'include', 'tests', 'tools', 'docs', 'bench', 'conformance'];
|
|
14
14
|
};
|
|
15
15
|
readonly 'zig-regex': {
|
|
@@ -277,6 +277,18 @@ final class CraftMacBox: NSView, NSTextFieldDelegate, NSTextViewDelegate, NSDrag
|
|
|
277
277
|
var lastDropPosition = ""
|
|
278
278
|
var acceptsDrops = false
|
|
279
279
|
var wantedFocus = false
|
|
280
|
+
/// Measurements are pure in a box's subtree (its style, props, text and children) and the size
|
|
281
|
+
/// offered, but a flex pass asks for the same ones over and over: a column measures its children
|
|
282
|
+
/// twice, a row measures them again at their final widths, and each child's own layout measures its
|
|
283
|
+
/// subtree once more. Unremembered, that repeats exponentially with nesting depth (a browser window
|
|
284
|
+
/// spent most of its first render here). Every change to a box (its style, props, text, visibility
|
|
285
|
+
/// or children) arrives through `render`, which starts a new generation and so forgets every measurement.
|
|
286
|
+
static var measureGeneration = 0
|
|
287
|
+
/// Measurements computed rather than remembered; the layout checks hold it to the size of the tree.
|
|
288
|
+
static var measuredCount = 0
|
|
289
|
+
private struct MeasureKey: Hashable { let width: CGFloat, stretch: Bool }
|
|
290
|
+
private var measured: [MeasureKey: CGSize] = [:]
|
|
291
|
+
private var measuredGeneration = -1
|
|
280
292
|
var componentRoot: CraftMacBox? { props["data-stx-component-wrapper"] != nil && flow?.boxes.count == 1 && flow?.boxes.first?.kind != "Modal" ? flow?.boxes.first : nil }
|
|
281
293
|
var layoutStyle: [String: Any] {
|
|
282
294
|
guard let child = componentRoot else { return style }
|
|
@@ -705,6 +717,15 @@ final class CraftMacBox: NSView, NSTextFieldDelegate, NSTextViewDelegate, NSDrag
|
|
|
705
717
|
return NSEdgeInsets(top: number(style["paddingTop"]) ?? vertical, left: number(style["paddingLeft"]) ?? horizontal, bottom: number(style["paddingBottom"]) ?? vertical, right: number(style["paddingRight"]) ?? horizontal)
|
|
706
718
|
}
|
|
707
719
|
func measure(width: CGFloat, stretch: Bool = false) -> CGSize {
|
|
720
|
+
if measuredGeneration != CraftMacBox.measureGeneration || measured.count > 64 { measured.removeAll(keepingCapacity: true); measuredGeneration = CraftMacBox.measureGeneration }
|
|
721
|
+
let key = MeasureKey(width: width, stretch: stretch)
|
|
722
|
+
if let size = measured[key] { return size }
|
|
723
|
+
let size = measureSubtree(width: width, stretch: stretch)
|
|
724
|
+
measured[key] = size
|
|
725
|
+
return size
|
|
726
|
+
}
|
|
727
|
+
private func measureSubtree(width: CGFloat, stretch: Bool) -> CGSize {
|
|
728
|
+
CraftMacBox.measuredCount &+= 1
|
|
708
729
|
if isHidden { return .zero }
|
|
709
730
|
if let child = componentRoot { return child.measure(width: width, stretch: stretch) }
|
|
710
731
|
let specifiedWidth = dimension(style["width"], base: width)
|
|
@@ -966,6 +987,8 @@ final class CraftMacRenderer {
|
|
|
966
987
|
return box
|
|
967
988
|
}
|
|
968
989
|
let box = reconcile(document)
|
|
990
|
+
// Boxes were reconfigured and children replaced: nothing measured before now holds.
|
|
991
|
+
CraftMacBox.measureGeneration &+= 1
|
|
969
992
|
for (id, box) in boxes where !retained.contains(id) {
|
|
970
993
|
box.imageTask?.cancel(); box.removeFromSuperview(); boxes.removeValue(forKey: id)
|
|
971
994
|
if let sheet = sheets.removeValue(forKey: id) { window?.endSheet(sheet); sheet.close() }
|