@colixsystems/widget-sdk 0.276.0 → 0.277.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/README.md CHANGED
@@ -86,7 +86,17 @@ See the design reference for the full architecture: [`docs/architecture/widget-m
86
86
 
87
87
  ## Status
88
88
 
89
- `v0.276.0` — pre-publish. The package surface (types, function names, export paths) is the v1 contract; runtime behaviour for some hooks is stubbed (each hook documents what's wired and what isn't). It is **not yet published to npm**.
89
+ `v0.277.1` — pre-publish. The package surface (types, function names, export paths) is the v1 contract; runtime behaviour for some hooks is stubbed (each hook documents what's wired and what isn't). It is **not yet published to npm**.
90
+
91
+ ### What's new in 0.277.1
92
+
93
+ **`hand-rolled-write-gate` no longer fires on `theme.typography.roles`.** The rule looked for `.roles` / `.groupIds` anywhere in the file, so a writing widget that called `useUser()` and styled its text with `theme.typography.roles[name]` was flagged on the `useUser()` line and, through the publish gate, refused. It now reads only the value `useUser()` returns: the identifier it is assigned to (`user.roles`, `user?.groupIds`), a destructured `{ roles }` or `{ groupIds }`, or `useUser().roles` inline. Gating a write on `user.roles` without `useCanWrite` still warns.
94
+
95
+ ### What's new in 0.277.0
96
+
97
+ **`validateManifest` refuses `manifest.actions` in ESM too.** The CommonJS build the backend runs has refused a widget-declared action since actions became their own marketplace deliverable, but the ESM build the CLI and the Builder import still validated the old shape. So `appstudio-widget lint` passed a manifest the publish step then rejected. Both builds now give the same error, which names `@colixsystems/action-sdk` as the replacement. The `actions` field in `index.d.ts` is marked `@deprecated`. This is a breaking change for a manifest that still declares `actions`, so it ships as a minor version. A widget already published with them still loads: `defineWidget` ignores the retired key.
98
+
99
+ **Every CommonJS module is generated from its ESM source.** `linter.cjs`, `manifest.cjs`, `navigation.cjs`, `theme-appearance.cjs`, `theme-background.cjs`, `theme-components.cjs`, `lucideIconName.cjs`, `bundled-assets.cjs` and the new `source-mask.cjs` are now produced by `scripts/generate-cjs.js` alongside `contract.cjs`, rather than kept by hand. Edit the `.js` file, then run `npm run generate:cjs`. `cjs-generated.test.js` fails when a `.cjs` is stale or hand-edited. The exports map is unchanged.
90
100
 
91
101
  ### What's new in 0.276.0 (contract 1.226.0)
92
102
 
@@ -1,9 +1,13 @@
1
+ // GENERATED from bundled-assets.js by scripts/generate-cjs.js — DO NOT EDIT.
2
+ // Change bundled-assets.js, then run `npm run generate:cjs` in packages/widget-sdk.
3
+ "use strict";
4
+
5
+ const { CONTRACT } = require("./contract.cjs");
6
+
1
7
  // The files a widget package ships in its assets/ directory: which names and
2
8
  // types are allowed. Pure and filesystem-free, so the CLI, the dev server, the
3
9
  // first-party packer and the backend all apply one rule set.
4
- // CommonJS twin of bundled-assets.js for the backend. Keep both in lockstep.
5
10
 
6
- const { CONTRACT } = require("./contract.cjs");
7
11
 
8
12
  const RULES = CONTRACT.bundledAssets;
9
13
  const BUNDLED_ASSET_DIRECTORY = RULES.directory;
@@ -1,7 +1,6 @@
1
1
  // The files a widget package ships in its assets/ directory: which names and
2
2
  // types are allowed. Pure and filesystem-free, so the CLI, the dev server, the
3
3
  // first-party packer and the backend all apply one rule set.
4
- // Keep bundled-assets.cjs in lockstep.
5
4
 
6
5
  import { CONTRACT } from "./contract.js";
7
6
 
package/dist/contract.cjs CHANGED
@@ -1,10 +1,11 @@
1
- // GENERATED from contract.js by scripts/contract-cjs.js — DO NOT EDIT.
2
- // Change contract.js, then run `npm run generate:contract` in packages/widget-sdk.
1
+ // GENERATED from contract.js by scripts/generate-cjs.js — DO NOT EDIT.
2
+ // Change contract.js, then run `npm run generate:cjs` in packages/widget-sdk.
3
+ "use strict";
3
4
 
4
5
  // The widget SDK contract: the ONE source the linter, the AI agents, the
5
6
  // compiler and both hosts read. `contract.cjs` is GENERATED from `contract.js`
6
- // (`npm run generate:contract`) for CommonJS consumers — never edit it by hand;
7
- // contract-cjs-generated.test.js fails when it is stale.
7
+ // (`npm run generate:cjs`) for CommonJS consumers — never edit it by hand;
8
+ // cjs-generated.test.js fails when it is stale.
8
9
 
9
10
  // REQ-AI-AGENT-DESIGN (sc-3696): the ONE cross-platform elevation vocabulary.
10
11
  // `shadow*` applies on iOS + react-native-web, `elevation` drives Android.
package/dist/contract.js CHANGED
@@ -1,7 +1,7 @@
1
1
  // The widget SDK contract: the ONE source the linter, the AI agents, the
2
2
  // compiler and both hosts read. `contract.cjs` is GENERATED from `contract.js`
3
- // (`npm run generate:contract`) for CommonJS consumers — never edit it by hand;
4
- // contract-cjs-generated.test.js fails when it is stale.
3
+ // (`npm run generate:cjs`) for CommonJS consumers — never edit it by hand;
4
+ // cjs-generated.test.js fails when it is stale.
5
5
 
6
6
  // REQ-AI-AGENT-DESIGN (sc-3696): the ONE cross-platform elevation vocabulary.
7
7
  // `shadow*` applies on iOS + react-native-web, `elevation` drives Android.
@@ -16,7 +16,7 @@ export function defineWidget(opts) {
16
16
  if (typeof component !== "function") {
17
17
  throw new TypeError("defineWidget: component must be a function");
18
18
  }
19
- const result = validateManifest(manifest);
19
+ const result = validateManifest(withoutRetiredActions(manifest));
20
20
  if (!result.ok) {
21
21
  const msg = `Invalid widget manifest:\n - ${result.errors.join("\n - ")}`;
22
22
  throw new Error(msg);
@@ -27,3 +27,10 @@ export function defineWidget(opts) {
27
27
  _kind: "appstudio-widget-module",
28
28
  };
29
29
  }
30
+
31
+ // Publishing refuses `actions`; a widget published before then must still load.
32
+ function withoutRetiredActions(manifest) {
33
+ if (manifest === null || typeof manifest !== "object" || !("actions" in manifest)) return manifest;
34
+ const { actions: _retired, ...loadable } = manifest;
35
+ return loadable;
36
+ }
package/dist/index.d.ts CHANGED
@@ -455,9 +455,8 @@ export interface WidgetManifest {
455
455
  */
456
456
  datastoreTemplate?: WidgetDatastoreTemplate;
457
457
  /**
458
- * Optional server-side actions (REQ-WIDGET-ACTION). Operators enable them
459
- * per tenant from the Properties Panel; each runs in the existing
460
- * isolated-vm action runner. See `WidgetManifestAction`.
458
+ * @deprecated Refused by `validateManifest` and at publish: ship the
459
+ * automation as a marketplace Action (`@colixsystems/action-sdk`).
461
460
  */
462
461
  actions?: WidgetManifestAction[];
463
462
  /**