craft-native 0.0.196 → 0.0.197

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
@@ -3424,7 +3424,7 @@ function pinCraftNativeDependency(packagePath, craftVersion) {
3424
3424
  `);
3425
3425
  }
3426
3426
  // package.json
3427
- var version = "0.0.196";
3427
+ var version = "0.0.197";
3428
3428
 
3429
3429
  // bin/cli.ts
3430
3430
  var spawnedFrom = process6.env[CRAFT_CLI_SPAWN_MARKER];
package/dist/index.cjs CHANGED
@@ -309,7 +309,7 @@ function craftBinaryNotFoundMessage(triedPath) {
309
309
  `);
310
310
  }
311
311
  // package.json
312
- var version = "0.0.196";
312
+ var version = "0.0.197";
313
313
 
314
314
  // src/sdk-version.ts
315
315
  var SDK_VERSION = version;
package/dist/index.js CHANGED
@@ -57,7 +57,7 @@ function craftBinaryNotFoundMessage(triedPath) {
57
57
  `);
58
58
  }
59
59
  // package.json
60
- var version = "0.0.196";
60
+ var version = "0.0.197";
61
61
 
62
62
  // src/sdk-version.ts
63
63
  var SDK_VERSION = version;
@@ -21,10 +21,6 @@ final class CraftNativeFlatList: UICollectionView, UICollectionViewDelegateFlowL
21
21
  private(set) var representedIdentity: String?
22
22
  private(set) var hostedView: UIView?
23
23
  var onRecycle: ((String) -> Void)?
24
- /// The width (or, sideways, height) the list gives this row, so a row
25
- /// is measured at the list's width rather than the layout's estimate.
26
- var fittingExtent: CGFloat?
27
-
28
24
  override func prepareForReuse() {
29
25
  super.prepareForReuse()
30
26
  releaseHostedView()
@@ -63,6 +59,12 @@ final class CraftNativeFlatList: UICollectionView, UICollectionViewDelegateFlowL
63
59
  // collection view ancestor.
64
60
  var ancestor = superview
65
61
  while let view = ancestor, !(view is UICollectionView) { ancestor = view.superview }
62
+ // A reusable cell can be measured during UIKit's invalidation,
63
+ // before layoutSubviews updates visible cells. Derive the extent
64
+ // from the live list bounds on every self-sizing pass.
65
+ let list = ancestor as? CraftNativeFlatList
66
+ let isChrome = representedIdentity.flatMap { list?.itemsByIdentity[$0]?.isChrome } ?? false
67
+ let fittingExtent = list?.itemExtent(isChrome: isChrome)
66
68
  if let collectionView = ancestor as? UICollectionView,
67
69
  let flowLayout = collectionView.collectionViewLayout as? UICollectionViewFlowLayout,
68
70
  flowLayout.scrollDirection == .horizontal {
@@ -155,7 +157,6 @@ final class CraftNativeFlatList: UICollectionView, UICollectionViewDelegateFlowL
155
157
  let renderItem = self.renderItem else { return UICollectionViewCell() }
156
158
  let view = renderItem(item.node, identity, cell.hostedView)
157
159
  cell.onRecycle = self.recycleItem
158
- cell.fittingExtent = self.itemExtent(isChrome: item.isChrome)
159
160
  cell.host(view, identity: identity)
160
161
  return cell
161
162
  }
@@ -214,19 +215,6 @@ final class CraftNativeFlatList: UICollectionView, UICollectionViewDelegateFlowL
214
215
  if flowLayout.estimatedItemSize != estimate, bounds.width > 0 {
215
216
  flowLayout.estimatedItemSize = estimate
216
217
  }
217
- // Cells can outlive a change to the list's width (including its first
218
- // constrained parent layout). Self-sizing must use the current extent,
219
- // or UIKit repeatedly receives a preferred width wider than the list.
220
- var changedExtent = false
221
- for case let cell as Cell in visibleCells {
222
- guard let identity = cell.representedIdentity, let item = itemsByIdentity[identity] else { continue }
223
- let extent = itemExtent(isChrome: item.isChrome)
224
- if cell.fittingExtent != extent {
225
- cell.fittingExtent = extent
226
- changedExtent = true
227
- }
228
- }
229
- if changedExtent { flowLayout.invalidateLayout() }
230
218
  super.layoutSubviews()
231
219
  craftApplyCornerRadius()
232
220
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "craft-native",
3
- "version": "0.0.196",
3
+ "version": "0.0.197",
4
4
  "type": "module",
5
5
  "description": "Build desktop apps with web languages - TypeScript SDK for Craft",
6
6
  "author": "Chris Breuer <chris@stacksjs.org>",