@hypen-space/web 0.4.37 → 0.4.38

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
@@ -15,7 +15,7 @@ bun add @hypen-space/core @hypen-space/web
15
15
  The simplest way to use Hypen in the browser:
16
16
 
17
17
  ```typescript
18
- import { render } from "@hypen-space/web";
18
+ import { render } from "@hypen-space/web-engine";
19
19
 
20
20
  // Auto-discovers and loads components from ./src/components
21
21
  await render("HomePage", "#app");
@@ -24,7 +24,7 @@ await render("HomePage", "#app");
24
24
  ### With Explicit Configuration
25
25
 
26
26
  ```typescript
27
- import { Hypen } from "@hypen-space/web";
27
+ import { Hypen } from "@hypen-space/web-engine";
28
28
 
29
29
  const hypen = new Hypen({
30
30
  componentsDir: "./src/components",
@@ -86,7 +86,7 @@ export default app
86
86
  ## Hypen Class API
87
87
 
88
88
  ```typescript
89
- import { Hypen } from "@hypen-space/web";
89
+ import { Hypen } from "@hypen-space/web-engine";
90
90
 
91
91
  const hypen = new Hypen({
92
92
  componentsDir: "./src/components", // Default
@@ -130,7 +130,8 @@ await hypen.unmount();
130
130
  For custom integrations:
131
131
 
132
132
  ```typescript
133
- import { Engine, app } from "@hypen-space/core";
133
+ import { app } from "@hypen-space/core";
134
+ import { Engine } from "@hypen-space/web-engine";
134
135
  import { DOMRenderer } from "@hypen-space/web";
135
136
 
136
137
  const engine = new Engine();
@@ -282,10 +283,10 @@ remote.dispatchAction("login", { user: "admin" });
282
283
 
283
284
  | Export | Description |
284
285
  |--------|-------------|
285
- | `@hypen-space/web` | Main - Hypen, render, DOMRenderer, CanvasRenderer |
286
- | `@hypen-space/web/hypen` | High-level Hypen class |
286
+ | `@hypen-space/web` | Main - DOMRenderer, CanvasRenderer, ComponentRegistry, ApplicatorRegistry |
287
287
  | `@hypen-space/web/dom` | DOM renderer and utilities |
288
288
  | `@hypen-space/web/canvas` | Canvas renderer |
289
+ | `@hypen-space/web-engine` | Hypen orchestrator, render, renderWithComponents, Engine (browser) |
289
290
 
290
291
  ## Requirements
291
292
 
package/dist/index.d.ts CHANGED
@@ -5,10 +5,10 @@
5
5
  * This entry point is WASM-free — it only contains renderers and the remote UI
6
6
  * embed component.
7
7
  *
8
- * For client-side rendering (with WASM engine), use "@hypen-space/web/client":
8
+ * For client-side rendering (with WASM engine), use "@hypen-space/web-engine":
9
9
  *
10
10
  * ```typescript
11
- * import { render } from "@hypen-space/web/client";
11
+ * import { render } from "@hypen-space/web-engine";
12
12
  * await render("Counter", "#app");
13
13
  * ```
14
14
  *
package/dist/index.js CHANGED
@@ -5,10 +5,10 @@
5
5
  * This entry point is WASM-free — it only contains renderers and the remote UI
6
6
  * embed component.
7
7
  *
8
- * For client-side rendering (with WASM engine), use "@hypen-space/web/client":
8
+ * For client-side rendering (with WASM engine), use "@hypen-space/web-engine":
9
9
  *
10
10
  * ```typescript
11
- * import { render } from "@hypen-space/web/client";
11
+ * import { render } from "@hypen-space/web-engine";
12
12
  * await render("Counter", "#app");
13
13
  * ```
14
14
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hypen-space/web",
3
- "version": "0.4.37",
3
+ "version": "0.4.38",
4
4
  "description": "Hypen web renderers - DOM and Canvas rendering for browsers",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -28,20 +28,6 @@
28
28
  "bun": "./src/canvas/index.ts",
29
29
  "import": "./dist/canvas/index.js",
30
30
  "default": "./dist/canvas/index.js"
31
- },
32
- "./client": {
33
- "types": "./dist/client.d.ts",
34
- "browser": "./dist/client.js",
35
- "bun": "./src/client.ts",
36
- "import": "./dist/client.js",
37
- "default": "./dist/client.js"
38
- },
39
- "./hypen": {
40
- "types": "./dist/hypen.d.ts",
41
- "browser": "./dist/hypen.js",
42
- "bun": "./src/hypen.ts",
43
- "import": "./dist/hypen.js",
44
- "default": "./dist/hypen.js"
45
31
  }
46
32
  },
47
33
  "files": [
@@ -56,7 +42,7 @@
56
42
  "clean": "rm -rf dist"
57
43
  },
58
44
  "dependencies": {
59
- "@hypen-space/core": "^0.4.37"
45
+ "@hypen-space/core": "^0.4.38"
60
46
  },
61
47
  "devDependencies": {
62
48
  "@types/bun": "latest",
@@ -5,7 +5,7 @@ Get started with the Hypen Canvas Renderer in 5 minutes.
5
5
  ## Installation
6
6
 
7
7
  ```bash
8
- bun add @hypen-space/core
8
+ bun add @hypen-space/core @hypen-space/web @hypen-space/web-engine
9
9
  ```
10
10
 
11
11
  ## Basic Setup
@@ -28,8 +28,9 @@ bun add @hypen-space/core
28
28
  ### 2. Create App (`app.ts`)
29
29
 
30
30
  ```typescript
31
- import { Engine, app, HypenModuleInstance } from "@hypen-space/core";
32
- import { CanvasRenderer } from "@hypen-space/core/canvas";
31
+ import { app, HypenModuleInstance } from "@hypen-space/core";
32
+ import { Engine } from "@hypen-space/web-engine";
33
+ import { CanvasRenderer } from "@hypen-space/web/canvas";
33
34
 
34
35
  // Define state
35
36
  type AppState = {
@@ -14,8 +14,9 @@ The Canvas Renderer is a complete alternative to the DOM renderer that draws all
14
14
  ## Quick Start
15
15
 
16
16
  ```typescript
17
- import { Engine, app } from "@hypen-space/core";
18
- import { CanvasRenderer } from "@hypen-space/core/canvas";
17
+ import { app } from "@hypen-space/core";
18
+ import { Engine } from "@hypen-space/web-engine";
19
+ import { CanvasRenderer } from "@hypen-space/web/canvas";
19
20
 
20
21
  // Setup canvas
21
22
  const canvas = document.getElementById("app") as HTMLCanvasElement;
package/src/dom/README.md CHANGED
@@ -38,8 +38,9 @@ src/dom/
38
38
  ### Browser Import
39
39
 
40
40
  ```typescript
41
- import { Engine, app, HypenModuleInstance } from "@hypen-space/core";
42
- import { DOMRenderer } from "@hypen-space/core/dom";
41
+ import { app, HypenModuleInstance } from "@hypen-space/core";
42
+ import { Engine } from "@hypen-space/web-engine";
43
+ import { DOMRenderer } from "@hypen-space/web";
43
44
 
44
45
  const engine = new Engine();
45
46
  await engine.init();
@@ -54,7 +55,7 @@ engine.setRenderCallback((patches) => {
54
55
 
55
56
  ```typescript
56
57
  // This will fail in Node.js/Bun (no DOM)
57
- import { DOMRenderer } from "@hypen-space/core/dom"; // ❌ Error
58
+ import { DOMRenderer } from "@hypen-space/web"; // ❌ Error (no DOM in Node.js)
58
59
 
59
60
  // Use server-safe renderer instead
60
61
  import { ConsoleRenderer } from "@hypen-space/core"; // ✅ Works
package/src/index.ts CHANGED
@@ -5,10 +5,10 @@
5
5
  * This entry point is WASM-free — it only contains renderers and the remote UI
6
6
  * embed component.
7
7
  *
8
- * For client-side rendering (with WASM engine), use "@hypen-space/web/client":
8
+ * For client-side rendering (with WASM engine), use "@hypen-space/web-engine":
9
9
  *
10
10
  * ```typescript
11
- * import { render } from "@hypen-space/web/client";
11
+ * import { render } from "@hypen-space/web-engine";
12
12
  * await render("Counter", "#app");
13
13
  * ```
14
14
  *
package/dist/client.d.ts DELETED
@@ -1,19 +0,0 @@
1
- /**
2
- * @hypen-space/web/client - Client-side rendering with WASM engine
3
- *
4
- * This entry point includes the Hypen orchestrator which connects the
5
- * BrowserEngine (WASM) with the DOM renderer. Use this when you want
6
- * to run the engine client-side in the browser.
7
- *
8
- * For remote UI (server-side engine, no WASM in browser), use the
9
- * default import from "@hypen-space/web" instead.
10
- *
11
- * @example
12
- * ```typescript
13
- * import { render } from "@hypen-space/web/client";
14
- *
15
- * await render("Counter", "#app");
16
- * ```
17
- */
18
- export { Hypen, render, renderWithComponents } from "./hypen.js";
19
- export type { HypenConfig } from "./hypen.js";
package/dist/client.js DELETED
@@ -1,19 +0,0 @@
1
- /**
2
- * @hypen-space/web/client - Client-side rendering with WASM engine
3
- *
4
- * This entry point includes the Hypen orchestrator which connects the
5
- * BrowserEngine (WASM) with the DOM renderer. Use this when you want
6
- * to run the engine client-side in the browser.
7
- *
8
- * For remote UI (server-side engine, no WASM in browser), use the
9
- * default import from "@hypen-space/web" instead.
10
- *
11
- * @example
12
- * ```typescript
13
- * import { render } from "@hypen-space/web/client";
14
- *
15
- * await render("Counter", "#app");
16
- * ```
17
- */
18
- export { Hypen, render, renderWithComponents } from "./hypen.js";
19
- //# sourceMappingURL=client.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC"}
package/dist/hypen.d.ts DELETED
@@ -1,140 +0,0 @@
1
- /**
2
- * Hypen - High-Level API for Web Applications
3
- *
4
- * Simple API for rendering Hypen applications (like ReactDOM.render)
5
- */
6
- import { HypenModuleInstance } from "@hypen-space/core/app";
7
- import type { HypenModuleDefinition } from "@hypen-space/core/app";
8
- import { HypenRouter } from "@hypen-space/core/router";
9
- import { HypenGlobalContext } from "@hypen-space/core/context";
10
- export interface HypenConfig {
11
- /** Base directory for components (default: "./src/components") */
12
- componentsDir?: string;
13
- /** Enable debug logging */
14
- debug?: boolean;
15
- /** Custom WASM URL */
16
- wasmUrl?: string;
17
- /** Custom WASM JS glue URL */
18
- jsUrl?: string;
19
- /** Enable re-render heatmap debugging */
20
- debugHeatmap?: boolean;
21
- /** Heatmap increment per re-render (default: 5%) */
22
- heatmapIncrement?: number;
23
- /** Heatmap fade out duration in ms (default: 2000) */
24
- heatmapFadeOut?: number;
25
- }
26
- export declare class Hypen {
27
- private engine;
28
- private renderer;
29
- private moduleInstance;
30
- private container;
31
- private config;
32
- private router;
33
- private globalContext;
34
- private moduleInstances;
35
- constructor(config?: HypenConfig);
36
- /**
37
- * Initialize the Hypen runtime
38
- * Must be called before render()
39
- */
40
- init(): Promise<void>;
41
- /**
42
- * Load all components from the components directory
43
- */
44
- loadComponents(componentsDir?: string): Promise<void>;
45
- /**
46
- * Render a component to a DOM container
47
- *
48
- * @param componentName - Name of the component to render (e.g., "HomePage")
49
- * @param containerSelector - CSS selector or HTMLElement for the mount point
50
- */
51
- render(componentName: string, containerSelector: string | HTMLElement): Promise<void>;
52
- /**
53
- * Unmount and cleanup
54
- */
55
- unmount(): Promise<void>;
56
- /**
57
- * Get the current module instance
58
- */
59
- getModuleInstance(): HypenModuleInstance<any> | null;
60
- /**
61
- * Get the current state
62
- */
63
- getState(): any;
64
- /**
65
- * Get the router instance
66
- */
67
- getRouter(): HypenRouter;
68
- /**
69
- * Get the global context
70
- */
71
- getGlobalContext(): HypenGlobalContext;
72
- /**
73
- * Enable or disable debug heatmap mode
74
- */
75
- setDebugHeatmap(enabled: boolean): void;
76
- /**
77
- * Reset debug tracking for all elements
78
- */
79
- resetDebugTracking(): void;
80
- /**
81
- * Get debug statistics
82
- */
83
- getDebugStats(): {
84
- totalRerenders: number;
85
- elementCount: number;
86
- avgRerenders: number;
87
- } | null;
88
- /**
89
- * Render a lazy route component into a specific route element
90
- * This is called by the Router when a route becomes active
91
- */
92
- renderLazyRoute(routePath: string, componentName: string, routeElement: HTMLElement): Promise<void>;
93
- /**
94
- * Extract module ID from component name or .id() applicator
95
- */
96
- private extractModuleId;
97
- /**
98
- * Create module instances for all components that have state
99
- */
100
- private createNestedModuleInstances;
101
- /**
102
- * Get merged state from all module instances
103
- */
104
- private getMergedState;
105
- /**
106
- * Set up component resolver for the engine
107
- */
108
- private setupComponentResolver;
109
- }
110
- /**
111
- * Quick render function (like ReactDOM.render)
112
- *
113
- * @example
114
- * ```typescript
115
- * import { render } from "@hypen-space/web/client";
116
- *
117
- * await render("HomePage", "#app");
118
- * ```
119
- */
120
- export declare function render(componentName: string, containerSelector: string | HTMLElement, config?: HypenConfig): Promise<Hypen>;
121
- /**
122
- * Render with explicit component loading
123
- *
124
- * @example
125
- * ```typescript
126
- * import { renderWithComponents } from "@hypen-space/web/client";
127
- * import HomePage from "./components/HomePage/component";
128
- * import homePageTemplate from "./components/HomePage/component.hypen";
129
- *
130
- * await renderWithComponents(
131
- * { HomePage: { module: HomePage, template: homePageTemplate } },
132
- * "HomePage",
133
- * "#app"
134
- * );
135
- * ```
136
- */
137
- export declare function renderWithComponents(components: Record<string, {
138
- module: HypenModuleDefinition;
139
- template: string;
140
- }>, componentName: string, containerSelector: string | HTMLElement, config?: HypenConfig): Promise<Hypen>;