@niche-works/style-layouts 0.3.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.ja.md +8 -8
- package/README.md +8 -8
- package/balance/index.cjs +6 -2
- package/balance/index.mjs +6 -2
- package/center/index.cjs +6 -2
- package/center/index.mjs +6 -2
- package/constants.cjs +1 -50
- package/constants.d.cts +2 -2
- package/constants.d.mts +2 -2
- package/constants.mjs +2 -2
- package/core/_constants.cjs +287 -34
- package/core/_constants.d.cts +206 -1
- package/core/_constants.d.mts +206 -1
- package/core/_constants.mjs +206 -3
- package/core/_internal/applyChildCount.cjs +6 -8
- package/core/_internal/applyChildCount.mjs +6 -6
- package/core/_internal/applyChildRatio.cjs +4 -6
- package/core/_internal/applyChildRatio.mjs +3 -3
- package/core/_internal/applyChildSize.cjs +6 -8
- package/core/_internal/applyChildSize.mjs +4 -4
- package/core/_internal/applyGap.cjs +6 -8
- package/core/_internal/applyGap.mjs +4 -4
- package/core/_internal/mergeClassName.cjs +11 -0
- package/core/_internal/mergeClassName.d.cts +3 -0
- package/core/_internal/mergeClassName.d.mts +4 -0
- package/core/_internal/mergeClassName.mjs +10 -0
- package/core/_internal/mergeLayoutResults.cjs +2 -4
- package/core/_internal/mergeLayoutResults.mjs +2 -2
- package/core/_types.d.cts +1 -9
- package/core/_types.d.mts +1 -9
- package/core/balance/balance.cjs +4 -4
- package/core/balance/balance.d.cts +2 -0
- package/core/balance/balance.d.mts +2 -0
- package/core/balance/balance.mjs +5 -4
- package/core/balance/styles.css +38 -6
- package/core/center/center.cjs +3 -4
- package/core/center/center.d.cts +1 -0
- package/core/center/center.d.mts +1 -0
- package/core/center/center.mjs +4 -4
- package/core/center/styles.css +4 -26
- package/core/constants.cjs +4 -255
- package/core/constants.d.cts +4 -206
- package/core/constants.d.mts +4 -206
- package/core/constants.mjs +4 -206
- package/core/flow/flow.cjs +5 -7
- package/core/flow/flow.mjs +6 -7
- package/core/index.d.cts +2 -2
- package/core/index.d.mts +2 -2
- package/core/layer/layer.cjs +2 -4
- package/core/layer/layer.mjs +3 -4
- package/core/layer/styles.css +0 -4
- package/core/matrix/matrix.cjs +3 -4
- package/core/matrix/matrix.d.cts +1 -0
- package/core/matrix/matrix.d.mts +1 -0
- package/core/matrix/matrix.mjs +4 -4
- package/core/matrix/styles.css +0 -6
- package/core/pack/pack.cjs +2 -4
- package/core/pack/pack.mjs +3 -4
- package/core/pin/pin.cjs +2 -2
- package/core/pin/pin.mjs +1 -1
- package/core/stack/stack.cjs +12 -14
- package/core/stack/stack.d.cts +1 -1
- package/core/stack/stack.d.mts +1 -1
- package/core/stack/stack.mjs +13 -14
- package/core/stack/styles.css +0 -2
- package/core/styles.css +42 -44
- package/core/tile/tile.cjs +2 -4
- package/core/tile/tile.mjs +3 -4
- package/core/types.d.cts +7 -2
- package/core/types.d.mts +7 -2
- package/flow/index.cjs +6 -2
- package/flow/index.mjs +6 -2
- 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 +18 -18
- package/index.d.cts +2 -2
- package/index.d.mts +2 -2
- package/index.mjs +10 -10
- package/layer/index.cjs +6 -2
- package/layer/index.mjs +6 -2
- package/matrix/index.cjs +6 -2
- package/matrix/index.mjs +6 -2
- package/pack/index.cjs +6 -2
- package/pack/index.mjs +6 -2
- package/package.json +6 -4
- package/pin/index.cjs +6 -2
- package/pin/index.mjs +6 -2
- package/stack/index.cjs +6 -2
- package/stack/index.mjs +6 -2
- package/tile/index.cjs +6 -2
- package/tile/index.mjs +6 -2
- package/types.d.cts +2 -2
- package/types.d.mts +2 -2
- package/core/_internal/warnIfUnsupported.cjs +0 -15
- package/core/_internal/warnIfUnsupported.d.cts +0 -3
- package/core/_internal/warnIfUnsupported.d.mts +0 -4
- package/core/_internal/warnIfUnsupported.mjs +0 -14
package/core/stack/stack.cjs
CHANGED
|
@@ -1,21 +1,19 @@
|
|
|
1
1
|
const require_runtime = require('../../_virtual/_rolldown/runtime.cjs');
|
|
2
|
-
const require_core_constants = require('../constants.cjs');
|
|
3
2
|
const require_core__constants = require('../_constants.cjs');
|
|
4
3
|
const require_core__internal_hasValue = require('../_internal/hasValue.cjs');
|
|
4
|
+
const require_core__internal_mergeClassName = require('../_internal/mergeClassName.cjs');
|
|
5
5
|
const require_core__internal_applyChildRatio = require('../_internal/applyChildRatio.cjs');
|
|
6
6
|
const require_core__internal_unit = require('../_internal/unit.cjs');
|
|
7
7
|
const require_core__internal_applyGap = require('../_internal/applyGap.cjs');
|
|
8
8
|
const require_core__internal_mergeLayoutResults = require('../_internal/mergeLayoutResults.cjs');
|
|
9
9
|
let _niche_works_utils_object_maybeDefault = require("@niche-works/utils/object/maybeDefault");
|
|
10
10
|
_niche_works_utils_object_maybeDefault = require_runtime.__toESM(_niche_works_utils_object_maybeDefault, 1);
|
|
11
|
-
let clsx = require("clsx");
|
|
12
|
-
clsx = require_runtime.__toESM(clsx, 1);
|
|
13
11
|
|
|
14
12
|
//#region src/core/stack/stack.ts
|
|
15
13
|
/**
|
|
16
14
|
* stackレイアウト
|
|
17
15
|
*
|
|
18
|
-
* -
|
|
16
|
+
* - 子要素を一列に並べて配置する
|
|
19
17
|
*/
|
|
20
18
|
const stack = (options = {}) => {
|
|
21
19
|
const { direction, alignX, alignY, adjustX, adjustY, gap, gapX = gap, gapY = gap, childSizeX, childSizeY, childRatioX, childRatioY } = (0, _niche_works_utils_object_maybeDefault.default)(options, {
|
|
@@ -24,7 +22,7 @@ const stack = (options = {}) => {
|
|
|
24
22
|
alignY: "top"
|
|
25
23
|
}, { overwriteNull: true });
|
|
26
24
|
const result = {
|
|
27
|
-
className: (
|
|
25
|
+
className: require_core__internal_mergeClassName(require_core__constants.clsLayoutStack, require_core__constants.clsLayout.direction[direction], require_core__constants.clsLayout.align.x[alignX], require_core__constants.clsLayout.align.y[alignY]),
|
|
28
26
|
style: {}
|
|
29
27
|
};
|
|
30
28
|
require_core__internal_applyGap(result, gap, gapX, gapY);
|
|
@@ -48,9 +46,9 @@ const stack = (options = {}) => {
|
|
|
48
46
|
* @returns スタイル
|
|
49
47
|
*/
|
|
50
48
|
function _getStackMainAxisStyle(axis, align, adjust, childSize) {
|
|
51
|
-
const result = { className: (
|
|
49
|
+
const result = { className: require_core__internal_mergeClassName(require_core__constants.clsLayout.align[axis][align], require_core__constants.clsLayout.adjust[axis][adjust]) };
|
|
52
50
|
if (require_core__internal_hasValue(childSize)) {
|
|
53
|
-
result.className = (
|
|
51
|
+
result.className = require_core__internal_mergeClassName(result.className, require_core__constants.clsLayout.childSize[axis]);
|
|
54
52
|
result.style = { [require_core__constants.varLayout.childSize[axis]]: require_core__internal_unit(childSize) };
|
|
55
53
|
}
|
|
56
54
|
return result;
|
|
@@ -65,34 +63,34 @@ function _getStackMainAxisStyle(axis, align, adjust, childSize) {
|
|
|
65
63
|
*/
|
|
66
64
|
function _getStackClossAxisStyle(axis, align, adjust, childSize) {
|
|
67
65
|
if (adjust === "fit") return {
|
|
68
|
-
className: (
|
|
66
|
+
className: require_core__internal_mergeClassName(require_core__constants.clsLayout.align[axis][align], require_core__constants.clsLayout.adjust[axis][adjust]),
|
|
69
67
|
style: { [require_core__constants.varLayout.childSize[axis]]: `min(0, 100%)` }
|
|
70
68
|
};
|
|
71
69
|
else if (adjust === "grow") {
|
|
72
70
|
const result = {
|
|
73
|
-
className: (
|
|
71
|
+
className: require_core__internal_mergeClassName(require_core__constants.clsLayout.align[axis][align], require_core__constants.clsLayout.adjust[axis][adjust]),
|
|
74
72
|
style: {}
|
|
75
73
|
};
|
|
76
74
|
if (require_core__internal_hasValue(childSize)) {
|
|
77
|
-
result.className = (
|
|
75
|
+
result.className = require_core__internal_mergeClassName(result.className, require_core__constants.clsLayout.childSize[axis]);
|
|
78
76
|
result.style[require_core__constants.varLayout.childSize[axis]] = require_core__internal_unit(childSize);
|
|
79
77
|
}
|
|
80
78
|
return result;
|
|
81
79
|
} else if (adjust === "shrink") {
|
|
82
80
|
const result = {
|
|
83
|
-
className: (
|
|
81
|
+
className: require_core__internal_mergeClassName(require_core__constants.clsLayout.align[axis][align], require_core__constants.clsLayout.adjust[axis][adjust]),
|
|
84
82
|
style: {}
|
|
85
83
|
};
|
|
86
84
|
if (require_core__internal_hasValue(childSize)) {
|
|
87
|
-
result.className = (
|
|
85
|
+
result.className = require_core__internal_mergeClassName(result.className, require_core__constants.clsLayout.childSize[axis]);
|
|
88
86
|
result.style = { [require_core__constants.varLayout.childSize[axis]]: `min(${require_core__internal_unit(childSize)}, 100%)` };
|
|
89
87
|
}
|
|
90
88
|
return result;
|
|
91
89
|
} else if (require_core__internal_hasValue(childSize)) return {
|
|
92
|
-
className: (
|
|
90
|
+
className: require_core__internal_mergeClassName(require_core__constants.clsLayout.align[axis][align], require_core__constants.clsLayout.childSize[axis]),
|
|
93
91
|
style: { [require_core__constants.varLayout.childSize[axis]]: require_core__internal_unit(childSize) }
|
|
94
92
|
};
|
|
95
|
-
else return { className: (
|
|
93
|
+
else return { className: require_core__internal_mergeClassName(require_core__constants.clsLayout.align[axis][align]) };
|
|
96
94
|
}
|
|
97
95
|
|
|
98
96
|
//#endregion
|
package/core/stack/stack.d.cts
CHANGED
package/core/stack/stack.d.mts
CHANGED
package/core/stack/stack.mjs
CHANGED
|
@@ -1,18 +1,17 @@
|
|
|
1
|
-
import { clsLayoutStack } from "../
|
|
2
|
-
import { clsLayout, varLayout } from "../_constants.mjs";
|
|
1
|
+
import { clsLayout, clsLayoutStack, varLayout } from "../_constants.mjs";
|
|
3
2
|
import hasValue from "../_internal/hasValue.mjs";
|
|
3
|
+
import mergeClassName from "../_internal/mergeClassName.mjs";
|
|
4
4
|
import applyChildRatio from "../_internal/applyChildRatio.mjs";
|
|
5
5
|
import unit from "../_internal/unit.mjs";
|
|
6
6
|
import applyGap from "../_internal/applyGap.mjs";
|
|
7
7
|
import mergeLayoutResults from "../_internal/mergeLayoutResults.mjs";
|
|
8
8
|
import maybeDefault from "@niche-works/utils/object/maybeDefault";
|
|
9
|
-
import clsx from "clsx";
|
|
10
9
|
|
|
11
10
|
//#region src/core/stack/stack.ts
|
|
12
11
|
/**
|
|
13
12
|
* stackレイアウト
|
|
14
13
|
*
|
|
15
|
-
* -
|
|
14
|
+
* - 子要素を一列に並べて配置する
|
|
16
15
|
*/
|
|
17
16
|
const stack = (options = {}) => {
|
|
18
17
|
const { direction, alignX, alignY, adjustX, adjustY, gap, gapX = gap, gapY = gap, childSizeX, childSizeY, childRatioX, childRatioY } = maybeDefault(options, {
|
|
@@ -21,7 +20,7 @@ const stack = (options = {}) => {
|
|
|
21
20
|
alignY: "top"
|
|
22
21
|
}, { overwriteNull: true });
|
|
23
22
|
const result = {
|
|
24
|
-
className:
|
|
23
|
+
className: mergeClassName(clsLayoutStack, clsLayout.direction[direction], clsLayout.align.x[alignX], clsLayout.align.y[alignY]),
|
|
25
24
|
style: {}
|
|
26
25
|
};
|
|
27
26
|
applyGap(result, gap, gapX, gapY);
|
|
@@ -45,9 +44,9 @@ const stack = (options = {}) => {
|
|
|
45
44
|
* @returns スタイル
|
|
46
45
|
*/
|
|
47
46
|
function _getStackMainAxisStyle(axis, align, adjust, childSize) {
|
|
48
|
-
const result = { className:
|
|
47
|
+
const result = { className: mergeClassName(clsLayout.align[axis][align], clsLayout.adjust[axis][adjust]) };
|
|
49
48
|
if (hasValue(childSize)) {
|
|
50
|
-
result.className =
|
|
49
|
+
result.className = mergeClassName(result.className, clsLayout.childSize[axis]);
|
|
51
50
|
result.style = { [varLayout.childSize[axis]]: unit(childSize) };
|
|
52
51
|
}
|
|
53
52
|
return result;
|
|
@@ -62,34 +61,34 @@ function _getStackMainAxisStyle(axis, align, adjust, childSize) {
|
|
|
62
61
|
*/
|
|
63
62
|
function _getStackClossAxisStyle(axis, align, adjust, childSize) {
|
|
64
63
|
if (adjust === "fit") return {
|
|
65
|
-
className:
|
|
64
|
+
className: mergeClassName(clsLayout.align[axis][align], clsLayout.adjust[axis][adjust]),
|
|
66
65
|
style: { [varLayout.childSize[axis]]: `min(0, 100%)` }
|
|
67
66
|
};
|
|
68
67
|
else if (adjust === "grow") {
|
|
69
68
|
const result = {
|
|
70
|
-
className:
|
|
69
|
+
className: mergeClassName(clsLayout.align[axis][align], clsLayout.adjust[axis][adjust]),
|
|
71
70
|
style: {}
|
|
72
71
|
};
|
|
73
72
|
if (hasValue(childSize)) {
|
|
74
|
-
result.className =
|
|
73
|
+
result.className = mergeClassName(result.className, clsLayout.childSize[axis]);
|
|
75
74
|
result.style[varLayout.childSize[axis]] = unit(childSize);
|
|
76
75
|
}
|
|
77
76
|
return result;
|
|
78
77
|
} else if (adjust === "shrink") {
|
|
79
78
|
const result = {
|
|
80
|
-
className:
|
|
79
|
+
className: mergeClassName(clsLayout.align[axis][align], clsLayout.adjust[axis][adjust]),
|
|
81
80
|
style: {}
|
|
82
81
|
};
|
|
83
82
|
if (hasValue(childSize)) {
|
|
84
|
-
result.className =
|
|
83
|
+
result.className = mergeClassName(result.className, clsLayout.childSize[axis]);
|
|
85
84
|
result.style = { [varLayout.childSize[axis]]: `min(${unit(childSize)}, 100%)` };
|
|
86
85
|
}
|
|
87
86
|
return result;
|
|
88
87
|
} else if (hasValue(childSize)) return {
|
|
89
|
-
className:
|
|
88
|
+
className: mergeClassName(clsLayout.align[axis][align], clsLayout.childSize[axis]),
|
|
90
89
|
style: { [varLayout.childSize[axis]]: unit(childSize) }
|
|
91
90
|
};
|
|
92
|
-
else return { className:
|
|
91
|
+
else return { className: mergeClassName(clsLayout.align[axis][align]) };
|
|
93
92
|
}
|
|
94
93
|
|
|
95
94
|
//#endregion
|
package/core/stack/styles.css
CHANGED
|
@@ -79,7 +79,6 @@
|
|
|
79
79
|
min-height: 100%;
|
|
80
80
|
}
|
|
81
81
|
.nws-layout-stack.nws-layout-direction-x.nws-layout-adjustY-shrink > * {
|
|
82
|
-
min-height: 0;
|
|
83
82
|
max-height: 100%;
|
|
84
83
|
}
|
|
85
84
|
.nws-layout-stack.nws-layout-direction-y {
|
|
@@ -135,7 +134,6 @@
|
|
|
135
134
|
min-width: 100%;
|
|
136
135
|
}
|
|
137
136
|
.nws-layout-stack.nws-layout-direction-y.nws-layout-adjustX-shrink > * {
|
|
138
|
-
min-width: 0;
|
|
139
137
|
max-width: 100%;
|
|
140
138
|
}
|
|
141
139
|
.nws-layout-stack.nws-layout-direction-y.nws-layout-childSizeY > * {
|
package/core/styles.css
CHANGED
|
@@ -79,7 +79,6 @@
|
|
|
79
79
|
min-height: 100%;
|
|
80
80
|
}
|
|
81
81
|
.nws-layout-stack.nws-layout-direction-x.nws-layout-adjustY-shrink > * {
|
|
82
|
-
min-height: 0;
|
|
83
82
|
max-height: 100%;
|
|
84
83
|
}
|
|
85
84
|
.nws-layout-stack.nws-layout-direction-y {
|
|
@@ -135,7 +134,6 @@
|
|
|
135
134
|
min-width: 100%;
|
|
136
135
|
}
|
|
137
136
|
.nws-layout-stack.nws-layout-direction-y.nws-layout-adjustX-shrink > * {
|
|
138
|
-
min-width: 0;
|
|
139
137
|
max-width: 100%;
|
|
140
138
|
}
|
|
141
139
|
.nws-layout-stack.nws-layout-direction-y.nws-layout-childSizeY > * {
|
|
@@ -624,9 +622,6 @@
|
|
|
624
622
|
.nws-layout-matrix.nws-layout-adjustX-grow.nws-layout-childCountX {
|
|
625
623
|
grid-template-columns: repeat(var(--nws-layout-childCountX), 1fr);
|
|
626
624
|
}
|
|
627
|
-
.nws-layout-matrix.nws-layout-adjustX-shrink {
|
|
628
|
-
grid-template-columns: repeat(auto-fit, auto);
|
|
629
|
-
}
|
|
630
625
|
.nws-layout-matrix.nws-layout-adjustX-shrink.nws-layout-childSizeX {
|
|
631
626
|
grid-template-columns: repeat(auto-fit, minmax(0, var(--nws-layout-childSizeX)));
|
|
632
627
|
}
|
|
@@ -675,9 +670,6 @@
|
|
|
675
670
|
.nws-layout-matrix.nws-layout-adjustY-grow.nws-layout-childCountY {
|
|
676
671
|
grid-template-rows: repeat(var(--nws-layout-childCountY), 1fr);
|
|
677
672
|
}
|
|
678
|
-
.nws-layout-matrix.nws-layout-adjustY-shrink {
|
|
679
|
-
grid-template-rows: repeat(auto-fit, auto);
|
|
680
|
-
}
|
|
681
673
|
.nws-layout-matrix.nws-layout-adjustY-shrink.nws-layout-childSizeY {
|
|
682
674
|
grid-template-rows: repeat(auto-fit, minmax(0, var(--nws-layout-childSizeY)));
|
|
683
675
|
}
|
|
@@ -720,6 +712,7 @@
|
|
|
720
712
|
}
|
|
721
713
|
.nws-layout-center.nws-layout-direction-x > * {
|
|
722
714
|
max-width: none;
|
|
715
|
+
max-height: none;
|
|
723
716
|
flex-grow: 0;
|
|
724
717
|
flex-shrink: 0;
|
|
725
718
|
margin-top: auto;
|
|
@@ -735,9 +728,6 @@
|
|
|
735
728
|
width: var(--nws-layout-childSizeX);
|
|
736
729
|
flex-basis: var(--nws-layout-childSizeX);
|
|
737
730
|
}
|
|
738
|
-
.nws-layout-center.nws-layout-direction-x.nws-layout-adjustX-fit {
|
|
739
|
-
justify-content: stretch;
|
|
740
|
-
}
|
|
741
731
|
.nws-layout-center.nws-layout-direction-x.nws-layout-adjustX-fit > * {
|
|
742
732
|
width: 100%;
|
|
743
733
|
max-width: none;
|
|
@@ -745,29 +735,19 @@
|
|
|
745
735
|
flex-shrink: 1;
|
|
746
736
|
flex-basis: 0%;
|
|
747
737
|
}
|
|
748
|
-
.nws-layout-center.nws-layout-direction-x.nws-layout-adjustX-grow {
|
|
749
|
-
justify-content: stretch;
|
|
750
|
-
}
|
|
751
738
|
.nws-layout-center.nws-layout-direction-x.nws-layout-adjustX-grow > * {
|
|
752
739
|
width: 100%;
|
|
753
740
|
min-width: var(--nws-layout-childSizeX);
|
|
754
741
|
max-width: none;
|
|
755
742
|
flex-grow: 1;
|
|
756
|
-
flex-shrink: 0;
|
|
757
743
|
flex-basis: var(--nws-layout-childSizeX);
|
|
758
744
|
}
|
|
759
745
|
.nws-layout-center.nws-layout-direction-x.nws-layout-adjustX-shrink > * {
|
|
760
746
|
width: var(--nws-layout-childSizeX);
|
|
761
747
|
max-width: 100%;
|
|
762
|
-
flex-grow: 0;
|
|
763
748
|
flex-shrink: 1;
|
|
764
749
|
flex-basis: var(--nws-layout-childSizeX);
|
|
765
750
|
}
|
|
766
|
-
.nws-layout-center.nws-layout-direction-x > * {
|
|
767
|
-
max-height: none;
|
|
768
|
-
margin-top: auto;
|
|
769
|
-
margin-bottom: auto;
|
|
770
|
-
}
|
|
771
751
|
.nws-layout-center.nws-layout-direction-x.nws-layout-childSizeY > * {
|
|
772
752
|
height: var(--nws-layout-childSizeY);
|
|
773
753
|
}
|
|
@@ -811,6 +791,9 @@
|
|
|
811
791
|
}
|
|
812
792
|
.nws-layout-center.nws-layout-direction-y > * {
|
|
813
793
|
max-width: none;
|
|
794
|
+
max-height: none;
|
|
795
|
+
flex-grow: 0;
|
|
796
|
+
flex-shrink: 0;
|
|
814
797
|
margin-left: auto;
|
|
815
798
|
margin-right: auto;
|
|
816
799
|
}
|
|
@@ -844,18 +827,10 @@
|
|
|
844
827
|
margin-left: auto;
|
|
845
828
|
margin-right: auto;
|
|
846
829
|
}
|
|
847
|
-
.nws-layout-center.nws-layout-direction-y > * {
|
|
848
|
-
max-height: none;
|
|
849
|
-
flex-grow: 0;
|
|
850
|
-
flex-shrink: 0;
|
|
851
|
-
}
|
|
852
830
|
.nws-layout-center.nws-layout-direction-y.nws-layout-childSizeY > * {
|
|
853
831
|
height: var(--nws-layout-childSizeY);
|
|
854
832
|
flex-basis: var(--nws-layout-childSizeY);
|
|
855
833
|
}
|
|
856
|
-
.nws-layout-center.nws-layout-direction-y.nws-layout-adjustY-fit {
|
|
857
|
-
justify-content: stretch;
|
|
858
|
-
}
|
|
859
834
|
.nws-layout-center.nws-layout-direction-y.nws-layout-adjustY-fit > * {
|
|
860
835
|
height: 100%;
|
|
861
836
|
max-height: none;
|
|
@@ -863,21 +838,16 @@
|
|
|
863
838
|
flex-shrink: 1;
|
|
864
839
|
flex-basis: 0%;
|
|
865
840
|
}
|
|
866
|
-
.nws-layout-center.nws-layout-direction-y.nws-layout-adjustY-grow {
|
|
867
|
-
justify-content: stretch;
|
|
868
|
-
}
|
|
869
841
|
.nws-layout-center.nws-layout-direction-y.nws-layout-adjustY-grow > * {
|
|
870
842
|
height: 100%;
|
|
871
843
|
min-height: var(--nws-layout-childSizeY);
|
|
872
844
|
max-height: none;
|
|
873
845
|
flex-grow: 1;
|
|
874
|
-
flex-shrink: 0;
|
|
875
846
|
flex-basis: var(--nws-layout-childSizeY);
|
|
876
847
|
}
|
|
877
848
|
.nws-layout-center.nws-layout-direction-y.nws-layout-adjustY-shrink > * {
|
|
878
849
|
height: var(--nws-layout-childSizeY);
|
|
879
850
|
max-height: 100%;
|
|
880
|
-
flex-grow: 0;
|
|
881
851
|
flex-shrink: 1;
|
|
882
852
|
flex-basis: var(--nws-layout-childSizeY);
|
|
883
853
|
}
|
|
@@ -955,9 +925,29 @@
|
|
|
955
925
|
}
|
|
956
926
|
.nws-layout-balance.nws-layout-direction-x {
|
|
957
927
|
grid-auto-flow: column;
|
|
928
|
+
grid-auto-columns: max-content;
|
|
929
|
+
}
|
|
930
|
+
.nws-layout-balance.nws-layout-direction-x.nws-layout-adjustX-grow, .nws-layout-balance.nws-layout-direction-x.nws-layout-adjustX-fit {
|
|
931
|
+
grid-auto-columns: auto;
|
|
932
|
+
}
|
|
933
|
+
.nws-layout-balance.nws-layout-direction-x.nws-layout-adjustX-shrink {
|
|
934
|
+
grid-auto-columns: minmax(0, max-content);
|
|
935
|
+
}
|
|
936
|
+
.nws-layout-balance.nws-layout-direction-x.nws-layout-childSizeX {
|
|
937
|
+
grid-auto-columns: auto;
|
|
958
938
|
}
|
|
959
939
|
.nws-layout-balance.nws-layout-direction-y {
|
|
960
940
|
grid-auto-flow: row;
|
|
941
|
+
grid-auto-rows: max-content;
|
|
942
|
+
}
|
|
943
|
+
.nws-layout-balance.nws-layout-direction-y.nws-layout-adjustY-grow, .nws-layout-balance.nws-layout-direction-y.nws-layout-adjustY-fit {
|
|
944
|
+
grid-auto-rows: auto;
|
|
945
|
+
}
|
|
946
|
+
.nws-layout-balance.nws-layout-direction-y.nws-layout-adjustY-shrink {
|
|
947
|
+
grid-auto-rows: minmax(0, max-content);
|
|
948
|
+
}
|
|
949
|
+
.nws-layout-balance.nws-layout-direction-y.nws-layout-childSizeY {
|
|
950
|
+
grid-auto-rows: auto;
|
|
961
951
|
}
|
|
962
952
|
.nws-layout-balance.nws-layout-alignX-left {
|
|
963
953
|
justify-items: flex-start;
|
|
@@ -969,13 +959,13 @@
|
|
|
969
959
|
justify-items: flex-end;
|
|
970
960
|
}
|
|
971
961
|
.nws-layout-balance.nws-layout-alignX-spaceBetween {
|
|
972
|
-
justify-
|
|
962
|
+
justify-content: space-between;
|
|
973
963
|
}
|
|
974
964
|
.nws-layout-balance.nws-layout-alignX-spaceAround {
|
|
975
|
-
justify-
|
|
965
|
+
justify-content: space-around;
|
|
976
966
|
}
|
|
977
967
|
.nws-layout-balance.nws-layout-alignX-spaceEvenly {
|
|
978
|
-
justify-
|
|
968
|
+
justify-content: space-evenly;
|
|
979
969
|
}
|
|
980
970
|
.nws-layout-balance.nws-layout-alignY-top {
|
|
981
971
|
align-items: flex-start;
|
|
@@ -987,13 +977,13 @@
|
|
|
987
977
|
align-items: flex-end;
|
|
988
978
|
}
|
|
989
979
|
.nws-layout-balance.nws-layout-alignY-spaceBetween {
|
|
990
|
-
align-
|
|
980
|
+
align-content: space-between;
|
|
991
981
|
}
|
|
992
982
|
.nws-layout-balance.nws-layout-alignY-spaceAround {
|
|
993
|
-
align-
|
|
983
|
+
align-content: space-around;
|
|
994
984
|
}
|
|
995
985
|
.nws-layout-balance.nws-layout-alignY-spaceEvenly {
|
|
996
|
-
align-
|
|
986
|
+
align-content: space-evenly;
|
|
997
987
|
}
|
|
998
988
|
.nws-layout-balance > * {
|
|
999
989
|
min-width: 0;
|
|
@@ -1011,9 +1001,15 @@
|
|
|
1011
1001
|
.nws-layout-balance.nws-layout-adjustX-grow > *, .nws-layout-balance.nws-layout-adjustX-shrink > * {
|
|
1012
1002
|
width: 100%;
|
|
1013
1003
|
}
|
|
1004
|
+
.nws-layout-balance.nws-layout-adjustX-grow > * {
|
|
1005
|
+
min-width: max-content;
|
|
1006
|
+
}
|
|
1014
1007
|
.nws-layout-balance.nws-layout-adjustX-grow.nws-layout-childSizeX > * {
|
|
1015
1008
|
min-width: var(--nws-layout-childSizeX);
|
|
1016
1009
|
}
|
|
1010
|
+
.nws-layout-balance.nws-layout-adjustX-shrink > * {
|
|
1011
|
+
max-width: max-content;
|
|
1012
|
+
}
|
|
1017
1013
|
.nws-layout-balance.nws-layout-adjustX-shrink.nws-layout-childSizeX > * {
|
|
1018
1014
|
max-width: var(--nws-layout-childSizeX);
|
|
1019
1015
|
}
|
|
@@ -1029,9 +1025,15 @@
|
|
|
1029
1025
|
.nws-layout-balance.nws-layout-adjustY-grow > *, .nws-layout-balance.nws-layout-adjustY-shrink > * {
|
|
1030
1026
|
height: 100%;
|
|
1031
1027
|
}
|
|
1028
|
+
.nws-layout-balance.nws-layout-adjustY-grow:not(.nws-layout-childSizeY) > * {
|
|
1029
|
+
min-height: max-content;
|
|
1030
|
+
}
|
|
1032
1031
|
.nws-layout-balance.nws-layout-adjustY-grow.nws-layout-childSizeY > * {
|
|
1033
1032
|
min-height: var(--nws-layout-childSizeY);
|
|
1034
1033
|
}
|
|
1034
|
+
.nws-layout-balance.nws-layout-adjustY-shrink:not(.nws-layout-childSizeY) > * {
|
|
1035
|
+
max-height: max-content;
|
|
1036
|
+
}
|
|
1035
1037
|
.nws-layout-balance.nws-layout-adjustY-shrink.nws-layout-childSizeY > * {
|
|
1036
1038
|
max-height: var(--nws-layout-childSizeY);
|
|
1037
1039
|
}
|
|
@@ -1087,8 +1089,6 @@
|
|
|
1087
1089
|
}
|
|
1088
1090
|
.nws-layout-layer.nws-layout-adjustX-shrink > * {
|
|
1089
1091
|
width: clamp(0px, 100%, var(--nws-layout-childSizeX));
|
|
1090
|
-
min-width: 0;
|
|
1091
|
-
max-width: 100%;
|
|
1092
1092
|
}
|
|
1093
1093
|
.nws-layout-layer.nws-layout-adjustY-fit > *, .nws-layout-layer.nws-layout-adjustY-grow > * {
|
|
1094
1094
|
align-self: stretch;
|
|
@@ -1099,8 +1099,6 @@
|
|
|
1099
1099
|
}
|
|
1100
1100
|
.nws-layout-layer.nws-layout-adjustY-shrink > * {
|
|
1101
1101
|
height: clamp(0px, 100%, var(--nws-layout-childSizeY));
|
|
1102
|
-
min-height: 0;
|
|
1103
|
-
max-height: 100%;
|
|
1104
1102
|
}
|
|
1105
1103
|
.nws-layout-layer.nws-layout-childRatio > * {
|
|
1106
1104
|
aspect-ratio: var(--nws-layout-childRatio);
|
package/core/tile/tile.cjs
CHANGED
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
const require_runtime = require('../../_virtual/_rolldown/runtime.cjs');
|
|
2
|
-
const require_core_constants = require('../constants.cjs');
|
|
3
2
|
const require_core__constants = require('../_constants.cjs');
|
|
3
|
+
const require_core__internal_mergeClassName = require('../_internal/mergeClassName.cjs');
|
|
4
4
|
const require_core__internal_applyChildRatio = require('../_internal/applyChildRatio.cjs');
|
|
5
5
|
const require_core__internal_applyChildSize = require('../_internal/applyChildSize.cjs');
|
|
6
6
|
const require_core__internal_applyGap = require('../_internal/applyGap.cjs');
|
|
7
7
|
let _niche_works_utils_object_maybeDefault = require("@niche-works/utils/object/maybeDefault");
|
|
8
8
|
_niche_works_utils_object_maybeDefault = require_runtime.__toESM(_niche_works_utils_object_maybeDefault, 1);
|
|
9
|
-
let clsx = require("clsx");
|
|
10
|
-
clsx = require_runtime.__toESM(clsx, 1);
|
|
11
9
|
|
|
12
10
|
//#region src/core/tile/tile.ts
|
|
13
11
|
/**
|
|
@@ -23,7 +21,7 @@ const tile = (options = {}) => {
|
|
|
23
21
|
alignY: "top"
|
|
24
22
|
}, { overwriteNull: true });
|
|
25
23
|
const result = {
|
|
26
|
-
className: (
|
|
24
|
+
className: require_core__internal_mergeClassName(require_core__constants.clsLayoutTile, require_core__constants.clsLayout.direction[direction], require_core__constants.clsLayout.align.x[alignX], require_core__constants.clsLayout.align.y[alignY], require_core__constants.clsLayout.adjust.x[adjustX], require_core__constants.clsLayout.adjust.y[adjustY]),
|
|
27
25
|
style: {}
|
|
28
26
|
};
|
|
29
27
|
require_core__internal_applyGap(result, gap, gapX, gapY);
|
package/core/tile/tile.mjs
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { clsLayoutTile } from "../
|
|
2
|
-
import
|
|
1
|
+
import { clsLayout, clsLayoutTile } from "../_constants.mjs";
|
|
2
|
+
import mergeClassName from "../_internal/mergeClassName.mjs";
|
|
3
3
|
import applyChildRatio from "../_internal/applyChildRatio.mjs";
|
|
4
4
|
import applyChildSize from "../_internal/applyChildSize.mjs";
|
|
5
5
|
import applyGap from "../_internal/applyGap.mjs";
|
|
6
6
|
import maybeDefault from "@niche-works/utils/object/maybeDefault";
|
|
7
|
-
import clsx from "clsx";
|
|
8
7
|
|
|
9
8
|
//#region src/core/tile/tile.ts
|
|
10
9
|
/**
|
|
@@ -20,7 +19,7 @@ const tile = (options = {}) => {
|
|
|
20
19
|
alignY: "top"
|
|
21
20
|
}, { overwriteNull: true });
|
|
22
21
|
const result = {
|
|
23
|
-
className:
|
|
22
|
+
className: mergeClassName(clsLayoutTile, clsLayout.direction[direction], clsLayout.align.x[alignX], clsLayout.align.y[alignY], clsLayout.adjust.x[adjustX], clsLayout.adjust.y[adjustY]),
|
|
24
23
|
style: {}
|
|
25
24
|
};
|
|
26
25
|
applyGap(result, gap, gapX, gapY);
|
package/core/types.d.cts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { CSSCustomProperties } from "./_types.cjs";
|
|
2
1
|
import { LooseDictionary } from "@niche-works/types";
|
|
3
2
|
|
|
4
3
|
//#region src/core/types.d.ts
|
|
@@ -19,5 +18,11 @@ type StyleLayoutResult = {
|
|
|
19
18
|
*/
|
|
20
19
|
style?: CSSCustomProperties;
|
|
21
20
|
};
|
|
21
|
+
/**
|
|
22
|
+
* CSSカスタムプロパティ(変数)
|
|
23
|
+
*/
|
|
24
|
+
type CSSCustomProperties = {
|
|
25
|
+
[key: `--${string}`]: string | undefined;
|
|
26
|
+
};
|
|
22
27
|
//#endregion
|
|
23
|
-
export { StyleLayout, StyleLayoutResult };
|
|
28
|
+
export { CSSCustomProperties, StyleLayout, StyleLayoutResult };
|
package/core/types.d.mts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { CSSCustomProperties } from "./_types.mjs";
|
|
2
1
|
import { LooseDictionary } from "@niche-works/types";
|
|
3
2
|
|
|
4
3
|
//#region src/core/types.d.ts
|
|
@@ -19,5 +18,11 @@ type StyleLayoutResult = {
|
|
|
19
18
|
*/
|
|
20
19
|
style?: CSSCustomProperties;
|
|
21
20
|
};
|
|
21
|
+
/**
|
|
22
|
+
* CSSカスタムプロパティ(変数)
|
|
23
|
+
*/
|
|
24
|
+
type CSSCustomProperties = {
|
|
25
|
+
[key: `--${string}`]: string | undefined;
|
|
26
|
+
};
|
|
22
27
|
//#endregion
|
|
23
|
-
export { StyleLayout, StyleLayoutResult };
|
|
28
|
+
export { CSSCustomProperties, StyleLayout, StyleLayoutResult };
|
package/flow/index.cjs
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
require('../core/flow/styles.css');
|
|
2
1
|
const require_core_flow_flow = require('../core/flow/flow.cjs');
|
|
2
|
+
require('../core/flow/styles.css');
|
|
3
|
+
|
|
4
|
+
//#region src/flow/index.ts
|
|
5
|
+
var flow_default = require_core_flow_flow;
|
|
3
6
|
|
|
4
|
-
|
|
7
|
+
//#endregion
|
|
8
|
+
module.exports = flow_default;
|
package/flow/index.mjs
CHANGED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
|
|
3
|
+
//#region src/helpers/_internal/constants.ts
|
|
4
|
+
const DIRECTION_OPTIONS_KEYS = ["direction"];
|
|
5
|
+
const ALIGN_OPTIONS_KEYS = ["alignX", "alignY"];
|
|
6
|
+
const ADJUST_OPTIONS_KEYS = ["adjustX", "adjustY"];
|
|
7
|
+
const GAP_OPTIONS_KEYS = [
|
|
8
|
+
"gap",
|
|
9
|
+
"gapX",
|
|
10
|
+
"gapY"
|
|
11
|
+
];
|
|
12
|
+
const CHILD_SIZE_OPTIONS_KEYS = ["childSizeX", "childSizeY"];
|
|
13
|
+
const CHILD_RATIO_OPTIONS_KEYS = ["childRatioX", "childRatioY"];
|
|
14
|
+
const CHILD_COUNT_OPTIONS_KEYS = ["childCountX", "childCountY"];
|
|
15
|
+
const TRACKS_OPTIONS_KEYS = ["tracksX", "tracksY"];
|
|
16
|
+
|
|
17
|
+
//#endregion
|
|
18
|
+
exports.ADJUST_OPTIONS_KEYS = ADJUST_OPTIONS_KEYS;
|
|
19
|
+
exports.ALIGN_OPTIONS_KEYS = ALIGN_OPTIONS_KEYS;
|
|
20
|
+
exports.CHILD_COUNT_OPTIONS_KEYS = CHILD_COUNT_OPTIONS_KEYS;
|
|
21
|
+
exports.CHILD_RATIO_OPTIONS_KEYS = CHILD_RATIO_OPTIONS_KEYS;
|
|
22
|
+
exports.CHILD_SIZE_OPTIONS_KEYS = CHILD_SIZE_OPTIONS_KEYS;
|
|
23
|
+
exports.DIRECTION_OPTIONS_KEYS = DIRECTION_OPTIONS_KEYS;
|
|
24
|
+
exports.GAP_OPTIONS_KEYS = GAP_OPTIONS_KEYS;
|
|
25
|
+
exports.TRACKS_OPTIONS_KEYS = TRACKS_OPTIONS_KEYS;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { AdjustOptions, AlignOptions, ChildCountOptions, ChildRatioOptions, ChildSizeOptions, DirectionOptions, GapOptions, TracksOptions } from "../../core/_types.cjs";
|
|
2
|
+
|
|
3
|
+
//#region src/helpers/_internal/constants.d.ts
|
|
4
|
+
declare const DIRECTION_OPTIONS_KEYS: (keyof DirectionOptions)[];
|
|
5
|
+
declare const ALIGN_OPTIONS_KEYS: (keyof AlignOptions)[];
|
|
6
|
+
declare const ADJUST_OPTIONS_KEYS: (keyof AdjustOptions)[];
|
|
7
|
+
declare const GAP_OPTIONS_KEYS: (keyof GapOptions)[];
|
|
8
|
+
declare const CHILD_SIZE_OPTIONS_KEYS: (keyof ChildSizeOptions)[];
|
|
9
|
+
declare const CHILD_RATIO_OPTIONS_KEYS: (keyof ChildRatioOptions)[];
|
|
10
|
+
declare const CHILD_COUNT_OPTIONS_KEYS: (keyof ChildCountOptions)[];
|
|
11
|
+
declare const TRACKS_OPTIONS_KEYS: (keyof TracksOptions)[];
|
|
12
|
+
//#endregion
|
|
13
|
+
export { ADJUST_OPTIONS_KEYS, ALIGN_OPTIONS_KEYS, CHILD_COUNT_OPTIONS_KEYS, CHILD_RATIO_OPTIONS_KEYS, CHILD_SIZE_OPTIONS_KEYS, DIRECTION_OPTIONS_KEYS, GAP_OPTIONS_KEYS, TRACKS_OPTIONS_KEYS };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { AdjustOptions, AlignOptions, ChildCountOptions, ChildRatioOptions, ChildSizeOptions, DirectionOptions, GapOptions, TracksOptions } from "../../core/_types.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/helpers/_internal/constants.d.ts
|
|
4
|
+
declare const DIRECTION_OPTIONS_KEYS: (keyof DirectionOptions)[];
|
|
5
|
+
declare const ALIGN_OPTIONS_KEYS: (keyof AlignOptions)[];
|
|
6
|
+
declare const ADJUST_OPTIONS_KEYS: (keyof AdjustOptions)[];
|
|
7
|
+
declare const GAP_OPTIONS_KEYS: (keyof GapOptions)[];
|
|
8
|
+
declare const CHILD_SIZE_OPTIONS_KEYS: (keyof ChildSizeOptions)[];
|
|
9
|
+
declare const CHILD_RATIO_OPTIONS_KEYS: (keyof ChildRatioOptions)[];
|
|
10
|
+
declare const CHILD_COUNT_OPTIONS_KEYS: (keyof ChildCountOptions)[];
|
|
11
|
+
declare const TRACKS_OPTIONS_KEYS: (keyof TracksOptions)[];
|
|
12
|
+
//#endregion
|
|
13
|
+
export { ADJUST_OPTIONS_KEYS, ALIGN_OPTIONS_KEYS, CHILD_COUNT_OPTIONS_KEYS, CHILD_RATIO_OPTIONS_KEYS, CHILD_SIZE_OPTIONS_KEYS, DIRECTION_OPTIONS_KEYS, GAP_OPTIONS_KEYS, TRACKS_OPTIONS_KEYS };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
//#region src/helpers/_internal/constants.ts
|
|
2
|
+
const DIRECTION_OPTIONS_KEYS = ["direction"];
|
|
3
|
+
const ALIGN_OPTIONS_KEYS = ["alignX", "alignY"];
|
|
4
|
+
const ADJUST_OPTIONS_KEYS = ["adjustX", "adjustY"];
|
|
5
|
+
const GAP_OPTIONS_KEYS = [
|
|
6
|
+
"gap",
|
|
7
|
+
"gapX",
|
|
8
|
+
"gapY"
|
|
9
|
+
];
|
|
10
|
+
const CHILD_SIZE_OPTIONS_KEYS = ["childSizeX", "childSizeY"];
|
|
11
|
+
const CHILD_RATIO_OPTIONS_KEYS = ["childRatioX", "childRatioY"];
|
|
12
|
+
const CHILD_COUNT_OPTIONS_KEYS = ["childCountX", "childCountY"];
|
|
13
|
+
const TRACKS_OPTIONS_KEYS = ["tracksX", "tracksY"];
|
|
14
|
+
|
|
15
|
+
//#endregion
|
|
16
|
+
export { ADJUST_OPTIONS_KEYS, ALIGN_OPTIONS_KEYS, CHILD_COUNT_OPTIONS_KEYS, CHILD_RATIO_OPTIONS_KEYS, CHILD_SIZE_OPTIONS_KEYS, DIRECTION_OPTIONS_KEYS, GAP_OPTIONS_KEYS, TRACKS_OPTIONS_KEYS };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
|
|
2
|
+
//#region src/helpers/_internal/createExtractLayoutOptions.ts
|
|
3
|
+
/**
|
|
4
|
+
* レコードからレイアウトオプションとそれ以外のプロパティを分離する関数を作成する
|
|
5
|
+
*
|
|
6
|
+
* @param optionsKeys レイアウトオプションのキー
|
|
7
|
+
*/
|
|
8
|
+
function createExtractLayoutOptions(optionKeys) {
|
|
9
|
+
const keySet = new Set(optionKeys);
|
|
10
|
+
/**
|
|
11
|
+
* レコードからレイアウトオプションとそれ以外のプロパティを分離する
|
|
12
|
+
*
|
|
13
|
+
* @param record レイアウトオプションとその他のプロパティを含むレコード
|
|
14
|
+
* @returns `[layoutOptions, rest]` のタプル。`layoutOptions` はレイアウトに対応するプロパティ、`rest` はそれ以外のプロパティ
|
|
15
|
+
*/
|
|
16
|
+
return (record) => {
|
|
17
|
+
const options = {};
|
|
18
|
+
const rest = {};
|
|
19
|
+
if (record) for (const [k, v] of Object.entries(record)) (keySet.has(k) ? options : rest)[k] = v;
|
|
20
|
+
return [options, rest];
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
//#endregion
|
|
25
|
+
module.exports = createExtractLayoutOptions;
|