asterui 0.12.19 → 0.12.20
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/Code.d.ts +2 -0
- package/dist/components/CopyButton.d.ts +34 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +205 -203
- package/dist/index.js.map +1 -1
- package/dist/index10.js +91 -121
- package/dist/index10.js.map +1 -1
- package/dist/index100.js +5 -13
- package/dist/index100.js.map +1 -1
- package/dist/index101.js +11 -43
- package/dist/index101.js.map +1 -1
- package/dist/index102.js +44 -11
- package/dist/index102.js.map +1 -1
- package/dist/index103.js +10 -12
- package/dist/index103.js.map +1 -1
- package/dist/index104.js +14 -7
- package/dist/index104.js.map +1 -1
- package/dist/index105.js +7 -12
- package/dist/index105.js.map +1 -1
- package/dist/index106.js +11 -29
- package/dist/index106.js.map +1 -1
- package/dist/index107.js +29 -16
- package/dist/index107.js.map +1 -1
- package/dist/index108.js +21 -0
- package/dist/index108.js.map +1 -0
- package/dist/index11.js +123 -30
- package/dist/index11.js.map +1 -1
- package/dist/index12.js +28 -263
- package/dist/index12.js.map +1 -1
- package/dist/index13.js +257 -105
- package/dist/index13.js.map +1 -1
- package/dist/index14.js +108 -153
- package/dist/index14.js.map +1 -1
- package/dist/index15.js +154 -146
- package/dist/index15.js.map +1 -1
- package/dist/index16.js +150 -5
- package/dist/index16.js.map +1 -1
- package/dist/index17.js +5 -71
- package/dist/index17.js.map +1 -1
- package/dist/index18.js +70 -24
- package/dist/index18.js.map +1 -1
- package/dist/index19.js +23 -194
- package/dist/index19.js.map +1 -1
- package/dist/index20.js +188 -106
- package/dist/index20.js.map +1 -1
- package/dist/index21.js +107 -177
- package/dist/index21.js.map +1 -1
- package/dist/index22.js +181 -107
- package/dist/index22.js.map +1 -1
- package/dist/index23.js +110 -19
- package/dist/index23.js.map +1 -1
- package/dist/index24.js +17 -41
- package/dist/index24.js.map +1 -1
- package/dist/index25.js +43 -32
- package/dist/index25.js.map +1 -1
- package/dist/index26.js +30 -170
- package/dist/index26.js.map +1 -1
- package/dist/index27.js +171 -40
- package/dist/index27.js.map +1 -1
- package/dist/index28.js +41 -17
- package/dist/index28.js.map +1 -1
- package/dist/index29.js +17 -33
- package/dist/index29.js.map +1 -1
- package/dist/index30.js +33 -52
- package/dist/index30.js.map +1 -1
- package/dist/index31.js +50 -61
- package/dist/index31.js.map +1 -1
- package/dist/index32.js +60 -181
- package/dist/index32.js.map +1 -1
- package/dist/index33.js +184 -18
- package/dist/index33.js.map +1 -1
- package/dist/index34.js +15 -271
- package/dist/index34.js.map +1 -1
- package/dist/index35.js +270 -1083
- package/dist/index35.js.map +1 -1
- package/dist/index36.js +1086 -16
- package/dist/index36.js.map +1 -1
- package/dist/index37.js +17 -17
- package/dist/index37.js.map +1 -1
- package/dist/index38.js +15 -120
- package/dist/index38.js.map +1 -1
- package/dist/index39.js +119 -37
- package/dist/index39.js.map +1 -1
- package/dist/index40.js +40 -398
- package/dist/index40.js.map +1 -1
- package/dist/index41.js +390 -89
- package/dist/index41.js.map +1 -1
- package/dist/index42.js +91 -253
- package/dist/index42.js.map +1 -1
- package/dist/index43.js +249 -145
- package/dist/index43.js.map +1 -1
- package/dist/index44.js +155 -15
- package/dist/index44.js.map +1 -1
- package/dist/index45.js +15 -17
- package/dist/index45.js.map +1 -1
- package/dist/index46.js +16 -136
- package/dist/index46.js.map +1 -1
- package/dist/index47.js +134 -10
- package/dist/index47.js.map +1 -1
- package/dist/index48.js +13 -35
- package/dist/index48.js.map +1 -1
- package/dist/index49.js +35 -34
- package/dist/index49.js.map +1 -1
- package/dist/index50.js +34 -81
- package/dist/index50.js.map +1 -1
- package/dist/index51.js +71 -166
- package/dist/index51.js.map +1 -1
- package/dist/index52.js +167 -144
- package/dist/index52.js.map +1 -1
- package/dist/index53.js +152 -11
- package/dist/index53.js.map +1 -1
- package/dist/index54.js +10 -20
- package/dist/index54.js.map +1 -1
- package/dist/index55.js +55 -12
- package/dist/index55.js.map +1 -1
- package/dist/index56.js +14 -7
- package/dist/index56.js.map +1 -1
- package/dist/index57.js +6 -333
- package/dist/index57.js.map +1 -1
- package/dist/index58.js +334 -47
- package/dist/index58.js.map +1 -1
- package/dist/index59.js +47 -122
- package/dist/index59.js.map +1 -1
- package/dist/index60.js +120 -108
- package/dist/index60.js.map +1 -1
- package/dist/index61.js +107 -167
- package/dist/index61.js.map +1 -1
- package/dist/index62.js +167 -29
- package/dist/index62.js.map +1 -1
- package/dist/index63.js +30 -120
- package/dist/index63.js.map +1 -1
- package/dist/index64.js +116 -80
- package/dist/index64.js.map +1 -1
- package/dist/index65.js +85 -19
- package/dist/index65.js.map +1 -1
- package/dist/index66.js +19 -73
- package/dist/index66.js.map +1 -1
- package/dist/index67.js +71 -54
- package/dist/index67.js.map +1 -1
- package/dist/index68.js +56 -44
- package/dist/index68.js.map +1 -1
- package/dist/index69.js +42 -49
- package/dist/index69.js.map +1 -1
- package/dist/index70.js +50 -121
- package/dist/index70.js.map +1 -1
- package/dist/index71.js +118 -102
- package/dist/index71.js.map +1 -1
- package/dist/index72.js +105 -72
- package/dist/index72.js.map +1 -1
- package/dist/index73.js +73 -67
- package/dist/index73.js.map +1 -1
- package/dist/index74.js +66 -19
- package/dist/index74.js.map +1 -1
- package/dist/index75.js +18 -55
- package/dist/index75.js.map +1 -1
- package/dist/index76.js +55 -251
- package/dist/index76.js.map +1 -1
- package/dist/index77.js +254 -22
- package/dist/index77.js.map +1 -1
- package/dist/index78.js +22 -31
- package/dist/index78.js.map +1 -1
- package/dist/index79.js +30 -93
- package/dist/index79.js.map +1 -1
- package/dist/index80.js +89 -324
- package/dist/index80.js.map +1 -1
- package/dist/index81.js +322 -73
- package/dist/index81.js.map +1 -1
- package/dist/index82.js +79 -39
- package/dist/index82.js.map +1 -1
- package/dist/index83.js +40 -23
- package/dist/index83.js.map +1 -1
- package/dist/index84.js +21 -93
- package/dist/index84.js.map +1 -1
- package/dist/index85.js +87 -148
- package/dist/index85.js.map +1 -1
- package/dist/index86.js +147 -152
- package/dist/index86.js.map +1 -1
- package/dist/index87.js +159 -63
- package/dist/index87.js.map +1 -1
- package/dist/index88.js +65 -35
- package/dist/index88.js.map +1 -1
- package/dist/index89.js +35 -234
- package/dist/index89.js.map +1 -1
- package/dist/index90.js +231 -31
- package/dist/index90.js.map +1 -1
- package/dist/index91.js +34 -210
- package/dist/index91.js.map +1 -1
- package/dist/index92.js +195 -198
- package/dist/index92.js.map +1 -1
- package/dist/index93.js +159 -241
- package/dist/index93.js.map +1 -1
- package/dist/index94.js +283 -166
- package/dist/index94.js.map +1 -1
- package/dist/index95.js +173 -253
- package/dist/index95.js.map +1 -1
- package/dist/index96.js +253 -121
- package/dist/index96.js.map +1 -1
- package/dist/index97.js +126 -14
- package/dist/index97.js.map +1 -1
- package/dist/index98.js +12 -31
- package/dist/index98.js.map +1 -1
- package/dist/index99.js +32 -5
- package/dist/index99.js.map +1 -1
- package/package.json +1 -1
package/dist/index98.js
CHANGED
|
@@ -1,36 +1,17 @@
|
|
|
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 "./index99.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=index98.js.map
|
package/dist/index98.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index98.js","sources":["../src/
|
|
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;"}
|
package/dist/index99.js
CHANGED
|
@@ -1,9 +1,36 @@
|
|
|
1
|
-
import { useState as u,
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { useState as u, useEffect as f } from "react";
|
|
2
|
+
const t = {
|
|
3
|
+
sm: 640,
|
|
4
|
+
md: 768,
|
|
5
|
+
lg: 1024,
|
|
6
|
+
xl: 1280,
|
|
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";
|
|
11
|
+
}
|
|
12
|
+
function i(e, o) {
|
|
13
|
+
return s.indexOf(e) - s.indexOf(o);
|
|
14
|
+
}
|
|
15
|
+
function m() {
|
|
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
|
+
};
|
|
5
32
|
}
|
|
6
33
|
export {
|
|
7
|
-
|
|
34
|
+
m as useBreakpoint
|
|
8
35
|
};
|
|
9
36
|
//# sourceMappingURL=index99.js.map
|
package/dist/index99.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index99.js","sources":["../src/hooks/
|
|
1
|
+
{"version":3,"file":"index99.js","sources":["../src/hooks/useBreakpoint.ts"],"sourcesContent":["import { useState, useEffect } from 'react'\n\nexport type Breakpoint = 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl'\n\nconst breakpoints: Record<Breakpoint, number> = {\n xs: 0,\n sm: 640,\n md: 768,\n lg: 1024,\n xl: 1280,\n '2xl': 1536,\n}\n\nconst breakpointOrder: Breakpoint[] = ['xs', 'sm', 'md', 'lg', 'xl', '2xl']\n\nfunction getBreakpoint(width: number): Breakpoint {\n if (width >= breakpoints['2xl']) return '2xl'\n if (width >= breakpoints.xl) return 'xl'\n if (width >= breakpoints.lg) return 'lg'\n if (width >= breakpoints.md) return 'md'\n if (width >= breakpoints.sm) return 'sm'\n return 'xs'\n}\n\nfunction compareBreakpoints(a: Breakpoint, b: Breakpoint): number {\n return breakpointOrder.indexOf(a) - breakpointOrder.indexOf(b)\n}\n\nexport interface UseBreakpointReturn {\n breakpoint: Breakpoint\n width: number\n isAbove: (bp: Breakpoint) => boolean\n isBelow: (bp: Breakpoint) => boolean\n isAt: (bp: Breakpoint) => boolean\n isBetween: (min: Breakpoint, max: Breakpoint) => boolean\n}\n\nexport function useBreakpoint(): UseBreakpointReturn {\n const [width, setWidth] = useState(() =>\n typeof window !== 'undefined' ? window.innerWidth : 1024\n )\n\n useEffect(() => {\n const handleResize = () => setWidth(window.innerWidth)\n\n window.addEventListener('resize', handleResize)\n return () => window.removeEventListener('resize', handleResize)\n }, [])\n\n const breakpoint = getBreakpoint(width)\n\n return {\n breakpoint,\n width,\n isAbove: (bp: Breakpoint) => compareBreakpoints(breakpoint, bp) >= 0,\n isBelow: (bp: Breakpoint) => compareBreakpoints(breakpoint, bp) < 0,\n isAt: (bp: Breakpoint) => breakpoint === bp,\n isBetween: (min: Breakpoint, max: Breakpoint) =>\n compareBreakpoints(breakpoint, min) >= 0 && compareBreakpoints(breakpoint, max) <= 0,\n }\n}\n"],"names":["breakpoints","breakpointOrder","getBreakpoint","width","compareBreakpoints","a","b","useBreakpoint","setWidth","useState","useEffect","handleResize","breakpoint","bp","min","max"],"mappings":";AAIA,MAAMA,IAA0C;AAAA,EAE9C,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,OAAO;AACT,GAEMC,IAAgC,CAAC,MAAM,MAAM,MAAM,MAAM,MAAM,KAAK;AAE1E,SAASC,EAAcC,GAA2B;AAChD,SAAIA,KAASH,EAAY,KAAK,IAAU,QACpCG,KAASH,EAAY,KAAW,OAChCG,KAASH,EAAY,KAAW,OAChCG,KAASH,EAAY,KAAW,OAChCG,KAASH,EAAY,KAAW,OAC7B;AACT;AAEA,SAASI,EAAmBC,GAAeC,GAAuB;AAChE,SAAOL,EAAgB,QAAQI,CAAC,IAAIJ,EAAgB,QAAQK,CAAC;AAC/D;AAWO,SAASC,IAAqC;AACnD,QAAM,CAACJ,GAAOK,CAAQ,IAAIC;AAAA,IAAS,MACjC,OAAO,SAAW,MAAc,OAAO,aAAa;AAAA,EAAA;AAGtD,EAAAC,EAAU,MAAM;AACd,UAAMC,IAAe,MAAMH,EAAS,OAAO,UAAU;AAErD,kBAAO,iBAAiB,UAAUG,CAAY,GACvC,MAAM,OAAO,oBAAoB,UAAUA,CAAY;AAAA,EAChE,GAAG,CAAA,CAAE;AAEL,QAAMC,IAAaV,EAAcC,CAAK;AAEtC,SAAO;AAAA,IACL,YAAAS;AAAA,IACA,OAAAT;AAAA,IACA,SAAS,CAACU,MAAmBT,EAAmBQ,GAAYC,CAAE,KAAK;AAAA,IACnE,SAAS,CAACA,MAAmBT,EAAmBQ,GAAYC,CAAE,IAAI;AAAA,IAClE,MAAM,CAACA,MAAmBD,MAAeC;AAAA,IACzC,WAAW,CAACC,GAAiBC,MAC3BX,EAAmBQ,GAAYE,CAAG,KAAK,KAAKV,EAAmBQ,GAAYG,CAAG,KAAK;AAAA,EAAA;AAEzF;"}
|