@marimo-team/islands 0.23.15-dev32 → 0.23.15-dev4
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-7p7rt9iw.js → ConnectedDataExplorerComponent-CU4fZJzG.js} +4 -4
- package/dist/{ErrorBoundary-B_CAG7_e.js → ErrorBoundary-DE6tzZf-.js} +1 -1
- package/dist/{ImageComparisonComponent-1i5IBhon.js → ImageComparisonComponent-CHrI72em.js} +129 -173
- package/dist/assets/__vite-browser-external-BQCLNwri.js +1 -0
- package/dist/assets/worker-DAWRHcPq.js +73 -0
- package/dist/{chat-ui-C0wkSwxB.js → chat-ui-DinOvbWu.js} +3111 -3111
- package/dist/{code-visibility-CEHWVGz1.js → code-visibility-Dk8cVOny.js} +864 -946
- package/dist/{debounce-BOD3DbfP.js → constants-T20xxyNf.js} +24 -1
- package/dist/{formats-BX3uDQbB.js → formats-Dzx4J_z1.js} +1 -1
- package/dist/{glide-data-editor-CwZz71BD.js → glide-data-editor-CjTu7ukN.js} +3 -3
- package/dist/{html-to-image-D8Q5SLSJ.js → html-to-image-_wGfk8V-.js} +2241 -2277
- package/dist/{input-BGPrFH3g.js → input-DtsN7xm-.js} +2 -2
- package/dist/main.js +1201 -1297
- package/dist/{mermaid-UdmxG2PZ.js → mermaid-BYqXy_NE.js} +2 -2
- package/dist/{process-output-C_A12w9J.js → process-output-Mh4UrjwM.js} +1 -1
- package/dist/{reveal-component-kLDhMoa2.js → reveal-component-B5DXLyO7.js} +605 -618
- package/dist/{spec-DSs9v0xx.js → spec-Cz-Bj1JI.js} +1 -1
- package/dist/style.css +1 -1
- package/dist/{toDate-CKpRx4TS.js → toDate-CWNNlFEX.js} +4 -3
- package/dist/{useAsyncData-BSOyAbac.js → useAsyncData-KfHB8wQR.js} +1 -1
- package/dist/{useDeepCompareMemoize-BTLeWzuR.js → useDeepCompareMemoize-nJMtxhm4.js} +1 -1
- package/dist/{useLifecycle-C6wHjkhW.js → useLifecycle-DegSo0lV.js} +1 -1
- package/dist/{useTheme-Df_vGflw.js → useTheme-6eZ3GOTS.js} +27 -62
- package/dist/{vega-component-DNHEV0u0.js → vega-component-DzyyM9fc.js} +6 -6
- package/package.json +1 -1
- package/src/components/chat/__tests__/chat-utils.test.ts +1 -244
- package/src/components/chat/chat-panel.tsx +67 -196
- package/src/components/chat/chat-utils.ts +2 -111
- package/src/components/editor/SortableCell.tsx +2 -6
- package/src/components/editor/actions/pair-with-agent-modal.tsx +64 -20
- package/src/components/editor/ai/add-cell-with-ai.tsx +5 -14
- package/src/components/editor/ai/ai-completion-editor.tsx +1 -4
- package/src/components/editor/cell/cell-context-menu.tsx +0 -7
- package/src/components/editor/chrome/panels/packages-panel.tsx +1 -11
- package/src/components/editor/columns/cell-column.tsx +4 -34
- package/src/components/editor/columns/sortable-column.tsx +4 -24
- package/src/components/editor/navigation/__tests__/navigation.test.ts +0 -33
- package/src/components/editor/navigation/navigation.ts +1 -8
- package/src/components/editor/notebook-cell.tsx +106 -203
- package/src/components/editor/renderers/cell-array.tsx +13 -26
- package/src/components/editor/renderers/cells-renderer.tsx +2 -8
- package/src/components/editor/renderers/slides-layout/__tests__/plugin.test.ts +0 -29
- package/src/components/editor/renderers/slides-layout/types.ts +0 -4
- package/src/components/editor/renderers/vertical-layout/vertical-layout.tsx +19 -19
- package/src/components/slides/reveal-component.tsx +4 -37
- package/src/components/slides/slide-form.tsx +0 -72
- package/src/core/cells/__tests__/utils.test.ts +0 -59
- package/src/core/cells/utils.ts +0 -51
- package/src/core/codemirror/completion/__tests__/signature-hint.test.ts +3 -97
- package/src/core/codemirror/completion/signature-hint.ts +11 -78
- package/src/core/constants.ts +0 -6
- package/src/core/islands/__tests__/bridge.test.ts +46 -341
- package/src/core/islands/__tests__/parse.test.ts +0 -105
- package/src/core/islands/bootstrap.ts +3 -8
- package/src/core/islands/bridge.ts +23 -116
- package/src/core/islands/components/web-components.tsx +15 -76
- package/src/core/islands/constants.ts +0 -1
- package/src/core/islands/main.ts +3 -35
- package/src/core/islands/parse.ts +23 -70
- package/src/core/islands/worker/worker.tsx +57 -145
- package/src/core/wasm/worker/bootstrap.ts +20 -113
- package/src/css/app/Cell.css +0 -10
- package/src/hooks/useHotkey.ts +4 -29
- package/src/plugins/impl/anywidget/__tests__/host.test.ts +9 -6
- package/src/plugins/impl/anywidget/__tests__/widget-binding.test.ts +61 -22
- package/src/plugins/impl/anywidget/model-proxy.ts +13 -0
- package/src/plugins/impl/anywidget/widget-binding.ts +34 -4
- package/src/plugins/impl/image-comparison/ImageComparisonComponent.tsx +2 -53
- package/src/plugins/impl/matplotlib/__tests__/matplotlib-renderer.test.ts +3 -71
- package/src/plugins/impl/matplotlib/matplotlib-renderer.ts +0 -1
- package/src/theme/useTheme.ts +1 -16
- package/dist/assets/__vite-browser-external-CjNAy01L.js +0 -1
- package/dist/assets/worker-B3XPCb6y.js +0 -98
- package/src/components/chat/__tests__/message-queue.test.tsx +0 -121
- package/src/components/editor/__tests__/output-persistence.test.tsx +0 -241
- package/src/components/editor/actions/__tests__/pair-with-agent-commands.test.ts +0 -153
- package/src/components/editor/actions/pair-with-agent-commands.ts +0 -109
- package/src/components/editor/columns/__tests__/cell-column.test.tsx +0 -105
- package/src/components/editor/renderers/__tests__/cells-renderer.test.tsx +0 -66
- package/src/core/islands/components/__tests__/web-components.test.tsx +0 -214
- package/src/core/islands/worker/__tests__/controller.test.ts +0 -173
- package/src/hooks/__tests__/useHotkey.test.tsx +0 -88
- package/src/plugins/impl/image-comparison/__tests__/ImageComparisonComponent.test.tsx +0 -71
- 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-
|
|
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-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 {
|
|
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-
|
|
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 {
|
|
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,
|
|
9
|
-
|
|
10
|
-
var
|
|
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
|
-
|
|
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
|
|
18
|
+
let a = i;
|
|
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 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
|
-
},
|
|
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
|
|
35
|
-
if (
|
|
36
|
-
var
|
|
37
|
-
|
|
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
|
|
40
|
-
var
|
|
41
|
-
|
|
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
|
-
},
|
|
43
|
+
}, t2;
|
|
44
44
|
};
|
|
45
45
|
}
|
|
46
|
-
},
|
|
47
|
-
function
|
|
48
|
-
var
|
|
49
|
-
if (
|
|
50
|
-
var
|
|
51
|
-
id:
|
|
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[
|
|
54
|
+
return e[r](a, a.exports, n), a.exports;
|
|
55
55
|
}
|
|
56
|
-
|
|
57
|
-
var
|
|
58
|
-
return
|
|
59
|
-
},
|
|
60
|
-
for (var
|
|
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:
|
|
62
|
+
get: t2[r]
|
|
63
63
|
});
|
|
64
|
-
},
|
|
65
|
-
var e2 =
|
|
66
|
-
let
|
|
67
|
-
let
|
|
68
|
-
return
|
|
69
|
-
},
|
|
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
|
-
},
|
|
72
|
+
}, o = ["horizontal", "vertical"], s = (e3) => ({
|
|
73
73
|
x: e3.touches[0].pageX,
|
|
74
74
|
y: e3.touches[0].pageY
|
|
75
|
-
}),
|
|
75
|
+
}), c = (e3) => ({
|
|
76
76
|
x: e3.pageX,
|
|
77
77
|
y: e3.pageY
|
|
78
|
-
}),
|
|
79
|
-
typeof window < "u" && (window.document && (
|
|
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
|
|
84
|
-
this.slideToPage(
|
|
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 && !
|
|
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
|
|
90
|
-
this.slideToPage(
|
|
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 && !
|
|
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
|
|
98
|
-
if (this.isTouchComparing) return this.slideToPage(
|
|
97
|
+
let t4 = s(e3);
|
|
98
|
+
if (this.isTouchComparing) return this.slideToPage(t4), e3.preventDefault(), false;
|
|
99
99
|
if (!this.hasTouchMoved) {
|
|
100
|
-
let
|
|
101
|
-
if (this.slideDirection === "horizontal" &&
|
|
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
|
|
113
|
-
this.animationDirection !==
|
|
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
|
|
117
|
-
|
|
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
|
|
122
|
-
|
|
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
|
|
135
|
-
|
|
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(...
|
|
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(
|
|
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,
|
|
159
|
-
e3 === "hover" && (this.hover =
|
|
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
|
|
163
|
-
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
|
|
168
|
-
this.dispatchEvent(
|
|
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,
|
|
185
|
+
let e3 = null, t3 = 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 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(
|
|
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
|
|
203
|
-
|
|
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
|
|
206
|
+
return t2[n];
|
|
207
207
|
}
|
|
208
208
|
});
|
|
209
|
-
}) : (function(e2,
|
|
210
|
-
|
|
211
|
-
})),
|
|
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:
|
|
214
|
+
value: t2
|
|
215
215
|
});
|
|
216
|
-
}) : function(e2,
|
|
217
|
-
e2.default =
|
|
218
|
-
}),
|
|
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
|
|
221
|
-
if (e2 != null) for (var
|
|
222
|
-
return
|
|
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
|
|
226
|
-
typeof document < "u" && Promise.resolve().then(() =>
|
|
227
|
-
let
|
|
228
|
-
return (0,
|
|
229
|
-
|
|
230
|
-
}, [
|
|
231
|
-
|
|
232
|
-
}, []), (0,
|
|
233
|
-
class:
|
|
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:
|
|
236
|
-
},
|
|
235
|
+
ref: s
|
|
236
|
+
}, i2), 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
|
-
|
|
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:
|
|
250
|
+
src: n,
|
|
285
251
|
alt: "Before",
|
|
286
|
-
width: "100%"
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
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:
|
|
257
|
+
src: r,
|
|
295
258
|
alt: "After",
|
|
296
|
-
width: "100%"
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
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();
|