@deadragdoll/reactnu 0.1.24 → 0.1.30

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.
@@ -1,6 +1,7 @@
1
1
  import { HTMLAttributes } from "react";
2
2
  import { MainMenuItem, MainMenuNode } from "../MainMenu/MainMenu.types";
3
3
  export type PopupMenuPointAnchor = {
4
+ themeSource?: HTMLElement;
4
5
  type: "point";
5
6
  x: number;
6
7
  y: number;
@@ -5,7 +5,7 @@ export declare function usePopupMenu(): {
5
5
  close: () => void;
6
6
  open: boolean;
7
7
  openAtElement: (element: HTMLElement) => void;
8
- openAtPoint: (x: number, y: number) => void;
8
+ openAtPoint: (x: number, y: number, themeSource?: HTMLElement) => void;
9
9
  openFromClick: (event: MouseEvent<HTMLElement>) => void;
10
10
  openFromContextMenu: (event: MouseEvent<HTMLElement>) => void;
11
11
  setOpen: import("react").Dispatch<import("react").SetStateAction<boolean>>;
package/dist/index.cjs CHANGED
@@ -4495,7 +4495,7 @@ function PopupMenu({
4495
4495
  ref: rootRef,
4496
4496
  style: {
4497
4497
  ...getThemePortalStyle(
4498
- anchor?.type === "element" ? anchor.element : null
4498
+ anchor.type === "element" ? anchor.element : anchor.themeSource ?? null
4499
4499
  ),
4500
4500
  ...styleProp,
4501
4501
  left: 0,
@@ -4528,8 +4528,9 @@ function usePopupMenu() {
4528
4528
  function close() {
4529
4529
  setOpen(false);
4530
4530
  }
4531
- function openAtPoint(x, y) {
4531
+ function openAtPoint(x, y, themeSource) {
4532
4532
  setAnchor({
4533
+ themeSource,
4533
4534
  type: "point",
4534
4535
  x,
4535
4536
  y
@@ -4548,7 +4549,7 @@ function usePopupMenu() {
4548
4549
  }
4549
4550
  function openFromContextMenu(event) {
4550
4551
  event.preventDefault();
4551
- openAtPoint(event.clientX, event.clientY);
4552
+ openAtPoint(event.clientX, event.clientY, event.currentTarget);
4552
4553
  }
4553
4554
  return {
4554
4555
  anchor,
@@ -4688,7 +4689,7 @@ function NuIconGridItem({ gridElement, icon }) {
4688
4689
  return;
4689
4690
  }
4690
4691
  event.preventDefault();
4691
- contextMenu.openAtPoint(event.clientX, event.clientY);
4692
+ contextMenu.openAtPoint(event.clientX, event.clientY, event.currentTarget);
4692
4693
  }
4693
4694
  function handleKeyDown(event) {
4694
4695
  if (event.key !== "ContextMenu" && !(event.key === "F10" && event.shiftKey) || contextMenuItems.length === 0) {
@@ -4780,7 +4781,7 @@ function NuIconGrid({
4780
4781
  }
4781
4782
  event.preventDefault();
4782
4783
  manager.selectIcon(null);
4783
- contextMenu.openAtPoint(event.clientX, event.clientY);
4784
+ contextMenu.openAtPoint(event.clientX, event.clientY, event.currentTarget);
4784
4785
  }
4785
4786
  return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
4786
4787
  "div",
@@ -9898,11 +9899,48 @@ var midnightTheme = {
9898
9899
  windowModalBackdrop: "rgb(7 12 20 / 0.48)"
9899
9900
  }
9900
9901
  };
9902
+ var grayscaleTheme = {
9903
+ name: "grayscale",
9904
+ label: "Grayscale Monitor",
9905
+ tokens: {
9906
+ desktopBackground: "#808080",
9907
+ desktopPattern: "rgb(0 0 0 / 0.3)",
9908
+ shellBackground: "#202020",
9909
+ appBackground: "#3f3f3f",
9910
+ appBackgroundAlt: "#2b2b2b",
9911
+ chromeBackground: "#727272",
9912
+ panelBackground: "#3f3f3f",
9913
+ panelInsetBackground: "#343434",
9914
+ titleBackground: "#262626",
9915
+ titleText: "#d0d0d0",
9916
+ textPrimary: "#c8c8c8",
9917
+ textMuted: "#969696",
9918
+ textInverse: "#d0d0d0",
9919
+ textAccent: "#e0e0e0",
9920
+ textHotkey: "#ffffff",
9921
+ buttonFace: "#5b5b5b",
9922
+ buttonFaceAlt: "#414141",
9923
+ buttonDanger: "#303030",
9924
+ buttonSuccess: "#6b6b6b",
9925
+ buttonText: "#d0d0d0",
9926
+ fieldBackground: "#0e0e0e",
9927
+ fieldText: "#d8d8d8",
9928
+ borderLight: "#c7c7c7",
9929
+ borderDark: "#000000",
9930
+ borderAccent: "#ffffff",
9931
+ shadowColor: "#000000",
9932
+ panelShadowColor: "rgb(0 0 0 / 0.5)",
9933
+ focusColor: "#ffffff",
9934
+ windowInactiveOverlay: "rgb(0 0 0 / 0.34)",
9935
+ windowModalBackdrop: "rgb(0 0 0 / 0.5)"
9936
+ }
9937
+ };
9901
9938
  var nuThemes = {
9902
9939
  classic: classicTheme,
9903
9940
  amber: amberTheme,
9904
9941
  phosphor: phosphorTheme,
9905
- midnight: midnightTheme
9942
+ midnight: midnightTheme,
9943
+ grayscale: grayscaleTheme
9906
9944
  };
9907
9945
  function isNuThemeName(value) {
9908
9946
  return value in nuThemes;
package/dist/index.js CHANGED
@@ -4454,7 +4454,7 @@ function PopupMenu({
4454
4454
  ref: rootRef,
4455
4455
  style: {
4456
4456
  ...getThemePortalStyle(
4457
- anchor?.type === "element" ? anchor.element : null
4457
+ anchor.type === "element" ? anchor.element : anchor.themeSource ?? null
4458
4458
  ),
4459
4459
  ...styleProp,
4460
4460
  left: 0,
@@ -4487,8 +4487,9 @@ function usePopupMenu() {
4487
4487
  function close() {
4488
4488
  setOpen(false);
4489
4489
  }
4490
- function openAtPoint(x, y) {
4490
+ function openAtPoint(x, y, themeSource) {
4491
4491
  setAnchor({
4492
+ themeSource,
4492
4493
  type: "point",
4493
4494
  x,
4494
4495
  y
@@ -4507,7 +4508,7 @@ function usePopupMenu() {
4507
4508
  }
4508
4509
  function openFromContextMenu(event) {
4509
4510
  event.preventDefault();
4510
- openAtPoint(event.clientX, event.clientY);
4511
+ openAtPoint(event.clientX, event.clientY, event.currentTarget);
4511
4512
  }
4512
4513
  return {
4513
4514
  anchor,
@@ -4647,7 +4648,7 @@ function NuIconGridItem({ gridElement, icon }) {
4647
4648
  return;
4648
4649
  }
4649
4650
  event.preventDefault();
4650
- contextMenu.openAtPoint(event.clientX, event.clientY);
4651
+ contextMenu.openAtPoint(event.clientX, event.clientY, event.currentTarget);
4651
4652
  }
4652
4653
  function handleKeyDown(event) {
4653
4654
  if (event.key !== "ContextMenu" && !(event.key === "F10" && event.shiftKey) || contextMenuItems.length === 0) {
@@ -4739,7 +4740,7 @@ function NuIconGrid({
4739
4740
  }
4740
4741
  event.preventDefault();
4741
4742
  manager.selectIcon(null);
4742
- contextMenu.openAtPoint(event.clientX, event.clientY);
4743
+ contextMenu.openAtPoint(event.clientX, event.clientY, event.currentTarget);
4743
4744
  }
4744
4745
  return /* @__PURE__ */ jsxs20(
4745
4746
  "div",
@@ -9941,11 +9942,48 @@ var midnightTheme = {
9941
9942
  windowModalBackdrop: "rgb(7 12 20 / 0.48)"
9942
9943
  }
9943
9944
  };
9945
+ var grayscaleTheme = {
9946
+ name: "grayscale",
9947
+ label: "Grayscale Monitor",
9948
+ tokens: {
9949
+ desktopBackground: "#808080",
9950
+ desktopPattern: "rgb(0 0 0 / 0.3)",
9951
+ shellBackground: "#202020",
9952
+ appBackground: "#3f3f3f",
9953
+ appBackgroundAlt: "#2b2b2b",
9954
+ chromeBackground: "#727272",
9955
+ panelBackground: "#3f3f3f",
9956
+ panelInsetBackground: "#343434",
9957
+ titleBackground: "#262626",
9958
+ titleText: "#d0d0d0",
9959
+ textPrimary: "#c8c8c8",
9960
+ textMuted: "#969696",
9961
+ textInverse: "#d0d0d0",
9962
+ textAccent: "#e0e0e0",
9963
+ textHotkey: "#ffffff",
9964
+ buttonFace: "#5b5b5b",
9965
+ buttonFaceAlt: "#414141",
9966
+ buttonDanger: "#303030",
9967
+ buttonSuccess: "#6b6b6b",
9968
+ buttonText: "#d0d0d0",
9969
+ fieldBackground: "#0e0e0e",
9970
+ fieldText: "#d8d8d8",
9971
+ borderLight: "#c7c7c7",
9972
+ borderDark: "#000000",
9973
+ borderAccent: "#ffffff",
9974
+ shadowColor: "#000000",
9975
+ panelShadowColor: "rgb(0 0 0 / 0.5)",
9976
+ focusColor: "#ffffff",
9977
+ windowInactiveOverlay: "rgb(0 0 0 / 0.34)",
9978
+ windowModalBackdrop: "rgb(0 0 0 / 0.5)"
9979
+ }
9980
+ };
9944
9981
  var nuThemes = {
9945
9982
  classic: classicTheme,
9946
9983
  amber: amberTheme,
9947
9984
  phosphor: phosphorTheme,
9948
- midnight: midnightTheme
9985
+ midnight: midnightTheme,
9986
+ grayscale: grayscaleTheme
9949
9987
  };
9950
9988
  function isNuThemeName(value) {
9951
9989
  return value in nuThemes;
package/dist/styles.css CHANGED
@@ -3497,11 +3497,6 @@
3497
3497
  outline: none;
3498
3498
  box-shadow: none;
3499
3499
  }
3500
- .nu-window__title-button--close {
3501
- background: var(--nu-color-title-bg);
3502
- border: 1px solid var(--nu-border-light);
3503
- color: var(--nu-text-inverse);
3504
- }
3505
3500
  .nu-window__body {
3506
3501
  min-width: 0;
3507
3502
  min-height: 0;
@@ -42,6 +42,7 @@ export declare const nuThemes: {
42
42
  readonly amber: NuThemeDefinition;
43
43
  readonly phosphor: NuThemeDefinition;
44
44
  readonly midnight: NuThemeDefinition;
45
+ readonly grayscale: NuThemeDefinition;
45
46
  };
46
47
  export type NuThemeName = keyof typeof nuThemes;
47
48
  export declare function isNuThemeName(value: string): value is NuThemeName;
@@ -59,7 +59,9 @@ Supported props:
59
59
 
60
60
  ## Notes
61
61
 
62
- - Built-in themes are `classic` (default), `amber`, `phosphor`, and `midnight`.
62
+ - Built-in themes are `classic` (default), `amber`, `phosphor`, `midnight`, and
63
+ `grayscale`.
63
64
  - `midnight` is a restrained dark blue-gray palette with pale chrome and yellow focus accents.
65
+ - `grayscale` is a high-contrast monochrome monitor palette. Semantic button variants use brightness rather than hue.
64
66
  - Theme tokens drive desktop, windowing, controls, selection, and inactive overlays.
65
67
  - Provider typography affects preview content, managed windows, dialogs, menus, and popup portals rendered inside the theme scope.
package/docs/PopupMenu.md CHANGED
@@ -32,7 +32,7 @@ const popupMenu = usePopupMenu();
32
32
  - `open`
33
33
  - `setOpen`
34
34
  - `close()`
35
- - `openAtPoint(x, y)`
35
+ - `openAtPoint(x, y, themeSource?)`
36
36
  - `openAtElement(element)`
37
37
  - `openFromClick(event)`
38
38
  - `openFromContextMenu(event)`
@@ -40,3 +40,6 @@ const popupMenu = usePopupMenu();
40
40
  ## Notes
41
41
 
42
42
  - Popup menus render through a portal and are not clipped by local overflow containers.
43
+ - `openFromContextMenu(event)` carries the event target into the portal, so
44
+ context menus inherit tokens from the nearest `NuThemeProvider`. Pass the
45
+ optional `themeSource` to `openAtPoint(...)` when opening one manually.
@@ -97,7 +97,7 @@ If a component needs a new reusable visual value, add it there first instead of
97
97
  - Shadows:
98
98
  - If it is raised, is it reusing button/window shadow logic instead of inventing a new one?
99
99
  - Theme coverage:
100
- - Would the component still read correctly in `classic`, `amber`, `phosphor`, and `midnight`?
100
+ - Would the component still read correctly in `classic`, `amber`, `phosphor`, `midnight`, and `grayscale`?
101
101
  - Hardcoded values:
102
102
  - Are any colors or dimensions local only because they are truly component-specific?
103
103
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deadragdoll/reactnu",
3
- "version": "0.1.24",
3
+ "version": "0.1.30",
4
4
  "private": false,
5
5
  "description": "React components with a precise DOS-era utility interface.",
6
6
  "license": "MIT",