expo-app-icon 1.3.0 → 1.4.0
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 +7 -13
- package/build/index.d.ts +0 -2
- package/build/index.d.ts.map +1 -1
- package/build/index.js +0 -1
- package/build/index.js.map +1 -1
- package/build/index.web.d.ts +0 -2
- package/build/index.web.d.ts.map +1 -1
- package/build/index.web.js +0 -1
- package/build/index.web.js.map +1 -1
- package/package.json +1 -1
- package/plugin/build/icons.d.ts +1 -2
- package/plugin/build/icons.js +2 -4
- package/plugin/build/index.js +6 -20
- package/plugin/build/types.d.ts +0 -9
- package/build/icons-data.d.ts +0 -19
- package/build/icons-data.d.ts.map +0 -1
- package/build/icons-data.generated.d.ts +0 -7
- package/build/icons-data.generated.d.ts.map +0 -1
- package/build/icons-data.generated.js +0 -6
- package/build/icons-data.generated.js.map +0 -1
- package/build/icons-data.js +0 -10
- package/build/icons-data.js.map +0 -1
package/README.md
CHANGED
|
@@ -31,16 +31,12 @@ Add the plugin to your `app.json` config and declare your icons. Each icon is ju
|
|
|
31
31
|
}
|
|
32
32
|
```
|
|
33
33
|
|
|
34
|
-
The same image is used for both platforms. For per-platform images,
|
|
35
|
-
metadata (any key/value you want — labels, descriptions, premium flags, …), use the object form:
|
|
34
|
+
The same image is used for both platforms. For per-platform images, use the object form:
|
|
36
35
|
|
|
37
36
|
```json
|
|
38
37
|
{
|
|
39
38
|
"red": "./assets/icons/red.png",
|
|
40
|
-
"blue": {
|
|
41
|
-
"image": "./assets/icons/blue.png",
|
|
42
|
-
"metadata": { "label": "Blue", "description": "Cool blue", "isPremium": true }
|
|
43
|
-
},
|
|
39
|
+
"blue": { "image": "./assets/icons/blue.png" },
|
|
44
40
|
"split": {
|
|
45
41
|
"ios": "./assets/icons/split-ios.png",
|
|
46
42
|
"android": "./assets/icons/split-android.png"
|
|
@@ -49,7 +45,6 @@ metadata (any key/value you want — labels, descriptions, premium flags, …),
|
|
|
49
45
|
```
|
|
50
46
|
|
|
51
47
|
- `image` sets both platforms; `ios` / `android` override it per platform.
|
|
52
|
-
- `metadata` is passed straight through to `getAvailableIcons()` at runtime (it's ignored when generating the icons).
|
|
53
48
|
|
|
54
49
|
Then create a new build (the plugin runs during prebuild):
|
|
55
50
|
|
|
@@ -59,19 +54,19 @@ npx expo prebuild --clean
|
|
|
59
54
|
|
|
60
55
|
## Usage
|
|
61
56
|
|
|
62
|
-
|
|
57
|
+
Switch icons at runtime with the `useAppIcon` hook — no per-app persistence needed (the native module is the source of truth). `IconName` is typed to your configured keys:
|
|
63
58
|
|
|
64
59
|
```tsx
|
|
65
|
-
import { useAppIcon,
|
|
60
|
+
import { useAppIcon, type IconName } from "expo-app-icon";
|
|
66
61
|
|
|
67
|
-
|
|
62
|
+
const ICONS: IconName[] = ["red", "blue"];
|
|
68
63
|
|
|
69
64
|
function IconPicker() {
|
|
70
65
|
const { icon, setIcon, isDefault } = useAppIcon();
|
|
71
66
|
|
|
72
|
-
return
|
|
67
|
+
return ICONS.map((name) => (
|
|
73
68
|
<Pressable key={name} onPress={() => setIcon(name)}>
|
|
74
|
-
<Text>{
|
|
69
|
+
<Text>{name}{icon === name ? " ✓" : ""}</Text>
|
|
75
70
|
</Pressable>
|
|
76
71
|
));
|
|
77
72
|
}
|
|
@@ -80,7 +75,6 @@ function IconPicker() {
|
|
|
80
75
|
- `icon` — the current icon key, or `null` for the default.
|
|
81
76
|
- `setIcon(name | null)` — switch icons; pass `null` to reset to the default. (The iOS timing fix is built in.)
|
|
82
77
|
- `isDefault` / `isSupported` — handy flags (`isSupported` is `false` on web).
|
|
83
|
-
- `getAvailableIcons<Meta>()` — the configured icons + their metadata, typed to `Meta`.
|
|
84
78
|
|
|
85
79
|
Or call the underlying functions directly:
|
|
86
80
|
|
package/build/index.d.ts
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import type { DynamicAppIconRegistry } from "./types";
|
|
2
2
|
export { useAppIcon } from "./useAppIcon";
|
|
3
3
|
export type { UseAppIcon } from "./useAppIcon";
|
|
4
|
-
export { getAvailableIcons } from "./icons-data";
|
|
5
|
-
export type { AppIconEntry } from "./icons-data";
|
|
6
4
|
/**
|
|
7
5
|
* Union of the icon keys declared in the plugin config (widened to string when none).
|
|
8
6
|
*/
|
package/build/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,SAAS,CAAC;AAGtD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,YAAY,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,SAAS,CAAC;AAGtD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,YAAY,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE/C;;GAEG;AACH,MAAM,MAAM,QAAQ,GAAG,sBAAsB,CAAC,UAAU,CAAC,CAAC;AAE1D;;GAEG;AACH,eAAO,MAAM,YAAY,EAAG,SAAkB,CAAC;AAE/C;;;;;GAKG;AACH,wBAAgB,UAAU,CACxB,IAAI,EAAE,QAAQ,GAAG,IAAI,GACpB,QAAQ,GAAG,OAAO,YAAY,GAAG,KAAK,CAExC;AAED;;GAEG;AACH,wBAAgB,UAAU,IAAI,QAAQ,GAAG,OAAO,YAAY,CAE3D"}
|
package/build/index.js
CHANGED
package/build/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,aAAa,MAAM,4BAA4B,CAAC;AAEvD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,aAAa,MAAM,4BAA4B,CAAC;AAEvD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAQ1C;;GAEG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,SAAkB,CAAC;AAE/C;;;;;GAKG;AACH,MAAM,UAAU,UAAU,CACxB,IAAqB;IAErB,OAAO,aAAa,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;AACxC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,UAAU;IACxB,OAAO,aAAa,CAAC,UAAU,EAAE,CAAC;AACpC,CAAC","sourcesContent":["import type { DynamicAppIconRegistry } from \"./types\";\nimport NativeAppIcon from \"./ExpoAppIconChangerModule\";\n\nexport { useAppIcon } from \"./useAppIcon\";\nexport type { UseAppIcon } from \"./useAppIcon\";\n\n/**\n * Union of the icon keys declared in the plugin config (widened to string when none).\n */\nexport type IconName = DynamicAppIconRegistry[\"IconName\"];\n\n/**\n * Value reported / accepted for the project's default launcher icon.\n */\nexport const DEFAULT_ICON = \"DEFAULT\" as const;\n\n/**\n * Switch the launcher icon at runtime.\n *\n * @param name A configured icon key, or `null` to reset to the default icon.\n * @returns The applied icon name, `\"DEFAULT\"`, or `false` if unsupported.\n */\nexport function setAppIcon(\n name: IconName | null\n): IconName | typeof DEFAULT_ICON | false {\n return NativeAppIcon.setAppIcon(name);\n}\n\n/**\n * Get the currently active icon name, or `\"DEFAULT\"` when none is set.\n */\nexport function getAppIcon(): IconName | typeof DEFAULT_ICON {\n return NativeAppIcon.getAppIcon();\n}\n"]}
|
package/build/index.web.d.ts
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import type { DynamicAppIconRegistry } from "./types";
|
|
2
2
|
import type { UseAppIcon } from "./useAppIcon";
|
|
3
|
-
export { getAvailableIcons } from "./icons-data";
|
|
4
|
-
export type { AppIconEntry } from "./icons-data";
|
|
5
3
|
export type { UseAppIcon } from "./useAppIcon";
|
|
6
4
|
export type IconName = DynamicAppIconRegistry["IconName"];
|
|
7
5
|
export declare const DEFAULT_ICON: "DEFAULT";
|
package/build/index.web.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.web.d.ts","sourceRoot":"","sources":["../src/index.web.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,SAAS,CAAC;AACtD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE/C,
|
|
1
|
+
{"version":3,"file":"index.web.d.ts","sourceRoot":"","sources":["../src/index.web.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,SAAS,CAAC;AACtD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE/C,YAAY,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE/C,MAAM,MAAM,QAAQ,GAAG,sBAAsB,CAAC,UAAU,CAAC,CAAC;AAE1D,eAAO,MAAM,YAAY,EAAG,SAAkB,CAAC;AAE/C;;GAEG;AACH,wBAAgB,UAAU,IAAI,UAAU,CAEvC;AAED;;GAEG;AACH,wBAAgB,UAAU,CACxB,KAAK,EAAE,QAAQ,GAAG,IAAI,GACrB,QAAQ,GAAG,OAAO,YAAY,GAAG,KAAK,CAGxC;AAED;;GAEG;AACH,wBAAgB,UAAU,IAAI,QAAQ,GAAG,OAAO,YAAY,CAG3D"}
|
package/build/index.web.js
CHANGED
package/build/index.web.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.web.js","sourceRoot":"","sources":["../src/index.web.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.web.js","sourceRoot":"","sources":["../src/index.web.ts"],"names":[],"mappings":"AAOA,MAAM,CAAC,MAAM,YAAY,GAAG,SAAkB,CAAC;AAE/C;;GAEG;AACH,MAAM,UAAU,UAAU;IACxB,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,EAAE,GAAE,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,WAAW,EAAE,KAAK,EAAE,CAAC;AAChF,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,UAAU,CACxB,KAAsB;IAEtB,OAAO,CAAC,KAAK,CAAC,oCAAoC,CAAC,CAAC;IACpD,OAAO,KAAK,CAAC;AACf,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,UAAU;IACxB,OAAO,CAAC,KAAK,CAAC,oCAAoC,CAAC,CAAC;IACpD,OAAO,YAAY,CAAC;AACtB,CAAC","sourcesContent":["import type { DynamicAppIconRegistry } from \"./types\";\nimport type { UseAppIcon } from \"./useAppIcon\";\n\nexport type { UseAppIcon } from \"./useAppIcon\";\n\nexport type IconName = DynamicAppIconRegistry[\"IconName\"];\n\nexport const DEFAULT_ICON = \"DEFAULT\" as const;\n\n/**\n * Web has no launcher icon; the hook reports an unsupported, default state.\n */\nexport function useAppIcon(): UseAppIcon {\n return { icon: null, setIcon: () => {}, isDefault: true, isSupported: false };\n}\n\n/**\n * Web has no launcher icon; this is a no-op that reports failure.\n */\nexport function setAppIcon(\n _name: IconName | null\n): IconName | typeof DEFAULT_ICON | false {\n console.error(\"setAppIcon is not supported on web\");\n return false;\n}\n\n/**\n * Web has no launcher icon; always reports the default.\n */\nexport function getAppIcon(): IconName | typeof DEFAULT_ICON {\n console.error(\"getAppIcon is not supported on web\");\n return DEFAULT_ICON;\n}\n"]}
|
package/package.json
CHANGED
package/plugin/build/icons.d.ts
CHANGED
|
@@ -3,8 +3,7 @@ import type { AppleIconVariant, IconConfig, IconPluginInput, IconSet, ResolvedIc
|
|
|
3
3
|
* Coerce whatever the user placed in app config into a normalized icon map.
|
|
4
4
|
* A bare array of image paths is expanded to keyed entries that share the same
|
|
5
5
|
* image for both platforms. For the object form, the `image` convenience is
|
|
6
|
-
* expanded to `ios`/`android` (which override it)
|
|
7
|
-
* through untouched.
|
|
6
|
+
* expanded to `ios`/`android` (which override it).
|
|
8
7
|
*/
|
|
9
8
|
export declare function normalizeIconSet(input: IconPluginInput): IconSet;
|
|
10
9
|
/**
|
package/plugin/build/icons.js
CHANGED
|
@@ -15,8 +15,7 @@ const APPLE_ICON_BLUEPRINTS = [
|
|
|
15
15
|
* Coerce whatever the user placed in app config into a normalized icon map.
|
|
16
16
|
* A bare array of image paths is expanded to keyed entries that share the same
|
|
17
17
|
* image for both platforms. For the object form, the `image` convenience is
|
|
18
|
-
* expanded to `ios`/`android` (which override it)
|
|
19
|
-
* through untouched.
|
|
18
|
+
* expanded to `ios`/`android` (which override it).
|
|
20
19
|
*/
|
|
21
20
|
function normalizeIconSet(input) {
|
|
22
21
|
if (Array.isArray(input)) {
|
|
@@ -32,11 +31,10 @@ function normalizeIconSet(input) {
|
|
|
32
31
|
if (typeof value === "string") {
|
|
33
32
|
return [key, { ios: value, android: value }];
|
|
34
33
|
}
|
|
35
|
-
const { image, ios, android
|
|
34
|
+
const { image, ios, android } = value;
|
|
36
35
|
const config = {
|
|
37
36
|
ios: ios ?? image,
|
|
38
37
|
android: android ?? image,
|
|
39
|
-
...(metadata ? { metadata } : {}),
|
|
40
38
|
};
|
|
41
39
|
return [key, config];
|
|
42
40
|
}));
|
package/plugin/build/index.js
CHANGED
|
@@ -17,7 +17,7 @@ const withDynamicIcon = (config, input) => {
|
|
|
17
17
|
const icons = (0, icons_1.normalizeIconSet)(input);
|
|
18
18
|
const variants = (0, icons_1.resolveAppleVariants)(Boolean(config.ios?.supportsTablet));
|
|
19
19
|
const props = { icons, variants };
|
|
20
|
-
config =
|
|
20
|
+
config = withTypedIconNames(config, icons);
|
|
21
21
|
config = (0, apple_1.withAppleIconAssets)(config, props);
|
|
22
22
|
config = (0, apple_1.withAppleAlternateIcons)(config, props);
|
|
23
23
|
config = (0, apple_1.withAppleIconImages)(config, props);
|
|
@@ -26,15 +26,12 @@ const withDynamicIcon = (config, input) => {
|
|
|
26
26
|
return config;
|
|
27
27
|
};
|
|
28
28
|
/**
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
* `getAvailableIcons()` returns it at runtime.
|
|
34
|
-
*
|
|
35
|
-
* Both files only exist in a built package, so writes are best-effort.
|
|
29
|
+
* Rewrite the `IconName` union in the shipped `build/types.d.ts` so
|
|
30
|
+
* `getAppIcon()` / `setAppIcon()` / `useAppIcon()` are typed to the configured
|
|
31
|
+
* keys. The types file only exists in a built package, so the write is
|
|
32
|
+
* best-effort.
|
|
36
33
|
*/
|
|
37
|
-
function
|
|
34
|
+
function withTypedIconNames(config, icons) {
|
|
38
35
|
const names = Object.keys(icons);
|
|
39
36
|
const union = names.map((name) => `"${name}"`).join(" | ") || "string";
|
|
40
37
|
const typesFile = path_1.default.join(PACKAGE_ROOT, "build", "types.d.ts");
|
|
@@ -45,17 +42,6 @@ function withGeneratedIconData(config, icons) {
|
|
|
45
42
|
catch {
|
|
46
43
|
// The types file only exists in a built package; ignore when absent.
|
|
47
44
|
}
|
|
48
|
-
const iconData = names.map((name) => ({
|
|
49
|
-
name,
|
|
50
|
-
metadata: icons[name]?.metadata ?? {},
|
|
51
|
-
}));
|
|
52
|
-
const dataFile = path_1.default.join(PACKAGE_ROOT, "build", "icons-data.generated.js");
|
|
53
|
-
try {
|
|
54
|
-
fs_1.default.writeFileSync(dataFile, `export const ICON_DATA = ${JSON.stringify(iconData)};\n`);
|
|
55
|
-
}
|
|
56
|
-
catch {
|
|
57
|
-
// The build output only exists in a built package; ignore when absent.
|
|
58
|
-
}
|
|
59
45
|
return config;
|
|
60
46
|
}
|
|
61
47
|
exports.default = withDynamicIcon;
|
package/plugin/build/types.d.ts
CHANGED
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Arbitrary, JSON-serialisable metadata a consumer attaches to an icon (e.g.
|
|
3
|
-
* label, description, isPremium). Surfaced at runtime via getAvailableIcons().
|
|
4
|
-
*/
|
|
5
|
-
export type IconMetadata = Record<string, unknown>;
|
|
6
1
|
/**
|
|
7
2
|
* A normalized icon entry as used everywhere internally (the `image`
|
|
8
3
|
* convenience has been expanded to `ios`/`android`).
|
|
@@ -16,10 +11,6 @@ export type IconConfig = {
|
|
|
16
11
|
* Path to the Android source image.
|
|
17
12
|
*/
|
|
18
13
|
android?: string;
|
|
19
|
-
/**
|
|
20
|
-
* Display/behaviour metadata, passed through to runtime untouched.
|
|
21
|
-
*/
|
|
22
|
-
metadata?: IconMetadata;
|
|
23
14
|
};
|
|
24
15
|
/**
|
|
25
16
|
* Map of icon key → icon config, as used everywhere internally (always the
|
package/build/icons-data.d.ts
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import type { DynamicAppIconRegistry } from "./types";
|
|
2
|
-
type IconName = DynamicAppIconRegistry["IconName"];
|
|
3
|
-
/**
|
|
4
|
-
* One configured icon and the metadata declared for it in the plugin config.
|
|
5
|
-
*/
|
|
6
|
-
export type AppIconEntry<M = Record<string, unknown>> = {
|
|
7
|
-
/** The configured icon key. */
|
|
8
|
-
name: IconName;
|
|
9
|
-
/** Arbitrary metadata attached in app.json (label, description, isPremium, …). */
|
|
10
|
-
metadata: M;
|
|
11
|
-
};
|
|
12
|
-
/**
|
|
13
|
-
* The icons configured in app.json, with their metadata. Generic over the
|
|
14
|
-
* consumer's metadata shape, e.g.
|
|
15
|
-
* `getAvailableIcons<{ label: string; isPremium?: boolean }>()`.
|
|
16
|
-
*/
|
|
17
|
-
export declare function getAvailableIcons<M = Record<string, unknown>>(): AppIconEntry<M>[];
|
|
18
|
-
export {};
|
|
19
|
-
//# sourceMappingURL=icons-data.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"icons-data.d.ts","sourceRoot":"","sources":["../src/icons-data.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,SAAS,CAAC;AAGtD,KAAK,QAAQ,GAAG,sBAAsB,CAAC,UAAU,CAAC,CAAC;AAEnD;;GAEG;AACH,MAAM,MAAM,YAAY,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,IAAI;IACtD,+BAA+B;IAC/B,IAAI,EAAE,QAAQ,CAAC;IACf,kFAAkF;IAClF,QAAQ,EAAE,CAAC,CAAC;CACb,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,iBAAiB,CAC/B,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KACxB,YAAY,CAAC,CAAC,CAAC,EAAE,CAErB"}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { AppIconEntry } from "./icons-data";
|
|
2
|
-
/**
|
|
3
|
-
* Placeholder. The expo-app-icon config plugin overwrites this file's compiled
|
|
4
|
-
* output during prebuild with the icons + metadata declared in app.json.
|
|
5
|
-
*/
|
|
6
|
-
export declare const ICON_DATA: AppIconEntry[];
|
|
7
|
-
//# sourceMappingURL=icons-data.generated.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"icons-data.generated.d.ts","sourceRoot":"","sources":["../src/icons-data.generated.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAEjD;;;GAGG;AACH,eAAO,MAAM,SAAS,EAAE,YAAY,EAAO,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"icons-data.generated.js","sourceRoot":"","sources":["../src/icons-data.generated.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,MAAM,CAAC,MAAM,SAAS,GAAmB,EAAE,CAAC","sourcesContent":["import type { AppIconEntry } from \"./icons-data\";\n\n/**\n * Placeholder. The expo-app-icon config plugin overwrites this file's compiled\n * output during prebuild with the icons + metadata declared in app.json.\n */\nexport const ICON_DATA: AppIconEntry[] = [];\n"]}
|
package/build/icons-data.js
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { ICON_DATA } from "./icons-data.generated";
|
|
2
|
-
/**
|
|
3
|
-
* The icons configured in app.json, with their metadata. Generic over the
|
|
4
|
-
* consumer's metadata shape, e.g.
|
|
5
|
-
* `getAvailableIcons<{ label: string; isPremium?: boolean }>()`.
|
|
6
|
-
*/
|
|
7
|
-
export function getAvailableIcons() {
|
|
8
|
-
return ICON_DATA;
|
|
9
|
-
}
|
|
10
|
-
//# sourceMappingURL=icons-data.js.map
|
package/build/icons-data.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"icons-data.js","sourceRoot":"","sources":["../src/icons-data.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAcnD;;;;GAIG;AACH,MAAM,UAAU,iBAAiB;IAG/B,OAAO,SAAyC,CAAC;AACnD,CAAC","sourcesContent":["import type { DynamicAppIconRegistry } from \"./types\";\nimport { ICON_DATA } from \"./icons-data.generated\";\n\ntype IconName = DynamicAppIconRegistry[\"IconName\"];\n\n/**\n * One configured icon and the metadata declared for it in the plugin config.\n */\nexport type AppIconEntry<M = Record<string, unknown>> = {\n /** The configured icon key. */\n name: IconName;\n /** Arbitrary metadata attached in app.json (label, description, isPremium, …). */\n metadata: M;\n};\n\n/**\n * The icons configured in app.json, with their metadata. Generic over the\n * consumer's metadata shape, e.g.\n * `getAvailableIcons<{ label: string; isPremium?: boolean }>()`.\n */\nexport function getAvailableIcons<\n M = Record<string, unknown>\n>(): AppIconEntry<M>[] {\n return ICON_DATA as unknown as AppIconEntry<M>[];\n}\n"]}
|