octane 0.1.32 → 0.1.34
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 +6 -0
- package/dist/behavior-root.d.ts +70 -0
- package/dist/behavior-root.js +687 -0
- package/dist/cjs/behavior-root.cjs +711 -0
- package/dist/cjs/component-flags.cjs +41 -0
- package/dist/cjs/constants.cjs +144 -0
- package/dist/cjs/css.cjs +60 -0
- package/dist/cjs/devtools-hook.cjs +194 -0
- package/dist/cjs/dom-tables.cjs +500 -0
- package/dist/cjs/error-codes.client.generated.cjs +176 -0
- package/dist/cjs/error-codes.server.generated.cjs +147 -0
- package/dist/cjs/error-message.cjs +53 -0
- package/dist/cjs/head-ownership.cjs +56 -0
- package/dist/cjs/html-tree-validation.cjs +175 -0
- package/dist/cjs/hydration/event-capture.cjs +188 -0
- package/dist/cjs/hydration/interaction-config.cjs +36 -0
- package/dist/cjs/index.cjs +413 -0
- package/dist/cjs/method-dep.cjs +35 -0
- package/dist/cjs/profiling.cjs +462 -0
- package/dist/cjs/renderer-bridge.cjs +64 -0
- package/dist/cjs/runtime.cjs +16054 -0
- package/dist/cjs/runtime.server.cjs +4818 -0
- package/dist/cjs/sanitize-url.cjs +59 -0
- package/dist/cjs/server/index.cjs +256 -0
- package/dist/cjs/server/rpc.cjs +58 -0
- package/dist/cjs/server-rpc-client.cjs +70 -0
- package/dist/cjs/stream-protocol.cjs +97 -0
- package/dist/cjs/version.cjs +28 -0
- package/dist/compiler/bundler.js +56 -34
- package/dist/compiler/compile-universal.js +358 -0
- package/dist/compiler/compile.js +1826 -137
- package/dist/error-codes.client.generated.d.ts +2 -0
- package/dist/error-codes.client.generated.js +7 -0
- package/dist/index.d.ts +3 -1
- package/dist/index.js +8 -0
- package/dist/jsx-runtime.d.ts +2 -2
- package/dist/renderer-bridge.d.ts +27 -0
- package/dist/renderer-bridge.js +35 -0
- package/dist/runtime.d.ts +102 -74
- package/dist/runtime.js +1014 -219
- package/dist/runtime.server.d.ts +9 -3
- package/dist/runtime.server.js +113 -36
- package/dist/server/index.d.ts +1 -1
- package/dist/server/index.js +2 -0
- package/dist/universal-core.d.ts +2 -0
- package/dist/universal-core.js +5 -0
- package/dist/universal-dom-boundary.d.ts +2 -0
- package/dist/universal-dom-boundary.js +9 -1
- package/dist/universal-native.js +3 -1
- package/dist/universal.d.ts +1 -1
- package/dist/universal.js +6 -2
- package/dist/version.js +1 -1
- package/package.json +9 -1
package/README.md
CHANGED
|
@@ -21,6 +21,12 @@ Direct Node or Bun server scripts can preload `octane/compiler/register` to
|
|
|
21
21
|
compile imported Octane components without going through Vite. See the
|
|
22
22
|
[SSR guide](https://github.com/octanejs/octane/blob/main/docs/ssr.md#run-an-ssg-script-directly).
|
|
23
23
|
|
|
24
|
+
Applications that stream or update their own server-rendered DOM can import
|
|
25
|
+
`attachBehaviorRoot` from `octane/behavior`. Behavior-only roots attach native
|
|
26
|
+
interactions and disposable behavior without creating a component root or
|
|
27
|
+
taking ownership of the existing markup. See the
|
|
28
|
+
[external ownership guide](https://github.com/octanejs/octane/blob/main/docs/deferred-hydration.md#behavior-only-roots-and-external-ownership).
|
|
29
|
+
|
|
24
30
|
For the full story, see the
|
|
25
31
|
[main README](https://github.com/octanejs/octane#readme).
|
|
26
32
|
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/** A behavior-only root observes existing DOM without taking reconciliation ownership. */
|
|
2
|
+
export interface BehaviorRootOptions {
|
|
3
|
+
/** Dispose this root when the enclosing page or document lifetime ends. */
|
|
4
|
+
signal?: AbortSignal;
|
|
5
|
+
/** Explicitly dispose an existing behavior root attached to this container. */
|
|
6
|
+
replace?: boolean;
|
|
7
|
+
}
|
|
8
|
+
export interface BehaviorDisposeOptions {
|
|
9
|
+
/** Existing DOM is retained unless its removal is explicitly requested. */
|
|
10
|
+
preserveDOM?: boolean;
|
|
11
|
+
}
|
|
12
|
+
export interface ExternalRangeOptions {
|
|
13
|
+
/** Identity of the component, stream, or application owning this subtree. */
|
|
14
|
+
owner: unknown;
|
|
15
|
+
/** Delay adoption until the independently owned stream is ready. */
|
|
16
|
+
ready?: PromiseLike<unknown>;
|
|
17
|
+
signal?: AbortSignal;
|
|
18
|
+
/** Explicitly hand the same subtree from its previous owner to this owner. */
|
|
19
|
+
replace?: boolean;
|
|
20
|
+
}
|
|
21
|
+
export interface ExternalRange {
|
|
22
|
+
readonly element: Element;
|
|
23
|
+
readonly owner: unknown;
|
|
24
|
+
readonly signal: AbortSignal;
|
|
25
|
+
readonly ready: Promise<void>;
|
|
26
|
+
dispose(): void;
|
|
27
|
+
}
|
|
28
|
+
export interface BehaviorContext {
|
|
29
|
+
/** Per-element lifetime, canceled when its adoption or registration ends. */
|
|
30
|
+
readonly signal: AbortSignal;
|
|
31
|
+
/** The original native interaction when adoption was started by that event. */
|
|
32
|
+
readonly event?: Event;
|
|
33
|
+
/** The closest externally owned range, if this target belongs to one. */
|
|
34
|
+
readonly range?: ExternalRange;
|
|
35
|
+
}
|
|
36
|
+
export type BehaviorCleanup = () => void;
|
|
37
|
+
export interface BehaviorEntry {
|
|
38
|
+
id?: string;
|
|
39
|
+
target: string | Element;
|
|
40
|
+
/** Restrict adoption to the closest range belonging to this exact owner. */
|
|
41
|
+
owner?: unknown;
|
|
42
|
+
events?: readonly string[];
|
|
43
|
+
ready?: PromiseLike<unknown>;
|
|
44
|
+
dependencies?: readonly string[];
|
|
45
|
+
conflicts?: readonly string[];
|
|
46
|
+
signal?: AbortSignal;
|
|
47
|
+
adopt(element: Element, context: BehaviorContext): void | BehaviorCleanup | PromiseLike<void | BehaviorCleanup>;
|
|
48
|
+
handleEvent?(event: Event, element: Element, context: BehaviorContext): void;
|
|
49
|
+
}
|
|
50
|
+
export interface BehaviorRegistration {
|
|
51
|
+
readonly id?: string;
|
|
52
|
+
readonly signal: AbortSignal;
|
|
53
|
+
readonly ready: Promise<void>;
|
|
54
|
+
dispose(): void;
|
|
55
|
+
}
|
|
56
|
+
export interface BehaviorRoot {
|
|
57
|
+
readonly container: Element;
|
|
58
|
+
readonly signal: AbortSignal;
|
|
59
|
+
/** A snapshot of currently active ranges, registrations, and asynchronous adoptions. */
|
|
60
|
+
readonly ready: Promise<void>;
|
|
61
|
+
registerExternalRange(element: Element, options: ExternalRangeOptions): ExternalRange;
|
|
62
|
+
registerBehavior(entry: BehaviorEntry): BehaviorRegistration;
|
|
63
|
+
dispose(options?: BehaviorDisposeOptions): void;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Attach behavior to existing DOM without rendering, replacing, or reconciling it.
|
|
67
|
+
* Every owner, observer, listener, and constructor is scoped to the container's
|
|
68
|
+
* own Document, including elements imported from another JavaScript realm.
|
|
69
|
+
*/
|
|
70
|
+
export declare function attachBehaviorRoot(container: Element, options?: BehaviorRootOptions): BehaviorRoot;
|