@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,10 @@
|
|
|
1
|
+
import _default from "./extractBalanceOptions.cjs";
|
|
2
|
+
import _default$1 from "./extractCenterOptions.cjs";
|
|
3
|
+
import _default$2 from "./extractFlowOptions.cjs";
|
|
4
|
+
import _default$3 from "./extractLayerOptions.cjs";
|
|
5
|
+
import _default$4 from "./extractMatrixOptions.cjs";
|
|
6
|
+
import _default$5 from "./extractPackOptions.cjs";
|
|
7
|
+
import _default$6 from "./extractPinOptions.cjs";
|
|
8
|
+
import _default$7 from "./extractStackOptions.cjs";
|
|
9
|
+
import _default$8 from "./extractTileOptions.cjs";
|
|
10
|
+
export { _default as extractBalanceOptions, _default$1 as extractCenterOptions, _default$2 as extractFlowOptions, _default$3 as extractLayerOptions, _default$4 as extractMatrixOptions, _default$5 as extractPackOptions, _default$6 as extractPinOptions, _default$7 as extractStackOptions, _default$8 as extractTileOptions };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import _default from "./extractBalanceOptions.mjs";
|
|
2
|
+
import _default$1 from "./extractCenterOptions.mjs";
|
|
3
|
+
import _default$2 from "./extractFlowOptions.mjs";
|
|
4
|
+
import _default$3 from "./extractLayerOptions.mjs";
|
|
5
|
+
import _default$4 from "./extractMatrixOptions.mjs";
|
|
6
|
+
import _default$5 from "./extractPackOptions.mjs";
|
|
7
|
+
import _default$6 from "./extractPinOptions.mjs";
|
|
8
|
+
import _default$7 from "./extractStackOptions.mjs";
|
|
9
|
+
import _default$8 from "./extractTileOptions.mjs";
|
|
10
|
+
export { _default as extractBalanceOptions, _default$1 as extractCenterOptions, _default$2 as extractFlowOptions, _default$3 as extractLayerOptions, _default$4 as extractMatrixOptions, _default$5 as extractPackOptions, _default$6 as extractPinOptions, _default$7 as extractStackOptions, _default$8 as extractTileOptions };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import extractBalanceOptions_default from "./extractBalanceOptions.mjs";
|
|
2
|
+
import extractCenterOptions_default from "./extractCenterOptions.mjs";
|
|
3
|
+
import extractFlowOptions_default from "./extractFlowOptions.mjs";
|
|
4
|
+
import extractLayerOptions_default from "./extractLayerOptions.mjs";
|
|
5
|
+
import extractMatrixOptions_default from "./extractMatrixOptions.mjs";
|
|
6
|
+
import extractPackOptions_default from "./extractPackOptions.mjs";
|
|
7
|
+
import extractPinOptions_default from "./extractPinOptions.mjs";
|
|
8
|
+
import extractStackOptions_default from "./extractStackOptions.mjs";
|
|
9
|
+
import extractTileOptions_default from "./extractTileOptions.mjs";
|
|
10
|
+
|
|
11
|
+
export { extractBalanceOptions_default as extractBalanceOptions, extractCenterOptions_default as extractCenterOptions, extractFlowOptions_default as extractFlowOptions, extractLayerOptions_default as extractLayerOptions, extractMatrixOptions_default as extractMatrixOptions, extractPackOptions_default as extractPackOptions, extractPinOptions_default as extractPinOptions, extractStackOptions_default as extractStackOptions, extractTileOptions_default as extractTileOptions };
|
package/index.cjs
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
const require_balance_balance = require('./balance/balance.cjs');
|
|
3
|
+
const require_center_center = require('./center/center.cjs');
|
|
4
|
+
const require_flow_flow = require('./flow/flow.cjs');
|
|
5
|
+
const require_layer_layer = require('./layer/layer.cjs');
|
|
6
|
+
const require_matrix_matrix = require('./matrix/matrix.cjs');
|
|
7
|
+
const require_pack_pack = require('./pack/pack.cjs');
|
|
8
|
+
const require_pin_pin = require('./pin/pin.cjs');
|
|
9
|
+
const require_stack_stack = require('./stack/stack.cjs');
|
|
10
|
+
const require_tile_tile = require('./tile/tile.cjs');
|
|
11
|
+
|
|
12
|
+
exports.balance = require_balance_balance;
|
|
13
|
+
exports.center = require_center_center;
|
|
14
|
+
exports.flow = require_flow_flow;
|
|
15
|
+
exports.layer = require_layer_layer;
|
|
16
|
+
exports.matrix = require_matrix_matrix;
|
|
17
|
+
exports.pack = require_pack_pack;
|
|
18
|
+
exports.pin = require_pin_pin;
|
|
19
|
+
exports.stack = require_stack_stack;
|
|
20
|
+
exports.tile = require_tile_tile;
|
package/index.d.cts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { CreateLayoutStyle, LayoutStyle } from "./types.cjs";
|
|
2
|
+
import { BalanceLayoutOptions } from "./balance/types.cjs";
|
|
3
|
+
import balance from "./balance/balance.cjs";
|
|
4
|
+
import { CenterLayoutOptions } from "./center/types.cjs";
|
|
5
|
+
import center from "./center/center.cjs";
|
|
6
|
+
import { FlowLayoutOptions } from "./flow/types.cjs";
|
|
7
|
+
import flow from "./flow/flow.cjs";
|
|
8
|
+
import { LayerLayoutOptions } from "./layer/types.cjs";
|
|
9
|
+
import { MatrixLayoutOptions } from "./matrix/types.cjs";
|
|
10
|
+
import { PackLayoutOptions } from "./pack/types.cjs";
|
|
11
|
+
import { PinLayoutOptions } from "./pin/types.cjs";
|
|
12
|
+
import { StackLayoutOptions } from "./stack/types.cjs";
|
|
13
|
+
import { TileLayoutOptions } from "./tile/types.cjs";
|
|
14
|
+
import layer from "./layer/layer.cjs";
|
|
15
|
+
import matrix from "./matrix/matrix.cjs";
|
|
16
|
+
import pack from "./pack/pack.cjs";
|
|
17
|
+
import pin from "./pin/pin.cjs";
|
|
18
|
+
import stack from "./stack/stack.cjs";
|
|
19
|
+
import tile from "./tile/tile.cjs";
|
|
20
|
+
export { type BalanceLayoutOptions, type CenterLayoutOptions, type CreateLayoutStyle, type FlowLayoutOptions, type LayerLayoutOptions, type LayoutStyle, type MatrixLayoutOptions, type PackLayoutOptions, type PinLayoutOptions, type StackLayoutOptions, type TileLayoutOptions, balance, center, flow, layer, matrix, pack, pin, stack, tile };
|
package/index.d.mts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { CreateLayoutStyle, LayoutStyle } from "./types.mjs";
|
|
2
|
+
import { BalanceLayoutOptions } from "./balance/types.mjs";
|
|
3
|
+
import balance from "./balance/balance.mjs";
|
|
4
|
+
import { CenterLayoutOptions } from "./center/types.mjs";
|
|
5
|
+
import center from "./center/center.mjs";
|
|
6
|
+
import { FlowLayoutOptions } from "./flow/types.mjs";
|
|
7
|
+
import flow from "./flow/flow.mjs";
|
|
8
|
+
import { LayerLayoutOptions } from "./layer/types.mjs";
|
|
9
|
+
import { MatrixLayoutOptions } from "./matrix/types.mjs";
|
|
10
|
+
import { PackLayoutOptions } from "./pack/types.mjs";
|
|
11
|
+
import { PinLayoutOptions } from "./pin/types.mjs";
|
|
12
|
+
import { StackLayoutOptions } from "./stack/types.mjs";
|
|
13
|
+
import { TileLayoutOptions } from "./tile/types.mjs";
|
|
14
|
+
import layer from "./layer/layer.mjs";
|
|
15
|
+
import matrix from "./matrix/matrix.mjs";
|
|
16
|
+
import pack from "./pack/pack.mjs";
|
|
17
|
+
import pin from "./pin/pin.mjs";
|
|
18
|
+
import stack from "./stack/stack.mjs";
|
|
19
|
+
import tile from "./tile/tile.mjs";
|
|
20
|
+
export { type BalanceLayoutOptions, type CenterLayoutOptions, type CreateLayoutStyle, type FlowLayoutOptions, type LayerLayoutOptions, type LayoutStyle, type MatrixLayoutOptions, type PackLayoutOptions, type PinLayoutOptions, type StackLayoutOptions, type TileLayoutOptions, balance, center, flow, layer, matrix, pack, pin, stack, tile };
|
package/index.mjs
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import balance from "./balance/balance.mjs";
|
|
2
|
+
import center from "./center/center.mjs";
|
|
3
|
+
import flow from "./flow/flow.mjs";
|
|
4
|
+
import layer from "./layer/layer.mjs";
|
|
5
|
+
import matrix from "./matrix/matrix.mjs";
|
|
6
|
+
import pack from "./pack/pack.mjs";
|
|
7
|
+
import pin from "./pin/pin.mjs";
|
|
8
|
+
import stack from "./stack/stack.mjs";
|
|
9
|
+
import tile from "./tile/tile.mjs";
|
|
10
|
+
|
|
11
|
+
export { balance, center, flow, layer, matrix, pack, pin, stack, tile };
|
package/layer/index.cjs
ADDED
package/layer/index.mjs
ADDED
package/layer/layer.cjs
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
|
|
2
|
+
const require__constants = require('../_constants.cjs');
|
|
3
|
+
const require__internal_mergeClassName = require('../_internal/mergeClassName.cjs');
|
|
4
|
+
const require__internal_applyItemRatio = require('../_internal/applyItemRatio.cjs');
|
|
5
|
+
const require__internal_applyItemSize = require('../_internal/applyItemSize.cjs');
|
|
6
|
+
let _fringeworks_utils_object_maybeDefault = require("@fringeworks/utils/object/maybeDefault");
|
|
7
|
+
_fringeworks_utils_object_maybeDefault = require_runtime.__toESM(_fringeworks_utils_object_maybeDefault, 1);
|
|
8
|
+
|
|
9
|
+
//#region src/layer/layer.ts
|
|
10
|
+
/**
|
|
11
|
+
* layerレイアウト
|
|
12
|
+
*
|
|
13
|
+
* - 子要素を重ねて配置する
|
|
14
|
+
* - alignX / alignY で重なる位置を制御する
|
|
15
|
+
* - 子要素の重なり順はDOM順に従う
|
|
16
|
+
*/
|
|
17
|
+
const layer = (options = {}) => {
|
|
18
|
+
const { alignX, alignY, adjustX, adjustY, itemSizeX, itemSizeY, itemRatioX, itemRatioY } = (0, _fringeworks_utils_object_maybeDefault.default)(options, {
|
|
19
|
+
alignX: "left",
|
|
20
|
+
alignY: "top",
|
|
21
|
+
adjustX: "none",
|
|
22
|
+
adjustY: "none"
|
|
23
|
+
}, { overwriteNull: true });
|
|
24
|
+
const result = {
|
|
25
|
+
className: require__internal_mergeClassName(require__constants.clsLayoutLayer, require__constants.clsLayout.align.x[alignX], require__constants.clsLayout.align.y[alignY], require__constants.clsLayout.adjust.x[adjustX], require__constants.clsLayout.adjust.y[adjustY]),
|
|
26
|
+
style: {}
|
|
27
|
+
};
|
|
28
|
+
require__internal_applyItemSize(result, itemSizeX, itemSizeY);
|
|
29
|
+
require__internal_applyItemRatio(result, itemRatioX, itemRatioY);
|
|
30
|
+
return result;
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
//#endregion
|
|
34
|
+
module.exports = layer;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { CreateLayoutStyle } from "../types.cjs";
|
|
2
|
+
import { LayerLayoutOptions } from "./types.cjs";
|
|
3
|
+
|
|
4
|
+
//#region src/layer/layer.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* layerレイアウト
|
|
7
|
+
*
|
|
8
|
+
* - 子要素を重ねて配置する
|
|
9
|
+
* - alignX / alignY で重なる位置を制御する
|
|
10
|
+
* - 子要素の重なり順はDOM順に従う
|
|
11
|
+
*/
|
|
12
|
+
declare const layer: CreateLayoutStyle<LayerLayoutOptions>;
|
|
13
|
+
export = layer;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { CreateLayoutStyle } from "../types.mjs";
|
|
2
|
+
import { LayerLayoutOptions } from "./types.mjs";
|
|
3
|
+
|
|
4
|
+
//#region src/layer/layer.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* layerレイアウト
|
|
7
|
+
*
|
|
8
|
+
* - 子要素を重ねて配置する
|
|
9
|
+
* - alignX / alignY で重なる位置を制御する
|
|
10
|
+
* - 子要素の重なり順はDOM順に従う
|
|
11
|
+
*/
|
|
12
|
+
declare const layer: CreateLayoutStyle<LayerLayoutOptions>;
|
|
13
|
+
//#endregion
|
|
14
|
+
export { layer as default };
|
package/layer/layer.mjs
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { clsLayout, clsLayoutLayer } from "../_constants.mjs";
|
|
2
|
+
import mergeClassName from "../_internal/mergeClassName.mjs";
|
|
3
|
+
import applyItemRatio from "../_internal/applyItemRatio.mjs";
|
|
4
|
+
import applyItemSize from "../_internal/applyItemSize.mjs";
|
|
5
|
+
import maybeDefault from "@fringeworks/utils/object/maybeDefault";
|
|
6
|
+
|
|
7
|
+
//#region src/layer/layer.ts
|
|
8
|
+
/**
|
|
9
|
+
* layerレイアウト
|
|
10
|
+
*
|
|
11
|
+
* - 子要素を重ねて配置する
|
|
12
|
+
* - alignX / alignY で重なる位置を制御する
|
|
13
|
+
* - 子要素の重なり順はDOM順に従う
|
|
14
|
+
*/
|
|
15
|
+
const layer = (options = {}) => {
|
|
16
|
+
const { alignX, alignY, adjustX, adjustY, itemSizeX, itemSizeY, itemRatioX, itemRatioY } = maybeDefault(options, {
|
|
17
|
+
alignX: "left",
|
|
18
|
+
alignY: "top",
|
|
19
|
+
adjustX: "none",
|
|
20
|
+
adjustY: "none"
|
|
21
|
+
}, { overwriteNull: true });
|
|
22
|
+
const result = {
|
|
23
|
+
className: mergeClassName(clsLayoutLayer, clsLayout.align.x[alignX], clsLayout.align.y[alignY], clsLayout.adjust.x[adjustX], clsLayout.adjust.y[adjustY]),
|
|
24
|
+
style: {}
|
|
25
|
+
};
|
|
26
|
+
applyItemSize(result, itemSizeX, itemSizeY);
|
|
27
|
+
applyItemRatio(result, itemRatioX, itemRatioY);
|
|
28
|
+
return result;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
//#endregion
|
|
32
|
+
export { layer as default };
|
package/layer/styles.css
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
.lx-layout-layer {
|
|
2
|
+
--lx-layout-itemSizeX: auto;
|
|
3
|
+
--lx-layout-itemSizeY: auto;
|
|
4
|
+
--lx-layout-itemRatio: auto;
|
|
5
|
+
display: grid;
|
|
6
|
+
}
|
|
7
|
+
.lx-layout-layer > * {
|
|
8
|
+
grid-area: 1/1;
|
|
9
|
+
}
|
|
10
|
+
.lx-layout-layer.lx-layout-alignX-left > * {
|
|
11
|
+
justify-self: start;
|
|
12
|
+
}
|
|
13
|
+
.lx-layout-layer.lx-layout-alignX-center > * {
|
|
14
|
+
justify-self: center;
|
|
15
|
+
}
|
|
16
|
+
.lx-layout-layer.lx-layout-alignX-right > * {
|
|
17
|
+
justify-self: end;
|
|
18
|
+
}
|
|
19
|
+
.lx-layout-layer.lx-layout-alignY-top > * {
|
|
20
|
+
align-self: start;
|
|
21
|
+
}
|
|
22
|
+
.lx-layout-layer.lx-layout-alignY-middle > * {
|
|
23
|
+
align-self: center;
|
|
24
|
+
}
|
|
25
|
+
.lx-layout-layer.lx-layout-alignY-bottom > * {
|
|
26
|
+
align-self: end;
|
|
27
|
+
}
|
|
28
|
+
.lx-layout-layer.lx-layout-itemSizeX > * {
|
|
29
|
+
width: var(--lx-layout-itemSizeX);
|
|
30
|
+
}
|
|
31
|
+
.lx-layout-layer.lx-layout-itemSizeY > * {
|
|
32
|
+
height: var(--lx-layout-itemSizeY);
|
|
33
|
+
}
|
|
34
|
+
.lx-layout-layer.lx-layout-adjustX-fit > *, .lx-layout-layer.lx-layout-adjustX-grow > * {
|
|
35
|
+
justify-self: stretch;
|
|
36
|
+
width: auto;
|
|
37
|
+
}
|
|
38
|
+
.lx-layout-layer.lx-layout-adjustX-grow > * {
|
|
39
|
+
min-width: var(--lx-layout-itemSizeX);
|
|
40
|
+
}
|
|
41
|
+
.lx-layout-layer.lx-layout-adjustX-shrink > * {
|
|
42
|
+
width: clamp(0px, 100%, var(--lx-layout-itemSizeX));
|
|
43
|
+
}
|
|
44
|
+
.lx-layout-layer.lx-layout-adjustY-fit > *, .lx-layout-layer.lx-layout-adjustY-grow > * {
|
|
45
|
+
align-self: stretch;
|
|
46
|
+
height: auto;
|
|
47
|
+
}
|
|
48
|
+
.lx-layout-layer.lx-layout-adjustY-grow > * {
|
|
49
|
+
min-height: var(--lx-layout-itemSizeY);
|
|
50
|
+
}
|
|
51
|
+
.lx-layout-layer.lx-layout-adjustY-shrink > * {
|
|
52
|
+
height: clamp(0px, 100%, var(--lx-layout-itemSizeY));
|
|
53
|
+
}
|
|
54
|
+
.lx-layout-layer.lx-layout-itemRatio > * {
|
|
55
|
+
aspect-ratio: var(--lx-layout-itemRatio);
|
|
56
|
+
}
|
package/layer/types.cjs
ADDED
|
File without changes
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { AlignXBase, AlignYBase } from "../constants.cjs";
|
|
2
|
+
import { AdjustOptions, ItemRatioOptions, ItemSizeOptions } from "../_types.cjs";
|
|
3
|
+
|
|
4
|
+
//#region src/layer/types.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* layerのオプション
|
|
7
|
+
*/
|
|
8
|
+
type LayerLayoutOptions = AdjustOptions & ItemSizeOptions & ItemRatioOptions & {
|
|
9
|
+
alignX?: AlignXBase;
|
|
10
|
+
alignY?: AlignYBase;
|
|
11
|
+
};
|
|
12
|
+
//#endregion
|
|
13
|
+
export { LayerLayoutOptions };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { AlignXBase, AlignYBase } from "../constants.mjs";
|
|
2
|
+
import { AdjustOptions, ItemRatioOptions, ItemSizeOptions } from "../_types.mjs";
|
|
3
|
+
|
|
4
|
+
//#region src/layer/types.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* layerのオプション
|
|
7
|
+
*/
|
|
8
|
+
type LayerLayoutOptions = AdjustOptions & ItemSizeOptions & ItemRatioOptions & {
|
|
9
|
+
alignX?: AlignXBase;
|
|
10
|
+
alignY?: AlignYBase;
|
|
11
|
+
};
|
|
12
|
+
//#endregion
|
|
13
|
+
export { LayerLayoutOptions };
|
package/layer/types.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
package/matrix/index.cjs
ADDED
package/matrix/index.mjs
ADDED
|
@@ -0,0 +1,110 @@
|
|
|
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_unit = require('../_internal/unit.cjs');
|
|
5
|
+
const require__internal_applyGap = require('../_internal/applyGap.cjs');
|
|
6
|
+
const require__internal_applyItemRatio = require('../_internal/applyItemRatio.cjs');
|
|
7
|
+
const require__internal_applyItemSize = require('../_internal/applyItemSize.cjs');
|
|
8
|
+
const require__internal_mergeLayoutResults = require('../_internal/mergeLayoutResults.cjs');
|
|
9
|
+
const require__internal_applyItemCount = require('../_internal/applyItemCount.cjs');
|
|
10
|
+
let _fringeworks_utils_object_maybeDefault = require("@fringeworks/utils/object/maybeDefault");
|
|
11
|
+
_fringeworks_utils_object_maybeDefault = require_runtime.__toESM(_fringeworks_utils_object_maybeDefault, 1);
|
|
12
|
+
|
|
13
|
+
//#region src/matrix/matrix.ts
|
|
14
|
+
/**
|
|
15
|
+
* matrixレイアウト
|
|
16
|
+
*
|
|
17
|
+
* - 子要素の縦の数、横の数を基準にして格子状に配置する
|
|
18
|
+
* - 親要素のサイズが子要素に依存していないことを前提とする
|
|
19
|
+
*/
|
|
20
|
+
const matrix = (options = {
|
|
21
|
+
itemCountX: 8,
|
|
22
|
+
itemCountY: 8
|
|
23
|
+
}) => {
|
|
24
|
+
const { direction, alignX, alignY, adjustX, adjustY, gap, gapX, gapY, itemSizeX, itemSizeY, itemRatioX, itemRatioY, itemCountX, itemCountY, tracksX, tracksY } = (0, _fringeworks_utils_object_maybeDefault.default)(options, {
|
|
25
|
+
direction: "x",
|
|
26
|
+
alignX: "left",
|
|
27
|
+
alignY: "top",
|
|
28
|
+
adjustX: "none",
|
|
29
|
+
adjustY: "none"
|
|
30
|
+
}, { overwriteNull: true });
|
|
31
|
+
let result = {
|
|
32
|
+
className: require__internal_mergeClassName(require__constants.clsLayoutMatrix, 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]),
|
|
33
|
+
style: {}
|
|
34
|
+
};
|
|
35
|
+
require__internal_applyGap(result, gap, gapX, gapY);
|
|
36
|
+
require__internal_applyItemRatio(result, itemRatioX, itemRatioY);
|
|
37
|
+
let sizeX;
|
|
38
|
+
let sizeY;
|
|
39
|
+
let countX;
|
|
40
|
+
let countY;
|
|
41
|
+
let trxX;
|
|
42
|
+
let trxY;
|
|
43
|
+
if (Array.isArray(tracksX)) trxX = tracksX;
|
|
44
|
+
else {
|
|
45
|
+
sizeX = itemSizeX;
|
|
46
|
+
countX = itemCountX;
|
|
47
|
+
}
|
|
48
|
+
if (Array.isArray(tracksY)) trxY = tracksY;
|
|
49
|
+
else {
|
|
50
|
+
sizeY = itemSizeY;
|
|
51
|
+
countY = itemCountY;
|
|
52
|
+
}
|
|
53
|
+
require__internal_applyItemSize(result, sizeX, sizeY);
|
|
54
|
+
require__internal_applyItemCount(result, countX, countY);
|
|
55
|
+
if (trxX) result = require__internal_mergeLayoutResults([result, _getTemplate("x", adjustX, trxX)]);
|
|
56
|
+
if (trxY) result = require__internal_mergeLayoutResults([result, _getTemplate("y", adjustY, trxY)]);
|
|
57
|
+
return result;
|
|
58
|
+
};
|
|
59
|
+
/**
|
|
60
|
+
* gridTemplateColumns / gridTemplateRowsを生成する
|
|
61
|
+
* @param axis 軸
|
|
62
|
+
* @param adjust 子要素のサイズ調整
|
|
63
|
+
* @param tracks 子要素数 & サイズ
|
|
64
|
+
* @returns
|
|
65
|
+
*/
|
|
66
|
+
function _getTemplate(axis, adjust, tracks) {
|
|
67
|
+
const pxTotal = tracks.reduce((sum, value) => {
|
|
68
|
+
const px = _extractPx(value);
|
|
69
|
+
return px !== null ? sum + px : sum;
|
|
70
|
+
}, 0);
|
|
71
|
+
const template = tracks.map((value) => _applyAdjustToTrack(axis, adjust, value, tracks.length, pxTotal)).join(" ");
|
|
72
|
+
return {
|
|
73
|
+
className: require__constants.clsLayout.template[axis],
|
|
74
|
+
style: { [require__constants.varLayout.template[axis]]: template }
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* tracksX/tracksYの各トラック値にadjustを適用する
|
|
79
|
+
* fr単位の値はminmax()のminに使えないため特別扱いになり、
|
|
80
|
+
* 伸縮の比率には影響しない
|
|
81
|
+
*/
|
|
82
|
+
function _applyAdjustToTrack(axis, adjust, size, itemCount, pxTotal) {
|
|
83
|
+
const itemSize = require__internal_unit(size);
|
|
84
|
+
const isFr = typeof size === "string" && size.trim().endsWith("fr");
|
|
85
|
+
const pxValue = _extractPx(size);
|
|
86
|
+
const isPx = pxValue !== null;
|
|
87
|
+
if (adjust === "fit") {
|
|
88
|
+
if (isPx && pxTotal > 0) return `minmax(0, max(${`calc((100% - var(${require__constants.varLayout.gap[axis]}) * ${itemCount - 1}) * ${pxValue} / ${pxTotal})`}, ${itemSize}))`;
|
|
89
|
+
return isFr ? itemSize : `minmax(0, ${itemSize})`;
|
|
90
|
+
} else if (adjust === "grow") {
|
|
91
|
+
if (isPx && pxTotal > 0) return `minmax(${itemSize}, calc(${pxValue} / ${pxTotal} * (100% - var(${require__constants.varLayout.gap[axis]}) * ${itemCount - 1})))`;
|
|
92
|
+
return isFr ? itemSize : `minmax(${itemSize}, 1fr)`;
|
|
93
|
+
} else if (adjust === "shrink") {
|
|
94
|
+
if (isPx && pxTotal > 0) return `minmax(0, min(${`calc((100% - var(${require__constants.varLayout.gap[axis]}) * ${itemCount - 1}) * ${pxValue} / ${pxTotal})`}, ${itemSize}))`;
|
|
95
|
+
return isFr ? itemSize : `minmax(0, ${itemSize})`;
|
|
96
|
+
}
|
|
97
|
+
return itemSize;
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* px値を数値として抽出する
|
|
101
|
+
* px以外の単位はnullを返す
|
|
102
|
+
*/
|
|
103
|
+
function _extractPx(itemSize) {
|
|
104
|
+
if (typeof itemSize === "number") return itemSize;
|
|
105
|
+
const match = itemSize.trim().match(/^([\d.]+)px$/);
|
|
106
|
+
return match ? parseFloat(match[1]) : null;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
//#endregion
|
|
110
|
+
module.exports = matrix;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { CreateLayoutStyle } from "../types.cjs";
|
|
2
|
+
import { MatrixLayoutOptions } from "./types.cjs";
|
|
3
|
+
|
|
4
|
+
//#region src/matrix/matrix.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* matrixレイアウト
|
|
7
|
+
*
|
|
8
|
+
* - 子要素の縦の数、横の数を基準にして格子状に配置する
|
|
9
|
+
* - 親要素のサイズが子要素に依存していないことを前提とする
|
|
10
|
+
*/
|
|
11
|
+
declare const matrix: CreateLayoutStyle<MatrixLayoutOptions>;
|
|
12
|
+
export = matrix;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { CreateLayoutStyle } from "../types.mjs";
|
|
2
|
+
import { MatrixLayoutOptions } from "./types.mjs";
|
|
3
|
+
|
|
4
|
+
//#region src/matrix/matrix.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* matrixレイアウト
|
|
7
|
+
*
|
|
8
|
+
* - 子要素の縦の数、横の数を基準にして格子状に配置する
|
|
9
|
+
* - 親要素のサイズが子要素に依存していないことを前提とする
|
|
10
|
+
*/
|
|
11
|
+
declare const matrix: CreateLayoutStyle<MatrixLayoutOptions>;
|
|
12
|
+
//#endregion
|
|
13
|
+
export { matrix as default };
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { clsLayout, clsLayoutMatrix, varLayout } from "../_constants.mjs";
|
|
2
|
+
import mergeClassName from "../_internal/mergeClassName.mjs";
|
|
3
|
+
import unit from "../_internal/unit.mjs";
|
|
4
|
+
import applyGap from "../_internal/applyGap.mjs";
|
|
5
|
+
import applyItemRatio from "../_internal/applyItemRatio.mjs";
|
|
6
|
+
import applyItemSize from "../_internal/applyItemSize.mjs";
|
|
7
|
+
import mergeLayoutResults from "../_internal/mergeLayoutResults.mjs";
|
|
8
|
+
import applyItemCount from "../_internal/applyItemCount.mjs";
|
|
9
|
+
import maybeDefault from "@fringeworks/utils/object/maybeDefault";
|
|
10
|
+
|
|
11
|
+
//#region src/matrix/matrix.ts
|
|
12
|
+
/**
|
|
13
|
+
* matrixレイアウト
|
|
14
|
+
*
|
|
15
|
+
* - 子要素の縦の数、横の数を基準にして格子状に配置する
|
|
16
|
+
* - 親要素のサイズが子要素に依存していないことを前提とする
|
|
17
|
+
*/
|
|
18
|
+
const matrix = (options = {
|
|
19
|
+
itemCountX: 8,
|
|
20
|
+
itemCountY: 8
|
|
21
|
+
}) => {
|
|
22
|
+
const { direction, alignX, alignY, adjustX, adjustY, gap, gapX, gapY, itemSizeX, itemSizeY, itemRatioX, itemRatioY, itemCountX, itemCountY, tracksX, tracksY } = maybeDefault(options, {
|
|
23
|
+
direction: "x",
|
|
24
|
+
alignX: "left",
|
|
25
|
+
alignY: "top",
|
|
26
|
+
adjustX: "none",
|
|
27
|
+
adjustY: "none"
|
|
28
|
+
}, { overwriteNull: true });
|
|
29
|
+
let result = {
|
|
30
|
+
className: mergeClassName(clsLayoutMatrix, clsLayout.direction[direction], clsLayout.align.x[alignX], clsLayout.align.y[alignY], clsLayout.adjust.x[adjustX], clsLayout.adjust.y[adjustY]),
|
|
31
|
+
style: {}
|
|
32
|
+
};
|
|
33
|
+
applyGap(result, gap, gapX, gapY);
|
|
34
|
+
applyItemRatio(result, itemRatioX, itemRatioY);
|
|
35
|
+
let sizeX;
|
|
36
|
+
let sizeY;
|
|
37
|
+
let countX;
|
|
38
|
+
let countY;
|
|
39
|
+
let trxX;
|
|
40
|
+
let trxY;
|
|
41
|
+
if (Array.isArray(tracksX)) trxX = tracksX;
|
|
42
|
+
else {
|
|
43
|
+
sizeX = itemSizeX;
|
|
44
|
+
countX = itemCountX;
|
|
45
|
+
}
|
|
46
|
+
if (Array.isArray(tracksY)) trxY = tracksY;
|
|
47
|
+
else {
|
|
48
|
+
sizeY = itemSizeY;
|
|
49
|
+
countY = itemCountY;
|
|
50
|
+
}
|
|
51
|
+
applyItemSize(result, sizeX, sizeY);
|
|
52
|
+
applyItemCount(result, countX, countY);
|
|
53
|
+
if (trxX) result = mergeLayoutResults([result, _getTemplate("x", adjustX, trxX)]);
|
|
54
|
+
if (trxY) result = mergeLayoutResults([result, _getTemplate("y", adjustY, trxY)]);
|
|
55
|
+
return result;
|
|
56
|
+
};
|
|
57
|
+
/**
|
|
58
|
+
* gridTemplateColumns / gridTemplateRowsを生成する
|
|
59
|
+
* @param axis 軸
|
|
60
|
+
* @param adjust 子要素のサイズ調整
|
|
61
|
+
* @param tracks 子要素数 & サイズ
|
|
62
|
+
* @returns
|
|
63
|
+
*/
|
|
64
|
+
function _getTemplate(axis, adjust, tracks) {
|
|
65
|
+
const pxTotal = tracks.reduce((sum, value) => {
|
|
66
|
+
const px = _extractPx(value);
|
|
67
|
+
return px !== null ? sum + px : sum;
|
|
68
|
+
}, 0);
|
|
69
|
+
const template = tracks.map((value) => _applyAdjustToTrack(axis, adjust, value, tracks.length, pxTotal)).join(" ");
|
|
70
|
+
return {
|
|
71
|
+
className: clsLayout.template[axis],
|
|
72
|
+
style: { [varLayout.template[axis]]: template }
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* tracksX/tracksYの各トラック値にadjustを適用する
|
|
77
|
+
* fr単位の値はminmax()のminに使えないため特別扱いになり、
|
|
78
|
+
* 伸縮の比率には影響しない
|
|
79
|
+
*/
|
|
80
|
+
function _applyAdjustToTrack(axis, adjust, size, itemCount, pxTotal) {
|
|
81
|
+
const itemSize = unit(size);
|
|
82
|
+
const isFr = typeof size === "string" && size.trim().endsWith("fr");
|
|
83
|
+
const pxValue = _extractPx(size);
|
|
84
|
+
const isPx = pxValue !== null;
|
|
85
|
+
if (adjust === "fit") {
|
|
86
|
+
if (isPx && pxTotal > 0) return `minmax(0, max(${`calc((100% - var(${varLayout.gap[axis]}) * ${itemCount - 1}) * ${pxValue} / ${pxTotal})`}, ${itemSize}))`;
|
|
87
|
+
return isFr ? itemSize : `minmax(0, ${itemSize})`;
|
|
88
|
+
} else if (adjust === "grow") {
|
|
89
|
+
if (isPx && pxTotal > 0) return `minmax(${itemSize}, calc(${pxValue} / ${pxTotal} * (100% - var(${varLayout.gap[axis]}) * ${itemCount - 1})))`;
|
|
90
|
+
return isFr ? itemSize : `minmax(${itemSize}, 1fr)`;
|
|
91
|
+
} else if (adjust === "shrink") {
|
|
92
|
+
if (isPx && pxTotal > 0) return `minmax(0, min(${`calc((100% - var(${varLayout.gap[axis]}) * ${itemCount - 1}) * ${pxValue} / ${pxTotal})`}, ${itemSize}))`;
|
|
93
|
+
return isFr ? itemSize : `minmax(0, ${itemSize})`;
|
|
94
|
+
}
|
|
95
|
+
return itemSize;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* px値を数値として抽出する
|
|
99
|
+
* px以外の単位はnullを返す
|
|
100
|
+
*/
|
|
101
|
+
function _extractPx(itemSize) {
|
|
102
|
+
if (typeof itemSize === "number") return itemSize;
|
|
103
|
+
const match = itemSize.trim().match(/^([\d.]+)px$/);
|
|
104
|
+
return match ? parseFloat(match[1]) : null;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
//#endregion
|
|
108
|
+
export { matrix as default };
|