@omnific/atelier 0.4.1 → 0.5.1

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 (76) hide show
  1. package/README.md +59 -4
  2. package/dist/box/Box.d.ts +1 -3
  3. package/dist/box/Box.js +2 -3
  4. package/dist/box/constants.js +1 -2
  5. package/dist/box/index.d.ts +1 -1
  6. package/dist/box/types.d.ts +1 -3
  7. package/dist/button/Button.d.ts +1 -3
  8. package/dist/button/Button.js +1 -2
  9. package/dist/button/LoadingIcon.js +1 -2
  10. package/dist/button/constants.js +1 -2
  11. package/dist/button/index.d.ts +1 -1
  12. package/dist/button/types.d.ts +1 -3
  13. package/dist/main.d.ts +6 -6
  14. package/dist/main.js +1 -1
  15. package/dist/props/display.props.d.ts +1 -3
  16. package/dist/props/display.props.js +1 -2
  17. package/dist/props/flex.props.d.ts +1 -3
  18. package/dist/props/flex.props.js +1 -2
  19. package/dist/props/gap.props.d.ts +1 -3
  20. package/dist/props/gap.props.js +1 -2
  21. package/dist/props/height.props.d.ts +1 -3
  22. package/dist/props/height.props.js +1 -2
  23. package/dist/props/index.d.ts +1 -3
  24. package/dist/props/index.js +2 -3
  25. package/dist/props/justify.props.d.ts +1 -3
  26. package/dist/props/justify.props.js +1 -2
  27. package/dist/props/margin.props.d.ts +1 -3
  28. package/dist/props/margin.props.js +1 -2
  29. package/dist/props/overflow.props.d.ts +1 -3
  30. package/dist/props/overflow.props.js +1 -2
  31. package/dist/props/padding.props.d.ts +1 -3
  32. package/dist/props/padding.props.js +1 -2
  33. package/dist/props/position.props.d.ts +1 -3
  34. package/dist/props/position.props.js +1 -2
  35. package/dist/props/radius.props.d.ts +1 -3
  36. package/dist/props/radius.props.js +1 -2
  37. package/dist/props/scaling.props.d.ts +1 -3
  38. package/dist/props/shadow.props.d.ts +1 -3
  39. package/dist/props/shadow.props.js +1 -2
  40. package/dist/props/width.props.d.ts +1 -3
  41. package/dist/props/width.props.js +1 -2
  42. package/dist/styles.css +84 -0
  43. package/dist/system/create-system.js +83 -16
  44. package/dist/system/create-theme.d.ts +14 -0
  45. package/dist/system/create-theme.js +21 -0
  46. package/dist/system/css-vars.d.ts +5 -4
  47. package/dist/system/css-vars.js +16 -10
  48. package/dist/system/default-system.d.ts +3 -7
  49. package/dist/system/default-system.js +4 -5
  50. package/dist/system/default-theme.d.ts +156 -0
  51. package/dist/system/default-theme.js +11 -0
  52. package/dist/system/defaults/color-keys.gen.d.ts +1 -3
  53. package/dist/system/defaults/colors.d.ts +89 -93
  54. package/dist/system/defaults/colors.js +68 -72
  55. package/dist/system/defaults/tokens.d.ts +55 -0
  56. package/dist/system/defaults/tokens.js +57 -0
  57. package/dist/system/index.d.ts +7 -8
  58. package/dist/system/index.js +5 -6
  59. package/dist/system/types.d.ts +34 -17
  60. package/dist/system/use-theme.d.ts +6 -3
  61. package/dist/system/use-theme.js +6 -2
  62. package/dist/transition/types.d.ts +1 -3
  63. package/dist/transition/types.js +1 -2
  64. package/dist/transition/useTransitionStatus.d.ts +1 -3
  65. package/dist/transition/useTransitionStatus.js +1 -2
  66. package/dist/types.d.ts +1 -3
  67. package/dist/utils/extractProps.js +1 -2
  68. package/dist/utils/getPrefixCls.js +1 -2
  69. package/package.json +5 -5
  70. package/dist/system/create-system.d.ts +0 -14
  71. package/dist/system/define-colors.d.ts +0 -7
  72. package/dist/system/define-colors.js +0 -7
  73. package/dist/system/flatten-colors.d.ts +0 -11
  74. package/dist/system/flatten-colors.js +0 -26
  75. package/dist/system/merge-colors.d.ts +0 -12
  76. package/dist/system/merge-colors.js +0 -30
@@ -3,7 +3,7 @@ import { isNil, resolveValue } from "@omnific/utils";
3
3
  import { useForkRef } from "@omnific/hooks";
4
4
  import { useAnimate } from "motion/react";
5
5
  import { useEffectEvent, useLayoutEffect, useState } from "react";
6
- //#region transition/useTransitionStatus.ts
6
+ // transition/useTransitionStatus.ts
7
7
  /**
8
8
  * 管理元素进入、退出、挂载状态及对应 Motion 动画。
9
9
  */
@@ -50,5 +50,4 @@ const useTransitionStatus = (options) => {
50
50
  status
51
51
  };
52
52
  };
53
- //#endregion
54
53
  export { useTransitionStatus };
package/dist/types.d.ts CHANGED
@@ -1,6 +1,4 @@
1
- //#region types.d.ts
2
1
  /**
3
2
  * 通用控件尺寸。
4
3
  */
5
- export type ComponentSize = 'small' | 'default' | 'large';
6
- //#endregion
4
+ export type ComponentSize = 'small' | 'default' | 'large';
@@ -1,7 +1,7 @@
1
1
  import { atelierStyleMaps, getAtelierClassName } from "../props/index.js";
2
2
  import { clsx } from "clsx";
3
3
  import { hasValue, isNil } from "@omnific/utils";
4
- //#region utils/extractProps.ts
4
+ // utils/extractProps.ts
5
5
  /**
6
6
  * 提取全局 props,生成静态 class 与 inline style,并透传剩余原生 props。
7
7
  */
@@ -30,5 +30,4 @@ const extractProps = (props) => {
30
30
  restProps.style = Object.assign(style, sourceProps.style);
31
31
  return restProps;
32
32
  };
33
- //#endregion
34
33
  export { extractProps };
@@ -1,4 +1,4 @@
1
- //#region utils/getPrefixCls.ts
1
+ // utils/getPrefixCls.ts
2
2
  /**
3
3
  * Atelier 样式的根类名前缀。
4
4
  */
@@ -7,5 +7,4 @@ const rootPrefixCls = "atelier";
7
7
  * 获取 Atelier 组件的 CSS 类名前缀。
8
8
  */
9
9
  const getPrefixCls = (suffixCls) => `${rootPrefixCls}-${suffixCls}`;
10
- //#endregion
11
10
  export { getPrefixCls, rootPrefixCls };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@omnific/atelier",
3
- "version": "0.4.1",
3
+ "version": "0.5.1",
4
4
  "description": "A refined React component library for Omnific",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -59,12 +59,12 @@
59
59
  "README.md"
60
60
  ],
61
61
  "dependencies": {
62
- "@omnific/hooks": "0.2.2",
63
- "@omnific/icons": "0.1.2",
62
+ "@omnific/hooks": "0.2.3",
63
+ "@omnific/icons": "0.1.3",
64
64
  "@omnific/types": "0.0.8",
65
- "@omnific/utils": "0.4.0",
65
+ "@omnific/utils": "0.5.0",
66
66
  "clsx": "^2.1.1",
67
- "motion": "^14.4.0"
67
+ "motion": "^14.9.0"
68
68
  },
69
69
  "peerDependencies": {
70
70
  "react": "^19.2.8",
@@ -1,14 +0,0 @@
1
- import { ColorSet, FlatColorSet } from "./types.js";
2
- //#region system/create-system.d.ts
3
- /**
4
- * 合并扁平颜色表并返回 system 实例。
5
- *
6
- * 第一个参数可以是主题名称,也可以直接传入扁平颜色表;
7
- * 省略主题名称时使用 `default`。
8
- */
9
- export declare function createSystem(nameOrColors: string | ColorSet, ...colorSets: ColorSet[]): {
10
- name: string;
11
- colors: FlatColorSet;
12
- cssVars: Readonly<Record<string, string>>;
13
- };
14
- //#endregion
@@ -1,7 +0,0 @@
1
- import { ColorSet } from "./types.js";
2
- //#region system/define-colors.d.ts
3
- /**
4
- * 标注并返回嵌套颜色配置,保留字面量结构。
5
- */
6
- export declare const defineColors: <const T extends ColorSet>(colors: T) => T;
7
- //#endregion
@@ -1,7 +0,0 @@
1
- //#region system/define-colors.ts
2
- /**
3
- * 标注并返回嵌套颜色配置,保留字面量结构。
4
- */
5
- const defineColors = (colors) => colors;
6
- //#endregion
7
- export { defineColors };
@@ -1,11 +0,0 @@
1
- import { ColorSet } from "./types.js";
2
- //#region system/flatten-colors.d.ts
3
- /**
4
- * 将嵌套颜色配置展开为扁平 key。
5
- *
6
- * bg.base -> bg
7
- * bg.muted -> bg-muted
8
- * accent.solid -> accent-solid
9
- */
10
- export declare const flattenColors: (colors: ColorSet, prefix?: string, result?: Record<string, string>) => Record<string, string>;
11
- //#endregion
@@ -1,26 +0,0 @@
1
- import { isNil, isString } from "@omnific/utils";
2
- //#region system/flatten-colors.ts
3
- /**
4
- * 将嵌套颜色配置展开为扁平 key。
5
- *
6
- * bg.base -> bg
7
- * bg.muted -> bg-muted
8
- * accent.solid -> accent-solid
9
- */
10
- const flattenColors = (colors, prefix = "", result = {}) => {
11
- const keys = Object.keys(colors);
12
- for (const key of keys) {
13
- if (isNil(key)) continue;
14
- const value = colors[key];
15
- const path = key === "base" ? prefix : prefix ? `${prefix}-${key}` : key;
16
- if (isString(value)) {
17
- result[path] = value;
18
- continue;
19
- }
20
- if (isNil(value)) continue;
21
- flattenColors(value, path, result);
22
- }
23
- return result;
24
- };
25
- //#endregion
26
- export { flattenColors };
@@ -1,12 +0,0 @@
1
- import { ColorSet, FlatColorSet } from "./types.js";
2
- //#region system/merge-colors.d.ts
3
- /**
4
- * 展开并合并嵌套颜色表,输出扁平颜色和 CSS 变量。
5
- *
6
- * 后传入的颜色覆盖前面同名 key。
7
- */
8
- export declare const mergeColors: (...colorSets: ColorSet[]) => {
9
- colors: FlatColorSet;
10
- cssVars: Readonly<Record<string, string>>;
11
- };
12
- //#endregion
@@ -1,30 +0,0 @@
1
- import { toColorVarName } from "./css-vars.js";
2
- import { flattenColors } from "./flatten-colors.js";
3
- import { isNil } from "@omnific/utils";
4
- //#region system/merge-colors.ts
5
- /**
6
- * 展开并合并嵌套颜色表,输出扁平颜色和 CSS 变量。
7
- *
8
- * 后传入的颜色覆盖前面同名 key。
9
- */
10
- const mergeColors = (...colorSets) => {
11
- const colors = {};
12
- for (const colorSet of colorSets) {
13
- if (isNil(colorSet)) continue;
14
- Object.assign(colors, flattenColors(colorSet));
15
- }
16
- const colorKeys = Object.keys(colors);
17
- const cssVars = {};
18
- for (const key of colorKeys) {
19
- if (isNil(key)) continue;
20
- const value = colors[key];
21
- if (isNil(value)) continue;
22
- cssVars[toColorVarName(key)] = value;
23
- }
24
- return {
25
- colors,
26
- cssVars: Object.freeze(cssVars)
27
- };
28
- };
29
- //#endregion
30
- export { mergeColors };