@mochabug/adapt-astro 1.0.0-rc35 → 1.0.0-rc37
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 +8 -0
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-rc37",
|
|
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-rc60"
|
|
35
35
|
}
|
|
36
36
|
}
|
package/src/Adapt.astro
CHANGED
|
@@ -21,6 +21,7 @@ export interface Props extends Pick<
|
|
|
21
21
|
| "onForkActive"
|
|
22
22
|
| "classNames"
|
|
23
23
|
| "persist"
|
|
24
|
+
| "text"
|
|
24
25
|
> {
|
|
25
26
|
/** CSS class name for the container */
|
|
26
27
|
class?: string;
|
|
@@ -44,6 +45,7 @@ const {
|
|
|
44
45
|
autoResizing = false,
|
|
45
46
|
classNames,
|
|
46
47
|
persist,
|
|
48
|
+
text,
|
|
47
49
|
class: className,
|
|
48
50
|
style,
|
|
49
51
|
} = Astro.props;
|
|
@@ -74,6 +76,7 @@ const containerId = `adapt-${Math.random().toString(36).slice(2, 11)}`;
|
|
|
74
76
|
dark-mode={darkMode ? "" : undefined}
|
|
75
77
|
auto-resizing={autoResizing ? "" : undefined}
|
|
76
78
|
persist={persist ? "" : undefined}
|
|
79
|
+
data-adapt-text={text ? JSON.stringify(text) : undefined}
|
|
77
80
|
data-adapt-persist-options={typeof persist === "object" ? JSON.stringify(persist) : undefined}
|
|
78
81
|
data-adapt-signals={signals ? JSON.stringify(signals) : undefined}
|
|
79
82
|
data-adapt-cap-widget-options={capWidgetOptions
|
|
@@ -122,6 +125,11 @@ const containerId = `adapt-${Math.random().toString(36).slice(2, 11)}`;
|
|
|
122
125
|
el.persistOptions = JSON.parse(persistStr);
|
|
123
126
|
}
|
|
124
127
|
|
|
128
|
+
const textStr = el.dataset.adaptText;
|
|
129
|
+
if (textStr) {
|
|
130
|
+
el.text = JSON.parse(textStr);
|
|
131
|
+
}
|
|
132
|
+
|
|
125
133
|
// Dispatch events for callbacks (users can addEventListener on the element)
|
|
126
134
|
// onSession and onOutput are handled automatically via adapt-session and adapt-output CustomEvents
|
|
127
135
|
});
|