@objectifthunes/whiteboard 0.3.0 → 0.4.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 +13 -1
- package/dist/index.d.ts +95 -0
- package/dist/index.js +840 -697
- package/dist/whiteboard.css +291 -0
- package/package.json +7 -6
- package/LICENSE +0 -21
package/README.md
CHANGED
|
@@ -63,11 +63,23 @@ Every component is driven by `--wb-*` CSS custom properties. Override on `:root`
|
|
|
63
63
|
|
|
64
64
|
- **Canvas:** `WhiteboardShell`, `FloatingPanel`, `Minimap`, `ZoomBar`, `ConfirmDialog`, `PanelErrorBoundary`
|
|
65
65
|
- **Store / hooks:** `useWhiteboardStore`, `useWhiteboardLayout`, `computeWhiteboardFit`, `computeWhiteboardRectFocus`, `usePanelRect`, `belowPanel`, `snapToWhiteboardGrid`, `WHITEBOARD_GRID`, `cn`
|
|
66
|
-
- **Primitives:** `Button`, `ButtonRow`, `PanelCloseButton`, `ThemeToggle`, `OverlayIconButton`, `Field`, `Label`, `Input`, `Textarea`, `Select`, `CoordGrid`, `CoordInput`, `Alert`, `Pill`, `Chip`, `TagRow`, `LoadingState`, `GeneratingOverlay`, `EmptyState`, `Stack`, `Inline`, `TitleRow`, `SplitLayout`, `IconText`, `PageShell`, `PageCard`, `PageTitle`, `CardTitle`, `SectionTitle`, `SectionDescription`, `MutedText`, `ItemCard`, `ItemList`, `List`, `PickerCard`, `PickerGrid`, `ChoiceCard`, `ChoiceGroup`, `VerticalToolbar`, `AvatarBadge`, `CanvasStage`, `ImageThumb`, `PanelSection`, `PanelTitle`
|
|
66
|
+
- **Primitives:** `Button`, `ButtonRow`, `PanelCloseButton`, `ThemeToggle`, `OverlayIconButton`, `Field`, `Label`, `Input`, `Textarea`, `Select`, `CoordGrid`, `CoordInput`, `Alert`, `Pill`, `Chip`, `TagRow`, `LoadingState`, `GeneratingOverlay`, `EmptyState`, `Stack`, `Inline`, `TitleRow`, `SplitLayout`, `IconText`, `PageShell`, `PageCard`, `PageTitle`, `CardTitle`, `SectionTitle`, `SectionDescription`, `MutedText`, `ItemCard`, `ItemList`, `List`, `PickerCard`, `PickerGrid`, `ChoiceCard`, `ChoiceGroup`, `VerticalToolbar`, `AvatarBadge`, `CanvasStage`, `ImageThumb`, `PanelSection`, `PanelTitle`, `Checkbox`, `Switch`, `Slider`, `NumberField`, `Toolbar`, `Surface`, `Tooltip`, `Kbd`, `Divider`
|
|
67
67
|
- **Skeletons:** `Skeleton`, `LineSkeleton`, `TitleSkeleton`, `ButtonSkeleton`, `IconButtonSkeleton`, `InputSkeleton`, `SelectSkeleton`, `TextareaSkeleton`, `ChipSkeleton`, `ThumbSkeleton`, `AvatarSkeleton`, `CanvasSkeleton`, `PanelFormSkeleton`, `CardSkeleton`, `PickerGridSkeleton`, `ChoiceGroupSkeleton`
|
|
68
68
|
|
|
69
69
|
See the live demo for the full prop reference and copy-pasteable examples per component.
|
|
70
70
|
|
|
71
|
+
## New in 0.4
|
|
72
|
+
|
|
73
|
+
Battle-tested additions from building a real app on the kit:
|
|
74
|
+
|
|
75
|
+
- **`Checkbox` / `Switch`** — labeled boolean rows; the input pins its own size so host globals can never stretch it.
|
|
76
|
+
- **`Slider`** — label left, live readout right, themed range underneath. Returns numbers.
|
|
77
|
+
- **`NumberField`** — labeled numeric input; clamps to min/max, never emits NaN.
|
|
78
|
+
- **`Toolbar`** — horizontal sibling of `VerticalToolbar` for app-chrome bars (`position="top" | "bottom" | "static"`, `end` slot).
|
|
79
|
+
- **`Surface`** — the plain floating overlay container (selection menus, legends, log panes) for overlays living outside a `WhiteboardShell`.
|
|
80
|
+
- **`Tooltip`** — CSS-only, shows on hover and keyboard focus. `Kbd` for shortcut hints, `Divider` (h/v) for separation.
|
|
81
|
+
- **Hardening** — `PickerCard` declares its own column layout (the global `button` style can no longer collapse it into a clipped row); native text/number inputs are now styled like `select` out of the box.
|
|
82
|
+
|
|
71
83
|
## Build size
|
|
72
84
|
|
|
73
85
|
42 KB JS raw / ~10 KB gzip, single 30 KB CSS file. No runtime CSS-in-JS.
|
package/dist/index.d.ts
CHANGED
|
@@ -92,6 +92,20 @@ declare interface CardTitleProps extends TypographyProps {
|
|
|
92
92
|
clamp?: boolean;
|
|
93
93
|
}
|
|
94
94
|
|
|
95
|
+
/**
|
|
96
|
+
* A labeled checkbox row. The input pins its own size and flex so host
|
|
97
|
+
* (or kit) globals like `input { flex: 1 }` can never stretch it across
|
|
98
|
+
* the row.
|
|
99
|
+
*/
|
|
100
|
+
export declare function Checkbox({ label, hint, className, ...props }: CheckboxProps): JSX_2.Element;
|
|
101
|
+
|
|
102
|
+
declare interface CheckboxProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'type'> {
|
|
103
|
+
/** Sentence-case text rendered next to the box. */
|
|
104
|
+
label?: ReactNode;
|
|
105
|
+
/** Muted addition after the label, e.g. "(dirty scans)". */
|
|
106
|
+
hint?: ReactNode;
|
|
107
|
+
}
|
|
108
|
+
|
|
95
109
|
export declare function Chip({ className, ...props }: ChipProps): JSX_2.Element;
|
|
96
110
|
|
|
97
111
|
declare type ChipProps = HTMLAttributes<HTMLSpanElement>;
|
|
@@ -173,6 +187,13 @@ declare interface CoordInputProps extends Omit<InputHTMLAttributes<HTMLInputElem
|
|
|
173
187
|
axis: string;
|
|
174
188
|
}
|
|
175
189
|
|
|
190
|
+
/** Hairline separator; vertical inside toolbars/inlines, horizontal in stacks. */
|
|
191
|
+
export declare function Divider({ orientation, className, ...props }: DividerProps): JSX_2.Element;
|
|
192
|
+
|
|
193
|
+
declare interface DividerProps extends HTMLAttributes<HTMLElement> {
|
|
194
|
+
orientation?: 'horizontal' | 'vertical';
|
|
195
|
+
}
|
|
196
|
+
|
|
176
197
|
export declare function EmptyState({ title, description, action }: EmptyStateProps): JSX_2.Element;
|
|
177
198
|
|
|
178
199
|
declare interface EmptyStateProps {
|
|
@@ -265,6 +286,9 @@ declare interface ItemListProps extends HTMLAttributes<HTMLElement> {
|
|
|
265
286
|
as?: ElementType;
|
|
266
287
|
}
|
|
267
288
|
|
|
289
|
+
/** Keyboard-key chip for shortcut hints: <Kbd>esc</Kbd> <Kbd>⌫</Kbd>. */
|
|
290
|
+
export declare function Kbd({ className, ...props }: HTMLAttributes<HTMLElement>): JSX_2.Element;
|
|
291
|
+
|
|
268
292
|
export declare function Label({ className, ...props }: LabelProps): JSX_2.Element;
|
|
269
293
|
|
|
270
294
|
declare type LabelProps = LabelHTMLAttributes<HTMLLabelElement>;
|
|
@@ -297,6 +321,20 @@ export declare function MutedText({ as, size, className, ...props }: TypographyP
|
|
|
297
321
|
|
|
298
322
|
declare type MutedTextSize = 'xs' | 'sm' | 'md';
|
|
299
323
|
|
|
324
|
+
/**
|
|
325
|
+
* Labeled numeric input. Values come back as numbers, clamped to
|
|
326
|
+
* [min, max] when provided; non-numeric keystrokes are ignored rather
|
|
327
|
+
* than emitted as NaN.
|
|
328
|
+
*/
|
|
329
|
+
export declare function NumberField({ label, hint, value, onChange, min, max, step, id, className, ...props }: NumberFieldProps): JSX_2.Element;
|
|
330
|
+
|
|
331
|
+
declare interface NumberFieldProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'value' | 'onChange' | 'type'> {
|
|
332
|
+
label?: ReactNode;
|
|
333
|
+
hint?: ReactNode;
|
|
334
|
+
value: number;
|
|
335
|
+
onChange: (value: number) => void;
|
|
336
|
+
}
|
|
337
|
+
|
|
300
338
|
export declare function OverlayIconButton({ className, placement, onPointerDown, onWheel, onContextMenu, ...props }: OverlayIconButtonProps): JSX_2.Element;
|
|
301
339
|
|
|
302
340
|
declare interface OverlayIconButtonProps extends Omit<ComponentProps<typeof Button>, 'variant' | 'iconOnly'> {
|
|
@@ -476,6 +514,21 @@ declare interface SkeletonProps extends HTMLAttributes<HTMLElement> {
|
|
|
476
514
|
|
|
477
515
|
declare type SkeletonRadius = 'sm' | 'md' | 'pill';
|
|
478
516
|
|
|
517
|
+
/**
|
|
518
|
+
* The settings-panel slider pattern: label left, live readout right,
|
|
519
|
+
* range underneath. Numbers come back as numbers.
|
|
520
|
+
*/
|
|
521
|
+
export declare function Slider({ label, display, value, onChange, className, ...props }: SliderProps): JSX_2.Element;
|
|
522
|
+
|
|
523
|
+
declare interface SliderProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'type' | 'value' | 'onChange'> {
|
|
524
|
+
/** Uppercase header on the left (rendered like a widget label). */
|
|
525
|
+
label?: ReactNode;
|
|
526
|
+
/** Right-aligned readout; defaults to the raw value. */
|
|
527
|
+
display?: ReactNode;
|
|
528
|
+
value: number;
|
|
529
|
+
onChange: (value: number) => void;
|
|
530
|
+
}
|
|
531
|
+
|
|
479
532
|
export declare function snapToWhiteboardGrid(value: number): number;
|
|
480
533
|
|
|
481
534
|
/**
|
|
@@ -506,6 +559,22 @@ declare interface State {
|
|
|
506
559
|
error: Error | null;
|
|
507
560
|
}
|
|
508
561
|
|
|
562
|
+
/**
|
|
563
|
+
* The plain floating surface: --wb-surface background, border, radius,
|
|
564
|
+
* soft shadow. For overlays that live OUTSIDE a WhiteboardShell —
|
|
565
|
+
* selection menus, legends, log panes — where FloatingPanel's canvas
|
|
566
|
+
* coupling would be wrong.
|
|
567
|
+
*/
|
|
568
|
+
export declare function Surface({ as, padding, className, ...props }: SurfaceProps): ReactElement<any, string | JSXElementConstructor<any>>;
|
|
569
|
+
|
|
570
|
+
declare interface SurfaceProps extends HTMLAttributes<HTMLElement> {
|
|
571
|
+
as?: ElementType;
|
|
572
|
+
padding?: 'none' | 'sm' | 'md';
|
|
573
|
+
}
|
|
574
|
+
|
|
575
|
+
/** A labeled on/off switch — same API as Checkbox, slider visuals. */
|
|
576
|
+
export declare function Switch({ label, hint, className, ...props }: CheckboxProps): JSX_2.Element;
|
|
577
|
+
|
|
509
578
|
/**
|
|
510
579
|
* A horizontal wrapping row for chips/tags/pills/small items.
|
|
511
580
|
* Replaces `<div className="element-tags-row">`, `<div className="chip-row">`,
|
|
@@ -547,6 +616,32 @@ declare interface TitleRowProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
547
616
|
|
|
548
617
|
export declare function TitleSkeleton(props: HTMLAttributes<HTMLDivElement>): JSX_2.Element;
|
|
549
618
|
|
|
619
|
+
/**
|
|
620
|
+
* Horizontal sibling of VerticalToolbar — same surface, same rhythm.
|
|
621
|
+
* The app-chrome bar: title, file chip, navigation, primary action.
|
|
622
|
+
*/
|
|
623
|
+
export declare function Toolbar({ children, end, position, className, ...props }: ToolbarProps): JSX_2.Element;
|
|
624
|
+
|
|
625
|
+
declare interface ToolbarProps extends HTMLAttributes<HTMLElement> {
|
|
626
|
+
/** 'top' (fixed, centered) · 'bottom' · 'static' (position it yourself). */
|
|
627
|
+
position?: 'top' | 'bottom' | 'static';
|
|
628
|
+
/** Actions pinned to the end of the bar after a divider gap. */
|
|
629
|
+
end?: ReactNode;
|
|
630
|
+
}
|
|
631
|
+
|
|
632
|
+
/**
|
|
633
|
+
* CSS-only tooltip: shows on hover and on keyboard focus, no JS, no
|
|
634
|
+
* portal. Wraps its child inline.
|
|
635
|
+
*/
|
|
636
|
+
export declare function Tooltip({ label, placement, className, children, ...props }: TooltipProps): JSX_2.Element;
|
|
637
|
+
|
|
638
|
+
declare interface TooltipProps extends HTMLAttributes<HTMLSpanElement> {
|
|
639
|
+
/** Bubble content. Keep it to a few words. */
|
|
640
|
+
label: ReactNode;
|
|
641
|
+
placement?: 'top' | 'bottom';
|
|
642
|
+
children: ReactNode;
|
|
643
|
+
}
|
|
644
|
+
|
|
550
645
|
declare interface TypographyProps extends HTMLAttributes<HTMLElement> {
|
|
551
646
|
as?: ElementType;
|
|
552
647
|
}
|