@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.
- package/LICENSE +21 -0
- package/README.ja.md +331 -0
- package/README.md +331 -3
- package/_constants.cjs +327 -0
- package/_constants.d.cts +237 -0
- package/_constants.d.mts +237 -0
- package/_constants.mjs +275 -0
- package/_internal/applyGap.cjs +30 -0
- package/_internal/applyGap.d.cts +12 -0
- package/_internal/applyGap.d.mts +13 -0
- package/_internal/applyGap.mjs +30 -0
- package/_internal/applyItemCount.cjs +20 -0
- package/_internal/applyItemCount.d.cts +5 -0
- package/_internal/applyItemCount.d.mts +6 -0
- package/_internal/applyItemCount.mjs +20 -0
- package/_internal/applyItemRatio.cjs +21 -0
- package/_internal/applyItemRatio.d.cts +11 -0
- package/_internal/applyItemRatio.d.mts +12 -0
- package/_internal/applyItemRatio.mjs +21 -0
- package/_internal/applyItemSize.cjs +21 -0
- package/_internal/applyItemSize.d.cts +5 -0
- package/_internal/applyItemSize.d.mts +6 -0
- package/_internal/applyItemSize.mjs +21 -0
- package/_internal/hasValue.cjs +15 -0
- package/_internal/hasValue.d.cts +8 -0
- package/_internal/hasValue.d.mts +9 -0
- package/_internal/hasValue.mjs +14 -0
- package/_internal/mergeClassName.cjs +11 -0
- package/_internal/mergeClassName.d.cts +3 -0
- package/_internal/mergeClassName.d.mts +4 -0
- package/_internal/mergeClassName.mjs +10 -0
- package/_internal/mergeLayoutResults.cjs +16 -0
- package/_internal/mergeLayoutResults.d.cts +5 -0
- package/_internal/mergeLayoutResults.d.mts +6 -0
- package/_internal/mergeLayoutResults.mjs +16 -0
- package/_internal/unit.cjs +9 -0
- package/_internal/unit.d.cts +11 -0
- package/_internal/unit.d.mts +12 -0
- package/_internal/unit.mjs +8 -0
- package/_styles.scss.cjs +1 -0
- package/_styles.scss.d.cts +1 -0
- package/_styles.scss.d.mts +1 -0
- package/_styles.scss.mjs +3 -0
- package/_types.cjs +0 -0
- package/_types.d.cts +115 -0
- package/_types.d.mts +115 -0
- package/_types.mjs +1 -0
- package/_virtual/_rolldown/runtime.cjs +29 -0
- package/balance/balance.cjs +37 -0
- package/balance/balance.d.cts +13 -0
- package/balance/balance.d.mts +14 -0
- package/balance/balance.mjs +35 -0
- package/balance/index.cjs +3 -0
- package/balance/index.d.cts +3 -0
- package/balance/index.d.mts +3 -0
- package/balance/index.mjs +3 -0
- package/balance/styles.css +131 -0
- package/balance/types.cjs +0 -0
- package/balance/types.d.cts +21 -0
- package/balance/types.d.mts +21 -0
- package/balance/types.mjs +1 -0
- package/center/center.cjs +34 -0
- package/center/center.d.cts +12 -0
- package/center/center.d.mts +13 -0
- package/center/center.mjs +32 -0
- package/center/index.cjs +3 -0
- package/center/index.d.cts +3 -0
- package/center/index.d.mts +3 -0
- package/center/index.mjs +3 -0
- package/center/styles.css +157 -0
- package/center/types.cjs +0 -0
- package/center/types.d.cts +9 -0
- package/center/types.d.mts +9 -0
- package/center/types.mjs +1 -0
- package/constants.cjs +109 -0
- package/constants.d.cts +112 -0
- package/constants.d.mts +112 -0
- package/constants.mjs +101 -0
- package/flow/flow.cjs +71 -0
- package/flow/flow.d.cts +12 -0
- package/flow/flow.d.mts +13 -0
- package/flow/flow.mjs +69 -0
- package/flow/index.cjs +3 -0
- package/flow/index.d.cts +3 -0
- package/flow/index.d.mts +3 -0
- package/flow/index.mjs +3 -0
- package/flow/styles.css +160 -0
- package/flow/types.cjs +0 -0
- package/flow/types.d.cts +21 -0
- package/flow/types.d.mts +21 -0
- package/flow/types.mjs +1 -0
- package/helpers/_internal/constants.cjs +25 -0
- package/helpers/_internal/constants.d.cts +13 -0
- package/helpers/_internal/constants.d.mts +13 -0
- package/helpers/_internal/constants.mjs +16 -0
- package/helpers/_internal/createExtractLayoutOptions.cjs +25 -0
- package/helpers/_internal/createExtractLayoutOptions.d.cts +8 -0
- package/helpers/_internal/createExtractLayoutOptions.d.mts +9 -0
- package/helpers/_internal/createExtractLayoutOptions.mjs +24 -0
- package/helpers/extractBalanceOptions.cjs +15 -0
- package/helpers/extractBalanceOptions.d.cts +5 -0
- package/helpers/extractBalanceOptions.d.mts +6 -0
- package/helpers/extractBalanceOptions.mjs +15 -0
- package/helpers/extractCenterOptions.cjs +14 -0
- package/helpers/extractCenterOptions.d.cts +6 -0
- package/helpers/extractCenterOptions.d.mts +7 -0
- package/helpers/extractCenterOptions.mjs +14 -0
- package/helpers/extractFlowOptions.cjs +15 -0
- package/helpers/extractFlowOptions.d.cts +6 -0
- package/helpers/extractFlowOptions.d.mts +7 -0
- package/helpers/extractFlowOptions.mjs +15 -0
- package/helpers/extractLayerOptions.cjs +13 -0
- package/helpers/extractLayerOptions.d.cts +6 -0
- package/helpers/extractLayerOptions.d.mts +7 -0
- package/helpers/extractLayerOptions.mjs +13 -0
- package/helpers/extractMatrixOptions.cjs +17 -0
- package/helpers/extractMatrixOptions.d.cts +5 -0
- package/helpers/extractMatrixOptions.d.mts +6 -0
- package/helpers/extractMatrixOptions.mjs +17 -0
- package/helpers/extractPackOptions.cjs +8 -0
- package/helpers/extractPackOptions.d.cts +6 -0
- package/helpers/extractPackOptions.d.mts +7 -0
- package/helpers/extractPackOptions.mjs +8 -0
- package/helpers/extractPinOptions.cjs +8 -0
- package/helpers/extractPinOptions.d.cts +6 -0
- package/helpers/extractPinOptions.d.mts +7 -0
- package/helpers/extractPinOptions.mjs +8 -0
- package/helpers/extractStackOptions.cjs +15 -0
- package/helpers/extractStackOptions.d.cts +6 -0
- package/helpers/extractStackOptions.d.mts +7 -0
- package/helpers/extractStackOptions.mjs +15 -0
- package/helpers/extractTileOptions.cjs +15 -0
- package/helpers/extractTileOptions.d.cts +6 -0
- package/helpers/extractTileOptions.d.mts +7 -0
- package/helpers/extractTileOptions.mjs +15 -0
- package/helpers/index.cjs +20 -0
- package/helpers/index.d.cts +10 -0
- package/helpers/index.d.mts +10 -0
- package/helpers/index.mjs +11 -0
- package/index.cjs +20 -0
- package/index.d.cts +20 -0
- package/index.d.mts +20 -0
- package/index.mjs +11 -0
- package/layer/index.cjs +3 -0
- package/layer/index.d.cts +3 -0
- package/layer/index.d.mts +3 -0
- package/layer/index.mjs +3 -0
- package/layer/layer.cjs +34 -0
- package/layer/layer.d.cts +13 -0
- package/layer/layer.d.mts +14 -0
- package/layer/layer.mjs +32 -0
- package/layer/styles.css +56 -0
- package/layer/types.cjs +0 -0
- package/layer/types.d.cts +13 -0
- package/layer/types.d.mts +13 -0
- package/layer/types.mjs +1 -0
- package/matrix/index.cjs +3 -0
- package/matrix/index.d.cts +3 -0
- package/matrix/index.d.mts +3 -0
- package/matrix/index.mjs +3 -0
- package/matrix/matrix.cjs +110 -0
- package/matrix/matrix.d.cts +12 -0
- package/matrix/matrix.d.mts +13 -0
- package/matrix/matrix.mjs +108 -0
- package/matrix/styles.css +141 -0
- package/matrix/types.cjs +0 -0
- package/matrix/types.d.cts +46 -0
- package/matrix/types.d.mts +46 -0
- package/matrix/types.mjs +1 -0
- package/pack/index.cjs +3 -0
- package/pack/index.d.cts +3 -0
- package/pack/index.d.mts +3 -0
- package/pack/index.mjs +3 -0
- package/pack/pack.cjs +25 -0
- package/pack/pack.d.cts +11 -0
- package/pack/pack.d.mts +12 -0
- package/pack/pack.mjs +23 -0
- package/pack/styles.css +35 -0
- package/pack/types.cjs +0 -0
- package/pack/types.d.cts +6 -0
- package/pack/types.d.mts +6 -0
- package/pack/types.mjs +1 -0
- package/package.json +52 -4
- package/pin/index.cjs +3 -0
- package/pin/index.d.cts +3 -0
- package/pin/index.d.mts +3 -0
- package/pin/index.mjs +3 -0
- package/pin/pin.cjs +23 -0
- package/pin/pin.d.cts +11 -0
- package/pin/pin.d.mts +12 -0
- package/pin/pin.mjs +23 -0
- package/pin/styles.css +19 -0
- package/pin/types.cjs +0 -0
- package/pin/types.d.cts +6 -0
- package/pin/types.d.mts +6 -0
- package/pin/types.mjs +1 -0
- package/stack/index.cjs +3 -0
- package/stack/index.d.cts +3 -0
- package/stack/index.d.mts +3 -0
- package/stack/index.mjs +3 -0
- package/stack/stack.cjs +96 -0
- package/stack/stack.d.cts +11 -0
- package/stack/stack.d.mts +12 -0
- package/stack/stack.mjs +94 -0
- package/stack/styles.css +167 -0
- package/stack/types.cjs +0 -0
- package/stack/types.d.cts +21 -0
- package/stack/types.d.mts +21 -0
- package/stack/types.mjs +1 -0
- package/styles.css +1055 -0
- package/tile/index.cjs +3 -0
- package/tile/index.d.cts +3 -0
- package/tile/index.d.mts +3 -0
- package/tile/index.mjs +3 -0
- package/tile/styles.css +181 -0
- package/tile/tile.cjs +36 -0
- package/tile/tile.d.cts +12 -0
- package/tile/tile.d.mts +13 -0
- package/tile/tile.mjs +34 -0
- package/tile/types.cjs +0 -0
- package/tile/types.d.cts +9 -0
- package/tile/types.d.mts +9 -0
- package/tile/types.mjs +1 -0
- package/types.cjs +0 -0
- package/types.d.cts +14 -0
- package/types.d.mts +14 -0
- package/types.mjs +1 -0
- package/with-css/balance/index.cjs +8 -0
- package/with-css/balance/index.d.cts +3 -0
- package/with-css/balance/index.d.mts +3 -0
- package/with-css/balance/index.mjs +8 -0
- package/with-css/center/index.cjs +8 -0
- package/with-css/center/index.d.cts +3 -0
- package/with-css/center/index.d.mts +3 -0
- package/with-css/center/index.mjs +8 -0
- package/with-css/flow/index.cjs +8 -0
- package/with-css/flow/index.d.cts +3 -0
- package/with-css/flow/index.d.mts +3 -0
- package/with-css/flow/index.mjs +8 -0
- package/with-css/index.cjs +20 -0
- package/with-css/index.d.cts +20 -0
- package/with-css/index.d.mts +20 -0
- package/with-css/index.mjs +11 -0
- package/with-css/layer/index.cjs +8 -0
- package/with-css/layer/index.d.cts +3 -0
- package/with-css/layer/index.d.mts +3 -0
- package/with-css/layer/index.mjs +8 -0
- package/with-css/matrix/index.cjs +8 -0
- package/with-css/matrix/index.d.cts +3 -0
- package/with-css/matrix/index.d.mts +3 -0
- package/with-css/matrix/index.mjs +8 -0
- package/with-css/pack/index.cjs +8 -0
- package/with-css/pack/index.d.cts +3 -0
- package/with-css/pack/index.d.mts +3 -0
- package/with-css/pack/index.mjs +8 -0
- package/with-css/pin/index.cjs +8 -0
- package/with-css/pin/index.d.cts +3 -0
- package/with-css/pin/index.d.mts +3 -0
- package/with-css/pin/index.mjs +8 -0
- package/with-css/stack/index.cjs +8 -0
- package/with-css/stack/index.d.cts +3 -0
- package/with-css/stack/index.d.mts +3 -0
- package/with-css/stack/index.mjs +8 -0
- package/with-css/tile/index.cjs +8 -0
- package/with-css/tile/index.d.cts +3 -0
- package/with-css/tile/index.d.mts +3 -0
- package/with-css/tile/index.mjs +8 -0
|
@@ -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 };
|
package/center/index.cjs
ADDED
package/center/index.mjs
ADDED
|
@@ -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
|
+
}
|
package/center/types.cjs
ADDED
|
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 };
|
package/center/types.mjs
ADDED
|
@@ -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;
|