lism-css 0.6.0 → 0.7.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,40 +1,41 @@
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";
1
+ var k = Object.defineProperty;
2
+ var E = (r, t, s) => t in r ? k(r, t, { enumerable: !0, configurable: !0, writable: !0, value: s }) : r[t] = s;
3
+ var f = (r, t, s) => E(r, typeof t != "symbol" ? t + "" : t, s);
4
+ import { STATES as U, PROPS as S } from "../config/index.js";
5
+ import A from "./getLayoutProps.js";
5
6
  import g from "./isPresetValue.js";
6
7
  import V from "./isTokenValue.js";
7
8
  import O from "./getUtilKey.js";
8
- import S from "./getMaybeCssVar.js";
9
+ import $ from "./getMaybeCssVar.js";
9
10
  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];
11
+ import x from "./helper/atts.js";
12
+ import z from "./helper/isEmptyObj.js";
13
+ import b from "./helper/filterEmptyObj.js";
14
+ import j from "./helper/splitWithComma.js";
15
+ const w = (r) => {
16
+ const t = S[r];
16
17
  return t && (t == null ? void 0 : t.token) || "";
17
18
  };
18
- class w {
19
+ class L {
19
20
  constructor(t) {
20
21
  // propList = {};
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(" ");
22
+ f(this, "className", "");
23
+ f(this, "uClasses", []);
24
+ f(this, "lismState", []);
25
+ f(this, "styles", {});
26
+ f(this, "attrs", {});
27
+ const { forwardedRef: s, class: i, className: l, lismClass: a, variant: e, style: h = {}, _propConfig: n = {}, ...c } = t;
28
+ this.styles = { ...h }, this._propConfig = { ...n };
29
+ let o = a || "";
30
+ if (e && a) {
31
+ const y = a.split(" "), d = y[0], m = `${d}--${e}`;
32
+ o = [d, m, ...y.slice(1)].join(" ");
32
33
  }
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);
34
+ z(c) || (this.attrs = { ...c }, this.analyzeProps()), s && (this.attrs.ref = s), this.className = x(l || i, o, this.lismState, this.uClasses);
34
35
  }
35
36
  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)));
37
+ const { className: i, preset: l, presetClass: a, customVar: e, tokenKey: h, setStyles: n } = t;
38
+ 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, h)) : n && this.addStyles(n(s)));
38
39
  }
39
40
  // prop解析
40
41
  analyzeProps() {
@@ -42,7 +43,7 @@ class w {
42
43
  if (Object.hasOwn(U, t)) {
43
44
  const s = this.extractProp(t), i = U[t];
44
45
  typeof i == "string" ? s && this.lismState.push(i) : this.analyzeState(i, s);
45
- } else if (Object.hasOwn(P, t)) {
46
+ } else if (Object.hasOwn(S, t)) {
46
47
  const s = this.attrs[t];
47
48
  delete this.attrs[t], this.analyzeLismProp(t, s);
48
49
  } else if (t === "hov") {
@@ -57,7 +58,7 @@ class w {
57
58
  // Lism Prop 解析
58
59
  analyzeLismProp(t, s) {
59
60
  if (s == null) return;
60
- let i = P[t] || null;
61
+ let i = S[t] || null;
61
62
  if (i === null) return;
62
63
  this._propConfig[t] && (i = Object.assign({}, i, this._propConfig[t]));
63
64
  const { base: l, ...a } = _(s);
@@ -103,18 +104,18 @@ class w {
103
104
  return;
104
105
  }
105
106
  if (!l) {
106
- const { presets: u, tokenClass: y, utils: $, shorthands: C } = i;
107
- if (u && g(u, s)) {
107
+ const { presets: d, tokenClass: m, utils: P, shorthands: C } = i;
108
+ if (d && g(d, s)) {
108
109
  this.addUtil(`${e}:${s}`);
109
110
  return;
110
111
  }
111
- if (y && V(i.token, s)) {
112
+ if (m && V(i.token, s)) {
112
113
  this.addUtil(`${e}:${s}`);
113
114
  return;
114
115
  }
115
- let c = "";
116
- if ($ && (c = O($, s)), !c && C && (c = O(C, s, !0)), c) {
117
- this.addUtil(`${e}:${c}`);
116
+ let u = "";
117
+ if (P && (u = O(P, s)), !u && C && (u = O(C, s, !0)), u) {
118
+ this.addUtil(`${e}:${u}`);
118
119
  return;
119
120
  }
120
121
  }
@@ -122,12 +123,12 @@ class w {
122
123
  this.addUtil(e);
123
124
  return;
124
125
  }
125
- let { prop: h, isVar: f, alwaysVar: m, token: o, bp: n } = i;
126
- if (o && (s = S(s, o)), !l) {
127
- if (f) {
126
+ let { prop: h, isVar: n, alwaysVar: c, token: o, bp: y } = i;
127
+ if (o && (s = $(s, o)), !l) {
128
+ if (n) {
128
129
  this.addStyle(`--${t}`, s);
129
130
  return;
130
- } else if (!n && !m) {
131
+ } else if (!y && !c) {
131
132
  this.addStyle(h, s);
132
133
  return;
133
134
  }
@@ -148,28 +149,28 @@ class w {
148
149
  // });
149
150
  // }
150
151
  setHovProps(t) {
151
- t && (t === "-" || t === !0 ? this.addUtil("-hov") : typeof t == "string" ? k(t).forEach((s) => {
152
+ t && (t === "-" || t === !0 ? this.addUtil("-hov") : typeof t == "string" ? j(t).forEach((s) => {
152
153
  this.addUtil(`-hov:${s}`);
153
154
  }) : typeof t == "object" && Object.keys(t).forEach((s) => {
154
155
  let i = t[s];
155
- i == null || i === "" || i === !1 || (i === "-" || i === !0 ? this.addUtil(`-hov:${s}`) : s === "class" ? k(i).forEach((l) => {
156
+ i == null || i === "" || i === !1 || (i === "-" || i === !0 ? this.addUtil(`-hov:${s}`) : s === "class" ? j(i).forEach((l) => {
156
157
  this.addUtil(`-hov:${l}`);
157
- }) : (i = S(i, z(s)), this.addUtil(`-hov:${s}`), this.addStyle(`--hov-${s}`, i)));
158
+ }) : (i = $(i, w(s)), this.addUtil(`-hov:${s}`), this.addStyle(`--hov-${s}`, i)));
158
159
  }));
159
160
  }
160
161
  }
161
- function J(r) {
162
+ function X(r) {
162
163
  if (r.length === 0)
163
164
  return {};
164
- const t = new w(r);
165
- return j({
166
- className: t.className,
167
- style: j(t.styles),
165
+ const { layout: t, ...s } = r, i = new L(A(t, s));
166
+ return b({
167
+ className: i.className,
168
+ style: b(i.styles),
168
169
  //filterEmptyObj(styles), // filterEmptyObj は最後にかける
169
- ...t.attrs
170
+ ...i.attrs
170
171
  // 処理されずに残っているprops
171
172
  });
172
173
  }
173
174
  export {
174
- J as default
175
+ X as default
175
176
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lism-css",
3
- "version": "0.6.0",
3
+ "version": "0.7.0",
4
4
  "description": "A layout-first CSS framework for websites.",
5
5
  "author": {
6
6
  "name": "ddryo",
@@ -1,15 +1,14 @@
1
1
  ---
2
2
  import type { LismProps } from '../../types';
3
3
  import getLismProps from '../../../dist/lib/getLismProps';
4
- import getLayoutProps from '../../../dist/components/getLayoutProps';
5
4
 
6
5
  // Propsの定義
7
6
  interface Props extends LismProps {}
8
7
 
9
- const { as, tag, layout, exProps, ...props } = Astro.props || {};
8
+ const { as, tag, exProps, ...props } = Astro.props || {};
10
9
  const JSX = as || tag || 'div';
11
10
  ---
12
11
 
13
- <JSX {...getLismProps(getLayoutProps(layout, props))} {...exProps}>
12
+ <JSX {...getLismProps(props)} {...exProps}>
14
13
  <slot />
15
14
  </JSX>
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  import type { LismProps } from '../../types';
3
- import { defaultProps } from '../../../dist/components/Modal/getProps';
3
+ import { getInnerProps } from '../../../dist/components/Modal/getProps';
4
4
  import { Lism } from '../Lism';
5
5
 
6
6
  // Propsの定義
@@ -8,6 +8,6 @@ interface Props extends LismProps {}
8
8
  const props = Astro.props || {};
9
9
  ---
10
10
 
11
- <Lism {...defaultProps.inner} {...props}>
11
+ <Lism {...getInnerProps(props)}>
12
12
  <slot />
13
13
  </Lism>
@@ -130,7 +130,7 @@ $bp_support_list: (); // list
130
130
  @if (meta.type-of($exValue) == map) {
131
131
  .-#{$key}\:#{$exKey} {
132
132
  @each $_p, $_v in $exValue {
133
- #{$_p}: #{$_v};
133
+ #{$_p}: #{$_v} #{get_important_str($important)};
134
134
  }
135
135
  }
136
136
  }
@@ -14,7 +14,7 @@ $maybe_important: '';
14
14
  // @return '';
15
15
  // }
16
16
 
17
- @mixin maybe_where($selectors, $mode) {
17
+ @mixin maybe_where($selectors, $mode: '') {
18
18
  // memo: セレクタリストを引数で受け取り、modeで出力方法を切り替える
19
19
  @if $layer_mode == 1 {
20
20
  @if $mode == '' {
@@ -25,7 +25,7 @@ $maybe_important: '';
25
25
  :is(#{$selectors}) {
26
26
  @content;
27
27
  }
28
- } @else if $mode == 'base' {
28
+ } @else if $mode == '@base' {
29
29
  @layer lism.base {
30
30
  #{$selectors} {
31
31
  @content;
@@ -1,4 +1,4 @@
1
- // 自動生成されたファイル. 生成日時: 2025-11-01T06:03:57.181Z
1
+ // 自動生成されたファイル. 生成日時: 2025-12-03T10:57:09.980Z
2
2
  $props: (
3
3
  'f': (
4
4
  prop: 'font',
@@ -661,9 +661,7 @@ $props: (
661
661
  ),
662
662
  exUtility: (
663
663
  'repeat': (
664
- '--cols': '1',
665
- '--rows': '1',
666
- 'grid-template': 'repeat(var(--rows), 1fr) / repeat(var(--cols), 1fr)',
664
+ 'grid-template': 'repeat(var(--rows,1), 1fr) / repeat(var(--cols,1), 1fr)',
667
665
  ),
668
666
  ),
669
667
  bp: 1,
@@ -4,15 +4,17 @@
4
4
  @use 'sass:meta';
5
5
 
6
6
  // 最初に順序定義
7
- @layer lism.reset, lism.base, lism.modules, lism.custom, lism.utility;
7
+ // @layer lism-reset, lism;
8
8
 
9
- @layer lism.reset {
10
- @include meta.load-css('reset');
11
- }
9
+ // resetは中で layer定義済み
10
+ @include meta.load-css('reset');
11
+
12
+ // baese
12
13
  @layer lism.base {
13
14
  @include meta.load-css('base');
14
15
  }
15
16
 
17
+ // modules
16
18
  @layer lism.modules {
17
19
  @layer state {
18
20
  @include meta.load-css('modules/state');
@@ -31,7 +31,7 @@ body {
31
31
  /* ----------------------------------------
32
32
  Heading
33
33
  ---------------------------------------- */
34
- @include mixin.maybe_where('h1, h2, h3, h4, h5, h6', '') {
34
+ @include mixin.maybe_where('h1, h2, h3, h4, h5, h6') {
35
35
  font-family: var(--heading-ff, inherit);
36
36
  font-weight: var(--heading-fw, bolder);
37
37
  font-size: var(--fz, revert);
@@ -64,7 +64,7 @@ h6 {
64
64
  /* ----------------------------------------
65
65
  list
66
66
  ---------------------------------------- */
67
- @include mixin.maybe_where('ul, ol', '') {
67
+ @include mixin.maybe_where('ul, ol') {
68
68
  list-style: none;
69
69
  padding: 0;
70
70
  padding-inline-start: var(--list-px-s, 0);
@@ -74,26 +74,31 @@ h6 {
74
74
  texts
75
75
  ---------------------------------------- */
76
76
  // link
77
- @include mixin.maybe_where('a', '') {
77
+ @include mixin.maybe_where('a') {
78
78
  color: var(--c--link);
79
79
  text-decoration: var(--link-td, underline);
80
80
  // text-underline-offset: var(--underline-offset, auto);
81
81
  // text-decoration-thickness: var(--underline-thickness, 1px);
82
82
  }
83
83
 
84
+ // フォーカス要素
85
+ @include mixin.maybe_where(':focus-visible') {
86
+ outline-offset: var(--focus-offset, 0px);
87
+ }
88
+
84
89
  /* ----------------------------------------
85
90
  table
86
91
  ---------------------------------------- */
87
- @include mixin.maybe_where('th', '') {
92
+ @include mixin.maybe_where('th') {
88
93
  color: var(--th--c, inherit);
89
94
  background-color: var(--th--bgc, transparent);
90
95
  }
91
- // @include mixin.maybe_where('td', '') {
96
+ // @include mixin.maybe_where('td') {
92
97
  // color: var(--td--c, inherit);
93
98
  // background-color: var(--td--bgc, transparent);
94
99
  // }
95
100
 
96
- @include mixin.maybe_where('td, th', '') {
101
+ @include mixin.maybe_where('td, th') {
97
102
  padding: var(--cell-p, 0.375em 0.5em);
98
103
  min-inline-size: var(--cell-minW, initial);
99
104
  }
@@ -101,18 +106,18 @@ h6 {
101
106
  /* ----------------------------------------
102
107
  others
103
108
  ---------------------------------------- */
104
- @include mixin.maybe_where('hr', '') {
109
+ @include mixin.maybe_where('hr') {
105
110
  border: none;
106
111
  border-block-start: 1px solid;
107
112
  block-size: 0;
108
113
  }
109
114
 
110
- @include mixin.maybe_where('blockquote', '') {
115
+ @include mixin.maybe_where('blockquote') {
111
116
  border-inline-start: solid 3px currentColor;
112
117
  padding: var(--s20) var(--s30);
113
118
  }
114
119
 
115
- @include mixin.maybe_where('pre', '') {
120
+ @include mixin.maybe_where('pre') {
116
121
  // 横にスクロールできるように(overflow-inline: auto; ← まだ使えない)
117
122
  overflow-x: auto; // 縦書きモードにしてもこれでいけた
118
123
  }
@@ -127,11 +132,16 @@ h6 {
127
132
  /* ----------------------------------------
128
133
  dialog
129
134
  ---------------------------------------- */
135
+ /* ダイアログ展開時のガタツキを防ぐ */
136
+ // html:has(:modal[open]) {
137
+ // scrollbar-gutter: stable;
138
+ // }
139
+
130
140
  // showModal()にのみ適用するため、 dialog ではなく :modal を使用
131
141
  @include mixin.switch_selector('body:has(:modal[open])', 'body:where(:has(:modal[open]))') {
132
142
  overflow: hidden;
133
143
  }
134
144
 
135
- @include mixin.switch_selector('dialog:not([open])', 'dialog:where(:not([open]))') {
136
- pointer-events: none;
137
- }
145
+ // @include mixin.switch_selector('dialog:not([open])', 'dialog:where(:not([open]))') {
146
+ // pointer-events: none;
147
+ // }
@@ -38,7 +38,7 @@
38
38
  --sz--s: 640px; // 80*8
39
39
  --sz--xs: 480px; // 80*6
40
40
 
41
- --sz--min: 16rem; // 最低限維持したいコンテンツサイズの標準値。 withSide等 で使用
41
+ --sz--min: 18rem; // 最低限維持したいコンテンツサイズの標準値。 withSide等 で使用
42
42
 
43
43
  // .l--flow の余白
44
44
  --flow--base: var(--s40);
@@ -50,12 +50,8 @@
50
50
  タイポグラフィ
51
51
  ------------------------------------------------------------ */
52
52
 
53
- // --ff--sans: 'Hiragino Kaku Gothic ProN', 'Hiragino Sans', 'Meiryo', sans-serif;
54
- // --ff--serif: serif;
55
-
56
- --ff--base: -apple-system, 'BlinkMacSystemFont', 'Hiragino Kaku Gothic ProN', 'Hiragino Sans', Meiryo, sans-serif, 'Segoe UI Emoji';
57
-
58
- // Optima, Georgia, Garamond, Baskerville;
53
+ // system-ui は 游ゴシックが適用されてしまう。-apple-system: safari, firefox用 / 'BlinkMacSystemFont': Chrome用
54
+ --ff--base: -apple-system, 'BlinkMacSystemFont', sans-serif, 'Segoe UI Emoji';
59
55
  --ff--accent: 'Garamond', 'Baskerville', 'Times New Roman', serif;
60
56
  --ff--mono: Menlo, Consolas, monaco, monospace;
61
57
 
@@ -20,11 +20,3 @@
20
20
  --list-px-s: 1.5em;
21
21
  list-style: revert;
22
22
  }
23
-
24
- // bdc, bdw などでカラーや太さを上書きできるように border 自体を変数管理
25
- // .-bd .set--bd
26
- @include mixin.maybe_where('.-bd,[class*="-bd-"]', '') {
27
- --bds: solid;
28
- --bdw: 1px;
29
- --bdc: currentColor;
30
- }
@@ -1,7 +1,7 @@
1
1
  @use '../../_mixin' as mixin;
2
2
 
3
3
  // Note: d--modalに使われる
4
- @include mixin.maybe_where('.set-plain', '') {
4
+ @include mixin.maybe_where('.set-plain') {
5
5
  font: inherit;
6
6
  width: auto;
7
7
  height: auto;
@@ -10,5 +10,5 @@
10
10
  border: none;
11
11
  text-decoration: none;
12
12
  padding: 0;
13
- // margin: 0;
13
+ margin: 0;
14
14
  }
@@ -5,8 +5,10 @@
5
5
  $layer_mode: 0
6
6
  );
7
7
 
8
- // base
8
+ // reset(ここはレイヤーあり)
9
9
  @use './reset' as reset;
10
+
11
+ // base
10
12
  @use './base/index' as base;
11
13
 
12
14
  // Modules
@@ -1,33 +1,42 @@
1
- // dialog,
1
+ /*
2
+ * dialog で実装.
3
+ * Memo: ::backdrop のアニメーションはFirefoxで動かない
4
+ */
2
5
  .d--modal {
3
6
  --my-s: 0; // flow直下にきても影響しないように
4
- --offset: 0 0; // アニメーション用
5
7
  --duration: var(--modal-duration, 0.5s);
6
- --backdropBg: rgb(0 0 0 / 0.6);
8
+ width: 100%;
9
+ height: 100%;
7
10
  max-width: 100%;
8
11
  max-height: 100%;
9
- transition-duration: var(--duration, 0.5s);
12
+ overflow: unset;
13
+ background: var(--backdrop-bg, rgb(0 0 0 / 0.6));
14
+ transition-duration: var(--duration);
15
+ transition-property: opacity;
10
16
 
11
17
  &::backdrop {
12
- transition: opacity var(--duration, 0.5s);
13
- background: var(--backdropBg);
18
+ background: none;
14
19
  }
15
20
  }
21
+ .d--modal[open] {
22
+ display: flex;
23
+ flex-direction: column;
24
+ justify-content: center;
25
+ }
16
26
 
17
27
  .d--modal_inner {
18
- max-height: 100%;
28
+ --translate: 0 0; // アニメーション用
19
29
  background-color: var(--c--base);
30
+ transition: translate var(--duration);
20
31
  }
21
32
 
22
- .d--modal_body {
23
- overflow: auto;
24
- overscroll-behavior: contain;
25
- }
33
+ // .d--modal_body {
34
+ // overscroll-behavior: contain;
35
+ // }
26
36
 
27
37
  .d--modal:not([data-is-open]) {
28
- translate: var(--offset);
29
- }
30
- .d--modal:not([data-is-open]),
31
- .d--modal:not([data-is-open])::backdrop {
32
38
  opacity: 0;
33
39
  }
40
+ .d--modal:not([data-is-open]) > .d--modal_inner {
41
+ translate: var(--translate);
42
+ }
@@ -1,19 +1,15 @@
1
- /*
2
- Memo:
3
- - > * + * を使えば :first-child への my-s の打ち消しは不要になるが、 my-e 0 を :first-child にも効かせたいので、 > * で書いている。
4
- */
5
1
  .l--flow {
6
2
  display: flow-root;
7
3
  // --flow: var(--flow--base);
8
4
 
9
- > * {
5
+ > * + * {
10
6
  --flow: var(--flow--base);
11
7
  --my-s: var(--flow);
12
- margin-block: var(--my-s) 0;
8
+ margin-block-start: var(--my-s);
13
9
  }
14
10
 
15
11
  // flow 直下のメディア要素は block に初期リセット
16
- > :where(img, video, audio) {
12
+ > :where(img, video) {
17
13
  display: block;
18
14
  }
19
15
  }
@@ -36,7 +32,6 @@
36
32
 
37
33
  // Note: 打ち消しを最後に書く
38
34
  // .l--flow > :where(.-max-sz\:full + .-max-sz\:full),
39
- .l--flow > :first-child,
40
35
  .is--skipFlow + * {
41
36
  --my-s: 0px;
42
37
  }
@@ -12,8 +12,12 @@
12
12
  */
13
13
 
14
14
  // Memo: base レイヤーで初期値セット済み
15
- .-bd,
16
- [class*='-bd-'] {
15
+ // bdc, bdw などでカラーや太さを上書きできるように border 自体を変数管理
16
+ // .-bd .set--bd
17
+ @include mixin.maybe_where('.-bd,[class*=" -bd-"],[class^="-bd-"]', '@base') {
18
+ --bds: solid;
19
+ --bdw: 1px;
20
+ --bdc: currentColor;
17
21
  border-width: var(--bdw) #{mixin.$maybe_important};
18
22
  border-color: var(--bdc) #{mixin.$maybe_important};
19
23
  }