@niche-works/style-layouts 0.3.1 → 0.4.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.ja.md +3 -3
- package/README.md +6 -6
- package/balance/index.cjs +6 -2
- package/balance/index.mjs +6 -2
- package/center/index.cjs +6 -2
- package/center/index.mjs +6 -2
- package/constants.cjs +1 -50
- package/constants.d.cts +2 -2
- package/constants.d.mts +2 -2
- package/constants.mjs +2 -2
- package/core/_constants.cjs +287 -34
- package/core/_constants.d.cts +206 -1
- package/core/_constants.d.mts +206 -1
- package/core/_constants.mjs +206 -3
- package/core/_internal/applyChildCount.cjs +6 -8
- package/core/_internal/applyChildCount.mjs +6 -6
- package/core/_internal/applyChildRatio.cjs +4 -6
- package/core/_internal/applyChildRatio.mjs +3 -3
- package/core/_internal/applyChildSize.cjs +6 -8
- package/core/_internal/applyChildSize.mjs +4 -4
- package/core/_internal/applyGap.cjs +6 -8
- package/core/_internal/applyGap.mjs +4 -4
- package/core/_internal/mergeClassName.cjs +11 -0
- package/core/_internal/mergeClassName.d.cts +3 -0
- package/core/_internal/mergeClassName.d.mts +4 -0
- package/core/_internal/mergeClassName.mjs +10 -0
- package/core/_internal/mergeLayoutResults.cjs +2 -4
- package/core/_internal/mergeLayoutResults.mjs +2 -2
- package/core/_types.d.cts +1 -9
- package/core/_types.d.mts +1 -9
- package/core/balance/balance.cjs +4 -4
- package/core/balance/balance.d.cts +2 -0
- package/core/balance/balance.d.mts +2 -0
- package/core/balance/balance.mjs +5 -4
- package/core/balance/styles.css +32 -0
- package/core/center/center.cjs +3 -4
- package/core/center/center.d.cts +1 -0
- package/core/center/center.d.mts +1 -0
- package/core/center/center.mjs +4 -4
- package/core/constants.cjs +4 -255
- package/core/constants.d.cts +4 -206
- package/core/constants.d.mts +4 -206
- package/core/constants.mjs +4 -206
- package/core/flow/flow.cjs +5 -7
- package/core/flow/flow.mjs +6 -7
- package/core/index.d.cts +2 -2
- package/core/index.d.mts +2 -2
- package/core/layer/layer.cjs +2 -4
- package/core/layer/layer.mjs +3 -4
- package/core/matrix/matrix.cjs +3 -4
- package/core/matrix/matrix.d.cts +1 -0
- package/core/matrix/matrix.d.mts +1 -0
- package/core/matrix/matrix.mjs +4 -4
- package/core/pack/pack.cjs +2 -4
- package/core/pack/pack.mjs +3 -4
- package/core/pin/pin.cjs +2 -2
- package/core/pin/pin.mjs +1 -1
- package/core/stack/stack.cjs +12 -14
- package/core/stack/stack.d.cts +1 -1
- package/core/stack/stack.d.mts +1 -1
- package/core/stack/stack.mjs +13 -14
- package/core/styles.css +32 -0
- package/core/tile/tile.cjs +2 -4
- package/core/tile/tile.mjs +3 -4
- package/core/types.d.cts +7 -2
- package/core/types.d.mts +7 -2
- package/flow/index.cjs +6 -2
- package/flow/index.mjs +6 -2
- package/helpers/_internal/constants.cjs +25 -0
- package/helpers/_internal/constants.d.cts +13 -0
- package/helpers/_internal/constants.d.mts +13 -0
- package/helpers/_internal/constants.mjs +16 -0
- package/helpers/_internal/createExtractLayoutOptions.cjs +25 -0
- package/helpers/_internal/createExtractLayoutOptions.d.cts +8 -0
- package/helpers/_internal/createExtractLayoutOptions.d.mts +9 -0
- package/helpers/_internal/createExtractLayoutOptions.mjs +24 -0
- package/helpers/extractBalanceOptions.cjs +15 -0
- package/helpers/extractBalanceOptions.d.cts +5 -0
- package/helpers/extractBalanceOptions.d.mts +6 -0
- package/helpers/extractBalanceOptions.mjs +15 -0
- package/helpers/extractCenterOptions.cjs +14 -0
- package/helpers/extractCenterOptions.d.cts +6 -0
- package/helpers/extractCenterOptions.d.mts +7 -0
- package/helpers/extractCenterOptions.mjs +14 -0
- package/helpers/extractFlowOptions.cjs +15 -0
- package/helpers/extractFlowOptions.d.cts +6 -0
- package/helpers/extractFlowOptions.d.mts +7 -0
- package/helpers/extractFlowOptions.mjs +15 -0
- package/helpers/extractLayerOptions.cjs +13 -0
- package/helpers/extractLayerOptions.d.cts +6 -0
- package/helpers/extractLayerOptions.d.mts +7 -0
- package/helpers/extractLayerOptions.mjs +13 -0
- package/helpers/extractMatrixOptions.cjs +17 -0
- package/helpers/extractMatrixOptions.d.cts +5 -0
- package/helpers/extractMatrixOptions.d.mts +6 -0
- package/helpers/extractMatrixOptions.mjs +17 -0
- package/helpers/extractPackOptions.cjs +8 -0
- package/helpers/extractPackOptions.d.cts +6 -0
- package/helpers/extractPackOptions.d.mts +7 -0
- package/helpers/extractPackOptions.mjs +8 -0
- package/helpers/extractPinOptions.cjs +8 -0
- package/helpers/extractPinOptions.d.cts +6 -0
- package/helpers/extractPinOptions.d.mts +7 -0
- package/helpers/extractPinOptions.mjs +8 -0
- package/helpers/extractStackOptions.cjs +15 -0
- package/helpers/extractStackOptions.d.cts +6 -0
- package/helpers/extractStackOptions.d.mts +7 -0
- package/helpers/extractStackOptions.mjs +15 -0
- package/helpers/extractTileOptions.cjs +15 -0
- package/helpers/extractTileOptions.d.cts +6 -0
- package/helpers/extractTileOptions.d.mts +7 -0
- package/helpers/extractTileOptions.mjs +15 -0
- package/helpers/index.cjs +20 -0
- package/helpers/index.d.cts +10 -0
- package/helpers/index.d.mts +10 -0
- package/helpers/index.mjs +11 -0
- package/index.cjs +18 -18
- package/index.d.cts +2 -2
- package/index.d.mts +2 -2
- package/index.mjs +10 -10
- package/layer/index.cjs +6 -2
- package/layer/index.mjs +6 -2
- package/matrix/index.cjs +6 -2
- package/matrix/index.mjs +6 -2
- package/pack/index.cjs +6 -2
- package/pack/index.mjs +6 -2
- package/package.json +6 -4
- package/pin/index.cjs +6 -2
- package/pin/index.mjs +6 -2
- package/stack/index.cjs +6 -2
- package/stack/index.mjs +6 -2
- package/tile/index.cjs +6 -2
- package/tile/index.mjs +6 -2
- package/types.d.cts +2 -2
- package/types.d.mts +2 -2
- package/core/_internal/warnIfUnsupported.cjs +0 -15
- package/core/_internal/warnIfUnsupported.d.cts +0 -3
- package/core/_internal/warnIfUnsupported.d.mts +0 -4
- package/core/_internal/warnIfUnsupported.mjs +0 -14
package/core/constants.mjs
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
//#region src/core/constants.ts
|
|
2
2
|
/**
|
|
3
3
|
* 整列方向
|
|
4
|
+
*
|
|
5
|
+
* - x: 横方向
|
|
6
|
+
* - y: 縦方向
|
|
4
7
|
*/
|
|
5
8
|
const Direction = {
|
|
6
9
|
x: "x",
|
|
@@ -93,211 +96,6 @@ const Adjust = {
|
|
|
93
96
|
grow: "grow",
|
|
94
97
|
shrink: "shrink"
|
|
95
98
|
};
|
|
96
|
-
/**
|
|
97
|
-
* レイアウト種別: stack
|
|
98
|
-
*/
|
|
99
|
-
const clsLayoutStack = "nws-layout-stack";
|
|
100
|
-
/**
|
|
101
|
-
* レイアウト種別: flow
|
|
102
|
-
*/
|
|
103
|
-
const clsLayoutFlow = "nws-layout-flow";
|
|
104
|
-
/**
|
|
105
|
-
* レイアウト種別: tile
|
|
106
|
-
*/
|
|
107
|
-
const clsLayoutTile = "nws-layout-tile";
|
|
108
|
-
/**
|
|
109
|
-
* レイアウト種別: matrix
|
|
110
|
-
*/
|
|
111
|
-
const clsLayoutMatrix = "nws-layout-matrix";
|
|
112
|
-
/**
|
|
113
|
-
* レイアウト種別: center
|
|
114
|
-
*/
|
|
115
|
-
const clsLayoutCenter = "nws-layout-center";
|
|
116
|
-
/**
|
|
117
|
-
* レイアウト種別: pack
|
|
118
|
-
*/
|
|
119
|
-
const clsLayoutPack = "nws-layout-pack";
|
|
120
|
-
/**
|
|
121
|
-
* レイアウト種別: balance
|
|
122
|
-
*/
|
|
123
|
-
const clsLayoutBalance = "nws-layout-balance";
|
|
124
|
-
/**
|
|
125
|
-
* レイアウト種別: layer
|
|
126
|
-
*/
|
|
127
|
-
const clsLayoutLayer = "nws-layout-layer";
|
|
128
|
-
/**
|
|
129
|
-
* レイアウト種別: pin
|
|
130
|
-
*/
|
|
131
|
-
const clsLayoutPin = "nws-layout-pin";
|
|
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 clsLayoutAdjustXNone = "nws-layout-adjustX-none";
|
|
192
|
-
/**
|
|
193
|
-
* 子要素の幅調整: 伸ばす & 縮める
|
|
194
|
-
*/
|
|
195
|
-
const clsLayoutAdjustXFit = "nws-layout-adjustX-fit";
|
|
196
|
-
/**
|
|
197
|
-
* 子要素の幅調整: 伸ばす
|
|
198
|
-
*/
|
|
199
|
-
const clsLayoutAdjustXExpand = "nws-layout-adjustX-grow";
|
|
200
|
-
/**
|
|
201
|
-
* 子要素の幅調整: 縮める
|
|
202
|
-
*/
|
|
203
|
-
const clsLayoutAdjustXShrink = "nws-layout-adjustX-shrink";
|
|
204
|
-
/**
|
|
205
|
-
* 子要素の高さ調整: なし
|
|
206
|
-
*/
|
|
207
|
-
const clsLayoutAdjustYNone = "nws-layout-adjustY-none";
|
|
208
|
-
/**
|
|
209
|
-
* 子要素の高さ調整: 伸ばす & 縮める
|
|
210
|
-
*/
|
|
211
|
-
const clsLayoutAdjustYFit = "nws-layout-adjustY-fit";
|
|
212
|
-
/**
|
|
213
|
-
* 子要素の高さ調整: 伸ばす
|
|
214
|
-
*/
|
|
215
|
-
const clsLayoutAdjustYExpand = "nws-layout-adjustY-grow";
|
|
216
|
-
/**
|
|
217
|
-
* 子要素の高さ調整: 縮める
|
|
218
|
-
*/
|
|
219
|
-
const clsLayoutAdjustYShrink = "nws-layout-adjustY-shrink";
|
|
220
|
-
/**
|
|
221
|
-
* 間隔: 横方向
|
|
222
|
-
*/
|
|
223
|
-
const clsLayoutGapX = "nws-layout-gapX";
|
|
224
|
-
/**
|
|
225
|
-
* 間隔: 縦方向
|
|
226
|
-
*/
|
|
227
|
-
const clsLayoutGapY = "nws-layout-gapY";
|
|
228
|
-
/**
|
|
229
|
-
* 子要素の幅
|
|
230
|
-
*/
|
|
231
|
-
const clsLayoutChildSizeX = "nws-layout-childSizeX";
|
|
232
|
-
/**
|
|
233
|
-
* 子要素の高さ
|
|
234
|
-
*/
|
|
235
|
-
const clsLayoutChildSizeY = "nws-layout-childSizeY";
|
|
236
|
-
/**
|
|
237
|
-
* 子要素の縦横比
|
|
238
|
-
*/
|
|
239
|
-
const clsLayoutChildRatio = "nws-layout-childRatio";
|
|
240
|
-
/**
|
|
241
|
-
* 子要素の横方向の数
|
|
242
|
-
*/
|
|
243
|
-
const clsLayoutChildCountX = "nws-layout-childCountX";
|
|
244
|
-
/**
|
|
245
|
-
* 子要素の縦方向の数
|
|
246
|
-
*/
|
|
247
|
-
const clsLayoutChildCountY = "nws-layout-childCountY";
|
|
248
|
-
/**
|
|
249
|
-
* 横方向のテンプレート
|
|
250
|
-
*/
|
|
251
|
-
const clsLayoutTemplateX = "nws-layout-templateX";
|
|
252
|
-
/**
|
|
253
|
-
* 縦方向のテンプレート
|
|
254
|
-
*/
|
|
255
|
-
const clsLayoutTemplateY = "nws-layout-templateY";
|
|
256
|
-
/**
|
|
257
|
-
* 変数\
|
|
258
|
-
* 間隔: 横方向
|
|
259
|
-
*/
|
|
260
|
-
const varLayoutGapX = "--nws-layout-gapX";
|
|
261
|
-
/**
|
|
262
|
-
* 変数\
|
|
263
|
-
* 間隔: 縦方向
|
|
264
|
-
*/
|
|
265
|
-
const varLayoutGapY = "--nws-layout-gapY";
|
|
266
|
-
/**
|
|
267
|
-
* 変数\
|
|
268
|
-
* 子要素の幅
|
|
269
|
-
*/
|
|
270
|
-
const varLayoutChildSizeX = "--nws-layout-childSizeX";
|
|
271
|
-
/**
|
|
272
|
-
* 変数\
|
|
273
|
-
* 子要素の高さ
|
|
274
|
-
*/
|
|
275
|
-
const varLayoutChildSizeY = "--nws-layout-childSizeY";
|
|
276
|
-
/**
|
|
277
|
-
* 変数\
|
|
278
|
-
* 子要素の縦横比
|
|
279
|
-
*/
|
|
280
|
-
const varLayoutChildRatio = "--nws-layout-childRatio";
|
|
281
|
-
/**
|
|
282
|
-
* 変数\
|
|
283
|
-
* 子要素の横方向の数
|
|
284
|
-
*/
|
|
285
|
-
const varLayoutChildCountX = "--nws-layout-childCountX";
|
|
286
|
-
/**
|
|
287
|
-
* 変数\
|
|
288
|
-
* 子要素の縦方向の数
|
|
289
|
-
*/
|
|
290
|
-
const varLayoutChildCountY = "--nws-layout-childCountY";
|
|
291
|
-
/**
|
|
292
|
-
* 変数\
|
|
293
|
-
* 横方向のテンプレート
|
|
294
|
-
*/
|
|
295
|
-
const varLayoutTemplateX = "--nws-layout-templateX";
|
|
296
|
-
/**
|
|
297
|
-
* 変数\
|
|
298
|
-
* 縦方向のテンプレート
|
|
299
|
-
*/
|
|
300
|
-
const varLayoutTemplateY = "--nws-layout-templateY";
|
|
301
99
|
|
|
302
100
|
//#endregion
|
|
303
|
-
export { Adjust, AdjustBase, AlignX, AlignXBase, AlignY, AlignYBase, Direction
|
|
101
|
+
export { Adjust, AdjustBase, AlignX, AlignXBase, AlignY, AlignYBase, Direction };
|
package/core/flow/flow.cjs
CHANGED
|
@@ -1,15 +1,13 @@
|
|
|
1
1
|
const require_runtime = require('../../_virtual/_rolldown/runtime.cjs');
|
|
2
|
-
const require_core_constants = require('../constants.cjs');
|
|
3
2
|
const require_core__constants = require('../_constants.cjs');
|
|
4
3
|
const require_core__internal_hasValue = require('../_internal/hasValue.cjs');
|
|
4
|
+
const require_core__internal_mergeClassName = require('../_internal/mergeClassName.cjs');
|
|
5
5
|
const require_core__internal_applyChildRatio = require('../_internal/applyChildRatio.cjs');
|
|
6
6
|
const require_core__internal_unit = require('../_internal/unit.cjs');
|
|
7
7
|
const require_core__internal_applyGap = require('../_internal/applyGap.cjs');
|
|
8
8
|
const require_core__internal_mergeLayoutResults = require('../_internal/mergeLayoutResults.cjs');
|
|
9
9
|
let _niche_works_utils_object_maybeDefault = require("@niche-works/utils/object/maybeDefault");
|
|
10
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
11
|
|
|
14
12
|
//#region src/core/flow/flow.ts
|
|
15
13
|
/**
|
|
@@ -25,7 +23,7 @@ const flow = (options = {}) => {
|
|
|
25
23
|
alignY: "top"
|
|
26
24
|
}, { overwriteNull: true });
|
|
27
25
|
const result = {
|
|
28
|
-
className: (
|
|
26
|
+
className: require_core__internal_mergeClassName(require_core__constants.clsLayoutFlow, require_core__constants.clsLayout.direction[direction], require_core__constants.clsLayout.align.x[alignX], require_core__constants.clsLayout.align.y[alignY]),
|
|
29
27
|
style: {}
|
|
30
28
|
};
|
|
31
29
|
require_core__internal_applyGap(result, gap, gapX, gapY);
|
|
@@ -46,9 +44,9 @@ const flow = (options = {}) => {
|
|
|
46
44
|
* stackの _getStackMainAxisStyle に相当。flowでは主軸の挙動はstackと同じ。
|
|
47
45
|
*/
|
|
48
46
|
function _getFlowMainAxisStyle(axis, align, adjust, childSize) {
|
|
49
|
-
const result = { className: (
|
|
47
|
+
const result = { className: require_core__internal_mergeClassName(require_core__constants.clsLayout.align[axis][align], require_core__constants.clsLayout.adjust[axis][adjust]) };
|
|
50
48
|
if (require_core__internal_hasValue(childSize)) {
|
|
51
|
-
result.className = (
|
|
49
|
+
result.className = require_core__internal_mergeClassName(result.className, require_core__constants.clsLayout.childSize[axis]);
|
|
52
50
|
result.style = { [require_core__constants.varLayout.childSize[axis]]: require_core__internal_unit(childSize) };
|
|
53
51
|
}
|
|
54
52
|
return result;
|
|
@@ -61,7 +59,7 @@ function _getFlowMainAxisStyle(axis, align, adjust, childSize) {
|
|
|
61
59
|
*/
|
|
62
60
|
function _getFlowCrossAxisStyle(axis, align, childSize) {
|
|
63
61
|
if (require_core__internal_hasValue(childSize)) return {
|
|
64
|
-
className: (
|
|
62
|
+
className: require_core__internal_mergeClassName(require_core__constants.clsLayout.align[axis][align], require_core__constants.clsLayout.childSize[axis]),
|
|
65
63
|
style: { [require_core__constants.varLayout.childSize[axis]]: require_core__internal_unit(childSize) }
|
|
66
64
|
};
|
|
67
65
|
else return { className: require_core__constants.clsLayout.align[axis][align] };
|
package/core/flow/flow.mjs
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import { clsLayoutFlow } from "../
|
|
2
|
-
import { clsLayout, varLayout } from "../_constants.mjs";
|
|
1
|
+
import { clsLayout, clsLayoutFlow, varLayout } from "../_constants.mjs";
|
|
3
2
|
import hasValue from "../_internal/hasValue.mjs";
|
|
3
|
+
import mergeClassName from "../_internal/mergeClassName.mjs";
|
|
4
4
|
import applyChildRatio from "../_internal/applyChildRatio.mjs";
|
|
5
5
|
import unit from "../_internal/unit.mjs";
|
|
6
6
|
import applyGap from "../_internal/applyGap.mjs";
|
|
7
7
|
import mergeLayoutResults from "../_internal/mergeLayoutResults.mjs";
|
|
8
8
|
import maybeDefault from "@niche-works/utils/object/maybeDefault";
|
|
9
|
-
import clsx from "clsx";
|
|
10
9
|
|
|
11
10
|
//#region src/core/flow/flow.ts
|
|
12
11
|
/**
|
|
@@ -22,7 +21,7 @@ const flow = (options = {}) => {
|
|
|
22
21
|
alignY: "top"
|
|
23
22
|
}, { overwriteNull: true });
|
|
24
23
|
const result = {
|
|
25
|
-
className:
|
|
24
|
+
className: mergeClassName(clsLayoutFlow, clsLayout.direction[direction], clsLayout.align.x[alignX], clsLayout.align.y[alignY]),
|
|
26
25
|
style: {}
|
|
27
26
|
};
|
|
28
27
|
applyGap(result, gap, gapX, gapY);
|
|
@@ -43,9 +42,9 @@ const flow = (options = {}) => {
|
|
|
43
42
|
* stackの _getStackMainAxisStyle に相当。flowでは主軸の挙動はstackと同じ。
|
|
44
43
|
*/
|
|
45
44
|
function _getFlowMainAxisStyle(axis, align, adjust, childSize) {
|
|
46
|
-
const result = { className:
|
|
45
|
+
const result = { className: mergeClassName(clsLayout.align[axis][align], clsLayout.adjust[axis][adjust]) };
|
|
47
46
|
if (hasValue(childSize)) {
|
|
48
|
-
result.className =
|
|
47
|
+
result.className = mergeClassName(result.className, clsLayout.childSize[axis]);
|
|
49
48
|
result.style = { [varLayout.childSize[axis]]: unit(childSize) };
|
|
50
49
|
}
|
|
51
50
|
return result;
|
|
@@ -58,7 +57,7 @@ function _getFlowMainAxisStyle(axis, align, adjust, childSize) {
|
|
|
58
57
|
*/
|
|
59
58
|
function _getFlowCrossAxisStyle(axis, align, childSize) {
|
|
60
59
|
if (hasValue(childSize)) return {
|
|
61
|
-
className:
|
|
60
|
+
className: mergeClassName(clsLayout.align[axis][align], clsLayout.childSize[axis]),
|
|
62
61
|
style: { [varLayout.childSize[axis]]: unit(childSize) }
|
|
63
62
|
};
|
|
64
63
|
else return { className: clsLayout.align[axis][align] };
|
package/core/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { StyleLayout, StyleLayoutResult } from "./types.cjs";
|
|
1
|
+
import { CSSCustomProperties, StyleLayout, StyleLayoutResult } from "./types.cjs";
|
|
2
2
|
import { BalanceLayoutOptions } from "./balance/types.cjs";
|
|
3
3
|
import balance from "./balance/balance.cjs";
|
|
4
4
|
import { CenterLayoutOptions } from "./center/types.cjs";
|
|
@@ -17,4 +17,4 @@ import { StackLayoutOptions } from "./stack/types.cjs";
|
|
|
17
17
|
import stack from "./stack/stack.cjs";
|
|
18
18
|
import { TileLayoutOptions } from "./tile/types.cjs";
|
|
19
19
|
import tile from "./tile/tile.cjs";
|
|
20
|
-
export { BalanceLayoutOptions, CenterLayoutOptions, FlowLayoutOptions, LayerLayoutOptions, MatrixLayoutOptions, PackLayoutOptions, PinLayoutOptions, StackLayoutOptions, StyleLayout, StyleLayoutResult, TileLayoutOptions, balance, center, flow, layer, matrix, pack, pin, stack, tile };
|
|
20
|
+
export { BalanceLayoutOptions, CSSCustomProperties, CenterLayoutOptions, FlowLayoutOptions, LayerLayoutOptions, MatrixLayoutOptions, PackLayoutOptions, PinLayoutOptions, StackLayoutOptions, StyleLayout, StyleLayoutResult, TileLayoutOptions, balance, center, flow, layer, matrix, pack, pin, stack, tile };
|
package/core/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { StyleLayout, StyleLayoutResult } from "./types.mjs";
|
|
1
|
+
import { CSSCustomProperties, StyleLayout, StyleLayoutResult } from "./types.mjs";
|
|
2
2
|
import { BalanceLayoutOptions } from "./balance/types.mjs";
|
|
3
3
|
import balance from "./balance/balance.mjs";
|
|
4
4
|
import { CenterLayoutOptions } from "./center/types.mjs";
|
|
@@ -17,4 +17,4 @@ import { StackLayoutOptions } from "./stack/types.mjs";
|
|
|
17
17
|
import stack from "./stack/stack.mjs";
|
|
18
18
|
import { TileLayoutOptions } from "./tile/types.mjs";
|
|
19
19
|
import tile from "./tile/tile.mjs";
|
|
20
|
-
export { BalanceLayoutOptions, CenterLayoutOptions, FlowLayoutOptions, LayerLayoutOptions, MatrixLayoutOptions, PackLayoutOptions, PinLayoutOptions, StackLayoutOptions, StyleLayout, StyleLayoutResult, TileLayoutOptions, balance, center, flow, layer, matrix, pack, pin, stack, tile };
|
|
20
|
+
export { BalanceLayoutOptions, CSSCustomProperties, CenterLayoutOptions, FlowLayoutOptions, LayerLayoutOptions, MatrixLayoutOptions, PackLayoutOptions, PinLayoutOptions, StackLayoutOptions, StyleLayout, StyleLayoutResult, TileLayoutOptions, balance, center, flow, layer, matrix, pack, pin, stack, tile };
|
package/core/layer/layer.cjs
CHANGED
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
const require_runtime = require('../../_virtual/_rolldown/runtime.cjs');
|
|
2
|
-
const require_core_constants = require('../constants.cjs');
|
|
3
2
|
const require_core__constants = require('../_constants.cjs');
|
|
3
|
+
const require_core__internal_mergeClassName = require('../_internal/mergeClassName.cjs');
|
|
4
4
|
const require_core__internal_applyChildRatio = require('../_internal/applyChildRatio.cjs');
|
|
5
5
|
const require_core__internal_applyChildSize = require('../_internal/applyChildSize.cjs');
|
|
6
6
|
let _niche_works_utils_object_maybeDefault = require("@niche-works/utils/object/maybeDefault");
|
|
7
7
|
_niche_works_utils_object_maybeDefault = require_runtime.__toESM(_niche_works_utils_object_maybeDefault, 1);
|
|
8
|
-
let clsx = require("clsx");
|
|
9
|
-
clsx = require_runtime.__toESM(clsx, 1);
|
|
10
8
|
|
|
11
9
|
//#region src/core/layer/layer.ts
|
|
12
10
|
/**
|
|
@@ -22,7 +20,7 @@ const layer = (options = {}) => {
|
|
|
22
20
|
alignY: "top"
|
|
23
21
|
}, { overwriteNull: true });
|
|
24
22
|
const result = {
|
|
25
|
-
className: (
|
|
23
|
+
className: require_core__internal_mergeClassName(require_core__constants.clsLayoutLayer, require_core__constants.clsLayout.align.x[alignX], require_core__constants.clsLayout.align.y[alignY], require_core__constants.clsLayout.adjust.x[adjustX], require_core__constants.clsLayout.adjust.y[adjustY]),
|
|
26
24
|
style: {}
|
|
27
25
|
};
|
|
28
26
|
require_core__internal_applyChildSize(result, childSizeX, childSizeY);
|
package/core/layer/layer.mjs
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { clsLayoutLayer } from "../
|
|
2
|
-
import
|
|
1
|
+
import { clsLayout, clsLayoutLayer } from "../_constants.mjs";
|
|
2
|
+
import mergeClassName from "../_internal/mergeClassName.mjs";
|
|
3
3
|
import applyChildRatio from "../_internal/applyChildRatio.mjs";
|
|
4
4
|
import applyChildSize from "../_internal/applyChildSize.mjs";
|
|
5
5
|
import maybeDefault from "@niche-works/utils/object/maybeDefault";
|
|
6
|
-
import clsx from "clsx";
|
|
7
6
|
|
|
8
7
|
//#region src/core/layer/layer.ts
|
|
9
8
|
/**
|
|
@@ -19,7 +18,7 @@ const layer = (options = {}) => {
|
|
|
19
18
|
alignY: "top"
|
|
20
19
|
}, { overwriteNull: true });
|
|
21
20
|
const result = {
|
|
22
|
-
className:
|
|
21
|
+
className: mergeClassName(clsLayoutLayer, clsLayout.align.x[alignX], clsLayout.align.y[alignY], clsLayout.adjust.x[adjustX], clsLayout.adjust.y[adjustY]),
|
|
23
22
|
style: {}
|
|
24
23
|
};
|
|
25
24
|
applyChildSize(result, childSizeX, childSizeY);
|
package/core/matrix/matrix.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
const require_runtime = require('../../_virtual/_rolldown/runtime.cjs');
|
|
2
|
-
const require_core_constants = require('../constants.cjs');
|
|
3
2
|
const require_core__constants = require('../_constants.cjs');
|
|
3
|
+
const require_core__internal_mergeClassName = require('../_internal/mergeClassName.cjs');
|
|
4
4
|
const require_core__internal_applyChildRatio = require('../_internal/applyChildRatio.cjs');
|
|
5
5
|
const require_core__internal_unit = require('../_internal/unit.cjs');
|
|
6
6
|
const require_core__internal_applyChildSize = require('../_internal/applyChildSize.cjs');
|
|
@@ -9,14 +9,13 @@ const require_core__internal_mergeLayoutResults = require('../_internal/mergeLay
|
|
|
9
9
|
const require_core__internal_applyChildCount = require('../_internal/applyChildCount.cjs');
|
|
10
10
|
let _niche_works_utils_object_maybeDefault = require("@niche-works/utils/object/maybeDefault");
|
|
11
11
|
_niche_works_utils_object_maybeDefault = require_runtime.__toESM(_niche_works_utils_object_maybeDefault, 1);
|
|
12
|
-
let clsx = require("clsx");
|
|
13
|
-
clsx = require_runtime.__toESM(clsx, 1);
|
|
14
12
|
|
|
15
13
|
//#region src/core/matrix/matrix.ts
|
|
16
14
|
/**
|
|
17
15
|
* matrixレイアウト
|
|
18
16
|
*
|
|
19
17
|
* - 子要素の縦の数、横の数を基準にして格子状に配置する
|
|
18
|
+
* - 親要素のサイズが子要素に依存していないことを前提とする
|
|
20
19
|
*/
|
|
21
20
|
const matrix = (options) => {
|
|
22
21
|
const { direction, alignX, alignY, adjustX, adjustY, gap, gapX = gap, gapY = gap, childSizeX, childSizeY, childRatioX, childRatioY, childCountX, childCountY, tracksX, tracksY } = (0, _niche_works_utils_object_maybeDefault.default)(options, {
|
|
@@ -25,7 +24,7 @@ const matrix = (options) => {
|
|
|
25
24
|
alignY: "top"
|
|
26
25
|
}, { overwriteNull: true });
|
|
27
26
|
let result = {
|
|
28
|
-
className: (
|
|
27
|
+
className: require_core__internal_mergeClassName(require_core__constants.clsLayoutMatrix, require_core__constants.clsLayout.direction[direction], require_core__constants.clsLayout.align.x[alignX], require_core__constants.clsLayout.align.y[alignY], require_core__constants.clsLayout.adjust.x[adjustX], require_core__constants.clsLayout.adjust.y[adjustY]),
|
|
29
28
|
style: {}
|
|
30
29
|
};
|
|
31
30
|
require_core__internal_applyGap(result, gap, gapX, gapY);
|
package/core/matrix/matrix.d.cts
CHANGED
package/core/matrix/matrix.d.mts
CHANGED
package/core/matrix/matrix.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { clsLayoutMatrix } from "../
|
|
2
|
-
import
|
|
1
|
+
import { clsLayout, clsLayoutMatrix, varLayout } from "../_constants.mjs";
|
|
2
|
+
import mergeClassName from "../_internal/mergeClassName.mjs";
|
|
3
3
|
import applyChildRatio from "../_internal/applyChildRatio.mjs";
|
|
4
4
|
import unit from "../_internal/unit.mjs";
|
|
5
5
|
import applyChildSize from "../_internal/applyChildSize.mjs";
|
|
@@ -7,13 +7,13 @@ import applyGap from "../_internal/applyGap.mjs";
|
|
|
7
7
|
import mergeLayoutResults from "../_internal/mergeLayoutResults.mjs";
|
|
8
8
|
import applyChildCount from "../_internal/applyChildCount.mjs";
|
|
9
9
|
import maybeDefault from "@niche-works/utils/object/maybeDefault";
|
|
10
|
-
import clsx from "clsx";
|
|
11
10
|
|
|
12
11
|
//#region src/core/matrix/matrix.ts
|
|
13
12
|
/**
|
|
14
13
|
* matrixレイアウト
|
|
15
14
|
*
|
|
16
15
|
* - 子要素の縦の数、横の数を基準にして格子状に配置する
|
|
16
|
+
* - 親要素のサイズが子要素に依存していないことを前提とする
|
|
17
17
|
*/
|
|
18
18
|
const matrix = (options) => {
|
|
19
19
|
const { direction, alignX, alignY, adjustX, adjustY, gap, gapX = gap, gapY = gap, childSizeX, childSizeY, childRatioX, childRatioY, childCountX, childCountY, tracksX, tracksY } = maybeDefault(options, {
|
|
@@ -22,7 +22,7 @@ const matrix = (options) => {
|
|
|
22
22
|
alignY: "top"
|
|
23
23
|
}, { overwriteNull: true });
|
|
24
24
|
let result = {
|
|
25
|
-
className:
|
|
25
|
+
className: mergeClassName(clsLayoutMatrix, clsLayout.direction[direction], clsLayout.align.x[alignX], clsLayout.align.y[alignY], clsLayout.adjust.x[adjustX], clsLayout.adjust.y[adjustY]),
|
|
26
26
|
style: {}
|
|
27
27
|
};
|
|
28
28
|
applyGap(result, gap, gapX, gapY);
|
package/core/pack/pack.cjs
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
const require_runtime = require('../../_virtual/_rolldown/runtime.cjs');
|
|
2
|
-
const require_core_constants = require('../constants.cjs');
|
|
3
2
|
const require_core__constants = require('../_constants.cjs');
|
|
3
|
+
const require_core__internal_mergeClassName = require('../_internal/mergeClassName.cjs');
|
|
4
4
|
const require_core__internal_applyGap = require('../_internal/applyGap.cjs');
|
|
5
5
|
let _niche_works_utils_object_maybeDefault = require("@niche-works/utils/object/maybeDefault");
|
|
6
6
|
_niche_works_utils_object_maybeDefault = require_runtime.__toESM(_niche_works_utils_object_maybeDefault, 1);
|
|
7
|
-
let clsx = require("clsx");
|
|
8
|
-
clsx = require_runtime.__toESM(clsx, 1);
|
|
9
7
|
|
|
10
8
|
//#region src/core/pack/pack.ts
|
|
11
9
|
/**
|
|
@@ -16,7 +14,7 @@ clsx = require_runtime.__toESM(clsx, 1);
|
|
|
16
14
|
const pack = (options = {}) => {
|
|
17
15
|
const { direction, gap, gapX, gapY } = (0, _niche_works_utils_object_maybeDefault.default)(options, { direction: "x" }, { overwriteNull: true });
|
|
18
16
|
const result = {
|
|
19
|
-
className: (
|
|
17
|
+
className: require_core__internal_mergeClassName(require_core__constants.clsLayoutPack, require_core__constants.clsLayout.direction[direction]),
|
|
20
18
|
style: {}
|
|
21
19
|
};
|
|
22
20
|
require_core__internal_applyGap(result, gap, gapX, gapY);
|
package/core/pack/pack.mjs
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { clsLayoutPack } from "../
|
|
2
|
-
import
|
|
1
|
+
import { clsLayout, clsLayoutPack } from "../_constants.mjs";
|
|
2
|
+
import mergeClassName from "../_internal/mergeClassName.mjs";
|
|
3
3
|
import applyGap from "../_internal/applyGap.mjs";
|
|
4
4
|
import maybeDefault from "@niche-works/utils/object/maybeDefault";
|
|
5
|
-
import clsx from "clsx";
|
|
6
5
|
|
|
7
6
|
//#region src/core/pack/pack.ts
|
|
8
7
|
/**
|
|
@@ -13,7 +12,7 @@ import clsx from "clsx";
|
|
|
13
12
|
const pack = (options = {}) => {
|
|
14
13
|
const { direction, gap, gapX, gapY } = maybeDefault(options, { direction: "x" }, { overwriteNull: true });
|
|
15
14
|
const result = {
|
|
16
|
-
className:
|
|
15
|
+
className: mergeClassName(clsLayoutPack, clsLayout.direction[direction]),
|
|
17
16
|
style: {}
|
|
18
17
|
};
|
|
19
18
|
applyGap(result, gap, gapX, gapY);
|
package/core/pin/pin.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const
|
|
1
|
+
const require_core__constants = require('../_constants.cjs');
|
|
2
2
|
const require_core__internal_applyChildRatio = require('../_internal/applyChildRatio.cjs');
|
|
3
3
|
const require_core__internal_applyChildSize = require('../_internal/applyChildSize.cjs');
|
|
4
4
|
|
|
@@ -11,7 +11,7 @@ const require_core__internal_applyChildSize = require('../_internal/applyChildSi
|
|
|
11
11
|
const pin = (options = {}) => {
|
|
12
12
|
const { childSizeX, childSizeY, childRatioX, childRatioY } = options;
|
|
13
13
|
const result = {
|
|
14
|
-
className:
|
|
14
|
+
className: require_core__constants.clsLayoutPin,
|
|
15
15
|
style: {}
|
|
16
16
|
};
|
|
17
17
|
require_core__internal_applyChildSize(result, childSizeX, childSizeY);
|
package/core/pin/pin.mjs
CHANGED
package/core/stack/stack.cjs
CHANGED
|
@@ -1,21 +1,19 @@
|
|
|
1
1
|
const require_runtime = require('../../_virtual/_rolldown/runtime.cjs');
|
|
2
|
-
const require_core_constants = require('../constants.cjs');
|
|
3
2
|
const require_core__constants = require('../_constants.cjs');
|
|
4
3
|
const require_core__internal_hasValue = require('../_internal/hasValue.cjs');
|
|
4
|
+
const require_core__internal_mergeClassName = require('../_internal/mergeClassName.cjs');
|
|
5
5
|
const require_core__internal_applyChildRatio = require('../_internal/applyChildRatio.cjs');
|
|
6
6
|
const require_core__internal_unit = require('../_internal/unit.cjs');
|
|
7
7
|
const require_core__internal_applyGap = require('../_internal/applyGap.cjs');
|
|
8
8
|
const require_core__internal_mergeLayoutResults = require('../_internal/mergeLayoutResults.cjs');
|
|
9
9
|
let _niche_works_utils_object_maybeDefault = require("@niche-works/utils/object/maybeDefault");
|
|
10
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
11
|
|
|
14
12
|
//#region src/core/stack/stack.ts
|
|
15
13
|
/**
|
|
16
14
|
* stackレイアウト
|
|
17
15
|
*
|
|
18
|
-
* -
|
|
16
|
+
* - 子要素を一列に並べて配置する
|
|
19
17
|
*/
|
|
20
18
|
const stack = (options = {}) => {
|
|
21
19
|
const { direction, alignX, alignY, adjustX, adjustY, gap, gapX = gap, gapY = gap, childSizeX, childSizeY, childRatioX, childRatioY } = (0, _niche_works_utils_object_maybeDefault.default)(options, {
|
|
@@ -24,7 +22,7 @@ const stack = (options = {}) => {
|
|
|
24
22
|
alignY: "top"
|
|
25
23
|
}, { overwriteNull: true });
|
|
26
24
|
const result = {
|
|
27
|
-
className: (
|
|
25
|
+
className: require_core__internal_mergeClassName(require_core__constants.clsLayoutStack, require_core__constants.clsLayout.direction[direction], require_core__constants.clsLayout.align.x[alignX], require_core__constants.clsLayout.align.y[alignY]),
|
|
28
26
|
style: {}
|
|
29
27
|
};
|
|
30
28
|
require_core__internal_applyGap(result, gap, gapX, gapY);
|
|
@@ -48,9 +46,9 @@ const stack = (options = {}) => {
|
|
|
48
46
|
* @returns スタイル
|
|
49
47
|
*/
|
|
50
48
|
function _getStackMainAxisStyle(axis, align, adjust, childSize) {
|
|
51
|
-
const result = { className: (
|
|
49
|
+
const result = { className: require_core__internal_mergeClassName(require_core__constants.clsLayout.align[axis][align], require_core__constants.clsLayout.adjust[axis][adjust]) };
|
|
52
50
|
if (require_core__internal_hasValue(childSize)) {
|
|
53
|
-
result.className = (
|
|
51
|
+
result.className = require_core__internal_mergeClassName(result.className, require_core__constants.clsLayout.childSize[axis]);
|
|
54
52
|
result.style = { [require_core__constants.varLayout.childSize[axis]]: require_core__internal_unit(childSize) };
|
|
55
53
|
}
|
|
56
54
|
return result;
|
|
@@ -65,34 +63,34 @@ function _getStackMainAxisStyle(axis, align, adjust, childSize) {
|
|
|
65
63
|
*/
|
|
66
64
|
function _getStackClossAxisStyle(axis, align, adjust, childSize) {
|
|
67
65
|
if (adjust === "fit") return {
|
|
68
|
-
className: (
|
|
66
|
+
className: require_core__internal_mergeClassName(require_core__constants.clsLayout.align[axis][align], require_core__constants.clsLayout.adjust[axis][adjust]),
|
|
69
67
|
style: { [require_core__constants.varLayout.childSize[axis]]: `min(0, 100%)` }
|
|
70
68
|
};
|
|
71
69
|
else if (adjust === "grow") {
|
|
72
70
|
const result = {
|
|
73
|
-
className: (
|
|
71
|
+
className: require_core__internal_mergeClassName(require_core__constants.clsLayout.align[axis][align], require_core__constants.clsLayout.adjust[axis][adjust]),
|
|
74
72
|
style: {}
|
|
75
73
|
};
|
|
76
74
|
if (require_core__internal_hasValue(childSize)) {
|
|
77
|
-
result.className = (
|
|
75
|
+
result.className = require_core__internal_mergeClassName(result.className, require_core__constants.clsLayout.childSize[axis]);
|
|
78
76
|
result.style[require_core__constants.varLayout.childSize[axis]] = require_core__internal_unit(childSize);
|
|
79
77
|
}
|
|
80
78
|
return result;
|
|
81
79
|
} else if (adjust === "shrink") {
|
|
82
80
|
const result = {
|
|
83
|
-
className: (
|
|
81
|
+
className: require_core__internal_mergeClassName(require_core__constants.clsLayout.align[axis][align], require_core__constants.clsLayout.adjust[axis][adjust]),
|
|
84
82
|
style: {}
|
|
85
83
|
};
|
|
86
84
|
if (require_core__internal_hasValue(childSize)) {
|
|
87
|
-
result.className = (
|
|
85
|
+
result.className = require_core__internal_mergeClassName(result.className, require_core__constants.clsLayout.childSize[axis]);
|
|
88
86
|
result.style = { [require_core__constants.varLayout.childSize[axis]]: `min(${require_core__internal_unit(childSize)}, 100%)` };
|
|
89
87
|
}
|
|
90
88
|
return result;
|
|
91
89
|
} else if (require_core__internal_hasValue(childSize)) return {
|
|
92
|
-
className: (
|
|
90
|
+
className: require_core__internal_mergeClassName(require_core__constants.clsLayout.align[axis][align], require_core__constants.clsLayout.childSize[axis]),
|
|
93
91
|
style: { [require_core__constants.varLayout.childSize[axis]]: require_core__internal_unit(childSize) }
|
|
94
92
|
};
|
|
95
|
-
else return { className: (
|
|
93
|
+
else return { className: require_core__internal_mergeClassName(require_core__constants.clsLayout.align[axis][align]) };
|
|
96
94
|
}
|
|
97
95
|
|
|
98
96
|
//#endregion
|
package/core/stack/stack.d.cts
CHANGED