@omerdlw/base-framework 1.0.0 → 1.0.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/LICENSE +1 -1
- package/README.md +121 -52
- package/dist/hooks/index.d.ts +1 -10
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/index.js +2 -538
- package/dist/hooks/index.js.map +1 -1
- package/dist/hooks/types.d.ts +0 -53
- package/dist/hooks/types.d.ts.map +1 -1
- package/dist/hooks/use-global-event.d.ts +0 -2
- package/dist/hooks/use-global-event.d.ts.map +1 -1
- package/dist/index.js +138 -742
- package/dist/index.js.map +1 -1
- package/dist/kernel/index.js +3 -3
- package/dist/kernel/index.js.map +1 -1
- package/dist/modules/ambient/index.js.map +1 -1
- package/dist/modules/background/index.js +5 -5
- package/dist/modules/background/index.js.map +1 -1
- package/dist/modules/context-menu/index.js +4 -4
- package/dist/modules/context-menu/index.js.map +1 -1
- package/dist/modules/controls/index.js +3 -3
- package/dist/modules/controls/index.js.map +1 -1
- package/dist/modules/dock/cards.d.ts +1 -1
- package/dist/modules/dock/hooks.d.ts +1 -1
- package/dist/modules/dock/index.js +3 -3
- package/dist/modules/dock/index.js.map +1 -1
- package/dist/modules/index.js +34 -115
- package/dist/modules/index.js.map +1 -1
- package/dist/modules/loading/index.js +3 -3
- package/dist/modules/loading/index.js.map +1 -1
- package/dist/modules/media/index.js.map +1 -1
- package/dist/modules/modal/index.js +11 -95
- package/dist/modules/modal/index.js.map +1 -1
- package/dist/modules/notification/index.js +7 -5
- package/dist/modules/notification/index.js.map +1 -1
- package/dist/provider.js.map +1 -1
- package/dist/utils/dom.d.ts +0 -2
- package/dist/utils/dom.d.ts.map +1 -1
- package/dist/utils/index.d.ts +5 -6
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +19 -84
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/number.d.ts +0 -1
- package/dist/utils/number.d.ts.map +1 -1
- package/dist/utils/object.d.ts +0 -2
- package/dist/utils/object.d.ts.map +1 -1
- package/dist/utils/string.d.ts +0 -3
- package/dist/utils/string.d.ts.map +1 -1
- package/dist/utils/timing.d.ts +0 -1
- package/dist/utils/timing.d.ts.map +1 -1
- package/docs/README.md +124 -0
- package/docs/architecture-and-rules.md +129 -0
- package/docs/core-engine.md +196 -0
- package/docs/custom-modules.md +267 -0
- package/docs/getting-started.md +199 -0
- package/docs/modules/README.md +176 -0
- package/docs/modules/ambient.md +150 -0
- package/docs/modules/background.md +195 -0
- package/docs/modules/context-menu.md +248 -0
- package/docs/modules/controls.md +159 -0
- package/docs/modules/dock.md +734 -0
- package/docs/modules/error-boundary.md +160 -0
- package/docs/modules/kernel.md +266 -0
- package/docs/modules/loading.md +157 -0
- package/docs/modules/media.md +196 -0
- package/docs/modules/modal.md +229 -0
- package/docs/modules/notification.md +161 -0
- package/docs/modules/result.md +135 -0
- package/docs/testing.md +160 -0
- package/docs/theming.md +185 -0
- package/package.json +3 -1
- package/templates/AGENTS.md +165 -0
package/LICENSE
CHANGED
package/README.md
CHANGED
|
@@ -1,28 +1,52 @@
|
|
|
1
1
|
# @omerdlw/base-framework
|
|
2
2
|
|
|
3
|
-
> Microkernel orchestration engine and first-party declarative UI modules for app-like Next.js 16 (App Router) & React 19 web applications
|
|
3
|
+
> **Microkernel orchestration engine and first-party declarative UI modules for app-like Next.js 16 (App Router) & React 19 web applications.**
|
|
4
4
|
|
|
5
5
|
[](https://www.npmjs.com/package/@omerdlw/base-framework)
|
|
6
6
|
[](https://opensource.org/licenses/MIT)
|
|
7
|
+
[](https://www.typescriptlang.org/)
|
|
8
|
+
[](https://react.dev/)
|
|
9
|
+
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
## 📖 Complete Documentation Index
|
|
13
|
+
|
|
14
|
+
For in-depth architecture guides and module-by-module references, explore the [`docs/`](./docs) folder:
|
|
15
|
+
|
|
16
|
+
### General Architecture Guides
|
|
17
|
+
- 🚀 **[Getting Started & Installation](./docs/getting-started.md)** — Step-by-step setup, Tailwind CSS v4, root layout wiring
|
|
18
|
+
- 🏛️ **[System Architecture Map](./docs/README.md)** — Macro overview, task lookup table, conventions
|
|
19
|
+
- 📐 **[Architecture & 10 Rules](./docs/architecture-and-rules.md)** — Package layer hierarchy, boundaries, decision tree
|
|
20
|
+
- 🎨 **[Theming System Guide](./docs/theming.md)** — Visual customization: defineTheme, ThemeProvider, slot reference
|
|
21
|
+
- 🧩 **[Custom Module Authoring](./docs/custom-modules.md)** — Build custom declarative modules with defineModule & usePage
|
|
22
|
+
- ⚙️ **[Core Engine Deep Dive](./docs/core-engine.md)** — CoreProvider, theme engine, event bus, pure utils & stores
|
|
23
|
+
- 🧪 **[Testing Guide](./docs/testing.md)** — 520+ test suite, test harness, happy-dom, downstream testing
|
|
24
|
+
- 🤖 **[AI Agent Blueprint (`AGENTS.md`)](./templates/AGENTS.md)** — Drop-in rules for AI coding assistants
|
|
25
|
+
|
|
26
|
+
### Module & Component Reference
|
|
27
|
+
- ⚡ **[Microkernel Engine (`kernel`)](./docs/modules/kernel.md)** — `usePage()`, `defineModule()`, topological registry
|
|
28
|
+
- ⚓ **[Dock Module (`dock`)](./docs/modules/dock.md)** — Floating app chrome, cards, surfaces, flows, HUD, guards
|
|
29
|
+
- 🪟 **[Modal Module (`modal`)](./docs/modules/modal.md)** — Stackable dialogs, focus trap, smooth scroll lock
|
|
30
|
+
- 🔔 **[Notification Module (`notification`)](./docs/modules/notification.md)** — Toasts, `toast.fromResult`, auto 401 listener
|
|
31
|
+
- 🎨 **[Ambient Lighting (`ambient`)](./docs/modules/ambient.md)** — Media color extraction, OKLCH canvas glow
|
|
32
|
+
- 🖼️ **[Background Canvas (`background`)](./docs/modules/background.md)** — Multi-layer video, YouTube loop, cross-fades
|
|
33
|
+
- 🖱️ **[Context Menu (`context-menu`)](./docs/modules/context-menu.md)** — Viewport clamping, declarative menus
|
|
34
|
+
- 🎛️ **[Controls Module (`controls`)](./docs/modules/controls.md)** — Paired HUD action rails beside the dock
|
|
35
|
+
- ⏳ **[Loading & Skeleton (`loading`)](./docs/modules/loading.md)** — Coordinated loading, anti-flicker delay
|
|
36
|
+
- 🎵 **[Media Transport (`media`)](./docs/modules/media.md)** — Session sync, leader vs audible displacement
|
|
37
|
+
- 🔒 **[Result Pattern (`result`)](./docs/modules/result.md)** — Functional `Result<T, E>`, `ok()`, `err()`
|
|
38
|
+
- 🛡️ **[Error Boundary (`error-boundary`)](./docs/modules/error-boundary.md)** — Isolated boundaries, deduplicating reporter
|
|
7
39
|
|
|
8
40
|
---
|
|
9
41
|
|
|
10
42
|
## ✨ Features
|
|
11
43
|
|
|
12
|
-
- ⚡ **Microkernel Architecture:** Ultra-
|
|
13
|
-
- 🧩 **First-Party Declarative Modules:**
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
- `background` — Video, image, and interactive backgrounds with YouTube support.
|
|
19
|
-
- `context-menu` — Contextual right-click menus with scope isolation.
|
|
20
|
-
- `controls` — Route-level HUD controls.
|
|
21
|
-
- `loading` — Coordinated loading states with skeleton blocks.
|
|
22
|
-
- `media` — Synchronized media transport controller.
|
|
23
|
-
- 🔒 **Type-Safe Result & Events:** Functional error-handling (`Result<T, E>`) and type-safe decoupled pub/sub events.
|
|
24
|
-
- 🎨 **Theme Engine:** Semantic OKLCH tokens, design slots, and hardware GPU accelerated motion presets.
|
|
25
|
-
- 🛡️ **Guaranteed Context Deduplication:** Cross-bundle resilient React context registry preventing multi-chunk split issues.
|
|
44
|
+
- ⚡ **Microkernel Architecture:** Ultra-lean orchestration host with topological module dependency sorting, transactional multi-source registry, and atomic route lifecycle commits.
|
|
45
|
+
- 🧩 **First-Party Declarative UI Modules:** 9 production-tested modules (`dock`, `modal`, `notification`, `ambient`, `background`, `context-menu`, `controls`, `loading`, `media`) that communicate strictly through typed contracts without tight coupling.
|
|
46
|
+
- 🎯 **Single Route Declaration (`usePage`):** Cleanly declare titles, navigation cards, modals, loading states, and background media in a single atomic hook call.
|
|
47
|
+
- 🔒 **Type-Safe Result Pattern (`Result<T, E>`):** Functional, bulletproof error handling with `ok()`, `err()`, and direct feedback bridging via `toast.fromResult()`.
|
|
48
|
+
- 🛡️ **Cross-Bundle Context Deduplication:** Guarantees stable React Context singletons across Next.js split chunks and monorepo boundaries.
|
|
49
|
+
- 🎨 **Tailwind CSS v4 & OKLCH Ready:** GPU-accelerated motion presets (`translate3d`, `scale`) and semantic color tokens.
|
|
26
50
|
|
|
27
51
|
---
|
|
28
52
|
|
|
@@ -32,13 +56,15 @@
|
|
|
32
56
|
npm install @omerdlw/base-framework motion
|
|
33
57
|
```
|
|
34
58
|
|
|
59
|
+
Ensure peer dependencies are satisfied (`next >= 15.0.0`, `react >= 19.0.0`, `react-dom >= 19.0.0`, `motion >= 12.0.0`).
|
|
60
|
+
|
|
35
61
|
---
|
|
36
62
|
|
|
37
63
|
## 🚀 Quick Start
|
|
38
64
|
|
|
39
|
-
### 1.
|
|
65
|
+
### 1. Configure Providers in Your Next.js App
|
|
40
66
|
|
|
41
|
-
|
|
67
|
+
Create your client providers component (e.g. `src/app/providers.tsx`):
|
|
42
68
|
|
|
43
69
|
```tsx
|
|
44
70
|
"use client";
|
|
@@ -47,19 +73,51 @@ import { CoreProvider } from "@omerdlw/base-framework/provider";
|
|
|
47
73
|
import { dockModule } from "@omerdlw/base-framework/modules/dock";
|
|
48
74
|
import { modalModule } from "@omerdlw/base-framework/modules/modal";
|
|
49
75
|
import { notificationModule } from "@omerdlw/base-framework/modules/notification";
|
|
50
|
-
|
|
51
|
-
|
|
76
|
+
import { ambientModule } from "@omerdlw/base-framework/modules/ambient";
|
|
77
|
+
import { backgroundModule } from "@omerdlw/base-framework/modules/background";
|
|
78
|
+
import { loadingModule } from "@omerdlw/base-framework/modules/loading";
|
|
79
|
+
|
|
80
|
+
const modules = [
|
|
81
|
+
dockModule,
|
|
82
|
+
modalModule,
|
|
83
|
+
notificationModule,
|
|
84
|
+
ambientModule,
|
|
85
|
+
backgroundModule,
|
|
86
|
+
loadingModule,
|
|
87
|
+
];
|
|
52
88
|
|
|
53
89
|
export function Providers({ children }: { children: React.ReactNode }) {
|
|
90
|
+
return <CoreProvider modules={modules}>{children}</CoreProvider>;
|
|
91
|
+
}
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
Wrap your root `app/layout.tsx`:
|
|
95
|
+
|
|
96
|
+
```tsx
|
|
97
|
+
import { Providers } from "./providers";
|
|
98
|
+
import "./globals.css";
|
|
99
|
+
|
|
100
|
+
export default function RootLayout({ children }: { children: React.ReactNode }) {
|
|
54
101
|
return (
|
|
55
|
-
<
|
|
56
|
-
|
|
57
|
-
|
|
102
|
+
<html lang="en">
|
|
103
|
+
<body>
|
|
104
|
+
<Providers>{children}</Providers>
|
|
105
|
+
</body>
|
|
106
|
+
</html>
|
|
58
107
|
);
|
|
59
108
|
}
|
|
60
109
|
```
|
|
61
110
|
|
|
62
|
-
### 2.
|
|
111
|
+
### 2. Tailwind CSS v4 Configuration
|
|
112
|
+
|
|
113
|
+
Add the package path to your `@source` scanning inside `src/app/globals.css`:
|
|
114
|
+
|
|
115
|
+
```css
|
|
116
|
+
@import "tailwindcss";
|
|
117
|
+
@source "../node_modules/@omerdlw/base-framework";
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
### 3. Declare Route State with `usePage`
|
|
63
121
|
|
|
64
122
|
In any route client component:
|
|
65
123
|
|
|
@@ -68,50 +126,61 @@ In any route client component:
|
|
|
68
126
|
|
|
69
127
|
import { usePage } from "@omerdlw/base-framework/kernel";
|
|
70
128
|
|
|
71
|
-
export default function
|
|
72
|
-
usePage({
|
|
129
|
+
export default function DashboardPage() {
|
|
130
|
+
const page = usePage({
|
|
131
|
+
title: "Analytics Dashboard",
|
|
73
132
|
dock: {
|
|
74
|
-
|
|
133
|
+
description: "Live system metrics and user activity",
|
|
75
134
|
icon: "solar:widget-bold",
|
|
76
135
|
},
|
|
77
|
-
|
|
78
|
-
|
|
136
|
+
background: {
|
|
137
|
+
image: "/media/dashboard-bg.webp",
|
|
138
|
+
overlay: true,
|
|
79
139
|
},
|
|
140
|
+
loading: false,
|
|
80
141
|
});
|
|
81
142
|
|
|
82
|
-
return
|
|
143
|
+
return (
|
|
144
|
+
<main className="p-8">
|
|
145
|
+
<h1 className="text-3xl font-bold">Analytics</h1>
|
|
146
|
+
<button
|
|
147
|
+
onClick={() => page.modules.notification?.toast("Data refreshed!")}
|
|
148
|
+
className="mt-4 rounded bg-white px-4 py-2 font-semibold text-black"
|
|
149
|
+
>
|
|
150
|
+
Refresh
|
|
151
|
+
</button>
|
|
152
|
+
</main>
|
|
153
|
+
);
|
|
83
154
|
}
|
|
84
155
|
```
|
|
85
156
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
If you use Tailwind CSS v4, include the package in your `@source` scanning inside `globals.css`:
|
|
157
|
+
---
|
|
89
158
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
159
|
+
## 📚 Subpath Export Directory
|
|
160
|
+
|
|
161
|
+
| Subpath | Purpose & Key Exports |
|
|
162
|
+
| :---------------------------------- | :---------------------------------------------------------------- |
|
|
163
|
+
| `@omerdlw/base-framework` | Root exports of all sub-systems |
|
|
164
|
+
| `@omerdlw/base-framework/kernel` | `usePage`, `defineModule`, `definePeer`, `createContextRegistry` |
|
|
165
|
+
| `@omerdlw/base-framework/provider` | `CoreProvider` composition pipeline & `ModuleHost` |
|
|
166
|
+
| `@omerdlw/base-framework/result` | `ok()`, `err()`, `isResult()`, `type Result<T, E>` |
|
|
167
|
+
| `@omerdlw/base-framework/events` | Decoupled event bus (`globalEvents`, `EVENT_TYPES`) |
|
|
168
|
+
| `@omerdlw/base-framework/theme` | `ThemeProvider`, `useTheme`, `defineThemeSpec` |
|
|
169
|
+
| `@omerdlw/base-framework/tokens` | Motion easing, timing presets, z-index hierarchy |
|
|
170
|
+
| `@omerdlw/base-framework/atoms` | Primitive components (`Button`, `Icon`, `Spinner`, `Tooltip`) |
|
|
171
|
+
| `@omerdlw/base-framework/utils` | Pure utilities (`cn`, `report`, `createStore`, `createScheduler`) |
|
|
172
|
+
| `@omerdlw/base-framework/hooks` | Essential hooks (`useClickOutside`, `useGlobalEvent`, `useStore`) |
|
|
173
|
+
| `@omerdlw/base-framework/error` | Error boundaries and reporter sink |
|
|
174
|
+
| `@omerdlw/base-framework/modules/*` | 9 standalone modules (`dock`, `modal`, `notification`, etc.) |
|
|
94
175
|
|
|
95
176
|
---
|
|
96
177
|
|
|
97
|
-
##
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
| :--- | :--- |
|
|
101
|
-
| `@omerdlw/base-framework` | Root exports |
|
|
102
|
-
| `@omerdlw/base-framework/kernel` | Microkernel engine, registry hooks, module host |
|
|
103
|
-
| `@omerdlw/base-framework/provider` | `CoreProvider` composition pipeline |
|
|
104
|
-
| `@omerdlw/base-framework/theme` | `ThemeProvider`, `defineTheme`, `useTheme` |
|
|
105
|
-
| `@omerdlw/base-framework/tokens` | Stacking order (`Z_INDEX`), motion timing, easing |
|
|
106
|
-
| `@omerdlw/base-framework/result` | Functional `ok()`, `err()`, safe action wrappers |
|
|
107
|
-
| `@omerdlw/base-framework/events` | Decoupled event bus (`globalEvents`, `EVENT_TYPES`) |
|
|
108
|
-
| `@omerdlw/base-framework/utils` | DOM helpers, string/object helpers, store primitives |
|
|
109
|
-
| `@omerdlw/base-framework/hooks` | React utility hooks |
|
|
110
|
-
| `@omerdlw/base-framework/error` | Global and module-level error boundaries |
|
|
111
|
-
| `@omerdlw/base-framework/modules/*` | Individual domain modules (`dock`, `modal`, etc.) |
|
|
178
|
+
## 🤖 For AI Coding Assistants (Cursor, Antigravity, Claude Code)
|
|
179
|
+
|
|
180
|
+
When developing a project that consumes `@omerdlw/base-framework`, copy [`templates/AGENTS.md`](./templates/AGENTS.md) into your downstream project root as `AGENTS.md`. This gives the AI assistant instant, complete context over the framework's strict rules, boundaries, and best practices.
|
|
112
181
|
|
|
113
182
|
---
|
|
114
183
|
|
|
115
184
|
## 📄 License
|
|
116
185
|
|
|
117
|
-
MIT © [Ömer
|
|
186
|
+
MIT © [Ömer Deliavcı](https://github.com/omerdlw)
|
package/dist/hooks/index.d.ts
CHANGED
|
@@ -2,16 +2,7 @@ export { useRequiredContext } from "./use-required-context";
|
|
|
2
2
|
export { useStore } from "./use-store";
|
|
3
3
|
export { useClickOutside } from "./use-click-outside";
|
|
4
4
|
export { useIsomorphicLayoutEffect } from "./use-isomorphic-layout-effect";
|
|
5
|
-
export {
|
|
6
|
-
export { useMounted } from "./use-mounted";
|
|
7
|
-
export { useMediaQuery } from "./use-media-query";
|
|
8
|
-
export { useControllableState } from "./use-controllable-state";
|
|
9
|
-
export { useHotkey, useEscapeKey } from "./use-hotkey";
|
|
10
|
-
export { useGlobalEvent, useEventState } from "./use-global-event";
|
|
11
|
-
export { useAsyncAction } from "./use-async-action";
|
|
12
|
-
export { useServerAction } from "./use-server-action";
|
|
13
|
-
export { useStorageState, useLocalStorage, useSessionStorage, } from "./use-storage-state";
|
|
14
|
-
export { useIntersectionObserver } from "./use-intersection-observer";
|
|
5
|
+
export { useGlobalEvent } from "./use-global-event";
|
|
15
6
|
export { useIsFullscreenStateActive } from "./use-fullscreen-state";
|
|
16
7
|
export type * from "./types";
|
|
17
8
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AAC3E,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AAC3E,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,0BAA0B,EAAE,MAAM,wBAAwB,CAAC;AAEpE,mBAAmB,SAAS,CAAC"}
|