@contentstack/studio-internal 0.0.2

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 (210) hide show
  1. package/README.md +79 -0
  2. package/dist/constants/condition.d.ts +4513 -0
  3. package/dist/constants/condition.d.ts.map +1 -0
  4. package/dist/constants/condition.js +150 -0
  5. package/dist/constants/condition.js.map +1 -0
  6. package/dist/core/apply.d.ts +3 -0
  7. package/dist/core/apply.d.ts.map +1 -0
  8. package/dist/core/apply.js +41 -0
  9. package/dist/core/apply.js.map +1 -0
  10. package/dist/core/batch-dirty-paths.d.ts +4 -0
  11. package/dist/core/batch-dirty-paths.d.ts.map +1 -0
  12. package/dist/core/batch-dirty-paths.js +7 -0
  13. package/dist/core/batch-dirty-paths.js.map +1 -0
  14. package/dist/core/get-dirty-paths.d.ts +4 -0
  15. package/dist/core/get-dirty-paths.d.ts.map +1 -0
  16. package/dist/core/get-dirty-paths.js +45 -0
  17. package/dist/core/get-dirty-paths.js.map +1 -0
  18. package/dist/core/index.d.ts +5 -0
  19. package/dist/core/index.d.ts.map +1 -0
  20. package/dist/core/normalize-node.d.ts +4 -0
  21. package/dist/core/normalize-node.d.ts.map +1 -0
  22. package/dist/core/normalize-node.js +16 -0
  23. package/dist/core/normalize-node.js.map +1 -0
  24. package/dist/core/should-normalize.d.ts +4 -0
  25. package/dist/core/should-normalize.d.ts.map +1 -0
  26. package/dist/core/should-normalize.js +10 -0
  27. package/dist/core/should-normalize.js.map +1 -0
  28. package/dist/core/update-dirty-paths.d.ts +3 -0
  29. package/dist/core/update-dirty-paths.d.ts.map +1 -0
  30. package/dist/core/update-dirty-paths.js +37 -0
  31. package/dist/core/update-dirty-paths.js.map +1 -0
  32. package/dist/create-editor.d.ts +3 -0
  33. package/dist/create-editor.d.ts.map +1 -0
  34. package/dist/create-editor.js +102 -0
  35. package/dist/create-editor.js.map +1 -0
  36. package/dist/editor/index.d.ts +11 -0
  37. package/dist/editor/index.d.ts.map +1 -0
  38. package/dist/editor/is-editor.d.ts +3 -0
  39. package/dist/editor/is-editor.d.ts.map +1 -0
  40. package/dist/editor/is-editor.js +17 -0
  41. package/dist/editor/is-editor.js.map +1 -0
  42. package/dist/editor/is-normalizing.d.ts +3 -0
  43. package/dist/editor/is-normalizing.d.ts.map +1 -0
  44. package/dist/editor/is-normalizing.js +9 -0
  45. package/dist/editor/is-normalizing.js.map +1 -0
  46. package/dist/editor/node.d.ts +3 -0
  47. package/dist/editor/node.d.ts.map +1 -0
  48. package/dist/editor/node.js +11 -0
  49. package/dist/editor/node.js.map +1 -0
  50. package/dist/editor/nodes.d.ts +4 -0
  51. package/dist/editor/nodes.d.ts.map +1 -0
  52. package/dist/editor/nodes.js +63 -0
  53. package/dist/editor/nodes.js.map +1 -0
  54. package/dist/editor/normalize.d.ts +3 -0
  55. package/dist/editor/normalize.d.ts.map +1 -0
  56. package/dist/editor/normalize.js +54 -0
  57. package/dist/editor/normalize.js.map +1 -0
  58. package/dist/editor/path-refs.d.ts +3 -0
  59. package/dist/editor/path-refs.d.ts.map +1 -0
  60. package/dist/editor/path-refs.js +13 -0
  61. package/dist/editor/path-refs.js.map +1 -0
  62. package/dist/editor/pathRef.d.ts +3 -0
  63. package/dist/editor/pathRef.d.ts.map +1 -0
  64. package/dist/editor/pathRef.js +25 -0
  65. package/dist/editor/pathRef.js.map +1 -0
  66. package/dist/editor/set-active-context.d.ts +3 -0
  67. package/dist/editor/set-active-context.d.ts.map +1 -0
  68. package/dist/editor/set-active-context.js +10 -0
  69. package/dist/editor/set-active-context.js.map +1 -0
  70. package/dist/editor/set-normalizing.d.ts +3 -0
  71. package/dist/editor/set-normalizing.d.ts.map +1 -0
  72. package/dist/editor/set-normalizing.js +8 -0
  73. package/dist/editor/set-normalizing.js.map +1 -0
  74. package/dist/editor/unsaved-changes.d.ts +4 -0
  75. package/dist/editor/unsaved-changes.d.ts.map +1 -0
  76. package/dist/editor/unsaved-changes.js +11 -0
  77. package/dist/editor/unsaved-changes.js.map +1 -0
  78. package/dist/editor/without-normalizing.d.ts +3 -0
  79. package/dist/editor/without-normalizing.d.ts.map +1 -0
  80. package/dist/editor/without-normalizing.js +19 -0
  81. package/dist/editor/without-normalizing.js.map +1 -0
  82. package/dist/index.d.ts +5190 -0
  83. package/dist/index.d.ts.map +1 -0
  84. package/dist/index.js +36 -0
  85. package/dist/index.js.map +1 -0
  86. package/dist/interfaces/editor.d.ts +103 -0
  87. package/dist/interfaces/editor.d.ts.map +1 -0
  88. package/dist/interfaces/editor.js +43 -0
  89. package/dist/interfaces/editor.js.map +1 -0
  90. package/dist/interfaces/get-default-node-styles.d.ts +3 -0
  91. package/dist/interfaces/get-default-node-styles.d.ts.map +1 -0
  92. package/dist/interfaces/get-default-node-styles.js +9 -0
  93. package/dist/interfaces/get-default-node-styles.js.map +1 -0
  94. package/dist/interfaces/index.d.ts +7 -0
  95. package/dist/interfaces/index.d.ts.map +1 -0
  96. package/dist/interfaces/node.d.ts +182 -0
  97. package/dist/interfaces/node.d.ts.map +1 -0
  98. package/dist/interfaces/node.js +158 -0
  99. package/dist/interfaces/node.js.map +1 -0
  100. package/dist/interfaces/operation.d.ts +86 -0
  101. package/dist/interfaces/operation.d.ts.map +1 -0
  102. package/dist/interfaces/operation.js +117 -0
  103. package/dist/interfaces/operation.js.map +1 -0
  104. package/dist/interfaces/path-ref.d.ts +15 -0
  105. package/dist/interfaces/path-ref.d.ts.map +1 -0
  106. package/dist/interfaces/path-ref.js +18 -0
  107. package/dist/interfaces/path-ref.js.map +1 -0
  108. package/dist/interfaces/path.d.ts +56 -0
  109. package/dist/interfaces/path.d.ts.map +1 -0
  110. package/dist/interfaces/path.js +205 -0
  111. package/dist/interfaces/path.js.map +1 -0
  112. package/dist/interfaces/transforms/general.d.ts +9 -0
  113. package/dist/interfaces/transforms/general.d.ts.map +1 -0
  114. package/dist/interfaces/transforms/general.js +125 -0
  115. package/dist/interfaces/transforms/general.js.map +1 -0
  116. package/dist/interfaces/transforms/index.d.ts +4 -0
  117. package/dist/interfaces/transforms/index.d.ts.map +1 -0
  118. package/dist/interfaces/transforms/index.js +10 -0
  119. package/dist/interfaces/transforms/index.js.map +1 -0
  120. package/dist/interfaces/transforms/node.d.ts +107 -0
  121. package/dist/interfaces/transforms/node.d.ts.map +1 -0
  122. package/dist/interfaces/transforms/node.js +50 -0
  123. package/dist/interfaces/transforms/node.js.map +1 -0
  124. package/dist/transforms-node/index.d.ts +15 -0
  125. package/dist/transforms-node/index.d.ts.map +1 -0
  126. package/dist/transforms-node/insert-nodes.d.ts +3 -0
  127. package/dist/transforms-node/insert-nodes.d.ts.map +1 -0
  128. package/dist/transforms-node/insert-nodes.js +45 -0
  129. package/dist/transforms-node/insert-nodes.js.map +1 -0
  130. package/dist/transforms-node/insert-slot.d.ts +3 -0
  131. package/dist/transforms-node/insert-slot.d.ts.map +1 -0
  132. package/dist/transforms-node/insert-slot.js +18 -0
  133. package/dist/transforms-node/insert-slot.js.map +1 -0
  134. package/dist/transforms-node/lift-nodes.d.ts +3 -0
  135. package/dist/transforms-node/lift-nodes.d.ts.map +1 -0
  136. package/dist/transforms-node/lift-nodes.js +38 -0
  137. package/dist/transforms-node/lift-nodes.js.map +1 -0
  138. package/dist/transforms-node/move-nodes.d.ts +3 -0
  139. package/dist/transforms-node/move-nodes.d.ts.map +1 -0
  140. package/dist/transforms-node/move-nodes.js +21 -0
  141. package/dist/transforms-node/move-nodes.js.map +1 -0
  142. package/dist/transforms-node/remove-nodes.d.ts +3 -0
  143. package/dist/transforms-node/remove-nodes.d.ts.map +1 -0
  144. package/dist/transforms-node/remove-nodes.js +20 -0
  145. package/dist/transforms-node/remove-nodes.js.map +1 -0
  146. package/dist/transforms-node/set-classes.d.ts +3 -0
  147. package/dist/transforms-node/set-classes.d.ts.map +1 -0
  148. package/dist/transforms-node/set-classes.js +48 -0
  149. package/dist/transforms-node/set-classes.js.map +1 -0
  150. package/dist/transforms-node/set-nodes.d.ts +3 -0
  151. package/dist/transforms-node/set-nodes.d.ts.map +1 -0
  152. package/dist/transforms-node/set-nodes.js +50 -0
  153. package/dist/transforms-node/set-nodes.js.map +1 -0
  154. package/dist/transforms-node/set-props.d.ts +3 -0
  155. package/dist/transforms-node/set-props.d.ts.map +1 -0
  156. package/dist/transforms-node/set-props.js +74 -0
  157. package/dist/transforms-node/set-props.js.map +1 -0
  158. package/dist/transforms-node/set-responsive-styles.d.ts +3 -0
  159. package/dist/transforms-node/set-responsive-styles.d.ts.map +1 -0
  160. package/dist/transforms-node/set-responsive-styles.js +41 -0
  161. package/dist/transforms-node/set-responsive-styles.js.map +1 -0
  162. package/dist/transforms-node/set-selection.d.ts +3 -0
  163. package/dist/transforms-node/set-selection.d.ts.map +1 -0
  164. package/dist/transforms-node/set-selection.js +21 -0
  165. package/dist/transforms-node/set-selection.js.map +1 -0
  166. package/dist/transforms-node/unset-classes.d.ts +3 -0
  167. package/dist/transforms-node/unset-classes.d.ts.map +1 -0
  168. package/dist/transforms-node/unset-classes.js +32 -0
  169. package/dist/transforms-node/unset-classes.js.map +1 -0
  170. package/dist/transforms-node/unset-props.d.ts +3 -0
  171. package/dist/transforms-node/unset-props.d.ts.map +1 -0
  172. package/dist/transforms-node/unset-props.js +35 -0
  173. package/dist/transforms-node/unset-props.js.map +1 -0
  174. package/dist/transforms-node/unset-responsive-styles.d.ts +3 -0
  175. package/dist/transforms-node/unset-responsive-styles.d.ts.map +1 -0
  176. package/dist/transforms-node/unset-responsive-styles.js +38 -0
  177. package/dist/transforms-node/unset-responsive-styles.js.map +1 -0
  178. package/dist/transforms-node/unwrap-nodes.d.ts +3 -0
  179. package/dist/transforms-node/unwrap-nodes.d.ts.map +1 -0
  180. package/dist/transforms-node/unwrap-nodes.js +19 -0
  181. package/dist/transforms-node/unwrap-nodes.js.map +1 -0
  182. package/dist/transforms-node/wrap-nodes.d.ts +3 -0
  183. package/dist/transforms-node/wrap-nodes.d.ts.map +1 -0
  184. package/dist/transforms-node/wrap-nodes.js +23 -0
  185. package/dist/transforms-node/wrap-nodes.js.map +1 -0
  186. package/dist/types/condition-types.d.ts +70 -0
  187. package/dist/types/condition-types.d.ts.map +1 -0
  188. package/dist/types/custom-types.d.ts +10 -0
  189. package/dist/types/custom-types.d.ts.map +1 -0
  190. package/dist/types/index.d.ts +4 -0
  191. package/dist/types/index.d.ts.map +1 -0
  192. package/dist/types/types.d.ts +12 -0
  193. package/dist/types/types.d.ts.map +1 -0
  194. package/dist/utils/index.d.ts +2 -0
  195. package/dist/utils/index.d.ts.map +1 -0
  196. package/dist/utils/index.js +6 -0
  197. package/dist/utils/index.js.map +1 -0
  198. package/dist/utils/is-plain-object.d.ts +9 -0
  199. package/dist/utils/is-plain-object.d.ts.map +1 -0
  200. package/dist/utils/is-plain-object.js +32 -0
  201. package/dist/utils/is-plain-object.js.map +1 -0
  202. package/dist/utils/match-path.d.ts +5 -0
  203. package/dist/utils/match-path.d.ts.map +1 -0
  204. package/dist/utils/types.d.ts +3 -0
  205. package/dist/utils/types.d.ts.map +1 -0
  206. package/dist/utils/weak-maps.d.ts +8 -0
  207. package/dist/utils/weak-maps.d.ts.map +1 -0
  208. package/dist/utils/weak-maps.js +9 -0
  209. package/dist/utils/weak-maps.js.map +1 -0
  210. package/package.json +52 -0
@@ -0,0 +1,50 @@
1
+ import { Node } from '../interfaces/node.js';
2
+
3
+ const setNodes = (editor, props, options = {}) => {
4
+ let { compare, allowAllProp } = options;
5
+ const { merge, at = editor.selection } = options;
6
+ //TODO:IMPLEMENT MATCH
7
+ if (!at) {
8
+ return;
9
+ }
10
+ const node = Node.get(editor, at);
11
+ const path = at;
12
+ const properties = {};
13
+ // FIXME: is this correct?
14
+ const newProperties = {};
15
+ let hasChanges = false;
16
+ if (!compare) {
17
+ compare = (prop, nodeProp) => prop !== nodeProp;
18
+ }
19
+ for (const k in props) {
20
+ if (!allowAllProp && (k === "slots" || k === "props")) {
21
+ continue;
22
+ }
23
+ if (compare(props[k], node[k])) {
24
+ hasChanges = true;
25
+ // Omit new properties from the old properties list
26
+ if (Object.prototype.hasOwnProperty.call(node, k))
27
+ properties[k] = node[k];
28
+ // Omit properties that have been removed from the new properties list
29
+ if (merge) {
30
+ if (props[k] != null)
31
+ newProperties[k] = merge(node[k], props[k]);
32
+ }
33
+ else {
34
+ if (props[k] != null)
35
+ newProperties[k] = props[k];
36
+ }
37
+ }
38
+ }
39
+ if (hasChanges) {
40
+ editor.apply({
41
+ type: "set_node",
42
+ path,
43
+ properties,
44
+ newProperties,
45
+ });
46
+ }
47
+ };
48
+
49
+ export { setNodes };
50
+ //# sourceMappingURL=set-nodes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"set-nodes.js","sources":["../../src/transforms-node/set-nodes.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAKO,MAAM,QAAQ,GAA+B,CAClD,MAAM,EACN,KAAoB,EACpB,OAAO,GAAG,EAAE,KACV;AACF,IAAA,IAAI,EAAE,OAAO,EAAE,YAAY,EAAE,GAAG,OAAO;IACvC,MAAM,EAAE,KAAK,EAAE,EAAE,GAAG,MAAM,CAAC,SAAS,EAAE,GAAG,OAAO;;IAGhD,IAAI,CAAC,EAAE,EAAE;QACP;IACF;IACA,MAAM,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE,EAAE,CAAC;IACjC,MAAM,IAAI,GAAG,EAAE;IACf,MAAM,UAAU,GAAkB,EAAE;;IAEpC,MAAM,aAAa,GAA+C,EAAE;IAEpE,IAAI,UAAU,GAAG,KAAK;IAEtB,IAAI,CAAC,OAAO,EAAE;QACZ,OAAO,GAAG,CAAC,IAAI,EAAE,QAAQ,KAAK,IAAI,KAAK,QAAQ;IACjD;AAEA,IAAA,KAAK,MAAM,CAAC,IAAI,KAAK,EAAE;AACrB,QAAA,IAAI,CAAC,YAAY,KAAK,CAAC,KAAK,OAAO,IAAI,CAAC,KAAK,OAAO,CAAC,EAAE;YACrD;QACF;AAEA,QAAA,IAAI,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE;YAC9B,UAAU,GAAG,IAAI;;YAEjB,IAAI,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC;gBAC/C,UAAU,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC;;YAEzB,IAAI,KAAK,EAAE;AACT,gBAAA,IAAI,KAAK,CAAC,CAAC,CAAC,IAAI,IAAI;AAAE,oBAAA,aAAa,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC;YACnE;iBAAO;AACL,gBAAA,IAAI,KAAK,CAAC,CAAC,CAAC,IAAI,IAAI;oBAAE,aAAa,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC;YACnD;QACF;IACF;IACA,IAAI,UAAU,EAAE;QACd,MAAM,CAAC,KAAK,CAAC;AACX,YAAA,IAAI,EAAE,UAAU;YAChB,IAAI;YACJ,UAAU;YACV,aAAa;AACd,SAAA,CAAC;IACJ;AACF;;;;"}
@@ -0,0 +1,3 @@
1
+ import { NodeTransforms } from "../interfaces/transforms/node";
2
+ export declare const setProp: NodeTransforms["setProp"];
3
+ //# sourceMappingURL=set-props.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"set-props.d.ts","sourceRoot":"","sources":["../../src/transforms-node/set-props.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAO/D,eAAO,MAAM,OAAO,EAAE,cAAc,CAAC,SAAS,CAmF7C,CAAC"}
@@ -0,0 +1,74 @@
1
+ import 'uuid';
2
+ import 'lodash-es';
3
+ import { Transforms } from '../interfaces/transforms/index.js';
4
+
5
+ // TODO: Discuss with @Deepak-Kharah why we used cloneDeep here and why can't we use set_nodes
6
+ const isNodeSlotProp = (prop) => {
7
+ return prop?.type === "slot";
8
+ };
9
+ const setProp = (editor, propKey, prop, nodes, options = {}) => {
10
+ const { at = editor.selection } = options;
11
+ if (!at) {
12
+ return;
13
+ }
14
+ if (!propKey) {
15
+ throw new Error(`The prop path is required to set the prop!`);
16
+ }
17
+ // prop { type: 'slot', slot: 'uid' }
18
+ // if uid changes it means old has to be deleted
19
+ // else simply update the prop
20
+ Transforms.setNodes(editor, { props: {} }, {
21
+ at,
22
+ allowAllProp: true,
23
+ //@ts-ignore
24
+ merge: (prevProps) => {
25
+ const prevProp = prevProps?.[propKey];
26
+ const nextProp = {
27
+ ...prevProp,
28
+ ...prop,
29
+ };
30
+ // DELETE ALL UNDEFINED VAlUE PROPS
31
+ Object.keys(nextProp).forEach((key) => {
32
+ // @ts-ignore
33
+ if (nextProp[key] === undefined)
34
+ delete nextProp[key];
35
+ });
36
+ if (isNodeSlotProp(nextProp) && !nextProp.slot) {
37
+ throw new Error(`The slot prop is missing!`);
38
+ }
39
+ const hasChangedFromSlot = isNodeSlotProp(prevProp) && !isNodeSlotProp(nextProp);
40
+ const hasSlotIdChanged = isNodeSlotProp(nextProp) &&
41
+ isNodeSlotProp(prevProp) &&
42
+ prevProp.slot !== nextProp.slot;
43
+ const isNewSlot = isNodeSlotProp(nextProp) && !isNodeSlotProp(prevProp);
44
+ if (hasChangedFromSlot || hasSlotIdChanged || isNewSlot) {
45
+ Transforms.setNodes(editor, { slots: {} }, {
46
+ at,
47
+ allowAllProp: true,
48
+ merge: (prevSlots) => {
49
+ const nextSlots = Object.assign({}, prevSlots || {});
50
+ if (!isNewSlot) {
51
+ delete nextSlots[prevProp.slot];
52
+ }
53
+ if (hasSlotIdChanged || isNewSlot) {
54
+ nextSlots[nextProp.slot] = nodes;
55
+ }
56
+ return nextSlots;
57
+ },
58
+ });
59
+ }
60
+ if (hasChangedFromSlot) {
61
+ //@ts-ignore
62
+ delete nextProp["slot"];
63
+ }
64
+ // Update the current with new
65
+ return {
66
+ ...(prevProps || {}),
67
+ [propKey]: nextProp,
68
+ };
69
+ },
70
+ });
71
+ };
72
+
73
+ export { setProp };
74
+ //# sourceMappingURL=set-props.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"set-props.js","sources":["../../src/transforms-node/set-props.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;AAQA;AACA,MAAM,cAAc,GAAG,CAAC,IAAuB,KAA+B;AAC5E,IAAA,OAAO,IAAI,EAAE,IAAI,KAAK,MAAM;AAC9B,CAAC;AAEM,MAAM,OAAO,GAA8B,CAChD,MAAM,EACN,OAAO,EACP,IAAI,EACJ,KAAK,EACL,OAAO,GAAG,EAAE,KACV;IACF,MAAM,EAAE,EAAE,GAAG,MAAM,CAAC,SAAS,EAAE,GAAG,OAAO;IAEzC,IAAI,CAAC,EAAE,EAAE;QACP;IACF;IAEA,IAAI,CAAC,OAAO,EAAE;AACZ,QAAA,MAAM,IAAI,KAAK,CAAC,CAAA,0CAAA,CAA4C,CAAC;IAC/D;;;;IAIA,UAAU,CAAC,QAAQ,CACjB,MAAM,EACN,EAAE,KAAK,EAAE,EAAe,EAAE,EAC1B;QACE,EAAE;AACF,QAAA,YAAY,EAAE,IAAI;;AAElB,QAAA,KAAK,EAAE,CAAC,SAAoB,KAAI;AAC9B,YAAA,MAAM,QAAQ,GAAG,SAAS,GAAG,OAAO,CAAa;AACjD,YAAA,MAAM,QAAQ,GAAG;AACf,gBAAA,GAAG,QAAQ;AACX,gBAAA,GAAG,IAAI;aACI;;YAGb,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,OAAO,CAAC,CAAC,GAAG,KAAI;;AAEpC,gBAAA,IAAI,QAAQ,CAAC,GAAG,CAAC,KAAK,SAAS;AAAE,oBAAA,OAAO,QAAQ,CAAC,GAAG,CAAC;AACvD,YAAA,CAAC,CAAC;YAEF,IAAI,cAAc,CAAC,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE;AAC9C,gBAAA,MAAM,IAAI,KAAK,CAAC,CAAA,yBAAA,CAA2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ponsiveStyles"];
3
+ //# sourceMappingURL=set-responsive-styles.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"set-responsive-styles.d.ts","sourceRoot":"","sources":["../../src/transforms-node/set-responsive-styles.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAE/D,eAAO,MAAM,mBAAmB,EAAE,cAAc,CAAC,qBAAqB,CA+CrE,CAAC"}
@@ -0,0 +1,41 @@
1
+ import { produce } from 'immer';
2
+ import { getDefaultNodeStyles } from '../interfaces/get-default-node-styles.js';
3
+
4
+ const setResponsiveStyles = (editor, styleGroup, breakpoint, style, options = {}) => {
5
+ const { at = editor.selection } = options;
6
+ if (!at) {
7
+ return;
8
+ }
9
+ if (!styleGroup) {
10
+ throw new Error("The style group is required to set the responsive style!");
11
+ }
12
+ if (!breakpoint) {
13
+ throw new Error(`The breakpoint is required to set the responsive style!`);
14
+ }
15
+ editor.setNodes({ styles: {} }, {
16
+ ...options,
17
+ merge: (prevStyles) => {
18
+ return produce(prevStyles, (draft) => {
19
+ // We update the responsive styles for the given style group
20
+ draft[styleGroup] = {
21
+ // We keep the existing classes and responsive styles, if any. Else, we initialize them.
22
+ ...(draft[styleGroup] || getDefaultNodeStyles()),
23
+ // We update the values of the responsive styles for the given breakpoint.
24
+ responsiveStyles: {
25
+ // Get all the existing responsive styles for the given style group
26
+ ...(draft[styleGroup]?.responsiveStyles || {}),
27
+ // Update the responsive styles for the given breakpoint
28
+ [breakpoint]: {
29
+ ...(draft[styleGroup]?.responsiveStyles?.[breakpoint] || {}),
30
+ ...style,
31
+ },
32
+ },
33
+ };
34
+ return draft;
35
+ });
36
+ },
37
+ });
38
+ };
39
+
40
+ export { setResponsiveStyles };
41
+ //# sourceMappingURL=set-responsive-styles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"set-responsive-styles.js","sources":["../../src/transforms-node/set-responsive-styles.ts"],"sourcesContent":[null],"names":[],"mappings":";;;AAKO,MAAM,mBAAmB,GAA0C,CACxE,MAAM,EACN,UAAU,EACV,UAAU,EACV,KAAK,EACL,OAAO,GAAG,EAAE,KACV;IACF,MAAM,EAAE,EAAE,GAAG,MAAM,CAAC,SAAS,EAAE,GAAG,OAAO;IAEzC,IAAI,CAAC,EAAE,EAAE;QACP;IACF;IAEA,IAAI,CAAC,UAAU,EAAE;AACf,QAAA,MAAM,IAAI,KAAK,CAAC,0DAA0D,CAAC;IAC7E;IAEA,IAAI,CAAC,UAAU,EAAE;AACf,QAAA,MAAM,IAAI,KAAK,CAAC,CAAA,uDAAA,CAAyD,CAAC;IAC5E;IAEA,MAAM,CAAC,QAAQ,CACb,EAAE,MAAM,EAAE,EAAE,EAAE,EACd;AACE,QAAA,GAAG,OAAO;AACV,QAAA,KAAK,EAAE,CAAC,UAAU,KAAI;AACpB,YAAA,OAAO,OAAO,CAAC,UAAU,EAAE,CAAC,KAAqB,KAAI;;gBAEnD,KAAK,CAAC,UAAU,CAAC,GAAG;;oBAElB,IAAI,KAAK,CAAC,UAAU,CAAC,IAAI,oBAAoB,EAAE,CAAC;;AAEhD,oBAAA,gBAAgB,EAAE;;wBAEhB,IAAI,KAAK,CAAC,UAAU,CAAC,EAAE,gBAAgB,IAAI,EAAE,CAAC;;wBAE9C,CAAC,UAAU,GAAG;AACZ,4BAAA,IAAI,KAAK,CAAC,UAAU,CAAC,EAAE,gBAAgB,GAAG,UAAU,CAAC,IAAI,EAAE,CAAC;AAC5D,4BAAA,GAAG,KAAK;AACT,yBAAA;AACF,qBAAA;iBACF;AACD,gBAAA,OAAO,KAAK;AACd,YAAA,CAAC,CAAC;QACJ,CAAC;AACF,KAAA,CACF;AACH;;;;"}
@@ -0,0 +1,3 @@
1
+ import { NodeTransforms } from "../interfaces/transforms/node";
2
+ export declare const setSelection: NodeTransforms["setSelection"];
3
+ //# sourceMappingURL=set-selection.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"set-selection.d.ts","sourceRoot":"","sources":["../../src/transforms-node/set-selection.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAE/D,eAAO,MAAM,YAAY,EAAE,cAAc,CAAC,cAAc,CAgBvD,CAAC"}
@@ -0,0 +1,21 @@
1
+ import 'uuid';
2
+ import { Path } from '../interfaces/path.js';
3
+ import 'immer';
4
+
5
+ const setSelection = (editor, options) => {
6
+ const { at } = options;
7
+ if (!at) {
8
+ return;
9
+ }
10
+ const { selection } = editor;
11
+ if (selection && Path.equals(selection, at)) {
12
+ return;
13
+ }
14
+ editor.apply({
15
+ type: "set_selection",
16
+ path: at,
17
+ });
18
+ };
19
+
20
+ export { setSelection };
21
+ //# sourceMappingURL=set-selection.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"set-selection.js","sources":["../../src/transforms-node/set-selection.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;MAGa,YAAY,GAAmC,CAC1D,MAAM,EACN,OAAO,KACL;AACF,IAAA,MAAM,EAAE,EAAE,EAAE,GAAG,OAAO;IACtB,IAAI,CAAC,EAAE,EAAE;QACP;IACF;AACA,IAAA,MAAM,EAAE,SAAS,EAAE,GAAG,MAAM;IAC5B,IAAI,SAAS,IAAI,IAAI,CAAC,MAAM,CAAC,SAAS,EAAE,EAAE,CAAC,EAAE;QAC3C;IACF;IACA,MAAM,CAAC,KAAK,CAAC;AACX,QAAA,IAAI,EAAE,eAAe;AACrB,QAAA,IAAI,EAAE,EAAE;AACT,KAAA,CAAC;AACJ;;;;"}
@@ -0,0 +1,3 @@
1
+ import { NodeTransforms } from "../interfaces/transforms/node";
2
+ export declare const unsetClasses: NodeTransforms["unsetClasses"];
3
+ //# sourceMappingURL=unset-classes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"unset-classes.d.ts","sourceRoot":"","sources":["../../src/transforms-node/unset-classes.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAE/D,eAAO,MAAM,YAAY,EAAE,cAAc,CAAC,cAAc,CAwCvD,CAAC"}
@@ -0,0 +1,32 @@
1
+ import { produce } from 'immer';
2
+
3
+ const unsetClasses = (editor, styleGroup, className, options = {}) => {
4
+ const { at = editor.selection } = options;
5
+ if (!at) {
6
+ return;
7
+ }
8
+ if (!styleGroup) {
9
+ throw new Error("The style group is required to unset the class!");
10
+ }
11
+ editor.setNodes({ styles: {} }, {
12
+ ...options,
13
+ merge: (prevStyles) => {
14
+ return produce(prevStyles, (draft) => {
15
+ // We update the responsive styles for the given style group
16
+ draft[styleGroup] = {
17
+ // We keep the existing classes and responsive styles, if any. Else, we initialize them.
18
+ ...(draft[styleGroup] || {
19
+ responsiveStyles: {},
20
+ classes: [],
21
+ }),
22
+ // Filter out the class to unset
23
+ classes: draft[styleGroup].classes.filter((val) => val !== className),
24
+ };
25
+ return draft;
26
+ });
27
+ },
28
+ });
29
+ };
30
+
31
+ export { unsetClasses };
32
+ //# sourceMappingURL=unset-classes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"unset-classes.js","sources":["../../src/transforms-node/unset-classes.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAIO,MAAM,YAAY,GAAmC,CAC1D,MAAM,EACN,UAAU,EACV,SAAS,EACT,OAAO,GAAG,EAAE,KACV;IACF,MAAM,EAAE,EAAE,GAAG,MAAM,CAAC,SAAS,EAAE,GAAG,OAAO;IAEzC,IAAI,CAAC,EAAE,EAAE;QACP;IACF;IAEA,IAAI,CAAC,UAAU,EAAE;AACf,QAAA,MAAM,IAAI,KAAK,CAAC,iDAAiD,CAAC;IACpE;IAEA,MAAM,CAAC,QAAQ,CACb,EAAE,MAAM,EAAE,EAAE,EAAE,EACd;AACE,QAAA,GAAG,OAAO;AACV,QAAA,KAAK,EAAE,CAAC,UAAU,KAAI;AACpB,YAAA,OAAO,OAAO,CAAC,UAAU,EAAE,CAAC,KAAqB,KAAI;;gBAEnD,KAAK,CAAC,UAAU,CAAC,GAAG;;AAElB,oBAAA,IAAI,KAAK,CAAC,UAAU,CAAC,IAAI;AACvB,wBAAA,gBAAgB,EAAE,EAAE;AACpB,wBAAA,OAAO,EAAE,EAAE;qBACZ,CAAC;;AAEF,oBAAA,OAAO,EAAE,KAAK,CAAC,UAAU,CAAC,CAAC,OAAO,CAAC,MAAM,CACvC,CAAC,GAAG,KAAK,GAAG,KAAK,SAAS,CAC3B;iBACF;AAED,gBAAA,OAAO,KAAK;AACd,YAAA,CAAC,CAAC;QACJ,CAAC;AACF,KAAA,CACF;AACH;;;;"}
@@ -0,0 +1,3 @@
1
+ import { NodeTransforms } from "../interfaces/transforms/node";
2
+ export declare const unsetProp: NodeTransforms["unsetProp"];
3
+ //# sourceMappingURL=unset-props.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"unset-props.d.ts","sourceRoot":"","sources":["../../src/transforms-node/unset-props.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAG/D,eAAO,MAAM,SAAS,EAAE,cAAc,CAAC,WAAW,CAuCjD,CAAC"}
@@ -0,0 +1,35 @@
1
+ import { cloneDeep, unset } from 'lodash-es';
2
+
3
+ // TODO: Discuss with @Deepak-Kharah why we used cloneDeep here
4
+ const unsetProp = (editor, propPath, options = {}) => {
5
+ const { at = editor.selection } = options;
6
+ if (!at) {
7
+ return;
8
+ }
9
+ if (!propPath) {
10
+ throw new Error(`The propPath is required to unset the prop!`);
11
+ }
12
+ const [node] = editor.node(at);
13
+ const newProps = cloneDeep(node.props);
14
+ const newSlots = cloneDeep(node.slots);
15
+ if (!node.props[propPath]) {
16
+ return;
17
+ }
18
+ if (node.props[propPath].type === "slot") {
19
+ unset(newSlots, node.props[propPath].slot);
20
+ }
21
+ // TODO: use the propPath to handle the array and object props
22
+ unset(newProps, propPath);
23
+ editor.apply({
24
+ type: "set_node",
25
+ properties: node.props,
26
+ newProperties: {
27
+ props: newProps,
28
+ slots: newSlots,
29
+ },
30
+ path: at,
31
+ });
32
+ };
33
+
34
+ export { unsetProp };
35
+ //# sourceMappingURL=unset-props.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"unset-props.js","sources":["../../src/transforms-node/unset-props.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAGA;AACO,MAAM,SAAS,GAAgC,CACpD,MAAM,EACN,QAAQ,EACR,OAAO,GAAG,EAAE,KACV;IACF,MAAM,EAAE,EAAE,GAAG,MAAM,CAAC,SAAS,EAAE,GAAG,OAAO;IAEzC,IAAI,CAAC,EAAE,EAAE;QACP;IACF;IAEA,IAAI,CAAC,QAAQ,EAAE;AACb,QAAA,MAAM,IAAI,KAAK,CAAC,CAAA,2CAAA,CAA6C,CAAC;IAChE;IAEA,MAAM,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC;IAE9B,MAAM,QAAQ,GAAG,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC;IACtC,MAAM,QAAQ,GAAG,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC;IAEtC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,EAAE;QACzB;IACF;IAEA,IAAI,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,IAAI,KAAK,MAAM,EAAE;AACxC,QAAA,KAAK,CAAC,QAAQ,EAAE,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC;IAC5C;;AAEA,IAAA,KAAK,CAAC,QAAQ,EAAE,QAAQ,CAAC;IAEzB,MAAM,CAAC,KAAK,CAAC;AACX,QAAA,IAAI,EAAE,UAAU;QAChB,UAAU,EAAE,IAAI,CAAC,KAAK;AACtB,QAAA,aAAa,EAAE;AACb,YAAA,KAAK,EAAE,QAAQ;AACf,YAAA,KAAK,EAAE,QAAQ;AAChB,SAAA;AACD,QAAA,IAAI,EAAE,EAAE;AACT,KAAA,CAAC;AACJ;;;;"}
@@ -0,0 +1,3 @@
1
+ import { NodeTransforms } from "../interfaces/transforms/node";
2
+ export declare const unsetResponsiveStyles: NodeTransforms["unsetResponsiveStyles"];
3
+ //# sourceMappingURL=unset-responsive-styles.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"unset-responsive-styles.d.ts","sourceRoot":"","sources":["../../src/transforms-node/unset-responsive-styles.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAE/D,eAAO,MAAM,qBAAqB,EAAE,cAAc,CAAC,uBAAuB,CAkDzE,CAAC"}
@@ -0,0 +1,38 @@
1
+ import { produce } from 'immer';
2
+ import { unset } from 'lodash-es';
3
+
4
+ const unsetResponsiveStyles = (editor, styleGroup, breakpoint, style, options = {}) => {
5
+ const { at = editor.selection } = options;
6
+ if (!at) {
7
+ return;
8
+ }
9
+ if (!styleGroup) {
10
+ throw new Error("The style group is required to unset the responsive style!");
11
+ }
12
+ if (!breakpoint) {
13
+ throw new Error(`The breakpoint is required to unset the responsive style!`);
14
+ }
15
+ editor.setNodes({ styles: {} }, {
16
+ ...options,
17
+ merge: (prevStyles) => {
18
+ return produce(prevStyles, (draft) => {
19
+ const breakpoints = draft?.[styleGroup]?.responsiveStyles?.[breakpoint];
20
+ if (!breakpoints) {
21
+ return draft;
22
+ }
23
+ if (Array.isArray(style)) {
24
+ style.forEach((s) => {
25
+ unset(breakpoints, s);
26
+ });
27
+ }
28
+ else if (breakpoints[style]) {
29
+ unset(breakpoints, style);
30
+ }
31
+ return draft;
32
+ });
33
+ },
34
+ });
35
+ };
36
+
37
+ export { unsetResponsiveStyles };
38
+ //# sourceMappingURL=unset-responsive-styles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"unset-responsive-styles.js","sources":["../../src/transforms-node/unset-responsive-styles.ts"],"sourcesContent":[null],"names":[],"mappings":";;;AAKO,MAAM,qBAAqB,GAA4C,CAC5E,MAAM,EACN,UAAU,EACV,UAAU,EACV,KAAK,EACL,OAAO,GAAG,EAAE,KACV;IACF,MAAM,EAAE,EAAE,GAAG,MAAM,CAAC,SAAS,EAAE,GAAG,OAAO;IAEzC,IAAI,CAAC,EAAE,EAAE;QACP;IACF;IAEA,IAAI,CAAC,UAAU,EAAE;AACf,QAAA,MAAM,IAAI,KAAK,CACb,4DAA4D,CAC7D;IACH;IAEA,IAAI,CAAC,UAAU,EAAE;AACf,QAAA,MAAM,IAAI,KAAK,CACb,CAAA,yDAAA,CAA2D,CAC5D;IACH;IAEA,MAAM,CAAC,QAAQ,CACb,EAAE,MAAM,EAAE,EAAE,EAAE,EACd;AACE,QAAA,GAAG,OAAO;AACV,QAAA,KAAK,EAAE,CAAC,UAAU,KAAI;AACpB,YAAA,OAAO,OAAO,CAAC,UAAU,EAAE,CAAC,KAAqB,KAAI;AACnD,gBAAA,MAAM,WAAW,GACf,KAAK,GAAG,UAAU,CAAC,EAAE,gBAAgB,GAAG,UAAU,CAAC;gBAErD,IAAI,CAAC,WAAW,EAAE;AAChB,oBAAA,OAAO,KAAK;gBACd;AAEA,gBAAA,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;AACxB,oBAAA,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,KAAI;AAClB,wBAAA,KAAK,CAAC,WAAW,EAAE,CAAC,CAAC;AACvB,oBAAA,CAAC,CAAC;gBACJ;AAAO,qBAAA,IAAI,WAAW,CAAC,KAAK,CAAC,EAAE;AAC7B,oBAAA,KAAK,CAAC,WAAW,EAAE,KAAK,CAAC;gBAC3B;AACA,gBAAA,OAAO,KAAK;AACd,YAAA,CAAC,CAAC;QACJ,CAAC;AACF,KAAA,CACF;AACH;;;;"}
@@ -0,0 +1,3 @@
1
+ import { NodeTransforms } from "../interfaces/transforms/node";
2
+ export declare const unwrapNodes: NodeTransforms["unwrapNodes"];
3
+ //# sourceMappingURL=unwrap-nodes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"unwrap-nodes.d.ts","sourceRoot":"","sources":["../../src/transforms-node/unwrap-nodes.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAE/D,eAAO,MAAM,WAAW,EAAE,cAAc,CAAC,aAAa,CAgBrD,CAAC"}
@@ -0,0 +1,19 @@
1
+ import 'uuid';
2
+ import 'lodash-es';
3
+ import { Editor } from '../interfaces/editor.js';
4
+ import { Transforms } from '../interfaces/transforms/index.js';
5
+
6
+ const unwrapNodes = (editor, slotUid, options = {}) => {
7
+ Editor.withoutNormalizing(editor, () => {
8
+ const { at = editor.selection } = options;
9
+ if (!at) {
10
+ return;
11
+ }
12
+ Transforms.liftNodes(editor, slotUid, {
13
+ at,
14
+ });
15
+ });
16
+ };
17
+
18
+ export { unwrapNodes };
19
+ //# sourceMappingURL=unwrap-nodes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"unwrap-nodes.js","sources":["../../src/transforms-node/unwrap-nodes.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;;AAGO,MAAM,WAAW,GAAkC,CACxD,MAAM,EACN,OAAO,EACP,OAAO,GAAG,EAAE,KACV;AACF,IAAA,MAAM,CAAC,kBAAkB,CAAC,MAAM,EAAE,MAAK;QACrC,MAAM,EAAE,EAAE,GAAG,MAAM,CAAC,SAAS,EAAE,GAAG,OAAO;QAEzC,IAAI,CAAC,EAAE,EAAE;YACP;QACF;AAEA,QAAA,UAAU,CAAC,SAAS,CAAC,MAAM,EAAE,OAAO,EAAE;YACpC,EAAE;AACH,SAAA,CAAC;AACJ,IAAA,CAAC,CAAC;AACJ;;;;"}
@@ -0,0 +1,3 @@
1
+ import { NodeTransforms } from "../interfaces/transforms/node";
2
+ export declare const wrapNodes: NodeTransforms["wrapNodes"];
3
+ //# sourceMappingURL=wrap-nodes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wrap-nodes.d.ts","sourceRoot":"","sources":["../../src/transforms-node/wrap-nodes.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAE/D,eAAO,MAAM,SAAS,EAAE,cAAc,CAAC,WAAW,CAqBjD,CAAC"}
@@ -0,0 +1,23 @@
1
+ import 'uuid';
2
+ import { Path } from '../interfaces/path.js';
3
+ import { Editor } from '../interfaces/editor.js';
4
+ import { Transforms } from '../interfaces/transforms/index.js';
5
+
6
+ const wrapNodes = (editor, container, slotUid, options = {}) => {
7
+ Editor.withoutNormalizing(editor, () => {
8
+ const { at = editor.selection } = options;
9
+ if (!at) {
10
+ return;
11
+ }
12
+ container.slots[slotUid] = [];
13
+ const wrapperPath = Path.next(at);
14
+ Transforms.insertNodes(editor, container, { at: wrapperPath });
15
+ Transforms.moveNodes(editor, {
16
+ at,
17
+ to: [...wrapperPath, [slotUid, 0]],
18
+ });
19
+ });
20
+ };
21
+
22
+ export { wrapNodes };
23
+ //# sourceMappingURL=wrap-nodes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wrap-nodes.js","sources":["../../src/transforms-node/wrap-nodes.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;;AAGO,MAAM,SAAS,GAAgC,CACpD,MAAM,EACN,SAAS,EACT,OAAO,EACP,OAAO,GAAG,EAAE,KACV;AACF,IAAA,MAAM,CAAC,kBAAkB,CAAC,MAAM,EAAE,MAAK;QACrC,MAAM,EAAE,EAAE,GAAG,MAAM,CAAC,SAAS,EAAE,GAAG,OAAO;QAEzC,IAAI,CAAC,EAAE,EAAE;YACP;QACF;AAEA,QAAA,SAAS,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,EAAE;QAC7B,MAAM,WAAW,GAAG,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;AACjC,QAAA,UAAU,CAAC,WAAW,CAAC,MAAM,EAAE,SAAS,EAAE,EAAE,EAAE,EAAE,WAAW,EAAE,CAAC;AAC9D,QAAA,UAAU,CAAC,SAAS,CAAC,MAAM,EAAE;YAC3B,EAAE;YACF,EAAE,EAAE,CAAC,GAAG,WAAW,EAAE,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;AACnC,SAAA,CAAC;AACJ,IAAA,CAAC,CAAC;AACJ;;;;"}
@@ -0,0 +1,70 @@
1
+ import { BindingType } from "../interfaces";
2
+ import { ARRAY_OPERATORS, TEXT_OPERATORS, MODULAR_BLOCK_OPERATORS, COMPARISON_OPERATORS, BOOLEAN_OPERATORS, SINGLE_SELECT_OPERATORS, MULTI_SELECT_OPERATORS, REFERENCE_OPERATORS, IMAGE_EXTENSION_OPERATOR } from "../constants/condition";
3
+ export type ComparisonOperator = (typeof COMPARISON_OPERATORS)[number]["value"];
4
+ export type StringOperator = (typeof TEXT_OPERATORS)[number]["value"];
5
+ export type ImageExtensionOperator = (typeof IMAGE_EXTENSION_OPERATOR)[number]["value"];
6
+ export type ArrayOperator = (typeof ARRAY_OPERATORS)[number]["value"];
7
+ export type ModularBlockOperator = (typeof MODULAR_BLOCK_OPERATORS)[number]["value"];
8
+ export type BooleanOperator = (typeof BOOLEAN_OPERATORS)[number]["value"];
9
+ export type SingleSelectOperator = (typeof SINGLE_SELECT_OPERATORS)[number]["value"];
10
+ export type MultiSelectOperator = (typeof MULTI_SELECT_OPERATORS)[number]["value"];
11
+ export type SelectOperator = SingleSelectOperator | MultiSelectOperator;
12
+ export type ReferenceOperator = (typeof REFERENCE_OPERATORS)[number]["value"];
13
+ export type ConditionBindings = {
14
+ conditionBinding: BindingType;
15
+ dataBinding: BindingType;
16
+ };
17
+ export type NumberCondition = {
18
+ type: "number";
19
+ operator: ComparisonOperator;
20
+ value: number;
21
+ } & ConditionBindings;
22
+ export type StringCondition = {
23
+ type: "string";
24
+ operator: StringOperator;
25
+ value: string;
26
+ caseSensitive?: boolean;
27
+ } & ConditionBindings;
28
+ export type BooleanCondition = {
29
+ type: "boolean";
30
+ value: boolean;
31
+ operator: BooleanOperator;
32
+ } & ConditionBindings;
33
+ export type ArrayCondition = {
34
+ type: "array";
35
+ operator: ArrayOperator;
36
+ value: any;
37
+ } & ConditionBindings;
38
+ export type ModularBlockCondition = {
39
+ type: "modular_block";
40
+ operator: ModularBlockOperator;
41
+ value: string;
42
+ } & ConditionBindings;
43
+ export type DateCondition = {
44
+ type: "date";
45
+ operator: ComparisonOperator;
46
+ value: string;
47
+ } & ConditionBindings;
48
+ export type SelectCondition = {
49
+ type: "select";
50
+ operator: SelectOperator;
51
+ value: string;
52
+ } & ConditionBindings;
53
+ export type ReferenceCondition = {
54
+ type: "reference";
55
+ operator: ReferenceOperator;
56
+ value: string;
57
+ } & ConditionBindings;
58
+ export type ImageExtensionCondition = {
59
+ type: "image_extension";
60
+ operator: ImageExtensionOperator;
61
+ value: string;
62
+ } & ConditionBindings;
63
+ export type ImageSizeCondition = {
64
+ type: "image_size";
65
+ operator: ComparisonOperator;
66
+ value: number;
67
+ } & ConditionBindings;
68
+ export type ImageCondition = ImageSizeCondition | ImageExtensionCondition;
69
+ export type Condition = NumberCondition | StringCondition | BooleanCondition | ArrayCondition | ModularBlockCondition | DateCondition | SelectCondition | ReferenceCondition | ImageCondition;
70
+ //# sourceMappingURL=condition-types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"condition-types.d.ts","sourceRoot":"","sources":["../../src/types/condition-types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EACL,eAAe,EACf,cAAc,EACd,uBAAuB,EACvB,oBAAoB,EACpB,iBAAiB,EACjB,uBAAuB,EACvB,sBAAsB,EACtB,mBAAmB,EACnB,wBAAwB,EACzB,MAAM,wBAAwB,CAAC;AAEhC,MAAM,MAAM,kBAAkB,GAAG,CAAC,OAAO,oBAAoB,CAAC,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC;AAChF,MAAM,MAAM,cAAc,GAAG,CAAC,OAAO,cAAc,CAAC,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC;AACtE,MAAM,MAAM,sBAAsB,GAChC,CAAC,OAAO,wBAAwB,C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S,GACjB,eAAe,GACf,eAAe,GACf,gBAAgB,GAChB,cAAc,GACd,qBAAqB,GACrB,aAAa,GACb,eAAe,GACf,kBAAkB,GAClB,cAAc,CAAC"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Extendable Custom Types Interface
3
+ */
4
+ type ExtendableTypes = "Editor" | "Selection" | "Range" | "Point" | "Operation" | "InsertNodeOperation" | "MoveNodeOperation" | "RemoveNodeOperation" | "SetNodeOperation" | "SetSelectionOperation";
5
+ export interface CustomTypes {
6
+ [key: string]: unknown;
7
+ }
8
+ export type ExtendedType<K extends ExtendableTypes, B> = unknown extends CustomTypes[K] ? B : CustomTypes[K];
9
+ export {};
10
+ //# sourceMappingURL=custom-types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"custom-types.d.ts","sourceRoot":"","sources":["../../src/types/custom-types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,KAAK,eAAe,GAChB,QAAQ,GAER,WAAW,GACX,OAAO,GACP,OAAO,GACP,WAAW,GACX,qBAAqB,GAGrB,mBAAmB,GACnB,qBAAqB,GAErB,kBAAkB,GAClB,uBAAuB,CAAC;AAE5B,MAAM,WAAW,WAAW;IAC1B,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED,MAAM,MAAM,YAAY,CACtB,CAAC,SAAS,eAAe,EACzB,CAAC,IACC,OAAO,SAAS,WAAW,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC,CAAC"}
@@ -0,0 +1,4 @@
1
+ export * from "./custom-types";
2
+ export * from "./types";
3
+ export * from "./condition-types";
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,SAAS,CAAC;AACxB,cAAc,mBAAmB,CAAC"}
@@ -0,0 +1,12 @@
1
+ export type LeafEdge = "start" | "end";
2
+ export type MaximizeMode = RangeMode | "all";
3
+ export type MoveUnit = "offset" | "character" | "word" | "line";
4
+ export type RangeDirection = TextDirection | "outward" | "inward";
5
+ export type RangeMode = "highest" | "lowest";
6
+ export type SelectionEdge = "anchor" | "focus" | "start" | "end";
7
+ export type SelectionMode = "all" | "highest" | "lowest";
8
+ export type TextDirection = "forward" | "backward";
9
+ export type TextUnit = "character" | "word" | "line" | "block";
10
+ export type TextUnitAdjustment = TextUnit | "offset";
11
+ export type OmitFirstArg<F> = F extends (x: any, ...args: infer P) => infer R ? (...args: P) => R : never;
12
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,QAAQ,GAAG,OAAO,GAAG,KAAK,CAAC;AAEvC,MAAM,MAAM,YAAY,GAAG,SAAS,GAAG,KAAK,CAAC;AAE7C,MAAM,MAAM,QAAQ,GAAG,QAAQ,GAAG,WAAW,GAAG,MAAM,GAAG,MAAM,CAAC;AAEhE,MAAM,MAAM,cAAc,GAAG,aAAa,GAAG,SAAS,GAAG,QAAQ,CAAC;AAElE,MAAM,MAAM,SAAS,GAAG,SAAS,GAAG,QAAQ,CAAC;AAE7C,MAAM,MAAM,aAAa,GAAG,QAAQ,GAAG,OAAO,GAAG,OAAO,GAAG,KAAK,CAAC;AAEjE,MAAM,MAAM,aAAa,GAAG,KAAK,GAAG,SAAS,GAAG,QAAQ,CAAC;AAEzD,MAAM,MAAM,aAAa,GAAG,SAAS,GAAG,UAAU,CAAC;AAEnD,MAAM,MAAM,QAAQ,GAAG,WAAW,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;AAE/D,MAAM,MAAM,kBAAkB,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAErD,MAAM,MAAM,YAAY,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,EAAE,GAAG,EAAE,GAAG,IAAI,EAAE,MAAM,CAAC,KAAK,MAAM,CAAC,GACzE,CAAC,GAAG,IAAI,EAAE,CAAC,KAAK,CAAC,GACjB,KAAK,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare const generateUID: () => string;
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,WAAW,cAAiB,CAAC"}
@@ -0,0 +1,6 @@
1
+ import { v4 } from 'uuid';
2
+
3
+ const generateUID = () => v4();
4
+
5
+ export { generateUID };
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../../src/utils/index.ts"],"sourcesContent":[null],"names":["uuidV4"],"mappings":";;MAEa,WAAW,GAAG,MAAMA,EAAM;;;;"}
@@ -0,0 +1,9 @@
1
+ /*!
2
+ * is-plain-object <https://github.com/jonschlinkert/is-plain-object>
3
+ *
4
+ * Copyright (c) 2014-2017, Jon Schlinkert.
5
+ * Released under the MIT License.
6
+ */
7
+ declare function isPlainObject(o: any): boolean;
8
+ export { isPlainObject };
9
+ //# sourceMappingURL=is-plain-object.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"is-plain-object.d.ts","sourceRoot":"","sources":["../../src/utils/is-plain-object.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAMH,iBAAS,aAAa,CAAC,CAAC,EAAE,GAAG,GAAG,OAAO,CAqBtC;AAED,OAAO,EAAE,aAAa,EAAE,CAAC"}