vite-uni-dev-tool 0.0.13 → 0.0.15
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/core.js +1 -1
- package/dist/devIntercept/index.d.ts +3 -3
- package/dist/devIntercept/index.d.ts.map +1 -1
- package/dist/devIntercept/index.js +117 -114
- package/dist/plugins/uniDevTool/transform/transformApp.d.ts +32 -0
- package/dist/plugins/uniDevTool/transform/transformApp.d.ts.map +1 -0
- package/dist/plugins/uniDevTool/transform/transformApp.js +32 -0
- package/dist/plugins/uniDevTool/transform/transformMain.d.ts +26 -0
- package/dist/plugins/uniDevTool/transform/transformMain.d.ts.map +1 -0
- package/dist/plugins/uniDevTool/transform/transformMain.js +3 -0
- package/dist/plugins/uniDevTool/transform/transformVue.d.ts +41 -0
- package/dist/plugins/uniDevTool/transform/transformVue.d.ts.map +1 -0
- package/dist/plugins/uniDevTool/transform/transformVue.js +9 -0
- package/dist/plugins/uniDevTool/uniDevTool.d.ts +7 -3
- package/dist/plugins/uniDevTool/uniDevTool.d.ts.map +1 -1
- package/dist/plugins/uniDevTool/uniDevTool.js +3 -33
- package/dist/plugins/utils/index.d.ts +32 -0
- package/dist/plugins/utils/index.d.ts.map +1 -1
- package/dist/plugins/utils/index.js +1 -1
- package/dist/type.d.ts +2 -2
- package/dist/type.d.ts.map +1 -1
- package/dist/v2/AppInfo/index.vue +41 -0
- package/dist/v2/AutoSizer/index.vue +189 -0
- package/dist/v2/AutoSizer/index1.vue +193 -0
- package/dist/v2/AutoSizer/utils.ts +49 -0
- package/dist/v2/CaptureScreen/index.vue +78 -0
- package/dist/v2/CloseButton/index.vue +32 -0
- package/dist/v2/Connection/index.vue +94 -0
- package/dist/v2/ConsoleList/ConsoleItem.vue +235 -0
- package/dist/v2/ConsoleList/RunJSInput.vue +243 -0
- package/dist/v2/ConsoleList/index.vue +164 -0
- package/dist/v2/ConsoleList/staticTips.js +1144 -0
- package/dist/v2/DevTool/index.vue +162 -0
- package/dist/v2/DevToolButton/index.vue +228 -0
- package/dist/v2/DevToolTitle/index.vue +28 -0
- package/dist/v2/DevToolWindow/index.vue +1051 -0
- package/dist/v2/DeviceInfo/index.vue +48 -0
- package/dist/v2/Empty/empty.png +0 -0
- package/dist/v2/Empty/index.vue +40 -0
- package/dist/v2/FilterInput/index.vue +100 -0
- package/dist/v2/JsonPretty/components/Brackets/index.vue +30 -0
- package/dist/v2/JsonPretty/components/Carets/index.vue +65 -0
- package/dist/v2/JsonPretty/components/CheckController/index.vue +127 -0
- package/dist/v2/JsonPretty/components/TreeNode/index.vue +417 -0
- package/dist/v2/JsonPretty/hooks/useClipboard.ts +21 -0
- package/dist/v2/JsonPretty/hooks/useError.ts +21 -0
- package/dist/v2/JsonPretty/index.vue +531 -0
- package/dist/v2/JsonPretty/type.ts +125 -0
- package/dist/v2/JsonPretty/utils/index.js +211 -0
- package/dist/v2/NetworkList/NetworkDetail.vue +215 -0
- package/dist/v2/NetworkList/NetworkItem.vue +135 -0
- package/dist/v2/NetworkList/index.vue +148 -0
- package/dist/v2/PiniaList/index.vue +79 -0
- package/dist/v2/RouteList/index.vue +137 -0
- package/dist/v2/RunJS/index.vue +128 -0
- package/dist/v2/SettingList/index.vue +318 -0
- package/dist/v2/SourceCode/index.vue +237 -0
- package/dist/v2/StorageList/index.vue +165 -0
- package/dist/v2/SystemInfo/index.vue +49 -0
- package/dist/v2/Tabs/index.vue +127 -0
- package/dist/v2/Tag/index.vue +91 -0
- package/dist/v2/UniEvent/UniEventItem.vue +157 -0
- package/dist/v2/UniEvent/index.vue +127 -0
- package/dist/v2/UploadList/UploadDetail.vue +204 -0
- package/dist/v2/UploadList/UploadItem.vue +134 -0
- package/dist/v2/UploadList/index.vue +143 -0
- package/dist/v2/VirtualList/index.vue +140 -0
- package/dist/v2/VirtualListPro/AutoSize.vue +50 -0
- package/dist/v2/VirtualListPro/index.vue +255 -0
- package/dist/v2/VirtualListPro/readme.md +40 -0
- package/dist/v2/VuexList/index.vue +80 -0
- package/dist/v2/WebSocket/WebSocketItem.vue +129 -0
- package/dist/v2/WebSocket/WebSocketList.vue +183 -0
- package/dist/v2/WebSocket/index.vue +155 -0
- package/dist/v2/WindowInfo/index.vue +49 -0
- package/dist/v3/AppInfo/index.vue +35 -0
- package/dist/v3/AutoSizer/index.vue +193 -0
- package/dist/v3/AutoSizer/index1.vue +186 -0
- package/dist/v3/AutoSizer/utils.ts +49 -0
- package/dist/v3/CaptureScreen/index.vue +62 -0
- package/dist/v3/CloseButton/index.vue +29 -0
- package/dist/v3/Connection/index.vue +88 -0
- package/dist/v3/ConsoleList/ConsoleItem.vue +208 -0
- package/dist/v3/ConsoleList/RunJSInput.vue +240 -0
- package/dist/v3/ConsoleList/index.vue +139 -0
- package/dist/v3/ConsoleList/staticTips.ts +1145 -0
- package/dist/v3/DevTool/index.vue +217 -0
- package/dist/v3/DevToolButton/index.vue +210 -0
- package/dist/v3/DevToolTitle/index.vue +21 -0
- package/dist/v3/DevToolWindow/index.vue +1116 -0
- package/dist/v3/DeviceInfo/index.vue +32 -0
- package/dist/v3/Empty/empty.png +0 -0
- package/dist/v3/Empty/index.vue +28 -0
- package/dist/v3/FilterInput/index.vue +87 -0
- package/dist/v3/JsonPretty/components/Brackets/index.vue +23 -0
- package/dist/v3/JsonPretty/components/Carets/index.vue +59 -0
- package/dist/v3/JsonPretty/components/CheckController/index.vue +125 -0
- package/dist/v3/JsonPretty/components/TreeNode/index.vue +349 -0
- package/dist/v3/JsonPretty/hooks/useClipboard.ts +21 -0
- package/dist/v3/JsonPretty/hooks/useError.ts +21 -0
- package/dist/v3/JsonPretty/index.vue +476 -0
- package/dist/v3/JsonPretty/type.ts +125 -0
- package/dist/v3/JsonPretty/utils/index.ts +172 -0
- package/dist/v3/NetworkList/NetworkDetail.vue +194 -0
- package/dist/v3/NetworkList/NetworkItem.vue +120 -0
- package/dist/v3/NetworkList/index.vue +128 -0
- package/dist/v3/PiniaList/index.vue +64 -0
- package/dist/v3/RouteList/index.vue +121 -0
- package/dist/v3/RunJS/index.vue +128 -0
- package/dist/v3/SettingList/index.vue +313 -0
- package/dist/v3/SourceCode/index.vue +231 -0
- package/dist/v3/StorageList/index.vue +170 -0
- package/dist/v3/SystemInfo/index.vue +34 -0
- package/dist/v3/Tabs/index.vue +123 -0
- package/dist/v3/Tag/index.vue +89 -0
- package/dist/v3/UniEvent/UniEventItem.vue +126 -0
- package/dist/v3/UniEvent/index.vue +98 -0
- package/dist/v3/UploadList/UploadDetail.vue +192 -0
- package/dist/v3/UploadList/UploadItem.vue +117 -0
- package/dist/v3/UploadList/index.vue +117 -0
- package/dist/v3/VirtualList/index.vue +112 -0
- package/dist/v3/VirtualListPro/AutoSize.vue +43 -0
- package/dist/v3/VirtualListPro/index.vue +238 -0
- package/dist/v3/VirtualListPro/readme.md +40 -0
- package/dist/v3/VuexList/index.vue +54 -0
- package/dist/v3/WebSocket/WebSocketItem.vue +103 -0
- package/dist/v3/WebSocket/WebSocketList.vue +161 -0
- package/dist/v3/WebSocket/index.vue +124 -0
- package/dist/v3/WindowInfo/index.vue +33 -0
- package/package.json +1 -1
|
@@ -0,0 +1,417 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view
|
|
3
|
+
:class="{
|
|
4
|
+
'json-pretty-tree-node': true,
|
|
5
|
+
'has-selector': showSelectController,
|
|
6
|
+
'has-carets': showIcon,
|
|
7
|
+
'is-highlight': highlightSelectedNode && checked,
|
|
8
|
+
'json-pretty-tree-node-active': state.editing,
|
|
9
|
+
dark: theme === 'dark',
|
|
10
|
+
}"
|
|
11
|
+
@click="handleNodeClick"
|
|
12
|
+
@mouseover="handleNodeMouseover"
|
|
13
|
+
:style="style"
|
|
14
|
+
>
|
|
15
|
+
<view v-if="showLineNumber" class="json-pretty-node-index">
|
|
16
|
+
{{ node.id + 1 }}
|
|
17
|
+
</view>
|
|
18
|
+
|
|
19
|
+
<CheckController
|
|
20
|
+
v-if="
|
|
21
|
+
showSelectController &&
|
|
22
|
+
selectable &&
|
|
23
|
+
node.type !== 'objectEnd' &&
|
|
24
|
+
node.type !== 'arrayEnd'
|
|
25
|
+
"
|
|
26
|
+
:isMultiple="isMultiple"
|
|
27
|
+
:checked="checked"
|
|
28
|
+
@change="handleSelectedChange"
|
|
29
|
+
/>
|
|
30
|
+
|
|
31
|
+
<view class="json-pretty-indent">
|
|
32
|
+
<view
|
|
33
|
+
v-for="(item, index) in Array(node.level)"
|
|
34
|
+
:key="index"
|
|
35
|
+
:class="{
|
|
36
|
+
'json-pretty-indent-unit': true,
|
|
37
|
+
'has-line': showLine,
|
|
38
|
+
}"
|
|
39
|
+
>
|
|
40
|
+
<view v-for="() in Array(indent)" :key="Math.random()"> </view>
|
|
41
|
+
</view>
|
|
42
|
+
<Carets v-if="showIcon" :nodeType="node.type" @click="handleIconClick" />
|
|
43
|
+
</view>
|
|
44
|
+
|
|
45
|
+
<view v-if="node.key" class="json-pretty-key">
|
|
46
|
+
<slot name="render-node-key" :node="node" :default-key="prettyKey">
|
|
47
|
+
{{ prettyKey }}
|
|
48
|
+
</slot>
|
|
49
|
+
<view class="json-pretty-colon">
|
|
50
|
+
{{ `:${showKeyValueSpace ? ' ' : ''}` }}
|
|
51
|
+
</view>
|
|
52
|
+
</view>
|
|
53
|
+
|
|
54
|
+
<view class="json-pretty-value-wrapper">
|
|
55
|
+
<Brackets
|
|
56
|
+
v-if="node.type !== 'content' && node.content"
|
|
57
|
+
:data="node.content.toString()"
|
|
58
|
+
@click="handleBracketsClick"
|
|
59
|
+
/>
|
|
60
|
+
|
|
61
|
+
<view v-else :class="valueClass" @click="handleValueEdit">
|
|
62
|
+
<input
|
|
63
|
+
v-if="editable && state.editing"
|
|
64
|
+
class="json-pretty-edit-input"
|
|
65
|
+
:value="defaultValue"
|
|
66
|
+
:focus="state.editing"
|
|
67
|
+
@blur="handleInputBlur"
|
|
68
|
+
/>
|
|
69
|
+
<view v-else>
|
|
70
|
+
<slot
|
|
71
|
+
name="render-node-value"
|
|
72
|
+
:node="node"
|
|
73
|
+
:default-value="defaultValue"
|
|
74
|
+
>
|
|
75
|
+
{{ defaultValue }}
|
|
76
|
+
</slot>
|
|
77
|
+
<text v-if="node.showComma">,</text>
|
|
78
|
+
</view>
|
|
79
|
+
</view>
|
|
80
|
+
|
|
81
|
+
<view v-if="showLength && collapsed" class="json-pretty-comment">
|
|
82
|
+
// {{ node.length }} items
|
|
83
|
+
</view>
|
|
84
|
+
</view>
|
|
85
|
+
<view class="json-pretty-tree-node-actions" v-if="showNodeActions">
|
|
86
|
+
<slot name="render-node-actions" :copy="handleCopy">
|
|
87
|
+
<view @click="handleCopy" class="json-pretty-tree-node-actions-item">
|
|
88
|
+
copy
|
|
89
|
+
</view>
|
|
90
|
+
</slot>
|
|
91
|
+
</view>
|
|
92
|
+
</view>
|
|
93
|
+
</template>
|
|
94
|
+
|
|
95
|
+
<script>
|
|
96
|
+
import { getDataType, isFunction, stringToAutoType } from '../../utils';
|
|
97
|
+
import { getValueByPath } from '../../../../utils';
|
|
98
|
+
import Brackets from '../Brackets/index.vue';
|
|
99
|
+
import CheckController from '../CheckController/index.vue';
|
|
100
|
+
import Carets from '../Carets/index.vue';
|
|
101
|
+
|
|
102
|
+
export default {
|
|
103
|
+
components: {
|
|
104
|
+
Brackets,
|
|
105
|
+
CheckController,
|
|
106
|
+
Carets,
|
|
107
|
+
},
|
|
108
|
+
props: {
|
|
109
|
+
node: {
|
|
110
|
+
type: Object,
|
|
111
|
+
required: true,
|
|
112
|
+
},
|
|
113
|
+
rootPath: {
|
|
114
|
+
type: String,
|
|
115
|
+
default: 'root',
|
|
116
|
+
},
|
|
117
|
+
indent: {
|
|
118
|
+
type: Number,
|
|
119
|
+
default: 2,
|
|
120
|
+
},
|
|
121
|
+
showDoubleQuotes: {
|
|
122
|
+
type: Boolean,
|
|
123
|
+
default: true,
|
|
124
|
+
},
|
|
125
|
+
showLine: {
|
|
126
|
+
type: Boolean,
|
|
127
|
+
default: true,
|
|
128
|
+
},
|
|
129
|
+
selectOnClickNode: {
|
|
130
|
+
type: Boolean,
|
|
131
|
+
default: true,
|
|
132
|
+
},
|
|
133
|
+
highlightSelectedNode: {
|
|
134
|
+
type: Boolean,
|
|
135
|
+
default: true,
|
|
136
|
+
},
|
|
137
|
+
theme: {
|
|
138
|
+
type: String,
|
|
139
|
+
default: 'light',
|
|
140
|
+
},
|
|
141
|
+
showKeyValueSpace: {
|
|
142
|
+
type: Boolean,
|
|
143
|
+
default: true,
|
|
144
|
+
},
|
|
145
|
+
editableTrigger: {
|
|
146
|
+
type: String,
|
|
147
|
+
default: 'click',
|
|
148
|
+
},
|
|
149
|
+
checked: {
|
|
150
|
+
type: Boolean,
|
|
151
|
+
default: false,
|
|
152
|
+
},
|
|
153
|
+
nodeSelectable: {
|
|
154
|
+
type: Function,
|
|
155
|
+
default: () => false,
|
|
156
|
+
},
|
|
157
|
+
selectableType: {
|
|
158
|
+
type: String,
|
|
159
|
+
default: 'multiple',
|
|
160
|
+
},
|
|
161
|
+
collapsed: {
|
|
162
|
+
type: Boolean,
|
|
163
|
+
default: false,
|
|
164
|
+
},
|
|
165
|
+
showSelectController: {
|
|
166
|
+
type: Boolean,
|
|
167
|
+
default: false,
|
|
168
|
+
},
|
|
169
|
+
showIcon: {
|
|
170
|
+
type: Boolean,
|
|
171
|
+
default: false,
|
|
172
|
+
},
|
|
173
|
+
showLineNumber: {
|
|
174
|
+
type: Boolean,
|
|
175
|
+
default: false,
|
|
176
|
+
},
|
|
177
|
+
showLength: {
|
|
178
|
+
type: Boolean,
|
|
179
|
+
default: false,
|
|
180
|
+
},
|
|
181
|
+
showNodeActions: {
|
|
182
|
+
type: Boolean,
|
|
183
|
+
default: false,
|
|
184
|
+
},
|
|
185
|
+
editable: {
|
|
186
|
+
type: Boolean,
|
|
187
|
+
default: false,
|
|
188
|
+
},
|
|
189
|
+
data: {
|
|
190
|
+
type: Object,
|
|
191
|
+
default: () => ({}),
|
|
192
|
+
},
|
|
193
|
+
style: {
|
|
194
|
+
type: Object,
|
|
195
|
+
default: () => ({}),
|
|
196
|
+
},
|
|
197
|
+
},
|
|
198
|
+
data() {
|
|
199
|
+
return {
|
|
200
|
+
state: {
|
|
201
|
+
editing: false,
|
|
202
|
+
},
|
|
203
|
+
};
|
|
204
|
+
},
|
|
205
|
+
computed: {
|
|
206
|
+
dataType() {
|
|
207
|
+
return getDataType(this.node.content);
|
|
208
|
+
},
|
|
209
|
+
valueClass() {
|
|
210
|
+
return `json-pretty-value json-pretty-value-${this.dataType}`;
|
|
211
|
+
},
|
|
212
|
+
prettyKey() {
|
|
213
|
+
return this.showDoubleQuotes ? `"${this.node.key}"` : this.node.key;
|
|
214
|
+
},
|
|
215
|
+
isMultiple() {
|
|
216
|
+
return this.selectableType === 'multiple';
|
|
217
|
+
},
|
|
218
|
+
isSingle() {
|
|
219
|
+
return this.selectableType === 'single';
|
|
220
|
+
},
|
|
221
|
+
selectable() {
|
|
222
|
+
return (
|
|
223
|
+
isFunction(this.nodeSelectable) &&
|
|
224
|
+
this.nodeSelectable(this.node) &&
|
|
225
|
+
(this.isMultiple || this.isSingle)
|
|
226
|
+
);
|
|
227
|
+
},
|
|
228
|
+
defaultValue() {
|
|
229
|
+
let value = this.node?.content;
|
|
230
|
+
if (value === null) {
|
|
231
|
+
value = 'null';
|
|
232
|
+
} else if (value === undefined) {
|
|
233
|
+
value = 'undefined';
|
|
234
|
+
}
|
|
235
|
+
return this.dataType === 'string' ? `"${value}"` : value?.toString();
|
|
236
|
+
},
|
|
237
|
+
},
|
|
238
|
+
methods: {
|
|
239
|
+
handleInputBlur(e) {
|
|
240
|
+
const source = e.detail.value;
|
|
241
|
+
const value = stringToAutoType(source);
|
|
242
|
+
this.$emit('valueChange', value, this.node.path);
|
|
243
|
+
this.state.editing = false;
|
|
244
|
+
},
|
|
245
|
+
handleBracketsClick() {
|
|
246
|
+
this.$emit('bracketsClick', !this.collapsed, this.node);
|
|
247
|
+
},
|
|
248
|
+
handleIconClick() {
|
|
249
|
+
this.$emit('iconClick', !this.collapsed, this.node);
|
|
250
|
+
},
|
|
251
|
+
handleSelectedChange() {
|
|
252
|
+
this.$emit('selectedChange', this.node);
|
|
253
|
+
},
|
|
254
|
+
handleNodeClick() {
|
|
255
|
+
this.$emit('nodeClick', this.node);
|
|
256
|
+
if (this.selectable && this.selectOnClickNode) {
|
|
257
|
+
this.$emit('selectedChange', this.node);
|
|
258
|
+
}
|
|
259
|
+
},
|
|
260
|
+
handleNodeMouseover() {
|
|
261
|
+
this.$emit('nodeMouseover', this.node);
|
|
262
|
+
},
|
|
263
|
+
handleValueEdit(e) {
|
|
264
|
+
if (!this.editable) return;
|
|
265
|
+
if (!this.state.editing) {
|
|
266
|
+
this.state.editing = true;
|
|
267
|
+
}
|
|
268
|
+
},
|
|
269
|
+
handleCopy() {
|
|
270
|
+
const { key, path } = this.node;
|
|
271
|
+
const rootPath = this.rootPath;
|
|
272
|
+
const content = getValueByPath(this.data, path.slice(rootPath.length));
|
|
273
|
+
const copiedData = JSON.stringify(
|
|
274
|
+
key ? { [key]: content } : content,
|
|
275
|
+
null,
|
|
276
|
+
2,
|
|
277
|
+
);
|
|
278
|
+
|
|
279
|
+
uni.setClipboardData({
|
|
280
|
+
data: copiedData,
|
|
281
|
+
success() {
|
|
282
|
+
uni.showToast({
|
|
283
|
+
title: '复制成功',
|
|
284
|
+
icon: 'none',
|
|
285
|
+
});
|
|
286
|
+
},
|
|
287
|
+
fail() {
|
|
288
|
+
uni.showToast({
|
|
289
|
+
title: '复制失败',
|
|
290
|
+
icon: 'none',
|
|
291
|
+
});
|
|
292
|
+
},
|
|
293
|
+
});
|
|
294
|
+
},
|
|
295
|
+
},
|
|
296
|
+
};
|
|
297
|
+
</script>
|
|
298
|
+
<style scoped>
|
|
299
|
+
.json-pretty-tree-node {
|
|
300
|
+
display: flex;
|
|
301
|
+
/* align-items: center; */
|
|
302
|
+
position: relative;
|
|
303
|
+
line-height: 20px;
|
|
304
|
+
}
|
|
305
|
+
.json-pretty-tree-node.has-carets {
|
|
306
|
+
padding-left: 15px;
|
|
307
|
+
}
|
|
308
|
+
.json-pretty-tree-node.has-selector,
|
|
309
|
+
.json-pretty-tree-node.has-carets.has-selector {
|
|
310
|
+
padding-left: 30px;
|
|
311
|
+
}
|
|
312
|
+
.json-pretty-tree-node.is-highlight,
|
|
313
|
+
.json-pretty-tree-node:hover {
|
|
314
|
+
background-color: var(--json-pretty-highlight-bg-color);
|
|
315
|
+
border-radius: 4px;
|
|
316
|
+
}
|
|
317
|
+
.json-pretty-tree-node.is-highlight .json-pretty-tree-node-actions,
|
|
318
|
+
.json-pretty-tree-node:hover .json-pretty-tree-node-actions {
|
|
319
|
+
display: block;
|
|
320
|
+
}
|
|
321
|
+
.json-pretty-tree-node .json-pretty-indent {
|
|
322
|
+
display: flex;
|
|
323
|
+
position: relative;
|
|
324
|
+
}
|
|
325
|
+
.json-pretty-tree-node .json-pretty-indent-unit {
|
|
326
|
+
display: flex;
|
|
327
|
+
}
|
|
328
|
+
.json-pretty-tree-node .json-pretty-indent-unit.has-line {
|
|
329
|
+
border-left: 1px dashed var(--json-pretty-border-color);
|
|
330
|
+
}
|
|
331
|
+
.json-pretty-tree-node .json-pretty-tree-node-actions {
|
|
332
|
+
display: none;
|
|
333
|
+
position: absolute;
|
|
334
|
+
right: 0;
|
|
335
|
+
top: 0;
|
|
336
|
+
padding: 0 4px;
|
|
337
|
+
background-color: var(--json-pretty-highlight-bg-color);
|
|
338
|
+
border-radius: 4px;
|
|
339
|
+
}
|
|
340
|
+
.json-pretty-tree-node
|
|
341
|
+
.json-pretty-tree-node-actions
|
|
342
|
+
.json-pretty-tree-node-actions-item {
|
|
343
|
+
cursor: pointer;
|
|
344
|
+
}
|
|
345
|
+
.json-pretty-tree-node
|
|
346
|
+
.json-pretty-tree-node-actions
|
|
347
|
+
.json-pretty-tree-node-actions-item:hover {
|
|
348
|
+
color: var(--json-pretty-color-primary);
|
|
349
|
+
}
|
|
350
|
+
.json-pretty-tree-node.dark.is-highlight,
|
|
351
|
+
.json-pretty-tree-node.dark:hover {
|
|
352
|
+
background-color: var(--json-pretty-highlight-bg-color-dark);
|
|
353
|
+
}
|
|
354
|
+
.json-pretty-tree-node.dark .json-pretty-tree-node-actions {
|
|
355
|
+
background-color: var(--json-pretty-highlight-bg-color-dark);
|
|
356
|
+
}
|
|
357
|
+
.json-pretty-tree-node-active {
|
|
358
|
+
background-color: var(--json-pretty-highlight-bg-color);
|
|
359
|
+
border-radius: 4px;
|
|
360
|
+
}
|
|
361
|
+
.json-pretty-tree-node-active .json-pretty-tree-node-actions {
|
|
362
|
+
display: block;
|
|
363
|
+
}
|
|
364
|
+
.json-pretty-node-index {
|
|
365
|
+
position: absolute;
|
|
366
|
+
right: 100%;
|
|
367
|
+
margin-right: 4px;
|
|
368
|
+
user-select: none;
|
|
369
|
+
}
|
|
370
|
+
.json-pretty-colon {
|
|
371
|
+
white-space: pre;
|
|
372
|
+
}
|
|
373
|
+
.json-pretty-comment {
|
|
374
|
+
color: var(--json-pretty-color-primary);
|
|
375
|
+
}
|
|
376
|
+
.json-pretty-key {
|
|
377
|
+
display: flex;
|
|
378
|
+
}
|
|
379
|
+
.json-pretty-value-wrapper {
|
|
380
|
+
display: flex;
|
|
381
|
+
align-items: center;
|
|
382
|
+
}
|
|
383
|
+
.json-pretty-value {
|
|
384
|
+
word-break: break-all;
|
|
385
|
+
white-space: normal;
|
|
386
|
+
/* white-space: pre-line; */
|
|
387
|
+
/* white-space: nowrap; */
|
|
388
|
+
}
|
|
389
|
+
.json-pretty-value-null {
|
|
390
|
+
color: var(--json-pretty-color-null);
|
|
391
|
+
}
|
|
392
|
+
.json-pretty-value-undefined {
|
|
393
|
+
color: var(--json-pretty-color-undefined);
|
|
394
|
+
}
|
|
395
|
+
.json-pretty-value-number {
|
|
396
|
+
color: var(--json-pretty-color-number);
|
|
397
|
+
}
|
|
398
|
+
.json-pretty-value-boolean {
|
|
399
|
+
color: var(--json-pretty-color-boolean);
|
|
400
|
+
}
|
|
401
|
+
.json-pretty-value-string {
|
|
402
|
+
color: var(--json-pretty-color-string);
|
|
403
|
+
}
|
|
404
|
+
.json-pretty-edit-input {
|
|
405
|
+
padding: 0px 8px;
|
|
406
|
+
border: 1px solid #eee;
|
|
407
|
+
box-shadow: none;
|
|
408
|
+
box-sizing: border-box;
|
|
409
|
+
border-radius: 5;
|
|
410
|
+
font-family: inherit;
|
|
411
|
+
color: #000;
|
|
412
|
+
font-weight: 400;
|
|
413
|
+
background-color: #fff;
|
|
414
|
+
font: unset;
|
|
415
|
+
height: 16px;
|
|
416
|
+
}
|
|
417
|
+
</style>
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { ref } from "vue";
|
|
2
|
+
|
|
3
|
+
export function useClipboard() {
|
|
4
|
+
const copied = ref(false);
|
|
5
|
+
|
|
6
|
+
const copy = async (source: string) => {
|
|
7
|
+
try {
|
|
8
|
+
await navigator.clipboard.writeText(source);
|
|
9
|
+
copied.value = true;
|
|
10
|
+
setTimeout(() => {
|
|
11
|
+
copied.value = false;
|
|
12
|
+
}, 300);
|
|
13
|
+
} catch (err) {
|
|
14
|
+
console.error("[json-pretty] Copy failed: ", err);
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
return {
|
|
19
|
+
copy
|
|
20
|
+
};
|
|
21
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { watchEffect } from "vue";
|
|
2
|
+
|
|
3
|
+
type UseErrorOptions = {
|
|
4
|
+
emitListener: boolean;
|
|
5
|
+
};
|
|
6
|
+
|
|
7
|
+
export function useError(message: string, { emitListener }: UseErrorOptions) {
|
|
8
|
+
const emit = () => {
|
|
9
|
+
throw new Error(`[VueJsonPretty] ${message}`);
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
watchEffect(() => {
|
|
13
|
+
if (emitListener) {
|
|
14
|
+
emit();
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
return {
|
|
19
|
+
emit
|
|
20
|
+
};
|
|
21
|
+
}
|