yxuse 1.0.8 → 1.0.10

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/README.md CHANGED
@@ -1,12 +1,149 @@
1
- <!--
2
- * @Author: WangXin
3
- * @Date: 2023-08-16 14:24:55
4
- * @LastEditors: WangXin
5
- * @LastEditTime: 2023-08-16 16:20:30
6
- * @FilePath: \yxUse\README.md
7
- * @Description:
8
- *
9
- * Copyright (c) 2023 by YuXing, All Rights Reserved.
10
- -->
11
-
12
- yxuse
1
+ # yxuse
2
+
3
+ - 起步
4
+
5
+ ```javascript
6
+ npm install yxuse@latest
7
+ ```
8
+
9
+ ## 主题
10
+
11
+ - 使用方式
12
+
13
+ ```javascript
14
+ import { install } from "yxuse/theme";
15
+ ```
16
+
17
+ - 内置方法
18
+
19
+ ```javascript
20
+ /**
21
+ * @description:注册主题下的css变量
22
+ */
23
+ install;
24
+ /**
25
+ * @description:修改主题
26
+ * @param themeName 主题名称
27
+ */
28
+ changeTheme;
29
+ /**
30
+ * @description:获取当前主题
31
+ */
32
+ getCurTheme;
33
+ /**
34
+ * @description:获取当前主题下的系统配置
35
+ * @param systemName 系统名称
36
+ */
37
+ getSystemThemeConfig;
38
+ ```
39
+
40
+ - css 变量 json 配置
41
+
42
+ > 下方各类组件颜色变量配置,需要大家一起丰富
43
+
44
+ ```json
45
+ green: {
46
+ common: {
47
+ //公用颜色
48
+ color: {
49
+ //主题色
50
+ "main-100": "rgba(80, 165, 122, 1)",
51
+ "main-50": "rgba(80, 165, 122, 0.5)",
52
+ "main-25": "rgba(80, 165, 122, 0.25)",
53
+ "main-15": "rgba(80, 165, 122, 0.15)",
54
+ "main-5": "rgba(80, 165, 122, 0.05)",
55
+
56
+ //故障色
57
+ "error-100": "rgba(255, 152, 146, 1)",
58
+ "error-50": "rgba(255, 152, 146, 0.5)",
59
+ "error-25": "rgba(255, 152, 146, 0.25)",
60
+ "error-15": "rgba(255, 152, 146, 0.15)",
61
+ "error-5": "rgba(255, 152, 146, 0.05)",
62
+
63
+ //预警色
64
+ "warning-100": "rgba(249, 162, 33, 1)",
65
+ "warning-50": "rgba(249, 162, 33, 0.5)",
66
+ "warning-25": "rgba(249, 162, 33, 0.25)",
67
+ "warning-15": "rgba(249, 162, 33, 0.15)",
68
+ "warning-5": "rgba(249, 162, 33, 0.05)",
69
+
70
+ //信息色
71
+ "info-100": "rgba(133, 233, 183, 1)",
72
+ "info-50": "rgba(133, 233, 183, 0.5)",
73
+ "info-25": "rgba(133, 233, 183, 0.25)",
74
+ "info-15": "rgba(133, 233, 183, 0.15)",
75
+ "info-5": "rgba(133, 233, 183, 0.05)",
76
+
77
+ //中性色
78
+ "neutral-100": "rgba(85, 221, 221, 1)",
79
+ "neutral-50": "rgba(85, 221, 221, 0.5)",
80
+ "neutral-25": "rgba(85, 221, 221, 0.25)",
81
+ "neutral-15": "rgba(85, 221, 221, 0.15)",
82
+ "neutral-5": "rgba(85, 221, 221, 0.05)"
83
+ },
84
+ //背景色类
85
+ background: {
86
+ "error-gradual": "linear-gradient(90deg, #FFCECB 0%, rgba(255,235,233,0.35) 100%)",
87
+ "warning-gradual": "linear-gradient(90deg, #FFE4BC 0%, rgba(255,250,233,0.35) 100%)",
88
+ "success-gradual": "linear-gradient(90deg, #D5ECBE 0%, rgba(234,255,233,0.35) 100%)"
89
+ },
90
+ //按钮类
91
+ button: {
92
+ background: "rgba(103, 186, 145, 0.10)",
93
+ "border-color": "rgba(80, 165, 122, 1)",
94
+ "text-color": "rgba(80, 165, 122, 1)",
95
+ "active-background-color": "rgba(80, 165, 122, 1)",
96
+ "active-border-color": "rgba(154, 209, 162, 1)",
97
+ "active-text-color": "#fff"
98
+ },
99
+ checkbox: {
100
+ background: "rgba(216, 233, 219, 1)",
101
+ "icon-color": "rgba(80, 165, 122, 0)",
102
+ "border-color": "rgba(154, 209, 162, 1)",
103
+ "checked-background": "rgba(216, 233, 219, 1)",
104
+ "checked-icon-color": "rgba(80, 165, 122, 1)",
105
+ "checked-border-color": "rgba(154, 209, 162, 1)"
106
+ },
107
+ //input
108
+ input: {
109
+ background: "rgba(237, 246, 239, 1)",
110
+ "border-color": "rgba(80, 165, 122, 1)",
111
+ color: "rgba(29, 75, 52, 1)",
112
+ "placeholder-color": "rgba(80, 165, 122, 1)",
113
+ "hover-background": "rgba(237, 246, 239, 0.30)",
114
+ "hover-border-color": "rgba(80, 165, 122, 1)",
115
+ "hover-color": "rgba(80, 165, 122, 1)",
116
+ "active-background": "rgba(237, 246, 239, 0.30)",
117
+ "active-border-color": "rgba(80, 165, 122, 1)",
118
+ "active-color": "rgba(80, 165, 122, 1)",
119
+ "disabled-background": "rgba(237, 246, 239, 1)",
120
+ "disabled-border-color": "rgba(237, 246, 239, 1)",
121
+ "disabled-color": "rgba(83, 83, 83, 1)"
122
+ },
123
+ // select
124
+ select: {
125
+ "dropdown-background": "rgba(237, 246, 239, 1)",
126
+ "dropdown-border-color": "rgba(80, 165, 122, 1)",
127
+ "dropdown-item-color": "rgba(80, 165, 122, 1)",
128
+ "dropdown-item-hover-background": "rgba(178, 220, 198, 1)",
129
+ "dropdown-item-hover-color": "rgba(29, 75, 52, 1)",
130
+ "dropdown-item-selected-background": "rgba(178, 220, 198, 1)",
131
+ "dropdown-item-selected-color": "rgba(29, 75, 52, 1)"
132
+ },
133
+ //布局类
134
+ layout: {},
135
+ //表格类
136
+ table: {},
137
+ //曲线类
138
+ chart: {},
139
+ //提示类
140
+ message: {}
141
+ },
142
+
143
+ //各系统个性化配置
144
+ cloud: {},//运管系统
145
+ "station-control-center": {}, //站控
146
+ "traceplan-client":{} //任务计划
147
+ ...
148
+ },
149
+ ```
package/lib/theme.cjs.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n={green:{common:{color:{"main-100":"rgba(80, 165, 122, 1)","main-50":"rgba(80, 165, 122, 0.5)","main-25":"rgba(80, 165, 122, 0.25)","main-15":"rgba(80, 165, 122, 0.15)","main-5":"rgba(80, 165, 122, 0.05)","error-100":"rgba(255, 152, 146, 1)","error-50":"rgba(255, 152, 146, 0.5)","error-25":"rgba(255, 152, 146, 0.25)","error-15":"rgba(255, 152, 146, 0.15)","error-5":"rgba(255, 152, 146, 0.05)","warning-100":"rgba(249, 162, 33, 1)","warning-50":"rgba(249, 162, 33, 0.5)","warning-25":"rgba(249, 162, 33, 0.25)","warning-15":"rgba(249, 162, 33, 0.15)","warning-5":"rgba(249, 162, 33, 0.05)","info-100":"rgba(133, 233, 183, 1)","info-50":"rgba(133, 233, 183, 0.5)","info-25":"rgba(133, 233, 183, 0.25)","info-15":"rgba(133, 233, 183, 0.15)","info-5":"rgba(133, 233, 183, 0.05)","neutral-100":"rgba(85, 221, 221, 1)","neutral-50":"rgba(85, 221, 221, 0.5)","neutral-25":"rgba(85, 221, 221, 0.25)","neutral-15":"rgba(85, 221, 221, 0.15)","neutral-5":"rgba(85, 221, 221, 0.05)"},background:{"error-gradual":"linear-gradient(90deg, #FFCECB 0%, rgba(255,235,233,0.35) 100%)","warning-gradual":"linear-gradient(90deg, #FFE4BC 0%, rgba(255,250,233,0.35) 100%)","success-gradual":"linear-gradient(90deg, #D5ECBE 0%, rgba(234,255,233,0.35) 100%)"},button:{background:"rgba(103, 186, 145, 0.10)","border-color":"rgba(80, 165, 122, 1)","text-color":"rgba(80, 165, 122, 1)","active-background-color":"rgba(80, 165, 122, 1)","active-border-color":"rgba(154, 209, 162, 1)","active-text-color":"#fff"},checkbox:{background:"rgba(216, 233, 219, 1)","icon-color":"rgba(80, 165, 122, 0)","border-color":"rgba(154, 209, 162, 1)","checked-background":"rgba(216, 233, 219, 1)","checked-icon-color":"rgba(80, 165, 122, 1)","checked-border-color":"rgba(154, 209, 162, 1)"},input:{background:"rgba(237, 246, 239, 1)","border-color":"rgba(80, 165, 122, 1)",color:"rgba(29, 75, 52, 1)","placeholder-color":"rgba(80, 165, 122, 1)","hover-background":"rgba(237, 246, 239, 0.30)","hover-border-color":"rgba(80, 165, 122, 1)","hover-color":"rgba(80, 165, 122, 1)","active-background":"rgba(237, 246, 239, 0.30)","active-border-color":"rgba(80, 165, 122, 1)","active-color":"rgba(80, 165, 122, 1)","disabled-background":"rgba(237, 246, 239, 1)","disabled-border-color":"rgba(237, 246, 239, 1)","disabled-color":"rgba(83, 83, 83, 1)"},select:{"dropdown-background":"rgba(237, 246, 239, 1)","dropdown-border-color":"rgba(80, 165, 122, 1)","dropdown-item-color":"rgba(80, 165, 122, 1)","dropdown-item-hover-background":"rgba(178, 220, 198, 1)","dropdown-item-hover-color":"rgba(29, 75, 52, 1)","dropdown-item-selected-background":"rgba(178, 220, 198, 1)","dropdown-item-selected-color":"rgba(29, 75, 52, 1)"},layout:{},table:{},chart:{},message:{}},cloud:{},"station-control-center":{}},blue:{common:{"--test1":"#fff","--test2":"#ccc"},cloud:{},"station-control-center":{}}},t=()=>{const r=e();localStorage.getItem("yxTheme")||localStorage.setItem("yxTheme",r);const o=document.documentElement,a=n[r].common;Object.keys(a).forEach(g=>{Object.keys(a[g]).forEach(c=>{const b=`--${g}-${c}`;o.style.setProperty(c,b)})})},l=r=>{localStorage.setItem("yxTheme",r),t()},e=()=>localStorage.getItem("yxTheme")||"green",d=r=>{const o=e();return n[o][r]||{}};exports.changeTheme=l;exports.getCurTheme=e;exports.getSystemThemeConfig=d;exports.install=t;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n={green:{common:{color:{"main-100":"rgba(80, 165, 122, 1)","main-50":"rgba(80, 165, 122, 0.5)","main-25":"rgba(80, 165, 122, 0.25)","main-15":"rgba(80, 165, 122, 0.15)","main-5":"rgba(80, 165, 122, 0.05)","error-100":"rgba(255, 152, 146, 1)","error-50":"rgba(255, 152, 146, 0.5)","error-25":"rgba(255, 152, 146, 0.25)","error-15":"rgba(255, 152, 146, 0.15)","error-5":"rgba(255, 152, 146, 0.05)","warning-100":"rgba(249, 162, 33, 1)","warning-50":"rgba(249, 162, 33, 0.5)","warning-25":"rgba(249, 162, 33, 0.25)","warning-15":"rgba(249, 162, 33, 0.15)","warning-5":"rgba(249, 162, 33, 0.05)","info-100":"rgba(133, 233, 183, 1)","info-50":"rgba(133, 233, 183, 0.5)","info-25":"rgba(133, 233, 183, 0.25)","info-15":"rgba(133, 233, 183, 0.15)","info-5":"rgba(133, 233, 183, 0.05)","neutral-100":"rgba(85, 221, 221, 1)","neutral-50":"rgba(85, 221, 221, 0.5)","neutral-25":"rgba(85, 221, 221, 0.25)","neutral-15":"rgba(85, 221, 221, 0.15)","neutral-5":"rgba(85, 221, 221, 0.05)"},background:{"error-gradual":"linear-gradient(90deg, #FFCECB 0%, rgba(255,235,233,0.35) 100%)","warning-gradual":"linear-gradient(90deg, #FFE4BC 0%, rgba(255,250,233,0.35) 100%)","success-gradual":"linear-gradient(90deg, #D5ECBE 0%, rgba(234,255,233,0.35) 100%)"},button:{background:"rgba(103, 186, 145, 0.10)","border-color":"rgba(80, 165, 122, 1)","text-color":"rgba(80, 165, 122, 1)","active-background-color":"rgba(80, 165, 122, 1)","active-border-color":"rgba(154, 209, 162, 1)","active-text-color":"#fff"},checkbox:{background:"rgba(216, 233, 219, 1)","icon-color":"rgba(80, 165, 122, 0)","border-color":"rgba(154, 209, 162, 1)","checked-background":"rgba(216, 233, 219, 1)","checked-icon-color":"rgba(80, 165, 122, 1)","checked-border-color":"rgba(154, 209, 162, 1)"},input:{background:"rgba(237, 246, 239, 1)","border-color":"rgba(80, 165, 122, 1)",color:"rgba(29, 75, 52, 1)","placeholder-color":"rgba(80, 165, 122, 1)","hover-background":"rgba(237, 246, 239, 0.30)","hover-border-color":"rgba(80, 165, 122, 1)","hover-color":"rgba(80, 165, 122, 1)","active-background":"rgba(237, 246, 239, 0.30)","active-border-color":"rgba(80, 165, 122, 1)","active-color":"rgba(80, 165, 122, 1)","disabled-background":"rgba(237, 246, 239, 1)","disabled-border-color":"rgba(237, 246, 239, 1)","disabled-color":"rgba(83, 83, 83, 1)"},select:{"dropdown-background":"rgba(237, 246, 239, 1)","dropdown-border-color":"rgba(80, 165, 122, 1)","dropdown-item-color":"rgba(80, 165, 122, 1)","dropdown-item-hover-background":"rgba(178, 220, 198, 1)","dropdown-item-hover-color":"rgba(29, 75, 52, 1)","dropdown-item-selected-background":"rgba(178, 220, 198, 1)","dropdown-item-selected-color":"rgba(29, 75, 52, 1)"},layout:{},table:{},chart:{},message:{}},cloud:{},"station-control-center":{}},blue:{common:{"--test1":"#fff","--test2":"#ccc"},cloud:{},"station-control-center":{}}},t=()=>{const r=g();localStorage.getItem("yxTheme")||localStorage.setItem("yxTheme",r);const o=document.documentElement,e=n[r].common;Object.keys(e).forEach(a=>{Object.keys(e[a]).forEach(c=>{const b=`--${a}-${c}`;o.style.setProperty(b,e[a][c])})})},l=r=>{localStorage.setItem("yxTheme",r),t()},g=()=>localStorage.getItem("yxTheme")||"green",d=r=>{const o=g();return n[o][r]||{}};exports.changeTheme=l;exports.getCurTheme=g;exports.getSystemThemeConfig=d;exports.install=t;
package/lib/theme.es.js CHANGED
@@ -110,18 +110,18 @@ const c = {
110
110
  Object.keys(e).forEach((a) => {
111
111
  Object.keys(e[a]).forEach((g) => {
112
112
  const n = `--${a}-${g}`;
113
- o.style.setProperty(g, n);
113
+ o.style.setProperty(n, e[a][g]);
114
114
  });
115
115
  });
116
- }, l = (r) => {
116
+ }, d = (r) => {
117
117
  localStorage.setItem("yxTheme", r), t();
118
- }, b = () => localStorage.getItem("yxTheme") || "green", d = (r) => {
118
+ }, b = () => localStorage.getItem("yxTheme") || "green", l = (r) => {
119
119
  const o = b();
120
120
  return c[o][r] || {};
121
121
  };
122
122
  export {
123
- l as changeTheme,
123
+ d as changeTheme,
124
124
  b as getCurTheme,
125
- d as getSystemThemeConfig,
125
+ l as getSystemThemeConfig,
126
126
  t as install
127
127
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "yxuse",
3
- "version": "1.0.8",
3
+ "version": "1.0.10",
4
4
  "private": false,
5
5
  "keywords": [
6
6
  "yx"