@valbuild/next 0.62.6 → 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.
- package/README.md +51 -25
- package/client/dist/valbuild-next-client.cjs.dev.js +7 -1
- package/client/dist/valbuild-next-client.cjs.prod.js +7 -1
- package/client/dist/valbuild-next-client.esm.js +7 -1
- package/dist/{ValContext-8eb2ec77.cjs.dev.js → ValContext-06fe6f7e.cjs.dev.js} +11 -0
- package/dist/ValContext-12a3eca2.cjs.js +7 -0
- package/dist/{ValContext-df4a9ae7.cjs.prod.js → ValContext-12a3eca2.cjs.prod.js} +11 -0
- package/dist/{ValContext-ea0b967a.esm.js → ValContext-8a8d9183.esm.js} +11 -0
- package/dist/ValNextProvider-5226c452.cjs.prod.js +1 -1
- package/dist/ValNextProvider-ccbea1bd.cjs.dev.js +1 -1
- package/dist/ValNextProvider-d94cd904.esm.js +1 -1
- package/dist/declarations/src/external_exempt_from_val_quickjs.d.ts +2 -2
- package/dist/declarations/src/initVal.d.ts +2 -2
- package/package.json +5 -5
- package/dist/ValContext-df4a9ae7.cjs.js +0 -7
package/README.md
CHANGED
|
@@ -61,9 +61,9 @@ This is release is only for **INTERNAL** **TESTING** PURPOSES.
|
|
|
61
61
|
- [Image](#image)
|
|
62
62
|
- [keyOf](#keyof)
|
|
63
63
|
|
|
64
|
-
##
|
|
64
|
+
## Content as code
|
|
65
65
|
|
|
66
|
-
Val is a CMS where **content** is **
|
|
66
|
+
Val is a CMS library where **content** is **TypeScript** / **JavaScript** files stored in your git repo.
|
|
67
67
|
|
|
68
68
|
As a CMS, Val is useful because:
|
|
69
69
|
|
|
@@ -196,7 +196,9 @@ export const schema = s.object({
|
|
|
196
196
|
s.object({
|
|
197
197
|
title: s.string(),
|
|
198
198
|
text: s.richtext({
|
|
199
|
-
|
|
199
|
+
style: {
|
|
200
|
+
bold: true, // <- Enables bold in richtext
|
|
201
|
+
},
|
|
200
202
|
}),
|
|
201
203
|
})
|
|
202
204
|
),
|
|
@@ -210,8 +212,15 @@ export default c.define(
|
|
|
210
212
|
sections: [
|
|
211
213
|
{
|
|
212
214
|
title: "Section 1",
|
|
213
|
-
text:
|
|
214
|
-
|
|
215
|
+
text: [
|
|
216
|
+
{
|
|
217
|
+
tag: "p",
|
|
218
|
+
children: [
|
|
219
|
+
"Val is",
|
|
220
|
+
{ tag: "span", styles: ["bold"], children: ["awesome"] },
|
|
221
|
+
],
|
|
222
|
+
},
|
|
223
|
+
],
|
|
215
224
|
},
|
|
216
225
|
],
|
|
217
226
|
}
|
|
@@ -245,7 +254,9 @@ const Page: NextPage = () => {
|
|
|
245
254
|
<h2>{section.title}</h2>
|
|
246
255
|
<ValRichText
|
|
247
256
|
theme={{
|
|
248
|
-
|
|
257
|
+
style: {
|
|
258
|
+
bold: "font-bold",
|
|
259
|
+
},
|
|
249
260
|
}}
|
|
250
261
|
>
|
|
251
262
|
{section.text}
|
|
@@ -348,27 +359,40 @@ To initialize some text content using a RichText schema, you can use follow the
|
|
|
348
359
|
import { s, c } from "./val.config";
|
|
349
360
|
|
|
350
361
|
export const schema = s.richtext({
|
|
351
|
-
// styling
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
362
|
+
// styling
|
|
363
|
+
style: {
|
|
364
|
+
bold: true, // enables bold
|
|
365
|
+
italic: true, // enables italic text
|
|
366
|
+
lineThrough: true, // enables line/strike-through
|
|
367
|
+
},
|
|
355
368
|
// tags:
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
369
|
+
block: {
|
|
370
|
+
//ul: true, // enables unordered lists
|
|
371
|
+
//ol: true, // enables ordered lists
|
|
372
|
+
// headings:
|
|
373
|
+
h1: true,
|
|
374
|
+
h2: true,
|
|
375
|
+
// h3: true,
|
|
376
|
+
// h4: true,
|
|
377
|
+
// h5: true,
|
|
378
|
+
// h6: true
|
|
379
|
+
},
|
|
380
|
+
inline: {
|
|
381
|
+
//a: true, // enables links
|
|
382
|
+
//img: true, // enables images
|
|
383
|
+
},
|
|
361
384
|
});
|
|
362
385
|
|
|
363
|
-
export default c.define(
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
386
|
+
export default c.define("/src/app/content", schema, [
|
|
387
|
+
{
|
|
388
|
+
tag: "p",
|
|
389
|
+
children: ["This is richtext"],
|
|
390
|
+
},
|
|
391
|
+
{
|
|
392
|
+
tag: "p",
|
|
393
|
+
children: [{ tag: "span", styles: ["bold"], children: ["Bold"] }, "text"],
|
|
394
|
+
},
|
|
395
|
+
]);
|
|
372
396
|
```
|
|
373
397
|
|
|
374
398
|
### Rendering RichText
|
|
@@ -387,7 +411,9 @@ export default function Page() {
|
|
|
387
411
|
<main>
|
|
388
412
|
<ValRichText
|
|
389
413
|
theme={{
|
|
390
|
-
|
|
414
|
+
style: {
|
|
415
|
+
bold: "font-bold", // <- maps bold to a class. NOTE: tailwind classes are supported
|
|
416
|
+
},
|
|
391
417
|
//
|
|
392
418
|
}}
|
|
393
419
|
>
|
|
@@ -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-
|
|
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-
|
|
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-
|
|
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());
|
|
@@ -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-
|
|
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-
|
|
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-
|
|
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';
|
|
@@ -2,7 +2,7 @@ export { Schema, type SerializedSchema } from "@valbuild/core";
|
|
|
2
2
|
export type { SourceObject, SourcePrimitive, Source } from "@valbuild/core";
|
|
3
3
|
export type { ValModule, SerializedModule } from "@valbuild/core";
|
|
4
4
|
export type { FileSource } from "@valbuild/core";
|
|
5
|
-
export type { RichTextSource
|
|
5
|
+
export type { RichTextSource } from "@valbuild/core";
|
|
6
6
|
export { type Val, type SerializedVal, type ModuleFilePath, type ModulePath, type SourcePath, type JsonOfSource, } from "@valbuild/core";
|
|
7
7
|
export { modules, type ValModules } from "@valbuild/core";
|
|
8
8
|
export type { Json, JsonPrimitive } from "@valbuild/core";
|
|
@@ -14,7 +14,7 @@ export { VAL_EXTENSION, type SourceArray } from "@valbuild/core";
|
|
|
14
14
|
export { derefPatch } from "@valbuild/core";
|
|
15
15
|
export { type SelectorSource, type SelectorOf, GenericSelector, } from "@valbuild/core";
|
|
16
16
|
export { ValRichText } from "@valbuild/react/internal";
|
|
17
|
-
export { type ValEncodedString, type Image } from "@valbuild/react/stega";
|
|
17
|
+
export { type ValEncodedString, type File, type Image, type RichText, } from "@valbuild/react/stega";
|
|
18
18
|
export { ValProvider } from "./ValProvider.js";
|
|
19
19
|
export { ValImage, type ValImageProps } from "./ValImage.js";
|
|
20
20
|
export { ValApp } from "./ValApp.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type ValConfig, type InitVal, type ValConstructor,
|
|
1
|
+
import { type ValConfig, type InitVal, type ValConstructor, ValModule, SelectorSource, Json } from "@valbuild/core";
|
|
2
2
|
import { raw } from "./raw.js";
|
|
3
3
|
import { decodeValPathOfString } from "./decodeValPathOfString.js";
|
|
4
4
|
type ValAttrs = {
|
|
@@ -7,7 +7,7 @@ type ValAttrs = {
|
|
|
7
7
|
export declare const initVal: (config?: ValConfig) => InitVal & {
|
|
8
8
|
val: ValConstructor & {
|
|
9
9
|
raw: typeof raw;
|
|
10
|
-
attrs: <T extends ValModule<SelectorSource> | Json
|
|
10
|
+
attrs: <T extends ValModule<SelectorSource> | Json>(target: T) => ValAttrs;
|
|
11
11
|
unstable_decodeValPathOfString: typeof decodeValPathOfString;
|
|
12
12
|
};
|
|
13
13
|
};
|
package/package.json
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"next",
|
|
9
9
|
"react"
|
|
10
10
|
],
|
|
11
|
-
"version": "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.
|
|
49
|
-
"@valbuild/react": "~0.
|
|
50
|
-
"@valbuild/server": "~0.
|
|
51
|
-
"@valbuild/ui": "~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
|
},
|