@appkit/dek-lib 0.1.0 → 0.2.0

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.es.js CHANGED
@@ -982,7 +982,7 @@ var wr$1 = { exports: {} };
982
982
  wr$1.exports;
983
983
  (function(d, w2) {
984
984
  (function() {
985
- var o3, R = "4.17.21", O2 = 200, E2 = "Unsupported core-js use. Try https://npms.io/search?q=ponyfill.", T = "Expected a function", X10 = "Invalid `variable` option passed into `_.template`", en2 = "__lodash_hash_undefined__", y2 = 500, K = "__lodash_placeholder__", W = 1, $10 = 2, z = 4, Z10 = 1, N = 2, V10 = 1, j = 2, he2 = 4, Y = 8, Q = 16, un2 = 32, sn2 = 64, gn2 = 128, Tn2 = 256, C = 512, B2 = 30, D10 = "...", An2 = 800, ge2 = 16, pe2 = 1, Be2 = 2, Vn2 = 3, me2 = 1 / 0, _e2 = 9007199254740991, Ko2 = 17976931348623157e292, Et2 = 0 / 0, Qn2 = 4294967295, $o2 = Qn2 - 1, qo2 = Qn2 >>> 1, zo2 = [
985
+ var o3, O2 = "4.17.21", E2 = 200, R = "Unsupported core-js use. Try https://npms.io/search?q=ponyfill.", T = "Expected a function", X10 = "Invalid `variable` option passed into `_.template`", en2 = "__lodash_hash_undefined__", y2 = 500, K = "__lodash_placeholder__", W = 1, $10 = 2, z = 4, Z10 = 1, N = 2, V10 = 1, j = 2, he2 = 4, Y = 8, Q = 16, un2 = 32, sn2 = 64, gn2 = 128, Tn2 = 256, C = 512, B2 = 30, D10 = "...", An2 = 800, ge2 = 16, pe2 = 1, Be2 = 2, Vn2 = 3, me2 = 1 / 0, _e2 = 9007199254740991, Ko2 = 17976931348623157e292, Et2 = 0 / 0, Qn2 = 4294967295, $o2 = Qn2 - 1, qo2 = Qn2 >>> 1, zo2 = [
986
986
  ["ary", gn2],
987
987
  ["bind", V10],
988
988
  ["bindKey", j],
@@ -1770,7 +1770,7 @@ wr$1.exports;
1770
1770
  var t10 = this.__data__;
1771
1771
  if (t10 instanceof re2) {
1772
1772
  var r10 = t10.__data__;
1773
- if (!st2 || r10.length < O2 - 1)
1773
+ if (!st2 || r10.length < E2 - 1)
1774
1774
  return r10.push([n10, e2]), this.size = ++t10.size, this;
1775
1775
  t10 = this.__data__ = new ie2(r10);
1776
1776
  }
@@ -1902,7 +1902,7 @@ wr$1.exports;
1902
1902
  var i2 = -1, f10 = bt2, s2 = true, l2 = n10.length, c3 = [], p10 = e2.length;
1903
1903
  if (!l2)
1904
1904
  return c3;
1905
- t10 && (e2 = on2(e2, bn2(t10))), r10 ? (f10 = Ur2, s2 = false) : e2.length >= O2 && (f10 = ft2, s2 = false, e2 = new Ce2(e2));
1905
+ t10 && (e2 = on2(e2, bn2(t10))), r10 ? (f10 = Ur2, s2 = false) : e2.length >= E2 && (f10 = ft2, s2 = false, e2 = new Ce2(e2));
1906
1906
  n:
1907
1907
  for (; ++i2 < l2; ) {
1908
1908
  var _10 = n10[i2], v = t10 == null ? _10 : t10(_10);
@@ -2336,7 +2336,7 @@ wr$1.exports;
2336
2336
  var r10 = -1, i2 = bt2, f10 = n10.length, s2 = true, l2 = [], c3 = l2;
2337
2337
  if (t10)
2338
2338
  s2 = false, i2 = Ur2;
2339
- else if (f10 >= O2) {
2339
+ else if (f10 >= E2) {
2340
2340
  var p10 = e2 ? null : ja2(n10);
2341
2341
  if (p10)
2342
2342
  return Dt2(p10);
@@ -3936,7 +3936,7 @@ wr$1.exports;
3936
3936
  }
3937
3937
  function Tg2(n10) {
3938
3938
  if (hc2(n10))
3939
- throw new b10(E2);
3939
+ throw new b10(R);
3940
3940
  return nf2(n10);
3941
3941
  }
3942
3942
  function Cg2(n10) {
@@ -4551,7 +4551,7 @@ function print() { __p += __j.call(arguments, '') }
4551
4551
  return kn2(u2, function(e2, t10) {
4552
4552
  nn2.call(u2.prototype, t10) || (n10[t10] = e2);
4553
4553
  }), n10;
4554
- }(), { chain: false }), u2.VERSION = R, Un2(["bind", "bindKey", "curry", "curryRight", "partial", "partialRight"], function(n10) {
4554
+ }(), { chain: false }), u2.VERSION = O2, Un2(["bind", "bindKey", "curry", "curryRight", "partial", "partialRight"], function(n10) {
4555
4555
  u2[n10].placeholder = u2;
4556
4556
  }), Un2(["drop", "take"], function(n10, e2) {
4557
4557
  H.prototype[n10] = function(t10) {
@@ -4655,16 +4655,16 @@ const $i$1 = Object.getPrototypeOf, qi$1 = /* @__PURE__ */ new WeakMap(), Bo$1 =
4655
4655
  return Object.values(w2).forEach((o3) => {
4656
4656
  o3.configurable = true;
4657
4657
  }), Object.create($i$1(d), w2);
4658
- }, Uo$1 = (d) => d[Zi$1] || d, Fo$1 = (d, w2, o3, R) => {
4658
+ }, Uo$1 = (d) => d[Zi$1] || d, Fo$1 = (d, w2, o3, O2) => {
4659
4659
  if (!Bo$1(d))
4660
4660
  return d;
4661
- let O2 = R && R.get(d);
4662
- if (!O2) {
4661
+ let E2 = O2 && O2.get(d);
4662
+ if (!E2) {
4663
4663
  const en2 = Uo$1(d);
4664
- O2 = ((y2) => Object.values(Object.getOwnPropertyDescriptors(y2)).some((K) => !K.configurable && !K.writable))(en2) ? [en2, G_$1(en2)] : [en2], R == null || R.set(d, O2);
4664
+ E2 = ((y2) => Object.values(Object.getOwnPropertyDescriptors(y2)).some((K) => !K.configurable && !K.writable))(en2) ? [en2, G_$1(en2)] : [en2], O2 == null || O2.set(d, E2);
4665
4665
  }
4666
- const [E2, T] = O2;
4667
- let X10 = o3 && o3.get(E2);
4666
+ const [R, T] = E2;
4667
+ let X10 = o3 && o3.get(R);
4668
4668
  return X10 && X10[1].f === !!T || (X10 = ((en2, y2) => {
4669
4669
  const K = { f: y2 };
4670
4670
  let W = false;
@@ -4680,47 +4680,47 @@ const $i$1 = Object.getPrototypeOf, qi$1 = /* @__PURE__ */ new WeakMap(), Bo$1 =
4680
4680
  }
4681
4681
  }, z = { get: (Z10, N) => N === Zi$1 ? en2 : ($10("k", N), Fo$1(Reflect.get(Z10, N), K[yt$1], K.c, K.t)), has: (Z10, N) => N === F_$1 ? (W = true, K[yt$1].delete(en2), true) : ($10("h", N), Reflect.has(Z10, N)), getOwnPropertyDescriptor: (Z10, N) => ($10("o", N), Reflect.getOwnPropertyDescriptor(Z10, N)), ownKeys: (Z10) => ($10(vr$1), Reflect.ownKeys(Z10)) };
4682
4682
  return y2 && (z.set = z.deleteProperty = () => false), [z, K];
4683
- })(E2, !!T), X10[1].p = N_$1(T || E2, X10[0]), o3 && o3.set(E2, X10)), X10[1][yt$1] = w2, X10[1].c = o3, X10[1].t = R, X10[1].p;
4684
- }, No$1 = (d, w2, o3, R) => {
4683
+ })(R, !!T), X10[1].p = N_$1(T || R, X10[0]), o3 && o3.set(R, X10)), X10[1][yt$1] = w2, X10[1].c = o3, X10[1].t = O2, X10[1].p;
4684
+ }, No$1 = (d, w2, o3, O2) => {
4685
4685
  if (Object.is(d, w2))
4686
4686
  return false;
4687
4687
  if (!To$1(d) || !To$1(w2))
4688
4688
  return true;
4689
- const O2 = o3.get(Uo$1(d));
4690
- if (!O2)
4689
+ const E2 = o3.get(Uo$1(d));
4690
+ if (!E2)
4691
4691
  return true;
4692
- if (R) {
4693
- const T = R.get(d);
4692
+ if (O2) {
4693
+ const T = O2.get(d);
4694
4694
  if (T && T.n === w2)
4695
4695
  return T.g;
4696
- R.set(d, { n: w2, g: false });
4696
+ O2.set(d, { n: w2, g: false });
4697
4697
  }
4698
- let E2 = null;
4698
+ let R = null;
4699
4699
  try {
4700
- for (const T of O2.h || [])
4701
- if (E2 = Reflect.has(d, T) !== Reflect.has(w2, T), E2)
4702
- return E2;
4703
- if (O2[vr$1] === true) {
4704
- if (E2 = ((T, X10) => {
4700
+ for (const T of E2.h || [])
4701
+ if (R = Reflect.has(d, T) !== Reflect.has(w2, T), R)
4702
+ return R;
4703
+ if (E2[vr$1] === true) {
4704
+ if (R = ((T, X10) => {
4705
4705
  const en2 = Reflect.ownKeys(T), y2 = Reflect.ownKeys(X10);
4706
4706
  return en2.length !== y2.length || en2.some((K, W) => K !== y2[W]);
4707
- })(d, w2), E2)
4708
- return E2;
4707
+ })(d, w2), R)
4708
+ return R;
4709
4709
  } else
4710
- for (const T of O2.o || [])
4711
- if (E2 = !!Reflect.getOwnPropertyDescriptor(d, T) != !!Reflect.getOwnPropertyDescriptor(w2, T), E2)
4712
- return E2;
4713
- for (const T of O2.k || [])
4714
- if (E2 = No$1(d[T], w2[T], o3, R), E2)
4715
- return E2;
4716
- return E2 === null && (E2 = true), E2;
4710
+ for (const T of E2.o || [])
4711
+ if (R = !!Reflect.getOwnPropertyDescriptor(d, T) != !!Reflect.getOwnPropertyDescriptor(w2, T), R)
4712
+ return R;
4713
+ for (const T of E2.k || [])
4714
+ if (R = No$1(d[T], w2[T], o3, O2), R)
4715
+ return R;
4716
+ return R === null && (R = true), R;
4717
4717
  } finally {
4718
- R && R.set(d, { n: w2, g: E2 });
4718
+ O2 && O2.set(d, { n: w2, g: R });
4719
4719
  }
4720
4720
  }, H_$1 = (d) => Bo$1(d) && d[Zi$1] || null, Co$1 = (d, w2 = true) => {
4721
4721
  qi$1.set(d, w2);
4722
4722
  };
4723
- const Gi$1 = (d) => typeof d == "object" && d !== null, Oe$1 = /* @__PURE__ */ new WeakMap(), dr$1 = /* @__PURE__ */ new WeakSet(), K_$1 = (d = Object.is, w2 = (y2, K) => new Proxy(y2, K), o3 = (y2) => Gi$1(y2) && !dr$1.has(y2) && (Array.isArray(y2) || !(Symbol.iterator in y2)) && !(y2 instanceof WeakMap) && !(y2 instanceof WeakSet) && !(y2 instanceof Error) && !(y2 instanceof Number) && !(y2 instanceof Date) && !(y2 instanceof String) && !(y2 instanceof RegExp) && !(y2 instanceof ArrayBuffer), R = (y2) => {
4723
+ const Gi$1 = (d) => typeof d == "object" && d !== null, Oe$1 = /* @__PURE__ */ new WeakMap(), dr$1 = /* @__PURE__ */ new WeakSet(), K_$1 = (d = Object.is, w2 = (y2, K) => new Proxy(y2, K), o3 = (y2) => Gi$1(y2) && !dr$1.has(y2) && (Array.isArray(y2) || !(Symbol.iterator in y2)) && !(y2 instanceof WeakMap) && !(y2 instanceof WeakSet) && !(y2 instanceof Error) && !(y2 instanceof Number) && !(y2 instanceof Date) && !(y2 instanceof String) && !(y2 instanceof RegExp) && !(y2 instanceof ArrayBuffer), O2 = (y2) => {
4724
4724
  switch (y2.status) {
4725
4725
  case "fulfilled":
4726
4726
  return y2.value;
@@ -4729,12 +4729,12 @@ const Gi$1 = (d) => typeof d == "object" && d !== null, Oe$1 = /* @__PURE__ */ n
4729
4729
  default:
4730
4730
  throw y2;
4731
4731
  }
4732
- }, O2 = /* @__PURE__ */ new WeakMap(), E2 = (y2, K, W = R) => {
4733
- const $10 = O2.get(y2);
4732
+ }, E2 = /* @__PURE__ */ new WeakMap(), R = (y2, K, W = O2) => {
4733
+ const $10 = E2.get(y2);
4734
4734
  if (($10 == null ? void 0 : $10[0]) === K)
4735
4735
  return $10[1];
4736
4736
  const z = Array.isArray(y2) ? [] : Object.create(Object.getPrototypeOf(y2));
4737
- return Co$1(z, true), O2.set(y2, [K, z]), Reflect.ownKeys(y2).forEach((Z10) => {
4737
+ return Co$1(z, true), E2.set(y2, [K, z]), Reflect.ownKeys(y2).forEach((Z10) => {
4738
4738
  if (Object.getOwnPropertyDescriptor(z, Z10))
4739
4739
  return;
4740
4740
  const N = Reflect.get(y2, Z10), { enumerable: V10 } = Reflect.getOwnPropertyDescriptor(
@@ -4755,7 +4755,7 @@ const Gi$1 = (d) => typeof d == "object" && d !== null, Oe$1 = /* @__PURE__ */ n
4755
4755
  const [he2, Y] = Oe$1.get(
4756
4756
  N
4757
4757
  );
4758
- j.value = E2(
4758
+ j.value = R(
4759
4759
  he2,
4760
4760
  Y(),
4761
4761
  W
@@ -4828,7 +4828,7 @@ const Gi$1 = (d) => typeof d == "object" && d !== null, Oe$1 = /* @__PURE__ */ n
4828
4828
  const Tn2 = [
4829
4829
  un2,
4830
4830
  N,
4831
- E2,
4831
+ R,
4832
4832
  Q
4833
4833
  ];
4834
4834
  return Oe$1.set(gn2, Tn2), Reflect.ownKeys(y2).forEach((C) => {
@@ -4848,9 +4848,9 @@ const Gi$1 = (d) => typeof d == "object" && d !== null, Oe$1 = /* @__PURE__ */ n
4848
4848
  d,
4849
4849
  w2,
4850
4850
  o3,
4851
- R,
4852
4851
  O2,
4853
4852
  E2,
4853
+ R,
4854
4854
  T,
4855
4855
  X10
4856
4856
  ], [$_$1] = K_$1();
@@ -4858,17 +4858,17 @@ function q_$1(d = {}) {
4858
4858
  return $_$1(d);
4859
4859
  }
4860
4860
  function Go$1(d, w2, o3) {
4861
- const R = Oe$1.get(d);
4862
- let O2;
4863
- const E2 = [], T = R[3];
4861
+ const O2 = Oe$1.get(d);
4862
+ let E2;
4863
+ const R = [], T = O2[3];
4864
4864
  let X10 = false;
4865
4865
  const y2 = T((K) => {
4866
- if (E2.push(K), o3) {
4867
- w2(E2.splice(0));
4866
+ if (R.push(K), o3) {
4867
+ w2(R.splice(0));
4868
4868
  return;
4869
4869
  }
4870
- O2 || (O2 = Promise.resolve().then(() => {
4871
- O2 = void 0, X10 && w2(E2.splice(0));
4870
+ E2 || (E2 = Promise.resolve().then(() => {
4871
+ E2 = void 0, X10 && w2(R.splice(0));
4872
4872
  }));
4873
4873
  });
4874
4874
  return X10 = true, () => {
@@ -4876,8 +4876,8 @@ function Go$1(d, w2, o3) {
4876
4876
  };
4877
4877
  }
4878
4878
  function bo$1(d, w2) {
4879
- const o3 = Oe$1.get(d), [R, O2, E2] = o3;
4880
- return E2(R, O2(), w2);
4879
+ const o3 = Oe$1.get(d), [O2, E2, R] = o3;
4880
+ return R(O2, E2(), w2);
4881
4881
  }
4882
4882
  var zi$1 = { exports: {} }, Hi$1 = {};
4883
4883
  /**
@@ -4898,12 +4898,12 @@ function z_$1() {
4898
4898
  function w2(W, $10) {
4899
4899
  return W === $10 && (W !== 0 || 1 / W === 1 / $10) || W !== W && $10 !== $10;
4900
4900
  }
4901
- var o3 = typeof Object.is == "function" ? Object.is : w2, R = d.useState, O2 = d.useEffect, E2 = d.useLayoutEffect, T = d.useDebugValue;
4901
+ var o3 = typeof Object.is == "function" ? Object.is : w2, O2 = d.useState, E2 = d.useEffect, R = d.useLayoutEffect, T = d.useDebugValue;
4902
4902
  function X10(W, $10) {
4903
- var z = $10(), Z10 = R({ inst: { value: z, getSnapshot: $10 } }), N = Z10[0].inst, V10 = Z10[1];
4904
- return E2(function() {
4903
+ var z = $10(), Z10 = O2({ inst: { value: z, getSnapshot: $10 } }), N = Z10[0].inst, V10 = Z10[1];
4904
+ return R(function() {
4905
4905
  N.value = z, N.getSnapshot = $10, en2(N) && V10({ inst: N });
4906
- }, [W, z, $10]), O2(function() {
4906
+ }, [W, z, $10]), E2(function() {
4907
4907
  return en2(N) && V10({ inst: N }), W(function() {
4908
4908
  en2(N) && V10({ inst: N });
4909
4909
  });
@@ -4944,10 +4944,10 @@ function Y_$1() {
4944
4944
  {
4945
4945
  for (var Q = arguments.length, un2 = new Array(Q > 1 ? Q - 1 : 0), sn2 = 1; sn2 < Q; sn2++)
4946
4946
  un2[sn2 - 1] = arguments[sn2];
4947
- R("error", Y, un2);
4947
+ O2("error", Y, un2);
4948
4948
  }
4949
4949
  }
4950
- function R(Y, Q, un2) {
4950
+ function O2(Y, Q, un2) {
4951
4951
  {
4952
4952
  var sn2 = w2.ReactDebugCurrentFrame, gn2 = sn2.getStackAddendum();
4953
4953
  gn2 !== "" && (Q += "%s", un2 = un2.concat([gn2]));
@@ -4957,16 +4957,16 @@ function Y_$1() {
4957
4957
  Tn2.unshift("Warning: " + Q), Function.prototype.apply.call(console[Y], console, Tn2);
4958
4958
  }
4959
4959
  }
4960
- function O2(Y, Q) {
4960
+ function E2(Y, Q) {
4961
4961
  return Y === Q && (Y !== 0 || 1 / Y === 1 / Q) || Y !== Y && Q !== Q;
4962
4962
  }
4963
- var E2 = typeof Object.is == "function" ? Object.is : O2, T = d.useState, X10 = d.useEffect, en2 = d.useLayoutEffect, y2 = d.useDebugValue, K = false, W = false;
4963
+ var R = typeof Object.is == "function" ? Object.is : E2, T = d.useState, X10 = d.useEffect, en2 = d.useLayoutEffect, y2 = d.useDebugValue, K = false, W = false;
4964
4964
  function $10(Y, Q, un2) {
4965
4965
  K || d.startTransition !== void 0 && (K = true, o3("You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."));
4966
4966
  var sn2 = Q();
4967
4967
  if (!W) {
4968
4968
  var gn2 = Q();
4969
- E2(sn2, gn2) || (o3("The result of getSnapshot should be cached to avoid an infinite loop"), W = true);
4969
+ R(sn2, gn2) || (o3("The result of getSnapshot should be cached to avoid an infinite loop"), W = true);
4970
4970
  }
4971
4971
  var Tn2 = T({
4972
4972
  inst: {
@@ -4994,7 +4994,7 @@ function Y_$1() {
4994
4994
  var Q = Y.getSnapshot, un2 = Y.value;
4995
4995
  try {
4996
4996
  var sn2 = Q();
4997
- return !E2(un2, sn2);
4997
+ return !R(un2, sn2);
4998
4998
  } catch {
4999
4999
  return true;
5000
5000
  }
@@ -5011,8 +5011,8 @@ var Z_$1 = zi$1.exports;
5011
5011
  const X_$1 = /* @__PURE__ */ Mo$1(Z_$1), { use: Wo$1 } = React__default, { useSyncExternalStore: J_$1 } = X_$1;
5012
5012
  const V_$1 = /* @__PURE__ */ new WeakMap();
5013
5013
  function Ho$1(d, w2) {
5014
- const o3 = w2 == null ? void 0 : w2.sync, R = useRef$1(), O2 = useRef$1();
5015
- let E2 = true;
5014
+ const o3 = w2 == null ? void 0 : w2.sync, O2 = useRef$1(), E2 = useRef$1();
5015
+ let R = true;
5016
5016
  const T = J_$1(
5017
5017
  useCallback(
5018
5018
  (y2) => {
@@ -5024,23 +5024,23 @@ function Ho$1(d, w2) {
5024
5024
  () => {
5025
5025
  const y2 = bo$1(d, Wo$1);
5026
5026
  try {
5027
- if (!E2 && R.current && O2.current && !No$1(
5028
- R.current,
5029
- y2,
5027
+ if (!R && O2.current && E2.current && !No$1(
5030
5028
  O2.current,
5029
+ y2,
5030
+ E2.current,
5031
5031
  /* @__PURE__ */ new WeakMap()
5032
5032
  ))
5033
- return R.current;
5033
+ return O2.current;
5034
5034
  } catch {
5035
5035
  }
5036
5036
  return y2;
5037
5037
  },
5038
5038
  () => bo$1(d, Wo$1)
5039
5039
  );
5040
- E2 = false;
5040
+ R = false;
5041
5041
  const X10 = /* @__PURE__ */ new WeakMap();
5042
5042
  useEffect$1(() => {
5043
- R.current = T, O2.current = X10;
5043
+ O2.current = T, E2.current = X10;
5044
5044
  });
5045
5045
  const en2 = useMemo(() => /* @__PURE__ */ new WeakMap(), []);
5046
5046
  return Fo$1(
@@ -5061,8 +5061,8 @@ function k_$1() {
5061
5061
  localStorage.setItem("api", JSON.stringify(ee$1));
5062
5062
  }
5063
5063
  function j_$1(d, w2, o3) {
5064
- const R = ee$1[d] || {};
5065
- R[w2] = o3, ee$1[d] = U_$1.cloneDeep(R);
5064
+ const O2 = ee$1[d] || {};
5065
+ O2[w2] = o3, ee$1[d] = U_$1.cloneDeep(O2);
5066
5066
  }
5067
5067
  function n0$1(d, w2) {
5068
5068
  if (ee$1[d])
@@ -5101,7 +5101,9 @@ let e0$1 = class e0 {
5101
5101
  return this.globals.boards;
5102
5102
  }
5103
5103
  get board() {
5104
- return this.boards.find((w2) => w2.key === this.boardKey) || {};
5104
+ return this.boards.find((w2) => w2.key === this.boardKey) || {
5105
+ zones: []
5106
+ };
5105
5107
  }
5106
5108
  get layout() {
5107
5109
  return this.board.layout || "<Screen><Text>Missing layout</Text></Screen>";
@@ -5119,17 +5121,21 @@ let e0$1 = class e0 {
5119
5121
  this.globals.setLocation(`/${w2}`);
5120
5122
  }
5121
5123
  createPluginWrapper(w2) {
5122
- const o3 = this.getPluginInstance(w2), R = !!o3;
5124
+ const o3 = this.getPluginInstance(w2), O2 = !!o3;
5123
5125
  return {
5124
- available: R,
5125
- component: (O2, E2) => this.getComponent(w2, O2, E2),
5126
- screen: (O2) => this.getScreen(w2, O2),
5127
- board: (O2) => this.getBoard(w2, O2),
5126
+ available: O2,
5127
+ info: {
5128
+ components: o3 != null && o3.components ? o3.components.map((E2) => E2.key) : [],
5129
+ screens: o3 != null && o3.screens ? o3.screens.map((E2) => E2.path) : []
5130
+ },
5131
+ component: (E2, R) => this.getComponent(w2, E2, R),
5132
+ screen: (E2) => this.getScreen(w2, E2),
5133
+ board: (E2) => this.getBoard(w2, E2),
5128
5134
  api: (o3 == null ? void 0 : o3.api) || {},
5129
5135
  state: {
5130
- get: (O2, E2) => R && n0$1(w2, O2) || E2,
5131
- set: (O2, E2) => {
5132
- R && j_$1(w2, O2, E2);
5136
+ get: (E2, R) => O2 && n0$1(w2, E2) || R,
5137
+ set: (E2, R) => {
5138
+ O2 && j_$1(w2, E2, R);
5133
5139
  }
5134
5140
  }
5135
5141
  };
@@ -5146,34 +5152,34 @@ let e0$1 = class e0 {
5146
5152
  getPluginInstance(w2) {
5147
5153
  return this.globals.pluginInstances[w2];
5148
5154
  }
5149
- getComponent(w2, o3, R) {
5150
- const O2 = this.getPluginInstance(w2);
5151
- if (O2) {
5152
- const E2 = O2.components && O2.components.find(
5155
+ getComponent(w2, o3, O2) {
5156
+ const E2 = this.getPluginInstance(w2);
5157
+ if (E2) {
5158
+ const R = E2.components && E2.components.find(
5153
5159
  (T) => T.key.toLowerCase() === o3.toLowerCase()
5154
5160
  );
5155
- return E2 ? E2.element(R) : void 0;
5161
+ return R ? R.element(O2) : void 0;
5156
5162
  }
5157
5163
  }
5158
5164
  getScreen(w2, o3) {
5159
5165
  if (w2) {
5160
- const R = this.getPluginInstance(w2);
5161
- if (R) {
5162
- const O2 = R.screens && R.screens.find(
5163
- (E2) => E2.path.toLowerCase() === o3.toLowerCase()
5166
+ const O2 = this.getPluginInstance(w2);
5167
+ if (O2) {
5168
+ const E2 = O2.screens && O2.screens.find(
5169
+ (R) => R.path.toLowerCase() === o3.toLowerCase()
5164
5170
  );
5165
- return O2 ? O2.element() : void 0;
5171
+ return E2 ? E2.element() : void 0;
5166
5172
  }
5167
5173
  }
5168
5174
  }
5169
5175
  getBoard(w2, o3) {
5170
5176
  if (w2) {
5171
- const R = this.getPluginInstance(w2);
5172
- if (R) {
5173
- const O2 = R.boards && R.boards.find(
5174
- (E2) => E2.key.toLowerCase() === o3.toLowerCase()
5177
+ const O2 = this.getPluginInstance(w2);
5178
+ if (O2) {
5179
+ const E2 = O2.boards && O2.boards.find(
5180
+ (R) => R.key.toLowerCase() === o3.toLowerCase()
5175
5181
  );
5176
- return O2 ? O2.element() : void 0;
5182
+ return E2 ? E2.element() : void 0;
5177
5183
  }
5178
5184
  }
5179
5185
  }
@@ -5183,8 +5189,8 @@ function f0() {
5183
5189
  return t0$1;
5184
5190
  }
5185
5191
  function s0(d, w2, o3) {
5186
- const R = Ho$1(ee$1);
5187
- return R && R[d] && R[d][w2] ? R[d][w2] : o3;
5192
+ const O2 = Ho$1(ee$1);
5193
+ return O2 && O2[d] && O2[d][w2] ? O2[d][w2] : o3;
5188
5194
  }
5189
5195
  var V4 = { exports: {} }, K2 = {};
5190
5196
  /**
@@ -28755,6 +28761,8 @@ const OF1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty(
28755
28761
  return t10.text.size.xlarge;
28756
28762
  case "xxlarge":
28757
28763
  return t10.text.size.xxlarge;
28764
+ case "heading":
28765
+ return t10.text.size.heading;
28758
28766
  }
28759
28767
  }, IF1 = (t10, h10) => {
28760
28768
  if (h10 === void 0)
@@ -28776,6 +28784,8 @@ const OF1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty(
28776
28784
  return t10.text.height.xlarge;
28777
28785
  case "xxlarge":
28778
28786
  return t10.text.height.xxlarge;
28787
+ case "heading":
28788
+ return t10.text.height.heading;
28779
28789
  }
28780
28790
  }, WF1 = (t10, h10) => {
28781
28791
  if (h10 === void 0)
@@ -49586,81 +49596,6 @@ const globals = {
49586
49596
  }
49587
49597
  };
49588
49598
  window.__dek_globals = globals;
49589
- const USER_DATA_QUERY = gql(`
49590
- query userData {
49591
- currentUser {
49592
- id
49593
- name
49594
- email
49595
- location
49596
- avatar
49597
- boards {
49598
- id
49599
- title
49600
- key
49601
- layout
49602
- zones {
49603
- key
49604
- plugin
49605
- component
49606
- props {
49607
- key
49608
- value
49609
- }
49610
- containerProps {
49611
- key
49612
- value
49613
- }
49614
- }
49615
- }
49616
- commandGroups {
49617
- title
49618
- key
49619
- commands {
49620
- title
49621
- plugin
49622
- component
49623
- props {
49624
- key
49625
- value
49626
- }
49627
- }
49628
- }
49629
- }
49630
- }
49631
- `);
49632
- async function fetchUserData(email, password) {
49633
- const client = await getClient(email, password);
49634
- const response = await client.query({
49635
- query: USER_DATA_QUERY
49636
- });
49637
- return response.data.currentUser;
49638
- }
49639
- const state$1 = proxy({
49640
- plugins: {},
49641
- pluginInstances: {},
49642
- data: null,
49643
- loading: false,
49644
- version: 0
49645
- });
49646
- function updateStatePlugins(plugins) {
49647
- state$1.plugins = plugins;
49648
- }
49649
- function updateStatePluginInstances(pluginInstances) {
49650
- state$1.pluginInstances = pluginInstances;
49651
- }
49652
- function updateStateData(data) {
49653
- state$1.data = data;
49654
- }
49655
- function updateStateLoading(loading) {
49656
- state$1.loading = loading;
49657
- }
49658
- async function updateData(email, password) {
49659
- updateStateLoading(true);
49660
- const userData = await fetchUserData(email, password);
49661
- updateStateData(userData);
49662
- updateStateLoading(false);
49663
- }
49664
49599
  var lodash = { exports: {} };
49665
49600
  /**
49666
49601
  * @license
@@ -55144,6 +55079,109 @@ lodash.exports;
55144
55079
  })(lodash, lodash.exports);
55145
55080
  var lodashExports = lodash.exports;
55146
55081
  const _ = /* @__PURE__ */ getDefaultExportFromCjs(lodashExports);
55082
+ const USER_DATA_QUERY = gql(`
55083
+ query userData {
55084
+ currentUser {
55085
+ id
55086
+ name
55087
+ email
55088
+ location
55089
+ avatar
55090
+ boards {
55091
+ id
55092
+ title
55093
+ key
55094
+ layout
55095
+ zones {
55096
+ key
55097
+ plugin
55098
+ component
55099
+ props {
55100
+ key
55101
+ value
55102
+ }
55103
+ containerProps {
55104
+ key
55105
+ value
55106
+ }
55107
+ }
55108
+ }
55109
+ commandGroups {
55110
+ title
55111
+ key
55112
+ commands {
55113
+ title
55114
+ plugin
55115
+ component
55116
+ props {
55117
+ key
55118
+ value
55119
+ }
55120
+ }
55121
+ }
55122
+ }
55123
+ }
55124
+ `);
55125
+ async function fetchUserData(email, password) {
55126
+ const client = await getClient(email, password);
55127
+ const response = await client.query({
55128
+ query: USER_DATA_QUERY
55129
+ });
55130
+ return response.data.currentUser;
55131
+ }
55132
+ const state$1 = proxy({
55133
+ plugins: {},
55134
+ pluginInstances: {},
55135
+ data: null,
55136
+ loading: false,
55137
+ version: 0
55138
+ });
55139
+ function updateStatePlugins(plugins) {
55140
+ state$1.plugins = plugins;
55141
+ }
55142
+ function updateStatePluginInstances(pluginInstances) {
55143
+ state$1.pluginInstances = pluginInstances;
55144
+ }
55145
+ function updateStateData(data) {
55146
+ state$1.data = data;
55147
+ }
55148
+ function updateStateLoading(loading) {
55149
+ state$1.loading = loading;
55150
+ }
55151
+ async function updateData(email, password, plugin) {
55152
+ updateStateLoading(true);
55153
+ let userData = await fetchUserData(email, password);
55154
+ if (plugin) {
55155
+ const pluginInstance = new plugin();
55156
+ if (pluginInstance.config.private !== "true") {
55157
+ userData = _.cloneDeep(userData);
55158
+ userData.boards = [
55159
+ {
55160
+ id: "test-plugin",
55161
+ key: "dev",
55162
+ // layout: `<Screen><View halign='center' valign='center'><Zone id='plugin'></Zone></View></Screen>`,
55163
+ title: "Test Board",
55164
+ base: {
55165
+ plugin: "base",
55166
+ key: "dev"
55167
+ },
55168
+ zones: []
55169
+ // zones: [
55170
+ // {
55171
+ // key: 'plugin',
55172
+ // plugin: 'plugin',
55173
+ // component: 'toggle-button',
55174
+ // props: [],
55175
+ // containerProps: [],
55176
+ // },
55177
+ // ],
55178
+ }
55179
+ ];
55180
+ }
55181
+ }
55182
+ updateStateData(userData);
55183
+ updateStateLoading(false);
55184
+ }
55147
55185
  const USER_PLUGIN_AND_INTEGRATIONS_QUERY = gql(`
55148
55186
  query userPluginsAndIntegrations {
55149
55187
  currentUser {
@@ -55344,6 +55382,61 @@ const Header = ({ height = 70 }) => {
55344
55382
  /* @__PURE__ */ jsxRuntimeExports.jsx(HeaderRight, { "aria-label": "header-right", children: /* @__PURE__ */ jsxRuntimeExports.jsx(ClockComponent, { "aria-label": "clock" }) })
55345
55383
  ] });
55346
55384
  };
55385
+ const DevBoard = () => {
55386
+ const api = f0();
55387
+ const plugin = api.plugin("plugin");
55388
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(NN1, { overlay: true, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(D2, { paddingTop: 100, paddingHorz: 20, collapse: true, direction: "vert", children: [
55389
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
55390
+ _t,
55391
+ {
55392
+ size: "heading",
55393
+ weight: "heading",
55394
+ family: "heading",
55395
+ paddingBottom: 15,
55396
+ children: "Components"
55397
+ }
55398
+ ),
55399
+ /* @__PURE__ */ jsxRuntimeExports.jsx(D2, { direction: "horz", collapse: true, children: plugin && plugin.info.components.map((component) => /* @__PURE__ */ jsxRuntimeExports.jsx(D2, { collapse: true, paddingRight: 10, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
55400
+ jN1,
55401
+ {
55402
+ title: component,
55403
+ icon: "none",
55404
+ onClick: () => api.navigate(`/base/dev/component/${component}`)
55405
+ }
55406
+ ) }, component)) }),
55407
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
55408
+ _t,
55409
+ {
55410
+ size: "heading",
55411
+ weight: "heading",
55412
+ family: "heading",
55413
+ paddingBottom: 15,
55414
+ paddingTop: 50,
55415
+ children: "Screens"
55416
+ }
55417
+ ),
55418
+ /* @__PURE__ */ jsxRuntimeExports.jsx(D2, { direction: "horz", collapse: true, children: plugin && plugin.info.screens.map((screen) => /* @__PURE__ */ jsxRuntimeExports.jsx(D2, { collapse: true, paddingRight: 10, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
55419
+ jN1,
55420
+ {
55421
+ title: screen,
55422
+ icon: "none",
55423
+ onClick: () => api.navigate(`/plugin${screen}`)
55424
+ }
55425
+ ) }, screen)) })
55426
+ ] }) });
55427
+ };
55428
+ const EmptyBoard = () => {
55429
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(NN1, { overlay: true, children: /* @__PURE__ */ jsxRuntimeExports.jsx(D2, { paddingTop: 100, paddingHorz: 20, collapse: true, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
55430
+ _t,
55431
+ {
55432
+ size: "heading",
55433
+ weight: "heading",
55434
+ family: "heading",
55435
+ paddingBottom: 15,
55436
+ children: "No boards configured yet"
55437
+ }
55438
+ ) }) });
55439
+ };
55347
55440
  const MainBoard = () => {
55348
55441
  return /* @__PURE__ */ jsxRuntimeExports.jsx(Board, {});
55349
55442
  };
@@ -59391,6 +59484,193 @@ const SettingsScreen = () => {
59391
59484
  )) }) })
59392
59485
  ] }) });
59393
59486
  };
59487
+ const {
59488
+ useEffect,
59489
+ useLayoutEffect,
59490
+ useRef,
59491
+ useInsertionEffect: useBuiltinInsertionEffect
59492
+ } = React;
59493
+ const canUseDOM = !!(typeof window !== "undefined" && typeof window.document !== "undefined" && typeof window.document.createElement !== "undefined");
59494
+ const useIsomorphicLayoutEffect = canUseDOM ? useLayoutEffect : useEffect;
59495
+ const useInsertionEffect = useBuiltinInsertionEffect || useIsomorphicLayoutEffect;
59496
+ const useEvent = (fn2) => {
59497
+ const ref = useRef([fn2, (...args) => ref[0](...args)]).current;
59498
+ useInsertionEffect(() => {
59499
+ ref[0] = fn2;
59500
+ });
59501
+ return ref[1];
59502
+ };
59503
+ const relativePath = (base = "", path = location.pathname) => !path.toLowerCase().indexOf(base.toLowerCase()) ? path.slice(base.length) || "/" : "~" + path;
59504
+ const absolutePath = (to2, base = "") => to2[0] === "~" ? to2.slice(1) : base + to2;
59505
+ const eventPopstate = "popstate";
59506
+ const eventPushState = "pushState";
59507
+ const eventReplaceState = "replaceState";
59508
+ const eventHashchange = "hashchange";
59509
+ const events = [
59510
+ eventPopstate,
59511
+ eventPushState,
59512
+ eventReplaceState,
59513
+ eventHashchange
59514
+ ];
59515
+ const subscribeToLocationUpdates = (callback) => {
59516
+ for (const event of events) {
59517
+ addEventListener(event, callback);
59518
+ }
59519
+ return () => {
59520
+ for (const event of events) {
59521
+ removeEventListener(event, callback);
59522
+ }
59523
+ };
59524
+ };
59525
+ const useLocationProperty = (fn2, ssrFn) => shimExports.useSyncExternalStore(subscribeToLocationUpdates, fn2, ssrFn);
59526
+ const currentPathname = () => location.pathname;
59527
+ const usePathname = ({ ssrPath } = {}) => useLocationProperty(
59528
+ currentPathname,
59529
+ ssrPath ? () => ssrPath : currentPathname
59530
+ );
59531
+ const navigate = (to2, { replace = false } = {}) => history[replace ? eventReplaceState : eventPushState](null, "", to2);
59532
+ const useLocation$1 = (opts = {}) => [
59533
+ relativePath(opts.base, usePathname(opts)),
59534
+ useEvent((to2, navOpts) => navigate(absolutePath(to2, opts.base), navOpts))
59535
+ ];
59536
+ if (typeof history !== "undefined") {
59537
+ for (const type of [eventPushState, eventReplaceState]) {
59538
+ const original = history[type];
59539
+ history[type] = function() {
59540
+ const result = original.apply(this, arguments);
59541
+ const event = new Event(type);
59542
+ event.arguments = arguments;
59543
+ dispatchEvent(event);
59544
+ return result;
59545
+ };
59546
+ }
59547
+ }
59548
+ function makeMatcher(makeRegexpFn = pathToRegexp) {
59549
+ let cache = {};
59550
+ const getRegexp = (pattern) => cache[pattern] || (cache[pattern] = makeRegexpFn(pattern));
59551
+ return (pattern, path) => {
59552
+ const { regexp, keys: keys2 } = getRegexp(pattern || "");
59553
+ const out = regexp.exec(path);
59554
+ if (!out)
59555
+ return [false, null];
59556
+ const params = keys2.reduce((params2, key, i2) => {
59557
+ params2[key.name] = out[i2 + 1];
59558
+ return params2;
59559
+ }, {});
59560
+ return [true, params];
59561
+ };
59562
+ }
59563
+ const escapeRx = (str) => str.replace(/([.+*?=^!:${}()[\]|/\\])/g, "\\$1");
59564
+ const rxForSegment = (repeat, optional, prefix) => {
59565
+ let capture = repeat ? "((?:[^\\/]+?)(?:\\/(?:[^\\/]+?))*)" : "([^\\/]+?)";
59566
+ if (optional && prefix)
59567
+ capture = "(?:\\/" + capture + ")";
59568
+ return capture + (optional ? "?" : "");
59569
+ };
59570
+ const pathToRegexp = (pattern) => {
59571
+ const groupRx = /:([A-Za-z0-9_]+)([?+*]?)/g;
59572
+ let match = null, lastIndex = 0, keys2 = [], result = "";
59573
+ while ((match = groupRx.exec(pattern)) !== null) {
59574
+ const [_10, segment, mod2] = match;
59575
+ const repeat = mod2 === "+" || mod2 === "*";
59576
+ const optional = mod2 === "?" || mod2 === "*";
59577
+ const prefix = optional && pattern[match.index - 1] === "/" ? 1 : 0;
59578
+ const prev = pattern.substring(lastIndex, match.index - prefix);
59579
+ keys2.push({ name: segment });
59580
+ lastIndex = groupRx.lastIndex;
59581
+ result += escapeRx(prev) + rxForSegment(repeat, optional, prefix);
59582
+ }
59583
+ result += escapeRx(pattern.substring(lastIndex));
59584
+ return { keys: keys2, regexp: new RegExp("^" + result + "(?:\\/)?$", "i") };
59585
+ };
59586
+ const defaultRouter = {
59587
+ hook: useLocation$1,
59588
+ matcher: makeMatcher(),
59589
+ base: ""
59590
+ // this option is used to override the current location during SSR
59591
+ // ssrPath: undefined,
59592
+ };
59593
+ const RouterCtx = createContext(defaultRouter);
59594
+ const useRouter = () => useContext(RouterCtx);
59595
+ const useLocationFromRouter = (router) => router.hook(router);
59596
+ const useLocation = () => useLocationFromRouter(useRouter());
59597
+ const useRoute = (pattern) => {
59598
+ const router = useRouter();
59599
+ const [path] = useLocationFromRouter(router);
59600
+ return router.matcher(pattern, path);
59601
+ };
59602
+ const ParamsCtx = createContext({ params: {} });
59603
+ const useParams = () => useContext(ParamsCtx).params;
59604
+ const ParamsWrapper = (params, children) => createElement(ParamsCtx.Provider, {
59605
+ value: { params },
59606
+ children
59607
+ });
59608
+ const Route = ({ path, match, component, children }) => {
59609
+ const useRouteMatch = useRoute(path);
59610
+ const [matches, params] = match || useRouteMatch;
59611
+ if (!matches)
59612
+ return null;
59613
+ if (component)
59614
+ return ParamsWrapper(params, createElement(component, { params }));
59615
+ return ParamsWrapper(
59616
+ params,
59617
+ typeof children === "function" ? children(params) : children
59618
+ );
59619
+ };
59620
+ forwardRef((props, ref) => {
59621
+ const router = useRouter();
59622
+ const [, navigate2] = useLocationFromRouter(router);
59623
+ const { to: to2, href = to2, children, onClick } = props;
59624
+ const handleClick = useEvent((event) => {
59625
+ if (event.ctrlKey || event.metaKey || event.altKey || event.shiftKey || event.button !== 0)
59626
+ return;
59627
+ onClick && onClick(event);
59628
+ if (!event.defaultPrevented) {
59629
+ event.preventDefault();
59630
+ navigate2(to2 || href, props);
59631
+ }
59632
+ });
59633
+ const extraProps = {
59634
+ // handle nested routers and absolute paths
59635
+ href: href[0] === "~" ? href.slice(1) : router.base + href,
59636
+ onClick: handleClick,
59637
+ to: null,
59638
+ ref
59639
+ };
59640
+ const jsx = isValidElement(children) ? children : createElement("a", props);
59641
+ return cloneElement(jsx, extraProps);
59642
+ });
59643
+ const flattenChildren = (children) => {
59644
+ return Array.isArray(children) ? [].concat(
59645
+ ...children.map(
59646
+ (c3) => c3 && c3.type === Fragment ? flattenChildren(c3.props.children) : flattenChildren(c3)
59647
+ )
59648
+ ) : [children];
59649
+ };
59650
+ const Switch = ({ children, location: location2 }) => {
59651
+ const router = useRouter();
59652
+ const matcher = router.matcher;
59653
+ const [originalLocation] = useLocationFromRouter(router);
59654
+ for (const element of flattenChildren(children)) {
59655
+ let match = 0;
59656
+ if (isValidElement(element) && // we don't require an element to be of type Route,
59657
+ // but we do require it to contain a truthy `path` prop.
59658
+ // this allows to use different components that wrap Route
59659
+ // inside of a switch, for example <AnimatedRoute />.
59660
+ (match = element.props.path ? matcher(element.props.path, location2 || originalLocation) : [true, {}])[0])
59661
+ return cloneElement(element, { match });
59662
+ }
59663
+ return null;
59664
+ };
59665
+ const ComponentScreen = () => {
59666
+ const params = useParams();
59667
+ const api = f0();
59668
+ const plugin = api.plugin("plugin").component(params.componentKey);
59669
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs(NN1, { overlay: true, children: [
59670
+ /* @__PURE__ */ jsxRuntimeExports.jsx(YN1, { title: `'${params.componentKey}' Component` }),
59671
+ /* @__PURE__ */ jsxRuntimeExports.jsx(D2, { halign: "center", valign: "center", children: plugin })
59672
+ ] });
59673
+ };
59394
59674
  let Plugin$2 = class Plugin {
59395
59675
  constructor() {
59396
59676
  __publicField(this, "config", {});
@@ -59410,6 +59690,10 @@ let Plugin$2 = class Plugin {
59410
59690
  {
59411
59691
  path: "/about",
59412
59692
  element: () => /* @__PURE__ */ jsxRuntimeExports.jsx(AboutScreen, {})
59693
+ },
59694
+ {
59695
+ path: "/dev/component/:componentKey",
59696
+ element: () => /* @__PURE__ */ jsxRuntimeExports.jsx(ComponentScreen, {})
59413
59697
  }
59414
59698
  ];
59415
59699
  }
@@ -59442,6 +59726,14 @@ let Plugin$2 = class Plugin {
59442
59726
  {
59443
59727
  key: "main",
59444
59728
  element: () => /* @__PURE__ */ jsxRuntimeExports.jsx(MainBoard, {})
59729
+ },
59730
+ {
59731
+ key: "dev",
59732
+ element: () => /* @__PURE__ */ jsxRuntimeExports.jsx(DevBoard, {})
59733
+ },
59734
+ {
59735
+ key: "empty",
59736
+ element: () => /* @__PURE__ */ jsxRuntimeExports.jsx(EmptyBoard, {})
59445
59737
  }
59446
59738
  ];
59447
59739
  }
@@ -63351,15 +63643,15 @@ function useUserConfig(email, password, plugin) {
63351
63643
  const userChanged = useCallback(async () => {
63352
63644
  console.log("### USER CHANGED");
63353
63645
  await updatePlugins(email, password);
63354
- await updateData(email, password);
63355
- }, [email, password]);
63646
+ await updateData(email, password, plugin);
63647
+ }, [email, password, plugin]);
63356
63648
  useEffect$1(() => {
63357
63649
  const update = async () => {
63358
63650
  await updatePlugins(email, password);
63359
63651
  if (plugin) {
63360
63652
  await updateLocalPlugin(plugin);
63361
63653
  }
63362
- await updateData(email, password);
63654
+ await updateData(email, password, plugin);
63363
63655
  await watchUser(email, password, userChanged);
63364
63656
  };
63365
63657
  update();
@@ -65325,183 +65617,6 @@ SwitchTransition.defaultProps = {
65325
65617
  mode: modes.out
65326
65618
  };
65327
65619
  const SwitchTransition$1 = SwitchTransition;
65328
- const {
65329
- useEffect,
65330
- useLayoutEffect,
65331
- useRef,
65332
- useInsertionEffect: useBuiltinInsertionEffect
65333
- } = React;
65334
- const canUseDOM = !!(typeof window !== "undefined" && typeof window.document !== "undefined" && typeof window.document.createElement !== "undefined");
65335
- const useIsomorphicLayoutEffect = canUseDOM ? useLayoutEffect : useEffect;
65336
- const useInsertionEffect = useBuiltinInsertionEffect || useIsomorphicLayoutEffect;
65337
- const useEvent = (fn2) => {
65338
- const ref = useRef([fn2, (...args) => ref[0](...args)]).current;
65339
- useInsertionEffect(() => {
65340
- ref[0] = fn2;
65341
- });
65342
- return ref[1];
65343
- };
65344
- const relativePath = (base = "", path = location.pathname) => !path.toLowerCase().indexOf(base.toLowerCase()) ? path.slice(base.length) || "/" : "~" + path;
65345
- const absolutePath = (to2, base = "") => to2[0] === "~" ? to2.slice(1) : base + to2;
65346
- const eventPopstate = "popstate";
65347
- const eventPushState = "pushState";
65348
- const eventReplaceState = "replaceState";
65349
- const eventHashchange = "hashchange";
65350
- const events = [
65351
- eventPopstate,
65352
- eventPushState,
65353
- eventReplaceState,
65354
- eventHashchange
65355
- ];
65356
- const subscribeToLocationUpdates = (callback) => {
65357
- for (const event of events) {
65358
- addEventListener(event, callback);
65359
- }
65360
- return () => {
65361
- for (const event of events) {
65362
- removeEventListener(event, callback);
65363
- }
65364
- };
65365
- };
65366
- const useLocationProperty = (fn2, ssrFn) => shimExports.useSyncExternalStore(subscribeToLocationUpdates, fn2, ssrFn);
65367
- const currentPathname = () => location.pathname;
65368
- const usePathname = ({ ssrPath } = {}) => useLocationProperty(
65369
- currentPathname,
65370
- ssrPath ? () => ssrPath : currentPathname
65371
- );
65372
- const navigate = (to2, { replace = false } = {}) => history[replace ? eventReplaceState : eventPushState](null, "", to2);
65373
- const useLocation$1 = (opts = {}) => [
65374
- relativePath(opts.base, usePathname(opts)),
65375
- useEvent((to2, navOpts) => navigate(absolutePath(to2, opts.base), navOpts))
65376
- ];
65377
- if (typeof history !== "undefined") {
65378
- for (const type of [eventPushState, eventReplaceState]) {
65379
- const original = history[type];
65380
- history[type] = function() {
65381
- const result = original.apply(this, arguments);
65382
- const event = new Event(type);
65383
- event.arguments = arguments;
65384
- dispatchEvent(event);
65385
- return result;
65386
- };
65387
- }
65388
- }
65389
- function makeMatcher(makeRegexpFn = pathToRegexp) {
65390
- let cache = {};
65391
- const getRegexp = (pattern) => cache[pattern] || (cache[pattern] = makeRegexpFn(pattern));
65392
- return (pattern, path) => {
65393
- const { regexp, keys: keys2 } = getRegexp(pattern || "");
65394
- const out = regexp.exec(path);
65395
- if (!out)
65396
- return [false, null];
65397
- const params = keys2.reduce((params2, key, i2) => {
65398
- params2[key.name] = out[i2 + 1];
65399
- return params2;
65400
- }, {});
65401
- return [true, params];
65402
- };
65403
- }
65404
- const escapeRx = (str) => str.replace(/([.+*?=^!:${}()[\]|/\\])/g, "\\$1");
65405
- const rxForSegment = (repeat, optional, prefix) => {
65406
- let capture = repeat ? "((?:[^\\/]+?)(?:\\/(?:[^\\/]+?))*)" : "([^\\/]+?)";
65407
- if (optional && prefix)
65408
- capture = "(?:\\/" + capture + ")";
65409
- return capture + (optional ? "?" : "");
65410
- };
65411
- const pathToRegexp = (pattern) => {
65412
- const groupRx = /:([A-Za-z0-9_]+)([?+*]?)/g;
65413
- let match = null, lastIndex = 0, keys2 = [], result = "";
65414
- while ((match = groupRx.exec(pattern)) !== null) {
65415
- const [_10, segment, mod2] = match;
65416
- const repeat = mod2 === "+" || mod2 === "*";
65417
- const optional = mod2 === "?" || mod2 === "*";
65418
- const prefix = optional && pattern[match.index - 1] === "/" ? 1 : 0;
65419
- const prev = pattern.substring(lastIndex, match.index - prefix);
65420
- keys2.push({ name: segment });
65421
- lastIndex = groupRx.lastIndex;
65422
- result += escapeRx(prev) + rxForSegment(repeat, optional, prefix);
65423
- }
65424
- result += escapeRx(pattern.substring(lastIndex));
65425
- return { keys: keys2, regexp: new RegExp("^" + result + "(?:\\/)?$", "i") };
65426
- };
65427
- const defaultRouter = {
65428
- hook: useLocation$1,
65429
- matcher: makeMatcher(),
65430
- base: ""
65431
- // this option is used to override the current location during SSR
65432
- // ssrPath: undefined,
65433
- };
65434
- const RouterCtx = createContext(defaultRouter);
65435
- const useRouter = () => useContext(RouterCtx);
65436
- const useLocationFromRouter = (router) => router.hook(router);
65437
- const useLocation = () => useLocationFromRouter(useRouter());
65438
- const useRoute = (pattern) => {
65439
- const router = useRouter();
65440
- const [path] = useLocationFromRouter(router);
65441
- return router.matcher(pattern, path);
65442
- };
65443
- const ParamsCtx = createContext({ params: {} });
65444
- const ParamsWrapper = (params, children) => createElement(ParamsCtx.Provider, {
65445
- value: { params },
65446
- children
65447
- });
65448
- const Route = ({ path, match, component, children }) => {
65449
- const useRouteMatch = useRoute(path);
65450
- const [matches, params] = match || useRouteMatch;
65451
- if (!matches)
65452
- return null;
65453
- if (component)
65454
- return ParamsWrapper(params, createElement(component, { params }));
65455
- return ParamsWrapper(
65456
- params,
65457
- typeof children === "function" ? children(params) : children
65458
- );
65459
- };
65460
- forwardRef((props, ref) => {
65461
- const router = useRouter();
65462
- const [, navigate2] = useLocationFromRouter(router);
65463
- const { to: to2, href = to2, children, onClick } = props;
65464
- const handleClick = useEvent((event) => {
65465
- if (event.ctrlKey || event.metaKey || event.altKey || event.shiftKey || event.button !== 0)
65466
- return;
65467
- onClick && onClick(event);
65468
- if (!event.defaultPrevented) {
65469
- event.preventDefault();
65470
- navigate2(to2 || href, props);
65471
- }
65472
- });
65473
- const extraProps = {
65474
- // handle nested routers and absolute paths
65475
- href: href[0] === "~" ? href.slice(1) : router.base + href,
65476
- onClick: handleClick,
65477
- to: null,
65478
- ref
65479
- };
65480
- const jsx = isValidElement(children) ? children : createElement("a", props);
65481
- return cloneElement(jsx, extraProps);
65482
- });
65483
- const flattenChildren = (children) => {
65484
- return Array.isArray(children) ? [].concat(
65485
- ...children.map(
65486
- (c3) => c3 && c3.type === Fragment ? flattenChildren(c3.props.children) : flattenChildren(c3)
65487
- )
65488
- ) : [children];
65489
- };
65490
- const Switch = ({ children, location: location2 }) => {
65491
- const router = useRouter();
65492
- const matcher = router.matcher;
65493
- const [originalLocation] = useLocationFromRouter(router);
65494
- for (const element of flattenChildren(children)) {
65495
- let match = 0;
65496
- if (isValidElement(element) && // we don't require an element to be of type Route,
65497
- // but we do require it to contain a truthy `path` prop.
65498
- // this allows to use different components that wrap Route
65499
- // inside of a switch, for example <AnimatedRoute />.
65500
- (match = element.props.path ? matcher(element.props.path, location2 || originalLocation) : [true, {}])[0])
65501
- return cloneElement(element, { match });
65502
- }
65503
- return null;
65504
- };
65505
65620
  const RouteResolver = ({ route }) => {
65506
65621
  const api = f0();
65507
65622
  const resolveRouteElement = (route2) => {
@@ -65515,15 +65630,24 @@ const RouteResolver = ({ route }) => {
65515
65630
  const board = api.boards.find(
65516
65631
  (b10) => b10.key === api.boardKey
65517
65632
  );
65518
- if (board && board.base) {
65519
- const boardElement = api.plugin(board.base.plugin).board(board.base.key);
65520
- if (boardElement) {
65521
- return boardElement;
65633
+ if (board) {
65634
+ if (board.base) {
65635
+ const boardElement = api.plugin(board.base.plugin).board(board.base.key);
65636
+ if (boardElement) {
65637
+ return boardElement;
65638
+ }
65639
+ } else {
65640
+ return api.plugin(defaultBase.plugin).board(defaultBase.key);
65522
65641
  }
65523
65642
  }
65524
- return api.plugin(defaultBase.plugin).board(defaultBase.key);
65643
+ const devBoard = api.plugin("plugin").board(api.boardKey);
65644
+ if (devBoard) {
65645
+ return devBoard;
65646
+ }
65647
+ return api.plugin(defaultBase.plugin).board(api.boardKey);
65525
65648
  }
65526
65649
  };
65650
+ console.log("### ROUTE", route);
65527
65651
  return resolveRouteElement(route);
65528
65652
  };
65529
65653
  const Container$1 = styled.div`
@@ -65537,14 +65661,18 @@ const Container$1 = styled.div`
65537
65661
  flex-direction: column;
65538
65662
  overflow: hidden;
65539
65663
  `;
65540
- const Router = ({ userConfig }) => {
65664
+ const Router = ({ userConfig, transitionDelay: transitionDelay2 }) => {
65541
65665
  const [routes, setRoutes] = useState([]);
65666
+ const [boardKeys, setBoardKeys] = useState([]);
65542
65667
  const [location2, setLocation] = useLocation();
65668
+ const [container, setContainer] = useState(null);
65669
+ const [containerNodeRef, setContainerNodeRef] = useState(null);
65543
65670
  const { data, pluginInstances } = userConfig;
65544
65671
  useEffect$1(() => {
65545
65672
  const loadRoutes = async () => {
65546
- var _a2;
65673
+ var _a2, _b2;
65547
65674
  const newRoutes = [];
65675
+ const newBoardKeys = [];
65548
65676
  if (pluginInstances) {
65549
65677
  for (const key in pluginInstances) {
65550
65678
  (_a2 = pluginInstances[key].screens) == null ? void 0 : _a2.forEach((screen) => {
@@ -65556,45 +65684,70 @@ const Router = ({ userConfig }) => {
65556
65684
  nodeRef: createRef()
65557
65685
  });
65558
65686
  });
65687
+ (_b2 = pluginInstances[key].boards) == null ? void 0 : _b2.forEach((board) => {
65688
+ newBoardKeys.push("/" + board.key);
65689
+ });
65559
65690
  }
65560
65691
  }
65692
+ (data == null ? void 0 : data.boards) && data.boards.forEach((board) => {
65693
+ newBoardKeys.push("/" + board.key);
65694
+ });
65561
65695
  newRoutes.push({
65562
65696
  type: "root",
65563
65697
  route: `/:boardKey`,
65564
65698
  nodeRef: createRef()
65565
65699
  });
65566
- console.log("### LOADED ROUTES", newRoutes);
65700
+ console.log("### LOADED ROUTES", newRoutes, newBoardKeys);
65567
65701
  setRoutes(newRoutes);
65702
+ setBoardKeys(newBoardKeys);
65568
65703
  };
65569
65704
  loadRoutes();
65570
- }, [pluginInstances]);
65705
+ }, [pluginInstances, data == null ? void 0 : data.boards]);
65706
+ useEffect$1(() => {
65707
+ const { nodeRef } = routes.find((route) => {
65708
+ let path = "/:boardKey";
65709
+ const tokens2 = location2.split("/");
65710
+ tokens2.shift();
65711
+ if (tokens2.length > 2) {
65712
+ tokens2.shift();
65713
+ path += "/" + tokens2.join("/");
65714
+ }
65715
+ return route.path === path;
65716
+ }) ?? {};
65717
+ const containerComponent = /* @__PURE__ */ jsxRuntimeExports.jsx(Container$1, { "aria-label": "router", ref: nodeRef, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Switch, { children: routes.map((route) => {
65718
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(Route, { path: route.route, children: (params) => {
65719
+ globals.boardKey = params.boardKey || "#error";
65720
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(RouteResolver, { route });
65721
+ } }, route.route);
65722
+ }) }) });
65723
+ console.log("### SETTING CONTAINER");
65724
+ setContainerNodeRef(nodeRef);
65725
+ setContainer(containerComponent);
65726
+ }, [location2, routes]);
65571
65727
  if (!data) {
65572
65728
  return null;
65573
65729
  }
65574
- const { nodeRef } = routes.find((route) => {
65575
- let path = "/:boardKey";
65576
- const tokens2 = location2.split("/");
65577
- tokens2.shift();
65578
- if (tokens2.length > 2) {
65579
- tokens2.shift();
65580
- path += "/" + tokens2.join("/");
65730
+ const defaultBoard = data.boards.length > 0 ? data.boards[0].key : "empty";
65731
+ if (location2 === "/") {
65732
+ setLocation(`/${defaultBoard}`);
65733
+ } else {
65734
+ const exists = boardKeys.some((key) => location2.startsWith(key));
65735
+ if (!exists) {
65736
+ setLocation(`/${defaultBoard}`);
65581
65737
  }
65582
- return route.path === path;
65583
- }) ?? {};
65738
+ }
65584
65739
  globals.setLocation = setLocation;
65740
+ if (transitionDelay2 <= 0) {
65741
+ return container;
65742
+ }
65585
65743
  return /* @__PURE__ */ jsxRuntimeExports.jsx(SwitchTransition$1, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
65586
65744
  CSSTransition$1,
65587
65745
  {
65588
- nodeRef,
65589
- timeout: 50,
65746
+ nodeRef: containerNodeRef,
65747
+ timeout: transitionDelay2,
65590
65748
  classNames: "page",
65591
65749
  unmountOnExit: true,
65592
- children: () => /* @__PURE__ */ jsxRuntimeExports.jsx(Container$1, { "aria-label": "router", ref: nodeRef, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Switch, { children: routes.map((route) => {
65593
- return /* @__PURE__ */ jsxRuntimeExports.jsx(Route, { path: route.route, children: (params) => {
65594
- globals.boardKey = params.boardKey || "#error";
65595
- return /* @__PURE__ */ jsxRuntimeExports.jsx(RouteResolver, { route });
65596
- } }, route.route);
65597
- }) }) })
65750
+ children: () => container
65598
65751
  },
65599
65752
  location2
65600
65753
  ) });
@@ -65660,8 +65813,8 @@ body {
65660
65813
  opacity: 1;
65661
65814
  transform: scale(1);
65662
65815
  transition:
65663
- opacity 50ms,
65664
- transform 50ms;
65816
+ opacity ${({ $transitionDelay }) => $transitionDelay}ms,
65817
+ transform ${({ $transitionDelay }) => $transitionDelay}ms;
65665
65818
  }
65666
65819
 
65667
65820
  .page-exit {
@@ -65673,8 +65826,8 @@ body {
65673
65826
  opacity: 0;
65674
65827
  transform: scale(0.95);
65675
65828
  transition:
65676
- opacity 50ms,
65677
- transform 50ms;
65829
+ opacity ${({ $transitionDelay }) => $transitionDelay}ms,
65830
+ transform ${({ $transitionDelay }) => $transitionDelay}ms;
65678
65831
  }
65679
65832
 
65680
65833
  /* scrollbar */
@@ -65702,14 +65855,16 @@ body {
65702
65855
  }
65703
65856
 
65704
65857
  `;
65858
+ const zoom = 1;
65859
+ const transitionDelay = 0;
65705
65860
  const BoardProvider = ({ email, password, plugin }) => {
65706
65861
  const config2 = useUserConfig(email, password, plugin);
65707
65862
  const api = f0();
65708
- console.log("BoardProvider", { config: config2, api });
65863
+ console.log("### LOADED", config2, api);
65709
65864
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(ThemeProvider, { theme: LT1, children: [
65710
- /* @__PURE__ */ jsxRuntimeExports.jsx(BoardStyles, { $zoom: 1 }),
65865
+ /* @__PURE__ */ jsxRuntimeExports.jsx(BoardStyles, { $zoom: zoom, $transitionDelay: transitionDelay }),
65711
65866
  /* @__PURE__ */ jsxRuntimeExports.jsx(Background, {}),
65712
- /* @__PURE__ */ jsxRuntimeExports.jsx(Router, { userConfig: config2 }),
65867
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Router, { userConfig: config2, transitionDelay }),
65713
65868
  config2.loading && /* @__PURE__ */ jsxRuntimeExports.jsx(UN1, {})
65714
65869
  ] });
65715
65870
  };