@mixd-id/web-scaffold 0.1.230406066 → 0.1.230406068

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.230406066",
4
+ "version": "0.1.230406068",
5
5
  "scripts": {
6
6
  "dev": "vite serve",
7
7
  "build": "vite build",
@@ -2,7 +2,7 @@
2
2
  <div :class="$style.comp">
3
3
  <input :id="id" type="checkbox" :checked="checked" @change="onChange" :disabled="isDisabled"/>
4
4
  <label :for="id">
5
- <div :class="$style.indicator">
5
+ <div :class="$style.indicator" v-if="Boolean(showIcon)">
6
6
  <Transition name="checkbox">
7
7
  <div v-if="checked">
8
8
  <svg width="14" height="14" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!--! Font Awesome Pro 6.2.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2022 Fonticons, Inc. --><path d="M470.6 105.4c12.5 12.5 12.5 32.8 0 45.3l-256 256c-12.5 12.5-32.8 12.5-45.3 0l-128-128c-12.5-12.5-12.5-32.8 0-45.3s32.8-12.5 45.3 0L192 338.7 425.4 105.4c12.5-12.5 32.8-12.5 45.3 0z"/></svg>
@@ -25,7 +25,11 @@ export default {
25
25
  value: undefined,
26
26
  trueValue: undefined,
27
27
  falseValue: undefined,
28
- disabled: undefined
28
+ disabled: undefined,
29
+ showIcon: {
30
+ type: undefined,
31
+ default: true
32
+ }
29
33
  },
30
34
 
31
35
  computed: {
@@ -0,0 +1,62 @@
1
+ <template>
2
+ <div :class="$style.comp">
3
+ <div class="flex flex-row bg-text-50 p-2">
4
+ <div class="flex-1">&nbsp;</div>
5
+ </div>
6
+ <code v-html="modelValue" contenteditable="true" spellcheck="false"
7
+ @paste="onPaste"></code>
8
+ </div>
9
+ </template>
10
+
11
+ <script>
12
+
13
+ export default{
14
+
15
+ props:{
16
+
17
+ modelValue: String
18
+
19
+ },
20
+
21
+ methods: {
22
+
23
+ beautify(){
24
+ const html = JSON.parse(JSON.stringify(this.modelValue, null, 2))
25
+ console.log(html)
26
+ this.$emit('update:modelValue', html)
27
+ },
28
+
29
+ onPaste(e) {
30
+ e.preventDefault()
31
+
32
+ let text = (e.clipboardData || window.clipboardData).getData("text");
33
+ const el = document.createElement('div')
34
+ el.innerHTML = text
35
+ text = el.innerText
36
+
37
+ this.$emit('update:modelValue', text)
38
+ }
39
+
40
+ }
41
+
42
+ }
43
+
44
+ </script>
45
+
46
+ <style module>
47
+
48
+ .comp{
49
+ @apply border-text-50 border-[1px] rounded-lg overflow-hidden flex flex-col;
50
+ }
51
+
52
+ .comp code{
53
+ @apply p-6 bg-base-300;
54
+ white-space: pre-wrap;
55
+ tab-size: 1rem;
56
+ }
57
+
58
+ .comp [contenteditable]{
59
+ outline: 0px solid transparent;
60
+ }
61
+
62
+ </style>
@@ -26,6 +26,8 @@
26
26
 
27
27
  export default{
28
28
 
29
+ emits: [ 'change', 'update:modelValue' ],
30
+
29
31
  props: {
30
32
 
31
33
  colors: Array,
@@ -40,6 +42,7 @@ export default{
40
42
 
41
43
  select(color){
42
44
  this.$emit('update:modelValue', color)
45
+ this.$emit('change')
43
46
  this.$refs.contextMenu.close()
44
47
  }
45
48
 
@@ -228,7 +228,7 @@ export default{
228
228
  },
229
229
 
230
230
  mounted() {
231
- this.html = this.modelValue
231
+ this.update()
232
232
  },
233
233
 
234
234
  methods: {
@@ -431,6 +431,10 @@ export default{
431
431
  this.updateModelValue()
432
432
  },
433
433
 
434
+ update(){
435
+ this.html = this.modelValue
436
+ },
437
+
434
438
  updateModelValue(){
435
439
 
436
440
  let html = this.$refs.article.innerHTML
@@ -144,7 +144,7 @@ export default{
144
144
 
145
145
  methods: {
146
146
 
147
- open(context){
147
+ open(context = {}){
148
148
  this.context = context
149
149
  this._state = true
150
150
  },
@@ -15,6 +15,8 @@ import {parseBoolean} from "../utils/helpers.mjs";
15
15
 
16
16
  export default{
17
17
 
18
+ emits: [ 'change' ],
19
+
18
20
  props:{
19
21
  name: String,
20
22
  checked: undefined,
@@ -44,6 +46,7 @@ export default{
44
46
  onChange(){
45
47
  if(this.isDisabled) return
46
48
  this.$emit('update:modelValue', this.value)
49
+ this.$emit('change')
47
50
  }
48
51
 
49
52
  }
package/src/index.js CHANGED
@@ -143,6 +143,10 @@ const unregisterResizeEvent = (fn) => {
143
143
  }
144
144
  }
145
145
 
146
+ const consoleInfo = (text) => { console.info(text) }
147
+ const consoleLog = (text) => { console.log(text) }
148
+ const consoleWarn = (text) => { console.warn(text) }
149
+
146
150
  const util = {
147
151
 
148
152
  push: (arr, item, opt = { key:"id" }) => {
@@ -239,6 +243,9 @@ export default{
239
243
  app.config.globalProperties.$util = util
240
244
  app.config.globalProperties.$resize = registerResizeEvent
241
245
  app.config.globalProperties.$unresize = unregisterResizeEvent
246
+ app.config.globalProperties.log = consoleLog
247
+ app.config.globalProperties.warn = consoleWarn
248
+ app.config.globalProperties.info = consoleInfo
242
249
 
243
250
  app.component('Alert', defineAsyncComponent(() => import("./components/Alert.vue")))
244
251
  app.component('Button', defineAsyncComponent(() => import("./components/Button.vue")))
@@ -248,6 +255,7 @@ export default{
248
255
  app.component('ButtonGroup', defineAsyncComponent(() => import("./components/ButtonGroup.vue")))
249
256
  app.component('ChatTyping', defineAsyncComponent(() => import("./components/ChatTyping.vue")))
250
257
  app.component('Checkbox', defineAsyncComponent(() => import("./components/Checkbox.vue")))
258
+ app.component('CodeEditor', defineAsyncComponent(() => import("./components/CodeEditor.vue")))
251
259
  app.component('CopyToClipboard', defineAsyncComponent(() => import("./components/CopyToClipboard.vue")))
252
260
  app.component('Countdown', defineAsyncComponent(() => import("./components/Countdown.vue")))
253
261
  app.component('Datepicker', defineAsyncComponent(() => import("./components/Datepicker.vue")))
@@ -296,9 +304,9 @@ export default{
296
304
  app.component('VirtualScroll', defineAsyncComponent(() => import("./components/VirtualScroll.vue")))
297
305
  app.component('VirtualTable', defineAsyncComponent(() => import("./components/VirtualTable.vue")))
298
306
  app.component('Slider', defineAsyncComponent(() => import("./components/Slider.vue")))
307
+ app.component('SplitPane', defineAsyncComponent(() => import("./components/SplitPane.vue")))
299
308
  app.component('TabView', defineAsyncComponent(() => import("./components/TabView.vue")))
300
309
  app.component('TextEditor', defineAsyncComponent(() => import("./components/TextEditor.vue")))
301
- app.component('SplitPane', defineAsyncComponent(() => import("./components/SplitPane.vue")))
302
310
 
303
311
 
304
312
  }
@@ -274,6 +274,27 @@ const accessNestedObject = function(obj, path) {
274
274
  return nestedObj;
275
275
  }
276
276
 
277
+ const cssDict = {
278
+ 'Global': '*',
279
+ 'Font': 'font-family',
280
+ 'Impact': "'Impact', 'Arial Black', 'Arial Bold', Gadget, sans-serif",
281
+ }
282
+
283
+ const generateStylesheet = (styleObj) => {
284
+
285
+ return `*{ font-family: Impact; }`
286
+
287
+ }
288
+
289
+ const hexToRgb = (hex) => {
290
+ var result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
291
+ return result ? {
292
+ r: parseInt(result[1], 16),
293
+ g: parseInt(result[2], 16),
294
+ b: parseInt(result[3], 16)
295
+ } : null;
296
+ }
297
+
277
298
 
278
299
  module.exports = {
279
300
  ceil,
@@ -293,5 +314,7 @@ module.exports = {
293
314
  sequelizeChunk,
294
315
  getPresetSortWhereParams,
295
316
  unflatten,
296
- accessNestedObject
317
+ accessNestedObject,
318
+ generateStylesheet,
319
+ hexToRgb
297
320
  }