@craft-native/ios 0.0.442 → 0.0.443
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/cli.js +20 -7
- package/dist/index.d.ts +13 -1
- package/dist/index.js +21 -7
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -909,6 +909,14 @@ function renderAssetCatalog(output, config) {
|
|
|
909
909
|
renderLaunchLogo(catalog, config);
|
|
910
910
|
}
|
|
911
911
|
var LAUNCH_LOGO = "LaunchLogo";
|
|
912
|
+
function splashScales(source) {
|
|
913
|
+
const extension = extname(source);
|
|
914
|
+
if (!/^\.(?:png|jpe?g)$/i.test(extension))
|
|
915
|
+
return [{ scale: 1, path: source }];
|
|
916
|
+
const stem = source.slice(0, -extension.length);
|
|
917
|
+
const scales = [2, 3].map((scale) => ({ scale, path: `${stem}@${scale}x${extension}` })).filter((item) => existsSync2(item.path));
|
|
918
|
+
return scales.length ? [{ scale: 1, path: source }, ...scales] : [{ scale: 1, path: source }];
|
|
919
|
+
}
|
|
912
920
|
function renderLaunchLogo(catalog, config) {
|
|
913
921
|
const imageset = join4(catalog, `${LAUNCH_LOGO}.imageset`);
|
|
914
922
|
rmSync2(imageset, { recursive: true, force: true });
|
|
@@ -925,13 +933,18 @@ function renderLaunchLogo(catalog, config) {
|
|
|
925
933
|
const extension = source.split(".").pop().toLowerCase();
|
|
926
934
|
if (extension === "svg" || extension === "pdf")
|
|
927
935
|
vector = true;
|
|
928
|
-
const
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
filename
|
|
933
|
-
|
|
934
|
-
|
|
936
|
+
const files = splashScales(source);
|
|
937
|
+
const scaled = files.length > 1;
|
|
938
|
+
for (const { scale, path } of files) {
|
|
939
|
+
const filename = `${LAUNCH_LOGO}${dark ? "-dark" : ""}${scale === 1 ? "" : `@${scale}x`}.${extension}`;
|
|
940
|
+
cpSync(path, join4(imageset, filename));
|
|
941
|
+
images.push({
|
|
942
|
+
...dark ? { appearances: [{ appearance: "luminosity", value: "dark" }] } : {},
|
|
943
|
+
filename,
|
|
944
|
+
idiom: "universal",
|
|
945
|
+
...scaled ? { scale: `${scale}x` } : {}
|
|
946
|
+
});
|
|
947
|
+
}
|
|
935
948
|
}
|
|
936
949
|
writeFileSync2(join4(imageset, "Contents.json"), `${JSON.stringify({
|
|
937
950
|
images,
|
package/dist/index.d.ts
CHANGED
|
@@ -208,7 +208,9 @@ export interface CraftConfig {
|
|
|
208
208
|
* screen until the page says it is ready (`splash.hide()`), so the app goes
|
|
209
209
|
* from launch to content without a blank web view in between. PNG, PDF or
|
|
210
210
|
* SVG, drawn at its own size in points: give an SVG the width and height it
|
|
211
|
-
* should have on screen.
|
|
211
|
+
* should have on screen. A PNG with `@2x` and `@3x` files beside it
|
|
212
|
+
* (`LaunchLogo.png`, `LaunchLogo@2x.png`, `LaunchLogo@3x.png`, as ts-images'
|
|
213
|
+
* `generateSplashScreens` writes them) is sharp on every screen.
|
|
212
214
|
*/
|
|
213
215
|
splashImagePath?: string;
|
|
214
216
|
/** The splash logo in Dark Mode, on `backgroundColorDark`. The light one if unset. */
|
|
@@ -532,6 +534,16 @@ export declare function renderPrivacyManifest(config: CraftConfig): string;
|
|
|
532
534
|
export declare function pngHasAlpha(bytes: Uint8Array): boolean;
|
|
533
535
|
/** The asset the launch screen and the splash both draw, so one hands over to the other unseen. */
|
|
534
536
|
export declare const LAUNCH_LOGO = "LaunchLogo";
|
|
537
|
+
/**
|
|
538
|
+
* A bitmap splash's `@2x` and `@3x` files beside it (`LaunchLogo.png`,
|
|
539
|
+
* `LaunchLogo@2x.png`, `LaunchLogo@3x.png`, as ts-images'
|
|
540
|
+
* `generateSplashScreens` writes them), by scale. A bitmap without them is
|
|
541
|
+
* one image, drawn at its pixel size in points.
|
|
542
|
+
*/
|
|
543
|
+
export declare function splashScales(source: string): Array<{
|
|
544
|
+
scale: 1 | 2 | 3;
|
|
545
|
+
path: string;
|
|
546
|
+
}>;
|
|
535
547
|
/** The launch screen: the background colour, and the splash logo on it when there is one. */
|
|
536
548
|
export declare function renderLaunchScreen(config: Pick<CraftConfig, 'splashImagePath'>): string;
|
|
537
549
|
/** Near-black or near-white, whichever reads on `background` (WCAG relative luminance). */
|
package/dist/index.js
CHANGED
|
@@ -1107,6 +1107,14 @@ function renderAssetCatalog(output, config) {
|
|
|
1107
1107
|
renderLaunchLogo(catalog, config);
|
|
1108
1108
|
}
|
|
1109
1109
|
var LAUNCH_LOGO = "LaunchLogo";
|
|
1110
|
+
function splashScales(source) {
|
|
1111
|
+
const extension = extname(source);
|
|
1112
|
+
if (!/^\.(?:png|jpe?g)$/i.test(extension))
|
|
1113
|
+
return [{ scale: 1, path: source }];
|
|
1114
|
+
const stem = source.slice(0, -extension.length);
|
|
1115
|
+
const scales = [2, 3].map((scale) => ({ scale, path: `${stem}@${scale}x${extension}` })).filter((item) => existsSync2(item.path));
|
|
1116
|
+
return scales.length ? [{ scale: 1, path: source }, ...scales] : [{ scale: 1, path: source }];
|
|
1117
|
+
}
|
|
1110
1118
|
function renderLaunchLogo(catalog, config) {
|
|
1111
1119
|
const imageset = join4(catalog, `${LAUNCH_LOGO}.imageset`);
|
|
1112
1120
|
rmSync3(imageset, { recursive: true, force: true });
|
|
@@ -1123,13 +1131,18 @@ function renderLaunchLogo(catalog, config) {
|
|
|
1123
1131
|
const extension = source.split(".").pop().toLowerCase();
|
|
1124
1132
|
if (extension === "svg" || extension === "pdf")
|
|
1125
1133
|
vector = true;
|
|
1126
|
-
const
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
filename
|
|
1131
|
-
|
|
1132
|
-
|
|
1134
|
+
const files = splashScales(source);
|
|
1135
|
+
const scaled = files.length > 1;
|
|
1136
|
+
for (const { scale, path } of files) {
|
|
1137
|
+
const filename = `${LAUNCH_LOGO}${dark ? "-dark" : ""}${scale === 1 ? "" : `@${scale}x`}.${extension}`;
|
|
1138
|
+
cpSync(path, join4(imageset, filename));
|
|
1139
|
+
images.push({
|
|
1140
|
+
...dark ? { appearances: [{ appearance: "luminosity", value: "dark" }] } : {},
|
|
1141
|
+
filename,
|
|
1142
|
+
idiom: "universal",
|
|
1143
|
+
...scaled ? { scale: `${scale}x` } : {}
|
|
1144
|
+
});
|
|
1145
|
+
}
|
|
1133
1146
|
}
|
|
1134
1147
|
writeFileSync3(join4(imageset, "Contents.json"), `${JSON.stringify({
|
|
1135
1148
|
images,
|
|
@@ -1841,6 +1854,7 @@ export {
|
|
|
1841
1854
|
runPostGenerateHook,
|
|
1842
1855
|
serializeSimulatorSteps,
|
|
1843
1856
|
showSimulator,
|
|
1857
|
+
splashScales,
|
|
1844
1858
|
syncNativeFonts,
|
|
1845
1859
|
syncWebAssets,
|
|
1846
1860
|
usesNativeBundle
|