@niche-works/style-layouts 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.ja.md +11 -0
- package/README.md +11 -0
- package/balance/index.cjs +1 -1
- package/center/index.cjs +1 -1
- package/constants.cjs +2 -2
- package/constants.d.cts +2 -2
- package/constants.d.mts +2 -2
- package/constants.mjs +2 -2
- package/core/_constants.cjs +58 -78
- package/core/_constants.d.cts +57 -71
- package/core/_constants.d.mts +57 -71
- package/core/_constants.mjs +58 -72
- package/core/balance/balance.cjs +1 -1
- package/core/balance/balance.mjs +2 -2
- package/core/balance/styles.css +8 -22
- package/core/center/center.cjs +1 -1
- package/core/center/center.mjs +2 -2
- package/core/center/styles.css +59 -24
- package/core/constants.cjs +18 -20
- package/core/constants.d.cts +17 -19
- package/core/constants.d.mts +17 -19
- package/core/constants.mjs +17 -19
- package/core/flow/flow.cjs +7 -7
- package/core/flow/flow.mjs +8 -8
- package/core/flow/styles.css +24 -20
- package/core/layer/layer.cjs +1 -1
- package/core/layer/layer.mjs +2 -2
- package/core/layer/styles.css +2 -6
- package/core/matrix/matrix.cjs +39 -41
- package/core/matrix/matrix.mjs +40 -42
- package/core/matrix/styles.css +106 -4
- package/core/pack/pack.cjs +1 -1
- package/core/pack/pack.mjs +2 -2
- package/core/pack/styles.css +17 -8
- package/core/pin/styles.css +1 -0
- package/core/stack/stack.cjs +19 -19
- package/core/stack/stack.mjs +20 -20
- package/core/stack/styles.css +26 -22
- package/core/styles.css +359 -149
- package/core/tile/styles.css +116 -43
- package/core/tile/tile.cjs +2 -52
- package/core/tile/tile.mjs +4 -54
- package/flow/index.cjs +1 -1
- package/layer/index.cjs +1 -1
- package/matrix/index.cjs +1 -1
- package/pack/index.cjs +1 -1
- package/package.json +1 -1
- package/pin/index.cjs +1 -1
- package/stack/index.cjs +1 -1
- package/tile/index.cjs +1 -1
package/core/matrix/styles.css
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
.nws-layout-matrix {
|
|
2
2
|
--nws-layout-gapX: 0px;
|
|
3
3
|
--nws-layout-gapY: 0px;
|
|
4
|
+
--nws-layout-childSizeX: auto;
|
|
5
|
+
--nws-layout-childSizeY: auto;
|
|
4
6
|
--nws-layout-childRatio: auto;
|
|
7
|
+
--nws-layout-childCountX: auto-fit;
|
|
8
|
+
--nws-layout-childCountY: auto-fit;
|
|
5
9
|
--nws-layout-templateX: none;
|
|
6
10
|
--nws-layout-templateY: none;
|
|
7
11
|
display: grid;
|
|
8
12
|
}
|
|
9
13
|
.nws-layout-matrix.nws-layout-direction-x {
|
|
10
14
|
grid-auto-flow: row;
|
|
11
|
-
grid-template-columns: var(--nws-layout-templateX);
|
|
12
|
-
grid-template-rows: var(--nws-layout-templateY);
|
|
13
15
|
}
|
|
14
16
|
.nws-layout-matrix.nws-layout-direction-y {
|
|
15
17
|
grid-auto-flow: column;
|
|
16
|
-
grid-template-columns: var(--nws-layout-templateX);
|
|
17
|
-
grid-template-rows: var(--nws-layout-templateY);
|
|
18
18
|
}
|
|
19
19
|
.nws-layout-matrix.nws-layout-alignX-left {
|
|
20
20
|
justify-content: flex-start;
|
|
@@ -52,6 +52,108 @@
|
|
|
52
52
|
.nws-layout-matrix.nws-layout-alignY-spaceEvenly {
|
|
53
53
|
align-content: space-evenly;
|
|
54
54
|
}
|
|
55
|
+
.nws-layout-matrix {
|
|
56
|
+
grid-template-columns: repeat(auto-fit, auto);
|
|
57
|
+
}
|
|
58
|
+
.nws-layout-matrix.nws-layout-childSizeX {
|
|
59
|
+
grid-template-columns: repeat(auto-fit, var(--nws-layout-childSizeX));
|
|
60
|
+
}
|
|
61
|
+
.nws-layout-matrix.nws-layout-childSizeX.nws-layout-childCountX {
|
|
62
|
+
grid-template-columns: repeat(var(--nws-layout-childCountX), var(--nws-layout-childSizeX));
|
|
63
|
+
}
|
|
64
|
+
.nws-layout-matrix.nws-layout-childCountX {
|
|
65
|
+
grid-template-columns: repeat(var(--nws-layout-childCountX), auto);
|
|
66
|
+
}
|
|
67
|
+
.nws-layout-matrix.nws-layout-templateX {
|
|
68
|
+
grid-template-columns: var(--nws-layout-templateX);
|
|
69
|
+
}
|
|
70
|
+
.nws-layout-matrix.nws-layout-adjustX-fit {
|
|
71
|
+
grid-template-columns: repeat(auto-fit, 1fr);
|
|
72
|
+
}
|
|
73
|
+
.nws-layout-matrix.nws-layout-adjustX-fit.nws-layout-childSizeX {
|
|
74
|
+
grid-template-columns: repeat(auto-fit, minmax(clamp(0px, 100%, var(--nws-layout-childSizeX)), 1fr));
|
|
75
|
+
}
|
|
76
|
+
.nws-layout-matrix.nws-layout-adjustX-fit.nws-layout-childSizeX.nws-layout-childCountX {
|
|
77
|
+
grid-template-columns: repeat(var(--nws-layout-childCountX), minmax(clamp(0px, (100% - var(--nws-layout-gapX) * (var(--nws-layout-childCountX) - 1)) / var(--nws-layout-childCountX), var(--nws-layout-childSizeX)), 1fr));
|
|
78
|
+
}
|
|
79
|
+
.nws-layout-matrix.nws-layout-adjustX-fit.nws-layout-childCountX {
|
|
80
|
+
grid-template-columns: repeat(var(--nws-layout-childCountX), 1fr);
|
|
81
|
+
}
|
|
82
|
+
.nws-layout-matrix.nws-layout-adjustX-grow {
|
|
83
|
+
grid-template-columns: repeat(auto-fit, 1fr);
|
|
84
|
+
}
|
|
85
|
+
.nws-layout-matrix.nws-layout-adjustX-grow.nws-layout-childSizeX {
|
|
86
|
+
grid-template-columns: repeat(auto-fit, minmax(var(--nws-layout-childSizeX), 1fr));
|
|
87
|
+
}
|
|
88
|
+
.nws-layout-matrix.nws-layout-adjustX-grow.nws-layout-childSizeX.nws-layout-childCountX {
|
|
89
|
+
grid-template-columns: repeat(var(--nws-layout-childCountX), minmax(var(--nws-layout-childSizeX), 1fr));
|
|
90
|
+
}
|
|
91
|
+
.nws-layout-matrix.nws-layout-adjustX-grow.nws-layout-childCountX {
|
|
92
|
+
grid-template-columns: repeat(var(--nws-layout-childCountX), 1fr);
|
|
93
|
+
}
|
|
94
|
+
.nws-layout-matrix.nws-layout-adjustX-shrink {
|
|
95
|
+
grid-template-columns: repeat(auto-fit, auto);
|
|
96
|
+
}
|
|
97
|
+
.nws-layout-matrix.nws-layout-adjustX-shrink.nws-layout-childSizeX {
|
|
98
|
+
grid-template-columns: repeat(auto-fit, minmax(0, var(--nws-layout-childSizeX)));
|
|
99
|
+
}
|
|
100
|
+
.nws-layout-matrix.nws-layout-adjustX-shrink.nws-layout-childSizeX.nws-layout-childCountX {
|
|
101
|
+
grid-template-columns: repeat(var(--nws-layout-childCountX), minmax(0, var(--nws-layout-childSizeX)));
|
|
102
|
+
}
|
|
103
|
+
.nws-layout-matrix.nws-layout-adjustX-shrink.nws-layout-childCountX {
|
|
104
|
+
grid-template-columns: repeat(var(--nws-layout-childCountX), auto);
|
|
105
|
+
}
|
|
106
|
+
.nws-layout-matrix {
|
|
107
|
+
grid-template-rows: repeat(auto-fit, auto);
|
|
108
|
+
}
|
|
109
|
+
.nws-layout-matrix.nws-layout-childSizeY {
|
|
110
|
+
grid-template-rows: repeat(auto-fit, var(--nws-layout-childSizeY));
|
|
111
|
+
}
|
|
112
|
+
.nws-layout-matrix.nws-layout-childSizeY.nws-layout-childCountY {
|
|
113
|
+
grid-template-rows: repeat(var(--nws-layout-childCountY), var(--nws-layout-childSizeY));
|
|
114
|
+
}
|
|
115
|
+
.nws-layout-matrix.nws-layout-childCountY {
|
|
116
|
+
grid-template-rows: repeat(var(--nws-layout-childCountY), auto);
|
|
117
|
+
}
|
|
118
|
+
.nws-layout-matrix.nws-layout-templateY {
|
|
119
|
+
grid-template-rows: var(--nws-layout-templateY);
|
|
120
|
+
}
|
|
121
|
+
.nws-layout-matrix.nws-layout-adjustY-fit {
|
|
122
|
+
grid-template-rows: repeat(auto-fit, 1fr);
|
|
123
|
+
}
|
|
124
|
+
.nws-layout-matrix.nws-layout-adjustY-fit.nws-layout-childSizeY {
|
|
125
|
+
grid-template-rows: repeat(auto-fit, minmax(clamp(0px, 100%, var(--nws-layout-childSizeY)), 1fr));
|
|
126
|
+
}
|
|
127
|
+
.nws-layout-matrix.nws-layout-adjustY-fit.nws-layout-childSizeY.nws-layout-childCountY {
|
|
128
|
+
grid-template-rows: repeat(var(--nws-layout-childCountY), minmax(clamp(0px, (100% - var(--nws-layout-gapY) * (var(--nws-layout-childCountY) - 1)) / var(--nws-layout-childCountY), var(--nws-layout-childSizeY)), 1fr));
|
|
129
|
+
}
|
|
130
|
+
.nws-layout-matrix.nws-layout-adjustY-fit.nws-layout-childCountY {
|
|
131
|
+
grid-template-rows: repeat(var(--nws-layout-childCountY), 1fr);
|
|
132
|
+
}
|
|
133
|
+
.nws-layout-matrix.nws-layout-adjustY-grow {
|
|
134
|
+
grid-template-rows: repeat(auto-fit, 1fr);
|
|
135
|
+
}
|
|
136
|
+
.nws-layout-matrix.nws-layout-adjustY-grow.nws-layout-childSizeY {
|
|
137
|
+
grid-template-rows: repeat(auto-fit, minmax(var(--nws-layout-childSizeY), 1fr));
|
|
138
|
+
}
|
|
139
|
+
.nws-layout-matrix.nws-layout-adjustY-grow.nws-layout-childSizeY.nws-layout-childCountY {
|
|
140
|
+
grid-template-rows: repeat(var(--nws-layout-childCountY), minmax(var(--nws-layout-childSizeY), 1fr));
|
|
141
|
+
}
|
|
142
|
+
.nws-layout-matrix.nws-layout-adjustY-grow.nws-layout-childCountY {
|
|
143
|
+
grid-template-rows: repeat(var(--nws-layout-childCountY), 1fr);
|
|
144
|
+
}
|
|
145
|
+
.nws-layout-matrix.nws-layout-adjustY-shrink {
|
|
146
|
+
grid-template-rows: repeat(auto-fit, auto);
|
|
147
|
+
}
|
|
148
|
+
.nws-layout-matrix.nws-layout-adjustY-shrink.nws-layout-childSizeY {
|
|
149
|
+
grid-template-rows: repeat(auto-fit, minmax(0, var(--nws-layout-childSizeY)));
|
|
150
|
+
}
|
|
151
|
+
.nws-layout-matrix.nws-layout-adjustY-shrink.nws-layout-childSizeY.nws-layout-childCountY {
|
|
152
|
+
grid-template-rows: repeat(var(--nws-layout-childCountY), minmax(0, var(--nws-layout-childSizeY)));
|
|
153
|
+
}
|
|
154
|
+
.nws-layout-matrix.nws-layout-adjustY-shrink.nws-layout-childCountY {
|
|
155
|
+
grid-template-rows: repeat(var(--nws-layout-childCountY), auto);
|
|
156
|
+
}
|
|
55
157
|
.nws-layout-matrix.nws-layout-childRatio > * {
|
|
56
158
|
aspect-ratio: var(--nws-layout-childRatio);
|
|
57
159
|
}
|
package/core/pack/pack.cjs
CHANGED
|
@@ -16,7 +16,7 @@ clsx = require_runtime.__toESM(clsx, 1);
|
|
|
16
16
|
const pack = (options = {}) => {
|
|
17
17
|
const { direction, gap, gapX, gapY } = (0, _niche_works_utils_object_maybeDefault.default)(options, { direction: "x" }, { overwriteNull: true });
|
|
18
18
|
const result = {
|
|
19
|
-
className: (0, clsx.default)(require_core_constants.clsLayoutPack, require_core__constants.
|
|
19
|
+
className: (0, clsx.default)(require_core_constants.clsLayoutPack, require_core__constants.clsLayout.direction[direction]),
|
|
20
20
|
style: {}
|
|
21
21
|
};
|
|
22
22
|
require_core__internal_applyGap(result, gap, gapX, gapY);
|
package/core/pack/pack.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { clsLayoutPack } from "../constants.mjs";
|
|
2
|
-
import {
|
|
2
|
+
import { clsLayout } from "../_constants.mjs";
|
|
3
3
|
import applyGap from "../_internal/applyGap.mjs";
|
|
4
4
|
import maybeDefault from "@niche-works/utils/object/maybeDefault";
|
|
5
5
|
import clsx from "clsx";
|
|
@@ -13,7 +13,7 @@ import clsx from "clsx";
|
|
|
13
13
|
const pack = (options = {}) => {
|
|
14
14
|
const { direction, gap, gapX, gapY } = maybeDefault(options, { direction: "x" }, { overwriteNull: true });
|
|
15
15
|
const result = {
|
|
16
|
-
className: clsx(clsLayoutPack,
|
|
16
|
+
className: clsx(clsLayoutPack, clsLayout.direction[direction]),
|
|
17
17
|
style: {}
|
|
18
18
|
};
|
|
19
19
|
applyGap(result, gap, gapX, gapY);
|
package/core/pack/styles.css
CHANGED
|
@@ -6,13 +6,15 @@
|
|
|
6
6
|
justify-content: flex-start;
|
|
7
7
|
align-items: stretch;
|
|
8
8
|
}
|
|
9
|
+
.nws-layout-pack > * {
|
|
10
|
+
flex-basis: 0;
|
|
11
|
+
flex-grow: 1;
|
|
12
|
+
flex-shrink: 1;
|
|
13
|
+
}
|
|
9
14
|
.nws-layout-pack.nws-layout-direction-x {
|
|
10
15
|
flex-direction: row;
|
|
11
16
|
}
|
|
12
17
|
.nws-layout-pack.nws-layout-direction-x > * {
|
|
13
|
-
flex-basis: 0;
|
|
14
|
-
flex-grow: 1;
|
|
15
|
-
flex-shrink: 1;
|
|
16
18
|
min-width: 0;
|
|
17
19
|
min-height: 100%;
|
|
18
20
|
max-height: 100%;
|
|
@@ -21,16 +23,23 @@
|
|
|
21
23
|
flex-direction: column;
|
|
22
24
|
}
|
|
23
25
|
.nws-layout-pack.nws-layout-direction-y > * {
|
|
24
|
-
flex-basis: 0;
|
|
25
|
-
flex-grow: 1;
|
|
26
|
-
flex-shrink: 1;
|
|
27
26
|
min-height: 0;
|
|
28
27
|
min-width: 100%;
|
|
29
28
|
max-width: 100%;
|
|
30
29
|
}
|
|
31
30
|
.nws-layout-pack.nws-layout-gapX {
|
|
32
|
-
|
|
31
|
+
margin-left: calc(var(--nws-layout-gapX) / -2);
|
|
32
|
+
margin-right: calc(var(--nws-layout-gapX) / -2);
|
|
33
|
+
}
|
|
34
|
+
.nws-layout-pack.nws-layout-gapX > * {
|
|
35
|
+
margin-left: calc(var(--nws-layout-gapX) / 2);
|
|
36
|
+
margin-right: calc(var(--nws-layout-gapX) / 2);
|
|
33
37
|
}
|
|
34
38
|
.nws-layout-pack.nws-layout-gapY {
|
|
35
|
-
|
|
39
|
+
margin-top: calc(var(--nws-layout-gapY) / -2);
|
|
40
|
+
margin-bottom: calc(var(--nws-layout-gapY) / -2);
|
|
41
|
+
}
|
|
42
|
+
.nws-layout-pack.nws-layout-gapY > * {
|
|
43
|
+
margin-top: calc(var(--nws-layout-gapY) / 2);
|
|
44
|
+
margin-bottom: calc(var(--nws-layout-gapY) / 2);
|
|
36
45
|
}
|
package/core/pin/styles.css
CHANGED
package/core/stack/stack.cjs
CHANGED
|
@@ -24,7 +24,7 @@ const stack = (options = {}) => {
|
|
|
24
24
|
alignY: "top"
|
|
25
25
|
}, { overwriteNull: true });
|
|
26
26
|
const result = {
|
|
27
|
-
className: (0, clsx.default)(require_core_constants.clsLayoutStack, require_core__constants.
|
|
27
|
+
className: (0, clsx.default)(require_core_constants.clsLayoutStack, require_core__constants.clsLayout.direction[direction], require_core__constants.clsLayout.align.x[alignX], require_core__constants.clsLayout.align.y[alignY]),
|
|
28
28
|
style: {}
|
|
29
29
|
};
|
|
30
30
|
require_core__internal_applyGap(result, gap, gapX, gapY);
|
|
@@ -48,10 +48,10 @@ const stack = (options = {}) => {
|
|
|
48
48
|
* @returns スタイル
|
|
49
49
|
*/
|
|
50
50
|
function _getStackMainAxisStyle(axis, align, adjust, childSize) {
|
|
51
|
-
const result = { className: (0, clsx.default)(require_core__constants.
|
|
51
|
+
const result = { className: (0, clsx.default)(require_core__constants.clsLayout.align[axis][align], require_core__constants.clsLayout.adjust[axis][adjust]) };
|
|
52
52
|
if (require_core__internal_hasValue(childSize)) {
|
|
53
|
-
result.className = (0, clsx.default)(result.className, require_core__constants.
|
|
54
|
-
result.style = { [require_core__constants.
|
|
53
|
+
result.className = (0, clsx.default)(result.className, require_core__constants.clsLayout.childSize[axis]);
|
|
54
|
+
result.style = { [require_core__constants.varLayout.childSize[axis]]: require_core__internal_unit(childSize) };
|
|
55
55
|
}
|
|
56
56
|
return result;
|
|
57
57
|
}
|
|
@@ -65,34 +65,34 @@ function _getStackMainAxisStyle(axis, align, adjust, childSize) {
|
|
|
65
65
|
*/
|
|
66
66
|
function _getStackClossAxisStyle(axis, align, adjust, childSize) {
|
|
67
67
|
if (adjust === "fit") return {
|
|
68
|
-
className: (0, clsx.default)(require_core__constants.
|
|
69
|
-
style: {
|
|
70
|
-
[`min-${require_core__constants.cssLayoutAxisSizeProp[axis]}`]: "100%",
|
|
71
|
-
[require_core__constants.varLayoutChildSize[axis]]: `min(0, 100%)`
|
|
72
|
-
}
|
|
68
|
+
className: (0, clsx.default)(require_core__constants.clsLayout.align[axis][align], require_core__constants.clsLayout.adjust[axis][adjust]),
|
|
69
|
+
style: { [require_core__constants.varLayout.childSize[axis]]: `min(0, 100%)` }
|
|
73
70
|
};
|
|
74
71
|
else if (adjust === "grow") {
|
|
75
72
|
const result = {
|
|
76
|
-
className: (0, clsx.default)(require_core__constants.
|
|
77
|
-
style: {
|
|
73
|
+
className: (0, clsx.default)(require_core__constants.clsLayout.align[axis][align], require_core__constants.clsLayout.adjust[axis][adjust]),
|
|
74
|
+
style: {}
|
|
78
75
|
};
|
|
79
76
|
if (require_core__internal_hasValue(childSize)) {
|
|
80
|
-
result.className = (0, clsx.default)(result.className, require_core__constants.
|
|
81
|
-
result.style[require_core__constants.
|
|
77
|
+
result.className = (0, clsx.default)(result.className, require_core__constants.clsLayout.childSize[axis]);
|
|
78
|
+
result.style[require_core__constants.varLayout.childSize[axis]] = require_core__internal_unit(childSize);
|
|
82
79
|
}
|
|
83
80
|
return result;
|
|
84
81
|
} else if (adjust === "shrink") {
|
|
85
|
-
const result = {
|
|
82
|
+
const result = {
|
|
83
|
+
className: (0, clsx.default)(require_core__constants.clsLayout.align[axis][align], require_core__constants.clsLayout.adjust[axis][adjust]),
|
|
84
|
+
style: {}
|
|
85
|
+
};
|
|
86
86
|
if (require_core__internal_hasValue(childSize)) {
|
|
87
|
-
result.className = (0, clsx.default)(result.className, require_core__constants.
|
|
88
|
-
result.style = { [require_core__constants.
|
|
87
|
+
result.className = (0, clsx.default)(result.className, require_core__constants.clsLayout.childSize[axis]);
|
|
88
|
+
result.style = { [require_core__constants.varLayout.childSize[axis]]: `min(${require_core__internal_unit(childSize)}, 100%)` };
|
|
89
89
|
}
|
|
90
90
|
return result;
|
|
91
91
|
} else if (require_core__internal_hasValue(childSize)) return {
|
|
92
|
-
className: (0, clsx.default)(require_core__constants.
|
|
93
|
-
style: { [require_core__constants.
|
|
92
|
+
className: (0, clsx.default)(require_core__constants.clsLayout.align[axis][align], require_core__constants.clsLayout.childSize[axis]),
|
|
93
|
+
style: { [require_core__constants.varLayout.childSize[axis]]: require_core__internal_unit(childSize) }
|
|
94
94
|
};
|
|
95
|
-
else return { className: (0, clsx.default)(require_core__constants.
|
|
95
|
+
else return { className: (0, clsx.default)(require_core__constants.clsLayout.align[axis][align]) };
|
|
96
96
|
}
|
|
97
97
|
|
|
98
98
|
//#endregion
|
package/core/stack/stack.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { clsLayoutStack } from "../constants.mjs";
|
|
2
|
-
import {
|
|
2
|
+
import { clsLayout, varLayout } from "../_constants.mjs";
|
|
3
3
|
import hasValue from "../_internal/hasValue.mjs";
|
|
4
4
|
import applyChildRatio from "../_internal/applyChildRatio.mjs";
|
|
5
5
|
import unit from "../_internal/unit.mjs";
|
|
@@ -21,7 +21,7 @@ const stack = (options = {}) => {
|
|
|
21
21
|
alignY: "top"
|
|
22
22
|
}, { overwriteNull: true });
|
|
23
23
|
const result = {
|
|
24
|
-
className: clsx(clsLayoutStack,
|
|
24
|
+
className: clsx(clsLayoutStack, clsLayout.direction[direction], clsLayout.align.x[alignX], clsLayout.align.y[alignY]),
|
|
25
25
|
style: {}
|
|
26
26
|
};
|
|
27
27
|
applyGap(result, gap, gapX, gapY);
|
|
@@ -45,10 +45,10 @@ const stack = (options = {}) => {
|
|
|
45
45
|
* @returns スタイル
|
|
46
46
|
*/
|
|
47
47
|
function _getStackMainAxisStyle(axis, align, adjust, childSize) {
|
|
48
|
-
const result = { className: clsx(
|
|
48
|
+
const result = { className: clsx(clsLayout.align[axis][align], clsLayout.adjust[axis][adjust]) };
|
|
49
49
|
if (hasValue(childSize)) {
|
|
50
|
-
result.className = clsx(result.className,
|
|
51
|
-
result.style = { [
|
|
50
|
+
result.className = clsx(result.className, clsLayout.childSize[axis]);
|
|
51
|
+
result.style = { [varLayout.childSize[axis]]: unit(childSize) };
|
|
52
52
|
}
|
|
53
53
|
return result;
|
|
54
54
|
}
|
|
@@ -62,34 +62,34 @@ function _getStackMainAxisStyle(axis, align, adjust, childSize) {
|
|
|
62
62
|
*/
|
|
63
63
|
function _getStackClossAxisStyle(axis, align, adjust, childSize) {
|
|
64
64
|
if (adjust === "fit") return {
|
|
65
|
-
className: clsx(
|
|
66
|
-
style: {
|
|
67
|
-
[`min-${cssLayoutAxisSizeProp[axis]}`]: "100%",
|
|
68
|
-
[varLayoutChildSize[axis]]: `min(0, 100%)`
|
|
69
|
-
}
|
|
65
|
+
className: clsx(clsLayout.align[axis][align], clsLayout.adjust[axis][adjust]),
|
|
66
|
+
style: { [varLayout.childSize[axis]]: `min(0, 100%)` }
|
|
70
67
|
};
|
|
71
68
|
else if (adjust === "grow") {
|
|
72
69
|
const result = {
|
|
73
|
-
className: clsx(
|
|
74
|
-
style: {
|
|
70
|
+
className: clsx(clsLayout.align[axis][align], clsLayout.adjust[axis][adjust]),
|
|
71
|
+
style: {}
|
|
75
72
|
};
|
|
76
73
|
if (hasValue(childSize)) {
|
|
77
|
-
result.className = clsx(result.className,
|
|
78
|
-
result.style[
|
|
74
|
+
result.className = clsx(result.className, clsLayout.childSize[axis]);
|
|
75
|
+
result.style[varLayout.childSize[axis]] = unit(childSize);
|
|
79
76
|
}
|
|
80
77
|
return result;
|
|
81
78
|
} else if (adjust === "shrink") {
|
|
82
|
-
const result = {
|
|
79
|
+
const result = {
|
|
80
|
+
className: clsx(clsLayout.align[axis][align], clsLayout.adjust[axis][adjust]),
|
|
81
|
+
style: {}
|
|
82
|
+
};
|
|
83
83
|
if (hasValue(childSize)) {
|
|
84
|
-
result.className = clsx(result.className,
|
|
85
|
-
result.style = { [
|
|
84
|
+
result.className = clsx(result.className, clsLayout.childSize[axis]);
|
|
85
|
+
result.style = { [varLayout.childSize[axis]]: `min(${unit(childSize)}, 100%)` };
|
|
86
86
|
}
|
|
87
87
|
return result;
|
|
88
88
|
} else if (hasValue(childSize)) return {
|
|
89
|
-
className: clsx(
|
|
90
|
-
style: { [
|
|
89
|
+
className: clsx(clsLayout.align[axis][align], clsLayout.childSize[axis]),
|
|
90
|
+
style: { [varLayout.childSize[axis]]: unit(childSize) }
|
|
91
91
|
};
|
|
92
|
-
else return { className: clsx(
|
|
92
|
+
else return { className: clsx(clsLayout.align[axis][align]) };
|
|
93
93
|
}
|
|
94
94
|
|
|
95
95
|
//#endregion
|
package/core/stack/styles.css
CHANGED
|
@@ -36,16 +36,14 @@
|
|
|
36
36
|
.nws-layout-stack.nws-layout-direction-x.nws-layout-alignY-bottom {
|
|
37
37
|
align-items: flex-end;
|
|
38
38
|
}
|
|
39
|
-
.nws-layout-stack.nws-layout-direction-x.nws-layout-childSizeX > * {
|
|
40
|
-
flex-basis: var(--nws-layout-childSizeX);
|
|
41
|
-
}
|
|
42
|
-
.nws-layout-stack.nws-layout-direction-x.nws-layout-childSizeY > * {
|
|
43
|
-
height: var(--nws-layout-childSizeY);
|
|
44
|
-
}
|
|
45
39
|
.nws-layout-stack.nws-layout-direction-x > * {
|
|
46
40
|
flex-grow: 0;
|
|
47
41
|
flex-shrink: 0;
|
|
48
42
|
min-width: 0;
|
|
43
|
+
min-height: 0;
|
|
44
|
+
}
|
|
45
|
+
.nws-layout-stack.nws-layout-direction-x.nws-layout-childSizeX > * {
|
|
46
|
+
flex-basis: var(--nws-layout-childSizeX);
|
|
49
47
|
}
|
|
50
48
|
.nws-layout-stack.nws-layout-direction-x.nws-layout-adjustX-fit {
|
|
51
49
|
justify-content: flex-start;
|
|
@@ -54,7 +52,6 @@
|
|
|
54
52
|
flex-grow: 1;
|
|
55
53
|
flex-shrink: 1;
|
|
56
54
|
flex-basis: auto;
|
|
57
|
-
min-width: 0;
|
|
58
55
|
}
|
|
59
56
|
.nws-layout-stack.nws-layout-direction-x.nws-layout-adjustX-fit.nws-layout-childSizeX > * {
|
|
60
57
|
flex-basis: var(--nws-layout-childSizeX);
|
|
@@ -65,8 +62,8 @@
|
|
|
65
62
|
.nws-layout-stack.nws-layout-direction-x.nws-layout-adjustX-shrink > * {
|
|
66
63
|
flex-shrink: 1;
|
|
67
64
|
}
|
|
68
|
-
.nws-layout-stack.nws-layout-direction-x > * {
|
|
69
|
-
|
|
65
|
+
.nws-layout-stack.nws-layout-direction-x.nws-layout-childSizeY > * {
|
|
66
|
+
height: var(--nws-layout-childSizeY);
|
|
70
67
|
}
|
|
71
68
|
.nws-layout-stack.nws-layout-direction-x.nws-layout-adjustY-fit {
|
|
72
69
|
align-items: stretch;
|
|
@@ -115,14 +112,14 @@
|
|
|
115
112
|
.nws-layout-stack.nws-layout-direction-y.nws-layout-alignY-spaceEvenly {
|
|
116
113
|
justify-content: space-evenly;
|
|
117
114
|
}
|
|
118
|
-
.nws-layout-stack.nws-layout-direction-y.nws-layout-childSizeX > * {
|
|
119
|
-
width: var(--nws-layout-childSizeX);
|
|
120
|
-
}
|
|
121
|
-
.nws-layout-stack.nws-layout-direction-y.nws-layout-childSizeY > * {
|
|
122
|
-
flex-basis: var(--nws-layout-childSizeY);
|
|
123
|
-
}
|
|
124
115
|
.nws-layout-stack.nws-layout-direction-y > * {
|
|
116
|
+
flex-grow: 0;
|
|
117
|
+
flex-shrink: 0;
|
|
125
118
|
min-width: 0;
|
|
119
|
+
min-height: 0;
|
|
120
|
+
}
|
|
121
|
+
.nws-layout-stack.nws-layout-direction-y.nws-layout-childSizeX > * {
|
|
122
|
+
width: var(--nws-layout-childSizeX);
|
|
126
123
|
}
|
|
127
124
|
.nws-layout-stack.nws-layout-direction-y.nws-layout-adjustX-fit {
|
|
128
125
|
align-items: stretch;
|
|
@@ -141,10 +138,8 @@
|
|
|
141
138
|
min-width: 0;
|
|
142
139
|
max-width: 100%;
|
|
143
140
|
}
|
|
144
|
-
.nws-layout-stack.nws-layout-direction-y > * {
|
|
145
|
-
flex-
|
|
146
|
-
flex-shrink: 0;
|
|
147
|
-
min-height: 0;
|
|
141
|
+
.nws-layout-stack.nws-layout-direction-y.nws-layout-childSizeY > * {
|
|
142
|
+
flex-basis: var(--nws-layout-childSizeY);
|
|
148
143
|
}
|
|
149
144
|
.nws-layout-stack.nws-layout-direction-y.nws-layout-adjustY-fit {
|
|
150
145
|
justify-content: flex-start;
|
|
@@ -153,7 +148,6 @@
|
|
|
153
148
|
flex-grow: 1;
|
|
154
149
|
flex-shrink: 1;
|
|
155
150
|
flex-basis: auto;
|
|
156
|
-
min-height: 0;
|
|
157
151
|
}
|
|
158
152
|
.nws-layout-stack.nws-layout-direction-y.nws-layout-adjustY-fit.nws-layout-childSizeY > * {
|
|
159
153
|
flex-basis: var(--nws-layout-childSizeY);
|
|
@@ -168,8 +162,18 @@
|
|
|
168
162
|
aspect-ratio: var(--nws-layout-childRatio);
|
|
169
163
|
}
|
|
170
164
|
.nws-layout-stack.nws-layout-gapX {
|
|
171
|
-
|
|
165
|
+
margin-left: calc(var(--nws-layout-gapX) / -2);
|
|
166
|
+
margin-right: calc(var(--nws-layout-gapX) / -2);
|
|
167
|
+
}
|
|
168
|
+
.nws-layout-stack.nws-layout-gapX > * {
|
|
169
|
+
margin-left: calc(var(--nws-layout-gapX) / 2);
|
|
170
|
+
margin-right: calc(var(--nws-layout-gapX) / 2);
|
|
172
171
|
}
|
|
173
172
|
.nws-layout-stack.nws-layout-gapY {
|
|
174
|
-
|
|
173
|
+
margin-top: calc(var(--nws-layout-gapY) / -2);
|
|
174
|
+
margin-bottom: calc(var(--nws-layout-gapY) / -2);
|
|
175
|
+
}
|
|
176
|
+
.nws-layout-stack.nws-layout-gapY > * {
|
|
177
|
+
margin-top: calc(var(--nws-layout-gapY) / 2);
|
|
178
|
+
margin-bottom: calc(var(--nws-layout-gapY) / 2);
|
|
175
179
|
}
|