UNPKG

@mitcsutt/kiln-dnd

Version:

Kiln drag and drop: sortable lists, boards, drop zones and grid layouts with one keyboard model and one announcer, rendered through kiln-ui

27 lines (26 loc) • 1.79 kB
//#region src/core/messages.ts var e = ({ index: e, count: t, list: n }) => `position ${String(e + 1)} of ${String(t)}${n ? ` in ${n}` : ""}`, t = (e, t, n) => `${String(e)} ${e === 1 ? t : n}`, n = ({ x: e, y: t }) => `row ${String(t + 1)}, column ${String(e + 1)}`, r = ({ w: e, h: n }) => `${t(e, "column", "columns")} wide and ${t(n, "row", "rows")} tall`, i = { instructions: "To pick up, press Space or Enter. Then use the arrow keys to move, Space or Enter to drop, and Escape to cancel.", gridInstructions: "To pick up, press Space or Enter. Then use the arrow keys to move, Shift and the arrow keys to resize, Space or Enter to drop, and Escape to cancel.", handle: (e) => `Move ${e}`, listLifted: (t) => `Picked up ${t.item}, ${e(t)}.`, listMoved: (t) => `${t.item} moved to ${e(t)}.`, listDropped: (t) => `Dropped ${t.item} at ${e(t)}.`, listCanceled: (t) => `Move cancelled. ${t.item} is back at ${e(t)}.`, zoneLifted: (e) => `Picked up ${e.item}.`, zoneMoved: (e) => e.zone ? `${e.item} is over ${e.zone}.` : `${e.item} is not over a drop zone.`, zoneDropped: (e) => e.zone ? `Dropped ${e.item} on ${e.zone}.` : `${e.item} was not over a drop zone, so nothing moved.`, zoneCanceled: (e) => `Move cancelled. ${e.item} is back where it started.`, gridLifted: (e) => `Picked up ${e.item}, ${n(e)}, ${r(e)}.`, gridMoved: (e) => `${e.item} moved to ${n(e)}.`, gridResized: (e) => `${e.item} is now ${r(e)}.`, gridDropped: (e) => `Dropped ${e.item} at ${n(e)}, ${r(e)}.`, gridCanceled: (e) => `Move cancelled. ${e.item} is back at ${n(e)}, ${r(e)}.`, gridLocked: (e) => `${e} can be moved when the grid is wider.` }, a = (e) => e ? { ...i, ...e } : i; //#endregion export { i as defaultAnnouncements, a as resolveAnnouncements }; //# sourceMappingURL=messages.js.map