@f-ewald/components 1.41.0 → 1.43.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 +5 -1
- package/custom-elements.json +2102 -332
- package/dist/autocomplete-input.d.ts +10 -2
- package/dist/autocomplete-input.d.ts.map +1 -1
- package/dist/autocomplete-input.js +34 -1
- package/dist/autocomplete-input.js.map +1 -1
- package/dist/dag-graph.d.ts +161 -0
- package/dist/dag-graph.d.ts.map +1 -0
- package/dist/dag-graph.js +724 -0
- package/dist/dag-graph.js.map +1 -0
- package/dist/data-table.d.ts +11 -2
- package/dist/data-table.d.ts.map +1 -1
- package/dist/data-table.js +31 -3
- package/dist/data-table.js.map +1 -1
- package/dist/icons.d.ts +16 -0
- package/dist/icons.d.ts.map +1 -1
- package/dist/icons.js +16 -0
- package/dist/icons.js.map +1 -1
- package/dist/index.d.ts +4 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -1
- package/dist/kind-icon.d.ts +38 -0
- package/dist/kind-icon.d.ts.map +1 -0
- package/dist/kind-icon.js +87 -0
- package/dist/kind-icon.js.map +1 -0
- package/dist/tokens.css +4 -0
- package/dist/tokens.d.ts.map +1 -1
- package/dist/tokens.js +10 -0
- package/dist/tokens.js.map +1 -1
- package/dist/ui-tooltip.d.ts +49 -0
- package/dist/ui-tooltip.d.ts.map +1 -0
- package/dist/ui-tooltip.js +317 -0
- package/dist/ui-tooltip.js.map +1 -0
- package/dist/utils/dag-layout.d.ts +60 -0
- package/dist/utils/dag-layout.d.ts.map +1 -0
- package/dist/utils/dag-layout.js +80 -0
- package/dist/utils/dag-layout.js.map +1 -0
- package/docs/autocomplete-input.md +9 -2
- package/docs/dag-graph.md +101 -0
- package/docs/data-table.md +18 -0
- package/docs/design-language.md +4 -1
- package/docs/icons.md +8 -0
- package/docs/kind-icon.md +53 -0
- package/docs/ui-tooltip.md +70 -0
- package/llms.txt +150 -2
- package/package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C;2CAAgC;AAhEvC,SAAS;IADrB,aAAa,CAAC,YAAY,CAAC;GACf,SAAS,CAwPrB","sourcesContent":["import { LitElement, css, html, type PropertyValues } from \"lit\";\nimport { customElement, property, query, state } from \"lit/decorators.js\";\nimport { tokens } from \"./tokens.js\";\n\nlet instanceCount = 0;\n\n/** Preferred side of the trigger; the tooltip flips when that side lacks room. */\nexport type UiTooltipPlacement = \"top\" | \"bottom\";\n\n/** Space kept between the trigger, the tooltip, and the viewport edges, in pixels. */\nconst GAP = 6;\nconst EDGE = 4;\n/** Grace period that lets the pointer cross from the trigger onto the tooltip. */\nconst HIDE_DELAY = 100;\n\nconst FOCUSABLE =\n \"a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), summary, [contenteditable], [tabindex]:not([tabindex='-1'])\";\n\n/** Whether `root` is or contains a focusable element, looking inside open shadow roots. */\nfunction containsFocusable(root: Element | ShadowRoot): boolean {\n if (root instanceof Element && root.matches(FOCUSABLE)) return true;\n if (root.querySelector(FOCUSABLE)) return true;\n const hosts = root instanceof Element ? [root, ...root.querySelectorAll(\"*\")] : [...root.querySelectorAll(\"*\")];\n return hosts.some((el) => el.shadowRoot !== null && containsFocusable(el.shadowRoot));\n}\n\n/**\n * Hover and focus tooltip for its default-slot trigger. The `content` slot\n * holds the tooltip body — plain text or rich markup such as a list. It\n * appears after `show-delay` on hover and at once on keyboard focus, stays\n * open while the pointer is over the tooltip itself, and closes on Escape,\n * blur, or when the pointer leaves. It renders in the top layer, so\n * scrolling or `overflow: hidden` ancestors never clip it.\n *\n * The trigger is described by the content (`aria-describedby`). A trigger\n * with nothing focusable inside (e.g. plain text) makes the tooltip host\n * focusable so keyboard users can reach the description too. ARIA references\n * can't cross shadow roots, so when the trigger is a custom element whose\n * focusable control lives in its own shadow root, screen readers won't\n * announce the description on focus; prefer a native trigger such as\n * `<button>` when that matters.\n *\n * @element ui-tooltip\n * @slot - The trigger the tooltip describes.\n * @slot content - The tooltip body.\n * @csspart tooltip - The floating tooltip surface.\n */\n@customElement(\"ui-tooltip\")\nexport class UiTooltip extends LitElement {\n static override styles = [\n tokens,\n css`\n :host {\n display: inline-block;\n }\n :host(:focus-visible) {\n outline: none;\n border-radius: var(--ui-radius-sm, 0.25rem);\n box-shadow: var(--ui-focus-ring, 0 0 0 3px rgb(79 70 229 / 0.35));\n }\n .tooltip {\n position: fixed;\n inset: auto;\n margin: 0;\n box-sizing: border-box;\n max-width: min(20rem, calc(100vw - 0.5rem));\n padding: 0.25rem 0.5rem;\n border: 0;\n border-radius: var(--ui-radius-sm, 0.25rem);\n background: var(--ui-tooltip, #0f172a);\n color: var(--ui-tooltip-text, #ffffff);\n box-shadow: var(--ui-shadow, 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1));\n font-family: var(\n --ui-font,\n ui-sans-serif,\n system-ui,\n sans-serif,\n \"Apple Color Emoji\",\n \"Segoe UI Emoji\",\n \"Segoe UI Symbol\",\n \"Noto Color Emoji\"\n );\n font-size: var(--ui-font-size-sm, 0.75rem);\n font-weight: var(--ui-font-weight-regular, 400);\n line-height: var(--ui-line-height-tight, 1.25);\n text-align: start;\n overflow-wrap: anywhere;\n }\n @media (forced-colors: active) {\n :host(:focus-visible) {\n outline: 2px solid CanvasText;\n outline-offset: 2px;\n box-shadow: none;\n }\n .tooltip {\n border: 1px solid CanvasText;\n background: Canvas;\n color: CanvasText;\n }\n }\n `,\n ];\n\n /** Preferred side of the trigger; flips to the other side when this one lacks room. */\n @property({ reflect: true }) placement: UiTooltipPlacement = \"top\";\n /** Hover delay in milliseconds before the tooltip appears; keyboard focus shows it at once. */\n @property({ type: Number, attribute: \"show-delay\" }) showDelay = 300;\n /** Suppresses the tooltip and closes it if open. */\n @property({ type: Boolean, reflect: true }) disabled = false;\n\n @state() private _open = false;\n\n @query(\".tooltip\") private _tooltip!: HTMLElement;\n\n #showTimer: ReturnType<typeof setTimeout> | null = null;\n #hideTimer: ReturnType<typeof setTimeout> | null = null;\n #describedTarget: HTMLElement | null = null;\n #describedId: string | null = null;\n #content: HTMLElement | null = null;\n #madeFocusable = false;\n readonly #contentId = `ui-tooltip-content-${++instanceCount}`;\n\n constructor() {\n super();\n this.addEventListener(\"pointerenter\", () => this.#scheduleShow(this.showDelay));\n this.addEventListener(\"pointerleave\", () => this.#scheduleHide(HIDE_DELAY, \":focus-within\"));\n this.addEventListener(\"focusin\", () => this.#scheduleShow(0));\n this.addEventListener(\"focusout\", () => this.#scheduleHide(0, \":hover\"));\n }\n\n /** Whether the tooltip is currently showing. */\n get open(): boolean {\n return this._open;\n }\n\n override disconnectedCallback(): void {\n super.disconnectedCallback();\n this.#clearTimers();\n this.#setOpen(false);\n }\n\n protected override willUpdate(changed: PropertyValues<this>): void {\n if (changed.has(\"disabled\") && this.disabled) {\n this.#clearTimers();\n this.#setOpen(false);\n }\n }\n\n protected override updated(changed: PropertyValues): void {\n if (!changed.has(\"_open\")) return;\n if (this._open) {\n this._tooltip.showPopover();\n this.#position();\n return;\n }\n if (this._tooltip.matches(\":popover-open\")) this._tooltip.hidePopover();\n }\n\n #scheduleShow(delay: number): void {\n if (this.disabled || !this.#content) return;\n this.#clearTimers();\n if (this._open) return;\n if (delay <= 0) {\n this.#setOpen(true);\n return;\n }\n this.#showTimer = setTimeout(() => this.#setOpen(true), delay);\n }\n\n /** Hides after `delay` unless the host still matches `keepOpenWhile` (still hovered or focused). */\n #scheduleHide(delay: number, keepOpenWhile: string): void {\n this.#clearTimers();\n if (!this._open) return;\n const hide = () => {\n if (!this.matches(keepOpenWhile)) this.#setOpen(false);\n };\n if (delay <= 0) {\n hide();\n return;\n }\n this.#hideTimer = setTimeout(hide, delay);\n }\n\n #clearTimers(): void {\n if (this.#showTimer) clearTimeout(this.#showTimer);\n if (this.#hideTimer) clearTimeout(this.#hideTimer);\n this.#showTimer = null;\n this.#hideTimer = null;\n }\n\n #setOpen(open: boolean): void {\n if (this._open === open) return;\n this._open = open;\n if (open) {\n document.addEventListener(\"keydown\", this.#onDocumentKeydown, true);\n window.addEventListener(\"scroll\", this.#onViewportChange, true);\n window.addEventListener(\"resize\", this.#onViewportChange);\n return;\n }\n document.removeEventListener(\"keydown\", this.#onDocumentKeydown, true);\n window.removeEventListener(\"scroll\", this.#onViewportChange, true);\n window.removeEventListener(\"resize\", this.#onViewportChange);\n }\n\n /** Escape closes the tooltip without dismissing anything else (WCAG 1.4.13). */\n #onDocumentKeydown = (event: KeyboardEvent): void => {\n if (event.key !== \"Escape\" || !this._open) return;\n event.preventDefault();\n event.stopPropagation();\n this.#clearTimers();\n this.#setOpen(false);\n };\n\n #onViewportChange = (): void => {\n if (this._open) this.#position();\n };\n\n /** Places the tooltip beside the host, flipping sides and clamping it inside the viewport. */\n #position(): void {\n const anchor = this.getBoundingClientRect();\n const tip = this._tooltip.getBoundingClientRect();\n const above = anchor.top - GAP - tip.height;\n const below = anchor.bottom + GAP;\n const fitsAbove = above >= EDGE;\n const fitsBelow = below + tip.height <= window.innerHeight - EDGE;\n const top =\n this.placement === \"top\" ? (fitsAbove || !fitsBelow ? above : below) : fitsBelow || !fitsAbove ? below : above;\n const centered = anchor.left + anchor.width / 2 - tip.width / 2;\n const left = Math.min(Math.max(centered, EDGE), Math.max(EDGE, window.innerWidth - EDGE - tip.width));\n this._tooltip.style.top = `${Math.round(top)}px`;\n this._tooltip.style.left = `${Math.round(left)}px`;\n this._tooltip.dataset.side = top === above ? \"top\" : \"bottom\";\n }\n\n async #onTriggerSlotChange(event: Event): Promise<void> {\n const slot = event.target as HTMLSlotElement;\n const trigger = slot.assignedElements()[0] as (HTMLElement & { updateComplete?: Promise<unknown> }) | undefined;\n // A Lit trigger renders its (possibly focusable) shadow content after it is slotted.\n await trigger?.updateComplete;\n if (trigger !== slot.assignedElements()[0]) return;\n const target = trigger && containsFocusable(trigger) ? trigger : this;\n this.#updateFocusability(target === this);\n this.#describe(target);\n }\n\n #onContentSlotChange(event: Event): void {\n const content = (event.target as HTMLSlotElement).assignedElements()[0] as HTMLElement | undefined;\n this.#content = content ?? null;\n if (content && !content.id) content.id = this.#contentId;\n if (!content) this.#setOpen(false);\n this.#describe(this.#describedTarget);\n }\n\n /** Points the trigger's `aria-describedby` at the content, replacing this tooltip's previous reference. */\n #describe(target: HTMLElement | null): void {\n if (this.#describedTarget && this.#describedId) {\n this.#setDescribedBy(this.#describedTarget, this.#describedIds(this.#describedTarget));\n }\n this.#describedTarget = target;\n this.#describedId = this.#content?.id ?? null;\n if (!target || !this.#describedId) return;\n this.#setDescribedBy(target, [...this.#describedIds(target), this.#describedId]);\n }\n\n /** The target's `aria-describedby` ids, minus the one this tooltip added. */\n #describedIds(target: HTMLElement): string[] {\n return (target.getAttribute(\"aria-describedby\") ?? \"\")\n .split(/\\s+/)\n .filter((value) => value && value !== this.#describedId);\n }\n\n #setDescribedBy(target: HTMLElement, ids: string[]): void {\n if (ids.length) target.setAttribute(\"aria-describedby\", ids.join(\" \"));\n else target.removeAttribute(\"aria-describedby\");\n }\n\n #updateFocusability(needed: boolean): void {\n if (needed && !this.hasAttribute(\"tabindex\")) {\n this.tabIndex = 0;\n this.#madeFocusable = true;\n return;\n }\n if (!needed && this.#madeFocusable) {\n this.removeAttribute(\"tabindex\");\n this.#madeFocusable = false;\n }\n }\n\n override render() {\n return html`\n <slot @slotchange=${this.#onTriggerSlotChange}></slot>\n <div class=\"tooltip\" part=\"tooltip\" role=\"tooltip\" popover=\"manual\">\n <slot name=\"content\" @slotchange=${this.#onContentSlotChange}></slot>\n </div>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"ui-tooltip\": UiTooltip;\n }\n}\n"]}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/** Height of every node card, in pixels. */
|
|
2
|
+
export declare const DAG_NODE_HEIGHT = 24;
|
|
3
|
+
/** Space before a node's label: left padding, 14px icon, and gap. */
|
|
4
|
+
export declare const DAG_LABEL_OFFSET = 26;
|
|
5
|
+
/** Space before a node's label when it has no icon. */
|
|
6
|
+
export declare const DAG_LABEL_OFFSET_PLAIN = 8;
|
|
7
|
+
/** Narrowest node card, in pixels. */
|
|
8
|
+
export declare const DAG_MIN_NODE_WIDTH = 48;
|
|
9
|
+
/** Widest node card, in pixels; longer labels are shortened with an ellipsis. */
|
|
10
|
+
export declare const DAG_MAX_NODE_WIDTH = 200;
|
|
11
|
+
/** Flow direction of the layers: left to right or top to bottom. */
|
|
12
|
+
export type DagDirection = "LR" | "TB";
|
|
13
|
+
/** Returns the rendered width of a label in pixels. */
|
|
14
|
+
export type MeasureText = (text: string) => number;
|
|
15
|
+
/** Width estimate used when the browser cannot measure text (no 2D canvas). */
|
|
16
|
+
export declare const approximateTextWidth: MeasureText;
|
|
17
|
+
/** A point in layout coordinates. */
|
|
18
|
+
export interface DagPoint {
|
|
19
|
+
x: number;
|
|
20
|
+
y: number;
|
|
21
|
+
}
|
|
22
|
+
/** One node to lay out. */
|
|
23
|
+
export interface DagLayoutInput {
|
|
24
|
+
id: string;
|
|
25
|
+
label: string;
|
|
26
|
+
/** Whether the node shows an icon before its label. */
|
|
27
|
+
hasIcon: boolean;
|
|
28
|
+
}
|
|
29
|
+
/** A positioned node: centered at `(x, y)` and sized to its (possibly shortened) label. */
|
|
30
|
+
export interface DagLayoutNode extends DagPoint {
|
|
31
|
+
id: string;
|
|
32
|
+
width: number;
|
|
33
|
+
label: string;
|
|
34
|
+
}
|
|
35
|
+
/** A routed edge; `backward` edges run against the flow direction and close a cycle. */
|
|
36
|
+
export interface DagLayoutEdge {
|
|
37
|
+
source: string;
|
|
38
|
+
target: string;
|
|
39
|
+
points: DagPoint[];
|
|
40
|
+
backward: boolean;
|
|
41
|
+
}
|
|
42
|
+
/** Positioned nodes and routed edges, in input-independent order. */
|
|
43
|
+
export interface DagLayout {
|
|
44
|
+
nodes: DagLayoutNode[];
|
|
45
|
+
edges: DagLayoutEdge[];
|
|
46
|
+
}
|
|
47
|
+
/** Shortens `text` with an ellipsis until it fits `maxWidth`. */
|
|
48
|
+
export declare function fitLabel(text: string, maxWidth: number, measure: MeasureText): string;
|
|
49
|
+
/**
|
|
50
|
+
* Lays out a directed graph in layers (Sugiyama-style, via dagre) so every edge points along `direction`.
|
|
51
|
+
*
|
|
52
|
+
* Cycles are broken only to assign layers: every edge is returned, and the ones that close a cycle are marked
|
|
53
|
+
* `backward`. Edges whose endpoints are not both in `nodes`, self-edges, and duplicates are ignored. The result
|
|
54
|
+
* does not depend on input order.
|
|
55
|
+
*/
|
|
56
|
+
export declare function layoutDag(nodes: DagLayoutInput[], edges: Array<{
|
|
57
|
+
source: string;
|
|
58
|
+
target: string;
|
|
59
|
+
}>, direction?: DagDirection, measure?: MeasureText): DagLayout;
|
|
60
|
+
//# sourceMappingURL=dag-layout.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dag-layout.d.ts","sourceRoot":"","sources":["../../src/utils/dag-layout.ts"],"names":[],"mappings":"AAEA,4CAA4C;AAC5C,eAAO,MAAM,eAAe,KAAK,CAAC;AAClC,qEAAqE;AACrE,eAAO,MAAM,gBAAgB,KAAK,CAAC;AACnC,uDAAuD;AACvD,eAAO,MAAM,sBAAsB,IAAI,CAAC;AAExC,sCAAsC;AACtC,eAAO,MAAM,kBAAkB,KAAK,CAAC;AACrC,iFAAiF;AACjF,eAAO,MAAM,kBAAkB,MAAM,CAAC;AAKtC,oEAAoE;AACpE,MAAM,MAAM,YAAY,GAAG,IAAI,GAAG,IAAI,CAAC;AAEvC,uDAAuD;AACvD,MAAM,MAAM,WAAW,GAAG,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,CAAC;AAEnD,+EAA+E;AAC/E,eAAO,MAAM,oBAAoB,EAAE,WAAyC,CAAC;AAE7E,qCAAqC;AACrC,MAAM,WAAW,QAAQ;IACvB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX;AAED,2BAA2B;AAC3B,MAAM,WAAW,cAAc;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,uDAAuD;IACvD,OAAO,EAAE,OAAO,CAAC;CAClB;AAED,2FAA2F;AAC3F,MAAM,WAAW,aAAc,SAAQ,QAAQ;IAC7C,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACf;AAED,wFAAwF;AACxF,MAAM,WAAW,aAAa;IAC5B,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,QAAQ,EAAE,CAAC;IACnB,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED,qEAAqE;AACrE,MAAM,WAAW,SAAS;IACxB,KAAK,EAAE,aAAa,EAAE,CAAC;IACvB,KAAK,EAAE,aAAa,EAAE,CAAC;CACxB;AAED,iEAAiE;AACjE,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,WAAW,GAAG,MAAM,CAKrF;AASD;;;;;;GAMG;AACH,wBAAgB,SAAS,CACvB,KAAK,EAAE,cAAc,EAAE,EACvB,KAAK,EAAE,KAAK,CAAC;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC,EAChD,SAAS,GAAE,YAAmB,EAC9B,OAAO,GAAE,WAAkC,GAC1C,SAAS,CA2CX"}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { Graph, layout } from "@dagrejs/dagre";
|
|
2
|
+
/** Height of every node card, in pixels. */
|
|
3
|
+
export const DAG_NODE_HEIGHT = 24;
|
|
4
|
+
/** Space before a node's label: left padding, 14px icon, and gap. */
|
|
5
|
+
export const DAG_LABEL_OFFSET = 26;
|
|
6
|
+
/** Space before a node's label when it has no icon. */
|
|
7
|
+
export const DAG_LABEL_OFFSET_PLAIN = 8;
|
|
8
|
+
const LABEL_PADDING_END = 10;
|
|
9
|
+
/** Narrowest node card, in pixels. */
|
|
10
|
+
export const DAG_MIN_NODE_WIDTH = 48;
|
|
11
|
+
/** Widest node card, in pixels; longer labels are shortened with an ellipsis. */
|
|
12
|
+
export const DAG_MAX_NODE_WIDTH = 200;
|
|
13
|
+
const RANK_GAP = 90;
|
|
14
|
+
const NODE_GAP = 6;
|
|
15
|
+
const ELLIPSIS = "…";
|
|
16
|
+
/** Width estimate used when the browser cannot measure text (no 2D canvas). */
|
|
17
|
+
export const approximateTextWidth = (text) => text.length * 6.2;
|
|
18
|
+
/** Shortens `text` with an ellipsis until it fits `maxWidth`. */
|
|
19
|
+
export function fitLabel(text, maxWidth, measure) {
|
|
20
|
+
if (measure(text) <= maxWidth)
|
|
21
|
+
return text;
|
|
22
|
+
let end = text.length - 1;
|
|
23
|
+
while (end > 1 && measure(text.slice(0, end) + ELLIPSIS) > maxWidth)
|
|
24
|
+
end -= 1;
|
|
25
|
+
return text.slice(0, end) + ELLIPSIS;
|
|
26
|
+
}
|
|
27
|
+
function nodeSize(node, measure) {
|
|
28
|
+
const offset = node.hasIcon ? DAG_LABEL_OFFSET : DAG_LABEL_OFFSET_PLAIN;
|
|
29
|
+
const label = fitLabel(node.label, DAG_MAX_NODE_WIDTH - offset - LABEL_PADDING_END, measure);
|
|
30
|
+
const width = Math.ceil(offset + measure(label) + LABEL_PADDING_END);
|
|
31
|
+
return { label, width: Math.min(DAG_MAX_NODE_WIDTH, Math.max(DAG_MIN_NODE_WIDTH, width)) };
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Lays out a directed graph in layers (Sugiyama-style, via dagre) so every edge points along `direction`.
|
|
35
|
+
*
|
|
36
|
+
* Cycles are broken only to assign layers: every edge is returned, and the ones that close a cycle are marked
|
|
37
|
+
* `backward`. Edges whose endpoints are not both in `nodes`, self-edges, and duplicates are ignored. The result
|
|
38
|
+
* does not depend on input order.
|
|
39
|
+
*/
|
|
40
|
+
export function layoutDag(nodes, edges, direction = "LR", measure = approximateTextWidth) {
|
|
41
|
+
if (nodes.length === 0)
|
|
42
|
+
return { nodes: [], edges: [] };
|
|
43
|
+
const graph = new Graph();
|
|
44
|
+
graph.setGraph({
|
|
45
|
+
rankdir: direction,
|
|
46
|
+
ranksep: RANK_GAP,
|
|
47
|
+
nodesep: NODE_GAP,
|
|
48
|
+
edgesep: 4,
|
|
49
|
+
marginx: 0,
|
|
50
|
+
marginy: 0,
|
|
51
|
+
});
|
|
52
|
+
graph.setDefaultEdgeLabel(() => ({}));
|
|
53
|
+
const sorted = [...nodes].sort((a, b) => a.id.localeCompare(b.id));
|
|
54
|
+
const sizes = new Map(sorted.map((node) => [node.id, nodeSize(node, measure)]));
|
|
55
|
+
for (const node of sorted) {
|
|
56
|
+
graph.setNode(node.id, { width: sizes.get(node.id).width, height: DAG_NODE_HEIGHT });
|
|
57
|
+
}
|
|
58
|
+
const known = new Set(sizes.keys());
|
|
59
|
+
const unique = new Map(edges
|
|
60
|
+
.filter((edge) => known.has(edge.source) && known.has(edge.target) && edge.source !== edge.target)
|
|
61
|
+
.map((edge) => [`${edge.source}\u0000${edge.target}`, { source: edge.source, target: edge.target }]));
|
|
62
|
+
const kept = [...unique.values()].sort((a, b) => a.source.localeCompare(b.source) || a.target.localeCompare(b.target));
|
|
63
|
+
for (const edge of kept)
|
|
64
|
+
graph.setEdge(edge.source, edge.target);
|
|
65
|
+
layout(graph);
|
|
66
|
+
const positioned = new Map(sorted.map((node) => {
|
|
67
|
+
const { x, y } = graph.node(node.id);
|
|
68
|
+
return [node.id, { id: node.id, x, y, ...sizes.get(node.id) }];
|
|
69
|
+
}));
|
|
70
|
+
const axis = direction === "LR" ? "x" : "y";
|
|
71
|
+
return {
|
|
72
|
+
nodes: [...positioned.values()],
|
|
73
|
+
edges: kept.map((edge) => ({
|
|
74
|
+
...edge,
|
|
75
|
+
points: graph.edge(edge.source, edge.target).points.map(({ x, y }) => ({ x, y })),
|
|
76
|
+
backward: positioned.get(edge.target)[axis] < positioned.get(edge.source)[axis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AC,MAAM,CAAE,CAAC,IAAI,CAAC,GAAG,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,CAAE,CAAC,IAAI,CAAC;SAClF,CAAC,CAAC;KACJ,CAAC;AACJ,CAAC","sourcesContent":["import { Graph, layout } from \"@dagrejs/dagre\";\n\n/** Height of every node card, in pixels. */\nexport const DAG_NODE_HEIGHT = 24;\n/** Space before a node's label: left padding, 14px icon, and gap. */\nexport const DAG_LABEL_OFFSET = 26;\n/** Space before a node's label when it has no icon. */\nexport const DAG_LABEL_OFFSET_PLAIN = 8;\nconst LABEL_PADDING_END = 10;\n/** Narrowest node card, in pixels. */\nexport const DAG_MIN_NODE_WIDTH = 48;\n/** Widest node card, in pixels; longer labels are shortened with an ellipsis. */\nexport const DAG_MAX_NODE_WIDTH = 200;\nconst RANK_GAP = 90;\nconst NODE_GAP = 6;\nconst ELLIPSIS = \"…\";\n\n/** Flow direction of the layers: left to right or top to bottom. */\nexport type DagDirection = \"LR\" | \"TB\";\n\n/** Returns the rendered width of a label in pixels. */\nexport type MeasureText = (text: string) => number;\n\n/** Width estimate used when the browser cannot measure text (no 2D canvas). */\nexport const approximateTextWidth: MeasureText = (text) => text.length * 6.2;\n\n/** A point in layout coordinates. */\nexport interface DagPoint {\n x: number;\n y: number;\n}\n\n/** One node to lay out. */\nexport interface DagLayoutInput {\n id: string;\n label: string;\n /** Whether the node shows an icon before its label. */\n hasIcon: boolean;\n}\n\n/** A positioned node: centered at `(x, y)` and sized to its (possibly shortened) label. */\nexport interface DagLayoutNode extends DagPoint {\n id: string;\n width: number;\n label: string;\n}\n\n/** A routed edge; `backward` edges run against the flow direction and close a cycle. */\nexport interface DagLayoutEdge {\n source: string;\n target: string;\n points: DagPoint[];\n backward: boolean;\n}\n\n/** Positioned nodes and routed edges, in input-independent order. */\nexport interface DagLayout {\n nodes: DagLayoutNode[];\n edges: DagLayoutEdge[];\n}\n\n/** Shortens `text` with an ellipsis until it fits `maxWidth`. */\nexport function fitLabel(text: string, maxWidth: number, measure: MeasureText): string {\n if (measure(text) <= maxWidth) return text;\n let end = text.length - 1;\n while (end > 1 && measure(text.slice(0, end) + ELLIPSIS) > maxWidth) end -= 1;\n return text.slice(0, end) + ELLIPSIS;\n}\n\nfunction nodeSize(node: DagLayoutInput, measure: MeasureText): { label: string; width: number } {\n const offset = node.hasIcon ? DAG_LABEL_OFFSET : DAG_LABEL_OFFSET_PLAIN;\n const label = fitLabel(node.label, DAG_MAX_NODE_WIDTH - offset - LABEL_PADDING_END, measure);\n const width = Math.ceil(offset + measure(label) + LABEL_PADDING_END);\n return { label, width: Math.min(DAG_MAX_NODE_WIDTH, Math.max(DAG_MIN_NODE_WIDTH, width)) };\n}\n\n/**\n * Lays out a directed graph in layers (Sugiyama-style, via dagre) so every edge points along `direction`.\n *\n * Cycles are broken only to assign layers: every edge is returned, and the ones that close a cycle are marked\n * `backward`. Edges whose endpoints are not both in `nodes`, self-edges, and duplicates are ignored. The result\n * does not depend on input order.\n */\nexport function layoutDag(\n nodes: DagLayoutInput[],\n edges: Array<{ source: string; target: string }>,\n direction: DagDirection = \"LR\",\n measure: MeasureText = approximateTextWidth,\n): DagLayout {\n if (nodes.length === 0) return { nodes: [], edges: [] };\n const graph = new Graph();\n graph.setGraph({\n rankdir: direction,\n ranksep: RANK_GAP,\n nodesep: NODE_GAP,\n edgesep: 4,\n marginx: 0,\n marginy: 0,\n });\n graph.setDefaultEdgeLabel(() => ({}));\n const sorted = [...nodes].sort((a, b) => a.id.localeCompare(b.id));\n const sizes = new Map(sorted.map((node) => [node.id, nodeSize(node, measure)]));\n for (const node of sorted) {\n graph.setNode(node.id, { width: sizes.get(node.id)!.width, height: DAG_NODE_HEIGHT });\n }\n const known = new Set(sizes.keys());\n const unique = new Map(\n edges\n .filter((edge) => known.has(edge.source) && known.has(edge.target) && edge.source !== edge.target)\n .map((edge) => [`${edge.source}\\u0000${edge.target}`, { source: edge.source, target: edge.target }]),\n );\n const kept = [...unique.values()].sort(\n (a, b) => a.source.localeCompare(b.source) || a.target.localeCompare(b.target),\n );\n for (const edge of kept) graph.setEdge(edge.source, edge.target);\n layout(graph);\n const positioned = new Map(\n sorted.map((node) => {\n const { x, y } = graph.node(node.id) as DagPoint;\n return [node.id, { id: node.id, x, y, ...sizes.get(node.id)! }];\n }),\n );\n const axis = direction === \"LR\" ? \"x\" : \"y\";\n return {\n nodes: [...positioned.values()],\n edges: kept.map((edge) => ({\n ...edge,\n points: (graph.edge(edge.source, edge.target).points as DagPoint[]).map(({ x, y }) => ({ x, y })),\n backward: positioned.get(edge.target)![axis] < positioned.get(edge.source)![axis],\n })),\n };\n}\n"]}
|
|
@@ -18,6 +18,10 @@ Supports two suggestion sources:
|
|
|
18
18
|
request. Useful for small/fixed lists, offline use, or tests. Takes
|
|
19
19
|
priority over `endpoint` whenever it's non-null.
|
|
20
20
|
|
|
21
|
+
Each option may also carry a pre-rendered `icon` (shown before the value)
|
|
22
|
+
and a `description` (a smaller, muted line under the value); options
|
|
23
|
+
without them render as a plain value.
|
|
24
|
+
|
|
21
25
|
Set `clearable` to show an in-field clear action whenever a value is
|
|
22
26
|
present.
|
|
23
27
|
|
|
@@ -34,9 +38,12 @@ import "@f-ewald/components/autocomplete-input.js";
|
|
|
34
38
|
<autocomplete-input clearable name="language" placeholder="Start typing a language…"></autocomplete-input>
|
|
35
39
|
</form>
|
|
36
40
|
<script type="module">
|
|
37
|
-
|
|
41
|
+
import { iconGlobeAlt } from "@f-ewald/components/icons.js";
|
|
42
|
+
|
|
43
|
+
// Local mode: filters client-side, no network request. `icon` and
|
|
44
|
+
// `description` are optional.
|
|
38
45
|
document.querySelector("autocomplete-input").options = [
|
|
39
|
-
{ key: "ts", value: "TypeScript" },
|
|
46
|
+
{ key: "ts", value: "TypeScript", icon: iconGlobeAlt(14), description: "Typed superset of JavaScript" },
|
|
40
47
|
{ key: "py", value: "Python" },
|
|
41
48
|
];
|
|
42
49
|
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
# `<dag-graph>`
|
|
2
|
+
|
|
3
|
+
Interactive layered drawing of a directed graph — dependencies, pipelines, or any node-link data.
|
|
4
|
+
|
|
5
|
+
Nodes are placed in layers (via dagre) so edges flow left to right (or top to bottom with
|
|
6
|
+
`direction="TB"`); cycles are allowed, and the edges closing them are drawn dashed and point backward.
|
|
7
|
+
Each node is a compact card sized to its label, with an optional icon, color, and border style from
|
|
8
|
+
`kinds`. The whole graph is shown when it fits at a readable zoom; otherwise the selected node is centered at
|
|
9
|
+
100%. Drag to pan; pinch or Ctrl/⌘ + wheel to zoom (a plain wheel scrolls the page). With keyboard
|
|
10
|
+
focus on the graph, arrow keys pan, `+`/`-` zoom, and `0` fits the graph. Clicking a node, or pressing
|
|
11
|
+
Enter/Space on it, selects it. A toolbar in the top-right corner offers the `controls` you enable.
|
|
12
|
+
|
|
13
|
+
Set `static` to present a fixed picture: the graph is always fitted into view, panning and zooming
|
|
14
|
+
are off, and the toolbar is hidden; nodes can still be selected.
|
|
15
|
+
|
|
16
|
+
Colors can be changed with these custom properties: `--dag-node-background`, `--dag-node-text`,
|
|
17
|
+
`--dag-edge-color`, `--dag-selected-color`, and `--dag-highlight-color`; `--dag-graph-height` sets the
|
|
18
|
+
height (default `24rem`).
|
|
19
|
+
|
|
20
|
+
## Install
|
|
21
|
+
|
|
22
|
+
```js
|
|
23
|
+
import "@f-ewald/components/dag-graph.js";
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Usage
|
|
27
|
+
|
|
28
|
+
```html
|
|
29
|
+
<dag-graph legend selected="web"></dag-graph>
|
|
30
|
+
<script type="module">
|
|
31
|
+
import { iconBookOpen, iconCube, iconServer } from "@f-ewald/components/icons.js";
|
|
32
|
+
const graph = document.querySelector("dag-graph");
|
|
33
|
+
graph.kinds = {
|
|
34
|
+
service: { label: "Service", icon: iconServer, color: "#4269d0" },
|
|
35
|
+
library: { label: "Library", icon: iconBookOpen, color: "#3ca951" },
|
|
36
|
+
package: { label: "External package", icon: iconCube, color: "#9498a0", dashed: true },
|
|
37
|
+
};
|
|
38
|
+
graph.nodes = [
|
|
39
|
+
{ id: "web", label: "web", kind: "service" },
|
|
40
|
+
{ id: "auth", label: "auth-lib", kind: "library" },
|
|
41
|
+
{ id: "requests", label: "requests", kind: "package" },
|
|
42
|
+
];
|
|
43
|
+
graph.edges = [
|
|
44
|
+
{ source: "web", target: "auth" },
|
|
45
|
+
{ source: "auth", target: "requests" },
|
|
46
|
+
];
|
|
47
|
+
graph.addEventListener("node-select", (e) => console.log(e.detail.id));
|
|
48
|
+
</script>
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## Attributes / properties
|
|
52
|
+
|
|
53
|
+
| Property | Attribute | Type | Default | Description |
|
|
54
|
+
| --- | --- | --- | --- | --- |
|
|
55
|
+
| `nodes` | `nodes` | `DagNode[]` | `[]` | Nodes to draw. |
|
|
56
|
+
| `edges` | `edges` | `DagEdge[]` | `[]` | Directed edges between `nodes`; edges with an unknown endpoint or to the node itself are ignored. |
|
|
57
|
+
| `kinds` | _(JS property only)_ | `Record<string, DagNodeKind>` | `{}` | Presentation per node `kind`: legend label, color, icon, and border style. |
|
|
58
|
+
| `selected` | `selected` | `string | null` | `null` | Id of the selected node. Selecting a node updates it; when it changes to a node outside the visible area, the view follows. |
|
|
59
|
+
| `direction` | `direction` | `DagDirection` | `"LR"` | Layer direction: `LR` (left to right) or `TB` (top to bottom). |
|
|
60
|
+
| `label` | `label` | `string` | `"Directed graph"` | Accessible name of the graph; the node and edge counts are appended. |
|
|
61
|
+
| `legend` | `legend` | `boolean` | `false` | Shows a legend of `kinds` below the graph. |
|
|
62
|
+
| `controls` | `controls` | `string` | `"zoom fit center"` | Space-separated toolbar controls to show: any of `zoom`, `fit`, `center`, and `direction`, in that order. An empty value hides the toolbar. |
|
|
63
|
+
| `isStatic` | `static` | `boolean` | `false` | Presents a static picture: always fitted, with panning, zooming, and the toolbar turned off. |
|
|
64
|
+
|
|
65
|
+
## Events
|
|
66
|
+
|
|
67
|
+
| Event | Description |
|
|
68
|
+
| --- | --- |
|
|
69
|
+
| `direction-change` | The toolbar's direction control flipped `direction`; `detail` is `{ direction }`. |
|
|
70
|
+
| `node-select` | A node was clicked or activated with the keyboard; `detail` is `{ id }`. |
|
|
71
|
+
|
|
72
|
+
## Slots
|
|
73
|
+
|
|
74
|
+
_None._
|
|
75
|
+
|
|
76
|
+
## CSS custom properties
|
|
77
|
+
|
|
78
|
+
| Custom property |
|
|
79
|
+
| --- |
|
|
80
|
+
| `--ui-border` |
|
|
81
|
+
| `--ui-border-width` |
|
|
82
|
+
| `--ui-button-highlight` |
|
|
83
|
+
| `--ui-button-secondary-background` |
|
|
84
|
+
| `--ui-button-secondary-border` |
|
|
85
|
+
| `--ui-button-secondary-gloss-end` |
|
|
86
|
+
| `--ui-button-secondary-gloss-start` |
|
|
87
|
+
| `--ui-danger` |
|
|
88
|
+
| `--ui-focus-ring` |
|
|
89
|
+
| `--ui-font` |
|
|
90
|
+
| `--ui-font-size` |
|
|
91
|
+
| `--ui-font-size-sm` |
|
|
92
|
+
| `--ui-font-size-xs` |
|
|
93
|
+
| `--ui-primary` |
|
|
94
|
+
| `--ui-radius` |
|
|
95
|
+
| `--ui-radius-sm` |
|
|
96
|
+
| `--ui-shadow` |
|
|
97
|
+
| `--ui-surface` |
|
|
98
|
+
| `--ui-surface-muted` |
|
|
99
|
+
| `--ui-text` |
|
|
100
|
+
| `--ui-text-muted` |
|
|
101
|
+
| `--ui-warning` |
|
package/docs/data-table.md
CHANGED
|
@@ -5,6 +5,9 @@ and one `<tr>` per entry in `rows`, with each cell's content produced by
|
|
|
5
5
|
`renderCell` (default: plain property lookup on the row object). Knows
|
|
6
6
|
nothing about what a "row" means — callers own the data shape entirely.
|
|
7
7
|
|
|
8
|
+
Each column may add a decorative header `icon` and an `align` for its
|
|
9
|
+
header and cells (`end` right-aligns numbers, with tabular figures).
|
|
10
|
+
|
|
8
11
|
Optional `rowHref` makes whole rows clickable (navigating via `location.hash`),
|
|
9
12
|
without hijacking clicks on nested interactive elements (links/buttons) a
|
|
10
13
|
cell's rendered content might contain.
|
|
@@ -31,6 +34,21 @@ import "@f-ewald/components/data-table.js";
|
|
|
31
34
|
];
|
|
32
35
|
table.rowHref = (row) => `#/tasks/${row.id}`;
|
|
33
36
|
</script>
|
|
37
|
+
<data-table id="packages"></data-table>
|
|
38
|
+
<script type="module">
|
|
39
|
+
import { iconArrowLongRight } from "@f-ewald/components/icons.js";
|
|
40
|
+
|
|
41
|
+
// Header icons and alignment, e.g. right-aligned numbers.
|
|
42
|
+
const packages = document.getElementById("packages");
|
|
43
|
+
packages.columns = [
|
|
44
|
+
{ key: "name", label: "Package" },
|
|
45
|
+
{ key: "dependents", label: "Dependents", icon: iconArrowLongRight(14), align: "end" },
|
|
46
|
+
];
|
|
47
|
+
packages.rows = [
|
|
48
|
+
{ name: "requests", dependents: 1204 },
|
|
49
|
+
{ name: "attrs", dependents: 87 },
|
|
50
|
+
];
|
|
51
|
+
</script>
|
|
34
52
|
```
|
|
35
53
|
|
|
36
54
|
## Attributes / properties
|
package/docs/design-language.md
CHANGED
|
@@ -111,7 +111,10 @@ defines the details used when creating or reviewing components.
|
|
|
111
111
|
|
|
112
112
|
A themed gradient still paints over that base, so a theme overriding the
|
|
113
113
|
token behaves exactly as before; only the "token contributes nothing" case
|
|
114
|
-
changes.
|
|
114
|
+
changes. SVG fills can't paint a CSS gradient, so SVG surfaces that act as
|
|
115
|
+
secondary buttons (`dag-graph`'s nodes) build an SVG `linearGradient` from
|
|
116
|
+
`--ui-button-secondary-gloss-start`/`-end` instead — both default to
|
|
117
|
+
`--ui-surface`, a flat fill, and a gradient theme sets them to its stops. The layered form applies to `ui-button`'s `secondary` variant,
|
|
115
118
|
`confirm-dialog`'s Cancel, `button-group`'s unchecked segments,
|
|
116
119
|
`pagination-nav`'s buttons, `radio-cards`' unchecked cards, and the floating
|
|
117
120
|
`scroll-to-top`/`scroll-to-bottom`/`fullscreen-button` controls. Neither form
|
package/docs/icons.md
CHANGED
|
@@ -16,6 +16,8 @@ const icon = iconPencil(16); // 16px, defaults shown below if omitted
|
|
|
16
16
|
| --- | --- | --- |
|
|
17
17
|
| `iconAcademicCap` | 18px | Education, learning, or certification-related content. |
|
|
18
18
|
| `iconArrowDownTray` | 16px | Download or export actions. |
|
|
19
|
+
| `iconArrowLongDown` | 18px | A top-to-bottom flow or layout direction. |
|
|
20
|
+
| `iconArrowLongRight` | 18px | A left-to-right flow or layout direction. |
|
|
19
21
|
| `iconArrowPath` | 12px | Refresh actions, or an animated busy/loading spinner. |
|
|
20
22
|
| `iconArrowRight` | 12px | "Continue" or forward-progressing actions, e.g. a compact next-step arrow. |
|
|
21
23
|
| `iconArrowRightOnRectangle` | 16px | Logout/sign-out actions. |
|
|
@@ -24,6 +26,7 @@ const icon = iconPencil(16); // 16px, defaults shown below if omitted
|
|
|
24
26
|
| `iconArrowsRightLeft` | 16px | Swap, exchange, or compare actions between two items. |
|
|
25
27
|
| `iconArrowTopRightOnSquare` | 16px | Links that open in a new tab/window, or navigate to an external site. |
|
|
26
28
|
| `iconBars3` | 18px | A hamburger menu toggle, e.g. collapsing or opening a sidebar/nav drawer. |
|
|
29
|
+
| `iconBookOpen` | 20px | A library, documentation, or reading content, e.g. a library node in dag-graph. |
|
|
27
30
|
| `iconCalendar` | 16px | Dates, due dates, or calendar-related metadata. |
|
|
28
31
|
| `iconChatBubbleLeftRight` | 18px | Messaging, comments, or conversation-related content. |
|
|
29
32
|
| `iconCheckCircle` | 16px | Success states, confirmations, or a selected-item checkmark. |
|
|
@@ -38,6 +41,7 @@ const icon = iconPencil(16); // 16px, defaults shown below if omitted
|
|
|
38
41
|
| `iconCog` | 20px | Settings, preferences, or configuration entry points. |
|
|
39
42
|
| `iconComputerDesktop` | 16px | A "system/auto" theme option, or to represent a desktop device. |
|
|
40
43
|
| `iconCpuChip` | 18px | System, hardware, or technical/processing content. |
|
|
44
|
+
| `iconCube` | 20px | A package or self-contained artifact, e.g. an external package node in dag-graph. |
|
|
41
45
|
| `iconCurrencyDollar` | 16px | Monetary values, pricing, or billing-related content. |
|
|
42
46
|
| `iconDocument` | 18px | A generic file/document icon, e.g. tile-grid's default file icon. |
|
|
43
47
|
| `iconEllipsisHorizontal` | 16px | Collapsed items in an inline sequence, e.g. breadcrumb-nav's truncated middle. |
|
|
@@ -56,6 +60,8 @@ const icon = iconPencil(16); // 16px, defaults shown below if omitted
|
|
|
56
60
|
| `iconLink` | 16px | Hyperlink-related actions or a linked/associated-item indicator. |
|
|
57
61
|
| `iconListBullet` | 18px | A list-view toggle, or to represent list-type content. |
|
|
58
62
|
| `iconMagnifyingGlass` | 16px | Search inputs or search-triggering actions. |
|
|
63
|
+
| `iconMagnifyingGlassMinus` | 18px | Zoom out, e.g. dag-graph's toolbar. |
|
|
64
|
+
| `iconMagnifyingGlassPlus` | 18px | Zoom in, e.g. dag-graph's toolbar. |
|
|
59
65
|
| `iconMap` | 16px | A map-view toggle, or to represent map/geographic content. |
|
|
60
66
|
| `iconMapPin` | 16px | A location, address, or map marker. |
|
|
61
67
|
| `iconMoon` | 16px | A dark-theme toggle, or to represent night/dark mode. |
|
|
@@ -66,6 +72,7 @@ const icon = iconPencil(16); // 16px, defaults shown below if omitted
|
|
|
66
72
|
| `iconPuzzlePiece` | 18px | Plugins, integrations, or extensible/add-on features. |
|
|
67
73
|
| `iconQuestionMarkCircle` | 20px | Help, tooltips, or "learn more" affordances. |
|
|
68
74
|
| `iconQueueList` | 16px | Queues, backlogs, or ordered work-item lists. |
|
|
75
|
+
| `iconServer` | 20px | A running service or deployable, e.g. a service node in dag-graph. |
|
|
69
76
|
| `iconShieldCheck` | 16px | Verified, secure, or trusted states. |
|
|
70
77
|
| `iconShieldExclamation` | 16px | Security warnings, or at-risk/compromised states. |
|
|
71
78
|
| `iconSignal` | 16px | Live/real-time data, connectivity strength, or a traffic-conditions toggle. |
|
|
@@ -78,5 +85,6 @@ const icon = iconPencil(16); // 16px, defaults shown below if omitted
|
|
|
78
85
|
| `iconTrash` | 16px | Delete/remove actions, typically paired with a destructive/danger style. |
|
|
79
86
|
| `iconUserCircle` | 20px | A generic user/person fallback, e.g. user-avatar's icon fallback. |
|
|
80
87
|
| `iconUsers` | 18px | Teams, groups, or multi-user/collaboration content. |
|
|
88
|
+
| `iconViewfinderCircle` | 18px | Center or focus the view on the current selection, e.g. dag-graph's toolbar. |
|
|
81
89
|
| `iconWrenchScrewdriver` | 18px | Tools, maintenance, or build/configuration actions. |
|
|
82
90
|
| `iconX` | 18px | Close, dismiss, or clear (e.g. a modal, toast, or clearable input). |
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# `<kind-icon>`
|
|
2
|
+
|
|
3
|
+
Inline icon for a named kind (e.g. a service, a library, an external
|
|
4
|
+
package), looked up in a shared `kinds` map so tables, lists, and search
|
|
5
|
+
results show the same icon and color as a `dag-graph` legend. With
|
|
6
|
+
`show-label` the kind's label follows the icon as text; otherwise the
|
|
7
|
+
icon alone is exposed as an image named by the label. Renders nothing for
|
|
8
|
+
a kind missing from `kinds`.
|
|
9
|
+
|
|
10
|
+
## Install
|
|
11
|
+
|
|
12
|
+
```js
|
|
13
|
+
import "@f-ewald/components/kind-icon.js";
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Usage
|
|
17
|
+
|
|
18
|
+
```html
|
|
19
|
+
<kind-icon kind="service" show-label></kind-icon>
|
|
20
|
+
<kind-icon kind="package" size="18"></kind-icon>
|
|
21
|
+
<script type="module">
|
|
22
|
+
import { iconCube, iconServer } from "@f-ewald/components/icons.js";
|
|
23
|
+
|
|
24
|
+
const kinds = {
|
|
25
|
+
service: { label: "Service", icon: iconServer, color: "#4269d0" },
|
|
26
|
+
package: { label: "External package", icon: iconCube, color: "#9498a0" },
|
|
27
|
+
};
|
|
28
|
+
for (const el of document.querySelectorAll("kind-icon")) el.kinds = kinds;
|
|
29
|
+
</script>
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## Attributes / properties
|
|
33
|
+
|
|
34
|
+
| Property | Attribute | Type | Default | Description |
|
|
35
|
+
| --- | --- | --- | --- | --- |
|
|
36
|
+
| `kind` | `kind` | `string` | `""` | Key of the kind to show, looked up in `kinds`. |
|
|
37
|
+
| `kinds` | _(JS property only)_ | `Record<string, KindIconStyle>` | `{}` | Presentation per kind: label, color, and icon. Shareable with `dag-graph`'s `kinds`. |
|
|
38
|
+
| `size` | `size` | `14 | 18` | `14` | Square icon size in pixels: 14 inline, 18 standalone. |
|
|
39
|
+
| `showLabel` | `show-label` | `boolean` | `false` | Shows the kind's label as text after the icon. |
|
|
40
|
+
|
|
41
|
+
## Events
|
|
42
|
+
|
|
43
|
+
_None._
|
|
44
|
+
|
|
45
|
+
## Slots
|
|
46
|
+
|
|
47
|
+
_None._
|
|
48
|
+
|
|
49
|
+
## CSS custom properties
|
|
50
|
+
|
|
51
|
+
| Custom property |
|
|
52
|
+
| --- |
|
|
53
|
+
| `--ui-primary` |
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
# `<ui-tooltip>`
|
|
2
|
+
|
|
3
|
+
Hover and focus tooltip for its default-slot trigger. The `content` slot
|
|
4
|
+
holds the tooltip body — plain text or rich markup such as a list. It
|
|
5
|
+
appears after `show-delay` on hover and at once on keyboard focus, stays
|
|
6
|
+
open while the pointer is over the tooltip itself, and closes on Escape,
|
|
7
|
+
blur, or when the pointer leaves. It renders in the top layer, so
|
|
8
|
+
scrolling or `overflow: hidden` ancestors never clip it.
|
|
9
|
+
|
|
10
|
+
The trigger is described by the content (`aria-describedby`). A trigger
|
|
11
|
+
with nothing focusable inside (e.g. plain text) makes the tooltip host
|
|
12
|
+
focusable so keyboard users can reach the description too. ARIA references
|
|
13
|
+
can't cross shadow roots, so when the trigger is a custom element whose
|
|
14
|
+
focusable control lives in its own shadow root, screen readers won't
|
|
15
|
+
announce the description on focus; prefer a native trigger such as
|
|
16
|
+
`<button>` when that matters.
|
|
17
|
+
|
|
18
|
+
## Install
|
|
19
|
+
|
|
20
|
+
```js
|
|
21
|
+
import "@f-ewald/components/ui-tooltip.js";
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Usage
|
|
25
|
+
|
|
26
|
+
```html
|
|
27
|
+
<ui-tooltip>
|
|
28
|
+
<button type="button">Copy link</button>
|
|
29
|
+
<span slot="content">Copies a shareable link to this view</span>
|
|
30
|
+
</ui-tooltip>
|
|
31
|
+
<!-- Plain-text trigger: the tooltip becomes focusable; rich content is fine -->
|
|
32
|
+
<ui-tooltip placement="bottom" show-delay="0">
|
|
33
|
+
<span>Partial snapshot</span>
|
|
34
|
+
<div slot="content">3 work items pending: <ul><li>mp:lap-service</li></ul></div>
|
|
35
|
+
</ui-tooltip>
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Attributes / properties
|
|
39
|
+
|
|
40
|
+
| Property | Attribute | Type | Default | Description |
|
|
41
|
+
| --- | --- | --- | --- | --- |
|
|
42
|
+
| `placement` | `placement` | `UiTooltipPlacement` | `"top"` | Preferred side of the trigger; flips to the other side when this one lacks room. |
|
|
43
|
+
| `showDelay` | `show-delay` | `number` | `300` | Hover delay in milliseconds before the tooltip appears; keyboard focus shows it at once. |
|
|
44
|
+
| `disabled` | `disabled` | `boolean` | `false` | Suppresses the tooltip and closes it if open. |
|
|
45
|
+
| `open` | _(JS property only)_ | `boolean` | `—` | Whether the tooltip is currently showing. _(read-only)_ |
|
|
46
|
+
|
|
47
|
+
## Events
|
|
48
|
+
|
|
49
|
+
_None._
|
|
50
|
+
|
|
51
|
+
## Slots
|
|
52
|
+
|
|
53
|
+
| Slot | Description |
|
|
54
|
+
| --- | --- |
|
|
55
|
+
| `(default)` | The trigger the tooltip describes. |
|
|
56
|
+
| `content` | The tooltip body: plain text or rich markup such as a list. |
|
|
57
|
+
|
|
58
|
+
## CSS custom properties
|
|
59
|
+
|
|
60
|
+
| Custom property |
|
|
61
|
+
| --- |
|
|
62
|
+
| `--ui-focus-ring` |
|
|
63
|
+
| `--ui-font` |
|
|
64
|
+
| `--ui-font-size-sm` |
|
|
65
|
+
| `--ui-font-weight-regular` |
|
|
66
|
+
| `--ui-line-height-tight` |
|
|
67
|
+
| `--ui-radius-sm` |
|
|
68
|
+
| `--ui-shadow` |
|
|
69
|
+
| `--ui-tooltip` |
|
|
70
|
+
| `--ui-tooltip-text` |
|