@2kog/kacha 0.3.1 → 0.3.2
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
|
@@ -13,7 +13,7 @@ const categories = { music: '音乐', effect: '音效', dialogue: '台词' }
|
|
|
13
13
|
export default {
|
|
14
14
|
components: { AssetDeleteButton, AssetTagInput, AudioLines, ElInput, ElOption, ElSelect, ElUpload, Plus, Search, Upload, X },
|
|
15
15
|
data() {
|
|
16
|
-
return { categories, assets: [], query: '', filter: '',
|
|
16
|
+
return { categories, assets: [], query: '', filter: '', selectedTag: '', overview: null, create: null, active: null, busy: false, error: '', durations: {} }
|
|
17
17
|
},
|
|
18
18
|
computed: {
|
|
19
19
|
typedAssets() {
|
|
@@ -24,14 +24,14 @@ export default {
|
|
|
24
24
|
},
|
|
25
25
|
visibleAssets() {
|
|
26
26
|
const query = this.query.trim().toLowerCase()
|
|
27
|
-
return this.typedAssets.filter(asset => this.
|
|
27
|
+
return this.typedAssets.filter(asset => (!this.selectedTag || asset.tags?.includes(this.selectedTag))
|
|
28
28
|
&& [asset.name, ...asset.groupPath, ...(asset.tags || []), ...asset.categories.flatMap(category => [categories[category], this.$t(categories[category])])]
|
|
29
29
|
.some(value => value?.toLowerCase().includes(query)))
|
|
30
30
|
},
|
|
31
31
|
},
|
|
32
32
|
watch: {
|
|
33
33
|
availableTags(tags) {
|
|
34
|
-
|
|
34
|
+
if (this.selectedTag && !tags.includes(this.selectedTag)) this.selectedTag = ''
|
|
35
35
|
},
|
|
36
36
|
},
|
|
37
37
|
beforeRouteLeave() {
|
|
@@ -45,11 +45,6 @@ export default {
|
|
|
45
45
|
import.meta.hot?.off('workbench:audio:changed', this.refresh)
|
|
46
46
|
},
|
|
47
47
|
methods: {
|
|
48
|
-
toggleTag(tag) {
|
|
49
|
-
this.tagFilters = this.tagFilters.includes(tag)
|
|
50
|
-
? this.tagFilters.filter(value => value !== tag)
|
|
51
|
-
: [...this.tagFilters, tag]
|
|
52
|
-
},
|
|
53
48
|
async submitOverview(method, data) {
|
|
54
49
|
if (this.busy || !this.active) return
|
|
55
50
|
this.busy = true
|
|
@@ -88,7 +83,7 @@ export default {
|
|
|
88
83
|
this.$refs.create.close()
|
|
89
84
|
this.query = ''
|
|
90
85
|
this.filter = ''
|
|
91
|
-
this.
|
|
86
|
+
this.selectedTag = ''
|
|
92
87
|
await this.refresh()
|
|
93
88
|
} catch (cause) {
|
|
94
89
|
this.error = cause.message
|
|
@@ -184,9 +179,9 @@ export default {
|
|
|
184
179
|
</div>
|
|
185
180
|
<div class="filter-list" role="group" :aria-label="$t('音频标签')">
|
|
186
181
|
<span class="filter-label">{{ $t('标签') }}</span>
|
|
187
|
-
<button class="tag" :class="{ chosen: !
|
|
188
|
-
<button v-for="tag in availableTags" :key="tag" class="tag" :class="{ chosen:
|
|
189
|
-
:aria-pressed="
|
|
182
|
+
<button class="tag" :class="{ chosen: !selectedTag }" :aria-pressed="!selectedTag" @click="selectedTag = ''">{{ $t('全部') }}</button>
|
|
183
|
+
<button v-for="tag in availableTags" :key="tag" class="tag" :class="{ chosen: selectedTag === tag }"
|
|
184
|
+
:aria-pressed="selectedTag === tag" @click="selectedTag = tag">{{ tag }}</button>
|
|
190
185
|
</div>
|
|
191
186
|
</div>
|
|
192
187
|
<p v-if="error && !active && !create" class="error" role="alert">{{ error }}</p>
|
|
@@ -19,7 +19,7 @@ export default {
|
|
|
19
19
|
props: { kind: { type: String, default: 'scenes' } },
|
|
20
20
|
data() {
|
|
21
21
|
return {
|
|
22
|
-
scenes: [],
|
|
22
|
+
scenes: [], selectedTag: '', query: '', createTags: [], overviewDraft: {}, scene: null, tab: 'cover', category: '', selectedId: '',
|
|
23
23
|
imageForm: null, storyDraft: null, promptDraft: null, create: false, name: '',
|
|
24
24
|
selecting: false, selectedIds: new Set(),
|
|
25
25
|
busy: false, error: '', pageError: '', revision: 0,
|
|
@@ -48,7 +48,7 @@ export default {
|
|
|
48
48
|
const query = this.query.trim().toLowerCase()
|
|
49
49
|
return this.scenes.filter(scene => {
|
|
50
50
|
const tags = scene.tags || []
|
|
51
|
-
return this.
|
|
51
|
+
return (!this.selectedTag || tags.includes(this.selectedTag))
|
|
52
52
|
&& [scene.name, ...tags, ...scene.groupPath].some(value => value.toLowerCase().includes(query))
|
|
53
53
|
})
|
|
54
54
|
},
|
|
@@ -124,11 +124,6 @@ export default {
|
|
|
124
124
|
}
|
|
125
125
|
return this.open(item)
|
|
126
126
|
},
|
|
127
|
-
toggleTag(tag) {
|
|
128
|
-
this.tagFilters = this.tagFilters.includes(tag)
|
|
129
|
-
? this.tagFilters.filter(value => value !== tag)
|
|
130
|
-
: [...this.tagFilters, tag]
|
|
131
|
-
},
|
|
132
127
|
async refreshAssets() {
|
|
133
128
|
await this.refresh()
|
|
134
129
|
const scene = this.scene
|
|
@@ -150,7 +145,7 @@ export default {
|
|
|
150
145
|
if (revision !== this.revision) return
|
|
151
146
|
this.scenes = scenes
|
|
152
147
|
this.selectedIds = new Set(scenes.filter(item => this.selectedIds.has(item.id)).map(item => item.id))
|
|
153
|
-
|
|
148
|
+
if (this.selectedTag && !this.availableTags.includes(this.selectedTag)) this.selectedTag = ''
|
|
154
149
|
this.pageError = ''
|
|
155
150
|
} catch (cause) {
|
|
156
151
|
if (revision === this.revision) this.pageError = cause.message
|
|
@@ -351,9 +346,9 @@ export default {
|
|
|
351
346
|
</div>
|
|
352
347
|
</div>
|
|
353
348
|
<div v-if="availableTags.length" class="filter-list" :aria-label="$t('按标签筛选')">
|
|
354
|
-
<button class="tag" :class="{ chosen: !
|
|
355
|
-
<button v-for="tag in availableTags" :key="tag" class="tag" :class="{ chosen:
|
|
356
|
-
:aria-pressed="
|
|
349
|
+
<button class="tag" :class="{ chosen: !selectedTag }" :aria-pressed="!selectedTag" @click="selectedTag = ''">{{ $t('全部') }}</button>
|
|
350
|
+
<button v-for="tag in availableTags" :key="tag" class="tag" :class="{ chosen: selectedTag === tag }"
|
|
351
|
+
:aria-pressed="selectedTag === tag" @click="selectedTag = tag">{{ tag }}</button>
|
|
357
352
|
</div>
|
|
358
353
|
</div>
|
|
359
354
|
<p v-if="pageError" class="error" role="alert">{{ pageError }}</p>
|
|
@@ -372,8 +367,8 @@ export default {
|
|
|
372
367
|
<div class="scene-card-info">
|
|
373
368
|
<button class="character-name" :disabled="busy" @click="openOrSelect(item)">{{ item.name }}</button>
|
|
374
369
|
<div v-if="item.tags?.length" class="card-tags image-card-tags">
|
|
375
|
-
<button v-for="tag in item.tags" :key="tag" class="tag compact" :aria-pressed="
|
|
376
|
-
:class="{ chosen:
|
|
370
|
+
<button v-for="tag in item.tags" :key="tag" class="tag compact" :aria-pressed="selectedTag === tag"
|
|
371
|
+
:class="{ chosen: selectedTag === tag }" @click="selectedTag = tag">{{ tag }}</button>
|
|
377
372
|
</div>
|
|
378
373
|
<p v-else-if="!isProp && item.groupPath.length" class="asset-group-path">{{ item.groupPath.join(' / ') }}</p>
|
|
379
374
|
<small>{{ $t('{count} 张图', { count: item.count }) }}<span v-if="item.cover?.status === 'candidate'"> · {{ $t('候选封面') }}</span></small>
|