@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.
Files changed (139) hide show
  1. package/README.ja.md +3 -3
  2. package/README.md +6 -6
  3. package/balance/index.cjs +6 -2
  4. package/balance/index.mjs +6 -2
  5. package/center/index.cjs +6 -2
  6. package/center/index.mjs +6 -2
  7. package/constants.cjs +1 -50
  8. package/constants.d.cts +2 -2
  9. package/constants.d.mts +2 -2
  10. package/constants.mjs +2 -2
  11. package/core/_constants.cjs +287 -34
  12. package/core/_constants.d.cts +206 -1
  13. package/core/_constants.d.mts +206 -1
  14. package/core/_constants.mjs +206 -3
  15. package/core/_internal/applyChildCount.cjs +6 -8
  16. package/core/_internal/applyChildCount.mjs +6 -6
  17. package/core/_internal/applyChildRatio.cjs +4 -6
  18. package/core/_internal/applyChildRatio.mjs +3 -3
  19. package/core/_internal/applyChildSize.cjs +6 -8
  20. package/core/_internal/applyChildSize.mjs +4 -4
  21. package/core/_internal/applyGap.cjs +6 -8
  22. package/core/_internal/applyGap.mjs +4 -4
  23. package/core/_internal/mergeClassName.cjs +11 -0
  24. package/core/_internal/mergeClassName.d.cts +3 -0
  25. package/core/_internal/mergeClassName.d.mts +4 -0
  26. package/core/_internal/mergeClassName.mjs +10 -0
  27. package/core/_internal/mergeLayoutResults.cjs +2 -4
  28. package/core/_internal/mergeLayoutResults.mjs +2 -2
  29. package/core/_types.d.cts +1 -9
  30. package/core/_types.d.mts +1 -9
  31. package/core/balance/balance.cjs +4 -4
  32. package/core/balance/balance.d.cts +2 -0
  33. package/core/balance/balance.d.mts +2 -0
  34. package/core/balance/balance.mjs +5 -4
  35. package/core/balance/styles.css +32 -0
  36. package/core/center/center.cjs +3 -4
  37. package/core/center/center.d.cts +1 -0
  38. package/core/center/center.d.mts +1 -0
  39. package/core/center/center.mjs +4 -4
  40. package/core/constants.cjs +4 -255
  41. package/core/constants.d.cts +4 -206
  42. package/core/constants.d.mts +4 -206
  43. package/core/constants.mjs +4 -206
  44. package/core/flow/flow.cjs +5 -7
  45. package/core/flow/flow.mjs +6 -7
  46. package/core/index.d.cts +2 -2
  47. package/core/index.d.mts +2 -2
  48. package/core/layer/layer.cjs +2 -4
  49. package/core/layer/layer.mjs +3 -4
  50. package/core/matrix/matrix.cjs +3 -4
  51. package/core/matrix/matrix.d.cts +1 -0
  52. package/core/matrix/matrix.d.mts +1 -0
  53. package/core/matrix/matrix.mjs +4 -4
  54. package/core/pack/pack.cjs +2 -4
  55. package/core/pack/pack.mjs +3 -4
  56. package/core/pin/pin.cjs +2 -2
  57. package/core/pin/pin.mjs +1 -1
  58. package/core/stack/stack.cjs +12 -14
  59. package/core/stack/stack.d.cts +1 -1
  60. package/core/stack/stack.d.mts +1 -1
  61. package/core/stack/stack.mjs +13 -14
  62. package/core/styles.css +32 -0
  63. package/core/tile/tile.cjs +2 -4
  64. package/core/tile/tile.mjs +3 -4
  65. package/core/types.d.cts +7 -2
  66. package/core/types.d.mts +7 -2
  67. package/flow/index.cjs +6 -2
  68. package/flow/index.mjs +6 -2
  69. package/helpers/_internal/constants.cjs +25 -0
  70. package/helpers/_internal/constants.d.cts +13 -0
  71. package/helpers/_internal/constants.d.mts +13 -0
  72. package/helpers/_internal/constants.mjs +16 -0
  73. package/helpers/_internal/createExtractLayoutOptions.cjs +25 -0
  74. package/helpers/_internal/createExtractLayoutOptions.d.cts +8 -0
  75. package/helpers/_internal/createExtractLayoutOptions.d.mts +9 -0
  76. package/helpers/_internal/createExtractLayoutOptions.mjs +24 -0
  77. package/helpers/extractBalanceOptions.cjs +15 -0
  78. package/helpers/extractBalanceOptions.d.cts +5 -0
  79. package/helpers/extractBalanceOptions.d.mts +6 -0
  80. package/helpers/extractBalanceOptions.mjs +15 -0
  81. package/helpers/extractCenterOptions.cjs +14 -0
  82. package/helpers/extractCenterOptions.d.cts +6 -0
  83. package/helpers/extractCenterOptions.d.mts +7 -0
  84. package/helpers/extractCenterOptions.mjs +14 -0
  85. package/helpers/extractFlowOptions.cjs +15 -0
  86. package/helpers/extractFlowOptions.d.cts +6 -0
  87. package/helpers/extractFlowOptions.d.mts +7 -0
  88. package/helpers/extractFlowOptions.mjs +15 -0
  89. package/helpers/extractLayerOptions.cjs +13 -0
  90. package/helpers/extractLayerOptions.d.cts +6 -0
  91. package/helpers/extractLayerOptions.d.mts +7 -0
  92. package/helpers/extractLayerOptions.mjs +13 -0
  93. package/helpers/extractMatrixOptions.cjs +17 -0
  94. package/helpers/extractMatrixOptions.d.cts +5 -0
  95. package/helpers/extractMatrixOptions.d.mts +6 -0
  96. package/helpers/extractMatrixOptions.mjs +17 -0
  97. package/helpers/extractPackOptions.cjs +8 -0
  98. package/helpers/extractPackOptions.d.cts +6 -0
  99. package/helpers/extractPackOptions.d.mts +7 -0
  100. package/helpers/extractPackOptions.mjs +8 -0
  101. package/helpers/extractPinOptions.cjs +8 -0
  102. package/helpers/extractPinOptions.d.cts +6 -0
  103. package/helpers/extractPinOptions.d.mts +7 -0
  104. package/helpers/extractPinOptions.mjs +8 -0
  105. package/helpers/extractStackOptions.cjs +15 -0
  106. package/helpers/extractStackOptions.d.cts +6 -0
  107. package/helpers/extractStackOptions.d.mts +7 -0
  108. package/helpers/extractStackOptions.mjs +15 -0
  109. package/helpers/extractTileOptions.cjs +15 -0
  110. package/helpers/extractTileOptions.d.cts +6 -0
  111. package/helpers/extractTileOptions.d.mts +7 -0
  112. package/helpers/extractTileOptions.mjs +15 -0
  113. package/helpers/index.cjs +20 -0
  114. package/helpers/index.d.cts +10 -0
  115. package/helpers/index.d.mts +10 -0
  116. package/helpers/index.mjs +11 -0
  117. package/index.cjs +18 -18
  118. package/index.d.cts +2 -2
  119. package/index.d.mts +2 -2
  120. package/index.mjs +10 -10
  121. package/layer/index.cjs +6 -2
  122. package/layer/index.mjs +6 -2
  123. package/matrix/index.cjs +6 -2
  124. package/matrix/index.mjs +6 -2
  125. package/pack/index.cjs +6 -2
  126. package/pack/index.mjs +6 -2
  127. package/package.json +6 -4
  128. package/pin/index.cjs +6 -2
  129. package/pin/index.mjs +6 -2
  130. package/stack/index.cjs +6 -2
  131. package/stack/index.mjs +6 -2
  132. package/tile/index.cjs +6 -2
  133. package/tile/index.mjs +6 -2
  134. package/types.d.cts +2 -2
  135. package/types.d.mts +2 -2
  136. package/core/_internal/warnIfUnsupported.cjs +0 -15
  137. package/core/_internal/warnIfUnsupported.d.cts +0 -3
  138. package/core/_internal/warnIfUnsupported.d.mts +0 -4
  139. package/core/_internal/warnIfUnsupported.mjs +0 -14
@@ -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, clsLayoutAdjustXExpand, clsLayoutAdjustXFit, clsLayoutAdjustXNone, clsLayoutAdjustXShrink, clsLayoutAdjustYExpand, clsLayoutAdjustYFit, clsLayoutAdjustYNone, clsLayoutAdjustYShrink, clsLayoutAlignXCenter, clsLayoutAlignXLeft, clsLayoutAlignXRight, clsLayoutAlignXSpaceAround, clsLayoutAlignXSpaceBetween, clsLayoutAlignXSpaceEvenly, clsLayoutAlignYBottom, clsLayoutAlignYMiddle, clsLayoutAlignYSpaceAround, clsLayoutAlignYSpaceBetween, clsLayoutAlignYSpaceEvenly, clsLayoutAlignYTop, clsLayoutBalance, clsLayoutCenter, clsLayoutChildCountX, clsLayoutChildCountY, clsLayoutChildRatio, clsLayoutChildSizeX, clsLayoutChildSizeY, clsLayoutDirectionX, clsLayoutDirectionY, clsLayoutFlow, clsLayoutGapX, clsLayoutGapY, clsLayoutLayer, clsLayoutMatrix, clsLayoutPack, clsLayoutPin, clsLayoutStack, clsLayoutTemplateX, clsLayoutTemplateY, clsLayoutTile, varLayoutChildCountX, varLayoutChildCountY, varLayoutChildRatio, varLayoutChildSizeX, varLayoutChildSizeY, varLayoutGapX, varLayoutGapY, varLayoutTemplateX, varLayoutTemplateY };
101
+ export { Adjust, AdjustBase, AlignX, AlignXBase, AlignY, AlignYBase, Direction };
@@ -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: (0, clsx.default)(require_core_constants.clsLayoutFlow, require_core__constants.clsLayout.direction[direction], require_core__constants.clsLayout.align.x[alignX], require_core__constants.clsLayout.align.y[alignY]),
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: (0, clsx.default)(require_core__constants.clsLayout.align[axis][align], require_core__constants.clsLayout.adjust[axis][adjust]) };
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 = (0, clsx.default)(result.className, require_core__constants.clsLayout.childSize[axis]);
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: (0, clsx.default)(require_core__constants.clsLayout.align[axis][align], require_core__constants.clsLayout.childSize[axis]),
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] };
@@ -1,12 +1,11 @@
1
- import { clsLayoutFlow } from "../constants.mjs";
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: clsx(clsLayoutFlow, clsLayout.direction[direction], clsLayout.align.x[alignX], clsLayout.align.y[alignY]),
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: clsx(clsLayout.align[axis][align], clsLayout.adjust[axis][adjust]) };
45
+ const result = { className: mergeClassName(clsLayout.align[axis][align], clsLayout.adjust[axis][adjust]) };
47
46
  if (hasValue(childSize)) {
48
- result.className = clsx(result.className, clsLayout.childSize[axis]);
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: clsx(clsLayout.align[axis][align], clsLayout.childSize[axis]),
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 };
@@ -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: (0, clsx.default)(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]),
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);
@@ -1,9 +1,8 @@
1
- import { clsLayoutLayer } from "../constants.mjs";
2
- import { clsLayout } from "../_constants.mjs";
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: clsx(clsLayoutLayer, clsLayout.align.x[alignX], clsLayout.align.y[alignY], clsLayout.adjust.x[adjustX], clsLayout.adjust.y[adjustY]),
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);
@@ -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: (0, clsx.default)(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]),
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);
@@ -6,6 +6,7 @@ import { MatrixLayoutOptions } from "./types.cjs";
6
6
  * matrixレイアウト
7
7
  *
8
8
  * - 子要素の縦の数、横の数を基準にして格子状に配置する
9
+ * - 親要素のサイズが子要素に依存していないことを前提とする
9
10
  */
10
11
  declare const matrix: StyleLayout<MatrixLayoutOptions>;
11
12
  export = matrix;
@@ -6,6 +6,7 @@ import { MatrixLayoutOptions } from "./types.mjs";
6
6
  * matrixレイアウト
7
7
  *
8
8
  * - 子要素の縦の数、横の数を基準にして格子状に配置する
9
+ * - 親要素のサイズが子要素に依存していないことを前提とする
9
10
  */
10
11
  declare const matrix: StyleLayout<MatrixLayoutOptions>;
11
12
  //#endregion
@@ -1,5 +1,5 @@
1
- import { clsLayoutMatrix } from "../constants.mjs";
2
- import { clsLayout, varLayout } from "../_constants.mjs";
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: clsx(clsLayoutMatrix, clsLayout.direction[direction], clsLayout.align.x[alignX], clsLayout.align.y[alignY], clsLayout.adjust.x[adjustX], clsLayout.adjust.y[adjustY]),
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);
@@ -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: (0, clsx.default)(require_core_constants.clsLayoutPack, require_core__constants.clsLayout.direction[direction]),
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);
@@ -1,8 +1,7 @@
1
- import { clsLayoutPack } from "../constants.mjs";
2
- import { clsLayout } from "../_constants.mjs";
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: clsx(clsLayoutPack, clsLayout.direction[direction]),
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 require_core_constants = require('../constants.cjs');
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: require_core_constants.clsLayoutPin,
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
@@ -1,4 +1,4 @@
1
- import { clsLayoutPin } from "../constants.mjs";
1
+ import { clsLayoutPin } from "../_constants.mjs";
2
2
  import applyChildRatio from "../_internal/applyChildRatio.mjs";
3
3
  import applyChildSize from "../_internal/applyChildSize.mjs";
4
4
 
@@ -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: (0, clsx.default)(require_core_constants.clsLayoutStack, require_core__constants.clsLayout.direction[direction], require_core__constants.clsLayout.align.x[alignX], require_core__constants.clsLayout.align.y[alignY]),
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: (0, clsx.default)(require_core__constants.clsLayout.align[axis][align], require_core__constants.clsLayout.adjust[axis][adjust]) };
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 = (0, clsx.default)(result.className, require_core__constants.clsLayout.childSize[axis]);
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: (0, clsx.default)(require_core__constants.clsLayout.align[axis][align], require_core__constants.clsLayout.adjust[axis][adjust]),
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: (0, clsx.default)(require_core__constants.clsLayout.align[axis][align], require_core__constants.clsLayout.adjust[axis][adjust]),
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 = (0, clsx.default)(result.className, require_core__constants.clsLayout.childSize[axis]);
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: (0, clsx.default)(require_core__constants.clsLayout.align[axis][align], require_core__constants.clsLayout.adjust[axis][adjust]),
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 = (0, clsx.default)(result.className, require_core__constants.clsLayout.childSize[axis]);
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: (0, clsx.default)(require_core__constants.clsLayout.align[axis][align], require_core__constants.clsLayout.childSize[axis]),
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: (0, clsx.default)(require_core__constants.clsLayout.align[axis][align]) };
93
+ else return { className: require_core__internal_mergeClassName(require_core__constants.clsLayout.align[axis][align]) };
96
94
  }
97
95
 
98
96
  //#endregion
@@ -5,7 +5,7 @@ import { StackLayoutOptions } from "./types.cjs";
5
5
  /**
6
6
  * stackレイアウト
7
7
  *
8
- * - 子要素を並べて配置する
8
+ * - 子要素を一列に並べて配置する
9
9
  */
10
10
  declare const stack: StyleLayout<StackLayoutOptions>;
11
11
  export = stack;
@@ -5,7 +5,7 @@ import { StackLayoutOptions } from "./types.mjs";
5
5
  /**
6
6
  * stackレイアウト
7
7
  *
8
- * - 子要素を並べて配置する
8
+ * - 子要素を一列に並べて配置する
9
9
  */
10
10
  declare const stack: StyleLayout<StackLayoutOptions>;
11
11
  //#endregion