@mochabug/adapt-astro 1.0.0-rc30 → 1.0.0-rc32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -2
- package/src/Adapt.astro +11 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mochabug/adapt-astro",
|
|
3
|
-
"version": "1.0.0-
|
|
3
|
+
"version": "1.0.0-rc32",
|
|
4
4
|
"description": "Astro component for Adapt automation platform",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./src/index.ts",
|
|
@@ -31,6 +31,6 @@
|
|
|
31
31
|
"astro": "^3.0.0 || ^4.0.0 || ^5.0.0"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@mochabug/adapt-web": "^1.0.0-
|
|
34
|
+
"@mochabug/adapt-web": "^1.0.0-rc55"
|
|
35
35
|
}
|
|
36
36
|
}
|
package/src/Adapt.astro
CHANGED
|
@@ -20,6 +20,7 @@ export interface Props extends Pick<
|
|
|
20
20
|
| "onOutput"
|
|
21
21
|
| "onForkActive"
|
|
22
22
|
| "classNames"
|
|
23
|
+
| "persist"
|
|
23
24
|
> {
|
|
24
25
|
/** CSS class name for the container */
|
|
25
26
|
class?: string;
|
|
@@ -42,14 +43,15 @@ const {
|
|
|
42
43
|
darkMode = false,
|
|
43
44
|
autoResizing = false,
|
|
44
45
|
classNames,
|
|
46
|
+
persist,
|
|
45
47
|
class: className,
|
|
46
48
|
style,
|
|
47
49
|
} = Astro.props;
|
|
48
50
|
|
|
49
51
|
const forkDisplayMode = forkDisplay?.mode ?? "side-by-side";
|
|
50
52
|
const sideBySideSplit = forkDisplay?.mode === "side-by-side" ? (forkDisplay.split ?? 50) : 50;
|
|
51
|
-
const dialogBackdropClose = forkDisplay?.mode === "dialog" && forkDisplay.backdropClose;
|
|
52
|
-
const dialogResizeToContent = forkDisplay?.mode === "dialog" && forkDisplay.resizeToContent;
|
|
53
|
+
const dialogBackdropClose = forkDisplay?.mode === "dialog" && forkDisplay.backdropClose !== false;
|
|
54
|
+
const dialogResizeToContent = forkDisplay?.mode === "dialog" && forkDisplay.resizeToContent !== false;
|
|
53
55
|
|
|
54
56
|
const containerId = `adapt-${Math.random().toString(36).slice(2, 11)}`;
|
|
55
57
|
---
|
|
@@ -71,6 +73,8 @@ const containerId = `adapt-${Math.random().toString(36).slice(2, 11)}`;
|
|
|
71
73
|
dialog-resize-to-content={dialogResizeToContent ? "" : undefined}
|
|
72
74
|
dark-mode={darkMode ? "" : undefined}
|
|
73
75
|
auto-resizing={autoResizing ? "" : undefined}
|
|
76
|
+
persist={persist ? "" : undefined}
|
|
77
|
+
data-adapt-persist-options={typeof persist === "object" ? JSON.stringify(persist) : undefined}
|
|
74
78
|
data-adapt-signals={signals ? JSON.stringify(signals) : undefined}
|
|
75
79
|
data-adapt-cap-widget-options={capWidgetOptions
|
|
76
80
|
? JSON.stringify(capWidgetOptions)
|
|
@@ -113,6 +117,11 @@ const containerId = `adapt-${Math.random().toString(36).slice(2, 11)}`;
|
|
|
113
117
|
el.classNames = JSON.parse(classNamesStr);
|
|
114
118
|
}
|
|
115
119
|
|
|
120
|
+
const persistStr = el.dataset.adaptPersistOptions;
|
|
121
|
+
if (persistStr) {
|
|
122
|
+
el.persistOptions = JSON.parse(persistStr);
|
|
123
|
+
}
|
|
124
|
+
|
|
116
125
|
// Dispatch events for callbacks (users can addEventListener on the element)
|
|
117
126
|
// onSession and onOutput are handled automatically via adapt-session and adapt-output CustomEvents
|
|
118
127
|
});
|