@pulse-js/tools 0.1.7 → 0.1.8

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/README.md CHANGED
@@ -59,7 +59,7 @@ document.body.appendChild(inspector);
59
59
 
60
60
  ## Tips
61
61
 
62
- - **Naming Matters**: Ensure you provide string names to your Sources and Guards (e.g., `source(val, { name: 'my-source' })`). The DevTools rely on these names to provide meaningful debugging information. Unnamed units will appear but are harder to trace.
62
+ - **Naming Matters**: Ensure you provide string names to your Sources and Guards (e.g., `source(val, { name: 'my-source' })`). The DevTools rely on these names to provide meaningful debugging information. Unnamed units will not appear.
63
63
  - **Status Indicators**:
64
64
  - 🟢 **Green**: OK / Active
65
65
  - 🔴 **Red**: Fails
package/dist/index.cjs CHANGED
@@ -45,7 +45,8 @@ var ICONS = {
45
45
  list: `<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="8" y1="6" x2="21" y2="6"/><line x1="8" y1="12" x2="21" y2="12"/><line x1="8" y1="18" x2="21" y2="18"/><line x1="3" y1="6" x2="3.01" y2="6"/><line x1="3" y1="12" x2="3.01" y2="12"/><line x1="3" y1="18" x2="3.01" y2="18"/></svg>`,
46
46
  chevronRight: `<svg width="10" height="10" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M9 18l6-6-6-6"/></svg>`,
47
47
  chevronDown: `<svg width="10" height="10" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M6 9l6 6 6-6"/></svg>`,
48
- edit: `<svg width="10" height="10" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"/><path d="M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"/></svg>`
48
+ edit: `<svg width="10" height="10" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"/><path d="M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"/></svg>`,
49
+ refresh: `<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M21.5 2v6h-6M2.5 22v-6h6M2 11.5a10 10 0 0 1 18.8-4.3M22 12.5a10 10 0 0 1-18.8 4.2"/></svg>`
49
50
  };
50
51
  var STORAGE_KEY = "pulse-devtools-state";
51
52
  var PulseInspector = class extends HTMLElement {
@@ -64,10 +65,16 @@ var PulseInspector = class extends HTMLElement {
64
65
  editValue = "";
65
66
  unsubscribeRegistry;
66
67
  unitSubscriptions = /* @__PURE__ */ new Map();
68
+ shortcut = "Ctrl+M";
69
+ // Default shortcut
67
70
  constructor() {
68
71
  super();
69
72
  this.shadow = this.attachShadow({ mode: "open" });
70
73
  this.loadState();
74
+ const shortcutAttr = this.getAttribute("shortcut");
75
+ if (shortcutAttr) {
76
+ this.shortcut = shortcutAttr;
77
+ }
71
78
  }
72
79
  connectedCallback() {
73
80
  this.render();
@@ -123,7 +130,14 @@ var PulseInspector = class extends HTMLElement {
123
130
  this.shadow.addEventListener("keydown", this.handleEditKeydown);
124
131
  }
125
132
  handleKeyDown = (e) => {
126
- if (e.ctrlKey && e.key.toLowerCase() === "m") {
133
+ const parts = this.shortcut.split("+").map((p) => p.trim().toLowerCase());
134
+ const needsCtrl = parts.includes("ctrl");
135
+ const needsShift = parts.includes("shift");
136
+ const needsAlt = parts.includes("alt");
137
+ const key = parts.find((p) => !["ctrl", "shift", "alt"].includes(p));
138
+ if (!key) return;
139
+ const matches = e.ctrlKey === needsCtrl && e.shiftKey === needsShift && e.altKey === needsAlt && e.key.toLowerCase() === key;
140
+ if (matches) {
127
141
  e.preventDefault();
128
142
  this.toggle();
129
143
  }
@@ -190,6 +204,10 @@ var PulseInspector = class extends HTMLElement {
190
204
  this.toggle();
191
205
  return;
192
206
  }
207
+ if (target.id === "refresh" || target.closest("#refresh")) {
208
+ this.refreshUnits();
209
+ return;
210
+ }
193
211
  const tabEl = target.closest(".tab-btn");
194
212
  if (tabEl) {
195
213
  const tab = tabEl.getAttribute("data-tab");
@@ -292,7 +310,10 @@ var PulseInspector = class extends HTMLElement {
292
310
  <strong style="font-size:14px;letter-spacing:0.5px">PULSE</strong>
293
311
  <span style="font-size:10px;opacity:0.5;margin-top:2px">v0.2.0</span>
294
312
  </div>
295
- <div id="close" class="icon-btn">\xD7</div>
313
+ <div style="display:flex;gap:8px;align-items:center">
314
+ <div id="refresh" class="icon-btn" title="Refresh" style="font-size:16px">${ICONS.refresh}</div>
315
+ <div id="close" class="icon-btn" title="Close (${this.shortcut})">\xD7</div>
316
+ </div>
296
317
  </div>
297
318
 
298
319
  <div class="tabs">
package/dist/index.d.cts CHANGED
@@ -8,6 +8,7 @@ declare class PulseInspector extends HTMLElement {
8
8
  private editValue;
9
9
  private unsubscribeRegistry?;
10
10
  private unitSubscriptions;
11
+ private shortcut;
11
12
  constructor();
12
13
  connectedCallback(): void;
13
14
  disconnectedCallback(): void;
package/dist/index.d.ts CHANGED
@@ -8,6 +8,7 @@ declare class PulseInspector extends HTMLElement {
8
8
  private editValue;
9
9
  private unsubscribeRegistry?;
10
10
  private unitSubscriptions;
11
+ private shortcut;
11
12
  constructor();
12
13
  connectedCallback(): void;
13
14
  disconnectedCallback(): void;
package/dist/index.js CHANGED
@@ -19,7 +19,8 @@ var ICONS = {
19
19
  list: `<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="8" y1="6" x2="21" y2="6"/><line x1="8" y1="12" x2="21" y2="12"/><line x1="8" y1="18" x2="21" y2="18"/><line x1="3" y1="6" x2="3.01" y2="6"/><line x1="3" y1="12" x2="3.01" y2="12"/><line x1="3" y1="18" x2="3.01" y2="18"/></svg>`,
20
20
  chevronRight: `<svg width="10" height="10" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M9 18l6-6-6-6"/></svg>`,
21
21
  chevronDown: `<svg width="10" height="10" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M6 9l6 6 6-6"/></svg>`,
22
- edit: `<svg width="10" height="10" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"/><path d="M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"/></svg>`
22
+ edit: `<svg width="10" height="10" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"/><path d="M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"/></svg>`,
23
+ refresh: `<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M21.5 2v6h-6M2.5 22v-6h6M2 11.5a10 10 0 0 1 18.8-4.3M22 12.5a10 10 0 0 1-18.8 4.2"/></svg>`
23
24
  };
24
25
  var STORAGE_KEY = "pulse-devtools-state";
25
26
  var PulseInspector = class extends HTMLElement {
@@ -38,10 +39,16 @@ var PulseInspector = class extends HTMLElement {
38
39
  editValue = "";
39
40
  unsubscribeRegistry;
40
41
  unitSubscriptions = /* @__PURE__ */ new Map();
42
+ shortcut = "Ctrl+M";
43
+ // Default shortcut
41
44
  constructor() {
42
45
  super();
43
46
  this.shadow = this.attachShadow({ mode: "open" });
44
47
  this.loadState();
48
+ const shortcutAttr = this.getAttribute("shortcut");
49
+ if (shortcutAttr) {
50
+ this.shortcut = shortcutAttr;
51
+ }
45
52
  }
46
53
  connectedCallback() {
47
54
  this.render();
@@ -97,7 +104,14 @@ var PulseInspector = class extends HTMLElement {
97
104
  this.shadow.addEventListener("keydown", this.handleEditKeydown);
98
105
  }
99
106
  handleKeyDown = (e) => {
100
- if (e.ctrlKey && e.key.toLowerCase() === "m") {
107
+ const parts = this.shortcut.split("+").map((p) => p.trim().toLowerCase());
108
+ const needsCtrl = parts.includes("ctrl");
109
+ const needsShift = parts.includes("shift");
110
+ const needsAlt = parts.includes("alt");
111
+ const key = parts.find((p) => !["ctrl", "shift", "alt"].includes(p));
112
+ if (!key) return;
113
+ const matches = e.ctrlKey === needsCtrl && e.shiftKey === needsShift && e.altKey === needsAlt && e.key.toLowerCase() === key;
114
+ if (matches) {
101
115
  e.preventDefault();
102
116
  this.toggle();
103
117
  }
@@ -164,6 +178,10 @@ var PulseInspector = class extends HTMLElement {
164
178
  this.toggle();
165
179
  return;
166
180
  }
181
+ if (target.id === "refresh" || target.closest("#refresh")) {
182
+ this.refreshUnits();
183
+ return;
184
+ }
167
185
  const tabEl = target.closest(".tab-btn");
168
186
  if (tabEl) {
169
187
  const tab = tabEl.getAttribute("data-tab");
@@ -266,7 +284,10 @@ var PulseInspector = class extends HTMLElement {
266
284
  <strong style="font-size:14px;letter-spacing:0.5px">PULSE</strong>
267
285
  <span style="font-size:10px;opacity:0.5;margin-top:2px">v0.2.0</span>
268
286
  </div>
269
- <div id="close" class="icon-btn">\xD7</div>
287
+ <div style="display:flex;gap:8px;align-items:center">
288
+ <div id="refresh" class="icon-btn" title="Refresh" style="font-size:16px">${ICONS.refresh}</div>
289
+ <div id="close" class="icon-btn" title="Close (${this.shortcut})">\xD7</div>
290
+ </div>
270
291
  </div>
271
292
 
272
293
  <div class="tabs">
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pulse-js/tools",
3
- "version": "0.1.7",
3
+ "version": "0.1.8",
4
4
  "type": "module",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.js",
@@ -13,6 +13,6 @@
13
13
  "lint": "bun x tsc --noEmit"
14
14
  },
15
15
  "dependencies": {
16
- "@pulse-js/core": "^0.1.9"
16
+ "@pulse-js/core": "^0.2.0"
17
17
  }
18
18
  }