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 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 } = "App" in config ? config : { ...entryProps(config, entryOptions.dev), root: entryOptions.root };
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.`);