@triniwiz/nativescript-masonkit 1.0.0-beta.121 → 1.0.0-beta.122

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 (82) hide show
  1. package/button/index.ios.js +5 -73
  2. package/button/index.ios.js.map +1 -1
  3. package/common.d.ts +3 -1
  4. package/common.js +53 -13
  5. package/common.js.map +1 -1
  6. package/css-shorthands.d.ts +0 -2
  7. package/css-shorthands.js +0 -4
  8. package/css-shorthands.js.map +1 -1
  9. package/foreign-layout.d.ts +3 -1
  10. package/foreign-layout.js +33 -1
  11. package/foreign-layout.js.map +1 -1
  12. package/img/index.ios.js +4 -42
  13. package/img/index.ios.js.map +1 -1
  14. package/index.d.ts +12 -0
  15. package/input/index.ios.js +4 -44
  16. package/input/index.ios.js.map +1 -1
  17. package/li/index.ios.js +6 -52
  18. package/li/index.ios.js.map +1 -1
  19. package/list/index.ios.js +3 -41
  20. package/list/index.ios.js.map +1 -1
  21. package/logical-boxes.d.ts +8 -0
  22. package/logical-boxes.js +131 -0
  23. package/logical-boxes.js.map +1 -0
  24. package/package.json +1 -1
  25. package/platforms/android/masonkit-release.aar +0 -0
  26. package/platforms/ios/Mason.xcframework/ios-arm64/Mason.framework/Headers/Mason-Swift.h +5 -0
  27. package/platforms/ios/Mason.xcframework/ios-arm64/Mason.framework/Headers/mason_native.h +9 -0
  28. package/platforms/ios/Mason.xcframework/ios-arm64/Mason.framework/Mason +0 -0
  29. package/platforms/ios/Mason.xcframework/ios-arm64/Mason.framework/Modules/Mason.swiftmodule/Project/arm64-apple-ios.swiftsourceinfo +0 -0
  30. package/platforms/ios/Mason.xcframework/ios-arm64/Mason.framework/Modules/Mason.swiftmodule/arm64-apple-ios.abi.json +47243 -44370
  31. package/platforms/ios/Mason.xcframework/ios-arm64/Mason.framework/Modules/Mason.swiftmodule/arm64-apple-ios.private.swiftinterface +276 -223
  32. package/platforms/ios/Mason.xcframework/ios-arm64/Mason.framework/Modules/Mason.swiftmodule/arm64-apple-ios.swiftdoc +0 -0
  33. package/platforms/ios/Mason.xcframework/ios-arm64/Mason.framework/Modules/Mason.swiftmodule/arm64-apple-ios.swiftinterface +276 -223
  34. package/platforms/ios/Mason.xcframework/ios-arm64/dSYMs/Mason.framework.dSYM/Contents/Resources/DWARF/Mason +0 -0
  35. package/platforms/ios/Mason.xcframework/ios-arm64/dSYMs/Mason.framework.dSYM/Contents/Resources/Relocations/aarch64/Mason.yml +9927 -9729
  36. package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Headers/Mason-Swift.h +10 -0
  37. package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Headers/mason_native.h +9 -0
  38. package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Mason +0 -0
  39. package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Modules/Mason.swiftmodule/Project/arm64-apple-ios-simulator.swiftsourceinfo +0 -0
  40. package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Modules/Mason.swiftmodule/Project/x86_64-apple-ios-simulator.swiftsourceinfo +0 -0
  41. package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Modules/Mason.swiftmodule/arm64-apple-ios-simulator.abi.json +47243 -44370
  42. package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Modules/Mason.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface +276 -223
  43. package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Modules/Mason.swiftmodule/arm64-apple-ios-simulator.swiftdoc +0 -0
  44. package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Modules/Mason.swiftmodule/arm64-apple-ios-simulator.swiftinterface +276 -223
  45. package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Modules/Mason.swiftmodule/x86_64-apple-ios-simulator.abi.json +47243 -44370
  46. package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Modules/Mason.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface +276 -223
  47. package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Modules/Mason.swiftmodule/x86_64-apple-ios-simulator.swiftdoc +0 -0
  48. package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Modules/Mason.swiftmodule/x86_64-apple-ios-simulator.swiftinterface +276 -223
  49. package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/_CodeSignature/CodeResources +28 -28
  50. package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/dSYMs/Mason.framework.dSYM/Contents/Resources/DWARF/Mason +2 -2
  51. package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/dSYMs/Mason.framework.dSYM/Contents/Resources/Relocations/aarch64/Mason.yml +9921 -9723
  52. package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/dSYMs/Mason.framework.dSYM/Contents/Resources/Relocations/x86_64/Mason.yml +9476 -9280
  53. package/platforms/windows/arm64/NativeScript.Mason.dll +0 -0
  54. package/platforms/windows/arm64/NativeScript.Mason.winmd +0 -0
  55. package/platforms/windows/x64/NativeScript.Mason.dll +0 -0
  56. package/platforms/windows/x64/NativeScript.Mason.winmd +0 -0
  57. package/properties.d.ts +32 -0
  58. package/properties.js +148 -37
  59. package/properties.js.map +1 -1
  60. package/scroll/index.ios.js +5 -62
  61. package/scroll/index.ios.js.map +1 -1
  62. package/style.d.ts +322 -0
  63. package/style.js +315 -1
  64. package/style.js.map +1 -1
  65. package/symbols.d.ts +2 -0
  66. package/symbols.js +2 -0
  67. package/symbols.js.map +1 -1
  68. package/text/index.ios.js +3 -79
  69. package/text/index.ios.js.map +1 -1
  70. package/text/index.windows.js +5 -4
  71. package/text/index.windows.js.map +1 -1
  72. package/textarea/index.ios.js +4 -62
  73. package/textarea/index.ios.js.map +1 -1
  74. package/typings/objc!Mason.d.ts +2 -0
  75. package/typings/objc!ObjectiveC.d.ts +2 -0
  76. package/view/index.ios.js +8 -56
  77. package/view/index.ios.js.map +1 -1
  78. package/vue/src/mason-meta.d.ts.map +1 -1
  79. package/vue/src/mason-meta.js +8 -7
  80. package/vue/src/mason-meta.js.map +1 -1
  81. package/web.js +6 -6
  82. package/web.js.map +1 -1
package/style.js CHANGED
@@ -242,6 +242,58 @@ var StyleKeys;
242
242
  StyleKeys[StyleKeys["TRANSFORM_ORIGIN_X_VALUE"] = 600] = "TRANSFORM_ORIGIN_X_VALUE";
243
243
  StyleKeys[StyleKeys["TRANSFORM_ORIGIN_Y_VALUE"] = 604] = "TRANSFORM_ORIGIN_Y_VALUE";
244
244
  StyleKeys[StyleKeys["TRANSFORM_ORIGIN_STATE"] = 608] = "TRANSFORM_ORIGIN_STATE";
245
+ StyleKeys[StyleKeys["TEXT_ORIENTATION"] = 609] = "TEXT_ORIENTATION";
246
+ StyleKeys[StyleKeys["TEXT_ORIENTATION_STATE"] = 610] = "TEXT_ORIENTATION_STATE";
247
+ // CSS logical properties, mapped onto physical sides by the box's writing mode and direction.
248
+ // A group's ORDER bytes are its physical slots (top, right, bottom, left; sizes: width, height,
249
+ // min-width, min-height, max-width, max-height) then its logical ones in the order below: 0
250
+ // never written, else the write's LOGICAL_SEQ stamp. A logical value applies to the side it
251
+ // maps to when it was written after that side's physical one. Types are the physical group's.
252
+ StyleKeys[StyleKeys["LOGICAL_SEQ"] = 611] = "LOGICAL_SEQ";
253
+ StyleKeys[StyleKeys["MARGIN_ORDER"] = 612] = "MARGIN_ORDER";
254
+ StyleKeys[StyleKeys["MARGIN_BLOCK_START_TYPE"] = 620] = "MARGIN_BLOCK_START_TYPE";
255
+ StyleKeys[StyleKeys["MARGIN_INLINE_END_TYPE"] = 621] = "MARGIN_INLINE_END_TYPE";
256
+ StyleKeys[StyleKeys["MARGIN_BLOCK_END_TYPE"] = 622] = "MARGIN_BLOCK_END_TYPE";
257
+ StyleKeys[StyleKeys["MARGIN_INLINE_START_TYPE"] = 623] = "MARGIN_INLINE_START_TYPE";
258
+ StyleKeys[StyleKeys["MARGIN_BLOCK_START_VALUE"] = 624] = "MARGIN_BLOCK_START_VALUE";
259
+ StyleKeys[StyleKeys["MARGIN_INLINE_END_VALUE"] = 628] = "MARGIN_INLINE_END_VALUE";
260
+ StyleKeys[StyleKeys["MARGIN_BLOCK_END_VALUE"] = 632] = "MARGIN_BLOCK_END_VALUE";
261
+ StyleKeys[StyleKeys["MARGIN_INLINE_START_VALUE"] = 636] = "MARGIN_INLINE_START_VALUE";
262
+ StyleKeys[StyleKeys["PADDING_ORDER"] = 640] = "PADDING_ORDER";
263
+ StyleKeys[StyleKeys["PADDING_BLOCK_START_TYPE"] = 648] = "PADDING_BLOCK_START_TYPE";
264
+ StyleKeys[StyleKeys["PADDING_INLINE_END_TYPE"] = 649] = "PADDING_INLINE_END_TYPE";
265
+ StyleKeys[StyleKeys["PADDING_BLOCK_END_TYPE"] = 650] = "PADDING_BLOCK_END_TYPE";
266
+ StyleKeys[StyleKeys["PADDING_INLINE_START_TYPE"] = 651] = "PADDING_INLINE_START_TYPE";
267
+ StyleKeys[StyleKeys["PADDING_BLOCK_START_VALUE"] = 652] = "PADDING_BLOCK_START_VALUE";
268
+ StyleKeys[StyleKeys["PADDING_INLINE_END_VALUE"] = 656] = "PADDING_INLINE_END_VALUE";
269
+ StyleKeys[StyleKeys["PADDING_BLOCK_END_VALUE"] = 660] = "PADDING_BLOCK_END_VALUE";
270
+ StyleKeys[StyleKeys["PADDING_INLINE_START_VALUE"] = 664] = "PADDING_INLINE_START_VALUE";
271
+ StyleKeys[StyleKeys["INSET_ORDER"] = 668] = "INSET_ORDER";
272
+ StyleKeys[StyleKeys["INSET_BLOCK_START_TYPE"] = 676] = "INSET_BLOCK_START_TYPE";
273
+ StyleKeys[StyleKeys["INSET_INLINE_END_TYPE"] = 677] = "INSET_INLINE_END_TYPE";
274
+ StyleKeys[StyleKeys["INSET_BLOCK_END_TYPE"] = 678] = "INSET_BLOCK_END_TYPE";
275
+ StyleKeys[StyleKeys["INSET_INLINE_START_TYPE"] = 679] = "INSET_INLINE_START_TYPE";
276
+ StyleKeys[StyleKeys["INSET_BLOCK_START_VALUE"] = 680] = "INSET_BLOCK_START_VALUE";
277
+ StyleKeys[StyleKeys["INSET_INLINE_END_VALUE"] = 684] = "INSET_INLINE_END_VALUE";
278
+ StyleKeys[StyleKeys["INSET_BLOCK_END_VALUE"] = 688] = "INSET_BLOCK_END_VALUE";
279
+ StyleKeys[StyleKeys["INSET_INLINE_START_VALUE"] = 692] = "INSET_INLINE_START_VALUE";
280
+ StyleKeys[StyleKeys["SIZE_ORDER"] = 696] = "SIZE_ORDER";
281
+ StyleKeys[StyleKeys["INLINE_SIZE_TYPE"] = 708] = "INLINE_SIZE_TYPE";
282
+ StyleKeys[StyleKeys["BLOCK_SIZE_TYPE"] = 709] = "BLOCK_SIZE_TYPE";
283
+ StyleKeys[StyleKeys["MIN_INLINE_SIZE_TYPE"] = 710] = "MIN_INLINE_SIZE_TYPE";
284
+ StyleKeys[StyleKeys["MIN_BLOCK_SIZE_TYPE"] = 711] = "MIN_BLOCK_SIZE_TYPE";
285
+ StyleKeys[StyleKeys["MAX_INLINE_SIZE_TYPE"] = 712] = "MAX_INLINE_SIZE_TYPE";
286
+ StyleKeys[StyleKeys["MAX_BLOCK_SIZE_TYPE"] = 713] = "MAX_BLOCK_SIZE_TYPE";
287
+ StyleKeys[StyleKeys["INLINE_SIZE_VALUE"] = 714] = "INLINE_SIZE_VALUE";
288
+ StyleKeys[StyleKeys["BLOCK_SIZE_VALUE"] = 718] = "BLOCK_SIZE_VALUE";
289
+ StyleKeys[StyleKeys["MIN_INLINE_SIZE_VALUE"] = 722] = "MIN_INLINE_SIZE_VALUE";
290
+ StyleKeys[StyleKeys["MIN_BLOCK_SIZE_VALUE"] = 726] = "MIN_BLOCK_SIZE_VALUE";
291
+ StyleKeys[StyleKeys["MAX_INLINE_SIZE_VALUE"] = 730] = "MAX_INLINE_SIZE_VALUE";
292
+ StyleKeys[StyleKeys["MAX_BLOCK_SIZE_VALUE"] = 734] = "MAX_BLOCK_SIZE_VALUE";
293
+ StyleKeys[StyleKeys["TEXT_COMBINE_UPRIGHT"] = 738] = "TEXT_COMBINE_UPRIGHT";
294
+ StyleKeys[StyleKeys["TEXT_COMBINE_UPRIGHT_STATE"] = 739] = "TEXT_COMBINE_UPRIGHT_STATE";
295
+ StyleKeys[StyleKeys["TEXT_SPACING_TRIM"] = 740] = "TEXT_SPACING_TRIM";
296
+ StyleKeys[StyleKeys["TEXT_SPACING_TRIM_STATE"] = 741] = "TEXT_SPACING_TRIM_STATE";
245
297
  // </style-keys:offsets>
246
298
  })(StyleKeys || (StyleKeys = {}));
247
299
  // Windows: the native Style.UpdateGrid takes all grid strings at once. To set one while preserving
@@ -757,10 +809,13 @@ StateKeys.FONT_STRETCH = StateKeys.flag(78);
757
809
  StateKeys.TEXT_INDENT = StateKeys.flag(79);
758
810
  StateKeys.LINE_CLAMP = StateKeys.flag(80);
759
811
  StateKeys.TRANSFORM_ORIGIN = StateKeys.flag(81);
812
+ StateKeys.TEXT_ORIENTATION = StateKeys.flag(82);
813
+ StateKeys.TEXT_COMBINE_UPRIGHT = StateKeys.flag(83);
814
+ StateKeys.TEXT_SPACING_TRIM = StateKeys.flag(84);
760
815
  // </style-keys:state>
761
816
  StateKeys.DISPLAY_AND_MODE = StateKeys.DISPLAY.or(StateKeys.DISPLAY_MODE);
762
817
  StateKeys.FLOW_TYPE = StateKeys.DISPLAY.or(StateKeys.DISPLAY_MODE).or(StateKeys.POSITION).or(StateKeys.FLOAT);
763
- StateKeys.WINDOWS_TEXT = [StateKeys.INVALIDATE_TEXT, StateKeys.FONT_COLOR, StateKeys.DECORATION_LINE, StateKeys.DECORATION_COLOR, StateKeys.TEXT_ALIGN, StateKeys.TEXT_JUSTIFY, StateKeys.FONT_SIZE, StateKeys.TEXT_TRANSFORM, StateKeys.FONT_STYLE, StateKeys.FONT_STYLE_SLANT, StateKeys.TEXT_WRAP, StateKeys.TEXT_OVERFLOW, StateKeys.DECORATION_STYLE, StateKeys.WHITE_SPACE, StateKeys.FONT_WEIGHT, StateKeys.LINE_HEIGHT, StateKeys.VERTICAL_ALIGN, StateKeys.DECORATION_THICKNESS, StateKeys.TEXT_SHADOWS, StateKeys.FONT_FAMILY, StateKeys.LETTER_SPACING, StateKeys.FONT_VARIANT_NUMERIC, StateKeys.WRITING_MODE, StateKeys.UNICODE_BIDI, StateKeys.HYPHENS, StateKeys.WORD_SPACING, StateKeys.FONT_STRETCH, StateKeys.TEXT_INDENT, StateKeys.LINE_CLAMP].reduce((mask, key) => mask.or(key), StateKeys.NONE);
818
+ StateKeys.WINDOWS_TEXT = [StateKeys.INVALIDATE_TEXT, StateKeys.FONT_COLOR, StateKeys.DECORATION_LINE, StateKeys.DECORATION_COLOR, StateKeys.TEXT_ALIGN, StateKeys.TEXT_JUSTIFY, StateKeys.FONT_SIZE, StateKeys.TEXT_TRANSFORM, StateKeys.FONT_STYLE, StateKeys.FONT_STYLE_SLANT, StateKeys.TEXT_WRAP, StateKeys.TEXT_OVERFLOW, StateKeys.DECORATION_STYLE, StateKeys.WHITE_SPACE, StateKeys.FONT_WEIGHT, StateKeys.LINE_HEIGHT, StateKeys.VERTICAL_ALIGN, StateKeys.DECORATION_THICKNESS, StateKeys.TEXT_SHADOWS, StateKeys.FONT_FAMILY, StateKeys.LETTER_SPACING, StateKeys.FONT_VARIANT_NUMERIC, StateKeys.WRITING_MODE, StateKeys.UNICODE_BIDI, StateKeys.HYPHENS, StateKeys.WORD_SPACING, StateKeys.FONT_STRETCH, StateKeys.TEXT_INDENT, StateKeys.LINE_CLAMP, StateKeys.TEXT_ORIENTATION].reduce((mask, key) => mask.or(key), StateKeys.NONE);
764
819
  function wordsToBigInt(w0, w1, w2, w3) {
765
820
  return BigInt(w0 >>> 0) | (BigInt(w1 >>> 0) << 32n) | (BigInt(w2 >>> 0) << 64n) | (BigInt(w3 >>> 0) << 96n);
766
821
  }
@@ -1319,6 +1374,53 @@ function parseSidesColorShorthand(value) {
1319
1374
  return { t: cols[0], r: cols[1], b: cols[2], l: cols[3] };
1320
1375
  }
1321
1376
  }
1377
+ const LOGICAL_GROUPS = {
1378
+ margin: { order: StyleKeys.MARGIN_ORDER, half: 4, types: StyleKeys.MARGIN_BLOCK_START_TYPE, values: StyleKeys.MARGIN_BLOCK_START_VALUE, kind: () => 'auto', state: () => StateKeys.MARGIN },
1379
+ padding: { order: StyleKeys.PADDING_ORDER, half: 4, types: StyleKeys.PADDING_BLOCK_START_TYPE, values: StyleKeys.PADDING_BLOCK_START_VALUE, kind: () => 'length', state: () => StateKeys.PADDING },
1380
+ inset: { order: StyleKeys.INSET_ORDER, half: 4, types: StyleKeys.INSET_BLOCK_START_TYPE, values: StyleKeys.INSET_BLOCK_START_VALUE, kind: () => 'auto', state: () => StateKeys.INSET },
1381
+ size: {
1382
+ order: StyleKeys.SIZE_ORDER,
1383
+ half: 6,
1384
+ types: StyleKeys.INLINE_SIZE_TYPE,
1385
+ values: StyleKeys.INLINE_SIZE_VALUE,
1386
+ kind: (slot) => (slot < 2 ? 'dimension' : 'auto'),
1387
+ state: (slot) => (slot < 2 ? StateKeys.SIZE : slot < 4 ? StateKeys.MIN_SIZE : StateKeys.MAX_SIZE),
1388
+ },
1389
+ };
1390
+ const LOGICAL_STAMPS = [
1391
+ [StyleKeys.MARGIN_ORDER, 8],
1392
+ [StyleKeys.PADDING_ORDER, 8],
1393
+ [StyleKeys.INSET_ORDER, 8],
1394
+ [StyleKeys.SIZE_ORDER, 12],
1395
+ ];
1396
+ const stampUsed = new Uint8Array(256);
1397
+ const stampRank = new Uint8Array(256);
1398
+ /** A length in the buffer's encoding for `kind` (auto: margins, insets, min/max; length: padding; dimension: sizes). */
1399
+ function logicalTypeValue(value, kind, emBasis) {
1400
+ switch (typeof value) {
1401
+ case 'string':
1402
+ return kind === 'length' ? lengthPercentageFromString(value, emBasis) : kind === 'dimension' ? dimensionFromString(value, emBasis) : lengthPercentageAutoFromString(value, emBasis);
1403
+ case 'number':
1404
+ return { type: kind === 'length' ? 0 : 1, value: layout.toDevicePixels(value) };
1405
+ case 'object': {
1406
+ const length = value;
1407
+ if (!length)
1408
+ return undefined;
1409
+ switch (length.unit) {
1410
+ case 'dip':
1411
+ case 'px':
1412
+ return { type: kind === 'length' ? 0 : 1, value: layout.toDevicePixels(length.value) };
1413
+ case '%':
1414
+ return { type: kind === 'length' ? 1 : 2, value: length.value };
1415
+ }
1416
+ const keyword = kind === 'dimension' ? sizingKeywordOf(length) : undefined;
1417
+ return keyword ? dimensionFromString(keyword) : undefined;
1418
+ }
1419
+ }
1420
+ return undefined;
1421
+ }
1422
+ // text-spacing-trim keywords, in their buffer order.
1423
+ const TEXT_SPACING_TRIM_VALUES = ['normal', 'space-all', 'space-first', 'trim-start', 'trim-both', 'trim-all', 'auto'];
1322
1424
  const i8Buffer = new Int8Array(4);
1323
1425
  const f32Buffer = new Uint8Array(Float32Array.BYTES_PER_ELEMENT * 4);
1324
1426
  const f32View = new Float32Array(f32Buffer.buffer);
@@ -1574,6 +1676,17 @@ export function refreshViewportUnits() {
1574
1676
  style[keys[i]] = writes.get(keys[i]);
1575
1677
  }
1576
1678
  }
1679
+ // Inherited text properties a stylesheet can drop back to inheriting: their *_STATE byte.
1680
+ const INHERITED_TEXT_STATE = {
1681
+ writingMode: [StyleKeys.WRITING_MODE_STATE, StateKeys.WRITING_MODE],
1682
+ textOrientation: [StyleKeys.TEXT_ORIENTATION_STATE, StateKeys.TEXT_ORIENTATION],
1683
+ textCombineUpright: [StyleKeys.TEXT_COMBINE_UPRIGHT_STATE, StateKeys.TEXT_COMBINE_UPRIGHT],
1684
+ textSpacingTrim: [StyleKeys.TEXT_SPACING_TRIM_STATE, StateKeys.TEXT_SPACING_TRIM],
1685
+ hyphens: [StyleKeys.HYPHENS_STATE, StateKeys.HYPHENS],
1686
+ whiteSpace: [StyleKeys.WHITE_SPACE_STATE, StateKeys.WHITE_SPACE],
1687
+ wordSpacing: [StyleKeys.WORD_SPACING_STATE, StateKeys.WORD_SPACING],
1688
+ fontStretch: [StyleKeys.FONT_STRETCH_STATE, StateKeys.FONT_STRETCH],
1689
+ };
1577
1690
  export class Style {
1578
1691
  constructor() {
1579
1692
  this._bufferRequested = false;
@@ -2976,6 +3089,7 @@ export class Style {
2976
3089
  default:
2977
3090
  return;
2978
3091
  }
3092
+ this.stampPhysical('size', 0b100);
2979
3093
  this.commitState(StateKeys.MIN_SIZE);
2980
3094
  }
2981
3095
  get minHeight() {
@@ -3021,6 +3135,7 @@ export class Style {
3021
3135
  default:
3022
3136
  return;
3023
3137
  }
3138
+ this.stampPhysical('size', 0b1000);
3024
3139
  this.commitState(StateKeys.MIN_SIZE);
3025
3140
  }
3026
3141
  get width() {
@@ -3076,6 +3191,7 @@ export class Style {
3076
3191
  default:
3077
3192
  return;
3078
3193
  }
3194
+ this.stampPhysical('size', 0b1);
3079
3195
  this.commitState(StateKeys.SIZE);
3080
3196
  }
3081
3197
  get height() {
@@ -3131,6 +3247,7 @@ export class Style {
3131
3247
  default:
3132
3248
  return;
3133
3249
  }
3250
+ this.stampPhysical('size', 0b10);
3134
3251
  this.commitState(StateKeys.SIZE);
3135
3252
  }
3136
3253
  get maxWidth() {
@@ -3176,6 +3293,7 @@ export class Style {
3176
3293
  default:
3177
3294
  return;
3178
3295
  }
3296
+ this.stampPhysical('size', 0b10000);
3179
3297
  this.commitState(StateKeys.MAX_SIZE);
3180
3298
  }
3181
3299
  get maxHeight() {
@@ -3221,6 +3339,7 @@ export class Style {
3221
3339
  default:
3222
3340
  return;
3223
3341
  }
3342
+ this.stampPhysical('size', 0b100000);
3224
3343
  this.commitState(StateKeys.MAX_SIZE);
3225
3344
  }
3226
3345
  get borderLeftWidth() {
@@ -3398,6 +3517,7 @@ export class Style {
3398
3517
  this.bottom = sides[2];
3399
3518
  this.left = sides[3];
3400
3519
  this.inBatch = wasInBatch;
3520
+ this.stampPhysical('inset', 0b1111);
3401
3521
  this.commitState(StateKeys.INSET);
3402
3522
  return;
3403
3523
  }
@@ -3438,6 +3558,7 @@ export class Style {
3438
3558
  this.u8View.set(i8Buffer, StyleKeys.INSET_LEFT_TYPE);
3439
3559
  f32View.fill(insetValue);
3440
3560
  this.u8View.set(f32Buffer, StyleKeys.INSET_LEFT_VALUE);
3561
+ this.stampPhysical('inset', 0b1111);
3441
3562
  this.commitState(StateKeys.INSET);
3442
3563
  }
3443
3564
  }
@@ -3480,6 +3601,7 @@ export class Style {
3480
3601
  }
3481
3602
  break;
3482
3603
  }
3604
+ this.stampPhysical('inset', 0b1000);
3483
3605
  this.commitState(StateKeys.INSET);
3484
3606
  }
3485
3607
  get right() {
@@ -3521,6 +3643,7 @@ export class Style {
3521
3643
  }
3522
3644
  break;
3523
3645
  }
3646
+ this.stampPhysical('inset', 0b10);
3524
3647
  this.commitState(StateKeys.INSET);
3525
3648
  }
3526
3649
  get top() {
@@ -3562,6 +3685,7 @@ export class Style {
3562
3685
  }
3563
3686
  break;
3564
3687
  }
3688
+ this.stampPhysical('inset', 0b1);
3565
3689
  this.commitState(StateKeys.INSET);
3566
3690
  }
3567
3691
  get bottom() {
@@ -3603,6 +3727,7 @@ export class Style {
3603
3727
  }
3604
3728
  break;
3605
3729
  }
3730
+ this.stampPhysical('inset', 0b100);
3606
3731
  this.commitState(StateKeys.INSET);
3607
3732
  }
3608
3733
  set margin(value) {
@@ -3616,6 +3741,7 @@ export class Style {
3616
3741
  this.marginBottom = sides[2];
3617
3742
  this.marginLeft = sides[3];
3618
3743
  this.inBatch = wasInBatch;
3744
+ this.stampPhysical('margin', 0b1111);
3619
3745
  this.commitState(StateKeys.MARGIN);
3620
3746
  return;
3621
3747
  }
@@ -3656,6 +3782,7 @@ export class Style {
3656
3782
  this.u8View.set(i8Buffer, StyleKeys.MARGIN_LEFT_TYPE);
3657
3783
  f32View.fill(marginValue);
3658
3784
  this.u8View.set(f32Buffer, StyleKeys.MARGIN_LEFT_VALUE);
3785
+ this.stampPhysical('margin', 0b1111);
3659
3786
  this.commitState(StateKeys.MARGIN);
3660
3787
  }
3661
3788
  }
@@ -3698,6 +3825,7 @@ export class Style {
3698
3825
  }
3699
3826
  break;
3700
3827
  }
3828
+ this.stampPhysical('margin', 0b1000);
3701
3829
  this.commitState(StateKeys.MARGIN);
3702
3830
  }
3703
3831
  get marginRight() {
@@ -3739,6 +3867,7 @@ export class Style {
3739
3867
  }
3740
3868
  break;
3741
3869
  }
3870
+ this.stampPhysical('margin', 0b10);
3742
3871
  this.commitState(StateKeys.MARGIN);
3743
3872
  }
3744
3873
  get marginTop() {
@@ -3780,6 +3909,7 @@ export class Style {
3780
3909
  }
3781
3910
  break;
3782
3911
  }
3912
+ this.stampPhysical('margin', 0b1);
3783
3913
  this.commitState(StateKeys.MARGIN);
3784
3914
  }
3785
3915
  get marginBottom() {
@@ -3821,6 +3951,7 @@ export class Style {
3821
3951
  }
3822
3952
  break;
3823
3953
  }
3954
+ this.stampPhysical('margin', 0b100);
3824
3955
  this.commitState(StateKeys.MARGIN);
3825
3956
  }
3826
3957
  set padding(value) {
@@ -3834,6 +3965,7 @@ export class Style {
3834
3965
  this.paddingBottom = sides[2];
3835
3966
  this.paddingLeft = sides[3];
3836
3967
  this.inBatch = wasInBatch;
3968
+ this.stampPhysical('padding', 0b1111);
3837
3969
  this.commitState(StateKeys.PADDING);
3838
3970
  return;
3839
3971
  }
@@ -3842,6 +3974,7 @@ export class Style {
3842
3974
  this.inBatch = true;
3843
3975
  this.paddingBottom = this.paddingLeft = this.paddingRight = this.paddingTop = value;
3844
3976
  this.inBatch = wasInBatch;
3977
+ this.stampPhysical('padding', 0b1111);
3845
3978
  this.commitState(StateKeys.PADDING);
3846
3979
  }
3847
3980
  get paddingLeft() {
@@ -3883,6 +4016,7 @@ export class Style {
3883
4016
  }
3884
4017
  break;
3885
4018
  }
4019
+ this.stampPhysical('padding', 0b1000);
3886
4020
  this.commitState(StateKeys.PADDING);
3887
4021
  }
3888
4022
  get paddingRight() {
@@ -3924,6 +4058,7 @@ export class Style {
3924
4058
  }
3925
4059
  break;
3926
4060
  }
4061
+ this.stampPhysical('padding', 0b10);
3927
4062
  this.commitState(StateKeys.PADDING);
3928
4063
  }
3929
4064
  get paddingTop() {
@@ -3965,6 +4100,7 @@ export class Style {
3965
4100
  }
3966
4101
  break;
3967
4102
  }
4103
+ this.stampPhysical('padding', 0b1);
3968
4104
  this.commitState(StateKeys.PADDING);
3969
4105
  }
3970
4106
  get paddingBottom() {
@@ -4006,8 +4142,73 @@ export class Style {
4006
4142
  }
4007
4143
  break;
4008
4144
  }
4145
+ this.stampPhysical('padding', 0b100);
4009
4146
  this.commitState(StateKeys.PADDING);
4010
4147
  }
4148
+ // CSS logical properties: see StyleKeys.LOGICAL_SEQ.
4149
+ /** The next write stamp; at the counter's end every stamp is renumbered by rank, keeping their order. */
4150
+ nextLogicalStamp() {
4151
+ const view = this.style_view;
4152
+ let seq = getUint8(view, StyleKeys.LOGICAL_SEQ);
4153
+ if (seq === 255) {
4154
+ stampUsed.fill(0);
4155
+ for (const [order, length] of LOGICAL_STAMPS) {
4156
+ for (let i = 0; i < length; i++)
4157
+ stampUsed[getUint8(view, order + i)] = 1;
4158
+ }
4159
+ let next = 0;
4160
+ for (let stamp = 1; stamp < 256; stamp++)
4161
+ stampRank[stamp] = stampUsed[stamp] ? ++next : 0;
4162
+ for (const [order, length] of LOGICAL_STAMPS) {
4163
+ for (let i = 0; i < length; i++)
4164
+ setUint8(view, order + i, stampRank[getUint8(view, order + i)]);
4165
+ }
4166
+ seq = next;
4167
+ }
4168
+ setUint8(view, StyleKeys.LOGICAL_SEQ, seq + 1);
4169
+ return seq + 1;
4170
+ }
4171
+ /** Stamps the physical slots in `mask` as written now, so they win over older logical values. Free while the group has none. */
4172
+ stampPhysical(group, mask) {
4173
+ const { order, half } = LOGICAL_GROUPS[group];
4174
+ const view = this.style_view;
4175
+ let logical = false;
4176
+ for (let i = 0; i < half; i++) {
4177
+ if (getUint8(view, order + half + i) !== 0) {
4178
+ logical = true;
4179
+ break;
4180
+ }
4181
+ }
4182
+ if (!logical)
4183
+ return;
4184
+ const stamp = this.nextLogicalStamp();
4185
+ for (let i = 0; i < half; i++) {
4186
+ if (mask & (1 << i))
4187
+ setUint8(view, order + i, stamp);
4188
+ }
4189
+ }
4190
+ /**
4191
+ * Sets a logical side (margin, padding, inset: 0 block-start, 1 inline-end, 2 block-end,
4192
+ * 3 inline-start; size: see LOGICAL_GROUPS). null or undefined removes it, so the physical
4193
+ * value applies again.
4194
+ */
4195
+ setLogical(group, slot, value) {
4196
+ const entry = LOGICAL_GROUPS[group];
4197
+ const parsed = value == null || value === '' ? undefined : logicalTypeValue(value, entry.kind(slot), this.emBasisFor(value));
4198
+ if (value != null && value !== '' && !parsed)
4199
+ return;
4200
+ this.prepareMut();
4201
+ const view = this.style_view;
4202
+ if (parsed) {
4203
+ setUint8(view, entry.order + entry.half + slot, this.nextLogicalStamp());
4204
+ setInt8(view, entry.types + slot, parsed.type);
4205
+ setFloat32(view, entry.values + slot * 4, parsed.value);
4206
+ }
4207
+ else {
4208
+ setUint8(view, entry.order + entry.half + slot, 0);
4209
+ }
4210
+ this.commitState(entry.state(slot));
4211
+ }
4011
4212
  get gridGap() {
4012
4213
  return this.gap;
4013
4214
  }
@@ -6908,6 +7109,12 @@ export class Style {
6908
7109
  get 'mask-border-mode'() {
6909
7110
  return this.maskBorderMode;
6910
7111
  }
7112
+ /** This box's own writing-mode (0 horizontal-tb, 1 vertical-rl, 2 vertical-lr), or -1 when it inherits. */
7113
+ get ownWritingMode() {
7114
+ if (!this.style_view || !getUint8(this.style_view, StyleKeys.WRITING_MODE_STATE))
7115
+ return -1;
7116
+ return getUint8(this.style_view, StyleKeys.WRITING_MODE);
7117
+ }
6911
7118
  get writingMode() {
6912
7119
  if (!this.style_view)
6913
7120
  return 'horizontal-tb';
@@ -6951,6 +7158,110 @@ export class Style {
6951
7158
  get 'writing-mode'() {
6952
7159
  return this.writingMode;
6953
7160
  }
7161
+ get textOrientation() {
7162
+ if (!this.style_view)
7163
+ return 'mixed';
7164
+ const state = getUint8(this.style_view, StyleKeys.TEXT_ORIENTATION_STATE);
7165
+ if (!state)
7166
+ return 'mixed';
7167
+ switch (getUint8(this.style_view, StyleKeys.TEXT_ORIENTATION)) {
7168
+ case 1:
7169
+ return 'upright';
7170
+ case 2:
7171
+ return 'sideways';
7172
+ default:
7173
+ return 'mixed';
7174
+ }
7175
+ }
7176
+ set textOrientation(value) {
7177
+ let v = -1;
7178
+ switch (value) {
7179
+ case 'mixed':
7180
+ v = 0;
7181
+ break;
7182
+ case 'upright':
7183
+ v = 1;
7184
+ break;
7185
+ case 'sideways':
7186
+ case 'sideways-right':
7187
+ v = 2;
7188
+ break;
7189
+ }
7190
+ if (v === -1)
7191
+ return;
7192
+ this.prepareMut();
7193
+ setUint8(this.style_view, StyleKeys.TEXT_ORIENTATION, v);
7194
+ setUint8(this.style_view, StyleKeys.TEXT_ORIENTATION_STATE, 1);
7195
+ this.commitState(StateKeys.TEXT_ORIENTATION);
7196
+ }
7197
+ set 'text-orientation'(value) {
7198
+ this.textOrientation = value;
7199
+ }
7200
+ get 'text-orientation'() {
7201
+ return this.textOrientation;
7202
+ }
7203
+ /** text-combine-upright: `none`, `all`, or `digits` with an optional count of 2 to 4 (2 when omitted). */
7204
+ get textCombineUpright() {
7205
+ if (!this.style_view || !getUint8(this.style_view, StyleKeys.TEXT_COMBINE_UPRIGHT_STATE))
7206
+ return 'none';
7207
+ const value = getUint8(this.style_view, StyleKeys.TEXT_COMBINE_UPRIGHT);
7208
+ return value === 0 ? 'none' : value === 1 ? 'all' : `digits ${value}`;
7209
+ }
7210
+ set textCombineUpright(value) {
7211
+ const parts = String(value).trim().toLowerCase().split(/\s+/);
7212
+ let v = -1;
7213
+ if (parts.length === 1 && parts[0] === 'none')
7214
+ v = 0;
7215
+ else if (parts.length === 1 && parts[0] === 'all')
7216
+ v = 1;
7217
+ else if (parts[0] === 'digits' && parts.length <= 2) {
7218
+ const count = parts.length === 2 ? Number(parts[1]) : 2;
7219
+ if (Number.isInteger(count) && count >= 2 && count <= 4)
7220
+ v = count;
7221
+ }
7222
+ if (v === -1)
7223
+ return;
7224
+ this.prepareMut();
7225
+ setUint8(this.style_view, StyleKeys.TEXT_COMBINE_UPRIGHT, v);
7226
+ setUint8(this.style_view, StyleKeys.TEXT_COMBINE_UPRIGHT_STATE, 1);
7227
+ this.commitState(StateKeys.TEXT_COMBINE_UPRIGHT);
7228
+ }
7229
+ set 'text-combine-upright'(value) {
7230
+ this.textCombineUpright = value;
7231
+ }
7232
+ get 'text-combine-upright'() {
7233
+ return this.textCombineUpright;
7234
+ }
7235
+ /** text-spacing-trim: `normal`, `space-all`, `space-first`, `trim-start`, `trim-both`, `trim-all` or `auto`. */
7236
+ get textSpacingTrim() {
7237
+ if (!this.style_view || !getUint8(this.style_view, StyleKeys.TEXT_SPACING_TRIM_STATE))
7238
+ return 'normal';
7239
+ return TEXT_SPACING_TRIM_VALUES[getUint8(this.style_view, StyleKeys.TEXT_SPACING_TRIM)] ?? 'normal';
7240
+ }
7241
+ set textSpacingTrim(value) {
7242
+ const v = TEXT_SPACING_TRIM_VALUES.indexOf(String(value).trim().toLowerCase());
7243
+ if (v === -1)
7244
+ return;
7245
+ this.prepareMut();
7246
+ setUint8(this.style_view, StyleKeys.TEXT_SPACING_TRIM, v);
7247
+ setUint8(this.style_view, StyleKeys.TEXT_SPACING_TRIM_STATE, 1);
7248
+ this.commitState(StateKeys.TEXT_SPACING_TRIM);
7249
+ }
7250
+ set 'text-spacing-trim'(value) {
7251
+ this.textSpacingTrim = value;
7252
+ }
7253
+ get 'text-spacing-trim'() {
7254
+ return this.textSpacingTrim;
7255
+ }
7256
+ /** Lets an inherited text property inherit again, as when its declaration is removed. */
7257
+ unsetInheritedText(name) {
7258
+ const [state, key] = INHERITED_TEXT_STATE[name];
7259
+ if (!this.style_view || !getUint8(this.style_view, state))
7260
+ return;
7261
+ this.prepareMut();
7262
+ setUint8(this.style_view, state, 0);
7263
+ this.commitState(key);
7264
+ }
6954
7265
  get unicodeBidi() {
6955
7266
  if (!this.style_view)
6956
7267
  return 'normal';
@@ -7103,6 +7414,9 @@ export class Style {
7103
7414
  objectPosition: this.objectPosition,
7104
7415
  borderStyle: this.borderStyle,
7105
7416
  writingMode: this.writingMode,
7417
+ textOrientation: this.textOrientation,
7418
+ textCombineUpright: this.textCombineUpright,
7419
+ textSpacingTrim: this.textSpacingTrim,
7106
7420
  unicodeBidi: this.unicodeBidi,
7107
7421
  hyphens: this.hyphens,
7108
7422
  caretColor: this.caretColor,