@marimo-team/islands 0.23.15-dev33 → 0.23.15-dev5

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 (85) hide show
  1. package/dist/{ConnectedDataExplorerComponent-7p7rt9iw.js → ConnectedDataExplorerComponent-CU4fZJzG.js} +4 -4
  2. package/dist/{ErrorBoundary-B_CAG7_e.js → ErrorBoundary-DE6tzZf-.js} +1 -1
  3. package/dist/{ImageComparisonComponent-1i5IBhon.js → ImageComparisonComponent-CHrI72em.js} +129 -173
  4. package/dist/assets/__vite-browser-external-BQCLNwri.js +1 -0
  5. package/dist/assets/worker-DAWRHcPq.js +73 -0
  6. package/dist/{chat-ui-C0wkSwxB.js → chat-ui-DinOvbWu.js} +3111 -3111
  7. package/dist/{code-visibility-BI94mK4u.js → code-visibility-DBuB5MVY.js} +864 -946
  8. package/dist/{debounce-BOD3DbfP.js → constants-T20xxyNf.js} +24 -1
  9. package/dist/{formats-BX3uDQbB.js → formats-Dzx4J_z1.js} +1 -1
  10. package/dist/{glide-data-editor-CwZz71BD.js → glide-data-editor-CjTu7ukN.js} +3 -3
  11. package/dist/{html-to-image-D8Q5SLSJ.js → html-to-image-_wGfk8V-.js} +2241 -2277
  12. package/dist/{input-BGPrFH3g.js → input-DtsN7xm-.js} +2 -2
  13. package/dist/main.js +1201 -1297
  14. package/dist/{mermaid-UdmxG2PZ.js → mermaid-BYqXy_NE.js} +2 -2
  15. package/dist/{process-output-C_A12w9J.js → process-output-Mh4UrjwM.js} +1 -1
  16. package/dist/{reveal-component-ELidGmPF.js → reveal-component-DfOZrkd6.js} +605 -618
  17. package/dist/{spec-DSs9v0xx.js → spec-Cz-Bj1JI.js} +1 -1
  18. package/dist/style.css +1 -1
  19. package/dist/{toDate-CKpRx4TS.js → toDate-CWNNlFEX.js} +4 -3
  20. package/dist/{useAsyncData-BSOyAbac.js → useAsyncData-KfHB8wQR.js} +1 -1
  21. package/dist/{useDeepCompareMemoize-BTLeWzuR.js → useDeepCompareMemoize-nJMtxhm4.js} +1 -1
  22. package/dist/{useLifecycle-C6wHjkhW.js → useLifecycle-DegSo0lV.js} +1 -1
  23. package/dist/{useTheme-Df_vGflw.js → useTheme-6eZ3GOTS.js} +27 -62
  24. package/dist/{vega-component-DNHEV0u0.js → vega-component-DzyyM9fc.js} +6 -6
  25. package/package.json +1 -1
  26. package/src/components/chat/__tests__/chat-utils.test.ts +1 -244
  27. package/src/components/chat/chat-panel.tsx +67 -196
  28. package/src/components/chat/chat-utils.ts +2 -111
  29. package/src/components/editor/SortableCell.tsx +2 -6
  30. package/src/components/editor/actions/pair-with-agent-modal.tsx +64 -20
  31. package/src/components/editor/ai/add-cell-with-ai.tsx +5 -14
  32. package/src/components/editor/ai/ai-completion-editor.tsx +1 -4
  33. package/src/components/editor/cell/cell-context-menu.tsx +0 -7
  34. package/src/components/editor/chrome/panels/packages-panel.tsx +1 -11
  35. package/src/components/editor/columns/cell-column.tsx +4 -34
  36. package/src/components/editor/columns/sortable-column.tsx +4 -24
  37. package/src/components/editor/navigation/__tests__/navigation.test.ts +0 -33
  38. package/src/components/editor/navigation/navigation.ts +1 -8
  39. package/src/components/editor/notebook-cell.tsx +106 -203
  40. package/src/components/editor/renderers/cell-array.tsx +13 -26
  41. package/src/components/editor/renderers/cells-renderer.tsx +2 -8
  42. package/src/components/editor/renderers/slides-layout/__tests__/plugin.test.ts +0 -29
  43. package/src/components/editor/renderers/slides-layout/types.ts +0 -4
  44. package/src/components/editor/renderers/vertical-layout/vertical-layout.tsx +19 -19
  45. package/src/components/slides/reveal-component.tsx +4 -37
  46. package/src/components/slides/slide-form.tsx +0 -72
  47. package/src/core/cells/__tests__/utils.test.ts +0 -59
  48. package/src/core/cells/utils.ts +0 -51
  49. package/src/core/codemirror/completion/__tests__/signature-hint.test.ts +3 -97
  50. package/src/core/codemirror/completion/signature-hint.ts +11 -78
  51. package/src/core/constants.ts +0 -6
  52. package/src/core/islands/__tests__/bridge.test.ts +46 -341
  53. package/src/core/islands/__tests__/parse.test.ts +0 -105
  54. package/src/core/islands/bootstrap.ts +3 -8
  55. package/src/core/islands/bridge.ts +23 -116
  56. package/src/core/islands/components/web-components.tsx +15 -76
  57. package/src/core/islands/constants.ts +0 -1
  58. package/src/core/islands/main.ts +3 -69
  59. package/src/core/islands/parse.ts +23 -70
  60. package/src/core/islands/worker/worker.tsx +57 -145
  61. package/src/core/wasm/worker/bootstrap.ts +20 -113
  62. package/src/css/app/Cell.css +0 -10
  63. package/src/hooks/useHotkey.ts +4 -29
  64. package/src/plugins/impl/anywidget/__tests__/host.test.ts +9 -6
  65. package/src/plugins/impl/anywidget/__tests__/widget-binding.test.ts +61 -22
  66. package/src/plugins/impl/anywidget/model-proxy.ts +13 -0
  67. package/src/plugins/impl/anywidget/widget-binding.ts +34 -4
  68. package/src/plugins/impl/image-comparison/ImageComparisonComponent.tsx +2 -53
  69. package/src/plugins/impl/matplotlib/__tests__/matplotlib-renderer.test.ts +3 -71
  70. package/src/plugins/impl/matplotlib/matplotlib-renderer.ts +0 -1
  71. package/src/theme/useTheme.ts +1 -16
  72. package/dist/assets/__vite-browser-external-CjNAy01L.js +0 -1
  73. package/dist/assets/worker-B3XPCb6y.js +0 -98
  74. package/src/components/chat/__tests__/message-queue.test.tsx +0 -121
  75. package/src/components/editor/__tests__/output-persistence.test.tsx +0 -241
  76. package/src/components/editor/actions/__tests__/pair-with-agent-commands.test.ts +0 -153
  77. package/src/components/editor/actions/pair-with-agent-commands.ts +0 -109
  78. package/src/components/editor/columns/__tests__/cell-column.test.tsx +0 -105
  79. package/src/components/editor/renderers/__tests__/cells-renderer.test.tsx +0 -66
  80. package/src/core/islands/__tests__/main.test.ts +0 -176
  81. package/src/core/islands/components/__tests__/web-components.test.tsx +0 -214
  82. package/src/core/islands/worker/__tests__/controller.test.ts +0 -173
  83. package/src/hooks/__tests__/useHotkey.test.tsx +0 -88
  84. package/src/plugins/impl/image-comparison/__tests__/ImageComparisonComponent.test.tsx +0 -71
  85. package/src/theme/__tests__/useTheme.test.ts +0 -68
@@ -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-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";
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";
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 { E as createStore, S as useAtomValue, T as atom, b as Provider, n as useTheme } from "./useTheme-Df_vGflw.js";
16
+ import { C as createStore, S as atom, _ as Provider, n as useTheme, y as useAtomValue } from "./useTheme-6eZ3GOTS.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-BSOyAbac.js";
23
+ import { t as useAsyncData } from "./useAsyncData-KfHB8wQR.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 { i as Constants } from "./useTheme-Df_vGflw.js";
7
+ import { n as Constants } from "./constants-T20xxyNf.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, i2, a2) => {
9
- a2.d(i2, { Z: () => c });
10
- var o = a2(609), s = a2.n(o)()((function(e3) {
8
+ 792: (e2, t2, n2) => {
9
+ n2.d(t2, { Z: () => a });
10
+ var r = n2(609), i = n2.n(r)()((function(e3) {
11
11
  return e3[1];
12
12
  }));
13
- s.push([
13
+ i.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 c = s;
18
+ let a = i;
19
19
  },
20
20
  609: (e2) => {
21
21
  e2.exports = function(e3) {
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;
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;
27
27
  })).join("");
28
- }, i2.i = function(e4, a2, o) {
28
+ }, t2.i = function(e4, n2, r) {
29
29
  typeof e4 == "string" && (e4 = [[
30
30
  null,
31
31
  e4,
32
32
  ""
33
33
  ]]);
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);
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);
38
38
  }
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));
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));
42
42
  }
43
- }, i2;
43
+ }, t2;
44
44
  };
45
45
  }
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,
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,
52
52
  exports: {}
53
53
  };
54
- return e[o](c, c.exports, a), c.exports;
54
+ return e[r](a, a.exports, n), a.exports;
55
55
  }
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, {
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, {
61
61
  enumerable: true,
62
- get: i2[o]
62
+ get: t2[r]
63
63
  });
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 = {
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 = {
70
70
  ArrowLeft: -1,
71
71
  ArrowRight: 1
72
- }, l = ["horizontal", "vertical"], u = (e3) => ({
72
+ }, o = ["horizontal", "vertical"], s = (e3) => ({
73
73
  x: e3.touches[0].pageX,
74
74
  y: e3.touches[0].pageY
75
- }), d = (e3) => ({
75
+ }), c = (e3) => ({
76
76
  x: e3.pageX,
77
77
  y: e3.pageY
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 {
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 {
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 i4 = d(e3);
84
- this.slideToPage(i4);
83
+ let t4 = c(e3);
84
+ this.slideToPage(t4);
85
85
  }
86
86
  }, this.bodyUserSelectStyle = "", this.bodyWebkitUserSelectStyle = "", this.onMouseDown = (e3) => {
87
- if (this.slideOnHover || this.handle && !o(this.handleElement, e3)) return;
87
+ if (this.slideOnHover || this.handle && !r(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 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";
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";
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 && !o(this.handleElement, e3) || (this.touchStartPoint = u(e3), this.isFocused && (this.enableTransition(), this.slideToPage(this.touchStartPoint)));
94
+ this.dragByHandle && !r(this.handleElement, e3) || (this.touchStartPoint = s(e3), this.isFocused && (this.enableTransition(), this.slideToPage(this.touchStartPoint)));
95
95
  }, this.onTouchMove = (e3) => {
96
96
  if (this.touchStartPoint === null) return;
97
- let i4 = u(e3);
98
- if (this.isTouchComparing) return this.slideToPage(i4), e3.preventDefault(), false;
97
+ let t4 = s(e3);
98
+ if (this.isTouchComparing) return this.slideToPage(t4), e3.preventDefault(), false;
99
99
  if (!this.hasTouchMoved) {
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;
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;
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 i4 = c[e3.key];
113
- this.animationDirection !== i4 && i4 !== void 0 && (this.animationDirection = i4, this.startSlideAnimation());
112
+ let t4 = a[e3.key];
113
+ this.animationDirection !== t4 && t4 !== void 0 && (this.animationDirection = t4, this.startSlideAnimation());
114
114
  }, this.onKeyUp = (e3) => {
115
115
  if (this.keyboard === "disabled") return;
116
- let i4 = c[e3.key];
117
- i4 !== void 0 && this.animationDirection === i4 && this.stopSlideAnimation();
116
+ let t4 = a[e3.key];
117
+ t4 !== void 0 && this.animationDirection === t4 && this.stopSlideAnimation();
118
118
  }, this.resetDimensions = () => {
119
119
  this.imageWidth = this.offsetWidth, this.imageHeight = this.offsetHeight;
120
120
  };
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");
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");
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 i3 = parseFloat(e3);
135
- i3 !== this.exposure && (this.exposure = i3, this.enableTransition(), this.setExposure());
134
+ let t3 = parseFloat(e3);
135
+ t3 !== this.exposure && (this.exposure = t3, 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(...l), l.includes(this.slideDirection) && this.firstElement.classList.add(this.slideDirection);
147
+ this.slideDirection = e3.toString().toLowerCase(), this.slide(0), this.firstElement.classList.remove(...o), o.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(i2) || this.classList.add(i2);
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);
154
154
  }
155
155
  disconnectedCallback() {
156
156
  this.transitionTimer && window.clearTimeout(this.transitionTimer);
157
157
  }
158
- attributeChangedCallback(e3, i3, a2) {
159
- e3 === "hover" && (this.hover = a2), e3 === "direction" && (this.direction = a2), e3 === "keyboard" && (this.keyboard = a2 === "disabled" ? "disabled" : "enabled");
158
+ attributeChangedCallback(e3, t3, n2) {
159
+ e3 === "hover" && (this.hover = n2), e3 === "direction" && (this.direction = n2), e3 === "keyboard" && (this.keyboard = n2 === "disabled" ? "disabled" : "enabled");
160
160
  }
161
161
  setExposure(e3 = 0) {
162
- var i3;
163
- this.exposure = (i3 = this.exposure + e3) < 0 ? 0 : i3 > 100 ? 100 : i3, this.firstElement.style.setProperty("--exposure", 100 - this.exposure + "%");
162
+ var t3;
163
+ this.exposure = (t3 = this.exposure + e3) < 0 ? 0 : t3 > 100 ? 100 : t3, this.firstElement.style.setProperty("--exposure", 100 - this.exposure + "%");
164
164
  }
165
165
  slide(e3 = 0) {
166
166
  this.setExposure(e3);
167
- let i3 = new Event("slide");
168
- this.dispatchEvent(i3);
167
+ let t3 = new Event("slide");
168
+ this.dispatchEvent(t3);
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, i3 = this.animationDirection;
185
+ let e3 = null, t3 = this.animationDirection;
186
186
  this.firstElement.style.setProperty("--transition-time", "var(--keyboard-transition-time)");
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;
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;
192
192
  };
193
- window.requestAnimationFrame(a2);
193
+ window.requestAnimationFrame(n2);
194
194
  }
195
195
  stopSlideAnimation() {
196
196
  this.animationDirection = 0, this.firstElement.style.setProperty("--transition-time", "var(--default-transition-time)");
@@ -199,121 +199,77 @@ var require_dist$1 = /* @__PURE__ */ __commonJSMin((() => {
199
199
  })();
200
200
  })();
201
201
  })), require_dist = /* @__PURE__ */ __commonJSMin(((e) => {
202
- var i = e && e.__createBinding || (Object.create ? (function(e2, i2, a, o2) {
203
- o2 === void 0 && (o2 = a), Object.defineProperty(e2, o2, {
202
+ var t = e && e.__createBinding || (Object.create ? (function(e2, t2, n, r2) {
203
+ r2 === void 0 && (r2 = n), Object.defineProperty(e2, r2, {
204
204
  enumerable: true,
205
205
  get: function() {
206
- return i2[a];
206
+ return t2[n];
207
207
  }
208
208
  });
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) {
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) {
212
212
  Object.defineProperty(e2, "default", {
213
213
  enumerable: true,
214
- value: i2
214
+ value: t2
215
215
  });
216
- }) : function(e2, i2) {
217
- e2.default = i2;
218
- }), s = e && e.__importStar || function(e2) {
216
+ }) : function(e2, t2) {
217
+ e2.default = t2;
218
+ }), i = e && e.__importStar || function(e2) {
219
219
  if (e2 && e2.__esModule) return e2;
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;
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;
223
223
  };
224
224
  Object.defineProperty(e, "__esModule", { value: true }), e.ImgComparisonSlider = void 0;
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",
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",
234
234
  tabIndex: 0,
235
- ref: u
236
- }, s2), e2);
235
+ ref: s
236
+ }, i2), e2);
237
237
  });
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", {
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", {
283
249
  slot: "first",
284
- src: a,
250
+ src: n,
285
251
  alt: "Before",
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", {
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", {
293
256
  slot: "second",
294
- src: o,
257
+ src: r,
295
258
  alt: "After",
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;
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;
310
272
  };
311
- function _temp() {
312
- return /* @__PURE__ */ new Set();
313
- }
314
- function _temp2(e) {
315
- return `"${truncateSrc(e)}"`;
316
- }
317
273
  export {
318
274
  ImageComparisonComponent_default as default
319
275
  };
@@ -0,0 +1 @@
1
+ import{t as e}from"./worker-DAWRHcPq.js";var t=e(((e,t)=>{t.exports={}}));export default t();