@mixd-id/web-scaffold 0.2.250801009 → 0.2.250801010

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.2.250801009",
4
+ "version": "0.2.250801010",
5
5
  "scripts": {
6
6
  "dev": "vite serve",
7
7
  "build": "vite build",
@@ -91,7 +91,7 @@ export default{
91
91
  this._state = null
92
92
  },
93
93
 
94
- onClick() {
94
+ onClick(e) {
95
95
  if ('edit-mode' in this.$route.query) return
96
96
 
97
97
  if (this.isDisabled) {
@@ -113,7 +113,7 @@ export default{
113
113
  break
114
114
  }
115
115
  } else {
116
- this.$emit('click')
116
+ this.$emit('click', e)
117
117
  }
118
118
  }
119
119
  },
@@ -177,7 +177,8 @@ export default{
177
177
  }
178
178
 
179
179
  .button-primary{
180
- @apply bg-primary border-primary text-white;
180
+ @apply border-primary text-white;
181
+ background: var(--primary-500);
181
182
  @apply hover:bg-primary-600 hover:border-primary-600 disabled:bg-primary;
182
183
  }
183
184
  .button-primary *{
@@ -194,8 +195,9 @@ export default{
194
195
  }
195
196
 
196
197
  .button-secondary{
197
- @apply bg-secondary border-secondary text-white;
198
+ @apply border-secondary text-white;
198
199
  @apply hover:bg-secondary-600 hover:border-secondary-600;
200
+ background: var(--secondary-500);
199
201
  }
200
202
  .button-secondary .svgBg{
201
203
  stroke: #fff;
@@ -19,13 +19,13 @@
19
19
  </div>
20
20
  </slot>
21
21
 
22
- <slot name="default"></slot>
22
+ <slot name="default" :context="context"></slot>
23
23
 
24
24
  </div>
25
25
  </Transition>
26
26
  </Teleport>
27
27
  <div v-else :class="computedClass">
28
- <slot name="default"></slot>
28
+ <slot name="default" :context="context"></slot>
29
29
  </div>
30
30
  </template>
31
31
 
@@ -56,8 +56,10 @@ export default{
56
56
  },
57
57
 
58
58
  computedState(){
59
- return this.mounted &&
60
- (this.query ? this.query in this.$route.query : this._state);
59
+ const state = this.query ? this.query in this.$route.query :
60
+ (this.hash ? this.$route.hash.indexOf(this.hash) > -1 : this._state);
61
+
62
+ return state
61
63
  },
62
64
 
63
65
  computedStyle(){
@@ -75,8 +77,8 @@ export default{
75
77
 
76
78
  data(){
77
79
  return {
78
- mounted: false,
79
- _state: false
80
+ _state: false,
81
+ context: {}
80
82
  }
81
83
  },
82
84
 
@@ -94,13 +96,31 @@ export default{
94
96
  }
95
97
  })
96
98
  }
99
+ else if(this.hash){
100
+
101
+ let currentHash = ''
102
+ const hashNames = this.$route.hash.split('#')
103
+ for(let name of hashNames){
104
+ if(name.indexOf(this.hash.substring(1)) > -1){
105
+ currentHash = `#${name}`
106
+ break
107
+ }
108
+ }
109
+
110
+ this.$router.replace({
111
+ ...this.$route,
112
+ hash: this.$route.hash.replace(currentHash, '')
113
+ })
114
+ }
97
115
  else{
98
116
  this._state = false
99
117
  }
100
118
 
101
119
  },
102
120
 
103
- open(){
121
+ open(context = {}){
122
+ this.context = context
123
+
104
124
  if(this.query){
105
125
 
106
126
  }
@@ -145,6 +165,8 @@ export default{
145
165
  default: false
146
166
  },
147
167
 
168
+ hash: String,
169
+
148
170
  query: String,
149
171
 
150
172
  width: [ String, Number ],
@@ -86,7 +86,7 @@ export default{
86
86
  else{
87
87
  if(this.valueType === 'rgb'){
88
88
  const hex = hexToRgb(color)
89
- this.$emit('update:modelValue', `${hex.r},${hex.g},${hex.b}`)
89
+ this.$emit('update:modelValue', `rgb(${hex.r},${hex.g},${hex.b})`)
90
90
  }
91
91
  else{
92
92
  this.$emit('update:modelValue', color)
@@ -122,7 +122,9 @@ export default{
122
122
 
123
123
  let value = this.modelValue
124
124
  if(this.valueType === 'rgb'){
125
- value = rgbToHex(...(this.modelValue ?? '').split(','))
125
+ const rgbColors = (this.modelValue ?? '').match(/rgb\((\d+),\s*(\d+),\s*(\d+)\)/)
126
+ const rgbValue = rgbColors ? [rgbColors[1], rgbColors[2], rgbColors[3]] : null
127
+ value = rgbToHex(...(rgbValue ? rgbValue : [0,0,0]))
126
128
  }
127
129
 
128
130
  return {
@@ -297,7 +297,7 @@ export default{
297
297
 
298
298
  emits: [ 'dragover', 'after-load', 'open-preset', 'signal', 'pivot-item-click' ],
299
299
 
300
- inject: [ 'useSocket', 'socket', 'toast' ],
300
+ inject: [ 'useSocket', 'toast' ],
301
301
 
302
302
  props: {
303
303
  config: Object,
@@ -464,6 +464,10 @@ export default{
464
464
  if(this.$route.query?.search)
465
465
  this.preset.search = this.$route.query.search
466
466
  }
467
+ else{
468
+ const defaultConfig = setupConfig(typeof this.defaultConfig === 'function' ? await this.defaultConfig() : {})
469
+ Object.assign(this.cConfig, defaultConfig)
470
+ }
467
471
  }
468
472
  else{
469
473
  const defaultConfig = setupConfig(typeof this.defaultConfig === 'function' ? await this.defaultConfig() : {})
@@ -116,7 +116,7 @@ export default{
116
116
  this.$el.querySelectorAll('[data-reorder]').forEach((comp) => {
117
117
  if(comp.closest(`.${this.$style.comp}`) === this.$el){
118
118
  comp.addEventListener('mousedown', this.onDrag)
119
- comp.addEventListener('touchstart', this.onDrag)
119
+ comp.addEventListener('touchstart', this.onDrag, { passive:true })
120
120
  }
121
121
  })
122
122
  }
@@ -1,10 +1,16 @@
1
1
  <template>
2
2
  <div :class="$style.comp">
3
3
  <div :class="computedClass">
4
- <input :class="$style.input" maxlength="1" type="tel" @focus="onFocus"
5
- ref="verify" @keydown="verifyKeyDown" v-for="i in parseInt(length)"
6
- :value="typeof modelValue === 'string' ? modelValue.split('')[i - 1] : ''"
7
- @paste="verifyPaste" @keyup="verifyKeyUp($event, i - 1)" />
4
+ <input v-for="i in parseInt(length)"
5
+ :class="computedItemClass"
6
+ :value="numbers[i - 1] ?? ''"
7
+ maxlength="1"
8
+ type="tel"
9
+ ref="verify"
10
+ @focus="onFocus"
11
+ @keydown="verifyKeyDown"
12
+ @paste="verifyPaste"
13
+ @keyup="verifyKeyUp($event, i - 1)" />
8
14
  </div>
9
15
  </div>
10
16
  </template>
@@ -17,6 +23,8 @@ export default{
17
23
 
18
24
  modelValue: String,
19
25
 
26
+ itemClass: String,
27
+
20
28
  length: {
21
29
  type: [ String, Number ],
22
30
  default: 4
@@ -34,11 +42,21 @@ export default{
34
42
  this.size ? this.$style['size-' + this.size] : '',
35
43
  ]
36
44
  .join(' ')
45
+ .trim()
37
46
  },
38
47
 
39
- verify(){
40
- return this.modelValue.split('')
41
- }
48
+ computedItemClass(){
49
+ return [
50
+ this.$style.input,
51
+ this.itemClass ? this.itemClass : ''
52
+ ]
53
+ .join(' ')
54
+ .trim()
55
+ },
56
+
57
+ numbers(){
58
+ return (this.modelValue ?? '').split('')
59
+ }
42
60
 
43
61
  },
44
62
 
@@ -71,10 +89,12 @@ export default{
71
89
  e.stopPropagation()
72
90
  e.preventDefault()
73
91
  const clipboardData = e.clipboardData || window.clipboardData
74
- const text = clipboardData.getData('Text')
75
92
 
76
- if((new RegExp('^\\d{' + this.size + '}$')).test(text)){
93
+ let text = clipboardData.getData('Text')
94
+ if(/^\d+$/.test(text)){
95
+ text = text.substring(0, parseInt(this.length))
77
96
  this.$emit('update:modelValue', text)
97
+ this.$refs.verify[this.$refs.verify.length - 1].select()
78
98
  }
79
99
  },
80
100
 
@@ -96,7 +116,7 @@ export default{
96
116
 
97
117
  .input{
98
118
  @apply outline-none text-center bg-base-300 text-lg;
99
- @apply border-[1px] border-border-200 rounded-lg;
119
+ @apply border-[1px] border-border-200 rounded-lg p-3;
100
120
  }
101
121
  .input:focus{
102
122
  @apply border-primary;
@@ -68,9 +68,10 @@ export default{
68
68
  modelValue(to, from){
69
69
  this.$emit('update:modelValue', to)
70
70
  this.$emit('change', to)
71
+
71
72
  this.$nextTick(() => {
72
- this.$el.style.height = '';
73
- this.$el.style.height = this.$refs.input.scrollHeight + 'px'
73
+ this.$refs.input.style.height = '';
74
+ this.$refs.input.style.height = this.$refs.input.scrollHeight + 'px'
74
75
  })
75
76
  }
76
77
 
@@ -143,13 +144,11 @@ export default{
143
144
  <style module>
144
145
 
145
146
  .textarea{
146
- @apply min-h-[var(--h-cp)];
147
- @apply flex items-start border-[1px] border-border-200 bg-base-400 rounded-lg overflow-hidden;
148
- @apply !max-h-[200px];
147
+ @apply flex flex-row items-start border-[1px] border-border-200 bg-base-400;
148
+ @apply rounded-lg overflow-hidden ;
149
149
  }
150
150
  .textarea textarea{
151
- @apply flex-1 outline-none p-2 bg-transparent resize-none;
152
- @apply self-stretch;
151
+ @apply flex-1 outline-none p-2 bg-transparent resize-none min-h-[2.6rem];
153
152
  scrollbar-width: none;
154
153
  }
155
154
  .textarea>textarea::-webkit-scrollbar{
@@ -77,6 +77,10 @@ export const componentMixin = {
77
77
  textColor: Array,
78
78
  lineHeight: Array,
79
79
 
80
+ objectFit: Array,
81
+ objectPosition: Array,
82
+ backdropBlur: Array,
83
+
80
84
  boxShadow: Array,
81
85
  opacity: Array,
82
86
  itemRatio: Array,
@@ -4,10 +4,25 @@ const plugin = Plugin(function({ addBase, addUtilities, config, theme }) {
4
4
 
5
5
  addBase({
6
6
 
7
+ ':root': {
8
+ '--space-1': '0.25rem',
9
+ '--space-2': '0.5rem',
10
+ '--space-3': '0.75rem',
11
+ '--space-4': '1rem',
12
+ '--space-5': '1.25rem',
13
+ '--space-6': '1.5rem',
14
+ '--space-7': '1.75rem',
15
+ '--space-8': '2rem',
16
+ '--space-9': '2.25rem',
17
+ '--space-10': '2.5rem',
18
+ '--space-11': '2.75rem',
19
+ '--space-12': '3rem'
20
+ },
21
+
7
22
  '*': {
8
23
  'color': theme('colors.text.DEFAULT'),
9
24
  'fontFamily': 'ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,apple color emoji,segoe ui emoji,Segoe UI Symbol,noto color emoji',
10
- 'fontSize': '13px'
25
+ //'fontSize': '13px'
11
26
  },
12
27
 
13
28
  'html, .html': {
@@ -26,12 +41,12 @@ const plugin = Plugin(function({ addBase, addUtilities, config, theme }) {
26
41
  '-webkit-font-smoothing': 'antialiased',
27
42
  '-moz-osx-font-smoothing': 'grayscale',
28
43
  'text-rendering': 'optimizeLegibility',
29
- 'fontSize': '15px',
44
+ //'fontSize': '15px',
30
45
  'touchAction': "pan-x pan-y",
31
46
  'backgroundColor': 'var(--base-300)'
32
47
  },
33
48
 
34
- '@media screen and (orientation: portrait)': {
49
+ /*'@media screen and (orientation: portrait)': {
35
50
  '*': {
36
51
  'fontSize': '14px',
37
52
  },
@@ -41,7 +56,7 @@ const plugin = Plugin(function({ addBase, addUtilities, config, theme }) {
41
56
  },
42
57
 
43
58
  "input, input[type='text'], input[type='number'], textarea, select, option": {fontSize: "16px !important"}
44
- },
59
+ },*/
45
60
 
46
61
  '::-webkit-scrollbar': {
47
62
  'height': '8px',
@@ -264,6 +279,22 @@ const plugin = Plugin(function({ addBase, addUtilities, config, theme }) {
264
279
  500: "var(--whatsapp-500)",
265
280
  DEFAULT: "var(--whatsapp)"
266
281
  },
282
+ },
283
+
284
+ spacing: {
285
+ 0: '0',
286
+ 1: 'var(--space-1)',
287
+ 2: 'var(--space-2)',
288
+ 3: 'var(--space-3)',
289
+ 4: 'var(--space-4)',
290
+ 5: 'var(--space-5)',
291
+ 6: 'var(--space-6)',
292
+ 7: 'var(--space-7)',
293
+ 8: 'var(--space-8)',
294
+ 9: 'var(--space-9)',
295
+ 10: 'var(--space-10)',
296
+ 11: 'var(--space-11)',
297
+ 12: 'var(--space-12)',
267
298
  }
268
299
  }
269
300
  }
package/src/utils/wss.js CHANGED
@@ -185,13 +185,7 @@ class WSS extends EventEmitter2{
185
185
  data = arr.length > 0 ? JSON.parse(JSON.stringify(arr.pop())) : data
186
186
  }
187
187
  catch(e){
188
-
189
- if(e.response){
190
- '$report' in process ? process.$report(e) : console.error(e.response.status, e.response.data)
191
- }
192
- else{
193
- '$report' in process ? process.$report(e) : console.error(e)
194
- }
188
+ console.error(e)
195
189
 
196
190
  status = 500
197
191
  data = {
@@ -526,7 +526,38 @@ export default{
526
526
  [ 'mx-', 'my-' ],
527
527
  [ 'ml-', 'mt-', 'mr-', 'mb-' ]
528
528
  ]
529
- }}
529
+ }},
530
+
531
+ { text:"Object Fit", key:"objectFit", values: [
532
+ [ 'object-contain', 'Contain'],
533
+ [ 'object-cover', 'Cover' ],
534
+ [ 'object-fill', 'Fill' ],
535
+ [ 'object-none', 'None' ],
536
+ [ 'object-scale-down', 'Scale Down' ],
537
+ ]},
538
+
539
+ { text:"Object Position", key:"objectPosition", values: [
540
+ [ 'object-bottom', 'Bottom' ],
541
+ [ 'object-center', 'Center' ],
542
+ [ 'object-left', 'Left' ],
543
+ [ 'object-left-bottom', 'Left Bottom' ],
544
+ [ 'object-left-top', 'Left Top' ],
545
+ [ 'object-right', 'Right' ],
546
+ [ 'object-right-bottom', 'Right Bottom' ],
547
+ [ 'object-right-top', 'Right Top' ],
548
+ [ 'object-top', 'Top' ],
549
+ ]},
550
+
551
+ { text:"Backdrop Blur", key:"backdropBlur", values: [
552
+ [ 'backdrop-blur-none', 'None' ],
553
+ [ 'backdrop-blur-sm', 'Small' ],
554
+ [ 'backdrop-blur', 'Medium' ],
555
+ [ 'backdrop-blur-md', 'Medium' ],
556
+ [ 'backdrop-blur-lg', 'Large' ],
557
+ [ 'backdrop-blur-xl', 'Extra Large' ],
558
+ [ 'backdrop-blur-2xl', '2xl' ],
559
+ [ 'backdrop-blur-3xl', '3xl' ],
560
+ ]}
530
561
 
531
562
  ]},
532
563
 
@@ -704,7 +735,7 @@ export default{
704
735
  [ 'w-[70vw]', '70vw' ],
705
736
  [ 'w-[80vw]', '80vw' ],
706
737
  [ 'w-[90vw]', '90vw' ],
707
- ]}
738
+ ]},
708
739
 
709
740
  ]},
710
741
 
@@ -59,7 +59,7 @@ export default{
59
59
  <style module>
60
60
 
61
61
  .comp{
62
- @apply bg-white flex flex-row items-center p-4 md:px-8;
62
+ @apply flex flex-row items-center p-4 md:px-8;
63
63
  }
64
64
 
65
65
  </style>
@@ -4,7 +4,7 @@
4
4
  <div class="flex flex-col gap-4 p-6 py-4">
5
5
  <div>
6
6
  <div class="flex flex-row gap-3">
7
- <small class="flex-1 text-text-400">Image</small>
7
+ <small class="flex-1 text-text-400" @dbclick="log(item.props)">Image</small>
8
8
  <ImageUploader ref="uploader" @change="image => item.props.src[viewIndex] = image" :upload-fn="uploadImage" class="text-sm"></ImageUploader>
9
9
  </div>
10
10
  <div class="mt-1">