@valbuild/next 0.62.6 → 0.63.0

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 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
- ## Introduction
64
+ ## Content as code
65
65
 
66
- Val is a CMS where **content** is **code** stored in your git repo.
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
- bold: true, // <- Enables bold in richtext
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: c.richtext`
214
- RichText is **awesome**`,
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
- bold: "font-bold",
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
- bold: true, // enables bold
353
- //italic: true, // enables italic text
354
- //lineThrough: true, // enables line/strike-through
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
- //headings: ["h1", "h2", "h3", "h4", "h5", "h6"], // sets which headings are available
357
- //a: true, // enables links
358
- //img: true, // enables images
359
- //ul: true, // enables unordered lists
360
- //ol: true, // enables ordered lists
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
- "/src/app/content",
365
- schema,
366
- c.richtext`
367
- NOTE: this is markdown.
368
-
369
- **Bold** text.
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
- bold: "font-bold", // <- maps bold to a class. NOTE: tailwind classes are supported
414
+ style: {
415
+ bold: "font-bold", // <- maps bold to a class. NOTE: tailwind classes are supported
416
+ },
391
417
  //
392
418
  }}
393
419
  >
@@ -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, RichText } from "@valbuild/core";
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, RichText, AnyRichTextOptions, ValModule, SelectorSource, Json } from "@valbuild/core";
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 | RichText<AnyRichTextOptions>>(target: T) => ValAttrs;
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.62.6",
11
+ "version": "0.63.0",
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.62.6",
49
- "@valbuild/react": "~0.62.6",
50
- "@valbuild/server": "~0.62.6",
51
- "@valbuild/ui": "~0.62.6",
48
+ "@valbuild/core": "~0.63.0",
49
+ "@valbuild/react": "~0.63.0",
50
+ "@valbuild/server": "~0.63.0",
51
+ "@valbuild/ui": "~0.63.0",
52
52
  "client-only": "^0.0.1",
53
53
  "server-only": "^0.0.1"
54
54
  },