@valbuild/next 0.108.1 → 0.108.3
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/client/dist/valbuild-next-client.cjs.dev.js +1 -1
- package/client/dist/valbuild-next-client.cjs.prod.js +1 -1
- package/client/dist/valbuild-next-client.esm.js +1 -1
- package/dist/{ValNextProvider-3209948c.esm.js → ValNextProvider-588f2ff0.esm.js} +74 -4
- package/dist/ValNextProvider-bd3f89d3.cjs.js +7 -0
- package/dist/{ValNextProvider-3fdf8756.cjs.prod.js → ValNextProvider-bd3f89d3.cjs.prod.js} +74 -4
- package/dist/{ValNextProvider-3d8ebfec.cjs.dev.js → ValNextProvider-f206d2ea.cjs.dev.js} +74 -4
- package/dist/{ValOverlayContext-ca3b6ebd.cjs.dev.js → ValOverlayContext-5bd7628b.cjs.dev.js} +31 -1
- package/dist/ValOverlayContext-d690744f.cjs.js +7 -0
- package/dist/{ValOverlayContext-1d019b95.cjs.prod.js → ValOverlayContext-d690744f.cjs.prod.js} +31 -1
- package/dist/{ValOverlayContext-f63e0fc9.esm.js → ValOverlayContext-e42a2e14.esm.js} +31 -1
- package/dist/valbuild-next.cjs.dev.js +1 -1
- package/dist/valbuild-next.cjs.prod.js +1 -1
- package/dist/valbuild-next.esm.js +1 -1
- package/package.json +5 -5
- package/dist/ValNextProvider-3fdf8756.cjs.js +0 -7
- package/dist/ValOverlayContext-1d019b95.cjs.js +0 -7
|
@@ -7,7 +7,7 @@ var routeFromVal = require('../../dist/routeFromVal-b48a454a.cjs.dev.js');
|
|
|
7
7
|
var core = require('@valbuild/core');
|
|
8
8
|
var stega = require('@valbuild/react/stega');
|
|
9
9
|
var React = require('react');
|
|
10
|
-
var ValOverlayContext = require('../../dist/ValOverlayContext-
|
|
10
|
+
var ValOverlayContext = require('../../dist/ValOverlayContext-5bd7628b.cjs.dev.js');
|
|
11
11
|
require('../../dist/createForOfIteratorHelper-0445603c.cjs.dev.js');
|
|
12
12
|
require('../../dist/unsupportedIterableToArray-c8ab77c9.cjs.dev.js');
|
|
13
13
|
require('../../dist/objectSpread2-58024783.cjs.dev.js');
|
|
@@ -7,7 +7,7 @@ var routeFromVal = require('../../dist/routeFromVal-8ac2f984.cjs.prod.js');
|
|
|
7
7
|
var core = require('@valbuild/core');
|
|
8
8
|
var stega = require('@valbuild/react/stega');
|
|
9
9
|
var React = require('react');
|
|
10
|
-
var ValOverlayContext = require('../../dist/ValOverlayContext-
|
|
10
|
+
var ValOverlayContext = require('../../dist/ValOverlayContext-d690744f.cjs.prod.js');
|
|
11
11
|
require('../../dist/createForOfIteratorHelper-d4afcad8.cjs.prod.js');
|
|
12
12
|
require('../../dist/unsupportedIterableToArray-0d2087a2.cjs.prod.js');
|
|
13
13
|
require('../../dist/objectSpread2-13f847a9.cjs.prod.js');
|
|
@@ -3,7 +3,7 @@ import { g as getJsonEntryStegaRoot, _ as _typeof, a as isJsonValuesRecordSchema
|
|
|
3
3
|
import { Internal } from '@valbuild/core';
|
|
4
4
|
import { getModuleIds, stegaEncode } from '@valbuild/react/stega';
|
|
5
5
|
import React from 'react';
|
|
6
|
-
import { useValOverlayContext } from '../../dist/ValOverlayContext-
|
|
6
|
+
import { useValOverlayContext } from '../../dist/ValOverlayContext-e42a2e14.esm.js';
|
|
7
7
|
import '../../dist/createForOfIteratorHelper-5758a730.esm.js';
|
|
8
8
|
import '../../dist/unsupportedIterableToArray-5baabfdc.esm.js';
|
|
9
9
|
import '../../dist/objectSpread2-60d1bd93.esm.js';
|
|
@@ -6,7 +6,7 @@ import { VERSION, VAL_APP_PATH, VAL_OVERLAY_ID } from '@valbuild/ui';
|
|
|
6
6
|
import { useRouter, usePathname } from 'next/navigation';
|
|
7
7
|
import Script from 'next/script';
|
|
8
8
|
import React, { useEffect } from 'react';
|
|
9
|
-
import { ValExternalStore, ValOverlayProvider } from './ValOverlayContext-
|
|
9
|
+
import { ValExternalStore, ValOverlayProvider } from './ValOverlayContext-e42a2e14.esm.js';
|
|
10
10
|
import { SET_AUTO_TAG_JSX_ENABLED } from '@valbuild/react/stega';
|
|
11
11
|
import { VAL_THEME_SESSION_STORAGE_KEY, createValClient, isValCanvasFrame } from '@valbuild/shared/internal';
|
|
12
12
|
import { p as prefixStyles, u as useConfigStorageSave, f as floatDarkBg, d as floatLightBg, v as valPrefixedClass, c as cn } from './fallbackColors-5ead2c26.esm.js';
|
|
@@ -137,6 +137,38 @@ var SAFETY_REFRESH_WINDOW_MS = 30000;
|
|
|
137
137
|
* be torn down and rebuilt per keystroke.
|
|
138
138
|
*/
|
|
139
139
|
var VAL_EDIT_LANDED = "val-edit-landed";
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* How often `/draft/stat` is asked when nothing is in progress.
|
|
143
|
+
*
|
|
144
|
+
* Draft mode changes when someone toggles it, which the handshake below already
|
|
145
|
+
* covers — so this is only there to notice it being changed somewhere else.
|
|
146
|
+
*/
|
|
147
|
+
var DRAFT_IDLE_POLL_MS = 20000;
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* And how often while the enable/disable handshake is in flight.
|
|
151
|
+
*
|
|
152
|
+
* Fast on purpose: the hidden iframe redirects through `/draft/enable`, and the
|
|
153
|
+
* page cannot do anything useful until that has landed.
|
|
154
|
+
*/
|
|
155
|
+
var DRAFT_HANDSHAKE_POLL_MS = 100;
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* How long that fast phase may last before it gives up.
|
|
159
|
+
*
|
|
160
|
+
* Without a deadline it does not end: the only thing that clears `iframeSrc` is
|
|
161
|
+
* a `val-ready` message posted by the redirect target, so a frame that fails to
|
|
162
|
+
* load — a 500, an auth redirect, a dev server still compiling — left the page
|
|
163
|
+
* asking ten times a second, forever. A browser runs about six connections per
|
|
164
|
+
* origin, so that is enough to push `/stat`, `/patches` and the canvas document
|
|
165
|
+
* itself into the browser's own queue, where they are indistinguishable from a
|
|
166
|
+
* slow server.
|
|
167
|
+
*
|
|
168
|
+
* Generous enough for a first compile in `next dev`, which is the slowest case
|
|
169
|
+
* that is not a fault.
|
|
170
|
+
*/
|
|
171
|
+
var DRAFT_HANDSHAKE_TIMEOUT_MS = 10000;
|
|
140
172
|
var ValNextProvider = function ValNextProvider(props) {
|
|
141
173
|
var _draftModeReady$curre2;
|
|
142
174
|
// TODO: use config:
|
|
@@ -482,9 +514,32 @@ var ValNextProvider = function ValNextProvider(props) {
|
|
|
482
514
|
return;
|
|
483
515
|
}
|
|
484
516
|
pollDraftStatIdRef.current--;
|
|
485
|
-
|
|
517
|
+
var handshaking = iframeSrc !== null;
|
|
518
|
+
if (handshaking && Date.now() - startedAt > DRAFT_HANDSHAKE_TIMEOUT_MS) {
|
|
519
|
+
/**
|
|
520
|
+
* The handshake did not complete, so stop hammering.
|
|
521
|
+
*
|
|
522
|
+
* Clearing `iframeSrc` unmounts the hidden frame and takes the poll
|
|
523
|
+
* back to its idle interval — which is the honest state: nothing is
|
|
524
|
+
* in progress any more. Leaving it set is what made this
|
|
525
|
+
* unrecoverable, because the ONLY other thing that clears it is the
|
|
526
|
+
* `val-ready` message the frame never sent.
|
|
527
|
+
*/
|
|
528
|
+
console.warn("Val: draft mode did not confirm in time. Falling back to the " + "idle poll — try toggling preview again.");
|
|
529
|
+
setIframeSrc(null);
|
|
530
|
+
return;
|
|
531
|
+
}
|
|
532
|
+
timeout = setTimeout(pollCurrentDraftMode, handshaking ? DRAFT_HANDSHAKE_POLL_MS : DRAFT_IDLE_POLL_MS);
|
|
486
533
|
});
|
|
487
534
|
}
|
|
535
|
+
/**
|
|
536
|
+
* When this spell of polling began.
|
|
537
|
+
*
|
|
538
|
+
* The effect re-runs when `iframeSrc` changes, so for the fast phase this is
|
|
539
|
+
* the moment the handshake started — which is what the deadline below is
|
|
540
|
+
* measured from.
|
|
541
|
+
*/
|
|
542
|
+
var startedAt = Date.now();
|
|
488
543
|
pollCurrentDraftMode();
|
|
489
544
|
return function () {
|
|
490
545
|
clearTimeout(timeout);
|
|
@@ -519,8 +574,23 @@ var ValNextProvider = function ValNextProvider(props) {
|
|
|
519
574
|
var moduleFilePath = (_event$detail3 = event.detail) === null || _event$detail3 === void 0 ? void 0 : _event$detail3.moduleFilePath;
|
|
520
575
|
var source = (_event$detail4 = event.detail) === null || _event$detail4 === void 0 ? void 0 : _event$detail4.source;
|
|
521
576
|
if (typeof moduleFilePath === "string" && source !== undefined) {
|
|
522
|
-
valStore.update(moduleFilePath, source);
|
|
523
|
-
|
|
577
|
+
var changed = valStore.update(moduleFilePath, source);
|
|
578
|
+
/**
|
|
579
|
+
* Armed by a CHANGE, not by a message.
|
|
580
|
+
*
|
|
581
|
+
* The editor re-sends everything it holds whenever this page
|
|
582
|
+
* becomes a new document — a reload, or the one `next dev` does
|
|
583
|
+
* when a publish rewrites the `.val.ts` files — and most of that
|
|
584
|
+
* snapshot is content this page already has. Counting those
|
|
585
|
+
* bought a whole-route request per publish whether or not the
|
|
586
|
+
* page was out of date, which with auto-save on is one per pause
|
|
587
|
+
* in typing.
|
|
588
|
+
*
|
|
589
|
+
* The catch-up that MATTERS still refreshes: a page whose server
|
|
590
|
+
* render predates the write has no value for that module, so the
|
|
591
|
+
* first arrival counts as a change.
|
|
592
|
+
*/
|
|
593
|
+
if (changed && !props.disableRefresh) {
|
|
524
594
|
rerenderCounterRef.current++;
|
|
525
595
|
window.dispatchEvent(new Event(VAL_EDIT_LANDED));
|
|
526
596
|
}
|
|
@@ -10,7 +10,7 @@ var ui = require('@valbuild/ui');
|
|
|
10
10
|
var navigation = require('next/navigation');
|
|
11
11
|
var Script = require('next/script');
|
|
12
12
|
var React = require('react');
|
|
13
|
-
var ValOverlayContext = require('./ValOverlayContext-
|
|
13
|
+
var ValOverlayContext = require('./ValOverlayContext-d690744f.cjs.prod.js');
|
|
14
14
|
var stega = require('@valbuild/react/stega');
|
|
15
15
|
var internal = require('@valbuild/shared/internal');
|
|
16
16
|
var fallbackColors = require('./fallbackColors-d4a5b0da.cjs.prod.js');
|
|
@@ -146,6 +146,38 @@ var SAFETY_REFRESH_WINDOW_MS = 30000;
|
|
|
146
146
|
* be torn down and rebuilt per keystroke.
|
|
147
147
|
*/
|
|
148
148
|
var VAL_EDIT_LANDED = "val-edit-landed";
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* How often `/draft/stat` is asked when nothing is in progress.
|
|
152
|
+
*
|
|
153
|
+
* Draft mode changes when someone toggles it, which the handshake below already
|
|
154
|
+
* covers — so this is only there to notice it being changed somewhere else.
|
|
155
|
+
*/
|
|
156
|
+
var DRAFT_IDLE_POLL_MS = 20000;
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* And how often while the enable/disable handshake is in flight.
|
|
160
|
+
*
|
|
161
|
+
* Fast on purpose: the hidden iframe redirects through `/draft/enable`, and the
|
|
162
|
+
* page cannot do anything useful until that has landed.
|
|
163
|
+
*/
|
|
164
|
+
var DRAFT_HANDSHAKE_POLL_MS = 100;
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* How long that fast phase may last before it gives up.
|
|
168
|
+
*
|
|
169
|
+
* Without a deadline it does not end: the only thing that clears `iframeSrc` is
|
|
170
|
+
* a `val-ready` message posted by the redirect target, so a frame that fails to
|
|
171
|
+
* load — a 500, an auth redirect, a dev server still compiling — left the page
|
|
172
|
+
* asking ten times a second, forever. A browser runs about six connections per
|
|
173
|
+
* origin, so that is enough to push `/stat`, `/patches` and the canvas document
|
|
174
|
+
* itself into the browser's own queue, where they are indistinguishable from a
|
|
175
|
+
* slow server.
|
|
176
|
+
*
|
|
177
|
+
* Generous enough for a first compile in `next dev`, which is the slowest case
|
|
178
|
+
* that is not a fault.
|
|
179
|
+
*/
|
|
180
|
+
var DRAFT_HANDSHAKE_TIMEOUT_MS = 10000;
|
|
149
181
|
var ValNextProvider = function ValNextProvider(props) {
|
|
150
182
|
var _draftModeReady$curre2;
|
|
151
183
|
// TODO: use config:
|
|
@@ -491,9 +523,32 @@ var ValNextProvider = function ValNextProvider(props) {
|
|
|
491
523
|
return;
|
|
492
524
|
}
|
|
493
525
|
pollDraftStatIdRef.current--;
|
|
494
|
-
|
|
526
|
+
var handshaking = iframeSrc !== null;
|
|
527
|
+
if (handshaking && Date.now() - startedAt > DRAFT_HANDSHAKE_TIMEOUT_MS) {
|
|
528
|
+
/**
|
|
529
|
+
* The handshake did not complete, so stop hammering.
|
|
530
|
+
*
|
|
531
|
+
* Clearing `iframeSrc` unmounts the hidden frame and takes the poll
|
|
532
|
+
* back to its idle interval — which is the honest state: nothing is
|
|
533
|
+
* in progress any more. Leaving it set is what made this
|
|
534
|
+
* unrecoverable, because the ONLY other thing that clears it is the
|
|
535
|
+
* `val-ready` message the frame never sent.
|
|
536
|
+
*/
|
|
537
|
+
console.warn("Val: draft mode did not confirm in time. Falling back to the " + "idle poll — try toggling preview again.");
|
|
538
|
+
setIframeSrc(null);
|
|
539
|
+
return;
|
|
540
|
+
}
|
|
541
|
+
timeout = setTimeout(pollCurrentDraftMode, handshaking ? DRAFT_HANDSHAKE_POLL_MS : DRAFT_IDLE_POLL_MS);
|
|
495
542
|
});
|
|
496
543
|
}
|
|
544
|
+
/**
|
|
545
|
+
* When this spell of polling began.
|
|
546
|
+
*
|
|
547
|
+
* The effect re-runs when `iframeSrc` changes, so for the fast phase this is
|
|
548
|
+
* the moment the handshake started — which is what the deadline below is
|
|
549
|
+
* measured from.
|
|
550
|
+
*/
|
|
551
|
+
var startedAt = Date.now();
|
|
497
552
|
pollCurrentDraftMode();
|
|
498
553
|
return function () {
|
|
499
554
|
clearTimeout(timeout);
|
|
@@ -528,8 +583,23 @@ var ValNextProvider = function ValNextProvider(props) {
|
|
|
528
583
|
var moduleFilePath = (_event$detail3 = event.detail) === null || _event$detail3 === void 0 ? void 0 : _event$detail3.moduleFilePath;
|
|
529
584
|
var source = (_event$detail4 = event.detail) === null || _event$detail4 === void 0 ? void 0 : _event$detail4.source;
|
|
530
585
|
if (typeof moduleFilePath === "string" && source !== undefined) {
|
|
531
|
-
valStore.update(moduleFilePath, source);
|
|
532
|
-
|
|
586
|
+
var changed = valStore.update(moduleFilePath, source);
|
|
587
|
+
/**
|
|
588
|
+
* Armed by a CHANGE, not by a message.
|
|
589
|
+
*
|
|
590
|
+
* The editor re-sends everything it holds whenever this page
|
|
591
|
+
* becomes a new document — a reload, or the one `next dev` does
|
|
592
|
+
* when a publish rewrites the `.val.ts` files — and most of that
|
|
593
|
+
* snapshot is content this page already has. Counting those
|
|
594
|
+
* bought a whole-route request per publish whether or not the
|
|
595
|
+
* page was out of date, which with auto-save on is one per pause
|
|
596
|
+
* in typing.
|
|
597
|
+
*
|
|
598
|
+
* The catch-up that MATTERS still refreshes: a page whose server
|
|
599
|
+
* render predates the write has no value for that module, so the
|
|
600
|
+
* first arrival counts as a change.
|
|
601
|
+
*/
|
|
602
|
+
if (changed && !props.disableRefresh) {
|
|
533
603
|
rerenderCounterRef.current++;
|
|
534
604
|
window.dispatchEvent(new Event(VAL_EDIT_LANDED));
|
|
535
605
|
}
|
|
@@ -10,7 +10,7 @@ var ui = require('@valbuild/ui');
|
|
|
10
10
|
var navigation = require('next/navigation');
|
|
11
11
|
var Script = require('next/script');
|
|
12
12
|
var React = require('react');
|
|
13
|
-
var ValOverlayContext = require('./ValOverlayContext-
|
|
13
|
+
var ValOverlayContext = require('./ValOverlayContext-5bd7628b.cjs.dev.js');
|
|
14
14
|
var stega = require('@valbuild/react/stega');
|
|
15
15
|
var internal = require('@valbuild/shared/internal');
|
|
16
16
|
var fallbackColors = require('./fallbackColors-9a2ac53a.cjs.dev.js');
|
|
@@ -146,6 +146,38 @@ var SAFETY_REFRESH_WINDOW_MS = 30000;
|
|
|
146
146
|
* be torn down and rebuilt per keystroke.
|
|
147
147
|
*/
|
|
148
148
|
var VAL_EDIT_LANDED = "val-edit-landed";
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* How often `/draft/stat` is asked when nothing is in progress.
|
|
152
|
+
*
|
|
153
|
+
* Draft mode changes when someone toggles it, which the handshake below already
|
|
154
|
+
* covers — so this is only there to notice it being changed somewhere else.
|
|
155
|
+
*/
|
|
156
|
+
var DRAFT_IDLE_POLL_MS = 20000;
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* And how often while the enable/disable handshake is in flight.
|
|
160
|
+
*
|
|
161
|
+
* Fast on purpose: the hidden iframe redirects through `/draft/enable`, and the
|
|
162
|
+
* page cannot do anything useful until that has landed.
|
|
163
|
+
*/
|
|
164
|
+
var DRAFT_HANDSHAKE_POLL_MS = 100;
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* How long that fast phase may last before it gives up.
|
|
168
|
+
*
|
|
169
|
+
* Without a deadline it does not end: the only thing that clears `iframeSrc` is
|
|
170
|
+
* a `val-ready` message posted by the redirect target, so a frame that fails to
|
|
171
|
+
* load — a 500, an auth redirect, a dev server still compiling — left the page
|
|
172
|
+
* asking ten times a second, forever. A browser runs about six connections per
|
|
173
|
+
* origin, so that is enough to push `/stat`, `/patches` and the canvas document
|
|
174
|
+
* itself into the browser's own queue, where they are indistinguishable from a
|
|
175
|
+
* slow server.
|
|
176
|
+
*
|
|
177
|
+
* Generous enough for a first compile in `next dev`, which is the slowest case
|
|
178
|
+
* that is not a fault.
|
|
179
|
+
*/
|
|
180
|
+
var DRAFT_HANDSHAKE_TIMEOUT_MS = 10000;
|
|
149
181
|
var ValNextProvider = function ValNextProvider(props) {
|
|
150
182
|
var _draftModeReady$curre2;
|
|
151
183
|
// TODO: use config:
|
|
@@ -491,9 +523,32 @@ var ValNextProvider = function ValNextProvider(props) {
|
|
|
491
523
|
return;
|
|
492
524
|
}
|
|
493
525
|
pollDraftStatIdRef.current--;
|
|
494
|
-
|
|
526
|
+
var handshaking = iframeSrc !== null;
|
|
527
|
+
if (handshaking && Date.now() - startedAt > DRAFT_HANDSHAKE_TIMEOUT_MS) {
|
|
528
|
+
/**
|
|
529
|
+
* The handshake did not complete, so stop hammering.
|
|
530
|
+
*
|
|
531
|
+
* Clearing `iframeSrc` unmounts the hidden frame and takes the poll
|
|
532
|
+
* back to its idle interval — which is the honest state: nothing is
|
|
533
|
+
* in progress any more. Leaving it set is what made this
|
|
534
|
+
* unrecoverable, because the ONLY other thing that clears it is the
|
|
535
|
+
* `val-ready` message the frame never sent.
|
|
536
|
+
*/
|
|
537
|
+
console.warn("Val: draft mode did not confirm in time. Falling back to the " + "idle poll — try toggling preview again.");
|
|
538
|
+
setIframeSrc(null);
|
|
539
|
+
return;
|
|
540
|
+
}
|
|
541
|
+
timeout = setTimeout(pollCurrentDraftMode, handshaking ? DRAFT_HANDSHAKE_POLL_MS : DRAFT_IDLE_POLL_MS);
|
|
495
542
|
});
|
|
496
543
|
}
|
|
544
|
+
/**
|
|
545
|
+
* When this spell of polling began.
|
|
546
|
+
*
|
|
547
|
+
* The effect re-runs when `iframeSrc` changes, so for the fast phase this is
|
|
548
|
+
* the moment the handshake started — which is what the deadline below is
|
|
549
|
+
* measured from.
|
|
550
|
+
*/
|
|
551
|
+
var startedAt = Date.now();
|
|
497
552
|
pollCurrentDraftMode();
|
|
498
553
|
return function () {
|
|
499
554
|
clearTimeout(timeout);
|
|
@@ -528,8 +583,23 @@ var ValNextProvider = function ValNextProvider(props) {
|
|
|
528
583
|
var moduleFilePath = (_event$detail3 = event.detail) === null || _event$detail3 === void 0 ? void 0 : _event$detail3.moduleFilePath;
|
|
529
584
|
var source = (_event$detail4 = event.detail) === null || _event$detail4 === void 0 ? void 0 : _event$detail4.source;
|
|
530
585
|
if (typeof moduleFilePath === "string" && source !== undefined) {
|
|
531
|
-
valStore.update(moduleFilePath, source);
|
|
532
|
-
|
|
586
|
+
var changed = valStore.update(moduleFilePath, source);
|
|
587
|
+
/**
|
|
588
|
+
* Armed by a CHANGE, not by a message.
|
|
589
|
+
*
|
|
590
|
+
* The editor re-sends everything it holds whenever this page
|
|
591
|
+
* becomes a new document — a reload, or the one `next dev` does
|
|
592
|
+
* when a publish rewrites the `.val.ts` files — and most of that
|
|
593
|
+
* snapshot is content this page already has. Counting those
|
|
594
|
+
* bought a whole-route request per publish whether or not the
|
|
595
|
+
* page was out of date, which with auto-save on is one per pause
|
|
596
|
+
* in typing.
|
|
597
|
+
*
|
|
598
|
+
* The catch-up that MATTERS still refreshes: a page whose server
|
|
599
|
+
* render predates the write has no value for that module, so the
|
|
600
|
+
* first arrival counts as a change.
|
|
601
|
+
*/
|
|
602
|
+
if (changed && !props.disableRefresh) {
|
|
533
603
|
rerenderCounterRef.current++;
|
|
534
604
|
window.dispatchEvent(new Event(VAL_EDIT_LANDED));
|
|
535
605
|
}
|
package/dist/{ValOverlayContext-ca3b6ebd.cjs.dev.js → ValOverlayContext-5bd7628b.cjs.dev.js}
RENAMED
|
@@ -5,6 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
|
|
6
6
|
var createForOfIteratorHelper = require('./createForOfIteratorHelper-0445603c.cjs.dev.js');
|
|
7
7
|
var defineProperty = require('./defineProperty-f90345d7.cjs.dev.js');
|
|
8
|
+
var patch = require('@valbuild/core/patch');
|
|
8
9
|
var React = require('react');
|
|
9
10
|
var jsxRuntime = require('react/jsx-runtime');
|
|
10
11
|
require('./unsupportedIterableToArray-c8ab77c9.cjs.dev.js');
|
|
@@ -181,8 +182,36 @@ var ValExternalStore = /*#__PURE__*/function () {
|
|
|
181
182
|
}
|
|
182
183
|
return _createClass(ValExternalStore, [{
|
|
183
184
|
key: "update",
|
|
184
|
-
value:
|
|
185
|
+
value:
|
|
186
|
+
/**
|
|
187
|
+
* Take a module's source from the editor.
|
|
188
|
+
*
|
|
189
|
+
* Returns whether this actually MOVED the value, which the caller needs and
|
|
190
|
+
* cannot work out for itself: the same source arrives more than once by
|
|
191
|
+
* design. The editor sends a catch-up snapshot of everything it holds every
|
|
192
|
+
* time the page becomes a new document — a reload, or the one `next dev` does
|
|
193
|
+
* when a publish rewrites the `.val.ts` files — and most of that snapshot is
|
|
194
|
+
* content this page already has.
|
|
195
|
+
*
|
|
196
|
+
* Without the answer, `ValNextProvider` armed its `router.refresh()` loop on
|
|
197
|
+
* the arrival rather than on the change, so every publish bought a whole-route
|
|
198
|
+
* request whether or not the page was out of date. With auto-save on that is
|
|
199
|
+
* one per pause in typing, which in development is a re-render (and sometimes
|
|
200
|
+
* a recompile) of the page — and it is what leaves the canvas looking
|
|
201
|
+
* permanently busy.
|
|
202
|
+
*/
|
|
203
|
+
function update(path, source) {
|
|
204
|
+
// `Json` has no `undefined`, so absent and "stored as undefined" cannot be
|
|
205
|
+
// confused: a miss here means this page has never been given this module.
|
|
206
|
+
var before = this.loadedSources.get(path);
|
|
207
|
+
var changed = before === undefined || !patch.deepEqual(before, source);
|
|
185
208
|
this.loadedSources.set(path, source);
|
|
209
|
+
if (!changed) {
|
|
210
|
+
// Nothing downstream to do: every subscriber's snapshot still answers
|
|
211
|
+
// with the same value, so invalidating them would be a re-render that
|
|
212
|
+
// shows exactly what is already on screen.
|
|
213
|
+
return false;
|
|
214
|
+
}
|
|
186
215
|
// Invalidate cached snapshots that include this path so the next get()
|
|
187
216
|
// rebuilds a fresh (new-reference) record, then notify their listeners.
|
|
188
217
|
for (var _i = 0, _Array$from = Array.from(this.snapshots.keys()); _i < _Array$from.length; _i++) {
|
|
@@ -210,6 +239,7 @@ var ValExternalStore = /*#__PURE__*/function () {
|
|
|
210
239
|
var listener = _Array$from2[_i2];
|
|
211
240
|
listener();
|
|
212
241
|
}
|
|
242
|
+
return true;
|
|
213
243
|
}
|
|
214
244
|
}, {
|
|
215
245
|
key: "emitChange",
|
package/dist/{ValOverlayContext-1d019b95.cjs.prod.js → ValOverlayContext-d690744f.cjs.prod.js}
RENAMED
|
@@ -5,6 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
|
|
6
6
|
var createForOfIteratorHelper = require('./createForOfIteratorHelper-d4afcad8.cjs.prod.js');
|
|
7
7
|
var defineProperty = require('./defineProperty-8951f469.cjs.prod.js');
|
|
8
|
+
var patch = require('@valbuild/core/patch');
|
|
8
9
|
var React = require('react');
|
|
9
10
|
var jsxRuntime = require('react/jsx-runtime');
|
|
10
11
|
require('./unsupportedIterableToArray-0d2087a2.cjs.prod.js');
|
|
@@ -181,8 +182,36 @@ var ValExternalStore = /*#__PURE__*/function () {
|
|
|
181
182
|
}
|
|
182
183
|
return _createClass(ValExternalStore, [{
|
|
183
184
|
key: "update",
|
|
184
|
-
value:
|
|
185
|
+
value:
|
|
186
|
+
/**
|
|
187
|
+
* Take a module's source from the editor.
|
|
188
|
+
*
|
|
189
|
+
* Returns whether this actually MOVED the value, which the caller needs and
|
|
190
|
+
* cannot work out for itself: the same source arrives more than once by
|
|
191
|
+
* design. The editor sends a catch-up snapshot of everything it holds every
|
|
192
|
+
* time the page becomes a new document — a reload, or the one `next dev` does
|
|
193
|
+
* when a publish rewrites the `.val.ts` files — and most of that snapshot is
|
|
194
|
+
* content this page already has.
|
|
195
|
+
*
|
|
196
|
+
* Without the answer, `ValNextProvider` armed its `router.refresh()` loop on
|
|
197
|
+
* the arrival rather than on the change, so every publish bought a whole-route
|
|
198
|
+
* request whether or not the page was out of date. With auto-save on that is
|
|
199
|
+
* one per pause in typing, which in development is a re-render (and sometimes
|
|
200
|
+
* a recompile) of the page — and it is what leaves the canvas looking
|
|
201
|
+
* permanently busy.
|
|
202
|
+
*/
|
|
203
|
+
function update(path, source) {
|
|
204
|
+
// `Json` has no `undefined`, so absent and "stored as undefined" cannot be
|
|
205
|
+
// confused: a miss here means this page has never been given this module.
|
|
206
|
+
var before = this.loadedSources.get(path);
|
|
207
|
+
var changed = before === undefined || !patch.deepEqual(before, source);
|
|
185
208
|
this.loadedSources.set(path, source);
|
|
209
|
+
if (!changed) {
|
|
210
|
+
// Nothing downstream to do: every subscriber's snapshot still answers
|
|
211
|
+
// with the same value, so invalidating them would be a re-render that
|
|
212
|
+
// shows exactly what is already on screen.
|
|
213
|
+
return false;
|
|
214
|
+
}
|
|
186
215
|
// Invalidate cached snapshots that include this path so the next get()
|
|
187
216
|
// rebuilds a fresh (new-reference) record, then notify their listeners.
|
|
188
217
|
for (var _i = 0, _Array$from = Array.from(this.snapshots.keys()); _i < _Array$from.length; _i++) {
|
|
@@ -210,6 +239,7 @@ var ValExternalStore = /*#__PURE__*/function () {
|
|
|
210
239
|
var listener = _Array$from2[_i2];
|
|
211
240
|
listener();
|
|
212
241
|
}
|
|
242
|
+
return true;
|
|
213
243
|
}
|
|
214
244
|
}, {
|
|
215
245
|
key: "emitChange",
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { _ as _createForOfIteratorHelper } from './createForOfIteratorHelper-5758a730.esm.js';
|
|
3
3
|
import { a as _toPropertyKey, _ as _defineProperty } from './defineProperty-cca5affa.esm.js';
|
|
4
|
+
import { deepEqual } from '@valbuild/core/patch';
|
|
4
5
|
import React from 'react';
|
|
5
6
|
import { jsx } from 'react/jsx-runtime';
|
|
6
7
|
import './unsupportedIterableToArray-5baabfdc.esm.js';
|
|
@@ -173,8 +174,36 @@ var ValExternalStore = /*#__PURE__*/function () {
|
|
|
173
174
|
}
|
|
174
175
|
return _createClass(ValExternalStore, [{
|
|
175
176
|
key: "update",
|
|
176
|
-
value:
|
|
177
|
+
value:
|
|
178
|
+
/**
|
|
179
|
+
* Take a module's source from the editor.
|
|
180
|
+
*
|
|
181
|
+
* Returns whether this actually MOVED the value, which the caller needs and
|
|
182
|
+
* cannot work out for itself: the same source arrives more than once by
|
|
183
|
+
* design. The editor sends a catch-up snapshot of everything it holds every
|
|
184
|
+
* time the page becomes a new document — a reload, or the one `next dev` does
|
|
185
|
+
* when a publish rewrites the `.val.ts` files — and most of that snapshot is
|
|
186
|
+
* content this page already has.
|
|
187
|
+
*
|
|
188
|
+
* Without the answer, `ValNextProvider` armed its `router.refresh()` loop on
|
|
189
|
+
* the arrival rather than on the change, so every publish bought a whole-route
|
|
190
|
+
* request whether or not the page was out of date. With auto-save on that is
|
|
191
|
+
* one per pause in typing, which in development is a re-render (and sometimes
|
|
192
|
+
* a recompile) of the page — and it is what leaves the canvas looking
|
|
193
|
+
* permanently busy.
|
|
194
|
+
*/
|
|
195
|
+
function update(path, source) {
|
|
196
|
+
// `Json` has no `undefined`, so absent and "stored as undefined" cannot be
|
|
197
|
+
// confused: a miss here means this page has never been given this module.
|
|
198
|
+
var before = this.loadedSources.get(path);
|
|
199
|
+
var changed = before === undefined || !deepEqual(before, source);
|
|
177
200
|
this.loadedSources.set(path, source);
|
|
201
|
+
if (!changed) {
|
|
202
|
+
// Nothing downstream to do: every subscriber's snapshot still answers
|
|
203
|
+
// with the same value, so invalidating them would be a re-render that
|
|
204
|
+
// shows exactly what is already on screen.
|
|
205
|
+
return false;
|
|
206
|
+
}
|
|
178
207
|
// Invalidate cached snapshots that include this path so the next get()
|
|
179
208
|
// rebuilds a fresh (new-reference) record, then notify their listeners.
|
|
180
209
|
for (var _i = 0, _Array$from = Array.from(this.snapshots.keys()); _i < _Array$from.length; _i++) {
|
|
@@ -202,6 +231,7 @@ var ValExternalStore = /*#__PURE__*/function () {
|
|
|
202
231
|
var listener = _Array$from2[_i2];
|
|
203
232
|
listener();
|
|
204
233
|
}
|
|
234
|
+
return true;
|
|
205
235
|
}
|
|
206
236
|
}, {
|
|
207
237
|
key: "emitChange",
|
|
@@ -7,7 +7,7 @@ var objectSpread2 = require('./objectSpread2-58024783.cjs.dev.js');
|
|
|
7
7
|
var core = require('@valbuild/core');
|
|
8
8
|
var stega = require('@valbuild/react/stega');
|
|
9
9
|
var internal = require('@valbuild/react/internal');
|
|
10
|
-
var ValNextProvider = require('./ValNextProvider-
|
|
10
|
+
var ValNextProvider = require('./ValNextProvider-f206d2ea.cjs.dev.js');
|
|
11
11
|
var NextImage = require('next/image');
|
|
12
12
|
var jsxRuntime = require('react/jsx-runtime');
|
|
13
13
|
var ValApp = require('./ValApp-c1c3ef55.cjs.dev.js');
|
|
@@ -7,7 +7,7 @@ var objectSpread2 = require('./objectSpread2-13f847a9.cjs.prod.js');
|
|
|
7
7
|
var core = require('@valbuild/core');
|
|
8
8
|
var stega = require('@valbuild/react/stega');
|
|
9
9
|
var internal = require('@valbuild/react/internal');
|
|
10
|
-
var ValNextProvider = require('./ValNextProvider-
|
|
10
|
+
var ValNextProvider = require('./ValNextProvider-bd3f89d3.cjs.prod.js');
|
|
11
11
|
var NextImage = require('next/image');
|
|
12
12
|
var jsxRuntime = require('react/jsx-runtime');
|
|
13
13
|
var ValApp = require('./ValApp-90c4171d.cjs.prod.js');
|
|
@@ -6,7 +6,7 @@ export { core as expr };
|
|
|
6
6
|
export { GenericSelector, Schema, VAL_EXTENSION, derefPatch, modules } from '@valbuild/core';
|
|
7
7
|
import { stegaEncode, stegaDecodeStrings, attrs, raw, autoTagJSX } from '@valbuild/react/stega';
|
|
8
8
|
export { ValRichText } from '@valbuild/react/internal';
|
|
9
|
-
import { ValNextProvider } from './ValNextProvider-
|
|
9
|
+
import { ValNextProvider } from './ValNextProvider-588f2ff0.esm.js';
|
|
10
10
|
import NextImage from 'next/image';
|
|
11
11
|
import { jsx } from 'react/jsx-runtime';
|
|
12
12
|
export { ValApp } from './ValApp-e17eb734.esm.js';
|
package/package.json
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"next",
|
|
13
13
|
"react"
|
|
14
14
|
],
|
|
15
|
-
"version": "0.108.
|
|
15
|
+
"version": "0.108.3",
|
|
16
16
|
"main": "dist/valbuild-next.cjs.js",
|
|
17
17
|
"module": "dist/valbuild-next.esm.js",
|
|
18
18
|
"exports": {
|
|
@@ -47,12 +47,12 @@
|
|
|
47
47
|
"dependencies": {
|
|
48
48
|
"client-only": "^0.0.1",
|
|
49
49
|
"server-only": "^0.0.1",
|
|
50
|
-
"@valbuild/react": "0.108.1",
|
|
51
|
-
"@valbuild/language-server": "0.108.1",
|
|
52
50
|
"@valbuild/core": "0.106.0",
|
|
53
|
-
"@valbuild/server": "0.108.
|
|
51
|
+
"@valbuild/language-server": "0.108.3",
|
|
52
|
+
"@valbuild/server": "0.108.3",
|
|
53
|
+
"@valbuild/react": "0.108.3",
|
|
54
54
|
"@valbuild/shared": "0.108.0",
|
|
55
|
-
"@valbuild/ui": "0.108.
|
|
55
|
+
"@valbuild/ui": "0.108.3"
|
|
56
56
|
},
|
|
57
57
|
"devDependencies": {
|
|
58
58
|
"@testing-library/react": "^16.3.3",
|