@mixd-id/web-scaffold 0.1.230406078 → 0.1.230406079

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@mixd-id/web-scaffold",
3
3
  "private": false,
4
- "version": "0.1.230406078",
4
+ "version": "0.1.230406079",
5
5
  "scripts": {
6
6
  "dev": "vite serve",
7
7
  "build": "vite build",
@@ -0,0 +1,59 @@
1
+ <template>
2
+ <div :class="compClass">
3
+
4
+ <component v-for="item in computedItems"
5
+ :is="item.type"
6
+ :uid="item.uid"
7
+ :items="item.items"
8
+ :="item.props" />
9
+
10
+ Block
11
+
12
+ </div>
13
+ </template>
14
+
15
+ <script>
16
+
17
+ import {classFromProps} from "../utils/helpers.mjs";
18
+
19
+ export default{
20
+
21
+ props:{
22
+ class: String,
23
+ items: Array,
24
+ padding: Array,
25
+ margin: Array,
26
+ display: Array,
27
+ type: String,
28
+ enabled: undefined,
29
+ name: String
30
+ },
31
+
32
+ computed: {
33
+
34
+ computedItems() {
35
+ return this.items.filter((_) => _.props.enabled)
36
+ },
37
+
38
+ compClass(){
39
+ return [
40
+ this.$style.comp,
41
+ this.class ?? '',
42
+ classFromProps(this.$props)
43
+ ]
44
+ .filter(_ => _)
45
+ .join(' ')
46
+ }
47
+
48
+ }
49
+
50
+ }
51
+
52
+ </script>
53
+
54
+ <style module>
55
+
56
+ .comp{
57
+ }
58
+
59
+ </style>
@@ -15,6 +15,7 @@
15
15
  <script>
16
16
 
17
17
  import {componentMixin} from "../mixin/component";
18
+ import {classFromProps} from "../utils/helpers.mjs";
18
19
 
19
20
  export default{
20
21
 
@@ -51,6 +52,7 @@ export default{
51
52
  this.$style['button-' + this.variant],
52
53
  this.class ?? '',
53
54
  parseInt(this.computedState) === 2 ? this.$style.loading : '',
55
+ classFromProps(this.$props)
54
56
  ]
55
57
  .filter(_ => _)
56
58
  .join(' ')
@@ -32,7 +32,7 @@
32
32
 
33
33
  <script>
34
34
 
35
- import { parseBoolean } from "../utils/helpers.mjs";
35
+ import {_applyClass, parseBoolean} from "../utils/helpers.mjs";
36
36
  import {componentMixin} from "../mixin/component";
37
37
 
38
38
  export default{
@@ -67,7 +67,8 @@ export default{
67
67
 
68
68
  compClass(){
69
69
  return [
70
- this.$style.comp
70
+ this.$style.comp,
71
+ ..._applyClass(this.$props)
71
72
  ]
72
73
  .filter(_ => _)
73
74
  .join(' ')
@@ -295,23 +296,7 @@ export default{
295
296
  overflow: hidden;
296
297
  position: relative;
297
298
  touch-action: none;
298
-
299
- background-color: v-bind(bgColor[0]);
300
299
  background-image: v-bind(bgImages[0]);
301
- background-position: v-bind(bgPositions[0]);
302
- background-size: v-bind(bgSizes[0]);
303
- background-repeat: v-bind(bgRepeats[0]);
304
-
305
- border-left-width: v-bind(bdSizes[0][0]);
306
- border-top-width: v-bind(bdSizes[0][1]);
307
- border-right-width: v-bind(bdSizes[0][2]);
308
- border-bottom-width: v-bind(bdSizes[0][3]);
309
- border-color: v-bind(bdColors[0]);
310
- border-top-left-radius: v-bind(bdRadiuses[0][0]);
311
- border-top-right-radius: v-bind(bdRadiuses[0][1]);
312
- border-bottom-right-radius: v-bind(bdRadiuses[0][2]);
313
- border-bottom-left-radius: v-bind(bdRadiuses[0][3]);
314
- border-style: v-bind(bdStyles[0]);
315
300
  }
316
301
 
317
302
  .carouselNext{
@@ -340,12 +325,12 @@ export default{
340
325
  }
341
326
 
342
327
  .legend{
343
- @apply flex justify-center gap-2 py-2;
328
+ @apply flex justify-center gap-2 py-1;
344
329
  }
345
330
  .legend .legendItem{
346
331
  }
347
332
  .legend .legendItem>*{
348
- @apply w-3 h-3 rounded-full bg-gray-100;
333
+ @apply w-2 h-2 rounded-full bg-gray-100;
349
334
  }
350
335
  .legend .legendItemActive>*{
351
336
  @apply bg-primary;
@@ -353,22 +338,7 @@ export default{
353
338
 
354
339
  @media screen and (min-width: 768px){
355
340
  .comp{
356
- background-color: v-bind(bgColor[1]);
357
341
  background-image: v-bind(bgImages[1]);
358
- background-position: v-bind(bgPositions[1]);
359
- background-size: v-bind(bgSizes[1]);
360
- background-repeat: v-bind(bgRepeats[1]);
361
-
362
- border-left-width: v-bind(bdSizes[1][0]);
363
- border-top-width: v-bind(bdSizes[1][1]);
364
- border-right-width: v-bind(bdSizes[1][2]);
365
- border-bottom-width: v-bind(bdSizes[1][3]);
366
- border-color: v-bind(bdColors[1]);
367
- border-top-left-radius: v-bind(bdRadiuses[1][0]);
368
- border-top-right-radius: v-bind(bdRadiuses[1][1]);
369
- border-bottom-right-radius: v-bind(bdRadiuses[1][2]);
370
- border-bottom-left-radius: v-bind(bdRadiuses[1][3]);
371
- border-style: v-bind(bdStyles[1]);
372
342
  }
373
343
  }
374
344
 
@@ -1,16 +1,18 @@
1
1
  <template>
2
2
  <div :class="$style.comp">
3
- <div :class="$style.circle" @click="$refs.contextMenu.open($refs.btn)"
4
- ref="btn" :style="{ backgroundColor:this.modelValue }"></div>
3
+ <div :class="`${$style.circle} ${modelValue}`" @click="$refs.contextMenu.open($refs.btn)"
4
+ ref="btn"></div>
5
5
  <input type="color" :class="$style.inputColor" ref="inputColor"
6
6
  @change="select($refs.inputColor.value)"/>
7
7
 
8
8
  <ContextMenu ref="contextMenu" :dismiss="false">
9
9
  <div class="p-4 flex flex-col gap-4">
10
- <div class="grid grid-cols-6 gap-4">
11
- <div v-for="color in colors">
12
- <div :class="$style.circle" :style="{ backgroundColor:color }"
13
- @click="select(color)"></div>
10
+ <div class="flex flex-col gap-4">
11
+ <div v-for="color in colors" class="grid gap-4" :class="`grid-cols-10`">
12
+ <div v-for="step in steps">
13
+ <div :class="`${$style.circle} bg-${color}-${step}`"
14
+ @click="select(`${color}-${step}`)"></div>
15
+ </div>
14
16
  </div>
15
17
  </div>
16
18
  <div class="grid grid-cols-2 gap-4">
@@ -34,18 +36,35 @@ export default{
34
36
 
35
37
  props: {
36
38
 
37
- colors: Array,
39
+ colors: {
40
+ type: Array,
41
+ default: [
42
+ 'primary',
43
+ 'gray',
44
+ 'red',
45
+ 'amber',
46
+ 'lime',
47
+ 'blue',
48
+ ]
49
+ },
50
+
51
+ steps: {
52
+ type: Array,
53
+ default: [ 50, 100, 200, 300, 400, 500, 600, 700, 800, 900 ]
54
+ },
38
55
 
39
56
  customColor: undefined,
40
57
 
41
- modelValue: String
58
+ modelValue: String,
59
+
60
+ prefix: String
42
61
 
43
62
  },
44
63
 
45
64
  methods: {
46
65
 
47
66
  select(color){
48
- this.$emit('update:modelValue', color)
67
+ this.$emit('update:modelValue', this.prefix + color)
49
68
  this.$emit('change')
50
69
  this.$refs.contextMenu.close()
51
70
  }
@@ -74,11 +93,11 @@ export default{
74
93
  <style module>
75
94
 
76
95
  .comp{
77
- @apply p-[2px] border-[1px] border-text-200 rounded-full relative;
96
+ @apply relative;
78
97
  }
79
98
 
80
99
  .circle{
81
- @apply w-[19px] h-[19px] rounded-full cursor-pointer;
100
+ @apply w-[24px] h-[24px] rounded-full cursor-pointer border-[2px] border-text-200;
82
101
  }
83
102
 
84
103
  .inputColor{
@@ -6,14 +6,15 @@
6
6
  :uid="item.uid"
7
7
  :items="item.items"
8
8
  :="item.props"
9
- :class="classOf(item, idx)" />
9
+ :class="itemClass(idx)" />
10
10
 
11
11
  </div>
12
+
12
13
  </template>
13
14
 
14
15
  <script>
15
16
 
16
- import {_applyClass, mediaPrefixes} from "../utils/helpers.mjs";
17
+ import {_applyClass, classFromProps, mediaPrefixes} from "../utils/helpers.mjs";
17
18
  import {componentMixin} from "../mixin/component";
18
19
 
19
20
  export default{
@@ -22,6 +23,7 @@ export default{
22
23
 
23
24
  props:{
24
25
  items: Array,
26
+ flexColumns: Array,
25
27
  type: Array,
26
28
  columnType: Array,
27
29
  columns: Array,
@@ -60,26 +62,9 @@ export default{
60
62
 
61
63
  methods: {
62
64
 
63
- classOf(item, idx){
64
-
65
- const classNames = []
66
- for(let i in this.columns){
67
- const column = this.columns[i][idx % this.columns.length]
68
-
69
- if(!column) continue
70
-
71
- if(column && column.width !== 'auto'){
72
- classNames.push(`${mediaPrefixes[i]}w-[${column.width}]`)
73
- }
74
- else{
75
- classNames.push(`${mediaPrefixes[i]}flex-1`)
76
- }
77
- }
78
-
79
- classNames.push(..._applyClass(item.props))
80
-
81
- return classNames.join(' ')
82
- }
65
+ itemClass(idx){
66
+ return (this.flexColumns[idx] ?? []).join(' ')
67
+ },
83
68
  },
84
69
 
85
70
  data(){
@@ -95,47 +80,12 @@ export default{
95
80
 
96
81
  .comp{
97
82
  @apply flex;
98
-
99
- background-color: v-bind(bgColor[0]);
100
83
  background-image: v-bind(bgImages[0]);
101
- background-position: v-bind(bgPositions[0]);
102
- background-size: v-bind(bgSizes[0]);
103
- background-repeat: v-bind(bgRepeats[0]);
104
-
105
- border-left-width: v-bind(bdSizes[0][0]);
106
- border-top-width: v-bind(bdSizes[0][1]);
107
- border-right-width: v-bind(bdSizes[0][2]);
108
- border-bottom-width: v-bind(bdSizes[0][3]);
109
- border-color: v-bind(bdColors[0]);
110
- border-top-left-radius: v-bind(bdRadiuses[0][0]);
111
- border-top-right-radius: v-bind(bdRadiuses[0][1]);
112
- border-bottom-right-radius: v-bind(bdRadiuses[0][2]);
113
- border-bottom-left-radius: v-bind(bdRadiuses[0][3]);
114
- border-style: v-bind(bdStyles[0]);
115
-
116
- max-width: v-bind(maxWidths[0]);
117
84
  }
118
85
 
119
86
  @media screen and (min-width: 768px){
120
87
  .comp{
121
- background-color: v-bind(bgColor[1]);
122
88
  background-image: v-bind(bgImages[1]);
123
- background-position: v-bind(bgPositions[1]);
124
- background-size: v-bind(bgSizes[1]);
125
- background-repeat: v-bind(bgRepeats[1]);
126
-
127
- border-left-width: v-bind(bdSizes[1][0]);
128
- border-top-width: v-bind(bdSizes[1][1]);
129
- border-right-width: v-bind(bdSizes[1][2]);
130
- border-bottom-width: v-bind(bdSizes[1][3]);
131
- border-color: v-bind(bdColors[1]);
132
- border-top-left-radius: v-bind(bdRadiuses[1][0]);
133
- border-top-right-radius: v-bind(bdRadiuses[1][1]);
134
- border-bottom-right-radius: v-bind(bdRadiuses[1][2]);
135
- border-bottom-left-radius: v-bind(bdRadiuses[1][3]);
136
- border-style: v-bind(bdStyles[1]);
137
-
138
- max-width: v-bind(maxWidths[1]);
139
89
  }
140
90
  }
141
91
 
@@ -1,19 +1,18 @@
1
1
  <template>
2
- <div :class="gridClass">
2
+ <div :class="compClass">
3
3
 
4
4
  <component v-for="item in computedItems"
5
5
  :is="item.type"
6
6
  :uid="item.uid"
7
7
  :items="item.items"
8
- :="item.props"
9
- :class="classOf(item)" />
8
+ :="item.props" />
10
9
 
11
10
  </div>
12
11
  </template>
13
12
 
14
13
  <script>
15
14
 
16
- import {_applyClass, mediaPrefixes} from "../utils/helpers.mjs";
15
+ import {_applyClass} from "../utils/helpers.mjs";
17
16
  import {componentMixin} from "../mixin/component";
18
17
 
19
18
  export default{
@@ -38,40 +37,18 @@ export default{
38
37
  return this.items.filter((_) => _.props.enabled)
39
38
  },
40
39
 
41
- gridClass(){
42
-
43
- const classNames = [
44
- this.$style.comp
40
+ compClass(){
41
+ return [
42
+ this.$style.comp,
43
+ ..._applyClass(this.$props)
45
44
  ]
46
-
47
- if(Array.isArray(this.columns)){
48
- for(let i in this.columns){
49
- classNames.push(mediaPrefixes[i] + 'grid-cols-' + this.columns[i])
50
- }
51
- }
52
-
53
- if(Array.isArray(this.gap)){
54
- for(let i in this.gap){
55
- classNames.push(mediaPrefixes[i] + 'gap-' + this.gap[i])
56
- }
57
- }
58
-
59
- classNames.push(..._applyClass(this.$props))
60
-
61
- return classNames.join(' ')
45
+ .join(' ')
62
46
  }
63
47
 
64
48
  },
65
49
 
66
50
  methods: {
67
51
 
68
- classOf(item){
69
-
70
- return [
71
- item.props.colSpan ? 'col-span-' + item.props.colSpan : ''
72
- ]
73
- .join(' ')
74
- }
75
52
 
76
53
  }
77
54
 
@@ -261,25 +261,7 @@ export default{
261
261
 
262
262
  .comp{
263
263
  @apply relative overflow-hidden;
264
-
265
- background-color: v-bind(bgColor[0]);
266
264
  background-image: v-bind(bgImages[0]);
267
- background-position: v-bind(bgPositions[0]);
268
- background-size: v-bind(bgSizes[0]);
269
- background-repeat: v-bind(bgRepeats[0]);
270
-
271
- border-left-width: v-bind(bdSizes[0][0]);
272
- border-top-width: v-bind(bdSizes[0][1]);
273
- border-right-width: v-bind(bdSizes[0][2]);
274
- border-bottom-width: v-bind(bdSizes[0][3]);
275
- border-color: v-bind(bdColors[0]);
276
- border-top-left-radius: v-bind(bdRadiuses[0][0]);
277
- border-top-right-radius: v-bind(bdRadiuses[0][1]);
278
- border-bottom-right-radius: v-bind(bdRadiuses[0][2]);
279
- border-bottom-left-radius: v-bind(bdRadiuses[0][3]);
280
- border-style: v-bind(bdStyles[0]);
281
-
282
- max-width: v-bind(maxWidths[0]);
283
265
  }
284
266
 
285
267
  .img{
@@ -301,24 +283,7 @@ export default{
301
283
 
302
284
  @media screen and (min-width: 768px){
303
285
  .comp{
304
- background-color: v-bind(bgColor[1]);
305
286
  background-image: v-bind(bgImages[1]);
306
- background-position: v-bind(bgPositions[1]);
307
- background-size: v-bind(bgSizes[1]);
308
- background-repeat: v-bind(bgRepeats[1]);
309
-
310
- border-left-width: v-bind(bdSizes[1][0]);
311
- border-top-width: v-bind(bdSizes[1][1]);
312
- border-right-width: v-bind(bdSizes[1][2]);
313
- border-bottom-width: v-bind(bdSizes[1][3]);
314
- border-color: v-bind(bdColors[1]);
315
- border-top-left-radius: v-bind(bdRadiuses[1][0]);
316
- border-top-right-radius: v-bind(bdRadiuses[1][1]);
317
- border-bottom-right-radius: v-bind(bdRadiuses[1][2]);
318
- border-bottom-left-radius: v-bind(bdRadiuses[1][3]);
319
- border-style: v-bind(bdStyles[1]);
320
-
321
- max-width: v-bind(maxWidths[1]);
322
287
  }
323
288
  }
324
289
 
package/src/index.js CHANGED
@@ -248,6 +248,7 @@ export default{
248
248
  app.config.globalProperties.info = consoleInfo
249
249
 
250
250
  app.component('Alert', defineAsyncComponent(() => import("./components/Alert.vue")))
251
+ app.component('Block', defineAsyncComponent(() => import("./components/Block.vue")))
251
252
  app.component('Button', defineAsyncComponent(() => import("./components/Button.vue")))
252
253
  app.component('Box', defineAsyncComponent(() => import("./components/Box.vue")))
253
254
  app.component('ColorPicker', defineAsyncComponent(() => import("./components/ColorPicker.vue")))
@@ -313,6 +314,8 @@ export default{
313
314
  app.component('Banner', defineAsyncComponent(() => import("./widgets/Banner.vue")))
314
315
  app.component('BannerItem', defineAsyncComponent(() => import("./widgets/BannerItem.vue")))
315
316
  app.component('BannerSetting', defineAsyncComponent(() => import("./widgets/BannerSetting.vue")))
317
+ app.component('BlockItem', defineAsyncComponent(() => import("./widgets/BlockItem.vue")))
318
+ app.component('BlockSetting', defineAsyncComponent(() => import("./widgets/BlockSetting.vue")))
316
319
  app.component('BoxItem', defineAsyncComponent(() => import("./widgets/BoxItem.vue")))
317
320
  app.component('BoxSetting', defineAsyncComponent(() => import("./widgets/BoxSetting.vue")))
318
321
  app.component('ButtonItem', defineAsyncComponent(() => import("./widgets/ButtonItem.vue")))
@@ -343,6 +346,8 @@ export default{
343
346
  app.component('IconListSetting', defineAsyncComponent(() => import("./widgets/IconListSetting.vue")))
344
347
  app.component('ImageItem', defineAsyncComponent(() => import("./widgets/ImageItem.vue")))
345
348
  app.component('ImageSetting', defineAsyncComponent(() => import("./widgets/ImageSetting.vue")))
349
+ app.component('MarginSetting', defineAsyncComponent(() => import("./widgets/MarginSetting.vue")))
350
+ app.component('PaddingSetting', defineAsyncComponent(() => import("./widgets/PaddingSetting.vue")))
346
351
  app.component('Share', defineAsyncComponent(() => import("./widgets/Share.vue")))
347
352
  app.component('ShareItem', defineAsyncComponent(() => import("./widgets/ShareItem.vue")))
348
353
  app.component('ShareSetting', defineAsyncComponent(() => import("./widgets/ShareSetting.vue")))
@@ -4,12 +4,12 @@ import {getQueryString} from "../utils/helpers.mjs";
4
4
  export const useWebPageBuilderStore = defineStore('webPageBuilder', {
5
5
 
6
6
  state: () =>({
7
- version: '0.0.0',
7
+ version: '0.0.1',
8
8
 
9
9
  layoutMode: false,
10
10
  selectedComponent: null,
11
11
  tabIndex: 1,
12
- viewType: 'mobile',
12
+ viewType: '',
13
13
  zoomLevel: 'fit'
14
14
  }),
15
15
 
@@ -177,23 +177,25 @@ const _applyClass = function(props, defaultClass = {}){
177
177
 
178
178
  const arr = []
179
179
 
180
- if(Array.isArray(props.padding) && props.padding.length > 0){
180
+ arr.push(classFromProps(props))
181
+
182
+ /*if(Array.isArray(props.padding) && props.padding.length > 0){
181
183
  for(let i in props.padding){
182
184
  const unit = calcUnit(mediaPrefixes[i], 'p', props.padding[i])
183
185
  if(unit){
184
186
  arr.push(unit)
185
187
  }
186
188
  }
187
- }
189
+ }*/
188
190
 
189
- if(Array.isArray(props.margin)){
191
+ /*if(Array.isArray(props.margin)){
190
192
  for(let i in props.margin){
191
193
  const unit = calcUnit(mediaPrefixes[i], 'm', props.margin[i])
192
194
  if(unit){
193
195
  arr.push(unit)
194
196
  }
195
197
  }
196
- }
198
+ }*/
197
199
 
198
200
  if(Array.isArray(props.gap) && props.gap.length > 0){
199
201
  for(let i in props.gap){
@@ -215,6 +217,28 @@ const _applyClass = function(props, defaultClass = {}){
215
217
  return arr
216
218
  }
217
219
 
220
+ const classFromProps = function(props){
221
+
222
+ return [
223
+ props.padding ? props.padding.join(' ') : '',
224
+ props.margin ? props.margin.join(' ') : '',
225
+ props.maxWidth ? props.maxWidth.join(' ') : '',
226
+ props.bgColors ? props.bgColors.join(' ') : '',
227
+ props.bgSize ? props.bgSize.join(' ') : '',
228
+ props.bgPosition ? props.bgPosition.join(' ') : '',
229
+ props.bgRepeat ? props.bgRepeat.join(' ') : '',
230
+ props.bdSize ? props.bdSize.join(' ') : '',
231
+ props.bdColor ? props.bdColor.join(' ') : '',
232
+ props.bdRadius ? props.bdRadius.join(' ') : '',
233
+ props.bdStyle ? props.bdStyle.join(' ') : '',
234
+ props.columns ? props.columns.join(' ') : '',
235
+ props.direction ? props.direction.join(' ') : '',
236
+ props.gap ? props.gap.join(' ') : '',
237
+ ]
238
+ .filter(_ => _)
239
+ .join(' ')
240
+ }
241
+
218
242
  export {
219
243
  downsizeImage,
220
244
  uid,
@@ -225,7 +249,8 @@ export {
225
249
  getQueryString,
226
250
  accessNestedObject,
227
251
  mediaPrefixes,
228
- _applyClass
252
+ _applyClass,
253
+ classFromProps
229
254
  }
230
255
 
231
256
  function observeInit(){
@@ -0,0 +1,25 @@
1
+ <template>
2
+ <div class="flex-1 flex flex-row items-center gap-4">
3
+ {{ item.props.name ?? item.type }}
4
+ </div>
5
+ </template>
6
+
7
+ <script>
8
+
9
+ export default{
10
+
11
+ props: {
12
+ item: Object
13
+ }
14
+
15
+ }
16
+
17
+ </script>
18
+
19
+ <style module>
20
+
21
+ .comp{
22
+
23
+ }
24
+
25
+ </style>
@@ -0,0 +1,42 @@
1
+ <template>
2
+ <div>
3
+ <h1>Block Setting</h1>
4
+ </div>
5
+ </template>
6
+
7
+ <script>
8
+
9
+ export default{
10
+
11
+ emits: [ 'save' ],
12
+
13
+ inject: [ 'socketEmit2' ],
14
+
15
+ methods: {
16
+
17
+ save(){
18
+ this.$emit('save')
19
+ this.close()
20
+ }
21
+
22
+ },
23
+
24
+ props: {
25
+
26
+ item: Object,
27
+
28
+ viewTypes: Array
29
+
30
+ }
31
+
32
+ }
33
+
34
+ </script>
35
+
36
+ <style module>
37
+
38
+ .comp{
39
+
40
+ }
41
+
42
+ </style>
@@ -106,7 +106,7 @@ export default{
106
106
  }
107
107
  },
108
108
 
109
- inject: [ 'confirm', 'defaultColors' ],
109
+ inject: [ 'confirm' ],
110
110
 
111
111
  methods: {
112
112
 
@@ -56,7 +56,7 @@ export default{
56
56
  }
57
57
  },
58
58
 
59
- inject: [ 'confirm', 'defaultColors', 'imageSrc' ],
59
+ inject: [ 'confirm', 'imageSrc' ],
60
60
 
61
61
  methods: {
62
62