@tanstack/hotkeys-devtools 0.4.4 → 0.7.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.
@@ -1,12 +1,13 @@
1
+ import { effectiveSequenceMatchedSteps } from "../sequence-progress.js";
1
2
  import { useHotkeysDevtoolsState } from "../HotkeysContextProvider.js";
2
3
  import { useStyles } from "../styles/use-styles.js";
3
4
  import { className, createComponent, delegateEvents, effect, insert, memo, template } from "solid-js/web";
4
5
  import { For, Show, createEffect, createMemo, createSignal, on } from "solid-js";
5
- import { formatForDisplay, formatHotkeySequence } from "@tanstack/hotkeys";
6
+ import { formatForDisplay } from "@tanstack/hotkeys";
6
7
  import clsx from "clsx";
7
8
 
8
9
  //#region src/components/HotkeyList.tsx
9
- var _tmpl$ = /* @__PURE__ */ template(`<div>Hotkeys (<!>)`), _tmpl$2 = /* @__PURE__ */ template(`<div>`), _tmpl$3 = /* @__PURE__ */ template(`<div>Sequences (<!>)`), _tmpl$4 = /* @__PURE__ */ template(`<span>x`), _tmpl$5 = /* @__PURE__ */ template(`<div><span></span><div><span><span data-tooltip></span></span><span><span data-tooltip>Fires on <!> event</span></span><span><span data-tooltip>`), _tmpl$6 = /* @__PURE__ */ template(`<span><span data-tooltip>`), _tmpl$7 = /* @__PURE__ */ template(`<span>i<span data-tooltip>`);
10
+ var _tmpl$ = /* @__PURE__ */ template(`<span>x`), _tmpl$2 = /* @__PURE__ */ template(`<div><span></span><div><span><span data-tooltip></span></span><span><span data-tooltip>Fires on <!> event</span></span><span><span data-tooltip>`), _tmpl$3 = /* @__PURE__ */ template(`<span><span>`), _tmpl$4 = /* @__PURE__ */ template(`<span><span data-tooltip>`), _tmpl$5 = /* @__PURE__ */ template(`<span>i<span data-tooltip>`), _tmpl$6 = /* @__PURE__ */ template(`<div>Hotkeys (<!>)`), _tmpl$7 = /* @__PURE__ */ template(`<div>`), _tmpl$8 = /* @__PURE__ */ template(`<div>Sequences (<!>)`);
10
11
  function sequenceKey(sequence) {
11
12
  return sequence.join("|");
12
13
  }
@@ -44,6 +45,151 @@ function findSequenceTargetConflicts(registration, all) {
44
45
  function findSequenceScopeConflicts(registration, all) {
45
46
  return all.filter((other) => other.id !== registration.id && sequenceKey(other.sequence) === sequenceKey(registration.sequence) && other.options.eventType === registration.options.eventType && other.target !== registration.target);
46
47
  }
48
+ function SequenceListRow(props) {
49
+ const styles = useStyles();
50
+ const sequenceRegistrations = () => props.getSequences();
51
+ const targetConflicts = () => findSequenceTargetConflicts(props.reg, sequenceRegistrations());
52
+ const scopeConflicts = () => findSequenceScopeConflicts(props.reg, sequenceRegistrations());
53
+ const hasTargetConflict = () => targetConflicts().length > 0;
54
+ const hasScopeConflict = () => scopeConflicts().length > 0;
55
+ const conflictBehavior = () => props.reg.options.conflictBehavior ?? "warn";
56
+ const targetConflictBadge = () => {
57
+ const behavior = conflictBehavior();
58
+ const c = targetConflicts();
59
+ if (behavior === "allow") return {
60
+ style: "badgeAllow",
61
+ label: "~",
62
+ tooltip: `Allowed: ${c.length} other binding${c.length > 1 ? "s" : ""} on same sequence and target (conflictBehavior: allow)`
63
+ };
64
+ if (behavior === "error") return {
65
+ style: "badgeError",
66
+ label: "!",
67
+ tooltip: `Error: ${c.length} conflicting binding${c.length > 1 ? "s" : ""} on same sequence and target (conflictBehavior: error)`
68
+ };
69
+ return {
70
+ style: "badgeConflict",
71
+ label: "!",
72
+ tooltip: `Warning: ${c.length} other binding${c.length > 1 ? "s" : ""} on same sequence and target`
73
+ };
74
+ };
75
+ const scopeConflictTooltip = () => {
76
+ const c = scopeConflicts();
77
+ return `Info: ${c.length} binding${c.length > 1 ? "s" : ""} with same sequence on different target${c.length > 1 ? "s" : ""}`;
78
+ };
79
+ const enabled = () => props.reg.options.enabled !== false;
80
+ const liveSequenceReg = createMemo(() => sequenceRegistrations().find((r) => r.id === props.reg.id) ?? props.reg);
81
+ const triggerCount = () => sequenceRegistrations().find((r) => r.id === props.reg.id)?.triggerCount ?? props.reg.triggerCount;
82
+ const matchedSteps = createMemo(() => effectiveSequenceMatchedSteps(liveSequenceReg(), props.sequenceProgressNow()));
83
+ const [prevCount, setPrevCount] = createSignal(props.reg.triggerCount);
84
+ const [pulsing, setPulsing] = createSignal(false);
85
+ createEffect(on(triggerCount, (current) => {
86
+ if (current > prevCount()) {
87
+ setPulsing(true);
88
+ setTimeout(() => setPulsing(false), 600);
89
+ }
90
+ setPrevCount(current);
91
+ }));
92
+ return (() => {
93
+ var _el$ = _tmpl$2(), _el$2 = _el$.firstChild, _el$5 = _el$2.nextSibling, _el$6 = _el$5.firstChild, _el$7 = _el$6.firstChild, _el$8 = _el$6.nextSibling, _el$9 = _el$8.firstChild, _el$10 = _el$9.firstChild.nextSibling;
94
+ _el$10.nextSibling;
95
+ var _el$11 = _el$8.nextSibling, _el$12 = _el$11.firstChild;
96
+ _el$.$$click = () => props.setSelectedId(props.reg.id);
97
+ insert(_el$2, createComponent(For, {
98
+ get each() {
99
+ return liveSequenceReg().sequence;
100
+ },
101
+ children: (step, i) => (() => {
102
+ var _el$13 = _tmpl$3(), _el$14 = _el$13.firstChild;
103
+ insert(_el$13, createComponent(Show, {
104
+ get when() {
105
+ return i() > 0;
106
+ },
107
+ children: " "
108
+ }), _el$14);
109
+ insert(_el$14, () => formatForDisplay(step));
110
+ effect(() => className(_el$14, i() < matchedSteps() ? styles().sequenceStepMatched : void 0));
111
+ return _el$13;
112
+ })()
113
+ }));
114
+ insert(_el$, createComponent(Show, {
115
+ get when() {
116
+ return triggerCount() > 0;
117
+ },
118
+ get children() {
119
+ var _el$3 = _tmpl$();
120
+ _el$3.firstChild;
121
+ insert(_el$3, triggerCount, null);
122
+ effect(() => className(_el$3, styles().triggerCount));
123
+ return _el$3;
124
+ }
125
+ }), _el$5);
126
+ insert(_el$5, (() => {
127
+ var _c$ = memo(() => !!hasTargetConflict());
128
+ return () => _c$() && (() => {
129
+ var _el$15 = _tmpl$4(), _el$16 = _el$15.firstChild;
130
+ insert(_el$15, () => targetConflictBadge().label, _el$16);
131
+ insert(_el$16, () => targetConflictBadge().tooltip);
132
+ effect((_p$) => {
133
+ var _v$0 = clsx(styles().badge, styles()[targetConflictBadge().style], styles().tooltip), _v$1 = styles().tooltipText;
134
+ _v$0 !== _p$.e && className(_el$15, _p$.e = _v$0);
135
+ _v$1 !== _p$.t && className(_el$16, _p$.t = _v$1);
136
+ return _p$;
137
+ }, {
138
+ e: void 0,
139
+ t: void 0
140
+ });
141
+ return _el$15;
142
+ })();
143
+ })(), _el$6);
144
+ insert(_el$5, (() => {
145
+ var _c$2 = memo(() => !!hasScopeConflict());
146
+ return () => _c$2() && (() => {
147
+ var _el$17 = _tmpl$5(), _el$19 = _el$17.firstChild.nextSibling;
148
+ insert(_el$19, scopeConflictTooltip);
149
+ effect((_p$) => {
150
+ var _v$10 = clsx(styles().badge, styles().badgeInfo, styles().tooltip), _v$11 = styles().tooltipText;
151
+ _v$10 !== _p$.e && className(_el$17, _p$.e = _v$10);
152
+ _v$11 !== _p$.t && className(_el$19, _p$.t = _v$11);
153
+ return _p$;
154
+ }, {
155
+ e: void 0,
156
+ t: void 0
157
+ });
158
+ return _el$17;
159
+ })();
160
+ })(), _el$6);
161
+ insert(_el$6, () => enabled() ? "on" : "off", _el$7);
162
+ insert(_el$7, () => enabled() ? "Sequence is enabled" : "Sequence is disabled");
163
+ insert(_el$8, () => props.reg.options.eventType ?? "keydown", _el$9);
164
+ insert(_el$9, () => props.reg.options.eventType ?? "keydown", _el$10);
165
+ insert(_el$11, () => getTargetLabel(props.reg.target), _el$12);
166
+ insert(_el$12, () => getTargetTooltip(props.reg.target));
167
+ effect((_p$) => {
168
+ var _v$ = clsx(styles().hotkeyRow, props.selectedId() === props.reg.id && styles().hotkeyRowSelected, pulsing() && styles().hotkeyRowTriggered), _v$2 = styles().hotkeyLabel, _v$3 = styles().hotkeyBadges, _v$4 = clsx(styles().badge, enabled() ? styles().badgeEnabled : styles().badgeDisabled, styles().tooltip), _v$5 = styles().tooltipText, _v$6 = clsx(styles().badge, (props.reg.options.eventType ?? "keydown") === "keydown" ? styles().badgeKeydown : styles().badgeKeyup, styles().tooltip), _v$7 = styles().tooltipText, _v$8 = clsx(styles().badge, styles().badgeTarget, styles().tooltip), _v$9 = styles().tooltipText;
169
+ _v$ !== _p$.e && className(_el$, _p$.e = _v$);
170
+ _v$2 !== _p$.t && className(_el$2, _p$.t = _v$2);
171
+ _v$3 !== _p$.a && className(_el$5, _p$.a = _v$3);
172
+ _v$4 !== _p$.o && className(_el$6, _p$.o = _v$4);
173
+ _v$5 !== _p$.i && className(_el$7, _p$.i = _v$5);
174
+ _v$6 !== _p$.n && className(_el$8, _p$.n = _v$6);
175
+ _v$7 !== _p$.s && className(_el$9, _p$.s = _v$7);
176
+ _v$8 !== _p$.h && className(_el$11, _p$.h = _v$8);
177
+ _v$9 !== _p$.r && className(_el$12, _p$.r = _v$9);
178
+ return _p$;
179
+ }, {
180
+ e: void 0,
181
+ t: void 0,
182
+ a: void 0,
183
+ o: void 0,
184
+ i: void 0,
185
+ n: void 0,
186
+ s: void 0,
187
+ h: void 0,
188
+ r: void 0
189
+ });
190
+ return _el$;
191
+ })();
192
+ }
47
193
  function HotkeyList(props) {
48
194
  const styles = useStyles();
49
195
  const state = useHotkeysDevtoolsState();
@@ -51,15 +197,15 @@ function HotkeyList(props) {
51
197
  const sequenceRegistrations = createMemo(() => state.sequenceRegistrations());
52
198
  return [
53
199
  (() => {
54
- var _el$ = _tmpl$(), _el$4 = _el$.firstChild.nextSibling;
55
- _el$4.nextSibling;
56
- insert(_el$, () => registrations().length, _el$4);
57
- effect(() => className(_el$, styles().panelHeader));
58
- return _el$;
200
+ var _el$20 = _tmpl$6(), _el$23 = _el$20.firstChild.nextSibling;
201
+ _el$23.nextSibling;
202
+ insert(_el$20, () => registrations().length, _el$23);
203
+ effect(() => className(_el$20, styles().panelHeader));
204
+ return _el$20;
59
205
  })(),
60
206
  (() => {
61
- var _el$5 = _tmpl$2();
62
- insert(_el$5, createComponent(For, {
207
+ var _el$24 = _tmpl$7();
208
+ insert(_el$24, createComponent(For, {
63
209
  get each() {
64
210
  return registrations();
65
211
  },
@@ -104,75 +250,75 @@ function HotkeyList(props) {
104
250
  setPrevCount(current);
105
251
  }));
106
252
  return (() => {
107
- var _el$1 = _tmpl$5(), _el$10 = _el$1.firstChild, _el$13 = _el$10.nextSibling, _el$14 = _el$13.firstChild, _el$15 = _el$14.firstChild, _el$16 = _el$14.nextSibling, _el$17 = _el$16.firstChild, _el$20 = _el$17.firstChild.nextSibling;
108
- _el$20.nextSibling;
109
- var _el$21 = _el$16.nextSibling, _el$22 = _el$21.firstChild;
110
- _el$1.$$click = () => props.setSelectedId(reg.id);
111
- insert(_el$10, () => formatForDisplay(reg.hotkey));
112
- insert(_el$1, createComponent(Show, {
253
+ var _el$30 = _tmpl$2(), _el$31 = _el$30.firstChild, _el$34 = _el$31.nextSibling, _el$35 = _el$34.firstChild, _el$36 = _el$35.firstChild, _el$37 = _el$35.nextSibling, _el$38 = _el$37.firstChild, _el$41 = _el$38.firstChild.nextSibling;
254
+ _el$41.nextSibling;
255
+ var _el$42 = _el$37.nextSibling, _el$43 = _el$42.firstChild;
256
+ _el$30.$$click = () => props.setSelectedId(reg.id);
257
+ insert(_el$31, () => formatForDisplay(reg.hotkey));
258
+ insert(_el$30, createComponent(Show, {
113
259
  get when() {
114
260
  return triggerCount() > 0;
115
261
  },
116
262
  get children() {
117
- var _el$11 = _tmpl$4();
118
- _el$11.firstChild;
119
- insert(_el$11, triggerCount, null);
120
- effect(() => className(_el$11, styles().triggerCount));
121
- return _el$11;
263
+ var _el$32 = _tmpl$();
264
+ _el$32.firstChild;
265
+ insert(_el$32, triggerCount, null);
266
+ effect(() => className(_el$32, styles().triggerCount));
267
+ return _el$32;
122
268
  }
123
- }), _el$13);
124
- insert(_el$13, (() => {
125
- var _c$ = memo(() => !!hasTargetConflict());
126
- return () => _c$() && (() => {
127
- var _el$23 = _tmpl$6(), _el$24 = _el$23.firstChild;
128
- insert(_el$23, () => targetConflictBadge().label, _el$24);
129
- insert(_el$24, () => targetConflictBadge().tooltip);
269
+ }), _el$34);
270
+ insert(_el$34, (() => {
271
+ var _c$3 = memo(() => !!hasTargetConflict());
272
+ return () => _c$3() && (() => {
273
+ var _el$44 = _tmpl$4(), _el$45 = _el$44.firstChild;
274
+ insert(_el$44, () => targetConflictBadge().label, _el$45);
275
+ insert(_el$45, () => targetConflictBadge().tooltip);
130
276
  effect((_p$) => {
131
- var _v$0 = clsx(styles().badge, styles()[targetConflictBadge().style], styles().tooltip), _v$1 = styles().tooltipText;
132
- _v$0 !== _p$.e && className(_el$23, _p$.e = _v$0);
133
- _v$1 !== _p$.t && className(_el$24, _p$.t = _v$1);
277
+ var _v$21 = clsx(styles().badge, styles()[targetConflictBadge().style], styles().tooltip), _v$22 = styles().tooltipText;
278
+ _v$21 !== _p$.e && className(_el$44, _p$.e = _v$21);
279
+ _v$22 !== _p$.t && className(_el$45, _p$.t = _v$22);
134
280
  return _p$;
135
281
  }, {
136
282
  e: void 0,
137
283
  t: void 0
138
284
  });
139
- return _el$23;
285
+ return _el$44;
140
286
  })();
141
- })(), _el$14);
142
- insert(_el$13, (() => {
143
- var _c$2 = memo(() => !!hasScopeConflict());
144
- return () => _c$2() && (() => {
145
- var _el$25 = _tmpl$7(), _el$27 = _el$25.firstChild.nextSibling;
146
- insert(_el$27, scopeConflictTooltip);
287
+ })(), _el$35);
288
+ insert(_el$34, (() => {
289
+ var _c$4 = memo(() => !!hasScopeConflict());
290
+ return () => _c$4() && (() => {
291
+ var _el$46 = _tmpl$5(), _el$48 = _el$46.firstChild.nextSibling;
292
+ insert(_el$48, scopeConflictTooltip);
147
293
  effect((_p$) => {
148
- var _v$10 = clsx(styles().badge, styles().badgeInfo, styles().tooltip), _v$11 = styles().tooltipText;
149
- _v$10 !== _p$.e && className(_el$25, _p$.e = _v$10);
150
- _v$11 !== _p$.t && className(_el$27, _p$.t = _v$11);
294
+ var _v$23 = clsx(styles().badge, styles().badgeInfo, styles().tooltip), _v$24 = styles().tooltipText;
295
+ _v$23 !== _p$.e && className(_el$46, _p$.e = _v$23);
296
+ _v$24 !== _p$.t && className(_el$48, _p$.t = _v$24);
151
297
  return _p$;
152
298
  }, {
153
299
  e: void 0,
154
300
  t: void 0
155
301
  });
156
- return _el$25;
302
+ return _el$46;
157
303
  })();
158
- })(), _el$14);
159
- insert(_el$14, () => enabled() ? "on" : "off", _el$15);
160
- insert(_el$15, () => enabled() ? "Hotkey is enabled" : "Hotkey is disabled");
161
- insert(_el$16, () => reg.options.eventType ?? "keydown", _el$17);
162
- insert(_el$17, () => reg.options.eventType ?? "keydown", _el$20);
163
- insert(_el$21, () => getTargetLabel(reg.target), _el$22);
164
- insert(_el$22, () => getTargetTooltip(reg.target));
304
+ })(), _el$35);
305
+ insert(_el$35, () => enabled() ? "on" : "off", _el$36);
306
+ insert(_el$36, () => enabled() ? "Hotkey is enabled" : "Hotkey is disabled");
307
+ insert(_el$37, () => reg.options.eventType ?? "keydown", _el$38);
308
+ insert(_el$38, () => reg.options.eventType ?? "keydown", _el$41);
309
+ insert(_el$42, () => getTargetLabel(reg.target), _el$43);
310
+ insert(_el$43, () => getTargetTooltip(reg.target));
165
311
  effect((_p$) => {
166
- var _v$ = clsx(styles().hotkeyRow, props.selectedId() === reg.id && styles().hotkeyRowSelected, pulsing() && styles().hotkeyRowTriggered), _v$2 = styles().hotkeyLabel, _v$3 = styles().hotkeyBadges, _v$4 = clsx(styles().badge, enabled() ? styles().badgeEnabled : styles().badgeDisabled, styles().tooltip), _v$5 = styles().tooltipText, _v$6 = clsx(styles().badge, (reg.options.eventType ?? "keydown") === "keydown" ? styles().badgeKeydown : styles().badgeKeyup, styles().tooltip), _v$7 = styles().tooltipText, _v$8 = clsx(styles().badge, styles().badgeTarget, styles().tooltip), _v$9 = styles().tooltipText;
167
- _v$ !== _p$.e && className(_el$1, _p$.e = _v$);
168
- _v$2 !== _p$.t && className(_el$10, _p$.t = _v$2);
169
- _v$3 !== _p$.a && className(_el$13, _p$.a = _v$3);
170
- _v$4 !== _p$.o && className(_el$14, _p$.o = _v$4);
171
- _v$5 !== _p$.i && className(_el$15, _p$.i = _v$5);
172
- _v$6 !== _p$.n && className(_el$16, _p$.n = _v$6);
173
- _v$7 !== _p$.s && className(_el$17, _p$.s = _v$7);
174
- _v$8 !== _p$.h && className(_el$21, _p$.h = _v$8);
175
- _v$9 !== _p$.r && className(_el$22, _p$.r = _v$9);
312
+ var _v$12 = clsx(styles().hotkeyRow, props.selectedId() === reg.id && styles().hotkeyRowSelected, pulsing() && styles().hotkeyRowTriggered), _v$13 = styles().hotkeyLabel, _v$14 = styles().hotkeyBadges, _v$15 = clsx(styles().badge, enabled() ? styles().badgeEnabled : styles().badgeDisabled, styles().tooltip), _v$16 = styles().tooltipText, _v$17 = clsx(styles().badge, (reg.options.eventType ?? "keydown") === "keydown" ? styles().badgeKeydown : styles().badgeKeyup, styles().tooltip), _v$18 = styles().tooltipText, _v$19 = clsx(styles().badge, styles().badgeTarget, styles().tooltip), _v$20 = styles().tooltipText;
313
+ _v$12 !== _p$.e && className(_el$30, _p$.e = _v$12);
314
+ _v$13 !== _p$.t && className(_el$31, _p$.t = _v$13);
315
+ _v$14 !== _p$.a && className(_el$34, _p$.a = _v$14);
316
+ _v$15 !== _p$.o && className(_el$35, _p$.o = _v$15);
317
+ _v$16 !== _p$.i && className(_el$36, _p$.i = _v$16);
318
+ _v$17 !== _p$.n && className(_el$37, _p$.n = _v$17);
319
+ _v$18 !== _p$.s && className(_el$38, _p$.s = _v$18);
320
+ _v$19 !== _p$.h && className(_el$42, _p$.h = _v$19);
321
+ _v$20 !== _p$.r && className(_el$43, _p$.r = _v$20);
176
322
  return _p$;
177
323
  }, {
178
324
  e: void 0,
@@ -185,154 +331,42 @@ function HotkeyList(props) {
185
331
  h: void 0,
186
332
  r: void 0
187
333
  });
188
- return _el$1;
334
+ return _el$30;
189
335
  })();
190
336
  }
191
337
  }));
192
- effect(() => className(_el$5, styles().hotkeyList));
193
- return _el$5;
338
+ effect(() => className(_el$24, styles().hotkeyList));
339
+ return _el$24;
194
340
  })(),
195
341
  (() => {
196
- var _el$6 = _tmpl$3(), _el$9 = _el$6.firstChild.nextSibling;
197
- _el$9.nextSibling;
198
- insert(_el$6, () => sequenceRegistrations().length, _el$9);
199
- effect(() => className(_el$6, styles().panelHeader));
200
- return _el$6;
342
+ var _el$25 = _tmpl$8(), _el$28 = _el$25.firstChild.nextSibling;
343
+ _el$28.nextSibling;
344
+ insert(_el$25, () => sequenceRegistrations().length, _el$28);
345
+ effect(() => className(_el$25, styles().panelHeader));
346
+ return _el$25;
201
347
  })(),
202
348
  (() => {
203
- var _el$0 = _tmpl$2();
204
- insert(_el$0, createComponent(For, {
349
+ var _el$29 = _tmpl$7();
350
+ insert(_el$29, createComponent(For, {
205
351
  get each() {
206
352
  return sequenceRegistrations();
207
353
  },
208
- children: (reg) => {
209
- const targetConflicts = () => findSequenceTargetConflicts(reg, sequenceRegistrations());
210
- const scopeConflicts = () => findSequenceScopeConflicts(reg, sequenceRegistrations());
211
- const hasTargetConflict = () => targetConflicts().length > 0;
212
- const hasScopeConflict = () => scopeConflicts().length > 0;
213
- const conflictBehavior = () => reg.options.conflictBehavior ?? "warn";
214
- const targetConflictBadge = () => {
215
- const behavior = conflictBehavior();
216
- const c = targetConflicts();
217
- if (behavior === "allow") return {
218
- style: "badgeAllow",
219
- label: "~",
220
- tooltip: `Allowed: ${c.length} other binding${c.length > 1 ? "s" : ""} on same sequence and target (conflictBehavior: allow)`
221
- };
222
- if (behavior === "error") return {
223
- style: "badgeError",
224
- label: "!",
225
- tooltip: `Error: ${c.length} conflicting binding${c.length > 1 ? "s" : ""} on same sequence and target (conflictBehavior: error)`
226
- };
227
- return {
228
- style: "badgeConflict",
229
- label: "!",
230
- tooltip: `Warning: ${c.length} other binding${c.length > 1 ? "s" : ""} on same sequence and target`
231
- };
232
- };
233
- const scopeConflictTooltip = () => {
234
- const c = scopeConflicts();
235
- return `Info: ${c.length} binding${c.length > 1 ? "s" : ""} with same sequence on different target${c.length > 1 ? "s" : ""}`;
236
- };
237
- const enabled = () => reg.options.enabled !== false;
238
- const triggerCount = () => sequenceRegistrations().find((r) => r.id === reg.id)?.triggerCount ?? reg.triggerCount;
239
- const [prevCount, setPrevCount] = createSignal(reg.triggerCount);
240
- const [pulsing, setPulsing] = createSignal(false);
241
- createEffect(on(triggerCount, (current) => {
242
- if (current > prevCount()) {
243
- setPulsing(true);
244
- setTimeout(() => setPulsing(false), 600);
245
- }
246
- setPrevCount(current);
247
- }));
248
- return (() => {
249
- var _el$28 = _tmpl$5(), _el$29 = _el$28.firstChild, _el$32 = _el$29.nextSibling, _el$33 = _el$32.firstChild, _el$34 = _el$33.firstChild, _el$35 = _el$33.nextSibling, _el$36 = _el$35.firstChild, _el$39 = _el$36.firstChild.nextSibling;
250
- _el$39.nextSibling;
251
- var _el$40 = _el$35.nextSibling, _el$41 = _el$40.firstChild;
252
- _el$28.$$click = () => props.setSelectedId(reg.id);
253
- insert(_el$29, () => formatHotkeySequence(reg.sequence));
254
- insert(_el$28, createComponent(Show, {
255
- get when() {
256
- return triggerCount() > 0;
257
- },
258
- get children() {
259
- var _el$30 = _tmpl$4();
260
- _el$30.firstChild;
261
- insert(_el$30, triggerCount, null);
262
- effect(() => className(_el$30, styles().triggerCount));
263
- return _el$30;
264
- }
265
- }), _el$32);
266
- insert(_el$32, (() => {
267
- var _c$3 = memo(() => !!hasTargetConflict());
268
- return () => _c$3() && (() => {
269
- var _el$42 = _tmpl$6(), _el$43 = _el$42.firstChild;
270
- insert(_el$42, () => targetConflictBadge().label, _el$43);
271
- insert(_el$43, () => targetConflictBadge().tooltip);
272
- effect((_p$) => {
273
- var _v$21 = clsx(styles().badge, styles()[targetConflictBadge().style], styles().tooltip), _v$22 = styles().tooltipText;
274
- _v$21 !== _p$.e && className(_el$42, _p$.e = _v$21);
275
- _v$22 !== _p$.t && className(_el$43, _p$.t = _v$22);
276
- return _p$;
277
- }, {
278
- e: void 0,
279
- t: void 0
280
- });
281
- return _el$42;
282
- })();
283
- })(), _el$33);
284
- insert(_el$32, (() => {
285
- var _c$4 = memo(() => !!hasScopeConflict());
286
- return () => _c$4() && (() => {
287
- var _el$44 = _tmpl$7(), _el$46 = _el$44.firstChild.nextSibling;
288
- insert(_el$46, scopeConflictTooltip);
289
- effect((_p$) => {
290
- var _v$23 = clsx(styles().badge, styles().badgeInfo, styles().tooltip), _v$24 = styles().tooltipText;
291
- _v$23 !== _p$.e && className(_el$44, _p$.e = _v$23);
292
- _v$24 !== _p$.t && className(_el$46, _p$.t = _v$24);
293
- return _p$;
294
- }, {
295
- e: void 0,
296
- t: void 0
297
- });
298
- return _el$44;
299
- })();
300
- })(), _el$33);
301
- insert(_el$33, () => enabled() ? "on" : "off", _el$34);
302
- insert(_el$34, () => enabled() ? "Sequence is enabled" : "Sequence is disabled");
303
- insert(_el$35, () => reg.options.eventType ?? "keydown", _el$36);
304
- insert(_el$36, () => reg.options.eventType ?? "keydown", _el$39);
305
- insert(_el$40, () => getTargetLabel(reg.target), _el$41);
306
- insert(_el$41, () => getTargetTooltip(reg.target));
307
- effect((_p$) => {
308
- var _v$12 = clsx(styles().hotkeyRow, props.selectedId() === reg.id && styles().hotkeyRowSelected, pulsing() && styles().hotkeyRowTriggered), _v$13 = styles().hotkeyLabel, _v$14 = styles().hotkeyBadges, _v$15 = clsx(styles().badge, enabled() ? styles().badgeEnabled : styles().badgeDisabled, styles().tooltip), _v$16 = styles().tooltipText, _v$17 = clsx(styles().badge, (reg.options.eventType ?? "keydown") === "keydown" ? styles().badgeKeydown : styles().badgeKeyup, styles().tooltip), _v$18 = styles().tooltipText, _v$19 = clsx(styles().badge, styles().badgeTarget, styles().tooltip), _v$20 = styles().tooltipText;
309
- _v$12 !== _p$.e && className(_el$28, _p$.e = _v$12);
310
- _v$13 !== _p$.t && className(_el$29, _p$.t = _v$13);
311
- _v$14 !== _p$.a && className(_el$32, _p$.a = _v$14);
312
- _v$15 !== _p$.o && className(_el$33, _p$.o = _v$15);
313
- _v$16 !== _p$.i && className(_el$34, _p$.i = _v$16);
314
- _v$17 !== _p$.n && className(_el$35, _p$.n = _v$17);
315
- _v$18 !== _p$.s && className(_el$36, _p$.s = _v$18);
316
- _v$19 !== _p$.h && className(_el$40, _p$.h = _v$19);
317
- _v$20 !== _p$.r && className(_el$41, _p$.r = _v$20);
318
- return _p$;
319
- }, {
320
- e: void 0,
321
- t: void 0,
322
- a: void 0,
323
- o: void 0,
324
- i: void 0,
325
- n: void 0,
326
- s: void 0,
327
- h: void 0,
328
- r: void 0
329
- });
330
- return _el$28;
331
- })();
332
- }
354
+ children: (reg) => createComponent(SequenceListRow, {
355
+ reg,
356
+ getSequences: sequenceRegistrations,
357
+ get sequenceProgressNow() {
358
+ return state.sequenceProgressNow;
359
+ },
360
+ get selectedId() {
361
+ return props.selectedId;
362
+ },
363
+ get setSelectedId() {
364
+ return props.setSelectedId;
365
+ }
366
+ })
333
367
  }));
334
- effect(() => className(_el$0, styles().hotkeyList));
335
- return _el$0;
368
+ effect(() => className(_el$29, styles().hotkeyList));
369
+ return _el$29;
336
370
  })()
337
371
  ];
338
372
  }