@molecule/app-file-card-angular 0.0.0-stage → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +202 -0
- package/README.md +551 -2
- package/dist/file-card.component.d.ts +173 -0
- package/dist/file-card.component.d.ts.map +1 -0
- package/dist/file-card.component.js +513 -0
- package/dist/file-card.component.js.map +1 -0
- package/dist/file-icon.component.d.ts +26 -0
- package/dist/file-icon.component.d.ts.map +1 -0
- package/dist/file-icon.component.js +110 -0
- package/dist/file-icon.component.js.map +1 -0
- package/dist/format.d.ts +80 -0
- package/dist/format.d.ts.map +1 -0
- package/dist/format.js +88 -0
- package/dist/format.js.map +1 -0
- package/dist/index.d.ts +54 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +54 -0
- package/dist/index.js.map +1 -0
- package/dist/types.d.ts +71 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +8 -0
- package/dist/types.js.map +1 -0
- package/package.json +71 -4
|
@@ -0,0 +1,513 @@
|
|
|
1
|
+
import { Component, ElementRef, inject, Renderer2, ViewChild } from '@angular/core';
|
|
2
|
+
import { useTranslation } from '@molecule/app-angular';
|
|
3
|
+
import { getClassMap } from '@molecule/app-ui';
|
|
4
|
+
import { hasNodes, SlotWrapper } from '@molecule/app-ui-angular';
|
|
5
|
+
import { FileIcon } from './file-icon.component.js';
|
|
6
|
+
import { relativeBucket, sizeParts } from './format.js';
|
|
7
|
+
import * as i0 from "@angular/core";
|
|
8
|
+
const _c0 = ["actionsSlot"];
|
|
9
|
+
const _c1 = [[["", "slot", "actions"]]];
|
|
10
|
+
const _c2 = ["[slot=actions]"];
|
|
11
|
+
function FileCard_Conditional_0_Conditional_1_Template(rf, ctx) { if (rf & 1) {
|
|
12
|
+
i0.ɵɵelement(0, "img", 8);
|
|
13
|
+
} if (rf & 2) {
|
|
14
|
+
const ctx_r0 = i0.ɵɵnextContext(2);
|
|
15
|
+
i0.ɵɵstyleProp("width", "40px")("height", "40px")("object-fit", "cover")("border-radius", "4px");
|
|
16
|
+
i0.ɵɵproperty("src", ctx_r0.file.thumbnail);
|
|
17
|
+
} }
|
|
18
|
+
function FileCard_Conditional_0_Conditional_2_Template(rf, ctx) { if (rf & 1) {
|
|
19
|
+
i0.ɵɵnamespaceSVG();
|
|
20
|
+
i0.ɵɵelement(0, "svg", 5);
|
|
21
|
+
} if (rf & 2) {
|
|
22
|
+
const ctx_r0 = i0.ɵɵnextContext(2);
|
|
23
|
+
i0.ɵɵproperty("kind", ctx_r0.file.kind)("size", 28);
|
|
24
|
+
} }
|
|
25
|
+
function FileCard_Conditional_0_Conditional_6_Conditional_1_Template(rf, ctx) { if (rf & 1) {
|
|
26
|
+
i0.ɵɵelementStart(0, "span", 10);
|
|
27
|
+
i0.ɵɵtext(1);
|
|
28
|
+
i0.ɵɵelementEnd();
|
|
29
|
+
} if (rf & 2) {
|
|
30
|
+
const ctx_r0 = i0.ɵɵnextContext(3);
|
|
31
|
+
i0.ɵɵattribute("aria-label", ctx_r0.sizeLabel());
|
|
32
|
+
i0.ɵɵadvance();
|
|
33
|
+
i0.ɵɵtextInterpolate(ctx_r0.sizeText());
|
|
34
|
+
} }
|
|
35
|
+
function FileCard_Conditional_0_Conditional_6_Conditional_2_Template(rf, ctx) { if (rf & 1) {
|
|
36
|
+
i0.ɵɵelementStart(0, "span", 11);
|
|
37
|
+
i0.ɵɵtext(1, "\u00B7");
|
|
38
|
+
i0.ɵɵelementEnd();
|
|
39
|
+
} }
|
|
40
|
+
function FileCard_Conditional_0_Conditional_6_Conditional_3_Template(rf, ctx) { if (rf & 1) {
|
|
41
|
+
i0.ɵɵelementStart(0, "span", 12);
|
|
42
|
+
i0.ɵɵtext(1);
|
|
43
|
+
i0.ɵɵelementEnd();
|
|
44
|
+
} if (rf & 2) {
|
|
45
|
+
const ctx_r0 = i0.ɵɵnextContext(3);
|
|
46
|
+
i0.ɵɵattribute("aria-label", ctx_r0.modifiedLabel());
|
|
47
|
+
i0.ɵɵadvance();
|
|
48
|
+
i0.ɵɵtextInterpolate(ctx_r0.modifiedText());
|
|
49
|
+
} }
|
|
50
|
+
function FileCard_Conditional_0_Conditional_6_Template(rf, ctx) { if (rf & 1) {
|
|
51
|
+
i0.ɵɵelementStart(0, "div", 9);
|
|
52
|
+
i0.ɵɵconditionalCreate(1, FileCard_Conditional_0_Conditional_6_Conditional_1_Template, 2, 2, "span", 10);
|
|
53
|
+
i0.ɵɵconditionalCreate(2, FileCard_Conditional_0_Conditional_6_Conditional_2_Template, 2, 0, "span", 11);
|
|
54
|
+
i0.ɵɵconditionalCreate(3, FileCard_Conditional_0_Conditional_6_Conditional_3_Template, 2, 2, "span", 12);
|
|
55
|
+
i0.ɵɵelementEnd();
|
|
56
|
+
} if (rf & 2) {
|
|
57
|
+
const ctx_r0 = i0.ɵɵnextContext(2);
|
|
58
|
+
i0.ɵɵclassMap(ctx_r0.metaClasses());
|
|
59
|
+
i0.ɵɵadvance();
|
|
60
|
+
i0.ɵɵconditional(ctx_r0.sizeText() ? 1 : -1);
|
|
61
|
+
i0.ɵɵadvance();
|
|
62
|
+
i0.ɵɵconditional(ctx_r0.sizeText() && ctx_r0.modifiedText() ? 2 : -1);
|
|
63
|
+
i0.ɵɵadvance();
|
|
64
|
+
i0.ɵɵconditional(ctx_r0.modifiedText() ? 3 : -1);
|
|
65
|
+
} }
|
|
66
|
+
function FileCard_Conditional_0_Template(rf, ctx) { if (rf & 1) {
|
|
67
|
+
i0.ɵɵelementStart(0, "div", 3);
|
|
68
|
+
i0.ɵɵconditionalCreate(1, FileCard_Conditional_0_Conditional_1_Template, 1, 9, "img", 4)(2, FileCard_Conditional_0_Conditional_2_Template, 1, 2, "svg", 5);
|
|
69
|
+
i0.ɵɵelementEnd();
|
|
70
|
+
i0.ɵɵelementStart(3, "div")(4, "div", 6);
|
|
71
|
+
i0.ɵɵtext(5);
|
|
72
|
+
i0.ɵɵelementEnd();
|
|
73
|
+
i0.ɵɵconditionalCreate(6, FileCard_Conditional_0_Conditional_6_Template, 4, 5, "div", 7);
|
|
74
|
+
i0.ɵɵelementEnd();
|
|
75
|
+
} if (rf & 2) {
|
|
76
|
+
const ctx_r0 = i0.ɵɵnextContext();
|
|
77
|
+
i0.ɵɵclassMap(ctx_r0.iconClasses());
|
|
78
|
+
i0.ɵɵadvance();
|
|
79
|
+
i0.ɵɵconditional(ctx_r0.file.thumbnail ? 1 : 2);
|
|
80
|
+
i0.ɵɵadvance(2);
|
|
81
|
+
i0.ɵɵclassMap(ctx_r0.stackClasses());
|
|
82
|
+
i0.ɵɵstyleProp("flex", "1")("min-width", "0");
|
|
83
|
+
i0.ɵɵadvance();
|
|
84
|
+
i0.ɵɵclassMap(ctx_r0.nameClasses());
|
|
85
|
+
i0.ɵɵstyleProp("overflow", "hidden")("text-overflow", "ellipsis")("white-space", "nowrap");
|
|
86
|
+
i0.ɵɵadvance();
|
|
87
|
+
i0.ɵɵtextInterpolate(ctx_r0.file.name);
|
|
88
|
+
i0.ɵɵadvance();
|
|
89
|
+
i0.ɵɵconditional(ctx_r0.hasMeta() ? 6 : -1);
|
|
90
|
+
} }
|
|
91
|
+
function FileCard_Conditional_1_Conditional_1_Template(rf, ctx) { if (rf & 1) {
|
|
92
|
+
i0.ɵɵelement(0, "img", 8);
|
|
93
|
+
} if (rf & 2) {
|
|
94
|
+
const ctx_r0 = i0.ɵɵnextContext(2);
|
|
95
|
+
i0.ɵɵstyleProp("width", "100%")("height", "100%")("object-fit", "cover")("border-radius", "4px");
|
|
96
|
+
i0.ɵɵproperty("src", ctx_r0.file.thumbnail);
|
|
97
|
+
} }
|
|
98
|
+
function FileCard_Conditional_1_Conditional_2_Template(rf, ctx) { if (rf & 1) {
|
|
99
|
+
i0.ɵɵnamespaceSVG();
|
|
100
|
+
i0.ɵɵelement(0, "svg", 5);
|
|
101
|
+
} if (rf & 2) {
|
|
102
|
+
const ctx_r0 = i0.ɵɵnextContext(2);
|
|
103
|
+
i0.ɵɵproperty("kind", ctx_r0.file.kind)("size", 48);
|
|
104
|
+
} }
|
|
105
|
+
function FileCard_Conditional_1_Conditional_5_Conditional_1_Template(rf, ctx) { if (rf & 1) {
|
|
106
|
+
i0.ɵɵelementStart(0, "span", 10);
|
|
107
|
+
i0.ɵɵtext(1);
|
|
108
|
+
i0.ɵɵelementEnd();
|
|
109
|
+
} if (rf & 2) {
|
|
110
|
+
const ctx_r0 = i0.ɵɵnextContext(3);
|
|
111
|
+
i0.ɵɵattribute("aria-label", ctx_r0.sizeLabel());
|
|
112
|
+
i0.ɵɵadvance();
|
|
113
|
+
i0.ɵɵtextInterpolate(ctx_r0.sizeText());
|
|
114
|
+
} }
|
|
115
|
+
function FileCard_Conditional_1_Conditional_5_Conditional_2_Template(rf, ctx) { if (rf & 1) {
|
|
116
|
+
i0.ɵɵelementStart(0, "span", 11);
|
|
117
|
+
i0.ɵɵtext(1, "\u00B7");
|
|
118
|
+
i0.ɵɵelementEnd();
|
|
119
|
+
} }
|
|
120
|
+
function FileCard_Conditional_1_Conditional_5_Conditional_3_Template(rf, ctx) { if (rf & 1) {
|
|
121
|
+
i0.ɵɵelementStart(0, "span", 12);
|
|
122
|
+
i0.ɵɵtext(1);
|
|
123
|
+
i0.ɵɵelementEnd();
|
|
124
|
+
} if (rf & 2) {
|
|
125
|
+
const ctx_r0 = i0.ɵɵnextContext(3);
|
|
126
|
+
i0.ɵɵattribute("aria-label", ctx_r0.modifiedLabel());
|
|
127
|
+
i0.ɵɵadvance();
|
|
128
|
+
i0.ɵɵtextInterpolate(ctx_r0.modifiedText());
|
|
129
|
+
} }
|
|
130
|
+
function FileCard_Conditional_1_Conditional_5_Template(rf, ctx) { if (rf & 1) {
|
|
131
|
+
i0.ɵɵelementStart(0, "div", 9);
|
|
132
|
+
i0.ɵɵconditionalCreate(1, FileCard_Conditional_1_Conditional_5_Conditional_1_Template, 2, 2, "span", 10);
|
|
133
|
+
i0.ɵɵconditionalCreate(2, FileCard_Conditional_1_Conditional_5_Conditional_2_Template, 2, 0, "span", 11);
|
|
134
|
+
i0.ɵɵconditionalCreate(3, FileCard_Conditional_1_Conditional_5_Conditional_3_Template, 2, 2, "span", 12);
|
|
135
|
+
i0.ɵɵelementEnd();
|
|
136
|
+
} if (rf & 2) {
|
|
137
|
+
const ctx_r0 = i0.ɵɵnextContext(2);
|
|
138
|
+
i0.ɵɵclassMap(ctx_r0.metaClasses());
|
|
139
|
+
i0.ɵɵadvance();
|
|
140
|
+
i0.ɵɵconditional(ctx_r0.sizeText() ? 1 : -1);
|
|
141
|
+
i0.ɵɵadvance();
|
|
142
|
+
i0.ɵɵconditional(ctx_r0.sizeText() && ctx_r0.modifiedText() ? 2 : -1);
|
|
143
|
+
i0.ɵɵadvance();
|
|
144
|
+
i0.ɵɵconditional(ctx_r0.modifiedText() ? 3 : -1);
|
|
145
|
+
} }
|
|
146
|
+
function FileCard_Conditional_1_Template(rf, ctx) { if (rf & 1) {
|
|
147
|
+
i0.ɵɵelementStart(0, "div", 3);
|
|
148
|
+
i0.ɵɵconditionalCreate(1, FileCard_Conditional_1_Conditional_1_Template, 1, 9, "img", 4)(2, FileCard_Conditional_1_Conditional_2_Template, 1, 2, "svg", 5);
|
|
149
|
+
i0.ɵɵelementEnd();
|
|
150
|
+
i0.ɵɵelementStart(3, "div", 6);
|
|
151
|
+
i0.ɵɵtext(4);
|
|
152
|
+
i0.ɵɵelementEnd();
|
|
153
|
+
i0.ɵɵconditionalCreate(5, FileCard_Conditional_1_Conditional_5_Template, 4, 5, "div", 7);
|
|
154
|
+
} if (rf & 2) {
|
|
155
|
+
const ctx_r0 = i0.ɵɵnextContext();
|
|
156
|
+
i0.ɵɵclassMap(ctx_r0.gridIconClasses());
|
|
157
|
+
i0.ɵɵstyleProp("aspect-ratio", "1 / 1")("width", "100%");
|
|
158
|
+
i0.ɵɵadvance();
|
|
159
|
+
i0.ɵɵconditional(ctx_r0.file.thumbnail ? 1 : 2);
|
|
160
|
+
i0.ɵɵadvance(2);
|
|
161
|
+
i0.ɵɵclassMap(ctx_r0.nameClasses());
|
|
162
|
+
i0.ɵɵstyleProp("overflow", "hidden")("text-overflow", "ellipsis")("white-space", "nowrap");
|
|
163
|
+
i0.ɵɵadvance();
|
|
164
|
+
i0.ɵɵtextInterpolate(ctx_r0.file.name);
|
|
165
|
+
i0.ɵɵadvance();
|
|
166
|
+
i0.ɵɵconditional(ctx_r0.hasMeta() ? 5 : -1);
|
|
167
|
+
} }
|
|
168
|
+
function FileCard_Conditional_2_Template(rf, ctx) { if (rf & 1) {
|
|
169
|
+
const _r2 = i0.ɵɵgetCurrentView();
|
|
170
|
+
i0.ɵɵelementStart(0, "button", 13);
|
|
171
|
+
i0.ɵɵlistener("click", function FileCard_Conditional_2_Template_button_click_0_listener($event) { i0.ɵɵrestoreView(_r2); const ctx_r0 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r0.handleClick($event)); });
|
|
172
|
+
i0.ɵɵelementEnd();
|
|
173
|
+
} if (rf & 2) {
|
|
174
|
+
const ctx_r0 = i0.ɵɵnextContext();
|
|
175
|
+
i0.ɵɵclassMap(ctx_r0.selectClasses());
|
|
176
|
+
i0.ɵɵstyleProp("background", "transparent")("border", "none")("padding", "0");
|
|
177
|
+
i0.ɵɵattribute("aria-label", ctx_r0.ariaLabel())("aria-pressed", ctx_r0.selected ? "true" : "false");
|
|
178
|
+
} }
|
|
179
|
+
/**
|
|
180
|
+
* FileCard component.
|
|
181
|
+
*
|
|
182
|
+
* File representation card — icon (or thumbnail), filename, formatted size,
|
|
183
|
+
* relative modified date, and an optional trailing actions slot. The host IS
|
|
184
|
+
* the root `<div>` (`div[mol-file-card]`), matching React's root exactly.
|
|
185
|
+
*
|
|
186
|
+
* Two layouts:
|
|
187
|
+
* - `'grid'` (default) — square tile with the icon/thumbnail stacked above
|
|
188
|
+
* the metadata.
|
|
189
|
+
* - `'row'` — horizontal line item with the icon on the left, metadata in
|
|
190
|
+
* the middle, and the actions slot on the right.
|
|
191
|
+
*
|
|
192
|
+
* The card's select control: a transparent native button covering the card
|
|
193
|
+
* (Enter / Space activate it natively), above the content and below the
|
|
194
|
+
* actions slot. A sibling of the actions, not their wrapper, so the action
|
|
195
|
+
* buttons stay reachable controls (a button's children are presentational).
|
|
196
|
+
* The actions are projected content (`[slot=actions]`); their wrapper
|
|
197
|
+
* detaches from the DOM whenever React would not render the region.
|
|
198
|
+
*/
|
|
199
|
+
export class FileCard {
|
|
200
|
+
/** The file to render (required, as in React's props). */
|
|
201
|
+
file;
|
|
202
|
+
/** Selected highlight state. */
|
|
203
|
+
selected;
|
|
204
|
+
/** Click handler; React's `onClick` (a click on the select button). */
|
|
205
|
+
onClick;
|
|
206
|
+
/** Context-menu (right-click) handler; React's `onContextMenu`. */
|
|
207
|
+
onContextMenu;
|
|
208
|
+
/** Layout — `'grid'` (default) or `'row'`. */
|
|
209
|
+
layout;
|
|
210
|
+
/** Extra classes merged onto the root element. */
|
|
211
|
+
className;
|
|
212
|
+
/** Override the root `data-mol-id` (defaults to `file-card-${file.id}`). */
|
|
213
|
+
dataMolId;
|
|
214
|
+
/** Reference "now" for relative-time formatting. */
|
|
215
|
+
now;
|
|
216
|
+
/** The projected actions wrapper (always in the template; detached when unused). */
|
|
217
|
+
actionsSlot;
|
|
218
|
+
sync = new SlotWrapper(inject(ElementRef), inject(Renderer2));
|
|
219
|
+
hasActions = false;
|
|
220
|
+
/** The `t` function, captured in the injection context at construction. */
|
|
221
|
+
t;
|
|
222
|
+
constructor() {
|
|
223
|
+
this.t = useTranslation().t;
|
|
224
|
+
}
|
|
225
|
+
/**
|
|
226
|
+
* The current class map.
|
|
227
|
+
* @returns The UIClassMap.
|
|
228
|
+
*/
|
|
229
|
+
cm() {
|
|
230
|
+
return getClassMap();
|
|
231
|
+
}
|
|
232
|
+
/**
|
|
233
|
+
* The root class list: the layout's frame tokens, the relative position
|
|
234
|
+
* when clickable (React's select button is absolutely positioned over it),
|
|
235
|
+
* and the caller's `className`.
|
|
236
|
+
* @returns The class string.
|
|
237
|
+
*/
|
|
238
|
+
classes() {
|
|
239
|
+
return this.layout === 'row'
|
|
240
|
+
? this.cm().cn(this.cm().flex({ align: 'center', gap: 'md' }), this.cm().sp('p', 2), this.onClick ? this.cm().position('relative') : undefined, this.className)
|
|
241
|
+
: this.cm().cn(this.cm().stack(1), this.cm().sp('p', 3), this.onClick ? this.cm().position('relative') : undefined, this.className);
|
|
242
|
+
}
|
|
243
|
+
/**
|
|
244
|
+
* The human-readable kind label (one literal t() key per FileKind).
|
|
245
|
+
* @returns The localized kind label.
|
|
246
|
+
*/
|
|
247
|
+
kindLabel() {
|
|
248
|
+
switch (this.file.kind) {
|
|
249
|
+
case 'image':
|
|
250
|
+
return this.t('file-card.kind.image', {}, { defaultValue: 'Image file' });
|
|
251
|
+
case 'video':
|
|
252
|
+
return this.t('file-card.kind.video', {}, { defaultValue: 'Video file' });
|
|
253
|
+
case 'audio':
|
|
254
|
+
return this.t('file-card.kind.audio', {}, { defaultValue: 'Audio file' });
|
|
255
|
+
case 'document':
|
|
256
|
+
return this.t('file-card.kind.document', {}, { defaultValue: 'Document' });
|
|
257
|
+
case 'archive':
|
|
258
|
+
return this.t('file-card.kind.archive', {}, { defaultValue: 'Archive' });
|
|
259
|
+
case 'code':
|
|
260
|
+
return this.t('file-card.kind.code', {}, { defaultValue: 'Code file' });
|
|
261
|
+
case 'folder':
|
|
262
|
+
return this.t('file-card.kind.folder', {}, { defaultValue: 'Folder' });
|
|
263
|
+
case 'other':
|
|
264
|
+
return this.t('file-card.kind.other', {}, { defaultValue: 'File' });
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
/**
|
|
268
|
+
* The size's unit word via `t()`, with the number {@link sizeParts} already
|
|
269
|
+
* displayed: one literal t() key per `SizeUnit` — the same pattern as
|
|
270
|
+
* {@link kindLabel} — so the i18n gate can verify every key exists in the
|
|
271
|
+
* locale bond, and the `{{n}}` placeholder lets a translation move the
|
|
272
|
+
* number or rename the token (French octets, Russian КБ).
|
|
273
|
+
* @param size - The size's displayed number and unit.
|
|
274
|
+
* @returns The localized size text.
|
|
275
|
+
*/
|
|
276
|
+
sizeUnitText(size) {
|
|
277
|
+
const t = this.t;
|
|
278
|
+
switch (size.unit) {
|
|
279
|
+
case 'B':
|
|
280
|
+
return t('file-card.size.b', { n: size.n }, { defaultValue: '{{n}} B' });
|
|
281
|
+
case 'KB':
|
|
282
|
+
return t('file-card.size.kb', { n: size.n }, { defaultValue: '{{n}} KB' });
|
|
283
|
+
case 'MB':
|
|
284
|
+
return t('file-card.size.mb', { n: size.n }, { defaultValue: '{{n}} MB' });
|
|
285
|
+
case 'GB':
|
|
286
|
+
return t('file-card.size.gb', { n: size.n }, { defaultValue: '{{n}} GB' });
|
|
287
|
+
case 'TB':
|
|
288
|
+
return t('file-card.size.tb', { n: size.n }, { defaultValue: '{{n}} TB' });
|
|
289
|
+
case 'PB':
|
|
290
|
+
return t('file-card.size.pb', { n: size.n }, { defaultValue: '{{n}} PB' });
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
/**
|
|
294
|
+
* The formatted size text (empty for folders).
|
|
295
|
+
* @returns The size text.
|
|
296
|
+
*/
|
|
297
|
+
sizeText() {
|
|
298
|
+
if (this.file.kind === 'folder')
|
|
299
|
+
return '';
|
|
300
|
+
return this.sizeUnitText(sizeParts(this.file.size));
|
|
301
|
+
}
|
|
302
|
+
/**
|
|
303
|
+
* The size span's accessible label.
|
|
304
|
+
* @returns The localized label.
|
|
305
|
+
*/
|
|
306
|
+
sizeLabel() {
|
|
307
|
+
return this.sizeText()
|
|
308
|
+
? this.t('file-card.aria.size', { size: this.sizeText() }, { defaultValue: 'Size {{size}}' })
|
|
309
|
+
: '';
|
|
310
|
+
}
|
|
311
|
+
/**
|
|
312
|
+
* The relative modified text via the translation keys (React's
|
|
313
|
+
* `relativeText`).
|
|
314
|
+
* @returns The localized relative-time string.
|
|
315
|
+
*/
|
|
316
|
+
modifiedText() {
|
|
317
|
+
if (!this.file.modifiedAt)
|
|
318
|
+
return '';
|
|
319
|
+
const at = this.file.modifiedAt;
|
|
320
|
+
const t = this.t;
|
|
321
|
+
const bucket = relativeBucket(at, this.now);
|
|
322
|
+
switch (bucket.kind) {
|
|
323
|
+
case 'just-now':
|
|
324
|
+
return t('file-card.modified.just-now', {}, { defaultValue: 'just now' });
|
|
325
|
+
case 'minutes':
|
|
326
|
+
return t(bucket.n === 1 ? 'file-card.modified.minute-one' : 'file-card.modified.minute-other', { count: bucket.n }, { defaultValue: bucket.n === 1 ? '1 min ago' : `${bucket.n} min ago` });
|
|
327
|
+
case 'hours':
|
|
328
|
+
return t(bucket.n === 1 ? 'file-card.modified.hour-one' : 'file-card.modified.hour-other', { count: bucket.n }, { defaultValue: bucket.n === 1 ? '1 hr ago' : `${bucket.n} hr ago` });
|
|
329
|
+
case 'days':
|
|
330
|
+
return t(bucket.n === 1 ? 'file-card.modified.day-one' : 'file-card.modified.day-other', { count: bucket.n }, { defaultValue: bucket.n === 1 ? 'yesterday' : `${bucket.n} days ago` });
|
|
331
|
+
case 'weeks':
|
|
332
|
+
return t(bucket.n === 1 ? 'file-card.modified.week-one' : 'file-card.modified.week-other', { count: bucket.n }, { defaultValue: bucket.n === 1 ? '1 wk ago' : `${bucket.n} wk ago` });
|
|
333
|
+
case 'months':
|
|
334
|
+
return t(bucket.n === 1 ? 'file-card.modified.month-one' : 'file-card.modified.month-other', { count: bucket.n }, { defaultValue: bucket.n === 1 ? '1 mo ago' : `${bucket.n} mo ago` });
|
|
335
|
+
case 'absolute':
|
|
336
|
+
return bucket.iso;
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
/**
|
|
340
|
+
* The modified span's accessible label.
|
|
341
|
+
* @returns The localized label.
|
|
342
|
+
*/
|
|
343
|
+
modifiedLabel() {
|
|
344
|
+
return this.modifiedText()
|
|
345
|
+
? this.t('file-card.aria.modified', { when: this.modifiedText() }, { defaultValue: 'Modified {{when}}' })
|
|
346
|
+
: '';
|
|
347
|
+
}
|
|
348
|
+
/**
|
|
349
|
+
* The root's aria label ("{{name}}, {{kind}}").
|
|
350
|
+
* @returns The localized label.
|
|
351
|
+
*/
|
|
352
|
+
ariaLabel() {
|
|
353
|
+
return this.t('file-card.aria.root', { name: this.file.name, kind: this.kindLabel() }, { defaultValue: '{{name}}, {{kind}}' });
|
|
354
|
+
}
|
|
355
|
+
/**
|
|
356
|
+
* The root `data-mol-id` (React's `dataMolId ?? `file-card-${file.id}``).
|
|
357
|
+
* @returns The marker id.
|
|
358
|
+
*/
|
|
359
|
+
rootMolId() {
|
|
360
|
+
return this.dataMolId ?? `file-card-${this.file.id}`;
|
|
361
|
+
}
|
|
362
|
+
/**
|
|
363
|
+
* Whether the meta row renders (React's `{(sizeText || modifiedText) && …}`).
|
|
364
|
+
* @returns True when either text is present.
|
|
365
|
+
*/
|
|
366
|
+
hasMeta() {
|
|
367
|
+
return this.sizeText() !== '' || this.modifiedText() !== '';
|
|
368
|
+
}
|
|
369
|
+
/**
|
|
370
|
+
* The row icon wrapper's class.
|
|
371
|
+
* @returns The class string.
|
|
372
|
+
*/
|
|
373
|
+
iconClasses() {
|
|
374
|
+
return this.cm().cn(this.cm().shrink0);
|
|
375
|
+
}
|
|
376
|
+
/**
|
|
377
|
+
* The grid icon wrapper's class.
|
|
378
|
+
* @returns The class string.
|
|
379
|
+
*/
|
|
380
|
+
gridIconClasses() {
|
|
381
|
+
return this.cm().cn(this.cm().flex({ align: 'center', justify: 'center' }));
|
|
382
|
+
}
|
|
383
|
+
/**
|
|
384
|
+
* The row content stack's class.
|
|
385
|
+
* @returns The class string.
|
|
386
|
+
*/
|
|
387
|
+
stackClasses() {
|
|
388
|
+
return this.cm().cn(this.cm().stack(0));
|
|
389
|
+
}
|
|
390
|
+
/**
|
|
391
|
+
* The filename's class.
|
|
392
|
+
* @returns The class string.
|
|
393
|
+
*/
|
|
394
|
+
nameClasses() {
|
|
395
|
+
return this.cm().cn(this.cm().textSize('sm'), this.cm().fontWeight('semibold'));
|
|
396
|
+
}
|
|
397
|
+
/**
|
|
398
|
+
* The meta row's class.
|
|
399
|
+
* @returns The class string.
|
|
400
|
+
*/
|
|
401
|
+
metaClasses() {
|
|
402
|
+
return this.cm().cn(this.cm().flex({ align: 'center', gap: 'sm' }), this.cm().textSize('xs'));
|
|
403
|
+
}
|
|
404
|
+
/**
|
|
405
|
+
* The select button's class.
|
|
406
|
+
* @returns The class string.
|
|
407
|
+
*/
|
|
408
|
+
selectClasses() {
|
|
409
|
+
return this.cm().cn(this.cm().position('absolute'), this.cm().inset0, this.cm().cursorPointer);
|
|
410
|
+
}
|
|
411
|
+
/**
|
|
412
|
+
* The actions wrapper's class (layout-dependent, as React's is).
|
|
413
|
+
* @returns The class string.
|
|
414
|
+
*/
|
|
415
|
+
actionsClasses() {
|
|
416
|
+
return this.layout === 'row'
|
|
417
|
+
? this.cm().cn(this.cm().shrink0, this.cm().position('relative'))
|
|
418
|
+
: this.cm().cn(this.cm().flex({ align: 'center', justify: 'end', gap: 'sm' }), this.cm().position('relative'));
|
|
419
|
+
}
|
|
420
|
+
/**
|
|
421
|
+
* Forward a body activation (a click on the select button, or Enter / Space
|
|
422
|
+
* on it) to the consumer.
|
|
423
|
+
* @param event - DOM mouse event.
|
|
424
|
+
*/
|
|
425
|
+
handleClick(event) {
|
|
426
|
+
this.onClick?.(this.file, event);
|
|
427
|
+
}
|
|
428
|
+
/**
|
|
429
|
+
* Forward right-click to the consumer.
|
|
430
|
+
* @param event - DOM mouse event.
|
|
431
|
+
*/
|
|
432
|
+
handleContextMenu(event) {
|
|
433
|
+
if (this.onContextMenu)
|
|
434
|
+
this.onContextMenu(this.file, event);
|
|
435
|
+
}
|
|
436
|
+
/** Reads slot content presence once the projection is known. */
|
|
437
|
+
ngAfterViewInit() {
|
|
438
|
+
const el = this.actionsSlot?.nativeElement;
|
|
439
|
+
this.hasActions = el ? hasNodes(el) : false;
|
|
440
|
+
this.syncWrappers();
|
|
441
|
+
}
|
|
442
|
+
/** Re-reconciles the wrapper when layout or projection changes. */
|
|
443
|
+
ngDoCheck() {
|
|
444
|
+
this.syncWrappers();
|
|
445
|
+
}
|
|
446
|
+
/** Applies React's `{actions && <div>…}` wrapper condition. */
|
|
447
|
+
syncWrappers() {
|
|
448
|
+
this.sync.sync(this.actionsSlot?.nativeElement, this.hasActions);
|
|
449
|
+
}
|
|
450
|
+
static ɵfac = function FileCard_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || FileCard)(); };
|
|
451
|
+
static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: FileCard, selectors: [["div", "mol-file-card", ""]], viewQuery: function FileCard_Query(rf, ctx) { if (rf & 1) {
|
|
452
|
+
i0.ɵɵviewQuery(_c0, 5);
|
|
453
|
+
} if (rf & 2) {
|
|
454
|
+
let _t;
|
|
455
|
+
i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.actionsSlot = _t.first);
|
|
456
|
+
} }, hostVars: 6, hostBindings: function FileCard_HostBindings(rf, ctx) { if (rf & 1) {
|
|
457
|
+
i0.ɵɵlistener("contextmenu", function FileCard_contextmenu_HostBindingHandler($event) { return ctx.handleContextMenu($event); });
|
|
458
|
+
} if (rf & 2) {
|
|
459
|
+
i0.ɵɵattribute("role", "group")("aria-label", ctx.ariaLabel())("data-mol-id", ctx.rootMolId())("data-selected", ctx.selected ? "true" : null);
|
|
460
|
+
i0.ɵɵclassMap(ctx.classes());
|
|
461
|
+
} }, inputs: { file: "file", selected: "selected", onClick: "onClick", onContextMenu: "onContextMenu", layout: "layout", className: "className", dataMolId: "dataMolId", now: "now" }, ngContentSelectors: _c2, decls: 6, vars: 4, consts: [["actionsSlot", ""], ["type", "button", "data-mol-id", "file-card-select", 3, "class", "background", "border", "padding"], ["data-mol-id", "file-card-actions"], ["data-mol-id", "file-card-icon"], ["alt", "", 3, "src", "width", "height", "objectFit", "borderRadius"], ["mol-file-icon", "", 3, "kind", "size"], ["data-mol-id", "file-card-name"], ["data-mol-id", "file-card-meta", 3, "class"], ["alt", "", 3, "src"], ["data-mol-id", "file-card-meta"], ["data-mol-id", "file-card-size"], ["aria-hidden", "true"], ["data-mol-id", "file-card-modified"], ["type", "button", "data-mol-id", "file-card-select", 3, "click"]], template: function FileCard_Template(rf, ctx) { if (rf & 1) {
|
|
462
|
+
i0.ɵɵprojectionDef(_c1);
|
|
463
|
+
i0.ɵɵconditionalCreate(0, FileCard_Conditional_0_Template, 7, 19)(1, FileCard_Conditional_1_Template, 6, 17);
|
|
464
|
+
i0.ɵɵconditionalCreate(2, FileCard_Conditional_2_Template, 1, 10, "button", 1);
|
|
465
|
+
i0.ɵɵelementStart(3, "div", 2, 0);
|
|
466
|
+
i0.ɵɵprojection(5);
|
|
467
|
+
i0.ɵɵelementEnd();
|
|
468
|
+
} if (rf & 2) {
|
|
469
|
+
i0.ɵɵconditional(ctx.layout === "row" ? 0 : 1);
|
|
470
|
+
i0.ɵɵadvance(2);
|
|
471
|
+
i0.ɵɵconditional(ctx.onClick ? 2 : -1);
|
|
472
|
+
i0.ɵɵadvance();
|
|
473
|
+
i0.ɵɵclassMap(ctx.actionsClasses());
|
|
474
|
+
} }, dependencies: [FileIcon], encapsulation: 2 });
|
|
475
|
+
}
|
|
476
|
+
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(FileCard, [{
|
|
477
|
+
type: Component,
|
|
478
|
+
args: [{
|
|
479
|
+
selector: 'div[mol-file-card]',
|
|
480
|
+
standalone: true,
|
|
481
|
+
imports: [FileIcon],
|
|
482
|
+
inputs: [
|
|
483
|
+
'file',
|
|
484
|
+
'selected',
|
|
485
|
+
'onClick',
|
|
486
|
+
'onContextMenu',
|
|
487
|
+
'layout',
|
|
488
|
+
'className',
|
|
489
|
+
'dataMolId',
|
|
490
|
+
'now',
|
|
491
|
+
],
|
|
492
|
+
host: {
|
|
493
|
+
'[class]': 'classes()',
|
|
494
|
+
'[attr.role]': '"group"',
|
|
495
|
+
'[attr.aria-label]': 'ariaLabel()',
|
|
496
|
+
'[attr.data-mol-id]': 'rootMolId()',
|
|
497
|
+
'[attr.data-selected]': 'selected ? "true" : null',
|
|
498
|
+
'(contextmenu)': 'handleContextMenu($event)',
|
|
499
|
+
},
|
|
500
|
+
// The template's whitespace is semantic: Angular removes whitespace-only
|
|
501
|
+
// text nodes between elements, and every element is glued to the previous
|
|
502
|
+
// tag's close so no stray text nodes render where React's JSX has none.
|
|
503
|
+
// The select button and the actions wrapper sit after the layout branches:
|
|
504
|
+
// they follow the content in BOTH layouts, as React's JSX does.
|
|
505
|
+
// prettier-ignore
|
|
506
|
+
template: `@if (layout === 'row') {<div [class]="iconClasses()" data-mol-id="file-card-icon">@if (file.thumbnail) {<img [src]="file.thumbnail" alt="" [style.width]="'40px'" [style.height]="'40px'" [style.objectFit]="'cover'" [style.borderRadius]="'4px'" />}@else {<svg mol-file-icon [kind]="file.kind" [size]="28" />}</div><div [class]="stackClasses()" [style.flex]="'1'" [style.minWidth]="'0'"><div [class]="nameClasses()" data-mol-id="file-card-name" [style.overflow]="'hidden'" [style.textOverflow]="'ellipsis'" [style.whiteSpace]="'nowrap'">{{ file.name }}</div>@if (hasMeta()) {<div [class]="metaClasses()" data-mol-id="file-card-meta">@if (sizeText()) {<span [attr.aria-label]="sizeLabel()" data-mol-id="file-card-size">{{ sizeText() }}</span>}@if (sizeText() && modifiedText()) {<span aria-hidden="true">·</span>}@if (modifiedText()) {<span [attr.aria-label]="modifiedLabel()" data-mol-id="file-card-modified">{{ modifiedText() }}</span>}</div>}</div>}@else {<div [class]="gridIconClasses()" data-mol-id="file-card-icon" [style.aspectRatio]="'1 / 1'" [style.width]="'100%'">@if (file.thumbnail) {<img [src]="file.thumbnail" alt="" [style.width]="'100%'" [style.height]="'100%'" [style.objectFit]="'cover'" [style.borderRadius]="'4px'" />}@else {<svg mol-file-icon [kind]="file.kind" [size]="48" />}</div><div [class]="nameClasses()" data-mol-id="file-card-name" [style.overflow]="'hidden'" [style.textOverflow]="'ellipsis'" [style.whiteSpace]="'nowrap'">{{ file.name }}</div>@if (hasMeta()) {<div [class]="metaClasses()" data-mol-id="file-card-meta">@if (sizeText()) {<span [attr.aria-label]="sizeLabel()" data-mol-id="file-card-size">{{ sizeText() }}</span>}@if (sizeText() && modifiedText()) {<span aria-hidden="true">·</span>}@if (modifiedText()) {<span [attr.aria-label]="modifiedLabel()" data-mol-id="file-card-modified">{{ modifiedText() }}</span>}</div>}}@if (onClick) {<button type="button" [attr.aria-label]="ariaLabel()" [attr.aria-pressed]="selected ? 'true' : 'false'" data-mol-id="file-card-select" [class]="selectClasses()" [style.background]="'transparent'" [style.border]="'none'" [style.padding]="'0'" (click)="handleClick($event)"></button>}<div [class]="actionsClasses()" data-mol-id="file-card-actions" #actionsSlot><ng-content select="[slot=actions]"></ng-content></div>`,
|
|
507
|
+
}]
|
|
508
|
+
}], () => [], { actionsSlot: [{
|
|
509
|
+
type: ViewChild,
|
|
510
|
+
args: ['actionsSlot']
|
|
511
|
+
}] }); })();
|
|
512
|
+
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(FileCard, { className: "FileCard", filePath: "file-card.component.ts", lineNumber: 75 }); })();
|
|
513
|
+
//# sourceMappingURL=file-card.component.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file-card.component.js","sourceRoot":"","sources":["../src/file-card.component.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAEnF,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AACtD,OAAO,EAAE,WAAW,EAAmB,MAAM,kBAAkB,CAAA;AAC/D,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAA;AAEhE,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAA;AACnD,OAAO,EAAE,cAAc,EAAkB,SAAS,EAAE,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|
|
|
1
|
+
import type { FileKind } from './types.js';
|
|
2
|
+
import * as i0 from "@angular/core";
|
|
3
|
+
/**
|
|
4
|
+
* FileIcon component.
|
|
5
|
+
*
|
|
6
|
+
* Icon glyph for a file kind. Stroke-currentColor SVG so it inherits the
|
|
7
|
+
* surrounding text color (no ClassMap colors needed). The host IS the `<svg>`
|
|
8
|
+
* (`svg[mol-file-icon]`), matching React's root exactly.
|
|
9
|
+
*/
|
|
10
|
+
export declare class FileIcon {
|
|
11
|
+
/** File kind — picks the SVG glyph. */
|
|
12
|
+
kind: FileKind;
|
|
13
|
+
/** Pixel size of the rendered SVG (default 24). */
|
|
14
|
+
size?: number;
|
|
15
|
+
/** Optional aria-label. When omitted the icon is `aria-hidden`. */
|
|
16
|
+
ariaLabel?: string;
|
|
17
|
+
/**
|
|
18
|
+
* The rendered size (React's `size = 24` default parameter: a later-bound
|
|
19
|
+
* write of `undefined` must not erase the default).
|
|
20
|
+
* @returns The pixel size.
|
|
21
|
+
*/
|
|
22
|
+
attrSize(): number;
|
|
23
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<FileIcon, never>;
|
|
24
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<FileIcon, "svg[mol-file-icon]", never, { "kind": { "alias": "kind"; "required": false; }; "size": { "alias": "size"; "required": false; }; "ariaLabel": { "alias": "ariaLabel"; "required": false; }; }, {}, never, never, true, never>;
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=file-icon.component.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file-icon.component.d.ts","sourceRoot":"","sources":["../src/file-icon.component.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;;AAE1C;;;;;;GAMG;AACH,qBAkCa,QAAQ;IACnB,uCAAuC;IACvC,IAAI,EAAG,QAAQ,CAAA;IACf,mDAAmD;IACnD,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,mEAAmE;IACnE,SAAS,CAAC,EAAE,MAAM,CAAA;IAElB;;;;OAIG;IACH,QAAQ,IAAI,MAAM;yCAbP,QAAQ;2CAAR,QAAQ;CAgBpB"}
|