@valbuild/react 0.33.0 → 0.35.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (28) hide show
  1. package/dist/{ValProvider-0620664e.esm.js → ValProvider-05e0ada2.esm.js} +9 -18
  2. package/dist/{ValProvider-7513c6ec.cjs.dev.js → ValProvider-396d7da7.cjs.dev.js} +9 -18
  3. package/dist/{ValProvider-14179159.browser.esm.js → ValProvider-9be9362b.browser.esm.js} +9 -18
  4. package/dist/ValProvider-d9e0b778.cjs.js +7 -0
  5. package/dist/{ValProvider-b2e83d12.cjs.prod.js → ValProvider-d9e0b778.cjs.prod.js} +9 -18
  6. package/dist/{ValProvider-d46ec16a.worker.esm.js → ValProvider-e745414d.worker.esm.js} +9 -18
  7. package/dist/{ValUI-4ba5efea.esm.js → ValUI-0091169b.esm.js} +7 -4
  8. package/dist/{ValUI-75338157.browser.esm.js → ValUI-053ef45d.browser.esm.js} +7 -4
  9. package/dist/{ValUI-33562b10.cjs.dev.js → ValUI-3a6c5666.cjs.dev.js} +7 -4
  10. package/dist/{ValUI-3b9f6c17.worker.esm.js → ValUI-400cffb5.worker.esm.js} +7 -4
  11. package/dist/ValUI-41cd1ce0.cjs.js +7 -0
  12. package/dist/{ValUI-8ea90ec3.cjs.prod.js → ValUI-41cd1ce0.cjs.prod.js} +7 -4
  13. package/dist/declarations/src/internal/ValProvider.d.ts +2 -1
  14. package/dist/declarations/src/internal/ValRichText.d.ts +9 -13
  15. package/dist/declarations/src/stega/stegaEncode.d.ts +1 -0
  16. package/internal/dist/valbuild-react-internal.browser.esm.js +3 -3
  17. package/internal/dist/valbuild-react-internal.cjs.dev.js +3 -3
  18. package/internal/dist/valbuild-react-internal.cjs.prod.js +3 -3
  19. package/internal/dist/valbuild-react-internal.esm.js +3 -3
  20. package/internal/dist/valbuild-react-internal.worker.esm.js +3 -3
  21. package/package.json +5 -5
  22. package/stega/dist/valbuild-react-stega.browser.esm.js +1 -1
  23. package/stega/dist/valbuild-react-stega.cjs.dev.js +1 -1
  24. package/stega/dist/valbuild-react-stega.cjs.prod.js +1 -1
  25. package/stega/dist/valbuild-react-stega.esm.js +1 -1
  26. package/stega/dist/valbuild-react-stega.worker.esm.js +1 -1
  27. package/dist/ValProvider-b2e83d12.cjs.js +0 -7
  28. package/dist/ValUI-8ea90ec3.cjs.js +0 -7
@@ -482,7 +482,7 @@ var ValStore = /*#__PURE__*/function () {
482
482
  while (1) switch (_context3.prev = _context3.next) {
483
483
  case 0:
484
484
  _context3.next = 2;
485
- return this.api.getModules({
485
+ return this.api.getTree({
486
486
  patch: true,
487
487
  includeSource: true
488
488
  });
@@ -545,7 +545,7 @@ var ValStore = /*#__PURE__*/function () {
545
545
  _context3.next = 17;
546
546
  break;
547
547
  case 16:
548
- console.error("Val: failed to update modules", data.error.message);
548
+ console.error("Val: failed to update modules", data.error);
549
549
  case 17:
550
550
  case "end":
551
551
  return _context3.stop();
@@ -597,10 +597,11 @@ var ValContext = typeof window !== "undefined" ? /*#__PURE__*/React.createContex
597
597
  valApi: undefined
598
598
  }) : undefined;
599
599
  var ValUI = /*#__PURE__*/lazy(function () {
600
- return import('./ValUI-4ba5efea.esm.js');
600
+ return import('./ValUI-0091169b.esm.js');
601
601
  });
602
602
  function ValProvider(_ref) {
603
- var children = _ref.children;
603
+ var children = _ref.children,
604
+ onSubmit = _ref.onSubmit;
604
605
  var host = "/api/val";
605
606
  var api = useMemo(function () {
606
607
  return new ValApi(host);
@@ -616,12 +617,6 @@ function ValProvider(_ref) {
616
617
  _useState4 = _slicedToArray(_useState3, 2),
617
618
  enabled = _useState4[0],
618
619
  setEnabled = _useState4[1];
619
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
620
- var _useState5 = useState(false),
621
- _useState6 = _slicedToArray(_useState5, 2);
622
- _useState6[0];
623
- var setDraftMode = _useState6[1]; // TODO: if enabled, but not in draft mode: show something
624
-
625
620
  useEffect(function () {
626
621
  setIsClient(true);
627
622
  try {
@@ -631,13 +626,6 @@ function ValProvider(_ref) {
631
626
  } catch (e) {
632
627
  console.warn("Could not read Val enabled state", e);
633
628
  }
634
- try {
635
- var _document$cookie2;
636
- var valDraftMode = (_document$cookie2 = document.cookie) === null || _document$cookie2 === void 0 ? void 0 : _document$cookie2.includes("".concat(Internal.VAL_DRAFT_MODE_COOKIE, "=true"));
637
- setDraftMode(valDraftMode);
638
- } catch (e) {
639
- console.warn("Could not read Val draft mode", e);
640
- }
641
629
  }, []);
642
630
  if (isClient && !enabled && process.env.NODE_ENV === "development") {
643
631
  if (!api) {
@@ -656,7 +644,10 @@ function ValProvider(_ref) {
656
644
  valApi: api,
657
645
  valStore: store
658
646
  },
659
- children: [children, /*#__PURE__*/jsx(ValUI, {})]
647
+ children: [children, /*#__PURE__*/jsx(ValUI, {
648
+ host: host,
649
+ onSubmit: onSubmit
650
+ })]
660
651
  });
661
652
  }
662
653
 
@@ -508,7 +508,7 @@ var ValStore = /*#__PURE__*/function () {
508
508
  while (1) switch (_context3.prev = _context3.next) {
509
509
  case 0:
510
510
  _context3.next = 2;
511
- return this.api.getModules({
511
+ return this.api.getTree({
512
512
  patch: true,
513
513
  includeSource: true
514
514
  });
@@ -571,7 +571,7 @@ var ValStore = /*#__PURE__*/function () {
571
571
  _context3.next = 17;
572
572
  break;
573
573
  case 16:
574
- console.error("Val: failed to update modules", data.error.message);
574
+ console.error("Val: failed to update modules", data.error);
575
575
  case 17:
576
576
  case "end":
577
577
  return _context3.stop();
@@ -623,10 +623,11 @@ var ValContext = typeof window !== "undefined" ? /*#__PURE__*/React__default["de
623
623
  valApi: undefined
624
624
  }) : undefined;
625
625
  var ValUI = /*#__PURE__*/React.lazy(function () {
626
- return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require('./ValUI-33562b10.cjs.dev.js')); });
626
+ return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require('./ValUI-3a6c5666.cjs.dev.js')); });
627
627
  });
628
628
  function ValProvider(_ref) {
629
- var children = _ref.children;
629
+ var children = _ref.children,
630
+ onSubmit = _ref.onSubmit;
630
631
  var host = "/api/val";
631
632
  var api = React.useMemo(function () {
632
633
  return new core.ValApi(host);
@@ -642,12 +643,6 @@ function ValProvider(_ref) {
642
643
  _useState4 = slicedToArray._slicedToArray(_useState3, 2),
643
644
  enabled = _useState4[0],
644
645
  setEnabled = _useState4[1];
645
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
646
- var _useState5 = React.useState(false),
647
- _useState6 = slicedToArray._slicedToArray(_useState5, 2);
648
- _useState6[0];
649
- var setDraftMode = _useState6[1]; // TODO: if enabled, but not in draft mode: show something
650
-
651
646
  React.useEffect(function () {
652
647
  setIsClient(true);
653
648
  try {
@@ -657,13 +652,6 @@ function ValProvider(_ref) {
657
652
  } catch (e) {
658
653
  console.warn("Could not read Val enabled state", e);
659
654
  }
660
- try {
661
- var _document$cookie2;
662
- var valDraftMode = (_document$cookie2 = document.cookie) === null || _document$cookie2 === void 0 ? void 0 : _document$cookie2.includes("".concat(core.Internal.VAL_DRAFT_MODE_COOKIE, "=true"));
663
- setDraftMode(valDraftMode);
664
- } catch (e) {
665
- console.warn("Could not read Val draft mode", e);
666
- }
667
655
  }, []);
668
656
  if (isClient && !enabled && process.env.NODE_ENV === "development") {
669
657
  if (!api) {
@@ -682,7 +670,10 @@ function ValProvider(_ref) {
682
670
  valApi: api,
683
671
  valStore: store
684
672
  },
685
- children: [children, /*#__PURE__*/ReactJSXRuntime.jsx(ValUI, {})]
673
+ children: [children, /*#__PURE__*/ReactJSXRuntime.jsx(ValUI, {
674
+ host: host,
675
+ onSubmit: onSubmit
676
+ })]
686
677
  });
687
678
  }
688
679
 
@@ -482,7 +482,7 @@ var ValStore = /*#__PURE__*/function () {
482
482
  while (1) switch (_context3.prev = _context3.next) {
483
483
  case 0:
484
484
  _context3.next = 2;
485
- return this.api.getModules({
485
+ return this.api.getTree({
486
486
  patch: true,
487
487
  includeSource: true
488
488
  });
@@ -545,7 +545,7 @@ var ValStore = /*#__PURE__*/function () {
545
545
  _context3.next = 17;
546
546
  break;
547
547
  case 16:
548
- console.error("Val: failed to update modules", data.error.message);
548
+ console.error("Val: failed to update modules", data.error);
549
549
  case 17:
550
550
  case "end":
551
551
  return _context3.stop();
@@ -597,10 +597,11 @@ var ValContext = /*#__PURE__*/React.createContext({
597
597
  valApi: undefined
598
598
  }) ;
599
599
  var ValUI = /*#__PURE__*/lazy(function () {
600
- return import('./ValUI-75338157.browser.esm.js');
600
+ return import('./ValUI-053ef45d.browser.esm.js');
601
601
  });
602
602
  function ValProvider(_ref) {
603
- var children = _ref.children;
603
+ var children = _ref.children,
604
+ onSubmit = _ref.onSubmit;
604
605
  var host = "/api/val";
605
606
  var api = useMemo(function () {
606
607
  return new ValApi(host);
@@ -616,12 +617,6 @@ function ValProvider(_ref) {
616
617
  _useState4 = _slicedToArray(_useState3, 2),
617
618
  enabled = _useState4[0],
618
619
  setEnabled = _useState4[1];
619
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
620
- var _useState5 = useState(false),
621
- _useState6 = _slicedToArray(_useState5, 2);
622
- _useState6[0];
623
- var setDraftMode = _useState6[1]; // TODO: if enabled, but not in draft mode: show something
624
-
625
620
  useEffect(function () {
626
621
  setIsClient(true);
627
622
  try {
@@ -631,13 +626,6 @@ function ValProvider(_ref) {
631
626
  } catch (e) {
632
627
  console.warn("Could not read Val enabled state", e);
633
628
  }
634
- try {
635
- var _document$cookie2;
636
- var valDraftMode = (_document$cookie2 = document.cookie) === null || _document$cookie2 === void 0 ? void 0 : _document$cookie2.includes("".concat(Internal.VAL_DRAFT_MODE_COOKIE, "=true"));
637
- setDraftMode(valDraftMode);
638
- } catch (e) {
639
- console.warn("Could not read Val draft mode", e);
640
- }
641
629
  }, []);
642
630
  if (isClient && !enabled && process.env.NODE_ENV === "development") {
643
631
  if (!api) {
@@ -656,7 +644,10 @@ function ValProvider(_ref) {
656
644
  valApi: api,
657
645
  valStore: store
658
646
  },
659
- children: [children, /*#__PURE__*/jsx(ValUI, {})]
647
+ children: [children, /*#__PURE__*/jsx(ValUI, {
648
+ host: host,
649
+ onSubmit: onSubmit
650
+ })]
660
651
  });
661
652
  }
662
653
 
@@ -0,0 +1,7 @@
1
+ 'use strict';
2
+
3
+ if (process.env.NODE_ENV === "production") {
4
+ module.exports = require("./ValProvider-d9e0b778.cjs.prod.js");
5
+ } else {
6
+ module.exports = require("./ValProvider-d9e0b778.cjs.dev.js");
7
+ }
@@ -508,7 +508,7 @@ var ValStore = /*#__PURE__*/function () {
508
508
  while (1) switch (_context3.prev = _context3.next) {
509
509
  case 0:
510
510
  _context3.next = 2;
511
- return this.api.getModules({
511
+ return this.api.getTree({
512
512
  patch: true,
513
513
  includeSource: true
514
514
  });
@@ -571,7 +571,7 @@ var ValStore = /*#__PURE__*/function () {
571
571
  _context3.next = 17;
572
572
  break;
573
573
  case 16:
574
- console.error("Val: failed to update modules", data.error.message);
574
+ console.error("Val: failed to update modules", data.error);
575
575
  case 17:
576
576
  case "end":
577
577
  return _context3.stop();
@@ -623,10 +623,11 @@ var ValContext = typeof window !== "undefined" ? /*#__PURE__*/React__default["de
623
623
  valApi: undefined
624
624
  }) : undefined;
625
625
  var ValUI = /*#__PURE__*/React.lazy(function () {
626
- return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require('./ValUI-8ea90ec3.cjs.prod.js')); });
626
+ return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require('./ValUI-41cd1ce0.cjs.prod.js')); });
627
627
  });
628
628
  function ValProvider(_ref) {
629
- var children = _ref.children;
629
+ var children = _ref.children,
630
+ onSubmit = _ref.onSubmit;
630
631
  var host = "/api/val";
631
632
  var api = React.useMemo(function () {
632
633
  return new core.ValApi(host);
@@ -642,12 +643,6 @@ function ValProvider(_ref) {
642
643
  _useState4 = slicedToArray._slicedToArray(_useState3, 2),
643
644
  enabled = _useState4[0],
644
645
  setEnabled = _useState4[1];
645
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
646
- var _useState5 = React.useState(false),
647
- _useState6 = slicedToArray._slicedToArray(_useState5, 2);
648
- _useState6[0];
649
- var setDraftMode = _useState6[1]; // TODO: if enabled, but not in draft mode: show something
650
-
651
646
  React.useEffect(function () {
652
647
  setIsClient(true);
653
648
  try {
@@ -657,13 +652,6 @@ function ValProvider(_ref) {
657
652
  } catch (e) {
658
653
  console.warn("Could not read Val enabled state", e);
659
654
  }
660
- try {
661
- var _document$cookie2;
662
- var valDraftMode = (_document$cookie2 = document.cookie) === null || _document$cookie2 === void 0 ? void 0 : _document$cookie2.includes("".concat(core.Internal.VAL_DRAFT_MODE_COOKIE, "=true"));
663
- setDraftMode(valDraftMode);
664
- } catch (e) {
665
- console.warn("Could not read Val draft mode", e);
666
- }
667
655
  }, []);
668
656
  if (isClient && !enabled && "production" === "development") {
669
657
  if (!api) {
@@ -682,7 +670,10 @@ function ValProvider(_ref) {
682
670
  valApi: api,
683
671
  valStore: store
684
672
  },
685
- children: [children, /*#__PURE__*/ReactJSXRuntime.jsx(ValUI, {})]
673
+ children: [children, /*#__PURE__*/ReactJSXRuntime.jsx(ValUI, {
674
+ host: host,
675
+ onSubmit: onSubmit
676
+ })]
686
677
  });
687
678
  }
688
679
 
@@ -482,7 +482,7 @@ var ValStore = /*#__PURE__*/function () {
482
482
  while (1) switch (_context3.prev = _context3.next) {
483
483
  case 0:
484
484
  _context3.next = 2;
485
- return this.api.getModules({
485
+ return this.api.getTree({
486
486
  patch: true,
487
487
  includeSource: true
488
488
  });
@@ -545,7 +545,7 @@ var ValStore = /*#__PURE__*/function () {
545
545
  _context3.next = 17;
546
546
  break;
547
547
  case 16:
548
- console.error("Val: failed to update modules", data.error.message);
548
+ console.error("Val: failed to update modules", data.error);
549
549
  case 17:
550
550
  case "end":
551
551
  return _context3.stop();
@@ -592,10 +592,11 @@ var useValApi = function useValApi() {
592
592
  };
593
593
  var ValContext = undefined;
594
594
  var ValUI = /*#__PURE__*/lazy(function () {
595
- return import('./ValUI-3b9f6c17.worker.esm.js');
595
+ return import('./ValUI-400cffb5.worker.esm.js');
596
596
  });
597
597
  function ValProvider(_ref) {
598
- var children = _ref.children;
598
+ var children = _ref.children,
599
+ onSubmit = _ref.onSubmit;
599
600
  var host = "/api/val";
600
601
  var api = useMemo(function () {
601
602
  return new ValApi(host);
@@ -611,12 +612,6 @@ function ValProvider(_ref) {
611
612
  _useState4 = _slicedToArray(_useState3, 2),
612
613
  enabled = _useState4[0],
613
614
  setEnabled = _useState4[1];
614
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
615
- var _useState5 = useState(false),
616
- _useState6 = _slicedToArray(_useState5, 2);
617
- _useState6[0];
618
- var setDraftMode = _useState6[1]; // TODO: if enabled, but not in draft mode: show something
619
-
620
615
  useEffect(function () {
621
616
  setIsClient(true);
622
617
  try {
@@ -626,13 +621,6 @@ function ValProvider(_ref) {
626
621
  } catch (e) {
627
622
  console.warn("Could not read Val enabled state", e);
628
623
  }
629
- try {
630
- var _document$cookie2;
631
- var valDraftMode = (_document$cookie2 = document.cookie) === null || _document$cookie2 === void 0 ? void 0 : _document$cookie2.includes("".concat(Internal.VAL_DRAFT_MODE_COOKIE, "=true"));
632
- setDraftMode(valDraftMode);
633
- } catch (e) {
634
- console.warn("Could not read Val draft mode", e);
635
- }
636
624
  }, []);
637
625
  if (isClient && !enabled && process.env.NODE_ENV === "development") {
638
626
  if (!api) {
@@ -651,7 +639,10 @@ function ValProvider(_ref) {
651
639
  valApi: api,
652
640
  valStore: store
653
641
  },
654
- children: [children, /*#__PURE__*/jsx(ValUI, {})]
642
+ children: [children, /*#__PURE__*/jsx(ValUI, {
643
+ host: host,
644
+ onSubmit: onSubmit
645
+ })]
655
646
  });
656
647
  }
657
648
 
@@ -4,7 +4,7 @@ import { _ as _slicedToArray } from './slicedToArray-331bebbb.esm.js';
4
4
  import { useRef, useState, useLayoutEffect } from 'react';
5
5
  import { createPortal } from 'react-dom';
6
6
  import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
7
- import { useValApi, useValStore } from './ValProvider-0620664e.esm.js';
7
+ import { useValApi, useValStore } from './ValProvider-05e0ada2.esm.js';
8
8
 
9
9
  function ShadowContent(_ref) {
10
10
  var root = _ref.root,
@@ -42,7 +42,7 @@ var ShadowRoot = function ShadowRoot(_ref2) {
42
42
  });
43
43
  };
44
44
 
45
- function ValUI() {
45
+ function ValUI(props) {
46
46
  var api = useValApi();
47
47
  var store = useValStore();
48
48
  if (!api || !store) {
@@ -69,9 +69,12 @@ function ValUI() {
69
69
  }), /*#__PURE__*/jsx("link", {
70
70
  href: "https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,100;0,300;0,400;0,500;0,700;1,100;1,300;1,400;1,500;1,700&family=Space+Mono:ital,wght@0,400;0,700;1,400&display=swap",
71
71
  rel: "stylesheet"
72
- }), /*#__PURE__*/jsx(Style, {}), /*#__PURE__*/jsx(ValOverlay, {
72
+ }), /*#__PURE__*/jsx(Style, {
73
+ route: props === null || props === void 0 ? void 0 : props.host
74
+ }), /*#__PURE__*/jsx(ValOverlay, {
73
75
  api: api,
74
- store: store
76
+ store: store,
77
+ onSubmit: props.onSubmit
75
78
  })]
76
79
  })
77
80
  });
@@ -4,7 +4,7 @@ import { _ as _slicedToArray } from './slicedToArray-85f6bb43.browser.esm.js';
4
4
  import { useRef, useState, useLayoutEffect } from 'react';
5
5
  import { createPortal } from 'react-dom';
6
6
  import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
7
- import { useValApi, useValStore } from './ValProvider-14179159.browser.esm.js';
7
+ import { useValApi, useValStore } from './ValProvider-9be9362b.browser.esm.js';
8
8
 
9
9
  function ShadowContent(_ref) {
10
10
  var root = _ref.root,
@@ -42,7 +42,7 @@ var ShadowRoot = function ShadowRoot(_ref2) {
42
42
  });
43
43
  };
44
44
 
45
- function ValUI() {
45
+ function ValUI(props) {
46
46
  var api = useValApi();
47
47
  var store = useValStore();
48
48
  if (!api || !store) {
@@ -69,9 +69,12 @@ function ValUI() {
69
69
  }), /*#__PURE__*/jsx("link", {
70
70
  href: "https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,100;0,300;0,400;0,500;0,700;1,100;1,300;1,400;1,500;1,700&family=Space+Mono:ital,wght@0,400;0,700;1,400&display=swap",
71
71
  rel: "stylesheet"
72
- }), /*#__PURE__*/jsx(Style, {}), /*#__PURE__*/jsx(ValOverlay, {
72
+ }), /*#__PURE__*/jsx(Style, {
73
+ route: props === null || props === void 0 ? void 0 : props.host
74
+ }), /*#__PURE__*/jsx(ValOverlay, {
73
75
  api: api,
74
- store: store
76
+ store: store,
77
+ onSubmit: props.onSubmit
75
78
  })]
76
79
  })
77
80
  });
@@ -8,7 +8,7 @@ var slicedToArray = require('./slicedToArray-a9d0d9cd.cjs.dev.js');
8
8
  var React = require('react');
9
9
  var reactDom = require('react-dom');
10
10
  var ReactJSXRuntime = require('react/jsx-runtime');
11
- var ValProvider = require('./ValProvider-7513c6ec.cjs.dev.js');
11
+ var ValProvider = require('./ValProvider-396d7da7.cjs.dev.js');
12
12
 
13
13
  function ShadowContent(_ref) {
14
14
  var root = _ref.root,
@@ -46,7 +46,7 @@ var ShadowRoot = function ShadowRoot(_ref2) {
46
46
  });
47
47
  };
48
48
 
49
- function ValUI() {
49
+ function ValUI(props) {
50
50
  var api = ValProvider.useValApi();
51
51
  var store = ValProvider.useValStore();
52
52
  if (!api || !store) {
@@ -73,9 +73,12 @@ function ValUI() {
73
73
  }), /*#__PURE__*/ReactJSXRuntime.jsx("link", {
74
74
  href: "https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,100;0,300;0,400;0,500;0,700;1,100;1,300;1,400;1,500;1,700&family=Space+Mono:ital,wght@0,400;0,700;1,400&display=swap",
75
75
  rel: "stylesheet"
76
- }), /*#__PURE__*/ReactJSXRuntime.jsx(ui.Style, {}), /*#__PURE__*/ReactJSXRuntime.jsx(ui.ValOverlay, {
76
+ }), /*#__PURE__*/ReactJSXRuntime.jsx(ui.Style, {
77
+ route: props === null || props === void 0 ? void 0 : props.host
78
+ }), /*#__PURE__*/ReactJSXRuntime.jsx(ui.ValOverlay, {
77
79
  api: api,
78
- store: store
80
+ store: store,
81
+ onSubmit: props.onSubmit
79
82
  })]
80
83
  })
81
84
  });
@@ -4,7 +4,7 @@ import { _ as _slicedToArray } from './slicedToArray-d4c4a4ed.worker.esm.js';
4
4
  import { useRef, useState, useLayoutEffect } from 'react';
5
5
  import { createPortal } from 'react-dom';
6
6
  import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
7
- import { useValApi, useValStore } from './ValProvider-d46ec16a.worker.esm.js';
7
+ import { useValApi, useValStore } from './ValProvider-e745414d.worker.esm.js';
8
8
 
9
9
  function ShadowContent(_ref) {
10
10
  var root = _ref.root,
@@ -42,7 +42,7 @@ var ShadowRoot = function ShadowRoot(_ref2) {
42
42
  });
43
43
  };
44
44
 
45
- function ValUI() {
45
+ function ValUI(props) {
46
46
  var api = useValApi();
47
47
  var store = useValStore();
48
48
  if (!api || !store) {
@@ -69,9 +69,12 @@ function ValUI() {
69
69
  }), /*#__PURE__*/jsx("link", {
70
70
  href: "https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,100;0,300;0,400;0,500;0,700;1,100;1,300;1,400;1,500;1,700&family=Space+Mono:ital,wght@0,400;0,700;1,400&display=swap",
71
71
  rel: "stylesheet"
72
- }), /*#__PURE__*/jsx(Style, {}), /*#__PURE__*/jsx(ValOverlay, {
72
+ }), /*#__PURE__*/jsx(Style, {
73
+ route: props === null || props === void 0 ? void 0 : props.host
74
+ }), /*#__PURE__*/jsx(ValOverlay, {
73
75
  api: api,
74
- store: store
76
+ store: store,
77
+ onSubmit: props.onSubmit
75
78
  })]
76
79
  })
77
80
  });
@@ -0,0 +1,7 @@
1
+ 'use strict';
2
+
3
+ if (process.env.NODE_ENV === "production") {
4
+ module.exports = require("./ValUI-41cd1ce0.cjs.prod.js");
5
+ } else {
6
+ module.exports = require("./ValUI-41cd1ce0.cjs.dev.js");
7
+ }
@@ -8,7 +8,7 @@ var slicedToArray = require('./slicedToArray-a2a426c7.cjs.prod.js');
8
8
  var React = require('react');
9
9
  var reactDom = require('react-dom');
10
10
  var ReactJSXRuntime = require('react/jsx-runtime');
11
- var ValProvider = require('./ValProvider-b2e83d12.cjs.prod.js');
11
+ var ValProvider = require('./ValProvider-d9e0b778.cjs.prod.js');
12
12
 
13
13
  function ShadowContent(_ref) {
14
14
  var root = _ref.root,
@@ -46,7 +46,7 @@ var ShadowRoot = function ShadowRoot(_ref2) {
46
46
  });
47
47
  };
48
48
 
49
- function ValUI() {
49
+ function ValUI(props) {
50
50
  var api = ValProvider.useValApi();
51
51
  var store = ValProvider.useValStore();
52
52
  if (!api || !store) {
@@ -73,9 +73,12 @@ function ValUI() {
73
73
  }), /*#__PURE__*/ReactJSXRuntime.jsx("link", {
74
74
  href: "https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,100;0,300;0,400;0,500;0,700;1,100;1,300;1,400;1,500;1,700&family=Space+Mono:ital,wght@0,400;0,700;1,400&display=swap",
75
75
  rel: "stylesheet"
76
- }), /*#__PURE__*/ReactJSXRuntime.jsx(ui.Style, {}), /*#__PURE__*/ReactJSXRuntime.jsx(ui.ValOverlay, {
76
+ }), /*#__PURE__*/ReactJSXRuntime.jsx(ui.Style, {
77
+ route: props === null || props === void 0 ? void 0 : props.host
78
+ }), /*#__PURE__*/ReactJSXRuntime.jsx(ui.ValOverlay, {
77
79
  api: api,
78
- store: store
80
+ store: store,
81
+ onSubmit: props.onSubmit
79
82
  })]
80
83
  })
81
84
  });
@@ -12,5 +12,6 @@ export type ValContext = {
12
12
  export declare const ValContext: React.Context<ValContext> | undefined;
13
13
  export type ValProviderProps = {
14
14
  children?: React.ReactNode;
15
+ onSubmit: (refreshRequired: boolean) => void;
15
16
  };
16
- export declare function ValProvider({ children }: ValProviderProps): JSX.Element;
17
+ export declare function ValProvider({ children, onSubmit }: ValProviderProps): import("react/jsx-runtime").JSX.Element;
@@ -1,22 +1,18 @@
1
- /// <reference types="react" />
2
1
  import { RichText, RichTextOptions } from "@valbuild/core";
3
2
  type Tags = keyof Pick<RichTextOptions, "img" | "ul" | "ol">;
4
3
  type Classes = keyof Pick<RichTextOptions, "bold" | "italic" | "lineThrough">;
5
- type ThemeOptions<O extends RichTextOptions> = {
6
- tags: (O["headings"] extends Array<unknown> ? {
7
- [Key in O["headings"][number]]: string;
8
- } : {}) & {
9
- [Key in Tags & keyof O as O[Key] extends true ? Key extends "ul" | "ol" ? Key | "li" : Key : never]: string;
10
- } & {
11
- p?: string;
12
- };
13
- classes: {
14
- [Key in Classes & keyof O as O[Key] extends true ? Key : never]: string;
15
- };
4
+ type ThemeOptions<O extends RichTextOptions> = (O["headings"] extends Array<unknown> ? {
5
+ [Key in O["headings"][number]]: string;
6
+ } : {}) & {
7
+ [Key in Tags & keyof O as O[Key] extends true ? Key extends "ul" | "ol" ? Key | "li" : Key : never]: string;
8
+ } & {
9
+ p?: string;
10
+ } & {
11
+ [Key in Classes & keyof O as O[Key] extends true ? Key : never]: string;
16
12
  };
17
13
  export declare function ValRichText<O extends RichTextOptions>({ theme, className, children, }: {
18
14
  theme?: ThemeOptions<O>;
19
15
  className?: string;
20
16
  children: RichText<O>;
21
- }): JSX.Element;
17
+ }): import("react/jsx-runtime").JSX.Element;
22
18
  export {};
@@ -24,5 +24,6 @@ export declare function stegaEncode(input: any, opts: {
24
24
  getModule?: (moduleId: string) => any;
25
25
  disabled?: boolean;
26
26
  }): any;
27
+ export declare function stegaClean(source: string): string;
27
28
  export declare function getModuleIds(input: any): string[];
28
29
  export {};
@@ -1,4 +1,4 @@
1
- export { ValProvider, useValApi, useValStore } from '../../dist/ValProvider-14179159.browser.esm.js';
1
+ export { ValProvider, useValApi, useValStore } from '../../dist/ValProvider-9be9362b.browser.esm.js';
2
2
  import React from 'react';
3
3
  import { jsx } from 'react/jsx-runtime';
4
4
 
@@ -9,7 +9,7 @@ function ValRichText(_ref) {
9
9
  children = _ref.children;
10
10
  var root = children;
11
11
  function withRenderTag(clazz, current) {
12
- var renderClass = theme.tags[clazz];
12
+ var renderClass = theme === null || theme === void 0 ? void 0 : theme[clazz];
13
13
  if (renderClass && current) {
14
14
  return [current, renderClass].join(" ");
15
15
  }
@@ -19,7 +19,7 @@ function ValRichText(_ref) {
19
19
  return current;
20
20
  }
21
21
  function withRenderClass(clazz, current) {
22
- var renderClass = theme.classes[clazz];
22
+ var renderClass = theme === null || theme === void 0 ? void 0 : theme[clazz];
23
23
  if (renderClass && current) {
24
24
  return [current, renderClass].join(" ");
25
25
  }
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var ValProvider = require('../../dist/ValProvider-7513c6ec.cjs.dev.js');
5
+ var ValProvider = require('../../dist/ValProvider-396d7da7.cjs.dev.js');
6
6
  var React = require('react');
7
7
  var ReactJSXRuntime = require('react/jsx-runtime');
8
8
 
@@ -17,7 +17,7 @@ function ValRichText(_ref) {
17
17
  children = _ref.children;
18
18
  var root = children;
19
19
  function withRenderTag(clazz, current) {
20
- var renderClass = theme.tags[clazz];
20
+ var renderClass = theme === null || theme === void 0 ? void 0 : theme[clazz];
21
21
  if (renderClass && current) {
22
22
  return [current, renderClass].join(" ");
23
23
  }
@@ -27,7 +27,7 @@ function ValRichText(_ref) {
27
27
  return current;
28
28
  }
29
29
  function withRenderClass(clazz, current) {
30
- var renderClass = theme.classes[clazz];
30
+ var renderClass = theme === null || theme === void 0 ? void 0 : theme[clazz];
31
31
  if (renderClass && current) {
32
32
  return [current, renderClass].join(" ");
33
33
  }
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var ValProvider = require('../../dist/ValProvider-b2e83d12.cjs.prod.js');
5
+ var ValProvider = require('../../dist/ValProvider-d9e0b778.cjs.prod.js');
6
6
  var React = require('react');
7
7
  var ReactJSXRuntime = require('react/jsx-runtime');
8
8
 
@@ -17,7 +17,7 @@ function ValRichText(_ref) {
17
17
  children = _ref.children;
18
18
  var root = children;
19
19
  function withRenderTag(clazz, current) {
20
- var renderClass = theme.tags[clazz];
20
+ var renderClass = theme === null || theme === void 0 ? void 0 : theme[clazz];
21
21
  if (renderClass && current) {
22
22
  return [current, renderClass].join(" ");
23
23
  }
@@ -27,7 +27,7 @@ function ValRichText(_ref) {
27
27
  return current;
28
28
  }
29
29
  function withRenderClass(clazz, current) {
30
- var renderClass = theme.classes[clazz];
30
+ var renderClass = theme === null || theme === void 0 ? void 0 : theme[clazz];
31
31
  if (renderClass && current) {
32
32
  return [current, renderClass].join(" ");
33
33
  }
@@ -1,4 +1,4 @@
1
- export { ValProvider, useValApi, useValStore } from '../../dist/ValProvider-0620664e.esm.js';
1
+ export { ValProvider, useValApi, useValStore } from '../../dist/ValProvider-05e0ada2.esm.js';
2
2
  import React from 'react';
3
3
  import { jsx } from 'react/jsx-runtime';
4
4
 
@@ -9,7 +9,7 @@ function ValRichText(_ref) {
9
9
  children = _ref.children;
10
10
  var root = children;
11
11
  function withRenderTag(clazz, current) {
12
- var renderClass = theme.tags[clazz];
12
+ var renderClass = theme === null || theme === void 0 ? void 0 : theme[clazz];
13
13
  if (renderClass && current) {
14
14
  return [current, renderClass].join(" ");
15
15
  }
@@ -19,7 +19,7 @@ function ValRichText(_ref) {
19
19
  return current;
20
20
  }
21
21
  function withRenderClass(clazz, current) {
22
- var renderClass = theme.classes[clazz];
22
+ var renderClass = theme === null || theme === void 0 ? void 0 : theme[clazz];
23
23
  if (renderClass && current) {
24
24
  return [current, renderClass].join(" ");
25
25
  }
@@ -1,4 +1,4 @@
1
- export { ValProvider, useValApi, useValStore } from '../../dist/ValProvider-d46ec16a.worker.esm.js';
1
+ export { ValProvider, useValApi, useValStore } from '../../dist/ValProvider-e745414d.worker.esm.js';
2
2
  import React from 'react';
3
3
  import { jsx } from 'react/jsx-runtime';
4
4
 
@@ -9,7 +9,7 @@ function ValRichText(_ref) {
9
9
  children = _ref.children;
10
10
  var root = children;
11
11
  function withRenderTag(clazz, current) {
12
- var renderClass = theme.tags[clazz];
12
+ var renderClass = theme === null || theme === void 0 ? void 0 : theme[clazz];
13
13
  if (renderClass && current) {
14
14
  return [current, renderClass].join(" ");
15
15
  }
@@ -19,7 +19,7 @@ function ValRichText(_ref) {
19
19
  return current;
20
20
  }
21
21
  function withRenderClass(clazz, current) {
22
- var renderClass = theme.classes[clazz];
22
+ var renderClass = theme === null || theme === void 0 ? void 0 : theme[clazz];
23
23
  if (renderClass && current) {
24
24
  return [current, renderClass].join(" ");
25
25
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@valbuild/react",
3
- "version": "0.33.0",
3
+ "version": "0.35.0",
4
4
  "private": false,
5
5
  "description": "Val - React internal helpers",
6
6
  "sideEffects": false,
@@ -9,16 +9,16 @@
9
9
  "test": "jest"
10
10
  },
11
11
  "dependencies": {
12
- "@valbuild/core": "~0.33.0",
13
- "@valbuild/ui": "~0.33.0",
14
- "@valbuild/shared": "~0.33.0",
12
+ "@valbuild/core": "~0.35.0",
13
+ "@valbuild/shared": "~0.35.0",
14
+ "@valbuild/ui": "~0.35.0",
15
15
  "@vercel/stega": "^0.1.0",
16
16
  "base64-arraybuffer": "^1.0.2",
17
17
  "style-to-object": "^0.4.1"
18
18
  },
19
19
  "devDependencies": {
20
20
  "@testing-library/react": "^14.0.0",
21
- "@types/react": "^18.0.26",
21
+ "@types/react": "^18.2.38",
22
22
  "jest-environment-jsdom": "^29.5.0",
23
23
  "react": "^18.2.0",
24
24
  "react-dom": "^18.2.0"
@@ -24,7 +24,7 @@ var addValPathIfFound = function addValPathIfFound(type, props) {
24
24
  if (!encodedBits || _typeof(encodedBits) !== "object") continue;
25
25
  if ("origin" in encodedBits && "data" in encodedBits && _typeof(encodedBits.data) === "object" && encodedBits.data && "valPath" in encodedBits.data) {
26
26
  var _encodedBits$data;
27
- var valPath = encodedBits === null || encodedBits === void 0 ? void 0 : (_encodedBits$data = encodedBits.data) === null || _encodedBits$data === void 0 ? void 0 : _encodedBits$data.valPath;
27
+ var valPath = encodedBits === null || encodedBits === void 0 || (_encodedBits$data = encodedBits.data) === null || _encodedBits$data === void 0 ? void 0 : _encodedBits$data.valPath;
28
28
  if (valPath) {
29
29
  valSources.push(valPath);
30
30
  props[key] = isIntrinsicElement(type) ? vercelStegaSplit(value).cleaned : value;
@@ -34,7 +34,7 @@ var addValPathIfFound = function addValPathIfFound(type, props) {
34
34
  if (!encodedBits || _typeof._typeof(encodedBits) !== "object") continue;
35
35
  if ("origin" in encodedBits && "data" in encodedBits && _typeof._typeof(encodedBits.data) === "object" && encodedBits.data && "valPath" in encodedBits.data) {
36
36
  var _encodedBits$data;
37
- var valPath = encodedBits === null || encodedBits === void 0 ? void 0 : (_encodedBits$data = encodedBits.data) === null || _encodedBits$data === void 0 ? void 0 : _encodedBits$data.valPath;
37
+ var valPath = encodedBits === null || encodedBits === void 0 || (_encodedBits$data = encodedBits.data) === null || _encodedBits$data === void 0 ? void 0 : _encodedBits$data.valPath;
38
38
  if (valPath) {
39
39
  valSources.push(valPath);
40
40
  props[key] = isIntrinsicElement(type) ? stega.vercelStegaSplit(value).cleaned : value;
@@ -34,7 +34,7 @@ var addValPathIfFound = function addValPathIfFound(type, props) {
34
34
  if (!encodedBits || _typeof._typeof(encodedBits) !== "object") continue;
35
35
  if ("origin" in encodedBits && "data" in encodedBits && _typeof._typeof(encodedBits.data) === "object" && encodedBits.data && "valPath" in encodedBits.data) {
36
36
  var _encodedBits$data;
37
- var valPath = encodedBits === null || encodedBits === void 0 ? void 0 : (_encodedBits$data = encodedBits.data) === null || _encodedBits$data === void 0 ? void 0 : _encodedBits$data.valPath;
37
+ var valPath = encodedBits === null || encodedBits === void 0 || (_encodedBits$data = encodedBits.data) === null || _encodedBits$data === void 0 ? void 0 : _encodedBits$data.valPath;
38
38
  if (valPath) {
39
39
  valSources.push(valPath);
40
40
  props[key] = isIntrinsicElement(type) ? stega.vercelStegaSplit(value).cleaned : value;
@@ -24,7 +24,7 @@ var addValPathIfFound = function addValPathIfFound(type, props) {
24
24
  if (!encodedBits || _typeof(encodedBits) !== "object") continue;
25
25
  if ("origin" in encodedBits && "data" in encodedBits && _typeof(encodedBits.data) === "object" && encodedBits.data && "valPath" in encodedBits.data) {
26
26
  var _encodedBits$data;
27
- var valPath = encodedBits === null || encodedBits === void 0 ? void 0 : (_encodedBits$data = encodedBits.data) === null || _encodedBits$data === void 0 ? void 0 : _encodedBits$data.valPath;
27
+ var valPath = encodedBits === null || encodedBits === void 0 || (_encodedBits$data = encodedBits.data) === null || _encodedBits$data === void 0 ? void 0 : _encodedBits$data.valPath;
28
28
  if (valPath) {
29
29
  valSources.push(valPath);
30
30
  props[key] = isIntrinsicElement(type) ? vercelStegaSplit(value).cleaned : value;
@@ -24,7 +24,7 @@ var addValPathIfFound = function addValPathIfFound(type, props) {
24
24
  if (!encodedBits || _typeof(encodedBits) !== "object") continue;
25
25
  if ("origin" in encodedBits && "data" in encodedBits && _typeof(encodedBits.data) === "object" && encodedBits.data && "valPath" in encodedBits.data) {
26
26
  var _encodedBits$data;
27
- var valPath = encodedBits === null || encodedBits === void 0 ? void 0 : (_encodedBits$data = encodedBits.data) === null || _encodedBits$data === void 0 ? void 0 : _encodedBits$data.valPath;
27
+ var valPath = encodedBits === null || encodedBits === void 0 || (_encodedBits$data = encodedBits.data) === null || _encodedBits$data === void 0 ? void 0 : _encodedBits$data.valPath;
28
28
  if (valPath) {
29
29
  valSources.push(valPath);
30
30
  props[key] = isIntrinsicElement(type) ? vercelStegaSplit(value).cleaned : value;
@@ -1,7 +0,0 @@
1
- 'use strict';
2
-
3
- if (process.env.NODE_ENV === "production") {
4
- module.exports = require("./ValProvider-b2e83d12.cjs.prod.js");
5
- } else {
6
- module.exports = require("./ValProvider-b2e83d12.cjs.dev.js");
7
- }
@@ -1,7 +0,0 @@
1
- 'use strict';
2
-
3
- if (process.env.NODE_ENV === "production") {
4
- module.exports = require("./ValUI-8ea90ec3.cjs.prod.js");
5
- } else {
6
- module.exports = require("./ValUI-8ea90ec3.cjs.dev.js");
7
- }