lism-css 0.3.5 → 0.5.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/README.md +2 -2
- package/bin/build-config.js +157 -0
- package/bin/build-css.cjs +92 -0
- package/bin/build-css.js +90 -0
- package/bin/cli.mjs +69 -0
- package/bin/script-build-css.js +6 -0
- package/config/__prop_list.js +44 -0
- package/config/__props.scss +25 -0
- package/config/default-config.js +9 -0
- package/config/defaults/__props-memo.js +45 -0
- package/config/defaults/props.js +370 -0
- package/config/defaults/states.js +42 -0
- package/config/defaults/tokens.js +26 -0
- package/config/helper/getSvgUrl.js +28 -0
- package/config/helper/minifyHtml.js +22 -0
- package/config/helper.js +67 -0
- package/config/index.js +15 -0
- package/config.js +2 -0
- package/dist/components/Accordion/AccIcon.js +1 -1
- package/dist/components/Accordion/getProps.js +15 -17
- package/dist/components/Accordion/index.js +4 -4
- package/dist/components/Accordion/index2.js +28 -23
- package/dist/components/Accordion/setAccordion.js +11 -11
- package/dist/components/Box/index.js +5 -6
- package/dist/components/Center/index.js +2 -2
- package/dist/components/Cluster/index.js +8 -0
- package/dist/components/Columns/index.js +5 -6
- package/dist/components/Container/index.js +3 -3
- package/dist/components/Dummy/index.js +9 -14
- package/dist/components/Dummy/texts.js +6 -6
- package/dist/components/Flex/index.js +5 -6
- package/dist/components/Flow/index.js +8 -0
- package/dist/components/Frame/index.js +5 -6
- package/dist/components/Grid/index.js +5 -6
- package/dist/components/HTML/index.js +5 -0
- package/dist/components/HTML/index2.js +44 -0
- package/dist/components/Layer/index.js +5 -5
- package/dist/components/LinkBox/index.js +6 -6
- package/dist/components/Lism/Link.js +5 -5
- package/dist/components/Lism/Text.js +4 -4
- package/dist/components/Lism/index.js +5 -4
- package/dist/components/Modal/Body.js +5 -5
- package/dist/components/Modal/CloseBtn.js +13 -0
- package/dist/components/Modal/Inner.js +5 -5
- package/dist/components/Modal/OpenBtn.js +9 -0
- package/dist/components/Modal/getProps.js +12 -13
- package/dist/components/Modal/index.js +4 -5
- package/dist/components/Modal/index2.js +12 -12
- package/dist/components/Stack/index.js +5 -5
- package/dist/components/Tabs/Tab.js +7 -9
- package/dist/components/Tabs/TabList.js +4 -4
- package/dist/components/Tabs/TabPanel.js +6 -7
- package/dist/components/Tabs/getProps.js +1 -8
- package/dist/components/Tabs/index2.js +14 -23
- package/dist/components/WithSide/index.js +4 -5
- package/dist/components/atomic/Decorator/getProps.js +13 -0
- package/dist/components/{Decorator → atomic/Decorator}/index.js +1 -1
- package/dist/components/atomic/Divider/getProps.js +10 -0
- package/dist/components/atomic/Divider/index.js +9 -0
- package/dist/components/atomic/Icon/getProps.js +59 -0
- package/dist/components/{Icon → atomic/Icon}/index.js +1 -1
- package/dist/components/atomic/Media/getProps.js +9 -0
- package/dist/components/atomic/Media/index.js +9 -0
- package/dist/components/atomic/Spacer/getProps.js +21 -0
- package/dist/components/atomic/Spacer/index.js +9 -0
- package/dist/components/getFilterProps.js +8 -18
- package/dist/components/getLayoutProps.js +27 -0
- package/dist/config/default-config.js +11 -0
- package/dist/config/defaults/props.js +342 -0
- package/dist/config/defaults/states.js +36 -0
- package/dist/config/defaults/tokens.js +29 -0
- package/dist/config/helper/getSvgUrl.js +4 -0
- package/dist/config/helper.js +31 -0
- package/dist/config/index.js +11 -0
- package/dist/index.js +50 -50
- package/dist/lib/getBpData.js +1 -1
- package/dist/lib/getLismProps.js +109 -177
- package/dist/lib/getMaybeCssVar.js +30 -54
- package/dist/lib/getMaybeTokenValue.js +26 -0
- package/dist/lib/getUtilKey.js +13 -0
- package/dist/lib/isPresetValue.js +3 -3
- package/dist/lib/isTokenValue.js +6 -5
- package/package.json +16 -3
- package/packages/astro/Accordion/AccBody.astro +5 -6
- package/packages/astro/Accordion/AccHeader.astro +4 -4
- package/packages/astro/Accordion/AccHeaderLabel.astro +12 -0
- package/packages/astro/Accordion/AccIcon.astro +1 -1
- package/packages/astro/Accordion/AccLabel.astro +1 -1
- package/packages/astro/Accordion/Accordion.astro +1 -1
- package/packages/astro/Accordion/index.js +2 -1
- package/packages/astro/Box/Box.astro +2 -3
- package/packages/astro/Center/Center.astro +2 -8
- package/packages/astro/Cluster/Cluster.astro +5 -0
- package/packages/astro/Cluster/index.js +1 -0
- package/packages/astro/Columns/Columns.astro +2 -8
- package/packages/astro/Container/Container.astro +3 -4
- package/packages/astro/Decorator/Decorator.astro +2 -2
- package/packages/astro/Divider/Divider.astro +3 -3
- package/packages/astro/Dummy/Dummy.astro +3 -2
- package/packages/astro/Flex/Flex.astro +1 -10
- package/packages/astro/Flex/index.js +0 -1
- package/packages/astro/Flow/Flow.astro +5 -0
- package/packages/astro/Flow/index.js +1 -0
- package/packages/astro/Frame/Frame.astro +1 -8
- package/packages/astro/Grid/Grid.astro +1 -9
- package/packages/astro/Grid/index.js +0 -1
- package/packages/astro/HTML/a.astro +5 -0
- package/packages/astro/HTML/button.astro +5 -0
- package/packages/astro/HTML/div.astro +5 -0
- package/packages/astro/HTML/h.astro +6 -0
- package/packages/astro/HTML/img.astro +5 -0
- package/packages/astro/HTML/index.js +12 -0
- package/packages/astro/HTML/li.astro +5 -0
- package/packages/astro/HTML/ol.astro +5 -0
- package/packages/astro/HTML/p.astro +5 -0
- package/packages/astro/HTML/span.astro +5 -0
- package/packages/astro/HTML/ul.astro +5 -0
- package/packages/astro/Icon/Icon.astro +3 -5
- package/packages/astro/Layer/Layer.astro +3 -10
- package/packages/astro/LinkBox/LinkBox.astro +4 -5
- package/packages/astro/Lism/Link.astro +2 -2
- package/packages/astro/Lism/Lism.astro +4 -3
- package/packages/astro/Lism/Text.astro +2 -2
- package/packages/astro/Lism/index.js +0 -1
- package/packages/astro/{Lism → Media}/Media.astro +1 -9
- package/packages/astro/Media/index.js +1 -0
- package/packages/astro/Modal/Body.astro +4 -5
- package/packages/astro/Modal/CloseBtn.astro +24 -0
- package/packages/astro/Modal/Inner.astro +4 -4
- package/packages/astro/Modal/Modal.astro +4 -5
- package/packages/astro/Modal/OpenBtn.astro +14 -0
- package/packages/astro/Modal/index.js +3 -4
- package/packages/astro/OverlayLink/OverlayLink.astro +1 -1
- package/packages/astro/Spacer/Spacer.astro +3 -3
- package/packages/astro/Stack/Stack.astro +2 -4
- package/packages/astro/Tabs/Tab.astro +2 -11
- package/packages/astro/Tabs/TabList.astro +4 -4
- package/packages/astro/Tabs/TabPanel.astro +1 -1
- package/packages/astro/Tabs/Tabs.astro +6 -10
- package/packages/astro/Test/Test.astro +1 -1
- package/packages/astro/Test/TestItem.astro +1 -1
- package/packages/astro/WithSide/WithSide.astro +1 -8
- package/packages/astro/index.js +6 -2
- package/packages/types/index.d.ts +22 -26
- package/src/scss/{_props.scss → __props copy.scss } +146 -169
- package/src/scss/__props.scss +786 -0
- package/src/scss/_auto_output.scss +102 -76
- package/src/scss/_prop-config.scss +862 -0
- package/src/scss/_setting.scss +2 -3
- package/src/scss/_with_layer.scss +19 -14
- package/src/scss/base/_dom.scss +35 -26
- package/src/scss/base/_property.scss +4 -16
- package/src/scss/base/_tokens.scss +105 -116
- package/src/scss/base/index.scss +18 -42
- package/src/scss/base/set/_hover.scss +13 -0
- package/src/scss/base/set/_innerRs.scss +3 -0
- package/src/scss/base/set/_mask.scss +6 -0
- package/src/scss/base/set/_plain.scss +14 -0
- package/src/scss/base/set/_shadow.scss +27 -0
- package/src/scss/base/set/_snap.scss +8 -0
- package/src/scss/base/set/_transition.scss +20 -0
- package/src/scss/main.scss +0 -1
- package/src/scss/main_no_layer.scss +6 -14
- package/src/scss/modules/atomic/_divider.scss +6 -0
- package/src/scss/{layout → modules/atomic}/_icon.scss +3 -9
- package/src/scss/modules/atomic/_media.scss +3 -0
- package/src/scss/{layout → modules/atomic}/_spacer.scss +1 -1
- package/src/scss/modules/atomic/index.scss +6 -0
- package/src/scss/{dynamic → modules/dynamic}/_accordion.scss +24 -24
- package/src/scss/modules/dynamic/_modal.scss +33 -0
- package/src/scss/{dynamic → modules/dynamic}/_tabs.scss +4 -5
- package/src/scss/{layout/_flex.scss → modules/layout/_cluster.scss} +1 -4
- package/src/scss/modules/layout/_columns.scss +9 -0
- package/src/scss/modules/layout/_flex.scss +3 -0
- package/src/scss/modules/layout/_flow.scss +46 -0
- package/src/scss/{layout → modules/layout}/_frame.scss +1 -1
- package/src/scss/modules/layout/_grid.scss +35 -0
- package/src/scss/{layout → modules/layout}/_withSide.scss +3 -3
- package/src/scss/{layout → modules/layout}/index.scss +4 -6
- package/src/scss/modules/state/_container.scss +37 -0
- package/src/scss/{state → modules/state}/_linkbox.scss +1 -1
- package/src/scss/modules/state/index.scss +5 -0
- package/src/scss/props/_border.scss +25 -40
- package/src/scss/props/_hover.scss +12 -23
- package/src/scss/props/_size.scss +17 -0
- package/src/scss/props/index.scss +1 -2
- package/src/scss/reset.scss +1 -1
- package/src/scss/utility/_cbox.scss +5 -4
- package/src/scss/utility/_hidden.scss +14 -0
- package/src/scss/utility/_itemDivider.scss +11 -0
- package/src/scss/utility/_linkExpand.scss +10 -0
- package/src/scss/utility/_trimHL.scss +29 -13
- package/src/scss/utility/index.scss +3 -45
- package/dist/components/Box/getProps.js +0 -7
- package/dist/components/Columns/getProps.js +0 -6
- package/dist/components/Decorator/getProps.js +0 -17
- package/dist/components/Divider/getProps.js +0 -11
- package/dist/components/Divider/index.js +0 -9
- package/dist/components/Flex/Cluster.js +0 -8
- package/dist/components/Flex/FlexItem.js +0 -8
- package/dist/components/Flex/getProps.js +0 -13
- package/dist/components/Frame/getProps.js +0 -7
- package/dist/components/Grid/GridItem.js +0 -9
- package/dist/components/Grid/getProps.js +0 -28
- package/dist/components/Icon/getProps.js +0 -60
- package/dist/components/Layer/getProps.js +0 -9
- package/dist/components/Lism/Media.js +0 -9
- package/dist/components/Modal/CloseIconBtn.js +0 -19
- package/dist/components/Modal/Footer.js +0 -9
- package/dist/components/Modal/Header.js +0 -9
- package/dist/components/Spacer/getProps.js +0 -21
- package/dist/components/Spacer/index.js +0 -9
- package/dist/components/WithSide/getProps.js +0 -14
- package/dist/components/getInsetProps.js +0 -8
- package/dist/components/getMediaProps.js +0 -7
- package/dist/components/getTransformProps.js +0 -8
- package/dist/config/prop_list.js +0 -386
- package/dist/config/tokens.js +0 -43
- package/dist/config.js +0 -9
- package/dist/lib/getMaybeUtilValue.js +0 -6
- package/packages/astro/Flex/Cluster.astro +0 -11
- package/packages/astro/Grid/GridItem.astro +0 -14
- package/packages/astro/Modal/CloseIconBtn.astro +0 -24
- package/packages/astro/Modal/Footer.astro +0 -14
- package/packages/astro/Modal/Header.astro +0 -14
- package/src/scss/dynamic/_modal.scss +0 -30
- package/src/scss/layout/_columns.scss +0 -13
- package/src/scss/layout/_divider.scss +0 -3
- package/src/scss/layout/_grid.scss +0 -9
- package/src/scss/props/__memo.scss +0 -15
- package/src/scss/props/_color.scss +0 -7
- package/src/scss/props/_transition.scss +0 -20
- package/src/scss/state/_container.scss +0 -34
- package/src/scss/state/_flow.scss +0 -45
- package/src/scss/state/_size.scss +0 -22
- package/src/scss/state/index.scss +0 -12
- /package/dist/components/{Icon → atomic/Icon}/SVG.js +0 -0
- /package/dist/components/{Icon → atomic/Icon}/presets.js +0 -0
- /package/packages/astro/{helper/index.js → helper.js} +0 -0
- /package/src/scss/{dynamic → modules/dynamic}/index.scss +0 -0
- /package/src/scss/{layout → modules/layout}/_center.scss +0 -0
- /package/src/scss/{layout → modules/layout}/_stack.scss +0 -0
- /package/src/scss/{state → modules/state}/_gutter.scss +0 -0
- /package/src/scss/{state → modules/state}/_layer.scss +0 -0
package/dist/lib/getLismProps.js
CHANGED
|
@@ -1,103 +1,68 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
const
|
|
15
|
-
const t =
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
}, V = Object.keys(C), B = Object.keys(E);
|
|
20
|
-
class K {
|
|
1
|
+
var E = Object.defineProperty;
|
|
2
|
+
var A = (r, t, s) => t in r ? E(r, t, { enumerable: !0, configurable: !0, writable: !0, value: s }) : r[t] = s;
|
|
3
|
+
var d = (r, t, s) => A(r, typeof t != "symbol" ? t + "" : t, s);
|
|
4
|
+
import { STATES as U, PROPS as P } from "../config/index.js";
|
|
5
|
+
import g from "./isPresetValue.js";
|
|
6
|
+
import V from "./isTokenValue.js";
|
|
7
|
+
import O from "./getUtilKey.js";
|
|
8
|
+
import S from "./getMaybeCssVar.js";
|
|
9
|
+
import _ from "./getBpData.js";
|
|
10
|
+
import b from "./helper/atts.js";
|
|
11
|
+
import x from "./helper/isEmptyObj.js";
|
|
12
|
+
import j from "./helper/filterEmptyObj.js";
|
|
13
|
+
import k from "./helper/splitWithComma.js";
|
|
14
|
+
const z = (r) => {
|
|
15
|
+
const t = P[r];
|
|
16
|
+
return t && (t == null ? void 0 : t.token) || "";
|
|
17
|
+
};
|
|
18
|
+
class w {
|
|
21
19
|
constructor(t) {
|
|
22
20
|
// propList = {};
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
const {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
variant: f,
|
|
35
|
-
passVars: c,
|
|
36
|
-
// lismVar,
|
|
37
|
-
style: n = {},
|
|
38
|
-
_propConfig: h = {},
|
|
39
|
-
// hasBd,
|
|
40
|
-
...d
|
|
41
|
-
} = t;
|
|
42
|
-
this.lismClass = l || "", this.lismState = structuredClone(r), this.styles = structuredClone(n), this._propConfig = structuredClone(h);
|
|
43
|
-
let a = this.getStateProps(d);
|
|
44
|
-
if (f && l) {
|
|
45
|
-
const $ = l.split(" "), b = $[0], m = f.split(",").map((P) => P.trim()).filter(Boolean).map((P) => `${b}-${P}`);
|
|
46
|
-
this.lismClass = [b, ...m, ...$.slice(1)].join(" ");
|
|
21
|
+
d(this, "className", "");
|
|
22
|
+
d(this, "uClasses", []);
|
|
23
|
+
d(this, "lismState", []);
|
|
24
|
+
d(this, "styles", {});
|
|
25
|
+
d(this, "attrs", {});
|
|
26
|
+
const { forwardedRef: s, class: i, className: l, lismClass: a, layout: e, variant: h, style: f = {}, _propConfig: m = {}, ...o } = t;
|
|
27
|
+
this.styles = { ...f }, this._propConfig = { ...m };
|
|
28
|
+
let n = a || "";
|
|
29
|
+
if (h && a) {
|
|
30
|
+
const u = a.split(" "), y = u[0], $ = `${y}--${h}`;
|
|
31
|
+
n = [y, $, ...u.slice(1)].join(" ");
|
|
47
32
|
}
|
|
48
|
-
|
|
33
|
+
typeof e == "string" && e && (n = b(n, `l--${e}`)), x(o) || (this.attrs = { ...o }, this.analyzeProps()), s && (this.attrs.ref = s), this.className = b(l || i, n, this.lismState, this.uClasses);
|
|
49
34
|
}
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
i && Object.keys(s).forEach((e) => {
|
|
54
|
-
const l = i[e];
|
|
55
|
-
if (l) {
|
|
56
|
-
const r = s[e];
|
|
57
|
-
this.analyzeProp(e, r, l);
|
|
58
|
-
} else t === "css" && this.addStyle(e, s[e]);
|
|
59
|
-
});
|
|
35
|
+
analyzeState(t, s) {
|
|
36
|
+
const { className: i, preset: l, presetClass: a, customVar: e, tokenKey: h, setStyles: f } = t;
|
|
37
|
+
s === !0 ? this.lismState.push(i) : l && g(l, s) ? this.lismState.push(`${i} ${a}:${s}`) : s && (this.lismState.push(i), h ? this.addStyle(e, S(s, h)) : f && this.addStyles(f(s)));
|
|
60
38
|
}
|
|
61
39
|
// prop解析
|
|
62
|
-
analyzeProps(
|
|
63
|
-
Object.keys(
|
|
64
|
-
if (
|
|
65
|
-
const
|
|
66
|
-
this.
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
this.
|
|
72
|
-
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
delete this.attrs[i], this.analyzeProp(i, r);
|
|
77
|
-
return;
|
|
78
|
-
}
|
|
79
|
-
if (B.includes(i)) {
|
|
80
|
-
const r = this.attrs[i];
|
|
81
|
-
delete this.attrs[i], this.setContextProps(i, r);
|
|
82
|
-
return;
|
|
40
|
+
analyzeProps() {
|
|
41
|
+
Object.keys(this.attrs).forEach((t) => {
|
|
42
|
+
if (Object.hasOwn(U, t)) {
|
|
43
|
+
const s = this.extractProp(t), i = U[t];
|
|
44
|
+
typeof i == "string" ? s && this.lismState.push(i) : this.analyzeState(i, s);
|
|
45
|
+
} else if (Object.hasOwn(P, t)) {
|
|
46
|
+
const s = this.attrs[t];
|
|
47
|
+
delete this.attrs[t], this.analyzeLismProp(t, s);
|
|
48
|
+
} else if (t === "hov") {
|
|
49
|
+
const s = this.extractProp(t);
|
|
50
|
+
this.setHovProps(s);
|
|
51
|
+
} else if (t === "css") {
|
|
52
|
+
const s = this.extractProp("css");
|
|
53
|
+
this.addStyles(s);
|
|
83
54
|
}
|
|
84
55
|
});
|
|
85
56
|
}
|
|
86
|
-
//
|
|
87
|
-
|
|
88
|
-
if (s == null
|
|
57
|
+
// Lism Prop 解析
|
|
58
|
+
analyzeLismProp(t, s) {
|
|
59
|
+
if (s == null) return;
|
|
60
|
+
let i = P[t] || null;
|
|
61
|
+
if (i === null) return;
|
|
89
62
|
this._propConfig[t] && (i = Object.assign({}, i, this._propConfig[t]));
|
|
90
|
-
const {
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
Object.keys(s).forEach((n) => {
|
|
94
|
-
const { prop: h, context: d } = l(n);
|
|
95
|
-
d ? this.setContextProps(t, { [h]: s[n] }) : this.analyzeProp(h, s[n]);
|
|
96
|
-
});
|
|
97
|
-
} else
|
|
98
|
-
this.setAttrs(e || t, s, r);
|
|
99
|
-
Object.keys(c).forEach((n) => {
|
|
100
|
-
this.setAttrs(e || t, c[n], r, n);
|
|
63
|
+
const { base: l, ...a } = _(s);
|
|
64
|
+
this.setAttrs(t, l, i), Object.keys(a).forEach((e) => {
|
|
65
|
+
this.setAttrs(t, a[e], i, e);
|
|
101
66
|
});
|
|
102
67
|
}
|
|
103
68
|
addUtil(t) {
|
|
@@ -130,114 +95,81 @@ class K {
|
|
|
130
95
|
}
|
|
131
96
|
// utilクラスを追加するか、styleにセットするかの分岐処理 @base
|
|
132
97
|
// 値が null, undefined, '', false の時はスキップ
|
|
133
|
-
setAttrs(t, s, i = {},
|
|
98
|
+
setAttrs(t, s, i = {}, l = "") {
|
|
134
99
|
if (s == null || s === "" || s === !1) return;
|
|
135
|
-
let
|
|
136
|
-
if (
|
|
137
|
-
this.addUtil(`${
|
|
100
|
+
let a = `--${t}`, e = `-${i.utilKey || t}`;
|
|
101
|
+
if (l && (a = `--${t}_${l}`, e += `_${l}`), typeof s == "string" && s.startsWith(":")) {
|
|
102
|
+
this.addUtil(`${e}:${s.replace(":", "")}`);
|
|
138
103
|
return;
|
|
139
104
|
}
|
|
140
|
-
if (!
|
|
141
|
-
|
|
142
|
-
if (
|
|
143
|
-
this.addUtil(`${
|
|
105
|
+
if (!l) {
|
|
106
|
+
const { presets: u, tokenClass: y, utils: $, shorthands: C } = i;
|
|
107
|
+
if (u && g(u, s)) {
|
|
108
|
+
this.addUtil(`${e}:${s}`);
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
111
|
+
if (y && V(i.token, s)) {
|
|
112
|
+
this.addUtil(`${e}:${s}`);
|
|
144
113
|
return;
|
|
145
114
|
}
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
this.addUtil(`${r}:${a}`);
|
|
151
|
-
return;
|
|
152
|
-
}
|
|
115
|
+
let c = "";
|
|
116
|
+
if ($ && (c = O($, s)), !c && C && (c = O(C, s, !0)), c) {
|
|
117
|
+
this.addUtil(`${e}:${c}`);
|
|
118
|
+
return;
|
|
153
119
|
}
|
|
154
120
|
}
|
|
155
|
-
let { style: f, isVar: c, converter: n } = i;
|
|
156
121
|
if (s === !0 || s === "-") {
|
|
157
|
-
this.addUtil(
|
|
158
|
-
return;
|
|
159
|
-
}
|
|
160
|
-
if ((t === "bgc" || t === "c" || t === "bdc") && typeof s == "string" && s.endsWith("%")) {
|
|
161
|
-
this.setMixColor(t, s);
|
|
162
|
-
return;
|
|
163
|
-
}
|
|
164
|
-
if (n && (s = u(s, n, t)), c && (f = `--${t}`), !e && f) {
|
|
165
|
-
this.addStyle(f, s);
|
|
122
|
+
this.addUtil(e);
|
|
166
123
|
return;
|
|
167
124
|
}
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
this.addStyle(`--_${t}1`, u(e, "color", t)), this.addStyle(`--_mixpct-${t}`, l);
|
|
125
|
+
let { prop: h, isVar: f, alwaysVar: m, token: o, bp: n } = i;
|
|
126
|
+
if (o && (s = S(s, o)), !l) {
|
|
127
|
+
if (f) {
|
|
128
|
+
this.addStyle(`--${t}`, s);
|
|
129
|
+
return;
|
|
130
|
+
} else if (!n && !m) {
|
|
131
|
+
this.addStyle(h, s);
|
|
132
|
+
return;
|
|
133
|
+
}
|
|
178
134
|
}
|
|
179
|
-
this.addUtil(
|
|
180
|
-
}
|
|
181
|
-
setPassProps(
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
135
|
+
this.addUtil(e), this.addStyle(a, s);
|
|
136
|
+
}
|
|
137
|
+
// setPassProps(passVars) {
|
|
138
|
+
// let dataList = [];
|
|
139
|
+
// Object.keys(passVars).forEach((propName) => {
|
|
140
|
+
// // プロバイダーリストに追加
|
|
141
|
+
// dataList.push(propName);
|
|
142
|
+
// // 渡す値
|
|
143
|
+
// let value = passVars[propName];
|
|
144
|
+
// if (null === value) return;
|
|
145
|
+
// // トークン値であれば変換
|
|
146
|
+
// value = getMaybeCssVar(value, getTokenKey(propName));
|
|
147
|
+
// this.addStyle(`--pass_${propName}`, value);
|
|
148
|
+
// });
|
|
149
|
+
// }
|
|
150
|
+
setHovProps(t) {
|
|
151
|
+
t && (t === "-" || t === !0 ? this.addUtil("-hov") : typeof t == "string" ? k(t).forEach((s) => {
|
|
191
152
|
this.addUtil(`-hov:${s}`);
|
|
192
153
|
}) : typeof t == "object" && Object.keys(t).forEach((s) => {
|
|
193
154
|
let i = t[s];
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
else if (s === "class")
|
|
198
|
-
S(i).forEach((e) => {
|
|
199
|
-
this.addUtil(`-hov:${e}`);
|
|
200
|
-
});
|
|
201
|
-
else {
|
|
202
|
-
const e = j(s);
|
|
203
|
-
e && (i = u(i, e, s)), this.addUtil(`-hov:${s}`), this.addStyle(`--hov-${s}`, i);
|
|
204
|
-
}
|
|
155
|
+
i == null || i === "" || i === !1 || (i === "-" || i === !0 ? this.addUtil(`-hov:${s}`) : s === "class" ? k(i).forEach((l) => {
|
|
156
|
+
this.addUtil(`-hov:${l}`);
|
|
157
|
+
}) : (i = S(i, z(s)), this.addUtil(`-hov:${s}`), this.addStyle(`--hov-${s}`, i)));
|
|
205
158
|
}));
|
|
206
159
|
}
|
|
207
|
-
setBdProps(t) {
|
|
208
|
-
if (t) {
|
|
209
|
-
if (typeof t == "string" && t.includes(",") && !t.includes("(")) {
|
|
210
|
-
S(t).forEach((s) => {
|
|
211
|
-
const i = x("bd", s) || s;
|
|
212
|
-
i && this.addUtil(`-bd:${i}`);
|
|
213
|
-
});
|
|
214
|
-
return;
|
|
215
|
-
}
|
|
216
|
-
this.analyzeProp("bd", t);
|
|
217
|
-
}
|
|
218
|
-
}
|
|
219
|
-
getStateProps({ skipState: t, isOverwide: s, isFullwide: i, isWide: e, isFlow: l, isContainer: r, hasGutter: f, isLayer: c, isLinkBox: n, ...h }) {
|
|
220
|
-
return t || (r && this.setContainerData(r), l && this.setFlowData(l), s && this.lismState.push("is--overwide"), i && this.lismState.push("is--fullwide"), e && this.lismState.push("is--wide"), f && this.lismState.push("has--gutter")), c && this.lismState.push("is--layer"), n && this.lismState.push("is--linkBox"), h;
|
|
221
|
-
}
|
|
222
|
-
setContainerData(t) {
|
|
223
|
-
t === !0 ? this.lismState.push("is--container") : t && (g("contentSize", t) ? this.lismState.push(`is--container -container:${t}`) : (this.lismState.push("is--container"), this.addStyle("--contentSize", u(t, "size"))));
|
|
224
|
-
}
|
|
225
|
-
setFlowData(t) {
|
|
226
|
-
t === !0 ? this.lismState.push("is--flow") : t && (g("flow", t) ? this.lismState.push(`is--flow -flow:${t}`) : (this.lismState.push("is--flow"), this.addStyle("--flowM", u(t, "space"))));
|
|
227
|
-
}
|
|
228
160
|
}
|
|
229
|
-
function
|
|
230
|
-
if (
|
|
161
|
+
function J(r) {
|
|
162
|
+
if (r.length === 0)
|
|
231
163
|
return {};
|
|
232
|
-
const
|
|
233
|
-
return
|
|
234
|
-
className:
|
|
235
|
-
style:
|
|
164
|
+
const t = new w(r);
|
|
165
|
+
return j({
|
|
166
|
+
className: t.className,
|
|
167
|
+
style: j(t.styles),
|
|
236
168
|
//filterEmptyObj(styles), // filterEmptyObj は最後にかける
|
|
237
|
-
...
|
|
169
|
+
...t.attrs
|
|
238
170
|
// 処理されずに残っているprops
|
|
239
171
|
});
|
|
240
172
|
}
|
|
241
173
|
export {
|
|
242
|
-
|
|
174
|
+
J as default
|
|
243
175
|
};
|
|
@@ -1,61 +1,37 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
return p(r);
|
|
16
|
-
case "bxsh":
|
|
17
|
-
return b(r);
|
|
18
|
-
// case 'opacity':
|
|
19
|
-
// return getMaybeOpacityVar(value);
|
|
20
|
-
case "fz":
|
|
21
|
-
return y(r);
|
|
22
|
-
// case 'filter':
|
|
23
|
-
// return getMaybeFilterVar(value);
|
|
24
|
-
default:
|
|
25
|
-
return r;
|
|
26
|
-
}
|
|
27
|
-
else if (t === 1 && n(i, r))
|
|
28
|
-
return `var(--${i}--${r})`;
|
|
29
|
-
return r;
|
|
30
|
-
}
|
|
31
|
-
function e(r, t) {
|
|
32
|
-
return r === 0 || r === "0" ? "0" : typeof r == "number" || o(r) ? `var(--s${r})` : typeof r == "string" && r.includes(" ") && !r.includes("calc(") && !r.includes("var(") && !r.includes(",") ? r.split(" ").map((s) => e(s)).join(" ") : r;
|
|
33
|
-
}
|
|
34
|
-
function f(r, t) {
|
|
35
|
-
if (typeof r == "string" && r.endsWith("%")) {
|
|
36
|
-
const [i, s] = r.split(":");
|
|
37
|
-
return `color-mix(in srgb, ${f(i)} ${s}, transparent)`;
|
|
1
|
+
import { TOKENS as t } from "../config/index.js";
|
|
2
|
+
import f from "./helper/isNumStr.js";
|
|
3
|
+
import n from "./getMaybeTokenValue.js";
|
|
4
|
+
function b(r, o) {
|
|
5
|
+
if (!o) return r;
|
|
6
|
+
switch (o) {
|
|
7
|
+
case "space":
|
|
8
|
+
return s(r);
|
|
9
|
+
case "color":
|
|
10
|
+
return p(r);
|
|
11
|
+
case "bxsh":
|
|
12
|
+
return r === "0" || r === 0 ? "none" : n(o, r, t);
|
|
13
|
+
default:
|
|
14
|
+
return n(o, r, t);
|
|
38
15
|
}
|
|
39
|
-
return n("color", r) ? `var(--c-${r})` : n("palette", r) ? `var(--${r})` : r;
|
|
40
16
|
}
|
|
41
|
-
function
|
|
42
|
-
return
|
|
17
|
+
function s(r) {
|
|
18
|
+
return r === 0 || r === "0" ? "0" : typeof r == "number" || f(r) ? `var(--s${r})` : typeof r == "string" && r.includes(" ") && !r.includes("calc(") && !r.includes("var(") && !r.includes(",") ? r.split(" ").map((i) => s(i)).join(" ") : r;
|
|
43
19
|
}
|
|
44
20
|
function p(r) {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
|
|
21
|
+
if (typeof r == "string" && r.endsWith("%")) {
|
|
22
|
+
const o = r.split(":");
|
|
23
|
+
if (o.length === 3) {
|
|
24
|
+
const [i, c, e] = o;
|
|
25
|
+
return `color-mix(in srgb, ${n("color", i, t)} ${e}, ${n("color", c, t)})`;
|
|
26
|
+
} else if (o.length === 2) {
|
|
27
|
+
const [i, c] = o;
|
|
28
|
+
return `color-mix(in srgb, ${n("color", i, t)} ${c}, transparent)`;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
return n("color", r, t);
|
|
52
32
|
}
|
|
53
33
|
export {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
p as getMaybeRadiusVar,
|
|
58
|
-
b as getMaybeShadowVar,
|
|
59
|
-
c as getMaybeSizeVar,
|
|
60
|
-
e as getMaybeSpaceVar
|
|
34
|
+
b as default,
|
|
35
|
+
p as getMaybeColorVar,
|
|
36
|
+
s as getMaybeSpaceVar
|
|
61
37
|
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
function c(t, r, n) {
|
|
2
|
+
if (typeof t != "string") return r;
|
|
3
|
+
if (t === "color") {
|
|
4
|
+
let s = c("c", r, n);
|
|
5
|
+
return s === r && (s = c("palette", r, n)), s;
|
|
6
|
+
}
|
|
7
|
+
const i = n[t];
|
|
8
|
+
if (!i) return r;
|
|
9
|
+
if (typeof r == "number" && (r = `${r}`), i instanceof Set) {
|
|
10
|
+
if (i.has(r))
|
|
11
|
+
return r.startsWith("-") && (r = `n${r.slice(1)}`), `var(--${t}--${r})`;
|
|
12
|
+
} else if (Array.isArray(i)) {
|
|
13
|
+
if (i.includes(r))
|
|
14
|
+
return r.startsWith("-") && (r = `n${r.slice(1)}`), `var(--${t}--${r})`;
|
|
15
|
+
} else if (typeof i == "object") {
|
|
16
|
+
const { pre: s = "", values: f = [] } = i || {};
|
|
17
|
+
if ((t === "palette" || t === "c") && console.log(":::color:::::", r, f), f instanceof Set && f.has(r))
|
|
18
|
+
return `var(${s}${r})`;
|
|
19
|
+
if (Array.isArray(f) && f.includes(r))
|
|
20
|
+
return `var(${s}${r})`;
|
|
21
|
+
}
|
|
22
|
+
return r;
|
|
23
|
+
}
|
|
24
|
+
export {
|
|
25
|
+
c as default
|
|
26
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
function o(e, r, f = !1) {
|
|
2
|
+
if (e == null || typeof e != "object") return "";
|
|
3
|
+
if (r in e)
|
|
4
|
+
return f ? e[r] : r;
|
|
5
|
+
if (f) return "";
|
|
6
|
+
for (const [n, t] of Object.entries(e))
|
|
7
|
+
if (t === r)
|
|
8
|
+
return n;
|
|
9
|
+
return "";
|
|
10
|
+
}
|
|
11
|
+
export {
|
|
12
|
+
o as default
|
|
13
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
function
|
|
2
|
-
return
|
|
1
|
+
function f(n, r) {
|
|
2
|
+
return typeof r == "number" && (r = `${r}`), n instanceof Set ? n.has(r) : Array.isArray(n) ? n.includes(r) : !1;
|
|
3
3
|
}
|
|
4
4
|
export {
|
|
5
|
-
|
|
5
|
+
f as default
|
|
6
6
|
};
|
package/dist/lib/isTokenValue.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import
|
|
2
|
-
function i(
|
|
3
|
-
if (typeof
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { TOKENS as s } from "../config/index.js";
|
|
2
|
+
function i(t, e) {
|
|
3
|
+
if (typeof t != "string") return !1;
|
|
4
|
+
typeof e == "number" && (e = `${e}`);
|
|
5
|
+
const r = s[t];
|
|
6
|
+
return r instanceof Set ? r.has(e) : Array.isArray(r) ? r.includes(e) : typeof r == "object" ? (r.values || /* @__PURE__ */ new Set()).has(e) : !1;
|
|
6
7
|
}
|
|
7
8
|
export {
|
|
8
9
|
i as default
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "lism-css",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"description": "A layout-first CSS framework for websites.",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "ddryo",
|
|
@@ -16,13 +16,20 @@
|
|
|
16
16
|
"dev": "vite",
|
|
17
17
|
"build": "vite build && pnpm build:css",
|
|
18
18
|
"build:vite": "vite build",
|
|
19
|
-
"build:css": "node
|
|
19
|
+
"build:css": "node bin/script-build-css.js",
|
|
20
20
|
"lint": "pnpm lint:style",
|
|
21
21
|
"lint:style": "stylelint '**/*.{css,scss}'",
|
|
22
22
|
"preview": "vite preview"
|
|
23
23
|
},
|
|
24
|
+
"bin": {
|
|
25
|
+
"lism-css": "./bin/cli.mjs"
|
|
26
|
+
},
|
|
24
27
|
"files": [
|
|
25
28
|
"dist",
|
|
29
|
+
"config",
|
|
30
|
+
"config.js",
|
|
31
|
+
"vite-plugin.js",
|
|
32
|
+
"bin",
|
|
26
33
|
"packages",
|
|
27
34
|
"src/scss"
|
|
28
35
|
],
|
|
@@ -31,7 +38,12 @@
|
|
|
31
38
|
"types": "./packages/types/index.d.ts",
|
|
32
39
|
"exports": {
|
|
33
40
|
".": "./dist/index.js",
|
|
34
|
-
"
|
|
41
|
+
"./config.js": "./config.js",
|
|
42
|
+
"./config": "./config/index.js",
|
|
43
|
+
"./default-config": "./config/default-config.js",
|
|
44
|
+
"./vite-plugin": "./vite-plugin.mjs",
|
|
45
|
+
"./lib/*": "./dist/lib/*",
|
|
46
|
+
"./components/*": "./dist/components/*",
|
|
35
47
|
"./react": {
|
|
36
48
|
"import": "./dist/index.js",
|
|
37
49
|
"types": "./packages/types/index.d.ts"
|
|
@@ -43,6 +55,7 @@
|
|
|
43
55
|
"types": "./packages/types/index.d.ts"
|
|
44
56
|
},
|
|
45
57
|
"./astro/*": "./packages/astro/*",
|
|
58
|
+
"./types": "./packages/types/index.d.ts",
|
|
46
59
|
"./scss/*": "./src/scss/*",
|
|
47
60
|
"./*.css": "./dist/css/*.css"
|
|
48
61
|
},
|
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
---
|
|
2
|
-
import type { LismProps } from '
|
|
2
|
+
import type { LismProps } from '../../types';
|
|
3
3
|
import { Lism } from '../Lism';
|
|
4
|
-
import { Grid } from '../Grid';
|
|
5
4
|
import { defaultProps } from '../../../dist/components/Accordion/getProps';
|
|
6
5
|
|
|
7
6
|
interface Props extends LismProps {}
|
|
8
|
-
const {
|
|
7
|
+
const { flow, innerProps, ...props } = Astro.props || {};
|
|
9
8
|
---
|
|
10
9
|
|
|
11
|
-
<
|
|
12
|
-
<Lism
|
|
10
|
+
<Lism {...defaultProps.body} {...props}>
|
|
11
|
+
<Lism layout='flow' flow={flow} {...defaultProps.inner} {...innerProps}>
|
|
13
12
|
<slot />
|
|
14
13
|
</Lism>
|
|
15
|
-
</
|
|
14
|
+
</Lism>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
|
-
import type { LismProps } from '
|
|
3
|
-
import {
|
|
2
|
+
import type { LismProps } from '../../types';
|
|
3
|
+
import { Lism } from '../Lism';
|
|
4
4
|
import { defaultProps } from '../../../dist/components/Accordion/getProps';
|
|
5
5
|
|
|
6
6
|
interface Props extends LismProps {}
|
|
@@ -8,6 +8,6 @@ interface Props extends LismProps {}
|
|
|
8
8
|
const props = Astro.props || {};
|
|
9
9
|
---
|
|
10
10
|
|
|
11
|
-
<
|
|
11
|
+
<Lism tag='summary' {...defaultProps.header} {...props}>
|
|
12
12
|
<slot />
|
|
13
|
-
</
|
|
13
|
+
</Lism>
|
|
@@ -3,5 +3,6 @@ import Header from './AccHeader.astro';
|
|
|
3
3
|
import Label from './AccLabel.astro';
|
|
4
4
|
import Icon from './AccIcon.astro';
|
|
5
5
|
import Body from './AccBody.astro';
|
|
6
|
+
import HeaderLabel from './AccHeaderLabel.astro';
|
|
6
7
|
|
|
7
|
-
export default { Root, Header, Body, Icon, Label };
|
|
8
|
+
export default { Root, Header, HeaderLabel, Body, Icon, Label };
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
---
|
|
2
|
-
import type { LismProps } from '
|
|
2
|
+
import type { LismProps } from '../../types';
|
|
3
3
|
import { Lism } from '../Lism';
|
|
4
|
-
import getProps from '../../../dist/components/Box/getProps';
|
|
5
4
|
|
|
6
5
|
// Propsの定義
|
|
7
6
|
interface Props extends LismProps {}
|
|
8
7
|
const props = Astro.props || {};
|
|
9
8
|
---
|
|
10
9
|
|
|
11
|
-
<Lism {...
|
|
10
|
+
<Lism layout='box' {...props}><slot /></Lism>
|