@particle-academy/react-fancy 3.4.3 → 3.5.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/dist/index.cjs +93 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +36 -1
- package/dist/index.d.ts +36 -1
- package/dist/index.js +94 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -6413,6 +6413,98 @@ var Callout = react.forwardRef(
|
|
|
6413
6413
|
}
|
|
6414
6414
|
);
|
|
6415
6415
|
Callout.displayName = "Callout";
|
|
6416
|
+
var DOT_COLORS = ["bg-rose-300", "bg-amber-300", "bg-green-300"];
|
|
6417
|
+
var FauxClient = react.forwardRef(
|
|
6418
|
+
({
|
|
6419
|
+
variant = "browser",
|
|
6420
|
+
url,
|
|
6421
|
+
meta,
|
|
6422
|
+
dots = true,
|
|
6423
|
+
width,
|
|
6424
|
+
scale = "fit",
|
|
6425
|
+
className,
|
|
6426
|
+
barClassName,
|
|
6427
|
+
bodyClassName,
|
|
6428
|
+
children,
|
|
6429
|
+
...rest
|
|
6430
|
+
}, ref) => {
|
|
6431
|
+
const scaled = typeof width === "number";
|
|
6432
|
+
const viewportRef = react.useRef(null);
|
|
6433
|
+
const stageRef = react.useRef(null);
|
|
6434
|
+
const [s, setS] = react.useState(typeof scale === "number" ? scale : 1);
|
|
6435
|
+
const [contentHeight, setContentHeight] = react.useState(void 0);
|
|
6436
|
+
react.useLayoutEffect(() => {
|
|
6437
|
+
if (!scaled) return;
|
|
6438
|
+
const viewport = viewportRef.current;
|
|
6439
|
+
const stage = stageRef.current;
|
|
6440
|
+
if (!viewport || !stage) return;
|
|
6441
|
+
if (typeof ResizeObserver === "undefined") return;
|
|
6442
|
+
const measure = () => {
|
|
6443
|
+
const avail = viewport.clientWidth;
|
|
6444
|
+
const next = scale === "fit" ? width && width > 0 ? avail / width : 1 : scale;
|
|
6445
|
+
const naturalHeight = stage.offsetHeight;
|
|
6446
|
+
setS(next);
|
|
6447
|
+
setContentHeight(naturalHeight * next);
|
|
6448
|
+
};
|
|
6449
|
+
measure();
|
|
6450
|
+
const ro = new ResizeObserver(measure);
|
|
6451
|
+
ro.observe(viewport);
|
|
6452
|
+
ro.observe(stage);
|
|
6453
|
+
return () => ro.disconnect();
|
|
6454
|
+
}, [scaled, scale, width]);
|
|
6455
|
+
const isBrowser = variant === "browser";
|
|
6456
|
+
const isDevice = variant === "device";
|
|
6457
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
6458
|
+
"div",
|
|
6459
|
+
{
|
|
6460
|
+
ref,
|
|
6461
|
+
"data-react-fancy-faux-client": "",
|
|
6462
|
+
className: cn(
|
|
6463
|
+
"overflow-hidden bg-white dark:bg-zinc-900",
|
|
6464
|
+
isBrowser && "rounded-2xl border border-zinc-200 shadow-xl dark:border-zinc-800",
|
|
6465
|
+
isDevice && "rounded-[2rem] border-[10px] border-zinc-800 shadow-2xl dark:border-zinc-700",
|
|
6466
|
+
variant === "bare" && "rounded-lg border border-zinc-200 dark:border-zinc-800",
|
|
6467
|
+
className
|
|
6468
|
+
),
|
|
6469
|
+
...rest,
|
|
6470
|
+
children: [
|
|
6471
|
+
isBrowser && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
6472
|
+
"div",
|
|
6473
|
+
{
|
|
6474
|
+
className: cn(
|
|
6475
|
+
"flex items-center gap-2 border-b border-zinc-200 bg-zinc-50 px-3.5 py-2.5 font-mono text-[11.5px] text-zinc-500 dark:border-zinc-800 dark:bg-zinc-950 dark:text-zinc-400",
|
|
6476
|
+
barClassName
|
|
6477
|
+
),
|
|
6478
|
+
children: [
|
|
6479
|
+
dots && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mr-1.5 flex gap-[5px]", children: DOT_COLORS.map((color, i) => /* @__PURE__ */ jsxRuntime.jsx("span", { className: cn("h-[9px] w-[9px] rounded-full", color) }, i)) }),
|
|
6480
|
+
url != null && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "min-w-0 flex-1 truncate", children: url }),
|
|
6481
|
+
meta != null && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "shrink-0 text-zinc-400 dark:text-zinc-500", children: meta })
|
|
6482
|
+
]
|
|
6483
|
+
}
|
|
6484
|
+
),
|
|
6485
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
6486
|
+
"div",
|
|
6487
|
+
{
|
|
6488
|
+
ref: viewportRef,
|
|
6489
|
+
className: cn("relative overflow-hidden", bodyClassName),
|
|
6490
|
+
style: scaled ? { height: contentHeight } : void 0,
|
|
6491
|
+
children: scaled ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
6492
|
+
"div",
|
|
6493
|
+
{
|
|
6494
|
+
ref: stageRef,
|
|
6495
|
+
className: "absolute left-0 top-0 origin-top-left",
|
|
6496
|
+
style: { width, transform: `scale(${s})` },
|
|
6497
|
+
children
|
|
6498
|
+
}
|
|
6499
|
+
) : children
|
|
6500
|
+
}
|
|
6501
|
+
)
|
|
6502
|
+
]
|
|
6503
|
+
}
|
|
6504
|
+
);
|
|
6505
|
+
}
|
|
6506
|
+
);
|
|
6507
|
+
FauxClient.displayName = "FauxClient";
|
|
6416
6508
|
var colorClasses5 = {
|
|
6417
6509
|
yellow: "bg-amber-100 text-amber-950 dark:bg-amber-200 dark:text-amber-950",
|
|
6418
6510
|
blue: "bg-sky-100 text-sky-950 dark:bg-sky-200 dark:text-sky-950",
|
|
@@ -13367,6 +13459,7 @@ exports.EMOJI_ENTRIES = EMOJI_ENTRIES;
|
|
|
13367
13459
|
exports.Editor = Editor;
|
|
13368
13460
|
exports.Emoji = Emoji;
|
|
13369
13461
|
exports.EmojiSelect = EmojiSelect;
|
|
13462
|
+
exports.FauxClient = FauxClient;
|
|
13370
13463
|
exports.Field = Field;
|
|
13371
13464
|
exports.FileUpload = FileUpload;
|
|
13372
13465
|
exports.Heading = Heading;
|