@molecule/app-annotation-pin-angular 0.0.1-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/README.md +31 -39
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -3,7 +3,7 @@ AUTO-GENERATED — DO NOT EDIT THIS FILE.
|
|
|
3
3
|
Generated by `mlcl sync-docs` from the package's src/index.ts JSDoc + mlcl/registry.json.
|
|
4
4
|
Edits here are overwritten on the next commit (molecule's pre-commit hook regenerates).
|
|
5
5
|
To change this document, edit the module-level JSDoc in src/index.ts.
|
|
6
|
-
Generated: 2026-11-
|
|
6
|
+
Generated: 2026-11-18T19:46:48.906Z
|
|
7
7
|
-->
|
|
8
8
|
|
|
9
9
|
# @molecule/app-annotation-pin-angular
|
|
@@ -394,71 +394,53 @@ This is the Angular counterpart of `@molecule/app-annotation-pin-react`.
|
|
|
394
394
|
'[attr.data-pin-selected]': 'selected ? "true" : "false"',
|
|
395
395
|
'[attr.style]': 'wrapperStyle()',
|
|
396
396
|
},
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
(click)="handleMarkerClick($event)"
|
|
400
|
-
[attr.aria-label]="markerLabel()"
|
|
401
|
-
[attr.aria-expanded]="selected ? 'true' : 'false'"
|
|
402
|
-
data-mol-id="annotation-pin-marker"
|
|
403
|
-
[class]="markerClasses()"
|
|
404
|
-
[ngStyle]="markerStyles()"
|
|
405
|
-
>
|
|
406
|
-
<span [class]="labelClasses()" data-mol-id="annotation-pin-label" [attr.style]="labelStyle()">
|
|
407
|
-
@if (labelTemplate(); as tpl) {
|
|
408
|
-
<ng-container [ngTemplateOutlet]="tpl" />
|
|
409
|
-
} @else if (labelText() !== null) {
|
|
410
|
-
{{ labelText() }}
|
|
411
|
-
}
|
|
412
|
-
<span #labelSlot data-parity-unwrap><ng-content select="[slot=label]"></ng-content></span
|
|
413
|
-
></span>
|
|
414
|
-
</button>
|
|
415
|
-
<div
|
|
416
|
-
#popupEl
|
|
417
|
-
role="dialog"
|
|
418
|
-
[attr.aria-label]="popupLabel()"
|
|
419
|
-
data-mol-id="annotation-pin-popup"
|
|
420
|
-
[attr.data-popup-side]="popupSide ?? 'right'"
|
|
421
|
-
[class]="popupClasses()"
|
|
422
|
-
[attr.style]="popupStyle()"
|
|
423
|
-
>
|
|
424
|
-
<div data-mol-id="annotation-pin-popup-body">
|
|
425
|
-
@if (noteTemplate(); as tpl) {
|
|
426
|
-
<ng-container [ngTemplateOutlet]="tpl" />
|
|
427
|
-
} @else if (noteText() !== null) {
|
|
428
|
-
{{ noteText() }}
|
|
429
|
-
}
|
|
430
|
-
<span #noteSlot data-parity-unwrap><ng-content select="[slot=note]"></ng-content></span
|
|
431
|
-
><span #emptyNoteEl data-mol-id="annotation-pin-popup-empty">{{ emptyNote() }}</span>
|
|
432
|
-
</div>
|
|
433
|
-
</div>`,
|
|
397
|
+
// prettier-ignore
|
|
398
|
+
template: `<button type="button" (click)="handleMarkerClick($event)" [attr.aria-label]="markerLabel()" [attr.aria-expanded]="selected ? 'true' : 'false'" data-mol-id="annotation-pin-marker" [class]="markerClasses()" [ngStyle]="markerStyles()"><span [class]="labelClasses()" data-mol-id="annotation-pin-label" [attr.style]="labelStyle()">@if (labelTemplate(); as tpl) {<ng-container [ngTemplateOutlet]="tpl" />} @else if (labelText() !== null) {{{ labelText() }}}<span #labelSlot data-parity-unwrap><ng-content select="[slot=label]"></ng-content></span></span></button><div #popupEl role="dialog" [attr.aria-label]="popupLabel()" data-mol-id="annotation-pin-popup" [attr.data-popup-side]="popupSide ?? 'right'" [class]="popupClasses()" [attr.style]="popupStyle()"><div data-mol-id="annotation-pin-popup-body">@if (noteTemplate(); as tpl) {<ng-container [ngTemplateOutlet]="tpl" />} @else if (noteText() !== null) {{{ noteText() }}}<span #noteSlot data-parity-unwrap><ng-content select="[slot=note]"></ng-content></span><span #emptyNoteEl data-mol-id="annotation-pin-popup-empty">{{ emptyNote() }}</span></div></div>`,
|
|
434
399
|
})
|
|
435
400
|
export class AnnotationPin implements AfterViewInit, DoCheck {
|
|
436
401
|
position!: { x: number; y: number }
|
|
437
402
|
label?: TemplateRef<unknown> | string | number | null
|
|
403
|
+
/** Popup body when selected — text, a template, or `[slot=note]` content. */
|
|
438
404
|
note?: TemplateRef<unknown> | string | number | null
|
|
405
|
+
/** Whether the popup is rendered (React's `selected`). */
|
|
439
406
|
selected?: boolean
|
|
407
|
+
/** Click handler — fires when the pin marker is clicked. */
|
|
440
408
|
onClick?: () => void
|
|
409
|
+
/** Side the popup renders on (defaults to `'right'` at read time). */
|
|
441
410
|
popupSide?: 'top' | 'bottom' | 'left' | 'right'
|
|
411
|
+
/** Extra classes merged onto the root wrapper. */
|
|
442
412
|
className?: string
|
|
413
|
+
/** Whether positions are normalised (defaults to `true` at read time). */
|
|
443
414
|
normalised?: boolean
|
|
444
415
|
|
|
445
416
|
@ViewChild('popupEl') private popupEl?: ElementRef<HTMLElement>
|
|
417
|
+
/** The `[slot=label]` capture point. */
|
|
446
418
|
@ViewChild('labelSlot') private labelSlot?: ElementRef<HTMLElement>
|
|
419
|
+
/** The `[slot=note]` capture point. */
|
|
447
420
|
@ViewChild('noteSlot') private noteSlot?: ElementRef<HTMLElement>
|
|
448
421
|
@ViewChild('emptyNoteEl') private emptyNoteEl?: ElementRef<HTMLElement>
|
|
449
422
|
|
|
423
|
+
/** The DOM renderer, for the attach/detach reconciliation. */
|
|
450
424
|
private readonly renderer: Renderer2 = inject(RendererFactory2).createRenderer(null, null)
|
|
425
|
+
/** Reconciles the popup against React's DOM. */
|
|
451
426
|
private readonly popupToggle = new ElementToggle(this.renderer)
|
|
427
|
+
/** Reconciles the label capture point. */
|
|
452
428
|
private readonly labelToggle = new ElementToggle(this.renderer)
|
|
429
|
+
/** Reconciles the note capture point. */
|
|
453
430
|
private readonly noteToggle = new ElementToggle(this.renderer)
|
|
431
|
+
/** Reconciles the empty-state line. */
|
|
454
432
|
private readonly emptyToggle = new ElementToggle(this.renderer)
|
|
433
|
+
/** Whether a `[slot=note]` projection landed. */
|
|
455
434
|
private noteProjected = false
|
|
435
|
+
/** Reactive translation, read in the injection context. */
|
|
456
436
|
private readonly i18n = useTranslation()
|
|
457
437
|
|
|
438
|
+
/** The current class map. */
|
|
458
439
|
cm(): UIClassMap {
|
|
459
440
|
return getClassMap()
|
|
460
441
|
}
|
|
461
442
|
|
|
443
|
+
/** The wrapper's class list (React's `cm.cn(className)`). */
|
|
462
444
|
classes(): string {
|
|
463
445
|
return this.cm().cn(this.className)
|
|
464
446
|
}
|
|
@@ -475,6 +457,7 @@ export class AnnotationPin implements AfterViewInit, DoCheck {
|
|
|
475
457
|
return this.cm().cn(this.cm().surface, this.cm().borderAll, this.cm().textSize('sm'))
|
|
476
458
|
}
|
|
477
459
|
|
|
460
|
+
/** The wrapper's inline style (React's `wrapperStyle`). */
|
|
478
461
|
wrapperStyle(): string {
|
|
479
462
|
const normalised = this.normalised ?? true
|
|
480
463
|
return styleString({
|
|
@@ -504,6 +487,7 @@ export class AnnotationPin implements AfterViewInit, DoCheck {
|
|
|
504
487
|
return styleString({ lineHeight: 1, pointerEvents: 'none' })
|
|
505
488
|
}
|
|
506
489
|
|
|
490
|
+
/** The popup's inline style (React's `popupStyle`, side-specific). */
|
|
507
491
|
popupStyle(): string {
|
|
508
492
|
const base: Record<string, string | number> = {
|
|
509
493
|
position: 'absolute',
|
|
@@ -540,18 +524,22 @@ export class AnnotationPin implements AfterViewInit, DoCheck {
|
|
|
540
524
|
return styleString(base)
|
|
541
525
|
}
|
|
542
526
|
|
|
527
|
+
/** The label as a template, when the caller passed a node. */
|
|
543
528
|
labelTemplate(): TemplateRef<unknown> | null {
|
|
544
529
|
return isTemplate(this.label) ? this.label : null
|
|
545
530
|
}
|
|
546
531
|
|
|
532
|
+
/** The label as text, when the caller passed one. */
|
|
547
533
|
labelText(): string | null {
|
|
548
534
|
return textOf(this.label)
|
|
549
535
|
}
|
|
550
536
|
|
|
537
|
+
/** The note as a template, when the caller passed a node. */
|
|
551
538
|
noteTemplate(): TemplateRef<unknown> | null {
|
|
552
539
|
return isTemplate(this.note) ? this.note : null
|
|
553
540
|
}
|
|
554
541
|
|
|
542
|
+
/** The note as text, when the caller passed one. */
|
|
555
543
|
noteText(): string | null {
|
|
556
544
|
return textOf(this.note)
|
|
557
545
|
}
|
|
@@ -572,10 +560,12 @@ export class AnnotationPin implements AfterViewInit, DoCheck {
|
|
|
572
560
|
return this.i18n.t('annotationPin.aria.marker', {}, { defaultValue: 'Annotation pin' })
|
|
573
561
|
}
|
|
574
562
|
|
|
563
|
+
/** The popup's accessible label (React's `annotationPin.aria.popup`). */
|
|
575
564
|
popupLabel(): string {
|
|
576
565
|
return this.i18n.t('annotationPin.aria.popup', {}, { defaultValue: 'Annotation details' })
|
|
577
566
|
}
|
|
578
567
|
|
|
568
|
+
/** The popup's empty-state text (React's `annotationPin.empty`). */
|
|
579
569
|
emptyNote(): string {
|
|
580
570
|
return this.i18n.t('annotationPin.empty', {}, { defaultValue: 'No notes for this pin.' })
|
|
581
571
|
}
|
|
@@ -594,17 +584,19 @@ export class AnnotationPin implements AfterViewInit, DoCheck {
|
|
|
594
584
|
this.emptyToggle.toggle(this.emptyNoteEl?.nativeElement, !this.hasNote())
|
|
595
585
|
}
|
|
596
586
|
|
|
587
|
+
/** Reconciles once the view (and its projections) exist. */
|
|
597
588
|
ngAfterViewInit(): void {
|
|
598
589
|
this.reconcile()
|
|
599
590
|
}
|
|
600
591
|
|
|
592
|
+
/** Reconciles after input writes, as React re-renders on a prop change. */
|
|
601
593
|
ngDoCheck(): void {
|
|
602
594
|
this.reconcile()
|
|
603
595
|
}
|
|
604
596
|
}
|
|
605
597
|
```
|
|
606
598
|
|
|
607
|
-
_(Member comments are left out to fit; the full declaration is in `node_modules/@molecule/app-annotation-pin-angular/dist/annotation-pin.component.d.ts`.)_
|
|
599
|
+
_(Member comments are shortened to their first sentence, and the 15 longest are left out to fit; the full declaration is in `node_modules/@molecule/app-annotation-pin-angular/dist/annotation-pin.component.d.ts`.)_
|
|
608
600
|
|
|
609
601
|
## Injection Notes
|
|
610
602
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@molecule/app-annotation-pin-angular",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "Pin/annotation marker overlay with click-to-place pins and label/note popups for 3d-model-viewer, image annotations, map pins, hotspot tours",
|
|
5
5
|
"homepage": "https://www.molecule.dev/packages/app-annotation-pin-angular",
|
|
6
6
|
"type": "module",
|
|
@@ -58,12 +58,12 @@
|
|
|
58
58
|
"@angular/compiler-cli": "22.2.3",
|
|
59
59
|
"@angular/core": "22.2.3",
|
|
60
60
|
"@angular/platform-browser": "22.2.3",
|
|
61
|
-
"@molecule/app-angular": "3.7.
|
|
61
|
+
"@molecule/app-angular": "3.7.2",
|
|
62
62
|
"@molecule/app-framework-conformance": "0.0.0",
|
|
63
63
|
"@molecule/app-i18n": "1.2.2",
|
|
64
64
|
"@molecule/app-icons": "1.0.4",
|
|
65
65
|
"@molecule/app-ui": "1.4.0",
|
|
66
|
-
"@molecule/app-ui-angular": "1.2.
|
|
66
|
+
"@molecule/app-ui-angular": "1.2.1",
|
|
67
67
|
"@types/node": "26.6.5",
|
|
68
68
|
"jsdom": "30.1.3",
|
|
69
69
|
"rxjs": "7.8.2",
|