efficient-easel 0.99.1 → 0.100.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.
- package/README.md +281 -36
- package/dist/autosave/index.d.ts +12 -6
- package/dist/blocks/index.d.ts +2 -2
- package/dist/canvas/index.d.ts +3 -3
- package/dist/canvas/index.js +1 -1
- package/dist/chrome/chrome.css +96 -29
- package/dist/chrome/index.d.ts +72 -19
- package/dist/chrome/index.js +17 -21
- package/dist/chunk-3EDSDPIP.js +1 -0
- package/dist/chunk-67GNT6PF.js +1 -0
- package/dist/{chunk-PI26YXYD.js → chunk-6EIVTKZZ.js} +21 -14
- package/dist/chunk-A5UK76FC.js +6 -0
- package/dist/chunk-AZT7V4UM.js +10 -0
- package/dist/chunk-DICUMYMG.js +12 -0
- package/dist/chunk-HDVD27VB.js +1 -0
- package/dist/chunk-JQM3V7XQ.js +1 -0
- package/dist/{chunk-TDA4HH54.js → chunk-JUQ6YJCG.js} +1 -1
- package/dist/chunk-LA54QLP5.js +1 -0
- package/dist/chunk-LGKQXSKO.js +16 -0
- package/dist/chunk-M6F6LS3H.js +1 -0
- package/dist/chunk-MH5GUZFQ.js +9 -0
- package/dist/chunk-P6O363EE.js +6 -0
- package/dist/chunk-PAELDYYS.js +1 -0
- package/dist/{chunk-JYPOOHII.js → chunk-QKVR3K73.js} +3 -3
- package/dist/chunk-SAJUCHOX.js +1 -0
- package/dist/chunk-TRVZ7C23.js +1 -0
- package/dist/chunk-V7GIIXFB.js +16 -0
- package/dist/{chunk-IBOFSS56.js → chunk-WZ7TGAAT.js} +1 -1
- package/dist/chunk-ZJEBF4NB.js +1 -0
- package/dist/copy/copy.css +388 -5
- package/dist/copy/index.d.ts +271 -8
- package/dist/copy/index.js +31 -10
- package/dist/data/index.d.ts +4 -4
- package/dist/drag/drag.css +10 -1
- package/dist/drag/index.d.ts +102 -11
- package/dist/drag/index.js +18 -17
- package/dist/{editor/editor.css → easel/easel.css} +16 -1
- package/dist/{editor → easel}/index.d.ts +146 -51
- package/dist/easel/index.js +9 -0
- package/dist/edit-lock/index.d.ts +3 -3
- package/dist/edit-lock/index.js +1 -1
- package/dist/fields/fields.css +103 -26
- package/dist/fields/index.d.ts +51 -13
- package/dist/fields/index.js +30 -46
- package/dist/gold/index.js +1 -1
- package/dist/icons/index.d.ts +10 -1
- package/dist/icons/index.js +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.js +1 -1
- package/dist/markup/index.d.ts +94 -10
- package/dist/markup/index.js +1 -1
- package/dist/menu/index.d.ts +61 -6
- package/dist/menu/index.js +15 -15
- package/dist/menu/menu.css +17 -6
- package/dist/node-ops/index.d.ts +9 -9
- package/dist/node-ops/index.js +1 -1
- package/dist/panel/index.d.ts +73 -5
- package/dist/panel/index.js +18 -16
- package/dist/panel/panel.css +56 -1
- package/dist/pick/index.d.ts +42 -4
- package/dist/pick/index.js +7 -14
- package/dist/pick/pick.css +14 -0
- package/dist/rail/index.d.ts +6 -6
- package/dist/rail/index.js +1 -1
- package/dist/rail/rail.css +1 -1
- package/dist/strings/catalogue.d.ts +24 -40
- package/dist/strings/catalogue.js +1 -1
- package/dist/strings/index.d.ts +25 -23
- package/dist/strings/index.js +2 -2
- package/dist/style-clipboard/index.d.ts +5 -5
- package/dist/style-clipboard/index.js +1 -1
- package/dist/text-styles/index.d.ts +328 -0
- package/dist/text-styles/index.js +38 -0
- package/dist/text-styles/text-styles.css +309 -0
- package/dist/tree/index.d.ts +44 -3
- package/dist/tree/index.js +1 -1
- package/dist/tree/tree.css +71 -0
- package/dist/{types-CnRzp9oc.d.ts → types-DGcCsxs8.d.ts} +79 -12
- package/dist/{types-DNrn_w4V.d.ts → types-DWS-s9z-.d.ts} +10 -10
- package/dist/{types-pGBXevBU.d.ts → types-Djdq6Xkd.d.ts} +15 -8
- package/dist/{types-Dy6oR6Z2.d.ts → types-E3HrTPg2.d.ts} +20 -14
- package/dist/{types-C7HFvdtk.d.ts → types-VqL6t5HH.d.ts} +82 -5
- package/dist/{watch-DmasQA61.d.ts → watch-BTYOJpQU.d.ts} +19 -2
- package/dist/{wordFit-9B9nqyf3.d.ts → wordFit-D4S36PvB.d.ts} +1 -1
- package/dist/{words-DagJdwIA.d.ts → words-AHHfiaRY.d.ts} +31 -2
- package/dist/{words-D9ChvbNC.d.ts → words-BDignMl_.d.ts} +1 -1
- package/dist/{words-Cqmyey0s.d.ts → words-BMzV04b1.d.ts} +2 -2
- package/dist/words-CJjUKcV5.d.ts +37 -0
- package/dist/words-CRYvAiHX.d.ts +105 -0
- package/dist/{words-B2YLaKEr.d.ts → words-CnnHb9jo.d.ts} +1 -1
- package/dist/{words-CD3WADyb.d.ts → words-CzoyDNHm.d.ts} +4 -0
- package/dist/{words-bOMsUJk9.d.ts → words-DBq7vfHy.d.ts} +59 -6
- package/dist/{words-DOhF-4D4.d.ts → words-DMG4dYq2.d.ts} +1 -1
- package/dist/{words-BK-npta-.d.ts → words-DgHcY5qB.d.ts} +10 -4
- package/dist/{words-B87GIFWH.d.ts → words-is_Vy6hn.d.ts} +1 -1
- package/package.json +14 -8
- package/dist/chunk-66CKSTXP.js +0 -14
- package/dist/chunk-67VZRQLG.js +0 -13
- package/dist/chunk-6PS6STGA.js +0 -1
- package/dist/chunk-7A7O2JWQ.js +0 -1
- package/dist/chunk-H4B72XCJ.js +0 -1
- package/dist/chunk-JE63JHKO.js +0 -1
- package/dist/chunk-KDIVA6WD.js +0 -1
- package/dist/chunk-MCLBHENY.js +0 -1
- package/dist/chunk-QB3BZIRA.js +0 -5
- package/dist/chunk-SJQG5ENJ.js +0 -1
- package/dist/chunk-SUO5627P.js +0 -1
- package/dist/chunk-ZT7M24XD.js +0 -1
- package/dist/editor/index.js +0 -9
- /package/dist/{chunk-GGTPNGFJ.js → chunk-AELNNAFM.js} +0 -0
package/dist/drag/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import { HTMLAttributes, ReactNode } from 'react';
|
|
3
3
|
import { P as Place, S as SlotAddress } from '../types-41704JE4.js';
|
|
4
|
-
import { C as CanvasTarget$1 } from '../watch-
|
|
5
|
-
import { D as DragWords } from '../words-
|
|
4
|
+
import { C as CanvasTarget$1 } from '../watch-BTYOJpQU.js';
|
|
5
|
+
import { D as DragWords } from '../words-BDignMl_.js';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* The one drag in flight, shared by every surface of an editor — the Layers
|
|
@@ -117,6 +117,12 @@ declare function stepGap(from: Place, dir: -1 | 1): Place;
|
|
|
117
117
|
*
|
|
118
118
|
* A drop the host refuses draws nothing and cannot land; a drop that would leave
|
|
119
119
|
* the row where it was draws nothing either. Leaving the tree clears the line.
|
|
120
|
+
*
|
|
121
|
+
* An EMPTY list is not a seam: a seam is the gap between two rows and takes
|
|
122
|
+
* back the space it adds, so alone in a list it is a strip nobody can aim at.
|
|
123
|
+
* Draw `efficient-easel/tree`'s `TreeEmptySlot` there, with the same `seam()`:
|
|
124
|
+
*
|
|
125
|
+
* <TreeEmptySlot {...drag.seam({ place: { ...list, index: 0 } })} onAdd={…} />
|
|
120
126
|
*/
|
|
121
127
|
|
|
122
128
|
type TreeDragOptions<I> = {
|
|
@@ -179,7 +185,8 @@ declare function useTreeDrag<I>(options: TreeDragOptions<I>): TreeDrag<I>;
|
|
|
179
185
|
* pixels apart); a parent is picked up by hovering its own padding.
|
|
180
186
|
* - THE ZONE: the innermost list under the pointer that will take the drop. A
|
|
181
187
|
* refused inner zone falls through to the next one out — a section dragged
|
|
182
|
-
* over a column lands between sections, not nowhere.
|
|
188
|
+
* over a column lands between sections, not nowhere. (Decided again on
|
|
189
|
+
* 2026-10-07; see `canvasTarget`.)
|
|
183
190
|
* - THE GAP: along the zone's own axis — down a column, ACROSS a row of
|
|
184
191
|
* columns — counted against the children's midpoints; the line is drawn in
|
|
185
192
|
* the middle of that gap, horizontal or vertical to match.
|
|
@@ -239,8 +246,27 @@ type CanvasTarget = {
|
|
|
239
246
|
* outside it. A drop that would leave the thing where it is lands NOWHERE — it
|
|
240
247
|
* does not fall through to an outer list, which would move it somewhere the
|
|
241
248
|
* pointer is not.
|
|
249
|
+
*
|
|
250
|
+
* ── THE FALL-THROUGH STAYS, AND A HOST MAY END IT (second host, 2026-10-07) ──
|
|
251
|
+
* A host reported it as a surprise: a Columns block dragged onto a column,
|
|
252
|
+
* which refuses columns, landed at the top level instead of being refused; and
|
|
253
|
+
* a block picked up INSIDE a container, held over a part of that container
|
|
254
|
+
* that will not take it, left the container for the page.
|
|
255
|
+
*
|
|
256
|
+
* It stays the rule, for three reasons. A page is covered by its inner lists:
|
|
257
|
+
* without the fall-through a section could be dropped only on the few pixels
|
|
258
|
+
* of the page's own list that show between sections. Both editors this was
|
|
259
|
+
* built for have shipped on it. And it is not silent: the line is drawn where
|
|
260
|
+
* the drop WILL land before the button is let go, across the page for a drop
|
|
261
|
+
* the page takes.
|
|
262
|
+
*
|
|
263
|
+
* But what surprises is the host's to know — the engine never learns what a
|
|
264
|
+
* column is — so the host may answer for each refusal: `fallThrough(refused)`
|
|
265
|
+
* is asked with the place that just refused, and `false` ends it there. The
|
|
266
|
+
* drop lands nowhere, no line is drawn, and the browser shows it refused.
|
|
267
|
+
* Left out, every refusal falls through, as before.
|
|
242
268
|
*/
|
|
243
|
-
declare function canvasTarget(zones: readonly CanvasZone[], x: number, y: number, accept: (to: Place) => boolean, isNoOp?: (to: Place) => boolean): CanvasTarget;
|
|
269
|
+
declare function canvasTarget(zones: readonly CanvasZone[], x: number, y: number, accept: (to: Place) => boolean, isNoOp?: (to: Place) => boolean, fallThrough?: (refused: Place) => boolean): CanvasTarget;
|
|
244
270
|
/** The seams between a zone's children — where "+ Add section" goes. */
|
|
245
271
|
declare function seamsBetween(zone: CanvasZone, keyPrefix?: string): CanvasSeam[];
|
|
246
272
|
|
|
@@ -271,6 +297,19 @@ type CanvasDragLayerProps<I> = {
|
|
|
271
297
|
model: (measured: MeasuredCanvas) => CanvasDragModel<I>;
|
|
272
298
|
canDrop: (item: I, to: Place) => boolean;
|
|
273
299
|
onDrop: (item: I, to: Place) => void;
|
|
300
|
+
/**
|
|
301
|
+
* A drop the innermost list under the pointer refuses is offered to the next
|
|
302
|
+
* list out: a section held over a column lands between sections, and the
|
|
303
|
+
* line shows where (./canvasHit). Answer `false` here to END it at the list
|
|
304
|
+
* that refused — nothing is drawn and nothing lands — for a drop where
|
|
305
|
+
* falling through would surprise: a Columns block over a column, or a block
|
|
306
|
+
* leaving the container it was picked up in.
|
|
307
|
+
*
|
|
308
|
+
* Asked only about a place `canDrop` has just refused: `refused` is that
|
|
309
|
+
* place, `from` where the thing was picked up (absent for a new one, from
|
|
310
|
+
* the Add list). Left out, every refusal falls through.
|
|
311
|
+
*/
|
|
312
|
+
fallThrough?: (item: I, refused: Place, from?: Place) => boolean;
|
|
274
313
|
/** The handle CLICKED, not dragged: select what it names. Absent: a click does nothing. */
|
|
275
314
|
onPick?: (item: I) => void;
|
|
276
315
|
/** "+ Add section" in a seam: open the Add panel at that place. */
|
|
@@ -286,7 +325,7 @@ type CanvasDragLayerProps<I> = {
|
|
|
286
325
|
measure?: (canvas: CanvasTarget$1, layer: Element) => MeasuredCanvas;
|
|
287
326
|
/**
|
|
288
327
|
* The layer's own words in the host's language:
|
|
289
|
-
* `
|
|
328
|
+
* `useEaselStrings().drag.canvas` (0.95.0). Left out, English. `seamLabel`
|
|
290
329
|
* and `zoneAddLabel` above still win for their one word. A prop, not the
|
|
291
330
|
* strings provider: drag imports only its own lane.
|
|
292
331
|
*/
|
|
@@ -296,6 +335,15 @@ type CanvasDragLayerProps<I> = {
|
|
|
296
335
|
declare const HANDLE_GRACE_MS = 140;
|
|
297
336
|
declare function CanvasDragLayer<I>(props: CanvasDragLayerProps<I>): react.JSX.Element;
|
|
298
337
|
|
|
338
|
+
/**
|
|
339
|
+
* One thing the Add list offers.
|
|
340
|
+
*
|
|
341
|
+
* `readOnly` is the whole panel's; `disabled` is one tile's (second host,
|
|
342
|
+
* 2026-10-07): a block that may not be added JUST NOW — a second Header —
|
|
343
|
+
* stays where a merchant looks for it, dimmed, and says why. A block that may
|
|
344
|
+
* be added only in some places is not disabled: that is the host's `canDrop`
|
|
345
|
+
* to refuse and its `onInsert` to place.
|
|
346
|
+
*/
|
|
299
347
|
type AddTile = {
|
|
300
348
|
/** The block's type — what `onInsert` and `itemFor` are given. */
|
|
301
349
|
type: string;
|
|
@@ -309,6 +357,16 @@ type AddTile = {
|
|
|
309
357
|
/** A picture of what it adds — a section's thumbnail. Every tile of a group
|
|
310
358
|
* having one lays the group out as cards. */
|
|
311
359
|
cover?: ReactNode;
|
|
360
|
+
/**
|
|
361
|
+
* It cannot be added just now. The tile stays in the list, dimmed, and is
|
|
362
|
+
* still found by search and counted by its group; a click adds nothing and
|
|
363
|
+
* a drag does not start. `aria-disabled`, not the native attribute, so the
|
|
364
|
+
* tile keeps the focus and its reason can be reached from the keyboard.
|
|
365
|
+
*/
|
|
366
|
+
disabled?: boolean;
|
|
367
|
+
/** Why, in the host's words ("A page has one header"): a disabled tile's
|
|
368
|
+
* tooltip, in place of "Add …". Left out, a disabled tile has none. */
|
|
369
|
+
disabledReason?: string;
|
|
312
370
|
};
|
|
313
371
|
type AddGroup = {
|
|
314
372
|
title: string;
|
|
@@ -334,7 +392,7 @@ type AddPanelProps<I> = {
|
|
|
334
392
|
readOnly?: boolean;
|
|
335
393
|
/**
|
|
336
394
|
* The shell's own words in the host's language:
|
|
337
|
-
* `
|
|
395
|
+
* `useEaselStrings().drag.add` (0.95.0). Left out, English. `hint` and
|
|
338
396
|
* `searchLabel` above still win for their one line. A prop, not the strings
|
|
339
397
|
* provider: drag imports only its own lane.
|
|
340
398
|
*/
|
|
@@ -342,6 +400,26 @@ type AddPanelProps<I> = {
|
|
|
342
400
|
};
|
|
343
401
|
declare function AddPanel<I>({ groups, session, itemFor, onInsert, at, hint: ownHint, searchLabel: ownSearchLabel, readOnly, words, }: AddPanelProps<I>): react.JSX.Element;
|
|
344
402
|
|
|
403
|
+
/**
|
|
404
|
+
* The effect a drop target names (second host, 2026-10-06).
|
|
405
|
+
*
|
|
406
|
+
* A browser lands a drop only if the `dropEffect` the target named in its last
|
|
407
|
+
* `dragover` is one the source's `effectAllowed` includes. Otherwise the cursor
|
|
408
|
+
* says "no" and `drop` NEVER FIRES: the line is drawn and nothing lands.
|
|
409
|
+
*
|
|
410
|
+
* The surfaces here start two kinds of drag. A row or a block picked up is a
|
|
411
|
+
* MOVE (`effectAllowed = 'move'`); a tile from the Add list is a COPY (it stays
|
|
412
|
+
* in the list). So a target cannot name one effect for both — it names one the
|
|
413
|
+
* source allowed, and the cursor then says what will happen: a move, or a "+".
|
|
414
|
+
*
|
|
415
|
+
* Read from the event, not from the session: it is the browser that holds the
|
|
416
|
+
* drop to it. And ONE function for every surface. Until then the canvas had
|
|
417
|
+
* this rule inline and the tree named "move" for everything, so a tile could be
|
|
418
|
+
* dropped on the canvas and never on the tree — and jsdom, which does not
|
|
419
|
+
* enforce drag effects, let the spec for it pass.
|
|
420
|
+
*/
|
|
421
|
+
declare function dropEffectFor(effectAllowed: string): 'move' | 'copy';
|
|
422
|
+
|
|
345
423
|
/**
|
|
346
424
|
* Scroll the list while a drag is held near its top or bottom edge (blueprint
|
|
347
425
|
* step 3.1).
|
|
@@ -357,7 +435,7 @@ declare function AddPanel<I>({ groups, session, itemFor, onInsert, at, hint: own
|
|
|
357
435
|
* - further than 56px OUTSIDE the box, nothing: the pointer has gone elsewhere.
|
|
358
436
|
*
|
|
359
437
|
* Nothing here reads a global at import; the document and the frame clock come
|
|
360
|
-
* from the element
|
|
438
|
+
* from the element the pointer is held against.
|
|
361
439
|
*/
|
|
362
440
|
declare const AUTO_SCROLL_EDGE = 56;
|
|
363
441
|
declare const AUTO_SCROLL_MAX_SPEED = 16;
|
|
@@ -369,11 +447,24 @@ declare function autoScrollDelta(y: number, top: number, bottom: number): number
|
|
|
369
447
|
declare function scrollParent(el: Element | null): HTMLElement | null;
|
|
370
448
|
/** `el` itself if it scrolls, else the nearest ancestor that does. */
|
|
371
449
|
declare function scrollBoxOf(el: HTMLElement | null): HTMLElement | null;
|
|
450
|
+
/**
|
|
451
|
+
* A canvas frame's own scrolling element, if its document is longer than the
|
|
452
|
+
* frame — a frame that fills its pane and scrolls itself
|
|
453
|
+
* (`EaselCanvas height="fill"`). Null for a frame as tall as its content,
|
|
454
|
+
* which the host's pane scrolls.
|
|
455
|
+
*/
|
|
456
|
+
declare function frameScrollBox(doc: Document): HTMLElement | null;
|
|
372
457
|
/**
|
|
373
458
|
* Scroll `box` while a drag is live. Reads the pointer from a capturing
|
|
374
|
-
* `dragover` on the
|
|
375
|
-
*
|
|
459
|
+
* `dragover` on the document the drag is IN, and holds it against the top and
|
|
460
|
+
* bottom of `edges`. Returns the stop.
|
|
461
|
+
*
|
|
462
|
+
* `edges` is the box itself, for a list or a pane in the page. For a canvas
|
|
463
|
+
* frame that scrolls itself it is the FRAME: what scrolls is the frame's
|
|
464
|
+
* document, but the drag never enters it — the drag layer lies over the frame,
|
|
465
|
+
* in the host page — so the pointer is the host's, and the edges it is held
|
|
466
|
+
* near are the frame element's (second host, 2026-10-06).
|
|
376
467
|
*/
|
|
377
|
-
declare function startAutoScroll(box: HTMLElement): () => void;
|
|
468
|
+
declare function startAutoScroll(box: HTMLElement, edges?: Element): () => void;
|
|
378
469
|
|
|
379
|
-
export { AUTO_SCROLL_EDGE, AUTO_SCROLL_MAX_SPEED, type AddGroup, AddPanel, type AddPanelProps, type AddTile, type Box, CanvasDragLayer, type CanvasDragLayerProps, type CanvasDragModel, type CanvasTarget as CanvasDropTarget, type CanvasSeam, type CanvasSource, type CanvasZone, type DragHeld, type DragSession, DragWords, type DropRow, type DropSide, type DropSpot, EMPTY_MEASURE, HANDLE_GRACE_MS, type MeasuredCanvas, type MeasuredNode, type TreeDrag, type TreeDragOptions, type TreeDragRowOptions, type TreeDragRowProps, type TreeDragSeamOptions, type TreeDragSeamProps, autoScrollDelta, autoScrollSpeed, canvasTarget, contains, createDragSession, dropOnRow, gapInZone, gapLine, gapToMoveIndex, isNoOpDrop, measureCanvas, pickSource, scrollBoxOf, scrollParent, seamsBetween, startAutoScroll, stepGap, useTreeDrag };
|
|
470
|
+
export { AUTO_SCROLL_EDGE, AUTO_SCROLL_MAX_SPEED, type AddGroup, AddPanel, type AddPanelProps, type AddTile, type Box, CanvasDragLayer, type CanvasDragLayerProps, type CanvasDragModel, type CanvasTarget as CanvasDropTarget, type CanvasSeam, type CanvasSource, type CanvasZone, type DragHeld, type DragSession, DragWords, type DropRow, type DropSide, type DropSpot, EMPTY_MEASURE, HANDLE_GRACE_MS, type MeasuredCanvas, type MeasuredNode, type TreeDrag, type TreeDragOptions, type TreeDragRowOptions, type TreeDragRowProps, type TreeDragSeamOptions, type TreeDragSeamProps, autoScrollDelta, autoScrollSpeed, canvasTarget, contains, createDragSession, dropEffectFor, dropOnRow, frameScrollBox, gapInZone, gapLine, gapToMoveIndex, isNoOpDrop, measureCanvas, pickSource, scrollBoxOf, scrollParent, seamsBetween, startAutoScroll, stepGap, useTreeDrag };
|
package/dist/drag/index.js
CHANGED
|
@@ -1,17 +1,18 @@
|
|
|
1
|
-
import{DEFAULT_DRAG_WORDS as e}from"../chunk-O2NLQBFX.js";import{
|
|
2
|
-
/* @__PURE__ */
|
|
3
|
-
/* @__PURE__ */
|
|
4
|
-
return
|
|
5
|
-
/* @__PURE__ */
|
|
6
|
-
/* @__PURE__ */
|
|
7
|
-
/* @__PURE__ */
|
|
8
|
-
/* @__PURE__ */
|
|
9
|
-
/* @__PURE__ */
|
|
10
|
-
/* @__PURE__ */
|
|
11
|
-
/* @__PURE__ */
|
|
12
|
-
/* @__PURE__ */
|
|
13
|
-
/* @__PURE__ */
|
|
14
|
-
/* @__PURE__ */
|
|
15
|
-
/* @__PURE__ */
|
|
16
|
-
/* @__PURE__ */
|
|
17
|
-
|
|
1
|
+
import{DEFAULT_DRAG_WORDS as e}from"../chunk-O2NLQBFX.js";import{dropEffectFor as t,scrollBoxOf as n,frameScrollBox as l,startAutoScroll as r,isNoOpDrop as a}from"../chunk-67GNT6PF.js";export{AUTO_SCROLL_EDGE,AUTO_SCROLL_MAX_SPEED,autoScrollDelta,autoScrollSpeed,createDragSession,dropEffectFor,dropOnRow,frameScrollBox,gapToMoveIndex,isNoOpDrop,scrollBoxOf,scrollParent,startAutoScroll,stepGap,useTreeDrag}from"../chunk-67GNT6PF.js";import{useCanvasLayout as o,useCanvasEvent as s}from"../chunk-PAELDYYS.js";import{framePointToHost as i,elementScale as c,frameRectToLayer as d,clientPointToLayer as u}from"../chunk-ZNCEOSXO.js";import{CloseIcon as h,SearchIcon as p}from"../chunk-6EIVTKZZ.js";import{parseZoneKey as f}from"../chunk-KRXQM65X.js";import"../chunk-NKB3KVAB.js";import{useRef as m,useEffect as g,useState as b,useCallback as y,useMemo as v,useSyncExternalStore as x,useId as k,useLayoutEffect as w}from"react";import{jsxs as N,jsx as D}from"react/jsx-runtime";var A=(e,t,n)=>t>=e.left&&t<=e.left+e.width&&n>=e.top&&n<=e.top+e.height,S=e=>e.width*e.height;function T(e,t,n){let l=null;for(const r of e)A(r.box,t,n)&&(!l||S(r.box)<=S(l.box))&&(l=r);return l}function z(e,t,n){const l="x"===e.axis?t:n;let r=0;for(const t of e.children){l>("x"===e.axis?t.left+t.width/2:t.top+t.height/2)&&(r+=1)}return r}function E(e,t){const n=e.children;if("x"===e.axis){const l=n[t-1],r=n[t],a=l&&r?(l.left+l.width+r.left)/2:l?l.left+l.width:r?r.left:e.box.left,o=r??l??e.box;return{left:a-1,top:o.top,width:2,height:o.height}}const l=n[t-1],r=n[t],a=l&&r?(l.top+l.height+r.top)/2:l?l.top+l.height:r?r.top:e.box.top;return{left:e.box.left,top:a-1,width:e.box.width,height:2}}function C(e,t,n,l,r=()=>!1,a=()=>!0){const o=e.filter(e=>A(e.box,t,n)).sort((e,t)=>S(e.box)-S(t.box));for(const e of o){const o=z(e,t,n),s={...e.list,index:o};if(r(s))return null;if(l(s))return{zone:e,to:s,line:E(e,o)};if(!a(s))return null}return null}function L(e,t=e.key){const n=[];for(let l=1;l<e.children.length;l++){const r=e.children[l-1],a=e.children[l],o=r.top+r.height;n.push({key:`${t}:${l}`,place:{...e.list,index:l},box:{left:e.box.left,top:o,width:e.box.width,height:Math.max(a.top-o,0)}})}return n}var O={nodes:[],zones:[]},j="data-puck-dropzone",B="data-puck-component";function K(e,t){if(e.length>=2){const[t,n]=e;return Math.abs(n.top-t.top)<Math.min(t.height,n.height)/2&&n.left>t.left?"x":"y"}const n=t.ownerDocument.defaultView?.getComputedStyle(t);return n&&n.display.includes("flex")&&n.flexDirection.startsWith("row")?"x":"y"}function M(e,t){const{frame:n,document:l}=e,r=e=>d(n,function(e){const t=e.getBoundingClientRect();return{left:t.left,top:t.top,width:t.width,height:t.height}}(e),t),a=[],o=[];for(const e of l.querySelectorAll(`[${j}]`)){const t=e.getAttribute(j)??"";let n;try{n=f(t)}catch{continue}const l=[...e.querySelectorAll(`[${B}]`)].filter(t=>t.parentElement?.closest(`[${j}]`)===e),s=l.map(r);o.push({key:t,list:n,box:r(e),axis:K(s,e),children:s}),l.forEach((e,t)=>{const l=e.getAttribute(B);l&&a.push({id:l,place:{...n,index:t},box:s[t]})})}return{nodes:a,zones:o}}var $="data-es-empty-cell",P="data-puck-dropzone",X=140;var R=e=>({left:e.left,top:e.top,width:e.width,height:e.height});function q(d){const{canvas:h,session:p,readOnly:f,words:k=e.canvas}=d,A=m(d);g(()=>{A.current=d});const S=m(null),z=o(h),[E,L]=b(0),j=y(()=>L(e=>e+1),[]),[B,K]=b(O);g(()=>{const e=S.current;h&&e&&K((A.current.measure??M)(h,e))},[h,z,d.revision,E]);const X=d.model,q=v(()=>X(B),[X,B]),F=x(p.subscribe,p.shown,p.shown),[Z,_]=b(null),[G,Y]=b(null),I=m(null),V=()=>{I.current&&clearTimeout(I.current),I.current=null},Q=()=>{V(),I.current=setTimeout(()=>{p.get()||_(null)},140)};g(()=>V,[]);const U=m(null);s(h,"mousemove",e=>{const t=S.current;if(!h||!t)return;const n=i(h.frame,e.clientX,e.clientY,t),l=c(t),r={x:n.x/l,y:n.y/l};if(U.current=r,A.current.readOnly||p.get())return;V();const a=T(q.sources,r.x,r.y);_(e=>e?.key===a?.key&&e?.box===a?.box?e:a)}),s(h,"mouseout",e=>{e.relatedTarget||(U.current=null,Q())}),s(h,"mouseover",e=>{e.relatedTarget||j()});const W=m(null),H=y(()=>{W.current?.(),W.current=null,Y(null)},[]);g(()=>p.subscribe(()=>{p.get()?j():H()}),[p,H,j]),g(()=>H,[H]),("undefined"==typeof document?g:w)(()=>{if(p.get())return;const e=U.current;_(t=>f?null:e?T(q.sources,e.x,e.y):t?q.sources.find(e=>e.key===t.key)??null:null)},[q,F,p,f]);const J=e=>{const t=p.get(),n=S.current;if(!t||!n)return null;const l=u(n,e.clientX,e.clientY);U.current=l;const r=C(q.zones,l.x,l.y,e=>A.current.canDrop(t.item,e),e=>!!t.from&&a(t.from,e),e=>A.current.fallThrough?.(t.item,e,t.from)??!0);return r?{h:t,t:r}:null},ee={onDragEnter:e=>{if(W.current)return;const t=n(e.currentTarget.parentElement?.parentElement??null),a=h?l(h.document):null,o=[];t&&o.push(r(t)),a&&h&&o.push(r(a,h.frame)),W.current=o.length?()=>o.forEach(e=>e()):null},onDragOver:e=>{const n=J(e);if(!n)return void Y(null);e.preventDefault(),e.dataTransfer.dropEffect=t(e.dataTransfer.effectAllowed);const l={zoneKey:n.t.zone.key,line:n.t.line,axis:n.t.zone.axis};Y(e=>e&&e.zoneKey===l.zoneKey&&e.line.left===l.line.left&&e.line.top===l.line.top?e:l)},onDragLeave:e=>{const t=e.relatedTarget;t&&e.currentTarget.contains(t)||(U.current=null,Y(null))},onDrop:e=>{const t=J(e);t&&(e.preventDefault(),p.end(),H(),A.current.onDrop(t.h.item,t.t.to))}},te={draggable:!f&&!!Z,onMouseEnter:V,onMouseLeave:()=>!p.get()&&Q(),onDragStart:e=>{if(Z&&!f){p.start({key:Z.key,item:Z.item,from:Z.from}),e.dataTransfer.effectAllowed="move";try{e.dataTransfer.setData("text/plain",Z.key)}catch{}}else e.preventDefault()},onDragEnd:()=>{p.end(),H()},onClick:()=>{Z&&!f&&A.current.onPick?.(Z.item)}},{seams:ne=[]}=q,le=q.zones.filter(e=>0===e.children.length),re=d.onZoneAdd&&!f?le:[],ae=re.map(e=>e.key).join("\n");return g(()=>{const e=h?.document;if(!e)return;const t=new Set(ae?ae.split("\n"):[]);for(const n of e.querySelectorAll(`[${P}]`))n.toggleAttribute($,t.has(n.getAttribute(P)??""));return()=>{for(const t of e.querySelectorAll(`[${$}]`))t.removeAttribute($)}},[h,ae,B,z,E]),/* @__PURE__ */N("div",{ref:S,className:"es-canvas-layer",children:[F||!d.onSeamAdd||f?null:ne.map(e=>/* @__PURE__ */D("div",{className:"es-canvas-seam",style:{left:e.box.left,top:e.box.top+e.box.height/2-8,width:e.box.width,height:16},children:/* @__PURE__ */D("button",{type:"button",className:"es-canvas-seam-add",onClick:()=>d.onSeamAdd?.(e.place),children:k.addButton({label:d.seamLabel??k.addSection})})},e.key)),re.length?re.map(e=>/* @__PURE__ */D("button",{type:"button",className:G?.zoneKey===e.key?"es-canvas-empty is-over":"es-canvas-empty",style:R(e.box),onClick:()=>d.onZoneAdd?.({...e.list,index:0}),children:/* @__PURE__ */D("span",{className:"es-canvas-empty-add",children:k.addButton({label:d.zoneAddLabel??k.addBlock})})},e.key)):null,F?/* @__PURE__ */D("div",{className:"es-canvas-catch",...ee}):null,G&&!le.some(e=>e.key===G.zoneKey)?/* @__PURE__ */D("div",{className:`es-canvas-line is-${G.axis}`,style:R(G.line)}):null,
|
|
2
|
+
/* @__PURE__ */N("div",{className:["es-canvas-handle",Z&&!f?"is-shown":"",F?"is-dragging":""].filter(Boolean).join(" "),style:Z?{left:Z.box.left+2,top:Math.max(Z.box.top-11,0)}:void 0,title:Z?Z.title??k.handle({label:Z.label}):void 0,...te,children:[
|
|
3
|
+
/* @__PURE__ */D("span",{className:"es-canvas-grip","aria-hidden":"true",children:"⋮⋮"}),Z?.label]})]})}var F=e=>e.tiles.length>0&&e.tiles.every(e=>null!=e.cover);function Z({groups:t,session:n,itemFor:l,onInsert:r,at:a,hint:o,searchLabel:s,readOnly:i,words:c=e.add}){const d=o??c.hint,u=s??c.search,[f,m]=b(""),g=k(),y=f.trim().toLowerCase(),v=t.map(e=>({...e,tiles:y?e.tiles.filter(e=>((e,t)=>e.label.toLowerCase().includes(t)||(e.keywords??[]).some(e=>e.toLowerCase().includes(t)))(e,y)):e.tiles})).filter(e=>e.tiles.length>0),x=(e,t)=>r=>{if(t)r.preventDefault();else{n.start({key:`new:${e}`,item:l(e)}),r.dataTransfer.effectAllowed="copy";try{r.dataTransfer.setData("text/plain",e)}catch{}}};/* @__PURE__ */
|
|
4
|
+
return N("div",{className:"es-add",children:[a?/* @__PURE__ */N("div",{className:"es-add-at",role:"status",children:[
|
|
5
|
+
/* @__PURE__ */D("span",{children:a.label}),
|
|
6
|
+
/* @__PURE__ */D("button",{type:"button",className:"es-add-at-clear","aria-label":c.stop,title:c.stop,onClick:a.onClear,children:/* @__PURE__ */D(h,{size:12,"aria-hidden":"true"})})]}):null,
|
|
7
|
+
/* @__PURE__ */D("p",{className:"es-add-hint",children:d}),
|
|
8
|
+
/* @__PURE__ */N("div",{className:"es-add-search",children:[
|
|
9
|
+
/* @__PURE__ */D(p,{size:16,"aria-hidden":"true"}),
|
|
10
|
+
/* @__PURE__ */D("input",{id:g,type:"search","aria-label":u,placeholder:c.searchPlaceholder({label:u}),value:f,onChange:e=>m(e.target.value)}),f?/* @__PURE__ */D("button",{type:"button",className:"es-add-search-clear","aria-label":c.clearSearch,onClick:()=>m(""),children:/* @__PURE__ */D(h,{size:12,"aria-hidden":"true"})}):null]}),0===v.length?/* @__PURE__ */N("div",{className:"es-add-empty",role:"status",children:[
|
|
11
|
+
/* @__PURE__ */D("div",{className:"es-add-empty-title",children:c.nothing({query:f.trim()})}),
|
|
12
|
+
/* @__PURE__ */D("div",{className:"es-add-empty-sub",children:c.tryAnother})]}):v.map(e=>/* @__PURE__ */N("section",{className:"es-add-group","aria-label":e.title,children:[
|
|
13
|
+
/* @__PURE__ */N("div",{className:"es-add-group-head",children:[
|
|
14
|
+
/* @__PURE__ */D("span",{className:"es-add-group-title",children:e.title}),
|
|
15
|
+
/* @__PURE__ */D("span",{className:"es-add-group-count",children:e.tiles.length})]}),
|
|
16
|
+
/* @__PURE__ */D("div",{className:F(e)?"es-add-grid is-cards":"es-add-grid",children:e.tiles.map(e=>{const t=Boolean(i||e.disabled),l=i?void 0:e.disabled?e.disabledReason:e.title??c.tile({label:e.label});/* @__PURE__ */
|
|
17
|
+
return N("button",{type:"button",className:null!=e.cover?"es-add-tile has-cover":"es-add-tile",draggable:!t,"aria-disabled":t||void 0,"aria-label":c.tile({label:e.label}),title:l,onDragStart:x(e.type,t),onDragEnd:()=>n.end(),onClick:()=>!t&&r(e.type),children:[null!=e.cover?/* @__PURE__ */D("span",{className:"es-add-tile-cover","aria-hidden":"true",children:e.cover}):e.icon?/* @__PURE__ */D("span",{className:"es-add-tile-glyph","aria-hidden":"true",children:e.icon}):null,
|
|
18
|
+
/* @__PURE__ */D("span",{className:"es-add-tile-label",children:e.label})]},e.type)})})]},e.title))]})}export{Z as AddPanel,q as CanvasDragLayer,O as EMPTY_MEASURE,X as HANDLE_GRACE_MS,C as canvasTarget,A as contains,z as gapInZone,E as gapLine,M as measureCanvas,T as pickSource,L as seamsBetween};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* efficient-easel/
|
|
2
|
+
* efficient-easel/easel — the canvas's own marks (blueprint 5.1): the
|
|
3
3
|
* lists' empty and selected states, and the outlines over the selected and
|
|
4
4
|
* hovered block. Puck's `puck.css` drew these until now; the rules follow it.
|
|
5
5
|
*
|
|
@@ -9,6 +9,21 @@
|
|
|
9
9
|
* no `.es-editor` root to define them.
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
+
/* The frame itself, in the host page (CanvasFrame): no border, the pane's
|
|
13
|
+
width, and — when it fills (`height="fill"`) — the pane's height. Rules, not
|
|
14
|
+
a `style` attribute (second host, 2026-10-06): a server-rendered editor under a
|
|
15
|
+
Content-Security-Policy without 'unsafe-inline' for styles had the attribute
|
|
16
|
+
refused, and drew the browser's own 300×150 bordered frame. An `auto`
|
|
17
|
+
frame's height is measured and written on the client. */
|
|
18
|
+
.es-canvas-frame {
|
|
19
|
+
border: 0;
|
|
20
|
+
width: 100%;
|
|
21
|
+
display: block;
|
|
22
|
+
}
|
|
23
|
+
.es-canvas-frame.is-fill {
|
|
24
|
+
height: 100%;
|
|
25
|
+
}
|
|
26
|
+
|
|
12
27
|
/* The frame's root (CanvasFrame). Puck's `[data-puck-entry]` rule: a stacking
|
|
13
28
|
context of its own, so a block's z-index stays inside the page. */
|
|
14
29
|
[data-puck-entry] {
|