@measured/puck 0.12.0-canary.5caf0ab → 0.12.0-canary.889b4c7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. package/README.md +32 -2
  2. package/dist/index.css +252 -124
  3. package/dist/index.js +254 -371
  4. package/package.json +22 -1
package/README.md CHANGED
@@ -33,7 +33,7 @@ Render the editor:
33
33
  ```jsx
34
34
  // Editor.jsx
35
35
  import { Puck } from "@measured/puck";
36
- import "@measured/puck/dist/index.css";
36
+ import "@measured/puck/puck.css";
37
37
 
38
38
  // Create puck component config
39
39
  const config = {
@@ -71,7 +71,7 @@ Render the page:
71
71
  ```jsx
72
72
  // Page.jsx
73
73
  import { Render } from "@measured/puck";
74
- import "@measured/puck/dist/index.css";
74
+ import "@measured/puck/puck.css";
75
75
 
76
76
  export function Page() {
77
77
  return <Render config={config} data={data} />;
@@ -374,6 +374,36 @@ import { resolveAllData } from "@measured/puck";
374
374
  const resolvedData = resolveAllData(data, config);
375
375
  ```
376
376
 
377
+ ### React server components
378
+
379
+ If you want to use React server components, use ` <Render>` from the `@measured/puck/rsc` bundle instead of the main bundle.
380
+
381
+ ```tsx
382
+ import { Render } from "@measured/puck/rsc";
383
+ import "@measured/puck/puck.css";
384
+
385
+ export function Page() {
386
+ return <Render config={config} data={data} />;
387
+ }
388
+ ```
389
+
390
+ If you're using DropZones with React server components, use the `puck.renderDropZone` prop provided to your render function instead of the `<DropZone>` component.
391
+
392
+ ```tsx
393
+ export const MyComponent: ComponentConfig = {
394
+ render: ({ puck: { renderDropZone } }) => {
395
+ return (
396
+ <div>
397
+ {renderDropZone({ zone: "first-drop-zone" })}
398
+ {renderDropZone({ zone: "second-drop-zone" })}
399
+ </div>
400
+ );
401
+ },
402
+ };
403
+ ```
404
+
405
+ In future, we may deprecate DropZone in favour of renderDropZone.
406
+
377
407
  ## Reference
378
408
 
379
409
  ### `<Puck>`