BlockDex

Components

Registries

Free blocks

Method

BlockDex

Components

Registries

Free blocks

Method

Open API

BlockDex

Components

Registries

Free blocks

Method

Open API

Components/@zard/core

core

zard/core
FreeComponent

@zard publishes no description for this item.

Live preview

live · rendered by the registry
Rendered by @zard on their own page — this is the component running, not a screenshot of it.

Install it

npx shadcn@latest add https://www.zardui.com/r/core.json

Source

directives/string-template-outlet/string-template-outlet.directive.tswww.zardui.com/r/core.json
1import {
2 Directive,
3 type EmbeddedViewRef,
4 inject,
5 input,
6 type OnDestroy,
7 TemplateRef,
8 ViewContainerRef,
9 effect,
10 type EffectRef,
11} from '@angular/core';
12
13export function isTemplateRef<C = unknown>(value: unknown): value is TemplateRef<C> {
14 return value instanceof TemplateRef;
15}
16
17export interface ZardStringTemplateOutletContext {
18 $implicit: unknown;
19 [key: string]: unknown;
20}
21
22@Directive({
23 selector: '[zStringTemplateOutlet]',
24 exportAs: 'zStringTemplateOutlet',
25})
26export class ZardStringTemplateOutletDirective<T = unknown> implements OnDestroy {
27 private readonly viewContainer = inject(ViewContainerRef);
28 private readonly templateRef = inject(TemplateRef<void>);
29
30 private embeddedViewRef: EmbeddedViewRef<ZardStringTemplateOutletContext> | null = null;
31 private readonly context = {} as ZardStringTemplateOutletContext;
32
33 #isFirstChange = true;
34 #lastOutletWasTemplate = false;
35 #lastTemplateRef: TemplateRef<void> | null = null;
36 #lastContext?: ZardStringTemplateOutletContext;
37
38 readonly zStringTemplateOutletContext = input<ZardStringTemplateOutletContext | undefined>(undefined);
39 readonly zStringTemplateOutlet = input.required<T | TemplateRef<void>>();
40
41 #hasContextShapeChanged(context: ZardStringTemplateOutletContext | undefined): boolean {
42 if (!context) {
43 return false;
44 }
45 const prevCtxKeys = Object.keys(this.#lastContext || {});
46 const currCtxKeys = Object.keys(context || {});
47
48 if (prevCtxKeys.length === currCtxKeys.length) {
49 for (const propName of currCtxKeys) {
50 if (!prevCtxKeys.includes(propName)) {
51 return true;
52 }
53 }
54 return false;
55 } else {
56 return true;
57 }
58 }
59
60 #shouldViewBeRecreated(
61 stringTemplateOutlet: TemplateRef<void> | T,
62 stringTemplateOutletContext: ZardStringTemplateOutletContext | undefined,
63 ): boolean {
64 const isTemplate = isTemplateRef(stringTemplateOutlet);
65
66 const shouldOutletRecreate =
67 this.#isFirstChange ||
68 isTemplate !== this.#lastOutletWasTemplate ||
69 (isTemplate && stringTemplateOutlet !== this.#lastTemplateRef);
70
71 const shouldContextRecreate = this.#hasContextShapeChanged(stringTemplateOutletContext);
72 return shouldContextRecreate || shouldOutletRecreate;
73 }
74
75 #updateTrackingState(
76 stringTemplateOutlet: TemplateRef<void> | T,
77 stringTemplateOutletContext: ZardStringTemplateOutletContext | undefined,
78 ): void {
79 const isTemplate = isTemplateRef(stringTemplateOutlet);
80// … truncated

Files it writes

  • directives/string-template-outlet/string-template-outlet.directive.ts
  • directives/id.directive.ts
  • provider/event-manager-plugins/zard-debounce-event-manager-plugin.ts
  • provider/event-manager-plugins/zard-event-manager-plugin.ts
  • provider/providezard.ts
  • css/tailwind.css
  • index.ts

Facts

Registry
@zard
Type
registry:component
Access
Free
Files written
7
Licence
MIT
First indexed
2026-08-10
Last confirmed
yesterday

Go to the source

Docs on @zard www.zardui.com zard-ui/zardui on GitHub Raw registry item This item as JSON

More from @zard

All 49 items
Same registry, same kind — the ones you would have found next
ComponentRegistryKindAccessInstallsCommand
accordionaccordion@zardComponentsFreeno deps · 5 files
alertalert@zardComponentsFreeno deps · 3 files
alert-dialogalert-dialog@zardComponentsFreeno deps · 5 files
avataravatar@zardComponentsFreeno deps · 4 files
badgebadge@zardComponentsFreeno deps · 3 files
breadcrumbbreadcrumb@zardComponentsFreeno deps · 4 files
buttonbutton@zardComponentsFreeno deps · 3 files
button-groupbutton-group@zardComponentsFreeno deps · 3 files
BlockDex

Built by

Kynth Studios

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

BlockDex

BlockDex

Built by

Kynth Studios

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

BlockDex

BlockDex

Built by

Kynth Studios

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

BlockDex