@nativescript-community/ui-material-core 7.2.38 → 7.2.41

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