@fluentui/react-icons-compat 0.0.0-nightly-20240911-0407.1 → 0.1.1

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 CHANGED
@@ -1,27 +1,12 @@
1
1
  # Change Log - @fluentui/react-icons-compat
2
2
 
3
- This log was last generated on Wed, 11 Sep 2024 04:12:14 GMT and should not be manually modified.
3
+ This log was last generated on Tue, 10 Sep 2024 10:15:11 GMT and should not be manually modified.
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
- ## [0.0.0-nightly-20240911-0407.1](https://github.com/microsoft/fluentui/tree/@fluentui/react-icons-compat_v0.0.0-nightly-20240911-0407.1)
8
-
9
- Wed, 11 Sep 2024 04:12:14 GMT
10
- [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-icons-compat_v0.1.1..@fluentui/react-icons-compat_v0.0.0-nightly-20240911-0407.1)
11
-
12
- ### Changes
13
-
14
- - Release nightly v9 ([commit](https://github.com/microsoft/fluentui/commit/not available) by fluentui-internal@service.microsoft.com)
15
- - Bump @fluentui/react-jsx-runtime to v0.0.0-nightly-20240911-0407.1 ([commit](https://github.com/microsoft/fluentui/commit/ff229fb88be2148307d6b0497ad0c1a67db499c3) by beachball)
16
- - Bump @fluentui/react-shared-contexts to v0.0.0-nightly-20240911-0407.1 ([commit](https://github.com/microsoft/fluentui/commit/ff229fb88be2148307d6b0497ad0c1a67db499c3) by beachball)
17
- - Bump @fluentui/react-theme to v0.0.0-nightly-20240911-0407.1 ([commit](https://github.com/microsoft/fluentui/commit/ff229fb88be2148307d6b0497ad0c1a67db499c3) by beachball)
18
- - Bump @fluentui/react-utilities to v0.0.0-nightly-20240911-0407.1 ([commit](https://github.com/microsoft/fluentui/commit/ff229fb88be2148307d6b0497ad0c1a67db499c3) by beachball)
19
- - Bump @fluentui/react-conformance to v0.0.0-nightly-20240911-0407.1 ([commit](https://github.com/microsoft/fluentui/commit/ff229fb88be2148307d6b0497ad0c1a67db499c3) by beachball)
20
- - Bump @fluentui/react-conformance-griffel to v0.0.0-nightly-20240911-0407.1 ([commit](https://github.com/microsoft/fluentui/commit/ff229fb88be2148307d6b0497ad0c1a67db499c3) by beachball)
21
-
22
7
  ## [0.1.1](https://github.com/microsoft/fluentui/tree/@fluentui/react-icons-compat_v0.1.1)
23
8
 
24
- Tue, 10 Sep 2024 10:19:12 GMT
9
+ Tue, 10 Sep 2024 10:15:11 GMT
25
10
  [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-icons-compat_v0.1.0..@fluentui/react-icons-compat_v0.1.1)
26
11
 
27
12
  ### Patches
@@ -0,0 +1,87 @@
1
+ /**
2
+ * Gets an icon definition. If an icon is requested but the subset has yet to be registered,
3
+ * it will get registered immediately.
4
+ *
5
+ * @public
6
+ * @param name - Name of icon.
7
+ */
8
+ export declare function getIcon(name?: string): IconRecord | undefined;
9
+
10
+ export declare interface IconOptions {
11
+ /**
12
+ * By default, registering the same set of icons will generate a console warning per duplicate icon
13
+ * registered, because this scenario can create unexpected consequences.
14
+ *
15
+ * Some scenarios include:
16
+ *
17
+ * Icon set was previously registered using a different base url.
18
+ * Icon set was previously registered but a different version was provided.
19
+ * Icons in a previous registered set overlap with a new set.
20
+ *
21
+ * To simply ignore previously registered icons, you can specify to disable warnings. This means
22
+ * that if an icon which was previous registered is registered again, it will be silently ignored.
23
+ * However, consider whether the problems listed above will cause issues.
24
+ **/
25
+ disableWarnings: boolean;
26
+ /**
27
+ * @deprecated Use `disableWarnings` instead.
28
+ */
29
+ warnOnMissingIcons?: boolean;
30
+ }
31
+
32
+ export declare interface IconRecord {
33
+ code: string | undefined;
34
+ subset: IconSubsetRecord;
35
+ }
36
+
37
+ export declare interface IconRecords {
38
+ __options: IconOptions;
39
+ __remapped: {
40
+ [key: string]: string;
41
+ };
42
+ [key: string]: IconRecord | {};
43
+ }
44
+
45
+ export declare interface IconSubset {
46
+ icons: {
47
+ [key: string]: string | JSX.Element;
48
+ };
49
+ /**
50
+ * Indicates to the icon renderer that it is safe to merge any props on the original `Icon` element
51
+ * onto the child content element registered for the icon which are valid for HTML images.
52
+ */
53
+ mergeImageProps?: boolean;
54
+ }
55
+
56
+ export declare interface IconSubsetRecord extends IconSubset {
57
+ isRegistered?: boolean;
58
+ className?: string;
59
+ }
60
+
61
+ /**
62
+ * Remaps one icon name to another.
63
+ */
64
+ export declare function registerIconAlias(iconName: string, mappedToName: string): void;
65
+
66
+ /**
67
+ * Registers a given subset of icons.
68
+ *
69
+ * @param iconSubset - the icon subset definition.
70
+ */
71
+ export declare function registerIcons(iconSubset: IconSubset, options?: Partial<IconOptions>): void;
72
+
73
+ /**
74
+ * Sets the icon options.
75
+ *
76
+ * @public
77
+ */
78
+ export declare function setIconOptions(options: Partial<IconOptions>): void;
79
+
80
+ /**
81
+ * Unregisters icons by name.
82
+ *
83
+ * @param iconNames - List of icons to unregister.
84
+ */
85
+ export declare function unregisterIcons(iconNames: string[]): void;
86
+
87
+ export { }
@@ -0,0 +1,75 @@
1
+ import { getWindow } from './getWindow';
2
+ /**
3
+ * Storing global state in local module variables has issues when more than one copy
4
+ * of the module gets loaded on the page (due to a bundling error or simply by consuming
5
+ * a prebundled script.)
6
+ *
7
+ * This file contains helpers to deal with the getting and setting local state, and allows
8
+ * callers to get called back when it mutates.
9
+ */ const GLOBAL_SETTINGS_PROP_NAME = '__globalSettings__';
10
+ const CALLBACK_STATE_PROP_NAME = '__callbacks__';
11
+ let _counter = 0;
12
+ /**
13
+ * Global settings helper, which stores settings in the global (window) namespace.
14
+ * If window is not provided, it will store settings in module scope. Provides a
15
+ * way to observe changes as well when their values change.
16
+ *
17
+ * @public
18
+ */ export class GlobalSettings {
19
+ static getValue(key, defaultValue) {
20
+ const globalSettings = _getGlobalSettings();
21
+ if (globalSettings[key] === undefined) {
22
+ globalSettings[key] = typeof defaultValue === 'function' ? defaultValue() : defaultValue;
23
+ }
24
+ return globalSettings[key];
25
+ }
26
+ static setValue(key, value) {
27
+ const globalSettings = _getGlobalSettings();
28
+ const callbacks = globalSettings[CALLBACK_STATE_PROP_NAME];
29
+ const oldValue = globalSettings[key];
30
+ if (value !== oldValue) {
31
+ globalSettings[key] = value;
32
+ const changeDescription = {
33
+ oldValue,
34
+ value,
35
+ key
36
+ };
37
+ for(const id in callbacks){
38
+ if (callbacks.hasOwnProperty(id)) {
39
+ callbacks[id](changeDescription);
40
+ }
41
+ }
42
+ }
43
+ return value;
44
+ }
45
+ static addChangeListener(cb) {
46
+ // Note: we use generated ids on the callbacks to create a map of the callbacks, which optimizes removal.
47
+ // (It's faster to delete a key than it is to look up the index of an object and splice an array.)
48
+ let id = cb.__id__;
49
+ const callbacks = _getCallbacks();
50
+ if (!id) {
51
+ id = cb.__id__ = String(_counter++);
52
+ }
53
+ callbacks[id] = cb;
54
+ }
55
+ static removeChangeListener(cb) {
56
+ const callbacks = _getCallbacks();
57
+ delete callbacks[cb.__id__];
58
+ }
59
+ }
60
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
61
+ function _getGlobalSettings() {
62
+ const win = getWindow();
63
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
64
+ const globalObj = win || {};
65
+ if (!globalObj[GLOBAL_SETTINGS_PROP_NAME]) {
66
+ globalObj[GLOBAL_SETTINGS_PROP_NAME] = {
67
+ [CALLBACK_STATE_PROP_NAME]: {}
68
+ };
69
+ }
70
+ return globalObj[GLOBAL_SETTINGS_PROP_NAME];
71
+ }
72
+ function _getCallbacks() {
73
+ const globalSettings = _getGlobalSettings();
74
+ return globalSettings[CALLBACK_STATE_PROP_NAME];
75
+ }
@@ -0,0 +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"}
@@ -0,0 +1,25 @@
1
+ import { canUseDOM } from '@fluentui/react-utilities';
2
+ let _window = undefined;
3
+ // Note: Accessing "window" in IE11 is somewhat expensive, and calling "typeof window"
4
+ // hits a memory leak, whereas aliasing it and calling "typeof _window" does not.
5
+ // Caching the window value at the file scope lets us minimize the impact.
6
+ try {
7
+ // eslint-disable-next-line no-restricted-globals
8
+ _window = window;
9
+ } catch (e) {
10
+ /* no-op */ }
11
+ /**
12
+ * Helper to get the window object. The helper will make sure to use a cached variable
13
+ * of "window", to avoid overhead and memory leaks in IE11. Note that in popup scenarios the
14
+ * window object won't match the "global" window object, and for these scenarios, you should
15
+ * pass in an element hosted within the popup.
16
+ *
17
+ * @public
18
+ */ export function getWindow(rootElement) {
19
+ if (!canUseDOM() || typeof _window === 'undefined') {
20
+ return undefined;
21
+ } else {
22
+ const el = rootElement;
23
+ return el && el.ownerDocument && el.ownerDocument.defaultView ? el.ownerDocument.defaultView : _window;
24
+ }
25
+ }
@@ -0,0 +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 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,iDAAiD;IACjDD,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 ADDED
@@ -0,0 +1,143 @@
1
+ import * as React from 'react';
2
+ import { GlobalSettings } from './GlobalSettings';
3
+ const ICON_SETTING_NAME = 'icons';
4
+ const _iconSettings = GlobalSettings.getValue(ICON_SETTING_NAME, {
5
+ __options: {
6
+ disableWarnings: false,
7
+ warnOnMissingIcons: true
8
+ },
9
+ __remapped: {}
10
+ });
11
+ /**
12
+ * Normalizes an icon name for consistent mapping.
13
+ * Current implementation is to convert the icon name to lower case.
14
+ *
15
+ * @param name - Icon name to normalize.
16
+ * @returns {string} Normalized icon name to use for indexing and mapping.
17
+ */ const normalizeIconName = (name)=>name.toLowerCase();
18
+ /**
19
+ * Registers a given subset of icons.
20
+ *
21
+ * @param iconSubset - the icon subset definition.
22
+ */ export function registerIcons(iconSubset, options) {
23
+ const subset = {
24
+ ...iconSubset,
25
+ isRegistered: false,
26
+ className: undefined
27
+ };
28
+ const { icons } = iconSubset;
29
+ // Grab options, optionally mix user provided ones on top.
30
+ options = options ? {
31
+ ..._iconSettings.__options,
32
+ ...options
33
+ } : _iconSettings.__options;
34
+ for(const iconName in icons){
35
+ if (icons.hasOwnProperty(iconName)) {
36
+ const code = icons[iconName];
37
+ const normalizedIconName = normalizeIconName(iconName);
38
+ if (_iconSettings[normalizedIconName]) {
39
+ _warnDuplicateIcon(iconName);
40
+ } else {
41
+ _iconSettings[normalizedIconName] = {
42
+ code,
43
+ subset
44
+ };
45
+ }
46
+ }
47
+ }
48
+ }
49
+ /**
50
+ * Unregisters icons by name.
51
+ *
52
+ * @param iconNames - List of icons to unregister.
53
+ */ export function unregisterIcons(iconNames) {
54
+ const options = _iconSettings.__options;
55
+ for (const iconName of iconNames){
56
+ const normalizedIconName = normalizeIconName(iconName);
57
+ if (_iconSettings[normalizedIconName]) {
58
+ delete _iconSettings[normalizedIconName];
59
+ } else {
60
+ // Warn that we are trying to delete an icon that doesn't exist
61
+ if (!options.disableWarnings) {
62
+ // eslint-disable-next-line no-console
63
+ console.warn(`The icon "${iconName}" tried to unregister but was not registered.`);
64
+ }
65
+ }
66
+ // Delete any aliases for this iconName
67
+ if (_iconSettings.__remapped[normalizedIconName]) {
68
+ delete _iconSettings.__remapped[normalizedIconName];
69
+ }
70
+ // Delete any items that were an alias for this iconName
71
+ Object.keys(_iconSettings.__remapped).forEach((key)=>{
72
+ if (_iconSettings.__remapped[key] === normalizedIconName) {
73
+ delete _iconSettings.__remapped[key];
74
+ }
75
+ });
76
+ }
77
+ }
78
+ /**
79
+ * Remaps one icon name to another.
80
+ */ export function registerIconAlias(iconName, mappedToName) {
81
+ _iconSettings.__remapped[normalizeIconName(iconName)] = normalizeIconName(mappedToName);
82
+ }
83
+ /**
84
+ * Gets an icon definition. If an icon is requested but the subset has yet to be registered,
85
+ * it will get registered immediately.
86
+ *
87
+ * @public
88
+ * @param name - Name of icon.
89
+ */ export function getIcon(name) {
90
+ let icon = undefined;
91
+ const options = _iconSettings.__options;
92
+ name = name ? normalizeIconName(name) : '';
93
+ name = _iconSettings.__remapped[name] || name;
94
+ if (name) {
95
+ icon = _iconSettings[name];
96
+ if (icon) {
97
+ const { subset } = icon;
98
+ if (subset) {
99
+ if (!subset.isRegistered) {
100
+ subset.isRegistered = true;
101
+ }
102
+ }
103
+ } else {
104
+ // eslint-disable-next-line deprecation/deprecation
105
+ if (!options.disableWarnings && options.warnOnMissingIcons) {
106
+ // eslint-disable-next-line no-console
107
+ console.warn(`The icon "${name}" was used but not registered. See https://github.com/microsoft/fluentui/wiki/Using-icons for more information.`);
108
+ }
109
+ }
110
+ }
111
+ return icon;
112
+ }
113
+ /**
114
+ * Sets the icon options.
115
+ *
116
+ * @public
117
+ */ export function setIconOptions(options) {
118
+ _iconSettings.__options = {
119
+ ..._iconSettings.__options,
120
+ ...options
121
+ };
122
+ }
123
+ let _missingIcons = [];
124
+ // TODO: exclude types from this lint rule: https://github.com/microsoft/fluentui/issues/31286
125
+ // eslint-disable-next-line no-restricted-globals
126
+ let _missingIconsTimer = undefined;
127
+ function _warnDuplicateIcon(iconName) {
128
+ const options = _iconSettings.__options;
129
+ const warningDelay = 2000;
130
+ const maxIconsInMessage = 10;
131
+ if (!options.disableWarnings) {
132
+ _missingIcons.push(iconName);
133
+ if (_missingIconsTimer === undefined) {
134
+ // eslint-disable-next-line no-restricted-globals
135
+ _missingIconsTimer = setTimeout(()=>{
136
+ // eslint-disable-next-line no-console
137
+ 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)` : ''));
138
+ _missingIconsTimer = undefined;
139
+ _missingIcons = [];
140
+ }, warningDelay);
141
+ }
142
+ }
143
+ }
@@ -0,0 +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\n// eslint-disable-next-line no-restricted-globals\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 // eslint-disable-next-line no-restricted-globals\n _missingIconsTimer = 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,SAA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zF,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;QACL;IACF;AACF"}
package/lib/index.js ADDED
@@ -0,0 +1 @@
1
+ export { registerIcons, registerIconAlias, unregisterIcons, getIcon, setIconOptions } from './icon';
@@ -0,0 +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"}
@@ -0,0 +1,79 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "GlobalSettings", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return GlobalSettings;
9
+ }
10
+ });
11
+ const _getWindow = require("./getWindow");
12
+ /**
13
+ * Storing global state in local module variables has issues when more than one copy
14
+ * of the module gets loaded on the page (due to a bundling error or simply by consuming
15
+ * a prebundled script.)
16
+ *
17
+ * This file contains helpers to deal with the getting and setting local state, and allows
18
+ * callers to get called back when it mutates.
19
+ */ const GLOBAL_SETTINGS_PROP_NAME = '__globalSettings__';
20
+ const CALLBACK_STATE_PROP_NAME = '__callbacks__';
21
+ let _counter = 0;
22
+ class GlobalSettings {
23
+ static getValue(key, defaultValue) {
24
+ const globalSettings = _getGlobalSettings();
25
+ if (globalSettings[key] === undefined) {
26
+ globalSettings[key] = typeof defaultValue === 'function' ? defaultValue() : defaultValue;
27
+ }
28
+ return globalSettings[key];
29
+ }
30
+ static setValue(key, value) {
31
+ const globalSettings = _getGlobalSettings();
32
+ const callbacks = globalSettings[CALLBACK_STATE_PROP_NAME];
33
+ const oldValue = globalSettings[key];
34
+ if (value !== oldValue) {
35
+ globalSettings[key] = value;
36
+ const changeDescription = {
37
+ oldValue,
38
+ value,
39
+ key
40
+ };
41
+ for(const id in callbacks){
42
+ if (callbacks.hasOwnProperty(id)) {
43
+ callbacks[id](changeDescription);
44
+ }
45
+ }
46
+ }
47
+ return value;
48
+ }
49
+ static addChangeListener(cb) {
50
+ // Note: we use generated ids on the callbacks to create a map of the callbacks, which optimizes removal.
51
+ // (It's faster to delete a key than it is to look up the index of an object and splice an array.)
52
+ let id = cb.__id__;
53
+ const callbacks = _getCallbacks();
54
+ if (!id) {
55
+ id = cb.__id__ = String(_counter++);
56
+ }
57
+ callbacks[id] = cb;
58
+ }
59
+ static removeChangeListener(cb) {
60
+ const callbacks = _getCallbacks();
61
+ delete callbacks[cb.__id__];
62
+ }
63
+ }
64
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
65
+ function _getGlobalSettings() {
66
+ const win = (0, _getWindow.getWindow)();
67
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
68
+ const globalObj = win || {};
69
+ if (!globalObj[GLOBAL_SETTINGS_PROP_NAME]) {
70
+ globalObj[GLOBAL_SETTINGS_PROP_NAME] = {
71
+ [CALLBACK_STATE_PROP_NAME]: {}
72
+ };
73
+ }
74
+ return globalObj[GLOBAL_SETTINGS_PROP_NAME];
75
+ }
76
+ function _getCallbacks() {
77
+ const globalSettings = _getGlobalSettings();
78
+ return globalSettings[CALLBACK_STATE_PROP_NAME];
79
+ }
@@ -0,0 +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,aAAaA,iBAA+BA;QAC5F;QAEA,OAAOC,cAAc,CAACF,IAAI;IAC5B;IAEA,OAAcK,SAAYL,GAAW,EAAEM,KAAQ,EAAK;QAClD,MAAMJ,iBAAiBC;QACvB,MAAMI,YAAYL,cAAc,CAACL,yBAAyB;QAC1D,MAAMW,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,OAAOlB;QAC1B;QAEAS,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,MAAMC,IAAAA,oBAAAA;IACZ,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"}
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "getWindow", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return getWindow;
9
+ }
10
+ });
11
+ const _reactutilities = require("@fluentui/react-utilities");
12
+ let _window = undefined;
13
+ // Note: Accessing "window" in IE11 is somewhat expensive, and calling "typeof window"
14
+ // hits a memory leak, whereas aliasing it and calling "typeof _window" does not.
15
+ // Caching the window value at the file scope lets us minimize the impact.
16
+ try {
17
+ // eslint-disable-next-line no-restricted-globals
18
+ _window = window;
19
+ } catch (e) {
20
+ /* no-op */ }
21
+ function getWindow(rootElement) {
22
+ if (!(0, _reactutilities.canUseDOM)() || typeof _window === 'undefined') {
23
+ return undefined;
24
+ } else {
25
+ const el = rootElement;
26
+ return el && el.ownerDocument && el.ownerDocument.defaultView ? el.ownerDocument.defaultView : _window;
27
+ }
28
+ }
@@ -0,0 +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 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,iDAAiD;IACjDD,UAAUE;AACZ,EAAE,OAAOC,GAAG;AACV,SAAS,GACX;AAUO,SAASJ,UAAUK,WAA4B;IACpD,IAAI,CAACC,IAAAA,yBAAAA,OAAe,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"}
@@ -0,0 +1,151 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ function _export(target, all) {
6
+ for(var name in all)Object.defineProperty(target, name, {
7
+ enumerable: true,
8
+ get: all[name]
9
+ });
10
+ }
11
+ _export(exports, {
12
+ getIcon: function() {
13
+ return getIcon;
14
+ },
15
+ registerIconAlias: function() {
16
+ return registerIconAlias;
17
+ },
18
+ registerIcons: function() {
19
+ return registerIcons;
20
+ },
21
+ setIconOptions: function() {
22
+ return setIconOptions;
23
+ },
24
+ unregisterIcons: function() {
25
+ return unregisterIcons;
26
+ }
27
+ });
28
+ const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
29
+ const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
30
+ const _GlobalSettings = require("./GlobalSettings");
31
+ const ICON_SETTING_NAME = 'icons';
32
+ const _iconSettings = _GlobalSettings.GlobalSettings.getValue(ICON_SETTING_NAME, {
33
+ __options: {
34
+ disableWarnings: false,
35
+ warnOnMissingIcons: true
36
+ },
37
+ __remapped: {}
38
+ });
39
+ /**
40
+ * Normalizes an icon name for consistent mapping.
41
+ * Current implementation is to convert the icon name to lower case.
42
+ *
43
+ * @param name - Icon name to normalize.
44
+ * @returns {string} Normalized icon name to use for indexing and mapping.
45
+ */ const normalizeIconName = (name)=>name.toLowerCase();
46
+ function registerIcons(iconSubset, options) {
47
+ const subset = {
48
+ ...iconSubset,
49
+ isRegistered: false,
50
+ className: undefined
51
+ };
52
+ const { icons } = iconSubset;
53
+ // Grab options, optionally mix user provided ones on top.
54
+ options = options ? {
55
+ ..._iconSettings.__options,
56
+ ...options
57
+ } : _iconSettings.__options;
58
+ for(const iconName in icons){
59
+ if (icons.hasOwnProperty(iconName)) {
60
+ const code = icons[iconName];
61
+ const normalizedIconName = normalizeIconName(iconName);
62
+ if (_iconSettings[normalizedIconName]) {
63
+ _warnDuplicateIcon(iconName);
64
+ } else {
65
+ _iconSettings[normalizedIconName] = {
66
+ code,
67
+ subset
68
+ };
69
+ }
70
+ }
71
+ }
72
+ }
73
+ function unregisterIcons(iconNames) {
74
+ const options = _iconSettings.__options;
75
+ for (const iconName of iconNames){
76
+ const normalizedIconName = normalizeIconName(iconName);
77
+ if (_iconSettings[normalizedIconName]) {
78
+ delete _iconSettings[normalizedIconName];
79
+ } else {
80
+ // Warn that we are trying to delete an icon that doesn't exist
81
+ if (!options.disableWarnings) {
82
+ // eslint-disable-next-line no-console
83
+ console.warn(`The icon "${iconName}" tried to unregister but was not registered.`);
84
+ }
85
+ }
86
+ // Delete any aliases for this iconName
87
+ if (_iconSettings.__remapped[normalizedIconName]) {
88
+ delete _iconSettings.__remapped[normalizedIconName];
89
+ }
90
+ // Delete any items that were an alias for this iconName
91
+ Object.keys(_iconSettings.__remapped).forEach((key)=>{
92
+ if (_iconSettings.__remapped[key] === normalizedIconName) {
93
+ delete _iconSettings.__remapped[key];
94
+ }
95
+ });
96
+ }
97
+ }
98
+ function registerIconAlias(iconName, mappedToName) {
99
+ _iconSettings.__remapped[normalizeIconName(iconName)] = normalizeIconName(mappedToName);
100
+ }
101
+ function getIcon(name) {
102
+ let icon = undefined;
103
+ const options = _iconSettings.__options;
104
+ name = name ? normalizeIconName(name) : '';
105
+ name = _iconSettings.__remapped[name] || name;
106
+ if (name) {
107
+ icon = _iconSettings[name];
108
+ if (icon) {
109
+ const { subset } = icon;
110
+ if (subset) {
111
+ if (!subset.isRegistered) {
112
+ subset.isRegistered = true;
113
+ }
114
+ }
115
+ } else {
116
+ // eslint-disable-next-line deprecation/deprecation
117
+ if (!options.disableWarnings && options.warnOnMissingIcons) {
118
+ // eslint-disable-next-line no-console
119
+ console.warn(`The icon "${name}" was used but not registered. See https://github.com/microsoft/fluentui/wiki/Using-icons for more information.`);
120
+ }
121
+ }
122
+ }
123
+ return icon;
124
+ }
125
+ function setIconOptions(options) {
126
+ _iconSettings.__options = {
127
+ ..._iconSettings.__options,
128
+ ...options
129
+ };
130
+ }
131
+ let _missingIcons = [];
132
+ // TODO: exclude types from this lint rule: https://github.com/microsoft/fluentui/issues/31286
133
+ // eslint-disable-next-line no-restricted-globals
134
+ let _missingIconsTimer = undefined;
135
+ function _warnDuplicateIcon(iconName) {
136
+ const options = _iconSettings.__options;
137
+ const warningDelay = 2000;
138
+ const maxIconsInMessage = 10;
139
+ if (!options.disableWarnings) {
140
+ _missingIcons.push(iconName);
141
+ if (_missingIconsTimer === undefined) {
142
+ // eslint-disable-next-line no-restricted-globals
143
+ _missingIconsTimer = setTimeout(()=>{
144
+ // eslint-disable-next-line no-console
145
+ 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)` : ''));
146
+ _missingIconsTimer = undefined;
147
+ _missingIcons = [];
148
+ }, warningDelay);
149
+ }
150
+ }
151
+ }
@@ -0,0 +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\n// eslint-disable-next-line no-restricted-globals\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 // eslint-disable-next-line no-restricted-globals\n _missingIconsTimer = 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,eAAA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AAM8B,eAAe;IACrB,MAAMC,oBAAoB;IAE1B,IAAI,CAACvB,QAAQP,eAAe,EAAE;QAC5B2B,cAAcI,IAAI,CAAClB;QACnB,IAAIe,uBAAuBjB,WAAW;YACpC,iDAAiD;YACjDiB,qBAAqBI,WAAW;gBAC9B,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,EAAA;gBAE1GF,qBAAqBjB;gBACrBgB,gBAAgB,EAAE;YACpB,GAAGE;QACL;IACF;AACF"}
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ function _export(target, all) {
6
+ for(var name in all)Object.defineProperty(target, name, {
7
+ enumerable: true,
8
+ get: all[name]
9
+ });
10
+ }
11
+ _export(exports, {
12
+ getIcon: function() {
13
+ return _icon.getIcon;
14
+ },
15
+ registerIconAlias: function() {
16
+ return _icon.registerIconAlias;
17
+ },
18
+ registerIcons: function() {
19
+ return _icon.registerIcons;
20
+ },
21
+ setIconOptions: function() {
22
+ return _icon.setIconOptions;
23
+ },
24
+ unregisterIcons: function() {
25
+ return _icon.unregisterIcons;
26
+ }
27
+ });
28
+ const _icon = require("./icon");
@@ -0,0 +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"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluentui/react-icons-compat",
3
- "version": "0.0.0-nightly-20240911-0407.1",
3
+ "version": "0.1.1",
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",
@@ -29,16 +29,16 @@
29
29
  },
30
30
  "devDependencies": {
31
31
  "@fluentui/eslint-plugin": "*",
32
- "@fluentui/react-conformance": "0.0.0-nightly-20240911-0407.1",
33
- "@fluentui/react-conformance-griffel": "0.0.0-nightly-20240911-0407.1",
32
+ "@fluentui/react-conformance": "*",
33
+ "@fluentui/react-conformance-griffel": "*",
34
34
  "@fluentui/scripts-api-extractor": "*",
35
35
  "@fluentui/scripts-tasks": "*"
36
36
  },
37
37
  "dependencies": {
38
- "@fluentui/react-jsx-runtime": "0.0.0-nightly-20240911-0407.1",
39
- "@fluentui/react-shared-contexts": "0.0.0-nightly-20240911-0407.1",
40
- "@fluentui/react-theme": "0.0.0-nightly-20240911-0407.1",
41
- "@fluentui/react-utilities": "0.0.0-nightly-20240911-0407.1",
38
+ "@fluentui/react-jsx-runtime": "^9.0.43",
39
+ "@fluentui/react-shared-contexts": "^9.20.0",
40
+ "@fluentui/react-theme": "^9.1.19",
41
+ "@fluentui/react-utilities": "^9.18.14",
42
42
  "@griffel/react": "^1.5.22",
43
43
  "@swc/helpers": "^0.5.1"
44
44
  },
@@ -57,5 +57,10 @@
57
57
  },
58
58
  "./package.json": "./package.json"
59
59
  },
60
- "beachball": {}
60
+ "beachball": {
61
+ "disallowedChangeTypes": [
62
+ "major",
63
+ "prerelease"
64
+ ]
65
+ }
61
66
  }