@bleedingdev/tanstack-redact 0.0.0-stage → 0.2.1
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 +35 -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 +22 -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,324 @@
|
|
|
1
|
+
import { ReactSharedInternals } from "../../../react/shared-internals.js";
|
|
2
|
+
import { prepareViewTransition } from "./visual.js";
|
|
3
|
+
import { recoverRootError } from "../../reconcile.js";
|
|
4
|
+
import { isFunction } from "../../../core/functions.js";
|
|
5
|
+
import { currentCommit, prepareCommit, commitBeforeMutation, commitMutation, commitSynchronously } from "../../commit.js";
|
|
6
|
+
const marks = /* @__PURE__ */ new Map();
|
|
7
|
+
const documents = /* @__PURE__ */ new Map();
|
|
8
|
+
let committing;
|
|
9
|
+
const ownerDocument = (root) => root.c.ownerDocument || root.c;
|
|
10
|
+
function deferTransitionPassive(work) {
|
|
11
|
+
if (!committing)
|
|
12
|
+
return false;
|
|
13
|
+
committing.p.push(work);
|
|
14
|
+
return true;
|
|
15
|
+
}
|
|
16
|
+
function render(work) {
|
|
17
|
+
for (const entry of work.values())
|
|
18
|
+
entry.c();
|
|
19
|
+
}
|
|
20
|
+
function cancel(coordinator) {
|
|
21
|
+
const transaction = coordinator.a;
|
|
22
|
+
const queued = coordinator.q;
|
|
23
|
+
const root = queued.keys().next().value;
|
|
24
|
+
const doc = transaction?.v.document ?? (root ? ownerDocument(root) : void 0);
|
|
25
|
+
coordinator.q = /* @__PURE__ */ new Map();
|
|
26
|
+
if (transaction) {
|
|
27
|
+
if (!transaction.r) {
|
|
28
|
+
coordinator.a = void 0;
|
|
29
|
+
transaction.a = true;
|
|
30
|
+
transaction.n?.skipTransition();
|
|
31
|
+
try {
|
|
32
|
+
transaction.v.cancel();
|
|
33
|
+
} catch (error) {
|
|
34
|
+
report(transaction, error);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
consume(transaction);
|
|
38
|
+
passive(transaction);
|
|
39
|
+
}
|
|
40
|
+
commitSynchronously(() => render(queued));
|
|
41
|
+
if (doc)
|
|
42
|
+
release(doc, coordinator);
|
|
43
|
+
}
|
|
44
|
+
function consume(transaction) {
|
|
45
|
+
transaction.c = true;
|
|
46
|
+
within(transaction, () => {
|
|
47
|
+
beforeMutation(transaction);
|
|
48
|
+
mutation(transaction);
|
|
49
|
+
});
|
|
50
|
+
drain(transaction.l);
|
|
51
|
+
}
|
|
52
|
+
function deferTransitionLayout(work) {
|
|
53
|
+
if (!committing)
|
|
54
|
+
return false;
|
|
55
|
+
committing.l.push(work);
|
|
56
|
+
return true;
|
|
57
|
+
}
|
|
58
|
+
function passive(transaction) {
|
|
59
|
+
if (transaction.c)
|
|
60
|
+
transaction.v.restore();
|
|
61
|
+
drain(transaction.p);
|
|
62
|
+
}
|
|
63
|
+
function mutation(transaction) {
|
|
64
|
+
for (const plan of transaction.s)
|
|
65
|
+
commitMutation(plan);
|
|
66
|
+
}
|
|
67
|
+
function release(doc, coordinator) {
|
|
68
|
+
if (!coordinator.a && !coordinator.q.size && documents.get(doc) === coordinator)
|
|
69
|
+
documents.delete(doc);
|
|
70
|
+
}
|
|
71
|
+
function deferTransition(root, commit, flush) {
|
|
72
|
+
if (committing?.f && !currentCommit && ownerDocument(root) === committing.v.document) {
|
|
73
|
+
prepareRoot(committing, root, commit);
|
|
74
|
+
return true;
|
|
75
|
+
}
|
|
76
|
+
if (!marks.size && !documents.size)
|
|
77
|
+
return false;
|
|
78
|
+
const scopes = marks.get(root);
|
|
79
|
+
marks.delete(root);
|
|
80
|
+
const doc = ownerDocument(root);
|
|
81
|
+
const activeCoordinator = documents.get(doc);
|
|
82
|
+
if (activeCoordinator?.a?.s.length && !activeCoordinator.a.c && !currentCommit) {
|
|
83
|
+
if (committing || !scopes)
|
|
84
|
+
cancel(activeCoordinator);
|
|
85
|
+
}
|
|
86
|
+
if (committing || !scopes || !doc.startViewTransition)
|
|
87
|
+
return false;
|
|
88
|
+
let coordinator = documents.get(doc);
|
|
89
|
+
if (!coordinator) {
|
|
90
|
+
coordinator = { q: /* @__PURE__ */ new Map(), f: flush, s: false };
|
|
91
|
+
documents.set(doc, coordinator);
|
|
92
|
+
}
|
|
93
|
+
const existing = coordinator.q.get(root);
|
|
94
|
+
if (existing)
|
|
95
|
+
for (const scope of scopes)
|
|
96
|
+
existing.s.add(scope);
|
|
97
|
+
else
|
|
98
|
+
coordinator.q.set(root, { c: commit, s: scopes });
|
|
99
|
+
kick(doc, coordinator);
|
|
100
|
+
return true;
|
|
101
|
+
}
|
|
102
|
+
function finish(doc, coordinator, transaction) {
|
|
103
|
+
if (coordinator.a === transaction)
|
|
104
|
+
coordinator.a = void 0;
|
|
105
|
+
try {
|
|
106
|
+
passive(transaction);
|
|
107
|
+
} catch (error) {
|
|
108
|
+
report(transaction, error);
|
|
109
|
+
} finally {
|
|
110
|
+
try {
|
|
111
|
+
transaction.v.finish();
|
|
112
|
+
} catch (error) {
|
|
113
|
+
report(transaction, error);
|
|
114
|
+
} finally {
|
|
115
|
+
if (coordinator.q.size)
|
|
116
|
+
kick(doc, coordinator);
|
|
117
|
+
else
|
|
118
|
+
release(doc, coordinator);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
const reportable = (error) => error !== null && !(error && typeof error === "object" && "name" in error && error.name === "InvalidStateError" && "message" in error && (error.message === "View transition was skipped because document visibility state is hidden." || error.message === "Skipping view transition because document visibility state has become hidden." || error.message === "Skipping view transition because viewport size changed." || error.message === "Transition was aborted because of invalid state"));
|
|
123
|
+
function within(transaction, work) {
|
|
124
|
+
const previous = committing;
|
|
125
|
+
committing = transaction;
|
|
126
|
+
try {
|
|
127
|
+
work();
|
|
128
|
+
} finally {
|
|
129
|
+
committing = previous;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
function report(transaction, error) {
|
|
133
|
+
const root = transaction.w.keys().next().value;
|
|
134
|
+
if (root?.ue)
|
|
135
|
+
root.ue(error, { componentStack: null });
|
|
136
|
+
else
|
|
137
|
+
queueMicrotask(() => {
|
|
138
|
+
throw error;
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
function drain(queue) {
|
|
142
|
+
while (queue.length)
|
|
143
|
+
queue.shift()();
|
|
144
|
+
}
|
|
145
|
+
function markTransitionUpdate(root) {
|
|
146
|
+
if (committing)
|
|
147
|
+
return;
|
|
148
|
+
const coordinator = documents.size ? documents.get(ownerDocument(root)) : void 0;
|
|
149
|
+
if (coordinator?.a)
|
|
150
|
+
passive(coordinator.a);
|
|
151
|
+
const scope = ReactSharedInternals.T;
|
|
152
|
+
if (scope) {
|
|
153
|
+
if (marks.get(root) !== null) {
|
|
154
|
+
let scopes = marks.get(root);
|
|
155
|
+
if (!scopes)
|
|
156
|
+
marks.set(root, scopes = /* @__PURE__ */ new Set());
|
|
157
|
+
scopes.add(scope);
|
|
158
|
+
}
|
|
159
|
+
} else {
|
|
160
|
+
if (marks.has(root))
|
|
161
|
+
marks.set(root, null);
|
|
162
|
+
if (coordinator)
|
|
163
|
+
cancel(coordinator);
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
function prepareRoot(transaction, root, commit) {
|
|
167
|
+
try {
|
|
168
|
+
prepareCommit(() => {
|
|
169
|
+
transaction.s.push(currentCommit);
|
|
170
|
+
commit();
|
|
171
|
+
});
|
|
172
|
+
} catch (error) {
|
|
173
|
+
transaction.s.pop();
|
|
174
|
+
if (!recoverRootError(error))
|
|
175
|
+
throw error;
|
|
176
|
+
transaction.w.delete(root);
|
|
177
|
+
transaction.v.exclude(root);
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
function beforeMutation(transaction) {
|
|
181
|
+
for (const plan of transaction.s)
|
|
182
|
+
commitBeforeMutation(plan);
|
|
183
|
+
}
|
|
184
|
+
function cancelTransitions() {
|
|
185
|
+
if (!marks.size && !documents.size)
|
|
186
|
+
return;
|
|
187
|
+
marks.clear();
|
|
188
|
+
for (const [doc, coordinator] of [...documents]) {
|
|
189
|
+
cancel(coordinator);
|
|
190
|
+
release(doc, coordinator);
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
function kick(doc, coordinator) {
|
|
194
|
+
if (coordinator.a || coordinator.s || !coordinator.q.size)
|
|
195
|
+
return;
|
|
196
|
+
coordinator.s = true;
|
|
197
|
+
queueMicrotask(async () => {
|
|
198
|
+
coordinator.s = false;
|
|
199
|
+
if (coordinator.a || !coordinator.q.size)
|
|
200
|
+
return;
|
|
201
|
+
const work = coordinator.q;
|
|
202
|
+
coordinator.q = /* @__PURE__ */ new Map();
|
|
203
|
+
const types = /* @__PURE__ */ new Set();
|
|
204
|
+
for (const entry of work.values())
|
|
205
|
+
for (const scope of entry.s)
|
|
206
|
+
for (const type of scope)
|
|
207
|
+
types.add(type);
|
|
208
|
+
const visual = prepareViewTransition(work.keys(), [...types]);
|
|
209
|
+
if (!visual) {
|
|
210
|
+
commitSynchronously(() => render(work));
|
|
211
|
+
release(doc, coordinator);
|
|
212
|
+
return;
|
|
213
|
+
}
|
|
214
|
+
const transaction = { v: visual, w: work, l: [], p: [], s: [], f: true, c: false, a: false, r: false };
|
|
215
|
+
coordinator.a = transaction;
|
|
216
|
+
try {
|
|
217
|
+
try {
|
|
218
|
+
within(transaction, () => {
|
|
219
|
+
for (const [root, entry] of work)
|
|
220
|
+
prepareRoot(transaction, root, entry.c);
|
|
221
|
+
coordinator.f();
|
|
222
|
+
});
|
|
223
|
+
} finally {
|
|
224
|
+
transaction.f = false;
|
|
225
|
+
}
|
|
226
|
+
const resources = visual.prepare();
|
|
227
|
+
if (resources)
|
|
228
|
+
await resources;
|
|
229
|
+
if (transaction.a)
|
|
230
|
+
return;
|
|
231
|
+
within(transaction, () => beforeMutation(transaction));
|
|
232
|
+
if (!visual.beforeCommit()) {
|
|
233
|
+
cancel(coordinator);
|
|
234
|
+
return;
|
|
235
|
+
}
|
|
236
|
+
} catch (error) {
|
|
237
|
+
cancel(coordinator);
|
|
238
|
+
report(transaction, error);
|
|
239
|
+
return;
|
|
240
|
+
}
|
|
241
|
+
const update = () => {
|
|
242
|
+
if (transaction.c)
|
|
243
|
+
return;
|
|
244
|
+
transaction.c = true;
|
|
245
|
+
const navigation = doc.defaultView?.navigation?.transition;
|
|
246
|
+
const fonts = doc.fonts;
|
|
247
|
+
const wasLoaded = fonts?.status === "loaded";
|
|
248
|
+
within(transaction, () => {
|
|
249
|
+
mutation(transaction);
|
|
250
|
+
coordinator.f();
|
|
251
|
+
});
|
|
252
|
+
const finishCommit = () => {
|
|
253
|
+
if (transaction.a)
|
|
254
|
+
return;
|
|
255
|
+
within(transaction, () => {
|
|
256
|
+
drain(transaction.l);
|
|
257
|
+
coordinator.f();
|
|
258
|
+
});
|
|
259
|
+
if (navigation)
|
|
260
|
+
return navigation.finished.catch(() => {
|
|
261
|
+
}).then(() => {
|
|
262
|
+
if (!transaction.a)
|
|
263
|
+
visual.afterCommit();
|
|
264
|
+
});
|
|
265
|
+
visual.afterCommit();
|
|
266
|
+
};
|
|
267
|
+
const resources = visual.waitForResources(!!wasLoaded);
|
|
268
|
+
if (resources)
|
|
269
|
+
return resources.then(finishCommit);
|
|
270
|
+
return finishCommit();
|
|
271
|
+
};
|
|
272
|
+
try {
|
|
273
|
+
const native = transaction.n = doc.startViewTransition({ update, types: [...types] });
|
|
274
|
+
native.updateCallbackDone.catch((error) => report(transaction, error));
|
|
275
|
+
native.ready.then(() => {
|
|
276
|
+
if (!transaction.a) {
|
|
277
|
+
transaction.r = true;
|
|
278
|
+
try {
|
|
279
|
+
visual.ready();
|
|
280
|
+
} catch (error) {
|
|
281
|
+
report(transaction, error);
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
}, (error) => {
|
|
285
|
+
try {
|
|
286
|
+
if (!transaction.a && reportable(error)) {
|
|
287
|
+
const root = transaction.w.keys().next().value;
|
|
288
|
+
if (root?.re)
|
|
289
|
+
root.re(error, { componentStack: null });
|
|
290
|
+
else if (isFunction(reportError))
|
|
291
|
+
reportError(error);
|
|
292
|
+
else
|
|
293
|
+
queueMicrotask(() => {
|
|
294
|
+
throw error;
|
|
295
|
+
});
|
|
296
|
+
}
|
|
297
|
+
} finally {
|
|
298
|
+
transaction.a = true;
|
|
299
|
+
try {
|
|
300
|
+
visual.cancel();
|
|
301
|
+
} finally {
|
|
302
|
+
consume(transaction);
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
});
|
|
306
|
+
native.finished.then(() => finish(doc, coordinator, transaction), () => finish(doc, coordinator, transaction));
|
|
307
|
+
} catch {
|
|
308
|
+
cancel(coordinator);
|
|
309
|
+
}
|
|
310
|
+
});
|
|
311
|
+
}
|
|
312
|
+
export {
|
|
313
|
+
cancelTransitions as c,
|
|
314
|
+
cancelTransitions,
|
|
315
|
+
deferTransition as d,
|
|
316
|
+
deferTransition,
|
|
317
|
+
deferTransitionLayout,
|
|
318
|
+
deferTransitionPassive,
|
|
319
|
+
deferTransitionLayout as l,
|
|
320
|
+
markTransitionUpdate as m,
|
|
321
|
+
markTransitionUpdate,
|
|
322
|
+
deferTransitionPassive as p
|
|
323
|
+
};
|
|
324
|
+
//# sourceMappingURL=full.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/dom/features/view-transition/full.ts"],
|
|
4
|
+
"sourcesContent": ["import { ReactSharedInternals } from '../../../react/shared-internals'\n\nimport { prepareViewTransition } from './visual'\n\nimport { recoverRootError } from '../../reconcile'\n\nimport { isFunction } from '../../../core/functions'\n\nimport { currentCommit, prepareCommit, commitBeforeMutation, commitMutation, commitSynchronously, type CommitPlan } from '../../commit'\n\nimport type { FiberRoot } from '../../../core'\n\ntype Work = { c: () => void; s: Set<Set<string>> }\ntype Visual = NonNullable<ReturnType<typeof prepareViewTransition>>\ninterface Transaction {\n n?: ViewTransition\n v: Visual\n w: Map<FiberRoot, Work>\n l: Array<() => void>\n p: Array<() => void>\n c: boolean\n a: boolean\n r: boolean\n s: CommitPlan[]\n f: boolean\n}\ninterface Coordinator {\n q: Map<FiberRoot, Work>\n a?: Transaction | undefined\n f: () => void\n s: boolean\n}\n\nconst marks = new Map<FiberRoot, Set<Set<string>> | null>()\nconst documents = new Map<Document, Coordinator>()\nlet committing: Transaction | undefined\n\nconst ownerDocument = (root: FiberRoot): Document => ((root.c.ownerDocument || root.c) as Document)\n\nexport function deferTransitionPassive(work: () => void): boolean {\n if (!committing) return false\n committing.p.push(work)\n return true\n}\n\nfunction render(work: Map<FiberRoot, Work>): void {\n for (const entry of work.values()) entry.c()\n}\n\nfunction cancel(coordinator: Coordinator): void {\n const transaction = coordinator.a\n const queued = coordinator.q\n const root = queued.keys().next().value\n const doc = transaction?.v.document ?? (root ? ownerDocument(root) : undefined)\n coordinator.q = new Map()\n if (transaction) {\n if (!transaction.r) {\n coordinator.a = undefined\n transaction.a = true\n transaction.n?.skipTransition()\n try { transaction.v.cancel() } catch (error) { report(transaction, error) }\n }\n consume(transaction)\n passive(transaction)\n }\n commitSynchronously(() => render(queued))\n if (doc) release(doc, coordinator)\n}\n\nfunction consume(transaction: Transaction): void {\n transaction.c = true\n within(transaction, () => {\n beforeMutation(transaction)\n mutation(transaction)\n })\n drain(transaction.l)\n}\n\nexport function deferTransitionLayout(work: () => void): boolean {\n if (!committing) return false\n committing.l.push(work)\n return true\n}\n\nfunction passive(transaction: Transaction): void {\n if (transaction.c) transaction.v.restore()\n drain(transaction.p)\n}\n\nfunction mutation(transaction: Transaction): void {\n for (const plan of transaction.s) commitMutation(plan)\n}\n\nfunction release(doc: Document, coordinator: Coordinator): void {\n if (!coordinator.a && !coordinator.q.size && documents.get(doc) === coordinator) documents.delete(doc)\n}\n\nexport function deferTransition(root: FiberRoot, commit: () => void, flush: () => void): boolean {\n if (committing?.f && !currentCommit && ownerDocument(root) === committing.v.document) {\n prepareRoot(committing, root, commit)\n return true\n }\n if (!marks.size && !documents.size) return false\n const scopes = marks.get(root)\n marks.delete(root)\n const doc = ownerDocument(root)\n const activeCoordinator = documents.get(doc)\n if (activeCoordinator?.a?.s.length && !activeCoordinator.a.c && !currentCommit) {\n // A reentrant urgent render must consume the already-rendered commit\n // before reconciling another tree against it.\n if (committing || !scopes) cancel(activeCoordinator)\n }\n if (committing || !scopes || !doc.startViewTransition) return false\n let coordinator = documents.get(doc)\n if (!coordinator) {\n coordinator = { q: new Map(), f: flush, s: false }\n documents.set(doc, coordinator)\n }\n const existing = coordinator.q.get(root)\n if (existing) for (const scope of scopes) existing.s.add(scope)\n else coordinator.q.set(root, { c: commit, s: scopes })\n kick(doc, coordinator)\n return true\n}\n\nfunction finish(doc: Document, coordinator: Coordinator, transaction: Transaction): void {\n if (coordinator.a === transaction) coordinator.a = undefined\n try { passive(transaction) } catch (error) { report(transaction, error) } finally {\n try { transaction.v.finish() } catch (error) { report(transaction, error) } finally {\n if (coordinator.q.size) kick(doc, coordinator)\n else release(doc, coordinator)\n }\n }\n}\n\nconst reportable = (error: unknown): boolean => (error !== null && !(error && typeof error === 'object' && 'name' in error && error.name === 'InvalidStateError' &&\n 'message' in error && (\n error.message === 'View transition was skipped because document visibility state is hidden.' ||\n error.message === 'Skipping view transition because document visibility state has become hidden.' ||\n error.message === 'Skipping view transition because viewport size changed.' ||\n error.message === 'Transition was aborted because of invalid state'\n )))\n\nfunction within(transaction: Transaction, work: () => void): void {\n const previous = committing\n committing = transaction\n try { work() } finally { committing = previous }\n}\n\nfunction report(transaction: Transaction, error: unknown): void {\n const root = transaction.w.keys().next().value\n if (root?.ue) root.ue(error, { componentStack: null })\n else queueMicrotask(() => { throw error })\n}\n\nfunction drain(queue: Array<() => void>): void {\n while (queue.length) queue.shift()!()\n}\n\nexport function markTransitionUpdate(root: FiberRoot): void {\n if (committing) return\n const coordinator = documents.size ? documents.get(ownerDocument(root)) : undefined\n if (coordinator?.a) passive(coordinator.a)\n const scope = ReactSharedInternals.T\n if (scope) {\n if (marks.get(root) !== null) {\n let scopes = marks.get(root)\n if (!scopes) marks.set(root, scopes = new Set())\n scopes.add(scope)\n }\n } else {\n if (marks.has(root)) marks.set(root, null)\n if (coordinator) cancel(coordinator)\n }\n}\n\nfunction prepareRoot(transaction: Transaction, root: FiberRoot, commit: () => void): void {\n try {\n prepareCommit(() => {\n transaction.s.push(currentCommit!)\n commit()\n })\n } catch (error) {\n transaction.s.pop()\n if (!recoverRootError(error)) throw error\n transaction.w.delete(root)\n transaction.v.exclude(root)\n }\n}\n\nfunction beforeMutation(transaction: Transaction): void {\n for (const plan of transaction.s) commitBeforeMutation(plan)\n}\n\nexport function cancelTransitions(): void {\n if (!marks.size && !documents.size) return\n marks.clear()\n for (const [doc, coordinator] of [...documents]) {\n cancel(coordinator)\n release(doc, coordinator)\n }\n}\n\nfunction kick(doc: Document, coordinator: Coordinator): void {\n if (coordinator.a || coordinator.s || !coordinator.q.size) return\n coordinator.s = true\n queueMicrotask(async () => {\n coordinator.s = false\n if (coordinator.a || !coordinator.q.size) return\n const work = coordinator.q\n coordinator.q = new Map()\n const types = new Set<string>()\n for (const entry of work.values()) for (const scope of entry.s) for (const type of scope) types.add(type)\n const visual = prepareViewTransition(work.keys(), [...types])\n if (!visual) {\n commitSynchronously(() => render(work))\n release(doc, coordinator)\n return\n }\n const transaction: Transaction = { v: visual, w: work, l: [], p: [], s: [], f: true, c: false, a: false, r: false }\n coordinator.a = transaction\n try {\n try {\n within(transaction, () => {\n for (const [root, entry] of work) prepareRoot(transaction, root, entry.c)\n coordinator.f()\n })\n } finally { transaction.f = false }\n const resources = visual.prepare()\n if (resources) await resources\n if (transaction.a) return\n within(transaction, () => beforeMutation(transaction))\n if (!visual.beforeCommit()) {\n cancel(coordinator)\n return\n }\n } catch (error) {\n cancel(coordinator)\n report(transaction, error)\n return\n }\n const update = () => {\n if (transaction.c) return\n transaction.c = true\n const navigation = (doc.defaultView as any)?.navigation?.transition\n const fonts = doc.fonts\n const wasLoaded = fonts?.status === 'loaded'\n within(transaction, () => {\n mutation(transaction)\n coordinator.f()\n })\n const finishCommit = () => {\n if (transaction.a) return\n within(transaction, () => { drain(transaction.l); coordinator.f() })\n if (navigation) return navigation.finished.catch(() => {}).then(() => {\n if (!transaction.a) visual.afterCommit()\n })\n visual.afterCommit()\n }\n const resources = visual.waitForResources(!!wasLoaded)\n if (resources) return resources.then(finishCommit)\n return finishCommit()\n }\n try {\n const native = transaction.n = doc.startViewTransition({ update, types: [...types] })\n native.updateCallbackDone.catch(error => report(transaction, error))\n native.ready.then(() => {\n if (!transaction.a) {\n transaction.r = true\n try { visual.ready() } catch (error) { report(transaction, error) }\n }\n }, error => {\n try {\n if (!transaction.a && reportable(error)) {\n const root = transaction.w.keys().next().value\n if (root?.re) root.re(error, { componentStack: null })\n else if (isFunction(reportError)) reportError(error)\n else queueMicrotask(() => { throw error })\n }\n } finally {\n transaction.a = true\n try { visual.cancel() } finally { consume(transaction) }\n }\n })\n native.finished.then(() => finish(doc, coordinator, transaction), () => finish(doc, coordinator, transaction))\n } catch {\n cancel(coordinator)\n }\n })\n}\n\nexport { markTransitionUpdate as m, deferTransition as d, cancelTransitions as c, deferTransitionLayout as l, deferTransitionPassive as p }\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,4BAA4B;AAErC,SAAS,6BAA6B;AAEtC,SAAS,wBAAwB;AAEjC,SAAS,kBAAkB;AAE3B,SAAS,eAAe,eAAe,sBAAsB,gBAAgB,2BAA4C;AAyBzH,MAAM,QAAQ,oBAAI,IAAG;AACrB,MAAM,YAAY,oBAAI,IAAG;AACzB,IAAI;AAEJ,MAAM,gBAAgB,CAAC,SAAgC,KAAK,EAAE,iBAAiB,KAAK;AAE9E,SAAU,uBAAuB,MAAgB;AACrD,MAAI,CAAC;AAAY,WAAO;AACxB,aAAW,EAAE,KAAK,IAAI;AACtB,SAAO;AACT;AAEA,SAAS,OAAO,MAA0B;AACxC,aAAW,SAAS,KAAK,OAAM;AAAI,UAAM,EAAC;AAC5C;AAEA,SAAS,OAAO,aAAwB;AACtC,QAAM,cAAc,YAAY;AAChC,QAAM,SAAS,YAAY;AAC3B,QAAM,OAAO,OAAO,KAAI,EAAG,KAAI,EAAG;AAClC,QAAM,MAAM,aAAa,EAAE,aAAa,OAAO,cAAc,IAAI,IAAI;AACrE,cAAY,IAAI,oBAAI,IAAG;AACvB,MAAI,aAAa;AACf,QAAI,CAAC,YAAY,GAAG;AAClB,kBAAY,IAAI;AAChB,kBAAY,IAAI;AAChB,kBAAY,GAAG,eAAc;AAC7B,UAAI;AAAE,oBAAY,EAAE,OAAM;MAAG,SAAS,OAAO;AAAE,eAAO,aAAa,KAAK;MAAE;IAC5E;AACA,YAAQ,WAAW;AACnB,YAAQ,WAAW;EACrB;AACA,sBAAoB,MAAM,OAAO,MAAM,CAAC;AACxC,MAAI;AAAK,YAAQ,K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
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./full.js";
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export type TransitionImages = Map<HTMLImageElement, {
|
|
2
|
+
src?: unknown;
|
|
3
|
+
srcSet?: unknown;
|
|
4
|
+
onLoad?: unknown;
|
|
5
|
+
loading?: unknown;
|
|
6
|
+
}>;
|
|
7
|
+
export declare function transitionResources(doc: Document, previous: TransitionImages, next: TransitionImages): {
|
|
8
|
+
before(): Promise<void>;
|
|
9
|
+
after(fontsWereLoaded: boolean): Promise<void>;
|
|
10
|
+
cancel(): void;
|
|
11
|
+
};
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { isFunction } from "../../../core/functions.js";
|
|
2
|
+
let imageBudget = 0;
|
|
3
|
+
const imageBytes = (image) => (image.width || 100) * (image.height || 100) * (image.ownerDocument.defaultView?.devicePixelRatio || 1) * 0.25;
|
|
4
|
+
const staticResource = (type) => /^(css|script|font|img|image|input|link)$/.test(type);
|
|
5
|
+
function bandwidth(doc) {
|
|
6
|
+
const view = doc.defaultView;
|
|
7
|
+
const entries = view.performance.getEntriesByType?.("resource");
|
|
8
|
+
let count = 0, bits = 0;
|
|
9
|
+
for (let i = 0; entries && i < entries.length; i++) {
|
|
10
|
+
const entry = entries[i];
|
|
11
|
+
if (!entry.transferSize || !entry.duration || !staticResource(entry.initiatorType))
|
|
12
|
+
continue;
|
|
13
|
+
let overlap = 0;
|
|
14
|
+
for (++i; i < entries.length; i++) {
|
|
15
|
+
const next = entries[i];
|
|
16
|
+
if (next.startTime > entry.responseEnd)
|
|
17
|
+
break;
|
|
18
|
+
if (next.transferSize && staticResource(next.initiatorType)) {
|
|
19
|
+
overlap += next.transferSize * (next.responseEnd < entry.responseEnd ? 1 : (entry.responseEnd - next.startTime) / (next.responseEnd - next.startTime));
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
i--;
|
|
23
|
+
bits += 8 * (entry.transferSize + overlap) / (entry.duration / 1e3);
|
|
24
|
+
if (++count > 10)
|
|
25
|
+
break;
|
|
26
|
+
}
|
|
27
|
+
if (count)
|
|
28
|
+
return bits / count / 1e6;
|
|
29
|
+
const downlink = view.navigator.connection?.downlink;
|
|
30
|
+
return typeof downlink === "number" ? downlink : 5;
|
|
31
|
+
}
|
|
32
|
+
function transitionResources(doc, previous, next) {
|
|
33
|
+
const pending = [];
|
|
34
|
+
const releases = /* @__PURE__ */ new Set();
|
|
35
|
+
function wait(promises, timeout, cleanups = []) {
|
|
36
|
+
if (!promises.length)
|
|
37
|
+
return;
|
|
38
|
+
return new Promise((resolve) => {
|
|
39
|
+
const finish = () => {
|
|
40
|
+
if (!releases.delete(finish))
|
|
41
|
+
return;
|
|
42
|
+
clearTimeout(timer);
|
|
43
|
+
for (const cleanup of cleanups)
|
|
44
|
+
cleanup();
|
|
45
|
+
resolve();
|
|
46
|
+
};
|
|
47
|
+
const timer = setTimeout(finish, timeout);
|
|
48
|
+
releases.add(finish);
|
|
49
|
+
Promise.all(promises).then(finish, finish);
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
return {
|
|
53
|
+
before() {
|
|
54
|
+
const promises = [];
|
|
55
|
+
let bytes = 0;
|
|
56
|
+
for (const [image, props] of next) {
|
|
57
|
+
const old = previous.get(image);
|
|
58
|
+
if (props.src == null || props.src === "" || props.onLoad != null || props.loading === "lazy" || old && props.src === old.src && props.srcSet === old.srcSet || !isFunction(image.decode))
|
|
59
|
+
continue;
|
|
60
|
+
if (!image.complete) {
|
|
61
|
+
pending.push(image);
|
|
62
|
+
bytes += imageBytes(image);
|
|
63
|
+
}
|
|
64
|
+
promises.push(image.decode().catch(() => {
|
|
65
|
+
}));
|
|
66
|
+
}
|
|
67
|
+
if (bytes && !imageBudget)
|
|
68
|
+
imageBudget = 125 * bandwidth(doc) * 500;
|
|
69
|
+
return wait(promises, bytes > imageBudget ? 50 : 800);
|
|
70
|
+
},
|
|
71
|
+
after(fontsWereLoaded) {
|
|
72
|
+
const promises = [];
|
|
73
|
+
const cleanups = [];
|
|
74
|
+
if (fontsWereLoaded) {
|
|
75
|
+
doc.documentElement.getBoundingClientRect();
|
|
76
|
+
if (doc.fonts.status === "loading")
|
|
77
|
+
promises.push(doc.fonts.ready);
|
|
78
|
+
}
|
|
79
|
+
const images = [];
|
|
80
|
+
let bytes = 0;
|
|
81
|
+
const view = doc.defaultView;
|
|
82
|
+
for (const image of pending) {
|
|
83
|
+
if (image.complete)
|
|
84
|
+
continue;
|
|
85
|
+
const rect = image.getBoundingClientRect();
|
|
86
|
+
if (rect.bottom <= 0 || rect.right <= 0 || rect.top >= view.innerHeight || rect.left >= view.innerWidth)
|
|
87
|
+
continue;
|
|
88
|
+
bytes += imageBytes(image);
|
|
89
|
+
if (bytes > imageBudget) {
|
|
90
|
+
images.length = 0;
|
|
91
|
+
break;
|
|
92
|
+
}
|
|
93
|
+
images.push(image);
|
|
94
|
+
}
|
|
95
|
+
for (const image of images) {
|
|
96
|
+
promises.push(new Promise((resolve) => {
|
|
97
|
+
const loaded = () => resolve();
|
|
98
|
+
image.addEventListener("load", loaded);
|
|
99
|
+
image.addEventListener("error", loaded);
|
|
100
|
+
cleanups.push(() => {
|
|
101
|
+
image.removeEventListener("load", loaded);
|
|
102
|
+
image.removeEventListener("error", loaded);
|
|
103
|
+
});
|
|
104
|
+
}));
|
|
105
|
+
}
|
|
106
|
+
return wait(promises, 500, cleanups);
|
|
107
|
+
},
|
|
108
|
+
cancel() {
|
|
109
|
+
for (const release of releases)
|
|
110
|
+
release();
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
export {
|
|
115
|
+
transitionResources
|
|
116
|
+
};
|
|
117
|
+
//# sourceMappingURL=resources.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/dom/features/view-transition/resources.ts"],
|
|
4
|
+
"sourcesContent": ["import { isFunction } from '../../../core/functions';\nexport type TransitionImages = Map<HTMLImageElement, {\n src?: unknown;\n srcSet?: unknown;\n onLoad?: unknown;\n loading?: unknown;\n}>;\nlet imageBudget = 0;\nconst imageBytes = (image: HTMLImageElement): number => ((image.width || 100) * (image.height || 100) * (image.ownerDocument.defaultView?.devicePixelRatio || 1) * 0.25);\nconst staticResource = (type: string): boolean => (/^(css|script|font|img|image|input|link)$/.test(type));\n// Match React's estimate from up to eleven groups of overlapping transfers,\n// falling back to the browser's downlink estimate and then 5 Mbps.\nfunction bandwidth(doc: Document): number {\n const view = doc.defaultView!;\n const entries = view.performance.getEntriesByType?.('resource') as PerformanceResourceTiming[] | undefined;\n let count = 0, bits = 0;\n for (let i = 0; entries && i < entries.length; i++) {\n const entry = entries[i]!;\n if (!entry.transferSize || !entry.duration || !staticResource(entry.initiatorType))\n continue;\n let overlap = 0;\n for (++i; i < entries.length; i++) {\n const next = entries[i]!;\n if (next.startTime > entry.responseEnd)\n break;\n if (next.transferSize && staticResource(next.initiatorType)) {\n overlap += next.transferSize * (next.responseEnd < entry.responseEnd ? 1 :\n (entry.responseEnd - next.startTime) / (next.responseEnd - next.startTime));\n }\n }\n i--;\n bits += 8 * (entry.transferSize + overlap) / (entry.duration / 1000);\n if (++count > 10)\n break;\n }\n if (count)\n return bits / count / 1000000;\n const downlink = (view.navigator as any).connection?.downlink;\n return typeof downlink === 'number' ? downlink : 5;\n}\nexport function transitionResources(doc: Document, previous: TransitionImages, next: TransitionImages) {\n const pending: HTMLImageElement[] = [];\n const releases = new Set<() => void>();\n function wait(promises: Promise<unknown>[], timeout: number, cleanups: Array<() => void> = []): Promise<void> | undefined {\n if (!promises.length)\n return;\n return new Promise(resolve => {\n const finish = () => {\n if (!releases.delete(finish))\n return;\n clearTimeout(timer);\n for (const cleanup of cleanups)\n cleanup();\n resolve();\n };\n const timer = setTimeout(finish, timeout);\n releases.add(finish);\n Promise.all(promises).then(finish, finish);\n });\n }\n return {\n before() {\n const promises: Promise<unknown>[] = [];\n let bytes = 0;\n for (const [image, props] of next) {\n const old = previous.get(image);\n if (props.src == null || props.src === '' || props.onLoad != null || props.loading === 'lazy' ||\n (old && props.src === old.src && props.srcSet === old.srcSet) || !isFunction(image.decode))\n continue;\n if (!image.complete) {\n pending.push(image);\n bytes += imageBytes(image);\n }\n promises.push(image.decode().catch(() => { }));\n }\n if (bytes && !imageBudget)\n imageBudget = 125 * bandwidth(doc) * 500;\n return wait(promises, bytes > imageBudget ? 50 : 800);\n },\n after(fontsWereLoaded: boolean) {\n const promises: Promise<unknown>[] = [];\n const cleanups: Array<() => void> = [];\n if (fontsWereLoaded) {\n // Discover fonts introduced by mutation before the browser captures.\n doc.documentElement.getBoundingClientRect();\n if (doc.fonts.status === 'loading')\n promises.push(doc.fonts.ready);\n }\n const images: HTMLImageElement[] = [];\n let bytes = 0;\n const view = doc.defaultView!;\n for (const image of pending) {\n if (image.complete)\n continue;\n const rect = image.getBoundingClientRect();\n if (rect.bottom <= 0 || rect.right <= 0 || rect.top >= view.innerHeight || rect.left >= view.innerWidth)\n continue;\n bytes += imageBytes(image);\n if (bytes > imageBudget) {\n images.length = 0;\n break;\n }\n images.push(image);\n }\n for (const image of images) {\n promises.push(new Promise<void>(resolve => {\n const loaded = () => resolve();\n image.addEventListener('load', loaded);\n image.addEventListener('error', loaded);\n cleanups.push(() => {\n image.removeEventListener('load', loaded);\n image.removeEventListener('error', loaded);\n });\n }));\n }\n return wait(promises, 500, cleanups);\n },\n cancel() {\n for (const release of releases)\n release();\n },\n };\n}\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,kBAAkB;AAO3B,IAAI,cAAc;AAClB,MAAM,aAAa,CAAC,WAAsC,MAAM,SAAS,QAAQ,MAAM,UAAU,QAAQ,MAAM,cAAc,aAAa,oBAAoB,KAAK;AACnK,MAAM,iBAAiB,CAAC,SAA2B,2CAA2C,KAAK,IAAI;AAGvG,SAAS,UAAU,KAAa;AAC5B,QAAM,OAAO,IAAI;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;AAC5B,gBAAM,iBAAiB,QAAQ,MAAM;AACrC,gBAAM,iBAAiB,SAAS,MAAM;AACtC,mBAAS,KAAK,MAAK;AACf,kBAAM,oBAAoB,QAAQ,MAAM;AACxC,kBAAM,oBAAoB,SAAS,MAAM;UAC7C,CAAC;QACL,CAAC,CAAC;MACN;AACA,aAAO,KAAK,UAAU,KAAK,QAAQ;IACvC;IACA,SAAM;AACF,iBAAW,WAAW;AAClB,gBAAO;IACf;;AAER;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare const m: any, d: any, c: any, l: any, p: any;
|
|
2
|
+
import type { FiberRoot } from "../../../core/index.js";
|
|
3
|
+
export declare function markTransitionUpdate(_root: FiberRoot): void;
|
|
4
|
+
export declare const deferTransition: (_root: FiberRoot, _commit: () => void, _flush: () => void) => boolean;
|
|
5
|
+
export declare function cancelTransitions(): void;
|
|
6
|
+
export declare const deferTransitionLayout: (_work: () => void) => boolean;
|
|
7
|
+
export declare const deferTransitionPassive: (_work: () => void) => boolean;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
const m = void 0, d = void 0, c = void 0, l = void 0, p = void 0;
|
|
2
|
+
function markTransitionUpdate(_root) {
|
|
3
|
+
}
|
|
4
|
+
const deferTransition = () => false;
|
|
5
|
+
function cancelTransitions() {
|
|
6
|
+
}
|
|
7
|
+
const deferTransitionLayout = () => false;
|
|
8
|
+
const deferTransitionPassive = () => false;
|
|
9
|
+
export {
|
|
10
|
+
c,
|
|
11
|
+
cancelTransitions,
|
|
12
|
+
d,
|
|
13
|
+
deferTransition,
|
|
14
|
+
deferTransitionLayout,
|
|
15
|
+
deferTransitionPassive,
|
|
16
|
+
l,
|
|
17
|
+
m,
|
|
18
|
+
markTransitionUpdate,
|
|
19
|
+
p
|
|
20
|
+
};
|
|
21
|
+
//# sourceMappingURL=stub.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/dom/features/view-transition/stub.ts"],
|
|
4
|
+
"sourcesContent": ["export const m = undefined, d = undefined, c = undefined, l = undefined, p = undefined\nimport type { FiberRoot } from '../../../core'\n\nexport function markTransitionUpdate(_root: FiberRoot): void {}\nexport const deferTransition: (_root: FiberRoot, _commit: () => void, _flush: () => void) => boolean = () => false\nexport function cancelTransitions(): void {}\nexport const deferTransitionLayout: (_work: () => void) => boolean = () => false\nexport const deferTransitionPassive: (_work: () => void) => boolean = () => false\n"],
|
|
5
|
+
"mappings": "AAAO,MAAM,IAAI,QAAW,IAAI,QAAW,IAAI,QAAW,IAAI,QAAW,IAAI;AAGvE,SAAU,qBAAqB,OAAgB;AAAS;AACvD,MAAM,kBAA0F,MAAM;AACvG,SAAU,oBAAiB;AAAU;AACpC,MAAM,wBAAwD,MAAM;AACpE,MAAM,yBAAyD,MAAM;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { type FiberRoot } from "../../../core/index.js";
|
|
2
|
+
export declare function prepareViewTransition(rootIterable: Iterable<FiberRoot>, types: string[]): PreparedViewTransition | null;
|
|
3
|
+
export interface PreparedViewTransition {
|
|
4
|
+
document: Document;
|
|
5
|
+
exclude(root: FiberRoot): void;
|
|
6
|
+
prepare(): Promise<void> | undefined;
|
|
7
|
+
waitForResources(fontsWereLoaded: boolean): Promise<void> | undefined;
|
|
8
|
+
beforeCommit(): boolean;
|
|
9
|
+
afterCommit(): void;
|
|
10
|
+
ready(): void;
|
|
11
|
+
restore(): void;
|
|
12
|
+
finish(): void;
|
|
13
|
+
cancel(): void;
|
|
14
|
+
}
|