rn-iconify 1.0.0 → 2.0.0
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/README.md +47 -235
- package/babel.js +14 -0
- package/lib/commonjs/IconRenderer.js +91 -4
- package/lib/commonjs/IconRenderer.js.map +1 -1
- package/lib/commonjs/accessibility/AccessibilityProvider.js +189 -0
- package/lib/commonjs/accessibility/AccessibilityProvider.js.map +1 -0
- package/lib/commonjs/accessibility/index.js +87 -0
- package/lib/commonjs/accessibility/index.js.map +1 -0
- package/lib/commonjs/accessibility/types.js +6 -0
- package/lib/commonjs/accessibility/types.js.map +1 -0
- package/lib/commonjs/accessibility/useAccessibleIcon.js +119 -0
- package/lib/commonjs/accessibility/useAccessibleIcon.js.map +1 -0
- package/lib/commonjs/accessibility/utils.js +231 -0
- package/lib/commonjs/accessibility/utils.js.map +1 -0
- package/lib/commonjs/alias/Icon.js +113 -0
- package/lib/commonjs/alias/Icon.js.map +1 -0
- package/lib/commonjs/alias/IconAliasContext.js +177 -0
- package/lib/commonjs/alias/IconAliasContext.js.map +1 -0
- package/lib/commonjs/alias/createIconAliases.js +222 -0
- package/lib/commonjs/alias/createIconAliases.js.map +1 -0
- package/lib/commonjs/alias/index.js +57 -0
- package/lib/commonjs/alias/index.js.map +1 -0
- package/lib/commonjs/alias/types.js +6 -0
- package/lib/commonjs/alias/types.js.map +1 -0
- package/lib/commonjs/animated/AnimatedIcon.js +116 -0
- package/lib/commonjs/animated/AnimatedIcon.js.map +1 -0
- package/lib/commonjs/animated/index.js +76 -0
- package/lib/commonjs/animated/index.js.map +1 -0
- package/lib/commonjs/animated/presets.js +220 -0
- package/lib/commonjs/animated/presets.js.map +1 -0
- package/lib/commonjs/animated/types.js +71 -0
- package/lib/commonjs/animated/types.js.map +1 -0
- package/lib/commonjs/animated/useIconAnimation.js +313 -0
- package/lib/commonjs/animated/useIconAnimation.js.map +1 -0
- package/lib/commonjs/babel/ast-utils.js +214 -0
- package/lib/commonjs/babel/ast-utils.js.map +1 -0
- package/lib/commonjs/babel/cache-writer.js +281 -0
- package/lib/commonjs/babel/cache-writer.js.map +1 -0
- package/lib/commonjs/babel/collector.js +219 -0
- package/lib/commonjs/babel/collector.js.map +1 -0
- package/lib/commonjs/babel/index.js +104 -0
- package/lib/commonjs/babel/index.js.map +1 -0
- package/lib/commonjs/babel/plugin.js +226 -0
- package/lib/commonjs/babel/plugin.js.map +1 -0
- package/lib/commonjs/babel/types.js +485 -0
- package/lib/commonjs/babel/types.js.map +1 -0
- package/lib/commonjs/bundle/index.js +213 -0
- package/lib/commonjs/bundle/index.js.map +1 -0
- package/lib/commonjs/cache/CacheManager.js +105 -6
- package/lib/commonjs/cache/CacheManager.js.map +1 -1
- package/lib/commonjs/cli/commands/analyze.js +171 -0
- package/lib/commonjs/cli/commands/analyze.js.map +1 -0
- package/lib/commonjs/cli/commands/bundle.js +214 -0
- package/lib/commonjs/cli/commands/bundle.js.map +1 -0
- package/lib/commonjs/cli/index.js +142 -0
- package/lib/commonjs/cli/index.js.map +1 -0
- package/lib/commonjs/cli/parser.js +260 -0
- package/lib/commonjs/cli/parser.js.map +1 -0
- package/lib/commonjs/cli/types.js +42 -0
- package/lib/commonjs/cli/types.js.map +1 -0
- package/lib/commonjs/config/ConfigManager.js +182 -0
- package/lib/commonjs/config/ConfigManager.js.map +1 -0
- package/lib/commonjs/config/index.js +44 -0
- package/lib/commonjs/config/index.js.map +1 -0
- package/lib/commonjs/config/types.js +55 -0
- package/lib/commonjs/config/types.js.map +1 -0
- package/lib/commonjs/createIconSet.js +49 -11
- package/lib/commonjs/createIconSet.js.map +1 -1
- package/lib/commonjs/explorer/IconExplorer.js +827 -0
- package/lib/commonjs/explorer/IconExplorer.js.map +1 -0
- package/lib/commonjs/explorer/iconSets.js +303 -0
- package/lib/commonjs/explorer/iconSets.js.map +1 -0
- package/lib/commonjs/explorer/index.js +93 -0
- package/lib/commonjs/explorer/index.js.map +1 -0
- package/lib/commonjs/explorer/types.js +6 -0
- package/lib/commonjs/explorer/types.js.map +1 -0
- package/lib/commonjs/explorer/useExplorer.js +359 -0
- package/lib/commonjs/explorer/useExplorer.js.map +1 -0
- package/lib/commonjs/index.js +618 -12
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/navigation/createDrawerIcon.js +129 -0
- package/lib/commonjs/navigation/createDrawerIcon.js.map +1 -0
- package/lib/commonjs/navigation/createHeaderIcon.js +185 -0
- package/lib/commonjs/navigation/createHeaderIcon.js.map +1 -0
- package/lib/commonjs/navigation/createTabBarIcon.js +178 -0
- package/lib/commonjs/navigation/createTabBarIcon.js.map +1 -0
- package/lib/commonjs/navigation/index.js +83 -0
- package/lib/commonjs/navigation/index.js.map +1 -0
- package/lib/commonjs/navigation/types.js +94 -0
- package/lib/commonjs/navigation/types.js.map +1 -0
- package/lib/commonjs/navigation/useNavigationIcon.js +128 -0
- package/lib/commonjs/navigation/useNavigationIcon.js.map +1 -0
- package/lib/commonjs/network/IconifyAPI.js +154 -14
- package/lib/commonjs/network/IconifyAPI.js.map +1 -1
- package/lib/commonjs/network/index.js +18 -0
- package/lib/commonjs/network/index.js.map +1 -1
- package/lib/commonjs/performance/PerformanceMonitor.js +327 -0
- package/lib/commonjs/performance/PerformanceMonitor.js.map +1 -0
- package/lib/commonjs/performance/index.js +43 -0
- package/lib/commonjs/performance/index.js.map +1 -0
- package/lib/commonjs/performance/types.js +2 -0
- package/lib/commonjs/performance/types.js.map +1 -0
- package/lib/commonjs/placeholder/PlaceholderFactory.js +111 -0
- package/lib/commonjs/placeholder/PlaceholderFactory.js.map +1 -0
- package/lib/commonjs/placeholder/Pulse.js +77 -0
- package/lib/commonjs/placeholder/Pulse.js.map +1 -0
- package/lib/commonjs/placeholder/Shimmer.js +95 -0
- package/lib/commonjs/placeholder/Shimmer.js.map +1 -0
- package/lib/commonjs/placeholder/Skeleton.js +52 -0
- package/lib/commonjs/placeholder/Skeleton.js.map +1 -0
- package/lib/commonjs/placeholder/index.js +41 -0
- package/lib/commonjs/placeholder/index.js.map +1 -0
- package/lib/commonjs/placeholder/types.js +40 -0
- package/lib/commonjs/placeholder/types.js.map +1 -0
- package/lib/commonjs/theme/IconThemeProvider.js +96 -0
- package/lib/commonjs/theme/IconThemeProvider.js.map +1 -0
- package/lib/commonjs/theme/context.js +53 -0
- package/lib/commonjs/theme/context.js.map +1 -0
- package/lib/commonjs/theme/index.js +52 -0
- package/lib/commonjs/theme/index.js.map +1 -0
- package/lib/commonjs/theme/types.js +39 -0
- package/lib/commonjs/theme/types.js.map +1 -0
- package/lib/commonjs/theme/useIconTheme.js +121 -0
- package/lib/commonjs/theme/useIconTheme.js.map +1 -0
- package/lib/module/IconRenderer.js +92 -5
- package/lib/module/IconRenderer.js.map +1 -1
- package/lib/module/accessibility/AccessibilityProvider.js +179 -0
- package/lib/module/accessibility/AccessibilityProvider.js.map +1 -0
- package/lib/module/accessibility/index.js +42 -0
- package/lib/module/accessibility/index.js.map +1 -0
- package/lib/module/accessibility/types.js +2 -0
- package/lib/module/accessibility/types.js.map +1 -0
- package/lib/module/accessibility/useAccessibleIcon.js +112 -0
- package/lib/module/accessibility/useAccessibleIcon.js.map +1 -0
- package/lib/module/accessibility/utils.js +221 -0
- package/lib/module/accessibility/utils.js.map +1 -0
- package/lib/module/alias/Icon.js +105 -0
- package/lib/module/alias/Icon.js.map +1 -0
- package/lib/module/alias/IconAliasContext.js +166 -0
- package/lib/module/alias/IconAliasContext.js.map +1 -0
- package/lib/module/alias/createIconAliases.js +213 -0
- package/lib/module/alias/createIconAliases.js.map +1 -0
- package/lib/module/alias/index.js +45 -0
- package/lib/module/alias/index.js.map +1 -0
- package/lib/module/alias/types.js +2 -0
- package/lib/module/alias/types.js.map +1 -0
- package/lib/module/animated/AnimatedIcon.js +109 -0
- package/lib/module/animated/AnimatedIcon.js.map +1 -0
- package/lib/module/animated/index.js +80 -0
- package/lib/module/animated/index.js.map +1 -0
- package/lib/module/animated/presets.js +209 -0
- package/lib/module/animated/presets.js.map +1 -0
- package/lib/module/animated/types.js +65 -0
- package/lib/module/animated/types.js.map +1 -0
- package/lib/module/animated/useIconAnimation.js +306 -0
- package/lib/module/animated/useIconAnimation.js.map +1 -0
- package/lib/module/babel/ast-utils.js +201 -0
- package/lib/module/babel/ast-utils.js.map +1 -0
- package/lib/module/babel/cache-writer.js +269 -0
- package/lib/module/babel/cache-writer.js.map +1 -0
- package/lib/module/babel/collector.js +214 -0
- package/lib/module/babel/collector.js.map +1 -0
- package/lib/module/babel/index.js +51 -0
- package/lib/module/babel/index.js.map +1 -0
- package/lib/module/babel/plugin.js +220 -0
- package/lib/module/babel/plugin.js.map +1 -0
- package/lib/module/babel/types.js +476 -0
- package/lib/module/babel/types.js.map +1 -0
- package/lib/module/bundle/index.js +205 -0
- package/lib/module/bundle/index.js.map +1 -0
- package/lib/module/cache/CacheManager.js +106 -6
- package/lib/module/cache/CacheManager.js.map +1 -1
- package/lib/module/cli/commands/analyze.js +166 -0
- package/lib/module/cli/commands/analyze.js.map +1 -0
- package/lib/module/cli/commands/bundle.js +208 -0
- package/lib/module/cli/commands/bundle.js.map +1 -0
- package/lib/module/cli/index.js +140 -0
- package/lib/module/cli/index.js.map +1 -0
- package/lib/module/cli/parser.js +251 -0
- package/lib/module/cli/parser.js.map +1 -0
- package/lib/module/cli/types.js +36 -0
- package/lib/module/cli/types.js.map +1 -0
- package/lib/module/components/index.js +27 -1
- package/lib/module/components/index.js.map +1 -1
- package/lib/module/config/ConfigManager.js +173 -0
- package/lib/module/config/ConfigManager.js.map +1 -0
- package/lib/module/config/index.js +28 -0
- package/lib/module/config/index.js.map +1 -0
- package/lib/module/config/types.js +49 -0
- package/lib/module/config/types.js.map +1 -0
- package/lib/module/createIconSet.js +49 -11
- package/lib/module/createIconSet.js.map +1 -1
- package/lib/module/explorer/IconExplorer.js +817 -0
- package/lib/module/explorer/IconExplorer.js.map +1 -0
- package/lib/module/explorer/iconSets.js +291 -0
- package/lib/module/explorer/iconSets.js.map +1 -0
- package/lib/module/explorer/index.js +42 -0
- package/lib/module/explorer/index.js.map +1 -0
- package/lib/module/explorer/types.js +2 -0
- package/lib/module/explorer/types.js.map +1 -0
- package/lib/module/explorer/useExplorer.js +353 -0
- package/lib/module/explorer/useExplorer.js.map +1 -0
- package/lib/module/index.js +26 -11
- package/lib/module/index.js.map +1 -1
- package/lib/module/navigation/createDrawerIcon.js +121 -0
- package/lib/module/navigation/createDrawerIcon.js.map +1 -0
- package/lib/module/navigation/createHeaderIcon.js +175 -0
- package/lib/module/navigation/createHeaderIcon.js.map +1 -0
- package/lib/module/navigation/createTabBarIcon.js +168 -0
- package/lib/module/navigation/createTabBarIcon.js.map +1 -0
- package/lib/module/navigation/index.js +59 -0
- package/lib/module/navigation/index.js.map +1 -0
- package/lib/module/navigation/types.js +88 -0
- package/lib/module/navigation/types.js.map +1 -0
- package/lib/module/navigation/useNavigationIcon.js +121 -0
- package/lib/module/navigation/useNavigationIcon.js.map +1 -0
- package/lib/module/network/IconifyAPI.js +152 -14
- package/lib/module/network/IconifyAPI.js.map +1 -1
- package/lib/module/network/index.js +1 -1
- package/lib/module/network/index.js.map +1 -1
- package/lib/module/performance/PerformanceMonitor.js +317 -0
- package/lib/module/performance/PerformanceMonitor.js.map +1 -0
- package/lib/module/performance/index.js +26 -0
- package/lib/module/performance/index.js.map +1 -0
- package/lib/module/performance/types.js +2 -0
- package/lib/module/performance/types.js.map +1 -0
- package/lib/module/placeholder/PlaceholderFactory.js +105 -0
- package/lib/module/placeholder/PlaceholderFactory.js.map +1 -0
- package/lib/module/placeholder/Pulse.js +70 -0
- package/lib/module/placeholder/Pulse.js.map +1 -0
- package/lib/module/placeholder/Shimmer.js +88 -0
- package/lib/module/placeholder/Shimmer.js.map +1 -0
- package/lib/module/placeholder/Skeleton.js +45 -0
- package/lib/module/placeholder/Skeleton.js.map +1 -0
- package/lib/module/placeholder/index.js +15 -0
- package/lib/module/placeholder/index.js.map +1 -0
- package/lib/module/placeholder/types.js +34 -0
- package/lib/module/placeholder/types.js.map +1 -0
- package/lib/module/theme/IconThemeProvider.js +89 -0
- package/lib/module/theme/IconThemeProvider.js.map +1 -0
- package/lib/module/theme/context.js +47 -0
- package/lib/module/theme/context.js.map +1 -0
- package/lib/module/theme/index.js +19 -0
- package/lib/module/theme/index.js.map +1 -0
- package/lib/module/theme/types.js +33 -0
- package/lib/module/theme/types.js.map +1 -0
- package/lib/module/theme/useIconTheme.js +114 -0
- package/lib/module/theme/useIconTheme.js.map +1 -0
- package/lib/typescript/IconRenderer.d.ts +1 -1
- package/lib/typescript/IconRenderer.d.ts.map +1 -1
- package/lib/typescript/accessibility/AccessibilityProvider.d.ts +57 -0
- package/lib/typescript/accessibility/AccessibilityProvider.d.ts.map +1 -0
- package/lib/typescript/accessibility/index.d.ts +37 -0
- package/lib/typescript/accessibility/index.d.ts.map +1 -0
- package/lib/typescript/accessibility/types.d.ts +130 -0
- package/lib/typescript/accessibility/types.d.ts.map +1 -0
- package/lib/typescript/accessibility/useAccessibleIcon.d.ts +111 -0
- package/lib/typescript/accessibility/useAccessibleIcon.d.ts.map +1 -0
- package/lib/typescript/accessibility/utils.d.ts +29 -0
- package/lib/typescript/accessibility/utils.d.ts.map +1 -0
- package/lib/typescript/alias/Icon.d.ts +38 -0
- package/lib/typescript/alias/Icon.d.ts.map +1 -0
- package/lib/typescript/alias/IconAliasContext.d.ts +52 -0
- package/lib/typescript/alias/IconAliasContext.d.ts.map +1 -0
- package/lib/typescript/alias/createIconAliases.d.ts +77 -0
- package/lib/typescript/alias/createIconAliases.d.ts.map +1 -0
- package/lib/typescript/alias/index.d.ts +36 -0
- package/lib/typescript/alias/index.d.ts.map +1 -0
- package/lib/typescript/alias/types.d.ts +115 -0
- package/lib/typescript/alias/types.d.ts.map +1 -0
- package/lib/typescript/animated/AnimatedIcon.d.ts +45 -0
- package/lib/typescript/animated/AnimatedIcon.d.ts.map +1 -0
- package/lib/typescript/animated/index.d.ts +70 -0
- package/lib/typescript/animated/index.d.ts.map +1 -0
- package/lib/typescript/animated/presets.d.ts +35 -0
- package/lib/typescript/animated/presets.d.ts.map +1 -0
- package/lib/typescript/animated/types.d.ts +196 -0
- package/lib/typescript/animated/types.d.ts.map +1 -0
- package/lib/typescript/animated/useIconAnimation.d.ts +64 -0
- package/lib/typescript/animated/useIconAnimation.d.ts.map +1 -0
- package/lib/typescript/babel/ast-utils.d.ts +52 -0
- package/lib/typescript/babel/ast-utils.d.ts.map +1 -0
- package/lib/typescript/babel/cache-writer.d.ts +56 -0
- package/lib/typescript/babel/cache-writer.d.ts.map +1 -0
- package/lib/typescript/babel/collector.d.ts +107 -0
- package/lib/typescript/babel/collector.d.ts.map +1 -0
- package/lib/typescript/babel/index.d.ts +47 -0
- package/lib/typescript/babel/index.d.ts.map +1 -0
- package/lib/typescript/babel/plugin.d.ts +17 -0
- package/lib/typescript/babel/plugin.d.ts.map +1 -0
- package/lib/typescript/babel/types.d.ts +129 -0
- package/lib/typescript/babel/types.d.ts.map +1 -0
- package/lib/typescript/bundle/index.d.ts +161 -0
- package/lib/typescript/bundle/index.d.ts.map +1 -0
- package/lib/typescript/cache/CacheManager.d.ts +52 -4
- package/lib/typescript/cache/CacheManager.d.ts.map +1 -1
- package/lib/typescript/cli/commands/analyze.d.ts +10 -0
- package/lib/typescript/cli/commands/analyze.d.ts.map +1 -0
- package/lib/typescript/cli/commands/bundle.d.ts +10 -0
- package/lib/typescript/cli/commands/bundle.d.ts.map +1 -0
- package/lib/typescript/cli/index.d.ts +7 -0
- package/lib/typescript/cli/index.d.ts.map +1 -0
- package/lib/typescript/cli/parser.d.ts +18 -0
- package/lib/typescript/cli/parser.d.ts.map +1 -0
- package/lib/typescript/cli/types.d.ts +157 -0
- package/lib/typescript/cli/types.d.ts.map +1 -0
- package/lib/typescript/components/Academicons.d.ts +1 -1
- package/lib/typescript/components/AkarIcons.d.ts +1 -1
- package/lib/typescript/components/AntDesign.d.ts +1 -1
- package/lib/typescript/components/Arcticons.d.ts +1 -1
- package/lib/typescript/components/Basil.d.ts +1 -1
- package/lib/typescript/components/Bi.d.ts +1 -1
- package/lib/typescript/components/BitcoinIcons.d.ts +1 -1
- package/lib/typescript/components/Bpmn.d.ts +1 -1
- package/lib/typescript/components/Brandico.d.ts +1 -1
- package/lib/typescript/components/Bx.d.ts +1 -1
- package/lib/typescript/components/Bxl.d.ts +1 -1
- package/lib/typescript/components/Bxs.d.ts +1 -1
- package/lib/typescript/components/Bytesize.d.ts +1 -1
- package/lib/typescript/components/Carbon.d.ts +1 -1
- package/lib/typescript/components/Catppuccin.d.ts +1 -1
- package/lib/typescript/components/Cbi.d.ts +1 -1
- package/lib/typescript/components/Charm.d.ts +1 -1
- package/lib/typescript/components/Ci.d.ts +1 -1
- package/lib/typescript/components/Cib.d.ts +1 -1
- package/lib/typescript/components/Cif.d.ts +1 -1
- package/lib/typescript/components/Cil.d.ts +1 -1
- package/lib/typescript/components/CircleFlags.d.ts +1 -1
- package/lib/typescript/components/Circum.d.ts +1 -1
- package/lib/typescript/components/Clarity.d.ts +1 -1
- package/lib/typescript/components/Codex.d.ts +1 -1
- package/lib/typescript/components/Codicon.d.ts +1 -1
- package/lib/typescript/components/Covid.d.ts +1 -1
- package/lib/typescript/components/Cryptocurrency.d.ts +1 -1
- package/lib/typescript/components/CryptocurrencyColor.d.ts +1 -1
- package/lib/typescript/components/Cuida.d.ts +1 -1
- package/lib/typescript/components/Dashicons.d.ts +1 -1
- package/lib/typescript/components/Devicon.d.ts +1 -1
- package/lib/typescript/components/DeviconPlain.d.ts +1 -1
- package/lib/typescript/components/DinkieIcons.d.ts +1 -1
- package/lib/typescript/components/DuoIcons.d.ts +1 -1
- package/lib/typescript/components/Ei.d.ts +1 -1
- package/lib/typescript/components/El.d.ts +1 -1
- package/lib/typescript/components/EmojioneMonotone.d.ts +1 -1
- package/lib/typescript/components/Entypo.d.ts +1 -1
- package/lib/typescript/components/EntypoSocial.d.ts +1 -1
- package/lib/typescript/components/EosIcons.d.ts +1 -1
- package/lib/typescript/components/Ep.d.ts +1 -1
- package/lib/typescript/components/Et.d.ts +1 -1
- package/lib/typescript/components/Eva.d.ts +1 -1
- package/lib/typescript/components/F7.d.ts +1 -1
- package/lib/typescript/components/Fa.d.ts +1 -1
- package/lib/typescript/components/Fa6Brands.d.ts +1 -1
- package/lib/typescript/components/Fa6Regular.d.ts +1 -1
- package/lib/typescript/components/Fa6Solid.d.ts +1 -1
- package/lib/typescript/components/Fa7Brands.d.ts +1 -1
- package/lib/typescript/components/Fa7Regular.d.ts +1 -1
- package/lib/typescript/components/Fa7Solid.d.ts +1 -1
- package/lib/typescript/components/FaBrands.d.ts +1 -1
- package/lib/typescript/components/FaRegular.d.ts +1 -1
- package/lib/typescript/components/FaSolid.d.ts +1 -1
- package/lib/typescript/components/Fad.d.ts +1 -1
- package/lib/typescript/components/Famicons.d.ts +1 -1
- package/lib/typescript/components/Fe.d.ts +1 -1
- package/lib/typescript/components/Feather.d.ts +1 -1
- package/lib/typescript/components/FileIcons.d.ts +1 -1
- package/lib/typescript/components/Flag.d.ts +1 -1
- package/lib/typescript/components/Flagpack.d.ts +1 -1
- package/lib/typescript/components/FlatUi.d.ts +1 -1
- package/lib/typescript/components/Flowbite.d.ts +1 -1
- package/lib/typescript/components/Fluent.d.ts +1 -1
- package/lib/typescript/components/FluentColor.d.ts +1 -1
- package/lib/typescript/components/FluentEmoji.d.ts +1 -1
- package/lib/typescript/components/FluentEmojiFlat.d.ts +1 -1
- package/lib/typescript/components/FluentEmojiHighContrast.d.ts +1 -1
- package/lib/typescript/components/FluentMdl2.d.ts +1 -1
- package/lib/typescript/components/Fontelico.d.ts +1 -1
- package/lib/typescript/components/Fontisto.d.ts +1 -1
- package/lib/typescript/components/Formkit.d.ts +1 -1
- package/lib/typescript/components/Foundation.d.ts +1 -1
- package/lib/typescript/components/Gala.d.ts +1 -1
- package/lib/typescript/components/GameIcons.d.ts +1 -1
- package/lib/typescript/components/Garden.d.ts +1 -1
- package/lib/typescript/components/Geo.d.ts +1 -1
- package/lib/typescript/components/Gg.d.ts +1 -1
- package/lib/typescript/components/Gis.d.ts +1 -1
- package/lib/typescript/components/GravityUi.d.ts +1 -1
- package/lib/typescript/components/Gridicons.d.ts +1 -1
- package/lib/typescript/components/GrommetIcons.d.ts +1 -1
- package/lib/typescript/components/Guidance.d.ts +1 -1
- package/lib/typescript/components/Healthicons.d.ts +1 -1
- package/lib/typescript/components/Heroicons.d.ts +1 -1
- package/lib/typescript/components/HeroiconsOutline.d.ts +1 -1
- package/lib/typescript/components/HeroiconsSolid.d.ts +1 -1
- package/lib/typescript/components/Hugeicons.d.ts +1 -1
- package/lib/typescript/components/Humbleicons.d.ts +1 -1
- package/lib/typescript/components/Ic.d.ts +1 -1
- package/lib/typescript/components/IcomoonFree.d.ts +1 -1
- package/lib/typescript/components/IconPark.d.ts +1 -1
- package/lib/typescript/components/IconParkOutline.d.ts +1 -1
- package/lib/typescript/components/IconParkSolid.d.ts +1 -1
- package/lib/typescript/components/IconParkTwotone.d.ts +1 -1
- package/lib/typescript/components/Iconamoon.d.ts +1 -1
- package/lib/typescript/components/Iconoir.d.ts +1 -1
- package/lib/typescript/components/Icons8.d.ts +1 -1
- package/lib/typescript/components/Il.d.ts +1 -1
- package/lib/typescript/components/Ion.d.ts +1 -1
- package/lib/typescript/components/Iwwa.d.ts +1 -1
- package/lib/typescript/components/Ix.d.ts +1 -1
- package/lib/typescript/components/Jam.d.ts +1 -1
- package/lib/typescript/components/La.d.ts +1 -1
- package/lib/typescript/components/LetsIcons.d.ts +1 -1
- package/lib/typescript/components/LineMd.d.ts +1 -1
- package/lib/typescript/components/Lineicons.d.ts +1 -1
- package/lib/typescript/components/Logos.d.ts +1 -1
- package/lib/typescript/components/Ls.d.ts +1 -1
- package/lib/typescript/components/Lsicon.d.ts +1 -1
- package/lib/typescript/components/Lucide.d.ts +1 -1
- package/lib/typescript/components/LucideLab.d.ts +1 -1
- package/lib/typescript/components/Mage.d.ts +1 -1
- package/lib/typescript/components/Majesticons.d.ts +1 -1
- package/lib/typescript/components/Maki.d.ts +1 -1
- package/lib/typescript/components/Map.d.ts +1 -1
- package/lib/typescript/components/Marketeq.d.ts +1 -1
- package/lib/typescript/components/MaterialIconTheme.d.ts +1 -1
- package/lib/typescript/components/MaterialSymbols.d.ts +1 -1
- package/lib/typescript/components/MaterialSymbolsLight.d.ts +1 -1
- package/lib/typescript/components/Mdi.d.ts +1 -1
- package/lib/typescript/components/MdiLight.d.ts +1 -1
- package/lib/typescript/components/MedicalIcon.d.ts +1 -1
- package/lib/typescript/components/Memory.d.ts +1 -1
- package/lib/typescript/components/Meteocons.d.ts +1 -1
- package/lib/typescript/components/MeteorIcons.d.ts +1 -1
- package/lib/typescript/components/Mi.d.ts +1 -1
- package/lib/typescript/components/Mingcute.d.ts +1 -1
- package/lib/typescript/components/MonoIcons.d.ts +1 -1
- package/lib/typescript/components/Mynaui.d.ts +1 -1
- package/lib/typescript/components/Nimbus.d.ts +1 -1
- package/lib/typescript/components/Nonicons.d.ts +1 -1
- package/lib/typescript/components/Nrk.d.ts +1 -1
- package/lib/typescript/components/Octicon.d.ts +1 -1
- package/lib/typescript/components/Oi.d.ts +1 -1
- package/lib/typescript/components/Ooui.d.ts +1 -1
- package/lib/typescript/components/Oui.d.ts +1 -1
- package/lib/typescript/components/Pajamas.d.ts +1 -1
- package/lib/typescript/components/Pepicons.d.ts +1 -1
- package/lib/typescript/components/PepiconsPencil.d.ts +1 -1
- package/lib/typescript/components/PepiconsPop.d.ts +1 -1
- package/lib/typescript/components/PepiconsPrint.d.ts +1 -1
- package/lib/typescript/components/Ph.d.ts +1 -1
- package/lib/typescript/components/Picon.d.ts +1 -1
- package/lib/typescript/components/Pixel.d.ts +1 -1
- package/lib/typescript/components/Pixelarticons.d.ts +1 -1
- package/lib/typescript/components/Prime.d.ts +1 -1
- package/lib/typescript/components/Proicons.d.ts +1 -1
- package/lib/typescript/components/Ps.d.ts +1 -1
- package/lib/typescript/components/QlementineIcons.d.ts +1 -1
- package/lib/typescript/components/Quill.d.ts +1 -1
- package/lib/typescript/components/RadixIcons.d.ts +1 -1
- package/lib/typescript/components/Raphael.d.ts +1 -1
- package/lib/typescript/components/Ri.d.ts +1 -1
- package/lib/typescript/components/RivetIcons.d.ts +1 -1
- package/lib/typescript/components/Roentgen.d.ts +1 -1
- package/lib/typescript/components/Si.d.ts +1 -1
- package/lib/typescript/components/SiGlyph.d.ts +1 -1
- package/lib/typescript/components/Sidekickicons.d.ts +1 -1
- package/lib/typescript/components/SimpleIcons.d.ts +1 -1
- package/lib/typescript/components/SimpleLineIcons.d.ts +1 -1
- package/lib/typescript/components/SkillIcons.d.ts +1 -1
- package/lib/typescript/components/Solar.d.ts +1 -1
- package/lib/typescript/components/Stash.d.ts +1 -1
- package/lib/typescript/components/Streamline.d.ts +1 -1
- package/lib/typescript/components/StreamlineBlock.d.ts +1 -1
- package/lib/typescript/components/StreamlineColor.d.ts +1 -1
- package/lib/typescript/components/StreamlineCyber.d.ts +1 -1
- package/lib/typescript/components/StreamlineCyberColor.d.ts +1 -1
- package/lib/typescript/components/StreamlineEmojis.d.ts +1 -1
- package/lib/typescript/components/StreamlineFlex.d.ts +1 -1
- package/lib/typescript/components/StreamlineFlexColor.d.ts +1 -1
- package/lib/typescript/components/StreamlineFreehand.d.ts +1 -1
- package/lib/typescript/components/StreamlineFreehandColor.d.ts +1 -1
- package/lib/typescript/components/StreamlineKameleonColor.d.ts +1 -1
- package/lib/typescript/components/StreamlineLogos.d.ts +1 -1
- package/lib/typescript/components/StreamlinePixel.d.ts +1 -1
- package/lib/typescript/components/StreamlinePlump.d.ts +1 -1
- package/lib/typescript/components/StreamlinePlumpColor.d.ts +1 -1
- package/lib/typescript/components/StreamlineSharp.d.ts +1 -1
- package/lib/typescript/components/StreamlineSharpColor.d.ts +1 -1
- package/lib/typescript/components/StreamlineStickiesColor.d.ts +1 -1
- package/lib/typescript/components/StreamlineUltimate.d.ts +1 -1
- package/lib/typescript/components/StreamlineUltimateColor.d.ts +1 -1
- package/lib/typescript/components/Subway.d.ts +1 -1
- package/lib/typescript/components/SvgSpinners.d.ts +1 -1
- package/lib/typescript/components/SystemUicons.d.ts +1 -1
- package/lib/typescript/components/Tabler.d.ts +1 -1
- package/lib/typescript/components/Tdesign.d.ts +1 -1
- package/lib/typescript/components/Teenyicons.d.ts +1 -1
- package/lib/typescript/components/Temaki.d.ts +1 -1
- package/lib/typescript/components/Token.d.ts +1 -1
- package/lib/typescript/components/TokenBranded.d.ts +1 -1
- package/lib/typescript/components/Topcoat.d.ts +1 -1
- package/lib/typescript/components/Typcn.d.ts +1 -1
- package/lib/typescript/components/Uil.d.ts +1 -1
- package/lib/typescript/components/Uim.d.ts +1 -1
- package/lib/typescript/components/Uis.d.ts +1 -1
- package/lib/typescript/components/Uit.d.ts +1 -1
- package/lib/typescript/components/Uiw.d.ts +1 -1
- package/lib/typescript/components/Unjs.d.ts +1 -1
- package/lib/typescript/components/Vaadin.d.ts +1 -1
- package/lib/typescript/components/Vs.d.ts +1 -1
- package/lib/typescript/components/VscodeIcons.d.ts +1 -1
- package/lib/typescript/components/Websymbol.d.ts +1 -1
- package/lib/typescript/components/Weui.d.ts +1 -1
- package/lib/typescript/components/Whh.d.ts +1 -1
- package/lib/typescript/components/Wi.d.ts +1 -1
- package/lib/typescript/components/Wpf.d.ts +1 -1
- package/lib/typescript/components/Zmdi.d.ts +1 -1
- package/lib/typescript/components/Zondicons.d.ts +1 -1
- package/lib/typescript/components/index.d.ts +38 -1
- package/lib/typescript/components/index.d.ts.map +1 -1
- package/lib/typescript/config/ConfigManager.d.ts +102 -0
- package/lib/typescript/config/ConfigManager.d.ts.map +1 -0
- package/lib/typescript/config/index.d.ts +22 -0
- package/lib/typescript/config/index.d.ts.map +1 -0
- package/lib/typescript/config/types.d.ts +112 -0
- package/lib/typescript/config/types.d.ts.map +1 -0
- package/lib/typescript/createIconSet.d.ts +1 -1
- package/lib/typescript/createIconSet.d.ts.map +1 -1
- package/lib/typescript/explorer/IconExplorer.d.ts +54 -0
- package/lib/typescript/explorer/IconExplorer.d.ts.map +1 -0
- package/lib/typescript/explorer/iconSets.d.ts +35 -0
- package/lib/typescript/explorer/iconSets.d.ts.map +1 -0
- package/lib/typescript/explorer/index.d.ts +33 -0
- package/lib/typescript/explorer/index.d.ts.map +1 -0
- package/lib/typescript/explorer/types.d.ts +329 -0
- package/lib/typescript/explorer/types.d.ts.map +1 -0
- package/lib/typescript/explorer/useExplorer.d.ts +18 -0
- package/lib/typescript/explorer/useExplorer.d.ts.map +1 -0
- package/lib/typescript/index.d.ts +25 -4
- package/lib/typescript/index.d.ts.map +1 -1
- package/lib/typescript/navigation/createDrawerIcon.d.ts +74 -0
- package/lib/typescript/navigation/createDrawerIcon.d.ts.map +1 -0
- package/lib/typescript/navigation/createHeaderIcon.d.ts +145 -0
- package/lib/typescript/navigation/createHeaderIcon.d.ts.map +1 -0
- package/lib/typescript/navigation/createTabBarIcon.d.ts +99 -0
- package/lib/typescript/navigation/createTabBarIcon.d.ts.map +1 -0
- package/lib/typescript/navigation/index.d.ts +51 -0
- package/lib/typescript/navigation/index.d.ts.map +1 -0
- package/lib/typescript/navigation/types.d.ts +149 -0
- package/lib/typescript/navigation/types.d.ts.map +1 -0
- package/lib/typescript/navigation/useNavigationIcon.d.ts +91 -0
- package/lib/typescript/navigation/useNavigationIcon.d.ts.map +1 -0
- package/lib/typescript/network/IconifyAPI.d.ts +32 -0
- package/lib/typescript/network/IconifyAPI.d.ts.map +1 -1
- package/lib/typescript/network/index.d.ts +2 -1
- package/lib/typescript/network/index.d.ts.map +1 -1
- package/lib/typescript/performance/PerformanceMonitor.d.ts +76 -0
- package/lib/typescript/performance/PerformanceMonitor.d.ts.map +1 -0
- package/lib/typescript/performance/index.d.ts +21 -0
- package/lib/typescript/performance/index.d.ts.map +1 -0
- package/lib/typescript/performance/types.d.ts +156 -0
- package/lib/typescript/performance/types.d.ts.map +1 -0
- package/lib/typescript/placeholder/PlaceholderFactory.d.ts +44 -0
- package/lib/typescript/placeholder/PlaceholderFactory.d.ts.map +1 -0
- package/lib/typescript/placeholder/Pulse.d.ts +18 -0
- package/lib/typescript/placeholder/Pulse.d.ts.map +1 -0
- package/lib/typescript/placeholder/Shimmer.d.ts +19 -0
- package/lib/typescript/placeholder/Shimmer.d.ts.map +1 -0
- package/lib/typescript/placeholder/Skeleton.d.ts +18 -0
- package/lib/typescript/placeholder/Skeleton.d.ts.map +1 -0
- package/lib/typescript/placeholder/index.d.ts +12 -0
- package/lib/typescript/placeholder/index.d.ts.map +1 -0
- package/lib/typescript/placeholder/types.d.ts +63 -0
- package/lib/typescript/placeholder/types.d.ts.map +1 -0
- package/lib/typescript/theme/IconThemeProvider.d.ts +64 -0
- package/lib/typescript/theme/IconThemeProvider.d.ts.map +1 -0
- package/lib/typescript/theme/context.d.ts +24 -0
- package/lib/typescript/theme/context.d.ts.map +1 -0
- package/lib/typescript/theme/index.d.ts +10 -0
- package/lib/typescript/theme/index.d.ts.map +1 -0
- package/lib/typescript/theme/types.d.ts +85 -0
- package/lib/typescript/theme/types.d.ts.map +1 -0
- package/lib/typescript/theme/useIconTheme.d.ts +78 -0
- package/lib/typescript/theme/useIconTheme.d.ts.map +1 -0
- package/lib/typescript/types/index.d.ts +58 -1
- package/lib/typescript/types/index.d.ts.map +1 -1
- package/package.json +41 -3
- package/src/IconRenderer.tsx +91 -4
- package/src/accessibility/AccessibilityProvider.tsx +220 -0
- package/src/accessibility/index.ts +63 -0
- package/src/accessibility/types.ts +152 -0
- package/src/accessibility/useAccessibleIcon.ts +220 -0
- package/src/accessibility/utils.ts +180 -0
- package/src/alias/Icon.tsx +113 -0
- package/src/alias/IconAliasContext.tsx +180 -0
- package/src/alias/createIconAliases.tsx +233 -0
- package/src/alias/index.ts +59 -0
- package/src/alias/types.ts +132 -0
- package/src/animated/AnimatedIcon.tsx +116 -0
- package/src/animated/index.ts +97 -0
- package/src/animated/presets.ts +211 -0
- package/src/animated/types.ts +239 -0
- package/src/animated/useIconAnimation.ts +383 -0
- package/src/babel/ast-utils.ts +219 -0
- package/src/babel/cache-writer.ts +323 -0
- package/src/babel/collector.ts +224 -0
- package/src/babel/index.ts +60 -0
- package/src/babel/plugin.ts +254 -0
- package/src/babel/types.ts +717 -0
- package/src/bundle/index.ts +313 -0
- package/src/cache/CacheManager.ts +123 -6
- package/src/cli/commands/analyze.ts +195 -0
- package/src/cli/commands/bundle.ts +231 -0
- package/src/cli/index.ts +153 -0
- package/src/cli/parser.ts +275 -0
- package/src/cli/types.ts +187 -0
- package/src/components/index.ts +52 -1
- package/src/config/ConfigManager.ts +196 -0
- package/src/config/index.ts +34 -0
- package/src/config/types.ts +149 -0
- package/src/createIconSet.tsx +48 -9
- package/src/explorer/IconExplorer.tsx +844 -0
- package/src/explorer/iconSets.ts +334 -0
- package/src/explorer/index.ts +64 -0
- package/src/explorer/types.ts +392 -0
- package/src/explorer/useExplorer.ts +390 -0
- package/src/index.ts +218 -9
- package/src/navigation/createDrawerIcon.tsx +113 -0
- package/src/navigation/createHeaderIcon.tsx +213 -0
- package/src/navigation/createTabBarIcon.tsx +180 -0
- package/src/navigation/index.ts +80 -0
- package/src/navigation/types.ts +155 -0
- package/src/navigation/useNavigationIcon.tsx +156 -0
- package/src/network/IconifyAPI.ts +182 -14
- package/src/network/index.ts +11 -1
- package/src/performance/PerformanceMonitor.ts +367 -0
- package/src/performance/index.ts +39 -0
- package/src/performance/types.ts +185 -0
- package/src/placeholder/PlaceholderFactory.tsx +133 -0
- package/src/placeholder/Pulse.tsx +86 -0
- package/src/placeholder/Shimmer.tsx +104 -0
- package/src/placeholder/Skeleton.tsx +52 -0
- package/src/placeholder/index.ts +21 -0
- package/src/placeholder/types.ts +78 -0
- package/src/theme/IconThemeProvider.tsx +94 -0
- package/src/theme/context.ts +51 -0
- package/src/theme/index.ts +19 -0
- package/src/theme/types.ts +108 -0
- package/src/theme/useIconTheme.ts +119 -0
- package/src/types/index.ts +78 -1
- package/lib/commonjs/components/Phosphor.js +0 -493
- package/lib/commonjs/components/Phosphor.js.map +0 -1
- package/lib/module/components/Phosphor.js +0 -488
- package/lib/module/components/Phosphor.js.map +0 -1
- package/lib/typescript/components/Phosphor.d.ts +0 -472
- package/lib/typescript/components/Phosphor.d.ts.map +0 -1
- package/src/components/Phosphor.tsx +0 -506
|
@@ -0,0 +1,269 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cache Writer
|
|
3
|
+
* Fetches collected icons from Iconify API and writes them to a cache file
|
|
4
|
+
* Runs in Node.js environment during build time
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import * as fs from 'fs';
|
|
8
|
+
import * as path from 'path';
|
|
9
|
+
/**
|
|
10
|
+
* Iconify API configuration
|
|
11
|
+
*/
|
|
12
|
+
const ICONIFY_API_BASE = 'https://api.iconify.design';
|
|
13
|
+
const DEFAULT_TIMEOUT_MS = 30000;
|
|
14
|
+
const MAX_RETRIES = 2;
|
|
15
|
+
const RETRY_DELAY_MS = 1000;
|
|
16
|
+
const BATCH_SIZE = 50;
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Iconify API response structure
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Fetch with timeout (Node.js compatible)
|
|
24
|
+
*/
|
|
25
|
+
async function fetchWithTimeout(url, timeoutMs = DEFAULT_TIMEOUT_MS) {
|
|
26
|
+
const controller = new AbortController();
|
|
27
|
+
const timeoutId = setTimeout(() => controller.abort(), timeoutMs);
|
|
28
|
+
try {
|
|
29
|
+
const response = await fetch(url, {
|
|
30
|
+
signal: controller.signal
|
|
31
|
+
});
|
|
32
|
+
return response;
|
|
33
|
+
} finally {
|
|
34
|
+
clearTimeout(timeoutId);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Build SVG string from Iconify icon data
|
|
40
|
+
* @internal Exported for testing
|
|
41
|
+
*/
|
|
42
|
+
export function buildSvg(data, defaultWidth = 24, defaultHeight = 24) {
|
|
43
|
+
const width = data.width ?? defaultWidth;
|
|
44
|
+
const height = data.height ?? defaultHeight;
|
|
45
|
+
const left = data.left ?? 0;
|
|
46
|
+
const top = data.top ?? 0;
|
|
47
|
+
const viewBox = `${left} ${top} ${width} ${height}`;
|
|
48
|
+
|
|
49
|
+
// Apply transformations
|
|
50
|
+
let transform = '';
|
|
51
|
+
const transforms = [];
|
|
52
|
+
if (data.rotate) {
|
|
53
|
+
const rotation = data.rotate * 90;
|
|
54
|
+
transforms.push(`rotate(${rotation} ${width / 2} ${height / 2})`);
|
|
55
|
+
}
|
|
56
|
+
if (data.hFlip || data.vFlip) {
|
|
57
|
+
const scaleX = data.hFlip ? -1 : 1;
|
|
58
|
+
const scaleY = data.vFlip ? -1 : 1;
|
|
59
|
+
const translateX = data.hFlip ? width : 0;
|
|
60
|
+
const translateY = data.vFlip ? height : 0;
|
|
61
|
+
transforms.push(`translate(${translateX} ${translateY}) scale(${scaleX} ${scaleY})`);
|
|
62
|
+
}
|
|
63
|
+
if (transforms.length > 0) {
|
|
64
|
+
transform = ` transform="${transforms.join(' ')}"`;
|
|
65
|
+
}
|
|
66
|
+
const body = transform ? `<g${transform}>${data.body}</g>` : data.body;
|
|
67
|
+
const svg = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="${viewBox}" width="${width}" height="${height}">${body}</svg>`;
|
|
68
|
+
return {
|
|
69
|
+
svg,
|
|
70
|
+
width,
|
|
71
|
+
height
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Fetch a batch of icons with the same prefix
|
|
77
|
+
*/
|
|
78
|
+
async function fetchIconBatch(prefix, iconNames, verbose) {
|
|
79
|
+
const results = new Map();
|
|
80
|
+
|
|
81
|
+
// Sort icon names alphabetically (Iconify best practice)
|
|
82
|
+
const sortedNames = [...iconNames].sort();
|
|
83
|
+
const namesString = sortedNames.join(',');
|
|
84
|
+
let lastError = null;
|
|
85
|
+
for (let attempt = 0; attempt <= MAX_RETRIES; attempt++) {
|
|
86
|
+
try {
|
|
87
|
+
const url = `${ICONIFY_API_BASE}/${prefix}.json?icons=${namesString}`;
|
|
88
|
+
if (verbose) {
|
|
89
|
+
console.log(`[rn-iconify] Fetching ${prefix} icons (attempt ${attempt + 1})...`);
|
|
90
|
+
}
|
|
91
|
+
const response = await fetchWithTimeout(url);
|
|
92
|
+
if (!response.ok) {
|
|
93
|
+
throw new Error(`HTTP ${response.status}: Failed to fetch ${prefix} icons`);
|
|
94
|
+
}
|
|
95
|
+
const data = await response.json();
|
|
96
|
+
if (!data || typeof data !== 'object' || !data.icons) {
|
|
97
|
+
throw new Error(`Invalid API response for ${prefix} icons`);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
// Process each icon
|
|
101
|
+
for (const name of sortedNames) {
|
|
102
|
+
const iconData = data.icons[name];
|
|
103
|
+
if (iconData) {
|
|
104
|
+
const {
|
|
105
|
+
svg,
|
|
106
|
+
width,
|
|
107
|
+
height
|
|
108
|
+
} = buildSvg(iconData, data.width, data.height);
|
|
109
|
+
results.set(`${prefix}:${name}`, {
|
|
110
|
+
svg,
|
|
111
|
+
width,
|
|
112
|
+
height
|
|
113
|
+
});
|
|
114
|
+
} else if (verbose) {
|
|
115
|
+
console.warn(`[rn-iconify] Icon not found: ${prefix}:${name}`);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
return results;
|
|
119
|
+
} catch (error) {
|
|
120
|
+
lastError = error instanceof Error ? error : new Error(String(error));
|
|
121
|
+
if (attempt < MAX_RETRIES) {
|
|
122
|
+
await new Promise(resolve => setTimeout(resolve, RETRY_DELAY_MS * (attempt + 1)));
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
// Log error but don't fail the build
|
|
128
|
+
console.error(`[rn-iconify] Failed to fetch ${prefix} icons after ${MAX_RETRIES + 1} attempts:`, lastError?.message);
|
|
129
|
+
return results;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* Group icons by prefix
|
|
134
|
+
* @internal Exported for testing
|
|
135
|
+
*/
|
|
136
|
+
export function groupIconsByPrefix(iconNames) {
|
|
137
|
+
const grouped = new Map();
|
|
138
|
+
for (const iconName of iconNames) {
|
|
139
|
+
const [prefix, name] = iconName.split(':');
|
|
140
|
+
if (prefix && name) {
|
|
141
|
+
if (!grouped.has(prefix)) {
|
|
142
|
+
grouped.set(prefix, []);
|
|
143
|
+
}
|
|
144
|
+
grouped.get(prefix).push(name);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
return grouped;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* Fetch all icons and create bundle
|
|
152
|
+
*/
|
|
153
|
+
export async function fetchAndCreateBundle(iconNames, options) {
|
|
154
|
+
const {
|
|
155
|
+
verbose = false
|
|
156
|
+
} = options;
|
|
157
|
+
const startTime = Date.now();
|
|
158
|
+
if (verbose) {
|
|
159
|
+
console.log(`[rn-iconify] Fetching ${iconNames.length} icons...`);
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
// Group icons by prefix
|
|
163
|
+
const grouped = groupIconsByPrefix(iconNames);
|
|
164
|
+
const allIcons = {};
|
|
165
|
+
let fetchedCount = 0;
|
|
166
|
+
|
|
167
|
+
// Fetch each prefix group
|
|
168
|
+
for (const [prefix, names] of grouped) {
|
|
169
|
+
// Split into batches if too many icons
|
|
170
|
+
for (let i = 0; i < names.length; i += BATCH_SIZE) {
|
|
171
|
+
const batch = names.slice(i, i + BATCH_SIZE);
|
|
172
|
+
const results = await fetchIconBatch(prefix, batch, verbose);
|
|
173
|
+
for (const [iconName, data] of results) {
|
|
174
|
+
allIcons[iconName] = data;
|
|
175
|
+
fetchedCount++;
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
const bundle = {
|
|
180
|
+
version: '1.0.0',
|
|
181
|
+
generatedAt: new Date().toISOString(),
|
|
182
|
+
icons: allIcons,
|
|
183
|
+
count: fetchedCount
|
|
184
|
+
};
|
|
185
|
+
if (verbose) {
|
|
186
|
+
const elapsed = Date.now() - startTime;
|
|
187
|
+
console.log(`[rn-iconify] Fetched ${fetchedCount}/${iconNames.length} icons in ${elapsed}ms`);
|
|
188
|
+
}
|
|
189
|
+
return bundle;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
* Write bundle to file
|
|
194
|
+
*/
|
|
195
|
+
export function writeBundleToFile(bundle, outputPath, verbose) {
|
|
196
|
+
// Ensure directory exists
|
|
197
|
+
const dir = path.dirname(outputPath);
|
|
198
|
+
if (!fs.existsSync(dir)) {
|
|
199
|
+
fs.mkdirSync(dir, {
|
|
200
|
+
recursive: true
|
|
201
|
+
});
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
// Write bundle
|
|
205
|
+
const content = JSON.stringify(bundle);
|
|
206
|
+
fs.writeFileSync(outputPath, content, 'utf-8');
|
|
207
|
+
if (verbose) {
|
|
208
|
+
const sizeKB = (content.length / 1024).toFixed(2);
|
|
209
|
+
console.log(`[rn-iconify] Bundle written to ${outputPath} (${sizeKB} KB)`);
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
/**
|
|
214
|
+
* Generate icon bundle from collected icons
|
|
215
|
+
*/
|
|
216
|
+
export async function generateBundle(iconNames, options, projectRoot) {
|
|
217
|
+
const {
|
|
218
|
+
outputPath = '.rn-iconify-cache',
|
|
219
|
+
verbose = false
|
|
220
|
+
} = options;
|
|
221
|
+
if (iconNames.length === 0) {
|
|
222
|
+
if (verbose) {
|
|
223
|
+
console.log('[rn-iconify] No icons to bundle');
|
|
224
|
+
}
|
|
225
|
+
return;
|
|
226
|
+
}
|
|
227
|
+
try {
|
|
228
|
+
// Fetch all icons
|
|
229
|
+
const bundle = await fetchAndCreateBundle(iconNames, options);
|
|
230
|
+
|
|
231
|
+
// Determine output file path
|
|
232
|
+
const bundleFile = path.isAbsolute(outputPath) ? path.join(outputPath, 'icons.json') : path.join(projectRoot, outputPath, 'icons.json');
|
|
233
|
+
|
|
234
|
+
// Write bundle to file
|
|
235
|
+
writeBundleToFile(bundle, bundleFile, verbose);
|
|
236
|
+
|
|
237
|
+
// Also write a JS module for easy importing
|
|
238
|
+
const jsContent = `// Auto-generated by rn-iconify babel plugin
|
|
239
|
+
// Do not edit manually
|
|
240
|
+
module.exports = ${JSON.stringify(bundle)};
|
|
241
|
+
`;
|
|
242
|
+
const jsFile = bundleFile.replace('.json', '.js');
|
|
243
|
+
fs.writeFileSync(jsFile, jsContent, 'utf-8');
|
|
244
|
+
if (verbose) {
|
|
245
|
+
console.log(`[rn-iconify] Bundle generation complete!`);
|
|
246
|
+
}
|
|
247
|
+
} catch (error) {
|
|
248
|
+
// Don't fail the build on bundle generation error
|
|
249
|
+
console.error('[rn-iconify] Bundle generation failed:', error instanceof Error ? error.message : error);
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
/**
|
|
254
|
+
* Check if bundle file exists and is valid
|
|
255
|
+
*/
|
|
256
|
+
export function isBundleValid(outputPath, projectRoot) {
|
|
257
|
+
const bundleFile = path.isAbsolute(outputPath) ? path.join(outputPath, 'icons.json') : path.join(projectRoot, outputPath, 'icons.json');
|
|
258
|
+
if (!fs.existsSync(bundleFile)) {
|
|
259
|
+
return false;
|
|
260
|
+
}
|
|
261
|
+
try {
|
|
262
|
+
const content = fs.readFileSync(bundleFile, 'utf-8');
|
|
263
|
+
const bundle = JSON.parse(content);
|
|
264
|
+
return bundle.version === '1.0.0' && typeof bundle.count === 'number';
|
|
265
|
+
} catch {
|
|
266
|
+
return false;
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
//# sourceMappingURL=cache-writer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["fs","path","ICONIFY_API_BASE","DEFAULT_TIMEOUT_MS","MAX_RETRIES","RETRY_DELAY_MS","BATCH_SIZE","fetchWithTimeout","url","timeoutMs","controller","AbortController","timeoutId","setTimeout","abort","response","fetch","signal","clearTimeout","buildSvg","data","defaultWidth","defaultHeight","width","height","left","top","viewBox","transform","transforms","rotate","rotation","push","hFlip","vFlip","scaleX","scaleY","translateX","translateY","length","join","body","svg","fetchIconBatch","prefix","iconNames","verbose","results","Map","sortedNames","sort","namesString","lastError","attempt","console","log","ok","Error","status","json","icons","name","iconData","set","warn","error","String","Promise","resolve","message","groupIconsByPrefix","grouped","iconName","split","has","get","fetchAndCreateBundle","options","startTime","Date","now","allIcons","fetchedCount","names","i","batch","slice","bundle","version","generatedAt","toISOString","count","elapsed","writeBundleToFile","outputPath","dir","dirname","existsSync","mkdirSync","recursive","content","JSON","stringify","writeFileSync","sizeKB","toFixed","generateBundle","projectRoot","bundleFile","isAbsolute","jsContent","jsFile","replace","isBundleValid","readFileSync","parse"],"sourceRoot":"../../../src","sources":["babel/cache-writer.ts"],"mappings":"AAAA;AACA;AACA;AACA;AACA;;AAEA,OAAO,KAAKA,EAAE,MAAM,IAAI;AACxB,OAAO,KAAKC,IAAI,MAAM,MAAM;AAG5B;AACA;AACA;AACA,MAAMC,gBAAgB,GAAG,4BAA4B;AACrD,MAAMC,kBAAkB,GAAG,KAAK;AAChC,MAAMC,WAAW,GAAG,CAAC;AACrB,MAAMC,cAAc,GAAG,IAAI;AAC3B,MAAMC,UAAU,GAAG,EAAE;;AAErB;AACA;AACA;;AAoBA;AACA;AACA;AACA,eAAeC,gBAAgBA,CAC7BC,GAAW,EACXC,SAAiB,GAAGN,kBAAkB,EACnB;EACnB,MAAMO,UAAU,GAAG,IAAIC,eAAe,CAAC,CAAC;EACxC,MAAMC,SAAS,GAAGC,UAAU,CAAC,MAAMH,UAAU,CAACI,KAAK,CAAC,CAAC,EAAEL,SAAS,CAAC;EAEjE,IAAI;IACF,MAAMM,QAAQ,GAAG,MAAMC,KAAK,CAACR,GAAG,EAAE;MAAES,MAAM,EAAEP,UAAU,CAACO;IAAO,C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U,KAAK,EAAE;IACd;IACAX,OAAO,CAACW,KAAK,CACX,wCAAwC,EACxCA,KAAK,YAAYR,KAAK,GAAGQ,KAAK,CAACI,OAAO,GAAGJ,KAC3C,CAAC;EACH;AACF;;AAEA;AACA;AACA;AACA,OAAO,SAASgD,aAAaA,CAACnB,UAAkB,EAAEa,WAAmB,EAAW;EAC9E,MAAMC,UAAU,GAAG3G,IAAI,CAAC4G,UAAU,CAACf,UAAU,CAAC,GAC1C7F,IAAI,CAACuC,IAAI,CAACsD,UAAU,EAAE,YAAY,CAAC,GACnC7F,IAAI,CAACuC,IAAI,CAACmE,WAAW,EAAEb,UAAU,EAAE,YAAY,CAAC;EAEpD,IAAI,CAAC9F,EAAE,CAACiG,UAAU,CAACW,UAAU,CAAC,EAAE;IAC9B,OAAO,KAAK;EACd;EAEA,IAAI;IACF,MAAMR,OAAO,GAAGpG,EAAE,CAACkH,YAAY,CAACN,UAAU,EAAE,OAAO,CAAC;IACpD,MAAMrB,MAAM,GAAGc,IAAI,CAACc,KAAK,CAACf,OAAO,CAAe;IAChD,OAAOb,MAAM,CAACC,OAAO,KAAK,OAAO,IAAI,OAAOD,MAAM,CAACI,KAAK,KAAK,QAAQ;EACvE,CAAC,CAAC,MAAM;IACN,OAAO,KAAK;EACd;AACF","ignoreList":[]}
|
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Icon Collector
|
|
3
|
+
* Singleton that collects icons across all files during the build process
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { shouldIncludeIcon, isValidIconName } from './ast-utils';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Icon collection state
|
|
10
|
+
* Uses a singleton pattern since Babel plugin runs in a single process
|
|
11
|
+
*/
|
|
12
|
+
class IconCollector {
|
|
13
|
+
/**
|
|
14
|
+
* Map of icon name -> collection info
|
|
15
|
+
* Using Map to track first occurrence location
|
|
16
|
+
*/
|
|
17
|
+
icons = new Map();
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Set of processed files to track progress
|
|
21
|
+
*/
|
|
22
|
+
processedFiles = new Set();
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Options from plugin configuration
|
|
26
|
+
*/
|
|
27
|
+
options = {};
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Whether bundle generation has been triggered
|
|
31
|
+
*/
|
|
32
|
+
bundleGenerated = false;
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Start time for performance tracking
|
|
36
|
+
*/
|
|
37
|
+
startTime = 0;
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Initialize the collector with options
|
|
41
|
+
* Called at the start of each build
|
|
42
|
+
*/
|
|
43
|
+
initialize(options) {
|
|
44
|
+
this.options = options;
|
|
45
|
+
this.startTime = Date.now();
|
|
46
|
+
if (options.verbose) {
|
|
47
|
+
console.log('[rn-iconify] Babel plugin initialized');
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Reset collector state
|
|
53
|
+
* Should be called at the start of each build
|
|
54
|
+
*/
|
|
55
|
+
reset() {
|
|
56
|
+
this.icons.clear();
|
|
57
|
+
this.processedFiles.clear();
|
|
58
|
+
this.bundleGenerated = false;
|
|
59
|
+
this.startTime = Date.now();
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Add an icon to the collection
|
|
64
|
+
*/
|
|
65
|
+
add(iconName, file, line, column) {
|
|
66
|
+
// Validate icon name format
|
|
67
|
+
if (!isValidIconName(iconName)) {
|
|
68
|
+
if (this.options.verbose) {
|
|
69
|
+
console.log(`[rn-iconify] Skipping invalid icon name: ${iconName}`);
|
|
70
|
+
}
|
|
71
|
+
return false;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
// Check include/exclude patterns
|
|
75
|
+
if (!shouldIncludeIcon(iconName, this.options.include, this.options.exclude)) {
|
|
76
|
+
if (this.options.verbose) {
|
|
77
|
+
console.log(`[rn-iconify] Excluded icon: ${iconName}`);
|
|
78
|
+
}
|
|
79
|
+
return false;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
// Only track first occurrence
|
|
83
|
+
if (!this.icons.has(iconName)) {
|
|
84
|
+
this.icons.set(iconName, {
|
|
85
|
+
name: iconName,
|
|
86
|
+
file,
|
|
87
|
+
line,
|
|
88
|
+
column
|
|
89
|
+
});
|
|
90
|
+
if (this.options.verbose) {
|
|
91
|
+
console.log(`[rn-iconify] Found icon: ${iconName} in ${file}:${line}`);
|
|
92
|
+
}
|
|
93
|
+
return true;
|
|
94
|
+
}
|
|
95
|
+
return false;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* Mark a file as processed
|
|
100
|
+
*/
|
|
101
|
+
markFileProcessed(filename) {
|
|
102
|
+
this.processedFiles.add(filename);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* Check if a file has been processed
|
|
107
|
+
*/
|
|
108
|
+
isFileProcessed(filename) {
|
|
109
|
+
return this.processedFiles.has(filename);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* Check if there are any collected icons
|
|
114
|
+
*/
|
|
115
|
+
hasIcons() {
|
|
116
|
+
return this.icons.size > 0;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* Get all collected icon names
|
|
121
|
+
*/
|
|
122
|
+
getIconNames() {
|
|
123
|
+
return Array.from(this.icons.keys());
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* Get all collected icons with their metadata
|
|
128
|
+
*/
|
|
129
|
+
getAllIcons() {
|
|
130
|
+
return Array.from(this.icons.values());
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* Get icon count
|
|
135
|
+
*/
|
|
136
|
+
getCount() {
|
|
137
|
+
return this.icons.size;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* Get processed file count
|
|
142
|
+
*/
|
|
143
|
+
getProcessedFileCount() {
|
|
144
|
+
return this.processedFiles.size;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* Get icons grouped by prefix
|
|
149
|
+
*/
|
|
150
|
+
getIconsByPrefix() {
|
|
151
|
+
const byPrefix = new Map();
|
|
152
|
+
for (const iconName of this.icons.keys()) {
|
|
153
|
+
const [prefix] = iconName.split(':');
|
|
154
|
+
if (!byPrefix.has(prefix)) {
|
|
155
|
+
byPrefix.set(prefix, []);
|
|
156
|
+
}
|
|
157
|
+
byPrefix.get(prefix).push(iconName);
|
|
158
|
+
}
|
|
159
|
+
return byPrefix;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
* Mark bundle as generated
|
|
164
|
+
*/
|
|
165
|
+
markBundleGenerated() {
|
|
166
|
+
this.bundleGenerated = true;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
/**
|
|
170
|
+
* Check if bundle has been generated
|
|
171
|
+
*/
|
|
172
|
+
isBundleGenerated() {
|
|
173
|
+
return this.bundleGenerated;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
/**
|
|
177
|
+
* Get elapsed time since initialization
|
|
178
|
+
*/
|
|
179
|
+
getElapsedTime() {
|
|
180
|
+
return Date.now() - this.startTime;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
/**
|
|
184
|
+
* Get current options
|
|
185
|
+
*/
|
|
186
|
+
getOptions() {
|
|
187
|
+
return this.options;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
/**
|
|
191
|
+
* Print summary (for verbose mode)
|
|
192
|
+
*/
|
|
193
|
+
printSummary() {
|
|
194
|
+
if (!this.options.verbose) return;
|
|
195
|
+
const byPrefix = this.getIconsByPrefix();
|
|
196
|
+
const prefixSummary = Array.from(byPrefix.entries()).map(([prefix, icons]) => `${prefix}: ${icons.length}`).join(', ');
|
|
197
|
+
console.log(`[rn-iconify] Collection summary:`);
|
|
198
|
+
console.log(` Total icons: ${this.icons.size}`);
|
|
199
|
+
console.log(` Files processed: ${this.processedFiles.size}`);
|
|
200
|
+
console.log(` By prefix: ${prefixSummary}`);
|
|
201
|
+
console.log(` Time elapsed: ${this.getElapsedTime()}ms`);
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
/**
|
|
206
|
+
* Singleton instance
|
|
207
|
+
*/
|
|
208
|
+
export const collector = new IconCollector();
|
|
209
|
+
|
|
210
|
+
/**
|
|
211
|
+
* Export class for testing
|
|
212
|
+
*/
|
|
213
|
+
export { IconCollector };
|
|
214
|
+
//# sourceMappingURL=collector.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["shouldIncludeIcon","isValidIconName","IconCollector","icons","Map","processedFiles","Set","options","bundleGenerated","startTime","initialize","Date","now","verbose","console","log","reset","clear","add","iconName","file","line","column","include","exclude","has","set","name","markFileProcessed","filename","isFileProcessed","hasIcons","size","getIconNames","Array","from","keys","getAllIcons","values","getCount","getProcessedFileCount","getIconsByPrefix","byPrefix","prefix","split","get","push","markBundleGenerated","isBundleGenerated","getElapsedTime","getOptions","printSummary","prefixSummary","entries","map","length","join","collector"],"sourceRoot":"../../../src","sources":["babel/collector.ts"],"mappings":"AAAA;AACA;AACA;AACA;;AAGA,SAASA,iBAAiB,EAAEC,eAAe,QAAQ,aAAa;;AAEhE;AACA;AACA;AACA;AACA,MAAMC,aAAa,CAAC;EAClB;AACF;AACA;AACA;EACUC,KAAK,GAA+B,IAAIC,GAAG,CAAC,CAAC;;EAErD;AACF;AACA;EACUC,cAAc,GAAgB,IAAIC,GAAG,CAAC,CAAC;;EAE/C;AACF;AACA;EACUC,OAAO,GAAuB,CAAC,CAAC;;EAExC;AACF;AACA;EACUC,eAAe,GAAY,KAAK;;EAExC;AACF;AACA;EACUC,SAAS,GAAW,CAAC;;EAE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AACC,GAAG,CAAC,sBAAsB,IAAI,CAACV,cAAc,CAAC2B,IAAI,EAAE,CAAC;IAC7DlB,OAAO,CAACC,GAAG,CAAC,gBAAgBqC,aAAa,EAAE,CAAC;IAC5CtC,OAAO,CAACC,GAAG,CAAC,mBAAmB,IAAI,CAACkC,cAAc,CAAC,CAAC,IAAI,CAAC;EAC3D;AACF;;AAEA;AACA;AACA;AACA,OAAO,MAAMQ,SAAS,GAAG,IAAIvD,aAAa,CAAC,CAAC;;AAE5C;AACA;AACA;AACA,SAASA,aAAa","ignoreList":[]}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* rn-iconify Babel Plugin
|
|
3
|
+
*
|
|
4
|
+
* Build-time icon bundling for 0ms first render.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```js
|
|
8
|
+
* // babel.config.js
|
|
9
|
+
* module.exports = {
|
|
10
|
+
* presets: ['module:@react-native/babel-preset'],
|
|
11
|
+
* plugins: ['rn-iconify/babel'],
|
|
12
|
+
* };
|
|
13
|
+
* ```
|
|
14
|
+
*
|
|
15
|
+
* @example With options
|
|
16
|
+
* ```js
|
|
17
|
+
* // babel.config.js
|
|
18
|
+
* module.exports = {
|
|
19
|
+
* presets: ['module:@react-native/babel-preset'],
|
|
20
|
+
* plugins: [
|
|
21
|
+
* ['rn-iconify/babel', {
|
|
22
|
+
* include: ['mdi:*', 'heroicons:*'],
|
|
23
|
+
* exclude: ['mdi:test-*'],
|
|
24
|
+
* outputPath: '.rn-iconify-cache',
|
|
25
|
+
* verbose: true,
|
|
26
|
+
* }]
|
|
27
|
+
* ],
|
|
28
|
+
* };
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
|
|
32
|
+
import { createRnIconifyPlugin, resetPluginState } from './plugin';
|
|
33
|
+
|
|
34
|
+
// Export types
|
|
35
|
+
|
|
36
|
+
// Export utilities for testing
|
|
37
|
+
export { collector } from './collector';
|
|
38
|
+
export { resetPluginState };
|
|
39
|
+
export { COMPONENT_PREFIX_MAP, PREFIX_COMPONENT_MAP, VALID_COMPONENTS, VALID_PREFIXES, getFilenameFromState, getFilenameFromFile } from './types';
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Default export for Babel plugin
|
|
43
|
+
* This is what Babel will import when you add 'rn-iconify/babel' to your config
|
|
44
|
+
*/
|
|
45
|
+
export default createRnIconifyPlugin;
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Named export for explicit importing
|
|
49
|
+
*/
|
|
50
|
+
export { createRnIconifyPlugin };
|
|
51
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["createRnIconifyPlugin","resetPluginState","collector","COMPONENT_PREFIX_MAP","PREFIX_COMPONENT_MAP","VALID_COMPONENTS","VALID_PREFIXES","getFilenameFromState","getFilenameFromFile"],"sourceRoot":"../../../src","sources":["babel/index.ts"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,qBAAqB,EAAEC,gBAAgB,QAAQ,UAAU;;AAGlE;;AAIA;AACA,SAASC,SAAS,QAAQ,aAAa;AACvC,SAASD,gBAAgB;AACzB,SACEE,oBAAoB,EACpBC,oBAAoB,EACpBC,gBAAgB,EAChBC,cAAc,EACdC,oBAAoB,EACpBC,mBAAmB,QACd,SAAS;;AAEhB;AACA;AACA;AACA;AACA,eAAeR,qBAAqB;;AAEpC;AACA;AACA;AACA,SAASA,qBAAqB","ignoreList":[]}
|