@ismail-elkorchi/ui-shell 0.1.0 → 0.1.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/README.md +71 -68
- package/dist/custom-elements.json +1039 -0
- package/dist/index.d.ts +8 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -6
- package/dist/index.js.map +1 -1
- package/dist/register.d.ts +5 -5
- package/dist/register.d.ts.map +1 -1
- package/dist/register.js +5 -5
- package/dist/register.js.map +1 -1
- package/dist/src/internal/light-dom-slot-controller.d.ts +22 -0
- package/dist/src/internal/light-dom-slot-controller.d.ts.map +1 -0
- package/dist/src/internal/light-dom-slot-controller.js +91 -0
- package/dist/src/internal/light-dom-slot-controller.js.map +1 -0
- package/dist/src/internal/router.d.ts +36 -0
- package/dist/src/internal/router.d.ts.map +1 -0
- package/dist/{router.js → src/internal/router.js} +26 -19
- package/dist/src/internal/router.js.map +1 -0
- package/dist/src/structures/uik-shell-activity-bar-contract.d.ts +10 -0
- package/dist/src/structures/uik-shell-activity-bar-contract.d.ts.map +1 -0
- package/dist/src/structures/uik-shell-activity-bar-contract.js +2 -0
- package/dist/src/structures/uik-shell-activity-bar-contract.js.map +1 -0
- package/dist/src/structures/uik-shell-activity-bar.d.ts +30 -0
- package/dist/src/structures/uik-shell-activity-bar.d.ts.map +1 -0
- package/dist/src/structures/uik-shell-activity-bar.js +272 -0
- package/dist/src/structures/uik-shell-activity-bar.js.map +1 -0
- package/dist/src/structures/uik-shell-layout.d.ts +16 -0
- package/dist/src/structures/uik-shell-layout.d.ts.map +1 -0
- package/dist/src/structures/uik-shell-layout.js +123 -0
- package/dist/src/structures/uik-shell-layout.js.map +1 -0
- package/dist/src/structures/uik-shell-secondary-sidebar.d.ts +21 -0
- package/dist/src/structures/uik-shell-secondary-sidebar.d.ts.map +1 -0
- package/dist/src/structures/uik-shell-secondary-sidebar.js +169 -0
- package/dist/src/structures/uik-shell-secondary-sidebar.js.map +1 -0
- package/dist/src/structures/uik-shell-sidebar.d.ts +21 -0
- package/dist/src/structures/uik-shell-sidebar.d.ts.map +1 -0
- package/dist/src/structures/uik-shell-sidebar.js +176 -0
- package/dist/src/structures/uik-shell-sidebar.js.map +1 -0
- package/dist/src/structures/uik-shell-status-bar.d.ts +23 -0
- package/dist/src/structures/uik-shell-status-bar.d.ts.map +1 -0
- package/dist/src/structures/uik-shell-status-bar.js +144 -0
- package/dist/src/structures/uik-shell-status-bar.js.map +1 -0
- package/package.json +31 -27
- package/dist/ActivityBar.d.ts +0 -25
- package/dist/ActivityBar.d.ts.map +0 -1
- package/dist/ActivityBar.js +0 -81
- package/dist/ActivityBar.js.map +0 -1
- package/dist/AppShellLayout.d.ts +0 -17
- package/dist/AppShellLayout.d.ts.map +0 -1
- package/dist/AppShellLayout.js +0 -66
- package/dist/AppShellLayout.js.map +0 -1
- package/dist/SecondarySidebar.d.ts +0 -18
- package/dist/SecondarySidebar.d.ts.map +0 -1
- package/dist/SecondarySidebar.js +0 -84
- package/dist/SecondarySidebar.js.map +0 -1
- package/dist/Sidebar.d.ts +0 -20
- package/dist/Sidebar.d.ts.map +0 -1
- package/dist/Sidebar.js +0 -105
- package/dist/Sidebar.js.map +0 -1
- package/dist/Statusbar.d.ts +0 -19
- package/dist/Statusbar.d.ts.map +0 -1
- package/dist/Statusbar.js +0 -73
- package/dist/Statusbar.js.map +0 -1
- package/dist/router.d.ts +0 -36
- package/dist/router.d.ts.map +0 -1
- package/dist/router.js.map +0 -1
- package/dist/tailwind-source.css +0 -2
package/README.md
CHANGED
|
@@ -1,19 +1,13 @@
|
|
|
1
1
|
# @ismail-elkorchi/ui-shell
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
## Build & distribution
|
|
6
|
-
|
|
7
|
-
- `npm run build` emits ESM + `.d.ts` modules into `dist/` for `index/register/router`, layout, activity bar, sidebar, secondary sidebar, and status bar.
|
|
8
|
-
- Tailwind scanning helper ships as `dist/tailwind-source.css`.
|
|
9
|
-
- Published output contains only `dist/` plus this README; TypeScript sources stay in the workspace.
|
|
3
|
+
Token-driven shell components (activity bar, sidebars, status bar, and an optional frame layout) for Light DOM composition. They depend on `@ismail-elkorchi/ui-primitives` for controls, expose slots + parts, and read all visual values from `@ismail-elkorchi/ui-tokens` CSS variables.
|
|
10
4
|
|
|
11
5
|
## Layout layer
|
|
12
6
|
|
|
13
7
|
- Regions: left rail (`activity-bar`), primary sidebar, main content, optional secondary sidebar, and status bar.
|
|
14
8
|
- `uik-shell-layout` stitches the regions together and tags them with `data-region` attributes to keep the layout contract visible in the DOM.
|
|
15
9
|
- Shell components expose only UI surface/state; business logic should live in the host app.
|
|
16
|
-
- **Contract**: Shell components use `ui-primitives` strictly via their public API (attributes/props).
|
|
10
|
+
- **Contract**: Shell components use `ui-primitives` strictly via their public API (attributes/props). Visual styling comes from `--uik-*` custom properties (no framework utility classes).
|
|
17
11
|
|
|
18
12
|
## Using the components
|
|
19
13
|
|
|
@@ -21,9 +15,9 @@ Tailwind-friendly shell components (activity bar, sidebars, status bar, and an o
|
|
|
21
15
|
import {html} from 'lit';
|
|
22
16
|
import '@ismail-elkorchi/ui-primitives/register';
|
|
23
17
|
import '@ismail-elkorchi/ui-shell/register';
|
|
24
|
-
import type {
|
|
18
|
+
import type {UikShellActivityBarItem} from '@ismail-elkorchi/ui-shell/activity-bar';
|
|
25
19
|
|
|
26
|
-
const activityItems:
|
|
20
|
+
const activityItems: UikShellActivityBarItem[] = [
|
|
27
21
|
{
|
|
28
22
|
id: 'explorer',
|
|
29
23
|
label: 'Explorer',
|
|
@@ -33,50 +27,77 @@ const activityItems: ActivityBarItem[] = [
|
|
|
33
27
|
];
|
|
34
28
|
|
|
35
29
|
html`
|
|
36
|
-
<uik-shell-layout
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
<uik-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
30
|
+
<uik-shell-layout ?isSecondarySidebarVisible=${true}>
|
|
31
|
+
<uik-shell-activity-bar
|
|
32
|
+
slot="activity-bar"
|
|
33
|
+
.items=${activityItems}
|
|
34
|
+
.activeId=${'explorer'}
|
|
35
|
+
@activity-bar-select=${(e: CustomEvent<{id: string}>) => console.log(e.detail.id)}>
|
|
36
|
+
</uik-shell-activity-bar>
|
|
37
|
+
<uik-shell-sidebar slot="primary-sidebar" heading="Explorer">
|
|
38
|
+
<uik-button slot="actions" variant="ghost" size="icon">…</uik-button>
|
|
39
|
+
<div style="font-size: var(--uik-typography-font-size-2);">
|
|
40
|
+
<!-- put your tree view or navigation here -->
|
|
41
|
+
</div>
|
|
42
|
+
</uik-shell-sidebar>
|
|
43
|
+
<main slot="main-content" style="flex: 1 1 auto; min-height: var(--uik-space-0);">
|
|
44
|
+
Your editor or subviews
|
|
45
|
+
</main>
|
|
46
|
+
<uik-shell-secondary-sidebar
|
|
47
|
+
slot="secondary-sidebar"
|
|
48
|
+
.isOpen=${true}
|
|
49
|
+
heading="AI Assistant"
|
|
50
|
+
@secondary-sidebar-close=${() => console.log('close secondary')}>
|
|
51
|
+
<p
|
|
52
|
+
style="
|
|
53
|
+
font-size: var(--uik-typography-font-size-2);
|
|
54
|
+
color: oklch(var(--uik-text-muted));
|
|
55
|
+
">
|
|
56
|
+
Auxiliary tools live here.
|
|
57
|
+
</p>
|
|
58
|
+
</uik-shell-secondary-sidebar>
|
|
59
|
+
<uik-shell-status-bar slot="status-bar" message="Ready" tone="info" meta="3 files selected"></uik-shell-status-bar>
|
|
63
60
|
</uik-shell-layout>
|
|
64
61
|
`;
|
|
65
62
|
```
|
|
66
63
|
|
|
67
64
|
### Component notes
|
|
68
65
|
|
|
69
|
-
- `uik-shell-activity-bar
|
|
70
|
-
- `uik-shell-
|
|
71
|
-
- `uik-shell-
|
|
72
|
-
- `uik-shell-
|
|
66
|
+
- `uik-shell-layout`: named slots `activity-bar`, `primary-sidebar`, `main-content`, `secondary-sidebar`, `status-bar`.
|
|
67
|
+
- `uik-shell-activity-bar`: accepts `.items` (id/label/icon/path) and emits `activity-bar-select`; optional `footer` slot; roving focus with Arrow keys/Home/End and Enter/Space activation (set `aria-label` if you need a custom name).
|
|
68
|
+
- `uik-shell-sidebar`: `slot="actions"` for header actions, default slot for body, optional `slot="footer"`; `isBodyPadded`/`isBodyScrollable` toggle spacing + scroll.
|
|
69
|
+
- `uik-shell-secondary-sidebar`: controlled via `.isOpen`; default slot for body, optional `slot="footer"`; emits `secondary-sidebar-close` on close.
|
|
70
|
+
- `uik-shell-status-bar`: `.message` + `.tone` colorize the left side; `meta` string (outline badge) or `slot="meta"` for custom content; optional `slot="actions"`.
|
|
71
|
+
- Use `@ismail-elkorchi/ui-primitives/uik-nav` or `@ismail-elkorchi/ui-primitives/uik-tree-view` for sidebar navigation content.
|
|
72
|
+
|
|
73
|
+
### Custom properties
|
|
74
|
+
|
|
75
|
+
- Activity bar: `--uik-component-shell-activity-bar-bg`, `--uik-component-shell-activity-bar-fg`, `--uik-component-shell-activity-bar-width`.
|
|
76
|
+
- Sidebar: `--uik-component-shell-sidebar-bg`, `--uik-component-shell-sidebar-fg`, `--uik-component-shell-sidebar-width`.
|
|
77
|
+
- Secondary sidebar: `--uik-component-shell-secondary-sidebar-bg`, `--uik-component-shell-secondary-sidebar-width`.
|
|
78
|
+
- Status bar: `--uik-component-shell-status-bar-bg`, `--uik-component-shell-status-bar-fg`, `--uik-component-shell-status-bar-height`.
|
|
79
|
+
- Shared: `--uik-component-shell-divider-color`, `--uik-component-shell-scrollbar-track`, `--uik-component-shell-scrollbar-thumb`.
|
|
80
|
+
|
|
81
|
+
## Tokens & theming
|
|
82
|
+
|
|
83
|
+
Load tokens once and set theme/density attributes on a shared container (often `:root`):
|
|
84
|
+
|
|
85
|
+
```css
|
|
86
|
+
@import '@ismail-elkorchi/ui-tokens/index.css';
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
```html
|
|
90
|
+
<html data-uik-theme="light" data-uik-density="comfortable">
|
|
91
|
+
...
|
|
92
|
+
</html>
|
|
93
|
+
```
|
|
73
94
|
|
|
74
95
|
## Routing store
|
|
75
96
|
|
|
76
|
-
A tiny EventTarget-based router lives in `@ismail-elkorchi/ui-shell/router`. It is framework-light, keeps state in memory (no history), and is meant for desktop flows that only need named views and optional subviews
|
|
97
|
+
A tiny EventTarget-based router lives in `@ismail-elkorchi/ui-shell/router`. It is framework-light, keeps state in memory (no history), and is meant for desktop flows that only need named views and optional subviews.
|
|
77
98
|
|
|
78
99
|
```ts
|
|
79
|
-
import {
|
|
100
|
+
import {createUikShellRouter, UIK_SHELL_NAVIGATION_EVENT, type UikShellNavigationDetail} from '@ismail-elkorchi/ui-shell/router';
|
|
80
101
|
|
|
81
102
|
const routes = [
|
|
82
103
|
{id: 'explorer', label: 'Explorer', subviews: ['code', 'prompt', 'apply'], defaultSubview: 'code'},
|
|
@@ -84,7 +105,7 @@ const routes = [
|
|
|
84
105
|
{id: 'settings', label: 'Settings'}
|
|
85
106
|
] as const;
|
|
86
107
|
|
|
87
|
-
export const shellRouter =
|
|
108
|
+
export const shellRouter = createUikShellRouter({routes, initialView: 'explorer', initialSubview: 'code'});
|
|
88
109
|
|
|
89
110
|
// React to navigation anywhere in the app
|
|
90
111
|
const unsubscribe = shellRouter.subscribe(({view, subview}) => {
|
|
@@ -96,18 +117,19 @@ html`
|
|
|
96
117
|
<uik-shell-activity-bar
|
|
97
118
|
.items=${routes.map(r => ({id: r.id, label: r.label ?? r.id}))}
|
|
98
119
|
.activeId=${shellRouter.current.view}
|
|
99
|
-
@activity-select=${(e: CustomEvent<{id: string}>) => shellRouter.navigate(e.detail.id)}>
|
|
120
|
+
@activity-bar-select=${(e: CustomEvent<{id: string}>) => shellRouter.navigate(e.detail.id)}>
|
|
100
121
|
</uik-shell-activity-bar>
|
|
101
122
|
|
|
102
123
|
<editor-area
|
|
103
|
-
.
|
|
104
|
-
@
|
|
124
|
+
.activeSubview=${shellRouter.current.subview ?? 'code'}
|
|
125
|
+
@subview-change=${(e: CustomEvent<{subview: string}>) =>
|
|
126
|
+
shellRouter.navigate(shellRouter.current.view, e.detail.subview)}>
|
|
105
127
|
</editor-area>
|
|
106
128
|
`;
|
|
107
129
|
|
|
108
130
|
// Listen to the low-level navigation event if you prefer EventTarget
|
|
109
|
-
window.addEventListener(
|
|
110
|
-
const detail = (event as CustomEvent<
|
|
131
|
+
window.addEventListener(UIK_SHELL_NAVIGATION_EVENT, (event: Event) => {
|
|
132
|
+
const detail = (event as CustomEvent<UikShellNavigationDetail>).detail;
|
|
111
133
|
console.log(detail.from, detail.to, detail.route);
|
|
112
134
|
});
|
|
113
135
|
```
|
|
@@ -115,22 +137,3 @@ window.addEventListener(APP_SHELL_NAV_EVENT, (event: Event) => {
|
|
|
115
137
|
- Routes are simple `{id, label?, subviews?, defaultSubview?}` objects.
|
|
116
138
|
- `navigate(view, subview?)` resolves subviews per route (keeping the last used subview for that route).
|
|
117
139
|
- `subscribe` immediately fires with the current location and returns an unsubscribe function.
|
|
118
|
-
|
|
119
|
-
## Tailwind v4 scanning
|
|
120
|
-
|
|
121
|
-
The package ships Tailwind class strings in TypeScript. Add the source hint before importing Tailwind:
|
|
122
|
-
|
|
123
|
-
```css
|
|
124
|
-
@import '@ismail-elkorchi/ui-tokens/index.css';
|
|
125
|
-
@import '@ismail-elkorchi/ui-shell/tailwind-source.css'; /* pulls in @source "./**/*.{ts,js}" */
|
|
126
|
-
@source "./**/*.{ts,js,html}";
|
|
127
|
-
@import 'tailwindcss';
|
|
128
|
-
```
|
|
129
|
-
|
|
130
|
-
Adjust the `@source` path to match the location of your entry CSS. Alternatively, add the line yourself:
|
|
131
|
-
|
|
132
|
-
```css
|
|
133
|
-
@source "../../node_modules/@ismail-elkorchi/ui-shell/**/*.{ts,js}";
|
|
134
|
-
```
|
|
135
|
-
|
|
136
|
-
Make sure these appear in the renderer entry CSS so Tailwind keeps the shell utilities during tree-shaking.
|