@molecule/app-timeline-angular 0.0.0-stage → 0.0.1-stage
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 +10 -2
- package/dist/index.d.ts +65 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +65 -0
- package/dist/index.js.map +1 -0
- package/dist/slot-dom.d.ts +57 -0
- package/dist/slot-dom.d.ts.map +1 -0
- package/dist/slot-dom.js +100 -0
- package/dist/slot-dom.js.map +1 -0
- package/dist/timeline-date.component.d.ts +30 -0
- package/dist/timeline-date.component.d.ts.map +1 -0
- package/dist/timeline-date.component.js +63 -0
- package/dist/timeline-date.component.js.map +1 -0
- package/dist/timeline-event.component.d.ts +71 -0
- package/dist/timeline-event.component.d.ts.map +1 -0
- package/dist/timeline-event.component.js +180 -0
- package/dist/timeline-event.component.js.map +1 -0
- package/dist/timeline-rail.component.d.ts +63 -0
- package/dist/timeline-rail.component.d.ts.map +1 -0
- package/dist/timeline-rail.component.js +148 -0
- package/dist/timeline-rail.component.js.map +1 -0
- package/dist/timeline.component.d.ts +101 -0
- package/dist/timeline.component.d.ts.map +1 -0
- package/dist/timeline.component.js +227 -0
- package/dist/timeline.component.js.map +1 -0
- package/dist/types.d.ts +82 -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 +69 -4
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Timeline component (React parity).
|
|
3
|
+
*
|
|
4
|
+
* @module
|
|
5
|
+
*/
|
|
6
|
+
import { NgTemplateOutlet } from '@angular/common';
|
|
7
|
+
import { Component, ElementRef, inject, Renderer2, TemplateRef, ViewChild, } from '@angular/core';
|
|
8
|
+
import { getClassMap } from '@molecule/app-ui';
|
|
9
|
+
import { hasNodes, SlotGuard } from './slot-dom.js';
|
|
10
|
+
import { TimelineEvent } from './timeline-event.component.js';
|
|
11
|
+
import * as i0 from "@angular/core";
|
|
12
|
+
const _c0 = ["empty"];
|
|
13
|
+
const _c1 = ["list"];
|
|
14
|
+
const _c2 = [[["", "slot", "emptystate"]]];
|
|
15
|
+
const _c3 = ["[slot=emptyState]"];
|
|
16
|
+
const _forTrack0 = ($index, $item) => $item.id;
|
|
17
|
+
function Timeline_Conditional_2_Template(rf, ctx) { if (rf & 1) {
|
|
18
|
+
i0.ɵɵtext(0);
|
|
19
|
+
} if (rf & 2) {
|
|
20
|
+
i0.ɵɵtextInterpolate(ctx);
|
|
21
|
+
} }
|
|
22
|
+
function Timeline_Conditional_3_Template(rf, ctx) { if (rf & 1) {
|
|
23
|
+
i0.ɵɵelementContainer(0, 3);
|
|
24
|
+
} if (rf & 2) {
|
|
25
|
+
i0.ɵɵproperty("ngTemplateOutlet", ctx);
|
|
26
|
+
} }
|
|
27
|
+
function Timeline_For_8_Conditional_1_Template(rf, ctx) { if (rf & 1) {
|
|
28
|
+
i0.ɵɵelementContainer(0, 4);
|
|
29
|
+
} if (rf & 2) {
|
|
30
|
+
const ctx_r0 = i0.ɵɵnextContext();
|
|
31
|
+
const event_r2 = ctx_r0.$implicit;
|
|
32
|
+
const ɵ$index_11_r3 = ctx_r0.$index;
|
|
33
|
+
const ctx_r3 = i0.ɵɵnextContext();
|
|
34
|
+
i0.ɵɵproperty("ngTemplateOutlet", ctx)("ngTemplateOutletContext", ctx_r3.separatorContext(event_r2, ɵ$index_11_r3));
|
|
35
|
+
} }
|
|
36
|
+
function Timeline_For_8_Template(rf, ctx) { if (rf & 1) {
|
|
37
|
+
i0.ɵɵelementStart(0, "div");
|
|
38
|
+
i0.ɵɵconditionalCreate(1, Timeline_For_8_Conditional_1_Template, 1, 2, "ng-container", 4);
|
|
39
|
+
i0.ɵɵelement(2, "div", 5);
|
|
40
|
+
i0.ɵɵelementEnd();
|
|
41
|
+
} if (rf & 2) {
|
|
42
|
+
let tmp_13_0;
|
|
43
|
+
const event_r2 = ctx.$implicit;
|
|
44
|
+
const ɵ$index_11_r3 = ctx.$index;
|
|
45
|
+
const ctx_r3 = i0.ɵɵnextContext();
|
|
46
|
+
i0.ɵɵadvance();
|
|
47
|
+
i0.ɵɵconditional((tmp_13_0 = ctx_r3.separatorTemplate()) ? 1 : -1, tmp_13_0);
|
|
48
|
+
i0.ɵɵadvance();
|
|
49
|
+
i0.ɵɵproperty("event", event_r2)("isLast", ɵ$index_11_r3 === ctx_r3.events.length - 1);
|
|
50
|
+
} }
|
|
51
|
+
/**
|
|
52
|
+
* Timeline component.
|
|
53
|
+
*
|
|
54
|
+
* Vertical chronological list of events, each rendered with a marker +
|
|
55
|
+
* connector on the left (`<div mol-timeline-event>`). Optional date separators
|
|
56
|
+
* come from `renderDateSeparator`, a template reference whose context carries
|
|
57
|
+
* the event as `$implicit` / `a0` and its predecessor as `a1`.
|
|
58
|
+
*
|
|
59
|
+
* React's root is the wrapper `<div>` — or, with no events and an empty state,
|
|
60
|
+
* that empty state alone (a fragment). A host element always exists in Angular,
|
|
61
|
+
* so this component's host is transparent (`mol-timeline`, `display: contents`,
|
|
62
|
+
* unwrapped by the conformance normalizer) and the template renders whichever
|
|
63
|
+
* root React would. The empty state is projected content
|
|
64
|
+
* (`[slot=emptyState]`) or a template reference passed as an input, reconciled
|
|
65
|
+
* against React's branch by {@link Timeline.ngAfterViewInit} /
|
|
66
|
+
* {@link Timeline.ngAfterViewChecked} / {@link Timeline.ngDoCheck}. Rows are
|
|
67
|
+
* tracked by the event's `id` value (`@for (…; track event.id)`), like React's
|
|
68
|
+
* per-item keys.
|
|
69
|
+
*
|
|
70
|
+
* This is the Angular counterpart of `@molecule/app-timeline-react`'s
|
|
71
|
+
* `Timeline`: the same props (React names), the same ClassMap tokens, and the
|
|
72
|
+
* same DOM for the same input.
|
|
73
|
+
*/
|
|
74
|
+
export class Timeline {
|
|
75
|
+
/** Events in display order. */
|
|
76
|
+
events = [];
|
|
77
|
+
/** Optional renderer for date separators: a template reference with the event in its context. */
|
|
78
|
+
renderDateSeparator;
|
|
79
|
+
/** Rendered when there are no events: a template reference, plain text, or `[slot=emptyState]`. */
|
|
80
|
+
emptyState;
|
|
81
|
+
/** Extra classes on the outer wrapper. */
|
|
82
|
+
className;
|
|
83
|
+
/** The projected empty-state capture point (unwrapped, so React's bare slot). */
|
|
84
|
+
empty;
|
|
85
|
+
/** The wrapper `<div>` (detached when the empty state renders instead). */
|
|
86
|
+
list;
|
|
87
|
+
guard = new SlotGuard(inject(ElementRef), inject(Renderer2));
|
|
88
|
+
/**
|
|
89
|
+
* The current class map.
|
|
90
|
+
* @returns The UIClassMap.
|
|
91
|
+
*/
|
|
92
|
+
cm() {
|
|
93
|
+
return getClassMap();
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Computes the outer wrapper's class list (`cm.stack(0)` + `className`).
|
|
97
|
+
* @returns The class string.
|
|
98
|
+
*/
|
|
99
|
+
classes() {
|
|
100
|
+
return this.cm().cn(this.cm().stack(0), this.className);
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* React's branch: with no events, the empty state renders bare (its
|
|
104
|
+
* template when it is a node).
|
|
105
|
+
* @returns The empty-state template, or null.
|
|
106
|
+
*/
|
|
107
|
+
emptyTemplate() {
|
|
108
|
+
if (this.events.length !== 0 || !this.emptyState)
|
|
109
|
+
return null;
|
|
110
|
+
return this.emptyState instanceof TemplateRef ? this.emptyState : null;
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* React's branch: with no events, a text empty state renders bare.
|
|
114
|
+
* @returns The empty-state text, or null when the wrapper renders instead.
|
|
115
|
+
*/
|
|
116
|
+
emptyText() {
|
|
117
|
+
if (this.events.length !== 0 || !this.emptyState)
|
|
118
|
+
return null;
|
|
119
|
+
if (this.emptyState instanceof TemplateRef)
|
|
120
|
+
return null;
|
|
121
|
+
return String(this.emptyState);
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* The date-separator template, when the caller supplied one.
|
|
125
|
+
* @returns The template, or null.
|
|
126
|
+
*/
|
|
127
|
+
separatorTemplate() {
|
|
128
|
+
return this.renderDateSeparator instanceof TemplateRef ? this.renderDateSeparator : null;
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* The separator template's context: React's `renderDateSeparator(event, prev)`
|
|
132
|
+
* arguments as `$implicit` / `a0` (the event) and `a1` (its predecessor).
|
|
133
|
+
* @param event - The event the separator precedes.
|
|
134
|
+
* @param index - The event's index in the list.
|
|
135
|
+
* @returns The template context.
|
|
136
|
+
*/
|
|
137
|
+
separatorContext(event, index) {
|
|
138
|
+
const prev = index > 0 ? this.events[index - 1] : undefined;
|
|
139
|
+
return { $implicit: event, a0: event, a1: prev, a2: undefined };
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Reconciles the projected empty state and the wrapper against React's
|
|
143
|
+
* branch once the view queries resolve.
|
|
144
|
+
*/
|
|
145
|
+
ngAfterViewInit() {
|
|
146
|
+
this.reconcile();
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* Re-reconciles on later passes, so a props step that empties or refills the
|
|
150
|
+
* list swaps the branch the way React does.
|
|
151
|
+
*/
|
|
152
|
+
ngDoCheck() {
|
|
153
|
+
this.reconcile();
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Re-reconciles after each view update: a node-valued empty state that arrives
|
|
157
|
+
* through an input renders into its outlet only during the update, so the
|
|
158
|
+
* branch decision must be read afterwards.
|
|
159
|
+
*/
|
|
160
|
+
ngAfterViewChecked() {
|
|
161
|
+
this.reconcile();
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* Applies React's condition: with no events and an empty state, the empty
|
|
165
|
+
* state renders bare and the wrapper disappears; otherwise the wrapper
|
|
166
|
+
* renders and the empty state is dropped.
|
|
167
|
+
*/
|
|
168
|
+
reconcile() {
|
|
169
|
+
const empty = this.empty?.nativeElement;
|
|
170
|
+
const list = this.list?.nativeElement;
|
|
171
|
+
const hasEmpty = (this.events?.length ?? 0) === 0 && hasNodes(empty);
|
|
172
|
+
this.guard.toggle(empty, hasEmpty);
|
|
173
|
+
this.guard.toggle(list, !hasEmpty);
|
|
174
|
+
}
|
|
175
|
+
static ɵfac = function Timeline_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || Timeline)(); };
|
|
176
|
+
static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: Timeline, selectors: [["mol-timeline"]], viewQuery: function Timeline_Query(rf, ctx) { if (rf & 1) {
|
|
177
|
+
i0.ɵɵviewQuery(_c0, 5)(_c1, 5);
|
|
178
|
+
} if (rf & 2) {
|
|
179
|
+
let _t;
|
|
180
|
+
i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.empty = _t.first);
|
|
181
|
+
i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.list = _t.first);
|
|
182
|
+
} }, hostAttrs: ["data-parity-unwrap", "", 2, "display", "contents"], inputs: { events: "events", renderDateSeparator: "renderDateSeparator", emptyState: "emptyState", className: "className" }, ngContentSelectors: _c3, decls: 9, vars: 4, consts: [["empty", ""], ["list", ""], ["data-parity-unwrap", "", 2, "display", "contents"], [3, "ngTemplateOutlet"], [3, "ngTemplateOutlet", "ngTemplateOutletContext"], ["mol-timeline-event", "", 3, "event", "isLast"]], template: function Timeline_Template(rf, ctx) { if (rf & 1) {
|
|
183
|
+
i0.ɵɵprojectionDef(_c2);
|
|
184
|
+
i0.ɵɵelementStart(0, "span", 2, 0);
|
|
185
|
+
i0.ɵɵconditionalCreate(2, Timeline_Conditional_2_Template, 1, 1);
|
|
186
|
+
i0.ɵɵconditionalCreate(3, Timeline_Conditional_3_Template, 1, 1, "ng-container", 3);
|
|
187
|
+
i0.ɵɵprojection(4);
|
|
188
|
+
i0.ɵɵelementEnd();
|
|
189
|
+
i0.ɵɵelementStart(5, "div", null, 1);
|
|
190
|
+
i0.ɵɵrepeaterCreate(7, Timeline_For_8_Template, 3, 3, "div", null, _forTrack0);
|
|
191
|
+
i0.ɵɵelementEnd();
|
|
192
|
+
} if (rf & 2) {
|
|
193
|
+
let tmp_2_0;
|
|
194
|
+
let tmp_3_0;
|
|
195
|
+
i0.ɵɵadvance(2);
|
|
196
|
+
i0.ɵɵconditional((tmp_2_0 = ctx.emptyText()) ? 2 : -1, tmp_2_0);
|
|
197
|
+
i0.ɵɵadvance();
|
|
198
|
+
i0.ɵɵconditional((tmp_3_0 = ctx.emptyTemplate()) ? 3 : -1, tmp_3_0);
|
|
199
|
+
i0.ɵɵadvance(2);
|
|
200
|
+
i0.ɵɵclassMap(ctx.classes());
|
|
201
|
+
i0.ɵɵadvance(2);
|
|
202
|
+
i0.ɵɵrepeater(ctx.events);
|
|
203
|
+
} }, dependencies: [NgTemplateOutlet, TimelineEvent], encapsulation: 2 });
|
|
204
|
+
}
|
|
205
|
+
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(Timeline, [{
|
|
206
|
+
type: Component,
|
|
207
|
+
args: [{
|
|
208
|
+
selector: 'mol-timeline',
|
|
209
|
+
standalone: true,
|
|
210
|
+
imports: [NgTemplateOutlet, TimelineEvent],
|
|
211
|
+
inputs: ['events', 'renderDateSeparator', 'emptyState', 'className'],
|
|
212
|
+
host: {
|
|
213
|
+
'data-parity-unwrap': '',
|
|
214
|
+
style: 'display: contents',
|
|
215
|
+
},
|
|
216
|
+
// prettier-ignore
|
|
217
|
+
template: `<span #empty data-parity-unwrap style="display: contents">@if (emptyText(); as text) {{{ text }}}@if (emptyTemplate(); as empty) {<ng-container [ngTemplateOutlet]="empty"></ng-container>}<ng-content select="[slot=emptyState]"></ng-content></span><div #list [class]="classes()">@for (event of events; track event.id; let i = $index) {<div>@if (separatorTemplate(); as separator) {<ng-container [ngTemplateOutlet]="separator" [ngTemplateOutletContext]="separatorContext(event, i)"></ng-container>}<div mol-timeline-event [event]="event" [isLast]="i === events.length - 1"></div></div>}</div>`,
|
|
218
|
+
}]
|
|
219
|
+
}], null, { empty: [{
|
|
220
|
+
type: ViewChild,
|
|
221
|
+
args: ['empty']
|
|
222
|
+
}], list: [{
|
|
223
|
+
type: ViewChild,
|
|
224
|
+
args: ['list']
|
|
225
|
+
}] }); })();
|
|
226
|
+
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(Timeline, { className: "Timeline", filePath: "timeline.component.ts", lineNumber: 62 }); })();
|
|
227
|
+
//# sourceMappingURL=timeline.component.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"timeline.component.js","sourceRoot":"","sources":["../src/timeline.component.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAA;AAClD,OAAO,EAGL,SAAS,EAET,UAAU,EACV,MAAM,EACN,SAAS,EACT,WAAW,EACX,SAAS,GACV,MAAM,eAAe,CAAA;AAGtB,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAE9C,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAA;;;;;;;;IAoCsC,YAAU;;IAAV,yBAAU;;;IAAkC,2BAAwD;;IAA1C,sCAA0B;;;IAAiN,2BAAmH;;;;;;IAAtE,AAA/B,sCAA8B,6EAAuD;;;IAAjJ,2BAAK;IAAA,yFAAyC;IAAoH,yBAAiF;IAAA,iBAAM;;;;;;IAApP,cAA6J;IAA7J,4EAA6J;IAAwB,cAAe;IAAC,AAAhB,gCAAe,sDAAmC;;AAjCtkB;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAaH,MAAM,OAAO,QAAQ;IACnB,+BAA+B;IAC/B,MAAM,GAAwB,EAAE,CAAA;IAChC,iGAAiG;IACjG,mBAAmB,CAAuB;IAC1C,mGAAmG;IACnG,UAAU,CAAU;IACpB,0CAA0C;IAC1C,SAAS,CAAS;IAElB,iFAAiF;IACrD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AAC,gBAAgB,EAAE,aAAa,CAAC;gBAC1C,MAAM,EAAE,CAAC,QAAQ,EAAE,qBAAqB,EAAE,YAAY,EAAE,WAAW,CAAC;gBACpE,IAAI,EAAE;oBACJ,oBAAoB,EAAE,EAAE;oBACxB,KAAK,EAAE,mBAAmB;iBAC3B;gBACD,kBAAkB;gBAClB,QAAQ,EAAE,+kBAA+kB;aAC1lB;;kBAYE,SAAS;mBAAC,OAAO;;kBAGjB,SAAS;mBAAC,MAAM;;kFAdN,QAAQ"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Types of `@molecule/app-timeline-angular` — the Angular counterpart of
|
|
3
|
+
* `@molecule/app-timeline-react`, same props and DOM.
|
|
4
|
+
*
|
|
5
|
+
* @module
|
|
6
|
+
*/
|
|
7
|
+
import type { TemplateRef } from '@angular/core';
|
|
8
|
+
/**
|
|
9
|
+
* One entry of a `<Timeline>`. Node fields are `ng-template` references (a
|
|
10
|
+
* projected node) or plain text, since an input cannot carry a DOM node.
|
|
11
|
+
*/
|
|
12
|
+
export interface TimelineEventData {
|
|
13
|
+
/** Stable identifier for this event (the row is tracked by it, like React's key). */
|
|
14
|
+
id: string;
|
|
15
|
+
/** Marker icon / dot — defaults to a small dot. */
|
|
16
|
+
marker?: string | number | TemplateRef<unknown>;
|
|
17
|
+
/** Display timestamp (ISO, relative, etc.). */
|
|
18
|
+
timestamp: string | number | TemplateRef<unknown>;
|
|
19
|
+
/** Headline of the event. */
|
|
20
|
+
title: string | number | TemplateRef<unknown>;
|
|
21
|
+
/** Optional body content. */
|
|
22
|
+
body?: string | number | TemplateRef<unknown>;
|
|
23
|
+
/**
|
|
24
|
+
* Optional accent color hint. Currently INERT — no component consumes it,
|
|
25
|
+
* so setting it changes nothing; pass a custom `marker` node to color a row.
|
|
26
|
+
*/
|
|
27
|
+
accent?: 'primary' | 'success' | 'warning' | 'error' | 'info' | 'neutral';
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Props accepted by {@link Timeline} — the same props
|
|
31
|
+
* `@molecule/app-timeline-react` accepts. `emptyState` is a template reference
|
|
32
|
+
* passed as an input (or projected content in a host template); the callback
|
|
33
|
+
* prop `renderDateSeparator` is a template reference whose context carries the
|
|
34
|
+
* event as `$implicit` / `a0` and its predecessor as `a1`.
|
|
35
|
+
*/
|
|
36
|
+
export interface TimelineProps {
|
|
37
|
+
/** Events in display order. */
|
|
38
|
+
events: TimelineEventData[];
|
|
39
|
+
/** Optional renderer for date separators between consecutive events. */
|
|
40
|
+
renderDateSeparator?: TemplateRef<unknown>;
|
|
41
|
+
/** Rendered when there are no events. */
|
|
42
|
+
emptyState?: string | number | TemplateRef<unknown>;
|
|
43
|
+
/** Extra classes on the outer wrapper. */
|
|
44
|
+
className?: string;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Props accepted by {@link TimelineEvent} — the same props
|
|
48
|
+
* `@molecule/app-timeline-react` accepts.
|
|
49
|
+
*/
|
|
50
|
+
export interface TimelineEventProps {
|
|
51
|
+
/** The event to render. */
|
|
52
|
+
event: TimelineEventData;
|
|
53
|
+
/** Whether this is the last event in the list (suppresses the connector). */
|
|
54
|
+
isLast?: boolean;
|
|
55
|
+
/** Extra classes. */
|
|
56
|
+
className?: string;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Props accepted by {@link TimelineRail} — the same props
|
|
60
|
+
* `@molecule/app-timeline-react` accepts.
|
|
61
|
+
*/
|
|
62
|
+
export interface TimelineRailProps {
|
|
63
|
+
/** Marker for this row — typically a dot or icon. */
|
|
64
|
+
marker?: string | number | TemplateRef<unknown>;
|
|
65
|
+
/** Whether to render the vertical connector below the marker. Defaults to `true`. */
|
|
66
|
+
connector?: boolean;
|
|
67
|
+
/** Extra classes on the outer wrapper. */
|
|
68
|
+
className?: string;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Props accepted by {@link TimelineDate} — the same props
|
|
72
|
+
* `@molecule/app-timeline-react` accepts. `children` is projected content in
|
|
73
|
+
* Angular (an input cannot carry a node), so it is typed `unknown`: pass it in
|
|
74
|
+
* the host template, not as a value.
|
|
75
|
+
*/
|
|
76
|
+
export interface TimelineDateProps {
|
|
77
|
+
/** Date label ("Today", "Yesterday", "March 12, 2025"), as projected content. */
|
|
78
|
+
children?: unknown;
|
|
79
|
+
/** Extra classes. */
|
|
80
|
+
className?: string;
|
|
81
|
+
}
|
|
82
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAEhD;;;GAGG;AACH,MAAM,WAAW,iBAAiB;IAChC,qFAAqF;IACrF,EAAE,EAAE,MAAM,CAAA;IACV,mDAAmD;IACnD,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,WAAW,CAAC,OAAO,CAAC,CAAA;IAC/C,+CAA+C;IAC/C,SAAS,EAAE,MAAM,GAAG,MAAM,GAAG,WAAW,CAAC,OAAO,CAAC,CAAA;IACjD,6BAA6B;IAC7B,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,WAAW,CAAC,OAAO,CAAC,CAAA;IAC7C,6BAA6B;IAC7B,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,WAAW,CAAC,OAAO,CAAC,CAAA;IAC7C;;;OAGG;IACH,MAAM,CAAC,EAAE,SAAS,GAAG,SAAS,GAAG,SAAS,GAAG,OAAO,GAAG,MAAM,GAAG,SAAS,CAAA;CAC1E;AAED;;;;;;GAMG;AACH,MAAM,WAAW,aAAa;IAC5B,+BAA+B;IAC/B,MAAM,EAAE,iBAAiB,EAAE,CAAA;IAC3B,wEAAwE;IACxE,mBAAmB,CAAC,EAAE,WAAW,CAAC,OAAO,CAAC,CAAA;IAC1C,yCAAyC;IACzC,UAAU,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,WAAW,CAAC,OAAO,CAAC,CAAA;IACnD,0CAA0C;IAC1C,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED;;;GAGG;AACH,MAAM,WAAW,kBAAkB;IACjC,2BAA2B;IAC3B,KAAK,EAAE,iBAAiB,CAAA;IACxB,6EAA6E;IAC7E,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,qBAAqB;IACrB,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED;;;GAGG;AACH,MAAM,WAAW,iBAAiB;IAChC,qDAAqD;IACrD,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,WAAW,CAAC,OAAO,CAAC,CAAA;IAC/C,qFAAqF;IACrF,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,0CAA0C;IAC1C,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED;;;;;GAKG;AACH,MAAM,WAAW,iBAAiB;IAChC,iFAAiF;IACjF,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,qBAAqB;IACrB,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB"}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,71 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@molecule/app-timeline-angular",
|
|
3
|
-
"version": "0.0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.0.1-stage",
|
|
4
|
+
"description": "Angular chronological timeline with event rails and date markers",
|
|
5
|
+
"homepage": "https://www.molecule.dev/packages/app-timeline-angular",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"main": "dist/index.js",
|
|
8
|
+
"types": "dist/index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"import": "./dist/index.js"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"files": [
|
|
16
|
+
"dist",
|
|
17
|
+
"README.md"
|
|
18
|
+
],
|
|
19
|
+
"scripts": {
|
|
20
|
+
"build": "ngc",
|
|
21
|
+
"dev": "ngc --watch",
|
|
22
|
+
"test": "vitest run",
|
|
23
|
+
"test:watch": "vitest"
|
|
24
|
+
},
|
|
25
|
+
"keywords": [
|
|
26
|
+
"molecule",
|
|
27
|
+
"timeline-ui",
|
|
28
|
+
"angular"
|
|
29
|
+
],
|
|
30
|
+
"author": "Molecule Dev, Inc. (https://molecule.dev)",
|
|
31
|
+
"license": "Apache-2.0",
|
|
32
|
+
"repository": {
|
|
33
|
+
"type": "git",
|
|
34
|
+
"url": "https://github.com/molecule-dev/molecule.git",
|
|
35
|
+
"directory": "packages/app/features/timeline-angular"
|
|
36
|
+
},
|
|
37
|
+
"engines": {
|
|
38
|
+
"node": ">=20"
|
|
39
|
+
},
|
|
40
|
+
"bugs": "https://github.com/molecule-dev/molecule/issues",
|
|
41
|
+
"publishConfig": {
|
|
42
|
+
"access": "public"
|
|
43
|
+
},
|
|
44
|
+
"peerDependencies": {
|
|
45
|
+
"@angular/common": "^22.0.0",
|
|
46
|
+
"@angular/core": "^22.0.0",
|
|
47
|
+
"@angular/platform-browser": "^22.0.0",
|
|
48
|
+
"@molecule/app-angular": "^3.5.0",
|
|
49
|
+
"@molecule/app-ui": "^1.0.1",
|
|
50
|
+
"@molecule/app-ui-angular": "^1.1.0"
|
|
51
|
+
},
|
|
52
|
+
"devDependencies": {
|
|
53
|
+
"@angular/common": "22.2.3",
|
|
54
|
+
"@angular/compiler": "22.2.3",
|
|
55
|
+
"@angular/compiler-cli": "22.2.3",
|
|
56
|
+
"@angular/core": "22.2.3",
|
|
57
|
+
"@angular/platform-browser": "22.2.3",
|
|
58
|
+
"@molecule/app-angular": "3.7.2",
|
|
59
|
+
"@molecule/app-framework-conformance": "0.0.0",
|
|
60
|
+
"@molecule/app-i18n": "1.2.2",
|
|
61
|
+
"@molecule/app-icons": "1.0.4",
|
|
62
|
+
"@molecule/app-ui": "1.4.0",
|
|
63
|
+
"@molecule/app-ui-angular": "1.2.1",
|
|
64
|
+
"@types/node": "26.6.5",
|
|
65
|
+
"jsdom": "30.1.3",
|
|
66
|
+
"rxjs": "7.8.2",
|
|
67
|
+
"typescript": "6.0.3",
|
|
68
|
+
"vitest": "4.1.12",
|
|
69
|
+
"zone.js": "0.16.3"
|
|
70
|
+
}
|
|
71
|
+
}
|