@mixd-id/web-scaffold 0.1.240411010 → 0.1.240411012
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,5 +1,8 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div :class="$style.comp">
|
|
3
|
+
|
|
4
|
+
<small class="text-text-400" v-if="title">{{ title }}</small>
|
|
5
|
+
|
|
3
6
|
<div :class="circleClass" :style="circleStyle"
|
|
4
7
|
@click="mode === 'hex' ? $refs.inputColor.click() : $refs.contextMenu.open($refs.btn)"
|
|
5
8
|
ref="btn"></div>
|
|
@@ -50,6 +53,8 @@ export default{
|
|
|
50
53
|
]
|
|
51
54
|
},
|
|
52
55
|
|
|
56
|
+
title: String,
|
|
57
|
+
|
|
53
58
|
values: {
|
|
54
59
|
type: Array,
|
|
55
60
|
default: [
|
|
@@ -43,7 +43,7 @@ export default {
|
|
|
43
43
|
mounted() {
|
|
44
44
|
if(`${this.modelValue ?? ''}`.substring(0, 1) === '#'){
|
|
45
45
|
this.color1 = this.modelValue
|
|
46
|
-
this.mode = 'solid'
|
|
46
|
+
this.mode = 'solid'
|
|
47
47
|
}
|
|
48
48
|
else if(`${this.modelValue ?? ''}`.indexOf('linear-') >= 0){
|
|
49
49
|
const match = this.modelValue.match(/linear-gradient\(([^,]+),([^,]+),([^)]+)\)/)
|
package/src/index.js
CHANGED
package/src/mixin/component.js
CHANGED
|
@@ -90,13 +90,29 @@ export const componentMixin = {
|
|
|
90
90
|
let background = []
|
|
91
91
|
|
|
92
92
|
if(Array.isArray(this.style.bgImages)){
|
|
93
|
-
let
|
|
94
|
-
|
|
95
|
-
|
|
93
|
+
let currentUrl = ''
|
|
94
|
+
for(let i = this.$device.mediaIndex ; i >= 0 ; i--){
|
|
95
|
+
if(this.style.bgImages[i]){
|
|
96
|
+
currentUrl = this.style.bgImages[i]
|
|
97
|
+
break
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
if(currentUrl){
|
|
102
|
+
currentUrl = currentUrl.indexOf('://') < 0 ? import.meta.env.VITE_IMAGE_HOST + '/' + currentUrl : currentUrl
|
|
103
|
+
background.push(`url('${currentUrl}')`)
|
|
104
|
+
}
|
|
96
105
|
}
|
|
97
106
|
|
|
98
107
|
if(Array.isArray(this.style.bgColors)){
|
|
99
|
-
|
|
108
|
+
let bgColor = ''
|
|
109
|
+
for(let i = this.$device.mediaIndex ; i >= 0 ; i--){
|
|
110
|
+
if(this.style.bgColors[i]){
|
|
111
|
+
bgColor = this.style.bgColors[i]
|
|
112
|
+
break
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
const bgColors = bgColor
|
|
100
116
|
|
|
101
117
|
if(bgColors.startsWith('#')){
|
|
102
118
|
background.push(`linear-gradient(${bgColors}, ${bgColors})`)
|
|
@@ -106,7 +122,7 @@ export const componentMixin = {
|
|
|
106
122
|
}
|
|
107
123
|
}
|
|
108
124
|
|
|
109
|
-
if(background)
|
|
125
|
+
if(background.length > 0)
|
|
110
126
|
obj['background-image'] = background.join(', ')
|
|
111
127
|
}
|
|
112
128
|
|
|
@@ -73,7 +73,7 @@
|
|
|
73
73
|
<div class="relative p-6 flex flex-col gap-4">
|
|
74
74
|
<h3>Add Property</h3>
|
|
75
75
|
<div class="absolute top-0 right-0 p-2">
|
|
76
|
-
<button type="button" class="p-2" @click="$router.replace({ hash
|
|
76
|
+
<button type="button" class="p-2" @click="$router.replace({ hash:$route.hash.replace('#select-property', '') })">
|
|
77
77
|
<svg width="24" height="24" viewBox="0 0 24 24" class="fill-text-300 hover:fill-red-500" xmlns="http://www.w3.org/2000/svg">
|
|
78
78
|
<path d="M6.53034 5.46965C6.23745 5.17676 5.76257 5.17676 5.46968 5.46965C5.17679 5.76255 5.17679 6.23742 5.46968 6.53031L10.9393 12L5.46967 17.4697C5.17678 17.7626 5.17678 18.2374 5.46967 18.5303C5.76256 18.8232 6.23744 18.8232 6.53033 18.5303L12 13.0606L17.4697 18.5303C17.7626 18.8232 18.2375 18.8232 18.5303 18.5303C18.8232 18.2374 18.8232 17.7626 18.5303 17.4697L13.0607 12L18.5303 6.53032C18.8232 6.23743 18.8232 5.76256 18.5303 5.46966C18.2374 5.17677 17.7626 5.17677 17.4697 5.46966L12 10.9393L6.53034 5.46965Z"/>
|
|
79
79
|
</svg>
|
|
@@ -146,7 +146,7 @@ export default{
|
|
|
146
146
|
|
|
147
147
|
this.item.props[item.key].push('')
|
|
148
148
|
|
|
149
|
-
this.$router.replace({ hash:'' })
|
|
149
|
+
this.$router.replace({ hash:this.$route.hash.replace('#select-property', '') })
|
|
150
150
|
},
|
|
151
151
|
|
|
152
152
|
select(){
|
|
@@ -786,6 +786,12 @@ export default{
|
|
|
786
786
|
[ 'text-end', 'End' ],
|
|
787
787
|
]},
|
|
788
788
|
|
|
789
|
+
{ text:'Text Color', key:'textColor', values:{
|
|
790
|
+
type:'ColorPicker2',
|
|
791
|
+
keys: [ ['text-']],
|
|
792
|
+
title: "Text Color"
|
|
793
|
+
}},
|
|
794
|
+
|
|
789
795
|
{ text:'Text Decoration', key:'textDecoration', values: [
|
|
790
796
|
[ 'underline', 'Underline' ],
|
|
791
797
|
[ 'overline', 'Overline' ],
|
|
@@ -936,6 +936,8 @@ export default{
|
|
|
936
936
|
if (!Array.isArray(bgColors)) return
|
|
937
937
|
|
|
938
938
|
for(let i = 0 ; i < bgColors.length ; i++){
|
|
939
|
+
|
|
940
|
+
let value = bgColors[i]
|
|
939
941
|
if(bgColors[i].startsWith('bg-')){
|
|
940
942
|
|
|
941
943
|
const el = document.createElement('div')
|
|
@@ -947,17 +949,17 @@ export default{
|
|
|
947
949
|
const rgbText = window.getComputedStyle(el)['background-color']
|
|
948
950
|
|
|
949
951
|
const rgb = rgbText.match(/rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*\d+)?\)/)
|
|
950
|
-
let hex
|
|
951
952
|
if(rgb){
|
|
952
|
-
|
|
953
|
+
value = `#${((1 << 24) + (parseInt(rgb[1]) << 16) +
|
|
953
954
|
(parseInt(rgb[2]) << 8) +
|
|
954
955
|
parseInt(rgb[3])).toString(16).slice(1)}`
|
|
955
956
|
}
|
|
956
957
|
|
|
957
958
|
document.body.removeChild(el)
|
|
958
|
-
|
|
959
|
-
bgColors[i] = hex
|
|
960
959
|
}
|
|
960
|
+
|
|
961
|
+
console.log(`bgColors[${i}]`, bgColors[i], value)
|
|
962
|
+
bgColors[i] = value
|
|
961
963
|
}
|
|
962
964
|
},
|
|
963
965
|
|