@xmesh/system-design 0.0.2 → 0.0.4
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/dist/lit/components/alert/index.d.ts +1 -1
- package/dist/lit/components/alert/index.js +1 -0
- package/dist/lit/components/app-bar/index.d.ts +1 -1
- package/dist/lit/components/app-bar/index.js +1 -0
- package/dist/lit/components/artifact/index.d.ts +1 -1
- package/dist/lit/components/artifact/index.js +16 -2
- package/dist/lit/components/avatar/index.d.ts +1 -1
- package/dist/lit/components/avatar/index.js +1 -0
- package/dist/lit/components/avatar-group/index.d.ts +1 -1
- package/dist/lit/components/avatar-group/index.js +1 -0
- package/dist/lit/components/badge/index.d.ts +1 -2
- package/dist/lit/components/badge/index.js +1 -0
- package/dist/lit/components/brand-mark/index.d.ts +2 -2
- package/dist/lit/components/brand-mark/index.js +14 -0
- package/dist/lit/components/breadcrumbs/index.d.ts +1 -1
- package/dist/lit/components/breadcrumbs/index.js +1 -0
- package/dist/lit/components/bubble/index.d.ts +4 -4
- package/dist/lit/components/bubble/index.js +18 -0
- package/dist/lit/components/button/index.d.ts +1 -1
- package/dist/lit/components/button/index.js +1 -0
- package/dist/lit/components/card/index.d.ts +1 -1
- package/dist/lit/components/card/index.js +1 -0
- package/dist/lit/components/chat/index.d.ts +1 -2
- package/dist/lit/components/chat/index.js +16 -2
- package/dist/lit/components/checkbox/index.d.ts +1 -2
- package/dist/lit/components/checkbox/index.js +1 -0
- package/dist/lit/components/chip/index.d.ts +1 -1
- package/dist/lit/components/chip/index.js +1 -0
- package/dist/lit/components/chip-group/index.d.ts +1 -1
- package/dist/lit/components/chip-group/index.js +1 -0
- package/dist/lit/components/code/index.d.ts +1 -2
- package/dist/lit/components/code/index.js +1 -0
- package/dist/lit/components/composer/index.d.ts +1 -2
- package/dist/lit/components/composer/index.js +14 -0
- package/dist/lit/components/date-range/index.css +324 -0
- package/dist/lit/components/date-range/index.d.ts +57 -0
- package/dist/lit/components/date-range/index.js +702 -0
- package/dist/lit/components/divider/index.d.ts +1 -1
- package/dist/lit/components/divider/index.js +1 -0
- package/dist/lit/components/expansion-panel/index.d.ts +1 -2
- package/dist/lit/components/expansion-panel/index.js +1 -0
- package/dist/lit/components/grid/index.d.ts +1 -1
- package/dist/lit/components/grid/index.js +1 -0
- package/dist/lit/components/kbd/index.d.ts +1 -2
- package/dist/lit/components/kbd/index.js +1 -0
- package/dist/lit/components/list/index.d.ts +1 -1
- package/dist/lit/components/list/index.js +1 -0
- package/dist/lit/components/list-item/index.d.ts +1 -2
- package/dist/lit/components/list-item/index.js +1 -0
- package/dist/lit/components/navigation-drawer/index.d.ts +1 -2
- package/dist/lit/components/navigation-drawer/index.js +1 -0
- package/dist/lit/components/pagination/index.d.ts +1 -1
- package/dist/lit/components/pagination/index.js +1 -0
- package/dist/lit/components/popover/index.css +34 -0
- package/dist/lit/components/popover/index.d.ts +29 -0
- package/dist/lit/components/popover/index.js +204 -0
- package/dist/lit/components/primitives/index.d.ts +2 -2
- package/dist/lit/components/primitives/index.js +14 -0
- package/dist/lit/components/sidebar-item/index.d.ts +1 -1
- package/dist/lit/components/sidebar-item/index.js +13 -0
- package/dist/lit/components/snackbar/index.d.ts +1 -2
- package/dist/lit/components/snackbar/index.js +16 -2
- package/dist/lit/components/stack/index.d.ts +1 -1
- package/dist/lit/components/stack/index.js +1 -0
- package/dist/lit/components/table/index.d.ts +1 -2
- package/dist/lit/components/table/index.js +5 -9
- package/dist/lit/components/tabs/index.d.ts +3 -3
- package/dist/lit/components/tabs/index.js +3 -0
- package/dist/lit/components/validation/index.d.ts +1 -2
- package/dist/lit/components/validation/index.js +16 -1
- package/dist/lit/index.d.ts +2 -0
- package/dist/lit/index.js +2 -0
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { LitElement } from "lit";
|
|
2
2
|
import type { TemplateResult } from "lit";
|
|
3
3
|
type DividerOrientation = "horizontal" | "vertical";
|
|
4
|
-
declare class XmDivider extends LitElement {
|
|
4
|
+
export declare class XmDivider extends LitElement {
|
|
5
5
|
orientation: DividerOrientation;
|
|
6
6
|
render(): TemplateResult;
|
|
7
7
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { LitElement } from "lit";
|
|
2
2
|
import type { TemplateResult } from "lit";
|
|
3
|
-
declare class XmExpansionPanel extends LitElement {
|
|
3
|
+
export declare class XmExpansionPanel extends LitElement {
|
|
4
4
|
open: boolean;
|
|
5
5
|
heading: string;
|
|
6
6
|
disabled: boolean;
|
|
@@ -19,4 +19,3 @@ declare global {
|
|
|
19
19
|
"xm-expansion-panel": XmExpansionPanel;
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
|
-
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { LitElement } from "lit";
|
|
2
2
|
import type { TemplateResult } from "lit";
|
|
3
3
|
type GridGap = "none" | "xs" | "sm" | "md" | "lg" | "xl";
|
|
4
|
-
declare class XmGrid extends LitElement {
|
|
4
|
+
export declare class XmGrid extends LitElement {
|
|
5
5
|
columns: number;
|
|
6
6
|
gap: GridGap;
|
|
7
7
|
render(): TemplateResult;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { LitElement } from "lit";
|
|
2
2
|
import type { TemplateResult } from "lit";
|
|
3
|
-
declare class XmKbd extends LitElement {
|
|
3
|
+
export declare class XmKbd extends LitElement {
|
|
4
4
|
render(): TemplateResult;
|
|
5
5
|
}
|
|
6
6
|
declare global {
|
|
@@ -8,4 +8,3 @@ declare global {
|
|
|
8
8
|
"xm-kbd": XmKbd;
|
|
9
9
|
}
|
|
10
10
|
}
|
|
11
|
-
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { LitElement } from "lit";
|
|
2
2
|
import type { TemplateResult } from "lit";
|
|
3
3
|
type Primitive = string | number;
|
|
4
|
-
declare class XmList extends LitElement {
|
|
4
|
+
export declare class XmList extends LitElement {
|
|
5
5
|
interactive: boolean;
|
|
6
6
|
selectable: boolean;
|
|
7
7
|
value: Primitive | null;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { LitElement } from "lit";
|
|
2
2
|
import type { TemplateResult } from "lit";
|
|
3
|
-
declare class XmListItem extends LitElement {
|
|
3
|
+
export declare class XmListItem extends LitElement {
|
|
4
4
|
value: string;
|
|
5
5
|
selected: boolean;
|
|
6
6
|
disabled: boolean;
|
|
@@ -17,4 +17,3 @@ declare global {
|
|
|
17
17
|
"xm-list-item": XmListItem;
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
|
-
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { LitElement } from "lit";
|
|
2
2
|
import type { PropertyValues, TemplateResult } from "lit";
|
|
3
|
-
declare class XmNavigationDrawer extends LitElement {
|
|
3
|
+
export declare class XmNavigationDrawer extends LitElement {
|
|
4
4
|
static shadowRootOptions: ShadowRootInit;
|
|
5
5
|
open: boolean;
|
|
6
6
|
collapsed: boolean;
|
|
@@ -26,4 +26,3 @@ declare global {
|
|
|
26
26
|
"xm-navigation-drawer": XmNavigationDrawer;
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
|
-
export {};
|
|
@@ -4,7 +4,7 @@ type PaginationSize = "xs" | "sm" | "md" | "lg";
|
|
|
4
4
|
export interface PaginationPageChangeDetail {
|
|
5
5
|
page: number;
|
|
6
6
|
}
|
|
7
|
-
declare class XmPagination extends LitElement {
|
|
7
|
+
export declare class XmPagination extends LitElement {
|
|
8
8
|
page: number;
|
|
9
9
|
total: number;
|
|
10
10
|
siblings: number;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/* ============================================
|
|
2
|
+
Popover — a click-triggered anchored panel of arbitrary content.
|
|
3
|
+
|
|
4
|
+
The popover surface chrome (inverse-surface fill, inverse-on-surface ink,
|
|
5
|
+
hairline border, level3 elevation, edge-flip, open/close motion) is owned by
|
|
6
|
+
the composed <xm-overlay> in the `menu` tier. This file styles only the
|
|
7
|
+
trigger wrapper and the content panel that rides inside the overlay body.
|
|
8
|
+
|
|
9
|
+
All ink is inverse-on-surface (AD-13) — the popover/card stack ink. The panel
|
|
10
|
+
is role="dialog" and receives initial focus, so its focus outline is
|
|
11
|
+
suppressed (the moved-in focus is the affordance, not a ring on the box).
|
|
12
|
+
|
|
13
|
+
BEM block: `popover`. Registered in scripts/check-bem.sh STRICT_BLOCKS.
|
|
14
|
+
Elements: popover__trigger, popover__panel.
|
|
15
|
+
============================================ */
|
|
16
|
+
|
|
17
|
+
.popover__trigger {
|
|
18
|
+
display: inline-flex;
|
|
19
|
+
align-items: center;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.popover__panel {
|
|
23
|
+
display: flex;
|
|
24
|
+
flex-direction: column;
|
|
25
|
+
gap: var(--s-2);
|
|
26
|
+
min-width: 180px;
|
|
27
|
+
color: var(--md-sys-color-inverse-on-surface);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/* role="dialog" + tabindex=-1: we move focus here on open, so the box itself
|
|
31
|
+
never shows a focus ring — interactive children own their own focus states. */
|
|
32
|
+
.popover__panel:focus {
|
|
33
|
+
outline: none;
|
|
34
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { LitElement } from "lit";
|
|
2
|
+
import type { TemplateResult } from "lit";
|
|
3
|
+
import type { OverlayPlacement } from "../overlay/index.js";
|
|
4
|
+
export declare class XmPopover extends LitElement {
|
|
5
|
+
open: boolean;
|
|
6
|
+
placement: OverlayPlacement;
|
|
7
|
+
label: string;
|
|
8
|
+
private _overlay;
|
|
9
|
+
private _panel;
|
|
10
|
+
private _triggerWrap;
|
|
11
|
+
private readonly _panelId;
|
|
12
|
+
private _closeReason;
|
|
13
|
+
private _wasOpen;
|
|
14
|
+
connectedCallback(): void;
|
|
15
|
+
disconnectedCallback(): void;
|
|
16
|
+
render(): TemplateResult;
|
|
17
|
+
private _onTriggerClick;
|
|
18
|
+
private _onDocPointer;
|
|
19
|
+
private _onOverlayClose;
|
|
20
|
+
private _requestClose;
|
|
21
|
+
protected updated(changed: Map<string, unknown>): void;
|
|
22
|
+
private get _triggerEl();
|
|
23
|
+
private _wireTriggerAria;
|
|
24
|
+
}
|
|
25
|
+
declare global {
|
|
26
|
+
interface HTMLElementTagNameMap {
|
|
27
|
+
"xm-popover": XmPopover;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
/*
|
|
2
|
+
popover/index.ts — <xm-popover>, a click-triggered anchored panel of
|
|
3
|
+
arbitrary content.
|
|
4
|
+
|
|
5
|
+
The generalized sibling of <xm-menu>: where the menu projects a list of
|
|
6
|
+
<xm-menu-item> children and owns the APG `menu` roving model, the popover
|
|
7
|
+
projects ANY content (a column toggle list, a small form, a filter panel) and
|
|
8
|
+
leaves interaction to that content. Both compose the same xm-overlay
|
|
9
|
+
foundation (Story 1.4) for anchored positioning, top-layer stacking, Esc
|
|
10
|
+
dismissal, and focus-restore — neither hand-rolls z-index or anchoring math.
|
|
11
|
+
We drive the overlay through its PUBLIC API only (mode / tier / placement /
|
|
12
|
+
.anchor / .opener / show / hide / xm-overlay-close) and never reach into its
|
|
13
|
+
shadow root (AD-12).
|
|
14
|
+
|
|
15
|
+
Behaviour:
|
|
16
|
+
• clicking the trigger opens an anchored panel; clicking it again, clicking
|
|
17
|
+
outside, or Esc closes it
|
|
18
|
+
• the panel is role="dialog" and takes initial focus on open; focus
|
|
19
|
+
restores to the trigger on close (delegated to the overlay via .opener)
|
|
20
|
+
• outside-click dismiss is owned here: the overlay runs popover="manual"
|
|
21
|
+
(no native light-dismiss) so a click whose composed path excludes this
|
|
22
|
+
host closes the panel
|
|
23
|
+
|
|
24
|
+
Events (AD-8 / AD-8a, tier (b) — component-specific signals):
|
|
25
|
+
xm-popover-open detail: {}
|
|
26
|
+
xm-popover-close detail: { reason } reason ∈ "trigger"|"outside"|"overlay"
|
|
27
|
+
both bubbles:true, composed:true.
|
|
28
|
+
|
|
29
|
+
Authoring:
|
|
30
|
+
<xm-popover placement="bottom-end" label="Columns">
|
|
31
|
+
<xm-button slot="trigger" variant="ghost" size="sm">Columns</xm-button>
|
|
32
|
+
<div class="my-panel">…arbitrary content…</div>
|
|
33
|
+
</xm-popover>
|
|
34
|
+
|
|
35
|
+
Shadow DOM. Depends on xm-overlay + tokens (AD-12). Lit is a bare `import`.
|
|
36
|
+
*/
|
|
37
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
38
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
39
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
40
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
41
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
42
|
+
};
|
|
43
|
+
import { LitElement, html } from "lit";
|
|
44
|
+
import { customElement, property, query } from "lit/decorators.js";
|
|
45
|
+
const POPOVER_CSS = new URL("../popover/index.css", import.meta.url).href;
|
|
46
|
+
let popoverSeq = 0;
|
|
47
|
+
let XmPopover = class XmPopover extends LitElement {
|
|
48
|
+
constructor() {
|
|
49
|
+
super(...arguments);
|
|
50
|
+
this.open = false;
|
|
51
|
+
this.placement = "bottom-start";
|
|
52
|
+
this.label = "";
|
|
53
|
+
this._panelId = `xm-popover-${++popoverSeq}`;
|
|
54
|
+
this._closeReason = "api";
|
|
55
|
+
this._wasOpen = false;
|
|
56
|
+
// ── Open / close ──────────────────────────────────────────────────────
|
|
57
|
+
this._onTriggerClick = () => {
|
|
58
|
+
if (this.open)
|
|
59
|
+
this._requestClose("trigger");
|
|
60
|
+
else
|
|
61
|
+
this.open = true;
|
|
62
|
+
};
|
|
63
|
+
this._onDocPointer = (e) => {
|
|
64
|
+
if (!this.open)
|
|
65
|
+
return;
|
|
66
|
+
if (!e.composedPath().includes(this))
|
|
67
|
+
this._requestClose("outside");
|
|
68
|
+
};
|
|
69
|
+
this._onOverlayClose = () => {
|
|
70
|
+
// Overlay self-dismissed (Esc); reflect it into our state. updated() owns
|
|
71
|
+
// the single overlay hide + xm-popover-close emission.
|
|
72
|
+
if (this.open)
|
|
73
|
+
this._requestClose("escape");
|
|
74
|
+
};
|
|
75
|
+
this._wireTriggerAria = (e) => {
|
|
76
|
+
const slot = e.target;
|
|
77
|
+
const el = slot.assignedElements()[0];
|
|
78
|
+
if (el) {
|
|
79
|
+
el.setAttribute("aria-haspopup", "dialog");
|
|
80
|
+
el.setAttribute("aria-expanded", this.open ? "true" : "false");
|
|
81
|
+
el.setAttribute("aria-controls", this._panelId);
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
connectedCallback() {
|
|
86
|
+
super.connectedCallback();
|
|
87
|
+
document.addEventListener("pointerdown", this._onDocPointer, true);
|
|
88
|
+
}
|
|
89
|
+
disconnectedCallback() {
|
|
90
|
+
super.disconnectedCallback();
|
|
91
|
+
document.removeEventListener("pointerdown", this._onDocPointer, true);
|
|
92
|
+
}
|
|
93
|
+
render() {
|
|
94
|
+
return html `
|
|
95
|
+
<link rel="stylesheet" href="${POPOVER_CSS}" />
|
|
96
|
+
<style>
|
|
97
|
+
:host { display: inline-flex; }
|
|
98
|
+
</style>
|
|
99
|
+
<span class="popover__trigger" @click=${this._onTriggerClick}>
|
|
100
|
+
<slot name="trigger" @slotchange=${this._wireTriggerAria}></slot>
|
|
101
|
+
</span>
|
|
102
|
+
|
|
103
|
+
<xm-overlay
|
|
104
|
+
mode="non-modal"
|
|
105
|
+
tier="menu"
|
|
106
|
+
placement=${this.placement}
|
|
107
|
+
label=${this.label || "Popover"}
|
|
108
|
+
@xm-overlay-close=${this._onOverlayClose}
|
|
109
|
+
>
|
|
110
|
+
<div
|
|
111
|
+
class="popover__panel"
|
|
112
|
+
id=${this._panelId}
|
|
113
|
+
role="dialog"
|
|
114
|
+
aria-label=${this.label || "Popover"}
|
|
115
|
+
tabindex="-1"
|
|
116
|
+
>
|
|
117
|
+
<slot></slot>
|
|
118
|
+
</div>
|
|
119
|
+
</xm-overlay>
|
|
120
|
+
`;
|
|
121
|
+
}
|
|
122
|
+
// Record the reason and flip `open`; the actual overlay hide + the single
|
|
123
|
+
// xm-popover-close emission happen in updated(), so every close path
|
|
124
|
+
// (trigger, outside, Esc, programmatic open=false) is one code path that
|
|
125
|
+
// fires exactly once.
|
|
126
|
+
_requestClose(reason) {
|
|
127
|
+
if (!this.open)
|
|
128
|
+
return;
|
|
129
|
+
this._closeReason = reason;
|
|
130
|
+
this.open = false;
|
|
131
|
+
}
|
|
132
|
+
updated(changed) {
|
|
133
|
+
if (!changed.has("open"))
|
|
134
|
+
return;
|
|
135
|
+
const ov = this._overlay;
|
|
136
|
+
const trigger = this._triggerEl;
|
|
137
|
+
if (this.open) {
|
|
138
|
+
if (ov && trigger) {
|
|
139
|
+
ov.anchor = trigger;
|
|
140
|
+
ov.opener = trigger;
|
|
141
|
+
ov.show();
|
|
142
|
+
// Land focus in the panel so the content is reachable; the overlay
|
|
143
|
+
// restores focus to the trigger on close.
|
|
144
|
+
requestAnimationFrame(() => {
|
|
145
|
+
if (this.open)
|
|
146
|
+
this._panel?.focus();
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
this._wasOpen = true;
|
|
150
|
+
this.dispatchEvent(new CustomEvent("xm-popover-open", {
|
|
151
|
+
bubbles: true,
|
|
152
|
+
composed: true,
|
|
153
|
+
detail: {},
|
|
154
|
+
}));
|
|
155
|
+
}
|
|
156
|
+
else {
|
|
157
|
+
if (ov?.open)
|
|
158
|
+
ov.hide("api");
|
|
159
|
+
// Guard the initial render (open=false from the start) so it never emits
|
|
160
|
+
// a phantom close; only a real open→close transition fires the event.
|
|
161
|
+
if (this._wasOpen) {
|
|
162
|
+
this._wasOpen = false;
|
|
163
|
+
this.dispatchEvent(new CustomEvent("xm-popover-close", {
|
|
164
|
+
bubbles: true,
|
|
165
|
+
composed: true,
|
|
166
|
+
detail: { reason: this._closeReason },
|
|
167
|
+
}));
|
|
168
|
+
}
|
|
169
|
+
this._closeReason = "api";
|
|
170
|
+
}
|
|
171
|
+
if (trigger) {
|
|
172
|
+
trigger.setAttribute("aria-expanded", this.open ? "true" : "false");
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
// Prefer the slotted trigger; fall back to the wrapper so an `open` set before
|
|
176
|
+
// the trigger element is assigned still anchors + shows (no stuck state with
|
|
177
|
+
// aria-expanded="true" and no panel).
|
|
178
|
+
get _triggerEl() {
|
|
179
|
+
const slot = this.renderRoot.querySelector('slot[name="trigger"]');
|
|
180
|
+
return (slot?.assignedElements()[0] ?? this._triggerWrap ?? null);
|
|
181
|
+
}
|
|
182
|
+
};
|
|
183
|
+
__decorate([
|
|
184
|
+
property({ type: Boolean, reflect: true })
|
|
185
|
+
], XmPopover.prototype, "open", void 0);
|
|
186
|
+
__decorate([
|
|
187
|
+
property({ type: String })
|
|
188
|
+
], XmPopover.prototype, "placement", void 0);
|
|
189
|
+
__decorate([
|
|
190
|
+
property({ type: String })
|
|
191
|
+
], XmPopover.prototype, "label", void 0);
|
|
192
|
+
__decorate([
|
|
193
|
+
query("xm-overlay")
|
|
194
|
+
], XmPopover.prototype, "_overlay", void 0);
|
|
195
|
+
__decorate([
|
|
196
|
+
query(".popover__panel")
|
|
197
|
+
], XmPopover.prototype, "_panel", void 0);
|
|
198
|
+
__decorate([
|
|
199
|
+
query(".popover__trigger")
|
|
200
|
+
], XmPopover.prototype, "_triggerWrap", void 0);
|
|
201
|
+
XmPopover = __decorate([
|
|
202
|
+
customElement("xm-popover")
|
|
203
|
+
], XmPopover);
|
|
204
|
+
export { XmPopover };
|
|
@@ -3,7 +3,7 @@ import type { TemplateResult } from "lit";
|
|
|
3
3
|
declare class LightElement extends LitElement {
|
|
4
4
|
createRenderRoot(): HTMLElement | DocumentFragment;
|
|
5
5
|
}
|
|
6
|
-
declare class XmIcon extends LightElement {
|
|
6
|
+
export declare class XmIcon extends LightElement {
|
|
7
7
|
size: number;
|
|
8
8
|
viewBox: string;
|
|
9
9
|
strokeWidth: number;
|
|
@@ -11,7 +11,7 @@ declare class XmIcon extends LightElement {
|
|
|
11
11
|
title: string;
|
|
12
12
|
render(): TemplateResult;
|
|
13
13
|
}
|
|
14
|
-
declare class XmSpinner extends LightElement {
|
|
14
|
+
export declare class XmSpinner extends LightElement {
|
|
15
15
|
size: number;
|
|
16
16
|
className: string;
|
|
17
17
|
render(): TemplateResult;
|
|
@@ -22,6 +22,18 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
22
22
|
};
|
|
23
23
|
import { LitElement, html, svg, nothing } from "lit";
|
|
24
24
|
import { customElement, property } from "lit/decorators.js";
|
|
25
|
+
if (typeof document !== "undefined") {
|
|
26
|
+
for (const href of [
|
|
27
|
+
new URL("../primitives/index.css", import.meta.url).href,
|
|
28
|
+
]) {
|
|
29
|
+
if (document.querySelector(`link[rel="stylesheet"][href="${href}"]`))
|
|
30
|
+
continue;
|
|
31
|
+
const link = document.createElement("link");
|
|
32
|
+
link.rel = "stylesheet";
|
|
33
|
+
link.href = href;
|
|
34
|
+
document.head.appendChild(link);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
25
37
|
class LightElement extends LitElement {
|
|
26
38
|
createRenderRoot() {
|
|
27
39
|
return this;
|
|
@@ -84,6 +96,7 @@ __decorate([
|
|
|
84
96
|
XmIcon = __decorate([
|
|
85
97
|
customElement("xm-icon")
|
|
86
98
|
], XmIcon);
|
|
99
|
+
export { XmIcon };
|
|
87
100
|
/* ─────────────────────────────────────────────────────────────
|
|
88
101
|
<xm-spinner> — circular indeterminate spinner. Used by Button
|
|
89
102
|
for the loading state. Mirrors Spinner({ size }) in the JSX:
|
|
@@ -116,6 +129,7 @@ __decorate([
|
|
|
116
129
|
XmSpinner = __decorate([
|
|
117
130
|
customElement("xm-spinner")
|
|
118
131
|
], XmSpinner);
|
|
132
|
+
export { XmSpinner };
|
|
119
133
|
const namedIcon = (tag, defaults, paths) => {
|
|
120
134
|
class NamedIcon extends LightElement {
|
|
121
135
|
constructor() {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { LitElement } from "lit";
|
|
2
2
|
import type { TemplateResult } from "lit";
|
|
3
3
|
type SidebarLayout = "row" | "stacked";
|
|
4
|
-
declare class XmSidebarItem extends LitElement {
|
|
4
|
+
export declare class XmSidebarItem extends LitElement {
|
|
5
5
|
title: string;
|
|
6
6
|
layout: SidebarLayout;
|
|
7
7
|
active: boolean;
|
|
@@ -26,6 +26,18 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
26
26
|
};
|
|
27
27
|
import { LitElement, html } from "lit";
|
|
28
28
|
import { customElement, property } from "lit/decorators.js";
|
|
29
|
+
if (typeof document !== "undefined") {
|
|
30
|
+
for (const href of [
|
|
31
|
+
new URL("../sidebar-item/index.css", import.meta.url).href,
|
|
32
|
+
]) {
|
|
33
|
+
if (document.querySelector(`link[rel="stylesheet"][href="${href}"]`))
|
|
34
|
+
continue;
|
|
35
|
+
const link = document.createElement("link");
|
|
36
|
+
link.rel = "stylesheet";
|
|
37
|
+
link.href = href;
|
|
38
|
+
document.head.appendChild(link);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
29
41
|
let XmSidebarItem = class XmSidebarItem extends LitElement {
|
|
30
42
|
constructor() {
|
|
31
43
|
super(...arguments);
|
|
@@ -103,3 +115,4 @@ __decorate([
|
|
|
103
115
|
XmSidebarItem = __decorate([
|
|
104
116
|
customElement("xm-sidebar-item")
|
|
105
117
|
], XmSidebarItem);
|
|
118
|
+
export { XmSidebarItem };
|
|
@@ -10,7 +10,7 @@ export interface SnackPreset {
|
|
|
10
10
|
secondaryLabel: string;
|
|
11
11
|
}
|
|
12
12
|
export declare const SNACK_PRESETS: Record<SnackKind, SnackPreset>;
|
|
13
|
-
declare class XmSnackbar extends LitElement {
|
|
13
|
+
export declare class XmSnackbar extends LitElement {
|
|
14
14
|
kind: SnackKind;
|
|
15
15
|
code: string;
|
|
16
16
|
title: string;
|
|
@@ -30,4 +30,3 @@ declare global {
|
|
|
30
30
|
"xm-snackbar": XmSnackbar;
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
|
-
export {};
|
|
@@ -20,8 +20,8 @@
|
|
|
20
20
|
snackbar-primary — primary action clicked (Retry / Open settings)
|
|
21
21
|
snackbar-dismiss — secondary/dismiss action clicked
|
|
22
22
|
|
|
23
|
-
Light DOM.
|
|
24
|
-
|
|
23
|
+
Light DOM. This module appends its stylesheets (snackbar + primitives) to
|
|
24
|
+
document.head on import.
|
|
25
25
|
|
|
26
26
|
SNACK_PRESETS is also exported so previews can spread a preset onto
|
|
27
27
|
the element via JS.
|
|
@@ -34,6 +34,19 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
34
34
|
};
|
|
35
35
|
import { LitElement, html, svg, nothing } from "lit";
|
|
36
36
|
import { customElement, property } from "lit/decorators.js";
|
|
37
|
+
if (typeof document !== "undefined") {
|
|
38
|
+
for (const href of [
|
|
39
|
+
new URL("../snackbar/index.css", import.meta.url).href,
|
|
40
|
+
new URL("../primitives/index.css", import.meta.url).href,
|
|
41
|
+
]) {
|
|
42
|
+
if (document.querySelector(`link[rel="stylesheet"][href="${href}"]`))
|
|
43
|
+
continue;
|
|
44
|
+
const link = document.createElement("link");
|
|
45
|
+
link.rel = "stylesheet";
|
|
46
|
+
link.href = href;
|
|
47
|
+
document.head.appendChild(link);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
37
50
|
export const SNACK_PRESETS = {
|
|
38
51
|
auth: {
|
|
39
52
|
kind: "auth",
|
|
@@ -193,3 +206,4 @@ __decorate([
|
|
|
193
206
|
XmSnackbar = __decorate([
|
|
194
207
|
customElement("xm-snackbar")
|
|
195
208
|
], XmSnackbar);
|
|
209
|
+
export { XmSnackbar };
|
|
@@ -4,7 +4,7 @@ type StackDirection = "vertical" | "horizontal";
|
|
|
4
4
|
type StackGap = "none" | "xs" | "sm" | "md" | "lg" | "xl";
|
|
5
5
|
type StackAlign = "start" | "center" | "end" | "stretch";
|
|
6
6
|
type StackJustify = "start" | "center" | "end" | "between";
|
|
7
|
-
declare class XmStack extends LitElement {
|
|
7
|
+
export declare class XmStack extends LitElement {
|
|
8
8
|
direction: StackDirection;
|
|
9
9
|
gap: StackGap;
|
|
10
10
|
align: StackAlign;
|
|
@@ -8,7 +8,7 @@ export interface TableColumn {
|
|
|
8
8
|
muted?: boolean;
|
|
9
9
|
}
|
|
10
10
|
export type TableRow = Record<string, string | number>;
|
|
11
|
-
declare class XmTable extends LitElement {
|
|
11
|
+
export declare class XmTable extends LitElement {
|
|
12
12
|
columns: TableColumn[];
|
|
13
13
|
rows: TableRow[];
|
|
14
14
|
caption: string;
|
|
@@ -22,4 +22,3 @@ declare global {
|
|
|
22
22
|
"xm-table": XmTable;
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
|
-
export {};
|
|
@@ -2,10 +2,9 @@
|
|
|
2
2
|
table/index.ts — <xm-table>.
|
|
3
3
|
|
|
4
4
|
Static, semantic, hairline-ruled table. Renders a real <table> in
|
|
5
|
-
its shadow root
|
|
5
|
+
its shadow root from a data-driven { columns, rows } model (the
|
|
6
|
+
shape xm-data-table composes in Epic 6):
|
|
6
7
|
|
|
7
|
-
1. Data-driven (preferred; this is the shape xm-data-table composes
|
|
8
|
-
in Epic 6):
|
|
9
8
|
const t = document.querySelector("xm-table");
|
|
10
9
|
t.columns = [
|
|
11
10
|
{ key: "name", label: "File name" },
|
|
@@ -16,10 +15,7 @@
|
|
|
16
15
|
{ name: "routing.yaml", type: "YAML", size: "8.4 KB" },
|
|
17
16
|
{ name: "schema.json", type: "JSON", size: "412 KB" },
|
|
18
17
|
];
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
2. Slotted (escape hatch for fully bespoke markup): author your own
|
|
22
|
-
<table> structure inside the element; it is projected verbatim.
|
|
18
|
+
Or set columns/rows as JSON via the `columns` / `rows` attributes.
|
|
23
19
|
|
|
24
20
|
Column model: { key, label, numeric?, align?, muted? }.
|
|
25
21
|
numeric → right-align + tabular figures (NFR-22). Put the unit in
|
|
@@ -75,7 +71,6 @@ let XmTable = class XmTable extends LitElement {
|
|
|
75
71
|
return Boolean(col.numeric);
|
|
76
72
|
}
|
|
77
73
|
render() {
|
|
78
|
-
const dataMode = this.columns.length > 0;
|
|
79
74
|
return html `
|
|
80
75
|
<link rel="stylesheet" href="${TABLE_CSS}" />
|
|
81
76
|
<style>
|
|
@@ -86,7 +81,7 @@ let XmTable = class XmTable extends LitElement {
|
|
|
86
81
|
display: none;
|
|
87
82
|
}
|
|
88
83
|
</style>
|
|
89
|
-
${
|
|
84
|
+
${this._renderData()}
|
|
90
85
|
`;
|
|
91
86
|
}
|
|
92
87
|
_renderData() {
|
|
@@ -137,3 +132,4 @@ __decorate([
|
|
|
137
132
|
XmTable = __decorate([
|
|
138
133
|
customElement("xm-table")
|
|
139
134
|
], XmTable);
|
|
135
|
+
export { XmTable };
|
|
@@ -4,20 +4,20 @@ type TabsSize = "xs" | "sm" | "md" | "lg";
|
|
|
4
4
|
export interface TabsChangeDetail {
|
|
5
5
|
value: string;
|
|
6
6
|
}
|
|
7
|
-
declare class XmTab extends LitElement {
|
|
7
|
+
export declare class XmTab extends LitElement {
|
|
8
8
|
value: string;
|
|
9
9
|
disabled: boolean;
|
|
10
10
|
createRenderRoot(): HTMLElement | DocumentFragment;
|
|
11
11
|
connectedCallback(): void;
|
|
12
12
|
render(): TemplateResult;
|
|
13
13
|
}
|
|
14
|
-
declare class XmTabPanel extends LitElement {
|
|
14
|
+
export declare class XmTabPanel extends LitElement {
|
|
15
15
|
value: string;
|
|
16
16
|
createRenderRoot(): HTMLElement | DocumentFragment;
|
|
17
17
|
connectedCallback(): void;
|
|
18
18
|
render(): TemplateResult;
|
|
19
19
|
}
|
|
20
|
-
declare class XmTabs extends LitElement {
|
|
20
|
+
export declare class XmTabs extends LitElement {
|
|
21
21
|
value: string;
|
|
22
22
|
size: TabsSize;
|
|
23
23
|
private _list;
|