@daasboard/ui 0.0.0-stage → 0.1.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/LICENSE +5 -0
- package/README.md +6 -2
- package/dist/LICENSE-lucide.txt +43 -0
- package/dist/color/color.d.ts +34 -0
- package/dist/color/color.js +106 -0
- package/dist/color/edit.d.ts +34 -0
- package/dist/color/edit.js +40 -0
- package/dist/color/gradient.d.ts +39 -0
- package/dist/color/gradient.js +129 -0
- package/dist/color/index.d.ts +3 -0
- package/dist/color/index.js +3 -0
- package/dist/controls/buttons.d.ts +54 -0
- package/dist/controls/buttons.js +95 -0
- package/dist/controls/font-picker.d.ts +35 -0
- package/dist/controls/font-picker.js +178 -0
- package/dist/controls/index.d.ts +43 -0
- package/dist/controls/index.js +32 -0
- package/dist/controls/number-field.d.ts +60 -0
- package/dist/controls/number-field.js +190 -0
- package/dist/controls/place.d.ts +10 -0
- package/dist/controls/place.js +77 -0
- package/dist/controls/popover.d.ts +84 -0
- package/dist/controls/popover.js +366 -0
- package/dist/controls/shared.d.ts +30 -0
- package/dist/controls/shared.js +134 -0
- package/dist/controls/slider.d.ts +82 -0
- package/dist/controls/slider.js +241 -0
- package/dist/controls/swatch.d.ts +25 -0
- package/dist/controls/swatch.js +38 -0
- package/dist/controls/tooltip.d.ts +19 -0
- package/dist/controls/tooltip.js +84 -0
- package/dist/controls/typed.d.ts +28 -0
- package/dist/controls/typed.js +126 -0
- package/dist/element.d.ts +40 -0
- package/dist/element.js +78 -0
- package/dist/host.d.ts +99 -0
- package/dist/host.js +1 -0
- package/dist/icons/index.d.ts +7 -0
- package/dist/icons/index.js +31 -0
- package/dist/icons/lucide.d.ts +851 -0
- package/dist/icons/lucide.js +90 -0
- package/dist/index.d.ts +18 -0
- package/dist/index.js +16 -0
- package/dist/keys.d.ts +30 -0
- package/dist/keys.js +122 -0
- package/dist/mount.d.ts +11 -0
- package/dist/mount.js +96 -0
- package/dist/options.d.ts +152 -0
- package/dist/options.js +78 -0
- package/dist/palette.d.ts +6 -0
- package/dist/palette.js +9 -0
- package/dist/picker/handles.d.ts +7 -0
- package/dist/picker/handles.js +8 -0
- package/dist/picker/index.d.ts +21 -0
- package/dist/picker/index.js +20 -0
- package/dist/picker/palette.d.ts +8 -0
- package/dist/picker/palette.js +14 -0
- package/dist/picker/picker.d.ts +63 -0
- package/dist/picker/picker.js +561 -0
- package/dist/picker/solid-editor.d.ts +60 -0
- package/dist/picker/solid-editor.js +330 -0
- package/dist/picker/stop-bar.d.ts +27 -0
- package/dist/picker/stop-bar.js +140 -0
- package/dist/prefs.d.ts +6 -0
- package/dist/prefs.js +34 -0
- package/dist/recents.d.ts +9 -0
- package/dist/recents.js +140 -0
- package/dist/root.d.ts +31 -0
- package/dist/root.js +526 -0
- package/dist/scheduler.d.ts +21 -0
- package/dist/scheduler.js +132 -0
- package/dist/strings.d.ts +284 -0
- package/dist/strings.js +287 -0
- package/dist/surface.d.ts +27 -0
- package/dist/surface.js +8 -0
- package/dist/surfaces/context-menu/index.d.ts +2 -0
- package/dist/surfaces/context-menu/index.js +2 -0
- package/dist/surfaces/context-menu/items.d.ts +14 -0
- package/dist/surfaces/context-menu/items.js +38 -0
- package/dist/surfaces/context-menu/menu.d.ts +16 -0
- package/dist/surfaces/context-menu/menu.js +135 -0
- package/dist/surfaces/pane/index.d.ts +16 -0
- package/dist/surfaces/pane/index.js +19 -0
- package/dist/surfaces/pane/model.d.ts +41 -0
- package/dist/surfaces/pane/model.js +139 -0
- package/dist/surfaces/pane/outlet.d.ts +16 -0
- package/dist/surfaces/pane/outlet.js +20 -0
- package/dist/surfaces/pane/pane.d.ts +40 -0
- package/dist/surfaces/pane/pane.js +1429 -0
- package/dist/surfaces/pane/placement.d.ts +11 -0
- package/dist/surfaces/pane/placement.js +62 -0
- package/dist/surfaces/pane/text-field.d.ts +16 -0
- package/dist/surfaces/pane/text-field.js +20 -0
- package/dist/surfaces/selection-toolbar/index.d.ts +2 -0
- package/dist/surfaces/selection-toolbar/index.js +2 -0
- package/dist/surfaces/selection-toolbar/items.d.ts +37 -0
- package/dist/surfaces/selection-toolbar/items.js +183 -0
- package/dist/surfaces/selection-toolbar/toolbar.d.ts +27 -0
- package/dist/surfaces/selection-toolbar/toolbar.js +956 -0
- package/dist/surfaces/tools/index.d.ts +2 -0
- package/dist/surfaces/tools/index.js +2 -0
- package/dist/surfaces/tools/keys.d.ts +11 -0
- package/dist/surfaces/tools/keys.js +21 -0
- package/dist/surfaces/tools/model.d.ts +48 -0
- package/dist/surfaces/tools/model.js +155 -0
- package/dist/surfaces/tools/toolbar.d.ts +27 -0
- package/dist/surfaces/tools/toolbar.js +502 -0
- package/dist/theme.d.ts +26 -0
- package/dist/theme.js +47 -0
- package/package.json +31 -3
package/dist/host.d.ts
ADDED
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import type { EmbedRef, PropertyController, ToolManager } from "@daasboard/editor";
|
|
2
|
+
import type { PaintEdit } from "./color/edit.js";
|
|
3
|
+
import type { UiOptions } from "./options.js";
|
|
4
|
+
export type UiController = Pick<PropertyController, "read" | "set" | "preview" | "commitPreview" | "cancelPreview" | "hasPreview" | "previewOverlay" | "commands" | "subscribe" | "targets" | "textTarget" | "create">;
|
|
5
|
+
export type UiTools = Pick<ToolManager, "active" | "setTool" | "onToolChange" | "setCreationStyle" | "creationStyle">;
|
|
6
|
+
export interface FontFamilyInfo {
|
|
7
|
+
family: string;
|
|
8
|
+
label?: string;
|
|
9
|
+
weights: readonly number[];
|
|
10
|
+
italic: boolean;
|
|
11
|
+
}
|
|
12
|
+
export interface ColorToken {
|
|
13
|
+
id: string;
|
|
14
|
+
name: string;
|
|
15
|
+
color: string;
|
|
16
|
+
}
|
|
17
|
+
export interface UiInsets {
|
|
18
|
+
top: number;
|
|
19
|
+
right: number;
|
|
20
|
+
bottom: number;
|
|
21
|
+
left: number;
|
|
22
|
+
}
|
|
23
|
+
export interface UiRect {
|
|
24
|
+
x: number;
|
|
25
|
+
y: number;
|
|
26
|
+
w: number;
|
|
27
|
+
h: number;
|
|
28
|
+
}
|
|
29
|
+
export interface UiPoint {
|
|
30
|
+
x: number;
|
|
31
|
+
y: number;
|
|
32
|
+
}
|
|
33
|
+
export interface UiClipboard {
|
|
34
|
+
canCopy(): boolean;
|
|
35
|
+
canPaste(): boolean;
|
|
36
|
+
copy(): void;
|
|
37
|
+
cut(): void;
|
|
38
|
+
paste(at: UiPoint | null): void;
|
|
39
|
+
}
|
|
40
|
+
export type ZoomLevel = number | "in" | "out" | "fit" | "selection";
|
|
41
|
+
export interface UiCamera {
|
|
42
|
+
zoom(): number;
|
|
43
|
+
zoomTo(level: ZoomLevel): void;
|
|
44
|
+
onChange(l: () => void): () => void;
|
|
45
|
+
}
|
|
46
|
+
export interface UiGradientTarget {
|
|
47
|
+
id: string;
|
|
48
|
+
layer?: number;
|
|
49
|
+
}
|
|
50
|
+
export type UiGradientEdit = Extract<PaintEdit, {
|
|
51
|
+
op: "axis" | "radial";
|
|
52
|
+
}>;
|
|
53
|
+
export interface UiGradientHandleEvents {
|
|
54
|
+
preview(edit: UiGradientEdit): void;
|
|
55
|
+
commit(edit: UiGradientEdit): void;
|
|
56
|
+
cancel(): void;
|
|
57
|
+
}
|
|
58
|
+
export interface UiGradientHandles {
|
|
59
|
+
hits(e: PointerEvent): boolean;
|
|
60
|
+
cancelDrag(): void;
|
|
61
|
+
hide(): void;
|
|
62
|
+
}
|
|
63
|
+
export interface UiHost {
|
|
64
|
+
allowsKey?(event: KeyboardEvent): boolean;
|
|
65
|
+
handleClipboard?(event: ClipboardEvent): boolean;
|
|
66
|
+
allows?(operation: string): boolean;
|
|
67
|
+
readonly clipboard?: UiClipboard;
|
|
68
|
+
readonly controller: UiController;
|
|
69
|
+
readonly tools: UiTools;
|
|
70
|
+
readOnly(): boolean;
|
|
71
|
+
readonly camera: UiCamera;
|
|
72
|
+
onGesture(l: (active: boolean) => void): () => void;
|
|
73
|
+
selectionRect(): UiRect | null;
|
|
74
|
+
fonts(): readonly FontFamilyInfo[];
|
|
75
|
+
lookupLink?(url: string): Promise<EmbedRef>;
|
|
76
|
+
insertImages?(): void;
|
|
77
|
+
tokens?(): readonly ColorToken[];
|
|
78
|
+
gradientHandles?(target: UiGradientTarget, events: UiGradientHandleEvents): UiGradientHandles | null;
|
|
79
|
+
returnFocus(): void;
|
|
80
|
+
setInsets(insets: UiInsets): void;
|
|
81
|
+
onChange(l: () => void): () => void;
|
|
82
|
+
}
|
|
83
|
+
export interface UiFrameStats {
|
|
84
|
+
frames: number;
|
|
85
|
+
lastMs: number;
|
|
86
|
+
medianMs: number;
|
|
87
|
+
p95Ms: number;
|
|
88
|
+
lastOutsideReadsMs: number;
|
|
89
|
+
outsideReadsMedianMs: number;
|
|
90
|
+
outsideReadsP95Ms: number;
|
|
91
|
+
}
|
|
92
|
+
export interface UiHandle {
|
|
93
|
+
configure(partial: UiOptions): void;
|
|
94
|
+
handleKey(e: KeyboardEvent): boolean;
|
|
95
|
+
owns(target: EventTarget | null): boolean;
|
|
96
|
+
openContextMenu(at: UiPoint | null): boolean;
|
|
97
|
+
stats(): UiFrameStats;
|
|
98
|
+
dispose(): void;
|
|
99
|
+
}
|
package/dist/host.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type TemplateResult } from "lit";
|
|
2
|
+
import { LUCIDE_ICONS, type IconNode } from "./lucide.js";
|
|
3
|
+
export { LUCIDE_ICONS, LUCIDE_VERSION, type IconNode } from "./lucide.js";
|
|
4
|
+
export type IconName = keyof typeof LUCIDE_ICONS;
|
|
5
|
+
export type IconOverride = string | IconNode;
|
|
6
|
+
export declare const ICON_NAMES: IconName[];
|
|
7
|
+
export declare function icon(name: IconName, size?: number, overrides?: Partial<Record<IconName, IconOverride>>): TemplateResult;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { html, nothing, svg } from "lit";
|
|
2
|
+
import { unsafeSVG } from "lit/directives/unsafe-svg.js";
|
|
3
|
+
import { LUCIDE_ICONS } from "./lucide.js";
|
|
4
|
+
export { LUCIDE_ICONS, LUCIDE_VERSION } from "./lucide.js";
|
|
5
|
+
export const ICON_NAMES = Object.keys(LUCIDE_ICONS);
|
|
6
|
+
const attr = (a, k) => (a[k] === undefined ? nothing : String(a[k]));
|
|
7
|
+
function element([tag, a]) {
|
|
8
|
+
switch (tag) {
|
|
9
|
+
case "path":
|
|
10
|
+
return svg `<path d=${attr(a, "d")} fill=${attr(a, "fill")}></path>`;
|
|
11
|
+
case "circle":
|
|
12
|
+
return svg `<circle cx=${attr(a, "cx")} cy=${attr(a, "cy")} r=${attr(a, "r")} fill=${attr(a, "fill")}></circle>`;
|
|
13
|
+
case "rect":
|
|
14
|
+
return svg `<rect x=${attr(a, "x")} y=${attr(a, "y")} width=${attr(a, "width")} height=${attr(a, "height")} rx=${attr(a, "rx")} ry=${attr(a, "ry")} fill=${attr(a, "fill")}></rect>`;
|
|
15
|
+
case "line":
|
|
16
|
+
return svg `<line x1=${attr(a, "x1")} y1=${attr(a, "y1")} x2=${attr(a, "x2")} y2=${attr(a, "y2")}></line>`;
|
|
17
|
+
case "polyline":
|
|
18
|
+
return svg `<polyline points=${attr(a, "points")}></polyline>`;
|
|
19
|
+
case "polygon":
|
|
20
|
+
return svg `<polygon points=${attr(a, "points")} fill=${attr(a, "fill")}></polygon>`;
|
|
21
|
+
case "ellipse":
|
|
22
|
+
return svg `<ellipse cx=${attr(a, "cx")} cy=${attr(a, "cy")} rx=${attr(a, "rx")} ry=${attr(a, "ry")} fill=${attr(a, "fill")}></ellipse>`;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
export function icon(name, size = 16, overrides) {
|
|
26
|
+
const own = overrides?.[name];
|
|
27
|
+
if (typeof own === "string")
|
|
28
|
+
return html `<span class="icon" part="icon" aria-hidden="true" style="display:inline-flex;width:${size}px;height:${size}px">${unsafeSVG(own)}</span>`;
|
|
29
|
+
const nodes = own ?? LUCIDE_ICONS[name];
|
|
30
|
+
return html `<svg class="icon" part="icon" aria-hidden="true" width=${size} height=${size} viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">${nodes.map(element)}</svg>`;
|
|
31
|
+
}
|