|
8 | 8 | import ClassTreeItem from "$src/components/Stimulus/ClassTreeItem.svelte" |
9 | 9 | import InspectButton from "$components/InspectButton.svelte" |
10 | 10 | import HTMLRenderer from "$src/browser_panel/HTMLRenderer.svelte" |
11 | | - import ScrollIntoViewButton from "$components/ScrollIntoViewButton.svelte" |
12 | | - import { getStimulusData } from "../../State.svelte.js" |
| 11 | + import { getStimulusData, getRegisteredStimulusIdentifiers } from "../../State.svelte.js" |
13 | 12 | import { flattenNodes, handleKeyboardNavigation, selectorByUUID } from "$utils/utils.js" |
14 | 13 | import { addHighlightOverlay, hideHighlightOverlay } from "../../messaging.js" |
15 | 14 | import { getDevtoolInstance } from "$lib/devtool.js" |
|
23 | 22 | controller: null, |
24 | 23 | }) |
25 | 24 | let stimulusControllers = $state([]) |
| 25 | + let registeredStimulusIdentifiers = $state([]) |
26 | 26 | let flattenStimulusControllers = $derived(flattenNodes(stimulusControllers)) |
27 | 27 | let uniqueIdentifiers = $derived([...new Set(flattenStimulusControllers.map((n) => n.identifier).filter(Boolean))].sort()) |
28 | 28 | let counts = $derived( |
|
47 | 47 | } |
48 | 48 | }) |
49 | 49 |
|
| 50 | + $effect(() => { |
| 51 | + registeredStimulusIdentifiers = getRegisteredStimulusIdentifiers() |
| 52 | + }) |
| 53 | +
|
50 | 54 | const getStimulusInstances = (identifier) => { |
51 | 55 | return flattenStimulusControllers.filter((n) => n.identifier === identifier) |
52 | 56 | } |
|
104 | 108 | } |
105 | 109 | }, 10) |
106 | 110 | } |
| 111 | +
|
| 112 | + const isIdentifierRegistered = (identifier) => { |
| 113 | + if (!registeredStimulusIdentifiers.length) return true |
| 114 | + return registeredStimulusIdentifiers.includes(identifier) |
| 115 | + } |
107 | 116 | </script> |
108 | 117 |
|
109 | 118 | <Splitpanes horizontal={$horizontalPanes} dblClickSplitter={false}> |
|
128 | 137 | class:selected={selected.identifier === identifier} |
129 | 138 | > |
130 | 139 | <div class="d-flex justify-content-between align-items-center"> |
131 | | - <div>{identifier}</div> |
| 140 | + <div id={`identifier-${index}`} class:error-text-underline={!isIdentifierRegistered(identifier)}> |
| 141 | + {identifier} |
| 142 | + </div> |
| 143 | + {#if !isIdentifierRegistered(identifier)} |
| 144 | + <wa-tooltip for={`identifier-${index}`} style="--max-width: 200px;"> |
| 145 | + <div>This controller does not appear to be registered in window.Stimulus.</div> |
| 146 | + </wa-tooltip> |
| 147 | + {/if} |
132 | 148 | <div>{counts[identifier]}</div> |
133 | 149 | </div> |
134 | 150 | </div> |
|
0 commit comments