@mochabug/adapt-vue 1.0.1-rc.2 → 1.0.1-rc.20
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/README.md +426 -40
- package/dist/esm/AdaptAutomation.js +180 -0
- package/dist/esm/AdaptCap.js +1 -3
- package/dist/esm/cap.js +4 -0
- package/dist/esm/core.js +3 -0
- package/dist/esm/index.js +2 -146
- package/dist/types/AdaptAutomation.d.ts +270 -0
- package/dist/types/AdaptCap.d.ts +3 -4
- package/dist/types/cap.d.ts +3 -0
- package/dist/types/core.d.ts +2 -0
- package/dist/types/index.d.ts +2 -210
- package/package.json +12 -4
package/README.md
CHANGED
|
@@ -12,18 +12,24 @@ Requires Vue 3.
|
|
|
12
12
|
|
|
13
13
|
```vue
|
|
14
14
|
<script setup>
|
|
15
|
-
import {
|
|
15
|
+
import { AdaptAutomation } from '@mochabug/adapt-vue';
|
|
16
16
|
</script>
|
|
17
17
|
|
|
18
18
|
<template>
|
|
19
|
-
<
|
|
19
|
+
<AdaptAutomation automation-id="auto-123" :style="{ height: '600px' }" />
|
|
20
20
|
</template>
|
|
21
21
|
```
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
With authentication:
|
|
24
24
|
|
|
25
25
|
```vue
|
|
26
|
-
<
|
|
26
|
+
<AdaptAutomation automation-id="auto-123" auth-token="your-token" :style="{ height: '600px' }" />
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
With proof-of-work challenge:
|
|
30
|
+
|
|
31
|
+
```vue
|
|
32
|
+
<AdaptAutomation automation-id="auto-123" :requires-challenge="true" :style="{ height: '600px' }" />
|
|
27
33
|
```
|
|
28
34
|
|
|
29
35
|
## SSR (Nuxt)
|
|
@@ -32,7 +38,7 @@ Keep auth token on server:
|
|
|
32
38
|
|
|
33
39
|
```vue
|
|
34
40
|
<script setup>
|
|
35
|
-
import {
|
|
41
|
+
import { AdaptAutomation } from '@mochabug/adapt-vue';
|
|
36
42
|
import { startSession } from '@mochabug/adapt-core';
|
|
37
43
|
|
|
38
44
|
const authToken = await getAuthTokenFromBackend();
|
|
@@ -40,7 +46,7 @@ const { token } = await startSession({ id: 'auto-123' }, authToken);
|
|
|
40
46
|
</script>
|
|
41
47
|
|
|
42
48
|
<template>
|
|
43
|
-
<
|
|
49
|
+
<AdaptAutomation automation-id="auto-123" :session-token="token" :style="{ height: '600px' }" />
|
|
44
50
|
</template>
|
|
45
51
|
```
|
|
46
52
|
|
|
@@ -48,73 +54,452 @@ const { token } = await startSession({ id: 'auto-123' }, authToken);
|
|
|
48
54
|
|
|
49
55
|
```vue
|
|
50
56
|
<!-- direct -->
|
|
51
|
-
<
|
|
57
|
+
<AdaptAutomation automation-id="auto-123" inherit-token="token-from-parent" />
|
|
52
58
|
|
|
53
59
|
<!-- from URL hash: example.com#mb_session=xxx -->
|
|
54
|
-
<
|
|
60
|
+
<AdaptAutomation automation-id="auto-123" :inherit-from="{ hash: 'mb_session' }" />
|
|
55
61
|
```
|
|
56
62
|
|
|
57
63
|
## Fork display
|
|
58
64
|
|
|
59
65
|
```vue
|
|
60
|
-
<!-- side-by-side -->
|
|
61
|
-
<
|
|
66
|
+
<!-- side-by-side (default) -->
|
|
67
|
+
<AdaptAutomation automation-id="auto-123" :fork-display="{ mode: 'side-by-side', split: 60 }" />
|
|
62
68
|
|
|
63
69
|
<!-- dialog -->
|
|
64
|
-
<
|
|
70
|
+
<AdaptAutomation automation-id="auto-123" :fork-display="{ mode: 'dialog' }" />
|
|
65
71
|
```
|
|
66
72
|
|
|
67
|
-
##
|
|
73
|
+
## Events
|
|
74
|
+
|
|
75
|
+
```vue
|
|
76
|
+
<AdaptAutomation
|
|
77
|
+
automation-id="auto-123"
|
|
78
|
+
@session="(status, fork) => console.log(status, fork)"
|
|
79
|
+
@output="(output) => console.log(output)"
|
|
80
|
+
@fork-active="(active) => console.log(active)"
|
|
81
|
+
/>
|
|
82
|
+
```
|
|
68
83
|
|
|
69
|
-
|
|
84
|
+
---
|
|
85
|
+
|
|
86
|
+
## 2. `AdaptCap`
|
|
87
|
+
|
|
88
|
+
Standalone proof-of-work challenge widget. Use when you manage the automation client yourself.
|
|
70
89
|
|
|
71
90
|
```vue
|
|
72
91
|
<script setup>
|
|
73
|
-
import {
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
}
|
|
81
|
-
};
|
|
92
|
+
import { AdaptCap, createConnectClient } from '@mochabug/adapt-vue/cap';
|
|
93
|
+
|
|
94
|
+
const client = createConnectClient({ id: 'YOUR_ID' });
|
|
95
|
+
|
|
96
|
+
function onSolve(token: string, expires: Date) {
|
|
97
|
+
console.log('Solved:', token, expires);
|
|
98
|
+
}
|
|
82
99
|
</script>
|
|
83
100
|
|
|
84
101
|
<template>
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
:style="{ height: '600px' }"
|
|
102
|
+
<AdaptCap
|
|
103
|
+
automation-id="YOUR_ID"
|
|
104
|
+
:client="client"
|
|
105
|
+
@solve="onSolve"
|
|
106
|
+
@error="(err) => console.error(err)"
|
|
91
107
|
/>
|
|
108
|
+
</template>
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
### Props
|
|
112
|
+
|
|
113
|
+
| Prop | Type |
|
|
114
|
+
|------|------|
|
|
115
|
+
| `automation-id` | `string` (required) |
|
|
116
|
+
| `client` | `AutomationClient` (required) |
|
|
117
|
+
| `worker-count` | `number` |
|
|
118
|
+
| `i18n` | `CapWidgetI18n` |
|
|
119
|
+
| `dark-mode` | `boolean` |
|
|
120
|
+
|
|
121
|
+
### Events
|
|
122
|
+
|
|
123
|
+
| Event | Payload |
|
|
124
|
+
|-------|---------|
|
|
125
|
+
| `solve` | `(token: string, expires: Date)` |
|
|
126
|
+
| `error` | `(error: Error)` |
|
|
127
|
+
|
|
128
|
+
### Headless (no UI)
|
|
129
|
+
|
|
130
|
+
Use the lower-level API to create and redeem challenges yourself:
|
|
131
|
+
|
|
132
|
+
```ts
|
|
133
|
+
import { createChallenge, redeemChallenge, createConnectClient } from '@mochabug/adapt-vue/cap';
|
|
134
|
+
|
|
135
|
+
const client = createConnectClient({ id: 'YOUR_ID' });
|
|
136
|
+
const challenge = await createChallenge(client);
|
|
137
|
+
// ... solve with Cap.js or your own solver ...
|
|
138
|
+
const redeemed = await redeemChallenge(client, solutions);
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
---
|
|
92
142
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
143
|
+
## Styling
|
|
144
|
+
|
|
145
|
+
There are three ways to style the component, from simplest to most advanced. Use whichever fits your workflow.
|
|
146
|
+
|
|
147
|
+
### 1. `theme` prop (recommended)
|
|
148
|
+
|
|
149
|
+
Pass an `AdaptTheme` object for semantic, token-based theming without writing CSS:
|
|
150
|
+
|
|
151
|
+
```vue
|
|
152
|
+
<script setup>
|
|
153
|
+
import { AdaptAutomation } from '@mochabug/adapt-vue';
|
|
154
|
+
|
|
155
|
+
const myTheme = {
|
|
156
|
+
mode: 'light',
|
|
157
|
+
primary: '#4f46e5',
|
|
158
|
+
background: '#ffffff',
|
|
159
|
+
surface: '#f0f4ff',
|
|
160
|
+
text: '#1e293b',
|
|
161
|
+
textSecondary: '#64748b',
|
|
162
|
+
border: '#cbd5e1',
|
|
163
|
+
font: '"Inter", sans-serif',
|
|
164
|
+
};
|
|
165
|
+
</script>
|
|
166
|
+
|
|
167
|
+
<template>
|
|
168
|
+
<AdaptAutomation
|
|
169
|
+
automation-id="auto-123"
|
|
170
|
+
:theme="myTheme"
|
|
99
171
|
:style="{ height: '600px' }"
|
|
100
172
|
/>
|
|
101
173
|
</template>
|
|
102
174
|
```
|
|
103
175
|
|
|
176
|
+
**`AdaptTheme` tokens:**
|
|
177
|
+
|
|
178
|
+
| Token | Type | What it controls |
|
|
179
|
+
|---|---|---|
|
|
180
|
+
| `mode` | `'light' \| 'dark'` | Dark-mode class + shadow/border defaults |
|
|
181
|
+
| `primary` | `string` | Accent color — derives separator, drop targets, spinner, status icon |
|
|
182
|
+
| `background` | `string` | Root background, active-tab bg, status-card bg |
|
|
183
|
+
| `surface` | `string` | Panel content bg, toolbar / inactive-tab bg |
|
|
184
|
+
| `text` | `string` | Active-tab text, status text, cap text |
|
|
185
|
+
| `textSecondary` | `string` | Inactive-tab text |
|
|
186
|
+
| `border` | `string` | Tab/panel borders, status-card border, cap border |
|
|
187
|
+
| `font` | `string` | Font family for all panel UI and cap widget |
|
|
188
|
+
| `vars` | `Record<string, string>` | Direct CSS variable overrides (keys without `--mb-adapt-` prefix) |
|
|
189
|
+
|
|
190
|
+
The `vars` escape hatch lets you fine-tune any variable while keeping the rest of the theme intact:
|
|
191
|
+
|
|
192
|
+
```vue
|
|
193
|
+
<script setup>
|
|
194
|
+
const theme = {
|
|
195
|
+
mode: 'dark',
|
|
196
|
+
primary: '#818cf8',
|
|
197
|
+
background: '#0f172a',
|
|
198
|
+
surface: '#1e293b',
|
|
199
|
+
text: '#f1f5f9',
|
|
200
|
+
border: '#334155',
|
|
201
|
+
vars: {
|
|
202
|
+
'floating-radius': '16px',
|
|
203
|
+
'cap-border-radius': '24px',
|
|
204
|
+
'border-radius': '12px',
|
|
205
|
+
},
|
|
206
|
+
};
|
|
207
|
+
</script>
|
|
208
|
+
|
|
209
|
+
<template>
|
|
210
|
+
<AdaptAutomation automation-id="auto-123" :theme="theme" :style="{ height: '600px' }" />
|
|
211
|
+
</template>
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
### 2. CSS custom properties
|
|
215
|
+
|
|
216
|
+
Set `--mb-adapt-*` variables on `.mb-adapt` in an unscoped `<style>` block or a global CSS file. In Vue SFCs, scoped styles cannot reach into the custom element's internals, so use one of these approaches:
|
|
217
|
+
|
|
218
|
+
**Unscoped `<style>` block (in any component or `App.vue`):**
|
|
219
|
+
|
|
220
|
+
```vue
|
|
221
|
+
<style>
|
|
222
|
+
.mb-adapt {
|
|
223
|
+
--mb-adapt-fork-bg: #ffffff;
|
|
224
|
+
--mb-adapt-fork-tab-bg: #f5f5f5;
|
|
225
|
+
--mb-adapt-fork-tab-active-bg: #ffffff;
|
|
226
|
+
--mb-adapt-fork-tab-color: #1a1a1a;
|
|
227
|
+
--mb-adapt-fork-tab-inactive-color: #888;
|
|
228
|
+
--mb-adapt-fork-separator: #e0e0e0;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
/* Dark mode — active when :dark-mode="true" */
|
|
232
|
+
.mb-adapt--dark {
|
|
233
|
+
--mb-adapt-fork-bg: #1e1e1e;
|
|
234
|
+
--mb-adapt-fork-tab-bg: #2a2a2a;
|
|
235
|
+
--mb-adapt-fork-tab-active-bg: #1e1e1e;
|
|
236
|
+
--mb-adapt-fork-tab-color: #e0e0e0;
|
|
237
|
+
--mb-adapt-fork-tab-inactive-color: #777;
|
|
238
|
+
--mb-adapt-fork-separator: #3a3a3a;
|
|
239
|
+
}
|
|
240
|
+
</style>
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
**Global CSS import in `main.ts`:**
|
|
244
|
+
|
|
245
|
+
```ts
|
|
246
|
+
// main.ts
|
|
247
|
+
import './adapt-theme.css';
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
```css
|
|
251
|
+
/* adapt-theme.css */
|
|
252
|
+
.mb-adapt {
|
|
253
|
+
--mb-adapt-fork-bg: #ffffff;
|
|
254
|
+
--mb-adapt-fork-separator: #e0e0e0;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
.mb-adapt--dark {
|
|
258
|
+
--mb-adapt-fork-bg: #1e1e1e;
|
|
259
|
+
--mb-adapt-fork-separator: #3a3a3a;
|
|
260
|
+
}
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
**Typical mapping from your site's design system:**
|
|
264
|
+
|
|
265
|
+
| Your site has | Maps to |
|
|
266
|
+
|---|---|
|
|
267
|
+
| Surface / card background | `--mb-adapt-fork-bg` |
|
|
268
|
+
| Secondary / muted background | `--mb-adapt-fork-tab-bg` |
|
|
269
|
+
| Primary text color | `--mb-adapt-fork-tab-color` |
|
|
270
|
+
| Muted / secondary text | `--mb-adapt-fork-tab-inactive-color` |
|
|
271
|
+
| Border / divider color | `--mb-adapt-fork-separator` |
|
|
272
|
+
| Accent color | `--mb-adapt-separator-active` (resize handle highlight) |
|
|
273
|
+
| Interactive hover tint | `--mb-adapt-button-hover-bg` |
|
|
274
|
+
|
|
275
|
+
### 3. Direct CSS on internal classes
|
|
276
|
+
|
|
277
|
+
For effects that go beyond variables (gradients, animations, pseudo-elements), target the component's internal class names directly. There is no Shadow DOM — all classes live in the light DOM.
|
|
278
|
+
|
|
279
|
+
Because Vue scoped styles hash selectors, internal classes like `.mb-group-header` will not match. Use an **unscoped `<style>` block** or `:global()` inside a scoped block:
|
|
280
|
+
|
|
281
|
+
**Animated gradient toolbar:**
|
|
282
|
+
|
|
283
|
+
```vue
|
|
284
|
+
<style>
|
|
285
|
+
/* Unscoped — reaches inside the custom element */
|
|
286
|
+
@keyframes mb-gradient-shift {
|
|
287
|
+
0% { background-position: 0% 50%; }
|
|
288
|
+
50% { background-position: 100% 50%; }
|
|
289
|
+
100% { background-position: 0% 50%; }
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
/* Light mode */
|
|
293
|
+
.mb-adapt .mb-group-header {
|
|
294
|
+
background: linear-gradient(135deg, #667eea, #764ba2, #f093fb, #667eea);
|
|
295
|
+
background-size: 300% 300%;
|
|
296
|
+
animation: mb-gradient-shift 8s ease infinite;
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
.mb-adapt .mb-group-header .mb-tab {
|
|
300
|
+
color: rgba(255, 255, 255, 0.7);
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
.mb-adapt .mb-group-header .mb-tab.mb-active {
|
|
304
|
+
color: #ffffff;
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
/* Dark mode */
|
|
308
|
+
.mb-adapt--dark .mb-group-header {
|
|
309
|
+
background: linear-gradient(135deg, #1e1b4b, #312e81, #4c1d95, #1e1b4b);
|
|
310
|
+
background-size: 300% 300%;
|
|
311
|
+
animation: mb-gradient-shift 8s ease infinite;
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
.mb-adapt--dark .mb-group-header .mb-tab {
|
|
315
|
+
color: rgba(199, 210, 254, 0.7);
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
.mb-adapt--dark .mb-group-header .mb-tab.mb-active {
|
|
319
|
+
color: #e0e7ff;
|
|
320
|
+
}
|
|
321
|
+
</style>
|
|
322
|
+
```
|
|
323
|
+
|
|
324
|
+
Or with `:global()` inside a scoped block:
|
|
325
|
+
|
|
326
|
+
```vue
|
|
327
|
+
<style scoped>
|
|
328
|
+
:global(.mb-adapt .mb-group-header) {
|
|
329
|
+
background: linear-gradient(135deg, #667eea, #764ba2, #f093fb, #667eea);
|
|
330
|
+
background-size: 300% 300%;
|
|
331
|
+
animation: mb-gradient-shift 8s ease infinite;
|
|
332
|
+
}
|
|
333
|
+
</style>
|
|
334
|
+
```
|
|
335
|
+
|
|
336
|
+
**Key internal classes:**
|
|
337
|
+
|
|
338
|
+
| Class | Element |
|
|
339
|
+
|---|---|
|
|
340
|
+
| `.mb-adapt` | Root container |
|
|
341
|
+
| `.mb-adapt--dark` | Root container in dark mode |
|
|
342
|
+
| `.mb-group-header` | Toolbar / tab bar |
|
|
343
|
+
| `.mb-tab` | Individual tab |
|
|
344
|
+
| `.mb-tab.mb-active` | Active tab |
|
|
345
|
+
| `.mb-fork-panel` | Panel content area |
|
|
346
|
+
| `.mb-status-card` | Status overlay card |
|
|
347
|
+
|
|
348
|
+
> **Note:** Internal class names are not covered by semver. Pin your `@mochabug/adapt-vue` version if you rely on them.
|
|
349
|
+
|
|
350
|
+
### Using the `:class-names` prop
|
|
351
|
+
|
|
352
|
+
Override internal element classes for deeper customization:
|
|
353
|
+
|
|
354
|
+
```vue
|
|
355
|
+
<AdaptAutomation
|
|
356
|
+
automation-id="auto-123"
|
|
357
|
+
:class-names="{
|
|
358
|
+
root: 'my-adapt-root',
|
|
359
|
+
iframe: 'my-adapt-iframe',
|
|
360
|
+
statusMessage: 'my-status-overlay',
|
|
361
|
+
statusCard: 'my-status-card',
|
|
362
|
+
}"
|
|
363
|
+
/>
|
|
364
|
+
```
|
|
365
|
+
|
|
366
|
+
### Using the `:styles` prop
|
|
367
|
+
|
|
368
|
+
Apply inline styles to the internal root element (useful for sizing):
|
|
369
|
+
|
|
370
|
+
```vue
|
|
371
|
+
<AdaptAutomation
|
|
372
|
+
automation-id="auto-123"
|
|
373
|
+
:styles="{ height: '600px', maxWidth: '1200px', margin: '0 auto' }"
|
|
374
|
+
/>
|
|
375
|
+
```
|
|
376
|
+
|
|
377
|
+
> **Note:** `:styles` targets the internal `.mb-adapt` root. Use Vue's `:style` for styles on the outer `<adapt-automation>` host element.
|
|
378
|
+
|
|
379
|
+
<details>
|
|
380
|
+
<summary>Full CSS variable reference</summary>
|
|
381
|
+
|
|
382
|
+
### General
|
|
383
|
+
|
|
384
|
+
| Variable | Light default | Dark default | Description |
|
|
385
|
+
|---|---|---|---|
|
|
386
|
+
| `--mb-adapt-bg` | `transparent` | | Root & group backgrounds |
|
|
387
|
+
| `--mb-adapt-font` | `system-ui, -apple-system, sans-serif` | | All panel UI text |
|
|
388
|
+
| `--mb-adapt-button-hover-bg` | `rgba(128,128,128,0.2)` | `rgba(128,128,128,0.3)` | Close/popout/action button hover |
|
|
389
|
+
| `--mb-adapt-separator-active` | `rgba(59,130,246,0.5)` | `rgba(99,130,246,0.6)` | Resize handle hover/active |
|
|
390
|
+
| `--mb-adapt-border-radius` | `8px` | | Iframe border radius |
|
|
391
|
+
|
|
392
|
+
### Toolbar and tabs
|
|
393
|
+
|
|
394
|
+
| Variable | Light default | Dark default | Description |
|
|
395
|
+
|---|---|---|---|
|
|
396
|
+
| `--mb-adapt-fork-bg` | `#ffffff` | `#1e1e1e` | Panel content background |
|
|
397
|
+
| `--mb-adapt-fork-tab-bg` | `#f3f3f3` | `#252526` | Toolbar / inactive tab bg |
|
|
398
|
+
| `--mb-adapt-fork-tab-active-bg` | `#ffffff` | `#1e1e1e` | Active tab background |
|
|
399
|
+
| `--mb-adapt-fork-tab-color` | `rgb(51,51,51)` | `#ffffff` | Active tab text |
|
|
400
|
+
| `--mb-adapt-fork-tab-inactive-color` | `rgba(51,51,51,0.7)` | `#969696` | Inactive tab text |
|
|
401
|
+
| `--mb-adapt-fork-separator` | `rgba(128,128,128,0.35)` | `rgb(68,68,68)` | Tab/panel borders |
|
|
402
|
+
| `--mb-adapt-tab-radius` | `0` | | Tab border-radius (use `999px` for pill shape) |
|
|
403
|
+
| `--mb-adapt-tab-shadow` | `none` | | Tab box-shadow |
|
|
404
|
+
| `--mb-adapt-tab-active-shadow` | `none` | | Active tab box-shadow |
|
|
405
|
+
| `--mb-adapt-tab-gap` | `0px` | | Tab margin (spacing between tabs) |
|
|
406
|
+
| `--mb-adapt-tab-padding` | `0 14px` | | Tab padding |
|
|
407
|
+
| `--mb-adapt-tab-font-size` | `13px` | | Tab label font size |
|
|
408
|
+
| `--mb-adapt-toolbar-height` | `40px` | | Toolbar / tab bar height |
|
|
409
|
+
| `--mb-adapt-toolbar-padding` | `0` | | Toolbar inner padding (standard CSS shorthand) |
|
|
410
|
+
| `--mb-adapt-tab-min-width` | `100px` | | Tab minimum width |
|
|
411
|
+
| `--mb-adapt-tab-spacing` | `6px` | | Gap between tab label and action buttons |
|
|
412
|
+
|
|
413
|
+
### Floating panels (elevation)
|
|
414
|
+
|
|
415
|
+
| Variable | Light default | Dark default | Description |
|
|
416
|
+
|---|---|---|---|
|
|
417
|
+
| `--mb-adapt-floating-shadow` | `0 25px 50px -12px rgba(0,0,0,0.25), 0 12px 24px -8px rgba(0,0,0,0.15)` | `… rgba(0,0,0,0.5), … rgba(0,0,0,0.3)` | Overlay box-shadow |
|
|
418
|
+
| `--mb-adapt-floating-border` | `none` | `1px solid rgba(255,255,255,0.06)` | Overlay border |
|
|
419
|
+
| `--mb-adapt-floating-backdrop` | `none` | | Overlay backdrop-filter |
|
|
420
|
+
| `--mb-adapt-floating-radius` | `8px` | | Overlay border-radius |
|
|
421
|
+
| `--mb-adapt-status-card-shadow` | `0 4px 24px rgba(0,0,0,0.08), 0 2px 8px rgba(0,0,0,0.04)` | `… rgba(0,0,0,0.25), … rgba(0,0,0,0.15)` | Status card box-shadow |
|
|
422
|
+
| `--mb-adapt-drag-ghost-shadow` | `0 4px 12px rgba(0,0,0,0.15)` | `0 4px 12px rgba(0,0,0,0.35)` | Drag ghost box-shadow |
|
|
423
|
+
|
|
424
|
+
### Drop targets
|
|
425
|
+
|
|
426
|
+
| Variable | Light default | Dark default |
|
|
427
|
+
|---|---|---|
|
|
428
|
+
| `--mb-adapt-drop-header-bg` | `rgba(99,102,241,0.18)` | `rgba(129,140,248,0.22)` |
|
|
429
|
+
| `--mb-adapt-drop-center-bg` | `rgba(99,102,241,0.12)` | `rgba(129,140,248,0.15)` |
|
|
430
|
+
| `--mb-adapt-drop-split-bg` | `rgba(99,102,241,0.14)` | `rgba(129,140,248,0.18)` |
|
|
431
|
+
| `--mb-adapt-drop-border` | `rgba(99,102,241,0.55)` | `rgba(129,140,248,0.6)` |
|
|
432
|
+
|
|
433
|
+
### Status cards
|
|
434
|
+
|
|
435
|
+
| Variable | Light default | Dark default |
|
|
436
|
+
|---|---|---|
|
|
437
|
+
| `--mb-adapt-status-card-bg` | `#ffffff` | `#1e293b` |
|
|
438
|
+
| `--mb-adapt-status-card-border` | `#e5e7eb` | `#334155` |
|
|
439
|
+
| `--mb-adapt-status-icon-bg` | `#fef2f2` | `#351c1c` |
|
|
440
|
+
| `--mb-adapt-status-text` | `#374151` | `#e2e8f0` |
|
|
441
|
+
|
|
442
|
+
### Cap widget
|
|
443
|
+
|
|
444
|
+
| Variable | Light default | Dark default |
|
|
445
|
+
|---|---|---|
|
|
446
|
+
| `--mb-adapt-cap-background` | `#ffffff` | `#1e293b` |
|
|
447
|
+
| `--mb-adapt-cap-border-color` | `#e2e8f0` | `#334155` |
|
|
448
|
+
| `--mb-adapt-cap-border-radius` | `16px` | |
|
|
449
|
+
| `--mb-adapt-cap-height` | `72px` | |
|
|
450
|
+
| `--mb-adapt-cap-width` | `380px` | |
|
|
451
|
+
| `--mb-adapt-cap-padding` | `20px 28px` | |
|
|
452
|
+
| `--mb-adapt-cap-gap` | `20px` | |
|
|
453
|
+
| `--mb-adapt-cap-color` | `#1e293b` | `#f1f5f9` |
|
|
454
|
+
| `--mb-adapt-cap-checkbox-size` | `36px` | |
|
|
455
|
+
| `--mb-adapt-cap-checkbox-border` | `2px solid #cbd5e1` | `2px solid #475569` |
|
|
456
|
+
| `--mb-adapt-cap-checkbox-radius` | `10px` | |
|
|
457
|
+
| `--mb-adapt-cap-checkbox-background` | `#f8fafc` | `#0f172a` |
|
|
458
|
+
| `--mb-adapt-cap-spinner-color` | `#6366f1` | `#818cf8` |
|
|
459
|
+
| `--mb-adapt-cap-spinner-bg` | `#e2e8f0` | `#334155` |
|
|
460
|
+
| `--mb-adapt-cap-spinner-thickness` | `3px` | |
|
|
461
|
+
| `--mb-adapt-cap-font` | `inherit` | |
|
|
462
|
+
|
|
463
|
+
### Z-index / stacking
|
|
464
|
+
|
|
465
|
+
| Variable | Default | Description |
|
|
466
|
+
|---|---|---|
|
|
467
|
+
| `--mb-adapt-z-base` | `0` | Base z-index offset — added to all internal z-index values |
|
|
468
|
+
|
|
469
|
+
Set `--mb-adapt-z-base` to shift all internal z-index values. Useful when embedding inside modals or drawers that have their own stacking context. Example: `--mb-adapt-z-base: 10000` lifts all layers by 10000.
|
|
470
|
+
|
|
471
|
+
Internal stacking order from low to high: separators (1), resize handles (10), minimized tabs (100), floating panels (100000+), status/cap (200000), confirm dialog (300000), drop targets (999998), drag ghost (999999). All values are offset by `--mb-adapt-z-base`.
|
|
472
|
+
|
|
473
|
+
</details>
|
|
474
|
+
|
|
475
|
+
---
|
|
476
|
+
|
|
104
477
|
## Props
|
|
105
478
|
|
|
106
479
|
| Prop | Type |
|
|
107
480
|
|------|------|
|
|
108
|
-
| `id` | `string` (required) |
|
|
481
|
+
| `automation-id` | `string` (required) |
|
|
109
482
|
| `session-token` | `string` |
|
|
110
483
|
| `auth-token` | `string` |
|
|
111
484
|
| `transmitter` | `string` |
|
|
112
|
-
| `signals` | `{ [key: string]:
|
|
485
|
+
| `signals` | `{ [key: string]: SignalValue }` |
|
|
486
|
+
| `challenge-token` | `string` |
|
|
487
|
+
| `requires-challenge` | `boolean` |
|
|
488
|
+
| `cap-widget-options` | `{ workerCount?: number; i18n?: CapWidgetI18n }` |
|
|
113
489
|
| `inherit-token` | `string` |
|
|
114
490
|
| `inherit-from` | `{ hash: string } \| { param: string }` |
|
|
115
|
-
| `fork-display
|
|
116
|
-
| `
|
|
117
|
-
| `
|
|
491
|
+
| `fork-display` | `{ mode: 'side-by-side', split?: number } \| { mode: 'dialog' }` |
|
|
492
|
+
| `dark-mode` | `boolean` |
|
|
493
|
+
| `auto-resizing` | `boolean` |
|
|
494
|
+
| `allow-floating` | `boolean` — hide pop-out buttons and block user-initiated floating (default `true`) |
|
|
495
|
+
| `allow-docking` | `boolean` — hide dock buttons and block user-initiated docking (default `true`) |
|
|
496
|
+
| `allow-dialog-docking` | `boolean` — allow tab splits inside floating dialog overlays (default `true`) |
|
|
497
|
+
| `floating-auto-resize` | `boolean` — floating overlays auto-resize from iframe content (default `false`) |
|
|
498
|
+
| `persist` | `boolean \| PersistOptions` |
|
|
499
|
+
| `text` | `StatusText` |
|
|
500
|
+
| `theme` | `AdaptTheme` |
|
|
501
|
+
| `class-names` | `{ root?: string; iframe?: string; statusMessage?: string; statusCard?: string }` |
|
|
502
|
+
| `styles` | `Partial<CSSStyleDeclaration>` |
|
|
118
503
|
|
|
119
504
|
## Events
|
|
120
505
|
|
|
@@ -122,7 +507,8 @@ const signals: { [key: string]: SignalDataJson } = {
|
|
|
122
507
|
|-------|---------|
|
|
123
508
|
| `session` | `(status, fork?)` |
|
|
124
509
|
| `output` | `(output)` |
|
|
510
|
+
| `fork-active` | `(active)` |
|
|
125
511
|
|
|
126
512
|
## License
|
|
127
513
|
|
|
128
|
-
ISC
|
|
514
|
+
ISC (c) mochabug AB
|