lism-css 0.18.0 → 0.21.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 (43) hide show
  1. package/config/defaults/props.ts +41 -40
  2. package/config/defaults/tokens.ts +1 -1
  3. package/config/defaults/traits.ts +1 -7
  4. package/dist/components/state/Wrapper/Wrapper.d.ts +2 -4
  5. package/dist/components/state/Wrapper/index.js +5 -5
  6. package/dist/config/default-config.d.ts +47 -45
  7. package/dist/config/defaults/props.d.ts +45 -37
  8. package/dist/config/defaults/props.js +42 -41
  9. package/dist/config/defaults/tokens.d.ts +1 -1
  10. package/dist/config/defaults/tokens.js +1 -1
  11. package/dist/config/defaults/traits.d.ts +1 -7
  12. package/dist/config/defaults/traits.js +1 -7
  13. package/dist/config/index.d.ts +95 -91
  14. package/dist/css/base/set.css +1 -1
  15. package/dist/css/base.css +1 -1
  16. package/dist/css/main.css +1 -1
  17. package/dist/css/main_no_layer.css +1 -1
  18. package/dist/css/primitives/layout.css +1 -1
  19. package/dist/css/props.css +1 -1
  20. package/dist/css/trait.css +1 -1
  21. package/dist/lib/getLismProps.d.ts +2 -9
  22. package/dist/lib/getLismProps.js +98 -95
  23. package/dist/lib/types/PropValueTypes.d.ts +14 -10
  24. package/dist/lib/types/TraitProps.d.ts +10 -11
  25. package/dist/lib/types/allowedTags.d.ts +1 -1
  26. package/dist/lib/warnUnsupportedBp.d.ts +10 -0
  27. package/dist/lib/warnUnsupportedBp.js +20 -0
  28. package/package.json +1 -1
  29. package/packages/astro/state/Wrapper/Wrapper.astro +2 -8
  30. package/src/scss/_prop-config.scss +30 -66
  31. package/src/scss/base/_html.scss +7 -2
  32. package/src/scss/base/set/_bdrsInner.scss +1 -1
  33. package/src/scss/base/set/_bleed.scss +3 -0
  34. package/src/scss/base/set/_hov.scss +4 -4
  35. package/src/scss/base/set/_revert.scss +1 -1
  36. package/src/scss/base/set/index.scss +1 -0
  37. package/src/scss/base/tokens/_shadow.scss +2 -2
  38. package/src/scss/base/tokens/_space.scss +3 -3
  39. package/src/scss/base/tokens/_tokens.scss +15 -1
  40. package/src/scss/primitives/layout/_flow.scss +0 -4
  41. package/src/scss/props/_border.scss +4 -4
  42. package/src/scss/props/_hover.scss +4 -7
  43. package/src/scss/trait/is/_wrapper.scss +1 -8
@@ -1,21 +1,22 @@
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
- import x from "./isTokenValue.js";
6
- import $ from "./getUtilKey.js";
7
- import d from "./getMaybeCssVar.js";
8
- import w from "./getBpData.js";
9
- import A from "./helper/atts.js";
10
- import _ from "./helper/isEmptyObj.js";
1
+ import { TRAITS as P, PROPS as d } from "../config/index.js";
2
+ import j from "./getLayoutProps.js";
3
+ import k from "./getAtomicProps.js";
4
+ import E from "./isPresetValue.js";
5
+ import w from "./isTokenValue.js";
6
+ import g from "./getUtilKey.js";
7
+ import C from "./getMaybeCssVar.js";
8
+ import x from "./getBpData.js";
9
+ import z from "./warnUnsupportedBp.js";
10
+ import _ from "./helper/atts.js";
11
+ import A from "./helper/isEmptyObj.js";
11
12
  import S from "./helper/filterEmptyObj.js";
12
13
  import b from "./helper/mergeSet.js";
13
- import z from "./helper/splitWithComma.js";
14
- const L = (n) => {
15
- const s = c[n];
16
- return s && s?.token || "";
14
+ import U from "./helper/splitWithComma.js";
15
+ const W = (n) => {
16
+ const t = d[n];
17
+ return t && t?.token || "";
17
18
  };
18
- class T {
19
+ class L {
19
20
  // 最終出力 className
20
21
  className = "";
21
22
  primitiveClass = [];
@@ -26,28 +27,25 @@ class T {
26
27
  styles = {};
27
28
  attrs = {};
28
29
  _propConfig;
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);
30
+ constructor(t) {
31
+ const { forwardedRef: s, class: i, className: e, primitiveClass: o, style: r = {}, _propConfig: u = {}, ...h } = t;
32
+ this.styles = { ...r }, this._propConfig = { ...u }, o && o.length && (this.primitiveClass = [...o]), A(h) || (this.attrs = { ...h }, this.analyzeProps()), s && (this.attrs.ref = s), this.className = this.buildClassName(e, i);
32
33
  }
33
34
  // 最終クラス文字列の組み立て(出力順の唯一の確定地点)
34
35
  // 出力順: [className&class] [primitiveClass] [setClasses] [traitClasses] [uClasses] [propClasses]
35
36
  // className と class が両方来た場合は両方マージする(atts 内で重複は除去される)。
36
- buildClassName(s, t) {
37
- return A(s, t, this.primitiveClass, this.setClasses, this.traitClasses, this.uClasses, this.propClasses);
38
- }
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)));
37
+ buildClassName(t, s) {
38
+ return _(t, s, this.primitiveClass, this.setClasses, this.traitClasses, this.uClasses, this.propClasses);
42
39
  }
43
40
  // prop解析
44
41
  analyzeProps() {
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)) {
42
+ this.normalizeIsWrapper();
43
+ const t = this.extractProp("set"), s = this.extractProp("util");
44
+ b(void 0, t).forEach((i) => this.addSet(i)), b(void 0, s).forEach((i) => this.addUtil(`u--${i}`)), Object.keys(this.attrs).forEach((i) => {
45
+ if (Object.hasOwn(P, i)) {
46
+ const e = this.extractProp(i), o = P[i];
47
+ e && this.traitClasses.push(o);
48
+ } else if (Object.hasOwn(d, i)) {
51
49
  const e = this.attrs[i];
52
50
  delete this.attrs[i], this.analyzeLismProp(i, e);
53
51
  } else if (i === "hov") {
@@ -59,91 +57,96 @@ class T {
59
57
  }
60
58
  });
61
59
  }
60
+ // isWrapper="s" 形式のサイズ指定は contentSize Prop に寄せる。
61
+ normalizeIsWrapper() {
62
+ const t = this.attrs.isWrapper;
63
+ t == null || t === !1 || t === "" || t !== !0 && (this.attrs.contentSize === void 0 && (this.attrs.contentSize = t), this.attrs.isWrapper = !0);
64
+ }
62
65
  // Lism Prop 解析
63
- analyzeLismProp(s, t) {
64
- if (t == null) return;
65
- let i = c[s] || null;
66
+ analyzeLismProp(t, s) {
67
+ if (s == null) return;
68
+ let i = d[t] || null;
66
69
  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);
70
+ this._propConfig?.[t] && (i = Object.assign({}, i, this._propConfig[t]));
71
+ const { base: e, ...o } = x(s);
72
+ process.env.NODE_ENV !== "production" && !i.bp && Object.keys(o).length > 0 && z(t), this.setAttrs(t, e, i), Object.keys(o).forEach((r) => {
73
+ i && this.setAttrs(t, o[r], i, r);
71
74
  });
72
75
  }
73
- addSet(s) {
74
- this.setClasses.push(`set--${s}`);
76
+ addSet(t) {
77
+ this.setClasses.push(`set--${t}`);
75
78
  }
76
- addUtil(s) {
77
- this.uClasses.push(s);
79
+ addUtil(t) {
80
+ this.uClasses.push(t);
78
81
  }
79
- addUtils(s) {
80
- this.uClasses.push(...s);
82
+ addUtils(t) {
83
+ this.uClasses.push(...t);
81
84
  }
82
- addProp(s) {
83
- this.propClasses.push(s);
85
+ addProp(t) {
86
+ this.propClasses.push(t);
84
87
  }
85
- addStyle(s, t) {
86
- this.styles[s] = t;
88
+ addStyle(t, s) {
89
+ this.styles[t] = s;
87
90
  }
88
- addStyles(s) {
89
- this.styles = { ...this.styles, ...s };
91
+ addStyles(t) {
92
+ this.styles = { ...this.styles, ...t };
90
93
  }
91
- addAttrs(s) {
92
- this.addStyles(s.styles || {}), this.addUtils(s.utils || []);
94
+ addAttrs(t) {
95
+ this.addStyles(t.styles || {}), this.addUtils(t.utils || []);
93
96
  }
94
- extractProp(s) {
95
- const t = this.attrs[s];
96
- return this.attrs[s] === void 0 ? null : (delete this.attrs[s], t);
97
+ extractProp(t) {
98
+ const s = this.attrs[t];
99
+ return this.attrs[t] === void 0 ? null : (delete this.attrs[t], s);
97
100
  }
98
- extractProps(s) {
99
- const t = {};
100
- return s.forEach((i) => {
101
- this.attrs[i] !== void 0 && (t[i] = this.attrs[i], delete this.attrs[i]);
102
- }), t;
101
+ extractProps(t) {
102
+ const s = {};
103
+ return t.forEach((i) => {
104
+ this.attrs[i] !== void 0 && (s[i] = this.attrs[i], delete this.attrs[i]);
105
+ }), s;
103
106
  }
104
107
  // propertyクラスを追加するか、styleにセットするかの分岐処理 @base
105
108
  // 値が null, undefined, '', false の時はスキップ
106
- setAttrs(s, t, i = {}, e = "") {
107
- if (t == null || t === "" || t === !1) return;
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(":", "")}`);
109
+ setAttrs(t, s, i = {}, e = "") {
110
+ if (s == null || s === "" || s === !1) return;
111
+ let o = `--${t}`, r = `-${String(i.utilKey || t)}`;
112
+ if (e && (o = `--${t}_${e}`, r += `_${e}`), typeof s == "string" && s.startsWith(":")) {
113
+ this.addProp(`${r}:${s.replace(":", "")}`);
111
114
  return;
112
115
  }
113
116
  if (!e) {
114
- const { presets: m, tokenClass: j, utils: p, shorthands: P } = i;
115
- if (m && g(m, t)) {
116
- const h = typeof t == "string" || typeof t == "number" ? String(t) : "";
117
- h && this.addProp(`${r}:${h}`);
117
+ const { presets: p, tokenClass: V, utils: y, shorthands: m } = i;
118
+ if (p && E(p, s)) {
119
+ const f = typeof s == "string" || typeof s == "number" ? String(s) : "";
120
+ f && this.addProp(`${r}:${f}`);
118
121
  return;
119
122
  }
120
- if (j && i.token && x(i.token, t)) {
121
- const h = typeof t == "string" || typeof t == "number" ? String(t) : "";
122
- h && this.addProp(`${r}:${h}`);
123
+ if (V && i.token && w(i.token, s)) {
124
+ const f = typeof s == "string" || typeof s == "number" ? String(s) : "";
125
+ f && this.addProp(`${r}:${f}`);
123
126
  return;
124
127
  }
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}`);
128
+ let l = "";
129
+ if (y && typeof s == "string" && (l = g(y, s)), !l && m && typeof s == "string" && (l = g(m, s, !0)), l) {
130
+ this.addProp(`${r}:${l}`);
128
131
  return;
129
132
  }
130
133
  }
131
- if (t === !0) {
134
+ if (s === !0) {
132
135
  this.addProp(r);
133
136
  return;
134
137
  }
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);
138
+ const { prop: u, isVar: h, alwaysVar: $, token: c, bp: O } = i;
139
+ let a;
140
+ if (c && (typeof s == "string" || typeof s == "number") ? a = C(s, c) : typeof s == "string" || typeof s == "number" ? a = s : a = JSON.stringify(s), !e) {
141
+ if (h) {
142
+ this.addStyle(`--${t}`, a);
140
143
  return;
141
- } else if (!k && !O) {
142
- this.addStyle(a, l);
144
+ } else if (!O && !$) {
145
+ this.addStyle(u, a);
143
146
  return;
144
147
  }
145
148
  }
146
- this.addProp(r), this.addStyle(o, l);
149
+ this.addProp(r), this.addStyle(o, a);
147
150
  }
148
151
  // setPassProps(passVars) {
149
152
  // let dataList = [];
@@ -158,26 +161,26 @@ class T {
158
161
  // this.addStyle(`--pass_${propName}`, value);
159
162
  // });
160
163
  // }
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];
164
+ setHovProps(t) {
165
+ t && (t === !0 ? this.addProp("-hov") : typeof t == "string" ? U(t).forEach((s) => {
166
+ this.addProp(`-hov:${s}`);
167
+ }) : typeof t == "object" && Object.keys(t).forEach((s) => {
168
+ const i = t[s];
166
169
  if (!(i == null || i === "" || i === !1)) {
167
170
  if (i === !0)
168
- this.addProp(`-hov:${t}`);
171
+ this.addProp(`-hov:${s}`);
169
172
  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
+ const e = C(i, W(s));
174
+ this.addProp(`-hov:-${s}`), this.addStyle(`--hov-${s}`, e);
172
175
  }
173
176
  }
174
177
  }));
175
178
  }
176
179
  }
177
- function Y(n) {
180
+ function D(n) {
178
181
  if (Object.keys(n).length === 0)
179
182
  return {};
180
- const { atomic: s, layout: t, ...i } = n, e = E(s, i), o = V(t, e), r = new T(o);
183
+ const { atomic: t, layout: s, ...i } = n, e = k(t, i), o = j(s, e), r = new L(o);
181
184
  return {
182
185
  ...S({
183
186
  className: r.className,
@@ -188,6 +191,6 @@ function Y(n) {
188
191
  };
189
192
  }
190
193
  export {
191
- T as LismPropsData,
192
- Y as default
194
+ L as LismPropsData,
195
+ D as default
193
196
  };
@@ -1,4 +1,4 @@
1
- import { TOKENS, PROPS } from '../../../config/index';
1
+ import { TOKENS, PROPS, BREAK_POINTS } from '../../../config/index';
2
2
  import { WithArbitraryString, ArrayElement, ExtractArrayValues, ExtractObjectKeys, ExtractPropertyValue } from './utils';
3
3
  import { MakeResponsive } from './ResponsiveProps';
4
4
  type PropsConfig = typeof PROPS;
@@ -33,43 +33,47 @@ type ExtractPropValues<T> = ExtractArrayValues<T, 'presets'> | ExtractObjectKeys
33
33
  * - ない場合: string | number(フォールバック)
34
34
  */
35
35
  type PropValueType<T> = ExtractPropValues<T> extends never ? string | number | boolean : WithArbitraryString<ExtractPropValues<T>> | number | boolean | null;
36
+ /** bp で指定できるブレークポイント名('lg' など個別指定用) */
37
+ type BreakpointName = (typeof BREAK_POINTS)[number];
36
38
  /**
37
- * bp プロパティが 1 に設定されているかを判定
38
- * never チェックを先に行うことで、bp プロパティが存在しない場合を正しく判定
39
+ * bp プロパティでレスポンシブ(配列・オブジェクト形式)が有効かを判定
40
+ * - bp 未設定 / bp: 0 → false
41
+ * - bp: 1 → 全 BP からユーティリティクラス生成
42
+ * - bp: 'lg' 等 → 指定 BP 以降のみ(配列形式の型は bp: 1 と同様に許可)
39
43
  */
40
- type HasBreakpointSupport<T> = [ExtractPropertyValue<T, 'bp'>] extends [never] ? false : ExtractPropertyValue<T, 'bp'> extends 1 ? true : false;
44
+ type HasBreakpointSupport<T> = [ExtractPropertyValue<T, 'bp'>] extends [never] ? false : ExtractPropertyValue<T, 'bp'> extends 0 ? false : ExtractPropertyValue<T, 'bp'> extends 1 | BreakpointName ? true : false;
41
45
  type AllPropKeys = keyof PropsConfig;
42
46
  /**
43
- * bp: 1 が設定されているプロパティのキーを抽出
47
+ * bp が有効(1 またはブレークポイント名)なプロパティのキーを抽出
44
48
  */
45
49
  type PropsWithBreakpoint = {
46
50
  [K in AllPropKeys]: HasBreakpointSupport<PropsConfig[K]> extends true ? K : never;
47
51
  }[AllPropKeys];
48
52
  /**
49
- * bp: 1 が設定されていないプロパティのキーを抽出
53
+ * bp が無効なプロパティのキーを抽出
50
54
  */
51
55
  type PropsWithoutBreakpoint = Exclude<AllPropKeys, PropsWithBreakpoint>;
52
56
  /**
53
- * bp: 1 が設定されているプロパティの型(レスポンシブ対応あり)
57
+ * bp が有効なプロパティの型(レスポンシブ対応あり)
54
58
  */
55
59
  export type ResponsivePropValueTypes = {
56
60
  [K in PropsWithBreakpoint]?: PropValueType<PropsConfig[K]>;
57
61
  };
58
62
  /**
59
- * bp: 1 が設定されていないプロパティの型(レスポンシブ対応なし)
63
+ * bp が無効なプロパティの型(レスポンシブ対応なし)
60
64
  */
61
65
  export type NonResponsivePropValueTypes = {
62
66
  [K in PropsWithoutBreakpoint]?: PropValueType<PropsConfig[K]>;
63
67
  };
64
68
  /**
65
69
  * PROPS 設定から生成される Props 型(レスポンシブ対応含む)
66
- * - bp: 1 のプロパティ: レスポンシブ対応(配列・オブジェクト形式可)
70
+ * - bp が有効なプロパティ: レスポンシブ対応(配列・オブジェクト形式可)
67
71
  * - bp なしのプロパティ: 単一値のみ
68
72
  * - presets/utils/token なしのプロパティ: string | number(フォールバック)
69
73
  *
70
74
  * @example
71
75
  * ```ts
72
- * // bp: 1 のプロパティ(fz など)
76
+ * // bp が有効なプロパティ(fz など)
73
77
  * fz?: 'root' | 'base' | ... | ['root', 'base'] | { base: 'root', md: 'base' }
74
78
  *
75
79
  * // bp なしのプロパティ(fw など)
@@ -1,29 +1,28 @@
1
1
  import { TRAITS } from '../../../config/index';
2
- import { WithArbitraryString, ArrayElement } from './utils';
2
+ import { PropValueTypes } from './PropValueTypes';
3
+ import { WithArbitraryString } from './utils';
3
4
  /**
4
5
  * config/index.ts から TRAITS の型を取得
5
6
  * objDeepMerge の DeepMergeResult 型により literal types が保持される
6
7
  */
7
8
  type TraitsConfig = typeof TRAITS;
8
- /** preset を持つ Trait の値の型を抽出 */
9
- type PresetElement<T> = T extends {
10
- preset: readonly unknown[];
11
- } ? ArrayElement<T['preset']> : never;
12
9
  /**
13
10
  * Trait 設定から Props の値の型を抽出するユーティリティ型
14
11
  */
15
- type ExtractTraitValue<T> = T extends string ? boolean : T extends {
16
- preset: readonly unknown[];
17
- } ? WithArbitraryString<PresetElement<T>> | boolean : never;
12
+ type ExtractTraitValue<T> = T extends string ? boolean : never;
13
+ type GeneratedTraitProps = {
14
+ [K in keyof TraitsConfig]?: ExtractTraitValue<TraitsConfig[K]>;
15
+ };
16
+ type ContentSizeStringValue = Extract<NonNullable<PropValueTypes['contentSize']>, string>;
18
17
  /**
19
18
  * config/index.ts の TRAITS から自動生成される Trait Props の型
20
19
  * config/index.ts の TRAITS に新しいトレイトを追加すると自動的に反映される
21
20
  */
22
- export type TraitProps = {
23
- [K in keyof TraitsConfig]?: ExtractTraitValue<TraitsConfig[K]>;
21
+ export type TraitProps = Omit<GeneratedTraitProps, 'isWrapper'> & {
22
+ isWrapper?: boolean | ContentSizeStringValue;
24
23
  };
25
24
  /** set prop で使われるプリセット値(エディタ補完用) */
26
- type SetPreset = 'plain' | 'revert' | 'var:hov' | 'var:bxsh' | 'var:bdrsInner' | 'var:s';
25
+ type SetPreset = 'plain' | 'revert' | 'hov' | 'bxsh' | 'bdrsInner' | 'bleed' | 's';
27
26
  /**
28
27
  * set prop の値の型。プリセット値がサジェストされつつ、任意の文字列も受け付ける。
29
28
  *
@@ -1,6 +1,6 @@
1
1
  export type GroupAllowedTag = 'div' | 'section' | 'article' | 'figure' | 'nav' | 'aside' | 'header' | 'footer' | 'main' | 'fieldset' | 'hgroup';
2
2
  export type TextAllowedTag = 'p' | 'div' | 'blockquote' | 'address' | 'figcaption' | 'pre';
3
- export type InlineAllowedTag = 'span' | 'em' | 'strong' | 'small' | 'code' | 'time' | 'i' | 'b' | 'mark' | 'abbr' | 'cite' | 'kbd';
3
+ export type InlineAllowedTag = 'span' | 'em' | 'strong' | 'small' | 'code' | 'time' | 'i' | 'b' | 'mark' | 'abbr' | 'cite' | 'kbd' | 'label';
4
4
  export type ListAllowedTag = 'ul' | 'ol' | 'dl';
5
5
  export type ListItemAllowedTag = 'li' | 'dt' | 'dd';
6
6
  export type MediaAllowedTag = 'img' | 'video' | 'iframe' | 'picture';
@@ -0,0 +1,10 @@
1
+ /**
2
+ * bp デフォルト非対応のプロパティに BP 指定(配列 / { sm, md, ... })が渡された時に、
3
+ * 開発環境でのみ警告を出す。呼び出し側で dev 判定・BP 指定有無の判定を済ませてから呼ぶ。
4
+ *
5
+ * 判定基準は JS ランタイムの propConfig.bp(config/defaults/props.ts)。
6
+ * SCSS の $props 上書きは CSS 出力だけを変え JS には届かないため、SCSS で BP を
7
+ * 再有効化済みのケースは誤検知になる。そのため抑制フラグは設けず、警告文に
8
+ * 「SCSS でカスタマイズ済みなら無視して OK」の注記を添える方針とする。
9
+ */
10
+ export default function warnUnsupportedBp(propName: string): void;
@@ -0,0 +1,20 @@
1
+ const o = {
2
+ pl: "ps",
3
+ pr: "pe",
4
+ pt: "pbs",
5
+ pb: "pbe",
6
+ ml: "ms",
7
+ mr: "me",
8
+ mt: "mbs",
9
+ mb: "mbe"
10
+ }, n = /* @__PURE__ */ new Set();
11
+ function i(s) {
12
+ if (n.has(s)) return;
13
+ n.add(s);
14
+ const e = o[s], t = [`[lism-css] \`${s}\` does not support breakpoint values by default.`];
15
+ e && t.push(` - Use the logical property \`${e}\` instead`), t.push(` - ${e ? "Or e" : "E"}nable it via SCSS $props: \`'${s}': ( bp: 1 )\``), t.push(" Docs: https://lism-css.com/en/docs/customize/"), t.push(" * If you've already customized this via SCSS, you can ignore this warning."), console.warn(t.join(`
16
+ `));
17
+ }
18
+ export {
19
+ i as default
20
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lism-css",
3
- "version": "0.18.0",
3
+ "version": "0.21.0",
4
4
  "description": "Lism CSS is a layout-first CSS framework for websites.",
5
5
  "author": {
6
6
  "name": "ddryo",
@@ -1,15 +1,9 @@
1
1
  ---
2
2
  import type { HTMLTag, Polymorphic } from 'astro/types';
3
3
  import type { AstroLismBaseProps } from '../../types';
4
- import type { LismProps } from 'lism-css/lib/getLismProps';
5
4
  import { Lism } from '../../Lism';
6
5
 
7
- type Props<Tag extends HTMLTag = 'div'> = Polymorphic<{ as: Tag }> &
8
- AstroLismBaseProps & {
9
- contentSize?: LismProps['isWrapper'];
10
- };
11
-
12
- const { contentSize = true, ...props } = Astro.props;
6
+ type Props<Tag extends HTMLTag = 'div'> = Polymorphic<{ as: Tag }> & AstroLismBaseProps;
13
7
  ---
14
8
 
15
- <Lism isWrapper={contentSize} {...props}><slot /></Lism>
9
+ <Lism isWrapper {...Astro.props}><slot /></Lism>