@valbuild/next 0.63.0 → 0.63.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.
@@ -7,7 +7,7 @@ var slicedToArray = require('../../dist/slicedToArray-c03b6356.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 ValContext = require('../../dist/ValContext-8eb2ec77.cjs.dev.js');
10
+ var ValContext = require('../../dist/ValContext-06fe6f7e.cjs.dev.js');
11
11
  require('../../dist/unsupportedIterableToArray-9e97e24a.cjs.dev.js');
12
12
 
13
13
  function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
@@ -25,6 +25,12 @@ function useValStega(selector) {
25
25
  }, [valEvents]);
26
26
  if (valEvents) {
27
27
  var moduleIds = stega.getModuleIds(selector);
28
+ React__default["default"].useEffect(function () {
29
+ // NOTE: reload if a component using this starts rendering: this happens if you navigate to a page with this component
30
+ if (enabled) {
31
+ valEvents.reloadPaths(moduleIds);
32
+ }
33
+ }, [enabled]);
28
34
  var moduleMap = React__default["default"].useSyncExternalStore(valEvents.subscribe(moduleIds), valEvents.getSnapshot(moduleIds), valEvents.getServerSnapshot(moduleIds));
29
35
  return stega.stegaEncode(selector, {
30
36
  disabled: !enabled,
@@ -7,7 +7,7 @@ var slicedToArray = require('../../dist/slicedToArray-1d91551a.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 ValContext = require('../../dist/ValContext-df4a9ae7.cjs.prod.js');
10
+ var ValContext = require('../../dist/ValContext-12a3eca2.cjs.prod.js');
11
11
  require('../../dist/unsupportedIterableToArray-afbea1dd.cjs.prod.js');
12
12
 
13
13
  function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
@@ -25,6 +25,12 @@ function useValStega(selector) {
25
25
  }, [valEvents]);
26
26
  if (valEvents) {
27
27
  var moduleIds = stega.getModuleIds(selector);
28
+ React__default["default"].useEffect(function () {
29
+ // NOTE: reload if a component using this starts rendering: this happens if you navigate to a page with this component
30
+ if (enabled) {
31
+ valEvents.reloadPaths(moduleIds);
32
+ }
33
+ }, [enabled]);
28
34
  var moduleMap = React__default["default"].useSyncExternalStore(valEvents.subscribe(moduleIds), valEvents.getSnapshot(moduleIds), valEvents.getServerSnapshot(moduleIds));
29
35
  return stega.stegaEncode(selector, {
30
36
  disabled: !enabled,
@@ -3,7 +3,7 @@ import { _ as _slicedToArray } from '../../dist/slicedToArray-1ff80c5e.esm.js';
3
3
  import { Internal } from '@valbuild/core';
4
4
  import { getModuleIds, stegaEncode } from '@valbuild/react/stega';
5
5
  import React from 'react';
6
- import { useValEvents } from '../../dist/ValContext-ea0b967a.esm.js';
6
+ import { useValEvents } from '../../dist/ValContext-8a8d9183.esm.js';
7
7
  import '../../dist/unsupportedIterableToArray-51bb61c2.esm.js';
8
8
 
9
9
  function useValStega(selector) {
@@ -17,6 +17,12 @@ function useValStega(selector) {
17
17
  }, [valEvents]);
18
18
  if (valEvents) {
19
19
  var moduleIds = getModuleIds(selector);
20
+ React.useEffect(function () {
21
+ // NOTE: reload if a component using this starts rendering: this happens if you navigate to a page with this component
22
+ if (enabled) {
23
+ valEvents.reloadPaths(moduleIds);
24
+ }
25
+ }, [enabled]);
20
26
  var moduleMap = React.useSyncExternalStore(valEvents.subscribe(moduleIds), valEvents.getSnapshot(moduleIds), valEvents.getServerSnapshot(moduleIds));
21
27
  return stegaEncode(selector, {
22
28
  disabled: !enabled,
@@ -124,6 +124,17 @@ var ValEvents = /*#__PURE__*/function () {
124
124
  this.listeners = {};
125
125
  }
126
126
  _createClass(ValEvents, [{
127
+ key: "reloadPaths",
128
+ value: function reloadPaths(paths) {
129
+ var event = new CustomEvent("val-store", {
130
+ detail: {
131
+ type: "reload-paths",
132
+ paths: paths
133
+ }
134
+ });
135
+ window.dispatchEvent(event);
136
+ }
137
+ }, {
127
138
  key: "update",
128
139
  value: function update(path, source) {
129
140
  var subscriberIds = Array.from(this.subscribers.keys());
@@ -0,0 +1,7 @@
1
+ 'use strict';
2
+
3
+ if (process.env.NODE_ENV === "production") {
4
+ module.exports = require("./ValContext-12a3eca2.cjs.prod.js");
5
+ } else {
6
+ module.exports = require("./ValContext-12a3eca2.cjs.dev.js");
7
+ }
@@ -124,6 +124,17 @@ var ValEvents = /*#__PURE__*/function () {
124
124
  this.listeners = {};
125
125
  }
126
126
  _createClass(ValEvents, [{
127
+ key: "reloadPaths",
128
+ value: function reloadPaths(paths) {
129
+ var event = new CustomEvent("val-store", {
130
+ detail: {
131
+ type: "reload-paths",
132
+ paths: paths
133
+ }
134
+ });
135
+ window.dispatchEvent(event);
136
+ }
137
+ }, {
127
138
  key: "update",
128
139
  value: function update(path, source) {
129
140
  var subscriberIds = Array.from(this.subscribers.keys());
@@ -116,6 +116,17 @@ var ValEvents = /*#__PURE__*/function () {
116
116
  this.listeners = {};
117
117
  }
118
118
  _createClass(ValEvents, [{
119
+ key: "reloadPaths",
120
+ value: function reloadPaths(paths) {
121
+ var event = new CustomEvent("val-store", {
122
+ detail: {
123
+ type: "reload-paths",
124
+ paths: paths
125
+ }
126
+ });
127
+ window.dispatchEvent(event);
128
+ }
129
+ }, {
119
130
  key: "update",
120
131
  value: function update(path, source) {
121
132
  var subscriberIds = Array.from(this.subscribers.keys());
@@ -9,7 +9,7 @@ var ui = require('@valbuild/ui');
9
9
  var navigation = require('next/navigation');
10
10
  var Script = require('next/script');
11
11
  var React = require('react');
12
- var ValContext = require('./ValContext-df4a9ae7.cjs.prod.js');
12
+ var ValContext = require('./ValContext-12a3eca2.cjs.prod.js');
13
13
  var stega = require('@valbuild/react/stega');
14
14
  var jsxRuntime = require('react/jsx-runtime');
15
15
  require('./unsupportedIterableToArray-afbea1dd.cjs.prod.js');
@@ -9,7 +9,7 @@ var ui = require('@valbuild/ui');
9
9
  var navigation = require('next/navigation');
10
10
  var Script = require('next/script');
11
11
  var React = require('react');
12
- var ValContext = require('./ValContext-8eb2ec77.cjs.dev.js');
12
+ var ValContext = require('./ValContext-06fe6f7e.cjs.dev.js');
13
13
  var stega = require('@valbuild/react/stega');
14
14
  var jsxRuntime = require('react/jsx-runtime');
15
15
  require('./unsupportedIterableToArray-9e97e24a.cjs.dev.js');
@@ -5,7 +5,7 @@ import { VAL_APP_PATH, VAL_OVERLAY_ID } from '@valbuild/ui';
5
5
  import { usePathname, useRouter } from 'next/navigation';
6
6
  import Script from 'next/script';
7
7
  import React from 'react';
8
- import { ValEvents, ValContext } from './ValContext-ea0b967a.esm.js';
8
+ import { ValEvents, ValContext } from './ValContext-8a8d9183.esm.js';
9
9
  import { SET_AUTO_TAG_JSX_ENABLED } from '@valbuild/react/stega';
10
10
  import { jsxs, jsx } from 'react/jsx-runtime';
11
11
  import './unsupportedIterableToArray-51bb61c2.esm.js';
package/package.json CHANGED
@@ -8,7 +8,7 @@
8
8
  "next",
9
9
  "react"
10
10
  ],
11
- "version": "0.63.0",
11
+ "version": "0.63.1",
12
12
  "scripts": {
13
13
  "typecheck": "tsc --noEmit",
14
14
  "test": "jest"
@@ -45,10 +45,10 @@
45
45
  "exports": true
46
46
  },
47
47
  "dependencies": {
48
- "@valbuild/core": "~0.63.0",
49
- "@valbuild/react": "~0.63.0",
50
- "@valbuild/server": "~0.63.0",
51
- "@valbuild/ui": "~0.63.0",
48
+ "@valbuild/core": "~0.63.1",
49
+ "@valbuild/react": "~0.63.1",
50
+ "@valbuild/server": "~0.63.1",
51
+ "@valbuild/ui": "~0.63.1",
52
52
  "client-only": "^0.0.1",
53
53
  "server-only": "^0.0.1"
54
54
  },
@@ -1,7 +0,0 @@
1
- 'use strict';
2
-
3
- if (process.env.NODE_ENV === "production") {
4
- module.exports = require("./ValContext-df4a9ae7.cjs.prod.js");
5
- } else {
6
- module.exports = require("./ValContext-df4a9ae7.cjs.dev.js");
7
- }