@deepfuture/dui-templates 1.0.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 +214 -0
- package/all.d.ts +10 -0
- package/all.js +20 -0
- package/content/briefing-block.d.ts +36 -0
- package/content/briefing-block.js +281 -0
- package/content/empty-state.d.ts +24 -0
- package/content/empty-state.js +187 -0
- package/content/index.d.ts +5 -0
- package/content/index.js +5 -0
- package/content/numbered-insight.d.ts +30 -0
- package/content/numbered-insight.js +242 -0
- package/dashboard/index.d.ts +5 -0
- package/dashboard/index.js +5 -0
- package/dashboard/page-header.d.ts +29 -0
- package/dashboard/page-header.js +218 -0
- package/dashboard/section-panel.d.ts +41 -0
- package/dashboard/section-panel.js +393 -0
- package/data/index.d.ts +5 -0
- package/data/index.js +4 -0
- package/data/key-value.d.ts +27 -0
- package/data/key-value.js +165 -0
- package/data/market-table.d.ts +40 -0
- package/data/market-table.js +270 -0
- package/feed/activity-item.d.ts +35 -0
- package/feed/activity-item.js +278 -0
- package/feed/feed-item.d.ts +32 -0
- package/feed/feed-item.js +260 -0
- package/feed/headline-item.d.ts +27 -0
- package/feed/headline-item.js +187 -0
- package/feed/index.d.ts +6 -0
- package/feed/index.js +6 -0
- package/feed/social-post.d.ts +31 -0
- package/feed/social-post.js +268 -0
- package/media/avatar-row.d.ts +31 -0
- package/media/avatar-row.js +164 -0
- package/media/index.d.ts +7 -0
- package/media/index.js +5 -0
- package/media/media-grid.d.ts +32 -0
- package/media/media-grid.js +199 -0
- package/metrics/index.d.ts +6 -0
- package/metrics/index.js +6 -0
- package/metrics/progress-bar.d.ts +31 -0
- package/metrics/progress-bar.js +212 -0
- package/metrics/risk-gauge.d.ts +31 -0
- package/metrics/risk-gauge.js +289 -0
- package/metrics/score-item.d.ts +33 -0
- package/metrics/score-item.js +253 -0
- package/metrics/stat-card.d.ts +29 -0
- package/metrics/stat-card.js +230 -0
- package/package.json +61 -0
|
@@ -0,0 +1,278 @@
|
|
|
1
|
+
var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
|
|
2
|
+
function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
|
|
3
|
+
var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
|
|
4
|
+
var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
|
|
5
|
+
var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
|
|
6
|
+
var _, done = false;
|
|
7
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
8
|
+
var context = {};
|
|
9
|
+
for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
|
|
10
|
+
for (var p in contextIn.access) context.access[p] = contextIn.access[p];
|
|
11
|
+
context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
|
|
12
|
+
var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
|
|
13
|
+
if (kind === "accessor") {
|
|
14
|
+
if (result === void 0) continue;
|
|
15
|
+
if (result === null || typeof result !== "object") throw new TypeError("Object expected");
|
|
16
|
+
if (_ = accept(result.get)) descriptor.get = _;
|
|
17
|
+
if (_ = accept(result.set)) descriptor.set = _;
|
|
18
|
+
if (_ = accept(result.init)) initializers.unshift(_);
|
|
19
|
+
}
|
|
20
|
+
else if (_ = accept(result)) {
|
|
21
|
+
if (kind === "field") initializers.unshift(_);
|
|
22
|
+
else descriptor[key] = _;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
if (target) Object.defineProperty(target, contextIn.name, descriptor);
|
|
26
|
+
done = true;
|
|
27
|
+
};
|
|
28
|
+
var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
|
|
29
|
+
var useValue = arguments.length > 2;
|
|
30
|
+
for (var i = 0; i < initializers.length; i++) {
|
|
31
|
+
value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
|
|
32
|
+
}
|
|
33
|
+
return useValue ? value : void 0;
|
|
34
|
+
};
|
|
35
|
+
import { css, html, LitElement, nothing } from "lit";
|
|
36
|
+
import { property } from "lit/decorators.js";
|
|
37
|
+
import { base } from "@deepfuture/dui-core/base";
|
|
38
|
+
import "@deepfuture/dui-components/badge";
|
|
39
|
+
/** Status → dot color mapping. */
|
|
40
|
+
const STATUS_COLORS = {
|
|
41
|
+
success: "var(--accent)",
|
|
42
|
+
error: "var(--destructive)",
|
|
43
|
+
warning: "var(--accent-text)",
|
|
44
|
+
info: "var(--text-3)",
|
|
45
|
+
pending: "var(--text-3)",
|
|
46
|
+
};
|
|
47
|
+
const DOT_SIZE = "--space-2";
|
|
48
|
+
const TRACK_LEFT = "var(--space-0_5)"; /* center of the dot column */
|
|
49
|
+
const styles = css `
|
|
50
|
+
:host {
|
|
51
|
+
display: block;
|
|
52
|
+
--_dot-color: var(--border-strong);
|
|
53
|
+
--_dot-size: var(--space-2);
|
|
54
|
+
/* Total left gutter = dot-size + gap */
|
|
55
|
+
--_gutter: calc(var(--_dot-size) + var(--space-3));
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
article {
|
|
59
|
+
position: relative;
|
|
60
|
+
padding-left: var(--_gutter);
|
|
61
|
+
padding-bottom: var(--space-4);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
:host([last]) article {
|
|
65
|
+
padding-bottom: 0;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/* ── Vertical line — runs full height of the article ── */
|
|
69
|
+
article::before {
|
|
70
|
+
content: "";
|
|
71
|
+
position: absolute;
|
|
72
|
+
top: 0;
|
|
73
|
+
bottom: 0;
|
|
74
|
+
/* Center the line under the dot */
|
|
75
|
+
left: calc(var(--_dot-size) / 2 - 0.5px);
|
|
76
|
+
width: var(--border-width-thin, 1px);
|
|
77
|
+
background: var(--border);
|
|
78
|
+
margin-top: 1rem;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/* :host([last]) article::before {
|
|
82
|
+
display: none;
|
|
83
|
+
} */
|
|
84
|
+
|
|
85
|
+
/* ── Content ── */
|
|
86
|
+
.content {
|
|
87
|
+
display: flex;
|
|
88
|
+
flex-direction: column;
|
|
89
|
+
gap: var(--space-0_5);
|
|
90
|
+
min-width: 0;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/* ── Header — the dot is a ::before pseudo-element ── */
|
|
94
|
+
.header {
|
|
95
|
+
display: flex;
|
|
96
|
+
align-items: baseline;
|
|
97
|
+
gap: var(--space-2);
|
|
98
|
+
min-width: 0;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
.title {
|
|
102
|
+
position: relative;
|
|
103
|
+
font-family: var(--font-sans);
|
|
104
|
+
font-size: var(--text-sm);
|
|
105
|
+
font-weight: var(--font-weight-medium);
|
|
106
|
+
letter-spacing: var(--letter-spacing-wide);
|
|
107
|
+
line-height: var(--line-height-snug);
|
|
108
|
+
color: var(--foreground);
|
|
109
|
+
white-space: nowrap;
|
|
110
|
+
text-overflow: ellipsis;
|
|
111
|
+
min-width: 0;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
.title::before {
|
|
115
|
+
content: "";
|
|
116
|
+
position: absolute;
|
|
117
|
+
width: var(--_dot-size);
|
|
118
|
+
height: var(--_dot-size);
|
|
119
|
+
border-radius: var(--radius-full);
|
|
120
|
+
background: var(--_dot-color);
|
|
121
|
+
/* Position: pull left into the gutter, vertically center with the title line */
|
|
122
|
+
left: calc(-1 * var(--_gutter));
|
|
123
|
+
/* Align to the first line of text: offset by half line-height minus half dot */
|
|
124
|
+
top: calc(var(--text-sm) * 0.35);
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
.timestamp {
|
|
129
|
+
font-family: var(--font-sans);
|
|
130
|
+
font-size: var(--text-xs);
|
|
131
|
+
letter-spacing: var(--letter-spacing-wide);
|
|
132
|
+
line-height: var(--line-height-snug);
|
|
133
|
+
color: var(--text-3);
|
|
134
|
+
flex-shrink: 0;
|
|
135
|
+
white-space: nowrap;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
.description {
|
|
139
|
+
font-family: var(--font-sans);
|
|
140
|
+
font-size: var(--text-xs);
|
|
141
|
+
letter-spacing: var(--letter-spacing-wide);
|
|
142
|
+
line-height: var(--line-height-normal);
|
|
143
|
+
color: var(--text-2);
|
|
144
|
+
margin: 0;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
.actions {
|
|
148
|
+
display: flex;
|
|
149
|
+
align-items: center;
|
|
150
|
+
gap: var(--space-2);
|
|
151
|
+
padding-top: var(--space-1);
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
.actions[hidden] {
|
|
155
|
+
display: none;
|
|
156
|
+
}
|
|
157
|
+
`;
|
|
158
|
+
/**
|
|
159
|
+
* `<dui-activity-item>` — A timestamped event in a vertical timeline.
|
|
160
|
+
*
|
|
161
|
+
* Renders a timeline dot + connecting line on the left, with a title,
|
|
162
|
+
* timestamp, optional description, and optional status badge on the right.
|
|
163
|
+
* The dot is a pseudo-element of the header row so it always aligns with
|
|
164
|
+
* the title text. Stack multiple activity-items to form a timeline. Set
|
|
165
|
+
* `last` on the final item to hide the trailing line.
|
|
166
|
+
*
|
|
167
|
+
* @slot actions - Optional action buttons or links.
|
|
168
|
+
* @csspart article - The outer container.
|
|
169
|
+
* @csspart title - The event title.
|
|
170
|
+
* @csspart timestamp - The timestamp text.
|
|
171
|
+
* @csspart description - The description paragraph.
|
|
172
|
+
*/
|
|
173
|
+
let DuiActivityItem = (() => {
|
|
174
|
+
let _classSuper = LitElement;
|
|
175
|
+
let _title_decorators;
|
|
176
|
+
let _title_initializers = [];
|
|
177
|
+
let _title_extraInitializers = [];
|
|
178
|
+
let _timestamp_decorators;
|
|
179
|
+
let _timestamp_initializers = [];
|
|
180
|
+
let _timestamp_extraInitializers = [];
|
|
181
|
+
let _description_decorators;
|
|
182
|
+
let _description_initializers = [];
|
|
183
|
+
let _description_extraInitializers = [];
|
|
184
|
+
let _status_decorators;
|
|
185
|
+
let _status_initializers = [];
|
|
186
|
+
let _status_extraInitializers = [];
|
|
187
|
+
let _statusLabel_decorators;
|
|
188
|
+
let _statusLabel_initializers = [];
|
|
189
|
+
let _statusLabel_extraInitializers = [];
|
|
190
|
+
let _last_decorators;
|
|
191
|
+
let _last_initializers = [];
|
|
192
|
+
let _last_extraInitializers = [];
|
|
193
|
+
return class DuiActivityItem extends _classSuper {
|
|
194
|
+
static {
|
|
195
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
196
|
+
_title_decorators = [property()];
|
|
197
|
+
_timestamp_decorators = [property()];
|
|
198
|
+
_description_decorators = [property()];
|
|
199
|
+
_status_decorators = [property()];
|
|
200
|
+
_statusLabel_decorators = [property({ attribute: "status-label" })];
|
|
201
|
+
_last_decorators = [property({ type: Boolean, reflect: true })];
|
|
202
|
+
__esDecorate(this, null, _title_decorators, { kind: "accessor", name: "title", static: false, private: false, access: { has: obj => "title" in obj, get: obj => obj.title, set: (obj, value) => { obj.title = value; } }, metadata: _metadata }, _title_initializers, _title_extraInitializers);
|
|
203
|
+
__esDecorate(this, null, _timestamp_decorators, { kind: "accessor", name: "timestamp", static: false, private: false, access: { has: obj => "timestamp" in obj, get: obj => obj.timestamp, set: (obj, value) => { obj.timestamp = value; } }, metadata: _metadata }, _timestamp_initializers, _timestamp_extraInitializers);
|
|
204
|
+
__esDecorate(this, null, _description_decorators, { kind: "accessor", name: "description", static: false, private: false, access: { has: obj => "description" in obj, get: obj => obj.description, set: (obj, value) => { obj.description = value; } }, metadata: _metadata }, _description_initializers, _description_extraInitializers);
|
|
205
|
+
__esDecorate(this, null, _status_decorators, { kind: "accessor", name: "status", static: false, private: false, access: { has: obj => "status" in obj, get: obj => obj.status, set: (obj, value) => { obj.status = value; } }, metadata: _metadata }, _status_initializers, _status_extraInitializers);
|
|
206
|
+
__esDecorate(this, null, _statusLabel_decorators, { kind: "accessor", name: "statusLabel", static: false, private: false, access: { has: obj => "statusLabel" in obj, get: obj => obj.statusLabel, set: (obj, value) => { obj.statusLabel = value; } }, metadata: _metadata }, _statusLabel_initializers, _statusLabel_extraInitializers);
|
|
207
|
+
__esDecorate(this, null, _last_decorators, { kind: "accessor", name: "last", static: false, private: false, access: { has: obj => "last" in obj, get: obj => obj.last, set: (obj, value) => { obj.last = value; } }, metadata: _metadata }, _last_initializers, _last_extraInitializers);
|
|
208
|
+
if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
209
|
+
}
|
|
210
|
+
static tagName = "dui-activity-item";
|
|
211
|
+
static styles = [base, styles];
|
|
212
|
+
#title_accessor_storage = __runInitializers(this, _title_initializers, "");
|
|
213
|
+
/** Event title. */
|
|
214
|
+
get title() { return this.#title_accessor_storage; }
|
|
215
|
+
set title(value) { this.#title_accessor_storage = value; }
|
|
216
|
+
#timestamp_accessor_storage = (__runInitializers(this, _title_extraInitializers), __runInitializers(this, _timestamp_initializers, ""));
|
|
217
|
+
/** Display timestamp (e.g. "2 min ago", "14:23 UTC"). */
|
|
218
|
+
get timestamp() { return this.#timestamp_accessor_storage; }
|
|
219
|
+
set timestamp(value) { this.#timestamp_accessor_storage = value; }
|
|
220
|
+
#description_accessor_storage = (__runInitializers(this, _timestamp_extraInitializers), __runInitializers(this, _description_initializers, ""));
|
|
221
|
+
/** Optional description text. */
|
|
222
|
+
get description() { return this.#description_accessor_storage; }
|
|
223
|
+
set description(value) { this.#description_accessor_storage = value; }
|
|
224
|
+
#status_accessor_storage = (__runInitializers(this, _description_extraInitializers), __runInitializers(this, _status_initializers, ""));
|
|
225
|
+
/** Status — determines dot color (success | error | warning | info | pending). */
|
|
226
|
+
get status() { return this.#status_accessor_storage; }
|
|
227
|
+
set status(value) { this.#status_accessor_storage = value; }
|
|
228
|
+
#statusLabel_accessor_storage = (__runInitializers(this, _status_extraInitializers), __runInitializers(this, _statusLabel_initializers, ""));
|
|
229
|
+
/** Optional status label — renders as a badge next to the title. */
|
|
230
|
+
get statusLabel() { return this.#statusLabel_accessor_storage; }
|
|
231
|
+
set statusLabel(value) { this.#statusLabel_accessor_storage = value; }
|
|
232
|
+
#last_accessor_storage = (__runInitializers(this, _statusLabel_extraInitializers), __runInitializers(this, _last_initializers, false));
|
|
233
|
+
/** Mark as the last item to hide the trailing timeline line. */
|
|
234
|
+
get last() { return this.#last_accessor_storage; }
|
|
235
|
+
set last(value) { this.#last_accessor_storage = value; }
|
|
236
|
+
#onSlotChange(e) {
|
|
237
|
+
const slot = e.target;
|
|
238
|
+
slot.parentElement.hidden = slot.assignedElements().length === 0;
|
|
239
|
+
}
|
|
240
|
+
render() {
|
|
241
|
+
const dotColor = STATUS_COLORS[this.status.toLowerCase()] ?? undefined;
|
|
242
|
+
const dotStyle = dotColor ? `--_dot-color: ${dotColor}` : "";
|
|
243
|
+
// Map status to badge variant
|
|
244
|
+
const badgeVariant = this.status === "error" ? "danger"
|
|
245
|
+
: this.status === "success" ? "primary"
|
|
246
|
+
: "neutral";
|
|
247
|
+
return html `
|
|
248
|
+
<article part="article" style=${dotStyle}>
|
|
249
|
+
<div class="content">
|
|
250
|
+
<div class="header">
|
|
251
|
+
<span class="title" part="title">${this.title}</span>
|
|
252
|
+
${this.statusLabel
|
|
253
|
+
? html `<dui-badge appearance="soft" size="sm" variant=${badgeVariant}>${this.statusLabel}</dui-badge>`
|
|
254
|
+
: nothing}
|
|
255
|
+
${this.timestamp
|
|
256
|
+
? html `<time class="timestamp" part="timestamp">${this.timestamp}</time>`
|
|
257
|
+
: nothing}
|
|
258
|
+
</div>
|
|
259
|
+
|
|
260
|
+
${this.description
|
|
261
|
+
? html `<p class="description" part="description">${this.description}</p>`
|
|
262
|
+
: nothing}
|
|
263
|
+
|
|
264
|
+
<div class="actions" hidden>
|
|
265
|
+
<slot name="actions" @slotchange=${this.#onSlotChange}></slot>
|
|
266
|
+
</div>
|
|
267
|
+
</div>
|
|
268
|
+
</article>
|
|
269
|
+
`;
|
|
270
|
+
}
|
|
271
|
+
constructor() {
|
|
272
|
+
super(...arguments);
|
|
273
|
+
__runInitializers(this, _last_extraInitializers);
|
|
274
|
+
}
|
|
275
|
+
};
|
|
276
|
+
})();
|
|
277
|
+
export { DuiActivityItem };
|
|
278
|
+
customElements.define(DuiActivityItem.tagName, DuiActivityItem);
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { LitElement, type TemplateResult } from "lit";
|
|
2
|
+
import "@deepfuture/dui-components/badge";
|
|
3
|
+
/**
|
|
4
|
+
* `<dui-feed-item>` — An event card for feeds and monitoring dashboards.
|
|
5
|
+
*
|
|
6
|
+
* Renders a title, subtitle (source/location), timestamp, optional category
|
|
7
|
+
* and severity badges, and an optional description body.
|
|
8
|
+
*
|
|
9
|
+
* @slot actions - Optional action buttons or links below the body.
|
|
10
|
+
* @csspart article - The outer article container.
|
|
11
|
+
* @csspart header - The title + badges row.
|
|
12
|
+
* @csspart meta - The subtitle + timestamp row.
|
|
13
|
+
* @csspart body - The description paragraph.
|
|
14
|
+
*/
|
|
15
|
+
export declare class DuiFeedItem extends LitElement {
|
|
16
|
+
#private;
|
|
17
|
+
static tagName: "dui-feed-item";
|
|
18
|
+
static styles: import("lit").CSSResult[];
|
|
19
|
+
/** Primary label for the event. */
|
|
20
|
+
accessor title: string;
|
|
21
|
+
/** Secondary context — location, source, or origin. */
|
|
22
|
+
accessor subtitle: string;
|
|
23
|
+
/** Display timestamp (e.g. "2 min ago", "14:23 UTC"). */
|
|
24
|
+
accessor timestamp: string;
|
|
25
|
+
/** Category label — renders as a neutral badge. */
|
|
26
|
+
accessor category: string;
|
|
27
|
+
/** Severity level — maps to badge variant (critical | high | medium | low). */
|
|
28
|
+
accessor severity: string;
|
|
29
|
+
/** Optional body text. */
|
|
30
|
+
accessor description: string;
|
|
31
|
+
render(): TemplateResult;
|
|
32
|
+
}
|
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
|
|
2
|
+
function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
|
|
3
|
+
var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
|
|
4
|
+
var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
|
|
5
|
+
var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
|
|
6
|
+
var _, done = false;
|
|
7
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
8
|
+
var context = {};
|
|
9
|
+
for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
|
|
10
|
+
for (var p in contextIn.access) context.access[p] = contextIn.access[p];
|
|
11
|
+
context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
|
|
12
|
+
var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
|
|
13
|
+
if (kind === "accessor") {
|
|
14
|
+
if (result === void 0) continue;
|
|
15
|
+
if (result === null || typeof result !== "object") throw new TypeError("Object expected");
|
|
16
|
+
if (_ = accept(result.get)) descriptor.get = _;
|
|
17
|
+
if (_ = accept(result.set)) descriptor.set = _;
|
|
18
|
+
if (_ = accept(result.init)) initializers.unshift(_);
|
|
19
|
+
}
|
|
20
|
+
else if (_ = accept(result)) {
|
|
21
|
+
if (kind === "field") initializers.unshift(_);
|
|
22
|
+
else descriptor[key] = _;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
if (target) Object.defineProperty(target, contextIn.name, descriptor);
|
|
26
|
+
done = true;
|
|
27
|
+
};
|
|
28
|
+
var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
|
|
29
|
+
var useValue = arguments.length > 2;
|
|
30
|
+
for (var i = 0; i < initializers.length; i++) {
|
|
31
|
+
value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
|
|
32
|
+
}
|
|
33
|
+
return useValue ? value : void 0;
|
|
34
|
+
};
|
|
35
|
+
import { css, html, LitElement, nothing } from "lit";
|
|
36
|
+
import { property } from "lit/decorators.js";
|
|
37
|
+
import { base } from "@deepfuture/dui-core/base";
|
|
38
|
+
import "@deepfuture/dui-components/badge";
|
|
39
|
+
/**
|
|
40
|
+
* Severity → badge variant + appearance mapping.
|
|
41
|
+
* Uses the default theme's variant vocabulary.
|
|
42
|
+
*/
|
|
43
|
+
const SEVERITY_MAP = {
|
|
44
|
+
critical: { variant: "danger", appearance: "filled" },
|
|
45
|
+
high: { variant: "danger", appearance: "ghost" },
|
|
46
|
+
medium: { variant: "primary", appearance: "ghost" },
|
|
47
|
+
low: { variant: "neutral", appearance: "ghost" },
|
|
48
|
+
};
|
|
49
|
+
const styles = css `
|
|
50
|
+
:host {
|
|
51
|
+
display: block;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
article {
|
|
55
|
+
display: flex;
|
|
56
|
+
flex-direction: column;
|
|
57
|
+
gap: var(--space-0_5);
|
|
58
|
+
padding: var(--space-3);
|
|
59
|
+
border: var(--border-width-thin) solid var(--border);
|
|
60
|
+
border-radius: var(--radius-md);
|
|
61
|
+
background: var(--surface-1);
|
|
62
|
+
transition: background var(--duration-fast) ease;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
article:hover {
|
|
66
|
+
background: var(--surface-2);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
header {
|
|
70
|
+
display: flex;
|
|
71
|
+
align-items: center;
|
|
72
|
+
gap: var(--space-2);
|
|
73
|
+
min-width: 0;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.title {
|
|
77
|
+
font-family: var(--font-sans);
|
|
78
|
+
font-size: var(--text-sm);
|
|
79
|
+
font-weight: var(--font-weight-semibold);
|
|
80
|
+
letter-spacing: var(--letter-spacing-wide);
|
|
81
|
+
line-height: var(--line-height-snug);
|
|
82
|
+
color: var(--foreground);
|
|
83
|
+
white-space: nowrap;
|
|
84
|
+
overflow: hidden;
|
|
85
|
+
text-overflow: ellipsis;
|
|
86
|
+
min-width: 0;
|
|
87
|
+
flex: 1;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
.badges {
|
|
91
|
+
display: flex;
|
|
92
|
+
align-items: center;
|
|
93
|
+
gap: var(--space-1_5);
|
|
94
|
+
flex-shrink: 0;
|
|
95
|
+
justify-self: flex-end;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
.meta {
|
|
99
|
+
display: flex;
|
|
100
|
+
align-items: center;
|
|
101
|
+
gap: var(--space-1);
|
|
102
|
+
font-family: var(--font-sans);
|
|
103
|
+
font-size: var(--text-xs);
|
|
104
|
+
letter-spacing: var(--letter-spacing-wide);
|
|
105
|
+
line-height: var(--line-height-normal);
|
|
106
|
+
color: var(--text-2);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
.meta-separator {
|
|
110
|
+
color: var(--text-3);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
.body {
|
|
114
|
+
font-family: var(--font-sans);
|
|
115
|
+
font-size: var(--text-sm);
|
|
116
|
+
letter-spacing: var(--letter-spacing-wide);
|
|
117
|
+
line-height: var(--line-height-normal);
|
|
118
|
+
color: var(--text-1);
|
|
119
|
+
margin: 0;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
.actions {
|
|
123
|
+
display: flex;
|
|
124
|
+
align-items: center;
|
|
125
|
+
gap: var(--space-2);
|
|
126
|
+
padding-top: var(--space-1);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
.actions[hidden] {
|
|
130
|
+
display: none;
|
|
131
|
+
}
|
|
132
|
+
`;
|
|
133
|
+
/**
|
|
134
|
+
* `<dui-feed-item>` — An event card for feeds and monitoring dashboards.
|
|
135
|
+
*
|
|
136
|
+
* Renders a title, subtitle (source/location), timestamp, optional category
|
|
137
|
+
* and severity badges, and an optional description body.
|
|
138
|
+
*
|
|
139
|
+
* @slot actions - Optional action buttons or links below the body.
|
|
140
|
+
* @csspart article - The outer article container.
|
|
141
|
+
* @csspart header - The title + badges row.
|
|
142
|
+
* @csspart meta - The subtitle + timestamp row.
|
|
143
|
+
* @csspart body - The description paragraph.
|
|
144
|
+
*/
|
|
145
|
+
let DuiFeedItem = (() => {
|
|
146
|
+
let _classSuper = LitElement;
|
|
147
|
+
let _title_decorators;
|
|
148
|
+
let _title_initializers = [];
|
|
149
|
+
let _title_extraInitializers = [];
|
|
150
|
+
let _subtitle_decorators;
|
|
151
|
+
let _subtitle_initializers = [];
|
|
152
|
+
let _subtitle_extraInitializers = [];
|
|
153
|
+
let _timestamp_decorators;
|
|
154
|
+
let _timestamp_initializers = [];
|
|
155
|
+
let _timestamp_extraInitializers = [];
|
|
156
|
+
let _category_decorators;
|
|
157
|
+
let _category_initializers = [];
|
|
158
|
+
let _category_extraInitializers = [];
|
|
159
|
+
let _severity_decorators;
|
|
160
|
+
let _severity_initializers = [];
|
|
161
|
+
let _severity_extraInitializers = [];
|
|
162
|
+
let _description_decorators;
|
|
163
|
+
let _description_initializers = [];
|
|
164
|
+
let _description_extraInitializers = [];
|
|
165
|
+
return class DuiFeedItem extends _classSuper {
|
|
166
|
+
static {
|
|
167
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
168
|
+
_title_decorators = [property()];
|
|
169
|
+
_subtitle_decorators = [property()];
|
|
170
|
+
_timestamp_decorators = [property()];
|
|
171
|
+
_category_decorators = [property()];
|
|
172
|
+
_severity_decorators = [property()];
|
|
173
|
+
_description_decorators = [property()];
|
|
174
|
+
__esDecorate(this, null, _title_decorators, { kind: "accessor", name: "title", static: false, private: false, access: { has: obj => "title" in obj, get: obj => obj.title, set: (obj, value) => { obj.title = value; } }, metadata: _metadata }, _title_initializers, _title_extraInitializers);
|
|
175
|
+
__esDecorate(this, null, _subtitle_decorators, { kind: "accessor", name: "subtitle", static: false, private: false, access: { has: obj => "subtitle" in obj, get: obj => obj.subtitle, set: (obj, value) => { obj.subtitle = value; } }, metadata: _metadata }, _subtitle_initializers, _subtitle_extraInitializers);
|
|
176
|
+
__esDecorate(this, null, _timestamp_decorators, { kind: "accessor", name: "timestamp", static: false, private: false, access: { has: obj => "timestamp" in obj, get: obj => obj.timestamp, set: (obj, value) => { obj.timestamp = value; } }, metadata: _metadata }, _timestamp_initializers, _timestamp_extraInitializers);
|
|
177
|
+
__esDecorate(this, null, _category_decorators, { kind: "accessor", name: "category", static: false, private: false, access: { has: obj => "category" in obj, get: obj => obj.category, set: (obj, value) => { obj.category = value; } }, metadata: _metadata }, _category_initializers, _category_extraInitializers);
|
|
178
|
+
__esDecorate(this, null, _severity_decorators, { kind: "accessor", name: "severity", static: false, private: false, access: { has: obj => "severity" in obj, get: obj => obj.severity, set: (obj, value) => { obj.severity = value; } }, metadata: _metadata }, _severity_initializers, _severity_extraInitializers);
|
|
179
|
+
__esDecorate(this, null, _description_decorators, { kind: "accessor", name: "description", static: false, private: false, access: { has: obj => "description" in obj, get: obj => obj.description, set: (obj, value) => { obj.description = value; } }, metadata: _metadata }, _description_initializers, _description_extraInitializers);
|
|
180
|
+
if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
181
|
+
}
|
|
182
|
+
static tagName = "dui-feed-item";
|
|
183
|
+
static styles = [base, styles];
|
|
184
|
+
#title_accessor_storage = __runInitializers(this, _title_initializers, "");
|
|
185
|
+
/** Primary label for the event. */
|
|
186
|
+
get title() { return this.#title_accessor_storage; }
|
|
187
|
+
set title(value) { this.#title_accessor_storage = value; }
|
|
188
|
+
#subtitle_accessor_storage = (__runInitializers(this, _title_extraInitializers), __runInitializers(this, _subtitle_initializers, ""));
|
|
189
|
+
/** Secondary context — location, source, or origin. */
|
|
190
|
+
get subtitle() { return this.#subtitle_accessor_storage; }
|
|
191
|
+
set subtitle(value) { this.#subtitle_accessor_storage = value; }
|
|
192
|
+
#timestamp_accessor_storage = (__runInitializers(this, _subtitle_extraInitializers), __runInitializers(this, _timestamp_initializers, ""));
|
|
193
|
+
/** Display timestamp (e.g. "2 min ago", "14:23 UTC"). */
|
|
194
|
+
get timestamp() { return this.#timestamp_accessor_storage; }
|
|
195
|
+
set timestamp(value) { this.#timestamp_accessor_storage = value; }
|
|
196
|
+
#category_accessor_storage = (__runInitializers(this, _timestamp_extraInitializers), __runInitializers(this, _category_initializers, ""));
|
|
197
|
+
/** Category label — renders as a neutral badge. */
|
|
198
|
+
get category() { return this.#category_accessor_storage; }
|
|
199
|
+
set category(value) { this.#category_accessor_storage = value; }
|
|
200
|
+
#severity_accessor_storage = (__runInitializers(this, _category_extraInitializers), __runInitializers(this, _severity_initializers, ""));
|
|
201
|
+
/** Severity level — maps to badge variant (critical | high | medium | low). */
|
|
202
|
+
get severity() { return this.#severity_accessor_storage; }
|
|
203
|
+
set severity(value) { this.#severity_accessor_storage = value; }
|
|
204
|
+
#description_accessor_storage = (__runInitializers(this, _severity_extraInitializers), __runInitializers(this, _description_initializers, ""));
|
|
205
|
+
/** Optional body text. */
|
|
206
|
+
get description() { return this.#description_accessor_storage; }
|
|
207
|
+
set description(value) { this.#description_accessor_storage = value; }
|
|
208
|
+
#onSlotChange(e) {
|
|
209
|
+
const slot = e.target;
|
|
210
|
+
slot.parentElement.hidden = slot.assignedElements().length === 0;
|
|
211
|
+
}
|
|
212
|
+
render() {
|
|
213
|
+
const sev = SEVERITY_MAP[this.severity.toLowerCase()];
|
|
214
|
+
return html `
|
|
215
|
+
<article part="article">
|
|
216
|
+
<header part="header">
|
|
217
|
+
<span class="title">${this.title}</span>
|
|
218
|
+
<div class="badges">
|
|
219
|
+
${this.category
|
|
220
|
+
? html `<dui-badge appearance="soft">${this.category}</dui-badge>`
|
|
221
|
+
: nothing}
|
|
222
|
+
${sev
|
|
223
|
+
? html `<dui-badge variant=${sev.variant} appearance=${sev.appearance}>${this.severity}</dui-badge>`
|
|
224
|
+
: nothing}
|
|
225
|
+
</div>
|
|
226
|
+
</header>
|
|
227
|
+
|
|
228
|
+
${this.subtitle || this.timestamp
|
|
229
|
+
? html `
|
|
230
|
+
<div class="meta" part="meta">
|
|
231
|
+
${this.subtitle ? html `<span>${this.subtitle}</span>` : nothing}
|
|
232
|
+
${this.subtitle && this.timestamp
|
|
233
|
+
? html `<span class="meta-separator">·</span>`
|
|
234
|
+
: nothing}
|
|
235
|
+
${this.timestamp
|
|
236
|
+
? html `<time>${this.timestamp}</time>`
|
|
237
|
+
: nothing}
|
|
238
|
+
</div>`
|
|
239
|
+
: nothing}
|
|
240
|
+
|
|
241
|
+
${this.description
|
|
242
|
+
? html `<p class="body" part="body">
|
|
243
|
+
<slot name="description">${this.description}</slot>
|
|
244
|
+
</p>`
|
|
245
|
+
: nothing}
|
|
246
|
+
|
|
247
|
+
<div class="actions" hidden>
|
|
248
|
+
<slot name="actions" @slotchange=${this.#onSlotChange}></slot>
|
|
249
|
+
</div>
|
|
250
|
+
</article>
|
|
251
|
+
`;
|
|
252
|
+
}
|
|
253
|
+
constructor() {
|
|
254
|
+
super(...arguments);
|
|
255
|
+
__runInitializers(this, _description_extraInitializers);
|
|
256
|
+
}
|
|
257
|
+
};
|
|
258
|
+
})();
|
|
259
|
+
export { DuiFeedItem };
|
|
260
|
+
customElements.define(DuiFeedItem.tagName, DuiFeedItem);
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { LitElement, type TemplateResult } from "lit";
|
|
2
|
+
/**
|
|
3
|
+
* `<dui-headline-item>` — A minimal headline row: title, source, and timestamp.
|
|
4
|
+
*
|
|
5
|
+
* Designed for dense headline lists and news tickers where space is at a premium.
|
|
6
|
+
* Renders as a single horizontal row with the title taking available space and
|
|
7
|
+
* source + timestamp right-aligned.
|
|
8
|
+
*
|
|
9
|
+
* @slot actions - Optional trailing action buttons or links.
|
|
10
|
+
* @csspart article - The outer article container.
|
|
11
|
+
* @csspart title - The headline title text.
|
|
12
|
+
* @csspart meta - The source + timestamp row.
|
|
13
|
+
*/
|
|
14
|
+
export declare class DuiHeadlineItem extends LitElement {
|
|
15
|
+
#private;
|
|
16
|
+
static tagName: "dui-headline-item";
|
|
17
|
+
static styles: import("lit").CSSResult[];
|
|
18
|
+
/** Primary headline text. */
|
|
19
|
+
accessor title: string;
|
|
20
|
+
/** Source or publication name. */
|
|
21
|
+
accessor source: string;
|
|
22
|
+
/** Display timestamp (e.g. "2 min ago", "14:23 UTC"). */
|
|
23
|
+
accessor timestamp: string;
|
|
24
|
+
/** Optional URL — when set, the title renders as a link. */
|
|
25
|
+
accessor href: string;
|
|
26
|
+
render(): TemplateResult;
|
|
27
|
+
}
|