@brightspot/ui 1.2.0 → 1.4.0
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/components/copy-to-clipboard/CopyToClipboard.d.ts +57 -0
- package/dist/components/copy-to-clipboard/CopyToClipboard.d.ts.map +1 -0
- package/dist/components/copy-to-clipboard/CopyToClipboard.js +84 -0
- package/dist/components/copy-to-clipboard/CopyToClipboard.js.map +1 -0
- package/dist/custom-elements.json +114 -0
- package/dist/global.d.ts +10 -0
- package/dist/storybook/assets/{Avatar.stories-BlxrclP0.js → Avatar.stories-DrhezTR1.js} +2 -2
- package/dist/storybook/assets/{AvatarGroup.stories-E3VUvBae.js → AvatarGroup.stories-DrlxT-mF.js} +1 -1
- package/dist/storybook/assets/{Badge.stories-f4YvPz0W.js → Badge.stories-DtJcBfOR.js} +1 -1
- package/dist/storybook/assets/{Button.stories-N66xrq4q.js → Button.stories-BKUfLgSY.js} +1 -1
- package/dist/storybook/assets/{CircularProgress.stories-zWyELtfc.js → CircularProgress.stories-dpmD-XJT.js} +1 -1
- package/dist/storybook/assets/ClipboardMixin.stories-C0pnQ7BY.js +228 -0
- package/dist/storybook/assets/Color-64QXVMR3-Dnd9S2a1.js +1 -0
- package/dist/storybook/assets/{Colors.stories-nEoNeHhf.js → Colors.stories-bKK25qgF.js} +1 -1
- package/dist/storybook/assets/ComponentStatesMixin-C2HZ9ZFb.js +1 -0
- package/dist/storybook/assets/ComponentStatesMixin.stories-9mRp2zuB.js +313 -0
- package/dist/storybook/assets/CopyToClipboard.stories-BW3oaT1i.js +277 -0
- package/dist/storybook/assets/Debounce.stories-BXx3CKvQ.js +199 -0
- package/dist/storybook/assets/{Events.stories-BP3ensxX.js → Events.stories-PBeiuWQn.js} +1 -1
- package/dist/storybook/assets/{Heading.stories-DGqWaBpi.js → Heading.stories-Djkl0MoC.js} +1 -1
- package/dist/storybook/assets/{Icon.stories-BWWjh4NZ.js → Icon.stories-Cam1fyud.js} +1 -1
- package/dist/storybook/assets/{LinearProgress.stories-DMVolkoE.js → LinearProgress.stories-BDNoYIJu.js} +1 -1
- package/dist/storybook/assets/Rtc.stories-BrTAIAi1.js +281 -0
- package/dist/storybook/assets/{ScrollShadow.stories-BmwSRNje.js → ScrollShadow.stories-DHcKhkag.js} +1 -1
- package/dist/storybook/assets/{Throttle.stories-DBj-9rhV.js → Throttle.stories-cSYT_BXu.js} +1 -1
- package/dist/storybook/assets/{WithTooltip-SK46ZJ2J-DW4NXFWt.js → WithTooltip-SK46ZJ2J-Df0E-KJO.js} +43 -43
- package/dist/storybook/assets/_commonjsHelpers-CqkleIqs.js +1 -0
- package/dist/storybook/assets/formatter-OMEEQ6HG-DFa_WTfb.js +1 -0
- package/dist/storybook/assets/{iframe-CxsKJSj-.css → iframe-BMxUFmpF.css} +1 -1
- package/dist/storybook/assets/{iframe-Z4F0Cgki.js → iframe-lTczLWsL.js} +76 -76
- package/dist/storybook/assets/index-yMswRDPh.js +1 -0
- package/dist/storybook/assets/onFind-C6olvKHR.js +1 -0
- package/dist/storybook/assets/onFind.stories-DfW54CDE.js +284 -0
- package/dist/storybook/assets/onRemove.stories-C7W9KyRr.js +234 -0
- package/dist/storybook/assets/onVisible.stories-CIl6R0q4.js +187 -0
- package/dist/storybook/assets/syntaxhighlighter-CAVLW7PM-DoI0ixeu.js +6 -0
- package/dist/storybook/iframe.html +2 -2
- package/dist/storybook/index.json +1 -1
- package/dist/storybook/project.json +1 -1
- package/dist/tailwind-plugin-button.js +3 -0
- package/dist/tailwind-plugin-button.js.map +1 -1
- package/dist/tailwind-plugin-button.ts +4 -0
- package/dist/util/ClipboardMixin.d.ts +39 -0
- package/dist/util/ClipboardMixin.d.ts.map +1 -0
- package/dist/util/ClipboardMixin.js +77 -0
- package/dist/util/ClipboardMixin.js.map +1 -0
- package/dist/util/ComponentStatesMixin.d.ts +54 -0
- package/dist/util/ComponentStatesMixin.d.ts.map +1 -0
- package/dist/util/ComponentStatesMixin.js +58 -0
- package/dist/util/ComponentStatesMixin.js.map +1 -0
- package/dist/util/EventEmitterMixin.d.ts +5 -3
- package/dist/util/EventEmitterMixin.d.ts.map +1 -1
- package/dist/util/EventEmitterMixin.js.map +1 -1
- package/dist/util/Socket.d.ts +29 -0
- package/dist/util/Socket.d.ts.map +1 -0
- package/dist/util/Socket.js +153 -0
- package/dist/util/Socket.js.map +1 -0
- package/dist/util/Tether.d.ts +18 -0
- package/dist/util/Tether.d.ts.map +1 -0
- package/dist/util/Tether.js +102 -0
- package/dist/util/Tether.js.map +1 -0
- package/dist/util/TetherLayout.d.ts +12 -0
- package/dist/util/TetherLayout.d.ts.map +1 -0
- package/dist/util/TetherLayout.js +121 -0
- package/dist/util/TetherLayout.js.map +1 -0
- package/dist/util/debounce.d.ts +3 -0
- package/dist/util/debounce.d.ts.map +1 -0
- package/dist/util/debounce.js +15 -0
- package/dist/util/debounce.js.map +1 -0
- package/dist/util/focusable.d.ts +9 -0
- package/dist/util/focusable.d.ts.map +1 -0
- package/dist/util/focusable.js +19 -0
- package/dist/util/focusable.js.map +1 -0
- package/dist/util/getComponentKey.d.ts +2 -0
- package/dist/util/getComponentKey.d.ts.map +1 -0
- package/dist/util/getComponentKey.js +21 -0
- package/dist/util/getComponentKey.js.map +1 -0
- package/dist/util/keyboard.d.ts +8 -0
- package/dist/util/keyboard.d.ts.map +1 -0
- package/dist/util/keyboard.js +138 -0
- package/dist/util/keyboard.js.map +1 -0
- package/dist/util/noise.d.ts +6 -0
- package/dist/util/noise.d.ts.map +1 -0
- package/dist/util/noise.js +43 -0
- package/dist/util/noise.js.map +1 -0
- package/dist/util/onFind.d.ts +11 -0
- package/dist/util/onFind.d.ts.map +1 -0
- package/dist/util/onFind.js +210 -0
- package/dist/util/onFind.js.map +1 -0
- package/dist/util/onFindOnce.d.ts +3 -0
- package/dist/util/onFindOnce.d.ts.map +1 -0
- package/dist/util/onFindOnce.js +25 -0
- package/dist/util/onFindOnce.js.map +1 -0
- package/dist/util/onRTEReady.d.ts +22 -0
- package/dist/util/onRTEReady.d.ts.map +1 -0
- package/dist/util/onRTEReady.js +69 -0
- package/dist/util/onRTEReady.js.map +1 -0
- package/dist/util/onRemove.d.ts +7 -0
- package/dist/util/onRemove.d.ts.map +1 -0
- package/dist/util/onRemove.js +24 -0
- package/dist/util/onRemove.js.map +1 -0
- package/dist/util/onVisible.d.ts +3 -0
- package/dist/util/onVisible.d.ts.map +1 -0
- package/dist/util/onVisible.js +22 -0
- package/dist/util/onVisible.js.map +1 -0
- package/dist/util/previousUntil.d.ts +2 -0
- package/dist/util/previousUntil.d.ts.map +1 -0
- package/dist/util/previousUntil.js +21 -0
- package/dist/util/previousUntil.js.map +1 -0
- package/dist/util/repaint.d.ts +3 -0
- package/dist/util/repaint.d.ts.map +1 -0
- package/dist/util/repaint.js +14 -0
- package/dist/util/repaint.js.map +1 -0
- package/dist/util/rtc.d.ts +10 -0
- package/dist/util/rtc.d.ts.map +1 -0
- package/dist/util/rtc.js +184 -0
- package/dist/util/rtc.js.map +1 -0
- package/dist/util/storage.d.ts +6 -0
- package/dist/util/storage.d.ts.map +1 -0
- package/dist/util/storage.js +18 -0
- package/dist/util/storage.js.map +1 -0
- package/dist/util/transition.d.ts +2 -0
- package/dist/util/transition.d.ts.map +1 -0
- package/dist/util/transition.js +4 -0
- package/dist/util/transition.js.map +1 -0
- package/dist/util/types.d.ts +10 -0
- package/dist/util/types.d.ts.map +1 -0
- package/dist/util/types.js +2 -0
- package/dist/util/types.js.map +1 -0
- package/package.json +7 -2
- package/dist/storybook/assets/Color-64QXVMR3-B3Y5c9dl.js +0 -1
- package/dist/storybook/assets/formatter-OMEEQ6HG-BBn014aZ.js +0 -1
- package/dist/storybook/assets/index-BUj5S-B7.js +0 -1
- package/dist/storybook/assets/syntaxhighlighter-CAVLW7PM-CsQveU1N.js +0 -6
|
@@ -0,0 +1,281 @@
|
|
|
1
|
+
import{x as o}from"./iframe-lTczLWsL.js";import"./preload-helper-PPVm8Dsz.js";const r={title:"Utilities/RTC",tags:["autodocs"],parameters:{docs:{subtitle:"The `rtc` module provides real-time communication between browser tabs and the Brightspot CMS server. Uses BroadcastChannel for cross-tab coordination with leader election, and Server-Sent Events for server communication."},controls:{expanded:!0}}},e={render:()=>o`
|
|
2
|
+
<div class="space-y-6 text-sm">
|
|
3
|
+
<div>
|
|
4
|
+
<h3 class="mb-2 font-bold">Overview</h3>
|
|
5
|
+
<p class="mb-4 text-gray-700">
|
|
6
|
+
The RTC module manages real-time updates between the CMS server and multiple browser tabs. It uses a
|
|
7
|
+
leader-election pattern so only one tab maintains a server connection, then broadcasts messages to other tabs
|
|
8
|
+
via BroadcastChannel.
|
|
9
|
+
</p>
|
|
10
|
+
</div>
|
|
11
|
+
|
|
12
|
+
<div class="rounded border border-gray-200 bg-gray-50 p-4">
|
|
13
|
+
<h4 class="mb-2 font-bold">Architecture Diagram</h4>
|
|
14
|
+
<pre class="text-xs leading-relaxed text-gray-700">
|
|
15
|
+
┌─────────────────────────────────────────────────┐
|
|
16
|
+
│ CMS Server │
|
|
17
|
+
│ (Server-Sent Events) │
|
|
18
|
+
└────────────────────┬────────────────────────────┘
|
|
19
|
+
│
|
|
20
|
+
┌──────┴──────┐
|
|
21
|
+
│ Leader Tab │ ← Socket connection
|
|
22
|
+
│ (Tab 1) │
|
|
23
|
+
└──────┬──────┘
|
|
24
|
+
│ BroadcastChannel
|
|
25
|
+
┌──────────┼──────────┐
|
|
26
|
+
│ │ │
|
|
27
|
+
┌────┴───┐ ┌───┴────┐ ┌──┴─────┐
|
|
28
|
+
│ Tab 2 │ │ Tab 3 │ │ Tab 4 │
|
|
29
|
+
└────────┘ └────────┘ └────────┘</pre
|
|
30
|
+
>
|
|
31
|
+
</div>
|
|
32
|
+
|
|
33
|
+
<div>
|
|
34
|
+
<h3 class="mb-2 font-bold">Key Concepts</h3>
|
|
35
|
+
<ul class="list-inside list-disc space-y-1 text-gray-700">
|
|
36
|
+
<li><strong>Leader election</strong>: One tab owns the server connection; others communicate through it</li>
|
|
37
|
+
<li>
|
|
38
|
+
<strong>State restore</strong>: When connecting, each tab restores its subscribed states from the server
|
|
39
|
+
</li>
|
|
40
|
+
<li><strong>Broadcasts</strong>: Server pushes events (publish, assignment, conversation) to all tabs</li>
|
|
41
|
+
<li>
|
|
42
|
+
<strong>Graceful degradation</strong>: When RTC is disabled or no user session exists, all methods become
|
|
43
|
+
no-ops
|
|
44
|
+
</li>
|
|
45
|
+
</ul>
|
|
46
|
+
</div>
|
|
47
|
+
</div>
|
|
48
|
+
`,parameters:{docs:{description:{story:"High-level architecture of the RTC (Real-Time Communication) system."}}}},t={render:()=>o`
|
|
49
|
+
<div class="space-y-4 text-sm">
|
|
50
|
+
<div>
|
|
51
|
+
<h3 class="mb-2 font-bold">Receiving Broadcasts</h3>
|
|
52
|
+
<pre
|
|
53
|
+
class="overflow-x-auto rounded bg-gray-900 p-4 text-gray-100"
|
|
54
|
+
><code>import rtc from '@brightspot/ui/dist/util/rtc.js'
|
|
55
|
+
|
|
56
|
+
// Listen for content publish events
|
|
57
|
+
rtc.receive('com.psddev.cms.tool.page.content.PublishBroadcast', (data) => {
|
|
58
|
+
console.log('Content published:', data)
|
|
59
|
+
refreshContent()
|
|
60
|
+
})
|
|
61
|
+
|
|
62
|
+
// Listen once (single-fire)
|
|
63
|
+
rtc.receiveOnce('com.psddev.cms.conversation.PostBroadcast', () => {
|
|
64
|
+
showNotification('New conversation post')
|
|
65
|
+
})</code></pre>
|
|
66
|
+
</div>
|
|
67
|
+
|
|
68
|
+
<div>
|
|
69
|
+
<h3 class="mb-2 font-bold">State Management</h3>
|
|
70
|
+
<pre
|
|
71
|
+
class="overflow-x-auto rounded bg-gray-900 p-4 text-gray-100"
|
|
72
|
+
><code>// Initialize a stateful connection (auto-disconnects on page unload)
|
|
73
|
+
rtc.initialize('com.example.MyState', { id: '123' }, () => {
|
|
74
|
+
console.log('State restored from server')
|
|
75
|
+
})
|
|
76
|
+
|
|
77
|
+
// Restore state without unload handling
|
|
78
|
+
rtc.restore('com.example.MyState', { id: '123' }, () => {
|
|
79
|
+
console.log('State restored')
|
|
80
|
+
})</code></pre>
|
|
81
|
+
</div>
|
|
82
|
+
|
|
83
|
+
<div>
|
|
84
|
+
<h3 class="mb-2 font-bold">Executing Actions</h3>
|
|
85
|
+
<pre class="overflow-x-auto rounded bg-gray-900 p-4 text-gray-100"><code>// Send an action to the server
|
|
86
|
+
rtc.execute('com.example.MyAction', { id: '123', value: 'updated' })</code></pre>
|
|
87
|
+
</div>
|
|
88
|
+
|
|
89
|
+
<div>
|
|
90
|
+
<h3 class="mb-2 font-bold">API Reference</h3>
|
|
91
|
+
<ul class="space-y-2">
|
|
92
|
+
<li>
|
|
93
|
+
<code class="rounded bg-gray-200 px-1">rtc.initialize(state, data, callback)</code> — Connect to server
|
|
94
|
+
state with automatic unload cleanup
|
|
95
|
+
</li>
|
|
96
|
+
<li>
|
|
97
|
+
<code class="rounded bg-gray-200 px-1">rtc.restore(state, data, callback)</code> — Restore state from server
|
|
98
|
+
without unload handling
|
|
99
|
+
</li>
|
|
100
|
+
<li>
|
|
101
|
+
<code class="rounded bg-gray-200 px-1">rtc.receive(broadcast, callback)</code> — Subscribe to broadcast
|
|
102
|
+
events (fires on every occurrence)
|
|
103
|
+
</li>
|
|
104
|
+
<li>
|
|
105
|
+
<code class="rounded bg-gray-200 px-1">rtc.receiveOnce(broadcast, callback)</code> — Subscribe to a
|
|
106
|
+
broadcast event (fires once)
|
|
107
|
+
</li>
|
|
108
|
+
<li>
|
|
109
|
+
<code class="rounded bg-gray-200 px-1">rtc.execute(action, data)</code> — Send an action to the server
|
|
110
|
+
</li>
|
|
111
|
+
</ul>
|
|
112
|
+
</div>
|
|
113
|
+
|
|
114
|
+
<div>
|
|
115
|
+
<h3 class="mb-2 font-bold">Configuration</h3>
|
|
116
|
+
<ul class="list-inside list-disc space-y-1 text-gray-700">
|
|
117
|
+
<li>
|
|
118
|
+
<code class="rounded bg-gray-200 px-1">window.DISABLE_RTC</code> — Set to
|
|
119
|
+
<code class="rounded bg-gray-200 px-1">true</code> to disable all RTC functionality
|
|
120
|
+
</li>
|
|
121
|
+
<li>
|
|
122
|
+
<code class="rounded bg-gray-200 px-1">window.ROOT_PATH</code> — Server root path for the
|
|
123
|
+
<code class="rounded bg-gray-200 px-1">/_rtc</code> endpoint
|
|
124
|
+
</li>
|
|
125
|
+
<li>
|
|
126
|
+
<code class="rounded bg-gray-200 px-1">data-user-id</code> on
|
|
127
|
+
<code class="rounded bg-gray-200 px-1"><html></code> — Required for RTC to activate
|
|
128
|
+
</li>
|
|
129
|
+
</ul>
|
|
130
|
+
</div>
|
|
131
|
+
</div>
|
|
132
|
+
`,parameters:{docs:{description:{story:"Code examples and API documentation for the RTC module."}}}};e.parameters={...e.parameters,docs:{...e.parameters?.docs,source:{originalSource:`{
|
|
133
|
+
render: () => html\`
|
|
134
|
+
<div class="space-y-6 text-sm">
|
|
135
|
+
<div>
|
|
136
|
+
<h3 class="mb-2 font-bold">Overview</h3>
|
|
137
|
+
<p class="mb-4 text-gray-700">
|
|
138
|
+
The RTC module manages real-time updates between the CMS server and multiple browser tabs. It uses a
|
|
139
|
+
leader-election pattern so only one tab maintains a server connection, then broadcasts messages to other tabs
|
|
140
|
+
via BroadcastChannel.
|
|
141
|
+
</p>
|
|
142
|
+
</div>
|
|
143
|
+
|
|
144
|
+
<div class="rounded border border-gray-200 bg-gray-50 p-4">
|
|
145
|
+
<h4 class="mb-2 font-bold">Architecture Diagram</h4>
|
|
146
|
+
<pre class="text-xs leading-relaxed text-gray-700">
|
|
147
|
+
┌─────────────────────────────────────────────────┐
|
|
148
|
+
│ CMS Server │
|
|
149
|
+
│ (Server-Sent Events) │
|
|
150
|
+
└────────────────────┬────────────────────────────┘
|
|
151
|
+
│
|
|
152
|
+
┌──────┴──────┐
|
|
153
|
+
│ Leader Tab │ ← Socket connection
|
|
154
|
+
│ (Tab 1) │
|
|
155
|
+
└──────┬──────┘
|
|
156
|
+
│ BroadcastChannel
|
|
157
|
+
┌──────────┼──────────┐
|
|
158
|
+
│ │ │
|
|
159
|
+
┌────┴───┐ ┌───┴────┐ ┌──┴─────┐
|
|
160
|
+
│ Tab 2 │ │ Tab 3 │ │ Tab 4 │
|
|
161
|
+
└────────┘ └────────┘ └────────┘</pre
|
|
162
|
+
>
|
|
163
|
+
</div>
|
|
164
|
+
|
|
165
|
+
<div>
|
|
166
|
+
<h3 class="mb-2 font-bold">Key Concepts</h3>
|
|
167
|
+
<ul class="list-inside list-disc space-y-1 text-gray-700">
|
|
168
|
+
<li><strong>Leader election</strong>: One tab owns the server connection; others communicate through it</li>
|
|
169
|
+
<li>
|
|
170
|
+
<strong>State restore</strong>: When connecting, each tab restores its subscribed states from the server
|
|
171
|
+
</li>
|
|
172
|
+
<li><strong>Broadcasts</strong>: Server pushes events (publish, assignment, conversation) to all tabs</li>
|
|
173
|
+
<li>
|
|
174
|
+
<strong>Graceful degradation</strong>: When RTC is disabled or no user session exists, all methods become
|
|
175
|
+
no-ops
|
|
176
|
+
</li>
|
|
177
|
+
</ul>
|
|
178
|
+
</div>
|
|
179
|
+
</div>
|
|
180
|
+
\`,
|
|
181
|
+
parameters: {
|
|
182
|
+
docs: {
|
|
183
|
+
description: {
|
|
184
|
+
story: \`High-level architecture of the RTC (Real-Time Communication) system.\`
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
}`,...e.parameters?.docs?.source}}};t.parameters={...t.parameters,docs:{...t.parameters?.docs,source:{originalSource:`{
|
|
189
|
+
render: () => html\`
|
|
190
|
+
<div class="space-y-4 text-sm">
|
|
191
|
+
<div>
|
|
192
|
+
<h3 class="mb-2 font-bold">Receiving Broadcasts</h3>
|
|
193
|
+
<pre
|
|
194
|
+
class="overflow-x-auto rounded bg-gray-900 p-4 text-gray-100"
|
|
195
|
+
><code>import rtc from '@brightspot/ui/dist/util/rtc.js'
|
|
196
|
+
|
|
197
|
+
// Listen for content publish events
|
|
198
|
+
rtc.receive('com.psddev.cms.tool.page.content.PublishBroadcast', (data) => {
|
|
199
|
+
console.log('Content published:', data)
|
|
200
|
+
refreshContent()
|
|
201
|
+
})
|
|
202
|
+
|
|
203
|
+
// Listen once (single-fire)
|
|
204
|
+
rtc.receiveOnce('com.psddev.cms.conversation.PostBroadcast', () => {
|
|
205
|
+
showNotification('New conversation post')
|
|
206
|
+
})</code></pre>
|
|
207
|
+
</div>
|
|
208
|
+
|
|
209
|
+
<div>
|
|
210
|
+
<h3 class="mb-2 font-bold">State Management</h3>
|
|
211
|
+
<pre
|
|
212
|
+
class="overflow-x-auto rounded bg-gray-900 p-4 text-gray-100"
|
|
213
|
+
><code>// Initialize a stateful connection (auto-disconnects on page unload)
|
|
214
|
+
rtc.initialize('com.example.MyState', { id: '123' }, () => {
|
|
215
|
+
console.log('State restored from server')
|
|
216
|
+
})
|
|
217
|
+
|
|
218
|
+
// Restore state without unload handling
|
|
219
|
+
rtc.restore('com.example.MyState', { id: '123' }, () => {
|
|
220
|
+
console.log('State restored')
|
|
221
|
+
})</code></pre>
|
|
222
|
+
</div>
|
|
223
|
+
|
|
224
|
+
<div>
|
|
225
|
+
<h3 class="mb-2 font-bold">Executing Actions</h3>
|
|
226
|
+
<pre class="overflow-x-auto rounded bg-gray-900 p-4 text-gray-100"><code>// Send an action to the server
|
|
227
|
+
rtc.execute('com.example.MyAction', { id: '123', value: 'updated' })</code></pre>
|
|
228
|
+
</div>
|
|
229
|
+
|
|
230
|
+
<div>
|
|
231
|
+
<h3 class="mb-2 font-bold">API Reference</h3>
|
|
232
|
+
<ul class="space-y-2">
|
|
233
|
+
<li>
|
|
234
|
+
<code class="rounded bg-gray-200 px-1">rtc.initialize(state, data, callback)</code> — Connect to server
|
|
235
|
+
state with automatic unload cleanup
|
|
236
|
+
</li>
|
|
237
|
+
<li>
|
|
238
|
+
<code class="rounded bg-gray-200 px-1">rtc.restore(state, data, callback)</code> — Restore state from server
|
|
239
|
+
without unload handling
|
|
240
|
+
</li>
|
|
241
|
+
<li>
|
|
242
|
+
<code class="rounded bg-gray-200 px-1">rtc.receive(broadcast, callback)</code> — Subscribe to broadcast
|
|
243
|
+
events (fires on every occurrence)
|
|
244
|
+
</li>
|
|
245
|
+
<li>
|
|
246
|
+
<code class="rounded bg-gray-200 px-1">rtc.receiveOnce(broadcast, callback)</code> — Subscribe to a
|
|
247
|
+
broadcast event (fires once)
|
|
248
|
+
</li>
|
|
249
|
+
<li>
|
|
250
|
+
<code class="rounded bg-gray-200 px-1">rtc.execute(action, data)</code> — Send an action to the server
|
|
251
|
+
</li>
|
|
252
|
+
</ul>
|
|
253
|
+
</div>
|
|
254
|
+
|
|
255
|
+
<div>
|
|
256
|
+
<h3 class="mb-2 font-bold">Configuration</h3>
|
|
257
|
+
<ul class="list-inside list-disc space-y-1 text-gray-700">
|
|
258
|
+
<li>
|
|
259
|
+
<code class="rounded bg-gray-200 px-1">window.DISABLE_RTC</code> — Set to
|
|
260
|
+
<code class="rounded bg-gray-200 px-1">true</code> to disable all RTC functionality
|
|
261
|
+
</li>
|
|
262
|
+
<li>
|
|
263
|
+
<code class="rounded bg-gray-200 px-1">window.ROOT_PATH</code> — Server root path for the
|
|
264
|
+
<code class="rounded bg-gray-200 px-1">/_rtc</code> endpoint
|
|
265
|
+
</li>
|
|
266
|
+
<li>
|
|
267
|
+
<code class="rounded bg-gray-200 px-1">data-user-id</code> on
|
|
268
|
+
<code class="rounded bg-gray-200 px-1"><html></code> — Required for RTC to activate
|
|
269
|
+
</li>
|
|
270
|
+
</ul>
|
|
271
|
+
</div>
|
|
272
|
+
</div>
|
|
273
|
+
\`,
|
|
274
|
+
parameters: {
|
|
275
|
+
docs: {
|
|
276
|
+
description: {
|
|
277
|
+
story: \`Code examples and API documentation for the RTC module.\`
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
}`,...t.parameters?.docs?.source}}};const n=["Architecture","UsageExample"];export{e as Architecture,t as UsageExample,n as __namedExportsOrder,r as default};
|
package/dist/storybook/assets/{ScrollShadow.stories-BmwSRNje.js → ScrollShadow.stories-DHcKhkag.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{x as a}from"./iframe-
|
|
1
|
+
import{x as a}from"./iframe-lTczLWsL.js";import"./preload-helper-PPVm8Dsz.js";const l=({theme:e="btu-scrollshadow-25"})=>{const r=new Array(100).fill(0).map((s,t)=>`Item ${t+1}`);return a`
|
|
2
2
|
<style>
|
|
3
3
|
:root {
|
|
4
4
|
--can-scroll: ;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{x as u}from"./iframe-
|
|
1
|
+
import{x as u}from"./iframe-lTczLWsL.js";import"./preload-helper-PPVm8Dsz.js";function v(e,t){if(e<=0)return t;let n,o=0;return function(){if(n)return;const r=Date.now(),s=e-r+o;s<=0?(o=r,t.apply(this,[...arguments])):n=setTimeout(()=>{o=r,n=void 0,t.apply(this,[...arguments])},s)}}const x={title:"Utilities/Throttle",tags:["autodocs"],parameters:{docs:{subtitle:"The `throttle` utility function limits how often a function can execute, ensuring it runs at most once per specified interval. Useful for high-frequency events like scroll, resize, or mousemove."},controls:{expanded:!0}},argTypes:{interval:{control:{type:"number",min:0,max:2e3,step:50},description:"Throttle interval in milliseconds"}},args:{interval:200}},a={render:e=>{const t=`throttle-${Math.random().toString(36).substring(2,9)}`;let n=0,o=0;const r=()=>{const h=document.getElementById(`${t}-normal-count`),m=document.getElementById(`${t}-throttled-count`);h&&(h.textContent=String(n)),m&&(m.textContent=String(o))},s=v(e.interval,()=>{o++,r()}),d=()=>{n++,r()},l=()=>{d(),s()};return u`
|
|
2
2
|
<div class="space-y-4">
|
|
3
3
|
<div class="text-base">
|
|
4
4
|
<p class="mb-2">
|