unika-components 1.0.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 +61 -0
- package/dist/src/components/LongPage/LongPage.vue.d.ts +20 -0
- package/dist/src/components/LongPage/index.d.ts +2 -0
- package/dist/src/components/SwiperPage/SwiperPage.vue.d.ts +20 -0
- package/dist/src/components/SwiperPage/index.d.ts +2 -0
- package/dist/src/components/UniImage/UniImage.vue.d.ts +11 -0
- package/dist/src/components/UniImage/index.d.ts +2 -0
- package/dist/src/components/UniShape/UniShape.vue.d.ts +11 -0
- package/dist/src/components/UniShape/index.d.ts +2 -0
- package/dist/src/components/UniText/UniText.vue.d.ts +11 -0
- package/dist/src/components/UniText/index.d.ts +2 -0
- package/dist/src/defaultProps.d.ts +252 -0
- package/dist/src/hooks/useComponentClick.d.ts +2 -0
- package/dist/src/hooks/useStylePick.d.ts +3 -0
- package/dist/src/index.d.ts +12 -0
- package/dist/tests/unit/UniImage.spec.d.ts +1 -0
- package/dist/tests/unit/UniText.spec.d.ts +1 -0
- package/dist/unika-components.css +16 -0
- package/dist/unika-components.esm.js +3688 -0
- package/dist/unika-components.umd.js +3702 -0
- package/package.json +73 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2023 uniecard
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# Unika 业务组件库
|
|
2
|
+
|
|
3
|
+
### 提供一个业务组件库在编辑器和 H5 页面中都可以使用
|
|
4
|
+
该组件包导出两种格式的模块,供不同情况下使用
|
|
5
|
+
|
|
6
|
+
```javascript
|
|
7
|
+
// umd 格式
|
|
8
|
+
"main": "dist/unika-components.umd.js",
|
|
9
|
+
// es modules 格式
|
|
10
|
+
"module": "dist/unika-components.esm.js",
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## 安装和使用
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
// 安装
|
|
17
|
+
npm install unika-components --save
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
```javascript
|
|
21
|
+
import Unika from 'unika-components'
|
|
22
|
+
// 加载样式
|
|
23
|
+
import 'unika-components/dist/unika-components.css'
|
|
24
|
+
|
|
25
|
+
const app = createApp(App)
|
|
26
|
+
// 全局引入 目前包括 FinalPage, LText, LImage , Lshape三个组件
|
|
27
|
+
app.use(Unika)
|
|
28
|
+
|
|
29
|
+
app.mount('#app')
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
### 渲染最终页面
|
|
33
|
+
```javascript
|
|
34
|
+
setup() {
|
|
35
|
+
// 使用 finalPage 组件进行渲染,使用我们预定义好的数据结构
|
|
36
|
+
const testData = {
|
|
37
|
+
// 页面上面一个个组件的属性
|
|
38
|
+
components: [
|
|
39
|
+
{id: '123', name: 'uni-text', props: { text: 'hello', top: '0', left: '20px'}},
|
|
40
|
+
{id: '234', name: 'uni-image', props: { imageSrc: 'http://vue-maker.oss-cn-hangzhou.aliyuncs.com/vue-marker/5f6338e666336111f73d220c.png', top: '30px', left: '20px'}},
|
|
41
|
+
{id: '235', name: 'uni-shape', props: { backgroundColor: 'red', top: '50px', left: '20px', width: '100px', height: '100px'}},
|
|
42
|
+
// 这是一个链接
|
|
43
|
+
{id: '345', name: 'uni-text', props: { backgroundColor: "#1890ff", color: "#ffffff", text: "按钮内容", width: "100px", actionType: "to", url: "http://www.baidu.com", top: '200px', left: '150px',
|
|
44
|
+
}}
|
|
45
|
+
]
|
|
46
|
+
}
|
|
47
|
+
return {
|
|
48
|
+
testData
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
```html
|
|
54
|
+
<final-page :components="testData.components"></final-page>
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## 最终页面效果
|
|
58
|
+
|
|
59
|
+

|
|
60
|
+
|
|
61
|
+
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { PropType } from 'vue';
|
|
2
|
+
import { ComponentData, WorkData } from '../../defaultProps';
|
|
3
|
+
declare const _default: import("vue").DefineComponent<{
|
|
4
|
+
work: {
|
|
5
|
+
type: PropType<WorkData>;
|
|
6
|
+
};
|
|
7
|
+
components: {
|
|
8
|
+
type: PropType<ComponentData[]>;
|
|
9
|
+
required: true;
|
|
10
|
+
};
|
|
11
|
+
}, unknown, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
12
|
+
work: {
|
|
13
|
+
type: PropType<WorkData>;
|
|
14
|
+
};
|
|
15
|
+
components: {
|
|
16
|
+
type: PropType<ComponentData[]>;
|
|
17
|
+
required: true;
|
|
18
|
+
};
|
|
19
|
+
}>>, {}, {}>;
|
|
20
|
+
export default _default;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { PropType } from 'vue';
|
|
2
|
+
import { ComponentData, PageData } from '../../defaultProps';
|
|
3
|
+
declare const _default: import("vue").DefineComponent<{
|
|
4
|
+
page: {
|
|
5
|
+
type: PropType<PageData>;
|
|
6
|
+
};
|
|
7
|
+
components: {
|
|
8
|
+
type: PropType<ComponentData[]>;
|
|
9
|
+
required: true;
|
|
10
|
+
};
|
|
11
|
+
}, unknown, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
12
|
+
page: {
|
|
13
|
+
type: PropType<PageData>;
|
|
14
|
+
};
|
|
15
|
+
components: {
|
|
16
|
+
type: PropType<ComponentData[]>;
|
|
17
|
+
required: true;
|
|
18
|
+
};
|
|
19
|
+
}>>, {}, {}>;
|
|
20
|
+
export default _default;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
declare const _default: import("vue").DefineComponent<{
|
|
2
|
+
[x: string]: any;
|
|
3
|
+
}, {
|
|
4
|
+
styleProps: import("vue").ComputedRef<Pick<any, string>>;
|
|
5
|
+
handleClick: () => void;
|
|
6
|
+
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
7
|
+
[x: string]: any;
|
|
8
|
+
}>>, {
|
|
9
|
+
[x: string]: any;
|
|
10
|
+
}, {}>;
|
|
11
|
+
export default _default;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
declare const _default: import("vue").DefineComponent<{
|
|
2
|
+
[x: string]: any;
|
|
3
|
+
}, {
|
|
4
|
+
styleProps: import("vue").ComputedRef<Pick<any, string>>;
|
|
5
|
+
handleClick: () => void;
|
|
6
|
+
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
7
|
+
[x: string]: any;
|
|
8
|
+
}>>, {
|
|
9
|
+
[x: string]: any;
|
|
10
|
+
}, {}>;
|
|
11
|
+
export default _default;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
declare const _default: import("vue").DefineComponent<{
|
|
2
|
+
[x: string]: any;
|
|
3
|
+
}, {
|
|
4
|
+
styleProps: import("vue").ComputedRef<Pick<any, string>>;
|
|
5
|
+
handleClick: () => void;
|
|
6
|
+
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
7
|
+
[x: string]: any;
|
|
8
|
+
}>>, {
|
|
9
|
+
[x: string]: any;
|
|
10
|
+
}, {}>;
|
|
11
|
+
export default _default;
|
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
export interface ComponentData {
|
|
2
|
+
props: {
|
|
3
|
+
[key: string]: any;
|
|
4
|
+
};
|
|
5
|
+
id: string;
|
|
6
|
+
name: string;
|
|
7
|
+
layerName?: string;
|
|
8
|
+
isHidden?: boolean;
|
|
9
|
+
isLocked?: boolean;
|
|
10
|
+
}
|
|
11
|
+
export interface PageData {
|
|
12
|
+
id: string;
|
|
13
|
+
components: ComponentData[];
|
|
14
|
+
title?: string;
|
|
15
|
+
props?: {
|
|
16
|
+
[key: string]: any;
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
export interface WorkData {
|
|
20
|
+
props?: {
|
|
21
|
+
[key: string]: any;
|
|
22
|
+
};
|
|
23
|
+
id?: number;
|
|
24
|
+
pages: PageData[];
|
|
25
|
+
setting?: {
|
|
26
|
+
[key: string]: any;
|
|
27
|
+
};
|
|
28
|
+
type?: string;
|
|
29
|
+
width?: string;
|
|
30
|
+
height?: string;
|
|
31
|
+
pageMode?: string;
|
|
32
|
+
isPublish?: boolean;
|
|
33
|
+
title?: string;
|
|
34
|
+
desc?: string;
|
|
35
|
+
coverImg?: string;
|
|
36
|
+
uuid?: string;
|
|
37
|
+
latestPublishAt?: string;
|
|
38
|
+
updatedAt?: string;
|
|
39
|
+
isTemplate?: boolean;
|
|
40
|
+
isHot?: boolean;
|
|
41
|
+
isNew?: boolean;
|
|
42
|
+
author?: string;
|
|
43
|
+
copiedCount?: number;
|
|
44
|
+
status?: string;
|
|
45
|
+
shareImg?: string;
|
|
46
|
+
music?: {
|
|
47
|
+
id: string;
|
|
48
|
+
name: string;
|
|
49
|
+
url: string;
|
|
50
|
+
status: boolean;
|
|
51
|
+
duration: number;
|
|
52
|
+
isPlaying: false;
|
|
53
|
+
props: {
|
|
54
|
+
[key: string]: any;
|
|
55
|
+
};
|
|
56
|
+
};
|
|
57
|
+
user?: {
|
|
58
|
+
gender: string;
|
|
59
|
+
nickName: string;
|
|
60
|
+
picture: string;
|
|
61
|
+
userName: string;
|
|
62
|
+
};
|
|
63
|
+
datasources?: Array<{
|
|
64
|
+
[key: string]: any;
|
|
65
|
+
}>;
|
|
66
|
+
}
|
|
67
|
+
export declare const commonDefaultProps: {
|
|
68
|
+
actionType: string;
|
|
69
|
+
url: string;
|
|
70
|
+
height: string;
|
|
71
|
+
width: string;
|
|
72
|
+
paddingLeft: string;
|
|
73
|
+
paddingRight: string;
|
|
74
|
+
paddingTop: string;
|
|
75
|
+
paddingBottom: string;
|
|
76
|
+
borderStyle: string;
|
|
77
|
+
borderColor: string;
|
|
78
|
+
borderWidth: string;
|
|
79
|
+
borderRadius: string;
|
|
80
|
+
boxShadow: string;
|
|
81
|
+
opacity: number;
|
|
82
|
+
position: string;
|
|
83
|
+
left: string;
|
|
84
|
+
top: string;
|
|
85
|
+
right: string;
|
|
86
|
+
};
|
|
87
|
+
export declare const textDefaultProps: {
|
|
88
|
+
actionType: string;
|
|
89
|
+
url: string;
|
|
90
|
+
height: string;
|
|
91
|
+
width: string;
|
|
92
|
+
paddingLeft: string;
|
|
93
|
+
paddingRight: string;
|
|
94
|
+
paddingTop: string;
|
|
95
|
+
paddingBottom: string;
|
|
96
|
+
borderStyle: string;
|
|
97
|
+
borderColor: string;
|
|
98
|
+
borderWidth: string;
|
|
99
|
+
borderRadius: string;
|
|
100
|
+
boxShadow: string;
|
|
101
|
+
opacity: number;
|
|
102
|
+
position: string;
|
|
103
|
+
left: string;
|
|
104
|
+
top: string;
|
|
105
|
+
right: string;
|
|
106
|
+
text: string;
|
|
107
|
+
fontSize: string;
|
|
108
|
+
fontFamily: string;
|
|
109
|
+
fontWeight: string;
|
|
110
|
+
fontStyle: string;
|
|
111
|
+
textDecoration: string;
|
|
112
|
+
lineHeight: string;
|
|
113
|
+
textAlign: string;
|
|
114
|
+
color: string;
|
|
115
|
+
backgroundColor: string;
|
|
116
|
+
};
|
|
117
|
+
export declare const imageDefaultProps: {
|
|
118
|
+
actionType: string;
|
|
119
|
+
url: string;
|
|
120
|
+
height: string;
|
|
121
|
+
width: string;
|
|
122
|
+
paddingLeft: string;
|
|
123
|
+
paddingRight: string;
|
|
124
|
+
paddingTop: string;
|
|
125
|
+
paddingBottom: string;
|
|
126
|
+
borderStyle: string;
|
|
127
|
+
borderColor: string;
|
|
128
|
+
borderWidth: string;
|
|
129
|
+
borderRadius: string;
|
|
130
|
+
boxShadow: string;
|
|
131
|
+
opacity: number;
|
|
132
|
+
position: string;
|
|
133
|
+
left: string;
|
|
134
|
+
top: string;
|
|
135
|
+
right: string;
|
|
136
|
+
imageSrc: string;
|
|
137
|
+
};
|
|
138
|
+
export declare const shapeDefaultProps: {
|
|
139
|
+
actionType: string;
|
|
140
|
+
url: string;
|
|
141
|
+
height: string;
|
|
142
|
+
width: string;
|
|
143
|
+
paddingLeft: string;
|
|
144
|
+
paddingRight: string;
|
|
145
|
+
paddingTop: string;
|
|
146
|
+
paddingBottom: string;
|
|
147
|
+
borderStyle: string;
|
|
148
|
+
borderColor: string;
|
|
149
|
+
borderWidth: string;
|
|
150
|
+
borderRadius: string;
|
|
151
|
+
boxShadow: string;
|
|
152
|
+
opacity: number;
|
|
153
|
+
position: string;
|
|
154
|
+
left: string;
|
|
155
|
+
top: string;
|
|
156
|
+
right: string;
|
|
157
|
+
backgroundColor: string;
|
|
158
|
+
};
|
|
159
|
+
export declare const componentsDefaultProps: {
|
|
160
|
+
'uni-text': {
|
|
161
|
+
props: {
|
|
162
|
+
actionType: string;
|
|
163
|
+
url: string;
|
|
164
|
+
height: string;
|
|
165
|
+
width: string;
|
|
166
|
+
paddingLeft: string;
|
|
167
|
+
paddingRight: string;
|
|
168
|
+
paddingTop: string;
|
|
169
|
+
paddingBottom: string;
|
|
170
|
+
borderStyle: string;
|
|
171
|
+
borderColor: string;
|
|
172
|
+
borderWidth: string;
|
|
173
|
+
borderRadius: string;
|
|
174
|
+
boxShadow: string;
|
|
175
|
+
opacity: number;
|
|
176
|
+
position: string;
|
|
177
|
+
left: string;
|
|
178
|
+
top: string;
|
|
179
|
+
right: string;
|
|
180
|
+
text: string;
|
|
181
|
+
fontSize: string;
|
|
182
|
+
fontFamily: string;
|
|
183
|
+
fontWeight: string;
|
|
184
|
+
fontStyle: string;
|
|
185
|
+
textDecoration: string;
|
|
186
|
+
lineHeight: string;
|
|
187
|
+
textAlign: string;
|
|
188
|
+
color: string;
|
|
189
|
+
backgroundColor: string;
|
|
190
|
+
};
|
|
191
|
+
};
|
|
192
|
+
'uni-image': {
|
|
193
|
+
props: {
|
|
194
|
+
actionType: string;
|
|
195
|
+
url: string;
|
|
196
|
+
height: string;
|
|
197
|
+
width: string;
|
|
198
|
+
paddingLeft: string;
|
|
199
|
+
paddingRight: string;
|
|
200
|
+
paddingTop: string;
|
|
201
|
+
paddingBottom: string;
|
|
202
|
+
borderStyle: string;
|
|
203
|
+
borderColor: string;
|
|
204
|
+
borderWidth: string;
|
|
205
|
+
borderRadius: string;
|
|
206
|
+
boxShadow: string;
|
|
207
|
+
opacity: number;
|
|
208
|
+
position: string;
|
|
209
|
+
left: string;
|
|
210
|
+
top: string;
|
|
211
|
+
right: string;
|
|
212
|
+
imageSrc: string;
|
|
213
|
+
};
|
|
214
|
+
};
|
|
215
|
+
'uni-shape': {
|
|
216
|
+
props: {
|
|
217
|
+
actionType: string;
|
|
218
|
+
url: string;
|
|
219
|
+
height: string;
|
|
220
|
+
width: string;
|
|
221
|
+
paddingLeft: string;
|
|
222
|
+
paddingRight: string;
|
|
223
|
+
paddingTop: string;
|
|
224
|
+
paddingBottom: string;
|
|
225
|
+
borderStyle: string;
|
|
226
|
+
borderColor: string;
|
|
227
|
+
borderWidth: string;
|
|
228
|
+
borderRadius: string;
|
|
229
|
+
boxShadow: string;
|
|
230
|
+
opacity: number;
|
|
231
|
+
position: string;
|
|
232
|
+
left: string;
|
|
233
|
+
top: string;
|
|
234
|
+
right: string;
|
|
235
|
+
backgroundColor: string;
|
|
236
|
+
};
|
|
237
|
+
};
|
|
238
|
+
};
|
|
239
|
+
export declare const isEditingProp: {
|
|
240
|
+
isEditing: {
|
|
241
|
+
type: BooleanConstructor;
|
|
242
|
+
default: boolean;
|
|
243
|
+
};
|
|
244
|
+
};
|
|
245
|
+
export declare const transformToComponentProps: (props: {
|
|
246
|
+
[key: string]: any;
|
|
247
|
+
}, extraProps?: {
|
|
248
|
+
[key: string]: any;
|
|
249
|
+
} | undefined) => {
|
|
250
|
+
[x: string]: any;
|
|
251
|
+
};
|
|
252
|
+
export default componentsDefaultProps;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { App } from 'vue';
|
|
2
|
+
import UniText from './components/UniText';
|
|
3
|
+
import UniImage from './components/UniImage';
|
|
4
|
+
import UniShape from './components/UniShape';
|
|
5
|
+
import LongPage from './components/LongPage';
|
|
6
|
+
import SwiperPage from './components/SwiperPage';
|
|
7
|
+
declare const install: (app: App) => void;
|
|
8
|
+
export { UniText, UniImage, UniShape, LongPage, SwiperPage, install };
|
|
9
|
+
declare const _default: {
|
|
10
|
+
install: (app: App<any>) => void;
|
|
11
|
+
};
|
|
12
|
+
export default _default;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
|
|
2
|
+
.uni-image-component {
|
|
3
|
+
max-width: 100%;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
h2.uni-text-component, p.uni-text-component {
|
|
7
|
+
margin-bottom: 0;
|
|
8
|
+
}
|
|
9
|
+
button.uni-text-component {
|
|
10
|
+
padding: 5px 10px;
|
|
11
|
+
cursor: pointer;
|
|
12
|
+
}
|
|
13
|
+
.uni-text-component {
|
|
14
|
+
box-sizing: border-box;
|
|
15
|
+
white-space: pre-wrap;
|
|
16
|
+
}
|