@triniwiz/nativescript-masonkit 1.0.0-beta.84 → 1.0.0-beta.86
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/br/index.windows.d.ts +11 -0
- package/br/index.windows.js +31 -0
- package/br/index.windows.js.map +1 -0
- package/button/index.windows.d.ts +12 -0
- package/button/index.windows.js +44 -0
- package/button/index.windows.js.map +1 -0
- package/common.d.ts +2 -0
- package/common.js +238 -19
- package/common.js.map +1 -1
- package/img/index.windows.d.ts +12 -0
- package/img/index.windows.js +48 -0
- package/img/index.windows.js.map +1 -0
- package/index.windows.d.ts +12 -0
- package/index.windows.js +13 -0
- package/index.windows.js.map +1 -0
- package/input/index.windows.d.ts +14 -0
- package/input/index.windows.js +96 -0
- package/input/index.windows.js.map +1 -0
- package/li/index.windows.d.ts +13 -0
- package/li/index.windows.js +50 -0
- package/li/index.windows.js.map +1 -0
- package/list/common.js +0 -1
- package/list/common.js.map +1 -1
- package/list/index.ios.js +0 -1
- package/list/index.ios.js.map +1 -1
- package/list/index.windows.d.ts +21 -0
- package/list/index.windows.js +68 -0
- package/list/index.windows.js.map +1 -0
- package/package.json +6 -3
- package/platforms/android/masonkit-release.aar +0 -0
- package/platforms/ios/Mason.xcframework/Info.plist +11 -11
- package/platforms/ios/Mason.xcframework/ios-arm64/Mason.framework/Mason +0 -0
- package/platforms/ios/Mason.xcframework/ios-arm64/Mason.framework/Modules/Mason.swiftmodule/Project/arm64-apple-ios.swiftsourceinfo +0 -0
- package/platforms/ios/Mason.xcframework/ios-arm64/Mason.framework/Modules/Mason.swiftmodule/arm64-apple-ios.abi.json +2642 -11194
- package/platforms/ios/Mason.xcframework/ios-arm64/dSYMs/Mason.framework.dSYM/Contents/Resources/DWARF/Mason +0 -0
- package/platforms/ios/Mason.xcframework/ios-arm64/dSYMs/Mason.framework.dSYM/Contents/Resources/Relocations/aarch64/Mason.yml +4065 -4064
- package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Mason +0 -0
- package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Modules/Mason.swiftmodule/Project/arm64-apple-ios-simulator.swiftsourceinfo +0 -0
- package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Modules/Mason.swiftmodule/Project/x86_64-apple-ios-simulator.swiftsourceinfo +0 -0
- package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Modules/Mason.swiftmodule/arm64-apple-ios-simulator.abi.json +2642 -11194
- package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Modules/Mason.swiftmodule/x86_64-apple-ios-simulator.abi.json +2642 -11194
- package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/_CodeSignature/CodeResources +12 -12
- package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/dSYMs/Mason.framework.dSYM/Contents/Resources/DWARF/Mason +0 -0
- package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/dSYMs/Mason.framework.dSYM/Contents/Resources/Relocations/aarch64/Mason.yml +4060 -4059
- package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/dSYMs/Mason.framework.dSYM/Contents/Resources/Relocations/x86_64/Mason.yml +3898 -3897
- package/platforms/ios/Mason.xcframework/xros-arm64/Mason.framework/Mason +0 -0
- package/platforms/ios/Mason.xcframework/xros-arm64/Mason.framework/Modules/Mason.swiftmodule/Project/arm64-apple-xros.swiftsourceinfo +0 -0
- package/platforms/ios/Mason.xcframework/xros-arm64/Mason.framework/Modules/Mason.swiftmodule/arm64-apple-xros.abi.json +2642 -11194
- package/platforms/ios/Mason.xcframework/xros-arm64/dSYMs/Mason.framework.dSYM/Contents/Resources/DWARF/Mason +0 -0
- package/platforms/ios/Mason.xcframework/xros-arm64/dSYMs/Mason.framework.dSYM/Contents/Resources/Relocations/aarch64/Mason.yml +2129 -2129
- package/platforms/ios/Mason.xcframework/xros-arm64-simulator/Mason.framework/Mason +0 -0
- package/platforms/ios/Mason.xcframework/xros-arm64-simulator/Mason.framework/Modules/Mason.swiftmodule/Project/arm64-apple-xros-simulator.swiftsourceinfo +0 -0
- package/platforms/ios/Mason.xcframework/xros-arm64-simulator/Mason.framework/Modules/Mason.swiftmodule/arm64-apple-xros-simulator.abi.json +2642 -11194
- package/platforms/ios/Mason.xcframework/xros-arm64-simulator/Mason.framework/_CodeSignature/CodeResources +6 -6
- package/platforms/ios/Mason.xcframework/xros-arm64-simulator/dSYMs/Mason.framework.dSYM/Contents/Resources/DWARF/Mason +0 -0
- package/platforms/ios/Mason.xcframework/xros-arm64-simulator/dSYMs/Mason.framework.dSYM/Contents/Resources/Relocations/aarch64/Mason.yml +2129 -2129
- package/platforms/windows/arm64/NativeScript.Mason.dll +0 -0
- package/platforms/windows/arm64/NativeScript.Mason.winmd +0 -0
- package/platforms/windows/plugin.props +9 -0
- package/platforms/windows/plugin.targets +50 -0
- package/platforms/windows/x64/NativeScript.Mason.dll +0 -0
- package/platforms/windows/x64/NativeScript.Mason.winmd +0 -0
- package/scroll/index.windows.d.ts +14 -0
- package/scroll/index.windows.js +63 -0
- package/scroll/index.windows.js.map +1 -0
- package/style.d.ts +1 -0
- package/style.js +377 -5
- package/style.js.map +1 -1
- package/text/index.windows.d.ts +13 -0
- package/text/index.windows.js +39 -0
- package/text/index.windows.js.map +1 -0
- package/text-node/index.windows.d.ts +14 -0
- package/text-node/index.windows.js +42 -0
- package/text-node/index.windows.js.map +1 -0
- package/textarea/index.windows.d.ts +15 -0
- package/textarea/index.windows.js +63 -0
- package/textarea/index.windows.js.map +1 -0
- package/tree/index.windows.d.ts +36 -0
- package/tree/index.windows.js +68 -0
- package/tree/index.windows.js.map +1 -0
- package/utils/index.windows.d.ts +128 -0
- package/utils/index.windows.js +155 -0
- package/utils/index.windows.js.map +1 -0
- package/view/index.windows.d.ts +15 -0
- package/view/index.windows.js +52 -0
- package/view/index.windows.js.map +1 -0
- package/web.d.ts +2 -2
- package/web.js +2 -2
- package/web.js.map +1 -1
- package/windows-panel-helpers.d.ts +2 -0
- package/windows-panel-helpers.js +27 -0
- package/windows-panel-helpers.js.map +1 -0
package/style.js
CHANGED
|
@@ -212,6 +212,50 @@ var StyleKeys;
|
|
|
212
212
|
StyleKeys[StyleKeys["FONT_STRETCH"] = 588] = "FONT_STRETCH";
|
|
213
213
|
StyleKeys[StyleKeys["FONT_STRETCH_STATE"] = 592] = "FONT_STRETCH_STATE";
|
|
214
214
|
})(StyleKeys || (StyleKeys = {}));
|
|
215
|
+
// Windows: the native Style.UpdateGrid takes all grid strings at once. To set one while preserving
|
|
216
|
+
// the others, read the current values back from the Grid*Css getters. (Layout grid props like
|
|
217
|
+
// grid-auto-flow and gap are buffer-stored and already flow through the live style buffer.)
|
|
218
|
+
function windowsSetGrid(nativeView, field, value) {
|
|
219
|
+
const s = nativeView?.Style;
|
|
220
|
+
if (!s)
|
|
221
|
+
return;
|
|
222
|
+
const g = {
|
|
223
|
+
gridAutoRows: s.GridAutoRowsCss,
|
|
224
|
+
gridAutoColumns: s.GridAutoColumnsCss,
|
|
225
|
+
gridColumn: s.GridColumnCss,
|
|
226
|
+
gridColumnStart: s.GridColumnStartCss,
|
|
227
|
+
gridColumnEnd: s.GridColumnEndCss,
|
|
228
|
+
gridRow: s.GridRowCss,
|
|
229
|
+
gridRowStart: s.GridRowStartCss,
|
|
230
|
+
gridRowEnd: s.GridRowEndCss,
|
|
231
|
+
gridTemplateRows: s.GridTemplateRowsCss,
|
|
232
|
+
gridTemplateColumns: s.GridTemplateColumnsCss,
|
|
233
|
+
gridArea: s.GridAreaCss,
|
|
234
|
+
gridTemplateAreas: s.GridTemplateAreasCss,
|
|
235
|
+
};
|
|
236
|
+
g[field] = value ?? '';
|
|
237
|
+
// `grid-row` / `grid-column` are SHORTHANDS for their `{start,end}` pair. UpdateGrid applies the
|
|
238
|
+
// shorthand first and then the start/end parts — and the parts (read back here as their defaults
|
|
239
|
+
// before this change) would overwrite the span we just set, collapsing the item to a single track.
|
|
240
|
+
// Derive start/end from the shorthand so the three stay consistent (`span 2` -> start `span 2`,
|
|
241
|
+
// end auto; `1 / 3` -> start `1`, end `3`).
|
|
242
|
+
if (field === 'gridRow' || field === 'gridColumn') {
|
|
243
|
+
const parts = String(value ?? '')
|
|
244
|
+
.split('/')
|
|
245
|
+
.map((p) => p.trim());
|
|
246
|
+
g[field + 'Start'] = parts[0] ?? '';
|
|
247
|
+
g[field + 'End'] = parts.length > 1 ? (parts[1] ?? '') : '';
|
|
248
|
+
}
|
|
249
|
+
s.UpdateGrid(g.gridAutoRows, g.gridAutoColumns, g.gridColumn, g.gridColumnStart, g.gridColumnEnd, g.gridRow, g.gridRowStart, g.gridRowEnd, g.gridTemplateRows, g.gridTemplateColumns, g.gridArea, g.gridTemplateAreas);
|
|
250
|
+
// UpdateGrid mutates the node's (non-buffer) grid placement directly; unlike a buffer write it does
|
|
251
|
+
// not mark the node dirty / invalidate XAML measure, so a grid ITEM's placement change wouldn't
|
|
252
|
+
// re-run the parent container's grid layout. SyncStyle marks the node dirty + InvalidateMeasure,
|
|
253
|
+
// which propagates up to the container.
|
|
254
|
+
try {
|
|
255
|
+
nativeView.SyncStyle('0', '0');
|
|
256
|
+
}
|
|
257
|
+
catch (_) { }
|
|
258
|
+
}
|
|
215
259
|
function parseLengthPercentageAuto(type, value) {
|
|
216
260
|
switch (type) {
|
|
217
261
|
case 0:
|
|
@@ -383,6 +427,154 @@ const getFloat32 = (view, offset) => {
|
|
|
383
427
|
const setFloat32 = (view, offset, value) => {
|
|
384
428
|
view.setFloat32(offset, value, true);
|
|
385
429
|
};
|
|
430
|
+
// Split a comma-separated list at top level only (commas inside parentheses, e.g. rgba(0,0,0,.5),
|
|
431
|
+
// are kept with their token).
|
|
432
|
+
function splitTopLevelCommas(s) {
|
|
433
|
+
const out = [];
|
|
434
|
+
let depth = 0;
|
|
435
|
+
let cur = '';
|
|
436
|
+
for (const ch of s) {
|
|
437
|
+
if (ch === '(')
|
|
438
|
+
depth++;
|
|
439
|
+
else if (ch === ')')
|
|
440
|
+
depth = Math.max(0, depth - 1);
|
|
441
|
+
if (ch === ',' && depth === 0) {
|
|
442
|
+
out.push(cur);
|
|
443
|
+
cur = '';
|
|
444
|
+
}
|
|
445
|
+
else {
|
|
446
|
+
cur += ch;
|
|
447
|
+
}
|
|
448
|
+
}
|
|
449
|
+
if (cur.trim().length)
|
|
450
|
+
out.push(cur);
|
|
451
|
+
return out;
|
|
452
|
+
}
|
|
453
|
+
// Map a CSS gradient direction token to a CSS angle in degrees (0deg = to top, 90deg = to right).
|
|
454
|
+
function parseGradientAngle(token) {
|
|
455
|
+
const t = token.trim().toLowerCase();
|
|
456
|
+
const deg = /^(-?[\d.]+)deg$/.exec(t);
|
|
457
|
+
if (deg)
|
|
458
|
+
return parseFloat(deg[1]);
|
|
459
|
+
if (/^(-?[\d.]+)turn$/.exec(t))
|
|
460
|
+
return parseFloat(t) * 360;
|
|
461
|
+
if (/^(-?[\d.]+)rad$/.exec(t))
|
|
462
|
+
return (parseFloat(t) * 180) / Math.PI;
|
|
463
|
+
if (t === 'to top')
|
|
464
|
+
return 0;
|
|
465
|
+
if (t === 'to right')
|
|
466
|
+
return 90;
|
|
467
|
+
if (t === 'to bottom')
|
|
468
|
+
return 180;
|
|
469
|
+
if (t === 'to left')
|
|
470
|
+
return 270;
|
|
471
|
+
if (t === 'to top right' || t === 'to right top')
|
|
472
|
+
return 45;
|
|
473
|
+
if (t === 'to bottom right' || t === 'to right bottom')
|
|
474
|
+
return 135;
|
|
475
|
+
if (t === 'to bottom left' || t === 'to left bottom')
|
|
476
|
+
return 225;
|
|
477
|
+
if (t === 'to top left' || t === 'to left top')
|
|
478
|
+
return 315;
|
|
479
|
+
return 180; // CSS default is 'to bottom'
|
|
480
|
+
}
|
|
481
|
+
// Parse `linear-gradient(<dir>?, <color> <stop>?, ...)` into a CSS angle + per-stop argb + offsets.
|
|
482
|
+
function parseLinearGradientCss(value) {
|
|
483
|
+
const m = /linear-gradient\s*\(([\s\S]*)\)\s*$/i.exec(value.trim());
|
|
484
|
+
if (!m)
|
|
485
|
+
return null;
|
|
486
|
+
const parts = splitTopLevelCommas(m[1])
|
|
487
|
+
.map((p) => p.trim())
|
|
488
|
+
.filter(Boolean);
|
|
489
|
+
if (parts.length < 2)
|
|
490
|
+
return null;
|
|
491
|
+
let angle = 180;
|
|
492
|
+
let start = 0;
|
|
493
|
+
if (/^(to\s|-?[\d.]+(deg|rad|turn))/i.test(parts[0])) {
|
|
494
|
+
angle = parseGradientAngle(parts[0]);
|
|
495
|
+
start = 1;
|
|
496
|
+
}
|
|
497
|
+
const colors = [];
|
|
498
|
+
const offsets = [];
|
|
499
|
+
const stops = parts.slice(start);
|
|
500
|
+
for (let i = 0; i < stops.length; i++) {
|
|
501
|
+
// A stop is `<color> [<percentage>]`; the color is everything up to a trailing % offset.
|
|
502
|
+
const stop = stops[i];
|
|
503
|
+
const pct = /\s+(-?[\d.]+)%\s*$/.exec(stop);
|
|
504
|
+
const colorStr = pct ? stop.slice(0, pct.index).trim() : stop;
|
|
505
|
+
const argb = normalizeColorValue(colorStr);
|
|
506
|
+
if (argb == null)
|
|
507
|
+
continue;
|
|
508
|
+
colors.push(argb >>> 0);
|
|
509
|
+
offsets.push(pct ? parseFloat(pct[1]) / 100 : -1);
|
|
510
|
+
}
|
|
511
|
+
if (colors.length < 1)
|
|
512
|
+
return null;
|
|
513
|
+
// Fill any unspecified offsets evenly across [0,1].
|
|
514
|
+
for (let i = 0; i < offsets.length; i++) {
|
|
515
|
+
if (offsets[i] < 0)
|
|
516
|
+
offsets[i] = offsets.length > 1 ? i / (offsets.length - 1) : 0;
|
|
517
|
+
}
|
|
518
|
+
return { angle, offsets, colors };
|
|
519
|
+
}
|
|
520
|
+
// Parse one side of a padding/margin shorthand into a Length the buffer setters accept.
|
|
521
|
+
function parseSideLength(tok) {
|
|
522
|
+
if (typeof tok === 'number')
|
|
523
|
+
return tok;
|
|
524
|
+
const t = String(tok).trim();
|
|
525
|
+
if (t === 'auto')
|
|
526
|
+
return 'auto';
|
|
527
|
+
const m = /^(-?[\d.]+)(px|%)?$/.exec(t);
|
|
528
|
+
if (!m)
|
|
529
|
+
return 0;
|
|
530
|
+
const n = parseFloat(m[1]);
|
|
531
|
+
if (m[2] === 'px')
|
|
532
|
+
return { value: n, unit: 'px' };
|
|
533
|
+
if (m[2] === '%')
|
|
534
|
+
return { value: n, unit: '%' };
|
|
535
|
+
return n; // bare number = dip
|
|
536
|
+
}
|
|
537
|
+
// Expand a CSS padding/margin shorthand (number or 1-4 space-separated values) to per-side lengths.
|
|
538
|
+
function parseSidesShorthand(value) {
|
|
539
|
+
if (typeof value === 'number')
|
|
540
|
+
return { top: value, right: value, bottom: value, left: value };
|
|
541
|
+
const parts = String(value ?? '')
|
|
542
|
+
.trim()
|
|
543
|
+
.split(/\s+/)
|
|
544
|
+
.filter(Boolean)
|
|
545
|
+
.map(parseSideLength);
|
|
546
|
+
switch (parts.length) {
|
|
547
|
+
case 1:
|
|
548
|
+
return { top: parts[0], right: parts[0], bottom: parts[0], left: parts[0] };
|
|
549
|
+
case 2:
|
|
550
|
+
return { top: parts[0], right: parts[1], bottom: parts[0], left: parts[1] };
|
|
551
|
+
case 3:
|
|
552
|
+
return { top: parts[0], right: parts[1], bottom: parts[2], left: parts[1] };
|
|
553
|
+
case 4:
|
|
554
|
+
return { top: parts[0], right: parts[1], bottom: parts[2], left: parts[3] };
|
|
555
|
+
default:
|
|
556
|
+
return { top: 0, right: 0, bottom: 0, left: 0 };
|
|
557
|
+
}
|
|
558
|
+
}
|
|
559
|
+
// Parse a CSS `border-radius` shorthand into per-corner px radii. Handles 1-4 space-separated
|
|
560
|
+
// values (CSS order: top-left, top-right, bottom-right, bottom-left) and ignores the optional
|
|
561
|
+
// `/ <vertical>` part (we treat radii as circular). `parseFloat` strips the `px` unit.
|
|
562
|
+
function parseBorderRadiusShorthand(value) {
|
|
563
|
+
const horizontal = String(value ?? '')
|
|
564
|
+
.split('/')[0]
|
|
565
|
+
.trim();
|
|
566
|
+
const vals = horizontal.length ? horizontal.split(/\s+/).map((v) => parseFloat(v) || 0) : [0];
|
|
567
|
+
switch (vals.length) {
|
|
568
|
+
case 1:
|
|
569
|
+
return { tl: vals[0], tr: vals[0], br: vals[0], bl: vals[0] };
|
|
570
|
+
case 2:
|
|
571
|
+
return { tl: vals[0], tr: vals[1], br: vals[0], bl: vals[1] };
|
|
572
|
+
case 3:
|
|
573
|
+
return { tl: vals[0], tr: vals[1], br: vals[2], bl: vals[1] };
|
|
574
|
+
default:
|
|
575
|
+
return { tl: vals[0], tr: vals[1], br: vals[2], bl: vals[3] };
|
|
576
|
+
}
|
|
577
|
+
}
|
|
386
578
|
const i8Buffer = new Int8Array(4);
|
|
387
579
|
const f32Buffer = new Uint8Array(Float32Array.BYTES_PER_ELEMENT * 4);
|
|
388
580
|
const f32View = new Float32Array(f32Buffer.buffer);
|
|
@@ -515,6 +707,20 @@ export class Style {
|
|
|
515
707
|
ret.i8View = new Int8Array(buffer);
|
|
516
708
|
ret.u8View = new Uint8Array(buffer);
|
|
517
709
|
}
|
|
710
|
+
else if (__WINDOWS__) {
|
|
711
|
+
let style = nativeView?.Style;
|
|
712
|
+
if (!style) {
|
|
713
|
+
style = NativeScript.Mason.Mason.Instance().CreateNode(false).Style;
|
|
714
|
+
}
|
|
715
|
+
// Live IBuffer over the engine's arena style memory; the @nativescript/windows runtime
|
|
716
|
+
// projects it as a writable ArrayBuffer, so the same StyleKeys-offset writes used on
|
|
717
|
+
// iOS/Android land straight in the node's style.
|
|
718
|
+
//@ts-ignore
|
|
719
|
+
const buffer = NSWinRT.interop.arrayBufferFromBuffer(style.Values);
|
|
720
|
+
ret.style_view = new DataView(buffer);
|
|
721
|
+
ret.i8View = new Int8Array(buffer);
|
|
722
|
+
ret.u8View = new Uint8Array(buffer);
|
|
723
|
+
}
|
|
518
724
|
//console.timeEnd('fromView');
|
|
519
725
|
return ret;
|
|
520
726
|
}
|
|
@@ -626,6 +832,89 @@ export class Style {
|
|
|
626
832
|
applyApple();
|
|
627
833
|
}
|
|
628
834
|
}
|
|
835
|
+
if (__WINDOWS__) {
|
|
836
|
+
// Android/Apple parse these CSS-string props in native setters; on Windows we write the
|
|
837
|
+
// buffer-backed ones (border-radius) directly to the live style buffer so VisualApply renders
|
|
838
|
+
// them. Border stroke / box-shadow / gradients still need the Css decoration overlay (TODO).
|
|
839
|
+
this.applyWindowsCssString(name, value);
|
|
840
|
+
}
|
|
841
|
+
}
|
|
842
|
+
// Apply a CSS-string property on Windows. Buffer-backed props (border-radius) are written to the
|
|
843
|
+
// live style buffer for VisualApply; gradients use the native Css helper to paint the Panel
|
|
844
|
+
// background directly.
|
|
845
|
+
applyWindowsCssString(name, value) {
|
|
846
|
+
// `background` shorthand: gradient -> native Css gradient brush; solid color -> BACKGROUND_COLOR
|
|
847
|
+
// buffer (VisualApply paints it). Switching between them must override the other, so a gradient
|
|
848
|
+
// clears the solid bg first, and a solid write lets VisualApply repaint over a prior gradient brush.
|
|
849
|
+
if (name === 'background' || name === 'background-image') {
|
|
850
|
+
const v = typeof value === 'string' ? value : String(value ?? '');
|
|
851
|
+
if (/linear-gradient/i.test(v)) {
|
|
852
|
+
const g = parseLinearGradientCss(v);
|
|
853
|
+
if (g && g.colors.length) {
|
|
854
|
+
if (this.style_view) {
|
|
855
|
+
this.prepareMut();
|
|
856
|
+
setUint32(this.style_view, StyleKeys.BACKGROUND_COLOR, 0);
|
|
857
|
+
this.commitState(StateKeys.BACKGROUND_COLOR);
|
|
858
|
+
}
|
|
859
|
+
try {
|
|
860
|
+
// Pass stops as an "offset:argb,..." string — WinRT array_view params don't marshal
|
|
861
|
+
// reliably from the NS-Windows JS runtime (plain arrays -> E_FAIL, typed arrays -> crash).
|
|
862
|
+
const stops = g.offsets.map((o, i) => o + ':' + (g.colors[i] >>> 0)).join(',');
|
|
863
|
+
NativeScript.Mason.Css.ApplyLinearGradient(this.nativeView, g.angle, stops);
|
|
864
|
+
}
|
|
865
|
+
catch (_) { }
|
|
866
|
+
}
|
|
867
|
+
}
|
|
868
|
+
else if (v.trim().length && !/gradient/i.test(v)) {
|
|
869
|
+
// Solid color background; reuse the backgroundColor buffer setter -> VisualApply repaints,
|
|
870
|
+
// overriding any gradient brush set previously.
|
|
871
|
+
this.backgroundColor = v;
|
|
872
|
+
}
|
|
873
|
+
return;
|
|
874
|
+
}
|
|
875
|
+
// padding / margin SHORTHANDS route here (paddingProperty/marginProperty -> paddingCss/marginCss).
|
|
876
|
+
// Expand to the per-side buffer setters, which Mason already applies in layout.
|
|
877
|
+
if (name === 'padding' || name === 'margin') {
|
|
878
|
+
const s = parseSidesShorthand(value);
|
|
879
|
+
if (name === 'padding') {
|
|
880
|
+
this.paddingTop = s.top;
|
|
881
|
+
this.paddingRight = s.right;
|
|
882
|
+
this.paddingBottom = s.bottom;
|
|
883
|
+
this.paddingLeft = s.left;
|
|
884
|
+
}
|
|
885
|
+
else {
|
|
886
|
+
this.marginTop = s.top;
|
|
887
|
+
this.marginRight = s.right;
|
|
888
|
+
this.marginBottom = s.bottom;
|
|
889
|
+
this.marginLeft = s.left;
|
|
890
|
+
}
|
|
891
|
+
return;
|
|
892
|
+
}
|
|
893
|
+
if (!this.style_view) {
|
|
894
|
+
return;
|
|
895
|
+
}
|
|
896
|
+
if (name === 'border-radius') {
|
|
897
|
+
const r = parseBorderRadiusShorthand(value);
|
|
898
|
+
this.prepareMut();
|
|
899
|
+
setFloat32(this.style_view, StyleKeys.BORDER_RADIUS_TOP_LEFT_X_VALUE, r.tl);
|
|
900
|
+
setFloat32(this.style_view, StyleKeys.BORDER_RADIUS_TOP_LEFT_Y_VALUE, r.tl);
|
|
901
|
+
setFloat32(this.style_view, StyleKeys.BORDER_RADIUS_TOP_RIGHT_X_VALUE, r.tr);
|
|
902
|
+
setFloat32(this.style_view, StyleKeys.BORDER_RADIUS_TOP_RIGHT_Y_VALUE, r.tr);
|
|
903
|
+
setFloat32(this.style_view, StyleKeys.BORDER_RADIUS_BOTTOM_RIGHT_X_VALUE, r.br);
|
|
904
|
+
setFloat32(this.style_view, StyleKeys.BORDER_RADIUS_BOTTOM_RIGHT_Y_VALUE, r.br);
|
|
905
|
+
setFloat32(this.style_view, StyleKeys.BORDER_RADIUS_BOTTOM_LEFT_X_VALUE, r.bl);
|
|
906
|
+
setFloat32(this.style_view, StyleKeys.BORDER_RADIUS_BOTTOM_LEFT_Y_VALUE, r.bl);
|
|
907
|
+
// Type bytes: 0 = length (px).
|
|
908
|
+
setUint8(this.style_view, StyleKeys.BORDER_RADIUS_TOP_LEFT_X_TYPE, 0);
|
|
909
|
+
setUint8(this.style_view, StyleKeys.BORDER_RADIUS_TOP_LEFT_Y_TYPE, 0);
|
|
910
|
+
setUint8(this.style_view, StyleKeys.BORDER_RADIUS_TOP_RIGHT_X_TYPE, 0);
|
|
911
|
+
setUint8(this.style_view, StyleKeys.BORDER_RADIUS_TOP_RIGHT_Y_TYPE, 0);
|
|
912
|
+
setUint8(this.style_view, StyleKeys.BORDER_RADIUS_BOTTOM_RIGHT_X_TYPE, 0);
|
|
913
|
+
setUint8(this.style_view, StyleKeys.BORDER_RADIUS_BOTTOM_RIGHT_Y_TYPE, 0);
|
|
914
|
+
setUint8(this.style_view, StyleKeys.BORDER_RADIUS_BOTTOM_LEFT_X_TYPE, 0);
|
|
915
|
+
setUint8(this.style_view, StyleKeys.BORDER_RADIUS_BOTTOM_LEFT_Y_TYPE, 0);
|
|
916
|
+
this.commitState(StateKeys.BORDER_RADIUS);
|
|
917
|
+
}
|
|
629
918
|
}
|
|
630
919
|
resetState() {
|
|
631
920
|
this.isDirty = -1n;
|
|
@@ -643,6 +932,11 @@ export class Style {
|
|
|
643
932
|
// @ts-ignore
|
|
644
933
|
view.mason_syncStyle(low, high);
|
|
645
934
|
}
|
|
935
|
+
else if (__WINDOWS__) {
|
|
936
|
+
// @ts-ignore
|
|
937
|
+
const view = this.view?.windows ?? this.view._view;
|
|
938
|
+
view.SyncStyle(low, high);
|
|
939
|
+
}
|
|
646
940
|
this.resetState();
|
|
647
941
|
}
|
|
648
942
|
setOrAppendState(value) {
|
|
@@ -709,6 +1003,17 @@ export class Style {
|
|
|
709
1003
|
this.i8View = new Int8Array(buffer);
|
|
710
1004
|
this.u8View = new Uint8Array(buffer);
|
|
711
1005
|
}
|
|
1006
|
+
if (__WINDOWS__) {
|
|
1007
|
+
let style = this.nativeView?.Style;
|
|
1008
|
+
if (!style) {
|
|
1009
|
+
style = NativeScript.Mason.Mason.Instance().CreateNode(false).Style;
|
|
1010
|
+
}
|
|
1011
|
+
style.PrepareForMutation();
|
|
1012
|
+
const buffer = style.Values;
|
|
1013
|
+
this.style_view = new DataView(buffer);
|
|
1014
|
+
this.i8View = new Int8Array(buffer);
|
|
1015
|
+
this.u8View = new Uint8Array(buffer);
|
|
1016
|
+
}
|
|
712
1017
|
}
|
|
713
1018
|
}
|
|
714
1019
|
get boxSizing() {
|
|
@@ -1212,10 +1517,27 @@ export class Style {
|
|
|
1212
1517
|
}
|
|
1213
1518
|
set width(value) {
|
|
1214
1519
|
switch (typeof value) {
|
|
1215
|
-
case 'string':
|
|
1520
|
+
case 'string': {
|
|
1521
|
+
// Parse the string instead of forcing `auto`. Reactively-applied sizes arrive as strings
|
|
1522
|
+
// ("48", "48px", "50%") — the old stub dropped them to auto (0), so dynamically-added boxes
|
|
1523
|
+
// rendered 0x0. unitless/dip → device pixels; px → as-is; % → percent.
|
|
1216
1524
|
this.prepareMut();
|
|
1217
|
-
|
|
1525
|
+
const t = value.trim();
|
|
1526
|
+
if (t === '' || t === 'auto') {
|
|
1527
|
+
setInt8(this.style_view, StyleKeys.WIDTH_TYPE, 0);
|
|
1528
|
+
setFloat32(this.style_view, StyleKeys.WIDTH_VALUE, 0);
|
|
1529
|
+
}
|
|
1530
|
+
else if (t.endsWith('%')) {
|
|
1531
|
+
setInt8(this.style_view, StyleKeys.WIDTH_TYPE, 2);
|
|
1532
|
+
setFloat32(this.style_view, StyleKeys.WIDTH_VALUE, parseFloat(t) || 0);
|
|
1533
|
+
}
|
|
1534
|
+
else {
|
|
1535
|
+
const n = parseFloat(t) || 0;
|
|
1536
|
+
setInt8(this.style_view, StyleKeys.WIDTH_TYPE, 1);
|
|
1537
|
+
setFloat32(this.style_view, StyleKeys.WIDTH_VALUE, t.endsWith('px') ? n : layout.toDevicePixels(n));
|
|
1538
|
+
}
|
|
1218
1539
|
break;
|
|
1540
|
+
}
|
|
1219
1541
|
case 'number':
|
|
1220
1542
|
this.prepareMut();
|
|
1221
1543
|
setInt8(this.style_view, StyleKeys.WIDTH_TYPE, 1);
|
|
@@ -1250,11 +1572,25 @@ export class Style {
|
|
|
1250
1572
|
}
|
|
1251
1573
|
set height(value) {
|
|
1252
1574
|
switch (typeof value) {
|
|
1253
|
-
case 'string':
|
|
1575
|
+
case 'string': {
|
|
1576
|
+
// Parse the string (see width setter) — the old stub forced auto/0, breaking string sizes.
|
|
1254
1577
|
this.prepareMut();
|
|
1255
|
-
|
|
1256
|
-
|
|
1578
|
+
const t = value.trim();
|
|
1579
|
+
if (t === '' || t === 'auto') {
|
|
1580
|
+
setInt8(this.style_view, StyleKeys.HEIGHT_TYPE, 0);
|
|
1581
|
+
setFloat32(this.style_view, StyleKeys.HEIGHT_VALUE, 0);
|
|
1582
|
+
}
|
|
1583
|
+
else if (t.endsWith('%')) {
|
|
1584
|
+
setInt8(this.style_view, StyleKeys.HEIGHT_TYPE, 2);
|
|
1585
|
+
setFloat32(this.style_view, StyleKeys.HEIGHT_VALUE, parseFloat(t) || 0);
|
|
1586
|
+
}
|
|
1587
|
+
else {
|
|
1588
|
+
const n = parseFloat(t) || 0;
|
|
1589
|
+
setInt8(this.style_view, StyleKeys.HEIGHT_TYPE, 1);
|
|
1590
|
+
setFloat32(this.style_view, StyleKeys.HEIGHT_VALUE, t.endsWith('px') ? n : layout.toDevicePixels(n));
|
|
1591
|
+
}
|
|
1257
1592
|
break;
|
|
1593
|
+
}
|
|
1258
1594
|
case 'number':
|
|
1259
1595
|
this.prepareMut();
|
|
1260
1596
|
setInt8(this.style_view, StyleKeys.HEIGHT_TYPE, 1);
|
|
@@ -2520,6 +2856,9 @@ export class Style {
|
|
|
2520
2856
|
if (__APPLE__) {
|
|
2521
2857
|
this.nativeView.style.gridAutoRows = value;
|
|
2522
2858
|
}
|
|
2859
|
+
if (__WINDOWS__) {
|
|
2860
|
+
windowsSetGrid(this.nativeView, 'gridAutoRows', value);
|
|
2861
|
+
}
|
|
2523
2862
|
}
|
|
2524
2863
|
get gridAutoColumns() {
|
|
2525
2864
|
if (!this.nativeView) {
|
|
@@ -2543,6 +2882,9 @@ export class Style {
|
|
|
2543
2882
|
if (__APPLE__) {
|
|
2544
2883
|
this.nativeView.style.gridAutoColumns = value;
|
|
2545
2884
|
}
|
|
2885
|
+
if (__WINDOWS__) {
|
|
2886
|
+
windowsSetGrid(this.nativeView, 'gridAutoColumns', value);
|
|
2887
|
+
}
|
|
2546
2888
|
}
|
|
2547
2889
|
get gridAutoFlow() {
|
|
2548
2890
|
switch (getInt8(this.style_view, StyleKeys.GRID_AUTO_FLOW)) {
|
|
@@ -2586,6 +2928,9 @@ export class Style {
|
|
|
2586
2928
|
if (__APPLE__) {
|
|
2587
2929
|
this.nativeView.style.gridColumn = value;
|
|
2588
2930
|
}
|
|
2931
|
+
if (__WINDOWS__) {
|
|
2932
|
+
windowsSetGrid(this.nativeView, 'gridColumn', value);
|
|
2933
|
+
}
|
|
2589
2934
|
}
|
|
2590
2935
|
get gridColumn() {
|
|
2591
2936
|
if (!this.nativeView) {
|
|
@@ -2621,6 +2966,9 @@ export class Style {
|
|
|
2621
2966
|
if (__APPLE__) {
|
|
2622
2967
|
this.nativeView.style.gridColumnStart = value;
|
|
2623
2968
|
}
|
|
2969
|
+
if (__WINDOWS__) {
|
|
2970
|
+
windowsSetGrid(this.nativeView, 'gridColumnStart', value);
|
|
2971
|
+
}
|
|
2624
2972
|
}
|
|
2625
2973
|
get gridColumnEnd() {
|
|
2626
2974
|
if (!this.nativeView) {
|
|
@@ -2644,6 +2992,9 @@ export class Style {
|
|
|
2644
2992
|
if (__APPLE__) {
|
|
2645
2993
|
this.nativeView.style.gridColumnEnd = value;
|
|
2646
2994
|
}
|
|
2995
|
+
if (__WINDOWS__) {
|
|
2996
|
+
windowsSetGrid(this.nativeView, 'gridColumnEnd', value);
|
|
2997
|
+
}
|
|
2647
2998
|
}
|
|
2648
2999
|
set gridRow(value) {
|
|
2649
3000
|
if (!this.nativeView) {
|
|
@@ -2655,6 +3006,9 @@ export class Style {
|
|
|
2655
3006
|
if (__APPLE__) {
|
|
2656
3007
|
this.nativeView.style.gridRow = value;
|
|
2657
3008
|
}
|
|
3009
|
+
if (__WINDOWS__) {
|
|
3010
|
+
windowsSetGrid(this.nativeView, 'gridRow', value);
|
|
3011
|
+
}
|
|
2658
3012
|
}
|
|
2659
3013
|
get gridRow() {
|
|
2660
3014
|
if (!this.nativeView) {
|
|
@@ -2690,6 +3044,9 @@ export class Style {
|
|
|
2690
3044
|
if (__APPLE__) {
|
|
2691
3045
|
this.nativeView.style.gridRowStart = value;
|
|
2692
3046
|
}
|
|
3047
|
+
if (__WINDOWS__) {
|
|
3048
|
+
windowsSetGrid(this.nativeView, 'gridRowStart', value);
|
|
3049
|
+
}
|
|
2693
3050
|
}
|
|
2694
3051
|
get gridRowEnd() {
|
|
2695
3052
|
if (!this.nativeView) {
|
|
@@ -2713,6 +3070,9 @@ export class Style {
|
|
|
2713
3070
|
if (__APPLE__) {
|
|
2714
3071
|
this.nativeView.style.gridRowEnd = value;
|
|
2715
3072
|
}
|
|
3073
|
+
if (__WINDOWS__) {
|
|
3074
|
+
windowsSetGrid(this.nativeView, 'gridRowEnd', value);
|
|
3075
|
+
}
|
|
2716
3076
|
}
|
|
2717
3077
|
set gridArea(value) {
|
|
2718
3078
|
if (!this.nativeView) {
|
|
@@ -2724,6 +3084,9 @@ export class Style {
|
|
|
2724
3084
|
if (__APPLE__) {
|
|
2725
3085
|
this.nativeView.style.gridArea = value;
|
|
2726
3086
|
}
|
|
3087
|
+
if (__WINDOWS__) {
|
|
3088
|
+
windowsSetGrid(this.nativeView, 'gridArea', value);
|
|
3089
|
+
}
|
|
2727
3090
|
}
|
|
2728
3091
|
get gridArea() {
|
|
2729
3092
|
if (!this.nativeView) {
|
|
@@ -2750,6 +3113,9 @@ export class Style {
|
|
|
2750
3113
|
if (__APPLE__) {
|
|
2751
3114
|
this.nativeView.style.gridTemplateRows = value;
|
|
2752
3115
|
}
|
|
3116
|
+
if (__WINDOWS__) {
|
|
3117
|
+
windowsSetGrid(this.nativeView, 'gridTemplateRows', value);
|
|
3118
|
+
}
|
|
2753
3119
|
}
|
|
2754
3120
|
get gridTemplateRows() {
|
|
2755
3121
|
if (!this.nativeView) {
|
|
@@ -2788,6 +3154,9 @@ export class Style {
|
|
|
2788
3154
|
if (__APPLE__) {
|
|
2789
3155
|
this.nativeView.style.gridTemplateColumns = value;
|
|
2790
3156
|
}
|
|
3157
|
+
if (__WINDOWS__) {
|
|
3158
|
+
windowsSetGrid(this.nativeView, 'gridTemplateColumns', value);
|
|
3159
|
+
}
|
|
2791
3160
|
}
|
|
2792
3161
|
get gridTemplateAreas() {
|
|
2793
3162
|
if (!this.nativeView) {
|
|
@@ -2813,6 +3182,9 @@ export class Style {
|
|
|
2813
3182
|
if (__APPLE__) {
|
|
2814
3183
|
this.nativeView.style.gridTemplateAreas = value;
|
|
2815
3184
|
}
|
|
3185
|
+
if (__WINDOWS__) {
|
|
3186
|
+
windowsSetGrid(this.nativeView, 'gridTemplateAreas', value);
|
|
3187
|
+
}
|
|
2816
3188
|
}
|
|
2817
3189
|
get overflow() {
|
|
2818
3190
|
const x = this.overflowX;
|