@molecule/app-timeline-angular 0.0.1-stage → 1.1.1

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 CHANGED
@@ -1,11 +1,611 @@
1
+ <!--
2
+ AUTO-GENERATED — DO NOT EDIT THIS FILE.
3
+ Generated by `mlcl sync-docs` from the package's src/index.ts JSDoc + mlcl/registry.json.
4
+ Edits here are overwritten on the next commit (molecule's pre-commit hook regenerates).
5
+ To change this document, edit the module-level JSDoc in src/index.ts.
6
+ Generated: 2026-11-23T14:53:47.073Z
7
+ -->
8
+
1
9
  # @molecule/app-timeline-angular
2
10
 
3
- Angular chronological timeline with event rails and date markers
11
+ Angular chronological timeline primitives.
12
+
13
+ Exports:
14
+
15
+ - `<mol-timeline>` / `Timeline` — vertical list of events with optional date separators.
16
+ - `<div mol-timeline-event>` / `TimelineEvent` — one event row with rail (marker + connector) + content.
17
+ - `<div mol-timeline-rail>` / `TimelineRail` — standalone rail (marker + connector) for custom rows.
18
+ - `<div mol-timeline-date>` / `TimelineDate` — date separator rendered between groups.
19
+ - `TimelineEventData` type for event records.
20
+
21
+ Use for activity chronologies, deal timelines, order tracking, audit logs.
22
+ It is the Angular counterpart of `@molecule/app-timeline-react`: the same
23
+ props (React names) and the same DOM for the same input, so switching
24
+ framework is changing the package name in the imports.
25
+
26
+ > **Auto-generated, AI-first package reference** for the [molecule.dev](https://molecule.dev) ecosystem.
27
+ > It is written to be read by coding agents as much as by people, and is generated from this
28
+ > package's source — edit `src/index.ts` JSDoc, not this file.
29
+
30
+ ## Quick Start
31
+
32
+ ```ts
33
+ import { Component } from '@angular/core'
34
+ import { Timeline, TimelineDate } from '@molecule/app-timeline-angular'
35
+
36
+ @Component({
37
+ selector: 'app-activity',
38
+ standalone: true,
39
+ imports: [Timeline, TimelineDate],
40
+ template: `
41
+ <mol-timeline [events]="events">
42
+ <p slot="emptyState">No activity yet.</p>
43
+ </mol-timeline>
44
+ `,
45
+ })
46
+ export class Activity {
47
+ events = [
48
+ { id: '1', timestamp: '2 hours ago', title: 'Order placed' },
49
+ { id: '2', timestamp: 'Yesterday', title: 'Payment confirmed', body: 'Visa ending 4242' },
50
+ { id: '3', timestamp: 'Mar 12', title: 'Item shipped' },
51
+ ]
52
+ }
53
+ ```
54
+
55
+ ## Type
56
+
57
+ `feature`
58
+
59
+ ## Installation
4
60
 
61
+ ```bash
62
+ npm install @molecule/app-timeline-angular @angular/common @angular/core @angular/platform-browser @molecule/app-angular @molecule/app-ui @molecule/app-ui-angular
5
63
  ```
6
- npm install @molecule/app-timeline-angular
64
+
65
+ ## API
66
+
67
+ ### Interfaces
68
+
69
+ #### `TimelineEventData`
70
+
71
+ One entry of a `<Timeline>`. Node fields are `ng-template` references (a
72
+ projected node) or plain text, since an input cannot carry a DOM node.
73
+
74
+ ```typescript
75
+ interface TimelineEventData {
76
+ /** Stable identifier for this event (the row is tracked by it, like React's key). */
77
+ id: string
78
+ /** Marker icon / dot — defaults to a small dot. */
79
+ marker?: string | number | TemplateRef<unknown>
80
+ /** Display timestamp (ISO, relative, etc.). */
81
+ timestamp: string | number | TemplateRef<unknown>
82
+ /** Headline of the event. */
83
+ title: string | number | TemplateRef<unknown>
84
+ /** Optional body content. */
85
+ body?: string | number | TemplateRef<unknown>
86
+ /**
87
+ * Optional accent color hint. Currently INERT — no component consumes it,
88
+ * so setting it changes nothing; pass a custom `marker` node to color a row.
89
+ */
90
+ accent?: 'primary' | 'success' | 'warning' | 'error' | 'info' | 'neutral'
91
+ }
92
+ ```
93
+
94
+ #### `TimelineProps`
95
+
96
+ Props accepted by {@link Timeline} — the same props
97
+ `@molecule/app-timeline-react` accepts. `emptyState` is a template reference
98
+ passed as an input (or projected content in a host template); the callback
99
+ prop `renderDateSeparator` is a template reference whose context carries the
100
+ event as `$implicit` / `a0` and its predecessor as `a1`.
101
+
102
+ ```typescript
103
+ interface TimelineProps {
104
+ /** Events in display order. */
105
+ events: TimelineEventData[]
106
+ /** Optional renderer for date separators between consecutive events. */
107
+ renderDateSeparator?: TemplateRef<unknown>
108
+ /** Rendered when there are no events. */
109
+ emptyState?: string | number | TemplateRef<unknown>
110
+ /** Extra classes on the outer wrapper. */
111
+ className?: string
112
+ }
7
113
  ```
8
114
 
9
- Part of the [Molecule](https://www.molecule.dev) package fleet. This page carries the manifest summary; the full generated documentation ships with the package's first committed version.
115
+ #### `TimelineEventProps`
116
+
117
+ Props accepted by {@link TimelineEvent} — the same props
118
+ `@molecule/app-timeline-react` accepts.
119
+
120
+ ```typescript
121
+ interface TimelineEventProps {
122
+ /** The event to render. */
123
+ event: TimelineEventData
124
+ /** Whether this is the last event in the list (suppresses the connector). */
125
+ isLast?: boolean
126
+ /** Extra classes. */
127
+ className?: string
128
+ }
129
+ ```
130
+
131
+ #### `TimelineRailProps`
132
+
133
+ Props accepted by {@link TimelineRail} — the same props
134
+ `@molecule/app-timeline-react` accepts.
135
+
136
+ ```typescript
137
+ interface TimelineRailProps {
138
+ /** Marker for this row — typically a dot or icon. */
139
+ marker?: string | number | TemplateRef<unknown>
140
+ /** Whether to render the vertical connector below the marker. Defaults to `true`. */
141
+ connector?: boolean
142
+ /** Extra classes on the outer wrapper. */
143
+ className?: string
144
+ }
145
+ ```
146
+
147
+ #### `TimelineDateProps`
148
+
149
+ Props accepted by {@link TimelineDate} — the same props
150
+ `@molecule/app-timeline-react` accepts. `children` is projected content in
151
+ Angular (an input cannot carry a node), so it is typed `unknown`: pass it in
152
+ the host template, not as a value.
153
+
154
+ ```typescript
155
+ interface TimelineDateProps {
156
+ /** Date label ("Today", "Yesterday", "March 12, 2025"), as projected content. */
157
+ children?: unknown
158
+ /** Extra classes. */
159
+ className?: string
160
+ }
161
+ ```
162
+
163
+ ### Classes
164
+
165
+ #### `TimelineDate`
166
+
167
+ TimelineDate component.
168
+
169
+ Date separator rendered between timeline groups. The host IS the
170
+ separator's outer `<div>` (`div[mol-timeline-date]`), matching React's root
171
+ exactly, and the label is projected content (the default `<ng-content>`).
172
+
173
+ This is the Angular counterpart of `@molecule/app-timeline-react`'s
174
+ `TimelineDate`: the same props (React names), the same ClassMap tokens, and
175
+ the same DOM for the same input.
176
+
177
+ ```typescript
178
+ @Component({
179
+ selector: 'div[mol-timeline-date]',
180
+ standalone: true,
181
+ inputs: ['className'],
182
+ host: {
183
+ '[class]': 'classes()',
184
+ },
185
+ template: `<span [class]="cm().cn(cm().flex1)"><ng-content></ng-content></span>`,
186
+ })
187
+ export class TimelineDate {
188
+ /** Extra classes. */
189
+ className?: string
190
+
191
+ /**
192
+ * The current class map.
193
+ * @returns The UIClassMap.
194
+ */
195
+ cm(): UIClassMap {
196
+ return getClassMap()
197
+ }
198
+
199
+ /**
200
+ * Computes the separator's class list.
201
+ * @returns The class string.
202
+ */
203
+ classes(): string {
204
+ return this.cm().cn(
205
+ this.cm().flex({ align: 'center', gap: 'sm' }),
206
+ this.cm().sp('py', 2),
207
+ this.cm().textSize('xs'),
208
+ this.cm().fontWeight('semibold'),
209
+ this.className,
210
+ )
211
+ }
212
+ }
213
+ ```
214
+
215
+ #### `TimelineEvent`
216
+
217
+ TimelineEvent component.
218
+
219
+ One row of a `<Timeline>`: [rail (marker + connector)] [timestamp / title /
220
+ body]. The host IS the row's outer `<div>` (`div[mol-timeline-event]`),
221
+ matching React's root exactly. The event's node-valued fields are
222
+ `ng-template` references rendered through `NgTemplateOutlet`; string / number
223
+ fields render as text.
224
+
225
+ This is the Angular counterpart of `@molecule/app-timeline-react`'s
226
+ `TimelineEvent`: the same props (React names), the same ClassMap tokens, and
227
+ the same DOM for the same input.
228
+
229
+ ```typescript
230
+ @Component({
231
+ selector: 'div[mol-timeline-event]',
232
+ standalone: true,
233
+ imports: [NgTemplateOutlet, TimelineRail],
234
+ inputs: ['event', 'isLast', 'className'],
235
+ host: {
236
+ '[class]': 'classes()',
237
+ },
238
+ // prettier-ignore
239
+ template: `<div mol-timeline-rail [marker]="event.marker" [connector]="!isLast"></div><div [class]="contentClasses()"><div [class]="timestampClasses()">@if (isNode(event.timestamp)) {<ng-container [ngTemplateOutlet]="templateOf(event.timestamp)" />}@else {{{ textOf(event.timestamp) }}}</div><div [class]="titleClasses()">@if (isNode(event.title)) {<ng-container [ngTemplateOutlet]="templateOf(event.title)" />}@else {{{ textOf(event.title) }}}</div>@if (event.body) {<div [class]="cm().textSize('sm')">@if (isNode(event.body)) {<ng-container [ngTemplateOutlet]="templateOf(event.body)" />}@else {{{ textOf(event.body) }}}</div>}</div>`,
240
+ })
241
+ export class TimelineEvent {
242
+ /** The event to render. */
243
+ event!: TimelineEventData
244
+ /** Whether this is the last event in the list (suppresses the connector). */
245
+ isLast?: boolean
246
+ /** Extra classes. */
247
+ className?: string
248
+
249
+ /**
250
+ * The current class map.
251
+ * @returns The UIClassMap.
252
+ */
253
+ cm(): UIClassMap {
254
+ return getClassMap()
255
+ }
256
+
257
+ /**
258
+ * Computes the row's class list.
259
+ * @returns The class string.
260
+ */
261
+ classes(): string {
262
+ return this.cm().cn(this.cm().flex({ align: 'stretch', gap: 'sm' }), this.className)
263
+ }
264
+
265
+ /**
266
+ * Computes the content column's class list.
267
+ * @returns The class string.
268
+ */
269
+ contentClasses(): string {
270
+ return this.cm().cn(this.cm().flex1, this.cm().stack(1), this.cm().sp('pb', 4))
271
+ }
272
+
273
+ /**
274
+ * Computes the timestamp line's class list.
275
+ * @returns The class string.
276
+ */
277
+ timestampClasses(): string {
278
+ return this.cm().cn(this.cm().textSize('xs'), this.cm().fontWeight('medium'))
279
+ }
280
+
281
+ /**
282
+ * Computes the title line's class list.
283
+ * @returns The class string.
284
+ */
285
+ titleClasses(): string {
286
+ return this.cm().cn(this.cm().textSize('sm'), this.cm().fontWeight('semibold'))
287
+ }
288
+
289
+ /**
290
+ * Whether a field holds a node (an `ng-template` reference) rather than text.
291
+ * @param value - The event field.
292
+ * @returns True when it renders through a template outlet.
293
+ */
294
+ isNode(value: unknown): value is TemplateRef<unknown> {
295
+ return value instanceof TemplateRef
296
+ }
297
+
298
+ /**
299
+ * Narrows a value to an embedded template.
300
+ * @param value - The event field.
301
+ * @returns The template, or null.
302
+ */
303
+ templateOf(value: unknown): TemplateRef<unknown> | null {
304
+ return value instanceof TemplateRef ? value : null
305
+ }
306
+
307
+ /**
308
+ * The text a field renders (React renders strings and numbers as text).
309
+ * @param value - The event field.
310
+ * @returns The text, or `''` for a node field.
311
+ */
312
+ textOf(value: unknown): string {
313
+ return typeof value === 'string' || typeof value === 'number' ? String(value) : ''
314
+ }
315
+ }
316
+ ```
317
+
318
+ #### `TimelineRail`
319
+
320
+ TimelineRail component.
321
+
322
+ Left-hand rail of a timeline row — renders the marker (a default dot when
323
+ none is given) and an optional vertical connector extending downward. The
324
+ host IS the rail's outer `<div>` (`div[mol-timeline-rail]`), matching React's
325
+ root exactly. A node-valued marker is an `ng-template` reference rendered
326
+ through `NgTemplateOutlet`; the connector's inline style is applied the way
327
+ React applies it (through the CSSOM), so the serialized attribute matches.
328
+
329
+ This is the Angular counterpart of `@molecule/app-timeline-react`'s
330
+ `TimelineRail`: the same props (React names), the same ClassMap tokens, and
331
+ the same DOM for the same input.
332
+
333
+ ```typescript
334
+ @Component({
335
+ selector: 'div[mol-timeline-rail]',
336
+ standalone: true,
337
+ imports: [NgTemplateOutlet],
338
+ inputs: ['marker', 'connector', 'className'],
339
+ host: {
340
+ '[class]': 'classes()',
341
+ },
342
+ template: `<div>
343
+ @if (markerTemplate(); as marker) {
344
+ <ng-container [ngTemplateOutlet]="marker" />
345
+ } @else if (markerText() !== null) {
346
+ {{ markerText() }}
347
+ } @else {
348
+ <span aria-hidden="true">•</span>
349
+ }
350
+ </div>
351
+ @if (hasConnector()) {
352
+ <div [class]="connectorClasses()" [style]="connectorStyle()"></div>
353
+ }`,
354
+ })
355
+ export class TimelineRail {
356
+ /** Marker for this row, as a template reference or plain text. */
357
+ marker?: string | number | TemplateRef<unknown>
358
+ /** Whether to render the vertical connector below the marker (defaults to `true`). */
359
+ connector?: boolean
360
+ /** Extra classes on the outer wrapper. */
361
+ className?: string
362
+
363
+ /**
364
+ * The current class map.
365
+ * @returns The UIClassMap.
366
+ */
367
+ cm(): UIClassMap {
368
+ return getClassMap()
369
+ }
370
+
371
+ /**
372
+ * Computes the outer rail class list.
373
+ * @returns The class string.
374
+ */
375
+ classes(): string {
376
+ return this.cm().cn(
377
+ this.cm().flex({ direction: 'col', align: 'center' }),
378
+ this.cm().shrink0,
379
+ this.className,
380
+ )
381
+ }
382
+
383
+ /**
384
+ * React's `connector = true` default: an absent input keeps the connector.
385
+ * @returns Whether the connector renders.
386
+ */
387
+ hasConnector(): boolean {
388
+ return this.connector ?? true
389
+ }
390
+
391
+ /**
392
+ * Whether the marker holds a node (an `ng-template` reference) rather than text.
393
+ * @returns True when it renders through a template outlet.
394
+ */
395
+ markerTemplate(): TemplateRef<unknown> | null {
396
+ return this.marker instanceof TemplateRef ? this.marker : null
397
+ }
398
+
399
+ /**
400
+ * The text a marker renders (React renders strings and numbers as text).
401
+ * @returns The text, or null when the marker is a node or absent.
402
+ */
403
+ markerText(): string | null {
404
+ if (typeof this.marker === 'string') return this.marker
405
+ if (typeof this.marker === 'number') return String(this.marker)
406
+ return null
407
+ }
408
+
409
+ /**
410
+ * Computes the connector's class list (`cm.w(0)` + `cm.h('full')`).
411
+ * @returns The class string.
412
+ */
413
+ connectorClasses(): string {
414
+ return this.cm().cn(this.cm().w(0), this.cm().h('full'))
415
+ }
416
+
417
+ /**
418
+ * The connector's inline style, exactly React's object.
419
+ * @returns The style declarations.
420
+ */
421
+ connectorStyle(): Record<string, string> {
422
+ return { 'border-left': '1px solid currentColor', opacity: '0.2', 'min-height': '24px' }
423
+ }
424
+ }
425
+ ```
426
+
427
+ #### `Timeline`
428
+
429
+ Timeline component.
430
+
431
+ Vertical chronological list of events, each rendered with a marker +
432
+ connector on the left (`<div mol-timeline-event>`). Optional date separators
433
+ come from `renderDateSeparator`, a template reference whose context carries
434
+ the event as `$implicit` / `a0` and its predecessor as `a1`.
435
+
436
+ React's root is the wrapper `<div>` — or, with no events and an empty state,
437
+ that empty state alone (a fragment). Everything the host holds (the empty
438
+ state's capture and the wrapper `<div>`) renders in the host's place and the
439
+ host itself leaves the page, so the fragment root is React's exact DOM. The
440
+ empty state is projected content
441
+ (`[slot=emptyState]`) or a template reference passed as an input, reconciled
442
+ against React's branch by the placement function registered in the
443
+ constructor. Rows are
444
+ tracked by the event's `id` value (`@for (…; track event.id)`), like React's
445
+ per-item keys.
446
+
447
+ This is the Angular counterpart of `@molecule/app-timeline-react`'s
448
+ `Timeline`: the same props (React names), the same ClassMap tokens, and the
449
+ same DOM for the same input.
450
+
451
+ ```typescript
452
+ @Component({
453
+ selector: 'mol-timeline',
454
+ standalone: true,
455
+ hostDirectives: [MolPlacement],
456
+ imports: [NgTemplateOutlet, TimelineEvent],
457
+ inputs: ['events', 'renderDateSeparator', 'emptyState', 'className'],
458
+ // prettier-ignore
459
+ template: `<span #empty>@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>`,
460
+ })
461
+ export class Timeline {
462
+ /** Events in display order. */
463
+ events: TimelineEventData[] = []
464
+ /** Optional renderer for date separators: a template reference with the event in its context. */
465
+ renderDateSeparator?: TemplateRef<unknown>
466
+ /** Rendered when there are no events: a template reference, plain text, or `[slot=emptyState]`. */
467
+ emptyState?: unknown
468
+ /** Extra classes on the outer wrapper. */
469
+ className?: string
470
+
471
+ /** The projected empty-state capture point (its content renders in its place, and it leaves the page). */
472
+ @ViewChild('empty') private empty?: ElementRef<HTMLElement>
473
+
474
+ /** The wrapper `<div>` (detached when the empty state renders instead). */
475
+ @ViewChild('list') private list?: ElementRef<HTMLElement>
476
+
477
+ private readonly host: ElementRef<HTMLElement> = inject(ElementRef)
478
+
479
+ constructor() {
480
+ // React's root is the wrapper `<div>`, or the empty state alone (a fragment): the
481
+ // host's content renders in the host's place and the host itself leaves the page.
482
+ usePlacement((hasContent) => this.reconcile(hasContent))
483
+ }
484
+
485
+ /**
486
+ * The current class map.
487
+ * @returns The UIClassMap.
488
+ */
489
+ cm(): UIClassMap {
490
+ return getClassMap()
491
+ }
492
+
493
+ /**
494
+ * Computes the outer wrapper's class list (`cm.stack(0)` + `className`).
495
+ * @returns The class string.
496
+ */
497
+ classes(): string {
498
+ return this.cm().cn(this.cm().stack(0), this.className)
499
+ }
500
+
501
+ /**
502
+ * React's branch: with no events, the empty state renders bare (its
503
+ * template when it is a node).
504
+ * @returns The empty-state template, or null.
505
+ */
506
+ emptyTemplate(): TemplateRef<unknown> | null {
507
+ if (this.events.length !== 0 || !this.emptyState) return null
508
+ return this.emptyState instanceof TemplateRef ? this.emptyState : null
509
+ }
510
+
511
+ /**
512
+ * React's branch: with no events, a text empty state renders bare.
513
+ * @returns The empty-state text, or null when the wrapper renders instead.
514
+ */
515
+ emptyText(): string | null {
516
+ if (this.events.length !== 0 || !this.emptyState) return null
517
+ if (this.emptyState instanceof TemplateRef) return null
518
+ return String(this.emptyState)
519
+ }
520
+
521
+ /**
522
+ * The date-separator template, when the caller supplied one.
523
+ * @returns The template, or null.
524
+ */
525
+ separatorTemplate(): TemplateRef<unknown> | null {
526
+ return this.renderDateSeparator instanceof TemplateRef ? this.renderDateSeparator : null
527
+ }
528
+
529
+ /**
530
+ * The separator template's context: React's `renderDateSeparator(event, prev)`
531
+ * arguments as `$implicit` / `a0` (the event) and `a1` (its predecessor).
532
+ * @param event - The event the separator precedes.
533
+ * @param index - The event's index in the list.
534
+ * @returns The template context.
535
+ */
536
+ separatorContext(event: TimelineEventData, index: number): Record<string, unknown> {
537
+ const prev = index > 0 ? this.events[index - 1] : undefined
538
+ return { $implicit: event, a0: event, a1: prev, a2: undefined }
539
+ }
540
+
541
+ /**
542
+ * Applies React's condition: with no events and an empty state, the empty
543
+ * state renders bare and the wrapper disappears; otherwise the wrapper
544
+ * renders and the empty state is dropped.
545
+ *
546
+ * @param hasContent - Reads whether a slot has content.
547
+ */
548
+ private reconcile(hasContent: SlotReader): void {
549
+ const host = this.host.nativeElement
550
+ const empty = this.empty?.nativeElement
551
+ const list = this.list?.nativeElement
552
+ const hasEmpty = (this.events?.length ?? 0) === 0 && hasContent(empty)
553
+ if (hasEmpty) {
554
+ // The capture's content renders exactly where the capture stood, and the capture
555
+ // itself leaves the page.
556
+ placeContentBefore(empty, empty)
557
+ } else {
558
+ // Back inside the capture, so it leaves the page with it.
559
+ placeContent(empty, null)
560
+ }
561
+ setElementPresent(empty, false)
562
+ setElementPresent(list, !hasEmpty)
563
+ // React's root is the fragment: everything renders in the host's place, and the host
564
+ // itself leaves the page.
565
+ placeContentBefore(host, host)
566
+ setElementPresent(host, false)
567
+ }
568
+ }
569
+ ```
570
+
571
+ ## Injection Notes
572
+
573
+ ### Requirements
574
+
575
+ Peer dependencies:
576
+
577
+ - `@angular/common` ^22.0.0
578
+ - `@angular/core` ^22.0.0
579
+ - `@angular/platform-browser` ^22.0.0
580
+ - `@molecule/app-angular` ^3.13.0
581
+ - `@molecule/app-ui` ^1.0.1
582
+ - `@molecule/app-ui-angular` ^1.1.0
583
+
584
+ ### Runtime Dependencies
585
+
586
+ - `@angular/common`
587
+ - `@angular/core`
588
+ - `@angular/platform-browser`
589
+ - `@molecule/app-angular`
590
+ - `@molecule/app-ui`
591
+ - `@molecule/app-ui-angular`
592
+
593
+ This is NOT the Angular binding for `@molecule/app-timeline` (the headless
594
+ provider core wired via `setProvider`) — it is standalone presentational
595
+ markup with no provider. For domain-specific rows see the sibling packages
596
+ `@molecule/app-activity-timeline-angular`, `@molecule/app-order-timeline-angular`,
597
+ `@molecule/app-status-timeline-angular`, `@molecule/app-stage-timeline-angular` and
598
+ `@molecule/app-day-timeline-angular`.
10
599
 
11
- License: Apache-2.0
600
+ `TimelineEventData.accent` is currently INERT — no component reads it, so
601
+ setting it changes nothing; color a row by passing a custom `marker` node
602
+ instead. `timestamp` is a display node — format/translate it before
603
+ passing. Node-valued props are `ng-template` references; `Timeline`'s root is
604
+ a fragment in its empty branch, so its content renders in the host's place
605
+ and the host itself leaves the page, and rows
606
+ are tracked by the event's `id`, like React's keys. The prop surface
607
+ (documented on the exported `TimelineProps`, `TimelineEventProps`,
608
+ `TimelineRailProps` and `TimelineDateProps` interfaces):
609
+ Timeline(events, renderDateSeparator, emptyState, className),
610
+ TimelineEvent(event, isLast, className), TimelineRail(marker, connector,
611
+ className), TimelineDate(children, className).
package/dist/index.d.ts CHANGED
@@ -40,14 +40,17 @@
40
40
  * @remarks
41
41
  * This is NOT the Angular binding for `@molecule/app-timeline` (the headless
42
42
  * provider core wired via `setProvider`) — it is standalone presentational
43
- * markup with no provider. For domain-specific rows see the sibling
44
- * `@molecule/app-{activity,order,status,stage,day}-timeline-angular` packages.
43
+ * markup with no provider. For domain-specific rows see the sibling packages
44
+ * `@molecule/app-activity-timeline-angular`, `@molecule/app-order-timeline-angular`,
45
+ * `@molecule/app-status-timeline-angular`, `@molecule/app-stage-timeline-angular` and
46
+ * `@molecule/app-day-timeline-angular`.
45
47
  *
46
48
  * `TimelineEventData.accent` is currently INERT — no component reads it, so
47
49
  * setting it changes nothing; color a row by passing a custom `marker` node
48
50
  * instead. `timestamp` is a display node — format/translate it before
49
51
  * passing. Node-valued props are `ng-template` references; `Timeline`'s root is
50
- * a fragment in its empty branch, so its host is `display: contents`, and rows
52
+ * a fragment in its empty branch, so its content renders in the host's place
53
+ * and the host itself leaves the page, and rows
51
54
  * are tracked by the event's `id`, like React's keys. The prop surface
52
55
  * (documented on the exported `TimelineProps`, `TimelineEventProps`,
53
56
  * `TimelineRailProps` and `TimelineDateProps` interfaces):
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0DG;AAEH,cAAc,yBAAyB,CAAA;AACvC,cAAc,8BAA8B,CAAA;AAC5C,cAAc,+BAA+B,CAAA;AAC7C,cAAc,8BAA8B,CAAA;AAC5C,cAAc,YAAY,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6DG;AAEH,cAAc,yBAAyB,CAAA;AACvC,cAAc,8BAA8B,CAAA;AAC5C,cAAc,+BAA+B,CAAA;AAC7C,cAAc,8BAA8B,CAAA;AAC5C,cAAc,YAAY,CAAA"}
package/dist/index.js CHANGED
@@ -40,14 +40,17 @@
40
40
  * @remarks
41
41
  * This is NOT the Angular binding for `@molecule/app-timeline` (the headless
42
42
  * provider core wired via `setProvider`) — it is standalone presentational
43
- * markup with no provider. For domain-specific rows see the sibling
44
- * `@molecule/app-{activity,order,status,stage,day}-timeline-angular` packages.
43
+ * markup with no provider. For domain-specific rows see the sibling packages
44
+ * `@molecule/app-activity-timeline-angular`, `@molecule/app-order-timeline-angular`,
45
+ * `@molecule/app-status-timeline-angular`, `@molecule/app-stage-timeline-angular` and
46
+ * `@molecule/app-day-timeline-angular`.
45
47
  *
46
48
  * `TimelineEventData.accent` is currently INERT — no component reads it, so
47
49
  * setting it changes nothing; color a row by passing a custom `marker` node
48
50
  * instead. `timestamp` is a display node — format/translate it before
49
51
  * passing. Node-valued props are `ng-template` references; `Timeline`'s root is
50
- * a fragment in its empty branch, so its host is `display: contents`, and rows
52
+ * a fragment in its empty branch, so its content renders in the host's place
53
+ * and the host itself leaves the page, and rows
51
54
  * are tracked by the event's `id`, like React's keys. The prop surface
52
55
  * (documented on the exported `TimelineProps`, `TimelineEventProps`,
53
56
  * `TimelineRailProps` and `TimelineDateProps` interfaces):
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0DG;AAEH,cAAc,yBAAyB,CAAA;AACvC,cAAc,8BAA8B,CAAA;AAC5C,cAAc,+BAA+B,CAAA;AAC7C,cAAc,8BAA8B,CAAA;AAC5C,cAAc,YAAY,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6DG;AAEH,cAAc,yBAAyB,CAAA;AACvC,cAAc,8BAA8B,CAAA;AAC5C,cAAc,+BAA+B,CAAA;AAC7C,cAAc,8BAA8B,CAAA;AAC5C,cAAc,YAAY,CAAA"}
@@ -1,7 +1,8 @@
1
- import { type AfterViewChecked, type AfterViewInit, type DoCheck, TemplateRef } from '@angular/core';
1
+ import { TemplateRef } from '@angular/core';
2
2
  import type { UIClassMap } from '@molecule/app-ui';
3
3
  import type { TimelineEventData } from './types.js';
4
4
  import * as i0 from "@angular/core";
5
+ import * as i1 from "@molecule/app-angular";
5
6
  /**
6
7
  * Timeline component.
7
8
  *
@@ -11,13 +12,13 @@ import * as i0 from "@angular/core";
11
12
  * the event as `$implicit` / `a0` and its predecessor as `a1`.
12
13
  *
13
14
  * React's root is the wrapper `<div>` — or, with no events and an empty state,
14
- * that empty state alone (a fragment). A host element always exists in Angular,
15
- * so this component's host is transparent (`mol-timeline`, `display: contents`,
16
- * unwrapped by the conformance normalizer) and the template renders whichever
17
- * root React would. The empty state is projected content
15
+ * that empty state alone (a fragment). Everything the host holds (the empty
16
+ * state's capture and the wrapper `<div>`) renders in the host's place and the
17
+ * host itself leaves the page, so the fragment root is React's exact DOM. The
18
+ * empty state is projected content
18
19
  * (`[slot=emptyState]`) or a template reference passed as an input, reconciled
19
- * against React's branch by {@link Timeline.ngAfterViewInit} /
20
- * {@link Timeline.ngAfterViewChecked} / {@link Timeline.ngDoCheck}. Rows are
20
+ * against React's branch by the placement function registered in the
21
+ * constructor. Rows are
21
22
  * tracked by the event's `id` value (`@for (…; track event.id)`), like React's
22
23
  * per-item keys.
23
24
  *
@@ -25,7 +26,7 @@ import * as i0 from "@angular/core";
25
26
  * `Timeline`: the same props (React names), the same ClassMap tokens, and the
26
27
  * same DOM for the same input.
27
28
  */
28
- export declare class Timeline implements AfterViewInit, AfterViewChecked, DoCheck {
29
+ export declare class Timeline {
29
30
  /** Events in display order. */
30
31
  events: TimelineEventData[];
31
32
  /** Optional renderer for date separators: a template reference with the event in its context. */
@@ -34,11 +35,12 @@ export declare class Timeline implements AfterViewInit, AfterViewChecked, DoChec
34
35
  emptyState?: unknown;
35
36
  /** Extra classes on the outer wrapper. */
36
37
  className?: string;
37
- /** The projected empty-state capture point (unwrapped, so React's bare slot). */
38
+ /** The projected empty-state capture point (its content renders in its place, and it leaves the page). */
38
39
  private empty?;
39
40
  /** The wrapper `<div>` (detached when the empty state renders instead). */
40
41
  private list?;
41
- private readonly guard;
42
+ private readonly host;
43
+ constructor();
42
44
  /**
43
45
  * The current class map.
44
46
  * @returns The UIClassMap.
@@ -73,29 +75,15 @@ export declare class Timeline implements AfterViewInit, AfterViewChecked, DoChec
73
75
  * @returns The template context.
74
76
  */
75
77
  separatorContext(event: TimelineEventData, index: number): Record<string, unknown>;
76
- /**
77
- * Reconciles the projected empty state and the wrapper against React's
78
- * branch once the view queries resolve.
79
- */
80
- ngAfterViewInit(): void;
81
- /**
82
- * Re-reconciles on later passes, so a props step that empties or refills the
83
- * list swaps the branch the way React does.
84
- */
85
- ngDoCheck(): void;
86
- /**
87
- * Re-reconciles after each view update: a node-valued empty state that arrives
88
- * through an input renders into its outlet only during the update, so the
89
- * branch decision must be read afterwards.
90
- */
91
- ngAfterViewChecked(): void;
92
78
  /**
93
79
  * Applies React's condition: with no events and an empty state, the empty
94
80
  * state renders bare and the wrapper disappears; otherwise the wrapper
95
81
  * renders and the empty state is dropped.
82
+ *
83
+ * @param hasContent - Reads whether a slot has content.
96
84
  */
97
85
  private reconcile;
98
86
  static ɵfac: i0.ɵɵFactoryDeclaration<Timeline, never>;
99
- static ɵcmp: i0.ɵɵComponentDeclaration<Timeline, "mol-timeline", never, { "events": { "alias": "events"; "required": false; }; "renderDateSeparator": { "alias": "renderDateSeparator"; "required": false; }; "emptyState": { "alias": "emptyState"; "required": false; }; "className": { "alias": "className"; "required": false; }; }, {}, never, ["[slot=emptyState]"], true, never>;
87
+ static ɵcmp: i0.ɵɵComponentDeclaration<Timeline, "mol-timeline", never, { "events": { "alias": "events"; "required": false; }; "renderDateSeparator": { "alias": "renderDateSeparator"; "required": false; }; "emptyState": { "alias": "emptyState"; "required": false; }; "className": { "alias": "className"; "required": false; }; }, {}, never, ["[slot=emptyState]"], true, [{ directive: typeof i1.MolPlacement; inputs: {}; outputs: {}; }]>;
100
88
  }
101
89
  //# sourceMappingURL=timeline.component.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"timeline.component.d.ts","sourceRoot":"","sources":["../src/timeline.component.ts"],"names":[],"mappings":"AAOA,OAAO,EACL,KAAK,gBAAgB,EACrB,KAAK,aAAa,EAElB,KAAK,OAAO,EAIZ,WAAW,EAEZ,MAAM,eAAe,CAAA;AAEtB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAKlD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAA;;AAEnD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,qBAYa,QAAS,YAAW,aAAa,EAAE,gBAAgB,EAAE,OAAO;IACvE,+BAA+B;IAC/B,MAAM,EAAE,iBAAiB,EAAE,CAAK;IAChC,iGAAiG;IACjG,mBAAmB,CAAC,EAAE,WAAW,CAAC,OAAO,C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,mBAAmB,CAAC,EAAE,WAAW,CAAC,OAAO,CAAC,CAAA;IAC1C,mGAAmG;IACnG,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,0CAA0C;IAC1C,SAAS,CAAC,EAAE,MAAM,CAAA;IAElB,0GAA0G;IACtF,OAAO,CAAC,KAAK,CAAC,CAAyB;IAE3D,2EAA2E;IACxD,OAAO,CAAC,IAAI,CAAC,CAAyB;IAEzD,OAAO,CAAC,QAAQ,CAAC,IAAI,CAA8C;;IAQnE;;;OAGG;IACH,EAAE,IAAI,UAAU;IAIhB;;;OAGG;IACH,OAAO,IAAI,MAAM;IAIjB;;;;OAIG;IACH,aAAa,IAAI,WAAW,CAAC,OAAO,CAAC,GAAG,IAAI;IAK5C;;;OAGG;IACH,SAAS,IAAI,MAAM,GAAG,IAAI;IAM1B;;;OAGG;IACH,iBAAiB,IAAI,WAAW,CAAC,OAAO,CAAC,GAAG,IAAI;IAIhD;;;;;;OAMG;IACH,gBAAgB,CAAC,KAAK,EAAE,iBAAiB,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAKlF;;;;;;OAMG;IACH,OAAO,CAAC,SAAS;yCAvFN,QAAQ;2CAAR,QAAQ;CA2GpB"}
@@ -4,11 +4,12 @@
4
4
  * @module
5
5
  */
6
6
  import { NgTemplateOutlet } from '@angular/common';
7
- import { Component, ElementRef, inject, Renderer2, TemplateRef, ViewChild, } from '@angular/core';
7
+ import { Component, ElementRef, inject, TemplateRef, ViewChild } from '@angular/core';
8
+ import { MolPlacement, placeContent, placeContentBefore, setElementPresent, usePlacement, } from '@molecule/app-angular';
8
9
  import { getClassMap } from '@molecule/app-ui';
9
- import { hasNodes, SlotGuard } from './slot-dom.js';
10
10
  import { TimelineEvent } from './timeline-event.component.js';
11
11
  import * as i0 from "@angular/core";
12
+ import * as i1 from "@molecule/app-angular";
12
13
  const _c0 = ["empty"];
13
14
  const _c1 = ["list"];
14
15
  const _c2 = [[["", "slot", "emptystate"]]];
@@ -20,12 +21,12 @@ function Timeline_Conditional_2_Template(rf, ctx) { if (rf & 1) {
20
21
  i0.ɵɵtextInterpolate(ctx);
21
22
  } }
22
23
  function Timeline_Conditional_3_Template(rf, ctx) { if (rf & 1) {
23
- i0.ɵɵelementContainer(0, 3);
24
+ i0.ɵɵelementContainer(0, 2);
24
25
  } if (rf & 2) {
25
26
  i0.ɵɵproperty("ngTemplateOutlet", ctx);
26
27
  } }
27
28
  function Timeline_For_8_Conditional_1_Template(rf, ctx) { if (rf & 1) {
28
- i0.ɵɵelementContainer(0, 4);
29
+ i0.ɵɵelementContainer(0, 3);
29
30
  } if (rf & 2) {
30
31
  const ctx_r0 = i0.ɵɵnextContext();
31
32
  const event_r2 = ctx_r0.$implicit;
@@ -35,8 +36,8 @@ function Timeline_For_8_Conditional_1_Template(rf, ctx) { if (rf & 1) {
35
36
  } }
36
37
  function Timeline_For_8_Template(rf, ctx) { if (rf & 1) {
37
38
  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);
39
+ i0.ɵɵconditionalCreate(1, Timeline_For_8_Conditional_1_Template, 1, 2, "ng-container", 3);
40
+ i0.ɵɵelement(2, "div", 4);
40
41
  i0.ɵɵelementEnd();
41
42
  } if (rf & 2) {
42
43
  let tmp_13_0;
@@ -57,13 +58,13 @@ function Timeline_For_8_Template(rf, ctx) { if (rf & 1) {
57
58
  * the event as `$implicit` / `a0` and its predecessor as `a1`.
58
59
  *
59
60
  * 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
61
+ * that empty state alone (a fragment). Everything the host holds (the empty
62
+ * state's capture and the wrapper `<div>`) renders in the host's place and the
63
+ * host itself leaves the page, so the fragment root is React's exact DOM. The
64
+ * empty state is projected content
64
65
  * (`[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
66
+ * against React's branch by the placement function registered in the
67
+ * constructor. Rows are
67
68
  * tracked by the event's `id` value (`@for (…; track event.id)`), like React's
68
69
  * per-item keys.
69
70
  *
@@ -80,11 +81,16 @@ export class Timeline {
80
81
  emptyState;
81
82
  /** Extra classes on the outer wrapper. */
82
83
  className;
83
- /** The projected empty-state capture point (unwrapped, so React's bare slot). */
84
+ /** The projected empty-state capture point (its content renders in its place, and it leaves the page). */
84
85
  empty;
85
86
  /** The wrapper `<div>` (detached when the empty state renders instead). */
86
87
  list;
87
- guard = new SlotGuard(inject(ElementRef), inject(Renderer2));
88
+ host = inject(ElementRef);
89
+ constructor() {
90
+ // React's root is the wrapper `<div>`, or the empty state alone (a fragment): the
91
+ // host's content renders in the host's place and the host itself leaves the page.
92
+ usePlacement((hasContent) => this.reconcile(hasContent));
93
+ }
88
94
  /**
89
95
  * The current class map.
90
96
  * @returns The UIClassMap.
@@ -138,39 +144,33 @@ export class Timeline {
138
144
  const prev = index > 0 ? this.events[index - 1] : undefined;
139
145
  return { $implicit: event, a0: event, a1: prev, a2: undefined };
140
146
  }
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
147
  /**
164
148
  * Applies React's condition: with no events and an empty state, the empty
165
149
  * state renders bare and the wrapper disappears; otherwise the wrapper
166
150
  * renders and the empty state is dropped.
151
+ *
152
+ * @param hasContent - Reads whether a slot has content.
167
153
  */
168
- reconcile() {
154
+ reconcile(hasContent) {
155
+ const host = this.host.nativeElement;
169
156
  const empty = this.empty?.nativeElement;
170
157
  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);
158
+ const hasEmpty = (this.events?.length ?? 0) === 0 && hasContent(empty);
159
+ if (hasEmpty) {
160
+ // The capture's content renders exactly where the capture stood, and the capture
161
+ // itself leaves the page.
162
+ placeContentBefore(empty, empty);
163
+ }
164
+ else {
165
+ // Back inside the capture, so it leaves the page with it.
166
+ placeContent(empty, null);
167
+ }
168
+ setElementPresent(empty, false);
169
+ setElementPresent(list, !hasEmpty);
170
+ // React's root is the fragment: everything renders in the host's place, and the host
171
+ // itself leaves the page.
172
+ placeContentBefore(host, host);
173
+ setElementPresent(host, false);
174
174
  }
175
175
  static ɵfac = function Timeline_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || Timeline)(); };
176
176
  static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: Timeline, selectors: [["mol-timeline"]], viewQuery: function Timeline_Query(rf, ctx) { if (rf & 1) {
@@ -179,11 +179,11 @@ export class Timeline {
179
179
  let _t;
180
180
  i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.empty = _t.first);
181
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) {
182
+ } }, inputs: { events: "events", renderDateSeparator: "renderDateSeparator", emptyState: "emptyState", className: "className" }, features: [i0.ɵɵHostDirectivesFeature([i1.MolPlacement])], ngContentSelectors: _c3, decls: 9, vars: 4, consts: [["empty", ""], ["list", ""], [3, "ngTemplateOutlet"], [3, "ngTemplateOutlet", "ngTemplateOutletContext"], ["mol-timeline-event", "", 3, "event", "isLast"]], template: function Timeline_Template(rf, ctx) { if (rf & 1) {
183
183
  i0.ɵɵprojectionDef(_c2);
184
- i0.ɵɵelementStart(0, "span", 2, 0);
184
+ i0.ɵɵelementStart(0, "span", null, 0);
185
185
  i0.ɵɵconditionalCreate(2, Timeline_Conditional_2_Template, 1, 1);
186
- i0.ɵɵconditionalCreate(3, Timeline_Conditional_3_Template, 1, 1, "ng-container", 3);
186
+ i0.ɵɵconditionalCreate(3, Timeline_Conditional_3_Template, 1, 1, "ng-container", 2);
187
187
  i0.ɵɵprojection(4);
188
188
  i0.ɵɵelementEnd();
189
189
  i0.ɵɵelementStart(5, "div", null, 1);
@@ -207,21 +207,18 @@ export class Timeline {
207
207
  args: [{
208
208
  selector: 'mol-timeline',
209
209
  standalone: true,
210
+ hostDirectives: [MolPlacement],
210
211
  imports: [NgTemplateOutlet, TimelineEvent],
211
212
  inputs: ['events', 'renderDateSeparator', 'emptyState', 'className'],
212
- host: {
213
- 'data-parity-unwrap': '',
214
- style: 'display: contents',
215
- },
216
213
  // 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>`,
214
+ template: `<span #empty>@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
215
  }]
219
- }], null, { empty: [{
216
+ }], () => [], { empty: [{
220
217
  type: ViewChild,
221
218
  args: ['empty']
222
219
  }], list: [{
223
220
  type: ViewChild,
224
221
  args: ['list']
225
222
  }] }); })();
226
- (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(Timeline, { className: "Timeline", filePath: "timeline.component.ts", lineNumber: 62 }); })();
223
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(Timeline, { className: "Timeline", filePath: "timeline.component.ts", lineNumber: 56 }); })();
227
224
  //# sourceMappingURL=timeline.component.js.map
@@ -1 +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,sC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AAY,CAAC,KAAK,EAAE,IAAI,CAAC,CAAA;QAC3B,CAAC;QACD,iBAAiB,CAAC,KAAK,EAAE,KAAK,CAAC,CAAA;QAC/B,iBAAiB,CAAC,IAAI,EAAE,CAAC,QAAQ,CAAC,CAAA;QAClC,qFAAqF;QACrF,0BAA0B;QAC1B,kBAAkB,CAAC,IAAI,EAAE,IAAI,CAAC,CAAA;QAC9B,iBAAiB,CAAC,IAAI,EAAE,KAAK,CAAC,CAAA;IAChC,CAAC;kGA1GU,QAAQ;6DAAR,QAAQ;;;;;;;;YAFR,qCAAa;YAAA,gEAA4B;YAAW,mFAAiC;YAAyD,kBAAoD;YAAA,iBAAO;YAAA,oCAA+B;YAAA,8EAAkT;YAAA,iBAAM;;;;YAAnhB,eAAuC;YAAvC,+DAAuC;YAAA,cAA0F;YAA1F,mEAA0F;YAAsE,eAAmB;YAAnB,4BAAmB;YAAC,eAAkT;YAAlT,yBAAkT;4BAH3hB,gBAAgB,EAAE,aAAa;;iFAK9B,QAAQ;cATpB,SAAS;eAAC;gBACT,QAAQ,EAAE,cAAc;gBACxB,UAAU,EAAE,IAAI;gBAChB,cAAc,EAAE,CAAC,YAAY,CAAC;gBAC9B,OAAO,EAAE,CAAC,gBAAgB,EAAE,aAAa,CAAC;gBAC1C,MAAM,EAAE,CAAC,QAAQ,EAAE,qBAAqB,EAAE,YAAY,EAAE,WAAW,CAAC;gBACpE,kBAAkB;gBAClB,QAAQ,EAAE,kiBAAkiB;aAC7iB;;kBAYE,SAAS;mBAAC,OAAO;;kBAGjB,SAAS;mBAAC,MAAM;;kFAdN,QAAQ"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@molecule/app-timeline-angular",
3
- "version": "0.0.1-stage",
3
+ "version": "1.1.1",
4
4
  "description": "Angular chronological timeline with event rails and date markers",
5
5
  "homepage": "https://www.molecule.dev/packages/app-timeline-angular",
6
6
  "type": "module",
@@ -45,7 +45,7 @@
45
45
  "@angular/common": "^22.0.0",
46
46
  "@angular/core": "^22.0.0",
47
47
  "@angular/platform-browser": "^22.0.0",
48
- "@molecule/app-angular": "^3.5.0",
48
+ "@molecule/app-angular": "^3.13.0",
49
49
  "@molecule/app-ui": "^1.0.1",
50
50
  "@molecule/app-ui-angular": "^1.1.0"
51
51
  },
@@ -55,14 +55,14 @@
55
55
  "@angular/compiler-cli": "22.2.3",
56
56
  "@angular/core": "22.2.3",
57
57
  "@angular/platform-browser": "22.2.3",
58
- "@molecule/app-angular": "3.7.2",
58
+ "@molecule/app-angular": "3.13.0",
59
59
  "@molecule/app-framework-conformance": "0.0.0",
60
60
  "@molecule/app-i18n": "1.2.2",
61
61
  "@molecule/app-icons": "1.0.4",
62
- "@molecule/app-ui": "1.4.0",
63
- "@molecule/app-ui-angular": "1.2.1",
62
+ "@molecule/app-ui": "1.5.0",
63
+ "@molecule/app-ui-angular": "1.5.1",
64
64
  "@types/node": "26.6.5",
65
- "jsdom": "30.1.3",
65
+ "jsdom": "31.0.1",
66
66
  "rxjs": "7.8.2",
67
67
  "typescript": "6.0.3",
68
68
  "vitest": "4.1.12",
@@ -1,57 +0,0 @@
1
- /**
2
- * DOM helpers for the projected capture points of {@link Timeline}.
3
- *
4
- * React renders the empty state bare and drops the wrapper, or renders the
5
- * wrapper and drops the empty state. Angular projection needs an
6
- * always-mounted `<ng-content>` capture point, so the wrapper lives in the
7
- * template unconditionally and these helpers reconcile it against React's DOM:
8
- * the capture point is marked `data-parity-unwrap` (the snapshot expands it, so
9
- * it looks like React's bare slot) and is detached together with its contents
10
- * when React would not render it.
11
- *
12
- * @module
13
- */
14
- import type { ElementRef, Renderer2 } from '@angular/core';
15
- /**
16
- * Whether an ng-content wrapper captured any element or text node.
17
- *
18
- * @param el - The wrapper element.
19
- * @returns True when at least one projected node exists.
20
- */
21
- export declare const hasNodes: (el: Element | undefined | null) => boolean;
22
- /**
23
- * Reconciles one always-mounted wrapper against what React renders.
24
- *
25
- * Both operations are idempotent and anchored in the wrapper's current parent
26
- * (default: the component host), so a wrapper whose contents move with it can
27
- * be detached and re-attached across prop changes.
28
- */
29
- export declare class SlotGuard {
30
- private readonly host;
31
- private readonly renderer;
32
- private readonly anchors;
33
- /**
34
- * Creates the guard.
35
- *
36
- * @param host - The component host element (default anchor parent).
37
- * @param renderer - The DOM renderer.
38
- */
39
- constructor(host: ElementRef<HTMLElement>, renderer: Renderer2);
40
- /**
41
- * Attaches or detaches the element (contents move with it).
42
- *
43
- * @param el - The wrapper element.
44
- * @param shouldAttach - Whether it should be in the DOM.
45
- */
46
- toggle(el: Element | undefined | null, shouldAttach: boolean): void;
47
- /**
48
- * Returns the wrapper's anchor comment in `parent`, creating (or replacing a
49
- * stale one) where the wrapper sits.
50
- *
51
- * @param parent - The anchor's parent.
52
- * @param el - The wrapper the anchor stands for.
53
- * @returns The connected anchor comment.
54
- */
55
- private anchorIn;
56
- }
57
- //# sourceMappingURL=slot-dom.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"slot-dom.d.ts","sourceRoot":"","sources":["../src/slot-dom.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAE1D;;;;;GAKG;AACH,eAAO,MAAM,QAAQ,GAAI,IAAI,OAAO,GAAG,SAAS,GAAG,IAAI,KAAG,OAOzD,CAAA;AAED;;;;;;GAMG;AACH,qBAAa,SAAS;IAUlB,OAAO,CAAC,QAAQ,CAAC,IAAI;IACrB,OAAO,CAAC,QAAQ,CAAC,QAAQ;IAV3B,OAAO,CAAC,QAAQ,CAAC,OAAO,CAA8B;IAEtD;;;;;OAKG;gBAEgB,IAAI,EAAE,UAAU,CAAC,WAAW,CAAC,EAC7B,QAAQ,EAAE,SAAS;IAGtC;;;;;OAKG;IACH,MAAM,CAAC,EAAE,EAAE,OAAO,GAAG,SAAS,GAAG,IAAI,EAAE,YAAY,EAAE,OAAO,GAAG,IAAI;IAoBnE;;;;;;;OAOG;IACH,OAAO,CAAC,QAAQ;CASjB"}
package/dist/slot-dom.js DELETED
@@ -1,100 +0,0 @@
1
- /**
2
- * DOM helpers for the projected capture points of {@link Timeline}.
3
- *
4
- * React renders the empty state bare and drops the wrapper, or renders the
5
- * wrapper and drops the empty state. Angular projection needs an
6
- * always-mounted `<ng-content>` capture point, so the wrapper lives in the
7
- * template unconditionally and these helpers reconcile it against React's DOM:
8
- * the capture point is marked `data-parity-unwrap` (the snapshot expands it, so
9
- * it looks like React's bare slot) and is detached together with its contents
10
- * when React would not render it.
11
- *
12
- * @module
13
- */
14
- /**
15
- * Whether an ng-content wrapper captured any element or text node.
16
- *
17
- * @param el - The wrapper element.
18
- * @returns True when at least one projected node exists.
19
- */
20
- export const hasNodes = (el) => {
21
- if (!el)
22
- return false;
23
- for (const node of Array.from(el.childNodes)) {
24
- if (node.nodeType === 1)
25
- return true;
26
- if (node.nodeType === 3 && (node.textContent ?? '').trim())
27
- return true;
28
- }
29
- return false;
30
- };
31
- /**
32
- * Reconciles one always-mounted wrapper against what React renders.
33
- *
34
- * Both operations are idempotent and anchored in the wrapper's current parent
35
- * (default: the component host), so a wrapper whose contents move with it can
36
- * be detached and re-attached across prop changes.
37
- */
38
- export class SlotGuard {
39
- host;
40
- renderer;
41
- anchors = new Map();
42
- /**
43
- * Creates the guard.
44
- *
45
- * @param host - The component host element (default anchor parent).
46
- * @param renderer - The DOM renderer.
47
- */
48
- constructor(host, renderer) {
49
- this.host = host;
50
- this.renderer = renderer;
51
- }
52
- /**
53
- * Attaches or detaches the element (contents move with it).
54
- *
55
- * @param el - The wrapper element.
56
- * @param shouldAttach - Whether it should be in the DOM.
57
- */
58
- toggle(el, shouldAttach) {
59
- if (!el)
60
- return;
61
- const parent = el.parentElement ?? this.host.nativeElement;
62
- if (shouldAttach && !el.isConnected) {
63
- const anchor = this.anchors.get(el);
64
- if (anchor?.isConnected) {
65
- parent.insertBefore(el, anchor);
66
- this.renderer.removeChild(parent, anchor);
67
- this.anchors.delete(el);
68
- }
69
- else {
70
- parent.appendChild(el);
71
- }
72
- }
73
- else if (!shouldAttach && el.isConnected) {
74
- // A placeholder comment keeps the re-insertion position stable; the
75
- // conformance normalizer strips comment nodes, so it never shows.
76
- this.anchorIn(parent, el);
77
- this.renderer.removeChild(parent, el);
78
- }
79
- }
80
- /**
81
- * Returns the wrapper's anchor comment in `parent`, creating (or replacing a
82
- * stale one) where the wrapper sits.
83
- *
84
- * @param parent - The anchor's parent.
85
- * @param el - The wrapper the anchor stands for.
86
- * @returns The connected anchor comment.
87
- */
88
- anchorIn(parent, el) {
89
- const existing = this.anchors.get(el);
90
- if (existing?.isConnected && existing.parentNode === parent)
91
- return existing;
92
- if (existing)
93
- this.anchors.delete(el);
94
- const created = this.renderer.createComment('slot');
95
- parent.insertBefore(created, el.isConnected ? el : null);
96
- this.anchors.set(el, created);
97
- return created;
98
- }
99
- }
100
- //# sourceMappingURL=slot-dom.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"slot-dom.js","sourceRoot":"","sources":["../src/slot-dom.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAIH;;;;;GAKG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,EAA8B,EAAW,EAAE;IAClE,IAAI,CAAC,EAAE;QAAE,OAAO,KAAK,CAAA;IACrB,KAAK,MAAM,IAAI,IAAI,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,EAAE,CAAC;QAC7C,IAAI,IAAI,CAAC,QAAQ,KAAK,CAAC;YAAE,OAAO,IAAI,CAAA;QACpC,IAAI,IAAI,CAAC,QAAQ,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE;YAAE,OAAO,IAAI,CAAA;IACzE,CAAC;IACD,OAAO,KAAK,CAAA;AACd,CAAC,CAAA;AAED;;;;;;GAMG;AACH,MAAM,OAAO,SAAS;IAUD;IACA;IAVF,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