@civitai/blocks-react 0.72.2 → 0.72.4

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
@@ -7,6 +7,17 @@ Pairs with [`@civitai/app-sdk`](https://www.npmjs.com/package/@civitai/app-sdk)'
7
7
  `postMessage` contract. This package adds the transport that actually moves bytes
8
8
  and the React hooks block authors call.
9
9
 
10
+ > **Starting a new block app? Start from
11
+ > [`@civitai/sdk`](https://www.npmjs.com/package/@civitai/sdk).** The three
12
+ > packages are layers over one host contract, and all three are supported:
13
+ >
14
+ > - **`@civitai/sdk`** is the client new block apps start on: `initialize()`,
15
+ > then `app.workflows`, `app.storage`, `app.site` and `app.host`.
16
+ > - **`@civitai/app-sdk/blocks`** is the contract itself: the workflow body
17
+ > types, the manifest types and the host message shapes.
18
+ > - **`@civitai/blocks-react`** (this package) is the React hook binding over
19
+ > that same contract.
20
+
10
21
  ## Install
11
22
 
12
23
  ```bash
@@ -4,6 +4,7 @@ import { OriginMatcher } from './originMatcher.js';
4
4
  import { DEFAULT_REQUEST_TIMEOUT_MS } from './requestTimeouts.js';
5
5
  import { isRoutableRequestId } from './requestId.js';
6
6
  import { payloadValidatorFor, projectInboundPayload } from './validate.js';
7
+ import { VERSION } from '../version.generated.js';
7
8
  const INIT_TIMEOUT_MS = 10_000;
8
9
  /**
9
10
  * How many DISTINCT inbound origins are remembered for the init-timeout
@@ -611,7 +612,9 @@ export class IframeTransport {
611
612
  // block's root element mounts. Queued because the iframe's React
612
613
  // tree hasn't rendered yet at this point — the postMessage goes
613
614
  // out on the next microtask via the standard dispatch path.
614
- this.dispatch('BLOCK_READY', { height: 0 });
615
+ // `sdkName`/`sdkVersion` are informational (the host counts versions
616
+ // in the wild); nothing is negotiated on them and older blocks omit them.
617
+ this.dispatch('BLOCK_READY', { height: 0, sdkName: 'blocks-react', sdkVersion: VERSION });
615
618
  this.resolveInit(data.payload);
616
619
  }
617
620
  return;
@@ -0,0 +1,3 @@
1
+ /** This package's version, reported to the host as `sdkVersion` in `BLOCK_READY`. */
2
+ export declare const VERSION = "0.72.4";
3
+ //# sourceMappingURL=version.generated.d.ts.map
@@ -0,0 +1,4 @@
1
+ /* AUTOGENERATED from package.json by scripts/gen-version.mjs. DO NOT EDIT. */
2
+ /** This package's version, reported to the host as `sdkVersion` in `BLOCK_READY`. */
3
+ export const VERSION = "0.72.4";
4
+ //# sourceMappingURL=version.generated.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@civitai/blocks-react",
3
- "version": "0.72.2",
3
+ "version": "0.72.4",
4
4
  "description": "React hooks and iframe transport for Civitai Apps. Pairs with @civitai/app-sdk/blocks.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -37,8 +37,8 @@
37
37
  "node": ">=20"
38
38
  },
39
39
  "dependencies": {
40
- "@civitai/components": "^0.9.3",
41
- "@civitai/theme": "^0.5.2"
40
+ "@civitai/theme": "^0.5.2",
41
+ "@civitai/components": "^0.9.3"
42
42
  },
43
43
  "comment-peerDependencies": "This floor is DERIVED, not chosen — the lowest published app-sdk that exports every symbol this package imports. Do not edit it without reading ./PEER_FLOOR.md (in-repo, unpublished) and tests/guards/blocks-react-peer-floor.test.mjs.",
44
44
  "peerDependencies": {
@@ -58,7 +58,7 @@
58
58
  "typescript": "^5.9.2",
59
59
  "vite": "^8.0.14",
60
60
  "vitest": "^4.1.11",
61
- "@civitai/app-sdk": "^0.68.0"
61
+ "@civitai/app-sdk": "^0.69.1"
62
62
  },
63
63
  "publishConfig": {
64
64
  "access": "public"
@@ -79,7 +79,8 @@
79
79
  "directory": "packages/civitai-blocks-react"
80
80
  },
81
81
  "scripts": {
82
- "build": "tsc -p tsconfig.json",
82
+ "generate": "node ../../scripts/gen-version.mjs",
83
+ "build": "node ../../scripts/gen-version.mjs && tsc -p tsconfig.json",
83
84
  "typecheck": "tsc -p tsconfig.json --noEmit",
84
85
  "test": "vitest run --project unit",
85
86
  "test:browser": "vitest run --project browser",