@mixd-id/web-scaffold 0.1.230406232 → 0.1.230406234

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.230406232",
4
+ "version": "0.1.230406234",
5
5
  "scripts": {
6
6
  "dev": "vite serve",
7
7
  "build": "vite build",
@@ -140,7 +140,7 @@ export default{
140
140
  @apply p-2;
141
141
  @apply relative flex items-center justify-center;
142
142
  @apply whitespace-nowrap text-ellipsis overflow-hidden;
143
- @apply rounded-lg;
143
+ @apply rounded-lg appearance-none;
144
144
  }
145
145
  .button>*:first-child{
146
146
  @apply flex items-center justify-center
@@ -155,21 +155,17 @@ export default{
155
155
  .button-primary{
156
156
  @apply bg-primary-500 text-white rounded-lg;
157
157
  box-shadow: 0 2px 1px rgba(0, 0, 0, .05);
158
- outline: solid 1px rgb(var(--primary-700));
159
158
  border: solid 1px rgb(var(--primary-400));
160
159
  }
161
160
  .button-primary:focus{
162
- outline-color: rgb(var(--primary-800));
163
161
  border-color: rgb(var(--primary-600));
164
162
  }
165
163
  .button-primary:hover{
166
164
  @apply bg-primary-600;
167
- outline-color: rgb(var(--primary-800))
168
165
  }
169
166
  .button-primary:disabled{
170
167
  @apply bg-primary-500 opacity-50 top-0 left-0 cursor-not-allowed;
171
168
  @apply top-0 left-0;
172
- outline: solid 1px rgb(var(--primary-700));
173
169
  }
174
170
  .button-primary *{
175
171
  @apply text-white fill-white;
@@ -188,10 +184,8 @@ export default{
188
184
 
189
185
  .button-outline{
190
186
  @apply bg-transparent text-primary-500;
191
- outline: solid 1px rgb(var(--primary-700));
192
187
  }
193
188
  .button-outline:hover{
194
- outline-color: rgb(var(--primary-800))
195
189
  }
196
190
  .button-outline:disabled{
197
191
  @apply opacity-50 top-0 left-0 cursor-not-allowed;
@@ -215,17 +209,14 @@ export default{
215
209
  .button-secondary{
216
210
  @apply bg-secondary-200 text-text-500 rounded-lg;
217
211
  box-shadow: 0 2px 1px rgba(0, 0, 0, .05);
218
- outline: solid 1px rgb(var(--secondary-200));
219
212
  border: solid 1px rgb(var(--secondary-200));
220
213
  }
221
214
  .button-secondary:hover{
222
215
  @apply bg-secondary-100;
223
- outline-color: rgb(var(--secondary-100));
224
216
  border-color: rgb(var(--secondary-100));
225
217
  }
226
218
  .button-secondary:disabled{
227
219
  @apply bg-secondary-500 opacity-50 top-0 left-0 cursor-not-allowed;
228
- outline: solid 1px rgb(var(--secondary-700));
229
220
  }
230
221
  .button-secondary *{
231
222
  @apply text-text-500 fill-white;
@@ -6,10 +6,9 @@
6
6
  <slot>
7
7
  <div class="p-6">
8
8
  <div ref="item" :class="$style.item" @mouseover="onMouseOver" @mouseout="onMouseOut">
9
- <div></div>
10
- <div class="flex-1 break-all whitespace-pre-line">{{ text }}</div>
9
+ <div class="flex-1">{{ text }}</div>
11
10
  <div>
12
- <button type="button" class="text-sm" @click="close">Dismiss</button>
11
+ <button type="button" class="text-sm text-primary" @click="close">Dismiss</button>
13
12
  </div>
14
13
  </div>
15
14
  </div>
@@ -210,10 +210,14 @@ export default{
210
210
 
211
211
  items: {
212
212
  deep: true,
213
- handler(){
214
- this.resize()
213
+ handler(to, from){
214
+ if((to ?? []).length !== (from ?? []).length){
215
+ this.scrollTop = 0
216
+ }
217
+
218
+ this.resize()
215
219
  }
216
- }
220
+ },
217
221
 
218
222
  }
219
223
 
@@ -241,11 +245,11 @@ export default{
241
245
  }
242
246
 
243
247
  .item:hover{
244
- @apply bg-primary-50;
248
+ @apply bg-text-50;
245
249
  }
246
250
 
247
251
  .item.trSelected{
248
- @apply bg-primary-100;
252
+ @apply bg-text-100;
249
253
  }
250
254
 
251
255
  .highlight{
@@ -405,7 +405,11 @@ export default{
405
405
 
406
406
  items: {
407
407
  deep: true,
408
- handler(){
408
+ handler(to, from){
409
+ if((to ?? []).length !== (from ?? []).length){
410
+ this.scrollTop = 0
411
+ }
412
+
409
413
  this.resize()
410
414
  }
411
415
  },
package/src/index.js CHANGED
@@ -1,6 +1,8 @@
1
1
  import {defineAsyncComponent, ref} from "vue"
2
2
  import {observeInit} from './utils/helpers.mjs'
3
3
  import throttle from "lodash/throttle"
4
+ import dayjs from "dayjs";
5
+ import groupBy from "lodash/groupBy";
4
6
 
5
7
  let _UNIQID = 0
6
8
  const uniqid = (additionalKey = '') => {
@@ -150,6 +152,11 @@ const consoleTime = (text) => { console.time(text) }
150
152
  const consoleTimeLog = (text) => { console.timeLog(text) }
151
153
  const consoleTimeEnd = (text) => { console.timeEnd(text) }
152
154
 
155
+ const formatDate = (date, format = 'YYYY-MM-DD HH:mm:ss') => {
156
+ if(!date) return ''
157
+ return dayjs(date).format(format)
158
+ }
159
+
153
160
  const util = {
154
161
 
155
162
  dragResize: (e, callback) => {
@@ -178,13 +185,35 @@ const util = {
178
185
  window.addEventListener('mouseup', onMouseUp)
179
186
  },
180
187
 
181
- push: (arr, item, opt = { key:"id" }) => {
182
- const index = arr.findIndex((_) => _[opt.key] === item[opt.key])
183
- if(index >= 0){
184
- Object.assign(arr[index], item)
188
+ push: (arr, items, opt = { key:"id" }) => {
189
+ if(!Array.isArray(arr)) return
190
+ if(!Array.isArray(items)) items = [ items ]
191
+
192
+ for(let item of items){
193
+ if(!item) continue
194
+
195
+ const index = arr.findIndex((_) => _[opt.key] === item[opt.key])
196
+ if(index >= 0){
197
+ Object.assign(arr[index], item)
198
+ }
199
+ else{
200
+ arr.push(item)
201
+ }
185
202
  }
186
- else{
187
- arr.push(item)
203
+ },
204
+
205
+ remove: (arr, sliced, opt = { key:'id' }) => {
206
+ if(!Array.isArray(arr)) return
207
+ if(!Array.isArray(sliced)) sliced = [ sliced ]
208
+
209
+ sliced = groupBy(sliced, opt.key)
210
+
211
+ for(let i = arr.length - 1 ; i >= 0 ; i--){
212
+ if(!arr[i]) continue
213
+
214
+ if(arr[i][opt.key] in sliced){
215
+ arr.splice(i, 1)
216
+ }
188
217
  }
189
218
  },
190
219
 
@@ -337,6 +366,7 @@ export default{
337
366
  const privateVars = {}
338
367
 
339
368
  app.config.globalProperties.uniqid = uniqid
369
+ app.config.globalProperties.formatDate = formatDate
340
370
  app.config.globalProperties.$download = download
341
371
  app.config.globalProperties.$preload = preload
342
372
  app.config.globalProperties.$popPreloads = popPreloads
@@ -57,6 +57,9 @@ const plugin = Plugin(function({ addBase, config, theme }) {
57
57
  '--whatsapp-100': '179, 206, 201',
58
58
  '--whatsapp-500': '0, 93, 75',
59
59
 
60
+ '--facebook-100': '205, 215, 231',
61
+ '--facebook-500': '8, 102, 255',
62
+
60
63
  },
61
64
 
62
65
  'html[data-theme="dark"], .html[data-theme="dark"]': {
@@ -90,7 +90,7 @@ let ListView = {
90
90
  async unsubscribe(params, socket){
91
91
  const { name } = params
92
92
  if(name){
93
- socket.leave(this.name)
93
+ socket.leave(name)
94
94
  }
95
95
  },
96
96