grist-widget-sdk 0.5.0 → 0.5.1
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/CHANGELOG.md +8 -0
- package/dist/app.cjs +4 -1
- package/dist/app.cjs.map +1 -1
- package/dist/app.js +1 -1
- package/dist/{chunk-LSALXIGM.js → chunk-P5I5MRC6.js} +6 -2
- package/dist/chunk-P5I5MRC6.js.map +1 -0
- package/dist/emulator/testing.cjs +4 -1
- package/dist/emulator/testing.cjs.map +1 -1
- package/dist/emulator/testing.js +4 -3
- package/dist/emulator/testing.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-LSALXIGM.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# grist-widget-sdk
|
|
2
2
|
|
|
3
|
+
## 0.5.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 10015f7: **`mountGristWidget(entry)` and `smokeTestWidget(entry)` read an entry module that also exports its component as `App`.** A widget whose `src/app/App.tsx` has `export function App()` next to `export default App` was taken for the older `{ App, options }` form: `mountGristWidget(entry)` (the 0.5 template's `src/main.tsx`) mounted it without its `GRIST_OPTIONS` (no declared columns, no access level), and `smokeTestWidget(entry)` threw. An entry module is now recognised by its default export.
|
|
8
|
+
|
|
9
|
+
Existing widgets: nothing to do. A widget on `create-grist-widget` 0.5.0's template with a named `App` export gets its declaration back once this version is installed.
|
|
10
|
+
|
|
3
11
|
## 0.5.0
|
|
4
12
|
|
|
5
13
|
### Minor Changes
|
package/dist/app.cjs
CHANGED
|
@@ -2020,6 +2020,9 @@ function noop() {
|
|
|
2020
2020
|
|
|
2021
2021
|
// src/app/mount-grist-widget.tsx
|
|
2022
2022
|
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
2023
|
+
function isGristWidgetEntry(value) {
|
|
2024
|
+
return "default" in value && value.default != null;
|
|
2025
|
+
}
|
|
2023
2026
|
function entryProps(entry, dev = false) {
|
|
2024
2027
|
const widget = isGristWidget(entry.widget) ? entry.widget : void 0;
|
|
2025
2028
|
const options = widget?.options ?? entry.GRIST_OPTIONS;
|
|
@@ -2040,7 +2043,7 @@ function entryProps(entry, dev = false) {
|
|
|
2040
2043
|
return props;
|
|
2041
2044
|
}
|
|
2042
2045
|
function mountGristWidget(config, entryOptions = {}) {
|
|
2043
|
-
const { root = "#root", ...props } =
|
|
2046
|
+
const { root = "#root", ...props } = isGristWidgetEntry(config) ? { ...entryProps(config, entryOptions.dev), root: entryOptions.root } : config;
|
|
2044
2047
|
const container = typeof root === "string" ? document.querySelector(root) : root;
|
|
2045
2048
|
if (!container) {
|
|
2046
2049
|
throw new Error(`mountGristWidget: no element matches "${String(root)}" to render the widget into.`);
|