@smilekite/lego-bricks 1.0.4 → 1.0.5

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.
@@ -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").PublicProps, 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,2 @@
1
+ import FinalPage from './FinalPage.vue';
2
+ export default FinalPage;
@@ -1,2 +1,19 @@
1
- declare const _default: any;
1
+ declare const _default: import("vue").DefineComponent<{
2
+ isEditing: {
3
+ type: BooleanConstructor;
4
+ default: boolean;
5
+ };
6
+ }, {
7
+ styleProps: import("vue").ComputedRef<Partial<Readonly<Partial<import("../../defaultProps").CommonComponentProps & {
8
+ isEditing: boolean;
9
+ }>>>>;
10
+ handleClick: () => void;
11
+ }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
12
+ isEditing: {
13
+ type: BooleanConstructor;
14
+ default: boolean;
15
+ };
16
+ }>>, {
17
+ isEditing: boolean;
18
+ }, {}>;
2
19
  export default _default;
@@ -1,2 +1,19 @@
1
- declare const _default: any;
1
+ declare const _default: import("vue").DefineComponent<{
2
+ isEditing: {
3
+ type: BooleanConstructor;
4
+ default: boolean;
5
+ };
6
+ }, {
7
+ styleProps: import("vue").ComputedRef<Partial<Readonly<Partial<import("../../defaultProps").CommonComponentProps & {
8
+ isEditing: boolean;
9
+ }>>>>;
10
+ handleClick: () => void;
11
+ }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
12
+ isEditing: {
13
+ type: BooleanConstructor;
14
+ default: boolean;
15
+ };
16
+ }>>, {
17
+ isEditing: boolean;
18
+ }, {}>;
2
19
  export default _default;
@@ -1,2 +1,28 @@
1
- declare const _default: any;
1
+ declare const _default: import("vue").DefineComponent<{
2
+ isEditing: {
3
+ type: BooleanConstructor;
4
+ default: boolean;
5
+ };
6
+ tag: {
7
+ type: StringConstructor;
8
+ default: string;
9
+ };
10
+ }, {
11
+ styleProps: import("vue").ComputedRef<Partial<Readonly<Partial<import("../../defaultProps").CommonComponentProps & {
12
+ isEditing: boolean;
13
+ }>>>>;
14
+ handleClick: () => void;
15
+ }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
16
+ isEditing: {
17
+ type: BooleanConstructor;
18
+ default: boolean;
19
+ };
20
+ tag: {
21
+ type: StringConstructor;
22
+ default: string;
23
+ };
24
+ }>>, {
25
+ isEditing: boolean;
26
+ tag: string;
27
+ }, {}>;
2
28
  export default _default;
@@ -1,3 +1,33 @@
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
+ props: {
13
+ [key: string]: any;
14
+ };
15
+ setting: {
16
+ [key: string]: any;
17
+ };
18
+ id?: number;
19
+ title?: string;
20
+ desc?: string;
21
+ coverImg?: string;
22
+ uuid?: string;
23
+ latestPublishAt?: string;
24
+ updatedAt?: string;
25
+ isTemplate?: boolean;
26
+ isHot?: boolean;
27
+ isNew?: boolean;
28
+ author?: string;
29
+ status?: string;
30
+ }
1
31
  export interface CommonComponentProps {
2
32
  actionType: string;
3
33
  url: string;
@@ -32,14 +62,10 @@ export interface TextComponentProps extends CommonComponentProps {
32
62
  backgroundColor: string;
33
63
  }
34
64
  export interface ImageComponentProps extends CommonComponentProps {
35
- src: string;
65
+ imageSrc: string;
36
66
  }
37
67
  export interface ShapeComponentProps extends CommonComponentProps {
38
68
  backgroundColor: string;
39
- borderTop: string;
40
- borderBottom: string;
41
- borderLeft: string;
42
- borderRight: string;
43
69
  }
44
70
  export declare type AllComponentProps = TextComponentProps & ImageComponentProps & ShapeComponentProps;
45
71
  export declare const textDefaultProps: TextComponentProps;
@@ -54,4 +80,9 @@ export declare const isEditingProp: {
54
80
  export declare const textStylePropNames: string[];
55
81
  export declare const imageStylePropsNames: string[];
56
82
  export declare const shapeStylePropsNames: string[];
57
- export declare const transformToComponentProps: <T extends {}>(props: T) => any;
83
+ export declare const transformToComponentProps: <T extends {}>(props: T) => {
84
+ isEditing: {
85
+ type: BooleanConstructor;
86
+ default: boolean;
87
+ };
88
+ };
@@ -2,7 +2,9 @@ import { CommonComponentProps } from '../defaultProps';
2
2
  declare const useComponentCommon: (props: Readonly<Partial<CommonComponentProps & {
3
3
  isEditing: boolean;
4
4
  }>>, picks: string[]) => {
5
- styleProps: import("vue").ComputedRef<any>;
5
+ styleProps: import("vue").ComputedRef<Partial<Readonly<Partial<CommonComponentProps & {
6
+ isEditing: boolean;
7
+ }>>>>;
6
8
  handleClick: () => void;
7
9
  };
8
10
  export default useComponentCommon;
package/dist/index.d.ts CHANGED
@@ -3,8 +3,9 @@ export { textDefaultProps, textStylePropNames, TextComponentProps, imageDefaultP
3
3
  import LText from './components/LText';
4
4
  import LImage from './components/LImage';
5
5
  import LShape from './components/LShape';
6
+ import FinalPage from './components/FinalPage';
6
7
  declare const install: (app: App) => void;
7
- export { LText, LImage, LShape, install };
8
+ export { LText, LImage, LShape, install, FinalPage };
8
9
  declare const _default: {
9
10
  install: (app: App<any>) => void;
10
11
  };
@@ -1,5 +1,5 @@
1
1
  import { without, mapValues, pick } from 'lodash-es';
2
- import { computed, defineComponent, openBlock, createBlock, resolveDynamicComponent, normalizeStyle, withCtx, createTextVNode, toDisplayString, createElementBlock, withModifiers } from 'vue';
2
+ import { computed, defineComponent, openBlock, createBlock, resolveDynamicComponent, normalizeStyle, withCtx, createTextVNode, toDisplayString, createElementBlock, withModifiers, Fragment, renderList, mergeProps } from 'vue';
3
3
 
4
4
  const commonDefaultProps = {
5
5
  // actions
@@ -41,15 +41,11 @@ const textDefaultProps = {
41
41
  ...commonDefaultProps
42
42
  };
43
43
  const imageDefaultProps = {
44
- src: 'test.url',
44
+ imageSrc: '',
45
45
  ...commonDefaultProps
46
46
  };
47
47
  const shapeDefaultProps = {
48
48
  backgroundColor: '',
49
- borderTop: '',
50
- borderBottom: '',
51
- borderLeft: '',
52
- borderRight: '',
53
49
  ...commonDefaultProps
54
50
  };
55
51
  const isEditingProp = {
@@ -197,13 +193,51 @@ script$2.install = (app) => {
197
193
  app.component(script$2.name, script$2);
198
194
  };
199
195
 
196
+ var script$3 = defineComponent({
197
+ name: 'final-page',
198
+ props: {
199
+ page: {
200
+ type: Object
201
+ },
202
+ components: {
203
+ type: Array,
204
+ required: true
205
+ }
206
+ }
207
+ });
208
+
209
+ const _hoisted_1$1 = ["id"];
210
+
211
+ function render$3(_ctx, _cache, $props, $setup, $data, $options) {
212
+ return (openBlock(), createElementBlock("div", {
213
+ class: "final-page",
214
+ style: normalizeStyle(_ctx.page && _ctx.page.props)
215
+ }, [
216
+ (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.components, (item) => {
217
+ return (openBlock(), createElementBlock("div", {
218
+ key: item.id,
219
+ id: `component-${item.id}`
220
+ }, [
221
+ (openBlock(), createBlock(resolveDynamicComponent(item.name), mergeProps({ ref_for: true }, item.props), null, 16 /* FULL_PROPS */))
222
+ ], 8 /* PROPS */, _hoisted_1$1))
223
+ }), 128 /* KEYED_FRAGMENT */))
224
+ ], 4 /* STYLE */))
225
+ }
226
+
227
+ script$3.render = render$3;
228
+ script$3.__file = "src/components/FinalPage/FinalPage.vue";
229
+
230
+ script$3.install = (app) => {
231
+ app.component(script$3.name, script$3);
232
+ };
233
+
200
234
  const components = [
201
235
  script,
202
236
  script$1,
203
237
  script$2
204
238
  ];
205
239
  const install = (app) => {
206
- components.forEach(component => {
240
+ components.forEach((component) => {
207
241
  app.component(component.name, component);
208
242
  });
209
243
  };
@@ -212,4 +246,4 @@ var index = {
212
246
  };
213
247
 
214
248
  export default index;
215
- export { script$1 as LImage, script$2 as LShape, script as LText, imageDefaultProps, imageStylePropsNames, install, shapeDefaultProps, shapeStylePropsNames, textDefaultProps, textStylePropNames };
249
+ export { script$3 as FinalPage, script$1 as LImage, script$2 as LShape, script as LText, imageDefaultProps, imageStylePropsNames, install, shapeDefaultProps, shapeStylePropsNames, textDefaultProps, textStylePropNames };
@@ -44,15 +44,11 @@
44
44
  ...commonDefaultProps
45
45
  };
46
46
  const imageDefaultProps = {
47
- src: 'test.url',
47
+ imageSrc: '',
48
48
  ...commonDefaultProps
49
49
  };
50
50
  const shapeDefaultProps = {
51
51
  backgroundColor: '',
52
- borderTop: '',
53
- borderBottom: '',
54
- borderLeft: '',
55
- borderRight: '',
56
52
  ...commonDefaultProps
57
53
  };
58
54
  const isEditingProp = {
@@ -200,13 +196,51 @@
200
196
  app.component(script$2.name, script$2);
201
197
  };
202
198
 
199
+ var script$3 = vue.defineComponent({
200
+ name: 'final-page',
201
+ props: {
202
+ page: {
203
+ type: Object
204
+ },
205
+ components: {
206
+ type: Array,
207
+ required: true
208
+ }
209
+ }
210
+ });
211
+
212
+ const _hoisted_1$1 = ["id"];
213
+
214
+ function render$3(_ctx, _cache, $props, $setup, $data, $options) {
215
+ return (vue.openBlock(), vue.createElementBlock("div", {
216
+ class: "final-page",
217
+ style: vue.normalizeStyle(_ctx.page && _ctx.page.props)
218
+ }, [
219
+ (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.components, (item) => {
220
+ return (vue.openBlock(), vue.createElementBlock("div", {
221
+ key: item.id,
222
+ id: `component-${item.id}`
223
+ }, [
224
+ (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(item.name), vue.mergeProps({ ref_for: true }, item.props), null, 16 /* FULL_PROPS */))
225
+ ], 8 /* PROPS */, _hoisted_1$1))
226
+ }), 128 /* KEYED_FRAGMENT */))
227
+ ], 4 /* STYLE */))
228
+ }
229
+
230
+ script$3.render = render$3;
231
+ script$3.__file = "src/components/FinalPage/FinalPage.vue";
232
+
233
+ script$3.install = (app) => {
234
+ app.component(script$3.name, script$3);
235
+ };
236
+
203
237
  const components = [
204
238
  script,
205
239
  script$1,
206
240
  script$2
207
241
  ];
208
242
  const install = (app) => {
209
- components.forEach(component => {
243
+ components.forEach((component) => {
210
244
  app.component(component.name, component);
211
245
  });
212
246
  };
@@ -214,6 +248,7 @@
214
248
  install
215
249
  };
216
250
 
251
+ exports.FinalPage = script$3;
217
252
  exports.LImage = script$1;
218
253
  exports.LShape = script$2;
219
254
  exports.LText = script;
package/dist/main.d.ts ADDED
@@ -0,0 +1 @@
1
+ export {};
package/package.json CHANGED
@@ -1,17 +1,17 @@
1
1
  {
2
2
  "name": "@smilekite/lego-bricks",
3
- "version": "1.0.4",
3
+ "version": "1.0.5",
4
4
  "author": "smiley",
5
5
  "scripts": {
6
6
  "serve": "vue-cli-service serve",
7
7
  "build": "npm run clean && npm run build:esm && npm run build:umd",
8
8
  "test:watch": "vue-cli-service test:unit --watch",
9
9
  "test": "vue-cli-service test:unit",
10
- "lint": "vue-cli-service lint --max-warnings 5",
10
+ "lint": "vue-cli-service lint",
11
11
  "build:esm": "rollup --config build/rollup.esm.config.js",
12
12
  "build:umd": "rollup --config build/rollup.umd.config.js",
13
13
  "clean": "rimraf ./dist",
14
- "prepublishOnly": "npm run lint && npm run test&& npm run build"
14
+ "prepublishOnly": "npm run lint && npm run test && npm run build"
15
15
  },
16
16
  "husky": {
17
17
  "hooks": {
@@ -50,8 +50,8 @@
50
50
  "rollup-plugin-css-only": "^3.1.0",
51
51
  "rollup-plugin-typescript2": "^0.29.0",
52
52
  "rollup-plugin-vue": "^6.0.0",
53
- "typescript": "^3.9.3",
54
- "vue": "^3.0.0",
53
+ "typescript": "^4.3.5",
54
+ "vue": "~3.4.0",
55
55
  "vue-jest": "5.0.0-alpha.9"
56
56
  },
57
57
  "peerDependencies": {
@@ -73,4 +73,4 @@
73
73
  "access": "public",
74
74
  "registry": "https://registry.npmjs.org/"
75
75
  }
76
- }
76
+ }