@nativescript-community/ui-material-core 7.2.18 → 7.2.20

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.
@@ -0,0 +1,351 @@
1
+ import { Background, Button, Color, Length, PercentLength, Utils, View, androidDynamicElevationOffsetProperty, androidElevationProperty, backgroundInternalProperty } from '@nativescript/core';
2
+ import { ad } from '@nativescript/core/utils';
3
+ import { createRippleDrawable, createStateListAnimator, getAttrColor, getColorStateList, handleClearFocus, isPostLollipop, isPostMarshmallow } from './android/utils';
4
+ import { cssProperty, dynamicElevationOffsetProperty, elevationProperty, rippleColorAlphaProperty, rippleColorProperty } from './cssproperties';
5
+ import { CornerFamily, applyMixins } from './index.common';
6
+ export * from './cssproperties';
7
+ export { applyMixins };
8
+ function cornerTreat(cornerFamily) {
9
+ switch (cornerFamily) {
10
+ case CornerFamily.CUT:
11
+ return new com.google.android.material.shape.CutCornerTreatment();
12
+ default:
13
+ case CornerFamily.ROUNDED:
14
+ return new com.google.android.material.shape.RoundedCornerTreatment();
15
+ }
16
+ }
17
+ let context;
18
+ function getContext() {
19
+ if (!context) {
20
+ context = Utils.ad.getApplicationContext();
21
+ }
22
+ return context;
23
+ }
24
+ // stub class as we don't use this on android
25
+ export class Themer {
26
+ constructor() {
27
+ this._shapes = {};
28
+ }
29
+ // appColorScheme: MDCSemanticColorScheme;
30
+ getOrcreateAppColorScheme() {
31
+ // if (!this.appColorScheme) {
32
+ // this.appColorScheme = MDCSemanticColorScheme.alloc().init();
33
+ // }
34
+ // return this.appColorScheme;
35
+ }
36
+ getAppColorScheme() {
37
+ // return this.appColorScheme;
38
+ }
39
+ setPrimaryColor(value) {
40
+ this.primaryColor = value;
41
+ }
42
+ getPrimaryColor() {
43
+ if (!this.primaryColor) {
44
+ this.primaryColor = new Color(getAttrColor(getContext(), 'colorPrimary'));
45
+ }
46
+ return this.primaryColor;
47
+ }
48
+ setOnPrimaryColor(value) {
49
+ this.onPrimaryColor = value;
50
+ }
51
+ getOnPrimaryColor() {
52
+ if (!this.onPrimaryColor) {
53
+ this.onPrimaryColor = new Color(getAttrColor(getContext(), 'colorOnPrimary'));
54
+ }
55
+ return this.onPrimaryColor;
56
+ }
57
+ setAccentColor(value) {
58
+ this.accentColor = value;
59
+ }
60
+ getAccentColor() {
61
+ if (!this.accentColor) {
62
+ this.accentColor = new Color(getAttrColor(getContext(), 'colorAccent'));
63
+ }
64
+ return this.accentColor;
65
+ }
66
+ setSurfaceColor(value) {
67
+ this.surfaceColor = value;
68
+ }
69
+ getSurfaceColor() {
70
+ return this.surfaceColor;
71
+ }
72
+ setOnSurfaceColor(value) {
73
+ this.onSurfaceColor = value;
74
+ }
75
+ getOnSurfaceColor() {
76
+ return this.onSurfaceColor;
77
+ }
78
+ setPrimaryColorVariant(value) {
79
+ this.primaryColorVariant = value;
80
+ }
81
+ getPrimaryColorVariant() {
82
+ if (!this.primaryColorVariant) {
83
+ this.primaryColorVariant = new Color(getAttrColor(getContext(), 'colorSecondary'));
84
+ }
85
+ return this.primaryColorVariant;
86
+ }
87
+ setSecondaryColor(value) {
88
+ this.secondaryColor = value;
89
+ }
90
+ getSecondaryColor() {
91
+ return this.secondaryColor;
92
+ }
93
+ getControlHighlightColor() {
94
+ if (!this.controlHighlightColor) {
95
+ this.controlHighlightColor = new Color(getAttrColor(getContext(), 'colorControlHighlight'));
96
+ }
97
+ return this.controlHighlightColor;
98
+ }
99
+ getShape(key) {
100
+ return this._shapes[key] || null;
101
+ }
102
+ createShape(key, options) {
103
+ const RelativeCornerSize = com.google.android.material.shape.RelativeCornerSize;
104
+ const builder = com.google.android.material.shape.ShapeAppearanceModel.builder();
105
+ if (options.cornerFamily) {
106
+ builder.setAllCorners(cornerTreat(options.cornerFamily));
107
+ }
108
+ if (options.cornerFamilyBottomRight) {
109
+ builder.setBottomRightCorner(cornerTreat(options.cornerFamilyBottomRight));
110
+ }
111
+ if (options.cornerFamilyBottomLeft) {
112
+ builder.setBottomLeftCorner(cornerTreat(options.cornerFamilyBottomLeft));
113
+ }
114
+ if (options.cornerFamilyTopLeft) {
115
+ builder.setTopLeftCorner(cornerTreat(options.cornerFamilyTopLeft));
116
+ }
117
+ if (options.cornerFamilyTopRight) {
118
+ builder.setTopRightCorner(cornerTreat(options.cornerFamilyTopRight));
119
+ }
120
+ if (options.cornerSize !== undefined) {
121
+ if (typeof options.cornerSize === 'object') {
122
+ if (options.cornerSize.unit === '%') {
123
+ builder.setAllCornerSizes(new RelativeCornerSize(options.cornerSize.value));
124
+ }
125
+ else {
126
+ builder.setAllCornerSizes(PercentLength.toDevicePixels(options.cornerSize));
127
+ }
128
+ }
129
+ else {
130
+ builder.setAllCornerSizes(PercentLength.toDevicePixels(options.cornerSize));
131
+ }
132
+ }
133
+ if (options.cornerSizeBottomLeft !== undefined) {
134
+ if (typeof options.cornerSizeBottomLeft === 'object') {
135
+ if (options.cornerSizeBottomLeft.unit === '%') {
136
+ builder.setBottomLeftCornerSize(new RelativeCornerSize(options.cornerSizeBottomLeft.value));
137
+ }
138
+ else {
139
+ builder.setBottomLeftCornerSize(PercentLength.toDevicePixels(options.cornerSizeBottomLeft));
140
+ }
141
+ }
142
+ else {
143
+ builder.setBottomLeftCornerSize(PercentLength.toDevicePixels(options.cornerSizeBottomLeft));
144
+ }
145
+ }
146
+ if (options.cornerSizeBottomRight !== undefined) {
147
+ if (typeof options.cornerSizeBottomRight === 'object') {
148
+ if (options.cornerSizeBottomRight.unit === '%') {
149
+ builder.setBottomRightCornerSize(new RelativeCornerSize(options.cornerSizeBottomRight.value));
150
+ }
151
+ else {
152
+ builder.setBottomRightCornerSize(PercentLength.toDevicePixels(options.cornerSizeBottomRight));
153
+ }
154
+ }
155
+ else {
156
+ builder.setBottomRightCornerSize(PercentLength.toDevicePixels(options.cornerSizeBottomRight));
157
+ }
158
+ }
159
+ if (options.cornerSizeTopRight !== undefined) {
160
+ if (typeof options.cornerSizeTopRight === 'object') {
161
+ if (options.cornerSizeTopRight.unit === '%') {
162
+ builder.setTopRightCornerSize(new RelativeCornerSize(options.cornerSizeTopRight.value));
163
+ }
164
+ else {
165
+ builder.setTopRightCornerSize(PercentLength.toDevicePixels(options.cornerSizeTopRight));
166
+ }
167
+ }
168
+ else {
169
+ builder.setTopRightCornerSize(PercentLength.toDevicePixels(options.cornerSizeTopRight));
170
+ }
171
+ }
172
+ if (options.cornerSizeTopLeft !== undefined) {
173
+ if (typeof options.cornerSizeTopLeft === 'object') {
174
+ if (options.cornerSizeTopLeft.unit === '%') {
175
+ builder.setTopLeftCornerSize(new RelativeCornerSize(options.cornerSizeTopLeft.value));
176
+ }
177
+ else {
178
+ builder.setTopLeftCornerSize(PercentLength.toDevicePixels(options.cornerSizeTopLeft));
179
+ }
180
+ }
181
+ else {
182
+ builder.setTopLeftCornerSize(PercentLength.toDevicePixels(options.cornerSizeTopLeft));
183
+ }
184
+ }
185
+ this._shapes[key] = builder.build();
186
+ }
187
+ }
188
+ export const themer = new Themer();
189
+ export function install() { }
190
+ export function getRippleColor(color, alpha = 0) {
191
+ if (color) {
192
+ const temp = color instanceof Color ? color : new Color(color);
193
+ if (temp.a !== 255 && alpha === 0) {
194
+ return temp.android;
195
+ }
196
+ // TODO: we cant use setAlpha until it is fixed in Nativescript or android will be undefined
197
+ return new Color(alpha || 61.5, temp.r, temp.g, temp.b).android;
198
+ // return temp.setAlpha(alpha || 61.5).android;
199
+ }
200
+ return null;
201
+ }
202
+ let mixinInstalled = false;
203
+ export function overrideViewBase() {
204
+ const NSView = require('@nativescript/core').View;
205
+ class ViewWithElevationAndRipple extends View {
206
+ constructor() {
207
+ super(...arguments);
208
+ this.elevation = 0;
209
+ this.dynamicElevationOffset = 0;
210
+ }
211
+ getRippleColor() {
212
+ if (this.rippleColor) {
213
+ return getRippleColor(this.rippleColor);
214
+ }
215
+ return getRippleColor(themer.getAccentColor());
216
+ }
217
+ setRippleDrawable(view, topLeftRadius = 0, topRightRadius = 0, bottomRightRadius = 0, bottomLeftRadius = 0) {
218
+ if (!this.rippleDrawable) {
219
+ this.rippleDrawable = createRippleDrawable(this.getRippleColor(), topLeftRadius, topRightRadius, bottomRightRadius, bottomLeftRadius);
220
+ if (isPostMarshmallow) {
221
+ view.setForeground(this.rippleDrawable);
222
+ }
223
+ }
224
+ }
225
+ [rippleColorProperty.setNative](color) {
226
+ const rippleColor = getRippleColor(color, this.rippleColorAlpha);
227
+ const nativeViewProtected = this.nativeViewProtected;
228
+ const RippleDrawable = android.graphics.drawable.RippleDrawable;
229
+ if (this instanceof Button && isPostMarshmallow) {
230
+ const foreground = nativeViewProtected.getForeground();
231
+ if (foreground instanceof RippleDrawable) {
232
+ foreground.setColor(getColorStateList(rippleColor));
233
+ return;
234
+ }
235
+ const background = nativeViewProtected.getBackground();
236
+ if (background instanceof RippleDrawable) {
237
+ background.setColor(getColorStateList(rippleColor));
238
+ return;
239
+ }
240
+ }
241
+ nativeViewProtected.setClickable(this.isUserInteractionEnabled);
242
+ const rippleDrawable = this.rippleDrawable;
243
+ if (!rippleDrawable) {
244
+ this.setRippleDrawable(nativeViewProtected, Length.toDevicePixels(this.style.borderTopLeftRadius), Length.toDevicePixels(this.style.borderTopRightRadius), Length.toDevicePixels(this.style.borderBottomRightRadius), Length.toDevicePixels(this.style.borderBottomLeftRadius));
245
+ }
246
+ else {
247
+ if (isPostLollipop) {
248
+ rippleDrawable.setColor(getColorStateList(rippleColor));
249
+ }
250
+ else if (rippleDrawable.rippleShape) {
251
+ rippleDrawable.rippleShape.getPaint().setColor(rippleColor);
252
+ }
253
+ }
254
+ }
255
+ [rippleColorAlphaProperty.setNative](value) {
256
+ const rippleColor = this.rippleColor;
257
+ if (rippleColor) {
258
+ this[rippleColorProperty.setNative](rippleColor);
259
+ }
260
+ }
261
+ [backgroundInternalProperty.setNative](value) {
262
+ if (this.nativeViewProtected) {
263
+ if (value instanceof android.graphics.drawable.Drawable) {
264
+ }
265
+ else {
266
+ // we recreate the ripple drawable if necessary.
267
+ // native button have on the background. Setting color will remove the ripple!
268
+ if (this.rippleDrawable || (value.color && this instanceof Button && this.rippleColor)) {
269
+ this.rippleDrawable = null;
270
+ this.setRippleDrawable(this.nativeViewProtected, Length.toDevicePixels(this.style.borderTopLeftRadius), Length.toDevicePixels(this.style.borderTopRightRadius), Length.toDevicePixels(this.style.borderBottomRightRadius), Length.toDevicePixels(this.style.borderBottomLeftRadius));
271
+ }
272
+ }
273
+ }
274
+ }
275
+ requestFocus() {
276
+ this.focus();
277
+ }
278
+ clearFocus() {
279
+ ad.dismissSoftInput(this.nativeViewProtected);
280
+ handleClearFocus(this.nativeViewProtected);
281
+ }
282
+ getDefaultElevation() {
283
+ const result = this instanceof Button ? 2 : 0;
284
+ return result;
285
+ }
286
+ getDefaultDynamicElevationOffset() {
287
+ const result = this instanceof Button ? 6 : 0;
288
+ return result;
289
+ }
290
+ [elevationProperty.setNative](value) {
291
+ if (isPostLollipop) {
292
+ this.createStateListAnimator();
293
+ }
294
+ else {
295
+ const newValue = Length.toDevicePixels(typeof value === 'string' ? Length.parse(value) : value, 0);
296
+ androidx.core.view.ViewCompat.setElevation(this.nativeViewProtected, newValue);
297
+ }
298
+ }
299
+ createStateListAnimator() {
300
+ if (!this.createStateListAnimatorTimeout) {
301
+ this.createStateListAnimatorTimeout = setTimeout(() => {
302
+ this.createStateListAnimatorTimeout = null;
303
+ if (this.nativeViewProtected) {
304
+ createStateListAnimator(this, this.nativeViewProtected);
305
+ }
306
+ });
307
+ }
308
+ }
309
+ [dynamicElevationOffsetProperty.setNative](value) {
310
+ this.nativeViewProtected.setClickable(this.isUserInteractionEnabled);
311
+ if (isPostLollipop) {
312
+ this.createStateListAnimator();
313
+ }
314
+ else {
315
+ const newValue = Length.toDevicePixels(typeof value === 'string' ? Length.parse(value) : value, 0);
316
+ androidx.core.view.ViewCompat.setTranslationZ(this.nativeViewProtected, newValue);
317
+ }
318
+ }
319
+ }
320
+ __decorate([
321
+ cssProperty
322
+ ], ViewWithElevationAndRipple.prototype, "elevation", void 0);
323
+ __decorate([
324
+ cssProperty
325
+ ], ViewWithElevationAndRipple.prototype, "dynamicElevationOffset", void 0);
326
+ __decorate([
327
+ cssProperty
328
+ ], ViewWithElevationAndRipple.prototype, "rippleColor", void 0);
329
+ __decorate([
330
+ cssProperty
331
+ ], ViewWithElevationAndRipple.prototype, "rippleColorAlpha", void 0);
332
+ applyMixins(NSView, [ViewWithElevationAndRipple]);
333
+ class ViewOverride extends View {
334
+ [androidElevationProperty.setNative](value) {
335
+ // override to prevent override of dynamicElevationOffset
336
+ this[elevationProperty.setNative](value);
337
+ }
338
+ [androidDynamicElevationOffsetProperty.setNative](value) {
339
+ // override to prevent override of elevation
340
+ this[dynamicElevationOffsetProperty.setNative](value);
341
+ }
342
+ }
343
+ applyMixins(NSView, [ViewOverride], { override: true });
344
+ }
345
+ export function installMixins() {
346
+ if (!mixinInstalled) {
347
+ mixinInstalled = true;
348
+ overrideViewBase();
349
+ }
350
+ }
351
+ //# sourceMappingURL=index.android.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.android.js","sourceRoot":"../src/","sources":["index.android.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,aAAa,EAAE,KAAK,EAAE,IAAI,EAAE,qCAAqC,EAAE,wBAAwB,EAAE,0BAA0B,EAAE,MAAM,oBAAoB,CAAC;AAChM,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAE9C,OAAO,EAAE,oBAAoB,EAAE,uBAAuB,EAAE,YAAY,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACtK,OAAO,EAAE,WAAW,EAAE,8BAA8B,EAAE,iBAAiB,EAAE,wBAAwB,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAChJ,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC3D,cAAc,iBAAiB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C5C,IAAI,CAAC,8BAA8B,CAAC,SAAS,CAAC,CAAC,KAAK,CAAC,CAAC;QAC1D,CAAC;KACJ;IACD,WAAW,CAAC,MAAM,EAAE,CAAC,YAAY,CAAC,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC;AAC5D,CAAC;AAED,MAAM,UAAU,aAAa;IACzB,IAAI,CAAC,cAAc,EAAE;QACjB,cAAc,GAAG,IAAI,CAAC;QACtB,gBAAgB,EAAE,CAAC;KACtB;AACL,CAAC"}
@@ -0,0 +1,9 @@
1
+ export declare enum CornerFamily {
2
+ CUT = "cut",
3
+ ROUNDED = "rounded"
4
+ }
5
+ export declare function applyMixins(derivedCtor: any, baseCtors: any[], options?: {
6
+ after?: boolean;
7
+ override?: boolean;
8
+ omit?: (string | symbol)[];
9
+ }): void;
@@ -0,0 +1,79 @@
1
+ export var CornerFamily;
2
+ (function (CornerFamily) {
3
+ CornerFamily["CUT"] = "cut";
4
+ CornerFamily["ROUNDED"] = "rounded";
5
+ })(CornerFamily || (CornerFamily = {}));
6
+ export function applyMixins(derivedCtor, baseCtors, options) {
7
+ const omits = options && options.omit ? options.omit : [];
8
+ baseCtors.forEach((baseCtor) => {
9
+ Object.getOwnPropertyNames(baseCtor.prototype).forEach((name) => {
10
+ if (omits.indexOf(name) !== -1) {
11
+ return;
12
+ }
13
+ const descriptor = Object.getOwnPropertyDescriptor(baseCtor.prototype, name);
14
+ if (name === 'constructor')
15
+ return;
16
+ if (descriptor && (descriptor.get || descriptor.set)) {
17
+ Object.defineProperty(derivedCtor.prototype, name, descriptor);
18
+ }
19
+ else {
20
+ const oldImpl = derivedCtor.prototype[name];
21
+ if (!oldImpl) {
22
+ derivedCtor.prototype[name] = baseCtor.prototype[name];
23
+ }
24
+ else {
25
+ derivedCtor.prototype[name] = function (...args) {
26
+ if (options) {
27
+ if (options.override) {
28
+ return baseCtor.prototype[name].apply(this, args);
29
+ }
30
+ else if (options.after) {
31
+ oldImpl.apply(this, args);
32
+ return baseCtor.prototype[name].apply(this, args);
33
+ }
34
+ else {
35
+ baseCtor.prototype[name].apply(this, args);
36
+ return oldImpl.apply(this, args);
37
+ }
38
+ }
39
+ else {
40
+ baseCtor.prototype[name].apply(this, args);
41
+ return oldImpl.apply(this, args);
42
+ }
43
+ };
44
+ }
45
+ }
46
+ });
47
+ Object.getOwnPropertySymbols(baseCtor.prototype).forEach((symbol) => {
48
+ if (omits.indexOf(symbol) !== -1) {
49
+ return;
50
+ }
51
+ const oldImpl = derivedCtor.prototype[symbol];
52
+ if (!oldImpl) {
53
+ derivedCtor.prototype[symbol] = baseCtor.prototype[symbol];
54
+ }
55
+ else {
56
+ derivedCtor.prototype[symbol] = function (...args) {
57
+ if (options) {
58
+ if (options.override) {
59
+ return baseCtor.prototype[symbol].apply(this, args);
60
+ }
61
+ else if (options.after) {
62
+ oldImpl.apply(this, args);
63
+ return baseCtor.prototype[symbol].apply(this, args);
64
+ }
65
+ else {
66
+ baseCtor.prototype[symbol].apply(this, args);
67
+ return oldImpl.apply(this, args);
68
+ }
69
+ }
70
+ else {
71
+ baseCtor.prototype[symbol].apply(this, args);
72
+ return oldImpl.apply(this, args);
73
+ }
74
+ };
75
+ }
76
+ });
77
+ });
78
+ }
79
+ //# sourceMappingURL=index.common.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.common.js","sourceRoot":"../src/","sources":["index.common.ts"],"names":[],"mappings":"AAAA,MAAM,CAAN,IAAY,YAGX;AAHD,WAAY,YAAY;IACpB,2BAAW,CAAA;IACX,mCAAmB,CAAA;AACvB,CAAC,EAHW,YAAY,KAAZ,YAAY,QAGvB;AAED,MAAM,UAAU,WAAW,CACvB,WAAgB,EAChB,SAAgB,EAChB,OAIC;IAED,MAAM,KAAK,GAAG,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC;IAC1D,SAAS,CAAC,OAAO,CAAC,CAAC,QAA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AAC,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;4BAC7C,OAAO,OAAO,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;yBACpC;qBACJ;yBAAM;wBACH,QAAQ,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;wBAC7C,OAAO,OAAO,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;qBACpC;gBACL,CAAC,CAAC;aACL;QACL,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;AACP,CAAC"}
package/index.d.ts ADDED
@@ -0,0 +1,95 @@
1
+ /**
2
+ * Material Core component
3
+ * @module @nativescript-community/ui-material-core
4
+ */
5
+
6
+ import { Color, CoreTypes, PercentLength } from '@nativescript/core';
7
+
8
+ declare module '@nativescript/core/ui/core/view' {
9
+ interface View {
10
+ _getRootFragmentManager(): androidx.fragment.app.FragmentManager;
11
+ clearFocus(): void;
12
+ requestFocus(): void;
13
+
14
+ /**
15
+ * @nativescript-community/ui-material-core {@link installMixins}.
16
+ *
17
+ * Gets or sets the elevation of the view.
18
+ */
19
+ elevation: number;
20
+
21
+ /**
22
+ * @nativescript-community/ui-material-core {@link installMixins}.
23
+ *
24
+ * Gets or sets the dynamic elevation offset of the view.
25
+ */
26
+ dynamicElevationOffset: number;
27
+
28
+ /**
29
+ * @nativescript-community/ui-material-core {@link installMixins}.
30
+ *
31
+ * Gets or sets the ripple-color of the view.
32
+ */
33
+ rippleColor: Color;
34
+
35
+ /**
36
+ * @nativescript-community/ui-material-core {@link installMixins}.
37
+ *
38
+ * Gets or sets the ripple-color alpha of the view.
39
+ */
40
+ rippleColorAlpha: number;
41
+ }
42
+ }
43
+
44
+ export interface TypographyOptions {
45
+ fontFamily?: string;
46
+ fontSize?: number;
47
+ }
48
+
49
+ import { CornerFamily } from './index.common';
50
+ export { CornerFamily };
51
+ export interface ShapeProperties {
52
+ cornerSize?: number | CoreTypes.LengthPercentUnit | CoreTypes.LengthDipUnit | CoreTypes.LengthPxUnit;
53
+ cornerSizeTopRight?: number | CoreTypes.LengthPercentUnit | CoreTypes.LengthDipUnit | CoreTypes.LengthPxUnit;
54
+ cornerSizeBottomLeft?: number | CoreTypes.LengthPercentUnit | CoreTypes.LengthDipUnit | CoreTypes.LengthPxUnit;
55
+ cornerSizeTopLeft?: number | CoreTypes.LengthPercentUnit | CoreTypes.LengthDipUnit | CoreTypes.LengthPxUnit;
56
+ cornerSizeBottomRight?: number | CoreTypes.LengthPercentUnit | CoreTypes.LengthDipUnit | CoreTypes.LengthPxUnit;
57
+ cornerFamily?: CornerFamily;
58
+ cornerFamilyTopLeft?: CornerFamily;
59
+ cornerFamilyTopRight?: CornerFamily;
60
+ cornerFamilyBottomRight?: CornerFamily;
61
+ cornerFamilyBottomLeft?: CornerFamily;
62
+ }
63
+
64
+ export class Themer {
65
+ getOrcreateAppColorScheme();
66
+ getAppColorScheme();
67
+ setPrimaryColor(value: string | Color);
68
+ getPrimaryColor(): string | Color;
69
+ getSecondaryColor(): string | Color;
70
+ setSecondaryColor(value: string | Color);
71
+ setAccentColor(value: string | Color);
72
+ getAccentColor(): string | Color;
73
+ setPrimaryColorVariant(value: string | Color);
74
+ getPrimaryColorVariant(): string | Color;
75
+ setSurfaceColor(value: string | Color);
76
+ getSurfaceColor(): string | Color;
77
+ setOnSurfaceColor(value: string | Color);
78
+ getOnSurfaceColor(): string | Color;
79
+ setOnPrimaryColor(value: string | Color);
80
+ getOnPrimaryColor(): string | Color;
81
+ createShape(key: string, options: ShapeProperties);
82
+ getShape(key: string): any;
83
+ }
84
+
85
+ export let themer: Themer;
86
+
87
+ export { applyMixins } from './index.common';
88
+ export * from './cssproperties';
89
+
90
+ export function install();
91
+ export function installMixins();
92
+ export function getRippleColor(color: string | Color, alpha?: number): any;
93
+
94
+ type Constructor<T = {}> = new (...args: any[]) => T;
95
+ export function mixin<T1 extends Constructor, T2 extends Constructor>(mix1: T1, mix2: T2): (new (...args: any[]) => InstanceType<T1> & InstanceType<T2>) & T1 & T2;
package/index.ios.d.ts ADDED
@@ -0,0 +1,52 @@
1
+ import { Color } from '@nativescript/core';
2
+ import { ShapeProperties, TypographyOptions } from '.';
3
+ import { applyMixins } from './index.common';
4
+ export * from './cssproperties';
5
+ export { applyMixins };
6
+ export declare class Themer {
7
+ appColorScheme: MDCSemanticColorScheme;
8
+ appTypoScheme: MDCTypographyScheme;
9
+ primaryColor: string | Color;
10
+ backgroundColor: string | Color;
11
+ onBackgroundColor: string | Color;
12
+ onPrimaryColor: string | Color;
13
+ secondaryColor: string | Color;
14
+ accentColor: string | Color;
15
+ primaryColorVariant: string | Color;
16
+ surfaceColor: string | Color;
17
+ onSurfaceColor: string | Color;
18
+ constructor();
19
+ getOrcreateAppColorScheme(): MDCSemanticColorScheme;
20
+ getAppColorScheme(): MDCSemanticColorScheme;
21
+ setPrimaryColor(value: string | Color): void;
22
+ getPrimaryColor(): string | Color;
23
+ setOnPrimaryColor(value: any): void;
24
+ getOnPrimaryColor(): string | Color;
25
+ setSecondaryColor(value: string | Color): void;
26
+ getSecondaryColor(): string | Color;
27
+ setAccentColor(value: string | Color): void;
28
+ getAccentColor(): string | Color;
29
+ setSurfaceColor(value: string | Color): void;
30
+ getSurfaceColor(): string | Color;
31
+ setOnSurfaceColor(value: string | Color): void;
32
+ getOnSurfaceColor(): string | Color;
33
+ setPrimaryColorVariant(value: string | Color): void;
34
+ getPrimaryColorVariant(): string | Color;
35
+ setBackgroundColor(value: string | Color): void;
36
+ getBackgroundColor(): string | Color;
37
+ setOnBackgroundColor(value: string | Color): void;
38
+ getOnBackgroundColor(): string | Color;
39
+ getOrcreateAppTypographyScheme(): MDCTypographyScheme;
40
+ getAppTypographyScheme(): MDCTypographyScheme;
41
+ setButtonTypography(args: TypographyOptions): void;
42
+ _shapes: {
43
+ [k: string]: MDCShapeScheme;
44
+ };
45
+ getShape(key: string): MDCShapeScheme;
46
+ createShape(key: string, options: ShapeProperties): void;
47
+ }
48
+ export declare const themer: Themer;
49
+ export declare function install(): void;
50
+ export declare function getRippleColor(color: string | Color, alpha?: number): UIColor;
51
+ export declare function overrideViewBase(): void;
52
+ export declare function installMixins(): void;