@notionhq/custom-blocks 0.1.21 → 0.1.22

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.
@@ -65,14 +65,16 @@ export declare function useContrastMode(): NotionContrastMode;
65
65
  */
66
66
  export declare function useCurrentUser(): NotionUser;
67
67
  /**
68
- * Returns the authoritative manifest received from the host the semantic
69
- * data source keys plus their declared `name`, `description`, and property declarations.
68
+ * Returns the manifest that the block declared and the host provided during initialization.
69
+ * It lists each semantic data source key with its declared name, description, icon, and
70
+ * property definitions. Use this hook to list keys when the UI supports multiple data sources,
71
+ * such as in a data source selector.
70
72
  *
71
73
  * Throws if called before `initCustomBlock` has resolved.
72
74
  *
73
- * This is the configuration the block declared, not host-resolved bindings: use
74
- * `useDataSource(key)` for rows and resolved schema. Handy for enumerating the declared
75
- * data source keys (e.g. picking a default key, or rendering a key switcher).
75
+ * The manifest does not include the concrete Notion data source IDs mapped to those keys or
76
+ * any row data. Use `useDataSource(key)` with a declared key to read rows and access the
77
+ * resolved property IDs and schemas.
76
78
  */
77
79
  export declare function useManifest(): CustomBlockManifest;
78
80
  //# sourceMappingURL=useRuntimeState.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useRuntimeState.d.ts","sourceRoot":"","sources":["../../../../home/runner/work/custom-blocks/custom-blocks/sdk/src/react/useRuntimeState.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,8CAA8C,CAAA;AACtF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yCAAyC,CAAA;AAC5E,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,8CAA8C,CAAA;AACvF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gDAAgD,CAAA;AACrF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,4CAA4C,CAAA;AAC9E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,2CAA2C,CAAA;AAC5E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gDAAgD,CAAA;AAIhF;;;;;;;GAOG;AACH,wBAAgB,UAAU,IAAI,aAAa,CAE1C;AAED;;;;;;;;GAQG;AACH,wBAAgB,SAAS,IAAI,YAAY,CAExC;AAED;;;;;;;;GAQG;AACH,wBAAgB,OAAO,IAAI,eAAe,CAEzC;AAED;;;;;;;GAOG;AACH,wBAAgB,QAAQ,IAAI,WAAW,CAEtC;AAED;;;;;;;;GAQG;AACH,wBAAgB,eAAe,IAAI,kBAAkB,CAKpD;AAED;;;;;;;;;GASG;AACH,wBAAgB,cAAc,IAAI,UAAU,CAE3C;AAED;;;;;;;;;GASG;AACH,wBAAgB,WAAW,IAAI,mBAAmB,CAEjD"}
1
+ {"version":3,"file":"useRuntimeState.d.ts","sourceRoot":"","sources":["../../../../home/runner/work/custom-blocks/custom-blocks/sdk/src/react/useRuntimeState.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,8CAA8C,CAAA;AACtF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yCAAyC,CAAA;AAC5E,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,8CAA8C,CAAA;AACvF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gDAAgD,CAAA;AACrF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,4CAA4C,CAAA;AAC9E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,2CAA2C,CAAA;AAC5E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gDAAgD,CAAA;AAIhF;;;;;;;GAOG;AACH,wBAAgB,UAAU,IAAI,aAAa,CAE1C;AAED;;;;;;;;GAQG;AACH,wBAAgB,SAAS,IAAI,YAAY,CAExC;AAED;;;;;;;;GAQG;AACH,wBAAgB,OAAO,IAAI,eAAe,CAEzC;AAED;;;;;;;GAOG;AACH,wBAAgB,QAAQ,IAAI,WAAW,CAEtC;AAED;;;;;;;;GAQG;AACH,wBAAgB,eAAe,IAAI,kBAAkB,CAKpD;AAED;;;;;;;;;GASG;AACH,wBAAgB,cAAc,IAAI,UAAU,CAE3C;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,WAAW,IAAI,mBAAmB,CAEjD"}
@@ -72,14 +72,16 @@ export function useCurrentUser() {
72
72
  return useSyncExternalStore(customBlock.subscribe, customBlock.getCurrentUser);
73
73
  }
74
74
  /**
75
- * Returns the authoritative manifest received from the host the semantic
76
- * data source keys plus their declared `name`, `description`, and property declarations.
75
+ * Returns the manifest that the block declared and the host provided during initialization.
76
+ * It lists each semantic data source key with its declared name, description, icon, and
77
+ * property definitions. Use this hook to list keys when the UI supports multiple data sources,
78
+ * such as in a data source selector.
77
79
  *
78
80
  * Throws if called before `initCustomBlock` has resolved.
79
81
  *
80
- * This is the configuration the block declared, not host-resolved bindings: use
81
- * `useDataSource(key)` for rows and resolved schema. Handy for enumerating the declared
82
- * data source keys (e.g. picking a default key, or rendering a key switcher).
82
+ * The manifest does not include the concrete Notion data source IDs mapped to those keys or
83
+ * any row data. Use `useDataSource(key)` with a declared key to read rows and access the
84
+ * resolved property IDs and schemas.
83
85
  */
84
86
  export function useManifest() {
85
87
  return useSyncExternalStore(customBlock.subscribe, customBlock.getManifest);
package/dist/version.js CHANGED
@@ -4,4 +4,4 @@
4
4
  *
5
5
  * WARNING: Generated during SDK publish. Do not edit in the published package.
6
6
  */
7
- export const CUSTOM_BLOCKS_SDK_VERSION = "0.1.21"
7
+ export const CUSTOM_BLOCKS_SDK_VERSION = "0.1.22"
@@ -6,7 +6,7 @@ The mapping from those semantic keys to concrete Notion data sources is stored o
6
6
 
7
7
  Use `ManifestDataSource`, `ManifestProperty`, and `ManifestIcon` when code needs the corresponding definition metadata types.
8
8
 
9
- At runtime, your code references the semantic key and the SDK handles the lookup for you. Use `useDataSource(key)` for the rows themselves (it also exposes the resolved schema), and `useManifest()` when you need the declared data source keys and their declarations (e.g. picking a default key, or rendering a key switcher). For non-React renderers, `customBlock.getManifest()` exposes the same manifest, but row querying is currently only exposed through the React `useDataSource` hook.
9
+ At runtime, your code references the semantic key and the SDK handles the lookup for you. Use `useDataSource(key)` for the rows themselves (it also exposes the resolved schema), and use `useManifest()` when the UI must enumerate declared data sources, such as a dynamic key switcher. For non-React renderers, `customBlock.getManifest()` exposes the same manifest, but row querying is currently only exposed through the React `useDataSource` hook.
10
10
 
11
11
  ## Pages within a data source
12
12
 
@@ -66,14 +66,14 @@ Query failures follow the SDK's [error-handling contract](./errors.md).
66
66
  function useManifest(): CustomBlockManifest;
67
67
  ```
68
68
 
69
- Returns the authoritative block manifest received from the host during initialization, including the semantic data source keys plus their declared `name`, `description`, and property declarations. Handy for enumerating declared keys:
69
+ Returns the authoritative block manifest received from the host during initialization, including the semantic data source keys plus their declared `name`, `description`, and property declarations. Most blocks should query a declared key directly:
70
70
 
71
71
  ```tsx
72
- const manifest = useManifest();
73
- const keys = Object.keys(manifest.dataSources);
74
- const activeKey = keys[0] ?? "default";
72
+ const query = useDataSource("tasks");
75
73
  ```
76
74
 
75
+ Use `useManifest()` when the UI must enumerate declarations, such as a switcher that supports multiple data sources.
76
+
77
77
  This API throws if called before initialization. This does not include host-resolved bindings nor does it include any actual data rows.
78
78
 
79
79
  ### `customBlock.getManifest()`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@notionhq/custom-blocks",
3
- "version": "0.1.21",
3
+ "version": "0.1.22",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "publishConfig": {
@@ -89,14 +89,16 @@ export function useCurrentUser(): NotionUser {
89
89
  }
90
90
 
91
91
  /**
92
- * Returns the authoritative manifest received from the host the semantic
93
- * data source keys plus their declared `name`, `description`, and property declarations.
92
+ * Returns the manifest that the block declared and the host provided during initialization.
93
+ * It lists each semantic data source key with its declared name, description, icon, and
94
+ * property definitions. Use this hook to list keys when the UI supports multiple data sources,
95
+ * such as in a data source selector.
94
96
  *
95
97
  * Throws if called before `initCustomBlock` has resolved.
96
98
  *
97
- * This is the configuration the block declared, not host-resolved bindings: use
98
- * `useDataSource(key)` for rows and resolved schema. Handy for enumerating the declared
99
- * data source keys (e.g. picking a default key, or rendering a key switcher).
99
+ * The manifest does not include the concrete Notion data source IDs mapped to those keys or
100
+ * any row data. Use `useDataSource(key)` with a declared key to read rows and access the
101
+ * resolved property IDs and schemas.
100
102
  */
101
103
  export function useManifest(): CustomBlockManifest {
102
104
  return useSyncExternalStore(customBlock.subscribe, customBlock.getManifest)