@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.
@@ -0,0 +1,173 @@
1
+ /**
2
+ * FileCard component (React parity).
3
+ *
4
+ * @module
5
+ */
6
+ import type { AfterViewInit, DoCheck } from '@angular/core';
7
+ import { ElementRef } from '@angular/core';
8
+ import { type UIClassMap } from '@molecule/app-ui';
9
+ import type { FileSummary } from './types.js';
10
+ import * as i0 from "@angular/core";
11
+ /**
12
+ * FileCard component.
13
+ *
14
+ * File representation card — icon (or thumbnail), filename, formatted size,
15
+ * relative modified date, and an optional trailing actions slot. The host IS
16
+ * the root `<div>` (`div[mol-file-card]`), matching React's root exactly.
17
+ *
18
+ * Two layouts:
19
+ * - `'grid'` (default) — square tile with the icon/thumbnail stacked above
20
+ * the metadata.
21
+ * - `'row'` — horizontal line item with the icon on the left, metadata in
22
+ * the middle, and the actions slot on the right.
23
+ *
24
+ * The card's select control: a transparent native button covering the card
25
+ * (Enter / Space activate it natively), above the content and below the
26
+ * actions slot. A sibling of the actions, not their wrapper, so the action
27
+ * buttons stay reachable controls (a button's children are presentational).
28
+ * The actions are projected content (`[slot=actions]`); their wrapper
29
+ * detaches from the DOM whenever React would not render the region.
30
+ */
31
+ export declare class FileCard implements AfterViewInit, DoCheck {
32
+ /** The file to render (required, as in React's props). */
33
+ file: FileSummary;
34
+ /** Selected highlight state. */
35
+ selected?: boolean;
36
+ /** Click handler; React's `onClick` (a click on the select button). */
37
+ onClick?: (file: FileSummary, event: MouseEvent) => void;
38
+ /** Context-menu (right-click) handler; React's `onContextMenu`. */
39
+ onContextMenu?: (file: FileSummary, event: MouseEvent) => void;
40
+ /** Layout — `'grid'` (default) or `'row'`. */
41
+ layout?: 'grid' | 'row';
42
+ /** Extra classes merged onto the root element. */
43
+ className?: string;
44
+ /** Override the root `data-mol-id` (defaults to `file-card-${file.id}`). */
45
+ dataMolId?: string;
46
+ /** Reference "now" for relative-time formatting. */
47
+ now?: Date;
48
+ /** The projected actions wrapper (always in the template; detached when unused). */
49
+ actionsSlot?: ElementRef<HTMLDivElement>;
50
+ private readonly sync;
51
+ private hasActions;
52
+ /** The `t` function, captured in the injection context at construction. */
53
+ private readonly t;
54
+ constructor();
55
+ /**
56
+ * The current class map.
57
+ * @returns The UIClassMap.
58
+ */
59
+ cm(): UIClassMap;
60
+ /**
61
+ * The root class list: the layout's frame tokens, the relative position
62
+ * when clickable (React's select button is absolutely positioned over it),
63
+ * and the caller's `className`.
64
+ * @returns The class string.
65
+ */
66
+ classes(): string;
67
+ /**
68
+ * The human-readable kind label (one literal t() key per FileKind).
69
+ * @returns The localized kind label.
70
+ */
71
+ kindLabel(): string;
72
+ /**
73
+ * The size's unit word via `t()`, with the number {@link sizeParts} already
74
+ * displayed: one literal t() key per `SizeUnit` — the same pattern as
75
+ * {@link kindLabel} — so the i18n gate can verify every key exists in the
76
+ * locale bond, and the `{{n}}` placeholder lets a translation move the
77
+ * number or rename the token (French octets, Russian КБ).
78
+ * @param size - The size's displayed number and unit.
79
+ * @returns The localized size text.
80
+ */
81
+ private sizeUnitText;
82
+ /**
83
+ * The formatted size text (empty for folders).
84
+ * @returns The size text.
85
+ */
86
+ sizeText(): string;
87
+ /**
88
+ * The size span's accessible label.
89
+ * @returns The localized label.
90
+ */
91
+ sizeLabel(): string;
92
+ /**
93
+ * The relative modified text via the translation keys (React's
94
+ * `relativeText`).
95
+ * @returns The localized relative-time string.
96
+ */
97
+ modifiedText(): string;
98
+ /**
99
+ * The modified span's accessible label.
100
+ * @returns The localized label.
101
+ */
102
+ modifiedLabel(): string;
103
+ /**
104
+ * The root's aria label ("{{name}}, {{kind}}").
105
+ * @returns The localized label.
106
+ */
107
+ ariaLabel(): string;
108
+ /**
109
+ * The root `data-mol-id` (React's `dataMolId ?? `file-card-${file.id}``).
110
+ * @returns The marker id.
111
+ */
112
+ rootMolId(): string;
113
+ /**
114
+ * Whether the meta row renders (React's `{(sizeText || modifiedText) && …}`).
115
+ * @returns True when either text is present.
116
+ */
117
+ hasMeta(): boolean;
118
+ /**
119
+ * The row icon wrapper's class.
120
+ * @returns The class string.
121
+ */
122
+ iconClasses(): string;
123
+ /**
124
+ * The grid icon wrapper's class.
125
+ * @returns The class string.
126
+ */
127
+ gridIconClasses(): string;
128
+ /**
129
+ * The row content stack's class.
130
+ * @returns The class string.
131
+ */
132
+ stackClasses(): string;
133
+ /**
134
+ * The filename's class.
135
+ * @returns The class string.
136
+ */
137
+ nameClasses(): string;
138
+ /**
139
+ * The meta row's class.
140
+ * @returns The class string.
141
+ */
142
+ metaClasses(): string;
143
+ /**
144
+ * The select button's class.
145
+ * @returns The class string.
146
+ */
147
+ selectClasses(): string;
148
+ /**
149
+ * The actions wrapper's class (layout-dependent, as React's is).
150
+ * @returns The class string.
151
+ */
152
+ actionsClasses(): string;
153
+ /**
154
+ * Forward a body activation (a click on the select button, or Enter / Space
155
+ * on it) to the consumer.
156
+ * @param event - DOM mouse event.
157
+ */
158
+ handleClick(event: MouseEvent): void;
159
+ /**
160
+ * Forward right-click to the consumer.
161
+ * @param event - DOM mouse event.
162
+ */
163
+ handleContextMenu(event: MouseEvent): void;
164
+ /** Reads slot content presence once the projection is known. */
165
+ ngAfterViewInit(): void;
166
+ /** Re-reconciles the wrapper when layout or projection changes. */
167
+ ngDoCheck(): void;
168
+ /** Applies React's `{actions && <div>…}` wrapper condition. */
169
+ private syncWrappers;
170
+ static ɵfac: i0.ɵɵFactoryDeclaration<FileCard, never>;
171
+ static ɵcmp: i0.ɵɵComponentDeclaration<FileCard, "div[mol-file-card]", never, { "file": { "alias": "file"; "required": false; }; "selected": { "alias": "selected"; "required": false; }; "onClick": { "alias": "onClick"; "required": false; }; "onContextMenu": { "alias": "onContextMenu"; "required": false; }; "layout": { "alias": "layout"; "required": false; }; "className": { "alias": "className"; "required": false; }; "dataMolId": { "alias": "dataMolId"; "required": false; }; "now": { "alias": "now"; "required": false; }; }, {}, never, ["[slot=actions]"], true, never>;
172
+ }
173
+ //# sourceMappingURL=file-card.component.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"file-card.component.d.ts","sourceRoot":"","sources":["../src/file-card.component.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AAC3D,OAAO,EAAa,UAAU,EAAgC,MAAM,eAAe,CAAA;AAGnF,OAAO,EAAe,KAAK,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAK/D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;;AAS7C;;;;;;;;;;;;;;;;;;;GAmBG;AACH,qBA8Ba,QAAS,YAAW,aAAa,EAAE,OAAO;IACrD,0DAA0D;IAC1D,IAAI,EAAG,WAAW,CAAA;IAClB,gCAAgC;IAChC,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,uEAAuE;IACvE,OAAO,CAAC,EAAE,CAAC,IAAI,EAAE,WAAW,EAAE,KAAK,EAAE,UAAU,KAAK,IAAI,CAAA;IACxD,mEAAmE;IACnE,aAAa,CAAC,EAAE,CAAC,IAAI,EAAE,WAAW,EAAE,KAAK,EAAE,UAAU,KAAK,IAAI,CAAA;IAC9D,8CAA8C;IAC9C,MAAM,CAAC,EAAE,MAAM,GAAG,KAAK,CAAA;IACvB,kDAAkD;IAClD,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,4EAA4E;IAC5E,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,oDAAoD;IACpD,GAAG,CAAC,EAAE,IAAI,CAAA;IAEV,oFAAoF;IAC1D,WAAW,CAAC,EAAE,UAAU,CAAC,cAAc,CAAC,CAAA;IAElE,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAyD;IAC9E,OAAO,CAAC,UAAU,CAAQ;IAE1B,2EAA2E;IAC3E,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAK;;IAMvB;;;OAGG;I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