| 67 | providers: [SplitResizerHandler], |
| 68 | }) |
| 69 | export default class Tutorial { |
| 70 | readonly content = viewChild<ElementRef<HTMLDivElement>>('content'); |
| 71 | readonly editor = viewChild<ElementRef<HTMLDivElement>>('editor'); |
| 72 | readonly resizer = viewChild.required<ElementRef<HTMLDivElement>>('resizer'); |
| 73 | readonly revealAnswerButton = viewChild<ElementRef<HTMLButtonElement>>('revealAnswerButton'); |
| 74 | |
| 75 | private readonly environmentInjector = inject(EnvironmentInjector); |
| 76 | private readonly elementRef = inject(ElementRef<unknown>); |
| 77 | private readonly embeddedTutorialManager = inject(EmbeddedTutorialManager); |
| 78 | private readonly nodeRuntimeState = inject(NodeRuntimeState); |
| 79 | private readonly splitResizerHandler = inject(SplitResizerHandler); |
| 80 | private readonly isBrowser = isPlatformBrowser(inject(PLATFORM_ID)); |
| 81 | |
| 82 | // Bound from the route data (the tutorial navigation item and its resolved content). |
| 83 | readonly docContent = input<DocContent>(); |
| 84 | readonly tutorialData = input<TutorialNavigationData>(); |
| 85 | readonly path = input<string>(); |
| 86 | readonly label = input<string>(); |
| 87 | readonly parent = input<TutorialNavigationItem>(); |
| 88 | |
| 89 | readonly documentContent = computed(() => this.docContent()?.contents ?? null); |
| 90 | readonly localTutorialZipUrl = signal<string | undefined>(undefined); |
| 91 | |
| 92 | readonly nextTutorialPath = signal<string | null>(null); |
| 93 | readonly stepName = signal<string | null>(null); |
| 94 | readonly tutorialName = signal<string | null>(null); |
| 95 | readonly tutorialNavigationItems = signal<NavigationItem[]>([]); |
| 96 | readonly showNavigationDropdown = signal<boolean>(false); |
| 97 | |
| 98 | readonly shouldRenderContent = signal<boolean>(false); |
| 99 | readonly shouldRenderEmbeddedEditor = signal<boolean>(false); |
| 100 | readonly shouldRenderRevealAnswer = signal<boolean>(false); |
| 101 | readonly restrictedMode = signal<boolean>(false); |
| 102 | |
| 103 | nextStepPath: string | undefined; |
| 104 | previousStepPath: string | undefined; |
| 105 | |
| 106 | embeddedEditorComponent = signal<Type<unknown> | null>(null); |
| 107 | |
| 108 | canRevealAnswer: Signal<boolean> = signal(false); |
| 109 | readonly answerRevealed = signal<boolean>(false); |
| 110 | |
| 111 | constructor() { |
| 112 | effect(() => { |
| 113 | const tutorialData = this.tutorialData(); |
| 114 | const path = this.path(); |
| 115 | const label = this.label(); |
| 116 | const parent = this.parent(); |
| 117 | if (!tutorialData || !path || !label) { |
| 118 | return; |
| 119 | } |
| 120 | untracked(() => this.setTutorialData({path, label, parent, tutorialData})); |
| 121 | }); |
| 122 | |
| 123 | const destroyRef = inject(DestroyRef); |
| 124 | afterNextRender(() => { |
| 125 | this.splitResizerHandler.init( |
| 126 | this.elementRef, |
nothing calls this directly
no test coverage detected