@triniwiz/nativescript-masonkit 1.0.0-beta.120 → 1.0.0-beta.121
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/README.md +67 -27
- package/angular/README.md +7 -9
- package/button/index.windows.js +1 -1
- package/button/index.windows.js.map +1 -1
- package/common.d.ts +8 -2
- package/common.js +45 -30
- package/common.js.map +1 -1
- package/css-shorthands.js +14 -2
- package/css-shorthands.js.map +1 -1
- package/display-density.d.ts +9 -0
- package/display-density.js +21 -0
- package/display-density.js.map +1 -0
- package/foreign-layout.js +1 -1
- package/foreign-layout.js.map +1 -1
- package/gradient-stops.d.ts +17 -0
- package/gradient-stops.js +66 -0
- package/gradient-stops.js.map +1 -1
- package/index.d.ts +6 -3
- package/index.ios.d.ts +3 -0
- package/index.ios.js +3 -0
- package/index.ios.js.map +1 -1
- package/index.windows.d.ts +1 -1
- package/index.windows.js +1 -1
- package/index.windows.js.map +1 -1
- package/{html-windows.js → inner-html.windows.js} +6 -1
- package/inner-html.windows.js.map +1 -0
- package/input/index.ios.d.ts +2 -0
- package/input/index.ios.js +7 -0
- package/input/index.ios.js.map +1 -1
- package/input/index.windows.js +1 -1
- package/input/index.windows.js.map +1 -1
- package/li/index.windows.js +1 -1
- package/li/index.windows.js.map +1 -1
- package/list/index.windows.js +1 -1
- package/list/index.windows.js.map +1 -1
- package/mask.d.ts +54 -0
- package/mask.js +27 -0
- package/mask.js.map +1 -0
- package/{windows-mask.d.ts → mask.windows.d.ts} +24 -30
- package/{windows-mask.js → mask.windows.js} +97 -11
- package/mask.windows.js.map +1 -0
- package/nativescript.webpack.js +35 -0
- package/package.json +1 -1
- package/panel-helpers.d.ts +3 -0
- package/panel-helpers.js +9 -0
- package/panel-helpers.js.map +1 -0
- package/{windows-panel-helpers.js → panel-helpers.windows.js} +1 -1
- package/{windows-panel-helpers.js.map → panel-helpers.windows.js.map} +1 -1
- package/platforms/android/masonkit-release.aar +0 -0
- package/platforms/ios/Mason.xcframework/Info.plist +4 -4
- package/platforms/ios/Mason.xcframework/ios-arm64/Mason.framework/Headers/Mason-Swift.h +11 -2
- package/platforms/ios/Mason.xcframework/ios-arm64/Mason.framework/Headers/mason_native.h +10 -0
- 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 +7069 -15103
- package/platforms/ios/Mason.xcframework/ios-arm64/Mason.framework/Modules/Mason.swiftmodule/arm64-apple-ios.private.swiftinterface +17 -5
- package/platforms/ios/Mason.xcframework/ios-arm64/Mason.framework/Modules/Mason.swiftmodule/arm64-apple-ios.swiftdoc +0 -0
- package/platforms/ios/Mason.xcframework/ios-arm64/Mason.framework/Modules/Mason.swiftmodule/arm64-apple-ios.swiftinterface +17 -5
- 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 +9735 -9456
- package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Headers/Mason-Swift.h +22 -4
- package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Headers/mason_native.h +10 -0
- 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 +7069 -15103
- package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Modules/Mason.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface +17 -5
- package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Modules/Mason.swiftmodule/arm64-apple-ios-simulator.swiftdoc +0 -0
- package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Modules/Mason.swiftmodule/arm64-apple-ios-simulator.swiftinterface +17 -5
- package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Modules/Mason.swiftmodule/x86_64-apple-ios-simulator.abi.json +7069 -15103
- package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Modules/Mason.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface +17 -5
- package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Modules/Mason.swiftmodule/x86_64-apple-ios-simulator.swiftdoc +0 -0
- package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Modules/Mason.swiftmodule/x86_64-apple-ios-simulator.swiftinterface +17 -5
- package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/_CodeSignature/CodeResources +28 -28
- package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/dSYMs/Mason.framework.dSYM/Contents/Resources/DWARF/Mason +2 -2
- package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/dSYMs/Mason.framework.dSYM/Contents/Resources/Relocations/aarch64/Mason.yml +9729 -9450
- package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/dSYMs/Mason.framework.dSYM/Contents/Resources/Relocations/x86_64/Mason.yml +9286 -9010
- package/platforms/ios/Mason.xcframework/xros-arm64/Mason.framework/Headers/Mason-Swift.h +10 -2
- package/platforms/ios/Mason.xcframework/xros-arm64/Mason.framework/Headers/mason_native.h +10 -0
- 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 +6726 -14794
- package/platforms/ios/Mason.xcframework/xros-arm64/Mason.framework/Modules/Mason.swiftmodule/arm64-apple-xros.private.swiftinterface +16 -5
- package/platforms/ios/Mason.xcframework/xros-arm64/Mason.framework/Modules/Mason.swiftmodule/arm64-apple-xros.swiftdoc +0 -0
- package/platforms/ios/Mason.xcframework/xros-arm64/Mason.framework/Modules/Mason.swiftmodule/arm64-apple-xros.swiftinterface +16 -5
- 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 +9218 -8945
- package/platforms/ios/Mason.xcframework/xros-arm64-simulator/Mason.framework/Headers/Mason-Swift.h +10 -2
- package/platforms/ios/Mason.xcframework/xros-arm64-simulator/Mason.framework/Headers/mason_native.h +10 -0
- 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 +6726 -14794
- package/platforms/ios/Mason.xcframework/xros-arm64-simulator/Mason.framework/Modules/Mason.swiftmodule/arm64-apple-xros-simulator.private.swiftinterface +16 -5
- package/platforms/ios/Mason.xcframework/xros-arm64-simulator/Mason.framework/Modules/Mason.swiftmodule/arm64-apple-xros-simulator.swiftdoc +0 -0
- package/platforms/ios/Mason.xcframework/xros-arm64-simulator/Mason.framework/Modules/Mason.swiftmodule/arm64-apple-xros-simulator.swiftinterface +16 -5
- package/platforms/ios/Mason.xcframework/xros-arm64-simulator/Mason.framework/_CodeSignature/CodeResources +16 -16
- 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 +9217 -8944
- package/platforms/windows/arm64/NativeScript.Mason.dll +0 -0
- package/platforms/windows/arm64/NativeScript.Mason.winmd +0 -0
- package/platforms/windows/x64/NativeScript.Mason.dll +0 -0
- package/platforms/windows/x64/NativeScript.Mason.winmd +0 -0
- package/postcss-guard.js +64 -0
- package/properties.d.ts +6 -2
- package/properties.js +78 -13
- package/properties.js.map +1 -1
- package/scroll/index.windows.js +1 -1
- package/scroll/index.windows.js.map +1 -1
- package/style.d.ts +40 -11
- package/style.js +364 -52
- package/style.js.map +1 -1
- package/svg-path.windows.d.ts +8 -0
- package/svg-path.windows.js +204 -0
- package/svg-path.windows.js.map +1 -0
- package/text/index.windows.js +1 -1
- package/text/index.windows.js.map +1 -1
- package/textarea/index.ios.d.ts +2 -0
- package/textarea/index.ios.js +7 -0
- package/textarea/index.ios.js.map +1 -1
- package/tree/index.android.js +14 -3
- package/tree/index.android.js.map +1 -1
- package/tree/index.ios.js +11 -3
- package/tree/index.ios.js.map +1 -1
- package/tree/index.windows.js +20 -0
- package/tree/index.windows.js.map +1 -1
- package/typings/android.d.ts +13 -0
- package/typings/objc!Mason.d.ts +6 -0
- package/units.d.ts +7 -0
- package/units.js +30 -2
- package/units.js.map +1 -1
- package/utils/index.android.js +28 -27
- package/utils/index.android.js.map +1 -1
- package/utils/index.ios.d.ts +1 -1
- package/view/index.windows.js +1 -1
- package/view/index.windows.js.map +1 -1
- package/vue/README.md +12 -7
- package/web.js +4 -3
- package/web.js.map +1 -1
- package/html-windows.js.map +0 -1
- package/windows-mask.js.map +0 -1
- /package/{html-windows.d.ts → inner-html.windows.d.ts} +0 -0
- /package/{windows-panel-helpers.d.ts → panel-helpers.windows.d.ts} +0 -0
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/postcss-guard.js
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Keeps app CSS that MasonKit supports through @nativescript/tailwind's PostCSS step.
|
|
3
|
+
*
|
|
4
|
+
* That step removes every declaration NativeScript core can't apply (`display`, `gap`,
|
|
5
|
+
* `grid-*`, values in `vw`/`vh`/`min-content`, ...) and every `:hover` rule, from all of
|
|
6
|
+
* the app's CSS. `before` stores a copy of each declaration in a custom property, which
|
|
7
|
+
* the step leaves alone; `after` puts back the declarations it removed and drops the copies.
|
|
8
|
+
* Declarations it kept, including the ones it rewrote, stay as it left them.
|
|
9
|
+
*/
|
|
10
|
+
const KEEP = '--mason-keep-';
|
|
11
|
+
// The step drops rules using these; they are renamed past it and back.
|
|
12
|
+
const PSEUDOS = [
|
|
13
|
+
[':hover', ':-mason-hover'],
|
|
14
|
+
[':focus-within', ':-mason-focus-within'],
|
|
15
|
+
];
|
|
16
|
+
|
|
17
|
+
// Hex has no `r` or `m`, so the step's rem/em rewrite can't touch a stored copy.
|
|
18
|
+
const encode = (decl) => Buffer.from(JSON.stringify([decl.prop, decl.value, decl.important])).toString('hex');
|
|
19
|
+
const decode = (value) => JSON.parse(Buffer.from(value, 'hex').toString('utf8'));
|
|
20
|
+
|
|
21
|
+
const before = () => ({
|
|
22
|
+
postcssPlugin: 'masonkit-css-guard-before',
|
|
23
|
+
Once(root) {
|
|
24
|
+
let id = 0;
|
|
25
|
+
root.walkDecls((decl) => {
|
|
26
|
+
if (decl.prop.startsWith('--')) return;
|
|
27
|
+
const key = String(id++);
|
|
28
|
+
decl.raws.masonKeep = key;
|
|
29
|
+
decl.cloneAfter({ prop: KEEP + key, value: encode(decl), important: false });
|
|
30
|
+
});
|
|
31
|
+
root.walkRules((rule) => {
|
|
32
|
+
for (const [pseudo, alias] of PSEUDOS) {
|
|
33
|
+
if (rule.selector.includes(pseudo)) rule.selector = rule.selector.split(pseudo).join(alias);
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
},
|
|
37
|
+
});
|
|
38
|
+
before.postcss = true;
|
|
39
|
+
|
|
40
|
+
const after = () => ({
|
|
41
|
+
postcssPlugin: 'masonkit-css-guard-after',
|
|
42
|
+
// After every plugin's visitors, which is where the step removes things.
|
|
43
|
+
OnceExit(root) {
|
|
44
|
+
root.walkDecls((decl) => {
|
|
45
|
+
if (!decl.prop.startsWith(KEEP)) return;
|
|
46
|
+
const key = decl.prop.slice(KEEP.length);
|
|
47
|
+
const kept = decl.parent.some((node) => node !== decl && node.type === 'decl' && node.raws.masonKeep === key);
|
|
48
|
+
if (kept) {
|
|
49
|
+
decl.remove();
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
const [prop, value, important] = decode(decl.value);
|
|
53
|
+
decl.replaceWith(decl.clone({ prop, value, important }));
|
|
54
|
+
});
|
|
55
|
+
root.walkRules((rule) => {
|
|
56
|
+
for (const [pseudo, alias] of PSEUDOS) {
|
|
57
|
+
if (rule.selector.includes(alias)) rule.selector = rule.selector.split(alias).join(pseudo);
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
},
|
|
61
|
+
});
|
|
62
|
+
after.postcss = true;
|
|
63
|
+
|
|
64
|
+
module.exports = { before, after };
|
package/properties.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CssProperty, CssAnimationProperty, InheritedCssProperty, Style, ShorthandProperty, Property } from '@nativescript/core';
|
|
2
|
-
import { Display, Overflow, Length, LengthAuto, Position, BoxSizing, GridAutoFlow, AlignContent, VerticalAlign, Float, Clear } from '.';
|
|
2
|
+
import { Display, Overflow, Length, Gap, LengthAuto, Position, BoxSizing, GridAutoFlow, AlignContent, VerticalAlign, Float, Clear } from '.';
|
|
3
3
|
import type { ViewBase } from './common';
|
|
4
4
|
import type { LonghandValue } from './css-shorthands';
|
|
5
5
|
type ShorthandLonghand = CssProperty<Style, any> | CssAnimationProperty<Style, any>;
|
|
@@ -45,11 +45,13 @@ export declare const textDecorationThicknessProperty: CssProperty<Style, string>
|
|
|
45
45
|
export declare const fontFamilyProperty: CssProperty<Style, string>;
|
|
46
46
|
export declare const marginProperty: CssProperty<Style, string>;
|
|
47
47
|
export declare const scrollBarWidthProperty: CssProperty<Style, number>;
|
|
48
|
+
/** The declaration behind `value` if it came from this view's own CSS, else `value`. */
|
|
49
|
+
export declare function masonRawDeclaration(style: Style, propertyName: string, value: unknown): unknown;
|
|
48
50
|
export declare const rowGapProperty: CssProperty<Style, Length>;
|
|
49
51
|
export declare const columnGapProperty: CssProperty<Style, Length>;
|
|
50
52
|
export declare const gridGapProperty: ShorthandProperty<Style, any>;
|
|
51
53
|
export declare const gapProperty: ShorthandProperty<Style, any>;
|
|
52
|
-
export declare const gridRowGapProperty: ShorthandProperty<Style,
|
|
54
|
+
export declare const gridRowGapProperty: ShorthandProperty<Style, Gap>;
|
|
53
55
|
export declare const gridColumnGapProperty: ShorthandProperty<Style, Length>;
|
|
54
56
|
export declare const maxWidthProperty: CssProperty<Style, LengthAuto>;
|
|
55
57
|
export declare const maxHeightProperty: CssProperty<Style, LengthAuto>;
|
|
@@ -101,6 +103,8 @@ export declare const cornerShapeTopLeftProperty: CssProperty<Style, string>;
|
|
|
101
103
|
export declare const cornerShapeTopRightProperty: CssProperty<Style, string>;
|
|
102
104
|
export declare const cornerShapeBottomRightProperty: CssProperty<Style, string>;
|
|
103
105
|
export declare const cornerShapeBottomLeftProperty: CssProperty<Style, string>;
|
|
106
|
+
/** Splits `a / b / ...` into `count` longhands, filling omitted ones as CSS Grid does. */
|
|
107
|
+
export declare function gridParts(value: string, count: number): string[];
|
|
104
108
|
export declare const objectPositionProperty: CssProperty<Style, string>;
|
|
105
109
|
export declare const borderTopStyleProperty: CssProperty<Style, string>;
|
|
106
110
|
export declare const borderRightStyleProperty: CssProperty<Style, string>;
|
package/properties.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { CssProperty, CssAnimationProperty, InheritedCssProperty, backgroundColorProperty, Style, ShorthandProperty, Length as CoreLength, fontSizeProperty, textAlignmentProperty, textDecorationProperty, textTransformProperty, PercentLength as CorePercentLength, Trace, CoreTypes, unsetValue, verticalAlignmentProperty, textShadowProperty, Font, Property, makeParser, makeValidator, marginTopProperty, marginRightProperty, marginBottomProperty, marginLeftProperty, paddingTopProperty, paddingRightProperty, paddingBottomProperty, paddingLeftProperty, borderTopWidthProperty, borderRightWidthProperty, borderBottomWidthProperty, borderLeftWidthProperty, minWidthProperty, minHeightProperty, widthProperty, heightProperty } from '@nativescript/core';
|
|
1
|
+
import { CssProperty, CssAnimationProperty, InheritedCssProperty, backgroundColorProperty, Style, ShorthandProperty, Length as CoreLength, fontSizeProperty, textAlignmentProperty, textDecorationProperty, textTransformProperty, PercentLength as CorePercentLength, Trace, CoreTypes, unsetValue, verticalAlignmentProperty, textShadowProperty, Font, Property, makeParser, makeValidator, marginTopProperty, marginRightProperty, marginBottomProperty, marginLeftProperty, paddingTopProperty, paddingRightProperty, paddingBottomProperty, paddingLeftProperty, borderTopWidthProperty, borderRightWidthProperty, borderBottomWidthProperty, borderLeftWidthProperty, minWidthProperty, minHeightProperty, widthProperty, heightProperty, lineHeightProperty, letterSpacingProperty, } from '@nativescript/core';
|
|
2
2
|
import { isMasonView_, touchAction_ } from './symbols';
|
|
3
3
|
/** Marks a Style whose size accessors already resolve Mason's units. */
|
|
4
4
|
const MASON_SIZE_UNITS = Symbol('mason:size-units');
|
|
5
|
-
import { cssLengthToDip, parseAspectRatio } from './style';
|
|
5
|
+
import { beginStyleWrite, cssLengthToDip, endStyleWrite, isSizingKeyword, parseAspectRatio } from './style';
|
|
6
6
|
import { isCssMathFunction } from './css-math';
|
|
7
7
|
import { alignItemsProperty, alignSelfProperty, flexDirectionProperty, flexGrowProperty, flexShrinkProperty, flexWrapProperty, justifyContentProperty } from '@nativescript/core/ui/layouts/flexbox-layout';
|
|
8
8
|
import { parseCSSShadow } from '@nativescript/core/ui/styling/css-shadow';
|
|
@@ -526,6 +526,38 @@ function overrideForMasonViews(property, options) {
|
|
|
526
526
|
}
|
|
527
527
|
property.overrideHandlers(handlers);
|
|
528
528
|
}
|
|
529
|
+
const rawDeclarations = new WeakMap();
|
|
530
|
+
/** Plain views keep core's number; a mason view also records the raw declaration so its units survive. */
|
|
531
|
+
function keepRawDeclarationForMasonViews(property, coreConverter) {
|
|
532
|
+
property.overrideHandlers({
|
|
533
|
+
valueConverter(value) {
|
|
534
|
+
const converted = coreConverter(value);
|
|
535
|
+
if (isMasonView(this)) {
|
|
536
|
+
let raw = rawDeclarations.get(this);
|
|
537
|
+
if (!raw) {
|
|
538
|
+
raw = new Map();
|
|
539
|
+
rawDeclarations.set(this, raw);
|
|
540
|
+
}
|
|
541
|
+
raw.set(property.name, { converted, raw: value });
|
|
542
|
+
}
|
|
543
|
+
return converted;
|
|
544
|
+
},
|
|
545
|
+
});
|
|
546
|
+
}
|
|
547
|
+
/** The declaration behind `value` if it came from this view's own CSS, else `value`. */
|
|
548
|
+
export function masonRawDeclaration(style, propertyName, value) {
|
|
549
|
+
const raw = rawDeclarations.get(style)?.get(propertyName);
|
|
550
|
+
if (!raw) {
|
|
551
|
+
return value;
|
|
552
|
+
}
|
|
553
|
+
if (Object.is(raw.converted, value)) {
|
|
554
|
+
return raw.raw;
|
|
555
|
+
}
|
|
556
|
+
rawDeclarations.get(style).delete(propertyName);
|
|
557
|
+
return value;
|
|
558
|
+
}
|
|
559
|
+
keepRawDeclarationForMasonViews(lineHeightProperty, (v) => parseFloat(v));
|
|
560
|
+
keepRawDeclarationForMasonViews(letterSpacingProperty, (v) => parseFloat(v));
|
|
529
561
|
overrideForMasonViews(flexDirectionProperty, {
|
|
530
562
|
coreConverter: FlexDirectionParse,
|
|
531
563
|
apply: (style, value) => {
|
|
@@ -864,10 +896,18 @@ function masonLengthDeclaration(value) {
|
|
|
864
896
|
if (typeof value !== 'string') {
|
|
865
897
|
return value;
|
|
866
898
|
}
|
|
899
|
+
const keyword = sizingKeywordLength(value);
|
|
900
|
+
if (keyword) {
|
|
901
|
+
return keyword;
|
|
902
|
+
}
|
|
867
903
|
const dip = cssLengthToDip(value);
|
|
868
904
|
// A bare number is a dip to core and a CSS pixel to mason — the same size.
|
|
869
905
|
return dip === undefined ? value : String(dip);
|
|
870
906
|
}
|
|
907
|
+
/** Core throws on sizing keywords; a negative length reads as auto to core and carries the keyword as its unit. */
|
|
908
|
+
function sizingKeywordLength(value) {
|
|
909
|
+
return isSizingKeyword(value) ? { unit: value.trim(), value: -2 } : undefined;
|
|
910
|
+
}
|
|
871
911
|
const MASON_SIZE_KEYS = [widthProperty, heightProperty].flatMap((property) => [property.name, property.cssName, property.cssLocalName]).filter((key) => typeof key === 'string' && key.length > 0);
|
|
872
912
|
/**
|
|
873
913
|
* The stylesheet-facing accessor a `CssAnimationProperty` installs is
|
|
@@ -893,7 +933,13 @@ function masonStyleProto(proto) {
|
|
|
893
933
|
configurable: true,
|
|
894
934
|
get,
|
|
895
935
|
set(value) {
|
|
896
|
-
|
|
936
|
+
beginStyleWrite(this, key, value);
|
|
937
|
+
try {
|
|
938
|
+
set.call(this, masonLengthDeclaration(value));
|
|
939
|
+
}
|
|
940
|
+
finally {
|
|
941
|
+
endStyleWrite();
|
|
942
|
+
}
|
|
897
943
|
},
|
|
898
944
|
});
|
|
899
945
|
}
|
|
@@ -1271,7 +1317,7 @@ export const flexBasisProperty = new CssProperty({
|
|
|
1271
1317
|
// @ts-ignore
|
|
1272
1318
|
equalityComparer: masonLengthEquals,
|
|
1273
1319
|
// @ts-ignore
|
|
1274
|
-
valueConverter: masonInsetConverter,
|
|
1320
|
+
valueConverter: (value) => (isSizingKeyword(value) ? value.trim() : masonInsetConverter(value)),
|
|
1275
1321
|
valueChanged(target, oldValue, newValue) {
|
|
1276
1322
|
if (appliedInSetNative(target, flexBasisProperty))
|
|
1277
1323
|
return;
|
|
@@ -1470,6 +1516,7 @@ export const gridTemplateColumnsProperty = new CssProperty({
|
|
|
1470
1516
|
// @ts-ignore
|
|
1471
1517
|
export const textWrapProperty = new CssProperty({
|
|
1472
1518
|
name: 'textWrap',
|
|
1519
|
+
cssName: 'text-wrap',
|
|
1473
1520
|
affectsLayout: true,
|
|
1474
1521
|
defaultValue: 'wrap',
|
|
1475
1522
|
valueChanged(target, oldValue, newValue) {
|
|
@@ -1644,22 +1691,28 @@ gridAreaProperty.register(Style);
|
|
|
1644
1691
|
// scalar properties lose CSS/local priority (including an explicit `auto`).
|
|
1645
1692
|
// Preserve Mason's direct accessors; core 9.1 stylesheet expansion uses these
|
|
1646
1693
|
// same longhands for both kinds of view.
|
|
1647
|
-
|
|
1648
|
-
|
|
1694
|
+
/** A lone `<custom-ident>` placement, which an omitted end copies instead of `auto`. */
|
|
1695
|
+
function isGridIdent(part) {
|
|
1696
|
+
return /^-?[A-Za-z_][\w-]*$/.test(part) && !/^(auto|span)$/i.test(part);
|
|
1697
|
+
}
|
|
1698
|
+
/** Splits `a / b / ...` into `count` longhands, filling omitted ones as CSS Grid does. */
|
|
1699
|
+
export function gridParts(value, count) {
|
|
1700
|
+
const parts = String(value)
|
|
1701
|
+
.split('/')
|
|
1702
|
+
.map((part) => part.trim());
|
|
1649
1703
|
if (parts.length > count || parts.some((part) => !part))
|
|
1650
1704
|
throw new Error(`Invalid grid placement: ${value}`);
|
|
1651
|
-
|
|
1652
|
-
|
|
1705
|
+
// Omitted ends copy their start (grid-area: row-start, column-start, row-end, column-end).
|
|
1706
|
+
for (let i = parts.length; i < count; i++) {
|
|
1707
|
+
const start = parts[i - (count === 4 ? 2 : 1)] ?? parts[0];
|
|
1708
|
+
parts.push(isGridIdent(start) ? start : 'auto');
|
|
1709
|
+
}
|
|
1653
1710
|
return parts;
|
|
1654
1711
|
}
|
|
1655
1712
|
const gridPlacementShorthands = [
|
|
1656
1713
|
{ cssName: 'grid-row', longhands: [gridRowStartProperty, gridRowEndProperty], split: (value) => gridParts(value, 2) },
|
|
1657
1714
|
{ cssName: 'grid-column', longhands: [gridColumnStartProperty, gridColumnEndProperty], split: (value) => gridParts(value, 2) },
|
|
1658
|
-
{
|
|
1659
|
-
cssName: 'grid-area',
|
|
1660
|
-
longhands: [gridRowStartProperty, gridColumnStartProperty, gridRowEndProperty, gridColumnEndProperty],
|
|
1661
|
-
split: (value) => (value.includes('/') ? gridParts(value, 4) : [value, value, value, value]),
|
|
1662
|
-
},
|
|
1715
|
+
{ cssName: 'grid-area', longhands: [gridRowStartProperty, gridColumnStartProperty, gridRowEndProperty, gridColumnEndProperty], split: (value) => gridParts(value, 4) },
|
|
1663
1716
|
];
|
|
1664
1717
|
for (const entry of gridPlacementShorthands) {
|
|
1665
1718
|
const shorthand = masonShorthandProperty(entry, function () {
|
|
@@ -2000,6 +2053,17 @@ export const maskBorderModeProperty = new CssProperty({
|
|
|
2000
2053
|
});
|
|
2001
2054
|
// The -webkit- prefixed names older and autoprefixed CSS still uses, set on the same Style
|
|
2002
2055
|
// properties. Composite operators and box keywords are translated to the standard ones.
|
|
2056
|
+
// Gradient-text CSS is usually written `-webkit-background-clip: text`.
|
|
2057
|
+
const webkitBackgroundClipProperty = new CssProperty({
|
|
2058
|
+
name: 'webkitBackgroundClip',
|
|
2059
|
+
cssName: '-webkit-background-clip',
|
|
2060
|
+
valueChanged(target, oldValue, newValue) {
|
|
2061
|
+
const view = getViewStyle(target.viewRef);
|
|
2062
|
+
if (view) {
|
|
2063
|
+
view.backgroundClip = newValue;
|
|
2064
|
+
}
|
|
2065
|
+
},
|
|
2066
|
+
});
|
|
2003
2067
|
const webkitMaskImageProperty = new CssProperty({
|
|
2004
2068
|
name: 'webkitMaskImage',
|
|
2005
2069
|
cssName: '-webkit-mask-image',
|
|
@@ -2164,6 +2228,7 @@ maskBorderWidthProperty.register(Style);
|
|
|
2164
2228
|
maskBorderOutsetProperty.register(Style);
|
|
2165
2229
|
maskBorderRepeatProperty.register(Style);
|
|
2166
2230
|
maskBorderModeProperty.register(Style);
|
|
2231
|
+
webkitBackgroundClipProperty.register(Style);
|
|
2167
2232
|
webkitMaskImageProperty.register(Style);
|
|
2168
2233
|
webkitMaskSizeProperty.register(Style);
|
|
2169
2234
|
webkitMaskPositionProperty.register(Style);
|