@asymmetric-effort/specifyjs 0.2.171 → 0.3.1

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.
@@ -13830,6 +13830,99 @@ function DesktopBackground(props) {
13830
13830
  return backgroundEl;
13831
13831
  }
13832
13832
 
13833
+ // ../components/layout/draggable-window/src/StatusBar.ts
13834
+ function StatusBar(props) {
13835
+ const {
13836
+ items,
13837
+ backgroundColor = "#007acc",
13838
+ color = "#ffffff",
13839
+ height = 22
13840
+ } = props;
13841
+ const leftItems = items.filter((item) => item.align !== "right");
13842
+ const rightItems = items.filter((item) => item.align === "right");
13843
+ const containerStyle3 = {
13844
+ display: "flex",
13845
+ alignItems: "center",
13846
+ justifyContent: "space-between",
13847
+ height: `${height}px`,
13848
+ backgroundColor,
13849
+ color,
13850
+ fontSize: "12px",
13851
+ flexShrink: "0",
13852
+ padding: "0 8px",
13853
+ overflow: "hidden",
13854
+ userSelect: "none"
13855
+ };
13856
+ function renderItem(item) {
13857
+ const isClickable = typeof item.onClick === "function";
13858
+ const itemStyle = {
13859
+ display: "inline-flex",
13860
+ alignItems: "center",
13861
+ gap: "4px",
13862
+ padding: "0 6px",
13863
+ height: "100%",
13864
+ whiteSpace: "nowrap",
13865
+ cursor: isClickable ? "pointer" : "default"
13866
+ };
13867
+ const children = [];
13868
+ if (item.icon) {
13869
+ children.push(
13870
+ createElement("span", {
13871
+ className: "status-bar__item-icon",
13872
+ style: { fontSize: "12px", lineHeight: "1" }
13873
+ }, item.icon)
13874
+ );
13875
+ }
13876
+ children.push(
13877
+ createElement("span", {
13878
+ className: "status-bar__item-label"
13879
+ }, item.label)
13880
+ );
13881
+ const itemProps = {
13882
+ key: item.key,
13883
+ className: `status-bar__item${isClickable ? " status-bar__item--clickable" : ""}`,
13884
+ style: itemStyle
13885
+ };
13886
+ if (isClickable) {
13887
+ itemProps.onClick = item.onClick;
13888
+ itemProps.onMouseEnter = (e) => {
13889
+ e.currentTarget.style.backgroundColor = "rgba(255, 255, 255, 0.15)";
13890
+ };
13891
+ itemProps.onMouseLeave = (e) => {
13892
+ e.currentTarget.style.backgroundColor = "";
13893
+ };
13894
+ }
13895
+ return createElement("span", itemProps, ...children);
13896
+ }
13897
+ const leftGroup = createElement(
13898
+ "div",
13899
+ {
13900
+ className: "status-bar__left",
13901
+ style: { display: "flex", alignItems: "center", height: "100%", overflow: "hidden" }
13902
+ },
13903
+ ...leftItems.map(renderItem)
13904
+ );
13905
+ const rightGroup = createElement(
13906
+ "div",
13907
+ {
13908
+ className: "status-bar__right",
13909
+ style: { display: "flex", alignItems: "center", height: "100%", overflow: "hidden" }
13910
+ },
13911
+ ...rightItems.map(renderItem)
13912
+ );
13913
+ return createElement(
13914
+ "div",
13915
+ {
13916
+ className: "status-bar",
13917
+ style: containerStyle3,
13918
+ role: "status",
13919
+ "aria-label": "Status bar"
13920
+ },
13921
+ leftGroup,
13922
+ rightGroup
13923
+ );
13924
+ }
13925
+
13833
13926
  // ../components/layout/draggable-window/src/DraggableWindow.ts
13834
13927
  var DEFAULT_MIN_SIZE = { width: 200, height: 150 };
13835
13928
  var DEFAULT_POSITION = { x: 50, y: 50 };
@@ -13866,6 +13959,7 @@ function DraggableWindow(props) {
13866
13959
  onFocus,
13867
13960
  onMove,
13868
13961
  onResize,
13962
+ statusBar,
13869
13963
  children
13870
13964
  } = props;
13871
13965
  const [posX, setPosX] = useState(defaultPosition.x);
@@ -13928,9 +14022,10 @@ function DraggableWindow(props) {
13928
14022
  const handleTitleBarDblClick = useCallback(
13929
14023
  (e) => {
13930
14024
  if (e.target.closest("button")) return;
14025
+ if (!resizable) return;
13931
14026
  if (onMaximize) onMaximize();
13932
14027
  },
13933
- [onMaximize]
14028
+ [onMaximize, resizable]
13934
14029
  );
13935
14030
  useEffect(() => {
13936
14031
  if (!isDragging) return;
@@ -14203,23 +14298,19 @@ function DraggableWindow(props) {
14203
14298
  title
14204
14299
  )
14205
14300
  );
14206
- const controlsContainer = createElement(
14207
- "div",
14208
- {
14209
- style: { display: "flex", alignItems: "center", flexShrink: "0" },
14210
- className: "draggable-window__controls"
14211
- },
14212
- createElement("button", {
14213
- type: "button",
14214
- "aria-label": "Minimize",
14215
- className: "draggable-window__btn-minimize",
14216
- style: { ...buttonBaseStyle, backgroundColor: "var(--window-button-minimize, #f39c12)" },
14217
- onClick: (e) => {
14218
- e.stopPropagation();
14219
- if (onMinimize) onMinimize();
14220
- }
14221
- }),
14222
- createElement("button", {
14301
+ const controlButtons = [];
14302
+ controlButtons.push(createElement("button", {
14303
+ type: "button",
14304
+ "aria-label": "Minimize",
14305
+ className: "draggable-window__btn-minimize",
14306
+ style: { ...buttonBaseStyle, backgroundColor: "var(--window-button-minimize, #f39c12)" },
14307
+ onClick: (e) => {
14308
+ e.stopPropagation();
14309
+ if (onMinimize) onMinimize();
14310
+ }
14311
+ }));
14312
+ if (resizable) {
14313
+ controlButtons.push(createElement("button", {
14223
14314
  type: "button",
14224
14315
  "aria-label": isMaximized ? "Restore" : "Maximize",
14225
14316
  className: "draggable-window__btn-maximize",
@@ -14228,17 +14319,25 @@ function DraggableWindow(props) {
14228
14319
  e.stopPropagation();
14229
14320
  if (onMaximize) onMaximize();
14230
14321
  }
14231
- }),
14232
- createElement("button", {
14233
- type: "button",
14234
- "aria-label": "Close",
14235
- className: "draggable-window__btn-close",
14236
- style: { ...buttonBaseStyle, backgroundColor: "var(--window-button-close, #e74c3c)" },
14237
- onClick: (e) => {
14238
- e.stopPropagation();
14239
- if (onClose) onClose();
14240
- }
14241
- })
14322
+ }));
14323
+ }
14324
+ controlButtons.push(createElement("button", {
14325
+ type: "button",
14326
+ "aria-label": "Close",
14327
+ className: "draggable-window__btn-close",
14328
+ style: { ...buttonBaseStyle, backgroundColor: "var(--window-button-close, #e74c3c)" },
14329
+ onClick: (e) => {
14330
+ e.stopPropagation();
14331
+ if (onClose) onClose();
14332
+ }
14333
+ }));
14334
+ const controlsContainer = createElement(
14335
+ "div",
14336
+ {
14337
+ style: { display: "flex", alignItems: "center", flexShrink: "0" },
14338
+ className: "draggable-window__controls"
14339
+ },
14340
+ ...controlButtons
14242
14341
  );
14243
14342
  titleBarChildren.push(controlsContainer);
14244
14343
  const resizeHandles = [];
@@ -14361,6 +14460,9 @@ function DraggableWindow(props) {
14361
14460
  children
14362
14461
  )
14363
14462
  );
14463
+ if (statusBar && statusBar !== false) {
14464
+ windowChildren.push(createElement(StatusBar, statusBar));
14465
+ }
14364
14466
  const result = [
14365
14467
  createElement(
14366
14468
  "div",
@@ -15469,7 +15571,7 @@ var statusItemStyle = {
15469
15571
  borderRadius: "3px",
15470
15572
  transition: "background-color 0.15s"
15471
15573
  };
15472
- function StatusBar(props) {
15574
+ function StatusBar2(props) {
15473
15575
  const renderItems = (items) => items.map(
15474
15576
  (item, i) => createElement(
15475
15577
  "span",
@@ -15818,7 +15920,7 @@ function IDE(props) {
15818
15920
  })
15819
15921
  ),
15820
15922
  // Status Bar
15821
- createElement(StatusBar, {
15923
+ createElement(StatusBar2, {
15822
15924
  items: [
15823
15925
  { label: "\u2387 main" },
15824
15926
  { label: "0 errors" },
@@ -20457,11 +20559,13 @@ function UnityDesktopInner(props) {
20457
20559
  icon: app.icon,
20458
20560
  x: 60 + prev.length * 30,
20459
20561
  y: 40 + prev.length * 30,
20460
- width: 600,
20461
- height: 400,
20562
+ width: app.defaultSize?.width ?? 600,
20563
+ height: app.defaultSize?.height ?? 400,
20462
20564
  zIndex: maxZ,
20463
20565
  focused: true,
20464
- windowState: "normal"
20566
+ windowState: "normal",
20567
+ resizable: app.resizable !== false,
20568
+ statusBar: app.statusBar
20465
20569
  };
20466
20570
  return [...prev.map((w) => ({ ...w, focused: false })), newWin];
20467
20571
  });
@@ -20532,11 +20636,13 @@ function UnityDesktopInner(props) {
20532
20636
  icon: app.icon,
20533
20637
  x: 60 + prev.length * 30,
20534
20638
  y: 40 + prev.length * 30,
20535
- width: 600,
20536
- height: 400,
20639
+ width: app.defaultSize?.width ?? 600,
20640
+ height: app.defaultSize?.height ?? 400,
20537
20641
  zIndex: maxZ,
20538
20642
  focused: true,
20539
- windowState: "normal"
20643
+ windowState: "normal",
20644
+ resizable: app.resizable !== false,
20645
+ statusBar: app.statusBar
20540
20646
  };
20541
20647
  if (appId === "files") {
20542
20648
  wmRef.current.setMenuBar("files", {
@@ -20680,6 +20786,8 @@ function UnityDesktopInner(props) {
20680
20786
  icon: w.icon,
20681
20787
  defaultPosition: { x: w.x, y: w.y },
20682
20788
  defaultSize: { width: w.width, height: w.height },
20789
+ resizable: w.resizable,
20790
+ statusBar: w.statusBar,
20683
20791
  zIndex: w.zIndex,
20684
20792
  focused: w.focused,
20685
20793
  windowState: w.windowState,
@@ -20701,11 +20809,10 @@ function UnityDesktopInner(props) {
20701
20809
  },
20702
20810
  // Gallery demo only — real apps pass their own content as UnityApp children.
20703
20811
  // See docs/components/page/unity-desktop.md for integration patterns.
20704
- getMockContent(
20705
- apps.find((a) => a.id === w.appId)?.label || w.title,
20706
- w.id,
20707
- titleChangeCallbacks.current[w.id]
20708
- )
20812
+ (() => {
20813
+ const app = apps.find((a) => a.id === w.appId);
20814
+ return app?.render ? app.render(w.id) : getMockContent(app?.label || w.title, w.id, titleChangeCallbacks.current[w.id]);
20815
+ })()
20709
20816
  ));
20710
20817
  const desktopContentChildren = [];
20711
20818
  if (children) {
@@ -20982,6 +21089,7 @@ function UnityApp(props) {
20982
21089
  resizable = true,
20983
21090
  onClose,
20984
21091
  menuBar,
21092
+ statusBar,
20985
21093
  onActivate,
20986
21094
  onDeactivate,
20987
21095
  children
@@ -21064,6 +21172,7 @@ function UnityApp(props) {
21064
21172
  onResize: handleResize,
21065
21173
  onMinimize: handleMinimize,
21066
21174
  onMaximize: handleMaximize,
21175
+ statusBar,
21067
21176
  children
21068
21177
  })
21069
21178
  );
@@ -30328,7 +30437,6 @@ export {
30328
30437
  Slider,
30329
30438
  Spinner,
30330
30439
  Splitter,
30331
- StatusBar,
30332
30440
  Stepper,
30333
30441
  Sunburst,
30334
30442
  SystemTray,
@@ -1,3 +1,4 @@
1
+ import type { StatusBarProps } from './StatusBar';
1
2
  export interface DraggableWindowProps {
2
3
  /** Unique window identifier */
3
4
  id: string;
@@ -53,6 +54,8 @@ export interface DraggableWindowProps {
53
54
  width: number;
54
55
  height: number;
55
56
  }) => void;
57
+ /** Optional status bar rendered at the bottom of the window */
58
+ statusBar?: StatusBarProps | false;
56
59
  /** Application content rendered inside the window body */
57
60
  children?: unknown;
58
61
  }
@@ -0,0 +1,23 @@
1
+ export interface StatusBarItem {
2
+ /** Unique identifier for the item */
3
+ key: string;
4
+ /** Display text */
5
+ label: string;
6
+ /** Optional leading icon/emoji */
7
+ icon?: string;
8
+ /** Optional click handler */
9
+ onClick?: () => void;
10
+ /** Alignment within the status bar. Default: 'left' */
11
+ align?: 'left' | 'right';
12
+ }
13
+ export interface StatusBarProps {
14
+ /** Items to display in the status bar */
15
+ items: StatusBarItem[];
16
+ /** Background color. Default: '#007acc' */
17
+ backgroundColor?: string;
18
+ /** Text color. Default: '#ffffff' */
19
+ color?: string;
20
+ /** Height in pixels. Default: 22 */
21
+ height?: number;
22
+ }
23
+ export declare function StatusBar(props: StatusBarProps): import("specifyjs").SpecElement<import("specifyjs").Props>;
@@ -1,2 +1,4 @@
1
1
  export { DraggableWindow } from './DraggableWindow';
2
2
  export type { DraggableWindowProps } from './DraggableWindow';
3
+ export { StatusBar } from './StatusBar';
4
+ export type { StatusBarProps, StatusBarItem } from './StatusBar';
@@ -1,4 +1,5 @@
1
1
  import type { AppMenuBar } from '../../../layout/window-manager/src/index';
2
+ import type { StatusBarProps } from '../../../layout/draggable-window/src/index';
2
3
  export interface UnityAppProps {
3
4
  /** Unique identifier for this app window */
4
5
  id: string;
@@ -27,6 +28,8 @@ export interface UnityAppProps {
27
28
  onClose?: () => void;
28
29
  /** Menu bar definition; registered with WindowManager when provided */
29
30
  menuBar?: AppMenuBar;
31
+ /** Optional status bar rendered at the bottom of the window */
32
+ statusBar?: StatusBarProps | false;
30
33
  /** Called when this window gains focus */
31
34
  onActivate?: () => void;
32
35
  /** Called when this window loses focus */
@@ -1,7 +1,18 @@
1
+ import type { StatusBarProps } from '../../../layout/draggable-window/src/index';
1
2
  export interface UnityDesktopApp {
2
3
  id: string;
3
4
  icon: string;
4
5
  label: string;
6
+ render?: (windowId: string) => unknown;
7
+ /** Initial window dimensions when opened via dock click. Default: 600x400 */
8
+ defaultSize?: {
9
+ width: number;
10
+ height: number;
11
+ };
12
+ /** Whether the window can be resized by the user. Default: true */
13
+ resizable?: boolean;
14
+ /** Optional status bar rendered at the bottom of the window */
15
+ statusBar?: StatusBarProps | false;
5
16
  }
6
17
  export interface UnityDesktopUser {
7
18
  name: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@asymmetric-effort/specifyjs",
3
- "version": "0.2.171",
3
+ "version": "0.3.1",
4
4
  "description": "A declarative TypeScript UI framework built for performance and simplicity",
5
5
  "publishConfig": {
6
6
  "access": "public"