@pulse-js/tools 0.1.6 → 0.1.7

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/index.cjs CHANGED
@@ -202,10 +202,10 @@ var PulseInspector = class extends HTMLElement {
202
202
  }
203
203
  const valueEl = target.closest(".editable-value");
204
204
  if (valueEl) {
205
+ const id = valueEl.getAttribute("data-id");
205
206
  const name = valueEl.getAttribute("data-name");
206
- const unit = this.units.find((u) => u._name === name);
207
- const hasName = unit._name && unit._name !== "unnamed";
208
- if (unit && !("state" in unit) && hasName) {
207
+ const unit = this.units.find((u) => u._id === id || u._name === name);
208
+ if (unit && !("state" in unit)) {
209
209
  this.editingUnit = unit;
210
210
  this.editValue = JSON.stringify(unit());
211
211
  this.render();
@@ -325,6 +325,7 @@ var PulseInspector = class extends HTMLElement {
325
325
  renderUnitCard(unit) {
326
326
  const isGuard = "state" in unit;
327
327
  const name = unit._name || "unnamed";
328
+ const id = unit._id;
328
329
  const explanation = isGuard ? unit.explain() : null;
329
330
  const value = isGuard ? explanation.value : unit();
330
331
  let status = "ok";
@@ -346,13 +347,13 @@ var PulseInspector = class extends HTMLElement {
346
347
  <input class="edit-input" value='${this.safeStringify(value)}' />
347
348
  </form>
348
349
  ` : `
349
- <div class="value-row ${!isGuard && name !== "unnamed" ? "editable-value" : ""}"
350
+ <div class="value-row ${!isGuard ? "editable-value" : ""}"
351
+ data-id="${id}"
350
352
  data-name="${name}"
351
- title="${!isGuard ? name === "unnamed" ? "Unnamed sources cannot be edited (not trackable)" : "Click to edit" : ""}">
353
+ title="${!isGuard ? "Click to edit" : ""}">
352
354
  <span style="opacity:0.5;margin-right:6px">Value:</span>
353
355
  <span class="value-text">${this.formatValue(value)}</span>
354
- ${!isGuard && name !== "unnamed" ? `<span class="edit-icon">${ICONS.edit}</span>` : ""}
355
- ${!isGuard && name === "unnamed" ? `<span style="opacity:0.3;font-size:10px;margin-left:auto">\u{1F512} Locked</span>` : ""}
356
+ ${!isGuard ? `<span class="edit-icon">${ICONS.edit}</span>` : ""}
356
357
  </div>
357
358
  `}
358
359
 
package/dist/index.js CHANGED
@@ -176,10 +176,10 @@ var PulseInspector = class extends HTMLElement {
176
176
  }
177
177
  const valueEl = target.closest(".editable-value");
178
178
  if (valueEl) {
179
+ const id = valueEl.getAttribute("data-id");
179
180
  const name = valueEl.getAttribute("data-name");
180
- const unit = this.units.find((u) => u._name === name);
181
- const hasName = unit._name && unit._name !== "unnamed";
182
- if (unit && !("state" in unit) && hasName) {
181
+ const unit = this.units.find((u) => u._id === id || u._name === name);
182
+ if (unit && !("state" in unit)) {
183
183
  this.editingUnit = unit;
184
184
  this.editValue = JSON.stringify(unit());
185
185
  this.render();
@@ -299,6 +299,7 @@ var PulseInspector = class extends HTMLElement {
299
299
  renderUnitCard(unit) {
300
300
  const isGuard = "state" in unit;
301
301
  const name = unit._name || "unnamed";
302
+ const id = unit._id;
302
303
  const explanation = isGuard ? unit.explain() : null;
303
304
  const value = isGuard ? explanation.value : unit();
304
305
  let status = "ok";
@@ -320,13 +321,13 @@ var PulseInspector = class extends HTMLElement {
320
321
  <input class="edit-input" value='${this.safeStringify(value)}' />
321
322
  </form>
322
323
  ` : `
323
- <div class="value-row ${!isGuard && name !== "unnamed" ? "editable-value" : ""}"
324
+ <div class="value-row ${!isGuard ? "editable-value" : ""}"
325
+ data-id="${id}"
324
326
  data-name="${name}"
325
- title="${!isGuard ? name === "unnamed" ? "Unnamed sources cannot be edited (not trackable)" : "Click to edit" : ""}">
327
+ title="${!isGuard ? "Click to edit" : ""}">
326
328
  <span style="opacity:0.5;margin-right:6px">Value:</span>
327
329
  <span class="value-text">${this.formatValue(value)}</span>
328
- ${!isGuard && name !== "unnamed" ? `<span class="edit-icon">${ICONS.edit}</span>` : ""}
329
- ${!isGuard && name === "unnamed" ? `<span style="opacity:0.3;font-size:10px;margin-left:auto">\u{1F512} Locked</span>` : ""}
330
+ ${!isGuard ? `<span class="edit-icon">${ICONS.edit}</span>` : ""}
330
331
  </div>
331
332
  `}
332
333
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pulse-js/tools",
3
- "version": "0.1.6",
3
+ "version": "0.1.7",
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.8"
16
+ "@pulse-js/core": "^0.1.9"
17
17
  }
18
18
  }