craft-native 0.0.179 → 0.0.181
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 +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/ios/templates/CraftNativeScreen.swift +38 -3
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -3303,7 +3303,7 @@ function pinCraftNativeDependency(packagePath, craftVersion) {
|
|
|
3303
3303
|
`);
|
|
3304
3304
|
}
|
|
3305
3305
|
// package.json
|
|
3306
|
-
var version = "0.0.
|
|
3306
|
+
var version = "0.0.181";
|
|
3307
3307
|
|
|
3308
3308
|
// bin/cli.ts
|
|
3309
3309
|
var spawnedFrom = process6.env[CRAFT_CLI_SPAWN_MARKER];
|
package/dist/index.cjs
CHANGED
package/dist/index.js
CHANGED
|
@@ -1296,6 +1296,22 @@ private class CraftNativeFlowView: UIStackView {
|
|
|
1296
1296
|
}
|
|
1297
1297
|
}
|
|
1298
1298
|
|
|
1299
|
+
// MARK: Touches
|
|
1300
|
+
|
|
1301
|
+
/// A child drawn outside this view's bounds still takes its touches, as an
|
|
1302
|
+
/// overflowing element is clickable on the web, unless the view clips
|
|
1303
|
+
/// (`overflow: hidden`). UIKit only asks a view's children when the point
|
|
1304
|
+
/// is inside the view, so a floating button absolutely positioned out of a
|
|
1305
|
+
/// zero-height parent (a component's wrapper) drew but could not be tapped.
|
|
1306
|
+
override func hitTest(_ point: CGPoint, with event: UIEvent?) -> UIView? {
|
|
1307
|
+
if let hit = super.hitTest(point, with: event) { return hit }
|
|
1308
|
+
guard !clipsToBounds, !isHidden, alpha > 0.01, isUserInteractionEnabled else { return nil }
|
|
1309
|
+
for child in subviews.reversed() where !child.isHidden && child.alpha > 0.01 && child.isUserInteractionEnabled {
|
|
1310
|
+
if let hit = child.hitTest(child.convert(point, from: self), with: event) { return hit }
|
|
1311
|
+
}
|
|
1312
|
+
return nil
|
|
1313
|
+
}
|
|
1314
|
+
|
|
1299
1315
|
// MARK: Children
|
|
1300
1316
|
|
|
1301
1317
|
override var arrangedSubviews: [UIView] { flowChildren }
|
|
@@ -1306,11 +1322,20 @@ private class CraftNativeFlowView: UIStackView {
|
|
|
1306
1322
|
|
|
1307
1323
|
override func insertArrangedSubview(_ view: UIView, at stackIndex: Int) {
|
|
1308
1324
|
flowChildren.removeAll { $0 === view }
|
|
1309
|
-
|
|
1325
|
+
let index = min(max(0, stackIndex), flowChildren.count)
|
|
1326
|
+
flowChildren.insert(view, at: index)
|
|
1310
1327
|
if view.superview !== self {
|
|
1311
1328
|
view.removeFromSuperview()
|
|
1312
1329
|
addSubview(view)
|
|
1313
1330
|
}
|
|
1331
|
+
// Stacking follows the tree, as on the web: a later sibling draws and
|
|
1332
|
+
// takes touches above an earlier one. Appending a child inserted
|
|
1333
|
+
// before its siblings put it on top of all of them, so a ScrollView
|
|
1334
|
+
// re-created under a floating button (absolute, after it) took the
|
|
1335
|
+
// button's taps for whatever lay beneath while the button still drew.
|
|
1336
|
+
if let next = flowChildren[(index + 1)...].first(where: { $0.superview === self }) {
|
|
1337
|
+
insertSubview(view, belowSubview: next)
|
|
1338
|
+
}
|
|
1314
1339
|
view.translatesAutoresizingMaskIntoConstraints = true
|
|
1315
1340
|
invalidateMeasurements()
|
|
1316
1341
|
}
|
|
@@ -3963,6 +3988,16 @@ final class CraftNativeScreenController: UIViewController, UIScrollViewDelegate,
|
|
|
3963
3988
|
// it follows light, dark and Increase Contrast by itself.
|
|
3964
3989
|
let surface = Self.floatingSurface(diameter: 44)
|
|
3965
3990
|
button.addSubview(surface)
|
|
3991
|
+
// Pinned to the button rather than resized with it: the button starts
|
|
3992
|
+
// at zero size, so a 44-point surface that grew with its superview
|
|
3993
|
+
// came out 88 points, a rounded card twice the button's size that
|
|
3994
|
+
// spilled off the bar's edge and covered its neighbour.
|
|
3995
|
+
NSLayoutConstraint.activate([
|
|
3996
|
+
surface.leadingAnchor.constraint(equalTo: button.leadingAnchor),
|
|
3997
|
+
surface.trailingAnchor.constraint(equalTo: button.trailingAnchor),
|
|
3998
|
+
surface.topAnchor.constraint(equalTo: button.topAnchor),
|
|
3999
|
+
surface.bottomAnchor.constraint(equalTo: button.bottomAnchor),
|
|
4000
|
+
])
|
|
3966
4001
|
// Glass lifts itself off the content; the material needs the tab
|
|
3967
4002
|
// bar's shadow to.
|
|
3968
4003
|
if surface.effect is UIBlurEffect {
|
|
@@ -4043,8 +4078,8 @@ final class CraftNativeScreenController: UIViewController, UIScrollViewDelegate,
|
|
|
4043
4078
|
effect = UIBlurEffect(style: .systemUltraThinMaterial)
|
|
4044
4079
|
#endif
|
|
4045
4080
|
let surface = UIVisualEffectView(effect: effect)
|
|
4046
|
-
|
|
4047
|
-
surface.
|
|
4081
|
+
// The caller pins it to its button; it is exactly `diameter` across.
|
|
4082
|
+
surface.translatesAutoresizingMaskIntoConstraints = false
|
|
4048
4083
|
surface.isUserInteractionEnabled = false
|
|
4049
4084
|
surface.layer.cornerRadius = diameter / 2
|
|
4050
4085
|
surface.layer.cornerCurve = .circular
|