@jsenv/plugin-toolbar 0.1.2 → 0.1.3

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.
Files changed (66) hide show
  1. package/dist/css/toolbar.css +683 -7
  2. package/dist/js/toolbar_core.js +1792 -8
  3. package/dist/js/toolbar_injector.js +4 -2
  4. package/dist/jsenv_plugin_toolbar.js +6 -3
  5. package/package.json +1 -1
  6. package/dist/css/document_execution_indicator.css +0 -87
  7. package/dist/css/globals.css +0 -75
  8. package/dist/css/server_indicator.css +0 -83
  9. package/dist/css/theme_light.css +0 -110
  10. package/dist/css/toolbar_menu_overflow.css +0 -59
  11. package/dist/css/toolbar_settings.css +0 -202
  12. package/dist/css/tooltips.css +0 -67
  13. package/dist/js/animation.js +0 -282
  14. package/dist/js/animation_actions.js +0 -7
  15. package/dist/js/animation_effects.js +0 -10
  16. package/dist/js/animation_signals.js +0 -4
  17. package/dist/js/changes_actions.js +0 -7
  18. package/dist/js/changes_indicator.js +0 -57
  19. package/dist/js/changes_signals.js +0 -2
  20. package/dist/js/document_execution_indicator.js +0 -62
  21. package/dist/js/document_index_link.js +0 -4
  22. package/dist/js/dom.js +0 -48
  23. package/dist/js/execution_actions.js +0 -46
  24. package/dist/js/execution_effects.js +0 -16
  25. package/dist/js/execution_signals.js +0 -17
  26. package/dist/js/hooks.mjs +0 -185
  27. package/dist/js/iframe_to_parent_href.js +0 -10
  28. package/dist/js/notification_actions.js +0 -60
  29. package/dist/js/notification_context.js +0 -1
  30. package/dist/js/notification_effects.js +0 -9
  31. package/dist/js/notification_signals.js +0 -5
  32. package/dist/js/parent_window_actions.js +0 -39
  33. package/dist/js/parent_window_context.js +0 -6
  34. package/dist/js/parent_window_effects.js +0 -15
  35. package/dist/js/parent_window_signals.js +0 -25
  36. package/dist/js/preact.mjs +0 -316
  37. package/dist/js/responsive.js +0 -104
  38. package/dist/js/server_actions.js +0 -7
  39. package/dist/js/server_effects.js +0 -9
  40. package/dist/js/server_indicator.js +0 -52
  41. package/dist/js/server_signals.js +0 -10
  42. package/dist/js/settings_actions.js +0 -7
  43. package/dist/js/settings_signals.js +0 -2
  44. package/dist/js/signals-core.mjs +0 -339
  45. package/dist/js/signals.mjs +0 -202
  46. package/dist/js/theme_actions.js +0 -7
  47. package/dist/js/theme_effects.js +0 -6
  48. package/dist/js/theme_signals.js +0 -4
  49. package/dist/js/toolbar_animation_setting.js +0 -21
  50. package/dist/js/toolbar_autoreload_setting.js +0 -67
  51. package/dist/js/toolbar_close_button.js +0 -14
  52. package/dist/js/toolbar_menu_overflow.js +0 -81
  53. package/dist/js/toolbar_notification_setting.js +0 -72
  54. package/dist/js/toolbar_open_actions.js +0 -7
  55. package/dist/js/toolbar_open_effects.js +0 -4
  56. package/dist/js/toolbar_open_signals.js +0 -4
  57. package/dist/js/toolbar_opening.js +0 -65
  58. package/dist/js/toolbar_overlay.js +0 -69
  59. package/dist/js/toolbar_settings.js +0 -44
  60. package/dist/js/toolbar_state_context.js +0 -1
  61. package/dist/js/toolbar_state_effects.js +0 -8
  62. package/dist/js/toolbar_state_signals.js +0 -17
  63. package/dist/js/toolbar_theme_setting.js +0 -13
  64. package/dist/js/toolbar_ui.js +0 -20
  65. package/dist/js/tooltip_actions.js +0 -6
  66. package/dist/js/variant.js +0 -53
@@ -1,104 +0,0 @@
1
- export const createHorizontalBreakpoint = breakpointValue => {
2
- return createBreakpoint(windowWidthMeasure, breakpointValue);
3
- };
4
- const createMeasure = ({
5
- compute,
6
- register
7
- }) => {
8
- let currentValue = compute();
9
- const get = () => compute();
10
- const changed = createSignal();
11
- let unregister = () => {};
12
- if (register) {
13
- unregister = register(() => {
14
- const value = compute();
15
- if (value !== currentValue) {
16
- const previousValue = value;
17
- currentValue = value;
18
- changed.notify(value, previousValue);
19
- }
20
- });
21
- }
22
- return {
23
- get,
24
- changed,
25
- unregister
26
- };
27
- };
28
- const createSignal = () => {
29
- const callbackArray = [];
30
- const listen = callback => {
31
- callbackArray.push(callback);
32
- return () => {
33
- const index = callbackArray.indexOf(callback);
34
- if (index > -1) {
35
- callbackArray.splice(index, 1);
36
- }
37
- };
38
- };
39
- const notify = (...args) => {
40
- callbackArray.slice().forEach(callback => {
41
- callback(...args);
42
- });
43
- };
44
- return {
45
- listen,
46
- notify
47
- };
48
- };
49
- const windowWidthMeasure = createMeasure({
50
- name: "window-width",
51
- compute: () => window.innerWidth,
52
- register: onchange => {
53
- window.addEventListener("resize", onchange);
54
- window.addEventListener("orientationchange", onchange);
55
- return () => {
56
- window.removeEventListener("resize", onchange);
57
- window.removeEventListener("orientationchange", onchange);
58
- };
59
- }
60
- });
61
- const createBreakpoint = (measure, breakpointValue) => {
62
- const getBreakpointState = () => {
63
- const value = measure.get();
64
- if (value < breakpointValue) {
65
- return "below";
66
- }
67
- if (value > breakpointValue) {
68
- return "above";
69
- }
70
- return "equals";
71
- };
72
- let currentBreakpointState = getBreakpointState();
73
- const isAbove = () => {
74
- return measure.get() > breakpointValue;
75
- };
76
- const isBelow = () => {
77
- return measure.get() < breakpointValue;
78
- };
79
- const breakpointChanged = createSignal();
80
- measure.changed.listen(() => {
81
- const breakpointState = getBreakpointState();
82
- if (breakpointState !== currentBreakpointState) {
83
- const breakpointStatePrevious = currentBreakpointState;
84
- currentBreakpointState = breakpointState;
85
- breakpointChanged.notify(breakpointState, breakpointStatePrevious);
86
- }
87
- });
88
- return {
89
- isAbove,
90
- isBelow,
91
- changed: breakpointChanged
92
- };
93
- };
94
-
95
- // const windowScrollTop = createMeasure({
96
- // name: "window-scroll-top",
97
- // compute: () => window.scrollTop,
98
- // register: (onchange) => {
99
- // window.addEventListener("scroll", onchange)
100
- // return () => {
101
- // window.removeEventListener("scroll", onchange)
102
- // }
103
- // },
104
- // })
@@ -1,7 +0,0 @@
1
- import { serverTooltipOpenedSignal } from "./server_signals.js";
2
- export const openServerTooltip = () => {
3
- serverTooltipOpenedSignal.value = true;
4
- };
5
- export const closeServerTooltip = () => {
6
- serverTooltipOpenedSignal.value = false;
7
- };
@@ -1,9 +0,0 @@
1
- import { effect } from "./signals.mjs";
2
- import { serverConnectionSignal } from "./server_signals.js";
3
- import { openServerTooltip } from "./server_actions.js";
4
- effect(() => {
5
- const serverConnection = serverConnectionSignal.value;
6
- if (serverConnection === "connecting" || serverConnection === "closed") {
7
- openServerTooltip();
8
- }
9
- });
@@ -1,52 +0,0 @@
1
- import { effect } from "./signals.mjs";
2
- import { serverConnectionSignal, serverTooltipOpenedSignal } from "./server_signals.js";
3
- import { openServerTooltip, closeServerTooltip } from "./server_actions.js";
4
- import { removeForceHideElement } from "./dom.js";
5
- import { enableVariant } from "./variant.js";
6
- const parentServerEvents = window.parent.__server_events__;
7
- const serverEvents = window.__server_events__;
8
- const serverIndicator = document.querySelector("#server_indicator");
9
- export const renderServerIndicator = () => {
10
- removeForceHideElement(document.querySelector("#server_indicator"));
11
- effect(() => {
12
- const serverConnection = serverConnectionSignal.value;
13
- updateServerIndicator(serverConnection);
14
- });
15
- effect(() => {
16
- const serverTooltipOpened = serverTooltipOpenedSignal.value;
17
- if (serverTooltipOpened) {
18
- serverIndicator.setAttribute("data-tooltip-visible", "");
19
- } else {
20
- serverIndicator.removeAttribute("data-tooltip-visible");
21
- }
22
- });
23
- };
24
- const updateServerIndicator = connectionState => {
25
- enableVariant(serverIndicator, {
26
- connectionState
27
- });
28
- const variantNode = document.querySelector("#server_indicator > [data-when-active]");
29
- variantNode.querySelector("button").onclick = () => {
30
- const serverTooltipOpened = serverTooltipOpenedSignal.value;
31
- if (serverTooltipOpened) {
32
- closeServerTooltip();
33
- } else {
34
- openServerTooltip();
35
- }
36
- };
37
- if (connectionState === "connecting") {
38
- variantNode.querySelector("a").onclick = () => {
39
- if (parentServerEvents) {
40
- parentServerEvents.disconnect();
41
- }
42
- serverEvents.disconnect();
43
- };
44
- } else if (connectionState === "closed") {
45
- variantNode.querySelector("a").onclick = () => {
46
- if (parentServerEvents) {
47
- parentServerEvents.connect();
48
- }
49
- serverEvents.connect();
50
- };
51
- }
52
- };
@@ -1,10 +0,0 @@
1
- import { signal } from "./signals.mjs";
2
- export const serverTooltipOpenedSignal = signal(false);
3
- export const serverConnectionSignal = signal("default");
4
- const serverEvents = window.__server_events__;
5
- if (serverEvents) {
6
- serverEvents.readyState.onchange = () => {
7
- serverConnectionSignal.value = serverEvents.readyState.value;
8
- };
9
- serverConnectionSignal.value = serverEvents.readyState.value;
10
- }
@@ -1,7 +0,0 @@
1
- import { settingsOpenedSignal } from "./settings_signals.js";
2
- export const openSettings = () => {
3
- settingsOpenedSignal.value = true;
4
- };
5
- export const closeSettings = () => {
6
- settingsOpenedSignal.value = false;
7
- };
@@ -1,2 +0,0 @@
1
- import { signal } from "./signals.mjs";
2
- export const settingsOpenedSignal = signal(false);
@@ -1,339 +0,0 @@
1
- function i() {
2
- throw new Error("Cycle detected");
3
- }
4
- function t() {
5
- if (h > 1) {
6
- h--;
7
- return;
8
- }
9
- let i,
10
- t = !1;
11
- while (void 0 !== o) {
12
- let s = o;
13
- o = void 0;
14
- f++;
15
- while (void 0 !== s) {
16
- const n = s.o;
17
- s.o = void 0;
18
- s.f &= -3;
19
- if (!(8 & s.f) && v(s)) try {
20
- s.c();
21
- } catch (s) {
22
- if (!t) {
23
- i = s;
24
- t = !0;
25
- }
26
- }
27
- s = n;
28
- }
29
- }
30
- f = 0;
31
- h--;
32
- if (t) throw i;
33
- }
34
- function s(i) {
35
- if (h > 0) return i();
36
- h++;
37
- try {
38
- return i();
39
- } finally {
40
- t();
41
- }
42
- }
43
- let n,
44
- o,
45
- h = 0,
46
- f = 0,
47
- r = 0;
48
- function e(i) {
49
- if (void 0 === n) return;
50
- let t = i.n;
51
- if (void 0 === t || t.t !== n) {
52
- t = {
53
- i: 0,
54
- S: i,
55
- p: void 0,
56
- n: n.s,
57
- t: n,
58
- e: void 0,
59
- x: void 0,
60
- r: t
61
- };
62
- n.s = t;
63
- i.n = t;
64
- if (32 & n.f) i.S(t);
65
- return t;
66
- } else if (-1 === t.i) {
67
- t.i = 0;
68
- if (void 0 !== t.p) {
69
- t.p.n = t.n;
70
- if (void 0 !== t.n) t.n.p = t.p;
71
- t.p = void 0;
72
- t.n = n.s;
73
- n.s.p = t;
74
- n.s = t;
75
- }
76
- return t;
77
- }
78
- }
79
- function u(i) {
80
- this.v = i;
81
- this.i = 0;
82
- this.n = void 0;
83
- this.t = void 0;
84
- }
85
- u.prototype.h = function () {
86
- return !0;
87
- };
88
- u.prototype.S = function (i) {
89
- if (this.t !== i && void 0 === i.e) {
90
- i.x = this.t;
91
- if (void 0 !== this.t) this.t.e = i;
92
- this.t = i;
93
- }
94
- };
95
- u.prototype.U = function (i) {
96
- const t = i.e,
97
- s = i.x;
98
- if (void 0 !== t) {
99
- t.x = s;
100
- i.e = void 0;
101
- }
102
- if (void 0 !== s) {
103
- s.e = t;
104
- i.x = void 0;
105
- }
106
- if (i === this.t) this.t = s;
107
- };
108
- u.prototype.subscribe = function (i) {
109
- const t = this;
110
- return b(function () {
111
- const s = t.value,
112
- n = 32 & this.f;
113
- this.f &= -33;
114
- try {
115
- i(s);
116
- } finally {
117
- this.f |= n;
118
- }
119
- });
120
- };
121
- u.prototype.valueOf = function () {
122
- return this.value;
123
- };
124
- u.prototype.toString = function () {
125
- return this.value + "";
126
- };
127
- u.prototype.peek = function () {
128
- return this.v;
129
- };
130
- Object.defineProperty(u.prototype, "value", {
131
- get() {
132
- const i = e(this);
133
- if (void 0 !== i) i.i = this.i;
134
- return this.v;
135
- },
136
- set(s) {
137
- if (s !== this.v) {
138
- if (f > 100) i();
139
- this.v = s;
140
- this.i++;
141
- r++;
142
- h++;
143
- try {
144
- for (let i = this.t; void 0 !== i; i = i.x) i.t.N();
145
- } finally {
146
- t();
147
- }
148
- }
149
- }
150
- });
151
- function c(i) {
152
- return new u(i);
153
- }
154
- function v(i) {
155
- 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;
156
- return !1;
157
- }
158
- function d(i) {
159
- for (let t = i.s; void 0 !== t; t = t.n) {
160
- const i = t.S.n;
161
- if (void 0 !== i) t.r = i;
162
- t.S.n = t;
163
- t.i = -1;
164
- }
165
- }
166
- function l(i) {
167
- let t,
168
- s = i.s;
169
- while (void 0 !== s) {
170
- const i = s.n;
171
- if (-1 === s.i) {
172
- s.S.U(s);
173
- s.n = void 0;
174
- } else {
175
- if (void 0 !== t) t.p = s;
176
- s.p = void 0;
177
- s.n = t;
178
- t = s;
179
- }
180
- s.S.n = s.r;
181
- if (void 0 !== s.r) s.r = void 0;
182
- s = i;
183
- }
184
- i.s = t;
185
- }
186
- function w(i) {
187
- u.call(this, void 0);
188
- this.x = i;
189
- this.s = void 0;
190
- this.g = r - 1;
191
- this.f = 4;
192
- }
193
- (w.prototype = new u()).h = function () {
194
- this.f &= -3;
195
- if (1 & this.f) return !1;
196
- if (32 == (36 & this.f)) return !0;
197
- this.f &= -5;
198
- if (this.g === r) return !0;
199
- this.g = r;
200
- this.f |= 1;
201
- if (this.i > 0 && !v(this)) {
202
- this.f &= -2;
203
- return !0;
204
- }
205
- const i = n;
206
- try {
207
- d(this);
208
- n = this;
209
- const i = this.x();
210
- if (16 & this.f || this.v !== i || 0 === this.i) {
211
- this.v = i;
212
- this.f &= -17;
213
- this.i++;
214
- }
215
- } catch (i) {
216
- this.v = i;
217
- this.f |= 16;
218
- this.i++;
219
- }
220
- n = i;
221
- l(this);
222
- this.f &= -2;
223
- return !0;
224
- };
225
- w.prototype.S = function (i) {
226
- if (void 0 === this.t) {
227
- this.f |= 36;
228
- for (let i = this.s; void 0 !== i; i = i.n) i.S.S(i);
229
- }
230
- u.prototype.S.call(this, i);
231
- };
232
- w.prototype.U = function (i) {
233
- u.prototype.U.call(this, i);
234
- if (void 0 === this.t) {
235
- this.f &= -33;
236
- for (let i = this.s; void 0 !== i; i = i.n) i.S.U(i);
237
- }
238
- };
239
- w.prototype.N = function () {
240
- if (!(2 & this.f)) {
241
- this.f |= 6;
242
- for (let i = this.t; void 0 !== i; i = i.x) i.t.N();
243
- }
244
- };
245
- w.prototype.peek = function () {
246
- if (!this.h()) i();
247
- if (16 & this.f) throw this.v;
248
- return this.v;
249
- };
250
- Object.defineProperty(w.prototype, "value", {
251
- get() {
252
- if (1 & this.f) i();
253
- const t = e(this);
254
- this.h();
255
- if (void 0 !== t) t.i = this.i;
256
- if (16 & this.f) throw this.v;
257
- return this.v;
258
- }
259
- });
260
- function a(i) {
261
- return new w(i);
262
- }
263
- function y(i) {
264
- const s = i.u;
265
- i.u = void 0;
266
- if ("function" == typeof s) {
267
- h++;
268
- const o = n;
269
- n = void 0;
270
- try {
271
- s();
272
- } catch (t) {
273
- i.f &= -2;
274
- i.f |= 8;
275
- _(i);
276
- throw t;
277
- } finally {
278
- n = o;
279
- t();
280
- }
281
- }
282
- }
283
- function _(i) {
284
- for (let t = i.s; void 0 !== t; t = t.n) t.S.U(t);
285
- i.x = void 0;
286
- i.s = void 0;
287
- y(i);
288
- }
289
- function g(i) {
290
- if (n !== this) throw new Error("Out-of-order effect");
291
- l(this);
292
- n = i;
293
- this.f &= -2;
294
- if (8 & this.f) _(this);
295
- t();
296
- }
297
- function p(i) {
298
- this.x = i;
299
- this.u = void 0;
300
- this.s = void 0;
301
- this.o = void 0;
302
- this.f = 32;
303
- }
304
- p.prototype.c = function () {
305
- const i = this.S();
306
- try {
307
- if (!(8 & this.f) && void 0 !== this.x) this.u = this.x();
308
- } finally {
309
- i();
310
- }
311
- };
312
- p.prototype.S = function () {
313
- if (1 & this.f) i();
314
- this.f |= 1;
315
- this.f &= -9;
316
- y(this);
317
- d(this);
318
- h++;
319
- const t = n;
320
- n = this;
321
- return g.bind(this, t);
322
- };
323
- p.prototype.N = function () {
324
- if (!(2 & this.f)) {
325
- this.f |= 2;
326
- this.o = o;
327
- o = this;
328
- }
329
- };
330
- p.prototype.d = function () {
331
- this.f |= 8;
332
- if (!(1 & this.f)) _(this);
333
- };
334
- function b(i) {
335
- const t = new p(i);
336
- t.c();
337
- return t.d.bind(t);
338
- }
339
- export { u as Signal, s as batch, a as computed, b as effect, c as signal };