@mixd-id/web-scaffold 0.1.240411007 → 0.1.240411009

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.240411007",
4
+ "version": "0.1.240411009",
5
5
  "scripts": {
6
6
  "dev": "vite serve",
7
7
  "build": "vite build",
@@ -41,8 +41,6 @@ export default {
41
41
  },
42
42
 
43
43
  mounted() {
44
- console.log(this.modelValue)
45
-
46
44
  if(`${this.modelValue ?? ''}`.substring(0, 1) === '#'){
47
45
  this.color1 = this.modelValue
48
46
  this.mode = 'solid'
@@ -1013,7 +1013,7 @@ export default{
1013
1013
  },
1014
1014
 
1015
1015
  searchable(){
1016
- return this.preset.columns.some(_ => 'search' in _)
1016
+ return true // this.preset.columns.some(_ => 'search' in _)
1017
1017
  },
1018
1018
 
1019
1019
  sidebar(){
@@ -7,7 +7,11 @@
7
7
  </div>
8
8
 
9
9
  <div>
10
- <small class="text-text-400">Background Image</small>
10
+ <div class="flex flex-row">
11
+ <small class="flex-1 text-text-400">Background Image</small>
12
+ <button v-if="bgImages[viewIndex]" type="button" class="text-primary text-sm"
13
+ @click="delete bgImages[viewIndex]">Remove</button>
14
+ </div>
11
15
  <Image :src="imageSrc(bgImages[viewIndex])"
12
16
  :editable="true"
13
17
  item-class="object-contain"
@@ -78,6 +82,7 @@ export default{
78
82
  bgColors(){
79
83
  if(!Array.isArray(this.item.props.bgColors))
80
84
  this.item.props.bgColors = []
85
+
81
86
  return this.item.props.bgColors
82
87
  },
83
88
 
@@ -387,7 +387,7 @@ export default{
387
387
 
388
388
  { text:'Backgrounds', items: [
389
389
 
390
- { text:'Background', key:'background', values:{ type:'BackgroundColorSetting' }},
390
+ { text:'Background', key:'bgColors', values:{ type:'BackgroundColorSetting' }},
391
391
 
392
392
  ]},
393
393
 
@@ -14,7 +14,7 @@
14
14
  <svg class="fill-text-300 hover:fill-red-500" width="18" height="18" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 512"><path d="M207.6 256l107.72-107.72c6.23-6.23 6.23-16.34 0-22.58l-25.03-25.03c-6.23-6.23-16.34-6.23-22.58 0L160 208.4 52.28 100.68c-6.23-6.23-16.34-6.23-22.58 0L4.68 125.7c-6.23 6.23-6.23 16.34 0 22.58L112.4 256 4.68 363.72c-6.23 6.23-6.23 16.34 0 22.58l25.03 25.03c6.23 6.23 16.34 6.23 22.58 0L160 303.6l107.72 107.72c6.23 6.23 16.34 6.23 22.58 0l25.03-25.03c6.23-6.23 6.23-16.34 0-22.58L207.6 256z"/></svg>
15
15
  </button>
16
16
 
17
- <h4 class="mr-5 w-[200px] text-ellipsis whitespace-nowrap overflow-hidden">
17
+ <h4 class="mr-5 w-[200px] text-ellipsis whitespace-nowrap overflow-hidden" @click.meta="log(page)">
18
18
  {{ page.title }}
19
19
  </h4>
20
20
 
@@ -520,7 +520,7 @@
520
520
  ref="templateCreator"
521
521
  @save="templateCreatorAfterSave" />
522
522
  </div>
523
- </div>
523
+ </div>p
524
524
 
525
525
  </div>
526
526
  </div>
@@ -932,9 +932,56 @@ export default{
932
932
  .catch((err) => this.toast(err))
933
933
  },
934
934
 
935
+ patchBgColors(bgColors){
936
+ if (!Array.isArray(bgColors)) return
937
+
938
+ for(let i = 0 ; i < bgColors.length ; i++){
939
+ if(bgColors[i].startsWith('bg-')){
940
+
941
+ const el = document.createElement('div')
942
+ el.classList.add(bgColors[i])
943
+ el.style.position = 'fixed'
944
+ el.style.top = '-100000px'
945
+ document.body.appendChild(el)
946
+
947
+ const rgbText = window.getComputedStyle(el)['background-color']
948
+
949
+ const rgb = rgbText.match(/rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*\d+)?\)/)
950
+ let hex
951
+ if(rgb){
952
+ hex = `#${((1 << 24) + (parseInt(rgb[1]) << 16) +
953
+ (parseInt(rgb[2]) << 8) +
954
+ parseInt(rgb[3])).toString(16).slice(1)}`
955
+ }
956
+
957
+ document.body.removeChild(el)
958
+
959
+ bgColors[i] = hex
960
+ }
961
+ }
962
+ },
963
+
964
+ patchPage(page){
965
+
966
+ const recursePatch = (components) => {
967
+ for(let component of components){
968
+ this.patchBgColors(component.props.bgColors)
969
+
970
+ if(Array.isArray(component.items)){
971
+ recursePatch(component.items)
972
+ }
973
+ }
974
+ }
975
+
976
+ recursePatch(page.components)
977
+ },
978
+
935
979
  async load(){
936
980
  return this.socket.send(`${this.controller}.open`, { uid:this.$route.params.uid })
937
981
  .then(({ page, host, previewHost }) => {
982
+
983
+ this.patchPage(page)
984
+
938
985
  if(page) this.page = page
939
986
  if(host) this.host = host
940
987
  if(previewHost) this.previewHost = previewHost