@valbuild/next 0.146.3 → 0.146.4

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/CHANGELOG.md CHANGED
@@ -1,5 +1,23 @@
1
1
  # @valbuild/next
2
2
 
3
+ ## 0.146.4
4
+
5
+ ### Patch Changes
6
+
7
+ - [#870](https://github.com/valbuild/val/pull/870) [`81f2e80`](https://github.com/valbuild/val/commit/81f2e803c4cefdf58bbe6856c06e98ace95a8e0b) Thanks [@freekh](https://github.com/freekh)! - The canvas works on a page behind your site's own login.
8
+
9
+ A site with its own sign-in (a dashboard, an intranet, a members' area) can be edited in the canvas. The canvas is a frame on the same origin as the Studio, so it sends your site's cookies like any other tab: if you are signed in to the site, the canvas shows the page signed in as you.
10
+
11
+ If you were not signed in, the site redirected the canvas to its login page, and the canvas then broke. That page mounted Val's whole overlay inside the canvas, a Studio inside the Studio. The canvas stayed on "Preview is not ready yet" through the sign-in and after it, until you pressed Reload. Now a page shown in the Studio's canvas counts as the canvas wherever it navigated to, so you can sign in inside the canvas and keep editing.
12
+
13
+ - Updated dependencies [[`81f2e80`](https://github.com/valbuild/val/commit/81f2e803c4cefdf58bbe6856c06e98ace95a8e0b), [`59ff6c3`](https://github.com/valbuild/val/commit/59ff6c367bc313b2bb7718b00c1641aaccab949d), [`c31f609`](https://github.com/valbuild/val/commit/c31f609fdeed79aa0e139fa4f652ba0684e96ea3)]:
14
+ - @valbuild/shared@0.146.4
15
+ - @valbuild/ui@0.146.4
16
+ - @valbuild/server@0.146.4
17
+ - @valbuild/language-server@0.146.4
18
+ - @valbuild/mcp@0.146.4
19
+ - @valbuild/react@0.146.4
20
+
3
21
  ## 0.146.3
4
22
 
5
23
  ### Patch Changes
@@ -0,0 +1,7 @@
1
+ 'use strict';
2
+
3
+ if (process.env.NODE_ENV === "production") {
4
+ module.exports = require("./ValNextProvider-3f8bc508.cjs.prod.js");
5
+ } else {
6
+ module.exports = require("./ValNextProvider-3f8bc508.cjs.dev.js");
7
+ }
@@ -366,7 +366,7 @@ var ValNextProvider = function ValNextProvider(props) {
366
366
  setMountOverlay(false);
367
367
  return;
368
368
  }
369
- setIsCanvas(client.isValCanvasFrame(location.search));
369
+ setIsCanvas(client.isValCanvasFrame(location.search, readParentPathname()));
370
370
  setMountOverlay(hasValEnableCookie(document.cookie));
371
371
  }, []);
372
372
  React__default["default"].useEffect(function () {
@@ -874,6 +874,24 @@ function isValStudioPath(pathname) {
874
874
  return pathname.startsWith("/val");
875
875
  }
876
876
 
877
+ /**
878
+ * The path of the window framing this document, or `null`.
879
+ *
880
+ * `null` for a top-level document, and for a parent on another origin: reading
881
+ * a cross-origin `location` throws, and a page on another origin is not the
882
+ * studio, whose canvas is always the same app. See `isValCanvasFrame`.
883
+ */
884
+ function readParentPathname() {
885
+ try {
886
+ if (window.parent === window) {
887
+ return null;
888
+ }
889
+ return window.parent.location.pathname;
890
+ } catch (_unused) {
891
+ return null;
892
+ }
893
+ }
894
+
877
895
  // Same guards as the mountOverlay effect: suspending where the overlay can't
878
896
  // mount would only ever stall into the waitForLoad timeout. Browser-only.
879
897
  function shouldEnableVal() {
@@ -339,7 +339,7 @@ var ValNextProvider = function ValNextProvider(props) {
339
339
  setMountOverlay(false);
340
340
  return;
341
341
  }
342
- setIsCanvas(isValCanvasFrame(location.search));
342
+ setIsCanvas(isValCanvasFrame(location.search, readParentPathname()));
343
343
  setMountOverlay(hasValEnableCookie(document.cookie));
344
344
  }, []);
345
345
  React.useEffect(function () {
@@ -847,6 +847,24 @@ function isValStudioPath(pathname) {
847
847
  return pathname.startsWith("/val");
848
848
  }
849
849
 
850
+ /**
851
+ * The path of the window framing this document, or `null`.
852
+ *
853
+ * `null` for a top-level document, and for a parent on another origin: reading
854
+ * a cross-origin `location` throws, and a page on another origin is not the
855
+ * studio, whose canvas is always the same app. See `isValCanvasFrame`.
856
+ */
857
+ function readParentPathname() {
858
+ try {
859
+ if (window.parent === window) {
860
+ return null;
861
+ }
862
+ return window.parent.location.pathname;
863
+ } catch (_unused) {
864
+ return null;
865
+ }
866
+ }
867
+
850
868
  // Same guards as the mountOverlay effect: suspending where the overlay can't
851
869
  // mount would only ever stall into the waitForLoad timeout. Browser-only.
852
870
  function shouldEnableVal() {
@@ -366,7 +366,7 @@ var ValNextProvider = function ValNextProvider(props) {
366
366
  setMountOverlay(false);
367
367
  return;
368
368
  }
369
- setIsCanvas(client.isValCanvasFrame(location.search));
369
+ setIsCanvas(client.isValCanvasFrame(location.search, readParentPathname()));
370
370
  setMountOverlay(hasValEnableCookie(document.cookie));
371
371
  }, []);
372
372
  React__default["default"].useEffect(function () {
@@ -874,6 +874,24 @@ function isValStudioPath(pathname) {
874
874
  return pathname.startsWith("/val");
875
875
  }
876
876
 
877
+ /**
878
+ * The path of the window framing this document, or `null`.
879
+ *
880
+ * `null` for a top-level document, and for a parent on another origin: reading
881
+ * a cross-origin `location` throws, and a page on another origin is not the
882
+ * studio, whose canvas is always the same app. See `isValCanvasFrame`.
883
+ */
884
+ function readParentPathname() {
885
+ try {
886
+ if (window.parent === window) {
887
+ return null;
888
+ }
889
+ return window.parent.location.pathname;
890
+ } catch (_unused) {
891
+ return null;
892
+ }
893
+ }
894
+
877
895
  // Same guards as the mountOverlay effect: suspending where the overlay can't
878
896
  // mount would only ever stall into the waitForLoad timeout. Browser-only.
879
897
  function shouldEnableVal() {
@@ -8,13 +8,13 @@ var core = require('@valbuild/core');
8
8
  var stega = require('@valbuild/react/stega');
9
9
  var objectWithoutProperties = require('./objectWithoutProperties-8f93848f.cjs.dev.js');
10
10
  var internal = require('@valbuild/react/internal');
11
- var ValNextProvider = require('./ValNextProvider-062a8dc9.cjs.dev.js');
11
+ var ValNextProvider = require('./ValNextProvider-d6de5d9a.cjs.dev.js');
12
12
  var NextImage = require('next/image');
13
13
  var jsxRuntime = require('react/jsx-runtime');
14
14
  var ValVideo = require('./ValVideo-b8130c1b.cjs.dev.js');
15
15
  var ValApp = require('./ValApp-cd14230d.cjs.dev.js');
16
16
  var ValModulesClient = require('./ValModulesClient-4ecabf99.cjs.dev.js');
17
- var version = require('./version-b5f41d72.cjs.dev.js');
17
+ var version = require('./version-c44f56b0.cjs.dev.js');
18
18
  var createForOfIteratorHelper = require('./createForOfIteratorHelper-0445603c.cjs.dev.js');
19
19
  require('./defineProperty-f90345d7.cjs.dev.js');
20
20
  require('./unsupportedIterableToArray-c8ab77c9.cjs.dev.js');
@@ -8,13 +8,13 @@ var core = require('@valbuild/core');
8
8
  var stega = require('@valbuild/react/stega');
9
9
  var objectWithoutProperties = require('./objectWithoutProperties-107dcb46.cjs.prod.js');
10
10
  var internal = require('@valbuild/react/internal');
11
- var ValNextProvider = require('./ValNextProvider-da189afe.cjs.prod.js');
11
+ var ValNextProvider = require('./ValNextProvider-3f8bc508.cjs.prod.js');
12
12
  var NextImage = require('next/image');
13
13
  var jsxRuntime = require('react/jsx-runtime');
14
14
  var ValVideo = require('./ValVideo-94e5aa28.cjs.prod.js');
15
15
  var ValApp = require('./ValApp-b17ac306.cjs.prod.js');
16
16
  var ValModulesClient = require('./ValModulesClient-10c0721c.cjs.prod.js');
17
- var version = require('./version-2813e625.cjs.prod.js');
17
+ var version = require('./version-f6abce64.cjs.prod.js');
18
18
  var createForOfIteratorHelper = require('./createForOfIteratorHelper-d4afcad8.cjs.prod.js');
19
19
  require('./defineProperty-8951f469.cjs.prod.js');
20
20
  require('./unsupportedIterableToArray-0d2087a2.cjs.prod.js');
@@ -7,13 +7,13 @@ export { GenericSelector, Schema, VAL_EXTENSION, derefPatch, modules } from '@va
7
7
  import { stegaEncode, attrs, raw, autoTagJSX } from '@valbuild/react/stega';
8
8
  import { d as decodeValPathsOfString, _ as _objectWithoutProperties } from './objectWithoutProperties-2daec22c.esm.js';
9
9
  export { ValRichText } from '@valbuild/react/internal';
10
- import { ValNextProvider } from './ValNextProvider-3d2cd7e4.esm.js';
10
+ import { ValNextProvider } from './ValNextProvider-9934c628.esm.js';
11
11
  import NextImage from 'next/image';
12
12
  import { jsx } from 'react/jsx-runtime';
13
13
  export { ValVideo } from './ValVideo-19f2ab05.esm.js';
14
14
  export { ValApp } from './ValApp-821536aa.esm.js';
15
15
  export { ValModulesClient, useRegisterValModules } from './ValModulesClient-0dd601a1.esm.js';
16
- import { V as VERSION } from './version-9128e1b5.esm.js';
16
+ import { V as VERSION } from './version-3032da1e.esm.js';
17
17
  import { _ as _createForOfIteratorHelper } from './createForOfIteratorHelper-5758a730.esm.js';
18
18
  import './defineProperty-cca5affa.esm.js';
19
19
  import './unsupportedIterableToArray-5baabfdc.esm.js';
@@ -12,7 +12,7 @@ var packageJson = {
12
12
  "next",
13
13
  "react"
14
14
  ],
15
- version: "0.146.3",
15
+ version: "0.146.4",
16
16
  scripts: {
17
17
  typecheck: "tsc --noEmit",
18
18
  test: "jest"
@@ -14,7 +14,7 @@ var packageJson = {
14
14
  "next",
15
15
  "react"
16
16
  ],
17
- version: "0.146.3",
17
+ version: "0.146.4",
18
18
  scripts: {
19
19
  typecheck: "tsc --noEmit",
20
20
  test: "jest"
@@ -14,7 +14,7 @@ var packageJson = {
14
14
  "next",
15
15
  "react"
16
16
  ],
17
- version: "0.146.3",
17
+ version: "0.146.4",
18
18
  scripts: {
19
19
  typecheck: "tsc --noEmit",
20
20
  test: "jest"
package/package.json CHANGED
@@ -12,7 +12,7 @@
12
12
  "next",
13
13
  "react"
14
14
  ],
15
- "version": "0.146.3",
15
+ "version": "0.146.4",
16
16
  "main": "dist/valbuild-next.cjs.js",
17
17
  "module": "dist/valbuild-next.esm.js",
18
18
  "exports": {
@@ -48,12 +48,12 @@
48
48
  "client-only": "^0.0.1",
49
49
  "server-only": "^0.0.1",
50
50
  "@valbuild/core": "0.146.2",
51
- "@valbuild/mcp": "0.146.2",
52
- "@valbuild/react": "0.146.2",
53
- "@valbuild/server": "0.146.2",
54
- "@valbuild/shared": "0.146.2",
55
- "@valbuild/ui": "0.146.2",
56
- "@valbuild/language-server": "0.146.2"
51
+ "@valbuild/language-server": "0.146.4",
52
+ "@valbuild/mcp": "0.146.4",
53
+ "@valbuild/react": "0.146.4",
54
+ "@valbuild/server": "0.146.4",
55
+ "@valbuild/shared": "0.146.4",
56
+ "@valbuild/ui": "0.146.4"
57
57
  },
58
58
  "devDependencies": {
59
59
  "@testing-library/react": "^16.3.3",
@@ -12,7 +12,7 @@ var core = require('@valbuild/core');
12
12
  var React = require('react');
13
13
  var internal = require('@valbuild/shared/internal');
14
14
  var server = require('@valbuild/server');
15
- var version = require('../../dist/version-b5f41d72.cjs.dev.js');
15
+ var version = require('../../dist/version-c44f56b0.cjs.dev.js');
16
16
  require('../../dist/createForOfIteratorHelper-0445603c.cjs.dev.js');
17
17
  require('../../dist/unsupportedIterableToArray-c8ab77c9.cjs.dev.js');
18
18
  require('../../dist/slicedToArray-44036a76.cjs.dev.js');
@@ -12,7 +12,7 @@ var core = require('@valbuild/core');
12
12
  var React = require('react');
13
13
  var internal = require('@valbuild/shared/internal');
14
14
  var server = require('@valbuild/server');
15
- var version = require('../../dist/version-2813e625.cjs.prod.js');
15
+ var version = require('../../dist/version-f6abce64.cjs.prod.js');
16
16
  require('../../dist/createForOfIteratorHelper-d4afcad8.cjs.prod.js');
17
17
  require('../../dist/unsupportedIterableToArray-0d2087a2.cjs.prod.js');
18
18
  require('../../dist/slicedToArray-ce613de6.cjs.prod.js');
@@ -8,7 +8,7 @@ import { Internal } from '@valbuild/core';
8
8
  import { cache } from 'react';
9
9
  import { VAL_SESSION_COOKIE, memoizePerRequest } from '@valbuild/shared/internal';
10
10
  import { createValServer } from '@valbuild/server';
11
- import { V as VERSION } from '../../dist/version-9128e1b5.esm.js';
11
+ import { V as VERSION } from '../../dist/version-3032da1e.esm.js';
12
12
  import '../../dist/createForOfIteratorHelper-5758a730.esm.js';
13
13
  import '../../dist/unsupportedIterableToArray-5baabfdc.esm.js';
14
14
  import '../../dist/slicedToArray-aa291011.esm.js';
@@ -9,7 +9,7 @@ var objectSpread2 = require('../../dist/objectSpread2-58024783.cjs.dev.js');
9
9
  var core = require('@valbuild/core');
10
10
  var server = require('@valbuild/server');
11
11
  var server$1 = require('next/server');
12
- var version = require('../../dist/version-b5f41d72.cjs.dev.js');
12
+ var version = require('../../dist/version-c44f56b0.cjs.dev.js');
13
13
  var mcp = require('@valbuild/mcp');
14
14
  require('../../dist/unsupportedIterableToArray-c8ab77c9.cjs.dev.js');
15
15
  require('../../dist/defineProperty-f90345d7.cjs.dev.js');
@@ -9,7 +9,7 @@ var objectSpread2 = require('../../dist/objectSpread2-13f847a9.cjs.prod.js');
9
9
  var core = require('@valbuild/core');
10
10
  var server = require('@valbuild/server');
11
11
  var server$1 = require('next/server');
12
- var version = require('../../dist/version-2813e625.cjs.prod.js');
12
+ var version = require('../../dist/version-f6abce64.cjs.prod.js');
13
13
  var mcp = require('@valbuild/mcp');
14
14
  require('../../dist/unsupportedIterableToArray-0d2087a2.cjs.prod.js');
15
15
  require('../../dist/defineProperty-8951f469.cjs.prod.js');
@@ -6,7 +6,7 @@ import { Internal } from '@valbuild/core';
6
6
  import { createValApiRouter, createValServer } from '@valbuild/server';
7
7
  export { createPrettierFormatter } from '@valbuild/server';
8
8
  import { NextResponse } from 'next/server';
9
- import { V as VERSION } from '../../dist/version-9128e1b5.esm.js';
9
+ import { V as VERSION } from '../../dist/version-3032da1e.esm.js';
10
10
  import { initValMcp as initValMcp$1 } from '@valbuild/mcp';
11
11
  import '../../dist/unsupportedIterableToArray-5baabfdc.esm.js';
12
12
  import '../../dist/defineProperty-cca5affa.esm.js';
@@ -1,7 +0,0 @@
1
- 'use strict';
2
-
3
- if (process.env.NODE_ENV === "production") {
4
- module.exports = require("./ValNextProvider-da189afe.cjs.prod.js");
5
- } else {
6
- module.exports = require("./ValNextProvider-da189afe.cjs.dev.js");
7
- }