@warp-drive/react 5.9.1 → 5.10.0-alpha.0
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/dist/unpkg/dev/index.js +1 -1
- package/dist/unpkg/dev/install.js +1 -1
- package/dist/unpkg/dev/{reactive-context-Ax2U-96G.js → reactive-context-DE-yJ0t6.js} +2 -2
- package/dist/unpkg/dev/{reactive-context-Ax2U-96G.js.map → reactive-context-DE-yJ0t6.js.map} +1 -1
- package/dist/unpkg/dev-deprecated/index.js +1 -1
- package/dist/unpkg/dev-deprecated/install.js +1 -1
- package/dist/unpkg/dev-deprecated/{reactive-context-B-pn7tS7.js → reactive-context-Bz6GBd64.js} +2 -2
- package/dist/unpkg/dev-deprecated/{reactive-context-B-pn7tS7.js.map → reactive-context-Bz6GBd64.js.map} +1 -1
- package/package.json +5 -5
package/dist/unpkg/dev/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as WatcherContext, t as ReactiveContext } from "./reactive-context-
|
|
1
|
+
import { n as WatcherContext, t as ReactiveContext } from "./reactive-context-DE-yJ0t6.js";
|
|
2
2
|
import { createContext, use, useEffect, useMemo, useRef } from "react";
|
|
3
3
|
import { Fragment, jsxDEV } from "react/jsx-dev-runtime";
|
|
4
4
|
import { createRequestSubscription } from "@warp-drive/core/reactive";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as WatcherContext, r as getGlobalConfig } from "./reactive-context-
|
|
1
|
+
import { n as WatcherContext, r as getGlobalConfig } from "./reactive-context-DE-yJ0t6.js";
|
|
2
2
|
import { use } from "react";
|
|
3
3
|
import { Signal } from "signal-polyfill";
|
|
4
4
|
import { setupSignals } from "@warp-drive/core/configure";
|
|
@@ -60,7 +60,7 @@ function initializeRuntimeMacrosConfig() {
|
|
|
60
60
|
"features": {
|
|
61
61
|
"ENFORCE_STRICT_RESOURCE_FINALIZATION": false,
|
|
62
62
|
"JSON_API_CACHE_VALIDATION_ERRORS": false,
|
|
63
|
-
"SAMPLE_FEATURE_FLAG":
|
|
63
|
+
"SAMPLE_FEATURE_FLAG": null
|
|
64
64
|
},
|
|
65
65
|
"activeLogging": {
|
|
66
66
|
"DEBUG_RELATIONSHIP_NOTIFICATIONS": true,
|
|
@@ -215,4 +215,4 @@ function ReactiveContext({ children }) {
|
|
|
215
215
|
|
|
216
216
|
//#endregion
|
|
217
217
|
export { WatcherContext as n, getGlobalConfig as r, ReactiveContext as t };
|
|
218
|
-
//# sourceMappingURL=reactive-context-
|
|
218
|
+
//# sourceMappingURL=reactive-context-DE-yJ0t6.js.map
|
package/dist/unpkg/dev/{reactive-context-Ax2U-96G.js.map → reactive-context-DE-yJ0t6.js.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reactive-context-Ax2U-96G.js","names":["each","array","Array","isArray","Error","macroCondition","predicate","config","packageRoot","runtimeConfig","packages","getGlobalConfig","global","isTesting","g","e","Boolean","setTesting","globalThis","__embroider_macros__runtime_config__","localConfig","initializeRuntimeMacrosConfig","Object","assign","updaterMethods","setConfig","value","setGlobalConfig","key","updaters","window","_embroider_macros_runtime_config","undefined","methods","updater","createContext","useSyncExternalStore","useMemo","Signal","getGlobalConfig","getGlobalConfig0","jsxDEV","_jsxDEV","nextFlush","watchers","watcherId","clearWatcher","state","watcher","unwatch","subtle","introspectSources","flush","pending","destroyed","WarpDrive","debug","LOG_REACT_SIGNAL_INTEGRATION","globalThis","getWarpDriveRuntimeConfig","console","log","snapshot","Set","getPending","notifyReact","watch","_createWatcher","id","Watcher","args","push","Promise","resolve","queueMicrotask","forEach","map","w","useWatcher","notifyChanged","WatcherContext","ReactiveContext","children","value","fileName","_jsxFileName","lineNumber","columnNumber"],"sources":["../../../../../node_modules/.pnpm/@embroider+macros@1.20.6/node_modules/@embroider/macros/src/addon/runtime.js","../../../src/-private/reactive-context.tsx"],"sourcesContent":["/*\n These are the runtime implementations for the javascript macros that have\n runtime implementations.\n\n Not every macro has a runtime implementation, some only make sense in the\n build and always run there.\n\n Even when we have runtime implementations, we are still careful to emit static\n errors during the build wherever possible, and runtime errors when necessary,\n so that you're not surprised when you switch from runtime-mode to compile-time\n mode.\n*/\n\n/*\n CAUTION: in classic builds, this file gets shared by all present copies of\n @embroider/macros. If you want to change its public API, you need to rename it\n and update `pathToRuntime` in ../babel/state.ts to point at it, so that your\n babel plugin and runtime will match.\n*/\n\nexport function each(array) {\n if (!Array.isArray(array)) {\n throw new Error(`the argument to the each() macro must be an array`);\n }\n return array;\n}\n\nexport function macroCondition(predicate) {\n return predicate;\n}\n\n// This is here as a compile target for `getConfig` and `getOwnConfig` when\n// we're in runtime mode. This is not public API to call from your own code.\nexport function config(packageRoot) {\n return runtimeConfig.packages[packageRoot];\n}\n\nexport function getGlobalConfig() {\n return runtimeConfig.global;\n}\n\nexport function isTesting() {\n let g = runtimeConfig.global;\n let e = g && g['@embroider/macros'];\n return Boolean(e && e.isTesting);\n}\n\nexport function setTesting(isTesting) {\n if (!runtimeConfig.global) {\n runtimeConfig.global = {};\n }\n if (!runtimeConfig.global['@embroider/macros']) {\n runtimeConfig.global['@embroider/macros'] = {};\n }\n runtimeConfig.global['@embroider/macros'].isTesting = Boolean(isTesting);\n}\n\n// Welcome intrepid developer!\n//\n// While this data is \"global\", this is a private variable.\n//\n// do not build features based off of its contents,\n// or assume it will have the same name in future releases.\nconst runtimeConfig = globalThis.__embroider_macros__runtime_config__ ||= {};\n\nruntimeConfig.packages ||= {};\nruntimeConfig.global ||= {};\n\n// In the off chance there are duplicate copies of @embroider/macros in the dep graph\n// (due to the package manager messing up)\n// Let's try to merge them together via the above global well known variable\nconst localConfig = initializeRuntimeMacrosConfig();\n\nObject.assign(runtimeConfig.packages, localConfig.packages);\nObject.assign(runtimeConfig.global, localConfig.global);\n\n// this exists to be targeted by our babel plugin\nfunction initializeRuntimeMacrosConfig() {\n return { packages: {}, global: {} };\n}\n\nfunction updaterMethods() {\n return {\n config,\n getGlobalConfig,\n setConfig(packageRoot, value) {\n runtimeConfig.packages[packageRoot] = value;\n },\n setGlobalConfig(key, value) {\n runtimeConfig.global[key] = value;\n },\n };\n}\n\n// this is how runtime config can get injected at boot. I'm not sure yet if this\n// should be public API, but we certainly need it internally to set things like\n// the global fastboot.isRunning.\n//\n// consumers of this API push a function onto\n// window._embroider_macros_runtime_config. The function is given four methods\n// which allow it to read and write the per-package and global configs. The\n// reason for allowing both read & write is that merging strategies are up to\n// each consumers -- read first, then merge, then write.\n//\n// For an example user of this API, see where we generate\n// embroider_macros_fastboot_init.js' in @embroider/core.\nlet updaters = typeof window !== 'undefined' ? window._embroider_macros_runtime_config : undefined;\nif (updaters) {\n let methods = updaterMethods();\n for (let updater of updaters) {\n updater(methods);\n }\n}\n","import { createContext, type JSX, type ReactNode, useSyncExternalStore, type Context, useMemo } from \"react\";\nimport { Signal } from \"signal-polyfill\";\n\nimport { LOG_REACT_SIGNAL_INTEGRATION } from \"@warp-drive/core/build-config/debugging\";\n\nlet nextFlush: Promise<void> | null = null;\nlet watchers: WatcherState[] = [];\nlet watcherId = 0;\n\ninterface WatcherState {\n watcherId: number;\n pending: boolean;\n destroyed: boolean;\n notifyReact: (() => void) | null;\n watcher: Signal.subtle.Watcher;\n\n // the extra wrapper returned here ensures that the context value for the watcher\n // changes causing a re-render when the watcher is updated.\n snapshot: { watcher: Signal.subtle.Watcher } | null;\n}\n\nfunction clearWatcher(state: WatcherState) {\n state.watcher.unwatch(...Signal.subtle.introspectSources(state.watcher));\n}\n\nfunction flush(state: WatcherState) {\n state.pending = false;\n if (state.destroyed) {\n if (LOG_REACT_SIGNAL_INTEGRATION) {\n // eslint-disable-next-line no-console\n console.log(`[WarpDrive] Detected Watcher Destroyed During Notify Flush, clearing signals`);\n }\n state.snapshot = null;\n clearWatcher(state);\n return;\n }\n\n if (LOG_REACT_SIGNAL_INTEGRATION) {\n /* eslint-disable no-console */\n console.log(`[WarpDrive] Notifying React That WatcherContext:${state.watcherId} Has Updated`);\n console.log(\"all signals\", new Set(Signal.subtle.introspectSources(state.watcher)));\n console.log(\"dirty signals\", new Set(state.watcher.getPending()));\n /* eslint-enable no-console */\n }\n\n // any time signals have changed, we notify React that our store has updated\n state.snapshot = { watcher: state.watcher };\n if (state.notifyReact) state.notifyReact();\n\n // tell the Watcher to start watching for changes again\n // by signaling that notifications have been flushed.\n state.watcher.watch();\n}\n\nfunction _createWatcher() {\n const id = watcherId++;\n if (LOG_REACT_SIGNAL_INTEGRATION) {\n // eslint-disable-next-line no-console\n console.log(`[WarpDrive] Creating a WatcherContext:${id}`);\n }\n const state: WatcherState = {\n watcherId: id,\n pending: false,\n destroyed: false,\n notifyReact: null as (() => void) | null,\n watcher: null as unknown as Signal.subtle.Watcher,\n\n // the extra wrapper returned here ensures that the context value for the watcher\n // changes causing a re-render when the watcher is updated.\n snapshot: null as { watcher: Signal.subtle.Watcher } | null,\n };\n\n state.watcher = new Signal.subtle.Watcher((...args) => {\n if (LOG_REACT_SIGNAL_INTEGRATION) {\n // eslint-disable-next-line no-console\n console.log(`watcher ${state.watcherId} notified`, args, state.watcher);\n }\n if (!state.pending && !state.destroyed) {\n watchers.push(state);\n state.pending = true;\n\n if (!nextFlush) {\n nextFlush = new Promise((resolve) => {\n queueMicrotask(() => {\n queueMicrotask(() => {\n queueMicrotask(() => {\n watchers.forEach(flush);\n if (LOG_REACT_SIGNAL_INTEGRATION) {\n // eslint-disable-next-line no-console\n console.log(\n \"Flushed watcher:\",\n watchers.map((w) => w.watcherId)\n );\n }\n watchers = [];\n nextFlush = null;\n\n resolve();\n });\n });\n });\n });\n }\n } else if (state.destroyed) {\n if (LOG_REACT_SIGNAL_INTEGRATION) {\n // eslint-disable-next-line no-console\n console.log(`[WarpDrive] Detected Watcher Destroyed During Notify, clearing signals`);\n }\n // if we are destroyed, we clear the watcher signals\n // so that it does not continue to watch for changes.\n state.snapshot = null;\n clearWatcher(state);\n }\n });\n\n // The watcher won't begin watching until we call `watcher.watch()`\n state.watcher.watch();\n state.snapshot = { watcher: state.watcher };\n\n return state;\n}\n\nexport function useWatcher(): { watcher: Signal.subtle.Watcher } | null {\n const state = useMemo(_createWatcher, []);\n\n return useSyncExternalStore(\n (notifyChanged: () => void) => {\n if (LOG_REACT_SIGNAL_INTEGRATION) {\n // eslint-disable-next-line no-console\n console.log(`[WarpDrive] Subscribing to Watcher`);\n }\n state.destroyed = false;\n state.notifyReact = notifyChanged;\n\n // The watcher won't begin watching until we call `watcher.watch()`\n state.watcher.watch();\n\n return () => {\n if (LOG_REACT_SIGNAL_INTEGRATION) {\n // eslint-disable-next-line no-console\n console.log(`[WarpDrive] Deactivating Watcher Subscription`);\n }\n state.destroyed = true;\n state.notifyReact = null;\n };\n },\n () => state.snapshot\n );\n}\n\n/**\n * @category Contexts\n */\nexport const WatcherContext: Context<{\n /**\n * The `Signal.subtle.Watcher` used to observe signal changes for the nearest {@link ReactiveContext}.\n */\n watcher: Signal.subtle.Watcher;\n} | null> = createContext<{\n watcher: Signal.subtle.Watcher;\n} | null>(null);\n\n/**\n *\n * @category Components\n */\nexport function ReactiveContext({ children }: { children: ReactNode }): JSX.Element {\n const watcher = useWatcher();\n /**\n * Unlike other frameworks, React does not have a built-in way to provide\n * a context value other than by rendering an extra component.\n *\n */\n return <WatcherContext value={watcher}>{children}</WatcherContext>;\n}\n"],"x_google_ignoreList":[0],"mappings":";;;;;AAiCA,SAAgBO,OAAOC,aAAa;CAClC,OAAOC,cAAcC,SAASF;AAChC;AAEA,SAAgBG,kBAAkB;CAChC,OAAOF,cAAcG;AACvB;AAwBA,MAAMH,gBAAgBS,WAAWC,yCAAyC,CAAC;AAE3EV,cAAcC,aAAa,CAAC;AAC5BD,cAAcG,WAAW,CAAC;AAK1B,MAAMQ,cAAcC,8BAA8B;AAElDC,OAAOC,OAAOd,cAAcC,UAAUU,YAAYV,QAAQ;AAC1DY,OAAOC,OAAOd,cAAcG,QAAQQ,YAAYR,MAAM;AAGtD,SAASS,gCAAgC;CAAA,OA7EvC;EA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BAAA,CAAA,CAAAH,MAAAC,8BAG3BG,QAAQC,IAAI,oCAAoC;EAElDd,MAAMO,YAAY;EAClBP,MAAMkB,cAAcc;EAGpBhC,MAAMC,QAAQkB,MAAM;EAEpB,aAAa;GAAA,IAAA1B,gBAAA,CAAA,CAAAe,UAAAC,MAAAC,gCAAAC,WAAAC,0BAAA,CAAA,CAAAH,MAAAC,8BAGTG,QAAQC,IAAI,+CAA+C;GAE7Dd,MAAMO,YAAY;GAClBP,MAAMkB,cAAc;EACtB;CACF,SACMlB,MAAMe,QACd;AACF;;;;AAKA,MAAakB,iBAKD7C,4BAEF,IAAI;;;;;AAMd,SAAgB8C,gBAAgB,EAAEC,YAAkD;CAClF,MAAMlC,UAAU8B,WAAW;;;;;;CAM3B,OAAOpC,qBAACsC,gBAAc;EAACG,OAAOnC;EAAUkC;CAAQ,GAAA,KAAA,GAAA,OAAA;EAAAE,UAAAC;EAAAC,YAAA;EAAAC,cAAA;CAAA,GAAA,IAAiB;AACnE"}
|
|
1
|
+
{"version":3,"file":"reactive-context-DE-yJ0t6.js","names":["each","array","Array","isArray","Error","macroCondition","predicate","config","packageRoot","runtimeConfig","packages","getGlobalConfig","global","isTesting","g","e","Boolean","setTesting","globalThis","__embroider_macros__runtime_config__","localConfig","initializeRuntimeMacrosConfig","Object","assign","updaterMethods","setConfig","value","setGlobalConfig","key","updaters","window","_embroider_macros_runtime_config","undefined","methods","updater","createContext","useSyncExternalStore","useMemo","Signal","getGlobalConfig","getGlobalConfig0","jsxDEV","_jsxDEV","nextFlush","watchers","watcherId","clearWatcher","state","watcher","unwatch","subtle","introspectSources","flush","pending","destroyed","WarpDrive","debug","LOG_REACT_SIGNAL_INTEGRATION","globalThis","getWarpDriveRuntimeConfig","console","log","snapshot","Set","getPending","notifyReact","watch","_createWatcher","id","Watcher","args","push","Promise","resolve","queueMicrotask","forEach","map","w","useWatcher","notifyChanged","WatcherContext","ReactiveContext","children","value","fileName","_jsxFileName","lineNumber","columnNumber"],"sources":["../../../../../node_modules/.pnpm/@embroider+macros@1.20.6/node_modules/@embroider/macros/src/addon/runtime.js","../../../src/-private/reactive-context.tsx"],"sourcesContent":["/*\n These are the runtime implementations for the javascript macros that have\n runtime implementations.\n\n Not every macro has a runtime implementation, some only make sense in the\n build and always run there.\n\n Even when we have runtime implementations, we are still careful to emit static\n errors during the build wherever possible, and runtime errors when necessary,\n so that you're not surprised when you switch from runtime-mode to compile-time\n mode.\n*/\n\n/*\n CAUTION: in classic builds, this file gets shared by all present copies of\n @embroider/macros. If you want to change its public API, you need to rename it\n and update `pathToRuntime` in ../babel/state.ts to point at it, so that your\n babel plugin and runtime will match.\n*/\n\nexport function each(array) {\n if (!Array.isArray(array)) {\n throw new Error(`the argument to the each() macro must be an array`);\n }\n return array;\n}\n\nexport function macroCondition(predicate) {\n return predicate;\n}\n\n// This is here as a compile target for `getConfig` and `getOwnConfig` when\n// we're in runtime mode. This is not public API to call from your own code.\nexport function config(packageRoot) {\n return runtimeConfig.packages[packageRoot];\n}\n\nexport function getGlobalConfig() {\n return runtimeConfig.global;\n}\n\nexport function isTesting() {\n let g = runtimeConfig.global;\n let e = g && g['@embroider/macros'];\n return Boolean(e && e.isTesting);\n}\n\nexport function setTesting(isTesting) {\n if (!runtimeConfig.global) {\n runtimeConfig.global = {};\n }\n if (!runtimeConfig.global['@embroider/macros']) {\n runtimeConfig.global['@embroider/macros'] = {};\n }\n runtimeConfig.global['@embroider/macros'].isTesting = Boolean(isTesting);\n}\n\n// Welcome intrepid developer!\n//\n// While this data is \"global\", this is a private variable.\n//\n// do not build features based off of its contents,\n// or assume it will have the same name in future releases.\nconst runtimeConfig = globalThis.__embroider_macros__runtime_config__ ||= {};\n\nruntimeConfig.packages ||= {};\nruntimeConfig.global ||= {};\n\n// In the off chance there are duplicate copies of @embroider/macros in the dep graph\n// (due to the package manager messing up)\n// Let's try to merge them together via the above global well known variable\nconst localConfig = initializeRuntimeMacrosConfig();\n\nObject.assign(runtimeConfig.packages, localConfig.packages);\nObject.assign(runtimeConfig.global, localConfig.global);\n\n// this exists to be targeted by our babel plugin\nfunction initializeRuntimeMacrosConfig() {\n return { packages: {}, global: {} };\n}\n\nfunction updaterMethods() {\n return {\n config,\n getGlobalConfig,\n setConfig(packageRoot, value) {\n runtimeConfig.packages[packageRoot] = value;\n },\n setGlobalConfig(key, value) {\n runtimeConfig.global[key] = value;\n },\n };\n}\n\n// this is how runtime config can get injected at boot. I'm not sure yet if this\n// should be public API, but we certainly need it internally to set things like\n// the global fastboot.isRunning.\n//\n// consumers of this API push a function onto\n// window._embroider_macros_runtime_config. The function is given four methods\n// which allow it to read and write the per-package and global configs. The\n// reason for allowing both read & write is that merging strategies are up to\n// each consumers -- read first, then merge, then write.\n//\n// For an example user of this API, see where we generate\n// embroider_macros_fastboot_init.js' in @embroider/core.\nlet updaters = typeof window !== 'undefined' ? window._embroider_macros_runtime_config : undefined;\nif (updaters) {\n let methods = updaterMethods();\n for (let updater of updaters) {\n updater(methods);\n }\n}\n","import { createContext, type JSX, type ReactNode, useSyncExternalStore, type Context, useMemo } from \"react\";\nimport { Signal } from \"signal-polyfill\";\n\nimport { LOG_REACT_SIGNAL_INTEGRATION } from \"@warp-drive/core/build-config/debugging\";\n\nlet nextFlush: Promise<void> | null = null;\nlet watchers: WatcherState[] = [];\nlet watcherId = 0;\n\ninterface WatcherState {\n watcherId: number;\n pending: boolean;\n destroyed: boolean;\n notifyReact: (() => void) | null;\n watcher: Signal.subtle.Watcher;\n\n // the extra wrapper returned here ensures that the context value for the watcher\n // changes causing a re-render when the watcher is updated.\n snapshot: { watcher: Signal.subtle.Watcher } | null;\n}\n\nfunction clearWatcher(state: WatcherState) {\n state.watcher.unwatch(...Signal.subtle.introspectSources(state.watcher));\n}\n\nfunction flush(state: WatcherState) {\n state.pending = false;\n if (state.destroyed) {\n if (LOG_REACT_SIGNAL_INTEGRATION) {\n // eslint-disable-next-line no-console\n console.log(`[WarpDrive] Detected Watcher Destroyed During Notify Flush, clearing signals`);\n }\n state.snapshot = null;\n clearWatcher(state);\n return;\n }\n\n if (LOG_REACT_SIGNAL_INTEGRATION) {\n /* eslint-disable no-console */\n console.log(`[WarpDrive] Notifying React That WatcherContext:${state.watcherId} Has Updated`);\n console.log(\"all signals\", new Set(Signal.subtle.introspectSources(state.watcher)));\n console.log(\"dirty signals\", new Set(state.watcher.getPending()));\n /* eslint-enable no-console */\n }\n\n // any time signals have changed, we notify React that our store has updated\n state.snapshot = { watcher: state.watcher };\n if (state.notifyReact) state.notifyReact();\n\n // tell the Watcher to start watching for changes again\n // by signaling that notifications have been flushed.\n state.watcher.watch();\n}\n\nfunction _createWatcher() {\n const id = watcherId++;\n if (LOG_REACT_SIGNAL_INTEGRATION) {\n // eslint-disable-next-line no-console\n console.log(`[WarpDrive] Creating a WatcherContext:${id}`);\n }\n const state: WatcherState = {\n watcherId: id,\n pending: false,\n destroyed: false,\n notifyReact: null as (() => void) | null,\n watcher: null as unknown as Signal.subtle.Watcher,\n\n // the extra wrapper returned here ensures that the context value for the watcher\n // changes causing a re-render when the watcher is updated.\n snapshot: null as { watcher: Signal.subtle.Watcher } | null,\n };\n\n state.watcher = new Signal.subtle.Watcher((...args) => {\n if (LOG_REACT_SIGNAL_INTEGRATION) {\n // eslint-disable-next-line no-console\n console.log(`watcher ${state.watcherId} notified`, args, state.watcher);\n }\n if (!state.pending && !state.destroyed) {\n watchers.push(state);\n state.pending = true;\n\n if (!nextFlush) {\n nextFlush = new Promise((resolve) => {\n queueMicrotask(() => {\n queueMicrotask(() => {\n queueMicrotask(() => {\n watchers.forEach(flush);\n if (LOG_REACT_SIGNAL_INTEGRATION) {\n // eslint-disable-next-line no-console\n console.log(\n \"Flushed watcher:\",\n watchers.map((w) => w.watcherId)\n );\n }\n watchers = [];\n nextFlush = null;\n\n resolve();\n });\n });\n });\n });\n }\n } else if (state.destroyed) {\n if (LOG_REACT_SIGNAL_INTEGRATION) {\n // eslint-disable-next-line no-console\n console.log(`[WarpDrive] Detected Watcher Destroyed During Notify, clearing signals`);\n }\n // if we are destroyed, we clear the watcher signals\n // so that it does not continue to watch for changes.\n state.snapshot = null;\n clearWatcher(state);\n }\n });\n\n // The watcher won't begin watching until we call `watcher.watch()`\n state.watcher.watch();\n state.snapshot = { watcher: state.watcher };\n\n return state;\n}\n\nexport function useWatcher(): { watcher: Signal.subtle.Watcher } | null {\n const state = useMemo(_createWatcher, []);\n\n return useSyncExternalStore(\n (notifyChanged: () => void) => {\n if (LOG_REACT_SIGNAL_INTEGRATION) {\n // eslint-disable-next-line no-console\n console.log(`[WarpDrive] Subscribing to Watcher`);\n }\n state.destroyed = false;\n state.notifyReact = notifyChanged;\n\n // The watcher won't begin watching until we call `watcher.watch()`\n state.watcher.watch();\n\n return () => {\n if (LOG_REACT_SIGNAL_INTEGRATION) {\n // eslint-disable-next-line no-console\n console.log(`[WarpDrive] Deactivating Watcher Subscription`);\n }\n state.destroyed = true;\n state.notifyReact = null;\n };\n },\n () => state.snapshot\n );\n}\n\n/**\n * @category Contexts\n */\nexport const WatcherContext: Context<{\n /**\n * The `Signal.subtle.Watcher` used to observe signal changes for the nearest {@link ReactiveContext}.\n */\n watcher: Signal.subtle.Watcher;\n} | null> = createContext<{\n watcher: Signal.subtle.Watcher;\n} | null>(null);\n\n/**\n *\n * @category Components\n */\nexport function ReactiveContext({ children }: { children: ReactNode }): JSX.Element {\n const watcher = useWatcher();\n /**\n * Unlike other frameworks, React does not have a built-in way to provide\n * a context value other than by rendering an extra component.\n *\n */\n return <WatcherContext value={watcher}>{children}</WatcherContext>;\n}\n"],"x_google_ignoreList":[0],"mappings":";;;;;AAiCA,SAAgBO,OAAOC,aAAa;CAClC,OAAOC,cAAcC,SAASF;AAChC;AAEA,SAAgBG,kBAAkB;CAChC,OAAOF,cAAcG;AACvB;AAwBA,MAAMH,gBAAgBS,WAAWC,yCAAyC,CAAC;AAE3EV,cAAcC,aAAa,CAAC;AAC5BD,cAAcG,WAAW,CAAC;AAK1B,MAAMQ,cAAcC,8BAA8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AAM/B,QAAQV,QAAQ8B,gBAAgB,CAAA,CAAE;CAExC,OAAO/B,sBACJ2C,kBAA8B;EAAA,IAAAvC,gBAAA,CAAA,CAAAe,UAAAC,MAAAC,gCAAAC,WAAAC,0BAAA,CAAA,CAAAH,MAAAC,8BAG3BG,QAAQC,IAAI,oCAAoC;EAElDd,MAAMO,YAAY;EAClBP,MAAMkB,cAAcc;EAGpBhC,MAAMC,QAAQkB,MAAM;EAEpB,aAAa;GAAA,IAAA1B,gBAAA,CAAA,CAAAe,UAAAC,MAAAC,gCAAAC,WAAAC,0BAAA,CAAA,CAAAH,MAAAC,8BAGTG,QAAQC,IAAI,+CAA+C;GAE7Dd,MAAMO,YAAY;GAClBP,MAAMkB,cAAc;EACtB;CACF,SACMlB,MAAMe,QACd;AACF;;;;AAKA,MAAakB,iBAKD7C,4BAEF,IAAI;;;;;AAMd,SAAgB8C,gBAAgB,EAAEC,YAAkD;CAClF,MAAMlC,UAAU8B,WAAW;;;;;;CAM3B,OAAOpC,qBAACsC,gBAAc;EAACG,OAAOnC;EAAUkC;CAAQ,GAAA,KAAA,GAAA,OAAA;EAAAE,UAAAC;EAAAC,YAAA;EAAAC,cAAA;CAAA,GAAA,IAAiB;AACnE"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as WatcherContext, t as ReactiveContext } from "./reactive-context-
|
|
1
|
+
import { n as WatcherContext, t as ReactiveContext } from "./reactive-context-Bz6GBd64.js";
|
|
2
2
|
import { createContext, use, useEffect, useMemo, useRef } from "react";
|
|
3
3
|
import { Fragment, jsxDEV } from "react/jsx-dev-runtime";
|
|
4
4
|
import { createRequestSubscription } from "@warp-drive/core/reactive";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as WatcherContext, r as getGlobalConfig } from "./reactive-context-
|
|
1
|
+
import { n as WatcherContext, r as getGlobalConfig } from "./reactive-context-Bz6GBd64.js";
|
|
2
2
|
import { use } from "react";
|
|
3
3
|
import { Signal } from "signal-polyfill";
|
|
4
4
|
import { setupSignals } from "@warp-drive/core/configure";
|
package/dist/unpkg/dev-deprecated/{reactive-context-B-pn7tS7.js → reactive-context-Bz6GBd64.js}
RENAMED
|
@@ -60,7 +60,7 @@ function initializeRuntimeMacrosConfig() {
|
|
|
60
60
|
"features": {
|
|
61
61
|
"ENFORCE_STRICT_RESOURCE_FINALIZATION": false,
|
|
62
62
|
"JSON_API_CACHE_VALIDATION_ERRORS": false,
|
|
63
|
-
"SAMPLE_FEATURE_FLAG":
|
|
63
|
+
"SAMPLE_FEATURE_FLAG": null
|
|
64
64
|
},
|
|
65
65
|
"activeLogging": {
|
|
66
66
|
"DEBUG_RELATIONSHIP_NOTIFICATIONS": true,
|
|
@@ -215,4 +215,4 @@ function ReactiveContext({ children }) {
|
|
|
215
215
|
|
|
216
216
|
//#endregion
|
|
217
217
|
export { WatcherContext as n, getGlobalConfig as r, ReactiveContext as t };
|
|
218
|
-
//# sourceMappingURL=reactive-context-
|
|
218
|
+
//# sourceMappingURL=reactive-context-Bz6GBd64.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reactive-context-B-pn7tS7.js","names":["each","array","Array","isArray","Error","macroCondition","predicate","config","packageRoot","runtimeConfig","packages","getGlobalConfig","global","isTesting","g","e","Boolean","setTesting","globalThis","__embroider_macros__runtime_config__","localConfig","initializeRuntimeMacrosConfig","Object","assign","updaterMethods","setConfig","value","setGlobalConfig","key","updaters","window","_embroider_macros_runtime_config","undefined","methods","updater","createContext","useSyncExternalStore","useMemo","Signal","getGlobalConfig","getGlobalConfig0","jsxDEV","_jsxDEV","nextFlush","watchers","watcherId","clearWatcher","state","watcher","unwatch","subtle","introspectSources","flush","pending","destroyed","WarpDrive","debug","LOG_REACT_SIGNAL_INTEGRATION","globalThis","getWarpDriveRuntimeConfig","console","log","snapshot","Set","getPending","notifyReact","watch","_createWatcher","id","Watcher","args","push","Promise","resolve","queueMicrotask","forEach","map","w","useWatcher","notifyChanged","WatcherContext","ReactiveContext","children","value","fileName","_jsxFileName","lineNumber","columnNumber"],"sources":["../../../../../node_modules/.pnpm/@embroider+macros@1.20.6/node_modules/@embroider/macros/src/addon/runtime.js","../../../src/-private/reactive-context.tsx"],"sourcesContent":["/*\n These are the runtime implementations for the javascript macros that have\n runtime implementations.\n\n Not every macro has a runtime implementation, some only make sense in the\n build and always run there.\n\n Even when we have runtime implementations, we are still careful to emit static\n errors during the build wherever possible, and runtime errors when necessary,\n so that you're not surprised when you switch from runtime-mode to compile-time\n mode.\n*/\n\n/*\n CAUTION: in classic builds, this file gets shared by all present copies of\n @embroider/macros. If you want to change its public API, you need to rename it\n and update `pathToRuntime` in ../babel/state.ts to point at it, so that your\n babel plugin and runtime will match.\n*/\n\nexport function each(array) {\n if (!Array.isArray(array)) {\n throw new Error(`the argument to the each() macro must be an array`);\n }\n return array;\n}\n\nexport function macroCondition(predicate) {\n return predicate;\n}\n\n// This is here as a compile target for `getConfig` and `getOwnConfig` when\n// we're in runtime mode. This is not public API to call from your own code.\nexport function config(packageRoot) {\n return runtimeConfig.packages[packageRoot];\n}\n\nexport function getGlobalConfig() {\n return runtimeConfig.global;\n}\n\nexport function isTesting() {\n let g = runtimeConfig.global;\n let e = g && g['@embroider/macros'];\n return Boolean(e && e.isTesting);\n}\n\nexport function setTesting(isTesting) {\n if (!runtimeConfig.global) {\n runtimeConfig.global = {};\n }\n if (!runtimeConfig.global['@embroider/macros']) {\n runtimeConfig.global['@embroider/macros'] = {};\n }\n runtimeConfig.global['@embroider/macros'].isTesting = Boolean(isTesting);\n}\n\n// Welcome intrepid developer!\n//\n// While this data is \"global\", this is a private variable.\n//\n// do not build features based off of its contents,\n// or assume it will have the same name in future releases.\nconst runtimeConfig = globalThis.__embroider_macros__runtime_config__ ||= {};\n\nruntimeConfig.packages ||= {};\nruntimeConfig.global ||= {};\n\n// In the off chance there are duplicate copies of @embroider/macros in the dep graph\n// (due to the package manager messing up)\n// Let's try to merge them together via the above global well known variable\nconst localConfig = initializeRuntimeMacrosConfig();\n\nObject.assign(runtimeConfig.packages, localConfig.packages);\nObject.assign(runtimeConfig.global, localConfig.global);\n\n// this exists to be targeted by our babel plugin\nfunction initializeRuntimeMacrosConfig() {\n return { packages: {}, global: {} };\n}\n\nfunction updaterMethods() {\n return {\n config,\n getGlobalConfig,\n setConfig(packageRoot, value) {\n runtimeConfig.packages[packageRoot] = value;\n },\n setGlobalConfig(key, value) {\n runtimeConfig.global[key] = value;\n },\n };\n}\n\n// this is how runtime config can get injected at boot. I'm not sure yet if this\n// should be public API, but we certainly need it internally to set things like\n// the global fastboot.isRunning.\n//\n// consumers of this API push a function onto\n// window._embroider_macros_runtime_config. The function is given four methods\n// which allow it to read and write the per-package and global configs. The\n// reason for allowing both read & write is that merging strategies are up to\n// each consumers -- read first, then merge, then write.\n//\n// For an example user of this API, see where we generate\n// embroider_macros_fastboot_init.js' in @embroider/core.\nlet updaters = typeof window !== 'undefined' ? window._embroider_macros_runtime_config : undefined;\nif (updaters) {\n let methods = updaterMethods();\n for (let updater of updaters) {\n updater(methods);\n }\n}\n","import { createContext, type JSX, type ReactNode, useSyncExternalStore, type Context, useMemo } from \"react\";\nimport { Signal } from \"signal-polyfill\";\n\nimport { LOG_REACT_SIGNAL_INTEGRATION } from \"@warp-drive/core/build-config/debugging\";\n\nlet nextFlush: Promise<void> | null = null;\nlet watchers: WatcherState[] = [];\nlet watcherId = 0;\n\ninterface WatcherState {\n watcherId: number;\n pending: boolean;\n destroyed: boolean;\n notifyReact: (() => void) | null;\n watcher: Signal.subtle.Watcher;\n\n // the extra wrapper returned here ensures that the context value for the watcher\n // changes causing a re-render when the watcher is updated.\n snapshot: { watcher: Signal.subtle.Watcher } | null;\n}\n\nfunction clearWatcher(state: WatcherState) {\n state.watcher.unwatch(...Signal.subtle.introspectSources(state.watcher));\n}\n\nfunction flush(state: WatcherState) {\n state.pending = false;\n if (state.destroyed) {\n if (LOG_REACT_SIGNAL_INTEGRATION) {\n // eslint-disable-next-line no-console\n console.log(`[WarpDrive] Detected Watcher Destroyed During Notify Flush, clearing signals`);\n }\n state.snapshot = null;\n clearWatcher(state);\n return;\n }\n\n if (LOG_REACT_SIGNAL_INTEGRATION) {\n /* eslint-disable no-console */\n console.log(`[WarpDrive] Notifying React That WatcherContext:${state.watcherId} Has Updated`);\n console.log(\"all signals\", new Set(Signal.subtle.introspectSources(state.watcher)));\n console.log(\"dirty signals\", new Set(state.watcher.getPending()));\n /* eslint-enable no-console */\n }\n\n // any time signals have changed, we notify React that our store has updated\n state.snapshot = { watcher: state.watcher };\n if (state.notifyReact) state.notifyReact();\n\n // tell the Watcher to start watching for changes again\n // by signaling that notifications have been flushed.\n state.watcher.watch();\n}\n\nfunction _createWatcher() {\n const id = watcherId++;\n if (LOG_REACT_SIGNAL_INTEGRATION) {\n // eslint-disable-next-line no-console\n console.log(`[WarpDrive] Creating a WatcherContext:${id}`);\n }\n const state: WatcherState = {\n watcherId: id,\n pending: false,\n destroyed: false,\n notifyReact: null as (() => void) | null,\n watcher: null as unknown as Signal.subtle.Watcher,\n\n // the extra wrapper returned here ensures that the context value for the watcher\n // changes causing a re-render when the watcher is updated.\n snapshot: null as { watcher: Signal.subtle.Watcher } | null,\n };\n\n state.watcher = new Signal.subtle.Watcher((...args) => {\n if (LOG_REACT_SIGNAL_INTEGRATION) {\n // eslint-disable-next-line no-console\n console.log(`watcher ${state.watcherId} notified`, args, state.watcher);\n }\n if (!state.pending && !state.destroyed) {\n watchers.push(state);\n state.pending = true;\n\n if (!nextFlush) {\n nextFlush = new Promise((resolve) => {\n queueMicrotask(() => {\n queueMicrotask(() => {\n queueMicrotask(() => {\n watchers.forEach(flush);\n if (LOG_REACT_SIGNAL_INTEGRATION) {\n // eslint-disable-next-line no-console\n console.log(\n \"Flushed watcher:\",\n watchers.map((w) => w.watcherId)\n );\n }\n watchers = [];\n nextFlush = null;\n\n resolve();\n });\n });\n });\n });\n }\n } else if (state.destroyed) {\n if (LOG_REACT_SIGNAL_INTEGRATION) {\n // eslint-disable-next-line no-console\n console.log(`[WarpDrive] Detected Watcher Destroyed During Notify, clearing signals`);\n }\n // if we are destroyed, we clear the watcher signals\n // so that it does not continue to watch for changes.\n state.snapshot = null;\n clearWatcher(state);\n }\n });\n\n // The watcher won't begin watching until we call `watcher.watch()`\n state.watcher.watch();\n state.snapshot = { watcher: state.watcher };\n\n return state;\n}\n\nexport function useWatcher(): { watcher: Signal.subtle.Watcher } | null {\n const state = useMemo(_createWatcher, []);\n\n return useSyncExternalStore(\n (notifyChanged: () => void) => {\n if (LOG_REACT_SIGNAL_INTEGRATION) {\n // eslint-disable-next-line no-console\n console.log(`[WarpDrive] Subscribing to Watcher`);\n }\n state.destroyed = false;\n state.notifyReact = notifyChanged;\n\n // The watcher won't begin watching until we call `watcher.watch()`\n state.watcher.watch();\n\n return () => {\n if (LOG_REACT_SIGNAL_INTEGRATION) {\n // eslint-disable-next-line no-console\n console.log(`[WarpDrive] Deactivating Watcher Subscription`);\n }\n state.destroyed = true;\n state.notifyReact = null;\n };\n },\n () => state.snapshot\n );\n}\n\n/**\n * @category Contexts\n */\nexport const WatcherContext: Context<{\n /**\n * The `Signal.subtle.Watcher` used to observe signal changes for the nearest {@link ReactiveContext}.\n */\n watcher: Signal.subtle.Watcher;\n} | null> = createContext<{\n watcher: Signal.subtle.Watcher;\n} | null>(null);\n\n/**\n *\n * @category Components\n */\nexport function ReactiveContext({ children }: { children: ReactNode }): JSX.Element {\n const watcher = useWatcher();\n /**\n * Unlike other frameworks, React does not have a built-in way to provide\n * a context value other than by rendering an extra component.\n *\n */\n return <WatcherContext value={watcher}>{children}</WatcherContext>;\n}\n"],"x_google_ignoreList":[0],"mappings":";;;;;AAiCA,SAAgBO,OAAOC,aAAa;CAClC,OAAOC,cAAcC,SAASF;AAChC;AAEA,SAAgBG,kBAAkB;CAChC,OAAOF,cAAcG;AACvB;AAwBA,MAAMH,gBAAgBS,WAAWC,yCAAyC,CAAC;AAE3EV,cAAcC,aAAa,CAAC;AAC5BD,c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E1C,OAAOD;AACT;AAEA,SAAgB+B,aAAwD;CACtE,MAAM/B,QAAQV,QAAQ8B,gBAAgB,CAAA,CAAE;CAExC,OAAO/B,sBACJ2C,kBAA8B;EAAA,IAAAvC,gBAAA,CAAA,CAAAe,UAAAC,MAAAC,gCAAAC,WAAAC,0BAAA,CAAA,CAAAH,MAAAC,8BAG3BG,QAAQC,IAAI,oCAAoC;EAElDd,MAAMO,YAAY;EAClBP,MAAMkB,cAAcc;EAGpBhC,MAAMC,QAAQkB,MAAM;EAEpB,aAAa;GAAA,IAAA1B,gBAAA,CAAA,CAAAe,UAAAC,MAAAC,gCAAAC,WAAAC,0BAAA,CAAA,CAAAH,MAAAC,8BAGTG,QAAQC,IAAI,+CAA+C;GAE7Dd,MAAMO,YAAY;GAClBP,MAAMkB,cAAc;EACtB;CACF,SACMlB,MAAMe,QACd;AACF;;;;AAKA,MAAakB,iBAKD7C,4BAEF,IAAI;;;;;AAMd,SAAgB8C,gBAAgB,EAAEC,YAAkD;CAClF,MAAMlC,UAAU8B,WAAW;;;;;;CAM3B,OAAOpC,qBAACsC,gBAAc;EAACG,OAAOnC;EAAUkC;CAAQ,GAAA,KAAA,GAAA,OAAA;EAAAE,UAAAC;EAAAC,YAAA;EAAAC,cAAA;CAAA,GAAA,IAAiB;AACnE"}
|
|
1
|
+
{"version":3,"file":"reactive-context-Bz6GBd64.js","names":["each","array","Array","isArray","Error","macroCondition","predicate","config","packageRoot","runtimeConfig","packages","getGlobalConfig","global","isTesting","g","e","Boolean","setTesting","globalThis","__embroider_macros__runtime_config__","localConfig","initializeRuntimeMacrosConfig","Object","assign","updaterMethods","setConfig","value","setGlobalConfig","key","updaters","window","_embroider_macros_runtime_config","undefined","methods","updater","createContext","useSyncExternalStore","useMemo","Signal","getGlobalConfig","getGlobalConfig0","jsxDEV","_jsxDEV","nextFlush","watchers","watcherId","clearWatcher","state","watcher","unwatch","subtle","introspectSources","flush","pending","destroyed","WarpDrive","debug","LOG_REACT_SIGNAL_INTEGRATION","globalThis","getWarpDriveRuntimeConfig","console","log","snapshot","Set","getPending","notifyReact","watch","_createWatcher","id","Watcher","args","push","Promise","resolve","queueMicrotask","forEach","map","w","useWatcher","notifyChanged","WatcherContext","ReactiveContext","children","value","fileName","_jsxFileName","lineNumber","columnNumber"],"sources":["../../../../../node_modules/.pnpm/@embroider+macros@1.20.6/node_modules/@embroider/macros/src/addon/runtime.js","../../../src/-private/reactive-context.tsx"],"sourcesContent":["/*\n These are the runtime implementations for the javascript macros that have\n runtime implementations.\n\n Not every macro has a runtime implementation, some only make sense in the\n build and always run there.\n\n Even when we have runtime implementations, we are still careful to emit static\n errors during the build wherever possible, and runtime errors when necessary,\n so that you're not surprised when you switch from runtime-mode to compile-time\n mode.\n*/\n\n/*\n CAUTION: in classic builds, this file gets shared by all present copies of\n @embroider/macros. If you want to change its public API, you need to rename it\n and update `pathToRuntime` in ../babel/state.ts to point at it, so that your\n babel plugin and runtime will match.\n*/\n\nexport function each(array) {\n if (!Array.isArray(array)) {\n throw new Error(`the argument to the each() macro must be an array`);\n }\n return array;\n}\n\nexport function macroCondition(predicate) {\n return predicate;\n}\n\n// This is here as a compile target for `getConfig` and `getOwnConfig` when\n// we're in runtime mode. This is not public API to call from your own code.\nexport function config(packageRoot) {\n return runtimeConfig.packages[packageRoot];\n}\n\nexport function getGlobalConfig() {\n return runtimeConfig.global;\n}\n\nexport function isTesting() {\n let g = runtimeConfig.global;\n let e = g && g['@embroider/macros'];\n return Boolean(e && e.isTesting);\n}\n\nexport function setTesting(isTesting) {\n if (!runtimeConfig.global) {\n runtimeConfig.global = {};\n }\n if (!runtimeConfig.global['@embroider/macros']) {\n runtimeConfig.global['@embroider/macros'] = {};\n }\n runtimeConfig.global['@embroider/macros'].isTesting = Boolean(isTesting);\n}\n\n// Welcome intrepid developer!\n//\n// While this data is \"global\", this is a private variable.\n//\n// do not build features based off of its contents,\n// or assume it will have the same name in future releases.\nconst runtimeConfig = globalThis.__embroider_macros__runtime_config__ ||= {};\n\nruntimeConfig.packages ||= {};\nruntimeConfig.global ||= {};\n\n// In the off chance there are duplicate copies of @embroider/macros in the dep graph\n// (due to the package manager messing up)\n// Let's try to merge them together via the above global well known variable\nconst localConfig = initializeRuntimeMacrosConfig();\n\nObject.assign(runtimeConfig.packages, localConfig.packages);\nObject.assign(runtimeConfig.global, localConfig.global);\n\n// this exists to be targeted by our babel plugin\nfunction initializeRuntimeMacrosConfig() {\n return { packages: {}, global: {} };\n}\n\nfunction updaterMethods() {\n return {\n config,\n getGlobalConfig,\n setConfig(packageRoot, value) {\n runtimeConfig.packages[packageRoot] = value;\n },\n setGlobalConfig(key, value) {\n runtimeConfig.global[key] = value;\n },\n };\n}\n\n// this is how runtime config can get injected at boot. I'm not sure yet if this\n// should be public API, but we certainly need it internally to set things like\n// the global fastboot.isRunning.\n//\n// consumers of this API push a function onto\n// window._embroider_macros_runtime_config. The function is given four methods\n// which allow it to read and write the per-package and global configs. The\n// reason for allowing both read & write is that merging strategies are up to\n// each consumers -- read first, then merge, then write.\n//\n// For an example user of this API, see where we generate\n// embroider_macros_fastboot_init.js' in @embroider/core.\nlet updaters = typeof window !== 'undefined' ? window._embroider_macros_runtime_config : undefined;\nif (updaters) {\n let methods = updaterMethods();\n for (let updater of updaters) {\n updater(methods);\n }\n}\n","import { createContext, type JSX, type ReactNode, useSyncExternalStore, type Context, useMemo } from \"react\";\nimport { Signal } from \"signal-polyfill\";\n\nimport { LOG_REACT_SIGNAL_INTEGRATION } from \"@warp-drive/core/build-config/debugging\";\n\nlet nextFlush: Promise<void> | null = null;\nlet watchers: WatcherState[] = [];\nlet watcherId = 0;\n\ninterface WatcherState {\n watcherId: number;\n pending: boolean;\n destroyed: boolean;\n notifyReact: (() => void) | null;\n watcher: Signal.subtle.Watcher;\n\n // the extra wrapper returned here ensures that the context value for the watcher\n // changes causing a re-render when the watcher is updated.\n snapshot: { watcher: Signal.subtle.Watcher } | null;\n}\n\nfunction clearWatcher(state: WatcherState) {\n state.watcher.unwatch(...Signal.subtle.introspectSources(state.watcher));\n}\n\nfunction flush(state: WatcherState) {\n state.pending = false;\n if (state.destroyed) {\n if (LOG_REACT_SIGNAL_INTEGRATION) {\n // eslint-disable-next-line no-console\n console.log(`[WarpDrive] Detected Watcher Destroyed During Notify Flush, clearing signals`);\n }\n state.snapshot = null;\n clearWatcher(state);\n return;\n }\n\n if (LOG_REACT_SIGNAL_INTEGRATION) {\n /* eslint-disable no-console */\n console.log(`[WarpDrive] Notifying React That WatcherContext:${state.watcherId} Has Updated`);\n console.log(\"all signals\", new Set(Signal.subtle.introspectSources(state.watcher)));\n console.log(\"dirty signals\", new Set(state.watcher.getPending()));\n /* eslint-enable no-console */\n }\n\n // any time signals have changed, we notify React that our store has updated\n state.snapshot = { watcher: state.watcher };\n if (state.notifyReact) state.notifyReact();\n\n // tell the Watcher to start watching for changes again\n // by signaling that notifications have been flushed.\n state.watcher.watch();\n}\n\nfunction _createWatcher() {\n const id = watcherId++;\n if (LOG_REACT_SIGNAL_INTEGRATION) {\n // eslint-disable-next-line no-console\n console.log(`[WarpDrive] Creating a WatcherContext:${id}`);\n }\n const state: WatcherState = {\n watcherId: id,\n pending: false,\n destroyed: false,\n notifyReact: null as (() => void) | null,\n watcher: null as unknown as Signal.subtle.Watcher,\n\n // the extra wrapper returned here ensures that the context value for the watcher\n // changes causing a re-render when the watcher is updated.\n snapshot: null as { watcher: Signal.subtle.Watcher } | null,\n };\n\n state.watcher = new Signal.subtle.Watcher((...args) => {\n if (LOG_REACT_SIGNAL_INTEGRATION) {\n // eslint-disable-next-line no-console\n console.log(`watcher ${state.watcherId} notified`, args, state.watcher);\n }\n if (!state.pending && !state.destroyed) {\n watchers.push(state);\n state.pending = true;\n\n if (!nextFlush) {\n nextFlush = new Promise((resolve) => {\n queueMicrotask(() => {\n queueMicrotask(() => {\n queueMicrotask(() => {\n watchers.forEach(flush);\n if (LOG_REACT_SIGNAL_INTEGRATION) {\n // eslint-disable-next-line no-console\n console.log(\n \"Flushed watcher:\",\n watchers.map((w) => w.watcherId)\n );\n }\n watchers = [];\n nextFlush = null;\n\n resolve();\n });\n });\n });\n });\n }\n } else if (state.destroyed) {\n if (LOG_REACT_SIGNAL_INTEGRATION) {\n // eslint-disable-next-line no-console\n console.log(`[WarpDrive] Detected Watcher Destroyed During Notify, clearing signals`);\n }\n // if we are destroyed, we clear the watcher signals\n // so that it does not continue to watch for changes.\n state.snapshot = null;\n clearWatcher(state);\n }\n });\n\n // The watcher won't begin watching until we call `watcher.watch()`\n state.watcher.watch();\n state.snapshot = { watcher: state.watcher };\n\n return state;\n}\n\nexport function useWatcher(): { watcher: Signal.subtle.Watcher } | null {\n const state = useMemo(_createWatcher, []);\n\n return useSyncExternalStore(\n (notifyChanged: () => void) => {\n if (LOG_REACT_SIGNAL_INTEGRATION) {\n // eslint-disable-next-line no-console\n console.log(`[WarpDrive] Subscribing to Watcher`);\n }\n state.destroyed = false;\n state.notifyReact = notifyChanged;\n\n // The watcher won't begin watching until we call `watcher.watch()`\n state.watcher.watch();\n\n return () => {\n if (LOG_REACT_SIGNAL_INTEGRATION) {\n // eslint-disable-next-line no-console\n console.log(`[WarpDrive] Deactivating Watcher Subscription`);\n }\n state.destroyed = true;\n state.notifyReact = null;\n };\n },\n () => state.snapshot\n );\n}\n\n/**\n * @category Contexts\n */\nexport const WatcherContext: Context<{\n /**\n * The `Signal.subtle.Watcher` used to observe signal changes for the nearest {@link ReactiveContext}.\n */\n watcher: Signal.subtle.Watcher;\n} | null> = createContext<{\n watcher: Signal.subtle.Watcher;\n} | null>(null);\n\n/**\n *\n * @category Components\n */\nexport function ReactiveContext({ children }: { children: ReactNode }): JSX.Element {\n const watcher = useWatcher();\n /**\n * Unlike other frameworks, React does not have a built-in way to provide\n * a context value other than by rendering an extra component.\n *\n */\n return <WatcherContext value={watcher}>{children}</WatcherContext>;\n}\n"],"x_google_ignoreList":[0],"mappings":";;;;;AAiCA,SAAgBO,OAAOC,aAAa;CAClC,OAAOC,cAAcC,SA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E;GAItFd,MAAMe,WAAW;GACjBhB,aAAaC,KAAK;EACpB;CACF,CAAC;CAGDA,MAAMC,QAAQkB,MAAM;CACpBnB,MAAMe,WAAW,EAAEd,SAASD,MAAMC,QAAQ;CAE1C,OAAOD;AACT;AAEA,SAAgB+B,aAAwD;CACtE,MAAM/B,QAAQV,QAAQ8B,gBAAgB,CAAA,CAAE;CAExC,OAAO/B,sBACJ2C,kBAA8B;EAAA,IAAAvC,gBAAA,CAAA,CAAAe,UAAAC,MAAAC,gCAAAC,WAAAC,0BAAA,CAAA,CAAAH,MAAAC,8BAG3BG,QAAQC,IAAI,oCAAoC;EAElDd,MAAMO,YAAY;EAClBP,MAAMkB,cAAcc;EAGpBhC,MAAMC,QAAQkB,MAAM;EAEpB,aAAa;GAAA,IAAA1B,gBAAA,CAAA,CAAAe,UAAAC,MAAAC,gCAAAC,WAAAC,0BAAA,CAAA,CAAAH,MAAAC,8BAGTG,QAAQC,IAAI,+CAA+C;GAE7Dd,MAAMO,YAAY;GAClBP,MAAMkB,cAAc;EACtB;CACF,SACMlB,MAAMe,QACd;AACF;;;;AAKA,MAAakB,iBAKD7C,4BAEF,IAAI;;;;;AAMd,SAAgB8C,gBAAgB,EAAEC,YAAkD;CAClF,MAAMlC,UAAU8B,WAAW;;;;;;CAM3B,OAAOpC,qBAACsC,gBAAc;EAACG,OAAOnC;EAAUkC;CAAQ,GAAA,KAAA,GAAA,OAAA;EAAAE,UAAAC;EAAAC,YAAA;EAAAC,cAAA;CAAA,GAAA,IAAiB;AACnE"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@warp-drive/react",
|
|
3
3
|
"description": "Data bindings and utilities for React applications using WarpDrive",
|
|
4
|
-
"version": "5.
|
|
4
|
+
"version": "5.10.0-alpha.0",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Chris Thoburn <runspired@users.noreply.github.com>",
|
|
7
7
|
"repository": {
|
|
@@ -44,8 +44,8 @@
|
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
46
|
"@embroider/macros": "^1.20.6",
|
|
47
|
-
"@warp-drive/core": "5.
|
|
48
|
-
"@warp-drive/tc39-proposal-signals": "5.
|
|
47
|
+
"@warp-drive/core": "5.10.0-alpha.0",
|
|
48
|
+
"@warp-drive/tc39-proposal-signals": "5.10.0-alpha.0",
|
|
49
49
|
"react": "^19.2.8",
|
|
50
50
|
"signal-polyfill": "^0.2.2"
|
|
51
51
|
},
|
|
@@ -58,8 +58,8 @@
|
|
|
58
58
|
"@babel/preset-typescript": "^7.29.7",
|
|
59
59
|
"@babel/runtime": "^7.29.7",
|
|
60
60
|
"@types/react": "^19.2.18",
|
|
61
|
-
"@warp-drive/core": "5.
|
|
62
|
-
"@warp-drive/internal-config": "5.
|
|
61
|
+
"@warp-drive/core": "5.10.0-alpha.0",
|
|
62
|
+
"@warp-drive/internal-config": "5.10.0-alpha.0",
|
|
63
63
|
"decorator-transforms": "^2.4.0",
|
|
64
64
|
"react": "^19.2.8",
|
|
65
65
|
"tsdown": "^0.22.14",
|