comfy-ts 2.12.0 → 2.14.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/dist/{LogsSt-U1H0mP1m.js → LogsSt-CUeo843w.js} +18 -4
- package/dist/LogsSt-CUeo843w.js.map +1 -0
- package/dist/cli.js +4 -4
- package/dist/index.cjs +123 -12
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +96 -16
- package/dist/index.d.ts +96 -16
- package/dist/index.js +123 -12
- package/dist/index.js.map +1 -1
- package/dist/{run-serve-BeAznay5.js → run-serve-DUqcn0h3.js} +477 -63
- package/dist/run-serve-DUqcn0h3.js.map +1 -0
- package/dist/{run-tui-BTGjvnKk.js → run-tui-D-LaSqgB.js} +4 -4
- package/dist/{run-tui-BTGjvnKk.js.map → run-tui-D-LaSqgB.js.map} +1 -1
- package/dist/{schemaDrift-Cg39vs53.js → schemaDrift-E95iTF7E.js} +4 -1
- package/dist/{schemaDrift-Cg39vs53.js.map → schemaDrift-E95iTF7E.js.map} +1 -1
- package/dist/serve-web.js +378 -141
- package/dist/{state-C7REnHan.js → state-BytbdZ8s.js} +122 -14
- package/dist/state-BytbdZ8s.js.map +1 -0
- package/dist/web.d.ts +96 -16
- package/dist/web.js +123 -12
- package/dist/web.js.map +1 -1
- package/examples/comfy-cloud/sdk.d.ts +163 -163
- package/examples/rvion/10-anima-t2i.cflow.ts +48 -25
- package/examples/rvion/11-yue2-t2a.cflow.ts +105 -0
- package/examples/rvion/12-stable-audio-3-t2a.cflow.ts +78 -0
- package/examples/rvion/13-ace-step-15-xl-t2a.cflow.ts +153 -0
- package/examples/rvion/stableAudio3Prompts.ts +19 -0
- package/package.json +2 -2
- package/src/cli/serve/ServeApp.ts +224 -77
- package/src/cli/serve/byteRange.ts +48 -0
- package/src/cli/serve/resultHistory.ts +125 -0
- package/src/cli/serve/run-serve.ts +12 -3
- package/src/cli/serve/runError.ts +23 -0
- package/src/cli/serve/serveSettings.ts +17 -1
- package/src/cli/serve/web/api.ts +53 -2
- package/src/cli/serve/web/components/App.tsx +311 -160
- package/src/cli/serve/web/components/DraftTabs.tsx +167 -0
- package/src/cli/serve/web/components/Gallery.tsx +75 -25
- package/src/cli/serve/web/components/Icon.tsx +44 -0
- package/src/cli/serve/web/components/MemoryBudget.tsx +98 -0
- package/src/cli/serve/web/components/Omnibox.tsx +70 -20
- package/src/cli/serve/web/components/RunError.tsx +19 -0
- package/src/cli/serve/web/components/ShortcutsModal.tsx +54 -0
- package/src/cli/serve/web/components/SideMenu.tsx +428 -0
- package/src/cli/serve/web/components/TooltipLayer.tsx +3 -2
- package/src/cli/serve/web/components/VarsForm.tsx +141 -404
- package/src/cli/serve/web/components/controls/BasicControls.tsx +8 -1
- package/src/cli/serve/web/components/controls/LorasControl.tsx +30 -25
- package/src/cli/serve/web/promptEditor/promptExtensions.ts +9 -4
- package/src/cli/serve/web/state/EnhancerSt.ts +17 -2
- package/src/cli/serve/web/state/FormSt.ts +22 -2
- package/src/cli/serve/web/state/OmniboxSt.ts +3 -1
- package/src/cli/serve/web/state/RunSt.ts +61 -3
- package/src/cli/serve/web/state/WebSt.ts +198 -35
- package/src/cli/serve/web/state/draftNames.ts +16 -0
- package/src/cli/serve/web/state/draftTabs.ts +75 -0
- package/src/cli/serve/web/state/formRows.ts +9 -0
- package/src/cli/serve/web/state/generateButton.ts +1 -1
- package/src/cli/serve/web/state/keptResults.ts +26 -0
- package/src/cli/serve/web/state/lightbox.ts +17 -0
- package/src/cli/serve/web/state/omnibox.ts +82 -18
- package/src/cli/serve/web/state/shortcutCatalog.ts +100 -0
- package/src/cli/serve/web/state/shortcuts.ts +66 -7
- package/src/cli/serve/web/styles.ts +327 -93
- package/src/cli/serve/workflowTags.ts +42 -0
- package/src/cli/serve/workspaceLabels.ts +23 -0
- package/src/cli/tui/state/DraftsSt.ts +10 -6
- package/src/coreExports.ts +1 -0
- package/src/host/ComfyHost.ts +17 -2
- package/src/host/ResilientWebsocket.ts +54 -4
- package/src/runner/ComfyExecution.ts +60 -0
- package/src/runner/ComfyWorkflow.ts +4 -0
- package/src/runner/ComfyWsApi.ts +2 -0
- package/src/runner/MediaImage.ts +2 -2
- package/src/sdk-generator/ComfyUIObjectInfoTypes.ts +5 -5
- package/src/sdk-generator/comfyui-sdk-codegen.ts +1 -1
- package/src/utils/copyName.ts +12 -0
- package/src/vars/DefinedWorkflow.ts +7 -1
- package/dist/LogsSt-U1H0mP1m.js.map +0 -1
- package/dist/run-serve-BeAznay5.js.map +0 -1
- package/dist/state-C7REnHan.js.map +0 -1
|
@@ -1,19 +1,33 @@
|
|
|
1
|
-
// the omnibox list and its
|
|
2
|
-
// one
|
|
3
|
-
//
|
|
1
|
+
// the omnibox list and its match. PURE and DOM-free, tests/serve-web-omnibox.test.ts.
|
|
2
|
+
// grouped: one workflow row, then its drafts. A query word that IS a tag keeps only the
|
|
3
|
+
// workflows carrying it, the other words fuzzy match names and tags
|
|
4
4
|
import { groupModulesByFolder, type TreeItem } from 'src/cli/serve/web/state/moduleTree.ts'
|
|
5
5
|
|
|
6
|
-
export type
|
|
6
|
+
export type OmniModule = TreeItem & { host: string; drafts: string[]; tags?: string[] }
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
/** a workflow row opens `draft`, its first draft */
|
|
9
|
+
export type OmniboxEntry = {
|
|
10
|
+
kind: 'workflow' | 'draft'
|
|
11
|
+
module: string
|
|
12
|
+
draft: string
|
|
13
|
+
host: string
|
|
14
|
+
folder: string
|
|
15
|
+
tags: string[]
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export function entryKey(e: OmniboxEntry): string {
|
|
19
|
+
return `${e.kind}:${e.module}/${e.draft}`
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export function omniboxEntries(modules: readonly OmniModule[]): OmniboxEntry[] {
|
|
9
23
|
const out: OmniboxEntry[] = []
|
|
10
24
|
for (const group of groupModulesByFolder(modules)) {
|
|
11
25
|
for (const mod of group.modules) {
|
|
12
26
|
// no saved draft still opens: the server serves the spec values as `default`
|
|
13
27
|
const drafts = mod.drafts.length > 0 ? mod.drafts : ['default']
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
|
|
28
|
+
const base = { module: mod.module, host: mod.host, folder: group.folder, tags: mod.tags ?? [] }
|
|
29
|
+
out.push({ kind: 'workflow', draft: drafts[0] ?? 'default', ...base })
|
|
30
|
+
for (const draft of drafts) out.push({ kind: 'draft', draft, ...base })
|
|
17
31
|
}
|
|
18
32
|
}
|
|
19
33
|
return out
|
|
@@ -54,16 +68,66 @@ export function fuzzyScore(query: string, text: string): number | null {
|
|
|
54
68
|
return best
|
|
55
69
|
}
|
|
56
70
|
|
|
71
|
+
type Group = { head: OmniboxEntry; drafts: OmniboxEntry[]; ix: number }
|
|
72
|
+
|
|
73
|
+
function groupsOf(entries: readonly OmniboxEntry[]): Group[] {
|
|
74
|
+
const groups: Group[] = []
|
|
75
|
+
for (const e of entries) {
|
|
76
|
+
if (e.kind === 'workflow') groups.push({ head: e, drafts: [], ix: groups.length })
|
|
77
|
+
else groups.at(-1)?.drafts.push(e)
|
|
78
|
+
}
|
|
79
|
+
return groups
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
const max = (a: number | null, b: number | null): number | null => (a == null ? b : b == null ? a : Math.max(a, b))
|
|
83
|
+
|
|
84
|
+
/** a letter scattered across the label scores ~1, one at a word start or in a run ~4 to 6.
|
|
85
|
+
* Below this average the hit is noise, and in a grouped list noise costs a whole workflow */
|
|
86
|
+
const MIN_SCORE_PER_LETTER = 2.5
|
|
87
|
+
|
|
57
88
|
export function searchOmnibox(entries: readonly OmniboxEntry[], query: string): OmniboxEntry[] {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
89
|
+
const words = query
|
|
90
|
+
.trim()
|
|
91
|
+
.toLowerCase()
|
|
92
|
+
.split(/\s+/)
|
|
93
|
+
.filter((w) => w !== '')
|
|
94
|
+
if (words.length === 0) return [...entries]
|
|
95
|
+
const known = new Set(entries.flatMap((e) => e.tags))
|
|
96
|
+
const tagWords = words.filter((w) => known.has(w))
|
|
97
|
+
const text = words.filter((w) => !known.has(w)).join('')
|
|
98
|
+
const scored: { group: Group; score: number; rows: OmniboxEntry[] }[] = []
|
|
99
|
+
for (const group of groupsOf(entries)) {
|
|
100
|
+
if (!tagWords.every((t) => group.head.tags.includes(t))) continue
|
|
101
|
+
if (text === '') {
|
|
102
|
+
scored.push({ group, score: 0, rows: [group.head, ...group.drafts] })
|
|
103
|
+
continue
|
|
104
|
+
}
|
|
105
|
+
const headText = `${group.head.folder}/${group.head.module} ${group.head.tags.join(' ')}`
|
|
106
|
+
const good = (score: number | null): number | null =>
|
|
107
|
+
score != null && score >= text.length * MIN_SCORE_PER_LETTER ? score : null
|
|
108
|
+
const headScore = good(fuzzyScore(text, headText))
|
|
109
|
+
// the draft name alone first: typing a draft name should not lose to a folder that shares letters
|
|
110
|
+
const drafts = group.drafts
|
|
111
|
+
.map((d) => {
|
|
112
|
+
const own = good(fuzzyScore(text, d.draft))
|
|
113
|
+
return {
|
|
114
|
+
d,
|
|
115
|
+
own,
|
|
116
|
+
score: max(own == null ? null : own + 2, good(fuzzyScore(text, `${headText}/${d.draft}`))),
|
|
117
|
+
}
|
|
118
|
+
})
|
|
119
|
+
.filter((x): x is { d: OmniboxEntry; own: number | null; score: number } => x.score != null)
|
|
120
|
+
const draftHits = drafts.filter((x) => x.own != null)
|
|
121
|
+
const best = max(
|
|
122
|
+
headScore,
|
|
123
|
+
drafts.reduce<number | null>((m, x) => max(m, x.score), null),
|
|
124
|
+
)
|
|
125
|
+
if (best == null) continue
|
|
126
|
+
// drafts matched by their own name are what was searched; otherwise the whole workflow
|
|
127
|
+
const shown =
|
|
128
|
+
draftHits.length > 0 ? [...draftHits].sort((a, b) => b.score - a.score).map((x) => x.d) : group.drafts
|
|
129
|
+
scored.push({ group, score: best, rows: [group.head, ...shown] })
|
|
66
130
|
}
|
|
67
|
-
scored.sort((a, b) => b.score - a.score || a.ix - b.ix)
|
|
68
|
-
return scored.
|
|
131
|
+
scored.sort((a, b) => b.score - a.score || a.group.ix - b.group.ix)
|
|
132
|
+
return scored.flatMap((s) => s.rows)
|
|
69
133
|
}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { MOD_KEY } from 'src/cli/serve/web/components/modKey.ts'
|
|
2
|
+
import {
|
|
3
|
+
ENHANCER_KEYS,
|
|
4
|
+
SHORTCUT_KEYS,
|
|
5
|
+
type EnhancerShortcut,
|
|
6
|
+
type Shortcut,
|
|
7
|
+
} from 'src/cli/serve/web/state/shortcuts.ts'
|
|
8
|
+
|
|
9
|
+
/** every key the panel binds, as the shortcuts popup lists it. The jump and enhancer rows are
|
|
10
|
+
* DERIVED from their key tables (a Record, so a new shortcut without a line fails typecheck); the
|
|
11
|
+
* prompt editor rows name their codemirror bindings, which tests/serve-web-shortcut-catalog.test.ts
|
|
12
|
+
* checks against promptExtensions.ts */
|
|
13
|
+
export type ShortcutRow = { keys: string[]; what: string; cm?: string[] }
|
|
14
|
+
export type ShortcutGroup = { title: string; rows: ShortcutRow[] }
|
|
15
|
+
|
|
16
|
+
const JUMP_WHAT: Record<Shortcut, string> = {
|
|
17
|
+
'focus-prompt': 'focus the first prompt',
|
|
18
|
+
'open-loras': 'open the lora picker',
|
|
19
|
+
'open-enhancer': 'open the prompt enhancer',
|
|
20
|
+
'rename-draft': 'rename the draft',
|
|
21
|
+
'duplicate-draft': 'duplicate the draft',
|
|
22
|
+
'toggle-menu': 'fold or unfold the menu',
|
|
23
|
+
'toggle-blur': 'blur or unblur the results',
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const ENHANCER_WHAT: Record<EnhancerShortcut, string> = {
|
|
27
|
+
enhance: 'enhance the prompt',
|
|
28
|
+
apply: 'apply the rewrite to the prompt',
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const cap = (mod: string, k: string): string => (/^F\d{1,2}$/.test(k) ? k : `${mod}${k}`)
|
|
32
|
+
|
|
33
|
+
export function shortcutCatalog(mod: string = MOD_KEY): ShortcutGroup[] {
|
|
34
|
+
const jumps = (Object.keys(JUMP_WHAT) as Shortcut[]).map((s) => ({
|
|
35
|
+
keys: [cap(mod, SHORTCUT_KEYS[s])],
|
|
36
|
+
what: JUMP_WHAT[s],
|
|
37
|
+
}))
|
|
38
|
+
const enhancer = (Object.keys(ENHANCER_WHAT) as EnhancerShortcut[]).map((s) => ({
|
|
39
|
+
keys: [cap(mod, ENHANCER_KEYS[s])],
|
|
40
|
+
what: ENHANCER_WHAT[s],
|
|
41
|
+
}))
|
|
42
|
+
return [
|
|
43
|
+
{
|
|
44
|
+
title: 'anywhere',
|
|
45
|
+
rows: [
|
|
46
|
+
{ keys: [`${mod}⏎`], what: 'run the draft' },
|
|
47
|
+
{ keys: [`${mod}K`, `${mod}J`], what: 'search every workflow and draft' },
|
|
48
|
+
{ keys: [`${mod}1 … ${mod}8`], what: 'open tab 1 to 8' },
|
|
49
|
+
{ keys: [`${mod}9`], what: 'open the last tab' },
|
|
50
|
+
{ keys: [`${mod}PageUp`, `${mod}PageDown`], what: 'previous or next tab, wrapping' },
|
|
51
|
+
...jumps,
|
|
52
|
+
{ keys: [`${mod}A`], what: 'select all in the field you are in' },
|
|
53
|
+
{ keys: ['Esc'], what: 'close the popup on top' },
|
|
54
|
+
],
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
title: 'prompt editor',
|
|
58
|
+
rows: [
|
|
59
|
+
{
|
|
60
|
+
keys: [`${mod}↑`, `${mod}↓`],
|
|
61
|
+
what: 'weight of the word or selection up or down',
|
|
62
|
+
cm: ['Mod-ArrowUp', 'Mod-ArrowDown', 'Ctrl-ArrowUp', 'Ctrl-ArrowDown'],
|
|
63
|
+
},
|
|
64
|
+
{ keys: [`${mod}/`], what: 'comment the line in or out', cm: ['Mod-/'] },
|
|
65
|
+
{ keys: [`${mod}⇧-`], what: 'make the line negative, or positive again', cm: ['Mod-Shift--', 'Mod-_'] },
|
|
66
|
+
{ keys: ['⌥↑', '⌥↓'], what: 'move the line up or down', cm: ['Alt-ArrowUp', 'Alt-ArrowDown'] },
|
|
67
|
+
{ keys: [`${mod}Z`, `${mod}⇧Z`], what: 'undo, redo' },
|
|
68
|
+
{ keys: ['↑', '↓', '⏎', 'Esc'], what: 'in the completion list: move, pick, dismiss' },
|
|
69
|
+
],
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
title: 'prompt enhancer',
|
|
73
|
+
rows: [...enhancer, { keys: [`${mod}⏎`], what: 'run with the rewrite, the prompt stays as it is' }],
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
title: 'lightbox',
|
|
77
|
+
rows: [
|
|
78
|
+
{ keys: ['↑', '↓'], what: 'previous or next image of the gallery' },
|
|
79
|
+
{ keys: ['scroll'], what: 'zoom at the pointer, drag to pan' },
|
|
80
|
+
{ keys: ['double click'], what: 'back to fit' },
|
|
81
|
+
{ keys: ['Esc'], what: 'close' },
|
|
82
|
+
],
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
title: 'search and history pickers',
|
|
86
|
+
rows: [
|
|
87
|
+
{ keys: ['↑', '↓'], what: 'move' },
|
|
88
|
+
{ keys: ['⏎'], what: 'open the pick' },
|
|
89
|
+
{ keys: ['Esc'], what: 'close' },
|
|
90
|
+
],
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
title: 'renaming',
|
|
94
|
+
rows: [
|
|
95
|
+
{ keys: ['⏎'], what: 'keep the new name' },
|
|
96
|
+
{ keys: ['Esc'], what: 'cancel' },
|
|
97
|
+
],
|
|
98
|
+
},
|
|
99
|
+
]
|
|
100
|
+
}
|
|
@@ -1,14 +1,56 @@
|
|
|
1
|
-
|
|
2
|
-
* focus, a prompt editor included: it is a jump, not an edit. Browser defaults they take over
|
|
3
|
-
* (print, open file) are useless on this page */
|
|
4
|
-
export type Shortcut = 'focus-prompt' | 'open-loras' | 'open-enhancer' | 'toggle-blur'
|
|
1
|
+
import { MOD_KEY } from 'src/cli/serve/web/components/modKey.ts'
|
|
5
2
|
|
|
3
|
+
/** the panel's jump keys, with ⌘ (ctrl elsewhere) and no other modifier except the ⇧ an entry
|
|
4
|
+
* names, or a bare function key. Each one works from ANY focus, a prompt editor included: it is
|
|
5
|
+
* a jump, not an edit. Browser defaults they take over (print, open file) are useless here */
|
|
6
|
+
export type Shortcut =
|
|
7
|
+
| 'focus-prompt'
|
|
8
|
+
| 'open-loras'
|
|
9
|
+
| 'open-enhancer'
|
|
10
|
+
| 'rename-draft'
|
|
11
|
+
| 'duplicate-draft'
|
|
12
|
+
| 'toggle-menu'
|
|
13
|
+
| 'toggle-blur'
|
|
14
|
+
|
|
15
|
+
/** the letter as shown after ⌘; a leading ⇧ means shift is part of the chord. A function key
|
|
16
|
+
* (F2) is pressed BARE, with no modifier: it is the rename key everywhere, and a free ⌘ letter
|
|
17
|
+
* that is not already a browser key is hard to find */
|
|
6
18
|
export const SHORTCUT_KEYS: Record<Shortcut, string> = {
|
|
7
19
|
'focus-prompt': 'P',
|
|
8
20
|
'open-loras': 'O',
|
|
9
21
|
// the same letter enhances once the enhancer is open (ENHANCER_KEYS): ⌘E, ⌘E
|
|
10
22
|
'open-enhancer': 'E',
|
|
11
|
-
'
|
|
23
|
+
// F2, as in every editor and the TUI; ⌘R stays the browser's reload
|
|
24
|
+
'rename-draft': 'F2',
|
|
25
|
+
// ⌘D: the browser's bookmark key, useless here
|
|
26
|
+
'duplicate-draft': 'D',
|
|
27
|
+
// ⌘B is the sidebar key of every editor
|
|
28
|
+
'toggle-menu': 'B',
|
|
29
|
+
'toggle-blur': 'U',
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const isFunctionKey = (k: string): boolean => /^F\d{1,2}$/.test(k)
|
|
33
|
+
|
|
34
|
+
/** the key cap a hint shows: `⌘D`, or a bare `F2` */
|
|
35
|
+
export function shortcutLabel(s: Shortcut): string {
|
|
36
|
+
const k = SHORTCUT_KEYS[s]
|
|
37
|
+
return isFunctionKey(k) ? k : `${MOD_KEY}${k}`
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/** ⌘K or ⌘J (ctrl elsewhere) opens the search over every workflow and draft */
|
|
41
|
+
export function isOmniboxKey(e: {
|
|
42
|
+
key: string
|
|
43
|
+
metaKey: boolean
|
|
44
|
+
ctrlKey: boolean
|
|
45
|
+
altKey: boolean
|
|
46
|
+
shiftKey: boolean
|
|
47
|
+
}): boolean {
|
|
48
|
+
return (
|
|
49
|
+
(e.metaKey || e.ctrlKey) &&
|
|
50
|
+
!e.altKey &&
|
|
51
|
+
!e.shiftKey &&
|
|
52
|
+
(e.key.toUpperCase() === 'K' || e.key.toUpperCase() === 'J')
|
|
53
|
+
)
|
|
12
54
|
}
|
|
13
55
|
|
|
14
56
|
export function shortcutOf(e: {
|
|
@@ -18,12 +60,29 @@ export function shortcutOf(e: {
|
|
|
18
60
|
altKey: boolean
|
|
19
61
|
shiftKey: boolean
|
|
20
62
|
}): Shortcut | null {
|
|
21
|
-
|
|
63
|
+
const bare = !(e.metaKey || e.ctrlKey || e.altKey || e.shiftKey)
|
|
64
|
+
for (const [s, k] of Object.entries(SHORTCUT_KEYS) as [Shortcut, string][])
|
|
65
|
+
if (isFunctionKey(k) && bare && e.key === k) return s
|
|
66
|
+
if (!(e.metaKey || e.ctrlKey) || e.altKey) return null
|
|
22
67
|
const key = e.key.toUpperCase()
|
|
23
|
-
for (const [s, k] of Object.entries(SHORTCUT_KEYS) as [Shortcut, string][])
|
|
68
|
+
for (const [s, k] of Object.entries(SHORTCUT_KEYS) as [Shortcut, string][]) {
|
|
69
|
+
if (isFunctionKey(k)) continue
|
|
70
|
+
const shifted = k.startsWith('⇧')
|
|
71
|
+
if (shifted === e.shiftKey && k.slice(shifted ? 1 : 0) === key) return s
|
|
72
|
+
}
|
|
24
73
|
return null
|
|
25
74
|
}
|
|
26
75
|
|
|
76
|
+
/** does this ⌘P / ⌘O press act on a var whose last seen press is `seenSeq`. The stored jump
|
|
77
|
+
* outlives the press: a var that mounts later (a tab switch rebuilds the form) must not replay it */
|
|
78
|
+
export function isNewJump(
|
|
79
|
+
jump: { kind: 'prompt' | 'loras'; seq: number } | null,
|
|
80
|
+
kind: 'prompt' | 'loras',
|
|
81
|
+
seenSeq: number,
|
|
82
|
+
): boolean {
|
|
83
|
+
return jump != null && jump.kind === kind && jump.seq > seenSeq
|
|
84
|
+
}
|
|
85
|
+
|
|
27
86
|
/** which var each jump lands on: the FIRST var of that kind in the order shown, skipping one
|
|
28
87
|
* that is disabled (it takes no focus) */
|
|
29
88
|
export function jumpTargets(vars: readonly { name: string; kind: string; inactive: boolean }[]): {
|