@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,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/dom/resource-store.ts"],
|
|
4
|
+
"sourcesContent": ["import type { ResourceHintOptions } from '../core/resource-hints';\ninterface Resources {\n // Connection and preload selectors are disjoint, so one map deduplicates both.\n p: Map<string, ResourceHintOptions>;\n i: Map<string, Element>;\n}\nexport type ResourceRoot = Document | DocumentFragment;\nconst roots = /*#__PURE__*/ new WeakMap<ResourceRoot, Resources>();\n// Existing document links can satisfy a shadow declaration. Links created by\n// the resource system belong to their original root instead.\nexport const createdStylesheets = /*#__PURE__*/ new WeakSet<Element>();\nexport const resourceAttribute = (name: string, value: string): string => (`[${name}=\"${value.replace(/[\\n\"\\\\]/g, char => '\\\\' + char.charCodeAt(0).toString(16) + ' ')}\"]`);\nexport const resourceSelector = (href: string, as: string): string => (as === 'style'\n ? 'link[rel=\"stylesheet\"]' + resourceAttribute('href', href)\n : 'script[async]' + resourceAttribute('src', href));\nexport function adoptResourceProps(props: any, prior: ResourceHintOptions | undefined, script: boolean): void {\n if (prior)\n for (const name of ['crossOrigin', 'referrerPolicy', script ? 'integrity' : 'title']) {\n if (props[name] == null && prior[name] != null)\n props[name] = prior[name];\n }\n}\nexport function getResources(root: ResourceRoot): Resources {\n let resources = roots.get(root);\n if (!resources)\n roots.set(root, resources = { p: new Map(), i: new Map() });\n return resources;\n}\nexport function insertResource(node: Element, precedence?: string, root: ResourceRoot = node.ownerDocument): void {\n const container = root.nodeType === 9 ? (root as Document).head : root;\n if (precedence != null) {\n if (node.localName === 'link')\n createdStylesheets.add(node);\n let previous: Element | undefined;\n let matched = false;\n for (const sibling of root.querySelectorAll('link[rel=\"stylesheet\"][data-precedence],style[data-precedence]')) {\n if (sibling.getAttribute('data-precedence') === precedence)\n matched = true;\n else if (matched)\n break;\n previous = sibling;\n }\n if (previous)\n previous.parentNode!.insertBefore(node, previous.nextSibling);\n else\n container.insertBefore(node, container.firstChild);\n }\n else\n container.appendChild(node);\n}\n"],
|
|
5
|
+
"mappings": "AAOA,MAAM,QAAsB,oBAAI,QAAO;AAGhC,MAAM,qBAAmC,oBAAI,QAAO;AACpD,MAAM,oBAAoB,CAAC,MAAc,UAA2B,IAAI,IAAI,KAAK,MAAM,QAAQ,YAAY,UAAQ,OAAO,KAAK,WAAW,CAAC,EAAE,SAAS,EAAE,IAAI,GAAG,CAAC;AAChK,MAAM,mBAAmB,CAAC,MAAc,OAAwB,OAAO,UACxE,2BAA2B,kBAAkB,QAAQ,IAAI,IACzD,kBAAkB,kBAAkB,OAAO,IAAI;AAC/C,SAAU,mBAAmB,OAAY,OAAwC,QAAe;AAClG,MAAI;AACA,eAAW,QAAQ,CAAC,eAAe,kBAAkB,SAAS,cAAc,OAAO,GAAG;AAClF,UAAI,MAAM,IAAI,KAAK,QAAQ,MAAM,IAAI,KAAK;AACtC,cAAM,IAAI,IAAI,MAAM,IAAI;IAChC;AACR;AACM,SAAU,aAAa,MAAkB;AAC3C,MAAI,YAAY,MAAM,IAAI,IAAI;AAC9B,MAAI,CAAC;AACD,UAAM,IAAI,MAAM,YAAY,EAAE,GAAG,oBAAI,IAAG,GAAI,GAAG,oBAAI,IAAG,EAAE,CAAE;AAC9D,SAAO;AACX;AACM,SAAU,eAAe,MAAe,YAAqB,OAAqB,KAAK,eAAa;AACtG,QAAM,YAAY,KAAK,aAAa,IAAK,KAAkB,OAAO;AAClE,MAAI,cAAc,MAAM;AACpB,QAAI,KAAK,cAAc;AACnB,yBAAmB,IAAI,IAAI;AAC/B,QAAI;AACJ,QAAI,UAAU;AACd,eAAW,WAAW,KAAK,iBAAiB,gEAAgE,GAAG;AAC3G,UAAI,QAAQ,aAAa,iBAAiB,MAAM;AAC5C,kBAAU;eACL;AACL;AACJ,iBAAW;IACf;AACA,QAAI;AACA,eAAS,WAAY,aAAa,MAAM,SAAS,WAAW;;AAE5D,gBAAU,aAAa,MAAM,UAAU,UAAU;EACzD;AAEI,cAAU,YAAY,IAAI;AAClC;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function acquireResource(type: string, props: any, container: Node): Element;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { setProp } from "./dom.js";
|
|
2
|
+
import { resourceURL } from "../core/resource-hints.js";
|
|
3
|
+
import { adoptResourceProps, createdStylesheets, getResources, insertResource, resourceAttribute, resourceSelector } from "./resource-store.js";
|
|
4
|
+
function acquireResource(type, props, container) {
|
|
5
|
+
const script = type === "script";
|
|
6
|
+
const style = type === "style";
|
|
7
|
+
const ownerDocument = container.ownerDocument || container;
|
|
8
|
+
const tree = script ? ownerDocument : container.getRootNode();
|
|
9
|
+
const root = tree.nodeType === 9 || tree.nodeType === 11 ? tree : ownerDocument;
|
|
10
|
+
const href = script ? props.src : props.href;
|
|
11
|
+
const resources = getResources(root);
|
|
12
|
+
const key = resourceSelector(href, script ? "script" : "style");
|
|
13
|
+
let node = resources.i.get(key);
|
|
14
|
+
if (node)
|
|
15
|
+
return node;
|
|
16
|
+
const existing = !style && !script && root !== ownerDocument ? ownerDocument.querySelector(key) : null;
|
|
17
|
+
node = existing && !createdStylesheets.has(existing) && !existing._p ? existing : root.querySelector(style ? "style" + resourceAttribute("data-href~", href) : key) || void 0;
|
|
18
|
+
if (node) {
|
|
19
|
+
resources.i.set(key, node);
|
|
20
|
+
return node;
|
|
21
|
+
}
|
|
22
|
+
const next = { ...props };
|
|
23
|
+
if (!script) {
|
|
24
|
+
next["data-precedence"] = props.precedence;
|
|
25
|
+
delete next.precedence;
|
|
26
|
+
if (style) {
|
|
27
|
+
next["data-href"] = props.href;
|
|
28
|
+
delete next.href;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
if (!style)
|
|
32
|
+
adoptResourceProps(next, getResources(ownerDocument).p.get(key), script);
|
|
33
|
+
node = ownerDocument.createElement(type);
|
|
34
|
+
for (const name in next) {
|
|
35
|
+
setProp(node, name, name === "href" || name === "src" ? resourceURL(next[name]) : next[name], void 0, false);
|
|
36
|
+
}
|
|
37
|
+
if (style && next.dangerouslySetInnerHTML == null && isTextContent(next.children))
|
|
38
|
+
node.textContent = "" + next.children;
|
|
39
|
+
resources.i.set(key, node);
|
|
40
|
+
insertResource(node, script ? void 0 : props.precedence, root);
|
|
41
|
+
return node;
|
|
42
|
+
}
|
|
43
|
+
import { isTextContent } from "../core/functions.js";
|
|
44
|
+
export {
|
|
45
|
+
acquireResource
|
|
46
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/dom/resources.ts"],
|
|
4
|
+
"sourcesContent": ["import { setProp } from './dom';\nimport { resourceURL } from '../core/resource-hints';\nimport { adoptResourceProps, createdStylesheets, getResources, insertResource, resourceAttribute, resourceSelector, type ResourceRoot } from './resource-store';\n// Called only during commit. Resource nodes are shared by href and are not\n// owned by a component's placement or unmount operations.\n// The renderer has already checked this host's resource eligibility.\nexport function acquireResource(type: string, props: any, container: Node): Element {\n const script = type === 'script';\n const style = type === 'style';\n const ownerDocument = (container.ownerDocument || container) as Document;\n const tree = script ? ownerDocument : container.getRootNode();\n const root = (tree.nodeType === 9 || tree.nodeType === 11 ? tree : ownerDocument) as ResourceRoot;\n const href = script ? props.src : props.href;\n const resources = getResources(root);\n const key = resourceSelector(href, script ? 'script' : 'style');\n let node = resources.i.get(key);\n if (node)\n return node;\n const existing = !style && !script && root !== ownerDocument ? ownerDocument.querySelector(key) : null;\n node = existing && !createdStylesheets.has(existing) && !(existing as any)._p ? existing\n : root.querySelector(style ? 'style' + resourceAttribute('data-href~', href) : key) || undefined;\n if (node) {\n resources.i.set(key, node);\n return node;\n }\n const next = { ...props };\n if (!script) {\n next['data-precedence'] = props.precedence;\n delete next.precedence;\n if (style) {\n next['data-href'] = props.href;\n delete next.href;\n }\n }\n if (!style)\n adoptResourceProps(next, getResources(ownerDocument).p.get(key), script);\n node = ownerDocument.createElement(type);\n for (const name in next) {\n setProp(node, name, name === 'href' || name === 'src' ? resourceURL(next[name]) : next[name], undefined, false);\n }\n if (style && next.dangerouslySetInnerHTML == null && (isString(next.children) || typeof next.children === 'number' || typeof next.children === 'bigint'))\n node.textContent = '' + next.children;\n resources.i.set(key, node);\n insertResource(node, script ? undefined : props.precedence, root);\n return node;\n}\nimport { isString } from \"../core/functions\";\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,eAAe;AACxB,SAAS,mBAAmB;AAC5B,SAAS,o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A2B,SAAS,SAAS,KAAK,QAAQ,KAAK,OAAO,KAAK,aAAa,YAAY,OAAO,KAAK,aAAa;AAC3I,SAAK,cAAc,KAAK,KAAK;AACjC,YAAU,EAAE,IAAI,KAAK,IAAI;AACzB,iBAAe,MAAM,SAAS,SAAY,MAAM,YAAY,IAAI;AAChE,SAAO;AACX;AACA,SAAS,gBAAgB;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type Fiber, type Hook, type Effect } from "../core/index.js";
|
|
2
|
+
export declare function disconnectClass(fiber: Fiber, removing?: boolean): void;
|
|
3
|
+
export declare function inSuspensePrimary(fiber: Fiber): boolean;
|
|
4
|
+
export { walkRetained } from "./walk.js";
|
|
5
|
+
export declare function rememberRetainedEffect(fiber: Fiber, hook: Hook, effect: Effect): void;
|
|
6
|
+
export declare function setRetainedFlag(fiber: Fiber, key: 'ld' | 'ad' | 'ah', disconnected: boolean): boolean;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { invokeCommit, layoutIsDisconnected } from "./reconcile.js";
|
|
2
|
+
import { onCommitRollback } from "./commit.js";
|
|
3
|
+
function disconnectClass(fiber, removing) {
|
|
4
|
+
const instance = fiber.i?._f === fiber ? fiber.i : null;
|
|
5
|
+
if (!instance)
|
|
6
|
+
return;
|
|
7
|
+
const props = instance.props, state = instance.state, committed = fiber.b?.c;
|
|
8
|
+
if (committed) {
|
|
9
|
+
instance.props = committed.p;
|
|
10
|
+
instance.state = committed.s;
|
|
11
|
+
}
|
|
12
|
+
try {
|
|
13
|
+
if (instance.componentWillUnmount && (!removing || !layoutIsDisconnected(fiber))) {
|
|
14
|
+
invokeCommit(fiber, () => instance.componentWillUnmount());
|
|
15
|
+
}
|
|
16
|
+
} finally {
|
|
17
|
+
if (!removing) {
|
|
18
|
+
instance.props = props;
|
|
19
|
+
instance.state = state;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
if (removing)
|
|
23
|
+
instance._f = instance._q = instance._u = null;
|
|
24
|
+
}
|
|
25
|
+
function inSuspensePrimary(fiber) {
|
|
26
|
+
for (let child = fiber, parent = fiber.p; parent; child = parent, parent = parent.p) {
|
|
27
|
+
if (parent.t === 11 && parent.b?.d && parent.b.f !== child)
|
|
28
|
+
return true;
|
|
29
|
+
}
|
|
30
|
+
return false;
|
|
31
|
+
}
|
|
32
|
+
import { walkRetained } from "./walk.js";
|
|
33
|
+
function rememberRetainedEffect(fiber, hook, effect) {
|
|
34
|
+
let entries = fiber.ef;
|
|
35
|
+
if (!entries) {
|
|
36
|
+
fiber.ef = entries = /* @__PURE__ */ new Map();
|
|
37
|
+
onCommitRollback(() => {
|
|
38
|
+
fiber.ef = void 0;
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
const previous = entries.get(hook), target = entries;
|
|
42
|
+
onCommitRollback(() => {
|
|
43
|
+
if (previous)
|
|
44
|
+
target.set(hook, previous);
|
|
45
|
+
else
|
|
46
|
+
target.delete(hook);
|
|
47
|
+
});
|
|
48
|
+
entries.set(hook, effect);
|
|
49
|
+
}
|
|
50
|
+
function setRetainedFlag(fiber, key, disconnected) {
|
|
51
|
+
const previous = !!fiber[key];
|
|
52
|
+
if (previous !== disconnected) {
|
|
53
|
+
onCommitRollback(() => {
|
|
54
|
+
fiber[key] = previous;
|
|
55
|
+
});
|
|
56
|
+
fiber[key] = disconnected;
|
|
57
|
+
}
|
|
58
|
+
return previous;
|
|
59
|
+
}
|
|
60
|
+
export {
|
|
61
|
+
disconnectClass,
|
|
62
|
+
inSuspensePrimary,
|
|
63
|
+
rememberRetainedEffect,
|
|
64
|
+
setRetainedFlag,
|
|
65
|
+
walkRetained
|
|
66
|
+
};
|
|
67
|
+
//# sourceMappingURL=retained-effects.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/dom/retained-effects.ts"],
|
|
4
|
+
"sourcesContent": ["import { invokeCommit, layoutIsDisconnected } from './reconcile';\nimport { onCommitRollback } from './commit';\nimport { FiberTag, type Fiber, type Hook, type Effect } from '../core';\nexport function disconnectClass(fiber: Fiber, removing?: boolean): void {\n const instance = fiber.i?._f === fiber ? fiber.i : null;\n if (!instance)\n return;\n const props = instance.props, state = instance.state, committed = fiber.b?.c;\n if (committed) {\n instance.props = committed.p;\n instance.state = committed.s;\n }\n try {\n if (instance.componentWillUnmount && (!removing || !layoutIsDisconnected(fiber))) {\n invokeCommit(fiber, () => instance.componentWillUnmount());\n }\n }\n finally {\n if (!removing) {\n instance.props = props;\n instance.state = state;\n }\n }\n if (removing)\n instance._f = instance._q = instance._u = null;\n}\nexport function inSuspensePrimary(fiber: Fiber): boolean {\n for (let child = fiber, parent = fiber.p; parent; child = parent, parent = parent.p) {\n if (parent.t === FiberTag.Suspense && parent.b?.d && parent.b.f !== child)\n return true;\n }\n return false;\n}\nexport { walkRetained } from './walk';\nexport function rememberRetainedEffect(fiber: Fiber, hook: Hook, effect: Effect): void {\n let entries = fiber.ef;\n if (!entries) {\n fiber.ef = entries = new Map();\n onCommitRollback(() => { fiber.ef = undefined; });\n }\n const previous = entries.get(hook), target = entries;\n onCommitRollback(() => {\n if (previous)\n target.set(hook, previous);\n else\n target.delete(hook);\n });\n entries.set(hook, effect);\n}\nexport function setRetainedFlag(fiber: Fiber, key: 'ld' | 'ad' | 'ah', disconnected: boolean): boolean {\n const previous = !!fiber[key];\n if (previous !== disconnected) {\n onCommitRollback(() => { fiber[key] = previous; });\n fiber[key] = disconnected;\n }\n return previous;\n}\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,cAAc,4BAA4B;AACnD,SAAS,wBAAwB;AAE3B,SAAU,gBAAgB,OAAc,UAAkB;AAC5D,QAAM,WAAW,MAAM,GAAG,OAAO,QAAQ,MAAM,IAAI;AACnD,MAAI,CAAC;AACD;AACJ,QAAM,QAAQ,SAAS,OAAO,QAAQ,SAAS,OAAO,YAAY,MAAM,GAAG;AAC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type FiberRoot, type RecoverableErrorHandler } from '../core/index.js';
|
|
2
|
+
export interface RootOptionsInternal {
|
|
3
|
+
identifierStrategy?: 'react';
|
|
4
|
+
identifierPrefix?: string;
|
|
5
|
+
onRecoverableError?: RecoverableErrorHandler;
|
|
6
|
+
onCaughtError?: RecoverableErrorHandler;
|
|
7
|
+
onUncaughtError?: RecoverableErrorHandler;
|
|
8
|
+
}
|
|
9
|
+
export declare function createFiberRoot(container: Element | Document | DocumentFragment, options: RootOptionsInternal): FiberRoot;
|
|
10
|
+
export declare function attachRootFiber(root: FiberRoot, container: Element | Document | DocumentFragment): void;
|
|
11
|
+
export declare function getRootContainer(fiber: Fiber, fallback?: Node): Node;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { createFiber } from "../core/index.js";
|
|
2
|
+
function createFiberRoot(container, options) {
|
|
3
|
+
const root = {
|
|
4
|
+
p: /* @__PURE__ */ new Set(),
|
|
5
|
+
s: false,
|
|
6
|
+
re: options.onRecoverableError,
|
|
7
|
+
ce: options.onCaughtError,
|
|
8
|
+
ue: options.onUncaughtError,
|
|
9
|
+
i: options.identifierPrefix,
|
|
10
|
+
h: false
|
|
11
|
+
};
|
|
12
|
+
root.ri = true;
|
|
13
|
+
attachRootFiber(root, container);
|
|
14
|
+
return root;
|
|
15
|
+
}
|
|
16
|
+
function attachRootFiber(root, container) {
|
|
17
|
+
const rootFiber = createFiber(12, null, null);
|
|
18
|
+
root.c = container;
|
|
19
|
+
root.ic = 0;
|
|
20
|
+
rootFiber.r = root;
|
|
21
|
+
rootFiber.i = container;
|
|
22
|
+
root.r = rootFiber;
|
|
23
|
+
}
|
|
24
|
+
function getRootContainer(fiber, fallback = fiber.r.c) {
|
|
25
|
+
for (let parent = fiber.p; parent; parent = parent.p) {
|
|
26
|
+
if (parent.t === 5)
|
|
27
|
+
return parent.v.container;
|
|
28
|
+
}
|
|
29
|
+
return fiber.r?.c || fallback;
|
|
30
|
+
}
|
|
31
|
+
export {
|
|
32
|
+
attachRootFiber,
|
|
33
|
+
createFiberRoot,
|
|
34
|
+
getRootContainer
|
|
35
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/dom/root-internal.ts"],
|
|
4
|
+
"sourcesContent": ["import { FiberTag, createFiber, type Fiber, type FiberRoot, type RecoverableErrorHandler } from '../core';\nexport interface RootOptionsInternal {\n identifierStrategy?: 'react';\n identifierPrefix?: string;\n onRecoverableError?: RecoverableErrorHandler;\n onCaughtError?: RecoverableErrorHandler;\n onUncaughtError?: RecoverableErrorHandler;\n}\nexport function createFiberRoot(container: Element | Document | DocumentFragment, options: RootOptionsInternal): FiberRoot {\n const root = {\n p: new Set(),\n s: false,\n re: options.onRecoverableError,\n ce: options.onCaughtError,\n ue: options.onUncaughtError,\n i: options.identifierPrefix,\n h: false,\n } as FiberRoot;\n if (options.identifierStrategy === 'react')\n root.ri = true;\n attachRootFiber(root, container);\n return root;\n}\nexport function attachRootFiber(root: FiberRoot, container: Element | Document | DocumentFragment): void {\n const rootFiber = createFiber(FiberTag.Root, null, null);\n root.c = container as any;\n root.ic = 0;\n rootFiber.r = root;\n rootFiber.i = container;\n root.r = rootFiber;\n}\nexport function getRootContainer(fiber: Fiber, fallback: Node = fiber.r!.c): Node {\n for (let parent = fiber.p; parent; parent = parent.p) {\n if (parent.t === FiberTag.Portal)\n return parent.v.container;\n }\n return fiber.r?.c || fallback;\n}\n"],
|
|
5
|
+
"mappings": "AAAA,SAAmB,mBAA6E;AAQ1F,SAAU,gBAAgB,WAAkD,SAA4B;AAC1G,QAAM,OAAO;IACT,GAAG,oBAAI,IAAG;IACV,GAAG;IACH,IAAI,QAAQ;IACZ,IAAI,QAAQ;IACZ,IAAI,QAAQ;IACZ,GAAG,QAAQ;IACX,GAAG;;AAEP,MAAI,QAAQ,uBAAuB;AAC/B,SAAK,KAAK;AACd,kBAAgB,MAAM,SAAS;AAC/B,SAAO;AACX;AACM,SAAU,gBAAgB,MAAiB,WAAgD;AAC7F,QAAM,YAAY,YAAW,IAAgB,MAAM,IAAI;AACvD,OAAK,IAAI;AACT,OAAK,KAAK;AACV,YAAU,IAAI;AACd,YAAU,IAAI;AACd,OAAK,IAAI;AACb;AACM,SAAU,iBAAiB,OAAc,WAAiB,MAAM,EAAG,GAAC;AACtE,WAAS,SAAS,MAAM,GAAG,QAAQ,SAAS,OAAO,GAAG;AAClD,QAAI,OAAO,MAAC;AACR,aAAO,OAAO,EAAE;EACxB;AACA,SAAO,MAAM,GAAG,KAAK;AACzB;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { flushSyncWork, batchedUpdates } from './reconcile.js';
|
|
2
|
+
import type { ReactNode, RecoverableErrorHandler } from '../core/index.js';
|
|
3
|
+
export interface RootOptions {
|
|
4
|
+
formState?: unknown[] | null;
|
|
5
|
+
identifierStrategy?: 'react';
|
|
6
|
+
identifierPrefix?: string;
|
|
7
|
+
onRecoverableError?: RecoverableErrorHandler;
|
|
8
|
+
onCaughtError?: RecoverableErrorHandler;
|
|
9
|
+
onUncaughtError?: RecoverableErrorHandler;
|
|
10
|
+
}
|
|
11
|
+
export interface Root {
|
|
12
|
+
render(children: ReactNode): void;
|
|
13
|
+
unmount(): void;
|
|
14
|
+
}
|
|
15
|
+
export declare function createRoot(container: Element | DocumentFragment | Document, options?: RootOptions): Root;
|
|
16
|
+
export declare function hydrateRoot(container: Element | Document, initialChildren: ReactNode, options?: RootOptions): Root;
|
|
17
|
+
export { flushSyncWork as flushSync, batchedUpdates };
|
package/dist/dom/root.js
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { discardPendingWork, renderRoot, scheduleRootRender, flushSyncWork, batchedUpdates } from "./reconcile.js";
|
|
2
|
+
import { createFiberRoot } from "./root-internal.js";
|
|
3
|
+
import { queueMutation } from "./commit.js";
|
|
4
|
+
import { clearHostContainer } from "./document-metadata.js";
|
|
5
|
+
import { hydrateRootImpl } from "./features/hydration/index.js";
|
|
6
|
+
function createRoot(container, options = {}) {
|
|
7
|
+
const root = createFiberRoot(container, options);
|
|
8
|
+
let firstRender = true;
|
|
9
|
+
return {
|
|
10
|
+
render(children) {
|
|
11
|
+
scheduleRootRender(root, () => {
|
|
12
|
+
if (firstRender) {
|
|
13
|
+
queueMutation(() => {
|
|
14
|
+
firstRender = false;
|
|
15
|
+
if (container.nodeType === 1 || container.nodeType === 9)
|
|
16
|
+
clearHostContainer(container);
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
renderRoot(root, children);
|
|
20
|
+
});
|
|
21
|
+
},
|
|
22
|
+
unmount() {
|
|
23
|
+
discardPendingWork(root);
|
|
24
|
+
flushSyncWork(() => {
|
|
25
|
+
renderRoot(root, null);
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
function hydrateRoot(container, initialChildren, options = {}) {
|
|
31
|
+
return hydrateRootImpl(container, initialChildren, options);
|
|
32
|
+
}
|
|
33
|
+
export {
|
|
34
|
+
batchedUpdates,
|
|
35
|
+
createRoot,
|
|
36
|
+
flushSyncWork as flushSync,
|
|
37
|
+
hydrateRoot
|
|
38
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/dom/root.ts"],
|
|
4
|
+
"sourcesContent": ["import { renderRoot, scheduleRootRender, flushSyncWork, batchedUpdates } from './reconcile'\n\nimport { createFiberRoot } from './root-internal'\n\nimport { queueMutation } from './commit'\nimport { clearHostContainer } from './document-metadata'\n\nimport { hydrateRootImpl } from './features/hydration'\n\nimport type { ReactNode, RecoverableErrorHandler } from '../core'\n\nexport interface RootOptions {\n formState?: unknown[] | null\n identifierStrategy?: 'react'\n identifierPrefix?: string\n onRecoverableError?: RecoverableErrorHandler\n onCaughtError?: RecoverableErrorHandler\n onUncaughtError?: RecoverableErrorHandler\n}\n\nexport interface Root {\n render(children: ReactNode): void\n unmount(): void\n}\n\nexport function createRoot(container: Element | DocumentFragment | Document, options: RootOptions = {}): Root {\n const root = createFiberRoot(container, options)\n\n let firstRender = true\n return {\n render(children) {\n scheduleRootRender(root, () => {\n if (firstRender) {\n queueMutation(() => {\n firstRender = false\n if (container.nodeType === 1 || container.nodeType === 9) clearHostContainer(container)\n })\n }\n renderRoot(root, children)\n })\n },\n unmount() {\n flushSyncWork(() => {\n renderRoot(root, null)\n })\n },\n }\n}\n\nexport function hydrateRoot(\n container: Element | Document,\n initialChildren: ReactNode,\n options: RootOptions = {},\n): Root {\n return hydrateRootImpl(container, initialChildren, options)\n}\n\nexport { flushSyncWork as flushSync, batchedUpdates }\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,YAAY,oBAAoB,eAAe,sBAAsB;AAE9E,SAAS,uBAAuB;AAEhC,SAAS,qBAAqB;AAC9B,SAAS,0BAA0B;AAEnC,SAAS,uBAAuB;AAkB1B,SAAU,WAAW,WAAkD,UAAuB,CAAA,GAAE;AACpG,QAAM,OAAO,gBAAgB,WAAW,OAAO;AAE/C,MAAI,cAAc;AAClB,SAAO;IACL,OAAO,UAAQ;AACb,yBAAmB,MAAM,MAAK;AAC5B,YAAI,aAAa;AACf,wBAAc,MAAK;AACjB,0BAAc;AACd,gBAAI,UAAU,aAAa,KAAK,UAAU,aAAa;AAAG,iCAAmB,SAAS;UACxF,CAAC;QACH;AACA,mBAAW,MAAM,QAAQ;MAC3B,CAAC;IACH;IACA,UAAO;AACL,oBAAc,MAAK;AACjB,mBAAW,MAAM,IAAI;MACvB,CAAC;IACH;;AAEJ;AAEM,SAAU,YACd,WACA,iBACA,UAAuB,CAAA,GAAE;AAEzB,SAAO,gBAAgB,WAAW,iBAAiB,OAAO;AAC5D;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function createSyntheticEvent(native: Event): Record<string, any>;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { isFunction } from "../core/functions.js";
|
|
2
|
+
function createSyntheticEvent(native) {
|
|
3
|
+
let stopped = false;
|
|
4
|
+
const event = {
|
|
5
|
+
nativeEvent: native,
|
|
6
|
+
defaultPrevented: native.defaultPrevented,
|
|
7
|
+
isDefaultPrevented: () => event.defaultPrevented,
|
|
8
|
+
isPropagationStopped: () => stopped,
|
|
9
|
+
preventDefault() {
|
|
10
|
+
event.defaultPrevented = true;
|
|
11
|
+
native.preventDefault();
|
|
12
|
+
},
|
|
13
|
+
stopPropagation() {
|
|
14
|
+
stopped = true;
|
|
15
|
+
native.stopPropagation();
|
|
16
|
+
},
|
|
17
|
+
stopImmediatePropagation() {
|
|
18
|
+
stopped = true;
|
|
19
|
+
native.stopImmediatePropagation();
|
|
20
|
+
},
|
|
21
|
+
persist() {
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
for (let o = native; o; o = Object.getPrototypeOf(o)) {
|
|
25
|
+
for (const key of Object.getOwnPropertyNames(o)) {
|
|
26
|
+
if (!(key in event)) {
|
|
27
|
+
const value = native[key];
|
|
28
|
+
event[key] = isFunction(value) ? value.bind(native) : value;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
return event;
|
|
33
|
+
}
|
|
34
|
+
export {
|
|
35
|
+
createSyntheticEvent
|
|
36
|
+
};
|
|
37
|
+
//# sourceMappingURL=synthetic-event.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/dom/synthetic-event.ts"],
|
|
4
|
+
"sourcesContent": ["import { isFunction } from '../core/functions'\n// Snapshot native values so retaining or redispatching an event cannot change them.\nexport function createSyntheticEvent(native: Event) {\n let stopped = false\n const event: Record<string, any> = {\n nativeEvent: native,\n defaultPrevented: native.defaultPrevented,\n isDefaultPrevented: () => event.defaultPrevented,\n isPropagationStopped: () => stopped,\n preventDefault() { event.defaultPrevented = true; native.preventDefault() },\n stopPropagation() { stopped = true; native.stopPropagation() },\n stopImmediatePropagation() { stopped = true; native.stopImmediatePropagation() },\n persist() {},\n }\n for (const key in native) {\n if (!(key in event)) {\n const value = (native as any)[key]\n event[key] = isFunction(value) ? value.bind(native) : value\n }\n }\n return event\n}\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,kBAAkB;AAErB,SAAU,qBAAqB,QAAa;AAChD,MAAI,UAAU;AACd,QAAM,QAA6B;IACjC,aAAa;IACb,kBAAkB,OAAO;IACzB,oBAAoB,MAAM,MAAM;IAChC,sBAAsB,MAAM;IAC5B,iBAAc;AAAK,YAAM,mBAAmB;AAAM,aAAO,eAAc;IAAG;IAC1E,kBAAe;AAAK,gBAAU;AAAM,aAAO,gBAAe;IAAG;IAC7D,2BAAwB;AAAK,gBAAU;AAAM,aAAO,yBAAwB;IAAG;IAC/E,UAAO;IAAI;;AAEb,aAAW,OAAO,QAAQ;AACxB,QAAI,EAAE,OAAO,QAAQ;AACnB,YAAM,QAAS,OAAe,GAAG;AACjC,YAAM,GAAG,IAAI,WAAW,KAAK,IAAI,MAAM,KAAK,MAAM,IAAI;IACxD;EACF;AACA,SAAO;AACT;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { act } from "../react/act.js";
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Fiber, FiberRoot, Hook } from '../core/index.js';
|
|
2
|
+
export declare let a: boolean;
|
|
3
|
+
export declare const p: (fiber: Fiber) => boolean;
|
|
4
|
+
export declare function q(hook: Hook, fiber: Fiber, action: any): boolean;
|
|
5
|
+
export declare function v(hook: Hook, fiber: Fiber, value: any): any;
|
|
6
|
+
export declare function c(root: FiberRoot): void;
|
|
7
|
+
export declare function t(root: FiberRoot, render: (root: FiberRoot, fibers: Fiber[], update?: () => void) => void): void;
|
|
8
|
+
export declare function s(root: FiberRoot, render: () => void): boolean;
|
|
9
|
+
export declare function r(hook: Hook, reducer: (state: any, action: any) => any): boolean;
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import { findRoot, scheduleUpdate } from "./reconcile.js";
|
|
2
|
+
import { finish } from "../react/action-scope.js";
|
|
3
|
+
import { isThenable } from "../core/functions.js";
|
|
4
|
+
import { checkpointCommit, rewindCommit, queueCommitEffects } from "./commit.js";
|
|
5
|
+
import { ReactSharedInternals } from "../react/shared-internals.js";
|
|
6
|
+
import { transitionScope } from "../react/hooks.js";
|
|
7
|
+
let a = false;
|
|
8
|
+
const p = (fiber) => !!fiber.r?.tr?.has(fiber);
|
|
9
|
+
function q(hook, fiber, action) {
|
|
10
|
+
const scope = ReactSharedInternals.T && ReactSharedInternals.B;
|
|
11
|
+
if (!scope && !hook.t)
|
|
12
|
+
return false;
|
|
13
|
+
const previous = hook.t || (hook.c || []).reduce((p2, a2) => [p2, void 0, a2, hook.s], null);
|
|
14
|
+
hook.c = null;
|
|
15
|
+
hook.t = [previous, scope, action, previous ? previous[3] : hook.s];
|
|
16
|
+
if (scope)
|
|
17
|
+
enqueue(fiber, scope);
|
|
18
|
+
else
|
|
19
|
+
scheduleUpdate(fiber);
|
|
20
|
+
return true;
|
|
21
|
+
}
|
|
22
|
+
function v(hook, fiber, value) {
|
|
23
|
+
if (!hook.d || a) {
|
|
24
|
+
hook.d = true;
|
|
25
|
+
return value;
|
|
26
|
+
} else if (!Object.is(value, hook.s))
|
|
27
|
+
enqueue(fiber);
|
|
28
|
+
return hook.s;
|
|
29
|
+
}
|
|
30
|
+
function c(root) {
|
|
31
|
+
const pending = root.tr;
|
|
32
|
+
if (pending) {
|
|
33
|
+
complete(pending.s);
|
|
34
|
+
pending.s.clear();
|
|
35
|
+
pending.clear();
|
|
36
|
+
pending.u = void 0;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
function t(root, render) {
|
|
40
|
+
const pending = root.tr;
|
|
41
|
+
if (!pending?.size)
|
|
42
|
+
return;
|
|
43
|
+
const checkpoint = checkpointCommit(root.r);
|
|
44
|
+
const fibers = [...pending];
|
|
45
|
+
a = true;
|
|
46
|
+
try {
|
|
47
|
+
const update = pending.u;
|
|
48
|
+
render(root, fibers, update);
|
|
49
|
+
if (pending.u === update)
|
|
50
|
+
pending.u = void 0;
|
|
51
|
+
for (const fiber of fibers) {
|
|
52
|
+
pending.delete(fiber);
|
|
53
|
+
}
|
|
54
|
+
if (!pending.size) {
|
|
55
|
+
const work = pending.s;
|
|
56
|
+
pending.s = /* @__PURE__ */ new Set();
|
|
57
|
+
queueCommitEffects(() => complete(work));
|
|
58
|
+
}
|
|
59
|
+
} catch (error) {
|
|
60
|
+
if (!isThenable(error))
|
|
61
|
+
throw error;
|
|
62
|
+
rewindCommit(checkpoint);
|
|
63
|
+
for (const scope of pending.s)
|
|
64
|
+
scope.n?.(scope);
|
|
65
|
+
if (pending.w !== error) {
|
|
66
|
+
pending.w = error;
|
|
67
|
+
const retry = () => transitionScope(() => {
|
|
68
|
+
for (const fiber of pending)
|
|
69
|
+
scheduleUpdate(fiber);
|
|
70
|
+
});
|
|
71
|
+
error.then(retry, retry);
|
|
72
|
+
}
|
|
73
|
+
} finally {
|
|
74
|
+
a = false;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
function complete(work) {
|
|
78
|
+
for (const scope of work) {
|
|
79
|
+
scope.v--;
|
|
80
|
+
finish(scope);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
function enqueue(fiber, scope) {
|
|
84
|
+
const root = findRoot(fiber);
|
|
85
|
+
if (!root)
|
|
86
|
+
return;
|
|
87
|
+
let pending = root.tr;
|
|
88
|
+
if (!pending) {
|
|
89
|
+
pending = root.tr = /* @__PURE__ */ new Set();
|
|
90
|
+
pending.s = /* @__PURE__ */ new Set();
|
|
91
|
+
}
|
|
92
|
+
const fresh = !pending.has(fiber);
|
|
93
|
+
pending.add(fiber);
|
|
94
|
+
if (scope && !pending.s.has(scope)) {
|
|
95
|
+
scope.v = (scope.v || 0) + 1;
|
|
96
|
+
scope.p++;
|
|
97
|
+
pending.s.add(scope);
|
|
98
|
+
}
|
|
99
|
+
if (ReactSharedInternals.F) {
|
|
100
|
+
if (fresh)
|
|
101
|
+
queueCommitEffects(() => scheduleUpdate(fiber));
|
|
102
|
+
} else
|
|
103
|
+
scheduleUpdate(fiber);
|
|
104
|
+
}
|
|
105
|
+
function s(root, render) {
|
|
106
|
+
if (!ReactSharedInternals.T) {
|
|
107
|
+
if (root.tr)
|
|
108
|
+
root.tr.u = void 0;
|
|
109
|
+
return false;
|
|
110
|
+
}
|
|
111
|
+
const scope = ReactSharedInternals.B;
|
|
112
|
+
enqueue(root.r, scope?.o === root ? scope : void 0);
|
|
113
|
+
root.tr.u = render;
|
|
114
|
+
return true;
|
|
115
|
+
}
|
|
116
|
+
function r(hook, reducer) {
|
|
117
|
+
if (!hook.t)
|
|
118
|
+
return false;
|
|
119
|
+
let state = hook.t[3], base = state, pending = void 0;
|
|
120
|
+
const stack = [];
|
|
121
|
+
for (let node = hook.t; node; node = node[0])
|
|
122
|
+
stack.push(node);
|
|
123
|
+
while (stack.length) {
|
|
124
|
+
const node = stack.pop();
|
|
125
|
+
const skipped = node[1] && !a;
|
|
126
|
+
if (skipped) {
|
|
127
|
+
if (!pending)
|
|
128
|
+
base = state;
|
|
129
|
+
} else
|
|
130
|
+
state = reducer(state, node[2]);
|
|
131
|
+
if (pending || skipped)
|
|
132
|
+
pending = [pending, node[1], node[2], base];
|
|
133
|
+
}
|
|
134
|
+
hook.t = pending;
|
|
135
|
+
hook.s = state;
|
|
136
|
+
return true;
|
|
137
|
+
}
|
|
138
|
+
export {
|
|
139
|
+
a,
|
|
140
|
+
c,
|
|
141
|
+
p,
|
|
142
|
+
q,
|
|
143
|
+
r,
|
|
144
|
+
s,
|
|
145
|
+
t,
|
|
146
|
+
v
|
|
147
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/dom/transitions.ts"],
|
|
4
|
+
"sourcesContent": ["import type { Fiber, FiberRoot, Hook } from '../core';\nimport { findRoot, scheduleUpdate } from './reconcile';\nimport { finish, type ActionScope } from '../react/action-scope';\nimport { isThenable } from '../core/functions';\nimport { checkpointCommit, rewindCommit, queueCommitEffects } from './commit';\nimport { ReactSharedInternals } from '../react/shared-internals';\nimport { transitionScope } from '../react/hooks';\nexport let a = false;\nexport const p = (fiber: Fiber): boolean => !!fiber.r?.tr?.has(fiber);\nexport function q(hook: Hook, fiber: Fiber, action: any): boolean {\n const scope = ReactSharedInternals.T && ReactSharedInternals.B;\n if (!scope && !hook.t)\n return false;\n const previous = hook.t || (hook.c || []).reduce((p: any, a: any) => ([p, undefined, a, hook.s]), null);\n hook.c = null;\n hook.t = [previous, scope, action, previous ? previous[3] : hook.s];\n if (scope)\n enqueue(fiber, scope);\n else\n scheduleUpdate(fiber);\n return true;\n}\nexport function v(hook: Hook, fiber: Fiber, value: any): any {\n if (!hook.d || a) {\n hook.d = true;\n return value;\n }\n else if (!Object.is(value, hook.s))\n enqueue(fiber);\n return hook.s;\n}\nexport function c(root: FiberRoot): void {\n const pending = root.tr;\n if (pending) {\n complete(pending.s);\n pending.s.clear();\n pending.clear();\n }\n}\nexport function t(root: FiberRoot, render: (root: FiberRoot, fibers: Fiber[]) => void): void {\n const pending = root.tr;\n if (!pending?.size)\n return;\n const checkpoint = checkpointCommit(root.r);\n const fibers = [...pending];\n a = true;\n try {\n render(root, fibers);\n for (const fiber of fibers) {\n pending.delete(fiber);\n }\n if (!pending.size) {\n const work = pending.s;\n pending.s = new Set();\n queueCommitEffects(() => complete(work));\n }\n }\n catch (error) {\n if (!isThenable(error))\n throw error;\n rewindCommit(checkpoint);\n for (const scope of pending.s)\n scope.n?.();\n if (pending.w !== error) {\n pending.w = error;\n const retry = () => transitionScope(() => {\n for (const fiber of pending)\n scheduleUpdate(fiber);\n });\n error.then(retry, retry);\n }\n }\n finally {\n a = false;\n }\n}\nfunction complete(work: Set<ActionScope>): void {\n for (const scope of work) {\n scope.v!--;\n finish(scope);\n }\n}\nfunction enqueue(fiber: Fiber, scope?: ActionScope | null): void {\n const root = findRoot(fiber);\n if (!root)\n return;\n let pending = root.tr;\n if (!pending) {\n pending = root.tr = new Set() as NonNullable<FiberRoot[\"tr\"]>;\n pending.s = new Set();\n }\n const fresh = !pending.has(fiber);\n pending.add(fiber);\n if (scope && !pending.s.has(scope)) {\n scope.v = (scope.v || 0) + 1;\n scope.p++;\n pending.s.add(scope);\n }\n if (ReactSharedInternals.F) {\n if (fresh)\n queueCommitEffects(() => scheduleUpdate(fiber));\n }\n else\n scheduleUpdate(fiber);\n}\nexport function r(hook: Hook, reducer: (state: any, action: any) => any): boolean {\n if (!hook.t)\n return false;\n let state = hook.t[3], base = state, pending: any = undefined;\n const stack = [];\n for (let node = hook.t; node; node = node[0])\n stack.push(node);\n while (stack.length) {\n const node = stack.pop()!;\n const skipped = node[1] && !a;\n if (skipped) {\n if (!pending)\n base = state;\n }\n else\n state = reducer(state, node[2]);\n if (pending || skipped)\n pending = [pending, node[1], node[2], base];\n }\n hook.t = pending;\n hook.s = state;\n return true;\n}\n"],
|
|
5
|
+
"mappings": "AACA,SAAS,UAAU,sBAAsB;AACzC,SAAS,cAAgC;AACzC,SAAS,kBAAkB;AAC3B,SAAS,kBAAkB,cAAc,0BAA0B;AACnE,SAAS,4BAA4B;AACrC,SAAS,uBAAuB;AACzB,IAAI,IAAI;AACR,MAAM,IAAI,CAAC,UAA0B,CAAC,CAAC,MAAM,GAAG,IAAI,IAAI,KAAK;AAC9D,SAAU,EAAE,MAAY,OAAc,QAAW;AACnD,QAAM,QAAQ,qBAAqB,KAAK,qBAAqB;AAC7D,MAAI,CAAC,SAAS,CAAC,KAAK;AAChB,WAAO;AACX,QAAM,WAAW,KAAK,MAAM,KAAK,KAAK,CAAA,GAAI,OAAO,CAACA,IAAQC,OAAY,CAACD,IAAG,QAAWC,IAAG,KAAK,CAAC,GAAI,IAAI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,5 @@
|
|
|
1
|
+
import { type Fiber, type FiberRoot } from "../core/index.js";
|
|
2
|
+
export declare function getAnchor(fiber: Fiber, domParent: Node): Node | null;
|
|
3
|
+
export declare function getHostParent(fiber: Fiber): Node;
|
|
4
|
+
export declare function findRoot(fiber: Fiber): FiberRoot | null;
|
|
5
|
+
export declare function firstDomNode(fiber: Fiber, domParent: Node): Node | null;
|
package/dist/dom/tree.js
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
function getAnchor(fiber, domParent) {
|
|
2
|
+
let p = fiber;
|
|
3
|
+
while (p) {
|
|
4
|
+
let sibling = p.s;
|
|
5
|
+
while (sibling) {
|
|
6
|
+
const d = firstDomNode(sibling, domParent);
|
|
7
|
+
if (d)
|
|
8
|
+
return d;
|
|
9
|
+
sibling = sibling.s;
|
|
10
|
+
}
|
|
11
|
+
p = p.p;
|
|
12
|
+
if (p?.t === 0 || p?.t === 12 || p?.t === 5)
|
|
13
|
+
break;
|
|
14
|
+
}
|
|
15
|
+
return null;
|
|
16
|
+
}
|
|
17
|
+
function getHostParent(fiber) {
|
|
18
|
+
let p = fiber.p;
|
|
19
|
+
while (p) {
|
|
20
|
+
if (p.t === 0)
|
|
21
|
+
return p.n;
|
|
22
|
+
if (p.t === 12 || p.t === 5) {
|
|
23
|
+
return p.t === 5 && (p.v ?? p.m)?.container || p.i || p.n || p.r?.c;
|
|
24
|
+
}
|
|
25
|
+
p = p.p;
|
|
26
|
+
}
|
|
27
|
+
if (process.env.NODE_ENV !== "production") {
|
|
28
|
+
throw new Error("No host parent found.");
|
|
29
|
+
}
|
|
30
|
+
throw new Error();
|
|
31
|
+
}
|
|
32
|
+
function findRoot(fiber) {
|
|
33
|
+
let f = fiber;
|
|
34
|
+
while (f) {
|
|
35
|
+
if (f.r)
|
|
36
|
+
return fiber.r = f.r;
|
|
37
|
+
f = f.p;
|
|
38
|
+
}
|
|
39
|
+
return null;
|
|
40
|
+
}
|
|
41
|
+
function firstDomNode(fiber, domParent) {
|
|
42
|
+
if (fiber.t === 11 && fiber.b?.w && fiber.b.b.parentNode === domParent)
|
|
43
|
+
return fiber.b.b;
|
|
44
|
+
if (fiber.t <= 1) {
|
|
45
|
+
return fiber.n?.parentNode === domParent ? fiber.n : null;
|
|
46
|
+
}
|
|
47
|
+
let c = fiber.c;
|
|
48
|
+
while (c) {
|
|
49
|
+
const d = firstDomNode(c, domParent);
|
|
50
|
+
if (d)
|
|
51
|
+
return d;
|
|
52
|
+
c = c.s;
|
|
53
|
+
}
|
|
54
|
+
return fiber.t === 11 && fiber.b?.f ? firstDomNode(fiber.b.f, domParent) : null;
|
|
55
|
+
}
|
|
56
|
+
export {
|
|
57
|
+
findRoot,
|
|
58
|
+
firstDomNode,
|
|
59
|
+
getAnchor,
|
|
60
|
+
getHostParent
|
|
61
|
+
};
|
|
62
|
+
//# sourceMappingURL=tree.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/dom/tree.ts"],
|
|
4
|
+
"sourcesContent": ["import { FiberTag, type Fiber, type FiberRoot } from '../core';\nexport function getAnchor(fiber: Fiber, domParent: Node): Node | null {\n let p: Fiber | null = fiber;\n while (p) {\n let sibling = p.s;\n while (sibling) {\n const d = firstDomNode(sibling, domParent);\n if (d)\n return d;\n sibling = sibling.s;\n }\n p = p.p;\n if (p?.t === FiberTag.Host || p?.t === FiberTag.Root || p?.t === FiberTag.Portal)\n break;\n }\n return null;\n}\nexport function getHostParent(fiber: Fiber): Node {\n let p = fiber.p;\n while (p) {\n if (p.t === FiberTag.Host)\n return p.n!;\n if (p.t === FiberTag.Root || p.t === FiberTag.Portal) {\n return (p.t === FiberTag.Portal && (p.v ?? p.m)?.container) || p.i || p.n || p.r?.c;\n }\n p = p.p;\n }\n if (process.env.NODE_ENV !== 'production') {\n throw new Error('No host parent found.');\n }\n throw new Error();\n}\nexport function findRoot(fiber: Fiber): FiberRoot | null {\n let f: Fiber | null = fiber;\n while (f) {\n if (f.r)\n return fiber.r = f.r;\n f = f.p;\n }\n return null;\n}\nexport function firstDomNode(fiber: Fiber, domParent: Node): Node | null {\n if (fiber.t === FiberTag.Suspense && fiber.b?.w && fiber.b.b.parentNode === domParent)\n return fiber.b.b;\n if (fiber.t <= FiberTag.Text) {\n return fiber.n?.parentNode === domParent ? fiber.n : null;\n }\n let c = fiber.c;\n while (c) {\n const d = firstDomNode(c, domParent);\n if (d)\n return d;\n c = c.s;\n }\n return fiber.t === FiberTag.Suspense && fiber.b?.f ? firstDomNode(fiber.b.f, domParent) : null;\n}\n"],
|
|
5
|
+
"mappings": "AACM,SAAU,UAAU,OAAc,WAAe;AACnD,MAAI,IAAkB;AACtB,SAAO,GAAG;AACN,QAAI,UAAU,EAAE;AAChB,WAAO,SAAS;AACZ,YAAM,IAAI,aAAa,SAAS,SAAS;AACzC,UAAI;AACA,eAAO;AACX,gBAAU,QAAQ;IACtB;AACA,QAAI,EAAE;AACN,QAAI,GAAG,MAAC,KAAsB,GAAG,MAAC,MAAsB,GAAG,MAAC;AACxD;EACR;AACA,SAAO;AACX;AACM,SAAU,cAAc,OAAY;AACtC,MAAI,IAAI,MAAM;AACd,SAAO,GAAG;AACN,QAAI,EAAE,MAAC;AACH,aAAO,EAAE;AACb,QAAI,EAAE,MAAC,MAAsB,EAAE,MAAC,GAAsB;AAClD,aAAQ,EAAE,MAAC,MAAyB,EAAE,KAAK,EAAE,IAAI,aAAc,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG;IACtF;AACA,QAAI,EAAE;EACV;AACA,MAAI,yBAAyB,cAAc;AACvC,UAAM,IAAI,MAAM,uBAAuB;EAC3C;AACA,QAAM,IAAI,MAAK;AACnB;AACM,SAAU,SAAS,OAAY;AACjC,MAAI,IAAkB;AACtB,SAAO,GAAG;AACN,QAAI,EAAE;AACF,aAAO,MAAM,IAAI,EAAE;AACvB,QAAI,EAAE;EACV;AACA,SAAO;AACX;AACM,SAAU,aAAa,OAAc,WAAe;AACtD,MAAI,MAAM,MAAC,MAA0B,MAAM,GAAG,KAAK,MAAM,EAAE,EAAE,eAAe;AACxE,WAAO,MAAM,EAAE;AACnB,MAAI,MAAM,KAAC,GAAmB;AAC1B,WAAO,MAAM,GAAG,eAAe,YAAY,MAAM,IAAI;EACzD;AACA,MAAI,IAAI,MAAM;AACd,SAAO,GAAG;AACN,UAAM,IAAI,aAAa,GAAG,SAAS;AACnC,QAAI;AACA,aAAO;AACX,QAAI,EAAE;EACV;AACA,SAAO,MAAM,MAAC,MAA0B,MAAM,GAAG,IAAI,aAAa,MAAM,EAAE,GAAG,SAAS,IAAI;AAC9F;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/dist/dom/walk.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
function walkRetained(fiber, visit, postorder) {
|
|
2
|
+
if (!postorder)
|
|
3
|
+
visit(fiber);
|
|
4
|
+
for (let child = fiber.c; child; child = child.s)
|
|
5
|
+
walkRetained(child, visit, postorder);
|
|
6
|
+
if (fiber.t === 11 && fiber.b?.f)
|
|
7
|
+
walkRetained(fiber.b.f, visit, postorder);
|
|
8
|
+
if (postorder)
|
|
9
|
+
visit(fiber);
|
|
10
|
+
}
|
|
11
|
+
export {
|
|
12
|
+
walkRetained
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=walk.js.map
|