@akylas/nativescript 8.3.6 → 8.4.4
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/accessibility/accessibility-common.js +2 -2
- package/accessibility/accessibility-common.js.map +1 -1
- package/accessibility/accessibility-service-common.js +1 -1
- package/accessibility/accessibility-service-common.js.map +1 -1
- package/accessibility/accessibility-service.android.js +2 -1
- package/accessibility/accessibility-service.android.js.map +1 -1
- package/accessibility/accessibility-service.ios.js +1 -1
- package/accessibility/accessibility-service.ios.js.map +1 -1
- package/accessibility/font-scale.android.js +1 -2
- package/accessibility/font-scale.android.js.map +1 -1
- package/accessibility/index.android.js +8 -8
- package/accessibility/index.android.js.map +1 -1
- package/accessibility/index.ios.js +5 -6
- package/accessibility/index.ios.js.map +1 -1
- package/application/index.android.js +14 -2
- package/application/index.android.js.map +1 -1
- package/application/index.ios.js +4 -5
- package/application/index.ios.js.map +1 -1
- package/application-settings/index.android.js +15 -2
- package/application-settings/index.android.js.map +1 -1
- package/color/color-common.d.ts +5 -2
- package/color/color-common.js +11 -8
- package/color/color-common.js.map +1 -1
- package/color/index.android.d.ts +2 -2
- package/color/index.android.js +2 -2
- package/color/index.android.js.map +1 -1
- package/color/index.d.ts +1 -1
- package/color/index.ios.d.ts +2 -2
- package/color/index.ios.js +8 -4
- package/color/index.ios.js.map +1 -1
- package/connectivity/index.android.js +4 -3
- package/connectivity/index.android.js.map +1 -1
- package/core-types/index.d.ts +36 -31
- package/core-types/index.js +7 -0
- package/core-types/index.js.map +1 -1
- package/css/parser.js +2 -1
- package/css/parser.js.map +1 -1
- package/css/reworkcss.d.ts +2 -2
- package/data/observable-array/index.js +1 -1
- package/data/observable-array/index.js.map +1 -1
- package/debugger/webinspector-css.ios.js.map +1 -1
- package/debugger/webinspector-dom.ios.js.map +1 -1
- package/debugger/webinspector-network.ios.js.map +1 -1
- package/file-system/file-system-access.android.js +18 -12
- package/file-system/file-system-access.android.js.map +1 -1
- package/file-system/index.js +2 -2
- package/file-system/index.js.map +1 -1
- package/fps-meter/fps-native.android.d.ts +0 -1
- package/fps-meter/fps-native.android.js +2 -3
- package/fps-meter/fps-native.android.js.map +1 -1
- package/fps-meter/fps-native.ios.js +2 -1
- package/fps-meter/fps-native.ios.js.map +1 -1
- package/global-types.d.ts +12 -7
- package/globals/index.js +4 -1
- package/globals/index.js.map +1 -1
- package/image-asset/index.ios.js +1 -2
- package/image-asset/index.ios.js.map +1 -1
- package/image-source/index.android.js +5 -1
- package/image-source/index.android.js.map +1 -1
- package/image-source/index.ios.js +2 -4
- package/image-source/index.ios.js.map +1 -1
- package/index.d.ts +6 -1
- package/index.js +7 -1
- package/index.js.map +1 -1
- package/package.json +2 -1
- package/platform/index.android.js +3 -2
- package/platform/index.android.js.map +1 -1
- package/platforms/android/native-api-usage.json +5 -0
- package/platforms/android/widgets-release.aar +0 -0
- package/platforms/ios/native-api-usage.json +2 -1
- package/platforms/ios/src/NativeScriptUtils.h +1 -1
- package/platforms/ios/src/NativeScriptUtils.m +22 -19
- package/platforms/ios/typings/objc!MaterialComponents.d.ts +0 -1
- package/platforms/ios/typings/objc!NativeScriptUtils.d.ts +1 -2
- package/timer/index.android.js +8 -0
- package/timer/index.android.js.map +1 -1
- package/ui/action-bar/action-bar-common.d.ts +1 -1
- package/ui/action-bar/action-bar-common.js +7 -11
- package/ui/action-bar/action-bar-common.js.map +1 -1
- package/ui/action-bar/index.android.js +16 -23
- package/ui/action-bar/index.android.js.map +1 -1
- package/ui/action-bar/index.ios.js +9 -15
- package/ui/action-bar/index.ios.js.map +1 -1
- package/ui/activity-indicator/activity-indicator-common.js.map +1 -1
- package/ui/animation/animation-common.js +1 -2
- package/ui/animation/animation-common.js.map +1 -1
- package/ui/animation/index.android.js +5 -4
- package/ui/animation/index.android.js.map +1 -1
- package/ui/animation/index.ios.d.ts +2 -2
- package/ui/animation/index.ios.js +37 -34
- package/ui/animation/index.ios.js.map +1 -1
- package/ui/animation/keyframe-animation.js +3 -3
- package/ui/animation/keyframe-animation.js.map +1 -1
- package/ui/builder/index.js +15 -2
- package/ui/builder/index.js.map +1 -1
- package/ui/button/button-common.js.map +1 -1
- package/ui/button/index.android.d.ts +0 -1
- package/ui/button/index.android.js +6 -16
- package/ui/button/index.android.js.map +1 -1
- package/ui/button/index.ios.js +1 -1
- package/ui/button/index.ios.js.map +1 -1
- package/ui/core/bindable/bindable-expressions.js +14 -16
- package/ui/core/bindable/bindable-expressions.js.map +1 -1
- package/ui/core/bindable/index.js +2 -2
- package/ui/core/bindable/index.js.map +1 -1
- package/ui/core/properties/index.d.ts +0 -1
- package/ui/core/properties/index.js.map +1 -1
- package/ui/core/view/index.android.js +9 -13
- package/ui/core/view/index.android.js.map +1 -1
- package/ui/core/view/index.ios.js +2 -2
- package/ui/core/view/index.ios.js.map +1 -1
- package/ui/core/view/view-common.js +9 -10
- package/ui/core/view/view-common.js.map +1 -1
- package/ui/core/view/view-helper/index.ios.js +17 -7
- package/ui/core/view/view-helper/index.ios.js.map +1 -1
- package/ui/core/view/view-helper/view-helper-common.js +1 -6
- package/ui/core/view/view-helper/view-helper-common.js.map +1 -1
- package/ui/core/view-base/index.d.ts +1 -1
- package/ui/core/view-base/index.js +13 -14
- package/ui/core/view-base/index.js.map +1 -1
- package/ui/date-picker/date-picker-common.js.map +1 -1
- package/ui/date-picker/index.ios.js +2 -1
- package/ui/editable-text-base/index.android.js +13 -5
- package/ui/editable-text-base/index.android.js.map +1 -1
- package/ui/editable-text-base/index.ios.js +18 -3
- package/ui/editable-text-base/index.ios.js.map +1 -1
- package/ui/frame/frame-common.js.map +1 -1
- package/ui/frame/index.android.js +3 -4
- package/ui/frame/index.android.js.map +1 -1
- package/ui/frame/index.ios.d.ts +1 -0
- package/ui/frame/index.ios.js +33 -10
- package/ui/frame/index.ios.js.map +1 -1
- package/ui/gestures/index.ios.js +2 -1
- package/ui/gestures/index.ios.js.map +1 -1
- package/ui/gestures/touch-manager.js +16 -17
- package/ui/gestures/touch-manager.js.map +1 -1
- package/ui/html-view/html-view-common.js.map +1 -1
- package/ui/html-view/index.android.js +2 -2
- package/ui/html-view/index.android.js.map +1 -1
- package/ui/image/image-common.js.map +1 -1
- package/ui/image/index.ios.js +5 -8
- package/ui/image/index.ios.js.map +1 -1
- package/ui/image-cache/index.android.js +2 -2
- package/ui/image-cache/index.android.js.map +1 -1
- package/ui/index.d.ts +1 -1
- package/ui/index.js +1 -1
- package/ui/index.js.map +1 -1
- package/ui/label/index.android.js.map +1 -1
- package/ui/label/index.ios.js.map +1 -1
- package/ui/layouts/absolute-layout/absolute-layout-common.js +4 -3
- package/ui/layouts/absolute-layout/absolute-layout-common.js.map +1 -1
- package/ui/layouts/dock-layout/dock-layout-common.js.map +1 -1
- package/ui/layouts/flexbox-layout/flexbox-layout-common.js.map +1 -1
- package/ui/layouts/grid-layout/grid-layout-common.d.ts +4 -4
- package/ui/layouts/grid-layout/grid-layout-common.js +4 -4
- package/ui/layouts/grid-layout/grid-layout-common.js.map +1 -1
- package/ui/layouts/root-layout/index.android.js +15 -9
- package/ui/layouts/root-layout/index.android.js.map +1 -1
- package/ui/layouts/root-layout/index.ios.js +16 -10
- package/ui/layouts/root-layout/index.ios.js.map +1 -1
- package/ui/layouts/root-layout/root-layout-common.js +26 -15
- package/ui/layouts/root-layout/root-layout-common.js.map +1 -1
- package/ui/layouts/stack-layout/stack-layout-common.js.map +1 -1
- package/ui/layouts/wrap-layout/wrap-layout-common.js.map +1 -1
- package/ui/list-picker/index.android.js +0 -3
- package/ui/list-picker/index.android.js.map +1 -1
- package/ui/list-picker/index.ios.js +6 -3
- package/ui/list-picker/list-picker-common.js.map +1 -1
- package/ui/list-view/index.ios.d.ts +0 -1
- package/ui/list-view/index.ios.js +18 -15
- package/ui/list-view/index.ios.js.map +1 -1
- package/ui/list-view/list-view-common.js.map +1 -1
- package/ui/page/index.android.d.ts +1 -0
- package/ui/page/index.android.js +21 -9
- package/ui/page/index.android.js.map +1 -1
- package/ui/page/index.ios.d.ts +7 -0
- package/ui/page/index.ios.js +59 -10
- package/ui/page/index.ios.js.map +1 -1
- package/ui/page/page-common.js.map +1 -1
- package/ui/placeholder/index.android.js.map +1 -1
- package/ui/progress/progress-common.js.map +1 -1
- package/ui/proxy-view-container/index.js.map +1 -1
- package/ui/repeater/index.js.map +1 -1
- package/ui/scroll-view/index.android.js +6 -6
- package/ui/scroll-view/index.android.js.map +1 -1
- package/ui/scroll-view/index.ios.js +2 -1
- package/ui/scroll-view/index.ios.js.map +1 -1
- package/ui/scroll-view/scroll-view-common.js.map +1 -1
- package/ui/search-bar/index.ios.js +6 -3
- package/ui/search-bar/index.ios.js.map +1 -1
- package/ui/search-bar/search-bar-common.js.map +1 -1
- package/ui/segmented-bar/index.android.js +3 -4
- package/ui/segmented-bar/index.android.js.map +1 -1
- package/ui/segmented-bar/index.ios.js +3 -2
- package/ui/segmented-bar/index.ios.js.map +1 -1
- package/ui/segmented-bar/segmented-bar-common.js.map +1 -1
- package/ui/slider/index.ios.js +6 -3
- package/ui/slider/index.ios.js.map +1 -1
- package/ui/slider/slider-common.js.map +1 -1
- package/ui/styling/background.ios.js +9 -4
- package/ui/styling/background.ios.js.map +1 -1
- package/ui/styling/css-animation-parser.js +1 -1
- package/ui/styling/css-animation-parser.js.map +1 -1
- package/ui/styling/{css-selector/index.d.ts → css-selector.d.ts} +4 -3
- package/ui/styling/{css-selector/index.js → css-selector.js} +6 -6
- package/ui/styling/css-selector.js.map +1 -0
- package/ui/styling/css-shadow.js +5 -4
- package/ui/styling/css-shadow.js.map +1 -1
- package/ui/styling/font-common.d.ts +16 -7
- package/ui/styling/font-common.js +71 -5
- package/ui/styling/font-common.js.map +1 -1
- package/ui/styling/font-interfaces.d.ts +9 -4
- package/ui/styling/font.android.d.ts +4 -2
- package/ui/styling/font.android.js +56 -27
- package/ui/styling/font.android.js.map +1 -1
- package/ui/styling/font.d.ts +16 -17
- package/ui/styling/font.ios.d.ts +5 -3
- package/ui/styling/font.ios.js +36 -12
- package/ui/styling/font.ios.js.map +1 -1
- package/ui/styling/style/index.d.ts +3 -3
- package/ui/styling/style-properties.d.ts +4 -4
- package/ui/styling/style-properties.js +36 -20
- package/ui/styling/style-properties.js.map +1 -1
- package/ui/styling/style-scope.js.map +1 -1
- package/ui/switch/index.ios.js +3 -3
- package/ui/switch/index.ios.js.map +1 -1
- package/ui/switch/switch-common.js.map +1 -1
- package/ui/tab-view/index.ios.js +16 -8
- package/ui/tab-view/index.ios.js.map +1 -1
- package/ui/tab-view/tab-view-common.js.map +1 -1
- package/ui/text-base/formatted-string.d.ts +5 -5
- package/ui/text-base/formatted-string.js.map +1 -1
- package/ui/text-base/index.android.js +8 -2
- package/ui/text-base/index.android.js.map +1 -1
- package/ui/text-base/index.ios.js +4 -3
- package/ui/text-base/index.ios.js.map +1 -1
- package/ui/text-base/span.d.ts +5 -5
- package/ui/text-base/span.js.map +1 -1
- package/ui/text-base/text-base-common.d.ts +6 -6
- package/ui/text-base/text-base-common.js.map +1 -1
- package/ui/text-field/index.ios.js +23 -17
- package/ui/text-field/index.ios.js.map +1 -1
- package/ui/text-field/text-field-common.js.map +1 -1
- package/ui/text-view/index.android.js.map +1 -1
- package/ui/text-view/index.ios.js +12 -6
- package/ui/text-view/index.ios.js.map +1 -1
- package/ui/time-picker/index.android.js +3 -4
- package/ui/time-picker/index.android.js.map +1 -1
- package/ui/time-picker/index.ios.js +2 -1
- package/ui/time-picker/time-picker-common.js.map +1 -1
- package/ui/utils.ios.js +1 -1
- package/ui/utils.ios.js.map +1 -1
- package/ui/web-view/index.android.js +1 -2
- package/ui/web-view/index.android.js.map +1 -1
- package/ui/web-view/index.ios.js +12 -6
- package/ui/web-view/index.ios.js.map +1 -1
- package/ui/web-view/web-view-common.js.map +1 -1
- package/utils/{utils-common.d.ts → common.d.ts} +8 -3
- package/utils/{utils-common.js → common.js} +21 -5
- package/utils/common.js.map +1 -0
- package/utils/constants.android.d.ts +1 -0
- package/utils/constants.android.js +2 -0
- package/utils/constants.android.js.map +1 -0
- package/utils/constants.d.ts +1 -0
- package/utils/constants.ios.d.ts +1 -0
- package/utils/constants.ios.js +2 -0
- package/utils/constants.ios.js.map +1 -0
- package/utils/debug.js +3 -3
- package/utils/debug.js.map +1 -1
- package/utils/index.android.d.ts +4 -1
- package/utils/index.android.js +30 -10
- package/utils/index.android.js.map +1 -1
- package/utils/index.d.ts +19 -81
- package/utils/index.ios.d.ts +4 -1
- package/utils/index.ios.js +13 -1
- package/utils/index.ios.js.map +1 -1
- package/utils/layout-helper/index.android.d.ts +24 -9
- package/utils/layout-helper/index.android.js +72 -33
- package/utils/layout-helper/index.android.js.map +1 -1
- package/utils/layout-helper/index.d.ts +68 -63
- package/utils/layout-helper/index.ios.d.ts +24 -9
- package/utils/layout-helper/index.ios.js +62 -24
- package/utils/layout-helper/index.ios.js.map +1 -1
- package/utils/native-helper.android.d.ts +2 -0
- package/utils/native-helper.android.js +16 -4
- package/utils/native-helper.android.js.map +1 -1
- package/utils/native-helper.d.ts +25 -0
- package/utils/native-helper.ios.d.ts +3 -1
- package/utils/native-helper.ios.js +35 -16
- package/utils/native-helper.ios.js.map +1 -1
- package/jest.config.d.ts +0 -5
- package/jest.config.js.map +0 -1
- package/ui/styling/css-selector/index.js.map +0 -1
- package/utils/utils-common.js.map +0 -1
- package/utils/utils.android.d.ts +0 -5
- package/utils/utils.android.js +0 -6
- package/utils/utils.android.js.map +0 -1
- package/utils/utils.d.ts +0 -1
- package/utils/utils.ios.d.ts +0 -5
- package/utils/utils.ios.js +0 -6
- package/utils/utils.ios.js.map +0 -1
package/ui/styling/css-shadow.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { CoreTypes } from '../../core-types';
|
|
1
2
|
import { Color } from '../../color';
|
|
2
|
-
import { Length
|
|
3
|
+
import { Length } from './style-properties';
|
|
3
4
|
/**
|
|
4
5
|
* Matches whitespace except if the whitespace is contained in parenthesis - ex. rgb(a), hsl color.
|
|
5
6
|
*/
|
|
@@ -29,10 +30,10 @@ export function parseCSSShadow(value) {
|
|
|
29
30
|
return null;
|
|
30
31
|
}
|
|
31
32
|
let colorRaw = 'black';
|
|
32
|
-
if (!isLength(first) && first !== 'inset') {
|
|
33
|
+
if (first && !isLength(first) && first !== 'inset') {
|
|
33
34
|
colorRaw = first;
|
|
34
35
|
}
|
|
35
|
-
else if (!isLength(last)) {
|
|
36
|
+
else if (last && !isLength(last)) {
|
|
36
37
|
colorRaw = last;
|
|
37
38
|
}
|
|
38
39
|
const nums = parts
|
|
@@ -43,7 +44,7 @@ export function parseCSSShadow(value) {
|
|
|
43
44
|
return Length.parse(val);
|
|
44
45
|
}
|
|
45
46
|
catch (err) {
|
|
46
|
-
return zeroLength;
|
|
47
|
+
return CoreTypes.zeroLength;
|
|
47
48
|
}
|
|
48
49
|
});
|
|
49
50
|
const [offsetX, offsetY, blurRadius, spreadRadius] = nums;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"css-shadow.js","sourceRoot":"","sources":["../../../../../packages/core/ui/styling/css-shadow.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"css-shadow.js","sourceRoot":"","sources":["../../../../../packages/core/ui/styling/css-shadow.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAW5C;;GAEG;AACH,MAAM,QAAQ,GAAG,eAAe,CAAC;AAEjC;;GAEG;AACH,MAAM,SAAS,GAAG,uBAAuB,CAAC;AAE1C;;GAEG;AACH,MAAM,QAAQ,GAAG,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,GAAG,IAAI,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAEvD;;;;;;;GAOG;AACH,MAAM,UAAU,cAAc,CAAC,KAAa;IAC3C,MAAM,KAAK,GAAG,KAAK,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AAC;AAED,mCAAmC;AACnC,4BAA4B;AAC5B,0BAA0B;AAC1B,WAAW;AACX,gCAAgC;AAChC,0BAA0B;AAC1B,IAAI;AAEJ,uBAAuB;AACvB,uBAAuB;AACvB,kDAAkD;AAClD,gEAAgE;AAChE,0CAA0C;AAE1C,0BAA0B;AAC1B,kCAAkC;AAClC,kCAAkC;AAClC,iCAAiC;AACjC,kCAAkC;AAClC,kCAAkC;AAClC,qCAAqC;AACrC,iCAAiC;AACjC,kCAAkC;AAClC,kCAAkC;AAClC,qCAAqC;AACrC,uCAAuC;AACvC,WAAW;AACX,wEAAwE;AACxE,IAAI;AACJ,WAAW;AACX,sBAAsB;AACtB,sBAAsB;AACtB,4BAA4B;AAC5B,gCAAgC;AAChC,kBAAkB;AAClB,KAAK"}
|
|
@@ -1,33 +1,32 @@
|
|
|
1
1
|
import { Font as FontDefinition } from './font';
|
|
2
|
-
import { ParsedFont } from './font-interfaces';
|
|
3
|
-
export * from './font-interfaces';
|
|
2
|
+
import { ParsedFont, FontStyleType, FontWeightType, FontVariationSettingsType } from './font-interfaces';
|
|
4
3
|
export declare abstract class Font implements FontDefinition {
|
|
5
4
|
readonly fontFamily: string;
|
|
6
5
|
readonly fontSize: number;
|
|
6
|
+
readonly fontVariationSettings?: Array<FontVariationSettingsType>;
|
|
7
7
|
static default: any;
|
|
8
8
|
readonly fontStyle: FontStyleType;
|
|
9
9
|
readonly fontWeight: FontWeightType;
|
|
10
10
|
readonly fontScale: number;
|
|
11
11
|
get isItalic(): boolean;
|
|
12
12
|
get isBold(): boolean;
|
|
13
|
-
protected constructor(fontFamily: string, fontSize: number, fontStyle?: FontStyleType, fontWeight?: FontWeightType, fontScale?: number);
|
|
13
|
+
protected constructor(fontFamily: string, fontSize: number, fontStyle?: FontStyleType, fontWeight?: FontWeightType, fontScale?: number, fontVariationSettings?: Array<FontVariationSettingsType>);
|
|
14
14
|
abstract getAndroidTypeface(): any;
|
|
15
15
|
abstract getUIFont(defaultFont: any): any;
|
|
16
16
|
abstract withFontFamily(family: string): Font;
|
|
17
|
-
abstract withFontStyle(style:
|
|
18
|
-
abstract withFontWeight(weight:
|
|
17
|
+
abstract withFontStyle(style: FontStyleType): Font;
|
|
18
|
+
abstract withFontWeight(weight: FontWeightType): Font;
|
|
19
19
|
abstract withFontSize(size: number): Font;
|
|
20
20
|
abstract withFontScale(scale: number): Font;
|
|
21
|
+
abstract withFontVariationSettings(variationSettings: Array<FontVariationSettingsType> | null): Font;
|
|
21
22
|
static equals(value1: Font, value2: Font): boolean;
|
|
22
23
|
}
|
|
23
|
-
export declare type FontStyleType = 'normal' | 'italic';
|
|
24
24
|
export declare namespace FontStyle {
|
|
25
25
|
const NORMAL = "normal";
|
|
26
26
|
const ITALIC = "italic";
|
|
27
27
|
const isValid: (value: any) => value is FontStyleType;
|
|
28
28
|
const parse: (value: any) => FontStyleType;
|
|
29
29
|
}
|
|
30
|
-
export declare type FontWeightType = '100' | '200' | '300' | 'normal' | '400' | '500' | '600' | 'bold' | '700' | '800' | '900';
|
|
31
30
|
export declare namespace FontWeight {
|
|
32
31
|
const THIN = "100";
|
|
33
32
|
const EXTRA_LIGHT = "200";
|
|
@@ -41,6 +40,10 @@ export declare namespace FontWeight {
|
|
|
41
40
|
const isValid: (value: any) => value is FontWeightType;
|
|
42
41
|
const parse: (value: any) => FontWeightType;
|
|
43
42
|
}
|
|
43
|
+
export declare namespace FontVariationSettings {
|
|
44
|
+
function parse(fontVariationSettings: string): Array<FontVariationSettingsType> | null;
|
|
45
|
+
function toString(fontVariationSettings: FontVariationSettingsType[] | null): string | null;
|
|
46
|
+
}
|
|
44
47
|
export declare function parseFontFamily(value: string): Array<string>;
|
|
45
48
|
export declare namespace genericFontFamilies {
|
|
46
49
|
const serif = "serif";
|
|
@@ -49,3 +52,9 @@ export declare namespace genericFontFamilies {
|
|
|
49
52
|
const system = "system";
|
|
50
53
|
}
|
|
51
54
|
export declare function parseFont(fontValue: string): ParsedFont;
|
|
55
|
+
/**
|
|
56
|
+
* Kind of hack.
|
|
57
|
+
* Used to search font variation axis names, since iOS for some reason requires names
|
|
58
|
+
* but tags are the standards.
|
|
59
|
+
*/
|
|
60
|
+
export declare function fuzzySearch(query: string, dataset: string[]): string[] | null;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { makeValidator, makeParser } from '../core/properties';
|
|
2
|
-
export * from './font-interfaces';
|
|
3
2
|
export class Font {
|
|
4
|
-
constructor(fontFamily, fontSize, fontStyle, fontWeight, fontScale) {
|
|
3
|
+
constructor(fontFamily, fontSize, fontStyle, fontWeight, fontScale, fontVariationSettings) {
|
|
5
4
|
this.fontFamily = fontFamily;
|
|
6
5
|
this.fontSize = fontSize;
|
|
7
|
-
this.
|
|
8
|
-
this.
|
|
9
|
-
this.
|
|
6
|
+
this.fontVariationSettings = fontVariationSettings;
|
|
7
|
+
this.fontStyle = fontStyle ?? FontStyle.NORMAL;
|
|
8
|
+
this.fontWeight = fontWeight ?? FontWeight.NORMAL;
|
|
9
|
+
this.fontScale = fontScale ?? 1;
|
|
10
10
|
}
|
|
11
11
|
get isItalic() {
|
|
12
12
|
return this.fontStyle === FontStyle.ITALIC;
|
|
@@ -48,6 +48,48 @@ export var FontWeight;
|
|
|
48
48
|
FontWeight.isValid = makeValidator(FontWeight.THIN, FontWeight.EXTRA_LIGHT, FontWeight.LIGHT, FontWeight.NORMAL, '400', FontWeight.MEDIUM, FontWeight.SEMI_BOLD, FontWeight.BOLD, '700', FontWeight.EXTRA_BOLD, FontWeight.BLACK);
|
|
49
49
|
FontWeight.parse = makeParser(FontWeight.isValid);
|
|
50
50
|
})(FontWeight || (FontWeight = {}));
|
|
51
|
+
export var FontVariationSettings;
|
|
52
|
+
(function (FontVariationSettings) {
|
|
53
|
+
function parse(fontVariationSettings) {
|
|
54
|
+
const allowedValues = ['normal', 'inherit', 'initial', 'revert', 'revert-layer', 'unset'];
|
|
55
|
+
const lower = fontVariationSettings?.toLowerCase().trim();
|
|
56
|
+
if (allowedValues.indexOf(lower) !== -1) {
|
|
57
|
+
return null;
|
|
58
|
+
}
|
|
59
|
+
const chunks = lower.split(',');
|
|
60
|
+
if (chunks.length) {
|
|
61
|
+
const parsed = [];
|
|
62
|
+
for (const chunk of chunks) {
|
|
63
|
+
const axisChunks = chunk.trim();
|
|
64
|
+
if (axisChunks.length === 2) {
|
|
65
|
+
const axisName = chunk[0].trim();
|
|
66
|
+
const axisValue = parseFloat(chunk[0]);
|
|
67
|
+
// See https://drafts.csswg.org/css-fonts/#font-variation-settings-def.
|
|
68
|
+
// Axis name strings longer or shorter than four characters are invalid.
|
|
69
|
+
if (!isNaN(axisValue) && axisName.length === 6 && ((axisName.startsWith("'") && axisName.endsWith("'")) || (axisName.startsWith('"') && axisName.endsWith('"')))) {
|
|
70
|
+
parsed.push({ axis: axisName, value: axisValue });
|
|
71
|
+
}
|
|
72
|
+
else {
|
|
73
|
+
console.error('Invalid value (font-variation-settings): ' + fontVariationSettings);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
else {
|
|
77
|
+
console.error('Invalid value (font-variation-settings): ' + fontVariationSettings);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
return parsed;
|
|
81
|
+
}
|
|
82
|
+
console.error('Invalid value (font-variation-settings): ' + fontVariationSettings);
|
|
83
|
+
}
|
|
84
|
+
FontVariationSettings.parse = parse;
|
|
85
|
+
function toString(fontVariationSettings) {
|
|
86
|
+
if (fontVariationSettings?.length) {
|
|
87
|
+
return fontVariationSettings.map(({ axis, value }) => `'${axis}' ${value}`).join(', ');
|
|
88
|
+
}
|
|
89
|
+
return null;
|
|
90
|
+
}
|
|
91
|
+
FontVariationSettings.toString = toString;
|
|
92
|
+
})(FontVariationSettings || (FontVariationSettings = {}));
|
|
51
93
|
export function parseFontFamily(value) {
|
|
52
94
|
if (!value) {
|
|
53
95
|
return [];
|
|
@@ -117,4 +159,28 @@ export function parseFont(fontValue) {
|
|
|
117
159
|
}
|
|
118
160
|
return result;
|
|
119
161
|
}
|
|
162
|
+
/**
|
|
163
|
+
* Kind of hack.
|
|
164
|
+
* Used to search font variation axis names, since iOS for some reason requires names
|
|
165
|
+
* but tags are the standards.
|
|
166
|
+
*/
|
|
167
|
+
export function fuzzySearch(query, dataset) {
|
|
168
|
+
const q = query ? query.trim().toLowerCase() : '';
|
|
169
|
+
const result = [];
|
|
170
|
+
if (!q.length) {
|
|
171
|
+
return null;
|
|
172
|
+
}
|
|
173
|
+
dataset.forEach((item) => {
|
|
174
|
+
const s = item.trim().toLowerCase();
|
|
175
|
+
let n = -1;
|
|
176
|
+
for (const char of q) {
|
|
177
|
+
n = s.indexOf(char, n + 1);
|
|
178
|
+
if (!~n) {
|
|
179
|
+
return;
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
result.push(item);
|
|
183
|
+
});
|
|
184
|
+
return result.length ? result : null;
|
|
185
|
+
}
|
|
120
186
|
//# sourceMappingURL=font-common.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"font-common.js","sourceRoot":"","sources":["../../../../../packages/core/ui/styling/font-common.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAE/D,
|
|
1
|
+
{"version":3,"file":"font-common.js","sourceRoot":"","sources":["../../../../../packages/core/ui/styling/font-common.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAE/D,MAAM,OAAgB,IAAI;IAczB,YAAsC,UAAkB,EAAkB,QAAgB,EAAE,SAAyB,EAAE,UAA2B,EAAE,SAAkB,EAAkB,qBAAwD;QAA1M,eAAU,GAAV,UAAU,CAAQ;QAAkB,aAAQ,GAAR,QAAQ,CAAQ;QAA8F,0BAAqB,GAArB,qBAAqB,CAAmC;QAC/O,IAAI,CAAC,SAAS,GAAG,SAAS,IAAI,SAAS,CAAC,MAAM,CAAC;QAC/C,IAAI,CAAC,UAAU,GAAG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AAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;SAC5D;aAAM;YACN,MAAM,CAAC,UAAU,GAAG,IAAI,CAAC;YACzB,IAAI,KAAK,CAAC,MAAM,EAAE;gBACjB,MAAM,CAAC,UAAU,IAAI,GAAG,GAAG,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;aAC3C;YACD,MAAM;SACN;KACD;IAED,OAAO,MAAM,CAAC;AACf,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,WAAW,CAAC,KAAa,EAAE,OAAiB;IAC3D,MAAM,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;IAElD,MAAM,MAAM,GAAa,EAAE,CAAC;IAC5B,IAAI,CAAC,CAAC,CAAC,MAAM,EAAE;QACd,OAAO,IAAI,CAAC;KACZ;IAED,OAAO,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;QACxB,MAAM,CAAC,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;QACpC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;QACX,KAAK,MAAM,IAAI,IAAI,CAAC,EAAE;YACrB,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;YAC3B,IAAI,CAAC,CAAC,CAAC,EAAE;gBACR,OAAO;aACP;SACD;QACD,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACnB,CAAC,CAAC,CAAC;IAEH,OAAO,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC;AACtC,CAAC"}
|
|
@@ -1,10 +1,15 @@
|
|
|
1
|
-
export declare type
|
|
2
|
-
export declare type
|
|
1
|
+
export declare type FontStyleType = 'normal' | 'italic';
|
|
2
|
+
export declare type FontWeightType = '100' | '200' | '300' | 'normal' | '400' | '500' | '600' | 'bold' | '700' | '800' | '900' | number;
|
|
3
3
|
export interface ParsedFont {
|
|
4
|
-
fontStyle?:
|
|
4
|
+
fontStyle?: FontStyleType;
|
|
5
5
|
fontVariant?: string;
|
|
6
|
-
fontWeight?:
|
|
6
|
+
fontWeight?: FontWeightType;
|
|
7
7
|
lineHeight?: string;
|
|
8
8
|
fontSize?: string;
|
|
9
9
|
fontFamily?: string;
|
|
10
|
+
fontVariationSettings?: Array<FontVariationSettingsType>;
|
|
10
11
|
}
|
|
12
|
+
export declare type FontVariationSettingsType = {
|
|
13
|
+
axis: string;
|
|
14
|
+
value: number;
|
|
15
|
+
};
|
|
@@ -1,14 +1,16 @@
|
|
|
1
|
-
import { Font as FontBase
|
|
1
|
+
import { Font as FontBase } from './font-common';
|
|
2
|
+
import { FontStyleType, FontWeightType, FontVariationSettingsType } from './font-interfaces';
|
|
2
3
|
export * from './font-common';
|
|
3
4
|
export declare class Font extends FontBase {
|
|
4
5
|
static default: Font;
|
|
5
6
|
private _typeface;
|
|
6
|
-
constructor(family: string, size: number, style?: FontStyleType, weight?: FontWeightType);
|
|
7
|
+
constructor(family: string, size: number, style?: FontStyleType, weight?: FontWeightType, fontVariationSettings?: Array<FontVariationSettingsType>);
|
|
7
8
|
withFontFamily(family: string): Font;
|
|
8
9
|
withFontStyle(style: FontStyleType): Font;
|
|
9
10
|
withFontWeight(weight: FontWeightType): Font;
|
|
10
11
|
withFontSize(size: number): Font;
|
|
11
12
|
withFontScale(scale: number): Font;
|
|
13
|
+
withFontVariationSettings(variationSettings: Array<FontVariationSettingsType> | null): Font;
|
|
12
14
|
getAndroidTypeface(): android.graphics.Typeface;
|
|
13
15
|
getUIFont(defaultFont: UIFont): UIFont;
|
|
14
16
|
}
|
|
@@ -1,29 +1,33 @@
|
|
|
1
|
-
import { Font as FontBase, parseFontFamily, genericFontFamilies, FontWeight } from './font-common';
|
|
1
|
+
import { Font as FontBase, parseFontFamily, genericFontFamilies, FontWeight, FontVariationSettings } from './font-common';
|
|
2
2
|
import { Trace } from '../../trace';
|
|
3
|
-
import
|
|
3
|
+
import { SDK_VERSION } from '../../utils/constants';
|
|
4
4
|
import * as fs from '../../file-system';
|
|
5
|
+
import { ad } from '../../utils';
|
|
5
6
|
export * from './font-common';
|
|
6
7
|
const FONTS_BASE_PATH = '/fonts/';
|
|
7
8
|
const typefaceCache = new Map();
|
|
8
9
|
let appAssets;
|
|
9
10
|
export class Font extends FontBase {
|
|
10
|
-
constructor(family, size, style, weight) {
|
|
11
|
-
super(family, size, style, weight, 1);
|
|
11
|
+
constructor(family, size, style, weight, fontVariationSettings) {
|
|
12
|
+
super(family, size, style, weight, 1, fontVariationSettings);
|
|
12
13
|
}
|
|
13
14
|
withFontFamily(family) {
|
|
14
|
-
return new Font(family, this.fontSize, this.fontStyle, this.fontWeight);
|
|
15
|
+
return new Font(family, this.fontSize, this.fontStyle, this.fontWeight, this.fontVariationSettings);
|
|
15
16
|
}
|
|
16
17
|
withFontStyle(style) {
|
|
17
|
-
return new Font(this.fontFamily, this.fontSize, style, this.fontWeight);
|
|
18
|
+
return new Font(this.fontFamily, this.fontSize, style, this.fontWeight, this.fontVariationSettings);
|
|
18
19
|
}
|
|
19
20
|
withFontWeight(weight) {
|
|
20
|
-
return new Font(this.fontFamily, this.fontSize, this.fontStyle, weight);
|
|
21
|
+
return new Font(this.fontFamily, this.fontSize, this.fontStyle, weight, this.fontVariationSettings);
|
|
21
22
|
}
|
|
22
23
|
withFontSize(size) {
|
|
23
|
-
return new Font(this.fontFamily, size, this.fontStyle, this.fontWeight);
|
|
24
|
+
return new Font(this.fontFamily, size, this.fontStyle, this.fontWeight, this.fontVariationSettings);
|
|
24
25
|
}
|
|
25
26
|
withFontScale(scale) {
|
|
26
|
-
return new Font(this.fontFamily, this.fontSize, this.fontStyle, this.fontWeight);
|
|
27
|
+
return new Font(this.fontFamily, this.fontSize, this.fontStyle, this.fontWeight, this.fontVariationSettings);
|
|
28
|
+
}
|
|
29
|
+
withFontVariationSettings(variationSettings) {
|
|
30
|
+
return new Font(this.fontFamily, this.fontSize, this.fontStyle, this.fontWeight, variationSettings);
|
|
27
31
|
}
|
|
28
32
|
getAndroidTypeface() {
|
|
29
33
|
if (!this._typeface) {
|
|
@@ -36,12 +40,18 @@ export class Font extends FontBase {
|
|
|
36
40
|
}
|
|
37
41
|
}
|
|
38
42
|
Font.default = new Font(undefined, undefined);
|
|
39
|
-
function
|
|
40
|
-
|
|
43
|
+
function computeFontCacheKey(fontFamily, font) {
|
|
44
|
+
const sep = ':';
|
|
45
|
+
return [fontFamily, String(FontVariationSettings.toString(font.fontVariationSettings)).replace(/'/g, '').replace(/[\s,]/g, '_')].join(sep);
|
|
46
|
+
}
|
|
47
|
+
function loadFontFromFile(fontFamily, font) {
|
|
48
|
+
const apiLevel = android.os.Build.VERSION.SDK_INT;
|
|
49
|
+
const cacheKey = apiLevel >= 26 ? computeFontCacheKey(fontFamily, font) : fontFamily;
|
|
50
|
+
appAssets = appAssets || ad.getApplicationContext().getAssets();
|
|
41
51
|
if (!appAssets) {
|
|
42
52
|
return null;
|
|
43
53
|
}
|
|
44
|
-
let result = typefaceCache.get(
|
|
54
|
+
let result = typefaceCache.get(cacheKey);
|
|
45
55
|
// Check for undefined explicitly as null mean we tried to load the font, but failed.
|
|
46
56
|
if (result === undefined) {
|
|
47
57
|
result = null;
|
|
@@ -53,15 +63,30 @@ function loadFontFromFile(fontFamily) {
|
|
|
53
63
|
else if (fs.File.exists(basePath + '.otf')) {
|
|
54
64
|
fontAssetPath = FONTS_BASE_PATH + fontFamily + '.otf';
|
|
55
65
|
}
|
|
56
|
-
else {
|
|
57
|
-
|
|
58
|
-
Trace.write('Could not find font file for ' + fontFamily, Trace.categories.Error, Trace.messageType.error);
|
|
59
|
-
}
|
|
66
|
+
else if (Trace.isEnabled()) {
|
|
67
|
+
Trace.write('Could not find font file for ' + fontFamily, Trace.categories.Error, Trace.messageType.error);
|
|
60
68
|
}
|
|
61
69
|
if (fontAssetPath) {
|
|
62
70
|
try {
|
|
63
71
|
fontAssetPath = fs.path.join(fs.knownFolders.currentApp().path, fontAssetPath);
|
|
64
|
-
|
|
72
|
+
if (apiLevel >= 26) {
|
|
73
|
+
const builder = new android.graphics.Typeface.Builder(fontAssetPath);
|
|
74
|
+
if (builder) {
|
|
75
|
+
if (font.fontVariationSettings !== undefined) {
|
|
76
|
+
builder.setFontVariationSettings(font.fontVariationSettings?.length ? FontVariationSettings.toString(font.fontVariationSettings) : '');
|
|
77
|
+
}
|
|
78
|
+
result = builder.build();
|
|
79
|
+
}
|
|
80
|
+
else {
|
|
81
|
+
result = android.graphics.Typeface.createFromFile(fontAssetPath);
|
|
82
|
+
if (Trace.isEnabled()) {
|
|
83
|
+
Trace.write('Could not create builder for ' + fontFamily, Trace.categories.Error, Trace.messageType.error);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
else {
|
|
88
|
+
result = android.graphics.Typeface.createFromFile(fontAssetPath);
|
|
89
|
+
}
|
|
65
90
|
}
|
|
66
91
|
catch (e) {
|
|
67
92
|
if (Trace.isEnabled()) {
|
|
@@ -69,7 +94,7 @@ function loadFontFromFile(fontFamily) {
|
|
|
69
94
|
}
|
|
70
95
|
}
|
|
71
96
|
}
|
|
72
|
-
typefaceCache.set(
|
|
97
|
+
typefaceCache.set(cacheKey, result);
|
|
73
98
|
}
|
|
74
99
|
return result;
|
|
75
100
|
}
|
|
@@ -82,10 +107,10 @@ function createTypeface(font) {
|
|
|
82
107
|
fontStyle |= android.graphics.Typeface.ITALIC;
|
|
83
108
|
}
|
|
84
109
|
//http://stackoverflow.com/questions/19691530/valid-values-for-androidfontfamily-and-what-they-map-to
|
|
85
|
-
const
|
|
110
|
+
const fontFamilies = parseFontFamily(font.fontFamily);
|
|
86
111
|
let result = null;
|
|
87
|
-
for (
|
|
88
|
-
switch (
|
|
112
|
+
for (const fontFamily of fontFamilies) {
|
|
113
|
+
switch (fontFamily.toLowerCase()) {
|
|
89
114
|
case genericFontFamilies.serif:
|
|
90
115
|
result = android.graphics.Typeface.create('serif' + getFontWeightSuffix(font.fontWeight), fontStyle);
|
|
91
116
|
break;
|
|
@@ -96,12 +121,13 @@ function createTypeface(font) {
|
|
|
96
121
|
case genericFontFamilies.monospace:
|
|
97
122
|
result = android.graphics.Typeface.create('monospace' + getFontWeightSuffix(font.fontWeight), fontStyle);
|
|
98
123
|
break;
|
|
99
|
-
default:
|
|
100
|
-
result = loadFontFromFile(
|
|
124
|
+
default: {
|
|
125
|
+
result = loadFontFromFile(fontFamily, font);
|
|
101
126
|
if (result && fontStyle) {
|
|
102
127
|
result = android.graphics.Typeface.create(result, fontStyle);
|
|
103
128
|
}
|
|
104
129
|
break;
|
|
130
|
+
}
|
|
105
131
|
}
|
|
106
132
|
if (result) {
|
|
107
133
|
// Found the font!
|
|
@@ -114,12 +140,15 @@ function createTypeface(font) {
|
|
|
114
140
|
return result;
|
|
115
141
|
}
|
|
116
142
|
function getFontWeightSuffix(fontWeight) {
|
|
143
|
+
if (typeof fontWeight === 'number') {
|
|
144
|
+
fontWeight = (fontWeight + '');
|
|
145
|
+
}
|
|
117
146
|
switch (fontWeight) {
|
|
118
147
|
case FontWeight.THIN:
|
|
119
|
-
return
|
|
148
|
+
return SDK_VERSION >= 16 ? '-thin' : '';
|
|
120
149
|
case FontWeight.EXTRA_LIGHT:
|
|
121
150
|
case FontWeight.LIGHT:
|
|
122
|
-
return
|
|
151
|
+
return SDK_VERSION >= 16 ? '-light' : '';
|
|
123
152
|
case FontWeight.NORMAL:
|
|
124
153
|
case '400':
|
|
125
154
|
case undefined:
|
|
@@ -127,13 +156,13 @@ function getFontWeightSuffix(fontWeight) {
|
|
|
127
156
|
return '';
|
|
128
157
|
case FontWeight.MEDIUM:
|
|
129
158
|
case FontWeight.SEMI_BOLD:
|
|
130
|
-
return
|
|
159
|
+
return SDK_VERSION >= 21 ? '-medium' : '';
|
|
131
160
|
case FontWeight.BOLD:
|
|
132
161
|
case '700':
|
|
133
162
|
case FontWeight.EXTRA_BOLD:
|
|
134
163
|
return '';
|
|
135
164
|
case FontWeight.BLACK:
|
|
136
|
-
return
|
|
165
|
+
return SDK_VERSION >= 21 ? '-black' : '';
|
|
137
166
|
default:
|
|
138
167
|
throw new Error(`Invalid font weight: "${fontWeight}"`);
|
|
139
168
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"font.android.js","sourceRoot":"","sources":["../../../../../packages/core/ui/styling/font.android.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,IAAI,QAAQ,EAAE,eAAe,EAAE,mBAAmB,
|
|
1
|
+
{"version":3,"file":"font.android.js","sourceRoot":"","sources":["../../../../../packages/core/ui/styling/font.android.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,IAAI,QAAQ,EAAE,eAAe,EAAE,mBAAmB,EAAE,UAAU,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AAE1H,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACxC,OAAO,EAAE,EAAE,EAAE,MAAM,aAAa,CAAC;AAEjC,cAAc,eAAe,CAAC;AAE9B,MAAM,eAAe,GAAG,SAAS,CAAC;AAClC,MAAM,aAAa,GAAG,IAAI,GAAG,EAAqC,CAAC;AACnE,IAAI,SAA2C,CAAC;AAEhD,MAAM,OAAO,IAAK,SAAQ,QAAQ;IAKjC,YAAY,MAAc,EAAE,IAAY,EAAE,KAAqB,EAAE,MAAuB,EAAE,qBAAwD;QACjJ,KAAK,CAAC,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,EAAE,qBAAqB,CAAC,CAAC;IAC9D,CAAC;IAEM,cAAc,CAAC,MAAc;QACnC,OAAO,IAAI,IAAI,CAAC,MAAM,EAAE,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KAAK,UAAU,CAAC,KAAK;YACpB,OAAO,WAAW,IAAI,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC;QAC1C,KAAK,UAAU,CAAC,MAAM,CAAC;QACvB,KAAK,KAAK,CAAC;QACX,KAAK,SAAS,CAAC;QACf,KAAK,IAAI;YACR,OAAO,EAAE,CAAC;QACX,KAAK,UAAU,CAAC,MAAM,CAAC;QACvB,KAAK,UAAU,CAAC,SAAS;YACxB,OAAO,WAAW,IAAI,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC;QAC3C,KAAK,UAAU,CAAC,IAAI,CAAC;QACrB,KAAK,KAAK,CAAC;QACX,KAAK,UAAU,CAAC,UAAU;YACzB,OAAO,EAAE,CAAC;QACX,KAAK,UAAU,CAAC,KAAK;YACpB,OAAO,WAAW,IAAI,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC;QAC1C;YACC,MAAM,IAAI,KAAK,CAAC,yBAAyB,UAAU,GAAG,CAAC,CAAC;KACzD;AACF,CAAC"}
|
package/ui/styling/font.d.ts
CHANGED
|
@@ -1,38 +1,41 @@
|
|
|
1
|
-
|
|
1
|
+
import { Font as FontBase } from './font-common';
|
|
2
|
+
export type { FontStyleType, FontWeightType, ParsedFont, FontVariationSettingsType } from './font-interfaces';
|
|
3
|
+
|
|
4
|
+
export declare class Font extends FontBase {
|
|
2
5
|
public static default: Font;
|
|
3
6
|
|
|
4
7
|
public fontFamily: string;
|
|
5
|
-
public fontStyle:
|
|
6
|
-
public fontWeight:
|
|
8
|
+
public fontStyle: FontStyleType;
|
|
9
|
+
public fontWeight: FontWeightType;
|
|
7
10
|
public fontSize: number;
|
|
8
11
|
public fontScale: number;
|
|
12
|
+
public fontVariationSettings?: FontVariationSettings[];
|
|
9
13
|
|
|
10
14
|
public isBold: boolean;
|
|
11
15
|
public isItalic: boolean;
|
|
12
16
|
|
|
13
|
-
constructor(family: string, size: number, style?:
|
|
17
|
+
constructor(family: string, size: number, style?: FontStyleType, weight?: FontWeightType, scale?: number, fontVariationSettings?: FontVariationSettings[]);
|
|
14
18
|
|
|
15
19
|
public getAndroidTypeface(): any /* android.graphics.Typeface */;
|
|
16
20
|
public getUIFont(defaultFont: any /* UIFont */): any /* UIFont */;
|
|
17
21
|
|
|
18
22
|
public withFontFamily(family: string): Font;
|
|
19
|
-
public withFontStyle(style:
|
|
20
|
-
public withFontWeight(weight:
|
|
23
|
+
public withFontStyle(style: FontStyleType): Font;
|
|
24
|
+
public withFontWeight(weight: FontWeightType): Font;
|
|
21
25
|
public withFontSize(size: number): Font;
|
|
22
26
|
public withFontScale(scale: number): Font;
|
|
27
|
+
public withFontVariationSettings(variationSettings: FontVariationSettings[] | null): Font;
|
|
23
28
|
|
|
24
29
|
public static equals(value1: Font, value2: Font): boolean;
|
|
25
30
|
}
|
|
26
31
|
|
|
27
|
-
export type FontStyle = 'normal' | 'italic';
|
|
28
32
|
export namespace FontStyle {
|
|
29
33
|
export const NORMAL: 'normal';
|
|
30
34
|
export const ITALIC: 'italic';
|
|
31
35
|
export function isValid(value: any): boolean;
|
|
32
|
-
export function parse(value: string):
|
|
36
|
+
export function parse(value: string): FontStyleType;
|
|
33
37
|
}
|
|
34
38
|
|
|
35
|
-
export type FontWeight = '100' | '200' | '300' | 'normal' | '400' | '500' | '600' | 'bold' | '700' | '800' | '900';
|
|
36
39
|
export namespace FontWeight {
|
|
37
40
|
export const THIN: '100';
|
|
38
41
|
export const EXTRA_LIGHT: '200';
|
|
@@ -44,16 +47,12 @@ export namespace FontWeight {
|
|
|
44
47
|
export const EXTRA_BOLD: '800';
|
|
45
48
|
export const BLACK: '900';
|
|
46
49
|
export function isValid(value: any): boolean;
|
|
47
|
-
export function parse(value: string):
|
|
50
|
+
export function parse(value: string): FontWeightType;
|
|
48
51
|
}
|
|
49
52
|
|
|
50
|
-
export
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
fontWeight?: FontWeight;
|
|
54
|
-
lineHeight?: string;
|
|
55
|
-
fontSize?: string;
|
|
56
|
-
fontFamily?: string;
|
|
53
|
+
export namespace FontVariationSettings {
|
|
54
|
+
export function parse(fontVariationSettings: string): Array<FontVariationSettingsType> | null;
|
|
55
|
+
export function toString(fontVariationSettings: Array<FontVariationSettingsType> | null): string | null;
|
|
57
56
|
}
|
|
58
57
|
|
|
59
58
|
export function parseFont(fontValue: string): ParsedFont;
|
package/ui/styling/font.ios.d.ts
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
1
|
-
import { Font as FontBase
|
|
2
|
-
|
|
1
|
+
import { Font as FontBase } from './font-common';
|
|
2
|
+
import { FontStyleType, FontWeightType, FontVariationSettingsType } from './font-interfaces';
|
|
3
|
+
export { FontStyle, FontWeight, FontVariationSettings, parseFont } from './font-common';
|
|
3
4
|
export declare class Font extends FontBase {
|
|
4
5
|
static default: Font;
|
|
5
|
-
constructor(family: string, size: number, style?: FontStyleType, weight?: FontWeightType, scale?: number);
|
|
6
|
+
constructor(family: string, size: number, style?: FontStyleType, weight?: FontWeightType, scale?: number, variationSettings?: Array<FontVariationSettingsType>);
|
|
6
7
|
withFontFamily(family: string): Font;
|
|
7
8
|
withFontStyle(style: FontStyleType): Font;
|
|
8
9
|
withFontWeight(weight: FontWeightType): Font;
|
|
9
10
|
withFontSize(size: number): Font;
|
|
10
11
|
withFontScale(scale: number): Font;
|
|
12
|
+
withFontVariationSettings(variationSettings: Array<FontVariationSettingsType> | null): Font;
|
|
11
13
|
getUIFont(defaultFont: UIFont): UIFont;
|
|
12
14
|
getAndroidTypeface(): android.graphics.Typeface;
|
|
13
15
|
}
|