@hypen-space/web 0.3.11 → 0.4.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hypen-space/web",
3
- "version": "0.3.11",
3
+ "version": "0.4.0",
4
4
  "description": "Hypen web renderers - DOM and Canvas rendering for browsers",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -29,6 +29,13 @@
29
29
  "import": "./dist/canvas/index.js",
30
30
  "default": "./dist/canvas/index.js"
31
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
+ },
32
39
  "./hypen": {
33
40
  "types": "./dist/hypen.d.ts",
34
41
  "browser": "./dist/hypen.js",
@@ -48,7 +55,7 @@
48
55
  "clean": "rm -rf dist"
49
56
  },
50
57
  "dependencies": {
51
- "@hypen-space/core": "^0.3.10"
58
+ "@hypen-space/core": "^0.4.0"
52
59
  },
53
60
  "devDependencies": {
54
61
  "@types/bun": "latest",
@@ -4,7 +4,8 @@
4
4
  * Main renderer class that orchestrates layout, painting, and events
5
5
  */
6
6
 
7
- import type { Renderer, Patch } from "@hypen-space/core";
7
+ import type { Renderer } from "@hypen-space/core/renderer";
8
+ import type { Patch } from "@hypen-space/core/types";
8
9
  import { frameworkLoggers } from "@hypen-space/core";
9
10
 
10
11
  const log = frameworkLoggers.canvas;
package/src/client.ts ADDED
@@ -0,0 +1,20 @@
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
+
19
+ export { Hypen, render, renderWithComponents } from "./hypen.js";
20
+ export type { HypenConfig } from "./hypen.js";
@@ -14,7 +14,7 @@
14
14
 
15
15
  import type { ComponentHandler } from "./index.js";
16
16
  import { RemoteEngine } from "@hypen-space/core/remote/client";
17
- import type { Patch } from "@hypen-space/core/remote";
17
+ import type { Patch } from "@hypen-space/core/types";
18
18
  import { frameworkLoggers } from "@hypen-space/core";
19
19
 
20
20
  const log = frameworkLoggers.remote;
@@ -158,7 +158,7 @@ function applyPatches(
158
158
  }
159
159
 
160
160
  case "insert": {
161
- const parentId = patch.parentId;
161
+ const parentId = patch.parentId!;
162
162
  const parent = parentId === "root" ? container : nodes.get(parentId);
163
163
  const child = nodes.get(patch.id!);
164
164
  const beforeId = patch.beforeId;
@@ -183,7 +183,7 @@ function applyPatches(
183
183
  }
184
184
 
185
185
  case "move": {
186
- const parentId = patch.parentId;
186
+ const parentId = patch.parentId!;
187
187
  const parent = parentId === "root" ? container : nodes.get(parentId);
188
188
  const child = nodes.get(patch.id!);
189
189
  const beforeId = patch.beforeId;
@@ -4,10 +4,10 @@
4
4
  * Renders Hypen patches to the DOM
5
5
  */
6
6
 
7
- import type { Patch } from "@hypen-space/core";
8
- import type { HypenModuleInstance, RouterContext } from "@hypen-space/core";
9
- import type { HypenRouter } from "@hypen-space/core";
10
- import type { HypenGlobalContext } from "@hypen-space/core";
7
+ import type { Patch } from "@hypen-space/core/types";
8
+ import type { HypenModuleInstance, RouterContext } from "@hypen-space/core/app";
9
+ import type { HypenRouter } from "@hypen-space/core/router";
10
+ import type { HypenGlobalContext } from "@hypen-space/core/context";
11
11
  import { frameworkLoggers } from "@hypen-space/core";
12
12
 
13
13
  const log = frameworkLoggers.renderer;
package/src/hypen.ts CHANGED
@@ -4,20 +4,14 @@
4
4
  * Simple API for rendering Hypen applications (like ReactDOM.render)
5
5
  */
6
6
 
7
- import {
8
- BrowserEngine as Engine,
9
- HypenModuleInstance,
10
- HypenRouter,
11
- HypenGlobalContext,
12
- componentLoader,
13
- Router,
14
- Route,
15
- Link,
16
- frameworkLoggers,
17
- setDebugMode,
18
- type RouterContext,
19
- type HypenModuleDefinition,
20
- } from "@hypen-space/core";
7
+ import { Engine } from "@hypen-space/core/engine/browser";
8
+ import { HypenModuleInstance } from "@hypen-space/core/app";
9
+ import type { RouterContext, HypenModuleDefinition } from "@hypen-space/core/app";
10
+ import { HypenRouter } from "@hypen-space/core/router";
11
+ import { HypenGlobalContext } from "@hypen-space/core/context";
12
+ import { componentLoader } from "@hypen-space/core/loader";
13
+ import { Router, Route, Link } from "@hypen-space/core/components";
14
+ import { frameworkLoggers, setDebugMode } from "@hypen-space/core";
21
15
  import { DOMRenderer } from "./dom/renderer.js";
22
16
  import type { DebugConfig } from "./dom/debug.js";
23
17
 
@@ -519,7 +513,7 @@ export class Hypen {
519
513
  *
520
514
  * @example
521
515
  * ```typescript
522
- * import { render } from "@hypen-space/web";
516
+ * import { render } from "@hypen-space/web/client";
523
517
  *
524
518
  * await render("HomePage", "#app");
525
519
  * ```
@@ -541,7 +535,7 @@ export async function render(
541
535
  *
542
536
  * @example
543
537
  * ```typescript
544
- * import { renderWithComponents } from "@hypen-space/web";
538
+ * import { renderWithComponents } from "@hypen-space/web/client";
545
539
  * import HomePage from "./components/HomePage/component";
546
540
  * import homePageTemplate from "./components/HomePage/component.hypen";
547
541
  *
package/src/index.ts CHANGED
@@ -1,30 +1,21 @@
1
1
  /**
2
- * @hypen/web - Hypen Web Renderers
2
+ * @hypen-space/web - Hypen Web Renderers
3
3
  *
4
4
  * Browser-only package providing DOM and Canvas rendering for Hypen applications.
5
- * Requires @hypen-space/core for the engine and state management.
5
+ * This entry point is WASM-free it only contains renderers and the remote UI
6
+ * embed component.
6
7
  *
7
- * ## Quick Start
8
+ * For client-side rendering (with WASM engine), use "@hypen-space/web/client":
8
9
  *
9
10
  * ```typescript
10
- * import { Engine, app } from "@hypen-space/core";
11
- * import { DOMRenderer } from "@hypen/web";
12
- *
13
- * // Initialize engine
14
- * const engine = new Engine();
15
- * await engine.init({ wasmPath: "/hypen_engine_bg.wasm" });
16
- *
17
- * // Create renderer
18
- * const container = document.getElementById("app")!;
19
- * const renderer = new DOMRenderer(container, engine);
11
+ * import { render } from "@hypen-space/web/client";
12
+ * await render("Counter", "#app");
13
+ * ```
20
14
  *
21
- * // Set up patch callback
22
- * engine.setRenderCallback((patches) => {
23
- * renderer.applyPatches(patches);
24
- * });
15
+ * For remote UI (no WASM needed in the browser):
25
16
  *
26
- * // Render your app
27
- * engine.renderSource(`Column { Text("Hello Hypen!") }`);
17
+ * ```typescript
18
+ * import { DOMRenderer } from "@hypen-space/web";
28
19
  * ```
29
20
  */
30
21
 
@@ -47,20 +38,3 @@ export { hypenAppHandler, disconnectHypenApp } from "./dom/components/hypenapp.j
47
38
 
48
39
  export { CanvasRenderer } from "./canvas/renderer.js";
49
40
  export { canvasHandler, canvasApplicators } from "./dom/canvas/index.js";
50
-
51
- // ============================================================================
52
- // HIGH-LEVEL API
53
- // ============================================================================
54
-
55
- export { Hypen, render, renderWithComponents } from "./hypen.js";
56
- export type { HypenConfig } from "./hypen.js";
57
-
58
- // Re-export core types that web users commonly need
59
- export type {
60
- Patch,
61
- Action,
62
- Renderer,
63
- RouterContext,
64
- HypenModuleInstance,
65
- HypenGlobalContext,
66
- } from "@hypen-space/core";