@triniwiz/nativescript-masonkit 1.0.0-beta.91 → 1.0.0-beta.93
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/common.d.ts +16 -3
- package/common.js +169 -27
- package/common.js.map +1 -1
- package/elements.js +3 -0
- package/elements.js.map +1 -1
- package/input/common.js +4 -1
- package/input/common.js.map +1 -1
- package/input/index.android.d.ts +2 -1
- package/input/index.android.js +6 -1
- package/input/index.android.js.map +1 -1
- package/package.json +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 +8 -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 +278 -333
- package/platforms/ios/Mason.xcframework/ios-arm64/Mason.framework/Modules/Mason.swiftmodule/arm64-apple-ios.private.swiftinterface +2 -0
- 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 +2 -0
- 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 +8547 -8502
- package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Headers/Mason-Swift.h +16 -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 +278 -333
- package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Modules/Mason.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface +2 -0
- 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 +2 -0
- package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Modules/Mason.swiftmodule/x86_64-apple-ios-simulator.abi.json +278 -333
- package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Modules/Mason.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface +2 -0
- 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 +2 -0
- package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/_CodeSignature/CodeResources +26 -26
- 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 +8542 -8497
- package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/dSYMs/Mason.framework.dSYM/Contents/Resources/Relocations/x86_64/Mason.yml +8180 -8137
- package/platforms/ios/Mason.xcframework/xros-arm64/Mason.framework/Headers/Mason-Swift.h +8 -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 +278 -333
- package/platforms/ios/Mason.xcframework/xros-arm64/Mason.framework/Modules/Mason.swiftmodule/arm64-apple-xros.private.swiftinterface +2 -0
- 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 +2 -0
- 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 +8040 -7997
- package/platforms/ios/Mason.xcframework/xros-arm64-simulator/Mason.framework/Headers/Mason-Swift.h +8 -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 +278 -333
- package/platforms/ios/Mason.xcframework/xros-arm64-simulator/Mason.framework/Modules/Mason.swiftmodule/arm64-apple-xros-simulator.private.swiftinterface +2 -0
- 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 +2 -0
- package/platforms/ios/Mason.xcframework/xros-arm64-simulator/Mason.framework/_CodeSignature/CodeResources +14 -14
- 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 +8040 -7997
- package/symbols.d.ts +4 -0
- package/symbols.js +14 -0
- package/symbols.js.map +1 -1
- package/view/index.android.js +2 -2
- package/view/index.android.js.map +1 -1
- package/view/index.ios.js +1 -1
- package/view/index.ios.js.map +1 -1
- package/web.d.ts +8 -0
- package/web.js +16 -0
- package/web.js.map +1 -1
package/common.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { AddChildFromBuilder, CustomLayoutView, View as NSView, ViewBase as NSViewBase, Property, widthProperty, heightProperty, CoreTypes, marginLeftProperty, marginRightProperty, marginTopProperty, marginBottomProperty, minWidthProperty, minHeightProperty, fontSizeProperty, fontWeightProperty, fontStyleProperty, colorProperty, lineHeightProperty, letterSpacingProperty, textAlignmentProperty, textDecorationProperty, borderLeftWidthProperty, borderTopWidthProperty, borderRightWidthProperty, borderBottomWidthProperty, backgroundColorProperty, paddingLeftProperty, paddingRightProperty, paddingTopProperty, paddingBottomProperty, zIndexProperty } from '@nativescript/core';
|
|
2
2
|
import { Display, Gap, GridAutoFlow, JustifyItems, JustifySelf, Length, LengthAuto, Overflow, Position, BoxSizing, VerticalAlign, FlexDirection, Float, Clear } from '.';
|
|
3
3
|
import { alignItemsProperty, alignSelfProperty, flexDirectionProperty, flexGrowProperty, flexShrinkProperty, flexWrapProperty, justifyContentProperty } from '@nativescript/core/ui/layouts/flexbox-layout';
|
|
4
|
-
import { fontInternalProperty } from '@nativescript/core/ui/styling/style-properties';
|
|
4
|
+
import { fontInternalProperty, borderTopLeftRadiusProperty, borderTopRightRadiusProperty, borderBottomRightRadiusProperty, borderBottomLeftRadiusProperty, borderTopColorProperty, borderRightColorProperty, borderBottomColorProperty, borderLeftColorProperty } from '@nativescript/core/ui/styling/style-properties';
|
|
5
5
|
import { Style } from './style';
|
|
6
6
|
import { alignContentProperty, aspectRatioProperty, backgroundProperty, borderProperty, borderLeftProperty, borderTopProperty, borderRightProperty, borderBottomProperty, borderRadiusProperty, bottomProperty, boxSizingProperty, clearProperty, columnGapProperty, cornerShapeProperty, displayProperty, filterProperty, flexBasisProperty, floatProperty, gridAreaProperty, gridAutoColumnsProperty, gridAutoFlowProperty, gridAutoRowsProperty, gridColumnEndProperty, gridColumnProperty, gridColumnStartProperty, gridRowEndProperty, gridRowProperty, gridRowStartProperty, gridTemplateAreasProperty, gridTemplateColumnsProperty, gridTemplateRowsProperty, justifyItemsProperty, justifySelfProperty, leftProperty, marginProperty, maxHeightProperty, maxWidthProperty, overflowXProperty, overflowYProperty, paddingProperty, positionProperty, rightProperty, rowGapProperty, scrollBarWidthProperty, textOverFlowProperty, textProperty, textWrapProperty, topProperty, verticalAlignProperty, boxShadowProperty, transformProperty, borderColorProperty, borderStyleProperty, backgroundImageProperty, listStyleTypeProperty, listStylePositionProperty } from './properties';
|
|
7
|
-
import { isMasonView_, isTextChild_, isText_, native_, pseudoStyles_ } from './symbols';
|
|
7
|
+
import { isMasonView_, isTextChild_, isText_, native_, pseudoStyles_, eventType_ } from './symbols';
|
|
8
8
|
import { TextNode } from './text-node';
|
|
9
9
|
export interface MasonChild extends ViewBase {
|
|
10
10
|
}
|
|
@@ -69,6 +69,14 @@ export declare class ViewBase extends CustomLayoutView implements AddChildFromBu
|
|
|
69
69
|
[textProperty.setNative]: (value: string) => void;
|
|
70
70
|
[filterProperty.setNative]: (value: any) => void;
|
|
71
71
|
[borderRadiusProperty.setNative]: (value: any) => void;
|
|
72
|
+
[borderTopLeftRadiusProperty.setNative]: (value: CoreTypes.LengthType) => void;
|
|
73
|
+
[borderTopRightRadiusProperty.setNative]: (value: CoreTypes.LengthType) => void;
|
|
74
|
+
[borderBottomRightRadiusProperty.setNative]: (value: CoreTypes.LengthType) => void;
|
|
75
|
+
[borderBottomLeftRadiusProperty.setNative]: (value: CoreTypes.LengthType) => void;
|
|
76
|
+
[borderTopColorProperty.setNative]: (value: any) => void;
|
|
77
|
+
[borderRightColorProperty.setNative]: (value: any) => void;
|
|
78
|
+
[borderBottomColorProperty.setNative]: (value: any) => void;
|
|
79
|
+
[borderLeftColorProperty.setNative]: (value: any) => void;
|
|
72
80
|
[borderProperty.setNative]: (value: any) => void;
|
|
73
81
|
[borderLeftProperty.setNative]: (value: any) => void;
|
|
74
82
|
[borderTopProperty.setNative]: (value: any) => void;
|
|
@@ -266,6 +274,8 @@ export declare class ViewBase extends CustomLayoutView implements AddChildFromBu
|
|
|
266
274
|
set filter(value: string);
|
|
267
275
|
set borderRadius(value: string | number | CoreTypes.LengthDipUnit | CoreTypes.LengthPxUnit);
|
|
268
276
|
get borderRadius(): string | number | CoreTypes.LengthDipUnit | CoreTypes.LengthPxUnit;
|
|
277
|
+
private _borderRadiusCorner;
|
|
278
|
+
private _borderSideColor;
|
|
269
279
|
set border(value: string);
|
|
270
280
|
get border(): string;
|
|
271
281
|
set background(value: string);
|
|
@@ -356,6 +366,7 @@ export declare class ImageBase extends ViewBase {
|
|
|
356
366
|
}
|
|
357
367
|
export declare class Event {
|
|
358
368
|
[native_]: any;
|
|
369
|
+
[eventType_]: string | undefined;
|
|
359
370
|
get bubbles(): boolean;
|
|
360
371
|
get cancelable(): boolean;
|
|
361
372
|
get isComposing(): any;
|
|
@@ -368,7 +379,9 @@ export declare class Event {
|
|
|
368
379
|
stopPropagation(): void;
|
|
369
380
|
preventDefault(): void;
|
|
370
381
|
get type(): string;
|
|
371
|
-
set type(
|
|
382
|
+
set type(value: string);
|
|
383
|
+
get button(): number;
|
|
384
|
+
set button(_: number);
|
|
372
385
|
get target(): any;
|
|
373
386
|
set target(_: any);
|
|
374
387
|
set currentTarget(_: any);
|
package/common.js
CHANGED
|
@@ -3,11 +3,14 @@ var _a, _b, _c, _d;
|
|
|
3
3
|
/* eslint-disable @typescript-eslint/ban-ts-comment */
|
|
4
4
|
import { CustomLayoutView, View as NSView, getViewById, Property, widthProperty, heightProperty, marginLeftProperty, marginRightProperty, marginTopProperty, marginBottomProperty, minWidthProperty, minHeightProperty, fontSizeProperty, fontWeightProperty, fontStyleProperty, colorProperty, Color, lineHeightProperty, letterSpacingProperty, textAlignmentProperty, textDecorationProperty, borderLeftWidthProperty, borderTopWidthProperty, borderRightWidthProperty, borderBottomWidthProperty, backgroundColorProperty, paddingLeftProperty, paddingRightProperty, paddingTopProperty, paddingBottomProperty, zIndexProperty, PseudoClassHandler } from '@nativescript/core';
|
|
5
5
|
import { alignItemsProperty, alignSelfProperty, flexDirectionProperty, flexGrowProperty, flexShrinkProperty, flexWrapProperty, justifyContentProperty } from '@nativescript/core/ui/layouts/flexbox-layout';
|
|
6
|
-
|
|
6
|
+
// The per-corner radius and per-side colour longhands core's `border-radius`
|
|
7
|
+
// / `border-color` shorthands expand into. They live in the styling module
|
|
8
|
+
// rather than core's root export, unlike the border *width* longhands above.
|
|
9
|
+
import { fontInternalProperty, borderTopLeftRadiusProperty, borderTopRightRadiusProperty, borderBottomRightRadiusProperty, borderBottomLeftRadiusProperty, borderTopColorProperty, borderRightColorProperty, borderBottomColorProperty, borderLeftColorProperty } from '@nativescript/core/ui/styling/style-properties';
|
|
7
10
|
import { _forceStyleUpdate } from './utils';
|
|
8
11
|
import { Style } from './style';
|
|
9
12
|
import { alignContentProperty, aspectRatioProperty, backgroundProperty, borderProperty, borderLeftProperty, borderTopProperty, borderRightProperty, borderBottomProperty, borderRadiusProperty, bottomProperty, boxSizingProperty, clearProperty, columnGapProperty, cornerShapeProperty, displayProperty, filterProperty, flexBasisProperty, floatProperty, gridAreaProperty, gridAutoColumnsProperty, gridAutoFlowProperty, gridAutoRowsProperty, gridColumnEndProperty, gridColumnProperty, gridColumnStartProperty, gridRowEndProperty, gridRowProperty, gridRowStartProperty, gridTemplateAreasProperty, gridTemplateColumnsProperty, gridTemplateRowsProperty, justifyItemsProperty, justifySelfProperty, leftProperty, marginProperty, maxHeightProperty, maxWidthProperty, overflowXProperty, overflowYProperty, paddingProperty, positionProperty, rightProperty, rowGapProperty, scrollBarWidthProperty, textOverFlowProperty, textProperty, textWrapProperty, topProperty, verticalAlignProperty, boxShadowProperty, transformProperty, borderColorProperty, borderStyleProperty, backgroundImageProperty, listStyleTypeProperty, listStylePositionProperty, } from './properties';
|
|
10
|
-
import { isMasonView_, isTextChild_, isText_, isPlaceholder_, text_, native_, textNode_, textNodeIndex_, textNodeProxied_, pseudoStyles_ } from './symbols';
|
|
13
|
+
import { isMasonView_, isTextChild_, isText_, isPlaceholder_, text_, native_, textNode_, textNodeIndex_, textNodeProxied_, pseudoStyles_, emptyTextNode_, borderRadiusCorners_, borderSideColors_, eventType_ } from './symbols';
|
|
11
14
|
import { Tree } from './tree';
|
|
12
15
|
import { TextNode } from './text-node';
|
|
13
16
|
import { compile } from './pseudo';
|
|
@@ -151,6 +154,18 @@ function nativeOwnerFor(nativeView) {
|
|
|
151
154
|
function nativeViewFor(owner) {
|
|
152
155
|
return owner?.nativeViewProtected ?? owner?.[native_];
|
|
153
156
|
}
|
|
157
|
+
function masonNativeEventName(eventName) {
|
|
158
|
+
switch (eventName) {
|
|
159
|
+
case 'tap':
|
|
160
|
+
case 'click':
|
|
161
|
+
return 'click';
|
|
162
|
+
case 'input':
|
|
163
|
+
case 'change':
|
|
164
|
+
return eventName;
|
|
165
|
+
default:
|
|
166
|
+
return null;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
154
169
|
function findOwnerForNativeView(owner, nativeView) {
|
|
155
170
|
if (!owner || !nativeView)
|
|
156
171
|
return null;
|
|
@@ -176,6 +191,36 @@ export const textContentProperty = new Property({
|
|
|
176
191
|
function toCamelCase(prop) {
|
|
177
192
|
return prop.replace(/-([a-z])/g, (_, c) => c.toUpperCase());
|
|
178
193
|
}
|
|
194
|
+
/** A core `Length` (number of dip, or `{ value, unit }`) as a CSS string. */
|
|
195
|
+
function lengthToCssString(value) {
|
|
196
|
+
if (value == null) {
|
|
197
|
+
return '0';
|
|
198
|
+
}
|
|
199
|
+
if (typeof value === 'number') {
|
|
200
|
+
return `${value}px`;
|
|
201
|
+
}
|
|
202
|
+
const unit = value.unit;
|
|
203
|
+
const amount = value.value ?? 0;
|
|
204
|
+
return unit === '%' ? `${amount * 100}%` : `${amount}px`;
|
|
205
|
+
}
|
|
206
|
+
/**
|
|
207
|
+
* A core colour value as a CSS string. Duck-typed rather than
|
|
208
|
+
* `instanceof Color` on purpose: a `Color` can arrive from a different
|
|
209
|
+
* `@nativescript/core` copy, where `instanceof` fails.
|
|
210
|
+
*/
|
|
211
|
+
function colorToCssString(value) {
|
|
212
|
+
if (value == null) {
|
|
213
|
+
return 'transparent';
|
|
214
|
+
}
|
|
215
|
+
if (typeof value === 'string') {
|
|
216
|
+
return value;
|
|
217
|
+
}
|
|
218
|
+
const hex = value.hex;
|
|
219
|
+
if (typeof hex === 'string') {
|
|
220
|
+
return hex;
|
|
221
|
+
}
|
|
222
|
+
return String(value);
|
|
223
|
+
}
|
|
179
224
|
export class ViewBase extends CustomLayoutView {
|
|
180
225
|
/**
|
|
181
226
|
* Enable or disable CSS Preflight (web-normalised / Tailwind-like) defaults
|
|
@@ -369,14 +414,14 @@ export class ViewBase extends CustomLayoutView {
|
|
|
369
414
|
//@ts-ignore
|
|
370
415
|
if (this._view) {
|
|
371
416
|
if (__ANDROID__) {
|
|
372
|
-
if (
|
|
417
|
+
if (id) {
|
|
373
418
|
//@ts-ignore
|
|
374
419
|
const removed = this._view.removeEventListener(arg, id);
|
|
375
420
|
callback['mason:event:id'] = undefined;
|
|
376
421
|
}
|
|
377
422
|
}
|
|
378
423
|
if (__APPLE__) {
|
|
379
|
-
if (
|
|
424
|
+
if (id) {
|
|
380
425
|
//@ts-ignore
|
|
381
426
|
const removed = this._view.mason_removeEventListenerId(arg, id);
|
|
382
427
|
callback['mason:event:id'] = undefined;
|
|
@@ -420,17 +465,17 @@ export class ViewBase extends CustomLayoutView {
|
|
|
420
465
|
capture: thisArg,
|
|
421
466
|
};
|
|
422
467
|
}
|
|
423
|
-
super.addEventListener(arg, callback, thisArg);
|
|
424
468
|
if (typeof arg !== 'string') {
|
|
469
|
+
super.addEventListener(arg, callback, thisArg);
|
|
425
470
|
return;
|
|
426
471
|
}
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
break;
|
|
472
|
+
const nativeEventName = masonNativeEventName(arg);
|
|
473
|
+
if (nativeEventName) {
|
|
474
|
+
super.addEventListener(nativeEventName, callback, thisArg);
|
|
475
|
+
this._registerNativeEvent(nativeEventName, callback, thisArg);
|
|
476
|
+
return;
|
|
433
477
|
}
|
|
478
|
+
super.addEventListener(arg, callback, thisArg);
|
|
434
479
|
}
|
|
435
480
|
removeEventListener(arg, callback, thisArg) {
|
|
436
481
|
if (typeof thisArg === 'boolean') {
|
|
@@ -438,14 +483,15 @@ export class ViewBase extends CustomLayoutView {
|
|
|
438
483
|
capture: thisArg,
|
|
439
484
|
};
|
|
440
485
|
}
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
486
|
+
if (typeof arg === 'string') {
|
|
487
|
+
const nativeEventName = masonNativeEventName(arg);
|
|
488
|
+
if (nativeEventName) {
|
|
489
|
+
super.removeEventListener(nativeEventName, callback, thisArg);
|
|
490
|
+
this._unregisterNativeEvent(nativeEventName, callback, thisArg);
|
|
491
|
+
return;
|
|
492
|
+
}
|
|
448
493
|
}
|
|
494
|
+
super.removeEventListener(arg, callback, thisArg);
|
|
449
495
|
}
|
|
450
496
|
_applyPseudoClassStyles(pseudoClass, view, styles) {
|
|
451
497
|
if (pseudoClass && styles && pseudoClass in styles) {
|
|
@@ -1042,7 +1088,21 @@ export class ViewBase extends CustomLayoutView {
|
|
|
1042
1088
|
if (Array.isArray(frameworkEl.childNodes)) {
|
|
1043
1089
|
const rawChildNodes = frameworkEl.childNodes;
|
|
1044
1090
|
if (rawChildNodes.length === 0) {
|
|
1045
|
-
this
|
|
1091
|
+
// No framework-tracked DOM child backs this text (e.g. a Label-like
|
|
1092
|
+
// element with plain `.text` set directly). Without a stable node to
|
|
1093
|
+
// key the reuse cache on, every write fell through to the "always
|
|
1094
|
+
// new" `replaceChild` string branch, orphaning a native TextNode
|
|
1095
|
+
// each call. Cache a synthetic node on `this` instead, so repeat
|
|
1096
|
+
// writes route through the same update-in-place path a real DOM
|
|
1097
|
+
// text node gets (and never touch `replaceChild`, which a host
|
|
1098
|
+
// framework's DOM shim may itself shadow).
|
|
1099
|
+
let node = this[emptyTextNode_];
|
|
1100
|
+
if (!node) {
|
|
1101
|
+
node = {};
|
|
1102
|
+
this[emptyTextNode_] = node;
|
|
1103
|
+
}
|
|
1104
|
+
node.text = value;
|
|
1105
|
+
this._updateTextNode(node, { type: this._children.length === 0 ? 'add' : 'replace', index: 0, isBreak: false });
|
|
1046
1106
|
return;
|
|
1047
1107
|
}
|
|
1048
1108
|
// Deduplicate nodes (some frameworks expose the same nodes via both
|
|
@@ -1146,6 +1206,73 @@ export class ViewBase extends CustomLayoutView {
|
|
|
1146
1206
|
style.borderRadius = value;
|
|
1147
1207
|
}
|
|
1148
1208
|
}
|
|
1209
|
+
// `border-radius` / `border-color` arriving as core's longhands.
|
|
1210
|
+
//
|
|
1211
|
+
// Core expands both shorthands into four longhands before a *stylesheet*
|
|
1212
|
+
// declaration ever reaches a property (`_expandCssShorthand` in
|
|
1213
|
+
// ui/styling/css-selector), so our own shorthand `setNative` above only
|
|
1214
|
+
// ever fires for an inline `view.style.borderRadius = …`. A CSS class was
|
|
1215
|
+
// silently doing nothing. Each longhand below records its corner/side and
|
|
1216
|
+
// recomposes the whole shorthand string, which is the shape the native
|
|
1217
|
+
// side parses anyway.
|
|
1218
|
+
_borderRadiusCorner(corner, value) {
|
|
1219
|
+
// @ts-ignore
|
|
1220
|
+
const style = this._styleHelper;
|
|
1221
|
+
if (!style) {
|
|
1222
|
+
return;
|
|
1223
|
+
}
|
|
1224
|
+
let corners = this[borderRadiusCorners_];
|
|
1225
|
+
if (!corners) {
|
|
1226
|
+
corners = this[borderRadiusCorners_] = { tl: '0', tr: '0', br: '0', bl: '0' };
|
|
1227
|
+
}
|
|
1228
|
+
corners[corner] = lengthToCssString(value);
|
|
1229
|
+
// @ts-ignore
|
|
1230
|
+
style.borderRadius = `${corners.tl} ${corners.tr} ${corners.br} ${corners.bl}`;
|
|
1231
|
+
}
|
|
1232
|
+
[borderTopLeftRadiusProperty.setNative](value) {
|
|
1233
|
+
this._borderRadiusCorner('tl', value);
|
|
1234
|
+
}
|
|
1235
|
+
[borderTopRightRadiusProperty.setNative](value) {
|
|
1236
|
+
this._borderRadiusCorner('tr', value);
|
|
1237
|
+
}
|
|
1238
|
+
[borderBottomRightRadiusProperty.setNative](value) {
|
|
1239
|
+
this._borderRadiusCorner('br', value);
|
|
1240
|
+
}
|
|
1241
|
+
[borderBottomLeftRadiusProperty.setNative](value) {
|
|
1242
|
+
this._borderRadiusCorner('bl', value);
|
|
1243
|
+
}
|
|
1244
|
+
_borderSideColor(side, value) {
|
|
1245
|
+
let sides = this[borderSideColors_];
|
|
1246
|
+
if (!sides) {
|
|
1247
|
+
sides = this[borderSideColors_] = { t: 'transparent', r: 'transparent', b: 'transparent', l: 'transparent' };
|
|
1248
|
+
}
|
|
1249
|
+
sides[side] = colorToCssString(value);
|
|
1250
|
+
const shorthand = `${sides.t} ${sides.r} ${sides.b} ${sides.l}`;
|
|
1251
|
+
if (__ANDROID__) {
|
|
1252
|
+
// @ts-ignore
|
|
1253
|
+
org.nativescript.mason.masonkit.NodeHelper.getShared().setBorderColor(this.nativeView, shorthand);
|
|
1254
|
+
}
|
|
1255
|
+
else if (__APPLE__) {
|
|
1256
|
+
// @ts-ignore
|
|
1257
|
+
this.nativeView?.style?.setBorderColor(shorthand);
|
|
1258
|
+
}
|
|
1259
|
+
else if (__WINDOWS__) {
|
|
1260
|
+
// @ts-ignore
|
|
1261
|
+
this._styleHelper?.setBorderColor(shorthand);
|
|
1262
|
+
}
|
|
1263
|
+
}
|
|
1264
|
+
[borderTopColorProperty.setNative](value) {
|
|
1265
|
+
this._borderSideColor('t', value);
|
|
1266
|
+
}
|
|
1267
|
+
[borderRightColorProperty.setNative](value) {
|
|
1268
|
+
this._borderSideColor('r', value);
|
|
1269
|
+
}
|
|
1270
|
+
[borderBottomColorProperty.setNative](value) {
|
|
1271
|
+
this._borderSideColor('b', value);
|
|
1272
|
+
}
|
|
1273
|
+
[borderLeftColorProperty.setNative](value) {
|
|
1274
|
+
this._borderSideColor('l', value);
|
|
1275
|
+
}
|
|
1149
1276
|
set border(value) {
|
|
1150
1277
|
this.style.border = value;
|
|
1151
1278
|
}
|
|
@@ -2231,13 +2358,10 @@ export class Event {
|
|
|
2231
2358
|
return false;
|
|
2232
2359
|
}
|
|
2233
2360
|
get currentTarget() {
|
|
2234
|
-
|
|
2235
|
-
|
|
2236
|
-
|
|
2237
|
-
|
|
2238
|
-
return this[native_]?.currentTarget;
|
|
2239
|
-
}
|
|
2240
|
-
return false;
|
|
2361
|
+
// DOM semantics: the element the listener is attached to, not the raw
|
|
2362
|
+
// native view. `_target` is set to that same owner at every dispatch
|
|
2363
|
+
// site (_registerNativeEvent), so reuse it here.
|
|
2364
|
+
return this['_target'];
|
|
2241
2365
|
}
|
|
2242
2366
|
stopImmediatePropagation() {
|
|
2243
2367
|
if (__ANDROID__) {
|
|
@@ -2263,13 +2387,31 @@ export class Event {
|
|
|
2263
2387
|
return this[native_]?.preventDefault();
|
|
2264
2388
|
}
|
|
2265
2389
|
}
|
|
2390
|
+
// Writable on purpose, unlike the DOM's read-only `Event.type`. Aliases
|
|
2391
|
+
// (e.g. 'tap') are folded onto the native name ('click') before the event
|
|
2392
|
+
// reaches JS; a host framework's DOM shim relabels it back to the name the
|
|
2393
|
+
// listener was registered under and re-dispatches, which needs a working
|
|
2394
|
+
// setter or the relabel is silently dropped and the listener never fires.
|
|
2266
2395
|
get type() {
|
|
2396
|
+
const override = this[eventType_];
|
|
2397
|
+
if (override !== undefined) {
|
|
2398
|
+
return override;
|
|
2399
|
+
}
|
|
2267
2400
|
if (__ANDROID__) {
|
|
2268
2401
|
return this[native_]?.getType();
|
|
2269
2402
|
}
|
|
2270
2403
|
return this[native_]?.type;
|
|
2271
2404
|
}
|
|
2272
|
-
set type(
|
|
2405
|
+
set type(value) {
|
|
2406
|
+
this[eventType_] = value;
|
|
2407
|
+
}
|
|
2408
|
+
// DOM MouseEvent.button: 0 = primary button. Mason's touch-originated
|
|
2409
|
+
// click has no native concept of mouse buttons, but callers checking
|
|
2410
|
+
// `e.button === 0` (e.g. a router's <Link> onClick guard) expect this.
|
|
2411
|
+
get button() {
|
|
2412
|
+
return 0;
|
|
2413
|
+
}
|
|
2414
|
+
set button(_) { }
|
|
2273
2415
|
get target() {
|
|
2274
2416
|
return this['_target'];
|
|
2275
2417
|
}
|