180 lines
5.8 KiB
JavaScript
180 lines
5.8 KiB
JavaScript
import {
|
|
Dynamic,
|
|
isServer,
|
|
spread
|
|
} from "./chunk-4XRXA77J.js";
|
|
import {
|
|
createComponent,
|
|
createContext,
|
|
mergeProps,
|
|
splitProps,
|
|
untrack,
|
|
useContext
|
|
} from "./chunk-R2HWYFCB.js";
|
|
import "./chunk-7FP5O474.js";
|
|
|
|
// node_modules/.pnpm/goober@2.1.11_csstype@3.1.0/node_modules/goober/dist/goober.modern.js
|
|
var e = { data: "" };
|
|
var t = (t2) => "object" == typeof window ? ((t2 ? t2.querySelector("#_goober") : window._goober) || Object.assign((t2 || document.head).appendChild(document.createElement("style")), { innerHTML: " ", id: "_goober" })).firstChild : t2 || e;
|
|
var r = (e2) => {
|
|
let r2 = t(e2), l2 = r2.data;
|
|
return r2.data = "", l2;
|
|
};
|
|
var l = /(?:([\u0080-\uFFFF\w-%@]+) *:? *([^{;]+?);|([^;}{]*?) *{)|(}\s*)/g;
|
|
var a = /\/\*[^]*?\*\/| +/g;
|
|
var n = /\n+/g;
|
|
var o = (e2, t2) => {
|
|
let r2 = "", l2 = "", a2 = "";
|
|
for (let n2 in e2) {
|
|
let c2 = e2[n2];
|
|
"@" == n2[0] ? "i" == n2[1] ? r2 = n2 + " " + c2 + ";" : l2 += "f" == n2[1] ? o(c2, n2) : n2 + "{" + o(c2, "k" == n2[1] ? "" : t2) + "}" : "object" == typeof c2 ? l2 += o(c2, t2 ? t2.replace(/([^,])+/g, (e3) => n2.replace(/(^:.*)|([^,])+/g, (t3) => /&/.test(t3) ? t3.replace(/&/g, e3) : e3 ? e3 + " " + t3 : t3)) : n2) : null != c2 && (n2 = /^--/.test(n2) ? n2 : n2.replace(/[A-Z]/g, "-$&").toLowerCase(), a2 += o.p ? o.p(n2, c2) : n2 + ":" + c2 + ";");
|
|
}
|
|
return r2 + (t2 && a2 ? t2 + "{" + a2 + "}" : a2) + l2;
|
|
};
|
|
var c = {};
|
|
var s = (e2) => {
|
|
if ("object" == typeof e2) {
|
|
let t2 = "";
|
|
for (let r2 in e2)
|
|
t2 += r2 + s(e2[r2]);
|
|
return t2;
|
|
}
|
|
return e2;
|
|
};
|
|
var i = (e2, t2, r2, i2, p2) => {
|
|
let u2 = s(e2), d2 = c[u2] || (c[u2] = ((e3) => {
|
|
let t3 = 0, r3 = 11;
|
|
for (; t3 < e3.length; )
|
|
r3 = 101 * r3 + e3.charCodeAt(t3++) >>> 0;
|
|
return "go" + r3;
|
|
})(u2));
|
|
if (!c[d2]) {
|
|
let t3 = u2 !== e2 ? e2 : ((e3) => {
|
|
let t4, r3, o2 = [{}];
|
|
for (; t4 = l.exec(e3.replace(a, "")); )
|
|
t4[4] ? o2.shift() : t4[3] ? (r3 = t4[3].replace(n, " ").trim(), o2.unshift(o2[0][r3] = o2[0][r3] || {})) : o2[0][t4[1]] = t4[2].replace(n, " ").trim();
|
|
return o2[0];
|
|
})(e2);
|
|
c[d2] = o(p2 ? { ["@keyframes " + d2]: t3 } : t3, r2 ? "" : "." + d2);
|
|
}
|
|
let f2 = r2 && c.g ? c.g : null;
|
|
return r2 && (c.g = c[d2]), ((e3, t3, r3, l2) => {
|
|
l2 ? t3.data = t3.data.replace(l2, e3) : -1 === t3.data.indexOf(e3) && (t3.data = r3 ? e3 + t3.data : t3.data + e3);
|
|
})(c[d2], t2, i2, f2), d2;
|
|
};
|
|
var p = (e2, t2, r2) => e2.reduce((e3, l2, a2) => {
|
|
let n2 = t2[a2];
|
|
if (n2 && n2.call) {
|
|
let e4 = n2(r2), t3 = e4 && e4.props && e4.props.className || /^go/.test(e4) && e4;
|
|
n2 = t3 ? "." + t3 : e4 && "object" == typeof e4 ? e4.props ? "" : o(e4, "") : false === e4 ? "" : e4;
|
|
}
|
|
return e3 + l2 + (null == n2 ? "" : n2);
|
|
}, "");
|
|
function u(e2) {
|
|
let r2 = this || {}, l2 = e2.call ? e2(r2.p) : e2;
|
|
return i(l2.unshift ? l2.raw ? p(l2, [].slice.call(arguments, 1), r2.p) : l2.reduce((e3, t2) => Object.assign(e3, t2 && t2.call ? t2(r2.p) : t2), {}) : l2, t(r2.target), r2.g, r2.o, r2.k);
|
|
}
|
|
var d;
|
|
var f;
|
|
var g;
|
|
var b = u.bind({ g: 1 });
|
|
var h = u.bind({ k: 1 });
|
|
function m(e2, t2, r2, l2) {
|
|
o.p = t2, d = e2, f = r2, g = l2;
|
|
}
|
|
|
|
// node_modules/.pnpm/solid-styled-components@0.28.4_solid-js@1.4.7/node_modules/solid-styled-components/src/index.js
|
|
var getForwardProps = null;
|
|
function shouldForwardProp(predicate) {
|
|
return (props) => props.filter(predicate);
|
|
}
|
|
function setup(prefixer, shouldForwardProp2 = null) {
|
|
m(null, prefixer);
|
|
getForwardProps = shouldForwardProp2;
|
|
}
|
|
var ThemeContext = createContext();
|
|
function ThemeProvider(props) {
|
|
return createComponent(ThemeContext.Provider, {
|
|
value: props.theme,
|
|
get children() {
|
|
return props.children;
|
|
}
|
|
});
|
|
}
|
|
function useTheme() {
|
|
return useContext(ThemeContext);
|
|
}
|
|
function makeStyled(tag) {
|
|
let _ctx = this || {};
|
|
return (...args) => {
|
|
const Styled = (props) => {
|
|
const theme = useContext(ThemeContext);
|
|
const withTheme = mergeProps(props, { theme });
|
|
const clone = mergeProps(withTheme, {
|
|
get class() {
|
|
const pClass = withTheme.class, append = "class" in withTheme && /^go[0-9]+/.test(pClass);
|
|
let className = u.apply({ target: _ctx.target, o: append, p: withTheme, g: _ctx.g }, args);
|
|
return [pClass, className].filter(Boolean).join(" ");
|
|
}
|
|
});
|
|
const [local, newProps] = splitProps(clone, ["as", "theme"]);
|
|
const htmlProps = getForwardProps ? splitProps(newProps, getForwardProps(Object.keys(newProps)))[0] : newProps;
|
|
const createTag = local.as || tag;
|
|
let el;
|
|
if (typeof createTag === "function") {
|
|
el = createTag(htmlProps);
|
|
} else {
|
|
if (isServer) {
|
|
const [local2, others] = splitProps(htmlProps, ["children", "theme"]);
|
|
el = Dynamic({
|
|
component: createTag,
|
|
get children() {
|
|
return local2.children;
|
|
},
|
|
...others
|
|
});
|
|
} else {
|
|
if (_ctx.g == 1) {
|
|
el = document.createElement(createTag);
|
|
spread(el, htmlProps);
|
|
} else {
|
|
el = Dynamic(mergeProps({ component: createTag }, htmlProps));
|
|
}
|
|
}
|
|
}
|
|
return el;
|
|
};
|
|
Styled.class = (props) => {
|
|
return untrack(() => {
|
|
return u.apply({ target: _ctx.target, p: props, g: _ctx.g }, args);
|
|
});
|
|
};
|
|
return Styled;
|
|
};
|
|
}
|
|
var styled = new Proxy(makeStyled, {
|
|
get(target, tag) {
|
|
return target(tag);
|
|
}
|
|
});
|
|
function createGlobalStyles() {
|
|
const fn = makeStyled.call({ g: 1 }, "div").apply(null, arguments);
|
|
return function GlobalStyles(props) {
|
|
fn(props);
|
|
return null;
|
|
};
|
|
}
|
|
export {
|
|
ThemeProvider,
|
|
createGlobalStyles,
|
|
u as css,
|
|
r as extractCss,
|
|
b as glob,
|
|
h as keyframes,
|
|
setup,
|
|
shouldForwardProp,
|
|
styled,
|
|
useTheme
|
|
};
|
|
//# sourceMappingURL=solid-styled-components.js.map
|