@noya-app/noya-designsystem 0.1.18 → 0.1.20

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.
@@ -5,13 +5,13 @@
5
5
  CLI Target: esnext
6
6
  CJS Build start
7
7
  ESM Build start
8
- CJS dist/index.js 226.61 KB
9
- CJS dist/index.js.map 457.18 KB
10
- CJS ⚡️ Build success in 151ms
11
- ESM dist/index.mjs 208.82 KB
12
- ESM dist/index.mjs.map 457.30 KB
13
- ESM ⚡️ Build success in 147ms
14
8
  DTS Build start
15
- DTS ⚡️ Build success in 10168ms
16
- DTS dist/index.d.ts 60.18 KB
17
- DTS dist/index.d.mts 60.18 KB
9
+ CJS dist/index.js 227.57 KB
10
+ CJS dist/index.js.map 458.94 KB
11
+ CJS ⚡️ Build success in 249ms
12
+ ESM dist/index.mjs 209.78 KB
13
+ ESM dist/index.mjs.map 459.06 KB
14
+ ESM ⚡️ Build success in 252ms
15
+ DTS ⚡️ Build success in 9569ms
16
+ DTS dist/index.d.ts 60.59 KB
17
+ DTS dist/index.d.mts 60.59 KB
package/CHANGELOG.md CHANGED
@@ -1,5 +1,18 @@
1
1
  # @noya-app/noya-designsystem
2
2
 
3
+ ## 0.1.20
4
+
5
+ ### Patch Changes
6
+
7
+ - 7306000: Improve embedded apis
8
+ - 5f3843e: Improve workspace sizing
9
+
10
+ ## 0.1.19
11
+
12
+ ### Patch Changes
13
+
14
+ - 1114573: Don't autosave workspace layout by default
15
+
3
16
  ## 0.1.18
4
17
 
5
18
  ### Patch Changes
package/dist/index.d.mts CHANGED
@@ -1075,9 +1075,22 @@ interface Props$1 {
1075
1075
  hasRightSidebar?: boolean;
1076
1076
  hasLeftSidebar?: boolean;
1077
1077
  onChangeLayoutState?: (layoutState: PanelLayoutState) => void;
1078
- leftSidebarInitialSize?: number;
1079
- rightSidebarInitialSize?: number;
1080
1078
  leftSidebarCanResize?: boolean;
1079
+ id?: string;
1080
+ className?: string;
1081
+ style?: React__default.CSSProperties;
1082
+ /**
1083
+ * Accepts a number (px) or % string (e.g. "50%").
1084
+ * Use % to avoid flicker server-rendering.
1085
+ */
1086
+ leftSidebarInitialSize?: number | string;
1087
+ leftSidebarMinSize?: number | string;
1088
+ /**
1089
+ * Accepts a number (px) or % string (e.g. "50%").
1090
+ * Use % to avoid flicker server-rendering.
1091
+ */
1092
+ rightSidebarInitialSize?: number | string;
1093
+ rightSidebarMinSize?: number | string;
1081
1094
  }
1082
1095
  type IWorkspaceLayout = {
1083
1096
  setLeftSidebarExpanded: (expanded: boolean) => void;
package/dist/index.d.ts CHANGED
@@ -1075,9 +1075,22 @@ interface Props$1 {
1075
1075
  hasRightSidebar?: boolean;
1076
1076
  hasLeftSidebar?: boolean;
1077
1077
  onChangeLayoutState?: (layoutState: PanelLayoutState) => void;
1078
- leftSidebarInitialSize?: number;
1079
- rightSidebarInitialSize?: number;
1080
1078
  leftSidebarCanResize?: boolean;
1079
+ id?: string;
1080
+ className?: string;
1081
+ style?: React__default.CSSProperties;
1082
+ /**
1083
+ * Accepts a number (px) or % string (e.g. "50%").
1084
+ * Use % to avoid flicker server-rendering.
1085
+ */
1086
+ leftSidebarInitialSize?: number | string;
1087
+ leftSidebarMinSize?: number | string;
1088
+ /**
1089
+ * Accepts a number (px) or % string (e.g. "50%").
1090
+ * Use % to avoid flicker server-rendering.
1091
+ */
1092
+ rightSidebarInitialSize?: number | string;
1093
+ rightSidebarMinSize?: number | string;
1081
1094
  }
1082
1095
  type IWorkspaceLayout = {
1083
1096
  setLeftSidebarExpanded: (expanded: boolean) => void;
package/dist/index.js CHANGED
@@ -6305,11 +6305,21 @@ var WorkspaceLayout = (0, import_react63.forwardRef)(function WorkspaceLayout2({
6305
6305
  onChangeLayoutState,
6306
6306
  leftSidebarInitialSize = 280,
6307
6307
  rightSidebarInitialSize = 400,
6308
- leftSidebarCanResize = false
6308
+ leftSidebarMinSize,
6309
+ rightSidebarMinSize,
6310
+ leftSidebarCanResize = false,
6311
+ id,
6312
+ className,
6313
+ style: style3
6309
6314
  }, forwardedRef) {
6310
6315
  const windowSize = useWindowSize();
6311
- const leftSidebarPercentage = leftSidebarInitialSize / windowSize.width * 100;
6312
- const rightSidebarPercentage = rightSidebarInitialSize / windowSize.width * 100;
6316
+ function getPercentage(size2) {
6317
+ return typeof size2 === "string" ? parseFloat(size2) : size2 / windowSize.width * 100;
6318
+ }
6319
+ const leftSidebarPercentage = getPercentage(leftSidebarInitialSize);
6320
+ const rightSidebarPercentage = getPercentage(rightSidebarInitialSize);
6321
+ const leftSidebarMinPercentage = leftSidebarMinSize !== void 0 ? getPercentage(leftSidebarMinSize) : void 0;
6322
+ const rightSidebarMinPercentage = rightSidebarMinSize !== void 0 ? getPercentage(rightSidebarMinSize) : void 0;
6313
6323
  const panelGroupRef = (0, import_react63.useRef)(null);
6314
6324
  const leftSidebarRef = (0, import_react63.useRef)(null);
6315
6325
  const rightSidebarRef = (0, import_react63.useRef)(null);
@@ -6371,82 +6381,97 @@ var WorkspaceLayout = (0, import_react63.forwardRef)(function WorkspaceLayout2({
6371
6381
  }
6372
6382
  }
6373
6383
  });
6374
- return /* @__PURE__ */ import_react63.default.createElement(Stack.H, { flex: "1" }, /* @__PURE__ */ import_react63.default.createElement(
6375
- import_react_resizable_panels.PanelGroup,
6384
+ const centerPanelPercentage = 100 - (leftPanelContent ? leftSidebarPercentage : 0) - (rightPanelContent ? rightSidebarPercentage : 0);
6385
+ return /* @__PURE__ */ import_react63.default.createElement(
6386
+ "div",
6376
6387
  {
6377
- ref: panelGroupRef,
6378
- id: EDITOR_PANEL_GROUP_ID,
6379
- direction: "horizontal",
6380
- autoSaveId: autoSavePrefix ? `${autoSavePrefix}--${EDITOR_PANEL_GROUP_ID}` : EDITOR_PANEL_GROUP_ID,
6381
- style: { flex: "1" }
6382
- },
6383
- hasLeftSidebar && /* @__PURE__ */ import_react63.default.createElement(import_react63.default.Fragment, null, /* @__PURE__ */ import_react63.default.createElement(
6384
- import_react_resizable_panels.Panel,
6385
- {
6386
- id: LEFT_SIDEBAR_ID,
6387
- order: 1,
6388
- ref: leftSidebarRef,
6389
- defaultSize: leftSidebarPercentage,
6390
- minSize: leftSidebarPercentage,
6391
- ...!leftSidebarCanResize && { maxSize: leftSidebarPercentage },
6392
- collapsible: true,
6393
- style: {
6394
- display: "flex",
6395
- flexDirection: "row"
6396
- }
6397
- },
6398
- leftPanelContent
6399
- ), /* @__PURE__ */ import_react63.default.createElement(
6400
- import_react_resizable_panels.PanelResizeHandle,
6401
- {
6402
- style: {
6403
- cursor: "col-resize",
6404
- width: "1px",
6405
- height: "100%",
6406
- backgroundColor: theme.colors.divider
6407
- }
6388
+ id,
6389
+ className,
6390
+ style: {
6391
+ backgroundColor: theme.colors.canvas.background,
6392
+ display: "flex",
6393
+ flexDirection: "row",
6394
+ ...style3
6408
6395
  }
6409
- )),
6396
+ },
6410
6397
  /* @__PURE__ */ import_react63.default.createElement(
6411
- import_react_resizable_panels.Panel,
6398
+ import_react_resizable_panels.PanelGroup,
6412
6399
  {
6413
- id: CONTENT_AREA_ID,
6414
- order: 2,
6415
- minSize: 10,
6416
- style: {
6417
- display: "flex",
6418
- flexDirection: "row"
6419
- }
6400
+ ref: panelGroupRef,
6401
+ id: EDITOR_PANEL_GROUP_ID,
6402
+ direction: "horizontal",
6403
+ autoSaveId: autoSavePrefix ? `${autoSavePrefix}--${EDITOR_PANEL_GROUP_ID}` : void 0,
6404
+ style: { flex: "1" }
6420
6405
  },
6421
- centerPanelContent
6422
- ),
6423
- hasRightSidebar && /* @__PURE__ */ import_react63.default.createElement(import_react63.default.Fragment, null, /* @__PURE__ */ import_react63.default.createElement(
6424
- import_react_resizable_panels.PanelResizeHandle,
6425
- {
6426
- style: {
6427
- cursor: "col-resize",
6428
- width: "1px",
6429
- height: "100%",
6430
- backgroundColor: theme.colors.divider
6406
+ hasLeftSidebar && /* @__PURE__ */ import_react63.default.createElement(import_react63.default.Fragment, null, /* @__PURE__ */ import_react63.default.createElement(
6407
+ import_react_resizable_panels.Panel,
6408
+ {
6409
+ id: LEFT_SIDEBAR_ID,
6410
+ order: 1,
6411
+ ref: leftSidebarRef,
6412
+ defaultSize: leftSidebarPercentage,
6413
+ minSize: leftSidebarMinPercentage ?? leftSidebarPercentage,
6414
+ ...!leftSidebarCanResize && { maxSize: leftSidebarPercentage },
6415
+ collapsible: true,
6416
+ style: {
6417
+ display: "flex",
6418
+ flexDirection: "row"
6419
+ }
6420
+ },
6421
+ leftPanelContent
6422
+ ), /* @__PURE__ */ import_react63.default.createElement(
6423
+ import_react_resizable_panels.PanelResizeHandle,
6424
+ {
6425
+ style: {
6426
+ cursor: "col-resize",
6427
+ width: "1px",
6428
+ height: "100%",
6429
+ backgroundColor: theme.colors.divider
6430
+ }
6431
6431
  }
6432
- }
6433
- ), /* @__PURE__ */ import_react63.default.createElement(
6434
- import_react_resizable_panels.Panel,
6435
- {
6436
- id: RIGHT_SIDEBAR_ID,
6437
- order: 3,
6438
- ref: rightSidebarRef,
6439
- minSize: rightSidebarPercentage,
6440
- defaultSize: rightSidebarPercentage,
6441
- collapsible: true,
6442
- style: {
6443
- display: "flex",
6444
- flexDirection: "row"
6432
+ )),
6433
+ /* @__PURE__ */ import_react63.default.createElement(
6434
+ import_react_resizable_panels.Panel,
6435
+ {
6436
+ id: CONTENT_AREA_ID,
6437
+ order: 2,
6438
+ defaultSize: centerPanelPercentage,
6439
+ minSize: 10,
6440
+ style: {
6441
+ display: "flex",
6442
+ flexDirection: "row"
6443
+ }
6444
+ },
6445
+ centerPanelContent
6446
+ ),
6447
+ hasRightSidebar && /* @__PURE__ */ import_react63.default.createElement(import_react63.default.Fragment, null, /* @__PURE__ */ import_react63.default.createElement(
6448
+ import_react_resizable_panels.PanelResizeHandle,
6449
+ {
6450
+ style: {
6451
+ cursor: "col-resize",
6452
+ width: "1px",
6453
+ height: "100%",
6454
+ backgroundColor: theme.colors.divider
6455
+ }
6445
6456
  }
6446
- },
6447
- rightPanelContent
6448
- ))
6449
- ));
6457
+ ), /* @__PURE__ */ import_react63.default.createElement(
6458
+ import_react_resizable_panels.Panel,
6459
+ {
6460
+ id: RIGHT_SIDEBAR_ID,
6461
+ order: 3,
6462
+ ref: rightSidebarRef,
6463
+ minSize: rightSidebarMinPercentage ?? rightSidebarPercentage,
6464
+ defaultSize: rightSidebarPercentage,
6465
+ collapsible: true,
6466
+ style: {
6467
+ display: "flex",
6468
+ flexDirection: "row"
6469
+ }
6470
+ },
6471
+ rightPanelContent
6472
+ ))
6473
+ )
6474
+ );
6450
6475
  });
6451
6476
 
6452
6477
  // src/hooks/usePlatform.ts