@notionhq/custom-blocks 0.1.49 → 0.2.0

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.
Files changed (49) hide show
  1. package/README.md +2 -3
  2. package/dist/bridge/SandboxBridge.d.ts.map +1 -1
  3. package/dist/bridge/SandboxBridge.js +2 -4
  4. package/dist/bridge/sandboxClient.d.ts +0 -5
  5. package/dist/bridge/sandboxClient.d.ts.map +1 -1
  6. package/dist/bridge/sandboxClient.js +0 -12
  7. package/dist/customBlock.d.ts +0 -22
  8. package/dist/customBlock.d.ts.map +1 -1
  9. package/dist/customBlock.js +0 -37
  10. package/dist/index.d.ts +1 -1
  11. package/dist/index.d.ts.map +1 -1
  12. package/dist/protocol/dataSources/dataSourcePage.d.ts +2 -2
  13. package/dist/protocol/dataSources/dataSourcePage.js +2 -3
  14. package/dist/protocol/messages/createPageResult.d.ts +2 -2
  15. package/dist/protocol/messages/getPage.d.ts +2 -2
  16. package/dist/protocol/messages/hostToSandbox.d.ts +9 -9
  17. package/dist/protocol/messages/init.d.ts +1 -1
  18. package/dist/protocol/messages/init.js +2 -3
  19. package/dist/protocol/messages/queryDataSourceResult.d.ts +2 -2
  20. package/dist/protocol/messages/updatePageResult.d.ts +2 -2
  21. package/dist/protocol/pages/page.d.ts +2 -2
  22. package/dist/protocol/pages/page.js +2 -3
  23. package/dist/protocol/protocolVersion.d.ts +1 -1
  24. package/dist/protocol/protocolVersion.js +1 -1
  25. package/dist/react/NotionCustomBlock.d.ts +1 -9
  26. package/dist/react/NotionCustomBlock.d.ts.map +1 -1
  27. package/dist/react/NotionCustomBlock.js +9 -3
  28. package/dist/react/index.d.ts +0 -1
  29. package/dist/react/index.d.ts.map +1 -1
  30. package/dist/react/index.js +0 -1
  31. package/dist/types.d.ts +4 -38
  32. package/dist/types.d.ts.map +1 -1
  33. package/dist/version.js +1 -1
  34. package/docs/lifecycle.md +1 -14
  35. package/docs/users.md +97 -26
  36. package/package.json +1 -6
  37. package/src/bridge/SandboxBridge.ts +2 -4
  38. package/src/bridge/sandboxClient.ts +0 -15
  39. package/src/customBlock.ts +1 -65
  40. package/src/index.ts +1 -1
  41. package/src/react/NotionCustomBlock.tsx +9 -11
  42. package/src/react/index.ts +0 -1
  43. package/src/types.ts +4 -46
  44. package/dist/react/useCustomBlockAutoResize.d.ts +0 -26
  45. package/dist/react/useCustomBlockAutoResize.d.ts.map +0 -1
  46. package/dist/react/useCustomBlockAutoResize.js +0 -31
  47. package/src/react/useCustomBlockAutoResize.ts +0 -42
  48. package/vite-plugin/index.d.ts +0 -12
  49. package/vite-plugin/index.js +0 -11
@@ -1,42 +0,0 @@
1
- import { useEffect } from "react"
2
- import { customBlock } from "../customBlock.js"
3
-
4
- /**
5
- * Measures the sandbox's `#root` element and posts `resize` messages so the host iframe
6
- * matches the block's border-box height. Unchanged values are deduped.
7
- *
8
- * `<NotionCustomBlock>` calls this hook for you. Only use it directly in a custom
9
- * initialization wrapper that does not render `<NotionCustomBlock>`.
10
- *
11
- * @deprecated Use CSS `max-height` and `overflow` to constrain block content instead.
12
- *
13
- * @example
14
- * function App() {
15
- * const [enabled, setEnabled] = useState(true)
16
- * useCustomBlockAutoResize({ enabled })
17
- * return <div>…</div>
18
- * }
19
- */
20
- export function useCustomBlockAutoResize(
21
- args: {
22
- /**
23
- * Whether or not the hook is enabled. To disable this behavior, pass `false`. This is
24
- * provided as an argument to allow for conditional disabling of the hook.
25
- *
26
- * @default true
27
- */
28
- enabled?: boolean
29
- } = {},
30
- ): void {
31
- const { enabled = true } = args
32
- useEffect(() => {
33
- if (!enabled) {
34
- return
35
- }
36
- if (typeof window === "undefined") {
37
- return
38
- }
39
- const target = document.getElementById("root")
40
- return customBlock.autoResize({ target })
41
- }, [enabled])
42
- }
@@ -1,12 +0,0 @@
1
- export type NotionCustomBlockPlugin = {
2
- name: string
3
- }
4
-
5
- /**
6
- * Vite plugin for Notion custom blocks.
7
- *
8
- * @deprecated This compatibility stub does nothing. Remove it from Vite config when possible.
9
- *
10
- * TODO(custom-blocks): Remove this when bumping bridge SDK version to 0.2.0.
11
- */
12
- export function notionCustomBlock(): NotionCustomBlockPlugin
@@ -1,11 +0,0 @@
1
- /**
2
- * Vite plugin for Notion custom blocks.
3
- *
4
- * @deprecated This is just a compatibility stub to ensure existing block code can continue to work
5
- * with the new SDK.
6
- *
7
- * TODO(custom-blocks): Remove this when bumping bridge SDK version to 0.2.0.
8
- */
9
- export function notionCustomBlock() {
10
- return { name: "custom-blocks:legacy-vite-plugin" }
11
- }