asterui 0.12.20 → 0.12.22
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/components/VirtualList.d.ts +29 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +46 -44
- package/dist/index.js.map +1 -1
- package/dist/index10.js +1 -1
- package/dist/index100.js +32 -5
- package/dist/index100.js.map +1 -1
- package/dist/index101.js +5 -13
- package/dist/index101.js.map +1 -1
- package/dist/index102.js +11 -43
- package/dist/index102.js.map +1 -1
- package/dist/index103.js +44 -11
- package/dist/index103.js.map +1 -1
- package/dist/index104.js +10 -12
- package/dist/index104.js.map +1 -1
- package/dist/index105.js +14 -7
- package/dist/index105.js.map +1 -1
- package/dist/index106.js +7 -12
- package/dist/index106.js.map +1 -1
- package/dist/index107.js +11 -29
- package/dist/index107.js.map +1 -1
- package/dist/index108.js +29 -16
- package/dist/index108.js.map +1 -1
- package/dist/index109.js +21 -0
- package/dist/index109.js.map +1 -0
- package/dist/index11.js +14 -14
- package/dist/index110.js +36 -0
- package/dist/index110.js.map +1 -0
- package/dist/index111.js +523 -0
- package/dist/index111.js.map +1 -0
- package/dist/index112.js +53 -0
- package/dist/index112.js.map +1 -0
- package/dist/index20.js +8 -8
- package/dist/index23.js +13 -13
- package/dist/index28.js +2 -2
- package/dist/index36.js +5 -5
- package/dist/index40.js +6 -6
- package/dist/index41.js +30 -30
- package/dist/index45.js +5 -5
- package/dist/index47.js +15 -15
- package/dist/index51.js +18 -18
- package/dist/index51.js.map +1 -1
- package/dist/index55.js +4 -4
- package/dist/index55.js.map +1 -1
- package/dist/index58.js +22 -22
- package/dist/index60.js +3 -3
- package/dist/index60.js.map +1 -1
- package/dist/index62.js +12 -12
- package/dist/index64.js +13 -13
- package/dist/index68.js +12 -12
- package/dist/index71.js +19 -19
- package/dist/index76.js +2 -2
- package/dist/index77.js +21 -21
- package/dist/index8.js +18 -18
- package/dist/index80.js +13 -13
- package/dist/index82.js +23 -23
- package/dist/index88.js +2 -2
- package/dist/index97.js +61 -121
- package/dist/index97.js.map +1 -1
- package/dist/index98.js +126 -14
- package/dist/index98.js.map +1 -1
- package/dist/index99.js +12 -31
- package/dist/index99.js.map +1 -1
- package/package.json +6 -1
package/dist/index98.js
CHANGED
|
@@ -1,17 +1,129 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
}
|
|
1
|
+
import { jsxs as z, jsx as R } from "react/jsx-runtime";
|
|
2
|
+
import { useState as V, useMemo as P, useEffect as Y } from "react";
|
|
3
|
+
const D = "asterui", O = 0.22, U = (t, c = O) => {
|
|
4
|
+
const r = `rgba(0,0,0,${c})`;
|
|
5
|
+
if (t && t.includes("var(--bc")) {
|
|
6
|
+
if (typeof window < "u") {
|
|
7
|
+
const a = getComputedStyle(document.documentElement).getPropertyValue("--bc").trim(), g = getComputedStyle(document.body).getPropertyValue("--bc").trim(), m = a || g;
|
|
8
|
+
if (m)
|
|
9
|
+
return t.replace(/var\(--bc\)/g, m);
|
|
10
|
+
}
|
|
11
|
+
return r;
|
|
12
|
+
}
|
|
13
|
+
if (t) return t;
|
|
14
|
+
if (typeof window > "u") return r;
|
|
15
|
+
const i = getComputedStyle(document.documentElement).getPropertyValue("--bc").trim(), d = getComputedStyle(document.body).getPropertyValue("--bc").trim(), s = i || d;
|
|
16
|
+
return s ? `hsl(${s} / ${c})` : r;
|
|
17
|
+
}, M = (t, c) => {
|
|
18
|
+
const r = t?.fontSize ?? 16;
|
|
19
|
+
return {
|
|
20
|
+
color: c,
|
|
21
|
+
fontSize: r,
|
|
22
|
+
fontWeight: t?.fontWeight ?? 600,
|
|
23
|
+
fontStyle: t?.fontStyle ?? "normal",
|
|
24
|
+
fontFamily: t?.fontFamily ?? "sans-serif",
|
|
25
|
+
lineHeight: t?.lineHeight ?? r * 1.2
|
|
26
|
+
};
|
|
27
|
+
}, X = ({
|
|
28
|
+
children: t,
|
|
29
|
+
className: c = "",
|
|
30
|
+
style: r,
|
|
31
|
+
content: i,
|
|
32
|
+
image: d,
|
|
33
|
+
width: s = 120,
|
|
34
|
+
height: a = 64,
|
|
35
|
+
gap: g,
|
|
36
|
+
offset: m,
|
|
37
|
+
rotate: T = -22,
|
|
38
|
+
zIndex: W = 1e3,
|
|
39
|
+
font: S,
|
|
40
|
+
...A
|
|
41
|
+
}) => {
|
|
42
|
+
const [y, $] = V(null), u = g?.[0] ?? 120, f = g?.[1] ?? 120, B = m?.[0] ?? u / 2, F = m?.[1] ?? f / 2, E = P(
|
|
43
|
+
() => typeof i == "string" ? [i] : Array.isArray(i) ? i : [D],
|
|
44
|
+
[i]
|
|
45
|
+
), k = U(S?.color), l = P(
|
|
46
|
+
() => M(S, k),
|
|
47
|
+
[S, k]
|
|
48
|
+
), h = Math.PI / 180 * T, I = E.join("|");
|
|
49
|
+
Y(() => {
|
|
50
|
+
if (typeof window > "u") return;
|
|
51
|
+
let p = !1;
|
|
52
|
+
const n = window.devicePixelRatio || 1, w = s + u, C = a + f, v = document.createElement("canvas");
|
|
53
|
+
v.width = w * n, v.height = C * n;
|
|
54
|
+
const e = v.getContext("2d");
|
|
55
|
+
if (!e) return;
|
|
56
|
+
const L = () => {
|
|
57
|
+
const o = v.toDataURL();
|
|
58
|
+
p || $({ url: o, width: w, height: C });
|
|
59
|
+
}, N = () => {
|
|
60
|
+
e.save(), e.translate((u / 2 + s / 2) * n, (f / 2 + a / 2) * n), e.rotate(h), e.fillStyle = l.color, e.textAlign = "center", e.textBaseline = "middle", e.font = `${l.fontStyle} normal ${l.fontWeight} ${l.fontSize * n}px ${l.fontFamily}`;
|
|
61
|
+
const o = l.lineHeight * n, b = -((E.length - 1) * o) / 2;
|
|
62
|
+
E.forEach((x, j) => {
|
|
63
|
+
e.fillText(x, 0, b + j * o);
|
|
64
|
+
}), e.restore();
|
|
65
|
+
};
|
|
66
|
+
if (d) {
|
|
67
|
+
const o = new Image();
|
|
68
|
+
o.crossOrigin = "anonymous", o.referrerPolicy = "no-referrer";
|
|
69
|
+
const b = () => {
|
|
70
|
+
e.save(), e.translate((u / 2 + s / 2) * n, (f / 2 + a / 2) * n), e.rotate(h), e.drawImage(
|
|
71
|
+
o,
|
|
72
|
+
-s / 2 * n,
|
|
73
|
+
-a / 2 * n,
|
|
74
|
+
s * n,
|
|
75
|
+
a * n
|
|
76
|
+
), e.restore(), L();
|
|
77
|
+
}, x = () => {
|
|
78
|
+
p || $(null);
|
|
79
|
+
};
|
|
80
|
+
return o.addEventListener("load", b), o.addEventListener("error", x), o.src = d, () => {
|
|
81
|
+
p = !0, o.removeEventListener("load", b), o.removeEventListener("error", x);
|
|
82
|
+
};
|
|
83
|
+
} else
|
|
84
|
+
N(), L();
|
|
85
|
+
return () => {
|
|
86
|
+
p = !0;
|
|
87
|
+
};
|
|
88
|
+
}, [
|
|
89
|
+
l,
|
|
90
|
+
u,
|
|
91
|
+
f,
|
|
92
|
+
a,
|
|
93
|
+
d,
|
|
94
|
+
h,
|
|
95
|
+
I,
|
|
96
|
+
s
|
|
97
|
+
]);
|
|
98
|
+
const H = ["relative", c].filter(Boolean).join(" ");
|
|
99
|
+
return /* @__PURE__ */ z(
|
|
100
|
+
"div",
|
|
101
|
+
{
|
|
102
|
+
className: H,
|
|
103
|
+
style: { position: r?.position ?? "relative", ...r },
|
|
104
|
+
...A,
|
|
105
|
+
children: [
|
|
106
|
+
t,
|
|
107
|
+
y && /* @__PURE__ */ R(
|
|
108
|
+
"div",
|
|
109
|
+
{
|
|
110
|
+
"aria-hidden": !0,
|
|
111
|
+
className: "pointer-events-none absolute inset-0",
|
|
112
|
+
style: {
|
|
113
|
+
zIndex: W,
|
|
114
|
+
backgroundImage: `url(${y.url})`,
|
|
115
|
+
backgroundRepeat: "repeat",
|
|
116
|
+
backgroundSize: `${y.width}px ${y.height}px`,
|
|
117
|
+
backgroundPosition: `${B}px ${F}px`
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
)
|
|
121
|
+
]
|
|
122
|
+
}
|
|
123
|
+
);
|
|
124
|
+
};
|
|
125
|
+
X.displayName = "Watermark";
|
|
13
126
|
export {
|
|
14
|
-
|
|
15
|
-
h as Show
|
|
127
|
+
X as Watermark
|
|
16
128
|
};
|
|
17
129
|
//# sourceMappingURL=index98.js.map
|
package/dist/index98.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index98.js","sources":["../src/components/Responsive.tsx"],"sourcesContent":["import React, { ReactNode } from 'react'\nimport { useBreakpoint, Breakpoint } from '../hooks/useBreakpoint'\n\nexport interface ShowProps {\n children: ReactNode\n above?: Breakpoint\n below?: Breakpoint\n at?: Breakpoint | Breakpoint[]\n between?: [Breakpoint, Breakpoint]\n}\n\nexport function Show({ children, above, below, at, between }: ShowProps): React.ReactElement | null {\n const { isAbove, isBelow, isAt, isBetween } = useBreakpoint()\n\n let shouldShow = false\n\n if (above !== undefined) {\n shouldShow = isAbove(above)\n } else if (below !== undefined) {\n shouldShow = isBelow(below)\n } else if (at !== undefined) {\n if (Array.isArray(at)) {\n shouldShow = at.some((bp) => isAt(bp))\n } else {\n shouldShow = isAt(at)\n }\n } else if (between !== undefined) {\n shouldShow = isBetween(between[0], between[1])\n } else {\n shouldShow = true\n }\n\n return shouldShow ? <>{children}</> : null\n}\n\nexport interface HideProps {\n children: ReactNode\n above?: Breakpoint\n below?: Breakpoint\n at?: Breakpoint | Breakpoint[]\n between?: [Breakpoint, Breakpoint]\n}\n\nexport function Hide({ children, above, below, at, between }: HideProps): React.ReactElement | null {\n const { isAbove, isBelow, isAt, isBetween } = useBreakpoint()\n\n let shouldHide = false\n\n if (above !== undefined) {\n shouldHide = isAbove(above)\n } else if (below !== undefined) {\n shouldHide = isBelow(below)\n } else if (at !== undefined) {\n if (Array.isArray(at)) {\n shouldHide = at.some((bp) => isAt(bp))\n } else {\n shouldHide = isAt(at)\n }\n } else if (between !== undefined) {\n shouldHide = isBetween(between[0], between[1])\n }\n\n return shouldHide ? null : <>{children}</>\n}\n"],"names":["Show","children","above","below","at","between","isAbove","isBelow","isAt","isBetween","useBreakpoint","shouldShow","bp","jsx","Fragment","Hide","shouldHide"],"mappings":";;AAWO,SAASA,EAAK,EAAE,UAAAC,GAAU,OAAAC,GAAO,OAAAC,GAAO,IAAAC,GAAI,SAAAC,KAAiD;AAClG,QAAM,EAAE,SAAAC,GAAS,SAAAC,GAAS,MAAAC,GAAM,WAAAC,EAAA,IAAcC,EAAA;AAE9C,MAAIC,IAAa;AAEjB,SAAIT,MAAU,SACZS,IAAaL,EAAQJ,CAAK,IACjBC,MAAU,SACnBQ,IAAaJ,EAAQJ,CAAK,IACjBC,MAAO,SACZ,MAAM,QAAQA,CAAE,IAClBO,IAAaP,EAAG,KAAK,CAACQ,MAAOJ,EAAKI,CAAE,CAAC,IAErCD,IAAaH,EAAKJ,CAAE,IAEbC,MAAY,SACrBM,IAAaF,EAAUJ,EAAQ,CAAC,GAAGA,EAAQ,CAAC,CAAC,IAE7CM,IAAa,IAGRA,IAAa,gBAAAE,EAAAC,GAAA,EAAG,UAAAb,EAAA,CAAS,IAAM;AACxC;AAUO,SAASc,EAAK,EAAE,UAAAd,GAAU,OAAAC,GAAO,OAAAC,GAAO,IAAAC,GAAI,SAAAC,KAAiD;AAClG,QAAM,EAAE,SAAAC,GAAS,SAAAC,GAAS,MAAAC,GAAM,WAAAC,EAAA,IAAcC,EAAA;AAE9C,MAAIM,IAAa;AAEjB,SAAId,MAAU,SACZc,IAAaV,EAAQJ,CAAK,IACjBC,MAAU,SACnBa,IAAaT,EAAQJ,CAAK,IACjBC,MAAO,SACZ,MAAM,QAAQA,CAAE,IAClBY,IAAaZ,EAAG,KAAK,CAACQ,MAAOJ,EAAKI,CAAE,CAAC,IAErCI,IAAaR,EAAKJ,CAAE,IAEbC,MAAY,WACrBW,IAAaP,EAAUJ,EAAQ,CAAC,GAAGA,EAAQ,CAAC,CAAC,IAGxCW,IAAa,OAAO,gBAAAH,EAAAC,GAAA,EAAG,UAAAb,EAAA,CAAS;AACzC;"}
|
|
1
|
+
{"version":3,"file":"index98.js","sources":["../src/components/Watermark.tsx"],"sourcesContent":["import React, { useEffect, useMemo, useState } from 'react'\n\nexport type WatermarkGap = [number, number]\nexport type WatermarkOffset = [number, number]\n\nexport interface WatermarkFontOptions {\n /** Text color for watermark content */\n color?: string\n /** Font size in pixels */\n fontSize?: number\n /** Font weight for watermark text */\n fontWeight?: number | 'normal' | 'bold' | 'bolder' | 'lighter'\n /** Font style for watermark text */\n fontStyle?: 'normal' | 'italic' | 'oblique'\n /** Font family for watermark text */\n fontFamily?: string\n /** Line height in pixels for multi-line content */\n lineHeight?: number\n}\n\nexport interface WatermarkProps\n extends Omit<React.HTMLAttributes<HTMLDivElement>, 'content'> {\n /** Text to render inside the watermark; falls back to \"asterui\" */\n content?: string | string[]\n /** Image source (URL or base64) to render instead of text */\n image?: string\n /** Width of a single watermark tile in pixels */\n width?: number\n /** Height of a single watermark tile in pixels */\n height?: number\n /** Horizontal/vertical gap between watermarks in pixels */\n gap?: WatermarkGap\n /** Offset for the first watermark tile from the top-left corner */\n offset?: WatermarkOffset\n /** Rotation angle in degrees */\n rotate?: number\n /** z-index for the overlay layer */\n zIndex?: number\n /** Font settings for text watermarks */\n font?: WatermarkFontOptions\n /** Content to protect with the watermark */\n children?: React.ReactNode\n}\n\ntype WatermarkImage = {\n url: string\n width: number\n height: number\n}\n\nconst DEFAULT_CONTENT = 'asterui'\nconst DEFAULT_OPACITY = 0.22\n\nconst resolveThemeColor = (requested?: string, opacity = DEFAULT_OPACITY) => {\n const fallback = `rgba(0,0,0,${opacity})`\n\n if (requested && requested.includes('var(--bc')) {\n if (typeof window !== 'undefined') {\n const docBase = getComputedStyle(document.documentElement).getPropertyValue('--bc').trim()\n const bodyBase = getComputedStyle(document.body).getPropertyValue('--bc').trim()\n const base = docBase || bodyBase\n if (base) {\n return requested.replace(/var\\(--bc\\)/g, base)\n }\n }\n return fallback\n }\n\n if (requested) return requested\n\n if (typeof window === 'undefined') return fallback\n\n const docBase = getComputedStyle(document.documentElement).getPropertyValue('--bc').trim()\n const bodyBase = getComputedStyle(document.body).getPropertyValue('--bc').trim()\n const base = docBase || bodyBase\n\n return base ? `hsl(${base} / ${opacity})` : fallback\n}\n\nconst getFontSettings = (font: WatermarkFontOptions | undefined, resolvedColor: string) => {\n const fontSize = font?.fontSize ?? 16\n\n return {\n color: resolvedColor,\n fontSize,\n fontWeight: font?.fontWeight ?? 600,\n fontStyle: font?.fontStyle ?? 'normal',\n fontFamily: font?.fontFamily ?? 'sans-serif',\n lineHeight: font?.lineHeight ?? fontSize * 1.2,\n }\n}\n\nexport const Watermark: React.FC<WatermarkProps> = ({\n children,\n className = '',\n style,\n content,\n image,\n width = 120,\n height = 64,\n gap,\n offset,\n rotate = -22,\n zIndex = 1000,\n font,\n ...rest\n}) => {\n const [watermark, setWatermark] = useState<WatermarkImage | null>(null)\n\n const gapX = gap?.[0] ?? 120\n const gapY = gap?.[1] ?? 120\n const offsetX = offset?.[0] ?? gapX / 2\n const offsetY = offset?.[1] ?? gapY / 2\n const textLines = useMemo(\n () =>\n typeof content === 'string'\n ? [content]\n : Array.isArray(content)\n ? content\n : [DEFAULT_CONTENT],\n [content]\n )\n const resolvedColor = resolveThemeColor(font?.color)\n const fontSettings = useMemo(\n () => getFontSettings(font, resolvedColor),\n [font, resolvedColor]\n )\n const rotationInRadians = (Math.PI / 180) * rotate\n const textKey = textLines.join('|')\n\n useEffect(() => {\n if (typeof window === 'undefined') return\n\n let cancelled = false\n const ratio = window.devicePixelRatio || 1\n const tileWidth = width + gapX\n const tileHeight = height + gapY\n const canvas = document.createElement('canvas')\n canvas.width = tileWidth * ratio\n canvas.height = tileHeight * ratio\n const ctx = canvas.getContext('2d')\n\n if (!ctx) return\n\n const commitWatermark = () => {\n const url = canvas.toDataURL()\n if (!cancelled) {\n setWatermark({ url, width: tileWidth, height: tileHeight })\n }\n }\n\n const drawText = () => {\n ctx.save()\n ctx.translate((gapX / 2 + width / 2) * ratio, (gapY / 2 + height / 2) * ratio)\n ctx.rotate(rotationInRadians)\n ctx.fillStyle = fontSettings.color\n ctx.textAlign = 'center'\n ctx.textBaseline = 'middle'\n ctx.font = `${fontSettings.fontStyle} normal ${fontSettings.fontWeight} ${fontSettings.fontSize * ratio}px ${fontSettings.fontFamily}`\n\n const lineHeight = fontSettings.lineHeight * ratio\n const startY = -((textLines.length - 1) * lineHeight) / 2\n\n textLines.forEach((line, index) => {\n ctx.fillText(line, 0, startY + index * lineHeight)\n })\n\n ctx.restore()\n }\n\n if (image) {\n const img = new Image()\n img.crossOrigin = 'anonymous'\n img.referrerPolicy = 'no-referrer'\n\n const handleLoad = () => {\n ctx.save()\n ctx.translate((gapX / 2 + width / 2) * ratio, (gapY / 2 + height / 2) * ratio)\n ctx.rotate(rotationInRadians)\n ctx.drawImage(\n img,\n (-width / 2) * ratio,\n (-height / 2) * ratio,\n width * ratio,\n height * ratio\n )\n ctx.restore()\n commitWatermark()\n }\n\n const handleError = () => {\n if (!cancelled) setWatermark(null)\n }\n\n img.addEventListener('load', handleLoad)\n img.addEventListener('error', handleError)\n img.src = image\n\n return () => {\n cancelled = true\n img.removeEventListener('load', handleLoad)\n img.removeEventListener('error', handleError)\n }\n } else {\n drawText()\n commitWatermark()\n }\n\n return () => {\n cancelled = true\n }\n }, [\n fontSettings,\n gapX,\n gapY,\n height,\n image,\n rotationInRadians,\n textKey,\n width,\n ])\n\n const classes = ['relative', className].filter(Boolean).join(' ')\n\n return (\n <div\n className={classes}\n style={{ position: style?.position ?? 'relative', ...style }}\n {...rest}\n >\n {children}\n {watermark && (\n <div\n aria-hidden\n className=\"pointer-events-none absolute inset-0\"\n style={{\n zIndex,\n backgroundImage: `url(${watermark.url})`,\n backgroundRepeat: 'repeat',\n backgroundSize: `${watermark.width}px ${watermark.height}px`,\n backgroundPosition: `${offsetX}px ${offsetY}px`,\n }}\n />\n )}\n </div>\n )\n}\n\nWatermark.displayName = 'Watermark'\n"],"names":["DEFAULT_CONTENT","DEFAULT_OPACITY","resolveThemeColor","requested","opacity","fallback","docBase","bodyBase","base","getFontSettings","font","resolvedColor","fontSize","Watermark","children","className","style","content","image","width","height","gap","offset","rotate","zIndex","rest","watermark","setWatermark","useState","gapX","gapY","offsetX","offsetY","textLines","useMemo","fontSettings","rotationInRadians","textKey","useEffect","cancelled","ratio","tileWidth","tileHeight","canvas","ctx","commitWatermark","url","drawText","lineHeight","startY","line","index","img","handleLoad","handleError","classes","jsxs","jsx"],"mappings":";;AAkDA,MAAMA,IAAkB,WAClBC,IAAkB,MAElBC,IAAoB,CAACC,GAAoBC,IAAUH,MAAoB;AAC3E,QAAMI,IAAW,cAAcD,CAAO;AAEtC,MAAID,KAAaA,EAAU,SAAS,UAAU,GAAG;AAC/C,QAAI,OAAO,SAAW,KAAa;AACjC,YAAMG,IAAU,iBAAiB,SAAS,eAAe,EAAE,iBAAiB,MAAM,EAAE,KAAA,GAC9EC,IAAW,iBAAiB,SAAS,IAAI,EAAE,iBAAiB,MAAM,EAAE,KAAA,GACpEC,IAAOF,KAAWC;AACxB,UAAIC;AACF,eAAOL,EAAU,QAAQ,gBAAgBK,CAAI;AAAA,IAEjD;AACA,WAAOH;AAAA,EACT;AAEA,MAAIF,EAAW,QAAOA;AAEtB,MAAI,OAAO,SAAW,IAAa,QAAOE;AAE1C,QAAMC,IAAU,iBAAiB,SAAS,eAAe,EAAE,iBAAiB,MAAM,EAAE,KAAA,GAC9EC,IAAW,iBAAiB,SAAS,IAAI,EAAE,iBAAiB,MAAM,EAAE,KAAA,GACpEC,IAAOF,KAAWC;AAExB,SAAOC,IAAO,OAAOA,CAAI,MAAMJ,CAAO,MAAMC;AAC9C,GAEMI,IAAkB,CAACC,GAAwCC,MAA0B;AACzF,QAAMC,IAAWF,GAAM,YAAY;AAEnC,SAAO;AAAA,IACL,OAAOC;A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|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
"2xl": 1536
|
|
8
|
-
}, s = ["xs", "sm", "md", "lg", "xl", "2xl"];
|
|
9
|
-
function l(e) {
|
|
10
|
-
return e >= t["2xl"] ? "2xl" : e >= t.xl ? "xl" : e >= t.lg ? "lg" : e >= t.md ? "md" : e >= t.sm ? "sm" : "xs";
|
|
1
|
+
import { jsx as v, Fragment as A } from "react/jsx-runtime";
|
|
2
|
+
import { useBreakpoint as m } from "./index100.js";
|
|
3
|
+
function h({ children: f, above: o, below: r, at: s, between: e }) {
|
|
4
|
+
const { isAbove: d, isBelow: n, isAt: l, isBetween: u } = m();
|
|
5
|
+
let i = !1;
|
|
6
|
+
return o !== void 0 ? i = d(o) : r !== void 0 ? i = n(r) : s !== void 0 ? Array.isArray(s) ? i = s.some((t) => l(t)) : i = l(s) : e !== void 0 ? i = u(e[0], e[1]) : i = !0, i ? /* @__PURE__ */ v(A, { children: f }) : null;
|
|
11
7
|
}
|
|
12
|
-
function
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
const [e, o] = u(
|
|
17
|
-
() => typeof window < "u" ? window.innerWidth : 1024
|
|
18
|
-
);
|
|
19
|
-
f(() => {
|
|
20
|
-
const n = () => o(window.innerWidth);
|
|
21
|
-
return window.addEventListener("resize", n), () => window.removeEventListener("resize", n);
|
|
22
|
-
}, []);
|
|
23
|
-
const r = l(e);
|
|
24
|
-
return {
|
|
25
|
-
breakpoint: r,
|
|
26
|
-
width: e,
|
|
27
|
-
isAbove: (n) => i(r, n) >= 0,
|
|
28
|
-
isBelow: (n) => i(r, n) < 0,
|
|
29
|
-
isAt: (n) => r === n,
|
|
30
|
-
isBetween: (n, d) => i(r, n) >= 0 && i(r, d) <= 0
|
|
31
|
-
};
|
|
8
|
+
function p({ children: f, above: o, below: r, at: s, between: e }) {
|
|
9
|
+
const { isAbove: d, isBelow: n, isAt: l, isBetween: u } = m();
|
|
10
|
+
let i = !1;
|
|
11
|
+
return o !== void 0 ? i = d(o) : r !== void 0 ? i = n(r) : s !== void 0 ? Array.isArray(s) ? i = s.some((t) => l(t)) : i = l(s) : e !== void 0 && (i = u(e[0], e[1])), i ? null : /* @__PURE__ */ v(A, { children: f });
|
|
32
12
|
}
|
|
33
13
|
export {
|
|
34
|
-
|
|
14
|
+
p as Hide,
|
|
15
|
+
h as Show
|
|
35
16
|
};
|
|
36
17
|
//# sourceMappingURL=index99.js.map
|
package/dist/index99.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index99.js","sources":["../src/
|
|
1
|
+
{"version":3,"file":"index99.js","sources":["../src/components/Responsive.tsx"],"sourcesContent":["import React, { ReactNode } from 'react'\nimport { useBreakpoint, Breakpoint } from '../hooks/useBreakpoint'\n\nexport interface ShowProps {\n children: ReactNode\n above?: Breakpoint\n below?: Breakpoint\n at?: Breakpoint | Breakpoint[]\n between?: [Breakpoint, Breakpoint]\n}\n\nexport function Show({ children, above, below, at, between }: ShowProps): React.ReactElement | null {\n const { isAbove, isBelow, isAt, isBetween } = useBreakpoint()\n\n let shouldShow = false\n\n if (above !== undefined) {\n shouldShow = isAbove(above)\n } else if (below !== undefined) {\n shouldShow = isBelow(below)\n } else if (at !== undefined) {\n if (Array.isArray(at)) {\n shouldShow = at.some((bp) => isAt(bp))\n } else {\n shouldShow = isAt(at)\n }\n } else if (between !== undefined) {\n shouldShow = isBetween(between[0], between[1])\n } else {\n shouldShow = true\n }\n\n return shouldShow ? <>{children}</> : null\n}\n\nexport interface HideProps {\n children: ReactNode\n above?: Breakpoint\n below?: Breakpoint\n at?: Breakpoint | Breakpoint[]\n between?: [Breakpoint, Breakpoint]\n}\n\nexport function Hide({ children, above, below, at, between }: HideProps): React.ReactElement | null {\n const { isAbove, isBelow, isAt, isBetween } = useBreakpoint()\n\n let shouldHide = false\n\n if (above !== undefined) {\n shouldHide = isAbove(above)\n } else if (below !== undefined) {\n shouldHide = isBelow(below)\n } else if (at !== undefined) {\n if (Array.isArray(at)) {\n shouldHide = at.some((bp) => isAt(bp))\n } else {\n shouldHide = isAt(at)\n }\n } else if (between !== undefined) {\n shouldHide = isBetween(between[0], between[1])\n }\n\n return shouldHide ? null : <>{children}</>\n}\n"],"names":["Show","children","above","below","at","between","isAbove","isBelow","isAt","isBetween","useBreakpoint","shouldShow","bp","jsx","Fragment","Hide","shouldHide"],"mappings":";;AAWO,SAASA,EAAK,EAAE,UAAAC,GAAU,OAAAC,GAAO,OAAAC,GAAO,IAAAC,GAAI,SAAAC,KAAiD;AAClG,QAAM,EAAE,SAAAC,GAAS,SAAAC,GAAS,MAAAC,GAAM,WAAAC,EAAA,IAAcC,EAAA;AAE9C,MAAIC,IAAa;AAEjB,SAAIT,MAAU,SACZS,IAAaL,EAAQJ,CAAK,IACjBC,MAAU,SACnBQ,IAAaJ,EAAQJ,CAAK,IACjBC,MAAO,SACZ,MAAM,QAAQA,CAAE,IAClBO,IAAaP,EAAG,KAAK,CAACQ,MAAOJ,EAAKI,CAAE,CAAC,IAErCD,IAAaH,EAAKJ,CAAE,IAEbC,MAAY,SACrBM,IAAaF,EAAUJ,EAAQ,CAAC,GAAGA,EAAQ,CAAC,CAAC,IAE7CM,IAAa,IAGRA,IAAa,gBAAAE,EAAAC,GAAA,EAAG,UAAAb,EAAA,CAAS,IAAM;AACxC;AAUO,SAASc,EAAK,EAAE,UAAAd,GAAU,OAAAC,GAAO,OAAAC,GAAO,IAAAC,GAAI,SAAAC,KAAiD;AAClG,QAAM,EAAE,SAAAC,GAAS,SAAAC,GAAS,MAAAC,GAAM,WAAAC,EAAA,IAAcC,EAAA;AAE9C,MAAIM,IAAa;AAEjB,SAAId,MAAU,SACZc,IAAaV,EAAQJ,CAAK,IACjBC,MAAU,SACnBa,IAAaT,EAAQJ,CAAK,IACjBC,MAAO,SACZ,MAAM,QAAQA,CAAE,IAClBY,IAAaZ,EAAG,KAAK,CAACQ,MAAOJ,EAAKI,CAAE,CAAC,IAErCI,IAAaR,EAAKJ,CAAE,IAEbC,MAAY,WACrBW,IAAaP,EAAUJ,EAAQ,CAAC,GAAGA,EAAQ,CAAC,CAAC,IAGxCW,IAAa,OAAO,gBAAAH,EAAAC,GAAA,EAAG,UAAAb,EAAA,CAAS;AACzC;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "asterui",
|
|
3
|
-
"version": "0.12.
|
|
3
|
+
"version": "0.12.22",
|
|
4
4
|
"description": "React UI component library with DaisyUI",
|
|
5
5
|
"homepage": "https://asterui.com",
|
|
6
6
|
"repository": {
|
|
@@ -25,6 +25,7 @@
|
|
|
25
25
|
],
|
|
26
26
|
"sideEffects": false,
|
|
27
27
|
"peerDependencies": {
|
|
28
|
+
"@tanstack/react-virtual": "^3.0.0",
|
|
28
29
|
"apexcharts": "^5.3.6",
|
|
29
30
|
"qrcode": "^1.5.4",
|
|
30
31
|
"react": "^18.0.0 || ^19.0.0",
|
|
@@ -32,6 +33,9 @@
|
|
|
32
33
|
"react-hook-form": "^7.0.0"
|
|
33
34
|
},
|
|
34
35
|
"peerDependenciesMeta": {
|
|
36
|
+
"@tanstack/react-virtual": {
|
|
37
|
+
"optional": true
|
|
38
|
+
},
|
|
35
39
|
"apexcharts": {
|
|
36
40
|
"optional": true
|
|
37
41
|
},
|
|
@@ -41,6 +45,7 @@
|
|
|
41
45
|
},
|
|
42
46
|
"devDependencies": {
|
|
43
47
|
"@tailwindcss/vite": "^4.1.17",
|
|
48
|
+
"@tanstack/react-virtual": "^3.13.13",
|
|
44
49
|
"@types/qrcode": "^1.5.6",
|
|
45
50
|
"@types/react": "^19.2.2",
|
|
46
51
|
"@types/react-dom": "^19.2.2",
|