@seamlet/astro 0.12.0 → 0.12.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 CHANGED
@@ -178,7 +178,7 @@ export default defineSeamletSite({
178
178
  });
179
179
  ```
180
180
 
181
- A text with a link in a sentence, bold words or a list is one `richText` field, not a text cut around the link. Its value is data, never HTML: paragraphs (`{ kind: "paragraph", spans }`) and lists (`{ kind: "list", items }`) of pieces `{ text, bold?, italic?, href? }`, where `href` leads where a `link` may. `inline` keeps it one paragraph without lists, for a text inside an element that holds one line. A saved plain string is read as paragraphs, so a `text` field turned into `richText` keeps its words. Render it with the component of the package, which puts out paragraphs and lists (or, with `inline`, the words alone) and never raw HTML; style its elements from around it:
181
+ A text with a link in a sentence, bold words or a list is one `richText` field, not a text cut around the link. Its value is data, never HTML: paragraphs (`{ kind: "paragraph", spans }`) and lists (`{ kind: "list", items }`) of pieces `{ text, bold?, italic?, href? }`, where `href` leads where a `link` may. `inline` keeps it one paragraph without lists, for a text inside an element that holds one line. A saved plain string is read as paragraphs, so a `text` field turned into `richText` keeps its words, and a `richText` turned into `text` keeps them too, without their marks. Which texts to make formatted: prose (a lead, a description, a paragraph about the place) is `richText`; headings, names of records, the words of buttons and links, contacts and short labels stay `text`, so the owner meets one rule: a paragraph can be formatted, the rest is typed as it is. Give every mark a style the site's fonts can show: a font without an italic needs another way to show `<em>` (another family's italic, a colour), or the owner presses «К» and sees nothing. Render it with the component of the package, which puts out paragraphs and lists (or, with `inline`, the words alone) and never raw HTML; style its elements from around it:
182
182
 
183
183
  ```astro
184
184
  ---
package/dist/bridge.js CHANGED
@@ -18,7 +18,7 @@ import {
18
18
  shortcutOf,
19
19
  toggleList,
20
20
  toggleMark
21
- } from "./chunk-MW3BE5O6.js";
21
+ } from "./chunk-SSECNMAD.js";
22
22
  import {
23
23
  FIELD_PATH_ATTRIBUTE,
24
24
  REVEALED_ATTRIBUTE,
@@ -28,7 +28,7 @@ import {
28
28
  readRichText,
29
29
  resolveFieldPath,
30
30
  safeHref
31
- } from "./chunk-7GYJS7ZT.js";
31
+ } from "./chunk-ZS32CW5F.js";
32
32
 
33
33
  // src/bridge/typed-fields.ts
34
34
  function typedKindAt(schema, path) {
@@ -6,7 +6,7 @@ import {
6
6
  readRichText,
7
7
  resolveFieldPath,
8
8
  safeHref
9
- } from "./chunk-7GYJS7ZT.js";
9
+ } from "./chunk-ZS32CW5F.js";
10
10
 
11
11
  // src/bridge/editor-shortcuts.ts
12
12
  function shortcutOf(event) {
@@ -558,17 +558,23 @@ function parseField(field, input, path) {
558
558
  }
559
559
  }
560
560
  function parseText(field, input, path) {
561
- if (typeof input !== "string") {
561
+ const typed = typedTextOf(input);
562
+ if (typed === void 0) {
562
563
  return invalidType(defaultValue(field), path);
563
564
  }
564
- const isTooLong = field.maxLength !== void 0 && countCharacters(input) > field.maxLength;
565
+ const isTooLong = field.maxLength !== void 0 && countCharacters(typed) > field.maxLength;
565
566
  if (isTooLong) {
566
567
  return {
567
- value: input,
568
+ value: typed,
568
569
  issues: [{ path, code: "too-long", maxLength: field.maxLength }]
569
570
  };
570
571
  }
571
- return valid(input);
572
+ return valid(typed);
573
+ }
574
+ function typedTextOf(input) {
575
+ if (typeof input === "string") return input;
576
+ const formatted = readRichText(input);
577
+ return formatted === void 0 ? void 0 : plainTextOf(formatted);
572
578
  }
573
579
  function parseRichText(field, input, path) {
574
580
  const read2 = typeof input === "string" ? richTextOf(input) : readRichText(input);
package/dist/cli.js CHANGED
@@ -3,7 +3,7 @@ import {
3
3
  SITE_CONFIG_FILE,
4
4
  isSiteId,
5
5
  readSiteConfig
6
- } from "./chunk-7GYJS7ZT.js";
6
+ } from "./chunk-ZS32CW5F.js";
7
7
  import {
8
8
  SITE_MODULE_FILE
9
9
  } from "./chunk-QCVWHHJC.js";
package/dist/index.js CHANGED
@@ -6,7 +6,7 @@ import {
6
6
  SITE_DESCRIPTION_PATH,
7
7
  isJsonObject,
8
8
  readSiteConfig
9
- } from "./chunk-7GYJS7ZT.js";
9
+ } from "./chunk-ZS32CW5F.js";
10
10
  import {
11
11
  PREVIEW_PATH,
12
12
  SITE_MODULE_FILE,
package/dist/protocol.js CHANGED
@@ -22,8 +22,8 @@ import {
22
22
  shortcutOf,
23
23
  toggleList,
24
24
  toggleMark
25
- } from "./chunk-MW3BE5O6.js";
26
- import "./chunk-7GYJS7ZT.js";
25
+ } from "./chunk-SSECNMAD.js";
26
+ import "./chunk-ZS32CW5F.js";
27
27
  import "./chunk-QCVWHHJC.js";
28
28
  export {
29
29
  OWN_PHOTOS_PATH,
package/dist/schema.js CHANGED
@@ -57,7 +57,7 @@ import {
57
57
  toggle,
58
58
  url,
59
59
  withRecordIds
60
- } from "./chunk-7GYJS7ZT.js";
60
+ } from "./chunk-ZS32CW5F.js";
61
61
  export {
62
62
  FIELD_PATH_ATTRIBUTE,
63
63
  HOME_PAGE_PATH,
package/dist/site.js CHANGED
@@ -3,7 +3,7 @@ import {
3
3
  checkSiteDescription,
4
4
  formatFieldPath,
5
5
  parseContent
6
- } from "./chunk-7GYJS7ZT.js";
6
+ } from "./chunk-ZS32CW5F.js";
7
7
  import {
8
8
  SITE_MODULE_FILE
9
9
  } from "./chunk-QCVWHHJC.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seamlet/astro",
3
- "version": "0.12.0",
3
+ "version": "0.12.1",
4
4
  "description": "Connects an Astro site to the Seamlet CMS: the schema of its content, the preview the editor frames, and its published content.",
5
5
  "license": "MIT",
6
6
  "type": "module",