@blotch/angular-lynx-native 22.2.24 → 22.2.26
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/README.md +6 -4
- package/dist/android/project.d.ts +27 -3
- package/dist/android/project.d.ts.map +1 -1
- package/dist/android/project.js +83 -2
- package/dist/generate.d.ts +1 -1
- package/dist/generate.js +8 -2
- package/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +9 -0
- package/dist/ios/project.d.ts +20 -3
- package/dist/ios/project.d.ts.map +1 -1
- package/dist/ios/project.js +99 -2
- package/dist/options.d.ts +119 -0
- package/dist/options.d.ts.map +1 -1
- package/dist/options.js +143 -0
- package/dist/png.d.ts +5 -0
- package/dist/png.d.ts.map +1 -1
- package/dist/png.js +19 -5
- package/dist/splash.d.ts +70 -0
- package/dist/splash.d.ts.map +1 -0
- package/dist/splash.js +239 -0
- package/package.json +1 -1
- package/templates/android/README.md +19 -1
- package/templates/android/app/build.gradle.kts +4 -0
- package/templates/android/app/src/debug/java/dev/angularlynx/shell/DevServer.kt +6 -0
- package/templates/android/app/src/main/AndroidManifest.xml +27 -1
- package/templates/android/app/src/main/java/dev/angularlynx/shell/AssetsModule.kt +2 -1
- package/templates/android/app/src/main/java/dev/angularlynx/shell/CanvasUI.kt +16 -3
- package/templates/android/app/src/main/java/dev/angularlynx/shell/MainActivity.kt +81 -4
- package/templates/android/app/src/main/java/dev/angularlynx/shell/ShellModule.kt +10 -0
- package/templates/android/app/src/main/java/dev/angularlynx/shell/ShortcutActivity.kt +33 -0
- package/templates/android/app/src/main/java/dev/angularlynx/shell/ShortcutsModule.kt +72 -0
- package/templates/android/app/src/main/java/dev/angularlynx/shell/WebGLContext.kt +15 -4
- package/templates/android/app/src/main/java/dev/angularlynx/shell/WebGLModule.kt +10 -1
- package/templates/android/app/src/main/res/values/colors.xml +3 -2
- package/templates/android/app/src/main/res/values/splash.xml +9 -0
- package/templates/android/app/src/main/res/values/themes.xml +14 -0
- package/templates/android/app/src/main/res/xml/shortcuts.xml +7 -0
- package/templates/android/app/src/release/java/dev/angularlynx/shell/DevServer.kt +2 -0
- package/templates/ios/App/AngularLynxWebGL.h +34 -6
- package/templates/ios/App/AngularLynxWebGL.m +58 -23
- package/templates/ios/App/AngularLynxWebGLContext.m +25 -21
- package/templates/ios/App/AnimationFrameRate.swift +214 -0
- package/templates/ios/App/AppDelegate.swift +2 -0
- package/templates/ios/App/AssetsModule.swift +3 -1
- package/templates/ios/App/DevServer.swift +3 -0
- package/templates/ios/App/Info.plist +12 -5
- package/templates/ios/App/LynxViewController.swift +24 -1
- package/templates/ios/App/ShellModule.swift +14 -1
- package/templates/ios/App/ShortcutsModule.swift +82 -0
- package/templates/ios/App/SplashScreen.swift +71 -0
- package/templates/ios/App/WebViewLoader.swift +95 -0
- package/templates/ios/App/XElementRegistry.swift +5 -1
package/dist/options.d.ts
CHANGED
|
@@ -38,6 +38,13 @@ export type NativeAppOptions = {
|
|
|
38
38
|
* `mailto`, `tel` and `sms` are always there.
|
|
39
39
|
*/
|
|
40
40
|
readonly canOpenURLSchemes?: readonly string[];
|
|
41
|
+
/**
|
|
42
|
+
* Things the app does that the phone offers outside it (see
|
|
43
|
+
* {@link AppShortcut}): on iOS through Siri, Spotlight and the Shortcuts
|
|
44
|
+
* app, and on Android in the menu a long press on the app's icon opens.
|
|
45
|
+
* The app hears each one through the runtime's `LynxShortcuts`.
|
|
46
|
+
*/
|
|
47
|
+
readonly shortcuts?: readonly AppShortcut[];
|
|
41
48
|
/**
|
|
42
49
|
* A 1024×1024 PNG without transparency, relative to the project root. iOS
|
|
43
50
|
* uses it as it is. Android gets it resized for each screen density, round
|
|
@@ -45,10 +52,115 @@ export type NativeAppOptions = {
|
|
|
45
52
|
* {@link AndroidOptions.adaptiveIcon}).
|
|
46
53
|
*/
|
|
47
54
|
readonly icon?: string;
|
|
55
|
+
/**
|
|
56
|
+
* What the phone shows from the tap on the app's icon until the app's
|
|
57
|
+
* first screen is drawn (see {@link SplashOptions}).
|
|
58
|
+
*/
|
|
59
|
+
readonly splash?: SplashOptions;
|
|
48
60
|
readonly ios?: IosOptions;
|
|
49
61
|
readonly android?: AndroidOptions;
|
|
50
62
|
};
|
|
63
|
+
/**
|
|
64
|
+
* The launch screen: an image centered on a color, from the tap on the app's
|
|
65
|
+
* icon until the app hides it (the runtime's `provideSplashScreen()`), or
|
|
66
|
+
* until Angular first draws, without that.
|
|
67
|
+
*
|
|
68
|
+
* iOS shows it as the launch screen (`UILaunchScreen`), and the shell keeps a
|
|
69
|
+
* copy of it over the app until then. Android shows it as the splash screen,
|
|
70
|
+
* through AndroidX's `core-splashscreen`, which gives Android 7 to 11 the
|
|
71
|
+
* same splash as 12 and later.
|
|
72
|
+
*/
|
|
73
|
+
export type SplashOptions = {
|
|
74
|
+
/**
|
|
75
|
+
* A PNG with transparency, relative to the project root, drawn centered.
|
|
76
|
+
* Without one, iOS shows the color alone, and Android the launcher icon,
|
|
77
|
+
* as Android 12 does by default.
|
|
78
|
+
*/
|
|
79
|
+
readonly image?: string;
|
|
80
|
+
/**
|
|
81
|
+
* The image's width on screen, in points and dp; its height follows from
|
|
82
|
+
* its shape. Needed with `image`. Give the PNG at least three times this
|
|
83
|
+
* many pixels across, for the sharpest iPhones.
|
|
84
|
+
*
|
|
85
|
+
* Android shows a splash image inside a circle 192 dp across, so an image
|
|
86
|
+
* whose corners reach past it is drawn smaller there, with a build warning.
|
|
87
|
+
*/
|
|
88
|
+
readonly imageWidth?: number;
|
|
89
|
+
/**
|
|
90
|
+
* The color behind the image, which the shells also paint behind the app
|
|
91
|
+
* (`#RRGGBB` or `#RGB`). Defaults to white, and on Android, to black in
|
|
92
|
+
* dark mode.
|
|
93
|
+
*/
|
|
94
|
+
readonly backgroundColor?: string;
|
|
95
|
+
/** The image and the color in dark mode. Each defaults to the light one. */
|
|
96
|
+
readonly dark?: {
|
|
97
|
+
readonly image?: string;
|
|
98
|
+
readonly backgroundColor?: string;
|
|
99
|
+
};
|
|
100
|
+
};
|
|
101
|
+
/** The splash's image and color in one appearance, light or dark. */
|
|
102
|
+
export type SplashAppearance = {
|
|
103
|
+
readonly image?: string;
|
|
104
|
+
/** Undefined keeps the shell's own color. */
|
|
105
|
+
readonly backgroundColor?: string;
|
|
106
|
+
};
|
|
107
|
+
/** {@link SplashOptions} checked, with the dark values filled in. */
|
|
108
|
+
export type ResolvedSplash = {
|
|
109
|
+
/** Set when either appearance has an image. */
|
|
110
|
+
readonly imageWidth?: number;
|
|
111
|
+
readonly light: SplashAppearance;
|
|
112
|
+
readonly dark: SplashAppearance;
|
|
113
|
+
};
|
|
51
114
|
export type Orientation = 'portrait' | 'landscape' | 'all';
|
|
115
|
+
/**
|
|
116
|
+
* One thing the app does, which the person can ask for without opening the
|
|
117
|
+
* app first.
|
|
118
|
+
*
|
|
119
|
+
* iOS makes it an App Shortcut (an App Intent the shell declares): Siri runs
|
|
120
|
+
* it when it hears one of its `phrases`, and it's listed in Spotlight and in
|
|
121
|
+
* the Shortcuts app, where it can go on the Action button or in an
|
|
122
|
+
* automation. Android lists it in the menu a long press on the app's icon
|
|
123
|
+
* opens. Either way the app comes to the front, the router goes to `route`
|
|
124
|
+
* when there is one, and `LynxShortcuts` calls the handlers the app
|
|
125
|
+
* registered for `id`.
|
|
126
|
+
*/
|
|
127
|
+
export type AppShortcut = {
|
|
128
|
+
/**
|
|
129
|
+
* What the app's code knows the shortcut by: `LynxShortcuts.on(id, …)`.
|
|
130
|
+
* Letters, digits, hyphens and underscores, starting with a letter. Keep
|
|
131
|
+
* it once the app is released: the shortcuts people saved are stored
|
|
132
|
+
* under it.
|
|
133
|
+
*/
|
|
134
|
+
readonly id: string;
|
|
135
|
+
/** The name the phone lists it under, such as "Refresh". */
|
|
136
|
+
readonly title: string;
|
|
137
|
+
/**
|
|
138
|
+
* What the person says to Siri. Each one names the app with `{appName}`,
|
|
139
|
+
* which Siri requires: `"Refresh {appName}"`. Defaults to the title and the
|
|
140
|
+
* app's name, `"<title> in {appName}"`. iOS only.
|
|
141
|
+
*/
|
|
142
|
+
readonly phrases?: readonly string[];
|
|
143
|
+
/**
|
|
144
|
+
* The path the router navigates to when the shortcut runs, such as
|
|
145
|
+
* `/photos`. Without one, the app stays where it is.
|
|
146
|
+
*/
|
|
147
|
+
readonly route?: string;
|
|
148
|
+
/**
|
|
149
|
+
* The SF Symbol iOS draws beside it, such as `arrow.clockwise`. iOS only.
|
|
150
|
+
*/
|
|
151
|
+
readonly symbol?: string;
|
|
152
|
+
};
|
|
153
|
+
/** An {@link AppShortcut} with its default phrase. */
|
|
154
|
+
export type ResolvedShortcut = {
|
|
155
|
+
readonly id: string;
|
|
156
|
+
readonly title: string;
|
|
157
|
+
/** Each holds {@link APP_NAME_PLACEHOLDER} once or more. */
|
|
158
|
+
readonly phrases: readonly string[];
|
|
159
|
+
readonly route?: string;
|
|
160
|
+
readonly symbol?: string;
|
|
161
|
+
};
|
|
162
|
+
/** Where a shortcut's phrase names the app. */
|
|
163
|
+
export declare const APP_NAME_PLACEHOLDER = "{appName}";
|
|
52
164
|
export type Permission = 'camera' | 'microphone' | 'location' | 'photos' | 'savePhotos' | 'contacts' | 'notifications';
|
|
53
165
|
/**
|
|
54
166
|
* How the `.ipa` is signed, as Xcode's export methods name it:
|
|
@@ -126,7 +238,9 @@ export type ResolvedApp = {
|
|
|
126
238
|
* {@link ALWAYS_QUERIED_SCHEMES}, in lowercase, each once.
|
|
127
239
|
*/
|
|
128
240
|
readonly canOpenURLSchemes: readonly string[];
|
|
241
|
+
readonly shortcuts: readonly ResolvedShortcut[];
|
|
129
242
|
readonly icon?: string;
|
|
243
|
+
readonly splash: ResolvedSplash;
|
|
130
244
|
/** `MyApp`: the iOS product (and so .app/.ipa) name. */
|
|
131
245
|
readonly productName: string;
|
|
132
246
|
/** `my-app`: the base name of Android artifacts. */
|
|
@@ -156,6 +270,11 @@ export declare const resolveAppOptions: (rawOptions: NativeAppOptions, defaults:
|
|
|
156
270
|
readonly projectName: string;
|
|
157
271
|
readonly packageVersion?: string;
|
|
158
272
|
}) => ResolvedApp;
|
|
273
|
+
/**
|
|
274
|
+
* A shortcut's ID as part of a Swift type name or an Android resource name,
|
|
275
|
+
* neither of which takes a hyphen: `show-photos` → `show_photos`.
|
|
276
|
+
*/
|
|
277
|
+
export declare const shortcutIdentifier: (id: string) => string;
|
|
159
278
|
/**
|
|
160
279
|
* Drops `undefined` values and the objects left empty by that. Angular CLI
|
|
161
280
|
* fills in every property its schema declares for a nested option object,
|
package/dist/options.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../src/options.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,MAAM,MAAM,gBAAgB,GAAG;IAC7B,6DAA6D;IAC7D,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAC1B,yEAAyE;IACzE,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,0EAA0E;IAC1E,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAC1B,8DAA8D;IAC9D,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,WAAW,CAAC,EAAE,WAAW,CAAC;IACnC;;;;;OAKG;IACH,QAAQ,CAAC,UAAU,CAAC,EAAE,OAAO,CAAC;IAC9B,uEAAuE;IACvE,QAAQ,CAAC,WAAW,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC,CAAC;IAC3D,8DAA8D;IAC9D,QAAQ,CAAC,eAAe,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC7C;;;;;;OAMG;IACH,QAAQ,CAAC,iBAAiB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC/C;;;;;OAKG;IACH,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,G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IAAC,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,CAAA;CAAE,KAC3E,WAoJF,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,kBAAkB,GAAI,IAAI,MAAM,KAAG,MAA+B,CAAC;AA6KhF;;;;;;GAMG;AACH,eAAO,MAAM,OAAO,GAAI,OAAO,OAAO,KAAG,OAWxC,CAAC"}
|
package/dist/options.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
/** Where a shortcut's phrase names the app. */
|
|
2
|
+
export const APP_NAME_PLACEHOLDER = '{appName}';
|
|
1
3
|
export const IOS_EXPORT_METHODS = [
|
|
2
4
|
'app-store-connect',
|
|
3
5
|
'release-testing',
|
|
@@ -34,6 +36,24 @@ export const ALWAYS_QUERIED_SCHEMES = [
|
|
|
34
36
|
];
|
|
35
37
|
/** The most schemes iOS reads from LSApplicationQueriesSchemes. */
|
|
36
38
|
const MAX_QUERIED_SCHEMES = 50;
|
|
39
|
+
const SHORTCUT_ID = /^[A-Za-z][A-Za-z0-9_-]*$/;
|
|
40
|
+
/** SF Symbols are named in dot-separated words: `arrow.clockwise`. */
|
|
41
|
+
const SF_SYMBOL = /^[A-Za-z0-9]+(\.[A-Za-z0-9]+)*$/;
|
|
42
|
+
/**
|
|
43
|
+
* The most App Shortcuts iOS takes from one app. Android's launchers show
|
|
44
|
+
* about four, the first ones listed.
|
|
45
|
+
*/
|
|
46
|
+
const MAX_SHORTCUTS = 10;
|
|
47
|
+
/**
|
|
48
|
+
* Whether the text has a line break or another control character, which
|
|
49
|
+
* neither a Swift string literal nor an Android string resource takes as it
|
|
50
|
+
* is. Checked by code point: a regular expression for them would hold the
|
|
51
|
+
* control characters themselves.
|
|
52
|
+
*/
|
|
53
|
+
const hasControlCharacter = (text) => [...text].some((character) => {
|
|
54
|
+
const code = character.codePointAt(0);
|
|
55
|
+
return code < 0x20 || code === 0x7f || code === 0x2028 || code === 0x2029;
|
|
56
|
+
});
|
|
37
57
|
const PERMISSIONS = [
|
|
38
58
|
'camera',
|
|
39
59
|
'microphone',
|
|
@@ -101,6 +121,8 @@ export const resolveAppOptions = (rawOptions, defaults) => {
|
|
|
101
121
|
if (canOpenURLSchemes.length > MAX_QUERIED_SCHEMES) {
|
|
102
122
|
throw new NativeConfigError(`canOpenURLSchemes lists ${canOpenURLSchemes.length} schemes with the ${ALWAYS_QUERIED_SCHEMES.length} always there (${ALWAYS_QUERIED_SCHEMES.join(', ')}). iOS reads no more than ${MAX_QUERIED_SCHEMES}.`);
|
|
103
123
|
}
|
|
124
|
+
const shortcuts = resolveShortcuts(options.shortcuts ?? []);
|
|
125
|
+
const splash = resolveSplash(options.splash ?? {});
|
|
104
126
|
const android = options.android ?? {};
|
|
105
127
|
if (android.adaptiveIcon) {
|
|
106
128
|
const { foreground, background } = android.adaptiveIcon;
|
|
@@ -137,13 +159,134 @@ export const resolveAppOptions = (rawOptions, defaults) => {
|
|
|
137
159
|
permissions,
|
|
138
160
|
deepLinkSchemes,
|
|
139
161
|
canOpenURLSchemes,
|
|
162
|
+
shortcuts,
|
|
140
163
|
icon: options.icon,
|
|
164
|
+
splash,
|
|
141
165
|
productName,
|
|
142
166
|
artifactName,
|
|
143
167
|
ios: options.ios ?? {},
|
|
144
168
|
android,
|
|
145
169
|
};
|
|
146
170
|
};
|
|
171
|
+
/**
|
|
172
|
+
* A shortcut's ID as part of a Swift type name or an Android resource name,
|
|
173
|
+
* neither of which takes a hyphen: `show-photos` → `show_photos`.
|
|
174
|
+
*/
|
|
175
|
+
export const shortcutIdentifier = (id) => id.replace(/-/g, '_');
|
|
176
|
+
/**
|
|
177
|
+
* Checks each shortcut and gives it its default phrase. What's wrong is
|
|
178
|
+
* caught here, where the message can name the option: the Swift and XML the
|
|
179
|
+
* generators write from these would otherwise fail in Xcode's App Intents
|
|
180
|
+
* step or in Gradle, far from angular.json.
|
|
181
|
+
*/
|
|
182
|
+
const resolveShortcuts = (shortcuts) => {
|
|
183
|
+
if (shortcuts.length > MAX_SHORTCUTS) {
|
|
184
|
+
throw new NativeConfigError(`shortcuts lists ${shortcuts.length}. iOS takes no more than ${MAX_SHORTCUTS} from an app.`);
|
|
185
|
+
}
|
|
186
|
+
const identifiers = new Set();
|
|
187
|
+
const heard = new Set();
|
|
188
|
+
return shortcuts.map((entry, index) => {
|
|
189
|
+
// compact() leaves undefined where angular.json has an empty object.
|
|
190
|
+
const shortcut = (entry ?? {});
|
|
191
|
+
const { id, route, symbol } = shortcut;
|
|
192
|
+
if (typeof id !== 'string' || !SHORTCUT_ID.test(id)) {
|
|
193
|
+
throw new NativeConfigError(`shortcuts[${index}].id "${id}" is not valid. Use letters, digits, hyphens and underscores, starting with a letter, e.g. "show-photos".`);
|
|
194
|
+
}
|
|
195
|
+
// The Swift type and the Android resources are named after the ID with
|
|
196
|
+
// its hyphens as underscores, so two IDs a hyphen apart would share them.
|
|
197
|
+
const identifier = shortcutIdentifier(id).toLowerCase();
|
|
198
|
+
if (identifiers.has(identifier)) {
|
|
199
|
+
throw new NativeConfigError(`shortcuts has two entries with the id "${id}". Each needs its own (a hyphen and an underscore count as the same, and so do capitals).`);
|
|
200
|
+
}
|
|
201
|
+
identifiers.add(identifier);
|
|
202
|
+
const title = typeof shortcut.title === 'string' ? shortcut.title.trim() : '';
|
|
203
|
+
if (!title || hasControlCharacter(title)) {
|
|
204
|
+
throw new NativeConfigError(`shortcuts "${id}" needs a title on one line, the name the phone lists it under, e.g. "Show photos".`);
|
|
205
|
+
}
|
|
206
|
+
const phrases = (shortcut.phrases ?? [`${title} in ${APP_NAME_PLACEHOLDER}`]).map((phrase) => (typeof phrase === 'string' ? phrase.trim() : ''));
|
|
207
|
+
if (phrases.length === 0) {
|
|
208
|
+
throw new NativeConfigError(`shortcuts "${id}" has no phrases. Give Siri at least one, e.g. "${title} in ${APP_NAME_PLACEHOLDER}", or leave phrases out for that one.`);
|
|
209
|
+
}
|
|
210
|
+
for (const phrase of phrases) {
|
|
211
|
+
if (!phrase.includes(APP_NAME_PLACEHOLDER) ||
|
|
212
|
+
hasControlCharacter(phrase)) {
|
|
213
|
+
throw new NativeConfigError(`shortcuts "${id}" has the phrase "${phrase}", which doesn't name the app. Siri only listens for phrases that do: put ${APP_NAME_PLACEHOLDER} where the app's name is said, e.g. "${title} in ${APP_NAME_PLACEHOLDER}".`);
|
|
214
|
+
}
|
|
215
|
+
// Siri couldn't tell which of two shortcuts a phrase they share means.
|
|
216
|
+
const spoken = phrase.toLowerCase();
|
|
217
|
+
if (heard.has(spoken)) {
|
|
218
|
+
throw new NativeConfigError(`shortcuts has the phrase "${phrase}" twice. Siri needs each phrase to mean one shortcut.`);
|
|
219
|
+
}
|
|
220
|
+
heard.add(spoken);
|
|
221
|
+
}
|
|
222
|
+
if (route !== undefined &&
|
|
223
|
+
(typeof route !== 'string' ||
|
|
224
|
+
!route.startsWith('/') ||
|
|
225
|
+
hasControlCharacter(route))) {
|
|
226
|
+
throw new NativeConfigError(`shortcuts "${id}" has the route "${route}". Give the path the router navigates to, starting with "/", e.g. "/photos".`);
|
|
227
|
+
}
|
|
228
|
+
if (symbol !== undefined &&
|
|
229
|
+
(typeof symbol !== 'string' || !SF_SYMBOL.test(symbol))) {
|
|
230
|
+
throw new NativeConfigError(`shortcuts "${id}" has the symbol "${symbol}", which is not an SF Symbol's name, e.g. "arrow.clockwise".`);
|
|
231
|
+
}
|
|
232
|
+
return {
|
|
233
|
+
id,
|
|
234
|
+
title,
|
|
235
|
+
phrases,
|
|
236
|
+
...(route !== undefined && { route }),
|
|
237
|
+
...(symbol !== undefined && { symbol }),
|
|
238
|
+
};
|
|
239
|
+
});
|
|
240
|
+
};
|
|
241
|
+
/**
|
|
242
|
+
* Checks the splash options, and gives dark mode the light values it doesn't
|
|
243
|
+
* set. The images themselves are read when the project is generated.
|
|
244
|
+
*/
|
|
245
|
+
const resolveSplash = (splash) => {
|
|
246
|
+
const { image, imageWidth, backgroundColor } = splash;
|
|
247
|
+
const dark = splash.dark ?? {};
|
|
248
|
+
for (const [option, file] of [
|
|
249
|
+
['splash.image', image],
|
|
250
|
+
['splash.dark.image', dark.image],
|
|
251
|
+
]) {
|
|
252
|
+
if (file !== undefined &&
|
|
253
|
+
(typeof file !== 'string' || !file.toLowerCase().endsWith('.png'))) {
|
|
254
|
+
throw new NativeConfigError(`${option} "${file}" is not a PNG file. Give the path of a PNG with transparency, relative to the project root.`);
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
for (const [option, color] of [
|
|
258
|
+
['splash.backgroundColor', backgroundColor],
|
|
259
|
+
['splash.dark.backgroundColor', dark.backgroundColor],
|
|
260
|
+
]) {
|
|
261
|
+
if (color !== undefined &&
|
|
262
|
+
(typeof color !== 'string' || !ICON_BACKGROUND_COLOR.test(color))) {
|
|
263
|
+
throw new NativeConfigError(`${option} "${color}" is not a color. Use #RRGGBB or #RGB, e.g. "#09090B".`);
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
// The dark image takes its size from imageWidth too, and a light mode
|
|
267
|
+
// without an image while dark mode has one would be a mistake.
|
|
268
|
+
if (dark.image !== undefined && image === undefined) {
|
|
269
|
+
throw new NativeConfigError('splash.dark.image needs splash.image too: dark mode has an image of its own only where light mode has one.');
|
|
270
|
+
}
|
|
271
|
+
if (image !== undefined) {
|
|
272
|
+
if (typeof imageWidth !== 'number' ||
|
|
273
|
+
!Number.isFinite(imageWidth) ||
|
|
274
|
+
imageWidth <= 0) {
|
|
275
|
+
throw new NativeConfigError(`splash.imageWidth ${imageWidth === undefined ? 'is missing' : `${imageWidth} is not valid`}. Give the image's width on screen in points and dp, e.g. 200: a phone's screen is about 400 across.`);
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
else if (imageWidth !== undefined) {
|
|
279
|
+
throw new NativeConfigError('splash.imageWidth needs splash.image: it sets how wide the image is drawn.');
|
|
280
|
+
}
|
|
281
|
+
return {
|
|
282
|
+
...(image !== undefined && { imageWidth }),
|
|
283
|
+
light: { image, backgroundColor },
|
|
284
|
+
dark: {
|
|
285
|
+
image: dark.image ?? image,
|
|
286
|
+
backgroundColor: dark.backgroundColor ?? backgroundColor,
|
|
287
|
+
},
|
|
288
|
+
};
|
|
289
|
+
};
|
|
147
290
|
/**
|
|
148
291
|
* `my-app` → `myapp`: a project name as one app ID segment.
|
|
149
292
|
*/
|
package/dist/png.d.ts
CHANGED
|
@@ -39,6 +39,11 @@ export declare const resize: (image: Image, width: number, height: number) => Im
|
|
|
39
39
|
* continue the picture rather than show a frame of another color.
|
|
40
40
|
*/
|
|
41
41
|
export declare const extendEdges: (image: Image, inset: number) => Image;
|
|
42
|
+
/**
|
|
43
|
+
* Puts the image in the middle of a transparent `width`×`height` canvas, at
|
|
44
|
+
* least as big as the image. An odd pixel of margin goes right and below.
|
|
45
|
+
*/
|
|
46
|
+
export declare const centerOnCanvas: (image: Image, width: number, height: number) => Image;
|
|
42
47
|
/**
|
|
43
48
|
* Clears everything outside the largest circle that fits, with a one-pixel
|
|
44
49
|
* soft edge so the circle isn't jagged: the round icon launchers on
|
package/dist/png.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"png.d.ts","sourceRoot":"","sources":["../src/png.ts"],"names":[],"mappings":"AAOA;;;;GAIG;AACH,eAAO,MAAM,WAAW,GACtB,MAAM,MAAM,KACX;IAAE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;CAiBnD,CAAC;AAYF,0EAA0E;AAC1E,MAAM,MAAM,KAAK,GAAG;IAClB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;CAC3B,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,SAAS,GAAI,OAAO,MAAM,KAAG,KAGzC,CAAC;AAEF,eAAO,MAAM,SAAS,GAAI,OAAO,KAAK,KAAG,MAStC,CAAC;AAE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AG,KAezC,CAAC"}
|
package/dist/png.js
CHANGED
|
@@ -24,11 +24,11 @@ export const readPngSize = (file) => {
|
|
|
24
24
|
return { width: header.readUInt32BE(16), height: header.readUInt32BE(20) };
|
|
25
25
|
};
|
|
26
26
|
/**
|
|
27
|
-
* pngjs, loaded the first time an
|
|
28
|
-
* module. Only Android
|
|
29
|
-
*
|
|
30
|
-
* README), which works as long as
|
|
31
|
-
* built-ins.
|
|
27
|
+
* pngjs, loaded the first time an image is resized rather than with this
|
|
28
|
+
* module. Only Android's icons and a splash image need it, and CI builds the
|
|
29
|
+
* iOS app, which has no splash image, from this package's tarball unpacked
|
|
30
|
+
* without its dependencies (packages/e2e's README), which works as long as
|
|
31
|
+
* that path loads nothing but Node's built-ins.
|
|
32
32
|
*/
|
|
33
33
|
const pngjs = () => createRequire(import.meta.url)('pngjs').PNG;
|
|
34
34
|
/**
|
|
@@ -171,6 +171,20 @@ export const extendEdges = (image, inset) => {
|
|
|
171
171
|
}
|
|
172
172
|
return { width, height, data };
|
|
173
173
|
};
|
|
174
|
+
/**
|
|
175
|
+
* Puts the image in the middle of a transparent `width`×`height` canvas, at
|
|
176
|
+
* least as big as the image. An odd pixel of margin goes right and below.
|
|
177
|
+
*/
|
|
178
|
+
export const centerOnCanvas = (image, width, height) => {
|
|
179
|
+
const data = new Uint8Array(width * height * 4);
|
|
180
|
+
const left = Math.floor((width - image.width) / 2);
|
|
181
|
+
const top = Math.floor((height - image.height) / 2);
|
|
182
|
+
for (let y = 0; y < image.height; y++) {
|
|
183
|
+
const row = y * image.width * 4;
|
|
184
|
+
data.set(image.data.subarray(row, row + image.width * 4), ((top + y) * width + left) * 4);
|
|
185
|
+
}
|
|
186
|
+
return { width, height, data };
|
|
187
|
+
};
|
|
174
188
|
/**
|
|
175
189
|
* Clears everything outside the largest circle that fits, with a one-pixel
|
|
176
190
|
* soft edge so the circle isn't jagged: the round icon launchers on
|
package/dist/splash.d.ts
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import type { Platform } from './generate.ts';
|
|
2
|
+
import type { ResolvedApp, ResolvedSplash } from './options.ts';
|
|
3
|
+
/**
|
|
4
|
+
* Android's splash icon, without an icon background, is a 288 dp square...
|
|
5
|
+
*/
|
|
6
|
+
export declare const ANDROID_SLOT_DP = 288;
|
|
7
|
+
/**
|
|
8
|
+
* ...of which it shows the middle: a circle 192 dp across, two thirds of it.
|
|
9
|
+
* Anything outside the circle is cut off.
|
|
10
|
+
*/
|
|
11
|
+
export declare const ANDROID_CIRCLE_DP = 192;
|
|
12
|
+
/** Where the shells find the launch image, by name. */
|
|
13
|
+
export declare const IOS_IMAGE_SET = "LaunchImage";
|
|
14
|
+
type Size = {
|
|
15
|
+
readonly width: number;
|
|
16
|
+
readonly height: number;
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* The image's size on screen in points (dp on Android): `imageWidth` across,
|
|
20
|
+
* and as tall as its shape makes that.
|
|
21
|
+
*/
|
|
22
|
+
export declare const splashImageSize: (pixels: Size, imageWidth: number) => Size;
|
|
23
|
+
/**
|
|
24
|
+
* The size Android draws the image at: as on iOS, unless its corners reach
|
|
25
|
+
* past the circle Android shows, when it's scaled down until they touch it.
|
|
26
|
+
* A wide logo is then smaller than on iOS, but whole.
|
|
27
|
+
*/
|
|
28
|
+
export declare const androidSplashSize: (size: Size) => Size;
|
|
29
|
+
/**
|
|
30
|
+
* What's worth knowing about how the splash images will look, checked on
|
|
31
|
+
* every build (unlike the project, which is generated only when its inputs
|
|
32
|
+
* change): an image too wide for Android's circle, or with too few pixels to
|
|
33
|
+
* be sharp. A missing image is left to generation, which fails on it.
|
|
34
|
+
*/
|
|
35
|
+
export declare const splashWarnings: (app: ResolvedApp, projectRoot: string, platform: Platform) => readonly string[];
|
|
36
|
+
/**
|
|
37
|
+
* The `LaunchBackground` color set: the launch screen's color, which the
|
|
38
|
+
* shell also paints behind the LynxView. Only its dark entry varies with dark
|
|
39
|
+
* mode: an entry without an appearance is the color for any.
|
|
40
|
+
*/
|
|
41
|
+
export declare const launchBackgroundColorSet: (splash: ResolvedSplash) => string;
|
|
42
|
+
/** The image set's Contents.json, for the files {@link writeIosSplash} writes. */
|
|
43
|
+
export declare const launchImageSet: (hasDark: boolean) => string;
|
|
44
|
+
/**
|
|
45
|
+
* Writes the splash into the iOS project's asset catalog: the
|
|
46
|
+
* `LaunchBackground` color set, and the `LaunchImage` image set at 1×, 2× and
|
|
47
|
+
* 3× (and again for dark mode). Info.plist's UILaunchScreen names them (see
|
|
48
|
+
* `infoPlistEntries`), and the shell's SplashScreen.swift draws the same two
|
|
49
|
+
* over the app until the app hides it.
|
|
50
|
+
*
|
|
51
|
+
* Each scale is made here: a launch screen draws its image at its natural
|
|
52
|
+
* size, which is its pixels over its scale, so each copy is `imageWidth`
|
|
53
|
+
* points across.
|
|
54
|
+
*/
|
|
55
|
+
export declare const writeIosSplash: (dir: string, app: ResolvedApp, projectRoot: string) => void;
|
|
56
|
+
/**
|
|
57
|
+
* Writes the splash into the Android project's resources: its colors as
|
|
58
|
+
* `window_background` (light in `values/`, dark in `values-night/`), which
|
|
59
|
+
* the splash theme and the window behind the LynxView both use, and its
|
|
60
|
+
* image as the `splash_icon` drawable the theme shows.
|
|
61
|
+
*
|
|
62
|
+
* Android shows a splash image in a 288 dp square, cut to the circle 192 dp
|
|
63
|
+
* across in its middle, and scales whatever drawable it's given to the
|
|
64
|
+
* square. So the image is drawn on a transparent 288 dp canvas, at
|
|
65
|
+
* `imageWidth` dp, or smaller if its corners would be cut off, and the canvas
|
|
66
|
+
* made at each density, as the icons are.
|
|
67
|
+
*/
|
|
68
|
+
export declare const writeAndroidSplash: (dir: string, app: ResolvedApp, projectRoot: string) => void;
|
|
69
|
+
export {};
|
|
70
|
+
//# sourceMappingURL=splash.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"splash.d.ts","sourceRoot":"","sources":["../src/splash.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,Q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