@bleedingdev/tanstack-redact 0.0.0-stage → 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/dist/cloudflare/index.d.ts +6 -0
- package/dist/cloudflare/index.js +39 -0
- package/dist/cloudflare/index.js.map +7 -0
- package/dist/core/attributes.d.ts +4 -0
- package/dist/core/attributes.js +30 -0
- package/dist/core/attributes.js.map +7 -0
- package/dist/core/browser.d.ts +9 -0
- package/dist/core/browser.js +32 -0
- package/dist/core/browser.js.map +7 -0
- package/dist/core/class-props.d.ts +1 -0
- package/dist/core/class-props.js +15 -0
- package/dist/core/class-props.js.map +7 -0
- package/dist/core/devtools.d.ts +26 -0
- package/dist/core/devtools.js +70 -0
- package/dist/core/devtools.js.map +7 -0
- package/dist/core/functions.d.ts +6 -0
- package/dist/core/functions.js +14 -0
- package/dist/core/functions.js.map +7 -0
- package/dist/core/index.d.ts +2 -0
- package/dist/core/index.js +3 -0
- package/dist/core/index.js.map +7 -0
- package/dist/core/internal.d.ts +103 -0
- package/dist/core/internal.js +43 -0
- package/dist/core/internal.js.map +7 -0
- package/dist/core/resource-hints.d.ts +7 -0
- package/dist/core/resource-hints.js +20 -0
- package/dist/core/resource-hints.js.map +7 -0
- package/dist/core/types.d.ts +23 -0
- package/dist/core/types.js +8 -0
- package/dist/core/types.js.map +7 -0
- package/dist/core/unitless-style.d.ts +1 -0
- package/dist/core/unitless-style.js +5 -0
- package/dist/core/unitless-style.js.map +7 -0
- package/dist/dom/_all.d.ts +27 -0
- package/dist/dom/_all.js +51 -0
- package/dist/dom/_all.js.map +7 -0
- package/dist/dom/client.d.ts +9 -0
- package/dist/dom/client.js +13 -0
- package/dist/dom/client.js.map +7 -0
- package/dist/dom/commit.d.ts +27 -0
- package/dist/dom/commit.js +237 -0
- package/dist/dom/commit.js.map +7 -0
- package/dist/dom/devtools-effects.d.ts +8 -0
- package/dist/dom/devtools-effects.js +80 -0
- package/dist/dom/devtools-effects.js.map +7 -0
- package/dist/dom/devtools.d.ts +33 -0
- package/dist/dom/devtools.js +635 -0
- package/dist/dom/devtools.js.map +7 -0
- package/dist/dom/dispatcher.d.ts +4 -0
- package/dist/dom/dispatcher.js +437 -0
- package/dist/dom/dispatcher.js.map +7 -0
- package/dist/dom/document-metadata.d.ts +7 -0
- package/dist/dom/document-metadata.js +44 -0
- package/dist/dom/document-metadata.js.map +7 -0
- package/dist/dom/dom.d.ts +11 -0
- package/dist/dom/dom.js +165 -0
- package/dist/dom/dom.js.map +7 -0
- package/dist/dom/error-info.d.ts +2 -0
- package/dist/dom/error-info.js +19 -0
- package/dist/dom/error-info.js.map +7 -0
- package/dist/dom/event-replay.d.ts +13 -0
- package/dist/dom/event-replay.js +24 -0
- package/dist/dom/event-replay.js.map +7 -0
- package/dist/dom/features/activity/full.d.ts +1 -0
- package/dist/dom/features/activity/full.js +140 -0
- package/dist/dom/features/activity/full.js.map +7 -0
- package/dist/dom/features/activity/index.d.ts +1 -0
- package/dist/dom/features/activity/index.js +2 -0
- package/dist/dom/features/activity/index.js.map +7 -0
- package/dist/dom/features/activity/stub.d.ts +1 -0
- package/dist/dom/features/activity/stub.js +10 -0
- package/dist/dom/features/activity/stub.js.map +7 -0
- package/dist/dom/features/class/full.d.ts +1 -0
- package/dist/dom/features/class/full.js +208 -0
- package/dist/dom/features/class/full.js.map +7 -0
- package/dist/dom/features/class/index.d.ts +1 -0
- package/dist/dom/features/class/index.js +2 -0
- package/dist/dom/features/class/index.js.map +7 -0
- package/dist/dom/features/class/stub.d.ts +1 -0
- package/dist/dom/features/class/stub.js +46 -0
- package/dist/dom/features/class/stub.js.map +7 -0
- package/dist/dom/features/context/full.d.ts +4 -0
- package/dist/dom/features/context/full.js +103 -0
- package/dist/dom/features/context/full.js.map +7 -0
- package/dist/dom/features/context/index.d.ts +1 -0
- package/dist/dom/features/context/index.js +2 -0
- package/dist/dom/features/context/index.js.map +7 -0
- package/dist/dom/features/context/stub.d.ts +4 -0
- package/dist/dom/features/context/stub.js +21 -0
- package/dist/dom/features/context/stub.js.map +7 -0
- package/dist/dom/features/forward-ref/full.d.ts +1 -0
- package/dist/dom/features/forward-ref/full.js +9 -0
- package/dist/dom/features/forward-ref/full.js.map +7 -0
- package/dist/dom/features/forward-ref/index.d.ts +1 -0
- package/dist/dom/features/forward-ref/index.js +2 -0
- package/dist/dom/features/forward-ref/index.js.map +7 -0
- package/dist/dom/features/forward-ref/stub.d.ts +1 -0
- package/dist/dom/features/forward-ref/stub.js +9 -0
- package/dist/dom/features/forward-ref/stub.js.map +7 -0
- package/dist/dom/features/fragment-refs/index.d.ts +1 -0
- package/dist/dom/features/fragment-refs/index.js +9 -0
- package/dist/dom/features/fragment-refs/index.js.map +7 -0
- package/dist/dom/features/fragment-refs/stub.d.ts +5 -0
- package/dist/dom/features/fragment-refs/stub.js +17 -0
- package/dist/dom/features/fragment-refs/stub.js.map +7 -0
- package/dist/dom/features/hydration/full.d.ts +68 -0
- package/dist/dom/features/hydration/full.js +493 -0
- package/dist/dom/features/hydration/full.js.map +7 -0
- package/dist/dom/features/hydration/index.d.ts +1 -0
- package/dist/dom/features/hydration/index.js +2 -0
- package/dist/dom/features/hydration/index.js.map +7 -0
- package/dist/dom/features/hydration/stub.d.ts +36 -0
- package/dist/dom/features/hydration/stub.js +80 -0
- package/dist/dom/features/hydration/stub.js.map +7 -0
- package/dist/dom/features/index.d.ts +8 -0
- package/dist/dom/features/index.js +9 -0
- package/dist/dom/features/index.js.map +7 -0
- package/dist/dom/features/lazy/full.d.ts +1 -0
- package/dist/dom/features/lazy/full.js +23 -0
- package/dist/dom/features/lazy/full.js.map +7 -0
- package/dist/dom/features/lazy/index.d.ts +1 -0
- package/dist/dom/features/lazy/index.js +2 -0
- package/dist/dom/features/lazy/index.js.map +7 -0
- package/dist/dom/features/lazy/stub.d.ts +1 -0
- package/dist/dom/features/lazy/stub.js +19 -0
- package/dist/dom/features/lazy/stub.js.map +7 -0
- package/dist/dom/features/memo/full.d.ts +1 -0
- package/dist/dom/features/memo/full.js +34 -0
- package/dist/dom/features/memo/full.js.map +7 -0
- package/dist/dom/features/memo/index.d.ts +1 -0
- package/dist/dom/features/memo/index.js +2 -0
- package/dist/dom/features/memo/index.js.map +7 -0
- package/dist/dom/features/memo/stub.d.ts +1 -0
- package/dist/dom/features/memo/stub.js +9 -0
- package/dist/dom/features/memo/stub.js.map +7 -0
- package/dist/dom/features/portal/full.d.ts +1 -0
- package/dist/dom/features/portal/full.js +11 -0
- package/dist/dom/features/portal/full.js.map +7 -0
- package/dist/dom/features/portal/index.d.ts +1 -0
- package/dist/dom/features/portal/index.js +2 -0
- package/dist/dom/features/portal/index.js.map +7 -0
- package/dist/dom/features/portal/stub.d.ts +1 -0
- package/dist/dom/features/portal/stub.js +5 -0
- package/dist/dom/features/portal/stub.js.map +7 -0
- package/dist/dom/features/suspense/full.d.ts +1 -0
- package/dist/dom/features/suspense/full.js +389 -0
- package/dist/dom/features/suspense/full.js.map +7 -0
- package/dist/dom/features/suspense/index.d.ts +1 -0
- package/dist/dom/features/suspense/index.js +2 -0
- package/dist/dom/features/suspense/index.js.map +7 -0
- package/dist/dom/features/suspense/stub.d.ts +1 -0
- package/dist/dom/features/suspense/stub.js +4 -0
- package/dist/dom/features/suspense/stub.js.map +7 -0
- package/dist/dom/features/suspense-runtime/index.d.ts +1 -0
- package/dist/dom/features/suspense-runtime/index.js +2 -0
- package/dist/dom/features/suspense-runtime/index.js.map +7 -0
- package/dist/dom/features/suspense-runtime/stub.d.ts +1 -0
- package/dist/dom/features/suspense-runtime/stub.js +11 -0
- package/dist/dom/features/suspense-runtime/stub.js.map +7 -0
- package/dist/dom/features/view-transition/full.d.ts +7 -0
- package/dist/dom/features/view-transition/full.js +324 -0
- package/dist/dom/features/view-transition/full.js.map +7 -0
- package/dist/dom/features/view-transition/index.d.ts +1 -0
- package/dist/dom/features/view-transition/index.js +2 -0
- package/dist/dom/features/view-transition/index.js.map +7 -0
- package/dist/dom/features/view-transition/resources.d.ts +11 -0
- package/dist/dom/features/view-transition/resources.js +117 -0
- package/dist/dom/features/view-transition/resources.js.map +7 -0
- package/dist/dom/features/view-transition/stub.d.ts +7 -0
- package/dist/dom/features/view-transition/stub.js +21 -0
- package/dist/dom/features/view-transition/stub.js.map +7 -0
- package/dist/dom/features/view-transition/visual.d.ts +14 -0
- package/dist/dom/features/view-transition/visual.js +404 -0
- package/dist/dom/features/view-transition/visual.js.map +7 -0
- package/dist/dom/form-actions.d.ts +4 -0
- package/dist/dom/form-actions.js +74 -0
- package/dist/dom/form-actions.js.map +7 -0
- package/dist/dom/form-controls.d.ts +3 -0
- package/dist/dom/form-controls.js +91 -0
- package/dist/dom/form-controls.js.map +7 -0
- package/dist/dom/fragment-instance.d.ts +33 -0
- package/dist/dom/fragment-instance.js +449 -0
- package/dist/dom/fragment-instance.js.map +7 -0
- package/dist/dom/index.d.ts +61 -0
- package/dist/dom/index.js +71 -0
- package/dist/dom/index.js.map +7 -0
- package/dist/dom/portal.d.ts +2 -0
- package/dist/dom/portal.js +14 -0
- package/dist/dom/portal.js.map +7 -0
- package/dist/dom/react-ids.d.ts +6 -0
- package/dist/dom/react-ids.js +38 -0
- package/dist/dom/react-ids.js.map +7 -0
- package/dist/dom/reconcile.d.ts +86 -0
- package/dist/dom/reconcile.js +1305 -0
- package/dist/dom/reconcile.js.map +7 -0
- package/dist/dom/refresh.d.ts +12 -0
- package/dist/dom/refresh.js +174 -0
- package/dist/dom/refresh.js.map +7 -0
- package/dist/dom/resource-hints.d.ts +6 -0
- package/dist/dom/resource-hints.js +107 -0
- package/dist/dom/resource-hints.js.map +7 -0
- package/dist/dom/resource-store.d.ts +13 -0
- package/dist/dom/resource-store.js +47 -0
- package/dist/dom/resource-store.js.map +7 -0
- package/dist/dom/resources.d.ts +1 -0
- package/dist/dom/resources.js +46 -0
- package/dist/dom/resources.js.map +7 -0
- package/dist/dom/retained-effects.d.ts +6 -0
- package/dist/dom/retained-effects.js +67 -0
- package/dist/dom/retained-effects.js.map +7 -0
- package/dist/dom/root-internal.d.ts +11 -0
- package/dist/dom/root-internal.js +35 -0
- package/dist/dom/root-internal.js.map +7 -0
- package/dist/dom/root.d.ts +17 -0
- package/dist/dom/root.js +38 -0
- package/dist/dom/root.js.map +7 -0
- package/dist/dom/synthetic-event.d.ts +1 -0
- package/dist/dom/synthetic-event.js +37 -0
- package/dist/dom/synthetic-event.js.map +7 -0
- package/dist/dom/test-utils.d.ts +1 -0
- package/dist/dom/test-utils.js +5 -0
- package/dist/dom/test-utils.js.map +7 -0
- package/dist/dom/transitions.d.ts +9 -0
- package/dist/dom/transitions.js +147 -0
- package/dist/dom/transitions.js.map +7 -0
- package/dist/dom/tree.d.ts +5 -0
- package/dist/dom/tree.js +62 -0
- package/dist/dom/tree.js.map +7 -0
- package/dist/dom/walk.d.ts +2 -0
- package/dist/dom/walk.js +14 -0
- package/dist/dom/walk.js.map +7 -0
- package/dist/next/client.d.ts +9 -0
- package/dist/next/client.js +14 -0
- package/dist/next/client.js.map +7 -0
- package/dist/next/dev-cache-loader.cjs +13 -0
- package/dist/next/index.d.ts +2 -0
- package/dist/next/index.js +97 -0
- package/dist/next/index.js.map +7 -0
- package/dist/next/loader.cjs +10 -0
- package/dist/next/react.d.ts +71 -0
- package/dist/next/react.js +9 -0
- package/dist/next/react.js.map +7 -0
- package/dist/react/act.d.ts +3 -0
- package/dist/react/act.js +124 -0
- package/dist/react/act.js.map +7 -0
- package/dist/react/action-scope.d.ts +17 -0
- package/dist/react/action-scope.js +60 -0
- package/dist/react/action-scope.js.map +7 -0
- package/dist/react/activity.d.ts +7 -0
- package/dist/react/activity.js +7 -0
- package/dist/react/activity.js.map +7 -0
- package/dist/react/children.d.ts +8 -0
- package/dist/react/children.js +76 -0
- package/dist/react/children.js.map +7 -0
- package/dist/react/class.d.ts +36 -0
- package/dist/react/class.js +39 -0
- package/dist/react/class.js.map +7 -0
- package/dist/react/compiler-runtime.d.ts +1 -0
- package/dist/react/compiler-runtime.js +9 -0
- package/dist/react/compiler-runtime.js.map +7 -0
- package/dist/react/context.d.ts +32 -0
- package/dist/react/context.js +25 -0
- package/dist/react/context.js.map +7 -0
- package/dist/react/element.d.ts +13 -0
- package/dist/react/element.js +70 -0
- package/dist/react/element.js.map +7 -0
- package/dist/react/form-state.d.ts +26 -0
- package/dist/react/form-state.js +30 -0
- package/dist/react/form-state.js.map +7 -0
- package/dist/react/hooks.d.ts +67 -0
- package/dist/react/hooks.js +165 -0
- package/dist/react/hooks.js.map +7 -0
- package/dist/react/index.d.ts +99 -0
- package/dist/react/index.js +143 -0
- package/dist/react/index.js.map +7 -0
- package/dist/react/jsx-runtime.d.ts +24 -0
- package/dist/react/jsx-runtime.js +37 -0
- package/dist/react/jsx-runtime.js.map +7 -0
- package/dist/react/memo.d.ts +20 -0
- package/dist/react/memo.js +27 -0
- package/dist/react/memo.js.map +7 -0
- package/dist/react/portal.d.ts +1 -0
- package/dist/react/portal.js +5 -0
- package/dist/react/portal.js.map +7 -0
- package/dist/react/shared-internals.d.ts +52 -0
- package/dist/react/shared-internals.js +22 -0
- package/dist/react/shared-internals.js.map +7 -0
- package/dist/react/suspense.d.ts +15 -0
- package/dist/react/suspense.js +15 -0
- package/dist/react/suspense.js.map +7 -0
- package/dist/react/thenable.d.ts +1 -0
- package/dist/react/thenable.js +25 -0
- package/dist/react/thenable.js.map +7 -0
- package/dist/react/view-transition.d.ts +32 -0
- package/dist/react/view-transition.js +12 -0
- package/dist/react/view-transition.js.map +7 -0
- package/dist/scheduler/index.d.ts +44 -0
- package/dist/scheduler/index.js +109 -0
- package/dist/scheduler/index.js.map +7 -0
- package/dist/server/bootstrap-script.d.ts +3 -0
- package/dist/server/bootstrap-script.js +17 -0
- package/dist/server/bootstrap-script.js.map +7 -0
- package/dist/server/dispatcher.d.ts +57 -0
- package/dist/server/dispatcher.js +157 -0
- package/dist/server/dispatcher.js.map +7 -0
- package/dist/server/escape.d.ts +6 -0
- package/dist/server/escape.js +75 -0
- package/dist/server/escape.js.map +7 -0
- package/dist/server/index.d.ts +16 -0
- package/dist/server/index.js +25 -0
- package/dist/server/index.js.map +7 -0
- package/dist/server/insertion-context.d.ts +3 -0
- package/dist/server/insertion-context.js +32 -0
- package/dist/server/renderToString.d.ts +7 -0
- package/dist/server/renderToString.js +33 -0
- package/dist/server/renderToString.js.map +7 -0
- package/dist/server/resource-hints.d.ts +22 -0
- package/dist/server/resource-hints.js +168 -0
- package/dist/server/resource-hints.js.map +7 -0
- package/dist/server/stream-ids.d.ts +3 -0
- package/dist/server/stream-ids.js +8 -0
- package/dist/server/stream.d.ts +61 -0
- package/dist/server/stream.js +418 -0
- package/dist/server/stream.js.map +7 -0
- package/dist/server/walk.d.ts +58 -0
- package/dist/server/walk.js +378 -0
- package/dist/server/walk.js.map +7 -0
- package/dist/vinext/compatibility.d.ts +23 -0
- package/dist/vinext/compatibility.js +127 -0
- package/dist/vinext/compatibility.js.map +7 -0
- package/dist/vinext/flight-timing.d.ts +1 -0
- package/dist/vinext/flight-timing.js +46 -0
- package/dist/vinext/flight-timing.js.map +7 -0
- package/dist/vinext/index.d.ts +5 -0
- package/dist/vinext/index.js +50 -0
- package/dist/vinext/index.js.map +7 -0
- package/dist/vite/index.d.ts +102 -0
- package/dist/vite/index.js +291 -0
- package/dist/vite/index.js.map +7 -0
- package/dist/vite/react18.d.ts +4 -0
- package/dist/vite/react18.js +74 -0
- package/dist/vite/react18.js.map +7 -0
- package/package.json +121 -4
- package/src/cloudflare/index.ts +44 -0
- package/src/core/attributes.ts +20 -0
- package/src/core/browser.ts +34 -0
- package/src/core/class-props.ts +12 -0
- package/src/core/devtools.ts +69 -0
- package/src/core/functions.ts +11 -0
- package/src/core/index.ts +2 -0
- package/src/core/internal.ts +123 -0
- package/src/core/resource-hints.ts +39 -0
- package/src/core/types.ts +39 -0
- package/src/core/unitless-style.ts +1 -0
- package/src/dom/_all.ts +46 -0
- package/src/dom/client.ts +17 -0
- package/src/dom/commit.ts +223 -0
- package/src/dom/devtools-effects.ts +78 -0
- package/src/dom/devtools.ts +527 -0
- package/src/dom/dispatcher.ts +476 -0
- package/src/dom/document-metadata.ts +41 -0
- package/src/dom/dom.ts +181 -0
- package/src/dom/error-info.ts +20 -0
- package/src/dom/event-replay.ts +39 -0
- package/src/dom/features/activity/full.ts +150 -0
- package/src/dom/features/activity/index.ts +1 -0
- package/src/dom/features/activity/stub.ts +12 -0
- package/src/dom/features/class/full.ts +202 -0
- package/src/dom/features/class/index.ts +1 -0
- package/src/dom/features/class/stub.ts +58 -0
- package/src/dom/features/context/full.ts +107 -0
- package/src/dom/features/context/index.ts +1 -0
- package/src/dom/features/context/stub.ts +26 -0
- package/src/dom/features/forward-ref/full.ts +9 -0
- package/src/dom/features/forward-ref/index.ts +1 -0
- package/src/dom/features/forward-ref/stub.ts +15 -0
- package/src/dom/features/fragment-refs/index.ts +1 -0
- package/src/dom/features/fragment-refs/stub.ts +6 -0
- package/src/dom/features/hydration/full.ts +563 -0
- package/src/dom/features/hydration/index.ts +1 -0
- package/src/dom/features/hydration/stub.ts +86 -0
- package/src/dom/features/index.ts +12 -0
- package/src/dom/features/lazy/full.ts +27 -0
- package/src/dom/features/lazy/index.ts +1 -0
- package/src/dom/features/lazy/stub.ts +24 -0
- package/src/dom/features/memo/full.ts +39 -0
- package/src/dom/features/memo/index.ts +1 -0
- package/src/dom/features/memo/stub.ts +13 -0
- package/src/dom/features/portal/full.ts +14 -0
- package/src/dom/features/portal/index.ts +1 -0
- package/src/dom/features/portal/stub.ts +11 -0
- package/src/dom/features/suspense/full.ts +469 -0
- package/src/dom/features/suspense/index.ts +1 -0
- package/src/dom/features/suspense/stub.ts +13 -0
- package/src/dom/features/suspense-runtime/index.ts +1 -0
- package/src/dom/features/suspense-runtime/stub.ts +1 -0
- package/src/dom/features/view-transition/full.ts +292 -0
- package/src/dom/features/view-transition/index.ts +1 -0
- package/src/dom/features/view-transition/resources.ts +123 -0
- package/src/dom/features/view-transition/stub.ts +8 -0
- package/src/dom/features/view-transition/visual.ts +454 -0
- package/src/dom/form-actions.ts +69 -0
- package/src/dom/form-controls.ts +91 -0
- package/src/dom/fragment-instance.ts +462 -0
- package/src/dom/index.ts +49 -0
- package/src/dom/portal.ts +16 -0
- package/src/dom/react-ids.ts +36 -0
- package/src/dom/reconcile.ts +1423 -0
- package/src/dom/refresh.ts +171 -0
- package/src/dom/resource-hints.ts +104 -0
- package/src/dom/resource-store.ts +50 -0
- package/src/dom/resources.ts +47 -0
- package/src/dom/retained-effects.ts +57 -0
- package/src/dom/root-internal.ts +37 -0
- package/src/dom/root.ts +59 -0
- package/src/dom/synthetic-event.ts +27 -0
- package/src/dom/test-utils.ts +1 -0
- package/src/dom/transitions.ts +141 -0
- package/src/dom/tree.ts +56 -0
- package/src/dom/walk.ts +8 -0
- package/src/next/client.ts +10 -0
- package/src/next/dev-cache-loader.cjs +13 -0
- package/src/next/index.ts +95 -0
- package/src/next/loader.cjs +10 -0
- package/src/next/react.ts +7 -0
- package/src/react/act.ts +105 -0
- package/src/react/action-scope.ts +57 -0
- package/src/react/activity.ts +10 -0
- package/src/react/children.ts +86 -0
- package/src/react/class.ts +66 -0
- package/src/react/compiler-runtime.ts +8 -0
- package/src/react/context.ts +46 -0
- package/src/react/element.ts +82 -0
- package/src/react/form-state.ts +35 -0
- package/src/react/hooks.ts +214 -0
- package/src/react/index.ts +91 -0
- package/src/react/jsx-runtime.ts +50 -0
- package/src/react/memo.ts +42 -0
- package/src/react/portal.ts +1 -0
- package/src/react/shared-internals.ts +80 -0
- package/src/react/suspense.ts +18 -0
- package/src/react/thenable.ts +21 -0
- package/src/react/view-transition.ts +41 -0
- package/src/scheduler/index.ts +124 -0
- package/src/server/bootstrap-script.ts +92 -0
- package/src/server/dispatcher.ts +168 -0
- package/src/server/escape.ts +102 -0
- package/src/server/index.ts +26 -0
- package/src/server/insertion-context.ts +28 -0
- package/src/server/renderToString.ts +35 -0
- package/src/server/resource-hints.ts +166 -0
- package/src/server/stream-ids.ts +5 -0
- package/src/server/stream.ts +525 -0
- package/src/server/walk.ts +555 -0
- package/src/vinext/compatibility.ts +122 -0
- package/src/vinext/flight-timing.ts +37 -0
- package/src/vinext/index.ts +47 -0
- package/src/vite/index.ts +476 -0
- package/src/vite/react18.ts +74 -0
- package/vendor/cloudflare-vite-plugin/LICENSE +25 -0
- package/vendor/cloudflare-vite-plugin/README.md +9 -0
- package/vendor/cloudflare-vite-plugin/dist/chunk-U6NEESU5-BmLHqeIt.mjs +43 -0
- package/vendor/cloudflare-vite-plugin/dist/index.d.mts +155 -0
- package/vendor/cloudflare-vite-plugin/dist/index.mjs +94700 -0
- package/vendor/cloudflare-vite-plugin/dist/open-PCXX3ZDZ-DYH87NhH.mjs +530 -0
- package/vendor/cloudflare-vite-plugin/dist/package-4cnqy5mM.mjs +84 -0
- package/vendor/cloudflare-vite-plugin/dist/workers/asset-worker/index.js +5996 -0
- package/vendor/cloudflare-vite-plugin/dist/workers/router-worker/index.js +6414 -0
- package/vendor/cloudflare-vite-plugin/dist/workers/runner-worker/index.js +457 -0
- package/vendor/cloudflare-vite-plugin/dist/workers/runner-worker/module-runner-legacy.js +1129 -0
- package/vendor/cloudflare-vite-plugin/dist/workers/runner-worker/module-runner.js +1259 -0
- package/vendor/cloudflare-vite-plugin/dist/workers/vite-proxy-worker/index.js +31 -0
- package/vendor/cloudflare-vite-plugin/package.json +90 -0
- package/vendor/cloudflare-vite-plugin/provenance.json +26 -0
- package/README.md +0 -3
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/react/children.ts"],
|
|
4
|
+
"sourcesContent": ["import { isValidElement, cloneElement } from './element'\nimport type { ReactNode, ReactElement } from '../core'\n\nfunction flatten(node: ReactNode, out: any[]): void {\n if (node == null || typeof node === 'boolean') return\n if (Array.isArray(node)) {\n for (let i = 0; i < node.length; i++) flatten(node[i], out)\n return\n }\n out.push(node)\n}\n\nfunction getKey(node: any, index: number, prefix: string): string {\n if (isValidElement(node) && node.key != null) return prefix + '$' + node.key\n return prefix + ':' + index\n}\n\nfunction mapChildren(\n children: ReactNode,\n fn: (child: ReactNode, index: number) => any,\n prefix = '',\n): any[] {\n const flat: any[] = []\n flatten(children, flat)\n const out: any[] = []\n for (let i = 0; i < flat.length; i++) {\n const child = flat[i]\n const mapped = fn(child, i)\n if (mapped == null) continue\n if (Array.isArray(mapped)) {\n for (let j = 0; j < mapped.length; j++) {\n const m = mapped[j]\n if (m == null) continue\n out.push(\n isValidElement(m) && m.key == null\n ? cloneElement(m as ReactElement, { key: getKey(child, i, prefix) + '/' + j })\n : m,\n )\n }\n } else {\n out.push(\n isValidElement(mapped) && mapped.key == null\n ? cloneElement(mapped as ReactElement, { key: getKey(child, i, prefix) })\n : mapped,\n )\n }\n }\n return out\n}\n\nexport const Children = {\n map(children: ReactNode, fn: (child: ReactNode, index: number) => any): any[] | null {\n if (children == null) return null\n return mapChildren(children, fn)\n },\n forEach(children: ReactNode, fn: (child: ReactNode, index: number) => void): void {\n if (children == null) return\n mapChildren(children, (c, i) => {\n fn(c, i)\n return null\n })\n },\n count(children: ReactNode): number {\n const flat: any[] = []\n flatten(children, flat)\n return flat.length\n },\n toArray(children: ReactNode): any[] {\n const flat: any[] = []\n flatten(children, flat)\n return flat.map((c, i) =>\n isValidElement(c) && c.key == null\n ? cloneElement(c as ReactElement, { key: '' + i })\n : c,\n )\n },\n only(children: ReactNode): ReactElement {\n if (!isValidElement(children)) {\n if (process.env.NODE_ENV !== 'production') {\n throw new Error('Children.only expected a single React element.')\n }\n throw new Error()\n }\n return children\n },\n}\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,gBAAgB,oBAAoB;AAG7C,SAAS,QAAQ,MAAiB,KAAU;AAC1C,MAAI,QAAQ,QAAQ,OAAO,SAAS;AAAW;AAC/C,MAAI,MAAM,QAAQ,IAAI,GAAG;AACvB,aAAS,IAAI,GAAG,IAAI,KAAK,QAAQ;AAAK,cAAQ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AO,KAAK;EACd;EACA,QAAQ,UAAmB;AACzB,UAAM,OAAc,CAAA;AACpB,YAAQ,UAAU,IAAI;AACtB,WAAO,KAAK,IAAI,CAAC,GAAG,MAClB,eAAe,CAAC,KAAK,EAAE,OAAO,OAC1B,aAAa,GAAmB,EAAE,KAAK,KAAK,EAAC,CAAE,IAC/C,CAAC;EAET;EACA,KAAK,UAAmB;AACtB,QAAI,CAAC,eAAe,QAAQ,GAAG;AAC7B,UAAI,yBAAyB,cAAc;AACzC,cAAM,IAAI,MAAM,gDAAgD;MAClE;AACA,YAAM,IAAI,MAAK;IACjB;AACA,WAAO;EACT;;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { ReactNode } from "../core/index.js";
|
|
2
|
+
type SetStateCallback<S, P> = Partial<S> | ((prev: S, props: P) => Partial<S> | null) | null;
|
|
3
|
+
export interface Component<P = {}, S = {}> {
|
|
4
|
+
props: P;
|
|
5
|
+
state: S;
|
|
6
|
+
context: any;
|
|
7
|
+
refs: Record<string, any>;
|
|
8
|
+
_f: any;
|
|
9
|
+
_q: ((updater: SetStateCallback<S, P>, cb?: () => void) => void) | null;
|
|
10
|
+
_u: ((cb?: () => void) => void) | null;
|
|
11
|
+
setState(updater: SetStateCallback<S, P>, callback?: () => void): void;
|
|
12
|
+
forceUpdate(callback?: () => void): void;
|
|
13
|
+
render(): ReactNode;
|
|
14
|
+
componentDidMount?(): void;
|
|
15
|
+
componentDidUpdate?(prevProps: P, prevState: S, snapshot?: any): void;
|
|
16
|
+
componentWillUnmount?(): void;
|
|
17
|
+
shouldComponentUpdate?(nextProps: P, nextState: S, nextCtx: any): boolean;
|
|
18
|
+
getSnapshotBeforeUpdate?(prevProps: P, prevState: S): any;
|
|
19
|
+
componentDidCatch?(error: any, info: {
|
|
20
|
+
componentStack: string;
|
|
21
|
+
}): void;
|
|
22
|
+
}
|
|
23
|
+
export interface ComponentConstructor {
|
|
24
|
+
new <P = {}, S = {}>(props: P, context?: any): Component<P, S>;
|
|
25
|
+
prototype: Component<any, any>;
|
|
26
|
+
contextType?: any;
|
|
27
|
+
getDerivedStateFromProps?(props: any, state: any): any;
|
|
28
|
+
getDerivedStateFromError?(error: any): any;
|
|
29
|
+
defaultProps?: any;
|
|
30
|
+
displayName?: string;
|
|
31
|
+
}
|
|
32
|
+
export declare const Component: ComponentConstructor;
|
|
33
|
+
export interface PureComponent<P = {}, S = {}> extends Component<P, S> {
|
|
34
|
+
}
|
|
35
|
+
export declare const PureComponent: ComponentConstructor;
|
|
36
|
+
export {};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
const Component = function Component2(props, context) {
|
|
2
|
+
this.props = props;
|
|
3
|
+
this.context = context;
|
|
4
|
+
this.state = {};
|
|
5
|
+
this.refs = {};
|
|
6
|
+
this._f = this._q = this._u = null;
|
|
7
|
+
};
|
|
8
|
+
Object.assign(Component.prototype, {
|
|
9
|
+
setState(updater, callback) {
|
|
10
|
+
if (!this._q) {
|
|
11
|
+
if (process.env.NODE_ENV !== "production")
|
|
12
|
+
throw new Error("Cannot call setState on an um component.");
|
|
13
|
+
throw new Error();
|
|
14
|
+
}
|
|
15
|
+
this._q(updater, callback);
|
|
16
|
+
},
|
|
17
|
+
forceUpdate(callback) {
|
|
18
|
+
if (!this._u)
|
|
19
|
+
return;
|
|
20
|
+
this._u(callback);
|
|
21
|
+
},
|
|
22
|
+
render() {
|
|
23
|
+
if (process.env.NODE_ENV !== "production")
|
|
24
|
+
throw new Error("Component subclass must implement render().");
|
|
25
|
+
throw new Error();
|
|
26
|
+
},
|
|
27
|
+
isReactComponent: {}
|
|
28
|
+
});
|
|
29
|
+
const PureComponent = function PureComponent2(props, context) {
|
|
30
|
+
Component.call(this, props, context);
|
|
31
|
+
};
|
|
32
|
+
PureComponent.prototype = Object.create(Component.prototype);
|
|
33
|
+
PureComponent.prototype.constructor = PureComponent;
|
|
34
|
+
PureComponent.prototype.isPureReactComponent = true;
|
|
35
|
+
export {
|
|
36
|
+
Component,
|
|
37
|
+
PureComponent
|
|
38
|
+
};
|
|
39
|
+
//# sourceMappingURL=class.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/react/class.ts"],
|
|
4
|
+
"sourcesContent": ["import type { ReactNode } from '../core'\n\ntype SetStateCallback<S, P> = Partial<S> | ((prev: S, props: P) => Partial<S> | null) | null\n\nexport interface Component<P = {}, S = {}> {\n props: P\n state: S\n context: any\n refs: Record<string, any>\n _f: any\n _q: ((updater: SetStateCallback<S, P>, cb?: () => void) => void) | null\n _u: ((cb?: () => void) => void) | null\n setState(updater: SetStateCallback<S, P>, callback?: () => void): void\n forceUpdate(callback?: () => void): void\n render(): ReactNode\n componentDidMount?(): void\n componentDidUpdate?(prevProps: P, prevState: S, snapshot?: any): void\n componentWillUnmount?(): void\n shouldComponentUpdate?(nextProps: P, nextState: S, nextCtx: any): boolean\n getSnapshotBeforeUpdate?(prevProps: P, prevState: S): any\n componentDidCatch?(error: any, info: { componentStack: string }): void\n}\nexport interface ComponentConstructor {\n new <P = {}, S = {}>(props: P, context?: any): Component<P, S>\n prototype: Component<any, any>\n contextType?: any\n getDerivedStateFromProps?(props: any, state: any): any\n getDerivedStateFromError?(error: any): any\n defaultProps?: any\n displayName?: string\n}\n\n// A real function constructor also supports the Component.call/apply pattern\n// emitted by ES5 class transforms. The signature keeps generic class consumers.\nexport const Component = function Component(this: Component<any, any>, props: any, context?: any) {\n this.props = props\n this.context = context\n this.state = {}\n this.refs = {}\n this._f = this._q = this._u = null\n} as unknown as ComponentConstructor\nObject.assign(Component.prototype, {\n setState(this: Component<any, any>, updater: SetStateCallback<any, any>, callback?: () => void): void {\n if (!this._q) {\n if (process.env.NODE_ENV !== 'production') throw new Error('Cannot call setState on an um component.')\n throw new Error()\n }\n this._q(updater, callback)\n },\n forceUpdate(this: Component<any, any>, callback?: () => void): void {\n if (!this._u) return\n this._u(callback)\n },\n render(): ReactNode {\n if (process.env.NODE_ENV !== 'production') throw new Error('Component subclass must implement render().')\n throw new Error()\n },\n isReactComponent: {},\n})\nexport interface PureComponent<P = {}, S = {}> extends Component<P, S> {}\nexport const PureComponent = function PureComponent(this: Component<any, any>, props: any, context?: any) {\n Component.call(this, props, context)\n} as unknown as ComponentConstructor\nPureComponent.prototype = Object.create(Component.prototype)\nPureComponent.prototype.constructor = PureComponent\n;(PureComponent.prototype as any).isPureReactComponent = true\n"],
|
|
5
|
+
"mappings": "AAkCO,MAAM,YAAY,SAASA,WAAqC,OAAY,SAAa;AAC9F,OAAK,QAAQ;AACb,OAAK,UAAU;AACf,OAAK,QAAQ,CAAA;AACb,OAAK,OAAO,CAAA;AACZ,OAAK,KAAK,KAAK,KAAK,KAAK,KAAK;AAChC;AACA,OAAO,OAAO,UAAU,WAAW;EACjC,SAAoC,SAAqC,UAAqB;AAC5F,QAAI,CAAC,KAAK,IAAI;AACZ,UAAI,yBAAyB;AAAc,cAAM,IAAI,MAAM,0CAA0C;AACrG,YAAM,IAAI,MAAK;IACjB;AACA,SAAK,GAAG,SAAS,QAAQ;EAC3B;EACA,YAAuC,UAAqB;AAC1D,QAAI,CAAC,KAAK;AAAI;AACd,SAAK,GAAG,QAAQ;EAClB;EACA,SAAM;AACJ,QAAI,yBAAyB;AAAc,YAAM,IAAI,MAAM,6CAA6C;AACxG,UAAM,IAAI,MAAK;EACjB;EACA,kBAAkB,CAAA;CACnB;AAEM,MAAM,gBAAgB,SAASC,eAAyC,OAAY,SAAa;AACtG,YAAU,KAAK,MAAM,OAAO,OAAO;AACrC;AACA,cAAc,YAAY,OAAO,OAAO,UAAU,SAAS;AAC3D,cAAc,UAAU,cAAc;AACpC,cAAc,UAAkB,uBAAuB;",
|
|
6
|
+
"names": ["Component", "PureComponent"]
|
|
7
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function c(size: number): Array<unknown>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { useMemo } from "./hooks.js";
|
|
2
|
+
const MEMO_CACHE_SENTINEL = /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel");
|
|
3
|
+
function c(size) {
|
|
4
|
+
return useMemo(() => new Array(size).fill(MEMO_CACHE_SENTINEL), [size]);
|
|
5
|
+
}
|
|
6
|
+
export {
|
|
7
|
+
c
|
|
8
|
+
};
|
|
9
|
+
//# sourceMappingURL=compiler-runtime.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/react/compiler-runtime.ts"],
|
|
4
|
+
"sourcesContent": ["import { useMemo } from './hooks'\n\nconst MEMO_CACHE_SENTINEL = Symbol.for('react.memo_cache_sentinel')\n\n// Memo dependencies are invalidated by Fast Refresh while component state survives.\nexport function c(size: number): Array<unknown> {\n return useMemo(() => new Array<unknown>(size).fill(MEMO_CACHE_SENTINEL), [size])\n}\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,eAAe;AAExB,MAAM,sBAAsB,uBAAO,IAAI,2BAA2B;AAG5D,SAAU,EAAE,MAAY;AAC5B,SAAO,QAAQ,MAAM,IAAI,MAAe,IAAI,EAAE,KAAK,mBAAmB,GAAG,CAAC,IAAI,CAAC;AACjF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { ReactElement, ReactNode } from "../core/index.js";
|
|
2
|
+
export declare const REACT_CONTEXT_TYPE: unique symbol;
|
|
3
|
+
export declare const REACT_PROVIDER_TYPE: unique symbol;
|
|
4
|
+
export declare const REACT_CONSUMER_TYPE: unique symbol;
|
|
5
|
+
export interface Context<T> {
|
|
6
|
+
$$typeof: typeof REACT_CONTEXT_TYPE;
|
|
7
|
+
_context: Context<T>;
|
|
8
|
+
_currentValue: T;
|
|
9
|
+
Provider: ProviderExoticComponent<{
|
|
10
|
+
value: T;
|
|
11
|
+
children?: ReactNode;
|
|
12
|
+
}>;
|
|
13
|
+
Consumer: ConsumerExoticComponent<T>;
|
|
14
|
+
displayName?: string;
|
|
15
|
+
(props: {
|
|
16
|
+
value: T;
|
|
17
|
+
children?: ReactNode;
|
|
18
|
+
}): ReactElement;
|
|
19
|
+
}
|
|
20
|
+
export interface ProviderExoticComponent<P> {
|
|
21
|
+
$$typeof: typeof REACT_CONTEXT_TYPE | typeof REACT_PROVIDER_TYPE;
|
|
22
|
+
_context: Context<any>;
|
|
23
|
+
(props: P): ReactElement;
|
|
24
|
+
}
|
|
25
|
+
export interface ConsumerExoticComponent<T> {
|
|
26
|
+
$$typeof: typeof REACT_CONSUMER_TYPE;
|
|
27
|
+
_context: Context<T>;
|
|
28
|
+
(props: {
|
|
29
|
+
children: (value: T) => ReactNode;
|
|
30
|
+
}): ReactElement;
|
|
31
|
+
}
|
|
32
|
+
export declare function createContext<T>(defaultValue: T): Context<T>;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { useContext } from "./hooks.js";
|
|
2
|
+
const REACT_CONTEXT_TYPE = /* @__PURE__ */ Symbol.for("react.context");
|
|
3
|
+
const REACT_PROVIDER_TYPE = /* @__PURE__ */ Symbol.for("react.provider");
|
|
4
|
+
const REACT_CONSUMER_TYPE = /* @__PURE__ */ Symbol.for("react.consumer");
|
|
5
|
+
function createContext(defaultValue) {
|
|
6
|
+
const context = {
|
|
7
|
+
$$typeof: REACT_CONTEXT_TYPE,
|
|
8
|
+
_currentValue: defaultValue
|
|
9
|
+
};
|
|
10
|
+
const Consumer = function Consumer2(props) {
|
|
11
|
+
return props.children(useContext(context));
|
|
12
|
+
};
|
|
13
|
+
Consumer.$$typeof = REACT_CONSUMER_TYPE;
|
|
14
|
+
Consumer._context = context;
|
|
15
|
+
context.Provider = context._context = context;
|
|
16
|
+
context.Consumer = Consumer;
|
|
17
|
+
return context;
|
|
18
|
+
}
|
|
19
|
+
export {
|
|
20
|
+
REACT_CONSUMER_TYPE,
|
|
21
|
+
REACT_CONTEXT_TYPE,
|
|
22
|
+
REACT_PROVIDER_TYPE,
|
|
23
|
+
createContext
|
|
24
|
+
};
|
|
25
|
+
//# sourceMappingURL=context.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/react/context.ts"],
|
|
4
|
+
"sourcesContent": ["import type { ReactElement, ReactNode } from '../core'\nimport { useContext } from './hooks'\n\nexport const REACT_CONTEXT_TYPE = Symbol.for('react.context')\nexport const REACT_PROVIDER_TYPE = Symbol.for('react.provider')\nexport const REACT_CONSUMER_TYPE = Symbol.for('react.consumer')\n\nexport interface Context<T> {\n $$typeof: typeof REACT_CONTEXT_TYPE\n _context: Context<T>\n _currentValue: T\n Provider: ProviderExoticComponent<{ value: T; children?: ReactNode }>\n Consumer: ConsumerExoticComponent<T>\n displayName?: string\n (props: { value: T; children?: ReactNode }): ReactElement\n}\n\nexport interface ProviderExoticComponent<P> {\n $$typeof: typeof REACT_CONTEXT_TYPE | typeof REACT_PROVIDER_TYPE\n _context: Context<any>\n (props: P): ReactElement\n}\n\nexport interface ConsumerExoticComponent<T> {\n $$typeof: typeof REACT_CONSUMER_TYPE\n _context: Context<T>\n (props: { children: (value: T) => ReactNode }): ReactElement\n}\n\nexport function createContext<T>(defaultValue: T): Context<T> {\n const context: Context<T> = {\n $$typeof: REACT_CONTEXT_TYPE,\n _currentValue: defaultValue,\n } as Context<T>\n\n const Consumer: any = function Consumer(props: { children: (v: T) => any }): any {\n return props.children(useContext(context))\n }\n Consumer.$$typeof = REACT_CONSUMER_TYPE\n Consumer._context = context\n\n context.Provider = context._context = context\n context.Consumer = Consumer\n\n return context\n}\n"],
|
|
5
|
+
"mappings": "AACA,SAAS,kBAAkB;AAEpB,MAAM,qBAAqB,uBAAO,IAAI,eAAe;AACrD,MAAM,sBAAsB,uBAAO,IAAI,gBAAgB;AACvD,MAAM,sBAAsB,uBAAO,IAAI,gBAAgB;AAwBxD,SAAU,cAAiB,cAAe;AAC9C,QAAM,UAAsB;IAC1B,UAAU;IACV,eAAe;;AAGjB,QAAM,WAAgB,SAASA,UAAS,OAAkC;AACxE,WAAO,MAAM,SAAS,WAAW,OAAO,CAAC;EAC3C;AACA,WAAS,WAAW;AACpB,WAAS,WAAW;AAEpB,UAAQ,WAAW,QAAQ,WAAW;AACtC,UAAQ,WAAW;AAEnB,SAAO;AACT;",
|
|
6
|
+
"names": ["Consumer"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type ReactElement, type ReactNode, type Ref } from "../core/index.js";
|
|
2
|
+
import type { FragmentInstance } from "../dom/fragment-instance.js";
|
|
3
|
+
export declare const Fragment: (props: {
|
|
4
|
+
children?: ReactNode;
|
|
5
|
+
key?: string | number;
|
|
6
|
+
ref?: Ref<FragmentInstance>;
|
|
7
|
+
}) => ReactElement;
|
|
8
|
+
export declare function createElement(type: any, config?: Record<string, any> | null, ...children: ReactNode[]): ReactElement;
|
|
9
|
+
export declare function cloneElement(element: ReactElement, config?: Record<string, any> | null, ...children: ReactNode[]): ReactElement;
|
|
10
|
+
export declare function isValidElement(obj: any): obj is ReactElement;
|
|
11
|
+
export declare function createRef<T = any>(): {
|
|
12
|
+
current: T | null;
|
|
13
|
+
};
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { REACT_ELEMENT_TYPE, REACT_LEGACY_ELEMENT_TYPE, REACT_FRAGMENT_TYPE } from "../core/index.js";
|
|
2
|
+
import { rememberDevToolsElement } from "../core/devtools.js";
|
|
3
|
+
const Fragment = REACT_FRAGMENT_TYPE;
|
|
4
|
+
function createElement(type, config, ...children) {
|
|
5
|
+
let key = null;
|
|
6
|
+
const props = {};
|
|
7
|
+
if (config != null) {
|
|
8
|
+
if (config.key !== void 0 && config.key !== null)
|
|
9
|
+
key = "" + config.key;
|
|
10
|
+
for (const k in config) {
|
|
11
|
+
if (k !== "key" && k !== "__self" && k !== "__source" && Object.prototype.hasOwnProperty.call(config, k)) {
|
|
12
|
+
props[k] = config[k];
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
if (children.length === 1)
|
|
17
|
+
props.children = children[0];
|
|
18
|
+
else if (children.length > 1)
|
|
19
|
+
props.children = children;
|
|
20
|
+
if (type && type.defaultProps) {
|
|
21
|
+
const dp = type.defaultProps;
|
|
22
|
+
for (const k in dp) {
|
|
23
|
+
if (props[k] === void 0)
|
|
24
|
+
props[k] = dp[k];
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
if (process.env.NODE_ENV !== "production")
|
|
28
|
+
return rememberDevToolsElement({ $$typeof: REACT_ELEMENT_TYPE, type, key, ref: props.ref ?? null, props }, config?.__source);
|
|
29
|
+
return { $$typeof: REACT_ELEMENT_TYPE, type, key, ref: props.ref ?? null, props };
|
|
30
|
+
}
|
|
31
|
+
function cloneElement(element, config, ...children) {
|
|
32
|
+
let key = element.key;
|
|
33
|
+
const props = { ...element.props };
|
|
34
|
+
if (config != null) {
|
|
35
|
+
if (config.key !== void 0)
|
|
36
|
+
key = "" + config.key;
|
|
37
|
+
const defaultProps = element.type?.defaultProps;
|
|
38
|
+
for (const k in config) {
|
|
39
|
+
if (k === "key" || k === "__self" || k === "__source" || !Object.prototype.hasOwnProperty.call(config, k))
|
|
40
|
+
continue;
|
|
41
|
+
if (k === "ref" && config.ref === void 0)
|
|
42
|
+
continue;
|
|
43
|
+
props[k] = config[k] === void 0 && defaultProps ? defaultProps[k] : config[k];
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
if (children.length === 1)
|
|
47
|
+
props.children = children[0];
|
|
48
|
+
else if (children.length > 1)
|
|
49
|
+
props.children = children;
|
|
50
|
+
if (process.env.NODE_ENV !== "production")
|
|
51
|
+
return rememberDevToolsElement({ $$typeof: REACT_ELEMENT_TYPE, type: element.type, key, ref: props.ref === void 0 ? element.ref : props.ref, props }, config?.__source, config?.ref === void 0 ? element : void 0);
|
|
52
|
+
return { $$typeof: REACT_ELEMENT_TYPE, type: element.type, key, ref: props.ref === void 0 ? element.ref : props.ref, props };
|
|
53
|
+
}
|
|
54
|
+
function isValidElement(obj) {
|
|
55
|
+
if (typeof obj !== "object" || obj === null)
|
|
56
|
+
return false;
|
|
57
|
+
const t = obj.$$typeof;
|
|
58
|
+
return t === REACT_ELEMENT_TYPE || t === REACT_LEGACY_ELEMENT_TYPE;
|
|
59
|
+
}
|
|
60
|
+
function createRef() {
|
|
61
|
+
return { current: null };
|
|
62
|
+
}
|
|
63
|
+
export {
|
|
64
|
+
Fragment,
|
|
65
|
+
cloneElement,
|
|
66
|
+
createElement,
|
|
67
|
+
createRef,
|
|
68
|
+
isValidElement
|
|
69
|
+
};
|
|
70
|
+
//# sourceMappingURL=element.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/react/element.ts"],
|
|
4
|
+
"sourcesContent": ["import {\n REACT_ELEMENT_TYPE,\n REACT_LEGACY_ELEMENT_TYPE,\n REACT_FRAGMENT_TYPE,\n type ReactElement,\n type ReactNode,\n type Ref,\n} from '../core'\nimport type { FragmentInstance } from '../dom/fragment-instance'\nimport { rememberDevToolsElement } from '../core/devtools'\n\nexport const Fragment = REACT_FRAGMENT_TYPE as unknown as (props: {\n children?: ReactNode\n key?: string | number\n ref?: Ref<FragmentInstance>\n}) => ReactElement\n\nexport function createElement(\n type: any,\n config?: Record<string, any> | null,\n ...children: ReactNode[]\n): ReactElement {\n let key: string | null = null\n const props: Record<string, any> = {}\n\n if (config != null) {\n if (config.key !== undefined && config.key !== null) key = '' + config.key\n for (const k in config) {\n if (k !== 'key' && k !== '__self' && k !== '__source' && Object.prototype.hasOwnProperty.call(config, k)) {\n props[k] = config[k]\n }\n }\n }\n\n if (children.length === 1) props.children = children[0]\n else if (children.length > 1) props.children = children\n\n if (type && type.defaultProps) {\n const dp = type.defaultProps\n for (const k in dp) {\n if (props[k] === undefined) props[k] = dp[k]\n }\n }\n\n if (process.env.NODE_ENV !== 'production') return rememberDevToolsElement({ $$typeof: REACT_ELEMENT_TYPE, type, key, ref: props.ref ?? null, props }, config?.__source)\n return { $$typeof: REACT_ELEMENT_TYPE, type, key, ref: props.ref ?? null, props }\n}\n\nexport function cloneElement(\n element: ReactElement,\n config?: Record<string, any> | null,\n ...children: ReactNode[]\n): ReactElement {\n let key = element.key\n const props = { ...element.props }\n\n if (config != null) {\n if (config.key !== undefined) key = '' + config.key\n const defaultProps = element.type?.defaultProps\n for (const k in config) {\n if (k === 'key' || k === '__self' || k === '__source' || !Object.prototype.hasOwnProperty.call(config, k)) continue\n if (k === 'ref' && config.ref === undefined) continue\n props[k] = config[k] === undefined && defaultProps ? defaultProps[k] : config[k]\n }\n }\n\n if (children.length === 1) props.children = children[0]\n else if (children.length > 1) props.children = children\n\n if (process.env.NODE_ENV !== 'production') return rememberDevToolsElement({ $$typeof: REACT_ELEMENT_TYPE, type: element.type, key, ref: props.ref === undefined ? element.ref : props.ref, props }, config?.__source, config?.ref === undefined ? element : undefined)\n return { $$typeof: REACT_ELEMENT_TYPE, type: element.type, key, ref: props.ref === undefined ? element.ref : props.ref, props }\n}\n\nexport function isValidElement(obj: any): obj is ReactElement {\n if (typeof obj !== 'object' || obj === null) return false\n const t = obj.$$typeof\n return t === REACT_ELEMENT_TYPE || t === REACT_LEGACY_ELEMENT_TYPE\n}\n\nexport function createRef<T = any>() {\n return { current: null as T | null }\n}\n"],
|
|
5
|
+
"mappings": "AAAA,SACE,oBACA,2BACA,2BAIK;AAEP,SAAS,+BAA+B;AAEjC,MAAM,WAAW;AAMlB,SAAU,cACd,MACA,WACG,UAAqB;AAExB,MAAI,MAAqB;AACzB,QAAM,QAA6B,CAAA;AAEnC,MAAI,UAAU,MAAM;AAClB,QAAI,OAAO,QAAQ,UAAa,OAAO,QAAQ;AAAM,YAAM,KAAK,OAAO;AACvE,eAAW,KAAK,QAAQ;AACtB,UAAI,MAAM,SAAS,MAAM,YAAY,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,SAAY,QAAQ,MAAM,MAAM,KAAK,MAAK,GAAI,QAAQ,UAAU,QAAQ,QAAQ,SAAY,UAAU,MAAS;AACrQ,SAAO,EAAE,UAAU,oBAAoB,MAAM,QAAQ,MAAM,KAAK,KAAK,MAAM,QAAQ,SAAY,QAAQ,MAAM,MAAM,KAAK,MAAK;AAC/H;AAEM,SAAU,eAAe,KAAQ;AACrC,MAAI,OAAO,QAAQ,YAAY,QAAQ;AAAM,WAAO;AACpD,QAAM,IAAI,IAAI;AACd,SAAO,MAAM,sBAAsB,MAAM;AAC3C;AAEM,SAAU,YAAS;AACvB,SAAO,EAAE,SAAS,KAAgB;AACpC;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { Fiber, FiberRoot } from "../core/index.js";
|
|
2
|
+
export type FormStatus = {
|
|
3
|
+
pending: false;
|
|
4
|
+
data: null;
|
|
5
|
+
method: null;
|
|
6
|
+
action: null;
|
|
7
|
+
} | {
|
|
8
|
+
pending: true;
|
|
9
|
+
data: FormData;
|
|
10
|
+
method: string;
|
|
11
|
+
action: (data: FormData) => unknown;
|
|
12
|
+
};
|
|
13
|
+
export declare const idleFormStatus: FormStatus;
|
|
14
|
+
export interface FormState {
|
|
15
|
+
s: FormStatus;
|
|
16
|
+
l: Set<() => void>;
|
|
17
|
+
g: number;
|
|
18
|
+
}
|
|
19
|
+
export declare const formStates: WeakMap<Fiber, FormState>;
|
|
20
|
+
export declare function formState(fiber: Fiber): FormState;
|
|
21
|
+
export declare function publishForm(state: FormState, status: FormStatus): void;
|
|
22
|
+
export declare const hydratedFormStates: WeakMap<FiberRoot, {
|
|
23
|
+
value: unknown;
|
|
24
|
+
consume: (fiber: Fiber) => boolean;
|
|
25
|
+
}>;
|
|
26
|
+
export declare function actionInitialState<T>(fiber: Fiber | null, initial: T): T;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
const idleFormStatus = { pending: false, data: null, method: null, action: null };
|
|
2
|
+
const formStates = /* @__PURE__ */ new WeakMap();
|
|
3
|
+
function formState(fiber) {
|
|
4
|
+
let state = formStates.get(fiber);
|
|
5
|
+
if (!state) {
|
|
6
|
+
state = { s: idleFormStatus, l: /* @__PURE__ */ new Set(), g: 0 };
|
|
7
|
+
formStates.set(fiber, state);
|
|
8
|
+
}
|
|
9
|
+
return state;
|
|
10
|
+
}
|
|
11
|
+
function publishForm(state, status) {
|
|
12
|
+
state.s = status;
|
|
13
|
+
for (const listener of state.l)
|
|
14
|
+
listener();
|
|
15
|
+
}
|
|
16
|
+
const hydratedFormStates = /* @__PURE__ */ new WeakMap();
|
|
17
|
+
function actionInitialState(fiber, initial) {
|
|
18
|
+
const root = fiber?.r;
|
|
19
|
+
const state = root?.h ? hydratedFormStates.get(root) : void 0;
|
|
20
|
+
return state && state.consume(fiber) ? state.value : initial;
|
|
21
|
+
}
|
|
22
|
+
export {
|
|
23
|
+
actionInitialState,
|
|
24
|
+
formState,
|
|
25
|
+
formStates,
|
|
26
|
+
hydratedFormStates,
|
|
27
|
+
idleFormStatus,
|
|
28
|
+
publishForm
|
|
29
|
+
};
|
|
30
|
+
//# sourceMappingURL=form-state.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/react/form-state.ts"],
|
|
4
|
+
"sourcesContent": ["import type { Fiber, FiberRoot } from '../core'\nexport type FormStatus = {\n pending: false\n data: null\n method: null\n action: null\n} | {\n pending: true\n data: FormData\n method: string\n action: (data: FormData) => unknown\n}\nexport const idleFormStatus: FormStatus = { pending: false, data: null, method: null, action: null }\nexport interface FormState {\n s: FormStatus\n l: Set<() => void>\n g: number\n}\nexport const formStates = new WeakMap<Fiber, FormState>()\nexport function formState(fiber: Fiber): FormState {\n let state = formStates.get(fiber)\n if (!state) { state = { s: idleFormStatus, l: new Set(), g: 0 }; formStates.set(fiber, state) }\n return state\n}\nexport function publishForm(state: FormState, status: FormStatus): void {\n state.s = status\n for (const listener of state.l) listener()\n}\n\nexport const hydratedFormStates = new WeakMap<FiberRoot, { value: unknown; consume: (fiber: Fiber) => boolean }>()\nexport function actionInitialState<T>(fiber: Fiber | null, initial: T): T {\n const root = fiber?.r\n const state = root?.h ? hydratedFormStates.get(root) : undefined\n return state && state.consume(fiber!) ? state.value as T : initial\n}\n"],
|
|
5
|
+
"mappings": "AAYO,MAAM,iBAA6B,EAAE,SAAS,OAAO,MAAM,MAAM,QAAQ,MAAM,QAAQ,KAAI;AAM3F,MAAM,aAAa,oBAAI,QAAO;AAC/B,SAAU,UAAU,OAAY;AACpC,MAAI,QAAQ,WAAW,IAAI,KAAK;AAChC,MAAI,CAAC,OAAO;AAAE,YAAQ,EAAE,GAAG,gBAAgB,GAAG,oBAAI,IAAG,GAAI,GAAG,EAAC;AAAI,eAAW,IAAI,OAAO,KAAK;EAAE;AAC9F,SAAO;AACT;AACM,SAAU,YAAY,OAAkB,QAAkB;AAC9D,QAAM,IAAI;AACV,aAAW,YAAY,MAAM;AAAG,aAAQ;AAC1C;AAEO,MAAM,qBAAqB,oBAAI,QAAO;AACvC,SAAU,mBAAsB,OAAqB,SAAU;AACnE,QAAM,OAAO,OAAO;AACpB,QAAM,QAAQ,MAAM,IAAI,mBAAmB,IAAI,IAAI,IAAI;AACvD,SAAO,SAAS,MAAM,QAAQ,KAAM,IAAI,MAAM,QAAa;AAC7D;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import type { Dispatch, SetStateAction, EffectCallback, DependencyList } from "../core/index.js";
|
|
2
|
+
import type { Context } from "./context.js";
|
|
3
|
+
import type { BrowserToken } from "../core/browser.js";
|
|
4
|
+
export declare function useState<S>(initial: S | (() => S)): [
|
|
5
|
+
S,
|
|
6
|
+
Dispatch<SetStateAction<S>>
|
|
7
|
+
];
|
|
8
|
+
export declare function useState<S = undefined>(): [
|
|
9
|
+
S | undefined,
|
|
10
|
+
Dispatch<SetStateAction<S | undefined>>
|
|
11
|
+
];
|
|
12
|
+
export declare function useReducer<S, A>(reducer: (s: S, a: A) => S, initial: any, init?: (a: any) => S): [
|
|
13
|
+
S,
|
|
14
|
+
Dispatch<A>
|
|
15
|
+
];
|
|
16
|
+
export declare function useEffect(create: EffectCallback, deps?: DependencyList): void;
|
|
17
|
+
export declare function useLayoutEffect(create: EffectCallback, deps?: DependencyList): void;
|
|
18
|
+
export declare function useInsertionEffect(create: EffectCallback, deps?: DependencyList): void;
|
|
19
|
+
export declare function useRef<T>(initial: T): {
|
|
20
|
+
current: T;
|
|
21
|
+
};
|
|
22
|
+
export declare function useRef<T>(initial: T | null): {
|
|
23
|
+
current: T | null;
|
|
24
|
+
};
|
|
25
|
+
export declare function useRef<T = undefined>(): {
|
|
26
|
+
current: T | undefined;
|
|
27
|
+
};
|
|
28
|
+
export declare function useMemo<T>(factory: () => T, deps?: DependencyList): T;
|
|
29
|
+
export declare function useCallback<T extends Function>(fn: T, deps?: DependencyList): T;
|
|
30
|
+
export declare function useContext<T>(ctx: Context<T>): T;
|
|
31
|
+
export declare function useImperativeHandle<T>(ref: any, factory: () => T, deps?: DependencyList): void;
|
|
32
|
+
export declare function useDebugValue<T>(value: T, formatter?: (v: T) => any): void;
|
|
33
|
+
export declare function useId(): string;
|
|
34
|
+
export declare function useTransition(): [
|
|
35
|
+
boolean,
|
|
36
|
+
(fn: () => void) => void
|
|
37
|
+
];
|
|
38
|
+
export declare function useDeferredValue<T>(v: T): T;
|
|
39
|
+
export declare function useSyncExternalStore<T>(subscribe: (cb: () => void) => () => void, getSnapshot: () => T, getServerSnapshot?: () => T): T;
|
|
40
|
+
export declare function use(resource: BrowserToken): undefined;
|
|
41
|
+
export declare function use<T>(resource: PromiseLike<T> | {
|
|
42
|
+
_currentValue: T;
|
|
43
|
+
} | {
|
|
44
|
+
$$typeof: symbol;
|
|
45
|
+
_currentValue: T;
|
|
46
|
+
}): T;
|
|
47
|
+
export declare function unstable_useCacheRefresh(): () => void;
|
|
48
|
+
export declare function transitionScope<T>(fn: () => T): T;
|
|
49
|
+
export declare function reportActionError(error: unknown): void;
|
|
50
|
+
export declare function startTransition(fn: () => void): void;
|
|
51
|
+
export declare function useActionState<S>(action: (state: Awaited<S>) => S | Promise<S>, initial: Awaited<S>, permalink?: string): [
|
|
52
|
+
Awaited<S>,
|
|
53
|
+
() => void,
|
|
54
|
+
boolean
|
|
55
|
+
];
|
|
56
|
+
export declare function useActionState<S, P>(action: (state: Awaited<S>, payload: P) => S | Promise<S>, initial: Awaited<S>, permalink?: string): [
|
|
57
|
+
Awaited<S>,
|
|
58
|
+
(payload: P) => void,
|
|
59
|
+
boolean
|
|
60
|
+
];
|
|
61
|
+
export declare function useFormStatus(): any;
|
|
62
|
+
export declare function useOptimistic<S, A = S>(state: S, updateFn?: (s: S, a: A) => S): [
|
|
63
|
+
S,
|
|
64
|
+
(action: A) => void
|
|
65
|
+
];
|
|
66
|
+
export declare function useEffectEvent<Args extends unknown[], Return>(fn: (...args: Args) => Return): (...args: Args) => Return;
|
|
67
|
+
export declare function useSyncExternalStoreWithSelector<Snapshot, Selection>(subscribe: (cb: () => void) => () => void, getSnapshot: () => Snapshot, getServerSnapshot: (() => Snapshot) | undefined, selector: (snapshot: Snapshot) => Selection, isEqual?: (a: Selection, b: Selection) => boolean): Selection;
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
import { isThenable, isFunction } from "../core/functions.js";
|
|
2
|
+
import { getDispatcher, ReactSharedInternals } from "./shared-internals.js";
|
|
3
|
+
function useState(initial) {
|
|
4
|
+
return getDispatcher().useState(initial);
|
|
5
|
+
}
|
|
6
|
+
function useReducer(reducer, initial, init) {
|
|
7
|
+
return getDispatcher().useReducer(reducer, initial, init);
|
|
8
|
+
}
|
|
9
|
+
function useEffect(create, deps) {
|
|
10
|
+
getDispatcher().useEffect(create, deps);
|
|
11
|
+
}
|
|
12
|
+
function useLayoutEffect(create, deps) {
|
|
13
|
+
getDispatcher().useLayoutEffect(create, deps);
|
|
14
|
+
}
|
|
15
|
+
function useInsertionEffect(create, deps) {
|
|
16
|
+
getDispatcher().useInsertionEffect(create, deps);
|
|
17
|
+
}
|
|
18
|
+
function useRef(initial) {
|
|
19
|
+
return getDispatcher().useRef(initial);
|
|
20
|
+
}
|
|
21
|
+
function useMemo(factory, deps) {
|
|
22
|
+
return getDispatcher().useMemo(factory, deps);
|
|
23
|
+
}
|
|
24
|
+
function useCallback(fn, deps) {
|
|
25
|
+
return getDispatcher().useCallback(fn, deps);
|
|
26
|
+
}
|
|
27
|
+
function useContext(ctx) {
|
|
28
|
+
return getDispatcher().useContext(ctx);
|
|
29
|
+
}
|
|
30
|
+
function useImperativeHandle(ref, factory, deps) {
|
|
31
|
+
getDispatcher().useImperativeHandle(ref, factory, deps);
|
|
32
|
+
}
|
|
33
|
+
function useDebugValue(value, formatter) {
|
|
34
|
+
getDispatcher().useDebugValue(value, formatter);
|
|
35
|
+
}
|
|
36
|
+
function useId() {
|
|
37
|
+
return getDispatcher().useId();
|
|
38
|
+
}
|
|
39
|
+
function useTransition() {
|
|
40
|
+
return getDispatcher().useTransition();
|
|
41
|
+
}
|
|
42
|
+
function useDeferredValue(v) {
|
|
43
|
+
return getDispatcher().useDeferredValue(v);
|
|
44
|
+
}
|
|
45
|
+
function useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot) {
|
|
46
|
+
return getDispatcher().useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);
|
|
47
|
+
}
|
|
48
|
+
function use(resource) {
|
|
49
|
+
return getDispatcher().use(resource);
|
|
50
|
+
}
|
|
51
|
+
function unstable_useCacheRefresh() {
|
|
52
|
+
return getDispatcher().useCacheRefresh();
|
|
53
|
+
}
|
|
54
|
+
function transitionScope(fn) {
|
|
55
|
+
const previous = ReactSharedInternals.T;
|
|
56
|
+
ReactSharedInternals.T = previous || /* @__PURE__ */ new Set();
|
|
57
|
+
try {
|
|
58
|
+
return fn();
|
|
59
|
+
} finally {
|
|
60
|
+
ReactSharedInternals.T = previous;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
function reportActionError(error) {
|
|
64
|
+
if (isFunction(globalThis.reportError))
|
|
65
|
+
globalThis.reportError(error);
|
|
66
|
+
else
|
|
67
|
+
setTimeout(() => {
|
|
68
|
+
throw error;
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
function startTransition(fn) {
|
|
72
|
+
try {
|
|
73
|
+
const result = transitionScope(() => ReactSharedInternals.X ? ReactSharedInternals.X(fn) : fn());
|
|
74
|
+
if (isThenable(result))
|
|
75
|
+
result.then(void 0, reportActionError);
|
|
76
|
+
} catch (error) {
|
|
77
|
+
reportActionError(error);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
function useActionState(action, initial, _permalink) {
|
|
81
|
+
return getDispatcher().useActionState(action, initial, _permalink);
|
|
82
|
+
}
|
|
83
|
+
function useFormStatus() {
|
|
84
|
+
if (process.env.NODE_ENV !== "production") {
|
|
85
|
+
const debug = ReactSharedInternals.H?.useHostTransitionStatus;
|
|
86
|
+
if (debug)
|
|
87
|
+
return debug();
|
|
88
|
+
}
|
|
89
|
+
return getDispatcher().useFormStatus();
|
|
90
|
+
}
|
|
91
|
+
function useOptimistic(state, updateFn) {
|
|
92
|
+
return getDispatcher().useOptimistic(state, updateFn);
|
|
93
|
+
}
|
|
94
|
+
function useEffectEvent(fn) {
|
|
95
|
+
if (process.env.NODE_ENV !== "production") {
|
|
96
|
+
const debug = ReactSharedInternals.H?.useEffectEvent;
|
|
97
|
+
if (debug)
|
|
98
|
+
return debug(fn);
|
|
99
|
+
}
|
|
100
|
+
const ref = useRef(fn);
|
|
101
|
+
useInsertionEffect(() => {
|
|
102
|
+
ref.current = fn;
|
|
103
|
+
});
|
|
104
|
+
return useCallback(((...args) => ref.current(...args)), []);
|
|
105
|
+
}
|
|
106
|
+
function useSyncExternalStoreWithSelector(subscribe, getSnapshot, getServerSnapshot, selector, isEqual) {
|
|
107
|
+
const committed = useRef(null);
|
|
108
|
+
const [getSelection, getServerSelection] = useMemo(() => {
|
|
109
|
+
let ready = false;
|
|
110
|
+
let snapshot;
|
|
111
|
+
let selection;
|
|
112
|
+
const select = (next) => {
|
|
113
|
+
if (ready && Object.is(snapshot, next))
|
|
114
|
+
return selection;
|
|
115
|
+
let value2 = selector(next);
|
|
116
|
+
if ((ready || committed.current) && isEqual?.(ready ? selection : committed.current.value, value2)) {
|
|
117
|
+
value2 = ready ? selection : committed.current.value;
|
|
118
|
+
}
|
|
119
|
+
ready = true;
|
|
120
|
+
snapshot = next;
|
|
121
|
+
return selection = value2;
|
|
122
|
+
};
|
|
123
|
+
return [
|
|
124
|
+
() => select(getSnapshot()),
|
|
125
|
+
getServerSnapshot && (() => select(getServerSnapshot()))
|
|
126
|
+
];
|
|
127
|
+
}, [getSnapshot, getServerSnapshot, selector, isEqual]);
|
|
128
|
+
const value = useSyncExternalStore(subscribe, getSelection, getServerSelection);
|
|
129
|
+
useDebugValue(value);
|
|
130
|
+
useLayoutEffect(() => {
|
|
131
|
+
if (committed.current)
|
|
132
|
+
committed.current.value = value;
|
|
133
|
+
else
|
|
134
|
+
committed.current = { value };
|
|
135
|
+
}, [value]);
|
|
136
|
+
return value;
|
|
137
|
+
}
|
|
138
|
+
export {
|
|
139
|
+
reportActionError,
|
|
140
|
+
startTransition,
|
|
141
|
+
transitionScope,
|
|
142
|
+
unstable_useCacheRefresh,
|
|
143
|
+
use,
|
|
144
|
+
useActionState,
|
|
145
|
+
useCallback,
|
|
146
|
+
useContext,
|
|
147
|
+
useDebugValue,
|
|
148
|
+
useDeferredValue,
|
|
149
|
+
useEffect,
|
|
150
|
+
useEffectEvent,
|
|
151
|
+
useFormStatus,
|
|
152
|
+
useId,
|
|
153
|
+
useImperativeHandle,
|
|
154
|
+
useInsertionEffect,
|
|
155
|
+
useLayoutEffect,
|
|
156
|
+
useMemo,
|
|
157
|
+
useOptimistic,
|
|
158
|
+
useReducer,
|
|
159
|
+
useRef,
|
|
160
|
+
useState,
|
|
161
|
+
useSyncExternalStore,
|
|
162
|
+
useSyncExternalStoreWithSelector,
|
|
163
|
+
useTransition
|
|
164
|
+
};
|
|
165
|
+
//# sourceMappingURL=hooks.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/react/hooks.ts"],
|
|
4
|
+
"sourcesContent": ["import { isThenable, isFunction } from '../core/functions'\nimport type {\n Dispatch,\n SetStateAction,\n EffectCallback,\n DependencyList,\n} from '../core'\nimport type { Context } from './context'\nimport { getDispatcher, ReactSharedInternals } from './shared-internals'\n\nimport type { BrowserToken } from '../core/browser'\n\nexport function useState<S>(initial: S | (() => S)): [S, Dispatch<SetStateAction<S>>]\nexport function useState<S = undefined>(): [S | undefined, Dispatch<SetStateAction<S | undefined>>]\nexport function useState<S>(initial?: S | (() => S)): [S | undefined, Dispatch<SetStateAction<S | undefined>>] {\n return getDispatcher().useState(initial)\n}\n\nexport function useReducer<S, A>(\n reducer: (s: S, a: A) => S,\n initial: any,\n init?: (a: any) => S,\n): [S, Dispatch<A>] {\n return getDispatcher().useReducer(reducer, initial, init)\n}\n\nexport function useEffect(create: EffectCallback, deps?: DependencyList): void {\n getDispatcher().useEffect(create, deps)\n}\n\nexport function useLayoutEffect(create: EffectCallback, deps?: DependencyList): void {\n getDispatcher().useLayoutEffect(create, deps)\n}\n\nexport function useInsertionEffect(create: EffectCallback, deps?: DependencyList): void {\n getDispatcher().useInsertionEffect(create, deps)\n}\n\nexport function useRef<T>(initial: T): { current: T }\nexport function useRef<T>(initial: T | null): { current: T | null }\nexport function useRef<T = undefined>(): { current: T | undefined }\nexport function useRef(initial?: any): { current: any } {\n return getDispatcher().useRef(initial)\n}\n\nexport function useMemo<T>(factory: () => T, deps?: DependencyList): T {\n return getDispatcher().useMemo(factory, deps)\n}\n\nexport function useCallback<T extends Function>(fn: T, deps?: DependencyList): T {\n return getDispatcher().useCallback(fn, deps)\n}\n\nexport function useContext<T>(ctx: Context<T>): T {\n return getDispatcher().useContext(ctx)\n}\n\nexport function useImperativeHandle<T>(\n ref: any,\n factory: () => T,\n deps?: DependencyList,\n): void {\n getDispatcher().useImperativeHandle(ref, factory, deps)\n}\n\nexport function useDebugValue<T>(value: T, formatter?: (v: T) => any): void {\n getDispatcher().useDebugValue(value, formatter)\n}\n\nexport function useId(): string {\n return getDispatcher().useId()\n}\n\nexport function useTransition(): [boolean, (fn: () => void) => void] {\n return getDispatcher().useTransition()\n}\n\nexport function useDeferredValue<T>(v: T): T {\n return getDispatcher().useDeferredValue(v)\n}\n\nexport function useSyncExternalStore<T>(\n subscribe: (cb: () => void) => () => void,\n getSnapshot: () => T,\n getServerSnapshot?: () => T,\n): T {\n return getDispatcher().useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot)\n}\n\nexport function use(resource: BrowserToken): undefined\nexport function use<T>(resource: PromiseLike<T> | { _currentValue: T } | { $$typeof: symbol; _currentValue: T }): T\nexport function use<T>(resource: BrowserToken | PromiseLike<T> | { _currentValue: T } | { $$typeof: symbol; _currentValue: T }): T {\n return getDispatcher().use(resource)\n}\n\nexport function unstable_useCacheRefresh(): () => void {\n return getDispatcher().useCacheRefresh()\n}\n\nexport function transitionScope<T>(fn: () => T): T {\n const previous = ReactSharedInternals.T\n ReactSharedInternals.T = previous || new Set()\n try { return fn() } finally { ReactSharedInternals.T = previous }\n}\n\nexport function reportActionError(error: unknown): void {\n if (isFunction(globalThis.reportError)) globalThis.reportError(error)\n else setTimeout(() => { throw error })\n}\n\nexport function startTransition(fn: () => void): void {\n try {\n const result = transitionScope(() => ReactSharedInternals.X ? ReactSharedInternals.X(fn) : fn())\n if (isThenable(result)) result.then(undefined, reportActionError)\n } catch (error) { reportActionError(error) }\n}\n\nexport function useActionState<S>(\n action: (state: Awaited<S>) => S | Promise<S>,\n initial: Awaited<S>,\n permalink?: string,\n): [Awaited<S>, () => void, boolean]\nexport function useActionState<S, P>(\n action: (state: Awaited<S>, payload: P) => S | Promise<S>,\n initial: Awaited<S>,\n permalink?: string,\n): [Awaited<S>, (payload: P) => void, boolean]\nexport function useActionState<S, P>(\n action: (state: Awaited<S>, payload: P) => S | Promise<S>,\n initial: Awaited<S>,\n _permalink?: string,\n): [Awaited<S>, (payload: P) => void, boolean] {\n return getDispatcher().useActionState(action, initial, _permalink)\n}\n\nexport function useFormStatus() {\n if (process.env.NODE_ENV !== 'production') {\n const debug = (ReactSharedInternals.H as any)?.useHostTransitionStatus\n if (debug) return debug()\n }\n return getDispatcher().useFormStatus()\n}\n\nexport function useOptimistic<S, A = S>(\n state: S,\n updateFn?: (s: S, a: A) => S,\n): [S, (action: A) => void] {\n return getDispatcher().useOptimistic(state, updateFn)\n}\n\n// Composed hook — returns a stable callback that always invokes the latest\n// `fn`. The ref is updated in useInsertionEffect so any useLayoutEffect /\n// useEffect reading ref.current in the next commit sees the fresh function.\nexport function useEffectEvent<Args extends unknown[], Return>(\n fn: (...args: Args) => Return,\n): (...args: Args) => Return {\n if (process.env.NODE_ENV !== 'production') {\n const debug = (ReactSharedInternals.H as any)?.useEffectEvent\n if (debug) return debug(fn)\n }\n const ref = useRef(fn)\n useInsertionEffect(() => {\n ref.current = fn\n })\n return useCallback(\n ((...args: Args) => ref.current(...args)) as (...args: Args) => Return,\n [],\n )\n}\n\n// `useSyncExternalStoreWithSelector` — provided here so consumers (like\n// @tanstack/react-store) that historically import from\n// `use-sync-external-store/shim/with-selector` can be aliased to this\n// package via the @tanstack/redact/vite plugin. The CJS shim is unsuitable\n// for Cloudflare Workers (it does `var React = require('react')` which\n// fails in workerd). Implementation matches React's reference impl —\n// selector + isEqual gate to avoid re-renders when the selected slice is\n// unchanged across snapshots.\nexport function useSyncExternalStoreWithSelector<Snapshot, Selection>(\n subscribe: (cb: () => void) => () => void,\n getSnapshot: () => Snapshot,\n getServerSnapshot: (() => Snapshot) | undefined,\n selector: (snapshot: Snapshot) => Selection,\n isEqual?: (a: Selection, b: Selection) => boolean,\n): Selection {\n const committed = useRef<{ value: Selection } | null>(null)\n const [getSelection, getServerSelection] = useMemo(() => {\n let ready = false\n let snapshot: Snapshot\n let selection: Selection\n const select = (next: Snapshot): Selection => {\n if (ready && Object.is(snapshot, next)) return selection\n let value = selector(next)\n if ((ready || committed.current) && isEqual?.(ready ? selection : committed.current!.value, value)) {\n value = ready ? selection : committed.current!.value\n }\n ready = true\n snapshot = next\n return selection = value\n }\n return [\n () => select(getSnapshot()),\n getServerSnapshot && (() => select(getServerSnapshot())),\n ] as const\n }, [getSnapshot, getServerSnapshot, selector, isEqual])\n\n const value = useSyncExternalStore(subscribe, getSelection, getServerSelection)\n useDebugValue(value)\n useLayoutEffect(() => {\n if (committed.current) committed.current.value = value\n else committed.current = { value }\n }, [value])\n return value\n}\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,YAAY,kBAAkB;AAQvC,SAAS,eAAe,4BAA4B;AAM9C,SAAU,SAAY,SAAuB;AACjD,SAAO,cAAa,EAAG,SAAS,OAAO;AACzC;AAEM,SAAU,WACd,SACA,SACA,MAAoB;AAEpB,SAAO,cAAa,EAAG,WAAW,SAAS,SAAS,IAAI;AAC1D;AAEM,SAAU,UAAU,QAAwB,MAAqB;AACrE,gBAAa,EAAG,UAAU,QAAQ,IAAI;AACxC;AAEM,SAAU,gBAAgB,QAAwB,MAAqB;AAC3E,gBAAa,EAAG,gBAAgB,QAAQ,IAAI;AAC9C;AAEM,SAAU,mBAAmB,QAAwB,MAAqB;AAC9E,gBAAa,EAAG,mBAAmB,QAAQ,IAAI;AACjD;AAKM,SAAU,OAAO,SAAa;AAClC,SAAO,cAAa,EAAG,OAAO,OAAO;AACvC;AAEM,SAAU,QAAW,SAAkB,MAAqB;AAChE,SAAO,cAAa,EAAG,QAAQ,SAAS,IAAI;AAC9C;AAEM,SAAU,YAAgC,IAAO,MAAqB;AAC1E,SAAO,cAAa,EAAG,YAAY,IAAI,IAAI;AAC7C;AAEM,SAAU,WAAc,KAAe;AAC3C,SAAO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