@ai-matrx/canvas 0.2.2 → 0.4.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 +16 -0
- package/README.md +16 -0
- package/dist/index.cjs +42 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +42 -1
- package/dist/index.js.map +1 -1
- package/dist/react.cjs +73 -7
- package/dist/react.cjs.map +1 -1
- package/dist/react.d.cts +19 -2
- package/dist/react.d.ts +19 -2
- package/dist/react.js +73 -7
- package/dist/react.js.map +1 -1
- package/dist/styles.css +17 -0
- package/dist/{controller-Dv6J6XZm.d.cts → toggleKind-A9v45oSb.d.cts} +30 -1
- package/dist/{controller-Dv6J6XZm.d.ts → toggleKind-A9v45oSb.d.ts} +30 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { C as CanvasItemId, a as CanvasWindowId, b as CanvasJson, c as CanvasLayoutNode, d as CanvasPaneId, e as CanvasStoreBinding, f as CanvasState, g as CanvasAction, h as CanvasController, i as CanvasItem, j as CanvasExtraWindow, k as CanvasPane, l as canvasWindowOfItem } from './
|
|
2
|
-
export { m as
|
|
1
|
+
import { C as CanvasItemId, a as CanvasWindowId, b as CanvasJson, c as CanvasLayoutNode, d as CanvasPaneId, e as CanvasStoreBinding, f as CanvasState, g as CanvasAction, h as CanvasController, i as CanvasItem, j as CanvasExtraWindow, k as CanvasPane, l as canvasWindowOfItem } from './toggleKind-A9v45oSb.cjs';
|
|
2
|
+
export { m as CANVAS_DEFAULT_KEY, n as CANVAS_DEFAULT_WIDTH, o as CANVAS_DESKTOP_LAYOUT_RULES, p as CANVAS_MAIN_WINDOW, q as CANVAS_MIN_SPLIT_FRACTION, r as CANVAS_MIN_WIDTH, s as CANVAS_STORAGE_KEY, t as CANVAS_WEB_LAYOUT_RULES, u as CanvasControllerOptions, v as CanvasErrorReport, w as CanvasErrorSink, x as CanvasKeyValueStore, y as CanvasKindVisibility, z as CanvasLayoutRules, A as CanvasOpenInput, B as CanvasOpenTarget, D as CanvasOrientation, E as CanvasPersistencePort, F as CanvasRect, G as CanvasSessionAttachReason, H as CanvasSessionDetachReason, I as CanvasSessionEvent, J as CanvasSessionHooks, K as CanvasSplitId, L as CanvasWindowCloseMode, M as CanvasWindowFrame, N as CanvasWindowPorts, R as ReduxStoreLike, T as ToggleKindInput, O as bindCanvasToReduxStore, P as canvasActions, Q as canvasReducer, S as canvasWindowFrame, U as canvasWindowOfPane, V as clampDraggedCanvasWidth, W as consoleCanvasErrorSink, X as createCanvasController, Y as createCanvasStore, Z as createInitialCanvasState, _ as createKeyValueCanvasPersistence, $ as createLocalStorageCanvasPersistence, a0 as defaultCanvasWidth, a1 as fitCanvasWidth, a2 as foldCanvasWindows, a3 as isCanvasAction, a4 as listCanvasWindowIds, a5 as resolveCanvasLayoutRules, a6 as sanitizeCanvasSnapshot, a7 as selectCanvasKindVisibility, a8 as shouldStackSplit, a9 as toPersistableSnapshot, aa as toggleKind } from './toggleKind-A9v45oSb.cjs';
|
|
3
3
|
|
|
4
4
|
declare function canvasItemId(kind: string, key: string): CanvasItemId;
|
|
5
5
|
declare function parseCanvasItemId(id: CanvasItemId): {
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { C as CanvasItemId, a as CanvasWindowId, b as CanvasJson, c as CanvasLayoutNode, d as CanvasPaneId, e as CanvasStoreBinding, f as CanvasState, g as CanvasAction, h as CanvasController, i as CanvasItem, j as CanvasExtraWindow, k as CanvasPane, l as canvasWindowOfItem } from './
|
|
2
|
-
export { m as
|
|
1
|
+
import { C as CanvasItemId, a as CanvasWindowId, b as CanvasJson, c as CanvasLayoutNode, d as CanvasPaneId, e as CanvasStoreBinding, f as CanvasState, g as CanvasAction, h as CanvasController, i as CanvasItem, j as CanvasExtraWindow, k as CanvasPane, l as canvasWindowOfItem } from './toggleKind-A9v45oSb.js';
|
|
2
|
+
export { m as CANVAS_DEFAULT_KEY, n as CANVAS_DEFAULT_WIDTH, o as CANVAS_DESKTOP_LAYOUT_RULES, p as CANVAS_MAIN_WINDOW, q as CANVAS_MIN_SPLIT_FRACTION, r as CANVAS_MIN_WIDTH, s as CANVAS_STORAGE_KEY, t as CANVAS_WEB_LAYOUT_RULES, u as CanvasControllerOptions, v as CanvasErrorReport, w as CanvasErrorSink, x as CanvasKeyValueStore, y as CanvasKindVisibility, z as CanvasLayoutRules, A as CanvasOpenInput, B as CanvasOpenTarget, D as CanvasOrientation, E as CanvasPersistencePort, F as CanvasRect, G as CanvasSessionAttachReason, H as CanvasSessionDetachReason, I as CanvasSessionEvent, J as CanvasSessionHooks, K as CanvasSplitId, L as CanvasWindowCloseMode, M as CanvasWindowFrame, N as CanvasWindowPorts, R as ReduxStoreLike, T as ToggleKindInput, O as bindCanvasToReduxStore, P as canvasActions, Q as canvasReducer, S as canvasWindowFrame, U as canvasWindowOfPane, V as clampDraggedCanvasWidth, W as consoleCanvasErrorSink, X as createCanvasController, Y as createCanvasStore, Z as createInitialCanvasState, _ as createKeyValueCanvasPersistence, $ as createLocalStorageCanvasPersistence, a0 as defaultCanvasWidth, a1 as fitCanvasWidth, a2 as foldCanvasWindows, a3 as isCanvasAction, a4 as listCanvasWindowIds, a5 as resolveCanvasLayoutRules, a6 as sanitizeCanvasSnapshot, a7 as selectCanvasKindVisibility, a8 as shouldStackSplit, a9 as toPersistableSnapshot, aa as toggleKind } from './toggleKind-A9v45oSb.js';
|
|
3
3
|
|
|
4
4
|
declare function canvasItemId(kind: string, key: string): CanvasItemId;
|
|
5
5
|
declare function parseCanvasItemId(id: CanvasItemId): {
|
package/dist/index.js
CHANGED
|
@@ -1312,7 +1312,46 @@ function selectCanvasWindows(s) {
|
|
|
1312
1312
|
}
|
|
1313
1313
|
var selectCanvasExtraWindow = (s, windowId) => s.windows?.[windowId];
|
|
1314
1314
|
var selectCanvasWindowOfItem = canvasWindowOfItem;
|
|
1315
|
+
|
|
1316
|
+
// src/core/toggleKind.ts
|
|
1317
|
+
var CANVAS_DEFAULT_KEY = "default";
|
|
1318
|
+
function selectCanvasKindVisibility(state, kind, key = CANVAS_DEFAULT_KEY) {
|
|
1319
|
+
const itemId = canvasItemId(kind, key);
|
|
1320
|
+
if (!state.items[itemId]) return "absent";
|
|
1321
|
+
const windowId = canvasWindowOfItem(state, itemId);
|
|
1322
|
+
if (!windowId) return "background";
|
|
1323
|
+
const isOpen = canvasWindowFrame(state, windowId)?.isOpen ?? false;
|
|
1324
|
+
const pane = Object.values(state.panes).find((p) => p.itemIds.includes(itemId));
|
|
1325
|
+
return isOpen && pane?.activeItemId === itemId ? "visible" : "background";
|
|
1326
|
+
}
|
|
1327
|
+
function toggleKind(controller, input) {
|
|
1328
|
+
const key = input.key ?? CANVAS_DEFAULT_KEY;
|
|
1329
|
+
const itemId = canvasItemId(input.kind, key);
|
|
1330
|
+
const before = selectCanvasKindVisibility(controller.getState(), input.kind, key);
|
|
1331
|
+
if (before === "visible") {
|
|
1332
|
+
if ((input.whenVisible ?? "close") === "close") {
|
|
1333
|
+
controller.close(itemId);
|
|
1334
|
+
} else {
|
|
1335
|
+
controller.hide(canvasWindowOfItem(controller.getState(), itemId) ?? void 0);
|
|
1336
|
+
}
|
|
1337
|
+
return selectCanvasKindVisibility(controller.getState(), input.kind, key);
|
|
1338
|
+
}
|
|
1339
|
+
if (before === "background") {
|
|
1340
|
+
controller.open({ kind: input.kind, key });
|
|
1341
|
+
const windowId = canvasWindowOfItem(controller.getState(), itemId);
|
|
1342
|
+
if (windowId) controller.show(windowId);
|
|
1343
|
+
return selectCanvasKindVisibility(controller.getState(), input.kind, key);
|
|
1344
|
+
}
|
|
1345
|
+
const opened = controller.open({
|
|
1346
|
+
kind: input.kind,
|
|
1347
|
+
key,
|
|
1348
|
+
...input.data !== void 0 ? { data: input.data } : {},
|
|
1349
|
+
...input.title !== void 0 ? { title: input.title } : {}
|
|
1350
|
+
});
|
|
1351
|
+
return opened ? selectCanvasKindVisibility(controller.getState(), input.kind, key) : "absent";
|
|
1352
|
+
}
|
|
1315
1353
|
export {
|
|
1354
|
+
CANVAS_DEFAULT_KEY,
|
|
1316
1355
|
CANVAS_DEFAULT_WIDTH,
|
|
1317
1356
|
CANVAS_DESKTOP_LAYOUT_RULES,
|
|
1318
1357
|
CANVAS_MAIN_WINDOW,
|
|
@@ -1360,6 +1399,7 @@ export {
|
|
|
1360
1399
|
selectCanvasIsOpen,
|
|
1361
1400
|
selectCanvasItem,
|
|
1362
1401
|
selectCanvasItemCount,
|
|
1402
|
+
selectCanvasKindVisibility,
|
|
1363
1403
|
selectCanvasLayout,
|
|
1364
1404
|
selectCanvasPane,
|
|
1365
1405
|
selectCanvasPaneCount,
|
|
@@ -1369,6 +1409,7 @@ export {
|
|
|
1369
1409
|
selectCanvasWindows,
|
|
1370
1410
|
shareStructure,
|
|
1371
1411
|
shouldStackSplit,
|
|
1372
|
-
toPersistableSnapshot
|
|
1412
|
+
toPersistableSnapshot,
|
|
1413
|
+
toggleKind
|
|
1373
1414
|
};
|
|
1374
1415
|
//# sourceMappingURL=index.js.map
|