@forgeax/app-shell 0.7.0 → 0.8.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/README.md +17 -0
- package/dist/panel.css +41 -0
- package/dist/react.d.ts +21 -2
- package/dist/react.js +39 -0
- package/package.json +5 -4
package/README.md
CHANGED
|
@@ -67,6 +67,23 @@ const [width, setWidth] = useLocalSize('product.sidebar.width', 280, 180, 640);
|
|
|
67
67
|
</aside>
|
|
68
68
|
```
|
|
69
69
|
|
|
70
|
+
Generic panel sections keep product renderers and action policies outside App
|
|
71
|
+
Shell while providing stable shell/content metadata:
|
|
72
|
+
|
|
73
|
+
```tsx
|
|
74
|
+
import '@forgeax/app-shell/panel.css';
|
|
75
|
+
import { PanelSurface } from '@forgeax/app-shell/react';
|
|
76
|
+
|
|
77
|
+
<PanelSurface
|
|
78
|
+
id="project-tree"
|
|
79
|
+
registered
|
|
80
|
+
header={<ProductPanelActions />}
|
|
81
|
+
content={{ padding: 'sm', scroll: 'auto', tone: 'tool' }}
|
|
82
|
+
>
|
|
83
|
+
<ProjectTree />
|
|
84
|
+
</PanelSurface>
|
|
85
|
+
```
|
|
86
|
+
|
|
70
87
|
## Ownership boundary
|
|
71
88
|
|
|
72
89
|
| Package | Owns |
|
package/dist/panel.css
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
.fx-panel {
|
|
2
|
+
height: 100%;
|
|
3
|
+
width: 100%;
|
|
4
|
+
min-width: 0;
|
|
5
|
+
min-height: 0;
|
|
6
|
+
display: flex;
|
|
7
|
+
flex-direction: column;
|
|
8
|
+
background: var(--color-background-base, #191919);
|
|
9
|
+
color: var(--color-text-primary, #e8eaed);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.fx-panel-content {
|
|
13
|
+
flex: 1 1 auto;
|
|
14
|
+
min-width: 0;
|
|
15
|
+
min-height: 0;
|
|
16
|
+
overflow: auto;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.fx-panel-content[data-scroll="none"] {
|
|
20
|
+
overflow: hidden;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.fx-panel-content[data-padding="none"] {
|
|
24
|
+
padding: 0;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.fx-panel-content[data-padding="sm"] {
|
|
28
|
+
padding: 8px;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.fx-panel-content[data-padding="md"] {
|
|
32
|
+
padding: 12px;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.fx-panel-content[data-tone="surface"] {
|
|
36
|
+
background: var(--color-background-elevated, #161619);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.fx-panel-content[data-tone="tool"] {
|
|
40
|
+
background: var(--color-background-base, #191919);
|
|
41
|
+
}
|
package/dist/react.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
|
-
import { ReactElement, HTMLAttributes } from 'react';
|
|
2
|
+
import { ReactElement, HTMLAttributes, ReactNode } from 'react';
|
|
3
3
|
|
|
4
4
|
/** Stable FNV-1a color bucket for a shell slot name. */
|
|
5
5
|
declare function hashSlotHue(name: string): number;
|
|
@@ -20,6 +20,25 @@ interface ResizeHandleProps {
|
|
|
20
20
|
}
|
|
21
21
|
declare function ResizeHandle({ orientation, onDrag, onDragStart, onDragEnd, className, ariaLabel, title, }: ResizeHandleProps): react.JSX.Element;
|
|
22
22
|
|
|
23
|
+
type PanelContentPadding = 'none' | 'sm' | 'md';
|
|
24
|
+
type PanelContentScroll = 'none' | 'auto';
|
|
25
|
+
type PanelContentTone = 'default' | 'surface' | 'tool';
|
|
26
|
+
interface PanelContentPolicy {
|
|
27
|
+
readonly padding?: PanelContentPadding;
|
|
28
|
+
readonly scroll?: PanelContentScroll;
|
|
29
|
+
readonly tone?: PanelContentTone;
|
|
30
|
+
}
|
|
31
|
+
interface PanelSurfaceProps extends Omit<HTMLAttributes<HTMLElement>, 'children' | 'content' | 'id'> {
|
|
32
|
+
readonly id: string;
|
|
33
|
+
readonly registered?: boolean;
|
|
34
|
+
readonly singleTab?: 'default' | 'full' | 'hideTitle';
|
|
35
|
+
readonly header?: ReactNode;
|
|
36
|
+
readonly content?: PanelContentPolicy;
|
|
37
|
+
readonly children?: ReactNode;
|
|
38
|
+
}
|
|
39
|
+
/** Product-neutral panel section and content presentation. */
|
|
40
|
+
declare function PanelSurface({ id, registered, singleTab, header, content, children, className, ...props }: PanelSurfaceProps): ReactElement;
|
|
41
|
+
|
|
23
42
|
type ShellSlotElement = 'aside' | 'div' | 'main' | 'section';
|
|
24
43
|
interface ShellSlotProps extends HTMLAttributes<HTMLElement> {
|
|
25
44
|
as?: ShellSlotElement;
|
|
@@ -28,4 +47,4 @@ interface ShellSlotProps extends HTMLAttributes<HTMLElement> {
|
|
|
28
47
|
/** Structural shell marker that preserves the caller's semantic element. */
|
|
29
48
|
declare function ShellSlot({ as, name, ...props }: ShellSlotProps): ReactElement;
|
|
30
49
|
|
|
31
|
-
export { ResizeHandle, type ResizeHandleProps, ShellSlot, type ShellSlotElement, type ShellSlotProps, SlotDebugOverlay, hashSlotHue, isSlotDebugEnabled, useLocalSize };
|
|
50
|
+
export { type PanelContentPadding, type PanelContentPolicy, type PanelContentScroll, type PanelContentTone, PanelSurface, type PanelSurfaceProps, ResizeHandle, type ResizeHandleProps, ShellSlot, type ShellSlotElement, type ShellSlotProps, SlotDebugOverlay, hashSlotHue, isSlotDebugEnabled, useLocalSize };
|
package/dist/react.js
CHANGED
|
@@ -255,6 +255,44 @@ function ResizeHandle({
|
|
|
255
255
|
);
|
|
256
256
|
}
|
|
257
257
|
|
|
258
|
+
// src/panel.tsx
|
|
259
|
+
import { jsx as jsx3, jsxs } from "react/jsx-runtime";
|
|
260
|
+
function PanelSurface({
|
|
261
|
+
id,
|
|
262
|
+
registered = false,
|
|
263
|
+
singleTab,
|
|
264
|
+
header,
|
|
265
|
+
content,
|
|
266
|
+
children,
|
|
267
|
+
className,
|
|
268
|
+
...props
|
|
269
|
+
}) {
|
|
270
|
+
return /* @__PURE__ */ jsxs(
|
|
271
|
+
"section",
|
|
272
|
+
{
|
|
273
|
+
...props,
|
|
274
|
+
className: className ? `fx-panel ${className}` : "fx-panel",
|
|
275
|
+
"data-fx-panel-id": id,
|
|
276
|
+
"data-panel-registered": registered ? "true" : "false",
|
|
277
|
+
"data-dock-single-tab": singleTab,
|
|
278
|
+
"data-fx-slot": `DockPanel:${id}`,
|
|
279
|
+
children: [
|
|
280
|
+
header,
|
|
281
|
+
/* @__PURE__ */ jsx3(
|
|
282
|
+
"div",
|
|
283
|
+
{
|
|
284
|
+
className: "fx-panel-content",
|
|
285
|
+
"data-padding": content?.padding ?? "none",
|
|
286
|
+
"data-scroll": content?.scroll ?? "auto",
|
|
287
|
+
"data-tone": content?.tone ?? "default",
|
|
288
|
+
children
|
|
289
|
+
}
|
|
290
|
+
)
|
|
291
|
+
]
|
|
292
|
+
}
|
|
293
|
+
);
|
|
294
|
+
}
|
|
295
|
+
|
|
258
296
|
// src/react.tsx
|
|
259
297
|
function ShellSlot({
|
|
260
298
|
as = "div",
|
|
@@ -264,6 +302,7 @@ function ShellSlot({
|
|
|
264
302
|
return createElement(as, { ...props, "data-fx-slot": name });
|
|
265
303
|
}
|
|
266
304
|
export {
|
|
305
|
+
PanelSurface,
|
|
267
306
|
ResizeHandle,
|
|
268
307
|
ShellSlot,
|
|
269
308
|
SlotDebugOverlay,
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@forgeax/app-shell",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.0",
|
|
4
4
|
"description": "Generic Dock, Panel, Window, and Slot composition primitives",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
7
|
-
"sideEffects": ["./dist/resize.css"],
|
|
7
|
+
"sideEffects": ["./dist/resize.css", "./dist/panel.css"],
|
|
8
8
|
"files": ["dist"],
|
|
9
9
|
"main": "./dist/index.js",
|
|
10
10
|
"types": "./dist/index.d.ts",
|
|
@@ -21,12 +21,13 @@
|
|
|
21
21
|
"types": "./dist/react.d.ts",
|
|
22
22
|
"import": "./dist/react.js"
|
|
23
23
|
},
|
|
24
|
-
"./resize.css": "./dist/resize.css"
|
|
24
|
+
"./resize.css": "./dist/resize.css",
|
|
25
|
+
"./panel.css": "./dist/panel.css"
|
|
25
26
|
},
|
|
26
27
|
"scripts": {
|
|
27
28
|
"typecheck": "tsc --noEmit",
|
|
28
29
|
"test": "bun test test",
|
|
29
|
-
"build": "tsup src/index.ts src/dock.ts src/react.tsx --format esm --dts --outDir dist && bun run scripts/copy-resize-css.ts",
|
|
30
|
+
"build": "tsup src/index.ts src/dock.ts src/react.tsx --format esm --dts --outDir dist && bun run scripts/copy-resize-css.ts && bun run scripts/copy-panel-css.ts",
|
|
30
31
|
"check": "bun run typecheck && bun run test && bun run build",
|
|
31
32
|
"release:preflight": "bun run scripts/release-preflight.ts"
|
|
32
33
|
},
|