@deck.gl/widgets 8.10.0-alpha.2 → 8.10.0-alpha.5

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/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2020 Urban Computing Foundation
1
+ Copyright Vis.gl contributors.
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining a copy
4
4
  of this software and associated documentation files (the "Software"), to deal
package/dist/dist.dev.js CHANGED
@@ -15,6 +15,10 @@ var __exports__ = (() => {
15
15
  var __commonJS = (cb, mod) => function __require() {
16
16
  return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
17
17
  };
18
+ var __export = (target, all) => {
19
+ for (var name in all)
20
+ __defProp(target, name, { get: all[name], enumerable: true });
21
+ };
18
22
  var __copyProps = (to, from, except, desc) => {
19
23
  if (from && typeof from === "object" || typeof from === "function") {
20
24
  for (let key of __getOwnPropNames(from))
@@ -39,6 +43,13 @@ var __exports__ = (() => {
39
43
 
40
44
  // bundle.ts
41
45
  var bundle_exports = {};
46
+ __export(bundle_exports, {
47
+ DarkGlassTheme: () => DarkGlassTheme,
48
+ DarkTheme: () => DarkTheme,
49
+ FullscreenWidget: () => FullscreenWidget,
50
+ LightGlassTheme: () => LightGlassTheme,
51
+ LightTheme: () => LightTheme
52
+ });
42
53
 
43
54
  // ../core/bundle/peer-dependency.ts
44
55
  var peer_dependency_exports = {};
@@ -50,6 +61,465 @@ var __exports__ = (() => {
50
61
 
51
62
  // bundle.ts
52
63
  __reExport(bundle_exports, peer_dependency_exports);
64
+
65
+ // src/fullscreen-widget.tsx
66
+ var import_core2 = __toESM(require_core());
67
+
68
+ // ../../node_modules/preact/dist/preact.module.js
69
+ var n;
70
+ var l;
71
+ var u;
72
+ var t;
73
+ var i;
74
+ var o;
75
+ var r;
76
+ var f;
77
+ var e;
78
+ var c = {};
79
+ var s = [];
80
+ var a = /acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i;
81
+ var h = Array.isArray;
82
+ function v(n2, l2) {
83
+ for (var u2 in l2)
84
+ n2[u2] = l2[u2];
85
+ return n2;
86
+ }
87
+ function p(n2) {
88
+ var l2 = n2.parentNode;
89
+ l2 && l2.removeChild(n2);
90
+ }
91
+ function y(l2, u2, t2) {
92
+ var i2, o2, r2, f2 = {};
93
+ for (r2 in u2)
94
+ "key" == r2 ? i2 = u2[r2] : "ref" == r2 ? o2 = u2[r2] : f2[r2] = u2[r2];
95
+ if (arguments.length > 2 && (f2.children = arguments.length > 3 ? n.call(arguments, 2) : t2), "function" == typeof l2 && null != l2.defaultProps)
96
+ for (r2 in l2.defaultProps)
97
+ void 0 === f2[r2] && (f2[r2] = l2.defaultProps[r2]);
98
+ return d(l2, f2, i2, o2, null);
99
+ }
100
+ function d(n2, t2, i2, o2, r2) {
101
+ var f2 = { type: n2, props: t2, key: i2, ref: o2, __k: null, __: null, __b: 0, __e: null, __d: void 0, __c: null, __h: null, constructor: void 0, __v: null == r2 ? ++u : r2 };
102
+ return null == r2 && null != l.vnode && l.vnode(f2), f2;
103
+ }
104
+ function k(n2) {
105
+ return n2.children;
106
+ }
107
+ function b(n2, l2) {
108
+ this.props = n2, this.context = l2;
109
+ }
110
+ function g(n2, l2) {
111
+ if (null == l2)
112
+ return n2.__ ? g(n2.__, n2.__.__k.indexOf(n2) + 1) : null;
113
+ for (var u2; l2 < n2.__k.length; l2++)
114
+ if (null != (u2 = n2.__k[l2]) && null != u2.__e)
115
+ return u2.__e;
116
+ return "function" == typeof n2.type ? g(n2) : null;
117
+ }
118
+ function m(n2) {
119
+ var l2, u2;
120
+ if (null != (n2 = n2.__) && null != n2.__c) {
121
+ for (n2.__e = n2.__c.base = null, l2 = 0; l2 < n2.__k.length; l2++)
122
+ if (null != (u2 = n2.__k[l2]) && null != u2.__e) {
123
+ n2.__e = n2.__c.base = u2.__e;
124
+ break;
125
+ }
126
+ return m(n2);
127
+ }
128
+ }
129
+ function w(n2) {
130
+ (!n2.__d && (n2.__d = true) && i.push(n2) && !x.__r++ || o !== l.debounceRendering) && ((o = l.debounceRendering) || r)(x);
131
+ }
132
+ function x() {
133
+ var n2, l2, u2, t2, o2, r2, e2, c2, s2;
134
+ for (i.sort(f); n2 = i.shift(); )
135
+ n2.__d && (l2 = i.length, t2 = void 0, o2 = void 0, r2 = void 0, c2 = (e2 = (u2 = n2).__v).__e, (s2 = u2.__P) && (t2 = [], o2 = [], (r2 = v({}, e2)).__v = e2.__v + 1, L(s2, e2, r2, u2.__n, void 0 !== s2.ownerSVGElement, null != e2.__h ? [c2] : null, t2, null == c2 ? g(e2) : c2, e2.__h, o2), M(t2, e2, o2), e2.__e != c2 && m(e2)), i.length > l2 && i.sort(f));
136
+ x.__r = 0;
137
+ }
138
+ function P(n2, l2, u2, t2, i2, o2, r2, f2, e2, a2, v2) {
139
+ var p2, y2, _, b2, m2, w2, x2, P2, S, H2 = 0, I2 = t2 && t2.__k || s, T2 = I2.length, j2 = T2, z2 = l2.length;
140
+ for (u2.__k = [], p2 = 0; p2 < z2; p2++)
141
+ null != (b2 = u2.__k[p2] = null == (b2 = l2[p2]) || "boolean" == typeof b2 || "function" == typeof b2 ? null : "string" == typeof b2 || "number" == typeof b2 || "bigint" == typeof b2 ? d(null, b2, null, null, b2) : h(b2) ? d(k, { children: b2 }, null, null, null) : b2.__b > 0 ? d(b2.type, b2.props, b2.key, b2.ref ? b2.ref : null, b2.__v) : b2) ? (b2.__ = u2, b2.__b = u2.__b + 1, -1 === (P2 = A(b2, I2, x2 = p2 + H2, j2)) ? _ = c : (_ = I2[P2] || c, I2[P2] = void 0, j2--), L(n2, b2, _, i2, o2, r2, f2, e2, a2, v2), m2 = b2.__e, (y2 = b2.ref) && _.ref != y2 && (_.ref && O(_.ref, null, b2), v2.push(y2, b2.__c || m2, b2)), null != m2 && (null == w2 && (w2 = m2), (S = _ === c || null === _.__v) ? -1 == P2 && H2-- : P2 !== x2 && (P2 === x2 + 1 ? H2++ : P2 > x2 ? j2 > z2 - x2 ? H2 += P2 - x2 : H2-- : H2 = P2 < x2 && P2 == x2 - 1 ? P2 - x2 : 0), x2 = p2 + H2, "function" != typeof b2.type || P2 === x2 && _.__k !== b2.__k ? "function" == typeof b2.type || P2 === x2 && !S ? void 0 !== b2.__d ? (e2 = b2.__d, b2.__d = void 0) : e2 = m2.nextSibling : e2 = $(n2, m2, e2) : e2 = C(b2, e2, n2), "function" == typeof u2.type && (u2.__d = e2))) : (_ = I2[p2]) && null == _.key && _.__e && (_.__e == e2 && (e2 = g(_)), q(_, _, false));
142
+ for (u2.__e = w2, p2 = T2; p2--; )
143
+ null != I2[p2] && ("function" == typeof u2.type && null != I2[p2].__e && I2[p2].__e == u2.__d && (u2.__d = I2[p2].__e.nextSibling), q(I2[p2], I2[p2]));
144
+ }
145
+ function C(n2, l2, u2) {
146
+ for (var t2, i2 = n2.__k, o2 = 0; i2 && o2 < i2.length; o2++)
147
+ (t2 = i2[o2]) && (t2.__ = n2, l2 = "function" == typeof t2.type ? C(t2, l2, u2) : $(u2, t2.__e, l2));
148
+ return l2;
149
+ }
150
+ function $(n2, l2, u2) {
151
+ return null == u2 || u2.parentNode !== n2 ? n2.insertBefore(l2, null) : l2 == u2 && null != l2.parentNode || n2.insertBefore(l2, u2), l2.nextSibling;
152
+ }
153
+ function A(n2, l2, u2, t2) {
154
+ var i2 = n2.key, o2 = n2.type, r2 = u2 - 1, f2 = u2 + 1, e2 = l2[u2];
155
+ if (null === e2 || e2 && i2 == e2.key && o2 === e2.type)
156
+ return u2;
157
+ if (t2 > (null != e2 ? 1 : 0))
158
+ for (; r2 >= 0 || f2 < l2.length; ) {
159
+ if (r2 >= 0) {
160
+ if ((e2 = l2[r2]) && i2 == e2.key && o2 === e2.type)
161
+ return r2;
162
+ r2--;
163
+ }
164
+ if (f2 < l2.length) {
165
+ if ((e2 = l2[f2]) && i2 == e2.key && o2 === e2.type)
166
+ return f2;
167
+ f2++;
168
+ }
169
+ }
170
+ return -1;
171
+ }
172
+ function H(n2, l2, u2, t2, i2) {
173
+ var o2;
174
+ for (o2 in u2)
175
+ "children" === o2 || "key" === o2 || o2 in l2 || T(n2, o2, null, u2[o2], t2);
176
+ for (o2 in l2)
177
+ i2 && "function" != typeof l2[o2] || "children" === o2 || "key" === o2 || "value" === o2 || "checked" === o2 || u2[o2] === l2[o2] || T(n2, o2, l2[o2], u2[o2], t2);
178
+ }
179
+ function I(n2, l2, u2) {
180
+ "-" === l2[0] ? n2.setProperty(l2, null == u2 ? "" : u2) : n2[l2] = null == u2 ? "" : "number" != typeof u2 || a.test(l2) ? u2 : u2 + "px";
181
+ }
182
+ function T(n2, l2, u2, t2, i2) {
183
+ var o2;
184
+ n:
185
+ if ("style" === l2)
186
+ if ("string" == typeof u2)
187
+ n2.style.cssText = u2;
188
+ else {
189
+ if ("string" == typeof t2 && (n2.style.cssText = t2 = ""), t2)
190
+ for (l2 in t2)
191
+ u2 && l2 in u2 || I(n2.style, l2, "");
192
+ if (u2)
193
+ for (l2 in u2)
194
+ t2 && u2[l2] === t2[l2] || I(n2.style, l2, u2[l2]);
195
+ }
196
+ else if ("o" === l2[0] && "n" === l2[1])
197
+ o2 = l2 !== (l2 = l2.replace(/Capture$/, "")), l2 = l2.toLowerCase() in n2 ? l2.toLowerCase().slice(2) : l2.slice(2), n2.l || (n2.l = {}), n2.l[l2 + o2] = u2, u2 ? t2 || n2.addEventListener(l2, o2 ? z : j, o2) : n2.removeEventListener(l2, o2 ? z : j, o2);
198
+ else if ("dangerouslySetInnerHTML" !== l2) {
199
+ if (i2)
200
+ l2 = l2.replace(/xlink(H|:h)/, "h").replace(/sName$/, "s");
201
+ else if ("width" !== l2 && "height" !== l2 && "href" !== l2 && "list" !== l2 && "form" !== l2 && "tabIndex" !== l2 && "download" !== l2 && "rowSpan" !== l2 && "colSpan" !== l2 && l2 in n2)
202
+ try {
203
+ n2[l2] = null == u2 ? "" : u2;
204
+ break n;
205
+ } catch (n3) {
206
+ }
207
+ "function" == typeof u2 || (null == u2 || false === u2 && "-" !== l2[4] ? n2.removeAttribute(l2) : n2.setAttribute(l2, u2));
208
+ }
209
+ }
210
+ function j(n2) {
211
+ return this.l[n2.type + false](l.event ? l.event(n2) : n2);
212
+ }
213
+ function z(n2) {
214
+ return this.l[n2.type + true](l.event ? l.event(n2) : n2);
215
+ }
216
+ function L(n2, u2, t2, i2, o2, r2, f2, e2, c2, s2) {
217
+ var a2, p2, y2, d2, _, g2, m2, w2, x2, C2, S, $2, A2, H2, I2, T2 = u2.type;
218
+ if (void 0 !== u2.constructor)
219
+ return null;
220
+ null != t2.__h && (c2 = t2.__h, e2 = u2.__e = t2.__e, u2.__h = null, r2 = [e2]), (a2 = l.__b) && a2(u2);
221
+ n:
222
+ if ("function" == typeof T2)
223
+ try {
224
+ if (w2 = u2.props, x2 = (a2 = T2.contextType) && i2[a2.__c], C2 = a2 ? x2 ? x2.props.value : a2.__ : i2, t2.__c ? m2 = (p2 = u2.__c = t2.__c).__ = p2.__E : ("prototype" in T2 && T2.prototype.render ? u2.__c = p2 = new T2(w2, C2) : (u2.__c = p2 = new b(w2, C2), p2.constructor = T2, p2.render = B), x2 && x2.sub(p2), p2.props = w2, p2.state || (p2.state = {}), p2.context = C2, p2.__n = i2, y2 = p2.__d = true, p2.__h = [], p2._sb = []), null == p2.__s && (p2.__s = p2.state), null != T2.getDerivedStateFromProps && (p2.__s == p2.state && (p2.__s = v({}, p2.__s)), v(p2.__s, T2.getDerivedStateFromProps(w2, p2.__s))), d2 = p2.props, _ = p2.state, p2.__v = u2, y2)
225
+ null == T2.getDerivedStateFromProps && null != p2.componentWillMount && p2.componentWillMount(), null != p2.componentDidMount && p2.__h.push(p2.componentDidMount);
226
+ else {
227
+ if (null == T2.getDerivedStateFromProps && w2 !== d2 && null != p2.componentWillReceiveProps && p2.componentWillReceiveProps(w2, C2), !p2.__e && (null != p2.shouldComponentUpdate && false === p2.shouldComponentUpdate(w2, p2.__s, C2) || u2.__v === t2.__v)) {
228
+ for (u2.__v !== t2.__v && (p2.props = w2, p2.state = p2.__s, p2.__d = false), u2.__e = t2.__e, u2.__k = t2.__k, u2.__k.forEach(function(n3) {
229
+ n3 && (n3.__ = u2);
230
+ }), S = 0; S < p2._sb.length; S++)
231
+ p2.__h.push(p2._sb[S]);
232
+ p2._sb = [], p2.__h.length && f2.push(p2);
233
+ break n;
234
+ }
235
+ null != p2.componentWillUpdate && p2.componentWillUpdate(w2, p2.__s, C2), null != p2.componentDidUpdate && p2.__h.push(function() {
236
+ p2.componentDidUpdate(d2, _, g2);
237
+ });
238
+ }
239
+ if (p2.context = C2, p2.props = w2, p2.__P = n2, p2.__e = false, $2 = l.__r, A2 = 0, "prototype" in T2 && T2.prototype.render) {
240
+ for (p2.state = p2.__s, p2.__d = false, $2 && $2(u2), a2 = p2.render(p2.props, p2.state, p2.context), H2 = 0; H2 < p2._sb.length; H2++)
241
+ p2.__h.push(p2._sb[H2]);
242
+ p2._sb = [];
243
+ } else
244
+ do {
245
+ p2.__d = false, $2 && $2(u2), a2 = p2.render(p2.props, p2.state, p2.context), p2.state = p2.__s;
246
+ } while (p2.__d && ++A2 < 25);
247
+ p2.state = p2.__s, null != p2.getChildContext && (i2 = v(v({}, i2), p2.getChildContext())), y2 || null == p2.getSnapshotBeforeUpdate || (g2 = p2.getSnapshotBeforeUpdate(d2, _)), P(n2, h(I2 = null != a2 && a2.type === k && null == a2.key ? a2.props.children : a2) ? I2 : [I2], u2, t2, i2, o2, r2, f2, e2, c2, s2), p2.base = u2.__e, u2.__h = null, p2.__h.length && f2.push(p2), m2 && (p2.__E = p2.__ = null);
248
+ } catch (n3) {
249
+ u2.__v = null, (c2 || null != r2) && (u2.__e = e2, u2.__h = !!c2, r2[r2.indexOf(e2)] = null), l.__e(n3, u2, t2);
250
+ }
251
+ else
252
+ null == r2 && u2.__v === t2.__v ? (u2.__k = t2.__k, u2.__e = t2.__e) : u2.__e = N(t2.__e, u2, t2, i2, o2, r2, f2, c2, s2);
253
+ (a2 = l.diffed) && a2(u2);
254
+ }
255
+ function M(n2, u2, t2) {
256
+ for (var i2 = 0; i2 < t2.length; i2++)
257
+ O(t2[i2], t2[++i2], t2[++i2]);
258
+ l.__c && l.__c(u2, n2), n2.some(function(u3) {
259
+ try {
260
+ n2 = u3.__h, u3.__h = [], n2.some(function(n3) {
261
+ n3.call(u3);
262
+ });
263
+ } catch (n3) {
264
+ l.__e(n3, u3.__v);
265
+ }
266
+ });
267
+ }
268
+ function N(l2, u2, t2, i2, o2, r2, f2, e2, s2) {
269
+ var a2, v2, y2, d2 = t2.props, _ = u2.props, k2 = u2.type, b2 = 0;
270
+ if ("svg" === k2 && (o2 = true), null != r2) {
271
+ for (; b2 < r2.length; b2++)
272
+ if ((a2 = r2[b2]) && "setAttribute" in a2 == !!k2 && (k2 ? a2.localName === k2 : 3 === a2.nodeType)) {
273
+ l2 = a2, r2[b2] = null;
274
+ break;
275
+ }
276
+ }
277
+ if (null == l2) {
278
+ if (null === k2)
279
+ return document.createTextNode(_);
280
+ l2 = o2 ? document.createElementNS("http://www.w3.org/2000/svg", k2) : document.createElement(k2, _.is && _), r2 = null, e2 = false;
281
+ }
282
+ if (null === k2)
283
+ d2 === _ || e2 && l2.data === _ || (l2.data = _);
284
+ else {
285
+ if (r2 = r2 && n.call(l2.childNodes), v2 = (d2 = t2.props || c).dangerouslySetInnerHTML, y2 = _.dangerouslySetInnerHTML, !e2) {
286
+ if (null != r2)
287
+ for (d2 = {}, b2 = 0; b2 < l2.attributes.length; b2++)
288
+ d2[l2.attributes[b2].name] = l2.attributes[b2].value;
289
+ (y2 || v2) && (y2 && (v2 && y2.__html == v2.__html || y2.__html === l2.innerHTML) || (l2.innerHTML = y2 && y2.__html || ""));
290
+ }
291
+ if (H(l2, _, d2, o2, e2), y2)
292
+ u2.__k = [];
293
+ else if (P(l2, h(b2 = u2.props.children) ? b2 : [b2], u2, t2, i2, o2 && "foreignObject" !== k2, r2, f2, r2 ? r2[0] : t2.__k && g(t2, 0), e2, s2), null != r2)
294
+ for (b2 = r2.length; b2--; )
295
+ null != r2[b2] && p(r2[b2]);
296
+ e2 || ("value" in _ && void 0 !== (b2 = _.value) && (b2 !== l2.value || "progress" === k2 && !b2 || "option" === k2 && b2 !== d2.value) && T(l2, "value", b2, d2.value, false), "checked" in _ && void 0 !== (b2 = _.checked) && b2 !== l2.checked && T(l2, "checked", b2, d2.checked, false));
297
+ }
298
+ return l2;
299
+ }
300
+ function O(n2, u2, t2) {
301
+ try {
302
+ "function" == typeof n2 ? n2(u2) : n2.current = u2;
303
+ } catch (n3) {
304
+ l.__e(n3, t2);
305
+ }
306
+ }
307
+ function q(n2, u2, t2) {
308
+ var i2, o2;
309
+ if (l.unmount && l.unmount(n2), (i2 = n2.ref) && (i2.current && i2.current !== n2.__e || O(i2, null, u2)), null != (i2 = n2.__c)) {
310
+ if (i2.componentWillUnmount)
311
+ try {
312
+ i2.componentWillUnmount();
313
+ } catch (n3) {
314
+ l.__e(n3, u2);
315
+ }
316
+ i2.base = i2.__P = null, n2.__c = void 0;
317
+ }
318
+ if (i2 = n2.__k)
319
+ for (o2 = 0; o2 < i2.length; o2++)
320
+ i2[o2] && q(i2[o2], u2, t2 || "function" != typeof n2.type);
321
+ t2 || null == n2.__e || p(n2.__e), n2.__ = n2.__e = n2.__d = void 0;
322
+ }
323
+ function B(n2, l2, u2) {
324
+ return this.constructor(n2, u2);
325
+ }
326
+ function D(u2, t2, i2) {
327
+ var o2, r2, f2, e2;
328
+ l.__ && l.__(u2, t2), r2 = (o2 = "function" == typeof i2) ? null : i2 && i2.__k || t2.__k, f2 = [], e2 = [], L(t2, u2 = (!o2 && i2 || t2).__k = y(k, null, [u2]), r2 || c, c, void 0 !== t2.ownerSVGElement, !o2 && i2 ? [i2] : r2 ? null : t2.firstChild ? n.call(t2.childNodes) : null, f2, !o2 && i2 ? i2 : r2 ? r2.__e : t2.firstChild, o2, e2), M(f2, u2, e2);
329
+ }
330
+ n = s.slice, l = { __e: function(n2, l2, u2, t2) {
331
+ for (var i2, o2, r2; l2 = l2.__; )
332
+ if ((i2 = l2.__c) && !i2.__)
333
+ try {
334
+ if ((o2 = i2.constructor) && null != o2.getDerivedStateFromError && (i2.setState(o2.getDerivedStateFromError(n2)), r2 = i2.__d), null != i2.componentDidCatch && (i2.componentDidCatch(n2, t2 || {}), r2 = i2.__d), r2)
335
+ return i2.__E = i2;
336
+ } catch (l3) {
337
+ n2 = l3;
338
+ }
339
+ throw n2;
340
+ } }, u = 0, t = function(n2) {
341
+ return null != n2 && void 0 === n2.constructor;
342
+ }, b.prototype.setState = function(n2, l2) {
343
+ var u2;
344
+ u2 = null != this.__s && this.__s !== this.state ? this.__s : this.__s = v({}, this.state), "function" == typeof n2 && (n2 = n2(v({}, u2), this.props)), n2 && v(u2, n2), null != n2 && this.__v && (l2 && this._sb.push(l2), w(this));
345
+ }, b.prototype.forceUpdate = function(n2) {
346
+ this.__v && (this.__e = true, n2 && this.__h.push(n2), w(this));
347
+ }, b.prototype.render = k, i = [], r = "function" == typeof Promise ? Promise.prototype.then.bind(Promise.resolve()) : setTimeout, f = function(n2, l2) {
348
+ return n2.__v.__b - l2.__v.__b;
349
+ }, x.__r = 0, e = 0;
350
+
351
+ // src/components.tsx
352
+ var IconButton = (props) => {
353
+ const {
354
+ className,
355
+ label,
356
+ onClick
357
+ } = props;
358
+ return React.createElement("div", {
359
+ className: "deck-widget-button-border"
360
+ }, React.createElement("button", {
361
+ className: `deck-widget-button ${className}`,
362
+ type: "button",
363
+ onClick,
364
+ title: label
365
+ }, React.createElement("div", {
366
+ className: "deck-widget-icon"
367
+ })));
368
+ };
369
+
370
+ // src/fullscreen-widget.tsx
371
+ var FullscreenWidget = class {
372
+ id = "fullscreen";
373
+ placement = "top-left";
374
+ fullscreen = false;
375
+ constructor(props) {
376
+ this.id = props.id || "fullscreen";
377
+ this.placement = props.placement || "top-left";
378
+ props.enterLabel = props.enterLabel || "Enter Fullscreen";
379
+ props.exitLabel = props.exitLabel || "Exit Fullscreen";
380
+ props.style = props.style || {};
381
+ this.props = props;
382
+ }
383
+ onAdd({
384
+ deck
385
+ }) {
386
+ const {
387
+ style,
388
+ className
389
+ } = this.props;
390
+ const el = document.createElement("div");
391
+ el.classList.add("deck-widget", "deck-widget-fullscreen");
392
+ if (className)
393
+ el.classList.add(className);
394
+ if (style) {
395
+ Object.entries(style).map(([key, value]) => el.style.setProperty(key, value));
396
+ }
397
+ this.deck = deck;
398
+ this.element = el;
399
+ this.update();
400
+ document.addEventListener("fullscreenchange", this.onFullscreenChange.bind(this));
401
+ return el;
402
+ }
403
+ onRemove() {
404
+ this.deck = void 0;
405
+ this.element = void 0;
406
+ document.removeEventListener("fullscreenchange", this.onFullscreenChange.bind(this));
407
+ }
408
+ update() {
409
+ const {
410
+ enterLabel,
411
+ exitLabel
412
+ } = this.props;
413
+ const el = this.element;
414
+ if (!el) {
415
+ return;
416
+ }
417
+ const ui = React.createElement(IconButton, {
418
+ onClick: this.handleClick.bind(this),
419
+ label: this.fullscreen ? exitLabel : enterLabel,
420
+ className: this.fullscreen ? "deck-widget-fullscreen-exit" : "deck-widget-fullscreen-enter"
421
+ });
422
+ D(ui, el);
423
+ }
424
+ setProps(props) {
425
+ const oldProps = this.props;
426
+ const el = this.element;
427
+ if (el) {
428
+ if (oldProps.className !== props.className) {
429
+ if (oldProps.className)
430
+ el.classList.remove(oldProps.className);
431
+ if (props.className)
432
+ el.classList.add(props.className);
433
+ }
434
+ if (!(0, import_core2._deepEqual)(oldProps.style, props.style, 1)) {
435
+ if (oldProps.style) {
436
+ Object.entries(oldProps.style).map(([key]) => el.style.removeProperty(key));
437
+ }
438
+ if (props.style) {
439
+ Object.entries(props.style).map(([key, value]) => el.style.setProperty(key, value));
440
+ }
441
+ }
442
+ }
443
+ Object.assign(this.props, props);
444
+ }
445
+ getContainer() {
446
+ return this.props.container || this.deck?.getCanvas()?.parentElement;
447
+ }
448
+ onFullscreenChange() {
449
+ const prevFullscreen = this.fullscreen;
450
+ const fullscreen = document.fullscreenElement === this.getContainer();
451
+ if (prevFullscreen !== fullscreen) {
452
+ this.fullscreen = !this.fullscreen;
453
+ }
454
+ this.update();
455
+ }
456
+ async handleClick() {
457
+ if (this.fullscreen) {
458
+ await this.exitFullscreen();
459
+ } else {
460
+ await this.requestFullscreen();
461
+ }
462
+ this.update();
463
+ }
464
+ async requestFullscreen() {
465
+ const container = this.getContainer();
466
+ if (container?.requestFullscreen) {
467
+ await container.requestFullscreen({
468
+ navigationUI: "hide"
469
+ });
470
+ } else {
471
+ this.togglePseudoFullscreen();
472
+ }
473
+ }
474
+ async exitFullscreen() {
475
+ if (document.exitFullscreen) {
476
+ await document.exitFullscreen();
477
+ } else {
478
+ this.togglePseudoFullscreen();
479
+ }
480
+ }
481
+ togglePseudoFullscreen() {
482
+ this.getContainer()?.classList.toggle("deck-pseudo-fullscreen");
483
+ }
484
+ };
485
+
486
+ // src/themes.ts
487
+ var LightTheme = {
488
+ "--button-background": "#fff",
489
+ "--button-stroke": "rgba(255, 255, 255, 0.3)",
490
+ "--button-inner-stroke": "unset",
491
+ "--button-shadow": "0px 0px 8px 0px rgba(0, 0, 0, 0.25)",
492
+ "--button-backdrop-filter": "unset",
493
+ "--button-icon-idle": "rgba(97, 97, 102, 1)",
494
+ "--button-icon-hover": "rgba(24, 24, 26, 1)"
495
+ };
496
+ var DarkTheme = {
497
+ "--button-background": "rgba(18, 18, 20, 1)",
498
+ "--button-stroke": "rgba(18, 18, 20, 0.30)",
499
+ "--button-inner-stroke": "unset",
500
+ "--button-shadow": "0px 0px 8px 0px rgba(0, 0, 0, 0.25)",
501
+ "--button-backdrop-filter": "unset",
502
+ "--button-icon-idle": "rgba(158, 157, 168, 1)",
503
+ "--button-icon-hover": "rgba(215, 214, 229, 1)"
504
+ };
505
+ var LightGlassTheme = {
506
+ "--button-background": "rgba(255, 255, 255, 0.6)",
507
+ "--button-stroke": "rgba(255, 255, 255, 0.3)",
508
+ "--button-inner-stroke": "1px solid rgba(255, 255, 255, 0.6)",
509
+ "--button-shadow": "0px 0px 8px 0px rgba(0, 0, 0, 0.25), 0px 0px 8px 0px rgba(0, 0, 0, 0.1) inset",
510
+ "--button-backdrop-filter": "blur(4px)",
511
+ "--button-icon-idle": "rgba(97, 97, 102, 1)",
512
+ "--button-icon-hover": "rgba(24, 24, 26, 1)"
513
+ };
514
+ var DarkGlassTheme = {
515
+ "--button-background": "rgba(18, 18, 20, 0.75)",
516
+ "--button-stroke": "rgba(18, 18, 20, 0.30)",
517
+ "--button-inner-stroke": "1px solid rgba(18, 18, 20, 0.75)",
518
+ "--button-shadow": "0px 0px 8px 0px rgba(0, 0, 0, 0.25), 0px 0px 8px 0px rgba(0, 0, 0, 0.1) inset",
519
+ "--button-backdrop-filter": "blur(4px)",
520
+ "--button-icon-idle": "rgba(158, 157, 168, 1)",
521
+ "--button-icon-hover": "rgba(215, 214, 229, 1)"
522
+ };
53
523
  return __toCommonJS(bundle_exports);
54
524
  })();
55
525
  return __exports__;
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.IconButton = void 0;
7
+
8
+ var _preact = require("preact");
9
+
10
+ var IconButton = function IconButton(props) {
11
+ var className = props.className,
12
+ label = props.label,
13
+ onClick = props.onClick;
14
+ return (0, _preact.h)("div", {
15
+ className: "deck-widget-button-border"
16
+ }, (0, _preact.h)("button", {
17
+ className: "deck-widget-button ".concat(className),
18
+ type: "button",
19
+ onClick: onClick,
20
+ title: label
21
+ }, (0, _preact.h)("div", {
22
+ className: "deck-widget-icon"
23
+ })));
24
+ };
25
+
26
+ exports.IconButton = IconButton;
27
+ //# sourceMappingURL=components.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/components.tsx"],"names":["IconButton","props","className","label","onClick"],"mappings":";;;;;;;AAAA;;AAEO,IAAMA,UAAU,GAAG,SAAbA,UAAa,CAAAC,KAAK,EAAI;AACjC,MAAOC,SAAP,GAAoCD,KAApC,CAAOC,SAAP;AAAA,MAAkBC,KAAlB,GAAoCF,KAApC,CAAkBE,KAAlB;AAAA,MAAyBC,OAAzB,GAAoCH,KAApC,CAAyBG,OAAzB;AACA,SACE;AAAK,IAAA,SAAS,EAAC;AAAf,KACE;AACE,IAAA,SAAS,+BAAwBF,SAAxB,CADX;AAEE,IAAA,IAAI,EAAC,QAFP;AAGE,IAAA,OAAO,EAAEE,OAHX;AAIE,IAAA,KAAK,EAAED;AAJT,KAME;AAAK,IAAA,SAAS,EAAC;AAAf,IANF,CADF,CADF;AAYD,CAdM","sourcesContent":["import {h, render} from 'preact';\n\nexport const IconButton = props => {\n const {className, label, onClick} = props;\n return (\n <div className=\"deck-widget-button-border\">\n <button\n className={`deck-widget-button ${className}`}\n type=\"button\"\n onClick={onClick}\n title={label}\n >\n <div className=\"deck-widget-icon\" />\n </button>\n </div>\n );\n};\n"],"file":"components.js"}