@cruxjs/base 0.1.4 → 0.1.5

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 CHANGED
@@ -8,7 +8,7 @@
8
8
  </div>
9
9
 
10
10
  <div align="center">
11
- <img src="https://img.shields.io/badge/v-0.1.4-black"/>
11
+ <img src="https://img.shields.io/badge/v-0.1.5-black"/>
12
12
  <img src="https://img.shields.io/badge/🔥-@cruxjs-black"/>
13
13
  <br>
14
14
  <img src="https://img.shields.io/github/issues/cruxjs-org/base?style=flat" alt="Github Repo Issues" />
package/dist/index.d.cts CHANGED
@@ -1,5 +1,7 @@
1
1
  import { TableSchema as TableSchema$1, DB } from '@minejs/db';
2
2
  import { AppContext as AppContext$1 } from '@minejs/server';
3
+ import { I18nConfig } from '@minejs/i18n';
4
+ import { JSXElement } from '@minejs/jsx';
3
5
  import { Logger } from '@minejs/logger';
4
6
 
5
7
  type AppContext = AppContext$1;
@@ -140,6 +142,54 @@ interface AppInstance {
140
142
  getContext(): LifecycleContext;
141
143
  getMiddleware(name: string): AppMiddleware | undefined;
142
144
  }
145
+ type RouteComponent = () => JSXElement | null;
146
+ interface ThemeConfig {
147
+ default: string;
148
+ available: string[];
149
+ }
150
+ type LangConfig = I18nConfig;
151
+ /**
152
+ * Client-side extension system
153
+ * Extensions can hook into lifecycle phases to extend functionality
154
+ * (logging, analytics, error handling, etc.)
155
+ */
156
+ interface ClientExtension {
157
+ name: string;
158
+ config?: Record<string, unknown>;
159
+ onBoot?: (context: ExtensionContext) => void | Promise<void>;
160
+ onReady?: (context: ExtensionContext) => void | Promise<void>;
161
+ onDestroy?: (context: ExtensionContext) => void | Promise<void>;
162
+ }
163
+ /**
164
+ * Context passed to extension lifecycle hooks
165
+ */
166
+ interface ExtensionContext {
167
+ debug: boolean;
168
+ config: Record<string, unknown>;
169
+ cconfig: ClientManagerConfig;
170
+ }
171
+ /**
172
+ * Lifecycle hooks for the client application
173
+ */
174
+ interface ClientManagerHooks {
175
+ onBoot?: () => void | Promise<void>;
176
+ onReady?: () => void | Promise<void>;
177
+ onDestroy?: () => void | Promise<void>;
178
+ }
179
+ /**
180
+ * Client Manager Configuration
181
+ * Declarative configuration pattern mirroring @cruxjs/app AppConfig
182
+ */
183
+ interface ClientManagerConfig {
184
+ routes: Record<string, RouteComponent>;
185
+ notFoundComponent?: RouteComponent;
186
+ rootLayout?: () => JSXElement | null;
187
+ debug?: boolean;
188
+ lifecycle?: ClientManagerHooks;
189
+ extensions?: ClientExtension[];
190
+ i18n?: I18nConfig;
191
+ theme?: ThemeConfig;
192
+ }
143
193
 
144
194
  declare const logger: Logger;
145
195
 
@@ -164,4 +214,4 @@ declare class PluginRegistry {
164
214
  collectStatic(): StaticConfig[];
165
215
  }
166
216
 
167
- export { type AppConfig, type AppContext, type AppInstance, type AppMiddleware, type CruxPlugin, type LifecycleContext, type LifecycleHooks, type MiddlewareExport, PluginRegistry, ResourceMerger, type RouteDefinition, type StaticConfig, type TableSchema, logger };
217
+ export { type AppConfig, type AppContext, type AppInstance, type AppMiddleware, type ClientExtension, type ClientManagerConfig, type ClientManagerHooks, type CruxPlugin, type ExtensionContext, type LangConfig, type LifecycleContext, type LifecycleHooks, type MiddlewareExport, PluginRegistry, ResourceMerger, type RouteComponent, type RouteDefinition, type StaticConfig, type TableSchema, type ThemeConfig, logger };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,7 @@
1
1
  import { TableSchema as TableSchema$1, DB } from '@minejs/db';
2
2
  import { AppContext as AppContext$1 } from '@minejs/server';
3
+ import { I18nConfig } from '@minejs/i18n';
4
+ import { JSXElement } from '@minejs/jsx';
3
5
  import { Logger } from '@minejs/logger';
4
6
 
5
7
  type AppContext = AppContext$1;
@@ -140,6 +142,54 @@ interface AppInstance {
140
142
  getContext(): LifecycleContext;
141
143
  getMiddleware(name: string): AppMiddleware | undefined;
142
144
  }
145
+ type RouteComponent = () => JSXElement | null;
146
+ interface ThemeConfig {
147
+ default: string;
148
+ available: string[];
149
+ }
150
+ type LangConfig = I18nConfig;
151
+ /**
152
+ * Client-side extension system
153
+ * Extensions can hook into lifecycle phases to extend functionality
154
+ * (logging, analytics, error handling, etc.)
155
+ */
156
+ interface ClientExtension {
157
+ name: string;
158
+ config?: Record<string, unknown>;
159
+ onBoot?: (context: ExtensionContext) => void | Promise<void>;
160
+ onReady?: (context: ExtensionContext) => void | Promise<void>;
161
+ onDestroy?: (context: ExtensionContext) => void | Promise<void>;
162
+ }
163
+ /**
164
+ * Context passed to extension lifecycle hooks
165
+ */
166
+ interface ExtensionContext {
167
+ debug: boolean;
168
+ config: Record<string, unknown>;
169
+ cconfig: ClientManagerConfig;
170
+ }
171
+ /**
172
+ * Lifecycle hooks for the client application
173
+ */
174
+ interface ClientManagerHooks {
175
+ onBoot?: () => void | Promise<void>;
176
+ onReady?: () => void | Promise<void>;
177
+ onDestroy?: () => void | Promise<void>;
178
+ }
179
+ /**
180
+ * Client Manager Configuration
181
+ * Declarative configuration pattern mirroring @cruxjs/app AppConfig
182
+ */
183
+ interface ClientManagerConfig {
184
+ routes: Record<string, RouteComponent>;
185
+ notFoundComponent?: RouteComponent;
186
+ rootLayout?: () => JSXElement | null;
187
+ debug?: boolean;
188
+ lifecycle?: ClientManagerHooks;
189
+ extensions?: ClientExtension[];
190
+ i18n?: I18nConfig;
191
+ theme?: ThemeConfig;
192
+ }
143
193
 
144
194
  declare const logger: Logger;
145
195
 
@@ -164,4 +214,4 @@ declare class PluginRegistry {
164
214
  collectStatic(): StaticConfig[];
165
215
  }
166
216
 
167
- export { type AppConfig, type AppContext, type AppInstance, type AppMiddleware, type CruxPlugin, type LifecycleContext, type LifecycleHooks, type MiddlewareExport, PluginRegistry, ResourceMerger, type RouteDefinition, type StaticConfig, type TableSchema, logger };
217
+ export { type AppConfig, type AppContext, type AppInstance, type AppMiddleware, type ClientExtension, type ClientManagerConfig, type ClientManagerHooks, type CruxPlugin, type ExtensionContext, type LangConfig, type LifecycleContext, type LifecycleHooks, type MiddlewareExport, PluginRegistry, ResourceMerger, type RouteComponent, type RouteDefinition, type StaticConfig, type TableSchema, type ThemeConfig, logger };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cruxjs/base",
3
- "version": "0.1.4",
3
+ "version": "0.1.5",
4
4
  "description": "Core types and utilities for building CruxJS applications and plugins. A shared foundation for @cruxjs/app and plugin packages.",
5
5
  "keywords": ["cruxjs", "base", "types"],
6
6
  "license": "MIT",
@@ -40,12 +40,14 @@
40
40
  "bun": "^1.3.3"
41
41
  },
42
42
  "dependencies": {
43
- "@minejs/db": "^0.0.3",
44
- "@minejs/logger": "^0.0.2",
45
- "@minejs/server": "^0.1.4"
43
+ "@minejs/logger": "^0.0.2"
46
44
  },
47
45
  "devDependencies": {
48
46
  "@eslint/js": "^9.39.2",
47
+ "@minejs/db": "^0.0.3",
48
+ "@minejs/i18n": "^0.1.3",
49
+ "@minejs/jsx": "^0.0.9",
50
+ "@minejs/server": "^0.1.4",
49
51
  "@stylistic/eslint-plugin": "^5.7.0",
50
52
  "@types/bun": "^1.3.6",
51
53
  "@types/node": "^20.19.29",