@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.umd.js CHANGED
@@ -999,7 +999,7 @@ var __publicField = (obj, key, value) => {
999
999
  wr$1.exports;
1000
1000
  (function(d, w2) {
1001
1001
  (function() {
1002
- 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__", y10 = 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 = [
1002
+ 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__", y10 = 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 = [
1003
1003
  ["ary", gn2],
1004
1004
  ["bind", V10],
1005
1005
  ["bindKey", j],
@@ -1787,7 +1787,7 @@ var __publicField = (obj, key, value) => {
1787
1787
  var t10 = this.__data__;
1788
1788
  if (t10 instanceof re2) {
1789
1789
  var r10 = t10.__data__;
1790
- if (!st2 || r10.length < O2 - 1)
1790
+ if (!st2 || r10.length < E2 - 1)
1791
1791
  return r10.push([n10, e2]), this.size = ++t10.size, this;
1792
1792
  t10 = this.__data__ = new ie2(r10);
1793
1793
  }
@@ -1919,7 +1919,7 @@ var __publicField = (obj, key, value) => {
1919
1919
  var i2 = -1, f10 = bt2, s2 = true, l2 = n10.length, c3 = [], p10 = e2.length;
1920
1920
  if (!l2)
1921
1921
  return c3;
1922
- t10 && (e2 = on2(e2, bn2(t10))), r10 ? (f10 = Ur2, s2 = false) : e2.length >= O2 && (f10 = ft2, s2 = false, e2 = new Ce2(e2));
1922
+ t10 && (e2 = on2(e2, bn2(t10))), r10 ? (f10 = Ur2, s2 = false) : e2.length >= E2 && (f10 = ft2, s2 = false, e2 = new Ce2(e2));
1923
1923
  n:
1924
1924
  for (; ++i2 < l2; ) {
1925
1925
  var _10 = n10[i2], v = t10 == null ? _10 : t10(_10);
@@ -2353,7 +2353,7 @@ var __publicField = (obj, key, value) => {
2353
2353
  var r10 = -1, i2 = bt2, f10 = n10.length, s2 = true, l2 = [], c3 = l2;
2354
2354
  if (t10)
2355
2355
  s2 = false, i2 = Ur2;
2356
- else if (f10 >= O2) {
2356
+ else if (f10 >= E2) {
2357
2357
  var p10 = e2 ? null : ja2(n10);
2358
2358
  if (p10)
2359
2359
  return Dt2(p10);
@@ -3953,7 +3953,7 @@ var __publicField = (obj, key, value) => {
3953
3953
  }
3954
3954
  function Tg2(n10) {
3955
3955
  if (hc2(n10))
3956
- throw new b10(E2);
3956
+ throw new b10(R);
3957
3957
  return nf2(n10);
3958
3958
  }
3959
3959
  function Cg2(n10) {
@@ -4568,7 +4568,7 @@ function print() { __p += __j.call(arguments, '') }
4568
4568
  return kn2(u2, function(e2, t10) {
4569
4569
  nn2.call(u2.prototype, t10) || (n10[t10] = e2);
4570
4570
  }), n10;
4571
- }(), { chain: false }), u2.VERSION = R, Un2(["bind", "bindKey", "curry", "curryRight", "partial", "partialRight"], function(n10) {
4571
+ }(), { chain: false }), u2.VERSION = O2, Un2(["bind", "bindKey", "curry", "curryRight", "partial", "partialRight"], function(n10) {
4572
4572
  u2[n10].placeholder = u2;
4573
4573
  }), Un2(["drop", "take"], function(n10, e2) {
4574
4574
  H.prototype[n10] = function(t10) {
@@ -4672,16 +4672,16 @@ function print() { __p += __j.call(arguments, '') }
4672
4672
  return Object.values(w2).forEach((o3) => {
4673
4673
  o3.configurable = true;
4674
4674
  }), Object.create($i$1(d), w2);
4675
- }, Uo$1 = (d) => d[Zi$1] || d, Fo$1 = (d, w2, o3, R) => {
4675
+ }, Uo$1 = (d) => d[Zi$1] || d, Fo$1 = (d, w2, o3, O2) => {
4676
4676
  if (!Bo$1(d))
4677
4677
  return d;
4678
- let O2 = R && R.get(d);
4679
- if (!O2) {
4678
+ let E2 = O2 && O2.get(d);
4679
+ if (!E2) {
4680
4680
  const en2 = Uo$1(d);
4681
- O2 = ((y10) => Object.values(Object.getOwnPropertyDescriptors(y10)).some((K) => !K.configurable && !K.writable))(en2) ? [en2, G_$1(en2)] : [en2], R == null || R.set(d, O2);
4681
+ E2 = ((y10) => Object.values(Object.getOwnPropertyDescriptors(y10)).some((K) => !K.configurable && !K.writable))(en2) ? [en2, G_$1(en2)] : [en2], O2 == null || O2.set(d, E2);
4682
4682
  }
4683
- const [E2, T] = O2;
4684
- let X10 = o3 && o3.get(E2);
4683
+ const [R, T] = E2;
4684
+ let X10 = o3 && o3.get(R);
4685
4685
  return X10 && X10[1].f === !!T || (X10 = ((en2, y10) => {
4686
4686
  const K = { f: y10 };
4687
4687
  let W = false;
@@ -4697,47 +4697,47 @@ function print() { __p += __j.call(arguments, '') }
4697
4697
  }
4698
4698
  }, 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)) };
4699
4699
  return y10 && (z.set = z.deleteProperty = () => false), [z, K];
4700
- })(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;
4701
- }, No$1 = (d, w2, o3, R) => {
4700
+ })(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;
4701
+ }, No$1 = (d, w2, o3, O2) => {
4702
4702
  if (Object.is(d, w2))
4703
4703
  return false;
4704
4704
  if (!To$1(d) || !To$1(w2))
4705
4705
  return true;
4706
- const O2 = o3.get(Uo$1(d));
4707
- if (!O2)
4706
+ const E2 = o3.get(Uo$1(d));
4707
+ if (!E2)
4708
4708
  return true;
4709
- if (R) {
4710
- const T = R.get(d);
4709
+ if (O2) {
4710
+ const T = O2.get(d);
4711
4711
  if (T && T.n === w2)
4712
4712
  return T.g;
4713
- R.set(d, { n: w2, g: false });
4713
+ O2.set(d, { n: w2, g: false });
4714
4714
  }
4715
- let E2 = null;
4715
+ let R = null;
4716
4716
  try {
4717
- for (const T of O2.h || [])
4718
- if (E2 = Reflect.has(d, T) !== Reflect.has(w2, T), E2)
4719
- return E2;
4720
- if (O2[vr$1] === true) {
4721
- if (E2 = ((T, X10) => {
4717
+ for (const T of E2.h || [])
4718
+ if (R = Reflect.has(d, T) !== Reflect.has(w2, T), R)
4719
+ return R;
4720
+ if (E2[vr$1] === true) {
4721
+ if (R = ((T, X10) => {
4722
4722
  const en2 = Reflect.ownKeys(T), y10 = Reflect.ownKeys(X10);
4723
4723
  return en2.length !== y10.length || en2.some((K, W) => K !== y10[W]);
4724
- })(d, w2), E2)
4725
- return E2;
4724
+ })(d, w2), R)
4725
+ return R;
4726
4726
  } else
4727
- for (const T of O2.o || [])
4728
- if (E2 = !!Reflect.getOwnPropertyDescriptor(d, T) != !!Reflect.getOwnPropertyDescriptor(w2, T), E2)
4729
- return E2;
4730
- for (const T of O2.k || [])
4731
- if (E2 = No$1(d[T], w2[T], o3, R), E2)
4732
- return E2;
4733
- return E2 === null && (E2 = true), E2;
4727
+ for (const T of E2.o || [])
4728
+ if (R = !!Reflect.getOwnPropertyDescriptor(d, T) != !!Reflect.getOwnPropertyDescriptor(w2, T), R)
4729
+ return R;
4730
+ for (const T of E2.k || [])
4731
+ if (R = No$1(d[T], w2[T], o3, O2), R)
4732
+ return R;
4733
+ return R === null && (R = true), R;
4734
4734
  } finally {
4735
- R && R.set(d, { n: w2, g: E2 });
4735
+ O2 && O2.set(d, { n: w2, g: R });
4736
4736
  }
4737
4737
  }, H_$1 = (d) => Bo$1(d) && d[Zi$1] || null, Co$1 = (d, w2 = true) => {
4738
4738
  qi$1.set(d, w2);
4739
4739
  };
4740
- 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 = (y10, K) => new Proxy(y10, K), o3 = (y10) => Gi$1(y10) && !dr$1.has(y10) && (Array.isArray(y10) || !(Symbol.iterator in y10)) && !(y10 instanceof WeakMap) && !(y10 instanceof WeakSet) && !(y10 instanceof Error) && !(y10 instanceof Number) && !(y10 instanceof Date) && !(y10 instanceof String) && !(y10 instanceof RegExp) && !(y10 instanceof ArrayBuffer), R = (y10) => {
4740
+ 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 = (y10, K) => new Proxy(y10, K), o3 = (y10) => Gi$1(y10) && !dr$1.has(y10) && (Array.isArray(y10) || !(Symbol.iterator in y10)) && !(y10 instanceof WeakMap) && !(y10 instanceof WeakSet) && !(y10 instanceof Error) && !(y10 instanceof Number) && !(y10 instanceof Date) && !(y10 instanceof String) && !(y10 instanceof RegExp) && !(y10 instanceof ArrayBuffer), O2 = (y10) => {
4741
4741
  switch (y10.status) {
4742
4742
  case "fulfilled":
4743
4743
  return y10.value;
@@ -4746,12 +4746,12 @@ function print() { __p += __j.call(arguments, '') }
4746
4746
  default:
4747
4747
  throw y10;
4748
4748
  }
4749
- }, O2 = /* @__PURE__ */ new WeakMap(), E2 = (y10, K, W = R) => {
4750
- const $10 = O2.get(y10);
4749
+ }, E2 = /* @__PURE__ */ new WeakMap(), R = (y10, K, W = O2) => {
4750
+ const $10 = E2.get(y10);
4751
4751
  if (($10 == null ? void 0 : $10[0]) === K)
4752
4752
  return $10[1];
4753
4753
  const z = Array.isArray(y10) ? [] : Object.create(Object.getPrototypeOf(y10));
4754
- return Co$1(z, true), O2.set(y10, [K, z]), Reflect.ownKeys(y10).forEach((Z10) => {
4754
+ return Co$1(z, true), E2.set(y10, [K, z]), Reflect.ownKeys(y10).forEach((Z10) => {
4755
4755
  if (Object.getOwnPropertyDescriptor(z, Z10))
4756
4756
  return;
4757
4757
  const N = Reflect.get(y10, Z10), { enumerable: V10 } = Reflect.getOwnPropertyDescriptor(
@@ -4772,7 +4772,7 @@ function print() { __p += __j.call(arguments, '') }
4772
4772
  const [he2, Y] = Oe$1.get(
4773
4773
  N
4774
4774
  );
4775
- j.value = E2(
4775
+ j.value = R(
4776
4776
  he2,
4777
4777
  Y(),
4778
4778
  W
@@ -4845,7 +4845,7 @@ function print() { __p += __j.call(arguments, '') }
4845
4845
  const Tn2 = [
4846
4846
  un2,
4847
4847
  N,
4848
- E2,
4848
+ R,
4849
4849
  Q
4850
4850
  ];
4851
4851
  return Oe$1.set(gn2, Tn2), Reflect.ownKeys(y10).forEach((C) => {
@@ -4865,9 +4865,9 @@ function print() { __p += __j.call(arguments, '') }
4865
4865
  d,
4866
4866
  w2,
4867
4867
  o3,
4868
- R,
4869
4868
  O2,
4870
4869
  E2,
4870
+ R,
4871
4871
  T,
4872
4872
  X10
4873
4873
  ], [$_$1] = K_$1();
@@ -4875,17 +4875,17 @@ function print() { __p += __j.call(arguments, '') }
4875
4875
  return $_$1(d);
4876
4876
  }
4877
4877
  function Go$1(d, w2, o3) {
4878
- const R = Oe$1.get(d);
4879
- let O2;
4880
- const E2 = [], T = R[3];
4878
+ const O2 = Oe$1.get(d);
4879
+ let E2;
4880
+ const R = [], T = O2[3];
4881
4881
  let X10 = false;
4882
4882
  const y10 = T((K) => {
4883
- if (E2.push(K), o3) {
4884
- w2(E2.splice(0));
4883
+ if (R.push(K), o3) {
4884
+ w2(R.splice(0));
4885
4885
  return;
4886
4886
  }
4887
- O2 || (O2 = Promise.resolve().then(() => {
4888
- O2 = void 0, X10 && w2(E2.splice(0));
4887
+ E2 || (E2 = Promise.resolve().then(() => {
4888
+ E2 = void 0, X10 && w2(R.splice(0));
4889
4889
  }));
4890
4890
  });
4891
4891
  return X10 = true, () => {
@@ -4893,8 +4893,8 @@ function print() { __p += __j.call(arguments, '') }
4893
4893
  };
4894
4894
  }
4895
4895
  function bo$1(d, w2) {
4896
- const o3 = Oe$1.get(d), [R, O2, E2] = o3;
4897
- return E2(R, O2(), w2);
4896
+ const o3 = Oe$1.get(d), [O2, E2, R] = o3;
4897
+ return R(O2, E2(), w2);
4898
4898
  }
4899
4899
  var zi$1 = { exports: {} }, Hi$1 = {};
4900
4900
  /**
@@ -4915,12 +4915,12 @@ function print() { __p += __j.call(arguments, '') }
4915
4915
  function w2(W, $10) {
4916
4916
  return W === $10 && (W !== 0 || 1 / W === 1 / $10) || W !== W && $10 !== $10;
4917
4917
  }
4918
- var o3 = typeof Object.is == "function" ? Object.is : w2, R = d.useState, O2 = d.useEffect, E2 = d.useLayoutEffect, T = d.useDebugValue;
4918
+ var o3 = typeof Object.is == "function" ? Object.is : w2, O2 = d.useState, E2 = d.useEffect, R = d.useLayoutEffect, T = d.useDebugValue;
4919
4919
  function X10(W, $10) {
4920
- var z = $10(), Z10 = R({ inst: { value: z, getSnapshot: $10 } }), N = Z10[0].inst, V10 = Z10[1];
4921
- return E2(function() {
4920
+ var z = $10(), Z10 = O2({ inst: { value: z, getSnapshot: $10 } }), N = Z10[0].inst, V10 = Z10[1];
4921
+ return R(function() {
4922
4922
  N.value = z, N.getSnapshot = $10, en2(N) && V10({ inst: N });
4923
- }, [W, z, $10]), O2(function() {
4923
+ }, [W, z, $10]), E2(function() {
4924
4924
  return en2(N) && V10({ inst: N }), W(function() {
4925
4925
  en2(N) && V10({ inst: N });
4926
4926
  });
@@ -4961,10 +4961,10 @@ function print() { __p += __j.call(arguments, '') }
4961
4961
  {
4962
4962
  for (var Q = arguments.length, un2 = new Array(Q > 1 ? Q - 1 : 0), sn2 = 1; sn2 < Q; sn2++)
4963
4963
  un2[sn2 - 1] = arguments[sn2];
4964
- R("error", Y, un2);
4964
+ O2("error", Y, un2);
4965
4965
  }
4966
4966
  }
4967
- function R(Y, Q, un2) {
4967
+ function O2(Y, Q, un2) {
4968
4968
  {
4969
4969
  var sn2 = w2.ReactDebugCurrentFrame, gn2 = sn2.getStackAddendum();
4970
4970
  gn2 !== "" && (Q += "%s", un2 = un2.concat([gn2]));
@@ -4974,16 +4974,16 @@ function print() { __p += __j.call(arguments, '') }
4974
4974
  Tn2.unshift("Warning: " + Q), Function.prototype.apply.call(console[Y], console, Tn2);
4975
4975
  }
4976
4976
  }
4977
- function O2(Y, Q) {
4977
+ function E2(Y, Q) {
4978
4978
  return Y === Q && (Y !== 0 || 1 / Y === 1 / Q) || Y !== Y && Q !== Q;
4979
4979
  }
4980
- var E2 = typeof Object.is == "function" ? Object.is : O2, T = d.useState, X10 = d.useEffect, en2 = d.useLayoutEffect, y10 = d.useDebugValue, K = false, W = false;
4980
+ var R = typeof Object.is == "function" ? Object.is : E2, T = d.useState, X10 = d.useEffect, en2 = d.useLayoutEffect, y10 = d.useDebugValue, K = false, W = false;
4981
4981
  function $10(Y, Q, un2) {
4982
4982
  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."));
4983
4983
  var sn2 = Q();
4984
4984
  if (!W) {
4985
4985
  var gn2 = Q();
4986
- E2(sn2, gn2) || (o3("The result of getSnapshot should be cached to avoid an infinite loop"), W = true);
4986
+ R(sn2, gn2) || (o3("The result of getSnapshot should be cached to avoid an infinite loop"), W = true);
4987
4987
  }
4988
4988
  var Tn2 = T({
4989
4989
  inst: {
@@ -5011,7 +5011,7 @@ function print() { __p += __j.call(arguments, '') }
5011
5011
  var Q = Y.getSnapshot, un2 = Y.value;
5012
5012
  try {
5013
5013
  var sn2 = Q();
5014
- return !E2(un2, sn2);
5014
+ return !R(un2, sn2);
5015
5015
  } catch {
5016
5016
  return true;
5017
5017
  }
@@ -5028,8 +5028,8 @@ function print() { __p += __j.call(arguments, '') }
5028
5028
  const X_$1 = /* @__PURE__ */ Mo$1(Z_$1), { use: Wo$1 } = React, { useSyncExternalStore: J_$1 } = X_$1;
5029
5029
  const V_$1 = /* @__PURE__ */ new WeakMap();
5030
5030
  function Ho$1(d, w2) {
5031
- const o3 = w2 == null ? void 0 : w2.sync, R = React.useRef(), O2 = React.useRef();
5032
- let E2 = true;
5031
+ const o3 = w2 == null ? void 0 : w2.sync, O2 = React.useRef(), E2 = React.useRef();
5032
+ let R = true;
5033
5033
  const T = J_$1(
5034
5034
  React.useCallback(
5035
5035
  (y10) => {
@@ -5041,23 +5041,23 @@ function print() { __p += __j.call(arguments, '') }
5041
5041
  () => {
5042
5042
  const y10 = bo$1(d, Wo$1);
5043
5043
  try {
5044
- if (!E2 && R.current && O2.current && !No$1(
5045
- R.current,
5046
- y10,
5044
+ if (!R && O2.current && E2.current && !No$1(
5047
5045
  O2.current,
5046
+ y10,
5047
+ E2.current,
5048
5048
  /* @__PURE__ */ new WeakMap()
5049
5049
  ))
5050
- return R.current;
5050
+ return O2.current;
5051
5051
  } catch {
5052
5052
  }
5053
5053
  return y10;
5054
5054
  },
5055
5055
  () => bo$1(d, Wo$1)
5056
5056
  );
5057
- E2 = false;
5057
+ R = false;
5058
5058
  const X10 = /* @__PURE__ */ new WeakMap();
5059
5059
  React.useEffect(() => {
5060
- R.current = T, O2.current = X10;
5060
+ O2.current = T, E2.current = X10;
5061
5061
  });
5062
5062
  const en2 = React.useMemo(() => /* @__PURE__ */ new WeakMap(), []);
5063
5063
  return Fo$1(
@@ -5078,8 +5078,8 @@ function print() { __p += __j.call(arguments, '') }
5078
5078
  localStorage.setItem("api", JSON.stringify(ee$1));
5079
5079
  }
5080
5080
  function j_$1(d, w2, o3) {
5081
- const R = ee$1[d] || {};
5082
- R[w2] = o3, ee$1[d] = U_$1.cloneDeep(R);
5081
+ const O2 = ee$1[d] || {};
5082
+ O2[w2] = o3, ee$1[d] = U_$1.cloneDeep(O2);
5083
5083
  }
5084
5084
  function n0$1(d, w2) {
5085
5085
  if (ee$1[d])
@@ -5118,7 +5118,9 @@ function print() { __p += __j.call(arguments, '') }
5118
5118
  return this.globals.boards;
5119
5119
  }
5120
5120
  get board() {
5121
- return this.boards.find((w2) => w2.key === this.boardKey) || {};
5121
+ return this.boards.find((w2) => w2.key === this.boardKey) || {
5122
+ zones: []
5123
+ };
5122
5124
  }
5123
5125
  get layout() {
5124
5126
  return this.board.layout || "<Screen><Text>Missing layout</Text></Screen>";
@@ -5136,17 +5138,21 @@ function print() { __p += __j.call(arguments, '') }
5136
5138
  this.globals.setLocation(`/${w2}`);
5137
5139
  }
5138
5140
  createPluginWrapper(w2) {
5139
- const o3 = this.getPluginInstance(w2), R = !!o3;
5141
+ const o3 = this.getPluginInstance(w2), O2 = !!o3;
5140
5142
  return {
5141
- available: R,
5142
- component: (O2, E2) => this.getComponent(w2, O2, E2),
5143
- screen: (O2) => this.getScreen(w2, O2),
5144
- board: (O2) => this.getBoard(w2, O2),
5143
+ available: O2,
5144
+ info: {
5145
+ components: o3 != null && o3.components ? o3.components.map((E2) => E2.key) : [],
5146
+ screens: o3 != null && o3.screens ? o3.screens.map((E2) => E2.path) : []
5147
+ },
5148
+ component: (E2, R) => this.getComponent(w2, E2, R),
5149
+ screen: (E2) => this.getScreen(w2, E2),
5150
+ board: (E2) => this.getBoard(w2, E2),
5145
5151
  api: (o3 == null ? void 0 : o3.api) || {},
5146
5152
  state: {
5147
- get: (O2, E2) => R && n0$1(w2, O2) || E2,
5148
- set: (O2, E2) => {
5149
- R && j_$1(w2, O2, E2);
5153
+ get: (E2, R) => O2 && n0$1(w2, E2) || R,
5154
+ set: (E2, R) => {
5155
+ O2 && j_$1(w2, E2, R);
5150
5156
  }
5151
5157
  }
5152
5158
  };
@@ -5163,34 +5169,34 @@ function print() { __p += __j.call(arguments, '') }
5163
5169
  getPluginInstance(w2) {
5164
5170
  return this.globals.pluginInstances[w2];
5165
5171
  }
5166
- getComponent(w2, o3, R) {
5167
- const O2 = this.getPluginInstance(w2);
5168
- if (O2) {
5169
- const E2 = O2.components && O2.components.find(
5172
+ getComponent(w2, o3, O2) {
5173
+ const E2 = this.getPluginInstance(w2);
5174
+ if (E2) {
5175
+ const R = E2.components && E2.components.find(
5170
5176
  (T) => T.key.toLowerCase() === o3.toLowerCase()
5171
5177
  );
5172
- return E2 ? E2.element(R) : void 0;
5178
+ return R ? R.element(O2) : void 0;
5173
5179
  }
5174
5180
  }
5175
5181
  getScreen(w2, o3) {
5176
5182
  if (w2) {
5177
- const R = this.getPluginInstance(w2);
5178
- if (R) {
5179
- const O2 = R.screens && R.screens.find(
5180
- (E2) => E2.path.toLowerCase() === o3.toLowerCase()
5183
+ const O2 = this.getPluginInstance(w2);
5184
+ if (O2) {
5185
+ const E2 = O2.screens && O2.screens.find(
5186
+ (R) => R.path.toLowerCase() === o3.toLowerCase()
5181
5187
  );
5182
- return O2 ? O2.element() : void 0;
5188
+ return E2 ? E2.element() : void 0;
5183
5189
  }
5184
5190
  }
5185
5191
  }
5186
5192
  getBoard(w2, o3) {
5187
5193
  if (w2) {
5188
- const R = this.getPluginInstance(w2);
5189
- if (R) {
5190
- const O2 = R.boards && R.boards.find(
5191
- (E2) => E2.key.toLowerCase() === o3.toLowerCase()
5194
+ const O2 = this.getPluginInstance(w2);
5195
+ if (O2) {
5196
+ const E2 = O2.boards && O2.boards.find(
5197
+ (R) => R.key.toLowerCase() === o3.toLowerCase()
5192
5198
  );
5193
- return O2 ? O2.element() : void 0;
5199
+ return E2 ? E2.element() : void 0;
5194
5200
  }
5195
5201
  }
5196
5202
  }
@@ -5200,8 +5206,8 @@ function print() { __p += __j.call(arguments, '') }
5200
5206
  return t0$1;
5201
5207
  }
5202
5208
  function s0(d, w2, o3) {
5203
- const R = Ho$1(ee$1);
5204
- return R && R[d] && R[d][w2] ? R[d][w2] : o3;
5209
+ const O2 = Ho$1(ee$1);
5210
+ return O2 && O2[d] && O2[d][w2] ? O2[d][w2] : o3;
5205
5211
  }
5206
5212
  var V4 = { exports: {} }, K2 = {};
5207
5213
  /**
@@ -28772,6 +28778,8 @@ Check the top-level render call using <` + w10 + ">.");
28772
28778
  return t10.text.size.xlarge;
28773
28779
  case "xxlarge":
28774
28780
  return t10.text.size.xxlarge;
28781
+ case "heading":
28782
+ return t10.text.size.heading;
28775
28783
  }
28776
28784
  }, IF1 = (t10, h10) => {
28777
28785
  if (h10 === void 0)
@@ -28793,6 +28801,8 @@ Check the top-level render call using <` + w10 + ">.");
28793
28801
  return t10.text.height.xlarge;
28794
28802
  case "xxlarge":
28795
28803
  return t10.text.height.xxlarge;
28804
+ case "heading":
28805
+ return t10.text.height.heading;
28796
28806
  }
28797
28807
  }, WF1 = (t10, h10) => {
28798
28808
  if (h10 === void 0)
@@ -49603,81 +49613,6 @@ Arguments: ` + Array.prototype.slice.call(n10).join("") + `
49603
49613
  }
49604
49614
  };
49605
49615
  window.__dek_globals = globals;
49606
- const USER_DATA_QUERY = gql(`
49607
- query userData {
49608
- currentUser {
49609
- id
49610
- name
49611
- email
49612
- location
49613
- avatar
49614
- boards {
49615
- id
49616
- title
49617
- key
49618
- layout
49619
- zones {
49620
- key
49621
- plugin
49622
- component
49623
- props {
49624
- key
49625
- value
49626
- }
49627
- containerProps {
49628
- key
49629
- value
49630
- }
49631
- }
49632
- }
49633
- commandGroups {
49634
- title
49635
- key
49636
- commands {
49637
- title
49638
- plugin
49639
- component
49640
- props {
49641
- key
49642
- value
49643
- }
49644
- }
49645
- }
49646
- }
49647
- }
49648
- `);
49649
- async function fetchUserData(email, password) {
49650
- const client = await getClient(email, password);
49651
- const response = await client.query({
49652
- query: USER_DATA_QUERY
49653
- });
49654
- return response.data.currentUser;
49655
- }
49656
- const state$1 = proxy({
49657
- plugins: {},
49658
- pluginInstances: {},
49659
- data: null,
49660
- loading: false,
49661
- version: 0
49662
- });
49663
- function updateStatePlugins(plugins) {
49664
- state$1.plugins = plugins;
49665
- }
49666
- function updateStatePluginInstances(pluginInstances) {
49667
- state$1.pluginInstances = pluginInstances;
49668
- }
49669
- function updateStateData(data) {
49670
- state$1.data = data;
49671
- }
49672
- function updateStateLoading(loading) {
49673
- state$1.loading = loading;
49674
- }
49675
- async function updateData(email, password) {
49676
- updateStateLoading(true);
49677
- const userData = await fetchUserData(email, password);
49678
- updateStateData(userData);
49679
- updateStateLoading(false);
49680
- }
49681
49616
  var lodash = { exports: {} };
49682
49617
  /**
49683
49618
  * @license
@@ -55161,6 +55096,99 @@ Arguments: ` + Array.prototype.slice.call(n10).join("") + `
55161
55096
  })(lodash, lodash.exports);
55162
55097
  var lodashExports = lodash.exports;
55163
55098
  const _ = /* @__PURE__ */ getDefaultExportFromCjs(lodashExports);
55099
+ const USER_DATA_QUERY = gql(`
55100
+ query userData {
55101
+ currentUser {
55102
+ id
55103
+ name
55104
+ email
55105
+ location
55106
+ avatar
55107
+ boards {
55108
+ id
55109
+ title
55110
+ key
55111
+ layout
55112
+ zones {
55113
+ key
55114
+ plugin
55115
+ component
55116
+ props {
55117
+ key
55118
+ value
55119
+ }
55120
+ containerProps {
55121
+ key
55122
+ value
55123
+ }
55124
+ }
55125
+ }
55126
+ commandGroups {
55127
+ title
55128
+ key
55129
+ commands {
55130
+ title
55131
+ plugin
55132
+ component
55133
+ props {
55134
+ key
55135
+ value
55136
+ }
55137
+ }
55138
+ }
55139
+ }
55140
+ }
55141
+ `);
55142
+ async function fetchUserData(email, password) {
55143
+ const client = await getClient(email, password);
55144
+ const response = await client.query({
55145
+ query: USER_DATA_QUERY
55146
+ });
55147
+ return response.data.currentUser;
55148
+ }
55149
+ const state$1 = proxy({
55150
+ plugins: {},
55151
+ pluginInstances: {},
55152
+ data: null,
55153
+ loading: false,
55154
+ version: 0
55155
+ });
55156
+ function updateStatePlugins(plugins) {
55157
+ state$1.plugins = plugins;
55158
+ }
55159
+ function updateStatePluginInstances(pluginInstances) {
55160
+ state$1.pluginInstances = pluginInstances;
55161
+ }
55162
+ function updateStateData(data) {
55163
+ state$1.data = data;
55164
+ }
55165
+ function updateStateLoading(loading) {
55166
+ state$1.loading = loading;
55167
+ }
55168
+ async function updateData(email, password, plugin) {
55169
+ updateStateLoading(true);
55170
+ let userData = await fetchUserData(email, password);
55171
+ if (plugin) {
55172
+ const pluginInstance = new plugin();
55173
+ if (pluginInstance.config && pluginInstance.config.private !== "true") {
55174
+ userData = _.cloneDeep(userData);
55175
+ userData.boards = [
55176
+ {
55177
+ id: "test-plugin",
55178
+ key: "dev",
55179
+ title: "Test Board",
55180
+ base: {
55181
+ plugin: "base",
55182
+ key: "dev"
55183
+ },
55184
+ zones: []
55185
+ }
55186
+ ];
55187
+ }
55188
+ }
55189
+ updateStateData(userData);
55190
+ updateStateLoading(false);
55191
+ }
55164
55192
  const USER_PLUGIN_AND_INTEGRATIONS_QUERY = gql(`
55165
55193
  query userPluginsAndIntegrations {
55166
55194
  currentUser {
@@ -55361,6 +55389,61 @@ Arguments: ` + Array.prototype.slice.call(n10).join("") + `
55361
55389
  /* @__PURE__ */ jsxRuntimeExports.jsx(HeaderRight, { "aria-label": "header-right", children: /* @__PURE__ */ jsxRuntimeExports.jsx(ClockComponent, { "aria-label": "clock" }) })
55362
55390
  ] });
55363
55391
  };
55392
+ const DevBoard = () => {
55393
+ const api = f0();
55394
+ const plugin = api.plugin("plugin");
55395
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(NN1, { overlay: true, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(D2, { paddingTop: 100, paddingHorz: 20, collapse: true, direction: "vert", children: [
55396
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
55397
+ _t,
55398
+ {
55399
+ size: "heading",
55400
+ weight: "heading",
55401
+ family: "heading",
55402
+ paddingBottom: 15,
55403
+ children: "Components"
55404
+ }
55405
+ ),
55406
+ /* @__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(
55407
+ jN1,
55408
+ {
55409
+ title: component,
55410
+ icon: "none",
55411
+ onClick: () => api.navigate(`/base/dev/component/${component}`)
55412
+ }
55413
+ ) }, component)) }),
55414
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
55415
+ _t,
55416
+ {
55417
+ size: "heading",
55418
+ weight: "heading",
55419
+ family: "heading",
55420
+ paddingBottom: 15,
55421
+ paddingTop: 50,
55422
+ children: "Screens"
55423
+ }
55424
+ ),
55425
+ /* @__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(
55426
+ jN1,
55427
+ {
55428
+ title: screen,
55429
+ icon: "none",
55430
+ onClick: () => api.navigate(`/plugin${screen}`)
55431
+ }
55432
+ ) }, screen)) })
55433
+ ] }) });
55434
+ };
55435
+ const EmptyBoard = () => {
55436
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(NN1, { overlay: true, children: /* @__PURE__ */ jsxRuntimeExports.jsx(D2, { paddingTop: 100, paddingHorz: 20, collapse: true, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
55437
+ _t,
55438
+ {
55439
+ size: "heading",
55440
+ weight: "heading",
55441
+ family: "heading",
55442
+ paddingBottom: 15,
55443
+ children: "No boards configured yet"
55444
+ }
55445
+ ) }) });
55446
+ };
55364
55447
  const MainBoard = () => {
55365
55448
  return /* @__PURE__ */ jsxRuntimeExports.jsx(Board, {});
55366
55449
  };
@@ -59408,6 +59491,193 @@ Arguments: ` + Array.prototype.slice.call(n10).join("") + `
59408
59491
  )) }) })
59409
59492
  ] }) });
59410
59493
  };
59494
+ const {
59495
+ useEffect,
59496
+ useLayoutEffect,
59497
+ useRef,
59498
+ useInsertionEffect: useBuiltinInsertionEffect
59499
+ } = React__namespace;
59500
+ const canUseDOM = !!(typeof window !== "undefined" && typeof window.document !== "undefined" && typeof window.document.createElement !== "undefined");
59501
+ const useIsomorphicLayoutEffect = canUseDOM ? useLayoutEffect : useEffect;
59502
+ const useInsertionEffect = useBuiltinInsertionEffect || useIsomorphicLayoutEffect;
59503
+ const useEvent = (fn2) => {
59504
+ const ref = useRef([fn2, (...args) => ref[0](...args)]).current;
59505
+ useInsertionEffect(() => {
59506
+ ref[0] = fn2;
59507
+ });
59508
+ return ref[1];
59509
+ };
59510
+ const relativePath = (base = "", path = location.pathname) => !path.toLowerCase().indexOf(base.toLowerCase()) ? path.slice(base.length) || "/" : "~" + path;
59511
+ const absolutePath = (to2, base = "") => to2[0] === "~" ? to2.slice(1) : base + to2;
59512
+ const eventPopstate = "popstate";
59513
+ const eventPushState = "pushState";
59514
+ const eventReplaceState = "replaceState";
59515
+ const eventHashchange = "hashchange";
59516
+ const events = [
59517
+ eventPopstate,
59518
+ eventPushState,
59519
+ eventReplaceState,
59520
+ eventHashchange
59521
+ ];
59522
+ const subscribeToLocationUpdates = (callback) => {
59523
+ for (const event of events) {
59524
+ addEventListener(event, callback);
59525
+ }
59526
+ return () => {
59527
+ for (const event of events) {
59528
+ removeEventListener(event, callback);
59529
+ }
59530
+ };
59531
+ };
59532
+ const useLocationProperty = (fn2, ssrFn) => shimExports.useSyncExternalStore(subscribeToLocationUpdates, fn2, ssrFn);
59533
+ const currentPathname = () => location.pathname;
59534
+ const usePathname = ({ ssrPath } = {}) => useLocationProperty(
59535
+ currentPathname,
59536
+ ssrPath ? () => ssrPath : currentPathname
59537
+ );
59538
+ const navigate = (to2, { replace = false } = {}) => history[replace ? eventReplaceState : eventPushState](null, "", to2);
59539
+ const useLocation$1 = (opts = {}) => [
59540
+ relativePath(opts.base, usePathname(opts)),
59541
+ useEvent((to2, navOpts) => navigate(absolutePath(to2, opts.base), navOpts))
59542
+ ];
59543
+ if (typeof history !== "undefined") {
59544
+ for (const type of [eventPushState, eventReplaceState]) {
59545
+ const original = history[type];
59546
+ history[type] = function() {
59547
+ const result = original.apply(this, arguments);
59548
+ const event = new Event(type);
59549
+ event.arguments = arguments;
59550
+ dispatchEvent(event);
59551
+ return result;
59552
+ };
59553
+ }
59554
+ }
59555
+ function makeMatcher(makeRegexpFn = pathToRegexp) {
59556
+ let cache = {};
59557
+ const getRegexp = (pattern) => cache[pattern] || (cache[pattern] = makeRegexpFn(pattern));
59558
+ return (pattern, path) => {
59559
+ const { regexp, keys: keys2 } = getRegexp(pattern || "");
59560
+ const out = regexp.exec(path);
59561
+ if (!out)
59562
+ return [false, null];
59563
+ const params = keys2.reduce((params2, key, i2) => {
59564
+ params2[key.name] = out[i2 + 1];
59565
+ return params2;
59566
+ }, {});
59567
+ return [true, params];
59568
+ };
59569
+ }
59570
+ const escapeRx = (str) => str.replace(/([.+*?=^!:${}()[\]|/\\])/g, "\\$1");
59571
+ const rxForSegment = (repeat, optional, prefix) => {
59572
+ let capture = repeat ? "((?:[^\\/]+?)(?:\\/(?:[^\\/]+?))*)" : "([^\\/]+?)";
59573
+ if (optional && prefix)
59574
+ capture = "(?:\\/" + capture + ")";
59575
+ return capture + (optional ? "?" : "");
59576
+ };
59577
+ const pathToRegexp = (pattern) => {
59578
+ const groupRx = /:([A-Za-z0-9_]+)([?+*]?)/g;
59579
+ let match = null, lastIndex = 0, keys2 = [], result = "";
59580
+ while ((match = groupRx.exec(pattern)) !== null) {
59581
+ const [_10, segment, mod2] = match;
59582
+ const repeat = mod2 === "+" || mod2 === "*";
59583
+ const optional = mod2 === "?" || mod2 === "*";
59584
+ const prefix = optional && pattern[match.index - 1] === "/" ? 1 : 0;
59585
+ const prev = pattern.substring(lastIndex, match.index - prefix);
59586
+ keys2.push({ name: segment });
59587
+ lastIndex = groupRx.lastIndex;
59588
+ result += escapeRx(prev) + rxForSegment(repeat, optional, prefix);
59589
+ }
59590
+ result += escapeRx(pattern.substring(lastIndex));
59591
+ return { keys: keys2, regexp: new RegExp("^" + result + "(?:\\/)?$", "i") };
59592
+ };
59593
+ const defaultRouter = {
59594
+ hook: useLocation$1,
59595
+ matcher: makeMatcher(),
59596
+ base: ""
59597
+ // this option is used to override the current location during SSR
59598
+ // ssrPath: undefined,
59599
+ };
59600
+ const RouterCtx = React.createContext(defaultRouter);
59601
+ const useRouter = () => React.useContext(RouterCtx);
59602
+ const useLocationFromRouter = (router) => router.hook(router);
59603
+ const useLocation = () => useLocationFromRouter(useRouter());
59604
+ const useRoute = (pattern) => {
59605
+ const router = useRouter();
59606
+ const [path] = useLocationFromRouter(router);
59607
+ return router.matcher(pattern, path);
59608
+ };
59609
+ const ParamsCtx = React.createContext({ params: {} });
59610
+ const useParams = () => React.useContext(ParamsCtx).params;
59611
+ const ParamsWrapper = (params, children) => React.createElement(ParamsCtx.Provider, {
59612
+ value: { params },
59613
+ children
59614
+ });
59615
+ const Route = ({ path, match, component, children }) => {
59616
+ const useRouteMatch = useRoute(path);
59617
+ const [matches, params] = match || useRouteMatch;
59618
+ if (!matches)
59619
+ return null;
59620
+ if (component)
59621
+ return ParamsWrapper(params, React.createElement(component, { params }));
59622
+ return ParamsWrapper(
59623
+ params,
59624
+ typeof children === "function" ? children(params) : children
59625
+ );
59626
+ };
59627
+ React.forwardRef((props, ref) => {
59628
+ const router = useRouter();
59629
+ const [, navigate2] = useLocationFromRouter(router);
59630
+ const { to: to2, href = to2, children, onClick } = props;
59631
+ const handleClick = useEvent((event) => {
59632
+ if (event.ctrlKey || event.metaKey || event.altKey || event.shiftKey || event.button !== 0)
59633
+ return;
59634
+ onClick && onClick(event);
59635
+ if (!event.defaultPrevented) {
59636
+ event.preventDefault();
59637
+ navigate2(to2 || href, props);
59638
+ }
59639
+ });
59640
+ const extraProps = {
59641
+ // handle nested routers and absolute paths
59642
+ href: href[0] === "~" ? href.slice(1) : router.base + href,
59643
+ onClick: handleClick,
59644
+ to: null,
59645
+ ref
59646
+ };
59647
+ const jsx = React.isValidElement(children) ? children : React.createElement("a", props);
59648
+ return React.cloneElement(jsx, extraProps);
59649
+ });
59650
+ const flattenChildren = (children) => {
59651
+ return Array.isArray(children) ? [].concat(
59652
+ ...children.map(
59653
+ (c3) => c3 && c3.type === React.Fragment ? flattenChildren(c3.props.children) : flattenChildren(c3)
59654
+ )
59655
+ ) : [children];
59656
+ };
59657
+ const Switch = ({ children, location: location2 }) => {
59658
+ const router = useRouter();
59659
+ const matcher = router.matcher;
59660
+ const [originalLocation] = useLocationFromRouter(router);
59661
+ for (const element of flattenChildren(children)) {
59662
+ let match = 0;
59663
+ if (React.isValidElement(element) && // we don't require an element to be of type Route,
59664
+ // but we do require it to contain a truthy `path` prop.
59665
+ // this allows to use different components that wrap Route
59666
+ // inside of a switch, for example <AnimatedRoute />.
59667
+ (match = element.props.path ? matcher(element.props.path, location2 || originalLocation) : [true, {}])[0])
59668
+ return React.cloneElement(element, { match });
59669
+ }
59670
+ return null;
59671
+ };
59672
+ const ComponentScreen = () => {
59673
+ const params = useParams();
59674
+ const api = f0();
59675
+ const plugin = api.plugin("plugin").component(params.componentKey);
59676
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs(NN1, { overlay: true, children: [
59677
+ /* @__PURE__ */ jsxRuntimeExports.jsx(YN1, { title: `'${params.componentKey}' Component` }),
59678
+ /* @__PURE__ */ jsxRuntimeExports.jsx(D2, { halign: "center", valign: "center", children: plugin })
59679
+ ] });
59680
+ };
59411
59681
  let Plugin$2 = class Plugin {
59412
59682
  constructor() {
59413
59683
  __publicField(this, "config", {});
@@ -59427,6 +59697,10 @@ Arguments: ` + Array.prototype.slice.call(n10).join("") + `
59427
59697
  {
59428
59698
  path: "/about",
59429
59699
  element: () => /* @__PURE__ */ jsxRuntimeExports.jsx(AboutScreen, {})
59700
+ },
59701
+ {
59702
+ path: "/dev/component/:componentKey",
59703
+ element: () => /* @__PURE__ */ jsxRuntimeExports.jsx(ComponentScreen, {})
59430
59704
  }
59431
59705
  ];
59432
59706
  }
@@ -59459,6 +59733,14 @@ Arguments: ` + Array.prototype.slice.call(n10).join("") + `
59459
59733
  {
59460
59734
  key: "main",
59461
59735
  element: () => /* @__PURE__ */ jsxRuntimeExports.jsx(MainBoard, {})
59736
+ },
59737
+ {
59738
+ key: "dev",
59739
+ element: () => /* @__PURE__ */ jsxRuntimeExports.jsx(DevBoard, {})
59740
+ },
59741
+ {
59742
+ key: "empty",
59743
+ element: () => /* @__PURE__ */ jsxRuntimeExports.jsx(EmptyBoard, {})
59462
59744
  }
59463
59745
  ];
59464
59746
  }
@@ -63368,15 +63650,15 @@ Arguments: ` + Array.prototype.slice.call(n10).join("") + `
63368
63650
  const userChanged = React.useCallback(async () => {
63369
63651
  console.log("### USER CHANGED");
63370
63652
  await updatePlugins(email, password);
63371
- await updateData(email, password);
63372
- }, [email, password]);
63653
+ await updateData(email, password, plugin);
63654
+ }, [email, password, plugin]);
63373
63655
  React.useEffect(() => {
63374
63656
  const update = async () => {
63375
63657
  await updatePlugins(email, password);
63376
63658
  if (plugin) {
63377
63659
  await updateLocalPlugin(plugin);
63378
63660
  }
63379
- await updateData(email, password);
63661
+ await updateData(email, password, plugin);
63380
63662
  await watchUser(email, password, userChanged);
63381
63663
  };
63382
63664
  update();
@@ -65342,183 +65624,6 @@ Arguments: ` + Array.prototype.slice.call(n10).join("") + `
65342
65624
  mode: modes.out
65343
65625
  };
65344
65626
  const SwitchTransition$1 = SwitchTransition;
65345
- const {
65346
- useEffect,
65347
- useLayoutEffect,
65348
- useRef,
65349
- useInsertionEffect: useBuiltinInsertionEffect
65350
- } = React__namespace;
65351
- const canUseDOM = !!(typeof window !== "undefined" && typeof window.document !== "undefined" && typeof window.document.createElement !== "undefined");
65352
- const useIsomorphicLayoutEffect = canUseDOM ? useLayoutEffect : useEffect;
65353
- const useInsertionEffect = useBuiltinInsertionEffect || useIsomorphicLayoutEffect;
65354
- const useEvent = (fn2) => {
65355
- const ref = useRef([fn2, (...args) => ref[0](...args)]).current;
65356
- useInsertionEffect(() => {
65357
- ref[0] = fn2;
65358
- });
65359
- return ref[1];
65360
- };
65361
- const relativePath = (base = "", path = location.pathname) => !path.toLowerCase().indexOf(base.toLowerCase()) ? path.slice(base.length) || "/" : "~" + path;
65362
- const absolutePath = (to2, base = "") => to2[0] === "~" ? to2.slice(1) : base + to2;
65363
- const eventPopstate = "popstate";
65364
- const eventPushState = "pushState";
65365
- const eventReplaceState = "replaceState";
65366
- const eventHashchange = "hashchange";
65367
- const events = [
65368
- eventPopstate,
65369
- eventPushState,
65370
- eventReplaceState,
65371
- eventHashchange
65372
- ];
65373
- const subscribeToLocationUpdates = (callback) => {
65374
- for (const event of events) {
65375
- addEventListener(event, callback);
65376
- }
65377
- return () => {
65378
- for (const event of events) {
65379
- removeEventListener(event, callback);
65380
- }
65381
- };
65382
- };
65383
- const useLocationProperty = (fn2, ssrFn) => shimExports.useSyncExternalStore(subscribeToLocationUpdates, fn2, ssrFn);
65384
- const currentPathname = () => location.pathname;
65385
- const usePathname = ({ ssrPath } = {}) => useLocationProperty(
65386
- currentPathname,
65387
- ssrPath ? () => ssrPath : currentPathname
65388
- );
65389
- const navigate = (to2, { replace = false } = {}) => history[replace ? eventReplaceState : eventPushState](null, "", to2);
65390
- const useLocation$1 = (opts = {}) => [
65391
- relativePath(opts.base, usePathname(opts)),
65392
- useEvent((to2, navOpts) => navigate(absolutePath(to2, opts.base), navOpts))
65393
- ];
65394
- if (typeof history !== "undefined") {
65395
- for (const type of [eventPushState, eventReplaceState]) {
65396
- const original = history[type];
65397
- history[type] = function() {
65398
- const result = original.apply(this, arguments);
65399
- const event = new Event(type);
65400
- event.arguments = arguments;
65401
- dispatchEvent(event);
65402
- return result;
65403
- };
65404
- }
65405
- }
65406
- function makeMatcher(makeRegexpFn = pathToRegexp) {
65407
- let cache = {};
65408
- const getRegexp = (pattern) => cache[pattern] || (cache[pattern] = makeRegexpFn(pattern));
65409
- return (pattern, path) => {
65410
- const { regexp, keys: keys2 } = getRegexp(pattern || "");
65411
- const out = regexp.exec(path);
65412
- if (!out)
65413
- return [false, null];
65414
- const params = keys2.reduce((params2, key, i2) => {
65415
- params2[key.name] = out[i2 + 1];
65416
- return params2;
65417
- }, {});
65418
- return [true, params];
65419
- };
65420
- }
65421
- const escapeRx = (str) => str.replace(/([.+*?=^!:${}()[\]|/\\])/g, "\\$1");
65422
- const rxForSegment = (repeat, optional, prefix) => {
65423
- let capture = repeat ? "((?:[^\\/]+?)(?:\\/(?:[^\\/]+?))*)" : "([^\\/]+?)";
65424
- if (optional && prefix)
65425
- capture = "(?:\\/" + capture + ")";
65426
- return capture + (optional ? "?" : "");
65427
- };
65428
- const pathToRegexp = (pattern) => {
65429
- const groupRx = /:([A-Za-z0-9_]+)([?+*]?)/g;
65430
- let match = null, lastIndex = 0, keys2 = [], result = "";
65431
- while ((match = groupRx.exec(pattern)) !== null) {
65432
- const [_10, segment, mod2] = match;
65433
- const repeat = mod2 === "+" || mod2 === "*";
65434
- const optional = mod2 === "?" || mod2 === "*";
65435
- const prefix = optional && pattern[match.index - 1] === "/" ? 1 : 0;
65436
- const prev = pattern.substring(lastIndex, match.index - prefix);
65437
- keys2.push({ name: segment });
65438
- lastIndex = groupRx.lastIndex;
65439
- result += escapeRx(prev) + rxForSegment(repeat, optional, prefix);
65440
- }
65441
- result += escapeRx(pattern.substring(lastIndex));
65442
- return { keys: keys2, regexp: new RegExp("^" + result + "(?:\\/)?$", "i") };
65443
- };
65444
- const defaultRouter = {
65445
- hook: useLocation$1,
65446
- matcher: makeMatcher(),
65447
- base: ""
65448
- // this option is used to override the current location during SSR
65449
- // ssrPath: undefined,
65450
- };
65451
- const RouterCtx = React.createContext(defaultRouter);
65452
- const useRouter = () => React.useContext(RouterCtx);
65453
- const useLocationFromRouter = (router) => router.hook(router);
65454
- const useLocation = () => useLocationFromRouter(useRouter());
65455
- const useRoute = (pattern) => {
65456
- const router = useRouter();
65457
- const [path] = useLocationFromRouter(router);
65458
- return router.matcher(pattern, path);
65459
- };
65460
- const ParamsCtx = React.createContext({ params: {} });
65461
- const ParamsWrapper = (params, children) => React.createElement(ParamsCtx.Provider, {
65462
- value: { params },
65463
- children
65464
- });
65465
- const Route = ({ path, match, component, children }) => {
65466
- const useRouteMatch = useRoute(path);
65467
- const [matches, params] = match || useRouteMatch;
65468
- if (!matches)
65469
- return null;
65470
- if (component)
65471
- return ParamsWrapper(params, React.createElement(component, { params }));
65472
- return ParamsWrapper(
65473
- params,
65474
- typeof children === "function" ? children(params) : children
65475
- );
65476
- };
65477
- React.forwardRef((props, ref) => {
65478
- const router = useRouter();
65479
- const [, navigate2] = useLocationFromRouter(router);
65480
- const { to: to2, href = to2, children, onClick } = props;
65481
- const handleClick = useEvent((event) => {
65482
- if (event.ctrlKey || event.metaKey || event.altKey || event.shiftKey || event.button !== 0)
65483
- return;
65484
- onClick && onClick(event);
65485
- if (!event.defaultPrevented) {
65486
- event.preventDefault();
65487
- navigate2(to2 || href, props);
65488
- }
65489
- });
65490
- const extraProps = {
65491
- // handle nested routers and absolute paths
65492
- href: href[0] === "~" ? href.slice(1) : router.base + href,
65493
- onClick: handleClick,
65494
- to: null,
65495
- ref
65496
- };
65497
- const jsx = React.isValidElement(children) ? children : React.createElement("a", props);
65498
- return React.cloneElement(jsx, extraProps);
65499
- });
65500
- const flattenChildren = (children) => {
65501
- return Array.isArray(children) ? [].concat(
65502
- ...children.map(
65503
- (c3) => c3 && c3.type === React.Fragment ? flattenChildren(c3.props.children) : flattenChildren(c3)
65504
- )
65505
- ) : [children];
65506
- };
65507
- const Switch = ({ children, location: location2 }) => {
65508
- const router = useRouter();
65509
- const matcher = router.matcher;
65510
- const [originalLocation] = useLocationFromRouter(router);
65511
- for (const element of flattenChildren(children)) {
65512
- let match = 0;
65513
- if (React.isValidElement(element) && // we don't require an element to be of type Route,
65514
- // but we do require it to contain a truthy `path` prop.
65515
- // this allows to use different components that wrap Route
65516
- // inside of a switch, for example <AnimatedRoute />.
65517
- (match = element.props.path ? matcher(element.props.path, location2 || originalLocation) : [true, {}])[0])
65518
- return React.cloneElement(element, { match });
65519
- }
65520
- return null;
65521
- };
65522
65627
  const RouteResolver = ({ route }) => {
65523
65628
  const api = f0();
65524
65629
  const resolveRouteElement = (route2) => {
@@ -65532,15 +65637,24 @@ Arguments: ` + Array.prototype.slice.call(n10).join("") + `
65532
65637
  const board = api.boards.find(
65533
65638
  (b10) => b10.key === api.boardKey
65534
65639
  );
65535
- if (board && board.base) {
65536
- const boardElement = api.plugin(board.base.plugin).board(board.base.key);
65537
- if (boardElement) {
65538
- return boardElement;
65640
+ if (board) {
65641
+ if (board.base) {
65642
+ const boardElement = api.plugin(board.base.plugin).board(board.base.key);
65643
+ if (boardElement) {
65644
+ return boardElement;
65645
+ }
65646
+ } else {
65647
+ return api.plugin(defaultBase.plugin).board(defaultBase.key);
65539
65648
  }
65540
65649
  }
65541
- return api.plugin(defaultBase.plugin).board(defaultBase.key);
65650
+ const devBoard = api.plugin("plugin").board(api.boardKey);
65651
+ if (devBoard) {
65652
+ return devBoard;
65653
+ }
65654
+ return api.plugin(defaultBase.plugin).board(api.boardKey);
65542
65655
  }
65543
65656
  };
65657
+ console.log("### ROUTE", route);
65544
65658
  return resolveRouteElement(route);
65545
65659
  };
65546
65660
  const Container$1 = styled.div`
@@ -65554,14 +65668,18 @@ Arguments: ` + Array.prototype.slice.call(n10).join("") + `
65554
65668
  flex-direction: column;
65555
65669
  overflow: hidden;
65556
65670
  `;
65557
- const Router = ({ userConfig }) => {
65671
+ const Router = ({ userConfig, transitionDelay: transitionDelay2 }) => {
65558
65672
  const [routes, setRoutes] = React.useState([]);
65673
+ const [boardKeys, setBoardKeys] = React.useState([]);
65559
65674
  const [location2, setLocation] = useLocation();
65675
+ const [container, setContainer] = React.useState(null);
65676
+ const [containerNodeRef, setContainerNodeRef] = React.useState(null);
65560
65677
  const { data, pluginInstances } = userConfig;
65561
65678
  React.useEffect(() => {
65562
65679
  const loadRoutes = async () => {
65563
- var _a2;
65680
+ var _a2, _b2;
65564
65681
  const newRoutes = [];
65682
+ const newBoardKeys = [];
65565
65683
  if (pluginInstances) {
65566
65684
  for (const key in pluginInstances) {
65567
65685
  (_a2 = pluginInstances[key].screens) == null ? void 0 : _a2.forEach((screen) => {
@@ -65573,45 +65691,70 @@ Arguments: ` + Array.prototype.slice.call(n10).join("") + `
65573
65691
  nodeRef: React.createRef()
65574
65692
  });
65575
65693
  });
65694
+ (_b2 = pluginInstances[key].boards) == null ? void 0 : _b2.forEach((board) => {
65695
+ newBoardKeys.push("/" + board.key);
65696
+ });
65576
65697
  }
65577
65698
  }
65699
+ (data == null ? void 0 : data.boards) && data.boards.forEach((board) => {
65700
+ newBoardKeys.push("/" + board.key);
65701
+ });
65578
65702
  newRoutes.push({
65579
65703
  type: "root",
65580
65704
  route: `/:boardKey`,
65581
65705
  nodeRef: React.createRef()
65582
65706
  });
65583
- console.log("### LOADED ROUTES", newRoutes);
65707
+ console.log("### LOADED ROUTES", newRoutes, newBoardKeys);
65584
65708
  setRoutes(newRoutes);
65709
+ setBoardKeys(newBoardKeys);
65585
65710
  };
65586
65711
  loadRoutes();
65587
- }, [pluginInstances]);
65712
+ }, [pluginInstances, data == null ? void 0 : data.boards]);
65713
+ React.useEffect(() => {
65714
+ const { nodeRef } = routes.find((route) => {
65715
+ let path = "/:boardKey";
65716
+ const tokens2 = location2.split("/");
65717
+ tokens2.shift();
65718
+ if (tokens2.length > 2) {
65719
+ tokens2.shift();
65720
+ path += "/" + tokens2.join("/");
65721
+ }
65722
+ return route.path === path;
65723
+ }) ?? {};
65724
+ const containerComponent = /* @__PURE__ */ jsxRuntimeExports.jsx(Container$1, { "aria-label": "router", ref: nodeRef, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Switch, { children: routes.map((route) => {
65725
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(Route, { path: route.route, children: (params) => {
65726
+ globals.boardKey = params.boardKey || "#error";
65727
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(RouteResolver, { route });
65728
+ } }, route.route);
65729
+ }) }) });
65730
+ console.log("### SETTING CONTAINER");
65731
+ setContainerNodeRef(nodeRef);
65732
+ setContainer(containerComponent);
65733
+ }, [location2, routes]);
65588
65734
  if (!data) {
65589
65735
  return null;
65590
65736
  }
65591
- const { nodeRef } = routes.find((route) => {
65592
- let path = "/:boardKey";
65593
- const tokens2 = location2.split("/");
65594
- tokens2.shift();
65595
- if (tokens2.length > 2) {
65596
- tokens2.shift();
65597
- path += "/" + tokens2.join("/");
65737
+ const defaultBoard = data.boards.length > 0 ? data.boards[0].key : "empty";
65738
+ if (location2 === "/") {
65739
+ setLocation(`/${defaultBoard}`);
65740
+ } else {
65741
+ const exists = boardKeys.some((key) => location2.startsWith(key));
65742
+ if (!exists) {
65743
+ setLocation(`/${defaultBoard}`);
65598
65744
  }
65599
- return route.path === path;
65600
- }) ?? {};
65745
+ }
65601
65746
  globals.setLocation = setLocation;
65747
+ if (transitionDelay2 <= 0) {
65748
+ return container;
65749
+ }
65602
65750
  return /* @__PURE__ */ jsxRuntimeExports.jsx(SwitchTransition$1, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
65603
65751
  CSSTransition$1,
65604
65752
  {
65605
- nodeRef,
65606
- timeout: 50,
65753
+ nodeRef: containerNodeRef,
65754
+ timeout: transitionDelay2,
65607
65755
  classNames: "page",
65608
65756
  unmountOnExit: true,
65609
- children: () => /* @__PURE__ */ jsxRuntimeExports.jsx(Container$1, { "aria-label": "router", ref: nodeRef, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Switch, { children: routes.map((route) => {
65610
- return /* @__PURE__ */ jsxRuntimeExports.jsx(Route, { path: route.route, children: (params) => {
65611
- globals.boardKey = params.boardKey || "#error";
65612
- return /* @__PURE__ */ jsxRuntimeExports.jsx(RouteResolver, { route });
65613
- } }, route.route);
65614
- }) }) })
65757
+ children: () => container
65615
65758
  },
65616
65759
  location2
65617
65760
  ) });
@@ -65677,8 +65820,8 @@ body {
65677
65820
  opacity: 1;
65678
65821
  transform: scale(1);
65679
65822
  transition:
65680
- opacity 50ms,
65681
- transform 50ms;
65823
+ opacity ${({ $transitionDelay }) => $transitionDelay}ms,
65824
+ transform ${({ $transitionDelay }) => $transitionDelay}ms;
65682
65825
  }
65683
65826
 
65684
65827
  .page-exit {
@@ -65690,8 +65833,8 @@ body {
65690
65833
  opacity: 0;
65691
65834
  transform: scale(0.95);
65692
65835
  transition:
65693
- opacity 50ms,
65694
- transform 50ms;
65836
+ opacity ${({ $transitionDelay }) => $transitionDelay}ms,
65837
+ transform ${({ $transitionDelay }) => $transitionDelay}ms;
65695
65838
  }
65696
65839
 
65697
65840
  /* scrollbar */
@@ -65719,14 +65862,16 @@ body {
65719
65862
  }
65720
65863
 
65721
65864
  `;
65865
+ const zoom = 1;
65866
+ const transitionDelay = 0;
65722
65867
  const BoardProvider = ({ email, password, plugin }) => {
65723
65868
  const config2 = useUserConfig(email, password, plugin);
65724
65869
  const api = f0();
65725
- console.log("BoardProvider", { config: config2, api });
65870
+ console.log("### LOADED", config2, api);
65726
65871
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(styled.ThemeProvider, { theme: LT1, children: [
65727
- /* @__PURE__ */ jsxRuntimeExports.jsx(BoardStyles, { $zoom: 1 }),
65872
+ /* @__PURE__ */ jsxRuntimeExports.jsx(BoardStyles, { $zoom: zoom, $transitionDelay: transitionDelay }),
65728
65873
  /* @__PURE__ */ jsxRuntimeExports.jsx(Background, {}),
65729
- /* @__PURE__ */ jsxRuntimeExports.jsx(Router, { userConfig: config2 }),
65874
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Router, { userConfig: config2, transitionDelay }),
65730
65875
  config2.loading && /* @__PURE__ */ jsxRuntimeExports.jsx(UN1, {})
65731
65876
  ] });
65732
65877
  };