@oh-just-another/react-ui 0.58.0 → 0.59.0
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/CHANGELOG.md +104 -0
- package/README.md +3 -0
- package/dist/.tsbuildinfo +1 -1
- package/dist/color-swatch-picker.d.ts +8 -1
- package/dist/color-swatch-picker.d.ts.map +1 -1
- package/dist/color-swatch-picker.js +7 -3
- package/dist/color-swatch-picker.js.map +1 -1
- package/dist/constants.d.ts +43 -0
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +43 -0
- package/dist/constants.js.map +1 -1
- package/dist/context-menu.d.ts.map +1 -1
- package/dist/context-menu.js +8 -4
- package/dist/context-menu.js.map +1 -1
- package/dist/diagram-canvas.d.ts +3 -1
- package/dist/diagram-canvas.d.ts.map +1 -1
- package/dist/diagram-canvas.js +1 -1
- package/dist/diagram-canvas.js.map +1 -1
- package/dist/diagram-root.d.ts +7 -1
- package/dist/diagram-root.d.ts.map +1 -1
- package/dist/diagram-root.js +10 -1
- package/dist/diagram-root.js.map +1 -1
- package/dist/drawing-panel.d.ts +14 -0
- package/dist/drawing-panel.d.ts.map +1 -0
- package/dist/drawing-panel.js +54 -0
- package/dist/drawing-panel.js.map +1 -0
- package/dist/help-dialog.d.ts.map +1 -1
- package/dist/help-dialog.js +9 -2
- package/dist/help-dialog.js.map +1 -1
- package/dist/hooks.d.ts +14 -1
- package/dist/hooks.d.ts.map +1 -1
- package/dist/hooks.js +14 -1
- package/dist/hooks.js.map +1 -1
- package/dist/index.d.ts +7 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -2
- package/dist/index.js.map +1 -1
- package/dist/minimap.d.ts +25 -0
- package/dist/minimap.d.ts.map +1 -0
- package/dist/minimap.js +196 -0
- package/dist/minimap.js.map +1 -0
- package/dist/property-panel.d.ts.map +1 -1
- package/dist/property-panel.js +139 -24
- package/dist/property-panel.js.map +1 -1
- package/dist/search-overlay.d.ts +18 -0
- package/dist/search-overlay.d.ts.map +1 -0
- package/dist/search-overlay.js +162 -0
- package/dist/search-overlay.js.map +1 -0
- package/dist/selection-floating-panel.d.ts.map +1 -1
- package/dist/selection-floating-panel.js +5 -2
- package/dist/selection-floating-panel.js.map +1 -1
- package/dist/stats-panel.d.ts +14 -0
- package/dist/stats-panel.d.ts.map +1 -0
- package/dist/stats-panel.js +104 -0
- package/dist/stats-panel.js.map +1 -0
- package/dist/toolbar.d.ts.map +1 -1
- package/dist/toolbar.js +22 -8
- package/dist/toolbar.js.map +1 -1
- package/dist/zen-mode.d.ts +30 -0
- package/dist/zen-mode.d.ts.map +1 -0
- package/dist/zen-mode.js +62 -0
- package/dist/zen-mode.js.map +1 -0
- package/package.json +8 -8
package/dist/zen-mode.js
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { createContext, useCallback, useContext, useEffect, useMemo, useState, } from "react";
|
|
3
|
+
import { defaultActionRegistry } from "@oh-just-another/state";
|
|
4
|
+
const ZenModeContext = createContext(null);
|
|
5
|
+
/**
|
|
6
|
+
* Provides zen-mode state to descendants and wires its hotkeys. `⌥Z`
|
|
7
|
+
* toggles; `Esc` exits (only while zen is active, so it doesn't swallow
|
|
8
|
+
* Escape elsewhere). Registers the toggle on the shared action registry
|
|
9
|
+
* (like the command palette) so it routes through hotkey dispatch and
|
|
10
|
+
* shows in the help dialog; `viewMode` keeps it live in read-only.
|
|
11
|
+
*
|
|
12
|
+
* Wrap the editor chrome in this provider and read {@link useZenMode} in
|
|
13
|
+
* the shell to hide UI when `zen` is true.
|
|
14
|
+
*/
|
|
15
|
+
export const ZenModeProvider = ({ children }) => {
|
|
16
|
+
const [zen, setZen] = useState(false);
|
|
17
|
+
const toggle = useCallback(() => {
|
|
18
|
+
setZen((v) => !v);
|
|
19
|
+
}, []);
|
|
20
|
+
useEffect(() => {
|
|
21
|
+
defaultActionRegistry.replace({
|
|
22
|
+
id: "toggle-zen-mode",
|
|
23
|
+
label: "Zen mode",
|
|
24
|
+
category: "other",
|
|
25
|
+
viewMode: true,
|
|
26
|
+
hotkey: { key: "z", alt: true },
|
|
27
|
+
perform: () => {
|
|
28
|
+
setZen((v) => !v);
|
|
29
|
+
},
|
|
30
|
+
});
|
|
31
|
+
return () => {
|
|
32
|
+
defaultActionRegistry.unregister("toggle-zen-mode");
|
|
33
|
+
};
|
|
34
|
+
}, []);
|
|
35
|
+
// Escape leaves zen. Bound only while active so it never competes with
|
|
36
|
+
// other Escape handlers (cancel gesture, clear selection) otherwise.
|
|
37
|
+
useEffect(() => {
|
|
38
|
+
if (!zen)
|
|
39
|
+
return undefined;
|
|
40
|
+
const onKey = (event) => {
|
|
41
|
+
if (event.key === "Escape")
|
|
42
|
+
setZen(false);
|
|
43
|
+
};
|
|
44
|
+
window.addEventListener("keydown", onKey);
|
|
45
|
+
return () => {
|
|
46
|
+
window.removeEventListener("keydown", onKey);
|
|
47
|
+
};
|
|
48
|
+
}, [zen]);
|
|
49
|
+
const api = useMemo(() => ({ zen, setZen, toggle }), [zen, toggle]);
|
|
50
|
+
return _jsx(ZenModeContext.Provider, { value: api, children: children });
|
|
51
|
+
};
|
|
52
|
+
/** Read zen-mode state. Throws outside a {@link ZenModeProvider}. */
|
|
53
|
+
export const useZenMode = () => {
|
|
54
|
+
const ctx = useContext(ZenModeContext);
|
|
55
|
+
if (!ctx) {
|
|
56
|
+
throw new Error("@oh-just-another/react-ui: useZenMode called outside <ZenModeProvider>.");
|
|
57
|
+
}
|
|
58
|
+
return ctx;
|
|
59
|
+
};
|
|
60
|
+
/** Forgiving variant — returns `null` when no {@link ZenModeProvider} is above. */
|
|
61
|
+
export const useZenModeOptional = () => useContext(ZenModeContext);
|
|
62
|
+
//# sourceMappingURL=zen-mode.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"zen-mode.js","sourceRoot":"","sources":["../src/zen-mode.tsx"],"names":[],"mappings":";AAAA,OAAO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AAE,MAAM,CAAC,KAAK,CAAC,CAAC;QAC5C,CAAC,CAAC;QACF,MAAM,CAAC,gBAAgB,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC;QAC1C,OAAO,GAAG,EAAE;YACV,MAAM,CAAC,mBAAmB,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC;QAC/C,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAEV,MAAM,GAAG,GAAG,OAAO,CAAa,GAAG,EAAE,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC,CAAC;IAChF,OAAO,KAAC,cAAc,CAAC,QAAQ,IAAC,KAAK,EAAE,GAAG,YAAG,QAAQ,GAA2B,CAAC;AACnF,CAAC,CAAC;AAEF,qEAAqE;AACrE,MAAM,CAAC,MAAM,UAAU,GAAG,GAAe,EAAE;IACzC,MAAM,GAAG,GAAG,UAAU,CAAC,cAAc,CAAC,CAAC;IACvC,IAAI,CAAC,GAAG,EAAE,CAAC;QACT,MAAM,IAAI,KAAK,CAAC,yEAAyE,CAAC,CAAC;IAC7F,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC,CAAC;AAEF,mFAAmF;AACnF,MAAM,CAAC,MAAM,kBAAkB,GAAG,GAAsB,EAAE,CAAC,UAAU,CAAC,cAAc,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oh-just-another/react-ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.59.0",
|
|
4
4
|
"description": "React components and hooks over the diagram editor — DiagramCanvas, Toolbar, Palette, PropertyPanel.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Rustam Garifulin <rustam@n69.in>",
|
|
@@ -47,15 +47,15 @@
|
|
|
47
47
|
"lucide-react": "1.16.0",
|
|
48
48
|
"@oh-just-another/events": "0.57.0",
|
|
49
49
|
"@oh-just-another/math": "0.58.0",
|
|
50
|
-
"@oh-just-another/renderer-canvas": "0.
|
|
51
|
-
"@oh-just-another/renderer-core": "0.
|
|
52
|
-
"@oh-just-another/renderer-svg": "0.57.
|
|
53
|
-
"@oh-just-another/scene": "0.
|
|
54
|
-
"@oh-just-another/state": "0.
|
|
55
|
-
"@oh-just-another/templates": "0.57.
|
|
50
|
+
"@oh-just-another/renderer-canvas": "0.60.0",
|
|
51
|
+
"@oh-just-another/renderer-core": "0.59.0",
|
|
52
|
+
"@oh-just-another/renderer-svg": "0.57.3",
|
|
53
|
+
"@oh-just-another/scene": "0.60.0",
|
|
54
|
+
"@oh-just-another/state": "0.60.0",
|
|
55
|
+
"@oh-just-another/templates": "0.57.3",
|
|
56
56
|
"@oh-just-another/tokens": "0.57.0",
|
|
57
57
|
"@oh-just-another/types": "0.57.0",
|
|
58
|
-
"@oh-just-another/versioning": "0.57.
|
|
58
|
+
"@oh-just-another/versioning": "0.57.3"
|
|
59
59
|
},
|
|
60
60
|
"peerDependencies": {
|
|
61
61
|
"react": ">=18",
|