@bleedingdev/tanstack-redact 0.0.0-bootstrap → 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 +1 -1
- 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 +113 -8
- 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,454 @@
|
|
|
1
|
+
import { FiberTag, type Fiber, type FiberRoot } from '../../../core';
|
|
2
|
+
import { REACT_VIEW_TRANSITION_TYPE, type ViewTransitionClass, type ViewTransitionInstance, type ViewTransitionProps, type ViewTransitionPseudoElement, } from '../../../react/view-transition';
|
|
3
|
+
import { isFunction } from '../../../core/functions';
|
|
4
|
+
import { transitionResources, type TransitionImages } from './resources';
|
|
5
|
+
type Kind = 'enter' | 'exit' | 'update' | 'share';
|
|
6
|
+
type Host = HTMLElement | SVGElement;
|
|
7
|
+
type Rect = [
|
|
8
|
+
number,
|
|
9
|
+
number,
|
|
10
|
+
number,
|
|
11
|
+
number
|
|
12
|
+
];
|
|
13
|
+
interface Boundary {
|
|
14
|
+
f: Fiber;
|
|
15
|
+
p: ViewTransitionProps;
|
|
16
|
+
h: Host[];
|
|
17
|
+
a: Fiber[];
|
|
18
|
+
r: Fiber | null;
|
|
19
|
+
n: string;
|
|
20
|
+
e: boolean;
|
|
21
|
+
s: Rect[];
|
|
22
|
+
c: string;
|
|
23
|
+
v: boolean;
|
|
24
|
+
}
|
|
25
|
+
interface Snapshot {
|
|
26
|
+
b: Map<Fiber, Boundary>;
|
|
27
|
+
v: Set<Fiber>;
|
|
28
|
+
i: TransitionImages;
|
|
29
|
+
}
|
|
30
|
+
interface Capture {
|
|
31
|
+
o?: Boundary | undefined;
|
|
32
|
+
n?: Boundary | undefined;
|
|
33
|
+
k: Kind;
|
|
34
|
+
s: string;
|
|
35
|
+
h: Host[];
|
|
36
|
+
e: boolean;
|
|
37
|
+
}
|
|
38
|
+
interface Event {
|
|
39
|
+
b: Boundary;
|
|
40
|
+
k: Kind;
|
|
41
|
+
n: string;
|
|
42
|
+
}
|
|
43
|
+
const names = new WeakMap<Fiber, string>();
|
|
44
|
+
const styleProperties = ['view-transition-name', 'view-transition-class'];
|
|
45
|
+
let nextName = 0;
|
|
46
|
+
function pseudo(doc: Document, kind: string, name: string): ViewTransitionPseudoElement {
|
|
47
|
+
const scope = doc.documentElement;
|
|
48
|
+
const selector = '::view-transition-' + kind + '(' + nativeName(name) + ')';
|
|
49
|
+
return {
|
|
50
|
+
animate(keyframes, options) {
|
|
51
|
+
return scope.animate(keyframes, { ...(typeof options === 'number' ? { duration: options } : options), pseudoElement: selector });
|
|
52
|
+
},
|
|
53
|
+
getAnimations() {
|
|
54
|
+
return scope.getAnimations({ subtree: true }).filter(animation => {
|
|
55
|
+
const effect = animation.effect as KeyframeEffect | null;
|
|
56
|
+
return effect?.target === scope && effect.pseudoElement === selector;
|
|
57
|
+
});
|
|
58
|
+
},
|
|
59
|
+
getComputedStyle() { return doc.defaultView!.getComputedStyle(scope, selector); },
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
// Ignore nested boundary content: its mutations belong to that boundary.
|
|
63
|
+
function contents(node: Node, nested: Set<Node>, first?: boolean): string {
|
|
64
|
+
if (!first && nested.has(node))
|
|
65
|
+
return '|';
|
|
66
|
+
if (node.nodeType === 3)
|
|
67
|
+
return JSON.stringify(node.nodeValue);
|
|
68
|
+
if (node.nodeType !== 1)
|
|
69
|
+
return '';
|
|
70
|
+
const element = node as Host;
|
|
71
|
+
let result = '<' + element.nodeName;
|
|
72
|
+
for (const attribute of element.attributes) {
|
|
73
|
+
if (attribute.name !== 'style')
|
|
74
|
+
result += ' ' + attribute.name + '=' + JSON.stringify(attribute.value);
|
|
75
|
+
}
|
|
76
|
+
for (let i = 0; i < element.style.length; i++) {
|
|
77
|
+
const property = element.style[i]!;
|
|
78
|
+
if (property !== 'view-transition-name' && property !== 'view-transition-class') {
|
|
79
|
+
result += ';' + property + ':' + element.style.getPropertyValue(property) + '!' + element.style.getPropertyPriority(property);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
if ('value' in element)
|
|
83
|
+
result += '=' + (element as HTMLInputElement).value;
|
|
84
|
+
if ('checked' in element)
|
|
85
|
+
result += ':' + (element as HTMLInputElement).checked;
|
|
86
|
+
result += '>';
|
|
87
|
+
for (let child = node.firstChild; child; child = child.nextSibling)
|
|
88
|
+
result += contents(child, nested);
|
|
89
|
+
return result + '</' + element.nodeName + '>';
|
|
90
|
+
}
|
|
91
|
+
function className(props: ViewTransitionProps, kind: Kind, types: string[]): string | undefined {
|
|
92
|
+
const value = byType(props[kind], types) ?? byType(props.default, types);
|
|
93
|
+
return value === 'auto' ? undefined : value;
|
|
94
|
+
}
|
|
95
|
+
function snapshot(roots: FiberRoot[], doc: Document, types: string[], connected = true): Snapshot {
|
|
96
|
+
const boundaries = new Map<Fiber, Boundary>();
|
|
97
|
+
const visible = new Set<Fiber>();
|
|
98
|
+
const images: TransitionImages = new Map();
|
|
99
|
+
const allHosts = new Set<Node>();
|
|
100
|
+
const empty: Boundary[] = [];
|
|
101
|
+
const ancestors: Fiber[] = [];
|
|
102
|
+
function walk(fiber: Fiber, parent: Fiber | null, pending: Boundary[]): void {
|
|
103
|
+
if (fiber.u)
|
|
104
|
+
return;
|
|
105
|
+
if (fiber.type === REACT_VIEW_TRANSITION_TYPE) {
|
|
106
|
+
const props: ViewTransitionProps = fiber.v ?? {};
|
|
107
|
+
const explicitName = byType(props.name, types);
|
|
108
|
+
let name = explicitName;
|
|
109
|
+
if (name == null || name === 'auto') {
|
|
110
|
+
name = names.get(fiber);
|
|
111
|
+
if (!name)
|
|
112
|
+
names.set(fiber, name = '_redact_t_' + (++nextName).toString(32));
|
|
113
|
+
}
|
|
114
|
+
const boundary: Boundary = {
|
|
115
|
+
f: fiber, p: props, h: [], a: ancestors.slice(), r: parent, n: name,
|
|
116
|
+
e: explicitName != null && explicitName !== 'auto', s: [], c: '', v: false,
|
|
117
|
+
};
|
|
118
|
+
boundaries.set(fiber, boundary);
|
|
119
|
+
pending = pending.concat(boundary);
|
|
120
|
+
parent = fiber;
|
|
121
|
+
}
|
|
122
|
+
if (fiber.t === FiberTag.Host) {
|
|
123
|
+
visible.add(fiber);
|
|
124
|
+
const dom = fiber.n as Host | null;
|
|
125
|
+
if (parent && fiber.type === 'img' && dom?.ownerDocument === doc) {
|
|
126
|
+
images.set(dom as HTMLImageElement, fiber.v);
|
|
127
|
+
}
|
|
128
|
+
if (pending.length && dom?.ownerDocument === doc && (!connected || dom.isConnected) && dom.style) {
|
|
129
|
+
for (const boundary of pending)
|
|
130
|
+
boundary.h.push(dom);
|
|
131
|
+
allHosts.add(dom);
|
|
132
|
+
}
|
|
133
|
+
pending = empty;
|
|
134
|
+
ancestors.push(fiber);
|
|
135
|
+
}
|
|
136
|
+
visibleChildren(fiber, child => walk(child, parent, pending));
|
|
137
|
+
if (fiber.t === FiberTag.Host)
|
|
138
|
+
ancestors.pop();
|
|
139
|
+
}
|
|
140
|
+
for (const root of roots)
|
|
141
|
+
walk(root.r, null, empty);
|
|
142
|
+
const view = doc.defaultView;
|
|
143
|
+
if (connected)
|
|
144
|
+
for (const boundary of boundaries.values()) {
|
|
145
|
+
boundary.s = boundary.h.map(host => {
|
|
146
|
+
const rect = host.getBoundingClientRect();
|
|
147
|
+
return [rect.x, rect.y, rect.width, rect.height];
|
|
148
|
+
});
|
|
149
|
+
boundary.v = boundary.s.some(([x, y, width, height]) => width > 0 && height > 0 && x + width > 0 && y + height > 0 && x < (view?.innerWidth ?? Infinity) && y < (view?.innerHeight ?? Infinity));
|
|
150
|
+
boundary.c = boundary.h.map(host => contents(host, allHosts, true)).join('');
|
|
151
|
+
}
|
|
152
|
+
return { b: boundaries, v: visible, i: images };
|
|
153
|
+
}
|
|
154
|
+
export function prepareViewTransition(rootIterable: Iterable<FiberRoot>, types: string[]): PreparedViewTransition | null {
|
|
155
|
+
const roots = Array.from(rootIterable);
|
|
156
|
+
const container = roots[0]?.c;
|
|
157
|
+
const doc = (container?.ownerDocument || container) as Document | undefined;
|
|
158
|
+
if (!doc?.documentElement)
|
|
159
|
+
return null;
|
|
160
|
+
const before = snapshot(roots, doc, types);
|
|
161
|
+
const saved = new Map<Host, string[]>();
|
|
162
|
+
const suppressed = new Set<string>();
|
|
163
|
+
const events: Event[] = [];
|
|
164
|
+
const cleanups: (() => void)[] = [];
|
|
165
|
+
const captures: Capture[] = [];
|
|
166
|
+
let done = false;
|
|
167
|
+
let after: Snapshot;
|
|
168
|
+
let resources: ReturnType<typeof transitionResources> | undefined;
|
|
169
|
+
function apply(host: Host, name: string, classes?: string): void {
|
|
170
|
+
let previous = saved.get(host);
|
|
171
|
+
if (!previous)
|
|
172
|
+
saved.set(host, previous = []);
|
|
173
|
+
for (let index = 0; index < 2; index++) {
|
|
174
|
+
const property = styleProperties[index]!;
|
|
175
|
+
const offset = index * 3;
|
|
176
|
+
const current = host.style.getPropertyValue(property);
|
|
177
|
+
// A committed style prop may replace either temporary value.
|
|
178
|
+
if (current !== previous[offset + 2]) {
|
|
179
|
+
previous[offset] = current;
|
|
180
|
+
previous[offset + 1] = host.style.getPropertyPriority(property);
|
|
181
|
+
}
|
|
182
|
+
const value = index ? classes === 'none' ? '' : classes ?? previous[offset]! : nativeName(name);
|
|
183
|
+
host.style.setProperty(property, previous[offset + 2] = value, 'important');
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
function applyHosts(hosts: Host[], name: string, props: ViewTransitionProps, kind: Kind): void {
|
|
187
|
+
const classes = className(props, kind, types);
|
|
188
|
+
hosts.forEach((host, index) => apply(host, index ? name + '_' + index : name, classes));
|
|
189
|
+
}
|
|
190
|
+
function suppress(hosts: Host[], name: string): void {
|
|
191
|
+
hosts.forEach((_, index) => suppressed.add(index ? name + '_' + index : name));
|
|
192
|
+
}
|
|
193
|
+
function ownership(side: 'o' | 'n'): Map<Host, Capture> {
|
|
194
|
+
const owners = new Map<Host, Capture>();
|
|
195
|
+
for (const capture of captures) {
|
|
196
|
+
if (side === 'n' && !capture.e)
|
|
197
|
+
continue;
|
|
198
|
+
for (const host of capture[side]?.h ?? [])
|
|
199
|
+
owners.set(host, capture);
|
|
200
|
+
}
|
|
201
|
+
return owners;
|
|
202
|
+
}
|
|
203
|
+
function capture(kind: Kind, old?: Boundary, next?: Boundary, enabled = true): void {
|
|
204
|
+
captures.push({ o: old, n: next, k: kind, s: (old ?? next)!.n, h: [], e: !!next && enabled });
|
|
205
|
+
}
|
|
206
|
+
function restore(): void {
|
|
207
|
+
for (const [host, previous] of saved) {
|
|
208
|
+
for (let index = 0; index < 2; index++) {
|
|
209
|
+
const property = styleProperties[index]!;
|
|
210
|
+
const offset = index * 3;
|
|
211
|
+
if (host.style.getPropertyValue(property) === previous[offset + 2]) {
|
|
212
|
+
host.style.setProperty(property, previous[offset]!, previous[offset + 1]);
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
saved.clear();
|
|
217
|
+
}
|
|
218
|
+
function finish(): void {
|
|
219
|
+
if (done)
|
|
220
|
+
return;
|
|
221
|
+
done = true;
|
|
222
|
+
resources?.cancel();
|
|
223
|
+
restore();
|
|
224
|
+
let error: unknown;
|
|
225
|
+
let failed = false;
|
|
226
|
+
for (const cleanup of cleanups.splice(0)) {
|
|
227
|
+
try {
|
|
228
|
+
cleanup();
|
|
229
|
+
}
|
|
230
|
+
catch (caught) {
|
|
231
|
+
if (!failed) {
|
|
232
|
+
error = caught;
|
|
233
|
+
failed = true;
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
if (failed)
|
|
238
|
+
throw error;
|
|
239
|
+
}
|
|
240
|
+
return {
|
|
241
|
+
document: doc,
|
|
242
|
+
exclude(root) {
|
|
243
|
+
const index = roots.indexOf(root);
|
|
244
|
+
if (index >= 0)
|
|
245
|
+
roots.splice(index, 1);
|
|
246
|
+
for (const [fiber] of before.b)
|
|
247
|
+
if (fiber.r === root)
|
|
248
|
+
before.b.delete(fiber);
|
|
249
|
+
},
|
|
250
|
+
prepare() {
|
|
251
|
+
after = snapshot(roots, doc, types, false);
|
|
252
|
+
resources = transitionResources(doc, before.i, after.i);
|
|
253
|
+
return resources.before();
|
|
254
|
+
},
|
|
255
|
+
waitForResources(fontsWereLoaded) {
|
|
256
|
+
if (!done)
|
|
257
|
+
return resources?.after(fontsWereLoaded);
|
|
258
|
+
},
|
|
259
|
+
beforeCommit() {
|
|
260
|
+
if (done)
|
|
261
|
+
return false;
|
|
262
|
+
const entering = new Map<string, Boundary>();
|
|
263
|
+
const paired = new Set<Fiber>();
|
|
264
|
+
for (const boundary of after.b.values()) {
|
|
265
|
+
if (!before.b.has(boundary.f) && boundary.e)
|
|
266
|
+
entering.set(boundary.n, boundary);
|
|
267
|
+
}
|
|
268
|
+
for (const old of before.b.values()) {
|
|
269
|
+
const current = after.b.get(old.f);
|
|
270
|
+
if (current) {
|
|
271
|
+
if (className(current.p, 'update', types) !== 'none')
|
|
272
|
+
capture('update', old, current);
|
|
273
|
+
}
|
|
274
|
+
else {
|
|
275
|
+
const shared = old.e && old.v ? entering.get(old.n) : undefined;
|
|
276
|
+
if (shared) {
|
|
277
|
+
entering.delete(old.n);
|
|
278
|
+
if (className(old.p, 'share', types) !== 'none') {
|
|
279
|
+
paired.add(shared.f);
|
|
280
|
+
capture('share', old, shared, className(shared.p, 'share', types) !== 'none');
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
else if (topLevel(old, after, before) && old.v && className(old.p, 'exit', types) !== 'none') {
|
|
284
|
+
capture('exit', old);
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
for (const boundary of after.b.values()) {
|
|
289
|
+
if (before.b.has(boundary.f) || paired.has(boundary.f))
|
|
290
|
+
continue;
|
|
291
|
+
if (topLevel(boundary, before, after) && className(boundary.p, 'enter', types) !== 'none') {
|
|
292
|
+
capture('enter', undefined, boundary);
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
// A directly nested boundary owns updates; an outer presence boundary
|
|
296
|
+
// owns entering/exiting hosts. Shared descendants take precedence.
|
|
297
|
+
captures.sort((a, b) => (a.k === 'share' ? 2 : a.k === 'update' ? 0 : 1) - (b.k === 'share' ? 2 : b.k === 'update' ? 0 : 1));
|
|
298
|
+
if (!captures.some(capture => capture.o?.h.length || (capture.e && capture.n?.h.length)))
|
|
299
|
+
return false;
|
|
300
|
+
const owners = ownership('o');
|
|
301
|
+
apply(doc.documentElement, 'none');
|
|
302
|
+
for (const boundary of before.b.values())
|
|
303
|
+
for (const host of boundary.h)
|
|
304
|
+
apply(host, 'none');
|
|
305
|
+
for (const capture of captures) {
|
|
306
|
+
capture.h = capture.o?.h.filter(host => owners.get(host) === capture) ?? [];
|
|
307
|
+
const props = capture.k === 'update' ? capture.n!.p : capture.o?.p;
|
|
308
|
+
if (props)
|
|
309
|
+
applyHosts(capture.h, capture.s, props, capture.k);
|
|
310
|
+
}
|
|
311
|
+
return true;
|
|
312
|
+
},
|
|
313
|
+
afterCommit() {
|
|
314
|
+
if (done)
|
|
315
|
+
return;
|
|
316
|
+
const after = snapshot(roots, doc, types);
|
|
317
|
+
for (const capture of captures) {
|
|
318
|
+
if (capture.n)
|
|
319
|
+
capture.n = after.b.get(capture.n.f);
|
|
320
|
+
if (capture.k !== 'update' && !capture.n?.v)
|
|
321
|
+
capture.e = false;
|
|
322
|
+
}
|
|
323
|
+
const owners = ownership('n');
|
|
324
|
+
for (const boundary of after.b.values())
|
|
325
|
+
for (const host of boundary.h)
|
|
326
|
+
apply(host, 'none');
|
|
327
|
+
for (const capture of captures) {
|
|
328
|
+
const newHosts = capture.n?.h.filter(host => owners.get(host) === capture) ?? [];
|
|
329
|
+
if (capture.n)
|
|
330
|
+
applyHosts(newHosts, capture.s, capture.n.p, capture.k);
|
|
331
|
+
if (!capture.h.length && !newHosts.length)
|
|
332
|
+
continue;
|
|
333
|
+
if (capture.k === 'update') {
|
|
334
|
+
if (capture.n && capture.o && changed(capture.o, capture.n))
|
|
335
|
+
events.push({ b: capture.n, n: capture.s, k: 'update' });
|
|
336
|
+
else
|
|
337
|
+
suppress(capture.h, capture.s);
|
|
338
|
+
}
|
|
339
|
+
else {
|
|
340
|
+
const boundary = capture.k === 'enter' ? capture.n : capture.o;
|
|
341
|
+
if (boundary)
|
|
342
|
+
events.push({ b: boundary, n: capture.s, k: capture.k });
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
},
|
|
346
|
+
ready() {
|
|
347
|
+
if (done)
|
|
348
|
+
return;
|
|
349
|
+
// These captures were needed before the synchronous commit could tell
|
|
350
|
+
// which boundaries changed. Cancel their native animations, not the DOM.
|
|
351
|
+
const nativeSuppressed = new Set([...suppressed].map(nativeName));
|
|
352
|
+
for (const animation of doc.documentElement.getAnimations({ subtree: true })) {
|
|
353
|
+
const effect = animation.effect as KeyframeEffect | null;
|
|
354
|
+
const selector = effect?.pseudoElement;
|
|
355
|
+
if (effect?.target !== doc.documentElement || !selector)
|
|
356
|
+
continue;
|
|
357
|
+
const start = selector.indexOf('(');
|
|
358
|
+
if (start >= 0 && nativeSuppressed.has(selector.slice(start + 1, -1)))
|
|
359
|
+
animation.cancel();
|
|
360
|
+
}
|
|
361
|
+
for (const name of suppressed) {
|
|
362
|
+
const animation = pseudo(doc, 'group', name).animate({ opacity: 0 }, { duration: 0, fill: 'forwards' });
|
|
363
|
+
cleanups.push(() => animation.cancel());
|
|
364
|
+
}
|
|
365
|
+
let error: unknown;
|
|
366
|
+
let failed = false;
|
|
367
|
+
for (const event of events) {
|
|
368
|
+
if (done)
|
|
369
|
+
break;
|
|
370
|
+
const callback = event.b.p[('on' + event.k[0]!.toUpperCase() + event.k.slice(1)) as 'onEnter'];
|
|
371
|
+
if (callback) {
|
|
372
|
+
try {
|
|
373
|
+
const cleanup = callback(instance(doc, event.n), types);
|
|
374
|
+
if (isFunction(cleanup)) {
|
|
375
|
+
if (done)
|
|
376
|
+
cleanup();
|
|
377
|
+
else
|
|
378
|
+
cleanups.push(cleanup);
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
catch (caught) {
|
|
382
|
+
if (!failed) {
|
|
383
|
+
error = caught;
|
|
384
|
+
failed = true;
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
if (failed)
|
|
390
|
+
throw error;
|
|
391
|
+
},
|
|
392
|
+
restore,
|
|
393
|
+
finish,
|
|
394
|
+
cancel: finish,
|
|
395
|
+
};
|
|
396
|
+
}
|
|
397
|
+
function visibleChildren(fiber: Fiber, visit: (child: Fiber) => void): void {
|
|
398
|
+
if (fiber.t === FiberTag.Activity && fiber.v?.mode === 'hidden')
|
|
399
|
+
return;
|
|
400
|
+
if (fiber.t === FiberTag.Suspense && fiber.b?.f) {
|
|
401
|
+
visit(fiber.b.f);
|
|
402
|
+
return;
|
|
403
|
+
}
|
|
404
|
+
for (let child = fiber.c; child; child = child.s)
|
|
405
|
+
visit(child);
|
|
406
|
+
}
|
|
407
|
+
const nativeName = (name: string): string => (CSS.escape(name) === name ? name : CSS.escape('r-' + btoa(name).replace(/=/g, '')));
|
|
408
|
+
const instance = (doc: Document, name: string): ViewTransitionInstance => ({
|
|
409
|
+
name,
|
|
410
|
+
group: pseudo(doc, 'group', name),
|
|
411
|
+
imagePair: pseudo(doc, 'image-pair', name),
|
|
412
|
+
old: pseudo(doc, 'old', name),
|
|
413
|
+
new: pseudo(doc, 'new', name),
|
|
414
|
+
});
|
|
415
|
+
function byType(value: ViewTransitionClass | undefined, types: string[]): string | undefined {
|
|
416
|
+
if (isString(value))
|
|
417
|
+
return value;
|
|
418
|
+
if (!value)
|
|
419
|
+
return undefined;
|
|
420
|
+
let result: string | undefined;
|
|
421
|
+
for (const type of types) {
|
|
422
|
+
const match = value[type];
|
|
423
|
+
if (match === 'none')
|
|
424
|
+
return match;
|
|
425
|
+
if (match != null)
|
|
426
|
+
result = result == null ? match : result + ' ' + match;
|
|
427
|
+
}
|
|
428
|
+
return result ?? value.default;
|
|
429
|
+
}
|
|
430
|
+
const changed = (before: Boundary, after: Boundary): boolean => (before.c !== after.c || before.h.length !== after.h.length ||
|
|
431
|
+
before.h.some((host, i) => host !== after.h[i] || before.s[i]!.some((value, axis) => value !== after.s[i]![axis])));
|
|
432
|
+
export interface PreparedViewTransition {
|
|
433
|
+
document: Document;
|
|
434
|
+
exclude(root: FiberRoot): void;
|
|
435
|
+
prepare(): Promise<void> | undefined;
|
|
436
|
+
waitForResources(fontsWereLoaded: boolean): Promise<void> | undefined;
|
|
437
|
+
beforeCommit(): boolean;
|
|
438
|
+
afterCommit(): void;
|
|
439
|
+
ready(): void;
|
|
440
|
+
restore(): void;
|
|
441
|
+
finish(): void;
|
|
442
|
+
cancel(): void;
|
|
443
|
+
}
|
|
444
|
+
function topLevel(boundary: Boundary, other: Snapshot, side: Snapshot): boolean {
|
|
445
|
+
// An inserted/deleted host wrapper owns its subtree's enter/exit animation.
|
|
446
|
+
if (boundary.a.some(fiber => !other.v.has(fiber)))
|
|
447
|
+
return false;
|
|
448
|
+
for (let parent = boundary.r; parent; parent = side.b.get(parent)?.r ?? null) {
|
|
449
|
+
if (!other.b.has(parent))
|
|
450
|
+
return false;
|
|
451
|
+
}
|
|
452
|
+
return true;
|
|
453
|
+
}
|
|
454
|
+
import { isString } from "../../../core/functions";
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { walkRetained } from './walk';
|
|
2
|
+
import { syncInputValue, syncTextareaValue, syncSelectValue } from './form-controls';
|
|
3
|
+
import { FiberTag, type Fiber } from '../core';
|
|
4
|
+
import { runAction } from '../react/action-scope';
|
|
5
|
+
import { formState, idleFormStatus, publishForm } from '../react/form-state';
|
|
6
|
+
import { getRootContainer } from './root-internal';
|
|
7
|
+
const forms = new WeakMap<HTMLFormElement, Fiber>();
|
|
8
|
+
const listening = new WeakSet<Node>();
|
|
9
|
+
const handled = new WeakSet<Event>();
|
|
10
|
+
export const formActions = new WeakMap<Element, (data: FormData) => unknown>();
|
|
11
|
+
function resetForm(form: HTMLFormElement, owner: Fiber): void {
|
|
12
|
+
form.ownerDocument.defaultView!.HTMLFormElement.prototype.reset.call(form);
|
|
13
|
+
walkRetained(owner.r!.r, fiber => {
|
|
14
|
+
const props = fiber.m;
|
|
15
|
+
if (fiber.n && props && (fiber.n as HTMLInputElement).form === form) {
|
|
16
|
+
if (fiber.type === 'input')
|
|
17
|
+
syncInputValue(fiber.n as HTMLInputElement, props, props);
|
|
18
|
+
else if (fiber.type === 'textarea')
|
|
19
|
+
syncTextareaValue(fiber.n as HTMLTextAreaElement, props);
|
|
20
|
+
else if (fiber.type === 'select' && props.value != null) {
|
|
21
|
+
const select = fiber.n as HTMLSelectElement;
|
|
22
|
+
syncSelectValue(select, props);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
export function requestFormReset(form: HTMLFormElement): void {
|
|
28
|
+
const owner = forms.get(form);
|
|
29
|
+
if (!owner || owner.u)
|
|
30
|
+
throw new Error(process.env.NODE_ENV !== 'production' ? 'requestFormReset expects a mounted form rendered by Redact.' : '');
|
|
31
|
+
resetForm(form, owner);
|
|
32
|
+
}
|
|
33
|
+
export function bindForm(fiber: Fiber, onError: (fiber: Fiber, error: unknown) => void): void {
|
|
34
|
+
const form = fiber.n as HTMLFormElement;
|
|
35
|
+
forms.set(form, fiber);
|
|
36
|
+
const container = getRootContainer(fiber);
|
|
37
|
+
if (listening.has(container))
|
|
38
|
+
return;
|
|
39
|
+
listening.add(container);
|
|
40
|
+
container.addEventListener('submit', event => {
|
|
41
|
+
if (event.defaultPrevented || handled.has(event))
|
|
42
|
+
return;
|
|
43
|
+
const form = event.target as HTMLFormElement;
|
|
44
|
+
const owner = forms.get(form);
|
|
45
|
+
if (!owner || owner.u)
|
|
46
|
+
return;
|
|
47
|
+
const submitter = (event as SubmitEvent).submitter as HTMLButtonElement | HTMLInputElement | null;
|
|
48
|
+
const override = submitter?.hasAttribute('formaction') || (submitter && formActions.has(submitter));
|
|
49
|
+
const action = override ? formActions.get(submitter!) : formActions.get(form);
|
|
50
|
+
if (!action)
|
|
51
|
+
return;
|
|
52
|
+
handled.add(event);
|
|
53
|
+
event.preventDefault();
|
|
54
|
+
const data = new FormData(form, submitter);
|
|
55
|
+
const state = formState(owner);
|
|
56
|
+
const generation = ++state.g;
|
|
57
|
+
publishForm(state, { pending: true, data, method: 'post', action });
|
|
58
|
+
const scope = runAction(() => action(data));
|
|
59
|
+
scope.d.then(() => {
|
|
60
|
+
if (owner.u || generation !== state.g)
|
|
61
|
+
return;
|
|
62
|
+
if (!scope.f)
|
|
63
|
+
resetForm(form, owner);
|
|
64
|
+
publishForm(state, idleFormStatus);
|
|
65
|
+
if (scope.f && !scope.h)
|
|
66
|
+
onError(owner, scope.e);
|
|
67
|
+
});
|
|
68
|
+
});
|
|
69
|
+
}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { trackInputValue } from './dom';
|
|
2
|
+
export function syncTextareaValue(el: HTMLTextAreaElement, props: any, mounting?: boolean): void {
|
|
3
|
+
if (mounting) {
|
|
4
|
+
const children = props.children;
|
|
5
|
+
const initial = props.value ?? props.defaultValue ?? (Array.isArray(children) ? children[0] : children) ?? '';
|
|
6
|
+
el.defaultValue = initial;
|
|
7
|
+
// The strict check also preserves React's clean numeric-default state.
|
|
8
|
+
if (initial !== '' && el.textContent === initial) {
|
|
9
|
+
el.value = initial;
|
|
10
|
+
trackInputValue(el);
|
|
11
|
+
}
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
14
|
+
const value = props.value;
|
|
15
|
+
if (value != null && el.value !== '' + value) {
|
|
16
|
+
el.value = '' + value;
|
|
17
|
+
trackInputValue(el);
|
|
18
|
+
}
|
|
19
|
+
const fallback = props.defaultValue ?? value ?? '';
|
|
20
|
+
if (el.defaultValue !== '' + fallback)
|
|
21
|
+
el.defaultValue = '' + fallback;
|
|
22
|
+
}
|
|
23
|
+
export function syncInputValue(el: HTMLInputElement, props: any, prev?: any): void {
|
|
24
|
+
if (!prev) {
|
|
25
|
+
el.checked = el.defaultChecked = !!(props.checked ?? props.defaultChecked);
|
|
26
|
+
}
|
|
27
|
+
else if (props.checked != null) {
|
|
28
|
+
el.checked = !!props.checked;
|
|
29
|
+
}
|
|
30
|
+
else if (props.defaultChecked != null) {
|
|
31
|
+
el.defaultChecked = !!props.defaultChecked;
|
|
32
|
+
}
|
|
33
|
+
const value = props.value;
|
|
34
|
+
const fallback = props.defaultValue;
|
|
35
|
+
if (!prev) {
|
|
36
|
+
if (value == null && (el.type === 'submit' || el.type === 'reset'))
|
|
37
|
+
return;
|
|
38
|
+
if (value != null || fallback != null) {
|
|
39
|
+
const initial = '' + (value ?? fallback);
|
|
40
|
+
if (el.value !== initial) {
|
|
41
|
+
el.value = initial;
|
|
42
|
+
trackInputValue(el);
|
|
43
|
+
}
|
|
44
|
+
el.defaultValue = initial;
|
|
45
|
+
}
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
if (value != null) {
|
|
49
|
+
// Number inputs keep equivalent user spelling, including trailing zeroes.
|
|
50
|
+
if (el.type === 'number' ? (value === 0 && el.value === '') || el.value != value : el.value !== '' + value) {
|
|
51
|
+
el.value = '' + value;
|
|
52
|
+
trackInputValue(el);
|
|
53
|
+
}
|
|
54
|
+
const nextDefault = el.type === 'number' && el.value == value ? el.value : '' + value;
|
|
55
|
+
if (el.defaultValue !== nextDefault)
|
|
56
|
+
el.defaultValue = nextDefault;
|
|
57
|
+
}
|
|
58
|
+
else if (fallback != null) {
|
|
59
|
+
if (el.defaultValue !== '' + fallback)
|
|
60
|
+
el.defaultValue = '' + fallback;
|
|
61
|
+
}
|
|
62
|
+
else if (prev.defaultValue != null || el.type === 'submit' || el.type === 'reset') {
|
|
63
|
+
el.removeAttribute('value');
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
export function syncSelectValue(select: HTMLSelectElement, props: any, prev?: any): void {
|
|
67
|
+
const multiple = select.multiple;
|
|
68
|
+
const value = props.value ?? ((!prev || !!prev.multiple !== multiple) ? props.defaultValue ?? (prev && []) : null);
|
|
69
|
+
if (value == null)
|
|
70
|
+
return;
|
|
71
|
+
const defaults = props.value == null && props.defaultValue != null;
|
|
72
|
+
const selected = new Set(multiple ? value.map(String) : ['' + value]);
|
|
73
|
+
let fallback: HTMLOptionElement | undefined;
|
|
74
|
+
for (const option of select.options) {
|
|
75
|
+
const match = selected.has(option.value);
|
|
76
|
+
if (defaults && match)
|
|
77
|
+
option.defaultSelected = true;
|
|
78
|
+
if (multiple)
|
|
79
|
+
option.selected = match;
|
|
80
|
+
else {
|
|
81
|
+
if (match) {
|
|
82
|
+
fallback = option;
|
|
83
|
+
break;
|
|
84
|
+
}
|
|
85
|
+
if (!fallback && !option.disabled)
|
|
86
|
+
fallback = option;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
if (fallback)
|
|
90
|
+
fallback.selected = true;
|
|
91
|
+
}
|