lism-css 0.3.4 → 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 +4 -4
- 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 +31 -38
- 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/css/base.css +0 -1
- package/dist/css/dynamic.css +0 -1
- package/dist/css/layout.css +0 -1
- package/dist/css/main.css +0 -1
- package/dist/css/main_no_layer.css +0 -1
- package/dist/css/props.css +0 -1
- package/dist/css/reset.css +0 -1
- package/dist/css/state.css +0 -1
- package/dist/css/utility.css +0 -1
- package/dist/lib/getMaybeUtilValue.js +0 -6
- package/packages/astro/Flex/Cluster.astro +0 -11
- package/packages/astro/Grid/GridItem.astro +0 -15
- 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
|
@@ -0,0 +1,370 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* isVar: 1 → クラス出力はせずstyle属性での変数出力のみ (--bdw, --keycolor など)
|
|
3
|
+
* bp: 0 → Prop-valユーティリティクラス化されなければ、style属性で出力するだけ。
|
|
4
|
+
* bp: 1 → .-prop と --prop の セットがベースにあり、.-prop_bp と .--prop_bp で ブレイクポイント指定できる。
|
|
5
|
+
* .-prop{propaty:var(--prop)} が基本で、ユーティリティクラスは .-prop:val{propaty:value} となる。
|
|
6
|
+
*
|
|
7
|
+
* ↓コンポーネント処理で使用される
|
|
8
|
+
* tokenClass: 1 → 対応するトークン値がそのまま全てユーティリティクラス化されるもの。
|
|
9
|
+
* shorthands: → コンポーネント側で短く書くための設定
|
|
10
|
+
*
|
|
11
|
+
* ↓SCSS出力で使用される
|
|
12
|
+
* alwaysVar: 1 → .-prop,[class*=-prop:] {propaty:var(--prop)} で、ユーティリティクラス時も常に変数管理となる。
|
|
13
|
+
* overwriteBaseVar: 1 → ブレイクポイントクラスで --prop: var(--prop_$bp) がセットされ、常にベース変数の --prop で値が取得できるようになる。
|
|
14
|
+
* important: 1 → !important を付けて最終的に出力する
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
const PLACE_PRESETS = ['start', 'center', 'end'];
|
|
18
|
+
const PLACE_UTILS = { 'flex-s': 'flex-start', 'flex-e': 'flex-end' };
|
|
19
|
+
const PLACE_SHORTHANDS = { s: 'start', e: 'end', c: 'center', fs: 'flex-s', fe: 'flex-e' };
|
|
20
|
+
|
|
21
|
+
export default {
|
|
22
|
+
f: { prop: 'font', presets: ['inherit'] },
|
|
23
|
+
fz: { prop: 'fontSize', token: 'fz', tokenClass: 1, bp: 1, alwaysVar: 1 },
|
|
24
|
+
fw: { prop: 'fontWeight', token: 'fw', tokenClass: 1 },
|
|
25
|
+
ff: { prop: 'fontFamily', token: 'ff', tokenClass: 1 },
|
|
26
|
+
fs: { prop: 'fontStyle', presets: ['italic'], shorthands: { i: 'italic' } },
|
|
27
|
+
lh: { prop: 'lineHeight', presets: ['1'], token: 'lh', tokenClass: 1, bp: 1, alwaysVar: 1 },
|
|
28
|
+
lts: { prop: 'letterSpacing', token: 'lts', tokenClass: 1 },
|
|
29
|
+
ta: { prop: 'textAlign', presets: ['center', 'left', 'right'] },
|
|
30
|
+
td: { prop: 'textDecoration', utils: { under: 'underline', none: 'none' } },
|
|
31
|
+
// tt: { prop: 'textTransform', utils: { upper: 'uppercase', lower: 'lowercase' } },
|
|
32
|
+
// te: { prop: 'textEmphasis', presets: ['filled'] },
|
|
33
|
+
// tsh: { prop: 'textShadow' },
|
|
34
|
+
|
|
35
|
+
d: {
|
|
36
|
+
prop: 'display',
|
|
37
|
+
presets: ['none', 'block'],
|
|
38
|
+
utils: { 'in-flex': 'inline-flex' },
|
|
39
|
+
bp: 1,
|
|
40
|
+
},
|
|
41
|
+
o: { prop: 'opacity', presets: ['0'], token: 'o', tokenClass: 1 },
|
|
42
|
+
v: { prop: 'visibility', presets: ['hidden'] },
|
|
43
|
+
ov: { prop: 'overflow', presets: ['hidden', 'auto', 'clip'] },
|
|
44
|
+
'ov-x': { prop: 'overflowX', presets: ['clip', 'auto', 'scroll'] },
|
|
45
|
+
'ov-y': { prop: 'overflowY', presets: ['clip', 'auto', 'scroll'] },
|
|
46
|
+
// overflow-clip-margin → safariで使えない
|
|
47
|
+
ar: {
|
|
48
|
+
prop: 'aspectRatio',
|
|
49
|
+
presets: ['21/9', '16/9', '3/2', '1/1'], // 4/3, 2/1
|
|
50
|
+
token: 'ar',
|
|
51
|
+
tokenClass: 1,
|
|
52
|
+
bp: 1,
|
|
53
|
+
},
|
|
54
|
+
|
|
55
|
+
// size
|
|
56
|
+
w: { prop: 'width', utils: { fit: 'fit-content' }, presets: ['100%'], token: 'sz', bp: 1 },
|
|
57
|
+
h: { prop: 'height', presets: ['100%'], token: 'sz', bp: 1 },
|
|
58
|
+
'min-w': { prop: 'minWidth', presets: ['100%'], token: 'sz', bp: 1 },
|
|
59
|
+
'max-w': { prop: 'maxWidth', presets: ['100%'], token: 'sz', bp: 1 },
|
|
60
|
+
'min-h': { prop: 'minHeight', presets: ['100%'], token: 'sz', bp: 1 },
|
|
61
|
+
'max-h': { prop: 'maxHeight', presets: ['100%'], token: 'sz', bp: 1 },
|
|
62
|
+
|
|
63
|
+
sz: { prop: 'inlineSize', token: 'sz' },
|
|
64
|
+
'min-sz': { prop: 'minInlineSize', token: 'sz' },
|
|
65
|
+
'max-sz': {
|
|
66
|
+
prop: 'maxInlineSize',
|
|
67
|
+
token: 'sz',
|
|
68
|
+
tokenClass: 1,
|
|
69
|
+
exUtility: {
|
|
70
|
+
min: '',
|
|
71
|
+
full: '',
|
|
72
|
+
outer: '',
|
|
73
|
+
},
|
|
74
|
+
},
|
|
75
|
+
ysz: { prop: 'blockSize', token: 'sz' },
|
|
76
|
+
'min-ysz': { prop: 'minBlockSize', token: 'sz' },
|
|
77
|
+
'max-ysz': { prop: 'maxBlockSize', token: 'sz' },
|
|
78
|
+
|
|
79
|
+
// bg
|
|
80
|
+
bg: { prop: 'background', bp: 1 },
|
|
81
|
+
bgi: { prop: 'backgroundImage' },
|
|
82
|
+
bgr: { prop: 'backgroundRepeat', utils: { no: 'no-repeat' } },
|
|
83
|
+
bgp: { prop: 'backgroundPosition', presets: ['center'] },
|
|
84
|
+
bgsz: { prop: 'backgroundSize', presets: ['cover', 'contain'] },
|
|
85
|
+
bga: { prop: 'backgroundAttachment' }, // fixed
|
|
86
|
+
bgo: { prop: 'backgroundOrigin' }, // border, padding, content
|
|
87
|
+
bgblend: { prop: 'backgroundBlendMode' },
|
|
88
|
+
bgclip: {
|
|
89
|
+
prop: 'backgroundClip',
|
|
90
|
+
presets: ['text'],
|
|
91
|
+
},
|
|
92
|
+
bgc: {
|
|
93
|
+
prop: 'backgroundColor',
|
|
94
|
+
presets: ['base', 'base-2', 'text', 'inherit', 'main', 'accent'],
|
|
95
|
+
utils: { trsp: 'transparent' },
|
|
96
|
+
token: 'color',
|
|
97
|
+
exUtility: { inherit: { 'background-color': 'inherit' } },
|
|
98
|
+
alwaysVar: 1,
|
|
99
|
+
},
|
|
100
|
+
|
|
101
|
+
c: {
|
|
102
|
+
// Note: bg系(bgclip)より後にくるように。
|
|
103
|
+
prop: 'color',
|
|
104
|
+
presets: ['base', 'text', 'text-2', 'main', 'accent', 'inherit'],
|
|
105
|
+
utils: { trsp: 'transparent' },
|
|
106
|
+
// tt
|
|
107
|
+
token: 'color',
|
|
108
|
+
exUtility: {
|
|
109
|
+
inherit: { color: 'inherit' }, // --c ではなく color で出力したい
|
|
110
|
+
// mix: {'--_c1:currentColor;--_c2:transparent;--c:color-mix(in srgb, var(--_c1) var(--_mix-c, 50%), var(--_c2))'},
|
|
111
|
+
},
|
|
112
|
+
alwaysVar: 1,
|
|
113
|
+
},
|
|
114
|
+
keycolor: { isVar: 1, token: 'color' },
|
|
115
|
+
bd: { prop: 'border', presets: ['none'] },
|
|
116
|
+
bds: { isVar: 1, presets: ['dashed', 'dotted', 'double'] },
|
|
117
|
+
bdc: {
|
|
118
|
+
isVar: 1,
|
|
119
|
+
presets: ['main', 'accent', 'line', 'inherit'],
|
|
120
|
+
utils: { trsp: 'transparent' },
|
|
121
|
+
token: 'color',
|
|
122
|
+
},
|
|
123
|
+
bdw: { isVar: 1, bp: 1 }, // --bdw のみ
|
|
124
|
+
'bd-x': { prop: 'borderInline' },
|
|
125
|
+
'bd-y': { prop: 'borderBlock' },
|
|
126
|
+
'bd-x-s': { prop: 'borderInlineStart' },
|
|
127
|
+
'bd-x-e': { prop: 'borderInlineEnd' },
|
|
128
|
+
'bd-y-s': { prop: 'borderBlockStart' },
|
|
129
|
+
'bd-y-e': { prop: 'borderBlockEnd' },
|
|
130
|
+
'bd-t': { prop: 'borderTop' },
|
|
131
|
+
'bd-b': { prop: 'borderBottom' },
|
|
132
|
+
'bd-l': { prop: 'borderLeft' },
|
|
133
|
+
'bd-r': { prop: 'borderRight' },
|
|
134
|
+
|
|
135
|
+
bdrs: {
|
|
136
|
+
prop: 'borderRadius',
|
|
137
|
+
presets: ['0'],
|
|
138
|
+
token: 'bdrs',
|
|
139
|
+
tokenClass: 1,
|
|
140
|
+
bp: 1,
|
|
141
|
+
alwaysVar: 1,
|
|
142
|
+
overwriteBaseVar: 1,
|
|
143
|
+
},
|
|
144
|
+
'bdrs-tl': { prop: 'borderTopLeftRadius', token: 'bdrs' },
|
|
145
|
+
'bdrs-tr': { prop: 'borderTopRightRadius', token: 'bdrs' },
|
|
146
|
+
'bdrs-br': { prop: 'borderBottomRightRadius', token: 'bdrs' },
|
|
147
|
+
'bdrs-bl': { prop: 'borderBottomLeftRadius', token: 'bdrs' },
|
|
148
|
+
'bdrs-ss': { prop: 'borderStartStartRadius', token: 'bdrs' },
|
|
149
|
+
'bdrs-se': { prop: 'borderStartEndRadius', token: 'bdrs' },
|
|
150
|
+
'bdrs-es': { prop: 'borderEndStartRadius', token: 'bdrs' },
|
|
151
|
+
'bdrs-ee': { prop: 'borderEndEndRadius', token: 'bdrs' },
|
|
152
|
+
|
|
153
|
+
bxsh: { prop: 'boxShadow', utils: { 0: 'none' }, token: 'bxsh', tokenClass: 1, bp: 1, alwaysVar: 1 },
|
|
154
|
+
|
|
155
|
+
// position
|
|
156
|
+
pos: {
|
|
157
|
+
prop: 'position',
|
|
158
|
+
presets: ['static', 'fixed', 'sticky'],
|
|
159
|
+
utils: { rel: 'relative', abs: 'absolute' },
|
|
160
|
+
},
|
|
161
|
+
z: { prop: 'zIndex', presets: ['-1', '0', '1', '99'] },
|
|
162
|
+
t: { prop: 'top', utils: { 0: '0%' }, presets: ['50%', '100%'], token: 'space' },
|
|
163
|
+
l: { prop: 'left', utils: { 0: '0%' }, presets: ['50%', '100%'], token: 'space' },
|
|
164
|
+
r: { prop: 'right', utils: { 0: '0%' }, presets: ['50%', '100%'], token: 'space' },
|
|
165
|
+
b: { prop: 'bottom', utils: { 0: '0%' }, presets: ['50%', '100%'], token: 'space' },
|
|
166
|
+
i: { prop: 'inset', utils: { 0: '0%' }, token: 'space' },
|
|
167
|
+
'i-x': { prop: 'insetInline', token: 'space' },
|
|
168
|
+
'i-y': { prop: 'insetBlock', token: 'space' },
|
|
169
|
+
'i-x-s': { prop: 'insetInlineStart', token: 'space' },
|
|
170
|
+
'i-x-e': { prop: 'insetInlineEnd', token: 'space' },
|
|
171
|
+
'i-y-s': { prop: 'insetBlockStart', token: 'space' },
|
|
172
|
+
'i-y-e': { prop: 'insetBlockEnd', token: 'space' },
|
|
173
|
+
|
|
174
|
+
// space
|
|
175
|
+
p: {
|
|
176
|
+
prop: 'padding',
|
|
177
|
+
presets: ['0'],
|
|
178
|
+
token: 'space',
|
|
179
|
+
tokenClass: 1,
|
|
180
|
+
alwaysVar: 1,
|
|
181
|
+
overwriteBaseVar: 1,
|
|
182
|
+
bp: 1,
|
|
183
|
+
},
|
|
184
|
+
px: { prop: 'paddingInline', presets: ['0'], token: 'space', tokenClass: 1, alwaysVar: 1, bp: 1 },
|
|
185
|
+
py: { prop: 'paddingBlock', presets: ['0'], token: 'space', tokenClass: 1, alwaysVar: 1, bp: 1 },
|
|
186
|
+
'px-s': { prop: 'paddingInlineStart', token: 'space', bp: 1 },
|
|
187
|
+
'px-e': { prop: 'paddingInlineEnd', token: 'space', bp: 1 },
|
|
188
|
+
'py-s': { prop: 'paddingBlockStart', token: 'space', bp: 1 },
|
|
189
|
+
'py-e': { prop: 'paddingBlockEnd', token: 'space', bp: 1 },
|
|
190
|
+
pl: { prop: 'paddingLeft', token: 'space', bp: 1 },
|
|
191
|
+
pr: { prop: 'paddingRight', token: 'space', bp: 1 },
|
|
192
|
+
pt: { prop: 'paddingTop', token: 'space', bp: 1 },
|
|
193
|
+
pb: { prop: 'paddingBottom', token: 'space', bp: 1 },
|
|
194
|
+
m: {
|
|
195
|
+
prop: 'margin',
|
|
196
|
+
presets: ['auto', '0'],
|
|
197
|
+
token: 'space',
|
|
198
|
+
tokenClass: 1,
|
|
199
|
+
alwaysVar: 1,
|
|
200
|
+
overwriteBaseVar: 1,
|
|
201
|
+
bp: 1,
|
|
202
|
+
},
|
|
203
|
+
mx: { prop: 'marginInline', presets: ['auto', '0'], token: 'space', tokenClass: 1, alwaysVar: 1, bp: 1 },
|
|
204
|
+
my: { prop: 'marginBlock', presets: ['auto', '0'], token: 'space', tokenClass: 1, alwaysVar: 1, bp: 1 },
|
|
205
|
+
'mx-s': { prop: 'marginInlineStart', presets: ['auto'], token: 'space', bp: 1 },
|
|
206
|
+
'mx-e': { prop: 'marginInlineEnd', presets: ['auto'], token: 'space', bp: 1 },
|
|
207
|
+
'my-s': { prop: 'marginBlockStart', token: 'space', bp: 1, presets: ['auto', '0'], tokenClass: 1 },
|
|
208
|
+
'my-e': { prop: 'marginInlineEnd', presets: ['auto'], token: 'space', bp: 1 },
|
|
209
|
+
ml: { prop: 'marginLeft', token: 'space', bp: 1 },
|
|
210
|
+
mr: { prop: 'marginRight', token: 'space', bp: 1 },
|
|
211
|
+
mt: { prop: 'marginTop', token: 'space', bp: 1 },
|
|
212
|
+
mb: { prop: 'marginBottom', token: 'space', bp: 1 },
|
|
213
|
+
|
|
214
|
+
g: {
|
|
215
|
+
prop: 'gap',
|
|
216
|
+
presets: ['0', 'inherit'],
|
|
217
|
+
exUtility: { inherit: { gap: 'inherit' } },
|
|
218
|
+
token: 'space',
|
|
219
|
+
tokenClass: 1,
|
|
220
|
+
alwaysVar: 1,
|
|
221
|
+
overwriteBaseVar: 1,
|
|
222
|
+
bp: 1,
|
|
223
|
+
},
|
|
224
|
+
'g-x': { prop: 'columnGap', token: 'space', bp: 1 },
|
|
225
|
+
'g-y': { prop: 'rowGap', token: 'space', bp: 1 },
|
|
226
|
+
cols: { isVar: 1, bp: 1 },
|
|
227
|
+
rows: { isVar: 1, bp: 1 },
|
|
228
|
+
|
|
229
|
+
// flex
|
|
230
|
+
fxf: { prop: 'flexFlow' },
|
|
231
|
+
fxw: { prop: 'flexWrap', presets: ['wrap'], bp: 1 },
|
|
232
|
+
fxd: { prop: 'flexDirection', utils: { col: 'column', 'col-r': 'column-reverse', 'row-r': 'row-reverse' }, bp: 1 },
|
|
233
|
+
fx: { prop: 'flex', presets: ['1'], bp: 1 },
|
|
234
|
+
fxg: { prop: 'flexGrow', presets: ['1'] },
|
|
235
|
+
fxsh: { prop: 'flexShrink', presets: ['0'] },
|
|
236
|
+
fxb: { prop: 'flexBasis', bp: 1 },
|
|
237
|
+
|
|
238
|
+
// grid
|
|
239
|
+
// gd: { prop: 'grid' },
|
|
240
|
+
gt: {
|
|
241
|
+
prop: 'gridTemplate',
|
|
242
|
+
presets: ['repeat'],
|
|
243
|
+
exUtility: {
|
|
244
|
+
repeat: {
|
|
245
|
+
'--cols': '1',
|
|
246
|
+
'--rows': '1',
|
|
247
|
+
'grid-template': 'repeat(var(--rows), 1fr) / repeat(var(--cols), 1fr)',
|
|
248
|
+
},
|
|
249
|
+
},
|
|
250
|
+
bp: 1,
|
|
251
|
+
},
|
|
252
|
+
gta: { prop: 'gridTemplateAreas', bp: 1 },
|
|
253
|
+
gtc: {
|
|
254
|
+
prop: 'gridTemplateColumns',
|
|
255
|
+
presets: ['subgrid', 'liquid'],
|
|
256
|
+
exUtility: {
|
|
257
|
+
// repeat: { '--cols': '1', '--gtc': 'repeat(var(--cols), 1fr)' },
|
|
258
|
+
liquid: { '--cols': 'var(--sz--min)', '--gtc': 'repeat(auto-fill, minmax(min(var(--cols), 100%), 1fr))' },
|
|
259
|
+
},
|
|
260
|
+
bp: 1,
|
|
261
|
+
},
|
|
262
|
+
gtr: {
|
|
263
|
+
prop: 'gridTemplateRows',
|
|
264
|
+
presets: ['subgrid'],
|
|
265
|
+
// exUtility: { repeat: { '--rows': '1', '--gtr': 'repeat(var(--rows), 1fr)' } },
|
|
266
|
+
bp: 1,
|
|
267
|
+
},
|
|
268
|
+
gaf: { prop: 'gridAutoFlow', utils: { row: 'row', col: 'column' }, bp: 1 }, //dense
|
|
269
|
+
gac: { prop: 'gridAutoColumns' },
|
|
270
|
+
gar: { prop: 'gridAutoRows' },
|
|
271
|
+
|
|
272
|
+
// grid item
|
|
273
|
+
ga: { prop: 'gridArea', utils: { '1/1': '1 / 1' }, bp: 1 },
|
|
274
|
+
gc: { prop: 'gridColumn', utils: { '1/-1': '1 / -1' }, bp: 1 },
|
|
275
|
+
gr: { prop: 'gridRow', utils: { '1/-1': '1 / -1' }, bp: 1 },
|
|
276
|
+
gcs: { prop: 'gridColumnStart' },
|
|
277
|
+
gce: { prop: 'gridColumnEnd' },
|
|
278
|
+
grs: { prop: 'gridRowStart' },
|
|
279
|
+
gre: { prop: 'gridRowEnd' },
|
|
280
|
+
|
|
281
|
+
// places
|
|
282
|
+
// -(ai|ac|ji|jc|aslf|jslf): / -$1:
|
|
283
|
+
ai: {
|
|
284
|
+
prop: 'alignItems',
|
|
285
|
+
presets: [...PLACE_PRESETS, 'stretch'],
|
|
286
|
+
utils: PLACE_UTILS,
|
|
287
|
+
shorthands: PLACE_SHORTHANDS,
|
|
288
|
+
bp: 1,
|
|
289
|
+
},
|
|
290
|
+
ac: {
|
|
291
|
+
prop: 'alignContent',
|
|
292
|
+
presets: PLACE_PRESETS,
|
|
293
|
+
utils: { ...PLACE_UTILS, between: 'space-between' },
|
|
294
|
+
shorthands: PLACE_SHORTHANDS,
|
|
295
|
+
bp: 1,
|
|
296
|
+
},
|
|
297
|
+
ji: {
|
|
298
|
+
prop: 'justifyItems',
|
|
299
|
+
presets: [...PLACE_PRESETS, 'stretch'],
|
|
300
|
+
utils: PLACE_UTILS,
|
|
301
|
+
shorthands: PLACE_SHORTHANDS,
|
|
302
|
+
bp: 1,
|
|
303
|
+
},
|
|
304
|
+
jc: {
|
|
305
|
+
prop: 'justifyContent',
|
|
306
|
+
presets: PLACE_PRESETS,
|
|
307
|
+
utils: { ...PLACE_UTILS, between: 'space-between' },
|
|
308
|
+
shorthands: PLACE_SHORTHANDS,
|
|
309
|
+
bp: 1,
|
|
310
|
+
},
|
|
311
|
+
aslf: {
|
|
312
|
+
prop: 'alignSelf',
|
|
313
|
+
presets: [...PLACE_PRESETS, 'stretch'],
|
|
314
|
+
shorthands: PLACE_SHORTHANDS,
|
|
315
|
+
},
|
|
316
|
+
jslf: {
|
|
317
|
+
prop: 'justifySelf',
|
|
318
|
+
presets: [...PLACE_PRESETS, 'stretch'],
|
|
319
|
+
shorthands: PLACE_SHORTHANDS,
|
|
320
|
+
},
|
|
321
|
+
pi: { prop: 'placeItems' },
|
|
322
|
+
pc: { prop: 'placeContent' },
|
|
323
|
+
pslf: { prop: 'placeSelf' },
|
|
324
|
+
order: { prop: 'order', presets: ['0', '-1', '1'] },
|
|
325
|
+
|
|
326
|
+
// transform
|
|
327
|
+
translate: {
|
|
328
|
+
prop: 'translate',
|
|
329
|
+
utils: {
|
|
330
|
+
'-50X': '-50% 0',
|
|
331
|
+
'-50Y': '0 -50%',
|
|
332
|
+
'-50XY': '-50% -50%',
|
|
333
|
+
},
|
|
334
|
+
},
|
|
335
|
+
//rtt
|
|
336
|
+
rotate: {
|
|
337
|
+
prop: 'rotate',
|
|
338
|
+
utils: {
|
|
339
|
+
[`45`]: '45deg',
|
|
340
|
+
'-45': '-45deg',
|
|
341
|
+
[`90`]: '90deg',
|
|
342
|
+
'-90': '-90deg',
|
|
343
|
+
// '180': '180deg',
|
|
344
|
+
},
|
|
345
|
+
},
|
|
346
|
+
//scl
|
|
347
|
+
scale: {
|
|
348
|
+
prop: 'scale',
|
|
349
|
+
utils: {
|
|
350
|
+
'-X': '-1 1',
|
|
351
|
+
'-Y': '1 -1',
|
|
352
|
+
'-XY': '-1 -1',
|
|
353
|
+
},
|
|
354
|
+
},
|
|
355
|
+
|
|
356
|
+
// others
|
|
357
|
+
// msk: { prop: 'mask', bp: 1 },
|
|
358
|
+
ovw: { prop: 'overflowWrap', utils: { any: 'anywhere' } },
|
|
359
|
+
whitespace: { prop: 'whiteSpace', presets: ['nowrap'] },
|
|
360
|
+
// wordbreak: { prop: 'wordBreak', utils: { keep: 'keep-all', all: 'break-all' } },
|
|
361
|
+
writing: { prop: 'writingMode', token: 'writing', tokenClass: 1, bp: 1 },
|
|
362
|
+
float: { prop: 'float', presets: ['left', 'right'] },
|
|
363
|
+
clear: { prop: 'clear', presets: ['both'] },
|
|
364
|
+
isolation: { prop: 'isolation', presets: ['isolate'] },
|
|
365
|
+
|
|
366
|
+
// transition
|
|
367
|
+
duration: { isVar: 1 },
|
|
368
|
+
delay: { isVar: 1 },
|
|
369
|
+
ease: { isVar: 1 },
|
|
370
|
+
};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import getSvgUrl from '../helper/getSvgUrl.js';
|
|
2
|
+
// import minifyHtml from '../helper/minifyHtml.js';
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
isContainer: {
|
|
6
|
+
className: 'is--container',
|
|
7
|
+
preset: ['s', 'm', 'l'],
|
|
8
|
+
presetClass: '-container',
|
|
9
|
+
customVar: '--contentSz',
|
|
10
|
+
tokenKey: 'sz',
|
|
11
|
+
},
|
|
12
|
+
isLayer: 'is--layer',
|
|
13
|
+
isLinkBox: 'is--linkBox',
|
|
14
|
+
isSide: 'is--side',
|
|
15
|
+
isSkipFlow: 'is--skipFlow',
|
|
16
|
+
hasGutter: 'has--gutter',
|
|
17
|
+
|
|
18
|
+
// set class
|
|
19
|
+
|
|
20
|
+
setShadow: 'set-shadow',
|
|
21
|
+
setHov: 'set-hov',
|
|
22
|
+
setTransition: 'set-transition',
|
|
23
|
+
setSnap: 'set-snap',
|
|
24
|
+
setMask: {
|
|
25
|
+
// 'set-mask',
|
|
26
|
+
className: 'set-mask',
|
|
27
|
+
setStyles: (propVal) => {
|
|
28
|
+
// minify化
|
|
29
|
+
// propVal = minifyHtml(propVal);
|
|
30
|
+
let imgUrl = propVal;
|
|
31
|
+
if (imgUrl.startsWith('<svg')) {
|
|
32
|
+
imgUrl = getSvgUrl(propVal, 'base64');
|
|
33
|
+
}
|
|
34
|
+
return {
|
|
35
|
+
'--maskImg': imgUrl,
|
|
36
|
+
};
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
setPlain: 'set-plain',
|
|
40
|
+
setRevert: 'set-revert',
|
|
41
|
+
setInnerRs: 'set-innerRs',
|
|
42
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
fz: ['root', 'base', '5xl', '4xl', '3xl', '2xl', 'xl', 'l', 'm', 's', 'xs', '2xs'],
|
|
3
|
+
lh: ['base', 'xs', 's', 'l', 'xl'],
|
|
4
|
+
lts: ['base', 's', 'l'],
|
|
5
|
+
ff: ['base', 'accent', 'mono'],
|
|
6
|
+
fw: ['thin', 'light', 'normal', 'medium', 'bold', 'black'],
|
|
7
|
+
o: ['-10', '-20', '-30'],
|
|
8
|
+
bdrs: ['5', '10', '20', '30', '40', '50', '99', 'inner'],
|
|
9
|
+
bxsh: ['5', '10', '20', '30', '40', '50'],
|
|
10
|
+
sz: ['xs', 's', 'm', 'l', 'xl', 'min', 'full', 'outer'],
|
|
11
|
+
ar: ['og'],
|
|
12
|
+
space: {
|
|
13
|
+
pre: '--s',
|
|
14
|
+
values: ['5', '10', '20', '30', '40', '50', '60', '70', '80'],
|
|
15
|
+
},
|
|
16
|
+
c: {
|
|
17
|
+
pre: '--c--',
|
|
18
|
+
values: ['base', 'base-2', 'text', 'text-2', 'line', 'link', 'main', 'accent'],
|
|
19
|
+
},
|
|
20
|
+
palette: {
|
|
21
|
+
pre: '--',
|
|
22
|
+
values: ['red', 'blue', 'green', 'yellow', 'purple', 'orange', 'pink', 'gray', 'white', 'black', 'keycolor'],
|
|
23
|
+
},
|
|
24
|
+
writing: ['vertical'],
|
|
25
|
+
flow: ['s', 'base', 'l'],
|
|
26
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
// import minifyHtml from './minifyHtml.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* svgをcssの image url に変換
|
|
5
|
+
*/
|
|
6
|
+
const getSvgUrl = (svg, encode = '') => {
|
|
7
|
+
if (!svg) return '';
|
|
8
|
+
|
|
9
|
+
// minify化
|
|
10
|
+
// svg = minifyHtml(svg);
|
|
11
|
+
|
|
12
|
+
if ('base64' === encode) {
|
|
13
|
+
// memo: btoa() だけだとマルチバイト文字が入った時にエラーになる。
|
|
14
|
+
// encodeURIComponent() でそれを回避できるがそれだとSVGとして描画できず、 unescape() と組み合わせることで期待する動作になった。 see: https://www.softel.co.jp/blogs/tech/archives/4133
|
|
15
|
+
// svg = window.btoa(unescape(encodeURIComponent(svg)));
|
|
16
|
+
|
|
17
|
+
// memo: Buffer 使えば非推奨な関数を使わなくてもいい see: https://hackersheet.com/naopoyo/sheets/bvtrkwt
|
|
18
|
+
svg = Buffer.from(svg).toString('base64');
|
|
19
|
+
return `url(data:image/svg+xml;base64,${svg})`;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
// シングルクォートをダブルクォートに変換
|
|
23
|
+
svg = svg.replace(/'/g, '"');
|
|
24
|
+
// カラーコードの先頭の # → %23 に置換
|
|
25
|
+
svg = svg.replace(/="#/g, '="%23');
|
|
26
|
+
return `url('data:image/svg+xml,${svg}')`;
|
|
27
|
+
};
|
|
28
|
+
export default getSvgUrl;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* html文字列をminify
|
|
3
|
+
*/
|
|
4
|
+
const minifyHtml = (html) => {
|
|
5
|
+
if (!html) return '';
|
|
6
|
+
|
|
7
|
+
// 改行先に削除
|
|
8
|
+
html = html.replace(/\r?\n/g, '');
|
|
9
|
+
|
|
10
|
+
// タブ → スペース
|
|
11
|
+
html = html.replace(/\t/g, ' ');
|
|
12
|
+
|
|
13
|
+
// 複数のスペースを1つに
|
|
14
|
+
html = html.replace(/\s\s+/g, ' ');
|
|
15
|
+
|
|
16
|
+
// タグとタグの間のスペースを削除
|
|
17
|
+
html = html.replace(/> </g, '><');
|
|
18
|
+
|
|
19
|
+
return html;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export default minifyHtml;
|
package/config/helper.js
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
function isObj(value) {
|
|
2
|
+
return value && typeof value === 'object' && !Array.isArray(value);
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* 深いマージを行う関数
|
|
7
|
+
* @param {Object} origin - マージ先となる元オブジェクト
|
|
8
|
+
* @param {Object} source - マージするソース(このデータに更新される)
|
|
9
|
+
* @returns {Object} マージされたオブジェクト
|
|
10
|
+
*/
|
|
11
|
+
export function objDeepMerge(origin, source) {
|
|
12
|
+
// originとsourceがオブジェクトかどうかをチェック
|
|
13
|
+
if (!origin || typeof origin !== 'object' || Array.isArray(origin)) {
|
|
14
|
+
return source;
|
|
15
|
+
}
|
|
16
|
+
if (!source || typeof source !== 'object' || Array.isArray(source)) {
|
|
17
|
+
return origin;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const result = { ...origin };
|
|
21
|
+
|
|
22
|
+
for (const key in source) {
|
|
23
|
+
if (Object.hasOwn(source, key)) {
|
|
24
|
+
const originValue = result[key];
|
|
25
|
+
const sourceValue = source[key];
|
|
26
|
+
|
|
27
|
+
if (!originValue) {
|
|
28
|
+
// origin側に存在しない新たなキーの場合はそのまま追加する
|
|
29
|
+
result[key] = sourceValue;
|
|
30
|
+
} else if (isObj(sourceValue) && isObj(originValue)) {
|
|
31
|
+
// どちらもオブジェクトの場合は再帰的にマージ
|
|
32
|
+
result[key] = objDeepMerge(originValue, sourceValue);
|
|
33
|
+
} else {
|
|
34
|
+
// どちらかのデータがobjectではない場合、そのまま上書き
|
|
35
|
+
result[key] = sourceValue;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
return result;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* オブジェクト内の配列を再帰的にSetに変換する関数
|
|
45
|
+
* @param {any} obj - 変換対象のオブジェクト
|
|
46
|
+
* @returns {any} 変換されたオブジェクト
|
|
47
|
+
*/
|
|
48
|
+
export function arrayConvertToSet(obj) {
|
|
49
|
+
// 配列の場合はSetに変換
|
|
50
|
+
if (Array.isArray(obj)) {
|
|
51
|
+
return new Set(obj);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
// オブジェクトの場合は再帰的に処理
|
|
55
|
+
if (isObj(obj)) {
|
|
56
|
+
const result = {};
|
|
57
|
+
for (const key in obj) {
|
|
58
|
+
if (Object.hasOwn(obj, key)) {
|
|
59
|
+
result[key] = arrayConvertToSet(obj[key]);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
return result;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
// その他の値はそのまま返す
|
|
66
|
+
return obj;
|
|
67
|
+
}
|
package/config/index.js
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import defaultConfig from './default-config.js';
|
|
2
|
+
import userConfig from 'lism-css/config.js'; // ユーザーが上書きできる
|
|
3
|
+
import { objDeepMerge, arrayConvertToSet } from './helper.js';
|
|
4
|
+
|
|
5
|
+
export const CONFIG = objDeepMerge(defaultConfig, userConfig);
|
|
6
|
+
|
|
7
|
+
const { tokens, props, states } = CONFIG;
|
|
8
|
+
|
|
9
|
+
// 配列を Set化.
|
|
10
|
+
export const TOKENS = arrayConvertToSet(structuredClone(tokens));
|
|
11
|
+
export const PROPS = arrayConvertToSet(structuredClone(props));
|
|
12
|
+
export const STATES = states;
|
|
13
|
+
|
|
14
|
+
// ブレイクポイント
|
|
15
|
+
export const BREAK_POINTS = ['sm', 'md', 'lg', 'xl'];
|
package/config.js
ADDED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as o } from "react/jsx-runtime";
|
|
2
2
|
import { getAccIconProps as n } from "./getProps.js";
|
|
3
3
|
import i from "../Lism/index.js";
|
|
4
|
-
import e from "../Icon/index.js";
|
|
4
|
+
import e from "../atomic/Icon/index.js";
|
|
5
5
|
function u({ icon: r = "caret-down", viewBox: c, children: t = null, ...m }) {
|
|
6
6
|
return /* @__PURE__ */ o(i, { ...n(m), children: t || /* @__PURE__ */ o(e, { viewBox: c, icon: r }) });
|
|
7
7
|
}
|
|
@@ -1,29 +1,27 @@
|
|
|
1
|
-
import
|
|
2
|
-
function
|
|
3
|
-
return o.lismClass =
|
|
1
|
+
import n from "../../lib/helper/atts.js";
|
|
2
|
+
function r({ lismClass: a, ...o }) {
|
|
3
|
+
return o.lismClass = n(a, "d--accordion"), o;
|
|
4
4
|
}
|
|
5
|
-
function
|
|
6
|
-
const
|
|
5
|
+
function t({ isTrigger: a, ...o }) {
|
|
6
|
+
const s = {
|
|
7
7
|
lismClass: "d--accordion_icon",
|
|
8
|
-
tag: "span"
|
|
9
|
-
d:
|
|
8
|
+
tag: "span"
|
|
9
|
+
// d: 'inline-grid',
|
|
10
10
|
};
|
|
11
|
-
return a && (
|
|
11
|
+
return a && (s.tag = "button", o["data-role"] = "trigger"), { ...s, ...o };
|
|
12
12
|
}
|
|
13
|
-
const
|
|
14
|
-
header: { lismClass: "d--accordion_header"
|
|
15
|
-
label: { lismClass: "d--accordion_label", tag: "span"
|
|
13
|
+
const i = {
|
|
14
|
+
header: { lismClass: "d--accordion_header" },
|
|
15
|
+
label: { lismClass: "d--accordion_label", tag: "span" },
|
|
16
16
|
body: {
|
|
17
17
|
lismClass: "d--accordion_body"
|
|
18
|
-
// trs: true,
|
|
19
18
|
},
|
|
20
19
|
inner: {
|
|
21
|
-
lismClass: "d--accordion_inner"
|
|
22
|
-
ov: "hidden"
|
|
20
|
+
lismClass: "d--accordion_inner"
|
|
23
21
|
}
|
|
24
22
|
};
|
|
25
23
|
export {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
24
|
+
i as defaultProps,
|
|
25
|
+
t as getAccIconProps,
|
|
26
|
+
r as getAccProps
|
|
29
27
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
const
|
|
1
|
+
import { HeaderLabel as o, Body as e, Label as r, Header as c, Accordion as a } from "./index2.js";
|
|
2
|
+
import d from "./AccIcon.js";
|
|
3
|
+
const i = { Root: a, Header: c, Label: r, Icon: d, Body: e, HeaderLabel: o };
|
|
4
4
|
export {
|
|
5
|
-
|
|
5
|
+
i as default
|
|
6
6
|
};
|