@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.
- package/button/index.ios.js +5 -73
- package/button/index.ios.js.map +1 -1
- package/common.d.ts +3 -1
- package/common.js +53 -13
- package/common.js.map +1 -1
- package/css-shorthands.d.ts +0 -2
- package/css-shorthands.js +0 -4
- package/css-shorthands.js.map +1 -1
- package/foreign-layout.d.ts +3 -1
- package/foreign-layout.js +33 -1
- package/foreign-layout.js.map +1 -1
- package/img/index.ios.js +4 -42
- package/img/index.ios.js.map +1 -1
- package/index.d.ts +12 -0
- package/input/index.ios.js +4 -44
- package/input/index.ios.js.map +1 -1
- package/li/index.ios.js +6 -52
- package/li/index.ios.js.map +1 -1
- package/list/index.ios.js +3 -41
- package/list/index.ios.js.map +1 -1
- package/logical-boxes.d.ts +8 -0
- package/logical-boxes.js +131 -0
- package/logical-boxes.js.map +1 -0
- package/package.json +1 -1
- package/platforms/android/masonkit-release.aar +0 -0
- package/platforms/ios/Mason.xcframework/ios-arm64/Mason.framework/Headers/Mason-Swift.h +5 -0
- package/platforms/ios/Mason.xcframework/ios-arm64/Mason.framework/Headers/mason_native.h +9 -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 +47243 -44370
- package/platforms/ios/Mason.xcframework/ios-arm64/Mason.framework/Modules/Mason.swiftmodule/arm64-apple-ios.private.swiftinterface +276 -223
- 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 +276 -223
- 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 +9927 -9729
- package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Headers/Mason-Swift.h +10 -0
- package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Headers/mason_native.h +9 -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 +47243 -44370
- package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Modules/Mason.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface +276 -223
- 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 +276 -223
- package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Modules/Mason.swiftmodule/x86_64-apple-ios-simulator.abi.json +47243 -44370
- package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Modules/Mason.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface +276 -223
- 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 +276 -223
- 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 +9921 -9723
- package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/dSYMs/Mason.framework.dSYM/Contents/Resources/Relocations/x86_64/Mason.yml +9476 -9280
- 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/properties.d.ts +32 -0
- package/properties.js +148 -37
- package/properties.js.map +1 -1
- package/scroll/index.ios.js +5 -62
- package/scroll/index.ios.js.map +1 -1
- package/style.d.ts +322 -0
- package/style.js +315 -1
- package/style.js.map +1 -1
- package/symbols.d.ts +2 -0
- package/symbols.js +2 -0
- package/symbols.js.map +1 -1
- package/text/index.ios.js +3 -79
- package/text/index.ios.js.map +1 -1
- package/text/index.windows.js +5 -4
- package/text/index.windows.js.map +1 -1
- package/textarea/index.ios.js +4 -62
- package/textarea/index.ios.js.map +1 -1
- package/typings/objc!Mason.d.ts +2 -0
- package/typings/objc!ObjectiveC.d.ts +2 -0
- package/view/index.ios.js +8 -56
- package/view/index.ios.js.map +1 -1
- package/vue/src/mason-meta.d.ts.map +1 -1
- package/vue/src/mason-meta.js +8 -7
- package/vue/src/mason-meta.js.map +1 -1
- package/web.js +6 -6
- package/web.js.map +1 -1
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/properties.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { CssProperty, CssAnimationProperty, InheritedCssProperty, Style, ShorthandProperty, Property } from '@nativescript/core';
|
|
2
2
|
import { Display, Overflow, Length, Gap, LengthAuto, Position, BoxSizing, GridAutoFlow, AlignContent, VerticalAlign, Float, Clear } from '.';
|
|
3
3
|
import type { ViewBase } from './common';
|
|
4
|
+
import type { LogicalGroupName } from './style';
|
|
4
5
|
import type { LonghandValue } from './css-shorthands';
|
|
5
6
|
type ShorthandLonghand = CssProperty<Style, any> | CssAnimationProperty<Style, any>;
|
|
6
7
|
export interface MasonShorthand {
|
|
@@ -138,6 +139,9 @@ export declare const maskBorderModeProperty: CssProperty<Style, string>;
|
|
|
138
139
|
export declare const maskProperty: ShorthandProperty<Style, any>;
|
|
139
140
|
export declare const maskBorderProperty: ShorthandProperty<Style, any>;
|
|
140
141
|
export declare const writingModeProperty: CssProperty<Style, string>;
|
|
142
|
+
export declare const textOrientationProperty: CssProperty<Style, string>;
|
|
143
|
+
export declare const textCombineUprightProperty: CssProperty<Style, string>;
|
|
144
|
+
export declare const textSpacingTrimProperty: CssProperty<Style, string>;
|
|
141
145
|
export declare const unicodeBidiProperty: CssProperty<Style, string>;
|
|
142
146
|
export declare const caretColorProperty: CssProperty<Style, string>;
|
|
143
147
|
export declare const listStyleTypeProperty: InheritedCssProperty<Style, string>;
|
|
@@ -150,5 +154,33 @@ export declare const borderTopProperty: ShorthandProperty<Style, any>;
|
|
|
150
154
|
export declare const borderRightProperty: ShorthandProperty<Style, any>;
|
|
151
155
|
export declare const borderBottomProperty: ShorthandProperty<Style, any>;
|
|
152
156
|
export declare const borderLeftProperty: ShorthandProperty<Style, any>;
|
|
157
|
+
type Sides = readonly [top: ShorthandLonghand, right: ShorthandLonghand, bottom: ShorthandLonghand, left: ShorthandLonghand];
|
|
158
|
+
export interface LogicalLonghand {
|
|
159
|
+
property: CssProperty<Style, unknown>;
|
|
160
|
+
group: LogicalGroupName;
|
|
161
|
+
slot: number;
|
|
162
|
+
}
|
|
163
|
+
/** Logical longhands; Mason views write them in setNative (common.ts), once the native view exists. */
|
|
164
|
+
export declare const logicalLonghands: LogicalLonghand[];
|
|
165
|
+
export declare const marginLogicalLonghands: Sides;
|
|
166
|
+
export declare const paddingLogicalLonghands: Sides;
|
|
167
|
+
export declare const insetLogicalLonghands: Sides;
|
|
168
|
+
export declare const logicalSizeLonghands: CssProperty<Style, unknown>[];
|
|
169
|
+
/**
|
|
170
|
+
* Logical longhands a Mason view writes to physical sides: `physical` are the group's physical
|
|
171
|
+
* longhands (sides top, right, bottom, left; corners top-left, top-right, bottom-right,
|
|
172
|
+
* bottom-left; axes x, y), `logical` its logical ones in the positions of the physical ones
|
|
173
|
+
* they map to in horizontal left-to-right text.
|
|
174
|
+
*/
|
|
175
|
+
export interface LogicalBoxGroup {
|
|
176
|
+
kind: 'sides' | 'corners' | 'axes';
|
|
177
|
+
physical: CssProperty<Style, unknown>[];
|
|
178
|
+
logical: CssProperty<Style, unknown>[];
|
|
179
|
+
/** A side's value when neither kind of declaration sets it. */
|
|
180
|
+
initial: unknown;
|
|
181
|
+
}
|
|
182
|
+
export declare const logicalBoxGroups: LogicalBoxGroup[];
|
|
183
|
+
export declare const radiusLogicalLonghands: CssProperty<Style, unknown>[];
|
|
184
|
+
export declare const overflowLogicalLonghands: CssProperty<Style, unknown>[];
|
|
153
185
|
export declare const masonShorthands: MasonShorthand[];
|
|
154
186
|
export {};
|
package/properties.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
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
|
-
import { isMasonView_, touchAction_ } from './symbols';
|
|
2
|
+
import { isMasonView_, remapLogicalBoxes_, 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
5
|
import { beginStyleWrite, cssLengthToDip, endStyleWrite, isSizingKeyword, parseAspectRatio } from './style';
|
|
@@ -8,7 +8,7 @@ import { alignItemsProperty, alignSelfProperty, flexDirectionProperty, flexGrowP
|
|
|
8
8
|
import { parseCSSShadow } from '@nativescript/core/ui/styling/css-shadow';
|
|
9
9
|
import { installKeyframes, interpolatePositionList, interpolateSizeList, registerKeyframeProperty } from './css-keyframes';
|
|
10
10
|
import { borderTopLeftRadiusProperty, borderTopRightRadiusProperty, borderBottomRightRadiusProperty, borderBottomLeftRadiusProperty, borderTopColorProperty, borderRightColorProperty, borderBottomColorProperty, borderLeftColorProperty } from '@nativescript/core/ui/styling/style-properties';
|
|
11
|
-
import { BORDER_WIDTH_KEYWORDS,
|
|
11
|
+
import { BORDER_WIDTH_KEYWORDS, splitBorder, splitBorderSide, splitBorderStyle, splitBorderStyleStartEnd, splitBorderWidthStartEnd, splitBorderColorStartEnd, splitInsetStartEnd, splitMarginStartEnd, splitPaddingStartEnd, splitBackground, splitMask, splitMaskBorder, splitWebkitMask, webkitMaskBox, webkitMaskComposite, splitBorderColor, splitBorderRadius, splitBorderWidth, splitFlex, splitFlexFlow, splitGap, splitMargin, splitOverflow, splitPadding } from './css-shorthands';
|
|
12
12
|
import { cssLength, isCssLength, toCamelCase } from './css-shorthands';
|
|
13
13
|
import { splitListStyle, splitPlace } from './css-shorthands';
|
|
14
14
|
function getViewStyle(view) {
|
|
@@ -262,11 +262,14 @@ export const paddingProperty = new CssProperty({
|
|
|
262
262
|
export const whiteSpaceProperty = new CssProperty({
|
|
263
263
|
name: 'whiteSpace',
|
|
264
264
|
cssName: 'white-space',
|
|
265
|
-
|
|
265
|
+
// No default: it inherits, so the initial value is a real change under another value.
|
|
266
266
|
valueChanged(target, oldValue, newValue) {
|
|
267
267
|
const view = getViewStyle(target.viewRef);
|
|
268
268
|
if (view) {
|
|
269
|
-
|
|
269
|
+
if (newValue == null)
|
|
270
|
+
view.unsetInheritedText('whiteSpace');
|
|
271
|
+
else
|
|
272
|
+
view.whiteSpace = newValue;
|
|
270
273
|
}
|
|
271
274
|
},
|
|
272
275
|
});
|
|
@@ -1804,11 +1807,14 @@ export const borderImageProperty = new CssProperty({
|
|
|
1804
1807
|
export const fontStretchProperty = new CssProperty({
|
|
1805
1808
|
name: 'fontStretch',
|
|
1806
1809
|
cssName: 'font-stretch',
|
|
1807
|
-
|
|
1810
|
+
// No default: it inherits, so the initial value is a real change under another value.
|
|
1808
1811
|
valueChanged(target, oldValue, newValue) {
|
|
1809
1812
|
const view = getViewStyle(target.viewRef);
|
|
1810
1813
|
if (view) {
|
|
1811
|
-
|
|
1814
|
+
if (newValue == null)
|
|
1815
|
+
view.unsetInheritedText('fontStretch');
|
|
1816
|
+
else
|
|
1817
|
+
view.fontStretch = newValue;
|
|
1812
1818
|
}
|
|
1813
1819
|
},
|
|
1814
1820
|
});
|
|
@@ -1826,22 +1832,28 @@ export const fontFeatureSettingsProperty = new CssProperty({
|
|
|
1826
1832
|
export const wordSpacingProperty = new CssProperty({
|
|
1827
1833
|
name: 'wordSpacing',
|
|
1828
1834
|
cssName: 'word-spacing',
|
|
1829
|
-
|
|
1835
|
+
// No default: it inherits, so the initial value is a real change under another value.
|
|
1830
1836
|
valueChanged(target, oldValue, newValue) {
|
|
1831
1837
|
const view = getViewStyle(target.viewRef);
|
|
1832
1838
|
if (view) {
|
|
1833
|
-
|
|
1839
|
+
if (newValue == null)
|
|
1840
|
+
view.unsetInheritedText('wordSpacing');
|
|
1841
|
+
else
|
|
1842
|
+
view.wordSpacing = newValue;
|
|
1834
1843
|
}
|
|
1835
1844
|
},
|
|
1836
1845
|
});
|
|
1837
1846
|
export const hyphensProperty = new CssProperty({
|
|
1838
1847
|
name: 'hyphens',
|
|
1839
1848
|
cssName: 'hyphens',
|
|
1840
|
-
|
|
1849
|
+
// No default: it inherits, so the initial value is a real change under another value.
|
|
1841
1850
|
valueChanged(target, oldValue, newValue) {
|
|
1842
1851
|
const view = getViewStyle(target.viewRef);
|
|
1843
1852
|
if (view) {
|
|
1844
|
-
|
|
1853
|
+
if (newValue == null)
|
|
1854
|
+
view.unsetInheritedText('hyphens');
|
|
1855
|
+
else
|
|
1856
|
+
view.hyphens = newValue;
|
|
1845
1857
|
}
|
|
1846
1858
|
},
|
|
1847
1859
|
});
|
|
@@ -2169,11 +2181,58 @@ const webkitMaskBoxImageProperty = masonShorthandProperty(webkitMaskBoxImageShor
|
|
|
2169
2181
|
export const writingModeProperty = new CssProperty({
|
|
2170
2182
|
name: 'writingMode',
|
|
2171
2183
|
cssName: 'writing-mode',
|
|
2172
|
-
|
|
2184
|
+
// No default: it inherits, so the initial value is a real change under another value.
|
|
2185
|
+
valueChanged(target, oldValue, newValue) {
|
|
2186
|
+
const view = getViewStyle(target.viewRef);
|
|
2187
|
+
if (view) {
|
|
2188
|
+
if (newValue == null)
|
|
2189
|
+
view.unsetInheritedText('writingMode');
|
|
2190
|
+
else
|
|
2191
|
+
view.writingMode = newValue;
|
|
2192
|
+
const ref = target.viewRef;
|
|
2193
|
+
(__ANDROID__ ? ref?.get() : ref?.deref())?.[remapLogicalBoxes_]?.();
|
|
2194
|
+
}
|
|
2195
|
+
},
|
|
2196
|
+
});
|
|
2197
|
+
export const textOrientationProperty = new CssProperty({
|
|
2198
|
+
name: 'textOrientation',
|
|
2199
|
+
cssName: 'text-orientation',
|
|
2200
|
+
// No default: it inherits, so the initial value is a real change under another value.
|
|
2201
|
+
valueChanged(target, oldValue, newValue) {
|
|
2202
|
+
const view = getViewStyle(target.viewRef);
|
|
2203
|
+
if (view) {
|
|
2204
|
+
if (newValue == null)
|
|
2205
|
+
view.unsetInheritedText('textOrientation');
|
|
2206
|
+
else
|
|
2207
|
+
view.textOrientation = newValue;
|
|
2208
|
+
}
|
|
2209
|
+
},
|
|
2210
|
+
});
|
|
2211
|
+
export const textCombineUprightProperty = new CssProperty({
|
|
2212
|
+
name: 'textCombineUpright',
|
|
2213
|
+
cssName: 'text-combine-upright',
|
|
2214
|
+
// No default: it inherits, so the initial value is a real change under another value.
|
|
2173
2215
|
valueChanged(target, oldValue, newValue) {
|
|
2174
2216
|
const view = getViewStyle(target.viewRef);
|
|
2175
2217
|
if (view) {
|
|
2176
|
-
|
|
2218
|
+
if (newValue == null)
|
|
2219
|
+
view.unsetInheritedText('textCombineUpright');
|
|
2220
|
+
else
|
|
2221
|
+
view.textCombineUpright = newValue;
|
|
2222
|
+
}
|
|
2223
|
+
},
|
|
2224
|
+
});
|
|
2225
|
+
export const textSpacingTrimProperty = new CssProperty({
|
|
2226
|
+
name: 'textSpacingTrim',
|
|
2227
|
+
cssName: 'text-spacing-trim',
|
|
2228
|
+
// No default: it inherits, so the initial value is a real change under another value.
|
|
2229
|
+
valueChanged(target, oldValue, newValue) {
|
|
2230
|
+
const view = getViewStyle(target.viewRef);
|
|
2231
|
+
if (view) {
|
|
2232
|
+
if (newValue == null)
|
|
2233
|
+
view.unsetInheritedText('textSpacingTrim');
|
|
2234
|
+
else
|
|
2235
|
+
view.textSpacingTrim = newValue;
|
|
2177
2236
|
}
|
|
2178
2237
|
},
|
|
2179
2238
|
});
|
|
@@ -2247,6 +2306,9 @@ maskClipProperty.register(Style);
|
|
|
2247
2306
|
maskModeProperty.register(Style);
|
|
2248
2307
|
maskCompositeProperty.register(Style);
|
|
2249
2308
|
writingModeProperty.register(Style);
|
|
2309
|
+
textOrientationProperty.register(Style);
|
|
2310
|
+
textCombineUprightProperty.register(Style);
|
|
2311
|
+
textSpacingTrimProperty.register(Style);
|
|
2250
2312
|
unicodeBidiProperty.register(Style);
|
|
2251
2313
|
caretColorProperty.register(Style);
|
|
2252
2314
|
registerAlongsideCore(backgroundImageProperty);
|
|
@@ -2411,38 +2473,87 @@ const LOGICAL_SIDES = [
|
|
|
2411
2473
|
['block-end', 2],
|
|
2412
2474
|
['inline-start', 3],
|
|
2413
2475
|
];
|
|
2414
|
-
/** `<prefix>-inline<suffix
|
|
2476
|
+
/** `<prefix>-inline<suffix>` and `<prefix>-block<suffix>`, over a group's logical sides. */
|
|
2415
2477
|
function logicalSides(prefix, suffix, sides, splitAxis) {
|
|
2416
|
-
|
|
2417
|
-
|
|
2418
|
-
|
|
2419
|
-
|
|
2478
|
+
return [
|
|
2479
|
+
{ cssName: `${prefix}-inline${suffix}`, longhands: [sides[3], sides[1]], split: splitAxis },
|
|
2480
|
+
{ cssName: `${prefix}-block${suffix}`, longhands: [sides[0], sides[2]], split: splitAxis },
|
|
2481
|
+
];
|
|
2482
|
+
}
|
|
2483
|
+
/** Logical longhands; Mason views write them in setNative (common.ts), once the native view exists. */
|
|
2484
|
+
export const logicalLonghands = [];
|
|
2485
|
+
function logicalLonghand(cssName, group, slot, physical) {
|
|
2486
|
+
const property = new CssProperty({
|
|
2487
|
+
name: toCamelCase(cssName),
|
|
2488
|
+
cssName,
|
|
2489
|
+
valueChanged(target, oldValue, newValue) {
|
|
2490
|
+
const ref = target?.viewRef;
|
|
2491
|
+
const view = ref ? (__ANDROID__ ? ref.get() : ref.deref()) : undefined;
|
|
2492
|
+
if (!view || view[isMasonView_])
|
|
2493
|
+
return;
|
|
2494
|
+
// cssName is the cascade's css-tier key ('css:margin-left').
|
|
2495
|
+
target[physical.cssName] = (newValue ?? unsetValue);
|
|
2496
|
+
},
|
|
2497
|
+
});
|
|
2498
|
+
property.register(Style);
|
|
2499
|
+
logicalLonghands.push({ property, group, slot });
|
|
2500
|
+
return property;
|
|
2501
|
+
}
|
|
2502
|
+
/** A group's four logical sides, in the positions of the physical sides they map to in horizontal left-to-right text. */
|
|
2503
|
+
function logicalSideLonghands(prefix, group, physical) {
|
|
2504
|
+
return LOGICAL_SIDES.map(([side, i]) => logicalLonghand(`${prefix}-${side}`, group, i, physical[i]));
|
|
2505
|
+
}
|
|
2506
|
+
export const marginLogicalLonghands = logicalSideLonghands('margin', 'margin', marginLonghands);
|
|
2507
|
+
export const paddingLogicalLonghands = logicalSideLonghands('padding', 'padding', paddingLonghands);
|
|
2508
|
+
export const insetLogicalLonghands = logicalSideLonghands('inset', 'inset', [topProperty, rightProperty, bottomProperty, leftProperty]);
|
|
2509
|
+
export const logicalSizeLonghands = [
|
|
2510
|
+
['inline-size', widthProperty],
|
|
2511
|
+
['block-size', heightProperty],
|
|
2512
|
+
['min-inline-size', minWidthProperty],
|
|
2513
|
+
['min-block-size', minHeightProperty],
|
|
2514
|
+
['max-inline-size', maxWidthProperty],
|
|
2515
|
+
['max-block-size', maxHeightProperty],
|
|
2516
|
+
].map(([cssName, physical], slot) => logicalLonghand(cssName, 'size', slot, physical));
|
|
2517
|
+
export const logicalBoxGroups = [];
|
|
2518
|
+
function logicalBoxGroup(kind, physical, cssNames, initial) {
|
|
2519
|
+
const group = { kind, physical: physical, logical: [], initial };
|
|
2520
|
+
group.logical = cssNames.map((cssName, slot) => {
|
|
2521
|
+
const property = new CssProperty({
|
|
2522
|
+
name: toCamelCase(cssName),
|
|
2523
|
+
cssName,
|
|
2524
|
+
valueChanged(target, oldValue, newValue) {
|
|
2525
|
+
const ref = target?.viewRef;
|
|
2526
|
+
const view = ref ? (__ANDROID__ ? ref.get() : ref.deref()) : undefined;
|
|
2527
|
+
if (!view || view[isMasonView_])
|
|
2528
|
+
return;
|
|
2529
|
+
target[group.physical[slot].cssName] = (newValue ?? unsetValue);
|
|
2530
|
+
},
|
|
2531
|
+
});
|
|
2532
|
+
property.register(Style);
|
|
2533
|
+
return property;
|
|
2534
|
+
});
|
|
2535
|
+
logicalBoxGroups.push(group);
|
|
2536
|
+
return group.logical;
|
|
2420
2537
|
}
|
|
2421
|
-
const
|
|
2538
|
+
const sideNames = (prefix, suffix) => LOGICAL_SIDES.map(([side]) => `${prefix}-${side}${suffix}`);
|
|
2539
|
+
const borderWidthLogicalLonghands = logicalBoxGroup('sides', borderWidthLonghands, sideNames('border', '-width'), 0);
|
|
2540
|
+
const borderStyleLogicalLonghands = logicalBoxGroup('sides', borderStyleLonghands, sideNames('border', '-style'), 'none');
|
|
2541
|
+
const borderColorLogicalLonghands = logicalBoxGroup('sides', borderColorLonghands, sideNames('border', '-color'), 'black');
|
|
2542
|
+
// Corners are <block>-<inline>: start-start is top-left.
|
|
2543
|
+
export const radiusLogicalLonghands = logicalBoxGroup('corners', radiusLonghands, ['border-start-start-radius', 'border-start-end-radius', 'border-end-end-radius', 'border-end-start-radius'], 0);
|
|
2544
|
+
export const overflowLogicalLonghands = logicalBoxGroup('axes', [overflowXProperty, overflowYProperty], ['overflow-inline', 'overflow-block'], 'visible');
|
|
2545
|
+
const borderSideLonghands = (i) => [borderWidthLogicalLonghands[i], borderStyleLogicalLonghands[i], borderColorLogicalLonghands[i]];
|
|
2422
2546
|
const logicalShorthands = [
|
|
2423
|
-
...logicalSides('margin', '',
|
|
2424
|
-
...logicalSides('padding', '',
|
|
2425
|
-
...logicalSides('inset', '',
|
|
2426
|
-
...logicalSides('border', '-width',
|
|
2427
|
-
...logicalSides('border', '-style',
|
|
2428
|
-
...logicalSides('border', '-color',
|
|
2547
|
+
...logicalSides('margin', '', marginLogicalLonghands, splitMarginStartEnd),
|
|
2548
|
+
...logicalSides('padding', '', paddingLogicalLonghands, splitPaddingStartEnd),
|
|
2549
|
+
...logicalSides('inset', '', insetLogicalLonghands, splitInsetStartEnd),
|
|
2550
|
+
...logicalSides('border', '-width', borderWidthLogicalLonghands, splitBorderWidthStartEnd),
|
|
2551
|
+
...logicalSides('border', '-style', borderStyleLogicalLonghands, splitBorderStyleStartEnd),
|
|
2552
|
+
...logicalSides('border', '-color', borderColorLogicalLonghands, splitBorderColorStartEnd),
|
|
2429
2553
|
// `border-inline: 1px solid` gives both sides the same border.
|
|
2430
2554
|
{ cssName: 'border-inline', longhands: [...borderSideLonghands(3), ...borderSideLonghands(1)], split: (value) => [...splitBorderSide(value), ...splitBorderSide(value)] },
|
|
2431
2555
|
{ cssName: 'border-block', longhands: [...borderSideLonghands(0), ...borderSideLonghands(2)], split: (value) => [...splitBorderSide(value), ...splitBorderSide(value)] },
|
|
2432
2556
|
...LOGICAL_SIDES.map(([side, i]) => ({ cssName: `border-${side}`, longhands: borderSideLonghands(i), split: splitBorderSide })),
|
|
2433
|
-
// Corners are <block>-<inline>: start-start is top-left.
|
|
2434
|
-
{ cssName: 'border-start-start-radius', longhands: [borderTopLeftRadiusProperty], split: passThrough },
|
|
2435
|
-
{ cssName: 'border-start-end-radius', longhands: [borderTopRightRadiusProperty], split: passThrough },
|
|
2436
|
-
{ cssName: 'border-end-end-radius', longhands: [borderBottomRightRadiusProperty], split: passThrough },
|
|
2437
|
-
{ cssName: 'border-end-start-radius', longhands: [borderBottomLeftRadiusProperty], split: passThrough },
|
|
2438
|
-
{ cssName: 'inline-size', longhands: [widthProperty], split: passThrough },
|
|
2439
|
-
{ cssName: 'block-size', longhands: [heightProperty], split: passThrough },
|
|
2440
|
-
{ cssName: 'min-inline-size', longhands: [minWidthProperty], split: passThrough },
|
|
2441
|
-
{ cssName: 'min-block-size', longhands: [minHeightProperty], split: passThrough },
|
|
2442
|
-
{ cssName: 'max-inline-size', longhands: [maxWidthProperty], split: passThrough },
|
|
2443
|
-
{ cssName: 'max-block-size', longhands: [maxHeightProperty], split: passThrough },
|
|
2444
|
-
{ cssName: 'overflow-inline', longhands: [overflowXProperty], split: passThrough },
|
|
2445
|
-
{ cssName: 'overflow-block', longhands: [overflowYProperty], split: passThrough },
|
|
2446
2557
|
];
|
|
2447
2558
|
for (const entry of logicalShorthands) {
|
|
2448
2559
|
masonShorthandProperty(entry, function () {
|