@appkit/dek-lib 0.1.0 → 0.2.1

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,99 @@ 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 && pluginInstance.config.private !== "true") {
55157
+ userData = _.cloneDeep(userData);
55158
+ userData.boards = [
55159
+ {
55160
+ id: "test-plugin",
55161
+ key: "dev",
55162
+ title: "Test Board",
55163
+ base: {
55164
+ plugin: "base",
55165
+ key: "dev"
55166
+ },
55167
+ zones: []
55168
+ }
55169
+ ];
55170
+ }
55171
+ }
55172
+ updateStateData(userData);
55173
+ updateStateLoading(false);
55174
+ }
55147
55175
  const USER_PLUGIN_AND_INTEGRATIONS_QUERY = gql(`
55148
55176
  query userPluginsAndIntegrations {
55149
55177
  currentUser {
@@ -55344,6 +55372,61 @@ const Header = ({ height = 70 }) => {
55344
55372
  /* @__PURE__ */ jsxRuntimeExports.jsx(HeaderRight, { "aria-label": "header-right", children: /* @__PURE__ */ jsxRuntimeExports.jsx(ClockComponent, { "aria-label": "clock" }) })
55345
55373
  ] });
55346
55374
  };
55375
+ const DevBoard = () => {
55376
+ const api = f0();
55377
+ const plugin = api.plugin("plugin");
55378
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(NN1, { overlay: true, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(D2, { paddingTop: 100, paddingHorz: 20, collapse: true, direction: "vert", children: [
55379
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
55380
+ _t,
55381
+ {
55382
+ size: "heading",
55383
+ weight: "heading",
55384
+ family: "heading",
55385
+ paddingBottom: 15,
55386
+ children: "Components"
55387
+ }
55388
+ ),
55389
+ /* @__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(
55390
+ jN1,
55391
+ {
55392
+ title: component,
55393
+ icon: "none",
55394
+ onClick: () => api.navigate(`/base/dev/component/${component}`)
55395
+ }
55396
+ ) }, component)) }),
55397
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
55398
+ _t,
55399
+ {
55400
+ size: "heading",
55401
+ weight: "heading",
55402
+ family: "heading",
55403
+ paddingBottom: 15,
55404
+ paddingTop: 50,
55405
+ children: "Screens"
55406
+ }
55407
+ ),
55408
+ /* @__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(
55409
+ jN1,
55410
+ {
55411
+ title: screen,
55412
+ icon: "none",
55413
+ onClick: () => api.navigate(`/plugin${screen}`)
55414
+ }
55415
+ ) }, screen)) })
55416
+ ] }) });
55417
+ };
55418
+ const EmptyBoard = () => {
55419
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(NN1, { overlay: true, children: /* @__PURE__ */ jsxRuntimeExports.jsx(D2, { paddingTop: 100, paddingHorz: 20, collapse: true, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
55420
+ _t,
55421
+ {
55422
+ size: "heading",
55423
+ weight: "heading",
55424
+ family: "heading",
55425
+ paddingBottom: 15,
55426
+ children: "No boards configured yet"
55427
+ }
55428
+ ) }) });
55429
+ };
55347
55430
  const MainBoard = () => {
55348
55431
  return /* @__PURE__ */ jsxRuntimeExports.jsx(Board, {});
55349
55432
  };
@@ -59391,6 +59474,193 @@ const SettingsScreen = () => {
59391
59474
  )) }) })
59392
59475
  ] }) });
59393
59476
  };
59477
+ const {
59478
+ useEffect,
59479
+ useLayoutEffect,
59480
+ useRef,
59481
+ useInsertionEffect: useBuiltinInsertionEffect
59482
+ } = React;
59483
+ const canUseDOM = !!(typeof window !== "undefined" && typeof window.document !== "undefined" && typeof window.document.createElement !== "undefined");
59484
+ const useIsomorphicLayoutEffect = canUseDOM ? useLayoutEffect : useEffect;
59485
+ const useInsertionEffect = useBuiltinInsertionEffect || useIsomorphicLayoutEffect;
59486
+ const useEvent = (fn2) => {
59487
+ const ref = useRef([fn2, (...args) => ref[0](...args)]).current;
59488
+ useInsertionEffect(() => {
59489
+ ref[0] = fn2;
59490
+ });
59491
+ return ref[1];
59492
+ };
59493
+ const relativePath = (base = "", path = location.pathname) => !path.toLowerCase().indexOf(base.toLowerCase()) ? path.slice(base.length) || "/" : "~" + path;
59494
+ const absolutePath = (to2, base = "") => to2[0] === "~" ? to2.slice(1) : base + to2;
59495
+ const eventPopstate = "popstate";
59496
+ const eventPushState = "pushState";
59497
+ const eventReplaceState = "replaceState";
59498
+ const eventHashchange = "hashchange";
59499
+ const events = [
59500
+ eventPopstate,
59501
+ eventPushState,
59502
+ eventReplaceState,
59503
+ eventHashchange
59504
+ ];
59505
+ const subscribeToLocationUpdates = (callback) => {
59506
+ for (const event of events) {
59507
+ addEventListener(event, callback);
59508
+ }
59509
+ return () => {
59510
+ for (const event of events) {
59511
+ removeEventListener(event, callback);
59512
+ }
59513
+ };
59514
+ };
59515
+ const useLocationProperty = (fn2, ssrFn) => shimExports.useSyncExternalStore(subscribeToLocationUpdates, fn2, ssrFn);
59516
+ const currentPathname = () => location.pathname;
59517
+ const usePathname = ({ ssrPath } = {}) => useLocationProperty(
59518
+ currentPathname,
59519
+ ssrPath ? () => ssrPath : currentPathname
59520
+ );
59521
+ const navigate = (to2, { replace = false } = {}) => history[replace ? eventReplaceState : eventPushState](null, "", to2);
59522
+ const useLocation$1 = (opts = {}) => [
59523
+ relativePath(opts.base, usePathname(opts)),
59524
+ useEvent((to2, navOpts) => navigate(absolutePath(to2, opts.base), navOpts))
59525
+ ];
59526
+ if (typeof history !== "undefined") {
59527
+ for (const type of [eventPushState, eventReplaceState]) {
59528
+ const original = history[type];
59529
+ history[type] = function() {
59530
+ const result = original.apply(this, arguments);
59531
+ const event = new Event(type);
59532
+ event.arguments = arguments;
59533
+ dispatchEvent(event);
59534
+ return result;
59535
+ };
59536
+ }
59537
+ }
59538
+ function makeMatcher(makeRegexpFn = pathToRegexp) {
59539
+ let cache = {};
59540
+ const getRegexp = (pattern) => cache[pattern] || (cache[pattern] = makeRegexpFn(pattern));
59541
+ return (pattern, path) => {
59542
+ const { regexp, keys: keys2 } = getRegexp(pattern || "");
59543
+ const out = regexp.exec(path);
59544
+ if (!out)
59545
+ return [false, null];
59546
+ const params = keys2.reduce((params2, key, i2) => {
59547
+ params2[key.name] = out[i2 + 1];
59548
+ return params2;
59549
+ }, {});
59550
+ return [true, params];
59551
+ };
59552
+ }
59553
+ const escapeRx = (str) => str.replace(/([.+*?=^!:${}()[\]|/\\])/g, "\\$1");
59554
+ const rxForSegment = (repeat, optional, prefix) => {
59555
+ let capture = repeat ? "((?:[^\\/]+?)(?:\\/(?:[^\\/]+?))*)" : "([^\\/]+?)";
59556
+ if (optional && prefix)
59557
+ capture = "(?:\\/" + capture + ")";
59558
+ return capture + (optional ? "?" : "");
59559
+ };
59560
+ const pathToRegexp = (pattern) => {
59561
+ const groupRx = /:([A-Za-z0-9_]+)([?+*]?)/g;
59562
+ let match = null, lastIndex = 0, keys2 = [], result = "";
59563
+ while ((match = groupRx.exec(pattern)) !== null) {
59564
+ const [_10, segment, mod2] = match;
59565
+ const repeat = mod2 === "+" || mod2 === "*";
59566
+ const optional = mod2 === "?" || mod2 === "*";
59567
+ const prefix = optional && pattern[match.index - 1] === "/" ? 1 : 0;
59568
+ const prev = pattern.substring(lastIndex, match.index - prefix);
59569
+ keys2.push({ name: segment });
59570
+ lastIndex = groupRx.lastIndex;
59571
+ result += escapeRx(prev) + rxForSegment(repeat, optional, prefix);
59572
+ }
59573
+ result += escapeRx(pattern.substring(lastIndex));
59574
+ return { keys: keys2, regexp: new RegExp("^" + result + "(?:\\/)?$", "i") };
59575
+ };
59576
+ const defaultRouter = {
59577
+ hook: useLocation$1,
59578
+ matcher: makeMatcher(),
59579
+ base: ""
59580
+ // this option is used to override the current location during SSR
59581
+ // ssrPath: undefined,
59582
+ };
59583
+ const RouterCtx = createContext(defaultRouter);
59584
+ const useRouter = () => useContext(RouterCtx);
59585
+ const useLocationFromRouter = (router) => router.hook(router);
59586
+ const useLocation = () => useLocationFromRouter(useRouter());
59587
+ const useRoute = (pattern) => {
59588
+ const router = useRouter();
59589
+ const [path] = useLocationFromRouter(router);
59590
+ return router.matcher(pattern, path);
59591
+ };
59592
+ const ParamsCtx = createContext({ params: {} });
59593
+ const useParams = () => useContext(ParamsCtx).params;
59594
+ const ParamsWrapper = (params, children) => createElement(ParamsCtx.Provider, {
59595
+ value: { params },
59596
+ children
59597
+ });
59598
+ const Route = ({ path, match, component, children }) => {
59599
+ const useRouteMatch = useRoute(path);
59600
+ const [matches, params] = match || useRouteMatch;
59601
+ if (!matches)
59602
+ return null;
59603
+ if (component)
59604
+ return ParamsWrapper(params, createElement(component, { params }));
59605
+ return ParamsWrapper(
59606
+ params,
59607
+ typeof children === "function" ? children(params) : children
59608
+ );
59609
+ };
59610
+ forwardRef((props, ref) => {
59611
+ const router = useRouter();
59612
+ const [, navigate2] = useLocationFromRouter(router);
59613
+ const { to: to2, href = to2, children, onClick } = props;
59614
+ const handleClick = useEvent((event) => {
59615
+ if (event.ctrlKey || event.metaKey || event.altKey || event.shiftKey || event.button !== 0)
59616
+ return;
59617
+ onClick && onClick(event);
59618
+ if (!event.defaultPrevented) {
59619
+ event.preventDefault();
59620
+ navigate2(to2 || href, props);
59621
+ }
59622
+ });
59623
+ const extraProps = {
59624
+ // handle nested routers and absolute paths
59625
+ href: href[0] === "~" ? href.slice(1) : router.base + href,
59626
+ onClick: handleClick,
59627
+ to: null,
59628
+ ref
59629
+ };
59630
+ const jsx = isValidElement(children) ? children : createElement("a", props);
59631
+ return cloneElement(jsx, extraProps);
59632
+ });
59633
+ const flattenChildren = (children) => {
59634
+ return Array.isArray(children) ? [].concat(
59635
+ ...children.map(
59636
+ (c3) => c3 && c3.type === Fragment ? flattenChildren(c3.props.children) : flattenChildren(c3)
59637
+ )
59638
+ ) : [children];
59639
+ };
59640
+ const Switch = ({ children, location: location2 }) => {
59641
+ const router = useRouter();
59642
+ const matcher = router.matcher;
59643
+ const [originalLocation] = useLocationFromRouter(router);
59644
+ for (const element of flattenChildren(children)) {
59645
+ let match = 0;
59646
+ if (isValidElement(element) && // we don't require an element to be of type Route,
59647
+ // but we do require it to contain a truthy `path` prop.
59648
+ // this allows to use different components that wrap Route
59649
+ // inside of a switch, for example <AnimatedRoute />.
59650
+ (match = element.props.path ? matcher(element.props.path, location2 || originalLocation) : [true, {}])[0])
59651
+ return cloneElement(element, { match });
59652
+ }
59653
+ return null;
59654
+ };
59655
+ const ComponentScreen = () => {
59656
+ const params = useParams();
59657
+ const api = f0();
59658
+ const plugin = api.plugin("plugin").component(params.componentKey);
59659
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs(NN1, { overlay: true, children: [
59660
+ /* @__PURE__ */ jsxRuntimeExports.jsx(YN1, { title: `'${params.componentKey}' Component` }),
59661
+ /* @__PURE__ */ jsxRuntimeExports.jsx(D2, { halign: "center", valign: "center", children: plugin })
59662
+ ] });
59663
+ };
59394
59664
  let Plugin$2 = class Plugin {
59395
59665
  constructor() {
59396
59666
  __publicField(this, "config", {});
@@ -59410,6 +59680,10 @@ let Plugin$2 = class Plugin {
59410
59680
  {
59411
59681
  path: "/about",
59412
59682
  element: () => /* @__PURE__ */ jsxRuntimeExports.jsx(AboutScreen, {})
59683
+ },
59684
+ {
59685
+ path: "/dev/component/:componentKey",
59686
+ element: () => /* @__PURE__ */ jsxRuntimeExports.jsx(ComponentScreen, {})
59413
59687
  }
59414
59688
  ];
59415
59689
  }
@@ -59442,6 +59716,14 @@ let Plugin$2 = class Plugin {
59442
59716
  {
59443
59717
  key: "main",
59444
59718
  element: () => /* @__PURE__ */ jsxRuntimeExports.jsx(MainBoard, {})
59719
+ },
59720
+ {
59721
+ key: "dev",
59722
+ element: () => /* @__PURE__ */ jsxRuntimeExports.jsx(DevBoard, {})
59723
+ },
59724
+ {
59725
+ key: "empty",
59726
+ element: () => /* @__PURE__ */ jsxRuntimeExports.jsx(EmptyBoard, {})
59445
59727
  }
59446
59728
  ];
59447
59729
  }
@@ -63351,15 +63633,15 @@ function useUserConfig(email, password, plugin) {
63351
63633
  const userChanged = useCallback(async () => {
63352
63634
  console.log("### USER CHANGED");
63353
63635
  await updatePlugins(email, password);
63354
- await updateData(email, password);
63355
- }, [email, password]);
63636
+ await updateData(email, password, plugin);
63637
+ }, [email, password, plugin]);
63356
63638
  useEffect$1(() => {
63357
63639
  const update = async () => {
63358
63640
  await updatePlugins(email, password);
63359
63641
  if (plugin) {
63360
63642
  await updateLocalPlugin(plugin);
63361
63643
  }
63362
- await updateData(email, password);
63644
+ await updateData(email, password, plugin);
63363
63645
  await watchUser(email, password, userChanged);
63364
63646
  };
63365
63647
  update();
@@ -65325,183 +65607,6 @@ SwitchTransition.defaultProps = {
65325
65607
  mode: modes.out
65326
65608
  };
65327
65609
  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
65610
  const RouteResolver = ({ route }) => {
65506
65611
  const api = f0();
65507
65612
  const resolveRouteElement = (route2) => {
@@ -65515,15 +65620,24 @@ const RouteResolver = ({ route }) => {
65515
65620
  const board = api.boards.find(
65516
65621
  (b10) => b10.key === api.boardKey
65517
65622
  );
65518
- if (board && board.base) {
65519
- const boardElement = api.plugin(board.base.plugin).board(board.base.key);
65520
- if (boardElement) {
65521
- return boardElement;
65623
+ if (board) {
65624
+ if (board.base) {
65625
+ const boardElement = api.plugin(board.base.plugin).board(board.base.key);
65626
+ if (boardElement) {
65627
+ return boardElement;
65628
+ }
65629
+ } else {
65630
+ return api.plugin(defaultBase.plugin).board(defaultBase.key);
65522
65631
  }
65523
65632
  }
65524
- return api.plugin(defaultBase.plugin).board(defaultBase.key);
65633
+ const devBoard = api.plugin("plugin").board(api.boardKey);
65634
+ if (devBoard) {
65635
+ return devBoard;
65636
+ }
65637
+ return api.plugin(defaultBase.plugin).board(api.boardKey);
65525
65638
  }
65526
65639
  };
65640
+ console.log("### ROUTE", route);
65527
65641
  return resolveRouteElement(route);
65528
65642
  };
65529
65643
  const Container$1 = styled.div`
@@ -65537,14 +65651,18 @@ const Container$1 = styled.div`
65537
65651
  flex-direction: column;
65538
65652
  overflow: hidden;
65539
65653
  `;
65540
- const Router = ({ userConfig }) => {
65654
+ const Router = ({ userConfig, transitionDelay: transitionDelay2 }) => {
65541
65655
  const [routes, setRoutes] = useState([]);
65656
+ const [boardKeys, setBoardKeys] = useState([]);
65542
65657
  const [location2, setLocation] = useLocation();
65658
+ const [container, setContainer] = useState(null);
65659
+ const [containerNodeRef, setContainerNodeRef] = useState(null);
65543
65660
  const { data, pluginInstances } = userConfig;
65544
65661
  useEffect$1(() => {
65545
65662
  const loadRoutes = async () => {
65546
- var _a2;
65663
+ var _a2, _b2;
65547
65664
  const newRoutes = [];
65665
+ const newBoardKeys = [];
65548
65666
  if (pluginInstances) {
65549
65667
  for (const key in pluginInstances) {
65550
65668
  (_a2 = pluginInstances[key].screens) == null ? void 0 : _a2.forEach((screen) => {
@@ -65556,45 +65674,70 @@ const Router = ({ userConfig }) => {
65556
65674
  nodeRef: createRef()
65557
65675
  });
65558
65676
  });
65677
+ (_b2 = pluginInstances[key].boards) == null ? void 0 : _b2.forEach((board) => {
65678
+ newBoardKeys.push("/" + board.key);
65679
+ });
65559
65680
  }
65560
65681
  }
65682
+ (data == null ? void 0 : data.boards) && data.boards.forEach((board) => {
65683
+ newBoardKeys.push("/" + board.key);
65684
+ });
65561
65685
  newRoutes.push({
65562
65686
  type: "root",
65563
65687
  route: `/:boardKey`,
65564
65688
  nodeRef: createRef()
65565
65689
  });
65566
- console.log("### LOADED ROUTES", newRoutes);
65690
+ console.log("### LOADED ROUTES", newRoutes, newBoardKeys);
65567
65691
  setRoutes(newRoutes);
65692
+ setBoardKeys(newBoardKeys);
65568
65693
  };
65569
65694
  loadRoutes();
65570
- }, [pluginInstances]);
65695
+ }, [pluginInstances, data == null ? void 0 : data.boards]);
65696
+ useEffect$1(() => {
65697
+ const { nodeRef } = routes.find((route) => {
65698
+ let path = "/:boardKey";
65699
+ const tokens2 = location2.split("/");
65700
+ tokens2.shift();
65701
+ if (tokens2.length > 2) {
65702
+ tokens2.shift();
65703
+ path += "/" + tokens2.join("/");
65704
+ }
65705
+ return route.path === path;
65706
+ }) ?? {};
65707
+ const containerComponent = /* @__PURE__ */ jsxRuntimeExports.jsx(Container$1, { "aria-label": "router", ref: nodeRef, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Switch, { children: routes.map((route) => {
65708
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(Route, { path: route.route, children: (params) => {
65709
+ globals.boardKey = params.boardKey || "#error";
65710
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(RouteResolver, { route });
65711
+ } }, route.route);
65712
+ }) }) });
65713
+ console.log("### SETTING CONTAINER");
65714
+ setContainerNodeRef(nodeRef);
65715
+ setContainer(containerComponent);
65716
+ }, [location2, routes]);
65571
65717
  if (!data) {
65572
65718
  return null;
65573
65719
  }
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("/");
65720
+ const defaultBoard = data.boards.length > 0 ? data.boards[0].key : "empty";
65721
+ if (location2 === "/") {
65722
+ setLocation(`/${defaultBoard}`);
65723
+ } else {
65724
+ const exists = boardKeys.some((key) => location2.startsWith(key));
65725
+ if (!exists) {
65726
+ setLocation(`/${defaultBoard}`);
65581
65727
  }
65582
- return route.path === path;
65583
- }) ?? {};
65728
+ }
65584
65729
  globals.setLocation = setLocation;
65730
+ if (transitionDelay2 <= 0) {
65731
+ return container;
65732
+ }
65585
65733
  return /* @__PURE__ */ jsxRuntimeExports.jsx(SwitchTransition$1, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
65586
65734
  CSSTransition$1,
65587
65735
  {
65588
- nodeRef,
65589
- timeout: 50,
65736
+ nodeRef: containerNodeRef,
65737
+ timeout: transitionDelay2,
65590
65738
  classNames: "page",
65591
65739
  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
- }) }) })
65740
+ children: () => container
65598
65741
  },
65599
65742
  location2
65600
65743
  ) });
@@ -65660,8 +65803,8 @@ body {
65660
65803
  opacity: 1;
65661
65804
  transform: scale(1);
65662
65805
  transition:
65663
- opacity 50ms,
65664
- transform 50ms;
65806
+ opacity ${({ $transitionDelay }) => $transitionDelay}ms,
65807
+ transform ${({ $transitionDelay }) => $transitionDelay}ms;
65665
65808
  }
65666
65809
 
65667
65810
  .page-exit {
@@ -65673,8 +65816,8 @@ body {
65673
65816
  opacity: 0;
65674
65817
  transform: scale(0.95);
65675
65818
  transition:
65676
- opacity 50ms,
65677
- transform 50ms;
65819
+ opacity ${({ $transitionDelay }) => $transitionDelay}ms,
65820
+ transform ${({ $transitionDelay }) => $transitionDelay}ms;
65678
65821
  }
65679
65822
 
65680
65823
  /* scrollbar */
@@ -65702,14 +65845,16 @@ body {
65702
65845
  }
65703
65846
 
65704
65847
  `;
65848
+ const zoom = 1;
65849
+ const transitionDelay = 0;
65705
65850
  const BoardProvider = ({ email, password, plugin }) => {
65706
65851
  const config2 = useUserConfig(email, password, plugin);
65707
65852
  const api = f0();
65708
- console.log("BoardProvider", { config: config2, api });
65853
+ console.log("### LOADED", config2, api);
65709
65854
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(ThemeProvider, { theme: LT1, children: [
65710
- /* @__PURE__ */ jsxRuntimeExports.jsx(BoardStyles, { $zoom: 1 }),
65855
+ /* @__PURE__ */ jsxRuntimeExports.jsx(BoardStyles, { $zoom: zoom, $transitionDelay: transitionDelay }),
65711
65856
  /* @__PURE__ */ jsxRuntimeExports.jsx(Background, {}),
65712
- /* @__PURE__ */ jsxRuntimeExports.jsx(Router, { userConfig: config2 }),
65857
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Router, { userConfig: config2, transitionDelay }),
65713
65858
  config2.loading && /* @__PURE__ */ jsxRuntimeExports.jsx(UN1, {})
65714
65859
  ] });
65715
65860
  };