@photon-os/sdk 1.0.0-alpha.4 → 1.0.0-alpha.6
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/dist/index.d.mts +12 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.js +20 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +20 -0
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -4,6 +4,7 @@ type AppDefinition = {
|
|
|
4
4
|
name: string;
|
|
5
5
|
author: string;
|
|
6
6
|
url: string;
|
|
7
|
+
icon?: string;
|
|
7
8
|
};
|
|
8
9
|
type RunningAppInstance = {
|
|
9
10
|
definition: AppDefinition;
|
|
@@ -85,6 +86,7 @@ type LinkingCode = {
|
|
|
85
86
|
};
|
|
86
87
|
type OperatingSystemAPI = {
|
|
87
88
|
system_homeButton: () => Promise<void>;
|
|
89
|
+
system_getScale: () => Promise<number>;
|
|
88
90
|
apps_getInstalledApps: () => Promise<AppDefinition[]>;
|
|
89
91
|
apps_launchApp: (app: AppDefinition) => Promise<AppLaunchResult>;
|
|
90
92
|
apps_foregroundApp: (app: AppDefinition) => Promise<void>;
|
|
@@ -188,6 +190,15 @@ declare class PreferencesManager {
|
|
|
188
190
|
deleteShared(key: string): Promise<void>;
|
|
189
191
|
}
|
|
190
192
|
|
|
193
|
+
declare class SystemManager {
|
|
194
|
+
private os;
|
|
195
|
+
constructor(os: OS);
|
|
196
|
+
/** Get the OS scale factor */
|
|
197
|
+
getScale(): Promise<number>;
|
|
198
|
+
/** Apply the OS scale factor to the current document */
|
|
199
|
+
applyScale(): Promise<number>;
|
|
200
|
+
}
|
|
201
|
+
|
|
191
202
|
declare class UserManager {
|
|
192
203
|
private os;
|
|
193
204
|
constructor(os: OS);
|
|
@@ -203,6 +214,7 @@ declare class OS {
|
|
|
203
214
|
apps: AppManager;
|
|
204
215
|
devices: DeviceManager;
|
|
205
216
|
prefs: PreferencesManager;
|
|
217
|
+
system: SystemManager;
|
|
206
218
|
user: UserManager;
|
|
207
219
|
private config;
|
|
208
220
|
constructor(config?: OSConfig);
|
package/dist/index.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ type AppDefinition = {
|
|
|
4
4
|
name: string;
|
|
5
5
|
author: string;
|
|
6
6
|
url: string;
|
|
7
|
+
icon?: string;
|
|
7
8
|
};
|
|
8
9
|
type RunningAppInstance = {
|
|
9
10
|
definition: AppDefinition;
|
|
@@ -85,6 +86,7 @@ type LinkingCode = {
|
|
|
85
86
|
};
|
|
86
87
|
type OperatingSystemAPI = {
|
|
87
88
|
system_homeButton: () => Promise<void>;
|
|
89
|
+
system_getScale: () => Promise<number>;
|
|
88
90
|
apps_getInstalledApps: () => Promise<AppDefinition[]>;
|
|
89
91
|
apps_launchApp: (app: AppDefinition) => Promise<AppLaunchResult>;
|
|
90
92
|
apps_foregroundApp: (app: AppDefinition) => Promise<void>;
|
|
@@ -188,6 +190,15 @@ declare class PreferencesManager {
|
|
|
188
190
|
deleteShared(key: string): Promise<void>;
|
|
189
191
|
}
|
|
190
192
|
|
|
193
|
+
declare class SystemManager {
|
|
194
|
+
private os;
|
|
195
|
+
constructor(os: OS);
|
|
196
|
+
/** Get the OS scale factor */
|
|
197
|
+
getScale(): Promise<number>;
|
|
198
|
+
/** Apply the OS scale factor to the current document */
|
|
199
|
+
applyScale(): Promise<number>;
|
|
200
|
+
}
|
|
201
|
+
|
|
191
202
|
declare class UserManager {
|
|
192
203
|
private os;
|
|
193
204
|
constructor(os: OS);
|
|
@@ -203,6 +214,7 @@ declare class OS {
|
|
|
203
214
|
apps: AppManager;
|
|
204
215
|
devices: DeviceManager;
|
|
205
216
|
prefs: PreferencesManager;
|
|
217
|
+
system: SystemManager;
|
|
206
218
|
user: UserManager;
|
|
207
219
|
private config;
|
|
208
220
|
constructor(config?: OSConfig);
|
package/dist/index.js
CHANGED
|
@@ -1351,6 +1351,25 @@ var PreferencesManager = class {
|
|
|
1351
1351
|
}
|
|
1352
1352
|
};
|
|
1353
1353
|
|
|
1354
|
+
// src/framework/SystemManager.ts
|
|
1355
|
+
var SystemManager = class {
|
|
1356
|
+
constructor(os) {
|
|
1357
|
+
this.os = os;
|
|
1358
|
+
}
|
|
1359
|
+
/** Get the OS scale factor */
|
|
1360
|
+
async getScale() {
|
|
1361
|
+
const api2 = await this.os.getRPCAPI();
|
|
1362
|
+
return await api2.system_getScale();
|
|
1363
|
+
}
|
|
1364
|
+
/** Apply the OS scale factor to the current document */
|
|
1365
|
+
async applyScale() {
|
|
1366
|
+
const scale = await this.getScale();
|
|
1367
|
+
document.documentElement.style.setProperty("--os-scale", String(scale));
|
|
1368
|
+
document.documentElement.style.zoom = String(scale);
|
|
1369
|
+
return scale;
|
|
1370
|
+
}
|
|
1371
|
+
};
|
|
1372
|
+
|
|
1354
1373
|
// src/framework/UserManager.ts
|
|
1355
1374
|
var UserManager = class {
|
|
1356
1375
|
constructor(os) {
|
|
@@ -1371,6 +1390,7 @@ var OS = class {
|
|
|
1371
1390
|
this.apps = new AppManager(this);
|
|
1372
1391
|
this.devices = new DeviceManager(this);
|
|
1373
1392
|
this.prefs = new PreferencesManager(this);
|
|
1393
|
+
this.system = new SystemManager(this);
|
|
1374
1394
|
this.user = new UserManager(this);
|
|
1375
1395
|
}
|
|
1376
1396
|
async homeButton() {
|