@seamlet/astro 0.12.0 → 1.0.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/CHANGELOG.md +28 -0
- package/README.md +1 -1
- package/dist/bridge.js +2 -2
- package/dist/{chunk-MW3BE5O6.js → chunk-SSECNMAD.js} +1 -1
- package/dist/{chunk-7GYJS7ZT.js → chunk-ZS32CW5F.js} +10 -4
- package/dist/cli.js +1 -1
- package/dist/index.js +1 -1
- package/dist/protocol.js +2 -2
- package/dist/schema.js +1 -1
- package/dist/site.js +1 -1
- package/package.json +3 -2
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 1.0.0
|
|
4
|
+
|
|
5
|
+
The first stable version. From here the package follows semver: what a site writes against it keeps building until the next major version.
|
|
6
|
+
|
|
7
|
+
What is stable:
|
|
8
|
+
|
|
9
|
+
- `@seamlet/astro` — the integration `seamlet()`, with the site's id, title and CMS in `seamlet.json` (`CMS_ORIGIN` takes the place of `cms`).
|
|
10
|
+
- `@seamlet/astro/site` — `defineSeamletSite({ schema, initialContent, pages, photos })` with `pageAt`, `loadPublishedContent`, `ownPhotoAt` and `description`.
|
|
11
|
+
- `@seamlet/astro/schema` — the field kinds and their builders, `ContentOf`, `defaultContent`, `parseContent`, `editable`, `resolveFieldPath`, formatted text (`richTextOf`, `plainTextOf`, `linesOf`), `safeHref`, `imagePosition`, the presets, record ids, `readSiteConfig`, `readSiteDescription`, `checkSiteDescription` and `checkFields`.
|
|
12
|
+
- `@seamlet/astro/components/RichText.astro` and the routes the integration adds: the preview (`/preview`), the site's description (`/seamlet/site.json`), the photos taken from the CMS (`/media/<site>/<file>`) and the site's own photos for the editor (`/seamlet-photos/<address>`).
|
|
13
|
+
- `@seamlet/astro/protocol` — the messages between the bridge and the CMS's editor at `PROTOCOL_VERSION` 2. A change the other side cannot read raises it; the editor speaks with the bridges of earlier versions it lists.
|
|
14
|
+
- `npx @seamlet/astro init`.
|
|
15
|
+
|
|
16
|
+
Since 0.12.1 nothing changed in the code.
|
|
17
|
+
|
|
18
|
+
## 0.12.1
|
|
19
|
+
|
|
20
|
+
- A field that became plain text keeps the words of a formatted text saved in it.
|
|
21
|
+
|
|
22
|
+
## 0.12.0
|
|
23
|
+
|
|
24
|
+
- `safeHref`: an address no link may have never reaches markup; `RichText` and the bridge use it.
|
|
25
|
+
- A site the CMS would refuse stops its build with every reason (`checkSiteDescription`, `checkFields`); `readFields` refuses names with a dot or of digits, options of the wrong kind, references to a missing collection and an `itemTitle` that is no text or link.
|
|
26
|
+
- Requests to the CMS are bounded in time and number; `/media` answers 502 when the CMS does not.
|
|
27
|
+
- A draft rendered while a text is typed or the page pressed is shown once that is over.
|
|
28
|
+
- `init` starts a site with a title of any length and writes its modules all or none.
|
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-
|
|
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-
|
|
31
|
+
} from "./chunk-ZS32CW5F.js";
|
|
32
32
|
|
|
33
33
|
// src/bridge/typed-fields.ts
|
|
34
34
|
function typedKindAt(schema, path) {
|
|
@@ -558,17 +558,23 @@ function parseField(field, input, path) {
|
|
|
558
558
|
}
|
|
559
559
|
}
|
|
560
560
|
function parseText(field, input, path) {
|
|
561
|
-
|
|
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(
|
|
565
|
+
const isTooLong = field.maxLength !== void 0 && countCharacters(typed) > field.maxLength;
|
|
565
566
|
if (isTooLong) {
|
|
566
567
|
return {
|
|
567
|
-
value:
|
|
568
|
+
value: typed,
|
|
568
569
|
issues: [{ path, code: "too-long", maxLength: field.maxLength }]
|
|
569
570
|
};
|
|
570
571
|
}
|
|
571
|
-
return valid(
|
|
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
package/dist/index.js
CHANGED
package/dist/protocol.js
CHANGED
package/dist/schema.js
CHANGED
package/dist/site.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@seamlet/astro",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.0",
|
|
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",
|
|
@@ -59,7 +59,8 @@
|
|
|
59
59
|
"files": [
|
|
60
60
|
"dist",
|
|
61
61
|
"routes",
|
|
62
|
-
"components"
|
|
62
|
+
"components",
|
|
63
|
+
"CHANGELOG.md"
|
|
63
64
|
],
|
|
64
65
|
"scripts": {
|
|
65
66
|
"build": "tsup"
|