@particle-academy/react-fancy 4.4.4 → 4.4.6
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.cjs +86 -53
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +56 -4
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
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 =
|
|
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);
|
|
@@ -3309,6 +3339,28 @@ function useFloatingPosition(anchorRef, floatingRef, options = {}) {
|
|
|
3309
3339
|
useEffect(() => {
|
|
3310
3340
|
if (enabled) update();
|
|
3311
3341
|
});
|
|
3342
|
+
useEffect(() => {
|
|
3343
|
+
if (!enabled) return;
|
|
3344
|
+
let raf = 0;
|
|
3345
|
+
let ro = null;
|
|
3346
|
+
const tick = () => {
|
|
3347
|
+
const el = floatingRef.current;
|
|
3348
|
+
if (el) {
|
|
3349
|
+
update();
|
|
3350
|
+
if (typeof ResizeObserver !== "undefined") {
|
|
3351
|
+
ro = new ResizeObserver(() => update());
|
|
3352
|
+
ro.observe(el);
|
|
3353
|
+
}
|
|
3354
|
+
} else {
|
|
3355
|
+
raf = requestAnimationFrame(tick);
|
|
3356
|
+
}
|
|
3357
|
+
};
|
|
3358
|
+
raf = requestAnimationFrame(tick);
|
|
3359
|
+
return () => {
|
|
3360
|
+
cancelAnimationFrame(raf);
|
|
3361
|
+
ro?.disconnect();
|
|
3362
|
+
};
|
|
3363
|
+
}, [enabled, update, floatingRef]);
|
|
3312
3364
|
useEffect(() => {
|
|
3313
3365
|
if (!enabled) {
|
|
3314
3366
|
setPosition(
|