@@ -5,7 +5,6 @@ import IconSearch from './icons/IconSearch.vue';
55import IconTrash from ' ./icons/IconTrash.vue' ;
66import IconListChecks from ' ./icons/IconListChecks.vue' ;
77import IconPreview from ' ./icons/IconPreview.vue' ;
8- import IconPlus from ' ./icons/IconPlus.vue' ;
98import IconArrowLeft from ' ./icons/IconArrowLeft.vue' ;
109import IconArrowRight from ' ./icons/IconArrowRight.vue' ;
1110import IconCopy from ' ./icons/IconCopy.vue' ;
@@ -81,6 +80,11 @@ function activateStructure(structureId) {
8180 store .setActiveWorkspaceTab (' explorer' );
8281}
8382
83+ function findStructure (structureId ) {
84+ activateStructure (structureId);
85+ store .runActiveKnownStructureMatching ();
86+ }
87+
8488function canFindStructure (structure ) {
8589 if (! structure? .browserRunnable || ! store .isCurrentInputParsed ()) {
8690 return false ;
@@ -107,14 +111,41 @@ function hasStructureMatches(structure) {
107111 return getStructureMatchCount (structure) > 0 ;
108112}
109113
110- function canPreviewStructure (structure ) {
111- return hasStructureMatches (structure) && store .canPreviewKnownStructureTransform (structure .id );
114+ function stepStructureMatch (structureId , direction = 1 ) {
115+ const matches = store .getKnownStructureMatches (structureId);
116+
117+ if (! matches .length ) {
118+ return ;
119+ }
120+
121+ store .setActiveKnownStructure (structureId);
122+
123+ const currentSelection = store .selectedKnownStructureMatch ? .structureId === structureId
124+ ? store .selectedKnownStructureMatch
125+ : null ;
126+ const rememberedIndex = store .knownStructureSelectionById [structureId];
127+ const currentIndex = currentSelection
128+ ? matches .findIndex ((match ) => match .index === currentSelection .index )
129+ : matches .findIndex ((match ) => match .index === rememberedIndex);
130+ const nextIndex = currentIndex === - 1
131+ ? direction > 0 ? 0 : matches .length - 1
132+ : (currentIndex + direction + matches .length ) % matches .length ;
133+
134+ store .setSelectedKnownStructureMatch (structureId, matches[nextIndex].index );
112135}
113136
114- function canAddStructureToPipeline (structure ) {
137+ function canTransformStructure (structure ) {
115138 return hasStructureMatches (structure) && store .canPreviewKnownStructureTransform (structure .id );
116139}
117140
141+ function openStructureTransform (structureId ) {
142+ store .previewKnownStructureTransform (structureId);
143+ store .setActiveTemplate (' apply-known-transform' );
144+ store .setInspectedKnownStructure (structureId);
145+ activateStructure (structureId);
146+ store .setActiveWorkspaceTab (' inspector' );
147+ }
148+
118149function toggleExpandedStructure (structureId ) {
119150 expandedStructureId .value = expandedStructureId .value === structureId ? null : structureId;
120151}
@@ -310,26 +341,45 @@ onBeforeUnmount(() => {
310341 < p class = " structure-description" > {{ structure .description }}< / p>
311342 < p class = " structure-note" > {{ structure .support .note }}< / p>
312343
313- < div class = " tag-row" >
314- < span v- for = " tag in structure.tags" : key= " tag" class = " tag" > #{{ tag }}< / span>
315- < / div>
316-
317344 < div class = " card-stats" >
318345 < span : class = " {highlighted: hasStructureMatches(structure)}" > {{ getStructureMatchCount (structure) }} matches< / span>
319346 < span> {{ structure .executionMode }}< / span>
320347 < / div>
321348
349+ < div v- if = " hasStructureMatches(structure)" class = " card-match-nav" >
350+ < button
351+ class = " structure-action structure-action-compact"
352+ type= " button"
353+ title= " Jump to the previous match for this structure"
354+ aria- label= " Previous structure match"
355+ @click= " stepStructureMatch(structure.id, -1)"
356+ >
357+ < icon- arrow- left / >
358+ < span> Prev< / span>
359+ < / button>
360+ < button
361+ class = " structure-action structure-action-compact"
362+ type= " button"
363+ title= " Jump to the next match for this structure"
364+ aria- label= " Next structure match"
365+ @click= " stepStructureMatch(structure.id, 1)"
366+ >
367+ < span> Next< / span>
368+ < icon- arrow- right / >
369+ < / button>
370+ < / div>
371+
322372 < div class = " card-actions" >
323373 < button
324374 class = " structure-action"
325375 type= " button"
326376 : disabled= " !canFindStructure(structure)"
327- title= " Run matching for this structure and focus it in the workspace "
328- aria- label= " Find matches for this structure"
329- @click= " activateStructure (structure.id)"
377+ title= " Run matching for just this structure"
378+ aria- label= " Match this structure"
379+ @click= " findStructure (structure.id)"
330380 >
331381 < icon- search / >
332- < span> Find < / span>
382+ < span> Match < / span>
333383 < / button>
334384 < button
335385 class = " structure-action"
@@ -355,24 +405,13 @@ onBeforeUnmount(() => {
355405 < button
356406 class = " structure-action"
357407 type= " button"
358- : disabled= " !canPreviewStructure (structure)"
359- title= " Preview the built-in transform for this structure without adding it to the pipeline "
360- aria- label= " Preview structure transform"
361- @click= " store.previewKnownStructureTransform (structure.id)"
408+ : disabled= " !canTransformStructure (structure)"
409+ title= " Preview this built-in transform and open it in the template panel "
410+ aria- label= " Open structure transform"
411+ @click= " openStructureTransform (structure.id)"
362412 >
363413 < icon- preview / >
364- < span> Preview< / span>
365- < / button>
366- < button
367- class = " structure-action structure-action-emphasis"
368- type= " button"
369- : disabled= " !canAddStructureToPipeline(structure)"
370- title= " Seed the template panel with this structure so you can add its transform to the pipeline"
371- aria- label= " Add transform to pipeline"
372- @click= " store.setActiveTemplate('apply-known-transform'); store.setInspectedKnownStructure(structure.id); activateStructure(structure.id); store.setActiveWorkspaceTab('inspector')"
373- >
374- < icon- plus / >
375- < span> Add< / span>
414+ < span> Transform< / span>
376415 < / button>
377416 < / div>
378417 < / div>
@@ -400,9 +439,6 @@ onBeforeUnmount(() => {
400439 < div class = " example-modal-header" >
401440 < div class = " example-modal-copy" >
402441 < h3> {{ exampleStructure .title }} Example< / h3>
403- < p class = " example-modal-note" >
404- Select any part of the snippet to copy just that text, or use the copy button for the full example.
405- < / p>
406442 < / div>
407443 < div class = " example-modal-actions" >
408444 < button
@@ -446,6 +482,7 @@ onBeforeUnmount(() => {
446482.structure - card- top,
447483.title - row,
448484.card - stats,
485+ .card - match- nav,
449486.card - actions,
450487.explorer - actions {
451488 display: flex;
@@ -458,6 +495,10 @@ onBeforeUnmount(() => {
458495 justify- content: space- between;
459496}
460497
498+ .card - match- nav {
499+ justify- content: flex- end;
500+ }
501+
461502h2 {
462503 font- size: 0 .96rem ;
463504}
0 commit comments