@forgeax/app-shell 0.38.0 → 0.39.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.
package/dist/react.d.ts CHANGED
@@ -129,6 +129,32 @@ interface FloatingMenuProps {
129
129
  /** Product-neutral floating menu portal with outside-dismiss and viewport clamping. */
130
130
  declare function FloatingMenu({ open, onClose, point, anchor, align, offset, className, children, }: FloatingMenuProps): react.ReactPortal | null;
131
131
 
132
+ interface DockLayoutMenuPanel {
133
+ readonly id: string;
134
+ readonly title: string;
135
+ readonly icon?: ReactNode;
136
+ }
137
+ interface DockLayoutMenuProps<Anchor extends FloatingMenuAnchor> {
138
+ readonly state: DockLayoutControlState<Anchor>;
139
+ readonly onToggle: DockLayoutControlToggleSource<Anchor>['onToggle'];
140
+ readonly isPanelOpen: (panelId: string) => boolean;
141
+ readonly closePanel: (panelId: string) => void;
142
+ readonly reopenPanel: (panelId: string) => void;
143
+ readonly onReset: () => void;
144
+ readonly resetLabel: ReactNode;
145
+ readonly sectionLabel: ReactNode;
146
+ readonly emptyLabel: ReactNode;
147
+ readonly resetIcon?: ReactNode;
148
+ readonly panels: readonly DockLayoutMenuPanel[];
149
+ }
150
+ /**
151
+ * Product-neutral Dock layout-menu composition.
152
+ *
153
+ * Consumers inject copy, icons, reset policy and concrete panel adapters while
154
+ * App Shell owns the stable binding, carrier, row semantics and structure.
155
+ */
156
+ declare function DockLayoutMenu<Anchor extends FloatingMenuAnchor>({ state, onToggle, isPanelOpen, closePanel, reopenPanel, onReset, resetLabel, sectionLabel, emptyLabel, resetIcon, panels, }: DockLayoutMenuProps<Anchor>): react.JSX.Element;
157
+
132
158
  type ShellSlotElement = 'aside' | 'div' | 'main' | 'section';
133
159
  interface ShellSlotProps extends HTMLAttributes<HTMLElement> {
134
160
  as?: ShellSlotElement;
@@ -137,4 +163,4 @@ interface ShellSlotProps extends HTMLAttributes<HTMLElement> {
137
163
  /** Structural shell marker that preserves the caller's semantic element. */
138
164
  declare function ShellSlot({ as, name, ...props }: ShellSlotProps): ReactElement;
139
165
 
140
- export { DetachedPanelBoundary, type DetachedPanelBoundaryProps, DetachedSurfaceFrame, type DetachedSurfaceFrameProps, DetachedSurfaceStatus, type DetachedSurfaceStatusProps, type DetachedSurfaceStatusTone, type DockLayoutControlBinding, type DockLayoutControlBindingOptions, FloatingMenu, type FloatingMenuAnchor, type FloatingMenuPoint, type FloatingMenuProps, type PanelContentPadding, type PanelContentPolicy, type PanelContentScroll, type PanelContentTone, PanelEmptyState, type PanelEmptyStateProps, PanelSurface, type PanelSurfaceProps, ResizeHandle, type ResizeHandleProps, ShellSlot, type ShellSlotElement, type ShellSlotProps, SlotDebugOverlay, SurfacePlaceholder, type SurfacePlaceholderProps, SurfaceRegion, type SurfaceRegionProps, hashSlotHue, isSlotDebugEnabled, useDockLayoutControlBinding, useLocalSize };
166
+ export { DetachedPanelBoundary, type DetachedPanelBoundaryProps, DetachedSurfaceFrame, type DetachedSurfaceFrameProps, DetachedSurfaceStatus, type DetachedSurfaceStatusProps, type DetachedSurfaceStatusTone, type DockLayoutControlBinding, type DockLayoutControlBindingOptions, DockLayoutMenu, type DockLayoutMenuPanel, type DockLayoutMenuProps, FloatingMenu, type FloatingMenuAnchor, type FloatingMenuPoint, type FloatingMenuProps, type PanelContentPadding, type PanelContentPolicy, type PanelContentScroll, type PanelContentTone, PanelEmptyState, type PanelEmptyStateProps, PanelSurface, type PanelSurfaceProps, ResizeHandle, type ResizeHandleProps, ShellSlot, type ShellSlotElement, type ShellSlotProps, SlotDebugOverlay, SurfacePlaceholder, type SurfacePlaceholderProps, SurfaceRegion, type SurfaceRegionProps, hashSlotHue, isSlotDebugEnabled, useDockLayoutControlBinding, useLocalSize };
package/dist/react.js CHANGED
@@ -949,6 +949,85 @@ function FloatingMenu({
949
949
  );
950
950
  }
951
951
 
952
+ // src/dock-layout-menu.tsx
953
+ import { jsx as jsx8, jsxs as jsxs4 } from "react/jsx-runtime";
954
+ function DockLayoutMenu({
955
+ state,
956
+ onToggle,
957
+ isPanelOpen,
958
+ closePanel,
959
+ reopenPanel,
960
+ onReset,
961
+ resetLabel,
962
+ sectionLabel,
963
+ emptyLabel,
964
+ resetIcon,
965
+ panels
966
+ }) {
967
+ const { snapshot, panelControl } = useDockLayoutControlBinding({
968
+ state,
969
+ onToggle,
970
+ isPanelOpen,
971
+ closePanel,
972
+ reopenPanel
973
+ });
974
+ return /* @__PURE__ */ jsxs4(
975
+ FloatingMenu,
976
+ {
977
+ open: snapshot.open,
978
+ onClose: state.close,
979
+ anchor: snapshot.anchor,
980
+ align: "end",
981
+ className: "fx-dl-menu",
982
+ children: [
983
+ /* @__PURE__ */ jsxs4(
984
+ "button",
985
+ {
986
+ type: "button",
987
+ role: "menuitem",
988
+ "data-app-shell-dock-layout-reset": "",
989
+ className: "fx-dl-item fx-dl-reset",
990
+ onClick: () => {
991
+ try {
992
+ onReset();
993
+ } finally {
994
+ state.close();
995
+ }
996
+ },
997
+ children: [
998
+ resetIcon ? /* @__PURE__ */ jsx8("span", { "aria-hidden": "true", children: resetIcon }) : null,
999
+ resetLabel
1000
+ ]
1001
+ }
1002
+ ),
1003
+ /* @__PURE__ */ jsx8("div", { className: "fx-dl-sep", role: "separator" }),
1004
+ /* @__PURE__ */ jsx8("div", { className: "fx-dl-head", children: sectionLabel }),
1005
+ panels.length === 0 ? /* @__PURE__ */ jsx8("div", { className: "fx-dl-head", "data-app-shell-dock-layout-empty": "", children: emptyLabel }) : panels.map((panel) => {
1006
+ const isOpen = panelControl.isOpen(panel.id);
1007
+ return /* @__PURE__ */ jsxs4(
1008
+ "button",
1009
+ {
1010
+ type: "button",
1011
+ role: "menuitemcheckbox",
1012
+ "aria-checked": isOpen,
1013
+ className: `fx-dl-item${isOpen ? " on" : ""}`,
1014
+ onClick: () => {
1015
+ panelControl.toggle(panel.id);
1016
+ },
1017
+ children: [
1018
+ /* @__PURE__ */ jsx8("span", { className: "fx-dl-check", "aria-hidden": "true", children: isOpen ? "\u2713" : "\uFF0B" }),
1019
+ panel.icon ? /* @__PURE__ */ jsx8("span", { className: "fx-dl-icon", "aria-hidden": "true", children: panel.icon }) : null,
1020
+ panel.title
1021
+ ]
1022
+ },
1023
+ panel.id
1024
+ );
1025
+ })
1026
+ ]
1027
+ }
1028
+ );
1029
+ }
1030
+
952
1031
  // src/react.tsx
953
1032
  function ShellSlot({
954
1033
  as = "div",
@@ -961,6 +1040,7 @@ export {
961
1040
  DetachedPanelBoundary,
962
1041
  DetachedSurfaceFrame,
963
1042
  DetachedSurfaceStatus,
1043
+ DockLayoutMenu,
964
1044
  FloatingMenu,
965
1045
  PanelEmptyState,
966
1046
  PanelSurface,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@forgeax/app-shell",
3
- "version": "0.38.0",
3
+ "version": "0.39.1",
4
4
  "description": "Generic Dock, Panel, Window, and Slot composition primitives",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",