@mixd-id/web-scaffold 0.1.230406171 → 0.1.230406173

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.230406171",
4
+ "version": "0.1.230406173",
5
5
  "scripts": {
6
6
  "dev": "vite serve",
7
7
  "build": "vite build",
@@ -15,6 +15,7 @@
15
15
  "./components/Textbox.vue": "./src/components/Textbox.vue",
16
16
  "./mixin/component": "./src/mixin/component.js",
17
17
  "./mixin/edit-mode": "./src/mixin/edit-mode.js",
18
+ "./middleware/http/trim-string": "./src/middleware/http/trim-string.js",
18
19
  "./helpers": {
19
20
  "require": "./src/utils/helpers.js",
20
21
  "import": "./src/utils/helpers.mjs"
@@ -15,9 +15,7 @@ export default{
15
15
  mixins: [ componentMixin ],
16
16
 
17
17
  props:{
18
- class: String,
19
- items: Array,
20
- type: String,
18
+ items: Array,
21
19
  }
22
20
 
23
21
  }
@@ -1,8 +1,9 @@
1
1
  <template>
2
- <div :class="$style.comp">
2
+ <div :class="$style.Flex">
3
3
 
4
4
  <component v-for="(item, idx) in items"
5
5
  :is="item.type"
6
+ :key="item.key"
6
7
  :="item" />
7
8
 
8
9
  </div>
@@ -32,13 +33,13 @@ export default{
32
33
 
33
34
  <style module>
34
35
 
35
- .comp{
36
+ .Flex{
36
37
  @apply flex;
37
38
  background-image: v-bind(bgImages[0]);
38
39
  }
39
40
 
40
41
  @media screen(md){
41
- .comp{
42
+ .Flex{
42
43
  background-image: v-bind(bgImages[1]);
43
44
  }
44
45
  }
@@ -3,6 +3,7 @@
3
3
 
4
4
  <component v-for="item in items"
5
5
  :is="item.type"
6
+ :key="item.key"
6
7
  :="item" />
7
8
 
8
9
  </div>
@@ -247,7 +247,7 @@ export default{
247
247
 
248
248
  watch:{
249
249
 
250
- src(){
250
+ src(to, from){
251
251
  this.loadSrc()
252
252
  },
253
253
 
@@ -374,6 +374,8 @@ export default{
374
374
  this.configLoaded = true
375
375
  if('reset' in ((this.$route ?? {}).query ?? {}))
376
376
  await this.saveConfig()
377
+
378
+ this.$router.replace({ query: { ...this.$route.query, reset: undefined } })
377
379
  }
378
380
  else{
379
381
  switch(this.configStoreObj.type){
package/src/index.js CHANGED
@@ -146,6 +146,9 @@ const unregisterResizeEvent = (fn) => {
146
146
  const consoleInfo = (text) => { console.info(text) }
147
147
  const consoleLog = (text) => { console.log(text) }
148
148
  const consoleWarn = (text) => { console.warn(text) }
149
+ const consoleTime = (text) => { console.time(text) }
150
+ const consoleTimeLog = (text) => { console.timeLog(text) }
151
+ const consoleTimeEnd = (text) => { console.timeEnd(text) }
149
152
 
150
153
  const util = {
151
154
 
@@ -333,12 +336,16 @@ export default{
333
336
  app.config.globalProperties.log = consoleLog
334
337
  app.config.globalProperties.warn = consoleWarn
335
338
  app.config.globalProperties.info = consoleInfo
339
+ app.config.globalProperties.time = consoleTime
340
+ app.config.globalProperties.timeLog = consoleTimeLog
341
+ app.config.globalProperties.timeEnd = consoleTimeEnd
336
342
 
337
343
  app.config.globalProperties.$isDev = () => import.meta.env.DEV
338
344
 
339
345
  app.config.globalProperties.$isDebugMode = () => {
340
346
  if(!('isDebugMode' in privateVars)){
341
- privateVars.isDebugMode = location.search.indexOf('debug-mode') >= 0 || import.meta.env.DEV
347
+ privateVars.isDebugMode = location.search.indexOf('debug-mode') >= 0 ||
348
+ import.meta.env.VITE_APP_DEBUG === 'true'
342
349
  }
343
350
  return privateVars.isDebugMode
344
351
  }
@@ -0,0 +1,20 @@
1
+ function trimStrings(obj) {
2
+ for (const key in obj) {
3
+ if (typeof obj[key] === 'string') {
4
+ obj[key] = obj[key].trim();
5
+ } else if (typeof obj[key] === 'object') {
6
+ trimStrings(obj[key]);
7
+ }
8
+ }
9
+ }
10
+
11
+ module.exports = async function(req, res, next){
12
+
13
+ if(req.query)
14
+ trimStrings(req.query)
15
+
16
+ if(req.body)
17
+ trimStrings(req.body)
18
+
19
+ next()
20
+ }
@@ -384,6 +384,14 @@ const deepObjectContainsObject = (outerObject, innerObject) => {
384
384
  return true; // All properties and values in innerObject exist in outerObject
385
385
  }
386
386
 
387
+ const removeStyleFromTag = (html) => {
388
+ const regex = /<[^>]+style="[^"]*"[^>]*>/g;
389
+
390
+ return html.replace(regex, (match) => {
391
+ return match.replace(/style="[^"]*"/, '');
392
+ });
393
+ }
394
+
387
395
 
388
396
  module.exports = {
389
397
  ceil,
@@ -408,4 +416,5 @@ module.exports = {
408
416
  hexToRgb,
409
417
  createComponentInstance,
410
418
  deepObjectContainsObject,
419
+ removeStyleFromTag,
411
420
  }
@@ -275,6 +275,14 @@ const unPascalCase = function(str){
275
275
 
276
276
  const sleep = ms => new Promise(r => setTimeout(r, ms))
277
277
 
278
+ const removeStyleFromTag = (html) => {
279
+ const regex = /<[^>]+style="[^"]*"[^>]*>/g;
280
+
281
+ return html.replace(regex, (match) => {
282
+ return match.replace(/style="[^"]*"/, '');
283
+ });
284
+ }
285
+
278
286
  export {
279
287
  downsizeImage,
280
288
  uid,
@@ -291,6 +299,7 @@ export {
291
299
  getComponentUids,
292
300
  unPascalCase,
293
301
  sleep,
302
+ removeStyleFromTag,
294
303
  }
295
304
 
296
305
  function observeInit(){
@@ -76,84 +76,6 @@
76
76
  </ColorPicker>
77
77
  </div>
78
78
 
79
- <div class="grid grid-cols-2 gap-4">
80
- <div>
81
- <label class="text-text-400">Font</label>
82
- <Dropdown v-for="(_, index) in viewTypes"
83
- v-show="_.value === viewType"
84
- v-model="fontFamily[index]"
85
- @change="$emit('change')">
86
- <option :value="`${viewType}font-sans`">Sans</option>
87
- <option :value="`${viewType}font-serif`">Serif</option>
88
- <option :value="`${viewType}font-mono`">Mono</option>
89
- <option value="">Not Set</option>
90
- </Dropdown>
91
- </div>
92
-
93
- <div>
94
- <label class="text-text-400">Size</label>
95
- <Dropdown v-for="(_, index) in viewTypes"
96
- v-show="_.value === viewType"
97
- v-model="fontSize[index]"
98
- @change="$emit('change')">
99
- <option :value="`${viewType}text-xs`">Extra Small</option>
100
- <option :value="`${viewType}text-sm`">Small</option>
101
- <option :value="`${viewType}text-base`">Normal</option>
102
- <option :value="`${viewType}text-lg`">Large</option>
103
- <option :value="`${viewType}text-xl`">Extra Large</option>
104
- <option :value="`${viewType}text-2xl`">Extra Large 2</option>
105
- <option :value="`${viewType}text-3xl`">Extra Large 3</option>
106
- <option :value="`${viewType}text-4xl`">Extra Large 4</option>
107
- <option :value="`${viewType}text-5xl`">Extra Large 5</option>
108
- <option :value="`${viewType}text-6xl`">Extra Large 6</option>
109
- <option value="">Not Set</option>
110
- </Dropdown>
111
- </div>
112
-
113
- <div>
114
- <label class="text-text-400">Weight</label>
115
- <Dropdown v-for="(_, index) in viewTypes"
116
- v-show="_.value === viewType"
117
- v-model="fontWeight[index]"
118
- @change="$emit('change')">
119
- <option :value="`${viewType}font-thin`">Thin</option>
120
- <option :value="`${viewType}font-extralight`">Extra Light</option>
121
- <option :value="`${viewType}font-light`">Light</option>
122
- <option :value="`${viewType}font-normal`">Normal</option>
123
- <option :value="`${viewType}font-medium`">Medium</option>
124
- <option :value="`${viewType}font-semibold`">Semi Bold</option>
125
- <option :value="`${viewType}font-bold`">Bold</option>
126
- <option :value="`${viewType}font-extrabold`">Extra Bold</option>
127
- <option :value="`${viewType}font-black`">Black</option>
128
- </Dropdown>
129
- </div>
130
-
131
- <div>
132
- <label class="text-text-400">Line Height</label>
133
- <Dropdown v-for="(_, index) in viewTypes"
134
- v-show="_.value === viewType"
135
- v-model="lineHeight[index]"
136
- class="mt-1"
137
- @change="$emit('change')">
138
- <option :value="`${viewType}leading-3`">Leading 3</option>
139
- <option :value="`${viewType}leading-4`">Leading 4</option>
140
- <option :value="`${viewType}leading-5`">Leading 5</option>
141
- <option :value="`${viewType}leading-6`">Leading 6</option>
142
- <option :value="`${viewType}leading-7`">Leading 7</option>
143
- <option :value="`${viewType}leading-8`">Leading 8</option>
144
- <option :value="`${viewType}leading-9`">Leading 9</option>
145
- <option :value="`${viewType}leading-10`">Leading 10</option>
146
- <option :value="`${viewType}leading-tight`">Tight</option>
147
- <option :value="`${viewType}leading-snug`">Snug</option>
148
- <option :value="`${viewType}leading-normal`">Normal</option>
149
- <option :value="`${viewType}leading-relaxed`">Relaxed</option>
150
- <option :value="`${viewType}leading-loose`">Loose</option>
151
- <option value="">Not Set</option>
152
- </Dropdown>
153
- </div>
154
-
155
- </div>
156
-
157
79
  <ContextMenu ref="headingContext">
158
80
  <div class="flex flex-col">
159
81
  <button class="p-3 text-4xl text-left hover:bg-primary-200" type="button" @click="format('formatBlock', 'h1')">