@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.
Files changed (67) hide show
  1. package/README.md +71 -68
  2. package/dist/custom-elements.json +1039 -0
  3. package/dist/index.d.ts +8 -6
  4. package/dist/index.d.ts.map +1 -1
  5. package/dist/index.js +6 -6
  6. package/dist/index.js.map +1 -1
  7. package/dist/register.d.ts +5 -5
  8. package/dist/register.d.ts.map +1 -1
  9. package/dist/register.js +5 -5
  10. package/dist/register.js.map +1 -1
  11. package/dist/src/internal/light-dom-slot-controller.d.ts +22 -0
  12. package/dist/src/internal/light-dom-slot-controller.d.ts.map +1 -0
  13. package/dist/src/internal/light-dom-slot-controller.js +91 -0
  14. package/dist/src/internal/light-dom-slot-controller.js.map +1 -0
  15. package/dist/src/internal/router.d.ts +36 -0
  16. package/dist/src/internal/router.d.ts.map +1 -0
  17. package/dist/{router.js → src/internal/router.js} +26 -19
  18. package/dist/src/internal/router.js.map +1 -0
  19. package/dist/src/structures/uik-shell-activity-bar-contract.d.ts +10 -0
  20. package/dist/src/structures/uik-shell-activity-bar-contract.d.ts.map +1 -0
  21. package/dist/src/structures/uik-shell-activity-bar-contract.js +2 -0
  22. package/dist/src/structures/uik-shell-activity-bar-contract.js.map +1 -0
  23. package/dist/src/structures/uik-shell-activity-bar.d.ts +30 -0
  24. package/dist/src/structures/uik-shell-activity-bar.d.ts.map +1 -0
  25. package/dist/src/structures/uik-shell-activity-bar.js +272 -0
  26. package/dist/src/structures/uik-shell-activity-bar.js.map +1 -0
  27. package/dist/src/structures/uik-shell-layout.d.ts +16 -0
  28. package/dist/src/structures/uik-shell-layout.d.ts.map +1 -0
  29. package/dist/src/structures/uik-shell-layout.js +123 -0
  30. package/dist/src/structures/uik-shell-layout.js.map +1 -0
  31. package/dist/src/structures/uik-shell-secondary-sidebar.d.ts +21 -0
  32. package/dist/src/structures/uik-shell-secondary-sidebar.d.ts.map +1 -0
  33. package/dist/src/structures/uik-shell-secondary-sidebar.js +169 -0
  34. package/dist/src/structures/uik-shell-secondary-sidebar.js.map +1 -0
  35. package/dist/src/structures/uik-shell-sidebar.d.ts +21 -0
  36. package/dist/src/structures/uik-shell-sidebar.d.ts.map +1 -0
  37. package/dist/src/structures/uik-shell-sidebar.js +176 -0
  38. package/dist/src/structures/uik-shell-sidebar.js.map +1 -0
  39. package/dist/src/structures/uik-shell-status-bar.d.ts +23 -0
  40. package/dist/src/structures/uik-shell-status-bar.d.ts.map +1 -0
  41. package/dist/src/structures/uik-shell-status-bar.js +144 -0
  42. package/dist/src/structures/uik-shell-status-bar.js.map +1 -0
  43. package/package.json +31 -27
  44. package/dist/ActivityBar.d.ts +0 -25
  45. package/dist/ActivityBar.d.ts.map +0 -1
  46. package/dist/ActivityBar.js +0 -81
  47. package/dist/ActivityBar.js.map +0 -1
  48. package/dist/AppShellLayout.d.ts +0 -17
  49. package/dist/AppShellLayout.d.ts.map +0 -1
  50. package/dist/AppShellLayout.js +0 -66
  51. package/dist/AppShellLayout.js.map +0 -1
  52. package/dist/SecondarySidebar.d.ts +0 -18
  53. package/dist/SecondarySidebar.d.ts.map +0 -1
  54. package/dist/SecondarySidebar.js +0 -84
  55. package/dist/SecondarySidebar.js.map +0 -1
  56. package/dist/Sidebar.d.ts +0 -20
  57. package/dist/Sidebar.d.ts.map +0 -1
  58. package/dist/Sidebar.js +0 -105
  59. package/dist/Sidebar.js.map +0 -1
  60. package/dist/Statusbar.d.ts +0 -19
  61. package/dist/Statusbar.d.ts.map +0 -1
  62. package/dist/Statusbar.js +0 -73
  63. package/dist/Statusbar.js.map +0 -1
  64. package/dist/router.d.ts +0 -36
  65. package/dist/router.d.ts.map +0 -1
  66. package/dist/router.js.map +0 -1
  67. package/dist/tailwind-source.css +0 -2
package/README.md CHANGED
@@ -1,19 +1,13 @@
1
1
  # @ismail-elkorchi/ui-shell
2
2
 
3
- Tailwind-friendly shell components (activity bar, sidebars, status bar, and an optional frame layout) for Light DOM layouts. They render Tailwind utility classes, depend on `@ismail-elkorchi/ui-primitives` for controls, and stay framework-agnostic.
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). They do not rely on Tailwind utility injection to style the internals of primitives (no `class="text-red-500"` on a `uik-button`).
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 {ActivityBarItem} from '@ismail-elkorchi/ui-shell/activity-bar';
18
+ import type {UikShellActivityBarItem} from '@ismail-elkorchi/ui-shell/activity-bar';
25
19
 
26
- const activityItems: ActivityBarItem[] = [
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
- .activityBar=${html`
38
- <uik-shell-activity-bar
39
- .items=${activityItems}
40
- .activeId=${'explorer'}
41
- @activity-select=${(e: CustomEvent<{id: string}>) => console.log(e.detail.id)}>
42
- </uik-shell-activity-bar>
43
- `}
44
- .primarySidebar=${html`
45
- <uik-shell-sidebar
46
- heading="Explorer"
47
- .actions=${html`<uik-button variant="ghost" size="icon">…</uik-button>`}
48
- .body=${html`<!-- put your file tree or filters here -->`}>
49
- </uik-shell-sidebar>
50
- `}
51
- .mainContent=${html`<main class="flex-1">Your editor or tabs</main>`}
52
- .secondarySidebar=${html`
53
- <uik-shell-secondary-sidebar
54
- .open=${true}
55
- heading="AI Assistant"
56
- .body=${html`<p class="text-sm text-muted-foreground">Auxiliary tools live here.</p>`}
57
- @secondary-close=${() => console.log('close secondary')}></uik-shell-secondary-sidebar>
58
- `}
59
- .statusBar=${html`
60
- <uik-shell-statusbar message="Ready" tone="info" .meta=${'3 files selected'}></uik-shell-statusbar>
61
- `}
62
- ?showSecondary=${true}>
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`: accepts `.items` (id/label/icon/path) and emits `activity-select`.
70
- - `uik-shell-sidebar`: header/heading with `.actions`, `.body`, and optional `.footer`; `paddedBody`/`scrollBody` toggle spacing and scroll.
71
- - `uik-shell-secondary-sidebar`: controlled via `.open`; emits `secondary-close` when the close button is clicked.
72
- - `uik-shell-statusbar`: `.message` + `.tone` colorizes the left side; `.meta` renders on the right (string becomes an outline badge).
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/tabs.
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 {createAppShellRouter, APP_SHELL_NAV_EVENT, type AppShellNavigationDetail} from '@ismail-elkorchi/ui-shell/router';
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 = createAppShellRouter({routes, initialView: 'explorer', initialSubview: 'code'});
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
- .activeTab=${shellRouter.current.subview ?? 'code'}
104
- @tab-change=${(e: CustomEvent<{tab: string}>) => shellRouter.navigate(shellRouter.current.view, e.detail.tab)}>
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(APP_SHELL_NAV_EVENT, (event: Event) => {
110
- const detail = (event as CustomEvent<AppShellNavigationDetail>).detail;
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.