@wikicasa-dev/svg-icons 1.3.1-alpha.3 → 1.3.1-alpha.4
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/lazy.d.ts +5 -1
- package/dist/lazy.js +7 -4
- package/package.json +1 -1
package/dist/lazy.d.ts
CHANGED
|
@@ -185,5 +185,9 @@ declare const icons: {
|
|
|
185
185
|
readonly WikiNerdAgency: () => Promise<typeof import("@svgImages/WikiNerdAgency")>;
|
|
186
186
|
};
|
|
187
187
|
type AvailableIcons = keyof typeof icons;
|
|
188
|
-
|
|
188
|
+
type ExtractIconType<K extends AvailableIcons> = (typeof icons)[K] extends () => Promise<infer T> ? T : never;
|
|
189
|
+
type ExtractNamedIconType<K extends AvailableIcons> = ExtractIconType<K> extends {
|
|
190
|
+
[P in `${K}`]: infer T;
|
|
191
|
+
} ? T : never;
|
|
192
|
+
export declare const createLazyIcon: <TIconName extends AvailableIcons>(name: TIconName, hydrateStrategy?: "idle" | "visible") => ExtractNamedIconType<TIconName>;
|
|
189
193
|
export {};
|
package/dist/lazy.js
CHANGED
|
@@ -191,10 +191,13 @@ const c = {
|
|
|
191
191
|
}, m = (o) => (
|
|
192
192
|
//@ts-expect-error extracting the default or named module
|
|
193
193
|
c[o]().then((i) => i[o] || i.default)
|
|
194
|
-
), I = (o, i = "idle") =>
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
194
|
+
), I = (o, i = "idle") => (
|
|
195
|
+
//@ts-expect-error extracting the default or named module
|
|
196
|
+
r({
|
|
197
|
+
loader: () => m(o),
|
|
198
|
+
hydrate: i === "idle" ? t() : n()
|
|
199
|
+
})
|
|
200
|
+
);
|
|
198
201
|
export {
|
|
199
202
|
I as createLazyIcon
|
|
200
203
|
};
|