stayge-ws-client-sdk 0.1.13 → 0.1.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.
- package/dist/index.d.mts +46 -0
- package/dist/index.d.ts +46 -0
- package/dist/react/index.js +17 -8
- package/dist/react/index.mjs +17 -8
- package/dist/react-native/index.js +17 -8
- package/dist/react-native/index.mjs +17 -8
- package/docs/.nojekyll +1 -0
- package/docs/assets/hierarchy.js +1 -0
- package/docs/assets/highlight.css +71 -0
- package/docs/assets/icons.js +18 -0
- package/docs/assets/icons.svg +1 -0
- package/docs/assets/main.js +60 -0
- package/docs/assets/navigation.js +1 -0
- package/docs/assets/search.js +1 -0
- package/docs/assets/style.css +1640 -0
- package/docs/hierarchy.html +1 -0
- package/docs/index.html +19 -0
- package/docs/interfaces/WebSocketClient.html +34 -0
- package/docs/modules.html +1 -0
- package/docs/types/ClientToServerMessage.html +1 -0
- package/docs/types/ServerToClientMessage.html +1 -0
- package/gen-docs.sh +1 -0
- package/package.json +2 -1
- package/sample/sample-websocket-client/package-lock.json +4 -4
- package/sample/sample-websocket-client/package.json +1 -1
- package/sample/sample-websocket-client/src/App.tsx +4 -0
- package/src/core/WebSocketClient.ts +53 -0
- package/src/core/WebSocketClientImpl.ts +22 -10
package/dist/index.d.mts
CHANGED
|
@@ -33,27 +33,73 @@ type ClientToServerMessage = {
|
|
|
33
33
|
type: "unsubscribe";
|
|
34
34
|
topic: string;
|
|
35
35
|
};
|
|
36
|
+
/**
|
|
37
|
+
* WebSocket client interface for handling real-time communication with the server.
|
|
38
|
+
* Provides methods for connection management, topic subscription, and event handling.
|
|
39
|
+
*/
|
|
36
40
|
interface WebSocketClient {
|
|
41
|
+
/**
|
|
42
|
+
* Establishes a WebSocket connection to the specified URL.
|
|
43
|
+
* @param args - Connection arguments
|
|
44
|
+
* @param args.url - The WebSocket server URL to connect to
|
|
45
|
+
*/
|
|
37
46
|
connect(args: {
|
|
38
47
|
url: string;
|
|
39
48
|
}): void;
|
|
49
|
+
/**
|
|
50
|
+
* Closes the WebSocket connection.
|
|
51
|
+
*/
|
|
40
52
|
disconnect(): void;
|
|
53
|
+
/**
|
|
54
|
+
* Subscribes to a specific topic with authentication token.
|
|
55
|
+
* @param args - Subscription arguments
|
|
56
|
+
* @param args.topic - The topic to subscribe to
|
|
57
|
+
* @param args.token - Authentication token for the subscription
|
|
58
|
+
*/
|
|
41
59
|
subscribe(args: {
|
|
42
60
|
topic: string;
|
|
43
61
|
token: string;
|
|
44
62
|
}): void;
|
|
63
|
+
/**
|
|
64
|
+
* Unsubscribes from a previously subscribed topic.
|
|
65
|
+
* @param args - Unsubscription arguments
|
|
66
|
+
* @param args.topic - The topic to unsubscribe from
|
|
67
|
+
*/
|
|
45
68
|
unsubscribe(args: {
|
|
46
69
|
topic: string;
|
|
47
70
|
}): void;
|
|
71
|
+
/**
|
|
72
|
+
* Registers a callback function to be called when the WebSocket connection is established.
|
|
73
|
+
* @param args - Callback registration arguments
|
|
74
|
+
* @param args.callback - Function to be called on successful connection
|
|
75
|
+
*/
|
|
48
76
|
onConnect(args: {
|
|
49
77
|
callback: () => void;
|
|
50
78
|
}): void;
|
|
79
|
+
/**
|
|
80
|
+
* Registers a callback function to be called when the WebSocket connection is closed.
|
|
81
|
+
* @param args - Callback registration arguments
|
|
82
|
+
* @param args.callback - Function to be called when connection is closed
|
|
83
|
+
*/
|
|
51
84
|
onDisconnect(args: {
|
|
52
85
|
callback: () => void;
|
|
53
86
|
}): void;
|
|
87
|
+
/**
|
|
88
|
+
* Registers a callback function to handle incoming messages.
|
|
89
|
+
* @param args - Callback registration arguments
|
|
90
|
+
* @param args.callback - Function to be called when a message is received
|
|
91
|
+
* @param args.callback.topic - The topic of the received message
|
|
92
|
+
* @param args.callback.payload - The payload of the received message
|
|
93
|
+
*/
|
|
54
94
|
onMessage(args: {
|
|
55
95
|
callback: (topic: string, payload: string) => void;
|
|
56
96
|
}): void;
|
|
97
|
+
/**
|
|
98
|
+
* Registers a callback function to handle WebSocket errors.
|
|
99
|
+
* @param args - Callback registration arguments
|
|
100
|
+
* @param args.callback - Function to be called when an error occurs
|
|
101
|
+
* @param args.callback.error - The error object containing error details
|
|
102
|
+
*/
|
|
57
103
|
onError(args: {
|
|
58
104
|
callback: (error: WsError) => void;
|
|
59
105
|
}): void;
|
package/dist/index.d.ts
CHANGED
|
@@ -33,27 +33,73 @@ type ClientToServerMessage = {
|
|
|
33
33
|
type: "unsubscribe";
|
|
34
34
|
topic: string;
|
|
35
35
|
};
|
|
36
|
+
/**
|
|
37
|
+
* WebSocket client interface for handling real-time communication with the server.
|
|
38
|
+
* Provides methods for connection management, topic subscription, and event handling.
|
|
39
|
+
*/
|
|
36
40
|
interface WebSocketClient {
|
|
41
|
+
/**
|
|
42
|
+
* Establishes a WebSocket connection to the specified URL.
|
|
43
|
+
* @param args - Connection arguments
|
|
44
|
+
* @param args.url - The WebSocket server URL to connect to
|
|
45
|
+
*/
|
|
37
46
|
connect(args: {
|
|
38
47
|
url: string;
|
|
39
48
|
}): void;
|
|
49
|
+
/**
|
|
50
|
+
* Closes the WebSocket connection.
|
|
51
|
+
*/
|
|
40
52
|
disconnect(): void;
|
|
53
|
+
/**
|
|
54
|
+
* Subscribes to a specific topic with authentication token.
|
|
55
|
+
* @param args - Subscription arguments
|
|
56
|
+
* @param args.topic - The topic to subscribe to
|
|
57
|
+
* @param args.token - Authentication token for the subscription
|
|
58
|
+
*/
|
|
41
59
|
subscribe(args: {
|
|
42
60
|
topic: string;
|
|
43
61
|
token: string;
|
|
44
62
|
}): void;
|
|
63
|
+
/**
|
|
64
|
+
* Unsubscribes from a previously subscribed topic.
|
|
65
|
+
* @param args - Unsubscription arguments
|
|
66
|
+
* @param args.topic - The topic to unsubscribe from
|
|
67
|
+
*/
|
|
45
68
|
unsubscribe(args: {
|
|
46
69
|
topic: string;
|
|
47
70
|
}): void;
|
|
71
|
+
/**
|
|
72
|
+
* Registers a callback function to be called when the WebSocket connection is established.
|
|
73
|
+
* @param args - Callback registration arguments
|
|
74
|
+
* @param args.callback - Function to be called on successful connection
|
|
75
|
+
*/
|
|
48
76
|
onConnect(args: {
|
|
49
77
|
callback: () => void;
|
|
50
78
|
}): void;
|
|
79
|
+
/**
|
|
80
|
+
* Registers a callback function to be called when the WebSocket connection is closed.
|
|
81
|
+
* @param args - Callback registration arguments
|
|
82
|
+
* @param args.callback - Function to be called when connection is closed
|
|
83
|
+
*/
|
|
51
84
|
onDisconnect(args: {
|
|
52
85
|
callback: () => void;
|
|
53
86
|
}): void;
|
|
87
|
+
/**
|
|
88
|
+
* Registers a callback function to handle incoming messages.
|
|
89
|
+
* @param args - Callback registration arguments
|
|
90
|
+
* @param args.callback - Function to be called when a message is received
|
|
91
|
+
* @param args.callback.topic - The topic of the received message
|
|
92
|
+
* @param args.callback.payload - The payload of the received message
|
|
93
|
+
*/
|
|
54
94
|
onMessage(args: {
|
|
55
95
|
callback: (topic: string, payload: string) => void;
|
|
56
96
|
}): void;
|
|
97
|
+
/**
|
|
98
|
+
* Registers a callback function to handle WebSocket errors.
|
|
99
|
+
* @param args - Callback registration arguments
|
|
100
|
+
* @param args.callback - Function to be called when an error occurs
|
|
101
|
+
* @param args.callback.error - The error object containing error details
|
|
102
|
+
*/
|
|
57
103
|
onError(args: {
|
|
58
104
|
callback: (error: WsError) => void;
|
|
59
105
|
}): void;
|
package/dist/react/index.js
CHANGED
|
@@ -46,6 +46,7 @@ var WebSocketClientImpl = class {
|
|
|
46
46
|
this.url = null;
|
|
47
47
|
this.desiredState = "disconnect";
|
|
48
48
|
this.currentState = "disconnected";
|
|
49
|
+
this.subscribedTopics = {};
|
|
49
50
|
}
|
|
50
51
|
connect(args) {
|
|
51
52
|
this.desiredState = "connect";
|
|
@@ -70,13 +71,12 @@ var WebSocketClientImpl = class {
|
|
|
70
71
|
this.currentState = "connecting";
|
|
71
72
|
}
|
|
72
73
|
disconnect() {
|
|
73
|
-
console.log("WebSocketClient:disconnect");
|
|
74
74
|
this.desiredState = "disconnect";
|
|
75
75
|
this.url = null;
|
|
76
76
|
this.close();
|
|
77
77
|
}
|
|
78
78
|
subscribe(args) {
|
|
79
|
-
|
|
79
|
+
this.addToSubscribedTopics(args.topic, args.token);
|
|
80
80
|
const message = {
|
|
81
81
|
type: "subscribe",
|
|
82
82
|
topic: args.topic,
|
|
@@ -85,7 +85,7 @@ var WebSocketClientImpl = class {
|
|
|
85
85
|
this.ws?.send(JSON.stringify(message));
|
|
86
86
|
}
|
|
87
87
|
unsubscribe(args) {
|
|
88
|
-
|
|
88
|
+
this.removeFromSubscribedTopics(args.topic);
|
|
89
89
|
const message = {
|
|
90
90
|
type: "unsubscribe",
|
|
91
91
|
topic: args.topic
|
|
@@ -110,7 +110,6 @@ var WebSocketClientImpl = class {
|
|
|
110
110
|
this.currentState = "disconnected";
|
|
111
111
|
}
|
|
112
112
|
reconnect() {
|
|
113
|
-
console.log("WebSocketClient:reconnect");
|
|
114
113
|
if (this.reconnectAttempts >= MAX_RECONNECT_ATTEMPTS) {
|
|
115
114
|
console.error("WebSocketClient:reconnect: max attempts reached");
|
|
116
115
|
return;
|
|
@@ -122,22 +121,24 @@ var WebSocketClientImpl = class {
|
|
|
122
121
|
}, delay);
|
|
123
122
|
}
|
|
124
123
|
async wsOnOpen() {
|
|
125
|
-
console.log("WebSocketClient:onopen");
|
|
126
124
|
this.reconnectAttempts = 0;
|
|
127
125
|
if (this.desiredState !== "connect") {
|
|
128
126
|
return;
|
|
129
127
|
}
|
|
130
128
|
this.currentState = "connected";
|
|
129
|
+
if (Object.keys(this.subscribedTopics).length > 0) {
|
|
130
|
+
Object.entries(this.subscribedTopics).forEach(([topic, token]) => {
|
|
131
|
+
this.subscribe({ topic, token });
|
|
132
|
+
});
|
|
133
|
+
}
|
|
131
134
|
if (this.onConnectCallback) {
|
|
132
135
|
this.onConnectCallback();
|
|
133
136
|
}
|
|
134
137
|
}
|
|
135
138
|
wsOnError(error) {
|
|
136
|
-
console.error("WebSocketClient:wsOnError", error);
|
|
137
139
|
this.close();
|
|
138
140
|
}
|
|
139
141
|
wsOnMessage(event) {
|
|
140
|
-
console.error("WebSocketClient:wsOnMessage");
|
|
141
142
|
try {
|
|
142
143
|
const message = JSON.parse(event.data);
|
|
143
144
|
if (message.type === "app") {
|
|
@@ -146,6 +147,9 @@ var WebSocketClientImpl = class {
|
|
|
146
147
|
}
|
|
147
148
|
} else if (message.type === "system:subscribe:error") {
|
|
148
149
|
if (this.onErrorCallback) {
|
|
150
|
+
if (message.body?.topic) {
|
|
151
|
+
this.removeFromSubscribedTopics(message.body.topic);
|
|
152
|
+
}
|
|
149
153
|
this.onErrorCallback(
|
|
150
154
|
new WsError({
|
|
151
155
|
code: "subscribeError",
|
|
@@ -160,7 +164,6 @@ var WebSocketClientImpl = class {
|
|
|
160
164
|
}
|
|
161
165
|
}
|
|
162
166
|
wsOnClose() {
|
|
163
|
-
console.error("WebSocketClient:wsOnClose");
|
|
164
167
|
if (this.onDisconnectCallback) {
|
|
165
168
|
this.onDisconnectCallback();
|
|
166
169
|
}
|
|
@@ -168,6 +171,12 @@ var WebSocketClientImpl = class {
|
|
|
168
171
|
this.reconnect();
|
|
169
172
|
}
|
|
170
173
|
}
|
|
174
|
+
addToSubscribedTopics(topic, token) {
|
|
175
|
+
this.subscribedTopics[topic] = token;
|
|
176
|
+
}
|
|
177
|
+
removeFromSubscribedTopics(topic) {
|
|
178
|
+
delete this.subscribedTopics[topic];
|
|
179
|
+
}
|
|
171
180
|
};
|
|
172
181
|
|
|
173
182
|
// src/react/index.ts
|
package/dist/react/index.mjs
CHANGED
|
@@ -20,6 +20,7 @@ var WebSocketClientImpl = class {
|
|
|
20
20
|
this.url = null;
|
|
21
21
|
this.desiredState = "disconnect";
|
|
22
22
|
this.currentState = "disconnected";
|
|
23
|
+
this.subscribedTopics = {};
|
|
23
24
|
}
|
|
24
25
|
connect(args) {
|
|
25
26
|
this.desiredState = "connect";
|
|
@@ -44,13 +45,12 @@ var WebSocketClientImpl = class {
|
|
|
44
45
|
this.currentState = "connecting";
|
|
45
46
|
}
|
|
46
47
|
disconnect() {
|
|
47
|
-
console.log("WebSocketClient:disconnect");
|
|
48
48
|
this.desiredState = "disconnect";
|
|
49
49
|
this.url = null;
|
|
50
50
|
this.close();
|
|
51
51
|
}
|
|
52
52
|
subscribe(args) {
|
|
53
|
-
|
|
53
|
+
this.addToSubscribedTopics(args.topic, args.token);
|
|
54
54
|
const message = {
|
|
55
55
|
type: "subscribe",
|
|
56
56
|
topic: args.topic,
|
|
@@ -59,7 +59,7 @@ var WebSocketClientImpl = class {
|
|
|
59
59
|
this.ws?.send(JSON.stringify(message));
|
|
60
60
|
}
|
|
61
61
|
unsubscribe(args) {
|
|
62
|
-
|
|
62
|
+
this.removeFromSubscribedTopics(args.topic);
|
|
63
63
|
const message = {
|
|
64
64
|
type: "unsubscribe",
|
|
65
65
|
topic: args.topic
|
|
@@ -84,7 +84,6 @@ var WebSocketClientImpl = class {
|
|
|
84
84
|
this.currentState = "disconnected";
|
|
85
85
|
}
|
|
86
86
|
reconnect() {
|
|
87
|
-
console.log("WebSocketClient:reconnect");
|
|
88
87
|
if (this.reconnectAttempts >= MAX_RECONNECT_ATTEMPTS) {
|
|
89
88
|
console.error("WebSocketClient:reconnect: max attempts reached");
|
|
90
89
|
return;
|
|
@@ -96,22 +95,24 @@ var WebSocketClientImpl = class {
|
|
|
96
95
|
}, delay);
|
|
97
96
|
}
|
|
98
97
|
async wsOnOpen() {
|
|
99
|
-
console.log("WebSocketClient:onopen");
|
|
100
98
|
this.reconnectAttempts = 0;
|
|
101
99
|
if (this.desiredState !== "connect") {
|
|
102
100
|
return;
|
|
103
101
|
}
|
|
104
102
|
this.currentState = "connected";
|
|
103
|
+
if (Object.keys(this.subscribedTopics).length > 0) {
|
|
104
|
+
Object.entries(this.subscribedTopics).forEach(([topic, token]) => {
|
|
105
|
+
this.subscribe({ topic, token });
|
|
106
|
+
});
|
|
107
|
+
}
|
|
105
108
|
if (this.onConnectCallback) {
|
|
106
109
|
this.onConnectCallback();
|
|
107
110
|
}
|
|
108
111
|
}
|
|
109
112
|
wsOnError(error) {
|
|
110
|
-
console.error("WebSocketClient:wsOnError", error);
|
|
111
113
|
this.close();
|
|
112
114
|
}
|
|
113
115
|
wsOnMessage(event) {
|
|
114
|
-
console.error("WebSocketClient:wsOnMessage");
|
|
115
116
|
try {
|
|
116
117
|
const message = JSON.parse(event.data);
|
|
117
118
|
if (message.type === "app") {
|
|
@@ -120,6 +121,9 @@ var WebSocketClientImpl = class {
|
|
|
120
121
|
}
|
|
121
122
|
} else if (message.type === "system:subscribe:error") {
|
|
122
123
|
if (this.onErrorCallback) {
|
|
124
|
+
if (message.body?.topic) {
|
|
125
|
+
this.removeFromSubscribedTopics(message.body.topic);
|
|
126
|
+
}
|
|
123
127
|
this.onErrorCallback(
|
|
124
128
|
new WsError({
|
|
125
129
|
code: "subscribeError",
|
|
@@ -134,7 +138,6 @@ var WebSocketClientImpl = class {
|
|
|
134
138
|
}
|
|
135
139
|
}
|
|
136
140
|
wsOnClose() {
|
|
137
|
-
console.error("WebSocketClient:wsOnClose");
|
|
138
141
|
if (this.onDisconnectCallback) {
|
|
139
142
|
this.onDisconnectCallback();
|
|
140
143
|
}
|
|
@@ -142,6 +145,12 @@ var WebSocketClientImpl = class {
|
|
|
142
145
|
this.reconnect();
|
|
143
146
|
}
|
|
144
147
|
}
|
|
148
|
+
addToSubscribedTopics(topic, token) {
|
|
149
|
+
this.subscribedTopics[topic] = token;
|
|
150
|
+
}
|
|
151
|
+
removeFromSubscribedTopics(topic) {
|
|
152
|
+
delete this.subscribedTopics[topic];
|
|
153
|
+
}
|
|
145
154
|
};
|
|
146
155
|
|
|
147
156
|
// src/react/index.ts
|
|
@@ -46,6 +46,7 @@ var WebSocketClientImpl = class {
|
|
|
46
46
|
this.url = null;
|
|
47
47
|
this.desiredState = "disconnect";
|
|
48
48
|
this.currentState = "disconnected";
|
|
49
|
+
this.subscribedTopics = {};
|
|
49
50
|
}
|
|
50
51
|
connect(args) {
|
|
51
52
|
this.desiredState = "connect";
|
|
@@ -70,13 +71,12 @@ var WebSocketClientImpl = class {
|
|
|
70
71
|
this.currentState = "connecting";
|
|
71
72
|
}
|
|
72
73
|
disconnect() {
|
|
73
|
-
console.log("WebSocketClient:disconnect");
|
|
74
74
|
this.desiredState = "disconnect";
|
|
75
75
|
this.url = null;
|
|
76
76
|
this.close();
|
|
77
77
|
}
|
|
78
78
|
subscribe(args) {
|
|
79
|
-
|
|
79
|
+
this.addToSubscribedTopics(args.topic, args.token);
|
|
80
80
|
const message = {
|
|
81
81
|
type: "subscribe",
|
|
82
82
|
topic: args.topic,
|
|
@@ -85,7 +85,7 @@ var WebSocketClientImpl = class {
|
|
|
85
85
|
this.ws?.send(JSON.stringify(message));
|
|
86
86
|
}
|
|
87
87
|
unsubscribe(args) {
|
|
88
|
-
|
|
88
|
+
this.removeFromSubscribedTopics(args.topic);
|
|
89
89
|
const message = {
|
|
90
90
|
type: "unsubscribe",
|
|
91
91
|
topic: args.topic
|
|
@@ -110,7 +110,6 @@ var WebSocketClientImpl = class {
|
|
|
110
110
|
this.currentState = "disconnected";
|
|
111
111
|
}
|
|
112
112
|
reconnect() {
|
|
113
|
-
console.log("WebSocketClient:reconnect");
|
|
114
113
|
if (this.reconnectAttempts >= MAX_RECONNECT_ATTEMPTS) {
|
|
115
114
|
console.error("WebSocketClient:reconnect: max attempts reached");
|
|
116
115
|
return;
|
|
@@ -122,22 +121,24 @@ var WebSocketClientImpl = class {
|
|
|
122
121
|
}, delay);
|
|
123
122
|
}
|
|
124
123
|
async wsOnOpen() {
|
|
125
|
-
console.log("WebSocketClient:onopen");
|
|
126
124
|
this.reconnectAttempts = 0;
|
|
127
125
|
if (this.desiredState !== "connect") {
|
|
128
126
|
return;
|
|
129
127
|
}
|
|
130
128
|
this.currentState = "connected";
|
|
129
|
+
if (Object.keys(this.subscribedTopics).length > 0) {
|
|
130
|
+
Object.entries(this.subscribedTopics).forEach(([topic, token]) => {
|
|
131
|
+
this.subscribe({ topic, token });
|
|
132
|
+
});
|
|
133
|
+
}
|
|
131
134
|
if (this.onConnectCallback) {
|
|
132
135
|
this.onConnectCallback();
|
|
133
136
|
}
|
|
134
137
|
}
|
|
135
138
|
wsOnError(error) {
|
|
136
|
-
console.error("WebSocketClient:wsOnError", error);
|
|
137
139
|
this.close();
|
|
138
140
|
}
|
|
139
141
|
wsOnMessage(event) {
|
|
140
|
-
console.error("WebSocketClient:wsOnMessage");
|
|
141
142
|
try {
|
|
142
143
|
const message = JSON.parse(event.data);
|
|
143
144
|
if (message.type === "app") {
|
|
@@ -146,6 +147,9 @@ var WebSocketClientImpl = class {
|
|
|
146
147
|
}
|
|
147
148
|
} else if (message.type === "system:subscribe:error") {
|
|
148
149
|
if (this.onErrorCallback) {
|
|
150
|
+
if (message.body?.topic) {
|
|
151
|
+
this.removeFromSubscribedTopics(message.body.topic);
|
|
152
|
+
}
|
|
149
153
|
this.onErrorCallback(
|
|
150
154
|
new WsError({
|
|
151
155
|
code: "subscribeError",
|
|
@@ -160,7 +164,6 @@ var WebSocketClientImpl = class {
|
|
|
160
164
|
}
|
|
161
165
|
}
|
|
162
166
|
wsOnClose() {
|
|
163
|
-
console.error("WebSocketClient:wsOnClose");
|
|
164
167
|
if (this.onDisconnectCallback) {
|
|
165
168
|
this.onDisconnectCallback();
|
|
166
169
|
}
|
|
@@ -168,6 +171,12 @@ var WebSocketClientImpl = class {
|
|
|
168
171
|
this.reconnect();
|
|
169
172
|
}
|
|
170
173
|
}
|
|
174
|
+
addToSubscribedTopics(topic, token) {
|
|
175
|
+
this.subscribedTopics[topic] = token;
|
|
176
|
+
}
|
|
177
|
+
removeFromSubscribedTopics(topic) {
|
|
178
|
+
delete this.subscribedTopics[topic];
|
|
179
|
+
}
|
|
171
180
|
};
|
|
172
181
|
|
|
173
182
|
// src/react-native/index.ts
|
|
@@ -20,6 +20,7 @@ var WebSocketClientImpl = class {
|
|
|
20
20
|
this.url = null;
|
|
21
21
|
this.desiredState = "disconnect";
|
|
22
22
|
this.currentState = "disconnected";
|
|
23
|
+
this.subscribedTopics = {};
|
|
23
24
|
}
|
|
24
25
|
connect(args) {
|
|
25
26
|
this.desiredState = "connect";
|
|
@@ -44,13 +45,12 @@ var WebSocketClientImpl = class {
|
|
|
44
45
|
this.currentState = "connecting";
|
|
45
46
|
}
|
|
46
47
|
disconnect() {
|
|
47
|
-
console.log("WebSocketClient:disconnect");
|
|
48
48
|
this.desiredState = "disconnect";
|
|
49
49
|
this.url = null;
|
|
50
50
|
this.close();
|
|
51
51
|
}
|
|
52
52
|
subscribe(args) {
|
|
53
|
-
|
|
53
|
+
this.addToSubscribedTopics(args.topic, args.token);
|
|
54
54
|
const message = {
|
|
55
55
|
type: "subscribe",
|
|
56
56
|
topic: args.topic,
|
|
@@ -59,7 +59,7 @@ var WebSocketClientImpl = class {
|
|
|
59
59
|
this.ws?.send(JSON.stringify(message));
|
|
60
60
|
}
|
|
61
61
|
unsubscribe(args) {
|
|
62
|
-
|
|
62
|
+
this.removeFromSubscribedTopics(args.topic);
|
|
63
63
|
const message = {
|
|
64
64
|
type: "unsubscribe",
|
|
65
65
|
topic: args.topic
|
|
@@ -84,7 +84,6 @@ var WebSocketClientImpl = class {
|
|
|
84
84
|
this.currentState = "disconnected";
|
|
85
85
|
}
|
|
86
86
|
reconnect() {
|
|
87
|
-
console.log("WebSocketClient:reconnect");
|
|
88
87
|
if (this.reconnectAttempts >= MAX_RECONNECT_ATTEMPTS) {
|
|
89
88
|
console.error("WebSocketClient:reconnect: max attempts reached");
|
|
90
89
|
return;
|
|
@@ -96,22 +95,24 @@ var WebSocketClientImpl = class {
|
|
|
96
95
|
}, delay);
|
|
97
96
|
}
|
|
98
97
|
async wsOnOpen() {
|
|
99
|
-
console.log("WebSocketClient:onopen");
|
|
100
98
|
this.reconnectAttempts = 0;
|
|
101
99
|
if (this.desiredState !== "connect") {
|
|
102
100
|
return;
|
|
103
101
|
}
|
|
104
102
|
this.currentState = "connected";
|
|
103
|
+
if (Object.keys(this.subscribedTopics).length > 0) {
|
|
104
|
+
Object.entries(this.subscribedTopics).forEach(([topic, token]) => {
|
|
105
|
+
this.subscribe({ topic, token });
|
|
106
|
+
});
|
|
107
|
+
}
|
|
105
108
|
if (this.onConnectCallback) {
|
|
106
109
|
this.onConnectCallback();
|
|
107
110
|
}
|
|
108
111
|
}
|
|
109
112
|
wsOnError(error) {
|
|
110
|
-
console.error("WebSocketClient:wsOnError", error);
|
|
111
113
|
this.close();
|
|
112
114
|
}
|
|
113
115
|
wsOnMessage(event) {
|
|
114
|
-
console.error("WebSocketClient:wsOnMessage");
|
|
115
116
|
try {
|
|
116
117
|
const message = JSON.parse(event.data);
|
|
117
118
|
if (message.type === "app") {
|
|
@@ -120,6 +121,9 @@ var WebSocketClientImpl = class {
|
|
|
120
121
|
}
|
|
121
122
|
} else if (message.type === "system:subscribe:error") {
|
|
122
123
|
if (this.onErrorCallback) {
|
|
124
|
+
if (message.body?.topic) {
|
|
125
|
+
this.removeFromSubscribedTopics(message.body.topic);
|
|
126
|
+
}
|
|
123
127
|
this.onErrorCallback(
|
|
124
128
|
new WsError({
|
|
125
129
|
code: "subscribeError",
|
|
@@ -134,7 +138,6 @@ var WebSocketClientImpl = class {
|
|
|
134
138
|
}
|
|
135
139
|
}
|
|
136
140
|
wsOnClose() {
|
|
137
|
-
console.error("WebSocketClient:wsOnClose");
|
|
138
141
|
if (this.onDisconnectCallback) {
|
|
139
142
|
this.onDisconnectCallback();
|
|
140
143
|
}
|
|
@@ -142,6 +145,12 @@ var WebSocketClientImpl = class {
|
|
|
142
145
|
this.reconnect();
|
|
143
146
|
}
|
|
144
147
|
}
|
|
148
|
+
addToSubscribedTopics(topic, token) {
|
|
149
|
+
this.subscribedTopics[topic] = token;
|
|
150
|
+
}
|
|
151
|
+
removeFromSubscribedTopics(topic) {
|
|
152
|
+
delete this.subscribedTopics[topic];
|
|
153
|
+
}
|
|
145
154
|
};
|
|
146
155
|
|
|
147
156
|
// src/react-native/index.ts
|
package/docs/.nojekyll
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
TypeDoc added this file to prevent GitHub Pages from using Jekyll. You can turn off this behavior by setting the `githubPages` option to false.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
window.hierarchyData = "eJyrVirKzy8pVrKKjtVRKkpNy0lNLsnMzytWsqqurQUAmx4Kpg=="
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
:root {
|
|
2
|
+
--light-hl-0: #AF00DB;
|
|
3
|
+
--dark-hl-0: #C586C0;
|
|
4
|
+
--light-hl-1: #000000;
|
|
5
|
+
--dark-hl-1: #D4D4D4;
|
|
6
|
+
--light-hl-2: #001080;
|
|
7
|
+
--dark-hl-2: #9CDCFE;
|
|
8
|
+
--light-hl-3: #A31515;
|
|
9
|
+
--dark-hl-3: #CE9178;
|
|
10
|
+
--light-hl-4: #0000FF;
|
|
11
|
+
--dark-hl-4: #569CD6;
|
|
12
|
+
--light-hl-5: #0070C1;
|
|
13
|
+
--dark-hl-5: #4FC1FF;
|
|
14
|
+
--light-hl-6: #795E26;
|
|
15
|
+
--dark-hl-6: #DCDCAA;
|
|
16
|
+
--light-code-background: #FFFFFF;
|
|
17
|
+
--dark-code-background: #1E1E1E;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
@media (prefers-color-scheme: light) { :root {
|
|
21
|
+
--hl-0: var(--light-hl-0);
|
|
22
|
+
--hl-1: var(--light-hl-1);
|
|
23
|
+
--hl-2: var(--light-hl-2);
|
|
24
|
+
--hl-3: var(--light-hl-3);
|
|
25
|
+
--hl-4: var(--light-hl-4);
|
|
26
|
+
--hl-5: var(--light-hl-5);
|
|
27
|
+
--hl-6: var(--light-hl-6);
|
|
28
|
+
--code-background: var(--light-code-background);
|
|
29
|
+
} }
|
|
30
|
+
|
|
31
|
+
@media (prefers-color-scheme: dark) { :root {
|
|
32
|
+
--hl-0: var(--dark-hl-0);
|
|
33
|
+
--hl-1: var(--dark-hl-1);
|
|
34
|
+
--hl-2: var(--dark-hl-2);
|
|
35
|
+
--hl-3: var(--dark-hl-3);
|
|
36
|
+
--hl-4: var(--dark-hl-4);
|
|
37
|
+
--hl-5: var(--dark-hl-5);
|
|
38
|
+
--hl-6: var(--dark-hl-6);
|
|
39
|
+
--code-background: var(--dark-code-background);
|
|
40
|
+
} }
|
|
41
|
+
|
|
42
|
+
:root[data-theme='light'] {
|
|
43
|
+
--hl-0: var(--light-hl-0);
|
|
44
|
+
--hl-1: var(--light-hl-1);
|
|
45
|
+
--hl-2: var(--light-hl-2);
|
|
46
|
+
--hl-3: var(--light-hl-3);
|
|
47
|
+
--hl-4: var(--light-hl-4);
|
|
48
|
+
--hl-5: var(--light-hl-5);
|
|
49
|
+
--hl-6: var(--light-hl-6);
|
|
50
|
+
--code-background: var(--light-code-background);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
:root[data-theme='dark'] {
|
|
54
|
+
--hl-0: var(--dark-hl-0);
|
|
55
|
+
--hl-1: var(--dark-hl-1);
|
|
56
|
+
--hl-2: var(--dark-hl-2);
|
|
57
|
+
--hl-3: var(--dark-hl-3);
|
|
58
|
+
--hl-4: var(--dark-hl-4);
|
|
59
|
+
--hl-5: var(--dark-hl-5);
|
|
60
|
+
--hl-6: var(--dark-hl-6);
|
|
61
|
+
--code-background: var(--dark-code-background);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.hl-0 { color: var(--hl-0); }
|
|
65
|
+
.hl-1 { color: var(--hl-1); }
|
|
66
|
+
.hl-2 { color: var(--hl-2); }
|
|
67
|
+
.hl-3 { color: var(--hl-3); }
|
|
68
|
+
.hl-4 { color: var(--hl-4); }
|
|
69
|
+
.hl-5 { color: var(--hl-5); }
|
|
70
|
+
.hl-6 { color: var(--hl-6); }
|
|
71
|
+
pre, code { background: var(--code-background); }
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
(function() {
|
|
2
|
+
addIcons();
|
|
3
|
+
function addIcons() {
|
|
4
|
+
if (document.readyState === "loading") return document.addEventListener("DOMContentLoaded", addIcons);
|
|
5
|
+
const svg = document.body.appendChild(document.createElementNS("http://www.w3.org/2000/svg", "svg"));
|
|
6
|
+
svg.innerHTML = `<g id="icon-1" class="tsd-no-select"><rect fill="var(--color-icon-background)" stroke="var(--color-ts-module)" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="6"></rect><text fill="var(--color-icon-text)" x="50%" y="50%" dominant-baseline="central" text-anchor="middle">M</text></g><g id="icon-2" class="tsd-no-select"><rect fill="var(--color-icon-background)" stroke="var(--color-ts-module)" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="6"></rect><text fill="var(--color-icon-text)" x="50%" y="50%" dominant-baseline="central" text-anchor="middle">M</text></g><g id="icon-4" class="tsd-no-select"><rect fill="var(--color-icon-background)" stroke="var(--color-ts-namespace)" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="6"></rect><text fill="var(--color-icon-text)" x="50%" y="50%" dominant-baseline="central" text-anchor="middle">N</text></g><g id="icon-8" class="tsd-no-select"><rect fill="var(--color-icon-background)" stroke="var(--color-ts-enum)" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="6"></rect><text fill="var(--color-icon-text)" x="50%" y="50%" dominant-baseline="central" text-anchor="middle">E</text></g><g id="icon-16" class="tsd-no-select"><rect fill="var(--color-icon-background)" stroke="var(--color-ts-property)" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="12"></rect><text fill="var(--color-icon-text)" x="50%" y="50%" dominant-baseline="central" text-anchor="middle">P</text></g><g id="icon-32" class="tsd-no-select"><rect fill="var(--color-icon-background)" stroke="var(--color-ts-variable)" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="6"></rect><text fill="var(--color-icon-text)" x="50%" y="50%" dominant-baseline="central" text-anchor="middle">V</text></g><g id="icon-64" class="tsd-no-select"><rect fill="var(--color-icon-background)" stroke="var(--color-ts-function)" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="6"></rect><text fill="var(--color-icon-text)" x="50%" y="50%" dominant-baseline="central" text-anchor="middle">F</text></g><g id="icon-128" class="tsd-no-select"><rect fill="var(--color-icon-background)" stroke="var(--color-ts-class)" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="6"></rect><text fill="var(--color-icon-text)" x="50%" y="50%" dominant-baseline="central" text-anchor="middle">C</text></g><g id="icon-256" class="tsd-no-select"><rect fill="var(--color-icon-background)" stroke="var(--color-ts-interface)" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="6"></rect><text fill="var(--color-icon-text)" x="50%" y="50%" dominant-baseline="central" text-anchor="middle">I</text></g><g id="icon-512" class="tsd-no-select"><rect fill="var(--color-icon-background)" stroke="var(--color-ts-constructor)" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="12"></rect><text fill="var(--color-icon-text)" x="50%" y="50%" dominant-baseline="central" text-anchor="middle">C</text></g><g id="icon-1024" class="tsd-no-select"><rect fill="var(--color-icon-background)" stroke="var(--color-ts-property)" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="12"></rect><text fill="var(--color-icon-text)" x="50%" y="50%" dominant-baseline="central" text-anchor="middle">P</text></g><g id="icon-2048" class="tsd-no-select"><rect fill="var(--color-icon-background)" stroke="var(--color-ts-method)" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="12"></rect><text fill="var(--color-icon-text)" x="50%" y="50%" dominant-baseline="central" text-anchor="middle">M</text></g><g id="icon-4096" class="tsd-no-select"><rect fill="var(--color-icon-background)" stroke="var(--color-ts-function)" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="6"></rect><text fill="var(--color-icon-text)" x="50%" y="50%" dominant-baseline="central" text-anchor="middle">F</text></g><g id="icon-8192" class="tsd-no-select"><rect fill="var(--color-icon-background)" stroke="var(--color-ts-property)" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="12"></rect><text fill="var(--color-icon-text)" x="50%" y="50%" dominant-baseline="central" text-anchor="middle">P</text></g><g id="icon-16384" class="tsd-no-select"><rect fill="var(--color-icon-background)" stroke="var(--color-ts-constructor)" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="12"></rect><text fill="var(--color-icon-text)" x="50%" y="50%" dominant-baseline="central" text-anchor="middle">C</text></g><g id="icon-32768" class="tsd-no-select"><rect fill="var(--color-icon-background)" stroke="var(--color-ts-property)" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="12"></rect><text fill="var(--color-icon-text)" x="50%" y="50%" dominant-baseline="central" text-anchor="middle">P</text></g><g id="icon-65536" class="tsd-no-select"><rect fill="var(--color-icon-background)" stroke="var(--color-ts-type-alias)" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="6"></rect><text fill="var(--color-icon-text)" x="50%" y="50%" dominant-baseline="central" text-anchor="middle">T</text></g><g id="icon-131072" class="tsd-no-select"><rect fill="var(--color-icon-background)" stroke="var(--color-ts-type-alias)" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="6"></rect><text fill="var(--color-icon-text)" x="50%" y="50%" dominant-baseline="central" text-anchor="middle">T</text></g><g id="icon-262144" class="tsd-no-select"><rect fill="var(--color-icon-background)" stroke="var(--color-ts-accessor)" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="12"></rect><text fill="var(--color-icon-text)" x="50%" y="50%" dominant-baseline="central" text-anchor="middle">A</text></g><g id="icon-524288" class="tsd-no-select"><rect fill="var(--color-icon-background)" stroke="var(--color-ts-accessor)" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="12"></rect><text fill="var(--color-icon-text)" x="50%" y="50%" dominant-baseline="central" text-anchor="middle">A</text></g><g id="icon-1048576" class="tsd-no-select"><rect fill="var(--color-icon-background)" stroke="var(--color-ts-accessor)" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="12"></rect><text fill="var(--color-icon-text)" x="50%" y="50%" dominant-baseline="central" text-anchor="middle">A</text></g><g id="icon-2097152" class="tsd-no-select"><rect fill="var(--color-icon-background)" stroke="var(--color-ts-type-alias)" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="6"></rect><text fill="var(--color-icon-text)" x="50%" y="50%" dominant-baseline="central" text-anchor="middle">T</text></g><g id="icon-4194304" class="tsd-no-select"><rect fill="var(--color-icon-background)" stroke="var(--color-ts-reference)" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="12"></rect><text fill="var(--color-icon-text)" x="50%" y="50%" dominant-baseline="central" text-anchor="middle">R</text></g><g id="icon-8388608" class="tsd-no-select"><rect fill="var(--color-icon-background)" stroke="var(--color-document)" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="6"></rect><g stroke="var(--color-icon-text)" fill="none" stroke-width="1.5"><polygon points="6,5 6,19 18,19, 18,10 13,5"></polygon><line x1="9" y1="9" x2="13" y2="9"></line><line x1="9" y1="12" x2="15" y2="12"></line><line x1="9" y1="15" x2="15" y2="15"></line></g></g><g id="icon-folder" class="tsd-no-select"><rect fill="var(--color-icon-background)" stroke="var(--color-document)" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="6"></rect><g stroke="var(--color-icon-text)" fill="none" stroke-width="1.5"><polygon points="5,5 10,5 12,8 19,8 19,18 5,18"></polygon></g></g><g id="icon-chevronDown" class="tsd-no-select"><path d="M4.93896 8.531L12 15.591L19.061 8.531L16.939 6.409L12 11.349L7.06098 6.409L4.93896 8.531Z" fill="var(--color-icon-text)"></path></g><g id="icon-chevronSmall" class="tsd-no-select"><path d="M1.5 5.50969L8 11.6609L14.5 5.50969L12.5466 3.66086L8 7.96494L3.45341 3.66086L1.5 5.50969Z" fill="var(--color-icon-text)"></path></g><g id="icon-checkbox" class="tsd-no-select"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></g><g id="icon-menu" class="tsd-no-select"><rect x="1" y="3" width="14" height="2" fill="var(--color-icon-text)"></rect><rect x="1" y="7" width="14" height="2" fill="var(--color-icon-text)"></rect><rect x="1" y="11" width="14" height="2" fill="var(--color-icon-text)"></rect></g><g id="icon-search" class="tsd-no-select"><path d="M15.7824 13.833L12.6666 10.7177C12.5259 10.5771 12.3353 10.499 12.1353 10.499H11.6259C12.4884 9.39596 13.001 8.00859 13.001 6.49937C13.001 2.90909 10.0914 0 6.50048 0C2.90959 0 0 2.90909 0 6.49937C0 10.0896 2.90959 12.9987 6.50048 12.9987C8.00996 12.9987 9.39756 12.4863 10.5008 11.6239V12.1332C10.5008 12.3332 10.5789 12.5238 10.7195 12.6644L13.8354 15.7797C14.1292 16.0734 14.6042 16.0734 14.8948 15.7797L15.7793 14.8954C16.0731 14.6017 16.0731 14.1267 15.7824 13.833ZM6.50048 10.499C4.29094 10.499 2.50018 8.71165 2.50018 6.49937C2.50018 4.29021 4.28781 2.49976 6.50048 2.49976C8.71001 2.49976 10.5008 4.28708 10.5008 6.49937C10.5008 8.70852 8.71314 10.499 6.50048 10.499Z" fill="var(--color-icon-text)"></path></g><g id="icon-anchor" class="tsd-no-select"><g stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M10 14a3.5 3.5 0 0 0 5 0l4 -4a3.5 3.5 0 0 0 -5 -5l-.5 .5"></path><path d="M14 10a3.5 3.5 0 0 0 -5 0l-4 4a3.5 3.5 0 0 0 5 5l.5 -.5"></path></g></g><g id="icon-alertNote" class="tsd-no-select"><path fill="var(--color-alert-note)" d="M0 8a8 8 0 1 1 16 0A8 8 0 0 1 0 8Zm8-6.5a6.5 6.5 0 1 0 0 13 6.5 6.5 0 0 0 0-13ZM6.5 7.75A.75.75 0 0 1 7.25 7h1a.75.75 0 0 1 .75.75v2.75h.25a.75.75 0 0 1 0 1.5h-2a.75.75 0 0 1 0-1.5h.25v-2h-.25a.75.75 0 0 1-.75-.75ZM8 6a1 1 0 1 1 0-2 1 1 0 0 1 0 2Z"></path></g><g id="icon-alertTip" class="tsd-no-select"><path fill="var(--color-alert-tip)" d="M8 1.5c-2.363 0-4 1.69-4 3.75 0 .984.424 1.625.984 2.304l.214.253c.223.264.47.556.673.848.284.411.537.896.621 1.49a.75.75 0 0 1-1.484.211c-.04-.282-.163-.547-.37-.847a8.456 8.456 0 0 0-.542-.68c-.084-.1-.173-.205-.268-.32C3.201 7.75 2.5 6.766 2.5 5.25 2.5 2.31 4.863 0 8 0s5.5 2.31 5.5 5.25c0 1.516-.701 2.5-1.328 3.259-.095.115-.184.22-.268.319-.207.245-.383.453-.541.681-.208.3-.33.565-.37.847a.751.751 0 0 1-1.485-.212c.084-.593.337-1.078.621-1.489.203-.292.45-.584.673-.848.075-.088.147-.173.213-.253.561-.679.985-1.32.985-2.304 0-2.06-1.637-3.75-4-3.75ZM5.75 12h4.5a.75.75 0 0 1 0 1.5h-4.5a.75.75 0 0 1 0-1.5ZM6 15.25a.75.75 0 0 1 .75-.75h2.5a.75.75 0 0 1 0 1.5h-2.5a.75.75 0 0 1-.75-.75Z"></path></g><g id="icon-alertImportant" class="tsd-no-select"><path fill="var(--color-alert-important)" d="M0 1.75C0 .784.784 0 1.75 0h12.5C15.216 0 16 .784 16 1.75v9.5A1.75 1.75 0 0 1 14.25 13H8.06l-2.573 2.573A1.458 1.458 0 0 1 3 14.543V13H1.75A1.75 1.75 0 0 1 0 11.25Zm1.75-.25a.25.25 0 0 0-.25.25v9.5c0 .138.112.25.25.25h2a.75.75 0 0 1 .75.75v2.19l2.72-2.72a.749.749 0 0 1 .53-.22h6.5a.25.25 0 0 0 .25-.25v-9.5a.25.25 0 0 0-.25-.25Zm7 2.25v2.5a.75.75 0 0 1-1.5 0v-2.5a.75.75 0 0 1 1.5 0ZM9 9a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z"></path></g><g id="icon-alertWarning" class="tsd-no-select"><path fill="var(--color-alert-warning)" d="M6.457 1.047c.659-1.234 2.427-1.234 3.086 0l6.082 11.378A1.75 1.75 0 0 1 14.082 15H1.918a1.75 1.75 0 0 1-1.543-2.575Zm1.763.707a.25.25 0 0 0-.44 0L1.698 13.132a.25.25 0 0 0 .22.368h12.164a.25.25 0 0 0 .22-.368Zm.53 3.996v2.5a.75.75 0 0 1-1.5 0v-2.5a.75.75 0 0 1 1.5 0ZM9 11a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z"></path></g><g id="icon-alertCaution" class="tsd-no-select"><path fill="var(--color-alert-caution)" d="M4.47.22A.749.749 0 0 1 5 0h6c.199 0 .389.079.53.22l4.25 4.25c.141.14.22.331.22.53v6a.749.749 0 0 1-.22.53l-4.25 4.25A.749.749 0 0 1 11 16H5a.749.749 0 0 1-.53-.22L.22 11.53A.749.749 0 0 1 0 11V5c0-.199.079-.389.22-.53Zm.84 1.28L1.5 5.31v5.38l3.81 3.81h5.38l3.81-3.81V5.31L10.69 1.5ZM8 4a.75.75 0 0 1 .75.75v3.5a.75.75 0 0 1-1.5 0v-3.5A.75.75 0 0 1 8 4Zm0 8a1 1 0 1 1 0-2 1 1 0 0 1 0 2Z"></path></g>`;
|
|
7
|
+
svg.style.display = "none";
|
|
8
|
+
if (location.protocol === "file:") updateUseElements();
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
function updateUseElements() {
|
|
12
|
+
document.querySelectorAll("use").forEach(el => {
|
|
13
|
+
if (el.getAttribute("href").includes("#icon-")) {
|
|
14
|
+
el.setAttribute("href", el.getAttribute("href").replace(/.*#/, "#"));
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
})()
|