@fluentui/react-icons-compat 0.1.3 → 0.1.5
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/CHANGELOG.md +27 -2
- package/lib/GlobalSettings.js.map +1 -1
- package/lib/getWindow.js.map +1 -1
- package/lib/icon.js.map +1 -1
- package/lib/index.js.map +1 -1
- package/lib-commonjs/GlobalSettings.js.map +1 -1
- package/lib-commonjs/getWindow.js.map +1 -1
- package/lib-commonjs/icon.js +2 -1
- package/lib-commonjs/icon.js.map +1 -1
- package/lib-commonjs/index.js.map +1 -1
- package/package.json +6 -17
package/CHANGELOG.md
CHANGED
|
@@ -1,12 +1,37 @@
|
|
|
1
1
|
# Change Log - @fluentui/react-icons-compat
|
|
2
2
|
|
|
3
|
-
This log was last generated on
|
|
3
|
+
This log was last generated on Fri, 06 Dec 2024 12:49:19 GMT and should not be manually modified.
|
|
4
4
|
|
|
5
5
|
<!-- Start content -->
|
|
6
6
|
|
|
7
|
+
## [0.1.5](https://github.com/microsoft/fluentui/tree/@fluentui/react-icons-compat_v0.1.5)
|
|
8
|
+
|
|
9
|
+
Fri, 06 Dec 2024 12:49:19 GMT
|
|
10
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-icons-compat_v0.1.4..@fluentui/react-icons-compat_v0.1.5)
|
|
11
|
+
|
|
12
|
+
### Patches
|
|
13
|
+
|
|
14
|
+
- Bump @fluentui/react-jsx-runtime to v9.0.47 ([PR #33414](https://github.com/microsoft/fluentui/pull/33414) by beachball)
|
|
15
|
+
- Bump @fluentui/react-shared-contexts to v9.21.1 ([PR #33414](https://github.com/microsoft/fluentui/pull/33414) by beachball)
|
|
16
|
+
- Bump @fluentui/react-theme to v9.1.23 ([PR #33414](https://github.com/microsoft/fluentui/pull/33414) by beachball)
|
|
17
|
+
- Bump @fluentui/react-utilities to v9.18.18 ([PR #33414](https://github.com/microsoft/fluentui/pull/33414) by beachball)
|
|
18
|
+
|
|
19
|
+
## [0.1.4](https://github.com/microsoft/fluentui/tree/@fluentui/react-icons-compat_v0.1.4)
|
|
20
|
+
|
|
21
|
+
Mon, 11 Nov 2024 10:00:40 GMT
|
|
22
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-icons-compat_v0.1.3..@fluentui/react-icons-compat_v0.1.4)
|
|
23
|
+
|
|
24
|
+
### Patches
|
|
25
|
+
|
|
26
|
+
- chore: replace npm-scripts and just-scrtips with nx inferred tasks ([PR #33074](https://github.com/microsoft/fluentui/pull/33074) by martinhochel@microsoft.com)
|
|
27
|
+
- Bump @fluentui/react-jsx-runtime to v9.0.46 ([PR #33238](https://github.com/microsoft/fluentui/pull/33238) by beachball)
|
|
28
|
+
- Bump @fluentui/react-shared-contexts to v9.21.0 ([PR #33238](https://github.com/microsoft/fluentui/pull/33238) by beachball)
|
|
29
|
+
- Bump @fluentui/react-theme to v9.1.22 ([PR #33238](https://github.com/microsoft/fluentui/pull/33238) by beachball)
|
|
30
|
+
- Bump @fluentui/react-utilities to v9.18.17 ([PR #33238](https://github.com/microsoft/fluentui/pull/33238) by beachball)
|
|
31
|
+
|
|
7
32
|
## [0.1.3](https://github.com/microsoft/fluentui/tree/@fluentui/react-icons-compat_v0.1.3)
|
|
8
33
|
|
|
9
|
-
Tue, 15 Oct 2024 17:
|
|
34
|
+
Tue, 15 Oct 2024 17:17:53 GMT
|
|
10
35
|
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-icons-compat_v0.1.2..@fluentui/react-icons-compat_v0.1.3)
|
|
11
36
|
|
|
12
37
|
### Patches
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["GlobalSettings.ts"],"sourcesContent":["import { getWindow } from './getWindow';\n\n/**\n * Storing global state in local module variables has issues when more than one copy\n * of the module gets loaded on the page (due to a bundling error or simply by consuming\n * a prebundled script.)\n *\n * This file contains helpers to deal with the getting and setting local state, and allows\n * callers to get called back when it mutates.\n */\n\nconst GLOBAL_SETTINGS_PROP_NAME = '__globalSettings__';\nconst CALLBACK_STATE_PROP_NAME = '__callbacks__';\n\nlet _counter = 0;\n\n/**\n * Change description used for change callbacks in GlobalSettings.\n *\n * @public\n */\nexport interface ChangeDescription {\n key: string;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n oldValue: any;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n value: any;\n}\n\n/**\n * Change event callback.\n *\n * @public\n */\nexport interface ChangeEventCallback {\n __id__?: string;\n (changeDescription?: ChangeDescription): void;\n}\n\n/**\n * Global settings helper, which stores settings in the global (window) namespace.\n * If window is not provided, it will store settings in module scope. Provides a\n * way to observe changes as well when their values change.\n *\n * @public\n */\nexport class GlobalSettings {\n public static getValue<T>(key: string, defaultValue?: T | (() => T)): T {\n const globalSettings = _getGlobalSettings();\n\n if (globalSettings[key] === undefined) {\n globalSettings[key] = typeof defaultValue === 'function' ? (defaultValue as Function)() : defaultValue;\n }\n\n return globalSettings[key];\n }\n\n public static setValue<T>(key: string, value: T): T {\n const globalSettings = _getGlobalSettings();\n const callbacks = globalSettings[CALLBACK_STATE_PROP_NAME];\n const oldValue = globalSettings[key];\n\n if (value !== oldValue) {\n globalSettings[key] = value;\n\n const changeDescription = {\n oldValue,\n value,\n key,\n };\n\n for (const id in callbacks) {\n if (callbacks.hasOwnProperty(id)) {\n callbacks[id](changeDescription);\n }\n }\n }\n\n return value;\n }\n\n public static addChangeListener(cb: ChangeEventCallback): void {\n // Note: we use generated ids on the callbacks to create a map of the callbacks, which optimizes removal.\n // (It's faster to delete a key than it is to look up the index of an object and splice an array.)\n let id = cb.__id__;\n const callbacks = _getCallbacks();\n\n if (!id) {\n id = cb.__id__ = String(_counter++);\n }\n\n callbacks[id] = cb;\n }\n\n public static removeChangeListener(cb: ChangeEventCallback): void {\n const callbacks = _getCallbacks();\n delete callbacks[cb.__id__ as string];\n }\n}\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nfunction _getGlobalSettings(): { [key: string]: any } {\n const win = getWindow();\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const globalObj: { [key: string]: any } = win || {};\n\n if (!globalObj[GLOBAL_SETTINGS_PROP_NAME]) {\n globalObj[GLOBAL_SETTINGS_PROP_NAME] = {\n [CALLBACK_STATE_PROP_NAME]: {},\n };\n }\n\n return globalObj[GLOBAL_SETTINGS_PROP_NAME];\n}\n\nfunction _getCallbacks(): { [key: string]: () => void } {\n const globalSettings = _getGlobalSettings();\n return globalSettings[CALLBACK_STATE_PROP_NAME];\n}\n"],"names":["getWindow","GLOBAL_SETTINGS_PROP_NAME","CALLBACK_STATE_PROP_NAME","_counter","GlobalSettings","getValue","key","defaultValue","globalSettings","_getGlobalSettings","undefined","setValue","value","callbacks","oldValue","changeDescription","id","hasOwnProperty","addChangeListener","cb","__id__","_getCallbacks","String","removeChangeListener","win","globalObj"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,SAASA,SAAS,QAAQ,cAAc;AAExC;;;;;;;CAOC,GAED,MAAMC,4BAA4B;AAClC,MAAMC,2BAA2B;AAEjC,IAAIC,WAAW;AAyBf;;;;;;CAMC,GACD,OAAO,MAAMC;IACX,OAAcC,SAAYC,GAAW,EAAEC,YAA4B,EAAK;QACtE,MAAMC,iBAAiBC;QAEvB,IAAID,cAAc,CAACF,IAAI,KAAKI,WAAW;YACrCF,cAAc,CAACF,IAAI,GAAG,OAAOC,iBAAiB,aAAa,AAACA,iBAA8BA;QAC5F;QAEA,OAAOC,cAAc,CAACF,IAAI;IAC5B;IAEA,OAAcK,SAAYL,GAAW,EAAEM,KAAQ,EAAK;QAClD,MAAMJ,iBAAiBC;QACvB,MAAMI,YAAYL,cAAc,CAACN,yBAAyB;QAC1D,MAAMY,WAAWN,cAAc,CAACF,IAAI;QAEpC,IAAIM,UAAUE,UAAU;YACtBN,cAAc,CAACF,IAAI,GAAGM;YAEtB,MAAMG,oBAAoB;gBACxBD;gBACAF;gBACAN;YACF;YAEA,IAAK,MAAMU,MAAMH,UAAW;gBAC1B,IAAIA,UAAUI,cAAc,CAACD,KAAK;oBAChCH,SAAS,CAACG,GAAG,CAACD;gBAChB;YACF;QACF;QAEA,OAAOH;IACT;IAEA,OAAcM,kBAAkBC,EAAuB,EAAQ;QAC7D,yGAAyG;QACzG,kGAAkG;QAClG,IAAIH,KAAKG,GAAGC,MAAM;QAClB,MAAMP,YAAYQ;QAElB,IAAI,CAACL,IAAI;YACPA,KAAKG,GAAGC,MAAM,GAAGE,OAAOnB;QAC1B;QAEAU,SAAS,CAACG,GAAG,GAAGG;IAClB;IAEA,OAAcI,qBAAqBJ,EAAuB,EAAQ;QAChE,MAAMN,YAAYQ;QAClB,OAAOR,SAAS,CAACM,GAAGC,MAAM,CAAW;IACvC;AACF;AAEA,8DAA8D;AAC9D,SAASX;IACP,MAAMe,MAAMxB;IACZ,8DAA8D;IAC9D,MAAMyB,YAAoCD,OAAO,CAAC;IAElD,IAAI,CAACC,SAAS,CAACxB,0BAA0B,EAAE;QACzCwB,SAAS,CAACxB,0BAA0B,GAAG;YACrC,CAACC,yBAAyB,EAAE,CAAC;QAC/B;IACF;IAEA,OAAOuB,SAAS,CAACxB,0BAA0B;AAC7C;AAEA,SAASoB;IACP,MAAMb,iBAAiBC;IACvB,OAAOD,cAAc,CAACN,yBAAyB;AACjD"}
|
|
1
|
+
{"version":3,"sources":["../src/GlobalSettings.ts"],"sourcesContent":["import { getWindow } from './getWindow';\n\n/**\n * Storing global state in local module variables has issues when more than one copy\n * of the module gets loaded on the page (due to a bundling error or simply by consuming\n * a prebundled script.)\n *\n * This file contains helpers to deal with the getting and setting local state, and allows\n * callers to get called back when it mutates.\n */\n\nconst GLOBAL_SETTINGS_PROP_NAME = '__globalSettings__';\nconst CALLBACK_STATE_PROP_NAME = '__callbacks__';\n\nlet _counter = 0;\n\n/**\n * Change description used for change callbacks in GlobalSettings.\n *\n * @public\n */\nexport interface ChangeDescription {\n key: string;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n oldValue: any;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n value: any;\n}\n\n/**\n * Change event callback.\n *\n * @public\n */\nexport interface ChangeEventCallback {\n __id__?: string;\n (changeDescription?: ChangeDescription): void;\n}\n\n/**\n * Global settings helper, which stores settings in the global (window) namespace.\n * If window is not provided, it will store settings in module scope. Provides a\n * way to observe changes as well when their values change.\n *\n * @public\n */\nexport class GlobalSettings {\n public static getValue<T>(key: string, defaultValue?: T | (() => T)): T {\n const globalSettings = _getGlobalSettings();\n\n if (globalSettings[key] === undefined) {\n globalSettings[key] = typeof defaultValue === 'function' ? (defaultValue as Function)() : defaultValue;\n }\n\n return globalSettings[key];\n }\n\n public static setValue<T>(key: string, value: T): T {\n const globalSettings = _getGlobalSettings();\n const callbacks = globalSettings[CALLBACK_STATE_PROP_NAME];\n const oldValue = globalSettings[key];\n\n if (value !== oldValue) {\n globalSettings[key] = value;\n\n const changeDescription = {\n oldValue,\n value,\n key,\n };\n\n for (const id in callbacks) {\n if (callbacks.hasOwnProperty(id)) {\n callbacks[id](changeDescription);\n }\n }\n }\n\n return value;\n }\n\n public static addChangeListener(cb: ChangeEventCallback): void {\n // Note: we use generated ids on the callbacks to create a map of the callbacks, which optimizes removal.\n // (It's faster to delete a key than it is to look up the index of an object and splice an array.)\n let id = cb.__id__;\n const callbacks = _getCallbacks();\n\n if (!id) {\n id = cb.__id__ = String(_counter++);\n }\n\n callbacks[id] = cb;\n }\n\n public static removeChangeListener(cb: ChangeEventCallback): void {\n const callbacks = _getCallbacks();\n delete callbacks[cb.__id__ as string];\n }\n}\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nfunction _getGlobalSettings(): { [key: string]: any } {\n const win = getWindow();\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const globalObj: { [key: string]: any } = win || {};\n\n if (!globalObj[GLOBAL_SETTINGS_PROP_NAME]) {\n globalObj[GLOBAL_SETTINGS_PROP_NAME] = {\n [CALLBACK_STATE_PROP_NAME]: {},\n };\n }\n\n return globalObj[GLOBAL_SETTINGS_PROP_NAME];\n}\n\nfunction _getCallbacks(): { [key: string]: () => void } {\n const globalSettings = _getGlobalSettings();\n return globalSettings[CALLBACK_STATE_PROP_NAME];\n}\n"],"names":["getWindow","GLOBAL_SETTINGS_PROP_NAME","CALLBACK_STATE_PROP_NAME","_counter","GlobalSettings","getValue","key","defaultValue","globalSettings","_getGlobalSettings","undefined","setValue","value","callbacks","oldValue","changeDescription","id","hasOwnProperty","addChangeListener","cb","__id__","_getCallbacks","String","removeChangeListener","win","globalObj"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,SAASA,SAAS,QAAQ,cAAc;AAExC;;;;;;;CAOC,GAED,MAAMC,4BAA4B;AAClC,MAAMC,2BAA2B;AAEjC,IAAIC,WAAW;AAyBf;;;;;;CAMC,GACD,OAAO,MAAMC;IACX,OAAcC,SAAYC,GAAW,EAAEC,YAA4B,EAAK;QACtE,MAAMC,iBAAiBC;QAEvB,IAAID,cAAc,CAACF,IAAI,KAAKI,WAAW;YACrCF,cAAc,CAACF,IAAI,GAAG,OAAOC,iBAAiB,aAAa,AAACA,iBAA8BA;QAC5F;QAEA,OAAOC,cAAc,CAACF,IAAI;IAC5B;IAEA,OAAcK,SAAYL,GAAW,EAAEM,KAAQ,EAAK;QAClD,MAAMJ,iBAAiBC;QACvB,MAAMI,YAAYL,cAAc,CAACN,yBAAyB;QAC1D,MAAMY,WAAWN,cAAc,CAACF,IAAI;QAEpC,IAAIM,UAAUE,UAAU;YACtBN,cAAc,CAACF,IAAI,GAAGM;YAEtB,MAAMG,oBAAoB;gBACxBD;gBACAF;gBACAN;YACF;YAEA,IAAK,MAAMU,MAAMH,UAAW;gBAC1B,IAAIA,UAAUI,cAAc,CAACD,KAAK;oBAChCH,SAAS,CAACG,GAAG,CAACD;gBAChB;YACF;QACF;QAEA,OAAOH;IACT;IAEA,OAAcM,kBAAkBC,EAAuB,EAAQ;QAC7D,yGAAyG;QACzG,kGAAkG;QAClG,IAAIH,KAAKG,GAAGC,MAAM;QAClB,MAAMP,YAAYQ;QAElB,IAAI,CAACL,IAAI;YACPA,KAAKG,GAAGC,MAAM,GAAGE,OAAOnB;QAC1B;QAEAU,SAAS,CAACG,GAAG,GAAGG;IAClB;IAEA,OAAcI,qBAAqBJ,EAAuB,EAAQ;QAChE,MAAMN,YAAYQ;QAClB,OAAOR,SAAS,CAACM,GAAGC,MAAM,CAAW;IACvC;AACF;AAEA,8DAA8D;AAC9D,SAASX;IACP,MAAMe,MAAMxB;IACZ,8DAA8D;IAC9D,MAAMyB,YAAoCD,OAAO,CAAC;IAElD,IAAI,CAACC,SAAS,CAACxB,0BAA0B,EAAE;QACzCwB,SAAS,CAACxB,0BAA0B,GAAG;YACrC,CAACC,yBAAyB,EAAE,CAAC;QAC/B;IACF;IAEA,OAAOuB,SAAS,CAACxB,0BAA0B;AAC7C;AAEA,SAASoB;IACP,MAAMb,iBAAiBC;IACvB,OAAOD,cAAc,CAACN,yBAAyB;AACjD"}
|
package/lib/getWindow.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["getWindow.ts"],"sourcesContent":["import { canUseDOM } from '@fluentui/react-utilities';\n\nlet _window: Window | undefined = undefined;\n\n// Note: Accessing \"window\" in IE11 is somewhat expensive, and calling \"typeof window\"\n// hits a memory leak, whereas aliasing it and calling \"typeof _window\" does not.\n// Caching the window value at the file scope lets us minimize the impact.\ntry {\n // eslint-disable-next-line @nx/workspace-no-restricted-globals\n _window = window;\n} catch (e) {\n /* no-op */\n}\n\n/**\n * Helper to get the window object. The helper will make sure to use a cached variable\n * of \"window\", to avoid overhead and memory leaks in IE11. Note that in popup scenarios the\n * window object won't match the \"global\" window object, and for these scenarios, you should\n * pass in an element hosted within the popup.\n *\n * @public\n */\nexport function getWindow(rootElement?: Element | null): Window | undefined {\n if (!canUseDOM() || typeof _window === 'undefined') {\n return undefined;\n } else {\n const el = rootElement as Element;\n\n return el && el.ownerDocument && el.ownerDocument.defaultView ? el.ownerDocument.defaultView : _window;\n }\n}\n"],"names":["canUseDOM","_window","undefined","window","e","getWindow","rootElement","el","ownerDocument","defaultView"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,SAASA,SAAS,QAAQ,4BAA4B;AAEtD,IAAIC,UAA8BC;AAElC,sFAAsF;AACtF,iFAAiF;AACjF,0EAA0E;AAC1E,IAAI;IACF,+DAA+D;IAC/DD,UAAUE;AACZ,EAAE,OAAOC,GAAG;AACV,SAAS,GACX;AAEA;;;;;;;CAOC,GACD,OAAO,SAASC,UAAUC,WAA4B;IACpD,IAAI,CAACN,eAAe,OAAOC,YAAY,aAAa;QAClD,OAAOC;IACT,OAAO;QACL,MAAMK,KAAKD;QAEX,OAAOC,MAAMA,GAAGC,aAAa,IAAID,GAAGC,aAAa,CAACC,WAAW,GAAGF,GAAGC,aAAa,CAACC,WAAW,GAAGR;IACjG;AACF"}
|
|
1
|
+
{"version":3,"sources":["../src/getWindow.ts"],"sourcesContent":["import { canUseDOM } from '@fluentui/react-utilities';\n\nlet _window: Window | undefined = undefined;\n\n// Note: Accessing \"window\" in IE11 is somewhat expensive, and calling \"typeof window\"\n// hits a memory leak, whereas aliasing it and calling \"typeof _window\" does not.\n// Caching the window value at the file scope lets us minimize the impact.\ntry {\n // eslint-disable-next-line @nx/workspace-no-restricted-globals\n _window = window;\n} catch (e) {\n /* no-op */\n}\n\n/**\n * Helper to get the window object. The helper will make sure to use a cached variable\n * of \"window\", to avoid overhead and memory leaks in IE11. Note that in popup scenarios the\n * window object won't match the \"global\" window object, and for these scenarios, you should\n * pass in an element hosted within the popup.\n *\n * @public\n */\nexport function getWindow(rootElement?: Element | null): Window | undefined {\n if (!canUseDOM() || typeof _window === 'undefined') {\n return undefined;\n } else {\n const el = rootElement as Element;\n\n return el && el.ownerDocument && el.ownerDocument.defaultView ? el.ownerDocument.defaultView : _window;\n }\n}\n"],"names":["canUseDOM","_window","undefined","window","e","getWindow","rootElement","el","ownerDocument","defaultView"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,SAASA,SAAS,QAAQ,4BAA4B;AAEtD,IAAIC,UAA8BC;AAElC,sFAAsF;AACtF,iFAAiF;AACjF,0EAA0E;AAC1E,IAAI;IACF,+DAA+D;IAC/DD,UAAUE;AACZ,EAAE,OAAOC,GAAG;AACV,SAAS,GACX;AAEA;;;;;;;CAOC,GACD,OAAO,SAASC,UAAUC,WAA4B;IACpD,IAAI,CAACN,eAAe,OAAOC,YAAY,aAAa;QAClD,OAAOC;IACT,OAAO;QACL,MAAMK,KAAKD;QAEX,OAAOC,MAAMA,GAAGC,aAAa,IAAID,GAAGC,aAAa,CAACC,WAAW,GAAGF,GAAGC,aAAa,CAACC,WAAW,GAAGR;IACjG;AACF"}
|
package/lib/icon.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["icon.ts"],"sourcesContent":["import * as React from 'react';\nimport { GlobalSettings } from './GlobalSettings';\n\nexport type T = React.ReactNode;\n\nexport interface IconSubset {\n icons: {\n [key: string]: string | JSX.Element;\n };\n /**\n * Indicates to the icon renderer that it is safe to merge any props on the original `Icon` element\n * onto the child content element registered for the icon which are valid for HTML images.\n */\n mergeImageProps?: boolean;\n}\n\nexport interface IconSubsetRecord extends IconSubset {\n isRegistered?: boolean;\n className?: string;\n}\n\nexport interface IconRecord {\n code: string | undefined;\n subset: IconSubsetRecord;\n}\n\nexport interface IconOptions {\n /**\n * By default, registering the same set of icons will generate a console warning per duplicate icon\n * registered, because this scenario can create unexpected consequences.\n *\n * Some scenarios include:\n *\n * Icon set was previously registered using a different base url.\n * Icon set was previously registered but a different version was provided.\n * Icons in a previous registered set overlap with a new set.\n *\n * To simply ignore previously registered icons, you can specify to disable warnings. This means\n * that if an icon which was previous registered is registered again, it will be silently ignored.\n * However, consider whether the problems listed above will cause issues.\n **/\n disableWarnings: boolean;\n\n /**\n * @deprecated Use `disableWarnings` instead.\n */\n warnOnMissingIcons?: boolean;\n}\n\nexport interface IconRecords {\n __options: IconOptions;\n __remapped: { [key: string]: string };\n [key: string]: IconRecord | {};\n}\n\nconst ICON_SETTING_NAME = 'icons';\n\nconst _iconSettings = GlobalSettings.getValue<IconRecords>(ICON_SETTING_NAME, {\n __options: {\n disableWarnings: false,\n warnOnMissingIcons: true,\n },\n __remapped: {},\n});\n\n/**\n * Normalizes an icon name for consistent mapping.\n * Current implementation is to convert the icon name to lower case.\n *\n * @param name - Icon name to normalize.\n * @returns {string} Normalized icon name to use for indexing and mapping.\n */\nconst normalizeIconName = (name: string): string => name.toLowerCase();\n\n/**\n * Registers a given subset of icons.\n *\n * @param iconSubset - the icon subset definition.\n */\nexport function registerIcons(iconSubset: IconSubset, options?: Partial<IconOptions>): void {\n const subset = {\n ...iconSubset,\n isRegistered: false,\n className: undefined,\n };\n const { icons } = iconSubset;\n\n // Grab options, optionally mix user provided ones on top.\n options = options ? { ..._iconSettings.__options, ...options } : _iconSettings.__options;\n\n for (const iconName in icons) {\n if (icons.hasOwnProperty(iconName)) {\n const code = icons[iconName];\n const normalizedIconName = normalizeIconName(iconName);\n\n if (_iconSettings[normalizedIconName]) {\n _warnDuplicateIcon(iconName);\n } else {\n _iconSettings[normalizedIconName] = {\n code,\n subset,\n } as IconRecord;\n }\n }\n }\n}\n\n/**\n * Unregisters icons by name.\n *\n * @param iconNames - List of icons to unregister.\n */\nexport function unregisterIcons(iconNames: string[]): void {\n const options = _iconSettings.__options;\n\n for (const iconName of iconNames) {\n const normalizedIconName = normalizeIconName(iconName);\n if (_iconSettings[normalizedIconName]) {\n delete _iconSettings[normalizedIconName];\n } else {\n // Warn that we are trying to delete an icon that doesn't exist\n if (!options.disableWarnings) {\n // eslint-disable-next-line no-console\n console.warn(`The icon \"${iconName}\" tried to unregister but was not registered.`);\n }\n }\n\n // Delete any aliases for this iconName\n if (_iconSettings.__remapped[normalizedIconName]) {\n delete _iconSettings.__remapped[normalizedIconName];\n }\n\n // Delete any items that were an alias for this iconName\n Object.keys(_iconSettings.__remapped).forEach((key: string) => {\n if (_iconSettings.__remapped[key] === normalizedIconName) {\n delete _iconSettings.__remapped[key];\n }\n });\n }\n}\n\n/**\n * Remaps one icon name to another.\n */\nexport function registerIconAlias(iconName: string, mappedToName: string): void {\n _iconSettings.__remapped[normalizeIconName(iconName)] = normalizeIconName(mappedToName);\n}\n\n/**\n * Gets an icon definition. If an icon is requested but the subset has yet to be registered,\n * it will get registered immediately.\n *\n * @public\n * @param name - Name of icon.\n */\nexport function getIcon(name?: string): IconRecord | undefined {\n let icon: IconRecord | undefined = undefined;\n const options = _iconSettings.__options;\n\n name = name ? normalizeIconName(name) : '';\n name = _iconSettings.__remapped[name] || name;\n\n if (name) {\n icon = _iconSettings[name!] as IconRecord;\n\n if (icon) {\n const { subset } = icon;\n if (subset) {\n if (!subset.isRegistered) {\n subset.isRegistered = true;\n }\n }\n } else {\n // eslint-disable-next-line deprecation/deprecation\n if (!options.disableWarnings && options.warnOnMissingIcons) {\n // eslint-disable-next-line no-console\n console.warn(\n `The icon \"${name}\" was used but not registered. See https://github.com/microsoft/fluentui/wiki/Using-icons for more information.`,\n );\n }\n }\n }\n\n return icon;\n}\n\n/**\n * Sets the icon options.\n *\n * @public\n */\nexport function setIconOptions(options: Partial<IconOptions>): void {\n _iconSettings.__options = {\n ..._iconSettings.__options,\n ...options,\n };\n}\n\nlet _missingIcons: string[] = [];\n// TODO: exclude types from this lint rule: https://github.com/microsoft/fluentui/issues/31286\nlet _missingIconsTimer: ReturnType<typeof setTimeout> | undefined = undefined;\n\nfunction _warnDuplicateIcon(iconName: string): void {\n const options = _iconSettings.__options;\n const warningDelay = 2000;\n const maxIconsInMessage = 10;\n\n if (!options.disableWarnings) {\n _missingIcons.push(iconName);\n if (_missingIconsTimer === undefined) {\n _missingIconsTimer =\n // eslint-disable-next-line @nx/workspace-no-restricted-globals\n setTimeout(() => {\n // eslint-disable-next-line no-console\n console.warn(\n `Some icons were re-registered. Applications should only call registerIcons for any given ` +\n `icon once. Redefining what an icon is may have unintended consequences. Duplicates ` +\n `include: \\n` +\n _missingIcons.slice(0, maxIconsInMessage).join(', ') +\n (_missingIcons.length > maxIconsInMessage ? ` (+ ${_missingIcons.length - maxIconsInMessage} more)` : ''),\n );\n _missingIconsTimer = undefined;\n _missingIcons = [];\n }, warningDelay);\n }\n }\n}\n"],"names":["React","GlobalSettings","ICON_SETTING_NAME","_iconSettings","getValue","__options","disableWarnings","warnOnMissingIcons","__remapped","normalizeIconName","name","toLowerCase","registerIcons","iconSubset","options","subset","isRegistered","className","undefined","icons","iconName","hasOwnProperty","code","normalizedIconName","_warnDuplicateIcon","unregisterIcons","iconNames","console","warn","Object","keys","forEach","key","registerIconAlias","mappedToName","getIcon","icon","setIconOptions","_missingIcons","_missingIconsTimer","warningDelay","maxIconsInMessage","push","setTimeout","slice","join","length"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,cAAc,QAAQ,mBAAmB;AAsDlD,MAAMC,oBAAoB;AAE1B,MAAMC,gBAAgBF,eAAeG,QAAQ,CAAcF,mBAAmB;IAC5EG,WAAW;QACTC,iBAAiB;QACjBC,oBAAoB;IACtB;IACAC,YAAY,CAAC;AACf;AAEA;;;;;;CAMC,GACD,MAAMC,oBAAoB,CAACC,OAAyBA,KAAKC,WAAW;AAEpE;;;;CAIC,GACD,OAAO,SAASC,cAAcC,UAAsB,EAAEC,OAA8B;IAClF,MAAMC,SAAS;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AC,GACrF,CAAC,WAAW,CAAC,GACbU,cAAcM,KAAK,CAAC,GAAGH,mBAAmBI,IAAI,CAAC,QAC9CP,CAAAA,cAAcQ,MAAM,GAAGL,oBAAoB,CAAC,IAAI,EAAEH,cAAcQ,MAAM,GAAGL,kBAAkB,MAAM,CAAC,GAAG,EAAC;gBAE3GF,qBAAqBrB;gBACrBoB,gBAAgB,EAAE;YACpB,GAAGE;QACP;IACF;AACF"}
|
|
1
|
+
{"version":3,"sources":["../src/icon.ts"],"sourcesContent":["import * as React from 'react';\nimport { GlobalSettings } from './GlobalSettings';\n\nexport type T = React.ReactNode;\n\nexport interface IconSubset {\n icons: {\n [key: string]: string | JSX.Element;\n };\n /**\n * Indicates to the icon renderer that it is safe to merge any props on the original `Icon` element\n * onto the child content element registered for the icon which are valid for HTML images.\n */\n mergeImageProps?: boolean;\n}\n\nexport interface IconSubsetRecord extends IconSubset {\n isRegistered?: boolean;\n className?: string;\n}\n\nexport interface IconRecord {\n code: string | undefined;\n subset: IconSubsetRecord;\n}\n\nexport interface IconOptions {\n /**\n * By default, registering the same set of icons will generate a console warning per duplicate icon\n * registered, because this scenario can create unexpected consequences.\n *\n * Some scenarios include:\n *\n * Icon set was previously registered using a different base url.\n * Icon set was previously registered but a different version was provided.\n * Icons in a previous registered set overlap with a new set.\n *\n * To simply ignore previously registered icons, you can specify to disable warnings. This means\n * that if an icon which was previous registered is registered again, it will be silently ignored.\n * However, consider whether the problems listed above will cause issues.\n **/\n disableWarnings: boolean;\n\n /**\n * @deprecated Use `disableWarnings` instead.\n */\n warnOnMissingIcons?: boolean;\n}\n\nexport interface IconRecords {\n __options: IconOptions;\n __remapped: { [key: string]: string };\n [key: string]: IconRecord | {};\n}\n\nconst ICON_SETTING_NAME = 'icons';\n\nconst _iconSettings = GlobalSettings.getValue<IconRecords>(ICON_SETTING_NAME, {\n __options: {\n disableWarnings: false,\n warnOnMissingIcons: true,\n },\n __remapped: {},\n});\n\n/**\n * Normalizes an icon name for consistent mapping.\n * Current implementation is to convert the icon name to lower case.\n *\n * @param name - Icon name to normalize.\n * @returns {string} Normalized icon name to use for indexing and mapping.\n */\nconst normalizeIconName = (name: string): string => name.toLowerCase();\n\n/**\n * Registers a given subset of icons.\n *\n * @param iconSubset - the icon subset definition.\n */\nexport function registerIcons(iconSubset: IconSubset, options?: Partial<IconOptions>): void {\n const subset = {\n ...iconSubset,\n isRegistered: false,\n className: undefined,\n };\n const { icons } = iconSubset;\n\n // Grab options, optionally mix user provided ones on top.\n options = options ? { ..._iconSettings.__options, ...options } : _iconSettings.__options;\n\n for (const iconName in icons) {\n if (icons.hasOwnProperty(iconName)) {\n const code = icons[iconName];\n const normalizedIconName = normalizeIconName(iconName);\n\n if (_iconSettings[normalizedIconName]) {\n _warnDuplicateIcon(iconName);\n } else {\n _iconSettings[normalizedIconName] = {\n code,\n subset,\n } as IconRecord;\n }\n }\n }\n}\n\n/**\n * Unregisters icons by name.\n *\n * @param iconNames - List of icons to unregister.\n */\nexport function unregisterIcons(iconNames: string[]): void {\n const options = _iconSettings.__options;\n\n for (const iconName of iconNames) {\n const normalizedIconName = normalizeIconName(iconName);\n if (_iconSettings[normalizedIconName]) {\n delete _iconSettings[normalizedIconName];\n } else {\n // Warn that we are trying to delete an icon that doesn't exist\n if (!options.disableWarnings) {\n // eslint-disable-next-line no-console\n console.warn(`The icon \"${iconName}\" tried to unregister but was not registered.`);\n }\n }\n\n // Delete any aliases for this iconName\n if (_iconSettings.__remapped[normalizedIconName]) {\n delete _iconSettings.__remapped[normalizedIconName];\n }\n\n // Delete any items that were an alias for this iconName\n Object.keys(_iconSettings.__remapped).forEach((key: string) => {\n if (_iconSettings.__remapped[key] === normalizedIconName) {\n delete _iconSettings.__remapped[key];\n }\n });\n }\n}\n\n/**\n * Remaps one icon name to another.\n */\nexport function registerIconAlias(iconName: string, mappedToName: string): void {\n _iconSettings.__remapped[normalizeIconName(iconName)] = normalizeIconName(mappedToName);\n}\n\n/**\n * Gets an icon definition. If an icon is requested but the subset has yet to be registered,\n * it will get registered immediately.\n *\n * @public\n * @param name - Name of icon.\n */\nexport function getIcon(name?: string): IconRecord | undefined {\n let icon: IconRecord | undefined = undefined;\n const options = _iconSettings.__options;\n\n name = name ? normalizeIconName(name) : '';\n name = _iconSettings.__remapped[name] || name;\n\n if (name) {\n icon = _iconSettings[name!] as IconRecord;\n\n if (icon) {\n const { subset } = icon;\n if (subset) {\n if (!subset.isRegistered) {\n subset.isRegistered = true;\n }\n }\n } else {\n // eslint-disable-next-line deprecation/deprecation\n if (!options.disableWarnings && options.warnOnMissingIcons) {\n // eslint-disable-next-line no-console\n console.warn(\n `The icon \"${name}\" was used but not registered. See https://github.com/microsoft/fluentui/wiki/Using-icons for more information.`,\n );\n }\n }\n }\n\n return icon;\n}\n\n/**\n * Sets the icon options.\n *\n * @public\n */\nexport function setIconOptions(options: Partial<IconOptions>): void {\n _iconSettings.__options = {\n ..._iconSettings.__options,\n ...options,\n };\n}\n\nlet _missingIcons: string[] = [];\n// TODO: exclude types from this lint rule: https://github.com/microsoft/fluentui/issues/31286\nlet _missingIconsTimer: ReturnType<typeof setTimeout> | undefined = undefined;\n\nfunction _warnDuplicateIcon(iconName: string): void {\n const options = _iconSettings.__options;\n const warningDelay = 2000;\n const maxIconsInMessage = 10;\n\n if (!options.disableWarnings) {\n _missingIcons.push(iconName);\n if (_missingIconsTimer === undefined) {\n _missingIconsTimer =\n // eslint-disable-next-line @nx/workspace-no-restricted-globals\n setTimeout(() => {\n // eslint-disable-next-line no-console\n console.warn(\n `Some icons were re-registered. Applications should only call registerIcons for any given ` +\n `icon once. Redefining what an icon is may have unintended consequences. Duplicates ` +\n `include: \\n` +\n _missingIcons.slice(0, maxIconsInMessage).join(', ') +\n (_missingIcons.length > maxIconsInMessage ? ` (+ ${_missingIcons.length - maxIconsInMessage} more)` : ''),\n );\n _missingIconsTimer = undefined;\n _missingIcons = [];\n }, warningDelay);\n }\n }\n}\n"],"names":["React","GlobalSettings","ICON_SETTING_NAME","_iconSettings","getValue","__options","disableWarnings","warnOnMissingIcons","__remapped","normalizeIconName","name","toLowerCase","registerIcons","iconSubset","options","subset","isRegistered","className","undefined","icons","iconName","hasOwnProperty","code","normalizedIconName","_warnDuplicateIcon","unregisterIcons","iconNames","console","warn","Object","keys","forEach","key","registerIconAlias","mappedToName","getIcon","icon","setIconOptions","_missingIcons","_missingIconsTimer","warningDelay","maxIconsInMessage","push","setTimeout","slice","join","length"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,cAAc,QAAQ,mBAAmB;AAsDlD,MAAMC,oBAAoB;AAE1B,MAAMC,gBAAgBF,eAAeG,QAAQ,CAAcF,mBAAmB;IAC5EG,WAAW;QACTC,iBAAiB;QACjBC,oBAAoB;IACtB;IACAC,YAAY,CAAC;AACf;AAEA;;;;;;CAMC,GACD,MAAMC,oBAAoB,CAACC,OAAyBA,KAAKC,WAAW;AAEpE;;;;CAIC,GACD,OAAO,SAASC,cAAcC,UAAsB,EAAEC,OAA8B;IAClF,MAAMC,SAAS;QACb,GAAGF,UAAU;QACbG,cAAc;QACdC,WAAWC;IACb;IACA,MAAM,EAAEC,KAAK,EAAE,GAAGN;IAElB,0DAA0D;IAC1DC,UAAUA,UAAU;QAAE,GAAGX,cAAcE,SAAS;QAAE,GAAGS,OAAO;IAAC,IAAIX,cAAcE,SAAS;IAExF,IAAK,MAAMe,YAAYD,MAAO;QAC5B,IAAIA,MAAME,cAAc,CAACD,WAAW;YAClC,MAAME,OAAOH,KAAK,CAACC,SAAS;YAC5B,MAAMG,qBAAqBd,kBAAkBW;YAE7C,IAAIjB,aAAa,CAACoB,mBAAmB,EAAE;gBACrCC,mBAAmBJ;YACrB,OAA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rB,QAAQ;gBACV,IAAI,CAACA,OAAOC,YAAY,EAAE;oBACxBD,OAAOC,YAAY,GAAG;gBACxB;YACF;QACF,OAAO;YACL,mDAAmD;YACnD,IAAI,CAACF,QAAQR,eAAe,IAAIQ,QAAQP,kBAAkB,EAAE;gBAC1D,sCAAsC;gBACtCoB,QAAQC,IAAI,CACV,CAAC,UAAU,EAAElB,KAAK,+GAA+G,CAAC;YAEtI;QACF;IACF;IAEA,OAAO0B;AACT;AAEA;;;;CAIC,GACD,OAAO,SAASC,eAAevB,OAA6B;IAC1DX,cAAcE,SAAS,GAAG;QACxB,GAAGF,cAAcE,SAAS;QAC1B,GAAGS,OAAO;IACZ;AACF;AAEA,IAAIwB,gBAA0B,EAAE;AAChC,8FAA8F;AAC9F,IAAIC,qBAAgErB;AAEpE,SAASM,mBAAmBJ,QAAgB;IAC1C,MAAMN,UAAUX,cAAcE,SAAS;IACvC,MAAMmC,eAAe;IACrB,MAAMC,oBAAoB;IAE1B,IAAI,CAAC3B,QAAQR,eAAe,EAAE;QAC5BgC,cAAcI,IAAI,CAACtB;QACnB,IAAImB,uBAAuBrB,WAAW;YACpCqB,qBACE,+DAA+D;YAC/DI,WAAW;gBACT,sCAAsC;gBACtChB,QAAQC,IAAI,CACV,CAAC,yFAAyF,CAAC,GACzF,CAAC,mFAAmF,CAAC,GACrF,CAAC,WAAW,CAAC,GACbU,cAAcM,KAAK,CAAC,GAAGH,mBAAmBI,IAAI,CAAC,QAC9CP,CAAAA,cAAcQ,MAAM,GAAGL,oBAAoB,CAAC,IAAI,EAAEH,cAAcQ,MAAM,GAAGL,kBAAkB,MAAM,CAAC,GAAG,EAAC;gBAE3GF,qBAAqBrB;gBACrBoB,gBAAgB,EAAE;YACpB,GAAGE;QACP;IACF;AACF"}
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["index.ts"],"sourcesContent":["export { registerIcons, registerIconAlias, unregisterIcons, getIcon, setIconOptions } from './icon';\nexport type { IconRecord, IconOptions, IconSubset, IconSubsetRecord, IconRecords } from './icon';\n"],"names":["registerIcons","registerIconAlias","unregisterIcons","getIcon","setIconOptions"],"rangeMappings":"","mappings":"AAAA,SAASA,aAAa,EAAEC,iBAAiB,EAAEC,eAAe,EAAEC,OAAO,EAAEC,cAAc,QAAQ,SAAS"}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["export { registerIcons, registerIconAlias, unregisterIcons, getIcon, setIconOptions } from './icon';\nexport type { IconRecord, IconOptions, IconSubset, IconSubsetRecord, IconRecords } from './icon';\n"],"names":["registerIcons","registerIconAlias","unregisterIcons","getIcon","setIconOptions"],"rangeMappings":"","mappings":"AAAA,SAASA,aAAa,EAAEC,iBAAiB,EAAEC,eAAe,EAAEC,OAAO,EAAEC,cAAc,QAAQ,SAAS"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["GlobalSettings.ts"],"sourcesContent":["import { getWindow } from './getWindow';\n\n/**\n * Storing global state in local module variables has issues when more than one copy\n * of the module gets loaded on the page (due to a bundling error or simply by consuming\n * a prebundled script.)\n *\n * This file contains helpers to deal with the getting and setting local state, and allows\n * callers to get called back when it mutates.\n */\n\nconst GLOBAL_SETTINGS_PROP_NAME = '__globalSettings__';\nconst CALLBACK_STATE_PROP_NAME = '__callbacks__';\n\nlet _counter = 0;\n\n/**\n * Change description used for change callbacks in GlobalSettings.\n *\n * @public\n */\nexport interface ChangeDescription {\n key: string;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n oldValue: any;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n value: any;\n}\n\n/**\n * Change event callback.\n *\n * @public\n */\nexport interface ChangeEventCallback {\n __id__?: string;\n (changeDescription?: ChangeDescription): void;\n}\n\n/**\n * Global settings helper, which stores settings in the global (window) namespace.\n * If window is not provided, it will store settings in module scope. Provides a\n * way to observe changes as well when their values change.\n *\n * @public\n */\nexport class GlobalSettings {\n public static getValue<T>(key: string, defaultValue?: T | (() => T)): T {\n const globalSettings = _getGlobalSettings();\n\n if (globalSettings[key] === undefined) {\n globalSettings[key] = typeof defaultValue === 'function' ? (defaultValue as Function)() : defaultValue;\n }\n\n return globalSettings[key];\n }\n\n public static setValue<T>(key: string, value: T): T {\n const globalSettings = _getGlobalSettings();\n const callbacks = globalSettings[CALLBACK_STATE_PROP_NAME];\n const oldValue = globalSettings[key];\n\n if (value !== oldValue) {\n globalSettings[key] = value;\n\n const changeDescription = {\n oldValue,\n value,\n key,\n };\n\n for (const id in callbacks) {\n if (callbacks.hasOwnProperty(id)) {\n callbacks[id](changeDescription);\n }\n }\n }\n\n return value;\n }\n\n public static addChangeListener(cb: ChangeEventCallback): void {\n // Note: we use generated ids on the callbacks to create a map of the callbacks, which optimizes removal.\n // (It's faster to delete a key than it is to look up the index of an object and splice an array.)\n let id = cb.__id__;\n const callbacks = _getCallbacks();\n\n if (!id) {\n id = cb.__id__ = String(_counter++);\n }\n\n callbacks[id] = cb;\n }\n\n public static removeChangeListener(cb: ChangeEventCallback): void {\n const callbacks = _getCallbacks();\n delete callbacks[cb.__id__ as string];\n }\n}\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nfunction _getGlobalSettings(): { [key: string]: any } {\n const win = getWindow();\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const globalObj: { [key: string]: any } = win || {};\n\n if (!globalObj[GLOBAL_SETTINGS_PROP_NAME]) {\n globalObj[GLOBAL_SETTINGS_PROP_NAME] = {\n [CALLBACK_STATE_PROP_NAME]: {},\n };\n }\n\n return globalObj[GLOBAL_SETTINGS_PROP_NAME];\n}\n\nfunction _getCallbacks(): { [key: string]: () => void } {\n const globalSettings = _getGlobalSettings();\n return globalSettings[CALLBACK_STATE_PROP_NAME];\n}\n"],"names":["GlobalSettings","GLOBAL_SETTINGS_PROP_NAME","CALLBACK_STATE_PROP_NAME","_counter","getValue","key","defaultValue","globalSettings","_getGlobalSettings","undefined","setValue","value","callbacks","oldValue","changeDescription","id","hasOwnProperty","addChangeListener","cb","__id__","_getCallbacks","String","removeChangeListener","win","getWindow","globalObj"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BA8CaA;;;eAAAA;;;2BA9Ca;AAE1B;;;;;;;CAOC,GAED,MAAMC,4BAA4B;AAClC,MAAMC,2BAA2B;AAEjC,IAAIC,WAAW;AAgCR,MAAMH;IACX,OAAcI,SAAYC,GAAW,EAAEC,YAA4B,EAAK;QACtE,MAAMC,iBAAiBC;QAEvB,IAAID,cAAc,CAACF,IAAI,KAAKI,WAAW;YACrCF,cAAc,CAACF,IAAI,GAAG,OAAOC,iBAAiB,
|
|
1
|
+
{"version":3,"sources":["../src/GlobalSettings.ts"],"sourcesContent":["import { getWindow } from './getWindow';\n\n/**\n * Storing global state in local module variables has issues when more than one copy\n * of the module gets loaded on the page (due to a bundling error or simply by consuming\n * a prebundled script.)\n *\n * This file contains helpers to deal with the getting and setting local state, and allows\n * callers to get called back when it mutates.\n */\n\nconst GLOBAL_SETTINGS_PROP_NAME = '__globalSettings__';\nconst CALLBACK_STATE_PROP_NAME = '__callbacks__';\n\nlet _counter = 0;\n\n/**\n * Change description used for change callbacks in GlobalSettings.\n *\n * @public\n */\nexport interface ChangeDescription {\n key: string;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n oldValue: any;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n value: any;\n}\n\n/**\n * Change event callback.\n *\n * @public\n */\nexport interface ChangeEventCallback {\n __id__?: string;\n (changeDescription?: ChangeDescription): void;\n}\n\n/**\n * Global settings helper, which stores settings in the global (window) namespace.\n * If window is not provided, it will store settings in module scope. Provides a\n * way to observe changes as well when their values change.\n *\n * @public\n */\nexport class GlobalSettings {\n public static getValue<T>(key: string, defaultValue?: T | (() => T)): T {\n const globalSettings = _getGlobalSettings();\n\n if (globalSettings[key] === undefined) {\n globalSettings[key] = typeof defaultValue === 'function' ? (defaultValue as Function)() : defaultValue;\n }\n\n return globalSettings[key];\n }\n\n public static setValue<T>(key: string, value: T): T {\n const globalSettings = _getGlobalSettings();\n const callbacks = globalSettings[CALLBACK_STATE_PROP_NAME];\n const oldValue = globalSettings[key];\n\n if (value !== oldValue) {\n globalSettings[key] = value;\n\n const changeDescription = {\n oldValue,\n value,\n key,\n };\n\n for (const id in callbacks) {\n if (callbacks.hasOwnProperty(id)) {\n callbacks[id](changeDescription);\n }\n }\n }\n\n return value;\n }\n\n public static addChangeListener(cb: ChangeEventCallback): void {\n // Note: we use generated ids on the callbacks to create a map of the callbacks, which optimizes removal.\n // (It's faster to delete a key than it is to look up the index of an object and splice an array.)\n let id = cb.__id__;\n const callbacks = _getCallbacks();\n\n if (!id) {\n id = cb.__id__ = String(_counter++);\n }\n\n callbacks[id] = cb;\n }\n\n public static removeChangeListener(cb: ChangeEventCallback): void {\n const callbacks = _getCallbacks();\n delete callbacks[cb.__id__ as string];\n }\n}\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nfunction _getGlobalSettings(): { [key: string]: any } {\n const win = getWindow();\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const globalObj: { [key: string]: any } = win || {};\n\n if (!globalObj[GLOBAL_SETTINGS_PROP_NAME]) {\n globalObj[GLOBAL_SETTINGS_PROP_NAME] = {\n [CALLBACK_STATE_PROP_NAME]: {},\n };\n }\n\n return globalObj[GLOBAL_SETTINGS_PROP_NAME];\n}\n\nfunction _getCallbacks(): { [key: string]: () => void } {\n const globalSettings = _getGlobalSettings();\n return globalSettings[CALLBACK_STATE_PROP_NAME];\n}\n"],"names":["GlobalSettings","GLOBAL_SETTINGS_PROP_NAME","CALLBACK_STATE_PROP_NAME","_counter","getValue","key","defaultValue","globalSettings","_getGlobalSettings","undefined","setValue","value","callbacks","oldValue","changeDescription","id","hasOwnProperty","addChangeListener","cb","__id__","_getCallbacks","String","removeChangeListener","win","getWindow","glob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EA,8DAA8D;AAC9D,SAASX;IACP,MAAMe,MAAMC,IAAAA,oBAAS;IACrB,8DAA8D;IAC9D,MAAMC,YAAoCF,OAAO,CAAC;IAElD,IAAI,CAACE,SAAS,CAACxB,0BAA0B,EAAE;QACzCwB,SAAS,CAACxB,0BAA0B,GAAG;YACrC,CAACC,yBAAyB,EAAE,CAAC;QAC/B;IACF;IAEA,OAAOuB,SAAS,CAACxB,0BAA0B;AAC7C;AAEA,SAASmB;IACP,MAAMb,iBAAiBC;IACvB,OAAOD,cAAc,CAACL,yBAAyB;AACjD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["getWindow.ts"],"sourcesContent":["import { canUseDOM } from '@fluentui/react-utilities';\n\nlet _window: Window | undefined = undefined;\n\n// Note: Accessing \"window\" in IE11 is somewhat expensive, and calling \"typeof window\"\n// hits a memory leak, whereas aliasing it and calling \"typeof _window\" does not.\n// Caching the window value at the file scope lets us minimize the impact.\ntry {\n // eslint-disable-next-line @nx/workspace-no-restricted-globals\n _window = window;\n} catch (e) {\n /* no-op */\n}\n\n/**\n * Helper to get the window object. The helper will make sure to use a cached variable\n * of \"window\", to avoid overhead and memory leaks in IE11. Note that in popup scenarios the\n * window object won't match the \"global\" window object, and for these scenarios, you should\n * pass in an element hosted within the popup.\n *\n * @public\n */\nexport function getWindow(rootElement?: Element | null): Window | undefined {\n if (!canUseDOM() || typeof _window === 'undefined') {\n return undefined;\n } else {\n const el = rootElement as Element;\n\n return el && el.ownerDocument && el.ownerDocument.defaultView ? el.ownerDocument.defaultView : _window;\n }\n}\n"],"names":["getWindow","_window","undefined","window","e","rootElement","canUseDOM","el","ownerDocument","defaultView"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAsBgBA;;;eAAAA;;;gCAtBU;AAE1B,IAAIC,UAA8BC;AAElC,sFAAsF;AACtF,iFAAiF;AACjF,0EAA0E;AAC1E,IAAI;IACF,+DAA+D;IAC/DD,UAAUE;AACZ,EAAE,OAAOC,GAAG;AACV,SAAS,GACX;AAUO,SAASJ,UAAUK,WAA4B;IACpD,IAAI,CAACC,IAAAA,
|
|
1
|
+
{"version":3,"sources":["../src/getWindow.ts"],"sourcesContent":["import { canUseDOM } from '@fluentui/react-utilities';\n\nlet _window: Window | undefined = undefined;\n\n// Note: Accessing \"window\" in IE11 is somewhat expensive, and calling \"typeof window\"\n// hits a memory leak, whereas aliasing it and calling \"typeof _window\" does not.\n// Caching the window value at the file scope lets us minimize the impact.\ntry {\n // eslint-disable-next-line @nx/workspace-no-restricted-globals\n _window = window;\n} catch (e) {\n /* no-op */\n}\n\n/**\n * Helper to get the window object. The helper will make sure to use a cached variable\n * of \"window\", to avoid overhead and memory leaks in IE11. Note that in popup scenarios the\n * window object won't match the \"global\" window object, and for these scenarios, you should\n * pass in an element hosted within the popup.\n *\n * @public\n */\nexport function getWindow(rootElement?: Element | null): Window | undefined {\n if (!canUseDOM() || typeof _window === 'undefined') {\n return undefined;\n } else {\n const el = rootElement as Element;\n\n return el && el.ownerDocument && el.ownerDocument.defaultView ? el.ownerDocument.defaultView : _window;\n }\n}\n"],"names":["getWindow","_window","undefined","window","e","rootElement","canUseDOM","el","ownerDocument","defaultView"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAsBgBA;;;eAAAA;;;gCAtBU;AAE1B,IAAIC,UAA8BC;AAElC,sFAAsF;AACtF,iFAAiF;AACjF,0EAA0E;AAC1E,IAAI;IACF,+DAA+D;IAC/DD,UAAUE;AACZ,EAAE,OAAOC,GAAG;AACV,SAAS,GACX;AAUO,SAASJ,UAAUK,WAA4B;IACpD,IAAI,CAACC,IAAAA,yBAAS,OAAM,OAAOL,YAAY,aAAa;QAClD,OAAOC;IACT,OAAO;QACL,MAAMK,KAAKF;QAEX,OAAOE,MAAMA,GAAGC,aAAa,IAAID,GAAGC,aAAa,CAACC,WAAW,GAAGF,GAAGC,aAAa,CAACC,WAAW,GAAGR;IACjG;AACF"}
|
package/lib-commonjs/icon.js
CHANGED
|
@@ -138,7 +138,8 @@ function _warnDuplicateIcon(iconName) {
|
|
|
138
138
|
if (!options.disableWarnings) {
|
|
139
139
|
_missingIcons.push(iconName);
|
|
140
140
|
if (_missingIconsTimer === undefined) {
|
|
141
|
-
_missingIconsTimer =
|
|
141
|
+
_missingIconsTimer = // eslint-disable-next-line @nx/workspace-no-restricted-globals
|
|
142
|
+
setTimeout(()=>{
|
|
142
143
|
// eslint-disable-next-line no-console
|
|
143
144
|
console.warn(`Some icons were re-registered. Applications should only call registerIcons for any given ` + `icon once. Redefining what an icon is may have unintended consequences. Duplicates ` + `include: \n` + _missingIcons.slice(0, maxIconsInMessage).join(', ') + (_missingIcons.length > maxIconsInMessage ? ` (+ ${_missingIcons.length - maxIconsInMessage} more)` : ''));
|
|
144
145
|
_missingIconsTimer = undefined;
|
package/lib-commonjs/icon.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["icon.ts"],"sourcesContent":["import * as React from 'react';\nimport { GlobalSettings } from './GlobalSettings';\n\nexport type T = React.ReactNode;\n\nexport interface IconSubset {\n icons: {\n [key: string]: string | JSX.Element;\n };\n /**\n * Indicates to the icon renderer that it is safe to merge any props on the original `Icon` element\n * onto the child content element registered for the icon which are valid for HTML images.\n */\n mergeImageProps?: boolean;\n}\n\nexport interface IconSubsetRecord extends IconSubset {\n isRegistered?: boolean;\n className?: string;\n}\n\nexport interface IconRecord {\n code: string | undefined;\n subset: IconSubsetRecord;\n}\n\nexport interface IconOptions {\n /**\n * By default, registering the same set of icons will generate a console warning per duplicate icon\n * registered, because this scenario can create unexpected consequences.\n *\n * Some scenarios include:\n *\n * Icon set was previously registered using a different base url.\n * Icon set was previously registered but a different version was provided.\n * Icons in a previous registered set overlap with a new set.\n *\n * To simply ignore previously registered icons, you can specify to disable warnings. This means\n * that if an icon which was previous registered is registered again, it will be silently ignored.\n * However, consider whether the problems listed above will cause issues.\n **/\n disableWarnings: boolean;\n\n /**\n * @deprecated Use `disableWarnings` instead.\n */\n warnOnMissingIcons?: boolean;\n}\n\nexport interface IconRecords {\n __options: IconOptions;\n __remapped: { [key: string]: string };\n [key: string]: IconRecord | {};\n}\n\nconst ICON_SETTING_NAME = 'icons';\n\nconst _iconSettings = GlobalSettings.getValue<IconRecords>(ICON_SETTING_NAME, {\n __options: {\n disableWarnings: false,\n warnOnMissingIcons: true,\n },\n __remapped: {},\n});\n\n/**\n * Normalizes an icon name for consistent mapping.\n * Current implementation is to convert the icon name to lower case.\n *\n * @param name - Icon name to normalize.\n * @returns {string} Normalized icon name to use for indexing and mapping.\n */\nconst normalizeIconName = (name: string): string => name.toLowerCase();\n\n/**\n * Registers a given subset of icons.\n *\n * @param iconSubset - the icon subset definition.\n */\nexport function registerIcons(iconSubset: IconSubset, options?: Partial<IconOptions>): void {\n const subset = {\n ...iconSubset,\n isRegistered: false,\n className: undefined,\n };\n const { icons } = iconSubset;\n\n // Grab options, optionally mix user provided ones on top.\n options = options ? { ..._iconSettings.__options, ...options } : _iconSettings.__options;\n\n for (const iconName in icons) {\n if (icons.hasOwnProperty(iconName)) {\n const code = icons[iconName];\n const normalizedIconName = normalizeIconName(iconName);\n\n if (_iconSettings[normalizedIconName]) {\n _warnDuplicateIcon(iconName);\n } else {\n _iconSettings[normalizedIconName] = {\n code,\n subset,\n } as IconRecord;\n }\n }\n }\n}\n\n/**\n * Unregisters icons by name.\n *\n * @param iconNames - List of icons to unregister.\n */\nexport function unregisterIcons(iconNames: string[]): void {\n const options = _iconSettings.__options;\n\n for (const iconName of iconNames) {\n const normalizedIconName = normalizeIconName(iconName);\n if (_iconSettings[normalizedIconName]) {\n delete _iconSettings[normalizedIconName];\n } else {\n // Warn that we are trying to delete an icon that doesn't exist\n if (!options.disableWarnings) {\n // eslint-disable-next-line no-console\n console.warn(`The icon \"${iconName}\" tried to unregister but was not registered.`);\n }\n }\n\n // Delete any aliases for this iconName\n if (_iconSettings.__remapped[normalizedIconName]) {\n delete _iconSettings.__remapped[normalizedIconName];\n }\n\n // Delete any items that were an alias for this iconName\n Object.keys(_iconSettings.__remapped).forEach((key: string) => {\n if (_iconSettings.__remapped[key] === normalizedIconName) {\n delete _iconSettings.__remapped[key];\n }\n });\n }\n}\n\n/**\n * Remaps one icon name to another.\n */\nexport function registerIconAlias(iconName: string, mappedToName: string): void {\n _iconSettings.__remapped[normalizeIconName(iconName)] = normalizeIconName(mappedToName);\n}\n\n/**\n * Gets an icon definition. If an icon is requested but the subset has yet to be registered,\n * it will get registered immediately.\n *\n * @public\n * @param name - Name of icon.\n */\nexport function getIcon(name?: string): IconRecord | undefined {\n let icon: IconRecord | undefined = undefined;\n const options = _iconSettings.__options;\n\n name = name ? normalizeIconName(name) : '';\n name = _iconSettings.__remapped[name] || name;\n\n if (name) {\n icon = _iconSettings[name!] as IconRecord;\n\n if (icon) {\n const { subset } = icon;\n if (subset) {\n if (!subset.isRegistered) {\n subset.isRegistered = true;\n }\n }\n } else {\n // eslint-disable-next-line deprecation/deprecation\n if (!options.disableWarnings && options.warnOnMissingIcons) {\n // eslint-disable-next-line no-console\n console.warn(\n `The icon \"${name}\" was used but not registered. See https://github.com/microsoft/fluentui/wiki/Using-icons for more information.`,\n );\n }\n }\n }\n\n return icon;\n}\n\n/**\n * Sets the icon options.\n *\n * @public\n */\nexport function setIconOptions(options: Partial<IconOptions>): void {\n _iconSettings.__options = {\n ..._iconSettings.__options,\n ...options,\n };\n}\n\nlet _missingIcons: string[] = [];\n// TODO: exclude types from this lint rule: https://github.com/microsoft/fluentui/issues/31286\nlet _missingIconsTimer: ReturnType<typeof setTimeout> | undefined = undefined;\n\nfunction _warnDuplicateIcon(iconName: string): void {\n const options = _iconSettings.__options;\n const warningDelay = 2000;\n const maxIconsInMessage = 10;\n\n if (!options.disableWarnings) {\n _missingIcons.push(iconName);\n if (_missingIconsTimer === undefined) {\n _missingIconsTimer =\n // eslint-disable-next-line @nx/workspace-no-restricted-globals\n setTimeout(() => {\n // eslint-disable-next-line no-console\n console.warn(\n `Some icons were re-registered. Applications should only call registerIcons for any given ` +\n `icon once. Redefining what an icon is may have unintended consequences. Duplicates ` +\n `include: \\n` +\n _missingIcons.slice(0, maxIconsInMessage).join(', ') +\n (_missingIcons.length > maxIconsInMessage ? ` (+ ${_missingIcons.length - maxIconsInMessage} more)` : ''),\n );\n _missingIconsTimer = undefined;\n _missingIcons = [];\n }, warningDelay);\n }\n }\n}\n"],"names":["getIcon","registerIconAlias","registerIcons","setIconOptions","unregisterIcons","ICON_SETTING_NAME","_iconSettings","GlobalSettings","getValue","__options","disableWarnings","warnOnMissingIcons","__remapped","normalizeIconName","name","toLowerCase","iconSubset","options","subset","isRegistered","className","undefined","icons","iconName","hasOwnProperty","code","normalizedIconName","_warnDuplicateIcon","iconNames","console","warn","Object","keys","forEach","key","mappedToName","icon","_missingIcons","_missingIconsTimer","warningDelay","maxIconsInMessage","push","setTimeout","slice","join","length"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;;;;;;;;IA2JgBA,OAAAA;eAAAA;;IAXAC,iBAAAA;eAAAA;;IAjEAC,aAAAA;eAAAA;;IAgHAC,cAAAA;eAAAA;;IA/EAC,eAAAA;eAAAA;;;;iEAhHO;gCACQ;AAsD/B,MAAMC,oBAAoB;AAE1B,MAAMC,gBAAgBC,8BAAAA,CAAeC,QAAQ,CAAcH,mBAAmB;IAC5EI,WAAW;QACTC,iBAAiB;QACjBC,oBAAoB;IACtB;IACAC,YAAY,CAAC;AACf;AAEA;;;;;;CAMC,GACD,MAAMC,oBAAoB,CAACC,OAAyBA,KAAKC,WAAW;AAO7D,SAASb,cAAcc,UAAsB,EAAEC,OAA8B;IAClF,MAAMC,SAAS;QACb,GAAGF,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cQ,MAAM,GAAGL,oBAAoB,CAAC,IAAI,EAAEH,cAAcQ,MAAM,GAAGL,kBAAkB,MAAM,CAAC,GAAG,EAAA;gBAE1GF,qBAAqBjB;gBACrBgB,gBAAgB,EAAE;YACpB,GAAGE;QACP;IACF;AACF"}
|
|
1
|
+
{"version":3,"sources":["../src/icon.ts"],"sourcesContent":["import * as React from 'react';\nimport { GlobalSettings } from './GlobalSettings';\n\nexport type T = React.ReactNode;\n\nexport interface IconSubset {\n icons: {\n [key: string]: string | JSX.Element;\n };\n /**\n * Indicates to the icon renderer that it is safe to merge any props on the original `Icon` element\n * onto the child content element registered for the icon which are valid for HTML images.\n */\n mergeImageProps?: boolean;\n}\n\nexport interface IconSubsetRecord extends IconSubset {\n isRegistered?: boolean;\n className?: string;\n}\n\nexport interface IconRecord {\n code: string | undefined;\n subset: IconSubsetRecord;\n}\n\nexport interface IconOptions {\n /**\n * By default, registering the same set of icons will generate a console warning per duplicate icon\n * registered, because this scenario can create unexpected consequences.\n *\n * Some scenarios include:\n *\n * Icon set was previously registered using a different base url.\n * Icon set was previously registered but a different version was provided.\n * Icons in a previous registered set overlap with a new set.\n *\n * To simply ignore previously registered icons, you can specify to disable warnings. This means\n * that if an icon which was previous registered is registered again, it will be silently ignored.\n * However, consider whether the problems listed above will cause issues.\n **/\n disableWarnings: boolean;\n\n /**\n * @deprecated Use `disableWarnings` instead.\n */\n warnOnMissingIcons?: boolean;\n}\n\nexport interface IconRecords {\n __options: IconOptions;\n __remapped: { [key: string]: string };\n [key: string]: IconRecord | {};\n}\n\nconst ICON_SETTING_NAME = 'icons';\n\nconst _iconSettings = GlobalSettings.getValue<IconRecords>(ICON_SETTING_NAME, {\n __options: {\n disableWarnings: false,\n warnOnMissingIcons: true,\n },\n __remapped: {},\n});\n\n/**\n * Normalizes an icon name for consistent mapping.\n * Current implementation is to convert the icon name to lower case.\n *\n * @param name - Icon name to normalize.\n * @returns {string} Normalized icon name to use for indexing and mapping.\n */\nconst normalizeIconName = (name: string): string => name.toLowerCase();\n\n/**\n * Registers a given subset of icons.\n *\n * @param iconSubset - the icon subset definition.\n */\nexport function registerIcons(iconSubset: IconSubset, options?: Partial<IconOptions>): void {\n const subset = {\n ...iconSubset,\n isRegistered: false,\n className: undefined,\n };\n const { icons } = iconSubset;\n\n // Grab options, optionally mix user provided ones on top.\n options = options ? { ..._iconSettings.__options, ...options } : _iconSettings.__options;\n\n for (const iconName in icons) {\n if (icons.hasOwnProperty(iconName)) {\n const code = icons[iconName];\n const normalizedIconName = normalizeIconName(iconName);\n\n if (_iconSettings[normalizedIconName]) {\n _warnDuplicateIcon(iconName);\n } else {\n _iconSettings[normalizedIconName] = {\n code,\n subset,\n } as IconRecord;\n }\n }\n }\n}\n\n/**\n * Unregisters icons by name.\n *\n * @param iconNames - List of icons to unregister.\n */\nexport function unregisterIcons(iconNames: string[]): void {\n const options = _iconSettings.__options;\n\n for (const iconName of iconNames) {\n const normalizedIconName = normalizeIconName(iconName);\n if (_iconSettings[normalizedIconName]) {\n delete _iconSettings[normalizedIconName];\n } else {\n // Warn that we are trying to delete an icon that doesn't exist\n if (!options.disableWarnings) {\n // eslint-disable-next-line no-console\n console.warn(`The icon \"${iconName}\" tried to unregister but was not registered.`);\n }\n }\n\n // Delete any aliases for this iconName\n if (_iconSettings.__remapped[normalizedIconName]) {\n delete _iconSettings.__remapped[normalizedIconName];\n }\n\n // Delete any items that were an alias for this iconName\n Object.keys(_iconSettings.__remapped).forEach((key: string) => {\n if (_iconSettings.__remapped[key] === normalizedIconName) {\n delete _iconSettings.__remapped[key];\n }\n });\n }\n}\n\n/**\n * Remaps one icon name to another.\n */\nexport function registerIconAlias(iconName: string, mappedToName: string): void {\n _iconSettings.__remapped[normalizeIconName(iconName)] = normalizeIconName(mappedToName);\n}\n\n/**\n * Gets an icon definition. If an icon is requested but the subset has yet to be registered,\n * it will get registered immediately.\n *\n * @public\n * @param name - Name of icon.\n */\nexport function getIcon(name?: string): IconRecord | undefined {\n let icon: IconRecord | undefined = undefined;\n const options = _iconSettings.__options;\n\n name = name ? normalizeIconName(name) : '';\n name = _iconSettings.__remapped[name] || name;\n\n if (name) {\n icon = _iconSettings[name!] as IconRecord;\n\n if (icon) {\n const { subset } = icon;\n if (subset) {\n if (!subset.isRegistered) {\n subset.isRegistered = true;\n }\n }\n } else {\n // eslint-disable-next-line deprecation/deprecation\n if (!options.disableWarnings && options.warnOnMissingIcons) {\n // eslint-disable-next-line no-console\n console.warn(\n `The icon \"${name}\" was used but not registered. See https://github.com/microsoft/fluentui/wiki/Using-icons for more information.`,\n );\n }\n }\n }\n\n return icon;\n}\n\n/**\n * Sets the icon options.\n *\n * @public\n */\nexport function setIconOptions(options: Partial<IconOptions>): void {\n _iconSettings.__options = {\n ..._iconSettings.__options,\n ...options,\n };\n}\n\nlet _missingIcons: string[] = [];\n// TODO: exclude types from this lint rule: https://github.com/microsoft/fluentui/issues/31286\nlet _missingIconsTimer: ReturnType<typeof setTimeout> | undefined = undefined;\n\nfunction _warnDuplicateIcon(iconName: string): void {\n const options = _iconSettings.__options;\n const warningDelay = 2000;\n const maxIconsInMessage = 10;\n\n if (!options.disableWarnings) {\n _missingIcons.push(iconName);\n if (_missingIconsTimer === undefined) {\n _missingIconsTimer =\n // eslint-disable-next-line @nx/workspace-no-restricted-globals\n setTimeout(() => {\n // eslint-disable-next-line no-console\n console.warn(\n `Some icons were re-registered. Applications should only call registerIcons for any given ` +\n `icon once. Redefining what an icon is may have unintended consequences. Duplicates ` +\n `include: \\n` +\n _missingIcons.slice(0, maxIconsInMessage).join(', ') +\n (_missingIcons.length > maxIconsInMessage ? ` (+ ${_missingIcons.length - maxIconsInMessage} more)` : ''),\n );\n _missingIconsTimer = undefined;\n _missingIcons = [];\n }, warningDelay);\n }\n }\n}\n"],"names":["getIcon","registerIconAlias","registerIcons","setIconOptions","unregisterIcons","ICON_SETTING_NAME","_iconSettings","GlobalSettings","getValue","__options","disableWarnings","warnOnMissingIcons","__remapped","normalizeIconName","name","toLowerCase","iconSubset","options","subset","isRegistered","className","undefined","icons","iconName","hasOwnProperty","code","normalizedIconName","_warnDuplicateIcon","iconNames","console","warn","Object","keys","forEach","key","mappedToName","icon","_missingIcons","_missingIconsTimer","warningDelay","maxIconsInMessage","push","setTimeout","slice","join","length"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;;;;;;;;IA2JgBA,OAAO;eAAPA;;IAXAC,iBAAiB;eAAjBA;;IAjEAC,aAAa;eAAbA;;IAgHAC,cAAc;eAAdA;;IA/EAC,eAAe;eAAfA;;;;iEAhHO;gCACQ;AAsD/B,MAAMC,oBAAoB;AAE1B,MAAMC,gBAAgBC,8BAAc,CAACC,QAAQ,CAAcH,mBAAmB;IAC5EI,WAAW;QACTC,iBAAiB;QACjBC,oBAAoB;IACtB;IACAC,YAAY,CAAC;AACf;AAEA;;;;;;CAMC,GACD,MAAMC,oBAAoB,CAACC,OAAyBA,KAAKC,WAAW;AAO7D,SAASb,cAAcc,UAAsB,EAAEC,OAA8B;IAClF,MAAMC,SAAS;QACb,GAAGF,UAAU;QACbG,cAAc;QACdC,WAAWC;IACb;IACA,MAAM,EAAEC,KAAK,EAAE,GAAGN;IAElB,0DAA0D;IAC1DC,UAAUA,UAAU;QAAE,GAAGX,cAAcG,SAAS;QAAE,GAAGQ,OAAO;IAAC,IAAIX,cAAcG,SAAS;IAExF,IAAK,MAAMc,YAAYD,MAAO;QAC5B,IAAIA,MAAME,cAAc,CAACD,WAAW;YAClC,MAAME,OAAOH,KAAK,CAACC,SAAS;YAC5B,MAAMG,qBAAqBb,kBAAkBU;YAE7C,IAAIjB,aAAa,CAACoB,mBAAmB,EAAE;gBACrCC,mBAAmBJ;YACrB,OAAO;gBACLjB,aAAa,CAAC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BACxB;YACF;QACF,OAAO;YACL,mDAAmD;YACnD,IAAI,CAACF,QAAQP,eAAe,IAAIO,QAAQN,kBAAkB,EAAE;gBAC1D,sCAAsC;gBACtCkB,QAAQC,IAAI,CACV,CAAC,UAAU,EAAEhB,KAAK,+GAA+G,CAAC;YAEtI;QACF;IACF;IAEA,OAAOsB;AACT;AAOO,SAASjC,eAAec,OAA6B;IAC1DX,cAAcG,SAAS,GAAG;QACxB,GAAGH,cAAcG,SAAS;QAC1B,GAAGQ,OAAO;IACZ;AACF;AAEA,IAAIoB,gBAA0B,EAAE;AAChC,8FAA8F;AAC9F,IAAIC,qBAAgEjB;AAEpE,SAASM,mBAAmBJ,QAAgB;IAC1C,MAAMN,UAAUX,cAAcG,SAAS;IACvC,MAAM8B,eAAe;IACrB,MAAMC,oBAAoB;IAE1B,IAAI,CAACvB,QAAQP,eAAe,EAAE;QAC5B2B,cAAcI,IAAI,CAAClB;QACnB,IAAIe,uBAAuBjB,WAAW;YACpCiB,qBACE,+DAA+D;YAC/DI,WAAW;gBACT,sCAAsC;gBACtCb,QAAQC,IAAI,CACV,CAAC,yFAAyF,CAAC,GACzF,CAAC,mFAAmF,CAAC,GACrF,CAAC,WAAW,CAAC,GACbO,cAAcM,KAAK,CAAC,GAAGH,mBAAmBI,IAAI,CAAC,QAC9CP,CAAAA,cAAcQ,MAAM,GAAGL,oBAAoB,CAAC,IAAI,EAAEH,cAAcQ,MAAM,GAAGL,kBAAkB,MAAM,CAAC,GAAG,EAAC;gBAE3GF,qBAAqBjB;gBACrBgB,gBAAgB,EAAE;YACpB,GAAGE;QACP;IACF;AACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["index.ts"],"sourcesContent":["export { registerIcons, registerIconAlias, unregisterIcons, getIcon, setIconOptions } from './icon';\nexport type { IconRecord, IconOptions, IconSubset, IconSubsetRecord, IconRecords } from './icon';\n"],"names":["getIcon","registerIconAlias","registerIcons","setIconOptions","unregisterIcons"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;;;;;;;;IAA4DA,OAAO;eAAPA,aAAO;;IAA3CC,iBAAiB;eAAjBA,uBAAiB;;IAAhCC,aAAa;eAAbA,mBAAa;;IAA+CC,cAAc;eAAdA,oBAAc;;IAAxCC,eAAe;eAAfA,qBAAe;;;sBAAiC"}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["export { registerIcons, registerIconAlias, unregisterIcons, getIcon, setIconOptions } from './icon';\nexport type { IconRecord, IconOptions, IconSubset, IconSubsetRecord, IconRecords } from './icon';\n"],"names":["getIcon","registerIconAlias","registerIcons","setIconOptions","unregisterIcons"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;;;;;;;;IAA4DA,OAAO;eAAPA,aAAO;;IAA3CC,iBAAiB;eAAjBA,uBAAiB;;IAAhCC,aAAa;eAAbA,mBAAa;;IAA+CC,cAAc;eAAdA,oBAAc;;IAAxCC,eAAe;eAAfA,qBAAe;;;sBAAiC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluentui/react-icons-compat",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.5",
|
|
4
4
|
"description": "Package for icon utility methods used by font and svg icons.",
|
|
5
5
|
"main": "lib-commonjs/index.js",
|
|
6
6
|
"module": "lib/index.js",
|
|
@@ -17,28 +17,17 @@
|
|
|
17
17
|
"url": "https://github.com/microsoft/fluentui"
|
|
18
18
|
},
|
|
19
19
|
"license": "MIT",
|
|
20
|
-
"scripts": {
|
|
21
|
-
"build": "just-scripts build",
|
|
22
|
-
"clean": "just-scripts clean",
|
|
23
|
-
"generate-api": "just-scripts generate-api",
|
|
24
|
-
"lint": "just-scripts lint",
|
|
25
|
-
"start": "yarn storybook",
|
|
26
|
-
"storybook": "yarn --cwd ../stories storybook",
|
|
27
|
-
"test": "jest --passWithNoTests",
|
|
28
|
-
"type-check": "just-scripts type-check"
|
|
29
|
-
},
|
|
30
20
|
"devDependencies": {
|
|
31
21
|
"@fluentui/eslint-plugin": "*",
|
|
32
22
|
"@fluentui/react-conformance": "*",
|
|
33
23
|
"@fluentui/react-conformance-griffel": "*",
|
|
34
|
-
"@fluentui/scripts-api-extractor": "*"
|
|
35
|
-
"@fluentui/scripts-tasks": "*"
|
|
24
|
+
"@fluentui/scripts-api-extractor": "*"
|
|
36
25
|
},
|
|
37
26
|
"dependencies": {
|
|
38
|
-
"@fluentui/react-jsx-runtime": "^9.0.
|
|
39
|
-
"@fluentui/react-shared-contexts": "^9.
|
|
40
|
-
"@fluentui/react-theme": "^9.1.
|
|
41
|
-
"@fluentui/react-utilities": "^9.18.
|
|
27
|
+
"@fluentui/react-jsx-runtime": "^9.0.47",
|
|
28
|
+
"@fluentui/react-shared-contexts": "^9.21.1",
|
|
29
|
+
"@fluentui/react-theme": "^9.1.23",
|
|
30
|
+
"@fluentui/react-utilities": "^9.18.18",
|
|
42
31
|
"@griffel/react": "^1.5.22",
|
|
43
32
|
"@swc/helpers": "^0.5.1"
|
|
44
33
|
},
|