@triniwiz/nativescript-masonkit 1.0.0-beta.118 → 1.0.0-beta.119

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 (45) hide show
  1. package/common.d.ts +3 -0
  2. package/common.js +35 -10
  3. package/common.js.map +1 -1
  4. package/package.json +1 -1
  5. package/platforms/android/masonkit-release.aar +0 -0
  6. package/platforms/ios/Mason.xcframework/Info.plist +8 -8
  7. package/platforms/ios/Mason.xcframework/ios-arm64/Mason.framework/Mason +0 -0
  8. package/platforms/ios/Mason.xcframework/ios-arm64/Mason.framework/Modules/Mason.swiftmodule/Project/arm64-apple-ios.swiftsourceinfo +0 -0
  9. package/platforms/ios/Mason.xcframework/ios-arm64/Mason.framework/Modules/Mason.swiftmodule/arm64-apple-ios.abi.json +152 -131
  10. package/platforms/ios/Mason.xcframework/ios-arm64/dSYMs/Mason.framework.dSYM/Contents/Resources/DWARF/Mason +0 -0
  11. package/platforms/ios/Mason.xcframework/ios-arm64/dSYMs/Mason.framework.dSYM/Contents/Resources/Relocations/aarch64/Mason.yml +9388 -9340
  12. package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Mason +0 -0
  13. package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Modules/Mason.swiftmodule/Project/arm64-apple-ios-simulator.swiftsourceinfo +0 -0
  14. package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Modules/Mason.swiftmodule/Project/x86_64-apple-ios-simulator.swiftsourceinfo +0 -0
  15. package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Modules/Mason.swiftmodule/arm64-apple-ios-simulator.abi.json +152 -131
  16. package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Modules/Mason.swiftmodule/x86_64-apple-ios-simulator.abi.json +152 -131
  17. package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/_CodeSignature/CodeResources +12 -12
  18. package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/dSYMs/Mason.framework.dSYM/Contents/Resources/DWARF/Mason +2 -2
  19. package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/dSYMs/Mason.framework.dSYM/Contents/Resources/Relocations/aarch64/Mason.yml +9382 -9334
  20. package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/dSYMs/Mason.framework.dSYM/Contents/Resources/Relocations/x86_64/Mason.yml +8947 -8900
  21. package/platforms/ios/Mason.xcframework/xros-arm64/Mason.framework/Mason +0 -0
  22. package/platforms/ios/Mason.xcframework/xros-arm64/Mason.framework/Modules/Mason.swiftmodule/Project/arm64-apple-xros.swiftsourceinfo +0 -0
  23. package/platforms/ios/Mason.xcframework/xros-arm64/Mason.framework/Modules/Mason.swiftmodule/arm64-apple-xros.abi.json +152 -131
  24. package/platforms/ios/Mason.xcframework/xros-arm64/dSYMs/Mason.framework.dSYM/Contents/Resources/DWARF/Mason +0 -0
  25. package/platforms/ios/Mason.xcframework/xros-arm64/dSYMs/Mason.framework.dSYM/Contents/Resources/Relocations/aarch64/Mason.yml +8877 -8831
  26. package/platforms/ios/Mason.xcframework/xros-arm64-simulator/Mason.framework/Mason +0 -0
  27. package/platforms/ios/Mason.xcframework/xros-arm64-simulator/Mason.framework/Modules/Mason.swiftmodule/Project/arm64-apple-xros-simulator.swiftsourceinfo +0 -0
  28. package/platforms/ios/Mason.xcframework/xros-arm64-simulator/Mason.framework/Modules/Mason.swiftmodule/arm64-apple-xros-simulator.abi.json +152 -131
  29. package/platforms/ios/Mason.xcframework/xros-arm64-simulator/Mason.framework/_CodeSignature/CodeResources +6 -6
  30. package/platforms/ios/Mason.xcframework/xros-arm64-simulator/dSYMs/Mason.framework.dSYM/Contents/Resources/DWARF/Mason +0 -0
  31. package/platforms/ios/Mason.xcframework/xros-arm64-simulator/dSYMs/Mason.framework.dSYM/Contents/Resources/Relocations/aarch64/Mason.yml +8876 -8830
  32. package/platforms/windows/arm64/NativeScript.Mason.dll +0 -0
  33. package/platforms/windows/arm64/NativeScript.Mason.winmd +0 -0
  34. package/platforms/windows/x64/NativeScript.Mason.dll +0 -0
  35. package/platforms/windows/x64/NativeScript.Mason.winmd +0 -0
  36. package/style.d.ts +3 -4
  37. package/style.js +61 -44
  38. package/style.js.map +1 -1
  39. package/typings/windows.d.ts +1 -1
  40. package/view/index.ios.d.ts +7 -0
  41. package/view/index.ios.js +68 -18
  42. package/view/index.ios.js.map +1 -1
  43. package/windows-mask.d.ts +2 -0
  44. package/windows-mask.js +2 -18
  45. package/windows-mask.js.map +1 -1
package/common.d.ts CHANGED
@@ -310,6 +310,8 @@ export declare class ViewBase extends CustomLayoutView implements AddChildFromBu
310
310
  nativeIndex: number;
311
311
  };
312
312
  _invalidateAttachCursor(): void;
313
+ /** Runs an iOS View's queued inserts before a native child edit. */
314
+ private _masonSettleNativeAdds;
313
315
  _windowsNativeIndexOf(child: any, atIndex: number): number;
314
316
  _childIndexToNativeChildIndex(index?: number): number;
315
317
  insertChild(child: any, atIndex: number): void;
@@ -351,6 +353,7 @@ export declare class ViewBase extends CustomLayoutView implements AddChildFromBu
351
353
  private _windowsHostsRuns;
352
354
  _windowsRunsInline(): boolean;
353
355
  private _windowsScheduleSettle;
356
+ onLoaded(): void;
354
357
  _windowsSettleRuns(): void;
355
358
  private _windowsJoins;
356
359
  private _windowsJoinsAt;
package/common.js CHANGED
@@ -1022,6 +1022,8 @@ export class ViewBase extends CustomLayoutView {
1022
1022
  return getViewById(this, id);
1023
1023
  }
1024
1024
  addChild(child) {
1025
+ if (!(child instanceof NSView))
1026
+ this._masonSettleNativeAdds();
1025
1027
  if (child && child[isPlaceholder_] && child._view) {
1026
1028
  if (__ANDROID__) {
1027
1029
  //@ts-ignore
@@ -1150,6 +1152,11 @@ export class ViewBase extends CustomLayoutView {
1150
1152
  _invalidateAttachCursor() {
1151
1153
  this._attachCursor = undefined;
1152
1154
  }
1155
+ /** Runs an iOS View's queued inserts before a native child edit. */
1156
+ _masonSettleNativeAdds() {
1157
+ if (this._masonPendingAdds)
1158
+ this._masonFlushNativeAdds();
1159
+ }
1153
1160
  // Windows attaches element children on load with no index, after text runs that attached
1154
1161
  // straight away, so an append would land them after text that comes later.
1155
1162
  _windowsNativeIndexOf(child, atIndex) {
@@ -1165,6 +1172,7 @@ export class ViewBase extends CustomLayoutView {
1165
1172
  return super._childIndexToNativeChildIndex(index);
1166
1173
  }
1167
1174
  insertChild(child, atIndex) {
1175
+ this._masonSettleNativeAdds();
1168
1176
  this._invalidateAttachCursor();
1169
1177
  if (child && child[isPlaceholder_] && child._view) {
1170
1178
  const nativeIndex = this._nativeIndexFor(atIndex);
@@ -1193,6 +1201,7 @@ export class ViewBase extends CustomLayoutView {
1193
1201
  }
1194
1202
  }
1195
1203
  replaceChild(child, atIndex) {
1204
+ this._masonSettleNativeAdds();
1196
1205
  this._invalidateAttachCursor();
1197
1206
  if (child && child[isPlaceholder_] && child._view) {
1198
1207
  this._children[atIndex] = child;
@@ -1241,10 +1250,9 @@ export class ViewBase extends CustomLayoutView {
1241
1250
  }
1242
1251
  }
1243
1252
  removeChild(child) {
1253
+ this._masonSettleNativeAdds();
1244
1254
  this._invalidateAttachCursor();
1245
- // Placeholder (e.g. Br): it was attached straight to the mason tree via the
1246
- // native element APIs (never `_addView`-ed), so `_removeView` would throw.
1247
- // Remove the native node directly instead.
1255
+ // A placeholder (e.g. Br) was never `_addView`-ed, so remove its native node directly.
1248
1256
  if (child && child[isPlaceholder_] && child._view) {
1249
1257
  const index = this._children.indexOf(child);
1250
1258
  if (index > -1) {
@@ -1293,9 +1301,9 @@ export class ViewBase extends CustomLayoutView {
1293
1301
  }
1294
1302
  }
1295
1303
  }
1296
- // Remove the native node directly when supported (no index drift), falling
1297
- // back to index-based removal on native builds that predate the by-node API.
1304
+ // By node when the native build supports it, else by index.
1298
1305
  _nativeRemoveChildNode(node, index) {
1306
+ this._masonSettleNativeAdds();
1299
1307
  //@ts-ignore
1300
1308
  const view = this._view;
1301
1309
  if (!view)
@@ -1356,6 +1364,7 @@ export class ViewBase extends CustomLayoutView {
1356
1364
  if (this._viewChildren.length === 0) {
1357
1365
  return;
1358
1366
  }
1367
+ this._masonSettleNativeAdds();
1359
1368
  for (const child of this._viewChildren) {
1360
1369
  // @ts-ignore
1361
1370
  child._isMasonChild = false;
@@ -1530,6 +1539,7 @@ export class ViewBase extends CustomLayoutView {
1530
1539
  });
1531
1540
  }
1532
1541
  _nativeAddChild(textNode, index) {
1542
+ this._masonSettleNativeAdds();
1533
1543
  //@ts-ignore
1534
1544
  if (__ANDROID__)
1535
1545
  this._view.addChildAt(textNode, index);
@@ -1547,6 +1557,7 @@ export class ViewBase extends CustomLayoutView {
1547
1557
  }
1548
1558
  }
1549
1559
  _nativeReplaceChild(textNode, index) {
1560
+ this._masonSettleNativeAdds();
1550
1561
  //@ts-ignore
1551
1562
  if (__ANDROID__)
1552
1563
  this._view.replaceChildAt(textNode, index);
@@ -1668,12 +1679,25 @@ export class ViewBase extends CustomLayoutView {
1668
1679
  const display = this._styleHelper?.display;
1669
1680
  return display === 'block' || display === 'inline-block';
1670
1681
  }
1671
- // A container's display arrives with its CSS, after its children attach, so runs are grouped once the turn ends.
1682
+ // A container's display arrives with its CSS, after its children attach, so runs are grouped once
1683
+ // the turn ends, or once it loads if it hasn't by then.
1672
1684
  _windowsScheduleSettle() {
1673
1685
  if (this[runsSettled_] !== undefined)
1674
1686
  return;
1675
1687
  this[runsSettled_] = false;
1676
- queueMicrotask(() => this._windowsSettleRuns());
1688
+ queueMicrotask(() => {
1689
+ if (this[runsSettled_] !== false)
1690
+ return;
1691
+ if (this.isLoaded)
1692
+ this._windowsSettleRuns();
1693
+ else
1694
+ this[runsSettled_] = 'load';
1695
+ });
1696
+ }
1697
+ onLoaded() {
1698
+ super.onLoaded();
1699
+ if (__WINDOWS__ && this[runsSettled_] === 'load')
1700
+ this._windowsSettleRuns();
1677
1701
  }
1678
1702
  _windowsSettleRuns() {
1679
1703
  this[runsSettled_] = true;
@@ -2167,7 +2191,8 @@ export class ViewBase extends CustomLayoutView {
2167
2191
  corners = this[borderRadiusCorners_] = this._nativeBorderRadiusCorners();
2168
2192
  }
2169
2193
  // Resolve math functions first: the corner parser can't read them.
2170
- const css = resolveCssMathIn(lengthToCssString(masonLength(value)), style.emBasis());
2194
+ const text = lengthToCssString(masonLength(value));
2195
+ const css = resolveCssMathIn(text, style.emBasisFor(text));
2171
2196
  const radius = (corners[corner] = /\s/.test(css) ? parseCornerRadius(css) : [css, css]);
2172
2197
  const shorthand = composeBorderRadius(corners);
2173
2198
  if ((__ANDROID__ || __APPLE__) && style._writeCornerRadius(corner, radius, shorthand)) {
@@ -3169,7 +3194,7 @@ export class ViewBase extends CustomLayoutView {
3169
3194
  if (__WINDOWS__) {
3170
3195
  const nv = this.nativeViewProtected ?? this._view;
3171
3196
  try {
3172
- const shadows = parseBoxShadows(typeof value === 'string' ? value : '', (token) => cssLengthToDip(token, style.emBasis()));
3197
+ const shadows = parseBoxShadows(typeof value === 'string' ? value : '', (token) => cssLengthToDip(token, style.emBasisFor(token)));
3173
3198
  const current = style.color >>> 0 || 0xff000000;
3174
3199
  const spec = encodeBoxShadows(shadows, (color) => {
3175
3200
  if (!color || color.toLowerCase() === 'currentcolor')
@@ -3243,7 +3268,7 @@ export class ViewBase extends CustomLayoutView {
3243
3268
  const nv = this.nativeViewProtected ?? this._view;
3244
3269
  try {
3245
3270
  const size = { width: nv?.ActualWidth ?? 0, height: nv?.ActualHeight ?? 0 };
3246
- const m = parseCssTransform(typeof value === 'string' ? value : '', (token) => cssLengthToDip(token, style.emBasis()), size);
3271
+ const m = parseCssTransform(typeof value === 'string' ? value : '', (token) => cssLengthToDip(token, style.emBasisFor(token)), size);
3247
3272
  if (!m)
3248
3273
  NativeScript.Mason.Css.ClearTransform(nv);
3249
3274
  else {