hy-lego-bricks 0.1.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/README.md ADDED
@@ -0,0 +1,24 @@
1
+ # lego-bricks
2
+
3
+ ## Project setup
4
+ ```
5
+ pnpm install
6
+ ```
7
+
8
+ ### Compiles and hot-reloads for development
9
+ ```
10
+ pnpm run serve
11
+ ```
12
+
13
+ ### Compiles and minifies for production
14
+ ```
15
+ pnpm run build
16
+ ```
17
+
18
+ ### Lints and fixes files
19
+ ```
20
+ pnpm run lint
21
+ ```
22
+
23
+ ### Customize configuration
24
+ See [Configuration Reference](https://cli.vuejs.org/config/).
@@ -0,0 +1,20 @@
1
+
2
+ h2.l-text-component[data-v-6bf95b7a], p.l-text-component[data-v-6bf95b7a] {
3
+ margin-bottom: 0;
4
+ }
5
+ button.l-text-component[data-v-6bf95b7a] {
6
+ padding: 5px 10px;
7
+ cursor: pointer;
8
+ }
9
+ .l-text-component[data-v-6bf95b7a] {
10
+ box-sizing: border-box;
11
+ white-space: pre-wrap;
12
+ position: relative !important;
13
+ }
14
+
15
+
16
+ .l-image-component[data-v-1e970aa2] {
17
+ max-width: 100%;
18
+ position: relative !important;
19
+ }
20
+
@@ -0,0 +1,190 @@
1
+ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
2
+ src: {
3
+ type: StringConstructor;
4
+ default: string;
5
+ };
6
+ actionType: {
7
+ type: StringConstructor;
8
+ default: string;
9
+ };
10
+ url: {
11
+ type: StringConstructor;
12
+ default: string;
13
+ };
14
+ height: {
15
+ type: StringConstructor;
16
+ default: string;
17
+ };
18
+ width: {
19
+ type: StringConstructor;
20
+ default: string;
21
+ };
22
+ paddingLeft: {
23
+ type: StringConstructor;
24
+ default: string;
25
+ };
26
+ paddingRight: {
27
+ type: StringConstructor;
28
+ default: string;
29
+ };
30
+ paddingTop: {
31
+ type: StringConstructor;
32
+ default: string;
33
+ };
34
+ paddingBottom: {
35
+ type: StringConstructor;
36
+ default: string;
37
+ };
38
+ borderStyle: {
39
+ type: StringConstructor;
40
+ default: string;
41
+ };
42
+ borderColor: {
43
+ type: StringConstructor;
44
+ default: string;
45
+ };
46
+ borderWidth: {
47
+ type: StringConstructor;
48
+ default: string;
49
+ };
50
+ borderRadius: {
51
+ type: StringConstructor;
52
+ default: string;
53
+ };
54
+ boxShadow: {
55
+ type: StringConstructor;
56
+ default: string;
57
+ };
58
+ opacity: {
59
+ type: StringConstructor;
60
+ default: string;
61
+ };
62
+ position: {
63
+ type: StringConstructor;
64
+ default: string;
65
+ };
66
+ left: {
67
+ type: StringConstructor;
68
+ default: string;
69
+ };
70
+ top: {
71
+ type: StringConstructor;
72
+ default: string;
73
+ };
74
+ right: {
75
+ type: StringConstructor;
76
+ default: string;
77
+ };
78
+ isEditing: {
79
+ type: BooleanConstructor;
80
+ default: boolean;
81
+ };
82
+ }>, {
83
+ styleProps: import("vue").ComputedRef<Partial<Readonly<Partial<import("../../defaultProps").CommonComponentProps & {
84
+ isEditing: boolean;
85
+ }>>>>;
86
+ handleClick: () => void;
87
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
88
+ src: {
89
+ type: StringConstructor;
90
+ default: string;
91
+ };
92
+ actionType: {
93
+ type: StringConstructor;
94
+ default: string;
95
+ };
96
+ url: {
97
+ type: StringConstructor;
98
+ default: string;
99
+ };
100
+ height: {
101
+ type: StringConstructor;
102
+ default: string;
103
+ };
104
+ width: {
105
+ type: StringConstructor;
106
+ default: string;
107
+ };
108
+ paddingLeft: {
109
+ type: StringConstructor;
110
+ default: string;
111
+ };
112
+ paddingRight: {
113
+ type: StringConstructor;
114
+ default: string;
115
+ };
116
+ paddingTop: {
117
+ type: StringConstructor;
118
+ default: string;
119
+ };
120
+ paddingBottom: {
121
+ type: StringConstructor;
122
+ default: string;
123
+ };
124
+ borderStyle: {
125
+ type: StringConstructor;
126
+ default: string;
127
+ };
128
+ borderColor: {
129
+ type: StringConstructor;
130
+ default: string;
131
+ };
132
+ borderWidth: {
133
+ type: StringConstructor;
134
+ default: string;
135
+ };
136
+ borderRadius: {
137
+ type: StringConstructor;
138
+ default: string;
139
+ };
140
+ boxShadow: {
141
+ type: StringConstructor;
142
+ default: string;
143
+ };
144
+ opacity: {
145
+ type: StringConstructor;
146
+ default: string;
147
+ };
148
+ position: {
149
+ type: StringConstructor;
150
+ default: string;
151
+ };
152
+ left: {
153
+ type: StringConstructor;
154
+ default: string;
155
+ };
156
+ top: {
157
+ type: StringConstructor;
158
+ default: string;
159
+ };
160
+ right: {
161
+ type: StringConstructor;
162
+ default: string;
163
+ };
164
+ isEditing: {
165
+ type: BooleanConstructor;
166
+ default: boolean;
167
+ };
168
+ }>> & Readonly<{}>, {
169
+ src: string;
170
+ actionType: string;
171
+ url: string;
172
+ height: string;
173
+ width: string;
174
+ paddingLeft: string;
175
+ paddingRight: string;
176
+ paddingTop: string;
177
+ paddingBottom: string;
178
+ borderStyle: string;
179
+ borderColor: string;
180
+ borderWidth: string;
181
+ borderRadius: string;
182
+ boxShadow: string;
183
+ opacity: string;
184
+ position: string;
185
+ left: string;
186
+ top: string;
187
+ right: string;
188
+ isEditing: boolean;
189
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
190
+ export default _default;
@@ -0,0 +1,2 @@
1
+ import LImage from "./LImage.vue";
2
+ export default LImage;
@@ -0,0 +1,190 @@
1
+ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
2
+ backgroundColor: {
3
+ type: StringConstructor;
4
+ default: string;
5
+ };
6
+ actionType: {
7
+ type: StringConstructor;
8
+ default: string;
9
+ };
10
+ url: {
11
+ type: StringConstructor;
12
+ default: string;
13
+ };
14
+ height: {
15
+ type: StringConstructor;
16
+ default: string;
17
+ };
18
+ width: {
19
+ type: StringConstructor;
20
+ default: string;
21
+ };
22
+ paddingLeft: {
23
+ type: StringConstructor;
24
+ default: string;
25
+ };
26
+ paddingRight: {
27
+ type: StringConstructor;
28
+ default: string;
29
+ };
30
+ paddingTop: {
31
+ type: StringConstructor;
32
+ default: string;
33
+ };
34
+ paddingBottom: {
35
+ type: StringConstructor;
36
+ default: string;
37
+ };
38
+ borderStyle: {
39
+ type: StringConstructor;
40
+ default: string;
41
+ };
42
+ borderColor: {
43
+ type: StringConstructor;
44
+ default: string;
45
+ };
46
+ borderWidth: {
47
+ type: StringConstructor;
48
+ default: string;
49
+ };
50
+ borderRadius: {
51
+ type: StringConstructor;
52
+ default: string;
53
+ };
54
+ boxShadow: {
55
+ type: StringConstructor;
56
+ default: string;
57
+ };
58
+ opacity: {
59
+ type: StringConstructor;
60
+ default: string;
61
+ };
62
+ position: {
63
+ type: StringConstructor;
64
+ default: string;
65
+ };
66
+ left: {
67
+ type: StringConstructor;
68
+ default: string;
69
+ };
70
+ top: {
71
+ type: StringConstructor;
72
+ default: string;
73
+ };
74
+ right: {
75
+ type: StringConstructor;
76
+ default: string;
77
+ };
78
+ isEditing: {
79
+ type: BooleanConstructor;
80
+ default: boolean;
81
+ };
82
+ }>, {
83
+ styleProps: import("vue").ComputedRef<Partial<Readonly<Partial<import("../../defaultProps").CommonComponentProps & {
84
+ isEditing: boolean;
85
+ }>>>>;
86
+ handleClick: () => void;
87
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
88
+ backgroundColor: {
89
+ type: StringConstructor;
90
+ default: string;
91
+ };
92
+ actionType: {
93
+ type: StringConstructor;
94
+ default: string;
95
+ };
96
+ url: {
97
+ type: StringConstructor;
98
+ default: string;
99
+ };
100
+ height: {
101
+ type: StringConstructor;
102
+ default: string;
103
+ };
104
+ width: {
105
+ type: StringConstructor;
106
+ default: string;
107
+ };
108
+ paddingLeft: {
109
+ type: StringConstructor;
110
+ default: string;
111
+ };
112
+ paddingRight: {
113
+ type: StringConstructor;
114
+ default: string;
115
+ };
116
+ paddingTop: {
117
+ type: StringConstructor;
118
+ default: string;
119
+ };
120
+ paddingBottom: {
121
+ type: StringConstructor;
122
+ default: string;
123
+ };
124
+ borderStyle: {
125
+ type: StringConstructor;
126
+ default: string;
127
+ };
128
+ borderColor: {
129
+ type: StringConstructor;
130
+ default: string;
131
+ };
132
+ borderWidth: {
133
+ type: StringConstructor;
134
+ default: string;
135
+ };
136
+ borderRadius: {
137
+ type: StringConstructor;
138
+ default: string;
139
+ };
140
+ boxShadow: {
141
+ type: StringConstructor;
142
+ default: string;
143
+ };
144
+ opacity: {
145
+ type: StringConstructor;
146
+ default: string;
147
+ };
148
+ position: {
149
+ type: StringConstructor;
150
+ default: string;
151
+ };
152
+ left: {
153
+ type: StringConstructor;
154
+ default: string;
155
+ };
156
+ top: {
157
+ type: StringConstructor;
158
+ default: string;
159
+ };
160
+ right: {
161
+ type: StringConstructor;
162
+ default: string;
163
+ };
164
+ isEditing: {
165
+ type: BooleanConstructor;
166
+ default: boolean;
167
+ };
168
+ }>> & Readonly<{}>, {
169
+ backgroundColor: string;
170
+ actionType: string;
171
+ url: string;
172
+ height: string;
173
+ width: string;
174
+ paddingLeft: string;
175
+ paddingRight: string;
176
+ paddingTop: string;
177
+ paddingBottom: string;
178
+ borderStyle: string;
179
+ borderColor: string;
180
+ borderWidth: string;
181
+ borderRadius: string;
182
+ boxShadow: string;
183
+ opacity: string;
184
+ position: string;
185
+ left: string;
186
+ top: string;
187
+ right: string;
188
+ isEditing: boolean;
189
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
190
+ export default _default;
@@ -0,0 +1,2 @@
1
+ import LShape from "./LShape.vue";
2
+ export default LShape;
@@ -0,0 +1,280 @@
1
+ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
2
+ text: {
3
+ type: StringConstructor;
4
+ default: string;
5
+ };
6
+ fontSize: {
7
+ type: StringConstructor;
8
+ default: string;
9
+ };
10
+ fontFamily: {
11
+ type: StringConstructor;
12
+ default: string;
13
+ };
14
+ fontWeight: {
15
+ type: StringConstructor;
16
+ default: string;
17
+ };
18
+ fontStyle: {
19
+ type: StringConstructor;
20
+ default: string;
21
+ };
22
+ textDecoration: {
23
+ type: StringConstructor;
24
+ default: string;
25
+ };
26
+ lineHeight: {
27
+ type: StringConstructor;
28
+ default: string;
29
+ };
30
+ textAlign: {
31
+ type: StringConstructor;
32
+ default: string;
33
+ };
34
+ color: {
35
+ type: StringConstructor;
36
+ default: string;
37
+ };
38
+ backgroundColor: {
39
+ type: StringConstructor;
40
+ default: string;
41
+ };
42
+ actionType: {
43
+ type: StringConstructor;
44
+ default: string;
45
+ };
46
+ url: {
47
+ type: StringConstructor;
48
+ default: string;
49
+ };
50
+ height: {
51
+ type: StringConstructor;
52
+ default: string;
53
+ };
54
+ width: {
55
+ type: StringConstructor;
56
+ default: string;
57
+ };
58
+ paddingLeft: {
59
+ type: StringConstructor;
60
+ default: string;
61
+ };
62
+ paddingRight: {
63
+ type: StringConstructor;
64
+ default: string;
65
+ };
66
+ paddingTop: {
67
+ type: StringConstructor;
68
+ default: string;
69
+ };
70
+ paddingBottom: {
71
+ type: StringConstructor;
72
+ default: string;
73
+ };
74
+ borderStyle: {
75
+ type: StringConstructor;
76
+ default: string;
77
+ };
78
+ borderColor: {
79
+ type: StringConstructor;
80
+ default: string;
81
+ };
82
+ borderWidth: {
83
+ type: StringConstructor;
84
+ default: string;
85
+ };
86
+ borderRadius: {
87
+ type: StringConstructor;
88
+ default: string;
89
+ };
90
+ boxShadow: {
91
+ type: StringConstructor;
92
+ default: string;
93
+ };
94
+ opacity: {
95
+ type: StringConstructor;
96
+ default: string;
97
+ };
98
+ position: {
99
+ type: StringConstructor;
100
+ default: string;
101
+ };
102
+ left: {
103
+ type: StringConstructor;
104
+ default: string;
105
+ };
106
+ top: {
107
+ type: StringConstructor;
108
+ default: string;
109
+ };
110
+ right: {
111
+ type: StringConstructor;
112
+ default: string;
113
+ };
114
+ isEditing: {
115
+ type: BooleanConstructor;
116
+ default: boolean;
117
+ };
118
+ tag: {
119
+ type: StringConstructor;
120
+ default: string;
121
+ };
122
+ }>, {
123
+ styleProps: import("vue").ComputedRef<Partial<Readonly<Partial<import("@/defaultProps").CommonComponentProps & {
124
+ isEditing: boolean;
125
+ }>>>>;
126
+ handleClick: () => void;
127
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
128
+ text: {
129
+ type: StringConstructor;
130
+ default: string;
131
+ };
132
+ fontSize: {
133
+ type: StringConstructor;
134
+ default: string;
135
+ };
136
+ fontFamily: {
137
+ type: StringConstructor;
138
+ default: string;
139
+ };
140
+ fontWeight: {
141
+ type: StringConstructor;
142
+ default: string;
143
+ };
144
+ fontStyle: {
145
+ type: StringConstructor;
146
+ default: string;
147
+ };
148
+ textDecoration: {
149
+ type: StringConstructor;
150
+ default: string;
151
+ };
152
+ lineHeight: {
153
+ type: StringConstructor;
154
+ default: string;
155
+ };
156
+ textAlign: {
157
+ type: StringConstructor;
158
+ default: string;
159
+ };
160
+ color: {
161
+ type: StringConstructor;
162
+ default: string;
163
+ };
164
+ backgroundColor: {
165
+ type: StringConstructor;
166
+ default: string;
167
+ };
168
+ actionType: {
169
+ type: StringConstructor;
170
+ default: string;
171
+ };
172
+ url: {
173
+ type: StringConstructor;
174
+ default: string;
175
+ };
176
+ height: {
177
+ type: StringConstructor;
178
+ default: string;
179
+ };
180
+ width: {
181
+ type: StringConstructor;
182
+ default: string;
183
+ };
184
+ paddingLeft: {
185
+ type: StringConstructor;
186
+ default: string;
187
+ };
188
+ paddingRight: {
189
+ type: StringConstructor;
190
+ default: string;
191
+ };
192
+ paddingTop: {
193
+ type: StringConstructor;
194
+ default: string;
195
+ };
196
+ paddingBottom: {
197
+ type: StringConstructor;
198
+ default: string;
199
+ };
200
+ borderStyle: {
201
+ type: StringConstructor;
202
+ default: string;
203
+ };
204
+ borderColor: {
205
+ type: StringConstructor;
206
+ default: string;
207
+ };
208
+ borderWidth: {
209
+ type: StringConstructor;
210
+ default: string;
211
+ };
212
+ borderRadius: {
213
+ type: StringConstructor;
214
+ default: string;
215
+ };
216
+ boxShadow: {
217
+ type: StringConstructor;
218
+ default: string;
219
+ };
220
+ opacity: {
221
+ type: StringConstructor;
222
+ default: string;
223
+ };
224
+ position: {
225
+ type: StringConstructor;
226
+ default: string;
227
+ };
228
+ left: {
229
+ type: StringConstructor;
230
+ default: string;
231
+ };
232
+ top: {
233
+ type: StringConstructor;
234
+ default: string;
235
+ };
236
+ right: {
237
+ type: StringConstructor;
238
+ default: string;
239
+ };
240
+ isEditing: {
241
+ type: BooleanConstructor;
242
+ default: boolean;
243
+ };
244
+ tag: {
245
+ type: StringConstructor;
246
+ default: string;
247
+ };
248
+ }>> & Readonly<{}>, {
249
+ text: string;
250
+ fontSize: string;
251
+ fontFamily: string;
252
+ fontWeight: string;
253
+ fontStyle: string;
254
+ textDecoration: string;
255
+ lineHeight: string;
256
+ textAlign: string;
257
+ color: string;
258
+ backgroundColor: string;
259
+ actionType: string;
260
+ url: string;
261
+ height: string;
262
+ width: string;
263
+ paddingLeft: string;
264
+ paddingRight: string;
265
+ paddingTop: string;
266
+ paddingBottom: string;
267
+ borderStyle: string;
268
+ borderColor: string;
269
+ borderWidth: string;
270
+ borderRadius: string;
271
+ boxShadow: string;
272
+ opacity: string;
273
+ position: string;
274
+ left: string;
275
+ top: string;
276
+ right: string;
277
+ tag: string;
278
+ isEditing: boolean;
279
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
280
+ export default _default;
@@ -0,0 +1,2 @@
1
+ import LText from "./LText.vue";
2
+ export default LText;
@@ -0,0 +1,61 @@
1
+ export interface CommonComponentProps {
2
+ actionType: string;
3
+ url: string;
4
+ height: string;
5
+ width: string;
6
+ paddingLeft: string;
7
+ paddingRight: string;
8
+ paddingTop: string;
9
+ paddingBottom: string;
10
+ borderStyle: string;
11
+ borderColor: string;
12
+ borderWidth: string;
13
+ borderRadius: string;
14
+ boxShadow: string;
15
+ opacity: string;
16
+ position: string;
17
+ left: string;
18
+ top: string;
19
+ right: string;
20
+ }
21
+ export declare const commonDefaultProps: CommonComponentProps;
22
+ export interface TextComponentProps extends CommonComponentProps {
23
+ text: string;
24
+ fontSize: string;
25
+ fontFamily: string;
26
+ fontWeight: string;
27
+ fontStyle: string;
28
+ textDecoration: string;
29
+ lineHeight: string;
30
+ textAlign: string;
31
+ color: string;
32
+ backgroundColor: string;
33
+ }
34
+ export interface ImageComponentProps extends CommonComponentProps {
35
+ src: string;
36
+ }
37
+ export interface ShapeComponentProps extends CommonComponentProps {
38
+ backgroundColor: string;
39
+ }
40
+ export declare type AllComponentProps = TextComponentProps & ImageComponentProps & ShapeComponentProps;
41
+ export declare const textDefaultProps: TextComponentProps;
42
+ export declare const imageDefaultProps: ImageComponentProps;
43
+ export declare const shapeDefaultProps: ShapeComponentProps;
44
+ export declare const isEditingProp: {
45
+ isEditing: {
46
+ type: BooleanConstructor;
47
+ default: boolean;
48
+ };
49
+ };
50
+ export declare const textStylePropNames: string[];
51
+ export declare const imageStylePropsNames: string[];
52
+ export declare const shapeStylePropsNames: string[];
53
+ export declare const transformToComponentProps: <T extends {}>(props: T) => { [P in keyof T]: {
54
+ type: StringConstructor;
55
+ default: T[keyof T];
56
+ }; } & {
57
+ isEditing: {
58
+ type: BooleanConstructor;
59
+ default: boolean;
60
+ };
61
+ };
@@ -0,0 +1,10 @@
1
+ import { CommonComponentProps } from "../defaultProps";
2
+ declare const useComponentCommon: (props: Readonly<Partial<CommonComponentProps & {
3
+ isEditing: boolean;
4
+ }>>, picks: string[]) => {
5
+ styleProps: import("vue").ComputedRef<Partial<Readonly<Partial<CommonComponentProps & {
6
+ isEditing: boolean;
7
+ }>>>>;
8
+ handleClick: () => void;
9
+ };
10
+ export default useComponentCommon;
@@ -0,0 +1,192 @@
1
+ import { computed, defineComponent, openBlock, createBlock, resolveDynamicComponent, normalizeStyle, withCtx, createTextVNode, toDisplayString, createElementBlock, withModifiers } from 'vue';
2
+ import { pick, without, mapValues } from 'lodash-es';
3
+
4
+ const useComponentCommon = (props, picks) => {
5
+ const styleProps = computed(() => pick(props, picks));
6
+ const handleClick = () => {
7
+ if (props.actionType === "url" && props.url && !props.isEditing) {
8
+ window.location.href = props.url;
9
+ }
10
+ };
11
+ return {
12
+ styleProps,
13
+ handleClick,
14
+ };
15
+ };
16
+
17
+ const commonDefaultProps = {
18
+ // actions
19
+ actionType: '',
20
+ url: '',
21
+ // size
22
+ height: '',
23
+ width: '373px',
24
+ paddingLeft: '0px',
25
+ paddingRight: '0px',
26
+ paddingTop: '0px',
27
+ paddingBottom: '0px',
28
+ // border type
29
+ borderStyle: 'none',
30
+ borderColor: '#000',
31
+ borderWidth: '0',
32
+ borderRadius: '0',
33
+ // shadow and opacity
34
+ boxShadow: '0 0 0 #000000',
35
+ opacity: '1',
36
+ // position and x,y
37
+ position: 'absolute',
38
+ left: '0',
39
+ top: '0',
40
+ right: '0'
41
+ };
42
+ const textDefaultProps = {
43
+ // basic props - font styles
44
+ text: '正文内容',
45
+ fontSize: '14px',
46
+ fontFamily: '',
47
+ fontWeight: 'normal',
48
+ fontStyle: 'normal',
49
+ textDecoration: 'none',
50
+ lineHeight: '1',
51
+ textAlign: 'left',
52
+ color: '#000000',
53
+ backgroundColor: '',
54
+ ...commonDefaultProps
55
+ };
56
+ const imageDefaultProps = {
57
+ src: 'test.url',
58
+ ...commonDefaultProps
59
+ };
60
+ const shapeDefaultProps = {
61
+ backgroundColor: '',
62
+ ...commonDefaultProps
63
+ };
64
+ const isEditingProp = {
65
+ isEditing: {
66
+ type: Boolean,
67
+ default: false
68
+ }
69
+ };
70
+ const textStylePropNames = without(Object.keys(textDefaultProps), 'actionType', 'url', 'text');
71
+ const imageStylePropsNames = without(Object.keys(imageDefaultProps), 'actionType', 'url', 'src');
72
+ const shapeStylePropsNames = without(Object.keys(imageDefaultProps), 'actionType', 'url');
73
+ const transformToComponentProps = (props) => {
74
+ const mapProps = mapValues(props, (item) => {
75
+ return {
76
+ type: item.constructor,
77
+ default: item
78
+ };
79
+ });
80
+ return { ...mapProps, ...isEditingProp };
81
+ };
82
+
83
+ const defaultProps$2 = transformToComponentProps(textDefaultProps);
84
+ // array that contains style props
85
+ var script$2 = defineComponent({
86
+ name: 'l-text',
87
+ props: {
88
+ tag: {
89
+ type: String,
90
+ default: 'div'
91
+ },
92
+ ...defaultProps$2
93
+ },
94
+ setup(props) {
95
+ // 重用并且简化
96
+ // 抽离并且获得 styleProps
97
+ const { styleProps, handleClick } = useComponentCommon(props, textStylePropNames);
98
+ return {
99
+ styleProps,
100
+ handleClick
101
+ };
102
+ }
103
+ });
104
+
105
+ function render$2(_ctx, _cache, $props, $setup, $data, $options) {
106
+ return (openBlock(), createBlock(resolveDynamicComponent(_ctx.tag), {
107
+ style: normalizeStyle(_ctx.styleProps),
108
+ class: "l-text-component",
109
+ onClick: _ctx.handleClick
110
+ }, {
111
+ default: withCtx(() => [
112
+ createTextVNode(toDisplayString(_ctx.text), 1 /* TEXT */)
113
+ ]),
114
+ _: 1 /* STABLE */
115
+ }, 8 /* PROPS */, ["style", "onClick"]))
116
+ }
117
+
118
+ script$2.render = render$2;
119
+ script$2.__scopeId = "data-v-6bf95b7a";
120
+ script$2.__file = "src/components/LText/LText.vue";
121
+
122
+ const defaultProps$1 = transformToComponentProps(imageDefaultProps);
123
+ // array that contains style props
124
+ var script$1 = defineComponent({
125
+ name: 'l-image',
126
+ props: {
127
+ ...defaultProps$1
128
+ },
129
+ setup(props) {
130
+ // 重用并且简化
131
+ // 抽离并且获得 styleProps
132
+ const { styleProps, handleClick } = useComponentCommon(props, imageStylePropsNames);
133
+ return {
134
+ styleProps,
135
+ handleClick
136
+ };
137
+ }
138
+ });
139
+
140
+ const _hoisted_1 = ["src"];
141
+
142
+ function render$1(_ctx, _cache, $props, $setup, $data, $options) {
143
+ return (openBlock(), createElementBlock("img", {
144
+ style: normalizeStyle(_ctx.styleProps),
145
+ class: "l-image-component",
146
+ onClick: _cache[0] || (_cache[0] = withModifiers((...args) => (_ctx.handleClick && _ctx.handleClick(...args)), ["prevent"])),
147
+ src: _ctx.src
148
+ }, null, 12 /* STYLE, PROPS */, _hoisted_1))
149
+ }
150
+
151
+ script$1.render = render$1;
152
+ script$1.__scopeId = "data-v-1e970aa2";
153
+ script$1.__file = "src/components/LImage/LImage.vue";
154
+
155
+ const defaultProps = transformToComponentProps(shapeDefaultProps);
156
+ // array that contains style props
157
+ var script = defineComponent({
158
+ name: 'l-shape',
159
+ props: {
160
+ ...defaultProps
161
+ },
162
+ setup(props) {
163
+ // 重用并且简化
164
+ // 抽离并且获得 styleProps
165
+ const { styleProps, handleClick } = useComponentCommon(props, shapeStylePropsNames);
166
+ return {
167
+ styleProps,
168
+ handleClick
169
+ };
170
+ }
171
+ });
172
+
173
+ function render(_ctx, _cache, $props, $setup, $data, $options) {
174
+ return (openBlock(), createElementBlock("div", {
175
+ style: normalizeStyle(_ctx.styleProps),
176
+ class: "l-shape-component",
177
+ onClick: _cache[0] || (_cache[0] = withModifiers((...args) => (_ctx.handleClick && _ctx.handleClick(...args)), ["prevent"]))
178
+ }, null, 4 /* STYLE */))
179
+ }
180
+
181
+ script.render = render;
182
+ script.__file = "src/components/LShape/LShape.vue";
183
+
184
+ const components = [script$2, script$1, script];
185
+ function install(app) {
186
+ components.forEach((component) => {
187
+ app.component(component.name, component);
188
+ });
189
+ }
190
+ var index = { install };
191
+
192
+ export { script$1 as LImage, script as LShape, script$2 as LText, index as default, imageDefaultProps, imageStylePropsNames, shapeDefaultProps, shapeStylePropsNames, textDefaultProps, textStylePropNames };
@@ -0,0 +1,208 @@
1
+ (function (global, factory) {
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('vue'), require('lodash-es')) :
3
+ typeof define === 'function' && define.amd ? define(['exports', 'vue', 'lodash-es'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.legoComponents = {}, global.Vue, global._));
5
+ })(this, (function (exports, vue, lodashEs) { 'use strict';
6
+
7
+ const useComponentCommon = (props, picks) => {
8
+ const styleProps = vue.computed(() => lodashEs.pick(props, picks));
9
+ const handleClick = () => {
10
+ if (props.actionType === "url" && props.url && !props.isEditing) {
11
+ window.location.href = props.url;
12
+ }
13
+ };
14
+ return {
15
+ styleProps,
16
+ handleClick,
17
+ };
18
+ };
19
+
20
+ const commonDefaultProps = {
21
+ // actions
22
+ actionType: '',
23
+ url: '',
24
+ // size
25
+ height: '',
26
+ width: '373px',
27
+ paddingLeft: '0px',
28
+ paddingRight: '0px',
29
+ paddingTop: '0px',
30
+ paddingBottom: '0px',
31
+ // border type
32
+ borderStyle: 'none',
33
+ borderColor: '#000',
34
+ borderWidth: '0',
35
+ borderRadius: '0',
36
+ // shadow and opacity
37
+ boxShadow: '0 0 0 #000000',
38
+ opacity: '1',
39
+ // position and x,y
40
+ position: 'absolute',
41
+ left: '0',
42
+ top: '0',
43
+ right: '0'
44
+ };
45
+ const textDefaultProps = {
46
+ // basic props - font styles
47
+ text: '正文内容',
48
+ fontSize: '14px',
49
+ fontFamily: '',
50
+ fontWeight: 'normal',
51
+ fontStyle: 'normal',
52
+ textDecoration: 'none',
53
+ lineHeight: '1',
54
+ textAlign: 'left',
55
+ color: '#000000',
56
+ backgroundColor: '',
57
+ ...commonDefaultProps
58
+ };
59
+ const imageDefaultProps = {
60
+ src: 'test.url',
61
+ ...commonDefaultProps
62
+ };
63
+ const shapeDefaultProps = {
64
+ backgroundColor: '',
65
+ ...commonDefaultProps
66
+ };
67
+ const isEditingProp = {
68
+ isEditing: {
69
+ type: Boolean,
70
+ default: false
71
+ }
72
+ };
73
+ const textStylePropNames = lodashEs.without(Object.keys(textDefaultProps), 'actionType', 'url', 'text');
74
+ const imageStylePropsNames = lodashEs.without(Object.keys(imageDefaultProps), 'actionType', 'url', 'src');
75
+ const shapeStylePropsNames = lodashEs.without(Object.keys(imageDefaultProps), 'actionType', 'url');
76
+ const transformToComponentProps = (props) => {
77
+ const mapProps = lodashEs.mapValues(props, (item) => {
78
+ return {
79
+ type: item.constructor,
80
+ default: item
81
+ };
82
+ });
83
+ return { ...mapProps, ...isEditingProp };
84
+ };
85
+
86
+ const defaultProps$2 = transformToComponentProps(textDefaultProps);
87
+ // array that contains style props
88
+ var script$2 = vue.defineComponent({
89
+ name: 'l-text',
90
+ props: {
91
+ tag: {
92
+ type: String,
93
+ default: 'div'
94
+ },
95
+ ...defaultProps$2
96
+ },
97
+ setup(props) {
98
+ // 重用并且简化
99
+ // 抽离并且获得 styleProps
100
+ const { styleProps, handleClick } = useComponentCommon(props, textStylePropNames);
101
+ return {
102
+ styleProps,
103
+ handleClick
104
+ };
105
+ }
106
+ });
107
+
108
+ function render$2(_ctx, _cache, $props, $setup, $data, $options) {
109
+ return (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.tag), {
110
+ style: vue.normalizeStyle(_ctx.styleProps),
111
+ class: "l-text-component",
112
+ onClick: _ctx.handleClick
113
+ }, {
114
+ default: vue.withCtx(() => [
115
+ vue.createTextVNode(vue.toDisplayString(_ctx.text), 1 /* TEXT */)
116
+ ]),
117
+ _: 1 /* STABLE */
118
+ }, 8 /* PROPS */, ["style", "onClick"]))
119
+ }
120
+
121
+ script$2.render = render$2;
122
+ script$2.__scopeId = "data-v-6bf95b7a";
123
+ script$2.__file = "src/components/LText/LText.vue";
124
+
125
+ const defaultProps$1 = transformToComponentProps(imageDefaultProps);
126
+ // array that contains style props
127
+ var script$1 = vue.defineComponent({
128
+ name: 'l-image',
129
+ props: {
130
+ ...defaultProps$1
131
+ },
132
+ setup(props) {
133
+ // 重用并且简化
134
+ // 抽离并且获得 styleProps
135
+ const { styleProps, handleClick } = useComponentCommon(props, imageStylePropsNames);
136
+ return {
137
+ styleProps,
138
+ handleClick
139
+ };
140
+ }
141
+ });
142
+
143
+ const _hoisted_1 = ["src"];
144
+
145
+ function render$1(_ctx, _cache, $props, $setup, $data, $options) {
146
+ return (vue.openBlock(), vue.createElementBlock("img", {
147
+ style: vue.normalizeStyle(_ctx.styleProps),
148
+ class: "l-image-component",
149
+ onClick: _cache[0] || (_cache[0] = vue.withModifiers((...args) => (_ctx.handleClick && _ctx.handleClick(...args)), ["prevent"])),
150
+ src: _ctx.src
151
+ }, null, 12 /* STYLE, PROPS */, _hoisted_1))
152
+ }
153
+
154
+ script$1.render = render$1;
155
+ script$1.__scopeId = "data-v-1e970aa2";
156
+ script$1.__file = "src/components/LImage/LImage.vue";
157
+
158
+ const defaultProps = transformToComponentProps(shapeDefaultProps);
159
+ // array that contains style props
160
+ var script = vue.defineComponent({
161
+ name: 'l-shape',
162
+ props: {
163
+ ...defaultProps
164
+ },
165
+ setup(props) {
166
+ // 重用并且简化
167
+ // 抽离并且获得 styleProps
168
+ const { styleProps, handleClick } = useComponentCommon(props, shapeStylePropsNames);
169
+ return {
170
+ styleProps,
171
+ handleClick
172
+ };
173
+ }
174
+ });
175
+
176
+ function render(_ctx, _cache, $props, $setup, $data, $options) {
177
+ return (vue.openBlock(), vue.createElementBlock("div", {
178
+ style: vue.normalizeStyle(_ctx.styleProps),
179
+ class: "l-shape-component",
180
+ onClick: _cache[0] || (_cache[0] = vue.withModifiers((...args) => (_ctx.handleClick && _ctx.handleClick(...args)), ["prevent"]))
181
+ }, null, 4 /* STYLE */))
182
+ }
183
+
184
+ script.render = render;
185
+ script.__file = "src/components/LShape/LShape.vue";
186
+
187
+ const components = [script$2, script$1, script];
188
+ function install(app) {
189
+ components.forEach((component) => {
190
+ app.component(component.name, component);
191
+ });
192
+ }
193
+ var index = { install };
194
+
195
+ exports.LImage = script$1;
196
+ exports.LShape = script;
197
+ exports.LText = script$2;
198
+ exports.default = index;
199
+ exports.imageDefaultProps = imageDefaultProps;
200
+ exports.imageStylePropsNames = imageStylePropsNames;
201
+ exports.shapeDefaultProps = shapeDefaultProps;
202
+ exports.shapeStylePropsNames = shapeStylePropsNames;
203
+ exports.textDefaultProps = textDefaultProps;
204
+ exports.textStylePropNames = textStylePropNames;
205
+
206
+ Object.defineProperty(exports, '__esModule', { value: true });
207
+
208
+ }));
@@ -0,0 +1,11 @@
1
+ import { App } from "vue";
2
+ import LText from "./components/LText/LText.vue";
3
+ import LImage from "./components/LImage/LImage.vue";
4
+ import LShape from "./components/LShape/LShape.vue";
5
+ export { textDefaultProps, textStylePropNames, TextComponentProps, imageDefaultProps, imageStylePropsNames, ImageComponentProps, shapeDefaultProps, shapeStylePropsNames, ShapeComponentProps, AllComponentProps, } from "./defaultProps";
6
+ declare function install(app: App): void;
7
+ export { LText, LImage, LShape };
8
+ declare const _default: {
9
+ install: typeof install;
10
+ };
11
+ export default _default;
package/package.json ADDED
@@ -0,0 +1,49 @@
1
+ {
2
+ "name": "hy-lego-bricks",
3
+ "version": "0.1.0",
4
+ "private": false,
5
+ "type": "module",
6
+ "types": "dist/index.d.ts",
7
+ "main": "dist/lego-bricks.umd.js",
8
+ "module": "dist/lego-bricks.esm.js",
9
+ "files": [
10
+ "dist"
11
+ ],
12
+ "scripts": {
13
+ "dev": "vue-cli-service serve",
14
+ "serve": "vue-cli-service serve",
15
+ "build": "vue-cli-service build",
16
+ "lint": "vue-cli-service lint",
17
+ "build:all": "npm run clean && npm run build:esm && npm run build:umd",
18
+ "build:esm": "rollup --config build/rollup.esm.config.js",
19
+ "build:umd": "rollup --config build/rollup.umd.config.js",
20
+ "clean": "rimraf ./dist",
21
+ "prepublishOnly": "npm run build:all"
22
+ },
23
+ "dependencies": {
24
+ "core-js": "^3.8.3",
25
+ "lodash-es": "^4.17.21"
26
+ },
27
+ "peerDependencies": {
28
+ "vue": "^3.2.13"
29
+ },
30
+ "devDependencies": {
31
+ "@rollup/plugin-node-resolve": "^16.0.3",
32
+ "@types/lodash-es": "^4.17.7",
33
+ "@typescript-eslint/eslint-plugin": "^5.4.0",
34
+ "@typescript-eslint/parser": "^5.4.0",
35
+ "@vue/cli-plugin-babel": "~5.0.0",
36
+ "@vue/cli-plugin-eslint": "~5.0.0",
37
+ "@vue/cli-plugin-typescript": "~5.0.0",
38
+ "@vue/cli-service": "~5.0.0",
39
+ "@vue/eslint-config-typescript": "^9.1.0",
40
+ "eslint": "^7.32.0",
41
+ "eslint-plugin-vue": "^8.0.3",
42
+ "rimraf": "^6.1.3",
43
+ "rollup": "^3.20.2",
44
+ "rollup-plugin-css-only": "^4.5.5",
45
+ "rollup-plugin-typescript2": "^0.36.0",
46
+ "rollup-plugin-vue": "^6.0.0",
47
+ "typescript": "~4.5.5"
48
+ }
49
+ }