@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
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
export const SECTION_IDS = ["layout", "appearance", "text", "fill", "stroke", "connector", "effects", "link", "other"];
|
|
2
|
+
export const CORNER_KEYS = ["radiusTopLeft", "radiusTopRight", "radiusBottomLeft", "radiusBottomRight"];
|
|
3
|
+
export const TEXT_MORE_KEYS = ["bold", "italic", "underline", "strike", "textCase", "list"];
|
|
4
|
+
export const SIDE_KEYS = ["strokeTop", "strokeRight", "strokeBottom", "strokeLeft"];
|
|
5
|
+
export const STROKE_MORE_KEYS = ["dash", "strokeCapStart", "strokeCapEnd", "strokeJoin"];
|
|
6
|
+
export const SHADOW_KEYS = ["shadowX", "shadowBlur", "shadowY", "shadowSpread", "shadowColor"];
|
|
7
|
+
export const SECTION_KEYS = {
|
|
8
|
+
layout: ["x", "y", "w", "h", "rotation"],
|
|
9
|
+
appearance: ["opacity", "radius", ...CORNER_KEYS],
|
|
10
|
+
text: [
|
|
11
|
+
"fontFamily",
|
|
12
|
+
"fontWeight",
|
|
13
|
+
"fontSize",
|
|
14
|
+
"textColor",
|
|
15
|
+
"lineHeight",
|
|
16
|
+
"letterSpacing",
|
|
17
|
+
"textAlign",
|
|
18
|
+
"valign",
|
|
19
|
+
"padding",
|
|
20
|
+
"paddingLeft",
|
|
21
|
+
"paddingRight",
|
|
22
|
+
"paddingTop",
|
|
23
|
+
"paddingBottom",
|
|
24
|
+
...TEXT_MORE_KEYS,
|
|
25
|
+
"indent",
|
|
26
|
+
"checked",
|
|
27
|
+
"link",
|
|
28
|
+
],
|
|
29
|
+
fill: ["fills", "fill"],
|
|
30
|
+
stroke: ["stroke", "strokeAlign", "strokeWidth", ...SIDE_KEYS, "lineStart", "lineEnd", ...STROKE_MORE_KEYS],
|
|
31
|
+
connector: ["route", "bendRadius"],
|
|
32
|
+
effects: ["shadowOn", ...SHADOW_KEYS],
|
|
33
|
+
link: ["embed"],
|
|
34
|
+
};
|
|
35
|
+
export const NOT_IN_PANE = ["name", "locked", "hidden"];
|
|
36
|
+
const GROUP_SECTION = { geometry: "layout", embed: "link" };
|
|
37
|
+
const CLAIMED = new Set([...Object.values(SECTION_KEYS).flat(), ...NOT_IN_PANE]);
|
|
38
|
+
const isSectionId = (id) => SECTION_IDS.includes(id);
|
|
39
|
+
export function hiddenKeys(hide) {
|
|
40
|
+
const out = new Set(hide);
|
|
41
|
+
if (out.has("fill") || out.has("fills"))
|
|
42
|
+
out.add("fill").add("fills");
|
|
43
|
+
return out;
|
|
44
|
+
}
|
|
45
|
+
export function shownValues(values, hide) {
|
|
46
|
+
if (!hide?.length)
|
|
47
|
+
return values;
|
|
48
|
+
const hidden = hiddenKeys(hide);
|
|
49
|
+
const out = {};
|
|
50
|
+
for (const k in values)
|
|
51
|
+
if (!hidden.has(k))
|
|
52
|
+
out[k] = values[k];
|
|
53
|
+
return out;
|
|
54
|
+
}
|
|
55
|
+
export function absent(v) {
|
|
56
|
+
if (!v)
|
|
57
|
+
return true;
|
|
58
|
+
if (v.mixed)
|
|
59
|
+
return false;
|
|
60
|
+
return v.value === undefined || v.value === null || v.value === false || (Array.isArray(v.value) && v.value.length === 0);
|
|
61
|
+
}
|
|
62
|
+
export function paneModel({ values: all, targets, readOnly, options, view, replaced = [] }) {
|
|
63
|
+
const values = shownValues(all, options.hide);
|
|
64
|
+
const listed = options.sections ?? SECTION_IDS;
|
|
65
|
+
const ids = new Set(listed.map((s) => (typeof s === "string" ? s : s.id)));
|
|
66
|
+
const customClaims = new Set(listed.flatMap((s) => (typeof s === "string" ? [] : (s.keys ?? []))));
|
|
67
|
+
const extras = new Map();
|
|
68
|
+
for (const key in values) {
|
|
69
|
+
if (CLAIMED.has(key) || customClaims.has(key))
|
|
70
|
+
continue;
|
|
71
|
+
const group = values[key].descriptor.group;
|
|
72
|
+
const home = GROUP_SECTION[group] ?? group;
|
|
73
|
+
const at = home !== "other" && ids.has(home) ? home : ids.has("other") ? "other" : null;
|
|
74
|
+
if (at)
|
|
75
|
+
extras.set(at, [...(extras.get(at) ?? []), `key:${key}`]);
|
|
76
|
+
}
|
|
77
|
+
const out = [];
|
|
78
|
+
for (const entry of listed) {
|
|
79
|
+
const id = typeof entry === "string" ? entry : entry.id;
|
|
80
|
+
const extra = extras.get(id) ?? [];
|
|
81
|
+
const collapsed = view.collapsed.has(id);
|
|
82
|
+
let s;
|
|
83
|
+
if (typeof entry !== "string") {
|
|
84
|
+
const keys = (entry.keys ?? []).filter((k) => k in values).map((k) => `key:${k}`);
|
|
85
|
+
const shows = entry.render ? targets > 0 && (!entry.keys?.length || keys.length > 0) : keys.length > 0;
|
|
86
|
+
s = shows ? { custom: entry, rows: entry.render ? ["custom"] : keys, own: true, empty: false, disabled: false } : null;
|
|
87
|
+
}
|
|
88
|
+
else
|
|
89
|
+
s = isSectionId(id) ? section(id, values, targets, readOnly, options.hide ?? [], view, replaced) : null;
|
|
90
|
+
if (!s && extra.length === 0)
|
|
91
|
+
continue;
|
|
92
|
+
const rows = [...(s?.rows ?? []), ...extra];
|
|
93
|
+
out.push({ id, ...(typeof entry === "string" ? {} : { custom: entry }), rows: collapsed ? [] : rows, own: s?.own ?? false, empty: s?.empty ?? false, disabled: s?.disabled ?? false, collapsed });
|
|
94
|
+
}
|
|
95
|
+
return out;
|
|
96
|
+
}
|
|
97
|
+
export const PADDING_KEYS = ["paddingLeft", "paddingRight", "paddingTop", "paddingBottom"];
|
|
98
|
+
export const ROWS = {
|
|
99
|
+
layout: { align: [], position: ["x", "y"], size: ["w", "h"], rotation: ["rotation"] },
|
|
100
|
+
appearance: { opacity: ["opacity", "radius"], corners: CORNER_KEYS },
|
|
101
|
+
text: {
|
|
102
|
+
font: ["fontFamily", ...TEXT_MORE_KEYS],
|
|
103
|
+
weightSize: ["fontWeight", "fontSize"],
|
|
104
|
+
color: ["textColor"],
|
|
105
|
+
spacing: ["lineHeight", "letterSpacing"],
|
|
106
|
+
align: ["textAlign", "valign"],
|
|
107
|
+
padding: PADDING_KEYS,
|
|
108
|
+
paddingSides: PADDING_KEYS,
|
|
109
|
+
},
|
|
110
|
+
stroke: { color: ["stroke"], geometry: ["strokeAlign", "strokeWidth", ...SIDE_KEYS], ends: ["lineStart", "lineEnd"] },
|
|
111
|
+
connector: { route: ["route", "bendRadius"] },
|
|
112
|
+
effects: { shadow: ["shadowOn"] },
|
|
113
|
+
link: { url: ["embed"] },
|
|
114
|
+
};
|
|
115
|
+
const LIST_KEYS = { fill: "fills", stroke: "stroke", effects: "shadowOn" };
|
|
116
|
+
function section(id, values, targets, readOnly, hide, view, replaced) {
|
|
117
|
+
const hidden = (k) => hide.includes(k) || (k === "fills" && hide.includes("fill"));
|
|
118
|
+
const has = (...keys) => keys.some((k) => (targets ? k in values : !hidden(k)));
|
|
119
|
+
const shown = (rows, empty = false) => ({ rows, own: true, empty, disabled: !targets && !empty });
|
|
120
|
+
const list = LIST_KEYS[id];
|
|
121
|
+
if (!targets && id !== "layout")
|
|
122
|
+
return list && has(list) ? shown([], true) : null;
|
|
123
|
+
if (!has(...(id === "fill" || id === "effects" ? [list] : (SECTION_KEYS[id] ?? []))))
|
|
124
|
+
return null;
|
|
125
|
+
if (id === "fill") {
|
|
126
|
+
if (replaced.includes("fills"))
|
|
127
|
+
return shown(["key:fills"]);
|
|
128
|
+
const v = view.fillsHeld ?? values.fills;
|
|
129
|
+
const rows = v.mixed ? ["mixed"] : (Array.isArray(v.value) ? v.value : []).map((_, i) => `layer:${i}`).reverse();
|
|
130
|
+
return shown(rows, rows.length === 0);
|
|
131
|
+
}
|
|
132
|
+
if (list && list in values && absent(values[list]))
|
|
133
|
+
return shown([], true);
|
|
134
|
+
const differ = "radius" in values && values.radius.value === undefined && !values.radius.mixed;
|
|
135
|
+
const rows = Object.entries(ROWS[id] ?? {})
|
|
136
|
+
.filter(([row, keys]) => (keys.length ? has(...keys) : !readOnly) && (row === "corners" ? view.corners || differ || !has("radius") : row !== "paddingSides" || view.paddingSides))
|
|
137
|
+
.map(([row]) => row);
|
|
138
|
+
return rows.length > 0 || (id === "stroke" && has(...STROKE_MORE_KEYS)) ? shown(rows) : null;
|
|
139
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { nothing } from "lit";
|
|
2
|
+
import { CONTEXT, UiElement, type ContextOwner, type UiContext } from "../../element.js";
|
|
3
|
+
import type { PaneSurface } from "./pane.js";
|
|
4
|
+
export declare const PANE_ROOT_TAG = "daas-ui-pane";
|
|
5
|
+
export declare class PaneRoot extends UiElement implements ContextOwner {
|
|
6
|
+
static styles: import("lit").CSSResult[];
|
|
7
|
+
static properties: {
|
|
8
|
+
pane: {
|
|
9
|
+
attribute: boolean;
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
[CONTEXT]: UiContext;
|
|
13
|
+
pane: PaneSurface | null;
|
|
14
|
+
constructor();
|
|
15
|
+
protected render(): typeof nothing | PaneSurface;
|
|
16
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { css, nothing } from "lit";
|
|
2
|
+
import { UiElement } from "../../element.js";
|
|
3
|
+
import { rootReset, themeStyles } from "../../theme.js";
|
|
4
|
+
export const PANE_ROOT_TAG = "daas-ui-pane";
|
|
5
|
+
export class PaneRoot extends UiElement {
|
|
6
|
+
static styles = [
|
|
7
|
+
rootReset,
|
|
8
|
+
css `
|
|
9
|
+
:host{display: block;font-family: var(--daas-ui-font);font-size: 13px;line-height: 1.4;color: var(--daas-ui-fg);}`,
|
|
10
|
+
themeStyles,
|
|
11
|
+
];
|
|
12
|
+
static properties = { pane: { attribute: false } };
|
|
13
|
+
constructor() {
|
|
14
|
+
super();
|
|
15
|
+
this.pane = null;
|
|
16
|
+
}
|
|
17
|
+
render() {
|
|
18
|
+
return this.pane ?? nothing;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { type PropertyValues, type TemplateResult } from "lit";
|
|
2
|
+
import type { ScopeChange } from "../../element.js";
|
|
3
|
+
import { type PaneOptions } from "../../options.js";
|
|
4
|
+
import { UiSurface } from "../../surface.js";
|
|
5
|
+
import { type PaneSection } from "./model.js";
|
|
6
|
+
export declare const NARROW_PX = 760;
|
|
7
|
+
export declare const NEW_LAYER = "#dee2e6";
|
|
8
|
+
export declare const NEW_STROKE = "#000000";
|
|
9
|
+
export type PaneMode = "docked" | "narrow" | "container";
|
|
10
|
+
declare const RESCUE: unique symbol;
|
|
11
|
+
declare const DRAGGING: unique symbol;
|
|
12
|
+
export declare class PaneSurface extends UiSurface {
|
|
13
|
+
#private;
|
|
14
|
+
static styles: import("lit").CSSResult[];
|
|
15
|
+
static properties: {
|
|
16
|
+
placement: {};
|
|
17
|
+
state: {
|
|
18
|
+
attribute: boolean;
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
placement: "left" | "right" | "container";
|
|
22
|
+
retired: boolean;
|
|
23
|
+
constructor();
|
|
24
|
+
keys(): readonly string[];
|
|
25
|
+
connectedCallback(): void;
|
|
26
|
+
disconnectedCallback(): void;
|
|
27
|
+
retire(off: () => void): void;
|
|
28
|
+
configured(o: PaneOptions): void;
|
|
29
|
+
get mode(): PaneMode;
|
|
30
|
+
get open(): boolean;
|
|
31
|
+
get sections(): readonly PaneSection[];
|
|
32
|
+
protected shouldUpdate(changed: PropertyValues<this>): boolean;
|
|
33
|
+
protected willUpdate(): void;
|
|
34
|
+
protected updated(changed: Map<PropertyKey, unknown>): void;
|
|
35
|
+
[RESCUE](el: Element): void;
|
|
36
|
+
[DRAGGING](): Element | null;
|
|
37
|
+
scopeChanged(change: ScopeChange): void;
|
|
38
|
+
protected render(): TemplateResult<1>;
|
|
39
|
+
}
|
|
40
|
+
export {};
|