lism-css 0.1.8 → 0.2.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.
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as n } from "react/jsx-runtime";
|
|
2
2
|
import i from "../Lism/index.js";
|
|
3
|
-
function m({ size: t
|
|
4
|
-
return /* @__PURE__ */ n(o || i, { isContainer: t, ...r });
|
|
3
|
+
function m({ size: t, layout: o, ...r }) {
|
|
4
|
+
return /* @__PURE__ */ n(o || i, { isContainer: t || !0, ...r });
|
|
5
5
|
}
|
|
6
6
|
export {
|
|
7
7
|
m as default
|
|
@@ -1,53 +1,60 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
function
|
|
4
|
-
const
|
|
5
|
-
if (
|
|
6
|
-
const [,
|
|
7
|
-
let
|
|
8
|
-
for (; (
|
|
9
|
-
const [, t,
|
|
10
|
-
|
|
1
|
+
import p from "./presets.js";
|
|
2
|
+
import h from "../../lib/helper/atts.js";
|
|
3
|
+
function b(c) {
|
|
4
|
+
const i = {}, l = c.match(/<svg([^>]*?)>([\s\S]*?)<\/svg>/i);
|
|
5
|
+
if (l) {
|
|
6
|
+
const [, g, v] = l, u = /([\w-]+)=["']([^"']*)["']/g;
|
|
7
|
+
let a;
|
|
8
|
+
for (; (a = u.exec(g)) !== null; ) {
|
|
9
|
+
const [, t, f] = a;
|
|
10
|
+
if (t === "style") {
|
|
11
|
+
const s = {};
|
|
12
|
+
f.split(";").forEach((r) => {
|
|
13
|
+
const [e, o] = r.split(":").map((n) => n.trim());
|
|
14
|
+
e && o && (s[e] = o);
|
|
15
|
+
}), i[t] = s;
|
|
16
|
+
} else
|
|
17
|
+
i[t] = f;
|
|
11
18
|
}
|
|
12
|
-
return { svgProps:
|
|
19
|
+
return { svgProps: i, svgContent: v };
|
|
13
20
|
}
|
|
14
21
|
return {};
|
|
15
22
|
}
|
|
16
|
-
function
|
|
17
|
-
lismClass:
|
|
18
|
-
className:
|
|
19
|
-
style:
|
|
23
|
+
function w({
|
|
24
|
+
lismClass: c,
|
|
25
|
+
className: i = "",
|
|
26
|
+
style: l = {},
|
|
20
27
|
// variant,
|
|
21
|
-
as:
|
|
28
|
+
as: g,
|
|
22
29
|
tag: v,
|
|
23
|
-
scale:
|
|
24
|
-
offset:
|
|
30
|
+
scale: u,
|
|
31
|
+
offset: a,
|
|
25
32
|
icon: t,
|
|
26
|
-
label:
|
|
33
|
+
label: f,
|
|
27
34
|
exProps: s = {},
|
|
28
|
-
...
|
|
35
|
+
...r
|
|
29
36
|
}) {
|
|
30
|
-
let
|
|
31
|
-
if (
|
|
32
|
-
|
|
37
|
+
let e = v || "span", o = "";
|
|
38
|
+
if (r.viewBox)
|
|
39
|
+
e = "svg";
|
|
33
40
|
else if (t)
|
|
34
41
|
if (typeof t == "string")
|
|
35
42
|
if (t.startsWith("<svg")) {
|
|
36
|
-
|
|
37
|
-
const { svgProps:
|
|
38
|
-
|
|
43
|
+
e = "_SVG_";
|
|
44
|
+
const { svgProps: n = {}, svgContent: m = "" } = b(t), { class: S, style: C, ..._ } = n;
|
|
45
|
+
i = h(i, S), l = { ...l, ...C }, s = { ...s, ..._, fill: "currentColor" }, o = m;
|
|
39
46
|
} else {
|
|
40
|
-
const
|
|
41
|
-
|
|
47
|
+
const n = p[t] || null;
|
|
48
|
+
n != null && (e = "_SVG_", s = { ...s, ...n });
|
|
42
49
|
}
|
|
43
50
|
else if (typeof t == "object" && t.as) {
|
|
44
|
-
const { as:
|
|
45
|
-
|
|
51
|
+
const { as: n, ...m } = t;
|
|
52
|
+
e = n, s = { ...s, ...m };
|
|
46
53
|
} else
|
|
47
|
-
|
|
48
|
-
else
|
|
49
|
-
return
|
|
54
|
+
e = t;
|
|
55
|
+
else g && (e = g);
|
|
56
|
+
return f ? (s["aria-label"] = f, s.role = "img") : s["aria-hidden"] = "true", u && (l["--scale"] = u), a && (l["--offset"] = a), r.lismClass = h(c, "l--icon", i), r.style = { ...l }, { Component: e, lismProps: r, exProps: s, content: o };
|
|
50
57
|
}
|
|
51
58
|
export {
|
|
52
|
-
|
|
59
|
+
w as default
|
|
53
60
|
};
|
package/package.json
CHANGED