@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.
- package/dist/{ConnectedDataExplorerComponent-CU4fZJzG.js → ConnectedDataExplorerComponent-7p7rt9iw.js} +4 -4
- package/dist/{ErrorBoundary-DE6tzZf-.js → ErrorBoundary-B_CAG7_e.js} +1 -1
- package/dist/{ImageComparisonComponent-CHrI72em.js → ImageComparisonComponent-1i5IBhon.js} +173 -129
- package/dist/assets/__vite-browser-external-CjNAy01L.js +1 -0
- package/dist/assets/worker-B3XPCb6y.js +98 -0
- package/dist/{chat-ui-DinOvbWu.js → chat-ui-C0z13gJB.js} +3111 -3111
- package/dist/{code-visibility-Dk8cVOny.js → code-visibility-COokQS5X.js} +946 -864
- package/dist/{constants-T20xxyNf.js → debounce-BOD3DbfP.js} +1 -24
- package/dist/{formats-Dzx4J_z1.js → formats-CitsMtUm.js} +1 -1
- package/dist/{glide-data-editor-CjTu7ukN.js → glide-data-editor-CwZz71BD.js} +3 -3
- package/dist/{html-to-image-_wGfk8V-.js → html-to-image-CEo5pRYw.js} +2291 -2250
- package/dist/{input-DtsN7xm-.js → input-BGPrFH3g.js} +2 -2
- package/dist/main.js +1297 -1201
- package/dist/{mermaid-BYqXy_NE.js → mermaid-UdmxG2PZ.js} +2 -2
- package/dist/{process-output-Mh4UrjwM.js → process-output-BOvvilRG.js} +1 -1
- package/dist/{reveal-component-B5DXLyO7.js → reveal-component-D3ySPwH5.js} +618 -605
- package/dist/{spec-Cz-Bj1JI.js → spec-DSs9v0xx.js} +1 -1
- package/dist/style.css +1 -1
- package/dist/{toDate-CWNNlFEX.js → toDate-BRJgtOGm.js} +14 -5
- package/dist/{useAsyncData-KfHB8wQR.js → useAsyncData-BSOyAbac.js} +1 -1
- package/dist/{useDeepCompareMemoize-nJMtxhm4.js → useDeepCompareMemoize-BTLeWzuR.js} +1 -1
- package/dist/{useLifecycle-DegSo0lV.js → useLifecycle-C6wHjkhW.js} +1 -1
- package/dist/{useTheme-6eZ3GOTS.js → useTheme-Df_vGflw.js} +62 -27
- package/dist/{vega-component-DzyyM9fc.js → vega-component-BAvmvTjO.js} +6 -6
- package/package.json +1 -1
- package/src/components/chat/__tests__/chat-utils.test.ts +244 -1
- package/src/components/chat/__tests__/message-queue.test.tsx +121 -0
- package/src/components/chat/chat-panel.tsx +196 -67
- package/src/components/chat/chat-utils.ts +111 -2
- package/src/components/editor/SortableCell.tsx +6 -2
- package/src/components/editor/__tests__/output-persistence.test.tsx +241 -0
- package/src/components/editor/actions/__tests__/pair-with-agent-commands.test.ts +153 -0
- package/src/components/editor/actions/pair-with-agent-commands.ts +109 -0
- package/src/components/editor/actions/pair-with-agent-modal.tsx +20 -64
- package/src/components/editor/ai/add-cell-with-ai.tsx +14 -5
- package/src/components/editor/ai/ai-completion-editor.tsx +4 -1
- package/src/components/editor/cell/cell-context-menu.tsx +7 -0
- package/src/components/editor/chrome/panels/packages-panel.tsx +11 -1
- package/src/components/editor/columns/__tests__/cell-column.test.tsx +105 -0
- package/src/components/editor/columns/cell-column.tsx +34 -4
- package/src/components/editor/columns/sortable-column.tsx +24 -4
- package/src/components/editor/file-tree/download.ts +46 -0
- package/src/components/editor/file-tree/file-explorer.tsx +3 -21
- package/src/components/editor/file-tree/file-viewer.tsx +4 -27
- package/src/components/editor/navigation/__tests__/navigation.test.ts +33 -0
- package/src/components/editor/navigation/navigation.ts +8 -1
- package/src/components/editor/notebook-cell.tsx +203 -106
- package/src/components/editor/renderers/__tests__/cells-renderer.test.tsx +66 -0
- package/src/components/editor/renderers/cell-array.tsx +26 -13
- package/src/components/editor/renderers/cells-renderer.tsx +8 -2
- package/src/components/editor/renderers/slides-layout/__tests__/plugin.test.ts +29 -0
- package/src/components/editor/renderers/slides-layout/types.ts +4 -0
- package/src/components/editor/renderers/vertical-layout/vertical-layout.tsx +19 -19
- package/src/components/slides/reveal-component.tsx +37 -4
- package/src/components/slides/slide-form.tsx +72 -0
- package/src/components/ui/toast.tsx +11 -3
- package/src/components/ui/toaster.tsx +65 -9
- package/src/core/cells/__tests__/utils.test.ts +59 -0
- package/src/core/cells/utils.ts +51 -0
- package/src/core/codemirror/completion/__tests__/signature-hint.test.ts +97 -3
- package/src/core/codemirror/completion/signature-hint.ts +78 -11
- package/src/core/constants.ts +6 -0
- package/src/core/islands/__tests__/bridge.test.ts +341 -46
- package/src/core/islands/__tests__/main.test.ts +176 -0
- package/src/core/islands/__tests__/parse.test.ts +105 -0
- package/src/core/islands/bootstrap.ts +8 -3
- package/src/core/islands/bridge.ts +116 -23
- package/src/core/islands/components/__tests__/web-components.test.tsx +214 -0
- package/src/core/islands/components/web-components.tsx +76 -15
- package/src/core/islands/constants.ts +1 -0
- package/src/core/islands/main.ts +69 -3
- package/src/core/islands/parse.ts +70 -23
- package/src/core/islands/worker/__tests__/controller.test.ts +173 -0
- package/src/core/islands/worker/worker.tsx +145 -57
- package/src/core/runtime/__tests__/runtime.test.ts +64 -0
- package/src/core/runtime/runtime.ts +30 -10
- package/src/core/wasm/worker/bootstrap.ts +113 -20
- package/src/css/app/Cell.css +10 -0
- package/src/hooks/__tests__/useHotkey.test.tsx +88 -0
- package/src/hooks/useHotkey.ts +29 -4
- package/src/plugins/impl/anywidget/__tests__/host.test.ts +6 -9
- package/src/plugins/impl/anywidget/__tests__/widget-binding.test.ts +22 -61
- package/src/plugins/impl/anywidget/model-proxy.ts +0 -13
- package/src/plugins/impl/anywidget/widget-binding.ts +4 -34
- package/src/plugins/impl/image-comparison/ImageComparisonComponent.tsx +53 -2
- package/src/plugins/impl/image-comparison/__tests__/ImageComparisonComponent.test.tsx +71 -0
- package/src/plugins/impl/matplotlib/__tests__/matplotlib-renderer.test.ts +71 -3
- package/src/plugins/impl/matplotlib/matplotlib-renderer.ts +1 -0
- package/src/theme/__tests__/useTheme.test.ts +68 -0
- package/src/theme/useTheme.ts +16 -1
- package/dist/assets/__vite-browser-external-BQCLNwri.js +0 -1
- 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-
|
|
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-
|
|
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 {
|
|
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-
|
|
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 {
|
|
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,
|
|
9
|
-
|
|
10
|
-
var
|
|
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
|
-
|
|
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
|
|
18
|
+
let c = s;
|
|
19
19
|
},
|
|
20
20
|
609: (e2) => {
|
|
21
21
|
e2.exports = function(e3) {
|
|
22
|
-
var
|
|
23
|
-
return
|
|
24
|
-
return this.map((function(
|
|
25
|
-
var
|
|
26
|
-
return
|
|
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
|
-
},
|
|
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
|
|
35
|
-
if (
|
|
36
|
-
var
|
|
37
|
-
|
|
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
|
|
40
|
-
var
|
|
41
|
-
|
|
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
|
-
},
|
|
43
|
+
}, i2;
|
|
44
44
|
};
|
|
45
45
|
}
|
|
46
|
-
},
|
|
47
|
-
function
|
|
48
|
-
var
|
|
49
|
-
if (
|
|
50
|
-
var
|
|
51
|
-
id:
|
|
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[
|
|
54
|
+
return e[o](c, c.exports, a), c.exports;
|
|
55
55
|
}
|
|
56
|
-
|
|
57
|
-
var
|
|
58
|
-
return
|
|
59
|
-
},
|
|
60
|
-
for (var
|
|
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:
|
|
62
|
+
get: i2[o]
|
|
63
63
|
});
|
|
64
|
-
},
|
|
65
|
-
var e2 =
|
|
66
|
-
let
|
|
67
|
-
let
|
|
68
|
-
return
|
|
69
|
-
},
|
|
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
|
-
},
|
|
72
|
+
}, l = ["horizontal", "vertical"], u = (e3) => ({
|
|
73
73
|
x: e3.touches[0].pageX,
|
|
74
74
|
y: e3.touches[0].pageY
|
|
75
|
-
}),
|
|
75
|
+
}), d = (e3) => ({
|
|
76
76
|
x: e3.pageX,
|
|
77
77
|
y: e3.pageY
|
|
78
|
-
}),
|
|
79
|
-
typeof window < "u" && (window.document && (
|
|
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
|
|
84
|
-
this.slideToPage(
|
|
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 && !
|
|
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
|
|
90
|
-
this.slideToPage(
|
|
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 && !
|
|
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
|
|
98
|
-
if (this.isTouchComparing) return this.slideToPage(
|
|
97
|
+
let i4 = u(e3);
|
|
98
|
+
if (this.isTouchComparing) return this.slideToPage(i4), e3.preventDefault(), false;
|
|
99
99
|
if (!this.hasTouchMoved) {
|
|
100
|
-
let
|
|
101
|
-
if (this.slideDirection === "horizontal" &&
|
|
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
|
|
113
|
-
this.animationDirection !==
|
|
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
|
|
117
|
-
|
|
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
|
|
122
|
-
|
|
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
|
|
135
|
-
|
|
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(...
|
|
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(
|
|
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,
|
|
159
|
-
e3 === "hover" && (this.hover =
|
|
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
|
|
163
|
-
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
|
|
168
|
-
this.dispatchEvent(
|
|
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,
|
|
185
|
+
let e3 = null, i3 = this.animationDirection;
|
|
186
186
|
this.firstElement.style.setProperty("--transition-time", "var(--keyboard-transition-time)");
|
|
187
|
-
let
|
|
188
|
-
if (this.animationDirection === 0 ||
|
|
189
|
-
e3 === null && (e3 =
|
|
190
|
-
let
|
|
191
|
-
this.slide(
|
|
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(
|
|
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
|
|
203
|
-
|
|
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
|
|
206
|
+
return i2[a];
|
|
207
207
|
}
|
|
208
208
|
});
|
|
209
|
-
}) : (function(e2,
|
|
210
|
-
|
|
211
|
-
})),
|
|
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:
|
|
214
|
+
value: i2
|
|
215
215
|
});
|
|
216
|
-
}) : function(e2,
|
|
217
|
-
e2.default =
|
|
218
|
-
}),
|
|
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
|
|
221
|
-
if (e2 != null) for (var
|
|
222
|
-
return
|
|
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
|
|
226
|
-
typeof document < "u" && Promise.resolve().then(() =>
|
|
227
|
-
let
|
|
228
|
-
return (0,
|
|
229
|
-
|
|
230
|
-
}, [
|
|
231
|
-
|
|
232
|
-
}, []), (0,
|
|
233
|
-
class:
|
|
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:
|
|
236
|
-
},
|
|
235
|
+
ref: u
|
|
236
|
+
}, s2), e2);
|
|
237
237
|
});
|
|
238
|
-
})), import_compiler_runtime = require_compiler_runtime(), import_dist = require_dist();
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
},
|
|
247
|
-
let
|
|
248
|
-
|
|
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:
|
|
284
|
+
src: a,
|
|
251
285
|
alt: "Before",
|
|
252
|
-
width: "100%"
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
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:
|
|
294
|
+
src: o,
|
|
258
295
|
alt: "After",
|
|
259
|
-
width: "100%"
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
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();
|