@fringeworks/style-layouts 0.0.0-stage → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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,12 @@
|
|
|
1
|
+
import { LayoutStyle } from "../types.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/_internal/applyItemRatio.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* 子要素の縦横比に関する設定の適用
|
|
6
|
+
* @param result
|
|
7
|
+
* @param itemRatioX
|
|
8
|
+
* @param itemRatioY
|
|
9
|
+
*/
|
|
10
|
+
declare function applyItemRatio(result: LayoutStyle, itemRatioX: number | null | undefined, itemRatioY: number | null | undefined): void;
|
|
11
|
+
//#endregion
|
|
12
|
+
export { applyItemRatio as default };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { clsLayoutItemRatio, varLayoutItemRatio } from "../_constants.mjs";
|
|
2
|
+
import hasValue from "./hasValue.mjs";
|
|
3
|
+
import mergeClassName from "./mergeClassName.mjs";
|
|
4
|
+
|
|
5
|
+
//#region src/_internal/applyItemRatio.ts
|
|
6
|
+
/**
|
|
7
|
+
* 子要素の縦横比に関する設定の適用
|
|
8
|
+
* @param result
|
|
9
|
+
* @param itemRatioX
|
|
10
|
+
* @param itemRatioY
|
|
11
|
+
*/
|
|
12
|
+
function applyItemRatio(result, itemRatioX, itemRatioY) {
|
|
13
|
+
if (hasValue(itemRatioX) || hasValue(itemRatioY)) {
|
|
14
|
+
result.className = mergeClassName(result.className, clsLayoutItemRatio);
|
|
15
|
+
result.style ??= {};
|
|
16
|
+
result.style[varLayoutItemRatio] = `${itemRatioX ?? 1} / ${itemRatioY ?? 1}`;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
//#endregion
|
|
21
|
+
export { applyItemRatio as default };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
const require__constants = require('../_constants.cjs');
|
|
2
|
+
const require__internal_hasValue = require('./hasValue.cjs');
|
|
3
|
+
const require__internal_mergeClassName = require('./mergeClassName.cjs');
|
|
4
|
+
const require__internal_unit = require('./unit.cjs');
|
|
5
|
+
|
|
6
|
+
//#region src/_internal/applyItemSize.ts
|
|
7
|
+
function applyItemSize(result, itemSizeX, itemSizeY) {
|
|
8
|
+
if (require__internal_hasValue(itemSizeX)) {
|
|
9
|
+
result.className = require__internal_mergeClassName(result.className, require__constants.clsLayoutItemSizeX);
|
|
10
|
+
result.style ??= {};
|
|
11
|
+
result.style[require__constants.varLayoutItemSizeX] = require__internal_unit(itemSizeX);
|
|
12
|
+
}
|
|
13
|
+
if (require__internal_hasValue(itemSizeY)) {
|
|
14
|
+
result.className = require__internal_mergeClassName(result.className, require__constants.clsLayoutItemSizeY);
|
|
15
|
+
result.style ??= {};
|
|
16
|
+
result.style[require__constants.varLayoutItemSizeY] = require__internal_unit(itemSizeY);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
//#endregion
|
|
21
|
+
module.exports = applyItemSize;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { LayoutStyle } from "../types.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/_internal/applyItemSize.d.ts
|
|
4
|
+
declare function applyItemSize(result: LayoutStyle, itemSizeX: number | null | undefined, itemSizeY: number | null | undefined): void;
|
|
5
|
+
//#endregion
|
|
6
|
+
export { applyItemSize as default };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { clsLayoutItemSizeX, clsLayoutItemSizeY, varLayoutItemSizeX, varLayoutItemSizeY } from "../_constants.mjs";
|
|
2
|
+
import hasValue from "./hasValue.mjs";
|
|
3
|
+
import mergeClassName from "./mergeClassName.mjs";
|
|
4
|
+
import unit from "./unit.mjs";
|
|
5
|
+
|
|
6
|
+
//#region src/_internal/applyItemSize.ts
|
|
7
|
+
function applyItemSize(result, itemSizeX, itemSizeY) {
|
|
8
|
+
if (hasValue(itemSizeX)) {
|
|
9
|
+
result.className = mergeClassName(result.className, clsLayoutItemSizeX);
|
|
10
|
+
result.style ??= {};
|
|
11
|
+
result.style[varLayoutItemSizeX] = unit(itemSizeX);
|
|
12
|
+
}
|
|
13
|
+
if (hasValue(itemSizeY)) {
|
|
14
|
+
result.className = mergeClassName(result.className, clsLayoutItemSizeY);
|
|
15
|
+
result.style ??= {};
|
|
16
|
+
result.style[varLayoutItemSizeY] = unit(itemSizeY);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
//#endregion
|
|
21
|
+
export { applyItemSize as default };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
|
|
2
|
+
//#region src/_internal/hasValue.ts
|
|
3
|
+
/**
|
|
4
|
+
* 有効な値か
|
|
5
|
+
* @param value
|
|
6
|
+
* @returns
|
|
7
|
+
*/
|
|
8
|
+
function hasValue(value) {
|
|
9
|
+
if (typeof value === "number") return true;
|
|
10
|
+
else if (typeof value === "boolean") return true;
|
|
11
|
+
else return value !== null && value !== void 0 && value !== "";
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
//#endregion
|
|
15
|
+
module.exports = hasValue;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
//#region src/_internal/hasValue.ts
|
|
2
|
+
/**
|
|
3
|
+
* 有効な値か
|
|
4
|
+
* @param value
|
|
5
|
+
* @returns
|
|
6
|
+
*/
|
|
7
|
+
function hasValue(value) {
|
|
8
|
+
if (typeof value === "number") return true;
|
|
9
|
+
else if (typeof value === "boolean") return true;
|
|
10
|
+
else return value !== null && value !== void 0 && value !== "";
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
//#endregion
|
|
14
|
+
export { hasValue as default };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
|
|
2
|
+
//#region src/_internal/mergeClassName.ts
|
|
3
|
+
function mergeClassName(...classNames) {
|
|
4
|
+
return classNames.reduce((result, className) => {
|
|
5
|
+
if (className) result.push(className);
|
|
6
|
+
return result;
|
|
7
|
+
}, []).join(" ");
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
//#endregion
|
|
11
|
+
module.exports = mergeClassName;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
//#region src/_internal/mergeClassName.ts
|
|
2
|
+
function mergeClassName(...classNames) {
|
|
3
|
+
return classNames.reduce((result, className) => {
|
|
4
|
+
if (className) result.push(className);
|
|
5
|
+
return result;
|
|
6
|
+
}, []).join(" ");
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
//#endregion
|
|
10
|
+
export { mergeClassName as default };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
const require__internal_mergeClassName = require('./mergeClassName.cjs');
|
|
2
|
+
|
|
3
|
+
//#region src/_internal/mergeLayoutResults.ts
|
|
4
|
+
function mergeLayoutResults(results) {
|
|
5
|
+
return results.reduce((layoutResult, result) => {
|
|
6
|
+
if (result.className) layoutResult.className = require__internal_mergeClassName(layoutResult.className, result.className);
|
|
7
|
+
if (result.style) layoutResult.style = {
|
|
8
|
+
...layoutResult.style,
|
|
9
|
+
...result.style
|
|
10
|
+
};
|
|
11
|
+
return layoutResult;
|
|
12
|
+
}, {});
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
//#endregion
|
|
16
|
+
module.exports = mergeLayoutResults;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import mergeClassName from "./mergeClassName.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/_internal/mergeLayoutResults.ts
|
|
4
|
+
function mergeLayoutResults(results) {
|
|
5
|
+
return results.reduce((layoutResult, result) => {
|
|
6
|
+
if (result.className) layoutResult.className = mergeClassName(layoutResult.className, result.className);
|
|
7
|
+
if (result.style) layoutResult.style = {
|
|
8
|
+
...layoutResult.style,
|
|
9
|
+
...result.style
|
|
10
|
+
};
|
|
11
|
+
return layoutResult;
|
|
12
|
+
}, {});
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
//#endregion
|
|
16
|
+
export { mergeLayoutResults as default };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
//#region src/_internal/unit.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* valueが数値の場合、単位を付与して文字列に変換する
|
|
4
|
+
* それ以外はそのまま返す
|
|
5
|
+
* @param value
|
|
6
|
+
* @param unit
|
|
7
|
+
* @returns
|
|
8
|
+
*/
|
|
9
|
+
declare function unit(value: string | number, unit?: string): string;
|
|
10
|
+
declare function unit(value: string | number | null | undefined, unit?: string): string | null | undefined;
|
|
11
|
+
export = unit;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
//#region src/_internal/unit.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* valueが数値の場合、単位を付与して文字列に変換する
|
|
4
|
+
* それ以外はそのまま返す
|
|
5
|
+
* @param value
|
|
6
|
+
* @param unit
|
|
7
|
+
* @returns
|
|
8
|
+
*/
|
|
9
|
+
declare function unit(value: string | number, unit?: string): string;
|
|
10
|
+
declare function unit(value: string | number | null | undefined, unit?: string): string | null | undefined;
|
|
11
|
+
//#endregion
|
|
12
|
+
export { unit as default };
|
package/_styles.scss.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
require('./styles.css');
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
package/_styles.scss.mjs
ADDED
package/_types.cjs
ADDED
|
File without changes
|
package/_types.d.cts
ADDED
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { Adjust, AlignX, AlignY, Direction } from "./constants.cjs";
|
|
2
|
+
|
|
3
|
+
//#region src/_types.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* 子要素を並べる方向
|
|
6
|
+
*/
|
|
7
|
+
type DirectionOptions<D extends Direction = Direction> = {
|
|
8
|
+
/**
|
|
9
|
+
* 並べる方向
|
|
10
|
+
*/
|
|
11
|
+
direction?: D | null;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* 子要素の位置
|
|
15
|
+
*/
|
|
16
|
+
type AlignOptions = {
|
|
17
|
+
/**
|
|
18
|
+
* 子要素の横位置
|
|
19
|
+
*/
|
|
20
|
+
alignX?: AlignX | null;
|
|
21
|
+
/**
|
|
22
|
+
* 子要素の縦位置
|
|
23
|
+
*/
|
|
24
|
+
alignY?: AlignY | null;
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* 子要素のサイズ調整
|
|
28
|
+
*/
|
|
29
|
+
type AdjustOptions = {
|
|
30
|
+
/**
|
|
31
|
+
* 子要素の幅の調整
|
|
32
|
+
* itemSizeXを指定した場合に有効
|
|
33
|
+
* デフォルトは`none`
|
|
34
|
+
*/
|
|
35
|
+
adjustX?: Adjust | null;
|
|
36
|
+
/**
|
|
37
|
+
* 子要素の高さの調整
|
|
38
|
+
* itemSizeYを指定した場合に有効
|
|
39
|
+
* デフォルトは`none`
|
|
40
|
+
*/
|
|
41
|
+
adjustY?: Adjust | null;
|
|
42
|
+
};
|
|
43
|
+
/**
|
|
44
|
+
* 要素間の余白
|
|
45
|
+
*/
|
|
46
|
+
type GapOptions = {
|
|
47
|
+
/**
|
|
48
|
+
* 余白
|
|
49
|
+
*/
|
|
50
|
+
gap?: number | null;
|
|
51
|
+
/**
|
|
52
|
+
* 横方向の余白
|
|
53
|
+
*/
|
|
54
|
+
gapX?: number | null;
|
|
55
|
+
/**
|
|
56
|
+
* 縦方向の余白
|
|
57
|
+
*/
|
|
58
|
+
gapY?: number | null;
|
|
59
|
+
};
|
|
60
|
+
/**
|
|
61
|
+
* 子要素のサイズ
|
|
62
|
+
*/
|
|
63
|
+
type ItemSizeOptions = {
|
|
64
|
+
/**
|
|
65
|
+
* 子要素の幅
|
|
66
|
+
*/
|
|
67
|
+
itemSizeX?: number | null;
|
|
68
|
+
/**
|
|
69
|
+
* 子要素の高さ
|
|
70
|
+
*/
|
|
71
|
+
itemSizeY?: number | null;
|
|
72
|
+
};
|
|
73
|
+
/**
|
|
74
|
+
* 子要素のサイズの縦横比
|
|
75
|
+
*/
|
|
76
|
+
type ItemRatioOptions = {
|
|
77
|
+
/**
|
|
78
|
+
* 子要素の縦横比(横)
|
|
79
|
+
*/
|
|
80
|
+
itemRatioX?: number | null;
|
|
81
|
+
/**
|
|
82
|
+
* 子要素の縦横比(縦)
|
|
83
|
+
*/
|
|
84
|
+
itemRatioY?: number | null;
|
|
85
|
+
};
|
|
86
|
+
/**
|
|
87
|
+
* 子要素の数
|
|
88
|
+
*/
|
|
89
|
+
type ItemCountOptions = {
|
|
90
|
+
/**
|
|
91
|
+
* 横方向の要素数
|
|
92
|
+
*/
|
|
93
|
+
itemCountX?: number | null;
|
|
94
|
+
/**
|
|
95
|
+
* 縦方向の要素数
|
|
96
|
+
*/
|
|
97
|
+
itemCountY?: number | null;
|
|
98
|
+
};
|
|
99
|
+
/**
|
|
100
|
+
* 子要素のサイズと数
|
|
101
|
+
*/
|
|
102
|
+
type TracksOptions = {
|
|
103
|
+
/**
|
|
104
|
+
* 横方向の設定
|
|
105
|
+
* このプロパティが設定されている場合、itemCountX,itemSizeXは無効
|
|
106
|
+
*/
|
|
107
|
+
tracksX?: (string | number)[] | null;
|
|
108
|
+
/**
|
|
109
|
+
* 縦方向の設定
|
|
110
|
+
* このプロパティが設定されている場合、itemCountY,itemSizeYは無効
|
|
111
|
+
*/
|
|
112
|
+
tracksY?: (string | number)[] | null;
|
|
113
|
+
};
|
|
114
|
+
//#endregion
|
|
115
|
+
export { AdjustOptions, AlignOptions, DirectionOptions, GapOptions, ItemCountOptions, ItemRatioOptions, ItemSizeOptions, TracksOptions };
|
package/_types.d.mts
ADDED
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { Adjust, AlignX, AlignY, Direction } from "./constants.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/_types.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* 子要素を並べる方向
|
|
6
|
+
*/
|
|
7
|
+
type DirectionOptions<D extends Direction = Direction> = {
|
|
8
|
+
/**
|
|
9
|
+
* 並べる方向
|
|
10
|
+
*/
|
|
11
|
+
direction?: D | null;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* 子要素の位置
|
|
15
|
+
*/
|
|
16
|
+
type AlignOptions = {
|
|
17
|
+
/**
|
|
18
|
+
* 子要素の横位置
|
|
19
|
+
*/
|
|
20
|
+
alignX?: AlignX | null;
|
|
21
|
+
/**
|
|
22
|
+
* 子要素の縦位置
|
|
23
|
+
*/
|
|
24
|
+
alignY?: AlignY | null;
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* 子要素のサイズ調整
|
|
28
|
+
*/
|
|
29
|
+
type AdjustOptions = {
|
|
30
|
+
/**
|
|
31
|
+
* 子要素の幅の調整
|
|
32
|
+
* itemSizeXを指定した場合に有効
|
|
33
|
+
* デフォルトは`none`
|
|
34
|
+
*/
|
|
35
|
+
adjustX?: Adjust | null;
|
|
36
|
+
/**
|
|
37
|
+
* 子要素の高さの調整
|
|
38
|
+
* itemSizeYを指定した場合に有効
|
|
39
|
+
* デフォルトは`none`
|
|
40
|
+
*/
|
|
41
|
+
adjustY?: Adjust | null;
|
|
42
|
+
};
|
|
43
|
+
/**
|
|
44
|
+
* 要素間の余白
|
|
45
|
+
*/
|
|
46
|
+
type GapOptions = {
|
|
47
|
+
/**
|
|
48
|
+
* 余白
|
|
49
|
+
*/
|
|
50
|
+
gap?: number | null;
|
|
51
|
+
/**
|
|
52
|
+
* 横方向の余白
|
|
53
|
+
*/
|
|
54
|
+
gapX?: number | null;
|
|
55
|
+
/**
|
|
56
|
+
* 縦方向の余白
|
|
57
|
+
*/
|
|
58
|
+
gapY?: number | null;
|
|
59
|
+
};
|
|
60
|
+
/**
|
|
61
|
+
* 子要素のサイズ
|
|
62
|
+
*/
|
|
63
|
+
type ItemSizeOptions = {
|
|
64
|
+
/**
|
|
65
|
+
* 子要素の幅
|
|
66
|
+
*/
|
|
67
|
+
itemSizeX?: number | null;
|
|
68
|
+
/**
|
|
69
|
+
* 子要素の高さ
|
|
70
|
+
*/
|
|
71
|
+
itemSizeY?: number | null;
|
|
72
|
+
};
|
|
73
|
+
/**
|
|
74
|
+
* 子要素のサイズの縦横比
|
|
75
|
+
*/
|
|
76
|
+
type ItemRatioOptions = {
|
|
77
|
+
/**
|
|
78
|
+
* 子要素の縦横比(横)
|
|
79
|
+
*/
|
|
80
|
+
itemRatioX?: number | null;
|
|
81
|
+
/**
|
|
82
|
+
* 子要素の縦横比(縦)
|
|
83
|
+
*/
|
|
84
|
+
itemRatioY?: number | null;
|
|
85
|
+
};
|
|
86
|
+
/**
|
|
87
|
+
* 子要素の数
|
|
88
|
+
*/
|
|
89
|
+
type ItemCountOptions = {
|
|
90
|
+
/**
|
|
91
|
+
* 横方向の要素数
|
|
92
|
+
*/
|
|
93
|
+
itemCountX?: number | null;
|
|
94
|
+
/**
|
|
95
|
+
* 縦方向の要素数
|
|
96
|
+
*/
|
|
97
|
+
itemCountY?: number | null;
|
|
98
|
+
};
|
|
99
|
+
/**
|
|
100
|
+
* 子要素のサイズと数
|
|
101
|
+
*/
|
|
102
|
+
type TracksOptions = {
|
|
103
|
+
/**
|
|
104
|
+
* 横方向の設定
|
|
105
|
+
* このプロパティが設定されている場合、itemCountX,itemSizeXは無効
|
|
106
|
+
*/
|
|
107
|
+
tracksX?: (string | number)[] | null;
|
|
108
|
+
/**
|
|
109
|
+
* 縦方向の設定
|
|
110
|
+
* このプロパティが設定されている場合、itemCountY,itemSizeYは無効
|
|
111
|
+
*/
|
|
112
|
+
tracksY?: (string | number)[] | null;
|
|
113
|
+
};
|
|
114
|
+
//#endregion
|
|
115
|
+
export { AdjustOptions, AlignOptions, DirectionOptions, GapOptions, ItemCountOptions, ItemRatioOptions, ItemSizeOptions, TracksOptions };
|
package/_types.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
//#region \0rolldown/runtime.js
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __copyProps = (to, from, except, desc) => {
|
|
9
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
10
|
+
for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
11
|
+
key = keys[i];
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except) {
|
|
13
|
+
__defProp(to, key, {
|
|
14
|
+
get: ((k) => from[k]).bind(null, key),
|
|
15
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
return to;
|
|
21
|
+
};
|
|
22
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
23
|
+
value: mod,
|
|
24
|
+
enumerable: true
|
|
25
|
+
}) : target, mod));
|
|
26
|
+
|
|
27
|
+
//#endregion
|
|
28
|
+
|
|
29
|
+
exports.__toESM = __toESM;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
|
|
2
|
+
const require__constants = require('../_constants.cjs');
|
|
3
|
+
const require__internal_mergeClassName = require('../_internal/mergeClassName.cjs');
|
|
4
|
+
const require__internal_applyGap = require('../_internal/applyGap.cjs');
|
|
5
|
+
const require__internal_applyItemRatio = require('../_internal/applyItemRatio.cjs');
|
|
6
|
+
const require__internal_applyItemSize = require('../_internal/applyItemSize.cjs');
|
|
7
|
+
let _fringeworks_utils_object_maybeDefault = require("@fringeworks/utils/object/maybeDefault");
|
|
8
|
+
_fringeworks_utils_object_maybeDefault = require_runtime.__toESM(_fringeworks_utils_object_maybeDefault, 1);
|
|
9
|
+
|
|
10
|
+
//#region src/balance/balance.ts
|
|
11
|
+
/**
|
|
12
|
+
* balanceレイアウト
|
|
13
|
+
*
|
|
14
|
+
* - 子要素を均等に配置する
|
|
15
|
+
* - `adjust`が効いていない場合は、子要素のサイズを維持したまま、余白を均等に配分する
|
|
16
|
+
* - `adjust`が効いている場合は、子要素のサイズを調整してコンテナを満たす
|
|
17
|
+
*/
|
|
18
|
+
const balance = (options = {}) => {
|
|
19
|
+
const { direction, alignX, alignY, adjustX, adjustY, gap, gapX, gapY, itemSizeX, itemSizeY, itemRatioX, itemRatioY } = (0, _fringeworks_utils_object_maybeDefault.default)(options, {
|
|
20
|
+
direction: "x",
|
|
21
|
+
alignX: "left",
|
|
22
|
+
alignY: "top",
|
|
23
|
+
adjustX: "none",
|
|
24
|
+
adjustY: "none"
|
|
25
|
+
}, { overwriteNull: true });
|
|
26
|
+
const result = {
|
|
27
|
+
className: require__internal_mergeClassName(require__constants.clsLayoutBalance, require__constants.clsLayout.direction[direction], require__constants.clsLayout.align.x[alignX], require__constants.clsLayout.align.y[alignY], require__constants.clsLayout.adjust.x[adjustX], require__constants.clsLayout.adjust.y[adjustY]),
|
|
28
|
+
style: {}
|
|
29
|
+
};
|
|
30
|
+
require__internal_applyGap(result, gap, gapX, gapY);
|
|
31
|
+
require__internal_applyItemSize(result, itemSizeX, itemSizeY);
|
|
32
|
+
require__internal_applyItemRatio(result, itemRatioX, itemRatioY);
|
|
33
|
+
return result;
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
//#endregion
|
|
37
|
+
module.exports = balance;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { CreateLayoutStyle } from "../types.cjs";
|
|
2
|
+
import { BalanceLayoutOptions } from "./types.cjs";
|
|
3
|
+
|
|
4
|
+
//#region src/balance/balance.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* balanceレイアウト
|
|
7
|
+
*
|
|
8
|
+
* - 子要素を均等に配置する
|
|
9
|
+
* - `adjust`が効いていない場合は、子要素のサイズを維持したまま、余白を均等に配分する
|
|
10
|
+
* - `adjust`が効いている場合は、子要素のサイズを調整してコンテナを満たす
|
|
11
|
+
*/
|
|
12
|
+
declare const balance: CreateLayoutStyle<BalanceLayoutOptions>;
|
|
13
|
+
export = balance;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { CreateLayoutStyle } from "../types.mjs";
|
|
2
|
+
import { BalanceLayoutOptions } from "./types.mjs";
|
|
3
|
+
|
|
4
|
+
//#region src/balance/balance.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* balanceレイアウト
|
|
7
|
+
*
|
|
8
|
+
* - 子要素を均等に配置する
|
|
9
|
+
* - `adjust`が効いていない場合は、子要素のサイズを維持したまま、余白を均等に配分する
|
|
10
|
+
* - `adjust`が効いている場合は、子要素のサイズを調整してコンテナを満たす
|
|
11
|
+
*/
|
|
12
|
+
declare const balance: CreateLayoutStyle<BalanceLayoutOptions>;
|
|
13
|
+
//#endregion
|
|
14
|
+
export { balance as default };
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { clsLayout, clsLayoutBalance } from "../_constants.mjs";
|
|
2
|
+
import mergeClassName from "../_internal/mergeClassName.mjs";
|
|
3
|
+
import applyGap from "../_internal/applyGap.mjs";
|
|
4
|
+
import applyItemRatio from "../_internal/applyItemRatio.mjs";
|
|
5
|
+
import applyItemSize from "../_internal/applyItemSize.mjs";
|
|
6
|
+
import maybeDefault from "@fringeworks/utils/object/maybeDefault";
|
|
7
|
+
|
|
8
|
+
//#region src/balance/balance.ts
|
|
9
|
+
/**
|
|
10
|
+
* balanceレイアウト
|
|
11
|
+
*
|
|
12
|
+
* - 子要素を均等に配置する
|
|
13
|
+
* - `adjust`が効いていない場合は、子要素のサイズを維持したまま、余白を均等に配分する
|
|
14
|
+
* - `adjust`が効いている場合は、子要素のサイズを調整してコンテナを満たす
|
|
15
|
+
*/
|
|
16
|
+
const balance = (options = {}) => {
|
|
17
|
+
const { direction, alignX, alignY, adjustX, adjustY, gap, gapX, gapY, itemSizeX, itemSizeY, itemRatioX, itemRatioY } = maybeDefault(options, {
|
|
18
|
+
direction: "x",
|
|
19
|
+
alignX: "left",
|
|
20
|
+
alignY: "top",
|
|
21
|
+
adjustX: "none",
|
|
22
|
+
adjustY: "none"
|
|
23
|
+
}, { overwriteNull: true });
|
|
24
|
+
const result = {
|
|
25
|
+
className: mergeClassName(clsLayoutBalance, clsLayout.direction[direction], clsLayout.align.x[alignX], clsLayout.align.y[alignY], clsLayout.adjust.x[adjustX], clsLayout.adjust.y[adjustY]),
|
|
26
|
+
style: {}
|
|
27
|
+
};
|
|
28
|
+
applyGap(result, gap, gapX, gapY);
|
|
29
|
+
applyItemSize(result, itemSizeX, itemSizeY);
|
|
30
|
+
applyItemRatio(result, itemRatioX, itemRatioY);
|
|
31
|
+
return result;
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
//#endregion
|
|
35
|
+
export { balance as default };
|