@fringeworks/style-layouts 0.0.0-stage → 0.8.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 (267) hide show
  1. package/LICENSE +21 -0
  2. package/README.ja.md +331 -0
  3. package/README.md +331 -3
  4. package/_constants.cjs +327 -0
  5. package/_constants.d.cts +237 -0
  6. package/_constants.d.mts +237 -0
  7. package/_constants.mjs +275 -0
  8. package/_internal/applyGap.cjs +30 -0
  9. package/_internal/applyGap.d.cts +12 -0
  10. package/_internal/applyGap.d.mts +13 -0
  11. package/_internal/applyGap.mjs +30 -0
  12. package/_internal/applyItemCount.cjs +20 -0
  13. package/_internal/applyItemCount.d.cts +5 -0
  14. package/_internal/applyItemCount.d.mts +6 -0
  15. package/_internal/applyItemCount.mjs +20 -0
  16. package/_internal/applyItemRatio.cjs +21 -0
  17. package/_internal/applyItemRatio.d.cts +11 -0
  18. package/_internal/applyItemRatio.d.mts +12 -0
  19. package/_internal/applyItemRatio.mjs +21 -0
  20. package/_internal/applyItemSize.cjs +21 -0
  21. package/_internal/applyItemSize.d.cts +5 -0
  22. package/_internal/applyItemSize.d.mts +6 -0
  23. package/_internal/applyItemSize.mjs +21 -0
  24. package/_internal/hasValue.cjs +15 -0
  25. package/_internal/hasValue.d.cts +8 -0
  26. package/_internal/hasValue.d.mts +9 -0
  27. package/_internal/hasValue.mjs +14 -0
  28. package/_internal/mergeClassName.cjs +11 -0
  29. package/_internal/mergeClassName.d.cts +3 -0
  30. package/_internal/mergeClassName.d.mts +4 -0
  31. package/_internal/mergeClassName.mjs +10 -0
  32. package/_internal/mergeLayoutResults.cjs +16 -0
  33. package/_internal/mergeLayoutResults.d.cts +5 -0
  34. package/_internal/mergeLayoutResults.d.mts +6 -0
  35. package/_internal/mergeLayoutResults.mjs +16 -0
  36. package/_internal/unit.cjs +9 -0
  37. package/_internal/unit.d.cts +11 -0
  38. package/_internal/unit.d.mts +12 -0
  39. package/_internal/unit.mjs +8 -0
  40. package/_styles.scss.cjs +1 -0
  41. package/_styles.scss.d.cts +1 -0
  42. package/_styles.scss.d.mts +1 -0
  43. package/_styles.scss.mjs +3 -0
  44. package/_types.cjs +0 -0
  45. package/_types.d.cts +115 -0
  46. package/_types.d.mts +115 -0
  47. package/_types.mjs +1 -0
  48. package/_virtual/_rolldown/runtime.cjs +29 -0
  49. package/balance/balance.cjs +37 -0
  50. package/balance/balance.d.cts +13 -0
  51. package/balance/balance.d.mts +14 -0
  52. package/balance/balance.mjs +35 -0
  53. package/balance/index.cjs +3 -0
  54. package/balance/index.d.cts +3 -0
  55. package/balance/index.d.mts +3 -0
  56. package/balance/index.mjs +3 -0
  57. package/balance/styles.css +131 -0
  58. package/balance/types.cjs +0 -0
  59. package/balance/types.d.cts +21 -0
  60. package/balance/types.d.mts +21 -0
  61. package/balance/types.mjs +1 -0
  62. package/center/center.cjs +34 -0
  63. package/center/center.d.cts +12 -0
  64. package/center/center.d.mts +13 -0
  65. package/center/center.mjs +32 -0
  66. package/center/index.cjs +3 -0
  67. package/center/index.d.cts +3 -0
  68. package/center/index.d.mts +3 -0
  69. package/center/index.mjs +3 -0
  70. package/center/styles.css +157 -0
  71. package/center/types.cjs +0 -0
  72. package/center/types.d.cts +9 -0
  73. package/center/types.d.mts +9 -0
  74. package/center/types.mjs +1 -0
  75. package/constants.cjs +109 -0
  76. package/constants.d.cts +112 -0
  77. package/constants.d.mts +112 -0
  78. package/constants.mjs +101 -0
  79. package/flow/flow.cjs +71 -0
  80. package/flow/flow.d.cts +12 -0
  81. package/flow/flow.d.mts +13 -0
  82. package/flow/flow.mjs +69 -0
  83. package/flow/index.cjs +3 -0
  84. package/flow/index.d.cts +3 -0
  85. package/flow/index.d.mts +3 -0
  86. package/flow/index.mjs +3 -0
  87. package/flow/styles.css +160 -0
  88. package/flow/types.cjs +0 -0
  89. package/flow/types.d.cts +21 -0
  90. package/flow/types.d.mts +21 -0
  91. package/flow/types.mjs +1 -0
  92. package/helpers/_internal/constants.cjs +25 -0
  93. package/helpers/_internal/constants.d.cts +13 -0
  94. package/helpers/_internal/constants.d.mts +13 -0
  95. package/helpers/_internal/constants.mjs +16 -0
  96. package/helpers/_internal/createExtractLayoutOptions.cjs +25 -0
  97. package/helpers/_internal/createExtractLayoutOptions.d.cts +8 -0
  98. package/helpers/_internal/createExtractLayoutOptions.d.mts +9 -0
  99. package/helpers/_internal/createExtractLayoutOptions.mjs +24 -0
  100. package/helpers/extractBalanceOptions.cjs +15 -0
  101. package/helpers/extractBalanceOptions.d.cts +5 -0
  102. package/helpers/extractBalanceOptions.d.mts +6 -0
  103. package/helpers/extractBalanceOptions.mjs +15 -0
  104. package/helpers/extractCenterOptions.cjs +14 -0
  105. package/helpers/extractCenterOptions.d.cts +6 -0
  106. package/helpers/extractCenterOptions.d.mts +7 -0
  107. package/helpers/extractCenterOptions.mjs +14 -0
  108. package/helpers/extractFlowOptions.cjs +15 -0
  109. package/helpers/extractFlowOptions.d.cts +6 -0
  110. package/helpers/extractFlowOptions.d.mts +7 -0
  111. package/helpers/extractFlowOptions.mjs +15 -0
  112. package/helpers/extractLayerOptions.cjs +13 -0
  113. package/helpers/extractLayerOptions.d.cts +6 -0
  114. package/helpers/extractLayerOptions.d.mts +7 -0
  115. package/helpers/extractLayerOptions.mjs +13 -0
  116. package/helpers/extractMatrixOptions.cjs +17 -0
  117. package/helpers/extractMatrixOptions.d.cts +5 -0
  118. package/helpers/extractMatrixOptions.d.mts +6 -0
  119. package/helpers/extractMatrixOptions.mjs +17 -0
  120. package/helpers/extractPackOptions.cjs +8 -0
  121. package/helpers/extractPackOptions.d.cts +6 -0
  122. package/helpers/extractPackOptions.d.mts +7 -0
  123. package/helpers/extractPackOptions.mjs +8 -0
  124. package/helpers/extractPinOptions.cjs +8 -0
  125. package/helpers/extractPinOptions.d.cts +6 -0
  126. package/helpers/extractPinOptions.d.mts +7 -0
  127. package/helpers/extractPinOptions.mjs +8 -0
  128. package/helpers/extractStackOptions.cjs +15 -0
  129. package/helpers/extractStackOptions.d.cts +6 -0
  130. package/helpers/extractStackOptions.d.mts +7 -0
  131. package/helpers/extractStackOptions.mjs +15 -0
  132. package/helpers/extractTileOptions.cjs +15 -0
  133. package/helpers/extractTileOptions.d.cts +6 -0
  134. package/helpers/extractTileOptions.d.mts +7 -0
  135. package/helpers/extractTileOptions.mjs +15 -0
  136. package/helpers/index.cjs +20 -0
  137. package/helpers/index.d.cts +10 -0
  138. package/helpers/index.d.mts +10 -0
  139. package/helpers/index.mjs +11 -0
  140. package/index.cjs +20 -0
  141. package/index.d.cts +20 -0
  142. package/index.d.mts +20 -0
  143. package/index.mjs +11 -0
  144. package/layer/index.cjs +3 -0
  145. package/layer/index.d.cts +3 -0
  146. package/layer/index.d.mts +3 -0
  147. package/layer/index.mjs +3 -0
  148. package/layer/layer.cjs +34 -0
  149. package/layer/layer.d.cts +13 -0
  150. package/layer/layer.d.mts +14 -0
  151. package/layer/layer.mjs +32 -0
  152. package/layer/styles.css +56 -0
  153. package/layer/types.cjs +0 -0
  154. package/layer/types.d.cts +13 -0
  155. package/layer/types.d.mts +13 -0
  156. package/layer/types.mjs +1 -0
  157. package/matrix/index.cjs +3 -0
  158. package/matrix/index.d.cts +3 -0
  159. package/matrix/index.d.mts +3 -0
  160. package/matrix/index.mjs +3 -0
  161. package/matrix/matrix.cjs +110 -0
  162. package/matrix/matrix.d.cts +12 -0
  163. package/matrix/matrix.d.mts +13 -0
  164. package/matrix/matrix.mjs +108 -0
  165. package/matrix/styles.css +141 -0
  166. package/matrix/types.cjs +0 -0
  167. package/matrix/types.d.cts +46 -0
  168. package/matrix/types.d.mts +46 -0
  169. package/matrix/types.mjs +1 -0
  170. package/pack/index.cjs +3 -0
  171. package/pack/index.d.cts +3 -0
  172. package/pack/index.d.mts +3 -0
  173. package/pack/index.mjs +3 -0
  174. package/pack/pack.cjs +25 -0
  175. package/pack/pack.d.cts +11 -0
  176. package/pack/pack.d.mts +12 -0
  177. package/pack/pack.mjs +23 -0
  178. package/pack/styles.css +35 -0
  179. package/pack/types.cjs +0 -0
  180. package/pack/types.d.cts +6 -0
  181. package/pack/types.d.mts +6 -0
  182. package/pack/types.mjs +1 -0
  183. package/package.json +52 -4
  184. package/pin/index.cjs +3 -0
  185. package/pin/index.d.cts +3 -0
  186. package/pin/index.d.mts +3 -0
  187. package/pin/index.mjs +3 -0
  188. package/pin/pin.cjs +23 -0
  189. package/pin/pin.d.cts +11 -0
  190. package/pin/pin.d.mts +12 -0
  191. package/pin/pin.mjs +23 -0
  192. package/pin/styles.css +19 -0
  193. package/pin/types.cjs +0 -0
  194. package/pin/types.d.cts +6 -0
  195. package/pin/types.d.mts +6 -0
  196. package/pin/types.mjs +1 -0
  197. package/stack/index.cjs +3 -0
  198. package/stack/index.d.cts +3 -0
  199. package/stack/index.d.mts +3 -0
  200. package/stack/index.mjs +3 -0
  201. package/stack/stack.cjs +96 -0
  202. package/stack/stack.d.cts +11 -0
  203. package/stack/stack.d.mts +12 -0
  204. package/stack/stack.mjs +94 -0
  205. package/stack/styles.css +167 -0
  206. package/stack/types.cjs +0 -0
  207. package/stack/types.d.cts +21 -0
  208. package/stack/types.d.mts +21 -0
  209. package/stack/types.mjs +1 -0
  210. package/styles.css +1055 -0
  211. package/tile/index.cjs +3 -0
  212. package/tile/index.d.cts +3 -0
  213. package/tile/index.d.mts +3 -0
  214. package/tile/index.mjs +3 -0
  215. package/tile/styles.css +181 -0
  216. package/tile/tile.cjs +36 -0
  217. package/tile/tile.d.cts +12 -0
  218. package/tile/tile.d.mts +13 -0
  219. package/tile/tile.mjs +34 -0
  220. package/tile/types.cjs +0 -0
  221. package/tile/types.d.cts +9 -0
  222. package/tile/types.d.mts +9 -0
  223. package/tile/types.mjs +1 -0
  224. package/types.cjs +0 -0
  225. package/types.d.cts +14 -0
  226. package/types.d.mts +14 -0
  227. package/types.mjs +1 -0
  228. package/with-css/balance/index.cjs +8 -0
  229. package/with-css/balance/index.d.cts +3 -0
  230. package/with-css/balance/index.d.mts +3 -0
  231. package/with-css/balance/index.mjs +8 -0
  232. package/with-css/center/index.cjs +8 -0
  233. package/with-css/center/index.d.cts +3 -0
  234. package/with-css/center/index.d.mts +3 -0
  235. package/with-css/center/index.mjs +8 -0
  236. package/with-css/flow/index.cjs +8 -0
  237. package/with-css/flow/index.d.cts +3 -0
  238. package/with-css/flow/index.d.mts +3 -0
  239. package/with-css/flow/index.mjs +8 -0
  240. package/with-css/index.cjs +20 -0
  241. package/with-css/index.d.cts +20 -0
  242. package/with-css/index.d.mts +20 -0
  243. package/with-css/index.mjs +11 -0
  244. package/with-css/layer/index.cjs +8 -0
  245. package/with-css/layer/index.d.cts +3 -0
  246. package/with-css/layer/index.d.mts +3 -0
  247. package/with-css/layer/index.mjs +8 -0
  248. package/with-css/matrix/index.cjs +8 -0
  249. package/with-css/matrix/index.d.cts +3 -0
  250. package/with-css/matrix/index.d.mts +3 -0
  251. package/with-css/matrix/index.mjs +8 -0
  252. package/with-css/pack/index.cjs +8 -0
  253. package/with-css/pack/index.d.cts +3 -0
  254. package/with-css/pack/index.d.mts +3 -0
  255. package/with-css/pack/index.mjs +8 -0
  256. package/with-css/pin/index.cjs +8 -0
  257. package/with-css/pin/index.d.cts +3 -0
  258. package/with-css/pin/index.d.mts +3 -0
  259. package/with-css/pin/index.mjs +8 -0
  260. package/with-css/stack/index.cjs +8 -0
  261. package/with-css/stack/index.d.cts +3 -0
  262. package/with-css/stack/index.d.mts +3 -0
  263. package/with-css/stack/index.mjs +8 -0
  264. package/with-css/tile/index.cjs +8 -0
  265. package/with-css/tile/index.d.cts +3 -0
  266. package/with-css/tile/index.d.mts +3 -0
  267. package/with-css/tile/index.mjs +8 -0
@@ -0,0 +1,12 @@
1
+ import { LayoutStyle } from "../types.mjs";
2
+
3
+ //#region src/_internal/applyItemRatio.d.ts
4
+ /**
5
+ * 子要素の縦横比に関する設定の適用
6
+ * @param result
7
+ * @param itemRatioX
8
+ * @param itemRatioY
9
+ */
10
+ declare function applyItemRatio(result: LayoutStyle, itemRatioX: number | null | undefined, itemRatioY: number | null | undefined): void;
11
+ //#endregion
12
+ export { applyItemRatio as default };
@@ -0,0 +1,21 @@
1
+ import { clsLayoutItemRatio, varLayoutItemRatio } from "../_constants.mjs";
2
+ import hasValue from "./hasValue.mjs";
3
+ import mergeClassName from "./mergeClassName.mjs";
4
+
5
+ //#region src/_internal/applyItemRatio.ts
6
+ /**
7
+ * 子要素の縦横比に関する設定の適用
8
+ * @param result
9
+ * @param itemRatioX
10
+ * @param itemRatioY
11
+ */
12
+ function applyItemRatio(result, itemRatioX, itemRatioY) {
13
+ if (hasValue(itemRatioX) || hasValue(itemRatioY)) {
14
+ result.className = mergeClassName(result.className, clsLayoutItemRatio);
15
+ result.style ??= {};
16
+ result.style[varLayoutItemRatio] = `${itemRatioX ?? 1} / ${itemRatioY ?? 1}`;
17
+ }
18
+ }
19
+
20
+ //#endregion
21
+ export { applyItemRatio as default };
@@ -0,0 +1,21 @@
1
+ const require__constants = require('../_constants.cjs');
2
+ const require__internal_hasValue = require('./hasValue.cjs');
3
+ const require__internal_mergeClassName = require('./mergeClassName.cjs');
4
+ const require__internal_unit = require('./unit.cjs');
5
+
6
+ //#region src/_internal/applyItemSize.ts
7
+ function applyItemSize(result, itemSizeX, itemSizeY) {
8
+ if (require__internal_hasValue(itemSizeX)) {
9
+ result.className = require__internal_mergeClassName(result.className, require__constants.clsLayoutItemSizeX);
10
+ result.style ??= {};
11
+ result.style[require__constants.varLayoutItemSizeX] = require__internal_unit(itemSizeX);
12
+ }
13
+ if (require__internal_hasValue(itemSizeY)) {
14
+ result.className = require__internal_mergeClassName(result.className, require__constants.clsLayoutItemSizeY);
15
+ result.style ??= {};
16
+ result.style[require__constants.varLayoutItemSizeY] = require__internal_unit(itemSizeY);
17
+ }
18
+ }
19
+
20
+ //#endregion
21
+ module.exports = applyItemSize;
@@ -0,0 +1,5 @@
1
+ import { LayoutStyle } from "../types.cjs";
2
+
3
+ //#region src/_internal/applyItemSize.d.ts
4
+ declare function applyItemSize(result: LayoutStyle, itemSizeX: number | null | undefined, itemSizeY: number | null | undefined): void;
5
+ export = applyItemSize;
@@ -0,0 +1,6 @@
1
+ import { LayoutStyle } from "../types.mjs";
2
+
3
+ //#region src/_internal/applyItemSize.d.ts
4
+ declare function applyItemSize(result: LayoutStyle, itemSizeX: number | null | undefined, itemSizeY: number | null | undefined): void;
5
+ //#endregion
6
+ export { applyItemSize as default };
@@ -0,0 +1,21 @@
1
+ import { clsLayoutItemSizeX, clsLayoutItemSizeY, varLayoutItemSizeX, varLayoutItemSizeY } from "../_constants.mjs";
2
+ import hasValue from "./hasValue.mjs";
3
+ import mergeClassName from "./mergeClassName.mjs";
4
+ import unit from "./unit.mjs";
5
+
6
+ //#region src/_internal/applyItemSize.ts
7
+ function applyItemSize(result, itemSizeX, itemSizeY) {
8
+ if (hasValue(itemSizeX)) {
9
+ result.className = mergeClassName(result.className, clsLayoutItemSizeX);
10
+ result.style ??= {};
11
+ result.style[varLayoutItemSizeX] = unit(itemSizeX);
12
+ }
13
+ if (hasValue(itemSizeY)) {
14
+ result.className = mergeClassName(result.className, clsLayoutItemSizeY);
15
+ result.style ??= {};
16
+ result.style[varLayoutItemSizeY] = unit(itemSizeY);
17
+ }
18
+ }
19
+
20
+ //#endregion
21
+ export { applyItemSize as default };
@@ -0,0 +1,15 @@
1
+
2
+ //#region src/_internal/hasValue.ts
3
+ /**
4
+ * 有効な値か
5
+ * @param value
6
+ * @returns
7
+ */
8
+ function hasValue(value) {
9
+ if (typeof value === "number") return true;
10
+ else if (typeof value === "boolean") return true;
11
+ else return value !== null && value !== void 0 && value !== "";
12
+ }
13
+
14
+ //#endregion
15
+ module.exports = hasValue;
@@ -0,0 +1,8 @@
1
+ //#region src/_internal/hasValue.d.ts
2
+ /**
3
+ * 有効な値か
4
+ * @param value
5
+ * @returns
6
+ */
7
+ declare function hasValue(value: string | number | boolean | null | undefined): value is string | number | boolean;
8
+ export = hasValue;
@@ -0,0 +1,9 @@
1
+ //#region src/_internal/hasValue.d.ts
2
+ /**
3
+ * 有効な値か
4
+ * @param value
5
+ * @returns
6
+ */
7
+ declare function hasValue(value: string | number | boolean | null | undefined): value is string | number | boolean;
8
+ //#endregion
9
+ export { hasValue as default };
@@ -0,0 +1,14 @@
1
+ //#region src/_internal/hasValue.ts
2
+ /**
3
+ * 有効な値か
4
+ * @param value
5
+ * @returns
6
+ */
7
+ function hasValue(value) {
8
+ if (typeof value === "number") return true;
9
+ else if (typeof value === "boolean") return true;
10
+ else return value !== null && value !== void 0 && value !== "";
11
+ }
12
+
13
+ //#endregion
14
+ export { hasValue as default };
@@ -0,0 +1,11 @@
1
+
2
+ //#region src/_internal/mergeClassName.ts
3
+ function mergeClassName(...classNames) {
4
+ return classNames.reduce((result, className) => {
5
+ if (className) result.push(className);
6
+ return result;
7
+ }, []).join(" ");
8
+ }
9
+
10
+ //#endregion
11
+ module.exports = mergeClassName;
@@ -0,0 +1,3 @@
1
+ //#region src/_internal/mergeClassName.d.ts
2
+ declare function mergeClassName(...classNames: (string | null | undefined)[]): string;
3
+ export = mergeClassName;
@@ -0,0 +1,4 @@
1
+ //#region src/_internal/mergeClassName.d.ts
2
+ declare function mergeClassName(...classNames: (string | null | undefined)[]): string;
3
+ //#endregion
4
+ export { mergeClassName as default };
@@ -0,0 +1,10 @@
1
+ //#region src/_internal/mergeClassName.ts
2
+ function mergeClassName(...classNames) {
3
+ return classNames.reduce((result, className) => {
4
+ if (className) result.push(className);
5
+ return result;
6
+ }, []).join(" ");
7
+ }
8
+
9
+ //#endregion
10
+ export { mergeClassName as default };
@@ -0,0 +1,16 @@
1
+ const require__internal_mergeClassName = require('./mergeClassName.cjs');
2
+
3
+ //#region src/_internal/mergeLayoutResults.ts
4
+ function mergeLayoutResults(results) {
5
+ return results.reduce((layoutResult, result) => {
6
+ if (result.className) layoutResult.className = require__internal_mergeClassName(layoutResult.className, result.className);
7
+ if (result.style) layoutResult.style = {
8
+ ...layoutResult.style,
9
+ ...result.style
10
+ };
11
+ return layoutResult;
12
+ }, {});
13
+ }
14
+
15
+ //#endregion
16
+ module.exports = mergeLayoutResults;
@@ -0,0 +1,5 @@
1
+ import { LayoutStyle } from "../types.cjs";
2
+
3
+ //#region src/_internal/mergeLayoutResults.d.ts
4
+ declare function mergeLayoutResults(results: LayoutStyle[]): LayoutStyle;
5
+ export = mergeLayoutResults;
@@ -0,0 +1,6 @@
1
+ import { LayoutStyle } from "../types.mjs";
2
+
3
+ //#region src/_internal/mergeLayoutResults.d.ts
4
+ declare function mergeLayoutResults(results: LayoutStyle[]): LayoutStyle;
5
+ //#endregion
6
+ export { mergeLayoutResults as default };
@@ -0,0 +1,16 @@
1
+ import mergeClassName from "./mergeClassName.mjs";
2
+
3
+ //#region src/_internal/mergeLayoutResults.ts
4
+ function mergeLayoutResults(results) {
5
+ return results.reduce((layoutResult, result) => {
6
+ if (result.className) layoutResult.className = mergeClassName(layoutResult.className, result.className);
7
+ if (result.style) layoutResult.style = {
8
+ ...layoutResult.style,
9
+ ...result.style
10
+ };
11
+ return layoutResult;
12
+ }, {});
13
+ }
14
+
15
+ //#endregion
16
+ export { mergeLayoutResults as default };
@@ -0,0 +1,9 @@
1
+
2
+ //#region src/_internal/unit.ts
3
+ function unit(value, unit = "px") {
4
+ if (typeof value === "number") return `${value}${unit}`;
5
+ else return value;
6
+ }
7
+
8
+ //#endregion
9
+ module.exports = unit;
@@ -0,0 +1,11 @@
1
+ //#region src/_internal/unit.d.ts
2
+ /**
3
+ * valueが数値の場合、単位を付与して文字列に変換する
4
+ * それ以外はそのまま返す
5
+ * @param value
6
+ * @param unit
7
+ * @returns
8
+ */
9
+ declare function unit(value: string | number, unit?: string): string;
10
+ declare function unit(value: string | number | null | undefined, unit?: string): string | null | undefined;
11
+ export = unit;
@@ -0,0 +1,12 @@
1
+ //#region src/_internal/unit.d.ts
2
+ /**
3
+ * valueが数値の場合、単位を付与して文字列に変換する
4
+ * それ以外はそのまま返す
5
+ * @param value
6
+ * @param unit
7
+ * @returns
8
+ */
9
+ declare function unit(value: string | number, unit?: string): string;
10
+ declare function unit(value: string | number | null | undefined, unit?: string): string | null | undefined;
11
+ //#endregion
12
+ export { unit as default };
@@ -0,0 +1,8 @@
1
+ //#region src/_internal/unit.ts
2
+ function unit(value, unit = "px") {
3
+ if (typeof value === "number") return `${value}${unit}`;
4
+ else return value;
5
+ }
6
+
7
+ //#endregion
8
+ export { unit as default };
@@ -0,0 +1 @@
1
+ require('./styles.css');
@@ -0,0 +1 @@
1
+ export { };
@@ -0,0 +1 @@
1
+ export { };
@@ -0,0 +1,3 @@
1
+ import "./styles.css";
2
+
3
+ export { };
package/_types.cjs ADDED
File without changes
package/_types.d.cts ADDED
@@ -0,0 +1,115 @@
1
+ import { Adjust, AlignX, AlignY, Direction } from "./constants.cjs";
2
+
3
+ //#region src/_types.d.ts
4
+ /**
5
+ * 子要素を並べる方向
6
+ */
7
+ type DirectionOptions<D extends Direction = Direction> = {
8
+ /**
9
+ * 並べる方向
10
+ */
11
+ direction?: D | null;
12
+ };
13
+ /**
14
+ * 子要素の位置
15
+ */
16
+ type AlignOptions = {
17
+ /**
18
+ * 子要素の横位置
19
+ */
20
+ alignX?: AlignX | null;
21
+ /**
22
+ * 子要素の縦位置
23
+ */
24
+ alignY?: AlignY | null;
25
+ };
26
+ /**
27
+ * 子要素のサイズ調整
28
+ */
29
+ type AdjustOptions = {
30
+ /**
31
+ * 子要素の幅の調整
32
+ * itemSizeXを指定した場合に有効
33
+ * デフォルトは`none`
34
+ */
35
+ adjustX?: Adjust | null;
36
+ /**
37
+ * 子要素の高さの調整
38
+ * itemSizeYを指定した場合に有効
39
+ * デフォルトは`none`
40
+ */
41
+ adjustY?: Adjust | null;
42
+ };
43
+ /**
44
+ * 要素間の余白
45
+ */
46
+ type GapOptions = {
47
+ /**
48
+ * 余白
49
+ */
50
+ gap?: number | null;
51
+ /**
52
+ * 横方向の余白
53
+ */
54
+ gapX?: number | null;
55
+ /**
56
+ * 縦方向の余白
57
+ */
58
+ gapY?: number | null;
59
+ };
60
+ /**
61
+ * 子要素のサイズ
62
+ */
63
+ type ItemSizeOptions = {
64
+ /**
65
+ * 子要素の幅
66
+ */
67
+ itemSizeX?: number | null;
68
+ /**
69
+ * 子要素の高さ
70
+ */
71
+ itemSizeY?: number | null;
72
+ };
73
+ /**
74
+ * 子要素のサイズの縦横比
75
+ */
76
+ type ItemRatioOptions = {
77
+ /**
78
+ * 子要素の縦横比(横)
79
+ */
80
+ itemRatioX?: number | null;
81
+ /**
82
+ * 子要素の縦横比(縦)
83
+ */
84
+ itemRatioY?: number | null;
85
+ };
86
+ /**
87
+ * 子要素の数
88
+ */
89
+ type ItemCountOptions = {
90
+ /**
91
+ * 横方向の要素数
92
+ */
93
+ itemCountX?: number | null;
94
+ /**
95
+ * 縦方向の要素数
96
+ */
97
+ itemCountY?: number | null;
98
+ };
99
+ /**
100
+ * 子要素のサイズと数
101
+ */
102
+ type TracksOptions = {
103
+ /**
104
+ * 横方向の設定
105
+ * このプロパティが設定されている場合、itemCountX,itemSizeXは無効
106
+ */
107
+ tracksX?: (string | number)[] | null;
108
+ /**
109
+ * 縦方向の設定
110
+ * このプロパティが設定されている場合、itemCountY,itemSizeYは無効
111
+ */
112
+ tracksY?: (string | number)[] | null;
113
+ };
114
+ //#endregion
115
+ export { AdjustOptions, AlignOptions, DirectionOptions, GapOptions, ItemCountOptions, ItemRatioOptions, ItemSizeOptions, TracksOptions };
package/_types.d.mts ADDED
@@ -0,0 +1,115 @@
1
+ import { Adjust, AlignX, AlignY, Direction } from "./constants.mjs";
2
+
3
+ //#region src/_types.d.ts
4
+ /**
5
+ * 子要素を並べる方向
6
+ */
7
+ type DirectionOptions<D extends Direction = Direction> = {
8
+ /**
9
+ * 並べる方向
10
+ */
11
+ direction?: D | null;
12
+ };
13
+ /**
14
+ * 子要素の位置
15
+ */
16
+ type AlignOptions = {
17
+ /**
18
+ * 子要素の横位置
19
+ */
20
+ alignX?: AlignX | null;
21
+ /**
22
+ * 子要素の縦位置
23
+ */
24
+ alignY?: AlignY | null;
25
+ };
26
+ /**
27
+ * 子要素のサイズ調整
28
+ */
29
+ type AdjustOptions = {
30
+ /**
31
+ * 子要素の幅の調整
32
+ * itemSizeXを指定した場合に有効
33
+ * デフォルトは`none`
34
+ */
35
+ adjustX?: Adjust | null;
36
+ /**
37
+ * 子要素の高さの調整
38
+ * itemSizeYを指定した場合に有効
39
+ * デフォルトは`none`
40
+ */
41
+ adjustY?: Adjust | null;
42
+ };
43
+ /**
44
+ * 要素間の余白
45
+ */
46
+ type GapOptions = {
47
+ /**
48
+ * 余白
49
+ */
50
+ gap?: number | null;
51
+ /**
52
+ * 横方向の余白
53
+ */
54
+ gapX?: number | null;
55
+ /**
56
+ * 縦方向の余白
57
+ */
58
+ gapY?: number | null;
59
+ };
60
+ /**
61
+ * 子要素のサイズ
62
+ */
63
+ type ItemSizeOptions = {
64
+ /**
65
+ * 子要素の幅
66
+ */
67
+ itemSizeX?: number | null;
68
+ /**
69
+ * 子要素の高さ
70
+ */
71
+ itemSizeY?: number | null;
72
+ };
73
+ /**
74
+ * 子要素のサイズの縦横比
75
+ */
76
+ type ItemRatioOptions = {
77
+ /**
78
+ * 子要素の縦横比(横)
79
+ */
80
+ itemRatioX?: number | null;
81
+ /**
82
+ * 子要素の縦横比(縦)
83
+ */
84
+ itemRatioY?: number | null;
85
+ };
86
+ /**
87
+ * 子要素の数
88
+ */
89
+ type ItemCountOptions = {
90
+ /**
91
+ * 横方向の要素数
92
+ */
93
+ itemCountX?: number | null;
94
+ /**
95
+ * 縦方向の要素数
96
+ */
97
+ itemCountY?: number | null;
98
+ };
99
+ /**
100
+ * 子要素のサイズと数
101
+ */
102
+ type TracksOptions = {
103
+ /**
104
+ * 横方向の設定
105
+ * このプロパティが設定されている場合、itemCountX,itemSizeXは無効
106
+ */
107
+ tracksX?: (string | number)[] | null;
108
+ /**
109
+ * 縦方向の設定
110
+ * このプロパティが設定されている場合、itemCountY,itemSizeYは無効
111
+ */
112
+ tracksY?: (string | number)[] | null;
113
+ };
114
+ //#endregion
115
+ export { AdjustOptions, AlignOptions, DirectionOptions, GapOptions, ItemCountOptions, ItemRatioOptions, ItemSizeOptions, TracksOptions };
package/_types.mjs ADDED
@@ -0,0 +1 @@
1
+ export { };
@@ -0,0 +1,29 @@
1
+ //#region \0rolldown/runtime.js
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __copyProps = (to, from, except, desc) => {
9
+ if (from && typeof from === "object" || typeof from === "function") {
10
+ for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
11
+ key = keys[i];
12
+ if (!__hasOwnProp.call(to, key) && key !== except) {
13
+ __defProp(to, key, {
14
+ get: ((k) => from[k]).bind(null, key),
15
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
16
+ });
17
+ }
18
+ }
19
+ }
20
+ return to;
21
+ };
22
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
23
+ value: mod,
24
+ enumerable: true
25
+ }) : target, mod));
26
+
27
+ //#endregion
28
+
29
+ exports.__toESM = __toESM;
@@ -0,0 +1,37 @@
1
+ const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
2
+ const require__constants = require('../_constants.cjs');
3
+ const require__internal_mergeClassName = require('../_internal/mergeClassName.cjs');
4
+ const require__internal_applyGap = require('../_internal/applyGap.cjs');
5
+ const require__internal_applyItemRatio = require('../_internal/applyItemRatio.cjs');
6
+ const require__internal_applyItemSize = require('../_internal/applyItemSize.cjs');
7
+ let _fringeworks_utils_object_maybeDefault = require("@fringeworks/utils/object/maybeDefault");
8
+ _fringeworks_utils_object_maybeDefault = require_runtime.__toESM(_fringeworks_utils_object_maybeDefault, 1);
9
+
10
+ //#region src/balance/balance.ts
11
+ /**
12
+ * balanceレイアウト
13
+ *
14
+ * - 子要素を均等に配置する
15
+ * - `adjust`が効いていない場合は、子要素のサイズを維持したまま、余白を均等に配分する
16
+ * - `adjust`が効いている場合は、子要素のサイズを調整してコンテナを満たす
17
+ */
18
+ const balance = (options = {}) => {
19
+ const { direction, alignX, alignY, adjustX, adjustY, gap, gapX, gapY, itemSizeX, itemSizeY, itemRatioX, itemRatioY } = (0, _fringeworks_utils_object_maybeDefault.default)(options, {
20
+ direction: "x",
21
+ alignX: "left",
22
+ alignY: "top",
23
+ adjustX: "none",
24
+ adjustY: "none"
25
+ }, { overwriteNull: true });
26
+ const result = {
27
+ className: require__internal_mergeClassName(require__constants.clsLayoutBalance, require__constants.clsLayout.direction[direction], require__constants.clsLayout.align.x[alignX], require__constants.clsLayout.align.y[alignY], require__constants.clsLayout.adjust.x[adjustX], require__constants.clsLayout.adjust.y[adjustY]),
28
+ style: {}
29
+ };
30
+ require__internal_applyGap(result, gap, gapX, gapY);
31
+ require__internal_applyItemSize(result, itemSizeX, itemSizeY);
32
+ require__internal_applyItemRatio(result, itemRatioX, itemRatioY);
33
+ return result;
34
+ };
35
+
36
+ //#endregion
37
+ module.exports = balance;
@@ -0,0 +1,13 @@
1
+ import { CreateLayoutStyle } from "../types.cjs";
2
+ import { BalanceLayoutOptions } from "./types.cjs";
3
+
4
+ //#region src/balance/balance.d.ts
5
+ /**
6
+ * balanceレイアウト
7
+ *
8
+ * - 子要素を均等に配置する
9
+ * - `adjust`が効いていない場合は、子要素のサイズを維持したまま、余白を均等に配分する
10
+ * - `adjust`が効いている場合は、子要素のサイズを調整してコンテナを満たす
11
+ */
12
+ declare const balance: CreateLayoutStyle<BalanceLayoutOptions>;
13
+ export = balance;
@@ -0,0 +1,14 @@
1
+ import { CreateLayoutStyle } from "../types.mjs";
2
+ import { BalanceLayoutOptions } from "./types.mjs";
3
+
4
+ //#region src/balance/balance.d.ts
5
+ /**
6
+ * balanceレイアウト
7
+ *
8
+ * - 子要素を均等に配置する
9
+ * - `adjust`が効いていない場合は、子要素のサイズを維持したまま、余白を均等に配分する
10
+ * - `adjust`が効いている場合は、子要素のサイズを調整してコンテナを満たす
11
+ */
12
+ declare const balance: CreateLayoutStyle<BalanceLayoutOptions>;
13
+ //#endregion
14
+ export { balance as default };
@@ -0,0 +1,35 @@
1
+ import { clsLayout, clsLayoutBalance } from "../_constants.mjs";
2
+ import mergeClassName from "../_internal/mergeClassName.mjs";
3
+ import applyGap from "../_internal/applyGap.mjs";
4
+ import applyItemRatio from "../_internal/applyItemRatio.mjs";
5
+ import applyItemSize from "../_internal/applyItemSize.mjs";
6
+ import maybeDefault from "@fringeworks/utils/object/maybeDefault";
7
+
8
+ //#region src/balance/balance.ts
9
+ /**
10
+ * balanceレイアウト
11
+ *
12
+ * - 子要素を均等に配置する
13
+ * - `adjust`が効いていない場合は、子要素のサイズを維持したまま、余白を均等に配分する
14
+ * - `adjust`が効いている場合は、子要素のサイズを調整してコンテナを満たす
15
+ */
16
+ const balance = (options = {}) => {
17
+ const { direction, alignX, alignY, adjustX, adjustY, gap, gapX, gapY, itemSizeX, itemSizeY, itemRatioX, itemRatioY } = maybeDefault(options, {
18
+ direction: "x",
19
+ alignX: "left",
20
+ alignY: "top",
21
+ adjustX: "none",
22
+ adjustY: "none"
23
+ }, { overwriteNull: true });
24
+ const result = {
25
+ className: mergeClassName(clsLayoutBalance, clsLayout.direction[direction], clsLayout.align.x[alignX], clsLayout.align.y[alignY], clsLayout.adjust.x[adjustX], clsLayout.adjust.y[adjustY]),
26
+ style: {}
27
+ };
28
+ applyGap(result, gap, gapX, gapY);
29
+ applyItemSize(result, itemSizeX, itemSizeY);
30
+ applyItemRatio(result, itemRatioX, itemRatioY);
31
+ return result;
32
+ };
33
+
34
+ //#endregion
35
+ export { balance as default };
@@ -0,0 +1,3 @@
1
+ const require_balance_balance = require('./balance.cjs');
2
+
3
+ module.exports = require_balance_balance;