@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,348 @@
|
|
|
1
|
+
// Settings of the "social-media" block: share or profile, and which networks in what order with their profile
|
|
2
|
+
// links. The icons' colour, background and shape are the site's CSS, or its own markup.
|
|
3
|
+
import type { BlockDefinition } from "../types.ts";
|
|
4
|
+
import { DEFAULT_SOCIAL_NETWORK_ORDER } from "../data/social-networks.ts";
|
|
5
|
+
|
|
6
|
+
export const socialMedia: BlockDefinition = {
|
|
7
|
+
type: "social-media",
|
|
8
|
+
label: "Social Media",
|
|
9
|
+
description: "Share buttons or profile links with social icons",
|
|
10
|
+
schema: {
|
|
11
|
+
fieldsets: [
|
|
12
|
+
{ id: "social_behavior", title: "Behavior", fields: ["mode", "shareText", "openInNewTab"] },
|
|
13
|
+
{ id: "social_networks", title: "Networks", fields: ["networkOrder"] },
|
|
14
|
+
],
|
|
15
|
+
properties: {
|
|
16
|
+
mode: {
|
|
17
|
+
title: "Mode",
|
|
18
|
+
type: "string",
|
|
19
|
+
widget: "select",
|
|
20
|
+
options: [
|
|
21
|
+
{ value: "share", label: "Share" },
|
|
22
|
+
{ value: "profile", label: "Check Profile" },
|
|
23
|
+
],
|
|
24
|
+
default: "share",
|
|
25
|
+
},
|
|
26
|
+
shareText: {
|
|
27
|
+
title: "Share Text",
|
|
28
|
+
type: "string",
|
|
29
|
+
widget: "text",
|
|
30
|
+
placeholder: "Check this out",
|
|
31
|
+
default: "Check this out",
|
|
32
|
+
showWhen: { mode: "share" },
|
|
33
|
+
},
|
|
34
|
+
openInNewTab: {
|
|
35
|
+
title: "Open profile in new tab",
|
|
36
|
+
type: "boolean",
|
|
37
|
+
widget: "checkbox",
|
|
38
|
+
default: true,
|
|
39
|
+
showWhen: { mode: "profile" },
|
|
40
|
+
},
|
|
41
|
+
networkOrder: {
|
|
42
|
+
title: "Networks",
|
|
43
|
+
type: "array",
|
|
44
|
+
widget: "social-network-order",
|
|
45
|
+
default: DEFAULT_SOCIAL_NETWORK_ORDER,
|
|
46
|
+
description: "Drag to reorder. Toggle share networks or add profile links.",
|
|
47
|
+
},
|
|
48
|
+
facebookEnabled: {
|
|
49
|
+
title: "Facebook",
|
|
50
|
+
type: "boolean",
|
|
51
|
+
widget: "checkbox",
|
|
52
|
+
default: true,
|
|
53
|
+
},
|
|
54
|
+
xEnabled: {
|
|
55
|
+
title: "X (Twitter)",
|
|
56
|
+
type: "boolean",
|
|
57
|
+
widget: "checkbox",
|
|
58
|
+
default: true,
|
|
59
|
+
},
|
|
60
|
+
linkedinEnabled: {
|
|
61
|
+
title: "LinkedIn",
|
|
62
|
+
type: "boolean",
|
|
63
|
+
widget: "checkbox",
|
|
64
|
+
default: true,
|
|
65
|
+
},
|
|
66
|
+
whatsappEnabled: {
|
|
67
|
+
title: "WhatsApp",
|
|
68
|
+
type: "boolean",
|
|
69
|
+
widget: "checkbox",
|
|
70
|
+
default: true,
|
|
71
|
+
},
|
|
72
|
+
telegramEnabled: {
|
|
73
|
+
title: "Telegram",
|
|
74
|
+
type: "boolean",
|
|
75
|
+
widget: "checkbox",
|
|
76
|
+
default: true,
|
|
77
|
+
},
|
|
78
|
+
pinterestEnabled: {
|
|
79
|
+
title: "Pinterest",
|
|
80
|
+
type: "boolean",
|
|
81
|
+
widget: "checkbox",
|
|
82
|
+
default: true,
|
|
83
|
+
},
|
|
84
|
+
redditEnabled: {
|
|
85
|
+
title: "Reddit",
|
|
86
|
+
type: "boolean",
|
|
87
|
+
widget: "checkbox",
|
|
88
|
+
default: true,
|
|
89
|
+
},
|
|
90
|
+
instagramEnabled: {
|
|
91
|
+
title: "Instagram",
|
|
92
|
+
type: "boolean",
|
|
93
|
+
widget: "checkbox",
|
|
94
|
+
default: true,
|
|
95
|
+
},
|
|
96
|
+
youtubeEnabled: {
|
|
97
|
+
title: "YouTube",
|
|
98
|
+
type: "boolean",
|
|
99
|
+
widget: "checkbox",
|
|
100
|
+
default: true,
|
|
101
|
+
},
|
|
102
|
+
tiktokEnabled: {
|
|
103
|
+
title: "TikTok",
|
|
104
|
+
type: "boolean",
|
|
105
|
+
widget: "checkbox",
|
|
106
|
+
default: true,
|
|
107
|
+
},
|
|
108
|
+
githubEnabled: {
|
|
109
|
+
title: "GitHub",
|
|
110
|
+
type: "boolean",
|
|
111
|
+
widget: "checkbox",
|
|
112
|
+
default: true,
|
|
113
|
+
},
|
|
114
|
+
discordEnabled: {
|
|
115
|
+
title: "Discord",
|
|
116
|
+
type: "boolean",
|
|
117
|
+
widget: "checkbox",
|
|
118
|
+
default: true,
|
|
119
|
+
},
|
|
120
|
+
twitchEnabled: {
|
|
121
|
+
title: "Twitch",
|
|
122
|
+
type: "boolean",
|
|
123
|
+
widget: "checkbox",
|
|
124
|
+
default: true,
|
|
125
|
+
},
|
|
126
|
+
vimeoEnabled: {
|
|
127
|
+
title: "Vimeo",
|
|
128
|
+
type: "boolean",
|
|
129
|
+
widget: "checkbox",
|
|
130
|
+
default: true,
|
|
131
|
+
},
|
|
132
|
+
dribbbleEnabled: {
|
|
133
|
+
title: "Dribbble",
|
|
134
|
+
type: "boolean",
|
|
135
|
+
widget: "checkbox",
|
|
136
|
+
default: true,
|
|
137
|
+
},
|
|
138
|
+
emailEnabled: {
|
|
139
|
+
title: "Email",
|
|
140
|
+
type: "boolean",
|
|
141
|
+
widget: "checkbox",
|
|
142
|
+
default: true,
|
|
143
|
+
},
|
|
144
|
+
phoneEnabled: {
|
|
145
|
+
title: "Phone",
|
|
146
|
+
type: "boolean",
|
|
147
|
+
widget: "checkbox",
|
|
148
|
+
default: true,
|
|
149
|
+
},
|
|
150
|
+
facebookUrl: {
|
|
151
|
+
title: "Facebook URL",
|
|
152
|
+
type: "string",
|
|
153
|
+
widget: "text",
|
|
154
|
+
placeholder: "https://facebook.com/your-page",
|
|
155
|
+
description: "Paste the profile URL manually (no link search).",
|
|
156
|
+
showWhen: { mode: "profile" },
|
|
157
|
+
},
|
|
158
|
+
instagramUrl: {
|
|
159
|
+
title: "Instagram URL",
|
|
160
|
+
type: "string",
|
|
161
|
+
widget: "text",
|
|
162
|
+
placeholder: "https://instagram.com/your-profile",
|
|
163
|
+
description: "Paste the profile URL manually (no link search).",
|
|
164
|
+
showWhen: { mode: "profile" },
|
|
165
|
+
},
|
|
166
|
+
xUrl: {
|
|
167
|
+
title: "X (Twitter) URL",
|
|
168
|
+
type: "string",
|
|
169
|
+
widget: "text",
|
|
170
|
+
placeholder: "https://x.com/your-profile",
|
|
171
|
+
description: "Paste the profile URL manually (no link search).",
|
|
172
|
+
showWhen: { mode: "profile" },
|
|
173
|
+
},
|
|
174
|
+
linkedinUrl: {
|
|
175
|
+
title: "LinkedIn URL",
|
|
176
|
+
type: "string",
|
|
177
|
+
widget: "text",
|
|
178
|
+
placeholder: "https://linkedin.com/in/your-profile",
|
|
179
|
+
description: "Paste the profile URL manually (no link search).",
|
|
180
|
+
showWhen: { mode: "profile" },
|
|
181
|
+
},
|
|
182
|
+
youtubeUrl: {
|
|
183
|
+
title: "YouTube URL",
|
|
184
|
+
type: "string",
|
|
185
|
+
widget: "text",
|
|
186
|
+
placeholder: "https://youtube.com/@your-channel",
|
|
187
|
+
description: "Paste the profile URL manually (no link search).",
|
|
188
|
+
showWhen: { mode: "profile" },
|
|
189
|
+
},
|
|
190
|
+
tiktokUrl: {
|
|
191
|
+
title: "TikTok URL",
|
|
192
|
+
type: "string",
|
|
193
|
+
widget: "text",
|
|
194
|
+
placeholder: "https://tiktok.com/@your-profile",
|
|
195
|
+
description: "Paste the profile URL manually (no link search).",
|
|
196
|
+
showWhen: { mode: "profile" },
|
|
197
|
+
},
|
|
198
|
+
whatsappUrl: {
|
|
199
|
+
title: "WhatsApp URL",
|
|
200
|
+
type: "string",
|
|
201
|
+
widget: "text",
|
|
202
|
+
placeholder: "https://wa.me/40700000000",
|
|
203
|
+
description: "Paste the profile URL manually (no link search).",
|
|
204
|
+
showWhen: { mode: "profile" },
|
|
205
|
+
},
|
|
206
|
+
telegramUrl: {
|
|
207
|
+
title: "Telegram URL",
|
|
208
|
+
type: "string",
|
|
209
|
+
widget: "text",
|
|
210
|
+
placeholder: "https://t.me/your-profile",
|
|
211
|
+
description: "Paste the profile URL manually (no link search).",
|
|
212
|
+
showWhen: { mode: "profile" },
|
|
213
|
+
},
|
|
214
|
+
pinterestUrl: {
|
|
215
|
+
title: "Pinterest URL",
|
|
216
|
+
type: "string",
|
|
217
|
+
widget: "text",
|
|
218
|
+
placeholder: "https://pinterest.com/your-profile",
|
|
219
|
+
description: "Paste the profile URL manually (no link search).",
|
|
220
|
+
showWhen: { mode: "profile" },
|
|
221
|
+
},
|
|
222
|
+
redditUrl: {
|
|
223
|
+
title: "Reddit URL",
|
|
224
|
+
type: "string",
|
|
225
|
+
widget: "text",
|
|
226
|
+
placeholder: "https://reddit.com/user/your-profile",
|
|
227
|
+
description: "Paste the profile URL manually (no link search).",
|
|
228
|
+
showWhen: { mode: "profile" },
|
|
229
|
+
},
|
|
230
|
+
githubUrl: {
|
|
231
|
+
title: "GitHub URL",
|
|
232
|
+
type: "string",
|
|
233
|
+
widget: "text",
|
|
234
|
+
placeholder: "https://github.com/your-profile",
|
|
235
|
+
description: "Paste the profile URL manually (no link search).",
|
|
236
|
+
showWhen: { mode: "profile" },
|
|
237
|
+
},
|
|
238
|
+
discordUrl: {
|
|
239
|
+
title: "Discord URL",
|
|
240
|
+
type: "string",
|
|
241
|
+
widget: "text",
|
|
242
|
+
placeholder: "https://discord.gg/your-server",
|
|
243
|
+
description: "Paste the profile URL manually (no link search).",
|
|
244
|
+
showWhen: { mode: "profile" },
|
|
245
|
+
},
|
|
246
|
+
twitchUrl: {
|
|
247
|
+
title: "Twitch URL",
|
|
248
|
+
type: "string",
|
|
249
|
+
widget: "text",
|
|
250
|
+
placeholder: "https://twitch.tv/your-profile",
|
|
251
|
+
description: "Paste the profile URL manually (no link search).",
|
|
252
|
+
showWhen: { mode: "profile" },
|
|
253
|
+
},
|
|
254
|
+
vimeoUrl: {
|
|
255
|
+
title: "Vimeo URL",
|
|
256
|
+
type: "string",
|
|
257
|
+
widget: "text",
|
|
258
|
+
placeholder: "https://vimeo.com/your-profile",
|
|
259
|
+
description: "Paste the profile URL manually (no link search).",
|
|
260
|
+
showWhen: { mode: "profile" },
|
|
261
|
+
},
|
|
262
|
+
dribbbleUrl: {
|
|
263
|
+
title: "Dribbble URL",
|
|
264
|
+
type: "string",
|
|
265
|
+
widget: "text",
|
|
266
|
+
placeholder: "https://dribbble.com/your-profile",
|
|
267
|
+
description: "Paste the profile URL manually (no link search).",
|
|
268
|
+
showWhen: { mode: "profile" },
|
|
269
|
+
},
|
|
270
|
+
emailUrl: {
|
|
271
|
+
title: "Email link",
|
|
272
|
+
type: "string",
|
|
273
|
+
widget: "text",
|
|
274
|
+
placeholder: "mailto:hello@example.com",
|
|
275
|
+
description: "Paste a mailto link manually.",
|
|
276
|
+
showWhen: { mode: "profile" },
|
|
277
|
+
},
|
|
278
|
+
phoneUrl: {
|
|
279
|
+
title: "Phone link",
|
|
280
|
+
type: "string",
|
|
281
|
+
widget: "text",
|
|
282
|
+
placeholder: "tel:+15555550123",
|
|
283
|
+
description: "Paste a tel link manually.",
|
|
284
|
+
showWhen: { mode: "profile" },
|
|
285
|
+
},
|
|
286
|
+
},
|
|
287
|
+
},
|
|
288
|
+
defaults: {
|
|
289
|
+
"@type": "social-media",
|
|
290
|
+
mode: "share",
|
|
291
|
+
shareText: "Check this out",
|
|
292
|
+
openInNewTab: true,
|
|
293
|
+
networkOrder: [
|
|
294
|
+
"facebook",
|
|
295
|
+
"x",
|
|
296
|
+
"linkedin",
|
|
297
|
+
"whatsapp",
|
|
298
|
+
"telegram",
|
|
299
|
+
"pinterest",
|
|
300
|
+
"reddit",
|
|
301
|
+
"instagram",
|
|
302
|
+
"youtube",
|
|
303
|
+
"tiktok",
|
|
304
|
+
"github",
|
|
305
|
+
"discord",
|
|
306
|
+
"twitch",
|
|
307
|
+
"vimeo",
|
|
308
|
+
"dribbble",
|
|
309
|
+
"email",
|
|
310
|
+
"phone",
|
|
311
|
+
],
|
|
312
|
+
facebookEnabled: true,
|
|
313
|
+
xEnabled: true,
|
|
314
|
+
linkedinEnabled: true,
|
|
315
|
+
whatsappEnabled: true,
|
|
316
|
+
telegramEnabled: true,
|
|
317
|
+
pinterestEnabled: true,
|
|
318
|
+
redditEnabled: true,
|
|
319
|
+
instagramEnabled: true,
|
|
320
|
+
youtubeEnabled: true,
|
|
321
|
+
tiktokEnabled: true,
|
|
322
|
+
githubEnabled: true,
|
|
323
|
+
discordEnabled: true,
|
|
324
|
+
twitchEnabled: true,
|
|
325
|
+
vimeoEnabled: true,
|
|
326
|
+
dribbbleEnabled: true,
|
|
327
|
+
emailEnabled: true,
|
|
328
|
+
phoneEnabled: true,
|
|
329
|
+
facebookUrl: "",
|
|
330
|
+
instagramUrl: "",
|
|
331
|
+
xUrl: "",
|
|
332
|
+
linkedinUrl: "",
|
|
333
|
+
youtubeUrl: "",
|
|
334
|
+
tiktokUrl: "",
|
|
335
|
+
whatsappUrl: "",
|
|
336
|
+
telegramUrl: "",
|
|
337
|
+
pinterestUrl: "",
|
|
338
|
+
redditUrl: "",
|
|
339
|
+
githubUrl: "",
|
|
340
|
+
discordUrl: "",
|
|
341
|
+
twitchUrl: "",
|
|
342
|
+
vimeoUrl: "",
|
|
343
|
+
dribbbleUrl: "",
|
|
344
|
+
emailUrl: "",
|
|
345
|
+
phoneUrl: "",
|
|
346
|
+
presetId: "default-theme",
|
|
347
|
+
},
|
|
348
|
+
};
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
// Settings of the "text" block, carried over unchanged from BrimCMS.
|
|
2
|
+
import type { BlockDefinition } from "../types.ts";
|
|
3
|
+
|
|
4
|
+
export const text: BlockDefinition = {
|
|
5
|
+
type: "text",
|
|
6
|
+
label: "Text",
|
|
7
|
+
description: "Rich text editor with formatting",
|
|
8
|
+
schema: {
|
|
9
|
+
fieldsets: [
|
|
10
|
+
{
|
|
11
|
+
id: "text_layout",
|
|
12
|
+
title: "Layout",
|
|
13
|
+
fields: [
|
|
14
|
+
"scaleText",
|
|
15
|
+
"rotation",
|
|
16
|
+
"dropCap",
|
|
17
|
+
"dropCapColor",
|
|
18
|
+
"quotedText",
|
|
19
|
+
"quoteStyle",
|
|
20
|
+
"pullQuoteSize",
|
|
21
|
+
"pullQuoteAlign",
|
|
22
|
+
"quoteColor",
|
|
23
|
+
],
|
|
24
|
+
},
|
|
25
|
+
],
|
|
26
|
+
properties: {
|
|
27
|
+
scaleText: {
|
|
28
|
+
title: "Oversized Text",
|
|
29
|
+
type: "boolean",
|
|
30
|
+
widget: "checkbox",
|
|
31
|
+
default: false,
|
|
32
|
+
editContext: "grid",
|
|
33
|
+
description: "Best for big, bold titles and recommended for short sentences or a few words.",
|
|
34
|
+
},
|
|
35
|
+
rotation: {
|
|
36
|
+
title: "Rotation",
|
|
37
|
+
type: "number",
|
|
38
|
+
widget: "range",
|
|
39
|
+
min: -180,
|
|
40
|
+
max: 180,
|
|
41
|
+
step: 1,
|
|
42
|
+
default: 0,
|
|
43
|
+
editContext: "grid",
|
|
44
|
+
description: "Rotate text in degrees",
|
|
45
|
+
},
|
|
46
|
+
dropCap: {
|
|
47
|
+
title: "Drop Cap",
|
|
48
|
+
type: "boolean",
|
|
49
|
+
widget: "checkbox",
|
|
50
|
+
default: false,
|
|
51
|
+
description: "Style the first letter of the first paragraph.",
|
|
52
|
+
},
|
|
53
|
+
dropCapColor: {
|
|
54
|
+
title: "Drop Cap Color",
|
|
55
|
+
type: "string",
|
|
56
|
+
widget: "color-select",
|
|
57
|
+
options: [
|
|
58
|
+
{ value: "", label: "Default" },
|
|
59
|
+
{ value: "background", label: "Background" },
|
|
60
|
+
{ value: "light1", label: "Light 1" },
|
|
61
|
+
{ value: "light2", label: "Light 2" },
|
|
62
|
+
{ value: "accent", label: "Accent" },
|
|
63
|
+
{ value: "primary", label: "Primary" },
|
|
64
|
+
{ value: "dark1", label: "Dark 1" },
|
|
65
|
+
{ value: "dark2", label: "Dark 2" },
|
|
66
|
+
],
|
|
67
|
+
default: "",
|
|
68
|
+
showWhen: { dropCap: true },
|
|
69
|
+
allowCustomColor: true,
|
|
70
|
+
description: "Color for the drop cap letter.",
|
|
71
|
+
},
|
|
72
|
+
quotedText: {
|
|
73
|
+
title: "Quoted Text",
|
|
74
|
+
type: "boolean",
|
|
75
|
+
widget: "checkbox",
|
|
76
|
+
default: false,
|
|
77
|
+
description: "Enable quote styling for the whole text block.",
|
|
78
|
+
},
|
|
79
|
+
quoteStyle: {
|
|
80
|
+
title: "Quote Style",
|
|
81
|
+
type: "string",
|
|
82
|
+
widget: "select",
|
|
83
|
+
options: [
|
|
84
|
+
{ value: "classic", label: "Classic" },
|
|
85
|
+
{ value: "pull", label: "Pull Quote" },
|
|
86
|
+
],
|
|
87
|
+
default: "classic",
|
|
88
|
+
showWhen: { quotedText: true },
|
|
89
|
+
description: "Apply a quote layout to the whole text block.",
|
|
90
|
+
},
|
|
91
|
+
pullQuoteSize: {
|
|
92
|
+
title: "Pull Quote Size",
|
|
93
|
+
type: "string",
|
|
94
|
+
widget: "select",
|
|
95
|
+
options: [
|
|
96
|
+
{ value: "small", label: "Small" },
|
|
97
|
+
{ value: "medium", label: "Medium" },
|
|
98
|
+
{ value: "large", label: "Large" },
|
|
99
|
+
],
|
|
100
|
+
default: "medium",
|
|
101
|
+
showWhen: { quotedText: true, quoteStyle: "pull" },
|
|
102
|
+
description: "Size of the Pull Quote decorative treatment.",
|
|
103
|
+
},
|
|
104
|
+
pullQuoteAlign: {
|
|
105
|
+
title: "Quote Align",
|
|
106
|
+
type: "string",
|
|
107
|
+
widget: "alignment",
|
|
108
|
+
default: "left",
|
|
109
|
+
showWhen: { quotedText: true, quoteStyle: "pull" },
|
|
110
|
+
},
|
|
111
|
+
quoteColor: {
|
|
112
|
+
title: "Quote Color",
|
|
113
|
+
type: "string",
|
|
114
|
+
widget: "color-select",
|
|
115
|
+
options: [
|
|
116
|
+
{ value: "", label: "Default" },
|
|
117
|
+
{ value: "background", label: "Background" },
|
|
118
|
+
{ value: "light1", label: "Light 1" },
|
|
119
|
+
{ value: "light2", label: "Light 2" },
|
|
120
|
+
{ value: "accent", label: "Accent" },
|
|
121
|
+
{ value: "primary", label: "Primary" },
|
|
122
|
+
{ value: "dark1", label: "Dark 1" },
|
|
123
|
+
{ value: "dark2", label: "Dark 2" },
|
|
124
|
+
],
|
|
125
|
+
default: "primary",
|
|
126
|
+
showWhen: { quotedText: true },
|
|
127
|
+
allowCustomColor: true,
|
|
128
|
+
description: "Color for quote accents and decorative treatments.",
|
|
129
|
+
},
|
|
130
|
+
},
|
|
131
|
+
},
|
|
132
|
+
defaults: {
|
|
133
|
+
"@type": "text",
|
|
134
|
+
scaleText: false,
|
|
135
|
+
rotation: 0,
|
|
136
|
+
dropCap: false,
|
|
137
|
+
dropCapColor: "",
|
|
138
|
+
quotedText: false,
|
|
139
|
+
quoteStyle: "classic",
|
|
140
|
+
pullQuoteSize: "medium",
|
|
141
|
+
pullQuoteAlign: "left",
|
|
142
|
+
quoteColor: "primary",
|
|
143
|
+
presetId: "default-theme",
|
|
144
|
+
value: [
|
|
145
|
+
{
|
|
146
|
+
type: "p",
|
|
147
|
+
children: [{ text: "" }],
|
|
148
|
+
},
|
|
149
|
+
],
|
|
150
|
+
},
|
|
151
|
+
};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
// Settings of the "video" block: the video and how it plays. Its size, shape, tint and fades are the site's CSS.
|
|
2
|
+
import type { BlockDefinition } from "../types.ts";
|
|
3
|
+
|
|
4
|
+
export const video: BlockDefinition = {
|
|
5
|
+
type: "video",
|
|
6
|
+
label: "Video",
|
|
7
|
+
description: "A video from YouTube, Vimeo, a file or a stream; the site sizes it",
|
|
8
|
+
schema: {
|
|
9
|
+
fieldsets: [
|
|
10
|
+
{ id: "video_source", title: "Video", fields: ["url", "posterUrl"] },
|
|
11
|
+
{ id: "video_playback", title: "Playback", fields: ["autoplay", "loop", "muted", "controls"] },
|
|
12
|
+
],
|
|
13
|
+
properties: {
|
|
14
|
+
url: {
|
|
15
|
+
title: "Video",
|
|
16
|
+
type: "string",
|
|
17
|
+
widget: "video",
|
|
18
|
+
posterField: "posterUrl",
|
|
19
|
+
description: "Upload, select from gallery, or paste a video/YouTube URL",
|
|
20
|
+
},
|
|
21
|
+
posterUrl: {
|
|
22
|
+
title: "Video Poster",
|
|
23
|
+
type: "string",
|
|
24
|
+
widget: "image",
|
|
25
|
+
description: "Fallback image shown while video loads. Auto-filled from uploaded videos when empty.",
|
|
26
|
+
showWhen: { isYouTube: false },
|
|
27
|
+
},
|
|
28
|
+
isYouTube: {
|
|
29
|
+
title: "Is YouTube",
|
|
30
|
+
type: "boolean",
|
|
31
|
+
widget: "hidden",
|
|
32
|
+
default: false,
|
|
33
|
+
},
|
|
34
|
+
autoplay: {
|
|
35
|
+
title: "Autoplay",
|
|
36
|
+
type: "boolean",
|
|
37
|
+
widget: "checkbox",
|
|
38
|
+
default: false,
|
|
39
|
+
description: "Plays silently.",
|
|
40
|
+
},
|
|
41
|
+
loop: { title: "Loop", type: "boolean", widget: "checkbox", default: false },
|
|
42
|
+
muted: { title: "Muted", type: "boolean", widget: "checkbox", default: true },
|
|
43
|
+
controls: { title: "Controls", type: "boolean", widget: "checkbox", default: true },
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
defaults: {
|
|
47
|
+
"@type": "video",
|
|
48
|
+
presetId: "default-theme",
|
|
49
|
+
url: "",
|
|
50
|
+
posterUrl: "",
|
|
51
|
+
isYouTube: false,
|
|
52
|
+
autoplay: false,
|
|
53
|
+
loop: false,
|
|
54
|
+
muted: true,
|
|
55
|
+
controls: true,
|
|
56
|
+
},
|
|
57
|
+
};
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
---
|
|
2
|
+
import "./search.css";
|
|
3
|
+
import config from "virtual:brim/config";
|
|
4
|
+
import { type ContentItem, getItems } from "../../runtime/content.ts";
|
|
5
|
+
import { searchItems } from "../../content/search.ts";
|
|
6
|
+
import type { SearchResult, SearchState } from "./state.ts";
|
|
7
|
+
import { noteQueryReads } from "../../runtime/query-reads.ts";
|
|
8
|
+
|
|
9
|
+
const LABELS = {
|
|
10
|
+
search: "Search",
|
|
11
|
+
button: "Search",
|
|
12
|
+
placeholder: "",
|
|
13
|
+
results: "{count} results for “{query}”",
|
|
14
|
+
empty: "Nothing found for “{query}”.",
|
|
15
|
+
previous: "Previous",
|
|
16
|
+
next: "Next",
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* A search of the whole site: the items of several content types, found by any word of their title, their texts,
|
|
21
|
+
* their rich text and the blocks of their body, whatever its case and accents. The words are in the page's address
|
|
22
|
+
* (`?q=`), so a result page can be shared and a search box anywhere (the header) can send visitors to it with a plain
|
|
23
|
+
* `<form action="/search">`.
|
|
24
|
+
*
|
|
25
|
+
* <Search types={["article", "project"]} />
|
|
26
|
+
*
|
|
27
|
+
* Pass a function to draw the box and the results in the site's own markup, from the state (`SearchState`):
|
|
28
|
+
*
|
|
29
|
+
* <Search types={["article", "project"]}>
|
|
30
|
+
* {({ query, results }) => results.map((result) => <a href={result.url}>{result.title}</a>)}
|
|
31
|
+
* </Search>
|
|
32
|
+
*
|
|
33
|
+
* It needs a page drawn on request (the dev server, the Node server, Brimsites): a static copy has no address to
|
|
34
|
+
* read the words from, so it shows the box alone.
|
|
35
|
+
*/
|
|
36
|
+
interface Props {
|
|
37
|
+
/** Keys of the content types searched; by default every type whose items have pages, except vocabularies. */
|
|
38
|
+
types?: string[];
|
|
39
|
+
/** The address parameter of the words. */
|
|
40
|
+
param?: string;
|
|
41
|
+
/** How many results one page shows. */
|
|
42
|
+
pageSize?: number;
|
|
43
|
+
/** The words of the box and the results, in the site's language. `{count}` and `{query}` are filled in. */
|
|
44
|
+
labels?: Partial<typeof LABELS>;
|
|
45
|
+
class?: string;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const { types, param = "q", pageSize = 20, labels, class: className } = Astro.props;
|
|
49
|
+
const words = { ...LABELS, ...labels };
|
|
50
|
+
const searched = (
|
|
51
|
+
types
|
|
52
|
+
? types.map((key) => {
|
|
53
|
+
const type = config.contentTypes.find((candidate) => candidate.key === key);
|
|
54
|
+
if (!type) throw new Error(`<Search> searches "${key}", which is not a content type of the site.`);
|
|
55
|
+
return type;
|
|
56
|
+
})
|
|
57
|
+
: config.contentTypes.filter((type) => !type.vocabulary && (type.component || type.path))
|
|
58
|
+
).filter(Boolean);
|
|
59
|
+
|
|
60
|
+
const params = config.mode === "static" ? new URLSearchParams() : Astro.url.searchParams;
|
|
61
|
+
const query = (params.get(param) ?? "").trim().slice(0, 200);
|
|
62
|
+
const pageParam = `${param}page`;
|
|
63
|
+
// What the page reads of its address, for a host that caches pages by the parameters they read.
|
|
64
|
+
noteQueryReads([param, pageParam]);
|
|
65
|
+
const groups = query
|
|
66
|
+
? await Promise.all(searched.map(async (type) => ({ type, items: await getItems(type.key) })))
|
|
67
|
+
: [];
|
|
68
|
+
const hits = searchItems<ContentItem>(groups, query);
|
|
69
|
+
const size = pageSize > 0 ? Math.floor(pageSize) : hits.length || 1;
|
|
70
|
+
const pageCount = Math.max(1, Math.ceil(hits.length / size));
|
|
71
|
+
const asked = Number.parseInt(params.get(pageParam) ?? "1", 10);
|
|
72
|
+
const page = Math.min(pageCount, Math.max(1, Number.isFinite(asked) ? asked : 1));
|
|
73
|
+
const typeOf = new Map(searched.map((type) => [type.key, type]));
|
|
74
|
+
const results: SearchResult[] = hits.slice((page - 1) * size, page * size).map((hit) => ({
|
|
75
|
+
item: hit.item,
|
|
76
|
+
type: hit.type,
|
|
77
|
+
typeLabel: typeOf.get(hit.type)?.singular ?? hit.type,
|
|
78
|
+
title: hit.item.title,
|
|
79
|
+
url: hit.item.url,
|
|
80
|
+
excerpt: hit.excerpt,
|
|
81
|
+
}));
|
|
82
|
+
const pageHref = (target: number): string => {
|
|
83
|
+
const next = new URLSearchParams(params);
|
|
84
|
+
if (target > 1) next.set(pageParam, String(target));
|
|
85
|
+
else next.delete(pageParam);
|
|
86
|
+
return `?${next.toString()}`;
|
|
87
|
+
};
|
|
88
|
+
const state: SearchState = { query, param, results, total: hits.length, page, pageCount, pageHref };
|
|
89
|
+
const fill = (text: string) => text.replace("{count}", String(hits.length)).replace("{query}", query);
|
|
90
|
+
const drawn = Astro.slots.has("default");
|
|
91
|
+
const content = drawn ? await Astro.slots.render("default", [state]) : undefined;
|
|
92
|
+
---
|
|
93
|
+
|
|
94
|
+
<div class:list={["brim-search", className]}>
|
|
95
|
+
{drawn ? (
|
|
96
|
+
<Fragment set:html={content} />
|
|
97
|
+
) : (
|
|
98
|
+
<>
|
|
99
|
+
<form class="brim-search__box" role="search" method="get">
|
|
100
|
+
<label class="brim-search__label">
|
|
101
|
+
<span>{words.search}</span>
|
|
102
|
+
<input type="search" name={param} value={query} placeholder={words.placeholder || undefined} />
|
|
103
|
+
</label>
|
|
104
|
+
<button type="submit" class="brim-btn brim-btn--block brim-btn--md">
|
|
105
|
+
{words.button}
|
|
106
|
+
</button>
|
|
107
|
+
</form>
|
|
108
|
+
{query && (
|
|
109
|
+
<p class="brim-search__count" role="status">
|
|
110
|
+
{fill(hits.length > 0 ? words.results : words.empty)}
|
|
111
|
+
</p>
|
|
112
|
+
)}
|
|
113
|
+
{results.length > 0 && (
|
|
114
|
+
<ol class="brim-search__results">
|
|
115
|
+
{results.map((result) => (
|
|
116
|
+
<li class="brim-search__result" data-type={result.type}>
|
|
117
|
+
<span class="brim-search__type">{result.typeLabel}</span>
|
|
118
|
+
<a class="brim-search__title" href={result.url}>
|
|
119
|
+
{result.title}
|
|
120
|
+
</a>
|
|
121
|
+
{result.excerpt && <p class="brim-search__excerpt">{result.excerpt}</p>}
|
|
122
|
+
</li>
|
|
123
|
+
))}
|
|
124
|
+
</ol>
|
|
125
|
+
)}
|
|
126
|
+
{pageCount > 1 && (
|
|
127
|
+
<nav class="brim-search__pages">
|
|
128
|
+
{page > 1 && (
|
|
129
|
+
<a href={pageHref(page - 1)} rel="prev">
|
|
130
|
+
{words.previous}
|
|
131
|
+
</a>
|
|
132
|
+
)}
|
|
133
|
+
{Array.from({ length: pageCount }, (_, index) => index + 1).map((target) => (
|
|
134
|
+
<a href={pageHref(target)} aria-current={target === page ? "page" : undefined}>
|
|
135
|
+
{target}
|
|
136
|
+
</a>
|
|
137
|
+
))}
|
|
138
|
+
{page < pageCount && (
|
|
139
|
+
<a href={pageHref(page + 1)} rel="next">
|
|
140
|
+
{words.next}
|
|
141
|
+
</a>
|
|
142
|
+
)}
|
|
143
|
+
</nav>
|
|
144
|
+
)}
|
|
145
|
+
</>
|
|
146
|
+
)}
|
|
147
|
+
</div>
|