@particle-academy/react-fancy 4.4.3 → 4.4.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,10 +1,9 @@
1
- import { forwardRef, createContext, useId, useRef, useEffect, useState, useCallback, useMemo, Children, isValidElement, useLayoutEffect, cloneElement, useContext, Fragment as Fragment$1 } from 'react';
1
+ import { forwardRef, useSyncExternalStore, createContext, useId, useRef, useEffect, useState, useCallback, useMemo, Children, isValidElement, useLayoutEffect, cloneElement, useContext, Fragment as Fragment$1 } from 'react';
2
2
  import { clsx } from 'clsx';
3
3
  import { twMerge } from 'tailwind-merge';
4
- import * as LucideIcons from 'lucide-react';
5
- import { X, ChevronUp, ChevronDown, ChevronLeft, ChevronRight, Search, Menu, File, Upload, PanelLeftOpen, PanelLeftClose, Check, XCircle, AlertTriangle, Info } from 'lucide-react';
6
4
  import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
7
5
  import { createPortal } from 'react-dom';
6
+ import { X, ChevronUp, ChevronDown, ChevronLeft, ChevronRight, Search, Menu, File, Upload, PanelLeftOpen, PanelLeftClose, Check, XCircle, AlertTriangle, Info } from 'lucide-react';
8
7
  import { marked } from 'marked';
9
8
 
10
9
  // src/components/Button/Button.tsx
@@ -2101,14 +2100,40 @@ function applyTone(char, tone) {
2101
2100
  const idx = SKIN_TONES.indexOf(tone);
2102
2101
  return entry.skinTones[idx] ?? char;
2103
2102
  }
2103
+
2104
+ // src/components/Icon/icon-config.ts
2104
2105
  var registry = /* @__PURE__ */ new Map();
2105
2106
  var defaultSetName = "lucide";
2106
2107
  function kebabToPascal(str) {
2107
2108
  return str.split("-").map((part) => part.charAt(0).toUpperCase() + part.slice(1)).join("");
2108
2109
  }
2110
+ var lucideModule = null;
2111
+ var lucidePromise = null;
2112
+ var lucideVersion = 0;
2113
+ var lucideListeners = /* @__PURE__ */ new Set();
2114
+ function ensureLucideLoaded() {
2115
+ if (lucideModule || lucidePromise) return;
2116
+ lucidePromise = import('lucide-react').then((mod) => {
2117
+ lucideModule = mod;
2118
+ lucideVersion++;
2119
+ for (const listener of lucideListeners) listener();
2120
+ }).catch(() => {
2121
+ });
2122
+ }
2123
+ function subscribeIconResolution(listener) {
2124
+ lucideListeners.add(listener);
2125
+ return () => lucideListeners.delete(listener);
2126
+ }
2127
+ function getIconResolutionVersion() {
2128
+ return lucideVersion;
2129
+ }
2109
2130
  function resolveFromLucide(name) {
2131
+ if (!lucideModule) {
2132
+ ensureLucideLoaded();
2133
+ return null;
2134
+ }
2110
2135
  const pascal = kebabToPascal(name);
2111
- const icon = LucideIcons[pascal];
2136
+ const icon = lucideModule[pascal];
2112
2137
  return typeof icon === "function" || icon && typeof icon === "object" ? icon : null;
2113
2138
  }
2114
2139
  function registerIcons(icons) {
@@ -2161,6 +2186,11 @@ var sizePixels = {
2161
2186
  };
2162
2187
  var Icon = forwardRef(
2163
2188
  ({ size = "md", className, children, name, iconSet, ...props }, ref) => {
2189
+ useSyncExternalStore(
2190
+ subscribeIconResolution,
2191
+ getIconResolutionVersion,
2192
+ getIconResolutionVersion
2193
+ );
2164
2194
  let content = children;
2165
2195
  if (name && !children) {
2166
2196
  const ResolvedIcon = resolveIcon(name, iconSet);
@@ -3212,7 +3242,11 @@ var Textarea = forwardRef(
3212
3242
  );
3213
3243
  Textarea.displayName = "Textarea";
3214
3244
  function Portal({ children, container }) {
3215
- if (typeof document === "undefined") return null;
3245
+ const [mounted, setMounted] = useState(false);
3246
+ useEffect(() => {
3247
+ setMounted(true);
3248
+ }, []);
3249
+ if (!mounted || typeof document === "undefined") return null;
3216
3250
  const target = container ?? document.body;
3217
3251
  return createPortal(
3218
3252
  /* @__PURE__ */ jsx(PortalDarkWrapper, { children }),