deck-plugin-sdk 0.15.1
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 +77 -0
- package/bin/deck-plugin.mjs +117 -0
- package/build-plugin.mjs +143 -0
- package/package.json +42 -0
- package/shim/bridge.d.ts +5 -0
- package/shim/bridge.js +196 -0
- package/shim/event.d.ts +5 -0
- package/shim/event.js +5 -0
- package/shim/jsx-runtime.js +20 -0
- package/shim/mcp.d.ts +68 -0
- package/shim/monaco.d.ts +5 -0
- package/shim/monaco.js +15 -0
- package/shim/react.js +50 -0
- package/shim/settings.d.ts +5 -0
- package/shim/settings.js +13 -0
- package/shim/terminals.d.ts +4 -0
- package/shim/terminals.js +70 -0
- package/shim/ui.d.ts +14 -0
- package/shim/ui.js +37 -0
- package/template/README.md +17 -0
- package/template/gitignore +4 -0
- package/template/package.json +10 -0
- package/template/plugin.json +8 -0
- package/template/src/plugin.tsx +65 -0
- package/template/tsconfig.json +13 -0
- package/types/components/ConfirmDialog.d.ts +22 -0
- package/types/components/ContextMenu.d.ts +41 -0
- package/types/components/MarkdownToolbar.d.ts +48 -0
- package/types/components/NamePrompt.d.ts +16 -0
- package/types/components/TabStrip.d.ts +26 -0
- package/types/components/Toast.d.ts +48 -0
- package/types/components/TreeRow.d.ts +41 -0
- package/types/components/dragrow.d.ts +34 -0
- package/types/components/menuplace.d.ts +30 -0
- package/types/components/ui.d.ts +102 -0
- package/types/components/useResize.d.ts +24 -0
- package/types/core/bridge.d.ts +670 -0
- package/types/core/editorsettings.d.ts +60 -0
- package/types/core/langmap.d.ts +15 -0
- package/types/core/monaco.d.ts +36 -0
- package/types/core/settingsstore.d.ts +19 -0
- package/types/core/shellpath.d.ts +45 -0
- package/types/core/terminals.d.ts +322 -0
- package/types/core/theme.d.ts +68 -0
- package/types/modules/editor/MarkdownLive.d.ts +61 -0
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
// GENERATED by sdk/gen-types.mjs from Deck's source — do not edit.
|
|
2
|
+
import type { ReactNode } from "react";
|
|
3
|
+
export interface TreeRowProps {
|
|
4
|
+
/** Nesting level; sets the indent, 14px per level as in the editor. */
|
|
5
|
+
depth: number;
|
|
6
|
+
/** Highlighted as the current selection. */
|
|
7
|
+
active?: boolean;
|
|
8
|
+
/** Highlighted as a drag-over drop target. */
|
|
9
|
+
dropHint?: boolean;
|
|
10
|
+
/** Shown before the label: a chevron for a container, a spacer for a leaf. */
|
|
11
|
+
leading?: ReactNode;
|
|
12
|
+
label: ReactNode;
|
|
13
|
+
/** Right-aligned extras — counts, status letters, dirty dots. Never a <button>: a nested
|
|
14
|
+
* control inside a draggable row swallows the press that would have started the drag. */
|
|
15
|
+
trailing?: ReactNode;
|
|
16
|
+
/** Colour applied to the label. */
|
|
17
|
+
tint?: string;
|
|
18
|
+
onClick?: () => void;
|
|
19
|
+
onDoubleClick?: () => void;
|
|
20
|
+
onContextMenu?: (e: React.MouseEvent) => void;
|
|
21
|
+
onKeyDown?: (e: React.KeyboardEvent) => void;
|
|
22
|
+
draggable?: boolean;
|
|
23
|
+
onDragStart?: (e: React.DragEvent) => void;
|
|
24
|
+
onDragEnd?: (e: React.DragEvent) => void;
|
|
25
|
+
onDragEnter?: (e: React.DragEvent) => void;
|
|
26
|
+
onDragOver?: (e: React.DragEvent) => void;
|
|
27
|
+
onDragLeave?: (e: React.DragEvent) => void;
|
|
28
|
+
onDrop?: (e: React.DragEvent) => void;
|
|
29
|
+
/** Extra inline styles, merged last — used for the insert-before line on a reorder target. */
|
|
30
|
+
style?: React.CSSProperties;
|
|
31
|
+
title?: string;
|
|
32
|
+
/** Id this row reports when dragged or dropped on. Also makes it a hit-test target. */
|
|
33
|
+
dragId?: string;
|
|
34
|
+
/** Container this row belongs to, for "insert before this row" moves. */
|
|
35
|
+
dragParentId?: string | null;
|
|
36
|
+
/** "folder" accepts a drop into it; anything else is an insertion point. */
|
|
37
|
+
dragKind?: string;
|
|
38
|
+
onMouseDown?: (e: React.MouseEvent) => void;
|
|
39
|
+
}
|
|
40
|
+
export declare function TreeRow({ depth, active, dropHint, leading, label, trailing, tint, onClick, onDoubleClick, onContextMenu, onKeyDown, draggable, onDragStart, onDragEnd, onDragEnter, onDragOver, onDragLeave, onDrop, style, title, dragId, dragParentId, dragKind, onMouseDown, }: TreeRowProps): import("react").JSX.Element;
|
|
41
|
+
export default TreeRow;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
// GENERATED by sdk/gen-types.mjs from Deck's source — do not edit.
|
|
2
|
+
/** Marks an element as a draggable/droppable row. Read back during a drag by hit-testing. */
|
|
3
|
+
export declare const ROW_ATTR = "data-drag-id";
|
|
4
|
+
/** Optional: the id of the container a row belongs to, for "insert before this row" moves. */
|
|
5
|
+
export declare const ROW_PARENT_ATTR = "data-drag-parent";
|
|
6
|
+
/** Optional: "folder" rows accept a drop into them; anything else is an insertion point. */
|
|
7
|
+
export declare const ROW_KIND_ATTR = "data-drag-kind";
|
|
8
|
+
export interface DropTarget {
|
|
9
|
+
id: string;
|
|
10
|
+
parentId: string | null;
|
|
11
|
+
kind: string | null;
|
|
12
|
+
}
|
|
13
|
+
/** The row under a point, or null. Exported for the check. */
|
|
14
|
+
export declare function rowAt(x: number, y: number): DropTarget | null;
|
|
15
|
+
export interface DragState {
|
|
16
|
+
/** Id of the row being dragged, or null when idle. */
|
|
17
|
+
dragId: string | null;
|
|
18
|
+
/** Row currently under the cursor, or null. */
|
|
19
|
+
over: DropTarget | null;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Start a drag from a row's onMouseDown.
|
|
23
|
+
*
|
|
24
|
+
* Returns the live drag state plus the handler to attach. Nothing happens until the pointer
|
|
25
|
+
* moves past the threshold, so a plain click still reaches onClick untouched.
|
|
26
|
+
*/
|
|
27
|
+
export declare function useRowDrag(onDrop: (dragId: string, target: DropTarget | null, x: number, y: number) => void): {
|
|
28
|
+
startDrag: (id: string) => (e: React.MouseEvent) => void;
|
|
29
|
+
justDragged: () => boolean;
|
|
30
|
+
/** Id of the row being dragged, or null when idle. */
|
|
31
|
+
dragId: string | null;
|
|
32
|
+
/** Row currently under the cursor, or null. */
|
|
33
|
+
over: DropTarget | null;
|
|
34
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
// GENERATED by sdk/gen-types.mjs from Deck's source — do not edit.
|
|
2
|
+
/** Where a menu of this size goes, given the cursor and the viewport. Pure, so it can be checked. */
|
|
3
|
+
export interface Placement {
|
|
4
|
+
left: number;
|
|
5
|
+
top: number;
|
|
6
|
+
maxHeight?: number;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Place a menu box of `width` x `height` raised at (x, y).
|
|
10
|
+
*
|
|
11
|
+
* `height` must be the menu's NATURAL height, measured with any previous clamp lifted. Passing an
|
|
12
|
+
* already-clamped height is what made a menu near the bottom of the window measure short, fail
|
|
13
|
+
* the flip test, and render downward off the edge.
|
|
14
|
+
*
|
|
15
|
+
* Flips rather than merely clamping: a menu raised from the footer should open UPWARD from the
|
|
16
|
+
* cursor, not be shoved up so the cursor lands in its middle. When it fits in neither direction
|
|
17
|
+
* it takes the roomier side and scrolls within it.
|
|
18
|
+
*/
|
|
19
|
+
export declare function place(x: number, y: number, width: number, height: number, vw: number, vh: number, alignRight?: boolean, PAD?: number,
|
|
20
|
+
/**
|
|
21
|
+
* Where the menu's RIGHT edge goes when it flips, for an anchor that has width.
|
|
22
|
+
*
|
|
23
|
+
* A submenu opens at its parent row's right edge, so flipping it around that same point puts
|
|
24
|
+
* it straight on top of the parent — the thing it is a submenu OF disappears behind it. It has
|
|
25
|
+
* to flip around the parent's LEFT edge instead, which is what this carries. Without it the
|
|
26
|
+
* flip is correct arithmetic and the wrong place.
|
|
27
|
+
*
|
|
28
|
+
* Left out by a menu raised at a cursor, which has no width and so flips around itself.
|
|
29
|
+
*/
|
|
30
|
+
flipAt?: number): Placement;
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
// GENERATED by sdk/gen-types.mjs from Deck's source — do not edit.
|
|
2
|
+
import { type ReactNode } from "react";
|
|
3
|
+
/**
|
|
4
|
+
* A labelled row: caption, control, optional hint.
|
|
5
|
+
*
|
|
6
|
+
* A div, NOT a label. A <label> forwards a click anywhere inside it to the first labelable
|
|
7
|
+
* control it contains, which is right for a single input and wrong for anything else — the
|
|
8
|
+
* plugin list put several buttons in one Field, and clicking a plugin's toggle fired the remove
|
|
9
|
+
* button two rows up because that button came first in the DOM.
|
|
10
|
+
*
|
|
11
|
+
* Callers wrapping exactly one input and wanting click-to-focus can use a <label> themselves;
|
|
12
|
+
* most of these wrap a control that is already its own click target.
|
|
13
|
+
*/
|
|
14
|
+
export declare function Field({ label, hint, children }: {
|
|
15
|
+
label: string;
|
|
16
|
+
hint?: string;
|
|
17
|
+
children: ReactNode;
|
|
18
|
+
}): import("react").JSX.Element;
|
|
19
|
+
export declare function TextInput(props: React.InputHTMLAttributes<HTMLInputElement>): import("react").JSX.Element;
|
|
20
|
+
/** Native OS time picker, styled dark. value/onChange are "HH:mm" strings. */
|
|
21
|
+
export declare function TimeInput({ value, onChange, className, }: {
|
|
22
|
+
value: string;
|
|
23
|
+
onChange: (v: string) => void;
|
|
24
|
+
className?: string;
|
|
25
|
+
}): import("react").JSX.Element;
|
|
26
|
+
export declare function Select(props: React.SelectHTMLAttributes<HTMLSelectElement>): import("react").JSX.Element;
|
|
27
|
+
export declare function PrimaryButton({ children, ...p }: React.ButtonHTMLAttributes<HTMLButtonElement>): import("react").JSX.Element;
|
|
28
|
+
export declare function GhostButton({ children, ...p }: React.ButtonHTMLAttributes<HTMLButtonElement>): import("react").JSX.Element;
|
|
29
|
+
/**
|
|
30
|
+
* A segmented control.
|
|
31
|
+
*
|
|
32
|
+
* `layoutId` names the sliding pill. Framer Motion matches that id across the WHOLE tree, so two
|
|
33
|
+
* segmented controls sharing one animate the pill between them — pass a distinct id wherever a
|
|
34
|
+
* screen draws more than one (a per-row control, say). The default keeps the single-control case
|
|
35
|
+
* a one-liner.
|
|
36
|
+
*/
|
|
37
|
+
export declare function Segmented<T extends string>({ value, onChange, options, layoutId, }: {
|
|
38
|
+
value: T;
|
|
39
|
+
onChange: (v: T) => void;
|
|
40
|
+
options: {
|
|
41
|
+
value: T;
|
|
42
|
+
label: string;
|
|
43
|
+
}[];
|
|
44
|
+
layoutId?: string;
|
|
45
|
+
}): import("react").JSX.Element;
|
|
46
|
+
/** Underlined tabs. `layoutId` behaves as in Segmented above. */
|
|
47
|
+
export declare function Tabs<T extends string>({ value, onChange, options, layoutId, }: {
|
|
48
|
+
value: T;
|
|
49
|
+
onChange: (v: T) => void;
|
|
50
|
+
options: {
|
|
51
|
+
value: T;
|
|
52
|
+
label: string;
|
|
53
|
+
}[];
|
|
54
|
+
layoutId?: string;
|
|
55
|
+
}): import("react").JSX.Element;
|
|
56
|
+
export declare function DayPicker({ value, onChange, }: {
|
|
57
|
+
value: string[];
|
|
58
|
+
onChange: (days: string[]) => void;
|
|
59
|
+
}): import("react").JSX.Element;
|
|
60
|
+
/** One readout in the footer strip: an icon, a short label, and an optional click. */
|
|
61
|
+
export declare function StatusItem({ icon, color, label, title, onClick, }: {
|
|
62
|
+
icon: React.ReactNode;
|
|
63
|
+
color: string;
|
|
64
|
+
label: string;
|
|
65
|
+
title?: string;
|
|
66
|
+
onClick?: () => void;
|
|
67
|
+
}): import("react").JSX.Element;
|
|
68
|
+
/**
|
|
69
|
+
* A footer readout that opens a details panel above the strip.
|
|
70
|
+
*
|
|
71
|
+
* Each one owns its own anchor and outside-click handling, so adding a readout is a matter of
|
|
72
|
+
* writing its panel — not another ref threaded into a shared listener. `open`/`onToggle` stay
|
|
73
|
+
* lifted by the caller so only one panel can be open at a time; a plugin that holds its own
|
|
74
|
+
* boolean simply gets a panel that does not close Deck's others, which is usually fine.
|
|
75
|
+
*/
|
|
76
|
+
export declare function StatusPopover({ open, onToggle, onClose, item, children, width }: {
|
|
77
|
+
open: boolean;
|
|
78
|
+
onToggle: () => void;
|
|
79
|
+
onClose: () => void;
|
|
80
|
+
/** The clickable readout itself. */
|
|
81
|
+
item: React.ReactNode;
|
|
82
|
+
/** Panel contents, rendered only while open. */
|
|
83
|
+
children: React.ReactNode;
|
|
84
|
+
/** Tailwind width class, when the default 16rem is too narrow for the panel's columns. */
|
|
85
|
+
width?: string;
|
|
86
|
+
}): import("react").JSX.Element;
|
|
87
|
+
/** Panel heading: what it is, and the one number that matters. */
|
|
88
|
+
export declare function PanelHead({ label, value }: {
|
|
89
|
+
label: string;
|
|
90
|
+
value?: string;
|
|
91
|
+
}): import("react").JSX.Element;
|
|
92
|
+
/** A labelled switch row: title, description, toggle. */
|
|
93
|
+
export declare function Row({ title, desc, on, onChange }: {
|
|
94
|
+
title: string;
|
|
95
|
+
desc: string;
|
|
96
|
+
on: boolean;
|
|
97
|
+
onChange: (v: boolean) => void;
|
|
98
|
+
}): import("react").JSX.Element;
|
|
99
|
+
export declare function Toggle({ on, onChange }: {
|
|
100
|
+
on: boolean;
|
|
101
|
+
onChange: (v: boolean) => void;
|
|
102
|
+
}): import("react").JSX.Element;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
// GENERATED by sdk/gen-types.mjs from Deck's source — do not edit.
|
|
2
|
+
/**
|
|
3
|
+
* A draggable split. Returns the size in px, the props for the divider, and whether a drag is
|
|
4
|
+
* in progress — the last so an animated pane can turn its transition off while dragging, or the
|
|
5
|
+
* spring re-targets on every mousemove and the pane lags the cursor.
|
|
6
|
+
*
|
|
7
|
+
* Listeners go on `window`, not the divider, so a fast drag that outruns the pointer keeps
|
|
8
|
+
* resizing instead of stopping the moment the cursor leaves the 4px handle.
|
|
9
|
+
*/
|
|
10
|
+
export declare function useResize({ initial, min, max, direction, invert, }: {
|
|
11
|
+
initial: number;
|
|
12
|
+
min: number;
|
|
13
|
+
max: number;
|
|
14
|
+
direction: "horizontal" | "vertical";
|
|
15
|
+
/**
|
|
16
|
+
* Set when the resized pane sits AFTER the handle (below it, or to its right).
|
|
17
|
+
*
|
|
18
|
+
* Without this the drag runs backwards: dragging the handle down increases clientY, which
|
|
19
|
+
* would grow a pane that is actually being squeezed from above.
|
|
20
|
+
*/
|
|
21
|
+
invert?: boolean;
|
|
22
|
+
}): readonly [number, {
|
|
23
|
+
readonly onMouseDown: (e: React.MouseEvent) => void;
|
|
24
|
+
}, boolean];
|