@niche-works/css-layouts 0.1.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/LICENSE +21 -0
- package/README.md +3 -0
- package/_constants.cjs +94 -0
- package/_constants.d.cts +83 -0
- package/_constants.d.mts +83 -0
- package/_constants.mjs +86 -0
- package/_helpers/applyChildCount.cjs +26 -0
- package/_helpers/applyChildCount.d.cts +12 -0
- package/_helpers/applyChildCount.d.mts +13 -0
- package/_helpers/applyChildCount.mjs +24 -0
- package/_helpers/applyChildSize.cjs +27 -0
- package/_helpers/applyChildSize.d.cts +12 -0
- package/_helpers/applyChildSize.d.mts +13 -0
- package/_helpers/applyChildSize.mjs +25 -0
- package/_helpers/applySpacing.cjs +30 -0
- package/_helpers/applySpacing.d.cts +13 -0
- package/_helpers/applySpacing.d.mts +14 -0
- package/_helpers/applySpacing.mjs +28 -0
- package/_helpers/hasValue.cjs +15 -0
- package/_helpers/hasValue.d.cts +8 -0
- package/_helpers/hasValue.d.mts +9 -0
- package/_helpers/hasValue.mjs +14 -0
- package/_helpers/mergeLayoutResults.cjs +18 -0
- package/_helpers/mergeLayoutResults.d.cts +5 -0
- package/_helpers/mergeLayoutResults.d.mts +6 -0
- package/_helpers/mergeLayoutResults.mjs +16 -0
- package/_helpers/unit.cjs +16 -0
- package/_helpers/unit.d.cts +10 -0
- package/_helpers/unit.d.mts +11 -0
- package/_helpers/unit.mjs +15 -0
- package/_types.cjs +0 -0
- package/_types.d.cts +118 -0
- package/_types.d.mts +118 -0
- package/_types.mjs +1 -0
- package/_virtual/_rolldown/runtime.cjs +29 -0
- package/balance/balance.cjs +34 -0
- package/balance/balance.d.cts +11 -0
- package/balance/balance.d.mts +12 -0
- package/balance/balance.mjs +31 -0
- package/balance/index.cjs +3 -0
- package/balance/index.d.cts +3 -0
- package/balance/index.d.mts +3 -0
- package/balance/index.mjs +3 -0
- package/balance/styles.css +109 -0
- package/balance/types.cjs +0 -0
- package/balance/types.d.cts +6 -0
- package/balance/types.d.mts +6 -0
- package/balance/types.mjs +1 -0
- package/constants.cjs +341 -0
- package/constants.d.cts +299 -0
- package/constants.d.mts +299 -0
- package/constants.mjs +288 -0
- package/flow/flow.cjs +70 -0
- package/flow/flow.d.cts +12 -0
- package/flow/flow.d.mts +13 -0
- package/flow/flow.mjs +67 -0
- package/flow/index.cjs +3 -0
- package/flow/index.d.cts +3 -0
- package/flow/index.d.mts +3 -0
- package/flow/index.mjs +3 -0
- package/flow/styles.css +162 -0
- package/flow/types.cjs +0 -0
- package/flow/types.d.cts +21 -0
- package/flow/types.d.mts +21 -0
- package/flow/types.mjs +1 -0
- package/index.cjs +23 -0
- package/index.d.cts +16 -0
- package/index.d.mts +16 -0
- package/index.mjs +16 -0
- package/matrix/index.cjs +3 -0
- package/matrix/index.d.cts +3 -0
- package/matrix/index.d.mts +3 -0
- package/matrix/index.mjs +3 -0
- package/matrix/matrix.cjs +109 -0
- package/matrix/matrix.d.cts +11 -0
- package/matrix/matrix.d.mts +12 -0
- package/matrix/matrix.mjs +106 -0
- package/matrix/styles.css +59 -0
- package/matrix/types.cjs +0 -0
- package/matrix/types.d.cts +46 -0
- package/matrix/types.d.mts +46 -0
- package/matrix/types.mjs +1 -0
- package/pack/index.cjs +3 -0
- package/pack/index.d.cts +3 -0
- package/pack/index.d.mts +3 -0
- package/pack/index.mjs +3 -0
- package/pack/pack.cjs +28 -0
- package/pack/pack.d.cts +11 -0
- package/pack/pack.d.mts +12 -0
- package/pack/pack.mjs +25 -0
- package/pack/styles.css +27 -0
- package/pack/types.cjs +0 -0
- package/pack/types.d.cts +6 -0
- package/pack/types.d.mts +6 -0
- package/pack/types.mjs +1 -0
- package/package.json +45 -0
- package/pin/index.cjs +3 -0
- package/pin/index.d.cts +3 -0
- package/pin/index.d.mts +3 -0
- package/pin/index.mjs +3 -0
- package/pin/pin.cjs +22 -0
- package/pin/pin.d.cts +11 -0
- package/pin/pin.d.mts +12 -0
- package/pin/pin.mjs +22 -0
- package/pin/styles.css +15 -0
- package/pin/types.cjs +0 -0
- package/pin/types.d.cts +6 -0
- package/pin/types.d.mts +6 -0
- package/pin/types.mjs +1 -0
- package/stack/index.cjs +3 -0
- package/stack/index.d.cts +3 -0
- package/stack/index.d.mts +3 -0
- package/stack/index.mjs +3 -0
- package/stack/stack.cjs +98 -0
- package/stack/stack.d.cts +11 -0
- package/stack/stack.d.mts +12 -0
- package/stack/stack.mjs +95 -0
- package/stack/styles.css +171 -0
- package/stack/types.cjs +0 -0
- package/stack/types.d.cts +21 -0
- package/stack/types.d.mts +21 -0
- package/stack/types.mjs +1 -0
- package/tile/index.cjs +3 -0
- package/tile/index.d.cts +3 -0
- package/tile/index.d.mts +3 -0
- package/tile/index.mjs +3 -0
- package/tile/styles.css +104 -0
- package/tile/tile.cjs +85 -0
- package/tile/tile.d.cts +12 -0
- package/tile/tile.d.mts +13 -0
- package/tile/tile.mjs +82 -0
- package/tile/types.cjs +0 -0
- package/tile/types.d.cts +9 -0
- package/tile/types.d.mts +9 -0
- package/tile/types.mjs +1 -0
- package/types.cjs +0 -0
- package/types.d.cts +23 -0
- package/types.d.mts +23 -0
- package/types.mjs +1 -0
package/constants.d.mts
ADDED
|
@@ -0,0 +1,299 @@
|
|
|
1
|
+
//#region src/constants.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* 整列方向
|
|
4
|
+
*/
|
|
5
|
+
declare const Direction: {
|
|
6
|
+
readonly x: "x";
|
|
7
|
+
readonly y: "y";
|
|
8
|
+
};
|
|
9
|
+
type Direction = (typeof Direction)[keyof typeof Direction];
|
|
10
|
+
/**
|
|
11
|
+
* 横位置
|
|
12
|
+
*
|
|
13
|
+
* - left: 左
|
|
14
|
+
* - center: 中央
|
|
15
|
+
* - right: 右
|
|
16
|
+
*/
|
|
17
|
+
declare const AlignXBase: {
|
|
18
|
+
readonly left: "left";
|
|
19
|
+
readonly center: "center";
|
|
20
|
+
readonly right: "right";
|
|
21
|
+
};
|
|
22
|
+
type AlignXBase = (typeof AlignXBase)[keyof typeof AlignXBase];
|
|
23
|
+
/**
|
|
24
|
+
* 横位置
|
|
25
|
+
*
|
|
26
|
+
* - left: 左
|
|
27
|
+
* - center: 中央
|
|
28
|
+
* - right: 右
|
|
29
|
+
* - space-between: 両端揃え
|
|
30
|
+
* - space-around: 両端余白あり均等
|
|
31
|
+
* - space-evenly: 完全均等
|
|
32
|
+
*/
|
|
33
|
+
declare const AlignX: {
|
|
34
|
+
readonly 'space-between': "space-between";
|
|
35
|
+
readonly 'space-around': "space-around";
|
|
36
|
+
readonly 'space-evenly': "space-evenly";
|
|
37
|
+
readonly left: "left";
|
|
38
|
+
readonly center: "center";
|
|
39
|
+
readonly right: "right";
|
|
40
|
+
};
|
|
41
|
+
type AlignX = (typeof AlignX)[keyof typeof AlignX];
|
|
42
|
+
/**
|
|
43
|
+
* 縦位置
|
|
44
|
+
*
|
|
45
|
+
* - top: 上
|
|
46
|
+
* - middle: 中央
|
|
47
|
+
* - bottom: 下
|
|
48
|
+
*/
|
|
49
|
+
declare const AlignYBase: {
|
|
50
|
+
readonly top: "top";
|
|
51
|
+
readonly middle: "middle";
|
|
52
|
+
readonly bottom: "bottom";
|
|
53
|
+
};
|
|
54
|
+
type AlignYBase = (typeof AlignYBase)[keyof typeof AlignYBase];
|
|
55
|
+
/**
|
|
56
|
+
* 縦位置(items用)
|
|
57
|
+
*
|
|
58
|
+
* - top: 上
|
|
59
|
+
* - middle: 中央
|
|
60
|
+
* - bottom: 下
|
|
61
|
+
* - space-between: 両端揃え
|
|
62
|
+
* - space-around: 両端余白あり均等
|
|
63
|
+
* - space-evenly: 完全均等
|
|
64
|
+
*/
|
|
65
|
+
declare const AlignY: {
|
|
66
|
+
readonly 'space-between': "space-between";
|
|
67
|
+
readonly 'space-around': "space-around";
|
|
68
|
+
readonly 'space-evenly': "space-evenly";
|
|
69
|
+
readonly top: "top";
|
|
70
|
+
readonly middle: "middle";
|
|
71
|
+
readonly bottom: "bottom";
|
|
72
|
+
};
|
|
73
|
+
type AlignY = (typeof AlignY)[keyof typeof AlignY];
|
|
74
|
+
/**
|
|
75
|
+
* 親要素のサイズを基準にした子要素のサイズ調整
|
|
76
|
+
*
|
|
77
|
+
* - `none`
|
|
78
|
+
* - 親のサイズに足りないとき: そのまま
|
|
79
|
+
* - 親のサイズを超えるとき: そのまま
|
|
80
|
+
*/
|
|
81
|
+
declare const AdjustBase: {
|
|
82
|
+
readonly none: "none";
|
|
83
|
+
};
|
|
84
|
+
type AdjustBase = (typeof AdjustBase)[keyof typeof AdjustBase];
|
|
85
|
+
/**
|
|
86
|
+
* 親要素のサイズを基準にした子要素のサイズ調整
|
|
87
|
+
*
|
|
88
|
+
* - `none`
|
|
89
|
+
* - 親のサイズに足りないとき: そのまま
|
|
90
|
+
* - 親のサイズを超えるとき: そのまま
|
|
91
|
+
* - `fit`
|
|
92
|
+
* - 親のサイズに足りないとき: 伸ばす
|
|
93
|
+
* - 親のサイズを超えるとき: 縮める
|
|
94
|
+
* - `grow`
|
|
95
|
+
* - 親のサイズに足りないとき: 伸ばす
|
|
96
|
+
* - 親のサイズを超えるとき: そのまま
|
|
97
|
+
* - `shrink`
|
|
98
|
+
* - 親のサイズに足りないとき: そのまま
|
|
99
|
+
* - 親のサイズを超えるとき: 縮める
|
|
100
|
+
*/
|
|
101
|
+
declare const Adjust: {
|
|
102
|
+
readonly fit: "fit";
|
|
103
|
+
readonly grow: "grow";
|
|
104
|
+
readonly shrink: "shrink";
|
|
105
|
+
readonly none: "none";
|
|
106
|
+
};
|
|
107
|
+
type Adjust = (typeof Adjust)[keyof typeof Adjust];
|
|
108
|
+
/**
|
|
109
|
+
* レイアウト種別: balance
|
|
110
|
+
*/
|
|
111
|
+
declare const clsLayoutBalance = "nws-layout-balance";
|
|
112
|
+
/**
|
|
113
|
+
* レイアウト種別: flow
|
|
114
|
+
*/
|
|
115
|
+
declare const clsLayoutFlow = "nws-layout-flow";
|
|
116
|
+
/**
|
|
117
|
+
* レイアウト種別: matrix
|
|
118
|
+
*/
|
|
119
|
+
declare const clsLayoutMatrix = "nws-layout-matrix";
|
|
120
|
+
/**
|
|
121
|
+
* レイアウト種別: pack
|
|
122
|
+
*/
|
|
123
|
+
declare const clsLayoutPack = "nws-layout-pack";
|
|
124
|
+
/**
|
|
125
|
+
* レイアウト種別: pin
|
|
126
|
+
*/
|
|
127
|
+
declare const clsLayoutPin = "nws-layout-pin";
|
|
128
|
+
/**
|
|
129
|
+
* レイアウト種別: stack
|
|
130
|
+
*/
|
|
131
|
+
declare const clsLayoutStack = "nws-layout-stack";
|
|
132
|
+
/**
|
|
133
|
+
* レイアウト種別: tile
|
|
134
|
+
*/
|
|
135
|
+
declare const clsLayoutTile = "nws-layout-tile";
|
|
136
|
+
/**
|
|
137
|
+
* 間隔: 横方向
|
|
138
|
+
*/
|
|
139
|
+
declare const clsLayoutSpacingX = "nws-layout-spacingX";
|
|
140
|
+
/**
|
|
141
|
+
* 間隔: 縦方向
|
|
142
|
+
*/
|
|
143
|
+
declare const clsLayoutSpacingY = "nws-layout-spacingY";
|
|
144
|
+
/**
|
|
145
|
+
* 整列: 横方向
|
|
146
|
+
*/
|
|
147
|
+
declare const clsLayoutDirectionX = "nws-layout-direction-x";
|
|
148
|
+
/**
|
|
149
|
+
* 整列: 縦方向
|
|
150
|
+
*/
|
|
151
|
+
declare const clsLayoutDirectionY = "nws-layout-direction-y";
|
|
152
|
+
/**
|
|
153
|
+
* 横位置: 左
|
|
154
|
+
*/
|
|
155
|
+
declare const clsLayoutAlignXLeft = "nws-layout-alignX-left";
|
|
156
|
+
/**
|
|
157
|
+
* 横位置: 中央
|
|
158
|
+
*/
|
|
159
|
+
declare const clsLayoutAlignXCenter = "nws-layout-alignX-center";
|
|
160
|
+
/**
|
|
161
|
+
* 横位置: 右
|
|
162
|
+
*/
|
|
163
|
+
declare const clsLayoutAlignXRight = "nws-layout-alignX-right";
|
|
164
|
+
/**
|
|
165
|
+
* 横位置: 両端揃え
|
|
166
|
+
*/
|
|
167
|
+
declare const clsLayoutAlignXSpaceBetween = "nws-layout-alignX-spaceBetween";
|
|
168
|
+
/**
|
|
169
|
+
* 横位置: 両端余白あり均等
|
|
170
|
+
*/
|
|
171
|
+
declare const clsLayoutAlignXSpaceAround = "nws-layout-alignX-spaceAround";
|
|
172
|
+
/**
|
|
173
|
+
* 横位置: 完全均等
|
|
174
|
+
*/
|
|
175
|
+
declare const clsLayoutAlignXSpaceEvenly = "nws-layout-alignX-spaceEvenly";
|
|
176
|
+
/**
|
|
177
|
+
* 縦位置: 上
|
|
178
|
+
*/
|
|
179
|
+
declare const clsLayoutAlignYTop = "nws-layout-alignY-top";
|
|
180
|
+
/**
|
|
181
|
+
* 縦位置: 中央
|
|
182
|
+
*/
|
|
183
|
+
declare const clsLayoutAlignYMiddle = "nws-layout-alignY-middle";
|
|
184
|
+
/**
|
|
185
|
+
* 縦位置: 下
|
|
186
|
+
*/
|
|
187
|
+
declare const clsLayoutAlignYBottom = "nws-layout-alignY-bottom";
|
|
188
|
+
/**
|
|
189
|
+
* 縦位置: 両端揃え
|
|
190
|
+
*/
|
|
191
|
+
declare const clsLayoutAlignYSpaceBetween = "nws-layout-alignY-spaceBetween";
|
|
192
|
+
/**
|
|
193
|
+
* 縦位置: 両端余白あり均等
|
|
194
|
+
*/
|
|
195
|
+
declare const clsLayoutAlignYSpaceAround = "nws-layout-alignY-spaceAround";
|
|
196
|
+
/**
|
|
197
|
+
* 縦位置: 完全均等
|
|
198
|
+
*/
|
|
199
|
+
declare const clsLayoutAlignYSpaceEvenly = "nws-layout-alignY-spaceEvenly";
|
|
200
|
+
/**
|
|
201
|
+
* 子要素の横方向の数
|
|
202
|
+
*/
|
|
203
|
+
declare const clsLayoutChildCountX = "nws-layout-childCountX";
|
|
204
|
+
/**
|
|
205
|
+
* 子要素の縦方向の数
|
|
206
|
+
*/
|
|
207
|
+
declare const clsLayoutChildCountY = "nws-layout-childCountY";
|
|
208
|
+
/**
|
|
209
|
+
* 子要素の幅
|
|
210
|
+
*/
|
|
211
|
+
declare const clsLayoutChildSizeX = "nws-layout-childSizeX";
|
|
212
|
+
/**
|
|
213
|
+
* 子要素の高さ
|
|
214
|
+
*/
|
|
215
|
+
declare const clsLayoutChildSizeY = "nws-layout-childSizeY";
|
|
216
|
+
/**
|
|
217
|
+
* 子要素の幅調整: なし
|
|
218
|
+
*/
|
|
219
|
+
declare const clsLayoutAdjustXNone = "nws-layout-adjustX-none";
|
|
220
|
+
/**
|
|
221
|
+
* 子要素の幅調整: 伸ばす & 縮める
|
|
222
|
+
*/
|
|
223
|
+
declare const clsLayoutAdjustXFit = "nws-layout-adjustX-fit";
|
|
224
|
+
/**
|
|
225
|
+
* 子要素の幅調整: 伸ばす
|
|
226
|
+
*/
|
|
227
|
+
declare const clsLayoutAdjustXExpand = "nws-layout-adjustX-grow";
|
|
228
|
+
/**
|
|
229
|
+
* 子要素の幅調整: 縮める
|
|
230
|
+
*/
|
|
231
|
+
declare const clsLayoutAdjustXShrink = "nws-layout-adjustX-shrink";
|
|
232
|
+
/**
|
|
233
|
+
* 子要素の高さ調整: なし
|
|
234
|
+
*/
|
|
235
|
+
declare const clsLayoutAdjustYNone = "nws-layout-adjustY-none";
|
|
236
|
+
/**
|
|
237
|
+
* 子要素の高さ調整: 伸ばす & 縮める
|
|
238
|
+
*/
|
|
239
|
+
declare const clsLayoutAdjustYFit = "nws-layout-adjustY-fit";
|
|
240
|
+
/**
|
|
241
|
+
* 子要素の高さ調整: 伸ばす
|
|
242
|
+
*/
|
|
243
|
+
declare const clsLayoutAdjustYExpand = "nws-layout-adjustY-grow";
|
|
244
|
+
/**
|
|
245
|
+
* 子要素の高さ調整: 縮める
|
|
246
|
+
*/
|
|
247
|
+
declare const clsLayoutAdjustYShrink = "nws-layout-adjustY-shrink";
|
|
248
|
+
/**
|
|
249
|
+
* 変数\
|
|
250
|
+
* 間隔: 横方向
|
|
251
|
+
*/
|
|
252
|
+
declare const varLayoutSpacingX = "--nws-layout-spacingX";
|
|
253
|
+
/**
|
|
254
|
+
* 変数\
|
|
255
|
+
* 間隔: 縦方向
|
|
256
|
+
*/
|
|
257
|
+
declare const varLayoutSpacingY = "--nws-layout-spacingY";
|
|
258
|
+
/**
|
|
259
|
+
* 変数\
|
|
260
|
+
* 子要素の横方向の数
|
|
261
|
+
*/
|
|
262
|
+
declare const varLayoutChildCountX = "--nws-layout-childCountX";
|
|
263
|
+
/**
|
|
264
|
+
* 変数\
|
|
265
|
+
* 子要素の縦方向の数
|
|
266
|
+
*/
|
|
267
|
+
declare const varLayoutChildCountY = "--nws-layout-childCountY";
|
|
268
|
+
/**
|
|
269
|
+
* 変数\
|
|
270
|
+
* 子要素の幅
|
|
271
|
+
*/
|
|
272
|
+
declare const varLayoutChildSizeX = "--nws-layout-childSizeX";
|
|
273
|
+
/**
|
|
274
|
+
* 変数\
|
|
275
|
+
* 子要素の高さ
|
|
276
|
+
*/
|
|
277
|
+
declare const varLayoutChildSizeY = "--nws-layout-childSizeY";
|
|
278
|
+
/**
|
|
279
|
+
* 変数\
|
|
280
|
+
* 横方向のテンプレート
|
|
281
|
+
*/
|
|
282
|
+
declare const varLayoutTemplateX = "--nws-layout-childX";
|
|
283
|
+
/**
|
|
284
|
+
* 変数\
|
|
285
|
+
* 縦方向のテンプレート
|
|
286
|
+
*/
|
|
287
|
+
declare const varLayoutTemplateY = "--nws-layout-childY";
|
|
288
|
+
/**
|
|
289
|
+
* 変数\
|
|
290
|
+
* 横方向のオートトラック
|
|
291
|
+
*/
|
|
292
|
+
declare const varLayoutAutoTracX = "--nws-layout-autoTracX";
|
|
293
|
+
/**
|
|
294
|
+
* 変数\
|
|
295
|
+
* 縦方向のオートトラック
|
|
296
|
+
*/
|
|
297
|
+
declare const varLayoutAutoTracY = "--nws-layout-autoTracY";
|
|
298
|
+
//#endregion
|
|
299
|
+
export { Adjust, AdjustBase, AlignX, AlignXBase, AlignY, AlignYBase, Direction, clsLayoutAdjustXExpand, clsLayoutAdjustXFit, clsLayoutAdjustXNone, clsLayoutAdjustXShrink, clsLayoutAdjustYExpand, clsLayoutAdjustYFit, clsLayoutAdjustYNone, clsLayoutAdjustYShrink, clsLayoutAlignXCenter, clsLayoutAlignXLeft, clsLayoutAlignXRight, clsLayoutAlignXSpaceAround, clsLayoutAlignXSpaceBetween, clsLayoutAlignXSpaceEvenly, clsLayoutAlignYBottom, clsLayoutAlignYMiddle, clsLayoutAlignYSpaceAround, clsLayoutAlignYSpaceBetween, clsLayoutAlignYSpaceEvenly, clsLayoutAlignYTop, clsLayoutBalance, clsLayoutChildCountX, clsLayoutChildCountY, clsLayoutChildSizeX, clsLayoutChildSizeY, clsLayoutDirectionX, clsLayoutDirectionY, clsLayoutFlow, clsLayoutMatrix, clsLayoutPack, clsLayoutPin, clsLayoutSpacingX, clsLayoutSpacingY, clsLayoutStack, clsLayoutTile, varLayoutAutoTracX, varLayoutAutoTracY, varLayoutChildCountX, varLayoutChildCountY, varLayoutChildSizeX, varLayoutChildSizeY, varLayoutSpacingX, varLayoutSpacingY, varLayoutTemplateX, varLayoutTemplateY };
|
package/constants.mjs
ADDED
|
@@ -0,0 +1,288 @@
|
|
|
1
|
+
//#region src/constants.ts
|
|
2
|
+
/**
|
|
3
|
+
* 整列方向
|
|
4
|
+
*/
|
|
5
|
+
const Direction = {
|
|
6
|
+
x: "x",
|
|
7
|
+
y: "y"
|
|
8
|
+
};
|
|
9
|
+
const AlignBetween = {
|
|
10
|
+
"space-between": "space-between",
|
|
11
|
+
"space-around": "space-around",
|
|
12
|
+
"space-evenly": "space-evenly"
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* 横位置
|
|
16
|
+
*
|
|
17
|
+
* - left: 左
|
|
18
|
+
* - center: 中央
|
|
19
|
+
* - right: 右
|
|
20
|
+
*/
|
|
21
|
+
const AlignXBase = {
|
|
22
|
+
left: "left",
|
|
23
|
+
center: "center",
|
|
24
|
+
right: "right"
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* 横位置
|
|
28
|
+
*
|
|
29
|
+
* - left: 左
|
|
30
|
+
* - center: 中央
|
|
31
|
+
* - right: 右
|
|
32
|
+
* - space-between: 両端揃え
|
|
33
|
+
* - space-around: 両端余白あり均等
|
|
34
|
+
* - space-evenly: 完全均等
|
|
35
|
+
*/
|
|
36
|
+
const AlignX = {
|
|
37
|
+
...AlignXBase,
|
|
38
|
+
...AlignBetween
|
|
39
|
+
};
|
|
40
|
+
/**
|
|
41
|
+
* 縦位置
|
|
42
|
+
*
|
|
43
|
+
* - top: 上
|
|
44
|
+
* - middle: 中央
|
|
45
|
+
* - bottom: 下
|
|
46
|
+
*/
|
|
47
|
+
const AlignYBase = {
|
|
48
|
+
top: "top",
|
|
49
|
+
middle: "middle",
|
|
50
|
+
bottom: "bottom"
|
|
51
|
+
};
|
|
52
|
+
/**
|
|
53
|
+
* 縦位置(items用)
|
|
54
|
+
*
|
|
55
|
+
* - top: 上
|
|
56
|
+
* - middle: 中央
|
|
57
|
+
* - bottom: 下
|
|
58
|
+
* - space-between: 両端揃え
|
|
59
|
+
* - space-around: 両端余白あり均等
|
|
60
|
+
* - space-evenly: 完全均等
|
|
61
|
+
*/
|
|
62
|
+
const AlignY = {
|
|
63
|
+
...AlignYBase,
|
|
64
|
+
...AlignBetween
|
|
65
|
+
};
|
|
66
|
+
/**
|
|
67
|
+
* 親要素のサイズを基準にした子要素のサイズ調整
|
|
68
|
+
*
|
|
69
|
+
* - `none`
|
|
70
|
+
* - 親のサイズに足りないとき: そのまま
|
|
71
|
+
* - 親のサイズを超えるとき: そのまま
|
|
72
|
+
*/
|
|
73
|
+
const AdjustBase = { none: "none" };
|
|
74
|
+
/**
|
|
75
|
+
* 親要素のサイズを基準にした子要素のサイズ調整
|
|
76
|
+
*
|
|
77
|
+
* - `none`
|
|
78
|
+
* - 親のサイズに足りないとき: そのまま
|
|
79
|
+
* - 親のサイズを超えるとき: そのまま
|
|
80
|
+
* - `fit`
|
|
81
|
+
* - 親のサイズに足りないとき: 伸ばす
|
|
82
|
+
* - 親のサイズを超えるとき: 縮める
|
|
83
|
+
* - `grow`
|
|
84
|
+
* - 親のサイズに足りないとき: 伸ばす
|
|
85
|
+
* - 親のサイズを超えるとき: そのまま
|
|
86
|
+
* - `shrink`
|
|
87
|
+
* - 親のサイズに足りないとき: そのまま
|
|
88
|
+
* - 親のサイズを超えるとき: 縮める
|
|
89
|
+
*/
|
|
90
|
+
const Adjust = {
|
|
91
|
+
...AdjustBase,
|
|
92
|
+
fit: "fit",
|
|
93
|
+
grow: "grow",
|
|
94
|
+
shrink: "shrink"
|
|
95
|
+
};
|
|
96
|
+
/**
|
|
97
|
+
* レイアウト種別: balance
|
|
98
|
+
*/
|
|
99
|
+
const clsLayoutBalance = "nws-layout-balance";
|
|
100
|
+
/**
|
|
101
|
+
* レイアウト種別: flow
|
|
102
|
+
*/
|
|
103
|
+
const clsLayoutFlow = "nws-layout-flow";
|
|
104
|
+
/**
|
|
105
|
+
* レイアウト種別: matrix
|
|
106
|
+
*/
|
|
107
|
+
const clsLayoutMatrix = "nws-layout-matrix";
|
|
108
|
+
/**
|
|
109
|
+
* レイアウト種別: pack
|
|
110
|
+
*/
|
|
111
|
+
const clsLayoutPack = "nws-layout-pack";
|
|
112
|
+
/**
|
|
113
|
+
* レイアウト種別: pin
|
|
114
|
+
*/
|
|
115
|
+
const clsLayoutPin = "nws-layout-pin";
|
|
116
|
+
/**
|
|
117
|
+
* レイアウト種別: stack
|
|
118
|
+
*/
|
|
119
|
+
const clsLayoutStack = "nws-layout-stack";
|
|
120
|
+
/**
|
|
121
|
+
* レイアウト種別: tile
|
|
122
|
+
*/
|
|
123
|
+
const clsLayoutTile = "nws-layout-tile";
|
|
124
|
+
/**
|
|
125
|
+
* 間隔: 横方向
|
|
126
|
+
*/
|
|
127
|
+
const clsLayoutSpacingX = "nws-layout-spacingX";
|
|
128
|
+
/**
|
|
129
|
+
* 間隔: 縦方向
|
|
130
|
+
*/
|
|
131
|
+
const clsLayoutSpacingY = "nws-layout-spacingY";
|
|
132
|
+
/**
|
|
133
|
+
* 整列: 横方向
|
|
134
|
+
*/
|
|
135
|
+
const clsLayoutDirectionX = "nws-layout-direction-x";
|
|
136
|
+
/**
|
|
137
|
+
* 整列: 縦方向
|
|
138
|
+
*/
|
|
139
|
+
const clsLayoutDirectionY = "nws-layout-direction-y";
|
|
140
|
+
/**
|
|
141
|
+
* 横位置: 左
|
|
142
|
+
*/
|
|
143
|
+
const clsLayoutAlignXLeft = "nws-layout-alignX-left";
|
|
144
|
+
/**
|
|
145
|
+
* 横位置: 中央
|
|
146
|
+
*/
|
|
147
|
+
const clsLayoutAlignXCenter = "nws-layout-alignX-center";
|
|
148
|
+
/**
|
|
149
|
+
* 横位置: 右
|
|
150
|
+
*/
|
|
151
|
+
const clsLayoutAlignXRight = "nws-layout-alignX-right";
|
|
152
|
+
/**
|
|
153
|
+
* 横位置: 両端揃え
|
|
154
|
+
*/
|
|
155
|
+
const clsLayoutAlignXSpaceBetween = "nws-layout-alignX-spaceBetween";
|
|
156
|
+
/**
|
|
157
|
+
* 横位置: 両端余白あり均等
|
|
158
|
+
*/
|
|
159
|
+
const clsLayoutAlignXSpaceAround = "nws-layout-alignX-spaceAround";
|
|
160
|
+
/**
|
|
161
|
+
* 横位置: 完全均等
|
|
162
|
+
*/
|
|
163
|
+
const clsLayoutAlignXSpaceEvenly = "nws-layout-alignX-spaceEvenly";
|
|
164
|
+
/**
|
|
165
|
+
* 縦位置: 上
|
|
166
|
+
*/
|
|
167
|
+
const clsLayoutAlignYTop = "nws-layout-alignY-top";
|
|
168
|
+
/**
|
|
169
|
+
* 縦位置: 中央
|
|
170
|
+
*/
|
|
171
|
+
const clsLayoutAlignYMiddle = "nws-layout-alignY-middle";
|
|
172
|
+
/**
|
|
173
|
+
* 縦位置: 下
|
|
174
|
+
*/
|
|
175
|
+
const clsLayoutAlignYBottom = "nws-layout-alignY-bottom";
|
|
176
|
+
/**
|
|
177
|
+
* 縦位置: 両端揃え
|
|
178
|
+
*/
|
|
179
|
+
const clsLayoutAlignYSpaceBetween = "nws-layout-alignY-spaceBetween";
|
|
180
|
+
/**
|
|
181
|
+
* 縦位置: 両端余白あり均等
|
|
182
|
+
*/
|
|
183
|
+
const clsLayoutAlignYSpaceAround = "nws-layout-alignY-spaceAround";
|
|
184
|
+
/**
|
|
185
|
+
* 縦位置: 完全均等
|
|
186
|
+
*/
|
|
187
|
+
const clsLayoutAlignYSpaceEvenly = "nws-layout-alignY-spaceEvenly";
|
|
188
|
+
/**
|
|
189
|
+
* 子要素の横方向の数
|
|
190
|
+
*/
|
|
191
|
+
const clsLayoutChildCountX = "nws-layout-childCountX";
|
|
192
|
+
/**
|
|
193
|
+
* 子要素の縦方向の数
|
|
194
|
+
*/
|
|
195
|
+
const clsLayoutChildCountY = "nws-layout-childCountY";
|
|
196
|
+
/**
|
|
197
|
+
* 子要素の幅
|
|
198
|
+
*/
|
|
199
|
+
const clsLayoutChildSizeX = "nws-layout-childSizeX";
|
|
200
|
+
/**
|
|
201
|
+
* 子要素の高さ
|
|
202
|
+
*/
|
|
203
|
+
const clsLayoutChildSizeY = "nws-layout-childSizeY";
|
|
204
|
+
/**
|
|
205
|
+
* 子要素の幅調整: なし
|
|
206
|
+
*/
|
|
207
|
+
const clsLayoutAdjustXNone = "nws-layout-adjustX-none";
|
|
208
|
+
/**
|
|
209
|
+
* 子要素の幅調整: 伸ばす & 縮める
|
|
210
|
+
*/
|
|
211
|
+
const clsLayoutAdjustXFit = "nws-layout-adjustX-fit";
|
|
212
|
+
/**
|
|
213
|
+
* 子要素の幅調整: 伸ばす
|
|
214
|
+
*/
|
|
215
|
+
const clsLayoutAdjustXExpand = "nws-layout-adjustX-grow";
|
|
216
|
+
/**
|
|
217
|
+
* 子要素の幅調整: 縮める
|
|
218
|
+
*/
|
|
219
|
+
const clsLayoutAdjustXShrink = "nws-layout-adjustX-shrink";
|
|
220
|
+
/**
|
|
221
|
+
* 子要素の高さ調整: なし
|
|
222
|
+
*/
|
|
223
|
+
const clsLayoutAdjustYNone = "nws-layout-adjustY-none";
|
|
224
|
+
/**
|
|
225
|
+
* 子要素の高さ調整: 伸ばす & 縮める
|
|
226
|
+
*/
|
|
227
|
+
const clsLayoutAdjustYFit = "nws-layout-adjustY-fit";
|
|
228
|
+
/**
|
|
229
|
+
* 子要素の高さ調整: 伸ばす
|
|
230
|
+
*/
|
|
231
|
+
const clsLayoutAdjustYExpand = "nws-layout-adjustY-grow";
|
|
232
|
+
/**
|
|
233
|
+
* 子要素の高さ調整: 縮める
|
|
234
|
+
*/
|
|
235
|
+
const clsLayoutAdjustYShrink = "nws-layout-adjustY-shrink";
|
|
236
|
+
/**
|
|
237
|
+
* 変数\
|
|
238
|
+
* 間隔: 横方向
|
|
239
|
+
*/
|
|
240
|
+
const varLayoutSpacingX = "--nws-layout-spacingX";
|
|
241
|
+
/**
|
|
242
|
+
* 変数\
|
|
243
|
+
* 間隔: 縦方向
|
|
244
|
+
*/
|
|
245
|
+
const varLayoutSpacingY = "--nws-layout-spacingY";
|
|
246
|
+
/**
|
|
247
|
+
* 変数\
|
|
248
|
+
* 子要素の横方向の数
|
|
249
|
+
*/
|
|
250
|
+
const varLayoutChildCountX = "--nws-layout-childCountX";
|
|
251
|
+
/**
|
|
252
|
+
* 変数\
|
|
253
|
+
* 子要素の縦方向の数
|
|
254
|
+
*/
|
|
255
|
+
const varLayoutChildCountY = "--nws-layout-childCountY";
|
|
256
|
+
/**
|
|
257
|
+
* 変数\
|
|
258
|
+
* 子要素の幅
|
|
259
|
+
*/
|
|
260
|
+
const varLayoutChildSizeX = "--nws-layout-childSizeX";
|
|
261
|
+
/**
|
|
262
|
+
* 変数\
|
|
263
|
+
* 子要素の高さ
|
|
264
|
+
*/
|
|
265
|
+
const varLayoutChildSizeY = "--nws-layout-childSizeY";
|
|
266
|
+
/**
|
|
267
|
+
* 変数\
|
|
268
|
+
* 横方向のテンプレート
|
|
269
|
+
*/
|
|
270
|
+
const varLayoutTemplateX = "--nws-layout-childX";
|
|
271
|
+
/**
|
|
272
|
+
* 変数\
|
|
273
|
+
* 縦方向のテンプレート
|
|
274
|
+
*/
|
|
275
|
+
const varLayoutTemplateY = "--nws-layout-childY";
|
|
276
|
+
/**
|
|
277
|
+
* 変数\
|
|
278
|
+
* 横方向のオートトラック
|
|
279
|
+
*/
|
|
280
|
+
const varLayoutAutoTracX = "--nws-layout-autoTracX";
|
|
281
|
+
/**
|
|
282
|
+
* 変数\
|
|
283
|
+
* 縦方向のオートトラック
|
|
284
|
+
*/
|
|
285
|
+
const varLayoutAutoTracY = "--nws-layout-autoTracY";
|
|
286
|
+
|
|
287
|
+
//#endregion
|
|
288
|
+
export { Adjust, AdjustBase, AlignX, AlignXBase, AlignY, AlignYBase, Direction, clsLayoutAdjustXExpand, clsLayoutAdjustXFit, clsLayoutAdjustXNone, clsLayoutAdjustXShrink, clsLayoutAdjustYExpand, clsLayoutAdjustYFit, clsLayoutAdjustYNone, clsLayoutAdjustYShrink, clsLayoutAlignXCenter, clsLayoutAlignXLeft, clsLayoutAlignXRight, clsLayoutAlignXSpaceAround, clsLayoutAlignXSpaceBetween, clsLayoutAlignXSpaceEvenly, clsLayoutAlignYBottom, clsLayoutAlignYMiddle, clsLayoutAlignYSpaceAround, clsLayoutAlignYSpaceBetween, clsLayoutAlignYSpaceEvenly, clsLayoutAlignYTop, clsLayoutBalance, clsLayoutChildCountX, clsLayoutChildCountY, clsLayoutChildSizeX, clsLayoutChildSizeY, clsLayoutDirectionX, clsLayoutDirectionY, clsLayoutFlow, clsLayoutMatrix, clsLayoutPack, clsLayoutPin, clsLayoutSpacingX, clsLayoutSpacingY, clsLayoutStack, clsLayoutTile, varLayoutAutoTracX, varLayoutAutoTracY, varLayoutChildCountX, varLayoutChildCountY, varLayoutChildSizeX, varLayoutChildSizeY, varLayoutSpacingX, varLayoutSpacingY, varLayoutTemplateX, varLayoutTemplateY };
|
package/flow/flow.cjs
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
|
|
2
|
+
const require_constants = require('../constants.cjs');
|
|
3
|
+
const require__constants = require('../_constants.cjs');
|
|
4
|
+
const require__helpers_hasValue = require('../_helpers/hasValue.cjs');
|
|
5
|
+
const require__helpers_unit = require('../_helpers/unit.cjs');
|
|
6
|
+
const require__helpers_applySpacing = require('../_helpers/applySpacing.cjs');
|
|
7
|
+
const require__helpers_mergeLayoutResults = require('../_helpers/mergeLayoutResults.cjs');
|
|
8
|
+
require('./styles.cjs');
|
|
9
|
+
let _niche_works_utils_object_maybeDefault = require("@niche-works/utils/object/maybeDefault");
|
|
10
|
+
_niche_works_utils_object_maybeDefault = require_runtime.__toESM(_niche_works_utils_object_maybeDefault, 1);
|
|
11
|
+
let clsx = require("clsx");
|
|
12
|
+
clsx = require_runtime.__toESM(clsx, 1);
|
|
13
|
+
|
|
14
|
+
//#region src/flow/flow.ts
|
|
15
|
+
/**
|
|
16
|
+
* flowレイアウト
|
|
17
|
+
*
|
|
18
|
+
* - 子要素を並べて配置し、親要素のサイズに達したら折り返す
|
|
19
|
+
* - stackとの違いは flex-wrap: wrap が常に有効な点
|
|
20
|
+
*/
|
|
21
|
+
const flow = (options = {}) => {
|
|
22
|
+
const { direction, alignX, alignY, adjustX, adjustY, spacing, spacingX = spacing, spacingY = spacing, childSizeX, childSizeY } = (0, _niche_works_utils_object_maybeDefault.default)(options, {
|
|
23
|
+
direction: "x",
|
|
24
|
+
alignX: "left",
|
|
25
|
+
alignY: "top"
|
|
26
|
+
}, { overwriteNull: true });
|
|
27
|
+
const result = {
|
|
28
|
+
className: (0, clsx.default)(require_constants.clsLayoutFlow, require__constants.clsLayoutDirection[direction], require__constants.clsLayoutAlign.x[alignX], require__constants.clsLayoutAlign.y[alignY]),
|
|
29
|
+
style: {}
|
|
30
|
+
};
|
|
31
|
+
require__helpers_applySpacing(result, spacing, spacingX, spacingY);
|
|
32
|
+
const resultList = [result];
|
|
33
|
+
if (direction === "x") {
|
|
34
|
+
resultList.push(_getFlowMainAxisStyle("x", alignX, adjustX, childSizeX));
|
|
35
|
+
resultList.push(_getFlowCrossAxisStyle("y", alignY, childSizeY));
|
|
36
|
+
} else {
|
|
37
|
+
resultList.push(_getFlowCrossAxisStyle("x", alignX, childSizeX));
|
|
38
|
+
resultList.push(_getFlowMainAxisStyle("y", alignY, adjustY, childSizeY));
|
|
39
|
+
}
|
|
40
|
+
return require__helpers_mergeLayoutResults(resultList);
|
|
41
|
+
};
|
|
42
|
+
/**
|
|
43
|
+
* 主軸方向のスタイル
|
|
44
|
+
*
|
|
45
|
+
* stackの _getStackMainAxisStyle に相当。flowでは主軸の挙動はstackと同じ。
|
|
46
|
+
*/
|
|
47
|
+
function _getFlowMainAxisStyle(axis, align, adjust, childSize) {
|
|
48
|
+
const result = { className: (0, clsx.default)(require__constants.clsLayoutAlign[axis][align], require__constants.clsLayoutAdjust[axis][adjust]) };
|
|
49
|
+
if (require__helpers_hasValue(childSize)) {
|
|
50
|
+
result.className = (0, clsx.default)(result.className, require__constants.clsLayoutChildSize[axis]);
|
|
51
|
+
result.style = { [require__constants.varLayoutChildSize[axis]]: require__helpers_unit(childSize) };
|
|
52
|
+
}
|
|
53
|
+
return result;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* 交差軸方向のスタイル
|
|
57
|
+
*
|
|
58
|
+
* stackの _getStackClossAxisStyle に相当。
|
|
59
|
+
* flowは交差軸方向のadjustはできないため、常にnoneのスタイルを返す
|
|
60
|
+
*/
|
|
61
|
+
function _getFlowCrossAxisStyle(axis, align, childSize) {
|
|
62
|
+
if (require__helpers_hasValue(childSize)) return {
|
|
63
|
+
className: (0, clsx.default)(require__constants.clsLayoutAlign[axis][align], require__constants.clsLayoutChildSize[axis]),
|
|
64
|
+
style: { [require__constants.varLayoutChildSize[axis]]: require__helpers_unit(childSize) }
|
|
65
|
+
};
|
|
66
|
+
else return { className: require__constants.clsLayoutAlign[axis][align] };
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
//#endregion
|
|
70
|
+
module.exports = flow;
|
package/flow/flow.d.cts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { CreateLayout } from "../types.cjs";
|
|
2
|
+
import { FlowLayoutOptions } from "./types.cjs";
|
|
3
|
+
|
|
4
|
+
//#region src/flow/flow.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* flowレイアウト
|
|
7
|
+
*
|
|
8
|
+
* - 子要素を並べて配置し、親要素のサイズに達したら折り返す
|
|
9
|
+
* - stackとの違いは flex-wrap: wrap が常に有効な点
|
|
10
|
+
*/
|
|
11
|
+
declare const flow: CreateLayout<FlowLayoutOptions>;
|
|
12
|
+
export = flow;
|
package/flow/flow.d.mts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { CreateLayout } from "../types.mjs";
|
|
2
|
+
import { FlowLayoutOptions } from "./types.mjs";
|
|
3
|
+
|
|
4
|
+
//#region src/flow/flow.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* flowレイアウト
|
|
7
|
+
*
|
|
8
|
+
* - 子要素を並べて配置し、親要素のサイズに達したら折り返す
|
|
9
|
+
* - stackとの違いは flex-wrap: wrap が常に有効な点
|
|
10
|
+
*/
|
|
11
|
+
declare const flow: CreateLayout<FlowLayoutOptions>;
|
|
12
|
+
//#endregion
|
|
13
|
+
export { flow as default };
|