@nysds/nys-icon 1.19.0 → 1.19.2
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/icons/filter_alt.svg +1 -1
- package/dist/icons/filter_list.svg +1 -1
- package/dist/icons/location_on.svg +8 -0
- package/dist/icons/manifest.json +2 -0
- package/dist/icons/schedule.svg +8 -0
- package/dist/icons/sort.svg +1 -1
- package/dist/nys-icon.js +678 -502
- package/dist/nys-icon.js.map +1 -1
- package/package.json +3 -2
- package/dist/icon-cache.d.ts +0 -11
- package/dist/icon-library-registry.d.ts +0 -47
- package/dist/index.d.ts +0 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nysds/nys-icon",
|
|
3
|
-
"version": "1.19.
|
|
3
|
+
"version": "1.19.2",
|
|
4
4
|
"description": "The Icon component from the NYS Design System.",
|
|
5
5
|
"module": "dist/nys-icon.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -36,5 +36,6 @@
|
|
|
36
36
|
"icon"
|
|
37
37
|
],
|
|
38
38
|
"author": "New York State Design System Team",
|
|
39
|
-
"license": "MIT"
|
|
39
|
+
"license": "MIT",
|
|
40
|
+
"sideEffects": true
|
|
40
41
|
}
|
package/dist/icon-cache.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Icon Cache
|
|
3
|
-
*
|
|
4
|
-
* Shared SVG fetch and parse cache. Deduplicates concurrent requests
|
|
5
|
-
* for the same icon URL. Each consumer gets a cloned SVGElement via
|
|
6
|
-
* `cloneNode(true)` so DOM nodes are never shared.
|
|
7
|
-
*/
|
|
8
|
-
/** Fetch and parse an SVG from a URL. Returns a cloned SVGElement (safe for multiple consumers). */
|
|
9
|
-
export declare function fetchIcon(url: string): Promise<SVGElement>;
|
|
10
|
-
/** Clear one or all entries from the cache. */
|
|
11
|
-
export declare function clearIconCache(url?: string): void;
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Icon Library Registry
|
|
3
|
-
*
|
|
4
|
-
* Global registry for icon libraries. The "default" library resolves
|
|
5
|
-
* NYSDS icons from colocated SVG files extracted at build time.
|
|
6
|
-
* Custom libraries (Font Awesome, Material Icons, etc.) can be
|
|
7
|
-
* registered at runtime via `registerIconLibrary()`.
|
|
8
|
-
*
|
|
9
|
-
* The registry and watcher maps are stored on `window` so that even
|
|
10
|
-
* when bundlers (Storybook Vite, etc.) create duplicate module
|
|
11
|
-
* instances, every copy shares a single source of truth.
|
|
12
|
-
*/
|
|
13
|
-
export interface IconLibrary {
|
|
14
|
-
/** Given an icon name, return the URL to its SVG file. Return undefined if not found. */
|
|
15
|
-
resolver: (name: string) => string | undefined;
|
|
16
|
-
/** Optional post-fetch transform applied to the parsed SVGElement. */
|
|
17
|
-
mutator?: (svg: SVGElement) => void;
|
|
18
|
-
}
|
|
19
|
-
export interface NysIconWatcher {
|
|
20
|
-
redraw(): void;
|
|
21
|
-
}
|
|
22
|
-
interface NysIconGlobals {
|
|
23
|
-
__nysIconRegistry: Map<string, IconLibrary>;
|
|
24
|
-
__nysIconWatchers: Map<string, Set<NysIconWatcher>>;
|
|
25
|
-
}
|
|
26
|
-
declare global {
|
|
27
|
-
interface Window extends NysIconGlobals {
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
/** Register or replace a named icon library. All watching icons using this library will redraw.
|
|
31
|
-
* @example Register a Font Awesome library with a custom resolver:
|
|
32
|
-
* ```ts
|
|
33
|
-
* registerIconLibrary("fa", {
|
|
34
|
-
* resolver: (name) => `https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/svg/${name}.svg`
|
|
35
|
-
* });
|
|
36
|
-
* ```
|
|
37
|
-
*/
|
|
38
|
-
export declare function registerIconLibrary(name: string, library: IconLibrary): void;
|
|
39
|
-
/** Remove a registered icon library. All watching icons using this library will redraw. */
|
|
40
|
-
export declare function unregisterIconLibrary(name: string): void;
|
|
41
|
-
/** Get a registered icon library by name. */
|
|
42
|
-
export declare function getIconLibrary(name: string): IconLibrary | undefined;
|
|
43
|
-
/** Subscribe an icon instance to library change notifications. */
|
|
44
|
-
export declare function watchIconLibrary(name: string, watcher: NysIconWatcher): void;
|
|
45
|
-
/** Unsubscribe an icon instance from library change notifications. */
|
|
46
|
-
export declare function unwatchIconLibrary(name: string, watcher: NysIconWatcher): void;
|
|
47
|
-
export {};
|
package/dist/index.d.ts
DELETED