@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,404 @@
|
|
|
1
|
+
import { REACT_VIEW_TRANSITION_TYPE } from "../../../react/view-transition.js";
|
|
2
|
+
import { isFunction } from "../../../core/functions.js";
|
|
3
|
+
import { transitionResources } from "./resources.js";
|
|
4
|
+
const names = /* @__PURE__ */ new WeakMap();
|
|
5
|
+
const styleProperties = ["view-transition-name", "view-transition-class"];
|
|
6
|
+
let nextName = 0;
|
|
7
|
+
function pseudo(doc, kind, name) {
|
|
8
|
+
const scope = doc.documentElement;
|
|
9
|
+
const selector = "::view-transition-" + kind + "(" + nativeName(name) + ")";
|
|
10
|
+
return {
|
|
11
|
+
animate(keyframes, options) {
|
|
12
|
+
return scope.animate(keyframes, { ...typeof options === "number" ? { duration: options } : options, pseudoElement: selector });
|
|
13
|
+
},
|
|
14
|
+
getAnimations() {
|
|
15
|
+
return scope.getAnimations({ subtree: true }).filter((animation) => {
|
|
16
|
+
const effect = animation.effect;
|
|
17
|
+
return effect?.target === scope && effect.pseudoElement === selector;
|
|
18
|
+
});
|
|
19
|
+
},
|
|
20
|
+
getComputedStyle() {
|
|
21
|
+
return doc.defaultView.getComputedStyle(scope, selector);
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
function contents(node, nested, first) {
|
|
26
|
+
if (!first && nested.has(node))
|
|
27
|
+
return "|";
|
|
28
|
+
if (node.nodeType === 3)
|
|
29
|
+
return JSON.stringify(node.nodeValue);
|
|
30
|
+
if (node.nodeType !== 1)
|
|
31
|
+
return "";
|
|
32
|
+
const element = node;
|
|
33
|
+
let result = "<" + element.nodeName;
|
|
34
|
+
for (const attribute of element.attributes) {
|
|
35
|
+
if (attribute.name !== "style")
|
|
36
|
+
result += " " + attribute.name + "=" + JSON.stringify(attribute.value);
|
|
37
|
+
}
|
|
38
|
+
for (let i = 0; i < element.style.length; i++) {
|
|
39
|
+
const property = element.style[i];
|
|
40
|
+
if (property !== "view-transition-name" && property !== "view-transition-class") {
|
|
41
|
+
result += ";" + property + ":" + element.style.getPropertyValue(property) + "!" + element.style.getPropertyPriority(property);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
if ("value" in element)
|
|
45
|
+
result += "=" + element.value;
|
|
46
|
+
if ("checked" in element)
|
|
47
|
+
result += ":" + element.checked;
|
|
48
|
+
result += ">";
|
|
49
|
+
for (let child = node.firstChild; child; child = child.nextSibling)
|
|
50
|
+
result += contents(child, nested);
|
|
51
|
+
return result + "</" + element.nodeName + ">";
|
|
52
|
+
}
|
|
53
|
+
function className(props, kind, types) {
|
|
54
|
+
const value = byType(props[kind], types) ?? byType(props.default, types);
|
|
55
|
+
return value === "auto" ? void 0 : value;
|
|
56
|
+
}
|
|
57
|
+
function snapshot(roots, doc, types, connected = true) {
|
|
58
|
+
const boundaries = /* @__PURE__ */ new Map();
|
|
59
|
+
const visible = /* @__PURE__ */ new Set();
|
|
60
|
+
const images = /* @__PURE__ */ new Map();
|
|
61
|
+
const allHosts = /* @__PURE__ */ new Set();
|
|
62
|
+
const empty = [];
|
|
63
|
+
const ancestors = [];
|
|
64
|
+
function walk(fiber, parent, pending) {
|
|
65
|
+
if (fiber.u)
|
|
66
|
+
return;
|
|
67
|
+
if (fiber.type === REACT_VIEW_TRANSITION_TYPE) {
|
|
68
|
+
const props = fiber.v ?? {};
|
|
69
|
+
const explicitName = byType(props.name, types);
|
|
70
|
+
let name = explicitName;
|
|
71
|
+
if (name == null || name === "auto") {
|
|
72
|
+
name = names.get(fiber);
|
|
73
|
+
if (!name)
|
|
74
|
+
names.set(fiber, name = "_redact_t_" + (++nextName).toString(32));
|
|
75
|
+
}
|
|
76
|
+
const boundary = {
|
|
77
|
+
f: fiber,
|
|
78
|
+
p: props,
|
|
79
|
+
h: [],
|
|
80
|
+
a: ancestors.slice(),
|
|
81
|
+
r: parent,
|
|
82
|
+
n: name,
|
|
83
|
+
e: explicitName != null && explicitName !== "auto",
|
|
84
|
+
s: [],
|
|
85
|
+
c: "",
|
|
86
|
+
v: false
|
|
87
|
+
};
|
|
88
|
+
boundaries.set(fiber, boundary);
|
|
89
|
+
pending = pending.concat(boundary);
|
|
90
|
+
parent = fiber;
|
|
91
|
+
}
|
|
92
|
+
if (fiber.t === 0) {
|
|
93
|
+
visible.add(fiber);
|
|
94
|
+
const dom = fiber.n;
|
|
95
|
+
if (parent && fiber.type === "img" && dom?.ownerDocument === doc) {
|
|
96
|
+
images.set(dom, fiber.v);
|
|
97
|
+
}
|
|
98
|
+
if (pending.length && dom?.ownerDocument === doc && (!connected || dom.isConnected) && dom.style) {
|
|
99
|
+
for (const boundary of pending)
|
|
100
|
+
boundary.h.push(dom);
|
|
101
|
+
allHosts.add(dom);
|
|
102
|
+
}
|
|
103
|
+
pending = empty;
|
|
104
|
+
ancestors.push(fiber);
|
|
105
|
+
}
|
|
106
|
+
visibleChildren(fiber, (child) => walk(child, parent, pending));
|
|
107
|
+
if (fiber.t === 0)
|
|
108
|
+
ancestors.pop();
|
|
109
|
+
}
|
|
110
|
+
for (const root of roots)
|
|
111
|
+
walk(root.r, null, empty);
|
|
112
|
+
const view = doc.defaultView;
|
|
113
|
+
if (connected)
|
|
114
|
+
for (const boundary of boundaries.values()) {
|
|
115
|
+
boundary.s = boundary.h.map((host) => {
|
|
116
|
+
const rect = host.getBoundingClientRect();
|
|
117
|
+
return [rect.x, rect.y, rect.width, rect.height];
|
|
118
|
+
});
|
|
119
|
+
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));
|
|
120
|
+
boundary.c = boundary.h.map((host) => contents(host, allHosts, true)).join("");
|
|
121
|
+
}
|
|
122
|
+
return { b: boundaries, v: visible, i: images };
|
|
123
|
+
}
|
|
124
|
+
function prepareViewTransition(rootIterable, types) {
|
|
125
|
+
const roots = Array.from(rootIterable);
|
|
126
|
+
const container = roots[0]?.c;
|
|
127
|
+
const doc = container?.ownerDocument || container;
|
|
128
|
+
if (!doc?.documentElement)
|
|
129
|
+
return null;
|
|
130
|
+
const before = snapshot(roots, doc, types);
|
|
131
|
+
const saved = /* @__PURE__ */ new Map();
|
|
132
|
+
const suppressed = /* @__PURE__ */ new Set();
|
|
133
|
+
const events = [];
|
|
134
|
+
const cleanups = [];
|
|
135
|
+
const captures = [];
|
|
136
|
+
let done = false;
|
|
137
|
+
let after;
|
|
138
|
+
let resources;
|
|
139
|
+
function apply(host, name, classes) {
|
|
140
|
+
let previous = saved.get(host);
|
|
141
|
+
if (!previous)
|
|
142
|
+
saved.set(host, previous = []);
|
|
143
|
+
for (let index = 0; index < 2; index++) {
|
|
144
|
+
const property = styleProperties[index];
|
|
145
|
+
const offset = index * 3;
|
|
146
|
+
const current = host.style.getPropertyValue(property);
|
|
147
|
+
if (current !== previous[offset + 2]) {
|
|
148
|
+
previous[offset] = current;
|
|
149
|
+
previous[offset + 1] = host.style.getPropertyPriority(property);
|
|
150
|
+
}
|
|
151
|
+
const value = index ? classes === "none" ? "" : classes ?? previous[offset] : nativeName(name);
|
|
152
|
+
host.style.setProperty(property, previous[offset + 2] = value, "important");
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
function applyHosts(hosts, name, props, kind) {
|
|
156
|
+
const classes = className(props, kind, types);
|
|
157
|
+
hosts.forEach((host, index) => apply(host, index ? name + "_" + index : name, classes));
|
|
158
|
+
}
|
|
159
|
+
function suppress(hosts, name) {
|
|
160
|
+
hosts.forEach((_, index) => suppressed.add(index ? name + "_" + index : name));
|
|
161
|
+
}
|
|
162
|
+
function ownership(side) {
|
|
163
|
+
const owners = /* @__PURE__ */ new Map();
|
|
164
|
+
for (const capture2 of captures) {
|
|
165
|
+
if (side === "n" && !capture2.e)
|
|
166
|
+
continue;
|
|
167
|
+
for (const host of capture2[side]?.h ?? [])
|
|
168
|
+
owners.set(host, capture2);
|
|
169
|
+
}
|
|
170
|
+
return owners;
|
|
171
|
+
}
|
|
172
|
+
function capture(kind, old, next, enabled = true) {
|
|
173
|
+
captures.push({ o: old, n: next, k: kind, s: (old ?? next).n, h: [], e: !!next && enabled });
|
|
174
|
+
}
|
|
175
|
+
function restore() {
|
|
176
|
+
for (const [host, previous] of saved) {
|
|
177
|
+
for (let index = 0; index < 2; index++) {
|
|
178
|
+
const property = styleProperties[index];
|
|
179
|
+
const offset = index * 3;
|
|
180
|
+
if (host.style.getPropertyValue(property) === previous[offset + 2]) {
|
|
181
|
+
host.style.setProperty(property, previous[offset], previous[offset + 1]);
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
saved.clear();
|
|
186
|
+
}
|
|
187
|
+
function finish() {
|
|
188
|
+
if (done)
|
|
189
|
+
return;
|
|
190
|
+
done = true;
|
|
191
|
+
resources?.cancel();
|
|
192
|
+
restore();
|
|
193
|
+
let error;
|
|
194
|
+
let failed = false;
|
|
195
|
+
for (const cleanup of cleanups.splice(0)) {
|
|
196
|
+
try {
|
|
197
|
+
cleanup();
|
|
198
|
+
} catch (caught) {
|
|
199
|
+
if (!failed) {
|
|
200
|
+
error = caught;
|
|
201
|
+
failed = true;
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
if (failed)
|
|
206
|
+
throw error;
|
|
207
|
+
}
|
|
208
|
+
return {
|
|
209
|
+
document: doc,
|
|
210
|
+
exclude(root) {
|
|
211
|
+
const index = roots.indexOf(root);
|
|
212
|
+
if (index >= 0)
|
|
213
|
+
roots.splice(index, 1);
|
|
214
|
+
for (const [fiber] of before.b)
|
|
215
|
+
if (fiber.r === root)
|
|
216
|
+
before.b.delete(fiber);
|
|
217
|
+
},
|
|
218
|
+
prepare() {
|
|
219
|
+
after = snapshot(roots, doc, types, false);
|
|
220
|
+
resources = transitionResources(doc, before.i, after.i);
|
|
221
|
+
return resources.before();
|
|
222
|
+
},
|
|
223
|
+
waitForResources(fontsWereLoaded) {
|
|
224
|
+
if (!done)
|
|
225
|
+
return resources?.after(fontsWereLoaded);
|
|
226
|
+
},
|
|
227
|
+
beforeCommit() {
|
|
228
|
+
if (done)
|
|
229
|
+
return false;
|
|
230
|
+
const entering = /* @__PURE__ */ new Map();
|
|
231
|
+
const paired = /* @__PURE__ */ new Set();
|
|
232
|
+
for (const boundary of after.b.values()) {
|
|
233
|
+
if (!before.b.has(boundary.f) && boundary.e)
|
|
234
|
+
entering.set(boundary.n, boundary);
|
|
235
|
+
}
|
|
236
|
+
for (const old of before.b.values()) {
|
|
237
|
+
const current = after.b.get(old.f);
|
|
238
|
+
if (current) {
|
|
239
|
+
if (className(current.p, "update", types) !== "none")
|
|
240
|
+
capture("update", old, current);
|
|
241
|
+
} else {
|
|
242
|
+
const shared = old.e && old.v ? entering.get(old.n) : void 0;
|
|
243
|
+
if (shared) {
|
|
244
|
+
entering.delete(old.n);
|
|
245
|
+
if (className(old.p, "share", types) !== "none") {
|
|
246
|
+
paired.add(shared.f);
|
|
247
|
+
capture("share", old, shared, className(shared.p, "share", types) !== "none");
|
|
248
|
+
}
|
|
249
|
+
} else if (topLevel(old, after, before) && old.v && className(old.p, "exit", types) !== "none") {
|
|
250
|
+
capture("exit", old);
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
for (const boundary of after.b.values()) {
|
|
255
|
+
if (before.b.has(boundary.f) || paired.has(boundary.f))
|
|
256
|
+
continue;
|
|
257
|
+
if (topLevel(boundary, before, after) && className(boundary.p, "enter", types) !== "none") {
|
|
258
|
+
capture("enter", void 0, boundary);
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
captures.sort((a, b) => (a.k === "share" ? 2 : a.k === "update" ? 0 : 1) - (b.k === "share" ? 2 : b.k === "update" ? 0 : 1));
|
|
262
|
+
if (!captures.some((capture2) => capture2.o?.h.length || capture2.e && capture2.n?.h.length))
|
|
263
|
+
return false;
|
|
264
|
+
const owners = ownership("o");
|
|
265
|
+
apply(doc.documentElement, "none");
|
|
266
|
+
for (const boundary of before.b.values())
|
|
267
|
+
for (const host of boundary.h)
|
|
268
|
+
apply(host, "none");
|
|
269
|
+
for (const capture2 of captures) {
|
|
270
|
+
capture2.h = capture2.o?.h.filter((host) => owners.get(host) === capture2) ?? [];
|
|
271
|
+
const props = capture2.k === "update" ? capture2.n.p : capture2.o?.p;
|
|
272
|
+
if (props)
|
|
273
|
+
applyHosts(capture2.h, capture2.s, props, capture2.k);
|
|
274
|
+
}
|
|
275
|
+
return true;
|
|
276
|
+
},
|
|
277
|
+
afterCommit() {
|
|
278
|
+
if (done)
|
|
279
|
+
return;
|
|
280
|
+
const after2 = snapshot(roots, doc, types);
|
|
281
|
+
for (const capture2 of captures) {
|
|
282
|
+
if (capture2.n)
|
|
283
|
+
capture2.n = after2.b.get(capture2.n.f);
|
|
284
|
+
if (capture2.k !== "update" && !capture2.n?.v)
|
|
285
|
+
capture2.e = false;
|
|
286
|
+
}
|
|
287
|
+
const owners = ownership("n");
|
|
288
|
+
for (const boundary of after2.b.values())
|
|
289
|
+
for (const host of boundary.h)
|
|
290
|
+
apply(host, "none");
|
|
291
|
+
for (const capture2 of captures) {
|
|
292
|
+
const newHosts = capture2.n?.h.filter((host) => owners.get(host) === capture2) ?? [];
|
|
293
|
+
if (capture2.n)
|
|
294
|
+
applyHosts(newHosts, capture2.s, capture2.n.p, capture2.k);
|
|
295
|
+
if (!capture2.h.length && !newHosts.length)
|
|
296
|
+
continue;
|
|
297
|
+
if (capture2.k === "update") {
|
|
298
|
+
if (capture2.n && capture2.o && changed(capture2.o, capture2.n))
|
|
299
|
+
events.push({ b: capture2.n, n: capture2.s, k: "update" });
|
|
300
|
+
else
|
|
301
|
+
suppress(capture2.h, capture2.s);
|
|
302
|
+
} else {
|
|
303
|
+
const boundary = capture2.k === "enter" ? capture2.n : capture2.o;
|
|
304
|
+
if (boundary)
|
|
305
|
+
events.push({ b: boundary, n: capture2.s, k: capture2.k });
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
},
|
|
309
|
+
ready() {
|
|
310
|
+
if (done)
|
|
311
|
+
return;
|
|
312
|
+
const nativeSuppressed = new Set([...suppressed].map(nativeName));
|
|
313
|
+
for (const animation of doc.documentElement.getAnimations({ subtree: true })) {
|
|
314
|
+
const effect = animation.effect;
|
|
315
|
+
const selector = effect?.pseudoElement;
|
|
316
|
+
if (effect?.target !== doc.documentElement || !selector)
|
|
317
|
+
continue;
|
|
318
|
+
const start = selector.indexOf("(");
|
|
319
|
+
if (start >= 0 && nativeSuppressed.has(selector.slice(start + 1, -1)))
|
|
320
|
+
animation.cancel();
|
|
321
|
+
}
|
|
322
|
+
for (const name of suppressed) {
|
|
323
|
+
const animation = pseudo(doc, "group", name).animate({ opacity: 0 }, { duration: 0, fill: "forwards" });
|
|
324
|
+
cleanups.push(() => animation.cancel());
|
|
325
|
+
}
|
|
326
|
+
let error;
|
|
327
|
+
let failed = false;
|
|
328
|
+
for (const event of events) {
|
|
329
|
+
if (done)
|
|
330
|
+
break;
|
|
331
|
+
const callback = event.b.p["on" + event.k[0].toUpperCase() + event.k.slice(1)];
|
|
332
|
+
if (callback) {
|
|
333
|
+
try {
|
|
334
|
+
const cleanup = callback(instance(doc, event.n), types);
|
|
335
|
+
if (isFunction(cleanup)) {
|
|
336
|
+
if (done)
|
|
337
|
+
cleanup();
|
|
338
|
+
else
|
|
339
|
+
cleanups.push(cleanup);
|
|
340
|
+
}
|
|
341
|
+
} catch (caught) {
|
|
342
|
+
if (!failed) {
|
|
343
|
+
error = caught;
|
|
344
|
+
failed = true;
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
if (failed)
|
|
350
|
+
throw error;
|
|
351
|
+
},
|
|
352
|
+
restore,
|
|
353
|
+
finish,
|
|
354
|
+
cancel: finish
|
|
355
|
+
};
|
|
356
|
+
}
|
|
357
|
+
function visibleChildren(fiber, visit) {
|
|
358
|
+
if (fiber.t === 13 && fiber.v?.mode === "hidden")
|
|
359
|
+
return;
|
|
360
|
+
if (fiber.t === 11 && fiber.b?.f) {
|
|
361
|
+
visit(fiber.b.f);
|
|
362
|
+
return;
|
|
363
|
+
}
|
|
364
|
+
for (let child = fiber.c; child; child = child.s)
|
|
365
|
+
visit(child);
|
|
366
|
+
}
|
|
367
|
+
const nativeName = (name) => CSS.escape(name) === name ? name : CSS.escape("r-" + btoa(name).replace(/=/g, ""));
|
|
368
|
+
const instance = (doc, name) => ({
|
|
369
|
+
name,
|
|
370
|
+
group: pseudo(doc, "group", name),
|
|
371
|
+
imagePair: pseudo(doc, "image-pair", name),
|
|
372
|
+
old: pseudo(doc, "old", name),
|
|
373
|
+
new: pseudo(doc, "new", name)
|
|
374
|
+
});
|
|
375
|
+
function byType(value, types) {
|
|
376
|
+
if (isString(value))
|
|
377
|
+
return value;
|
|
378
|
+
if (!value)
|
|
379
|
+
return void 0;
|
|
380
|
+
let result;
|
|
381
|
+
for (const type of types) {
|
|
382
|
+
const match = value[type];
|
|
383
|
+
if (match === "none")
|
|
384
|
+
return match;
|
|
385
|
+
if (match != null)
|
|
386
|
+
result = result == null ? match : result + " " + match;
|
|
387
|
+
}
|
|
388
|
+
return result ?? value.default;
|
|
389
|
+
}
|
|
390
|
+
const changed = (before, after) => before.c !== after.c || before.h.length !== after.h.length || before.h.some((host, i) => host !== after.h[i] || before.s[i].some((value, axis) => value !== after.s[i][axis]));
|
|
391
|
+
function topLevel(boundary, other, side) {
|
|
392
|
+
if (boundary.a.some((fiber) => !other.v.has(fiber)))
|
|
393
|
+
return false;
|
|
394
|
+
for (let parent = boundary.r; parent; parent = side.b.get(parent)?.r ?? null) {
|
|
395
|
+
if (!other.b.has(parent))
|
|
396
|
+
return false;
|
|
397
|
+
}
|
|
398
|
+
return true;
|
|
399
|
+
}
|
|
400
|
+
import { isString } from "../../../core/functions.js";
|
|
401
|
+
export {
|
|
402
|
+
prepareViewTransition
|
|
403
|
+
};
|
|
404
|
+
//# sourceMappingURL=visual.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/dom/features/view-transition/visual.ts"],
|
|
4
|
+
"sourcesContent": ["import { FiberTag, type Fiber, type FiberRoot } from '../../../core';\nimport { REACT_VIEW_TRANSITION_TYPE, type ViewTransitionClass, type ViewTransitionInstance, type ViewTransitionProps, type ViewTransitionPseudoElement, } from '../../../react/view-transition';\nimport { isFunction } from '../../../core/functions';\nimport { transitionResources, type TransitionImages } from './resources';\ntype Kind = 'enter' | 'exit' | 'update' | 'share';\ntype Host = HTMLElement | SVGElement;\ntype Rect = [\n number,\n number,\n number,\n number\n];\ninterface Boundary {\n f: Fiber;\n p: ViewTransitionProps;\n h: Host[];\n a: Fiber[];\n r: Fiber | null;\n n: string;\n e: boolean;\n s: Rect[];\n c: string;\n v: boolean;\n}\ninterface Snapshot {\n b: Map<Fiber, Boundary>;\n v: Set<Fiber>;\n i: TransitionImages;\n}\ninterface Capture {\n o?: Boundary | undefined;\n n?: Boundary | undefined;\n k: Kind;\n s: string;\n h: Host[];\n e: boolean;\n}\ninterface Event {\n b: Boundary;\n k: Kind;\n n: string;\n}\nconst names = new WeakMap<Fiber, string>();\nconst styleProperties = ['view-transition-name', 'view-transition-class'];\nlet nextName = 0;\nfunction pseudo(doc: Document, kind: string, name: string): ViewTransitionPseudoElement {\n const scope = doc.documentElement;\n const selector = '::view-transition-' + kind + '(' + nativeName(name) + ')';\n return {\n animate(keyframes, options) {\n return scope.animate(keyframes, { ...(typeof options === 'number' ? { duration: options } : options), pseudoElement: selector });\n },\n getAnimations() {\n return scope.getAnimations({ subtree: true }).filter(animation => {\n const effect = animation.effect as KeyframeEffect | null;\n return effect?.target === scope && effect.pseudoElement === selector;\n });\n },\n getComputedStyle() { return doc.defaultView!.getComputedStyle(scope, selector); },\n };\n}\n// Ignore nested boundary content: its mutations belong to that boundary.\nfunction contents(node: Node, nested: Set<Node>, first?: boolean): string {\n if (!first && nested.has(node))\n return '|';\n if (node.nodeType === 3)\n return JSON.stringify(node.nodeValue);\n if (node.nodeType !== 1)\n return '';\n const element = node as Host;\n let result = '<' + element.nodeName;\n for (const attribute of element.attributes) {\n if (attribute.name !== 'style')\n result += ' ' + attribute.name + '=' + JSON.stringify(attribute.value);\n }\n for (let i = 0; i < element.style.length; i++) {\n const property = element.style[i]!;\n if (property !== 'view-transition-name' && property !== 'view-transition-class') {\n result += ';' + property + ':' + element.style.getPropertyValue(property) + '!' + element.style.getPropertyPriority(property);\n }\n }\n if ('value' in element)\n result += '=' + (element as HTMLInputElement).value;\n if ('checked' in element)\n result += ':' + (element as HTMLInputElement).checked;\n result += '>';\n for (let child = node.firstChild; child; child = child.nextSibling)\n result += contents(child, nested);\n return result + '</' + element.nodeName + '>';\n}\nfunction className(props: ViewTransitionProps, kind: Kind, types: string[]): string | undefined {\n const value = byType(props[kind], types) ?? byType(props.default, types);\n return value === 'auto' ? undefined : value;\n}\nfunction snapshot(roots: FiberRoot[], doc: Document, types: string[], connected = true): Snapshot {\n const boundaries = new Map<Fiber, Boundary>();\n const visible = new Set<Fiber>();\n const images: TransitionImages = new Map();\n const allHosts = new Set<Node>();\n const empty: Boundary[] = [];\n const ancestors: Fiber[] = [];\n function walk(fiber: Fiber, parent: Fiber | null, pending: Boundary[]): void {\n if (fiber.u)\n return;\n if (fiber.type === REACT_VIEW_TRANSITION_TYPE) {\n const props: ViewTransitionProps = fiber.v ?? {};\n const explicitName = byType(props.name, types);\n let name = explicitName;\n if (name == null || name === 'auto') {\n name = names.get(fiber);\n if (!name)\n names.set(fiber, name = '_redact_t_' + (++nextName).toString(32));\n }\n const boundary: Boundary = {\n f: fiber, p: props, h: [], a: ancestors.slice(), r: parent, n: name,\n e: explicitName != null && explicitName !== 'auto', s: [], c: '', v: false,\n };\n boundaries.set(fiber, boundary);\n pending = pending.concat(boundary);\n parent = fiber;\n }\n if (fiber.t === FiberTag.Host) {\n visible.add(fiber);\n const dom = fiber.n as Host | null;\n if (parent && fiber.type === 'img' && dom?.ownerDocument === doc) {\n images.set(dom as HTMLImageElement, fiber.v);\n }\n if (pending.length && dom?.ownerDocument === doc && (!connected || dom.isConnected) && dom.style) {\n for (const boundary of pending)\n boundary.h.push(dom);\n allHosts.add(dom);\n }\n pending = empty;\n ancestors.push(fiber);\n }\n visibleChildren(fiber, child => walk(child, parent, pending));\n if (fiber.t === FiberTag.Host)\n ancestors.pop();\n }\n for (const root of roots)\n walk(root.r, null, empty);\n const view = doc.defaultView;\n if (connected)\n for (const boundary of boundaries.values()) {\n boundary.s = boundary.h.map(host => {\n const rect = host.getBoundingClientRect();\n return [rect.x, rect.y, rect.width, rect.height];\n });\n 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));\n boundary.c = boundary.h.map(host => contents(host, allHosts, true)).join('');\n }\n return { b: boundaries, v: visible, i: images };\n}\nexport function prepareViewTransition(rootIterable: Iterable<FiberRoot>, types: string[]): PreparedViewTransition | null {\n const roots = Array.from(rootIterable);\n const container = roots[0]?.c;\n const doc = (container?.ownerDocument || container) as Document | undefined;\n if (!doc?.documentElement)\n return null;\n const before = snapshot(roots, doc, types);\n const saved = new Map<Host, string[]>();\n const suppressed = new Set<string>();\n const events: Event[] = [];\n const cleanups: (() => void)[] = [];\n const captures: Capture[] = [];\n let done = false;\n let after: Snapshot;\n let resources: ReturnType<typeof transitionResources> | undefined;\n function apply(host: Host, name: string, classes?: string): void {\n let previous = saved.get(host);\n if (!previous)\n saved.set(host, previous = []);\n for (let index = 0; index < 2; index++) {\n const property = styleProperties[index]!;\n const offset = index * 3;\n const current = host.style.getPropertyValue(property);\n // A committed style prop may replace either temporary value.\n if (current !== previous[offset + 2]) {\n previous[offset] = current;\n previous[offset + 1] = host.style.getPropertyPriority(property);\n }\n const value = index ? classes === 'none' ? '' : classes ?? previous[offset]! : nativeName(name);\n host.style.setProperty(property, previous[offset + 2] = value, 'important');\n }\n }\n function applyHosts(hosts: Host[], name: string, props: ViewTransitionProps, kind: Kind): void {\n const classes = className(props, kind, types);\n hosts.forEach((host, index) => apply(host, index ? name + '_' + index : name, classes));\n }\n function suppress(hosts: Host[], name: string): void {\n hosts.forEach((_, index) => suppressed.add(index ? name + '_' + index : name));\n }\n function ownership(side: 'o' | 'n'): Map<Host, Capture> {\n const owners = new Map<Host, Capture>();\n for (const capture of captures) {\n if (side === 'n' && !capture.e)\n continue;\n for (const host of capture[side]?.h ?? [])\n owners.set(host, capture);\n }\n return owners;\n }\n function capture(kind: Kind, old?: Boundary, next?: Boundary, enabled = true): void {\n captures.push({ o: old, n: next, k: kind, s: (old ?? next)!.n, h: [], e: !!next && enabled });\n }\n function restore(): void {\n for (const [host, previous] of saved) {\n for (let index = 0; index < 2; index++) {\n const property = styleProperties[index]!;\n const offset = index * 3;\n if (host.style.getPropertyValue(property) === previous[offset + 2]) {\n host.style.setProperty(property, previous[offset]!, previous[offset + 1]);\n }\n }\n }\n saved.clear();\n }\n function finish(): void {\n if (done)\n return;\n done = true;\n resources?.cancel();\n restore();\n let error: unknown;\n let failed = false;\n for (const cleanup of cleanups.splice(0)) {\n try {\n cleanup();\n }\n catch (caught) {\n if (!failed) {\n error = caught;\n failed = true;\n }\n }\n }\n if (failed)\n throw error;\n }\n return {\n document: doc,\n exclude(root) {\n const index = roots.indexOf(root);\n if (index >= 0)\n roots.splice(index, 1);\n for (const [fiber] of before.b)\n if (fiber.r === root)\n before.b.delete(fiber);\n },\n prepare() {\n after = snapshot(roots, doc, types, false);\n resources = transitionResources(doc, before.i, after.i);\n return resources.before();\n },\n waitForResources(fontsWereLoaded) {\n if (!done)\n return resources?.after(fontsWereLoaded);\n },\n beforeCommit() {\n if (done)\n return false;\n const entering = new Map<string, Boundary>();\n const paired = new Set<Fiber>();\n for (const boundary of after.b.values()) {\n if (!before.b.has(boundary.f) && boundary.e)\n entering.set(boundary.n, boundary);\n }\n for (const old of before.b.values()) {\n const current = after.b.get(old.f);\n if (current) {\n if (className(current.p, 'update', types) !== 'none')\n capture('update', old, current);\n }\n else {\n const shared = old.e && old.v ? entering.get(old.n) : undefined;\n if (shared) {\n entering.delete(old.n);\n if (className(old.p, 'share', types) !== 'none') {\n paired.add(shared.f);\n capture('share', old, shared, className(shared.p, 'share', types) !== 'none');\n }\n }\n else if (topLevel(old, after, before) && old.v && className(old.p, 'exit', types) !== 'none') {\n capture('exit', old);\n }\n }\n }\n for (const boundary of after.b.values()) {\n if (before.b.has(boundary.f) || paired.has(boundary.f))\n continue;\n if (topLevel(boundary, before, after) && className(boundary.p, 'enter', types) !== 'none') {\n capture('enter', undefined, boundary);\n }\n }\n // A directly nested boundary owns updates; an outer presence boundary\n // owns entering/exiting hosts. Shared descendants take precedence.\n captures.sort((a, b) => (a.k === 'share' ? 2 : a.k === 'update' ? 0 : 1) - (b.k === 'share' ? 2 : b.k === 'update' ? 0 : 1));\n if (!captures.some(capture => capture.o?.h.length || (capture.e && capture.n?.h.length)))\n return false;\n const owners = ownership('o');\n apply(doc.documentElement, 'none');\n for (const boundary of before.b.values())\n for (const host of boundary.h)\n apply(host, 'none');\n for (const capture of captures) {\n capture.h = capture.o?.h.filter(host => owners.get(host) === capture) ?? [];\n const props = capture.k === 'update' ? capture.n!.p : capture.o?.p;\n if (props)\n applyHosts(capture.h, capture.s, props, capture.k);\n }\n return true;\n },\n afterCommit() {\n if (done)\n return;\n const after = snapshot(roots, doc, types);\n for (const capture of captures) {\n if (capture.n)\n capture.n = after.b.get(capture.n.f);\n if (capture.k !== 'update' && !capture.n?.v)\n capture.e = false;\n }\n const owners = ownership('n');\n for (const boundary of after.b.values())\n for (const host of boundary.h)\n apply(host, 'none');\n for (const capture of captures) {\n const newHosts = capture.n?.h.filter(host => owners.get(host) === capture) ?? [];\n if (capture.n)\n applyHosts(newHosts, capture.s, capture.n.p, capture.k);\n if (!capture.h.length && !newHosts.length)\n continue;\n if (capture.k === 'update') {\n if (capture.n && capture.o && changed(capture.o, capture.n))\n events.push({ b: capture.n, n: capture.s, k: 'update' });\n else\n suppress(capture.h, capture.s);\n }\n else {\n const boundary = capture.k === 'enter' ? capture.n : capture.o;\n if (boundary)\n events.push({ b: boundary, n: capture.s, k: capture.k });\n }\n }\n },\n ready() {\n if (done)\n return;\n // These captures were needed before the synchronous commit could tell\n // which boundaries changed. Cancel their native animations, not the DOM.\n const nativeSuppressed = new Set([...suppressed].map(nativeName));\n for (const animation of doc.documentElement.getAnimations({ subtree: true })) {\n const effect = animation.effect as KeyframeEffect | null;\n const selector = effect?.pseudoElement;\n if (effect?.target !== doc.documentElement || !selector)\n continue;\n const start = selector.indexOf('(');\n if (start >= 0 && nativeSuppressed.has(selector.slice(start + 1, -1)))\n animation.cancel();\n }\n for (const name of suppressed) {\n const animation = pseudo(doc, 'group', name).animate({ opacity: 0 }, { duration: 0, fill: 'forwards' });\n cleanups.push(() => animation.cancel());\n }\n let error: unknown;\n let failed = false;\n for (const event of events) {\n if (done)\n break;\n const callback = event.b.p[('on' + event.k[0]!.toUpperCase() + event.k.slice(1)) as 'onEnter'];\n if (callback) {\n try {\n const cleanup = callback(instance(doc, event.n), types);\n if (isFunction(cleanup)) {\n if (done)\n cleanup();\n else\n cleanups.push(cleanup);\n }\n }\n catch (caught) {\n if (!failed) {\n error = caught;\n failed = true;\n }\n }\n }\n }\n if (failed)\n throw error;\n },\n restore,\n finish,\n cancel: finish,\n };\n}\nfunction visibleChildren(fiber: Fiber, visit: (child: Fiber) => void): void {\n if (fiber.t === FiberTag.Activity && fiber.v?.mode === 'hidden')\n return;\n if (fiber.t === FiberTag.Suspense && fiber.b?.f) {\n visit(fiber.b.f);\n return;\n }\n for (let child = fiber.c; child; child = child.s)\n visit(child);\n}\nconst nativeName = (name: string): string => (CSS.escape(name) === name ? name : CSS.escape('r-' + btoa(name).replace(/=/g, '')));\nconst instance = (doc: Document, name: string): ViewTransitionInstance => ({\n name,\n group: pseudo(doc, 'group', name),\n imagePair: pseudo(doc, 'image-pair', name),\n old: pseudo(doc, 'old', name),\n new: pseudo(doc, 'new', name),\n});\nfunction byType(value: ViewTransitionClass | undefined, types: string[]): string | undefined {\n if (isString(value))\n return value;\n if (!value)\n return undefined;\n let result: string | undefined;\n for (const type of types) {\n const match = value[type];\n if (match === 'none')\n return match;\n if (match != null)\n result = result == null ? match : result + ' ' + match;\n }\n return result ?? value.default;\n}\nconst changed = (before: Boundary, after: Boundary): boolean => (before.c !== after.c || before.h.length !== after.h.length ||\n before.h.some((host, i) => host !== after.h[i] || before.s[i]!.some((value, axis) => value !== after.s[i]![axis])));\nexport interface PreparedViewTransition {\n document: Document;\n exclude(root: FiberRoot): void;\n prepare(): Promise<void> | undefined;\n waitForResources(fontsWereLoaded: boolean): Promise<void> | undefined;\n beforeCommit(): boolean;\n afterCommit(): void;\n ready(): void;\n restore(): void;\n finish(): void;\n cancel(): void;\n}\nfunction topLevel(boundary: Boundary, other: Snapshot, side: Snapshot): boolean {\n // An inserted/deleted host wrapper owns its subtree's enter/exit animation.\n if (boundary.a.some(fiber => !other.v.has(fiber)))\n return false;\n for (let parent = boundary.r; parent; parent = side.b.get(parent)?.r ?? null) {\n if (!other.b.has(parent))\n return false;\n }\n return true;\n}\nimport { isString } from \"../../../core/functions\";\n"],
|
|
5
|
+
"mappings": "AACA,SAAS,kCAAsJ;AAC/J,SAAS,kBAAkB;AAC3B,SAAS,2BAAkD;AAuC3D,MAAM,QAAQ,oBAAI,QAAO;AACzB,MAAM,kBAAkB,CAAC,wBAAwB,uBAAuB;AACxE,IAAI,WAAW;AACf,SAAS,OAAO,KAAe,MAAc,MAAY;AACrD,QAAM,QAAQ,IAAI;AAClB,QAAM,WAAW,uBAAuB,OAAO,MAAM,WAAW,IAAI,IAAI;AACxE,SAAO;IACH,QAAQ,WAAW,SAAO;AACtB,aAAO,MAAM,QAAQ,WAAW,EAAE,GAAI,OAAO,YAAY,WAAW,EAAE,UAAU,QAAO,IAAK,SAAU,eAAe,SAAQ,CAAE;IACnI;IACA,gBAAa;AACT,aAAO,MAAM,cAAc,EAAE,SAAS,KAAI,CAAE,EAAE,OAAO,eAAY;AAC7D,cAAM,SAAS,UAAU;AACzB,eAAO,QAAQ,WAAW,SAAS,OAAO,kBAAkB;MAChE,CAAC;IACL;IACA,mBAAgB;AAAK,aAAO,IAAI,YAAa,iBAAiB,OAAO,QAAQ;IAAG;;AAExF;AAEA,SAAS,SAAS,MAAY,QAAmB,OAAe;AAC5D,MAAI,CAAC,SAAS,OAAO,IAAI,IAAI;AACzB,WAAO;AACX,MAAI,KAAK,aAAa;AACl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",
|
|
6
|
+
"names": ["capture", "after"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { type Fiber } from "../core/index.js";
|
|
2
|
+
export declare const formActions: WeakMap<Element, (data: FormData) => unknown>;
|
|
3
|
+
export declare function requestFormReset(form: HTMLFormElement): void;
|
|
4
|
+
export declare function bindForm(fiber: Fiber, onError: (fiber: Fiber, error: unknown) => void): void;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { walkRetained } from "./walk.js";
|
|
2
|
+
import { syncInputValue, syncTextareaValue, syncSelectValue } from "./form-controls.js";
|
|
3
|
+
import { runAction } from "../react/action-scope.js";
|
|
4
|
+
import { formState, idleFormStatus, publishForm } from "../react/form-state.js";
|
|
5
|
+
import { getRootContainer } from "./root-internal.js";
|
|
6
|
+
const forms = /* @__PURE__ */ new WeakMap();
|
|
7
|
+
const listening = /* @__PURE__ */ new WeakSet();
|
|
8
|
+
const handled = /* @__PURE__ */ new WeakSet();
|
|
9
|
+
const formActions = /* @__PURE__ */ new WeakMap();
|
|
10
|
+
function resetForm(form, owner) {
|
|
11
|
+
form.ownerDocument.defaultView.HTMLFormElement.prototype.reset.call(form);
|
|
12
|
+
walkRetained(owner.r.r, (fiber) => {
|
|
13
|
+
const props = fiber.m;
|
|
14
|
+
if (fiber.n && props && fiber.n.form === form) {
|
|
15
|
+
if (fiber.type === "input")
|
|
16
|
+
syncInputValue(fiber.n, props, props);
|
|
17
|
+
else if (fiber.type === "textarea")
|
|
18
|
+
syncTextareaValue(fiber.n, props);
|
|
19
|
+
else if (fiber.type === "select" && props.value != null) {
|
|
20
|
+
const select = fiber.n;
|
|
21
|
+
syncSelectValue(select, props);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
function requestFormReset(form) {
|
|
27
|
+
const owner = forms.get(form);
|
|
28
|
+
if (!owner || owner.u)
|
|
29
|
+
throw new Error(process.env.NODE_ENV !== "production" ? "requestFormReset expects a mounted form rendered by Redact." : "");
|
|
30
|
+
resetForm(form, owner);
|
|
31
|
+
}
|
|
32
|
+
function bindForm(fiber, onError) {
|
|
33
|
+
const form = fiber.n;
|
|
34
|
+
forms.set(form, fiber);
|
|
35
|
+
const container = getRootContainer(fiber);
|
|
36
|
+
if (listening.has(container))
|
|
37
|
+
return;
|
|
38
|
+
listening.add(container);
|
|
39
|
+
container.addEventListener("submit", (event) => {
|
|
40
|
+
if (event.defaultPrevented || handled.has(event))
|
|
41
|
+
return;
|
|
42
|
+
const form2 = event.target;
|
|
43
|
+
const owner = forms.get(form2);
|
|
44
|
+
if (!owner || owner.u)
|
|
45
|
+
return;
|
|
46
|
+
const submitter = event.submitter;
|
|
47
|
+
const override = submitter?.hasAttribute("formaction") || submitter && formActions.has(submitter);
|
|
48
|
+
const action = override ? formActions.get(submitter) : formActions.get(form2);
|
|
49
|
+
if (!action)
|
|
50
|
+
return;
|
|
51
|
+
handled.add(event);
|
|
52
|
+
event.preventDefault();
|
|
53
|
+
const data = new FormData(form2, submitter);
|
|
54
|
+
const state = formState(owner);
|
|
55
|
+
const generation = ++state.g;
|
|
56
|
+
publishForm(state, { pending: true, data, method: "post", action });
|
|
57
|
+
const scope = runAction(() => action(data));
|
|
58
|
+
scope.d.then(() => {
|
|
59
|
+
if (owner.u || generation !== state.g)
|
|
60
|
+
return;
|
|
61
|
+
if (!scope.f)
|
|
62
|
+
resetForm(form2, owner);
|
|
63
|
+
publishForm(state, idleFormStatus);
|
|
64
|
+
if (scope.f && !scope.h)
|
|
65
|
+
onError(owner, scope.e);
|
|
66
|
+
});
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
export {
|
|
70
|
+
bindForm,
|
|
71
|
+
formActions,
|
|
72
|
+
requestFormReset
|
|
73
|
+
};
|
|
74
|
+
//# sourceMappingURL=form-actions.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/dom/form-actions.ts"],
|
|
4
|
+
"sourcesContent": ["import { walkRetained } from './walk';\nimport { syncInputValue, syncTextareaValue, syncSelectValue } from './form-controls';\nimport { FiberTag, type Fiber } from '../core';\nimport { runAction } from '../react/action-scope';\nimport { formState, idleFormStatus, publishForm } from '../react/form-state';\nimport { getRootContainer } from './root-internal';\nconst forms = new WeakMap<HTMLFormElement, Fiber>();\nconst listening = new WeakSet<Node>();\nconst handled = new WeakSet<Event>();\nexport const formActions = new WeakMap<Element, (data: FormData) => unknown>();\nfunction resetForm(form: HTMLFormElement, owner: Fiber): void {\n form.ownerDocument.defaultView!.HTMLFormElement.prototype.reset.call(form);\n walkRetained(owner.r!.r, fiber => {\n const props = fiber.m;\n if (fiber.n && props && (fiber.n as HTMLInputElement).form === form) {\n if (fiber.type === 'input')\n syncInputValue(fiber.n as HTMLInputElement, props, props);\n else if (fiber.type === 'textarea')\n syncTextareaValue(fiber.n as HTMLTextAreaElement, props);\n else if (fiber.type === 'select' && props.value != null) {\n const select = fiber.n as HTMLSelectElement;\n syncSelectValue(select, props);\n }\n }\n });\n}\nexport function requestFormReset(form: HTMLFormElement): void {\n const owner = forms.get(form);\n if (!owner || owner.u)\n throw new Error(process.env.NODE_ENV !== 'production' ? 'requestFormReset expects a mounted form rendered by Redact.' : '');\n resetForm(form, owner);\n}\nexport function bindForm(fiber: Fiber, onError: (fiber: Fiber, error: unknown) => void): void {\n const form = fiber.n as HTMLFormElement;\n forms.set(form, fiber);\n const container = getRootContainer(fiber);\n if (listening.has(container))\n return;\n listening.add(container);\n container.addEventListener('submit', event => {\n if (event.defaultPrevented || handled.has(event))\n return;\n const form = event.target as HTMLFormElement;\n const owner = forms.get(form);\n if (!owner || owner.u)\n return;\n const submitter = (event as SubmitEvent).submitter as HTMLButtonElement | HTMLInputElement | null;\n const override = submitter?.hasAttribute('formaction') || (submitter && formActions.has(submitter));\n const action = override ? formActions.get(submitter!) : formActions.get(form);\n if (!action)\n return;\n handled.add(event);\n event.preventDefault();\n const data = new FormData(form, submitter);\n const state = formState(owner);\n const generation = ++state.g;\n publishForm(state, { pending: true, data, method: 'post', action });\n const scope = runAction(() => action(data));\n scope.d.then(() => {\n if (owner.u || generation !== state.g)\n return;\n if (!scope.f)\n resetForm(form, owner);\n publishForm(state, idleFormStatus);\n if (scope.f && !scope.h)\n onError(owner, scope.e);\n });\n });\n}\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,oBAAoB;AAC7B,SAAS,gBAAgB,mBAAmB,uBAAuB;AAEnE,SAAS,iBAAiB;AAC1B,SAAS,WAAW,gBAAgB,mBAAmB;AACvD,SAAS,wBAAwB;AACjC,MAAM,QAAQ,oBAAI,QAAO;AACzB,MAAM,YAAY,oBAAI,QAAO;AAC7B,MAAM,UAAU,oBAAI,QAAO;AACpB,MAAM,cAAc,oBAAI,QAAO;AACtC,SAAS,UAAU,MAAuB,OAAY;AAClD,OAAK,cAAc,YAAa,gBAAgB,UAAU,MAAM,KAAK,IAAI;AACzE,eAAa,MAAM,EAAG,GAAG,WAAQ;AAC7B,UAAM,QAAQ,MAAM;AACpB,QAAI,MAAM,KAAK,SAAU,MAAM,EAAuB,SAAS,MAAM;AACjE,UAAI,MAAM,SAAS;AACf,uBAAe,MAAM,GAAuB,OAAO,KAAK;eACnD,MAAM,SAAS;AACpB,0BAAkB,MAAM,GAA0B,KAAK;eAClD,MAAM,SAAS,YAAY,MAAM,SAAS,MAAM;AACrD,cAAM,SAAS,MAAM;AACrB,wBAAgB,QAAQ,KAAK;MACjC;IACJ;EACJ,CAAC;AACL;AACM,SAAU,iBAAiB,MAAqB;AAClD,QAAM,QAAQ,MAAM,IAAI,IAAI;AAC5B,MAAI,CAAC,SAAS,MAAM;AAChB,UAAM,IAAI,MAAM,yBAAyB,eAAe,gEAAgE,EAAE;AAC9H,YAAU,MAAM,KAAK;AACzB;AACM,SAAU,SAAS,OAAc,SAA+C;AAClF,QAAM,OAAO,MAAM;AACnB,QAAM,IAAI,MAAM,KAAK;AACrB,QAAM,YAAY,iBAAiB,KAAK;AACxC,MAAI,UAAU,IAAI,SAAS;AACvB;AACJ,YAAU,IAAI,SAAS;AACvB,YAAU,iBAAiB,UAAU,WAAQ;AACzC,QAAI,MAAM,oBAAoB,QAAQ,IAAI,KAAK;AAC3C;AACJ,UAAMA,QAAO,MAAM;AACnB,UAAM,QAAQ,MAAM,IAAIA,KAAI;AAC5B,QAAI,CAAC,SAAS,MAAM;AAChB;AACJ,UAAM,YAAa,MAAsB;AACzC,UAAM,WAAW,WAAW,aAAa,YAAY,KAAM,aAAa,YAAY,IAAI,SAAS;AACjG,UAAM,SAAS,WAAW,YAAY,IAAI,SAAU,IAAI,YAAY,IAAIA,KAAI;AAC5E,QAAI,CAAC;AACD;AACJ,YAAQ,IAAI,KAAK;AACjB,UAAM,eAAc;AACpB,UAAM,OAAO,IAAI,SAASA,OAAM,SAAS;AACzC,UAAM,QAAQ,UAAU,KAAK;AAC7B,UAAM,aAAa,EAAE,MAAM;AAC3B,gBAAY,OAAO,EAAE,SAAS,MAAM,MAAM,QAAQ,QAAQ,OAAM,CAAE;AAClE,UAAM,QAAQ,UAAU,MAAM,OAAO,IAAI,CAAC;AAC1C,UAAM,EAAE,KAAK,MAAK;AACd,UAAI,MAAM,KAAK,eAAe,MAAM;AAChC;AACJ,UAAI,CAAC,MAAM;AACP,kBAAUA,OAAM,KAAK;AACzB,kBAAY,OAAO,cAAc;AACjC,UAAI,MAAM,KAAK,CAAC,MAAM;AAClB,gBAAQ,OAAO,MAAM,CAAC;IAC9B,CAAC;EACL,CAAC;AACL;",
|
|
6
|
+
"names": ["form"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export declare function syncTextareaValue(el: HTMLTextAreaElement, props: any, mounting?: boolean): void;
|
|
2
|
+
export declare function syncInputValue(el: HTMLInputElement, props: any, prev?: any): void;
|
|
3
|
+
export declare function syncSelectValue(select: HTMLSelectElement, props: any, prev?: any): void;
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { trackInputValue } from "./dom.js";
|
|
2
|
+
function syncTextareaValue(el, props, mounting) {
|
|
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
|
+
if (initial !== "" && el.textContent === initial) {
|
|
8
|
+
el.value = initial;
|
|
9
|
+
trackInputValue(el);
|
|
10
|
+
}
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
const value = props.value;
|
|
14
|
+
if (value != null && el.value !== "" + value) {
|
|
15
|
+
el.value = "" + value;
|
|
16
|
+
trackInputValue(el);
|
|
17
|
+
}
|
|
18
|
+
const fallback = props.defaultValue ?? value ?? "";
|
|
19
|
+
if (el.defaultValue !== "" + fallback)
|
|
20
|
+
el.defaultValue = "" + fallback;
|
|
21
|
+
}
|
|
22
|
+
function syncInputValue(el, props, prev) {
|
|
23
|
+
if (!prev) {
|
|
24
|
+
el.checked = el.defaultChecked = !!(props.checked ?? props.defaultChecked);
|
|
25
|
+
} else if (props.checked != null) {
|
|
26
|
+
el.checked = !!props.checked;
|
|
27
|
+
} else if (props.defaultChecked != null) {
|
|
28
|
+
el.defaultChecked = !!props.defaultChecked;
|
|
29
|
+
}
|
|
30
|
+
const value = props.value;
|
|
31
|
+
const fallback = props.defaultValue;
|
|
32
|
+
if (!prev) {
|
|
33
|
+
if (value == null && (el.type === "submit" || el.type === "reset"))
|
|
34
|
+
return;
|
|
35
|
+
if (value != null || fallback != null) {
|
|
36
|
+
const initial = "" + (value ?? fallback);
|
|
37
|
+
if (el.value !== initial) {
|
|
38
|
+
el.value = initial;
|
|
39
|
+
trackInputValue(el);
|
|
40
|
+
}
|
|
41
|
+
el.defaultValue = initial;
|
|
42
|
+
}
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
if (value != null) {
|
|
46
|
+
if (el.type === "number" ? value === 0 && el.value === "" || el.value != value : el.value !== "" + value) {
|
|
47
|
+
el.value = "" + value;
|
|
48
|
+
trackInputValue(el);
|
|
49
|
+
}
|
|
50
|
+
const nextDefault = el.type === "number" && el.value == value ? el.value : "" + value;
|
|
51
|
+
if (el.defaultValue !== nextDefault)
|
|
52
|
+
el.defaultValue = nextDefault;
|
|
53
|
+
} else if (fallback != null) {
|
|
54
|
+
if (el.defaultValue !== "" + fallback)
|
|
55
|
+
el.defaultValue = "" + fallback;
|
|
56
|
+
} else if (prev.defaultValue != null || el.type === "submit" || el.type === "reset") {
|
|
57
|
+
el.removeAttribute("value");
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
function syncSelectValue(select, props, prev) {
|
|
61
|
+
const multiple = select.multiple;
|
|
62
|
+
const value = props.value ?? (!prev || !!prev.multiple !== multiple ? props.defaultValue ?? (prev && []) : null);
|
|
63
|
+
if (value == null)
|
|
64
|
+
return;
|
|
65
|
+
const defaults = props.value == null && props.defaultValue != null;
|
|
66
|
+
const selected = new Set(multiple ? value.map(String) : ["" + value]);
|
|
67
|
+
let fallback;
|
|
68
|
+
for (const option of select.options) {
|
|
69
|
+
const match = selected.has(option.value);
|
|
70
|
+
if (defaults && match)
|
|
71
|
+
option.defaultSelected = true;
|
|
72
|
+
if (multiple)
|
|
73
|
+
option.selected = match;
|
|
74
|
+
else {
|
|
75
|
+
if (match) {
|
|
76
|
+
fallback = option;
|
|
77
|
+
break;
|
|
78
|
+
}
|
|
79
|
+
if (!fallback && !option.disabled)
|
|
80
|
+
fallback = option;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
if (fallback)
|
|
84
|
+
fallback.selected = true;
|
|
85
|
+
}
|
|
86
|
+
export {
|
|
87
|
+
syncInputValue,
|
|
88
|
+
syncSelectValue,
|
|
89
|
+
syncTextareaValue
|
|
90
|
+
};
|
|
91
|
+
//# sourceMappingURL=form-controls.js.map
|