@mixd-id/web-scaffold 0.1.230406242 → 0.1.230406243
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/package.json
CHANGED
package/src/components/Alert.vue
CHANGED
|
@@ -15,8 +15,9 @@
|
|
|
15
15
|
<h5 :class="$style.title">{{ title }}</h5>
|
|
16
16
|
</div>
|
|
17
17
|
|
|
18
|
-
<div :class="$style.details"
|
|
19
|
-
<p class="text-center break-words">{{ message }}</p>
|
|
18
|
+
<div :class="$style.details">
|
|
19
|
+
<p class="text-center break-words" v-if="message">{{ message }}</p>
|
|
20
|
+
<p class="text-center break-words max-w-[420px]" v-if="stack">{{ stack }}</p>
|
|
20
21
|
</div>
|
|
21
22
|
|
|
22
23
|
<div :class="$style.details" v-if="details">
|
|
@@ -128,7 +129,6 @@ export default{
|
|
|
128
129
|
},
|
|
129
130
|
|
|
130
131
|
message(){
|
|
131
|
-
|
|
132
132
|
if(this.err.errors){
|
|
133
133
|
return typeof this.err.errors === 'object' && Object.keys(this.err.errors).length > 0 ?
|
|
134
134
|
Object.values(this.err.errors).join("\n") :
|
|
@@ -150,6 +150,12 @@ export default{
|
|
|
150
150
|
}
|
|
151
151
|
},
|
|
152
152
|
|
|
153
|
+
stack(){
|
|
154
|
+
if(this.err.stack){
|
|
155
|
+
return this.err.stack
|
|
156
|
+
}
|
|
157
|
+
},
|
|
158
|
+
|
|
153
159
|
details(){
|
|
154
160
|
|
|
155
161
|
if(this.alert.details && typeof this.alert.details === 'object'){
|
package/src/components/Modal.vue
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div :class="computedClass">
|
|
3
3
|
<slot name="start"></slot>
|
|
4
|
-
<textarea :maxlength="maxlength"
|
|
4
|
+
<textarea :maxlength="maxlength" :class="itemClass"
|
|
5
5
|
:placeholder="placeholder" :rows="rows" ref="input" @focus="isActive = true" @blur="onBlur" @input="onInput"
|
|
6
6
|
:value="modelValue" :readonly="Boolean(readonly)" />
|
|
7
7
|
<div v-if="state === -2 && !!(errors)">
|
|
@@ -29,6 +29,8 @@ export default{
|
|
|
29
29
|
|
|
30
30
|
customClass: String,
|
|
31
31
|
|
|
32
|
+
itemClass: String,
|
|
33
|
+
|
|
32
34
|
state: {
|
|
33
35
|
type: Number,
|
|
34
36
|
default: 1 // 1:normal, -1:disabled, -2:error
|
|
@@ -23,7 +23,7 @@ const plugin = Plugin(function({ addBase, config, theme }) {
|
|
|
23
23
|
'--base-500': '255, 255, 255',
|
|
24
24
|
'--base': '236, 236, 236',
|
|
25
25
|
|
|
26
|
-
"--text-50": '
|
|
26
|
+
"--text-50": '229, 229, 229',
|
|
27
27
|
"--text-100": '223, 223, 223',
|
|
28
28
|
"--text-200": '218, 218, 218',
|
|
29
29
|
"--text-300": '191, 191, 191',
|
|
@@ -70,7 +70,7 @@ const plugin = Plugin(function({ addBase, config, theme }) {
|
|
|
70
70
|
"--base-500": '22, 26, 33',
|
|
71
71
|
"--base": '22, 26, 33',
|
|
72
72
|
|
|
73
|
-
"--text-50": '
|
|
73
|
+
"--text-50": '33, 39, 46',
|
|
74
74
|
"--text-100": '48, 54, 61',
|
|
75
75
|
"--text-200": '53, 59, 66',
|
|
76
76
|
"--text-300": '77, 77, 77',
|
package/src/utils/wss.js
CHANGED
|
@@ -129,7 +129,15 @@ class WSS extends EventEmitter2{
|
|
|
129
129
|
|
|
130
130
|
socket.on('message', async (binaryData) => {
|
|
131
131
|
|
|
132
|
-
|
|
132
|
+
let obj
|
|
133
|
+
try{
|
|
134
|
+
obj = await this.fromBinaryData(binaryData);
|
|
135
|
+
}
|
|
136
|
+
catch(e){
|
|
137
|
+
return socket.close(1002, e.message);
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
const { _requestId, path, params } = obj
|
|
133
141
|
|
|
134
142
|
let status = 200
|
|
135
143
|
let data
|
|
@@ -142,7 +150,7 @@ class WSS extends EventEmitter2{
|
|
|
142
150
|
}
|
|
143
151
|
}
|
|
144
152
|
catch(e){
|
|
145
|
-
socket.close(1002, e.message);
|
|
153
|
+
return socket.close(1002, e.message);
|
|
146
154
|
}
|
|
147
155
|
break
|
|
148
156
|
|
|
@@ -158,6 +166,10 @@ class WSS extends EventEmitter2{
|
|
|
158
166
|
data = arr.length > 0 ? JSON.parse(JSON.stringify(arr.pop())) : data
|
|
159
167
|
}
|
|
160
168
|
catch(e){
|
|
169
|
+
if(this._opt.debug){
|
|
170
|
+
console.error(e)
|
|
171
|
+
}
|
|
172
|
+
|
|
161
173
|
status = 500
|
|
162
174
|
data = {
|
|
163
175
|
name: e.name,
|
package/src/utils/wss.mjs
CHANGED
|
@@ -121,14 +121,14 @@ class WSS extends EventEmitter2{
|
|
|
121
121
|
this._readyState = 2
|
|
122
122
|
this.send('_auth', this._opt.auth)
|
|
123
123
|
.then(() => {
|
|
124
|
+
this._readyState = 1
|
|
125
|
+
|
|
124
126
|
reconnect ? this.emit('reconnect', null, []) : this.emit('connect', null, [])
|
|
125
127
|
|
|
126
128
|
for(let sendParams of this._pendingSend){
|
|
127
129
|
this.sendSync(sendParams.path, sendParams.params, sendParams.cb, sendParams.err)
|
|
128
130
|
}
|
|
129
131
|
this._pendingSend = []
|
|
130
|
-
|
|
131
|
-
this._readyState = 1
|
|
132
132
|
})
|
|
133
133
|
};
|
|
134
134
|
|
|
@@ -178,24 +178,26 @@ class WSS extends EventEmitter2{
|
|
|
178
178
|
};
|
|
179
179
|
}
|
|
180
180
|
|
|
181
|
-
async reconnect(){
|
|
181
|
+
async reconnect(opt){
|
|
182
182
|
if(this._instance){
|
|
183
183
|
this._instance.close()
|
|
184
184
|
}
|
|
185
185
|
|
|
186
|
+
Object.assign(this._opt, opt)
|
|
187
|
+
|
|
186
188
|
await this.connect(true)
|
|
187
189
|
}
|
|
188
190
|
|
|
189
191
|
sendSync(path, params, cb, err, override){
|
|
190
|
-
if(this._instance.readyState !== 1 && this._readyState !== 1){
|
|
192
|
+
if(this._instance.readyState !== 1 || (path !== '_auth' && this._readyState !== 1)){
|
|
191
193
|
this._pendingSend.push({ path, params, cb, err })
|
|
192
194
|
return
|
|
193
195
|
}
|
|
194
196
|
|
|
195
|
-
if(!navigator.onLine){
|
|
197
|
+
/*if(!navigator.onLine){
|
|
196
198
|
err({ message: 'Unable to send, network disconnected' })
|
|
197
199
|
return
|
|
198
|
-
}
|
|
200
|
+
}*/
|
|
199
201
|
|
|
200
202
|
const _requestId = ++this._counter
|
|
201
203
|
|
|
@@ -216,14 +218,14 @@ class WSS extends EventEmitter2{
|
|
|
216
218
|
t1: new Date().getTime()
|
|
217
219
|
}
|
|
218
220
|
|
|
219
|
-
setTimeout(() => {
|
|
221
|
+
/*setTimeout(() => {
|
|
220
222
|
if(this._callbacks[_requestId]){
|
|
221
223
|
err({ message: 'Timeout' })
|
|
222
224
|
delete this._callbacks[_requestId]
|
|
223
225
|
|
|
224
226
|
this.reconnect()
|
|
225
227
|
}
|
|
226
|
-
}, (override ?? {}).timeout ?? this._opt.timeout)
|
|
228
|
+
}, (override ?? {}).timeout ?? this._opt.timeout)*/
|
|
227
229
|
})
|
|
228
230
|
}
|
|
229
231
|
|