@brimsites/brimjs 0.0.0-stage → 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/LICENSE +110 -0
- package/README.md +22 -2
- package/bin/brim.js +5 -0
- package/dist/cli.js +3802 -0
- package/editor-dist/editor.css +1 -0
- package/editor-dist/editor.js +91 -0
- package/package.json +71 -3
- package/skills/brim-convert/SKILL.md +256 -0
- package/skills/brim-hosting/SKILL.md +221 -0
- package/src/astro-shim.d.ts +5 -0
- package/src/auth/accounts.ts +341 -0
- package/src/auth/password.ts +34 -0
- package/src/auth/permissions.ts +44 -0
- package/src/blocks/accordion/Accordion.astro +48 -0
- package/src/blocks/accordion/accordion.css +63 -0
- package/src/blocks/analytics/Analytics.astro +45 -0
- package/src/blocks/analytics/ConsentBanner.astro +41 -0
- package/src/blocks/analytics/analytics.client.ts +125 -0
- package/src/blocks/analytics/analytics.css +51 -0
- package/src/blocks/analytics/consent.ts +51 -0
- package/src/blocks/button/Button.astro +64 -0
- package/src/blocks/button/button.css +100 -0
- package/src/blocks/carousel/Carousel.astro +140 -0
- package/src/blocks/carousel/carousel.client.ts +153 -0
- package/src/blocks/carousel/carousel.css +181 -0
- package/src/blocks/data/icons.ts +285 -0
- package/src/blocks/data/image-shapes.ts +91 -0
- package/src/blocks/data/social-icons.ts +41 -0
- package/src/blocks/data/social-networks.ts +256 -0
- package/src/blocks/divider/Divider.astro +27 -0
- package/src/blocks/divider/divider.css +17 -0
- package/src/blocks/form/Captcha.astro +27 -0
- package/src/blocks/form/Form.astro +250 -0
- package/src/blocks/form/FormField.astro +138 -0
- package/src/blocks/form/Newsletter.astro +80 -0
- package/src/blocks/form/form.client.ts +339 -0
- package/src/blocks/form/form.css +271 -0
- package/src/blocks/gallery/ImageGallery.astro +126 -0
- package/src/blocks/gallery/gallery.css +43 -0
- package/src/blocks/gallery/lightbox.client.ts +178 -0
- package/src/blocks/gallery/lightbox.css +134 -0
- package/src/blocks/icon/Icon.astro +41 -0
- package/src/blocks/icon/icon.css +16 -0
- package/src/blocks/image/Image.astro +158 -0
- package/src/blocks/image/image.css +42 -0
- package/src/blocks/images.ts +64 -0
- package/src/blocks/in-editor.client.ts +8 -0
- package/src/blocks/listing/Listing.astro +288 -0
- package/src/blocks/listing/ListingCards.astro +48 -0
- package/src/blocks/listing/listing.css +136 -0
- package/src/blocks/listing/query.ts +363 -0
- package/src/blocks/map/Map.astro +75 -0
- package/src/blocks/map/map.css +32 -0
- package/src/blocks/schemas/accordion.ts +118 -0
- package/src/blocks/schemas/button.ts +78 -0
- package/src/blocks/schemas/carousel.ts +133 -0
- package/src/blocks/schemas/divider.ts +29 -0
- package/src/blocks/schemas/form-field-types.ts +29 -0
- package/src/blocks/schemas/form.ts +350 -0
- package/src/blocks/schemas/icon.ts +24 -0
- package/src/blocks/schemas/image-gallery.ts +54 -0
- package/src/blocks/schemas/image.ts +87 -0
- package/src/blocks/schemas/index.ts +33 -0
- package/src/blocks/schemas/listing.ts +14 -0
- package/src/blocks/schemas/map.ts +81 -0
- package/src/blocks/schemas/newsletter.ts +324 -0
- package/src/blocks/schemas/social-media.ts +348 -0
- package/src/blocks/schemas/text.ts +151 -0
- package/src/blocks/schemas/video.ts +57 -0
- package/src/blocks/search/Search.astro +147 -0
- package/src/blocks/search/search.css +69 -0
- package/src/blocks/search/state.ts +28 -0
- package/src/blocks/settings.ts +94 -0
- package/src/blocks/social/SocialMedia.astro +102 -0
- package/src/blocks/social/social-links.ts +16 -0
- package/src/blocks/social/social.css +31 -0
- package/src/blocks/theme.ts +35 -0
- package/src/blocks/types.ts +52 -0
- package/src/blocks/video/Video.astro +90 -0
- package/src/blocks/video/video-source.ts +77 -0
- package/src/blocks/video/video.client.ts +43 -0
- package/src/blocks/video/video.css +29 -0
- package/src/check.ts +1119 -0
- package/src/cli.ts +493 -0
- package/src/components/Blocks.astro +68 -0
- package/src/components/Field.astro +61 -0
- package/src/components/Footer.astro +36 -0
- package/src/components/Link.astro +18 -0
- package/src/components/MobileMenu.astro +77 -0
- package/src/components/Navbar.astro +42 -0
- package/src/components/RichText.astro +32 -0
- package/src/components/Seo.astro +202 -0
- package/src/components/Setting.astro +46 -0
- package/src/components/Shared.astro +17 -0
- package/src/components/Text.astro +91 -0
- package/src/components/blocks.css +86 -0
- package/src/components/index.ts +27 -0
- package/src/components/mobile-menu.client.ts +21 -0
- package/src/components/mobile-menu.css +52 -0
- package/src/components/text.css +48 -0
- package/src/config.ts +413 -0
- package/src/content/block-layout.ts +63 -0
- package/src/content/block-values.ts +48 -0
- package/src/content/content-check.ts +174 -0
- package/src/content/content-types.ts +408 -0
- package/src/content/drafts.ts +115 -0
- package/src/content/feed.ts +237 -0
- package/src/content/field-types.ts +107 -0
- package/src/content/history.ts +140 -0
- package/src/content/ids.ts +50 -0
- package/src/content/image-size.ts +212 -0
- package/src/content/image-sizes.ts +126 -0
- package/src/content/item-fields.ts +110 -0
- package/src/content/item-head.ts +126 -0
- package/src/content/item-image.ts +26 -0
- package/src/content/item-path.ts +122 -0
- package/src/content/items.ts +580 -0
- package/src/content/language-scopes.ts +40 -0
- package/src/content/media.ts +271 -0
- package/src/content/menus.ts +51 -0
- package/src/content/page-templates.ts +52 -0
- package/src/content/redirects.ts +112 -0
- package/src/content/references.ts +165 -0
- package/src/content/rich-text.ts +63 -0
- package/src/content/search.ts +167 -0
- package/src/content/seed.ts +229 -0
- package/src/content/site-settings.ts +111 -0
- package/src/content/sitemap.ts +143 -0
- package/src/content/store.ts +225 -0
- package/src/content/tags.ts +67 -0
- package/src/content/text-default.ts +139 -0
- package/src/content/types.ts +137 -0
- package/src/content/validate.ts +253 -0
- package/src/content/validation-error.ts +2 -0
- package/src/db/cached.ts +140 -0
- package/src/db/database.ts +15 -0
- package/src/db/libsql.ts +29 -0
- package/src/db/schema.ts +189 -0
- package/src/db/url.ts +44 -0
- package/src/editor/client/BlockSettings.tsx +1063 -0
- package/src/editor/client/Chrome.tsx +284 -0
- package/src/editor/client/ContentBrowser.tsx +1299 -0
- package/src/editor/client/Editor.tsx +1756 -0
- package/src/editor/client/HistoryPanel.tsx +114 -0
- package/src/editor/client/ImagesWidget.tsx +113 -0
- package/src/editor/client/Inspector.tsx +127 -0
- package/src/editor/client/ItemForm.tsx +535 -0
- package/src/editor/client/LinkWidget.tsx +440 -0
- package/src/editor/client/ListingPanel.tsx +99 -0
- package/src/editor/client/Login.tsx +338 -0
- package/src/editor/client/Menu.tsx +64 -0
- package/src/editor/client/PageSettings.tsx +270 -0
- package/src/editor/client/RedirectsSettings.tsx +130 -0
- package/src/editor/client/Resize.tsx +204 -0
- package/src/editor/client/Sidebar.tsx +51 -0
- package/src/editor/client/SiteMap.tsx +568 -0
- package/src/editor/client/SiteSettings.tsx +409 -0
- package/src/editor/client/TextTools.tsx +391 -0
- package/src/editor/client/Toolbar.tsx +449 -0
- package/src/editor/client/VideoUpload.tsx +251 -0
- package/src/editor/client/api.ts +417 -0
- package/src/editor/client/brand.ts +20 -0
- package/src/editor/client/connection.ts +98 -0
- package/src/editor/client/context.ts +19 -0
- package/src/editor/client/css.d.ts +2 -0
- package/src/editor/client/editor.css +4656 -0
- package/src/editor/client/fields.tsx +812 -0
- package/src/editor/client/icons.tsx +174 -0
- package/src/editor/client/keys.ts +15 -0
- package/src/editor/client/kinds.ts +289 -0
- package/src/editor/client/languages.ts +32 -0
- package/src/editor/client/main.tsx +100 -0
- package/src/editor/client/responses.ts +26 -0
- package/src/editor/client/rich-text.ts +326 -0
- package/src/editor/client/site-tree.ts +239 -0
- package/src/editor/client/theme.ts +55 -0
- package/src/editor/client/tsconfig.json +18 -0
- package/src/editor/client/tus.ts +137 -0
- package/src/editor/client/use-rect.ts +50 -0
- package/src/editor/client/widgets.tsx +1218 -0
- package/src/forms/captcha.ts +83 -0
- package/src/forms/define.ts +166 -0
- package/src/forms/fields.ts +197 -0
- package/src/forms/file-types.ts +108 -0
- package/src/forms/files.ts +216 -0
- package/src/forms/form-page.ts +9 -0
- package/src/forms/handler.ts +622 -0
- package/src/forms/spec.ts +89 -0
- package/src/forms/store.ts +96 -0
- package/src/forms/work.ts +50 -0
- package/src/icons/library.ts +144 -0
- package/src/icons/load.ts +63 -0
- package/src/index.ts +99 -0
- package/src/init.ts +257 -0
- package/src/integration.ts +469 -0
- package/src/mail/mailer.ts +197 -0
- package/src/mail/notify.ts +272 -0
- package/src/mail/settings.ts +173 -0
- package/src/mail/templates.ts +191 -0
- package/src/mcp/page-nodes.ts +209 -0
- package/src/mcp/server.ts +111 -0
- package/src/mcp/tools.ts +637 -0
- package/src/runtime/TemplatePage.astro +39 -0
- package/src/runtime/TemplatePageStatic.astro +13 -0
- package/src/runtime/admin-route.ts +80 -0
- package/src/runtime/connect.ts +53 -0
- package/src/runtime/content.ts +188 -0
- package/src/runtime/context.ts +131 -0
- package/src/runtime/form-files.ts +18 -0
- package/src/runtime/forms-route.ts +33 -0
- package/src/runtime/forms.ts +28 -0
- package/src/runtime/icons.ts +5 -0
- package/src/runtime/media.ts +175 -0
- package/src/runtime/middleware.ts +186 -0
- package/src/runtime/nav.ts +13 -0
- package/src/runtime/query-reads.ts +49 -0
- package/src/runtime/query-store.ts +16 -0
- package/src/runtime/request-state.ts +69 -0
- package/src/runtime/robots.ts +29 -0
- package/src/runtime/rss-static.ts +16 -0
- package/src/runtime/rss.ts +29 -0
- package/src/runtime/server.ts +29 -0
- package/src/runtime/sitemap.ts +34 -0
- package/src/runtime/template-paths.ts +34 -0
- package/src/runtime/uploads-route.ts +13 -0
- package/src/seed-cli.ts +253 -0
- package/src/server/auth.ts +31 -0
- package/src/server/fetch-image.ts +219 -0
- package/src/server/handler.ts +2106 -0
- package/src/server/http.ts +162 -0
- package/src/server/locales.ts +73 -0
- package/src/server/node.ts +57 -0
- package/src/server/query-params.ts +249 -0
- package/src/server/rate-limit.ts +72 -0
- package/src/server/video-host.ts +162 -0
- package/src/starter.ts +70 -0
- package/src/version.ts +4 -0
- package/src/virtual.d.ts +65 -0
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
// Settings of the "carousel" block: its slides and how they move. Slide shapes, arrow styles and positions,
|
|
2
|
+
// caption styles and transition timing are the site's own CSS and markup.
|
|
3
|
+
import type { BlockDefinition, SchemaProperty } from "../types.ts";
|
|
4
|
+
|
|
5
|
+
/** The list of images the side panel edits, for a gallery and a carousel alike. */
|
|
6
|
+
export function imagesProperty(title: string): SchemaProperty {
|
|
7
|
+
return {
|
|
8
|
+
title,
|
|
9
|
+
type: "array",
|
|
10
|
+
widget: "carousel-images",
|
|
11
|
+
description: "Upload several at once, drag them into order, open one to describe it.",
|
|
12
|
+
items: {
|
|
13
|
+
type: "object",
|
|
14
|
+
properties: {
|
|
15
|
+
id: { type: "string" },
|
|
16
|
+
url: { type: "string" },
|
|
17
|
+
alt: { type: "string" },
|
|
18
|
+
caption: { type: "string" },
|
|
19
|
+
link: { type: "string" },
|
|
20
|
+
width: { type: "number", exclusiveMinimum: 0 },
|
|
21
|
+
height: { type: "number", exclusiveMinimum: 0 },
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export const carousel: BlockDefinition = {
|
|
28
|
+
type: "carousel",
|
|
29
|
+
label: "Carousel",
|
|
30
|
+
description: "Slides the visitor swipes through, or a strip of logos that rolls by itself",
|
|
31
|
+
schema: {
|
|
32
|
+
fieldsets: [
|
|
33
|
+
{ id: "carousel_content", title: "Content", fields: ["images"] },
|
|
34
|
+
{ id: "carousel_layout", title: "Layout", fields: ["variant", "slidesPerView", "gap", "showArrows", "showDots"] },
|
|
35
|
+
{
|
|
36
|
+
id: "carousel_behavior",
|
|
37
|
+
title: "Behavior",
|
|
38
|
+
fields: ["start", "autoplay", "autoplaySpeed", "pauseOnHover", "loop", "continuousSpeed"],
|
|
39
|
+
},
|
|
40
|
+
],
|
|
41
|
+
properties: {
|
|
42
|
+
images: imagesProperty("Slides"),
|
|
43
|
+
variant: {
|
|
44
|
+
title: "Variation",
|
|
45
|
+
type: "string",
|
|
46
|
+
widget: "select",
|
|
47
|
+
default: "slider",
|
|
48
|
+
options: [
|
|
49
|
+
{ value: "slider", label: "Slider" },
|
|
50
|
+
{ value: "center-peek", label: "Peek: the neighbours show on each side" },
|
|
51
|
+
{ value: "continuous", label: "Rolling strip (logos)" },
|
|
52
|
+
],
|
|
53
|
+
},
|
|
54
|
+
slidesPerView: {
|
|
55
|
+
title: "Slides per view",
|
|
56
|
+
type: "number",
|
|
57
|
+
widget: "range",
|
|
58
|
+
min: 1,
|
|
59
|
+
max: 6,
|
|
60
|
+
step: 1,
|
|
61
|
+
default: 1,
|
|
62
|
+
description: "On a phone, one.",
|
|
63
|
+
showWhen: { variant: "slider" },
|
|
64
|
+
},
|
|
65
|
+
gap: {
|
|
66
|
+
title: "Gap",
|
|
67
|
+
type: "number",
|
|
68
|
+
widget: "range",
|
|
69
|
+
min: 0,
|
|
70
|
+
max: 96,
|
|
71
|
+
step: 2,
|
|
72
|
+
default: 0,
|
|
73
|
+
},
|
|
74
|
+
showArrows: { title: "Arrows", type: "boolean", widget: "checkbox", default: true },
|
|
75
|
+
showDots: { title: "Dots", type: "boolean", widget: "checkbox", default: false },
|
|
76
|
+
start: {
|
|
77
|
+
title: "Opens on slide",
|
|
78
|
+
type: "number",
|
|
79
|
+
widget: "range",
|
|
80
|
+
min: 1,
|
|
81
|
+
max: 20,
|
|
82
|
+
step: 1,
|
|
83
|
+
default: 1,
|
|
84
|
+
},
|
|
85
|
+
autoplay: { title: "Autoplay", type: "boolean", widget: "checkbox", default: false },
|
|
86
|
+
autoplaySpeed: {
|
|
87
|
+
title: "Time per slide (ms)",
|
|
88
|
+
type: "number",
|
|
89
|
+
widget: "range",
|
|
90
|
+
min: 1000,
|
|
91
|
+
max: 15000,
|
|
92
|
+
step: 500,
|
|
93
|
+
default: 4000,
|
|
94
|
+
showWhen: { autoplay: true },
|
|
95
|
+
},
|
|
96
|
+
pauseOnHover: {
|
|
97
|
+
title: "Pause under the pointer",
|
|
98
|
+
type: "boolean",
|
|
99
|
+
widget: "checkbox",
|
|
100
|
+
default: true,
|
|
101
|
+
showWhen: { autoplay: true },
|
|
102
|
+
},
|
|
103
|
+
loop: { title: "Loop", type: "boolean", widget: "checkbox", default: true },
|
|
104
|
+
continuousSpeed: {
|
|
105
|
+
title: "Rolling time (s)",
|
|
106
|
+
type: "number",
|
|
107
|
+
widget: "range",
|
|
108
|
+
min: 5,
|
|
109
|
+
max: 120,
|
|
110
|
+
step: 1,
|
|
111
|
+
default: 24,
|
|
112
|
+
description: "How long the strip takes to roll once round.",
|
|
113
|
+
showWhen: { variant: "continuous" },
|
|
114
|
+
},
|
|
115
|
+
},
|
|
116
|
+
},
|
|
117
|
+
defaults: {
|
|
118
|
+
"@type": "carousel",
|
|
119
|
+
presetId: "default-theme",
|
|
120
|
+
images: [],
|
|
121
|
+
variant: "slider",
|
|
122
|
+
slidesPerView: 1,
|
|
123
|
+
gap: 0,
|
|
124
|
+
showArrows: true,
|
|
125
|
+
showDots: false,
|
|
126
|
+
start: 1,
|
|
127
|
+
autoplay: false,
|
|
128
|
+
autoplaySpeed: 4000,
|
|
129
|
+
pauseOnHover: true,
|
|
130
|
+
loop: true,
|
|
131
|
+
continuousSpeed: 24,
|
|
132
|
+
},
|
|
133
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
// Settings of the "divider" block: which way it runs. Its line (style, thickness, colour) is the site's CSS on
|
|
2
|
+
// `.brim-divider`; in a \`blocks\` field, its width is the block's.
|
|
3
|
+
import type { BlockDefinition } from "../types.ts";
|
|
4
|
+
|
|
5
|
+
export const divider: BlockDefinition = {
|
|
6
|
+
type: "divider",
|
|
7
|
+
label: "Divider",
|
|
8
|
+
description: "A line between two parts of a page",
|
|
9
|
+
schema: {
|
|
10
|
+
fieldsets: [{ id: "default", title: "Divider Settings", fields: ["orientation"] }],
|
|
11
|
+
properties: {
|
|
12
|
+
orientation: {
|
|
13
|
+
title: "Orientation",
|
|
14
|
+
type: "string",
|
|
15
|
+
widget: "select",
|
|
16
|
+
options: [
|
|
17
|
+
{ value: "horizontal", label: "Horizontal" },
|
|
18
|
+
{ value: "vertical", label: "Vertical" },
|
|
19
|
+
],
|
|
20
|
+
default: "horizontal",
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
defaults: {
|
|
25
|
+
"@type": "divider",
|
|
26
|
+
presetId: "default-theme",
|
|
27
|
+
orientation: "horizontal",
|
|
28
|
+
},
|
|
29
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/** Kinds of field a form can contain, carried over unchanged from BrimCMS. */
|
|
2
|
+
export const FORM_FIELD_TYPES = [
|
|
3
|
+
"text",
|
|
4
|
+
"email",
|
|
5
|
+
"tel",
|
|
6
|
+
"textarea",
|
|
7
|
+
"checkbox",
|
|
8
|
+
"radio",
|
|
9
|
+
"checkboxes",
|
|
10
|
+
"select",
|
|
11
|
+
"number",
|
|
12
|
+
"date",
|
|
13
|
+
"date-range",
|
|
14
|
+
"time",
|
|
15
|
+
"range",
|
|
16
|
+
"url",
|
|
17
|
+
"file",
|
|
18
|
+
"hidden",
|
|
19
|
+
"address",
|
|
20
|
+
"name",
|
|
21
|
+
"divider",
|
|
22
|
+
"currency",
|
|
23
|
+
"survey",
|
|
24
|
+
"display",
|
|
25
|
+
// Not a question: starts a step of a form asked in steps.
|
|
26
|
+
"step",
|
|
27
|
+
] as const;
|
|
28
|
+
|
|
29
|
+
export type FormFieldType = (typeof FORM_FIELD_TYPES)[number];
|
|
@@ -0,0 +1,350 @@
|
|
|
1
|
+
// Settings of the "form" block: its fields, texts, consent and where its messages go. How it looks (colours,
|
|
2
|
+
// input styles, spacing, the button's place) is the site's CSS, on the form's stable classes.
|
|
3
|
+
import type { BlockDefinition } from "../types.ts";
|
|
4
|
+
import { FORM_FIELD_TYPES } from "./form-field-types.ts";
|
|
5
|
+
|
|
6
|
+
export const form: BlockDefinition = {
|
|
7
|
+
type: "form",
|
|
8
|
+
label: "Form",
|
|
9
|
+
description: "A form whose messages the owner reads in the editor",
|
|
10
|
+
schema: {
|
|
11
|
+
fieldsets: [
|
|
12
|
+
{ id: "form_settings", title: "Settings", fields: ["formName", "infoText"] },
|
|
13
|
+
{ id: "form_fields", title: "Fields", fields: ["fields"] },
|
|
14
|
+
{ id: "form_button", title: "Button", fields: ["buttonText", "nextText", "backText"] },
|
|
15
|
+
{
|
|
16
|
+
id: "form_consent",
|
|
17
|
+
title: "Consent",
|
|
18
|
+
fields: ["showConsent", "consentText", "consentLinkText", "consentLinkUrl", "consentRequired"],
|
|
19
|
+
},
|
|
20
|
+
{ id: "form_after", title: "After Submission", fields: ["successMessage"] },
|
|
21
|
+
{
|
|
22
|
+
id: "form_confirmation",
|
|
23
|
+
title: "Confirmation Email",
|
|
24
|
+
fields: [
|
|
25
|
+
"confirmationEmail",
|
|
26
|
+
"confirmationField",
|
|
27
|
+
"confirmationSubject",
|
|
28
|
+
"confirmationMessage",
|
|
29
|
+
"confirmationAnswers",
|
|
30
|
+
],
|
|
31
|
+
},
|
|
32
|
+
],
|
|
33
|
+
properties: {
|
|
34
|
+
fields: {
|
|
35
|
+
title: "Form Fields",
|
|
36
|
+
type: "array",
|
|
37
|
+
widget: "form-fields",
|
|
38
|
+
description:
|
|
39
|
+
'Ordered form fields. An entry of type "step" starts a step: its label is the step\'s title, its help the line under it, and the fields after it are asked together.',
|
|
40
|
+
items: {
|
|
41
|
+
type: "object",
|
|
42
|
+
required: ["id", "type", "name", "label"],
|
|
43
|
+
properties: {
|
|
44
|
+
id: {
|
|
45
|
+
type: "string",
|
|
46
|
+
description: "Stable unique field identifier used by layoutRows.",
|
|
47
|
+
},
|
|
48
|
+
type: {
|
|
49
|
+
type: "string",
|
|
50
|
+
enum: FORM_FIELD_TYPES,
|
|
51
|
+
description: "Use date for a date picker, time for a time picker, and range for a numeric slider.",
|
|
52
|
+
},
|
|
53
|
+
name: {
|
|
54
|
+
type: "string",
|
|
55
|
+
description: "Unique submission payload key.",
|
|
56
|
+
},
|
|
57
|
+
label: { type: "string" },
|
|
58
|
+
placeholder: { type: "string" },
|
|
59
|
+
help: { type: "string", description: "A line under the question; for a step, the line under its title." },
|
|
60
|
+
display: {
|
|
61
|
+
type: "string",
|
|
62
|
+
enum: ["list", "cards"],
|
|
63
|
+
description:
|
|
64
|
+
"For a radio or checkboxes field: cards shows the choices as boxes to click, with their image or icon.",
|
|
65
|
+
},
|
|
66
|
+
showWhen: {
|
|
67
|
+
type: "object",
|
|
68
|
+
description:
|
|
69
|
+
'Ask this field only when another field has one of these answers: { field: "city", equals: ["Other"] }.',
|
|
70
|
+
properties: {
|
|
71
|
+
field: { type: "string" },
|
|
72
|
+
equals: { type: ["string", "array"], items: { type: "string" } },
|
|
73
|
+
},
|
|
74
|
+
},
|
|
75
|
+
width: {
|
|
76
|
+
type: "string",
|
|
77
|
+
enum: ["full", "half"],
|
|
78
|
+
description: "half puts the field next to another half on a wide screen.",
|
|
79
|
+
},
|
|
80
|
+
placeholders: {
|
|
81
|
+
type: "object",
|
|
82
|
+
description: "Per-control placeholder text for compound name and address fields.",
|
|
83
|
+
properties: {
|
|
84
|
+
fullName: { type: "string" },
|
|
85
|
+
firstName: { type: "string" },
|
|
86
|
+
middleName: { type: "string" },
|
|
87
|
+
lastName: { type: "string" },
|
|
88
|
+
country: { type: "string" },
|
|
89
|
+
state: { type: "string" },
|
|
90
|
+
city: { type: "string" },
|
|
91
|
+
postalCode: { type: "string" },
|
|
92
|
+
streetAddress: { type: "string" },
|
|
93
|
+
streetNumber: { type: "string" },
|
|
94
|
+
},
|
|
95
|
+
},
|
|
96
|
+
required: { type: "boolean" },
|
|
97
|
+
rows: { type: "number", minimum: 2 },
|
|
98
|
+
options: {
|
|
99
|
+
type: "array",
|
|
100
|
+
items: {
|
|
101
|
+
type: "object",
|
|
102
|
+
required: ["label"],
|
|
103
|
+
properties: {
|
|
104
|
+
value: { type: "string" },
|
|
105
|
+
label: { type: "string" },
|
|
106
|
+
icon: {
|
|
107
|
+
type: "string",
|
|
108
|
+
description:
|
|
109
|
+
"On a card choice: a picture's address (an SVG of the site, an upload) or a short text such as an emoji.",
|
|
110
|
+
},
|
|
111
|
+
description: { type: "string", description: "On a card choice: a line under its words." },
|
|
112
|
+
image: {
|
|
113
|
+
type: "string",
|
|
114
|
+
description: "On a card choice: a photo filling the card's top (an upload's address).",
|
|
115
|
+
},
|
|
116
|
+
width: { type: "number" },
|
|
117
|
+
imageScales: {
|
|
118
|
+
type: "array",
|
|
119
|
+
items: {
|
|
120
|
+
type: "object",
|
|
121
|
+
properties: {
|
|
122
|
+
url: { type: "string" },
|
|
123
|
+
width: { type: "number" },
|
|
124
|
+
height: { type: "number" },
|
|
125
|
+
},
|
|
126
|
+
},
|
|
127
|
+
},
|
|
128
|
+
},
|
|
129
|
+
},
|
|
130
|
+
},
|
|
131
|
+
nameFormat: {
|
|
132
|
+
type: "string",
|
|
133
|
+
enum: ["full", "first_last", "first_middle_last"],
|
|
134
|
+
},
|
|
135
|
+
accept: {
|
|
136
|
+
type: ["string", "array"],
|
|
137
|
+
description:
|
|
138
|
+
'File fields: the kinds taken, out of pdf, jpg, png, webp, gif (e.g. "pdf, jpg"). Without it: pdf, jpg, png, webp. Files are recognised by content; nothing else can be allowed.',
|
|
139
|
+
},
|
|
140
|
+
multiple: { type: "boolean", description: "File fields: up to five files instead of one." },
|
|
141
|
+
min: {
|
|
142
|
+
type: ["number", "string"],
|
|
143
|
+
description: "Number for range/number/currency; YYYY-MM-DD for date; HH:mm for time.",
|
|
144
|
+
},
|
|
145
|
+
max: {
|
|
146
|
+
type: ["number", "string"],
|
|
147
|
+
description: "Number for range/number/currency; YYYY-MM-DD for date; HH:mm for time.",
|
|
148
|
+
},
|
|
149
|
+
step: {
|
|
150
|
+
type: "number",
|
|
151
|
+
description: "Numeric increment. For time fields this value is measured in seconds.",
|
|
152
|
+
},
|
|
153
|
+
defaultValue: {
|
|
154
|
+
type: ["number", "string"],
|
|
155
|
+
description: "Initial value matching the field type and its min/max constraints.",
|
|
156
|
+
},
|
|
157
|
+
currencySymbol: { type: "string" },
|
|
158
|
+
addressFields: {
|
|
159
|
+
type: "array",
|
|
160
|
+
items: {
|
|
161
|
+
type: "string",
|
|
162
|
+
enum: ["street", "city", "state", "zip", "country"],
|
|
163
|
+
},
|
|
164
|
+
},
|
|
165
|
+
defaultCountry: { type: "string" },
|
|
166
|
+
restrictCountry: { type: "boolean" },
|
|
167
|
+
showStreetNumber: { type: "boolean" },
|
|
168
|
+
displayContent: {},
|
|
169
|
+
},
|
|
170
|
+
},
|
|
171
|
+
},
|
|
172
|
+
formName: {
|
|
173
|
+
title: "Form Name",
|
|
174
|
+
type: "string",
|
|
175
|
+
widget: "text",
|
|
176
|
+
placeholder: "Contact Form",
|
|
177
|
+
default: "",
|
|
178
|
+
description: "Name to identify this form in submissions",
|
|
179
|
+
},
|
|
180
|
+
infoText: {
|
|
181
|
+
title: "Description",
|
|
182
|
+
type: "string",
|
|
183
|
+
widget: "form-richtext",
|
|
184
|
+
default: "",
|
|
185
|
+
description: "Optional text displayed above the form fields",
|
|
186
|
+
},
|
|
187
|
+
buttonText: {
|
|
188
|
+
title: "Button Text",
|
|
189
|
+
type: "string",
|
|
190
|
+
widget: "text",
|
|
191
|
+
default: "Send message",
|
|
192
|
+
},
|
|
193
|
+
nextText: {
|
|
194
|
+
title: "Continue Button",
|
|
195
|
+
type: "string",
|
|
196
|
+
widget: "text",
|
|
197
|
+
default: "Continue",
|
|
198
|
+
description: "In a form asked in steps: the button to the next step",
|
|
199
|
+
},
|
|
200
|
+
backText: {
|
|
201
|
+
title: "Back Button",
|
|
202
|
+
type: "string",
|
|
203
|
+
widget: "text",
|
|
204
|
+
default: "Back",
|
|
205
|
+
description: "In a form asked in steps: the button to the step before",
|
|
206
|
+
},
|
|
207
|
+
showConsent: {
|
|
208
|
+
title: "Show Consent",
|
|
209
|
+
type: "boolean",
|
|
210
|
+
widget: "checkbox",
|
|
211
|
+
default: true,
|
|
212
|
+
},
|
|
213
|
+
consentText: {
|
|
214
|
+
title: "Text Before Link",
|
|
215
|
+
type: "string",
|
|
216
|
+
widget: "text",
|
|
217
|
+
default: "I agree to the",
|
|
218
|
+
showWhen: { showConsent: true },
|
|
219
|
+
description: "Text that appears before the link",
|
|
220
|
+
},
|
|
221
|
+
consentLinkText: {
|
|
222
|
+
title: "Link Text",
|
|
223
|
+
type: "string",
|
|
224
|
+
widget: "text",
|
|
225
|
+
default: "privacy policy",
|
|
226
|
+
showWhen: { showConsent: true },
|
|
227
|
+
description: "The clickable link text",
|
|
228
|
+
},
|
|
229
|
+
consentLinkUrl: {
|
|
230
|
+
title: "Link URL",
|
|
231
|
+
type: "string",
|
|
232
|
+
widget: "url",
|
|
233
|
+
default: "/privacy",
|
|
234
|
+
showWhen: { showConsent: true },
|
|
235
|
+
description: "URL for the consent link (e.g., /privacy)",
|
|
236
|
+
},
|
|
237
|
+
consentRequired: {
|
|
238
|
+
title: "Consent Required",
|
|
239
|
+
type: "boolean",
|
|
240
|
+
widget: "checkbox",
|
|
241
|
+
default: false,
|
|
242
|
+
showWhen: { showConsent: true },
|
|
243
|
+
},
|
|
244
|
+
successMessage: {
|
|
245
|
+
title: "Success Message",
|
|
246
|
+
type: "string",
|
|
247
|
+
widget: "form-richtext",
|
|
248
|
+
default: "<p>Thank you! We will get back to you shortly.</p>",
|
|
249
|
+
description: "Message shown after successful submission",
|
|
250
|
+
},
|
|
251
|
+
confirmationEmail: {
|
|
252
|
+
title: "Email the visitor a confirmation",
|
|
253
|
+
type: "boolean",
|
|
254
|
+
widget: "checkbox",
|
|
255
|
+
default: false,
|
|
256
|
+
description:
|
|
257
|
+
"After a message is received, the visitor gets one email at the address they wrote. The site must be able to send email (Site Settings).",
|
|
258
|
+
},
|
|
259
|
+
confirmationField: {
|
|
260
|
+
title: "Send it to",
|
|
261
|
+
type: "string",
|
|
262
|
+
widget: "form-email-field",
|
|
263
|
+
default: "",
|
|
264
|
+
showWhen: { confirmationEmail: true },
|
|
265
|
+
description: "The email field of this form that holds the visitor's address.",
|
|
266
|
+
},
|
|
267
|
+
confirmationSubject: {
|
|
268
|
+
title: "Subject",
|
|
269
|
+
type: "string",
|
|
270
|
+
widget: "text",
|
|
271
|
+
default: "We received your message",
|
|
272
|
+
showWhen: { confirmationEmail: true },
|
|
273
|
+
},
|
|
274
|
+
confirmationMessage: {
|
|
275
|
+
title: "Message",
|
|
276
|
+
type: "string",
|
|
277
|
+
widget: "textarea",
|
|
278
|
+
default: "Thank you for writing to us. We received your message and will get back to you shortly.",
|
|
279
|
+
showWhen: { confirmationEmail: true },
|
|
280
|
+
description: "Plain text, 5,000 characters at most. How the email looks is the site's design.",
|
|
281
|
+
},
|
|
282
|
+
confirmationAnswers: {
|
|
283
|
+
title: "Include the visitor's answers",
|
|
284
|
+
type: "boolean",
|
|
285
|
+
widget: "checkbox",
|
|
286
|
+
default: false,
|
|
287
|
+
showWhen: { confirmationEmail: true },
|
|
288
|
+
description:
|
|
289
|
+
"Off is safer: anyone can type someone else's address, and with this on the site would email that person whatever was typed in the form (shortened).",
|
|
290
|
+
},
|
|
291
|
+
notificationEmail: {
|
|
292
|
+
title: "Notification Email",
|
|
293
|
+
type: "string",
|
|
294
|
+
widget: "text",
|
|
295
|
+
placeholder: "hello@example.com",
|
|
296
|
+
default: "",
|
|
297
|
+
description:
|
|
298
|
+
"Each message is emailed to the site's owners and to the addresses in Site Settings. Add more addresses for this form here, separated by commas.",
|
|
299
|
+
},
|
|
300
|
+
},
|
|
301
|
+
},
|
|
302
|
+
defaults: {
|
|
303
|
+
"@type": "form",
|
|
304
|
+
presetId: "default-theme",
|
|
305
|
+
formName: "",
|
|
306
|
+
buttonText: "Send message",
|
|
307
|
+
nextText: "Continue",
|
|
308
|
+
backText: "Back",
|
|
309
|
+
infoText: "",
|
|
310
|
+
fields: [
|
|
311
|
+
{
|
|
312
|
+
id: "name",
|
|
313
|
+
type: "name",
|
|
314
|
+
name: "name",
|
|
315
|
+
label: "Name",
|
|
316
|
+
nameFormat: "full",
|
|
317
|
+
required: true,
|
|
318
|
+
},
|
|
319
|
+
{
|
|
320
|
+
id: "email",
|
|
321
|
+
type: "email",
|
|
322
|
+
name: "email",
|
|
323
|
+
label: "Email",
|
|
324
|
+
placeholder: "jane@company.com",
|
|
325
|
+
required: true,
|
|
326
|
+
},
|
|
327
|
+
{
|
|
328
|
+
id: "message",
|
|
329
|
+
type: "textarea",
|
|
330
|
+
name: "message",
|
|
331
|
+
label: "Message",
|
|
332
|
+
placeholder: "Tell us about your goals...",
|
|
333
|
+
required: true,
|
|
334
|
+
rows: 5,
|
|
335
|
+
},
|
|
336
|
+
],
|
|
337
|
+
showConsent: true,
|
|
338
|
+
consentText: "I agree to the",
|
|
339
|
+
consentLinkText: "privacy policy",
|
|
340
|
+
consentLinkUrl: "/privacy",
|
|
341
|
+
consentRequired: false,
|
|
342
|
+
successMessage: "<p>Thank you! We will get back to you shortly.</p>",
|
|
343
|
+
notificationEmail: "",
|
|
344
|
+
confirmationEmail: false,
|
|
345
|
+
confirmationField: "",
|
|
346
|
+
confirmationSubject: "We received your message",
|
|
347
|
+
confirmationMessage: "Thank you for writing to us. We received your message and will get back to you shortly.",
|
|
348
|
+
confirmationAnswers: false,
|
|
349
|
+
},
|
|
350
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
// Settings of the "icon" block: which icon. Its size, colour and any shape behind it are the site's CSS.
|
|
2
|
+
import type { BlockDefinition } from "../types.ts";
|
|
3
|
+
|
|
4
|
+
export const icon: BlockDefinition = {
|
|
5
|
+
type: "icon",
|
|
6
|
+
label: "Icon",
|
|
7
|
+
description: "One icon from the site's set",
|
|
8
|
+
schema: {
|
|
9
|
+
fieldsets: [{ id: "default", title: "Icon Settings", fields: ["icon"] }],
|
|
10
|
+
properties: {
|
|
11
|
+
icon: {
|
|
12
|
+
title: "Icon",
|
|
13
|
+
type: "string",
|
|
14
|
+
widget: "icon-picker",
|
|
15
|
+
default: "star",
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
defaults: {
|
|
20
|
+
"@type": "icon",
|
|
21
|
+
presetId: "default-theme",
|
|
22
|
+
icon: "star",
|
|
23
|
+
},
|
|
24
|
+
};
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
// Settings of the "image-gallery" block: its images, and for the look Brim draws when the site draws none, how many
|
|
2
|
+
// columns and how far apart. Masonry, ratios, captions styles and the rest are the site's own CSS.
|
|
3
|
+
import type { BlockDefinition } from "../types.ts";
|
|
4
|
+
import { imagesProperty } from "./carousel.ts";
|
|
5
|
+
|
|
6
|
+
export const imageGallery: BlockDefinition = {
|
|
7
|
+
type: "image-gallery",
|
|
8
|
+
label: "Gallery",
|
|
9
|
+
description: "Images the owner adds and orders; the site lays them out",
|
|
10
|
+
schema: {
|
|
11
|
+
fieldsets: [
|
|
12
|
+
{ id: "content", title: "Content", fields: ["images", "lightbox"] },
|
|
13
|
+
{ id: "image_gallery_layout", title: "Layout", fields: ["columns", "gap"] },
|
|
14
|
+
],
|
|
15
|
+
properties: {
|
|
16
|
+
images: imagesProperty("Images"),
|
|
17
|
+
lightbox: {
|
|
18
|
+
title: "Open full screen",
|
|
19
|
+
type: "boolean",
|
|
20
|
+
widget: "checkbox",
|
|
21
|
+
default: true,
|
|
22
|
+
description: "A click on an image opens it over the whole screen, as a slideshow. Images with a link keep it.",
|
|
23
|
+
},
|
|
24
|
+
columns: {
|
|
25
|
+
title: "Columns",
|
|
26
|
+
type: "number",
|
|
27
|
+
widget: "range",
|
|
28
|
+
min: 1,
|
|
29
|
+
max: 6,
|
|
30
|
+
step: 1,
|
|
31
|
+
default: 3,
|
|
32
|
+
description: "On a phone, the images stack as they need to.",
|
|
33
|
+
},
|
|
34
|
+
gap: {
|
|
35
|
+
title: "Gap",
|
|
36
|
+
type: "number",
|
|
37
|
+
widget: "range",
|
|
38
|
+
min: 0,
|
|
39
|
+
max: 64,
|
|
40
|
+
step: 2,
|
|
41
|
+
default: 16,
|
|
42
|
+
description: "Space between the images (px)",
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
defaults: {
|
|
47
|
+
"@type": "image-gallery",
|
|
48
|
+
presetId: "default-theme",
|
|
49
|
+
images: [],
|
|
50
|
+
lightbox: true,
|
|
51
|
+
columns: 3,
|
|
52
|
+
gap: 16,
|
|
53
|
+
},
|
|
54
|
+
};
|