@fluentui/react-icons-compat 0.1.2 → 0.1.3

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,12 +1,24 @@
1
1
  # Change Log - @fluentui/react-icons-compat
2
2
 
3
- This log was last generated on Mon, 23 Sep 2024 12:36:04 GMT and should not be manually modified.
3
+ This log was last generated on Tue, 15 Oct 2024 17:13:32 GMT and should not be manually modified.
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
+ ## [0.1.3](https://github.com/microsoft/fluentui/tree/@fluentui/react-icons-compat_v0.1.3)
8
+
9
+ Tue, 15 Oct 2024 17:13:32 GMT
10
+ [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-icons-compat_v0.1.2..@fluentui/react-icons-compat_v0.1.3)
11
+
12
+ ### Patches
13
+
14
+ - Bump @fluentui/react-jsx-runtime to v9.0.45 ([PR #32999](https://github.com/microsoft/fluentui/pull/32999) by beachball)
15
+ - Bump @fluentui/react-shared-contexts to v9.20.2 ([PR #32999](https://github.com/microsoft/fluentui/pull/32999) by beachball)
16
+ - Bump @fluentui/react-theme to v9.1.21 ([PR #32999](https://github.com/microsoft/fluentui/pull/32999) by beachball)
17
+ - Bump @fluentui/react-utilities to v9.18.16 ([PR #32999](https://github.com/microsoft/fluentui/pull/32999) by beachball)
18
+
7
19
  ## [0.1.2](https://github.com/microsoft/fluentui/tree/@fluentui/react-icons-compat_v0.1.2)
8
20
 
9
- Mon, 23 Sep 2024 12:36:04 GMT
21
+ Mon, 23 Sep 2024 12:40:17 GMT
10
22
  [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-icons-compat_v0.1.1..@fluentui/react-icons-compat_v0.1.2)
11
23
 
12
24
  ### Patches
package/lib/getWindow.js CHANGED
@@ -4,7 +4,7 @@ let _window = undefined;
4
4
  // hits a memory leak, whereas aliasing it and calling "typeof _window" does not.
5
5
  // Caching the window value at the file scope lets us minimize the impact.
6
6
  try {
7
- // eslint-disable-next-line no-restricted-globals
7
+ // eslint-disable-next-line @nx/workspace-no-restricted-globals
8
8
  _window = window;
9
9
  } catch (e) {
10
10
  /* no-op */ }
@@ -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 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"}
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"}
package/lib/icon.js CHANGED
@@ -122,7 +122,6 @@ const _iconSettings = GlobalSettings.getValue(ICON_SETTING_NAME, {
122
122
  }
123
123
  let _missingIcons = [];
124
124
  // TODO: exclude types from this lint rule: https://github.com/microsoft/fluentui/issues/31286
125
- // eslint-disable-next-line no-restricted-globals
126
125
  let _missingIconsTimer = undefined;
127
126
  function _warnDuplicateIcon(iconName) {
128
127
  const options = _iconSettings.__options;
@@ -131,8 +130,8 @@ function _warnDuplicateIcon(iconName) {
131
130
  if (!options.disableWarnings) {
132
131
  _missingIcons.push(iconName);
133
132
  if (_missingIconsTimer === undefined) {
134
- // eslint-disable-next-line no-restricted-globals
135
- _missingIconsTimer = setTimeout(()=>{
133
+ _missingIconsTimer = // eslint-disable-next-line @nx/workspace-no-restricted-globals
134
+ setTimeout(()=>{
136
135
  // eslint-disable-next-line no-console
137
136
  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
137
  _missingIconsTimer = undefined;
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\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,U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QC,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;QACL;IACF;AACF"}
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;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,CAAC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R,MAAM,EAAErB,MAAM,EAAE,GAAGqB;YACnB,IAAIrB,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"}
@@ -14,7 +14,7 @@ let _window = undefined;
14
14
  // hits a memory leak, whereas aliasing it and calling "typeof _window" does not.
15
15
  // Caching the window value at the file scope lets us minimize the impact.
16
16
  try {
17
- // eslint-disable-next-line no-restricted-globals
17
+ // eslint-disable-next-line @nx/workspace-no-restricted-globals
18
18
  _window = window;
19
19
  } catch (e) {
20
20
  /* no-op */ }
@@ -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 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"}
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,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"}
@@ -130,7 +130,6 @@ function setIconOptions(options) {
130
130
  }
131
131
  let _missingIcons = [];
132
132
  // TODO: exclude types from this lint rule: https://github.com/microsoft/fluentui/issues/31286
133
- // eslint-disable-next-line no-restricted-globals
134
133
  let _missingIconsTimer = undefined;
135
134
  function _warnDuplicateIcon(iconName) {
136
135
  const options = _iconSettings.__options;
@@ -139,7 +138,6 @@ function _warnDuplicateIcon(iconName) {
139
138
  if (!options.disableWarnings) {
140
139
  _missingIcons.push(iconName);
141
140
  if (_missingIconsTimer === undefined) {
142
- // eslint-disable-next-line no-restricted-globals
143
141
  _missingIconsTimer = setTimeout(()=>{
144
142
  // eslint-disable-next-line no-console
145
143
  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)` : ''));
@@ -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\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,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,UAAU;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,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"}
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,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,OAA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OAAOC,YAAY,GAAG;gBACxB;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,qBAEEI,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,EAAA;gBAE1GF,qBAAqBjB;gBACrBgB,gBAAgB,EAAE;YACpB,GAAGE;QACP;IACF;AACF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluentui/react-icons-compat",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
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",
@@ -35,10 +35,10 @@
35
35
  "@fluentui/scripts-tasks": "*"
36
36
  },
37
37
  "dependencies": {
38
- "@fluentui/react-jsx-runtime": "^9.0.44",
39
- "@fluentui/react-shared-contexts": "^9.20.1",
40
- "@fluentui/react-theme": "^9.1.20",
41
- "@fluentui/react-utilities": "^9.18.15",
38
+ "@fluentui/react-jsx-runtime": "^9.0.45",
39
+ "@fluentui/react-shared-contexts": "^9.20.2",
40
+ "@fluentui/react-theme": "^9.1.21",
41
+ "@fluentui/react-utilities": "^9.18.16",
42
42
  "@griffel/react": "^1.5.22",
43
43
  "@swc/helpers": "^0.5.1"
44
44
  },