@valbuild/next 0.96.3 → 0.97.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (56) hide show
  1. package/README.md +33 -0
  2. package/client/dist/valbuild-next-client.cjs.dev.js +29 -10
  3. package/client/dist/valbuild-next-client.cjs.prod.js +29 -10
  4. package/client/dist/valbuild-next-client.esm.js +29 -10
  5. package/dist/{ValApp-3df36e0d.cjs.dev.js → ValApp-1992d8b3.cjs.dev.js} +3 -2
  6. package/dist/{ValApp-e2e1dfed.esm.js → ValApp-8912fc8b.esm.js} +3 -2
  7. package/dist/ValApp-bb207e96.cjs.js +7 -0
  8. package/dist/{ValApp-22147086.cjs.prod.js → ValApp-bb207e96.cjs.prod.js} +3 -2
  9. package/dist/ValModulesClient-0dd601a1.esm.js +48 -0
  10. package/dist/ValModulesClient-10c0721c.cjs.js +7 -0
  11. package/dist/ValModulesClient-10c0721c.cjs.prod.js +53 -0
  12. package/dist/ValModulesClient-4ecabf99.cjs.dev.js +53 -0
  13. package/dist/{ValNextProvider-26ef0c1c.cjs.dev.js → ValNextProvider-03a9f8fd.cjs.dev.js} +103 -25
  14. package/dist/ValNextProvider-6103cb74.cjs.js +7 -0
  15. package/dist/{ValNextProvider-b0d9fa24.cjs.prod.js → ValNextProvider-6103cb74.cjs.prod.js} +103 -25
  16. package/dist/{ValNextProvider-e163e127.esm.js → ValNextProvider-7302b8af.esm.js} +104 -26
  17. package/dist/ValOverlayContext-3c37e5a7.esm.js +251 -0
  18. package/dist/ValOverlayContext-c6f27a6d.cjs.dev.js +262 -0
  19. package/dist/ValOverlayContext-f7f45bc7.cjs.js +7 -0
  20. package/dist/ValOverlayContext-f7f45bc7.cjs.prod.js +262 -0
  21. package/dist/declarations/src/ValApp.d.ts +3 -1
  22. package/dist/declarations/src/ValModulesClient.d.ts +38 -0
  23. package/dist/declarations/src/ValProvider.d.ts +1 -0
  24. package/dist/declarations/src/external_exempt_from_val_quickjs.d.ts +1 -0
  25. package/dist/declarations/src/initVal.d.ts +25 -0
  26. package/dist/defineProperty-8951f469.cjs.prod.js +29 -0
  27. package/dist/defineProperty-cca5affa.esm.js +26 -0
  28. package/dist/defineProperty-f90345d7.cjs.dev.js +29 -0
  29. package/dist/{objectSpread2-3c87fb4f.cjs.prod.js → objectSpread2-13f847a9.cjs.prod.js} +2 -27
  30. package/dist/{objectSpread2-792eb2c2.cjs.dev.js → objectSpread2-58024783.cjs.dev.js} +2 -27
  31. package/dist/{objectSpread2-c1340c1c.esm.js → objectSpread2-60d1bd93.esm.js} +2 -25
  32. package/dist/{routeFromVal-ef8c304a.cjs.prod.js → routeFromVal-13c832b2.cjs.prod.js} +1 -1
  33. package/dist/{routeFromVal-748d2aec.esm.js → routeFromVal-8855a5cc.esm.js} +1 -1
  34. package/dist/{routeFromVal-8fdaa0d0.cjs.dev.js → routeFromVal-9b610e77.cjs.dev.js} +1 -1
  35. package/dist/valbuild-next.cjs.dev.js +56 -4
  36. package/dist/valbuild-next.cjs.prod.js +56 -4
  37. package/dist/valbuild-next.esm.js +48 -4
  38. package/dist/{asyncToGenerator-8e5c36c8.cjs.prod.js → version-0e6da9a7.cjs.prod.js} +10 -0
  39. package/dist/{asyncToGenerator-500f022f.esm.js → version-4d7b692c.esm.js} +10 -1
  40. package/dist/{asyncToGenerator-c3823d62.cjs.dev.js → version-c311d818.cjs.dev.js} +10 -0
  41. package/package.json +14 -8
  42. package/rsc/dist/valbuild-next-rsc.cjs.dev.js +38 -36
  43. package/rsc/dist/valbuild-next-rsc.cjs.prod.js +38 -36
  44. package/rsc/dist/valbuild-next-rsc.esm.js +7 -5
  45. package/server/dist/valbuild-next-server.cjs.dev.js +9 -9
  46. package/server/dist/valbuild-next-server.cjs.prod.js +9 -9
  47. package/server/dist/valbuild-next-server.esm.js +3 -3
  48. package/dist/ValApp-22147086.cjs.js +0 -7
  49. package/dist/ValNextProvider-b0d9fa24.cjs.js +0 -7
  50. package/dist/ValOverlayContext-6635a4d7.esm.js +0 -114
  51. package/dist/ValOverlayContext-942f1294.cjs.js +0 -7
  52. package/dist/ValOverlayContext-942f1294.cjs.prod.js +0 -125
  53. package/dist/ValOverlayContext-c82a4507.cjs.dev.js +0 -125
  54. package/dist/version-16f6b0ce.esm.js +0 -10
  55. package/dist/version-d034b2fc.cjs.dev.js +0 -12
  56. package/dist/version-d2061026.cjs.prod.js +0 -12
@@ -0,0 +1,251 @@
1
+ 'use client';
2
+ import { _ as _createForOfIteratorHelper } from './createForOfIteratorHelper-5758a730.esm.js';
3
+ import { a as _toPropertyKey, _ as _defineProperty } from './defineProperty-cca5affa.esm.js';
4
+ import React from 'react';
5
+ import { jsx } from 'react/jsx-runtime';
6
+ import './unsupportedIterableToArray-5baabfdc.esm.js';
7
+
8
+ function _classCallCheck(a, n) {
9
+ if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function");
10
+ }
11
+
12
+ function _defineProperties(e, r) {
13
+ for (var t = 0; t < r.length; t++) {
14
+ var o = r[t];
15
+ o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o);
16
+ }
17
+ }
18
+ function _createClass(e, r, t) {
19
+ return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", {
20
+ writable: !1
21
+ }), e;
22
+ }
23
+
24
+ var LOAD_TIMEOUT_MS = 10000;
25
+ var ValExternalStore = /*#__PURE__*/function () {
26
+ // Path-keyed cache of every source seen via update(). The single source of
27
+ // truth: load state and snapshots are both derived from this, so data can be
28
+ // queried for any combination of paths even before a subscriber registers.
29
+
30
+ // Reference-stable per-subscriberId snapshot cache for useSyncExternalStore.
31
+ // Built lazily from loadedSources in get() and invalidated in update().
32
+
33
+ // One-shot listeners used solely by waitForLoad. Kept separate from the
34
+ // useSyncExternalStore listeners so waitForLoad never has to register (and
35
+ // leak) a subscriberId.
36
+
37
+ function ValExternalStore() {
38
+ var _this = this;
39
+ _classCallCheck(this, ValExternalStore);
40
+ _defineProperty(this, "subscribe", function (paths) {
41
+ return function (listener) {
42
+ var subscriberId = createSubscriberId(paths);
43
+ var existing = _this.listeners.get(subscriberId);
44
+ if (existing) {
45
+ existing.push(listener);
46
+ } else {
47
+ _this.listeners.set(subscriberId, [listener]);
48
+ }
49
+ return function () {
50
+ var current = _this.listeners.get(subscriberId);
51
+ if (!current) return;
52
+ var idx = current.indexOf(listener);
53
+ if (idx >= 0) current.splice(idx, 1);
54
+ if (current.length === 0) _this.listeners["delete"](subscriberId);
55
+ };
56
+ };
57
+ });
58
+ _defineProperty(this, "getSnapshot", function (paths) {
59
+ return function () {
60
+ return _this.get(paths);
61
+ };
62
+ });
63
+ _defineProperty(this, "getServerSnapshot", function (paths) {
64
+ return function () {
65
+ return _this.get(paths);
66
+ };
67
+ });
68
+ _defineProperty(this, "get", function (paths) {
69
+ var subscriberId = createSubscriberId(paths);
70
+ if (_this.snapshots.has(subscriberId)) {
71
+ return _this.snapshots.get(subscriberId);
72
+ }
73
+ // Build the snapshot from the path-keyed loadedSources so data that arrived
74
+ // before this subscriber registered is still returned. Cache it for a
75
+ // reference-stable result (required by useSyncExternalStore).
76
+ var record;
77
+ var _iterator = _createForOfIteratorHelper(paths),
78
+ _step;
79
+ try {
80
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
81
+ var p = _step.value;
82
+ // Json never holds `undefined`, so a defined value means the path loaded.
83
+ var loaded = _this.loadedSources.get(p);
84
+ if (loaded !== undefined) {
85
+ if (!record) {
86
+ record = {};
87
+ }
88
+ record[p] = loaded;
89
+ }
90
+ }
91
+ } catch (err) {
92
+ _iterator.e(err);
93
+ } finally {
94
+ _iterator.f();
95
+ }
96
+ _this.snapshots.set(subscriberId, record);
97
+ return record;
98
+ });
99
+ _defineProperty(this, "hasAllLoaded", function (paths) {
100
+ var _iterator2 = _createForOfIteratorHelper(paths),
101
+ _step2;
102
+ try {
103
+ for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
104
+ var p = _step2.value;
105
+ if (!_this.loadedSources.has(p)) {
106
+ return false;
107
+ }
108
+ }
109
+ } catch (err) {
110
+ _iterator2.e(err);
111
+ } finally {
112
+ _iterator2.f();
113
+ }
114
+ return true;
115
+ });
116
+ /**
117
+ * Returns a cached promise that resolves once `update()` has populated
118
+ * every path in `paths`. The same promise instance is returned for the
119
+ * same paths until it resolves — required so `React.use` / classic
120
+ * Suspense doesn't re-suspend on every render.
121
+ *
122
+ * If the data never arrives (network failure, a path that is never
123
+ * `update()`'d, a typo in a module path) the promise would otherwise hang
124
+ * forever and keep the Suspense boundary in its fallback. To avoid a silent
125
+ * hang it resolves anyway after `LOAD_TIMEOUT_MS`, logging an error so the
126
+ * failure is diagnosable while the page still renders with partial data.
127
+ */
128
+ _defineProperty(this, "waitForLoad", function (paths) {
129
+ if (_this.hasAllLoaded(paths)) {
130
+ return Promise.resolve();
131
+ }
132
+ var subscriberId = createSubscriberId(paths);
133
+ var existing = _this.loadPromises.get(subscriberId);
134
+ if (existing) {
135
+ return existing;
136
+ }
137
+ var promise = new Promise(function (resolve) {
138
+ var cleanup = function cleanup() {
139
+ clearTimeout(timeout);
140
+ _this.loadListeners["delete"](listener);
141
+ _this.loadPromises["delete"](subscriberId);
142
+ };
143
+ var listener = function listener() {
144
+ if (_this.hasAllLoaded(paths)) {
145
+ cleanup();
146
+ resolve();
147
+ }
148
+ };
149
+ var timeout = setTimeout(function () {
150
+ var missing = paths.filter(function (p) {
151
+ return !_this.loadedSources.has(p);
152
+ });
153
+ console.error("Val: draft module(s) did not load within ".concat(LOAD_TIMEOUT_MS, "ms; rendering with partial data. Missing: ").concat(missing.join(", ")));
154
+ cleanup();
155
+ resolve();
156
+ }, LOAD_TIMEOUT_MS);
157
+ // Don't let the pending timer keep a Node process (e.g. the test runner
158
+ // or SSR) alive; setTimeout returns a number in the browser, where there
159
+ // is nothing to unref.
160
+ if (typeof timeout !== "number") {
161
+ timeout.unref();
162
+ }
163
+ _this.loadListeners.add(listener);
164
+ });
165
+ _this.loadPromises.set(subscriberId, promise);
166
+ return promise;
167
+ });
168
+ this.listeners = new Map();
169
+ this.loadPromises = new Map();
170
+ this.loadedSources = new Map();
171
+ this.snapshots = new Map();
172
+ this.loadListeners = new Set();
173
+ }
174
+ return _createClass(ValExternalStore, [{
175
+ key: "update",
176
+ value: function update(path, source) {
177
+ this.loadedSources.set(path, source);
178
+ // Invalidate cached snapshots that include this path so the next get()
179
+ // rebuilds a fresh (new-reference) record, then notify their listeners.
180
+ for (var _i = 0, _Array$from = Array.from(this.snapshots.keys()); _i < _Array$from.length; _i++) {
181
+ var subscriberId = _Array$from[_i];
182
+ if (subscriberId.includes(path)) {
183
+ // TODO: hash paths instead
184
+ this.snapshots["delete"](subscriberId);
185
+ }
186
+ }
187
+ var _iterator3 = _createForOfIteratorHelper(this.listeners.keys()),
188
+ _step3;
189
+ try {
190
+ for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
191
+ var _subscriberId = _step3.value;
192
+ if (_subscriberId.includes(path)) {
193
+ this.emitChange(_subscriberId);
194
+ }
195
+ }
196
+ } catch (err) {
197
+ _iterator3.e(err);
198
+ } finally {
199
+ _iterator3.f();
200
+ }
201
+ for (var _i2 = 0, _Array$from2 = Array.from(this.loadListeners); _i2 < _Array$from2.length; _i2++) {
202
+ var listener = _Array$from2[_i2];
203
+ listener();
204
+ }
205
+ }
206
+ }, {
207
+ key: "emitChange",
208
+ value: function emitChange(subscriberId) {
209
+ var _this$listeners$get;
210
+ var _iterator4 = _createForOfIteratorHelper((_this$listeners$get = this.listeners.get(subscriberId)) !== null && _this$listeners$get !== void 0 ? _this$listeners$get : []),
211
+ _step4;
212
+ try {
213
+ for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
214
+ var listener = _step4.value;
215
+ listener();
216
+ }
217
+ } catch (err) {
218
+ _iterator4.e(err);
219
+ } finally {
220
+ _iterator4.f();
221
+ }
222
+ }
223
+ }]);
224
+ }();
225
+ function createSubscriberId(paths) {
226
+ return paths.slice().sort().join("&");
227
+ }
228
+ var ValOverlayContext = /*#__PURE__*/React.createContext({
229
+ store: undefined,
230
+ draftMode: false,
231
+ suspend: false
232
+ });
233
+ function ValOverlayProvider(_ref) {
234
+ var store = _ref.store,
235
+ draftMode = _ref.draftMode,
236
+ suspend = _ref.suspend,
237
+ children = _ref.children;
238
+ return /*#__PURE__*/jsx(ValOverlayContext.Provider, {
239
+ value: {
240
+ store: store,
241
+ draftMode: draftMode,
242
+ suspend: suspend
243
+ },
244
+ children: children
245
+ });
246
+ }
247
+ var useValOverlayContext = function useValOverlayContext() {
248
+ return React.useContext(ValOverlayContext);
249
+ };
250
+
251
+ export { ValExternalStore, ValOverlayContext, ValOverlayProvider, useValOverlayContext };
@@ -0,0 +1,262 @@
1
+ 'use client';
2
+ 'use strict';
3
+
4
+ Object.defineProperty(exports, '__esModule', { value: true });
5
+
6
+ var createForOfIteratorHelper = require('./createForOfIteratorHelper-0445603c.cjs.dev.js');
7
+ var defineProperty = require('./defineProperty-f90345d7.cjs.dev.js');
8
+ var React = require('react');
9
+ var jsxRuntime = require('react/jsx-runtime');
10
+ require('./unsupportedIterableToArray-c8ab77c9.cjs.dev.js');
11
+
12
+ function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
13
+
14
+ var React__default = /*#__PURE__*/_interopDefault(React);
15
+
16
+ function _classCallCheck(a, n) {
17
+ if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function");
18
+ }
19
+
20
+ function _defineProperties(e, r) {
21
+ for (var t = 0; t < r.length; t++) {
22
+ var o = r[t];
23
+ o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, defineProperty._toPropertyKey(o.key), o);
24
+ }
25
+ }
26
+ function _createClass(e, r, t) {
27
+ return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", {
28
+ writable: !1
29
+ }), e;
30
+ }
31
+
32
+ var LOAD_TIMEOUT_MS = 10000;
33
+ var ValExternalStore = /*#__PURE__*/function () {
34
+ // Path-keyed cache of every source seen via update(). The single source of
35
+ // truth: load state and snapshots are both derived from this, so data can be
36
+ // queried for any combination of paths even before a subscriber registers.
37
+
38
+ // Reference-stable per-subscriberId snapshot cache for useSyncExternalStore.
39
+ // Built lazily from loadedSources in get() and invalidated in update().
40
+
41
+ // One-shot listeners used solely by waitForLoad. Kept separate from the
42
+ // useSyncExternalStore listeners so waitForLoad never has to register (and
43
+ // leak) a subscriberId.
44
+
45
+ function ValExternalStore() {
46
+ var _this = this;
47
+ _classCallCheck(this, ValExternalStore);
48
+ defineProperty._defineProperty(this, "subscribe", function (paths) {
49
+ return function (listener) {
50
+ var subscriberId = createSubscriberId(paths);
51
+ var existing = _this.listeners.get(subscriberId);
52
+ if (existing) {
53
+ existing.push(listener);
54
+ } else {
55
+ _this.listeners.set(subscriberId, [listener]);
56
+ }
57
+ return function () {
58
+ var current = _this.listeners.get(subscriberId);
59
+ if (!current) return;
60
+ var idx = current.indexOf(listener);
61
+ if (idx >= 0) current.splice(idx, 1);
62
+ if (current.length === 0) _this.listeners["delete"](subscriberId);
63
+ };
64
+ };
65
+ });
66
+ defineProperty._defineProperty(this, "getSnapshot", function (paths) {
67
+ return function () {
68
+ return _this.get(paths);
69
+ };
70
+ });
71
+ defineProperty._defineProperty(this, "getServerSnapshot", function (paths) {
72
+ return function () {
73
+ return _this.get(paths);
74
+ };
75
+ });
76
+ defineProperty._defineProperty(this, "get", function (paths) {
77
+ var subscriberId = createSubscriberId(paths);
78
+ if (_this.snapshots.has(subscriberId)) {
79
+ return _this.snapshots.get(subscriberId);
80
+ }
81
+ // Build the snapshot from the path-keyed loadedSources so data that arrived
82
+ // before this subscriber registered is still returned. Cache it for a
83
+ // reference-stable result (required by useSyncExternalStore).
84
+ var record;
85
+ var _iterator = createForOfIteratorHelper._createForOfIteratorHelper(paths),
86
+ _step;
87
+ try {
88
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
89
+ var p = _step.value;
90
+ // Json never holds `undefined`, so a defined value means the path loaded.
91
+ var loaded = _this.loadedSources.get(p);
92
+ if (loaded !== undefined) {
93
+ if (!record) {
94
+ record = {};
95
+ }
96
+ record[p] = loaded;
97
+ }
98
+ }
99
+ } catch (err) {
100
+ _iterator.e(err);
101
+ } finally {
102
+ _iterator.f();
103
+ }
104
+ _this.snapshots.set(subscriberId, record);
105
+ return record;
106
+ });
107
+ defineProperty._defineProperty(this, "hasAllLoaded", function (paths) {
108
+ var _iterator2 = createForOfIteratorHelper._createForOfIteratorHelper(paths),
109
+ _step2;
110
+ try {
111
+ for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
112
+ var p = _step2.value;
113
+ if (!_this.loadedSources.has(p)) {
114
+ return false;
115
+ }
116
+ }
117
+ } catch (err) {
118
+ _iterator2.e(err);
119
+ } finally {
120
+ _iterator2.f();
121
+ }
122
+ return true;
123
+ });
124
+ /**
125
+ * Returns a cached promise that resolves once `update()` has populated
126
+ * every path in `paths`. The same promise instance is returned for the
127
+ * same paths until it resolves — required so `React.use` / classic
128
+ * Suspense doesn't re-suspend on every render.
129
+ *
130
+ * If the data never arrives (network failure, a path that is never
131
+ * `update()`'d, a typo in a module path) the promise would otherwise hang
132
+ * forever and keep the Suspense boundary in its fallback. To avoid a silent
133
+ * hang it resolves anyway after `LOAD_TIMEOUT_MS`, logging an error so the
134
+ * failure is diagnosable while the page still renders with partial data.
135
+ */
136
+ defineProperty._defineProperty(this, "waitForLoad", function (paths) {
137
+ if (_this.hasAllLoaded(paths)) {
138
+ return Promise.resolve();
139
+ }
140
+ var subscriberId = createSubscriberId(paths);
141
+ var existing = _this.loadPromises.get(subscriberId);
142
+ if (existing) {
143
+ return existing;
144
+ }
145
+ var promise = new Promise(function (resolve) {
146
+ var cleanup = function cleanup() {
147
+ clearTimeout(timeout);
148
+ _this.loadListeners["delete"](listener);
149
+ _this.loadPromises["delete"](subscriberId);
150
+ };
151
+ var listener = function listener() {
152
+ if (_this.hasAllLoaded(paths)) {
153
+ cleanup();
154
+ resolve();
155
+ }
156
+ };
157
+ var timeout = setTimeout(function () {
158
+ var missing = paths.filter(function (p) {
159
+ return !_this.loadedSources.has(p);
160
+ });
161
+ console.error("Val: draft module(s) did not load within ".concat(LOAD_TIMEOUT_MS, "ms; rendering with partial data. Missing: ").concat(missing.join(", ")));
162
+ cleanup();
163
+ resolve();
164
+ }, LOAD_TIMEOUT_MS);
165
+ // Don't let the pending timer keep a Node process (e.g. the test runner
166
+ // or SSR) alive; setTimeout returns a number in the browser, where there
167
+ // is nothing to unref.
168
+ if (typeof timeout !== "number") {
169
+ timeout.unref();
170
+ }
171
+ _this.loadListeners.add(listener);
172
+ });
173
+ _this.loadPromises.set(subscriberId, promise);
174
+ return promise;
175
+ });
176
+ this.listeners = new Map();
177
+ this.loadPromises = new Map();
178
+ this.loadedSources = new Map();
179
+ this.snapshots = new Map();
180
+ this.loadListeners = new Set();
181
+ }
182
+ return _createClass(ValExternalStore, [{
183
+ key: "update",
184
+ value: function update(path, source) {
185
+ this.loadedSources.set(path, source);
186
+ // Invalidate cached snapshots that include this path so the next get()
187
+ // rebuilds a fresh (new-reference) record, then notify their listeners.
188
+ for (var _i = 0, _Array$from = Array.from(this.snapshots.keys()); _i < _Array$from.length; _i++) {
189
+ var subscriberId = _Array$from[_i];
190
+ if (subscriberId.includes(path)) {
191
+ // TODO: hash paths instead
192
+ this.snapshots["delete"](subscriberId);
193
+ }
194
+ }
195
+ var _iterator3 = createForOfIteratorHelper._createForOfIteratorHelper(this.listeners.keys()),
196
+ _step3;
197
+ try {
198
+ for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
199
+ var _subscriberId = _step3.value;
200
+ if (_subscriberId.includes(path)) {
201
+ this.emitChange(_subscriberId);
202
+ }
203
+ }
204
+ } catch (err) {
205
+ _iterator3.e(err);
206
+ } finally {
207
+ _iterator3.f();
208
+ }
209
+ for (var _i2 = 0, _Array$from2 = Array.from(this.loadListeners); _i2 < _Array$from2.length; _i2++) {
210
+ var listener = _Array$from2[_i2];
211
+ listener();
212
+ }
213
+ }
214
+ }, {
215
+ key: "emitChange",
216
+ value: function emitChange(subscriberId) {
217
+ var _this$listeners$get;
218
+ var _iterator4 = createForOfIteratorHelper._createForOfIteratorHelper((_this$listeners$get = this.listeners.get(subscriberId)) !== null && _this$listeners$get !== void 0 ? _this$listeners$get : []),
219
+ _step4;
220
+ try {
221
+ for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
222
+ var listener = _step4.value;
223
+ listener();
224
+ }
225
+ } catch (err) {
226
+ _iterator4.e(err);
227
+ } finally {
228
+ _iterator4.f();
229
+ }
230
+ }
231
+ }]);
232
+ }();
233
+ function createSubscriberId(paths) {
234
+ return paths.slice().sort().join("&");
235
+ }
236
+ var ValOverlayContext = /*#__PURE__*/React__default["default"].createContext({
237
+ store: undefined,
238
+ draftMode: false,
239
+ suspend: false
240
+ });
241
+ function ValOverlayProvider(_ref) {
242
+ var store = _ref.store,
243
+ draftMode = _ref.draftMode,
244
+ suspend = _ref.suspend,
245
+ children = _ref.children;
246
+ return /*#__PURE__*/jsxRuntime.jsx(ValOverlayContext.Provider, {
247
+ value: {
248
+ store: store,
249
+ draftMode: draftMode,
250
+ suspend: suspend
251
+ },
252
+ children: children
253
+ });
254
+ }
255
+ var useValOverlayContext = function useValOverlayContext() {
256
+ return React__default["default"].useContext(ValOverlayContext);
257
+ };
258
+
259
+ exports.ValExternalStore = ValExternalStore;
260
+ exports.ValOverlayContext = ValOverlayContext;
261
+ exports.ValOverlayProvider = ValOverlayProvider;
262
+ exports.useValOverlayContext = useValOverlayContext;
@@ -0,0 +1,7 @@
1
+ 'use strict';
2
+
3
+ if (process.env.NODE_ENV === "production") {
4
+ module.exports = require("./ValOverlayContext-f7f45bc7.cjs.prod.js");
5
+ } else {
6
+ module.exports = require("./ValOverlayContext-f7f45bc7.cjs.dev.js");
7
+ }