ywana-core8 0.2.13 → 0.2.15
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/index.css +60 -11
- package/dist/index.js +63 -6
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +64 -7
- package/dist/index.modern.js.map +1 -1
- package/dist/index.umd.js +63 -6
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/desktop/desktop.js +1 -3
- package/src/desktop/window.css +1 -0
- package/src/html/index.js +1 -1
- package/src/widgets/image/ImageViewer.css +14 -1
- package/src/widgets/image/ImageViewer.js +20 -6
- package/src/widgets/viewer/Viewer.css +45 -10
- package/src/widgets/viewer/Viewer.js +71 -19
package/dist/index.umd.js
CHANGED
@@ -22635,26 +22635,38 @@ const rows = [
|
|
22635
22635
|
const SCROLL_SENSITIVITY = 5e-4;
|
22636
22636
|
const MAX_ZOOM = 5;
|
22637
22637
|
const MIN_ZOOM = 0.1;
|
22638
|
-
const ImageViewer = ({ image }) => {
|
22638
|
+
const ImageViewer = React.forwardRef(({ image }, ref2) => {
|
22639
22639
|
const [offset2, setOffset] = React.useState({ x: 0, y: 0 });
|
22640
22640
|
const [zoom, setZoom] = React.useState(1);
|
22641
|
-
const [
|
22641
|
+
const [dragging, setDragging] = React.useState(false);
|
22642
22642
|
const touch = React.useRef({ x: 0, y: 0 });
|
22643
22643
|
const canvasRef = React.useRef(null);
|
22644
22644
|
const containerRef = React.useRef(null);
|
22645
22645
|
const observer = React.useRef(null);
|
22646
22646
|
const background = React.useMemo(() => new Image(), [image]);
|
22647
22647
|
const clamp = (num, min2, max2) => Math.min(Math.max(num, min2), max2);
|
22648
|
+
React.useImperativeHandle(ref2, () => ({
|
22649
|
+
zoomIn: () => {
|
22650
|
+
setZoom((prevZoom) => clamp(prevZoom + 0.2, MIN_ZOOM, MAX_ZOOM));
|
22651
|
+
},
|
22652
|
+
zoomOut: () => {
|
22653
|
+
setZoom((prevZoom) => clamp(prevZoom - 0.2, MIN_ZOOM, MAX_ZOOM));
|
22654
|
+
},
|
22655
|
+
resetZoom: () => {
|
22656
|
+
setZoom(1);
|
22657
|
+
setOffset({ x: 0, y: 0 });
|
22658
|
+
}
|
22659
|
+
}), []);
|
22648
22660
|
const handleWheel = (event) => {
|
22649
22661
|
const { deltaY } = event;
|
22650
|
-
if (!
|
22662
|
+
if (!dragging) {
|
22651
22663
|
setZoom(
|
22652
22664
|
(zoom2) => clamp(zoom2 + deltaY * SCROLL_SENSITIVITY * -1, MIN_ZOOM, MAX_ZOOM)
|
22653
22665
|
);
|
22654
22666
|
}
|
22655
22667
|
};
|
22656
22668
|
const handleMouseMove = (event) => {
|
22657
|
-
if (
|
22669
|
+
if (dragging) {
|
22658
22670
|
const { x, y } = touch.current;
|
22659
22671
|
const { clientX, clientY } = event;
|
22660
22672
|
setOffset({
|
@@ -22723,14 +22735,55 @@ const rows = [
|
|
22723
22735
|
ref: canvasRef
|
22724
22736
|
}
|
22725
22737
|
));
|
22738
|
+
});
|
22739
|
+
const ViewerTest = () => {
|
22740
|
+
const [showViewer, setShowViewer] = React.useState(false);
|
22741
|
+
const sampleInfo = /* @__PURE__ */ React.createElement("div", { style: { padding: "1rem" } }, /* @__PURE__ */ React.createElement("h3", null, "Sample Image"), /* @__PURE__ */ React.createElement("p", null, /* @__PURE__ */ React.createElement("strong", null, "Size:"), " 1920x1080"), /* @__PURE__ */ React.createElement("p", null, /* @__PURE__ */ React.createElement("strong", null, "Format:"), " PNG"), /* @__PURE__ */ React.createElement("p", null, /* @__PURE__ */ React.createElement("strong", null, "Created:"), " 2024-01-15"));
|
22742
|
+
const sampleActions = [
|
22743
|
+
/* @__PURE__ */ React.createElement(Icon, { key: "download", icon: "download", clickable: true, title: "Download" }),
|
22744
|
+
/* @__PURE__ */ React.createElement(Icon, { key: "share", icon: "share", clickable: true, title: "Share" })
|
22745
|
+
];
|
22746
|
+
return /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement("button", { onClick: () => setShowViewer(true) }, "Open Viewer Test"), showViewer && /* @__PURE__ */ React.createElement(
|
22747
|
+
Viewer,
|
22748
|
+
{
|
22749
|
+
title: "Sample Image",
|
22750
|
+
src: "https://concepto.de/wp-content/uploads/2015/03/paisaje-800x409.jpg",
|
22751
|
+
info: sampleInfo,
|
22752
|
+
actions: sampleActions,
|
22753
|
+
tools: true,
|
22754
|
+
onClose: () => setShowViewer(false)
|
22755
|
+
}
|
22756
|
+
));
|
22726
22757
|
};
|
22727
22758
|
const Viewer = ({ title, src, info, actions = [], tools = false, onClose }) => {
|
22728
22759
|
const [showDetails, setShowDetails] = React.useState(false);
|
22760
|
+
const [imageViewerRef, setImageViewerRef] = React.useState(null);
|
22729
22761
|
function toggleDetails() {
|
22730
22762
|
setShowDetails(!showDetails);
|
22731
22763
|
}
|
22764
|
+
function handleZoomIn() {
|
22765
|
+
if (imageViewerRef && imageViewerRef.zoomIn) {
|
22766
|
+
imageViewerRef.zoomIn();
|
22767
|
+
}
|
22768
|
+
}
|
22769
|
+
function handleZoomOut() {
|
22770
|
+
if (imageViewerRef && imageViewerRef.zoomOut) {
|
22771
|
+
imageViewerRef.zoomOut();
|
22772
|
+
}
|
22773
|
+
}
|
22774
|
+
function handleZoomReset() {
|
22775
|
+
if (imageViewerRef && imageViewerRef.resetZoom) {
|
22776
|
+
imageViewerRef.resetZoom();
|
22777
|
+
}
|
22778
|
+
}
|
22732
22779
|
const headerTitle = /* @__PURE__ */ React.createElement(Text, { use: "headline6" }, title);
|
22733
|
-
return /* @__PURE__ */ React.createElement("div", { className: "viewer" }, /* @__PURE__ */ React.createElement(Header, { icon: "view", title: headerTitle },
|
22780
|
+
return /* @__PURE__ */ React.createElement("div", { className: "viewer" }, /* @__PURE__ */ React.createElement(Header, { icon: "view", title: headerTitle }, actions, !showDetails && /* @__PURE__ */ React.createElement(Icon, { icon: "info", clickable: true, action: toggleDetails }), onClose && /* @__PURE__ */ React.createElement(Icon, { icon: "close", clickable: true, action: onClose })), /* @__PURE__ */ React.createElement("main", null, /* @__PURE__ */ React.createElement("div", { className: "resizer" }, /* @__PURE__ */ React.createElement("picture", null, /* @__PURE__ */ React.createElement(
|
22781
|
+
ImageViewer,
|
22782
|
+
{
|
22783
|
+
image: src,
|
22784
|
+
ref: setImageViewerRef
|
22785
|
+
}
|
22786
|
+
)))), /* @__PURE__ */ React.createElement("aside", { className: `${showDetails ? "open" : ""}` }, /* @__PURE__ */ React.createElement(Header, { title: "Detalles" }, /* @__PURE__ */ React.createElement(Icon, { icon: "close", clickable: true, action: toggleDetails })), /* @__PURE__ */ React.createElement("main", null, info)), tools && /* @__PURE__ */ React.createElement("footer", null, /* @__PURE__ */ React.createElement(Icon, { clickable: true, icon: "zoom_out", action: handleZoomOut }), /* @__PURE__ */ React.createElement(Icon, { clickable: true, icon: "zoom_out_map", action: handleZoomReset }), /* @__PURE__ */ React.createElement(Icon, { clickable: true, icon: "zoom_in", action: handleZoomIn })));
|
22734
22787
|
};
|
22735
22788
|
const Kanban = ({ children }) => {
|
22736
22789
|
const hasSwimlanes = React.useMemo(() => {
|
@@ -32970,7 +33023,7 @@ const rows = [
|
|
32970
33023
|
toolbar: window2.toolbar,
|
32971
33024
|
statusBar: window2.statusBar
|
32972
33025
|
},
|
32973
|
-
|
33026
|
+
window2.content
|
32974
33027
|
)));
|
32975
33028
|
};
|
32976
33029
|
const DesktopTaskbar = () => {
|
@@ -43034,6 +43087,7 @@ Middle click: Close`
|
|
43034
43087
|
exports2.MenuItem = MenuItem;
|
43035
43088
|
exports2.MenuSeparator = MenuSeparator;
|
43036
43089
|
exports2.MonthCalendar = MonthCalendar;
|
43090
|
+
exports2.MultiProgress = MultiProgress;
|
43037
43091
|
exports2.MultiSelector = MultiSelector;
|
43038
43092
|
exports2.Page = Page;
|
43039
43093
|
exports2.PageContext = PageContext;
|
@@ -43047,6 +43101,7 @@ Middle click: Close`
|
|
43047
43101
|
exports2.ProgressExamples = ProgressExamples;
|
43048
43102
|
exports2.Property = Property;
|
43049
43103
|
exports2.PropertyExamples = PropertyExamples;
|
43104
|
+
exports2.RadialProgress = RadialProgress;
|
43050
43105
|
exports2.RadioButton = RadioButton;
|
43051
43106
|
exports2.RadioExamples = RadioExamples;
|
43052
43107
|
exports2.RadioGroup = RadioGroup;
|
@@ -43058,6 +43113,7 @@ Middle click: Close`
|
|
43058
43113
|
exports2.SiteContext = SiteContext;
|
43059
43114
|
exports2.SiteProvider = SiteProvider;
|
43060
43115
|
exports2.Stack = Stack;
|
43116
|
+
exports2.StepProgress = StepProgress;
|
43061
43117
|
exports2.Switch = Switch;
|
43062
43118
|
exports2.SwitchExamples = SwitchExamples;
|
43063
43119
|
exports2.TASK_STATES = TASK_STATES;
|
@@ -43102,6 +43158,7 @@ Middle click: Close`
|
|
43102
43158
|
exports2.Uploader = Uploader;
|
43103
43159
|
exports2.View = View;
|
43104
43160
|
exports2.Viewer = Viewer;
|
43161
|
+
exports2.ViewerTest = ViewerTest;
|
43105
43162
|
exports2.WaitScreen = WaitScreen;
|
43106
43163
|
exports2.Window = Window;
|
43107
43164
|
exports2.WindowManager = WindowManager;
|