@cnc_cbz/usefultools-plugin-official 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/README.md +56 -0
- package/dist/base-converter.mjs +333 -0
- package/dist/case-converter.mjs +142 -0
- package/dist/chmod-calculator.mjs +286 -0
- package/dist/color-converter.mjs +211 -0
- package/dist/cron-expression.mjs +487 -0
- package/dist/cyber-chef.mjs +24885 -0
- package/dist/hash-generator.mjs +239 -0
- package/dist/html-entity.mjs +187 -0
- package/dist/image-compressor.mjs +337 -0
- package/dist/ip-subnet.mjs +222 -0
- package/dist/js-runner.mjs +39973 -0
- package/dist/json-diff.mjs +704 -0
- package/dist/json-formatter.mjs +1138 -0
- package/dist/json-yaml.mjs +256 -0
- package/dist/jwt-parser.mjs +405 -0
- package/dist/lorem-ipsum.mjs +246 -0
- package/dist/markdown-preview.mjs +184 -0
- package/dist/password-generator.mjs +254 -0
- package/dist/qr-generator.mjs +238 -0
- package/dist/regex-tester.mjs +424 -0
- package/dist/sql-formatter.mjs +242 -0
- package/dist/text-diff.mjs +940 -0
- package/dist/text-stats.mjs +205 -0
- package/dist/timestamp-converter.mjs +339 -0
- package/dist/translator.mjs +667 -0
- package/dist/url-codec.mjs +179 -0
- package/dist/uuid-generator.mjs +165 -0
- package/package.json +56 -0
- package/plugin.json +31 -0
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
import { defineComponent, ref, computed, openBlock, createElementBlock, createElementVNode, withDirectives, vModelText, createCommentVNode, Fragment, renderList, toDisplayString, normalizeClass, normalizeStyle } from "vue";
|
|
2
|
+
const _hoisted_1 = { class: "flex flex-col h-full gap-5" };
|
|
3
|
+
const _hoisted_2 = { class: "bg-deep-charcoal border-4 border-black rounded-xl p-4 shadow-hard" };
|
|
4
|
+
const _hoisted_3 = {
|
|
5
|
+
key: 0,
|
|
6
|
+
class: "flex-1 flex flex-col gap-4 overflow-auto min-h-0"
|
|
7
|
+
};
|
|
8
|
+
const _hoisted_4 = { class: "grid grid-cols-2 lg:grid-cols-4 gap-3" };
|
|
9
|
+
const _hoisted_5 = ["onClick"];
|
|
10
|
+
const _hoisted_6 = { class: "flex items-center gap-1.5 mb-1" };
|
|
11
|
+
const _hoisted_7 = { class: "material-icons text-sm text-gray-600" };
|
|
12
|
+
const _hoisted_8 = { class: "text-[10px] font-bold text-gray-500 uppercase tracking-wider" };
|
|
13
|
+
const _hoisted_9 = {
|
|
14
|
+
key: 0,
|
|
15
|
+
class: "bg-deep-charcoal border-4 border-black rounded-xl p-4 shadow-hard"
|
|
16
|
+
};
|
|
17
|
+
const _hoisted_10 = { class: "space-y-1.5" };
|
|
18
|
+
const _hoisted_11 = { class: "font-mono text-sm text-gray-300 w-24 truncate" };
|
|
19
|
+
const _hoisted_12 = { class: "flex-1 h-4 bg-bg-dark rounded-full border border-black overflow-hidden" };
|
|
20
|
+
const _hoisted_13 = { class: "font-mono text-xs text-gray-500 w-8 text-right" };
|
|
21
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
22
|
+
__name: "index",
|
|
23
|
+
setup(__props) {
|
|
24
|
+
const input = ref("");
|
|
25
|
+
const copyField = ref("");
|
|
26
|
+
const stats = computed(() => {
|
|
27
|
+
const text = input.value;
|
|
28
|
+
if (!text) return [];
|
|
29
|
+
const chars = text.length;
|
|
30
|
+
const charsNoSpace = text.replace(/\s/g, "").length;
|
|
31
|
+
const words = text.trim() ? text.trim().split(/\s+/).length : 0;
|
|
32
|
+
const lines = text ? text.split("\n").length : 0;
|
|
33
|
+
const sentences = text.trim() ? text.split(/[.!?。!?]+/).filter((s) => s.trim()).length : 0;
|
|
34
|
+
const paragraphs = text.trim() ? text.split(/\n\s*\n/).filter((p) => p.trim()).length : 0;
|
|
35
|
+
const cjk = (text.match(/[\u4e00-\u9fff\u3400-\u4dbf]/g) || []).length;
|
|
36
|
+
const enWords = (text.match(/[a-zA-Z]+/g) || []).length;
|
|
37
|
+
const digits = (text.match(/\d/g) || []).length;
|
|
38
|
+
const punctuation = (text.match(/[^\w\s\u4e00-\u9fff\u3400-\u4dbf]/g) || []).length;
|
|
39
|
+
const byteSize = new TextEncoder().encode(text).length;
|
|
40
|
+
return [
|
|
41
|
+
{ label: "总字符数", value: chars.toLocaleString(), color: "text-primary", icon: "text_fields" },
|
|
42
|
+
{ label: "字符数(不含空格)", value: charsNoSpace.toLocaleString(), color: "text-primary", icon: "text_fields" },
|
|
43
|
+
{ label: "单词数", value: words.toLocaleString(), color: "text-electric-blue", icon: "spellcheck" },
|
|
44
|
+
{ label: "行数", value: lines.toLocaleString(), color: "text-vibrant-purple", icon: "format_list_numbered" },
|
|
45
|
+
{ label: "句子数", value: sentences.toLocaleString(), color: "text-neon-green", icon: "short_text" },
|
|
46
|
+
{ label: "段落数", value: paragraphs.toLocaleString(), color: "text-hot-pink", icon: "subject" },
|
|
47
|
+
{ label: "中文字符", value: cjk.toLocaleString(), color: "text-coral-red", icon: "translate" },
|
|
48
|
+
{ label: "英文单词", value: enWords.toLocaleString(), color: "text-electric-blue", icon: "abc" },
|
|
49
|
+
{ label: "数字字符", value: digits.toLocaleString(), color: "text-neon-green", icon: "pin" },
|
|
50
|
+
{ label: "标点符号", value: punctuation.toLocaleString(), color: "text-gray-400", icon: "more_horiz" },
|
|
51
|
+
{ label: "字节大小", value: formatBytes(byteSize), color: "text-vibrant-purple", icon: "data_usage" }
|
|
52
|
+
];
|
|
53
|
+
});
|
|
54
|
+
const wordFreq = computed(() => {
|
|
55
|
+
if (!input.value.trim()) return [];
|
|
56
|
+
const words = input.value.toLowerCase().match(/[\u4e00-\u9fff]|[a-zA-Z]+/g) || [];
|
|
57
|
+
const freq = {};
|
|
58
|
+
for (const w of words) freq[w] = (freq[w] || 0) + 1;
|
|
59
|
+
return Object.entries(freq).sort((a, b) => b[1] - a[1]).slice(0, 10);
|
|
60
|
+
});
|
|
61
|
+
function formatBytes(bytes) {
|
|
62
|
+
if (bytes < 1024) return `${bytes} B`;
|
|
63
|
+
if (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(1)} KB`;
|
|
64
|
+
return `${(bytes / (1024 * 1024)).toFixed(2)} MB`;
|
|
65
|
+
}
|
|
66
|
+
async function copy(text, field) {
|
|
67
|
+
await navigator.clipboard.writeText(text);
|
|
68
|
+
copyField.value = field;
|
|
69
|
+
setTimeout(() => {
|
|
70
|
+
copyField.value = "";
|
|
71
|
+
}, 1200);
|
|
72
|
+
}
|
|
73
|
+
return (_ctx, _cache) => {
|
|
74
|
+
return openBlock(), createElementBlock("div", _hoisted_1, [
|
|
75
|
+
createElementVNode("div", _hoisted_2, [
|
|
76
|
+
_cache[1] || (_cache[1] = createElementVNode(
|
|
77
|
+
"div",
|
|
78
|
+
{ class: "flex items-center gap-2 mb-3" },
|
|
79
|
+
[
|
|
80
|
+
createElementVNode("span", { class: "material-icons text-primary text-lg" }, "analytics"),
|
|
81
|
+
createElementVNode("span", { class: "text-sm font-bold text-gray-400 uppercase tracking-wider" }, "文本统计")
|
|
82
|
+
],
|
|
83
|
+
-1
|
|
84
|
+
/* CACHED */
|
|
85
|
+
)),
|
|
86
|
+
withDirectives(createElementVNode(
|
|
87
|
+
"textarea",
|
|
88
|
+
{
|
|
89
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => input.value = $event),
|
|
90
|
+
rows: "6",
|
|
91
|
+
placeholder: "输入或粘贴文本...",
|
|
92
|
+
class: "w-full bg-bg-dark text-gray-100 border-4 border-black rounded-lg px-4 py-3 font-mono text-sm shadow-hard focus:border-primary focus:shadow-none focus:translate-x-[4px] focus:translate-y-[4px] transition-all outline-none placeholder-gray-600 resize-none"
|
|
93
|
+
},
|
|
94
|
+
null,
|
|
95
|
+
512
|
|
96
|
+
/* NEED_PATCH */
|
|
97
|
+
), [
|
|
98
|
+
[vModelText, input.value]
|
|
99
|
+
])
|
|
100
|
+
]),
|
|
101
|
+
stats.value.length ? (openBlock(), createElementBlock("div", _hoisted_3, [
|
|
102
|
+
createCommentVNode(" 统计网格 "),
|
|
103
|
+
createElementVNode("div", _hoisted_4, [
|
|
104
|
+
(openBlock(true), createElementBlock(
|
|
105
|
+
Fragment,
|
|
106
|
+
null,
|
|
107
|
+
renderList(stats.value, (s) => {
|
|
108
|
+
return openBlock(), createElementBlock("div", {
|
|
109
|
+
key: s.label,
|
|
110
|
+
class: "bg-deep-charcoal border-4 border-black rounded-xl p-3 shadow-hard cursor-pointer hover:border-primary transition-all group",
|
|
111
|
+
onClick: ($event) => copy(s.value, s.label)
|
|
112
|
+
}, [
|
|
113
|
+
createElementVNode("div", _hoisted_6, [
|
|
114
|
+
createElementVNode(
|
|
115
|
+
"span",
|
|
116
|
+
_hoisted_7,
|
|
117
|
+
toDisplayString(s.icon),
|
|
118
|
+
1
|
|
119
|
+
/* TEXT */
|
|
120
|
+
),
|
|
121
|
+
createElementVNode(
|
|
122
|
+
"span",
|
|
123
|
+
_hoisted_8,
|
|
124
|
+
toDisplayString(s.label),
|
|
125
|
+
1
|
|
126
|
+
/* TEXT */
|
|
127
|
+
)
|
|
128
|
+
]),
|
|
129
|
+
createElementVNode(
|
|
130
|
+
"div",
|
|
131
|
+
{
|
|
132
|
+
class: normalizeClass(["font-mono text-lg font-bold", s.color])
|
|
133
|
+
},
|
|
134
|
+
toDisplayString(s.value),
|
|
135
|
+
3
|
|
136
|
+
/* TEXT, CLASS */
|
|
137
|
+
)
|
|
138
|
+
], 8, _hoisted_5);
|
|
139
|
+
}),
|
|
140
|
+
128
|
|
141
|
+
/* KEYED_FRAGMENT */
|
|
142
|
+
))
|
|
143
|
+
]),
|
|
144
|
+
createCommentVNode(" 词频 "),
|
|
145
|
+
wordFreq.value.length ? (openBlock(), createElementBlock("div", _hoisted_9, [
|
|
146
|
+
_cache[2] || (_cache[2] = createElementVNode(
|
|
147
|
+
"div",
|
|
148
|
+
{ class: "flex items-center gap-2 mb-3" },
|
|
149
|
+
[
|
|
150
|
+
createElementVNode("span", { class: "material-icons text-primary text-sm" }, "bar_chart"),
|
|
151
|
+
createElementVNode("span", { class: "text-xs font-bold text-gray-500 uppercase tracking-wider" }, "词频 TOP 10")
|
|
152
|
+
],
|
|
153
|
+
-1
|
|
154
|
+
/* CACHED */
|
|
155
|
+
)),
|
|
156
|
+
createElementVNode("div", _hoisted_10, [
|
|
157
|
+
(openBlock(true), createElementBlock(
|
|
158
|
+
Fragment,
|
|
159
|
+
null,
|
|
160
|
+
renderList(wordFreq.value, ([word, count]) => {
|
|
161
|
+
return openBlock(), createElementBlock("div", {
|
|
162
|
+
key: word,
|
|
163
|
+
class: "flex items-center gap-3"
|
|
164
|
+
}, [
|
|
165
|
+
createElementVNode(
|
|
166
|
+
"span",
|
|
167
|
+
_hoisted_11,
|
|
168
|
+
toDisplayString(word),
|
|
169
|
+
1
|
|
170
|
+
/* TEXT */
|
|
171
|
+
),
|
|
172
|
+
createElementVNode("div", _hoisted_12, [
|
|
173
|
+
createElementVNode(
|
|
174
|
+
"div",
|
|
175
|
+
{
|
|
176
|
+
class: "h-full bg-primary rounded-full transition-all",
|
|
177
|
+
style: normalizeStyle({ width: count / wordFreq.value[0][1] * 100 + "%" })
|
|
178
|
+
},
|
|
179
|
+
null,
|
|
180
|
+
4
|
|
181
|
+
/* STYLE */
|
|
182
|
+
)
|
|
183
|
+
]),
|
|
184
|
+
createElementVNode(
|
|
185
|
+
"span",
|
|
186
|
+
_hoisted_13,
|
|
187
|
+
toDisplayString(count),
|
|
188
|
+
1
|
|
189
|
+
/* TEXT */
|
|
190
|
+
)
|
|
191
|
+
]);
|
|
192
|
+
}),
|
|
193
|
+
128
|
|
194
|
+
/* KEYED_FRAGMENT */
|
|
195
|
+
))
|
|
196
|
+
])
|
|
197
|
+
])) : createCommentVNode("v-if", true)
|
|
198
|
+
])) : createCommentVNode("v-if", true)
|
|
199
|
+
]);
|
|
200
|
+
};
|
|
201
|
+
}
|
|
202
|
+
});
|
|
203
|
+
export {
|
|
204
|
+
_sfc_main as default
|
|
205
|
+
};
|
|
@@ -0,0 +1,339 @@
|
|
|
1
|
+
import { defineComponent, ref, onMounted, onBeforeUnmount, computed, openBlock, createElementBlock, createCommentVNode, createElementVNode, Fragment, renderList, toDisplayString, createTextVNode, normalizeClass, withDirectives, vModelText } from "vue";
|
|
2
|
+
const _hoisted_1 = { class: "flex flex-col h-full gap-5" };
|
|
3
|
+
const _hoisted_2 = { class: "bg-deep-charcoal border-4 border-black rounded-xl p-4 shadow-hard" };
|
|
4
|
+
const _hoisted_3 = { class: "grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-3" };
|
|
5
|
+
const _hoisted_4 = ["onClick"];
|
|
6
|
+
const _hoisted_5 = { class: "text-xs text-gray-500 mb-1" };
|
|
7
|
+
const _hoisted_6 = { class: "font-mono text-sm text-gray-100 break-all flex items-center gap-2" };
|
|
8
|
+
const _hoisted_7 = { class: "flex-1 grid grid-cols-1 lg:grid-cols-2 gap-4 min-h-0" };
|
|
9
|
+
const _hoisted_8 = { class: "flex flex-col gap-3" };
|
|
10
|
+
const _hoisted_9 = { class: "flex gap-2" };
|
|
11
|
+
const _hoisted_10 = {
|
|
12
|
+
key: 0,
|
|
13
|
+
class: "bg-deep-charcoal border-4 border-black rounded-xl p-4 shadow-hard space-y-2"
|
|
14
|
+
};
|
|
15
|
+
const _hoisted_11 = ["onClick"];
|
|
16
|
+
const _hoisted_12 = { class: "text-xs text-gray-500 w-20 shrink-0" };
|
|
17
|
+
const _hoisted_13 = { class: "font-mono text-sm text-gray-100 flex-1 text-right" };
|
|
18
|
+
const _hoisted_14 = {
|
|
19
|
+
key: 1,
|
|
20
|
+
class: "px-4 py-2 bg-coral-red/20 border-2 border-coral-red rounded flex items-center gap-2 text-coral-red font-bold text-sm"
|
|
21
|
+
};
|
|
22
|
+
const _hoisted_15 = { class: "flex flex-col gap-3" };
|
|
23
|
+
const _hoisted_16 = { class: "flex gap-2" };
|
|
24
|
+
const _hoisted_17 = {
|
|
25
|
+
key: 0,
|
|
26
|
+
class: "bg-deep-charcoal border-4 border-black rounded-xl p-4 shadow-hard space-y-2"
|
|
27
|
+
};
|
|
28
|
+
const _hoisted_18 = ["onClick"];
|
|
29
|
+
const _hoisted_19 = { class: "text-xs text-gray-500 w-20 shrink-0" };
|
|
30
|
+
const _hoisted_20 = { class: "font-mono text-sm text-gray-100 flex-1 text-right" };
|
|
31
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
32
|
+
__name: "index",
|
|
33
|
+
setup(__props) {
|
|
34
|
+
const timestampInput = ref("");
|
|
35
|
+
const dateInput = ref("");
|
|
36
|
+
const errorMsg = ref("");
|
|
37
|
+
const now = ref(Date.now());
|
|
38
|
+
const copyField = ref("");
|
|
39
|
+
let timer;
|
|
40
|
+
onMounted(() => {
|
|
41
|
+
timer = setInterval(() => {
|
|
42
|
+
now.value = Date.now();
|
|
43
|
+
}, 1e3);
|
|
44
|
+
});
|
|
45
|
+
onBeforeUnmount(() => clearInterval(timer));
|
|
46
|
+
const currentSeconds = computed(() => Math.floor(now.value / 1e3));
|
|
47
|
+
const currentMillis = computed(() => now.value);
|
|
48
|
+
const currentISO = computed(() => new Date(now.value).toISOString());
|
|
49
|
+
const currentLocal = computed(() => formatLocal(new Date(now.value)));
|
|
50
|
+
function formatLocal(d) {
|
|
51
|
+
const pad = (n) => String(n).padStart(2, "0");
|
|
52
|
+
return `${d.getFullYear()}-${pad(d.getMonth() + 1)}-${pad(d.getDate())} ${pad(d.getHours())}:${pad(d.getMinutes())}:${pad(d.getSeconds())}`;
|
|
53
|
+
}
|
|
54
|
+
const tsResult = computed(() => {
|
|
55
|
+
const raw = timestampInput.value.trim();
|
|
56
|
+
if (!raw) return null;
|
|
57
|
+
const n = Number(raw);
|
|
58
|
+
if (isNaN(n)) {
|
|
59
|
+
errorMsg.value = "无效的时间戳";
|
|
60
|
+
return null;
|
|
61
|
+
}
|
|
62
|
+
const ms = raw.length <= 10 ? n * 1e3 : n;
|
|
63
|
+
const d = new Date(ms);
|
|
64
|
+
if (isNaN(d.getTime())) {
|
|
65
|
+
errorMsg.value = "无效的时间戳";
|
|
66
|
+
return null;
|
|
67
|
+
}
|
|
68
|
+
errorMsg.value = "";
|
|
69
|
+
return {
|
|
70
|
+
local: formatLocal(d),
|
|
71
|
+
iso: d.toISOString(),
|
|
72
|
+
utc: d.toUTCString(),
|
|
73
|
+
relative: getRelative(d),
|
|
74
|
+
date: d
|
|
75
|
+
};
|
|
76
|
+
});
|
|
77
|
+
const dateResult = computed(() => {
|
|
78
|
+
const raw = dateInput.value.trim();
|
|
79
|
+
if (!raw) return null;
|
|
80
|
+
const d = new Date(raw);
|
|
81
|
+
if (isNaN(d.getTime())) return null;
|
|
82
|
+
return { seconds: Math.floor(d.getTime() / 1e3), millis: d.getTime() };
|
|
83
|
+
});
|
|
84
|
+
function getRelative(d) {
|
|
85
|
+
const diff = Date.now() - d.getTime();
|
|
86
|
+
const abs = Math.abs(diff);
|
|
87
|
+
const suffix = diff > 0 ? "前" : "后";
|
|
88
|
+
if (abs < 6e4) return `${Math.floor(abs / 1e3)} 秒${suffix}`;
|
|
89
|
+
if (abs < 36e5) return `${Math.floor(abs / 6e4)} 分钟${suffix}`;
|
|
90
|
+
if (abs < 864e5) return `${Math.floor(abs / 36e5)} 小时${suffix}`;
|
|
91
|
+
return `${Math.floor(abs / 864e5)} 天${suffix}`;
|
|
92
|
+
}
|
|
93
|
+
function useNow() {
|
|
94
|
+
timestampInput.value = String(Math.floor(Date.now() / 1e3));
|
|
95
|
+
}
|
|
96
|
+
function useNowDate() {
|
|
97
|
+
dateInput.value = formatLocal(/* @__PURE__ */ new Date());
|
|
98
|
+
}
|
|
99
|
+
async function copy(text, field) {
|
|
100
|
+
await navigator.clipboard.writeText(text);
|
|
101
|
+
copyField.value = field;
|
|
102
|
+
setTimeout(() => {
|
|
103
|
+
copyField.value = "";
|
|
104
|
+
}, 1200);
|
|
105
|
+
}
|
|
106
|
+
return (_ctx, _cache) => {
|
|
107
|
+
return openBlock(), createElementBlock("div", _hoisted_1, [
|
|
108
|
+
createCommentVNode(" 当前时间实时显示 "),
|
|
109
|
+
createElementVNode("div", _hoisted_2, [
|
|
110
|
+
_cache[2] || (_cache[2] = createElementVNode(
|
|
111
|
+
"div",
|
|
112
|
+
{ class: "flex items-center gap-2 mb-3" },
|
|
113
|
+
[
|
|
114
|
+
createElementVNode("span", { class: "material-icons text-primary text-lg" }, "schedule"),
|
|
115
|
+
createElementVNode("span", { class: "text-sm font-bold text-gray-400 uppercase tracking-wider" }, "当前时间"),
|
|
116
|
+
createElementVNode("span", { class: "ml-2 w-2 h-2 rounded-full bg-neon-green animate-pulse" })
|
|
117
|
+
],
|
|
118
|
+
-1
|
|
119
|
+
/* CACHED */
|
|
120
|
+
)),
|
|
121
|
+
createElementVNode("div", _hoisted_3, [
|
|
122
|
+
(openBlock(true), createElementBlock(
|
|
123
|
+
Fragment,
|
|
124
|
+
null,
|
|
125
|
+
renderList([
|
|
126
|
+
{ label: "秒级时间戳", value: String(currentSeconds.value), key: "cs" },
|
|
127
|
+
{ label: "毫秒时间戳", value: String(currentMillis.value), key: "cm" },
|
|
128
|
+
{ label: "本地时间", value: currentLocal.value, key: "cl" },
|
|
129
|
+
{ label: "ISO 8601", value: currentISO.value, key: "ci" }
|
|
130
|
+
], (item) => {
|
|
131
|
+
return openBlock(), createElementBlock("div", {
|
|
132
|
+
key: item.key,
|
|
133
|
+
class: "bg-bg-dark border-2 border-black rounded-lg p-3 cursor-pointer hover:border-primary transition-all group",
|
|
134
|
+
onClick: ($event) => copy(item.value, item.key)
|
|
135
|
+
}, [
|
|
136
|
+
createElementVNode(
|
|
137
|
+
"div",
|
|
138
|
+
_hoisted_5,
|
|
139
|
+
toDisplayString(item.label),
|
|
140
|
+
1
|
|
141
|
+
/* TEXT */
|
|
142
|
+
),
|
|
143
|
+
createElementVNode("div", _hoisted_6, [
|
|
144
|
+
createTextVNode(
|
|
145
|
+
toDisplayString(item.value) + " ",
|
|
146
|
+
1
|
|
147
|
+
/* TEXT */
|
|
148
|
+
),
|
|
149
|
+
createElementVNode(
|
|
150
|
+
"span",
|
|
151
|
+
{
|
|
152
|
+
class: normalizeClass(["material-icons text-sm opacity-0 group-hover:opacity-100 transition-opacity", copyField.value === item.key ? "text-neon-green" : "text-gray-500"])
|
|
153
|
+
},
|
|
154
|
+
toDisplayString(copyField.value === item.key ? "check" : "content_copy"),
|
|
155
|
+
3
|
|
156
|
+
/* TEXT, CLASS */
|
|
157
|
+
)
|
|
158
|
+
])
|
|
159
|
+
], 8, _hoisted_4);
|
|
160
|
+
}),
|
|
161
|
+
128
|
|
162
|
+
/* KEYED_FRAGMENT */
|
|
163
|
+
))
|
|
164
|
+
])
|
|
165
|
+
]),
|
|
166
|
+
createCommentVNode(" 双向转换区域 "),
|
|
167
|
+
createElementVNode("div", _hoisted_7, [
|
|
168
|
+
createCommentVNode(" 时间戳 → 日期 "),
|
|
169
|
+
createElementVNode("div", _hoisted_8, [
|
|
170
|
+
_cache[4] || (_cache[4] = createElementVNode(
|
|
171
|
+
"div",
|
|
172
|
+
{ class: "flex items-center gap-2" },
|
|
173
|
+
[
|
|
174
|
+
createElementVNode("span", { class: "material-icons text-primary text-lg" }, "tag"),
|
|
175
|
+
createElementVNode("span", { class: "text-sm font-bold text-gray-400 uppercase tracking-wider" }, "时间戳 → 日期")
|
|
176
|
+
],
|
|
177
|
+
-1
|
|
178
|
+
/* CACHED */
|
|
179
|
+
)),
|
|
180
|
+
createElementVNode("div", _hoisted_9, [
|
|
181
|
+
withDirectives(createElementVNode(
|
|
182
|
+
"input",
|
|
183
|
+
{
|
|
184
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => timestampInput.value = $event),
|
|
185
|
+
placeholder: "输入秒级或毫秒级时间戳...",
|
|
186
|
+
class: "flex-1 h-10 bg-deep-charcoal text-gray-100 border-4 border-black rounded-lg px-4 font-mono text-sm shadow-hard focus:border-primary focus:shadow-none focus:translate-x-[4px] focus:translate-y-[4px] transition-all outline-none placeholder-gray-600"
|
|
187
|
+
},
|
|
188
|
+
null,
|
|
189
|
+
512
|
|
190
|
+
/* NEED_PATCH */
|
|
191
|
+
), [
|
|
192
|
+
[vModelText, timestampInput.value]
|
|
193
|
+
]),
|
|
194
|
+
createElementVNode("button", {
|
|
195
|
+
onClick: useNow,
|
|
196
|
+
class: "h-10 px-4 bg-primary text-black font-bold border-2 border-black rounded shadow-hard-sm hover:shadow-none hover:translate-x-0.5 hover:translate-y-0.5 transition-all text-sm whitespace-nowrap"
|
|
197
|
+
}, " 现在 ")
|
|
198
|
+
]),
|
|
199
|
+
createCommentVNode(" 转换结果 "),
|
|
200
|
+
tsResult.value ? (openBlock(), createElementBlock("div", _hoisted_10, [
|
|
201
|
+
(openBlock(true), createElementBlock(
|
|
202
|
+
Fragment,
|
|
203
|
+
null,
|
|
204
|
+
renderList([
|
|
205
|
+
{ label: "本地时间", value: tsResult.value.local, key: "tl" },
|
|
206
|
+
{ label: "ISO 8601", value: tsResult.value.iso, key: "ti" },
|
|
207
|
+
{ label: "UTC", value: tsResult.value.utc, key: "tu" },
|
|
208
|
+
{ label: "相对时间", value: tsResult.value.relative, key: "tr" }
|
|
209
|
+
], (row) => {
|
|
210
|
+
return openBlock(), createElementBlock("div", {
|
|
211
|
+
key: row.key,
|
|
212
|
+
class: "flex items-center justify-between py-1.5 px-2 rounded hover:bg-white/5 cursor-pointer group",
|
|
213
|
+
onClick: ($event) => copy(row.value, row.key)
|
|
214
|
+
}, [
|
|
215
|
+
createElementVNode(
|
|
216
|
+
"span",
|
|
217
|
+
_hoisted_12,
|
|
218
|
+
toDisplayString(row.label),
|
|
219
|
+
1
|
|
220
|
+
/* TEXT */
|
|
221
|
+
),
|
|
222
|
+
createElementVNode(
|
|
223
|
+
"span",
|
|
224
|
+
_hoisted_13,
|
|
225
|
+
toDisplayString(row.value),
|
|
226
|
+
1
|
|
227
|
+
/* TEXT */
|
|
228
|
+
),
|
|
229
|
+
createElementVNode(
|
|
230
|
+
"span",
|
|
231
|
+
{
|
|
232
|
+
class: normalizeClass(["material-icons text-sm ml-2 opacity-0 group-hover:opacity-100 transition-opacity", copyField.value === row.key ? "text-neon-green" : "text-gray-500"])
|
|
233
|
+
},
|
|
234
|
+
toDisplayString(copyField.value === row.key ? "check" : "content_copy"),
|
|
235
|
+
3
|
|
236
|
+
/* TEXT, CLASS */
|
|
237
|
+
)
|
|
238
|
+
], 8, _hoisted_11);
|
|
239
|
+
}),
|
|
240
|
+
128
|
|
241
|
+
/* KEYED_FRAGMENT */
|
|
242
|
+
))
|
|
243
|
+
])) : timestampInput.value.trim() && errorMsg.value ? (openBlock(), createElementBlock("div", _hoisted_14, [
|
|
244
|
+
_cache[3] || (_cache[3] = createElementVNode(
|
|
245
|
+
"span",
|
|
246
|
+
{ class: "material-icons text-lg" },
|
|
247
|
+
"error_outline",
|
|
248
|
+
-1
|
|
249
|
+
/* CACHED */
|
|
250
|
+
)),
|
|
251
|
+
createTextVNode(
|
|
252
|
+
" " + toDisplayString(errorMsg.value),
|
|
253
|
+
1
|
|
254
|
+
/* TEXT */
|
|
255
|
+
)
|
|
256
|
+
])) : createCommentVNode("v-if", true)
|
|
257
|
+
]),
|
|
258
|
+
createCommentVNode(" 日期 → 时间戳 "),
|
|
259
|
+
createElementVNode("div", _hoisted_15, [
|
|
260
|
+
_cache[5] || (_cache[5] = createElementVNode(
|
|
261
|
+
"div",
|
|
262
|
+
{ class: "flex items-center gap-2" },
|
|
263
|
+
[
|
|
264
|
+
createElementVNode("span", { class: "material-icons text-neon-green text-lg" }, "calendar_today"),
|
|
265
|
+
createElementVNode("span", { class: "text-sm font-bold text-gray-400 uppercase tracking-wider" }, "日期 → 时间戳")
|
|
266
|
+
],
|
|
267
|
+
-1
|
|
268
|
+
/* CACHED */
|
|
269
|
+
)),
|
|
270
|
+
createElementVNode("div", _hoisted_16, [
|
|
271
|
+
withDirectives(createElementVNode(
|
|
272
|
+
"input",
|
|
273
|
+
{
|
|
274
|
+
"onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => dateInput.value = $event),
|
|
275
|
+
placeholder: "如 2024-01-15 12:30:00 或 ISO 格式...",
|
|
276
|
+
class: "flex-1 h-10 bg-deep-charcoal text-gray-100 border-4 border-black rounded-lg px-4 font-mono text-sm shadow-hard focus:border-primary focus:shadow-none focus:translate-x-[4px] focus:translate-y-[4px] transition-all outline-none placeholder-gray-600"
|
|
277
|
+
},
|
|
278
|
+
null,
|
|
279
|
+
512
|
|
280
|
+
/* NEED_PATCH */
|
|
281
|
+
), [
|
|
282
|
+
[vModelText, dateInput.value]
|
|
283
|
+
]),
|
|
284
|
+
createElementVNode("button", {
|
|
285
|
+
onClick: useNowDate,
|
|
286
|
+
class: "h-10 px-4 bg-neon-green text-black font-bold border-2 border-black rounded shadow-hard-sm hover:shadow-none hover:translate-x-0.5 hover:translate-y-0.5 transition-all text-sm whitespace-nowrap"
|
|
287
|
+
}, " 现在 ")
|
|
288
|
+
]),
|
|
289
|
+
dateResult.value ? (openBlock(), createElementBlock("div", _hoisted_17, [
|
|
290
|
+
(openBlock(true), createElementBlock(
|
|
291
|
+
Fragment,
|
|
292
|
+
null,
|
|
293
|
+
renderList([
|
|
294
|
+
{ label: "秒级时间戳", value: String(dateResult.value.seconds), key: "ds" },
|
|
295
|
+
{ label: "毫秒时间戳", value: String(dateResult.value.millis), key: "dm" }
|
|
296
|
+
], (row) => {
|
|
297
|
+
return openBlock(), createElementBlock("div", {
|
|
298
|
+
key: row.key,
|
|
299
|
+
class: "flex items-center justify-between py-1.5 px-2 rounded hover:bg-white/5 cursor-pointer group",
|
|
300
|
+
onClick: ($event) => copy(row.value, row.key)
|
|
301
|
+
}, [
|
|
302
|
+
createElementVNode(
|
|
303
|
+
"span",
|
|
304
|
+
_hoisted_19,
|
|
305
|
+
toDisplayString(row.label),
|
|
306
|
+
1
|
|
307
|
+
/* TEXT */
|
|
308
|
+
),
|
|
309
|
+
createElementVNode(
|
|
310
|
+
"span",
|
|
311
|
+
_hoisted_20,
|
|
312
|
+
toDisplayString(row.value),
|
|
313
|
+
1
|
|
314
|
+
/* TEXT */
|
|
315
|
+
),
|
|
316
|
+
createElementVNode(
|
|
317
|
+
"span",
|
|
318
|
+
{
|
|
319
|
+
class: normalizeClass(["material-icons text-sm ml-2 opacity-0 group-hover:opacity-100 transition-opacity", copyField.value === row.key ? "text-neon-green" : "text-gray-500"])
|
|
320
|
+
},
|
|
321
|
+
toDisplayString(copyField.value === row.key ? "check" : "content_copy"),
|
|
322
|
+
3
|
|
323
|
+
/* TEXT, CLASS */
|
|
324
|
+
)
|
|
325
|
+
], 8, _hoisted_18);
|
|
326
|
+
}),
|
|
327
|
+
128
|
|
328
|
+
/* KEYED_FRAGMENT */
|
|
329
|
+
))
|
|
330
|
+
])) : createCommentVNode("v-if", true)
|
|
331
|
+
])
|
|
332
|
+
])
|
|
333
|
+
]);
|
|
334
|
+
};
|
|
335
|
+
}
|
|
336
|
+
});
|
|
337
|
+
export {
|
|
338
|
+
_sfc_main as default
|
|
339
|
+
};
|