@niche-works/css-layouts 0.1.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.md +3 -0
- package/_constants.cjs +94 -0
- package/_constants.d.cts +83 -0
- package/_constants.d.mts +83 -0
- package/_constants.mjs +86 -0
- package/_helpers/applyChildCount.cjs +26 -0
- package/_helpers/applyChildCount.d.cts +12 -0
- package/_helpers/applyChildCount.d.mts +13 -0
- package/_helpers/applyChildCount.mjs +24 -0
- package/_helpers/applyChildSize.cjs +27 -0
- package/_helpers/applyChildSize.d.cts +12 -0
- package/_helpers/applyChildSize.d.mts +13 -0
- package/_helpers/applyChildSize.mjs +25 -0
- package/_helpers/applySpacing.cjs +30 -0
- package/_helpers/applySpacing.d.cts +13 -0
- package/_helpers/applySpacing.d.mts +14 -0
- package/_helpers/applySpacing.mjs +28 -0
- package/_helpers/hasValue.cjs +15 -0
- package/_helpers/hasValue.d.cts +8 -0
- package/_helpers/hasValue.d.mts +9 -0
- package/_helpers/hasValue.mjs +14 -0
- package/_helpers/mergeLayoutResults.cjs +18 -0
- package/_helpers/mergeLayoutResults.d.cts +5 -0
- package/_helpers/mergeLayoutResults.d.mts +6 -0
- package/_helpers/mergeLayoutResults.mjs +16 -0
- package/_helpers/unit.cjs +16 -0
- package/_helpers/unit.d.cts +10 -0
- package/_helpers/unit.d.mts +11 -0
- package/_helpers/unit.mjs +15 -0
- package/_types.cjs +0 -0
- package/_types.d.cts +118 -0
- package/_types.d.mts +118 -0
- package/_types.mjs +1 -0
- package/_virtual/_rolldown/runtime.cjs +29 -0
- package/balance/balance.cjs +34 -0
- package/balance/balance.d.cts +11 -0
- package/balance/balance.d.mts +12 -0
- package/balance/balance.mjs +31 -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 +109 -0
- package/balance/types.cjs +0 -0
- package/balance/types.d.cts +6 -0
- package/balance/types.d.mts +6 -0
- package/balance/types.mjs +1 -0
- package/constants.cjs +341 -0
- package/constants.d.cts +299 -0
- package/constants.d.mts +299 -0
- package/constants.mjs +288 -0
- package/flow/flow.cjs +70 -0
- package/flow/flow.d.cts +12 -0
- package/flow/flow.d.mts +13 -0
- package/flow/flow.mjs +67 -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 +162 -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/index.cjs +23 -0
- package/index.d.cts +16 -0
- package/index.d.mts +16 -0
- package/index.mjs +16 -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 +109 -0
- package/matrix/matrix.d.cts +11 -0
- package/matrix/matrix.d.mts +12 -0
- package/matrix/matrix.mjs +106 -0
- package/matrix/styles.css +59 -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 +28 -0
- package/pack/pack.d.cts +11 -0
- package/pack/pack.d.mts +12 -0
- package/pack/pack.mjs +25 -0
- package/pack/styles.css +27 -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 +45 -0
- 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 +22 -0
- package/pin/pin.d.cts +11 -0
- package/pin/pin.d.mts +12 -0
- package/pin/pin.mjs +22 -0
- package/pin/styles.css +15 -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 +98 -0
- package/stack/stack.d.cts +11 -0
- package/stack/stack.d.mts +12 -0
- package/stack/stack.mjs +95 -0
- package/stack/styles.css +171 -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/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 +104 -0
- package/tile/tile.cjs +85 -0
- package/tile/tile.d.cts +12 -0
- package/tile/tile.d.mts +13 -0
- package/tile/tile.mjs +82 -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 +23 -0
- package/types.d.mts +23 -0
- package/types.mjs +1 -0
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
.nws-layout-matrix {
|
|
2
|
+
--nws-layout-childX: none;
|
|
3
|
+
--nws-layout-childY: none;
|
|
4
|
+
--nws-layout-spacingX: 0px;
|
|
5
|
+
--nws-layout-spacingY: 0px;
|
|
6
|
+
display: grid;
|
|
7
|
+
}
|
|
8
|
+
.nws-layout-matrix.nws-layout-spacingX {
|
|
9
|
+
column-gap: var(--nws-layout-spacingX);
|
|
10
|
+
}
|
|
11
|
+
.nws-layout-matrix.nws-layout-spacingY {
|
|
12
|
+
row-gap: var(--nws-layout-spacingY);
|
|
13
|
+
}
|
|
14
|
+
.nws-layout-matrix.nws-layout-direction-x {
|
|
15
|
+
grid-auto-flow: row;
|
|
16
|
+
grid-template-columns: var(--nws-layout-childX);
|
|
17
|
+
grid-template-rows: var(--nws-layout-childY);
|
|
18
|
+
}
|
|
19
|
+
.nws-layout-matrix.nws-layout-direction-y {
|
|
20
|
+
grid-auto-flow: column;
|
|
21
|
+
grid-template-columns: var(--nws-layout-childX);
|
|
22
|
+
grid-template-rows: var(--nws-layout-childY);
|
|
23
|
+
}
|
|
24
|
+
.nws-layout-matrix.nws-layout-alignX-left {
|
|
25
|
+
justify-content: flex-start;
|
|
26
|
+
}
|
|
27
|
+
.nws-layout-matrix.nws-layout-alignX-center {
|
|
28
|
+
justify-content: center;
|
|
29
|
+
}
|
|
30
|
+
.nws-layout-matrix.nws-layout-alignX-right {
|
|
31
|
+
justify-content: flex-end;
|
|
32
|
+
}
|
|
33
|
+
.nws-layout-matrix.nws-layout-alignX-spaceBetween {
|
|
34
|
+
justify-content: space-between;
|
|
35
|
+
}
|
|
36
|
+
.nws-layout-matrix.nws-layout-alignX-spaceAround {
|
|
37
|
+
justify-content: space-around;
|
|
38
|
+
}
|
|
39
|
+
.nws-layout-matrix.nws-layout-alignX-spaceEvenly {
|
|
40
|
+
justify-content: space-evenly;
|
|
41
|
+
}
|
|
42
|
+
.nws-layout-matrix.nws-layout-alignY-top {
|
|
43
|
+
align-content: flex-start;
|
|
44
|
+
}
|
|
45
|
+
.nws-layout-matrix.nws-layout-alignY-middle {
|
|
46
|
+
align-content: center;
|
|
47
|
+
}
|
|
48
|
+
.nws-layout-matrix.nws-layout-alignY-bottom {
|
|
49
|
+
align-content: flex-end;
|
|
50
|
+
}
|
|
51
|
+
.nws-layout-matrix.nws-layout-alignY-spaceBetween {
|
|
52
|
+
align-content: space-between;
|
|
53
|
+
}
|
|
54
|
+
.nws-layout-matrix.nws-layout-alignY-spaceAround {
|
|
55
|
+
align-content: space-around;
|
|
56
|
+
}
|
|
57
|
+
.nws-layout-matrix.nws-layout-alignY-spaceEvenly {
|
|
58
|
+
align-content: space-evenly;
|
|
59
|
+
}
|
package/matrix/types.cjs
ADDED
|
File without changes
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { AdjustOptions, AlignOptions, ChildCountOptions, ChildOptions, ChildSizeOptions, DirectionOptions, SpacingOptions } from "../_types.cjs";
|
|
2
|
+
|
|
3
|
+
//#region src/matrix/types.d.ts
|
|
4
|
+
type MatrixLayoutOptions = AdjustOptions & AlignOptions & DirectionOptions & MatrixAxisXOptions & MatrixAxisYOptions & SpacingOptions;
|
|
5
|
+
/**
|
|
6
|
+
* 横軸、要素数指定
|
|
7
|
+
*/
|
|
8
|
+
type MatrixAxisXWithCountOptions = {
|
|
9
|
+
childCountX: ChildCountOptions['childCountX'];
|
|
10
|
+
childSizeX?: ChildSizeOptions['childSizeX'];
|
|
11
|
+
childX?: never;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* 横軸、テンプレート指定
|
|
15
|
+
*/
|
|
16
|
+
type MatrixAxisXWithTemplateOptions = {
|
|
17
|
+
childCountX?: never;
|
|
18
|
+
childSizeX?: never;
|
|
19
|
+
chilsX: ChildOptions['childX'];
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* 横軸用オプション
|
|
23
|
+
*/
|
|
24
|
+
type MatrixAxisXOptions = MatrixAxisXWithCountOptions | MatrixAxisXWithTemplateOptions;
|
|
25
|
+
/**
|
|
26
|
+
* 縦軸、要素数指定
|
|
27
|
+
*/
|
|
28
|
+
type MatrixAxisYWithCountOptions = {
|
|
29
|
+
childCountY: ChildCountOptions['childCountY'];
|
|
30
|
+
childSizeY?: ChildSizeOptions['childSizeY'];
|
|
31
|
+
childY?: never;
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* 縦軸、テンプレート指定
|
|
35
|
+
*/
|
|
36
|
+
type MatrixAxisYWithTemplateOptions = {
|
|
37
|
+
childCountY?: never;
|
|
38
|
+
childSizeY?: never;
|
|
39
|
+
childY: ChildOptions['childY'];
|
|
40
|
+
};
|
|
41
|
+
/**
|
|
42
|
+
* 縦軸用オプション
|
|
43
|
+
*/
|
|
44
|
+
type MatrixAxisYOptions = MatrixAxisYWithCountOptions | MatrixAxisYWithTemplateOptions;
|
|
45
|
+
//#endregion
|
|
46
|
+
export { MatrixLayoutOptions };
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { AdjustOptions, AlignOptions, ChildCountOptions, ChildOptions, ChildSizeOptions, DirectionOptions, SpacingOptions } from "../_types.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/matrix/types.d.ts
|
|
4
|
+
type MatrixLayoutOptions = AdjustOptions & AlignOptions & DirectionOptions & MatrixAxisXOptions & MatrixAxisYOptions & SpacingOptions;
|
|
5
|
+
/**
|
|
6
|
+
* 横軸、要素数指定
|
|
7
|
+
*/
|
|
8
|
+
type MatrixAxisXWithCountOptions = {
|
|
9
|
+
childCountX: ChildCountOptions['childCountX'];
|
|
10
|
+
childSizeX?: ChildSizeOptions['childSizeX'];
|
|
11
|
+
childX?: never;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* 横軸、テンプレート指定
|
|
15
|
+
*/
|
|
16
|
+
type MatrixAxisXWithTemplateOptions = {
|
|
17
|
+
childCountX?: never;
|
|
18
|
+
childSizeX?: never;
|
|
19
|
+
chilsX: ChildOptions['childX'];
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* 横軸用オプション
|
|
23
|
+
*/
|
|
24
|
+
type MatrixAxisXOptions = MatrixAxisXWithCountOptions | MatrixAxisXWithTemplateOptions;
|
|
25
|
+
/**
|
|
26
|
+
* 縦軸、要素数指定
|
|
27
|
+
*/
|
|
28
|
+
type MatrixAxisYWithCountOptions = {
|
|
29
|
+
childCountY: ChildCountOptions['childCountY'];
|
|
30
|
+
childSizeY?: ChildSizeOptions['childSizeY'];
|
|
31
|
+
childY?: never;
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* 縦軸、テンプレート指定
|
|
35
|
+
*/
|
|
36
|
+
type MatrixAxisYWithTemplateOptions = {
|
|
37
|
+
childCountY?: never;
|
|
38
|
+
childSizeY?: never;
|
|
39
|
+
childY: ChildOptions['childY'];
|
|
40
|
+
};
|
|
41
|
+
/**
|
|
42
|
+
* 縦軸用オプション
|
|
43
|
+
*/
|
|
44
|
+
type MatrixAxisYOptions = MatrixAxisYWithCountOptions | MatrixAxisYWithTemplateOptions;
|
|
45
|
+
//#endregion
|
|
46
|
+
export { MatrixLayoutOptions };
|
package/matrix/types.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
package/pack/index.cjs
ADDED
package/pack/index.d.cts
ADDED
package/pack/index.d.mts
ADDED
package/pack/index.mjs
ADDED
package/pack/pack.cjs
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
|
|
2
|
+
const require_constants = require('../constants.cjs');
|
|
3
|
+
const require__constants = require('../_constants.cjs');
|
|
4
|
+
const require__helpers_applySpacing = require('../_helpers/applySpacing.cjs');
|
|
5
|
+
require('./styles.cjs');
|
|
6
|
+
let _niche_works_utils_object_maybeDefault = require("@niche-works/utils/object/maybeDefault");
|
|
7
|
+
_niche_works_utils_object_maybeDefault = require_runtime.__toESM(_niche_works_utils_object_maybeDefault, 1);
|
|
8
|
+
let clsx = require("clsx");
|
|
9
|
+
clsx = require_runtime.__toESM(clsx, 1);
|
|
10
|
+
|
|
11
|
+
//#region src/pack/pack.ts
|
|
12
|
+
/**
|
|
13
|
+
* packレイアウト
|
|
14
|
+
*
|
|
15
|
+
* - 子要素で親要素を満たす
|
|
16
|
+
*/
|
|
17
|
+
const pack = (options = {}) => {
|
|
18
|
+
const { direction, spacing, spacingX, spacingY } = (0, _niche_works_utils_object_maybeDefault.default)(options, { direction: "x" }, { overwriteNull: true });
|
|
19
|
+
const result = {
|
|
20
|
+
className: (0, clsx.default)(require_constants.clsLayoutPack, require__constants.clsLayoutDirection[direction]),
|
|
21
|
+
style: {}
|
|
22
|
+
};
|
|
23
|
+
require__helpers_applySpacing(result, spacing, spacingX, spacingY);
|
|
24
|
+
return result;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
//#endregion
|
|
28
|
+
module.exports = pack;
|
package/pack/pack.d.cts
ADDED
package/pack/pack.d.mts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { CreateLayout } from "../types.mjs";
|
|
2
|
+
import { PackLayoutOptions } from "./types.mjs";
|
|
3
|
+
|
|
4
|
+
//#region src/pack/pack.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* packレイアウト
|
|
7
|
+
*
|
|
8
|
+
* - 子要素で親要素を満たす
|
|
9
|
+
*/
|
|
10
|
+
declare const pack: CreateLayout<PackLayoutOptions>;
|
|
11
|
+
//#endregion
|
|
12
|
+
export { pack as default };
|
package/pack/pack.mjs
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { clsLayoutPack } from "../constants.mjs";
|
|
2
|
+
import { clsLayoutDirection } from "../_constants.mjs";
|
|
3
|
+
import applySpacing from "../_helpers/applySpacing.mjs";
|
|
4
|
+
import "./styles.css";
|
|
5
|
+
import maybeDefault from "@niche-works/utils/object/maybeDefault";
|
|
6
|
+
import clsx from "clsx";
|
|
7
|
+
|
|
8
|
+
//#region src/pack/pack.ts
|
|
9
|
+
/**
|
|
10
|
+
* packレイアウト
|
|
11
|
+
*
|
|
12
|
+
* - 子要素で親要素を満たす
|
|
13
|
+
*/
|
|
14
|
+
const pack = (options = {}) => {
|
|
15
|
+
const { direction, spacing, spacingX, spacingY } = maybeDefault(options, { direction: "x" }, { overwriteNull: true });
|
|
16
|
+
const result = {
|
|
17
|
+
className: clsx(clsLayoutPack, clsLayoutDirection[direction]),
|
|
18
|
+
style: {}
|
|
19
|
+
};
|
|
20
|
+
applySpacing(result, spacing, spacingX, spacingY);
|
|
21
|
+
return result;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
//#endregion
|
|
25
|
+
export { pack as default };
|
package/pack/styles.css
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
.nws-layout-pack {
|
|
2
|
+
--nws-layout-spacingX: 0px;
|
|
3
|
+
--nws-layout-spacingY: 0px;
|
|
4
|
+
display: grid;
|
|
5
|
+
}
|
|
6
|
+
.nws-layout-pack.nws-layout-spacingX {
|
|
7
|
+
column-gap: var(--nws-layout-spacingX);
|
|
8
|
+
}
|
|
9
|
+
.nws-layout-pack.nws-layout-spacingY {
|
|
10
|
+
row-gap: var(--nws-layout-spacingY);
|
|
11
|
+
}
|
|
12
|
+
.nws-layout-pack.nws-layout-direction-x {
|
|
13
|
+
grid-auto-flow: column;
|
|
14
|
+
grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
|
|
15
|
+
grid-template-rows: auto;
|
|
16
|
+
}
|
|
17
|
+
.nws-layout-pack.nws-layout-direction-y {
|
|
18
|
+
grid-auto-flow: row;
|
|
19
|
+
grid-template-columns: auto;
|
|
20
|
+
grid-template-rows: repeat(auto-fit, minmax(0, 1fr));
|
|
21
|
+
}
|
|
22
|
+
.nws-layout-pack > * {
|
|
23
|
+
height: auto;
|
|
24
|
+
width: auto;
|
|
25
|
+
min-height: 0;
|
|
26
|
+
min-width: 0;
|
|
27
|
+
}
|
package/pack/types.cjs
ADDED
|
File without changes
|
package/pack/types.d.cts
ADDED
package/pack/types.d.mts
ADDED
package/pack/types.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
package/package.json
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@niche-works/css-layouts",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"keywords": [
|
|
5
|
+
"css",
|
|
6
|
+
"style",
|
|
7
|
+
"layout"
|
|
8
|
+
],
|
|
9
|
+
"repository": {
|
|
10
|
+
"type": "git",
|
|
11
|
+
"url": "https://github.com/mitsuhiroseino/niche-works-css-layouts.git"
|
|
12
|
+
},
|
|
13
|
+
"license": "MIT",
|
|
14
|
+
"author": "Mitsuhiro Seino",
|
|
15
|
+
"sideEffects": [
|
|
16
|
+
"**/*.css"
|
|
17
|
+
],
|
|
18
|
+
"type": "module",
|
|
19
|
+
"exports": {
|
|
20
|
+
".": {
|
|
21
|
+
"import": "./index.mjs",
|
|
22
|
+
"require": "./index.cjs"
|
|
23
|
+
},
|
|
24
|
+
"./*": {
|
|
25
|
+
"import": "./*/index.mjs",
|
|
26
|
+
"require": "./*/index.cjs"
|
|
27
|
+
},
|
|
28
|
+
"./constants": {
|
|
29
|
+
"import": "./constants.mjs",
|
|
30
|
+
"require": "./constants.cjs"
|
|
31
|
+
},
|
|
32
|
+
"./*/constants": {
|
|
33
|
+
"import": "./*/constants.mjs",
|
|
34
|
+
"require": "./*/constants.cjs"
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
"main": "./index.cjs",
|
|
38
|
+
"module": "./index.mjs",
|
|
39
|
+
"dependencies": {
|
|
40
|
+
"@niche-works/types": "^0.3.1",
|
|
41
|
+
"@niche-works/utils": "^0.4.0",
|
|
42
|
+
"clsx": "^2.1.1",
|
|
43
|
+
"csstype": "^3.2.3"
|
|
44
|
+
}
|
|
45
|
+
}
|
package/pin/index.cjs
ADDED
package/pin/index.d.cts
ADDED
package/pin/index.d.mts
ADDED
package/pin/index.mjs
ADDED
package/pin/pin.cjs
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
const require_constants = require('../constants.cjs');
|
|
2
|
+
const require__helpers_applyChildSize = require('../_helpers/applyChildSize.cjs');
|
|
3
|
+
require('./styles.cjs');
|
|
4
|
+
|
|
5
|
+
//#region src/pin/pin.ts
|
|
6
|
+
/**
|
|
7
|
+
* pinレイアウト
|
|
8
|
+
*
|
|
9
|
+
* - 子要素のtop,left,bottom,rightに従い配置する
|
|
10
|
+
*/
|
|
11
|
+
const pin = (options = {}) => {
|
|
12
|
+
const { childSizeX, childSizeY } = options;
|
|
13
|
+
const result = {
|
|
14
|
+
className: require_constants.clsLayoutPin,
|
|
15
|
+
style: {}
|
|
16
|
+
};
|
|
17
|
+
require__helpers_applyChildSize(result, childSizeX, childSizeY);
|
|
18
|
+
return result;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
//#endregion
|
|
22
|
+
module.exports = pin;
|
package/pin/pin.d.cts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { CreateLayout } from "../types.cjs";
|
|
2
|
+
import { PinLayoutOptions } from "./types.cjs";
|
|
3
|
+
|
|
4
|
+
//#region src/pin/pin.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* pinレイアウト
|
|
7
|
+
*
|
|
8
|
+
* - 子要素のtop,left,bottom,rightに従い配置する
|
|
9
|
+
*/
|
|
10
|
+
declare const pin: CreateLayout<PinLayoutOptions>;
|
|
11
|
+
export = pin;
|
package/pin/pin.d.mts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { CreateLayout } from "../types.mjs";
|
|
2
|
+
import { PinLayoutOptions } from "./types.mjs";
|
|
3
|
+
|
|
4
|
+
//#region src/pin/pin.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* pinレイアウト
|
|
7
|
+
*
|
|
8
|
+
* - 子要素のtop,left,bottom,rightに従い配置する
|
|
9
|
+
*/
|
|
10
|
+
declare const pin: CreateLayout<PinLayoutOptions>;
|
|
11
|
+
//#endregion
|
|
12
|
+
export { pin as default };
|
package/pin/pin.mjs
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { clsLayoutPin } from "../constants.mjs";
|
|
2
|
+
import applyChildSize from "../_helpers/applyChildSize.mjs";
|
|
3
|
+
import "./styles.css";
|
|
4
|
+
|
|
5
|
+
//#region src/pin/pin.ts
|
|
6
|
+
/**
|
|
7
|
+
* pinレイアウト
|
|
8
|
+
*
|
|
9
|
+
* - 子要素のtop,left,bottom,rightに従い配置する
|
|
10
|
+
*/
|
|
11
|
+
const pin = (options = {}) => {
|
|
12
|
+
const { childSizeX, childSizeY } = options;
|
|
13
|
+
const result = {
|
|
14
|
+
className: clsLayoutPin,
|
|
15
|
+
style: {}
|
|
16
|
+
};
|
|
17
|
+
applyChildSize(result, childSizeX, childSizeY);
|
|
18
|
+
return result;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
//#endregion
|
|
22
|
+
export { pin as default };
|
package/pin/styles.css
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
.nws-layout-pin {
|
|
2
|
+
--nws-layout-childSizeX: auto;
|
|
3
|
+
--nws-layout-childSizeY: auto;
|
|
4
|
+
display: block;
|
|
5
|
+
position: relative;
|
|
6
|
+
}
|
|
7
|
+
.nws-layout-pin > * {
|
|
8
|
+
position: absolute;
|
|
9
|
+
}
|
|
10
|
+
.nws-layout-pin.nws-layout-childSizeX > * {
|
|
11
|
+
width: var(--nws-layout-childSizeX);
|
|
12
|
+
}
|
|
13
|
+
.nws-layout-pin.nws-layout-childSizeY > * {
|
|
14
|
+
height: var(--nws-layout-childSizeY);
|
|
15
|
+
}
|
package/pin/types.cjs
ADDED
|
File without changes
|
package/pin/types.d.cts
ADDED
package/pin/types.d.mts
ADDED
package/pin/types.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
package/stack/index.cjs
ADDED
package/stack/index.mjs
ADDED
package/stack/stack.cjs
ADDED
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
|
|
2
|
+
const require_constants = require('../constants.cjs');
|
|
3
|
+
const require__constants = require('../_constants.cjs');
|
|
4
|
+
const require__helpers_hasValue = require('../_helpers/hasValue.cjs');
|
|
5
|
+
const require__helpers_unit = require('../_helpers/unit.cjs');
|
|
6
|
+
const require__helpers_applySpacing = require('../_helpers/applySpacing.cjs');
|
|
7
|
+
const require__helpers_mergeLayoutResults = require('../_helpers/mergeLayoutResults.cjs');
|
|
8
|
+
require('./styles.cjs');
|
|
9
|
+
let _niche_works_utils_object_maybeDefault = require("@niche-works/utils/object/maybeDefault");
|
|
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
|
+
|
|
14
|
+
//#region src/stack/stack.ts
|
|
15
|
+
/**
|
|
16
|
+
* stackレイアウト
|
|
17
|
+
*
|
|
18
|
+
* - 子要素を並べて配置する
|
|
19
|
+
*/
|
|
20
|
+
const stack = (options = {}) => {
|
|
21
|
+
const { direction, alignX, alignY, adjustX, adjustY, spacing, spacingX = spacing, spacingY = spacing, childSizeX, childSizeY } = (0, _niche_works_utils_object_maybeDefault.default)(options, {
|
|
22
|
+
direction: "x",
|
|
23
|
+
alignX: "left",
|
|
24
|
+
alignY: "top"
|
|
25
|
+
}, { overwriteNull: true });
|
|
26
|
+
const result = {
|
|
27
|
+
className: (0, clsx.default)(require_constants.clsLayoutStack, require__constants.clsLayoutDirection[direction], require__constants.clsLayoutAlign.x[alignX], require__constants.clsLayoutAlign.y[alignY]),
|
|
28
|
+
style: {}
|
|
29
|
+
};
|
|
30
|
+
require__helpers_applySpacing(result, spacing, spacingX, spacingY);
|
|
31
|
+
const resultList = [result];
|
|
32
|
+
if (direction === "x") {
|
|
33
|
+
resultList.push(_getStackMainAxisStyle("x", alignX, adjustX, childSizeX));
|
|
34
|
+
resultList.push(_getStackClossAxisStyle("y", alignY, adjustY, childSizeY));
|
|
35
|
+
} else {
|
|
36
|
+
resultList.push(_getStackClossAxisStyle("x", alignX, adjustX, childSizeX));
|
|
37
|
+
resultList.push(_getStackMainAxisStyle("y", alignY, adjustY, childSizeY));
|
|
38
|
+
}
|
|
39
|
+
return require__helpers_mergeLayoutResults(resultList);
|
|
40
|
+
};
|
|
41
|
+
/**
|
|
42
|
+
* 主軸方向のスタイル
|
|
43
|
+
* @param axis 横 or 縦
|
|
44
|
+
* @param align 位置
|
|
45
|
+
* @param adjust 子要素のサイズの調整
|
|
46
|
+
* @param childSize 子要素のサイズ
|
|
47
|
+
* @returns スタイル
|
|
48
|
+
*/
|
|
49
|
+
function _getStackMainAxisStyle(axis, align, adjust, childSize) {
|
|
50
|
+
const result = { className: (0, clsx.default)(require__constants.clsLayoutAlign[axis][align], require__constants.clsLayoutAdjust[axis][adjust]) };
|
|
51
|
+
if (require__helpers_hasValue(childSize)) {
|
|
52
|
+
result.className = (0, clsx.default)(result.className, require__constants.clsLayoutChildSize[axis]);
|
|
53
|
+
result.style = { [require__constants.varLayoutChildSize[axis]]: require__helpers_unit(childSize) };
|
|
54
|
+
}
|
|
55
|
+
return result;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* 交差軸方向のクラス
|
|
59
|
+
* @param axis 横 or 縦
|
|
60
|
+
* @param align 位置
|
|
61
|
+
* @param adjust 子要素のサイズの調整
|
|
62
|
+
* @param childSize 子要素のサイズ
|
|
63
|
+
* @returns スタイル
|
|
64
|
+
*/
|
|
65
|
+
function _getStackClossAxisStyle(axis, align, adjust, childSize) {
|
|
66
|
+
if (adjust === "fit") return {
|
|
67
|
+
className: (0, clsx.default)(require__constants.clsLayoutAlign[axis][align], require__constants.clsLayoutAdjust[axis][adjust]),
|
|
68
|
+
style: {
|
|
69
|
+
[`min-${require__constants.cssLayoutAxisSizeProp[axis]}`]: "100%",
|
|
70
|
+
[require__constants.varLayoutChildSize[axis]]: `min(0, 100%)`
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
else if (adjust === "grow") {
|
|
74
|
+
const result = {
|
|
75
|
+
className: (0, clsx.default)(require__constants.clsLayoutAlign[axis][align], require__constants.clsLayoutAdjust[axis][adjust]),
|
|
76
|
+
style: { [`min-${require__constants.cssLayoutAxisSizeProp[axis]}`]: "100%" }
|
|
77
|
+
};
|
|
78
|
+
if (require__helpers_hasValue(childSize)) {
|
|
79
|
+
result.className = (0, clsx.default)(result.className, require__constants.clsLayoutChildSize[axis]);
|
|
80
|
+
result.style[require__constants.varLayoutChildSize[axis]] = require__helpers_unit(childSize);
|
|
81
|
+
}
|
|
82
|
+
return result;
|
|
83
|
+
} else if (adjust === "shrink") {
|
|
84
|
+
const result = { className: (0, clsx.default)(require__constants.clsLayoutAlign[axis][align], require__constants.clsLayoutAdjust[axis][adjust]) };
|
|
85
|
+
if (require__helpers_hasValue(childSize)) {
|
|
86
|
+
result.className = (0, clsx.default)(result.className, require__constants.clsLayoutChildSize[axis]);
|
|
87
|
+
result.style = { [require__constants.varLayoutChildSize[axis]]: `min(${require__helpers_unit(childSize)}, 100%)` };
|
|
88
|
+
}
|
|
89
|
+
return result;
|
|
90
|
+
} else if (require__helpers_hasValue(childSize)) return {
|
|
91
|
+
className: (0, clsx.default)(require__constants.clsLayoutAlign[axis][align], require__constants.clsLayoutChildSize[axis]),
|
|
92
|
+
style: { [require__constants.varLayoutChildSize[axis]]: require__helpers_unit(childSize) }
|
|
93
|
+
};
|
|
94
|
+
else return { className: (0, clsx.default)(require__constants.clsLayoutAlign[axis][align]) };
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
//#endregion
|
|
98
|
+
module.exports = stack;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { CreateLayout } from "../types.mjs";
|
|
2
|
+
import { StackLayoutOptions } from "./types.mjs";
|
|
3
|
+
|
|
4
|
+
//#region src/stack/stack.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* stackレイアウト
|
|
7
|
+
*
|
|
8
|
+
* - 子要素を並べて配置する
|
|
9
|
+
*/
|
|
10
|
+
declare const stack: CreateLayout<StackLayoutOptions>;
|
|
11
|
+
//#endregion
|
|
12
|
+
export { stack as default };
|