@marimo-team/islands 0.23.15-dev4 → 0.23.15-dev41

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 (92) hide show
  1. package/dist/{ConnectedDataExplorerComponent-CU4fZJzG.js → ConnectedDataExplorerComponent-7p7rt9iw.js} +4 -4
  2. package/dist/{ErrorBoundary-DE6tzZf-.js → ErrorBoundary-B_CAG7_e.js} +1 -1
  3. package/dist/{ImageComparisonComponent-CHrI72em.js → ImageComparisonComponent-1i5IBhon.js} +173 -129
  4. package/dist/assets/__vite-browser-external-CjNAy01L.js +1 -0
  5. package/dist/assets/worker-B3XPCb6y.js +98 -0
  6. package/dist/{chat-ui-DinOvbWu.js → chat-ui-C0z13gJB.js} +3111 -3111
  7. package/dist/{code-visibility-Dk8cVOny.js → code-visibility-COokQS5X.js} +946 -864
  8. package/dist/{constants-T20xxyNf.js → debounce-BOD3DbfP.js} +1 -24
  9. package/dist/{formats-Dzx4J_z1.js → formats-CitsMtUm.js} +1 -1
  10. package/dist/{glide-data-editor-CjTu7ukN.js → glide-data-editor-CwZz71BD.js} +3 -3
  11. package/dist/{html-to-image-_wGfk8V-.js → html-to-image-CEo5pRYw.js} +2291 -2250
  12. package/dist/{input-DtsN7xm-.js → input-BGPrFH3g.js} +2 -2
  13. package/dist/main.js +1297 -1201
  14. package/dist/{mermaid-BYqXy_NE.js → mermaid-UdmxG2PZ.js} +2 -2
  15. package/dist/{process-output-Mh4UrjwM.js → process-output-BOvvilRG.js} +1 -1
  16. package/dist/{reveal-component-B5DXLyO7.js → reveal-component-D3ySPwH5.js} +618 -605
  17. package/dist/{spec-Cz-Bj1JI.js → spec-DSs9v0xx.js} +1 -1
  18. package/dist/style.css +1 -1
  19. package/dist/{toDate-CWNNlFEX.js → toDate-BRJgtOGm.js} +14 -5
  20. package/dist/{useAsyncData-KfHB8wQR.js → useAsyncData-BSOyAbac.js} +1 -1
  21. package/dist/{useDeepCompareMemoize-nJMtxhm4.js → useDeepCompareMemoize-BTLeWzuR.js} +1 -1
  22. package/dist/{useLifecycle-DegSo0lV.js → useLifecycle-C6wHjkhW.js} +1 -1
  23. package/dist/{useTheme-6eZ3GOTS.js → useTheme-Df_vGflw.js} +62 -27
  24. package/dist/{vega-component-DzyyM9fc.js → vega-component-BAvmvTjO.js} +6 -6
  25. package/package.json +1 -1
  26. package/src/components/chat/__tests__/chat-utils.test.ts +244 -1
  27. package/src/components/chat/__tests__/message-queue.test.tsx +121 -0
  28. package/src/components/chat/chat-panel.tsx +196 -67
  29. package/src/components/chat/chat-utils.ts +111 -2
  30. package/src/components/editor/SortableCell.tsx +6 -2
  31. package/src/components/editor/__tests__/output-persistence.test.tsx +241 -0
  32. package/src/components/editor/actions/__tests__/pair-with-agent-commands.test.ts +153 -0
  33. package/src/components/editor/actions/pair-with-agent-commands.ts +109 -0
  34. package/src/components/editor/actions/pair-with-agent-modal.tsx +20 -64
  35. package/src/components/editor/ai/add-cell-with-ai.tsx +14 -5
  36. package/src/components/editor/ai/ai-completion-editor.tsx +4 -1
  37. package/src/components/editor/cell/cell-context-menu.tsx +7 -0
  38. package/src/components/editor/chrome/panels/packages-panel.tsx +11 -1
  39. package/src/components/editor/columns/__tests__/cell-column.test.tsx +105 -0
  40. package/src/components/editor/columns/cell-column.tsx +34 -4
  41. package/src/components/editor/columns/sortable-column.tsx +24 -4
  42. package/src/components/editor/file-tree/download.ts +46 -0
  43. package/src/components/editor/file-tree/file-explorer.tsx +3 -21
  44. package/src/components/editor/file-tree/file-viewer.tsx +4 -27
  45. package/src/components/editor/navigation/__tests__/navigation.test.ts +33 -0
  46. package/src/components/editor/navigation/navigation.ts +8 -1
  47. package/src/components/editor/notebook-cell.tsx +203 -106
  48. package/src/components/editor/renderers/__tests__/cells-renderer.test.tsx +66 -0
  49. package/src/components/editor/renderers/cell-array.tsx +26 -13
  50. package/src/components/editor/renderers/cells-renderer.tsx +8 -2
  51. package/src/components/editor/renderers/slides-layout/__tests__/plugin.test.ts +29 -0
  52. package/src/components/editor/renderers/slides-layout/types.ts +4 -0
  53. package/src/components/editor/renderers/vertical-layout/vertical-layout.tsx +19 -19
  54. package/src/components/slides/reveal-component.tsx +37 -4
  55. package/src/components/slides/slide-form.tsx +72 -0
  56. package/src/components/ui/toast.tsx +11 -3
  57. package/src/components/ui/toaster.tsx +65 -9
  58. package/src/core/cells/__tests__/utils.test.ts +59 -0
  59. package/src/core/cells/utils.ts +51 -0
  60. package/src/core/codemirror/completion/__tests__/signature-hint.test.ts +97 -3
  61. package/src/core/codemirror/completion/signature-hint.ts +78 -11
  62. package/src/core/constants.ts +6 -0
  63. package/src/core/islands/__tests__/bridge.test.ts +341 -46
  64. package/src/core/islands/__tests__/main.test.ts +176 -0
  65. package/src/core/islands/__tests__/parse.test.ts +105 -0
  66. package/src/core/islands/bootstrap.ts +8 -3
  67. package/src/core/islands/bridge.ts +116 -23
  68. package/src/core/islands/components/__tests__/web-components.test.tsx +214 -0
  69. package/src/core/islands/components/web-components.tsx +76 -15
  70. package/src/core/islands/constants.ts +1 -0
  71. package/src/core/islands/main.ts +69 -3
  72. package/src/core/islands/parse.ts +70 -23
  73. package/src/core/islands/worker/__tests__/controller.test.ts +173 -0
  74. package/src/core/islands/worker/worker.tsx +145 -57
  75. package/src/core/runtime/__tests__/runtime.test.ts +64 -0
  76. package/src/core/runtime/runtime.ts +30 -10
  77. package/src/core/wasm/worker/bootstrap.ts +113 -20
  78. package/src/css/app/Cell.css +10 -0
  79. package/src/hooks/__tests__/useHotkey.test.tsx +88 -0
  80. package/src/hooks/useHotkey.ts +29 -4
  81. package/src/plugins/impl/anywidget/__tests__/host.test.ts +6 -9
  82. package/src/plugins/impl/anywidget/__tests__/widget-binding.test.ts +22 -61
  83. package/src/plugins/impl/anywidget/model-proxy.ts +0 -13
  84. package/src/plugins/impl/anywidget/widget-binding.ts +4 -34
  85. package/src/plugins/impl/image-comparison/ImageComparisonComponent.tsx +53 -2
  86. package/src/plugins/impl/image-comparison/__tests__/ImageComparisonComponent.test.tsx +71 -0
  87. package/src/plugins/impl/matplotlib/__tests__/matplotlib-renderer.test.ts +71 -3
  88. package/src/plugins/impl/matplotlib/matplotlib-renderer.ts +1 -0
  89. package/src/theme/__tests__/useTheme.test.ts +68 -0
  90. package/src/theme/useTheme.ts +16 -1
  91. package/dist/assets/__vite-browser-external-BQCLNwri.js +0 -1
  92. package/dist/assets/worker-DAWRHcPq.js +0 -73
@@ -3,8 +3,8 @@ import { _ as Logger, c as Objects, g as cn, t as Button } from "./button-BacYv-
3
3
  import { t as require_react } from "./react-DA-nE2FX.js";
4
4
  import { t as require_compiler_runtime } from "./compiler-runtime-CEbnTgxf.js";
5
5
  import { u as createLucideIcon } from "./dist--2Bqjvs0.js";
6
- import { A as SquareFunction, t as augmentSpecWithData } from "./spec-Cz-Bj1JI.js";
7
- import { a as Type, c as Calendar, i as createReducerAndAtoms, o as ToggleLeft, r as Badge, s as Hash, t as useOnMount } from "./useLifecycle-DegSo0lV.js";
6
+ import { A as SquareFunction, t as augmentSpecWithData } from "./spec-DSs9v0xx.js";
7
+ import { a as Type, c as Calendar, i as createReducerAndAtoms, o as ToggleLeft, r as Badge, s as Hash, t as useOnMount } from "./useLifecycle-C6wHjkhW.js";
8
8
  import { a as ListFilter, t as $896ba0a80a8f4d36$export$85fd5fdf27bacc79 } from "./useDateFormatter-CMnRuVmN.js";
9
9
  import { a as SelectGroup, c as SelectSeparator, i as SelectContent, l as SelectTrigger, o as SelectItem, r as Select, s as SelectLabel, t as Strings, u as SelectValue, w as $a916eb452884faea$export$b7a616150fdb9f44 } from "./strings-Dq_j3Rxw.js";
10
10
  import "./react-dom-BTJzcVJ9.js";
@@ -13,14 +13,14 @@ import "./zod-CijjQh4u.js";
13
13
  import { n as ErrorBanner } from "./error-banner-DFPfz_Qf.js";
14
14
  import { t as Label } from "./label-WfTSU8L4.js";
15
15
  import { t as Tooltip } from "./tooltip-Czds6Qr8.js";
16
- import { C as createStore, S as atom, _ as Provider, n as useTheme, y as useAtomValue } from "./useTheme-6eZ3GOTS.js";
16
+ import { E as createStore, S as useAtomValue, T as atom, b as Provider, n as useTheme } from "./useTheme-Df_vGflw.js";
17
17
  import { t as invariant } from "./invariant-wRzNXIsJ.js";
18
18
  import "./vega-loader.browser-CZ-J8Py3.js";
19
19
  import { a as getContainerWidth, n as vegaLoadData, s as tooltipHandler } from "./loader-Boph2xIS.js";
20
20
  import { n as q, r as contains } from "./react-vega-B0sAlDTL.js";
21
21
  import "./defaultLocale-u-3osm0P.js";
22
22
  import "./defaultLocale-BoHTsDG6.js";
23
- import { t as useAsyncData } from "./useAsyncData-KfHB8wQR.js";
23
+ import { t as useAsyncData } from "./useAsyncData-BSOyAbac.js";
24
24
  var ChartColumnBig = createLucideIcon("chart-column-big", [
25
25
  ["path", {
26
26
  d: "M3 3v16a2 2 0 0 0 2 2h16",
@@ -4,7 +4,7 @@ import { t as require_react } from "./react-DA-nE2FX.js";
4
4
  import { t as require_compiler_runtime } from "./compiler-runtime-CEbnTgxf.js";
5
5
  import { u as createLucideIcon } from "./dist--2Bqjvs0.js";
6
6
  import { t as require_jsx_runtime } from "./jsx-runtime-DebpN0FN.js";
7
- import { n as Constants } from "./constants-T20xxyNf.js";
7
+ import { i as Constants } from "./useTheme-Df_vGflw.js";
8
8
  var Plus = createLucideIcon("plus", [["path", {
9
9
  d: "M5 12h14",
10
10
  key: "1ays0h"
@@ -5,100 +5,100 @@ import { t as require_jsx_runtime } from "./jsx-runtime-DebpN0FN.js";
5
5
  var require_dist$1 = /* @__PURE__ */ __commonJSMin((() => {
6
6
  (() => {
7
7
  var e = {
8
- 792: (e2, t2, n2) => {
9
- n2.d(t2, { Z: () => a });
10
- var r = n2(609), i = n2.n(r)()((function(e3) {
8
+ 792: (e2, i2, a2) => {
9
+ a2.d(i2, { Z: () => c });
10
+ var o = a2(609), s = a2.n(o)()((function(e3) {
11
11
  return e3[1];
12
12
  }));
13
- i.push([
13
+ s.push([
14
14
  e2.id,
15
15
  ':host{--divider-width: 1px;--divider-color: #fff;--divider-shadow: none;--default-handle-width: 50px;--default-handle-color: #fff;--default-handle-opacity: 1;--default-handle-shadow: none;--handle-position-start: 50%;position:relative;display:inline-block;overflow:hidden;line-height:0;direction:ltr}@media screen and (-webkit-min-device-pixel-ratio: 0)and (min-resolution: 0.001dpcm){:host{outline-offset:1px}}:host(:focus){outline:2px solid -webkit-focus-ring-color}::slotted(*){-webkit-user-drag:none;-khtml-user-drag:none;-moz-user-drag:none;-o-user-drag:none;user-drag:none;-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.first{position:absolute;left:0;top:0;right:0;line-height:normal;font-size:100%;max-height:100%;height:100%;width:100%;--exposure: 50%;--keyboard-transition-time: 0ms;--default-transition-time: 0ms;--transition-time: var(--default-transition-time)}.first .first-overlay-container{position:relative;clip-path:inset(0 var(--exposure) 0 0);transition:clip-path var(--transition-time);height:100%}.first .first-overlay{overflow:hidden;height:100%}.first.focused{will-change:clip-path}.first.focused .first-overlay-container{will-change:clip-path}.second{position:relative}.handle-container{transform:translateX(50%);position:absolute;top:0;right:var(--exposure);height:100%;transition:right var(--transition-time),bottom var(--transition-time)}.focused .handle-container{will-change:right}.divider{position:absolute;height:100%;width:100%;left:0;top:0;display:flex;align-items:center;justify-content:center;flex-direction:column}.divider:after{content:" ";display:block;height:100%;border-left-width:var(--divider-width);border-left-style:solid;border-left-color:var(--divider-color);box-shadow:var(--divider-shadow)}.handle{position:absolute;top:var(--handle-position-start);pointer-events:none;box-sizing:border-box;margin-left:1px;transform:translate(calc(-50% - 0.5px), -50%);line-height:0}.default-handle{width:var(--default-handle-width);opacity:var(--default-handle-opacity);transition:all 1s;filter:drop-shadow(var(--default-handle-shadow))}.default-handle path{stroke:var(--default-handle-color)}.vertical .first-overlay-container{clip-path:inset(0 0 var(--exposure) 0)}.vertical .handle-container{transform:translateY(50%);height:auto;top:unset;bottom:var(--exposure);width:100%;left:0;flex-direction:row}.vertical .divider:after{height:1px;width:100%;border-top-width:var(--divider-width);border-top-style:solid;border-top-color:var(--divider-color);border-left:0}.vertical .handle{top:auto;left:var(--handle-position-start);transform:translate(calc(-50% - 0.5px), -50%) rotate(90deg)}',
16
16
  ""
17
17
  ]);
18
- let a = i;
18
+ let c = s;
19
19
  },
20
20
  609: (e2) => {
21
21
  e2.exports = function(e3) {
22
- var t2 = [];
23
- return t2.toString = function() {
24
- return this.map((function(t3) {
25
- var n2 = e3(t3);
26
- return t3[2] ? `@media ${t3[2]} {${n2}}` : n2;
22
+ var i2 = [];
23
+ return i2.toString = function() {
24
+ return this.map((function(i3) {
25
+ var a2 = e3(i3);
26
+ return i3[2] ? `@media ${i3[2]} {${a2}}` : a2;
27
27
  })).join("");
28
- }, t2.i = function(e4, n2, r) {
28
+ }, i2.i = function(e4, a2, o) {
29
29
  typeof e4 == "string" && (e4 = [[
30
30
  null,
31
31
  e4,
32
32
  ""
33
33
  ]]);
34
- var i = {};
35
- if (r) for (var a = 0; a < this.length; a++) {
36
- var o = this[a][0];
37
- o != null && (i[o] = true);
34
+ var s = {};
35
+ if (o) for (var c = 0; c < this.length; c++) {
36
+ var l = this[c][0];
37
+ l != null && (s[l] = true);
38
38
  }
39
- for (var s = 0; s < e4.length; s++) {
40
- var c = [].concat(e4[s]);
41
- r && i[c[0]] || (n2 && (c[2] ? c[2] = `${n2} and ${c[2]}` : c[2] = n2), t2.push(c));
39
+ for (var u = 0; u < e4.length; u++) {
40
+ var d = [].concat(e4[u]);
41
+ o && s[d[0]] || (a2 && (d[2] ? d[2] = `${a2} and ${d[2]}` : d[2] = a2), i2.push(d));
42
42
  }
43
- }, t2;
43
+ }, i2;
44
44
  };
45
45
  }
46
- }, t = {};
47
- function n(r) {
48
- var i = t[r];
49
- if (i !== void 0) return i.exports;
50
- var a = t[r] = {
51
- id: r,
46
+ }, i = {};
47
+ function a(o) {
48
+ var s = i[o];
49
+ if (s !== void 0) return s.exports;
50
+ var c = i[o] = {
51
+ id: o,
52
52
  exports: {}
53
53
  };
54
- return e[r](a, a.exports, n), a.exports;
54
+ return e[o](c, c.exports, a), c.exports;
55
55
  }
56
- n.n = (e2) => {
57
- var t2 = e2 && e2.__esModule ? () => e2.default : () => e2;
58
- return n.d(t2, { a: t2 }), t2;
59
- }, n.d = (e2, t2) => {
60
- for (var r in t2) n.o(t2, r) && !n.o(e2, r) && Object.defineProperty(e2, r, {
56
+ a.n = (e2) => {
57
+ var i2 = e2 && e2.__esModule ? () => e2.default : () => e2;
58
+ return a.d(i2, { a: i2 }), i2;
59
+ }, a.d = (e2, i2) => {
60
+ for (var o in i2) a.o(i2, o) && !a.o(e2, o) && Object.defineProperty(e2, o, {
61
61
  enumerable: true,
62
- get: t2[r]
62
+ get: i2[o]
63
63
  });
64
- }, n.o = (e2, t2) => Object.prototype.hasOwnProperty.call(e2, t2), (() => {
65
- var e2 = n(792);
66
- let t2 = "rendered", r = (e3, t3) => {
67
- let n2 = e3.getBoundingClientRect(), r2, i2;
68
- return t3.type === "mousedown" ? (r2 = t3.clientX, i2 = t3.clientY) : (r2 = t3.touches[0].clientX, i2 = t3.touches[0].clientY), r2 >= n2.x && r2 <= n2.x + n2.width && i2 >= n2.y && i2 <= n2.y + n2.height;
69
- }, i, a = {
64
+ }, a.o = (e2, i2) => Object.prototype.hasOwnProperty.call(e2, i2), (() => {
65
+ var e2 = a(792);
66
+ let i2 = "rendered", o = (e3, i3) => {
67
+ let a2 = e3.getBoundingClientRect(), o2, s2;
68
+ return i3.type === "mousedown" ? (o2 = i3.clientX, s2 = i3.clientY) : (o2 = i3.touches[0].clientX, s2 = i3.touches[0].clientY), o2 >= a2.x && o2 <= a2.x + a2.width && s2 >= a2.y && s2 <= a2.y + a2.height;
69
+ }, s, c = {
70
70
  ArrowLeft: -1,
71
71
  ArrowRight: 1
72
- }, o = ["horizontal", "vertical"], s = (e3) => ({
72
+ }, l = ["horizontal", "vertical"], u = (e3) => ({
73
73
  x: e3.touches[0].pageX,
74
74
  y: e3.touches[0].pageY
75
- }), c = (e3) => ({
75
+ }), d = (e3) => ({
76
76
  x: e3.pageX,
77
77
  y: e3.pageY
78
- }), l = typeof window < "u" && (window == null ? void 0 : window.HTMLElement);
79
- typeof window < "u" && (window.document && (i = document.createElement("template"), i.innerHTML = '<div class="second" id="second"> <slot name="second"><slot name="before"></slot></slot> </div> <div class="first" id="first"> <div class="first-overlay"> <div class="first-overlay-container" id="firstImageContainer"> <slot name="first"><slot name="after"></slot></slot> </div> </div> <div class="handle-container"> <div class="divider"></div> <div class="handle" id="handle"> <slot name="handle"> <svg xmlns="http://www.w3.org/2000/svg" class="default-handle" viewBox="-8 -3 16 6"> <path d="M -5 -2 L -7 0 L -5 2 M 5 -2 L 7 0 L 5 2" fill="none" vector-effect="non-scaling-stroke"/> </svg> </slot> </div> </div> </div> '), window.customElements.define("img-comparison-slider", class extends l {
78
+ }), f = typeof window < "u" && (window == null ? void 0 : window.HTMLElement);
79
+ typeof window < "u" && (window.document && (s = document.createElement("template"), s.innerHTML = '<div class="second" id="second"> <slot name="second"><slot name="before"></slot></slot> </div> <div class="first" id="first"> <div class="first-overlay"> <div class="first-overlay-container" id="firstImageContainer"> <slot name="first"><slot name="after"></slot></slot> </div> </div> <div class="handle-container"> <div class="divider"></div> <div class="handle" id="handle"> <slot name="handle"> <svg xmlns="http://www.w3.org/2000/svg" class="default-handle" viewBox="-8 -3 16 6"> <path d="M -5 -2 L -7 0 L -5 2 M 5 -2 L 7 0 L 5 2" fill="none" vector-effect="non-scaling-stroke"/> </svg> </slot> </div> </div> </div> '), window.customElements.define("img-comparison-slider", class extends f {
80
80
  constructor() {
81
81
  super(), this.exposure = this.hasAttribute("value") ? parseFloat(this.getAttribute("value")) : 50, this.slideOnHover = false, this.slideDirection = "horizontal", this.keyboard = "enabled", this.isMouseDown = false, this.animationDirection = 0, this.isFocused = false, this.dragByHandle = false, this.onMouseMove = (e3) => {
82
82
  if (this.isMouseDown || this.slideOnHover) {
83
- let t4 = c(e3);
84
- this.slideToPage(t4);
83
+ let i4 = d(e3);
84
+ this.slideToPage(i4);
85
85
  }
86
86
  }, this.bodyUserSelectStyle = "", this.bodyWebkitUserSelectStyle = "", this.onMouseDown = (e3) => {
87
- if (this.slideOnHover || this.handle && !r(this.handleElement, e3)) return;
87
+ if (this.slideOnHover || this.handle && !o(this.handleElement, e3)) return;
88
88
  e3.preventDefault(), window.addEventListener("mousemove", this.onMouseMove), window.addEventListener("mouseup", this.onWindowMouseUp), this.isMouseDown = true, this.enableTransition();
89
- let t4 = c(e3);
90
- this.slideToPage(t4), this.focus(), this.bodyUserSelectStyle = window.document.body.style.userSelect, this.bodyWebkitUserSelectStyle = window.document.body.style.webkitUserSelect, window.document.body.style.userSelect = "none", window.document.body.style.webkitUserSelect = "none";
89
+ let i4 = d(e3);
90
+ this.slideToPage(i4), this.focus(), this.bodyUserSelectStyle = window.document.body.style.userSelect, this.bodyWebkitUserSelectStyle = window.document.body.style.webkitUserSelect, window.document.body.style.userSelect = "none", window.document.body.style.webkitUserSelect = "none";
91
91
  }, this.onWindowMouseUp = () => {
92
92
  this.isMouseDown = false, window.document.body.style.userSelect = this.bodyUserSelectStyle, window.document.body.style.webkitUserSelect = this.bodyWebkitUserSelectStyle, window.removeEventListener("mousemove", this.onMouseMove), window.removeEventListener("mouseup", this.onWindowMouseUp);
93
93
  }, this.touchStartPoint = null, this.isTouchComparing = false, this.hasTouchMoved = false, this.onTouchStart = (e3) => {
94
- this.dragByHandle && !r(this.handleElement, e3) || (this.touchStartPoint = s(e3), this.isFocused && (this.enableTransition(), this.slideToPage(this.touchStartPoint)));
94
+ this.dragByHandle && !o(this.handleElement, e3) || (this.touchStartPoint = u(e3), this.isFocused && (this.enableTransition(), this.slideToPage(this.touchStartPoint)));
95
95
  }, this.onTouchMove = (e3) => {
96
96
  if (this.touchStartPoint === null) return;
97
- let t4 = s(e3);
98
- if (this.isTouchComparing) return this.slideToPage(t4), e3.preventDefault(), false;
97
+ let i4 = u(e3);
98
+ if (this.isTouchComparing) return this.slideToPage(i4), e3.preventDefault(), false;
99
99
  if (!this.hasTouchMoved) {
100
- let n3 = Math.abs(t4.y - this.touchStartPoint.y), r2 = Math.abs(t4.x - this.touchStartPoint.x);
101
- if (this.slideDirection === "horizontal" && n3 < r2 || this.slideDirection === "vertical" && n3 > r2) return this.isTouchComparing = true, this.focus(), this.slideToPage(t4), e3.preventDefault(), false;
100
+ let a3 = Math.abs(i4.y - this.touchStartPoint.y), o2 = Math.abs(i4.x - this.touchStartPoint.x);
101
+ if (this.slideDirection === "horizontal" && a3 < o2 || this.slideDirection === "vertical" && a3 > o2) return this.isTouchComparing = true, this.focus(), this.slideToPage(i4), e3.preventDefault(), false;
102
102
  this.hasTouchMoved = true;
103
103
  }
104
104
  }, this.onTouchEnd = () => {
@@ -109,17 +109,17 @@ var require_dist$1 = /* @__PURE__ */ __commonJSMin((() => {
109
109
  this.isFocused = true, this.firstElement.classList.add("focused");
110
110
  }, this.onKeyDown = (e3) => {
111
111
  if (this.keyboard === "disabled") return;
112
- let t4 = a[e3.key];
113
- this.animationDirection !== t4 && t4 !== void 0 && (this.animationDirection = t4, this.startSlideAnimation());
112
+ let i4 = c[e3.key];
113
+ this.animationDirection !== i4 && i4 !== void 0 && (this.animationDirection = i4, this.startSlideAnimation());
114
114
  }, this.onKeyUp = (e3) => {
115
115
  if (this.keyboard === "disabled") return;
116
- let t4 = a[e3.key];
117
- t4 !== void 0 && this.animationDirection === t4 && this.stopSlideAnimation();
116
+ let i4 = c[e3.key];
117
+ i4 !== void 0 && this.animationDirection === i4 && this.stopSlideAnimation();
118
118
  }, this.resetDimensions = () => {
119
119
  this.imageWidth = this.offsetWidth, this.imageHeight = this.offsetHeight;
120
120
  };
121
- let t3 = this.attachShadow({ mode: "open" }), n2 = document.createElement("style");
122
- n2.innerHTML = e2.Z, this.getAttribute("nonce") && n2.setAttribute("nonce", this.getAttribute("nonce")), t3.appendChild(n2), t3.appendChild(i.content.cloneNode(true)), this.firstElement = t3.getElementById("first"), this.handleElement = t3.getElementById("handle");
121
+ let i3 = this.attachShadow({ mode: "open" }), a2 = document.createElement("style");
122
+ a2.innerHTML = e2.Z, this.getAttribute("nonce") && a2.setAttribute("nonce", this.getAttribute("nonce")), i3.appendChild(a2), i3.appendChild(s.content.cloneNode(true)), this.firstElement = i3.getElementById("first"), this.handleElement = i3.getElementById("handle");
123
123
  }
124
124
  set handle(e3) {
125
125
  this.dragByHandle = e3.toString().toLowerCase() !== "false";
@@ -131,8 +131,8 @@ var require_dist$1 = /* @__PURE__ */ __commonJSMin((() => {
131
131
  return this.exposure;
132
132
  }
133
133
  set value(e3) {
134
- let t3 = parseFloat(e3);
135
- t3 !== this.exposure && (this.exposure = t3, this.enableTransition(), this.setExposure());
134
+ let i3 = parseFloat(e3);
135
+ i3 !== this.exposure && (this.exposure = i3, this.enableTransition(), this.setExposure());
136
136
  }
137
137
  get hover() {
138
138
  return this.slideOnHover;
@@ -144,28 +144,28 @@ var require_dist$1 = /* @__PURE__ */ __commonJSMin((() => {
144
144
  return this.slideDirection;
145
145
  }
146
146
  set direction(e3) {
147
- this.slideDirection = e3.toString().toLowerCase(), this.slide(0), this.firstElement.classList.remove(...o), o.includes(this.slideDirection) && this.firstElement.classList.add(this.slideDirection);
147
+ this.slideDirection = e3.toString().toLowerCase(), this.slide(0), this.firstElement.classList.remove(...l), l.includes(this.slideDirection) && this.firstElement.classList.add(this.slideDirection);
148
148
  }
149
149
  static get observedAttributes() {
150
150
  return ["hover", "direction"];
151
151
  }
152
152
  connectedCallback() {
153
- this.hasAttribute("tabindex") || (this.tabIndex = 0), this.addEventListener("dragstart", ((e3) => (e3.preventDefault(), false))), new ResizeObserver(this.resetDimensions).observe(this), this.setExposure(0), this.keyboard = this.hasAttribute("keyboard") && this.getAttribute("keyboard") === "disabled" ? "disabled" : "enabled", this.addEventListener("keydown", this.onKeyDown), this.addEventListener("keyup", this.onKeyUp), this.addEventListener("focus", this.onFocus), this.addEventListener("blur", this.onBlur), this.addEventListener("touchstart", this.onTouchStart, { passive: true }), this.addEventListener("touchmove", this.onTouchMove, { passive: false }), this.addEventListener("touchend", this.onTouchEnd), this.addEventListener("mousedown", this.onMouseDown), this.handle = this.hasAttribute("handle") ? this.getAttribute("handle") : this.dragByHandle, this.hover = this.hasAttribute("hover") ? this.getAttribute("hover") : this.slideOnHover, this.direction = this.hasAttribute("direction") ? this.getAttribute("direction") : this.slideDirection, this.resetDimensions(), this.classList.contains(t2) || this.classList.add(t2);
153
+ this.hasAttribute("tabindex") || (this.tabIndex = 0), this.addEventListener("dragstart", ((e3) => (e3.preventDefault(), false))), new ResizeObserver(this.resetDimensions).observe(this), this.setExposure(0), this.keyboard = this.hasAttribute("keyboard") && this.getAttribute("keyboard") === "disabled" ? "disabled" : "enabled", this.addEventListener("keydown", this.onKeyDown), this.addEventListener("keyup", this.onKeyUp), this.addEventListener("focus", this.onFocus), this.addEventListener("blur", this.onBlur), this.addEventListener("touchstart", this.onTouchStart, { passive: true }), this.addEventListener("touchmove", this.onTouchMove, { passive: false }), this.addEventListener("touchend", this.onTouchEnd), this.addEventListener("mousedown", this.onMouseDown), this.handle = this.hasAttribute("handle") ? this.getAttribute("handle") : this.dragByHandle, this.hover = this.hasAttribute("hover") ? this.getAttribute("hover") : this.slideOnHover, this.direction = this.hasAttribute("direction") ? this.getAttribute("direction") : this.slideDirection, this.resetDimensions(), this.classList.contains(i2) || this.classList.add(i2);
154
154
  }
155
155
  disconnectedCallback() {
156
156
  this.transitionTimer && window.clearTimeout(this.transitionTimer);
157
157
  }
158
- attributeChangedCallback(e3, t3, n2) {
159
- e3 === "hover" && (this.hover = n2), e3 === "direction" && (this.direction = n2), e3 === "keyboard" && (this.keyboard = n2 === "disabled" ? "disabled" : "enabled");
158
+ attributeChangedCallback(e3, i3, a2) {
159
+ e3 === "hover" && (this.hover = a2), e3 === "direction" && (this.direction = a2), e3 === "keyboard" && (this.keyboard = a2 === "disabled" ? "disabled" : "enabled");
160
160
  }
161
161
  setExposure(e3 = 0) {
162
- var t3;
163
- this.exposure = (t3 = this.exposure + e3) < 0 ? 0 : t3 > 100 ? 100 : t3, this.firstElement.style.setProperty("--exposure", 100 - this.exposure + "%");
162
+ var i3;
163
+ this.exposure = (i3 = this.exposure + e3) < 0 ? 0 : i3 > 100 ? 100 : i3, this.firstElement.style.setProperty("--exposure", 100 - this.exposure + "%");
164
164
  }
165
165
  slide(e3 = 0) {
166
166
  this.setExposure(e3);
167
- let t3 = new Event("slide");
168
- this.dispatchEvent(t3);
167
+ let i3 = new Event("slide");
168
+ this.dispatchEvent(i3);
169
169
  }
170
170
  slideToPage(e3) {
171
171
  this.slideDirection === "horizontal" && this.slideToPageX(e3.x), this.slideDirection === "vertical" && this.slideToPageY(e3.y);
@@ -182,15 +182,15 @@ var require_dist$1 = /* @__PURE__ */ __commonJSMin((() => {
182
182
  }), 100);
183
183
  }
184
184
  startSlideAnimation() {
185
- let e3 = null, t3 = this.animationDirection;
185
+ let e3 = null, i3 = this.animationDirection;
186
186
  this.firstElement.style.setProperty("--transition-time", "var(--keyboard-transition-time)");
187
- let n2 = (r2) => {
188
- if (this.animationDirection === 0 || t3 !== this.animationDirection) return;
189
- e3 === null && (e3 = r2);
190
- let i2 = (r2 - e3) / 16.666666666666668 * this.animationDirection;
191
- this.slide(i2), setTimeout((() => window.requestAnimationFrame(n2)), 0), e3 = r2;
187
+ let a2 = (o2) => {
188
+ if (this.animationDirection === 0 || i3 !== this.animationDirection) return;
189
+ e3 === null && (e3 = o2);
190
+ let s2 = (o2 - e3) / 16.666666666666668 * this.animationDirection;
191
+ this.slide(s2), setTimeout((() => window.requestAnimationFrame(a2)), 0), e3 = o2;
192
192
  };
193
- window.requestAnimationFrame(n2);
193
+ window.requestAnimationFrame(a2);
194
194
  }
195
195
  stopSlideAnimation() {
196
196
  this.animationDirection = 0, this.firstElement.style.setProperty("--transition-time", "var(--default-transition-time)");
@@ -199,77 +199,121 @@ var require_dist$1 = /* @__PURE__ */ __commonJSMin((() => {
199
199
  })();
200
200
  })();
201
201
  })), require_dist = /* @__PURE__ */ __commonJSMin(((e) => {
202
- var t = e && e.__createBinding || (Object.create ? (function(e2, t2, n, r2) {
203
- r2 === void 0 && (r2 = n), Object.defineProperty(e2, r2, {
202
+ var i = e && e.__createBinding || (Object.create ? (function(e2, i2, a, o2) {
203
+ o2 === void 0 && (o2 = a), Object.defineProperty(e2, o2, {
204
204
  enumerable: true,
205
205
  get: function() {
206
- return t2[n];
206
+ return i2[a];
207
207
  }
208
208
  });
209
- }) : (function(e2, t2, n, r2) {
210
- r2 === void 0 && (r2 = n), e2[r2] = t2[n];
211
- })), r = e && e.__setModuleDefault || (Object.create ? (function(e2, t2) {
209
+ }) : (function(e2, i2, a, o2) {
210
+ o2 === void 0 && (o2 = a), e2[o2] = i2[a];
211
+ })), o = e && e.__setModuleDefault || (Object.create ? (function(e2, i2) {
212
212
  Object.defineProperty(e2, "default", {
213
213
  enumerable: true,
214
- value: t2
214
+ value: i2
215
215
  });
216
- }) : function(e2, t2) {
217
- e2.default = t2;
218
- }), i = e && e.__importStar || function(e2) {
216
+ }) : function(e2, i2) {
217
+ e2.default = i2;
218
+ }), s = e && e.__importStar || function(e2) {
219
219
  if (e2 && e2.__esModule) return e2;
220
- var n = {};
221
- if (e2 != null) for (var i2 in e2) i2 !== "default" && Object.prototype.hasOwnProperty.call(e2, i2) && t(n, e2, i2);
222
- return r(n, e2), n;
220
+ var a = {};
221
+ if (e2 != null) for (var s2 in e2) s2 !== "default" && Object.prototype.hasOwnProperty.call(e2, s2) && i(a, e2, s2);
222
+ return o(a, e2), a;
223
223
  };
224
224
  Object.defineProperty(e, "__esModule", { value: true }), e.ImgComparisonSlider = void 0;
225
- var o = require_react();
226
- typeof document < "u" && Promise.resolve().then(() => i(require_dist$1())), e.ImgComparisonSlider = (0, o.forwardRef)(({ children: e2, onSlide: t2, value: n, className: r2, ...i2 }, a) => {
227
- let s = (0, o.useRef)();
228
- return (0, o.useEffect)(() => {
229
- n !== void 0 && (s.current.value = parseFloat(n.toString()));
230
- }, [n, s]), (0, o.useEffect)(() => {
231
- t2 && s.current.addEventListener("slide", t2);
232
- }, []), (0, o.useImperativeHandle)(a, () => s.current, [s]), (0, o.createElement)("img-comparison-slider", Object.assign({
233
- class: r2 ? `${r2} rendered` : "rendered",
225
+ var l = require_react();
226
+ typeof document < "u" && Promise.resolve().then(() => s(require_dist$1())), e.ImgComparisonSlider = (0, l.forwardRef)(({ children: e2, onSlide: i2, value: a, className: o2, ...s2 }, c) => {
227
+ let u = (0, l.useRef)();
228
+ return (0, l.useEffect)(() => {
229
+ a !== void 0 && (u.current.value = parseFloat(a.toString()));
230
+ }, [a, u]), (0, l.useEffect)(() => {
231
+ i2 && u.current.addEventListener("slide", i2);
232
+ }, []), (0, l.useImperativeHandle)(c, () => u.current, [u]), (0, l.createElement)("img-comparison-slider", Object.assign({
233
+ class: o2 ? `${o2} rendered` : "rendered",
234
234
  tabIndex: 0,
235
- ref: s
236
- }, i2), e2);
235
+ ref: u
236
+ }, s2), e2);
237
237
  });
238
- })), import_compiler_runtime = require_compiler_runtime(), import_dist = require_dist();
239
- require_react();
240
- var import_jsx_runtime = /* @__PURE__ */ __toESM(require_jsx_runtime(), 1), ImageComparisonComponent_default = (e) => {
241
- let t = (0, import_compiler_runtime.c)(15), { beforeSrc: n, afterSrc: r, value: i, direction: a, width: o, height: u } = e, d = o || "100%", f = u || (a === "vertical" ? "400px" : "auto"), p;
242
- t[0] !== d || t[1] !== f ? (p = {
243
- width: d,
244
- height: f,
245
- maxWidth: "100%"
246
- }, t[0] = d, t[1] = f, t[2] = p) : p = t[2];
247
- let m = p, h;
248
- t[3] === n ? h = t[4] : (h = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("img", {
238
+ })), import_compiler_runtime = require_compiler_runtime(), import_dist = require_dist(), import_react = /* @__PURE__ */ __toESM(require_react(), 1), import_jsx_runtime = /* @__PURE__ */ __toESM(require_jsx_runtime(), 1);
239
+ function truncateSrc(e) {
240
+ return e.length > 100 ? `${e.slice(0, 100)}\u2026` : e;
241
+ }
242
+ var ImageComparisonComponent_default = (e) => {
243
+ let i = (0, import_compiler_runtime.c)(34), { beforeSrc: a, afterSrc: o, value: s, direction: c, width: l, height: p } = e, [m, h] = import_react.useState(_temp), g;
244
+ i[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (g = () => {
245
+ h(/* @__PURE__ */ new Set());
246
+ }, i[0] = g) : g = i[0];
247
+ let _;
248
+ i[1] !== o || i[2] !== a ? (_ = [a, o], i[1] = o, i[2] = a, i[3] = _) : _ = i[3], import_react.useEffect(g, _);
249
+ let v;
250
+ i[4] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (v = (e2) => {
251
+ h((i2) => new Set(i2).add(e2));
252
+ }, i[4] = v) : v = i[4];
253
+ let y = v, b = l || "100%", x = p || (c === "vertical" ? "400px" : "auto"), S;
254
+ i[5] !== b || i[6] !== x ? (S = {
255
+ width: b,
256
+ height: x,
257
+ maxWidth: "100%",
258
+ minHeight: "2rem"
259
+ }, i[5] = b, i[6] = x, i[7] = S) : S = i[7];
260
+ let C = S;
261
+ if (m.size > 0) {
262
+ let e2 = m.size > 1 ? "images" : "image", a2;
263
+ i[8] === m ? a2 = i[9] : (a2 = [...m].map(_temp2), i[8] = m, i[9] = a2);
264
+ let o2 = a2.join(", "), s2;
265
+ i[10] !== e2 || i[11] !== o2 ? (s2 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { children: [
266
+ "Failed to load ",
267
+ e2,
268
+ ":",
269
+ " ",
270
+ o2
271
+ ] }), i[10] = e2, i[11] = o2, i[12] = s2) : s2 = i[12];
272
+ let c2;
273
+ return i[13] !== C || i[14] !== s2 ? (c2 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
274
+ style: C,
275
+ className: "flex items-center justify-center rounded border border-destructive/40 bg-destructive/5 p-3 text-sm text-destructive",
276
+ children: s2
277
+ }), i[13] = C, i[14] = s2, i[15] = c2) : c2 = i[15], c2;
278
+ }
279
+ let w;
280
+ i[16] === a ? w = i[17] : (w = () => y(a), i[16] = a, i[17] = w);
281
+ let T;
282
+ i[18] !== a || i[19] !== w ? (T = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("img", {
249
283
  slot: "first",
250
- src: n,
284
+ src: a,
251
285
  alt: "Before",
252
- width: "100%"
253
- }), t[3] = n, t[4] = h);
254
- let g;
255
- t[5] === r ? g = t[6] : (g = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("img", {
286
+ width: "100%",
287
+ onError: w
288
+ }), i[18] = a, i[19] = w, i[20] = T) : T = i[20];
289
+ let E;
290
+ i[21] === o ? E = i[22] : (E = () => y(o), i[21] = o, i[22] = E);
291
+ let D;
292
+ i[23] !== o || i[24] !== E ? (D = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("img", {
256
293
  slot: "second",
257
- src: r,
294
+ src: o,
258
295
  alt: "After",
259
- width: "100%"
260
- }), t[5] = r, t[6] = g);
261
- let _;
262
- t[7] !== a || t[8] !== h || t[9] !== g || t[10] !== i ? (_ = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_dist.ImgComparisonSlider, {
263
- value: i,
264
- direction: a,
265
- children: [h, g]
266
- }), t[7] = a, t[8] = h, t[9] = g, t[10] = i, t[11] = _) : _ = t[11];
267
- let v;
268
- return t[12] !== m || t[13] !== _ ? (v = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
269
- style: m,
270
- children: _
271
- }), t[12] = m, t[13] = _, t[14] = v) : v = t[14], v;
296
+ width: "100%",
297
+ onError: E
298
+ }), i[23] = o, i[24] = E, i[25] = D) : D = i[25];
299
+ let O;
300
+ i[26] !== c || i[27] !== D || i[28] !== T || i[29] !== s ? (O = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_dist.ImgComparisonSlider, {
301
+ value: s,
302
+ direction: c,
303
+ children: [T, D]
304
+ }), i[26] = c, i[27] = D, i[28] = T, i[29] = s, i[30] = O) : O = i[30];
305
+ let k;
306
+ return i[31] !== C || i[32] !== O ? (k = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
307
+ style: C,
308
+ children: O
309
+ }), i[31] = C, i[32] = O, i[33] = k) : k = i[33], k;
272
310
  };
311
+ function _temp() {
312
+ return /* @__PURE__ */ new Set();
313
+ }
314
+ function _temp2(e) {
315
+ return `"${truncateSrc(e)}"`;
316
+ }
273
317
  export {
274
318
  ImageComparisonComponent_default as default
275
319
  };
@@ -0,0 +1 @@
1
+ import{t as e}from"./worker-B3XPCb6y.js";var t=e(((e,t)=>{t.exports={}}));export default t();