@kitlangton/knobs 0.4.0-next.10 → 0.4.0-next.12
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 +115 -13
- package/dist/dev/{chunk-3ygqgy1x.js → chunk-7kns3qe6.js} +43 -26
- package/dist/dev/{chunk-5pb7ymrd.js → chunk-9qtvxa6k.js} +1465 -1104
- package/dist/dev/{chunk-a7cjgy8x.js → chunk-ab7vfghg.js} +2 -5
- package/dist/dev/{chunk-dyq4m24m.js → chunk-nwfm1bfj.js} +92 -37
- package/dist/dev/index.js +71 -25
- package/dist/index.js +107 -23
- package/dist/panel.js +3091 -2528
- package/dist/review-react.js +8 -4
- package/dist/review-solid.js +10 -5
- package/dist/review.js +8 -4
- package/dist/types/core/remote.d.ts +10 -2
- package/dist/types/core/schema.d.ts +65 -5
- package/dist/types/core/store.d.ts +15 -0
- package/dist/types/index.d.ts +1 -1
- package/dist/types/panel/dock.d.ts +9 -0
- package/dist/types/panel/gpu/renderer.d.ts +13 -1
- package/dist/types/panel/inspector.d.ts +11 -3
- package/dist/types/panel/presets.d.ts +21 -1
- package/dist/types/panel/scope.d.ts +15 -4
- package/dist/types/ui/canvas-css.d.ts +1 -0
- package/dist/types/ui/canvas-model.d.ts +116 -0
- package/dist/types/ui/canvas.d.ts +66 -0
- package/dist/types/ui/index.d.ts +2 -0
- package/dist/types/ui/react.d.ts +12 -0
- package/dist/types/ui/solid.d.ts +9 -0
- package/dist/ui-react.js +1020 -17
- package/dist/ui-solid.js +1032 -25
- package/dist/ui.js +986 -4
- package/package.json +1 -1
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { type CanvasPoint, type CanvasRect, type CanvasView } from "./canvas-model.js";
|
|
2
|
+
import { type UiLook } from "./look.js";
|
|
3
|
+
export interface CanvasItem {
|
|
4
|
+
readonly id: string;
|
|
5
|
+
/** Where it sits on the canvas (world px). Without both, it packs into the grid. */
|
|
6
|
+
readonly x?: number;
|
|
7
|
+
readonly y?: number;
|
|
8
|
+
/** The card's size (px). Without them, the card takes its content's size. */
|
|
9
|
+
readonly w?: number;
|
|
10
|
+
readonly h?: number;
|
|
11
|
+
/** Shown above the card. */
|
|
12
|
+
readonly title?: string;
|
|
13
|
+
/** Draws the item into its card; return a cleanup for when it goes. */
|
|
14
|
+
readonly render: (el: HTMLElement) => void | (() => void);
|
|
15
|
+
}
|
|
16
|
+
export interface CanvasOptions extends UiLook {
|
|
17
|
+
readonly items: readonly CanvasItem[];
|
|
18
|
+
/** Between packed items, world px (48). */
|
|
19
|
+
readonly gap?: number;
|
|
20
|
+
/** Around what `fit` and `focus` show, px on screen (48). */
|
|
21
|
+
readonly padding?: number;
|
|
22
|
+
/** How wide packed rows run, world px (as wide as makes the set about the canvas's shape). */
|
|
23
|
+
readonly width?: number;
|
|
24
|
+
/** The zoom's range (.05 … 8). */
|
|
25
|
+
readonly minZoom?: number;
|
|
26
|
+
readonly maxZoom?: number;
|
|
27
|
+
/** The zoom readout, with fit and 100% (true). */
|
|
28
|
+
readonly readout?: boolean;
|
|
29
|
+
/** The view moved: a gesture, a key, a fit or a focus. */
|
|
30
|
+
readonly onView?: (view: CanvasView) => void;
|
|
31
|
+
/** The canvas's accessible name. */
|
|
32
|
+
readonly label?: string;
|
|
33
|
+
}
|
|
34
|
+
export interface Canvas {
|
|
35
|
+
readonly element: HTMLElement;
|
|
36
|
+
readonly view: CanvasView;
|
|
37
|
+
/** Each item's place (world px, its title included). */
|
|
38
|
+
readonly rects: ReadonlyMap<string, CanvasRect>;
|
|
39
|
+
/** Shows every item. */
|
|
40
|
+
fit(): void;
|
|
41
|
+
/** Brings an item to the middle and zooms to fit it (at most 200%). */
|
|
42
|
+
focus(id: string): void;
|
|
43
|
+
/** Zooms to `scale` around a point on the canvas (its middle by default). */
|
|
44
|
+
zoomTo(scale: number, at?: CanvasPoint): void;
|
|
45
|
+
/** New items: those that stay keep their content and glide to new places; new ones fade in, gone ones out. */
|
|
46
|
+
update(items: readonly CanvasItem[]): void;
|
|
47
|
+
/** Whether anything is moving (the frame loop runs only then). */
|
|
48
|
+
readonly moving: boolean;
|
|
49
|
+
/** Frames stepped, and the script time each took (ms), for perf checks. */
|
|
50
|
+
stats(): {
|
|
51
|
+
frames: number;
|
|
52
|
+
p50: number;
|
|
53
|
+
p95: number;
|
|
54
|
+
max: number;
|
|
55
|
+
};
|
|
56
|
+
dispose(): void;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* An infinite canvas: items as cards on a dotted page that pans and zooms freely. Drag the page
|
|
60
|
+
* (or hold Space, or the middle button, and drag anywhere) or scroll with two fingers to pan;
|
|
61
|
+
* pinch or ⌘/ctrl-scroll to zoom around the pointer. Both follow the hand 1:1 and coast on
|
|
62
|
+
* release. 0 fits everything, 1 is 100%, = and - zoom, and a double-click focuses an item (again,
|
|
63
|
+
* or on the page, fits). Items stay live: clicks and keys reach them. Items without a place pack
|
|
64
|
+
* into rows sized to their content. Nothing moves on load: the first fit is instant.
|
|
65
|
+
*/
|
|
66
|
+
export declare function canvas(container: HTMLElement, options: CanvasOptions): Canvas;
|
package/dist/types/ui/index.d.ts
CHANGED
|
@@ -27,6 +27,8 @@ export { codeDiff, diffCounts, diffReview, diffStatus, type CodeDiff, type CodeD
|
|
|
27
27
|
export { compareText, comparePaths, countChanges, diffBar, diffFiles, diffFolders, diffStats, diffTree, fileKey, filesUnder, keepFile, matchPath, parsePatch, splitPath, stepFile, type DiffChange, type DiffFile, type DiffInput, type DiffRows, type DiffSource, type DiffTreeItem, } from "./diff-model.js";
|
|
28
28
|
export { bento, type Bento, type BentoItem, type BentoOptions } from "./bento.js";
|
|
29
29
|
export { fitRect, FIT_MAX, motionBlur, neighbour as bentoNeighbour, planBento, rowTarget, windowOf as bentoWindow, type BentoDirection, type BentoLayout, type BentoMode, type BentoPlan, type BentoRect, } from "./bento-model.js";
|
|
30
|
+
export { canvas, type Canvas, type CanvasItem, type CanvasOptions } from "./canvas.js";
|
|
31
|
+
export { boundsOf as canvasBounds, dotGrid, fitView, layoutCanvas, packRows, viewPath, zoomAround, type CanvasPoint, type CanvasRect, type CanvasView, } from "./canvas-model.js";
|
|
30
32
|
export { activity, type Activity, type ActivityOptions, } from "./activity.js";
|
|
31
33
|
export { diffActivity, flattenActivity, formatDuration, indexActivity, keepSelection as keepActivitySelection, navigateActivity, railSegments, showsSelection, stackRows, type ActivityEvent, type ActivityInput, type ActivityKey, type ActivityKind, type ActivityRow, type RailNode, } from "./activity-model.js";
|
|
32
34
|
export { optionPicker, type OptionPicker, type OptionPickerOptions, type PickerOption, } from "./picker.js";
|
package/dist/types/ui/react.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { type CSSProperties, type ReactNode } from "react";
|
|
2
2
|
import { type Activity as ActivityHandle, type ActivityOptions } from "./activity.js";
|
|
3
3
|
import { type Bento as BentoHandle, type BentoOptions } from "./bento.js";
|
|
4
|
+
import { type Canvas as CanvasHandle, type CanvasOptions } from "./canvas.js";
|
|
4
5
|
import { type CodeDiff as CodeDiffHandle, type CodeDiffOptions, type DiffReview as DiffReviewHandle, type DiffReviewOptions } from "./diff.js";
|
|
5
6
|
import { type OptionPicker as OptionPickerHandle, type OptionPickerOptions, type PickerOption } from "./picker.js";
|
|
6
7
|
import { type Split as SplitHandle, type SplitOptions } from "./split.js";
|
|
@@ -86,6 +87,17 @@ export type BentoProps = BentoOptions & {
|
|
|
86
87
|
* prop; callbacks always call the latest props.
|
|
87
88
|
*/
|
|
88
89
|
export declare function Bento(props: BentoProps): import("react").JSX.Element;
|
|
90
|
+
export type CanvasProps = CanvasOptions & {
|
|
91
|
+
className?: string;
|
|
92
|
+
style?: CSSProperties;
|
|
93
|
+
onReady?: (canvas: CanvasHandle) => void;
|
|
94
|
+
};
|
|
95
|
+
/**
|
|
96
|
+
* `canvas()` as a component. New `items` update it in place (items that stay keep their content
|
|
97
|
+
* and glide); `onView` always calls the latest prop. Keep `items` (and their `render`s) stable
|
|
98
|
+
* across renders, or each render redraws the cards.
|
|
99
|
+
*/
|
|
100
|
+
export declare function Canvas(props: CanvasProps): import("react").JSX.Element;
|
|
89
101
|
export type ActivityProps = ActivityOptions & {
|
|
90
102
|
className?: string;
|
|
91
103
|
style?: CSSProperties;
|
package/dist/types/ui/solid.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { type JSX } from "solid-js";
|
|
2
2
|
import { type Activity as ActivityHandle, type ActivityOptions } from "./activity.js";
|
|
3
3
|
import { type Bento as BentoHandle, type BentoOptions } from "./bento.js";
|
|
4
|
+
import { type Canvas as CanvasHandle, type CanvasOptions } from "./canvas.js";
|
|
4
5
|
import { type CodeDiff as CodeDiffHandle, type CodeDiffOptions, type DiffReview as DiffReviewHandle, type DiffReviewOptions } from "./diff.js";
|
|
5
6
|
import { type OptionPicker as OptionPickerHandle, type OptionPickerOptions, type PickerOption } from "./picker.js";
|
|
6
7
|
import { type Split as SplitHandle, type SplitOptions } from "./split.js";
|
|
@@ -73,6 +74,14 @@ export type BentoProps = BentoOptions & {
|
|
|
73
74
|
* prop; callbacks always call the latest props.
|
|
74
75
|
*/
|
|
75
76
|
export declare function Bento(props: BentoProps): JSX.Element;
|
|
77
|
+
export type CanvasProps = CanvasOptions & {
|
|
78
|
+
onReady?: (canvas: CanvasHandle) => void;
|
|
79
|
+
};
|
|
80
|
+
/**
|
|
81
|
+
* `canvas()` as a component. New `items` update it in place (items that stay keep their content
|
|
82
|
+
* and glide); `onView` always calls the latest prop.
|
|
83
|
+
*/
|
|
84
|
+
export declare function Canvas(props: CanvasProps): JSX.Element;
|
|
76
85
|
export type ActivityProps = ActivityOptions & {
|
|
77
86
|
onReady?: (activity: ActivityHandle) => void;
|
|
78
87
|
};
|