@makeswift/runtime 0.10.2 → 0.10.3

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 (106) hide show
  1. package/dist/Button.cjs.js +1 -1
  2. package/dist/Button.es.js +1 -1
  3. package/dist/Carousel.cjs.js +1 -1
  4. package/dist/Carousel.es.js +1 -1
  5. package/dist/Countdown.cjs.js +2 -2
  6. package/dist/Countdown.es.js +2 -2
  7. package/dist/Divider.cjs.js +1 -1
  8. package/dist/Divider.es.js +1 -1
  9. package/dist/Embed.cjs.js +2 -1
  10. package/dist/Embed.cjs.js.map +1 -1
  11. package/dist/Embed.es.js +2 -1
  12. package/dist/Embed.es.js.map +1 -1
  13. package/dist/Form.cjs.js +2 -2
  14. package/dist/Form.es.js +2 -2
  15. package/dist/Image.cjs.js +1 -1
  16. package/dist/Image.es.js +1 -1
  17. package/dist/LiveProvider.cjs.js +1 -1
  18. package/dist/LiveProvider.es.js +1 -1
  19. package/dist/Navigation.cjs.js +1 -1
  20. package/dist/Navigation.es.js +1 -1
  21. package/dist/PreviewProvider.cjs.js +1 -1
  22. package/dist/PreviewProvider.es.js +2 -2
  23. package/dist/ReadOnlyText.cjs.js +1 -1
  24. package/dist/ReadOnlyText.es.js +2 -2
  25. package/dist/ReadOnlyTextV2.cjs.js +1 -1
  26. package/dist/ReadOnlyTextV2.es.js +2 -2
  27. package/dist/Root.cjs.js +1 -1
  28. package/dist/Root.es.js +1 -1
  29. package/dist/SocialLinks.cjs.js +1 -1
  30. package/dist/SocialLinks.es.js +1 -1
  31. package/dist/Video.cjs.js +2 -1
  32. package/dist/Video.cjs.js.map +1 -1
  33. package/dist/Video.es.js +2 -1
  34. package/dist/Video.es.js.map +1 -1
  35. package/dist/builder.cjs.js +2 -1
  36. package/dist/builder.cjs.js.map +1 -1
  37. package/dist/builder.es.js +2 -1
  38. package/dist/builder.es.js.map +1 -1
  39. package/dist/components.cjs.js +1 -1
  40. package/dist/components.es.js +1 -1
  41. package/dist/control-serialization.cjs.js +1 -0
  42. package/dist/control-serialization.cjs.js.map +1 -1
  43. package/dist/control-serialization.es.js +1 -0
  44. package/dist/control-serialization.es.js.map +1 -1
  45. package/dist/controls.cjs.js +4 -1
  46. package/dist/controls.cjs.js.map +1 -1
  47. package/dist/controls.es.js +3 -2
  48. package/dist/controls.es.js.map +1 -1
  49. package/dist/index.cjs.js +2 -2
  50. package/dist/index.cjs2.js +1 -0
  51. package/dist/index.cjs2.js.map +1 -1
  52. package/dist/index.cjs7.js +1 -1
  53. package/dist/index.cjs8.js +1 -1
  54. package/dist/index.es.js +2 -2
  55. package/dist/index.es2.js +1 -0
  56. package/dist/index.es2.js.map +1 -1
  57. package/dist/index.es5.js +1 -1
  58. package/dist/index.es7.js +2 -2
  59. package/dist/index.es8.js +2 -2
  60. package/dist/main.cjs.js +2 -1
  61. package/dist/main.cjs.js.map +1 -1
  62. package/dist/main.es.js +2 -1
  63. package/dist/main.es.js.map +1 -1
  64. package/dist/next.cjs.js +2 -2
  65. package/dist/next.es.js +2 -2
  66. package/dist/prop-controllers.cjs.js +2 -1
  67. package/dist/prop-controllers.cjs.js.map +1 -1
  68. package/dist/prop-controllers.es.js +2 -1
  69. package/dist/prop-controllers.es.js.map +1 -1
  70. package/dist/react-page.cjs.js +473 -308
  71. package/dist/react-page.cjs.js.map +1 -1
  72. package/dist/react-page.es.js +473 -309
  73. package/dist/react-page.es.js.map +1 -1
  74. package/dist/react.cjs.js +2 -2
  75. package/dist/react.es.js +2 -2
  76. package/dist/slate.cjs.js +2 -2
  77. package/dist/slate.es.js +3 -3
  78. package/dist/types/src/controls/control.d.ts +1 -1
  79. package/dist/types/src/controls/control.d.ts.map +1 -1
  80. package/dist/types/src/controls/rich-text/__test__/copy.test.d.ts +2 -0
  81. package/dist/types/src/controls/rich-text/__test__/copy.test.d.ts.map +1 -0
  82. package/dist/types/src/controls/rich-text/__test__/introspection.test.d.ts.map +1 -0
  83. package/dist/types/src/controls/rich-text/__test__/translation.test.d.ts.map +1 -0
  84. package/dist/types/src/controls/rich-text/copy.d.ts +4 -0
  85. package/dist/types/src/controls/rich-text/copy.d.ts.map +1 -0
  86. package/dist/types/src/controls/rich-text/index.d.ts +1 -0
  87. package/dist/types/src/controls/rich-text/index.d.ts.map +1 -1
  88. package/dist/types/src/controls/rich-text-v2/__test__/copy.test.d.ts +2 -0
  89. package/dist/types/src/controls/rich-text-v2/__test__/copy.test.d.ts.map +1 -0
  90. package/dist/types/src/controls/rich-text-v2/__test__/introspection.test.d.ts.map +1 -0
  91. package/dist/types/src/controls/rich-text-v2/copy.d.ts +4 -0
  92. package/dist/types/src/controls/rich-text-v2/copy.d.ts.map +1 -0
  93. package/dist/types/src/controls/rich-text-v2/index.d.ts +1 -0
  94. package/dist/types/src/controls/rich-text-v2/index.d.ts.map +1 -1
  95. package/dist/types/src/controls/rich-text-v2/translation.d.ts +1 -1
  96. package/dist/types/src/controls/rich-text-v2/translation.d.ts.map +1 -1
  97. package/dist/types/src/slate/InlinePlugin/index.d.ts +2 -2
  98. package/dist/types/src/slate/TextAlignPlugin/index.d.ts +3 -3
  99. package/dist/types/src/slate/TypographyPlugin/index.d.ts +3 -3
  100. package/package.json +1 -1
  101. package/dist/types/src/controls/rich-text/introspection.test.d.ts.map +0 -1
  102. package/dist/types/src/controls/rich-text/translation.test.d.ts.map +0 -1
  103. package/dist/types/src/controls/rich-text-v2/introspection.test.d.ts.map +0 -1
  104. /package/dist/types/src/controls/rich-text/{introspection.test.d.ts → __test__/introspection.test.d.ts} +0 -0
  105. /package/dist/types/src/controls/rich-text/{translation.test.d.ts → __test__/translation.test.d.ts} +0 -0
  106. /package/dist/types/src/controls/rich-text-v2/{introspection.test.d.ts → __test__/introspection.test.d.ts} +0 -0
@@ -43,6 +43,7 @@ require("./actions.cjs.js");
43
43
  require("zod");
44
44
  require("./text-input.cjs.js");
45
45
  require("./combobox.cjs.js");
46
+ require("uuid");
46
47
  require("slate");
47
48
  require("use-sync-external-store/shim");
48
49
  require("redux");
@@ -63,7 +64,6 @@ require("cookie");
63
64
  require("http-proxy");
64
65
  require("set-cookie-parser");
65
66
  require("./constants.cjs.js");
66
- require("uuid");
67
67
  require("corporate-ipsum");
68
68
  require("is-hotkey");
69
69
  require("slate-react");
package/dist/Button.es.js CHANGED
@@ -41,6 +41,7 @@ import "./actions.es.js";
41
41
  import "zod";
42
42
  import "./text-input.es.js";
43
43
  import "./combobox.es.js";
44
+ import "uuid";
44
45
  import "slate";
45
46
  import "use-sync-external-store/shim";
46
47
  import "redux";
@@ -61,7 +62,6 @@ import "cookie";
61
62
  import "http-proxy";
62
63
  import "set-cookie-parser";
63
64
  import "./constants.es.js";
64
- import "uuid";
65
65
  import "corporate-ipsum";
66
66
  import "is-hotkey";
67
67
  import "slate-react";
@@ -39,6 +39,7 @@ var next = require("./index.cjs.js");
39
39
  require("use-sync-external-store/shim");
40
40
  var reactPage = require("./react-page.cjs.js");
41
41
  require("./actions.cjs.js");
42
+ require("uuid");
42
43
  require("slate");
43
44
  var useMediaQuery = require("./useMediaQuery.cjs.js");
44
45
  var Image = require("./Image.cjs.js");
@@ -68,7 +69,6 @@ require("cookie");
68
69
  require("http-proxy");
69
70
  require("set-cookie-parser");
70
71
  require("./constants.cjs.js");
71
- require("uuid");
72
72
  require("corporate-ipsum");
73
73
  require("is-hotkey");
74
74
  require("slate-react");
@@ -37,6 +37,7 @@ import { r as useBreakpoints, n as useResponsiveStyle, q as colorToString } from
37
37
  import "use-sync-external-store/shim";
38
38
  import { _ as useStyle } from "./react-page.es.js";
39
39
  import "./actions.es.js";
40
+ import "uuid";
40
41
  import "slate";
41
42
  import { u as useMediaQuery } from "./useMediaQuery.es.js";
42
43
  import ImageComponent from "./Image.es.js";
@@ -66,7 +67,6 @@ import "cookie";
66
67
  import "http-proxy";
67
68
  import "set-cookie-parser";
68
69
  import "./constants.es.js";
69
- import "uuid";
70
70
  import "corporate-ipsum";
71
71
  import "is-hotkey";
72
72
  import "slate-react";
@@ -41,9 +41,10 @@ require("redux-thunk");
41
41
  require("./actions.cjs.js");
42
42
  require("zod");
43
43
  require("./state/breakpoints.cjs.js");
44
+ require("slate");
45
+ require("uuid");
44
46
  require("@emotion/serialize");
45
47
  require("@emotion/utils");
46
- require("slate");
47
48
  require("is-hotkey");
48
49
  require("use-sync-external-store/shim/with-selector");
49
50
  require("next/dynamic");
@@ -66,7 +67,6 @@ require("cookie");
66
67
  require("http-proxy");
67
68
  require("set-cookie-parser");
68
69
  require("./constants.cjs.js");
69
- require("uuid");
70
70
  require("corporate-ipsum");
71
71
  require("slate-react");
72
72
  require("next/link");
@@ -39,9 +39,10 @@ import "redux-thunk";
39
39
  import "./actions.es.js";
40
40
  import "zod";
41
41
  import "./state/breakpoints.es.js";
42
+ import "slate";
43
+ import "uuid";
42
44
  import "@emotion/serialize";
43
45
  import "@emotion/utils";
44
- import "slate";
45
46
  import "is-hotkey";
46
47
  import "use-sync-external-store/shim/with-selector";
47
48
  import "next/dynamic";
@@ -64,7 +65,6 @@ import "cookie";
64
65
  import "http-proxy";
65
66
  import "set-cookie-parser";
66
67
  import "./constants.es.js";
67
- import "uuid";
68
68
  import "corporate-ipsum";
69
69
  import "slate-react";
70
70
  import "next/link";
@@ -11,6 +11,7 @@ require("./actions.cjs.js");
11
11
  require("zod");
12
12
  require("./text-input.cjs.js");
13
13
  require("./combobox.cjs.js");
14
+ require("uuid");
14
15
  require("slate");
15
16
  require("use-sync-external-store/shim");
16
17
  require("redux");
@@ -32,7 +33,6 @@ require("cookie");
32
33
  require("http-proxy");
33
34
  require("set-cookie-parser");
34
35
  require("./constants.cjs.js");
35
- require("uuid");
36
36
  require("corporate-ipsum");
37
37
  require("is-hotkey");
38
38
  require("slate-react");
@@ -9,6 +9,7 @@ import "./actions.es.js";
9
9
  import "zod";
10
10
  import "./text-input.es.js";
11
11
  import "./combobox.es.js";
12
+ import "uuid";
12
13
  import "slate";
13
14
  import "use-sync-external-store/shim";
14
15
  import "redux";
@@ -30,7 +31,6 @@ import "cookie";
30
31
  import "http-proxy";
31
32
  import "set-cookie-parser";
32
33
  import "./constants.es.js";
33
- import "uuid";
34
34
  import "corporate-ipsum";
35
35
  import "is-hotkey";
36
36
  import "slate-react";
package/dist/Embed.cjs.js CHANGED
@@ -10,9 +10,10 @@ require("redux-thunk");
10
10
  require("./actions.cjs.js");
11
11
  require("zod");
12
12
  require("./state/breakpoints.cjs.js");
13
+ require("slate");
14
+ require("uuid");
13
15
  require("@emotion/serialize");
14
16
  require("@emotion/utils");
15
- require("slate");
16
17
  require("is-hotkey");
17
18
  const defaultHtml = `<div style="padding: 24px; background-color: rgba(161, 168, 194, 0.18); overflow: hidden;">
18
19
  <svg width="316" height="168" viewBox="0 0 316 168" fill="none" xmlns="http://www.w3.org/2000/svg">
@@ -1 +1 @@
1
- {"version":3,"file":"Embed.cjs.js","sources":["../src/components/builtin/Embed/Embed.tsx"],"sourcesContent":["/* eslint-env browser */\n\nimport { useState, useEffect, forwardRef, Ref, useImperativeHandle } from 'react'\n\nimport { ElementIDValue, TextAreaValue } from '../../../prop-controllers/descriptors'\nimport { useIsomorphicLayoutEffect } from '../../hooks/useIsomorphicLayoutEffect'\nimport { useStyle } from '../../../runtimes/react/use-style'\nimport { cx } from '@emotion/css'\n\ntype Props = {\n id?: ElementIDValue\n html?: TextAreaValue\n width?: string\n margin?: string\n}\n\nconst defaultHtml = `<div style=\"padding: 24px; background-color: rgba(161, 168, 194, 0.18); overflow: hidden;\">\n<svg width=\"316\" height=\"168\" viewBox=\"0 0 316 168\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<rect width=\"70\" height=\"8\" rx=\"2\" fill=\"#A1A8C2\" fill-opacity=\"0.5\"/>\n<rect x=\"78\" width=\"30\" height=\"8\" rx=\"2\" fill=\"#A1A8C2\" fill-opacity=\"0.25\"/>\n<rect x=\"116\" width=\"78\" height=\"8\" rx=\"2\" fill=\"#A1A8C2\" fill-opacity=\"0.25\"/>\n<rect y=\"20\" width=\"120\" height=\"8\" rx=\"2\" fill=\"#A1A8C2\" fill-opacity=\"0.5\"/>\n<rect x=\"128\" y=\"20\" width=\"30\" height=\"8\" rx=\"2\" fill=\"#A1A8C2\" fill-opacity=\"0.25\"/>\n<rect x=\"166\" y=\"20\" width=\"78\" height=\"8\" rx=\"2\" fill=\"#A1A8C2\" fill-opacity=\"0.25\"/>\n<rect y=\"60\" width=\"40\" height=\"8\" rx=\"2\" fill=\"#A1A8C2\" fill-opacity=\"0.5\"/>\n<rect x=\"20\" y=\"80\" width=\"40\" height=\"8\" rx=\"2\" fill=\"#A1A8C2\" fill-opacity=\"0.5\"/>\n<rect x=\"40\" y=\"100\" width=\"40\" height=\"8\" rx=\"2\" fill=\"#A1A8C2\" fill-opacity=\"0.5\"/>\n<rect x=\"88\" y=\"100\" width=\"110\" height=\"8\" rx=\"2\" fill=\"#A1A8C2\" fill-opacity=\"0.25\"/>\n<rect x=\"206\" y=\"100\" width=\"24\" height=\"8\" rx=\"2\" fill=\"#A1A8C2\" fill-opacity=\"0.25\"/>\n<rect x=\"238\" y=\"100\" width=\"40\" height=\"8\" rx=\"2\" fill=\"#A1A8C2\" fill-opacity=\"0.5\"/>\n<rect x=\"40\" y=\"120\" width=\"40\" height=\"8\" rx=\"2\" fill=\"#A1A8C2\" fill-opacity=\"0.5\"/>\n<rect x=\"88\" y=\"120\" width=\"50\" height=\"8\" rx=\"2\" fill=\"#A1A8C2\" fill-opacity=\"0.25\"/>\n<rect x=\"146\" y=\"120\" width=\"24\" height=\"8\" rx=\"2\" fill=\"#A1A8C2\" fill-opacity=\"0.25\"/>\n<rect x=\"178\" y=\"120\" width=\"90\" height=\"8\" rx=\"2\" fill=\"#A1A8C2\" fill-opacity=\"0.25\"/>\n<rect x=\"276\" y=\"120\" width=\"40\" height=\"8\" rx=\"2\" fill=\"#A1A8C2\" fill-opacity=\"0.5\"/>\n<rect x=\"20\" y=\"140\" width=\"40\" height=\"8\" rx=\"2\" fill=\"#A1A8C2\" fill-opacity=\"0.5\"/>\n<rect y=\"160\" width=\"40\" height=\"8\" rx=\"2\" fill=\"#A1A8C2\" fill-opacity=\"0.5\"/>\n</svg>\n</div>`\nconst SCRIPT_TAG = 'script'\n\nconst Embed = forwardRef(function Embed(\n { id, width, margin, html = defaultHtml }: Props,\n ref: Ref<HTMLDivElement | null>,\n) {\n const [container, setContainer] = useState<HTMLDivElement | null>(null)\n const [shouldRender, setShouldRender] = useState(false)\n\n useIsomorphicLayoutEffect(() => {\n setShouldRender(true)\n }, [])\n\n useImperativeHandle(ref, () => container, [container])\n\n useEffect(() => {\n // TODO: When we SSR the editor, we can remove the editor check\n // and not run this effect on the first render.\n if (!container) return\n\n const walker = container.ownerDocument.createTreeWalker(container, NodeFilter.SHOW_ELEMENT, {\n acceptNode(node: Element) {\n return node.tagName.toLowerCase() === SCRIPT_TAG\n ? NodeFilter.FILTER_ACCEPT\n : NodeFilter.FILTER_REJECT\n },\n })\n\n const nodes: Element[] = []\n\n while (walker.nextNode()) nodes.push(walker.currentNode as Element)\n\n // By default scripts appended dynamically will execute asyncrhonously. Here we ensure that\n // scripts are loaded synchronously since that's what a user usually expects with scripts in\n // embedded in HTML which usually comes from the server.\n //\n // See: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script#notes\n async function executeScriptsInOrder() {\n for (let i = 0; i < nodes.length; i++) {\n await new Promise<void>(resolve => {\n const node = nodes[i]\n const script = node.ownerDocument.createElement(SCRIPT_TAG)\n\n script.textContent = node.textContent\n Array.from(node.attributes).forEach(({ name, value }) => {\n script.setAttribute(name, value)\n })\n\n script.onload = () => resolve()\n script.onerror = () => resolve()\n\n node.parentNode?.insertBefore(script, node)\n node.parentNode?.removeChild(node)\n\n if (!script.hasAttribute('src')) resolve()\n })\n }\n }\n\n executeScriptsInOrder().catch(error => {\n // Ignore errors from user-provided code\n console.error(error)\n })\n }, [container, html])\n\n const className = useStyle({ minHeight: 15 })\n\n if (shouldRender === false) return null\n\n return (\n <div\n ref={setContainer}\n id={id}\n className={cx(className, width, margin)}\n dangerouslySetInnerHTML={{ __html: html }}\n />\n )\n})\n\nexport default Embed\n"],"names":["defaultHtml","SCRIPT_TAG","Embed","forwardRef","id","width","margin","html","ref","container","setContainer","useState","shouldRender","setShouldRender","useIsomorphicLayoutEffect","useImperativeHandle","useEffect","walker","ownerDocument","createTreeWalker","NodeFilter","SHOW_ELEMENT","acceptNode","node","tagName","toLowerCase","FILTER_ACCEPT","FILTER_REJECT","nodes","nextNode","push","currentNode","i","length","Promise","resolve","script","createElement","textContent","Array","from","attributes","forEach","name","value","setAttribute","onload","onerror","parentNode","insertBefore","removeChild","hasAttribute","catch","error","console","className","useStyle","minHeight","cx","__html"],"mappings":";;;;;;;;;;;;;;;;AAgBA,MAAMA,cAAe;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAuBrB,MAAMC,aAAa;AAEbC,MAAAA,QAAQC,MAAAA,WAAW,gBACvB;AAAA,EAAEC;AAAAA,EAAIC;AAAAA,EAAOC;AAAAA,EAAQC,OAAOP;AAAAA,GAC5BQ,KACA;AACA,QAAM,CAACC,WAAWC,gBAAgBC,MAAAA,SAAgC,IAAxB;AACpC,QAAA,CAACC,cAAcC,mBAAmBF,MAAAA,SAAS,KAAD;AAEhDG,4BAAAA,0BAA0B,MAAM;AAC9BD,oBAAgB,IAAD;AAAA,EADQ,GAEtB,CAFsB,CAAA;AAIzBE,QAAAA,oBAAoBP,KAAK,MAAMC,WAAW,CAACA,SAAD,CAAvB;AAEnBO,QAAAA,UAAU,MAAM;AAGV,QAAA,CAACP;AAAW;AAEhB,UAAMQ,SAASR,UAAUS,cAAcC,iBAAiBV,WAAWW,WAAWC,cAAc;AAAA,MAC1FC,WAAWC,MAAe;AACxB,eAAOA,KAAKC,QAAQC,kBAAkBxB,aAClCmB,WAAWM,gBACXN,WAAWO;AAAAA,MAChB;AAAA,IAAA,CALY;AAQf,UAAMC,QAAmB,CAAA;AAEzB,WAAOX,OAAOY,SAAP;AAAyBC,YAAAA,KAAKb,OAAOc;AAOL,2CAAA;AACrC,eAASC,IAAI,GAAGA,IAAIJ,MAAMK,QAAQD,KAAK;AAC/B,cAAA,IAAIE,QAAcC,CAAW,YAAA;;AACjC,gBAAMZ,OAAOK,MAAMI;AACbI,gBAAAA,SAASb,KAAKL,cAAcmB,cAAcpC,UAAjC;AAEfmC,iBAAOE,cAAcf,KAAKe;AAC1BC,gBAAMC,KAAKjB,KAAKkB,UAAhB,EAA4BC,QAAQ,CAAC;AAAA,YAAEC;AAAAA,YAAMC;AAAAA,gBAAY;AAChDC,mBAAAA,aAAaF,MAAMC,KAA1B;AAAA,UAAA,CADF;AAIOE,iBAAAA,SAAS,MAAMX;AACfY,iBAAAA,UAAU,MAAMZ;AAElBa,qBAAAA,eAAAA,mBAAYC,aAAab,QAAQb;AACjCyB,qBAAAA,eAAAA,mBAAYE,YAAY3B;AAEzB,cAAA,CAACa,OAAOe,aAAa,KAApB;AAAmC;QAAA,CAfpC;AAAA,MAiBP;AAAA,IACF;AAEoB,0BAAA,EAAGC,MAAMC,CAAS,UAAA;AAErCC,cAAQD,MAAMA,KAAd;AAAA,IAAA,CAFF;AAAA,EAAA,GAIC,CAAC5C,WAAWF,IAAZ,CAhDM;AAkDHgD,QAAAA,YAAYC,UAAAA,SAAS;AAAA,IAAEC,WAAW;AAAA,EAAA,CAAd;AAE1B,MAAI7C,iBAAiB;AAAc,WAAA;AAGjC,wCAAA,OAAA;AAAA,IACE,KAAKF;AAAAA,IACL;AAAA,IACA,WAAWgD,IAAAA,GAAGH,WAAWlD,OAAOC,MAAnB;AAAA,IACb,yBAAyB;AAAA,MAAEqD,QAAQpD;AAAAA,IAAV;AAAA,EAAA,CAL7B;AAQD,CA3EuB;;"}
1
+ {"version":3,"file":"Embed.cjs.js","sources":["../src/components/builtin/Embed/Embed.tsx"],"sourcesContent":["/* eslint-env browser */\n\nimport { useState, useEffect, forwardRef, Ref, useImperativeHandle } from 'react'\n\nimport { ElementIDValue, TextAreaValue } from '../../../prop-controllers/descriptors'\nimport { useIsomorphicLayoutEffect } from '../../hooks/useIsomorphicLayoutEffect'\nimport { useStyle } from '../../../runtimes/react/use-style'\nimport { cx } from '@emotion/css'\n\ntype Props = {\n id?: ElementIDValue\n html?: TextAreaValue\n width?: string\n margin?: string\n}\n\nconst defaultHtml = `<div style=\"padding: 24px; background-color: rgba(161, 168, 194, 0.18); overflow: hidden;\">\n<svg width=\"316\" height=\"168\" viewBox=\"0 0 316 168\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<rect width=\"70\" height=\"8\" rx=\"2\" fill=\"#A1A8C2\" fill-opacity=\"0.5\"/>\n<rect x=\"78\" width=\"30\" height=\"8\" rx=\"2\" fill=\"#A1A8C2\" fill-opacity=\"0.25\"/>\n<rect x=\"116\" width=\"78\" height=\"8\" rx=\"2\" fill=\"#A1A8C2\" fill-opacity=\"0.25\"/>\n<rect y=\"20\" width=\"120\" height=\"8\" rx=\"2\" fill=\"#A1A8C2\" fill-opacity=\"0.5\"/>\n<rect x=\"128\" y=\"20\" width=\"30\" height=\"8\" rx=\"2\" fill=\"#A1A8C2\" fill-opacity=\"0.25\"/>\n<rect x=\"166\" y=\"20\" width=\"78\" height=\"8\" rx=\"2\" fill=\"#A1A8C2\" fill-opacity=\"0.25\"/>\n<rect y=\"60\" width=\"40\" height=\"8\" rx=\"2\" fill=\"#A1A8C2\" fill-opacity=\"0.5\"/>\n<rect x=\"20\" y=\"80\" width=\"40\" height=\"8\" rx=\"2\" fill=\"#A1A8C2\" fill-opacity=\"0.5\"/>\n<rect x=\"40\" y=\"100\" width=\"40\" height=\"8\" rx=\"2\" fill=\"#A1A8C2\" fill-opacity=\"0.5\"/>\n<rect x=\"88\" y=\"100\" width=\"110\" height=\"8\" rx=\"2\" fill=\"#A1A8C2\" fill-opacity=\"0.25\"/>\n<rect x=\"206\" y=\"100\" width=\"24\" height=\"8\" rx=\"2\" fill=\"#A1A8C2\" fill-opacity=\"0.25\"/>\n<rect x=\"238\" y=\"100\" width=\"40\" height=\"8\" rx=\"2\" fill=\"#A1A8C2\" fill-opacity=\"0.5\"/>\n<rect x=\"40\" y=\"120\" width=\"40\" height=\"8\" rx=\"2\" fill=\"#A1A8C2\" fill-opacity=\"0.5\"/>\n<rect x=\"88\" y=\"120\" width=\"50\" height=\"8\" rx=\"2\" fill=\"#A1A8C2\" fill-opacity=\"0.25\"/>\n<rect x=\"146\" y=\"120\" width=\"24\" height=\"8\" rx=\"2\" fill=\"#A1A8C2\" fill-opacity=\"0.25\"/>\n<rect x=\"178\" y=\"120\" width=\"90\" height=\"8\" rx=\"2\" fill=\"#A1A8C2\" fill-opacity=\"0.25\"/>\n<rect x=\"276\" y=\"120\" width=\"40\" height=\"8\" rx=\"2\" fill=\"#A1A8C2\" fill-opacity=\"0.5\"/>\n<rect x=\"20\" y=\"140\" width=\"40\" height=\"8\" rx=\"2\" fill=\"#A1A8C2\" fill-opacity=\"0.5\"/>\n<rect y=\"160\" width=\"40\" height=\"8\" rx=\"2\" fill=\"#A1A8C2\" fill-opacity=\"0.5\"/>\n</svg>\n</div>`\nconst SCRIPT_TAG = 'script'\n\nconst Embed = forwardRef(function Embed(\n { id, width, margin, html = defaultHtml }: Props,\n ref: Ref<HTMLDivElement | null>,\n) {\n const [container, setContainer] = useState<HTMLDivElement | null>(null)\n const [shouldRender, setShouldRender] = useState(false)\n\n useIsomorphicLayoutEffect(() => {\n setShouldRender(true)\n }, [])\n\n useImperativeHandle(ref, () => container, [container])\n\n useEffect(() => {\n // TODO: When we SSR the editor, we can remove the editor check\n // and not run this effect on the first render.\n if (!container) return\n\n const walker = container.ownerDocument.createTreeWalker(container, NodeFilter.SHOW_ELEMENT, {\n acceptNode(node: Element) {\n return node.tagName.toLowerCase() === SCRIPT_TAG\n ? NodeFilter.FILTER_ACCEPT\n : NodeFilter.FILTER_REJECT\n },\n })\n\n const nodes: Element[] = []\n\n while (walker.nextNode()) nodes.push(walker.currentNode as Element)\n\n // By default scripts appended dynamically will execute asyncrhonously. Here we ensure that\n // scripts are loaded synchronously since that's what a user usually expects with scripts in\n // embedded in HTML which usually comes from the server.\n //\n // See: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script#notes\n async function executeScriptsInOrder() {\n for (let i = 0; i < nodes.length; i++) {\n await new Promise<void>(resolve => {\n const node = nodes[i]\n const script = node.ownerDocument.createElement(SCRIPT_TAG)\n\n script.textContent = node.textContent\n Array.from(node.attributes).forEach(({ name, value }) => {\n script.setAttribute(name, value)\n })\n\n script.onload = () => resolve()\n script.onerror = () => resolve()\n\n node.parentNode?.insertBefore(script, node)\n node.parentNode?.removeChild(node)\n\n if (!script.hasAttribute('src')) resolve()\n })\n }\n }\n\n executeScriptsInOrder().catch(error => {\n // Ignore errors from user-provided code\n console.error(error)\n })\n }, [container, html])\n\n const className = useStyle({ minHeight: 15 })\n\n if (shouldRender === false) return null\n\n return (\n <div\n ref={setContainer}\n id={id}\n className={cx(className, width, margin)}\n dangerouslySetInnerHTML={{ __html: html }}\n />\n )\n})\n\nexport default Embed\n"],"names":["defaultHtml","SCRIPT_TAG","Embed","forwardRef","id","width","margin","html","ref","container","setContainer","useState","shouldRender","setShouldRender","useIsomorphicLayoutEffect","useImperativeHandle","useEffect","walker","ownerDocument","createTreeWalker","NodeFilter","SHOW_ELEMENT","acceptNode","node","tagName","toLowerCase","FILTER_ACCEPT","FILTER_REJECT","nodes","nextNode","push","currentNode","i","length","Promise","resolve","script","createElement","textContent","Array","from","attributes","forEach","name","value","setAttribute","onload","onerror","parentNode","insertBefore","removeChild","hasAttribute","catch","error","console","className","useStyle","minHeight","cx","__html"],"mappings":";;;;;;;;;;;;;;;;;AAgBA,MAAMA,cAAe;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAuBrB,MAAMC,aAAa;AAEbC,MAAAA,QAAQC,MAAAA,WAAW,gBACvB;AAAA,EAAEC;AAAAA,EAAIC;AAAAA,EAAOC;AAAAA,EAAQC,OAAOP;AAAAA,GAC5BQ,KACA;AACA,QAAM,CAACC,WAAWC,gBAAgBC,MAAAA,SAAgC,IAAxB;AACpC,QAAA,CAACC,cAAcC,mBAAmBF,MAAAA,SAAS,KAAD;AAEhDG,4BAAAA,0BAA0B,MAAM;AAC9BD,oBAAgB,IAAD;AAAA,EADQ,GAEtB,CAFsB,CAAA;AAIzBE,QAAAA,oBAAoBP,KAAK,MAAMC,WAAW,CAACA,SAAD,CAAvB;AAEnBO,QAAAA,UAAU,MAAM;AAGV,QAAA,CAACP;AAAW;AAEhB,UAAMQ,SAASR,UAAUS,cAAcC,iBAAiBV,WAAWW,WAAWC,cAAc;AAAA,MAC1FC,WAAWC,MAAe;AACxB,eAAOA,KAAKC,QAAQC,kBAAkBxB,aAClCmB,WAAWM,gBACXN,WAAWO;AAAAA,MAChB;AAAA,IAAA,CALY;AAQf,UAAMC,QAAmB,CAAA;AAEzB,WAAOX,OAAOY,SAAP;AAAyBC,YAAAA,KAAKb,OAAOc;AAOL,2CAAA;AACrC,eAASC,IAAI,GAAGA,IAAIJ,MAAMK,QAAQD,KAAK;AAC/B,cAAA,IAAIE,QAAcC,CAAW,YAAA;;AACjC,gBAAMZ,OAAOK,MAAMI;AACbI,gBAAAA,SAASb,KAAKL,cAAcmB,cAAcpC,UAAjC;AAEfmC,iBAAOE,cAAcf,KAAKe;AAC1BC,gBAAMC,KAAKjB,KAAKkB,UAAhB,EAA4BC,QAAQ,CAAC;AAAA,YAAEC;AAAAA,YAAMC;AAAAA,gBAAY;AAChDC,mBAAAA,aAAaF,MAAMC,KAA1B;AAAA,UAAA,CADF;AAIOE,iBAAAA,SAAS,MAAMX;AACfY,iBAAAA,UAAU,MAAMZ;AAElBa,qBAAAA,eAAAA,mBAAYC,aAAab,QAAQb;AACjCyB,qBAAAA,eAAAA,mBAAYE,YAAY3B;AAEzB,cAAA,CAACa,OAAOe,aAAa,KAApB;AAAmC;QAAA,CAfpC;AAAA,MAiBP;AAAA,IACF;AAEoB,0BAAA,EAAGC,MAAMC,CAAS,UAAA;AAErCC,cAAQD,MAAMA,KAAd;AAAA,IAAA,CAFF;AAAA,EAAA,GAIC,CAAC5C,WAAWF,IAAZ,CAhDM;AAkDHgD,QAAAA,YAAYC,UAAAA,SAAS;AAAA,IAAEC,WAAW;AAAA,EAAA,CAAd;AAE1B,MAAI7C,iBAAiB;AAAc,WAAA;AAGjC,wCAAA,OAAA;AAAA,IACE,KAAKF;AAAAA,IACL;AAAA,IACA,WAAWgD,IAAAA,GAAGH,WAAWlD,OAAOC,MAAnB;AAAA,IACb,yBAAyB;AAAA,MAAEqD,QAAQpD;AAAAA,IAAV;AAAA,EAAA,CAL7B;AAQD,CA3EuB;;"}
package/dist/Embed.es.js CHANGED
@@ -8,9 +8,10 @@ import "redux-thunk";
8
8
  import "./actions.es.js";
9
9
  import "zod";
10
10
  import "./state/breakpoints.es.js";
11
+ import "slate";
12
+ import "uuid";
11
13
  import "@emotion/serialize";
12
14
  import "@emotion/utils";
13
- import "slate";
14
15
  import "is-hotkey";
15
16
  const defaultHtml = `<div style="padding: 24px; background-color: rgba(161, 168, 194, 0.18); overflow: hidden;">
16
17
  <svg width="316" height="168" viewBox="0 0 316 168" fill="none" xmlns="http://www.w3.org/2000/svg">
@@ -1 +1 @@
1
- {"version":3,"file":"Embed.es.js","sources":["../src/components/builtin/Embed/Embed.tsx"],"sourcesContent":["/* eslint-env browser */\n\nimport { useState, useEffect, forwardRef, Ref, useImperativeHandle } from 'react'\n\nimport { ElementIDValue, TextAreaValue } from '../../../prop-controllers/descriptors'\nimport { useIsomorphicLayoutEffect } from '../../hooks/useIsomorphicLayoutEffect'\nimport { useStyle } from '../../../runtimes/react/use-style'\nimport { cx } from '@emotion/css'\n\ntype Props = {\n id?: ElementIDValue\n html?: TextAreaValue\n width?: string\n margin?: string\n}\n\nconst defaultHtml = `<div style=\"padding: 24px; background-color: rgba(161, 168, 194, 0.18); overflow: hidden;\">\n<svg width=\"316\" height=\"168\" viewBox=\"0 0 316 168\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<rect width=\"70\" height=\"8\" rx=\"2\" fill=\"#A1A8C2\" fill-opacity=\"0.5\"/>\n<rect x=\"78\" width=\"30\" height=\"8\" rx=\"2\" fill=\"#A1A8C2\" fill-opacity=\"0.25\"/>\n<rect x=\"116\" width=\"78\" height=\"8\" rx=\"2\" fill=\"#A1A8C2\" fill-opacity=\"0.25\"/>\n<rect y=\"20\" width=\"120\" height=\"8\" rx=\"2\" fill=\"#A1A8C2\" fill-opacity=\"0.5\"/>\n<rect x=\"128\" y=\"20\" width=\"30\" height=\"8\" rx=\"2\" fill=\"#A1A8C2\" fill-opacity=\"0.25\"/>\n<rect x=\"166\" y=\"20\" width=\"78\" height=\"8\" rx=\"2\" fill=\"#A1A8C2\" fill-opacity=\"0.25\"/>\n<rect y=\"60\" width=\"40\" height=\"8\" rx=\"2\" fill=\"#A1A8C2\" fill-opacity=\"0.5\"/>\n<rect x=\"20\" y=\"80\" width=\"40\" height=\"8\" rx=\"2\" fill=\"#A1A8C2\" fill-opacity=\"0.5\"/>\n<rect x=\"40\" y=\"100\" width=\"40\" height=\"8\" rx=\"2\" fill=\"#A1A8C2\" fill-opacity=\"0.5\"/>\n<rect x=\"88\" y=\"100\" width=\"110\" height=\"8\" rx=\"2\" fill=\"#A1A8C2\" fill-opacity=\"0.25\"/>\n<rect x=\"206\" y=\"100\" width=\"24\" height=\"8\" rx=\"2\" fill=\"#A1A8C2\" fill-opacity=\"0.25\"/>\n<rect x=\"238\" y=\"100\" width=\"40\" height=\"8\" rx=\"2\" fill=\"#A1A8C2\" fill-opacity=\"0.5\"/>\n<rect x=\"40\" y=\"120\" width=\"40\" height=\"8\" rx=\"2\" fill=\"#A1A8C2\" fill-opacity=\"0.5\"/>\n<rect x=\"88\" y=\"120\" width=\"50\" height=\"8\" rx=\"2\" fill=\"#A1A8C2\" fill-opacity=\"0.25\"/>\n<rect x=\"146\" y=\"120\" width=\"24\" height=\"8\" rx=\"2\" fill=\"#A1A8C2\" fill-opacity=\"0.25\"/>\n<rect x=\"178\" y=\"120\" width=\"90\" height=\"8\" rx=\"2\" fill=\"#A1A8C2\" fill-opacity=\"0.25\"/>\n<rect x=\"276\" y=\"120\" width=\"40\" height=\"8\" rx=\"2\" fill=\"#A1A8C2\" fill-opacity=\"0.5\"/>\n<rect x=\"20\" y=\"140\" width=\"40\" height=\"8\" rx=\"2\" fill=\"#A1A8C2\" fill-opacity=\"0.5\"/>\n<rect y=\"160\" width=\"40\" height=\"8\" rx=\"2\" fill=\"#A1A8C2\" fill-opacity=\"0.5\"/>\n</svg>\n</div>`\nconst SCRIPT_TAG = 'script'\n\nconst Embed = forwardRef(function Embed(\n { id, width, margin, html = defaultHtml }: Props,\n ref: Ref<HTMLDivElement | null>,\n) {\n const [container, setContainer] = useState<HTMLDivElement | null>(null)\n const [shouldRender, setShouldRender] = useState(false)\n\n useIsomorphicLayoutEffect(() => {\n setShouldRender(true)\n }, [])\n\n useImperativeHandle(ref, () => container, [container])\n\n useEffect(() => {\n // TODO: When we SSR the editor, we can remove the editor check\n // and not run this effect on the first render.\n if (!container) return\n\n const walker = container.ownerDocument.createTreeWalker(container, NodeFilter.SHOW_ELEMENT, {\n acceptNode(node: Element) {\n return node.tagName.toLowerCase() === SCRIPT_TAG\n ? NodeFilter.FILTER_ACCEPT\n : NodeFilter.FILTER_REJECT\n },\n })\n\n const nodes: Element[] = []\n\n while (walker.nextNode()) nodes.push(walker.currentNode as Element)\n\n // By default scripts appended dynamically will execute asyncrhonously. Here we ensure that\n // scripts are loaded synchronously since that's what a user usually expects with scripts in\n // embedded in HTML which usually comes from the server.\n //\n // See: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script#notes\n async function executeScriptsInOrder() {\n for (let i = 0; i < nodes.length; i++) {\n await new Promise<void>(resolve => {\n const node = nodes[i]\n const script = node.ownerDocument.createElement(SCRIPT_TAG)\n\n script.textContent = node.textContent\n Array.from(node.attributes).forEach(({ name, value }) => {\n script.setAttribute(name, value)\n })\n\n script.onload = () => resolve()\n script.onerror = () => resolve()\n\n node.parentNode?.insertBefore(script, node)\n node.parentNode?.removeChild(node)\n\n if (!script.hasAttribute('src')) resolve()\n })\n }\n }\n\n executeScriptsInOrder().catch(error => {\n // Ignore errors from user-provided code\n console.error(error)\n })\n }, [container, html])\n\n const className = useStyle({ minHeight: 15 })\n\n if (shouldRender === false) return null\n\n return (\n <div\n ref={setContainer}\n id={id}\n className={cx(className, width, margin)}\n dangerouslySetInnerHTML={{ __html: html }}\n />\n )\n})\n\nexport default Embed\n"],"names":["defaultHtml","SCRIPT_TAG","Embed","forwardRef","id","width","margin","html","ref","container","setContainer","useState","shouldRender","setShouldRender","useIsomorphicLayoutEffect","useImperativeHandle","useEffect","walker","ownerDocument","createTreeWalker","NodeFilter","SHOW_ELEMENT","acceptNode","node","tagName","toLowerCase","FILTER_ACCEPT","FILTER_REJECT","nodes","nextNode","push","currentNode","i","length","Promise","resolve","script","createElement","textContent","Array","from","attributes","forEach","name","value","setAttribute","onload","onerror","parentNode","insertBefore","removeChild","hasAttribute","catch","error","console","className","useStyle","minHeight","cx","__html"],"mappings":";;;;;;;;;;;;;;AAgBA,MAAMA,cAAe;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAuBrB,MAAMC,aAAa;AAEbC,MAAAA,QAAQC,WAAW,gBACvB;AAAA,EAAEC;AAAAA,EAAIC;AAAAA,EAAOC;AAAAA,EAAQC,OAAOP;AAAAA,GAC5BQ,KACA;AACA,QAAM,CAACC,WAAWC,gBAAgBC,SAAgC,IAAxB;AACpC,QAAA,CAACC,cAAcC,mBAAmBF,SAAS,KAAD;AAEhDG,4BAA0B,MAAM;AAC9BD,oBAAgB,IAAD;AAAA,EADQ,GAEtB,CAFsB,CAAA;AAIzBE,sBAAoBP,KAAK,MAAMC,WAAW,CAACA,SAAD,CAAvB;AAEnBO,YAAU,MAAM;AAGV,QAAA,CAACP;AAAW;AAEhB,UAAMQ,SAASR,UAAUS,cAAcC,iBAAiBV,WAAWW,WAAWC,cAAc;AAAA,MAC1FC,WAAWC,MAAe;AACxB,eAAOA,KAAKC,QAAQC,kBAAkBxB,aAClCmB,WAAWM,gBACXN,WAAWO;AAAAA,MAChB;AAAA,IAAA,CALY;AAQf,UAAMC,QAAmB,CAAA;AAEzB,WAAOX,OAAOY,SAAP;AAAyBC,YAAAA,KAAKb,OAAOc;AAOL,2CAAA;AACrC,eAASC,IAAI,GAAGA,IAAIJ,MAAMK,QAAQD,KAAK;AAC/B,cAAA,IAAIE,QAAcC,CAAW,YAAA;;AACjC,gBAAMZ,OAAOK,MAAMI;AACbI,gBAAAA,SAASb,KAAKL,cAAcmB,cAAcpC,UAAjC;AAEfmC,iBAAOE,cAAcf,KAAKe;AAC1BC,gBAAMC,KAAKjB,KAAKkB,UAAhB,EAA4BC,QAAQ,CAAC;AAAA,YAAEC;AAAAA,YAAMC;AAAAA,gBAAY;AAChDC,mBAAAA,aAAaF,MAAMC,KAA1B;AAAA,UAAA,CADF;AAIOE,iBAAAA,SAAS,MAAMX;AACfY,iBAAAA,UAAU,MAAMZ;AAElBa,qBAAAA,eAAAA,mBAAYC,aAAab,QAAQb;AACjCyB,qBAAAA,eAAAA,mBAAYE,YAAY3B;AAEzB,cAAA,CAACa,OAAOe,aAAa,KAApB;AAAmC;QAAA,CAfpC;AAAA,MAiBP;AAAA,IACF;AAEoB,0BAAA,EAAGC,MAAMC,CAAS,UAAA;AAErCC,cAAQD,MAAMA,KAAd;AAAA,IAAA,CAFF;AAAA,EAAA,GAIC,CAAC5C,WAAWF,IAAZ,CAhDM;AAkDHgD,QAAAA,YAAYC,SAAS;AAAA,IAAEC,WAAW;AAAA,EAAA,CAAd;AAE1B,MAAI7C,iBAAiB;AAAc,WAAA;AAGjC,6BAAA,OAAA;AAAA,IACE,KAAKF;AAAAA,IACL;AAAA,IACA,WAAWgD,GAAGH,WAAWlD,OAAOC,MAAnB;AAAA,IACb,yBAAyB;AAAA,MAAEqD,QAAQpD;AAAAA,IAAV;AAAA,EAAA,CAL7B;AAQD,CA3EuB;;"}
1
+ {"version":3,"file":"Embed.es.js","sources":["../src/components/builtin/Embed/Embed.tsx"],"sourcesContent":["/* eslint-env browser */\n\nimport { useState, useEffect, forwardRef, Ref, useImperativeHandle } from 'react'\n\nimport { ElementIDValue, TextAreaValue } from '../../../prop-controllers/descriptors'\nimport { useIsomorphicLayoutEffect } from '../../hooks/useIsomorphicLayoutEffect'\nimport { useStyle } from '../../../runtimes/react/use-style'\nimport { cx } from '@emotion/css'\n\ntype Props = {\n id?: ElementIDValue\n html?: TextAreaValue\n width?: string\n margin?: string\n}\n\nconst defaultHtml = `<div style=\"padding: 24px; background-color: rgba(161, 168, 194, 0.18); overflow: hidden;\">\n<svg width=\"316\" height=\"168\" viewBox=\"0 0 316 168\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<rect width=\"70\" height=\"8\" rx=\"2\" fill=\"#A1A8C2\" fill-opacity=\"0.5\"/>\n<rect x=\"78\" width=\"30\" height=\"8\" rx=\"2\" fill=\"#A1A8C2\" fill-opacity=\"0.25\"/>\n<rect x=\"116\" width=\"78\" height=\"8\" rx=\"2\" fill=\"#A1A8C2\" fill-opacity=\"0.25\"/>\n<rect y=\"20\" width=\"120\" height=\"8\" rx=\"2\" fill=\"#A1A8C2\" fill-opacity=\"0.5\"/>\n<rect x=\"128\" y=\"20\" width=\"30\" height=\"8\" rx=\"2\" fill=\"#A1A8C2\" fill-opacity=\"0.25\"/>\n<rect x=\"166\" y=\"20\" width=\"78\" height=\"8\" rx=\"2\" fill=\"#A1A8C2\" fill-opacity=\"0.25\"/>\n<rect y=\"60\" width=\"40\" height=\"8\" rx=\"2\" fill=\"#A1A8C2\" fill-opacity=\"0.5\"/>\n<rect x=\"20\" y=\"80\" width=\"40\" height=\"8\" rx=\"2\" fill=\"#A1A8C2\" fill-opacity=\"0.5\"/>\n<rect x=\"40\" y=\"100\" width=\"40\" height=\"8\" rx=\"2\" fill=\"#A1A8C2\" fill-opacity=\"0.5\"/>\n<rect x=\"88\" y=\"100\" width=\"110\" height=\"8\" rx=\"2\" fill=\"#A1A8C2\" fill-opacity=\"0.25\"/>\n<rect x=\"206\" y=\"100\" width=\"24\" height=\"8\" rx=\"2\" fill=\"#A1A8C2\" fill-opacity=\"0.25\"/>\n<rect x=\"238\" y=\"100\" width=\"40\" height=\"8\" rx=\"2\" fill=\"#A1A8C2\" fill-opacity=\"0.5\"/>\n<rect x=\"40\" y=\"120\" width=\"40\" height=\"8\" rx=\"2\" fill=\"#A1A8C2\" fill-opacity=\"0.5\"/>\n<rect x=\"88\" y=\"120\" width=\"50\" height=\"8\" rx=\"2\" fill=\"#A1A8C2\" fill-opacity=\"0.25\"/>\n<rect x=\"146\" y=\"120\" width=\"24\" height=\"8\" rx=\"2\" fill=\"#A1A8C2\" fill-opacity=\"0.25\"/>\n<rect x=\"178\" y=\"120\" width=\"90\" height=\"8\" rx=\"2\" fill=\"#A1A8C2\" fill-opacity=\"0.25\"/>\n<rect x=\"276\" y=\"120\" width=\"40\" height=\"8\" rx=\"2\" fill=\"#A1A8C2\" fill-opacity=\"0.5\"/>\n<rect x=\"20\" y=\"140\" width=\"40\" height=\"8\" rx=\"2\" fill=\"#A1A8C2\" fill-opacity=\"0.5\"/>\n<rect y=\"160\" width=\"40\" height=\"8\" rx=\"2\" fill=\"#A1A8C2\" fill-opacity=\"0.5\"/>\n</svg>\n</div>`\nconst SCRIPT_TAG = 'script'\n\nconst Embed = forwardRef(function Embed(\n { id, width, margin, html = defaultHtml }: Props,\n ref: Ref<HTMLDivElement | null>,\n) {\n const [container, setContainer] = useState<HTMLDivElement | null>(null)\n const [shouldRender, setShouldRender] = useState(false)\n\n useIsomorphicLayoutEffect(() => {\n setShouldRender(true)\n }, [])\n\n useImperativeHandle(ref, () => container, [container])\n\n useEffect(() => {\n // TODO: When we SSR the editor, we can remove the editor check\n // and not run this effect on the first render.\n if (!container) return\n\n const walker = container.ownerDocument.createTreeWalker(container, NodeFilter.SHOW_ELEMENT, {\n acceptNode(node: Element) {\n return node.tagName.toLowerCase() === SCRIPT_TAG\n ? NodeFilter.FILTER_ACCEPT\n : NodeFilter.FILTER_REJECT\n },\n })\n\n const nodes: Element[] = []\n\n while (walker.nextNode()) nodes.push(walker.currentNode as Element)\n\n // By default scripts appended dynamically will execute asyncrhonously. Here we ensure that\n // scripts are loaded synchronously since that's what a user usually expects with scripts in\n // embedded in HTML which usually comes from the server.\n //\n // See: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script#notes\n async function executeScriptsInOrder() {\n for (let i = 0; i < nodes.length; i++) {\n await new Promise<void>(resolve => {\n const node = nodes[i]\n const script = node.ownerDocument.createElement(SCRIPT_TAG)\n\n script.textContent = node.textContent\n Array.from(node.attributes).forEach(({ name, value }) => {\n script.setAttribute(name, value)\n })\n\n script.onload = () => resolve()\n script.onerror = () => resolve()\n\n node.parentNode?.insertBefore(script, node)\n node.parentNode?.removeChild(node)\n\n if (!script.hasAttribute('src')) resolve()\n })\n }\n }\n\n executeScriptsInOrder().catch(error => {\n // Ignore errors from user-provided code\n console.error(error)\n })\n }, [container, html])\n\n const className = useStyle({ minHeight: 15 })\n\n if (shouldRender === false) return null\n\n return (\n <div\n ref={setContainer}\n id={id}\n className={cx(className, width, margin)}\n dangerouslySetInnerHTML={{ __html: html }}\n />\n )\n})\n\nexport default Embed\n"],"names":["defaultHtml","SCRIPT_TAG","Embed","forwardRef","id","width","margin","html","ref","container","setContainer","useState","shouldRender","setShouldRender","useIsomorphicLayoutEffect","useImperativeHandle","useEffect","walker","ownerDocument","createTreeWalker","NodeFilter","SHOW_ELEMENT","acceptNode","node","tagName","toLowerCase","FILTER_ACCEPT","FILTER_REJECT","nodes","nextNode","push","currentNode","i","length","Promise","resolve","script","createElement","textContent","Array","from","attributes","forEach","name","value","setAttribute","onload","onerror","parentNode","insertBefore","removeChild","hasAttribute","catch","error","console","className","useStyle","minHeight","cx","__html"],"mappings":";;;;;;;;;;;;;;;AAgBA,MAAMA,cAAe;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAuBrB,MAAMC,aAAa;AAEbC,MAAAA,QAAQC,WAAW,gBACvB;AAAA,EAAEC;AAAAA,EAAIC;AAAAA,EAAOC;AAAAA,EAAQC,OAAOP;AAAAA,GAC5BQ,KACA;AACA,QAAM,CAACC,WAAWC,gBAAgBC,SAAgC,IAAxB;AACpC,QAAA,CAACC,cAAcC,mBAAmBF,SAAS,KAAD;AAEhDG,4BAA0B,MAAM;AAC9BD,oBAAgB,IAAD;AAAA,EADQ,GAEtB,CAFsB,CAAA;AAIzBE,sBAAoBP,KAAK,MAAMC,WAAW,CAACA,SAAD,CAAvB;AAEnBO,YAAU,MAAM;AAGV,QAAA,CAACP;AAAW;AAEhB,UAAMQ,SAASR,UAAUS,cAAcC,iBAAiBV,WAAWW,WAAWC,cAAc;AAAA,MAC1FC,WAAWC,MAAe;AACxB,eAAOA,KAAKC,QAAQC,kBAAkBxB,aAClCmB,WAAWM,gBACXN,WAAWO;AAAAA,MAChB;AAAA,IAAA,CALY;AAQf,UAAMC,QAAmB,CAAA;AAEzB,WAAOX,OAAOY,SAAP;AAAyBC,YAAAA,KAAKb,OAAOc;AAOL,2CAAA;AACrC,eAASC,IAAI,GAAGA,IAAIJ,MAAMK,QAAQD,KAAK;AAC/B,cAAA,IAAIE,QAAcC,CAAW,YAAA;;AACjC,gBAAMZ,OAAOK,MAAMI;AACbI,gBAAAA,SAASb,KAAKL,cAAcmB,cAAcpC,UAAjC;AAEfmC,iBAAOE,cAAcf,KAAKe;AAC1BC,gBAAMC,KAAKjB,KAAKkB,UAAhB,EAA4BC,QAAQ,CAAC;AAAA,YAAEC;AAAAA,YAAMC;AAAAA,gBAAY;AAChDC,mBAAAA,aAAaF,MAAMC,KAA1B;AAAA,UAAA,CADF;AAIOE,iBAAAA,SAAS,MAAMX;AACfY,iBAAAA,UAAU,MAAMZ;AAElBa,qBAAAA,eAAAA,mBAAYC,aAAab,QAAQb;AACjCyB,qBAAAA,eAAAA,mBAAYE,YAAY3B;AAEzB,cAAA,CAACa,OAAOe,aAAa,KAApB;AAAmC;QAAA,CAfpC;AAAA,MAiBP;AAAA,IACF;AAEoB,0BAAA,EAAGC,MAAMC,CAAS,UAAA;AAErCC,cAAQD,MAAMA,KAAd;AAAA,IAAA,CAFF;AAAA,EAAA,GAIC,CAAC5C,WAAWF,IAAZ,CAhDM;AAkDHgD,QAAAA,YAAYC,SAAS;AAAA,IAAEC,WAAW;AAAA,EAAA,CAAd;AAE1B,MAAI7C,iBAAiB;AAAc,WAAA;AAGjC,6BAAA,OAAA;AAAA,IACE,KAAKF;AAAAA,IACL;AAAA,IACA,WAAWgD,GAAGH,WAAWlD,OAAOC,MAAnB;AAAA,IACb,yBAAyB;AAAA,MAAEqD,QAAQpD;AAAAA,IAAV;AAAA,EAAA,CAL7B;AAQD,CA3EuB;;"}
package/dist/Form.cjs.js CHANGED
@@ -45,9 +45,10 @@ require("redux-thunk");
45
45
  require("./actions.cjs.js");
46
46
  require("zod");
47
47
  require("./state/breakpoints.cjs.js");
48
+ require("slate");
49
+ require("uuid");
48
50
  require("@emotion/serialize");
49
51
  require("@emotion/utils");
50
- require("slate");
51
52
  require("is-hotkey");
52
53
  require("use-sync-external-store/shim/with-selector");
53
54
  require("next/dynamic");
@@ -67,7 +68,6 @@ require("cookie");
67
68
  require("http-proxy");
68
69
  require("set-cookie-parser");
69
70
  require("./constants.cjs.js");
70
- require("uuid");
71
71
  require("corporate-ipsum");
72
72
  require("slate-react");
73
73
  require("next/link");
package/dist/Form.es.js CHANGED
@@ -44,9 +44,10 @@ import "redux-thunk";
44
44
  import "./actions.es.js";
45
45
  import "zod";
46
46
  import "./state/breakpoints.es.js";
47
+ import "slate";
48
+ import "uuid";
47
49
  import "@emotion/serialize";
48
50
  import "@emotion/utils";
49
- import "slate";
50
51
  import "is-hotkey";
51
52
  import "use-sync-external-store/shim/with-selector";
52
53
  import "next/dynamic";
@@ -66,7 +67,6 @@ import "cookie";
66
67
  import "http-proxy";
67
68
  import "set-cookie-parser";
68
69
  import "./constants.es.js";
69
- import "uuid";
70
70
  import "corporate-ipsum";
71
71
  import "slate-react";
72
72
  import "next/link";
package/dist/Image.cjs.js CHANGED
@@ -15,6 +15,7 @@ require("use-sync-external-store/shim/with-selector");
15
15
  require("next/dynamic");
16
16
  require("./text-input.cjs.js");
17
17
  require("./combobox.cjs.js");
18
+ require("uuid");
18
19
  require("slate");
19
20
  require("use-sync-external-store/shim");
20
21
  require("redux");
@@ -35,7 +36,6 @@ require("cookie");
35
36
  require("http-proxy");
36
37
  require("set-cookie-parser");
37
38
  require("./constants.cjs.js");
38
- require("uuid");
39
39
  require("corporate-ipsum");
40
40
  require("is-hotkey");
41
41
  require("slate-react");
package/dist/Image.es.js CHANGED
@@ -13,6 +13,7 @@ import "use-sync-external-store/shim/with-selector";
13
13
  import "next/dynamic";
14
14
  import "./text-input.es.js";
15
15
  import "./combobox.es.js";
16
+ import "uuid";
16
17
  import "slate";
17
18
  import "use-sync-external-store/shim";
18
19
  import "redux";
@@ -33,7 +34,6 @@ import "cookie";
33
34
  import "http-proxy";
34
35
  import "set-cookie-parser";
35
36
  import "./constants.es.js";
36
- import "uuid";
37
37
  import "corporate-ipsum";
38
38
  import "is-hotkey";
39
39
  import "slate-react";
@@ -10,6 +10,7 @@ require("./actions.cjs.js");
10
10
  require("zod");
11
11
  require("./text-input.cjs.js");
12
12
  require("./combobox.cjs.js");
13
+ require("uuid");
13
14
  require("slate");
14
15
  require("use-sync-external-store/shim");
15
16
  require("redux");
@@ -32,7 +33,6 @@ require("cookie");
32
33
  require("http-proxy");
33
34
  require("set-cookie-parser");
34
35
  require("./constants.cjs.js");
35
- require("uuid");
36
36
  require("corporate-ipsum");
37
37
  require("is-hotkey");
38
38
  require("slate-react");
@@ -8,6 +8,7 @@ import "./actions.es.js";
8
8
  import "zod";
9
9
  import "./text-input.es.js";
10
10
  import "./combobox.es.js";
11
+ import "uuid";
11
12
  import "slate";
12
13
  import "use-sync-external-store/shim";
13
14
  import "redux";
@@ -30,7 +31,6 @@ import "cookie";
30
31
  import "http-proxy";
31
32
  import "set-cookie-parser";
32
33
  import "./constants.es.js";
33
- import "uuid";
34
34
  import "corporate-ipsum";
35
35
  import "is-hotkey";
36
36
  import "slate-react";
@@ -40,6 +40,7 @@ var jsxRuntime = require("react/jsx-runtime");
40
40
  var next = require("./index.cjs.js");
41
41
  require("use-sync-external-store/shim");
42
42
  require("./actions.cjs.js");
43
+ require("uuid");
43
44
  require("slate");
44
45
  require("./state/breakpoints.cjs.js");
45
46
  var useIsomorphicLayoutEffect = require("./useIsomorphicLayoutEffect.cjs.js");
@@ -71,7 +72,6 @@ require("cookie");
71
72
  require("http-proxy");
72
73
  require("set-cookie-parser");
73
74
  require("./constants.cjs.js");
74
- require("uuid");
75
75
  require("corporate-ipsum");
76
76
  require("is-hotkey");
77
77
  require("slate-react");
@@ -39,6 +39,7 @@ import { jsx, Fragment, jsxs } from "react/jsx-runtime";
39
39
  import { l as useResponsiveColor, L as Link, p as useResponsiveTextStyle, n as useResponsiveStyle, q as colorToString } from "./index.es.js";
40
40
  import "use-sync-external-store/shim";
41
41
  import "./actions.es.js";
42
+ import "uuid";
42
43
  import "slate";
43
44
  import "./state/breakpoints.es.js";
44
45
  import { u as useIsomorphicLayoutEffect } from "./useIsomorphicLayoutEffect.es.js";
@@ -70,7 +71,6 @@ import "cookie";
70
71
  import "http-proxy";
71
72
  import "set-cookie-parser";
72
73
  import "./constants.es.js";
73
- import "uuid";
74
74
  import "corporate-ipsum";
75
75
  import "is-hotkey";
76
76
  import "slate-react";
@@ -35,6 +35,7 @@ require("use-sync-external-store/shim/with-selector");
35
35
  require("next/dynamic");
36
36
  require("./text-input.cjs.js");
37
37
  require("./combobox.cjs.js");
38
+ require("uuid");
38
39
  require("slate");
39
40
  require("use-sync-external-store/shim");
40
41
  require("./types.cjs.js");
@@ -53,7 +54,6 @@ require("cookie");
53
54
  require("http-proxy");
54
55
  require("set-cookie-parser");
55
56
  require("./constants.cjs.js");
56
- require("uuid");
57
57
  require("corporate-ipsum");
58
58
  require("is-hotkey");
59
59
  require("slate-react");
@@ -23,7 +23,7 @@ import { H as ElementImperativeHandle, a as ReactRuntime, I as StoreContext, M a
23
23
  import { createStore, applyMiddleware, combineReducers } from "redux";
24
24
  import thunk from "redux-thunk";
25
25
  import Router from "next/router";
26
- import { bV as getInitialState$3, bW as reducer$4, bX as getDocument$1, c as createDocument, bY as getComponentsMeta$1, bZ as getComponentPropControllerDescriptors$1, av as getBreakpoints, h as getLocales, f as getDefaultLocale, a as deepEqual, aB as getBuilderEditMode, b_ as BuilderEditMode, b$ as getDocumentKeysSortedByDepth, c0 as getPropController, c1 as getPropControllersHandle, c2 as getElement, c3 as getElementPropControllerDescriptors, c4 as createPropController, e as isElementReference, a4 as isPropControllersHandle, c5 as reducer$5, c6 as reducer$7, c7 as reducer$8, c8 as reducer$9, c9 as reducer$a, ca as reducer$b, cb as reducer$c, cc as reducer$e, cd as getInitialState$4 } from "./react-page.es.js";
26
+ import { bW as getInitialState$3, bX as reducer$4, bY as getDocument$1, c as createDocument, bZ as getComponentsMeta$1, b_ as getComponentPropControllerDescriptors$1, av as getBreakpoints, h as getLocales, f as getDefaultLocale, a as deepEqual, aB as getBuilderEditMode, b$ as BuilderEditMode, c0 as getDocumentKeysSortedByDepth, c1 as getPropController, c2 as getPropControllersHandle, c3 as getElement, c4 as getElementPropControllerDescriptors, c5 as createPropController, e as isElementReference, a4 as isPropControllersHandle, c6 as reducer$5, c7 as reducer$7, c8 as reducer$8, c9 as reducer$9, ca as reducer$a, cb as reducer$b, cc as reducer$c, cd as reducer$e, ce as getInitialState$4 } from "./react-page.es.js";
27
27
  import { removeIn, setIn } from "immutable";
28
28
  import { A as ActionTypes, w as unregisterMeasurable, x as registerMeasurable, y as registerBuilderComponent, j as setBreakpoints, l as setLocales, z as setDefaultLocale, k as setLocale, B as changePathnameStart, C as changePathnameComplete, D as changeElementBoxModels, E as changeDocumentElementSize, F as handleWheel, G as handlePointerMove, H as elementFromPointChange, I as setIsInBuilder, J as unregisterBuilderComponent, K as unregisterPropControllers, L as registerPropControllers, M as registerPropControllersHandle, r as registerDocument, N as registerComponentHandle, O as messageBuilderPropController, P as registerDocumentEffect } from "./actions.es.js";
29
29
  import { i as isMeasurable, a as getMeasurables$1, b as getBoxModels$1, m as measure, d as getBoxModel$1, r as reducer$6 } from "./box-models.es.js";
@@ -34,6 +34,7 @@ import "use-sync-external-store/shim/with-selector";
34
34
  import "next/dynamic";
35
35
  import "./text-input.es.js";
36
36
  import "./combobox.es.js";
37
+ import "uuid";
37
38
  import "slate";
38
39
  import "use-sync-external-store/shim";
39
40
  import "./types.es.js";
@@ -52,7 +53,6 @@ import "cookie";
52
53
  import "http-proxy";
53
54
  import "set-cookie-parser";
54
55
  import "./constants.es.js";
55
- import "uuid";
56
56
  import "corporate-ipsum";
57
57
  import "is-hotkey";
58
58
  import "slate-react";
@@ -6,11 +6,11 @@ var next = require("./index.cjs.js");
6
6
  var reactPage = require("./react-page.cjs.js");
7
7
  require("./actions.cjs.js");
8
8
  require("slate");
9
+ require("uuid");
9
10
  require("./state/breakpoints.cjs.js");
10
11
  require("is-hotkey");
11
12
  var jsxRuntime = require("react/jsx-runtime");
12
13
  require("slate-react");
13
- require("uuid");
14
14
  require("use-sync-external-store/shim/with-selector");
15
15
  require("next/dynamic");
16
16
  require("./text-input.cjs.js");
@@ -1,14 +1,14 @@
1
1
  import { cx } from "@emotion/css";
2
2
  import { forwardRef } from "react";
3
3
  import { J as useEnhancedTypography, K as useTypographyClassName, n as useResponsiveStyle, L as Link } from "./index.es.js";
4
- import { bn as richTextDTOtoDAO, _ as useStyle, Y as BlockType, bM as InlineType } from "./react-page.es.js";
4
+ import { bo as richTextDTOtoDAO, _ as useStyle, Y as BlockType, bO as InlineType } from "./react-page.es.js";
5
5
  import "./actions.es.js";
6
6
  import "slate";
7
+ import "uuid";
7
8
  import "./state/breakpoints.es.js";
8
9
  import "is-hotkey";
9
10
  import { jsx, Fragment } from "react/jsx-runtime";
10
11
  import "slate-react";
11
- import "uuid";
12
12
  import "use-sync-external-store/shim/with-selector";
13
13
  import "next/dynamic";
14
14
  import "./text-input.es.js";
@@ -19,9 +19,9 @@ var React = require("react");
19
19
  var reactPage = require("./react-page.cjs.js");
20
20
  require("./actions.cjs.js");
21
21
  require("slate");
22
+ require("uuid");
22
23
  require("slate-react");
23
24
  var index = require("./index.cjs5.js");
24
- require("uuid");
25
25
  var next = require("./index.cjs.js");
26
26
  var jsxRuntime = require("react/jsx-runtime");
27
27
  require("redux");
@@ -14,12 +14,12 @@ var __objRest = (source, exclude) => {
14
14
  return target;
15
15
  };
16
16
  import { forwardRef } from "react";
17
- import { bq as RichTextV2Mode, bI as InlineModePlugin, bG as BlockPlugin, bB as TypographyPlugin, bK as TextAlignPlugin, bP as InlinePlugin, _ as useStyle, Y as BlockType, bM as InlineType } from "./react-page.es.js";
17
+ import { br as RichTextV2Mode, bK as InlineModePlugin, bI as BlockPlugin, bD as TypographyPlugin, bM as TextAlignPlugin, bR as InlinePlugin, _ as useStyle, Y as BlockType, bO as InlineType } from "./react-page.es.js";
18
18
  import "./actions.es.js";
19
19
  import "slate";
20
+ import "uuid";
20
21
  import "slate-react";
21
22
  import { L as LinkPlugin } from "./index.es5.js";
22
- import "uuid";
23
23
  import { Q as ControlValue } from "./index.es.js";
24
24
  import { jsx, Fragment } from "react/jsx-runtime";
25
25
  import "redux";
package/dist/Root.cjs.js CHANGED
@@ -16,6 +16,7 @@ require("./actions.cjs.js");
16
16
  require("zod");
17
17
  require("./state/breakpoints.cjs.js");
18
18
  require("slate");
19
+ require("uuid");
19
20
  require("is-hotkey");
20
21
  require("use-sync-external-store/shim/with-selector");
21
22
  require("next/dynamic");
@@ -38,7 +39,6 @@ require("cookie");
38
39
  require("http-proxy");
39
40
  require("set-cookie-parser");
40
41
  require("./constants.cjs.js");
41
- require("uuid");
42
42
  require("corporate-ipsum");
43
43
  require("slate-react");
44
44
  require("next/link");
package/dist/Root.es.js CHANGED
@@ -15,6 +15,7 @@ import "./actions.es.js";
15
15
  import "zod";
16
16
  import "./state/breakpoints.es.js";
17
17
  import "slate";
18
+ import "uuid";
18
19
  import "is-hotkey";
19
20
  import "use-sync-external-store/shim/with-selector";
20
21
  import "next/dynamic";
@@ -37,7 +38,6 @@ import "cookie";
37
38
  import "http-proxy";
38
39
  import "set-cookie-parser";
39
40
  import "./constants.es.js";
40
- import "uuid";
41
41
  import "corporate-ipsum";
42
42
  import "slate-react";
43
43
  import "next/link";
@@ -43,6 +43,7 @@ require("./actions.cjs.js");
43
43
  require("zod");
44
44
  require("./text-input.cjs.js");
45
45
  require("./combobox.cjs.js");
46
+ require("uuid");
46
47
  require("slate");
47
48
  require("use-sync-external-store/shim");
48
49
  require("redux");
@@ -64,7 +65,6 @@ require("cookie");
64
65
  require("http-proxy");
65
66
  require("set-cookie-parser");
66
67
  require("./constants.cjs.js");
67
- require("uuid");
68
68
  require("corporate-ipsum");
69
69
  require("is-hotkey");
70
70
  require("slate-react");
@@ -42,6 +42,7 @@ import "./actions.es.js";
42
42
  import "zod";
43
43
  import "./text-input.es.js";
44
44
  import "./combobox.es.js";
45
+ import "uuid";
45
46
  import "slate";
46
47
  import "use-sync-external-store/shim";
47
48
  import "redux";
@@ -63,7 +64,6 @@ import "cookie";
63
64
  import "http-proxy";
64
65
  import "set-cookie-parser";
65
66
  import "./constants.es.js";
66
- import "uuid";
67
67
  import "corporate-ipsum";
68
68
  import "is-hotkey";
69
69
  import "slate-react";
package/dist/Video.cjs.js CHANGED
@@ -30,9 +30,10 @@ require("redux-thunk");
30
30
  require("./actions.cjs.js");
31
31
  require("zod");
32
32
  require("./state/breakpoints.cjs.js");
33
+ require("slate");
34
+ require("uuid");
33
35
  require("@emotion/serialize");
34
36
  require("@emotion/utils");
35
- require("slate");
36
37
  require("is-hotkey");
37
38
  function _interopDefaultLegacy(e) {
38
39
  return e && typeof e === "object" && "default" in e ? e : { "default": e };
@@ -1 +1 @@
1
- {"version":3,"file":"Video.cjs.js","sources":["../src/components/builtin/Video/Video.tsx"],"sourcesContent":["import { cx } from '@emotion/css'\nimport { forwardRef, Ref, useEffect, useState } from 'react'\nimport ReactPlayer from 'react-player'\n\nimport { ElementIDValue, VideoValue } from '../../../prop-controllers/descriptors'\nimport { useStyle } from '../../../runtimes/react/use-style'\nimport { placeholders } from '../../utils/placeholders'\n\ntype Props = {\n id?: ElementIDValue\n video?: VideoValue\n width?: string\n margin?: string\n borderRadius?: string\n}\n\nconst ASPECT_RATIO = 16 / 9\n\nconst Video = forwardRef(function Video(\n { id, video, width, margin, borderRadius }: Props,\n ref: Ref<HTMLDivElement>,\n) {\n const canPlayUrl = video && video.url != null && ReactPlayer.canPlay(video.url)\n /**\n * @see https://github.com/cookpete/react-player/issues/1428\n */\n const [shouldRenderReactPlayer, setShouldRenderReactPlayer] = useState(false)\n\n useEffect(() => {\n setShouldRenderReactPlayer(true)\n }, [])\n\n return (\n <div\n ref={ref}\n id={id}\n className={cx(\n useStyle({ display: 'flex', flexDirection: 'column', overflow: 'hidden' }),\n width,\n margin,\n borderRadius,\n )}\n >\n <div style={{ position: 'relative', paddingTop: `${100 / ASPECT_RATIO}%` }}>\n <div style={{ position: 'absolute', top: 0, left: 0, right: 0, bottom: 0 }}>\n {shouldRenderReactPlayer && canPlayUrl === true ? (\n <ReactPlayer\n {...video}\n width=\"100%\"\n height=\"100%\"\n config={{\n vimeo: { playerOptions: { background: video != null && !video.controls } },\n wistia: {\n options: {\n endVideoBehavior: video != null && video.loop === true ? 'loop' : 'default',\n },\n },\n }}\n />\n ) : (\n <img width=\"100%\" src={placeholders.video.src} alt=\"Video Placeholder\" />\n )}\n </div>\n </div>\n </div>\n )\n})\n\nexport default Video\n"],"names":["ASPECT_RATIO","Video","forwardRef","id","video","width","margin","borderRadius","ref","canPlayUrl","url","ReactPlayer","canPlay","shouldRenderReactPlayer","setShouldRenderReactPlayer","useState","useEffect","cx","useStyle","display","flexDirection","overflow","position","paddingTop","top","left","right","bottom","vimeo","playerOptions","background","controls","wistia","options","endVideoBehavior","loop","_jsx","placeholders","src"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgBA,MAAMA,eAAe,KAAK;AAEpBC,MAAAA,QAAQC,MAAAA,WAAW,gBACvB;AAAA,EAAEC;AAAAA,EAAIC;AAAAA,EAAOC;AAAAA,EAAOC;AAAAA,EAAQC;AAAAA,GAC5BC,KACA;AACMC,QAAAA,aAAaL,SAASA,MAAMM,OAAO,QAAQC,qBAAAA,WAAYC,QAAQR,MAAMM,GAA1B;AAI3C,QAAA,CAACG,yBAAyBC,8BAA8BC,MAAAA,SAAS,KAAD;AAEtEC,QAAAA,UAAU,MAAM;AACdF,+BAA2B,IAAD;AAAA,EADnB,GAEN,CAFM,CAAA;AAKP,wCAAA,OAAA;AAAA,IACE;AAAA,IACA;AAAA,IACA,WAAWG,OACTC,mBAAS;AAAA,MAAEC,SAAS;AAAA,MAAQC,eAAe;AAAA,MAAUC,UAAU;AAAA,IAAA,CAAvD,GACRhB,OACAC,QACAC,YAJW;AAAA,IAOb,yCAAA,OAAA;AAAA,MAAK,OAAO;AAAA,QAAEe,UAAU;AAAA,QAAYC,YAAa,GAAE,MAAMvB;AAAAA,MAAzD;AAAA,MACE,yCAAA,OAAA;AAAA,QAAK,OAAO;AAAA,UAAEsB,UAAU;AAAA,UAAYE,KAAK;AAAA,UAAGC,MAAM;AAAA,UAAGC,OAAO;AAAA,UAAGC,QAAQ;AAAA,QAAvE;AAAA,QACGd,UAAAA,2BAA2BJ,eAAe,sCACxCE,qBAAAA,YAAD,iCACMP,QADN;AAAA,UAEE,OAAM;AAAA,UACN,QAAO;AAAA,UACP,QAAQ;AAAA,YACNwB,OAAO;AAAA,cAAEC,eAAe;AAAA,gBAAEC,YAAY1B,SAAS,QAAQ,CAACA,MAAM2B;AAAAA,cAAtC;AAAA,YADlB;AAAA,YAENC,QAAQ;AAAA,cACNC,SAAS;AAAA,gBACPC,kBAAkB9B,SAAS,QAAQA,MAAM+B,SAAS,OAAO,SAAS;AAAA,cAD3D;AAAA,YADH;AAAA,UAFF;AAAA,QAAA,EAJV,IAcAC,2BAAA,IAAA,OAAA;AAAA,UAAK,OAAM;AAAA,UAAO,KAAKC,aAAAA,aAAajC,MAAMkC;AAAAA,UAAK,KAAI;AAAA,QAAA,CAAnD;AAAA,MAAA,CAhBJ;AAAA,IAAA,CADF;AAAA,EAAA,CAXJ;AAkCD,CAhDuB;;"}
1
+ {"version":3,"file":"Video.cjs.js","sources":["../src/components/builtin/Video/Video.tsx"],"sourcesContent":["import { cx } from '@emotion/css'\nimport { forwardRef, Ref, useEffect, useState } from 'react'\nimport ReactPlayer from 'react-player'\n\nimport { ElementIDValue, VideoValue } from '../../../prop-controllers/descriptors'\nimport { useStyle } from '../../../runtimes/react/use-style'\nimport { placeholders } from '../../utils/placeholders'\n\ntype Props = {\n id?: ElementIDValue\n video?: VideoValue\n width?: string\n margin?: string\n borderRadius?: string\n}\n\nconst ASPECT_RATIO = 16 / 9\n\nconst Video = forwardRef(function Video(\n { id, video, width, margin, borderRadius }: Props,\n ref: Ref<HTMLDivElement>,\n) {\n const canPlayUrl = video && video.url != null && ReactPlayer.canPlay(video.url)\n /**\n * @see https://github.com/cookpete/react-player/issues/1428\n */\n const [shouldRenderReactPlayer, setShouldRenderReactPlayer] = useState(false)\n\n useEffect(() => {\n setShouldRenderReactPlayer(true)\n }, [])\n\n return (\n <div\n ref={ref}\n id={id}\n className={cx(\n useStyle({ display: 'flex', flexDirection: 'column', overflow: 'hidden' }),\n width,\n margin,\n borderRadius,\n )}\n >\n <div style={{ position: 'relative', paddingTop: `${100 / ASPECT_RATIO}%` }}>\n <div style={{ position: 'absolute', top: 0, left: 0, right: 0, bottom: 0 }}>\n {shouldRenderReactPlayer && canPlayUrl === true ? (\n <ReactPlayer\n {...video}\n width=\"100%\"\n height=\"100%\"\n config={{\n vimeo: { playerOptions: { background: video != null && !video.controls } },\n wistia: {\n options: {\n endVideoBehavior: video != null && video.loop === true ? 'loop' : 'default',\n },\n },\n }}\n />\n ) : (\n <img width=\"100%\" src={placeholders.video.src} alt=\"Video Placeholder\" />\n )}\n </div>\n </div>\n </div>\n )\n})\n\nexport default Video\n"],"names":["ASPECT_RATIO","Video","forwardRef","id","video","width","margin","borderRadius","ref","canPlayUrl","url","ReactPlayer","canPlay","shouldRenderReactPlayer","setShouldRenderReactPlayer","useState","useEffect","cx","useStyle","display","flexDirection","overflow","position","paddingTop","top","left","right","bottom","vimeo","playerOptions","background","controls","wistia","options","endVideoBehavior","loop","_jsx","placeholders","src"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgBA,MAAMA,eAAe,KAAK;AAEpBC,MAAAA,QAAQC,MAAAA,WAAW,gBACvB;AAAA,EAAEC;AAAAA,EAAIC;AAAAA,EAAOC;AAAAA,EAAOC;AAAAA,EAAQC;AAAAA,GAC5BC,KACA;AACMC,QAAAA,aAAaL,SAASA,MAAMM,OAAO,QAAQC,qBAAAA,WAAYC,QAAQR,MAAMM,GAA1B;AAI3C,QAAA,CAACG,yBAAyBC,8BAA8BC,MAAAA,SAAS,KAAD;AAEtEC,QAAAA,UAAU,MAAM;AACdF,+BAA2B,IAAD;AAAA,EADnB,GAEN,CAFM,CAAA;AAKP,wCAAA,OAAA;AAAA,IACE;AAAA,IACA;AAAA,IACA,WAAWG,OACTC,mBAAS;AAAA,MAAEC,SAAS;AAAA,MAAQC,eAAe;AAAA,MAAUC,UAAU;AAAA,IAAA,CAAvD,GACRhB,OACAC,QACAC,YAJW;AAAA,IAOb,yCAAA,OAAA;AAAA,MAAK,OAAO;AAAA,QAAEe,UAAU;AAAA,QAAYC,YAAa,GAAE,MAAMvB;AAAAA,MAAzD;AAAA,MACE,yCAAA,OAAA;AAAA,QAAK,OAAO;AAAA,UAAEsB,UAAU;AAAA,UAAYE,KAAK;AAAA,UAAGC,MAAM;AAAA,UAAGC,OAAO;AAAA,UAAGC,QAAQ;AAAA,QAAvE;AAAA,QACGd,UAAAA,2BAA2BJ,eAAe,sCACxCE,qBAAAA,YAAD,iCACMP,QADN;AAAA,UAEE,OAAM;AAAA,UACN,QAAO;AAAA,UACP,QAAQ;AAAA,YACNwB,OAAO;AAAA,cAAEC,eAAe;AAAA,gBAAEC,YAAY1B,SAAS,QAAQ,CAACA,MAAM2B;AAAAA,cAAtC;AAAA,YADlB;AAAA,YAENC,QAAQ;AAAA,cACNC,SAAS;AAAA,gBACPC,kBAAkB9B,SAAS,QAAQA,MAAM+B,SAAS,OAAO,SAAS;AAAA,cAD3D;AAAA,YADH;AAAA,UAFF;AAAA,QAAA,EAJV,IAcAC,2BAAA,IAAA,OAAA;AAAA,UAAK,OAAM;AAAA,UAAO,KAAKC,aAAAA,aAAajC,MAAMkC;AAAAA,UAAK,KAAI;AAAA,QAAA,CAAnD;AAAA,MAAA,CAhBJ;AAAA,IAAA,CADF;AAAA,EAAA,CAXJ;AAkCD,CAhDuB;;"}
package/dist/Video.es.js CHANGED
@@ -28,9 +28,10 @@ import "redux-thunk";
28
28
  import "./actions.es.js";
29
29
  import "zod";
30
30
  import "./state/breakpoints.es.js";
31
+ import "slate";
32
+ import "uuid";
31
33
  import "@emotion/serialize";
32
34
  import "@emotion/utils";
33
- import "slate";
34
35
  import "is-hotkey";
35
36
  const ASPECT_RATIO = 16 / 9;
36
37
  const Video = forwardRef(function Video2({