@jsenv/plugin-toolbar 0.1.10 → 0.1.12

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.
@@ -39,7 +39,7 @@
39
39
  </svg>
40
40
  </button>
41
41
  </div>
42
- <div data-when="execution:errored">
42
+ <div data-when="execution:failed">
43
43
  <div class="tooltip">Execution failed in X ms</div>
44
44
  <button class="toolbar_control">
45
45
  <svg id="execution_failed_icon" data-animate="" viewBox="0 0 512 512">
@@ -115,23 +115,23 @@ function t() {
115
115
  }
116
116
  let i,
117
117
  t = !1;
118
- while (void 0 !== n) {
119
- let s = n;
120
- n = void 0;
118
+ while (void 0 !== s) {
119
+ let n = s;
120
+ s = void 0;
121
121
  f++;
122
- while (void 0 !== s) {
123
- const o = s.o;
124
- s.o = void 0;
125
- s.f &= -3;
126
- if (!(8 & s.f) && v(s)) try {
127
- s.c();
128
- } catch (s) {
122
+ while (void 0 !== n) {
123
+ const o = n.o;
124
+ n.o = void 0;
125
+ n.f &= -3;
126
+ if (!(8 & n.f) && d$1(n)) try {
127
+ n.c();
128
+ } catch (n) {
129
129
  if (!t) {
130
- i = s;
130
+ i = n;
131
131
  t = !0;
132
132
  }
133
133
  }
134
- s = o;
134
+ n = o;
135
135
  }
136
136
  }
137
137
  f = 0;
@@ -139,7 +139,7 @@ function t() {
139
139
  if (t) throw i;
140
140
  }
141
141
  let o,
142
- n,
142
+ s,
143
143
  h$1 = 0,
144
144
  f = 0,
145
145
  r = 0;
@@ -194,26 +194,26 @@ c$1.prototype.S = function (i) {
194
194
  c$1.prototype.U = function (i) {
195
195
  if (void 0 !== this.t) {
196
196
  const t = i.e,
197
- s = i.x;
197
+ n = i.x;
198
198
  if (void 0 !== t) {
199
- t.x = s;
199
+ t.x = n;
200
200
  i.e = void 0;
201
201
  }
202
- if (void 0 !== s) {
203
- s.e = t;
202
+ if (void 0 !== n) {
203
+ n.e = t;
204
204
  i.x = void 0;
205
205
  }
206
- if (i === this.t) this.t = s;
206
+ if (i === this.t) this.t = n;
207
207
  }
208
208
  };
209
209
  c$1.prototype.subscribe = function (i) {
210
210
  const t = this;
211
- return p$1(function () {
212
- const s = t.value,
211
+ return b(function () {
212
+ const n = t.value,
213
213
  o = 32 & this.f;
214
214
  this.f &= -33;
215
215
  try {
216
- i(s);
216
+ i(n);
217
217
  } finally {
218
218
  this.f |= o;
219
219
  }
@@ -225,6 +225,9 @@ c$1.prototype.valueOf = function () {
225
225
  c$1.prototype.toString = function () {
226
226
  return this.value + "";
227
227
  };
228
+ c$1.prototype.toJSON = function () {
229
+ return this.value;
230
+ };
228
231
  c$1.prototype.peek = function () {
229
232
  return this.v;
230
233
  };
@@ -234,10 +237,13 @@ Object.defineProperty(c$1.prototype, "value", {
234
237
  if (void 0 !== i) i.i = this.i;
235
238
  return this.v;
236
239
  },
237
- set(s) {
238
- if (s !== this.v) {
240
+ set(n) {
241
+ if (o instanceof a$1) !function () {
242
+ throw new Error("Computed cannot have side-effects");
243
+ }();
244
+ if (n !== this.v) {
239
245
  if (f > 100) i();
240
- this.v = s;
246
+ this.v = n;
241
247
  this.i++;
242
248
  r++;
243
249
  h$1++;
@@ -252,14 +258,14 @@ Object.defineProperty(c$1.prototype, "value", {
252
258
  function u(i) {
253
259
  return new c$1(i);
254
260
  }
255
- function v(i) {
261
+ function d$1(i) {
256
262
  for (let t = i.s; void 0 !== t; t = t.n) if (t.S.i !== t.i || !t.S.h() || t.S.i !== t.i) return !0;
257
263
  return !1;
258
264
  }
259
- function d$1(i) {
265
+ function v(i) {
260
266
  for (let t = i.s; void 0 !== t; t = t.n) {
261
- const s = t.S.n;
262
- if (void 0 !== s) t.r = s;
267
+ const n = t.S.n;
268
+ if (void 0 !== n) t.r = n;
263
269
  t.S.n = t;
264
270
  t.i = -1;
265
271
  if (void 0 === t.n) {
@@ -270,17 +276,17 @@ function d$1(i) {
270
276
  }
271
277
  function l(i) {
272
278
  let t,
273
- s = i.s;
274
- while (void 0 !== s) {
275
- const i = s.p;
276
- if (-1 === s.i) {
277
- s.S.U(s);
278
- if (void 0 !== i) i.n = s.n;
279
- if (void 0 !== s.n) s.n.p = i;
280
- } else t = s;
281
- s.S.n = s.r;
282
- if (void 0 !== s.r) s.r = void 0;
283
- s = i;
279
+ n = i.s;
280
+ while (void 0 !== n) {
281
+ const i = n.p;
282
+ if (-1 === n.i) {
283
+ n.S.U(n);
284
+ if (void 0 !== i) i.n = n.n;
285
+ if (void 0 !== n.n) n.n.p = i;
286
+ } else t = n;
287
+ n.S.n = n.r;
288
+ if (void 0 !== n.r) n.r = void 0;
289
+ n = i;
284
290
  }
285
291
  i.s = t;
286
292
  }
@@ -299,13 +305,13 @@ function a$1(i) {
299
305
  if (this.g === r) return !0;
300
306
  this.g = r;
301
307
  this.f |= 1;
302
- if (this.i > 0 && !v(this)) {
308
+ if (this.i > 0 && !d$1(this)) {
303
309
  this.f &= -2;
304
310
  return !0;
305
311
  }
306
312
  const i = o;
307
313
  try {
308
- d$1(this);
314
+ v(this);
309
315
  o = this;
310
316
  const i = this.x();
311
317
  if (16 & this.f || this.v !== i || 0 === this.i) {
@@ -364,21 +370,21 @@ function w(i) {
364
370
  return new a$1(i);
365
371
  }
366
372
  function y(i) {
367
- const s = i.u;
373
+ const n = i.u;
368
374
  i.u = void 0;
369
- if ("function" == typeof s) {
375
+ if ("function" == typeof n) {
370
376
  h$1++;
371
- const n = o;
377
+ const s = o;
372
378
  o = void 0;
373
379
  try {
374
- s();
380
+ n();
375
381
  } catch (t) {
376
382
  i.f &= -2;
377
383
  i.f |= 8;
378
384
  _(i);
379
385
  throw t;
380
386
  } finally {
381
- o = n;
387
+ o = s;
382
388
  t();
383
389
  }
384
390
  }
@@ -389,7 +395,7 @@ function _(i) {
389
395
  i.s = void 0;
390
396
  y(i);
391
397
  }
392
- function g(i) {
398
+ function p$1(i) {
393
399
  if (o !== this) throw new Error("Out-of-order effect");
394
400
  l(this);
395
401
  o = i;
@@ -397,45 +403,48 @@ function g(i) {
397
403
  if (8 & this.f) _(this);
398
404
  t();
399
405
  }
400
- function b(i) {
406
+ function g(i) {
401
407
  this.x = i;
402
408
  this.u = void 0;
403
409
  this.s = void 0;
404
410
  this.o = void 0;
405
411
  this.f = 32;
406
412
  }
407
- b.prototype.c = function () {
413
+ g.prototype.c = function () {
408
414
  const i = this.S();
409
415
  try {
410
- if (!(8 & this.f) && void 0 !== this.x) this.u = this.x();
416
+ if (8 & this.f) return;
417
+ if (void 0 === this.x) return;
418
+ const t = this.x();
419
+ if ("function" == typeof t) this.u = t;
411
420
  } finally {
412
421
  i();
413
422
  }
414
423
  };
415
- b.prototype.S = function () {
424
+ g.prototype.S = function () {
416
425
  if (1 & this.f) i();
417
426
  this.f |= 1;
418
427
  this.f &= -9;
419
428
  y(this);
420
- d$1(this);
429
+ v(this);
421
430
  h$1++;
422
431
  const t = o;
423
432
  o = this;
424
- return g.bind(this, t);
433
+ return p$1.bind(this, t);
425
434
  };
426
- b.prototype.N = function () {
435
+ g.prototype.N = function () {
427
436
  if (!(2 & this.f)) {
428
437
  this.f |= 2;
429
- this.o = n;
430
- n = this;
438
+ this.o = s;
439
+ s = this;
431
440
  }
432
441
  };
433
- b.prototype.d = function () {
442
+ g.prototype.d = function () {
434
443
  this.f |= 8;
435
444
  if (!(1 & this.f)) _(this);
436
445
  };
437
- function p$1(i) {
438
- const t = new b(i);
446
+ function b(i) {
447
+ const t = new g(i);
439
448
  try {
440
449
  t.c();
441
450
  } catch (i) {
@@ -522,7 +531,7 @@ c("__r", (t, i) => {
522
531
  e = n.__$u;
523
532
  if (void 0 === e) n.__$u = e = function (t) {
524
533
  let i;
525
- p$1(function () {
534
+ b(function () {
526
535
  i = this;
527
536
  });
528
537
  i.c = () => {
@@ -577,7 +586,7 @@ function h(t, i, e, n) {
577
586
  r.value = t;
578
587
  n = i;
579
588
  },
580
- d: p$1(() => {
589
+ d: b(() => {
581
590
  const e = r.value.value;
582
591
  if (n[i] !== e) {
583
592
  n[i] = e;
@@ -630,7 +639,7 @@ const stateFromLocalStorage = localStorage.hasOwnProperty("jsenv_toolbar") ? JSO
630
639
 
631
640
  const animationsEnabledSignal = u(typeof stateFromLocalStorage.animationsEnabled === "boolean" ? stateFromLocalStorage.animationsEnabled : typeof paramsFromParentWindow.animationsEnabled === "boolean" ? paramsFromParentWindow.animationsEnabled : false);
632
641
 
633
- p$1(() => {
642
+ b(() => {
634
643
  const animationsEnabled = animationsEnabledSignal.value;
635
644
  if (animationsEnabled) {
636
645
  document.documentElement.removeAttribute("data-animation-disabled");
@@ -734,7 +743,7 @@ const notifyExecutionResult = (execution, previousExecution) => {
734
743
  clickToFocus: true,
735
744
  clickToClose: true
736
745
  };
737
- if (execution.status === "errored") {
746
+ if (execution.status === "failed") {
738
747
  if (previousExecution) {
739
748
  if (previousExecution.status === "completed") {
740
749
  notify("Broken", {
@@ -753,7 +762,7 @@ const notifyExecutionResult = (execution, previousExecution) => {
753
762
  body: `${executedFileRelativeUrl} execution failed.`
754
763
  });
755
764
  }
756
- } else if (previousExecution && previousExecution.status === "errored") {
765
+ } else if (previousExecution && previousExecution.status === "failed") {
757
766
  notify("Fixed", {
758
767
  ...notificationOptions,
759
768
  body: `${executedFileRelativeUrl} execution fixed.`
@@ -765,13 +774,13 @@ const getFaviconHref = () => {
765
774
  return link ? link.href : undefined;
766
775
  };
767
776
 
768
- p$1(() => {
777
+ b(() => {
769
778
  const execution = executionSignal.value;
770
779
  if (execution) {
771
780
  sessionStorage.setItem(window.location.href, JSON.stringify(execution));
772
781
  }
773
782
  });
774
- p$1(() => {
783
+ b(() => {
775
784
  const execution = executionSignal.value;
776
785
  const previousExecution = previousExecutionSignal.value;
777
786
  if (execution) {
@@ -779,7 +788,7 @@ p$1(() => {
779
788
  }
780
789
  });
781
790
 
782
- p$1(() => {
791
+ b(() => {
783
792
  const notificationsEnabled = notificationsEnabledSignal.value;
784
793
  if (!notificationsEnabled) {
785
794
  closeAllNotifications();
@@ -939,7 +948,7 @@ const startJavaScriptAnimation = ({
939
948
  };
940
949
 
941
950
  const initToolbarOpening = () => {
942
- p$1(() => {
951
+ b(() => {
943
952
  const opened = openedSignal.value;
944
953
  if (opened) {
945
954
  showToolbar();
@@ -1199,7 +1208,7 @@ const renderToolbarOverlay = () => {
1199
1208
  closeAllTooltips();
1200
1209
  closeSettings();
1201
1210
  };
1202
- p$1(() => {
1211
+ b(() => {
1203
1212
  if (!window.parent) {
1204
1213
  // can happen while parent iframe reloads
1205
1214
  return;
@@ -1326,11 +1335,11 @@ const renameAttribute = (node, name, newName) => {
1326
1335
  const executionIndicator = document.querySelector("#document_execution_indicator");
1327
1336
  const renderDocumentExecutionIndicator = async () => {
1328
1337
  removeForceHideElement(document.querySelector("#document_execution_indicator"));
1329
- p$1(() => {
1338
+ b(() => {
1330
1339
  const execution = executionSignal.value;
1331
1340
  updateExecutionIndicator(execution);
1332
1341
  });
1333
- p$1(() => {
1342
+ b(() => {
1334
1343
  const executionTooltipOpened = executionTooltipOpenedSignal.value;
1335
1344
  if (executionTooltipOpened) {
1336
1345
  executionIndicator.setAttribute("data-tooltip-visible", "");
@@ -1372,7 +1381,7 @@ const computeText = ({
1372
1381
  if (status === "completed") {
1373
1382
  return `Execution completed in ${endTime - startTime}ms`;
1374
1383
  }
1375
- if (status === "errored") {
1384
+ if (status === "failed") {
1376
1385
  return `Execution failed in ${endTime - startTime}ms`;
1377
1386
  }
1378
1387
  if (status === "running") {
@@ -1414,7 +1423,7 @@ const closeChangesToolip = () => {
1414
1423
 
1415
1424
  const changesIndicator = document.querySelector("#changes_indicator");
1416
1425
  const renderChangesIndicator = () => {
1417
- p$1(() => {
1426
+ b(() => {
1418
1427
  const autoreloadEnabled = autoreloadEnabledSignal.value;
1419
1428
  const changes = changesSignal.value;
1420
1429
  const changeCount = changes.length;
@@ -1436,7 +1445,7 @@ const renderChangesIndicator = () => {
1436
1445
  changesIndicator.querySelector(".tooltip_action").onclick = () => {
1437
1446
  parentWindowReloader.reload();
1438
1447
  };
1439
- p$1(() => {
1448
+ b(() => {
1440
1449
  const changesTooltipOpened = changesTooltipOpenedSignal.value;
1441
1450
  if (changesTooltipOpened) {
1442
1451
  changesIndicator.setAttribute("data-tooltip-visible", "");
@@ -1469,11 +1478,11 @@ const serverEvents = window.__server_events__;
1469
1478
  const serverIndicator = document.querySelector("#server_indicator");
1470
1479
  const renderServerIndicator = () => {
1471
1480
  removeForceHideElement(document.querySelector("#server_indicator"));
1472
- p$1(() => {
1481
+ b(() => {
1473
1482
  const serverConnection = serverConnectionSignal.value;
1474
1483
  updateServerIndicator(serverConnection);
1475
1484
  });
1476
- p$1(() => {
1485
+ b(() => {
1477
1486
  const serverTooltipOpened = serverTooltipOpenedSignal.value;
1478
1487
  if (serverTooltipOpened) {
1479
1488
  serverIndicator.setAttribute("data-tooltip-visible", "");
@@ -1519,7 +1528,7 @@ const renderToolbarAutoreloadSetting = () => {
1519
1528
  return;
1520
1529
  }
1521
1530
  const autoreloadCheckbox = document.querySelector("#toggle_autoreload");
1522
- p$1(() => {
1531
+ b(() => {
1523
1532
  const autoreloadEnabled = autoreloadEnabledSignal.value;
1524
1533
  if (autoreloadEnabled) {
1525
1534
  autoreloadCheckbox.checked = true;
@@ -1586,7 +1595,7 @@ const disableAnimations = () => {
1586
1595
 
1587
1596
  const renderToolbarAnimationSetting = () => {
1588
1597
  const animCheckbox = document.querySelector("#toggle_anims");
1589
- p$1(() => {
1598
+ b(() => {
1590
1599
  const animationsEnabled = animationsEnabledSignal.value;
1591
1600
  animCheckbox.checked = animationsEnabled;
1592
1601
  });
@@ -1605,11 +1614,11 @@ const renderToolbarAnimationSetting = () => {
1605
1614
 
1606
1615
  const notifCheckbox = document.querySelector("#toggle_notifs");
1607
1616
  const renderToolbarNotificationSetting = () => {
1608
- p$1(() => {
1617
+ b(() => {
1609
1618
  const notificationsEnabled = notificationsEnabledSignal.value;
1610
1619
  notifCheckbox.checked = notificationsEnabled;
1611
1620
  });
1612
- p$1(() => {
1621
+ b(() => {
1613
1622
  const notificationPermission = notificationPermissionSignal.value;
1614
1623
  if (!notificationAPIDetected) {
1615
1624
  applyNotificationNotAvailableEffects();
@@ -1700,7 +1709,7 @@ const renderToolbarSettings = () => {
1700
1709
  renderToolbarAnimationSetting();
1701
1710
  renderToolbarNotificationSetting();
1702
1711
  renderToolbarThemeSetting();
1703
- p$1(() => {
1712
+ b(() => {
1704
1713
  const settingsOpened = settingsOpenedSignal.value;
1705
1714
  if (settingsOpened) {
1706
1715
  activateToolbarSection(document.querySelector("#settings"));
@@ -1768,14 +1777,14 @@ addExternalCommandCallback("initToolbar", () => {
1768
1777
  });
1769
1778
  sendEventToParent("toolbar_ready");
1770
1779
 
1771
- p$1(() => {
1780
+ b(() => {
1772
1781
  const serverConnection = serverConnectionSignal.value;
1773
1782
  if (serverConnection === "connecting" || serverConnection === "closed") {
1774
1783
  openServerTooltip();
1775
1784
  }
1776
1785
  });
1777
1786
 
1778
- p$1(() => {
1787
+ b(() => {
1779
1788
  const theme = themeSignal.value;
1780
1789
  document.querySelector("html").setAttribute("data-theme", theme);
1781
1790
  });
@@ -1796,7 +1805,7 @@ const toolbarStateSignal = w(() => {
1796
1805
  };
1797
1806
  });
1798
1807
 
1799
- p$1(() => {
1808
+ b(() => {
1800
1809
  const toolbarState = toolbarStateSignal.value;
1801
1810
  localStorage.setItem("jsenv_toolbar", JSON.stringify(toolbarState));
1802
1811
  sendEventToParent("toolbar_state_change", toolbarState);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jsenv/plugin-toolbar",
3
- "version": "0.1.10",
3
+ "version": "0.1.12",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",
@@ -26,7 +26,7 @@
26
26
  "/src/"
27
27
  ],
28
28
  "dependencies": {
29
- "@jsenv/ast": "3.0.3",
29
+ "@jsenv/ast": "3.0.5",
30
30
  "@preact/signals": "1.1.3"
31
31
  },
32
32
  "scripts": {
@@ -17,7 +17,7 @@ export const notifyExecutionResult = (execution, previousExecution) => {
17
17
  clickToFocus: true,
18
18
  clickToClose: true,
19
19
  }
20
- if (execution.status === "errored") {
20
+ if (execution.status === "failed") {
21
21
  if (previousExecution) {
22
22
  if (previousExecution.status === "completed") {
23
23
  notify("Broken", {
@@ -36,7 +36,7 @@ export const notifyExecutionResult = (execution, previousExecution) => {
36
36
  body: `${executedFileRelativeUrl} execution failed.`,
37
37
  })
38
38
  }
39
- } else if (previousExecution && previousExecution.status === "errored") {
39
+ } else if (previousExecution && previousExecution.status === "failed") {
40
40
  notify("Fixed", {
41
41
  ...notificationOptions,
42
42
  body: `${executedFileRelativeUrl} execution fixed.`,
@@ -57,7 +57,7 @@
57
57
  </svg>
58
58
  </button>
59
59
  </div>
60
- <div data-when="execution:errored">
60
+ <div data-when="execution:failed">
61
61
  <div class="tooltip">Execution failed in X ms</div>
62
62
  <button class="toolbar_control">
63
63
  <svg
@@ -56,7 +56,7 @@ const computeText = ({ status, startTime, endTime }) => {
56
56
  if (status === "completed") {
57
57
  return `Execution completed in ${endTime - startTime}ms`
58
58
  }
59
- if (status === "errored") {
59
+ if (status === "failed") {
60
60
  return `Execution failed in ${endTime - startTime}ms`
61
61
  }
62
62
  if (status === "running") {