@fonixtree/magic-design 0.0.5 → 0.0.6

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 ADDED
@@ -0,0 +1,311 @@
1
+ # 设计器二期
2
+
3
+ ## 1、基本概念
4
+
5
+ ### 1.1、元组件:构成复合组件的最小单位
6
+
7
+ Text、Image、Button、Divider、Video 等
8
+
9
+ ### 1.2、复合组件:由若干个元组件构成的一个大组件
10
+
11
+ Text、Banner、Image Gallery、Image and Text、Carousel、Reward、Newsletter 等
12
+
13
+ ### 1.3、业务公共组件:项目中复用的公共组件
14
+
15
+ 所有的公共组件需要开放 value 和 onChange Api(除 Button、Iconfont)
16
+
17
+ Button、Iconfont、AlignSelecter、Collapse、ColorPicker、ImagePicker、LayoutSelecter、Slider、UrlPicker
18
+
19
+ ## 2、元组件
20
+
21
+ ### 2.1
22
+
23
+ 元组件类型:
24
+
25
+ TEXT、IMAGE、BUTTON、DIVIDER、VIDEO
26
+
27
+ 元组件报文格式:
28
+
29
+ ```json
30
+ {
31
+ id:'xxxx' //元组件key
32
+ type: 'TYPE', //元组件类型
33
+ style:{
34
+ fontFamily:'xxx', //字体
35
+ ...css //属性名称尽量使用标准css名称
36
+ },
37
+ hoverStyle:{
38
+
39
+ }
40
+ }
41
+ ```
42
+
43
+ 动态设置 hover 效果
44
+
45
+ onMouseEnter={e => { e.target.style.color = 'red'; }}
46
+
47
+ onMouseLeave={e => { e.target.style.color = 'white'; }}
48
+
49
+ 文本可编辑
50
+
51
+ contenteditable="true"
52
+
53
+ ### 2.2 、元组件报文
54
+
55
+ #### Text
56
+
57
+ ```json
58
+ {
59
+ id:'xxxx' //元组件key
60
+ type: 'TYPE', //元组件类型
61
+ content:'this is text',
62
+ style:{
63
+ fontFamily:'xxx', //字体
64
+ fontSize: '14px',
65
+ width: '200px',
66
+ ...css
67
+ }
68
+ }
69
+ ```
70
+
71
+ #### Image
72
+
73
+ ```json
74
+ {
75
+ id:'xxxx' //元组件key
76
+ type: 'IMAGE', //元组件类型
77
+ name:'123.png',
78
+ src:'../image.png', //图片地址
79
+ url:'www.baidu.com', //图片跳转地址
80
+ style:{
81
+ width: '200px',
82
+ ...css
83
+ },
84
+ hoverStyle:{ //hover 类型为new时保存src,类型为enlarge时保存scale
85
+ scale: '2',
86
+ src:'../image1.png',
87
+ }
88
+ }
89
+ ```
90
+
91
+ #### Button
92
+
93
+ ```json
94
+ {
95
+ id:'xxxx' //元组件key
96
+ type: 'BUTTON', //元组件类型
97
+ name:'Submit',
98
+ url: 'www.baidu.com',
99
+ style:{
100
+ buttonIconSrc:'../img.png',
101
+ buttonIconPlace: 'left',
102
+ color:'#FEFEFE',
103
+ border: '1px solid red',
104
+ borderRadius:'10px',
105
+ fontFamily:'xxx', //字体
106
+ fontSize: '14px',
107
+ ...css
108
+ },
109
+ hoverStyle {
110
+ color:'#FEFEFE',
111
+ border: '1px solid red',
112
+ fontFamily:'xxx', //字体
113
+ fontSize: '14px',
114
+ ...css
115
+ }
116
+ }
117
+ ```
118
+
119
+ ## 2、复合组件
120
+
121
+ ### 2.1
122
+
123
+ 元组件类型:
124
+
125
+ TEXT、BANNER、IMAGE_GALLERT、IMAGE_TEXT、CAROUSEL、REWARD、NEWSLETTER
126
+
127
+ 复合组件报文格式:
128
+
129
+ ```json
130
+ {
131
+ id:'xxxx' //复合组件key
132
+ type: 'TYPE', //复合组件类型
133
+ setting:{ //开关类型的配置及属性配置放在这里
134
+ autoplays: 3, //3秒轮播
135
+ },
136
+ groupSource:[], //元组件集合组数据放在这里
137
+ metas:{
138
+ title:{
139
+ open:false,
140
+ type:'IMAGE'
141
+ ...metaCompJson
142
+ },
143
+ subTitle:{
144
+ open:false,
145
+ type:'IMAGE'
146
+ ...metaCompJson
147
+ }
148
+ },
149
+ customize:{
150
+ layout:'',
151
+ background:{
152
+
153
+ }
154
+ }
155
+ }
156
+ ```
157
+
158
+ #### Text
159
+
160
+ ```js
161
+ {
162
+ id: 'xxxx', //复合组件key
163
+ type: 'TEXT', //复合组件类型
164
+ setting:{
165
+ layout:'left', // 模块布局 left/center/right ,每一个layout可能都是一个不同的组件
166
+ title:{
167
+ type:'TEXT'
168
+ ...metaCompJson
169
+ },
170
+ subtitle:{
171
+ type:'TEXT'
172
+ ...metaCompJson
173
+ },
174
+ },
175
+ source:[
176
+ { //此处可以抽出业务组件
177
+ title:{
178
+ type:'TEXT'
179
+ ...metaCompJson
180
+ },
181
+ content:{
182
+ type:'TEXT'
183
+ ...metaCompJson
184
+ }
185
+ }
186
+ ],
187
+ style:{
188
+ align:'left', //文本布局 left/center/right
189
+ backgroundColor: 'red',
190
+ backgroundImage:'../image.png'
191
+ }
192
+ }
193
+ ```
194
+
195
+ #### Banner
196
+
197
+ modifySetting
198
+
199
+ ```json
200
+ {
201
+ "comositeId": "1111",
202
+
203
+ "value": {
204
+ "autoplays": 4
205
+ }
206
+ }
207
+ ```
208
+
209
+ ```json
210
+ {
211
+ id: 'xxxx',
212
+ type: 'BANNER',
213
+ setting:{
214
+ open:false
215
+ autoplays: 3, //3秒轮播
216
+ arrows:{ // 滚动箭头
217
+ open:false,
218
+ color:'red',
219
+ size:'',
220
+ hoverSize:'',
221
+ hoverColor:'green',
222
+ },
223
+ dots:{ //面板指示点
224
+ open:false,
225
+ color: 'red',
226
+ size:'',
227
+ hoverSize:''
228
+ hoverColor:'green',
229
+ },
230
+ },
231
+ groupSource:[
232
+ { //此处可以作为一个业务组件
233
+ id:'xxxxx',
234
+ image:{
235
+ open:false,
236
+ type:'IMAGE'
237
+ ...metaCompJson
238
+ },
239
+ title:{
240
+ open:false,
241
+ type:'TEXT',
242
+ ...metaCompJson
243
+ },
244
+ content:{
245
+ open:false,
246
+ type:'TEXT',
247
+ ...metaCompJson
248
+ },
249
+ button:{
250
+ type:'BUTTON',
251
+ ...metaCompJson
252
+ },
253
+ secondaryButton:{
254
+ type:'BUTTON',
255
+ ...metaCompJson
256
+ },
257
+ layout:'center',
258
+ align:'left',
259
+ //文本布局 left/center/right
260
+ }
261
+ ]
262
+ }
263
+ ```
264
+
265
+ #### Image Gallery
266
+
267
+ ```json
268
+
269
+ ```
270
+
271
+ #### Image and Text
272
+
273
+ ```json
274
+ {
275
+ id:'xxxx'
276
+ type: 'IMAGE_TEXT',
277
+ setting:{
278
+ layout:'left',
279
+ title:{},
280
+ subtitle:{},
281
+ button:{},
282
+ secondaryButton:{}
283
+ },
284
+ source:[
285
+
286
+ ],
287
+ style:{
288
+ align:'left',
289
+ backgroundColor:'red',
290
+ backgroundImage:'./img.png'
291
+ }
292
+ }
293
+ ```
294
+
295
+ 疑问:
296
+
297
+ Text 元组件
298
+
299
+ 文字链接配置好之后,怎么删除
300
+
301
+ 链接配置的规则,按单词还是字符
302
+
303
+ image 元组件
304
+
305
+ 属性控制进度条和输入框是否要限制最大最小值
306
+
307
+ button 元组件
308
+
309
+ 是否需要 icon 的 hover 效果
310
+
311
+ banner 中的 text Align 放在元组件里?
package/es/mobx/Store.js CHANGED
@@ -25,6 +25,8 @@ function () {
25
25
 
26
26
  this.MPageData = []; // 楼层数据
27
27
 
28
+ this.CarouselStore = {}; // 轮播组件暂存数据
29
+
28
30
  (0, _mobx.makeObservable)(this, {
29
31
  hoveredMeta: _mobx.observable,
30
32
  clickedMeta: _mobx.observable,
package/lib/mobx/Store.js CHANGED
@@ -25,6 +25,8 @@ function () {
25
25
 
26
26
  this.MPageData = []; // 楼层数据
27
27
 
28
+ this.CarouselStore = {}; // 轮播组件暂存数据
29
+
28
30
  (0, _mobx.makeObservable)(this, {
29
31
  hoveredMeta: _mobx.observable,
30
32
  clickedMeta: _mobx.observable,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@fonixtree/magic-design",
3
3
  "author": "Cylon Team",
4
- "version": "0.0.5",
4
+ "version": "0.0.6",
5
5
  "description": "Magic Design",
6
6
  "license": "MIT",
7
7
  "module": "es/index.js",
@@ -15,7 +15,7 @@
15
15
  "export": "rm -rf dist && npx rollup --config ./config/rollup.config.js",
16
16
  "compile": "rc-tools run compile --src=src/components --babel-runtime && cp -r ./src/components/assets/fonts ./es/assets&& cp -r ./src/components/assets/fonts ./lib/assets",
17
17
  "push:h5": "cp -r ./pub-dist/es ../eshoph5_pto/node_modules/@fonixtree/magic-design/",
18
- "push:biz": "cp -r ./pub-dist/es ../bizme_pto/node_modules/@fonixtree/magic-design/"
18
+ "push:biz": "cp -r ./pub-dist/es ../bizme/node_modules/@fonixtree/magic-design/"
19
19
  },
20
20
  "dependencies": {
21
21
  "antd": "4.20.6",
@@ -33,6 +33,84 @@
33
33
  "react-slick": "^0.29.0",
34
34
  "slick-carousel": "^1.8.1"
35
35
  },
36
+ "devDependencies": {
37
+ "@babel/core": "^7.16.0",
38
+ "@pmmmwh/react-refresh-webpack-plugin": "^0.5.3",
39
+ "@rollup/plugin-babel": "^5.3.1",
40
+ "@rollup/plugin-commonjs": "^22.0.0",
41
+ "@rollup/plugin-image": "^2.1.1",
42
+ "@rollup/plugin-json": "^4.1.0",
43
+ "@rollup/plugin-node-resolve": "^13.3.0",
44
+ "@svgr/webpack": "^5.5.0",
45
+ "@types/axios": "^0.14.0",
46
+ "@types/lodash": "^4.14.182",
47
+ "@types/node": "^17.0.36",
48
+ "@types/react": "^18.0.9",
49
+ "@types/react-color": "^3.0.6",
50
+ "@types/react-dom": "^18.0.5",
51
+ "@types/uuid": "^8.3.4",
52
+ "@typescript-eslint/eslint-plugin": "^5.27.1",
53
+ "add": "^2.0.6",
54
+ "babel-loader": "^8.2.3",
55
+ "babel-plugin-named-asset-import": "^0.3.8",
56
+ "babel-preset-react-app": "^10.0.1",
57
+ "bfj": "^7.0.2",
58
+ "browserslist": "^4.18.1",
59
+ "camelcase": "^6.2.1",
60
+ "case-sensitive-paths-webpack-plugin": "^2.4.0",
61
+ "child_process": "^1.0.2",
62
+ "classnames": "^2.3.1",
63
+ "css-loader": "^6.5.1",
64
+ "css-minimizer-webpack-plugin": "^3.2.0",
65
+ "dotenv": "^10.0.0",
66
+ "dotenv-expand": "^5.1.0",
67
+ "eslint": "7",
68
+ "eslint-config-next": "^12.1.6",
69
+ "eslint-config-react-app": "^7.0.1",
70
+ "eslint-webpack-plugin": "^3.1.1",
71
+ "extract-zip": "^2.0.1",
72
+ "file-loader": "^6.2.0",
73
+ "fs-extra": "^10.0.0",
74
+ "html-webpack-plugin": "^5.5.0",
75
+ "http-proxy-middleware": "^2.0.6",
76
+ "identity-obj-proxy": "^3.0.0",
77
+ "less": "3.13.1",
78
+ "less-loader": "^11.0.0",
79
+ "mini-css-extract-plugin": "^2.4.5",
80
+ "mv": "^2.1.1",
81
+ "ora": "^4.1.1",
82
+ "postcss": "^8.4.4",
83
+ "postcss-flexbugs-fixes": "^5.0.2",
84
+ "postcss-loader": "^6.2.1",
85
+ "postcss-normalize": "^10.0.1",
86
+ "postcss-preset-env": "^7.0.1",
87
+ "postcss-px-to-viewport": "^1.1.1",
88
+ "postcss-selector-namespace": "^3.0.1",
89
+ "prompts": "^2.4.2",
90
+ "rc-tools": "^9.6.1-alpha.1",
91
+ "react-app-polyfill": "^3.0.0",
92
+ "react-dev-utils": "^12.0.1",
93
+ "react-refresh": "^0.11.0",
94
+ "resolve": "^1.20.0",
95
+ "resolve-url-loader": "^4.0.0",
96
+ "rollup-plugin-dts": "^4.2.2",
97
+ "rollup-plugin-peer-deps-external": "^2.2.4",
98
+ "rollup-plugin-postcss": "^4.0.2",
99
+ "rollup-plugin-styles": "^4.0.0",
100
+ "rollup-plugin-typescript2": "^0.32.1",
101
+ "sass-loader": "^12.3.0",
102
+ "semver": "^7.3.5",
103
+ "source-map-loader": "^3.0.0",
104
+ "style-loader": "^3.3.1",
105
+ "tailwindcss": "^3.0.2",
106
+ "terser-webpack-plugin": "^5.2.5",
107
+ "typescript": "^4.7.2",
108
+ "web-vitals": "^2.1.4",
109
+ "webpack": "^5.64.4",
110
+ "webpack-dev-server": "^4.6.0",
111
+ "webpack-manifest-plugin": "^4.0.2",
112
+ "workbox-webpack-plugin": "^6.4.1"
113
+ },
36
114
  "files": [
37
115
  "es",
38
116
  "lib",
@@ -65,4 +143,4 @@
65
143
  "@babel/preset-env"
66
144
  ]
67
145
  }
68
- }
146
+ }