@measured/puck 0.8.0-canary.f4b0563 → 0.9.0-canary.1822536
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 +64 -0
- package/dist/index.css +50 -44
- package/dist/index.js +562 -307
- package/package.json +12 -1
package/README.md
CHANGED
@@ -160,6 +160,63 @@ export const MyComponent: ComponentConfig = {
|
|
160
160
|
};
|
161
161
|
```
|
162
162
|
|
163
|
+
## DropZones
|
164
|
+
|
165
|
+
Puck supports creating complex layouts (like multi-column layouts) using the `<DropZone>` component.
|
166
|
+
|
167
|
+
### Example
|
168
|
+
|
169
|
+
In this example, we use the `<DropZone>` component to render two nested DropZones within another component:
|
170
|
+
|
171
|
+
```tsx
|
172
|
+
import { DropZone } from "@measured/puck";
|
173
|
+
|
174
|
+
export const MyComponent: ComponentConfig = {
|
175
|
+
render: () => {
|
176
|
+
return (
|
177
|
+
<div>
|
178
|
+
<DropZone zone="first-drop-zone">
|
179
|
+
<DropZone zone="second-drop-zone">
|
180
|
+
</div>
|
181
|
+
)
|
182
|
+
}
|
183
|
+
};
|
184
|
+
```
|
185
|
+
|
186
|
+
### Custom root entry points
|
187
|
+
|
188
|
+
You can also do this at the root of your component. This is useful if you have a fixed layout and only want to make certain parts of your page customisable:
|
189
|
+
|
190
|
+
```tsx
|
191
|
+
import { DropZone, Config } from "@measured/puck";
|
192
|
+
|
193
|
+
export const config: Config = {
|
194
|
+
root: {
|
195
|
+
render: ({ children }) => {
|
196
|
+
return (
|
197
|
+
<div>
|
198
|
+
{/* children renders the default zone. This can be omitted if necessary. */}
|
199
|
+
{children}
|
200
|
+
|
201
|
+
<div>
|
202
|
+
<DropZone zone="other-drop-zone">
|
203
|
+
</div>
|
204
|
+
</div>
|
205
|
+
)
|
206
|
+
}
|
207
|
+
}
|
208
|
+
};
|
209
|
+
```
|
210
|
+
|
211
|
+
### The Rules of DropZones
|
212
|
+
|
213
|
+
The current DropZone implementation has certain rules and limitations:
|
214
|
+
|
215
|
+
1. You can drag from the component list on the LHS into any DropZone
|
216
|
+
2. You can drag components between DropZones, so long as those DropZones share a parent (also known as _area_)
|
217
|
+
3. You can't drag between DropZones that don't share a parent (or _area_)
|
218
|
+
4. Your mouse must be directly over a DropZone for a collision to be detected
|
219
|
+
|
163
220
|
## Reference
|
164
221
|
|
165
222
|
### `<Puck>`
|
@@ -183,6 +240,13 @@ The `<Render>` component renders user-facing UI using Puck data.
|
|
183
240
|
- **config** (`Config`): Puck component configuration
|
184
241
|
- **data** (`Data`): Data to render
|
185
242
|
|
243
|
+
### `<DropZone>`
|
244
|
+
|
245
|
+
The `<DropZone>` component allows you to create advanced layouts, like multi-columns.
|
246
|
+
|
247
|
+
- **zone** (`string`): Identifier for the zone of your component, unique to the parent component
|
248
|
+
- **style** (`CSSProperties`): Custom inline styles
|
249
|
+
|
186
250
|
### `Config`
|
187
251
|
|
188
252
|
The `Config` object describes which components Puck should render, how they should render and which inputs are available to them.
|
package/dist/index.css
CHANGED
@@ -210,28 +210,27 @@
|
|
210
210
|
}
|
211
211
|
|
212
212
|
/* css-module:/home/runner/work/puck/puck/packages/core/components/DraggableComponent/styles.module.css/#css-module-data */
|
213
|
-
.
|
214
|
-
position: relative;
|
213
|
+
._DraggableComponent_1phls_1 {
|
215
214
|
pointer-events: auto;
|
216
215
|
}
|
217
|
-
._DraggableComponent--
|
216
|
+
._DraggableComponent--isDragging_1phls_5 {
|
218
217
|
background: #abc7e510;
|
219
218
|
outline: 2px var(--puck-color-azure-8) solid;
|
220
219
|
overflow: hidden;
|
221
220
|
}
|
222
|
-
._DraggableComponent-
|
221
|
+
._DraggableComponent-contents_1phls_11 {
|
223
222
|
position: relative;
|
224
223
|
pointer-events: none;
|
224
|
+
z-index: 0;
|
225
225
|
}
|
226
|
-
._DraggableComponent-
|
227
|
-
._DraggableComponent-
|
226
|
+
._DraggableComponent-contents_1phls_11::before,
|
227
|
+
._DraggableComponent-contents_1phls_11::after {
|
228
228
|
content: " ";
|
229
229
|
display: table;
|
230
230
|
}
|
231
|
-
._DraggableComponent-
|
231
|
+
._DraggableComponent-overlay_1phls_24 {
|
232
232
|
display: none;
|
233
233
|
background: #abc7e530;
|
234
|
-
outline: 2px var(--puck-color-azure-8) solid;
|
235
234
|
cursor: pointer;
|
236
235
|
height: 100%;
|
237
236
|
width: 100%;
|
@@ -242,28 +241,36 @@
|
|
242
241
|
pointer-events: none;
|
243
242
|
box-sizing: border-box;
|
244
243
|
}
|
245
|
-
.
|
244
|
+
._DraggableComponent_1phls_1:hover:not(._DraggableComponent--isLocked_1phls_38) > ._DraggableComponent-overlay_1phls_24 {
|
246
245
|
display: block;
|
247
246
|
pointer-events: none;
|
248
247
|
}
|
249
|
-
._DraggableComponent--
|
248
|
+
._DraggableComponent--forceHover_1phls_44 > ._DraggableComponent-overlay_1phls_24 {
|
250
249
|
display: block;
|
251
250
|
pointer-events: none;
|
252
251
|
}
|
253
|
-
._DraggableComponent--
|
252
|
+
._DraggableComponent_1phls_1:not(._DraggableComponent--isSelected_1phls_49) > ._DraggableComponent-overlay_1phls_24 {
|
253
|
+
outline: 2px var(--puck-color-azure-8) solid;
|
254
|
+
}
|
255
|
+
._DraggableComponent--indicativeHover_1phls_54 > ._DraggableComponent-overlay_1phls_24 {
|
254
256
|
display: block;
|
255
257
|
background: transparent;
|
256
258
|
pointer-events: none;
|
257
259
|
}
|
258
|
-
.
|
260
|
+
._DraggableComponent_1phls_1:not(._DraggableComponent--isSelected_1phls_49):has(._DraggableComponent_1phls_1:hover > ._DraggableComponent-overlay_1phls_24) > ._DraggableComponent-overlay_1phls_24 {
|
259
261
|
display: none;
|
260
262
|
}
|
261
|
-
._DraggableComponent--
|
263
|
+
._DraggableComponent--isSelected_1phls_49 {
|
264
|
+
outline: 2px var(--puck-color-azure-6) solid;
|
265
|
+
}
|
266
|
+
._DraggableComponent--isSelected_1phls_49 > ._DraggableComponent-overlay_1phls_24 {
|
262
267
|
background: none;
|
263
268
|
display: block;
|
264
|
-
|
269
|
+
position: sticky;
|
270
|
+
top: 56px;
|
271
|
+
z-index: 1;
|
265
272
|
}
|
266
|
-
._DraggableComponent-
|
273
|
+
._DraggableComponent-actions_1phls_80 {
|
267
274
|
position: absolute;
|
268
275
|
right: 6.5px;
|
269
276
|
width: auto;
|
@@ -279,10 +286,10 @@
|
|
279
286
|
pointer-events: auto;
|
280
287
|
box-sizing: border-box;
|
281
288
|
}
|
282
|
-
._DraggableComponent--
|
289
|
+
._DraggableComponent--isSelected_1phls_49 > ._DraggableComponent-overlay_1phls_24 > ._DraggableComponent-actions_1phls_80 {
|
283
290
|
display: flex;
|
284
291
|
}
|
285
|
-
._DraggableComponent-
|
292
|
+
._DraggableComponent-actionsLabel_1phls_103 {
|
286
293
|
color: var(--puck-color-grey-7);
|
287
294
|
display: flex;
|
288
295
|
font-size: var(--puck-font-size-xxxs);
|
@@ -296,7 +303,7 @@
|
|
296
303
|
text-overflow: ellipsis;
|
297
304
|
white-space: nowrap;
|
298
305
|
}
|
299
|
-
._DraggableComponent-
|
306
|
+
._DraggableComponent-action_1phls_80 {
|
300
307
|
background: transparent;
|
301
308
|
border: none;
|
302
309
|
color: var(--puck-color-grey-7);
|
@@ -304,14 +311,14 @@
|
|
304
311
|
border-radius: 4px;
|
305
312
|
overflow: hidden;
|
306
313
|
}
|
307
|
-
._DraggableComponent-
|
314
|
+
._DraggableComponent-action_1phls_80:hover {
|
308
315
|
background: var(--puck-color-grey-2);
|
309
316
|
color: var(--puck-color-azure-5);
|
310
317
|
cursor: pointer;
|
311
318
|
}
|
312
319
|
|
313
320
|
/* css-module:/home/runner/work/puck/puck/packages/core/components/DropZone/styles.module.css/#css-module-data */
|
314
|
-
.
|
321
|
+
._DropZone_ou0z5_1 {
|
315
322
|
margin-left: auto;
|
316
323
|
margin-right: auto;
|
317
324
|
zoom: 1.33;
|
@@ -320,39 +327,37 @@
|
|
320
327
|
outline-offset: -1px;
|
321
328
|
width: 100%;
|
322
329
|
}
|
323
|
-
._DropZone-
|
330
|
+
._DropZone-content_ou0z5_11 {
|
324
331
|
min-height: 128px;
|
325
332
|
height: 100%;
|
326
333
|
}
|
327
|
-
._DropZone--
|
334
|
+
._DropZone--userIsDragging_ou0z5_16 ._DropZone-content_ou0z5_11 {
|
328
335
|
pointer-events: all;
|
329
336
|
}
|
330
|
-
._DropZone--
|
337
|
+
._DropZone--userIsDragging_ou0z5_16:not(._DropZone--draggingOverArea_ou0z5_20):not(._DropZone--draggingNewComponent_ou0z5_21) > ._DropZone-content_ou0z5_11 {
|
331
338
|
pointer-events: none;
|
332
339
|
}
|
333
|
-
._DropZone--
|
334
|
-
._DropZone--
|
335
|
-
._DropZone--
|
340
|
+
._DropZone--isAreaSelected_ou0z5_27,
|
341
|
+
._DropZone--draggingOverArea_ou0z5_20:not(:has(._DropZone--hoveringOverArea_ou0z5_28)),
|
342
|
+
._DropZone--hoveringOverArea_ou0z5_28:not(._DropZone--isDisabled_ou0z5_29):not(._DropZone--isRootZone_ou0z5_30) {
|
336
343
|
background: var(--puck-color-azure-9);
|
337
344
|
outline: 2px dashed var(--puck-color-azure-7);
|
338
345
|
}
|
339
|
-
.
|
346
|
+
._DropZone_ou0z5_1:not(._DropZone--hasChildren_ou0z5_36) {
|
340
347
|
background: var(--puck-color-azure-9);
|
341
348
|
outline: 2px dashed var(--puck-color-azure-7);
|
342
349
|
}
|
343
|
-
._DropZone--
|
350
|
+
._DropZone--isDestination_ou0z5_41 {
|
344
351
|
outline: 2px dashed var(--puck-color-azure-3) !important;
|
345
352
|
}
|
346
|
-
._DropZone--
|
353
|
+
._DropZone--isDestination_ou0z5_41:not(._DropZone--isRootZone_ou0z5_30) {
|
347
354
|
background: var(--puck-color-azure-85) !important;
|
348
355
|
}
|
349
|
-
._DropZone-
|
356
|
+
._DropZone-item_ou0z5_49 {
|
350
357
|
position: relative;
|
358
|
+
z-index: 0;
|
351
359
|
}
|
352
|
-
._DropZone-
|
353
|
-
z-index: 1;
|
354
|
-
}
|
355
|
-
._DropZone-hitbox_1980k_57 {
|
360
|
+
._DropZone-hitbox_ou0z5_54 {
|
356
361
|
position: absolute;
|
357
362
|
bottom: -12px;
|
358
363
|
height: 24px;
|
@@ -744,39 +749,40 @@
|
|
744
749
|
}
|
745
750
|
|
746
751
|
/* css-module:/home/runner/work/puck/puck/packages/core/components/Heading/styles.module.css/#css-module-data */
|
747
|
-
.
|
752
|
+
._Heading_1bvy5_1 {
|
748
753
|
display: block;
|
754
|
+
color: var(--puck-color-black);
|
749
755
|
font-family: var(--puck-font-stack);
|
750
756
|
font-weight: 700;
|
751
757
|
margin: 0;
|
752
758
|
}
|
753
|
-
.
|
759
|
+
._Heading_1bvy5_1 b {
|
754
760
|
font-weight: 700;
|
755
761
|
}
|
756
|
-
._Heading--
|
762
|
+
._Heading--xxxxl_1bvy5_13 {
|
757
763
|
font-size: var(--puck-font-size-xxxxl);
|
758
764
|
letter-spacing: 0.08ch;
|
759
765
|
font-weight: 800;
|
760
766
|
}
|
761
|
-
._Heading--
|
767
|
+
._Heading--xxxl_1bvy5_19 {
|
762
768
|
font-size: var(--puck-font-size-xxxl);
|
763
769
|
}
|
764
|
-
._Heading--
|
770
|
+
._Heading--xxl_1bvy5_23 {
|
765
771
|
font-size: var(--puck-font-size-xxl);
|
766
772
|
}
|
767
|
-
._Heading--
|
773
|
+
._Heading--xl_1bvy5_27 {
|
768
774
|
font-size: var(--puck-font-size-xl);
|
769
775
|
}
|
770
|
-
._Heading--
|
776
|
+
._Heading--l_1bvy5_31 {
|
771
777
|
font-size: var(--puck-font-size-l);
|
772
778
|
}
|
773
|
-
._Heading--
|
779
|
+
._Heading--m_1bvy5_35 {
|
774
780
|
font-size: var(--puck-font-size-m);
|
775
781
|
}
|
776
|
-
._Heading--
|
782
|
+
._Heading--s_1bvy5_39 {
|
777
783
|
font-size: var(--puck-font-size-s);
|
778
784
|
}
|
779
|
-
._Heading--
|
785
|
+
._Heading--xs_1bvy5_43 {
|
780
786
|
font-size: var(--puck-font-size-xs);
|
781
787
|
}
|
782
788
|
|