@fringeworks/style-layouts 0.0.0-stage → 0.8.1

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,3 @@
1
+ import { BalanceLayoutOptions } from "./types.cjs";
2
+ import balance from "./balance.cjs";
3
+ export { type BalanceLayoutOptions, balance as default };
@@ -0,0 +1,3 @@
1
+ import { BalanceLayoutOptions } from "./types.mjs";
2
+ import balance from "./balance.mjs";
3
+ export { type BalanceLayoutOptions, balance as default };
@@ -0,0 +1,3 @@
1
+ import balance from "./balance.mjs";
2
+
3
+ export { balance as default };
@@ -0,0 +1,131 @@
1
+ .frg-layout-balance {
2
+ --frg-layout-gapX: 0px;
3
+ --frg-layout-gapY: 0px;
4
+ --frg-layout-itemSizeX: auto;
5
+ --frg-layout-itemSizeY: auto;
6
+ --frg-layout-itemRatio: auto;
7
+ display: grid;
8
+ }
9
+ .frg-layout-balance.frg-layout-direction-x {
10
+ grid-auto-flow: column;
11
+ grid-auto-columns: max-content;
12
+ }
13
+ .frg-layout-balance.frg-layout-direction-x.frg-layout-adjustX-grow, .frg-layout-balance.frg-layout-direction-x.frg-layout-adjustX-fit {
14
+ grid-auto-columns: auto;
15
+ }
16
+ .frg-layout-balance.frg-layout-direction-x.frg-layout-adjustX-shrink {
17
+ grid-auto-columns: minmax(0, max-content);
18
+ }
19
+ .frg-layout-balance.frg-layout-direction-x.frg-layout-itemSizeX {
20
+ grid-auto-columns: auto;
21
+ }
22
+ .frg-layout-balance.frg-layout-direction-y {
23
+ grid-auto-flow: row;
24
+ grid-auto-rows: max-content;
25
+ }
26
+ .frg-layout-balance.frg-layout-direction-y.frg-layout-adjustY-grow, .frg-layout-balance.frg-layout-direction-y.frg-layout-adjustY-fit {
27
+ grid-auto-rows: auto;
28
+ }
29
+ .frg-layout-balance.frg-layout-direction-y.frg-layout-adjustY-shrink {
30
+ grid-auto-rows: minmax(0, max-content);
31
+ }
32
+ .frg-layout-balance.frg-layout-direction-y.frg-layout-itemSizeY {
33
+ grid-auto-rows: auto;
34
+ }
35
+ .frg-layout-balance.frg-layout-alignX-left {
36
+ justify-items: flex-start;
37
+ }
38
+ .frg-layout-balance.frg-layout-alignX-center {
39
+ justify-items: center;
40
+ }
41
+ .frg-layout-balance.frg-layout-alignX-right {
42
+ justify-items: flex-end;
43
+ }
44
+ .frg-layout-balance.frg-layout-alignX-spaceBetween {
45
+ justify-content: space-between;
46
+ }
47
+ .frg-layout-balance.frg-layout-alignX-spaceAround {
48
+ justify-content: space-around;
49
+ }
50
+ .frg-layout-balance.frg-layout-alignX-spaceEvenly {
51
+ justify-content: space-evenly;
52
+ }
53
+ .frg-layout-balance.frg-layout-alignY-top {
54
+ align-items: flex-start;
55
+ }
56
+ .frg-layout-balance.frg-layout-alignY-middle {
57
+ align-items: center;
58
+ }
59
+ .frg-layout-balance.frg-layout-alignY-bottom {
60
+ align-items: flex-end;
61
+ }
62
+ .frg-layout-balance.frg-layout-alignY-spaceBetween {
63
+ align-content: space-between;
64
+ }
65
+ .frg-layout-balance.frg-layout-alignY-spaceAround {
66
+ align-content: space-around;
67
+ }
68
+ .frg-layout-balance.frg-layout-alignY-spaceEvenly {
69
+ align-content: space-evenly;
70
+ }
71
+ .frg-layout-balance > * {
72
+ min-width: 0;
73
+ min-height: 0;
74
+ }
75
+ .frg-layout-balance.frg-layout-itemSizeX > * {
76
+ width: var(--frg-layout-itemSizeX);
77
+ }
78
+ .frg-layout-balance.frg-layout-adjustX-fit {
79
+ justify-items: stretch;
80
+ }
81
+ .frg-layout-balance.frg-layout-adjustX-fit > * {
82
+ width: auto;
83
+ }
84
+ .frg-layout-balance.frg-layout-adjustX-grow > *, .frg-layout-balance.frg-layout-adjustX-shrink > * {
85
+ width: 100%;
86
+ }
87
+ .frg-layout-balance.frg-layout-adjustX-grow > * {
88
+ min-width: max-content;
89
+ }
90
+ .frg-layout-balance.frg-layout-adjustX-grow.frg-layout-itemSizeX > * {
91
+ min-width: var(--frg-layout-itemSizeX);
92
+ }
93
+ .frg-layout-balance.frg-layout-adjustX-shrink > * {
94
+ max-width: max-content;
95
+ }
96
+ .frg-layout-balance.frg-layout-adjustX-shrink.frg-layout-itemSizeX > * {
97
+ max-width: var(--frg-layout-itemSizeX);
98
+ }
99
+ .frg-layout-balance.frg-layout-itemSizeY > * {
100
+ height: var(--frg-layout-itemSizeY);
101
+ }
102
+ .frg-layout-balance.frg-layout-adjustY-fit {
103
+ align-items: stretch;
104
+ }
105
+ .frg-layout-balance.frg-layout-adjustY-fit > * {
106
+ height: auto;
107
+ }
108
+ .frg-layout-balance.frg-layout-adjustY-grow > *, .frg-layout-balance.frg-layout-adjustY-shrink > * {
109
+ height: 100%;
110
+ }
111
+ .frg-layout-balance.frg-layout-adjustY-grow:not(.frg-layout-itemSizeY) > * {
112
+ min-height: max-content;
113
+ }
114
+ .frg-layout-balance.frg-layout-adjustY-grow.frg-layout-itemSizeY > * {
115
+ min-height: var(--frg-layout-itemSizeY);
116
+ }
117
+ .frg-layout-balance.frg-layout-adjustY-shrink:not(.frg-layout-itemSizeY) > * {
118
+ max-height: max-content;
119
+ }
120
+ .frg-layout-balance.frg-layout-adjustY-shrink.frg-layout-itemSizeY > * {
121
+ max-height: var(--frg-layout-itemSizeY);
122
+ }
123
+ .frg-layout-balance.frg-layout-itemRatio > * {
124
+ aspect-ratio: var(--frg-layout-itemRatio);
125
+ }
126
+ .frg-layout-balance.frg-layout-gapX {
127
+ column-gap: var(--frg-layout-gapX);
128
+ }
129
+ .frg-layout-balance.frg-layout-gapY {
130
+ row-gap: var(--frg-layout-gapY);
131
+ }
File without changes
@@ -0,0 +1,21 @@
1
+ import { AlignXBase, AlignYBase } from "../constants.cjs";
2
+ import { AdjustOptions, AlignOptions, DirectionOptions, GapOptions, ItemRatioOptions, ItemSizeOptions } from "../_types.cjs";
3
+
4
+ //#region src/balance/types.d.ts
5
+ /**
6
+ * balanceのオプション
7
+ *
8
+ * - `direction='x'` 時: `alignY` に `space-between`,`space-around`,`space-evenly` 指定不可
9
+ * - `direction='y'` 時: `alignX` に `space-between`,`space-around`,`space-evenly` 指定不可
10
+ */
11
+ type BalanceLayoutOptions = AdjustOptions & GapOptions & ItemSizeOptions & ItemRatioOptions & BalanceDirectionWithAlignOptions;
12
+ /**
13
+ * direction & alignのオプション
14
+ */
15
+ type BalanceDirectionWithAlignOptions = (DirectionOptions<'x'> & Omit<AlignOptions, 'alignY'> & {
16
+ alignY?: AlignYBase;
17
+ }) | (DirectionOptions<'y'> & Omit<AlignOptions, 'alignX'> & {
18
+ alignX?: AlignXBase;
19
+ });
20
+ //#endregion
21
+ export { BalanceLayoutOptions };
@@ -0,0 +1,21 @@
1
+ import { AlignXBase, AlignYBase } from "../constants.mjs";
2
+ import { AdjustOptions, AlignOptions, DirectionOptions, GapOptions, ItemRatioOptions, ItemSizeOptions } from "../_types.mjs";
3
+
4
+ //#region src/balance/types.d.ts
5
+ /**
6
+ * balanceのオプション
7
+ *
8
+ * - `direction='x'` 時: `alignY` に `space-between`,`space-around`,`space-evenly` 指定不可
9
+ * - `direction='y'` 時: `alignX` に `space-between`,`space-around`,`space-evenly` 指定不可
10
+ */
11
+ type BalanceLayoutOptions = AdjustOptions & GapOptions & ItemSizeOptions & ItemRatioOptions & BalanceDirectionWithAlignOptions;
12
+ /**
13
+ * direction & alignのオプション
14
+ */
15
+ type BalanceDirectionWithAlignOptions = (DirectionOptions<'x'> & Omit<AlignOptions, 'alignY'> & {
16
+ alignY?: AlignYBase;
17
+ }) | (DirectionOptions<'y'> & Omit<AlignOptions, 'alignX'> & {
18
+ alignX?: AlignXBase;
19
+ });
20
+ //#endregion
21
+ export { BalanceLayoutOptions };
@@ -0,0 +1 @@
1
+ export { };
@@ -0,0 +1,34 @@
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/center/center.ts
11
+ /**
12
+ * centerレイアウト
13
+ *
14
+ * - 子要素を中央に配置する
15
+ * - 親要素が子要素のサイズよりも小さくなっても左上が親要素内に収まる
16
+ */
17
+ const center = (options = {}) => {
18
+ const { direction, adjustX, adjustY, gap, gapX, gapY, itemSizeX, itemSizeY, itemRatioX, itemRatioY } = (0, _fringeworks_utils_object_maybeDefault.default)(options, {
19
+ direction: "x",
20
+ adjustX: "none",
21
+ adjustY: "none"
22
+ }, { overwriteNull: true });
23
+ const result = {
24
+ className: require__internal_mergeClassName(require__constants.clsLayoutCenter, require__constants.clsLayout.direction[direction], require__constants.clsLayout.adjust.x[adjustX], require__constants.clsLayout.adjust.y[adjustY]),
25
+ style: {}
26
+ };
27
+ require__internal_applyGap(result, gap, gapX, gapY);
28
+ require__internal_applyItemSize(result, itemSizeX, itemSizeY);
29
+ require__internal_applyItemRatio(result, itemRatioX, itemRatioY);
30
+ return result;
31
+ };
32
+
33
+ //#endregion
34
+ module.exports = center;
@@ -0,0 +1,12 @@
1
+ import { CreateLayoutStyle } from "../types.cjs";
2
+ import { CenterLayoutOptions } from "./types.cjs";
3
+
4
+ //#region src/center/center.d.ts
5
+ /**
6
+ * centerレイアウト
7
+ *
8
+ * - 子要素を中央に配置する
9
+ * - 親要素が子要素のサイズよりも小さくなっても左上が親要素内に収まる
10
+ */
11
+ declare const center: CreateLayoutStyle<CenterLayoutOptions>;
12
+ export = center;
@@ -0,0 +1,13 @@
1
+ import { CreateLayoutStyle } from "../types.mjs";
2
+ import { CenterLayoutOptions } from "./types.mjs";
3
+
4
+ //#region src/center/center.d.ts
5
+ /**
6
+ * centerレイアウト
7
+ *
8
+ * - 子要素を中央に配置する
9
+ * - 親要素が子要素のサイズよりも小さくなっても左上が親要素内に収まる
10
+ */
11
+ declare const center: CreateLayoutStyle<CenterLayoutOptions>;
12
+ //#endregion
13
+ export { center as default };
@@ -0,0 +1,32 @@
1
+ import { clsLayout, clsLayoutCenter } 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/center/center.ts
9
+ /**
10
+ * centerレイアウト
11
+ *
12
+ * - 子要素を中央に配置する
13
+ * - 親要素が子要素のサイズよりも小さくなっても左上が親要素内に収まる
14
+ */
15
+ const center = (options = {}) => {
16
+ const { direction, adjustX, adjustY, gap, gapX, gapY, itemSizeX, itemSizeY, itemRatioX, itemRatioY } = maybeDefault(options, {
17
+ direction: "x",
18
+ adjustX: "none",
19
+ adjustY: "none"
20
+ }, { overwriteNull: true });
21
+ const result = {
22
+ className: mergeClassName(clsLayoutCenter, clsLayout.direction[direction], clsLayout.adjust.x[adjustX], clsLayout.adjust.y[adjustY]),
23
+ style: {}
24
+ };
25
+ applyGap(result, gap, gapX, gapY);
26
+ applyItemSize(result, itemSizeX, itemSizeY);
27
+ applyItemRatio(result, itemRatioX, itemRatioY);
28
+ return result;
29
+ };
30
+
31
+ //#endregion
32
+ export { center as default };
@@ -0,0 +1,3 @@
1
+ const require_center_center = require('./center.cjs');
2
+
3
+ module.exports = require_center_center;
@@ -0,0 +1,3 @@
1
+ import { CenterLayoutOptions } from "./types.cjs";
2
+ import center from "./center.cjs";
3
+ export { type CenterLayoutOptions, center as default };
@@ -0,0 +1,3 @@
1
+ import { CenterLayoutOptions } from "./types.mjs";
2
+ import center from "./center.mjs";
3
+ export { type CenterLayoutOptions, center as default };
@@ -0,0 +1,3 @@
1
+ import center from "./center.mjs";
2
+
3
+ export { center as default };
@@ -0,0 +1,157 @@
1
+ .frg-layout-center {
2
+ --frg-layout-gapX: 0px;
3
+ --frg-layout-gapY: 0px;
4
+ --frg-layout-itemSizeX: auto;
5
+ --frg-layout-itemSizeY: auto;
6
+ --frg-layout-itemRatio: auto;
7
+ display: flex;
8
+ justify-content: flex-start;
9
+ align-content: flex-start;
10
+ flex-wrap: nowrap;
11
+ }
12
+ .frg-layout-center > * {
13
+ min-width: 0;
14
+ max-width: 100%;
15
+ min-height: 0;
16
+ max-height: 100%;
17
+ margin: 0;
18
+ }
19
+ .frg-layout-center.frg-layout-direction-x {
20
+ flex-direction: row;
21
+ }
22
+ .frg-layout-center.frg-layout-direction-x > * {
23
+ max-width: none;
24
+ max-height: none;
25
+ flex-grow: 0;
26
+ flex-shrink: 0;
27
+ margin-top: auto;
28
+ margin-bottom: auto;
29
+ }
30
+ .frg-layout-center.frg-layout-direction-x > *:first-child {
31
+ margin-left: auto;
32
+ }
33
+ .frg-layout-center.frg-layout-direction-x > *:last-child {
34
+ margin-right: auto;
35
+ }
36
+ .frg-layout-center.frg-layout-direction-x.frg-layout-itemSizeX > * {
37
+ width: var(--frg-layout-itemSizeX);
38
+ flex-basis: var(--frg-layout-itemSizeX);
39
+ }
40
+ .frg-layout-center.frg-layout-direction-x.frg-layout-adjustX-fit > * {
41
+ width: 100%;
42
+ max-width: none;
43
+ flex-grow: 1;
44
+ flex-shrink: 1;
45
+ flex-basis: 0%;
46
+ }
47
+ .frg-layout-center.frg-layout-direction-x.frg-layout-adjustX-grow > * {
48
+ width: 100%;
49
+ min-width: var(--frg-layout-itemSizeX);
50
+ max-width: none;
51
+ flex-grow: 1;
52
+ flex-basis: var(--frg-layout-itemSizeX);
53
+ }
54
+ .frg-layout-center.frg-layout-direction-x.frg-layout-adjustX-shrink > * {
55
+ width: var(--frg-layout-itemSizeX);
56
+ max-width: 100%;
57
+ flex-shrink: 1;
58
+ flex-basis: var(--frg-layout-itemSizeX);
59
+ }
60
+ .frg-layout-center.frg-layout-direction-x.frg-layout-itemSizeY > * {
61
+ height: var(--frg-layout-itemSizeY);
62
+ }
63
+ .frg-layout-center.frg-layout-direction-x.frg-layout-adjustY-fit {
64
+ align-items: stretch;
65
+ }
66
+ .frg-layout-center.frg-layout-direction-x.frg-layout-adjustY-fit > * {
67
+ height: 100%;
68
+ max-height: none;
69
+ }
70
+ .frg-layout-center.frg-layout-direction-x.frg-layout-adjustY-grow {
71
+ align-items: stretch;
72
+ }
73
+ .frg-layout-center.frg-layout-direction-x.frg-layout-adjustY-grow > * {
74
+ height: 100%;
75
+ min-height: var(--frg-layout-itemSizeY);
76
+ max-height: none;
77
+ }
78
+ .frg-layout-center.frg-layout-direction-x.frg-layout-adjustY-shrink > * {
79
+ height: var(--frg-layout-itemSizeY);
80
+ max-height: 100%;
81
+ margin-top: auto;
82
+ margin-bottom: auto;
83
+ }
84
+ .frg-layout-center.frg-layout-direction-y {
85
+ flex-direction: column;
86
+ }
87
+ .frg-layout-center.frg-layout-direction-y > * {
88
+ max-width: none;
89
+ max-height: none;
90
+ flex-grow: 0;
91
+ flex-shrink: 0;
92
+ margin-left: auto;
93
+ margin-right: auto;
94
+ }
95
+ .frg-layout-center.frg-layout-direction-y > *:first-child {
96
+ margin-top: auto;
97
+ }
98
+ .frg-layout-center.frg-layout-direction-y > *:last-child {
99
+ margin-bottom: auto;
100
+ }
101
+ .frg-layout-center.frg-layout-direction-y.frg-layout-itemSizeX > * {
102
+ width: var(--frg-layout-itemSizeX);
103
+ }
104
+ .frg-layout-center.frg-layout-direction-y.frg-layout-adjustX-fit {
105
+ align-items: stretch;
106
+ }
107
+ .frg-layout-center.frg-layout-direction-y.frg-layout-adjustX-fit > * {
108
+ width: 100%;
109
+ max-width: none;
110
+ }
111
+ .frg-layout-center.frg-layout-direction-y.frg-layout-adjustX-grow {
112
+ align-items: stretch;
113
+ }
114
+ .frg-layout-center.frg-layout-direction-y.frg-layout-adjustX-grow > * {
115
+ width: 100%;
116
+ min-width: var(--frg-layout-itemSizeX);
117
+ max-width: none;
118
+ }
119
+ .frg-layout-center.frg-layout-direction-y.frg-layout-adjustX-shrink > * {
120
+ width: var(--frg-layout-itemSizeX);
121
+ max-width: 100%;
122
+ margin-left: auto;
123
+ margin-right: auto;
124
+ }
125
+ .frg-layout-center.frg-layout-direction-y.frg-layout-itemSizeY > * {
126
+ height: var(--frg-layout-itemSizeY);
127
+ flex-basis: var(--frg-layout-itemSizeY);
128
+ }
129
+ .frg-layout-center.frg-layout-direction-y.frg-layout-adjustY-fit > * {
130
+ height: 100%;
131
+ max-height: none;
132
+ flex-grow: 1;
133
+ flex-shrink: 1;
134
+ flex-basis: 0%;
135
+ }
136
+ .frg-layout-center.frg-layout-direction-y.frg-layout-adjustY-grow > * {
137
+ height: 100%;
138
+ min-height: var(--frg-layout-itemSizeY);
139
+ max-height: none;
140
+ flex-grow: 1;
141
+ flex-basis: var(--frg-layout-itemSizeY);
142
+ }
143
+ .frg-layout-center.frg-layout-direction-y.frg-layout-adjustY-shrink > * {
144
+ height: var(--frg-layout-itemSizeY);
145
+ max-height: 100%;
146
+ flex-shrink: 1;
147
+ flex-basis: var(--frg-layout-itemSizeY);
148
+ }
149
+ .frg-layout-center.frg-layout-itemRatio > * {
150
+ aspect-ratio: var(--frg-layout-itemRatio);
151
+ }
152
+ .frg-layout-center.frg-layout-gapX {
153
+ column-gap: var(--frg-layout-gapX);
154
+ }
155
+ .frg-layout-center.frg-layout-gapY {
156
+ row-gap: var(--frg-layout-gapY);
157
+ }
File without changes
@@ -0,0 +1,9 @@
1
+ import { AdjustOptions, DirectionOptions, GapOptions, ItemRatioOptions, ItemSizeOptions } from "../_types.cjs";
2
+
3
+ //#region src/center/types.d.ts
4
+ /**
5
+ * centerのオプション
6
+ */
7
+ type CenterLayoutOptions = DirectionOptions & AdjustOptions & GapOptions & ItemSizeOptions & ItemRatioOptions;
8
+ //#endregion
9
+ export { CenterLayoutOptions };
@@ -0,0 +1,9 @@
1
+ import { AdjustOptions, DirectionOptions, GapOptions, ItemRatioOptions, ItemSizeOptions } from "../_types.mjs";
2
+
3
+ //#region src/center/types.d.ts
4
+ /**
5
+ * centerのオプション
6
+ */
7
+ type CenterLayoutOptions = DirectionOptions & AdjustOptions & GapOptions & ItemSizeOptions & ItemRatioOptions;
8
+ //#endregion
9
+ export { CenterLayoutOptions };
@@ -0,0 +1 @@
1
+ export { };
package/constants.cjs ADDED
@@ -0,0 +1,109 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+
3
+ //#region src/constants.ts
4
+ /**
5
+ * 整列方向
6
+ *
7
+ * - x: 横方向
8
+ * - y: 縦方向
9
+ */
10
+ const Direction = {
11
+ x: "x",
12
+ y: "y"
13
+ };
14
+ const AlignBetween = {
15
+ "space-between": "space-between",
16
+ "space-around": "space-around",
17
+ "space-evenly": "space-evenly"
18
+ };
19
+ /**
20
+ * 横位置
21
+ *
22
+ * - left: 左寄せ
23
+ * - center: 中央寄せ
24
+ * - right: 右寄せ
25
+ */
26
+ const AlignXBase = {
27
+ left: "left",
28
+ center: "center",
29
+ right: "right"
30
+ };
31
+ /**
32
+ * 横位置
33
+ *
34
+ * - left: 左寄せ
35
+ * - center: 中央寄せ
36
+ * - right: 右寄せ
37
+ * - space-between: 両端揃え
38
+ * - space-around: 両端余白あり均等
39
+ * - space-evenly: 完全均等
40
+ */
41
+ const AlignX = {
42
+ ...AlignXBase,
43
+ ...AlignBetween
44
+ };
45
+ /**
46
+ * 縦位置
47
+ *
48
+ * - top: 上寄せ
49
+ * - middle: 中央寄せ
50
+ * - bottom: 下寄せ
51
+ */
52
+ const AlignYBase = {
53
+ top: "top",
54
+ middle: "middle",
55
+ bottom: "bottom"
56
+ };
57
+ /**
58
+ * 縦位置
59
+ *
60
+ * - top: 上寄せ
61
+ * - middle: 中央寄せ
62
+ * - bottom: 下寄せ
63
+ * - space-between: 両端揃え
64
+ * - space-around: 両端余白あり均等
65
+ * - space-evenly: 完全均等
66
+ */
67
+ const AlignY = {
68
+ ...AlignYBase,
69
+ ...AlignBetween
70
+ };
71
+ /**
72
+ * 親要素のサイズを基準にした子要素のサイズ調整
73
+ *
74
+ * - `none`
75
+ * - 親のサイズに足りないとき: そのまま
76
+ * - 親のサイズを超えるとき: そのまま
77
+ */
78
+ const AdjustBase = { none: "none" };
79
+ /**
80
+ * 親要素のサイズを基準にした子要素のサイズ調整
81
+ *
82
+ * - `none`
83
+ * - 親のサイズに足りないとき: そのまま
84
+ * - 親のサイズを超えるとき: そのまま
85
+ * - `fit`
86
+ * - 親のサイズに足りないとき: 伸ばす
87
+ * - 親のサイズを超えるとき: 縮める
88
+ * - `grow`
89
+ * - 親のサイズに足りないとき: 伸ばす
90
+ * - 親のサイズを超えるとき: そのまま
91
+ * - `shrink`
92
+ * - 親のサイズに足りないとき: そのまま
93
+ * - 親のサイズを超えるとき: 縮める
94
+ */
95
+ const Adjust = {
96
+ ...AdjustBase,
97
+ fit: "fit",
98
+ grow: "grow",
99
+ shrink: "shrink"
100
+ };
101
+
102
+ //#endregion
103
+ exports.Adjust = Adjust;
104
+ exports.AdjustBase = AdjustBase;
105
+ exports.AlignX = AlignX;
106
+ exports.AlignXBase = AlignXBase;
107
+ exports.AlignY = AlignY;
108
+ exports.AlignYBase = AlignYBase;
109
+ exports.Direction = Direction;