vite-uni-dev-tool 0.0.13 → 0.0.14

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.
Files changed (109) hide show
  1. package/dist/v2/AppInfo/index.vue +41 -0
  2. package/dist/v2/AutoSizer/index.vue +189 -0
  3. package/dist/v2/AutoSizer/index1.vue +193 -0
  4. package/dist/v2/AutoSizer/utils.ts +49 -0
  5. package/dist/v2/CaptureScreen/index.vue +78 -0
  6. package/dist/v2/CloseButton/index.vue +32 -0
  7. package/dist/v2/Connection/index.vue +94 -0
  8. package/dist/v2/ConsoleList/ConsoleItem.vue +235 -0
  9. package/dist/v2/ConsoleList/RunJSInput.vue +243 -0
  10. package/dist/v2/ConsoleList/index.vue +164 -0
  11. package/dist/v2/ConsoleList/staticTips.js +1144 -0
  12. package/dist/v2/DevTool/index.vue +162 -0
  13. package/dist/v2/DevToolButton/index.vue +228 -0
  14. package/dist/v2/DevToolTitle/index.vue +28 -0
  15. package/dist/v2/DevToolWindow/index.vue +1051 -0
  16. package/dist/v2/DeviceInfo/index.vue +48 -0
  17. package/dist/v2/Empty/empty.png +0 -0
  18. package/dist/v2/Empty/index.vue +40 -0
  19. package/dist/v2/FilterInput/index.vue +100 -0
  20. package/dist/v2/JsonPretty/components/Brackets/index.vue +30 -0
  21. package/dist/v2/JsonPretty/components/Carets/index.vue +65 -0
  22. package/dist/v2/JsonPretty/components/CheckController/index.vue +127 -0
  23. package/dist/v2/JsonPretty/components/TreeNode/index.vue +417 -0
  24. package/dist/v2/JsonPretty/hooks/useClipboard.ts +21 -0
  25. package/dist/v2/JsonPretty/hooks/useError.ts +21 -0
  26. package/dist/v2/JsonPretty/index.vue +531 -0
  27. package/dist/v2/JsonPretty/type.ts +125 -0
  28. package/dist/v2/JsonPretty/utils/index.js +211 -0
  29. package/dist/v2/NetworkList/NetworkDetail.vue +215 -0
  30. package/dist/v2/NetworkList/NetworkItem.vue +135 -0
  31. package/dist/v2/NetworkList/index.vue +148 -0
  32. package/dist/v2/PiniaList/index.vue +79 -0
  33. package/dist/v2/RouteList/index.vue +137 -0
  34. package/dist/v2/RunJS/index.vue +128 -0
  35. package/dist/v2/SettingList/index.vue +318 -0
  36. package/dist/v2/SourceCode/index.vue +237 -0
  37. package/dist/v2/StorageList/index.vue +165 -0
  38. package/dist/v2/SystemInfo/index.vue +49 -0
  39. package/dist/v2/Tabs/index.vue +127 -0
  40. package/dist/v2/Tag/index.vue +91 -0
  41. package/dist/v2/UniEvent/UniEventItem.vue +157 -0
  42. package/dist/v2/UniEvent/index.vue +127 -0
  43. package/dist/v2/UploadList/UploadDetail.vue +204 -0
  44. package/dist/v2/UploadList/UploadItem.vue +134 -0
  45. package/dist/v2/UploadList/index.vue +143 -0
  46. package/dist/v2/VirtualList/index.vue +140 -0
  47. package/dist/v2/VirtualListPro/AutoSize.vue +50 -0
  48. package/dist/v2/VirtualListPro/index.vue +255 -0
  49. package/dist/v2/VirtualListPro/readme.md +40 -0
  50. package/dist/v2/VuexList/index.vue +80 -0
  51. package/dist/v2/WebSocket/WebSocketItem.vue +129 -0
  52. package/dist/v2/WebSocket/WebSocketList.vue +183 -0
  53. package/dist/v2/WebSocket/index.vue +155 -0
  54. package/dist/v2/WindowInfo/index.vue +49 -0
  55. package/dist/v3/AppInfo/index.vue +35 -0
  56. package/dist/v3/AutoSizer/index.vue +193 -0
  57. package/dist/v3/AutoSizer/index1.vue +186 -0
  58. package/dist/v3/AutoSizer/utils.ts +49 -0
  59. package/dist/v3/CaptureScreen/index.vue +62 -0
  60. package/dist/v3/CloseButton/index.vue +29 -0
  61. package/dist/v3/Connection/index.vue +88 -0
  62. package/dist/v3/ConsoleList/ConsoleItem.vue +208 -0
  63. package/dist/v3/ConsoleList/RunJSInput.vue +240 -0
  64. package/dist/v3/ConsoleList/index.vue +139 -0
  65. package/dist/v3/ConsoleList/staticTips.ts +1145 -0
  66. package/dist/v3/DevTool/index.vue +217 -0
  67. package/dist/v3/DevToolButton/index.vue +210 -0
  68. package/dist/v3/DevToolTitle/index.vue +21 -0
  69. package/dist/v3/DevToolWindow/index.vue +1116 -0
  70. package/dist/v3/DeviceInfo/index.vue +32 -0
  71. package/dist/v3/Empty/empty.png +0 -0
  72. package/dist/v3/Empty/index.vue +28 -0
  73. package/dist/v3/FilterInput/index.vue +87 -0
  74. package/dist/v3/JsonPretty/components/Brackets/index.vue +23 -0
  75. package/dist/v3/JsonPretty/components/Carets/index.vue +59 -0
  76. package/dist/v3/JsonPretty/components/CheckController/index.vue +125 -0
  77. package/dist/v3/JsonPretty/components/TreeNode/index.vue +349 -0
  78. package/dist/v3/JsonPretty/hooks/useClipboard.ts +21 -0
  79. package/dist/v3/JsonPretty/hooks/useError.ts +21 -0
  80. package/dist/v3/JsonPretty/index.vue +476 -0
  81. package/dist/v3/JsonPretty/type.ts +125 -0
  82. package/dist/v3/JsonPretty/utils/index.ts +172 -0
  83. package/dist/v3/NetworkList/NetworkDetail.vue +194 -0
  84. package/dist/v3/NetworkList/NetworkItem.vue +120 -0
  85. package/dist/v3/NetworkList/index.vue +128 -0
  86. package/dist/v3/PiniaList/index.vue +64 -0
  87. package/dist/v3/RouteList/index.vue +121 -0
  88. package/dist/v3/RunJS/index.vue +128 -0
  89. package/dist/v3/SettingList/index.vue +313 -0
  90. package/dist/v3/SourceCode/index.vue +231 -0
  91. package/dist/v3/StorageList/index.vue +170 -0
  92. package/dist/v3/SystemInfo/index.vue +34 -0
  93. package/dist/v3/Tabs/index.vue +123 -0
  94. package/dist/v3/Tag/index.vue +89 -0
  95. package/dist/v3/UniEvent/UniEventItem.vue +126 -0
  96. package/dist/v3/UniEvent/index.vue +98 -0
  97. package/dist/v3/UploadList/UploadDetail.vue +192 -0
  98. package/dist/v3/UploadList/UploadItem.vue +117 -0
  99. package/dist/v3/UploadList/index.vue +117 -0
  100. package/dist/v3/VirtualList/index.vue +112 -0
  101. package/dist/v3/VirtualListPro/AutoSize.vue +43 -0
  102. package/dist/v3/VirtualListPro/index.vue +238 -0
  103. package/dist/v3/VirtualListPro/readme.md +40 -0
  104. package/dist/v3/VuexList/index.vue +54 -0
  105. package/dist/v3/WebSocket/WebSocketItem.vue +103 -0
  106. package/dist/v3/WebSocket/WebSocketList.vue +161 -0
  107. package/dist/v3/WebSocket/index.vue +124 -0
  108. package/dist/v3/WindowInfo/index.vue +33 -0
  109. package/package.json +1 -1
@@ -0,0 +1,129 @@
1
+ <template>
2
+ <view class="websocket-item">
3
+ <view class="websocket-url-row">
4
+ <Tag mode="info" v-if="ws.readyState === 'connection'">con</Tag>
5
+ <Tag mode="success" v-if="ws.readyState === 'open'">open</Tag>
6
+ <Tag
7
+ mode="warn"
8
+ v-if="ws.readyState === 'closing' || ws.readyState === 'closed'"
9
+ >
10
+ close
11
+ </Tag>
12
+
13
+ <Tag mode="error" v-if="ws.readyState === 'error'">error</Tag>
14
+
15
+ <view class="websocket-url" v-html="ws.url" />
16
+
17
+ <Tag
18
+ mode="main"
19
+ class="websocket-detail-icon"
20
+ @click="showDetail = !showDetail"
21
+ >
22
+ 详情
23
+ </Tag>
24
+ </view>
25
+ <view class="websocket-info">
26
+ <view class="websocket-info-last">
27
+ {{ ws?.message?.[ws.message.length - 1]?.data }}
28
+ </view>
29
+
30
+ <view>{{
31
+ ws?.message?.[ws.message.length - 1].time
32
+ ? formatDate(ws?.message?.[ws.message.length - 1].time, 'HH:mm:ss')
33
+ : '-'
34
+ }}</view>
35
+ </view>
36
+
37
+ <WebSocketList
38
+ v-if="showDetail"
39
+ :ws="ws"
40
+ :zIndex="zIndex"
41
+ @close="onClose"
42
+ />
43
+ </view>
44
+ </template>
45
+
46
+ <script>
47
+ import Tag from '../Tag/index.vue';
48
+ import WebSocketList from './WebSocketList.vue';
49
+ import { formatDate } from '../../utils';
50
+
51
+ export default {
52
+ components: {
53
+ Tag,
54
+ WebSocketList,
55
+ },
56
+ props: {
57
+ ws: {
58
+ type: Object,
59
+ required: true,
60
+ validator: (value) => {
61
+ // 验证必要字段存在
62
+ return ['readyState', 'url', 'message'].every((key) => key in value);
63
+ },
64
+ },
65
+ zIndex: {
66
+ type: Number,
67
+ default: 1000,
68
+ },
69
+ },
70
+ data() {
71
+ return {
72
+ showDetail: false, // 控制详情显示/隐藏
73
+ };
74
+ },
75
+ methods: {
76
+ // 关闭详情
77
+ onClose() {
78
+ this.showDetail = false;
79
+ },
80
+ // 引入日期格式化工具函数
81
+ formatDate,
82
+ },
83
+ };
84
+ </script>
85
+
86
+ <style scoped>
87
+ .websocket-item {
88
+ padding: 16px;
89
+
90
+ box-sizing: border-box;
91
+ border-bottom: 1px solid var(--dev-tool-border-color);
92
+ font-size: var(--dev-tool-base-font-size);
93
+ }
94
+ .websocket-item .websocket-url-row {
95
+ display: flex;
96
+ align-items: center;
97
+ word-break: break-all;
98
+ }
99
+
100
+ .websocket-item .websocket-url-row .websocket-url {
101
+ margin-left: 4px;
102
+ flex: 1;
103
+ white-space: nowrap;
104
+ overflow: hidden;
105
+ text-overflow: ellipsis;
106
+ }
107
+
108
+ .websocket-item .websocket-url-row .websocket-detail-icon {
109
+ flex-shrink: 0;
110
+ margin-left: auto;
111
+ }
112
+ .websocket-item .websocket-url-row .websocket-detail-active {
113
+ transform: rotate(135deg);
114
+ }
115
+ .websocket-item .websocket-info {
116
+ display: flex;
117
+ align-items: center;
118
+ justify-content: space-between;
119
+ margin-top: 4px;
120
+ color: var(--dev-tool-info-color);
121
+ }
122
+
123
+ .websocket-item .websocket-info .websocket-info-last {
124
+ white-space: nowrap;
125
+ flex: 1;
126
+ overflow: hidden;
127
+ text-overflow: ellipsis;
128
+ }
129
+ </style>
@@ -0,0 +1,183 @@
1
+ <template>
2
+ <view class="web-socket-list-container" :style="{ zIndex: zIndex }">
3
+ <view class="web-socket-top">
4
+ 请求url:
5
+
6
+ <CloseButton style="margin-left: auto" @click="onClose" />
7
+ </view>
8
+ <view class="web-socket-url">
9
+ {{ ws.url }}
10
+ </view>
11
+
12
+ <view class="web-socket-data">
13
+ <view class="web-socket-title"
14
+ >请求方式:<Tag mode="info"> {{ ws.method }} </Tag></view
15
+ >
16
+ <view class="web-socket-title">请求头:</view>
17
+ <view
18
+ class="header-detail-item"
19
+ v-for="item in ws.headers"
20
+ :key="item.key"
21
+ >
22
+ <view>{{ item.key }}: </view>
23
+ {{ item.value }}
24
+ </view>
25
+
26
+ <view class="web-socket-title">消息列表:</view>
27
+ <view class="web-socket-data-list">
28
+ <view
29
+ v-for="item in ws.message"
30
+ :key="item.time"
31
+ :class="`web-socket-data-item web-socket-data-item-${item.type}`"
32
+ @click="onClick(item)"
33
+ >
34
+ <view class="web-socket-data-time">
35
+ {{ formatDate(item.time, 'HH:mm:ss') }}
36
+ </view>
37
+ <view class="web-socket-data-content">
38
+ {{ item.data }}
39
+ </view>
40
+ </view>
41
+ </view>
42
+ </view>
43
+ </view>
44
+ </template>
45
+
46
+ <script>
47
+ import Tag from '../Tag/index.vue';
48
+ import CloseButton from '../CloseButton/index.vue';
49
+ import { formatDate } from '../../utils/index';
50
+
51
+ export default {
52
+ components: {
53
+ Tag,
54
+ CloseButton,
55
+ },
56
+ props: {
57
+ /** @type {{url:string; method:string; headers: {key:string; value:string}[]; message: { time:string; data:string }[] }} */
58
+ ws: {
59
+ type: Object,
60
+ required: true,
61
+ validator: (value) => {
62
+ // 验证必要字段存在
63
+ return ['url', 'method', 'headers', 'message'].every(
64
+ (key) => key in value,
65
+ );
66
+ },
67
+ },
68
+ zIndex: {
69
+ type: Number,
70
+ default: 1001,
71
+ },
72
+ },
73
+ methods: {
74
+ // 关闭详情面板
75
+ onClose() {
76
+ this.$emit('close');
77
+ },
78
+ // 点击消息项,复制到剪贴板
79
+ onClick(item) {
80
+ uni.setClipboardData({
81
+ data: JSON.stringify(item),
82
+ success() {
83
+ uni.showToast({
84
+ title: '复制成功',
85
+ icon: 'none',
86
+ });
87
+ },
88
+ fail() {
89
+ uni.showToast({
90
+ title: '复制失败',
91
+ icon: 'none',
92
+ });
93
+ },
94
+ });
95
+ },
96
+ // 引入日期格式化工具函数
97
+ formatDate,
98
+ },
99
+ };
100
+ </script>
101
+
102
+ <style>
103
+ .web-socket-list-container {
104
+ position: fixed;
105
+ width: 100vw;
106
+ height: 100vh;
107
+ z-index: 1001;
108
+ top: 0;
109
+ left: 0;
110
+ padding: 0 16px;
111
+
112
+ background-color: var(--dev-tool-bg2-color);
113
+ box-sizing: border-box;
114
+ }
115
+ .web-socket-list-title {
116
+ min-height: 32px;
117
+ display: flex;
118
+ align-items: center;
119
+ }
120
+
121
+ .web-socket-data {
122
+ height: calc(100% - 32px);
123
+ overflow: auto;
124
+ }
125
+
126
+ .web-socket-url {
127
+ display: flex;
128
+ align-items: center;
129
+ min-height: 28px;
130
+
131
+ white-space: wrap;
132
+ word-break: break-all;
133
+ }
134
+
135
+ .web-socket-top {
136
+ display: flex;
137
+ align-items: center;
138
+ height: 32px;
139
+
140
+ border-bottom: 1px solid transparent;
141
+ box-sizing: border-box;
142
+ }
143
+ .web-socket-title {
144
+ display: flex;
145
+ align-items: center;
146
+ }
147
+ .header-detail-item {
148
+ display: flex;
149
+ align-items: center;
150
+ min-height: 28px;
151
+ word-break: break-all;
152
+ }
153
+ .header-detail-item > view:first-child {
154
+ white-space: nowrap;
155
+ margin-right: 8px;
156
+ color: var(--dev-tool-info-color);
157
+ }
158
+
159
+ .web-socket-data-item {
160
+ display: flex;
161
+ align-items: center;
162
+ min-height: 28px;
163
+ }
164
+ .web-socket-data-item-error {
165
+ background-color: var(--dev-tool-error-bg-color);
166
+ }
167
+ .web-socket-data-item-success {
168
+ background-color: var(--dev-tool-success-bg-color);
169
+ }
170
+ .web-socket-data-time {
171
+ /* margin-right: 16px; */
172
+ padding: 0 6px;
173
+ flex-shrink: 0;
174
+ color: var(--dev-tool-info-color);
175
+ }
176
+ .web-socket-data-content {
177
+ padding: 6px;
178
+ flex: 1;
179
+ overflow: hidden;
180
+ text-overflow: ellipsis;
181
+ word-break: break-all;
182
+ }
183
+ </style>
@@ -0,0 +1,155 @@
1
+ <template>
2
+ <view class="websocket-content">
3
+ <view class="websocket-control">
4
+ <FilterInput
5
+ :modelValue="modelValue"
6
+ placeholder="查询url"
7
+ @search="handleSearch"
8
+ @update:modelValue="handleUpdateModelValue"
9
+ />
10
+ <Tag
11
+ v-for="item in webSocketFilter"
12
+ :mode="item.mode"
13
+ :key="item.value"
14
+ :active="item.value === currentWebSocketType"
15
+ @click="onChoose(item.value)"
16
+ >
17
+ {{ item.label }}
18
+ </Tag>
19
+ </view>
20
+
21
+ <VirtualListPro
22
+ :dataSource="wsList"
23
+ :pageSize="15"
24
+ :height="height"
25
+ className="websocket-list"
26
+ >
27
+ <template v-slot="{ list, start }">
28
+ <AutoSize
29
+ v-for="(item, index) in list"
30
+ :index="start + index"
31
+ :key="start + index"
32
+ >
33
+ <WebSocketItem :ws="item" :zIndex="zIndex" />
34
+ </AutoSize>
35
+ <Empty v-if="!wsList || wsList.length === 0" />
36
+ </template>
37
+ </VirtualListPro>
38
+ </view>
39
+ </template>
40
+
41
+ <script>
42
+ import WebSocketItem from './WebSocketItem.vue';
43
+ import Tag from '../Tag/index.vue';
44
+ import Empty from '../Empty/index.vue';
45
+ import FilterInput from '../FilterInput/index.vue';
46
+ import VirtualListPro from '../VirtualListPro/index.vue';
47
+ import AutoSize from '../VirtualListPro/AutoSize.vue';
48
+
49
+ export default {
50
+ components: {
51
+ WebSocketItem,
52
+ Tag,
53
+ Empty,
54
+ FilterInput,
55
+ VirtualListPro,
56
+ AutoSize,
57
+ },
58
+ props: {
59
+ wsList: {
60
+ type: Array,
61
+ default: () => [],
62
+ },
63
+ currentWebSocketType: {
64
+ type: String,
65
+ required: true,
66
+ },
67
+ modelValue: {
68
+ type: String,
69
+ default: '',
70
+ },
71
+ zIndex: {
72
+ type: Number,
73
+ default: 1000,
74
+ },
75
+ },
76
+ data() {
77
+ return {
78
+ height: 0,
79
+ webSocketFilter: [
80
+ {
81
+ label: '全部',
82
+ value: 'all',
83
+ mode: 'all',
84
+ },
85
+ {
86
+ label: 'con',
87
+ value: 'connection',
88
+ mode: 'info',
89
+ },
90
+ {
91
+ label: 'open',
92
+ value: 'open',
93
+ mode: 'success',
94
+ },
95
+ {
96
+ label: 'close',
97
+ value: 'close',
98
+ mode: 'warn',
99
+ },
100
+ {
101
+ label: 'error',
102
+ value: 'error',
103
+ mode: 'error',
104
+ },
105
+ {
106
+ label: '清除',
107
+ value: 'clear',
108
+ mode: 'clear',
109
+ },
110
+ ],
111
+ };
112
+ },
113
+ mounted() {
114
+ // 计算列表高度(窗口高度减去控制栏高度)
115
+ const { windowHeight } = uni.getWindowInfo();
116
+ this.height = windowHeight - 32 - 32;
117
+ },
118
+ methods: {
119
+ // 选择筛选类型
120
+ onChoose(type) {
121
+ this.$emit('choose', type);
122
+ },
123
+ // 处理搜索事件
124
+ handleSearch(value) {
125
+ this.$emit('search', value);
126
+ },
127
+ // 处理输入框值更新
128
+ handleUpdateModelValue(value) {
129
+ this.$emit('update:modelValue', value);
130
+ },
131
+ },
132
+ };
133
+ </script>
134
+
135
+ <style scoped>
136
+ .websocket-content {
137
+ height: 100%;
138
+ font-size: var(--dev-tool-base-font-size);
139
+ }
140
+
141
+ .websocket-control {
142
+ display: flex;
143
+ align-items: center;
144
+ justify-content: space-between;
145
+ gap: 8px;
146
+ padding: 0 16px;
147
+ height: 32px;
148
+ border-bottom: 1px solid var(--dev-tool-border-color);
149
+ box-sizing: border-box;
150
+ }
151
+ .websocket-list {
152
+ height: calc(100% - 32px);
153
+ overflow: auto;
154
+ }
155
+ </style>
@@ -0,0 +1,49 @@
1
+ <template>
2
+ <view class="window-info-content">
3
+ <JsonPretty v-if="showJson" :data="windowInfo" />
4
+ <Empty v-else />
5
+ </view>
6
+ </template>
7
+
8
+ <script>
9
+ import JsonPretty from '../JsonPretty/index.vue';
10
+ import Empty from '../Empty/index.vue';
11
+
12
+ export default {
13
+ components: {
14
+ JsonPretty,
15
+ Empty,
16
+ },
17
+ props: {
18
+ windowInfo: {
19
+ type: Object,
20
+ required: true,
21
+ default: () => ({}),
22
+ },
23
+ },
24
+ computed: {
25
+ // 判断是否显示JSON视图
26
+ showJson() {
27
+ try {
28
+ const str = JSON.stringify(this.windowInfo);
29
+ // 当数据为对象且不为空时显示
30
+ return (
31
+ typeof this.windowInfo === 'object' &&
32
+ this.windowInfo !== null &&
33
+ str !== '{}' &&
34
+ str !== ''
35
+ );
36
+ } catch (error) {
37
+ return false;
38
+ }
39
+ },
40
+ },
41
+ };
42
+ </script>
43
+
44
+ <style scoped>
45
+ .window-info-content {
46
+ padding: 16px;
47
+ font-size: var(--dev-tool-base-font-size);
48
+ }
49
+ </style>
@@ -0,0 +1,35 @@
1
+ <template>
2
+ <view class="app-info-content">
3
+ <JsonPretty v-if="showJson" :data="appInfo" />
4
+ <Empty v-else />
5
+ </view>
6
+ </template>
7
+ <script lang="ts" setup>
8
+ import { computed } from 'vue';
9
+ import JsonPretty from '../JsonPretty/index.vue';
10
+ import Empty from '../Empty/index.vue';
11
+ const props = defineProps<{
12
+ appInfo: Record<string, any>;
13
+ }>();
14
+
15
+ const showJson = computed(() => {
16
+ try {
17
+ const str = JSON.stringify(props.appInfo);
18
+ if (typeof props.appInfo === 'object' && (str === '' || str === '{}')) {
19
+ return false;
20
+ }
21
+ return true;
22
+ } catch (error) {
23
+ return false;
24
+ }
25
+ });
26
+ </script>
27
+ <style scoped>
28
+ .app-info-content {
29
+ padding: 16px;
30
+ font-size: var(--dev-tool-base-font-size);
31
+
32
+ height: calc(100% - 32px);
33
+ overflow: auto;
34
+ }
35
+ </style>