@spark-ui/internal-utils 17.2.3-beta.1 → 17.2.4-beta.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/CHANGELOG.md +10 -0
- package/dist/index.js +1 -1
- package/dist/index.mjs +72 -38
- package/package.json +1 -1
- package/vite.config.ts +28 -23
package/CHANGELOG.md
CHANGED
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=Object.defineProperty,t=(t,n)=>{let r={};for(var i in t)e(r,i,{get:t[i],enumerable:!0});return n||e(r,Symbol.toStringTag,{value:`Module`}),r};let n=require(`react`);var r=t({}),i=t({designs:()=>s,intents:()=>o,shapes:()=>c,sizes:()=>a}),a=[`current`,`sm`,`md`,`lg`,`xl`],o=[`current`,`main`,`support`,`success`,`error`,`info`,`alert`,`danger`,`neutral`,`surface`,`surfaceInverse`,`accent`],s=[`filled`,`outlined`,`tinted`,`ghost`,`contrast`,`dashed`],c=[`rounded`,`square`,`pill`];function l(e){return(0,n.isValidElement)(e)&&function(e){return(0,n.isValidElement)(e)&&!!e.props.children}(e)&&n.Children.toArray(e.props.children).reduce(((e,t)=>e||(0,n.isValidElement)(t)),!1)}Object.defineProperty(exports,`VariantTypes`,{enumerable:!0,get:function(){return r}}),exports.createSplitProps=()=>(e,t)=>t.reduce(((e,t)=>{let[n,r]=e,i=t;return r[i]!==void 0&&(n[i]=r[i]),delete r[i],[n,r]}),[{},{...e}]),exports.deepFind=function e(t,r){let i;return n.Children.toArray(t).find(((t,a,o)=>r(t,a,o)?(i=t,!0):!(!(0,n.isValidElement)(t)||!l(t))&&(i=e(t.props.children,r),i!==void 0))),i},exports.makeVariants=function(e){return e},exports.omit=function(e,t){let n={};return Object.keys(e).forEach((r=>{let i=r;t.includes(i)||(n[i]=e[i])})),n},exports.tw=function(e){return e},exports.useEvent=function(e,t={}){let{sync:r=!1}=t,i=function(e){let t=(0,n.useRef)(e);return t.current=e,t}(e);return(0,n.useCallback)(((...e)=>r?queueMicrotask((()=>i.current?.(...e))):i.current?.(...e)),[r,i])},Object.defineProperty(exports,`variantConstants`,{enumerable:!0,get:function(){return i}});
|
package/dist/index.mjs
CHANGED
|
@@ -1,45 +1,79 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { Children as e, isValidElement as t, useCallback as n, useRef as r } from "react";
|
|
2
|
+
var i = Object.defineProperty, a = (e, t) => {
|
|
3
|
+
let n = {};
|
|
4
|
+
for (var r in e) i(n, r, {
|
|
5
|
+
get: e[r],
|
|
6
|
+
enumerable: !0
|
|
7
|
+
});
|
|
8
|
+
return t || i(n, Symbol.toStringTag, { value: "Module" }), n;
|
|
9
|
+
};
|
|
10
|
+
function o(e) {
|
|
11
|
+
return e;
|
|
4
12
|
}
|
|
5
|
-
function
|
|
6
|
-
|
|
13
|
+
function s(e) {
|
|
14
|
+
return e;
|
|
7
15
|
}
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
16
|
+
var c = a({}), l = a({
|
|
17
|
+
designs: () => f,
|
|
18
|
+
intents: () => d,
|
|
19
|
+
shapes: () => p,
|
|
20
|
+
sizes: () => u
|
|
21
|
+
}), u = [
|
|
22
|
+
"current",
|
|
23
|
+
"sm",
|
|
24
|
+
"md",
|
|
25
|
+
"lg",
|
|
26
|
+
"xl"
|
|
27
|
+
], d = [
|
|
28
|
+
"current",
|
|
29
|
+
"main",
|
|
30
|
+
"support",
|
|
31
|
+
"success",
|
|
32
|
+
"error",
|
|
33
|
+
"info",
|
|
34
|
+
"alert",
|
|
35
|
+
"danger",
|
|
36
|
+
"neutral",
|
|
37
|
+
"surface",
|
|
38
|
+
"surfaceInverse",
|
|
39
|
+
"accent"
|
|
40
|
+
], f = [
|
|
41
|
+
"filled",
|
|
42
|
+
"outlined",
|
|
43
|
+
"tinted",
|
|
44
|
+
"ghost",
|
|
45
|
+
"contrast",
|
|
46
|
+
"dashed"
|
|
47
|
+
], p = [
|
|
48
|
+
"rounded",
|
|
49
|
+
"square",
|
|
50
|
+
"pill"
|
|
51
|
+
];
|
|
52
|
+
function m(n) {
|
|
53
|
+
return t(n) && function(e) {
|
|
54
|
+
return t(e) && !!e.props.children;
|
|
55
|
+
}(n) && e.toArray(n.props.children).reduce(((e, n) => e || t(n)), !1);
|
|
13
56
|
}
|
|
14
|
-
function
|
|
15
|
-
|
|
16
|
-
|
|
57
|
+
function h(n, r) {
|
|
58
|
+
let i;
|
|
59
|
+
return e.toArray(n).find(((e, n, a) => r(e, n, a) ? (i = e, !0) : !(!t(e) || !m(e)) && (i = h(e.props.children, r), i !== void 0))), i;
|
|
17
60
|
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
61
|
+
var g = () => (e, t) => t.reduce(((e, t) => {
|
|
62
|
+
let [n, r] = e, i = t;
|
|
63
|
+
return r[i] !== void 0 && (n[i] = r[i]), delete r[i], [n, r];
|
|
21
64
|
}), [{}, { ...e }]);
|
|
22
|
-
function _(e,
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
65
|
+
function _(e, t) {
|
|
66
|
+
let n = {};
|
|
67
|
+
return Object.keys(e).forEach(((r) => {
|
|
68
|
+
let i = r;
|
|
69
|
+
t.includes(i) || (n[i] = e[i]);
|
|
70
|
+
})), n;
|
|
28
71
|
}
|
|
29
|
-
function v(e,
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
72
|
+
function v(e, t = {}) {
|
|
73
|
+
let { sync: i = !1 } = t, a = function(e) {
|
|
74
|
+
let t = r(e);
|
|
75
|
+
return t.current = e, t;
|
|
76
|
+
}(e);
|
|
77
|
+
return n(((...e) => i ? queueMicrotask((() => a.current?.(...e))) : a.current?.(...e)), [i, a]);
|
|
35
78
|
}
|
|
36
|
-
export {
|
|
37
|
-
b as VariantTypes,
|
|
38
|
-
h as createSplitProps,
|
|
39
|
-
f as deepFind,
|
|
40
|
-
y as makeVariants,
|
|
41
|
-
_ as omit,
|
|
42
|
-
m as tw,
|
|
43
|
-
v as useEvent,
|
|
44
|
-
g as variantConstants
|
|
45
|
-
};
|
|
79
|
+
export { c as VariantTypes, g as createSplitProps, h as deepFind, s as makeVariants, _ as omit, o as tw, v as useEvent, l as variantConstants };
|
package/package.json
CHANGED
package/vite.config.ts
CHANGED
|
@@ -1,29 +1,34 @@
|
|
|
1
|
+
import { readFileSync } from 'node:fs'
|
|
2
|
+
import { dirname, join } from 'node:path'
|
|
3
|
+
import { fileURLToPath } from 'node:url'
|
|
4
|
+
|
|
1
5
|
import terser from '@rollup/plugin-terser'
|
|
6
|
+
import browserslistToEsbuild from 'browserslist-to-esbuild'
|
|
7
|
+
import { defineConfig } from 'vite'
|
|
2
8
|
import dts from 'vite-plugin-dts'
|
|
3
9
|
|
|
4
|
-
const
|
|
10
|
+
const __dirname = dirname(fileURLToPath(import.meta.url))
|
|
11
|
+
const pkg = JSON.parse(readFileSync(join(__dirname, 'package.json'), 'utf8')) as {
|
|
12
|
+
peerDependencies?: Record<string, string>
|
|
13
|
+
}
|
|
5
14
|
const peerDeps = Object.keys(pkg.peerDependencies || {})
|
|
6
15
|
|
|
7
|
-
export default
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
entry: 'src/index.ts',
|
|
15
|
-
formats: ['es', 'cjs'],
|
|
16
|
-
fileName: 'index',
|
|
17
|
-
},
|
|
18
|
-
rollupOptions: {
|
|
19
|
-
external: ['node:path', 'node:fs', ...peerDeps],
|
|
20
|
-
plugins: [terser()],
|
|
21
|
-
},
|
|
16
|
+
export default defineConfig({
|
|
17
|
+
build: {
|
|
18
|
+
target: browserslistToEsbuild(),
|
|
19
|
+
lib: {
|
|
20
|
+
entry: 'src/index.ts',
|
|
21
|
+
formats: ['es', 'cjs'],
|
|
22
|
+
fileName: 'index',
|
|
22
23
|
},
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
24
|
+
rolldownOptions: {
|
|
25
|
+
external: ['node:path', 'node:fs', ...peerDeps],
|
|
26
|
+
plugins: [terser()],
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
plugins: [
|
|
30
|
+
dts({
|
|
31
|
+
entryRoot: './src',
|
|
32
|
+
}),
|
|
33
|
+
],
|
|
34
|
+
})
|