@phill-component/icons 0.2.2 → 1.0.1
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/dist/mobile/uvue/icon-calendar/calendar.png +0 -0
- package/dist/mobile/uvue/{Home/Home.uvue → icon-calendar/icon-calendar.uvue} +15 -6
- package/dist/mobile/uvue/icon-file-fold/file_fold.png +0 -0
- package/dist/mobile/uvue/icon-file-fold/icon-file-fold.uvue +75 -0
- package/dist/mobile/uvue/icon-find-replace/find-replace.png +0 -0
- package/dist/mobile/uvue/{ToLandscape/ToLandscape.uvue → icon-find-replace/icon-find-replace.uvue} +15 -6
- package/dist/mobile/uvue/icon-h6/h6.png +0 -0
- package/dist/mobile/uvue/{Setting/Setting.uvue → icon-h6/icon-h6.uvue} +15 -6
- package/dist/mobile/uvue/icon-home/icon-home.uvue +75 -0
- package/dist/mobile/uvue/{Calendar/Calendar.uvue → icon-setting/icon-setting.uvue} +15 -6
- package/dist/mobile/uvue/icon-setting/setting.png +0 -0
- package/dist/mobile/uvue/icon-task/icon-task.uvue +75 -0
- package/dist/mobile/uvue/icon-task/task.png +0 -0
- package/dist/mobile/uvue/{Task/Task.uvue → icon-to-landscape/icon-to-landscape.uvue} +15 -6
- package/dist/mobile/uvue/icon-to-landscape/to_landscape.png +0 -0
- package/dist/mobile/vue/icon-calendar.vue +58 -0
- package/dist/mobile/vue/icon-file-fold.vue +58 -0
- package/dist/mobile/vue/{ToLandscape.vue → icon-find-replace.vue} +6 -10
- package/dist/mobile/vue/{Setting.vue → icon-h6.vue} +6 -10
- package/dist/mobile/vue/icon-home.vue +58 -0
- package/dist/mobile/vue/{Task.vue → icon-setting.vue} +6 -10
- package/dist/mobile/vue/{Calendar.vue → icon-task.vue} +6 -10
- package/dist/mobile/vue/icon-to-landscape.vue +58 -0
- package/dist/web/vue/Calendar.vue +4 -8
- package/dist/web/vue/FileFold.vue +4 -8
- package/dist/web/vue/FindReplace.vue +53 -0
- package/dist/web/vue/H6.vue +53 -0
- package/dist/web/vue/Home.vue +4 -8
- package/dist/web/vue/Setting.vue +4 -8
- package/dist/web/vue/Task.vue +4 -8
- package/dist/web/vue/ToLandscape.vue +4 -8
- package/dist/web/vue/index.js +2 -0
- package/package.json +6 -8
- package/scripts/build.js +21 -12
- package/scripts/install.js +32 -7
- package/scripts/publish.js +145 -0
- package/scripts/templates/mobile.uvue.tpl +14 -5
- package/scripts/templates/mobile.vue.tpl +6 -10
- package/scripts/templates/web.vue.tpl +4 -8
- package/dist/mobile/uvue/Calendar/calendar.png +0 -0
- package/dist/mobile/uvue/FileFold/FileFold.uvue +0 -66
- package/dist/mobile/uvue/FileFold/file_fold.png +0 -0
- package/dist/mobile/uvue/Setting/setting.png +0 -0
- package/dist/mobile/uvue/Task/task.png +0 -0
- package/dist/mobile/uvue/ToLandscape/to_landscape.png +0 -0
- package/dist/mobile/uvue/index.uts +0 -6
- package/dist/mobile/vue/FileFold.vue +0 -62
- package/dist/mobile/vue/Home.vue +0 -62
- package/dist/mobile/vue/index.js +0 -6
- /package/dist/mobile/uvue/{Home → icon-home}/home.png +0 -0
package/dist/web/vue/Home.vue
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<view class="icon" @tap="onTap" :hover-class="hoverClass" :style="wrapStyle">
|
|
3
|
-
<svg
|
|
4
|
-
<path fill="#222" d="M615.64 510.5a62.15 62.15 0 0 1-32.75-9.36l-53.68-33.22a17.19 17.19 0 0 0-18-.07L461.63 498a62.31 62.31 0 0 1-67.88-2.09l-36.91-25.66a17.31 17.31 0 0 0-19.7 0l-31 21.57a62.2 62.2 0 0 1-79.58-7.08l-21.5-21.5a107 107 0 0 1-30.86-87.52c2.7-25 5.57-50.63 8.54-76.1A113.8 113.8 0 0 1 295.78 199l462.35.07a113.87 113.87 0 0 1 113 100.48c3.3 27.95 6.25 54.41 8.77 78.65a107 107 0 0 1-30.91 87l-13.27 13.27a62.51 62.51 0 0 1-74.24 10.4l-39.68-22.04a17.28 17.28 0 0 0-17.31.33l-56.58 34.28a62.2 62.2 0 0 1-32.27 9.06m-95.51-90.21a62.2 62.2 0 0 1 32.76 9.36l53.68 33.22a17.19 17.19 0 0 0 18 .09l56.58-34.29a62.38 62.38 0 0 1 62.48-1.18l39.71 22.05a17.31 17.31 0 0 0 20.57-2.88l13.27-13.27a62.16 62.16 0 0 0 18-50.58c-2.5-24-5.42-50.28-8.7-78A68.84 68.84 0 0 0 758.15 244H295.79a68.79 68.79 0 0 0-68.34 60.84c-3 25.34-5.81 50.81-8.5 75.71a62.22 62.22 0 0 0 17.94 50.88l21.5 21.5a17.25 17.25 0 0 0 22.06 2l31-21.58a62.51 62.51 0 0 1 71.09 0l36.91 25.67a17.27 17.27 0 0 0 18.81.58l49.54-30.12a62.2 62.2 0 0 1 32.33-9.19m104.46 337.56a22.5 22.5 0 0 1-22.5-22.5v-58a76 76 0 0 0-152.1 0v58a22.5 22.5 0 1 1-45 0v-58a121.05 121.05 0 0 1 242.1 0v58a22.5 22.5 0 0 1-22.5 22.5"/><path fill="#222" d="M527.05 849.87c-38 0-76.5-1.53-114.4-4.56l-48-3.84a155 155 0 0 1-142.21-142.21l-3.84-48c-3-38.19-3-57.22-3-95.13v-.54a22.5 22.5 0 0 1 45 0v.54c0 36.71 0 55.15 2.91 91.54l3.83 48a110.08 110.08 0 0 0 100.89 100.95l48 3.83c36.81 2.94 74.22 4.48 111.14 4.42 36.7 0 73.87-1.49 110.47-4.42l48-3.83a110.06 110.06 0 0 0 100.95-100.94l3.83-48c2.91-36.39 2.91-54.83 2.91-91.54v-.54a22.5 22.5 0 1 1 45 0v.54c0 37.91 0 56.94-3 95.13l-3.83 48a155 155 0 0 1-142.27 142.2l-48 3.84c-37.78 3-76.15 4.55-114 4.56z"/>
|
|
5
|
-
</svg>
|
|
2
|
+
<view class="icon" @tap="onTap" :hover-class="hoverClass" :style="[wrapStyle, iconStyle]">
|
|
3
|
+
<svg v-bind="$attrs" :style="iconStyle" :width="iconW" :height="iconH" xmlns="http://www.w3.org/2000/svg" class="icon" viewBox="0 0 1024 1024"><path fill="currentColor" d="M615.64 510.5a62.15 62.15 0 0 1-32.75-9.36l-53.68-33.22a17.19 17.19 0 0 0-18-.07L461.63 498a62.31 62.31 0 0 1-67.88-2.09l-36.91-25.66a17.31 17.31 0 0 0-19.7 0l-31 21.57a62.2 62.2 0 0 1-79.58-7.08l-21.5-21.5a107 107 0 0 1-30.86-87.52c2.7-25 5.57-50.63 8.54-76.1A113.8 113.8 0 0 1 295.78 199l462.35.07a113.87 113.87 0 0 1 113 100.48c3.3 27.95 6.25 54.41 8.77 78.65a107 107 0 0 1-30.91 87l-13.27 13.27a62.51 62.51 0 0 1-74.24 10.4l-39.68-22.04a17.28 17.28 0 0 0-17.31.33l-56.58 34.28a62.2 62.2 0 0 1-32.27 9.06m-95.51-90.21a62.2 62.2 0 0 1 32.76 9.36l53.68 33.22a17.19 17.19 0 0 0 18 .09l56.58-34.29a62.38 62.38 0 0 1 62.48-1.18l39.71 22.05a17.31 17.31 0 0 0 20.57-2.88l13.27-13.27a62.16 62.16 0 0 0 18-50.58c-2.5-24-5.42-50.28-8.7-78A68.84 68.84 0 0 0 758.15 244H295.79a68.79 68.79 0 0 0-68.34 60.84c-3 25.34-5.81 50.81-8.5 75.71a62.22 62.22 0 0 0 17.94 50.88l21.5 21.5a17.25 17.25 0 0 0 22.06 2l31-21.58a62.51 62.51 0 0 1 71.09 0l36.91 25.67a17.27 17.27 0 0 0 18.81.58l49.54-30.12a62.2 62.2 0 0 1 32.33-9.19m104.46 337.56a22.5 22.5 0 0 1-22.5-22.5v-58a76 76 0 0 0-152.1 0v58a22.5 22.5 0 1 1-45 0v-58a121.05 121.05 0 0 1 242.1 0v58a22.5 22.5 0 0 1-22.5 22.5"/><path fill="currentColor" d="M527.05 849.87c-38 0-76.5-1.53-114.4-4.56l-48-3.84a155 155 0 0 1-142.21-142.21l-3.84-48c-3-38.19-3-57.22-3-95.13v-.54a22.5 22.5 0 0 1 45 0v.54c0 36.71 0 55.15 2.91 91.54l3.83 48a110.08 110.08 0 0 0 100.89 100.95l48 3.83c36.81 2.94 74.22 4.48 111.14 4.42 36.7 0 73.87-1.49 110.47-4.42l48-3.83a110.06 110.06 0 0 0 100.95-100.94l3.83-48c2.91-36.39 2.91-54.83 2.91-91.54v-.54a22.5 22.5 0 1 1 45 0v.54c0 37.91 0 56.94-3 95.13l-3.83 48a155 155 0 0 1-142.27 142.2l-48 3.84c-37.78 3-76.15 4.55-114 4.56z"/></svg>
|
|
6
4
|
<text v-if="label !== ''" class="icon__label" :style="labelStyle">{{ label }}</text>
|
|
7
5
|
</view>
|
|
8
6
|
</template>
|
|
@@ -10,7 +8,7 @@
|
|
|
10
8
|
import { computed } from 'vue'
|
|
11
9
|
const props = defineProps({
|
|
12
10
|
size: { type: [String, Number], default: '1em' },
|
|
13
|
-
color: { type: String, default: '' },
|
|
11
|
+
color: { type: String, default: 'inherit' },
|
|
14
12
|
label: { type: [String, Number], default: '' },
|
|
15
13
|
labelPos: { type: String, default: 'right' },
|
|
16
14
|
labelSize: { type: [String, Number], default: '15px' },
|
|
@@ -28,9 +26,7 @@ const iconW = computed(() => props.width ? toPx(props.width) : toPx(props.size))
|
|
|
28
26
|
const iconH = computed(() => props.height ? toPx(props.height) : toPx(props.size))
|
|
29
27
|
const iconBoxStyle = computed(() => ({ width: iconW.value, height: iconH.value }))
|
|
30
28
|
const iconStyle = computed(() => {
|
|
31
|
-
|
|
32
|
-
if (props.color) s.color = props.color
|
|
33
|
-
return s
|
|
29
|
+
return { color: props.color || 'inherit' }
|
|
34
30
|
})
|
|
35
31
|
const wrapStyle = computed(() => {
|
|
36
32
|
const dirMap = { right: 'row', left: 'row-reverse', top: 'column-reverse', bottom: 'column' }
|
package/dist/web/vue/Setting.vue
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<view class="icon" @tap="onTap" :hover-class="hoverClass" :style="wrapStyle">
|
|
3
|
-
<svg
|
|
4
|
-
<path fill="#0a0a0a" fill-rule="evenodd" d="M12 8a4 4 0 1 1 0 8.001 4 4 0 0 1 0-8m0 2a2 2 0 1 0 0 4 2 2 0 0 0 0-4" clip-rule="evenodd"/><path fill="#0a0a0a" fill-rule="evenodd" d="M10.539 2.634a2 2 0 0 1 2.922 0l1.675 1.793 2.453-.083a2 2 0 0 1 2.066 2.067l-.082 2.453 1.792 1.675a2 2 0 0 1 0 2.922l-1.792 1.675.082 2.452a2 2 0 0 1-2.067 2.067l-2.452-.082-1.675 1.792a2 2 0 0 1-2.922 0l-1.675-1.792-2.453.082a2 2 0 0 1-2.067-2.066l.083-2.453-1.793-1.675a2 2 0 0 1 0-2.922l1.793-1.675-.083-2.453a2 2 0 0 1 2.067-2.067l2.453.083zm-.214 3.158a2 2 0 0 1-1.53.634l-2.452-.083.083 2.452a2 2 0 0 1-.634 1.53L4 12l1.792 1.675a2 2 0 0 1 .634 1.53l-.083 2.453 2.452-.084a2 2 0 0 1 1.53.633L12 20l1.675-1.793a2 2 0 0 1 1.53-.633l2.453.084-.084-2.454a2 2 0 0 1 .633-1.529L20 12l-1.793-1.675a2 2 0 0 1-.633-1.53l.084-2.452-2.454.083a2 2 0 0 1-1.529-.634L12 4z" clip-rule="evenodd"/>
|
|
5
|
-
</svg>
|
|
2
|
+
<view class="icon" @tap="onTap" :hover-class="hoverClass" :style="[wrapStyle, iconStyle]">
|
|
3
|
+
<svg v-bind="$attrs" :style="iconStyle" :width="iconW" :height="iconH" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24"><path fill="currentColor" fill-rule="evenodd" d="M12 8a4 4 0 1 1 0 8.001 4 4 0 0 1 0-8m0 2a2 2 0 1 0 0 4 2 2 0 0 0 0-4" clip-rule="evenodd"/><path fill="currentColor" fill-rule="evenodd" d="M10.539 2.634a2 2 0 0 1 2.922 0l1.675 1.793 2.453-.083a2 2 0 0 1 2.066 2.067l-.082 2.453 1.792 1.675a2 2 0 0 1 0 2.922l-1.792 1.675.082 2.452a2 2 0 0 1-2.067 2.067l-2.452-.082-1.675 1.792a2 2 0 0 1-2.922 0l-1.675-1.792-2.453.082a2 2 0 0 1-2.067-2.066l.083-2.453-1.793-1.675a2 2 0 0 1 0-2.922l1.793-1.675-.083-2.453a2 2 0 0 1 2.067-2.067l2.453.083zm-.214 3.158a2 2 0 0 1-1.53.634l-2.452-.083.083 2.452a2 2 0 0 1-.634 1.53L4 12l1.792 1.675a2 2 0 0 1 .634 1.53l-.083 2.453 2.452-.084a2 2 0 0 1 1.53.633L12 20l1.675-1.793a2 2 0 0 1 1.53-.633l2.453.084-.084-2.454a2 2 0 0 1 .633-1.529L20 12l-1.793-1.675a2 2 0 0 1-.633-1.53l.084-2.452-2.454.083a2 2 0 0 1-1.529-.634L12 4z" clip-rule="evenodd"/></svg>
|
|
6
4
|
<text v-if="label !== ''" class="icon__label" :style="labelStyle">{{ label }}</text>
|
|
7
5
|
</view>
|
|
8
6
|
</template>
|
|
@@ -10,7 +8,7 @@
|
|
|
10
8
|
import { computed } from 'vue'
|
|
11
9
|
const props = defineProps({
|
|
12
10
|
size: { type: [String, Number], default: '1em' },
|
|
13
|
-
color: { type: String, default: '' },
|
|
11
|
+
color: { type: String, default: 'inherit' },
|
|
14
12
|
label: { type: [String, Number], default: '' },
|
|
15
13
|
labelPos: { type: String, default: 'right' },
|
|
16
14
|
labelSize: { type: [String, Number], default: '15px' },
|
|
@@ -28,9 +26,7 @@ const iconW = computed(() => props.width ? toPx(props.width) : toPx(props.size))
|
|
|
28
26
|
const iconH = computed(() => props.height ? toPx(props.height) : toPx(props.size))
|
|
29
27
|
const iconBoxStyle = computed(() => ({ width: iconW.value, height: iconH.value }))
|
|
30
28
|
const iconStyle = computed(() => {
|
|
31
|
-
|
|
32
|
-
if (props.color) s.color = props.color
|
|
33
|
-
return s
|
|
29
|
+
return { color: props.color || 'inherit' }
|
|
34
30
|
})
|
|
35
31
|
const wrapStyle = computed(() => {
|
|
36
32
|
const dirMap = { right: 'row', left: 'row-reverse', top: 'column-reverse', bottom: 'column' }
|
package/dist/web/vue/Task.vue
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<view class="icon" @tap="onTap" :hover-class="hoverClass" :style="wrapStyle">
|
|
3
|
-
<svg
|
|
4
|
-
<path fill="#8a94dc" d="M18.059 12.905a2 2 0 0 1 1.6 3.199h.001c-.01.014-.544.747-.595 1.514l-.003 1.258 1.712.383a1.645 1.645 0 0 1 1.287 1.605v.65a.275.275 0 0 1-.274.275h-7.45a.275.275 0 0 1-.274-.274v-.653c0-.77.534-1.437 1.285-1.605l1.714-.386.003-1.14h-.004a2.6 2.6 0 0 0-.5-1.501 2.001 2.001 0 0 1 1.498-3.324"/><path fill="#fff" d="M6.96 3.387c0-.598.431-1.082.962-1.082h5.77c.53 0 .96.484.96 1.082 0 .597-.43 1.082-.96 1.082h-5.77c-.53 0-.961-.485-.961-1.082"/><path fill="#6571c4" d="M6.157 3.062q-.019.132-.02.27c0 1.046.824 1.895 1.842 1.895h5.524c1.017 0 1.842-.849 1.842-1.895a2 2 0 0 0-.02-.27h1.222c1.205 0 2.182.976 2.183 2.181v6.197a3.363 3.363 0 0 0-3.235 5.47c.11.163.272.473.272.849v.24l-.87.195a2.99 2.99 0 0 0-2.332 2.724H4.932a2.18 2.18 0 0 1-2.182-2.182V5.243c0-1.205.977-2.181 2.182-2.181z"/><path fill="#6571c4" d="M6.95 3.332c0-.598.424-1.082.947-1.082h5.688c.523 0 .948.484.948 1.082s-.425 1.082-.948 1.082H7.897c-.523 0-.948-.484-.948-1.082"/><path fill="#fff" fill-rule="evenodd" d="M14.604 8.9a.77.77 0 0 1 .169 1.11l-3.103 3.975c-1.133 1.468-2.234 1.071-3.128.217l-1.487-1.42a.77.77 0 0 1 0-1.12.857.857 0 0 1 1.173 0l1.487 1.42c.178.17.474.15.625-.044l3.103-3.976a.855.855 0 0 1 1.16-.162" clip-rule="evenodd"/>
|
|
5
|
-
</svg>
|
|
2
|
+
<view class="icon" @tap="onTap" :hover-class="hoverClass" :style="[wrapStyle, iconStyle]">
|
|
3
|
+
<svg v-bind="$attrs" :style="iconStyle" :width="iconW" :height="iconH" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24"><path fill="currentColor" d="M18.059 12.905a2 2 0 0 1 1.6 3.199h.001c-.01.014-.544.747-.595 1.514l-.003 1.258 1.712.383a1.645 1.645 0 0 1 1.287 1.605v.65a.275.275 0 0 1-.274.275h-7.45a.275.275 0 0 1-.274-.274v-.653c0-.77.534-1.437 1.285-1.605l1.714-.386.003-1.14h-.004a2.6 2.6 0 0 0-.5-1.501 2.001 2.001 0 0 1 1.498-3.324"/><path fill="currentColor" d="M6.96 3.387c0-.598.431-1.082.962-1.082h5.77c.53 0 .96.484.96 1.082 0 .597-.43 1.082-.96 1.082h-5.77c-.53 0-.961-.485-.961-1.082"/><path fill="currentColor" d="M6.157 3.062q-.019.132-.02.27c0 1.046.824 1.895 1.842 1.895h5.524c1.017 0 1.842-.849 1.842-1.895a2 2 0 0 0-.02-.27h1.222c1.205 0 2.182.976 2.183 2.181v6.197a3.363 3.363 0 0 0-3.235 5.47c.11.163.272.473.272.849v.24l-.87.195a2.99 2.99 0 0 0-2.332 2.724H4.932a2.18 2.18 0 0 1-2.182-2.182V5.243c0-1.205.977-2.181 2.182-2.181z"/><path fill="currentColor" d="M6.95 3.332c0-.598.424-1.082.947-1.082h5.688c.523 0 .948.484.948 1.082s-.425 1.082-.948 1.082H7.897c-.523 0-.948-.484-.948-1.082"/><path fill="currentColor" fill-rule="evenodd" d="M14.604 8.9a.77.77 0 0 1 .169 1.11l-3.103 3.975c-1.133 1.468-2.234 1.071-3.128.217l-1.487-1.42a.77.77 0 0 1 0-1.12.857.857 0 0 1 1.173 0l1.487 1.42c.178.17.474.15.625-.044l3.103-3.976a.855.855 0 0 1 1.16-.162" clip-rule="evenodd"/></svg>
|
|
6
4
|
<text v-if="label !== ''" class="icon__label" :style="labelStyle">{{ label }}</text>
|
|
7
5
|
</view>
|
|
8
6
|
</template>
|
|
@@ -10,7 +8,7 @@
|
|
|
10
8
|
import { computed } from 'vue'
|
|
11
9
|
const props = defineProps({
|
|
12
10
|
size: { type: [String, Number], default: '1em' },
|
|
13
|
-
color: { type: String, default: '' },
|
|
11
|
+
color: { type: String, default: 'inherit' },
|
|
14
12
|
label: { type: [String, Number], default: '' },
|
|
15
13
|
labelPos: { type: String, default: 'right' },
|
|
16
14
|
labelSize: { type: [String, Number], default: '15px' },
|
|
@@ -28,9 +26,7 @@ const iconW = computed(() => props.width ? toPx(props.width) : toPx(props.size))
|
|
|
28
26
|
const iconH = computed(() => props.height ? toPx(props.height) : toPx(props.size))
|
|
29
27
|
const iconBoxStyle = computed(() => ({ width: iconW.value, height: iconH.value }))
|
|
30
28
|
const iconStyle = computed(() => {
|
|
31
|
-
|
|
32
|
-
if (props.color) s.color = props.color
|
|
33
|
-
return s
|
|
29
|
+
return { color: props.color || 'inherit' }
|
|
34
30
|
})
|
|
35
31
|
const wrapStyle = computed(() => {
|
|
36
32
|
const dirMap = { right: 'row', left: 'row-reverse', top: 'column-reverse', bottom: 'column' }
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<view class="icon" @tap="onTap" :hover-class="hoverClass" :style="wrapStyle">
|
|
3
|
-
<svg
|
|
4
|
-
<path fill="#0a0a0a" d="M20 11a2 2 0 0 1 2 2v7a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-7a2 2 0 0 1 2-2zM4 20h16v-7H4zm6-18a2 2 0 0 1 2 2v5a1 1 0 1 1-2 0V4H4v5a1 1 0 0 1-2 0V4a2 2 0 0 1 2-2zm8 0a1 1 0 0 1 1 .998l.006 3.23.954-.953a1 1 0 0 1 1.414 1.415l-2.657 2.657a1 1 0 0 1-1.414 0L14.646 6.69a1.001 1.001 0 0 1 1.415-1.415l.945.946L17.002 4H14.5a1 1 0 1 1 0-2z"/>
|
|
5
|
-
</svg>
|
|
2
|
+
<view class="icon" @tap="onTap" :hover-class="hoverClass" :style="[wrapStyle, iconStyle]">
|
|
3
|
+
<svg v-bind="$attrs" :style="iconStyle" :width="iconW" :height="iconH" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24"><path fill="currentColor" d="M20 11a2 2 0 0 1 2 2v7a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-7a2 2 0 0 1 2-2zM4 20h16v-7H4zm6-18a2 2 0 0 1 2 2v5a1 1 0 1 1-2 0V4H4v5a1 1 0 0 1-2 0V4a2 2 0 0 1 2-2zm8 0a1 1 0 0 1 1 .998l.006 3.23.954-.953a1 1 0 0 1 1.414 1.415l-2.657 2.657a1 1 0 0 1-1.414 0L14.646 6.69a1.001 1.001 0 0 1 1.415-1.415l.945.946L17.002 4H14.5a1 1 0 1 1 0-2z"/></svg>
|
|
6
4
|
<text v-if="label !== ''" class="icon__label" :style="labelStyle">{{ label }}</text>
|
|
7
5
|
</view>
|
|
8
6
|
</template>
|
|
@@ -10,7 +8,7 @@
|
|
|
10
8
|
import { computed } from 'vue'
|
|
11
9
|
const props = defineProps({
|
|
12
10
|
size: { type: [String, Number], default: '1em' },
|
|
13
|
-
color: { type: String, default: '' },
|
|
11
|
+
color: { type: String, default: 'inherit' },
|
|
14
12
|
label: { type: [String, Number], default: '' },
|
|
15
13
|
labelPos: { type: String, default: 'right' },
|
|
16
14
|
labelSize: { type: [String, Number], default: '15px' },
|
|
@@ -28,9 +26,7 @@ const iconW = computed(() => props.width ? toPx(props.width) : toPx(props.size))
|
|
|
28
26
|
const iconH = computed(() => props.height ? toPx(props.height) : toPx(props.size))
|
|
29
27
|
const iconBoxStyle = computed(() => ({ width: iconW.value, height: iconH.value }))
|
|
30
28
|
const iconStyle = computed(() => {
|
|
31
|
-
|
|
32
|
-
if (props.color) s.color = props.color
|
|
33
|
-
return s
|
|
29
|
+
return { color: props.color || 'inherit' }
|
|
34
30
|
})
|
|
35
31
|
const wrapStyle = computed(() => {
|
|
36
32
|
const dirMap = { right: 'row', left: 'row-reverse', top: 'column-reverse', bottom: 'column' }
|
package/dist/web/vue/index.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
export { default as IconCalendar } from './Calendar.vue';
|
|
2
2
|
export { default as IconFileFold } from './FileFold.vue';
|
|
3
|
+
export { default as IconFindReplace } from './FindReplace.vue';
|
|
4
|
+
export { default as IconH6 } from './H6.vue';
|
|
3
5
|
export { default as IconHome } from './Home.vue';
|
|
4
6
|
export { default as IconSetting } from './Setting.vue';
|
|
5
7
|
export { default as IconTask } from './Task.vue';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@phill-component/icons",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "Unified icons for phillUI mobile and pc libraries",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.js",
|
|
@@ -10,11 +10,11 @@
|
|
|
10
10
|
],
|
|
11
11
|
"sideEffects": false,
|
|
12
12
|
"bin": {
|
|
13
|
-
"
|
|
13
|
+
"icons": "scripts/install.js"
|
|
14
14
|
},
|
|
15
15
|
"scripts": {
|
|
16
16
|
"build": "node scripts/build.js",
|
|
17
|
-
"release
|
|
17
|
+
"release": "node scripts/publish.js"
|
|
18
18
|
},
|
|
19
19
|
"keywords": [
|
|
20
20
|
"icons",
|
|
@@ -29,9 +29,7 @@
|
|
|
29
29
|
"devDependencies": {
|
|
30
30
|
"case": "^1.6.3",
|
|
31
31
|
"svgo": "^4.0.0",
|
|
32
|
-
"svgtofont": "^6.5.1"
|
|
33
|
-
},
|
|
34
|
-
"dependencies": {
|
|
35
32
|
"sharp": "^0.34.5"
|
|
36
|
-
}
|
|
37
|
-
}
|
|
33
|
+
},
|
|
34
|
+
"dependencies": {}
|
|
35
|
+
}
|
package/scripts/build.js
CHANGED
|
@@ -33,16 +33,29 @@ async function build() {
|
|
|
33
33
|
for (const file of files) {
|
|
34
34
|
const name = file.replace('.svg', '');
|
|
35
35
|
const pascalName = Case.pascal(name);
|
|
36
|
+
const kebab = Case.kebab(name);
|
|
37
|
+
const easycomName = `icon-${kebab}`;
|
|
36
38
|
const content = fs.readFileSync(path.join(srcDir, file), 'utf-8');
|
|
37
39
|
// Optimize(不区分单/多色,统一按默认优化)
|
|
38
|
-
const svgoPlugins = [
|
|
40
|
+
const svgoPlugins = [
|
|
41
|
+
'preset-default',
|
|
42
|
+
'removeDimensions',
|
|
43
|
+
{
|
|
44
|
+
name: 'convertColors',
|
|
45
|
+
params: {
|
|
46
|
+
currentColor: true,
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
];
|
|
39
50
|
|
|
40
51
|
let optimized = optimize(content, {
|
|
41
52
|
path: file,
|
|
42
53
|
plugins: svgoPlugins
|
|
43
54
|
}).data;
|
|
44
55
|
|
|
45
|
-
|
|
56
|
+
// 直接在 <svg> 标签上注入 Vue 响应式属性
|
|
57
|
+
const innerSvg = optimized
|
|
58
|
+
.replace('<svg', '<svg v-bind="$attrs" :style="iconStyle" :width="iconW" :height="iconH"');
|
|
46
59
|
|
|
47
60
|
// 1) web/vue:始终内联 SVG,供 PC/Web 使用(模板)
|
|
48
61
|
const webTpl = fs.readFileSync(path.join(__dirname, 'templates/web.vue.tpl'), 'utf-8');
|
|
@@ -52,20 +65,20 @@ async function build() {
|
|
|
52
65
|
// 2) mobile/vue(模板)
|
|
53
66
|
const mobileVueTpl = fs.readFileSync(path.join(__dirname, 'templates/mobile.vue.tpl'), 'utf-8');
|
|
54
67
|
// 计算运行时图片 URL(非 H5 使用)
|
|
55
|
-
const runtimePngUrl = `@/uni_modules/@phill-component/icons/
|
|
68
|
+
const runtimePngUrl = `@/uni_modules/@phill-component/icons/mobile/uvue/${easycomName}/${name}.png`;
|
|
56
69
|
const mobileVueImgUrl = runtimePngUrl;
|
|
57
70
|
|
|
58
71
|
const mobileVueOut = mobileVueTpl
|
|
59
72
|
.replace('__INNER_SVG__', innerSvg)
|
|
60
73
|
.replace(/__IMG_SRC__/g, mobileVueImgUrl);
|
|
61
|
-
fs.writeFileSync(path.join(mobileVueDir, `${
|
|
74
|
+
fs.writeFileSync(path.join(mobileVueDir, `${easycomName}.vue`), mobileVueOut);
|
|
62
75
|
|
|
63
76
|
// 3) mobile/uvue:H5 用 SVG;非 H5 用 PNG/SVG
|
|
64
|
-
const uvueComponentdir = path.join(mobileUvueDir,
|
|
77
|
+
const uvueComponentdir = path.join(mobileUvueDir, easycomName);
|
|
65
78
|
if (!fs.existsSync(uvueComponentdir)) fs.mkdirSync(uvueComponentdir, { recursive: true });
|
|
66
79
|
try {
|
|
67
80
|
const pngPath = path.join(uvueComponentdir, `${name}.png`);
|
|
68
|
-
await sharp(Buffer.from(
|
|
81
|
+
await sharp(Buffer.from(content)).resize(128, 128, { fit: 'contain' }).png().toFile(pngPath);
|
|
69
82
|
} catch (e) {
|
|
70
83
|
console.warn(`[icons] PNG rasterize failed for ${name}:`, e.message);
|
|
71
84
|
}
|
|
@@ -73,18 +86,14 @@ async function build() {
|
|
|
73
86
|
const mobileUvueOut = mobileUvueTpl
|
|
74
87
|
.replace('__INNER_SVG__', innerSvg)
|
|
75
88
|
.replace(/__IMG_SRC__/g, runtimePngUrl);
|
|
76
|
-
fs.writeFileSync(path.join(uvueComponentdir, `${
|
|
89
|
+
fs.writeFileSync(path.join(uvueComponentdir, `${easycomName}.uvue`), mobileUvueOut);
|
|
77
90
|
|
|
78
|
-
iconData.push({ name, pascalName });
|
|
91
|
+
iconData.push({ name, pascalName, kebab });
|
|
79
92
|
}
|
|
80
93
|
|
|
81
94
|
// 5) 生成入口:web/index.js、mobile/vue/index.js、mobile/uvue/index.uts
|
|
82
95
|
const webEntry = iconData.map(i => `export { default as Icon${i.pascalName} } from './${i.pascalName}.vue';`).join('\n');
|
|
83
96
|
fs.writeFileSync(path.join(webVueDir, 'index.js'), webEntry);
|
|
84
|
-
const mobileVueEntry = iconData.map(i => `export { default as Icon${i.pascalName} } from './${i.pascalName}.vue';`).join('\n');
|
|
85
|
-
fs.writeFileSync(path.join(mobileVueDir, 'index.js'), mobileVueEntry);
|
|
86
|
-
const mobileUtsEntry = iconData.map(i => `export { default as Icon${i.pascalName} } from './${i.pascalName}/${i.pascalName}.uvue'`).join('\n');
|
|
87
|
-
fs.writeFileSync(path.join(mobileUvueDir, 'index.uts'), mobileUtsEntry);
|
|
88
97
|
|
|
89
98
|
// 不再输出 icons-svg.js/uts 等映射与其它冗余目录
|
|
90
99
|
|
package/scripts/install.js
CHANGED
|
@@ -10,7 +10,7 @@ const path = require('path');
|
|
|
10
10
|
|
|
11
11
|
function resolvePackageRoot() {
|
|
12
12
|
// When executed from node_modules: __dirname -> <pkg>/scripts
|
|
13
|
-
// In workspace/dev: __dirname -> repo/packages/
|
|
13
|
+
// In workspace/dev: __dirname -> repo/packages/icons/scripts
|
|
14
14
|
const scriptsDir = __dirname;
|
|
15
15
|
const candidate = path.resolve(scriptsDir, '..'); // <pkg>
|
|
16
16
|
if (fs.existsSync(path.join(candidate, 'dist'))) return candidate;
|
|
@@ -58,7 +58,6 @@ function main() {
|
|
|
58
58
|
? path.join(srcDir, 'uni_modules')
|
|
59
59
|
: path.join(projectRoot, 'uni_modules');
|
|
60
60
|
const targetPkgDir = path.join(uniModulesBase, '@phill-component/icons');
|
|
61
|
-
const targetDistDir = path.join(targetPkgDir, 'dist');
|
|
62
61
|
|
|
63
62
|
const pkgRoot = resolvePackageRoot();
|
|
64
63
|
const sourceDistDir = path.join(pkgRoot, 'dist');
|
|
@@ -71,24 +70,50 @@ function main() {
|
|
|
71
70
|
// Clean old content
|
|
72
71
|
rimraf(targetPkgDir);
|
|
73
72
|
fs.mkdirSync(targetPkgDir, { recursive: true });
|
|
74
|
-
//
|
|
75
|
-
copyDir(sourceDistDir,
|
|
73
|
+
// Copy into package root (no "dist" folder needed for consumers)
|
|
74
|
+
copyDir(path.join(sourceDistDir, 'mobile'), path.join(targetPkgDir, 'mobile'), exclude);
|
|
75
|
+
copyDir(path.join(sourceDistDir, 'web'), path.join(targetPkgDir, 'web'), exclude);
|
|
76
76
|
// Lightweight package.json for uni_modules (optional but helps tooling)
|
|
77
77
|
const lightPkgJson = {
|
|
78
78
|
name: 'phillui-icons',
|
|
79
79
|
description: 'Icons assets for phillUI in UniApp uni_modules',
|
|
80
|
+
main: 'mobile/vue/index.js',
|
|
80
81
|
};
|
|
81
82
|
fs.writeFileSync(path.join(targetPkgDir, 'package.json'), JSON.stringify(lightPkgJson, null, 2));
|
|
82
|
-
console.log(`[phillui/icons] Installed to ${
|
|
83
|
+
console.log(`[phillui/icons] Installed to ${targetPkgDir} ${isX ? '(UniApp X)' : '(UniApp, Exclude .uvue/.uts)'}`);
|
|
83
84
|
|
|
84
|
-
|
|
85
|
-
// patchViteAlias(projectRoot, !!fs.existsSync(srcDir));
|
|
85
|
+
patchPagesJson(projectRoot, fs.existsSync(srcDir), isX);
|
|
86
86
|
} catch (e) {
|
|
87
87
|
console.error('[phillui/icons] Installation failed:', e.message);
|
|
88
88
|
process.exit(1);
|
|
89
89
|
}
|
|
90
90
|
}
|
|
91
91
|
|
|
92
|
+
function patchPagesJson(projectRoot, hasSrc, isX) {
|
|
93
|
+
const pagesPath = hasSrc ? path.join(projectRoot, 'src/pages.json') : path.join(projectRoot, 'pages.json');
|
|
94
|
+
if (!fs.existsSync(pagesPath)) return;
|
|
95
|
+
|
|
96
|
+
try {
|
|
97
|
+
const raw = fs.readFileSync(pagesPath, 'utf8');
|
|
98
|
+
const json = JSON.parse(raw);
|
|
99
|
+
json.easycom = json.easycom || {};
|
|
100
|
+
json.easycom.autoscan = json.easycom.autoscan !== false;
|
|
101
|
+
json.easycom.custom = json.easycom.custom || {};
|
|
102
|
+
|
|
103
|
+
const key = '^icon-(.*)$';
|
|
104
|
+
const value = isX
|
|
105
|
+
? '@/uni_modules/@phill-component/icons/mobile/uvue/icon-$1/icon-$1.uvue'
|
|
106
|
+
: '@/uni_modules/@phill-component/icons/mobile/vue/icon-$1.vue';
|
|
107
|
+
if (json.easycom.custom[key] !== value) {
|
|
108
|
+
json.easycom.custom[key] = value;
|
|
109
|
+
fs.writeFileSync(pagesPath, JSON.stringify(json, null, 2));
|
|
110
|
+
console.log('[phillui/icons] Patched pages.json easycom mapping for icons.');
|
|
111
|
+
}
|
|
112
|
+
} catch (e) {
|
|
113
|
+
console.warn('[phillui/icons] Skip patching pages.json:', e.message);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
|
|
92
117
|
function patchViteAlias(projectRoot, hasSrc) {
|
|
93
118
|
const candidates = ['vite.config.ts', 'vite.config.js'].map(f => path.join(projectRoot, f));
|
|
94
119
|
const vitePath = candidates.find(p => fs.existsSync(p));
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
const fs = require('fs');
|
|
3
|
+
const path = require('path');
|
|
4
|
+
const cp = require('child_process');
|
|
5
|
+
const os = require('os');
|
|
6
|
+
|
|
7
|
+
function readJSON(p) {
|
|
8
|
+
return JSON.parse(fs.readFileSync(p, 'utf8'));
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
function normalizeNpmToken(input) {
|
|
12
|
+
let t = String(input || '').trim();
|
|
13
|
+
if (!t) return '';
|
|
14
|
+
if ((t.startsWith('"') && t.endsWith('"')) || (t.startsWith("'") && t.endsWith("'"))) {
|
|
15
|
+
t = t.slice(1, -1).trim();
|
|
16
|
+
}
|
|
17
|
+
const m = t.match(/_authToken\s*=\s*([^\s]+)/);
|
|
18
|
+
if (m && m[1]) return m[1].trim();
|
|
19
|
+
return t;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function normalizeNpmRegistry(input) {
|
|
23
|
+
let r = String(input || '').trim();
|
|
24
|
+
if (!r) r = 'https://registry.npmjs.org/';
|
|
25
|
+
if ((r.startsWith('"') && r.endsWith('"')) || (r.startsWith("'") && r.endsWith("'"))) {
|
|
26
|
+
r = r.slice(1, -1).trim();
|
|
27
|
+
}
|
|
28
|
+
if (!/^https?:\/\//.test(r)) r = `https://${r}`;
|
|
29
|
+
if (!r.endsWith('/')) r += '/';
|
|
30
|
+
return r;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function findProjectRoot(startDir) {
|
|
34
|
+
let dir = startDir;
|
|
35
|
+
while (true) {
|
|
36
|
+
const pkg = path.join(dir, 'package.json');
|
|
37
|
+
if (fs.existsSync(pkg)) {
|
|
38
|
+
try {
|
|
39
|
+
const json = JSON.parse(fs.readFileSync(pkg, 'utf8'));
|
|
40
|
+
if (json && json.private === true && json.name === 'phill-icon') return dir;
|
|
41
|
+
} catch {}
|
|
42
|
+
}
|
|
43
|
+
const parent = path.dirname(dir);
|
|
44
|
+
if (parent === dir) return null;
|
|
45
|
+
dir = parent;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
function exec(command, args, options = {}) {
|
|
50
|
+
const res = cp.spawnSync(command, args, { encoding: 'utf8', ...options });
|
|
51
|
+
if (res.status !== 0) {
|
|
52
|
+
const err = new Error(res.stderr || res.stdout || `${command} failed`);
|
|
53
|
+
err.stdout = res.stdout;
|
|
54
|
+
err.stderr = res.stderr;
|
|
55
|
+
err.status = res.status;
|
|
56
|
+
throw err;
|
|
57
|
+
}
|
|
58
|
+
return res.stdout || '';
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
function main() {
|
|
62
|
+
const args = process.argv.slice(2);
|
|
63
|
+
const checkOnly = args.includes('--check');
|
|
64
|
+
const doPublish = process.env.PHILLUI_PUBLISH === '1';
|
|
65
|
+
|
|
66
|
+
const pkgDir = process.cwd();
|
|
67
|
+
const iconsPkgPath = path.join(pkgDir, 'package.json');
|
|
68
|
+
if (!fs.existsSync(iconsPkgPath)) {
|
|
69
|
+
console.error('[publish-icons] 未在 icons 包目录下执行。');
|
|
70
|
+
process.exit(1);
|
|
71
|
+
}
|
|
72
|
+
const iconsPkg = readJSON(iconsPkgPath);
|
|
73
|
+
|
|
74
|
+
if (checkOnly || !doPublish) {
|
|
75
|
+
console.log('[publish-icons] 校验通过。未执行发布(设置 PHILLUI_PUBLISH=1 才会发布)。');
|
|
76
|
+
process.exit(0);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
const npmToken = normalizeNpmToken(process.env.NPM_TOKEN);
|
|
80
|
+
const npmRegistry = normalizeNpmRegistry(process.env.NPM_REGISTRY);
|
|
81
|
+
|
|
82
|
+
const pkgNpmrc = path.join(pkgDir, '.npmrc');
|
|
83
|
+
const root = findProjectRoot(pkgDir);
|
|
84
|
+
const rootNpmrc = root ? path.join(root, '.npmrc') : null;
|
|
85
|
+
|
|
86
|
+
let tmpDir = null;
|
|
87
|
+
let userconfig = null;
|
|
88
|
+
|
|
89
|
+
try {
|
|
90
|
+
// 预先检查版本
|
|
91
|
+
try {
|
|
92
|
+
const viewOut = exec('npm', ['view', iconsPkg.name, 'version', '--registry', npmRegistry], { env: process.env });
|
|
93
|
+
const remoteVersion = String(viewOut).trim();
|
|
94
|
+
if (remoteVersion === iconsPkg.version) {
|
|
95
|
+
console.log(`[publish-icons] ${iconsPkg.name}@${iconsPkg.version} 已存在,跳过。`);
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
} catch (e) {}
|
|
99
|
+
|
|
100
|
+
if (npmToken) {
|
|
101
|
+
tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'phill-icons-npmrc-'));
|
|
102
|
+
userconfig = path.join(tmpDir, '.npmrc');
|
|
103
|
+
const registryHost = new URL(npmRegistry).host;
|
|
104
|
+
fs.writeFileSync(
|
|
105
|
+
userconfig,
|
|
106
|
+
`registry=${npmRegistry}\n` +
|
|
107
|
+
`always-auth=true\n` +
|
|
108
|
+
`//${registryHost}/:_authToken=${npmToken}\n`
|
|
109
|
+
);
|
|
110
|
+
console.log(`[publish-icons] 使用临时 npmrc:${userconfig}`);
|
|
111
|
+
} else if (fs.existsSync(pkgNpmrc)) {
|
|
112
|
+
userconfig = pkgNpmrc;
|
|
113
|
+
console.log(`[publish-icons] 使用包内 npmrc:${userconfig}`);
|
|
114
|
+
} else if (rootNpmrc && fs.existsSync(rootNpmrc)) {
|
|
115
|
+
userconfig = rootNpmrc;
|
|
116
|
+
console.log(`[publish-icons] 使用根目录 npmrc:${userconfig}`);
|
|
117
|
+
} else {
|
|
118
|
+
console.error('[publish-icons] 缺少认证信息:请提供 NPM_TOKEN 或者提供可用的 .npmrc(包内/根目录)。');
|
|
119
|
+
process.exit(1);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
const env = { ...process.env, NPM_CONFIG_USERCONFIG: userconfig, npm_config_userconfig: userconfig };
|
|
123
|
+
|
|
124
|
+
// 验证身份
|
|
125
|
+
const whoami = exec('npm', ['whoami', '--userconfig', userconfig], { env }).trim();
|
|
126
|
+
console.log(`[publish-icons] 当前登录用户:${whoami}`);
|
|
127
|
+
|
|
128
|
+
console.log(`[publish-icons] 执行:npm publish --access public --userconfig ${userconfig}`);
|
|
129
|
+
exec('npm', ['publish', '--access', 'public', '--userconfig', userconfig], { env });
|
|
130
|
+
console.log(`[publish-icons] ${iconsPkg.name}@${iconsPkg.version} 发布成功!`);
|
|
131
|
+
} catch (e) {
|
|
132
|
+
console.error('[publish-icons] 发布失败:', e.message);
|
|
133
|
+
if (e.stdout) console.error('STDOUT:', e.stdout.toString());
|
|
134
|
+
if (e.stderr) console.error('STDERR:', e.stderr.toString());
|
|
135
|
+
process.exit(e.status || 1);
|
|
136
|
+
} finally {
|
|
137
|
+
if (tmpDir) {
|
|
138
|
+
try {
|
|
139
|
+
fs.rmSync(tmpDir, { recursive: true, force: true });
|
|
140
|
+
} catch (e) {}
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
main();
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<view class="icon" @tap="onTap" :hover-class="hoverClass" :style="
|
|
2
|
+
<view class="icon" @tap="onTap" :hover-class="hoverClass" :style="rootStyle">
|
|
3
3
|
<!-- #ifdef H5 -->
|
|
4
|
-
|
|
5
|
-
__INNER_SVG__
|
|
6
|
-
</svg>
|
|
4
|
+
__INNER_SVG__
|
|
7
5
|
<!-- #endif -->
|
|
8
6
|
<!-- #ifndef H5 -->
|
|
9
7
|
<image :src="imgSrc" :style="iconBoxStyle" />
|
|
@@ -16,7 +14,7 @@ import { computed } from 'vue'
|
|
|
16
14
|
import imgSrc from '__IMG_SRC__'
|
|
17
15
|
const props = defineProps({
|
|
18
16
|
size: { type: [String, Number], default: '1em' },
|
|
19
|
-
color: { type: String, default: '' },
|
|
17
|
+
color: { type: String, default: 'var(--tsm-color-primary)' },
|
|
20
18
|
label: { type: [String, Number], default: '' },
|
|
21
19
|
labelPos: { type: String, default: 'right' },
|
|
22
20
|
labelSize: { type: [String, Number], default: '15px' },
|
|
@@ -36,6 +34,9 @@ function toPx(v: any): string {
|
|
|
36
34
|
}
|
|
37
35
|
const iconW = computed((): string => (props.width != '' ? toPx(props.width) : toPx(props.size)))
|
|
38
36
|
const iconH = computed((): string => (props.height != '' ? toPx(props.height) : toPx(props.size)))
|
|
37
|
+
const iconStyle = computed((): UTSJSONObject => {
|
|
38
|
+
return { 'color': props.color != '' ? props.color : 'inherit' } as UTSJSONObject
|
|
39
|
+
})
|
|
39
40
|
const iconBoxStyle = computed((): UTSJSONObject => ({ width: iconW.value, height: iconH.value } as UTSJSONObject))
|
|
40
41
|
const wrapStyle = computed((): UTSJSONObject => {
|
|
41
42
|
const map = { right: 'row', left: 'row-reverse', top: 'column-reverse', bottom: 'column' } as UTSJSONObject
|
|
@@ -46,6 +47,14 @@ const wrapStyle = computed((): UTSJSONObject => {
|
|
|
46
47
|
}
|
|
47
48
|
return { display: 'flex', alignItems: 'center', flexDirection: dir } as UTSJSONObject
|
|
48
49
|
})
|
|
50
|
+
const rootStyle = computed((): UTSJSONObject => {
|
|
51
|
+
const s = wrapStyle.value
|
|
52
|
+
const i = iconStyle.value
|
|
53
|
+
for (const key in i) {
|
|
54
|
+
s[key] = i[key]
|
|
55
|
+
}
|
|
56
|
+
return s
|
|
57
|
+
})
|
|
49
58
|
const labelStyle = computed((): UTSJSONObject => {
|
|
50
59
|
const out = {} as UTSJSONObject
|
|
51
60
|
if (props.labelColor != '') out['color'] = props.labelColor
|
|
@@ -1,21 +1,20 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<view class="icon" @tap="onTap" :hover-class="hoverClass" :style="wrapStyle">
|
|
2
|
+
<view class="icon" @tap="onTap" :hover-class="hoverClass" :style="[wrapStyle, iconStyle]">
|
|
3
3
|
<!-- #ifdef H5 -->
|
|
4
|
-
|
|
5
|
-
__INNER_SVG__
|
|
6
|
-
</svg>
|
|
4
|
+
__INNER_SVG__
|
|
7
5
|
<!-- #endif -->
|
|
8
6
|
<!-- #ifndef H5 -->
|
|
9
|
-
<image :src="imgSrc" :style="iconBoxStyle"
|
|
7
|
+
<image :src="imgSrc" :style="iconBoxStyle" />
|
|
10
8
|
<!-- #endif -->
|
|
11
9
|
<text v-if="label !== ''" class="icon__label" :style="labelStyle">{{ label }}</text>
|
|
12
10
|
</view>
|
|
13
11
|
</template>
|
|
14
12
|
<script setup>
|
|
15
13
|
import { computed } from 'vue'
|
|
14
|
+
import imgSrc from '__IMG_SRC__'
|
|
16
15
|
const props = defineProps({
|
|
17
16
|
size: { type: [String, Number], default: '1em' },
|
|
18
|
-
color: { type: String, default: '' },
|
|
17
|
+
color: { type: String, default: 'var(--tsm-color-primary)' },
|
|
19
18
|
label: { type: [String, Number], default: '' },
|
|
20
19
|
labelPos: { type: String, default: 'right' },
|
|
21
20
|
labelSize: { type: [String, Number], default: '15px' },
|
|
@@ -33,9 +32,7 @@ const iconW = computed(() => props.width ? toPx(props.width) : toPx(props.size))
|
|
|
33
32
|
const iconH = computed(() => props.height ? toPx(props.height) : toPx(props.size))
|
|
34
33
|
const iconBoxStyle = computed(() => ({ width: iconW.value, height: iconH.value }))
|
|
35
34
|
const iconStyle = computed(() => {
|
|
36
|
-
|
|
37
|
-
if (props.color) s.color = props.color
|
|
38
|
-
return s
|
|
35
|
+
return { color: props.color || 'inherit' }
|
|
39
36
|
})
|
|
40
37
|
const wrapStyle = computed(() => {
|
|
41
38
|
const dirMap = { right: 'row', left: 'row-reverse', top: 'column-reverse', bottom: 'column' }
|
|
@@ -51,7 +48,6 @@ const labelStyle = computed(() => {
|
|
|
51
48
|
marginBottom: props.labelPos === 'top' ? toPx(props.space) : 0
|
|
52
49
|
}
|
|
53
50
|
})
|
|
54
|
-
const imgSrc = '__IMG_SRC__'
|
|
55
51
|
function onTap(e) {
|
|
56
52
|
emit('click', props.index)
|
|
57
53
|
if (props.stop && e && e.stopPropagation) e.stopPropagation()
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<view class="icon" @tap="onTap" :hover-class="hoverClass" :style="wrapStyle">
|
|
3
|
-
|
|
4
|
-
__INNER_SVG__
|
|
5
|
-
</svg>
|
|
2
|
+
<view class="icon" @tap="onTap" :hover-class="hoverClass" :style="[wrapStyle, iconStyle]">
|
|
3
|
+
__INNER_SVG__
|
|
6
4
|
<text v-if="label !== ''" class="icon__label" :style="labelStyle">{{ label }}</text>
|
|
7
5
|
</view>
|
|
8
6
|
</template>
|
|
@@ -10,7 +8,7 @@
|
|
|
10
8
|
import { computed } from 'vue'
|
|
11
9
|
const props = defineProps({
|
|
12
10
|
size: { type: [String, Number], default: '1em' },
|
|
13
|
-
color: { type: String, default: '' },
|
|
11
|
+
color: { type: String, default: 'inherit' },
|
|
14
12
|
label: { type: [String, Number], default: '' },
|
|
15
13
|
labelPos: { type: String, default: 'right' },
|
|
16
14
|
labelSize: { type: [String, Number], default: '15px' },
|
|
@@ -28,9 +26,7 @@ const iconW = computed(() => props.width ? toPx(props.width) : toPx(props.size))
|
|
|
28
26
|
const iconH = computed(() => props.height ? toPx(props.height) : toPx(props.size))
|
|
29
27
|
const iconBoxStyle = computed(() => ({ width: iconW.value, height: iconH.value }))
|
|
30
28
|
const iconStyle = computed(() => {
|
|
31
|
-
|
|
32
|
-
if (props.color) s.color = props.color
|
|
33
|
-
return s
|
|
29
|
+
return { color: props.color || 'inherit' }
|
|
34
30
|
})
|
|
35
31
|
const wrapStyle = computed(() => {
|
|
36
32
|
const dirMap = { right: 'row', left: 'row-reverse', top: 'column-reverse', bottom: 'column' }
|
|
Binary file
|