octane 0.2.2 → 0.2.4

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 (59) hide show
  1. package/dist/cjs/compatibility.cjs +35 -0
  2. package/dist/cjs/component-flags.cjs +8 -1
  3. package/dist/cjs/css.cjs +9 -0
  4. package/dist/cjs/dom-tables.cjs +8 -1
  5. package/dist/cjs/error-codes.client.generated.cjs +15 -2
  6. package/dist/cjs/error-codes.server.generated.cjs +5 -0
  7. package/dist/cjs/event-names.cjs +39 -0
  8. package/dist/cjs/index.cjs +13 -0
  9. package/dist/cjs/runtime.cjs +1345 -359
  10. package/dist/cjs/runtime.server.cjs +620 -183
  11. package/dist/cjs/server/index.cjs +26 -0
  12. package/dist/cjs/version.cjs +1 -1
  13. package/dist/compatibility.d.ts +7 -0
  14. package/dist/compatibility.js +10 -0
  15. package/dist/compiler/bundler.js +20 -30
  16. package/dist/compiler/compile-renderer-boundaries.js +1 -0
  17. package/dist/compiler/compile-universal.js +3 -0
  18. package/dist/compiler/compile.js +877 -627
  19. package/dist/compiler/hook-deps.js +100 -3
  20. package/dist/compiler/hook-names.js +1 -0
  21. package/dist/compiler/hydrate-boundaries.js +165 -15
  22. package/dist/compiler/manual-hooks.js +171 -0
  23. package/dist/compiler/parser.node.js +34 -8
  24. package/dist/compiler/plain-hook-memo.js +54 -5
  25. package/dist/compiler/slot-hooks.d.ts +43 -0
  26. package/dist/compiler/slot-hooks.js +154 -35
  27. package/dist/compiler/strong-mode.js +836 -3
  28. package/dist/compiler/style-scopes.js +1134 -0
  29. package/dist/compiler/volar.LICENSES.txt +1 -1
  30. package/dist/compiler/volar.js +4543 -2839
  31. package/dist/component-flags.d.ts +1 -1
  32. package/dist/component-flags.js +8 -1
  33. package/dist/css.d.ts +7 -0
  34. package/dist/css.js +8 -0
  35. package/dist/dom-tables.js +8 -1
  36. package/dist/error-codes.client.generated.d.ts +3 -1
  37. package/dist/error-codes.client.generated.js +15 -2
  38. package/dist/error-codes.server.generated.d.ts +1 -0
  39. package/dist/error-codes.server.generated.js +5 -0
  40. package/dist/event-names.d.ts +1 -0
  41. package/dist/event-names.js +15 -0
  42. package/dist/html-tree-validation.d.ts +17 -34
  43. package/dist/index.d.ts +3 -1
  44. package/dist/index.js +12 -1
  45. package/dist/jsx-runtime.d.ts +6 -1
  46. package/dist/public-types.d.ts +188 -0
  47. package/dist/public-types.js +0 -0
  48. package/dist/runtime.d.ts +128 -69
  49. package/dist/runtime.js +1349 -360
  50. package/dist/runtime.server.d.ts +67 -15
  51. package/dist/runtime.server.js +619 -184
  52. package/dist/server/index.d.ts +4 -2
  53. package/dist/server/index.js +23 -0
  54. package/dist/static/index.d.ts +2 -1
  55. package/dist/static/index.js +3 -1
  56. package/dist/universal-core.d.ts +8 -1
  57. package/dist/universal-core.js +95 -9
  58. package/dist/version.js +1 -1
  59. package/package.json +4 -3
@@ -1,6 +1,6 @@
1
1
  /** The component owns a load-bearing runtime/SSR boundary range. */
2
2
  export declare const COMPONENT_FLAG_BOUNDARY: number;
3
3
  /** Attach an immutable capability bitmask without retaining concrete component identities. */
4
- export declare function markComponentFlags<T extends Function>(component: T, flags: number, name: string): T;
4
+ export declare function markComponentFlags<T extends Function>(component: T, flags: number, name: string, kind?: symbol): T;
5
5
  /** Test compiler/runtime capability bits on a component from any Octane runtime copy. */
6
6
  export declare function hasComponentFlags(component: unknown, flags: number): boolean;
@@ -1,9 +1,16 @@
1
1
  import { hasOwnProp } from "./has-own.js";
2
2
  const OCTANE_COMPONENT_FLAGS = /* @__PURE__ */ Symbol.for("octane.flags.component");
3
3
  const COMPONENT_FLAG_BOUNDARY = 1 << 0;
4
- function markComponentFlags(component, flags, name) {
4
+ function markComponentFlags(component, flags, name, kind) {
5
5
  Object.defineProperty(component, OCTANE_COMPONENT_FLAGS, { value: flags });
6
6
  Object.defineProperty(component, "name", { value: name, configurable: true });
7
+ if (kind !== void 0) {
8
+ Object.defineProperty(component, kind, {
9
+ get() {
10
+ return this === component;
11
+ }
12
+ });
13
+ }
7
14
  return component;
8
15
  }
9
16
  function hasComponentFlags(component, flags) {
package/dist/css.d.ts CHANGED
@@ -3,6 +3,13 @@
3
3
  * falsy drops out). Octane's `class`/`className` semantics at every apply site.
4
4
  */
5
5
  export declare function normalizeClass(value: unknown): string;
6
+ /**
7
+ * Append a later class source onto an earlier one. Used when a synthesized
8
+ * scope hash must share the element with a spread's class instead of replacing
9
+ * it. Both sides go through `normalizeClass` so arrays / objects compose the
10
+ * same way they would as a lone `class` value.
11
+ */
12
+ export declare function mergeClass(left: unknown, right: unknown): string;
6
13
  export declare function styleName(name: string): string;
7
14
  /** @internal Development-only React-style inline CSS diagnostics. */
8
15
  export declare function devWarnStyleProperty(name: string, value: unknown, server: boolean): void;
package/dist/css.js CHANGED
@@ -20,6 +20,13 @@ function normalizeClass(value) {
20
20
  }
21
21
  return str;
22
22
  }
23
+ function mergeClass(left, right) {
24
+ const a = normalizeClass(left);
25
+ const b = normalizeClass(right);
26
+ if (!a) return b;
27
+ if (!b) return a;
28
+ return a + " " + b;
29
+ }
23
30
  import { hyphenateStyleName } from "./dom-tables.js";
24
31
  const styleNameCache = /* @__PURE__ */ new Map();
25
32
  function styleName(name) {
@@ -84,6 +91,7 @@ function devWarnStyleCoercion(name, value) {
84
91
  export {
85
92
  devWarnStyleCoercion,
86
93
  devWarnStyleProperty,
94
+ mergeClass,
87
95
  normalizeClass,
88
96
  styleName
89
97
  };
@@ -398,6 +398,7 @@ for (const base of [
398
398
  "opacity",
399
399
  "order",
400
400
  "orphans",
401
+ "scale",
401
402
  "tabSize",
402
403
  "widows",
403
404
  "zIndex",
@@ -418,8 +419,13 @@ for (const base of [
418
419
  UNITLESS_STYLE_PROPS.add("moz" + c);
419
420
  UNITLESS_STYLE_PROPS.add("o" + c);
420
421
  }
422
+ const unitlessStylePropCache = /* @__PURE__ */ new Map();
421
423
  function isUnitlessStyleProp(name) {
422
- return UNITLESS_STYLE_PROPS.has(name.replaceAll("-", "").toLowerCase());
424
+ const cached = unitlessStylePropCache.get(name);
425
+ if (cached !== void 0) return cached;
426
+ const result = UNITLESS_STYLE_PROPS.has(name.replaceAll("-", "").toLowerCase());
427
+ unitlessStylePropCache.set(name, result);
428
+ return result;
423
429
  }
424
430
  function cssStyleValue(name, value) {
425
431
  if (typeof value === "number" && value !== 0 && name.charCodeAt(0) !== 45 && !isUnitlessStyleProp(name)) {
@@ -428,6 +434,7 @@ function cssStyleValue(name, value) {
428
434
  return typeof value === "string" ? value.trim() : "" + value;
429
435
  }
430
436
  function hyphenateStyleName(name) {
437
+ if (name === "cssFloat") return "float";
431
438
  if (name.charCodeAt(0) === 45) return name;
432
439
  let hasUpper = false;
433
440
  for (let i = 0; i < name.length; i++) {
@@ -26,7 +26,6 @@ type ClientErrorArguments = {
26
26
  25: [];
27
27
  26: [unknown];
28
28
  27: [];
29
- 28: [];
30
29
  29: [];
31
30
  46: [unknown, unknown];
32
31
  49: [];
@@ -38,6 +37,9 @@ type ClientErrorArguments = {
38
37
  55: [];
39
38
  56: [];
40
39
  58: [];
40
+ 61: [];
41
+ 62: [];
42
+ 63: [];
41
43
  };
42
44
  export declare function formatClientError<Code extends keyof ClientErrorArguments>(code: Code, ...args: ClientErrorArguments[Code]): string;
43
45
  export {};
@@ -129,8 +129,6 @@ function formatClientError(code, ...args) {
129
129
  "A hosted foreign-context request escaped its renderer-region owner; the owning bridge is gone or declined it.",
130
130
  args
131
131
  );
132
- case 28:
133
- return formatDevErrorMessage("Target container is not a DOM element.", args);
134
132
  case 29:
135
133
  return formatDevErrorMessage("Cannot update an unmounted root.", args);
136
134
  case 46:
@@ -177,6 +175,21 @@ function formatClientError(code, ...args) {
177
175
  );
178
176
  case 58:
179
177
  return formatDevErrorMessage("Unsupported native-read compiler/runtime version.", args);
178
+ case 61:
179
+ return formatDevErrorMessage(
180
+ "Hydration mismatch: the server-rendered text differed from the client; the text was updated to the client value.",
181
+ args
182
+ );
183
+ case 62:
184
+ return formatDevErrorMessage(
185
+ "Hydration mismatch: the server rendered extra children in a text element; the stale children were discarded.",
186
+ args
187
+ );
188
+ case 63:
189
+ return formatDevErrorMessage(
190
+ "Target container is not a DOM element. Pass an Element, Document, or DocumentFragment. If document.body is null after document hydration, update the existing document root or render a document shell containing <body>.",
191
+ args
192
+ );
180
193
  default:
181
194
  return formatUnknownDevErrorMessage(code);
182
195
  }
@@ -30,6 +30,7 @@ type ServerErrorArguments = {
30
30
  57: [];
31
31
  58: [];
32
32
  59: [unknown];
33
+ 60: [];
33
34
  };
34
35
  export declare function formatServerError<Code extends keyof ServerErrorArguments>(code: Code, ...args: ServerErrorArguments[Code]): string;
35
36
  export {};
@@ -125,6 +125,11 @@ function formatServerError(code, ...args) {
125
125
  return formatDevErrorMessage("Unsupported native-read compiler/runtime version.", args);
126
126
  case 59:
127
127
  return formatDevErrorMessage("%s requires an active server component.", args);
128
+ case 60:
129
+ return formatDevErrorMessage(
130
+ "A component suspended without a Suspense boundary during synchronous server rendering. Use prerender() or a streaming renderer to await it.",
131
+ args
132
+ );
128
133
  default:
129
134
  return formatUnknownDevErrorMessage(code);
130
135
  }
@@ -0,0 +1 @@
1
+ export function isDelegatedEventProp(name: string): boolean;
@@ -0,0 +1,15 @@
1
+ const names = "Abort AnimationEnd AnimationIteration AnimationStart AuxClick BeforeInput BeforeToggle Blur Cancel CanPlay CanPlayThrough Change Click Close CompositionEnd CompositionStart CompositionUpdate ContextMenu Copy Cut DoubleClick Drag DragEnd DragEnter DragExit DragLeave DragOver DragStart Drop DurationChange Emptied Encrypted Ended Error Focus GotPointerCapture Input Invalid KeyDown KeyPress KeyUp Load LoadedData LoadedMetadata LoadStart LostPointerCapture MouseDown MouseEnter MouseLeave MouseMove MouseOut MouseOver MouseUp Paste Pause Play Playing PointerCancel PointerDown PointerEnter PointerLeave PointerMove PointerOut PointerOver PointerUp Progress RateChange Reset Resize Scroll ScrollEnd Seeked Seeking Select Stalled Submit Suspend TimeUpdate Toggle TouchCancel TouchEnd TouchMove TouchStart TransitionCancel TransitionEnd TransitionRun TransitionStart VolumeChange Waiting Wheel";
2
+ let delegatedEventProps;
3
+ function isDelegatedEventProp(name) {
4
+ if (delegatedEventProps === void 0) {
5
+ delegatedEventProps = /* @__PURE__ */ new Set();
6
+ for (const event of names.split(" ")) {
7
+ delegatedEventProps.add("on" + event);
8
+ delegatedEventProps.add("on" + event + "Capture");
9
+ }
10
+ }
11
+ return delegatedEventProps.has(name);
12
+ }
13
+ export {
14
+ isDelegatedEventProp
15
+ };
@@ -1,34 +1,17 @@
1
- /**
2
- * HTML parser-repair rules used by DEV client and SSR nesting diagnostics.
3
- *
4
- * This is intentionally narrower than the full HTML content model: it only
5
- * lists placements the browser repairs while parsing serialized HTML, because
6
- * those repairs can change the DOM before hydration. Adapted from Svelte's
7
- * html-tree-validation module, which Ripple also uses.
8
- *
9
- * Copyright (c) 2016-2025 Svelte Contributors
10
- *
11
- * Permission is hereby granted, free of charge, to any person obtaining a copy
12
- * of this software and associated documentation files (the "Software"), to deal
13
- * in the Software without restriction, including without limitation the rights
14
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
15
- * copies of the Software, and to permit persons to whom the Software is
16
- * furnished to do so, subject to the following conditions:
17
- *
18
- * The above copyright notice and this permission notice shall be included in
19
- * all copies or substantial portions of the Software.
20
- *
21
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
26
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
27
- * SOFTWARE.
28
- */
29
- /** Return a diagnostic when `childTag` causes an ancestor to be repaired. */
30
- export declare function invalidHtmlNestingWithAncestor(childTag: string, ancestors: string[], childLocation?: string, ancestorLocation?: string): string | null;
31
- /** Return a diagnostic when `childTag` causes its direct parent to be repaired. */
32
- export declare function invalidHtmlNestingWithParent(childTag: string, parentTag: string, childLocation?: string, parentLocation?: string): string | null;
33
- /** Return a diagnostic when visible or whitespace text cannot remain under its parent. */
34
- export declare function invalidHtmlTextNesting(text: string, parentTag: string, parentLocation?: string): string | null;
1
+ export declare function invalidHtmlNestingWithAncestor(
2
+ childTag: string,
3
+ ancestors: string[],
4
+ childLocation?: string,
5
+ ancestorLocation?: string,
6
+ ): string | null;
7
+ export declare function invalidHtmlNestingWithParent(
8
+ childTag: string,
9
+ parentTag: string,
10
+ childLocation?: string,
11
+ parentLocation?: string,
12
+ ): string | null;
13
+ export declare function invalidHtmlTextNesting(
14
+ text: string,
15
+ parentTag: string,
16
+ parentLocation?: string,
17
+ ): string | null;
package/dist/index.d.ts CHANGED
@@ -1,9 +1,11 @@
1
1
  export { version } from './version.js';
2
+ export type * from './public-types.js';
3
+ export { StrictMode, unstable_batchedUpdates } from './compatibility.js';
2
4
  export { initializeHydrationEventCapture } from './hydration/event-capture.js';
3
5
  export { attachBehaviorRoot } from './behavior-root.js';
4
6
  export type * from './behavior-root.js';
5
7
  export { createSubSlot, subSlot, type SubSlot, type SlotlessSubSlot, type SubSlotOptions, } from './sub-slot.js';
6
- export { createRoot, hydrateRoot, flushSync, act, type Root, type RootOptions, useState, useLinkedState, type LinkedStatePrevious, type LinkedStateOptions, useReducer, useEffect, useLayoutEffect, useInsertionEffect, useMemo, useCallback, useRef, useId, useImperativeHandle, useEffectEvent, useSyncExternalStore, useDeferredValue, useTransition, useActionState, useFormStatus, useOptimistic, useDebugValue, type FormStatus, startTransition, requestFormReset, memo, lazy, preload, preinit, preloadModule, preinitModule, preconnect, prefetchDNS, createContext, use, useContext, type Context, type ForeignHostContext, Suspense, ErrorBoundary, Hydrate, Activity, Activity as unstable_Activity, ViewTransition, addTransitionType, ViewTransition as unstable_ViewTransition, addTransitionType as unstable_addTransitionType, ViewTransitionPseudoElement, type ViewTransitionProps, type ViewTransitionInstance, Fragment, createPortal, type PortalDescriptor, createElement, cloneElement, isValidElement, isChildrenBlock, Children, type ElementDescriptor, type ComponentBody, type OctaneNode, TsrxErrorBoundary, __useStateWithGetter, __useLinkedStateWithGetter, __useReducerWithGetter, __createVoidRoot, bindRendererRegionOwner, EXTERNAL_HYDRATION_PROMISE, HYDRATION_RANGE_BOUNDARY, createHostContextRequest, __vtSeen, template, clone, drainFrag, bag0, bag1, bag2, bag3, bag4, bag5, bag6, bag7, bag8, bag9, bag10, bag11, bag12, bag13, bag14, bag15, bag16, bagOf, evt0, evt0u, evt1, evt1u, evt2, evt2u, evtN, evtNu, setEventHandler, devEventListener, devHtmlNesting, htext, htextSwap, child, sibling, setText, setScriptText, setHTML, setDangerouslySetInnerHTML, setDangerouslySetInnerHTMLSources, markDangerouslySetInnerHTMLChildren, setAttribute, setStringData, setBooleanAttribute, setAriaAttribute, setClassName, setClassAttr, normalizeClass, setStyle, setStyleProperty, setSpread, snapshotSpread, setHostPropSources, queueNativeChangeDiagnostic, queueFormAuthoringDiagnostic, markNativeChangeDiagnosticStatic, setFormAction, setValue, setFormControlSources, setChecked, setCheckedCheckable, setSelectValue, setDefaultValue, setDefaultValueUncontrolled, setDefaultChecked, setAutoFocus, attachRef, queueRefAttach, queueRefDetach, replaceRef, queueOwnRefDetach, injectStyle, headBlock, stylesheetResource, styleResource, scriptResource, namespaceHead, namespaceHeadElement, delegateEvents, delegateCaptureEvents, fastForBlock, fastKeyedForBlock, fastMapSlot, forBlock, keyedForBlock, mapSlot, ifBlock, errorBlock, tryBlock, switchBlock, activityBlock, componentSlot, componentSlotVoid, componentSlotLite, compilerCacheArray, compilerCacheImmutableArrayFilter, compilerCacheMappedArray, compilerCacheContext, compilerOwnsContextProvider, markSingleRoot, markSingleRoot as __s, markChildrenBlock, descriptorChildren, createScopedValue, createScopedElement, childSlot, positionalChildren, textSlot, textHole, childTextHole, hostComponent, renderBlock, portal, hookSlots, withSlot, useBatch, seedOrCreate, warmMemo, warmChild, puMiss, puTake0, puTake1, puTake2, puTake3, puTake4, puPub, provideContext, mountFragmentRef, FragmentInstance, hmr, HMR, hasPendingWork, type Scope, type Block, drainPassiveEffects, setIsOctaneActEnvironment, resetFloatResourceState, setTransitionFallbackTimeout, getTransitionFallbackTimeout, } from './runtime.js';
8
+ export { createRoot, hydrateRoot, flushSync, act, type Root, type RootContainer, type RootOptions, useState, useLinkedState, type LinkedStatePrevious, type LinkedStateOptions, useReducer, useEffect, useLayoutEffect, useInsertionEffect, useMemo, useCallback, useRef, useId, useImperativeHandle, useEffectEvent, useSyncExternalStore, useDeferredValue, useTransition, useActionState, useActionState as useFormState, useFormStatus, useOptimistic, useDebugValue, type FormStatus, startTransition, requestFormReset, memo, lazy, preload, preinit, preloadModule, preinitModule, preconnect, prefetchDNS, createContext, use, useContext, type Context, type ForeignHostContext, Suspense, ErrorBoundary, Hydrate, Activity, Activity as unstable_Activity, ViewTransition, addTransitionType, ViewTransition as unstable_ViewTransition, addTransitionType as unstable_addTransitionType, ViewTransitionPseudoElement, type ViewTransitionProps, type ViewTransitionInstance, Fragment, createPortal, type PortalDescriptor, createElement, cloneElement, isValidElement, isChildrenBlock, descriptorChildren, Children, type ElementDescriptor, type ComponentBody, type OctaneNode, TsrxErrorBoundary, __useStateWithGetter, __useLinkedStateWithGetter, __useReducerWithGetter, __createVoidRoot, bindRendererRegionOwner, EXTERNAL_HYDRATION_PROMISE, HYDRATION_RANGE_BOUNDARY, createHostContextRequest, __vtSeen, template, clone, drainFrag, bag0, bag1, bag2, bag3, bag4, bag5, bag6, bag7, bag8, bag9, bag10, bag11, bag12, bag13, bag14, bag15, bag16, bagOf, evt0, evt0u, evt1, evt1u, evt2, evt2u, evtN, evtNu, setEventHandler, devEventListener, devHtmlNesting, htext, htextSwap, child, sibling, setText, setScriptText, setHTML, setDangerouslySetInnerHTML, setDangerouslySetInnerHTMLSources, markDangerouslySetInnerHTMLChildren, setAttribute, setStringData, setBooleanAttribute, setAriaAttribute, setClassName, setClassAttr, normalizeClass, setStyle, setStyleProperty, setSpread, snapshotSpread, setHostPropSources, queueNativeChangeDiagnostic, queueFormAuthoringDiagnostic, markNativeChangeDiagnosticStatic, setFormAction, setValue, setFormControlSources, setChecked, setCheckedCheckable, setSelectValue, setDefaultValue, setDefaultValueUncontrolled, setDefaultChecked, setAutoFocus, attachRef, queueRefAttach, queueRefDetach, replaceRef, queueOwnRefDetach, injectStyle, headBlock, stylesheetResource, styleResource, scriptResource, namespaceHead, namespaceHeadElement, delegateEvents, delegateCaptureEvents, fastForBlock, fastKeyedForBlock, fastMapSlot, forBlock, keyedForBlock, mapSlot, ifBlock, errorBlock, tryBlock, switchBlock, activityBlock, componentSlot, componentSlotVoid, componentSlotLite, compilerCacheArray, compilerCacheImmutableArrayFilter, compilerCacheMappedArray, compilerCacheContext, compilerOwnsContextProvider, markSingleRoot, markWarm, markSingleRoot as __s, markChildrenBlock, createScopedValue, createScopedElement, childSlot, positionalChildren, textSlot, textHole, childTextHole, hostComponent, renderBlock, portal, hookSlots, withSlot, manualHook, invokeManualHook, useBatch, seedOrCreate, warmMemo, warmChild, puMiss, puTake0, puTake1, puTake2, puTake3, puTake4, puPub, provideContext, mountFragmentRef, FragmentInstance, hmr, HMR, hasPendingWork, type Scope, type Block, drainPassiveEffects, setIsOctaneActEnvironment, resetFloatResourceState, setTransitionFallbackTimeout, getTransitionFallbackTimeout, } from './runtime.js';
7
9
  export type { HydrateOptions, HydrateProps, HydrateWhen, HydrationInteractionEvent, HydrationInteractionEvents, HydrationPrefetchContext, HydrationPrefetchFunction, HydrationPrefetchStrategy, HydrationPrefetchWaitReason, HydrationStrategy, HydrationWhen, } from './hydration/types.js';
8
10
  export { __serverRpc } from './server-rpc-client.js';
9
11
  export { __methodDep } from './method-dep.js';
package/dist/index.js CHANGED
@@ -1,4 +1,5 @@
1
1
  import { version } from "./version.js";
2
+ import { StrictMode, unstable_batchedUpdates } from "./compatibility.js";
2
3
  import { initializeHydrationEventCapture } from "./hydration/event-capture.js";
3
4
  import { attachBehaviorRoot } from "./behavior-root.js";
4
5
  import {
@@ -26,6 +27,7 @@ import {
26
27
  useDeferredValue,
27
28
  useTransition,
28
29
  useActionState,
30
+ useActionState as useActionState2,
29
31
  useFormStatus,
30
32
  useOptimistic,
31
33
  useDebugValue,
@@ -58,6 +60,7 @@ import {
58
60
  cloneElement,
59
61
  isValidElement,
60
62
  isChildrenBlock,
63
+ descriptorChildren,
61
64
  Children,
62
65
  TsrxErrorBoundary,
63
66
  __useStateWithGetter,
@@ -170,9 +173,9 @@ import {
170
173
  compilerCacheContext,
171
174
  compilerOwnsContextProvider,
172
175
  markSingleRoot,
176
+ markWarm,
173
177
  markSingleRoot as markSingleRoot2,
174
178
  markChildrenBlock,
175
- descriptorChildren,
176
179
  createScopedValue,
177
180
  createScopedElement,
178
181
  childSlot,
@@ -185,6 +188,8 @@ import {
185
188
  portal,
186
189
  hookSlots,
187
190
  withSlot,
191
+ manualHook,
192
+ invokeManualHook,
188
193
  useBatch,
189
194
  seedOrCreate,
190
195
  warmMemo,
@@ -220,6 +225,7 @@ export {
220
225
  HMR,
221
226
  HYDRATION_RANGE_BOUNDARY,
222
227
  Hydrate,
228
+ StrictMode,
223
229
  Suspense,
224
230
  TsrxErrorBoundary,
225
231
  ViewTransition,
@@ -310,15 +316,18 @@ export {
310
316
  ifBlock,
311
317
  initializeHydrationEventCapture,
312
318
  injectStyle,
319
+ invokeManualHook,
313
320
  isChildrenBlock,
314
321
  isValidElement,
315
322
  keyedForBlock,
316
323
  lazy,
324
+ manualHook,
317
325
  mapSlot,
318
326
  markChildrenBlock,
319
327
  markDangerouslySetInnerHTMLChildren,
320
328
  markNativeChangeDiagnosticStatic,
321
329
  markSingleRoot,
330
+ markWarm,
322
331
  memo,
323
332
  mountFragmentRef,
324
333
  namespaceHead,
@@ -393,6 +402,7 @@ export {
393
402
  Activity2 as unstable_Activity,
394
403
  ViewTransition2 as unstable_ViewTransition,
395
404
  addTransitionType2 as unstable_addTransitionType,
405
+ unstable_batchedUpdates,
396
406
  use,
397
407
  useActionState,
398
408
  useBatch,
@@ -402,6 +412,7 @@ export {
402
412
  useDeferredValue,
403
413
  useEffect,
404
414
  useEffectEvent,
415
+ useActionState2 as useFormState,
405
416
  useFormStatus,
406
417
  useId,
407
418
  useImperativeHandle,
@@ -53,6 +53,10 @@ import type { ElementDescriptor, FragmentInstance } from './index.js';
53
53
  */
54
54
  export interface OctaneElement<P = any> extends ElementDescriptor<P> {}
55
55
 
56
+ export interface CSSProperties extends React.CSSProperties {
57
+ cssFloat?: React.CSSProperties['float'];
58
+ }
59
+
56
60
  export type ClassValue =
57
61
  | string
58
62
  | number
@@ -135,7 +139,7 @@ type Transformed<P, T> = Omit<P, ReactSyntheticProps | 'className' | 'style' | '
135
139
  className?: ClassValue;
136
140
  for?: string;
137
141
  xmlns?: string;
138
- style?: string | React.CSSProperties;
142
+ style?: string | CSSProperties;
139
143
  children?: unknown;
140
144
  };
141
145
 
@@ -177,6 +181,7 @@ declare namespace Octane {
177
181
  interface FieldsetHTMLAttributes<T> extends Transformed<React.FieldsetHTMLAttributes<T>, T> {}
178
182
  interface FormHTMLAttributes<T> extends Transformed<React.FormHTMLAttributes<T>, T> {}
179
183
  interface HTMLAttributes<T> extends Transformed<React.HTMLAttributes<T>, T> {}
184
+ interface AllHTMLAttributes<T> extends Transformed<React.AllHTMLAttributes<T>, T> {}
180
185
  interface HtmlHTMLAttributes<T> extends Transformed<React.HtmlHTMLAttributes<T>, T> {}
181
186
  interface IframeHTMLAttributes<T> extends Transformed<React.IframeHTMLAttributes<T>, T> {}
182
187
  interface ImgHTMLAttributes<T> extends Transformed<React.ImgHTMLAttributes<T>, T> {}
@@ -0,0 +1,188 @@
1
+ /** React-shaped type names describing Octane values and native DOM events. */
2
+ import type * as React from 'react';
3
+ import type { Octane } from './jsx-runtime.js';
4
+ import type { Activity, Context, ElementDescriptor, OctaneNode, PortalDescriptor, Suspense } from './runtime.js';
5
+ export type { JSX, Octane, OctaneElement, ClassValue, CSSProperties } from './jsx-runtime.js';
6
+ /** Migration alias. New Octane code should use OctaneNode. */
7
+ export type ReactNode = OctaneNode;
8
+ export type ReactElement<P = any, T extends ElementDescriptor<P>['type'] = ElementDescriptor<P>['type']> = ElementDescriptor<P> & {
9
+ type: T;
10
+ };
11
+ export type ReactPortal = PortalDescriptor;
12
+ export type FunctionComponentElement<P> = ReactElement<P, FunctionComponent<P>>;
13
+ export type DOMElement<P, T extends Element> = ReactElement<P, string> & {
14
+ ref?: Ref<T>;
15
+ };
16
+ export type DetailedReactHTMLElement<P extends HTMLAttributes<T>, T extends HTMLElement> = DOMElement<P, T>;
17
+ export type ReactHTMLElement<T extends HTMLElement> = DetailedReactHTMLElement<AllHTMLAttributes<T>, T>;
18
+ export type ReactSVGElement = DOMElement<SVGAttributes<SVGElement>, SVGElement>;
19
+ export type Key = Octane.Key;
20
+ export type Ref<T> = Octane.Ref<T>;
21
+ export type RefCallback<T> = React.RefCallback<T>;
22
+ export interface RefObject<T> {
23
+ current: T;
24
+ }
25
+ export interface MutableRefObject<T> {
26
+ current: T;
27
+ }
28
+ export type Attributes = Octane.Attributes;
29
+ export type RefAttributes<T> = Octane.RefAttributes<T>;
30
+ export type PropsWithChildren<P = unknown> = P & {
31
+ children?: OctaneNode;
32
+ };
33
+ export type PropsWithoutRef<P> = P extends unknown ? 'ref' extends keyof P ? Omit<P, 'ref'> : P : P;
34
+ export type PropsWithRef<P> = P;
35
+ export type SetStateAction<S> = S | ((previous: S) => S);
36
+ export type Dispatch<A> = (value: A) => void;
37
+ export type DispatchWithoutAction = () => void;
38
+ export type DependencyList = readonly unknown[];
39
+ export type EffectCallback = () => void | (() => void);
40
+ export type Destructor = () => void;
41
+ export type Reducer<S, A> = (state: S, action: A) => S;
42
+ export type ReducerWithoutAction<S> = (state: S) => S;
43
+ export type ReducerState<R extends Reducer<any, any>> = R extends Reducer<infer S, any> ? S : never;
44
+ export type ReducerAction<R extends Reducer<any, any>> = R extends Reducer<any, infer A> ? A : never;
45
+ export type ReducerStateWithoutAction<R extends ReducerWithoutAction<any>> = R extends ReducerWithoutAction<infer S> ? S : never;
46
+ export interface FunctionComponent<P = {}> {
47
+ (props: P): OctaneNode;
48
+ displayName?: string;
49
+ }
50
+ export type FC<P = {}> = FunctionComponent<P>;
51
+ export type ComponentType<P = {}> = FunctionComponent<P>;
52
+ /** Octane boundary and memo wrappers are callable components, without React branding. */
53
+ export type ExoticComponent<P = {}> = FunctionComponent<P>;
54
+ export type NamedExoticComponent<P = {}> = FunctionComponent<P>;
55
+ export type MemoExoticComponent<T extends ComponentType<any>> = FunctionComponent<ComponentProps<T>> & {
56
+ readonly type: T;
57
+ };
58
+ export type LazyExoticComponent<T extends ComponentType<any>> = FunctionComponent<ComponentProps<T>>;
59
+ export type JSXElementConstructor<P> = (props: P, ...args: any[]) => OctaneNode;
60
+ export type ElementType<P = any, Tag extends keyof Octane.JSX.IntrinsicElements = keyof Octane.JSX.IntrinsicElements> = {
61
+ [K in Tag]: P extends Octane.JSX.IntrinsicElements[K] ? K : never;
62
+ }[Tag] | ComponentType<P>;
63
+ export type ComponentProps<T extends keyof Octane.JSX.IntrinsicElements | JSXElementConstructor<any>> = T extends JSXElementConstructor<infer P> ? P : T extends keyof Octane.JSX.IntrinsicElements ? Octane.JSX.IntrinsicElements[T] : never;
64
+ export type ComponentPropsWithRef<T extends ElementType> = ComponentProps<T>;
65
+ export type ComponentPropsWithoutRef<T extends ElementType> = PropsWithoutRef<ComponentProps<T>>;
66
+ export type CustomComponentPropsWithRef<T extends ComponentType<any>> = ComponentProps<T>;
67
+ export type ComponentRef<T extends ElementType> = ComponentProps<T> extends {
68
+ ref?: Ref<infer Instance>;
69
+ } ? Instance : never;
70
+ export type ElementRef<T extends ElementType> = ComponentRef<T>;
71
+ export type ContextType<C extends Context<any>> = C extends Context<infer T> ? T : never;
72
+ export type Provider<T> = Context<T>['Provider'];
73
+ export interface ProviderProps<T> {
74
+ value: T;
75
+ children?: OctaneNode;
76
+ }
77
+ export type SuspenseProps = Parameters<typeof Suspense>[0];
78
+ export type ActivityProps = Parameters<typeof Activity>[0];
79
+ export interface StrictModeProps {
80
+ children?: OctaneNode;
81
+ }
82
+ export type AriaAttributes = React.AriaAttributes;
83
+ export type AriaRole = React.AriaRole;
84
+ export type HTMLInputTypeAttribute = React.HTMLInputTypeAttribute;
85
+ export type HTMLAttributeReferrerPolicy = React.HTMLAttributeReferrerPolicy;
86
+ export type HTMLAttributeAnchorTarget = React.HTMLAttributeAnchorTarget;
87
+ export type Booleanish = boolean | 'true' | 'false';
88
+ export type CrossOrigin = '' | 'anonymous' | 'use-credentials' | undefined;
89
+ export type DetailedHTMLProps<E, T> = Octane.DetailedHTMLProps<E, T>;
90
+ export type HTMLProps<T> = Octane.DetailedHTMLProps<Octane.AllHTMLAttributes<T>, T>;
91
+ export type SVGProps<T> = Octane.SVGProps<T>;
92
+ export type SVGLineElementAttributes<T> = Octane.SVGLineElementAttributes<T>;
93
+ export type SVGTextElementAttributes<T> = Octane.SVGTextElementAttributes<T>;
94
+ /** The currentTarget is the host whose listener is currently being invoked. */
95
+ export type NativeEvent<T = Element, E extends Event = Event> = E & {
96
+ currentTarget: T & EventTarget;
97
+ };
98
+ export type EventHandler<E extends Event> = {
99
+ bivarianceHack(event: E): void;
100
+ }['bivarianceHack'];
101
+ export type AnchorHTMLAttributes<T> = Octane.AnchorHTMLAttributes<T>;
102
+ export type AreaHTMLAttributes<T> = Octane.AreaHTMLAttributes<T>;
103
+ export type AudioHTMLAttributes<T> = Octane.AudioHTMLAttributes<T>;
104
+ export type BaseHTMLAttributes<T> = Octane.BaseHTMLAttributes<T>;
105
+ export type BlockquoteHTMLAttributes<T> = Octane.BlockquoteHTMLAttributes<T>;
106
+ export type ButtonHTMLAttributes<T> = Octane.ButtonHTMLAttributes<T>;
107
+ export type CanvasHTMLAttributes<T> = Octane.CanvasHTMLAttributes<T>;
108
+ export type ColHTMLAttributes<T> = Octane.ColHTMLAttributes<T>;
109
+ export type ColgroupHTMLAttributes<T> = Octane.ColgroupHTMLAttributes<T>;
110
+ export type DataHTMLAttributes<T> = Octane.DataHTMLAttributes<T>;
111
+ export type DelHTMLAttributes<T> = Octane.DelHTMLAttributes<T>;
112
+ export type DetailsHTMLAttributes<T> = Octane.DetailsHTMLAttributes<T>;
113
+ export type DialogHTMLAttributes<T> = Octane.DialogHTMLAttributes<T>;
114
+ export type EmbedHTMLAttributes<T> = Octane.EmbedHTMLAttributes<T>;
115
+ export type FieldsetHTMLAttributes<T> = Octane.FieldsetHTMLAttributes<T>;
116
+ export type FormHTMLAttributes<T> = Octane.FormHTMLAttributes<T>;
117
+ export type HTMLAttributes<T> = Octane.HTMLAttributes<T>;
118
+ export type AllHTMLAttributes<T> = Octane.AllHTMLAttributes<T>;
119
+ export type HtmlHTMLAttributes<T> = Octane.HtmlHTMLAttributes<T>;
120
+ export type IframeHTMLAttributes<T> = Octane.IframeHTMLAttributes<T>;
121
+ export type ImgHTMLAttributes<T> = Octane.ImgHTMLAttributes<T>;
122
+ export type InputHTMLAttributes<T> = Octane.InputHTMLAttributes<T>;
123
+ export type InsHTMLAttributes<T> = Octane.InsHTMLAttributes<T>;
124
+ export type KeygenHTMLAttributes<T> = Octane.KeygenHTMLAttributes<T>;
125
+ export type LabelHTMLAttributes<T> = Octane.LabelHTMLAttributes<T>;
126
+ export type LiHTMLAttributes<T> = Octane.LiHTMLAttributes<T>;
127
+ export type LinkHTMLAttributes<T> = Octane.LinkHTMLAttributes<T>;
128
+ export type MapHTMLAttributes<T> = Octane.MapHTMLAttributes<T>;
129
+ export type MenuHTMLAttributes<T> = Octane.MenuHTMLAttributes<T>;
130
+ export type MetaHTMLAttributes<T> = Octane.MetaHTMLAttributes<T>;
131
+ export type MeterHTMLAttributes<T> = Octane.MeterHTMLAttributes<T>;
132
+ export type ObjectHTMLAttributes<T> = Octane.ObjectHTMLAttributes<T>;
133
+ export type OlHTMLAttributes<T> = Octane.OlHTMLAttributes<T>;
134
+ export type OptgroupHTMLAttributes<T> = Octane.OptgroupHTMLAttributes<T>;
135
+ export type OptionHTMLAttributes<T> = Octane.OptionHTMLAttributes<T>;
136
+ export type OutputHTMLAttributes<T> = Octane.OutputHTMLAttributes<T>;
137
+ export type ParamHTMLAttributes<T> = Octane.ParamHTMLAttributes<T>;
138
+ export type ProgressHTMLAttributes<T> = Octane.ProgressHTMLAttributes<T>;
139
+ export type QuoteHTMLAttributes<T> = Octane.QuoteHTMLAttributes<T>;
140
+ export type SVGAttributes<T> = Octane.SVGAttributes<T>;
141
+ export type ScriptHTMLAttributes<T> = Octane.ScriptHTMLAttributes<T>;
142
+ export type SelectHTMLAttributes<T> = Octane.SelectHTMLAttributes<T>;
143
+ export type SlotHTMLAttributes<T> = Octane.SlotHTMLAttributes<T>;
144
+ export type SourceHTMLAttributes<T> = Octane.SourceHTMLAttributes<T>;
145
+ export type StyleHTMLAttributes<T> = Octane.StyleHTMLAttributes<T>;
146
+ export type TableHTMLAttributes<T> = Octane.TableHTMLAttributes<T>;
147
+ export type TdHTMLAttributes<T> = Octane.TdHTMLAttributes<T>;
148
+ export type TextareaHTMLAttributes<T> = Octane.TextareaHTMLAttributes<T>;
149
+ export type ThHTMLAttributes<T> = Octane.ThHTMLAttributes<T>;
150
+ export type TimeHTMLAttributes<T> = Octane.TimeHTMLAttributes<T>;
151
+ export type TrackHTMLAttributes<T> = Octane.TrackHTMLAttributes<T>;
152
+ export type VideoHTMLAttributes<T> = Octane.VideoHTMLAttributes<T>;
153
+ export type WebViewHTMLAttributes<T> = Octane.WebViewHTMLAttributes<T>;
154
+ export type ClipboardEvent<T = Element> = NativeEvent<T, globalThis.ClipboardEvent>;
155
+ export type ClipboardEventHandler<T = Element> = EventHandler<ClipboardEvent<T>>;
156
+ export type CompositionEvent<T = Element> = NativeEvent<T, globalThis.CompositionEvent>;
157
+ export type CompositionEventHandler<T = Element> = EventHandler<CompositionEvent<T>>;
158
+ export type DragEvent<T = Element> = NativeEvent<T, globalThis.DragEvent>;
159
+ export type DragEventHandler<T = Element> = EventHandler<DragEvent<T>>;
160
+ export type FocusEvent<T = Element> = NativeEvent<T, globalThis.FocusEvent>;
161
+ export type FocusEventHandler<T = Element> = EventHandler<FocusEvent<T>>;
162
+ export type FormEvent<T = Element> = NativeEvent<T, globalThis.Event>;
163
+ export type FormEventHandler<T = Element> = EventHandler<FormEvent<T>>;
164
+ export type ChangeEvent<T = Element> = NativeEvent<T, globalThis.Event>;
165
+ export type ChangeEventHandler<T = Element> = EventHandler<ChangeEvent<T>>;
166
+ export type InputEvent<T = Element> = NativeEvent<T, globalThis.InputEvent>;
167
+ export type InputEventHandler<T = Element> = EventHandler<InputEvent<T>>;
168
+ export type InvalidEvent<T = Element> = NativeEvent<T, globalThis.Event>;
169
+ export type InvalidEventHandler<T = Element> = EventHandler<InvalidEvent<T>>;
170
+ export type KeyboardEvent<T = Element> = NativeEvent<T, globalThis.KeyboardEvent>;
171
+ export type KeyboardEventHandler<T = Element> = EventHandler<KeyboardEvent<T>>;
172
+ export type MouseEvent<T = Element> = NativeEvent<T, globalThis.MouseEvent>;
173
+ export type MouseEventHandler<T = Element> = EventHandler<MouseEvent<T>>;
174
+ export type TouchEvent<T = Element> = NativeEvent<T, globalThis.TouchEvent>;
175
+ export type TouchEventHandler<T = Element> = EventHandler<TouchEvent<T>>;
176
+ export type PointerEvent<T = Element> = NativeEvent<T, globalThis.PointerEvent>;
177
+ export type PointerEventHandler<T = Element> = EventHandler<PointerEvent<T>>;
178
+ export type UIEvent<T = Element> = NativeEvent<T, globalThis.UIEvent>;
179
+ export type UIEventHandler<T = Element> = EventHandler<UIEvent<T>>;
180
+ export type WheelEvent<T = Element> = NativeEvent<T, globalThis.WheelEvent>;
181
+ export type WheelEventHandler<T = Element> = EventHandler<WheelEvent<T>>;
182
+ export type AnimationEvent<T = Element> = NativeEvent<T, globalThis.AnimationEvent>;
183
+ export type AnimationEventHandler<T = Element> = EventHandler<AnimationEvent<T>>;
184
+ export type TransitionEvent<T = Element> = NativeEvent<T, globalThis.TransitionEvent>;
185
+ export type TransitionEventHandler<T = Element> = EventHandler<TransitionEvent<T>>;
186
+ export type ToggleEvent<T = Element> = NativeEvent<T, globalThis.Event>;
187
+ export type ToggleEventHandler<T = Element> = EventHandler<ToggleEvent<T>>;
188
+ export type DOMAttributes<T> = Pick<Octane.HTMLAttributes<T>, Extract<keyof Octane.HTMLAttributes<T>, `on${string}`> | 'children' | 'dangerouslySetInnerHTML'>;
File without changes