geoiq-frontend-ui-kit 2.0.2 → 2.0.4

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 (217) hide show
  1. package/dist/components/organisms/image-editor/components/line-session-bar.d.ts +20 -0
  2. package/dist/components/organisms/image-editor/components/line-session-bar.d.ts.map +1 -0
  3. package/dist/components/organisms/image-editor/components/panel-insert.d.ts.map +1 -1
  4. package/dist/components/organisms/image-editor/components/panel-selected.d.ts.map +1 -1
  5. package/dist/components/organisms/image-editor/components/panel.d.ts.map +1 -1
  6. package/dist/components/organisms/image-editor/components/saved-layers-list.d.ts +9 -0
  7. package/dist/components/organisms/image-editor/components/saved-layers-list.d.ts.map +1 -0
  8. package/dist/components/organisms/image-editor/image-editor-modal.d.ts.map +1 -1
  9. package/dist/components/organisms/image-editor/image-editor.types.d.ts +73 -0
  10. package/dist/components/organisms/image-editor/image-editor.types.d.ts.map +1 -1
  11. package/dist/components/organisms/image-editor/use-image-editor.d.ts.map +1 -1
  12. package/dist/components/ui/request-credits-view/component/request-credit-dialog.d.ts.map +1 -1
  13. package/dist/index.es100.js +147 -120
  14. package/dist/index.es100.js.map +1 -1
  15. package/dist/index.es101.js +16 -11
  16. package/dist/index.es101.js.map +1 -1
  17. package/dist/index.es102.js +7 -41
  18. package/dist/index.es102.js.map +1 -1
  19. package/dist/index.es103.js +21 -10
  20. package/dist/index.es103.js.map +1 -1
  21. package/dist/index.es104.js +7 -74
  22. package/dist/index.es104.js.map +1 -1
  23. package/dist/index.es105.js +177 -30
  24. package/dist/index.es105.js.map +1 -1
  25. package/dist/index.es106.js +45 -16
  26. package/dist/index.es106.js.map +1 -1
  27. package/dist/index.es107.js +42 -20
  28. package/dist/index.es107.js.map +1 -1
  29. package/dist/index.es108.js +22 -12
  30. package/dist/index.es108.js.map +1 -1
  31. package/dist/index.es109.js +122 -98
  32. package/dist/index.es109.js.map +1 -1
  33. package/dist/index.es11.js +1 -1
  34. package/dist/index.es110.js +33 -62
  35. package/dist/index.es110.js.map +1 -1
  36. package/dist/index.es111.js +60 -52
  37. package/dist/index.es111.js.map +1 -1
  38. package/dist/index.es112.js +10 -41
  39. package/dist/index.es112.js.map +1 -1
  40. package/dist/index.es113.js +21 -11
  41. package/dist/index.es113.js.map +1 -1
  42. package/dist/index.es114.js +42 -92
  43. package/dist/index.es114.js.map +1 -1
  44. package/dist/index.es115.js +37 -16
  45. package/dist/index.es115.js.map +1 -1
  46. package/dist/index.es116.js +12 -99
  47. package/dist/index.es116.js.map +1 -1
  48. package/dist/index.es117.js +92 -13
  49. package/dist/index.es117.js.map +1 -1
  50. package/dist/index.es118.js +13 -101
  51. package/dist/index.es118.js.map +1 -1
  52. package/dist/index.es119.js +71 -20
  53. package/dist/index.es119.js.map +1 -1
  54. package/dist/index.es12.js +1 -1
  55. package/dist/index.es120.js +34 -25
  56. package/dist/index.es120.js.map +1 -1
  57. package/dist/index.es121.js +20 -22
  58. package/dist/index.es121.js.map +1 -1
  59. package/dist/index.es122.js +16 -45
  60. package/dist/index.es122.js.map +1 -1
  61. package/dist/index.es123.js +11 -34
  62. package/dist/index.es123.js.map +1 -1
  63. package/dist/index.es124.js +96 -61
  64. package/dist/index.es124.js.map +1 -1
  65. package/dist/index.es125.js +57 -174
  66. package/dist/index.es125.js.map +1 -1
  67. package/dist/index.es126.js +50 -17
  68. package/dist/index.es126.js.map +1 -1
  69. package/dist/index.es127.js +2 -2
  70. package/dist/index.es128.js +2 -2
  71. package/dist/index.es129.js +1 -1
  72. package/dist/index.es130.js +1 -1
  73. package/dist/index.es131.js +2 -2
  74. package/dist/index.es132.js +35 -38
  75. package/dist/index.es132.js.map +1 -1
  76. package/dist/index.es133.js +41 -7
  77. package/dist/index.es133.js.map +1 -1
  78. package/dist/index.es134.js +88 -7
  79. package/dist/index.es134.js.map +1 -1
  80. package/dist/index.es135.js +14 -34
  81. package/dist/index.es135.js.map +1 -1
  82. package/dist/index.es136.js +269 -35
  83. package/dist/index.es136.js.map +1 -1
  84. package/dist/index.es137.js +7 -2
  85. package/dist/index.es137.js.map +1 -1
  86. package/dist/index.es138.js +23 -25
  87. package/dist/index.es138.js.map +1 -1
  88. package/dist/index.es139.js +169 -15
  89. package/dist/index.es139.js.map +1 -1
  90. package/dist/index.es140.js +82 -7
  91. package/dist/index.es140.js.map +1 -1
  92. package/dist/index.es141.js +73 -21
  93. package/dist/index.es141.js.map +1 -1
  94. package/dist/index.es142.js +3 -168
  95. package/dist/index.es142.js.map +1 -1
  96. package/dist/index.es143.js +56 -82
  97. package/dist/index.es143.js.map +1 -1
  98. package/dist/index.es144.js +119 -4
  99. package/dist/index.es144.js.map +1 -1
  100. package/dist/index.es145.js +405 -56
  101. package/dist/index.es145.js.map +1 -1
  102. package/dist/index.es146.js +25 -110
  103. package/dist/index.es146.js.map +1 -1
  104. package/dist/index.es147.js +60 -314
  105. package/dist/index.es147.js.map +1 -1
  106. package/dist/index.es148.js +29 -24
  107. package/dist/index.es148.js.map +1 -1
  108. package/dist/index.es149.js +21 -64
  109. package/dist/index.es149.js.map +1 -1
  110. package/dist/index.es150.js +36 -30
  111. package/dist/index.es150.js.map +1 -1
  112. package/dist/index.es151.js +211 -24
  113. package/dist/index.es151.js.map +1 -1
  114. package/dist/index.es152.js +141 -35
  115. package/dist/index.es152.js.map +1 -1
  116. package/dist/index.es153.js +141 -140
  117. package/dist/index.es153.js.map +1 -1
  118. package/dist/index.es154.js +45 -142
  119. package/dist/index.es154.js.map +1 -1
  120. package/dist/index.es155.js +353 -45
  121. package/dist/index.es155.js.map +1 -1
  122. package/dist/index.es156.js +14 -10
  123. package/dist/index.es156.js.map +1 -1
  124. package/dist/index.es157.js +10 -42
  125. package/dist/index.es157.js.map +1 -1
  126. package/dist/index.es158.js +44 -5
  127. package/dist/index.es158.js.map +1 -1
  128. package/dist/index.es159.js +5 -11
  129. package/dist/index.es159.js.map +1 -1
  130. package/dist/index.es16.js +1 -1
  131. package/dist/index.es160.js +10 -10
  132. package/dist/index.es160.js.map +1 -1
  133. package/dist/index.es161.js +11 -2
  134. package/dist/index.es161.js.map +1 -1
  135. package/dist/index.es162.js +2 -91
  136. package/dist/index.es162.js.map +1 -1
  137. package/dist/index.es163.js +2 -213
  138. package/dist/index.es163.js.map +1 -1
  139. package/dist/index.es164.js +23 -52
  140. package/dist/index.es164.js.map +1 -1
  141. package/dist/index.es165.js +88 -33
  142. package/dist/index.es165.js.map +1 -1
  143. package/dist/index.es166.js +52 -31
  144. package/dist/index.es166.js.map +1 -1
  145. package/dist/index.es167.js +32 -29
  146. package/dist/index.es167.js.map +1 -1
  147. package/dist/index.es168.js +26 -84
  148. package/dist/index.es168.js.map +1 -1
  149. package/dist/index.es169.js +27 -111
  150. package/dist/index.es169.js.map +1 -1
  151. package/dist/index.es170.js +97 -285
  152. package/dist/index.es170.js.map +1 -1
  153. package/dist/index.es171.js +251 -30
  154. package/dist/index.es171.js.map +1 -1
  155. package/dist/index.es172.js +63 -11
  156. package/dist/index.es172.js.map +1 -1
  157. package/dist/index.es173.js +284 -82
  158. package/dist/index.es173.js.map +1 -1
  159. package/dist/index.es174.js +29 -70
  160. package/dist/index.es174.js.map +1 -1
  161. package/dist/index.es175.js +10 -114
  162. package/dist/index.es175.js.map +1 -1
  163. package/dist/index.es176.js +23 -106
  164. package/dist/index.es176.js.map +1 -1
  165. package/dist/index.es177.js +19 -82
  166. package/dist/index.es177.js.map +1 -1
  167. package/dist/index.es178.js +63 -109
  168. package/dist/index.es178.js.map +1 -1
  169. package/dist/index.es179.js +63 -117
  170. package/dist/index.es179.js.map +1 -1
  171. package/dist/index.es180.js +112 -23
  172. package/dist/index.es180.js.map +1 -1
  173. package/dist/index.es181.js +103 -18
  174. package/dist/index.es181.js.map +1 -1
  175. package/dist/index.es182.js +86 -5
  176. package/dist/index.es182.js.map +1 -1
  177. package/dist/index.es183.js +133 -0
  178. package/dist/index.es183.js.map +1 -0
  179. package/dist/index.es184.js +133 -0
  180. package/dist/index.es184.js.map +1 -0
  181. package/dist/index.es185.js +9 -0
  182. package/dist/index.es185.js.map +1 -0
  183. package/dist/index.es19.js +1 -1
  184. package/dist/index.es2.js +21 -21
  185. package/dist/index.es2.js.map +1 -1
  186. package/dist/index.es20.js +1 -1
  187. package/dist/index.es21.js +3 -3
  188. package/dist/index.es22.js +1 -1
  189. package/dist/index.es25.js +1 -1
  190. package/dist/index.es27.js +1 -1
  191. package/dist/index.es28.js +2 -2
  192. package/dist/index.es30.js +1 -1
  193. package/dist/index.es32.js +1 -1
  194. package/dist/index.es33.js +1 -1
  195. package/dist/index.es45.js +48 -46
  196. package/dist/index.es45.js.map +1 -1
  197. package/dist/index.es46.js +2 -2
  198. package/dist/index.es47.js +1 -1
  199. package/dist/index.es48.js +1 -1
  200. package/dist/index.es53.js +1 -1
  201. package/dist/index.es54.js +1 -1
  202. package/dist/index.es57.js +1 -1
  203. package/dist/index.es59.js +1 -1
  204. package/dist/index.es67.js +2 -2
  205. package/dist/index.es68.js +1 -1
  206. package/dist/index.es71.js +1 -1
  207. package/dist/index.es72.js +7 -7
  208. package/dist/index.es73.js +2 -2
  209. package/dist/index.es85.js +1 -1
  210. package/dist/index.es97.js +16 -11
  211. package/dist/index.es97.js.map +1 -1
  212. package/dist/index.es98.js +89 -262
  213. package/dist/index.es98.js.map +1 -1
  214. package/dist/index.es99.js +13 -87
  215. package/dist/index.es99.js.map +1 -1
  216. package/dist/styles.css +55 -0
  217. package/package.json +2 -1
@@ -1,120 +1,35 @@
1
- import { FONTS as a, VERSION as i } from "./index.es145.js";
2
- const d = 30;
3
- function o() {
4
- const e = document.createElement("canvas");
5
- return e.width = 0, e.height = 0, e;
6
- }
7
- function g(e) {
8
- return {
9
- config: e,
10
- stickers: e.stickers || [],
11
- listeners: { open: [], close: [], save: [], change: [], load: [] },
12
- notify: () => {
13
- },
14
- sourceCanvas: o(),
15
- originalCanvas: null,
16
- layers: [],
17
- selectedId: null,
18
- nextId: 1,
19
- undoStack: [],
20
- redoStack: [],
21
- mode: "select",
22
- viewScale: 1,
23
- zoom: 1,
24
- fitScale: 1,
25
- selectedShapeType: "rect",
26
- shapeFill: "stroke",
27
- shapeWidth: 6,
28
- brushSize: 8,
29
- brushStyle: "round",
30
- textFont: a[0].value,
31
- textSize: 64,
32
- textColor: "#111111",
33
- shapeColor: "#111111",
34
- drawColor: "#111111",
35
- cropRatio: "free",
36
- isSaving: !1,
37
- isLoadingImage: !1,
38
- statusText: "Ready",
39
- adj: {
40
- brightness: 100,
41
- contrast: 100,
42
- saturate: 100,
43
- sepia: 0,
44
- blur: 0,
45
- hue: 0,
46
- filter: "none"
47
- },
48
- stickerImageCache: /* @__PURE__ */ new Map(),
49
- canvasEl: null,
50
- overlayEl: null,
51
- textEditorEl: null,
52
- stageEl: null,
53
- ctx: null,
54
- octx: null,
55
- mounted: !1,
56
- editingLayer: null,
57
- editingSelectAll: !1,
58
- dragMode: null,
59
- dragStart: null,
60
- dragOrig: null,
61
- dragRect: null,
62
- resizeCorner: null,
63
- resizeAnchor: null,
64
- resizeCenter: null,
65
- resizeAnchorWorld: null,
66
- rotateStart: null,
67
- activePointerId: null,
68
- pendingShape: null,
69
- pendingStroke: null,
70
- cropRect: null,
71
- cropStart: null,
72
- isOpenFlag: !1
1
+ import { emitChange as o, MAX_HISTORY as e } from "./index.es144.js";
2
+ import { syncCanvasSize as u, render as i } from "./index.es145.js";
3
+ function d(n) {
4
+ const r = document.createElement("canvas");
5
+ return r.width = n.sourceCanvas.width, r.height = n.sourceCanvas.height, r.getContext("2d").drawImage(n.sourceCanvas, 0, 0), {
6
+ raster: r,
7
+ layers: JSON.parse(JSON.stringify(n.layers)),
8
+ adj: { ...n.adj },
9
+ sel: n.selectedId
73
10
  };
74
11
  }
75
- function s(e, n, l) {
76
- (e.listeners[n] || []).forEach((r) => {
77
- try {
78
- r(l);
79
- } catch (t) {
80
- console.error(t);
81
- }
82
- });
12
+ function p(n) {
13
+ n.undoStack.push(d(n)), n.undoStack.length > e && n.undoStack.shift(), n.redoStack = [], o(n);
83
14
  }
84
- function h(e) {
85
- s(e, "change", { state: u(e) }), e.notify();
15
+ function S(n) {
16
+ n.undoStack.pop(), o(n);
86
17
  }
87
- function S(e) {
88
- return e.selectedId != null ? e.layers.find((n) => n.id === e.selectedId) : null;
18
+ function c(n, r) {
19
+ n.sourceCanvas.width = r.raster.width, n.sourceCanvas.height = r.raster.height, n.sourceCanvas.getContext("2d").drawImage(r.raster, 0, 0), n.layers = JSON.parse(JSON.stringify(r.layers)), Object.assign(n.adj, r.adj), n.selectedId = r.sel, u(n), i(n);
89
20
  }
90
- function f(e) {
91
- e.adj.brightness = 100, e.adj.contrast = 100, e.adj.saturate = 100, e.adj.sepia = 0, e.adj.blur = 0, e.adj.hue = 0, e.adj.filter = "none";
21
+ function g(n) {
22
+ n.undoStack.length && (n.redoStack.push(d(n)), c(n, n.undoStack.pop()), n.statusText = "Undo", o(n));
92
23
  }
93
- function u(e) {
94
- return e.sourceCanvas.width ? {
95
- version: i,
96
- image: e.sourceCanvas.toDataURL("image/png"),
97
- width: e.sourceCanvas.width,
98
- height: e.sourceCanvas.height,
99
- adjustments: { ...e.adj },
100
- layers: JSON.parse(
101
- JSON.stringify(
102
- e.layers.map((n) => {
103
- const l = { ...n };
104
- return delete l._editing, l;
105
- })
106
- )
107
- )
108
- } : null;
24
+ function f(n) {
25
+ n.redoStack.length && (n.undoStack.push(d(n)), c(n, n.redoStack.pop()), n.statusText = "Redo", o(n));
109
26
  }
110
27
  export {
111
- d as MAX_HISTORY,
112
- g as createState,
113
- s as emit,
114
- h as emitChange,
115
- o as emptySourceCanvas,
116
- S as getSel,
117
- u as getState,
118
- f as resetAdjValues
28
+ c as applySnapshot,
29
+ S as popHistory,
30
+ p as pushHistory,
31
+ f as redo,
32
+ d as snapshot,
33
+ g as undo
119
34
  };
120
35
  //# sourceMappingURL=index.es146.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.es146.js","sources":["../src/components/organisms/image-editor/engine/state.js"],"sourcesContent":["import { FONTS, VERSION } from './constants.js'\n\nexport const MAX_HISTORY = 30\n\nexport function emptySourceCanvas() {\n const c = document.createElement('canvas')\n c.width = 0\n c.height = 0\n return c\n}\n\nexport function createState(config) {\n return {\n config,\n stickers: config.stickers || [],\n listeners: { open: [], close: [], save: [], change: [], load: [] },\n notify: () => {},\n\n sourceCanvas: emptySourceCanvas(),\n originalCanvas: null,\n layers: [],\n selectedId: null,\n nextId: 1,\n undoStack: [],\n redoStack: [],\n\n mode: 'select',\n viewScale: 1,\n zoom: 1,\n fitScale: 1,\n selectedShapeType: 'rect',\n shapeFill: 'stroke',\n shapeWidth: 6,\n brushSize: 8,\n brushStyle: 'round',\n textFont: FONTS[0].value,\n textSize: 64,\n textColor: '#111111',\n shapeColor: '#111111',\n drawColor: '#111111',\n cropRatio: 'free',\n isSaving: false,\n isLoadingImage: false,\n statusText: 'Ready',\n adj: {\n brightness: 100,\n contrast: 100,\n saturate: 100,\n sepia: 0,\n blur: 0,\n hue: 0,\n filter: 'none',\n },\n stickerImageCache: new Map(),\n\n canvasEl: null,\n overlayEl: null,\n textEditorEl: null,\n stageEl: null,\n ctx: null,\n octx: null,\n mounted: false,\n\n editingLayer: null,\n editingSelectAll: false,\n\n dragMode: null,\n dragStart: null,\n dragOrig: null,\n dragRect: null,\n resizeCorner: null,\n resizeAnchor: null,\n resizeCenter: null,\n resizeAnchorWorld: null,\n rotateStart: null,\n activePointerId: null,\n pendingShape: null,\n pendingStroke: null,\n cropRect: null,\n cropStart: null,\n\n isOpenFlag: false,\n }\n}\n\nexport function emit(state, ev, payload) {\n ;(state.listeners[ev] || []).forEach((fn) => {\n try {\n fn(payload)\n } catch (e) {\n // eslint-disable-next-line no-console\n console.error(e)\n }\n })\n}\n\nexport function emitChange(state) {\n emit(state, 'change', { state: getState(state) })\n state.notify()\n}\n\nexport function getSel(state) {\n return state.selectedId != null\n ? state.layers.find((l) => l.id === state.selectedId)\n : null\n}\n\nexport function resetAdjValues(state) {\n state.adj.brightness = 100\n state.adj.contrast = 100\n state.adj.saturate = 100\n state.adj.sepia = 0\n state.adj.blur = 0\n state.adj.hue = 0\n state.adj.filter = 'none'\n}\n\nexport function getState(state) {\n if (!state.sourceCanvas.width) return null\n return {\n version: VERSION,\n image: state.sourceCanvas.toDataURL('image/png'),\n width: state.sourceCanvas.width,\n height: state.sourceCanvas.height,\n adjustments: { ...state.adj },\n layers: JSON.parse(\n JSON.stringify(\n state.layers.map((L) => {\n const c = { ...L }\n delete c._editing\n return c\n })\n )\n ),\n }\n}\n"],"names":["MAX_HISTORY","emptySourceCanvas","c","createState","config","FONTS","emit","state","ev","payload","fn","e","emitChange","getState","getSel","l","resetAdjValues","VERSION","L"],"mappings":"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"}
1
+ {"version":3,"file":"index.es146.js","sources":["../src/components/organisms/image-editor/engine/history.js"],"sourcesContent":["import { MAX_HISTORY, emitChange } from './state.js'\nimport { render, syncCanvasSize } from './rendering.js'\n\nexport function snapshot(state) {\n const c = document.createElement('canvas')\n c.width = state.sourceCanvas.width\n c.height = state.sourceCanvas.height\n c.getContext('2d').drawImage(state.sourceCanvas, 0, 0)\n return {\n raster: c,\n layers: JSON.parse(JSON.stringify(state.layers)),\n adj: { ...state.adj },\n sel: state.selectedId,\n }\n}\n\nexport function pushHistory(state) {\n state.undoStack.push(snapshot(state))\n if (state.undoStack.length > MAX_HISTORY) state.undoStack.shift()\n state.redoStack = []\n emitChange(state)\n}\nexport function popHistory(state) {\n state.undoStack.pop()\n emitChange(state)\n}\n\nexport function applySnapshot(state, s) {\n state.sourceCanvas.width = s.raster.width\n state.sourceCanvas.height = s.raster.height\n state.sourceCanvas.getContext('2d').drawImage(s.raster, 0, 0)\n state.layers = JSON.parse(JSON.stringify(s.layers))\n Object.assign(state.adj, s.adj)\n state.selectedId = s.sel\n syncCanvasSize(state)\n render(state)\n}\n\nexport function undo(state) {\n if (!state.undoStack.length) return\n state.redoStack.push(snapshot(state))\n applySnapshot(state, state.undoStack.pop())\n state.statusText = 'Undo'\n emitChange(state)\n}\n\nexport function redo(state) {\n if (!state.redoStack.length) return\n state.undoStack.push(snapshot(state))\n applySnapshot(state, state.redoStack.pop())\n state.statusText = 'Redo'\n emitChange(state)\n}\n"],"names":["snapshot","state","c","pushHistory","MAX_HISTORY","emitChange","popHistory","applySnapshot","s","syncCanvasSize","render","undo","redo"],"mappings":";;AAGO,SAASA,EAASC,GAAO;AAC9B,QAAMC,IAAI,SAAS,cAAc,QAAQ;AACzC,SAAAA,EAAE,QAAQD,EAAM,aAAa,OAC7BC,EAAE,SAASD,EAAM,aAAa,QAC9BC,EAAE,WAAW,IAAI,EAAE,UAAUD,EAAM,cAAc,GAAG,CAAC,GAC9C;AAAA,IACL,QAAQC;AAAA,IACR,QAAQ,KAAK,MAAM,KAAK,UAAUD,EAAM,MAAM,CAAC;AAAA,IAC/C,KAAK,EAAE,GAAGA,EAAM,IAAG;AAAA,IACnB,KAAKA,EAAM;AAAA,EACf;AACA;AAEO,SAASE,EAAYF,GAAO;AACjC,EAAAA,EAAM,UAAU,KAAKD,EAASC,CAAK,CAAC,GAChCA,EAAM,UAAU,SAASG,KAAaH,EAAM,UAAU,MAAK,GAC/DA,EAAM,YAAY,CAAA,GAClBI,EAAWJ,CAAK;AAClB;AACO,SAASK,EAAWL,GAAO;AAChC,EAAAA,EAAM,UAAU,IAAG,GACnBI,EAAWJ,CAAK;AAClB;AAEO,SAASM,EAAcN,GAAOO,GAAG;AACtC,EAAAP,EAAM,aAAa,QAAQO,EAAE,OAAO,OACpCP,EAAM,aAAa,SAASO,EAAE,OAAO,QACrCP,EAAM,aAAa,WAAW,IAAI,EAAE,UAAUO,EAAE,QAAQ,GAAG,CAAC,GAC5DP,EAAM,SAAS,KAAK,MAAM,KAAK,UAAUO,EAAE,MAAM,CAAC,GAClD,OAAO,OAAOP,EAAM,KAAKO,EAAE,GAAG,GAC9BP,EAAM,aAAaO,EAAE,KACrBC,EAAeR,CAAK,GACpBS,EAAOT,CAAK;AACd;AAEO,SAASU,EAAKV,GAAO;AAC1B,EAAKA,EAAM,UAAU,WACrBA,EAAM,UAAU,KAAKD,EAASC,CAAK,CAAC,GACpCM,EAAcN,GAAOA,EAAM,UAAU,IAAG,CAAE,GAC1CA,EAAM,aAAa,QACnBI,EAAWJ,CAAK;AAClB;AAEO,SAASW,EAAKX,GAAO;AAC1B,EAAKA,EAAM,UAAU,WACrBA,EAAM,UAAU,KAAKD,EAASC,CAAK,CAAC,GACpCM,EAAcN,GAAOA,EAAM,UAAU,IAAG,CAAE,GAC1CA,EAAM,aAAa,QACnBI,EAAWJ,CAAK;AAClB;"}
@@ -1,325 +1,71 @@
1
- import { supportsContextFilter as k } from "./index.es162.js";
2
- import { FILTER_CSS as T } from "./index.es145.js";
3
- function C(t) {
4
- const { adj: e } = t;
5
- let n = `brightness(${e.brightness}%) contrast(${e.contrast}%) saturate(${e.saturate}%) sepia(${e.sepia}%) blur(${e.blur}px) hue-rotate(${e.hue}deg)`;
6
- return e.filter !== "none" && (n += " " + T[e.filter]), n.trim();
7
- }
8
- const R = 0.25, A = 4, m = 1.25;
9
- function v(t) {
10
- const n = Math.min(
11
- (t.stageEl.clientWidth - 48) / t.sourceCanvas.width,
12
- (t.stageEl.clientHeight - 48) / t.sourceCanvas.height,
13
- 1
14
- );
15
- t.fitScale = n;
16
- const o = n * t.zoom;
17
- t.viewScale = o;
18
- const a = Math.round(t.sourceCanvas.width * o), r = Math.round(t.sourceCanvas.height * o);
19
- t.canvasEl.style.width = t.overlayEl.style.width = a + "px", t.canvasEl.style.height = t.overlayEl.style.height = r + "px";
20
- }
21
- function u(t, e) {
22
- if (t.zoom = Math.min(A, Math.max(R, e)), !t.mounted || !t.sourceCanvas.width) {
23
- t.notify();
24
- return;
25
- }
26
- v(t), I(t), t.notify();
27
- }
28
- function J(t) {
29
- u(t, t.zoom * m);
30
- }
31
- function V(t) {
32
- u(t, t.zoom / m);
33
- }
34
- function j(t) {
35
- u(t, 1);
36
- }
37
- function q(t) {
38
- t.canvasEl.width = t.overlayEl.width = t.sourceCanvas.width, t.canvasEl.height = t.overlayEl.height = t.sourceCanvas.height, v(t);
39
- }
40
- function H(t) {
41
- const { ctx: e, canvasEl: n, sourceCanvas: o } = t;
42
- e.clearRect(0, 0, n.width, n.height);
43
- const a = C(t);
44
- if (k()) {
45
- n.style.filter = "", e.filter = a, e.drawImage(o, 0, 0), e.filter = "none";
46
- return;
47
- }
48
- n.style.filter = a, e.drawImage(o, 0, 0);
49
- }
50
- function U(t) {
51
- !t.mounted || !t.sourceCanvas.width || (H(t), I(t));
52
- }
53
- const g = 1.1;
54
- function S(t, e) {
55
- t.octx.font = `${e.size}px ${e.font}`;
56
- const n = Math.max(e.boxWidth, 1), o = [];
57
- return e.text.split(`
58
- `).forEach((a) => {
59
- const r = a.split(" ");
60
- let i = "";
61
- r.forEach((h) => {
62
- const s = i ? i + " " + h : h;
63
- i && t.octx.measureText(s).width > n ? (o.push(i), i = h) : i = s;
64
- }), o.push(i);
65
- }), o;
66
- }
67
- function c(t, e) {
68
- if (e.type === "text") {
69
- const n = S(t, e);
70
- return {
71
- x: e.x,
72
- y: e.y,
73
- w: e.boxWidth,
74
- h: n.length * e.size * g
75
- };
76
- }
77
- if (e.type === "shape" || e.type === "sticker")
1
+ import { pushHistory as d } from "./index.es146.js";
2
+ import { emitChange as u, resetAdjValues as v } from "./index.es144.js";
3
+ import { syncCanvasSize as C, render as x, normRect as w, layerBounds as R } from "./index.es145.js";
4
+ import { setMode as g } from "./index.es148.js";
5
+ function m(o, n, t) {
6
+ const r = R(o, n), a = { x: r.x + r.w / 2, y: r.y + r.h / 2 }, c = t(a);
7
+ return { x: c.x - a.x, y: c.y - a.y };
8
+ }
9
+ function T(o, n) {
10
+ d(o);
11
+ const t = n * Math.PI / 180, r = o.sourceCanvas.width, a = o.sourceCanvas.height, c = a, h = r, p = document.createElement("canvas");
12
+ p.width = c, p.height = h;
13
+ const e = p.getContext("2d");
14
+ e.translate(c / 2, h / 2), e.rotate(t), e.drawImage(o.sourceCanvas, -r / 2, -a / 2), o.sourceCanvas.width = c, o.sourceCanvas.height = h, o.sourceCanvas.getContext("2d").drawImage(p, 0, 0);
15
+ const s = (i, l) => {
16
+ const y = i - r / 2, f = l - a / 2;
78
17
  return {
79
- x: Math.min(e.x, e.x + e.w),
80
- y: Math.min(e.y, e.y + e.h),
81
- w: Math.abs(e.w),
82
- h: Math.abs(e.h)
18
+ x: y * Math.cos(t) - f * Math.sin(t) + c / 2,
19
+ y: y * Math.sin(t) + f * Math.cos(t) + h / 2
83
20
  };
84
- if (e.type === "stroke") {
85
- let n = 1 / 0, o = 1 / 0, a = -1 / 0, r = -1 / 0;
86
- e.points.forEach((h) => {
87
- n = Math.min(n, h.x), o = Math.min(o, h.y), a = Math.max(a, h.x), r = Math.max(r, h.y);
88
- });
89
- const i = e.width / 2;
90
- return { x: n - i, y: o - i, w: a - n + i * 2, h: r - o + i * 2 };
91
- }
92
- return { x: 0, y: 0, w: 0, h: 0 };
93
- }
94
- function K(t, e) {
95
- if (e.type !== "text") return;
96
- const n = t.sourceCanvas.height - e.y;
97
- for (; e.size > 10 && c(t, e).h > n && n > 0; )
98
- e.size -= 1;
99
- }
100
- function Q(t, e) {
101
- if (e.type !== "text") return;
102
- const n = t.sourceCanvas.width - e.x;
103
- e.boxWidth = Math.round(Math.max(20, Math.min(e.boxWidth, n)));
104
- }
105
- function E(t) {
106
- return [
107
- { corner: "tl", x: t.x, y: t.y },
108
- { corner: "tr", x: t.x + t.w, y: t.y },
109
- { corner: "bl", x: t.x, y: t.y + t.h },
110
- { corner: "br", x: t.x + t.w, y: t.y + t.h }
111
- ];
112
- }
113
- const w = [
114
- "line",
115
- "dashedLine",
116
- "arrow",
117
- "dashedArrow",
118
- "doubleArrow",
119
- "dashedDoubleArrow"
120
- ], z = ["dashedLine", "dashedArrow", "dashedDoubleArrow"], D = {
121
- arrow: ["end"],
122
- dashedArrow: ["end"],
123
- doubleArrow: ["end", "start"],
124
- dashedDoubleArrow: ["end", "start"]
125
- };
126
- function W(t) {
127
- const e = Math.max(1, t || 1);
128
- return [Math.max(6, e * 2.5), Math.max(4, e * 1.75)];
129
- }
130
- function M(t, e, n, o, a) {
131
- t.beginPath(), t.moveTo(e, n), t.lineTo(
132
- e - a * Math.cos(o - Math.PI / 6),
133
- n - a * Math.sin(o - Math.PI / 6)
134
- ), t.moveTo(e, n), t.lineTo(
135
- e - a * Math.cos(o + Math.PI / 6),
136
- n - a * Math.sin(o + Math.PI / 6)
137
- ), t.stroke();
138
- }
139
- const _ = 26, O = 6;
140
- function y(t, e) {
141
- const n = c(t, e);
142
- return { x: n.x + n.w / 2, y: n.y + n.h / 2 };
143
- }
144
- function d(t, e, n) {
145
- if (!n) return { x: t.x, y: t.y };
146
- const o = n * Math.PI / 180, a = Math.cos(o), r = Math.sin(o), i = t.x - e.x, h = t.y - e.y;
147
- return { x: e.x + i * a - h * r, y: e.y + i * r + h * a };
148
- }
149
- function X(t, e, n, o) {
150
- const a = e.rotation || 0;
151
- if (!a) {
152
- o();
153
- return;
154
- }
155
- const r = d(n, y(t, e), a);
156
- o();
157
- const i = d(n, y(t, e), a);
158
- e.x += r.x - i.x, e.y += r.y - i.y;
159
- }
160
- function $(t, e, n) {
161
- return d(n, y(t, e), -(e.rotation || 0));
162
- }
163
- function b(t, e) {
164
- const n = c(t, e);
165
- return {
166
- x: n.x + n.w / 2,
167
- y: n.y + n.h + _ / t.viewScale
168
21
  };
169
- }
170
- function N(t, e) {
171
- const n = b(t, e);
172
- return d(n, y(t, e), e.rotation || 0);
173
- }
174
- function Y(t, e, n) {
175
- const o = N(t, n);
176
- return Math.hypot(e.x - o.x, e.y - o.y) <= 14 / t.viewScale;
177
- }
178
- function L(t, e, n) {
179
- if (n.type === "stroke") return null;
180
- const o = 12 / t.viewScale, a = $(t, n, e);
181
- if (n.type === "shape" && w.includes(n.shape)) {
182
- const s = [
183
- { corner: "start", x: n.x, y: n.y },
184
- { corner: "end", x: n.x + n.w, y: n.y + n.h }
185
- ].find(
186
- (l) => Math.abs(a.x - l.x) < o && Math.abs(a.y - l.y) < o
187
- );
188
- return s ? s.corner : null;
189
- }
190
- const r = c(t, n), i = E(r).find(
191
- (h) => Math.abs(a.x - h.x) < o && Math.abs(a.y - h.y) < o
192
- );
193
- return i ? i.corner : null;
194
- }
195
- function p(t, e, n) {
196
- if (!n._editing) {
197
- if (e.save(), n.type !== "stroke" || n.rotation) {
198
- const o = c(t, n), a = o.x + o.w / 2, r = o.y + o.h / 2;
199
- e.translate(a, r), n.rotation && e.rotate(n.rotation * Math.PI / 180), (n.flipH || n.flipV) && e.scale(n.flipH ? -1 : 1, n.flipV ? -1 : 1), e.translate(-a, -r);
200
- }
201
- if (n.type === "text") {
202
- e.font = `${n.size}px ${n.font}`, e.fillStyle = n.color, e.textBaseline = "top", e.shadowColor = "rgba(0,0,0,.22)", e.shadowBlur = n.size * 0.05, e.shadowOffsetY = n.size * 0.02;
203
- const o = n.size * g;
204
- S(t, n).forEach((a, r) => {
205
- e.fillText(a, n.x, n.y + r * o);
206
- });
207
- } else if (n.type === "shape") {
208
- e.strokeStyle = n.color, e.fillStyle = n.color, e.lineWidth = n.width, e.lineCap = "round", e.lineJoin = "round";
209
- const o = n.x, a = n.y, r = n.w, i = n.h;
210
- if (n.shape === "rect")
211
- n.fill === "fill" ? e.fillRect(o, a, r, i) : e.strokeRect(o, a, r, i);
212
- else if (n.shape === "ellipse")
213
- e.beginPath(), e.ellipse(
214
- o + r / 2,
215
- a + i / 2,
216
- Math.abs(r / 2),
217
- Math.abs(i / 2),
218
- 0,
219
- 0,
220
- Math.PI * 2
221
- ), n.fill === "fill" ? e.fill() : e.stroke();
222
- else if (n.shape === "circle") {
223
- const h = Math.min(Math.abs(r), Math.abs(i)) / 2;
224
- e.beginPath(), e.arc(o + r / 2, a + i / 2, h, 0, Math.PI * 2), n.fill === "fill" ? e.fill() : e.stroke();
225
- } else if (w.includes(n.shape)) {
226
- const h = o + r, s = a + i, l = z.includes(n.shape);
227
- l && (e.lineCap = "butt", e.setLineDash(W(n.width))), e.beginPath(), e.moveTo(o, a), e.lineTo(h, s), e.stroke(), l && (e.setLineDash([]), e.lineCap = "round");
228
- const x = Math.atan2(i, r), f = Math.max(14, n.width * 3);
229
- (D[n.shape] || []).forEach((P) => {
230
- P === "end" ? M(e, h, s, x, f) : M(e, o, a, x + Math.PI, f);
231
- });
232
- }
233
- } else if (n.type === "stroke")
234
- e.strokeStyle = n.color, e.lineWidth = n.width, e.lineCap = "round", e.lineJoin = "round", e.globalAlpha = n.style === "highlight" ? 0.35 : 1, e.beginPath(), n.points.forEach(
235
- (o, a) => a === 0 ? e.moveTo(o.x, o.y) : e.lineTo(o.x, o.y)
236
- ), n.points.length === 1 && e.lineTo(n.points[0].x + 0.1, n.points[0].y + 0.1), e.stroke();
237
- else if (n.type === "sticker") {
238
- const o = t.stickerImageCache.get(n.src);
239
- o && o.complete && o.naturalWidth && e.drawImage(o, n.x, n.y, n.w, n.h);
240
- }
241
- e.restore();
22
+ o.layers.forEach((i) => {
23
+ if (i.type === "text" || i.type === "shape" || i.type === "sticker") {
24
+ const l = m(o, i, (y) => s(y.x, y.y));
25
+ i.x += l.x, i.y += l.y, i.rotation = (((i.rotation || 0) + n) % 360 + 360) % 360;
26
+ } else i.type === "stroke" && (i.points = i.points.map((l) => s(l.x, l.y)));
27
+ }), C(o), x(o), o.statusText = n < 0 ? "Rotated left" : "Rotated right", u(o);
28
+ }
29
+ function b(o, n) {
30
+ d(o);
31
+ const t = o.sourceCanvas.width, r = o.sourceCanvas.height, a = document.createElement("canvas");
32
+ a.width = t, a.height = r;
33
+ const c = a.getContext("2d");
34
+ n ? (c.translate(t, 0), c.scale(-1, 1)) : (c.translate(0, r), c.scale(1, -1)), c.drawImage(o.sourceCanvas, 0, 0), o.sourceCanvas.getContext("2d").clearRect(0, 0, t, r), o.sourceCanvas.getContext("2d").drawImage(a, 0, 0);
35
+ const h = (e) => n ? t - e : e, p = (e) => n ? e : r - e;
36
+ o.layers.forEach((e) => {
37
+ if (e.type === "text" || e.type === "shape" || e.type === "sticker") {
38
+ const s = m(o, e, (i) => ({ x: h(i.x), y: p(i.y) }));
39
+ e.x += s.x, e.y += s.y, e.rotation = (360 - (e.rotation || 0) % 360) % 360, n ? e.flipH = !e.flipH : e.flipV = !e.flipV;
40
+ } else e.type === "stroke" && (e.points = e.points.map((s) => ({ x: h(s.x), y: p(s.y) })));
41
+ }), x(o), o.statusText = n ? "Flipped horizontally" : "Flipped vertically", u(o);
42
+ }
43
+ function H(o) {
44
+ if (!o.cropRect || Math.abs(o.cropRect.w) < 4 || Math.abs(o.cropRect.h) < 4) {
45
+ o.statusText = "Draw a crop box first", o.notify();
46
+ return;
242
47
  }
48
+ d(o);
49
+ const n = w(o.cropRect), t = document.createElement("canvas");
50
+ t.width = Math.round(n.w), t.height = Math.round(n.h), t.getContext("2d").drawImage(o.sourceCanvas, n.x, n.y, n.w, n.h, 0, 0, n.w, n.h), o.sourceCanvas.width = t.width, o.sourceCanvas.height = t.height, o.sourceCanvas.getContext("2d").drawImage(t, 0, 0), o.layers.forEach((r) => {
51
+ r.type === "text" || r.type === "shape" || r.type === "sticker" ? (r.x -= n.x, r.y -= n.y) : r.type === "stroke" && (r.points = r.points.map((a) => ({ x: a.x - n.x, y: a.y - n.y })));
52
+ }), o.cropRect = null, g(o, "select"), C(o), x(o), o.statusText = "Cropped", u(o);
243
53
  }
244
- function B(t) {
245
- return {
246
- x: Math.min(t.x, t.x + t.w),
247
- y: Math.min(t.y, t.y + t.h),
248
- w: Math.abs(t.w),
249
- h: Math.abs(t.h)
250
- };
54
+ function V(o) {
55
+ g(o, "select");
251
56
  }
252
- function F(t) {
253
- const { cropRect: e, overlayEl: n, octx: o, sourceCanvas: a } = t;
254
- if (!e) return;
255
- const r = B(e), i = n.width, h = n.height;
256
- o.save(), o.fillStyle = "rgba(0,0,0,.45)", o.fillRect(0, 0, i, Math.max(0, r.y)), o.fillRect(0, Math.min(h, r.y + r.h), i, Math.max(0, h - (r.y + r.h))), o.fillRect(0, r.y, Math.max(0, r.x), r.h), o.fillRect(Math.min(i, r.x + r.w), r.y, Math.max(0, i - (r.x + r.w)), r.h), o.strokeStyle = "#fff", o.lineWidth = Math.max(1, a.width / 500), o.setLineDash([8, 6]), o.strokeRect(r.x, r.y, r.w, r.h), o.restore();
57
+ function D(o, n) {
58
+ o.cropRatio = n, o.notify();
257
59
  }
258
- function I(t) {
259
- const { octx: e, overlayEl: n, layers: o, mode: a, selectedId: r } = t;
260
- if (e.clearRect(0, 0, n.width, n.height), o.forEach((i) => {
261
- try {
262
- p(t, e, i);
263
- } catch (h) {
264
- console.error("[image-editor] failed to paint layer", i.id, i.type, h);
265
- }
266
- }), a === "select" && r != null) {
267
- const i = o.find((h) => h.id === r);
268
- if (i) {
269
- const h = c(t, i);
270
- if (e.save(), i.rotation) {
271
- const l = y(t, i);
272
- e.translate(l.x, l.y), e.rotate(i.rotation * Math.PI / 180), e.translate(-l.x, -l.y);
273
- }
274
- if (e.strokeStyle = "#2f5fd2", e.lineWidth = Math.max(1.2, 1.5 / t.viewScale), e.setLineDash([6 / t.viewScale, 4 / t.viewScale]), e.strokeRect(h.x - 4, h.y - 4, h.w + 8, h.h + 8), e.setLineDash([]), i.type !== "stroke") {
275
- const l = 9 / t.viewScale;
276
- e.fillStyle = "#fff", e.strokeStyle = "#2f5fd2", (i.type === "shape" && w.includes(i.shape) ? [
277
- { x: i.x, y: i.y },
278
- { x: i.x + i.w, y: i.y + i.h }
279
- ] : E(h)).forEach((f) => {
280
- e.fillRect(f.x - l / 2, f.y - l / 2, l, l), e.strokeRect(f.x - l / 2, f.y - l / 2, l, l);
281
- });
282
- }
283
- const s = b(t, i);
284
- e.strokeStyle = "#2f5fd2", e.fillStyle = "#fff", e.beginPath(), e.moveTo(s.x, h.y + h.h + 4), e.lineTo(s.x, s.y), e.stroke(), e.beginPath(), e.arc(
285
- s.x,
286
- s.y,
287
- O / t.viewScale,
288
- 0,
289
- Math.PI * 2
290
- ), e.fill(), e.stroke(), e.restore();
291
- }
292
- }
293
- t.pendingShape && p(t, e, t.pendingShape), a === "crop" && t.cropRect && F(t);
60
+ function F(o) {
61
+ o.originalCanvas && (d(o), o.sourceCanvas.width = o.originalCanvas.width, o.sourceCanvas.height = o.originalCanvas.height, o.sourceCanvas.getContext("2d").drawImage(o.originalCanvas, 0, 0), o.layers = [], o.selectedId = null, o.zoom = 1, v(o), C(o), x(o), o.statusText = "Reset to original", u(o));
294
62
  }
295
63
  export {
296
- w as DIRECTIONAL_SHAPES,
297
- g as TEXT_LINE_HEIGHT,
298
- A as ZOOM_MAX,
299
- R as ZOOM_MIN,
300
- u as applyZoom,
301
- C as baseFilter,
302
- Q as clampBoxWidth,
303
- K as clampTextSize,
304
- E as cornerPoints,
305
- F as drawCropOverlay,
306
- v as fitStage,
307
- X as keepingFixed,
308
- c as layerBounds,
309
- y as layerCenter,
310
- B as normRect,
311
- L as onResizeHandle,
312
- Y as onRotateHandle,
313
- p as paintLayer,
314
- U as render,
315
- H as renderBase,
316
- I as renderOverlay,
317
- d as rotatePoint,
318
- q as syncCanvasSize,
319
- $ as toLayerSpace,
320
- S as wrapTextLines,
321
- J as zoomIn,
322
- V as zoomOut,
323
- j as zoomToFit
64
+ H as applyCrop,
65
+ V as cancelCrop,
66
+ b as flip,
67
+ F as resetToOriginal,
68
+ T as rotate,
69
+ D as setCropRatio
324
70
  };
325
71
  //# sourceMappingURL=index.es147.js.map