@jsenv/plugin-toolbar 0.1.1 → 0.1.2

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/document_execution_indicator.css +87 -0
  2. package/dist/css/globals.css +75 -0
  3. package/dist/css/server_indicator.css +83 -0
  4. package/dist/css/theme_light.css +110 -0
  5. package/dist/css/toolbar.css +7 -683
  6. package/dist/css/toolbar_menu_overflow.css +59 -0
  7. package/dist/css/toolbar_settings.css +202 -0
  8. package/dist/css/tooltips.css +67 -0
  9. package/dist/js/animation.js +282 -0
  10. package/dist/js/animation_actions.js +7 -0
  11. package/dist/js/animation_effects.js +10 -0
  12. package/dist/js/animation_signals.js +4 -0
  13. package/dist/js/changes_actions.js +7 -0
  14. package/dist/js/changes_indicator.js +57 -0
  15. package/dist/js/changes_signals.js +2 -0
  16. package/dist/js/document_execution_indicator.js +62 -0
  17. package/dist/js/document_index_link.js +4 -0
  18. package/dist/js/dom.js +48 -0
  19. package/dist/js/execution_actions.js +46 -0
  20. package/dist/js/execution_effects.js +16 -0
  21. package/dist/js/execution_signals.js +17 -0
  22. package/dist/js/hooks.mjs +185 -0
  23. package/dist/js/iframe_to_parent_href.js +10 -0
  24. package/dist/js/notification_actions.js +60 -0
  25. package/dist/js/notification_context.js +1 -0
  26. package/dist/js/notification_effects.js +9 -0
  27. package/dist/js/notification_signals.js +5 -0
  28. package/dist/js/parent_window_actions.js +39 -0
  29. package/dist/js/parent_window_context.js +6 -0
  30. package/dist/js/parent_window_effects.js +15 -0
  31. package/dist/js/parent_window_signals.js +25 -0
  32. package/dist/js/preact.mjs +316 -0
  33. package/dist/js/responsive.js +104 -0
  34. package/dist/js/server_actions.js +7 -0
  35. package/dist/js/server_effects.js +9 -0
  36. package/dist/js/server_indicator.js +52 -0
  37. package/dist/js/server_signals.js +10 -0
  38. package/dist/js/settings_actions.js +7 -0
  39. package/dist/js/settings_signals.js +2 -0
  40. package/dist/js/signals-core.mjs +339 -0
  41. package/dist/js/signals.mjs +202 -0
  42. package/dist/js/theme_actions.js +7 -0
  43. package/dist/js/theme_effects.js +6 -0
  44. package/dist/js/theme_signals.js +4 -0
  45. package/dist/js/toolbar_animation_setting.js +21 -0
  46. package/dist/js/toolbar_autoreload_setting.js +67 -0
  47. package/dist/js/toolbar_close_button.js +14 -0
  48. package/dist/js/toolbar_core.js +8 -1792
  49. package/dist/js/toolbar_injector.js +2 -4
  50. package/dist/js/toolbar_menu_overflow.js +81 -0
  51. package/dist/js/toolbar_notification_setting.js +72 -0
  52. package/dist/js/toolbar_open_actions.js +7 -0
  53. package/dist/js/toolbar_open_effects.js +4 -0
  54. package/dist/js/toolbar_open_signals.js +4 -0
  55. package/dist/js/toolbar_opening.js +65 -0
  56. package/dist/js/toolbar_overlay.js +69 -0
  57. package/dist/js/toolbar_settings.js +44 -0
  58. package/dist/js/toolbar_state_context.js +1 -0
  59. package/dist/js/toolbar_state_effects.js +8 -0
  60. package/dist/js/toolbar_state_signals.js +17 -0
  61. package/dist/js/toolbar_theme_setting.js +13 -0
  62. package/dist/js/toolbar_ui.js +20 -0
  63. package/dist/js/tooltip_actions.js +6 -0
  64. package/dist/js/variant.js +53 -0
  65. package/dist/jsenv_plugin_toolbar.js +3 -6
  66. package/package.json +2 -2
@@ -0,0 +1,316 @@
1
+ var n,
2
+ l,
3
+ u,
4
+ i,
5
+ t,
6
+ o,
7
+ r,
8
+ f = {},
9
+ e = [],
10
+ c = /acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i;
11
+ function s(n, l) {
12
+ for (var u in l) n[u] = l[u];
13
+ return n;
14
+ }
15
+ function a(n) {
16
+ var l = n.parentNode;
17
+ l && l.removeChild(n);
18
+ }
19
+ function h(l, u, i) {
20
+ var t,
21
+ o,
22
+ r,
23
+ f = {};
24
+ for (r in u) "key" == r ? t = u[r] : "ref" == r ? o = u[r] : f[r] = u[r];
25
+ if (arguments.length > 2 && (f.children = arguments.length > 3 ? n.call(arguments, 2) : i), "function" == typeof l && null != l.defaultProps) for (r in l.defaultProps) void 0 === f[r] && (f[r] = l.defaultProps[r]);
26
+ return v(l, f, t, o, null);
27
+ }
28
+ function v(n, i, t, o, r) {
29
+ var f = {
30
+ type: n,
31
+ props: i,
32
+ key: t,
33
+ ref: o,
34
+ __k: null,
35
+ __: null,
36
+ __b: 0,
37
+ __e: null,
38
+ __d: void 0,
39
+ __c: null,
40
+ __h: null,
41
+ constructor: void 0,
42
+ __v: null == r ? ++u : r
43
+ };
44
+ return null == r && null != l.vnode && l.vnode(f), f;
45
+ }
46
+ function y() {
47
+ return {
48
+ current: null
49
+ };
50
+ }
51
+ function p(n) {
52
+ return n.children;
53
+ }
54
+ function d(n, l) {
55
+ this.props = n, this.context = l;
56
+ }
57
+ function _(n, l) {
58
+ if (null == l) return n.__ ? _(n.__, n.__.__k.indexOf(n) + 1) : null;
59
+ for (var u; l < n.__k.length; l++) if (null != (u = n.__k[l]) && null != u.__e) return u.__e;
60
+ return "function" == typeof n.type ? _(n) : null;
61
+ }
62
+ function k(n) {
63
+ var l, u;
64
+ if (null != (n = n.__) && null != n.__c) {
65
+ for (n.__e = n.__c.base = null, l = 0; l < n.__k.length; l++) if (null != (u = n.__k[l]) && null != u.__e) {
66
+ n.__e = n.__c.base = u.__e;
67
+ break;
68
+ }
69
+ return k(n);
70
+ }
71
+ }
72
+ function b(n) {
73
+ (!n.__d && (n.__d = !0) && t.push(n) && !g.__r++ || o !== l.debounceRendering) && ((o = l.debounceRendering) || setTimeout)(g);
74
+ }
75
+ function g() {
76
+ for (var n; g.__r = t.length;) n = t.sort(function (n, l) {
77
+ return n.__v.__b - l.__v.__b;
78
+ }), t = [], n.some(function (n) {
79
+ var l, u, i, t, o, r;
80
+ n.__d && (o = (t = (l = n).__v).__e, (r = l.__P) && (u = [], (i = s({}, t)).__v = t.__v + 1, j(r, t, i, l.__n, void 0 !== r.ownerSVGElement, null != t.__h ? [o] : null, u, null == o ? _(t) : o, t.__h), z(u, t), t.__e != o && k(t)));
81
+ });
82
+ }
83
+ function w(n, l, u, i, t, o, r, c, s, a) {
84
+ var h,
85
+ y,
86
+ d,
87
+ k,
88
+ b,
89
+ g,
90
+ w,
91
+ x = i && i.__k || e,
92
+ C = x.length;
93
+ for (u.__k = [], h = 0; h < l.length; h++) if (null != (k = u.__k[h] = null == (k = l[h]) || "boolean" == typeof k ? null : "string" == typeof k || "number" == typeof k || "bigint" == typeof k ? v(null, k, null, null, k) : Array.isArray(k) ? v(p, {
94
+ children: k
95
+ }, null, null, null) : k.__b > 0 ? v(k.type, k.props, k.key, k.ref ? k.ref : null, k.__v) : k)) {
96
+ if (k.__ = u, k.__b = u.__b + 1, null === (d = x[h]) || d && k.key == d.key && k.type === d.type) x[h] = void 0;else for (y = 0; y < C; y++) {
97
+ if ((d = x[y]) && k.key == d.key && k.type === d.type) {
98
+ x[y] = void 0;
99
+ break;
100
+ }
101
+ d = null;
102
+ }
103
+ j(n, k, d = d || f, t, o, r, c, s, a), b = k.__e, (y = k.ref) && d.ref != y && (w || (w = []), d.ref && w.push(d.ref, null, k), w.push(y, k.__c || b, k)), null != b ? (null == g && (g = b), "function" == typeof k.type && k.__k === d.__k ? k.__d = s = m(k, s, n) : s = A(n, k, d, x, b, s), "function" == typeof u.type && (u.__d = s)) : s && d.__e == s && s.parentNode != n && (s = _(d));
104
+ }
105
+ for (u.__e = g, h = C; h--;) null != x[h] && N(x[h], x[h]);
106
+ if (w) for (h = 0; h < w.length; h++) M(w[h], w[++h], w[++h]);
107
+ }
108
+ function m(n, l, u) {
109
+ for (var i, t = n.__k, o = 0; t && o < t.length; o++) (i = t[o]) && (i.__ = n, l = "function" == typeof i.type ? m(i, l, u) : A(u, i, i, t, i.__e, l));
110
+ return l;
111
+ }
112
+ function x(n, l) {
113
+ return l = l || [], null == n || "boolean" == typeof n || (Array.isArray(n) ? n.some(function (n) {
114
+ x(n, l);
115
+ }) : l.push(n)), l;
116
+ }
117
+ function A(n, l, u, i, t, o) {
118
+ var r, f, e;
119
+ if (void 0 !== l.__d) r = l.__d, l.__d = void 0;else if (null == u || t != o || null == t.parentNode) n: if (null == o || o.parentNode !== n) n.appendChild(t), r = null;else {
120
+ for (f = o, e = 0; (f = f.nextSibling) && e < i.length; e += 1) if (f == t) break n;
121
+ n.insertBefore(t, o), r = o;
122
+ }
123
+ return void 0 !== r ? r : t.nextSibling;
124
+ }
125
+ function C(n, l, u, i, t) {
126
+ var o;
127
+ for (o in u) "children" === o || "key" === o || o in l || H(n, o, null, u[o], i);
128
+ for (o in l) t && "function" != typeof l[o] || "children" === o || "key" === o || "value" === o || "checked" === o || u[o] === l[o] || H(n, o, l[o], u[o], i);
129
+ }
130
+ function $(n, l, u) {
131
+ "-" === l[0] ? n.setProperty(l, u) : n[l] = null == u ? "" : "number" != typeof u || c.test(l) ? u : u + "px";
132
+ }
133
+ function H(n, l, u, i, t) {
134
+ var o;
135
+ n: if ("style" === l) {
136
+ if ("string" == typeof u) n.style.cssText = u;else {
137
+ if ("string" == typeof i && (n.style.cssText = i = ""), i) for (l in i) u && l in u || $(n.style, l, "");
138
+ if (u) for (l in u) i && u[l] === i[l] || $(n.style, l, u[l]);
139
+ }
140
+ } else if ("o" === l[0] && "n" === l[1]) o = l !== (l = l.replace(/Capture$/, "")), l = l.toLowerCase() in n ? l.toLowerCase().slice(2) : l.slice(2), n.l || (n.l = {}), n.l[l + o] = u, u ? i || n.addEventListener(l, o ? T : I, o) : n.removeEventListener(l, o ? T : I, o);else if ("dangerouslySetInnerHTML" !== l) {
141
+ if (t) l = l.replace(/xlink(H|:h)/, "h").replace(/sName$/, "s");else if ("href" !== l && "list" !== l && "form" !== l && "tabIndex" !== l && "download" !== l && l in n) try {
142
+ n[l] = null == u ? "" : u;
143
+ break n;
144
+ } catch (n) {}
145
+ "function" == typeof u || (null == u || !1 === u && -1 == l.indexOf("-") ? n.removeAttribute(l) : n.setAttribute(l, u));
146
+ }
147
+ }
148
+ function I(n) {
149
+ this.l[n.type + !1](l.event ? l.event(n) : n);
150
+ }
151
+ function T(n) {
152
+ this.l[n.type + !0](l.event ? l.event(n) : n);
153
+ }
154
+ function j(n, u, i, t, o, r, f, e, c) {
155
+ var a,
156
+ h,
157
+ v,
158
+ y,
159
+ _,
160
+ k,
161
+ b,
162
+ g,
163
+ m,
164
+ x,
165
+ A,
166
+ C,
167
+ $,
168
+ H,
169
+ I,
170
+ T = u.type;
171
+ if (void 0 !== u.constructor) return null;
172
+ null != i.__h && (c = i.__h, e = u.__e = i.__e, u.__h = null, r = [e]), (a = l.__b) && a(u);
173
+ try {
174
+ n: if ("function" == typeof T) {
175
+ if (g = u.props, m = (a = T.contextType) && t[a.__c], x = a ? m ? m.props.value : a.__ : t, i.__c ? b = (h = u.__c = i.__c).__ = h.__E : ("prototype" in T && T.prototype.render ? u.__c = h = new T(g, x) : (u.__c = h = new d(g, x), h.constructor = T, h.render = O), m && m.sub(h), h.props = g, h.state || (h.state = {}), h.context = x, h.__n = t, v = h.__d = !0, h.__h = [], h._sb = []), null == h.__s && (h.__s = h.state), null != T.getDerivedStateFromProps && (h.__s == h.state && (h.__s = s({}, h.__s)), s(h.__s, T.getDerivedStateFromProps(g, h.__s))), y = h.props, _ = h.state, v) null == T.getDerivedStateFromProps && null != h.componentWillMount && h.componentWillMount(), null != h.componentDidMount && h.__h.push(h.componentDidMount);else {
176
+ if (null == T.getDerivedStateFromProps && g !== y && null != h.componentWillReceiveProps && h.componentWillReceiveProps(g, x), !h.__e && null != h.shouldComponentUpdate && !1 === h.shouldComponentUpdate(g, h.__s, x) || u.__v === i.__v) {
177
+ for (h.props = g, h.state = h.__s, u.__v !== i.__v && (h.__d = !1), h.__v = u, u.__e = i.__e, u.__k = i.__k, u.__k.forEach(function (n) {
178
+ n && (n.__ = u);
179
+ }), A = 0; A < h._sb.length; A++) h.__h.push(h._sb[A]);
180
+ h._sb = [], h.__h.length && f.push(h);
181
+ break n;
182
+ }
183
+ null != h.componentWillUpdate && h.componentWillUpdate(g, h.__s, x), null != h.componentDidUpdate && h.__h.push(function () {
184
+ h.componentDidUpdate(y, _, k);
185
+ });
186
+ }
187
+ if (h.context = x, h.props = g, h.__v = u, h.__P = n, C = l.__r, $ = 0, "prototype" in T && T.prototype.render) {
188
+ for (h.state = h.__s, h.__d = !1, C && C(u), a = h.render(h.props, h.state, h.context), H = 0; H < h._sb.length; H++) h.__h.push(h._sb[H]);
189
+ h._sb = [];
190
+ } else do {
191
+ h.__d = !1, C && C(u), a = h.render(h.props, h.state, h.context), h.state = h.__s;
192
+ } while (h.__d && ++$ < 25);
193
+ h.state = h.__s, null != h.getChildContext && (t = s(s({}, t), h.getChildContext())), v || null == h.getSnapshotBeforeUpdate || (k = h.getSnapshotBeforeUpdate(y, _)), I = null != a && a.type === p && null == a.key ? a.props.children : a, w(n, Array.isArray(I) ? I : [I], u, i, t, o, r, f, e, c), h.base = u.__e, u.__h = null, h.__h.length && f.push(h), b && (h.__E = h.__ = null), h.__e = !1;
194
+ } else null == r && u.__v === i.__v ? (u.__k = i.__k, u.__e = i.__e) : u.__e = L(i.__e, u, i, t, o, r, f, c);
195
+ (a = l.diffed) && a(u);
196
+ } catch (n) {
197
+ u.__v = null, (c || null != r) && (u.__e = e, u.__h = !!c, r[r.indexOf(e)] = null), l.__e(n, u, i);
198
+ }
199
+ }
200
+ function z(n, u) {
201
+ l.__c && l.__c(u, n), n.some(function (u) {
202
+ try {
203
+ n = u.__h, u.__h = [], n.some(function (n) {
204
+ n.call(u);
205
+ });
206
+ } catch (n) {
207
+ l.__e(n, u.__v);
208
+ }
209
+ });
210
+ }
211
+ function L(l, u, i, t, o, r, e, c) {
212
+ var s,
213
+ h,
214
+ v,
215
+ y = i.props,
216
+ p = u.props,
217
+ d = u.type,
218
+ k = 0;
219
+ if ("svg" === d && (o = !0), null != r) for (; k < r.length; k++) if ((s = r[k]) && "setAttribute" in s == !!d && (d ? s.localName === d : 3 === s.nodeType)) {
220
+ l = s, r[k] = null;
221
+ break;
222
+ }
223
+ if (null == l) {
224
+ if (null === d) return document.createTextNode(p);
225
+ l = o ? document.createElementNS("http://www.w3.org/2000/svg", d) : document.createElement(d, p.is && p), r = null, c = !1;
226
+ }
227
+ if (null === d) y === p || c && l.data === p || (l.data = p);else {
228
+ if (r = r && n.call(l.childNodes), h = (y = i.props || f).dangerouslySetInnerHTML, v = p.dangerouslySetInnerHTML, !c) {
229
+ if (null != r) for (y = {}, k = 0; k < l.attributes.length; k++) y[l.attributes[k].name] = l.attributes[k].value;
230
+ (v || h) && (v && (h && v.__html == h.__html || v.__html === l.innerHTML) || (l.innerHTML = v && v.__html || ""));
231
+ }
232
+ if (C(l, p, y, o, c), v) u.__k = [];else if (k = u.props.children, w(l, Array.isArray(k) ? k : [k], u, i, t, o && "foreignObject" !== d, r, e, r ? r[0] : i.__k && _(i, 0), c), null != r) for (k = r.length; k--;) null != r[k] && a(r[k]);
233
+ c || ("value" in p && void 0 !== (k = p.value) && (k !== l.value || "progress" === d && !k || "option" === d && k !== y.value) && H(l, "value", k, y.value, !1), "checked" in p && void 0 !== (k = p.checked) && k !== l.checked && H(l, "checked", k, y.checked, !1));
234
+ }
235
+ return l;
236
+ }
237
+ function M(n, u, i) {
238
+ try {
239
+ "function" == typeof n ? n(u) : n.current = u;
240
+ } catch (n) {
241
+ l.__e(n, i);
242
+ }
243
+ }
244
+ function N(n, u, i) {
245
+ var t, o;
246
+ if (l.unmount && l.unmount(n), (t = n.ref) && (t.current && t.current !== n.__e || M(t, null, u)), null != (t = n.__c)) {
247
+ if (t.componentWillUnmount) try {
248
+ t.componentWillUnmount();
249
+ } catch (n) {
250
+ l.__e(n, u);
251
+ }
252
+ t.base = t.__P = null, n.__c = void 0;
253
+ }
254
+ if (t = n.__k) for (o = 0; o < t.length; o++) t[o] && N(t[o], u, i || "function" != typeof n.type);
255
+ i || null == n.__e || a(n.__e), n.__ = n.__e = n.__d = void 0;
256
+ }
257
+ function O(n, l, u) {
258
+ return this.constructor(n, u);
259
+ }
260
+ function P(u, i, t) {
261
+ var o, r, e;
262
+ l.__ && l.__(u, i), r = (o = "function" == typeof t) ? null : t && t.__k || i.__k, e = [], j(i, u = (!o && t || i).__k = h(p, null, [u]), r || f, f, void 0 !== i.ownerSVGElement, !o && t ? [t] : r ? null : i.firstChild ? n.call(i.childNodes) : null, e, !o && t ? t : r ? r.__e : i.firstChild, o), z(e, u);
263
+ }
264
+ function S(n, l) {
265
+ P(n, l, S);
266
+ }
267
+ function q(l, u, i) {
268
+ var t,
269
+ o,
270
+ r,
271
+ f = s({}, l.props);
272
+ for (r in u) "key" == r ? t = u[r] : "ref" == r ? o = u[r] : f[r] = u[r];
273
+ return arguments.length > 2 && (f.children = arguments.length > 3 ? n.call(arguments, 2) : i), v(l.type, f, t || l.key, o || l.ref, null);
274
+ }
275
+ function B(n, l) {
276
+ var u = {
277
+ __c: l = "__cC" + r++,
278
+ __: n,
279
+ Consumer: function (n, l) {
280
+ return n.children(l);
281
+ },
282
+ Provider: function (n) {
283
+ var u, i;
284
+ return this.getChildContext || (u = [], (i = {})[l] = this, this.getChildContext = function () {
285
+ return i;
286
+ }, this.shouldComponentUpdate = function (n) {
287
+ this.props.value !== n.value && u.some(b);
288
+ }, this.sub = function (n) {
289
+ u.push(n);
290
+ var l = n.componentWillUnmount;
291
+ n.componentWillUnmount = function () {
292
+ u.splice(u.indexOf(n), 1), l && l.call(n);
293
+ };
294
+ }), n.children;
295
+ }
296
+ };
297
+ return u.Provider.__ = u.Consumer.contextType = u;
298
+ }
299
+ n = e.slice, l = {
300
+ __e: function (n, l, u, i) {
301
+ for (var t, o, r; l = l.__;) if ((t = l.__c) && !t.__) try {
302
+ if ((o = t.constructor) && null != o.getDerivedStateFromError && (t.setState(o.getDerivedStateFromError(n)), r = t.__d), null != t.componentDidCatch && (t.componentDidCatch(n, i || {}), r = t.__d), r) return t.__E = t;
303
+ } catch (l) {
304
+ n = l;
305
+ }
306
+ throw n;
307
+ }
308
+ }, u = 0, i = function (n) {
309
+ return null != n && void 0 === n.constructor;
310
+ }, d.prototype.setState = function (n, l) {
311
+ var u;
312
+ u = null != this.__s && this.__s !== this.state ? this.__s : this.__s = s({}, this.state), "function" == typeof n && (n = n(s({}, u), this.props)), n && s(u, n), null != n && this.__v && (l && this._sb.push(l), b(this));
313
+ }, d.prototype.forceUpdate = function (n) {
314
+ this.__v && (this.__e = !0, n && this.__h.push(n), b(this));
315
+ }, d.prototype.render = p, t = [], g.__r = 0, r = 0;
316
+ export { d as Component, p as Fragment, q as cloneElement, B as createContext, h as createElement, y as createRef, h, S as hydrate, i as isValidElement, l as options, P as render, x as toChildArray };
@@ -0,0 +1,104 @@
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
+ // })
@@ -0,0 +1,7 @@
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
+ };
@@ -0,0 +1,9 @@
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
+ });
@@ -0,0 +1,52 @@
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
+ };
@@ -0,0 +1,10 @@
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
+ }
@@ -0,0 +1,7 @@
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
+ };
@@ -0,0 +1,2 @@
1
+ import { signal } from "./signals.mjs";
2
+ export const settingsOpenedSignal = signal(false);