@nativescript/core 8.8.0-next-07-01-2024-9747699474 → 8.8.0-pre-next-07-02-2024-9765997232

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.
Files changed (80) hide show
  1. package/application/application-common.d.ts +2 -1
  2. package/application/application-common.js +21 -7
  3. package/application/application-common.js.map +1 -1
  4. package/application/application.android.d.ts +1 -1
  5. package/application/application.android.js +4 -0
  6. package/application/application.android.js.map +1 -1
  7. package/application/application.ios.d.ts +1 -1
  8. package/application/application.ios.js +3 -2
  9. package/application/application.ios.js.map +1 -1
  10. package/config/config.interface.d.ts +24 -0
  11. package/css/reworkcss.d.ts +15 -1
  12. package/css-mediaquery/index.d.ts +27 -0
  13. package/css-mediaquery/index.js +118 -0
  14. package/css-mediaquery/index.js.map +1 -0
  15. package/globals/index.js +2 -0
  16. package/globals/index.js.map +1 -1
  17. package/media-query-list/index.d.ts +21 -0
  18. package/media-query-list/index.js +169 -0
  19. package/media-query-list/index.js.map +1 -0
  20. package/package.json +1 -1
  21. package/platform/{index.android.d.ts → device/index.android.d.ts} +1 -16
  22. package/platform/{index.android.js → device/index.android.js} +4 -47
  23. package/platform/device/index.android.js.map +1 -0
  24. package/platform/device/index.d.ts +70 -0
  25. package/platform/{index.ios.d.ts → device/index.ios.d.ts} +1 -14
  26. package/platform/{index.ios.js → device/index.ios.js} +1 -34
  27. package/platform/device/index.ios.js.map +1 -0
  28. package/platform/index.d.ts +2 -118
  29. package/platform/index.js +4 -0
  30. package/platform/index.js.map +1 -0
  31. package/platform/screen/index.android.d.ts +16 -0
  32. package/platform/screen/index.android.js +41 -0
  33. package/platform/screen/index.android.js.map +1 -0
  34. package/platform/screen/index.d.ts +48 -0
  35. package/platform/screen/index.ios.d.ts +15 -0
  36. package/platform/screen/index.ios.js +35 -0
  37. package/platform/screen/index.ios.js.map +1 -0
  38. package/trace/index.d.ts +1 -0
  39. package/trace/index.js +2 -1
  40. package/trace/index.js.map +1 -1
  41. package/ui/animation/keyframe-animation.d.ts +3 -0
  42. package/ui/animation/keyframe-animation.js +4 -2
  43. package/ui/animation/keyframe-animation.js.map +1 -1
  44. package/ui/core/view/index.android.js.map +1 -1
  45. package/ui/embedding/index.android.d.ts +4 -0
  46. package/ui/embedding/index.android.js +14 -0
  47. package/ui/embedding/index.android.js.map +1 -0
  48. package/ui/embedding/index.d.ts +10 -0
  49. package/ui/embedding/index.ios.d.ts +1 -0
  50. package/ui/embedding/index.ios.js +4 -0
  51. package/ui/embedding/index.ios.js.map +1 -0
  52. package/ui/frame/activity.android.js +106 -47
  53. package/ui/frame/activity.android.js.map +1 -1
  54. package/ui/frame/callbacks/activity-callbacks.d.ts +19 -0
  55. package/ui/frame/callbacks/activity-callbacks.js +301 -0
  56. package/ui/frame/callbacks/activity-callbacks.js.map +1 -0
  57. package/ui/frame/callbacks/fragment-callbacks.d.ts +18 -0
  58. package/ui/frame/callbacks/fragment-callbacks.js +323 -0
  59. package/ui/frame/callbacks/fragment-callbacks.js.map +1 -0
  60. package/ui/frame/fragment.android.d.ts +3 -1
  61. package/ui/frame/fragment.android.js +40 -3
  62. package/ui/frame/fragment.android.js.map +1 -1
  63. package/ui/frame/fragment.d.ts +5 -0
  64. package/ui/frame/fragment.ios.d.ts +3 -0
  65. package/ui/frame/fragment.ios.js +4 -0
  66. package/ui/frame/fragment.ios.js.map +1 -0
  67. package/ui/frame/index.android.d.ts +3 -2
  68. package/ui/frame/index.android.js +6 -622
  69. package/ui/frame/index.android.js.map +1 -1
  70. package/ui/frame/index.d.ts +18 -0
  71. package/ui/index.d.ts +1 -0
  72. package/ui/index.js +1 -0
  73. package/ui/index.js.map +1 -1
  74. package/ui/styling/css-selector.d.ts +25 -9
  75. package/ui/styling/css-selector.js +108 -20
  76. package/ui/styling/css-selector.js.map +1 -1
  77. package/ui/styling/style-scope.js +275 -131
  78. package/ui/styling/style-scope.js.map +1 -1
  79. package/platform/index.android.js.map +0 -1
  80. package/platform/index.ios.js.map +0 -1
@@ -0,0 +1,169 @@
1
+ import { Observable } from '../data/observable';
2
+ import { Screen } from '../platform';
3
+ import { Application } from '../application';
4
+ import { matchQuery, MediaQueryType } from '../css-mediaquery';
5
+ import { Trace } from '../trace';
6
+ const mediaQueryLists = [];
7
+ const applicationEvents = [Application.orientationChangedEvent, Application.systemAppearanceChangedEvent];
8
+ // In browser, developers cannot create MediaQueryList instances without calling matchMedia
9
+ let isMediaInitializationEnabled = false;
10
+ function toggleApplicationEventListeners(toAdd) {
11
+ for (const eventName of applicationEvents) {
12
+ if (toAdd) {
13
+ Application.on(eventName, onDeviceChange);
14
+ }
15
+ else {
16
+ Application.off(eventName, onDeviceChange);
17
+ }
18
+ }
19
+ }
20
+ function onDeviceChange(args) {
21
+ for (const mql of mediaQueryLists) {
22
+ const matches = checkIfMediaQueryMatches(mql.media);
23
+ if (mql.matches !== matches) {
24
+ mql._matches = matches;
25
+ mql.notify({
26
+ eventName: MediaQueryListImpl.changeEvent,
27
+ object: mql,
28
+ matches: mql.matches,
29
+ media: mql.media,
30
+ });
31
+ }
32
+ }
33
+ }
34
+ function checkIfMediaQueryMatches(mediaQueryString) {
35
+ const { widthPixels, heightPixels } = Screen.mainScreen;
36
+ let matches;
37
+ try {
38
+ matches = matchQuery(mediaQueryString, {
39
+ type: MediaQueryType.screen,
40
+ width: widthPixels,
41
+ height: heightPixels,
42
+ 'device-width': widthPixels,
43
+ 'device-height': heightPixels,
44
+ orientation: Application.orientation(),
45
+ 'prefers-color-scheme': Application.systemAppearance(),
46
+ });
47
+ }
48
+ catch (err) {
49
+ matches = false;
50
+ Trace.write(err, Trace.categories.MediaQuery, Trace.messageType.error);
51
+ }
52
+ return matches;
53
+ }
54
+ function matchMedia(mediaQueryString) {
55
+ isMediaInitializationEnabled = true;
56
+ const mediaQueryList = new MediaQueryListImpl();
57
+ isMediaInitializationEnabled = false;
58
+ mediaQueryList._media = mediaQueryString;
59
+ mediaQueryList._matches = checkIfMediaQueryMatches(mediaQueryString);
60
+ return mediaQueryList;
61
+ }
62
+ class MediaQueryListImpl extends Observable {
63
+ constructor() {
64
+ super();
65
+ if (!isMediaInitializationEnabled) {
66
+ throw new TypeError('Illegal constructor');
67
+ }
68
+ Object.defineProperties(this, {
69
+ _media: {
70
+ writable: true,
71
+ },
72
+ _matches: {
73
+ writable: true,
74
+ },
75
+ _onChange: {
76
+ writable: true,
77
+ value: null,
78
+ },
79
+ mediaQueryChangeListeners: {
80
+ value: new Map(),
81
+ },
82
+ _throwInvocationError: {
83
+ value: null,
84
+ },
85
+ });
86
+ }
87
+ get media() {
88
+ this._throwInvocationError?.();
89
+ return this._media;
90
+ }
91
+ get matches() {
92
+ this._throwInvocationError?.();
93
+ return this._matches;
94
+ }
95
+ // @ts-ignore
96
+ addEventListener(eventName, callback, thisArg) {
97
+ this._throwInvocationError?.();
98
+ const hasChangeListeners = this.hasListeners(MediaQueryListImpl.changeEvent);
99
+ // Call super method first since it throws in the case of bad parameters
100
+ super.addEventListener(eventName, callback, thisArg);
101
+ if (eventName === MediaQueryListImpl.changeEvent && !hasChangeListeners) {
102
+ mediaQueryLists.push(this);
103
+ if (mediaQueryLists.length === 1) {
104
+ toggleApplicationEventListeners(true);
105
+ }
106
+ }
107
+ }
108
+ // @ts-ignore
109
+ removeEventListener(eventName, callback, thisArg) {
110
+ this._throwInvocationError?.();
111
+ // Call super method first since it throws in the case of bad parameters
112
+ super.removeEventListener(eventName, callback, thisArg);
113
+ if (eventName === MediaQueryListImpl.changeEvent) {
114
+ const hasChangeListeners = this.hasListeners(MediaQueryListImpl.changeEvent);
115
+ if (!hasChangeListeners) {
116
+ const index = mediaQueryLists.indexOf(this);
117
+ if (index >= 0) {
118
+ mediaQueryLists.splice(index, 1);
119
+ if (!mediaQueryLists.length) {
120
+ toggleApplicationEventListeners(false);
121
+ }
122
+ }
123
+ }
124
+ }
125
+ }
126
+ addListener(callback) {
127
+ this._throwInvocationError?.();
128
+ // This kind of implementation helps maintain listener registration order
129
+ // regardless of using the deprecated methods or property onchange
130
+ const wrapperCallback = (data) => {
131
+ callback.call(this, {
132
+ matches: this.matches,
133
+ media: this.media,
134
+ });
135
+ };
136
+ // Call this method first since it throws in the case of bad parameters
137
+ this.addEventListener(MediaQueryListImpl.changeEvent, wrapperCallback);
138
+ this.mediaQueryChangeListeners.set(callback, wrapperCallback);
139
+ }
140
+ removeListener(callback) {
141
+ this._throwInvocationError?.();
142
+ if (this.mediaQueryChangeListeners.has(callback)) {
143
+ // Call this method first since it throws in the case of bad parameters
144
+ this.removeEventListener(MediaQueryListImpl.changeEvent, this.mediaQueryChangeListeners.get(callback));
145
+ this.mediaQueryChangeListeners.delete(callback);
146
+ }
147
+ }
148
+ get onchange() {
149
+ this._throwInvocationError?.();
150
+ return this._onChange;
151
+ }
152
+ set onchange(callback) {
153
+ this._throwInvocationError?.();
154
+ // Remove old listener if any
155
+ if (this._onChange) {
156
+ this.removeListener(this._onChange);
157
+ }
158
+ if (callback) {
159
+ this.addListener(callback);
160
+ }
161
+ this._onChange = callback;
162
+ }
163
+ _throwInvocationError() {
164
+ throw new TypeError('Illegal invocation');
165
+ }
166
+ }
167
+ MediaQueryListImpl.changeEvent = 'change';
168
+ export { matchMedia, MediaQueryListImpl as MediaQueryList, checkIfMediaQueryMatches };
169
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../packages/core/media-query-list/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,WAAW,EAAwB,MAAM,gBAAgB,CAAC;AACnE,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAC/D,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAEjC,MAAM,eAAe,GAAyB,EAAE,CAAC;AACjD,MAAM,iBAAiB,GAAa,C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B,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QACrC,CAAC;QAED,IAAI,QAAQ,EAAE,CAAC;YACd,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC;QAC5B,CAAC;QAED,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC;IAC3B,CAAC;IAEO,qBAAqB;QAC5B,MAAM,IAAI,SAAS,CAAC,oBAAoB,CAAC,CAAC;IAC3C,CAAC;;AA1IsB,8BAAW,GAAG,QAAQ,CAAC;AA6I/C,OAAO,EAAE,UAAU,EAAE,kBAAkB,IAAI,cAAc,EAAE,wBAAwB,EAAE,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nativescript/core",
3
- "version": "8.8.0-next-07-01-2024-9747699474",
3
+ "version": "8.8.0-pre-next-07-02-2024-9765997232",
4
4
  "description": "A JavaScript library providing an easy to use api for interacting with iOS and Android platform APIs.",
5
5
  "main": "index",
6
6
  "types": "index.d.ts",
@@ -1,19 +1,3 @@
1
- export * from './common';
2
- declare class MainScreen {
3
- private _metrics;
4
- private reinitMetrics;
5
- private initMetrics;
6
- private get metrics();
7
- get widthPixels(): number;
8
- get heightPixels(): number;
9
- get scale(): number;
10
- get widthDIPs(): number;
11
- get heightDIPs(): number;
12
- }
13
- export declare class Screen {
14
- static mainScreen: MainScreen;
15
- }
16
- export declare const screen: typeof Screen;
17
1
  declare class DeviceRef {
18
2
  private _manufacturer;
19
3
  private _model;
@@ -33,3 +17,4 @@ declare class DeviceRef {
33
17
  }
34
18
  export declare const Device: DeviceRef;
35
19
  export declare const device: DeviceRef;
20
+ export {};
@@ -1,51 +1,8 @@
1
- /* tslint:disable:class-name */
2
- import { Application } from '../application';
3
- import { SDK_VERSION } from '../utils/constants';
4
- import { platformNames } from './common';
1
+ import { Application } from '../../application';
2
+ import { SDK_VERSION } from '../../utils/constants';
3
+ import { platformNames } from '../common';
4
+ import { Screen } from '../screen';
5
5
  const MIN_TABLET_PIXELS = 600;
6
- export * from './common';
7
- class MainScreen {
8
- reinitMetrics() {
9
- if (!this._metrics) {
10
- this._metrics = new android.util.DisplayMetrics();
11
- }
12
- this.initMetrics();
13
- }
14
- initMetrics() {
15
- const nativeApp = Application.android.getNativeApplication();
16
- nativeApp.getSystemService(android.content.Context.WINDOW_SERVICE).getDefaultDisplay().getRealMetrics(this._metrics);
17
- }
18
- get metrics() {
19
- if (!this._metrics) {
20
- // NOTE: This will be memory leak but we MainScreen is singleton
21
- Application.on('cssChanged', this.reinitMetrics, this);
22
- Application.on(Application.orientationChangedEvent, this.reinitMetrics, this);
23
- this._metrics = new android.util.DisplayMetrics();
24
- this.initMetrics();
25
- }
26
- return this._metrics;
27
- }
28
- get widthPixels() {
29
- return this.metrics.widthPixels;
30
- }
31
- get heightPixels() {
32
- return this.metrics.heightPixels;
33
- }
34
- get scale() {
35
- return this.metrics.density;
36
- }
37
- get widthDIPs() {
38
- return this.metrics.widthPixels / this.metrics.density;
39
- }
40
- get heightDIPs() {
41
- return this.metrics.heightPixels / this.metrics.density;
42
- }
43
- }
44
- export class Screen {
45
- }
46
- Screen.mainScreen = new MainScreen();
47
- // This retains compatibility with NS6
48
- export const screen = Screen;
49
6
  class DeviceRef {
50
7
  get manufacturer() {
51
8
  if (!this._manufacturer) {
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.android.js","sourceRoot":"","sources":["../../../../../packages/core/platform/device/index.android.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAEnC,MAAM,iBAAiB,GAAG,GAAG,CAAC;AAE9B,MAAM,SAAS;IAQd,IAAI,YAAY;QACf,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE,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B,GAAG,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,SAAS,EAAE,CAAC,gBAAgB,EAAE,CAAC,MAAM,CAAC;QAC3F,CAAC;QACD,OAAO,mBAAmB,CAAC,UAAU,EAAE,CAAC;IACzC,CAAC;CACD;AAED,MAAM,CAAC,MAAM,MAAM,GAAG,IAAI,SAAS,EAAE,CAAC;AAEtC,sCAAsC;AACtC,MAAM,CAAC,MAAM,MAAM,GAAG,MAAM,CAAC"}
@@ -0,0 +1,70 @@
1
+ /*
2
+ * An object containing device specific information.
3
+ */
4
+ export interface IDevice {
5
+ /**
6
+ * Gets the manufacturer of the device.
7
+ * For example: "Apple" or "HTC" or "Samsung".
8
+ */
9
+ manufacturer: string;
10
+
11
+ /**
12
+ * Gets the model of the device.
13
+ * For example: "Nexus 5" or "iPhone".
14
+ */
15
+ model: string;
16
+
17
+ /**
18
+ * Gets the OS of the device.
19
+ * For example: "Android" or "iOS".
20
+ */
21
+ os: string;
22
+
23
+ /**
24
+ * Gets the OS version.
25
+ * For example: 4.4.4(android), 8.1(ios)
26
+ */
27
+ osVersion: string;
28
+
29
+ /**
30
+ * Gets the SDK version.
31
+ * For example: 19(android), 8.1(ios).
32
+ */
33
+ sdkVersion: string;
34
+
35
+ /**
36
+ * Gets the type of the current device.
37
+ * Available values: "Phone", "Tablet".
38
+ */
39
+ deviceType: 'Phone' | 'Tablet';
40
+
41
+ /**
42
+ * Gets the uuid.
43
+ * On iOS this will return a new uuid if the application is re-installed on the device.
44
+ * If you need to receive the same uuid even after the application has been re-installed on the device,
45
+ * use this plugin: https://www.npmjs.com/package/nativescript-ios-uuid
46
+ */
47
+ uuid: string;
48
+
49
+ /**
50
+ * Gets the preferred language. For example "en" or "en-US".
51
+ */
52
+ language: string;
53
+
54
+ /**
55
+ * Gets the preferred region. For example "US".
56
+ */
57
+ region: string;
58
+ }
59
+
60
+ /**
61
+ * Gets the current device information.
62
+ */
63
+ export const Device: IDevice;
64
+
65
+ /**
66
+ * Gets the current device information.
67
+ *
68
+ * This retains compatibility with NS6
69
+ */
70
+ export const device: IDevice;
@@ -1,4 +1,3 @@
1
- export * from './common';
2
1
  type DeviceType = 'Phone' | 'Tablet' | 'Vision';
3
2
  declare class DeviceRef {
4
3
  private _model;
@@ -15,18 +14,6 @@ declare class DeviceRef {
15
14
  get language(): string;
16
15
  get region(): string;
17
16
  }
18
- declare class MainScreen {
19
- private _screen;
20
- private get screen();
21
- get widthPixels(): number;
22
- get heightPixels(): number;
23
- get scale(): number;
24
- get widthDIPs(): number;
25
- get heightDIPs(): number;
26
- }
27
17
  export declare const Device: DeviceRef;
28
18
  export declare const device: DeviceRef;
29
- export declare class Screen {
30
- static mainScreen: MainScreen;
31
- }
32
- export declare const screen: typeof Screen;
19
+ export {};
@@ -1,7 +1,4 @@
1
- /* tslint:disable:class-name */
2
- import { platformNames } from './common';
3
- import { ios } from '../utils';
4
- export * from './common';
1
+ import { platformNames } from '../common';
5
2
  class DeviceRef {
6
3
  get manufacturer() {
7
4
  return 'Apple';
@@ -66,37 +63,7 @@ class DeviceRef {
66
63
  return NSLocale.currentLocale.objectForKey(NSLocaleCountryCode);
67
64
  }
68
65
  }
69
- class MainScreen {
70
- get screen() {
71
- if (!this._screen) {
72
- // NOTE: may not want to cache this value with SwiftUI app lifecycle based apps (using NativeScriptViewFactory) given the potential of multiple scenes
73
- const window = ios.getWindow();
74
- this._screen = window ? window.screen : UIScreen.mainScreen;
75
- }
76
- return this._screen;
77
- }
78
- get widthPixels() {
79
- return this.widthDIPs * this.scale;
80
- }
81
- get heightPixels() {
82
- return this.heightDIPs * this.scale;
83
- }
84
- get scale() {
85
- return this.screen.scale;
86
- }
87
- get widthDIPs() {
88
- return this.screen.bounds.size.width;
89
- }
90
- get heightDIPs() {
91
- return this.screen.bounds.size.height;
92
- }
93
- }
94
66
  export const Device = new DeviceRef();
95
67
  // This retains compatibility with NS6
96
68
  export const device = Device;
97
- export class Screen {
98
- }
99
- Screen.mainScreen = new MainScreen();
100
- // This retains compatibility with NS6
101
- export const screen = Screen;
102
69
  //# sourceMappingURL=index.ios.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.ios.js","sourceRoot":"","sources":["../../../../../packages/core/platform/device/index.ios.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAI1C,MAAM,SAAS;IAMd,IAAI,YAAY;QACf,OAAO,OAAO,CAAC;IAChB,CAAC;IAED,IAAI,EAAE;QACL,IAAI,YAAY,EAAE,CAAC;YAClB,OAAO,aAAa,CAAC,QAAQ,CAAC;QAC/B,CAAC;aAAM,CAAC;YACP,OAAO,aAAa,CAAC,GAAG,CAAC;QAC1B,CAAC;IACF,CAAC;IAED,IAAI,SAAS;QACZ,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC;YACtB,IAAI,CAAC,UAAU,GAAG,QAAQ,CAAC,aAAa,CAAC,aAAa,CAAC;QACxD,CAAC;QAED,OAAO,IAAI,CAAC,UAAU,CAAC;IACxB,CAAC;IAED,IAAI,KAAK;QACR,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;YAClB,IAAI,CAAC,MAAM,GAAG,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC;QAC5C,CAAC;QAED,OAAO,IAAI,CAAC,MAAM,CAAC;IACpB,CAAC;IAED,IAAI,UAAU;QACb,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC;YACvB,IAAI,CAAC,WAAW,GAAG,QAAQ,CAAC,aAAa,CAAC,aAAa,CAAC;QACzD,CAAC;QAED,OAAO,IAAI,CAAC,WAAW,CAAC;IACzB,CAAC;IAED,IAAI,UAAU;QACb,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC;YACvB,IAAI,QAAQ,CAAC,aAAa,CAAC,kBAAkB,uCAA+B,EAAE,CAAC;gBAC9E,IAAI,CAAC,WAAW,GAAG,OAAO,CAAC;YAC5B,CAAC;iBAAM,IAAI,QAAQ,CAAC,aAAa,CAAC,kBAAkB,wCAAgC,EAAE,CAAC;gBACtF,IAAI,CAAC,WAAW,GAAG,QAAQ,CAAC;gBAC5B,sDAAsD;gBACtD,+BAA+B;YAChC,CAAC;iBAAM,CAAC;gBACP,IAAI,CAAC,WAAW,GAAG,QAAQ,CAAC;YAC7B,CAAC;QACF,CAAC;QAED,OAAO,IAAI,CAAC,WAAW,CAAC;IACzB,CAAC;IAED,IAAI,IAAI;QACP,MAAM,YAAY,GAAG,cAAc,CAAC,oBAAoB,CAAC;QACzD,MAAM,QAAQ,GAAG,SAAS,CAAC;QAC3B,IAAI,QAAQ,GAAG,YAAY,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC;QAEnD,IAAI,CAAC,QAAQ,EAAE,CAAC;YACf,QAAQ,GAAG,MAAM,CAAC,IAAI,EAAE,CAAC,UAAU,CAAC;YACpC,YAAY,CAAC,eAAe,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;YACjD,YAAY,CAAC,WAAW,EAAE,CAAC;QAC5B,CAAC;QAED,OAAO,QAAQ,CAAC;IACjB,CAAC;IAED,IAAI,QAAQ;QACX,OAAO,QAAQ,CAAC,kBAAkB,CAAC,CAAC,CAAC,CAAC;IACvC,CAAC;IAED,IAAI,MAAM;QACT,OAAO,QAAQ,CAAC,aAAa,CAAC,YAAY,CAAC,mBAAmB,CAAC,CAAC;IACjE,CAAC;CACD;AAED,MAAM,CAAC,MAAM,MAAM,GAAG,IAAI,SAAS,EAAE,CAAC;AAEtC,sCAAsC;AACtC,MAAM,CAAC,MAAM,MAAM,GAAG,MAAM,CAAC"}
@@ -25,121 +25,5 @@ export const isApple: boolean;
25
25
  export const isVisionOS: boolean;
26
26
 
27
27
  export * from './common';
28
-
29
- /*
30
- * An object containing device specific information.
31
- */
32
- export interface IDevice {
33
- /**
34
- * Gets the manufacturer of the device.
35
- * For example: "Apple" or "HTC" or "Samsung".
36
- */
37
- manufacturer: string;
38
-
39
- /**
40
- * Gets the model of the device.
41
- * For example: "Nexus 5" or "iPhone".
42
- */
43
- model: string;
44
-
45
- /**
46
- * Gets the OS of the device.
47
- * For example: "Android" or "iOS".
48
- */
49
- os: string;
50
-
51
- /**
52
- * Gets the OS version.
53
- * For example: 4.4.4(android), 8.1(ios)
54
- */
55
- osVersion: string;
56
-
57
- /**
58
- * Gets the SDK version.
59
- * For example: 19(android), 8.1(ios).
60
- */
61
- sdkVersion: string;
62
-
63
- /**
64
- * Gets the type of the current device.
65
- * Available values: "Phone", "Tablet".
66
- */
67
- deviceType: 'Phone' | 'Tablet';
68
-
69
- /**
70
- * Gets the uuid.
71
- * On iOS this will return a new uuid if the application is re-installed on the device.
72
- * If you need to receive the same uuid even after the application has been re-installed on the device,
73
- * use this plugin: https://www.npmjs.com/package/nativescript-ios-uuid
74
- */
75
- uuid: string;
76
-
77
- /**
78
- * Gets the preferred language. For example "en" or "en-US".
79
- */
80
- language: string;
81
-
82
- /**
83
- * Gets the preferred region. For example "US".
84
- */
85
- region: string;
86
- }
87
-
88
- /**
89
- * An object containing screen information.
90
- */
91
- export interface ScreenMetrics {
92
- /**
93
- * Gets the absolute width of the screen in pixels.
94
- */
95
- widthPixels: number;
96
-
97
- /**
98
- * Gets the absolute height of the screen in pixels.
99
- */
100
- heightPixels: number;
101
-
102
- /**
103
- * Gets the absolute width of the screen in density independent pixels.
104
- */
105
- widthDIPs: number;
106
-
107
- /**
108
- * Gets the absolute height of the screen in density independent pixels.
109
- */
110
- heightDIPs: number;
111
-
112
- /**
113
- * The logical density of the display. This is a scaling factor for the Density Independent Pixel unit.
114
- */
115
- scale: number;
116
- }
117
-
118
- /**
119
- * An object describing general information about a display.
120
- */
121
- export class Screen {
122
- /**
123
- * Gets information about the main screen of the current device.
124
- */
125
- static mainScreen: ScreenMetrics;
126
- }
127
-
128
- /**
129
- * An object describing general information about a display.
130
- *
131
- * This retains compatibility with NS6
132
- */
133
- export const screen: Screen;
134
-
135
- /**
136
- * Gets the current device information.
137
- */
138
- export const Device: IDevice;
139
-
140
- /**
141
- * Gets the current device information.
142
- *
143
- * This retains compatibility with NS6
144
- */
145
- export const device: IDevice;
28
+ export * from './device';
29
+ export * from './screen';
@@ -0,0 +1,4 @@
1
+ export * from './common';
2
+ export * from './device';
3
+ export * from './screen';
4
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../packages/core/platform/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC"}
@@ -0,0 +1,16 @@
1
+ declare class MainScreen {
2
+ private _metrics;
3
+ private initMetrics;
4
+ private get metrics();
5
+ get widthPixels(): number;
6
+ get heightPixels(): number;
7
+ get scale(): number;
8
+ get widthDIPs(): number;
9
+ get heightDIPs(): number;
10
+ _updateMetrics(): void;
11
+ }
12
+ export declare class Screen {
13
+ static mainScreen: MainScreen;
14
+ }
15
+ export declare const screen: typeof Screen;
16
+ export {};
@@ -0,0 +1,41 @@
1
+ import { Application } from '../../application';
2
+ class MainScreen {
3
+ initMetrics() {
4
+ const nativeApp = Application.android.getNativeApplication();
5
+ nativeApp.getSystemService(android.content.Context.WINDOW_SERVICE).getDefaultDisplay().getRealMetrics(this._metrics);
6
+ }
7
+ get metrics() {
8
+ if (!this._metrics) {
9
+ this._metrics = new android.util.DisplayMetrics();
10
+ this.initMetrics();
11
+ }
12
+ return this._metrics;
13
+ }
14
+ get widthPixels() {
15
+ return this.metrics.widthPixels;
16
+ }
17
+ get heightPixels() {
18
+ return this.metrics.heightPixels;
19
+ }
20
+ get scale() {
21
+ return this.metrics.density;
22
+ }
23
+ get widthDIPs() {
24
+ return this.metrics.widthPixels / this.metrics.density;
25
+ }
26
+ get heightDIPs() {
27
+ return this.metrics.heightPixels / this.metrics.density;
28
+ }
29
+ _updateMetrics() {
30
+ if (!this._metrics) {
31
+ this._metrics = new android.util.DisplayMetrics();
32
+ }
33
+ this.initMetrics();
34
+ }
35
+ }
36
+ export class Screen {
37
+ }
38
+ Screen.mainScreen = new MainScreen();
39
+ // This retains compatibility with NS6
40
+ export const screen = Screen;
41
+ //# sourceMappingURL=index.android.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.android.js","sourceRoot":"","sources":["../../../../../packages/core/platform/screen/index.android.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD,MAAM,UAAU;IAGP,WAAW;QAClB,MAAM,SAAS,GAAG,WAAW,CAAC,OAAO,CAAC,oBAAoB,EAAE,CAAC;QAC7D,SAAS,CAAC,gBAAgB,CAAC,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC,iBAAiB,EAAE,CAAC,cAAc,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACtH,CAAC;IAED,IAAY,OAAO;QAClB,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC;YACpB,IAAI,CAAC,QAAQ,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC,cAAc,EAAE,CAAC;YAClD,IAAI,CAAC,WAAW,EAAE,CAAC;QACpB,CAAC;QAED,OAAO,IAAI,CAAC,QAAQ,CAAC;IACtB,CAAC;IAED,IAAI,WAAW;QACd,OAAO,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC;IACjC,CAAC;IACD,IAAI,YAAY;QACf,OAAO,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC;IAClC,CAAC;IACD,IAAI,KAAK;QACR,OAAO,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC;IAC7B,CAAC;IACD,IAAI,SAAS;QACZ,OAAO,IAAI,CAAC,OAAO,CAAC,WAAW,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC;IACxD,CAAC;IACD,IAAI,UAAU;QACb,OAAO,IAAI,CAAC,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC;IACzD,CAAC;IAEM,cAAc;QACpB,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC;YACpB,IAAI,CAAC,QAAQ,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC,cAAc,EAAE,CAAC;QACnD,CAAC;QACD,IAAI,CAAC,WAAW,EAAE,CAAC;IACpB,CAAC;CACD;AAED,MAAM,OAAO,MAAM;;AACX,iBAAU,GAAG,IAAI,UAAU,EAAE,CAAC;AAGtC,sCAAsC;AACtC,MAAM,CAAC,MAAM,MAAM,GAAG,MAAM,CAAC"}
@@ -0,0 +1,48 @@
1
+ /**
2
+ * An object containing screen information.
3
+ */
4
+ export interface ScreenMetrics {
5
+ /**
6
+ * Gets the absolute width of the screen in pixels.
7
+ */
8
+ widthPixels: number;
9
+
10
+ /**
11
+ * Gets the absolute height of the screen in pixels.
12
+ */
13
+ heightPixels: number;
14
+
15
+ /**
16
+ * Gets the absolute width of the screen in density independent pixels.
17
+ */
18
+ widthDIPs: number;
19
+
20
+ /**
21
+ * Gets the absolute height of the screen in density independent pixels.
22
+ */
23
+ heightDIPs: number;
24
+
25
+ /**
26
+ * The logical density of the display. This is a scaling factor for the Density Independent Pixel unit.
27
+ */
28
+ scale: number;
29
+
30
+ _updateMetrics(): void;
31
+ }
32
+
33
+ /**
34
+ * An object describing general information about a display.
35
+ */
36
+ export class Screen {
37
+ /**
38
+ * Gets information about the main screen of the current device.
39
+ */
40
+ static mainScreen: ScreenMetrics;
41
+ }
42
+
43
+ /**
44
+ * An object describing general information about a display.
45
+ *
46
+ * This retains compatibility with NS6
47
+ */
48
+ export const screen: Screen;