@apple-pie/slice 0.1.6 → 0.1.7
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/cjs/chunks/{Avatar-YNcGDUzr.js → Avatar-8XLnVICd.js} +6 -4
- package/dist/cjs/chunks/{AvatarGroup-Dn5R1XIU.js → AvatarGroup-BhKZvX8M.js} +1 -1
- package/dist/cjs/chunks/{Button-Ck4syxwn.js → Button-D8_eyuOA.js} +9 -6
- package/dist/cjs/chunks/{ButtonBar-Cx9Xwddh.js → ButtonBar-DwMLfvi8.js} +11 -15
- package/dist/cjs/chunks/{Camera-BrLRwcw1.js → Camera-CxHdYGEa.js} +11 -8
- package/dist/cjs/chunks/{Card-CYDP4vAN.js → Card-D4YkmNC7.js} +5 -8
- package/dist/cjs/chunks/{CheckBox-DYG1fNWy.js → CheckBox-CmTQ6KW1.js} +9 -14
- package/dist/cjs/chunks/{Chip-CqOwsrmt.js → Chip-CwMJOnBV.js} +5 -5
- package/dist/cjs/chunks/{DivInput-C73sqUF3.js → DivInput-DdZA8S1k.js} +1 -1
- package/dist/cjs/chunks/{DocIcons-B5TcBqSH.js → DocIcons-BZI6JMyw.js} +1 -1
- package/dist/cjs/chunks/{DrggablePanel-BzvBBhS7.js → DrggablePanel-CkhCXqKv.js} +1 -1
- package/dist/cjs/chunks/{DropDown-Bo0bxkFk.js → DropDown-Ce8aU2va.js} +2 -2
- package/dist/cjs/chunks/{FileIcon-hYwcre20.js → FileIcon-CZLe2S2l.js} +3 -3
- package/dist/cjs/chunks/{FileList-bA8PoGOh.js → FileList-tivoUJSP.js} +11 -4
- package/dist/cjs/chunks/{Grouper-BszVihfB.js → Grouper-BbovOSYw.js} +8 -7
- package/dist/cjs/chunks/{_types-NyUTfBLR.js → Icon-N0YJuKQf.js} +68 -44
- package/dist/cjs/chunks/{IconButton-yWq-C437.js → IconButton-BXotgG2u.js} +9 -6
- package/dist/cjs/chunks/{Label-D15cIroT.js → Label-CZvJbATa.js} +16 -11
- package/dist/cjs/chunks/{Overlay-DL0EJDyk.js → Overlay-BX6vXX9F.js} +1 -1
- package/dist/cjs/chunks/{Pager-TUxcWbmn.js → Pager-Da9AqSFN.js} +1 -1
- package/dist/cjs/chunks/{ProgressIndicator-Dvq4eIWW.js → ProgressIndicator-opbbADog.js} +2 -2
- package/dist/cjs/chunks/{PromptInput-Hgh6995X.js → PromptInput-tA4fpOTk.js} +1 -1
- package/dist/cjs/chunks/{RadioButton-Cu-laBV5.js → RadioButton-B8GIKGm-.js} +9 -10
- package/dist/cjs/chunks/{RadioButtonList-COS7jfsC.js → RadioButtonList-3o1IvhdC.js} +11 -5
- package/dist/cjs/chunks/{SSEConnection-B_yE8cXz.js → SSEConnection-C-1OzEOp.js} +29 -15
- package/dist/cjs/chunks/{Slider-BeXrWjVx.js → Slider-CnXBacf-.js} +65 -36
- package/dist/cjs/chunks/{Switch-Xqf0vwul.js → Switch-BiTshVLM.js} +6 -3
- package/dist/cjs/chunks/{TabBar-DCRr3l9L.js → TabBar-DZ2y7owf.js} +48 -12
- package/dist/cjs/chunks/{TextArea-DM0aHGGt.js → TextArea-DXcMRUfI.js} +1 -1
- package/dist/cjs/chunks/{TextField-DQgpDpR1.js → TextField-CkfTNM6_.js} +11 -6
- package/dist/cjs/chunks/{Tip-ik8-p4_4.js → Tip-59T3TUN4.js} +1 -1
- package/dist/cjs/chunks/{Toast-D-Y1Ytnb.js → Toast-skIBuJ3b.js} +2 -2
- package/dist/cjs/chunks/{UploadArea-Y_B35qjZ.js → UploadArea-B8mJRc0a.js} +15 -10
- package/dist/cjs/chunks/{WSConnection-DCBuJGmb.js → WSConnection-DrOC8Z0R.js} +32 -23
- package/dist/cjs/chunks/_types-BD6txsj1.js +118 -0
- package/dist/cjs/chunks/{colors-uej0anrN.js → colors-njquvHkx.js} +1 -1
- package/dist/cjs/chunks/debounce-BF4i6uIC.js +18 -0
- package/dist/cjs/chunks/{misc-C-M6KKsH.js → misc-BTF7BCZW.js} +21 -12
- package/dist/cjs/chunks/{sseStore-CIIeshjm.js → sseStore-1OeJ9TRP.js} +1 -1
- package/dist/cjs/components/Avatar/index.js +2 -2
- package/dist/cjs/components/AvatarGroup/index.js +2 -2
- package/dist/cjs/components/Button/index.js +3 -3
- package/dist/cjs/components/ButtonBar/index.js +3 -3
- package/dist/cjs/components/Camera/index.js +4 -4
- package/dist/cjs/components/Card/index.js +5 -6
- package/dist/cjs/components/CheckBox/index.js +6 -7
- package/dist/cjs/components/Chip/index.js +2 -2
- package/dist/cjs/components/DivInput/index.js +2 -2
- package/dist/cjs/components/DocIcon/index.js +1 -1
- package/dist/cjs/components/DraggablePanel/index.js +2 -2
- package/dist/cjs/components/DropDown/index.js +2 -2
- package/dist/cjs/components/FileIcon/index.js +2 -2
- package/dist/cjs/components/FileList/index.js +4 -4
- package/dist/cjs/components/Grouper/index.js +3 -3
- package/dist/cjs/components/Icon/index.js +3 -8
- package/dist/cjs/components/IconButton/index.js +3 -3
- package/dist/cjs/components/Label/index.js +2 -2
- package/dist/cjs/components/Overlay/index.js +1 -1
- package/dist/cjs/components/Pager/index.js +2 -2
- package/dist/cjs/components/Progress/index.js +3 -3
- package/dist/cjs/components/PromptInput/index.js +6 -6
- package/dist/cjs/components/RadioButton/index.js +2 -2
- package/dist/cjs/components/RadioButtonList/index.js +7 -7
- package/dist/cjs/components/Slider/index.js +4 -3
- package/dist/cjs/components/Switch/index.js +1 -1
- package/dist/cjs/components/TabBar/index.js +3 -3
- package/dist/cjs/components/TextArea/index.js +6 -7
- package/dist/cjs/components/Textfield/index.js +5 -5
- package/dist/cjs/components/Tip/index.js +2 -2
- package/dist/cjs/components/Toast/index.js +2 -2
- package/dist/cjs/components/UploadArea/index.js +6 -6
- package/dist/cjs/hooks/useTrackRenders.js +1 -1
- package/dist/cjs/index.js +9 -14
- package/dist/cjs/stores/SSE.js +2 -2
- package/dist/cjs/stores/WS.js +1 -1
- package/dist/cjs/stores.js +2 -2
- package/dist/cjs/utils/index.js +4 -3
- package/dist/cjs/utils/objects/index.js +1 -1
- package/dist/esm/chunks/{Avatar-CDMV6f9w.mjs → Avatar-DGRMsHdO.mjs} +7 -5
- package/dist/esm/chunks/{AvatarGroup-BZ18GwhK.mjs → AvatarGroup-C9Ka1e9P.mjs} +1 -1
- package/dist/esm/chunks/{Button-DexmN81C.mjs → Button-DAvVj4YV.mjs} +8 -5
- package/dist/esm/chunks/{ButtonBar-C-LwBxlY.mjs → ButtonBar-Cw73kooJ.mjs} +11 -15
- package/dist/esm/chunks/{Camera-DdUBZi52.mjs → Camera-BrdJGlv6.mjs} +12 -9
- package/dist/esm/chunks/{Card-DUfnTA5v.mjs → Card-DGlv1PII.mjs} +4 -7
- package/dist/esm/chunks/{CheckBox-Bnd3UAt0.mjs → CheckBox-B7UCZvRv.mjs} +9 -14
- package/dist/esm/chunks/{Chip-BJS4oJBL.mjs → Chip-BPF7fBba.mjs} +5 -3
- package/dist/esm/chunks/{DivInput-B7BliU1p.mjs → DivInput-Ch9XjfWd.mjs} +1 -1
- package/dist/esm/chunks/{DocIcons-BxtcXsWI.mjs → DocIcons-B4xsPrXM.mjs} +1 -1
- package/dist/esm/chunks/{DrggablePanel-DvactFf5.mjs → DrggablePanel-Ddi0vPRp.mjs} +1 -1
- package/dist/esm/chunks/{DropDown-CbX16ETP.mjs → DropDown-Cvf2d_3u.mjs} +1 -1
- package/dist/esm/chunks/{FileIcon-CC_k5dUW.mjs → FileIcon-ePouoJpT.mjs} +3 -3
- package/dist/esm/chunks/{FileList-E5uvcN2J.mjs → FileList-BHCGzX_0.mjs} +11 -6
- package/dist/esm/chunks/{Grouper-X9OursiT.mjs → Grouper-B_FutfjV.mjs} +6 -5
- package/dist/esm/chunks/{_types-C8GP_aSD.mjs → Icon-C92f63Ib.mjs} +69 -46
- package/dist/esm/chunks/{IconButton-B5WEf-v5.mjs → IconButton-4O5S9S9G.mjs} +9 -6
- package/dist/esm/chunks/{Label-DOvquc82.mjs → Label-7ezP3eHw.mjs} +16 -11
- package/dist/esm/chunks/{Overlay-Cw9o1fHb.mjs → Overlay-TOzZXnwF.mjs} +1 -1
- package/dist/esm/chunks/{Pager-BX4TMwD_.mjs → Pager-BlLYeA2F.mjs} +1 -1
- package/dist/esm/chunks/{ProgressIndicator-DeLwB3Rb.mjs → ProgressIndicator-BVwQNOcV.mjs} +1 -1
- package/dist/esm/chunks/{PromptInput-BdMotrXA.mjs → PromptInput-pKwwzyAd.mjs} +2 -2
- package/dist/esm/chunks/{RadioButton-D6kP8p0n.mjs → RadioButton-COEnChNW.mjs} +9 -10
- package/dist/esm/chunks/{RadioButtonList-guQECpwi.mjs → RadioButtonList-De3rbLQb.mjs} +12 -6
- package/dist/esm/chunks/{SSEConnection-Dj9P0SWE.mjs → SSEConnection-DcA3wFsO.mjs} +29 -14
- package/dist/esm/chunks/{Slider-ZuSvETfo.mjs → Slider-DL2iuNlh.mjs} +69 -34
- package/dist/esm/chunks/{Switch-nWg2Ykea.mjs → Switch-Cv6LABsW.mjs} +6 -3
- package/dist/esm/chunks/{TabBar-BYtGaj_A.mjs → TabBar-qiozE5zA.mjs} +49 -13
- package/dist/esm/chunks/{TextArea-D88dZrXm.mjs → TextArea-yF2pGeel.mjs} +1 -1
- package/dist/esm/chunks/{TextField-DvTB_JoS.mjs → TextField-CgnPj6oK.mjs} +11 -6
- package/dist/esm/chunks/{Tip-B-cDOFvV.mjs → Tip-CroDIKO4.mjs} +1 -1
- package/dist/esm/chunks/{Toast-BdlopzJ6.mjs → Toast-CM493gMR.mjs} +2 -2
- package/dist/esm/chunks/{UploadArea--i-bbRIJ.mjs → UploadArea-BNf1y8Ep.mjs} +18 -13
- package/dist/esm/chunks/{WSConnection-DlYSitff.mjs → WSConnection-D9mpsVdc.mjs} +32 -23
- package/dist/esm/chunks/_types-C2C2Zwd0.mjs +118 -0
- package/dist/esm/chunks/{colors-DR9fLI5X.mjs → colors-FQ0uNQcW.mjs} +2 -2
- package/dist/esm/chunks/debounce-Bst1jxMS.mjs +19 -0
- package/dist/esm/chunks/{misc-cg9I7drO.mjs → misc-N8KLjOXc.mjs} +22 -12
- package/dist/esm/chunks/{sseStore-DdqmnAAf.mjs → sseStore-2JIpEKfz.mjs} +1 -1
- package/dist/esm/components/Avatar/index.mjs +2 -2
- package/dist/esm/components/AvatarGroup/index.mjs +3 -3
- package/dist/esm/components/Button/index.mjs +4 -4
- package/dist/esm/components/ButtonBar/index.mjs +4 -4
- package/dist/esm/components/Camera/index.mjs +5 -5
- package/dist/esm/components/Card/index.mjs +3 -3
- package/dist/esm/components/CheckBox/index.mjs +5 -5
- package/dist/esm/components/Chip/index.mjs +3 -3
- package/dist/esm/components/DivInput/index.mjs +2 -2
- package/dist/esm/components/DocIcon/index.mjs +1 -1
- package/dist/esm/components/DraggablePanel/index.mjs +2 -2
- package/dist/esm/components/DropDown/index.mjs +3 -3
- package/dist/esm/components/FileIcon/index.mjs +2 -2
- package/dist/esm/components/FileList/index.mjs +5 -5
- package/dist/esm/components/Grouper/index.mjs +3 -3
- package/dist/esm/components/Icon/index.mjs +4 -2
- package/dist/esm/components/IconButton/index.mjs +3 -3
- package/dist/esm/components/Label/index.mjs +2 -2
- package/dist/esm/components/Overlay/index.mjs +1 -1
- package/dist/esm/components/Pager/index.mjs +2 -2
- package/dist/esm/components/Progress/index.mjs +3 -3
- package/dist/esm/components/PromptInput/index.mjs +7 -7
- package/dist/esm/components/RadioButton/index.mjs +3 -3
- package/dist/esm/components/RadioButtonList/index.mjs +4 -4
- package/dist/esm/components/Slider/index.mjs +4 -2
- package/dist/esm/components/Switch/index.mjs +1 -1
- package/dist/esm/components/TabBar/index.mjs +4 -4
- package/dist/esm/components/TextArea/index.mjs +5 -5
- package/dist/esm/components/Textfield/index.mjs +6 -6
- package/dist/esm/components/Tip/index.mjs +2 -2
- package/dist/esm/components/Toast/index.mjs +3 -3
- package/dist/esm/components/UploadArea/index.mjs +6 -6
- package/dist/esm/hooks/useTrackRenders.mjs +1 -1
- package/dist/esm/index.mjs +38 -34
- package/dist/esm/stores/SSE.mjs +2 -2
- package/dist/esm/stores/WS.mjs +1 -1
- package/dist/esm/stores.mjs +2 -2
- package/dist/esm/utils/index.mjs +6 -4
- package/dist/esm/utils/objects/index.mjs +2 -2
- package/dist/types/components/Button/Button.d.ts +3 -3
- package/dist/types/components/Button/_types.d.ts +2 -2
- package/dist/types/components/Camera/_types.d.ts +1 -0
- package/dist/types/components/Card/_types.d.ts +1 -1
- package/dist/types/components/Chip/_types.d.ts +1 -2
- package/dist/types/components/Grouper/_types.d.ts +1 -1
- package/dist/types/components/Icon/_types.d.ts +116 -83
- package/dist/types/components/Icon/index.d.ts +1 -1
- package/dist/types/components/IconButton/_types.d.ts +2 -2
- package/dist/types/components/Label/_types.d.ts +1 -1
- package/dist/types/components/RadioButton/_types.d.ts +2 -1
- package/dist/types/components/Switch/_types.d.ts +1 -1
- package/dist/types/components/TabBar/_types.d.ts +2 -0
- package/dist/types/index.d.ts +1 -1
- package/dist/types/utils/functions/colors.d.ts +2 -2
- package/dist/types/utils/functions/debounce.d.ts +1 -2
- package/dist/types/utils/functions/files.d.ts +7 -1
- package/dist/types/utils/functions/misc.d.ts +19 -11
- package/dist/types/utils/index.d.ts +3 -2
- package/dist/types/utils/objects/SSEConnection/SSEConnection.d.ts +29 -8
- package/dist/types/utils/objects/WSConnection/WSConnection.d.ts +32 -20
- package/package.json +1 -1
|
@@ -38,6 +38,9 @@ interface WSConnectionStandardOptions<TMessage = unknown> extends WSConnectionOp
|
|
|
38
38
|
onMessageCallback?: WSStandardMessageCallback<TMessage>;
|
|
39
39
|
}
|
|
40
40
|
export type WSConnectionOptions<TMessage = unknown> = WSConnectionStandardOptions<TMessage> | WSConnectionUnifiedOptions<TMessage>;
|
|
41
|
+
/**
|
|
42
|
+
* Manage a WebSocket connection with optional unified events, retries, and keep-alive pings.
|
|
43
|
+
*/
|
|
41
44
|
export declare class WSConnection<TMessage = unknown> {
|
|
42
45
|
private readonly url;
|
|
43
46
|
private readonly autoReconnect;
|
|
@@ -57,90 +60,99 @@ export declare class WSConnection<TMessage = unknown> {
|
|
|
57
60
|
private reconnectIntervalTimer;
|
|
58
61
|
private reconnectAttemptsCount;
|
|
59
62
|
private manuallyClosed;
|
|
63
|
+
/**
|
|
64
|
+
* Report whether the underlying socket is currently open.
|
|
65
|
+
*/
|
|
60
66
|
get connected(): boolean;
|
|
67
|
+
/**
|
|
68
|
+
* Expose the underlying WebSocket instance.
|
|
69
|
+
*/
|
|
61
70
|
get connection(): WebSocket | null;
|
|
71
|
+
/**
|
|
72
|
+
* Initialize the socket connection and configure its runtime options.
|
|
73
|
+
*/
|
|
62
74
|
constructor(options: WSConnectionOptions<TMessage>);
|
|
63
75
|
/**
|
|
64
|
-
*
|
|
76
|
+
* Send a string or JSON-serializable payload through the socket.
|
|
65
77
|
*/
|
|
66
78
|
send(message: unknown): void;
|
|
67
79
|
/**
|
|
68
|
-
*
|
|
80
|
+
* Close the socket intentionally and stop any reconnect attempts.
|
|
69
81
|
*/
|
|
70
82
|
close(closeEvent: {
|
|
71
83
|
code: number;
|
|
72
84
|
reason: string;
|
|
73
85
|
}): void;
|
|
74
86
|
/**
|
|
75
|
-
* Emit
|
|
87
|
+
* Emit parsed message data when standard callback mode is enabled.
|
|
76
88
|
*/
|
|
77
89
|
private emitParsedMessage;
|
|
78
90
|
/**
|
|
79
|
-
* Emit a unified
|
|
91
|
+
* Emit a unified event object when unified callback mode is enabled.
|
|
80
92
|
*/
|
|
81
93
|
private emitUnifiedMessage;
|
|
82
94
|
/**
|
|
83
|
-
*
|
|
95
|
+
* Forward an error event through both direct and unified callbacks.
|
|
84
96
|
*/
|
|
85
97
|
private emitErrorEvent;
|
|
86
98
|
/**
|
|
87
|
-
*
|
|
99
|
+
* Parse incoming message data, falling back to raw socket payloads when needed.
|
|
88
100
|
*/
|
|
89
101
|
private parseEventData;
|
|
90
102
|
/**
|
|
91
|
-
*
|
|
103
|
+
* Initialize connection state after the socket opens.
|
|
92
104
|
*/
|
|
93
105
|
private readonly onOpen;
|
|
94
106
|
/**
|
|
95
|
-
*
|
|
107
|
+
* Parse and emit each incoming socket message.
|
|
96
108
|
*/
|
|
97
109
|
private readonly onMessage;
|
|
98
110
|
/**
|
|
99
|
-
*
|
|
111
|
+
* Clean up the socket and trigger reconnect logic after unexpected closes.
|
|
100
112
|
*/
|
|
101
113
|
private readonly onClose;
|
|
102
114
|
/**
|
|
103
|
-
*
|
|
115
|
+
* Normalize socket errors before forwarding them to consumers.
|
|
104
116
|
*/
|
|
105
117
|
private readonly onError;
|
|
106
118
|
/**
|
|
107
|
-
* Attach
|
|
119
|
+
* Attach the connection lifecycle listeners to the current socket.
|
|
108
120
|
*/
|
|
109
121
|
private attachEventListeners;
|
|
110
122
|
/**
|
|
111
|
-
*
|
|
123
|
+
* Start periodic ping messages to keep the socket active.
|
|
112
124
|
*/
|
|
113
125
|
private setKeepAlive;
|
|
114
126
|
/**
|
|
115
|
-
*
|
|
127
|
+
* Stop the active keep-alive timer if one is running.
|
|
116
128
|
*/
|
|
117
129
|
private clearKeepAliveTimer;
|
|
118
130
|
/**
|
|
119
|
-
*
|
|
131
|
+
* Stop the active reconnect timer if one is running.
|
|
120
132
|
*/
|
|
121
133
|
private clearReconnectTimer;
|
|
122
134
|
/**
|
|
123
|
-
*
|
|
135
|
+
* Detach all lifecycle listeners from the current socket.
|
|
124
136
|
*/
|
|
125
137
|
private detachEventListeners;
|
|
126
138
|
/**
|
|
127
|
-
*
|
|
139
|
+
* Open a new socket connection when one is not already active.
|
|
128
140
|
*/
|
|
129
141
|
private connect;
|
|
130
142
|
/**
|
|
131
|
-
*
|
|
143
|
+
* Schedule the next reconnect attempt when reconnects are allowed.
|
|
132
144
|
*/
|
|
133
145
|
private reconnect;
|
|
134
146
|
/**
|
|
135
|
-
* Calculate reconnect delay
|
|
147
|
+
* Calculate the reconnect delay, optionally using exponential backoff.
|
|
136
148
|
*/
|
|
137
149
|
private getReconnectDelay;
|
|
138
150
|
/**
|
|
139
|
-
*
|
|
151
|
+
* Decide whether a close event should trigger a reconnect attempt.
|
|
140
152
|
*/
|
|
141
153
|
private shouldReconnect;
|
|
142
154
|
/**
|
|
143
|
-
*
|
|
155
|
+
* Close the current socket instance and release its timers and listeners.
|
|
144
156
|
*/
|
|
145
157
|
private closeSocket;
|
|
146
158
|
}
|