@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,238 @@
|
|
|
1
|
+
import { defineComponent, ref, watch, onMounted, openBlock, createElementBlock, createElementVNode, withDirectives, vModelText, toDisplayString, createTextVNode } 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: "flex items-center gap-3 mt-3" };
|
|
5
|
+
const _hoisted_4 = { class: "font-mono text-xs text-gray-400" };
|
|
6
|
+
const _hoisted_5 = { class: "flex-1 flex flex-col items-center justify-center gap-4" };
|
|
7
|
+
const _hoisted_6 = { class: "bg-white p-4 rounded-xl border-4 border-black shadow-hard" };
|
|
8
|
+
const _hoisted_7 = ["width", "height"];
|
|
9
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
10
|
+
__name: "index",
|
|
11
|
+
setup(__props) {
|
|
12
|
+
const input = ref("https://example.com");
|
|
13
|
+
const size = ref(256);
|
|
14
|
+
const canvasRef = ref();
|
|
15
|
+
function generateQR() {
|
|
16
|
+
const canvas = canvasRef.value;
|
|
17
|
+
if (!canvas || !input.value.trim()) return;
|
|
18
|
+
const ctx = canvas.getContext("2d");
|
|
19
|
+
if (!ctx) return;
|
|
20
|
+
canvas.width = size.value;
|
|
21
|
+
canvas.height = size.value;
|
|
22
|
+
const matrix = encodeQR(input.value.trim());
|
|
23
|
+
const cellSize = size.value / matrix.length;
|
|
24
|
+
ctx.fillStyle = "#ffffff";
|
|
25
|
+
ctx.fillRect(0, 0, size.value, size.value);
|
|
26
|
+
ctx.fillStyle = "#000000";
|
|
27
|
+
for (let y = 0; y < matrix.length; y++) {
|
|
28
|
+
for (let x = 0; x < matrix[y].length; x++) {
|
|
29
|
+
if (matrix[y][x]) {
|
|
30
|
+
ctx.fillRect(x * cellSize, y * cellSize, cellSize + 0.5, cellSize + 0.5);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
function encodeQR(text) {
|
|
36
|
+
const size2 = 21;
|
|
37
|
+
const matrix = Array.from({ length: size2 }, () => Array(size2).fill(false));
|
|
38
|
+
const reserved = Array.from({ length: size2 }, () => Array(size2).fill(false));
|
|
39
|
+
function drawFinder(cx, cy) {
|
|
40
|
+
for (let dy = -3; dy <= 3; dy++) {
|
|
41
|
+
for (let dx = -3; dx <= 3; dx++) {
|
|
42
|
+
const x = cx + dx, y = cy + dy;
|
|
43
|
+
if (x < 0 || x >= size2 || y < 0 || y >= size2) continue;
|
|
44
|
+
const ring = Math.max(Math.abs(dx), Math.abs(dy));
|
|
45
|
+
matrix[y][x] = ring !== 2;
|
|
46
|
+
reserved[y][x] = true;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
for (let i = -4; i <= 4; i++) {
|
|
50
|
+
for (const [dx, dy] of [[i, -4], [i, 4], [-4, i], [4, i]]) {
|
|
51
|
+
const x = cx + dx, y = cy + dy;
|
|
52
|
+
if (x >= 0 && x < size2 && y >= 0 && y < size2) {
|
|
53
|
+
reserved[y][x] = true;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
drawFinder(3, 3);
|
|
59
|
+
drawFinder(size2 - 4, 3);
|
|
60
|
+
drawFinder(3, size2 - 4);
|
|
61
|
+
for (let i = 8; i < size2 - 8; i++) {
|
|
62
|
+
matrix[6][i] = i % 2 === 0;
|
|
63
|
+
matrix[i][6] = i % 2 === 0;
|
|
64
|
+
reserved[6][i] = true;
|
|
65
|
+
reserved[i][6] = true;
|
|
66
|
+
}
|
|
67
|
+
matrix[size2 - 8][8] = true;
|
|
68
|
+
reserved[size2 - 8][8] = true;
|
|
69
|
+
for (let i = 0; i < 9; i++) {
|
|
70
|
+
reserved[8][i] = true;
|
|
71
|
+
reserved[i][8] = true;
|
|
72
|
+
}
|
|
73
|
+
for (let i = 0; i < 8; i++) {
|
|
74
|
+
reserved[8][size2 - 1 - i] = true;
|
|
75
|
+
reserved[size2 - 1 - i][8] = true;
|
|
76
|
+
}
|
|
77
|
+
const bytes = new TextEncoder().encode(text);
|
|
78
|
+
const dataBits = [];
|
|
79
|
+
dataBits.push(0, 1, 0, 0);
|
|
80
|
+
for (let i = 7; i >= 0; i--) dataBits.push(bytes.length >> i & 1);
|
|
81
|
+
for (const b of bytes) {
|
|
82
|
+
for (let i = 7; i >= 0; i--) dataBits.push(b >> i & 1);
|
|
83
|
+
}
|
|
84
|
+
while (dataBits.length < 152) dataBits.push(0);
|
|
85
|
+
const totalBits = 26 * 8;
|
|
86
|
+
let padIdx = 0;
|
|
87
|
+
while (dataBits.length < totalBits) {
|
|
88
|
+
const padByte = padIdx % 2 === 0 ? 236 : 17;
|
|
89
|
+
for (let i = 7; i >= 0; i--) dataBits.push(padByte >> i & 1);
|
|
90
|
+
padIdx++;
|
|
91
|
+
}
|
|
92
|
+
let bitIdx = 0;
|
|
93
|
+
let upward = true;
|
|
94
|
+
for (let right = size2 - 1; right >= 0; right -= 2) {
|
|
95
|
+
if (right === 6) right = 5;
|
|
96
|
+
const cols = [right, right - 1].filter((c) => c >= 0);
|
|
97
|
+
const rows = upward ? Array.from({ length: size2 }, (_, i) => size2 - 1 - i) : Array.from({ length: size2 }, (_, i) => i);
|
|
98
|
+
for (const row of rows) {
|
|
99
|
+
for (const col of cols) {
|
|
100
|
+
if (!reserved[row][col] && bitIdx < dataBits.length) {
|
|
101
|
+
matrix[row][col] = dataBits[bitIdx] === 1;
|
|
102
|
+
bitIdx++;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
upward = !upward;
|
|
107
|
+
}
|
|
108
|
+
const formatBits = [1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 0];
|
|
109
|
+
const hPos = [0, 1, 2, 3, 4, 5, 7, 8, size2 - 8, size2 - 7, size2 - 6, size2 - 5, size2 - 4, size2 - 3, size2 - 2];
|
|
110
|
+
for (let i = 0; i < 15; i++) matrix[8][hPos[i]] = formatBits[i] === 1;
|
|
111
|
+
const vPos = [size2 - 1, size2 - 2, size2 - 3, size2 - 4, size2 - 5, size2 - 6, size2 - 7, 8, 7, 5, 4, 3, 2, 1, 0];
|
|
112
|
+
for (let i = 0; i < 15; i++) matrix[vPos[i]][8] = formatBits[i] === 1;
|
|
113
|
+
for (let y = 0; y < size2; y++) {
|
|
114
|
+
for (let x = 0; x < size2; x++) {
|
|
115
|
+
if (!reserved[y][x] && (y + x) % 2 === 0) {
|
|
116
|
+
matrix[y][x] = !matrix[y][x];
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
const quiet = 2;
|
|
121
|
+
const final = Array.from({ length: size2 + quiet * 2 }, () => Array(size2 + quiet * 2).fill(false));
|
|
122
|
+
for (let y = 0; y < size2; y++) {
|
|
123
|
+
for (let x = 0; x < size2; x++) {
|
|
124
|
+
final[y + quiet][x + quiet] = matrix[y][x];
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
return final;
|
|
128
|
+
}
|
|
129
|
+
watch([input, size], () => generateQR());
|
|
130
|
+
onMounted(() => generateQR());
|
|
131
|
+
function download() {
|
|
132
|
+
const canvas = canvasRef.value;
|
|
133
|
+
if (!canvas) return;
|
|
134
|
+
const link = document.createElement("a");
|
|
135
|
+
link.download = "qrcode.png";
|
|
136
|
+
link.href = canvas.toDataURL("image/png");
|
|
137
|
+
link.click();
|
|
138
|
+
}
|
|
139
|
+
return (_ctx, _cache) => {
|
|
140
|
+
return openBlock(), createElementBlock("div", _hoisted_1, [
|
|
141
|
+
createElementVNode("div", _hoisted_2, [
|
|
142
|
+
_cache[3] || (_cache[3] = createElementVNode(
|
|
143
|
+
"div",
|
|
144
|
+
{ class: "flex items-center gap-2 mb-3" },
|
|
145
|
+
[
|
|
146
|
+
createElementVNode("span", { class: "material-icons text-primary text-lg" }, "qr_code_2"),
|
|
147
|
+
createElementVNode("span", { class: "text-sm font-bold text-gray-400 uppercase tracking-wider" }, "QR 码生成器")
|
|
148
|
+
],
|
|
149
|
+
-1
|
|
150
|
+
/* CACHED */
|
|
151
|
+
)),
|
|
152
|
+
withDirectives(createElementVNode(
|
|
153
|
+
"textarea",
|
|
154
|
+
{
|
|
155
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => input.value = $event),
|
|
156
|
+
rows: "3",
|
|
157
|
+
placeholder: "输入 URL 或文本...",
|
|
158
|
+
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"
|
|
159
|
+
},
|
|
160
|
+
null,
|
|
161
|
+
512
|
|
162
|
+
/* NEED_PATCH */
|
|
163
|
+
), [
|
|
164
|
+
[vModelText, input.value]
|
|
165
|
+
]),
|
|
166
|
+
createElementVNode("div", _hoisted_3, [
|
|
167
|
+
_cache[2] || (_cache[2] = createElementVNode(
|
|
168
|
+
"span",
|
|
169
|
+
{ class: "text-xs text-gray-500" },
|
|
170
|
+
"尺寸:",
|
|
171
|
+
-1
|
|
172
|
+
/* CACHED */
|
|
173
|
+
)),
|
|
174
|
+
withDirectives(createElementVNode(
|
|
175
|
+
"input",
|
|
176
|
+
{
|
|
177
|
+
"onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => size.value = $event),
|
|
178
|
+
type: "range",
|
|
179
|
+
min: "128",
|
|
180
|
+
max: "512",
|
|
181
|
+
step: "64",
|
|
182
|
+
class: "w-32 accent-primary"
|
|
183
|
+
},
|
|
184
|
+
null,
|
|
185
|
+
512
|
|
186
|
+
/* NEED_PATCH */
|
|
187
|
+
), [
|
|
188
|
+
[
|
|
189
|
+
vModelText,
|
|
190
|
+
size.value,
|
|
191
|
+
void 0,
|
|
192
|
+
{ number: true }
|
|
193
|
+
]
|
|
194
|
+
]),
|
|
195
|
+
createElementVNode(
|
|
196
|
+
"span",
|
|
197
|
+
_hoisted_4,
|
|
198
|
+
toDisplayString(size.value) + "px",
|
|
199
|
+
1
|
|
200
|
+
/* TEXT */
|
|
201
|
+
)
|
|
202
|
+
])
|
|
203
|
+
]),
|
|
204
|
+
createElementVNode("div", _hoisted_5, [
|
|
205
|
+
createElementVNode("div", _hoisted_6, [
|
|
206
|
+
createElementVNode("canvas", {
|
|
207
|
+
ref_key: "canvasRef",
|
|
208
|
+
ref: canvasRef,
|
|
209
|
+
width: size.value,
|
|
210
|
+
height: size.value,
|
|
211
|
+
class: "block"
|
|
212
|
+
}, null, 8, _hoisted_7)
|
|
213
|
+
]),
|
|
214
|
+
createElementVNode("button", {
|
|
215
|
+
onClick: download,
|
|
216
|
+
class: "h-10 px-5 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 flex items-center gap-2"
|
|
217
|
+
}, [..._cache[4] || (_cache[4] = [
|
|
218
|
+
createElementVNode(
|
|
219
|
+
"span",
|
|
220
|
+
{ class: "material-icons text-lg" },
|
|
221
|
+
"download",
|
|
222
|
+
-1
|
|
223
|
+
/* CACHED */
|
|
224
|
+
),
|
|
225
|
+
createTextVNode(
|
|
226
|
+
" 下载 PNG ",
|
|
227
|
+
-1
|
|
228
|
+
/* CACHED */
|
|
229
|
+
)
|
|
230
|
+
])])
|
|
231
|
+
])
|
|
232
|
+
]);
|
|
233
|
+
};
|
|
234
|
+
}
|
|
235
|
+
});
|
|
236
|
+
export {
|
|
237
|
+
_sfc_main as default
|
|
238
|
+
};
|
|
@@ -0,0 +1,424 @@
|
|
|
1
|
+
import { defineComponent, ref, computed, openBlock, createElementBlock, createCommentVNode, createElementVNode, createTextVNode, withDirectives, vModelText, Fragment, renderList, normalizeClass, toDisplayString, normalizeStyle } from "vue";
|
|
2
|
+
const _hoisted_1 = { class: "flex flex-col h-full gap-4" };
|
|
3
|
+
const _hoisted_2 = { class: "flex flex-wrap items-center gap-3" };
|
|
4
|
+
const _hoisted_3 = { class: "flex items-center gap-2 flex-1 min-w-[200px]" };
|
|
5
|
+
const _hoisted_4 = { class: "flex items-center gap-1" };
|
|
6
|
+
const _hoisted_5 = ["title", "onClick"];
|
|
7
|
+
const _hoisted_6 = {
|
|
8
|
+
key: 0,
|
|
9
|
+
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"
|
|
10
|
+
};
|
|
11
|
+
const _hoisted_7 = { class: "flex-1 grid grid-cols-1 lg:grid-cols-2 gap-4 min-h-0" };
|
|
12
|
+
const _hoisted_8 = { class: "flex flex-col min-h-0" };
|
|
13
|
+
const _hoisted_9 = { class: "flex flex-col min-h-0" };
|
|
14
|
+
const _hoisted_10 = { class: "flex items-center gap-2 mb-2" };
|
|
15
|
+
const _hoisted_11 = {
|
|
16
|
+
key: 0,
|
|
17
|
+
class: "ml-2 text-xs text-primary font-bold"
|
|
18
|
+
};
|
|
19
|
+
const _hoisted_12 = ["innerHTML"];
|
|
20
|
+
const _hoisted_13 = {
|
|
21
|
+
key: 1,
|
|
22
|
+
class: "max-h-[200px] overflow-auto"
|
|
23
|
+
};
|
|
24
|
+
const _hoisted_14 = { class: "grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-2" };
|
|
25
|
+
const _hoisted_15 = { class: "flex items-center gap-2 mb-1" };
|
|
26
|
+
const _hoisted_16 = { class: "text-xs font-bold text-gray-400" };
|
|
27
|
+
const _hoisted_17 = { class: "ml-auto text-xs text-gray-500" };
|
|
28
|
+
const _hoisted_18 = { class: "font-mono text-sm text-white break-all" };
|
|
29
|
+
const _hoisted_19 = {
|
|
30
|
+
key: 0,
|
|
31
|
+
class: "mt-1 text-xs text-gray-400"
|
|
32
|
+
};
|
|
33
|
+
const _hoisted_20 = { class: "text-neon-green" };
|
|
34
|
+
const _hoisted_21 = {
|
|
35
|
+
key: 1,
|
|
36
|
+
class: "mt-1 text-xs text-gray-400"
|
|
37
|
+
};
|
|
38
|
+
const _hoisted_22 = { class: "text-electric-blue" };
|
|
39
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
40
|
+
__name: "index",
|
|
41
|
+
setup(__props) {
|
|
42
|
+
const pattern = ref("");
|
|
43
|
+
const flags = ref("g");
|
|
44
|
+
const testText = ref("");
|
|
45
|
+
const errorMsg = ref("");
|
|
46
|
+
const flagOptions = [
|
|
47
|
+
{ label: "g", title: "全局匹配" },
|
|
48
|
+
{ label: "i", title: "忽略大小写" },
|
|
49
|
+
{ label: "m", title: "多行模式" },
|
|
50
|
+
{ label: "s", title: "点号匹配换行" },
|
|
51
|
+
{ label: "u", title: "Unicode模式" }
|
|
52
|
+
];
|
|
53
|
+
function toggleFlag(f) {
|
|
54
|
+
flags.value = flags.value.includes(f) ? flags.value.replace(f, "") : flags.value + f;
|
|
55
|
+
}
|
|
56
|
+
const matches = computed(() => {
|
|
57
|
+
if (!pattern.value || !testText.value) {
|
|
58
|
+
errorMsg.value = "";
|
|
59
|
+
return [];
|
|
60
|
+
}
|
|
61
|
+
try {
|
|
62
|
+
const re = new RegExp(pattern.value, flags.value);
|
|
63
|
+
errorMsg.value = "";
|
|
64
|
+
const results = [];
|
|
65
|
+
if (flags.value.includes("g")) {
|
|
66
|
+
let m;
|
|
67
|
+
while ((m = re.exec(testText.value)) !== null) {
|
|
68
|
+
results.push({
|
|
69
|
+
text: m[0],
|
|
70
|
+
index: m.index,
|
|
71
|
+
groups: m.slice(1),
|
|
72
|
+
namedGroups: m.groups ? { ...m.groups } : void 0
|
|
73
|
+
});
|
|
74
|
+
if (!m[0].length) re.lastIndex++;
|
|
75
|
+
}
|
|
76
|
+
} else {
|
|
77
|
+
const m = re.exec(testText.value);
|
|
78
|
+
if (m) {
|
|
79
|
+
results.push({
|
|
80
|
+
text: m[0],
|
|
81
|
+
index: m.index,
|
|
82
|
+
groups: m.slice(1),
|
|
83
|
+
namedGroups: m.groups ? { ...m.groups } : void 0
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
return results;
|
|
88
|
+
} catch (e) {
|
|
89
|
+
errorMsg.value = e.message || "无效的正则表达式";
|
|
90
|
+
return [];
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
const highlightColors = [
|
|
94
|
+
{ bg: "rgba(249,177,31,0.35)", border: "#f9b11f" },
|
|
95
|
+
{ bg: "rgba(59,130,246,0.35)", border: "#3b82f6" },
|
|
96
|
+
{ bg: "rgba(132,204,22,0.35)", border: "#84cc16" },
|
|
97
|
+
{ bg: "rgba(168,85,247,0.35)", border: "#a855f7" },
|
|
98
|
+
{ bg: "rgba(236,72,153,0.35)", border: "#ec4899" },
|
|
99
|
+
{ bg: "rgba(255,107,107,0.35)", border: "#ff6b6b" }
|
|
100
|
+
];
|
|
101
|
+
const highlightedHtml = computed(() => {
|
|
102
|
+
if (!testText.value) return "";
|
|
103
|
+
if (!matches.value.length) return escapeHtml(testText.value);
|
|
104
|
+
const text = testText.value;
|
|
105
|
+
const intervals = matches.value.map((m, i) => ({
|
|
106
|
+
start: m.index,
|
|
107
|
+
end: m.index + m.text.length,
|
|
108
|
+
colorIdx: i % highlightColors.length,
|
|
109
|
+
matchIdx: i
|
|
110
|
+
}));
|
|
111
|
+
let result = "";
|
|
112
|
+
let cursor = 0;
|
|
113
|
+
for (const iv of intervals) {
|
|
114
|
+
if (iv.start > cursor) {
|
|
115
|
+
result += escapeHtml(text.slice(cursor, iv.start));
|
|
116
|
+
}
|
|
117
|
+
const c = highlightColors[iv.colorIdx];
|
|
118
|
+
result += `<mark style="background:${c.bg};border-bottom:2px solid ${c.border};border-radius:2px;padding:0 1px;color:inherit;" title="匹配 #${iv.matchIdx + 1}">${escapeHtml(text.slice(iv.start, iv.end))}</mark>`;
|
|
119
|
+
cursor = iv.end;
|
|
120
|
+
}
|
|
121
|
+
if (cursor < text.length) {
|
|
122
|
+
result += escapeHtml(text.slice(cursor));
|
|
123
|
+
}
|
|
124
|
+
return result;
|
|
125
|
+
});
|
|
126
|
+
function escapeHtml(s) {
|
|
127
|
+
return s.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/\n/g, "<br/>");
|
|
128
|
+
}
|
|
129
|
+
function loadSample() {
|
|
130
|
+
pattern.value = "(\\d{4})-(\\d{2})-(\\d{2})";
|
|
131
|
+
flags.value = "g";
|
|
132
|
+
testText.value = "今天是 2026-02-13,昨天是 2026-02-12。\n会议时间:2026-03-01 下午两点。\n无效日期:abcd-ef-gh";
|
|
133
|
+
}
|
|
134
|
+
function handleClear() {
|
|
135
|
+
pattern.value = "";
|
|
136
|
+
flags.value = "g";
|
|
137
|
+
testText.value = "";
|
|
138
|
+
errorMsg.value = "";
|
|
139
|
+
}
|
|
140
|
+
return (_ctx, _cache) => {
|
|
141
|
+
return openBlock(), createElementBlock("div", _hoisted_1, [
|
|
142
|
+
createCommentVNode(" Toolbar "),
|
|
143
|
+
createElementVNode("div", { class: "flex flex-wrap items-center gap-3" }, [
|
|
144
|
+
createElementVNode("button", {
|
|
145
|
+
class: "h-9 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 flex items-center gap-1.5 text-sm",
|
|
146
|
+
onClick: loadSample
|
|
147
|
+
}, [..._cache[2] || (_cache[2] = [
|
|
148
|
+
createElementVNode(
|
|
149
|
+
"span",
|
|
150
|
+
{ class: "material-icons text-lg" },
|
|
151
|
+
"science",
|
|
152
|
+
-1
|
|
153
|
+
/* CACHED */
|
|
154
|
+
),
|
|
155
|
+
createTextVNode(
|
|
156
|
+
" 示例 ",
|
|
157
|
+
-1
|
|
158
|
+
/* CACHED */
|
|
159
|
+
)
|
|
160
|
+
])]),
|
|
161
|
+
createElementVNode("button", {
|
|
162
|
+
class: "h-9 px-4 bg-coral-red text-white 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 flex items-center gap-1.5 text-sm",
|
|
163
|
+
onClick: handleClear
|
|
164
|
+
}, [..._cache[3] || (_cache[3] = [
|
|
165
|
+
createElementVNode(
|
|
166
|
+
"span",
|
|
167
|
+
{ class: "material-icons text-lg" },
|
|
168
|
+
"delete_outline",
|
|
169
|
+
-1
|
|
170
|
+
/* CACHED */
|
|
171
|
+
),
|
|
172
|
+
createTextVNode(
|
|
173
|
+
" 清空 ",
|
|
174
|
+
-1
|
|
175
|
+
/* CACHED */
|
|
176
|
+
)
|
|
177
|
+
])])
|
|
178
|
+
]),
|
|
179
|
+
createCommentVNode(" Regex input row "),
|
|
180
|
+
createElementVNode("div", _hoisted_2, [
|
|
181
|
+
createElementVNode("div", _hoisted_3, [
|
|
182
|
+
_cache[4] || (_cache[4] = createElementVNode(
|
|
183
|
+
"span",
|
|
184
|
+
{ class: "text-primary font-mono text-lg" },
|
|
185
|
+
"/",
|
|
186
|
+
-1
|
|
187
|
+
/* CACHED */
|
|
188
|
+
)),
|
|
189
|
+
withDirectives(createElementVNode(
|
|
190
|
+
"input",
|
|
191
|
+
{
|
|
192
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => pattern.value = $event),
|
|
193
|
+
placeholder: "输入正则表达式...",
|
|
194
|
+
spellcheck: "false",
|
|
195
|
+
class: "flex-1 h-10 bg-deep-charcoal text-gray-100 border-2 border-black rounded px-3 font-mono text-sm shadow-hard-sm focus:border-primary focus:shadow-none transition-all outline-none placeholder-gray-600"
|
|
196
|
+
},
|
|
197
|
+
null,
|
|
198
|
+
512
|
|
199
|
+
/* NEED_PATCH */
|
|
200
|
+
), [
|
|
201
|
+
[vModelText, pattern.value]
|
|
202
|
+
]),
|
|
203
|
+
_cache[5] || (_cache[5] = createElementVNode(
|
|
204
|
+
"span",
|
|
205
|
+
{ class: "text-primary font-mono text-lg" },
|
|
206
|
+
"/",
|
|
207
|
+
-1
|
|
208
|
+
/* CACHED */
|
|
209
|
+
))
|
|
210
|
+
]),
|
|
211
|
+
createElementVNode("div", _hoisted_4, [
|
|
212
|
+
(openBlock(), createElementBlock(
|
|
213
|
+
Fragment,
|
|
214
|
+
null,
|
|
215
|
+
renderList(flagOptions, (f) => {
|
|
216
|
+
return createElementVNode("button", {
|
|
217
|
+
key: f.label,
|
|
218
|
+
title: f.title,
|
|
219
|
+
class: normalizeClass(["w-8 h-8 font-mono font-bold text-sm border-2 border-black rounded transition-all", flags.value.includes(f.label) ? "bg-primary text-black shadow-hard-sm" : "bg-deep-charcoal text-gray-500 hover:text-gray-300"]),
|
|
220
|
+
onClick: ($event) => toggleFlag(f.label)
|
|
221
|
+
}, toDisplayString(f.label), 11, _hoisted_5);
|
|
222
|
+
}),
|
|
223
|
+
64
|
|
224
|
+
/* STABLE_FRAGMENT */
|
|
225
|
+
))
|
|
226
|
+
])
|
|
227
|
+
]),
|
|
228
|
+
createCommentVNode(" Error bar "),
|
|
229
|
+
errorMsg.value ? (openBlock(), createElementBlock("div", _hoisted_6, [
|
|
230
|
+
_cache[6] || (_cache[6] = createElementVNode(
|
|
231
|
+
"span",
|
|
232
|
+
{ class: "material-icons text-lg" },
|
|
233
|
+
"error_outline",
|
|
234
|
+
-1
|
|
235
|
+
/* CACHED */
|
|
236
|
+
)),
|
|
237
|
+
createTextVNode(
|
|
238
|
+
" " + toDisplayString(errorMsg.value),
|
|
239
|
+
1
|
|
240
|
+
/* TEXT */
|
|
241
|
+
)
|
|
242
|
+
])) : createCommentVNode("v-if", true),
|
|
243
|
+
createCommentVNode(" Main panels "),
|
|
244
|
+
createElementVNode("div", _hoisted_7, [
|
|
245
|
+
createCommentVNode(" Test text input "),
|
|
246
|
+
createElementVNode("div", _hoisted_8, [
|
|
247
|
+
_cache[7] || (_cache[7] = createElementVNode(
|
|
248
|
+
"div",
|
|
249
|
+
{ class: "flex items-center gap-2 mb-2" },
|
|
250
|
+
[
|
|
251
|
+
createElementVNode("span", { class: "material-icons text-primary text-lg" }, "edit_note"),
|
|
252
|
+
createElementVNode("span", { class: "text-sm font-bold text-gray-400 uppercase tracking-wider" }, "测试文本")
|
|
253
|
+
],
|
|
254
|
+
-1
|
|
255
|
+
/* CACHED */
|
|
256
|
+
)),
|
|
257
|
+
withDirectives(createElementVNode(
|
|
258
|
+
"textarea",
|
|
259
|
+
{
|
|
260
|
+
"onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => testText.value = $event),
|
|
261
|
+
placeholder: "在此输入要测试的文本...",
|
|
262
|
+
spellcheck: "false",
|
|
263
|
+
class: "flex-1 w-full bg-deep-charcoal text-gray-100 border-4 border-black rounded-xl p-4 font-mono text-sm leading-relaxed resize-none shadow-hard focus:border-primary focus:shadow-none focus:translate-x-[4px] focus:translate-y-[4px] transition-all outline-none placeholder-gray-600 min-h-[180px]"
|
|
264
|
+
},
|
|
265
|
+
null,
|
|
266
|
+
512
|
|
267
|
+
/* NEED_PATCH */
|
|
268
|
+
), [
|
|
269
|
+
[vModelText, testText.value]
|
|
270
|
+
])
|
|
271
|
+
]),
|
|
272
|
+
createCommentVNode(" Highlighted result "),
|
|
273
|
+
createElementVNode("div", _hoisted_9, [
|
|
274
|
+
createElementVNode("div", _hoisted_10, [
|
|
275
|
+
_cache[8] || (_cache[8] = createElementVNode(
|
|
276
|
+
"span",
|
|
277
|
+
{ class: "material-icons text-neon-green text-lg" },
|
|
278
|
+
"highlight",
|
|
279
|
+
-1
|
|
280
|
+
/* CACHED */
|
|
281
|
+
)),
|
|
282
|
+
_cache[9] || (_cache[9] = createElementVNode(
|
|
283
|
+
"span",
|
|
284
|
+
{ class: "text-sm font-bold text-gray-400 uppercase tracking-wider" },
|
|
285
|
+
"匹配可视化",
|
|
286
|
+
-1
|
|
287
|
+
/* CACHED */
|
|
288
|
+
)),
|
|
289
|
+
matches.value.length ? (openBlock(), createElementBlock(
|
|
290
|
+
"span",
|
|
291
|
+
_hoisted_11,
|
|
292
|
+
toDisplayString(matches.value.length) + " 个匹配 ",
|
|
293
|
+
1
|
|
294
|
+
/* TEXT */
|
|
295
|
+
)) : createCommentVNode("v-if", true)
|
|
296
|
+
]),
|
|
297
|
+
createElementVNode("div", {
|
|
298
|
+
class: "flex-1 w-full bg-deep-charcoal border-4 border-black rounded-xl p-4 overflow-auto shadow-hard min-h-[180px] font-mono text-sm leading-relaxed text-gray-100 whitespace-pre-wrap break-all",
|
|
299
|
+
innerHTML: highlightedHtml.value || "<span class='text-gray-600'>匹配结果将高亮显示在这里...</span>"
|
|
300
|
+
}, null, 8, _hoisted_12)
|
|
301
|
+
])
|
|
302
|
+
]),
|
|
303
|
+
createCommentVNode(" Match details "),
|
|
304
|
+
matches.value.length ? (openBlock(), createElementBlock("div", _hoisted_13, [
|
|
305
|
+
_cache[10] || (_cache[10] = createElementVNode(
|
|
306
|
+
"div",
|
|
307
|
+
{ class: "flex items-center gap-2 mb-2" },
|
|
308
|
+
[
|
|
309
|
+
createElementVNode("span", { class: "material-icons text-electric-blue text-lg" }, "list_alt"),
|
|
310
|
+
createElementVNode("span", { class: "text-sm font-bold text-gray-400 uppercase tracking-wider" }, "匹配详情")
|
|
311
|
+
],
|
|
312
|
+
-1
|
|
313
|
+
/* CACHED */
|
|
314
|
+
)),
|
|
315
|
+
createElementVNode("div", _hoisted_14, [
|
|
316
|
+
(openBlock(true), createElementBlock(
|
|
317
|
+
Fragment,
|
|
318
|
+
null,
|
|
319
|
+
renderList(matches.value, (m, i) => {
|
|
320
|
+
return openBlock(), createElementBlock("div", {
|
|
321
|
+
key: i,
|
|
322
|
+
class: "bg-deep-charcoal border-2 border-black rounded-lg p-3 shadow-hard-sm"
|
|
323
|
+
}, [
|
|
324
|
+
createElementVNode("div", _hoisted_15, [
|
|
325
|
+
createElementVNode(
|
|
326
|
+
"span",
|
|
327
|
+
{
|
|
328
|
+
class: "inline-block w-3 h-3 rounded-sm border border-black",
|
|
329
|
+
style: normalizeStyle({ background: highlightColors[i % highlightColors.length].border })
|
|
330
|
+
},
|
|
331
|
+
null,
|
|
332
|
+
4
|
|
333
|
+
/* STYLE */
|
|
334
|
+
),
|
|
335
|
+
createElementVNode(
|
|
336
|
+
"span",
|
|
337
|
+
_hoisted_16,
|
|
338
|
+
"匹配 #" + toDisplayString(i + 1),
|
|
339
|
+
1
|
|
340
|
+
/* TEXT */
|
|
341
|
+
),
|
|
342
|
+
createElementVNode(
|
|
343
|
+
"span",
|
|
344
|
+
_hoisted_17,
|
|
345
|
+
"索引: " + toDisplayString(m.index),
|
|
346
|
+
1
|
|
347
|
+
/* TEXT */
|
|
348
|
+
)
|
|
349
|
+
]),
|
|
350
|
+
createElementVNode(
|
|
351
|
+
"div",
|
|
352
|
+
_hoisted_18,
|
|
353
|
+
' "' + toDisplayString(m.text) + '" ',
|
|
354
|
+
1
|
|
355
|
+
/* TEXT */
|
|
356
|
+
),
|
|
357
|
+
m.groups.length ? (openBlock(), createElementBlock("div", _hoisted_19, [
|
|
358
|
+
(openBlock(true), createElementBlock(
|
|
359
|
+
Fragment,
|
|
360
|
+
null,
|
|
361
|
+
renderList(m.groups, (g, gi) => {
|
|
362
|
+
return openBlock(), createElementBlock("span", {
|
|
363
|
+
key: gi,
|
|
364
|
+
class: "mr-2"
|
|
365
|
+
}, [
|
|
366
|
+
createTextVNode(
|
|
367
|
+
" $" + toDisplayString(gi + 1) + "=",
|
|
368
|
+
1
|
|
369
|
+
/* TEXT */
|
|
370
|
+
),
|
|
371
|
+
createElementVNode(
|
|
372
|
+
"span",
|
|
373
|
+
_hoisted_20,
|
|
374
|
+
'"' + toDisplayString(g) + '"',
|
|
375
|
+
1
|
|
376
|
+
/* TEXT */
|
|
377
|
+
)
|
|
378
|
+
]);
|
|
379
|
+
}),
|
|
380
|
+
128
|
|
381
|
+
/* KEYED_FRAGMENT */
|
|
382
|
+
))
|
|
383
|
+
])) : createCommentVNode("v-if", true),
|
|
384
|
+
m.namedGroups ? (openBlock(), createElementBlock("div", _hoisted_21, [
|
|
385
|
+
(openBlock(true), createElementBlock(
|
|
386
|
+
Fragment,
|
|
387
|
+
null,
|
|
388
|
+
renderList(m.namedGroups, (v, k) => {
|
|
389
|
+
return openBlock(), createElementBlock("span", {
|
|
390
|
+
key: k,
|
|
391
|
+
class: "mr-2"
|
|
392
|
+
}, [
|
|
393
|
+
createTextVNode(
|
|
394
|
+
toDisplayString(k) + "=",
|
|
395
|
+
1
|
|
396
|
+
/* TEXT */
|
|
397
|
+
),
|
|
398
|
+
createElementVNode(
|
|
399
|
+
"span",
|
|
400
|
+
_hoisted_22,
|
|
401
|
+
'"' + toDisplayString(v) + '"',
|
|
402
|
+
1
|
|
403
|
+
/* TEXT */
|
|
404
|
+
)
|
|
405
|
+
]);
|
|
406
|
+
}),
|
|
407
|
+
128
|
|
408
|
+
/* KEYED_FRAGMENT */
|
|
409
|
+
))
|
|
410
|
+
])) : createCommentVNode("v-if", true)
|
|
411
|
+
]);
|
|
412
|
+
}),
|
|
413
|
+
128
|
|
414
|
+
/* KEYED_FRAGMENT */
|
|
415
|
+
))
|
|
416
|
+
])
|
|
417
|
+
])) : createCommentVNode("v-if", true)
|
|
418
|
+
]);
|
|
419
|
+
};
|
|
420
|
+
}
|
|
421
|
+
});
|
|
422
|
+
export {
|
|
423
|
+
_sfc_main as default
|
|
424
|
+
};
|