@talex-touch/utils 1.0.40 → 1.0.44
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/.eslintcache +1 -0
- package/__tests__/cloud-sync-sdk.test.ts +442 -0
- package/__tests__/icons/icons.test.ts +84 -0
- package/__tests__/plugin-sdk-lifecycle.test.ts +130 -0
- package/__tests__/power-sdk.test.ts +143 -0
- package/__tests__/preset-export-types.test.ts +108 -0
- package/__tests__/search/fuzzy-match.test.ts +137 -0
- package/__tests__/transport/port-policy.test.ts +44 -0
- package/__tests__/transport-domain-sdks.test.ts +152 -0
- package/__tests__/types/update.test.ts +67 -0
- package/account/account-sdk.ts +915 -0
- package/account/index.ts +2 -0
- package/account/types.ts +321 -0
- package/analytics/client.ts +136 -0
- package/analytics/index.ts +2 -0
- package/analytics/types.ts +156 -0
- package/animation/auto-resize.ts +322 -0
- package/animation/window-node.ts +26 -19
- package/auth/clerk-types.ts +12 -30
- package/auth/index.ts +0 -2
- package/auth/useAuthState.ts +6 -14
- package/base/index.ts +2 -0
- package/base/log-level.ts +105 -0
- package/channel/index.ts +170 -69
- package/cloud-sync/cloud-sync-sdk.ts +450 -0
- package/cloud-sync/index.ts +1 -0
- package/common/file-scan-utils.ts +17 -9
- package/common/index.ts +4 -0
- package/common/logger/index.ts +46 -0
- package/common/logger/logger-manager.ts +303 -0
- package/common/logger/module-logger.ts +270 -0
- package/common/logger/transport-logger.ts +234 -0
- package/common/logger/types.ts +93 -0
- package/common/search/gather.ts +48 -6
- package/common/search/index.ts +8 -0
- package/common/storage/constants.ts +13 -0
- package/common/storage/entity/app-settings.ts +245 -0
- package/common/storage/entity/index.ts +3 -0
- package/common/storage/entity/layout-atom-types.ts +147 -0
- package/common/storage/entity/openers.ts +1 -0
- package/common/storage/entity/preset-cloud-api.ts +132 -0
- package/common/storage/entity/preset-export-types.ts +256 -0
- package/common/storage/entity/shortcut-settings.ts +1 -0
- package/common/storage/shortcut-storage.ts +11 -0
- package/common/utils/clone-diagnostics.ts +105 -0
- package/common/utils/file.ts +16 -8
- package/common/utils/index.ts +6 -2
- package/common/utils/payload-preview.ts +173 -0
- package/common/utils/polling.ts +167 -13
- package/common/utils/safe-path.ts +103 -0
- package/common/utils/safe-shell.ts +115 -0
- package/common/utils/task-queue.ts +4 -1
- package/core-box/builder/tuff-builder.ts +0 -1
- package/core-box/index.ts +1 -1
- package/core-box/recommendation.ts +38 -1
- package/core-box/tuff/tuff-dsl.ts +97 -0
- package/electron/download-manager.ts +10 -7
- package/electron/env-tool.ts +42 -40
- package/electron/index.ts +0 -1
- package/env/index.ts +156 -0
- package/eslint.config.js +55 -0
- package/i18n/index.ts +62 -0
- package/i18n/locales/en.json +226 -0
- package/i18n/locales/zh.json +226 -0
- package/i18n/message-keys.ts +236 -0
- package/i18n/resolver.ts +181 -0
- package/icons/index.ts +257 -0
- package/icons/svg.ts +69 -0
- package/index.ts +9 -1
- package/intelligence/client.ts +72 -42
- package/market/constants.ts +21 -3
- package/market/index.ts +1 -1
- package/market/types.ts +20 -5
- package/package.json +15 -5
- package/permission/index.ts +143 -46
- package/permission/legacy.ts +26 -0
- package/permission/registry.ts +304 -0
- package/permission/types.ts +164 -0
- package/plugin/channel.ts +68 -39
- package/plugin/index.ts +82 -8
- package/plugin/install.ts +3 -0
- package/plugin/log/types.ts +22 -5
- package/plugin/node/logger-manager.ts +11 -3
- package/plugin/node/logger.ts +24 -17
- package/plugin/preload.ts +25 -2
- package/plugin/providers/index.ts +4 -0
- package/plugin/providers/market-client.ts +218 -0
- package/plugin/providers/npm-provider.ts +228 -0
- package/plugin/providers/tpex-provider.ts +297 -0
- package/plugin/providers/tpex-types.ts +34 -0
- package/plugin/sdk/box-items.ts +14 -0
- package/plugin/sdk/box-sdk.ts +64 -0
- package/plugin/sdk/channel.ts +119 -4
- package/plugin/sdk/clipboard.ts +26 -12
- package/plugin/sdk/cloud-sync.ts +113 -0
- package/plugin/sdk/common.ts +19 -11
- package/plugin/sdk/core-box.ts +6 -15
- package/plugin/sdk/division-box.ts +160 -65
- package/plugin/sdk/examples/storage-onDidChange-example.js +5 -2
- package/plugin/sdk/feature-sdk.ts +111 -76
- package/plugin/sdk/flow.ts +146 -45
- package/plugin/sdk/hooks/bridge.ts +113 -49
- package/plugin/sdk/hooks/life-cycle.ts +35 -16
- package/plugin/sdk/index.ts +14 -3
- package/plugin/sdk/intelligence.ts +87 -0
- package/plugin/sdk/meta/README.md +179 -0
- package/plugin/sdk/meta-sdk.ts +244 -0
- package/plugin/sdk/notification.ts +9 -0
- package/plugin/sdk/performance.ts +1 -16
- package/plugin/sdk/plugin-info.ts +64 -0
- package/plugin/sdk/power.ts +155 -0
- package/plugin/sdk/recommend.ts +21 -0
- package/plugin/sdk/service/index.ts +12 -8
- package/plugin/sdk/sqlite.ts +141 -0
- package/plugin/sdk/storage.ts +2 -6
- package/plugin/sdk/system.ts +2 -9
- package/plugin/sdk/temp-files.ts +41 -0
- package/plugin/sdk/touch-sdk.ts +18 -0
- package/plugin/sdk/types.ts +44 -4
- package/plugin/sdk/window/index.ts +12 -9
- package/plugin/sdk-version.ts +231 -0
- package/preload/renderer.ts +3 -2
- package/renderer/hooks/arg-mapper.ts +34 -6
- package/renderer/hooks/index.ts +13 -0
- package/renderer/hooks/initialize.ts +2 -1
- package/renderer/hooks/use-agent-market-sdk.ts +7 -0
- package/renderer/hooks/use-agent-market.ts +106 -0
- package/renderer/hooks/use-agents-sdk.ts +7 -0
- package/renderer/hooks/use-app-sdk.ts +7 -0
- package/renderer/hooks/use-channel.ts +33 -4
- package/renderer/hooks/use-download-sdk.ts +21 -0
- package/renderer/hooks/use-intelligence-sdk.ts +7 -0
- package/renderer/hooks/use-intelligence-stats.ts +290 -0
- package/renderer/hooks/use-intelligence.ts +202 -104
- package/renderer/hooks/use-market-sdk.ts +16 -0
- package/renderer/hooks/use-notification-sdk.ts +7 -0
- package/renderer/hooks/use-permission-sdk.ts +7 -0
- package/renderer/hooks/use-permission.ts +325 -0
- package/renderer/hooks/use-platform-sdk.ts +7 -0
- package/renderer/hooks/use-plugin-sdk.ts +16 -0
- package/renderer/hooks/use-settings-sdk.ts +7 -0
- package/renderer/hooks/use-update-sdk.ts +21 -0
- package/renderer/index.ts +1 -0
- package/renderer/ref.ts +19 -10
- package/renderer/shared/components/SharedPluginDetailContent.vue +84 -0
- package/renderer/shared/components/SharedPluginDetailHeader.vue +116 -0
- package/renderer/shared/components/SharedPluginDetailMetaList.vue +39 -0
- package/renderer/shared/components/SharedPluginDetailReadme.vue +45 -0
- package/renderer/shared/components/SharedPluginDetailVersions.vue +98 -0
- package/renderer/shared/components/index.ts +5 -0
- package/renderer/shared/components/shims-vue.d.ts +5 -0
- package/renderer/shared/index.ts +2 -0
- package/renderer/shared/plugin-detail.ts +62 -0
- package/renderer/storage/app-settings.ts +3 -1
- package/renderer/storage/base-storage.ts +508 -82
- package/renderer/storage/intelligence-storage.ts +37 -46
- package/renderer/storage/openers.ts +3 -1
- package/renderer/storage/storage-subscription.ts +126 -42
- package/renderer/touch-sdk/env.ts +10 -10
- package/renderer/touch-sdk/index.ts +114 -18
- package/renderer/touch-sdk/terminal.ts +24 -13
- package/search/feature-matcher.ts +279 -0
- package/search/fuzzy-match.ts +64 -34
- package/search/index.ts +10 -0
- package/search/levenshtein-utils.ts +17 -11
- package/transport/errors.ts +310 -0
- package/transport/event/builder.ts +378 -0
- package/transport/event/index.ts +7 -0
- package/transport/event/types.ts +292 -0
- package/transport/events/index.ts +2670 -0
- package/transport/events/meta-overlay.ts +79 -0
- package/transport/events/types/agents.ts +177 -0
- package/transport/events/types/app-index.ts +9 -0
- package/transport/events/types/app.ts +475 -0
- package/transport/events/types/box-item.ts +222 -0
- package/transport/events/types/clipboard.ts +80 -0
- package/transport/events/types/core-box.ts +534 -0
- package/transport/events/types/device-idle.ts +7 -0
- package/transport/events/types/division-box.ts +99 -0
- package/transport/events/types/download.ts +115 -0
- package/transport/events/types/file-index.ts +73 -0
- package/transport/events/types/flow.ts +149 -0
- package/transport/events/types/index.ts +70 -0
- package/transport/events/types/market.ts +39 -0
- package/transport/events/types/meta-overlay.ts +184 -0
- package/transport/events/types/notification.ts +140 -0
- package/transport/events/types/permission.ts +90 -0
- package/transport/events/types/platform.ts +8 -0
- package/transport/events/types/plugin.ts +620 -0
- package/transport/events/types/sentry.ts +20 -0
- package/transport/events/types/storage.ts +208 -0
- package/transport/events/types/transport.ts +60 -0
- package/transport/events/types/tray.ts +16 -0
- package/transport/events/types/update.ts +78 -0
- package/transport/index.ts +139 -0
- package/transport/main.ts +2 -0
- package/transport/sdk/constants.ts +29 -0
- package/transport/sdk/domains/agents-market.ts +47 -0
- package/transport/sdk/domains/agents.ts +62 -0
- package/transport/sdk/domains/app.ts +48 -0
- package/transport/sdk/domains/disposable.ts +35 -0
- package/transport/sdk/domains/download.ts +139 -0
- package/transport/sdk/domains/index.ts +13 -0
- package/transport/sdk/domains/intelligence.ts +616 -0
- package/transport/sdk/domains/market.ts +35 -0
- package/transport/sdk/domains/notification.ts +62 -0
- package/transport/sdk/domains/permission.ts +85 -0
- package/transport/sdk/domains/platform.ts +19 -0
- package/transport/sdk/domains/plugin.ts +144 -0
- package/transport/sdk/domains/settings.ts +92 -0
- package/transport/sdk/domains/update.ts +64 -0
- package/transport/sdk/index.ts +60 -0
- package/transport/sdk/main-transport.ts +710 -0
- package/transport/sdk/main.ts +9 -0
- package/transport/sdk/plugin-transport.ts +654 -0
- package/transport/sdk/port-policy.ts +38 -0
- package/transport/sdk/renderer-transport.ts +1165 -0
- package/transport/types.ts +605 -0
- package/types/agent.ts +399 -0
- package/types/cloud-sync.ts +157 -0
- package/types/division-box.ts +47 -27
- package/types/download.ts +1 -0
- package/types/flow.ts +63 -12
- package/types/icon.ts +2 -1
- package/types/index.ts +5 -0
- package/types/intelligence.ts +1492 -81
- package/types/modules/base.ts +2 -0
- package/types/path-browserify.d.ts +5 -0
- package/types/platform.ts +12 -0
- package/types/startup-info.ts +32 -0
- package/types/touch-app-core.ts +8 -8
- package/types/update.ts +94 -1
- package/vitest.config.ts +25 -0
- package/auth/useClerkConfig.ts +0 -40
- package/auth/useClerkProvider.ts +0 -52
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { SharedPluginReadme } from '../plugin-detail'
|
|
3
|
+
import { marked } from 'marked'
|
|
4
|
+
import { computed } from 'vue'
|
|
5
|
+
|
|
6
|
+
interface Props {
|
|
7
|
+
readme?: SharedPluginReadme
|
|
8
|
+
title?: string
|
|
9
|
+
emptyText?: string
|
|
10
|
+
renderMarkdown?: (markdown: string) => string
|
|
11
|
+
contentClass?: string
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const props = withDefaults(defineProps<Props>(), {
|
|
15
|
+
title: 'README',
|
|
16
|
+
emptyText: 'No README'
|
|
17
|
+
})
|
|
18
|
+
|
|
19
|
+
marked.setOptions({
|
|
20
|
+
breaks: true,
|
|
21
|
+
gfm: true
|
|
22
|
+
})
|
|
23
|
+
|
|
24
|
+
const renderedReadme = computed(() => {
|
|
25
|
+
const markdown = props.readme?.markdown?.trim()
|
|
26
|
+
if (!markdown) return ''
|
|
27
|
+
// NOTE: Markdown is not sanitized; caller should ensure content is trusted or provide a safe renderer.
|
|
28
|
+
return props.renderMarkdown ? props.renderMarkdown(markdown) : marked.parse(markdown)
|
|
29
|
+
})
|
|
30
|
+
</script>
|
|
31
|
+
|
|
32
|
+
<template>
|
|
33
|
+
<section class="space-y-3">
|
|
34
|
+
<h3 v-if="title" class="text-sm font-semibold uppercase tracking-wide text-black/70">
|
|
35
|
+
{{ title }}
|
|
36
|
+
</h3>
|
|
37
|
+
<div v-if="renderedReadme" class="prose prose-sm max-w-none" :class="[contentClass]">
|
|
38
|
+
<!-- eslint-disable-next-line vue/no-v-html -->
|
|
39
|
+
<div v-html="renderedReadme" />
|
|
40
|
+
</div>
|
|
41
|
+
<p v-else class="text-sm text-black/60">
|
|
42
|
+
{{ emptyText }}
|
|
43
|
+
</p>
|
|
44
|
+
</section>
|
|
45
|
+
</template>
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { SharedPluginVersion } from '../plugin-detail'
|
|
3
|
+
import { computed } from 'vue'
|
|
4
|
+
|
|
5
|
+
interface Props {
|
|
6
|
+
versions?: SharedPluginVersion[]
|
|
7
|
+
title?: string
|
|
8
|
+
emptyText?: string
|
|
9
|
+
downloadText?: string
|
|
10
|
+
formatDate?: (value: string | number | Date) => string
|
|
11
|
+
formatSize?: (value: number) => string
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const props = withDefaults(defineProps<Props>(), {
|
|
15
|
+
title: 'Versions',
|
|
16
|
+
emptyText: 'No versions',
|
|
17
|
+
downloadText: 'Download'
|
|
18
|
+
})
|
|
19
|
+
|
|
20
|
+
const emit = defineEmits<{
|
|
21
|
+
(e: 'download', version: SharedPluginVersion): void
|
|
22
|
+
}>()
|
|
23
|
+
|
|
24
|
+
const hasVersions = computed(() => (props.versions?.length ?? 0) > 0)
|
|
25
|
+
|
|
26
|
+
const formatBytes = (value: number): string => {
|
|
27
|
+
if (props.formatSize) return props.formatSize(value)
|
|
28
|
+
if (value >= 1024 * 1024) return `${(value / 1024 / 1024).toFixed(1)} MB`
|
|
29
|
+
if (value >= 1024) return `${(value / 1024).toFixed(1)} KB`
|
|
30
|
+
return `${value} B`
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const formatTime = (value: string | number | Date): string => {
|
|
34
|
+
if (props.formatDate) return props.formatDate(value)
|
|
35
|
+
const date = new Date(value as any)
|
|
36
|
+
return Number.isNaN(date.valueOf()) ? `${value}` : date.toLocaleDateString()
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
const signatureText = (signature?: string) => {
|
|
40
|
+
if (!signature) return ''
|
|
41
|
+
return signature.length > 12 ? `${signature.slice(0, 12)}…` : signature
|
|
42
|
+
}
|
|
43
|
+
</script>
|
|
44
|
+
|
|
45
|
+
<template>
|
|
46
|
+
<section class="space-y-3">
|
|
47
|
+
<h3 v-if="title" class="text-sm font-semibold uppercase tracking-wide text-black/70">
|
|
48
|
+
{{ title }}
|
|
49
|
+
</h3>
|
|
50
|
+
<div v-if="hasVersions" class="space-y-3">
|
|
51
|
+
<article
|
|
52
|
+
v-for="version in versions"
|
|
53
|
+
:key="version.id ?? version.version"
|
|
54
|
+
class="rounded-2xl border border-black/5 bg-white/80 p-4 text-sm text-black/70"
|
|
55
|
+
>
|
|
56
|
+
<div class="flex flex-wrap items-center justify-between gap-2">
|
|
57
|
+
<div class="flex items-center gap-2 text-black font-semibold">
|
|
58
|
+
<span>v{{ version.version }}</span>
|
|
59
|
+
<span
|
|
60
|
+
v-if="version.channel"
|
|
61
|
+
class="inline-flex items-center rounded-full bg-black/5 px-2 py-0.5 text-xs text-black/70"
|
|
62
|
+
>
|
|
63
|
+
{{ version.channel }}
|
|
64
|
+
</span>
|
|
65
|
+
</div>
|
|
66
|
+
<span class="text-xs text-black/50">
|
|
67
|
+
<span v-if="version.createdAt">{{ formatTime(version.createdAt) }}</span>
|
|
68
|
+
<span v-if="version.packageSize"> · {{ formatBytes(version.packageSize) }}</span>
|
|
69
|
+
</span>
|
|
70
|
+
</div>
|
|
71
|
+
<p v-if="version.changelog" class="mt-2 text-sm leading-relaxed text-black/70">
|
|
72
|
+
{{ version.changelog }}
|
|
73
|
+
</p>
|
|
74
|
+
<div class="mt-3 flex flex-wrap items-center gap-2 text-xs">
|
|
75
|
+
<a
|
|
76
|
+
v-if="version.packageUrl"
|
|
77
|
+
:href="version.packageUrl"
|
|
78
|
+
target="_blank"
|
|
79
|
+
rel="noopener"
|
|
80
|
+
class="inline-flex items-center rounded-full bg-black text-white px-3 py-1"
|
|
81
|
+
@click="emit('download', version)"
|
|
82
|
+
>
|
|
83
|
+
{{ downloadText }}
|
|
84
|
+
</a>
|
|
85
|
+
<span
|
|
86
|
+
v-if="version.signature"
|
|
87
|
+
class="inline-flex items-center rounded-full bg-black/5 px-2 py-0.5 text-xs text-black/70"
|
|
88
|
+
>
|
|
89
|
+
{{ signatureText(version.signature) }}
|
|
90
|
+
</span>
|
|
91
|
+
</div>
|
|
92
|
+
</article>
|
|
93
|
+
</div>
|
|
94
|
+
<p v-else class="text-sm text-black/60">
|
|
95
|
+
{{ emptyText }}
|
|
96
|
+
</p>
|
|
97
|
+
</section>
|
|
98
|
+
</template>
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { default as SharedPluginDetailContent } from './SharedPluginDetailContent.vue'
|
|
2
|
+
export { default as SharedPluginDetailHeader } from './SharedPluginDetailHeader.vue'
|
|
3
|
+
export { default as SharedPluginDetailMetaList } from './SharedPluginDetailMetaList.vue'
|
|
4
|
+
export { default as SharedPluginDetailReadme } from './SharedPluginDetailReadme.vue'
|
|
5
|
+
export { default as SharedPluginDetailVersions } from './SharedPluginDetailVersions.vue'
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
export type SharedPluginTrustLevel = 'official' | 'verified' | 'unverified'
|
|
2
|
+
|
|
3
|
+
export interface SharedPluginAuthor {
|
|
4
|
+
name: string
|
|
5
|
+
avatarUrl?: string
|
|
6
|
+
avatarColor?: string
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export interface SharedPluginCategory {
|
|
10
|
+
id?: string
|
|
11
|
+
label?: string
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export interface SharedPluginVersion {
|
|
15
|
+
id?: string
|
|
16
|
+
version: string
|
|
17
|
+
channel?: string
|
|
18
|
+
createdAt?: string | number | Date
|
|
19
|
+
packageSize?: number
|
|
20
|
+
changelog?: string | null
|
|
21
|
+
packageUrl?: string
|
|
22
|
+
signature?: string
|
|
23
|
+
readmeMarkdown?: string | null
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export interface SharedPluginReadme {
|
|
27
|
+
markdown?: string | null
|
|
28
|
+
url?: string
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export interface SharedPluginMetaItem {
|
|
32
|
+
label: string
|
|
33
|
+
value: string
|
|
34
|
+
icon?: string
|
|
35
|
+
highlight?: 'upgrade' | 'installed' | 'info'
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export interface SharedPluginProvider {
|
|
39
|
+
id?: string
|
|
40
|
+
name?: string
|
|
41
|
+
type?: string
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export interface SharedPluginDetail {
|
|
45
|
+
id: string
|
|
46
|
+
name: string
|
|
47
|
+
summary?: string
|
|
48
|
+
author?: SharedPluginAuthor
|
|
49
|
+
category?: SharedPluginCategory
|
|
50
|
+
badges?: string[]
|
|
51
|
+
installs?: number
|
|
52
|
+
official?: boolean
|
|
53
|
+
trustLevel?: SharedPluginTrustLevel
|
|
54
|
+
icon?: string
|
|
55
|
+
iconUrl?: string | null
|
|
56
|
+
latestVersion?: SharedPluginVersion
|
|
57
|
+
versions?: SharedPluginVersion[]
|
|
58
|
+
readme?: SharedPluginReadme
|
|
59
|
+
metaItems?: SharedPluginMetaItem[]
|
|
60
|
+
provider?: SharedPluginProvider
|
|
61
|
+
updatedAt?: string | number | Date
|
|
62
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { AppSetting } from '../..'
|
|
2
2
|
import { appSettingOriginData, StorageList } from '../..'
|
|
3
|
-
import { createStorageProxy, TouchStorage } from './base-storage'
|
|
3
|
+
import { createStorageDataProxy, createStorageProxy, TouchStorage } from './base-storage'
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Application settings storage manager
|
|
@@ -42,3 +42,5 @@ export const appSettings = createStorageProxy<AppSettingsStorage>(
|
|
|
42
42
|
APP_SETTINGS_SINGLETON_KEY,
|
|
43
43
|
() => new AppSettingsStorage(),
|
|
44
44
|
)
|
|
45
|
+
|
|
46
|
+
export const appSettingsData = createStorageDataProxy(appSettings)
|