rita-workspace 0.5.37 → 0.5.39

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/README.md CHANGED
@@ -139,6 +139,12 @@ const [workspaceEnabled] = useState(() => {
139
139
  });
140
140
  ```
141
141
 
142
+ ### Cross-tab "last active drawing" memory
143
+
144
+ The library writes `localStorage['rita-workspace-last-active-drawing']` whenever the active drawing changes. On mount in a tab without a session-pinned drawing (e.g. auto-start in a fresh tab), the active-drawing resolution falls back to this id before defaulting to the first drawing in the list. Users see the drawing they last edited rather than an arbitrary one.
145
+
146
+ Resolution order: `sessionStorage['rita-workspace-tab-drawing']` → `localStorage['rita-workspace-last-active-drawing']` → `wsDrawings[0]`.
147
+
142
148
  ## API Reference
143
149
 
144
150
  ### Components
package/dist/index.css CHANGED
@@ -166,3 +166,12 @@
166
166
  .toggleButton:hover {
167
167
  background: #e9ecef;
168
168
  }
169
+
170
+ /* src/ui/Dialog/Dialog.css */
171
+ .theme--dark .rita-thumbnail-wrapper {
172
+ box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
173
+ border-color: rgba(255, 255, 255, 0.12);
174
+ }
175
+ .theme--dark .rita-thumbnail-wrapper img {
176
+ opacity: 0.88;
177
+ }
package/dist/index.js CHANGED
@@ -794,7 +794,13 @@ function WorkspaceProvider({ children, lang = "en" }) {
794
794
  active = wsDrawings.find((d) => d.id === lastDrawingId) || null;
795
795
  }
796
796
  if (!active && wsDrawings.length > 0) {
797
- active = wsDrawings[0];
797
+ const globalLastActiveId = localStorage.getItem("rita-workspace-last-active-drawing");
798
+ if (globalLastActiveId) {
799
+ active = wsDrawings.find((d) => d.id === globalLastActiveId) || null;
800
+ }
801
+ if (!active) {
802
+ active = wsDrawings[0];
803
+ }
798
804
  }
799
805
  if (active) {
800
806
  setActiveDrawing2(active);
@@ -808,6 +814,11 @@ function WorkspaceProvider({ children, lang = "en" }) {
808
814
  }
809
815
  init();
810
816
  }, []);
817
+ (0, import_react.useEffect)(() => {
818
+ if (activeDrawing?.id) {
819
+ localStorage.setItem("rita-workspace-last-active-drawing", activeDrawing.id);
820
+ }
821
+ }, [activeDrawing?.id]);
811
822
  const refreshDrawings = (0, import_react.useCallback)(async () => {
812
823
  if (!workspace) return;
813
824
  try {
@@ -2016,18 +2027,26 @@ var DrawingsDialog = ({
2016
2027
  borderRadius: "2px",
2017
2028
  pointerEvents: "none"
2018
2029
  } }),
2019
- renderThumbnail && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { style: {
2020
- width: "64px",
2021
- height: "48px",
2022
- flexShrink: 0,
2023
- borderRadius: "4px",
2024
- overflow: "hidden",
2025
- border: "1px solid var(--default-border-color, #e0e0e0)",
2026
- backgroundColor: "#fff",
2027
- display: "flex",
2028
- alignItems: "center",
2029
- justifyContent: "center"
2030
- }, children: renderThumbnail(drawing) }),
2030
+ renderThumbnail && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
2031
+ "div",
2032
+ {
2033
+ className: "rita-thumbnail-wrapper",
2034
+ style: {
2035
+ width: "64px",
2036
+ height: "48px",
2037
+ flexShrink: 0,
2038
+ borderRadius: "4px",
2039
+ overflow: "hidden",
2040
+ border: "1px solid var(--default-border-color, #e0e0e0)",
2041
+ backgroundColor: "var(--island-bg-color, #fff)",
2042
+ display: "flex",
2043
+ alignItems: "center",
2044
+ justifyContent: "center",
2045
+ boxShadow: "inset 0 0 0 1px rgba(0,0,0,0.04)"
2046
+ },
2047
+ children: renderThumbnail(drawing)
2048
+ }
2049
+ ),
2031
2050
  /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { style: { flex: 1, minWidth: 0 }, children: editingId === drawing.id ? /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { style: { display: "flex", gap: "6px", alignItems: "center" }, children: [
2032
2051
  /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
2033
2052
  "input",
package/dist/index.mjs CHANGED
@@ -722,7 +722,13 @@ function WorkspaceProvider({ children, lang = "en" }) {
722
722
  active = wsDrawings.find((d) => d.id === lastDrawingId) || null;
723
723
  }
724
724
  if (!active && wsDrawings.length > 0) {
725
- active = wsDrawings[0];
725
+ const globalLastActiveId = localStorage.getItem("rita-workspace-last-active-drawing");
726
+ if (globalLastActiveId) {
727
+ active = wsDrawings.find((d) => d.id === globalLastActiveId) || null;
728
+ }
729
+ if (!active) {
730
+ active = wsDrawings[0];
731
+ }
726
732
  }
727
733
  if (active) {
728
734
  setActiveDrawing2(active);
@@ -736,6 +742,11 @@ function WorkspaceProvider({ children, lang = "en" }) {
736
742
  }
737
743
  init();
738
744
  }, []);
745
+ useEffect(() => {
746
+ if (activeDrawing?.id) {
747
+ localStorage.setItem("rita-workspace-last-active-drawing", activeDrawing.id);
748
+ }
749
+ }, [activeDrawing?.id]);
739
750
  const refreshDrawings = useCallback(async () => {
740
751
  if (!workspace) return;
741
752
  try {
@@ -1944,18 +1955,26 @@ var DrawingsDialog = ({
1944
1955
  borderRadius: "2px",
1945
1956
  pointerEvents: "none"
1946
1957
  } }),
1947
- renderThumbnail && /* @__PURE__ */ jsx6("div", { style: {
1948
- width: "64px",
1949
- height: "48px",
1950
- flexShrink: 0,
1951
- borderRadius: "4px",
1952
- overflow: "hidden",
1953
- border: "1px solid var(--default-border-color, #e0e0e0)",
1954
- backgroundColor: "#fff",
1955
- display: "flex",
1956
- alignItems: "center",
1957
- justifyContent: "center"
1958
- }, children: renderThumbnail(drawing) }),
1958
+ renderThumbnail && /* @__PURE__ */ jsx6(
1959
+ "div",
1960
+ {
1961
+ className: "rita-thumbnail-wrapper",
1962
+ style: {
1963
+ width: "64px",
1964
+ height: "48px",
1965
+ flexShrink: 0,
1966
+ borderRadius: "4px",
1967
+ overflow: "hidden",
1968
+ border: "1px solid var(--default-border-color, #e0e0e0)",
1969
+ backgroundColor: "var(--island-bg-color, #fff)",
1970
+ display: "flex",
1971
+ alignItems: "center",
1972
+ justifyContent: "center",
1973
+ boxShadow: "inset 0 0 0 1px rgba(0,0,0,0.04)"
1974
+ },
1975
+ children: renderThumbnail(drawing)
1976
+ }
1977
+ ),
1959
1978
  /* @__PURE__ */ jsx6("div", { style: { flex: 1, minWidth: 0 }, children: editingId === drawing.id ? /* @__PURE__ */ jsxs4("div", { style: { display: "flex", gap: "6px", alignItems: "center" }, children: [
1960
1979
  /* @__PURE__ */ jsx6(
1961
1980
  "input",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rita-workspace",
3
- "version": "0.5.37",
3
+ "version": "0.5.39",
4
4
  "description": "Multi-drawing workspace feature for Rita (Excalidraw fork)",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",