ywana-core8 0.2.14 → 0.2.16

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 CHANGED
@@ -15079,19 +15079,36 @@ li.selected,
15079
15079
  justify-content: space-between;
15080
15080
  margin-top: 20px;
15081
15081
  display: none !important;
15082
- }.image-viewer {
15082
+ }.image-viewer {
15083
15083
  display: flex;
15084
15084
  justify-content: center;
15085
15085
  align-items: center;
15086
+ width: 100%;
15087
+ height: 100%;
15088
+ overflow: hidden;
15089
+ }
15090
+
15091
+ .image-viewer canvas {
15092
+ cursor: grab;
15093
+ max-width: 100%;
15094
+ max-height: 100%;
15095
+ }
15096
+
15097
+ .image-viewer canvas:active {
15098
+ cursor: grabbing;
15086
15099
  }.viewer {
15100
+ position: fixed;
15101
+ top: 0;
15102
+ left: 0;
15087
15103
  width: 100vw;
15088
15104
  height: 100vh;
15089
- background-color: rgba(0, 0, 0, .75);
15105
+ background-color: rgba(0, 0, 0, .85);
15090
15106
  display: grid;
15091
15107
  grid-template-columns: 1fr auto;
15092
15108
  grid-template-rows: 4rem 1fr;
15093
15109
  grid-template-areas: "header aside" "main aside";
15094
15110
  color: #FFF;
15111
+ z-index: 1000;
15095
15112
  }
15096
15113
 
15097
15114
  .viewer>header {
@@ -15119,6 +15136,7 @@ li.selected,
15119
15136
 
15120
15137
  .viewer>main>.resizer {
15121
15138
  width: 100%;
15139
+ height: 100%;
15122
15140
  overflow: hidden;
15123
15141
  position: relative;
15124
15142
  display: flex;
@@ -15127,9 +15145,18 @@ li.selected,
15127
15145
  padding: 1rem;
15128
15146
  }
15129
15147
 
15130
- .viewer>main>.resizer img {
15148
+ .viewer>main>.resizer picture {
15131
15149
  width: 100%;
15132
- object-fit: fill;
15150
+ height: 100%;
15151
+ display: flex;
15152
+ justify-content: center;
15153
+ align-items: center;
15154
+ }
15155
+
15156
+ .viewer>main>.resizer img {
15157
+ max-width: 100%;
15158
+ max-height: 100%;
15159
+ object-fit: contain;
15133
15160
  }
15134
15161
 
15135
15162
  @media (min-width: 800px) {
@@ -15141,9 +15168,12 @@ li.selected,
15141
15168
 
15142
15169
  .viewer>aside {
15143
15170
  min-width: 22rem;
15171
+ max-width: 25rem;
15144
15172
  grid-area: aside;
15145
15173
  display: none;
15146
- background-color: rgb(50, 50, 50);
15174
+ background-color: rgba(40, 40, 40, 0.95);
15175
+ backdrop-filter: blur(10px);
15176
+ border-left: 1px solid rgba(255, 255, 255, 0.1);
15147
15177
  }
15148
15178
 
15149
15179
  .viewer>aside.open {
@@ -15152,22 +15182,40 @@ li.selected,
15152
15182
  flex-direction: column;
15153
15183
  }
15154
15184
 
15185
+ .viewer>aside main {
15186
+ flex: 1;
15187
+ overflow-y: auto;
15188
+ padding: 0;
15189
+ }
15190
+
15155
15191
  .viewer>aside .property>label {
15156
15192
  color: #AAA;
15157
15193
  }
15158
15194
 
15159
15195
  .viewer>footer {
15160
- width: 15rem;
15196
+ width: 12rem;
15161
15197
  position: absolute;
15162
- bottom: 1rem;
15163
- left: calc(50vw - 4rem);
15164
- border-radius: 3px;
15198
+ bottom: 2rem;
15199
+ left: calc(50vw - 6rem);
15200
+ border-radius: 8px;
15165
15201
  z-index: 100;
15166
15202
  display: flex;
15167
15203
  justify-content: space-between;
15168
15204
  align-items: center;
15169
- padding: .5rem;
15170
- background-color: rgba(0, 0, 0, .75);
15205
+ padding: 0.75rem 1rem;
15206
+ background-color: rgba(0, 0, 0, 0.8);
15207
+ backdrop-filter: blur(10px);
15208
+ border: 1px solid rgba(255, 255, 255, 0.1);
15209
+ box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
15210
+ }
15211
+
15212
+ .viewer>footer .icon {
15213
+ transition: all 0.2s ease;
15214
+ }
15215
+
15216
+ .viewer>footer .icon:hover {
15217
+ transform: scale(1.1);
15218
+ color: #fff;
15171
15219
  }.kanban {
15172
15220
  background-color: var(--background-color);
15173
15221
  overflow-x: auto;
package/dist/index.js CHANGED
@@ -22634,26 +22634,38 @@ const LOGIN_CONTEXT = {
22634
22634
  const SCROLL_SENSITIVITY = 5e-4;
22635
22635
  const MAX_ZOOM = 5;
22636
22636
  const MIN_ZOOM = 0.1;
22637
- const ImageViewer = ({ image }) => {
22637
+ const ImageViewer = React.forwardRef(({ image }, ref2) => {
22638
22638
  const [offset2, setOffset] = React.useState({ x: 0, y: 0 });
22639
22639
  const [zoom, setZoom] = React.useState(1);
22640
- const [draggind, setDragging] = React.useState(false);
22640
+ const [dragging, setDragging] = React.useState(false);
22641
22641
  const touch = React.useRef({ x: 0, y: 0 });
22642
22642
  const canvasRef = React.useRef(null);
22643
22643
  const containerRef = React.useRef(null);
22644
22644
  const observer = React.useRef(null);
22645
22645
  const background = React.useMemo(() => new Image(), [image]);
22646
22646
  const clamp = (num, min2, max2) => Math.min(Math.max(num, min2), max2);
22647
+ React.useImperativeHandle(ref2, () => ({
22648
+ zoomIn: () => {
22649
+ setZoom((prevZoom) => clamp(prevZoom + 0.2, MIN_ZOOM, MAX_ZOOM));
22650
+ },
22651
+ zoomOut: () => {
22652
+ setZoom((prevZoom) => clamp(prevZoom - 0.2, MIN_ZOOM, MAX_ZOOM));
22653
+ },
22654
+ resetZoom: () => {
22655
+ setZoom(1);
22656
+ setOffset({ x: 0, y: 0 });
22657
+ }
22658
+ }), []);
22647
22659
  const handleWheel = (event) => {
22648
22660
  const { deltaY } = event;
22649
- if (!draggind) {
22661
+ if (!dragging) {
22650
22662
  setZoom(
22651
22663
  (zoom2) => clamp(zoom2 + deltaY * SCROLL_SENSITIVITY * -1, MIN_ZOOM, MAX_ZOOM)
22652
22664
  );
22653
22665
  }
22654
22666
  };
22655
22667
  const handleMouseMove = (event) => {
22656
- if (draggind) {
22668
+ if (dragging) {
22657
22669
  const { x, y } = touch.current;
22658
22670
  const { clientX, clientY } = event;
22659
22671
  setOffset({
@@ -22670,24 +22682,34 @@ const ImageViewer = ({ image }) => {
22670
22682
  };
22671
22683
  const handleMouseUp = () => setDragging(false);
22672
22684
  const draw = () => {
22673
- if (canvasRef.current) {
22674
- const { width, height } = canvasRef.current;
22675
- const context = canvasRef.current.getContext("2d");
22676
- canvasRef.current.width = width;
22677
- canvasRef.current.height = height;
22685
+ if (!canvasRef.current || !background.complete || !background.naturalWidth) {
22686
+ return;
22687
+ }
22688
+ try {
22689
+ const canvas = canvasRef.current;
22690
+ const { width, height } = canvas;
22691
+ const context = canvas.getContext("2d");
22692
+ canvas.width = width;
22693
+ canvas.height = height;
22694
+ context.save();
22678
22695
  context.translate(-offset2.x, -offset2.y);
22679
22696
  context.scale(zoom, zoom);
22680
22697
  context.clearRect(0, 0, width, height);
22681
- const x = (context.canvas.width / zoom - background.width) / 2;
22682
- const y = (context.canvas.height / zoom - background.height) / 2;
22698
+ const x = (canvas.width / zoom - background.width) / 2;
22699
+ const y = (canvas.height / zoom - background.height) / 2;
22683
22700
  context.drawImage(background, x, y);
22701
+ context.restore();
22702
+ } catch (error) {
22703
+ console.warn("Error drawing image:", error);
22684
22704
  }
22685
22705
  };
22686
22706
  React.useEffect(() => {
22707
+ const container = containerRef.current;
22708
+ if (!container) return;
22687
22709
  observer.current = new ResizeObserver((entries) => {
22688
22710
  entries.forEach(({ target }) => {
22689
22711
  const { width, height } = background;
22690
- if (target.clientWidth < width) {
22712
+ if (target.clientWidth < width && canvasRef.current) {
22691
22713
  const scale = target.clientWidth / width;
22692
22714
  canvasRef.current.width = width * scale;
22693
22715
  canvasRef.current.height = height * scale;
@@ -22695,23 +22717,37 @@ const ImageViewer = ({ image }) => {
22695
22717
  }
22696
22718
  });
22697
22719
  });
22698
- observer.current.observe(containerRef.current);
22699
- return () => observer.current.unobserve(containerRef.current);
22720
+ observer.current.observe(container);
22721
+ return () => {
22722
+ if (observer.current && container) {
22723
+ observer.current.unobserve(container);
22724
+ }
22725
+ };
22700
22726
  }, []);
22701
22727
  React.useEffect(() => {
22728
+ if (!image) return;
22702
22729
  background.src = image;
22703
- if (canvasRef.current) {
22704
- background.onload = () => {
22730
+ const handleImageLoad = () => {
22731
+ if (canvasRef.current) {
22705
22732
  const { width, height } = background;
22706
22733
  canvasRef.current.width = width;
22707
22734
  canvasRef.current.height = height;
22708
22735
  canvasRef.current.getContext("2d").drawImage(background, 0, 0);
22709
- };
22710
- }
22711
- }, [background]);
22736
+ }
22737
+ };
22738
+ const handleImageError = () => {
22739
+ console.warn("Failed to load image:", image);
22740
+ };
22741
+ background.onload = handleImageLoad;
22742
+ background.onerror = handleImageError;
22743
+ return () => {
22744
+ background.onload = null;
22745
+ background.onerror = null;
22746
+ };
22747
+ }, [image, background]);
22712
22748
  React.useEffect(() => {
22713
22749
  draw();
22714
- }, [zoom, offset2]);
22750
+ }, [zoom, offset2, background.src]);
22715
22751
  return /* @__PURE__ */ React.createElement("div", { className: "image-viewer", ref: containerRef }, /* @__PURE__ */ React.createElement(
22716
22752
  "canvas",
22717
22753
  {
@@ -22722,14 +22758,55 @@ const ImageViewer = ({ image }) => {
22722
22758
  ref: canvasRef
22723
22759
  }
22724
22760
  ));
22761
+ });
22762
+ const ViewerTest = () => {
22763
+ const [showViewer, setShowViewer] = React.useState(false);
22764
+ 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"));
22765
+ const sampleActions = [
22766
+ /* @__PURE__ */ React.createElement(Icon, { key: "download", icon: "download", clickable: true, title: "Download" }),
22767
+ /* @__PURE__ */ React.createElement(Icon, { key: "share", icon: "share", clickable: true, title: "Share" })
22768
+ ];
22769
+ return /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement("button", { onClick: () => setShowViewer(true) }, "Open Viewer Test"), showViewer && /* @__PURE__ */ React.createElement(
22770
+ Viewer,
22771
+ {
22772
+ title: "Sample Image",
22773
+ src: "https://concepto.de/wp-content/uploads/2015/03/paisaje-800x409.jpg",
22774
+ info: sampleInfo,
22775
+ actions: sampleActions,
22776
+ tools: true,
22777
+ onClose: () => setShowViewer(false)
22778
+ }
22779
+ ));
22725
22780
  };
22726
22781
  const Viewer = ({ title, src, info, actions = [], tools = false, onClose }) => {
22727
22782
  const [showDetails, setShowDetails] = React.useState(false);
22783
+ const [imageViewerRef, setImageViewerRef] = React.useState(null);
22728
22784
  function toggleDetails() {
22729
22785
  setShowDetails(!showDetails);
22730
22786
  }
22787
+ function handleZoomIn() {
22788
+ if (imageViewerRef && imageViewerRef.zoomIn) {
22789
+ imageViewerRef.zoomIn();
22790
+ }
22791
+ }
22792
+ function handleZoomOut() {
22793
+ if (imageViewerRef && imageViewerRef.zoomOut) {
22794
+ imageViewerRef.zoomOut();
22795
+ }
22796
+ }
22797
+ function handleZoomReset() {
22798
+ if (imageViewerRef && imageViewerRef.resetZoom) {
22799
+ imageViewerRef.resetZoom();
22800
+ }
22801
+ }
22731
22802
  const headerTitle = /* @__PURE__ */ React.createElement(Text, { use: "headline6" }, title);
22732
- return /* @__PURE__ */ React.createElement("div", { className: "viewer" }, /* @__PURE__ */ React.createElement(Header, { icon: "view", title: headerTitle }, onClose ? /* @__PURE__ */ React.createElement(Icon, { icon: "close", clickable: true, action: onClose }) : null, showDetails ? "" : /* @__PURE__ */ React.createElement(Icon, { icon: "info", clickable: true, action: toggleDetails }), actions), /* @__PURE__ */ React.createElement("main", null, /* @__PURE__ */ React.createElement("div", { className: "resizer" }, /* @__PURE__ */ React.createElement("picture", null, /* @__PURE__ */ React.createElement(ImageViewer, { image: src })))), /* @__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" }), /* @__PURE__ */ React.createElement(Icon, { clickable: true, icon: "zoom_out_map" }), /* @__PURE__ */ React.createElement(Icon, { clickable: true, icon: "zoom_in" })) : null);
22803
+ 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(
22804
+ ImageViewer,
22805
+ {
22806
+ image: src,
22807
+ ref: setImageViewerRef
22808
+ }
22809
+ )))), /* @__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 })));
22733
22810
  };
22734
22811
  const Kanban = ({ children }) => {
22735
22812
  const hasSwimlanes = React.useMemo(() => {
@@ -43033,6 +43110,7 @@ exports.MenuIcon = MenuIcon;
43033
43110
  exports.MenuItem = MenuItem;
43034
43111
  exports.MenuSeparator = MenuSeparator;
43035
43112
  exports.MonthCalendar = MonthCalendar;
43113
+ exports.MultiProgress = MultiProgress;
43036
43114
  exports.MultiSelector = MultiSelector;
43037
43115
  exports.Page = Page;
43038
43116
  exports.PageContext = PageContext;
@@ -43046,6 +43124,7 @@ exports.Planner2 = Planner2;
43046
43124
  exports.ProgressExamples = ProgressExamples;
43047
43125
  exports.Property = Property;
43048
43126
  exports.PropertyExamples = PropertyExamples;
43127
+ exports.RadialProgress = RadialProgress;
43049
43128
  exports.RadioButton = RadioButton;
43050
43129
  exports.RadioExamples = RadioExamples;
43051
43130
  exports.RadioGroup = RadioGroup;
@@ -43057,6 +43136,7 @@ exports.Site = Site;
43057
43136
  exports.SiteContext = SiteContext;
43058
43137
  exports.SiteProvider = SiteProvider;
43059
43138
  exports.Stack = Stack;
43139
+ exports.StepProgress = StepProgress;
43060
43140
  exports.Switch = Switch;
43061
43141
  exports.SwitchExamples = SwitchExamples;
43062
43142
  exports.TASK_STATES = TASK_STATES;
@@ -43101,6 +43181,7 @@ exports.UploadIcon = UploadIcon;
43101
43181
  exports.Uploader = Uploader;
43102
43182
  exports.View = View;
43103
43183
  exports.Viewer = Viewer;
43184
+ exports.ViewerTest = ViewerTest;
43104
43185
  exports.WaitScreen = WaitScreen;
43105
43186
  exports.Window = Window;
43106
43187
  exports.WindowManager = WindowManager;