@antv/infographic 0.2.11 → 0.2.12

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 (300) hide show
  1. package/dist/infographic.min.js +1 -1
  2. package/dist/infographic.min.js.map +1 -1
  3. package/esm/designs/components/Btn.js +15 -4
  4. package/esm/designs/components/BtnsGroup.js +1 -1
  5. package/esm/designs/components/Illus.js +15 -3
  6. package/esm/designs/components/ItemDesc.js +17 -11
  7. package/esm/designs/components/ItemIcon.js +17 -18
  8. package/esm/designs/components/ItemLabel.js +17 -11
  9. package/esm/designs/components/ItemValue.js +17 -12
  10. package/esm/designs/components/ItemsGroup.js +1 -1
  11. package/esm/designs/components/ShapesGroup.js +1 -1
  12. package/esm/designs/components/Title.js +2 -2
  13. package/esm/designs/decorations/simple-arrow.js +14 -2
  14. package/esm/designs/decorations/triangle.js +14 -2
  15. package/esm/designs/defs/DropShadow.js +13 -2
  16. package/esm/designs/defs/LinearGradient.js +1 -1
  17. package/esm/designs/items/BadgeCard.js +2 -2
  18. package/esm/designs/items/CandyCardLite.js +1 -1
  19. package/esm/designs/items/CapsuleItem.js +3 -3
  20. package/esm/designs/items/CircleNode.js +1 -1
  21. package/esm/designs/items/CircularProgress.js +3 -2
  22. package/esm/designs/items/CompactCard.js +1 -1
  23. package/esm/designs/items/DoneList.js +1 -1
  24. package/esm/designs/items/HorizontalIconArrow.js +2 -2
  25. package/esm/designs/items/HorizontalIconLine.js +2 -2
  26. package/esm/designs/items/IconBadge.js +4 -3
  27. package/esm/designs/items/IndexedCard.js +1 -1
  28. package/esm/designs/items/LCornerCard.js +1 -1
  29. package/esm/designs/items/LetterCard.js +4 -3
  30. package/esm/designs/items/LinedText.js +6 -5
  31. package/esm/designs/items/PillBadge.js +2 -2
  32. package/esm/designs/items/PlainText.js +4 -4
  33. package/esm/designs/items/ProgressCard.js +4 -4
  34. package/esm/designs/items/QuarterCircular.js +1 -1
  35. package/esm/designs/items/QuarterSimpleCard.js +1 -1
  36. package/esm/designs/items/RibbonCard.js +2 -2
  37. package/esm/designs/items/RoundedRectNode.js +2 -2
  38. package/esm/designs/items/SimpleCircleNode.js +1 -1
  39. package/esm/designs/items/SimpleHorizontalArrow.js +2 -2
  40. package/esm/designs/items/SimpleIllusItem.js +1 -1
  41. package/esm/designs/items/SimpleItem.js +3 -3
  42. package/esm/designs/items/SimpleVerticalArrow.js +2 -2
  43. package/esm/designs/items/UnderlineText.js +1 -1
  44. package/esm/designs/items/VerticalIconArrow.js +2 -2
  45. package/esm/designs/layouts/Align.js +22 -15
  46. package/esm/designs/layouts/Flex.js +23 -16
  47. package/esm/designs/structures/chart-bar.js +7 -5
  48. package/esm/designs/structures/chart-column.js +3 -2
  49. package/esm/designs/structures/chart-line.js +7 -5
  50. package/esm/designs/structures/chart-pie.js +4 -3
  51. package/esm/designs/structures/chart-wordcloud.js +5 -14
  52. package/esm/designs/structures/compare-binary-horizontal/dividers/pros-cons-arrow.js +1 -1
  53. package/esm/designs/structures/compare-binary-horizontal/dividers/pros-cons-fold.js +1 -1
  54. package/esm/designs/structures/compare-binary-horizontal/dividers/types.js +2 -1
  55. package/esm/designs/structures/compare-hierarchy-left-right.js +6 -5
  56. package/esm/designs/structures/compare-hierarchy-row.js +3 -2
  57. package/esm/designs/structures/compare-quadrant.js +2 -3
  58. package/esm/designs/structures/hierarchy-mindmap.js +19 -19
  59. package/esm/designs/structures/hierarchy-structure.js +1 -1
  60. package/esm/designs/structures/hierarchy-tree.js +15 -24
  61. package/esm/designs/structures/list-sector.js +5 -6
  62. package/esm/designs/structures/list-zigzag.js +2 -1
  63. package/esm/designs/structures/relation-dagre-flow.js +30 -35
  64. package/esm/designs/structures/relation-network.js +2 -2
  65. package/esm/designs/structures/sequence-funnel.js +1 -1
  66. package/esm/designs/structures/sequence-mountain.js +4 -4
  67. package/esm/designs/structures/sequence-pyramid.js +1 -1
  68. package/esm/designs/structures/sequence-zigzag-steps.js +2 -1
  69. package/esm/designs/utils/color.js +8 -4
  70. package/esm/designs/utils/item.js +3 -2
  71. package/esm/editor/commands/Batch.js +21 -8
  72. package/esm/editor/commands/UpdateElement.js +25 -22
  73. package/esm/editor/commands/UpdateOptions.js +23 -10
  74. package/esm/editor/commands/UpdateText.js +24 -11
  75. package/esm/editor/interactions/brush-select.js +27 -13
  76. package/esm/editor/interactions/click-select.js +13 -3
  77. package/esm/editor/interactions/dblclick-edit-text.js +36 -20
  78. package/esm/editor/interactions/drag-element.js +23 -9
  79. package/esm/editor/interactions/hotkey-history.js +17 -7
  80. package/esm/editor/interactions/select-highlight.js +5 -9
  81. package/esm/editor/interactions/zoom-wheel.js +2 -1
  82. package/esm/editor/managers/command.js +45 -27
  83. package/esm/editor/managers/interaction.js +46 -33
  84. package/esm/editor/managers/state.js +1 -1
  85. package/esm/editor/plugins/edit-bar/components/color-picker.js +9 -6
  86. package/esm/editor/plugins/edit-bar/components/popover.js +15 -12
  87. package/esm/editor/plugins/edit-bar/components/select.js +10 -8
  88. package/esm/editor/plugins/edit-bar/edit-bar.js +7 -25
  89. package/esm/editor/plugins/edit-bar/edit-items/align-elements.js +5 -3
  90. package/esm/editor/plugins/edit-bar/edit-items/font-align.js +1 -1
  91. package/esm/editor/plugins/edit-bar/edit-items/font-color.js +2 -2
  92. package/esm/editor/plugins/edit-bar/edit-items/icon-color.js +2 -2
  93. package/esm/editor/plugins/resize-element.js +6 -4
  94. package/esm/editor/utils/click-handler.js +6 -3
  95. package/esm/editor/utils/coordinate.js +2 -1
  96. package/esm/editor/utils/element.js +2 -1
  97. package/esm/editor/utils/event.js +2 -1
  98. package/esm/editor/utils/extension.js +1 -1
  99. package/esm/editor/utils/hotkey.js +2 -1
  100. package/esm/exporter/font.js +106 -90
  101. package/esm/exporter/png.js +49 -37
  102. package/esm/exporter/svg.js +55 -38
  103. package/esm/jsx/components/Ellipse.js +5 -4
  104. package/esm/jsx/components/Path.js +2 -4
  105. package/esm/jsx/components/Polygon.js +15 -6
  106. package/esm/jsx/components/Text.js +21 -41
  107. package/esm/jsx/renderer.js +15 -7
  108. package/esm/jsx/utils/bounds.js +18 -16
  109. package/esm/jsx/utils/children.js +2 -1
  110. package/esm/jsx/utils/clone.js +13 -2
  111. package/esm/jsx/utils/element.js +2 -1
  112. package/esm/options/parser.js +45 -46
  113. package/esm/renderer/composites/background.js +3 -2
  114. package/esm/renderer/composites/icon.js +14 -19
  115. package/esm/renderer/composites/illus.js +17 -22
  116. package/esm/renderer/composites/shape.js +4 -2
  117. package/esm/renderer/composites/svg.js +2 -1
  118. package/esm/renderer/composites/text.js +5 -3
  119. package/esm/renderer/fonts/loader.js +4 -3
  120. package/esm/renderer/fonts/registry.js +1 -1
  121. package/esm/renderer/palettes/utils.js +3 -2
  122. package/esm/renderer/renderer.js +7 -5
  123. package/esm/renderer/stylize/gradient.js +3 -2
  124. package/esm/renderer/stylize/pattern.js +15 -8
  125. package/esm/renderer/stylize/rough.js +1 -1
  126. package/esm/resource/load-tracker.js +22 -10
  127. package/esm/resource/loader.js +80 -67
  128. package/esm/resource/loaders/image.js +71 -59
  129. package/esm/resource/loaders/remote.js +26 -15
  130. package/esm/resource/loaders/search.js +38 -25
  131. package/esm/resource/utils/parser.js +2 -1
  132. package/esm/runtime/Infographic.js +26 -13
  133. package/esm/runtime/utils.js +5 -8
  134. package/esm/ssr/renderer.js +42 -35
  135. package/esm/syntax/index.js +19 -6
  136. package/esm/syntax/mapper.js +2 -2
  137. package/esm/templates/built-in.js +96 -200
  138. package/esm/templates/hierarchy-mindmap.js +1 -5
  139. package/esm/templates/hierarchy-tree.js +1 -5
  140. package/esm/templates/relation-dagre-flow.js +4 -28
  141. package/esm/themes/generator.js +8 -14
  142. package/esm/utils/fetch.js +48 -35
  143. package/esm/utils/icon.js +1 -4
  144. package/esm/utils/is-browser.js +2 -2
  145. package/esm/utils/measure-text.js +2 -1
  146. package/esm/utils/padding.js +1 -1
  147. package/esm/utils/recognizer.js +2 -1
  148. package/esm/utils/text.js +14 -3
  149. package/esm/version.d.ts +1 -1
  150. package/esm/version.js +1 -1
  151. package/lib/designs/components/Btn.js +15 -4
  152. package/lib/designs/components/BtnsGroup.js +1 -1
  153. package/lib/designs/components/Illus.js +15 -3
  154. package/lib/designs/components/ItemDesc.js +17 -11
  155. package/lib/designs/components/ItemIcon.js +17 -18
  156. package/lib/designs/components/ItemLabel.js +17 -11
  157. package/lib/designs/components/ItemValue.js +17 -12
  158. package/lib/designs/components/ItemsGroup.js +1 -1
  159. package/lib/designs/components/ShapesGroup.js +1 -1
  160. package/lib/designs/components/Title.js +2 -2
  161. package/lib/designs/decorations/simple-arrow.js +14 -2
  162. package/lib/designs/decorations/triangle.js +14 -2
  163. package/lib/designs/defs/DropShadow.js +13 -2
  164. package/lib/designs/defs/LinearGradient.js +1 -1
  165. package/lib/designs/items/BadgeCard.js +2 -2
  166. package/lib/designs/items/CandyCardLite.js +1 -1
  167. package/lib/designs/items/CapsuleItem.js +3 -3
  168. package/lib/designs/items/CircleNode.js +1 -1
  169. package/lib/designs/items/CircularProgress.js +3 -2
  170. package/lib/designs/items/CompactCard.js +1 -1
  171. package/lib/designs/items/DoneList.js +1 -1
  172. package/lib/designs/items/HorizontalIconArrow.js +2 -2
  173. package/lib/designs/items/HorizontalIconLine.js +2 -2
  174. package/lib/designs/items/IconBadge.js +4 -3
  175. package/lib/designs/items/IndexedCard.js +1 -1
  176. package/lib/designs/items/LCornerCard.js +1 -1
  177. package/lib/designs/items/LetterCard.js +4 -3
  178. package/lib/designs/items/LinedText.js +6 -5
  179. package/lib/designs/items/PillBadge.js +2 -2
  180. package/lib/designs/items/PlainText.js +4 -4
  181. package/lib/designs/items/ProgressCard.js +4 -4
  182. package/lib/designs/items/QuarterCircular.js +1 -1
  183. package/lib/designs/items/QuarterSimpleCard.js +1 -1
  184. package/lib/designs/items/RibbonCard.js +2 -2
  185. package/lib/designs/items/RoundedRectNode.js +2 -2
  186. package/lib/designs/items/SimpleCircleNode.js +1 -1
  187. package/lib/designs/items/SimpleHorizontalArrow.js +2 -2
  188. package/lib/designs/items/SimpleIllusItem.js +1 -1
  189. package/lib/designs/items/SimpleItem.js +3 -3
  190. package/lib/designs/items/SimpleVerticalArrow.js +2 -2
  191. package/lib/designs/items/UnderlineText.js +1 -1
  192. package/lib/designs/items/VerticalIconArrow.js +2 -2
  193. package/lib/designs/layouts/Align.js +22 -15
  194. package/lib/designs/layouts/Flex.js +23 -16
  195. package/lib/designs/structures/chart-bar.js +7 -5
  196. package/lib/designs/structures/chart-column.js +3 -2
  197. package/lib/designs/structures/chart-line.js +7 -5
  198. package/lib/designs/structures/chart-pie.js +4 -3
  199. package/lib/designs/structures/chart-wordcloud.js +5 -14
  200. package/lib/designs/structures/compare-binary-horizontal/dividers/pros-cons-arrow.js +1 -1
  201. package/lib/designs/structures/compare-binary-horizontal/dividers/pros-cons-fold.js +1 -1
  202. package/lib/designs/structures/compare-binary-horizontal/dividers/types.js +2 -1
  203. package/lib/designs/structures/compare-hierarchy-left-right.js +6 -5
  204. package/lib/designs/structures/compare-hierarchy-row.js +3 -2
  205. package/lib/designs/structures/compare-quadrant.js +2 -3
  206. package/lib/designs/structures/hierarchy-mindmap.js +19 -19
  207. package/lib/designs/structures/hierarchy-structure.js +1 -1
  208. package/lib/designs/structures/hierarchy-tree.js +15 -24
  209. package/lib/designs/structures/list-sector.js +5 -6
  210. package/lib/designs/structures/list-zigzag.js +2 -1
  211. package/lib/designs/structures/relation-dagre-flow.js +30 -35
  212. package/lib/designs/structures/relation-network.js +2 -2
  213. package/lib/designs/structures/sequence-funnel.js +1 -1
  214. package/lib/designs/structures/sequence-mountain.js +4 -4
  215. package/lib/designs/structures/sequence-pyramid.js +1 -1
  216. package/lib/designs/structures/sequence-zigzag-steps.js +2 -1
  217. package/lib/designs/utils/color.js +8 -4
  218. package/lib/designs/utils/item.js +3 -2
  219. package/lib/editor/commands/Batch.js +21 -8
  220. package/lib/editor/commands/UpdateElement.js +25 -22
  221. package/lib/editor/commands/UpdateOptions.js +23 -10
  222. package/lib/editor/commands/UpdateText.js +24 -11
  223. package/lib/editor/interactions/brush-select.js +27 -13
  224. package/lib/editor/interactions/click-select.js +13 -3
  225. package/lib/editor/interactions/dblclick-edit-text.js +36 -20
  226. package/lib/editor/interactions/drag-element.js +23 -9
  227. package/lib/editor/interactions/hotkey-history.js +17 -7
  228. package/lib/editor/interactions/select-highlight.js +5 -9
  229. package/lib/editor/interactions/zoom-wheel.js +2 -1
  230. package/lib/editor/managers/command.js +43 -25
  231. package/lib/editor/managers/interaction.js +46 -33
  232. package/lib/editor/managers/state.js +1 -1
  233. package/lib/editor/plugins/edit-bar/components/color-picker.js +9 -6
  234. package/lib/editor/plugins/edit-bar/components/popover.js +15 -12
  235. package/lib/editor/plugins/edit-bar/components/select.js +10 -8
  236. package/lib/editor/plugins/edit-bar/edit-bar.js +7 -25
  237. package/lib/editor/plugins/edit-bar/edit-items/align-elements.js +5 -3
  238. package/lib/editor/plugins/edit-bar/edit-items/font-align.js +1 -1
  239. package/lib/editor/plugins/edit-bar/edit-items/font-color.js +2 -2
  240. package/lib/editor/plugins/edit-bar/edit-items/icon-color.js +2 -2
  241. package/lib/editor/plugins/resize-element.js +6 -4
  242. package/lib/editor/utils/click-handler.js +6 -3
  243. package/lib/editor/utils/coordinate.js +2 -1
  244. package/lib/editor/utils/element.js +2 -1
  245. package/lib/editor/utils/event.js +2 -1
  246. package/lib/editor/utils/extension.js +1 -1
  247. package/lib/editor/utils/hotkey.js +2 -1
  248. package/lib/exporter/font.js +106 -90
  249. package/lib/exporter/png.js +49 -37
  250. package/lib/exporter/svg.js +55 -38
  251. package/lib/jsx/components/Ellipse.js +5 -4
  252. package/lib/jsx/components/Path.js +2 -4
  253. package/lib/jsx/components/Polygon.js +15 -6
  254. package/lib/jsx/components/Text.js +21 -41
  255. package/lib/jsx/renderer.js +15 -7
  256. package/lib/jsx/utils/bounds.js +18 -16
  257. package/lib/jsx/utils/children.js +2 -1
  258. package/lib/jsx/utils/clone.js +13 -2
  259. package/lib/jsx/utils/element.js +2 -1
  260. package/lib/options/parser.js +45 -46
  261. package/lib/renderer/composites/background.js +3 -2
  262. package/lib/renderer/composites/icon.js +14 -19
  263. package/lib/renderer/composites/illus.js +17 -22
  264. package/lib/renderer/composites/shape.js +4 -2
  265. package/lib/renderer/composites/svg.js +2 -1
  266. package/lib/renderer/composites/text.js +5 -3
  267. package/lib/renderer/fonts/loader.js +4 -3
  268. package/lib/renderer/fonts/registry.js +1 -1
  269. package/lib/renderer/palettes/utils.js +3 -2
  270. package/lib/renderer/renderer.js +7 -5
  271. package/lib/renderer/stylize/gradient.js +3 -2
  272. package/lib/renderer/stylize/pattern.js +15 -8
  273. package/lib/renderer/stylize/rough.js +1 -1
  274. package/lib/resource/load-tracker.js +22 -10
  275. package/lib/resource/loader.js +80 -67
  276. package/lib/resource/loaders/image.js +71 -59
  277. package/lib/resource/loaders/remote.js +26 -15
  278. package/lib/resource/loaders/search.js +38 -25
  279. package/lib/resource/utils/parser.js +2 -1
  280. package/lib/runtime/Infographic.js +26 -13
  281. package/lib/runtime/utils.js +5 -8
  282. package/lib/ssr/renderer.js +42 -35
  283. package/lib/syntax/index.js +19 -6
  284. package/lib/syntax/mapper.js +2 -2
  285. package/lib/templates/built-in.js +96 -200
  286. package/lib/templates/hierarchy-mindmap.js +1 -5
  287. package/lib/templates/hierarchy-tree.js +1 -5
  288. package/lib/templates/relation-dagre-flow.js +4 -28
  289. package/lib/themes/generator.js +8 -14
  290. package/lib/utils/fetch.js +48 -35
  291. package/lib/utils/icon.js +1 -4
  292. package/lib/utils/is-browser.js +2 -2
  293. package/lib/utils/measure-text.js +2 -1
  294. package/lib/utils/padding.js +1 -1
  295. package/lib/utils/recognizer.js +2 -1
  296. package/lib/utils/text.js +14 -3
  297. package/lib/version.d.ts +1 -1
  298. package/lib/version.js +1 -1
  299. package/package.json +1 -1
  300. package/src/version.ts +1 -1
@@ -1,3 +1,12 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
1
10
  import { getCombinedBounds } from '../../jsx/utils/bounds.js';
2
11
  import { createElement, getAttributes, isEditableText, isEditingText, setAttributes, } from '../../utils/index.js';
3
12
  import { UpdateElementCommand } from '../commands/index.js';
@@ -114,9 +123,11 @@ export class DragElement extends Interaction {
114
123
  if (this.dragItems.length === 0)
115
124
  return false;
116
125
  let started = false;
117
- this.interaction.executeExclusiveInteraction(this, async () => new Promise((resolve) => {
118
- this.completeInteraction = resolve;
119
- started = true;
126
+ this.interaction.executeExclusiveInteraction(this, () => __awaiter(this, void 0, void 0, function* () {
127
+ return new Promise((resolve) => {
128
+ this.completeInteraction = resolve;
129
+ started = true;
130
+ });
120
131
  }));
121
132
  this.exclusiveStarted = started;
122
133
  return started;
@@ -252,7 +263,8 @@ export class DragElement extends Interaction {
252
263
  return rest && rest.length ? `${translate} ${rest}` : translate;
253
264
  }
254
265
  emitGeometryChange() {
255
- const target = this.dragItems[0]?.element;
266
+ var _a;
267
+ const target = (_a = this.dragItems[0]) === null || _a === void 0 ? void 0 : _a.element;
256
268
  if (!target)
257
269
  return;
258
270
  const rect = getElementViewportBounds(this.editor.getDocument(), target);
@@ -268,6 +280,7 @@ export class DragElement extends Interaction {
268
280
  window.removeEventListener('pointercancel', this.handleEnd);
269
281
  }
270
282
  reset() {
283
+ var _a;
271
284
  this.detachPointerListeners();
272
285
  this.clearGuides();
273
286
  this.pointerId = undefined;
@@ -280,7 +293,7 @@ export class DragElement extends Interaction {
280
293
  this.dragging = false;
281
294
  this.startBounds = undefined;
282
295
  this.guideCandidates = undefined;
283
- this.completeInteraction?.();
296
+ (_a = this.completeInteraction) === null || _a === void 0 ? void 0 : _a.call(this);
284
297
  this.completeInteraction = undefined;
285
298
  }
286
299
  getSelectionBounds(selection) {
@@ -315,8 +328,8 @@ export class DragElement extends Interaction {
315
328
  const snapX = this.getSnapOffset([moving.x, moving.x + moving.width / 2, moving.x + moving.width], this.guideCandidates.vertical);
316
329
  const snapY = this.getSnapOffset([moving.y, moving.y + moving.height / 2, moving.y + moving.height], this.guideCandidates.horizontal);
317
330
  return {
318
- dx: dx + (snapX?.offset || 0),
319
- dy: dy + (snapY?.offset || 0),
331
+ dx: dx + ((snapX === null || snapX === void 0 ? void 0 : snapX.offset) || 0),
332
+ dy: dy + ((snapY === null || snapY === void 0 ? void 0 : snapY.offset) || 0),
320
333
  snapX,
321
334
  snapY,
322
335
  };
@@ -383,8 +396,9 @@ export class DragElement extends Interaction {
383
396
  }
384
397
  }
385
398
  clearGuides() {
386
- this.guideVertical?.remove();
387
- this.guideHorizontal?.remove();
399
+ var _a, _b;
400
+ (_a = this.guideVertical) === null || _a === void 0 ? void 0 : _a.remove();
401
+ (_b = this.guideHorizontal) === null || _b === void 0 ? void 0 : _b.remove();
388
402
  this.guideVertical = undefined;
389
403
  this.guideHorizontal = undefined;
390
404
  }
@@ -1,17 +1,26 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
1
10
  import { Hotkey } from '../utils/index.js';
2
11
  import { Interaction } from './base.js';
3
12
  export class HotkeyHistory extends Interaction {
4
13
  constructor() {
5
14
  super(...arguments);
6
15
  this.name = 'hotkey-history';
7
- this.handleUndo = async (event) => {
16
+ this.handleUndo = (event) => __awaiter(this, void 0, void 0, function* () {
8
17
  event.preventDefault();
9
- await this.commander.undo();
10
- };
11
- this.handleRedo = async (event) => {
18
+ yield this.commander.undo();
19
+ });
20
+ this.handleRedo = (event) => __awaiter(this, void 0, void 0, function* () {
12
21
  event.preventDefault();
13
- await this.commander.redo();
14
- };
22
+ yield this.commander.redo();
23
+ });
15
24
  }
16
25
  init(options) {
17
26
  super.init(options);
@@ -22,6 +31,7 @@ export class HotkeyHistory extends Interaction {
22
31
  this.hotkey.bind(['mod+shift+z', 'mod+y'], this.handleRedo);
23
32
  }
24
33
  destroy() {
25
- this.hotkey?.destroy();
34
+ var _a;
35
+ (_a = this.hotkey) === null || _a === void 0 ? void 0 : _a.destroy();
26
36
  }
27
37
  }
@@ -70,19 +70,14 @@ export class SelectHighlight extends Interaction {
70
70
  this.highlightMasks = this.highlightMasks.slice(0, selection.length);
71
71
  }
72
72
  drawCombinedBoundsMask(selection) {
73
+ var _a;
73
74
  if (selection.length < 2) {
74
- this.combinedBoundsMask?.remove();
75
+ (_a = this.combinedBoundsMask) === null || _a === void 0 ? void 0 : _a.remove();
75
76
  this.combinedBoundsMask = undefined;
76
77
  return;
77
78
  }
78
79
  const bounds = getCombinedBounds(selection.map((element) => getElementViewportBounds(this.editor.getDocument(), element)));
79
- const attrs = {
80
- ...bounds,
81
- fill: 'none',
82
- stroke: '#3384F5',
83
- 'stroke-width': 2,
84
- 'pointer-events': 'none',
85
- };
80
+ const attrs = Object.assign(Object.assign({}, bounds), { fill: 'none', stroke: '#3384F5', 'stroke-width': 2, 'pointer-events': 'none' });
86
81
  if (this.combinedBoundsMask) {
87
82
  setAttributes(this.combinedBoundsMask, attrs);
88
83
  }
@@ -91,9 +86,10 @@ export class SelectHighlight extends Interaction {
91
86
  }
92
87
  }
93
88
  clearMasks() {
89
+ var _a;
94
90
  this.highlightMasks.forEach((mask) => mask.remove());
95
91
  this.highlightMasks = [];
96
- this.combinedBoundsMask?.remove();
92
+ (_a = this.combinedBoundsMask) === null || _a === void 0 ? void 0 : _a.remove();
97
93
  this.combinedBoundsMask = undefined;
98
94
  }
99
95
  }
@@ -10,6 +10,7 @@ export class ZoomWheel extends Interaction {
10
10
  super(...arguments);
11
11
  this.name = 'zoom-wheel';
12
12
  this.wheelListener = (event) => {
13
+ var _a;
13
14
  if (!this.interaction.isActive())
14
15
  return;
15
16
  if (!event.ctrlKey && !event.metaKey)
@@ -17,7 +18,7 @@ export class ZoomWheel extends Interaction {
17
18
  event.preventDefault();
18
19
  const factor = event.deltaY > 0 ? 1.1 : 0.9;
19
20
  const current = this.state.getOptions();
20
- const currentPadding = current.padding ?? 0;
21
+ const currentPadding = (_a = current.padding) !== null && _a !== void 0 ? _a : 0;
21
22
  const parsed = parsePadding(currentPadding);
22
23
  const svg = this.editor.getDocument();
23
24
  const bbox = svg.getBBox();
@@ -1,3 +1,12 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
1
10
  import { BatchCommand } from '../commands/index.js';
2
11
  export class CommandManager {
3
12
  constructor() {
@@ -7,33 +16,41 @@ export class CommandManager {
7
16
  init(options) {
8
17
  Object.assign(this, options);
9
18
  }
10
- async execute(command) {
11
- await command.apply(this.state);
12
- this.undoStack.push(command);
13
- this.redoStack = [];
14
- this.emitHistoryChange('execute');
15
- }
16
- async executeBatch(commands) {
17
- if (commands.length === 0)
18
- return;
19
- const batchCommand = new BatchCommand(commands);
20
- await this.execute(batchCommand);
21
- }
22
- async undo() {
23
- const command = this.undoStack.pop();
24
- if (command) {
25
- await command.undo(this.state);
26
- this.redoStack.push(command);
27
- this.emitHistoryChange('undo');
28
- }
29
- }
30
- async redo() {
31
- const command = this.redoStack.pop();
32
- if (command) {
33
- await command.apply(this.state);
19
+ execute(command) {
20
+ return __awaiter(this, void 0, void 0, function* () {
21
+ yield command.apply(this.state);
34
22
  this.undoStack.push(command);
35
- this.emitHistoryChange('redo');
36
- }
23
+ this.redoStack = [];
24
+ this.emitHistoryChange('execute');
25
+ });
26
+ }
27
+ executeBatch(commands) {
28
+ return __awaiter(this, void 0, void 0, function* () {
29
+ if (commands.length === 0)
30
+ return;
31
+ const batchCommand = new BatchCommand(commands);
32
+ yield this.execute(batchCommand);
33
+ });
34
+ }
35
+ undo() {
36
+ return __awaiter(this, void 0, void 0, function* () {
37
+ const command = this.undoStack.pop();
38
+ if (command) {
39
+ yield command.undo(this.state);
40
+ this.redoStack.push(command);
41
+ this.emitHistoryChange('undo');
42
+ }
43
+ });
44
+ }
45
+ redo() {
46
+ return __awaiter(this, void 0, void 0, function* () {
47
+ const command = this.redoStack.pop();
48
+ if (command) {
49
+ yield command.apply(this.state);
50
+ this.undoStack.push(command);
51
+ this.emitHistoryChange('redo');
52
+ }
53
+ });
37
54
  }
38
55
  serialize() {
39
56
  return this.undoStack.map((cmd) => cmd.serialize());
@@ -55,7 +72,8 @@ export class CommandManager {
55
72
  this.clear();
56
73
  }
57
74
  emitHistoryChange(action) {
58
- this.emitter?.emit('history:change', {
75
+ var _a;
76
+ (_a = this.emitter) === null || _a === void 0 ? void 0 : _a.emit('history:change', {
59
77
  type: 'history:change',
60
78
  action,
61
79
  });
@@ -1,3 +1,12 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
1
10
  import { createElement, getElementByRole, isInfographicComponent, setElementRole, } from '../../utils/index.js';
2
11
  import { Extension } from '../utils/index.js';
3
12
  export class InteractionManager {
@@ -127,43 +136,47 @@ export class InteractionManager {
127
136
  /**
128
137
  * 执行互斥交互操作(同一时间只能有一个互斥交互在进行)
129
138
  */
130
- async executeExclusiveInteraction(instance, callback) {
131
- // 如果未激活或已有互斥交互在运行,则拒绝执行
132
- if (!this.active || this.running)
133
- return;
134
- this.running = instance;
135
- try {
136
- this.emitter.emit('interaction:started', instance);
137
- await callback();
138
- this.emitter.emit('interaction:ended', instance);
139
- }
140
- catch (error) {
141
- console.error(`Error occurred during exclusive interaction "${instance.name}":`, error);
142
- this.emitter.emit('interaction:error', instance, error);
143
- }
144
- finally {
145
- this.running = null;
146
- }
139
+ executeExclusiveInteraction(instance, callback) {
140
+ return __awaiter(this, void 0, void 0, function* () {
141
+ // 如果未激活或已有互斥交互在运行,则拒绝执行
142
+ if (!this.active || this.running)
143
+ return;
144
+ this.running = instance;
145
+ try {
146
+ this.emitter.emit('interaction:started', instance);
147
+ yield callback();
148
+ this.emitter.emit('interaction:ended', instance);
149
+ }
150
+ catch (error) {
151
+ console.error(`Error occurred during exclusive interaction "${instance.name}":`, error);
152
+ this.emitter.emit('interaction:error', instance, error);
153
+ }
154
+ finally {
155
+ this.running = null;
156
+ }
157
+ });
147
158
  }
148
159
  /**
149
160
  * 执行协同交互操作(允许多个协同交互同时进行)
150
161
  */
151
- async executeConcurrentInteraction(instance, callback) {
152
- if (!this.active)
153
- return;
154
- this.concurrentInteractions.add(instance);
155
- try {
156
- this.emitter.emit('interaction:started', instance);
157
- await callback();
158
- this.emitter.emit('interaction:ended', instance);
159
- }
160
- catch (error) {
161
- console.error(`Error occurred during concurrent interaction "${instance.name}":`, error);
162
- this.emitter.emit('interaction:error', instance, error);
163
- }
164
- finally {
165
- this.concurrentInteractions.delete(instance);
166
- }
162
+ executeConcurrentInteraction(instance, callback) {
163
+ return __awaiter(this, void 0, void 0, function* () {
164
+ if (!this.active)
165
+ return;
166
+ this.concurrentInteractions.add(instance);
167
+ try {
168
+ this.emitter.emit('interaction:started', instance);
169
+ yield callback();
170
+ this.emitter.emit('interaction:ended', instance);
171
+ }
172
+ catch (error) {
173
+ console.error(`Error occurred during concurrent interaction "${instance.name}":`, error);
174
+ this.emitter.emit('interaction:error', instance, error);
175
+ }
176
+ finally {
177
+ this.concurrentInteractions.delete(instance);
178
+ }
179
+ });
167
180
  }
168
181
  getOrCreateTransientContainer() {
169
182
  const role = 'transient-container';
@@ -75,7 +75,7 @@ export class StateManager {
75
75
  this.updateBuiltInElement(element, props);
76
76
  }
77
77
  updateOptions(options) {
78
- this.options = { ...this.options, ...options };
78
+ this.options = Object.assign(Object.assign({}, this.options), options);
79
79
  if (this.options.padding !== undefined) {
80
80
  setSVGPadding(this.editor.getDocument(), parsePadding(this.options.padding));
81
81
  }
@@ -42,6 +42,7 @@ const DEFAULT_SWATCHES = [
42
42
  'rgba(255, 255, 255, 0.85)',
43
43
  ];
44
44
  export function ColorPicker(props) {
45
+ var _a, _b, _c;
45
46
  if (typeof document === 'undefined') {
46
47
  throw new Error('ColorPicker can only be used in the browser.');
47
48
  }
@@ -72,15 +73,14 @@ export function ColorPicker(props) {
72
73
  formatSwitch.appendChild(createSwitchLabel('RGBA'));
73
74
  formatToggle.appendChild(formatSwitch);
74
75
  let format = 'hexa';
75
- let color = parseColor(props.value) ??
76
- parseColor(DEFAULT_COLOR) ?? {
76
+ let color = (_b = (_a = parseColor(props.value)) !== null && _a !== void 0 ? _a : parseColor(DEFAULT_COLOR)) !== null && _b !== void 0 ? _b : {
77
77
  r: 31,
78
78
  g: 31,
79
79
  b: 31,
80
80
  a: 1,
81
81
  };
82
82
  const swatchButtons = [];
83
- const swatches = props.swatches?.length ? props.swatches : DEFAULT_SWATCHES;
83
+ const swatches = ((_c = props.swatches) === null || _c === void 0 ? void 0 : _c.length) ? props.swatches : DEFAULT_SWATCHES;
84
84
  swatches.forEach((value) => {
85
85
  const parsed = parseColor(value);
86
86
  if (!parsed)
@@ -128,15 +128,17 @@ export function ColorPicker(props) {
128
128
  setColor(parsed);
129
129
  }
130
130
  function setFormat(next, emitChange) {
131
+ var _a;
131
132
  if (format === next)
132
133
  return;
133
134
  format = next;
134
135
  syncUI();
135
136
  if (emitChange) {
136
- props.onChange?.(formatColor(color, format));
137
+ (_a = props.onChange) === null || _a === void 0 ? void 0 : _a.call(props, formatColor(color, format));
137
138
  }
138
139
  }
139
140
  function setColor(next, emitChange = true) {
141
+ var _a;
140
142
  if (isSameColor(color, next)) {
141
143
  syncUI();
142
144
  return;
@@ -144,7 +146,7 @@ export function ColorPicker(props) {
144
146
  color = next;
145
147
  syncUI();
146
148
  if (emitChange) {
147
- props.onChange?.(formatColor(color, format));
149
+ (_a = props.onChange) === null || _a === void 0 ? void 0 : _a.call(props, formatColor(color, format));
148
150
  }
149
151
  }
150
152
  function syncUI() {
@@ -173,6 +175,7 @@ export function ColorPicker(props) {
173
175
  }
174
176
  }
175
177
  function parseColor(value) {
178
+ var _a;
176
179
  if (!value)
177
180
  return undefined;
178
181
  const parsed = parse(value);
@@ -183,7 +186,7 @@ function parseColor(value) {
183
186
  r: clampByte(rgb.r),
184
187
  g: clampByte(rgb.g),
185
188
  b: clampByte(rgb.b),
186
- a: clamp01(rgb.alpha ?? 1),
189
+ a: clamp01((_a = rgb.alpha) !== null && _a !== void 0 ? _a : 1),
187
190
  };
188
191
  }
189
192
  function formatColor(color, format) {
@@ -5,29 +5,30 @@ const POPOVER_CONTENT_CLASS = `${POPOVER_CLASS}__content`;
5
5
  const POPOVER_ARROW_CLASS = `${POPOVER_CLASS}__arrow`;
6
6
  const POPOVER_STYLE_ID = 'infographic-edit-popover-style';
7
7
  export function Popover(props) {
8
+ var _a, _b, _c, _d, _e, _f, _g, _h;
8
9
  ensurePopoverStyle();
9
- const placement = props.placement ?? 'top';
10
- const closeOnOutsideClick = props.closeOnOutsideClick ?? true;
10
+ const placement = (_a = props.placement) !== null && _a !== void 0 ? _a : 'top';
11
+ const closeOnOutsideClick = (_b = props.closeOnOutsideClick) !== null && _b !== void 0 ? _b : true;
11
12
  const triggerActions = Array.isArray(props.trigger)
12
13
  ? props.trigger
13
14
  : [props.trigger || 'hover'];
14
- const hoverOpenDelay = props.mouseEnterDelay ?? 50;
15
- const hoverCloseDelay = props.mouseLeaveDelay ?? 150;
16
- const offset = props.offset ?? 8;
15
+ const hoverOpenDelay = (_c = props.mouseEnterDelay) !== null && _c !== void 0 ? _c : 50;
16
+ const hoverCloseDelay = (_d = props.mouseLeaveDelay) !== null && _d !== void 0 ? _d : 150;
17
+ const offset = (_e = props.offset) !== null && _e !== void 0 ? _e : 8;
17
18
  const arrowSize = 8;
18
19
  const arrowInnerSize = 7;
19
20
  const bodyPadding = typeof props.padding === 'number'
20
21
  ? `${props.padding}px`
21
- : (props.padding ?? '4px');
22
+ : ((_f = props.padding) !== null && _f !== void 0 ? _f : '4px');
22
23
  const container = document.createElement('div');
23
24
  container.classList.add(POPOVER_CLASS);
24
- const trigger = props.target ?? document.createElement('div');
25
+ const trigger = (_g = props.target) !== null && _g !== void 0 ? _g : document.createElement('div');
25
26
  container.appendChild(trigger);
26
27
  const getContentContainer = () => {
27
28
  const next = typeof props.getContainer === 'function'
28
29
  ? props.getContainer()
29
30
  : props.getContainer;
30
- return next ?? document.body;
31
+ return next !== null && next !== void 0 ? next : document.body;
31
32
  };
32
33
  const content = document.createElement('div');
33
34
  content.classList.add(POPOVER_CONTENT_CLASS);
@@ -51,8 +52,9 @@ export function Popover(props) {
51
52
  contentContainer.appendChild(content);
52
53
  let open = Boolean(props.open);
53
54
  let placementPriority = Array.isArray(placement) ? placement : [placement];
54
- let currentPlacement = placementPriority[0] ?? 'top';
55
+ let currentPlacement = (_h = placementPriority[0]) !== null && _h !== void 0 ? _h : 'top';
55
56
  const updatePosition = () => {
57
+ var _a;
56
58
  const targetRect = trigger.getBoundingClientRect();
57
59
  const contentRect = content.getBoundingClientRect();
58
60
  const scrollX = window.scrollX || document.documentElement.scrollLeft;
@@ -102,7 +104,7 @@ export function Popover(props) {
102
104
  nextTop >= scrollY &&
103
105
  nextLeft + contentRect.width <= scrollX + viewportWidth &&
104
106
  nextTop + contentRect.height <= scrollY + viewportHeight;
105
- let chosenPlacement = placementPriority[0] ?? 'top';
107
+ let chosenPlacement = (_a = placementPriority[0]) !== null && _a !== void 0 ? _a : 'top';
106
108
  let position = calcPosition(chosenPlacement);
107
109
  for (const candidate of placementPriority) {
108
110
  const nextPosition = calcPosition(candidate);
@@ -138,13 +140,14 @@ export function Popover(props) {
138
140
  body.appendChild(nextContent);
139
141
  }
140
142
  else {
141
- body.textContent = nextContent ?? '';
143
+ body.textContent = nextContent !== null && nextContent !== void 0 ? nextContent : '';
142
144
  }
143
145
  updatePosition();
144
146
  };
145
147
  const setPlacement = (next) => {
148
+ var _a;
146
149
  placementPriority = Array.isArray(next) ? next : [next];
147
- currentPlacement = placementPriority[0] ?? 'top';
150
+ currentPlacement = (_a = placementPriority[0]) !== null && _a !== void 0 ? _a : 'top';
148
151
  updatePosition();
149
152
  };
150
153
  const setOpen = (value) => {
@@ -35,8 +35,9 @@ export function Select(props) {
35
35
  }
36
36
  };
37
37
  const renderLabel = () => {
38
+ var _a, _b, _c;
38
39
  const option = options.find((opt) => opt.value === selected);
39
- const custom = props.renderLabel?.(option);
40
+ const custom = (_a = props.renderLabel) === null || _a === void 0 ? void 0 : _a.call(props, option);
40
41
  if (typeof custom === 'string') {
41
42
  label.textContent = custom;
42
43
  }
@@ -45,10 +46,10 @@ export function Select(props) {
45
46
  }
46
47
  else if (custom === null || custom === undefined) {
47
48
  if (option) {
48
- label.textContent = option.label ?? option.value;
49
+ label.textContent = (_b = option.label) !== null && _b !== void 0 ? _b : option.value;
49
50
  }
50
51
  else {
51
- label.textContent = props.placeholder ?? '请选择';
52
+ label.textContent = (_c = props.placeholder) !== null && _c !== void 0 ? _c : '请选择';
52
53
  }
53
54
  }
54
55
  else {
@@ -58,9 +59,8 @@ export function Select(props) {
58
59
  const renderOptions = () => {
59
60
  dropdown.innerHTML = '';
60
61
  options.forEach((option) => {
61
- const optionNode = props.renderOption?.(option) ??
62
- option.render?.() ??
63
- defaultOptionNode(option);
62
+ var _a, _b, _c, _d;
63
+ const optionNode = (_d = (_b = (_a = props.renderOption) === null || _a === void 0 ? void 0 : _a.call(props, option)) !== null && _b !== void 0 ? _b : (_c = option.render) === null || _c === void 0 ? void 0 : _c.call(option)) !== null && _d !== void 0 ? _d : defaultOptionNode(option);
64
64
  optionNode.classList.add(OPTION_CLASS);
65
65
  optionNode.setAttribute('data-value', option.value);
66
66
  if (option.disabled) {
@@ -76,9 +76,10 @@ export function Select(props) {
76
76
  });
77
77
  };
78
78
  const selectValue = (value, option) => {
79
+ var _a;
79
80
  selected = value;
80
81
  renderLabel();
81
- props.onChange?.(value, option);
82
+ (_a = props.onChange) === null || _a === void 0 ? void 0 : _a.call(props, value, option);
82
83
  setOpen(false);
83
84
  };
84
85
  const setOpen = (value) => {
@@ -195,7 +196,8 @@ function ensureSelectStyle() {
195
196
  `);
196
197
  }
197
198
  function defaultOptionNode(option) {
199
+ var _a;
198
200
  const node = document.createElement('div');
199
- node.textContent = option.label ?? option.value;
201
+ node.textContent = (_a = option.label) !== null && _a !== void 0 ? _a : option.value;
200
202
  return node;
201
203
  }
@@ -47,11 +47,12 @@ export class EditBar extends Plugin {
47
47
  emitter.on('history:change', this.handleHistoryChanged);
48
48
  }
49
49
  destroy() {
50
+ var _a;
50
51
  const { emitter } = this;
51
52
  emitter.off('selection:change', this.handleSelectionChanged);
52
53
  emitter.off('selection:geometrychange', this.handleGeometryChanged);
53
54
  emitter.off('history:change', this.handleHistoryChanged);
54
- this.container?.remove();
55
+ (_a = this.container) === null || _a === void 0 ? void 0 : _a.remove();
55
56
  }
56
57
  getEditItems(selection) {
57
58
  let hasText = false;
@@ -102,26 +103,7 @@ export class EditBar extends Plugin {
102
103
  return this.container;
103
104
  const { style, className } = this.options || {};
104
105
  const container = document.createElement('div');
105
- Object.assign(container.style, {
106
- visibility: 'hidden',
107
- position: 'absolute',
108
- left: '0',
109
- top: '0',
110
- display: 'flex',
111
- flexFlow: 'row',
112
- justifyContent: 'center',
113
- alignItems: 'center',
114
- height: '40px',
115
- minWidth: '40px',
116
- minHeight: '40px',
117
- borderRadius: '8px',
118
- padding: '0 4px',
119
- backgroundColor: '#fff',
120
- border: '1px solid rgba(239, 240, 240, 0.9)',
121
- zIndex: '9999',
122
- boxShadow: 'rgba(0, 0, 0, 0.08) 0px 1px 2px -2px, rgba(0, 0, 0, 0.04) 0px 2px 6px, rgba(0, 0, 0, 0.02) 0px 4px 8px 1px',
123
- ...style,
124
- });
106
+ Object.assign(container.style, Object.assign({ visibility: 'hidden', position: 'absolute', left: '0', top: '0', display: 'flex', flexFlow: 'row', justifyContent: 'center', alignItems: 'center', height: '40px', minWidth: '40px', minHeight: '40px', borderRadius: '8px', padding: '0 4px', backgroundColor: '#fff', border: '1px solid rgba(239, 240, 240, 0.9)', zIndex: '9999', boxShadow: 'rgba(0, 0, 0, 0.08) 0px 1px 2px -2px, rgba(0, 0, 0, 0.04) 0px 2px 6px, rgba(0, 0, 0, 0.02) 0px 4px 8px 1px' }, style));
125
107
  if (className) {
126
108
  container.classList.add(className);
127
109
  }
@@ -129,8 +111,8 @@ export class EditBar extends Plugin {
129
111
  this.container = container;
130
112
  const { getContainer } = this.options || {};
131
113
  const resolvedContainer = typeof getContainer === 'function' ? getContainer() : getContainer;
132
- const containerParent = resolvedContainer ?? document.body;
133
- containerParent?.appendChild(container);
114
+ const containerParent = resolvedContainer !== null && resolvedContainer !== void 0 ? resolvedContainer : document.body;
115
+ containerParent === null || containerParent === void 0 ? void 0 : containerParent.appendChild(container);
134
116
  return container;
135
117
  }
136
118
  getTextEditItems(text) {
@@ -168,11 +150,11 @@ export class EditBar extends Plugin {
168
150
  ];
169
151
  }
170
152
  placeEditBar(container, selection) {
153
+ var _a;
171
154
  if (selection.length === 0)
172
155
  return;
173
156
  const combinedBounds = getCombinedBounds(selection.map((element) => element.getBoundingClientRect()));
174
- const offsetParent = container.offsetParent ??
175
- document.documentElement;
157
+ const offsetParent = (_a = container.offsetParent) !== null && _a !== void 0 ? _a : document.documentElement;
176
158
  const viewportHeight = document.documentElement.clientHeight;
177
159
  const viewportWidth = document.documentElement.clientWidth;
178
160
  const containerRect = container.getBoundingClientRect();