@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.
Files changed (71) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +121 -52
  3. package/dist/hooks/index.d.ts +1 -10
  4. package/dist/hooks/index.d.ts.map +1 -1
  5. package/dist/hooks/index.js +2 -538
  6. package/dist/hooks/index.js.map +1 -1
  7. package/dist/hooks/types.d.ts +0 -53
  8. package/dist/hooks/types.d.ts.map +1 -1
  9. package/dist/hooks/use-global-event.d.ts +0 -2
  10. package/dist/hooks/use-global-event.d.ts.map +1 -1
  11. package/dist/index.js +138 -742
  12. package/dist/index.js.map +1 -1
  13. package/dist/kernel/index.js +3 -3
  14. package/dist/kernel/index.js.map +1 -1
  15. package/dist/modules/ambient/index.js.map +1 -1
  16. package/dist/modules/background/index.js +5 -5
  17. package/dist/modules/background/index.js.map +1 -1
  18. package/dist/modules/context-menu/index.js +4 -4
  19. package/dist/modules/context-menu/index.js.map +1 -1
  20. package/dist/modules/controls/index.js +3 -3
  21. package/dist/modules/controls/index.js.map +1 -1
  22. package/dist/modules/dock/cards.d.ts +1 -1
  23. package/dist/modules/dock/hooks.d.ts +1 -1
  24. package/dist/modules/dock/index.js +3 -3
  25. package/dist/modules/dock/index.js.map +1 -1
  26. package/dist/modules/index.js +34 -115
  27. package/dist/modules/index.js.map +1 -1
  28. package/dist/modules/loading/index.js +3 -3
  29. package/dist/modules/loading/index.js.map +1 -1
  30. package/dist/modules/media/index.js.map +1 -1
  31. package/dist/modules/modal/index.js +11 -95
  32. package/dist/modules/modal/index.js.map +1 -1
  33. package/dist/modules/notification/index.js +7 -5
  34. package/dist/modules/notification/index.js.map +1 -1
  35. package/dist/provider.js.map +1 -1
  36. package/dist/utils/dom.d.ts +0 -2
  37. package/dist/utils/dom.d.ts.map +1 -1
  38. package/dist/utils/index.d.ts +5 -6
  39. package/dist/utils/index.d.ts.map +1 -1
  40. package/dist/utils/index.js +19 -84
  41. package/dist/utils/index.js.map +1 -1
  42. package/dist/utils/number.d.ts +0 -1
  43. package/dist/utils/number.d.ts.map +1 -1
  44. package/dist/utils/object.d.ts +0 -2
  45. package/dist/utils/object.d.ts.map +1 -1
  46. package/dist/utils/string.d.ts +0 -3
  47. package/dist/utils/string.d.ts.map +1 -1
  48. package/dist/utils/timing.d.ts +0 -1
  49. package/dist/utils/timing.d.ts.map +1 -1
  50. package/docs/README.md +124 -0
  51. package/docs/architecture-and-rules.md +129 -0
  52. package/docs/core-engine.md +196 -0
  53. package/docs/custom-modules.md +267 -0
  54. package/docs/getting-started.md +199 -0
  55. package/docs/modules/README.md +176 -0
  56. package/docs/modules/ambient.md +150 -0
  57. package/docs/modules/background.md +195 -0
  58. package/docs/modules/context-menu.md +248 -0
  59. package/docs/modules/controls.md +159 -0
  60. package/docs/modules/dock.md +734 -0
  61. package/docs/modules/error-boundary.md +160 -0
  62. package/docs/modules/kernel.md +266 -0
  63. package/docs/modules/loading.md +157 -0
  64. package/docs/modules/media.md +196 -0
  65. package/docs/modules/modal.md +229 -0
  66. package/docs/modules/notification.md +161 -0
  67. package/docs/modules/result.md +135 -0
  68. package/docs/testing.md +160 -0
  69. package/docs/theming.md +185 -0
  70. package/package.json +3 -1
  71. package/templates/AGENTS.md +165 -0
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2026 Ömer Dilaver
3
+ Copyright (c) 2026 Ömer Deliavcı
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
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
  [![npm version](https://img.shields.io/npm/v/@omerdlw/base-framework.svg)](https://www.npmjs.com/package/@omerdlw/base-framework)
6
6
  [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)
7
+ [![TypeScript 5.8](https://img.shields.io/badge/TypeScript-5.8-blue.svg)](https://www.typescriptlang.org/)
8
+ [![React 19](https://img.shields.io/badge/React-19-blue.svg)](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-lightweight registry, transaction pipelines, and decoupled module lifecycle.
13
- - 🧩 **First-Party Declarative Modules:**
14
- - `dock` — Floating app-like dock with navigation, cards, and state continuity.
15
- - `modal` — Stackable, accessible modals with hardware-accelerated animations.
16
- - `notification` — Toast notifications with promise and result tracking.
17
- - `ambient` — Dynamic background and color extraction from media.
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. Wrap Your App with `CoreProvider`
65
+ ### 1. Configure Providers in Your Next.js App
40
66
 
41
- In your `app/providers.tsx` (Client Component):
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
- const modules = [dockModule, modalModule, notificationModule];
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
- <CoreProvider modules={modules}>
56
- {children}
57
- </CoreProvider>
102
+ <html lang="en">
103
+ <body>
104
+ <Providers>{children}</Providers>
105
+ </body>
106
+ </html>
58
107
  );
59
108
  }
60
109
  ```
61
110
 
62
- ### 2. Configure Route State with `usePage`
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 MyPage() {
72
- usePage({
129
+ export default function DashboardPage() {
130
+ const page = usePage({
131
+ title: "Analytics Dashboard",
73
132
  dock: {
74
- title: "Dashboard",
133
+ description: "Live system metrics and user activity",
75
134
  icon: "solar:widget-bold",
76
135
  },
77
- loading: {
78
- isLoading: false,
136
+ background: {
137
+ image: "/media/dashboard-bg.webp",
138
+ overlay: true,
79
139
  },
140
+ loading: false,
80
141
  });
81
142
 
82
- return <main>Page Content</main>;
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
- ### 3. Tailwind CSS v4 Integration
87
-
88
- If you use Tailwind CSS v4, include the package in your `@source` scanning inside `globals.css`:
157
+ ---
89
158
 
90
- ```css
91
- @import "tailwindcss";
92
- @source "../node_modules/@omerdlw/base-framework";
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
- ## 📚 Subpath Exports
98
-
99
- | Export Path | Purpose |
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 Dilavever](https://github.com/omerdlw)
186
+ MIT © [Ömer Deliavcı](https://github.com/omerdlw)
@@ -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 { useDebounce } from "./use-debounce";
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,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAChE,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AACvD,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnE,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EACL,eAAe,EACf,eAAe,EACf,iBAAiB,GAClB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AACtE,OAAO,EAAE,0BAA0B,EAAE,MAAM,wBAAwB,CAAC;AAEpE,mBAAmB,SAAS,CAAC"}
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"}