@valbuild/next 0.102.0 → 0.103.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.
- package/README.md +50 -1
- package/client/dist/valbuild-next-client.cjs.dev.js +25 -2
- package/client/dist/valbuild-next-client.cjs.prod.js +25 -2
- package/client/dist/valbuild-next-client.esm.js +25 -2
- package/dist/ValApp-90c4171d.cjs.js +7 -0
- package/dist/{ValApp-bb207e96.cjs.prod.js → ValApp-90c4171d.cjs.prod.js} +8 -6
- package/dist/{ValApp-1992d8b3.cjs.dev.js → ValApp-c1c3ef55.cjs.dev.js} +8 -6
- package/dist/{ValApp-8912fc8b.esm.js → ValApp-e17eb734.esm.js} +5 -3
- package/dist/ValCanvasBridge-96f67a41.cjs.dev.js +395 -0
- package/dist/ValCanvasBridge-d8713d9d.esm.js +387 -0
- package/dist/ValCanvasBridge-f75509c6.cjs.js +7 -0
- package/dist/ValCanvasBridge-f75509c6.cjs.prod.js +395 -0
- package/dist/{ValNextProvider-7302b8af.esm.js → ValNextProvider-3209948c.esm.js} +282 -43
- package/dist/{ValNextProvider-03a9f8fd.cjs.dev.js → ValNextProvider-3d8ebfec.cjs.dev.js} +297 -58
- package/dist/ValNextProvider-3fdf8756.cjs.js +7 -0
- package/dist/{ValNextProvider-6103cb74.cjs.prod.js → ValNextProvider-3fdf8756.cjs.prod.js} +297 -58
- package/dist/ValOverlayContext-1d019b95.cjs.js +7 -0
- package/dist/{ValOverlayContext-f7f45bc7.cjs.prod.js → ValOverlayContext-1d019b95.cjs.prod.js} +8 -2
- package/dist/{ValOverlayContext-c6f27a6d.cjs.dev.js → ValOverlayContext-ca3b6ebd.cjs.dev.js} +8 -2
- package/dist/{ValOverlayContext-3c37e5a7.esm.js → ValOverlayContext-f63e0fc9.esm.js} +8 -2
- package/dist/declarations/src/ValApp.d.ts +1 -1
- package/dist/declarations/src/ValImage.d.ts +1 -1
- package/dist/declarations/src/ValProvider.d.ts +1 -1
- package/dist/declarations/src/external_exempt_from_val_quickjs.d.ts +7 -5
- package/dist/fallbackColors-5ead2c26.esm.js +58 -0
- package/dist/{cssUtils-9c11102f.cjs.dev.js → fallbackColors-9a2ac53a.cjs.dev.js} +30 -0
- package/dist/{cssUtils-d97a757c.cjs.prod.js → fallbackColors-d4a5b0da.cjs.prod.js} +30 -0
- package/dist/valbuild-next.cjs.dev.js +8 -13
- package/dist/valbuild-next.cjs.prod.js +8 -13
- package/dist/valbuild-next.esm.js +9 -10
- package/package.json +13 -13
- package/dist/ValApp-bb207e96.cjs.js +0 -7
- package/dist/ValNextProvider-6103cb74.cjs.js +0 -7
- package/dist/ValOverlayContext-f7f45bc7.cjs.js +0 -7
- package/dist/cssUtils-b5651c03.esm.js +0 -32
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { VAL_CONFIG_SESSION_STORAGE_KEY } from '@valbuild/shared/internal';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { _ as _slicedToArray } from './slicedToArray-aa291011.esm.js';
|
|
4
|
+
import { Internal } from '@valbuild/core';
|
|
5
|
+
import { VERSION } from '@valbuild/ui';
|
|
6
|
+
|
|
7
|
+
/*
|
|
8
|
+
* See the useConfig.tsx where the config is loaded from session storage
|
|
9
|
+
*/
|
|
10
|
+
function useConfigStorageSave(config) {
|
|
11
|
+
React.useEffect(function () {
|
|
12
|
+
sessionStorage.setItem(VAL_CONFIG_SESSION_STORAGE_KEY, JSON.stringify(config));
|
|
13
|
+
}, [config]);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
// All DOM element that are outside the Shadow DOM should use this class name prefix
|
|
17
|
+
var valPrefixedClass = "val-prefix-" + Internal.getSHA256Hash(new TextEncoder().encode(VERSION || "")).slice(0, 8) + "-";
|
|
18
|
+
var prefixStyles = function prefixStyles(styles) {
|
|
19
|
+
return Object.entries(styles).map(function (_ref) {
|
|
20
|
+
var _ref2 = _slicedToArray(_ref, 2),
|
|
21
|
+
key = _ref2[0],
|
|
22
|
+
value = _ref2[1];
|
|
23
|
+
return ".".concat(valPrefixedClass).concat(key.replace(/\//g, "\\/"), " { ").concat(value, " }");
|
|
24
|
+
}).join("\n");
|
|
25
|
+
};
|
|
26
|
+
var cn = function cn(className) {
|
|
27
|
+
return className.map(function (c) {
|
|
28
|
+
return "".concat(valPrefixedClass).concat(c);
|
|
29
|
+
}).join(" ");
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Colours for the moments before Val's own stylesheet exists.
|
|
34
|
+
*
|
|
35
|
+
* Two of them, and they are not interchangeable. The studio's loading screen
|
|
36
|
+
* covers the whole viewport and is replaced by the studio's canvas, so it has
|
|
37
|
+
* to match `--bg-canvas`. The loading pill sits on the customer's page as a
|
|
38
|
+
* piece of Val's floating chrome, so it has to match `--bg-float`. Getting
|
|
39
|
+
* them the wrong way round is not invisible: the studio flashes one colour and
|
|
40
|
+
* repaints in another the moment the stylesheet lands.
|
|
41
|
+
*
|
|
42
|
+
* Hardcoded because that is the whole point — these are used exactly when the
|
|
43
|
+
* variables that define them are not loaded yet. They are copies, so they go
|
|
44
|
+
* stale silently: if `--bg-canvas` or `--bg-float` changes in
|
|
45
|
+
* `packages/ui/spa/index.css`, change them here too.
|
|
46
|
+
*/
|
|
47
|
+
|
|
48
|
+
/** `--bg-canvas`, dark. The studio's own background. */
|
|
49
|
+
var canvasDarkBg = "#08080a";
|
|
50
|
+
/** `--bg-canvas`, light. */
|
|
51
|
+
var canvasLightBg = "#fafafa";
|
|
52
|
+
|
|
53
|
+
/** `--bg-float`, dark. Val's chrome, floating over the customer's page. */
|
|
54
|
+
var floatDarkBg = "#131316";
|
|
55
|
+
/** `--bg-float`, light. */
|
|
56
|
+
var floatLightBg = "#ffffff";
|
|
57
|
+
|
|
58
|
+
export { canvasDarkBg as a, canvasLightBg as b, cn as c, floatLightBg as d, floatDarkBg as f, prefixStyles as p, useConfigStorageSave as u, valPrefixedClass as v };
|
|
@@ -35,7 +35,37 @@ var cn = function cn(className) {
|
|
|
35
35
|
}).join(" ");
|
|
36
36
|
};
|
|
37
37
|
|
|
38
|
+
/**
|
|
39
|
+
* Colours for the moments before Val's own stylesheet exists.
|
|
40
|
+
*
|
|
41
|
+
* Two of them, and they are not interchangeable. The studio's loading screen
|
|
42
|
+
* covers the whole viewport and is replaced by the studio's canvas, so it has
|
|
43
|
+
* to match `--bg-canvas`. The loading pill sits on the customer's page as a
|
|
44
|
+
* piece of Val's floating chrome, so it has to match `--bg-float`. Getting
|
|
45
|
+
* them the wrong way round is not invisible: the studio flashes one colour and
|
|
46
|
+
* repaints in another the moment the stylesheet lands.
|
|
47
|
+
*
|
|
48
|
+
* Hardcoded because that is the whole point — these are used exactly when the
|
|
49
|
+
* variables that define them are not loaded yet. They are copies, so they go
|
|
50
|
+
* stale silently: if `--bg-canvas` or `--bg-float` changes in
|
|
51
|
+
* `packages/ui/spa/index.css`, change them here too.
|
|
52
|
+
*/
|
|
53
|
+
|
|
54
|
+
/** `--bg-canvas`, dark. The studio's own background. */
|
|
55
|
+
var canvasDarkBg = "#08080a";
|
|
56
|
+
/** `--bg-canvas`, light. */
|
|
57
|
+
var canvasLightBg = "#fafafa";
|
|
58
|
+
|
|
59
|
+
/** `--bg-float`, dark. Val's chrome, floating over the customer's page. */
|
|
60
|
+
var floatDarkBg = "#131316";
|
|
61
|
+
/** `--bg-float`, light. */
|
|
62
|
+
var floatLightBg = "#ffffff";
|
|
63
|
+
|
|
64
|
+
exports.canvasDarkBg = canvasDarkBg;
|
|
65
|
+
exports.canvasLightBg = canvasLightBg;
|
|
38
66
|
exports.cn = cn;
|
|
67
|
+
exports.floatDarkBg = floatDarkBg;
|
|
68
|
+
exports.floatLightBg = floatLightBg;
|
|
39
69
|
exports.prefixStyles = prefixStyles;
|
|
40
70
|
exports.useConfigStorageSave = useConfigStorageSave;
|
|
41
71
|
exports.valPrefixedClass = valPrefixedClass;
|
|
@@ -35,7 +35,37 @@ var cn = function cn(className) {
|
|
|
35
35
|
}).join(" ");
|
|
36
36
|
};
|
|
37
37
|
|
|
38
|
+
/**
|
|
39
|
+
* Colours for the moments before Val's own stylesheet exists.
|
|
40
|
+
*
|
|
41
|
+
* Two of them, and they are not interchangeable. The studio's loading screen
|
|
42
|
+
* covers the whole viewport and is replaced by the studio's canvas, so it has
|
|
43
|
+
* to match `--bg-canvas`. The loading pill sits on the customer's page as a
|
|
44
|
+
* piece of Val's floating chrome, so it has to match `--bg-float`. Getting
|
|
45
|
+
* them the wrong way round is not invisible: the studio flashes one colour and
|
|
46
|
+
* repaints in another the moment the stylesheet lands.
|
|
47
|
+
*
|
|
48
|
+
* Hardcoded because that is the whole point — these are used exactly when the
|
|
49
|
+
* variables that define them are not loaded yet. They are copies, so they go
|
|
50
|
+
* stale silently: if `--bg-canvas` or `--bg-float` changes in
|
|
51
|
+
* `packages/ui/spa/index.css`, change them here too.
|
|
52
|
+
*/
|
|
53
|
+
|
|
54
|
+
/** `--bg-canvas`, dark. The studio's own background. */
|
|
55
|
+
var canvasDarkBg = "#08080a";
|
|
56
|
+
/** `--bg-canvas`, light. */
|
|
57
|
+
var canvasLightBg = "#fafafa";
|
|
58
|
+
|
|
59
|
+
/** `--bg-float`, dark. Val's chrome, floating over the customer's page. */
|
|
60
|
+
var floatDarkBg = "#131316";
|
|
61
|
+
/** `--bg-float`, light. */
|
|
62
|
+
var floatLightBg = "#ffffff";
|
|
63
|
+
|
|
64
|
+
exports.canvasDarkBg = canvasDarkBg;
|
|
65
|
+
exports.canvasLightBg = canvasLightBg;
|
|
38
66
|
exports.cn = cn;
|
|
67
|
+
exports.floatDarkBg = floatDarkBg;
|
|
68
|
+
exports.floatLightBg = floatLightBg;
|
|
39
69
|
exports.prefixStyles = prefixStyles;
|
|
40
70
|
exports.useConfigStorageSave = useConfigStorageSave;
|
|
41
71
|
exports.valPrefixedClass = valPrefixedClass;
|
|
@@ -7,10 +7,10 @@ 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-3d8ebfec.cjs.dev.js');
|
|
11
11
|
var NextImage = require('next/image');
|
|
12
12
|
var jsxRuntime = require('react/jsx-runtime');
|
|
13
|
-
var ValApp = require('./ValApp-
|
|
13
|
+
var ValApp = require('./ValApp-c1c3ef55.cjs.dev.js');
|
|
14
14
|
var ValModulesClient = require('./ValModulesClient-4ecabf99.cjs.dev.js');
|
|
15
15
|
var createForOfIteratorHelper = require('./createForOfIteratorHelper-0445603c.cjs.dev.js');
|
|
16
16
|
require('./defineProperty-f90345d7.cjs.dev.js');
|
|
@@ -143,7 +143,6 @@ function _objectWithoutProperties(e, t) {
|
|
|
143
143
|
|
|
144
144
|
var _excluded = ["src", "alt", "style", "width", "disableHotspot", "height"];
|
|
145
145
|
function ValImage(props) {
|
|
146
|
-
var _src$metadata, _src$metadata2, _src$metadata3, _src$metadata4, _src$metadata5, _src$metadata6;
|
|
147
146
|
var src = props.src,
|
|
148
147
|
alt = props.alt,
|
|
149
148
|
style = props.style,
|
|
@@ -168,12 +167,12 @@ function ValImage(props) {
|
|
|
168
167
|
_iterator.f();
|
|
169
168
|
}
|
|
170
169
|
}
|
|
171
|
-
var hotspot = src === null || src === void 0
|
|
170
|
+
var hotspot = src === null || src === void 0 ? void 0 : src.hotspot;
|
|
172
171
|
var imageStyle = hotspot && !disableHotspot ? objectSpread2._objectSpread2(objectSpread2._objectSpread2({}, style), {}, {
|
|
173
172
|
objectPosition: "".concat(hotspot.x * 100, "% ").concat(hotspot.y * 100, "%")
|
|
174
173
|
}) : style;
|
|
175
|
-
var preferMetadataDims = (src === null || src === void 0 ? void 0 : src.
|
|
176
|
-
var isUnoptimized = rest.unoptimized !== undefined ? rest.unoptimized : (src === null || src === void 0
|
|
174
|
+
var preferMetadataDims = ((src === null || src === void 0 ? void 0 : src.width) !== undefined || (src === null || src === void 0 ? void 0 : src.height) !== undefined) && !rest.fill && !width && !height;
|
|
175
|
+
var isUnoptimized = rest.unoptimized !== undefined ? rest.unoptimized : (src === null || src === void 0 ? void 0 : src.mimeType) === "image/svg+xml"; // SVGs are unoptimized by default
|
|
177
176
|
return /*#__PURE__*/jsxRuntime.jsx(NextImage__default["default"], objectSpread2._objectSpread2(objectSpread2._objectSpread2({}, objectSpread2._objectSpread2(objectSpread2._objectSpread2({}, rest), {}, {
|
|
178
177
|
layout: undefined,
|
|
179
178
|
objectFit: undefined,
|
|
@@ -186,10 +185,10 @@ function ValImage(props) {
|
|
|
186
185
|
"data-val-attr-alt": maybeValPathOfAlt,
|
|
187
186
|
"data-val-attr-src": valPathsOfUrl && valPathsOfUrl.length > 0 ? valPathsOfUrl.join(",") : undefined,
|
|
188
187
|
style: imageStyle,
|
|
189
|
-
alt: alt ? stega.raw(alt) : src !== null && src !== void 0 &&
|
|
188
|
+
alt: alt ? stega.raw(alt) : src !== null && src !== void 0 && src.alt ? stega.raw(src === null || src === void 0 ? void 0 : src.alt) : "",
|
|
190
189
|
fill: rest.fill,
|
|
191
|
-
width: preferMetadataDims ? src === null || src === void 0
|
|
192
|
-
height: preferMetadataDims ? src === null || src === void 0
|
|
190
|
+
width: preferMetadataDims ? src === null || src === void 0 ? void 0 : src.width : width,
|
|
191
|
+
height: preferMetadataDims ? src === null || src === void 0 ? void 0 : src.height : height,
|
|
193
192
|
unoptimized: isUnoptimized
|
|
194
193
|
}));
|
|
195
194
|
}
|
|
@@ -205,10 +204,6 @@ var Internal = objectSpread2._objectSpread2(objectSpread2._objectSpread2({}, cor
|
|
|
205
204
|
})
|
|
206
205
|
});
|
|
207
206
|
|
|
208
|
-
Object.defineProperty(exports, 'FILE_REF_PROP', {
|
|
209
|
-
enumerable: true,
|
|
210
|
-
get: function () { return core.FILE_REF_PROP; }
|
|
211
|
-
});
|
|
212
207
|
Object.defineProperty(exports, 'GenericSelector', {
|
|
213
208
|
enumerable: true,
|
|
214
209
|
get: function () { return core.GenericSelector; }
|
|
@@ -7,10 +7,10 @@ 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-3fdf8756.cjs.prod.js');
|
|
11
11
|
var NextImage = require('next/image');
|
|
12
12
|
var jsxRuntime = require('react/jsx-runtime');
|
|
13
|
-
var ValApp = require('./ValApp-
|
|
13
|
+
var ValApp = require('./ValApp-90c4171d.cjs.prod.js');
|
|
14
14
|
var ValModulesClient = require('./ValModulesClient-10c0721c.cjs.prod.js');
|
|
15
15
|
var createForOfIteratorHelper = require('./createForOfIteratorHelper-d4afcad8.cjs.prod.js');
|
|
16
16
|
require('./defineProperty-8951f469.cjs.prod.js');
|
|
@@ -143,7 +143,6 @@ function _objectWithoutProperties(e, t) {
|
|
|
143
143
|
|
|
144
144
|
var _excluded = ["src", "alt", "style", "width", "disableHotspot", "height"];
|
|
145
145
|
function ValImage(props) {
|
|
146
|
-
var _src$metadata, _src$metadata2, _src$metadata3, _src$metadata4, _src$metadata5, _src$metadata6;
|
|
147
146
|
var src = props.src,
|
|
148
147
|
alt = props.alt,
|
|
149
148
|
style = props.style,
|
|
@@ -168,12 +167,12 @@ function ValImage(props) {
|
|
|
168
167
|
_iterator.f();
|
|
169
168
|
}
|
|
170
169
|
}
|
|
171
|
-
var hotspot = src === null || src === void 0
|
|
170
|
+
var hotspot = src === null || src === void 0 ? void 0 : src.hotspot;
|
|
172
171
|
var imageStyle = hotspot && !disableHotspot ? objectSpread2._objectSpread2(objectSpread2._objectSpread2({}, style), {}, {
|
|
173
172
|
objectPosition: "".concat(hotspot.x * 100, "% ").concat(hotspot.y * 100, "%")
|
|
174
173
|
}) : style;
|
|
175
|
-
var preferMetadataDims = (src === null || src === void 0 ? void 0 : src.
|
|
176
|
-
var isUnoptimized = rest.unoptimized !== undefined ? rest.unoptimized : (src === null || src === void 0
|
|
174
|
+
var preferMetadataDims = ((src === null || src === void 0 ? void 0 : src.width) !== undefined || (src === null || src === void 0 ? void 0 : src.height) !== undefined) && !rest.fill && !width && !height;
|
|
175
|
+
var isUnoptimized = rest.unoptimized !== undefined ? rest.unoptimized : (src === null || src === void 0 ? void 0 : src.mimeType) === "image/svg+xml"; // SVGs are unoptimized by default
|
|
177
176
|
return /*#__PURE__*/jsxRuntime.jsx(NextImage__default["default"], objectSpread2._objectSpread2(objectSpread2._objectSpread2({}, objectSpread2._objectSpread2(objectSpread2._objectSpread2({}, rest), {}, {
|
|
178
177
|
layout: undefined,
|
|
179
178
|
objectFit: undefined,
|
|
@@ -186,10 +185,10 @@ function ValImage(props) {
|
|
|
186
185
|
"data-val-attr-alt": maybeValPathOfAlt,
|
|
187
186
|
"data-val-attr-src": valPathsOfUrl && valPathsOfUrl.length > 0 ? valPathsOfUrl.join(",") : undefined,
|
|
188
187
|
style: imageStyle,
|
|
189
|
-
alt: alt ? stega.raw(alt) : src !== null && src !== void 0 &&
|
|
188
|
+
alt: alt ? stega.raw(alt) : src !== null && src !== void 0 && src.alt ? stega.raw(src === null || src === void 0 ? void 0 : src.alt) : "",
|
|
190
189
|
fill: rest.fill,
|
|
191
|
-
width: preferMetadataDims ? src === null || src === void 0
|
|
192
|
-
height: preferMetadataDims ? src === null || src === void 0
|
|
190
|
+
width: preferMetadataDims ? src === null || src === void 0 ? void 0 : src.width : width,
|
|
191
|
+
height: preferMetadataDims ? src === null || src === void 0 ? void 0 : src.height : height,
|
|
193
192
|
unoptimized: isUnoptimized
|
|
194
193
|
}));
|
|
195
194
|
}
|
|
@@ -205,10 +204,6 @@ var Internal = objectSpread2._objectSpread2(objectSpread2._objectSpread2({}, cor
|
|
|
205
204
|
})
|
|
206
205
|
});
|
|
207
206
|
|
|
208
|
-
Object.defineProperty(exports, 'FILE_REF_PROP', {
|
|
209
|
-
enumerable: true,
|
|
210
|
-
get: function () { return core.FILE_REF_PROP; }
|
|
211
|
-
});
|
|
212
207
|
Object.defineProperty(exports, 'GenericSelector', {
|
|
213
208
|
enumerable: true,
|
|
214
209
|
get: function () { return core.GenericSelector; }
|
|
@@ -3,13 +3,13 @@ import { _ as _objectSpread2 } from './objectSpread2-60d1bd93.esm.js';
|
|
|
3
3
|
import { Internal as Internal$1, initVal as initVal$1 } from '@valbuild/core';
|
|
4
4
|
import * as core from '@valbuild/core';
|
|
5
5
|
export { core as expr };
|
|
6
|
-
export {
|
|
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-3209948c.esm.js';
|
|
10
10
|
import NextImage from 'next/image';
|
|
11
11
|
import { jsx } from 'react/jsx-runtime';
|
|
12
|
-
export { ValApp } from './ValApp-
|
|
12
|
+
export { ValApp } from './ValApp-e17eb734.esm.js';
|
|
13
13
|
export { ValModulesClient, useRegisterValModules } from './ValModulesClient-0dd601a1.esm.js';
|
|
14
14
|
import { _ as _createForOfIteratorHelper } from './createForOfIteratorHelper-5758a730.esm.js';
|
|
15
15
|
import './defineProperty-cca5affa.esm.js';
|
|
@@ -119,7 +119,6 @@ function _objectWithoutProperties(e, t) {
|
|
|
119
119
|
|
|
120
120
|
var _excluded = ["src", "alt", "style", "width", "disableHotspot", "height"];
|
|
121
121
|
function ValImage(props) {
|
|
122
|
-
var _src$metadata, _src$metadata2, _src$metadata3, _src$metadata4, _src$metadata5, _src$metadata6;
|
|
123
122
|
var src = props.src,
|
|
124
123
|
alt = props.alt,
|
|
125
124
|
style = props.style,
|
|
@@ -144,12 +143,12 @@ function ValImage(props) {
|
|
|
144
143
|
_iterator.f();
|
|
145
144
|
}
|
|
146
145
|
}
|
|
147
|
-
var hotspot = src === null || src === void 0
|
|
146
|
+
var hotspot = src === null || src === void 0 ? void 0 : src.hotspot;
|
|
148
147
|
var imageStyle = hotspot && !disableHotspot ? _objectSpread2(_objectSpread2({}, style), {}, {
|
|
149
148
|
objectPosition: "".concat(hotspot.x * 100, "% ").concat(hotspot.y * 100, "%")
|
|
150
149
|
}) : style;
|
|
151
|
-
var preferMetadataDims = (src === null || src === void 0 ? void 0 : src.
|
|
152
|
-
var isUnoptimized = rest.unoptimized !== undefined ? rest.unoptimized : (src === null || src === void 0
|
|
150
|
+
var preferMetadataDims = ((src === null || src === void 0 ? void 0 : src.width) !== undefined || (src === null || src === void 0 ? void 0 : src.height) !== undefined) && !rest.fill && !width && !height;
|
|
151
|
+
var isUnoptimized = rest.unoptimized !== undefined ? rest.unoptimized : (src === null || src === void 0 ? void 0 : src.mimeType) === "image/svg+xml"; // SVGs are unoptimized by default
|
|
153
152
|
return /*#__PURE__*/jsx(NextImage, _objectSpread2(_objectSpread2({}, _objectSpread2(_objectSpread2({}, rest), {}, {
|
|
154
153
|
layout: undefined,
|
|
155
154
|
objectFit: undefined,
|
|
@@ -162,10 +161,10 @@ function ValImage(props) {
|
|
|
162
161
|
"data-val-attr-alt": maybeValPathOfAlt,
|
|
163
162
|
"data-val-attr-src": valPathsOfUrl && valPathsOfUrl.length > 0 ? valPathsOfUrl.join(",") : undefined,
|
|
164
163
|
style: imageStyle,
|
|
165
|
-
alt: alt ? raw(alt) : src !== null && src !== void 0 &&
|
|
164
|
+
alt: alt ? raw(alt) : src !== null && src !== void 0 && src.alt ? raw(src === null || src === void 0 ? void 0 : src.alt) : "",
|
|
166
165
|
fill: rest.fill,
|
|
167
|
-
width: preferMetadataDims ? src === null || src === void 0
|
|
168
|
-
height: preferMetadataDims ? src === null || src === void 0
|
|
166
|
+
width: preferMetadataDims ? src === null || src === void 0 ? void 0 : src.width : width,
|
|
167
|
+
height: preferMetadataDims ? src === null || src === void 0 ? void 0 : src.height : height,
|
|
169
168
|
unoptimized: isUnoptimized
|
|
170
169
|
}));
|
|
171
170
|
}
|
package/package.json
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"next",
|
|
13
13
|
"react"
|
|
14
14
|
],
|
|
15
|
-
"version": "0.
|
|
15
|
+
"version": "0.103.1",
|
|
16
16
|
"main": "dist/valbuild-next.cjs.js",
|
|
17
17
|
"module": "dist/valbuild-next.esm.js",
|
|
18
18
|
"exports": {
|
|
@@ -47,21 +47,21 @@
|
|
|
47
47
|
"dependencies": {
|
|
48
48
|
"client-only": "^0.0.1",
|
|
49
49
|
"server-only": "^0.0.1",
|
|
50
|
-
"@valbuild/core": "0.
|
|
51
|
-
"@valbuild/language-server": "0.
|
|
52
|
-
"@valbuild/react": "0.
|
|
53
|
-
"@valbuild/server": "0.
|
|
54
|
-
"@valbuild/shared": "0.
|
|
55
|
-
"@valbuild/ui": "0.
|
|
50
|
+
"@valbuild/core": "0.103.0",
|
|
51
|
+
"@valbuild/language-server": "0.103.1",
|
|
52
|
+
"@valbuild/react": "0.103.1",
|
|
53
|
+
"@valbuild/server": "0.103.1",
|
|
54
|
+
"@valbuild/shared": "0.103.0",
|
|
55
|
+
"@valbuild/ui": "0.103.1"
|
|
56
56
|
},
|
|
57
57
|
"devDependencies": {
|
|
58
|
-
"@testing-library/react": "^
|
|
59
|
-
"@types/react": "^
|
|
60
|
-
"@types/react-dom": "^
|
|
58
|
+
"@testing-library/react": "^16.3.2",
|
|
59
|
+
"@types/react": "^19.2.18",
|
|
60
|
+
"@types/react-dom": "^19.2.5",
|
|
61
61
|
"jest-environment-jsdom": "^29.5.0",
|
|
62
|
-
"next": "^
|
|
63
|
-
"react": "^
|
|
64
|
-
"react-dom": "^
|
|
62
|
+
"next": "^16.3.3",
|
|
63
|
+
"react": "^19.2.8",
|
|
64
|
+
"react-dom": "^19.2.8",
|
|
65
65
|
"typescript": "^5.9.3"
|
|
66
66
|
},
|
|
67
67
|
"peerDependencies": {
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { VAL_CONFIG_SESSION_STORAGE_KEY } from '@valbuild/shared/internal';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import { _ as _slicedToArray } from './slicedToArray-aa291011.esm.js';
|
|
4
|
-
import { Internal } from '@valbuild/core';
|
|
5
|
-
import { VERSION } from '@valbuild/ui';
|
|
6
|
-
|
|
7
|
-
/*
|
|
8
|
-
* See the useConfig.tsx where the config is loaded from session storage
|
|
9
|
-
*/
|
|
10
|
-
function useConfigStorageSave(config) {
|
|
11
|
-
React.useEffect(function () {
|
|
12
|
-
sessionStorage.setItem(VAL_CONFIG_SESSION_STORAGE_KEY, JSON.stringify(config));
|
|
13
|
-
}, [config]);
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
// All DOM element that are outside the Shadow DOM should use this class name prefix
|
|
17
|
-
var valPrefixedClass = "val-prefix-" + Internal.getSHA256Hash(new TextEncoder().encode(VERSION || "")).slice(0, 8) + "-";
|
|
18
|
-
var prefixStyles = function prefixStyles(styles) {
|
|
19
|
-
return Object.entries(styles).map(function (_ref) {
|
|
20
|
-
var _ref2 = _slicedToArray(_ref, 2),
|
|
21
|
-
key = _ref2[0],
|
|
22
|
-
value = _ref2[1];
|
|
23
|
-
return ".".concat(valPrefixedClass).concat(key.replace(/\//g, "\\/"), " { ").concat(value, " }");
|
|
24
|
-
}).join("\n");
|
|
25
|
-
};
|
|
26
|
-
var cn = function cn(className) {
|
|
27
|
-
return className.map(function (c) {
|
|
28
|
-
return "".concat(valPrefixedClass).concat(c);
|
|
29
|
-
}).join(" ");
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
export { cn as c, prefixStyles as p, useConfigStorageSave as u, valPrefixedClass as v };
|