@niche-works/style-layouts 0.3.1 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (139) hide show
  1. package/README.ja.md +3 -3
  2. package/README.md +6 -6
  3. package/balance/index.cjs +6 -2
  4. package/balance/index.mjs +6 -2
  5. package/center/index.cjs +6 -2
  6. package/center/index.mjs +6 -2
  7. package/constants.cjs +1 -50
  8. package/constants.d.cts +2 -2
  9. package/constants.d.mts +2 -2
  10. package/constants.mjs +2 -2
  11. package/core/_constants.cjs +287 -34
  12. package/core/_constants.d.cts +206 -1
  13. package/core/_constants.d.mts +206 -1
  14. package/core/_constants.mjs +206 -3
  15. package/core/_internal/applyChildCount.cjs +6 -8
  16. package/core/_internal/applyChildCount.mjs +6 -6
  17. package/core/_internal/applyChildRatio.cjs +4 -6
  18. package/core/_internal/applyChildRatio.mjs +3 -3
  19. package/core/_internal/applyChildSize.cjs +6 -8
  20. package/core/_internal/applyChildSize.mjs +4 -4
  21. package/core/_internal/applyGap.cjs +6 -8
  22. package/core/_internal/applyGap.mjs +4 -4
  23. package/core/_internal/mergeClassName.cjs +11 -0
  24. package/core/_internal/mergeClassName.d.cts +3 -0
  25. package/core/_internal/mergeClassName.d.mts +4 -0
  26. package/core/_internal/mergeClassName.mjs +10 -0
  27. package/core/_internal/mergeLayoutResults.cjs +2 -4
  28. package/core/_internal/mergeLayoutResults.mjs +2 -2
  29. package/core/_types.d.cts +1 -9
  30. package/core/_types.d.mts +1 -9
  31. package/core/balance/balance.cjs +4 -4
  32. package/core/balance/balance.d.cts +2 -0
  33. package/core/balance/balance.d.mts +2 -0
  34. package/core/balance/balance.mjs +5 -4
  35. package/core/balance/styles.css +32 -0
  36. package/core/center/center.cjs +3 -4
  37. package/core/center/center.d.cts +1 -0
  38. package/core/center/center.d.mts +1 -0
  39. package/core/center/center.mjs +4 -4
  40. package/core/constants.cjs +4 -255
  41. package/core/constants.d.cts +4 -206
  42. package/core/constants.d.mts +4 -206
  43. package/core/constants.mjs +4 -206
  44. package/core/flow/flow.cjs +5 -7
  45. package/core/flow/flow.mjs +6 -7
  46. package/core/index.d.cts +2 -2
  47. package/core/index.d.mts +2 -2
  48. package/core/layer/layer.cjs +2 -4
  49. package/core/layer/layer.mjs +3 -4
  50. package/core/matrix/matrix.cjs +3 -4
  51. package/core/matrix/matrix.d.cts +1 -0
  52. package/core/matrix/matrix.d.mts +1 -0
  53. package/core/matrix/matrix.mjs +4 -4
  54. package/core/pack/pack.cjs +2 -4
  55. package/core/pack/pack.mjs +3 -4
  56. package/core/pin/pin.cjs +2 -2
  57. package/core/pin/pin.mjs +1 -1
  58. package/core/stack/stack.cjs +12 -14
  59. package/core/stack/stack.d.cts +1 -1
  60. package/core/stack/stack.d.mts +1 -1
  61. package/core/stack/stack.mjs +13 -14
  62. package/core/styles.css +32 -0
  63. package/core/tile/tile.cjs +2 -4
  64. package/core/tile/tile.mjs +3 -4
  65. package/core/types.d.cts +7 -2
  66. package/core/types.d.mts +7 -2
  67. package/flow/index.cjs +6 -2
  68. package/flow/index.mjs +6 -2
  69. package/helpers/_internal/constants.cjs +25 -0
  70. package/helpers/_internal/constants.d.cts +13 -0
  71. package/helpers/_internal/constants.d.mts +13 -0
  72. package/helpers/_internal/constants.mjs +16 -0
  73. package/helpers/_internal/createExtractLayoutOptions.cjs +25 -0
  74. package/helpers/_internal/createExtractLayoutOptions.d.cts +8 -0
  75. package/helpers/_internal/createExtractLayoutOptions.d.mts +9 -0
  76. package/helpers/_internal/createExtractLayoutOptions.mjs +24 -0
  77. package/helpers/extractBalanceOptions.cjs +15 -0
  78. package/helpers/extractBalanceOptions.d.cts +5 -0
  79. package/helpers/extractBalanceOptions.d.mts +6 -0
  80. package/helpers/extractBalanceOptions.mjs +15 -0
  81. package/helpers/extractCenterOptions.cjs +14 -0
  82. package/helpers/extractCenterOptions.d.cts +6 -0
  83. package/helpers/extractCenterOptions.d.mts +7 -0
  84. package/helpers/extractCenterOptions.mjs +14 -0
  85. package/helpers/extractFlowOptions.cjs +15 -0
  86. package/helpers/extractFlowOptions.d.cts +6 -0
  87. package/helpers/extractFlowOptions.d.mts +7 -0
  88. package/helpers/extractFlowOptions.mjs +15 -0
  89. package/helpers/extractLayerOptions.cjs +13 -0
  90. package/helpers/extractLayerOptions.d.cts +6 -0
  91. package/helpers/extractLayerOptions.d.mts +7 -0
  92. package/helpers/extractLayerOptions.mjs +13 -0
  93. package/helpers/extractMatrixOptions.cjs +17 -0
  94. package/helpers/extractMatrixOptions.d.cts +5 -0
  95. package/helpers/extractMatrixOptions.d.mts +6 -0
  96. package/helpers/extractMatrixOptions.mjs +17 -0
  97. package/helpers/extractPackOptions.cjs +8 -0
  98. package/helpers/extractPackOptions.d.cts +6 -0
  99. package/helpers/extractPackOptions.d.mts +7 -0
  100. package/helpers/extractPackOptions.mjs +8 -0
  101. package/helpers/extractPinOptions.cjs +8 -0
  102. package/helpers/extractPinOptions.d.cts +6 -0
  103. package/helpers/extractPinOptions.d.mts +7 -0
  104. package/helpers/extractPinOptions.mjs +8 -0
  105. package/helpers/extractStackOptions.cjs +15 -0
  106. package/helpers/extractStackOptions.d.cts +6 -0
  107. package/helpers/extractStackOptions.d.mts +7 -0
  108. package/helpers/extractStackOptions.mjs +15 -0
  109. package/helpers/extractTileOptions.cjs +15 -0
  110. package/helpers/extractTileOptions.d.cts +6 -0
  111. package/helpers/extractTileOptions.d.mts +7 -0
  112. package/helpers/extractTileOptions.mjs +15 -0
  113. package/helpers/index.cjs +20 -0
  114. package/helpers/index.d.cts +10 -0
  115. package/helpers/index.d.mts +10 -0
  116. package/helpers/index.mjs +11 -0
  117. package/index.cjs +18 -18
  118. package/index.d.cts +2 -2
  119. package/index.d.mts +2 -2
  120. package/index.mjs +10 -10
  121. package/layer/index.cjs +6 -2
  122. package/layer/index.mjs +6 -2
  123. package/matrix/index.cjs +6 -2
  124. package/matrix/index.mjs +6 -2
  125. package/pack/index.cjs +6 -2
  126. package/pack/index.mjs +6 -2
  127. package/package.json +6 -4
  128. package/pin/index.cjs +6 -2
  129. package/pin/index.mjs +6 -2
  130. package/stack/index.cjs +6 -2
  131. package/stack/index.mjs +6 -2
  132. package/tile/index.cjs +6 -2
  133. package/tile/index.mjs +6 -2
  134. package/types.d.cts +2 -2
  135. package/types.d.mts +2 -2
  136. package/core/_internal/warnIfUnsupported.cjs +0 -15
  137. package/core/_internal/warnIfUnsupported.d.cts +0 -3
  138. package/core/_internal/warnIfUnsupported.d.mts +0 -4
  139. package/core/_internal/warnIfUnsupported.mjs +0 -14
@@ -1,18 +1,17 @@
1
- import { clsLayoutStack } from "../constants.mjs";
2
- import { clsLayout, varLayout } from "../_constants.mjs";
1
+ import { clsLayout, clsLayoutStack, varLayout } from "../_constants.mjs";
3
2
  import hasValue from "../_internal/hasValue.mjs";
3
+ import mergeClassName from "../_internal/mergeClassName.mjs";
4
4
  import applyChildRatio from "../_internal/applyChildRatio.mjs";
5
5
  import unit from "../_internal/unit.mjs";
6
6
  import applyGap from "../_internal/applyGap.mjs";
7
7
  import mergeLayoutResults from "../_internal/mergeLayoutResults.mjs";
8
8
  import maybeDefault from "@niche-works/utils/object/maybeDefault";
9
- import clsx from "clsx";
10
9
 
11
10
  //#region src/core/stack/stack.ts
12
11
  /**
13
12
  * stackレイアウト
14
13
  *
15
- * - 子要素を並べて配置する
14
+ * - 子要素を一列に並べて配置する
16
15
  */
17
16
  const stack = (options = {}) => {
18
17
  const { direction, alignX, alignY, adjustX, adjustY, gap, gapX = gap, gapY = gap, childSizeX, childSizeY, childRatioX, childRatioY } = maybeDefault(options, {
@@ -21,7 +20,7 @@ const stack = (options = {}) => {
21
20
  alignY: "top"
22
21
  }, { overwriteNull: true });
23
22
  const result = {
24
- className: clsx(clsLayoutStack, clsLayout.direction[direction], clsLayout.align.x[alignX], clsLayout.align.y[alignY]),
23
+ className: mergeClassName(clsLayoutStack, clsLayout.direction[direction], clsLayout.align.x[alignX], clsLayout.align.y[alignY]),
25
24
  style: {}
26
25
  };
27
26
  applyGap(result, gap, gapX, gapY);
@@ -45,9 +44,9 @@ const stack = (options = {}) => {
45
44
  * @returns スタイル
46
45
  */
47
46
  function _getStackMainAxisStyle(axis, align, adjust, childSize) {
48
- const result = { className: clsx(clsLayout.align[axis][align], clsLayout.adjust[axis][adjust]) };
47
+ const result = { className: mergeClassName(clsLayout.align[axis][align], clsLayout.adjust[axis][adjust]) };
49
48
  if (hasValue(childSize)) {
50
- result.className = clsx(result.className, clsLayout.childSize[axis]);
49
+ result.className = mergeClassName(result.className, clsLayout.childSize[axis]);
51
50
  result.style = { [varLayout.childSize[axis]]: unit(childSize) };
52
51
  }
53
52
  return result;
@@ -62,34 +61,34 @@ function _getStackMainAxisStyle(axis, align, adjust, childSize) {
62
61
  */
63
62
  function _getStackClossAxisStyle(axis, align, adjust, childSize) {
64
63
  if (adjust === "fit") return {
65
- className: clsx(clsLayout.align[axis][align], clsLayout.adjust[axis][adjust]),
64
+ className: mergeClassName(clsLayout.align[axis][align], clsLayout.adjust[axis][adjust]),
66
65
  style: { [varLayout.childSize[axis]]: `min(0, 100%)` }
67
66
  };
68
67
  else if (adjust === "grow") {
69
68
  const result = {
70
- className: clsx(clsLayout.align[axis][align], clsLayout.adjust[axis][adjust]),
69
+ className: mergeClassName(clsLayout.align[axis][align], clsLayout.adjust[axis][adjust]),
71
70
  style: {}
72
71
  };
73
72
  if (hasValue(childSize)) {
74
- result.className = clsx(result.className, clsLayout.childSize[axis]);
73
+ result.className = mergeClassName(result.className, clsLayout.childSize[axis]);
75
74
  result.style[varLayout.childSize[axis]] = unit(childSize);
76
75
  }
77
76
  return result;
78
77
  } else if (adjust === "shrink") {
79
78
  const result = {
80
- className: clsx(clsLayout.align[axis][align], clsLayout.adjust[axis][adjust]),
79
+ className: mergeClassName(clsLayout.align[axis][align], clsLayout.adjust[axis][adjust]),
81
80
  style: {}
82
81
  };
83
82
  if (hasValue(childSize)) {
84
- result.className = clsx(result.className, clsLayout.childSize[axis]);
83
+ result.className = mergeClassName(result.className, clsLayout.childSize[axis]);
85
84
  result.style = { [varLayout.childSize[axis]]: `min(${unit(childSize)}, 100%)` };
86
85
  }
87
86
  return result;
88
87
  } else if (hasValue(childSize)) return {
89
- className: clsx(clsLayout.align[axis][align], clsLayout.childSize[axis]),
88
+ className: mergeClassName(clsLayout.align[axis][align], clsLayout.childSize[axis]),
90
89
  style: { [varLayout.childSize[axis]]: unit(childSize) }
91
90
  };
92
- else return { className: clsx(clsLayout.align[axis][align]) };
91
+ else return { className: mergeClassName(clsLayout.align[axis][align]) };
93
92
  }
94
93
 
95
94
  //#endregion
package/core/styles.css CHANGED
@@ -925,9 +925,29 @@
925
925
  }
926
926
  .nws-layout-balance.nws-layout-direction-x {
927
927
  grid-auto-flow: column;
928
+ grid-auto-columns: max-content;
929
+ }
930
+ .nws-layout-balance.nws-layout-direction-x.nws-layout-adjustX-grow, .nws-layout-balance.nws-layout-direction-x.nws-layout-adjustX-fit {
931
+ grid-auto-columns: auto;
932
+ }
933
+ .nws-layout-balance.nws-layout-direction-x.nws-layout-adjustX-shrink {
934
+ grid-auto-columns: minmax(0, max-content);
935
+ }
936
+ .nws-layout-balance.nws-layout-direction-x.nws-layout-childSizeX {
937
+ grid-auto-columns: auto;
928
938
  }
929
939
  .nws-layout-balance.nws-layout-direction-y {
930
940
  grid-auto-flow: row;
941
+ grid-auto-rows: max-content;
942
+ }
943
+ .nws-layout-balance.nws-layout-direction-y.nws-layout-adjustY-grow, .nws-layout-balance.nws-layout-direction-y.nws-layout-adjustY-fit {
944
+ grid-auto-rows: auto;
945
+ }
946
+ .nws-layout-balance.nws-layout-direction-y.nws-layout-adjustY-shrink {
947
+ grid-auto-rows: minmax(0, max-content);
948
+ }
949
+ .nws-layout-balance.nws-layout-direction-y.nws-layout-childSizeY {
950
+ grid-auto-rows: auto;
931
951
  }
932
952
  .nws-layout-balance.nws-layout-alignX-left {
933
953
  justify-items: flex-start;
@@ -981,9 +1001,15 @@
981
1001
  .nws-layout-balance.nws-layout-adjustX-grow > *, .nws-layout-balance.nws-layout-adjustX-shrink > * {
982
1002
  width: 100%;
983
1003
  }
1004
+ .nws-layout-balance.nws-layout-adjustX-grow > * {
1005
+ min-width: max-content;
1006
+ }
984
1007
  .nws-layout-balance.nws-layout-adjustX-grow.nws-layout-childSizeX > * {
985
1008
  min-width: var(--nws-layout-childSizeX);
986
1009
  }
1010
+ .nws-layout-balance.nws-layout-adjustX-shrink > * {
1011
+ max-width: max-content;
1012
+ }
987
1013
  .nws-layout-balance.nws-layout-adjustX-shrink.nws-layout-childSizeX > * {
988
1014
  max-width: var(--nws-layout-childSizeX);
989
1015
  }
@@ -999,9 +1025,15 @@
999
1025
  .nws-layout-balance.nws-layout-adjustY-grow > *, .nws-layout-balance.nws-layout-adjustY-shrink > * {
1000
1026
  height: 100%;
1001
1027
  }
1028
+ .nws-layout-balance.nws-layout-adjustY-grow:not(.nws-layout-childSizeY) > * {
1029
+ min-height: max-content;
1030
+ }
1002
1031
  .nws-layout-balance.nws-layout-adjustY-grow.nws-layout-childSizeY > * {
1003
1032
  min-height: var(--nws-layout-childSizeY);
1004
1033
  }
1034
+ .nws-layout-balance.nws-layout-adjustY-shrink:not(.nws-layout-childSizeY) > * {
1035
+ max-height: max-content;
1036
+ }
1005
1037
  .nws-layout-balance.nws-layout-adjustY-shrink.nws-layout-childSizeY > * {
1006
1038
  max-height: var(--nws-layout-childSizeY);
1007
1039
  }
@@ -1,13 +1,11 @@
1
1
  const require_runtime = require('../../_virtual/_rolldown/runtime.cjs');
2
- const require_core_constants = require('../constants.cjs');
3
2
  const require_core__constants = require('../_constants.cjs');
3
+ const require_core__internal_mergeClassName = require('../_internal/mergeClassName.cjs');
4
4
  const require_core__internal_applyChildRatio = require('../_internal/applyChildRatio.cjs');
5
5
  const require_core__internal_applyChildSize = require('../_internal/applyChildSize.cjs');
6
6
  const require_core__internal_applyGap = require('../_internal/applyGap.cjs');
7
7
  let _niche_works_utils_object_maybeDefault = require("@niche-works/utils/object/maybeDefault");
8
8
  _niche_works_utils_object_maybeDefault = require_runtime.__toESM(_niche_works_utils_object_maybeDefault, 1);
9
- let clsx = require("clsx");
10
- clsx = require_runtime.__toESM(clsx, 1);
11
9
 
12
10
  //#region src/core/tile/tile.ts
13
11
  /**
@@ -23,7 +21,7 @@ const tile = (options = {}) => {
23
21
  alignY: "top"
24
22
  }, { overwriteNull: true });
25
23
  const result = {
26
- className: (0, clsx.default)(require_core_constants.clsLayoutTile, require_core__constants.clsLayout.direction[direction], require_core__constants.clsLayout.align.x[alignX], require_core__constants.clsLayout.align.y[alignY], require_core__constants.clsLayout.adjust.x[adjustX], require_core__constants.clsLayout.adjust.y[adjustY]),
24
+ className: require_core__internal_mergeClassName(require_core__constants.clsLayoutTile, require_core__constants.clsLayout.direction[direction], require_core__constants.clsLayout.align.x[alignX], require_core__constants.clsLayout.align.y[alignY], require_core__constants.clsLayout.adjust.x[adjustX], require_core__constants.clsLayout.adjust.y[adjustY]),
27
25
  style: {}
28
26
  };
29
27
  require_core__internal_applyGap(result, gap, gapX, gapY);
@@ -1,10 +1,9 @@
1
- import { clsLayoutTile } from "../constants.mjs";
2
- import { clsLayout } from "../_constants.mjs";
1
+ import { clsLayout, clsLayoutTile } from "../_constants.mjs";
2
+ import mergeClassName from "../_internal/mergeClassName.mjs";
3
3
  import applyChildRatio from "../_internal/applyChildRatio.mjs";
4
4
  import applyChildSize from "../_internal/applyChildSize.mjs";
5
5
  import applyGap from "../_internal/applyGap.mjs";
6
6
  import maybeDefault from "@niche-works/utils/object/maybeDefault";
7
- import clsx from "clsx";
8
7
 
9
8
  //#region src/core/tile/tile.ts
10
9
  /**
@@ -20,7 +19,7 @@ const tile = (options = {}) => {
20
19
  alignY: "top"
21
20
  }, { overwriteNull: true });
22
21
  const result = {
23
- className: clsx(clsLayoutTile, clsLayout.direction[direction], clsLayout.align.x[alignX], clsLayout.align.y[alignY], clsLayout.adjust.x[adjustX], clsLayout.adjust.y[adjustY]),
22
+ className: mergeClassName(clsLayoutTile, clsLayout.direction[direction], clsLayout.align.x[alignX], clsLayout.align.y[alignY], clsLayout.adjust.x[adjustX], clsLayout.adjust.y[adjustY]),
24
23
  style: {}
25
24
  };
26
25
  applyGap(result, gap, gapX, gapY);
package/core/types.d.cts CHANGED
@@ -1,4 +1,3 @@
1
- import { CSSCustomProperties } from "./_types.cjs";
2
1
  import { LooseDictionary } from "@niche-works/types";
3
2
 
4
3
  //#region src/core/types.d.ts
@@ -19,5 +18,11 @@ type StyleLayoutResult = {
19
18
  */
20
19
  style?: CSSCustomProperties;
21
20
  };
21
+ /**
22
+ * CSSカスタムプロパティ(変数)
23
+ */
24
+ type CSSCustomProperties = {
25
+ [key: `--${string}`]: string | undefined;
26
+ };
22
27
  //#endregion
23
- export { StyleLayout, StyleLayoutResult };
28
+ export { CSSCustomProperties, StyleLayout, StyleLayoutResult };
package/core/types.d.mts CHANGED
@@ -1,4 +1,3 @@
1
- import { CSSCustomProperties } from "./_types.mjs";
2
1
  import { LooseDictionary } from "@niche-works/types";
3
2
 
4
3
  //#region src/core/types.d.ts
@@ -19,5 +18,11 @@ type StyleLayoutResult = {
19
18
  */
20
19
  style?: CSSCustomProperties;
21
20
  };
21
+ /**
22
+ * CSSカスタムプロパティ(変数)
23
+ */
24
+ type CSSCustomProperties = {
25
+ [key: `--${string}`]: string | undefined;
26
+ };
22
27
  //#endregion
23
- export { StyleLayout, StyleLayoutResult };
28
+ export { CSSCustomProperties, StyleLayout, StyleLayoutResult };
package/flow/index.cjs CHANGED
@@ -1,4 +1,8 @@
1
- require('../core/flow/styles.css');
2
1
  const require_core_flow_flow = require('../core/flow/flow.cjs');
2
+ require('../core/flow/styles.css');
3
+
4
+ //#region src/flow/index.ts
5
+ var flow_default = require_core_flow_flow;
3
6
 
4
- module.exports = require_core_flow_flow;
7
+ //#endregion
8
+ module.exports = flow_default;
package/flow/index.mjs CHANGED
@@ -1,4 +1,8 @@
1
- import "../core/flow/styles.css";
2
1
  import flow from "../core/flow/flow.mjs";
2
+ import "../core/flow/styles.css";
3
+
4
+ //#region src/flow/index.ts
5
+ var flow_default = flow;
3
6
 
4
- export { flow as default };
7
+ //#endregion
8
+ export { flow_default as default };
@@ -0,0 +1,25 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+
3
+ //#region src/helpers/_internal/constants.ts
4
+ const DIRECTION_OPTIONS_KEYS = ["direction"];
5
+ const ALIGN_OPTIONS_KEYS = ["alignX", "alignY"];
6
+ const ADJUST_OPTIONS_KEYS = ["adjustX", "adjustY"];
7
+ const GAP_OPTIONS_KEYS = [
8
+ "gap",
9
+ "gapX",
10
+ "gapY"
11
+ ];
12
+ const CHILD_SIZE_OPTIONS_KEYS = ["childSizeX", "childSizeY"];
13
+ const CHILD_RATIO_OPTIONS_KEYS = ["childRatioX", "childRatioY"];
14
+ const CHILD_COUNT_OPTIONS_KEYS = ["childCountX", "childCountY"];
15
+ const TRACKS_OPTIONS_KEYS = ["tracksX", "tracksY"];
16
+
17
+ //#endregion
18
+ exports.ADJUST_OPTIONS_KEYS = ADJUST_OPTIONS_KEYS;
19
+ exports.ALIGN_OPTIONS_KEYS = ALIGN_OPTIONS_KEYS;
20
+ exports.CHILD_COUNT_OPTIONS_KEYS = CHILD_COUNT_OPTIONS_KEYS;
21
+ exports.CHILD_RATIO_OPTIONS_KEYS = CHILD_RATIO_OPTIONS_KEYS;
22
+ exports.CHILD_SIZE_OPTIONS_KEYS = CHILD_SIZE_OPTIONS_KEYS;
23
+ exports.DIRECTION_OPTIONS_KEYS = DIRECTION_OPTIONS_KEYS;
24
+ exports.GAP_OPTIONS_KEYS = GAP_OPTIONS_KEYS;
25
+ exports.TRACKS_OPTIONS_KEYS = TRACKS_OPTIONS_KEYS;
@@ -0,0 +1,13 @@
1
+ import { AdjustOptions, AlignOptions, ChildCountOptions, ChildRatioOptions, ChildSizeOptions, DirectionOptions, GapOptions, TracksOptions } from "../../core/_types.cjs";
2
+
3
+ //#region src/helpers/_internal/constants.d.ts
4
+ declare const DIRECTION_OPTIONS_KEYS: (keyof DirectionOptions)[];
5
+ declare const ALIGN_OPTIONS_KEYS: (keyof AlignOptions)[];
6
+ declare const ADJUST_OPTIONS_KEYS: (keyof AdjustOptions)[];
7
+ declare const GAP_OPTIONS_KEYS: (keyof GapOptions)[];
8
+ declare const CHILD_SIZE_OPTIONS_KEYS: (keyof ChildSizeOptions)[];
9
+ declare const CHILD_RATIO_OPTIONS_KEYS: (keyof ChildRatioOptions)[];
10
+ declare const CHILD_COUNT_OPTIONS_KEYS: (keyof ChildCountOptions)[];
11
+ declare const TRACKS_OPTIONS_KEYS: (keyof TracksOptions)[];
12
+ //#endregion
13
+ export { ADJUST_OPTIONS_KEYS, ALIGN_OPTIONS_KEYS, CHILD_COUNT_OPTIONS_KEYS, CHILD_RATIO_OPTIONS_KEYS, CHILD_SIZE_OPTIONS_KEYS, DIRECTION_OPTIONS_KEYS, GAP_OPTIONS_KEYS, TRACKS_OPTIONS_KEYS };
@@ -0,0 +1,13 @@
1
+ import { AdjustOptions, AlignOptions, ChildCountOptions, ChildRatioOptions, ChildSizeOptions, DirectionOptions, GapOptions, TracksOptions } from "../../core/_types.mjs";
2
+
3
+ //#region src/helpers/_internal/constants.d.ts
4
+ declare const DIRECTION_OPTIONS_KEYS: (keyof DirectionOptions)[];
5
+ declare const ALIGN_OPTIONS_KEYS: (keyof AlignOptions)[];
6
+ declare const ADJUST_OPTIONS_KEYS: (keyof AdjustOptions)[];
7
+ declare const GAP_OPTIONS_KEYS: (keyof GapOptions)[];
8
+ declare const CHILD_SIZE_OPTIONS_KEYS: (keyof ChildSizeOptions)[];
9
+ declare const CHILD_RATIO_OPTIONS_KEYS: (keyof ChildRatioOptions)[];
10
+ declare const CHILD_COUNT_OPTIONS_KEYS: (keyof ChildCountOptions)[];
11
+ declare const TRACKS_OPTIONS_KEYS: (keyof TracksOptions)[];
12
+ //#endregion
13
+ export { ADJUST_OPTIONS_KEYS, ALIGN_OPTIONS_KEYS, CHILD_COUNT_OPTIONS_KEYS, CHILD_RATIO_OPTIONS_KEYS, CHILD_SIZE_OPTIONS_KEYS, DIRECTION_OPTIONS_KEYS, GAP_OPTIONS_KEYS, TRACKS_OPTIONS_KEYS };
@@ -0,0 +1,16 @@
1
+ //#region src/helpers/_internal/constants.ts
2
+ const DIRECTION_OPTIONS_KEYS = ["direction"];
3
+ const ALIGN_OPTIONS_KEYS = ["alignX", "alignY"];
4
+ const ADJUST_OPTIONS_KEYS = ["adjustX", "adjustY"];
5
+ const GAP_OPTIONS_KEYS = [
6
+ "gap",
7
+ "gapX",
8
+ "gapY"
9
+ ];
10
+ const CHILD_SIZE_OPTIONS_KEYS = ["childSizeX", "childSizeY"];
11
+ const CHILD_RATIO_OPTIONS_KEYS = ["childRatioX", "childRatioY"];
12
+ const CHILD_COUNT_OPTIONS_KEYS = ["childCountX", "childCountY"];
13
+ const TRACKS_OPTIONS_KEYS = ["tracksX", "tracksY"];
14
+
15
+ //#endregion
16
+ export { ADJUST_OPTIONS_KEYS, ALIGN_OPTIONS_KEYS, CHILD_COUNT_OPTIONS_KEYS, CHILD_RATIO_OPTIONS_KEYS, CHILD_SIZE_OPTIONS_KEYS, DIRECTION_OPTIONS_KEYS, GAP_OPTIONS_KEYS, TRACKS_OPTIONS_KEYS };
@@ -0,0 +1,25 @@
1
+
2
+ //#region src/helpers/_internal/createExtractLayoutOptions.ts
3
+ /**
4
+ * レコードからレイアウトオプションとそれ以外のプロパティを分離する関数を作成する
5
+ *
6
+ * @param optionsKeys レイアウトオプションのキー
7
+ */
8
+ function createExtractLayoutOptions(optionKeys) {
9
+ const keySet = new Set(optionKeys);
10
+ /**
11
+ * レコードからレイアウトオプションとそれ以外のプロパティを分離する
12
+ *
13
+ * @param record レイアウトオプションとその他のプロパティを含むレコード
14
+ * @returns `[layoutOptions, rest]` のタプル。`layoutOptions` はレイアウトに対応するプロパティ、`rest` はそれ以外のプロパティ
15
+ */
16
+ return (record) => {
17
+ const options = {};
18
+ const rest = {};
19
+ if (record) for (const [k, v] of Object.entries(record)) (keySet.has(k) ? options : rest)[k] = v;
20
+ return [options, rest];
21
+ };
22
+ }
23
+
24
+ //#endregion
25
+ module.exports = createExtractLayoutOptions;
@@ -0,0 +1,8 @@
1
+ //#region src/helpers/_internal/createExtractLayoutOptions.d.ts
2
+ /**
3
+ * レコードからレイアウトオプションとそれ以外のプロパティを分離する関数を作成する
4
+ *
5
+ * @param optionsKeys レイアウトオプションのキー
6
+ */
7
+ declare function createExtractLayoutOptions<TOptions extends Record<string, unknown>>(optionKeys: (keyof TOptions)[]): <T extends Record<string, unknown>>(record: T) => [TOptions, Omit<T, keyof TOptions>];
8
+ export = createExtractLayoutOptions;
@@ -0,0 +1,9 @@
1
+ //#region src/helpers/_internal/createExtractLayoutOptions.d.ts
2
+ /**
3
+ * レコードからレイアウトオプションとそれ以外のプロパティを分離する関数を作成する
4
+ *
5
+ * @param optionsKeys レイアウトオプションのキー
6
+ */
7
+ declare function createExtractLayoutOptions<TOptions extends Record<string, unknown>>(optionKeys: (keyof TOptions)[]): <T extends Record<string, unknown>>(record: T) => [TOptions, Omit<T, keyof TOptions>];
8
+ //#endregion
9
+ export { createExtractLayoutOptions as default };
@@ -0,0 +1,24 @@
1
+ //#region src/helpers/_internal/createExtractLayoutOptions.ts
2
+ /**
3
+ * レコードからレイアウトオプションとそれ以外のプロパティを分離する関数を作成する
4
+ *
5
+ * @param optionsKeys レイアウトオプションのキー
6
+ */
7
+ function createExtractLayoutOptions(optionKeys) {
8
+ const keySet = new Set(optionKeys);
9
+ /**
10
+ * レコードからレイアウトオプションとそれ以外のプロパティを分離する
11
+ *
12
+ * @param record レイアウトオプションとその他のプロパティを含むレコード
13
+ * @returns `[layoutOptions, rest]` のタプル。`layoutOptions` はレイアウトに対応するプロパティ、`rest` はそれ以外のプロパティ
14
+ */
15
+ return (record) => {
16
+ const options = {};
17
+ const rest = {};
18
+ if (record) for (const [k, v] of Object.entries(record)) (keySet.has(k) ? options : rest)[k] = v;
19
+ return [options, rest];
20
+ };
21
+ }
22
+
23
+ //#endregion
24
+ export { createExtractLayoutOptions as default };
@@ -0,0 +1,15 @@
1
+ const require_helpers__internal_constants = require('./_internal/constants.cjs');
2
+ const require_helpers__internal_createExtractLayoutOptions = require('./_internal/createExtractLayoutOptions.cjs');
3
+
4
+ //#region src/helpers/extractBalanceOptions.ts
5
+ var extractBalanceOptions_default = require_helpers__internal_createExtractLayoutOptions([
6
+ ...require_helpers__internal_constants.DIRECTION_OPTIONS_KEYS,
7
+ ...require_helpers__internal_constants.ALIGN_OPTIONS_KEYS,
8
+ ...require_helpers__internal_constants.ADJUST_OPTIONS_KEYS,
9
+ ...require_helpers__internal_constants.GAP_OPTIONS_KEYS,
10
+ ...require_helpers__internal_constants.CHILD_SIZE_OPTIONS_KEYS,
11
+ ...require_helpers__internal_constants.CHILD_RATIO_OPTIONS_KEYS
12
+ ]);
13
+
14
+ //#endregion
15
+ module.exports = extractBalanceOptions_default;
@@ -0,0 +1,5 @@
1
+ import { AdjustOptions, ChildRatioOptions, ChildSizeOptions, GapOptions } from "../core/_types.cjs";
2
+ import { BalanceLayoutOptions } from "../core/balance/types.cjs";
3
+ //#region src/helpers/extractBalanceOptions.d.ts
4
+ declare const _default: <T extends Record<string, unknown>>(record: T) => [BalanceLayoutOptions, Omit<T, keyof AdjustOptions | "direction" | keyof GapOptions | keyof ChildSizeOptions | keyof ChildRatioOptions | "alignY" | "alignX">];
5
+ export = _default;
@@ -0,0 +1,6 @@
1
+ import { AdjustOptions, ChildRatioOptions, ChildSizeOptions, GapOptions } from "../core/_types.mjs";
2
+ import { BalanceLayoutOptions } from "../core/balance/types.mjs";
3
+ //#region src/helpers/extractBalanceOptions.d.ts
4
+ declare const _default: <T extends Record<string, unknown>>(record: T) => [BalanceLayoutOptions, Omit<T, keyof AdjustOptions | "direction" | keyof GapOptions | keyof ChildSizeOptions | keyof ChildRatioOptions | "alignY" | "alignX">];
5
+ //#endregion
6
+ export { _default as default };
@@ -0,0 +1,15 @@
1
+ import { ADJUST_OPTIONS_KEYS, ALIGN_OPTIONS_KEYS, CHILD_RATIO_OPTIONS_KEYS, CHILD_SIZE_OPTIONS_KEYS, DIRECTION_OPTIONS_KEYS, GAP_OPTIONS_KEYS } from "./_internal/constants.mjs";
2
+ import createExtractLayoutOptions from "./_internal/createExtractLayoutOptions.mjs";
3
+
4
+ //#region src/helpers/extractBalanceOptions.ts
5
+ var extractBalanceOptions_default = createExtractLayoutOptions([
6
+ ...DIRECTION_OPTIONS_KEYS,
7
+ ...ALIGN_OPTIONS_KEYS,
8
+ ...ADJUST_OPTIONS_KEYS,
9
+ ...GAP_OPTIONS_KEYS,
10
+ ...CHILD_SIZE_OPTIONS_KEYS,
11
+ ...CHILD_RATIO_OPTIONS_KEYS
12
+ ]);
13
+
14
+ //#endregion
15
+ export { extractBalanceOptions_default as default };
@@ -0,0 +1,14 @@
1
+ const require_helpers__internal_constants = require('./_internal/constants.cjs');
2
+ const require_helpers__internal_createExtractLayoutOptions = require('./_internal/createExtractLayoutOptions.cjs');
3
+
4
+ //#region src/helpers/extractCenterOptions.ts
5
+ var extractCenterOptions_default = require_helpers__internal_createExtractLayoutOptions([
6
+ ...require_helpers__internal_constants.DIRECTION_OPTIONS_KEYS,
7
+ ...require_helpers__internal_constants.ADJUST_OPTIONS_KEYS,
8
+ ...require_helpers__internal_constants.GAP_OPTIONS_KEYS,
9
+ ...require_helpers__internal_constants.CHILD_SIZE_OPTIONS_KEYS,
10
+ ...require_helpers__internal_constants.CHILD_RATIO_OPTIONS_KEYS
11
+ ]);
12
+
13
+ //#endregion
14
+ module.exports = extractCenterOptions_default;
@@ -0,0 +1,6 @@
1
+ import { AdjustOptions, ChildRatioOptions, ChildSizeOptions, GapOptions } from "../core/_types.cjs";
2
+ import { CenterLayoutOptions } from "../core/center/types.cjs";
3
+
4
+ //#region src/helpers/extractCenterOptions.d.ts
5
+ declare const _default: <T extends Record<string, unknown>>(record: T) => [CenterLayoutOptions, Omit<T, keyof AdjustOptions | "direction" | keyof GapOptions | keyof ChildSizeOptions | keyof ChildRatioOptions>];
6
+ export = _default;
@@ -0,0 +1,7 @@
1
+ import { AdjustOptions, ChildRatioOptions, ChildSizeOptions, GapOptions } from "../core/_types.mjs";
2
+ import { CenterLayoutOptions } from "../core/center/types.mjs";
3
+
4
+ //#region src/helpers/extractCenterOptions.d.ts
5
+ declare const _default: <T extends Record<string, unknown>>(record: T) => [CenterLayoutOptions, Omit<T, keyof AdjustOptions | "direction" | keyof GapOptions | keyof ChildSizeOptions | keyof ChildRatioOptions>];
6
+ //#endregion
7
+ export { _default as default };
@@ -0,0 +1,14 @@
1
+ import { ADJUST_OPTIONS_KEYS, CHILD_RATIO_OPTIONS_KEYS, CHILD_SIZE_OPTIONS_KEYS, DIRECTION_OPTIONS_KEYS, GAP_OPTIONS_KEYS } from "./_internal/constants.mjs";
2
+ import createExtractLayoutOptions from "./_internal/createExtractLayoutOptions.mjs";
3
+
4
+ //#region src/helpers/extractCenterOptions.ts
5
+ var extractCenterOptions_default = createExtractLayoutOptions([
6
+ ...DIRECTION_OPTIONS_KEYS,
7
+ ...ADJUST_OPTIONS_KEYS,
8
+ ...GAP_OPTIONS_KEYS,
9
+ ...CHILD_SIZE_OPTIONS_KEYS,
10
+ ...CHILD_RATIO_OPTIONS_KEYS
11
+ ]);
12
+
13
+ //#endregion
14
+ export { extractCenterOptions_default as default };
@@ -0,0 +1,15 @@
1
+ const require_helpers__internal_constants = require('./_internal/constants.cjs');
2
+ const require_helpers__internal_createExtractLayoutOptions = require('./_internal/createExtractLayoutOptions.cjs');
3
+
4
+ //#region src/helpers/extractFlowOptions.ts
5
+ var extractFlowOptions_default = require_helpers__internal_createExtractLayoutOptions([
6
+ ...require_helpers__internal_constants.DIRECTION_OPTIONS_KEYS,
7
+ ...require_helpers__internal_constants.ALIGN_OPTIONS_KEYS,
8
+ ...require_helpers__internal_constants.ADJUST_OPTIONS_KEYS,
9
+ ...require_helpers__internal_constants.GAP_OPTIONS_KEYS,
10
+ ...require_helpers__internal_constants.CHILD_SIZE_OPTIONS_KEYS,
11
+ ...require_helpers__internal_constants.CHILD_RATIO_OPTIONS_KEYS
12
+ ]);
13
+
14
+ //#endregion
15
+ module.exports = extractFlowOptions_default;
@@ -0,0 +1,6 @@
1
+ import { AlignOptions, ChildRatioOptions, ChildSizeOptions, GapOptions } from "../core/_types.cjs";
2
+ import { FlowLayoutOptions } from "../core/flow/types.cjs";
3
+
4
+ //#region src/helpers/extractFlowOptions.d.ts
5
+ declare const _default: <T extends Record<string, unknown>>(record: T) => [FlowLayoutOptions, Omit<T, "adjustY" | "adjustX" | "direction" | keyof GapOptions | keyof ChildSizeOptions | keyof ChildRatioOptions | keyof AlignOptions>];
6
+ export = _default;
@@ -0,0 +1,7 @@
1
+ import { AlignOptions, ChildRatioOptions, ChildSizeOptions, GapOptions } from "../core/_types.mjs";
2
+ import { FlowLayoutOptions } from "../core/flow/types.mjs";
3
+
4
+ //#region src/helpers/extractFlowOptions.d.ts
5
+ declare const _default: <T extends Record<string, unknown>>(record: T) => [FlowLayoutOptions, Omit<T, "adjustY" | "adjustX" | "direction" | keyof GapOptions | keyof ChildSizeOptions | keyof ChildRatioOptions | keyof AlignOptions>];
6
+ //#endregion
7
+ export { _default as default };
@@ -0,0 +1,15 @@
1
+ import { ADJUST_OPTIONS_KEYS, ALIGN_OPTIONS_KEYS, CHILD_RATIO_OPTIONS_KEYS, CHILD_SIZE_OPTIONS_KEYS, DIRECTION_OPTIONS_KEYS, GAP_OPTIONS_KEYS } from "./_internal/constants.mjs";
2
+ import createExtractLayoutOptions from "./_internal/createExtractLayoutOptions.mjs";
3
+
4
+ //#region src/helpers/extractFlowOptions.ts
5
+ var extractFlowOptions_default = createExtractLayoutOptions([
6
+ ...DIRECTION_OPTIONS_KEYS,
7
+ ...ALIGN_OPTIONS_KEYS,
8
+ ...ADJUST_OPTIONS_KEYS,
9
+ ...GAP_OPTIONS_KEYS,
10
+ ...CHILD_SIZE_OPTIONS_KEYS,
11
+ ...CHILD_RATIO_OPTIONS_KEYS
12
+ ]);
13
+
14
+ //#endregion
15
+ export { extractFlowOptions_default as default };
@@ -0,0 +1,13 @@
1
+ const require_helpers__internal_constants = require('./_internal/constants.cjs');
2
+ const require_helpers__internal_createExtractLayoutOptions = require('./_internal/createExtractLayoutOptions.cjs');
3
+
4
+ //#region src/helpers/extractLayerOptions.ts
5
+ var extractLayerOptions_default = require_helpers__internal_createExtractLayoutOptions([
6
+ ...require_helpers__internal_constants.ALIGN_OPTIONS_KEYS,
7
+ ...require_helpers__internal_constants.ADJUST_OPTIONS_KEYS,
8
+ ...require_helpers__internal_constants.CHILD_SIZE_OPTIONS_KEYS,
9
+ ...require_helpers__internal_constants.CHILD_RATIO_OPTIONS_KEYS
10
+ ]);
11
+
12
+ //#endregion
13
+ module.exports = extractLayerOptions_default;
@@ -0,0 +1,6 @@
1
+ import { AdjustOptions, ChildRatioOptions, ChildSizeOptions } from "../core/_types.cjs";
2
+ import { LayerLayoutOptions } from "../core/layer/types.cjs";
3
+
4
+ //#region src/helpers/extractLayerOptions.d.ts
5
+ declare const _default: <T extends Record<string, unknown>>(record: T) => [LayerLayoutOptions, Omit<T, keyof AdjustOptions | keyof ChildSizeOptions | keyof ChildRatioOptions | "alignY" | "alignX">];
6
+ export = _default;
@@ -0,0 +1,7 @@
1
+ import { AdjustOptions, ChildRatioOptions, ChildSizeOptions } from "../core/_types.mjs";
2
+ import { LayerLayoutOptions } from "../core/layer/types.mjs";
3
+
4
+ //#region src/helpers/extractLayerOptions.d.ts
5
+ declare const _default: <T extends Record<string, unknown>>(record: T) => [LayerLayoutOptions, Omit<T, keyof AdjustOptions | keyof ChildSizeOptions | keyof ChildRatioOptions | "alignY" | "alignX">];
6
+ //#endregion
7
+ export { _default as default };
@@ -0,0 +1,13 @@
1
+ import { ADJUST_OPTIONS_KEYS, ALIGN_OPTIONS_KEYS, CHILD_RATIO_OPTIONS_KEYS, CHILD_SIZE_OPTIONS_KEYS } from "./_internal/constants.mjs";
2
+ import createExtractLayoutOptions from "./_internal/createExtractLayoutOptions.mjs";
3
+
4
+ //#region src/helpers/extractLayerOptions.ts
5
+ var extractLayerOptions_default = createExtractLayoutOptions([
6
+ ...ALIGN_OPTIONS_KEYS,
7
+ ...ADJUST_OPTIONS_KEYS,
8
+ ...CHILD_SIZE_OPTIONS_KEYS,
9
+ ...CHILD_RATIO_OPTIONS_KEYS
10
+ ]);
11
+
12
+ //#endregion
13
+ export { extractLayerOptions_default as default };
@@ -0,0 +1,17 @@
1
+ const require_helpers__internal_constants = require('./_internal/constants.cjs');
2
+ const require_helpers__internal_createExtractLayoutOptions = require('./_internal/createExtractLayoutOptions.cjs');
3
+
4
+ //#region src/helpers/extractMatrixOptions.ts
5
+ var extractMatrixOptions_default = require_helpers__internal_createExtractLayoutOptions([
6
+ ...require_helpers__internal_constants.DIRECTION_OPTIONS_KEYS,
7
+ ...require_helpers__internal_constants.ALIGN_OPTIONS_KEYS,
8
+ ...require_helpers__internal_constants.ADJUST_OPTIONS_KEYS,
9
+ ...require_helpers__internal_constants.GAP_OPTIONS_KEYS,
10
+ ...require_helpers__internal_constants.CHILD_SIZE_OPTIONS_KEYS,
11
+ ...require_helpers__internal_constants.CHILD_RATIO_OPTIONS_KEYS,
12
+ ...require_helpers__internal_constants.CHILD_COUNT_OPTIONS_KEYS,
13
+ ...require_helpers__internal_constants.TRACKS_OPTIONS_KEYS
14
+ ]);
15
+
16
+ //#endregion
17
+ module.exports = extractMatrixOptions_default;
@@ -0,0 +1,5 @@
1
+ import { MatrixLayoutOptions } from "../core/matrix/types.cjs";
2
+
3
+ //#region src/helpers/extractMatrixOptions.d.ts
4
+ declare const _default: <T extends Record<string, unknown>>(record: T) => [MatrixLayoutOptions, Omit<T, "adjustY" | "adjustX" | "direction" | "gap" | "gapX" | "gapY" | "childSizeX" | "childSizeY" | "childRatioX" | "childRatioY" | "alignY" | "alignX" | "childCountX" | "tracksX" | "childCountY" | "tracksY">];
5
+ export = _default;
@@ -0,0 +1,6 @@
1
+ import { MatrixLayoutOptions } from "../core/matrix/types.mjs";
2
+
3
+ //#region src/helpers/extractMatrixOptions.d.ts
4
+ declare const _default: <T extends Record<string, unknown>>(record: T) => [MatrixLayoutOptions, Omit<T, "adjustY" | "adjustX" | "direction" | "gap" | "gapX" | "gapY" | "childSizeX" | "childSizeY" | "childRatioX" | "childRatioY" | "alignY" | "alignX" | "childCountX" | "tracksX" | "childCountY" | "tracksY">];
5
+ //#endregion
6
+ export { _default as default };