@cuemath/leap 3.0.9 → 3.0.10-aa1

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 (81) hide show
  1. package/dist/assets/line-icons/icons/check.js +3 -3
  2. package/dist/assets/line-icons/icons/check.js.map +1 -1
  3. package/dist/assets/line-icons/icons/hw.js +32 -0
  4. package/dist/assets/line-icons/icons/hw.js.map +1 -0
  5. package/dist/assets/line-icons/icons/puzzle-icon.js +51 -0
  6. package/dist/assets/line-icons/icons/puzzle-icon.js.map +1 -0
  7. package/dist/assets/line-icons/icons/share.js +48 -0
  8. package/dist/assets/line-icons/icons/share.js.map +1 -0
  9. package/dist/assets/line-icons/icons/tile.js +54 -0
  10. package/dist/assets/line-icons/icons/tile.js.map +1 -0
  11. package/dist/features/cue-canvas/bottombar/homework-controls.js +58 -0
  12. package/dist/features/cue-canvas/bottombar/homework-controls.js.map +1 -0
  13. package/dist/features/cue-canvas/cue-canvas-context.js +6 -6
  14. package/dist/features/cue-canvas/cue-canvas-context.js.map +1 -1
  15. package/dist/features/cue-canvas/cue-canvas-core.js +85 -54
  16. package/dist/features/cue-canvas/cue-canvas-core.js.map +1 -1
  17. package/dist/features/cue-canvas/cue-canvas-helpers.js +31 -25
  18. package/dist/features/cue-canvas/cue-canvas-helpers.js.map +1 -1
  19. package/dist/features/cue-canvas/cue-canvas-provider.js +10 -10
  20. package/dist/features/cue-canvas/cue-canvas-provider.js.map +1 -1
  21. package/dist/features/cue-canvas/cue-canvas.js +57 -57
  22. package/dist/features/cue-canvas/cue-canvas.js.map +1 -1
  23. package/dist/features/cue-canvas/cue-cavas-styled.js +34 -33
  24. package/dist/features/cue-canvas/cue-cavas-styled.js.map +1 -1
  25. package/dist/features/cue-canvas/hooks/use-cue-canvas-actions.js +20 -20
  26. package/dist/features/cue-canvas/hooks/use-cue-canvas-actions.js.map +1 -1
  27. package/dist/features/cue-canvas/sidebar/homework/helper.js +20 -0
  28. package/dist/features/cue-canvas/sidebar/homework/helper.js.map +1 -0
  29. package/dist/features/cue-canvas/sidebar/homework/homework-menu.js +33 -0
  30. package/dist/features/cue-canvas/sidebar/homework/homework-menu.js.map +1 -0
  31. package/dist/features/cue-canvas/sidebar/homework/homework-request.js +60 -0
  32. package/dist/features/cue-canvas/sidebar/homework/homework-request.js.map +1 -0
  33. package/dist/features/cue-canvas/sidebar/homework/homework-styled.js +25 -0
  34. package/dist/features/cue-canvas/sidebar/homework/homework-styled.js.map +1 -0
  35. package/dist/features/cue-canvas/sidebar/homework/homework.js +32 -0
  36. package/dist/features/cue-canvas/sidebar/homework/homework.js.map +1 -0
  37. package/dist/features/cue-canvas/sidebar/puzzles/api/get-puzzles.js +13 -0
  38. package/dist/features/cue-canvas/sidebar/puzzles/api/get-puzzles.js.map +1 -0
  39. package/dist/features/cue-canvas/sidebar/puzzles/filter-selection-menu.js +60 -0
  40. package/dist/features/cue-canvas/sidebar/puzzles/filter-selection-menu.js.map +1 -0
  41. package/dist/features/cue-canvas/sidebar/puzzles/filters-section.js +44 -0
  42. package/dist/features/cue-canvas/sidebar/puzzles/filters-section.js.map +1 -0
  43. package/dist/features/cue-canvas/sidebar/puzzles/filters.js +107 -0
  44. package/dist/features/cue-canvas/sidebar/puzzles/filters.js.map +1 -0
  45. package/dist/features/cue-canvas/sidebar/puzzles/hooks/use-fetch-cue-canvas-activity.js +42 -0
  46. package/dist/features/cue-canvas/sidebar/puzzles/hooks/use-fetch-cue-canvas-activity.js.map +1 -0
  47. package/dist/features/cue-canvas/sidebar/puzzles/launch-puzzle.js +84 -0
  48. package/dist/features/cue-canvas/sidebar/puzzles/launch-puzzle.js.map +1 -0
  49. package/dist/features/cue-canvas/sidebar/puzzles/puzzle-menu-header.js +36 -0
  50. package/dist/features/cue-canvas/sidebar/puzzles/puzzle-menu-header.js.map +1 -0
  51. package/dist/features/cue-canvas/sidebar/puzzles/puzzle-menu.js +133 -0
  52. package/dist/features/cue-canvas/sidebar/puzzles/puzzle-menu.js.map +1 -0
  53. package/dist/features/cue-canvas/sidebar/puzzles/puzzles-styled.js +96 -0
  54. package/dist/features/cue-canvas/sidebar/puzzles/puzzles-styled.js.map +1 -0
  55. package/dist/features/cue-canvas/sidebar/puzzles/puzzles.js +29 -0
  56. package/dist/features/cue-canvas/sidebar/puzzles/puzzles.js.map +1 -0
  57. package/dist/features/cue-canvas/sidebar/puzzles/utils.js +120 -0
  58. package/dist/features/cue-canvas/sidebar/puzzles/utils.js.map +1 -0
  59. package/dist/features/cue-canvas/sidebar/sidebar-styled.js +32 -0
  60. package/dist/features/cue-canvas/sidebar/sidebar-styled.js.map +1 -0
  61. package/dist/features/cue-canvas/sidebar/sidebar.js +34 -0
  62. package/dist/features/cue-canvas/sidebar/sidebar.js.map +1 -0
  63. package/dist/features/cue-canvas/sidebar/tiles/tile.js +16 -0
  64. package/dist/features/cue-canvas/sidebar/tiles/tile.js.map +1 -0
  65. package/dist/features/hooks/use-debounce.js +16 -0
  66. package/dist/features/hooks/use-debounce.js.map +1 -0
  67. package/dist/features/post-game-stats/digital-meter/digital-meter.js +49 -40
  68. package/dist/features/post-game-stats/digital-meter/digital-meter.js.map +1 -1
  69. package/dist/features/ui/animated-arc/animated-arc.js +7 -7
  70. package/dist/features/ui/animated-arc/animated-arc.js.map +1 -1
  71. package/dist/features/ui/loader/circular-loader/circular-loader.js +8 -6
  72. package/dist/features/ui/loader/circular-loader/circular-loader.js.map +1 -1
  73. package/dist/features/ui/stepper/stepper.js +7 -7
  74. package/dist/features/ui/theme/tab.js +26 -0
  75. package/dist/features/ui/theme/tab.js.map +1 -1
  76. package/dist/features/worksheet/worksheet/worksheet-question/worksheet-question.js +34 -34
  77. package/dist/features/worksheet/worksheet/worksheet-question/worksheet-question.js.map +1 -1
  78. package/dist/index.d.ts +48 -11
  79. package/dist/index.js +441 -435
  80. package/dist/index.js.map +1 -1
  81. package/package.json +1 -1
@@ -1,5 +1,5 @@
1
1
  import { jsx as o } from "react/jsx-runtime";
2
- const e = (t) => /* @__PURE__ */ o(
2
+ const t = (e) => /* @__PURE__ */ o(
3
3
  "svg",
4
4
  {
5
5
  width: "24",
@@ -7,7 +7,7 @@ const e = (t) => /* @__PURE__ */ o(
7
7
  viewBox: "0 0 24 24",
8
8
  fill: "none",
9
9
  xmlns: "http://www.w3.org/2000/svg",
10
- ...t,
10
+ ...e,
11
11
  children: /* @__PURE__ */ o(
12
12
  "path",
13
13
  {
@@ -19,7 +19,7 @@ const e = (t) => /* @__PURE__ */ o(
19
19
  }
20
20
  )
21
21
  }
22
- ), n = e;
22
+ ), n = t;
23
23
  export {
24
24
  n as default
25
25
  };
@@ -1 +1 @@
1
- {"version":3,"file":"check.js","sources":["../../../../src/assets/line-icons/icons/check.tsx"],"sourcesContent":["const CheckIcon: React.FC<React.SVGProps<SVGSVGElement>> = props => (\n <svg\n width=\"24\"\n height=\"24\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n {...props}\n >\n <path\n d=\"M18.6663 7L9.49967 16.1667L5.33301 12\"\n stroke=\"currentColor\"\n strokeWidth=\"1.66882\"\n strokeLinecap=\"square\"\n strokeLinejoin=\"round\"\n />\n </svg>\n);\n\nexport default CheckIcon;\n"],"names":["CheckIcon","props","jsx","TickIcon"],"mappings":";AAAA,MAAMA,IAAqD,CACzDC,MAAA,gBAAAC;AAAA,EAAC;AAAA,EAAA;AAAA,IACC,OAAM;AAAA,IACN,QAAO;AAAA,IACP,SAAQ;AAAA,IACR,MAAK;AAAA,IACL,OAAM;AAAA,IACL,GAAGD;AAAA,IAEJ,UAAA,gBAAAC;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,GAAE;AAAA,QACF,QAAO;AAAA,QACP,aAAY;AAAA,QACZ,eAAc;AAAA,QACd,gBAAe;AAAA,MAAA;AAAA,IACjB;AAAA,EAAA;AACF,GAGFC,IAAeH;"}
1
+ {"version":3,"file":"check.js","sources":["../../../../src/assets/line-icons/icons/check.tsx"],"sourcesContent":["const CheckIcon: React.FC<React.SVGProps<SVGSVGElement>> = props => (\n <svg\n width=\"24\"\n height=\"24\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n {...props}\n >\n <path\n d=\"M18.6663 7L9.49967 16.1667L5.33301 12\"\n stroke=\"currentColor\"\n strokeWidth=\"1.66882\"\n strokeLinecap=\"square\"\n strokeLinejoin=\"round\"\n />\n </svg>\n);\n\nexport default CheckIcon;\n"],"names":["CheckIcon","props","jsx","CheckIcon$1"],"mappings":";AAAA,MAAMA,IAAqD,CACzDC,MAAA,gBAAAC;AAAA,EAAC;AAAA,EAAA;AAAA,IACC,OAAM;AAAA,IACN,QAAO;AAAA,IACP,SAAQ;AAAA,IACR,MAAK;AAAA,IACL,OAAM;AAAA,IACL,GAAGD;AAAA,IAEJ,UAAA,gBAAAC;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,GAAE;AAAA,QACF,QAAO;AAAA,QACP,aAAY;AAAA,QACZ,eAAc;AAAA,QACd,gBAAe;AAAA,MAAA;AAAA,IACjB;AAAA,EAAA;AACF,GAGFC,IAAeH;"}
@@ -0,0 +1,32 @@
1
+ import { jsxs as o, jsx as H } from "react/jsx-runtime";
2
+ const l = (t) => /* @__PURE__ */ o(
3
+ "svg",
4
+ {
5
+ width: "10",
6
+ height: "5",
7
+ viewBox: "0 0 10 5",
8
+ fill: "none",
9
+ xmlns: "http://www.w3.org/2000/svg",
10
+ ...t,
11
+ children: [
12
+ /* @__PURE__ */ H(
13
+ "path",
14
+ {
15
+ d: "M0.416504 4.50065H1.24984V2.76851H3.14865V4.50065H3.98198V0.333984H3.14865V1.97089H1.24984V0.333984H0.416504V4.50065Z",
16
+ fill: "#2B2B2B"
17
+ }
18
+ ),
19
+ /* @__PURE__ */ H(
20
+ "path",
21
+ {
22
+ d: "M4.3634 0.333984L5.43483 4.50065H6.42887L7.14911 1.70303L7.8634 4.50065H8.85745L9.92887 0.333984H9.07768L8.35745 3.2566L7.59554 0.333984H6.69673L5.94078 3.23279L5.21459 0.333984H4.3634Z",
23
+ fill: "#2B2B2B"
24
+ }
25
+ )
26
+ ]
27
+ }
28
+ ), s = l;
29
+ export {
30
+ s as default
31
+ };
32
+ //# sourceMappingURL=hw.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hw.js","sources":["../../../../src/assets/line-icons/icons/hw.tsx"],"sourcesContent":["import React from 'react';\n\nconst HWIcon: React.FC<React.SVGProps<SVGSVGElement>> = props => {\n return (\n <svg\n width=\"10\"\n height=\"5\"\n viewBox=\"0 0 10 5\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n {...props}\n >\n <path\n d=\"M0.416504 4.50065H1.24984V2.76851H3.14865V4.50065H3.98198V0.333984H3.14865V1.97089H1.24984V0.333984H0.416504V4.50065Z\"\n fill=\"#2B2B2B\"\n />\n <path\n d=\"M4.3634 0.333984L5.43483 4.50065H6.42887L7.14911 1.70303L7.8634 4.50065H8.85745L9.92887 0.333984H9.07768L8.35745 3.2566L7.59554 0.333984H6.69673L5.94078 3.23279L5.21459 0.333984H4.3634Z\"\n fill=\"#2B2B2B\"\n />\n </svg>\n );\n};\n\nexport default HWIcon;\n"],"names":["HWIcon","props","jsxs","jsx","HWIcon$1"],"mappings":";AAEA,MAAMA,IAAkD,CAASC,MAE7D,gBAAAC;AAAA,EAAC;AAAA,EAAA;AAAA,IACC,OAAM;AAAA,IACN,QAAO;AAAA,IACP,SAAQ;AAAA,IACR,MAAK;AAAA,IACL,OAAM;AAAA,IACL,GAAGD;AAAA,IAEJ,UAAA;AAAA,MAAA,gBAAAE;AAAA,QAAC;AAAA,QAAA;AAAA,UACC,GAAE;AAAA,UACF,MAAK;AAAA,QAAA;AAAA,MACP;AAAA,MACA,gBAAAA;AAAA,QAAC;AAAA,QAAA;AAAA,UACC,GAAE;AAAA,UACF,MAAK;AAAA,QAAA;AAAA,MACP;AAAA,IAAA;AAAA,EAAA;AAAA,GAKNC,IAAeJ;"}
@@ -0,0 +1,51 @@
1
+ import { jsxs as l, jsx as r } from "react/jsx-runtime";
2
+ const e = (c) => /* @__PURE__ */ l(
3
+ "svg",
4
+ {
5
+ width: "20",
6
+ height: "20",
7
+ viewBox: "0 0 20 20",
8
+ fill: "none",
9
+ xmlns: "http://www.w3.org/2000/svg",
10
+ ...c,
11
+ children: [
12
+ /* @__PURE__ */ r(
13
+ "path",
14
+ {
15
+ d: "M4.84375 5.78632L4.84375 4.37218C4.84375 3.98865 5.15466 3.67773 5.53819 3.67773H7.11038",
16
+ stroke: "currentColor",
17
+ strokeWidth: "1.39167"
18
+ }
19
+ ),
20
+ /* @__PURE__ */ r(
21
+ "path",
22
+ {
23
+ d: "M14.6472 16.5289L17.3453 4.68253C17.4304 4.30858 17.1963 3.93638 16.8224 3.85121L10.0307 2.30435C9.67373 2.22305 9.31497 2.43282 9.21075 2.78377L8.31911 5.78642",
24
+ stroke: "currentColor",
25
+ strokeWidth: "1.39167"
26
+ }
27
+ ),
28
+ /* @__PURE__ */ r(
29
+ "rect",
30
+ {
31
+ x: "3.33325",
32
+ y: "7.59961",
33
+ width: "9.0665",
34
+ height: "9.0665",
35
+ rx: "0.694444",
36
+ fill: "#F6F6F6",
37
+ stroke: "currentColor",
38
+ strokeWidth: "1.39167"
39
+ }
40
+ ),
41
+ /* @__PURE__ */ r("circle", { cx: "6.29508", cy: "10.563", r: "0.695833", fill: "black" }),
42
+ /* @__PURE__ */ r("circle", { cx: "6.29508", cy: "13.7359", r: "0.695833", fill: "black" }),
43
+ /* @__PURE__ */ r("circle", { cx: "9.4689", cy: "10.563", r: "0.695833", fill: "black" }),
44
+ /* @__PURE__ */ r("circle", { cx: "9.4689", cy: "13.7359", r: "0.695833", fill: "black" })
45
+ ]
46
+ }
47
+ );
48
+ export {
49
+ e as default
50
+ };
51
+ //# sourceMappingURL=puzzle-icon.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"puzzle-icon.js","sources":["../../../../src/assets/line-icons/icons/puzzle-icon.tsx"],"sourcesContent":["const PuzzleIcon: React.FC<React.SVGProps<SVGSVGElement>> = props => (\n <svg\n width=\"20\"\n height=\"20\"\n viewBox=\"0 0 20 20\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n {...props}\n >\n <path\n d=\"M4.84375 5.78632L4.84375 4.37218C4.84375 3.98865 5.15466 3.67773 5.53819 3.67773H7.11038\"\n stroke=\"currentColor\"\n strokeWidth=\"1.39167\"\n />\n <path\n d=\"M14.6472 16.5289L17.3453 4.68253C17.4304 4.30858 17.1963 3.93638 16.8224 3.85121L10.0307 2.30435C9.67373 2.22305 9.31497 2.43282 9.21075 2.78377L8.31911 5.78642\"\n stroke=\"currentColor\"\n strokeWidth=\"1.39167\"\n />\n <rect\n x=\"3.33325\"\n y=\"7.59961\"\n width=\"9.0665\"\n height=\"9.0665\"\n rx=\"0.694444\"\n fill=\"#F6F6F6\"\n stroke=\"currentColor\"\n strokeWidth=\"1.39167\"\n />\n <circle cx=\"6.29508\" cy=\"10.563\" r=\"0.695833\" fill=\"black\" />\n <circle cx=\"6.29508\" cy=\"13.7359\" r=\"0.695833\" fill=\"black\" />\n <circle cx=\"9.4689\" cy=\"10.563\" r=\"0.695833\" fill=\"black\" />\n <circle cx=\"9.4689\" cy=\"13.7359\" r=\"0.695833\" fill=\"black\" />\n </svg>\n);\n\nexport default PuzzleIcon;\n"],"names":["PuzzleIcon","props","jsxs","jsx"],"mappings":";AAAA,MAAMA,IAAsD,CAC1DC,MAAA,gBAAAC;AAAA,EAAC;AAAA,EAAA;AAAA,IACC,OAAM;AAAA,IACN,QAAO;AAAA,IACP,SAAQ;AAAA,IACR,MAAK;AAAA,IACL,OAAM;AAAA,IACL,GAAGD;AAAA,IAEJ,UAAA;AAAA,MAAA,gBAAAE;AAAA,QAAC;AAAA,QAAA;AAAA,UACC,GAAE;AAAA,UACF,QAAO;AAAA,UACP,aAAY;AAAA,QAAA;AAAA,MACd;AAAA,MACA,gBAAAA;AAAA,QAAC;AAAA,QAAA;AAAA,UACC,GAAE;AAAA,UACF,QAAO;AAAA,UACP,aAAY;AAAA,QAAA;AAAA,MACd;AAAA,MACA,gBAAAA;AAAA,QAAC;AAAA,QAAA;AAAA,UACC,GAAE;AAAA,UACF,GAAE;AAAA,UACF,OAAM;AAAA,UACN,QAAO;AAAA,UACP,IAAG;AAAA,UACH,MAAK;AAAA,UACL,QAAO;AAAA,UACP,aAAY;AAAA,QAAA;AAAA,MACd;AAAA,MACA,gBAAAA,EAAC,YAAO,IAAG,WAAU,IAAG,UAAS,GAAE,YAAW,MAAK,QAAQ,CAAA;AAAA,MAC3D,gBAAAA,EAAC,YAAO,IAAG,WAAU,IAAG,WAAU,GAAE,YAAW,MAAK,QAAQ,CAAA;AAAA,MAC5D,gBAAAA,EAAC,YAAO,IAAG,UAAS,IAAG,UAAS,GAAE,YAAW,MAAK,QAAQ,CAAA;AAAA,MAC1D,gBAAAA,EAAC,YAAO,IAAG,UAAS,IAAG,WAAU,GAAE,YAAW,MAAK,QAAQ,CAAA;AAAA,IAAA;AAAA,EAAA;AAC7D;"}
@@ -0,0 +1,48 @@
1
+ import { jsxs as t, jsx as e } from "react/jsx-runtime";
2
+ const s = (o) => /* @__PURE__ */ t(
3
+ "svg",
4
+ {
5
+ width: "21",
6
+ height: "20",
7
+ viewBox: "0 0 21 20",
8
+ fill: "none",
9
+ xmlns: "http://www.w3.org/2000/svg",
10
+ ...o,
11
+ children: [
12
+ /* @__PURE__ */ e(
13
+ "path",
14
+ {
15
+ d: "M14.6667 10.6951V14.8618C14.6667 15.2301 14.5203 15.5834 14.2599 15.8439C13.9994 16.1043 13.6461 16.2507 13.2778 16.2507H5.63889C5.27053 16.2507 4.91726 16.1043 4.6568 15.8439C4.39633 15.5834 4.25 15.2301 4.25 14.8618V7.22287C4.25 6.85452 4.39633 6.50125 4.6568 6.24078C4.91726 5.98031 5.27053 5.83398 5.63889 5.83398H9.80556",
16
+ stroke: "#2B2B2B",
17
+ strokeWidth: "1.66667",
18
+ strokeLinecap: "square",
19
+ strokeLinejoin: "round"
20
+ }
21
+ ),
22
+ /* @__PURE__ */ e(
23
+ "path",
24
+ {
25
+ d: "M12.5835 3.75H16.7502V7.91667",
26
+ stroke: "#2B2B2B",
27
+ strokeWidth: "1.66667",
28
+ strokeLinecap: "square",
29
+ strokeLinejoin: "round"
30
+ }
31
+ ),
32
+ /* @__PURE__ */ e(
33
+ "path",
34
+ {
35
+ d: "M9.11133 11.3898L16.0558 4.44531",
36
+ stroke: "#2B2B2B",
37
+ strokeWidth: "1.66667",
38
+ strokeLinecap: "square",
39
+ strokeLinejoin: "round"
40
+ }
41
+ )
42
+ ]
43
+ }
44
+ );
45
+ export {
46
+ s as default
47
+ };
48
+ //# sourceMappingURL=share.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"share.js","sources":["../../../../src/assets/line-icons/icons/share.tsx"],"sourcesContent":["const ShareIcon: React.FC<React.SVGProps<SVGSVGElement>> = props => (\n <svg\n width=\"21\"\n height=\"20\"\n viewBox=\"0 0 21 20\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n {...props}\n >\n <path\n d=\"M14.6667 10.6951V14.8618C14.6667 15.2301 14.5203 15.5834 14.2599 15.8439C13.9994 16.1043 13.6461 16.2507 13.2778 16.2507H5.63889C5.27053 16.2507 4.91726 16.1043 4.6568 15.8439C4.39633 15.5834 4.25 15.2301 4.25 14.8618V7.22287C4.25 6.85452 4.39633 6.50125 4.6568 6.24078C4.91726 5.98031 5.27053 5.83398 5.63889 5.83398H9.80556\"\n stroke=\"#2B2B2B\"\n strokeWidth=\"1.66667\"\n strokeLinecap=\"square\"\n strokeLinejoin=\"round\"\n />\n <path\n d=\"M12.5835 3.75H16.7502V7.91667\"\n stroke=\"#2B2B2B\"\n strokeWidth=\"1.66667\"\n strokeLinecap=\"square\"\n strokeLinejoin=\"round\"\n />\n <path\n d=\"M9.11133 11.3898L16.0558 4.44531\"\n stroke=\"#2B2B2B\"\n strokeWidth=\"1.66667\"\n strokeLinecap=\"square\"\n strokeLinejoin=\"round\"\n />\n </svg>\n);\n\nexport default ShareIcon;\n"],"names":["ShareIcon","props","jsxs","jsx"],"mappings":";AAAA,MAAMA,IAAqD,CACzDC,MAAA,gBAAAC;AAAA,EAAC;AAAA,EAAA;AAAA,IACC,OAAM;AAAA,IACN,QAAO;AAAA,IACP,SAAQ;AAAA,IACR,MAAK;AAAA,IACL,OAAM;AAAA,IACL,GAAGD;AAAA,IAEJ,UAAA;AAAA,MAAA,gBAAAE;AAAA,QAAC;AAAA,QAAA;AAAA,UACC,GAAE;AAAA,UACF,QAAO;AAAA,UACP,aAAY;AAAA,UACZ,eAAc;AAAA,UACd,gBAAe;AAAA,QAAA;AAAA,MACjB;AAAA,MACA,gBAAAA;AAAA,QAAC;AAAA,QAAA;AAAA,UACC,GAAE;AAAA,UACF,QAAO;AAAA,UACP,aAAY;AAAA,UACZ,eAAc;AAAA,UACd,gBAAe;AAAA,QAAA;AAAA,MACjB;AAAA,MACA,gBAAAA;AAAA,QAAC;AAAA,QAAA;AAAA,UACC,GAAE;AAAA,UACF,QAAO;AAAA,UACP,aAAY;AAAA,UACZ,eAAc;AAAA,UACd,gBAAe;AAAA,QAAA;AAAA,MACjB;AAAA,IAAA;AAAA,EAAA;AACF;"}
@@ -0,0 +1,54 @@
1
+ import { jsxs as i, jsx as t } from "react/jsx-runtime";
2
+ const o = (e) => /* @__PURE__ */ i(
3
+ "svg",
4
+ {
5
+ className: "tile-icon",
6
+ width: "32",
7
+ height: "32",
8
+ viewBox: "0 0 32 32",
9
+ fill: "none",
10
+ xmlns: "http://www.w3.org/2000/svg",
11
+ ...e,
12
+ children: [
13
+ /* @__PURE__ */ t("rect", { x: "0.5", y: "0.5", width: "31", height: "31", rx: "15.5", fill: "white" }),
14
+ /* @__PURE__ */ t("rect", { x: "0.5", y: "0.5", width: "31", height: "31", rx: "15.5", stroke: "white" }),
15
+ /* @__PURE__ */ t(
16
+ "rect",
17
+ {
18
+ x: "8.5",
19
+ y: "16",
20
+ width: "5.83333",
21
+ height: "6.66667",
22
+ rx: "0.833333",
23
+ stroke: "#2B2B2B",
24
+ strokeWidth: "1.39167",
25
+ strokeLinejoin: "round"
26
+ }
27
+ ),
28
+ /* @__PURE__ */ t(
29
+ "circle",
30
+ {
31
+ cx: "20.1667",
32
+ cy: "19.2542",
33
+ r: "3.33333",
34
+ stroke: "#2B2B2B",
35
+ strokeWidth: "1.39167",
36
+ strokeLinejoin: "round"
37
+ }
38
+ ),
39
+ /* @__PURE__ */ t(
40
+ "path",
41
+ {
42
+ d: "M18.8222 13.6583H11.7094C10.9896 13.6583 10.6084 12.8073 11.0875 12.2702L14.644 8.28391C14.9753 7.91249 15.5563 7.9125 15.8876 8.28391L19.444 12.2702C19.9232 12.8073 19.542 13.6583 18.8222 13.6583Z",
43
+ stroke: "#2B2B2B",
44
+ strokeWidth: "1.39167",
45
+ strokeLinejoin: "round"
46
+ }
47
+ )
48
+ ]
49
+ }
50
+ );
51
+ export {
52
+ o as default
53
+ };
54
+ //# sourceMappingURL=tile.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tile.js","sources":["../../../../src/assets/line-icons/icons/tile.tsx"],"sourcesContent":["const TileIcon: React.FC<React.SVGProps<SVGSVGElement>> = props => (\n <svg\n className=\"tile-icon\"\n width=\"32\"\n height=\"32\"\n viewBox=\"0 0 32 32\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n {...props}\n >\n <rect x=\"0.5\" y=\"0.5\" width=\"31\" height=\"31\" rx=\"15.5\" fill=\"white\" />\n <rect x=\"0.5\" y=\"0.5\" width=\"31\" height=\"31\" rx=\"15.5\" stroke=\"white\" />\n <rect\n x=\"8.5\"\n y=\"16\"\n width=\"5.83333\"\n height=\"6.66667\"\n rx=\"0.833333\"\n stroke=\"#2B2B2B\"\n strokeWidth=\"1.39167\"\n strokeLinejoin=\"round\"\n />\n <circle\n cx=\"20.1667\"\n cy=\"19.2542\"\n r=\"3.33333\"\n stroke=\"#2B2B2B\"\n strokeWidth=\"1.39167\"\n strokeLinejoin=\"round\"\n />\n <path\n d=\"M18.8222 13.6583H11.7094C10.9896 13.6583 10.6084 12.8073 11.0875 12.2702L14.644 8.28391C14.9753 7.91249 15.5563 7.9125 15.8876 8.28391L19.444 12.2702C19.9232 12.8073 19.542 13.6583 18.8222 13.6583Z\"\n stroke=\"#2B2B2B\"\n strokeWidth=\"1.39167\"\n strokeLinejoin=\"round\"\n />\n </svg>\n);\n\nexport default TileIcon;\n"],"names":["TileIcon","props","jsxs","jsx"],"mappings":";AAAA,MAAMA,IAAoD,CACxDC,MAAA,gBAAAC;AAAA,EAAC;AAAA,EAAA;AAAA,IACC,WAAU;AAAA,IACV,OAAM;AAAA,IACN,QAAO;AAAA,IACP,SAAQ;AAAA,IACR,MAAK;AAAA,IACL,OAAM;AAAA,IACL,GAAGD;AAAA,IAEJ,UAAA;AAAA,MAAA,gBAAAE,EAAC,QAAK,EAAA,GAAE,OAAM,GAAE,OAAM,OAAM,MAAK,QAAO,MAAK,IAAG,QAAO,MAAK,SAAQ;AAAA,MACnE,gBAAAA,EAAA,QAAA,EAAK,GAAE,OAAM,GAAE,OAAM,OAAM,MAAK,QAAO,MAAK,IAAG,QAAO,QAAO,SAAQ;AAAA,MACtE,gBAAAA;AAAA,QAAC;AAAA,QAAA;AAAA,UACC,GAAE;AAAA,UACF,GAAE;AAAA,UACF,OAAM;AAAA,UACN,QAAO;AAAA,UACP,IAAG;AAAA,UACH,QAAO;AAAA,UACP,aAAY;AAAA,UACZ,gBAAe;AAAA,QAAA;AAAA,MACjB;AAAA,MACA,gBAAAA;AAAA,QAAC;AAAA,QAAA;AAAA,UACC,IAAG;AAAA,UACH,IAAG;AAAA,UACH,GAAE;AAAA,UACF,QAAO;AAAA,UACP,aAAY;AAAA,UACZ,gBAAe;AAAA,QAAA;AAAA,MACjB;AAAA,MACA,gBAAAA;AAAA,QAAC;AAAA,QAAA;AAAA,UACC,GAAE;AAAA,UACF,QAAO;AAAA,UACP,aAAY;AAAA,UACZ,gBAAe;AAAA,QAAA;AAAA,MACjB;AAAA,IAAA;AAAA,EAAA;AACF;"}
@@ -0,0 +1,58 @@
1
+ import { jsxs as p, jsx as a } from "react/jsx-runtime";
2
+ import { memo as u, useCallback as s } from "react";
3
+ import h from "../../../assets/line-icons/icons/check.js";
4
+ import C from "../../../assets/line-icons/icons/share.js";
5
+ import m from "../../ui/buttons/button/button.js";
6
+ import w from "../../ui/layout/flex-view.js";
7
+ import b from "../../ui/separator/separator.js";
8
+ import { dataURIToBlob as k } from "../cue-canvas-helpers.js";
9
+ import { useCueCanvasActions as g } from "../hooks/use-cue-canvas-actions.js";
10
+ const I = (c) => {
11
+ const { width: l, onMarkAsResolved: r, onSendImageToChat: t } = c, { homeworkId: o, activeInstance: e } = g(), i = s(async () => {
12
+ if (!e) return;
13
+ const n = await (e == null ? void 0 : e.getCanvasAsImage());
14
+ return n ? k(n) : void 0;
15
+ }, [e]), d = s(async () => {
16
+ const n = await i();
17
+ !o || !t || !n || t == null || t(o, n);
18
+ }, [i, o, t]), f = s(() => {
19
+ !o || !r || r == null || r(o);
20
+ }, [o, r]);
21
+ return o ? /* @__PURE__ */ p(
22
+ w,
23
+ {
24
+ $flexDirection: "row",
25
+ $gapX: 1,
26
+ $gutterX: 0.5,
27
+ $alignItems: "center",
28
+ $justifyContent: "center",
29
+ $width: l,
30
+ $background: "YELLOW_1",
31
+ children: [
32
+ /* @__PURE__ */ a(
33
+ m,
34
+ {
35
+ label: "Mark as reolved",
36
+ onClick: f,
37
+ renderAs: "primary",
38
+ Icon: h
39
+ }
40
+ ),
41
+ /* @__PURE__ */ a(b, { width: 16 }),
42
+ /* @__PURE__ */ a(
43
+ m,
44
+ {
45
+ label: "Send CueBoard image to chat",
46
+ onClick: d,
47
+ renderAs: "primary",
48
+ Icon: C
49
+ }
50
+ )
51
+ ]
52
+ }
53
+ ) : null;
54
+ }, D = u(I);
55
+ export {
56
+ D as default
57
+ };
58
+ //# sourceMappingURL=homework-controls.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"homework-controls.js","sources":["../../../../src/features/cue-canvas/bottombar/homework-controls.tsx"],"sourcesContent":["import type { IHomeWorkControllerProps } from './bottombar-types';\nimport type { FC } from 'react';\n\nimport { memo, useCallback } from 'react';\n\nimport CheckIcon from '../../../assets/line-icons/icons/check';\nimport ShareIcon from '../../../assets/line-icons/icons/share';\nimport Button from '../../ui/buttons/button/button';\nimport FlexView from '../../ui/layout/flex-view';\nimport Separator from '../../ui/separator/separator';\nimport { dataURIToBlob } from '../cue-canvas-helpers';\nimport { useCueCanvasActions } from '../hooks/use-cue-canvas-actions';\n\nconst HomeworkController: FC<IHomeWorkControllerProps> = props => {\n const { width, onMarkAsResolved, onSendImageToChat } = props;\n const { homeworkId, activeInstance } = useCueCanvasActions();\n\n const getBoardSnapshot = useCallback(async () => {\n if (!activeInstance) return;\n\n const snapshot = await activeInstance?.getCanvasAsImage();\n\n if (!snapshot) {\n return;\n }\n\n const blobdata = dataURIToBlob(snapshot);\n\n return blobdata;\n }, [activeInstance]);\n\n const handleSendImageToChat = useCallback(async () => {\n const snapshot = await getBoardSnapshot();\n\n if (!homeworkId || !onSendImageToChat || !snapshot) return;\n\n onSendImageToChat?.(homeworkId, snapshot);\n }, [getBoardSnapshot, homeworkId, onSendImageToChat]);\n\n const handleMarkAsResolved = useCallback(() => {\n if (!homeworkId || !onMarkAsResolved) return;\n onMarkAsResolved?.(homeworkId);\n }, [homeworkId, onMarkAsResolved]);\n\n if (!homeworkId) return null;\n\n return (\n <FlexView\n $flexDirection=\"row\"\n $gapX={1}\n $gutterX={0.5}\n $alignItems=\"center\"\n $justifyContent=\"center\"\n $width={width}\n $background=\"YELLOW_1\"\n >\n <Button\n label=\"Mark as reolved\"\n onClick={handleMarkAsResolved}\n renderAs={'primary'}\n Icon={CheckIcon}\n />\n <Separator width={16} />\n <Button\n label=\"Send CueBoard image to chat\"\n onClick={handleSendImageToChat}\n renderAs={'primary'}\n Icon={ShareIcon}\n />\n </FlexView>\n );\n};\n\nexport default memo(HomeworkController);\n"],"names":["HomeworkController","props","width","onMarkAsResolved","onSendImageToChat","homeworkId","activeInstance","useCueCanvasActions","getBoardSnapshot","useCallback","snapshot","dataURIToBlob","handleSendImageToChat","handleMarkAsResolved","jsxs","FlexView","jsx","Button","CheckIcon","Separator","ShareIcon","homeworkControls","memo"],"mappings":";;;;;;;;;AAaA,MAAMA,IAAmD,CAASC,MAAA;AAChE,QAAM,EAAE,OAAAC,GAAO,kBAAAC,GAAkB,mBAAAC,EAAA,IAAsBH,GACjD,EAAE,YAAAI,GAAY,gBAAAC,EAAe,IAAIC,EAAoB,GAErDC,IAAmBC,EAAY,YAAY;AAC/C,QAAI,CAACH,EAAgB;AAEf,UAAAI,IAAW,OAAMJ,KAAA,gBAAAA,EAAgB;AAEvC,WAAKI,IAIYC,EAAcD,CAAQ,IAHrC;AAAA,EAKK,GACN,CAACJ,CAAc,CAAC,GAEbM,IAAwBH,EAAY,YAAY;AAC9C,UAAAC,IAAW,MAAMF;AAEvB,IAAI,CAACH,KAAc,CAACD,KAAqB,CAACM,KAE1CN,KAAA,QAAAA,EAAoBC,GAAYK;AAAA,EAC/B,GAAA,CAACF,GAAkBH,GAAYD,CAAiB,CAAC,GAE9CS,IAAuBJ,EAAY,MAAM;AACzC,IAAA,CAACJ,KAAc,CAACF,KACpBA,KAAA,QAAAA,EAAmBE;AAAA,EAAU,GAC5B,CAACA,GAAYF,CAAgB,CAAC;AAE7B,SAACE,IAGH,gBAAAS;AAAA,IAACC;AAAA,IAAA;AAAA,MACC,gBAAe;AAAA,MACf,OAAO;AAAA,MACP,UAAU;AAAA,MACV,aAAY;AAAA,MACZ,iBAAgB;AAAA,MAChB,QAAQb;AAAA,MACR,aAAY;AAAA,MAEZ,UAAA;AAAA,QAAA,gBAAAc;AAAA,UAACC;AAAA,UAAA;AAAA,YACC,OAAM;AAAA,YACN,SAASJ;AAAA,YACT,UAAU;AAAA,YACV,MAAMK;AAAA,UAAA;AAAA,QACR;AAAA,QACA,gBAAAF,EAACG,GAAU,EAAA,OAAO,GAAI,CAAA;AAAA,QACtB,gBAAAH;AAAA,UAACC;AAAA,UAAA;AAAA,YACC,OAAM;AAAA,YACN,SAASL;AAAA,YACT,UAAU;AAAA,YACV,MAAMQ;AAAA,UAAA;AAAA,QACR;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA,IAxBoB;AA2B1B,GAEeC,IAAAC,EAAKtB,CAAkB;"}
@@ -1,17 +1,17 @@
1
- import { createContext as e } from "react";
2
- import { CANVAS_COLORS as t } from "./constants/constants.js";
3
- const v = e({
1
+ import { createContext as o } from "react";
2
+ import { CANVAS_COLORS as e } from "./constants/constants.js";
3
+ const v = o({
4
4
  activeInstance: void 0,
5
5
  setActiveInstance: () => {
6
6
  },
7
7
  activeTool: "pen",
8
8
  setActiveTool: () => {
9
9
  },
10
- activeColor: Object.keys(t)[0],
10
+ activeColor: Object.keys(e)[0],
11
11
  setActiveColor: () => {
12
12
  },
13
- activeSidebar: void 0,
14
- setActiveSidebar: () => {
13
+ homeworkId: void 0,
14
+ setHomeworkId: () => {
15
15
  }
16
16
  });
17
17
  export {
@@ -1 +1 @@
1
- {"version":3,"file":"cue-canvas-context.js","sources":["../../../src/features/cue-canvas/cue-canvas-context.tsx"],"sourcesContent":["import type { TPolyContextValue } from './types/context';\nimport type { TCueCanvasColors } from './types/cue-canvas';\n\nimport { createContext } from 'react';\n\nimport { CANVAS_COLORS } from './constants/constants';\n\nconst PolyContext = createContext<TPolyContextValue>({\n activeInstance: undefined,\n setActiveInstance: () => undefined,\n activeTool: 'pen',\n setActiveTool: () => undefined,\n activeColor: Object.keys(CANVAS_COLORS)[0] as TCueCanvasColors,\n setActiveColor: () => undefined,\n activeSidebar: undefined,\n setActiveSidebar: () => undefined,\n});\n\nexport default PolyContext;\n"],"names":["PolyContext","createContext","CANVAS_COLORS"],"mappings":";;AAOA,MAAMA,IAAcC,EAAiC;AAAA,EACnD,gBAAgB;AAAA,EAChB,mBAAmB,MAAM;AAAA;AAAA,EACzB,YAAY;AAAA,EACZ,eAAe,MAAM;AAAA;AAAA,EACrB,aAAa,OAAO,KAAKC,CAAa,EAAE,CAAC;AAAA,EACzC,gBAAgB,MAAM;AAAA;AAAA,EACtB,eAAe;AAAA,EACf,kBAAkB,MAAM;AAAA;AAC1B,CAAC;"}
1
+ {"version":3,"file":"cue-canvas-context.js","sources":["../../../src/features/cue-canvas/cue-canvas-context.tsx"],"sourcesContent":["import type { TPolyContextValue } from './types/context';\nimport type { TCueCanvasColors } from './types/cue-canvas';\n\nimport { createContext } from 'react';\n\nimport { CANVAS_COLORS } from './constants/constants';\n\nconst PolyContext = createContext<TPolyContextValue>({\n activeInstance: undefined,\n setActiveInstance: () => undefined,\n activeTool: 'pen',\n setActiveTool: () => undefined,\n activeColor: Object.keys(CANVAS_COLORS)[0] as TCueCanvasColors,\n setActiveColor: () => undefined,\n homeworkId: undefined,\n setHomeworkId: () => undefined,\n});\n\nexport default PolyContext;\n"],"names":["PolyContext","createContext","CANVAS_COLORS"],"mappings":";;AAOA,MAAMA,IAAcC,EAAiC;AAAA,EACnD,gBAAgB;AAAA,EAChB,mBAAmB,MAAM;AAAA;AAAA,EACzB,YAAY;AAAA,EACZ,eAAe,MAAM;AAAA;AAAA,EACrB,aAAa,OAAO,KAAKC,CAAa,EAAE,CAAC;AAAA,EACzC,gBAAgB,MAAM;AAAA;AAAA,EACtB,YAAY;AAAA,EACZ,eAAe,MAAM;AAAA;AACvB,CAAC;"}
@@ -1,38 +1,49 @@
1
1
  var d = Object.defineProperty;
2
- var u = (l, t, e) => t in l ? d(l, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : l[t] = e;
3
- var s = (l, t, e) => u(l, typeof t != "symbol" ? t + "" : t, e);
2
+ var u = (r, t, e) => t in r ? d(r, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : r[t] = e;
3
+ var s = (r, t, e) => u(r, typeof t != "symbol" ? t + "" : t, e);
4
4
  import v from "../../node_modules/lodash.debounce/index.js";
5
- import { removeTileButton as f, removeMask as g, checkTextOrEquationTool as y, getReverseMap as m, getToolAndSubtool as C } from "./cue-canvas-helpers.js";
6
- class I {
7
- constructor(t, e, i, n, a, o, r, h, c, p) {
5
+ import { removeTileButton as g, removeMask as f, checkTextOrEquationTool as y, getReverseMap as m, getToolAndSubtool as C } from "./cue-canvas-helpers.js";
6
+ class b {
7
+ constructor({
8
+ onPublish: t,
9
+ onSubscribe: e,
10
+ onUpdateActiveTool: a,
11
+ onUpdateHeight: n,
12
+ uploadImageToS3: i,
13
+ height: o,
14
+ userId: h,
15
+ canvasId: l,
16
+ userType: c,
17
+ renderAs: p
18
+ }) {
8
19
  s(this, "polycanvas");
9
20
  s(this, "publish");
10
21
  s(this, "height");
11
22
  s(this, "onUpdateActiveTool");
12
23
  s(this, "onUpdateHeight");
13
24
  s(this, "userId");
14
- s(this, "responseId");
25
+ s(this, "canvasId");
15
26
  s(this, "userType");
16
27
  s(this, "renderAs");
17
28
  s(this, "fileInput", null);
18
29
  s(this, "debouncedViewportChange");
19
30
  s(this, "uploadImageToS3");
20
- s(this, "publishToChannel", (t, e, i) => {
31
+ s(this, "publishToChannel", (t, e, a) => {
21
32
  this.publish && this.publish({
22
33
  eventName: "cue_canvas_changed",
23
34
  eventPayload: {
24
35
  data: t,
25
36
  height: this.height,
26
37
  userId: this.userId,
27
- responseId: this.responseId,
38
+ responseId: this.canvasId,
28
39
  gridName: e,
29
- dimension: i
40
+ dimension: a
30
41
  }
31
42
  });
32
43
  });
33
44
  s(this, "onChange", (t) => {
34
- const i = Object.fromEntries(t.entries());
35
- y(i) && this.onUpdateActiveTool("move"), this.publishToChannel(i);
45
+ const a = Object.fromEntries(t.entries());
46
+ y(a) && this.onUpdateActiveTool("move"), this.publishToChannel(a);
36
47
  });
37
48
  s(this, "undo", () => {
38
49
  if (!this.polycanvas)
@@ -62,6 +73,7 @@ class I {
62
73
  const t = this.polycanvas.getViewport();
63
74
  this.polycanvas.setViewport(t.x, t.y, t.zoom * 0.9);
64
75
  });
76
+ s(this, "getCanvasAsImage", async () => this.polycanvas ? await this.polycanvas.image(3e3, 3e3, "png") : void 0);
65
77
  s(this, "downloadCanvasAsImage", async () => {
66
78
  if (!this.polycanvas) return;
67
79
  const t = await this.polycanvas.image(3e3, 3e3, "png");
@@ -69,8 +81,8 @@ class I {
69
81
  const e = document.createElement("a");
70
82
  e.href = t, e.download = `canvas-drawing-${Date.now()}.png`, e.click();
71
83
  });
72
- s(this, "uploadFileToCanvas", async (t) => new Promise((e, i) => {
73
- this.uploadImageToS3 ? e(this.uploadImageToS3(t)) : i(new Error("Upload function not provided"));
84
+ s(this, "uploadFileToCanvas", async (t) => new Promise((e, a) => {
85
+ this.uploadImageToS3 ? e(this.uploadImageToS3(t)) : a(new Error("Upload function not provided"));
74
86
  }));
75
87
  s(this, "onViewPortChange", (t) => {
76
88
  if (!this.publish) return;
@@ -78,34 +90,39 @@ class I {
78
90
  this.publishToChannel({}, void 0, e);
79
91
  });
80
92
  s(this, "openFileUpload", () => {
81
- this.fileInput || (this.fileInput = document.createElement("input"), this.fileInput.type = "file", this.fileInput.accept = "image/*", this.fileInput.style.display = "none", this.fileInput.onchange = this.addImageToCanvas, document.body.appendChild(this.fileInput)), this.fileInput.click();
93
+ this.fileInput || (this.fileInput = document.createElement("input"), this.fileInput.type = "file", this.fileInput.accept = "image/*", this.fileInput.style.display = "none", this.fileInput.onchange = this.onSelectImage, document.body.appendChild(this.fileInput)), this.fileInput.click();
82
94
  });
83
- s(this, "addImageToCanvas", async (t) => {
84
- var h;
85
- const e = t.target, i = (h = e.files) == null ? void 0 : h[0];
86
- if (!i || !this.polycanvas || !this.uploadImageToS3) return;
87
- const n = await this.uploadImageToS3(i), a = this.polycanvas.getViewport(), o = {
95
+ s(this, "addImageToCanvas", (t) => {
96
+ if (!this.polycanvas) return;
97
+ const e = this.polycanvas.getViewport(), a = {
88
98
  name: "image",
89
- href: n,
90
- x: a.x + 88,
91
- y: a.y + 88
92
- }, r = this.polycanvas.add({
93
- ...o
99
+ href: t,
100
+ x: e.x + 88,
101
+ y: e.y + 88
102
+ }, n = this.polycanvas.add({
103
+ ...a
94
104
  });
95
105
  this.publishToChannel({
96
- [r]: [void 0, { ...o, status: "locked" }]
97
- }), e.value = "";
106
+ [n]: [void 0, { ...a, status: "locked" }]
107
+ });
98
108
  });
99
- s(this, "updateCanvasConfig", (t, e, i) => {
100
- this.polycanvas && (t > this.height && this.updateHeight(t), e && this.polycanvas.setViewport(e.x, e.y, e.zoom), i && this.polycanvas.setOptions({
101
- grid: i
109
+ s(this, "onSelectImage", async (t) => {
110
+ var i;
111
+ const e = t.target, a = (i = e.files) == null ? void 0 : i[0];
112
+ if (!a || !this.polycanvas || !this.uploadImageToS3) return;
113
+ const n = await this.uploadImageToS3(a);
114
+ this.addImageToCanvas(n), e.value = "";
115
+ });
116
+ s(this, "updateCanvasConfig", (t, e, a) => {
117
+ this.polycanvas && (t > this.height && this.updateHeight(t), e && this.polycanvas.setViewport(e.x, e.y, e.zoom), a && this.polycanvas.setOptions({
118
+ grid: a
102
119
  }));
103
120
  });
104
121
  s(this, "updateCanvas", ({ data: t, userId: e }) => {
105
- const i = this.userType === "TEACHER" || e === this.userId;
106
- Object.entries(t).forEach(([n, a]) => {
107
- var o, r, h;
108
- !a[0] && a[1] ? (o = this.polycanvas) == null || o.add({ ...a[1], cannotEdit: !i }, n) : a[0] && !a[1] ? (r = this.polycanvas) == null || r.delete(n) : a[0] && a[1] && ((h = this.polycanvas) == null || h.update(n, { ...a[1] }));
122
+ const a = this.userType === "TEACHER" || e === this.userId;
123
+ Object.entries(t).forEach(([n, i]) => {
124
+ var o, h, l;
125
+ !i[0] && i[1] ? (o = this.polycanvas) == null || o.add({ ...i[1], cannotEdit: !a }, n) : i[0] && !i[1] ? (h = this.polycanvas) == null || h.delete(n) : i[0] && i[1] && ((l = this.polycanvas) == null || l.update(n, { ...i[1] }));
109
126
  });
110
127
  });
111
128
  s(this, "toggleTiles", (t) => {
@@ -121,31 +138,44 @@ class I {
121
138
  }), this.publishToChannel({}, t));
122
139
  });
123
140
  s(this, "lockSelectedTiles", () => {
124
- var i, n;
125
- const { tiles: t } = ((i = this.polycanvas) == null ? void 0 : i.serialize()) || {}, e = ((n = this.polycanvas) == null ? void 0 : n.getSelection()) || [];
141
+ var a, n;
142
+ const { tiles: t } = ((a = this.polycanvas) == null ? void 0 : a.serialize()) || {}, e = ((n = this.polycanvas) == null ? void 0 : n.getSelection()) || [];
126
143
  if (e.length > 0 && t) {
127
- const a = {};
144
+ const i = {};
128
145
  e.forEach((o) => {
129
- var h, c, p;
130
- if (!((h = t[o]) != null && h.name)) return;
131
- const r = { ...t[o], status: "locked" };
132
- (c = this.polycanvas) == null || c.update(o, r), (p = t[o]) != null && p.name && (a[o] = [t[o], r]);
133
- }), this.publishToChannel(a);
146
+ var l, c, p;
147
+ if (!((l = t[o]) != null && l.name)) return;
148
+ const h = { ...t[o], status: "locked" };
149
+ (c = this.polycanvas) == null || c.update(o, h), (p = t[o]) != null && p.name && (i[o] = [t[o], h]);
150
+ }), this.publishToChannel(i);
134
151
  }
135
152
  });
136
153
  s(this, "unlockAllTiles", () => {
137
154
  if (!this.polycanvas) return;
138
155
  const { tiles: t } = this.polycanvas.serialize(), e = {};
139
- t && Object.entries(t).length > 0 && (Object.entries(t).forEach(([i, n]) => {
156
+ t && Object.entries(t).length > 0 && (Object.entries(t).forEach(([a, n]) => {
140
157
  var o;
141
158
  if (n.status !== "locked") return;
142
- const a = { ...n, status: void 0 };
143
- (o = this.polycanvas) == null || o.update(i, a), e[i] = [n, a];
159
+ const i = { ...n, status: void 0 };
160
+ (o = this.polycanvas) == null || o.update(a, i), e[a] = [n, i];
144
161
  }), this.publishToChannel(e));
145
162
  });
163
+ s(this, "replaceCanvas", (t) => {
164
+ if (!this.polycanvas) return;
165
+ const { data: e, gridName: a } = t;
166
+ this.polycanvas.clear(), a && this.polycanvas.setOptions({
167
+ grid: a
168
+ }), Object.entries(e).forEach(([n, i]) => {
169
+ var o;
170
+ if (!i[0] && i[1]) {
171
+ (o = this.polycanvas) == null || o.add({ ...i[1] }, n);
172
+ return;
173
+ }
174
+ }), this.publishToChannel(e, a);
175
+ });
146
176
  s(this, "setTool", (t) => {
147
177
  if (this.polycanvas) {
148
- const [e, i] = C(t);
178
+ const [e, a] = C(t);
149
179
  switch (e) {
150
180
  case "clearAll":
151
181
  this.clearCanvas();
@@ -180,7 +210,7 @@ class I {
180
210
  case "grid":
181
211
  break;
182
212
  default:
183
- this.polycanvas.setTool(e, i);
213
+ this.polycanvas.setTool(e, a);
184
214
  }
185
215
  }
186
216
  });
@@ -198,8 +228,8 @@ class I {
198
228
  */
199
229
  s(this, "update", (t) => {
200
230
  if (Array.isArray(t)) {
201
- const e = t.map((o) => o.height).filter(Boolean), i = Math.max(...e), n = t.map((o) => o.dimension).filter(Boolean)[t.length - 1], a = t.map((o) => o.gridName).filter(Boolean)[t.length - 1];
202
- this.updateCanvasConfig(i, n, a), t.forEach((o) => this.updateCanvas(o));
231
+ const e = t.map((o) => o.height).filter(Boolean), a = Math.max(...e), n = t.map((o) => o.dimension).filter(Boolean)[t.length - 1], i = t.map((o) => o.gridName).filter(Boolean)[t.length - 1];
232
+ this.updateCanvasConfig(a, n, i), t.forEach((o) => this.updateCanvas(o));
203
233
  } else
204
234
  this.updateCanvasConfig(t.height, t.dimension, t == null ? void 0 : t.gridName), this.updateCanvas(t);
205
235
  });
@@ -207,26 +237,27 @@ class I {
207
237
  this.polycanvas && this.polycanvas.setColor(t);
208
238
  });
209
239
  s(this, "updateHeight", (t) => {
210
- this.height = t, this.onUpdateHeight(t);
240
+ var e;
241
+ this.height = t, (e = this.onUpdateHeight) == null || e.call(this, t);
211
242
  });
212
243
  s(this, "destroy", () => {
213
244
  this.polycanvas && (this.polycanvas.off("change", this.onChange), this.polycanvas.destroy(), this.debouncedViewportChange.cancel(), this.renderAs === "whiteboard" && this.userType === "TEACHER" && this.polycanvas.off("viewport", this.debouncedViewportChange), this.polycanvas = void 0, this.fileInput && this.fileInput.parentNode && (this.fileInput.parentNode.removeChild(this.fileInput), this.fileInput = null));
214
245
  });
215
- this.onUpdateHeight = n, this.onUpdateActiveTool = i, this.height = o, this.uploadImageToS3 = a, this.userId = r, this.responseId = h, this.publish = t, this.userType = c, this.renderAs = p, this.debouncedViewportChange = v(this.onViewPortChange, 300), e(this.responseId, this.update);
246
+ this.onUpdateHeight = n, this.onUpdateActiveTool = a, this.height = o, this.uploadImageToS3 = i, this.userId = h, this.canvasId = l, this.publish = t, this.userType = c, this.renderAs = p, this.debouncedViewportChange = v(this.onViewPortChange, 300), e == null || e(this.canvasId, this.update);
216
247
  }
217
- async create({ canvasElementRef: t, canvasConfig: e, canvasSetting: i, initialData: n }) {
248
+ async create({ canvasElementRef: t, canvasConfig: e, canvasSetting: a, initialData: n }) {
218
249
  if (!t.current)
219
250
  throw new Error("PolyCanvas: Div Element Not found for canvas");
220
251
  this.polycanvas = await window.Polypad.create(t.current, {
221
252
  initial: {
222
253
  options: e
223
254
  },
224
- ...i,
255
+ ...a,
225
256
  imageUpload: this.renderAs === "whiteboard" && this.userType === "TEACHER" ? this.uploadFileToCanvas : void 0
226
- }), this.renderAs === "whiteboard" && this.userType === "TEACHER" && (this.polycanvas.toggleSidebar(!1), f(t), this.polycanvas.on("viewport", this.debouncedViewportChange)), g(t), this.polycanvas.on("change", this.onChange), n && this.update(n);
257
+ }), this.renderAs === "whiteboard" && this.userType === "TEACHER" && (this.polycanvas.toggleSidebar(!1), g(t), this.polycanvas.on("viewport", this.debouncedViewportChange)), f(t), this.polycanvas.on("change", this.onChange), n && this.update(n);
227
258
  }
228
259
  }
229
260
  export {
230
- I as CueCanvasCore
261
+ b as CueCanvasCore
231
262
  };
232
263
  //# sourceMappingURL=cue-canvas-core.js.map