rita-workspace 0.5.36 → 0.5.37

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
@@ -26,6 +26,8 @@ yarn add rita-workspace
26
26
 
27
27
  ## Integration Guide
28
28
 
29
+ > 📘 For the full host-app integration walkthrough (10 steps including auto-save debounce, switch effect, conflict handling, and replacing Excalidraw's "Open from file"), see [docs/INTEGRATION.md](./docs/INTEGRATION.md).
30
+
29
31
  ### 1. `App.tsx` - Add Provider
30
32
 
31
33
  ```tsx
@@ -124,6 +126,19 @@ const [workspaceEnabled] = useState(() =>
124
126
  - State stored in `sessionStorage` (not shared between tabs)
125
127
  - When disabled: auto-save to workspace skipped, drawing-switch disabled, footer hidden
126
128
 
129
+ ### Auto-start preference
130
+
131
+ Users can opt into starting every new tab in workspace mode via a checkbox in `DrawingsDialog`. The preference is stored in `localStorage['rita-workspace-auto-start']` (`"true"` to enable, removed when disabled). The host app reads this flag at init time as a fallback when `sessionStorage` has no explicit value:
132
+
133
+ ```tsx
134
+ const [workspaceEnabled] = useState(() => {
135
+ const sessionVal = sessionStorage.getItem("rita-workspace-enabled");
136
+ if (sessionVal === "true") return true;
137
+ if (sessionVal === "false") return false;
138
+ return localStorage.getItem("rita-workspace-auto-start") === "true";
139
+ });
140
+ ```
141
+
127
142
  ## API Reference
128
143
 
129
144
  ### Components
@@ -131,7 +146,7 @@ const [workspaceEnabled] = useState(() =>
131
146
  | Component | Description |
132
147
  |-----------|-------------|
133
148
  | `WorkspaceProvider` | React context provider. Props: `lang`, `children` |
134
- | `DrawingsDialog` | Management dialog. Props: `open`, `onClose`, `onDrawingSelect`, `renderThumbnail` |
149
+ | `DrawingsDialog` | Management dialog. Props: `open`, `onClose`, `onDrawingSelect` (called on both switch and create), `renderThumbnail` |
135
150
 
136
151
  ### Hooks
137
152
 
@@ -185,7 +200,7 @@ const {
185
200
  importWorkspace, // () => Promise<void>
186
201
  exportDrawingAsExcalidraw, // (id) => Promise<void>
187
202
  exportAllDrawingsAsExcalidraw, // () => Promise<void> — downloads all as .excalidraw files
188
- importExcalidrawFile, // () => Promise<void>
203
+ importExcalidrawFile, // () => Promise<void> — imports .excalidraw files; switches to the last imported drawing
189
204
  } = useWorkspace();
190
205
  ```
191
206
 
package/dist/index.js CHANGED
@@ -2197,7 +2197,6 @@ var DrawingsDialog = ({
2197
2197
  },
2198
2198
  style: { background: "none", border: "none", cursor: "pointer", padding: "4px", fontSize: "14px", opacity: 0.5 },
2199
2199
  title: t.delete,
2200
- disabled: drawings.length <= 1,
2201
2200
  children: "\u{1F5D1}\uFE0F"
2202
2201
  }
2203
2202
  )
package/dist/index.mjs CHANGED
@@ -2125,7 +2125,6 @@ var DrawingsDialog = ({
2125
2125
  },
2126
2126
  style: { background: "none", border: "none", cursor: "pointer", padding: "4px", fontSize: "14px", opacity: 0.5 },
2127
2127
  title: t.delete,
2128
- disabled: drawings.length <= 1,
2129
2128
  children: "\u{1F5D1}\uFE0F"
2130
2129
  }
2131
2130
  )
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rita-workspace",
3
- "version": "0.5.36",
3
+ "version": "0.5.37",
4
4
  "description": "Multi-drawing workspace feature for Rita (Excalidraw fork)",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",