lism-css 0.14.0 → 0.15.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.
Files changed (59) hide show
  1. package/README.ja.md +2 -2
  2. package/README.md +4 -3
  3. package/bin/build-config.js +1 -4
  4. package/bin/cli.mjs +13 -3
  5. package/config/defaults/props.ts +11 -14
  6. package/config/defaults/tokens.ts +1 -1
  7. package/config/defaults/traits.ts +4 -0
  8. package/dist/components/Lism/Lism.d.ts +2 -1
  9. package/dist/config/default-config.d.ts +5 -12
  10. package/dist/config/defaults/props.d.ts +5 -14
  11. package/dist/config/defaults/props.js +7 -12
  12. package/dist/config/defaults/tokens.d.ts +1 -1
  13. package/dist/config/defaults/tokens.js +1 -1
  14. package/dist/config/defaults/traits.d.ts +4 -0
  15. package/dist/config/defaults/traits.js +5 -1
  16. package/dist/config/index.d.ts +10 -24
  17. package/dist/css/base/set.css +1 -1
  18. package/dist/css/base.css +1 -1
  19. package/dist/css/main.css +1 -1
  20. package/dist/css/main_no_layer.css +1 -1
  21. package/dist/css/props.css +1 -1
  22. package/dist/css/trait.css +1 -0
  23. package/dist/css/utility.css +1 -1
  24. package/dist/lib/getLismProps.d.ts +5 -5
  25. package/dist/lib/getLismProps.js +101 -102
  26. package/dist/lib/types/TraitProps.d.ts +2 -2
  27. package/package.json +1 -1
  28. package/packages/astro/index.ts +3 -0
  29. package/packages/astro/layout/Flex/Flex.astro +3 -2
  30. package/packages/astro/layout/Flow/Flow.astro +2 -2
  31. package/packages/astro/types.ts +3 -0
  32. package/src/scss/_auto_output.scss +12 -11
  33. package/src/scss/_prop-config.scss +1 -11
  34. package/src/scss/_with_layer.scss +8 -4
  35. package/src/scss/base/_html.scss +3 -3
  36. package/src/scss/base/set/{_innerRs.scss → _bdrsInner.scss} +1 -1
  37. package/src/scss/base/set/_hov.scss +4 -4
  38. package/src/scss/base/set/_revert.scss +6 -0
  39. package/src/scss/base/set/index.scss +2 -4
  40. package/src/scss/base/tokens/_shadow.scss +18 -12
  41. package/src/scss/base/tokens/_tokens.scss +1 -12
  42. package/src/scss/main_no_layer.scss +4 -1
  43. package/src/scss/props/_hover.scss +27 -16
  44. package/src/scss/props/_size.scss +1 -1
  45. package/src/scss/{primitives/trait → trait}/_boxLink.scss +1 -1
  46. package/src/scss/{primitives/trait → trait}/_container.scss +2 -2
  47. package/src/scss/{base/set/_gutter.scss → trait/_hasGutter.scss} +1 -1
  48. package/src/scss/trait/_hasMask.scss +6 -0
  49. package/src/scss/trait/_hasSnap.scss +11 -0
  50. package/src/scss/trait/_hasTransition.scss +8 -0
  51. package/src/scss/{primitives/trait → trait}/index.scss +7 -1
  52. package/src/scss/utility/index.scss +0 -1
  53. package/dist/css/primitives/trait.css +0 -1
  54. package/src/scss/base/set/_mask.scss +0 -6
  55. package/src/scss/base/set/_transition.scss +0 -11
  56. package/src/scss/utility/_snap.scss +0 -8
  57. /package/src/scss/{primitives/trait → trait}/_coverLink.scss +0 -0
  58. /package/src/scss/{primitives/trait → trait}/_layer.scss +0 -0
  59. /package/src/scss/{primitives/trait → trait}/_wrapper.scss +0 -0
@@ -15,7 +15,6 @@ interface PropConfig {
15
15
  isVar?: number;
16
16
  bp?: 0 | 1;
17
17
  alwaysVar?: number;
18
- overwriteBaseVar?: number;
19
18
  important?: number;
20
19
  exUtility?: Record<string, unknown>;
21
20
  customVar?: string;
@@ -35,10 +34,6 @@ export interface LismPropsBase extends TraitProps, PropValueTypes {
35
34
  forwardedRef?: React.Ref<any>;
36
35
  class?: string | null;
37
36
  className?: string;
38
- /**
39
- * a--* / l--* / is--* クラスを集約する内部スロット。
40
- * 通常は getLayoutProps / getAtomicProps 経由で push される。
41
- */
42
37
  primitiveClass?: string[];
43
38
  style?: StyleWithCustomProps;
44
39
  _propConfig?: Record<string, PropConfig>;
@@ -52,7 +47,10 @@ export interface LismPropsBase extends TraitProps, PropValueTypes {
52
47
  export declare class LismPropsData {
53
48
  className: string;
54
49
  primitiveClass: string[];
50
+ setClasses: string[];
51
+ traitClasses: string[];
55
52
  uClasses: string[];
53
+ propClasses: string[];
56
54
  styles: StyleWithCustomProps;
57
55
  attrs: Record<string, unknown>;
58
56
  _propConfig?: Record<string, PropConfig>;
@@ -61,8 +59,10 @@ export declare class LismPropsData {
61
59
  analyzeTrait(traitPropData: TraitPropDataObject, propVal: unknown): void;
62
60
  analyzeProps(): void;
63
61
  analyzeLismProp(propName: string, propVal: unknown): void;
62
+ addSet(setName: string): void;
64
63
  addUtil(util: string): void;
65
64
  addUtils(utils: string[]): void;
65
+ addProp(prop: string): void;
66
66
  addStyle(name: string, val: string | number): void;
67
67
  addStyles(styles: Record<string, string | number | undefined>): void;
68
68
  addAttrs(data: {
@@ -1,146 +1,149 @@
1
- import { TRAITS as C, PROPS as d } from "../config/index.js";
2
- import E from "./getLayoutProps.js";
3
- import V from "./getAtomicProps.js";
4
- import P from "./isPresetValue.js";
1
+ import { TRAITS as C, PROPS as c } from "../config/index.js";
2
+ import V from "./getLayoutProps.js";
3
+ import E from "./getAtomicProps.js";
4
+ import g from "./isPresetValue.js";
5
5
  import x from "./isTokenValue.js";
6
- import S from "./getUtilKey.js";
7
- import u from "./getMaybeCssVar.js";
6
+ import $ from "./getUtilKey.js";
7
+ import d from "./getMaybeCssVar.js";
8
8
  import w from "./getBpData.js";
9
9
  import A from "./helper/atts.js";
10
10
  import _ from "./helper/isEmptyObj.js";
11
- import p from "./helper/filterEmptyObj.js";
11
+ import S from "./helper/filterEmptyObj.js";
12
12
  import b from "./helper/mergeSet.js";
13
- import U from "./helper/splitWithComma.js";
14
- const z = (n) => {
15
- const i = d[n];
16
- return i && i?.token || "";
13
+ import z from "./helper/splitWithComma.js";
14
+ const L = (n) => {
15
+ const s = c[n];
16
+ return s && s?.token || "";
17
17
  };
18
- class L {
18
+ class T {
19
19
  // 最終出力 className
20
20
  className = "";
21
- // 出力順のためのクラスバケット: [primitiveClass] [uClasses]
22
- // - primitiveClass : a--* / l--* / is--* の primitive クラス(getAtomicProps → getLayoutProps → analyzeTrait の順で push)
23
- // - uClasses : set--* → u--* → -property の順で push される utility クラス
24
21
  primitiveClass = [];
22
+ setClasses = [];
23
+ traitClasses = [];
25
24
  uClasses = [];
25
+ propClasses = [];
26
26
  styles = {};
27
27
  attrs = {};
28
28
  _propConfig;
29
- constructor(i) {
30
- const { forwardedRef: t, class: s, className: e, primitiveClass: l, style: r = {}, _propConfig: o = {}, ...c } = i;
31
- this.styles = { ...r }, this._propConfig = { ...o }, l && l.length && (this.primitiveClass = [...l]), _(c) || (this.attrs = { ...c }, this.analyzeProps()), t && (this.attrs.ref = t), this.className = this.buildClassName(e, s);
29
+ constructor(s) {
30
+ const { forwardedRef: t, class: i, className: e, primitiveClass: o, style: r = {}, _propConfig: a = {}, ...u } = s;
31
+ this.styles = { ...r }, this._propConfig = { ...a }, o && o.length && (this.primitiveClass = [...o]), _(u) || (this.attrs = { ...u }, this.analyzeProps()), t && (this.attrs.ref = t), this.className = this.buildClassName(e, i);
32
32
  }
33
33
  // 最終クラス文字列の組み立て(出力順の唯一の確定地点)
34
- // 出力順: [className&class] [primitiveClass] [uClasses]
34
+ // 出力順: [className&class] [primitiveClass] [setClasses] [traitClasses] [uClasses] [propClasses]
35
35
  // className と class が両方来た場合は両方マージする(atts 内で重複は除去される)。
36
- buildClassName(i, t) {
37
- return A(i, t, this.primitiveClass, this.uClasses);
36
+ buildClassName(s, t) {
37
+ return A(s, t, this.primitiveClass, this.setClasses, this.traitClasses, this.uClasses, this.propClasses);
38
38
  }
39
- analyzeTrait(i, t) {
40
- const { className: s, preset: e, presetClass: l, customVar: r, tokenKey: o } = i;
41
- t === !0 ? this.primitiveClass.push(s) : e && P(e, t) ? this.primitiveClass.push(`${s} ${l}:${String(t)}`) : t && (this.primitiveClass.push(s), o && r && this.addStyle(r, u(t, o)));
39
+ analyzeTrait(s, t) {
40
+ const { className: i, preset: e, presetClass: o, customVar: r, tokenKey: a } = s;
41
+ t === !0 ? this.traitClasses.push(i) : e && g(e, t) ? this.traitClasses.push(`${i} ${o}:${String(t)}`) : t && (this.traitClasses.push(i), a && r && this.addStyle(r, d(t, a)));
42
42
  }
43
43
  // prop解析
44
44
  analyzeProps() {
45
- const i = this.extractProp("set"), t = this.extractProp("util");
46
- b(void 0, i).forEach((s) => this.addUtil(`set--${s}`)), b(void 0, t).forEach((s) => this.addUtil(`u--${s}`)), Object.keys(this.attrs).forEach((s) => {
47
- if (Object.hasOwn(C, s)) {
48
- const e = this.extractProp(s), l = C[s];
49
- typeof l == "string" ? e && this.primitiveClass.push(l) : this.analyzeTrait(l, e);
50
- } else if (Object.hasOwn(d, s)) {
51
- const e = this.attrs[s];
52
- delete this.attrs[s], this.analyzeLismProp(s, e);
53
- } else if (s === "hov") {
54
- const e = this.extractProp(s);
45
+ const s = this.extractProp("set"), t = this.extractProp("util");
46
+ b(void 0, s).forEach((i) => this.addSet(i)), b(void 0, t).forEach((i) => this.addUtil(`u--${i}`)), Object.keys(this.attrs).forEach((i) => {
47
+ if (Object.hasOwn(C, i)) {
48
+ const e = this.extractProp(i), o = C[i];
49
+ typeof o == "string" ? e && this.traitClasses.push(o) : this.analyzeTrait(o, e);
50
+ } else if (Object.hasOwn(c, i)) {
51
+ const e = this.attrs[i];
52
+ delete this.attrs[i], this.analyzeLismProp(i, e);
53
+ } else if (i === "hov") {
54
+ const e = this.extractProp(i);
55
55
  this.setHovProps(e);
56
- } else if (s === "css") {
56
+ } else if (i === "css") {
57
57
  const e = this.extractProp("css");
58
58
  this.addStyles(e);
59
59
  }
60
60
  });
61
61
  }
62
62
  // Lism Prop 解析
63
- analyzeLismProp(i, t) {
63
+ analyzeLismProp(s, t) {
64
64
  if (t == null) return;
65
- let s = d[i] || null;
66
- if (s === null) return;
67
- this._propConfig?.[i] && (s = Object.assign({}, s, this._propConfig[i]));
68
- const { base: e, ...l } = w(t);
69
- this.setAttrs(i, e, s), Object.keys(l).forEach((r) => {
70
- s && this.setAttrs(i, l[r], s, r);
65
+ let i = c[s] || null;
66
+ if (i === null) return;
67
+ this._propConfig?.[s] && (i = Object.assign({}, i, this._propConfig[s]));
68
+ const { base: e, ...o } = w(t);
69
+ this.setAttrs(s, e, i), Object.keys(o).forEach((r) => {
70
+ i && this.setAttrs(s, o[r], i, r);
71
71
  });
72
72
  }
73
- addUtil(i) {
74
- this.uClasses.push(i);
73
+ addSet(s) {
74
+ this.setClasses.push(`set--${s}`);
75
75
  }
76
- addUtils(i) {
77
- this.uClasses.push(...i);
76
+ addUtil(s) {
77
+ this.uClasses.push(s);
78
78
  }
79
- // addState(state) {
80
- // this.stateClasses.push(state);
81
- // }
82
- addStyle(i, t) {
83
- this.styles[i] = t;
79
+ addUtils(s) {
80
+ this.uClasses.push(...s);
81
+ }
82
+ addProp(s) {
83
+ this.propClasses.push(s);
84
+ }
85
+ addStyle(s, t) {
86
+ this.styles[s] = t;
84
87
  }
85
- addStyles(i) {
86
- this.styles = { ...this.styles, ...i };
88
+ addStyles(s) {
89
+ this.styles = { ...this.styles, ...s };
87
90
  }
88
- addAttrs(i) {
89
- this.addStyles(i.styles || {}), this.addUtils(i.utils || []);
91
+ addAttrs(s) {
92
+ this.addStyles(s.styles || {}), this.addUtils(s.utils || []);
90
93
  }
91
- extractProp(i) {
92
- const t = this.attrs[i];
93
- return this.attrs[i] === void 0 ? null : (delete this.attrs[i], t);
94
+ extractProp(s) {
95
+ const t = this.attrs[s];
96
+ return this.attrs[s] === void 0 ? null : (delete this.attrs[s], t);
94
97
  }
95
- extractProps(i) {
98
+ extractProps(s) {
96
99
  const t = {};
97
- return i.forEach((s) => {
98
- this.attrs[s] !== void 0 && (t[s] = this.attrs[s], delete this.attrs[s]);
100
+ return s.forEach((i) => {
101
+ this.attrs[i] !== void 0 && (t[i] = this.attrs[i], delete this.attrs[i]);
99
102
  }), t;
100
103
  }
101
- // utilクラスを追加するか、styleにセットするかの分岐処理 @base
104
+ // propertyクラスを追加するか、styleにセットするかの分岐処理 @base
102
105
  // 値が null, undefined, '', false の時はスキップ
103
- setAttrs(i, t, s = {}, e = "") {
106
+ setAttrs(s, t, i = {}, e = "") {
104
107
  if (t == null || t === "" || t === !1) return;
105
- let l = `--${i}`, r = `-${String(s.utilKey || i)}`;
106
- if (e && (l = `--${i}_${e}`, r += `_${e}`), typeof t == "string" && t.startsWith(":")) {
107
- this.addUtil(`${r}:${t.replace(":", "")}`);
108
+ let o = `--${s}`, r = `-${String(i.utilKey || s)}`;
109
+ if (e && (o = `--${s}_${e}`, r += `_${e}`), typeof t == "string" && t.startsWith(":")) {
110
+ this.addProp(`${r}:${t.replace(":", "")}`);
108
111
  return;
109
112
  }
110
113
  if (!e) {
111
- const { presets: m, tokenClass: j, utils: g, shorthands: $ } = s;
112
- if (m && P(m, t)) {
114
+ const { presets: m, tokenClass: j, utils: p, shorthands: P } = i;
115
+ if (m && g(m, t)) {
113
116
  const h = typeof t == "string" || typeof t == "number" ? String(t) : "";
114
- h && this.addUtil(`${r}:${h}`);
117
+ h && this.addProp(`${r}:${h}`);
115
118
  return;
116
119
  }
117
- if (j && s.token && x(s.token, t)) {
120
+ if (j && i.token && x(i.token, t)) {
118
121
  const h = typeof t == "string" || typeof t == "number" ? String(t) : "";
119
- h && this.addUtil(`${r}:${h}`);
122
+ h && this.addProp(`${r}:${h}`);
120
123
  return;
121
124
  }
122
- let a = "";
123
- if (g && typeof t == "string" && (a = S(g, t)), !a && $ && typeof t == "string" && (a = S($, t, !0)), a) {
124
- this.addUtil(`${r}:${a}`);
125
+ let f = "";
126
+ if (p && typeof t == "string" && (f = $(p, t)), !f && P && typeof t == "string" && (f = $(P, t, !0)), f) {
127
+ this.addProp(`${r}:${f}`);
125
128
  return;
126
129
  }
127
130
  }
128
- if (t === !0 || t === "-") {
129
- this.addUtil(r);
131
+ if (t === !0) {
132
+ this.addProp(r);
130
133
  return;
131
134
  }
132
- const { prop: o, isVar: c, alwaysVar: O, token: y, bp: k } = s;
133
- let f;
134
- if (y && (typeof t == "string" || typeof t == "number") ? f = u(t, y) : typeof t == "string" || typeof t == "number" ? f = t : f = JSON.stringify(t), !e) {
135
- if (c) {
136
- this.addStyle(`--${i}`, f);
135
+ const { prop: a, isVar: u, alwaysVar: O, token: y, bp: k } = i;
136
+ let l;
137
+ if (y && (typeof t == "string" || typeof t == "number") ? l = d(t, y) : typeof t == "string" || typeof t == "number" ? l = t : l = JSON.stringify(t), !e) {
138
+ if (u) {
139
+ this.addStyle(`--${s}`, l);
137
140
  return;
138
141
  } else if (!k && !O) {
139
- this.addStyle(o, f);
142
+ this.addStyle(a, l);
140
143
  return;
141
144
  }
142
145
  }
143
- this.addUtil(r), this.addStyle(l, f);
146
+ this.addProp(r), this.addStyle(o, l);
144
147
  }
145
148
  // setPassProps(passVars) {
146
149
  // let dataList = [];
@@ -155,21 +158,17 @@ class L {
155
158
  // this.addStyle(`--pass_${propName}`, value);
156
159
  // });
157
160
  // }
158
- setHovProps(i) {
159
- i && (i === "-" || i === !0 ? this.addUtil("-hov") : typeof i == "string" ? U(i).forEach((t) => {
160
- this.addUtil(`-hov:${t}`);
161
- }) : typeof i == "object" && Object.keys(i).forEach((t) => {
162
- const s = i[t];
163
- if (!(s == null || s === "" || s === !1)) {
164
- if (s === "-" || s === !0)
165
- this.addUtil(`-hov:${t}`);
166
- else if (t === "class")
167
- U(s).forEach((e) => {
168
- this.addUtil(`-hov:${e}`);
169
- });
170
- else if (typeof s == "string" || typeof s == "number") {
171
- const e = u(s, z(t));
172
- this.addUtil(`-hov:${t}`), this.addStyle(`--hov-${t}`, e);
161
+ setHovProps(s) {
162
+ s && (s === !0 ? this.addProp("-hov") : typeof s == "string" ? z(s).forEach((t) => {
163
+ this.addProp(`-hov:${t}`);
164
+ }) : typeof s == "object" && Object.keys(s).forEach((t) => {
165
+ const i = s[t];
166
+ if (!(i == null || i === "" || i === !1)) {
167
+ if (i === !0)
168
+ this.addProp(`-hov:${t}`);
169
+ else if (typeof i == "string" || typeof i == "number") {
170
+ const e = d(i, L(t));
171
+ this.addProp(`-hov:-${t}`), this.addStyle(`--hov-${t}`, e);
173
172
  }
174
173
  }
175
174
  }));
@@ -178,17 +177,17 @@ class L {
178
177
  function Y(n) {
179
178
  if (Object.keys(n).length === 0)
180
179
  return {};
181
- const { atomic: i, layout: t, ...s } = n, e = V(i, s), l = E(t, e), r = new L(l);
180
+ const { atomic: s, layout: t, ...i } = n, e = E(s, i), o = V(t, e), r = new T(o);
182
181
  return {
183
- ...p({
182
+ ...S({
184
183
  className: r.className,
185
- style: p(r.styles)
184
+ style: S(r.styles)
186
185
  }),
187
186
  ...r.attrs
188
187
  // data-* などHTMLの標準属性はそのまま渡す
189
188
  };
190
189
  }
191
190
  export {
192
- L as LismPropsData,
191
+ T as LismPropsData,
193
192
  Y as default
194
193
  };
@@ -23,7 +23,7 @@ export type TraitProps = {
23
23
  [K in keyof TraitsConfig]?: ExtractTraitValue<TraitsConfig[K]>;
24
24
  };
25
25
  /** set prop で使われるプリセット値(エディタ補完用) */
26
- type SetPreset = 'gutter' | 'shadow' | 'hov' | 'transition' | 'mask' | 'plain' | 'innerRs';
26
+ type SetPreset = 'plain' | 'revert' | 'var:hov' | 'var:bxsh' | 'var:bdrsInner';
27
27
  /**
28
28
  * set prop の値の型。プリセット値がサジェストされつつ、任意の文字列も受け付ける。
29
29
  *
@@ -34,7 +34,7 @@ type SetPreset = 'gutter' | 'shadow' | 'hov' | 'transition' | 'mask' | 'plain' |
34
34
  */
35
35
  export type SetPropValue = WithArbitraryString<SetPreset> | WithArbitraryString<SetPreset>[];
36
36
  /** util prop で使われるプリセット値(既知の `u--` クラス名・エディタ補完用) */
37
- type UtilPreset = 'cbox' | 'trim' | 'trimChildren' | 'srOnly' | 'clipText' | 'collapseGrid' | 'snap';
37
+ type UtilPreset = 'cbox' | 'trim' | 'trimChildren' | 'srOnly' | 'clipText' | 'collapseGrid';
38
38
  /**
39
39
  * util prop の値の型。既知の `u--` クラス名がサジェストされつつ、任意の文字列も受け付ける。
40
40
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lism-css",
3
- "version": "0.14.0",
3
+ "version": "0.15.0",
4
4
  "description": "Lism CSS is a layout-first CSS framework for websites.",
5
5
  "author": {
6
6
  "name": "ddryo",
@@ -41,3 +41,6 @@ export * from './atomic/Decorator';
41
41
  export * from './atomic/Divider';
42
42
  export * from './atomic/Icon';
43
43
  export * from './atomic/Spacer';
44
+
45
+ // Type exports for Astro components
46
+ export type { AstroLismBaseProps, AstroLismFixedLayoutProps, AstroLayoutProps } from './types';
@@ -1,9 +1,10 @@
1
1
  ---
2
2
  import type { HTMLTag, Polymorphic } from 'astro/types';
3
- import type { AstroLismFixedLayoutProps } from '../../types';
3
+ import type { AstroLayoutProps } from '../../types';
4
+ import type { FlexProps } from 'lism-css/lib/types/LayoutProps';
4
5
  import { Lism } from '../../Lism';
5
6
 
6
- type Props<Tag extends HTMLTag = 'div'> = Polymorphic<{ as: Tag }> & AstroLismFixedLayoutProps;
7
+ type Props<Tag extends HTMLTag = 'div'> = Polymorphic<{ as: Tag }> & AstroLayoutProps<FlexProps>;
7
8
 
8
9
  const props = Astro.props;
9
10
  ---
@@ -1,10 +1,10 @@
1
1
  ---
2
2
  import type { HTMLTag, Polymorphic } from 'astro/types';
3
- import type { AstroLismFixedLayoutProps } from '../../types';
3
+ import type { AstroLayoutProps } from '../../types';
4
4
  import type { FlowLayoutProps } from 'lism-css/lib/types/LayoutProps';
5
5
  import { Lism } from '../../Lism';
6
6
 
7
- type Props<Tag extends HTMLTag = 'div'> = Polymorphic<{ as: Tag }> & AstroLismFixedLayoutProps & Omit<FlowLayoutProps, 'layout'>;
7
+ type Props<Tag extends HTMLTag = 'div'> = Polymorphic<{ as: Tag }> & AstroLayoutProps<FlowLayoutProps>;
8
8
 
9
9
  const props = Astro.props;
10
10
  ---
@@ -17,3 +17,6 @@ export type AstroLismBaseProps = LismProps &
17
17
  export type AstroLismFixedLayoutProps = Omit<LismProps, 'layout'> & {
18
18
  exProps?: Record<string, unknown>;
19
19
  };
20
+
21
+ /** レイアウトコンポーネント向けベース型(React の LayoutComponentProps<T, L> に対応) */
22
+ export type AstroLayoutProps<L = object> = AstroLismFixedLayoutProps & Omit<L, 'layout'>;
@@ -6,15 +6,15 @@
6
6
  @use './query' as query;
7
7
  @use './setting' as setting;
8
8
 
9
- /*
9
+ /*
10
10
  base_type:
11
11
  0 → なし(ユーティリティクラス以外は普通のインラインスタイルのみ)
12
12
  1 → .-d{display: var(--d)}  (メリット:importantなしでbp対応できる)
13
- 2 → .-p, [class*='-p\:'] {padding: var(--p);} の形式で、BPクラス含めて全て変数にセットするもの。
14
- 常に変数で管理されるようになるので、他の処理と絡ませることがしやすい。
15
- デメリット: *= は処理負荷が高い。また、途中のBPから使えるようにするにはCSS記述増える)
16
-
17
- 3 → BPクラスには変数使わないが、文字数省略のため baseのProperty Classだけ変数化して *= セレクタ使う
13
+ 2 → alwaysVar 対象。 .-p, [class*='-p\:'] {padding: var(--p);} の形式で、
14
+ ユーティリティクラスは --p をセットする形になる(state 変数として扱う)。
15
+ BPクラスも .-p_$bp { padding: var(--p); --p: var(--p_$bp) !important; } を出力し、
16
+ --p が常に現在値を参照できるようになる。
17
+ デメリット: *= は処理負荷が高い。
18
18
  */
19
19
 
20
20
  // マップから値を取得し、nullの場合はデフォルト値を返す
@@ -218,7 +218,7 @@ $bp_outputs: (
218
218
  $prop_data: map.get(setting.$props, $key);
219
219
  $prop_name: map.get($prop_data, prop);
220
220
  $isVar: map_get_with_default($prop_data, isVar, 0);
221
- $overwriteBaseVar: map_get_with_default($prop_data, overwriteBaseVar, 0);
221
+ $alwaysVar: map_get_with_default($prop_data, alwaysVar, 0);
222
222
  $important: map_get_with_default($prop_data, important, setting.$default_important);
223
223
 
224
224
  @if $isVar == 1 {
@@ -226,11 +226,12 @@ $bp_outputs: (
226
226
  }
227
227
 
228
228
  .-#{$key}_#{$bp} {
229
- #{$prop_name}: var(--#{$key}_#{$bp}) #{get_important_str($important)};
230
-
231
- // 常に --prop でそのBPの値を取得できるように
232
- @if $overwriteBaseVar == 1 {
229
+ @if $alwaysVar == 1 {
230
+ // state 変数扱い: --prop を単一情報源にし、--prop を上書きして property は var(--prop) を読む
231
+ #{$prop_name}: var(--#{$key}) #{get_important_str($important)};
233
232
  --#{$key}: var(--#{$key}_#{$bp}) !important;
233
+ } @else {
234
+ #{$prop_name}: var(--#{$key}_#{$bp}) #{get_important_str($important)};
234
235
  }
235
236
  }
236
237
  }
@@ -22,7 +22,6 @@ $props: (
22
22
  '2xs': 'var(--fz--2xs)',
23
23
  ),
24
24
  bp: 1,
25
- alwaysVar: 1,
26
25
  ),
27
26
  'fw': (
28
27
  prop: 'font-weight',
@@ -317,7 +316,6 @@ $props: (
317
316
  ),
318
317
  bp: 1,
319
318
  alwaysVar: 1,
320
- overwriteBaseVar: 1,
321
319
  ),
322
320
  'bxsh': (
323
321
  prop: 'box-shadow',
@@ -327,9 +325,9 @@ $props: (
327
325
  '20': 'var(--bxsh--20)',
328
326
  '30': 'var(--bxsh--30)',
329
327
  '40': 'var(--bxsh--40)',
328
+ '50': 'var(--bxsh--50)',
330
329
  ),
331
330
  bp: 1,
332
- alwaysVar: 1,
333
331
  ),
334
332
  'pos': (
335
333
  prop: 'position',
@@ -405,7 +403,6 @@ $props: (
405
403
  ),
406
404
  bp: 1,
407
405
  alwaysVar: 1,
408
- overwriteBaseVar: 1,
409
406
  ),
410
407
  'px': (
411
408
  prop: 'padding-inline',
@@ -423,7 +420,6 @@ $props: (
423
420
  '80': 'var(--s80)',
424
421
  ),
425
422
  bp: 1,
426
- alwaysVar: 1,
427
423
  ),
428
424
  'py': (
429
425
  prop: 'padding-block',
@@ -441,7 +437,6 @@ $props: (
441
437
  '80': 'var(--s80)',
442
438
  ),
443
439
  bp: 1,
444
- alwaysVar: 1,
445
440
  ),
446
441
  'px-s': (
447
442
  prop: 'padding-inline-start',
@@ -493,7 +488,6 @@ $props: (
493
488
  ),
494
489
  bp: 1,
495
490
  alwaysVar: 1,
496
- overwriteBaseVar: 1,
497
491
  ),
498
492
  'mx': (
499
493
  prop: 'margin-inline',
@@ -512,7 +506,6 @@ $props: (
512
506
  'auto': 'auto',
513
507
  ),
514
508
  bp: 1,
515
- alwaysVar: 1,
516
509
  ),
517
510
  'my': (
518
511
  prop: 'margin-block',
@@ -531,7 +524,6 @@ $props: (
531
524
  'auto': 'auto',
532
525
  ),
533
526
  bp: 1,
534
- alwaysVar: 1,
535
527
  ),
536
528
  'mx-s': (
537
529
  prop: 'margin-inline-start',
@@ -609,8 +601,6 @@ $props: (
609
601
  ),
610
602
  ),
611
603
  bp: 1,
612
- alwaysVar: 1,
613
- overwriteBaseVar: 1,
614
604
  ),
615
605
  'cg': (
616
606
  prop: 'column-gap',
@@ -4,7 +4,7 @@
4
4
  @use 'sass:meta';
5
5
 
6
6
  // レイヤー順序を明示的に宣言(詳細度: 上ほど弱い)
7
- @layer lism-base, lism-primitive, lism-component, lism-custom, lism-utility;
7
+ @layer lism-base, lism-trait, lism-primitive, lism-component, lism-custom, lism-utility;
8
8
 
9
9
  @layer lism-base {
10
10
  // resetは中でも layer定義済み。 lism-base.reset となる
@@ -13,10 +13,14 @@
13
13
  @include meta.load-css('base');
14
14
  }
15
15
 
16
+ // ユーザーが明示的に宣言する trait クラス(is--* / has--*)用レイヤー。
17
+ // primitive より弱い位置に配置し、is--boxLink の display: block 等の
18
+ // 初期化的な宣言がレイアウトプリミティブ(l--stack の display: flex 等)に負けるようにする。
19
+ @layer lism-trait {
20
+ @include meta.load-css('trait');
21
+ }
22
+
16
23
  @layer lism-primitive {
17
- @layer trait {
18
- @include meta.load-css('primitives/trait');
19
- }
20
24
  @layer layout {
21
25
  @include meta.load-css('primitives/layout');
22
26
  }
@@ -95,9 +95,9 @@ hr {
95
95
  /* --------------------------------------------------
96
96
  list
97
97
  -------------------------------------------------- */
98
- // classを持たない、もしくは Property Classしかない(≒ Property Class で始まる) リスト要素はブラウザ標準のスタイルを復活させる。
99
- :is(ul, ol):where(:not([class])),
100
- :is(ul, ol):where([class^='-']) {
98
+ // classを持たないリスト要素はブラウザ標準のスタイルを復活させる。
99
+ // Property Class だけの ul/ol など、明示的に戻したい場合は `.set--revert` を付与する(base/set/_revert.scss)。
100
+ :is(ul, ol):where(:not([class])) {
101
101
  list-style: revert;
102
102
  padding-inline-start: var(--list-px-s, var(--s30));
103
103
  }
@@ -1,3 +1,3 @@
1
- .set--innerRs {
1
+ .set--var\:bdrsInner {
2
2
  --bdrs--inner: calc(var(--bdrs, 0px) - var(--p, 0px));
3
3
  }
@@ -1,16 +1,16 @@
1
1
  @media (any-hover: hover) {
2
- .set--hov:hover {
2
+ .set--var\:hov:hover {
3
3
  --_notHov: ;
4
4
  }
5
- .set--hov:not(:is(:hover, :focus-within)) {
5
+ .set--var\:hov:not(:is(:hover, :focus-within)) {
6
6
  --_isHov: ;
7
7
  }
8
8
  }
9
9
  @media (any-hover: none) {
10
- .set--hov {
10
+ .set--var\:hov {
11
11
  --_isHov: ;
12
12
  }
13
13
  }
14
- .set--hov:is(:focus-visible, :focus-within) {
14
+ .set--var\:hov:is(:focus-visible, :focus-within) {
15
15
  --_notHov: ;
16
16
  }
@@ -0,0 +1,6 @@
1
+ // HTML 要素の基礎スタイリング ― ブラウザ標準の見た目を復活させる汎用クラス
2
+ // set--revert 単体では何も適用されず、HTML要素と組み合わせて使う想定。現状は ul / ol のみ対象だが、ユーザーが a / button など他要素に対しても自由に使える。
3
+ :is(ul, ol).set--revert {
4
+ list-style: revert;
5
+ padding-inline-start: var(--list-px-s, var(--s30));
6
+ }
@@ -1,7 +1,5 @@
1
1
  // @forward './bp'; // Note: set--bp は無効化中。ファイルは参考用に残す
2
2
  @forward './hov';
3
- @forward './transition';
4
- @forward './mask';
5
- @forward './innerRs';
3
+ @forward './bdrsInner';
6
4
  @forward './plain';
7
- @forward './gutter';
5
+ @forward './revert';