@seamlet/astro 0.3.0 → 0.5.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 +21 -1
- package/dist/bridge.d.ts +3 -3
- package/dist/bridge.js +2 -2
- package/dist/{chunk-AFTVM755.js → chunk-GLXC5OLC.js} +84 -2
- package/dist/{chunk-N2UE3EQU.js → chunk-XCBYYKWR.js} +1 -1
- package/dist/{content-GL5k9Mch.d.ts → content-C_WpiWBm.d.ts} +8 -1
- package/dist/index.js +58 -0
- package/dist/{messages-CJ8vKPs9.d.ts → messages-CBf5diaN.d.ts} +2 -2
- package/dist/{parse-content-CVU-pHrH.d.ts → parse-content-9RIWhb6z.d.ts} +1 -1
- package/dist/protocol.d.ts +3 -3
- package/dist/protocol.js +2 -2
- package/dist/schema.d.ts +80 -5
- package/dist/schema.js +11 -1
- package/dist/site.d.ts +1 -1
- package/dist/site.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -115,6 +115,26 @@ item: { name: text({ label: "Название" }), isHidden: toggle({ label: "С
|
|
|
115
115
|
// content.practices.filter((practice) => !practice.isHidden)
|
|
116
116
|
```
|
|
117
117
|
|
|
118
|
+
A photo may carry the point that must stay in view when the site crops it, chosen in the editor: put `imagePosition(photo)` into its `object-position` (the middle when no point is chosen):
|
|
119
|
+
|
|
120
|
+
```astro
|
|
121
|
+
<img
|
|
122
|
+
src={photo.src}
|
|
123
|
+
alt={photo.alt}
|
|
124
|
+
style={`object-fit: cover; object-position: ${imagePosition(photo)}`}
|
|
125
|
+
/>
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
## Presets
|
|
129
|
+
|
|
130
|
+
Sets of fields almost every site has, edited the same way everywhere; they are plain groups and collections, rendered as the site likes:
|
|
131
|
+
|
|
132
|
+
- `seoFields()` — `title`, `description` and `image` of a page for search engines and links shared in messengers;
|
|
133
|
+
- `contactsFields()` — `phone` (a link), `address`, `map` (an address) and `messengers` (links);
|
|
134
|
+
- `openingHoursField()` — rows of `days` (`WEEKDAYS`), `opens` and `closes` times and a `note`.
|
|
135
|
+
|
|
136
|
+
Each takes `{ label }` to name it otherwise.
|
|
137
|
+
|
|
118
138
|
## Records and references
|
|
119
139
|
|
|
120
140
|
Every record of a collection has an `id` of its own, which never changes when records move, so a record has no field named `id`. The CMS gives ids to records that have none (`withRecordIds`), so a site's initial content may leave them out, unless something refers to those records.
|
|
@@ -158,7 +178,7 @@ What was opened stays open while the page is rendered anew after every edit.
|
|
|
158
178
|
|
|
159
179
|
- `/preview` and `/preview/<page>`: the preview the CMS's editor frames. `GET` shows the published content; `POST` with the content as JSON shows that content without saving it, which is how the editor shows every edit at once. Only the CMS may frame it (`Content-Security-Policy: frame-ancestors`), and it is never indexed or cached.
|
|
160
180
|
- The bridge on the preview: it tells the editor where the marked elements are and what a person does on the page, and types texts in place.
|
|
161
|
-
- `/media/<site>/<file>`: the photos uploaded in the CMS, taken from it.
|
|
181
|
+
- `/media/<site>/<file>`: the photos uploaded in the CMS, taken from it on request; a static build copies every uploaded photo its built pages refer to next to them, so a static host serves them too.
|
|
162
182
|
|
|
163
183
|
A site never renders content as raw HTML (`set:html`): the editor acts on what its preview says.
|
|
164
184
|
|
package/dist/bridge.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { F as Fields } from './content-
|
|
2
|
-
import { P as PageMessage, E as EditorMessage } from './messages-
|
|
3
|
-
import './parse-content-
|
|
1
|
+
import { F as Fields } from './content-C_WpiWBm.js';
|
|
2
|
+
import { P as PageMessage, E as EditorMessage } from './messages-CBf5diaN.js';
|
|
3
|
+
import './parse-content-9RIWhb6z.js';
|
|
4
4
|
|
|
5
5
|
interface BridgeOptions {
|
|
6
6
|
/** The origin of the CMS whose editor may frame the page, such as `https://cms.example.com`. */
|
package/dist/bridge.js
CHANGED
|
@@ -5,13 +5,13 @@ import {
|
|
|
5
5
|
imageFieldAt,
|
|
6
6
|
readEditorMessage,
|
|
7
7
|
shortcutOf
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-XCBYYKWR.js";
|
|
9
9
|
import {
|
|
10
10
|
FIELD_PATH_ATTRIBUTE,
|
|
11
11
|
REVEALED_ATTRIBUTE,
|
|
12
12
|
REVEAL_ATTRIBUTE,
|
|
13
13
|
REVEAL_EVENT
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-GLXC5OLC.js";
|
|
15
15
|
|
|
16
16
|
// src/bridge/page-markers.ts
|
|
17
17
|
var MARKER_SELECTOR = `[${FIELD_PATH_ATTRIBUTE}]`;
|
|
@@ -398,7 +398,8 @@ function parseImage(field, input, path) {
|
|
|
398
398
|
if (typeof src !== "string" || typeof alt !== "string") {
|
|
399
399
|
return invalidType(defaultValue(field), path);
|
|
400
400
|
}
|
|
401
|
-
const
|
|
401
|
+
const focus = isRecord(input) ? focusOf(input["focus"]) : void 0;
|
|
402
|
+
const image2 = focus === void 0 ? { src, alt } : { src, alt, focus };
|
|
402
403
|
if (src.trim() === "") {
|
|
403
404
|
return { value: image2, issues: [{ path, code: "missing-image-src" }] };
|
|
404
405
|
}
|
|
@@ -521,6 +522,15 @@ function parseReferences(field, input, path) {
|
|
|
521
522
|
const ids = [...new Set(input)];
|
|
522
523
|
return valid(ids);
|
|
523
524
|
}
|
|
525
|
+
function focusOf(input) {
|
|
526
|
+
if (!isRecord(input)) return void 0;
|
|
527
|
+
const { x, y } = input;
|
|
528
|
+
const isInside = isFraction(x) && isFraction(y);
|
|
529
|
+
return isInside ? { x, y } : void 0;
|
|
530
|
+
}
|
|
531
|
+
function isFraction(value) {
|
|
532
|
+
return typeof value === "number" && value >= 0 && value <= 1;
|
|
533
|
+
}
|
|
524
534
|
function isCalendarDate(value) {
|
|
525
535
|
if (!DATE_PATTERN.test(value)) {
|
|
526
536
|
return false;
|
|
@@ -588,6 +598,73 @@ var REVEAL_ATTRIBUTE = "data-cms-reveal";
|
|
|
588
598
|
var REVEALED_ATTRIBUTE = "data-cms-revealed";
|
|
589
599
|
var REVEAL_EVENT = "cms:reveal";
|
|
590
600
|
|
|
601
|
+
// src/schema/image-position.ts
|
|
602
|
+
var PERCENT = 100;
|
|
603
|
+
var STEPS_PER_PERCENT = 10;
|
|
604
|
+
var MIDDLE = 0.5;
|
|
605
|
+
function imagePosition(image2) {
|
|
606
|
+
const x = image2?.focus?.x ?? MIDDLE;
|
|
607
|
+
const y = image2?.focus?.y ?? MIDDLE;
|
|
608
|
+
return `${percentOf(x)} ${percentOf(y)}`;
|
|
609
|
+
}
|
|
610
|
+
function percentOf(fraction) {
|
|
611
|
+
const steps = Math.round(fraction * PERCENT * STEPS_PER_PERCENT);
|
|
612
|
+
const rounded = steps / STEPS_PER_PERCENT;
|
|
613
|
+
return `${String(rounded)}%`;
|
|
614
|
+
}
|
|
615
|
+
|
|
616
|
+
// src/schema/presets.ts
|
|
617
|
+
function seoFields(options = {}) {
|
|
618
|
+
return group({
|
|
619
|
+
label: options.label ?? "\u041F\u043E\u0438\u0441\u043A\u043E\u0432\u0438\u043A\u0438 \u0438 \u0441\u043E\u0446\u0441\u0435\u0442\u0438",
|
|
620
|
+
fields: {
|
|
621
|
+
title: text({ label: "\u0417\u0430\u0433\u043E\u043B\u043E\u0432\u043E\u043A \u0432 \u043F\u043E\u0438\u0441\u043A\u0435", maxLength: 60 }),
|
|
622
|
+
description: text({
|
|
623
|
+
label: "\u041E\u043F\u0438\u0441\u0430\u043D\u0438\u0435 \u0432 \u043F\u043E\u0438\u0441\u043A\u0435",
|
|
624
|
+
multiline: true,
|
|
625
|
+
maxLength: 160
|
|
626
|
+
}),
|
|
627
|
+
image: image({ label: "\u041A\u0430\u0440\u0442\u0438\u043D\u043A\u0430 \u0434\u043B\u044F \u0441\u043E\u0446\u0441\u0435\u0442\u0435\u0439" })
|
|
628
|
+
}
|
|
629
|
+
});
|
|
630
|
+
}
|
|
631
|
+
function contactsFields(options = {}) {
|
|
632
|
+
return group({
|
|
633
|
+
label: options.label ?? "\u041A\u043E\u043D\u0442\u0430\u043A\u0442\u044B",
|
|
634
|
+
fields: {
|
|
635
|
+
phone: link({ label: "\u0422\u0435\u043B\u0435\u0444\u043E\u043D" }),
|
|
636
|
+
address: text({ label: "\u0410\u0434\u0440\u0435\u0441", multiline: true }),
|
|
637
|
+
map: url({ label: "\u0421\u0441\u044B\u043B\u043A\u0430 \u043D\u0430 \u043A\u0430\u0440\u0442\u0443" }),
|
|
638
|
+
messengers: collection({
|
|
639
|
+
label: "\u041C\u0435\u0441\u0441\u0435\u043D\u0434\u0436\u0435\u0440\u044B \u0438 \u0441\u043E\u0446\u0441\u0435\u0442\u0438",
|
|
640
|
+
itemTitle: "link",
|
|
641
|
+
item: { link: link({ label: "\u0421\u0441\u044B\u043B\u043A\u0430" }) }
|
|
642
|
+
})
|
|
643
|
+
}
|
|
644
|
+
});
|
|
645
|
+
}
|
|
646
|
+
var WEEKDAYS = [
|
|
647
|
+
{ value: "mon", label: "\u041F\u043D" },
|
|
648
|
+
{ value: "tue", label: "\u0412\u0442" },
|
|
649
|
+
{ value: "wed", label: "\u0421\u0440" },
|
|
650
|
+
{ value: "thu", label: "\u0427\u0442" },
|
|
651
|
+
{ value: "fri", label: "\u041F\u0442" },
|
|
652
|
+
{ value: "sat", label: "\u0421\u0431" },
|
|
653
|
+
{ value: "sun", label: "\u0412\u0441" }
|
|
654
|
+
];
|
|
655
|
+
function openingHoursField(options = {}) {
|
|
656
|
+
return collection({
|
|
657
|
+
label: options.label ?? "\u0427\u0430\u0441\u044B \u0440\u0430\u0431\u043E\u0442\u044B",
|
|
658
|
+
itemTitle: "note",
|
|
659
|
+
item: {
|
|
660
|
+
days: choices({ label: "\u0414\u043D\u0438", options: WEEKDAYS }),
|
|
661
|
+
opens: time({ label: "\u041E\u0442\u043A\u0440\u044B\u0432\u0430\u0435\u0442\u0441\u044F" }),
|
|
662
|
+
closes: time({ label: "\u0417\u0430\u043A\u0440\u044B\u0432\u0430\u0435\u0442\u0441\u044F" }),
|
|
663
|
+
note: text({ label: "\u041F\u043E\u0434\u043F\u0438\u0441\u044C", maxLength: 40 })
|
|
664
|
+
}
|
|
665
|
+
});
|
|
666
|
+
}
|
|
667
|
+
|
|
591
668
|
export {
|
|
592
669
|
defineSchema,
|
|
593
670
|
text,
|
|
@@ -622,5 +699,10 @@ export {
|
|
|
622
699
|
resolveFieldPath,
|
|
623
700
|
REVEAL_ATTRIBUTE,
|
|
624
701
|
REVEALED_ATTRIBUTE,
|
|
625
|
-
REVEAL_EVENT
|
|
702
|
+
REVEAL_EVENT,
|
|
703
|
+
imagePosition,
|
|
704
|
+
seoFields,
|
|
705
|
+
contactsFields,
|
|
706
|
+
WEEKDAYS,
|
|
707
|
+
openingHoursField
|
|
626
708
|
};
|
|
@@ -125,9 +125,16 @@ declare function references(options: FieldOptions<ReferencesField>): ReferencesF
|
|
|
125
125
|
declare function group<F extends Fields>(options: FieldOptions<GroupField<F>>): GroupField<F>;
|
|
126
126
|
declare function collection<F extends RecordFields>(options: FieldOptions<CollectionField<F>>): CollectionField<F>;
|
|
127
127
|
|
|
128
|
+
/** The point of a photo that must stay in view when a site crops it: 0 to 1 from the left and the top. */
|
|
129
|
+
interface ImageFocus {
|
|
130
|
+
readonly x: number;
|
|
131
|
+
readonly y: number;
|
|
132
|
+
}
|
|
128
133
|
interface ImageValue {
|
|
129
134
|
readonly src: string;
|
|
130
135
|
readonly alt: string;
|
|
136
|
+
/** Unset: the middle of the photo (see imagePosition). */
|
|
137
|
+
readonly focus?: ImageFocus;
|
|
131
138
|
}
|
|
132
139
|
interface LinkValue {
|
|
133
140
|
readonly text: string;
|
|
@@ -160,4 +167,4 @@ type FieldValue = string | number | boolean | null | readonly string[] | ImageVa
|
|
|
160
167
|
declare function defaultValue(field: Field): FieldValue;
|
|
161
168
|
declare function defaultContent(fields: Fields): Content;
|
|
162
169
|
|
|
163
|
-
export {
|
|
170
|
+
export { number as A, reference as B, type ContentOf as C, type DateField as D, references as E, type Fields as F, type GroupField as G, text as H, type ImageField as I, time as J, toggle as K, type LinkValue as L, url as M, type NumberField as N, type OptionValue as O, type RecordFields as R, type TextField as T, type UrlField as U, type ValueOf as V, type Content as a, type ImageValue as b, type Field as c, type CollectionField as d, type LinkField as e, type ChoicesField as f, type TimeField as g, type ChoiceField as h, type ChoiceOption as i, type FieldKind as j, type FieldValue as k, type ImageFocus as l, type RecordOf as m, type ReferenceField as n, type ReferencesField as o, type ToggleField as p, choice as q, choices as r, collection as s, date as t, defaultContent as u, defaultValue as v, defineSchema as w, group as x, image as y, link as z };
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,53 @@
|
|
|
1
|
+
import {
|
|
2
|
+
isUploadedPhoto
|
|
3
|
+
} from "./chunk-P2OQOZBC.js";
|
|
4
|
+
|
|
1
5
|
// src/index.ts
|
|
2
6
|
import { fileURLToPath } from "url";
|
|
7
|
+
|
|
8
|
+
// src/uploaded-photos.ts
|
|
9
|
+
import { mkdir, readdir, readFile, writeFile } from "fs/promises";
|
|
10
|
+
import { dirname, join } from "path";
|
|
11
|
+
var PHOTO_ADDRESS = /\/media\/([a-z0-9-]+)\/([A-Za-z0-9_-]+\.webp)/gu;
|
|
12
|
+
var HTML_EXTENSION = ".html";
|
|
13
|
+
function uploadedPhotoAddresses(html) {
|
|
14
|
+
const addresses = [...html.matchAll(PHOTO_ADDRESS)].flatMap(
|
|
15
|
+
([address, , fileName]) => isUploadedPhoto(fileName) ? [address] : []
|
|
16
|
+
);
|
|
17
|
+
return [...new Set(addresses)];
|
|
18
|
+
}
|
|
19
|
+
async function copyUploadedPhotos(options) {
|
|
20
|
+
const pages = await htmlFilesIn(options.directory);
|
|
21
|
+
const texts = await Promise.all(pages.map((page) => readFile(page, "utf8")));
|
|
22
|
+
const addresses = new Set(texts.flatMap(uploadedPhotoAddresses));
|
|
23
|
+
await Promise.all(
|
|
24
|
+
[...addresses].map(
|
|
25
|
+
(address) => copyPhoto(address, options.directory, options.cmsOrigin)
|
|
26
|
+
)
|
|
27
|
+
);
|
|
28
|
+
return addresses.size;
|
|
29
|
+
}
|
|
30
|
+
async function copyPhoto(address, directory, cmsOrigin) {
|
|
31
|
+
const url = new URL(address, cmsOrigin);
|
|
32
|
+
const response = await fetch(url);
|
|
33
|
+
if (!response.ok) {
|
|
34
|
+
throw new Error(
|
|
35
|
+
`Copying the photo ${url.href} into the build failed with status ${String(response.status)}`
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
const target = join(directory, address);
|
|
39
|
+
await mkdir(dirname(target), { recursive: true });
|
|
40
|
+
await writeFile(target, new Uint8Array(await response.arrayBuffer()));
|
|
41
|
+
}
|
|
42
|
+
async function htmlFilesIn(directory) {
|
|
43
|
+
const entries = await readdir(directory, {
|
|
44
|
+
recursive: true,
|
|
45
|
+
withFileTypes: true
|
|
46
|
+
});
|
|
47
|
+
return entries.filter((entry) => entry.isFile() && entry.name.endsWith(HTML_EXTENSION)).map((entry) => join(entry.parentPath, entry.name));
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
// src/index.ts
|
|
3
51
|
var CONFIG_MODULE = "virtual:seamlet/config";
|
|
4
52
|
var SITE_MODULE = "virtual:seamlet/site";
|
|
5
53
|
var RESOLVED_CONFIG_MODULE = `\0${CONFIG_MODULE}`;
|
|
@@ -41,6 +89,16 @@ function seamlet(options) {
|
|
|
41
89
|
entrypoint: "@seamlet/astro/routes/media",
|
|
42
90
|
prerender: false
|
|
43
91
|
});
|
|
92
|
+
},
|
|
93
|
+
// A static host has no route to take the uploaded photos from the CMS on request: the photos
|
|
94
|
+
// the built pages refer to are copied next to them. Pages rendered on request take them
|
|
95
|
+
// through the route above.
|
|
96
|
+
"astro:build:done": async ({ dir, logger }) => {
|
|
97
|
+
const copied = await copyUploadedPhotos({
|
|
98
|
+
directory: fileURLToPath(dir),
|
|
99
|
+
cmsOrigin
|
|
100
|
+
});
|
|
101
|
+
if (copied > 0) logger.info(`copied ${String(copied)} uploaded photos`);
|
|
44
102
|
}
|
|
45
103
|
}
|
|
46
104
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { F as Fields, a as Content } from './content-
|
|
2
|
-
import { F as FieldPath } from './parse-content-
|
|
1
|
+
import { F as Fields, a as Content } from './content-C_WpiWBm.js';
|
|
2
|
+
import { F as FieldPath } from './parse-content-9RIWhb6z.js';
|
|
3
3
|
|
|
4
4
|
interface Box {
|
|
5
5
|
readonly top: number;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { F as Fields, C as ContentOf } from './content-
|
|
1
|
+
import { F as Fields, C as ContentOf } from './content-C_WpiWBm.js';
|
|
2
2
|
|
|
3
3
|
/** Where a value lives in the content: field names and, inside a collection, record indexes. */
|
|
4
4
|
type FieldPath = readonly (string | number)[];
|
package/dist/protocol.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export { B as Box, a as EditorKey, E as EditorMessage, I as InlineEditingOutcome, L as LinkBox, M as MarkerBox, b as PROTOCOL_VERSION, c as PageLayout, P as PageMessage, d as Point, S as Shortcut, V as Viewport, r as readEditorMessage, e as readPageMessage, s as shortcutOf } from './messages-
|
|
2
|
-
import { F as Fields, I as ImageField } from './content-
|
|
3
|
-
import { F as FieldPath } from './parse-content-
|
|
1
|
+
export { B as Box, a as EditorKey, E as EditorMessage, I as InlineEditingOutcome, L as LinkBox, M as MarkerBox, b as PROTOCOL_VERSION, c as PageLayout, P as PageMessage, d as Point, S as Shortcut, V as Viewport, r as readEditorMessage, e as readPageMessage, s as shortcutOf } from './messages-CBf5diaN.js';
|
|
2
|
+
import { F as Fields, I as ImageField } from './content-C_WpiWBm.js';
|
|
3
|
+
import { F as FieldPath } from './parse-content-9RIWhb6z.js';
|
|
4
4
|
|
|
5
5
|
declare function carriesFiles(event: DragEvent): boolean;
|
|
6
6
|
|
package/dist/protocol.js
CHANGED
package/dist/schema.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { b as ImageValue, L as LinkValue, c as Field, d as CollectionField, F as Fields, a as Content, R as RecordFields, C as ContentOf } from './content-
|
|
2
|
-
export {
|
|
3
|
-
import { F as FieldPath } from './parse-content-
|
|
4
|
-
export { C as ContentIssue, P as ParsedContent, c as countCharacters, f as formatFieldPath, p as parseContent } from './parse-content-
|
|
1
|
+
import { b as ImageValue, L as LinkValue, c as Field, d as CollectionField, F as Fields, a as Content, R as RecordFields, C as ContentOf, G as GroupField, e as LinkField, T as TextField, U as UrlField, f as ChoicesField, g as TimeField, I as ImageField } from './content-C_WpiWBm.js';
|
|
2
|
+
export { h as ChoiceField, i as ChoiceOption, D as DateField, j as FieldKind, k as FieldValue, l as ImageFocus, N as NumberField, O as OptionValue, m as RecordOf, n as ReferenceField, o as ReferencesField, p as ToggleField, V as ValueOf, q as choice, r as choices, s as collection, t as date, u as defaultContent, v as defaultValue, w as defineSchema, x as group, y as image, z as link, A as number, B as reference, E as references, H as text, J as time, K as toggle, M as url } from './content-C_WpiWBm.js';
|
|
3
|
+
import { F as FieldPath } from './parse-content-9RIWhb6z.js';
|
|
4
|
+
export { C as ContentIssue, P as ParsedContent, c as countCharacters, f as formatFieldPath, p as parseContent } from './parse-content-9RIWhb6z.js';
|
|
5
5
|
|
|
6
6
|
declare const FIELD_PATH_ATTRIBUTE = "data-cms-path";
|
|
7
7
|
interface FieldMarker {
|
|
@@ -96,4 +96,79 @@ declare function linkTargetOf(href: string): LinkTarget | undefined;
|
|
|
96
96
|
*/
|
|
97
97
|
declare function hrefOf(target: LinkTarget): string;
|
|
98
98
|
|
|
99
|
-
|
|
99
|
+
/** `object-position` of the photo: "50% 30%"; the middle when no point is chosen. */
|
|
100
|
+
declare function imagePosition(image: ImageValue | null): string;
|
|
101
|
+
|
|
102
|
+
/** What search engines and a link shared in a messenger show: one per page. */
|
|
103
|
+
declare function seoFields(options?: {
|
|
104
|
+
readonly label?: string;
|
|
105
|
+
}): GroupField<{
|
|
106
|
+
title: TextField;
|
|
107
|
+
description: TextField;
|
|
108
|
+
image: ImageField;
|
|
109
|
+
}>;
|
|
110
|
+
/** How to reach the business: the phone, the address with a map, the messengers. */
|
|
111
|
+
declare function contactsFields(options?: {
|
|
112
|
+
readonly label?: string;
|
|
113
|
+
}): GroupField<{
|
|
114
|
+
phone: LinkField;
|
|
115
|
+
address: TextField;
|
|
116
|
+
map: UrlField;
|
|
117
|
+
messengers: CollectionField<{
|
|
118
|
+
link: LinkField;
|
|
119
|
+
}>;
|
|
120
|
+
}>;
|
|
121
|
+
declare const WEEKDAYS: readonly [{
|
|
122
|
+
readonly value: "mon";
|
|
123
|
+
readonly label: "Пн";
|
|
124
|
+
}, {
|
|
125
|
+
readonly value: "tue";
|
|
126
|
+
readonly label: "Вт";
|
|
127
|
+
}, {
|
|
128
|
+
readonly value: "wed";
|
|
129
|
+
readonly label: "Ср";
|
|
130
|
+
}, {
|
|
131
|
+
readonly value: "thu";
|
|
132
|
+
readonly label: "Чт";
|
|
133
|
+
}, {
|
|
134
|
+
readonly value: "fri";
|
|
135
|
+
readonly label: "Пт";
|
|
136
|
+
}, {
|
|
137
|
+
readonly value: "sat";
|
|
138
|
+
readonly label: "Сб";
|
|
139
|
+
}, {
|
|
140
|
+
readonly value: "sun";
|
|
141
|
+
readonly label: "Вс";
|
|
142
|
+
}];
|
|
143
|
+
/** When the business is open: rows of days with the same hours, «Пн–Пт 08:00–21:00». */
|
|
144
|
+
declare function openingHoursField(options?: {
|
|
145
|
+
readonly label?: string;
|
|
146
|
+
}): CollectionField<{
|
|
147
|
+
days: ChoicesField<readonly [{
|
|
148
|
+
readonly value: "mon";
|
|
149
|
+
readonly label: "Пн";
|
|
150
|
+
}, {
|
|
151
|
+
readonly value: "tue";
|
|
152
|
+
readonly label: "Вт";
|
|
153
|
+
}, {
|
|
154
|
+
readonly value: "wed";
|
|
155
|
+
readonly label: "Ср";
|
|
156
|
+
}, {
|
|
157
|
+
readonly value: "thu";
|
|
158
|
+
readonly label: "Чт";
|
|
159
|
+
}, {
|
|
160
|
+
readonly value: "fri";
|
|
161
|
+
readonly label: "Пт";
|
|
162
|
+
}, {
|
|
163
|
+
readonly value: "sat";
|
|
164
|
+
readonly label: "Сб";
|
|
165
|
+
}, {
|
|
166
|
+
readonly value: "sun";
|
|
167
|
+
readonly label: "Вс";
|
|
168
|
+
}]>;
|
|
169
|
+
opens: TimeField;
|
|
170
|
+
closes: TimeField;
|
|
171
|
+
note: TextField;
|
|
172
|
+
}>;
|
|
173
|
+
|
|
174
|
+
export { ChoicesField, CollectionField, type CollectionRecords, Content, ContentOf, type ContentPath, FIELD_PATH_ATTRIBUTE, Field, type FieldMarker, FieldPath, type FieldTarget, Fields, GroupField, ImageField, ImageValue, LinkField, type LinkKind, type LinkTarget, LinkValue, RECORD_ID_KEY, REVEALED_ATTRIBUTE, REVEAL_ATTRIBUTE, REVEAL_EVENT, RecordFields, TextField, TimeField, UrlField, WEEKDAYS, collectionAt, contactsFields, editable, findRecord, hrefOf, imagePosition, isRecordId, linkTargetOf, newRecord, openingHoursField, resolveFieldPath, seoFields, withRecordIds };
|
package/dist/schema.js
CHANGED
|
@@ -4,10 +4,12 @@ import {
|
|
|
4
4
|
REVEALED_ATTRIBUTE,
|
|
5
5
|
REVEAL_ATTRIBUTE,
|
|
6
6
|
REVEAL_EVENT,
|
|
7
|
+
WEEKDAYS,
|
|
7
8
|
choice,
|
|
8
9
|
choices,
|
|
9
10
|
collection,
|
|
10
11
|
collectionAt,
|
|
12
|
+
contactsFields,
|
|
11
13
|
countCharacters,
|
|
12
14
|
date,
|
|
13
15
|
defaultContent,
|
|
@@ -19,31 +21,36 @@ import {
|
|
|
19
21
|
group,
|
|
20
22
|
hrefOf,
|
|
21
23
|
image,
|
|
24
|
+
imagePosition,
|
|
22
25
|
isRecordId,
|
|
23
26
|
link,
|
|
24
27
|
linkTargetOf,
|
|
25
28
|
newRecord,
|
|
26
29
|
number,
|
|
30
|
+
openingHoursField,
|
|
27
31
|
parseContent,
|
|
28
32
|
reference,
|
|
29
33
|
references,
|
|
30
34
|
resolveFieldPath,
|
|
35
|
+
seoFields,
|
|
31
36
|
text,
|
|
32
37
|
time,
|
|
33
38
|
toggle,
|
|
34
39
|
url,
|
|
35
40
|
withRecordIds
|
|
36
|
-
} from "./chunk-
|
|
41
|
+
} from "./chunk-GLXC5OLC.js";
|
|
37
42
|
export {
|
|
38
43
|
FIELD_PATH_ATTRIBUTE,
|
|
39
44
|
RECORD_ID_KEY,
|
|
40
45
|
REVEALED_ATTRIBUTE,
|
|
41
46
|
REVEAL_ATTRIBUTE,
|
|
42
47
|
REVEAL_EVENT,
|
|
48
|
+
WEEKDAYS,
|
|
43
49
|
choice,
|
|
44
50
|
choices,
|
|
45
51
|
collection,
|
|
46
52
|
collectionAt,
|
|
53
|
+
contactsFields,
|
|
47
54
|
countCharacters,
|
|
48
55
|
date,
|
|
49
56
|
defaultContent,
|
|
@@ -55,15 +62,18 @@ export {
|
|
|
55
62
|
group,
|
|
56
63
|
hrefOf,
|
|
57
64
|
image,
|
|
65
|
+
imagePosition,
|
|
58
66
|
isRecordId,
|
|
59
67
|
link,
|
|
60
68
|
linkTargetOf,
|
|
61
69
|
newRecord,
|
|
62
70
|
number,
|
|
71
|
+
openingHoursField,
|
|
63
72
|
parseContent,
|
|
64
73
|
reference,
|
|
65
74
|
references,
|
|
66
75
|
resolveFieldPath,
|
|
76
|
+
seoFields,
|
|
67
77
|
text,
|
|
68
78
|
time,
|
|
69
79
|
toggle,
|
package/dist/site.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AstroComponentFactory } from 'astro/runtime/server/index.js';
|
|
2
|
-
import { F as Fields, C as ContentOf } from './content-
|
|
2
|
+
import { F as Fields, C as ContentOf } from './content-C_WpiWBm.js';
|
|
3
3
|
|
|
4
4
|
interface SeamletSiteDefinition<F extends Fields> {
|
|
5
5
|
/** The site's address in the CMS: `/sites/<id>`. */
|
package/dist/site.js
CHANGED
package/package.json
CHANGED