@servicetitan/dte-unlayer 0.89.0 → 0.90.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 (45) hide show
  1. package/dist/api-core.js +29 -22
  2. package/dist/api-core.js.map +1 -1
  3. package/dist/api-custom-tools.js +35 -42
  4. package/dist/api-custom-tools.js.map +1 -1
  5. package/dist/editor-core-source.d.ts +3 -3
  6. package/dist/editor-core-source.d.ts.map +1 -1
  7. package/dist/editor-core-source.js +4 -4
  8. package/dist/editor-core-source.js.map +1 -1
  9. package/dist/editor-core.js +2 -2
  10. package/dist/editor-core.js.map +1 -1
  11. package/dist/editor.js +73 -34
  12. package/dist/editor.js.map +1 -1
  13. package/dist/index.js +2 -0
  14. package/dist/index.js.map +1 -1
  15. package/dist/loadScript.d.ts.map +1 -1
  16. package/dist/loadScript.js +7 -6
  17. package/dist/loadScript.js.map +1 -1
  18. package/dist/shared/const.js +2 -1
  19. package/dist/shared/const.js.map +1 -1
  20. package/dist/shared/edit-icon.js +1 -0
  21. package/dist/shared/edit-icon.js.map +1 -1
  22. package/dist/shared/fonts.js +24 -17
  23. package/dist/shared/fonts.js.map +1 -1
  24. package/dist/shared/schema.d.ts.map +1 -1
  25. package/dist/shared/schema.js +91 -49
  26. package/dist/shared/schema.js.map +1 -1
  27. package/dist/shared/tools.d.ts.map +1 -1
  28. package/dist/shared/tools.js +13 -6
  29. package/dist/shared/tools.js.map +1 -1
  30. package/dist/store.d.ts +5 -5
  31. package/dist/store.d.ts.map +1 -1
  32. package/dist/store.js +235 -315
  33. package/dist/store.js.map +1 -1
  34. package/dist/tools.d.ts.map +1 -1
  35. package/dist/tools.js +120 -112
  36. package/dist/tools.js.map +1 -1
  37. package/dist/unlayer-interface.js +2 -1
  38. package/dist/unlayer-interface.js.map +1 -1
  39. package/dist/unlayer.d.ts +1 -0
  40. package/dist/unlayer.d.ts.map +1 -1
  41. package/dist/unlayer.js +115 -70
  42. package/dist/unlayer.js.map +1 -1
  43. package/package.json +1 -1
  44. package/src/editor-core-source.ts +3 -3
  45. package/src/unlayer.tsx +11 -1
@@ -4,6 +4,6 @@
4
4
  * so when we build tools packages, we generate ./editor-core-source.ts file and include all tools bundles as strings
5
5
  * then this code is passed to unlayer initializer
6
6
  * (note that custom tools are imported differently as urls)
7
- */
8
- export { editorCoreScript, editorCoreTools, editorCoreStyles } from './editor-core-source';
7
+ */ export { editorCoreScript, editorCoreTools, editorCoreStyles } from './editor-core-source';
8
+
9
9
  //# sourceMappingURL=editor-core.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"editor-core.js","sourceRoot":"","sources":["../src/editor-core.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC"}
1
+ {"version":3,"sources":["../src/editor-core.ts"],"sourcesContent":["/**\n * we need to pass code to unlayer and we have to pass it as source code (not as url to static file)\n * because it is loaded from unlayer domain, so it has to pass authorization\n * so when we build tools packages, we generate ./editor-core-source.ts file and include all tools bundles as strings\n * then this code is passed to unlayer initializer\n * (note that custom tools are imported differently as urls)\n */\nexport { editorCoreScript, editorCoreTools, editorCoreStyles } from './editor-core-source';\n"],"names":["editorCoreScript","editorCoreTools","editorCoreStyles"],"mappings":"AAAA;;;;;;CAMC,GACD,SAASA,gBAAgB,EAAEC,eAAe,EAAEC,gBAAgB,QAAQ,uBAAuB"}
package/dist/editor.js CHANGED
@@ -1,55 +1,94 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { forwardRef, useEffect, useImperativeHandle, useMemo, useRef, useState, } from 'react';
2
+ import { forwardRef, useEffect, useImperativeHandle, useMemo, useRef, useState } from 'react';
3
3
  import { UnlayerStore } from './store';
4
- export const useUnlayerRef = () => useRef(null);
5
- export const UnlayerEditor = forwardRef((props, ref) => {
6
- var _a;
4
+ export const useUnlayerRef = ()=>useRef(null);
5
+ export const UnlayerEditor = /*#__PURE__*/ forwardRef((props, ref)=>{
7
6
  const [isReady, setIsReady] = useState(false);
8
7
  const containerRef = useRef(null);
9
- const store = useMemo(() => new UnlayerStore(props.opts),
10
- // eslint-disable-next-line react-hooks/exhaustive-deps
8
+ const store = useMemo(()=>new UnlayerStore(props.opts), // eslint-disable-next-line react-hooks/exhaustive-deps
11
9
  []);
12
- useEffect(() => {
10
+ useEffect(()=>{
13
11
  if (containerRef.current) {
14
- store
15
- .init(containerRef.current)
16
- .then(() => setIsReady(true))
17
- .catch(() => setIsReady(false));
12
+ store.init(containerRef.current).then(()=>setIsReady(true)).catch(()=>setIsReady(false));
18
13
  }
19
- return () => store.destroy();
20
- }, [store]);
21
- useImperativeHandle(ref, () => store.unlayerRef, [store]);
22
- useEffect(() => {
14
+ return ()=>store.destroy();
15
+ }, [
16
+ store
17
+ ]);
18
+ useImperativeHandle(ref, ()=>store.unlayerRef, [
19
+ store
20
+ ]);
21
+ useEffect(()=>{
23
22
  if (isReady) {
24
23
  store.setDesign(props.design);
25
24
  }
26
- }, [isReady, props.design, store]);
27
- useEffect(() => {
25
+ }, [
26
+ isReady,
27
+ props.design,
28
+ store
29
+ ]);
30
+ useEffect(()=>{
28
31
  store.setOnChange(props.onChange);
29
- return () => store.setOnChange();
30
- }, [props.onChange, store]);
31
- useEffect(() => {
32
+ return ()=>store.setOnChange();
33
+ }, [
34
+ props.onChange,
35
+ store
36
+ ]);
37
+ useEffect(()=>{
32
38
  store.setOnSnapshotSave(props.onSnapshotSave);
33
- return () => store.setOnSnapshotSave();
34
- }, [props.onSnapshotSave, store]);
35
- useEffect(() => {
39
+ return ()=>store.setOnSnapshotSave();
40
+ }, [
41
+ props.onSnapshotSave,
42
+ store
43
+ ]);
44
+ useEffect(()=>{
36
45
  if (props.opts.newSnapshot) {
37
46
  store.addTwin(props.opts.newSnapshot);
38
47
  }
39
- }, [props.opts.newSnapshot, store]);
40
- useEffect(() => {
48
+ }, [
49
+ props.opts.newSnapshot,
50
+ store
51
+ ]);
52
+ useEffect(()=>{
41
53
  store.setOnReady(props.onReady);
42
- return () => store.setOnReady();
43
- }, [props.onReady, store]);
44
- useEffect(() => {
54
+ return ()=>store.setOnReady();
55
+ }, [
56
+ props.onReady,
57
+ store
58
+ ]);
59
+ useEffect(()=>{
45
60
  store.setOnImage(props.onImage);
46
- return () => store.setOnImage();
47
- }, [props.onImage, store]);
48
- useEffect(() => {
61
+ return ()=>store.setOnImage();
62
+ }, [
63
+ props.onImage,
64
+ store
65
+ ]);
66
+ useEffect(()=>{
49
67
  store.setOnMessage(props.onMessage);
50
- return () => store.setOnMessage();
51
- }, [props.onMessage, store]);
68
+ return ()=>store.setOnMessage();
69
+ }, [
70
+ props.onMessage,
71
+ store
72
+ ]);
52
73
  const { minHeight = 800, style = {} } = props;
53
- return (_jsxs("div", { style: { minHeight, display: 'flex' }, children: [!isReady && _jsx("p", { className: "c-red-500", children: "error loading editor" }), _jsx("div", { id: (_a = props.id) !== null && _a !== void 0 ? _a : 'editor', style: style, ref: containerRef })] }));
74
+ var _props_id;
75
+ return /*#__PURE__*/ _jsxs("div", {
76
+ style: {
77
+ minHeight,
78
+ display: 'flex'
79
+ },
80
+ children: [
81
+ !isReady && /*#__PURE__*/ _jsx("p", {
82
+ className: "c-red-500",
83
+ children: "error loading editor"
84
+ }),
85
+ /*#__PURE__*/ _jsx("div", {
86
+ id: (_props_id = props.id) !== null && _props_id !== void 0 ? _props_id : 'editor',
87
+ style: style,
88
+ ref: containerRef
89
+ })
90
+ ]
91
+ });
54
92
  });
93
+
55
94
  //# sourceMappingURL=editor.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"editor.js","sourceRoot":"","sources":["../src/editor.tsx"],"names":[],"mappings":";AAAA,OAAO,EAEH,UAAU,EACV,SAAS,EACT,mBAAmB,EACnB,OAAO,EACP,MAAM,EACN,QAAQ,GACX,MAAM,OAAO,CAAC;AAEf,OAAO,EAAE,YAAY,EAA2B,MAAM,SAAS,CAAC;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AAC,EAAE,CAAC,KAAK,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC,CAAC;IAE7B,MAAM,EAAE,SAAS,GAAG,GAAG,EAAE,KAAK,GAAG,EAAE,EAAE,GAAG,KAAK,CAAC;IAE9C,OAAO,CACH,eAAK,KAAK,EAAE,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,aACrC,CAAC,OAAO,IAAI,YAAG,SAAS,EAAC,WAAW,qCAAyB,EAC9D,cAAK,EAAE,EAAE,MAAA,KAAK,CAAC,EAAE,mCAAI,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,YAAY,GAAI,IAChE,CACT,CAAC;AACN,CAAC,CAAC,CAAC"}
1
+ {"version":3,"sources":["../src/editor.tsx"],"sourcesContent":["import {\n CSSProperties,\n forwardRef,\n useEffect,\n useImperativeHandle,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport { UnlayerEditorTwin } from './shared/const';\nimport { UnlayerStore, UnlayerDesignChangeInfo } from './store';\nimport { UnlayerRef, CreateUnlayerEditorProps } from './unlayer-interface';\n\nexport interface UnlayerEditorProps {\n id?: string;\n design?: any;\n opts: CreateUnlayerEditorProps;\n minHeight?: number;\n style?: CSSProperties;\n\n onReady?(): void;\n\n onChange?(info: UnlayerDesignChangeInfo): void;\n\n onSnapshotSave?(tool: UnlayerEditorTwin): void;\n\n onImage?(file: File): Promise<{ url: string }>;\n\n onMessage?(type: string, data: any): void;\n}\n\nexport const useUnlayerRef = () => useRef<UnlayerRef | null>(null);\n\nexport const UnlayerEditor = forwardRef<UnlayerRef, UnlayerEditorProps>((props, ref) => {\n const [isReady, setIsReady] = useState(false);\n const containerRef = useRef<HTMLDivElement | null>(null);\n const store = useMemo(\n () => new UnlayerStore(props.opts),\n // eslint-disable-next-line react-hooks/exhaustive-deps\n []\n );\n\n useEffect(() => {\n if (containerRef.current) {\n store\n .init(containerRef.current)\n .then(() => setIsReady(true))\n .catch(() => setIsReady(false));\n }\n\n return () => store.destroy();\n }, [store]);\n useImperativeHandle(ref, () => store.unlayerRef, [store]);\n\n useEffect(() => {\n if (isReady) {\n store.setDesign(props.design);\n }\n }, [isReady, props.design, store]);\n\n useEffect(() => {\n store.setOnChange(props.onChange);\n\n return () => store.setOnChange();\n }, [props.onChange, store]);\n\n useEffect(() => {\n store.setOnSnapshotSave(props.onSnapshotSave);\n\n return () => store.setOnSnapshotSave();\n }, [props.onSnapshotSave, store]);\n\n useEffect(() => {\n if (props.opts.newSnapshot) {\n store.addTwin(props.opts.newSnapshot);\n }\n }, [props.opts.newSnapshot, store]);\n\n useEffect(() => {\n store.setOnReady(props.onReady);\n\n return () => store.setOnReady();\n }, [props.onReady, store]);\n\n useEffect(() => {\n store.setOnImage(props.onImage);\n\n return () => store.setOnImage();\n }, [props.onImage, store]);\n\n useEffect(() => {\n store.setOnMessage(props.onMessage);\n\n return () => store.setOnMessage();\n }, [props.onMessage, store]);\n\n const { minHeight = 800, style = {} } = props;\n\n return (\n <div style={{ minHeight, display: 'flex' }}>\n {!isReady && <p className=\"c-red-500\">error loading editor</p>}\n <div id={props.id ?? 'editor'} style={style} ref={containerRef} />\n </div>\n );\n});\n"],"names":["forwardRef","useEffect","useImperativeHandle","useMemo","useRef","useState","UnlayerStore","useUnlayerRef","UnlayerEditor","props","ref","isReady","setIsReady","containerRef","store","opts","current","init","then","catch","destroy","unlayerRef","setDesign","design","setOnChange","onChange","setOnSnapshotSave","onSnapshotSave","newSnapshot","addTwin","setOnReady","onReady","setOnImage","onImage","setOnMessage","onMessage","minHeight","style","div","display","p","className","id"],"mappings":";AAAA,SAEIA,UAAU,EACVC,SAAS,EACTC,mBAAmB,EACnBC,OAAO,EACPC,MAAM,EACNC,QAAQ,QACL,QAAQ;AAEf,SAASC,YAAY,QAAiC,UAAU;AAqBhE,OAAO,MAAMC,gBAAgB,IAAMH,OAA0B,MAAM;AAEnE,OAAO,MAAMI,8BAAgBR,WAA2C,CAACS,OAAOC;IAC5E,MAAM,CAACC,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,GAAG;QAACvB,MAAMwB,OAAO;QAAEnB;KAAM;IAEzBb,UAAU;QACNa,MAAMoB,YAAY,CAACzB,MAAM0B,SAAS;QAElC,OAAO,IAAMrB,MAAMoB,YAAY;IACnC,GAAG;QAACzB,MAAM0B,SAAS;QAAErB;KAAM;IAE3B,MAAM,EAAEsB,YAAY,GAAG,EAAEC,QAAQ,CAAC,CAAC,EAAE,GAAG5B;QAKvBA;IAHjB,qBACI,MAAC6B;QAAID,OAAO;YAAED;YAAWG,SAAS;QAAO;;YACpC,CAAC5B,yBAAW,KAAC6B;gBAAEC,WAAU;0BAAY;;0BACtC,KAACH;gBAAII,IAAIjC,CAAAA,YAAAA,MAAMiC,EAAE,cAARjC,uBAAAA,YAAY;gBAAU4B,OAAOA;gBAAO3B,KAAKG;;;;AAG9D,GAAG"}
package/dist/index.js CHANGED
@@ -7,5 +7,7 @@ export * from './loadScript';
7
7
  export * from './shared/const';
8
8
  export * from './shared/schema';
9
9
  export * from './shared/tools';
10
+ export { UnlayerDesignChangeInfo } from './store';
10
11
  export { versions } from './unlayer';
12
+
11
13
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY,CAAC;AAC3B,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,cAAc,CAAC;AAC7B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAE/B,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC"}
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["export * from './editor';\nexport * from './tools';\nexport * from './api-core';\nexport * from './api-custom-tools';\nexport * from './unlayer-interface';\nexport * from './loadScript';\nexport * from './shared/const';\nexport * from './shared/schema';\nexport * from './shared/tools';\nexport { UnlayerDesignChangeInfo } from './store';\nexport { versions } from './unlayer';\n"],"names":["UnlayerDesignChangeInfo","versions"],"mappings":"AAAA,cAAc,WAAW;AACzB,cAAc,UAAU;AACxB,cAAc,aAAa;AAC3B,cAAc,qBAAqB;AACnC,cAAc,sBAAsB;AACpC,cAAc,eAAe;AAC7B,cAAc,iBAAiB;AAC/B,cAAc,kBAAkB;AAChC,cAAc,iBAAiB;AAC/B,SAASA,uBAAuB,QAAQ,UAAU;AAClD,SAASC,QAAQ,QAAQ,YAAY"}
@@ -1 +1 @@
1
- {"version":3,"file":"loadScript.d.ts","sourceRoot":"","sources":["../src/loadScript.ts"],"names":[],"mappings":"AAaA,eAAO,MAAM,UAAU,cAAe,MAAM,KAAG,QAAQ,IAAI,CAa1D,CAAC;AAEF,eAAO,MAAM,gBAAgB,WAAY,MAAM,SAI9C,CAAC"}
1
+ {"version":3,"file":"loadScript.d.ts","sourceRoot":"","sources":["../src/loadScript.ts"],"names":[],"mappings":"AAaA,eAAO,MAAM,UAAU,GAAI,WAAW,MAAM,KAAG,OAAO,CAAC,IAAI,CAa1D,CAAC;AAEF,eAAO,MAAM,gBAAgB,GAAI,QAAQ,MAAM,SAI9C,CAAC"}
@@ -1,29 +1,30 @@
1
- const isScriptInjected = (scriptUrl) => {
1
+ const isScriptInjected = (scriptUrl)=>{
2
2
  const scripts = document.querySelectorAll('script');
3
3
  let injected = false;
4
- scripts.forEach(script => {
4
+ scripts.forEach((script)=>{
5
5
  if (script.src.includes(scriptUrl)) {
6
6
  injected = true;
7
7
  }
8
8
  });
9
9
  return injected;
10
10
  };
11
- export const loadScript = (scriptUrl) => {
12
- return new Promise(resolve => {
11
+ export const loadScript = (scriptUrl)=>{
12
+ return new Promise((resolve)=>{
13
13
  if (isScriptInjected(scriptUrl)) {
14
14
  resolve();
15
15
  }
16
16
  const embedScript = document.createElement('script');
17
17
  embedScript.setAttribute('src', scriptUrl);
18
- embedScript.onload = () => {
18
+ embedScript.onload = ()=>{
19
19
  resolve();
20
20
  };
21
21
  document.head.appendChild(embedScript);
22
22
  });
23
23
  };
24
- export const loadScriptSource = (source) => {
24
+ export const loadScriptSource = (source)=>{
25
25
  const embedScript = document.createElement('script');
26
26
  embedScript.textContent = source;
27
27
  document.head.appendChild(embedScript);
28
28
  };
29
+
29
30
  //# sourceMappingURL=loadScript.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"loadScript.js","sourceRoot":"","sources":["../src/loadScript.ts"],"names":[],"mappings":"AAAA,MAAM,gBAAgB,GAAG,CAAC,SAAiB,EAAE,EAAE;IAC3C,MAAM,OAAO,GAAG,QAAQ,CAAC,gBAAgB,CAAC,QAAQ,CAAC,CAAC;IACpD,IAAI,QAAQ,GAAG,KAAK,CAAC;IAErB,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE;QACrB,IAAI,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAE,CAAC;YACjC,QAAQ,GAAG,IAAI,CAAC;QACpB,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,OAAO,QAAQ,CAAC;AACpB,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,SAAiB,EAAiB,EAAE;IAC3D,OAAO,IAAI,OAAO,CAAO,OAAO,CAAC,EAAE;QAC/B,IAAI,gBAAgB,CAAC,SAAS,CAAC,EAAE,CAAC;YAC9B,OAAO,EAAE,CAAC;QACd,CAAC;QAED,MAAM,WAAW,GAAG,QAAQ,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;QACrD,WAAW,CAAC,YAAY,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC;QAC3C,WAAW,CAAC,MAAM,GAAG,GAAG,EAAE;YACtB,OAAO,EAAE,CAAC;QACd,CAAC,CAAC;QACF,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC;IAC3C,CAAC,CAAC,CAAC;AACP,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,MAAc,EAAE,EAAE;IAC/C,MAAM,WAAW,GAAG,QAAQ,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;IACrD,WAAW,CAAC,WAAW,GAAG,MAAM,CAAC;IACjC,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC;AAC3C,CAAC,CAAC"}
1
+ {"version":3,"sources":["../src/loadScript.ts"],"sourcesContent":["const isScriptInjected = (scriptUrl: string) => {\n const scripts = document.querySelectorAll('script');\n let injected = false;\n\n scripts.forEach(script => {\n if (script.src.includes(scriptUrl)) {\n injected = true;\n }\n });\n\n return injected;\n};\n\nexport const loadScript = (scriptUrl: string): Promise<void> => {\n return new Promise<void>(resolve => {\n if (isScriptInjected(scriptUrl)) {\n resolve();\n }\n\n const embedScript = document.createElement('script');\n embedScript.setAttribute('src', scriptUrl);\n embedScript.onload = () => {\n resolve();\n };\n document.head.appendChild(embedScript);\n });\n};\n\nexport const loadScriptSource = (source: string) => {\n const embedScript = document.createElement('script');\n embedScript.textContent = source;\n document.head.appendChild(embedScript);\n};\n"],"names":["isScriptInjected","scriptUrl","scripts","document","querySelectorAll","injected","forEach","script","src","includes","loadScript","Promise","resolve","embedScript","createElement","setAttribute","onload","head","appendChild","loadScriptSource","source","textContent"],"mappings":"AAAA,MAAMA,mBAAmB,CAACC;IACtB,MAAMC,UAAUC,SAASC,gBAAgB,CAAC;IAC1C,IAAIC,WAAW;IAEfH,QAAQI,OAAO,CAACC,CAAAA;QACZ,IAAIA,OAAOC,GAAG,CAACC,QAAQ,CAACR,YAAY;YAChCI,WAAW;QACf;IACJ;IAEA,OAAOA;AACX;AAEA,OAAO,MAAMK,aAAa,CAACT;IACvB,OAAO,IAAIU,QAAcC,CAAAA;QACrB,IAAIZ,iBAAiBC,YAAY;YAC7BW;QACJ;QAEA,MAAMC,cAAcV,SAASW,aAAa,CAAC;QAC3CD,YAAYE,YAAY,CAAC,OAAOd;QAChCY,YAAYG,MAAM,GAAG;YACjBJ;QACJ;QACAT,SAASc,IAAI,CAACC,WAAW,CAACL;IAC9B;AACJ,EAAE;AAEF,OAAO,MAAMM,mBAAmB,CAACC;IAC7B,MAAMP,cAAcV,SAASW,aAAa,CAAC;IAC3CD,YAAYQ,WAAW,GAAGD;IAC1BjB,SAASc,IAAI,CAACC,WAAW,CAACL;AAC9B,EAAE"}
@@ -1,6 +1,7 @@
1
1
  export const constGenericsEditor = {
2
2
  infoDataProperty: '_info',
3
3
  adminConfigProperty: 'adminConfig',
4
- userConfigProperty: 'config',
4
+ userConfigProperty: 'config'
5
5
  };
6
+
6
7
  //# sourceMappingURL=const.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"const.js","sourceRoot":"","sources":["../../src/shared/const.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,mBAAmB,GAAG;IAC/B,gBAAgB,EAAE,OAAO;IACzB,mBAAmB,EAAE,aAAa;IAClC,kBAAkB,EAAE,QAAQ;CAC/B,CAAC"}
1
+ {"version":3,"sources":["../../src/shared/const.ts"],"sourcesContent":["import { SchemaObject } from './schema';\n\nexport const constGenericsEditor = {\n infoDataProperty: '_info',\n adminConfigProperty: 'adminConfig',\n userConfigProperty: 'config',\n};\n\nexport interface UnlayerEditorESignRecipientInfo {\n id: number;\n name: string;\n displayName: string;\n}\n\nexport interface UnlayerEditorUnit {\n id: string;\n generic: string;\n title: string;\n values: any;\n}\n\nexport interface UnlayerEditorTwin {\n tool: string;\n title: string;\n values: any;\n}\n\nexport interface UnlayerEventConfig {\n dummyData?: any;\n schema?: SchemaObject;\n generics?: true | string[];\n genericConfigMode?: boolean;\n isSnapshotMode?: boolean;\n units?: UnlayerEditorUnit[];\n}\n\nexport interface UnlayerEventRegister {\n units?: UnlayerEditorUnit[];\n eSignRecipients?: UnlayerEditorESignRecipientInfo[];\n eSignFieldTypes?: string[];\n customTools?: {\n key: string;\n title?: string;\n }[];\n toolTwins?: UnlayerEditorTwin[];\n}\n\nexport interface UnlayerToolMetaData {\n key: string;\n description?: string;\n}\n"],"names":["constGenericsEditor","infoDataProperty","adminConfigProperty","userConfigProperty"],"mappings":"AAEA,OAAO,MAAMA,sBAAsB;IAC/BC,kBAAkB;IAClBC,qBAAqB;IACrBC,oBAAoB;AACxB,EAAE"}
@@ -10,4 +10,5 @@ export const editIconSvg = `
10
10
  </defs>
11
11
  </svg>
12
12
  `;
13
+
13
14
  //# sourceMappingURL=edit-icon.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"edit-icon.js","sourceRoot":"","sources":["../../src/shared/edit-icon.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,WAAW,GAAG;;;;;;;;;;;CAW1B,CAAC"}
1
+ {"version":3,"sources":["../../src/shared/edit-icon.ts"],"sourcesContent":["export const editIconSvg = `\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"32\" height=\"32\" viewBox=\"0 0 32 32\" fill=\"none\">\n <g clip-path=\"url(#clip0_2941_4625)\">\n <path d=\"M4 23V28H9L23.7533 13.2467L18.7533 8.24667L4 23ZM27.6067 9.39333C28.1267 8.87333 28.1267 8.02667 27.6067 7.50667L24.4933 4.39333C23.9733 3.87333 23.1267 3.87333 22.6067 4.39333L20.1667 6.83333L25.1667 11.8333L27.6067 9.39333Z\" fill=\"#606162\"/>\n </g>\n <defs>\n <clipPath id=\"clip0_2941_4625\">\n <rect width=\"32\" height=\"32\" fill=\"white\"/>\n </clipPath>\n </defs>\n </svg>\n`;\n"],"names":["editIconSvg"],"mappings":"AAAA,OAAO,MAAMA,cAAc,CAAC;;;;;;;;;;;AAW5B,CAAC,CAAC"}
@@ -1,75 +1,82 @@
1
1
  export const unlayerSupportedFonts = [
2
2
  {
3
3
  label: 'Arial',
4
- value: 'arial,helvetica,sans-serif',
4
+ value: 'arial,helvetica,sans-serif'
5
5
  },
6
6
  {
7
7
  label: 'Lobster Two',
8
8
  value: "'Lobster Two',cursive",
9
- url: 'https://fonts.googleapis.com/css?family=Lobster+Two:400,700',
9
+ url: 'https://fonts.googleapis.com/css?family=Lobster+Two:400,700'
10
10
  },
11
11
  {
12
12
  label: 'Playfair Display',
13
13
  value: "'Playfair Display',serif",
14
- url: 'https://fonts.googleapis.com/css?family=Playfair+Display:400,700',
14
+ url: 'https://fonts.googleapis.com/css?family=Playfair+Display:400,700'
15
15
  },
16
16
  {
17
17
  label: 'Rubik',
18
18
  value: "'Rubik',sans-serif",
19
- url: 'https://fonts.googleapis.com/css?family=Rubik:400,700',
19
+ url: 'https://fonts.googleapis.com/css?family=Rubik:400,700'
20
20
  },
21
21
  {
22
22
  label: 'Source Sans Pro',
23
23
  value: "'Source Sans Pro',sans-serif",
24
- url: 'https://fonts.googleapis.com/css?family=Source+Sans+Pro:400,700',
24
+ url: 'https://fonts.googleapis.com/css?family=Source+Sans+Pro:400,700'
25
25
  },
26
26
  {
27
27
  label: 'Open Sans',
28
28
  value: "'Open Sans',sans-serif",
29
- url: 'https://fonts.googleapis.com/css?family=Open+Sans:400,700',
29
+ url: 'https://fonts.googleapis.com/css?family=Open+Sans:400,700'
30
30
  },
31
31
  {
32
32
  label: 'Crimson Text',
33
33
  value: "'Crimson Text',serif",
34
- url: 'https://fonts.googleapis.com/css?family=Crimson+Text:400,700',
34
+ url: 'https://fonts.googleapis.com/css?family=Crimson+Text:400,700'
35
35
  },
36
36
  {
37
37
  label: 'Montserrat',
38
38
  value: "'Montserrat',sans-serif",
39
- url: 'https://fonts.googleapis.com/css?family=Montserrat:400,700',
39
+ url: 'https://fonts.googleapis.com/css?family=Montserrat:400,700'
40
40
  },
41
41
  {
42
42
  label: 'Old Standard TT',
43
43
  value: "'Old Standard TT',serif",
44
- url: 'https://fonts.googleapis.com/css?family=Old+Standard+TT:400,700',
44
+ url: 'https://fonts.googleapis.com/css?family=Old+Standard+TT:400,700'
45
45
  },
46
46
  {
47
47
  label: 'Lato',
48
48
  value: "'Lato',sans-serif",
49
- url: 'https://fonts.googleapis.com/css?family=Lato:400,700',
49
+ url: 'https://fonts.googleapis.com/css?family=Lato:400,700'
50
50
  },
51
51
  {
52
52
  label: 'Raleway',
53
53
  value: "'Raleway',sans-serif",
54
- url: 'https://fonts.googleapis.com/css?family=Raleway:400,700',
54
+ url: 'https://fonts.googleapis.com/css?family=Raleway:400,700'
55
55
  },
56
56
  {
57
57
  label: 'Cabin',
58
58
  value: "'Cabin',sans-serif",
59
- url: 'https://fonts.googleapis.com/css?family=Cabin:400,700',
59
+ url: 'https://fonts.googleapis.com/css?family=Cabin:400,700'
60
60
  },
61
61
  {
62
62
  label: 'Pacifico',
63
63
  value: "'Pacifico',cursive",
64
- url: 'https://fonts.googleapis.com/css?family=Pacifico',
64
+ url: 'https://fonts.googleapis.com/css?family=Pacifico'
65
65
  },
66
66
  // custom DTE fonts
67
- { label: 'Sofia Pro', value: 'Sofia Pro' },
68
- { label: 'Montserrat', value: 'Montserrat' },
67
+ {
68
+ label: 'Sofia Pro',
69
+ value: 'Sofia Pro'
70
+ },
71
+ {
72
+ label: 'Montserrat',
73
+ value: 'Montserrat'
74
+ },
69
75
  {
70
76
  label: 'Nunito',
71
77
  value: 'Nunito',
72
- url: 'https://fonts.googleapis.com/css?family=Nunito',
73
- },
78
+ url: 'https://fonts.googleapis.com/css?family=Nunito'
79
+ }
74
80
  ];
81
+
75
82
  //# sourceMappingURL=fonts.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"fonts.js","sourceRoot":"","sources":["../../src/shared/fonts.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,qBAAqB,GAAG;IACjC;QACI,KAAK,EAAE,OAAO;QACd,KAAK,EAAE,4BAA4B;KACtC;IACD;QACI,KAAK,EAAE,aAAa;QACpB,KAAK,EAAE,uBAAuB;QAC9B,GAAG,EAAE,6DAA6D;KACrE;IACD;QACI,KAAK,EAAE,kBAAkB;QACzB,KAAK,EAAE,0BAA0B;QACjC,GAAG,EAAE,kEAAkE;KAC1E;IACD;QACI,KAAK,EAAE,OAAO;QACd,KAAK,EAAE,oBAAoB;QAC3B,GAAG,EAAE,uDAAuD;KAC/D;IACD;QACI,KAAK,EAAE,iBAAiB;QACxB,KAAK,EAAE,8BAA8B;QACrC,GAAG,EAAE,iEAAiE;KACzE;IACD;QACI,KAAK,EAAE,WAAW;QAClB,KAAK,EAAE,wBAAwB;QAC/B,GAAG,EAAE,2DAA2D;KACnE;IACD;QACI,KAAK,EAAE,cAAc;QACrB,KAAK,EAAE,sBAAsB;QAC7B,GAAG,EAAE,8DAA8D;KACtE;IACD;QACI,KAAK,EAAE,YAAY;QACnB,KAAK,EAAE,yBAAyB;QAChC,GAAG,EAAE,4DAA4D;KACpE;IACD;QACI,KAAK,EAAE,iBAAiB;QACxB,KAAK,EAAE,yBAAyB;QAChC,GAAG,EAAE,iEAAiE;KACzE;IACD;QACI,KAAK,EAAE,MAAM;QACb,KAAK,EAAE,mBAAmB;QAC1B,GAAG,EAAE,sDAAsD;KAC9D;IACD;QACI,KAAK,EAAE,SAAS;QAChB,KAAK,EAAE,sBAAsB;QAC7B,GAAG,EAAE,yDAAyD;KACjE;IACD;QACI,KAAK,EAAE,OAAO;QACd,KAAK,EAAE,oBAAoB;QAC3B,GAAG,EAAE,uDAAuD;KAC/D;IACD;QACI,KAAK,EAAE,UAAU;QACjB,KAAK,EAAE,oBAAoB;QAC3B,GAAG,EAAE,kDAAkD;KAC1D;IACD,mBAAmB;IACnB,EAAE,KAAK,EAAE,WAAW,EAAE,KAAK,EAAE,WAAW,EAAE;IAC1C,EAAE,KAAK,EAAE,YAAY,EAAE,KAAK,EAAE,YAAY,EAAE;IAE5C;QACI,KAAK,EAAE,QAAQ;QACf,KAAK,EAAE,QAAQ;QACf,GAAG,EAAE,gDAAgD;KACxD;CACJ,CAAC"}
1
+ {"version":3,"sources":["../../src/shared/fonts.ts"],"sourcesContent":["export const unlayerSupportedFonts = [\n {\n label: 'Arial',\n value: 'arial,helvetica,sans-serif',\n },\n {\n label: 'Lobster Two',\n value: \"'Lobster Two',cursive\",\n url: 'https://fonts.googleapis.com/css?family=Lobster+Two:400,700',\n },\n {\n label: 'Playfair Display',\n value: \"'Playfair Display',serif\",\n url: 'https://fonts.googleapis.com/css?family=Playfair+Display:400,700',\n },\n {\n label: 'Rubik',\n value: \"'Rubik',sans-serif\",\n url: 'https://fonts.googleapis.com/css?family=Rubik:400,700',\n },\n {\n label: 'Source Sans Pro',\n value: \"'Source Sans Pro',sans-serif\",\n url: 'https://fonts.googleapis.com/css?family=Source+Sans+Pro:400,700',\n },\n {\n label: 'Open Sans',\n value: \"'Open Sans',sans-serif\",\n url: 'https://fonts.googleapis.com/css?family=Open+Sans:400,700',\n },\n {\n label: 'Crimson Text',\n value: \"'Crimson Text',serif\",\n url: 'https://fonts.googleapis.com/css?family=Crimson+Text:400,700',\n },\n {\n label: 'Montserrat',\n value: \"'Montserrat',sans-serif\",\n url: 'https://fonts.googleapis.com/css?family=Montserrat:400,700',\n },\n {\n label: 'Old Standard TT',\n value: \"'Old Standard TT',serif\",\n url: 'https://fonts.googleapis.com/css?family=Old+Standard+TT:400,700',\n },\n {\n label: 'Lato',\n value: \"'Lato',sans-serif\",\n url: 'https://fonts.googleapis.com/css?family=Lato:400,700',\n },\n {\n label: 'Raleway',\n value: \"'Raleway',sans-serif\",\n url: 'https://fonts.googleapis.com/css?family=Raleway:400,700',\n },\n {\n label: 'Cabin',\n value: \"'Cabin',sans-serif\",\n url: 'https://fonts.googleapis.com/css?family=Cabin:400,700',\n },\n {\n label: 'Pacifico',\n value: \"'Pacifico',cursive\",\n url: 'https://fonts.googleapis.com/css?family=Pacifico',\n },\n // custom DTE fonts\n { label: 'Sofia Pro', value: 'Sofia Pro' },\n { label: 'Montserrat', value: 'Montserrat' },\n\n {\n label: 'Nunito',\n value: 'Nunito',\n url: 'https://fonts.googleapis.com/css?family=Nunito',\n },\n];\n"],"names":["unlayerSupportedFonts","label","value","url"],"mappings":"AAAA,OAAO,MAAMA,wBAAwB;IACjC;QACIC,OAAO;QACPC,OAAO;IACX;IACA;QACID,OAAO;QACPC,OAAO;QACPC,KAAK;IACT;IACA;QACIF,OAAO;QACPC,OAAO;QACPC,KAAK;IACT;IACA;QACIF,OAAO;QACPC,OAAO;QACPC,KAAK;IACT;IACA;QACIF,OAAO;QACPC,OAAO;QACPC,KAAK;IACT;IACA;QACIF,OAAO;QACPC,OAAO;QACPC,KAAK;IACT;IACA;QACIF,OAAO;QACPC,OAAO;QACPC,KAAK;IACT;IACA;QACIF,OAAO;QACPC,OAAO;QACPC,KAAK;IACT;IACA;QACIF,OAAO;QACPC,OAAO;QACPC,KAAK;IACT;IACA;QACIF,OAAO;QACPC,OAAO;QACPC,KAAK;IACT;IACA;QACIF,OAAO;QACPC,OAAO;QACPC,KAAK;IACT;IACA;QACIF,OAAO;QACPC,OAAO;QACPC,KAAK;IACT;IACA;QACIF,OAAO;QACPC,OAAO;QACPC,KAAK;IACT;IACA,mBAAmB;IACnB;QAAEF,OAAO;QAAaC,OAAO;IAAY;IACzC;QAAED,OAAO;QAAcC,OAAO;IAAa;IAE3C;QACID,OAAO;QACPC,OAAO;QACPC,KAAK;IACT;CACH,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/shared/schema.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,wBAAwB,GAAG,QAAQ,GAAG,OAAO,GAAG,QAAQ,CAAC;AACrE,eAAO,MAAM,wBAAwB,UAAgC,CAAC;AAEtE,MAAM,MAAM,wBAAwB,GAAG,QAAQ,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;AAC5E,eAAO,MAAM,wBAAwB,UAAsC,CAAC;AAE5E,eAAO,MAAM,qBAAqB,SAAU,MAAM,qCACP,CAAC;AAE5C,MAAM,WAAW,sBAAsB;IACnC,WAAW,CAAC,EAAE,GAAG,CAAC;IAClB,WAAW,CAAC,EAAE,GAAG,CAAC;IAClB,UAAU,CAAC,EAAE,GAAG,CAAC;IACjB,YAAY,CAAC,EAAE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,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,UAAU,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,OAAO,CAAC;IACnB,OAAO,EAAE,OAAO,CAAC;CACpB;AAED,MAAM,MAAM,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC;AAExD,eAAO,MAAM,cAAc,GAAI,QAAQ,YAAY,KAAG;IAAE,GAAG,EAAE,SAAS,CAAC;IAAC,SAAS,EAAE,GAAG,CAAA;CA8ErF,CAAC"}
@@ -1,15 +1,24 @@
1
- export const schemaNodeAvailableTypes = ['object', 'array', 'string'];
2
- export const schemaNodeStringSubTypes = ['string', 'text', 'html', 'image'];
3
- export const schemaIsAvailableType = (type) => schemaNodeAvailableTypes.includes(type);
1
+ export const schemaNodeAvailableTypes = [
2
+ 'object',
3
+ 'array',
4
+ 'string'
5
+ ];
6
+ export const schemaNodeStringSubTypes = [
7
+ 'string',
8
+ 'text',
9
+ 'html',
10
+ 'image'
11
+ ];
12
+ export const schemaIsAvailableType = (type)=>schemaNodeAvailableTypes.includes(type);
4
13
  export const schemaArrayRootKey = '[]';
5
- export const schemaIsObject = (node) => (node === null || node === void 0 ? void 0 : node.type) === 'object';
6
- export const schemaIsArrayOfObjects = (node) => (node === null || node === void 0 ? void 0 : node.type) === 'array' && (node === null || node === void 0 ? void 0 : node.items.type) === 'object';
7
- export const schemaIsArray = (node) => (node === null || node === void 0 ? void 0 : node.type) === 'array';
8
- export const schemaIsString = (node) => (node === null || node === void 0 ? void 0 : node.type) === 'string';
9
- export const schemaIsStringHtml = (node) => (node === null || node === void 0 ? void 0 : node.type) === 'string' && (node === null || node === void 0 ? void 0 : node.subType) === 'html';
10
- export const schemaIsStringImage = (node) => (node === null || node === void 0 ? void 0 : node.type) === 'string' && (node === null || node === void 0 ? void 0 : node.subType) === 'image';
11
- export const schemaFindNode = (schema, key) => {
12
- const nodeFinder = (node, keys) => {
14
+ export const schemaIsObject = (node)=>(node === null || node === void 0 ? void 0 : node.type) === 'object';
15
+ export const schemaIsArrayOfObjects = (node)=>(node === null || node === void 0 ? void 0 : node.type) === 'array' && (node === null || node === void 0 ? void 0 : node.items.type) === 'object';
16
+ export const schemaIsArray = (node)=>(node === null || node === void 0 ? void 0 : node.type) === 'array';
17
+ export const schemaIsString = (node)=>(node === null || node === void 0 ? void 0 : node.type) === 'string';
18
+ export const schemaIsStringHtml = (node)=>(node === null || node === void 0 ? void 0 : node.type) === 'string' && (node === null || node === void 0 ? void 0 : node.subType) === 'html';
19
+ export const schemaIsStringImage = (node)=>(node === null || node === void 0 ? void 0 : node.type) === 'string' && (node === null || node === void 0 ? void 0 : node.subType) === 'image';
20
+ export const schemaFindNode = (schema, key)=>{
21
+ const nodeFinder = (node, keys)=>{
13
22
  if (!node) {
14
23
  return undefined;
15
24
  }
@@ -33,80 +42,113 @@ export const schemaFindNode = (schema, key) => {
33
42
  };
34
43
  return nodeFinder(schema, key.split('.'));
35
44
  };
36
- export const schemaFindParentNode = (schema, key) => {
45
+ export const schemaFindParentNode = (schema, key)=>{
37
46
  const keys = key.split('.');
38
47
  keys.pop();
39
- return keys.length
40
- ? schemaFindNode(schema, keys.join('.'))
41
- : schemaIsObject(schema) && schema.properties[key]
42
- ? schema
43
- : undefined;
48
+ return keys.length ? schemaFindNode(schema, keys.join('.')) : schemaIsObject(schema) && schema.properties[key] ? schema : undefined;
44
49
  };
45
- export const schemaGetFieldKey = (fullKey) => { var _a; return (_a = fullKey.split('.').pop()) !== null && _a !== void 0 ? _a : ''; };
46
- export const schemaBuildNode = (type, arrayItemType) => {
50
+ export const schemaGetFieldKey = (fullKey)=>{
51
+ var _fullKey_split_pop;
52
+ return (_fullKey_split_pop = fullKey.split('.').pop()) !== null && _fullKey_split_pop !== void 0 ? _fullKey_split_pop : '';
53
+ };
54
+ export const schemaBuildNode = (type, arrayItemType)=>{
47
55
  if (type === 'object') {
48
- return { type: 'object', properties: {}, options: {} };
56
+ return {
57
+ type: 'object',
58
+ properties: {},
59
+ options: {}
60
+ };
49
61
  }
50
62
  if (type === 'array') {
51
- return { type: 'array', items: schemaBuildNode(arrayItemType !== null && arrayItemType !== void 0 ? arrayItemType : 'object'), options: {} };
63
+ return {
64
+ type: 'array',
65
+ items: schemaBuildNode(arrayItemType !== null && arrayItemType !== void 0 ? arrayItemType : 'object'),
66
+ options: {}
67
+ };
52
68
  }
53
- return { type, options: {} };
69
+ return {
70
+ type,
71
+ options: {}
72
+ };
54
73
  };
55
- export const schemaBuildMap = (schema) => {
74
+ export const schemaBuildMap = (schema)=>{
56
75
  const fieldsMap = {};
57
76
  const dummyData = {};
58
- const processNode = (node, nodeKey, parentNodes, isArrayed, dummyDataNode) => {
59
- var _a, _b, _c, _d, _e, _f, _g;
60
- const nodeLabel = (_a = node.title) !== null && _a !== void 0 ? _a : nodeKey;
77
+ const processNode = (node, nodeKey, parentNodes, isArrayed, dummyDataNode)=>{
78
+ var _node_title;
79
+ const nodeLabel = (_node_title = node.title) !== null && _node_title !== void 0 ? _node_title : nodeKey;
61
80
  const isArrayRoot = nodeKey === schemaArrayRootKey;
62
81
  if (nodeKey) {
63
- const fullKey = [...parentNodes.map(n => n.key), nodeKey].join('.');
64
- const fullTitle = [...parentNodes.map(n => n.title), nodeLabel].join(' - ');
82
+ const fullKey = [
83
+ ...parentNodes.map((n)=>n.key),
84
+ nodeKey
85
+ ].join('.');
86
+ const fullTitle = [
87
+ ...parentNodes.map((n)=>n.title),
88
+ nodeLabel
89
+ ].join(' - ');
90
+ var _node_title1;
65
91
  fieldsMap[fullKey] = {
66
92
  fieldKey: nodeKey,
67
93
  fullKey,
68
94
  fullTitle,
69
- title: ((_b = node.title) !== null && _b !== void 0 ? _b : isArrayed) ? nodeLabel : fullTitle,
95
+ title: ((_node_title1 = node.title) !== null && _node_title1 !== void 0 ? _node_title1 : isArrayed) ? nodeLabel : fullTitle,
70
96
  node,
71
97
  isArrayed,
72
- isValue: !schemaIsObject(node) && !schemaIsArray(node),
98
+ isValue: !schemaIsObject(node) && !schemaIsArray(node)
73
99
  };
74
100
  }
75
101
  if (schemaIsObject(node)) {
76
- const properties = (_c = node.properties) !== null && _c !== void 0 ? _c : {};
102
+ var _node_properties;
103
+ const properties = (_node_properties = node.properties) !== null && _node_properties !== void 0 ? _node_properties : {};
77
104
  const keys = Object.keys(properties !== null && properties !== void 0 ? properties : {}).sort();
78
105
  let dummyDataObject = {};
79
106
  if (isArrayRoot) {
80
- (_d = dummyDataNode.push) === null || _d === void 0 ? void 0 : _d.call(dummyDataNode, dummyDataObject);
81
- }
82
- else if (nodeKey) {
107
+ var _dummyDataNode_push;
108
+ (_dummyDataNode_push = dummyDataNode.push) === null || _dummyDataNode_push === void 0 ? void 0 : _dummyDataNode_push.call(dummyDataNode, dummyDataObject);
109
+ } else if (nodeKey) {
83
110
  dummyDataNode[nodeKey] = dummyDataObject;
84
- }
85
- else {
111
+ } else {
86
112
  dummyDataObject = dummyDataNode;
87
113
  }
88
- for (const key of keys) {
89
- processNode(properties[key], key, nodeKey ? [...parentNodes, { key: nodeKey, title: nodeLabel }] : [], isArrayed, dummyDataObject);
114
+ for (const key of keys){
115
+ processNode(properties[key], key, nodeKey ? [
116
+ ...parentNodes,
117
+ {
118
+ key: nodeKey,
119
+ title: nodeLabel
120
+ }
121
+ ] : [], isArrayed, dummyDataObject);
90
122
  }
91
- }
92
- else if (schemaIsArray(node)) {
93
- const items = (_e = node.items) !== null && _e !== void 0 ? _e : {};
123
+ } else if (schemaIsArray(node)) {
124
+ var _node_items;
125
+ const items = (_node_items = node.items) !== null && _node_items !== void 0 ? _node_items : {};
94
126
  dummyDataNode[nodeKey] = [];
95
- processNode(items, schemaArrayRootKey, nodeKey ? [...parentNodes, { key: nodeKey, title: nodeLabel }] : [], true, dummyDataNode[nodeKey]);
96
- }
97
- else if (nodeKey) {
98
- const placeholder = (_f = node === null || node === void 0 ? void 0 : node.options) === null || _f === void 0 ? void 0 : _f.placeholder;
127
+ processNode(items, schemaArrayRootKey, nodeKey ? [
128
+ ...parentNodes,
129
+ {
130
+ key: nodeKey,
131
+ title: nodeLabel
132
+ }
133
+ ] : [], true, dummyDataNode[nodeKey]);
134
+ } else if (nodeKey) {
135
+ var _node_options;
136
+ const placeholder = node === null || node === void 0 ? void 0 : (_node_options = node.options) === null || _node_options === void 0 ? void 0 : _node_options.placeholder;
99
137
  if (placeholder !== undefined) {
100
138
  if (isArrayRoot) {
101
- (_g = dummyDataNode.push) === null || _g === void 0 ? void 0 : _g.call(dummyDataNode, placeholder);
102
- }
103
- else {
139
+ var _dummyDataNode_push1;
140
+ (_dummyDataNode_push1 = dummyDataNode.push) === null || _dummyDataNode_push1 === void 0 ? void 0 : _dummyDataNode_push1.call(dummyDataNode, placeholder);
141
+ } else {
104
142
  dummyDataNode[nodeKey] = placeholder;
105
143
  }
106
144
  }
107
145
  }
108
146
  };
109
147
  processNode(schema, '', [], false, dummyData);
110
- return { map: fieldsMap, dummyData };
148
+ return {
149
+ map: fieldsMap,
150
+ dummyData
151
+ };
111
152
  };
153
+
112
154
  //# sourceMappingURL=schema.js.map