@bleedingdev/tanstack-redact 0.0.0-stage → 0.2.2
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/LICENSE +21 -0
- package/dist/cloudflare/index.d.ts +6 -0
- package/dist/cloudflare/index.js +39 -0
- package/dist/cloudflare/index.js.map +7 -0
- package/dist/core/attributes.d.ts +4 -0
- package/dist/core/attributes.js +30 -0
- package/dist/core/attributes.js.map +7 -0
- package/dist/core/browser.d.ts +9 -0
- package/dist/core/browser.js +32 -0
- package/dist/core/browser.js.map +7 -0
- package/dist/core/class-props.d.ts +1 -0
- package/dist/core/class-props.js +15 -0
- package/dist/core/class-props.js.map +7 -0
- package/dist/core/devtools.d.ts +26 -0
- package/dist/core/devtools.js +70 -0
- package/dist/core/devtools.js.map +7 -0
- package/dist/core/functions.d.ts +6 -0
- package/dist/core/functions.js +14 -0
- package/dist/core/functions.js.map +7 -0
- package/dist/core/index.d.ts +2 -0
- package/dist/core/index.js +3 -0
- package/dist/core/index.js.map +7 -0
- package/dist/core/internal.d.ts +103 -0
- package/dist/core/internal.js +43 -0
- package/dist/core/internal.js.map +7 -0
- package/dist/core/resource-hints.d.ts +7 -0
- package/dist/core/resource-hints.js +20 -0
- package/dist/core/resource-hints.js.map +7 -0
- package/dist/core/types.d.ts +23 -0
- package/dist/core/types.js +8 -0
- package/dist/core/types.js.map +7 -0
- package/dist/core/unitless-style.d.ts +1 -0
- package/dist/core/unitless-style.js +5 -0
- package/dist/core/unitless-style.js.map +7 -0
- package/dist/dom/_all.d.ts +27 -0
- package/dist/dom/_all.js +51 -0
- package/dist/dom/_all.js.map +7 -0
- package/dist/dom/client.d.ts +9 -0
- package/dist/dom/client.js +13 -0
- package/dist/dom/client.js.map +7 -0
- package/dist/dom/commit.d.ts +27 -0
- package/dist/dom/commit.js +237 -0
- package/dist/dom/commit.js.map +7 -0
- package/dist/dom/devtools-effects.d.ts +8 -0
- package/dist/dom/devtools-effects.js +80 -0
- package/dist/dom/devtools-effects.js.map +7 -0
- package/dist/dom/devtools.d.ts +33 -0
- package/dist/dom/devtools.js +635 -0
- package/dist/dom/devtools.js.map +7 -0
- package/dist/dom/dispatcher.d.ts +4 -0
- package/dist/dom/dispatcher.js +437 -0
- package/dist/dom/dispatcher.js.map +7 -0
- package/dist/dom/document-metadata.d.ts +7 -0
- package/dist/dom/document-metadata.js +44 -0
- package/dist/dom/document-metadata.js.map +7 -0
- package/dist/dom/dom.d.ts +11 -0
- package/dist/dom/dom.js +165 -0
- package/dist/dom/dom.js.map +7 -0
- package/dist/dom/error-info.d.ts +2 -0
- package/dist/dom/error-info.js +19 -0
- package/dist/dom/error-info.js.map +7 -0
- package/dist/dom/event-replay.d.ts +13 -0
- package/dist/dom/event-replay.js +24 -0
- package/dist/dom/event-replay.js.map +7 -0
- package/dist/dom/features/activity/full.d.ts +1 -0
- package/dist/dom/features/activity/full.js +140 -0
- package/dist/dom/features/activity/full.js.map +7 -0
- package/dist/dom/features/activity/index.d.ts +1 -0
- package/dist/dom/features/activity/index.js +2 -0
- package/dist/dom/features/activity/index.js.map +7 -0
- package/dist/dom/features/activity/stub.d.ts +1 -0
- package/dist/dom/features/activity/stub.js +10 -0
- package/dist/dom/features/activity/stub.js.map +7 -0
- package/dist/dom/features/class/full.d.ts +1 -0
- package/dist/dom/features/class/full.js +208 -0
- package/dist/dom/features/class/full.js.map +7 -0
- package/dist/dom/features/class/index.d.ts +1 -0
- package/dist/dom/features/class/index.js +2 -0
- package/dist/dom/features/class/index.js.map +7 -0
- package/dist/dom/features/class/stub.d.ts +1 -0
- package/dist/dom/features/class/stub.js +46 -0
- package/dist/dom/features/class/stub.js.map +7 -0
- package/dist/dom/features/context/full.d.ts +4 -0
- package/dist/dom/features/context/full.js +103 -0
- package/dist/dom/features/context/full.js.map +7 -0
- package/dist/dom/features/context/index.d.ts +1 -0
- package/dist/dom/features/context/index.js +2 -0
- package/dist/dom/features/context/index.js.map +7 -0
- package/dist/dom/features/context/stub.d.ts +4 -0
- package/dist/dom/features/context/stub.js +21 -0
- package/dist/dom/features/context/stub.js.map +7 -0
- package/dist/dom/features/forward-ref/full.d.ts +1 -0
- package/dist/dom/features/forward-ref/full.js +9 -0
- package/dist/dom/features/forward-ref/full.js.map +7 -0
- package/dist/dom/features/forward-ref/index.d.ts +1 -0
- package/dist/dom/features/forward-ref/index.js +2 -0
- package/dist/dom/features/forward-ref/index.js.map +7 -0
- package/dist/dom/features/forward-ref/stub.d.ts +1 -0
- package/dist/dom/features/forward-ref/stub.js +9 -0
- package/dist/dom/features/forward-ref/stub.js.map +7 -0
- package/dist/dom/features/fragment-refs/index.d.ts +1 -0
- package/dist/dom/features/fragment-refs/index.js +9 -0
- package/dist/dom/features/fragment-refs/index.js.map +7 -0
- package/dist/dom/features/fragment-refs/stub.d.ts +5 -0
- package/dist/dom/features/fragment-refs/stub.js +17 -0
- package/dist/dom/features/fragment-refs/stub.js.map +7 -0
- package/dist/dom/features/hydration/full.d.ts +68 -0
- package/dist/dom/features/hydration/full.js +493 -0
- package/dist/dom/features/hydration/full.js.map +7 -0
- package/dist/dom/features/hydration/index.d.ts +1 -0
- package/dist/dom/features/hydration/index.js +2 -0
- package/dist/dom/features/hydration/index.js.map +7 -0
- package/dist/dom/features/hydration/stub.d.ts +36 -0
- package/dist/dom/features/hydration/stub.js +80 -0
- package/dist/dom/features/hydration/stub.js.map +7 -0
- package/dist/dom/features/index.d.ts +8 -0
- package/dist/dom/features/index.js +9 -0
- package/dist/dom/features/index.js.map +7 -0
- package/dist/dom/features/lazy/full.d.ts +1 -0
- package/dist/dom/features/lazy/full.js +23 -0
- package/dist/dom/features/lazy/full.js.map +7 -0
- package/dist/dom/features/lazy/index.d.ts +1 -0
- package/dist/dom/features/lazy/index.js +2 -0
- package/dist/dom/features/lazy/index.js.map +7 -0
- package/dist/dom/features/lazy/stub.d.ts +1 -0
- package/dist/dom/features/lazy/stub.js +19 -0
- package/dist/dom/features/lazy/stub.js.map +7 -0
- package/dist/dom/features/memo/full.d.ts +1 -0
- package/dist/dom/features/memo/full.js +34 -0
- package/dist/dom/features/memo/full.js.map +7 -0
- package/dist/dom/features/memo/index.d.ts +1 -0
- package/dist/dom/features/memo/index.js +2 -0
- package/dist/dom/features/memo/index.js.map +7 -0
- package/dist/dom/features/memo/stub.d.ts +1 -0
- package/dist/dom/features/memo/stub.js +9 -0
- package/dist/dom/features/memo/stub.js.map +7 -0
- package/dist/dom/features/portal/full.d.ts +1 -0
- package/dist/dom/features/portal/full.js +11 -0
- package/dist/dom/features/portal/full.js.map +7 -0
- package/dist/dom/features/portal/index.d.ts +1 -0
- package/dist/dom/features/portal/index.js +2 -0
- package/dist/dom/features/portal/index.js.map +7 -0
- package/dist/dom/features/portal/stub.d.ts +1 -0
- package/dist/dom/features/portal/stub.js +5 -0
- package/dist/dom/features/portal/stub.js.map +7 -0
- package/dist/dom/features/suspense/full.d.ts +1 -0
- package/dist/dom/features/suspense/full.js +389 -0
- package/dist/dom/features/suspense/full.js.map +7 -0
- package/dist/dom/features/suspense/index.d.ts +1 -0
- package/dist/dom/features/suspense/index.js +2 -0
- package/dist/dom/features/suspense/index.js.map +7 -0
- package/dist/dom/features/suspense/stub.d.ts +1 -0
- package/dist/dom/features/suspense/stub.js +4 -0
- package/dist/dom/features/suspense/stub.js.map +7 -0
- package/dist/dom/features/suspense-runtime/index.d.ts +1 -0
- package/dist/dom/features/suspense-runtime/index.js +2 -0
- package/dist/dom/features/suspense-runtime/index.js.map +7 -0
- package/dist/dom/features/suspense-runtime/stub.d.ts +1 -0
- package/dist/dom/features/suspense-runtime/stub.js +11 -0
- package/dist/dom/features/suspense-runtime/stub.js.map +7 -0
- package/dist/dom/features/view-transition/full.d.ts +7 -0
- package/dist/dom/features/view-transition/full.js +324 -0
- package/dist/dom/features/view-transition/full.js.map +7 -0
- package/dist/dom/features/view-transition/index.d.ts +1 -0
- package/dist/dom/features/view-transition/index.js +2 -0
- package/dist/dom/features/view-transition/index.js.map +7 -0
- package/dist/dom/features/view-transition/resources.d.ts +11 -0
- package/dist/dom/features/view-transition/resources.js +117 -0
- package/dist/dom/features/view-transition/resources.js.map +7 -0
- package/dist/dom/features/view-transition/stub.d.ts +7 -0
- package/dist/dom/features/view-transition/stub.js +21 -0
- package/dist/dom/features/view-transition/stub.js.map +7 -0
- package/dist/dom/features/view-transition/visual.d.ts +14 -0
- package/dist/dom/features/view-transition/visual.js +404 -0
- package/dist/dom/features/view-transition/visual.js.map +7 -0
- package/dist/dom/form-actions.d.ts +4 -0
- package/dist/dom/form-actions.js +74 -0
- package/dist/dom/form-actions.js.map +7 -0
- package/dist/dom/form-controls.d.ts +3 -0
- package/dist/dom/form-controls.js +91 -0
- package/dist/dom/form-controls.js.map +7 -0
- package/dist/dom/fragment-instance.d.ts +33 -0
- package/dist/dom/fragment-instance.js +449 -0
- package/dist/dom/fragment-instance.js.map +7 -0
- package/dist/dom/index.d.ts +61 -0
- package/dist/dom/index.js +71 -0
- package/dist/dom/index.js.map +7 -0
- package/dist/dom/portal.d.ts +2 -0
- package/dist/dom/portal.js +14 -0
- package/dist/dom/portal.js.map +7 -0
- package/dist/dom/react-ids.d.ts +6 -0
- package/dist/dom/react-ids.js +38 -0
- package/dist/dom/react-ids.js.map +7 -0
- package/dist/dom/reconcile.d.ts +86 -0
- package/dist/dom/reconcile.js +1305 -0
- package/dist/dom/reconcile.js.map +7 -0
- package/dist/dom/refresh.d.ts +12 -0
- package/dist/dom/refresh.js +174 -0
- package/dist/dom/refresh.js.map +7 -0
- package/dist/dom/resource-hints.d.ts +6 -0
- package/dist/dom/resource-hints.js +107 -0
- package/dist/dom/resource-hints.js.map +7 -0
- package/dist/dom/resource-store.d.ts +13 -0
- package/dist/dom/resource-store.js +47 -0
- package/dist/dom/resource-store.js.map +7 -0
- package/dist/dom/resources.d.ts +1 -0
- package/dist/dom/resources.js +46 -0
- package/dist/dom/resources.js.map +7 -0
- package/dist/dom/retained-effects.d.ts +6 -0
- package/dist/dom/retained-effects.js +67 -0
- package/dist/dom/retained-effects.js.map +7 -0
- package/dist/dom/root-internal.d.ts +11 -0
- package/dist/dom/root-internal.js +35 -0
- package/dist/dom/root-internal.js.map +7 -0
- package/dist/dom/root.d.ts +17 -0
- package/dist/dom/root.js +38 -0
- package/dist/dom/root.js.map +7 -0
- package/dist/dom/synthetic-event.d.ts +1 -0
- package/dist/dom/synthetic-event.js +37 -0
- package/dist/dom/synthetic-event.js.map +7 -0
- package/dist/dom/test-utils.d.ts +1 -0
- package/dist/dom/test-utils.js +5 -0
- package/dist/dom/test-utils.js.map +7 -0
- package/dist/dom/transitions.d.ts +9 -0
- package/dist/dom/transitions.js +147 -0
- package/dist/dom/transitions.js.map +7 -0
- package/dist/dom/tree.d.ts +5 -0
- package/dist/dom/tree.js +62 -0
- package/dist/dom/tree.js.map +7 -0
- package/dist/dom/walk.d.ts +2 -0
- package/dist/dom/walk.js +14 -0
- package/dist/dom/walk.js.map +7 -0
- package/dist/next/client.d.ts +9 -0
- package/dist/next/client.js +14 -0
- package/dist/next/client.js.map +7 -0
- package/dist/next/dev-cache-loader.cjs +13 -0
- package/dist/next/index.d.ts +2 -0
- package/dist/next/index.js +97 -0
- package/dist/next/index.js.map +7 -0
- package/dist/next/loader.cjs +10 -0
- package/dist/next/react.d.ts +71 -0
- package/dist/next/react.js +9 -0
- package/dist/next/react.js.map +7 -0
- package/dist/react/act.d.ts +3 -0
- package/dist/react/act.js +124 -0
- package/dist/react/act.js.map +7 -0
- package/dist/react/action-scope.d.ts +17 -0
- package/dist/react/action-scope.js +60 -0
- package/dist/react/action-scope.js.map +7 -0
- package/dist/react/activity.d.ts +7 -0
- package/dist/react/activity.js +7 -0
- package/dist/react/activity.js.map +7 -0
- package/dist/react/children.d.ts +8 -0
- package/dist/react/children.js +76 -0
- package/dist/react/children.js.map +7 -0
- package/dist/react/class.d.ts +36 -0
- package/dist/react/class.js +39 -0
- package/dist/react/class.js.map +7 -0
- package/dist/react/compiler-runtime.d.ts +1 -0
- package/dist/react/compiler-runtime.js +9 -0
- package/dist/react/compiler-runtime.js.map +7 -0
- package/dist/react/context.d.ts +32 -0
- package/dist/react/context.js +25 -0
- package/dist/react/context.js.map +7 -0
- package/dist/react/element.d.ts +13 -0
- package/dist/react/element.js +70 -0
- package/dist/react/element.js.map +7 -0
- package/dist/react/form-state.d.ts +26 -0
- package/dist/react/form-state.js +30 -0
- package/dist/react/form-state.js.map +7 -0
- package/dist/react/hooks.d.ts +67 -0
- package/dist/react/hooks.js +165 -0
- package/dist/react/hooks.js.map +7 -0
- package/dist/react/index.d.ts +99 -0
- package/dist/react/index.js +143 -0
- package/dist/react/index.js.map +7 -0
- package/dist/react/jsx-runtime.d.ts +24 -0
- package/dist/react/jsx-runtime.js +37 -0
- package/dist/react/jsx-runtime.js.map +7 -0
- package/dist/react/memo.d.ts +20 -0
- package/dist/react/memo.js +27 -0
- package/dist/react/memo.js.map +7 -0
- package/dist/react/portal.d.ts +1 -0
- package/dist/react/portal.js +5 -0
- package/dist/react/portal.js.map +7 -0
- package/dist/react/shared-internals.d.ts +52 -0
- package/dist/react/shared-internals.js +22 -0
- package/dist/react/shared-internals.js.map +7 -0
- package/dist/react/suspense.d.ts +15 -0
- package/dist/react/suspense.js +15 -0
- package/dist/react/suspense.js.map +7 -0
- package/dist/react/thenable.d.ts +1 -0
- package/dist/react/thenable.js +25 -0
- package/dist/react/thenable.js.map +7 -0
- package/dist/react/view-transition.d.ts +32 -0
- package/dist/react/view-transition.js +12 -0
- package/dist/react/view-transition.js.map +7 -0
- package/dist/scheduler/index.d.ts +44 -0
- package/dist/scheduler/index.js +109 -0
- package/dist/scheduler/index.js.map +7 -0
- package/dist/server/bootstrap-script.d.ts +3 -0
- package/dist/server/bootstrap-script.js +17 -0
- package/dist/server/bootstrap-script.js.map +7 -0
- package/dist/server/dispatcher.d.ts +57 -0
- package/dist/server/dispatcher.js +157 -0
- package/dist/server/dispatcher.js.map +7 -0
- package/dist/server/escape.d.ts +6 -0
- package/dist/server/escape.js +75 -0
- package/dist/server/escape.js.map +7 -0
- package/dist/server/index.d.ts +16 -0
- package/dist/server/index.js +25 -0
- package/dist/server/index.js.map +7 -0
- package/dist/server/insertion-context.d.ts +3 -0
- package/dist/server/insertion-context.js +32 -0
- package/dist/server/renderToString.d.ts +7 -0
- package/dist/server/renderToString.js +33 -0
- package/dist/server/renderToString.js.map +7 -0
- package/dist/server/resource-hints.d.ts +22 -0
- package/dist/server/resource-hints.js +168 -0
- package/dist/server/resource-hints.js.map +7 -0
- package/dist/server/stream-ids.d.ts +3 -0
- package/dist/server/stream-ids.js +8 -0
- package/dist/server/stream.d.ts +61 -0
- package/dist/server/stream.js +418 -0
- package/dist/server/stream.js.map +7 -0
- package/dist/server/walk.d.ts +58 -0
- package/dist/server/walk.js +378 -0
- package/dist/server/walk.js.map +7 -0
- package/dist/vinext/compatibility.d.ts +23 -0
- package/dist/vinext/compatibility.js +127 -0
- package/dist/vinext/compatibility.js.map +7 -0
- package/dist/vinext/flight-timing.d.ts +1 -0
- package/dist/vinext/flight-timing.js +46 -0
- package/dist/vinext/flight-timing.js.map +7 -0
- package/dist/vinext/index.d.ts +5 -0
- package/dist/vinext/index.js +50 -0
- package/dist/vinext/index.js.map +7 -0
- package/dist/vite/index.d.ts +102 -0
- package/dist/vite/index.js +291 -0
- package/dist/vite/index.js.map +7 -0
- package/dist/vite/react18.d.ts +4 -0
- package/dist/vite/react18.js +74 -0
- package/dist/vite/react18.js.map +7 -0
- package/package.json +121 -4
- package/src/cloudflare/index.ts +44 -0
- package/src/core/attributes.ts +20 -0
- package/src/core/browser.ts +34 -0
- package/src/core/class-props.ts +12 -0
- package/src/core/devtools.ts +69 -0
- package/src/core/functions.ts +11 -0
- package/src/core/index.ts +2 -0
- package/src/core/internal.ts +123 -0
- package/src/core/resource-hints.ts +39 -0
- package/src/core/types.ts +39 -0
- package/src/core/unitless-style.ts +1 -0
- package/src/dom/_all.ts +46 -0
- package/src/dom/client.ts +17 -0
- package/src/dom/commit.ts +223 -0
- package/src/dom/devtools-effects.ts +78 -0
- package/src/dom/devtools.ts +527 -0
- package/src/dom/dispatcher.ts +476 -0
- package/src/dom/document-metadata.ts +41 -0
- package/src/dom/dom.ts +181 -0
- package/src/dom/error-info.ts +20 -0
- package/src/dom/event-replay.ts +39 -0
- package/src/dom/features/activity/full.ts +150 -0
- package/src/dom/features/activity/index.ts +1 -0
- package/src/dom/features/activity/stub.ts +12 -0
- package/src/dom/features/class/full.ts +202 -0
- package/src/dom/features/class/index.ts +1 -0
- package/src/dom/features/class/stub.ts +58 -0
- package/src/dom/features/context/full.ts +107 -0
- package/src/dom/features/context/index.ts +1 -0
- package/src/dom/features/context/stub.ts +26 -0
- package/src/dom/features/forward-ref/full.ts +9 -0
- package/src/dom/features/forward-ref/index.ts +1 -0
- package/src/dom/features/forward-ref/stub.ts +15 -0
- package/src/dom/features/fragment-refs/index.ts +1 -0
- package/src/dom/features/fragment-refs/stub.ts +6 -0
- package/src/dom/features/hydration/full.ts +563 -0
- package/src/dom/features/hydration/index.ts +1 -0
- package/src/dom/features/hydration/stub.ts +86 -0
- package/src/dom/features/index.ts +12 -0
- package/src/dom/features/lazy/full.ts +27 -0
- package/src/dom/features/lazy/index.ts +1 -0
- package/src/dom/features/lazy/stub.ts +24 -0
- package/src/dom/features/memo/full.ts +39 -0
- package/src/dom/features/memo/index.ts +1 -0
- package/src/dom/features/memo/stub.ts +13 -0
- package/src/dom/features/portal/full.ts +14 -0
- package/src/dom/features/portal/index.ts +1 -0
- package/src/dom/features/portal/stub.ts +11 -0
- package/src/dom/features/suspense/full.ts +469 -0
- package/src/dom/features/suspense/index.ts +1 -0
- package/src/dom/features/suspense/stub.ts +13 -0
- package/src/dom/features/suspense-runtime/index.ts +1 -0
- package/src/dom/features/suspense-runtime/stub.ts +1 -0
- package/src/dom/features/view-transition/full.ts +292 -0
- package/src/dom/features/view-transition/index.ts +1 -0
- package/src/dom/features/view-transition/resources.ts +123 -0
- package/src/dom/features/view-transition/stub.ts +8 -0
- package/src/dom/features/view-transition/visual.ts +454 -0
- package/src/dom/form-actions.ts +69 -0
- package/src/dom/form-controls.ts +91 -0
- package/src/dom/fragment-instance.ts +462 -0
- package/src/dom/index.ts +49 -0
- package/src/dom/portal.ts +16 -0
- package/src/dom/react-ids.ts +36 -0
- package/src/dom/reconcile.ts +1423 -0
- package/src/dom/refresh.ts +171 -0
- package/src/dom/resource-hints.ts +104 -0
- package/src/dom/resource-store.ts +50 -0
- package/src/dom/resources.ts +47 -0
- package/src/dom/retained-effects.ts +57 -0
- package/src/dom/root-internal.ts +37 -0
- package/src/dom/root.ts +59 -0
- package/src/dom/synthetic-event.ts +27 -0
- package/src/dom/test-utils.ts +1 -0
- package/src/dom/transitions.ts +141 -0
- package/src/dom/tree.ts +56 -0
- package/src/dom/walk.ts +8 -0
- package/src/next/client.ts +10 -0
- package/src/next/dev-cache-loader.cjs +13 -0
- package/src/next/index.ts +95 -0
- package/src/next/loader.cjs +10 -0
- package/src/next/react.ts +7 -0
- package/src/react/act.ts +105 -0
- package/src/react/action-scope.ts +57 -0
- package/src/react/activity.ts +10 -0
- package/src/react/children.ts +86 -0
- package/src/react/class.ts +66 -0
- package/src/react/compiler-runtime.ts +8 -0
- package/src/react/context.ts +46 -0
- package/src/react/element.ts +82 -0
- package/src/react/form-state.ts +35 -0
- package/src/react/hooks.ts +214 -0
- package/src/react/index.ts +91 -0
- package/src/react/jsx-runtime.ts +50 -0
- package/src/react/memo.ts +42 -0
- package/src/react/portal.ts +1 -0
- package/src/react/shared-internals.ts +80 -0
- package/src/react/suspense.ts +18 -0
- package/src/react/thenable.ts +21 -0
- package/src/react/view-transition.ts +41 -0
- package/src/scheduler/index.ts +124 -0
- package/src/server/bootstrap-script.ts +92 -0
- package/src/server/dispatcher.ts +168 -0
- package/src/server/escape.ts +102 -0
- package/src/server/index.ts +26 -0
- package/src/server/insertion-context.ts +28 -0
- package/src/server/renderToString.ts +35 -0
- package/src/server/resource-hints.ts +166 -0
- package/src/server/stream-ids.ts +5 -0
- package/src/server/stream.ts +525 -0
- package/src/server/walk.ts +555 -0
- package/src/vinext/compatibility.ts +122 -0
- package/src/vinext/flight-timing.ts +37 -0
- package/src/vinext/index.ts +47 -0
- package/src/vite/index.ts +476 -0
- package/src/vite/react18.ts +74 -0
- package/vendor/cloudflare-vite-plugin/LICENSE +25 -0
- package/vendor/cloudflare-vite-plugin/README.md +9 -0
- package/vendor/cloudflare-vite-plugin/dist/chunk-U6NEESU5-BmLHqeIt.mjs +43 -0
- package/vendor/cloudflare-vite-plugin/dist/index.d.mts +155 -0
- package/vendor/cloudflare-vite-plugin/dist/index.mjs +94700 -0
- package/vendor/cloudflare-vite-plugin/dist/open-PCXX3ZDZ-DYH87NhH.mjs +530 -0
- package/vendor/cloudflare-vite-plugin/dist/package-4cnqy5mM.mjs +84 -0
- package/vendor/cloudflare-vite-plugin/dist/workers/asset-worker/index.js +5996 -0
- package/vendor/cloudflare-vite-plugin/dist/workers/router-worker/index.js +6414 -0
- package/vendor/cloudflare-vite-plugin/dist/workers/runner-worker/index.js +457 -0
- package/vendor/cloudflare-vite-plugin/dist/workers/runner-worker/module-runner-legacy.js +1129 -0
- package/vendor/cloudflare-vite-plugin/dist/workers/runner-worker/module-runner.js +1259 -0
- package/vendor/cloudflare-vite-plugin/dist/workers/vite-proxy-worker/index.js +31 -0
- package/vendor/cloudflare-vite-plugin/package.json +90 -0
- package/vendor/cloudflare-vite-plugin/provenance.json +26 -0
- package/README.md +0 -3
|
@@ -0,0 +1,462 @@
|
|
|
1
|
+
import { isString } from "../core/functions";
|
|
2
|
+
import { findRoot, getCurrentRoot, isActivityHidden, attachRef, detachRef, invokeCommit, type LayoutCommit } from './reconcile';
|
|
3
|
+
import { FiberTag, REACT_FRAGMENT_TYPE, type Fiber, type FiberRoot } from '../core';
|
|
4
|
+
import { isObject } from '../core/functions';
|
|
5
|
+
type Listener = EventListenerOrEventListenerObject;
|
|
6
|
+
type Observer = IntersectionObserver | ResizeObserver;
|
|
7
|
+
type OwnedNode = Node & {
|
|
8
|
+
reactFragments?: Set<FragmentInstance>;
|
|
9
|
+
};
|
|
10
|
+
type Registration = {
|
|
11
|
+
t: string;
|
|
12
|
+
l: Listener;
|
|
13
|
+
a: Listener;
|
|
14
|
+
c: boolean;
|
|
15
|
+
o: AddEventListenerOptions;
|
|
16
|
+
d?: () => void;
|
|
17
|
+
};
|
|
18
|
+
const instances = new WeakMap<FiberRoot, Set<FragmentInstance>>();
|
|
19
|
+
function siblings(fiber: Fiber, parent: Fiber | null): [
|
|
20
|
+
Node | null,
|
|
21
|
+
Node | null
|
|
22
|
+
] {
|
|
23
|
+
let previous: Node | null = null;
|
|
24
|
+
let next: Node | null = null;
|
|
25
|
+
let found = false;
|
|
26
|
+
function visit(parent: Fiber): void {
|
|
27
|
+
for (let child = parent.c; child && !next; child = child.s) {
|
|
28
|
+
if (child === fiber)
|
|
29
|
+
found = true;
|
|
30
|
+
else if (child.t <= FiberTag.Text) {
|
|
31
|
+
if (found)
|
|
32
|
+
next = node(child);
|
|
33
|
+
else
|
|
34
|
+
previous = node(child);
|
|
35
|
+
}
|
|
36
|
+
else if (!isActivityHidden(child))
|
|
37
|
+
visit(child);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
if (parent)
|
|
41
|
+
visit(parent);
|
|
42
|
+
return [previous, next];
|
|
43
|
+
}
|
|
44
|
+
const node = (fiber: Fiber): Node => (fiber.t === FiberTag.Root ? fiber.r!.c : fiber.n!);
|
|
45
|
+
function containsFiber(parent: Fiber, child: Fiber | null): boolean {
|
|
46
|
+
for (; child; child = child.p)
|
|
47
|
+
if (child === parent)
|
|
48
|
+
return true;
|
|
49
|
+
return false;
|
|
50
|
+
}
|
|
51
|
+
export function placeFragmentCommits(fiber: Fiber, entries: LayoutCommit[], pendingCommits: LayoutCommit[]): boolean | void {
|
|
52
|
+
if (fiber.type !== REACT_FRAGMENT_TYPE)
|
|
53
|
+
return;
|
|
54
|
+
// React attaches Fragment refs before their descendants. Only referenced
|
|
55
|
+
// Fragments need to locate this insertion point among queued commits.
|
|
56
|
+
let index = pendingCommits.findIndex(([child]) => containsFiber(fiber, child.p));
|
|
57
|
+
if (index < 0)
|
|
58
|
+
index = pendingCommits.length;
|
|
59
|
+
if (index < pendingCommits.length && currentCommit?.c.length) {
|
|
60
|
+
const count = entries.length;
|
|
61
|
+
onCommitRollback(() => { pendingCommits.splice(index, count); });
|
|
62
|
+
}
|
|
63
|
+
pendingCommits.splice(index, 0, ...entries);
|
|
64
|
+
return true;
|
|
65
|
+
}
|
|
66
|
+
export class FragmentInstance {
|
|
67
|
+
#nodes = new Set<OwnedNode>();
|
|
68
|
+
#listeners: Registration[] = [];
|
|
69
|
+
#observers = new Set<Observer>();
|
|
70
|
+
#pending = new Map<Observer, Set<Element>>();
|
|
71
|
+
#children: Node[] = [];
|
|
72
|
+
#ordered: Fiber[] = [];
|
|
73
|
+
#parent: Node | null = null;
|
|
74
|
+
#adjacent: [
|
|
75
|
+
Node | null,
|
|
76
|
+
Node | null
|
|
77
|
+
] = [null, null];
|
|
78
|
+
#portalContainer: Node | null = null;
|
|
79
|
+
#fiber: Fiber;
|
|
80
|
+
constructor(fiber: Fiber) { this.#fiber = fiber; }
|
|
81
|
+
refresh(ordered: Fiber[]): void {
|
|
82
|
+
this.#children = hosts(this.#fiber).map(node);
|
|
83
|
+
let parent = this.#fiber.p;
|
|
84
|
+
this.#portalContainer = null;
|
|
85
|
+
for (; parent; parent = parent.p) {
|
|
86
|
+
if (parent.t === FiberTag.Host || parent.t === FiberTag.Root)
|
|
87
|
+
break;
|
|
88
|
+
if (parent.t === FiberTag.Portal && !this.#portalContainer)
|
|
89
|
+
this.#portalContainer = parent.m.container;
|
|
90
|
+
}
|
|
91
|
+
this.#parent = parent && node(parent);
|
|
92
|
+
this.#adjacent = siblings(this.#fiber, parent);
|
|
93
|
+
this.#ordered = ordered;
|
|
94
|
+
const current = new Set(this.#children);
|
|
95
|
+
for (const child of this.#nodes)
|
|
96
|
+
if (!current.has(child))
|
|
97
|
+
this.update(child, false);
|
|
98
|
+
for (const child of current)
|
|
99
|
+
this.update(child, true);
|
|
100
|
+
}
|
|
101
|
+
/** Renderer hook, called only for first-level host insertion/removal. */
|
|
102
|
+
update(child: OwnedNode, adding: boolean): void {
|
|
103
|
+
if (adding === this.#nodes.has(child))
|
|
104
|
+
return;
|
|
105
|
+
if (adding) {
|
|
106
|
+
this.#nodes.add(child);
|
|
107
|
+
(child.reactFragments ??= new Set()).add(this);
|
|
108
|
+
}
|
|
109
|
+
else {
|
|
110
|
+
this.#nodes.delete(child);
|
|
111
|
+
child.reactFragments?.delete(this);
|
|
112
|
+
}
|
|
113
|
+
for (const entry of this.#listeners) {
|
|
114
|
+
if (adding)
|
|
115
|
+
child.addEventListener(entry.t, entry.a, entry.o);
|
|
116
|
+
else
|
|
117
|
+
child.removeEventListener(entry.t, entry.a, entry.c);
|
|
118
|
+
}
|
|
119
|
+
if (child.nodeType !== 1)
|
|
120
|
+
return;
|
|
121
|
+
for (const observer of this.#observers) {
|
|
122
|
+
if (adding) {
|
|
123
|
+
this.#pending.get(observer)?.delete(child as Element);
|
|
124
|
+
observer.observe(child as Element);
|
|
125
|
+
}
|
|
126
|
+
else if (isString((observer as IntersectionObserver).rootMargin)) {
|
|
127
|
+
let pending = this.#pending.get(observer);
|
|
128
|
+
if (!pending) {
|
|
129
|
+
this.#pending.set(observer, pending = new Set());
|
|
130
|
+
const flush = () => {
|
|
131
|
+
for (const element of pending!)
|
|
132
|
+
observer.unobserve(element);
|
|
133
|
+
if (this.#pending.get(observer) === pending)
|
|
134
|
+
this.#pending.delete(observer);
|
|
135
|
+
};
|
|
136
|
+
const frame = child.ownerDocument?.defaultView?.requestAnimationFrame;
|
|
137
|
+
if (frame)
|
|
138
|
+
frame(() => frame(flush));
|
|
139
|
+
else
|
|
140
|
+
queueMicrotask(flush);
|
|
141
|
+
}
|
|
142
|
+
pending.add(child as Element);
|
|
143
|
+
}
|
|
144
|
+
else
|
|
145
|
+
observer.unobserve(child as Element);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
addEventListener(type: string, listener: Listener | null, options?: boolean | AddEventListenerOptions): void {
|
|
149
|
+
if (!listener)
|
|
150
|
+
return;
|
|
151
|
+
const opts = typeof options === 'boolean' ? { capture: options } : options ?? {};
|
|
152
|
+
const capture = !!opts.capture;
|
|
153
|
+
if (opts.signal?.aborted || this.#listeners.some((entry) => entry.t === type && entry.l === listener && entry.c === capture))
|
|
154
|
+
return;
|
|
155
|
+
const instance = this;
|
|
156
|
+
const entry: Registration = {
|
|
157
|
+
t: type, l: listener, c: capture,
|
|
158
|
+
o: opts.passive === undefined ? { capture } : { capture, passive: opts.passive },
|
|
159
|
+
a: opts.once ? function (this: EventTarget, event: Event) {
|
|
160
|
+
instance.removeEventListener(type, listener, capture);
|
|
161
|
+
if (isFunction(listener))
|
|
162
|
+
listener.call(this, event);
|
|
163
|
+
else
|
|
164
|
+
listener.handleEvent(event);
|
|
165
|
+
} : listener,
|
|
166
|
+
};
|
|
167
|
+
if (opts.signal) {
|
|
168
|
+
const abort = () => this.removeEventListener(type, listener, capture);
|
|
169
|
+
opts.signal.addEventListener('abort', abort, { once: true });
|
|
170
|
+
entry.d = () => opts.signal!.removeEventListener('abort', abort);
|
|
171
|
+
}
|
|
172
|
+
this.#listeners.push(entry);
|
|
173
|
+
for (const child of this.#nodes)
|
|
174
|
+
child.addEventListener(type, entry.a, entry.o);
|
|
175
|
+
}
|
|
176
|
+
removeEventListener(type: string, listener: Listener | null, options?: boolean | EventListenerOptions): void {
|
|
177
|
+
const capture = typeof options === 'boolean' ? options : !!options?.capture;
|
|
178
|
+
const index = this.#listeners.findIndex((entry) => entry.t === type && entry.l === listener && entry.c === capture);
|
|
179
|
+
if (index < 0)
|
|
180
|
+
return;
|
|
181
|
+
const entry = this.#listeners.splice(index, 1)[0]!;
|
|
182
|
+
for (const child of this.#nodes)
|
|
183
|
+
child.removeEventListener(type, entry.a, capture);
|
|
184
|
+
entry.d?.();
|
|
185
|
+
}
|
|
186
|
+
dispatchEvent(event: Event): boolean {
|
|
187
|
+
const parent = !this.#fiber.u && this.#parent;
|
|
188
|
+
if (!parent)
|
|
189
|
+
return true;
|
|
190
|
+
const target = parent;
|
|
191
|
+
if (!this.#listeners.length && event.bubbles)
|
|
192
|
+
return target.dispatchEvent(event);
|
|
193
|
+
const document = (target.ownerDocument || target) as Document;
|
|
194
|
+
const temporary = target.nodeType === 9 ? document.createComment('') : document.createTextNode('');
|
|
195
|
+
for (const entry of this.#listeners)
|
|
196
|
+
temporary.addEventListener(entry.t, entry.a, entry.o);
|
|
197
|
+
target.appendChild(temporary);
|
|
198
|
+
try {
|
|
199
|
+
return temporary.dispatchEvent(event);
|
|
200
|
+
}
|
|
201
|
+
finally {
|
|
202
|
+
temporary.remove();
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
#focusChild(last: boolean, options?: FocusOptions): void {
|
|
206
|
+
// Parent links survive reconciliation. Filter the committed root order,
|
|
207
|
+
// not the work-in-progress child pointers, when focus is actually used.
|
|
208
|
+
const children = this.#ordered.filter(child => containsFiber(this.#fiber, child));
|
|
209
|
+
if (last)
|
|
210
|
+
children.reverse();
|
|
211
|
+
for (const child of children) {
|
|
212
|
+
if (child.t === FiberTag.Text)
|
|
213
|
+
continue;
|
|
214
|
+
const element = child.n as HTMLElement;
|
|
215
|
+
if (element.ownerDocument.activeElement === element)
|
|
216
|
+
return;
|
|
217
|
+
let focused = false;
|
|
218
|
+
const handleFocus = () => { focused = true; };
|
|
219
|
+
element.ownerDocument.addEventListener('focus', handleFocus, true);
|
|
220
|
+
try {
|
|
221
|
+
(element.focus ?? HTMLElement.prototype.focus).call(element, options);
|
|
222
|
+
}
|
|
223
|
+
finally {
|
|
224
|
+
element.ownerDocument.removeEventListener('focus', handleFocus, true);
|
|
225
|
+
}
|
|
226
|
+
if (focused)
|
|
227
|
+
return;
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
focus(options?: FocusOptions): void { this.#focusChild(false, options); }
|
|
231
|
+
focusLast(options?: FocusOptions): void { this.#focusChild(true, options); }
|
|
232
|
+
blur(): void {
|
|
233
|
+
const parent = this.#parent;
|
|
234
|
+
const active = parent && (parent.ownerDocument ?? parent as Document).activeElement as HTMLElement | null;
|
|
235
|
+
if (active && this.#children.some((child) => child.contains(active)))
|
|
236
|
+
active.blur();
|
|
237
|
+
}
|
|
238
|
+
observeUsing(observer: Observer): void {
|
|
239
|
+
this.#observers.add(observer);
|
|
240
|
+
for (const child of this.#nodes)
|
|
241
|
+
if (child.nodeType === 1)
|
|
242
|
+
observer.observe(child as Element);
|
|
243
|
+
}
|
|
244
|
+
unobserveUsing(observer: Observer): void {
|
|
245
|
+
if (!this.#observers.delete(observer))
|
|
246
|
+
return;
|
|
247
|
+
for (const child of this.#nodes)
|
|
248
|
+
if (child.nodeType === 1)
|
|
249
|
+
observer.unobserve(child as Element);
|
|
250
|
+
for (const child of this.#pending.get(observer) ?? [])
|
|
251
|
+
observer.unobserve(child);
|
|
252
|
+
this.#pending.get(observer)?.clear();
|
|
253
|
+
this.#pending.delete(observer);
|
|
254
|
+
}
|
|
255
|
+
getClientRects(): DOMRect[] {
|
|
256
|
+
const rects: DOMRect[] = [];
|
|
257
|
+
for (const child of this.#children) {
|
|
258
|
+
if (child.nodeType === 3) {
|
|
259
|
+
const range = child.ownerDocument!.createRange();
|
|
260
|
+
range.selectNodeContents(child);
|
|
261
|
+
rects.push(...range.getClientRects());
|
|
262
|
+
}
|
|
263
|
+
else
|
|
264
|
+
rects.push(...(child as Element).getClientRects());
|
|
265
|
+
}
|
|
266
|
+
return rects;
|
|
267
|
+
}
|
|
268
|
+
getRootNode(options?: GetRootNodeOptions): Node | FragmentInstance {
|
|
269
|
+
const parent = !this.#fiber.u && this.#parent;
|
|
270
|
+
return parent ? parent.getRootNode(options) : this;
|
|
271
|
+
}
|
|
272
|
+
compareDocumentPosition(other: Node): number {
|
|
273
|
+
const parent = !this.#fiber.u && this.#parent;
|
|
274
|
+
if (!parent)
|
|
275
|
+
return 1;
|
|
276
|
+
const children = this.#children;
|
|
277
|
+
let parentNode = parent;
|
|
278
|
+
if (!children.length) {
|
|
279
|
+
if (this.#portalContainer)
|
|
280
|
+
parentNode = this.#portalContainer;
|
|
281
|
+
let result = parentNode.compareDocumentPosition(other);
|
|
282
|
+
if (parentNode === other)
|
|
283
|
+
result = 8;
|
|
284
|
+
else if (result & 16) {
|
|
285
|
+
const following = this.#adjacent[1];
|
|
286
|
+
const position = following && following.compareDocumentPosition(other);
|
|
287
|
+
result = following && (position === 0 || position! & 4) ? 4 : 2;
|
|
288
|
+
}
|
|
289
|
+
return result | 32;
|
|
290
|
+
}
|
|
291
|
+
const first = children[0]!;
|
|
292
|
+
const last = children[children.length - 1]!;
|
|
293
|
+
if (this.#portalContainer)
|
|
294
|
+
parentNode = first.parentNode!;
|
|
295
|
+
if (!parentNode)
|
|
296
|
+
return 1;
|
|
297
|
+
const firstContained = parentNode.compareDocumentPosition(first) & 16;
|
|
298
|
+
const lastContained = parentNode.compareDocumentPosition(last) & 16;
|
|
299
|
+
const firstPosition = first.compareDocumentPosition(other);
|
|
300
|
+
const lastPosition = last.compareDocumentPosition(other);
|
|
301
|
+
const result = (firstContained && first === other) || (lastContained && last === other) ||
|
|
302
|
+
(firstPosition & 16) || (lastPosition & 16) ||
|
|
303
|
+
(firstContained && lastContained && (firstPosition & 4) && (lastPosition & 2)) ? 16 :
|
|
304
|
+
(!firstContained && first === other) || (!lastContained && last === other) ? 32 : firstPosition;
|
|
305
|
+
if (result & 33)
|
|
306
|
+
return result;
|
|
307
|
+
const ordered = this.#ordered;
|
|
308
|
+
let otherFiber: Fiber | undefined;
|
|
309
|
+
for (let target: Node | null = other; target && !otherFiber; target = target.parentNode) {
|
|
310
|
+
otherFiber = ordered.find((fiber) => fiber.n === target);
|
|
311
|
+
}
|
|
312
|
+
if (result & 16)
|
|
313
|
+
return containsFiber(this.#fiber, otherFiber ?? null) ? result : 32;
|
|
314
|
+
if (result & 8)
|
|
315
|
+
return otherFiber || other === other.ownerDocument || other === other.ownerDocument?.documentElement || other === other.ownerDocument?.body ? result : 32;
|
|
316
|
+
if (!otherFiber)
|
|
317
|
+
return 32;
|
|
318
|
+
const otherIndex = ordered.indexOf(otherFiber);
|
|
319
|
+
return ((result & 2) && otherIndex <= ordered.findIndex(fiber => fiber.n === first)) ||
|
|
320
|
+
((result & 4) && otherIndex >= ordered.findIndex(fiber => fiber.n === last)) ? result : 32;
|
|
321
|
+
}
|
|
322
|
+
scrollIntoView(alignToTop?: boolean): void {
|
|
323
|
+
if (isObject(alignToTop))
|
|
324
|
+
throw new Error(process.env.NODE_ENV !== 'production' ? 'FragmentInstance.scrollIntoView expects a boolean, not an options object.' : '');
|
|
325
|
+
if (this.#fiber.u)
|
|
326
|
+
return;
|
|
327
|
+
const children = this.#children.slice();
|
|
328
|
+
const top = alignToTop !== false;
|
|
329
|
+
if (!children.length) {
|
|
330
|
+
const [previous, next] = this.#adjacent;
|
|
331
|
+
const fallback = top ? next ?? previous ?? this.#parent : previous ?? next;
|
|
332
|
+
if (fallback)
|
|
333
|
+
children.push(fallback);
|
|
334
|
+
}
|
|
335
|
+
if (top)
|
|
336
|
+
children.reverse();
|
|
337
|
+
for (const target of children) {
|
|
338
|
+
if (target.nodeType === 3) {
|
|
339
|
+
const range = target.ownerDocument!.createRange();
|
|
340
|
+
range.selectNodeContents(target);
|
|
341
|
+
const rect = range.getBoundingClientRect();
|
|
342
|
+
const window = target.ownerDocument!.defaultView!;
|
|
343
|
+
window.scrollTo(window.scrollX + rect.left, window.scrollY + (top ? rect.top : rect.bottom - window.innerHeight));
|
|
344
|
+
}
|
|
345
|
+
else if (target.nodeType === 11) {
|
|
346
|
+
;
|
|
347
|
+
(target as ShadowRoot).host?.scrollIntoView(alignToTop);
|
|
348
|
+
}
|
|
349
|
+
else if (target.nodeType !== 9)
|
|
350
|
+
(target as Element).scrollIntoView(alignToTop);
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
dispose(): void {
|
|
354
|
+
for (const child of this.#nodes)
|
|
355
|
+
this.update(child, false);
|
|
356
|
+
for (const entry of this.#listeners)
|
|
357
|
+
entry.d?.();
|
|
358
|
+
this.#listeners = [];
|
|
359
|
+
this.#children = [];
|
|
360
|
+
this.#ordered = [];
|
|
361
|
+
this.#parent = null;
|
|
362
|
+
const root = this.#fiber.r ?? findRoot(this.#fiber);
|
|
363
|
+
if (root)
|
|
364
|
+
instances.get(root)?.delete(this);
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
export function refreshFragmentInstances(root: FiberRoot): void {
|
|
368
|
+
if (!root.fr)
|
|
369
|
+
return;
|
|
370
|
+
const registered = instances.get(root);
|
|
371
|
+
if (!registered?.size)
|
|
372
|
+
return;
|
|
373
|
+
queueMutation(() => {
|
|
374
|
+
if (!registered.size)
|
|
375
|
+
return;
|
|
376
|
+
const ordered = hosts(root.r, true);
|
|
377
|
+
for (const instance of registered)
|
|
378
|
+
instance.refresh(ordered);
|
|
379
|
+
});
|
|
380
|
+
}
|
|
381
|
+
export function createFragmentInstance(fiber: Fiber): FragmentInstance {
|
|
382
|
+
const root = fiber.r ?? findRoot(fiber);
|
|
383
|
+
if (root)
|
|
384
|
+
root.fr = true;
|
|
385
|
+
const instance = new FragmentInstance(fiber);
|
|
386
|
+
if (root) {
|
|
387
|
+
let registered = instances.get(root);
|
|
388
|
+
if (!registered)
|
|
389
|
+
instances.set(root, registered = new Set());
|
|
390
|
+
registered.add(instance);
|
|
391
|
+
onCommitRollback(() => { registered.delete(instance); });
|
|
392
|
+
onCommitFailure(() => { registered.delete(instance); });
|
|
393
|
+
}
|
|
394
|
+
return instance;
|
|
395
|
+
}
|
|
396
|
+
export function updateFragmentHost(fiber: Fiber, adding: boolean): void {
|
|
397
|
+
if (!(fiber.r ?? getCurrentRoot() ?? findRoot(fiber))?.fr || !fiber.n)
|
|
398
|
+
return;
|
|
399
|
+
const dom = fiber.n;
|
|
400
|
+
queueMutation(() => {
|
|
401
|
+
for (let parent = fiber.p; parent; parent = parent.p) {
|
|
402
|
+
if (adding && isActivityHidden(parent))
|
|
403
|
+
break;
|
|
404
|
+
if (parent.t === FiberTag.Fragment && parent.i instanceof FragmentInstance)
|
|
405
|
+
parent.i.update(dom, adding);
|
|
406
|
+
if (parent.t === FiberTag.Host || parent.t === FiberTag.Root)
|
|
407
|
+
break;
|
|
408
|
+
}
|
|
409
|
+
});
|
|
410
|
+
}
|
|
411
|
+
function hosts(fiber: Fiber, deep?: boolean, result: Fiber[] = []): Fiber[] {
|
|
412
|
+
for (let child = fiber.c; child; child = child.s) {
|
|
413
|
+
if (child.u || isActivityHidden(child))
|
|
414
|
+
continue;
|
|
415
|
+
const host = child.t <= FiberTag.Text;
|
|
416
|
+
if (host)
|
|
417
|
+
result.push(child);
|
|
418
|
+
if (!host || deep)
|
|
419
|
+
hosts(child, deep, result);
|
|
420
|
+
}
|
|
421
|
+
if (deep && fiber.t === FiberTag.Suspense && fiber.b?.f)
|
|
422
|
+
hosts(fiber.b.f, true, result);
|
|
423
|
+
return result;
|
|
424
|
+
}
|
|
425
|
+
// 0 synchronizes the ref, 1 runs cleanup, 2 disposes the unmounted instance.
|
|
426
|
+
export function commitFragmentRef(fiber: Fiber, phase = 0): void {
|
|
427
|
+
if (fiber.type !== REACT_FRAGMENT_TYPE)
|
|
428
|
+
return;
|
|
429
|
+
if (!phase) {
|
|
430
|
+
if (fiber.ref && !fiber.i)
|
|
431
|
+
fiber.i = createFragmentInstance(fiber);
|
|
432
|
+
const previous = fiber.b?.ref;
|
|
433
|
+
if (previous !== fiber.ref) {
|
|
434
|
+
if (fiber.e) {
|
|
435
|
+
const cleanups = fiber.e;
|
|
436
|
+
queueMutation(() => {
|
|
437
|
+
for (const cleanup of cleanups)
|
|
438
|
+
invokeCommit(fiber, cleanup);
|
|
439
|
+
});
|
|
440
|
+
fiber.e = null;
|
|
441
|
+
}
|
|
442
|
+
detachRef(previous, fiber);
|
|
443
|
+
fiber.b = { ...fiber.b, ref: fiber.ref };
|
|
444
|
+
if (fiber.i)
|
|
445
|
+
attachRef(fiber, fiber.i);
|
|
446
|
+
}
|
|
447
|
+
}
|
|
448
|
+
else if (fiber.i) {
|
|
449
|
+
if (phase === 2)
|
|
450
|
+
fiber.i.dispose();
|
|
451
|
+
else {
|
|
452
|
+
if (fiber.e) {
|
|
453
|
+
for (const cleanup of fiber.e)
|
|
454
|
+
invokeCommit(fiber, cleanup);
|
|
455
|
+
fiber.e = null;
|
|
456
|
+
}
|
|
457
|
+
detachRef(fiber.cr ?? fiber.ref, fiber);
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
import { onCommitFailure, onCommitRollback, queueMutation, currentCommit } from './commit';
|
|
462
|
+
import { isFunction } from '../core/functions';
|
package/src/dom/index.ts
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { requestFormReset } from './form-actions';
|
|
2
|
+
export { createPortal } from './portal';
|
|
3
|
+
import { createPortal } from './portal';
|
|
4
|
+
import { browser } from '../core/browser';
|
|
5
|
+
export type { BrowserToken } from '../core/browser';
|
|
6
|
+
import { preconnect, prefetchDNS, preload, preinit, preloadModule, preinitModule } from './resource-hints';
|
|
7
|
+
import { useFormStatus, useActionState as useFormState } from '../react/hooks';
|
|
8
|
+
export { flushSync, batchedUpdates as unstable_batchedUpdates } from './root';
|
|
9
|
+
import { flushSync, batchedUpdates } from './root';
|
|
10
|
+
export { browser } from '../core/browser';
|
|
11
|
+
import { findDOMNode } from './features/class';
|
|
12
|
+
// Root entry points register renderers. These DOM utilities can also run alone,
|
|
13
|
+
// so importing them must not eagerly install every optional renderer.
|
|
14
|
+
export { preconnect, prefetchDNS, preload, preinit, preloadModule, preinitModule };
|
|
15
|
+
export const __DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE = {
|
|
16
|
+
d: {
|
|
17
|
+
f() { },
|
|
18
|
+
r: requestFormReset,
|
|
19
|
+
D: prefetchDNS,
|
|
20
|
+
C(href: string, crossOrigin?: string) { preconnect(href, { crossOrigin }); },
|
|
21
|
+
L(href: string, as: string, options?: any) { preload(href, { ...options, as }); },
|
|
22
|
+
m: preloadModule,
|
|
23
|
+
X(href: string, options?: any) { preinit(href, { ...options, as: 'script' }); },
|
|
24
|
+
S(href: string, precedence?: string, options?: any) { preinit(href, { ...options, as: 'style', precedence }); },
|
|
25
|
+
M: preinitModule,
|
|
26
|
+
},
|
|
27
|
+
p: 0,
|
|
28
|
+
findDOMNode,
|
|
29
|
+
};
|
|
30
|
+
export const version = '19.2.3';
|
|
31
|
+
// Required by React's default export consumers
|
|
32
|
+
export default {
|
|
33
|
+
useFormStatus,
|
|
34
|
+
useFormState,
|
|
35
|
+
requestFormReset,
|
|
36
|
+
flushSync,
|
|
37
|
+
unstable_batchedUpdates: batchedUpdates,
|
|
38
|
+
createPortal,
|
|
39
|
+
browser,
|
|
40
|
+
preconnect,
|
|
41
|
+
prefetchDNS,
|
|
42
|
+
preload,
|
|
43
|
+
preinit,
|
|
44
|
+
preloadModule,
|
|
45
|
+
preinitModule,
|
|
46
|
+
__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,
|
|
47
|
+
version: '19.2.3',
|
|
48
|
+
};
|
|
49
|
+
export { useFormStatus, useFormState, requestFormReset };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { ReactNode, ReactElement } from '../core'
|
|
2
|
+
import { REACT_PORTAL_TYPE } from '../react'
|
|
3
|
+
|
|
4
|
+
export function createPortal(
|
|
5
|
+
children: ReactNode,
|
|
6
|
+
container: Element | DocumentFragment,
|
|
7
|
+
key: string | null = null,
|
|
8
|
+
): ReactElement {
|
|
9
|
+
return {
|
|
10
|
+
$$typeof: REACT_PORTAL_TYPE as any,
|
|
11
|
+
type: REACT_PORTAL_TYPE as any,
|
|
12
|
+
key: key == null ? null : '' + key,
|
|
13
|
+
ref: null,
|
|
14
|
+
props: { children, container },
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { Fiber, FiberRoot } from '../core';
|
|
2
|
+
// React SSR encodes the original child slots, including empty slots, into IDs.
|
|
3
|
+
// Redact SSR uses the same tree slots so suspended render order cannot change IDs.
|
|
4
|
+
let clientId = 0;
|
|
5
|
+
export const leadingBit = (tree: bigint): bigint => 1n << BigInt(tree.toString(2).length - 1);
|
|
6
|
+
export function forkId(base: bigint, count: number, index: number): bigint {
|
|
7
|
+
const bit = leadingBit(base);
|
|
8
|
+
return (bit << BigInt(32 - Math.clz32(count))) | (BigInt(index + 1) * bit) | (base ^ bit);
|
|
9
|
+
}
|
|
10
|
+
export function assignReactIds(parent: Fiber, children: object): void {
|
|
11
|
+
const paths = (children as {
|
|
12
|
+
ip?: bigint[];
|
|
13
|
+
}).ip;
|
|
14
|
+
if (!paths)
|
|
15
|
+
return;
|
|
16
|
+
let base = parent.it ?? 1n;
|
|
17
|
+
if (parent.im)
|
|
18
|
+
base = forkId(base, 1, 0);
|
|
19
|
+
const bit = leadingBit(base);
|
|
20
|
+
let index = 0;
|
|
21
|
+
for (let child = parent.c; child; child = child.s) {
|
|
22
|
+
const path = paths[child.ix ?? index++] ?? 1n;
|
|
23
|
+
child.it = (path * bit) | (base ^ bit);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
export function reactId(fiber: Fiber, root: FiberRoot): string {
|
|
27
|
+
if (!root.h)
|
|
28
|
+
return clientReactId(root);
|
|
29
|
+
fiber.im = true;
|
|
30
|
+
const local = fiber.il ?? 0;
|
|
31
|
+
fiber.il = local + 1;
|
|
32
|
+
const tree = fiber.it ?? 1n;
|
|
33
|
+
const id = (tree ^ leadingBit(tree)).toString(32);
|
|
34
|
+
return '_' + (root.i ?? '') + 'R_' + id + (local ? 'H' + local.toString(32) : '') + '_';
|
|
35
|
+
}
|
|
36
|
+
export const clientReactId = (root: FiberRoot): string => ('_' + (root.i ?? '') + 'r_' + (clientId++).toString(32) + '_');
|