@echothink-ui/layout 0.2.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 +92 -0
- package/dist/index.cjs +1620 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.css +149 -0
- package/dist/index.css.map +1 -0
- package/dist/index.d.ts +24 -0
- package/dist/index.js +1546 -0
- package/dist/index.js.map +1 -0
- package/dist/layout-system/builders.d.ts +13 -0
- package/dist/layout-system/index.d.ts +24 -0
- package/dist/layout-system/inference/context.d.ts +33 -0
- package/dist/layout-system/inference/responsive.d.ts +21 -0
- package/dist/layout-system/inference/style.d.ts +15 -0
- package/dist/layout-system/page-layouts/index.d.ts +8 -0
- package/dist/layout-system/primitives/index.d.ts +6 -0
- package/dist/layout-system/regions/index.d.ts +4 -0
- package/dist/layout-system/registry/builtins.d.ts +8 -0
- package/dist/layout-system/registry/registry.d.ts +20 -0
- package/dist/layout-system/renderer/context.d.ts +41 -0
- package/dist/layout-system/renderer/region.d.ts +10 -0
- package/dist/layout-system/renderer/renderer.d.ts +13 -0
- package/dist/layout-system/renderer/root.d.ts +24 -0
- package/dist/layout-system/runtime/state.d.ts +17 -0
- package/dist/layout-system/runtime/viewport.d.ts +9 -0
- package/dist/layout-system/schema/types.d.ts +488 -0
- package/dist/layout-system/schema/validate.d.ts +15 -0
- package/dist/layout-system/tokens/preset-tokens.d.ts +11 -0
- package/package.json +47 -0
- package/src/index.tsx +42 -0
- package/src/layout-system/__tests__/layout-system.test.tsx +169 -0
- package/src/layout-system/builders.ts +46 -0
- package/src/layout-system/index.ts +87 -0
- package/src/layout-system/inference/context.ts +158 -0
- package/src/layout-system/inference/responsive.ts +147 -0
- package/src/layout-system/inference/style.ts +128 -0
- package/src/layout-system/page-layouts/index.tsx +405 -0
- package/src/layout-system/primitives/index.tsx +266 -0
- package/src/layout-system/regions/index.tsx +90 -0
- package/src/layout-system/registry/builtins.ts +19 -0
- package/src/layout-system/registry/registry.ts +47 -0
- package/src/layout-system/renderer/context.tsx +89 -0
- package/src/layout-system/renderer/region.tsx +34 -0
- package/src/layout-system/renderer/renderer.tsx +200 -0
- package/src/layout-system/renderer/root.tsx +95 -0
- package/src/layout-system/runtime/state.ts +80 -0
- package/src/layout-system/runtime/viewport.ts +71 -0
- package/src/layout-system/schema/types.ts +706 -0
- package/src/layout-system/schema/validate.ts +168 -0
- package/src/layout-system/tokens/preset-tokens.ts +77 -0
- package/src/styles.css +178 -0
package/README.md
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
# @echothink-ui/layout
|
|
2
|
+
|
|
3
|
+
Layout-template library for EchoThink UI. Build any frontend as **layout
|
|
4
|
+
template + pages of components**, with the _look_ selected by a style preset.
|
|
5
|
+
|
|
6
|
+
Templates and region parts read **only** the Tier-2 contract tokens (see
|
|
7
|
+
`TOKEN_CONTRACT.md`) plus a small set of layout-owned region/breakpoint tokens.
|
|
8
|
+
Switching the preset restyles every template without touching its markup.
|
|
9
|
+
|
|
10
|
+
## The three orthogonal axes
|
|
11
|
+
|
|
12
|
+
`StyleScope` (re-exported here) applies all three to a subtree:
|
|
13
|
+
|
|
14
|
+
| Axis | Prop | Values | Drives |
|
|
15
|
+
| ------------- | ----------- | --------------------------------------------- | --------------------------------------------------------- |
|
|
16
|
+
| **preset** | `preset` | `ethStylePresets` (e.g. `carbon`, `glass`, …) | colors, surfaces, borders, radius, shadows, glass effects |
|
|
17
|
+
| **density** | `density` | `compact` \| `standard` \| `comfortable` | the `--eth-space-*` spacing scale |
|
|
18
|
+
| **typeScale** | `typeScale` | `compact` \| `standard` \| `large` | the `--eth-text-scale` typography multiplier |
|
|
19
|
+
|
|
20
|
+
```tsx
|
|
21
|
+
import { StyleScope, AppShell, PageHeader } from "@echothink-ui/layout";
|
|
22
|
+
import "@echothink-ui/layout/styles.css";
|
|
23
|
+
|
|
24
|
+
<StyleScope preset="glass" density="comfortable" typeScale="large">
|
|
25
|
+
<AppShell topbar={<TopBar />} nav={<Nav />} footer={<Footer />}>
|
|
26
|
+
<PageHeader title="Overview" description="…" />
|
|
27
|
+
{/* pages of components */}
|
|
28
|
+
</AppShell>
|
|
29
|
+
</StyleScope>;
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## Templates
|
|
33
|
+
|
|
34
|
+
| Component | Slots / props | Use |
|
|
35
|
+
| ------------------ | ---------------------------------------------------------- | -------------------------------------------------------- |
|
|
36
|
+
| `AppShell` | `topbar`, `nav`, `aside`, `footer`, `children`, `navWidth` | default product frame; nav collapses under `--eth-bp-lg` |
|
|
37
|
+
| `DashboardLayout` | `children`, `minColumn` | responsive auto-fit grid of regions |
|
|
38
|
+
| `ListDetailLayout` | `list`, `detail`, `listWidth`, `detailEmpty` | master-detail; stacks under `--eth-bp-md` |
|
|
39
|
+
| `SplitPaneLayout` | `primary`, `secondary`, `ratio`, `orientation` | editors, tools |
|
|
40
|
+
| `SettingsLayout` | `nav`, `children`, `navWidth` | two-pane settings |
|
|
41
|
+
| `CenteredLayout` | `children`, `maxWidth` | auth / empty / error |
|
|
42
|
+
| `CanvasLayout` | `stage`, `panels`, `toolbar` | full-bleed canvas + floating panels |
|
|
43
|
+
|
|
44
|
+
## Region parts
|
|
45
|
+
|
|
46
|
+
`PageHeader` (`title`, `description`, `actions`, `breadcrumbs`), `Toolbar`
|
|
47
|
+
(`start`, `end`, `children`), `Breadcrumbs` (`items: {label, href?}[]`).
|
|
48
|
+
|
|
49
|
+
## Breakpoint contract
|
|
50
|
+
|
|
51
|
+
`--eth-bp-sm` 36rem · `--eth-bp-md` 48rem · `--eth-bp-lg` 64rem · `--eth-bp-xl`
|
|
52
|
+
80rem. Exposed to JS as `ethBreakpoints` (CSS media queries can't read custom
|
|
53
|
+
properties, so the literal `rem` values are mirrored in the stylesheet).
|
|
54
|
+
|
|
55
|
+
## Region tokens
|
|
56
|
+
|
|
57
|
+
Layout owns these chrome tokens; they default to contract tokens so a preset
|
|
58
|
+
still drives them, but they can be themed independently:
|
|
59
|
+
`--eth-region-topbar-bg`, `--eth-region-topbar-color`,
|
|
60
|
+
`--eth-region-sidebar-bg`, `--eth-region-canvas-bg`.
|
|
61
|
+
|
|
62
|
+
## Preview utilities
|
|
63
|
+
|
|
64
|
+
`StylePresetPicker`, `StylePresetLayout`, `ComponentPreviewLayout` are
|
|
65
|
+
docs/preview helpers. `StylePresetLayout` and `ComponentPreviewLayout` accept
|
|
66
|
+
`density` and `typeScale` and forward them to `StyleScope`.
|
|
67
|
+
|
|
68
|
+
## Page Template Preview
|
|
69
|
+
|
|
70
|
+
Run the layout preview from the pnpm workspace root
|
|
71
|
+
`/Users/wangqihang/wkspace/echothink-UI/echothink-UI-components`, which includes
|
|
72
|
+
`../echothink-UI-layout`:
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
pnpm --filter @echothink-ui/layout dev:preview
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
Or run it from anywhere with:
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
pnpm --dir /Users/wangqihang/wkspace/echothink-UI/echothink-UI-components --filter @echothink-ui/layout dev:preview
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
Then open the printed local URL, for example `http://127.0.0.1:5174/`.
|
|
85
|
+
The preview reads `pageTemplateCatalog` and lets you browse every registered
|
|
86
|
+
template. You can link directly to one template with a hash, for example:
|
|
87
|
+
|
|
88
|
+
```text
|
|
89
|
+
http://127.0.0.1:5174/#glass-flowchart
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
Current generated preview screenshots live in `snapshots/`.
|