@vermeulen.solutions/eventual 0.0.0-stage → 0.18.2
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 +21 -0
- package/README.md +139 -2
- package/astro/EventList.astro +57 -0
- package/astro/admin.d.mts +3 -0
- package/astro/admin.mjs +158 -0
- package/astro/blueprint.d.mts +51 -0
- package/astro/blueprint.mjs +236 -0
- package/astro/cache.ts +82 -0
- package/astro/descriptor.mjs +7 -0
- package/astro/editor-compat.mjs +197 -0
- package/astro/editor-i18n.d.mts +8 -0
- package/astro/editor-i18n.mjs +157 -0
- package/astro/event-details.ts +29 -0
- package/astro/event-list.ts +56 -0
- package/astro/feed.ts +201 -0
- package/astro/install.d.mts +9 -0
- package/astro/install.mjs +66 -0
- package/astro/schema.ts +88 -0
- package/dist/index.d.mts +5 -0
- package/dist/index.mjs +1585 -0
- package/dist/plugin.d.mts +6 -0
- package/dist/plugin.mjs +13 -0
- package/docs/collection-setup.md +46 -0
- package/docs/history.md +16 -0
- package/docs/native-modernization.md +99 -0
- package/docs/public-feed-caching.md +259 -0
- package/docs/registry-installation.md +13 -0
- package/docs/release-notes-0.14.0.md +27 -0
- package/docs/release-notes-0.14.1.md +40 -0
- package/docs/release-notes-0.15.0.md +18 -0
- package/docs/release-notes-0.16.0.md +7 -0
- package/docs/release-notes-0.17.0.md +7 -0
- package/docs/release-notes-0.18.0.md +8 -0
- package/docs/release-notes-0.18.1.md +7 -0
- package/docs/release-notes-0.18.2.md +6 -0
- package/docs/upgrade-0.13.0.md +21 -0
- package/docs/user-guide.md +40 -0
- package/emdash-plugin.jsonc +77 -0
- package/package.json +143 -4
- package/scripts/check-editor-installation.mjs +32 -0
- package/scripts/export-native-schema.mjs +28 -0
- package/scripts/upgrade-native-editor.mjs +296 -0
- package/src/domain/calendar-links.ts +80 -0
- package/src/domain/category.ts +32 -0
- package/src/domain/collections.ts +101 -0
- package/src/domain/date-time.ts +220 -0
- package/src/domain/description.ts +108 -0
- package/src/domain/event-data.ts +217 -0
- package/src/domain/event-expansion.ts +305 -0
- package/src/domain/event.ts +195 -0
- package/src/domain/icalendar.ts +165 -0
- package/src/domain/image.ts +18 -0
- package/src/domain/invocation-budget.ts +56 -0
- package/src/domain/messages.ts +8 -0
- package/src/domain/migration.ts +666 -0
- package/src/domain/native-calendar.ts +256 -0
- package/src/domain/native-references.ts +41 -0
- package/src/domain/native-source.ts +261 -0
- package/src/domain/native-validation.ts +366 -0
- package/src/domain/occurrences.ts +54 -0
- package/src/domain/portable-text.ts +180 -0
- package/src/domain/public-cache.ts +24 -0
- package/src/domain/recurrence-rule.ts +34 -0
- package/src/domain/recurrence.ts +350 -0
- package/src/domain/request-memo.ts +8 -0
- package/src/domain/schedule-history.ts +14 -0
- package/src/domain/text.ts +2 -0
- package/src/domain/time-entry.ts +23 -0
- package/src/domain/venue-adapter.ts +101 -0
- package/src/domain/venue.ts +42 -0
- package/src/public-event.ts +88 -0
- package/src/schema/blueprint.ts +315 -0
- package/src/storage.ts +257 -0
- package/transfer/index.d.mts +13 -0
- package/transfer/index.mjs +155 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Jaap Vermeulen
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,140 @@
|
|
|
1
|
-
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img src="./images/registry/banner-v2.png" alt="Eventual RSVP – Core: events for EmDash CMS" width="100%" />
|
|
3
|
+
</p>
|
|
2
4
|
|
|
3
|
-
|
|
5
|
+
# Eventual RSVP – Core
|
|
6
|
+
|
|
7
|
+
<p align="center">
|
|
8
|
+
<a href="https://github.com/Vermeulen-Solutions/eventual-rsvp-core/actions/workflows/ci.yml"><img src="https://github.com/Vermeulen-Solutions/eventual-rsvp-core/actions/workflows/ci.yml/badge.svg" alt="CI Status" /></a>
|
|
9
|
+
<a href="https://github.com/Vermeulen-Solutions/eventual-rsvp-core/releases"><img src="https://img.shields.io/github/v/release/Vermeulen-Solutions/eventual-rsvp-core?color=176b57&label=GitHub%20download" alt="Latest GitHub source download" /></a>
|
|
10
|
+
<a href="https://plugins.emdashcms.com/plugins/@vermeulen.solutions/eventual"><img src="https://img.shields.io/badge/EmDash_Registry-0.18.2-0b4d3d" alt="EmDash Plugin Registry" /></a>
|
|
11
|
+
<a href="https://emdashcms.com"><img src="https://img.shields.io/badge/EmDash-1.2.x%20%7C%201.4.x-0b4d3d" alt="EmDash Compatibility" /></a>
|
|
12
|
+
<a href="./LICENSE"><img src="https://img.shields.io/badge/License-MIT-d89521" alt="License: MIT" /></a>
|
|
13
|
+
<img src="https://img.shields.io/badge/TypeScript-strict-3178c6" alt="TypeScript Strict" />
|
|
14
|
+
<img src="https://img.shields.io/badge/Sandbox-1%20host%20(language%20packs)-2ea44f" alt="One outbound host: language packs" />
|
|
15
|
+
</p>
|
|
16
|
+
|
|
17
|
+
**Website:** [eventual.rsvp](https://eventual.rsvp/): documentation, install guide and support for Eventual RSVP – Core, Registrations and Tickets.
|
|
18
|
+
|
|
19
|
+
Plan and publish events in [EmDash CMS](https://emdashcms.com). Write announcements, choose venues and organizers, set repeat schedules, and share events through your website and calendar subscriptions.
|
|
20
|
+
|
|
21
|
+
**Current Registry release: 0.15.0.** Events are edited in EmDash's own collections, with rich text, images, drafts and translations. Your site builder connects the feeds to visitor pages; the screenshots below show the optional Astro showcase.
|
|
22
|
+
|
|
23
|
+
In 0.14.x, old events stored inside the plugin are shown only when an administrator explicitly enables **Show old events saved inside the plugin**. Native collections remain authoritative. See [what changed](./docs/release-notes-0.14.0.md).
|
|
24
|
+
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
## At a Glance
|
|
28
|
+
|
|
29
|
+
- **Announcements and images:** use EmDash's normal editor, save drafts, then publish.
|
|
30
|
+
- **Flexible schedules:** one-off, daily, weekly or monthly events, with changes to individual dates.
|
|
31
|
+
- **Saved venues and organizers:** choose existing entries instead of retyping them.
|
|
32
|
+
- **Languages:** separate announcements per language, with shared published schedules. The admin speaks 21 languages, including Arabic and Hebrew right to left.
|
|
33
|
+
- **Calendars:** event downloads and iCalendar subscriptions.
|
|
34
|
+
- **Website integration:** JSON feeds, optional Astro helpers and seven example layouts.
|
|
35
|
+
- **Sandboxed:** declared permissions; the only outbound host is `cdn.jsdelivr.net`, for the admin's language packs, each checked against a hash built into the release.
|
|
36
|
+
|
|
37
|
+
## Get Started
|
|
38
|
+
|
|
39
|
+
1. An administrator [installs Eventual RSVP and connects the collections](./docs/collection-setup.md).
|
|
40
|
+
2. Editors follow [Managing events](./docs/user-guide.md): save an announcement, open **Dates, venue & repeat**, then publish.
|
|
41
|
+
3. Site builders use the [developer guide](./docs/native-modernization.md) to connect visitor pages.
|
|
42
|
+
|
|
43
|
+
For the opt-in HTML cache integration, see [public feed caching](./docs/public-feed-caching.md)
|
|
44
|
+
and [release notes](./docs/release-notes-0.15.0.md). Eventual RSVP does not enable site caching.
|
|
45
|
+
|
|
46
|
+
Requires **EmDash >=1.2.0 <2.0.0**; tested on 1.2.0 and 1.4.0. **1.4.0 is recommended** because it fixes nested Block Kit forms and Cloudflare plugin mutations; 1.2/1.3 remain supported with those host limitations. Upgrades from 0.12.x or earlier need the [native-content upgrade](./docs/upgrade-0.13.0.md). Source/developer tooling needs Node 24+.
|
|
47
|
+
|
|
48
|
+
---
|
|
49
|
+
|
|
50
|
+
## Visual Tour
|
|
51
|
+
|
|
52
|
+
### 1. Website Calendar
|
|
53
|
+
Render public events on your site using the included Astro showcase with seven responsive layouts, month navigation, and category filtering—with zero client-side JavaScript.
|
|
54
|
+
|
|
55
|
+
<p align="center">
|
|
56
|
+
<img src="./images/registry-0.11.0/05-public-events.jpg" alt="Public Event Browser" width="90%" />
|
|
57
|
+
</p>
|
|
58
|
+
|
|
59
|
+
---
|
|
60
|
+
|
|
61
|
+
### 2. Event Details & One-Click Calendar Sync
|
|
62
|
+
Visitors can view full event details, join virtual meetings, get venue directions, and add events to Google Calendar, Outlook, Yahoo, or Apple Calendar.
|
|
63
|
+
|
|
64
|
+
<p align="center">
|
|
65
|
+
<img src="./images/registry-0.13.4/public-event-detail-fr-desktop.png" alt="Public event detail view" width="90%" />
|
|
66
|
+
</p>
|
|
67
|
+
|
|
68
|
+
---
|
|
69
|
+
|
|
70
|
+
### 3. Native Event Editor
|
|
71
|
+
Write announcements in EmDash's rich-text editor. Save the draft, then open Dates, venue & repeat for local dates, recurrence and individual-date changes. The Eventual RSVP workspace links to the selected content types and offers safe draft duplication.
|
|
72
|
+
|
|
73
|
+
<p align="center">
|
|
74
|
+
<img src="./images/registry-0.13.0/native-fr-editor-desktop.png" alt="French native Eventual RSVP editor" width="90%" />
|
|
75
|
+
</p>
|
|
76
|
+
|
|
77
|
+
---
|
|
78
|
+
|
|
79
|
+
### 4. Saved Organizers & Venues
|
|
80
|
+
Maintain a directory of organizers (names, websites, contact links) and physical venues with structured addresses and map directions.
|
|
81
|
+
|
|
82
|
+
Venue choices combine translation siblings into one selection, show the name and address, and retain the saved native ID. The schedule panel searches native names and addresses, including accents. Unpublished dependencies are marked and must be published before their events. Create and edit links open the native venue editor.
|
|
83
|
+
|
|
84
|
+
---
|
|
85
|
+
|
|
86
|
+
## Optional Website Views
|
|
87
|
+
|
|
88
|
+
Visitors can switch between seven viewing formats via query parameter (e.g., `/events?view=month`):
|
|
89
|
+
|
|
90
|
+
| View | Query Param | Description |
|
|
91
|
+
| :--- | :--- | :--- |
|
|
92
|
+
| **List** *(Default)* | `?view=list` | Chronological agenda list with high-contrast date blocks. |
|
|
93
|
+
| **Timeline** | `?view=timeline` | Vertical timeline with visual event nodes and summary cards. |
|
|
94
|
+
| **Card Grid** | `?view=cards` | Rich card grid displaying event cover images, organizers, and tags. |
|
|
95
|
+
| **Daily Schedule** | `?view=schedule` | Collapsible daily disclosures grouping events per date. |
|
|
96
|
+
| **Date Strip** | `?view=dates` | Horizontal date jump bar for quick navigation across the month. |
|
|
97
|
+
| **Month Calendar** | `?view=month` | Full week-aligned calendar grid on desktop; day-by-day agenda on mobile. |
|
|
98
|
+
| **Locations** | `?view=locations` | Events grouped by physical venue or virtual attendance with map directions. |
|
|
99
|
+
|
|
100
|
+
---
|
|
101
|
+
|
|
102
|
+
## For Developers
|
|
103
|
+
|
|
104
|
+
Eventual RSVP's Registry package supplies the sandbox backend and editor controls. Optional Astro, schema and transfer helpers are on npm as [`@vermeulen.solutions/eventual`](https://www.npmjs.com/package/@vermeulen.solutions/eventual) (`npm install @vermeulen.solutions/eventual`); keep its version aligned with the Registry backend. The plugin ID stays `eventual`. GitHub download versions and Registry releases are listed separately; the badges above identify each.
|
|
105
|
+
|
|
106
|
+
Use the **actual installed plugin ID** in API URLs and MCP tool names. Config-managed sites normally use `eventual`; Registry sites get a generated ID. Pass `pluginId` to `fetchPublicFeed` for a Registry installation; the showcase defaults to `eventual`.
|
|
107
|
+
|
|
108
|
+
The [developer guide](./docs/native-modernization.md) covers public JSON/ICS/image routes, SSR dispatch, tool names, settings, transfer formats, permissions and sandbox limits. It also explains installing the matching npm helpers. Eventual RSVP's MCP tools inspect native data; native edits and publication use EmDash's core tools.
|
|
109
|
+
|
|
110
|
+
For source changes:
|
|
111
|
+
|
|
112
|
+
```sh
|
|
113
|
+
npm ci
|
|
114
|
+
npm run validate
|
|
115
|
+
npm run typecheck
|
|
116
|
+
npm test
|
|
117
|
+
npm run build
|
|
118
|
+
npm run bundle
|
|
119
|
+
npm run budget
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
The backend shares EmDash's fixed sandbox RPC budget. Large feeds and migrations need host-specific verification; optional public URL lookups can be disabled when your site constructs its own links. [Details and checks](./docs/native-modernization.md#limits-and-checks).
|
|
123
|
+
|
|
124
|
+
---
|
|
125
|
+
|
|
126
|
+
## Documentation
|
|
127
|
+
|
|
128
|
+
- [Managing events](./docs/user-guide.md) — the editor's everyday guide.
|
|
129
|
+
- [Install and connect](./docs/collection-setup.md) — administrators and schema setup.
|
|
130
|
+
- [Upgrade and migrate](./docs/upgrade-0.13.0.md) — existing sites and old plugin data.
|
|
131
|
+
- [Developer guide](./docs/native-modernization.md) — integration and API reference.
|
|
132
|
+
- [0.15.0 cache integration](./docs/release-notes-0.15.0.md) · [0.14.1 compatibility release](./docs/release-notes-0.14.1.md) · [0.14.0 changes](./docs/release-notes-0.14.0.md) · [Changelog](./CHANGELOG.md).
|
|
133
|
+
- [Astro showcase](./examples/astro-events/README.md) — optional visitor pages.
|
|
134
|
+
- [Release evidence and older records](./docs/history.md).
|
|
135
|
+
|
|
136
|
+
---
|
|
137
|
+
|
|
138
|
+
## License
|
|
139
|
+
|
|
140
|
+
Eventual RSVP is licensed under the [MIT License](./LICENSE).
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
---
|
|
2
|
+
import type { PublicEvent } from "./feed";
|
|
3
|
+
import { eventPageUrl, displayEventDate } from './event-list';
|
|
4
|
+
import { buildCalendarLinks } from './event-details';
|
|
5
|
+
import { editorText, loadEditorCatalog } from './editor-i18n.mjs';
|
|
6
|
+
|
|
7
|
+
interface Props {
|
|
8
|
+
events: PublicEvent[];
|
|
9
|
+
basePath?: string;
|
|
10
|
+
heading?: string;
|
|
11
|
+
locale?: string;
|
|
12
|
+
emptyMessage?: string;
|
|
13
|
+
showCalendarLinks?: boolean;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const {
|
|
17
|
+
events,
|
|
18
|
+
basePath = "/events",
|
|
19
|
+
heading,
|
|
20
|
+
locale = Astro.currentLocale,
|
|
21
|
+
emptyMessage,
|
|
22
|
+
showCalendarLinks = false,
|
|
23
|
+
} = Astro.props;
|
|
24
|
+
|
|
25
|
+
// Visitor-facing labels follow the page language (catalogs ship with this package).
|
|
26
|
+
const uiLocale = locale ?? 'en';
|
|
27
|
+
await loadEditorCatalog(uiLocale);
|
|
28
|
+
const t = (text: string) => editorText(text, uiLocale);
|
|
29
|
+
|
|
30
|
+
function eventUrl(event: PublicEvent): string {
|
|
31
|
+
return eventPageUrl(event, basePath);
|
|
32
|
+
}
|
|
33
|
+
---
|
|
34
|
+
|
|
35
|
+
{heading && <h2>{heading}</h2>}
|
|
36
|
+
{events.length === 0 ? <p>{emptyMessage ?? t('No events found.')}</p> : (
|
|
37
|
+
<ul class="eventual-list">
|
|
38
|
+
{events.map((event) => {
|
|
39
|
+
const links = showCalendarLinks ? (event.calendarLinks ?? buildCalendarLinks(event)) : null;
|
|
40
|
+
return (
|
|
41
|
+
<li class="eventual-item">
|
|
42
|
+
<a href={eventUrl(event)} class="eventual-title">{event.title}</a>
|
|
43
|
+
<time datetime={event.start} class="eventual-time">{displayEventDate(event, locale ?? event.locale ?? 'en-GB')}</time>
|
|
44
|
+
{(event.venue?.name || event.location) && <span class="eventual-location">{event.venue?.name || event.location}</span>}
|
|
45
|
+
{links && (
|
|
46
|
+
<div class="eventual-calendar-links" role="group" aria-label={t('Add to calendar')}>
|
|
47
|
+
<a href={links.google} target="_blank" rel="noopener noreferrer" aria-label={t('Add to Google Calendar')} class="eventual-cal-btn eventual-cal-google">Google</a>
|
|
48
|
+
<a href={links.outlook} target="_blank" rel="noopener noreferrer" aria-label={t('Add to Outlook Calendar')} class="eventual-cal-btn eventual-cal-outlook">Outlook</a>
|
|
49
|
+
<a href={links.office365} target="_blank" rel="noopener noreferrer" aria-label={t('Add to Office 365')} class="eventual-cal-btn eventual-cal-office">Office 365</a>
|
|
50
|
+
<a href={links.ics} download aria-label={t('Download iCal file')} class="eventual-cal-btn eventual-cal-ics">.ics</a>
|
|
51
|
+
</div>
|
|
52
|
+
)}
|
|
53
|
+
</li>
|
|
54
|
+
);
|
|
55
|
+
})}
|
|
56
|
+
</ul>
|
|
57
|
+
)}
|
package/astro/admin.mjs
ADDED
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
/** Frontend companion for configured sites. Eventual's backend stays sandboxed. */
|
|
2
|
+
import { createElement as h, useEffect, useRef, useState } from "react";
|
|
3
|
+
import { useLocale } from "@emdash-cms/admin";
|
|
4
|
+
import {i18n} from "@lingui/core";
|
|
5
|
+
import { editorText,fillFrenchCoreMessages,loadEditorCatalog,onEditorCatalog } from "./editor-i18n.mjs";
|
|
6
|
+
export { eventualEditor, createPlugin } from "./descriptor.mjs";
|
|
7
|
+
function useText() {
|
|
8
|
+
const { locale } = useLocale();
|
|
9
|
+
const [, rerender] = useState(0);
|
|
10
|
+
useEffect(()=>{fillFrenchCoreMessages(i18n);},[locale]);
|
|
11
|
+
// Catalogs load per language; re-render once the admin's language arrives.
|
|
12
|
+
useEffect(()=>{ const off=onEditorCatalog(()=>rerender(n=>n+1)); loadEditorCatalog(locale); return off; },[locale]);
|
|
13
|
+
return value => editorText(value, locale);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
// Core field widgets receive one value. Scope attendance presentation to the
|
|
17
|
+
// enclosing editor form; this never changes, clears or persists another field.
|
|
18
|
+
const attendance = new WeakMap();
|
|
19
|
+
function useAttendance(ref, value) {
|
|
20
|
+
const [mode, setMode] = useState("physical");
|
|
21
|
+
useEffect(() => {
|
|
22
|
+
const form = ref.current?.closest("form");
|
|
23
|
+
if (!form) return;
|
|
24
|
+
let store = attendance.get(form);
|
|
25
|
+
if (!store) { store = { value: "physical", listeners: new Set() }; attendance.set(form, store); }
|
|
26
|
+
store.listeners.add(setMode);
|
|
27
|
+
if (value !== undefined) {
|
|
28
|
+
store.value = value || "physical";
|
|
29
|
+
for (const listener of store.listeners) listener(store.value);
|
|
30
|
+
} else setMode(store.value);
|
|
31
|
+
return () => store.listeners.delete(setMode);
|
|
32
|
+
}, [value]);
|
|
33
|
+
return mode;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
// Returning null uses core's supported plugin field renderer hook. The field
|
|
37
|
+
// remains in formData, snapshots, revisions and the database; no CSS hiding.
|
|
38
|
+
function ManagedField({ id }) {
|
|
39
|
+
const t = useText();
|
|
40
|
+
return id === "field-start"
|
|
41
|
+
? h(
|
|
42
|
+
"aside",
|
|
43
|
+
{
|
|
44
|
+
className:
|
|
45
|
+
"rounded-md border border-kumo-line p-4 text-sm leading-relaxed",
|
|
46
|
+
"aria-label": t("Event dates"),
|
|
47
|
+
},
|
|
48
|
+
t("Set dates, choose a saved venue and manage repeats in “Dates, venue & repeat” in the settings panel. For a new event, save its first draft to open that panel."),
|
|
49
|
+
)
|
|
50
|
+
: null;
|
|
51
|
+
}
|
|
52
|
+
const fieldHelp = {
|
|
53
|
+
"field-excerpt":
|
|
54
|
+
"An optional short summary for event listings. The full announcement stays in Description.",
|
|
55
|
+
"field-image_url":
|
|
56
|
+
"Use this only for an image hosted elsewhere. Prefer Event image from the media library.",
|
|
57
|
+
"field-location":
|
|
58
|
+
"Extra information such as a room or entrance. It appears alongside the saved venue’s address and can be translated.",
|
|
59
|
+
"field-organizer":
|
|
60
|
+
"Leave blank to use the saved organizer’s name. Change it here only when this language needs a different display name.",
|
|
61
|
+
"field-virtual_url": "Link visitors use to join an online or hybrid event.",
|
|
62
|
+
"field-external_url":
|
|
63
|
+
"Link visitors use to register or read more about the event.",
|
|
64
|
+
};
|
|
65
|
+
function OptionalText({ value, onChange, label, id }) {
|
|
66
|
+
const t = useText();
|
|
67
|
+
const ref = useRef(null);
|
|
68
|
+
const mode = useAttendance(ref);
|
|
69
|
+
const [open, setOpen] = useState(false);
|
|
70
|
+
const url = id.endsWith("_url");
|
|
71
|
+
const multiline = id === "field-excerpt";
|
|
72
|
+
return h(
|
|
73
|
+
"details",
|
|
74
|
+
{
|
|
75
|
+
className: "rounded-md border border-kumo-line p-4",
|
|
76
|
+
ref,
|
|
77
|
+
hidden: id === "field-virtual_url" && mode === "physical",
|
|
78
|
+
open,
|
|
79
|
+
onToggle: event => setOpen(event.currentTarget.open),
|
|
80
|
+
},
|
|
81
|
+
h("summary", { className: "cursor-pointer text-base font-medium break-words" }, t(label), value ? h("span", { className: "ms-2 text-sm font-normal text-kumo-subtle" }, t("Added")) : null),
|
|
82
|
+
h(
|
|
83
|
+
"div",
|
|
84
|
+
{ className: "mt-3 grid gap-2" },
|
|
85
|
+
h("label", { htmlFor: id, className: "text-sm", id: id + "-help" }, t(fieldHelp[id] || label)),
|
|
86
|
+
h(multiline ? "textarea" : "input", {
|
|
87
|
+
id,
|
|
88
|
+
"aria-describedby": id + "-help",
|
|
89
|
+
value: typeof value === "string" ? value : "",
|
|
90
|
+
...(!multiline ? { type: url ? "url" : "text" } : { rows: 3 }),
|
|
91
|
+
onChange: (event) => onChange(event.target.value),
|
|
92
|
+
className:
|
|
93
|
+
"w-full rounded-md border border-kumo-line bg-kumo-base p-2 text-base",
|
|
94
|
+
}),
|
|
95
|
+
),
|
|
96
|
+
);
|
|
97
|
+
}
|
|
98
|
+
function LocationType({ value, onChange, label, id }) {
|
|
99
|
+
const t = useText();
|
|
100
|
+
const ref = useRef(null);
|
|
101
|
+
useAttendance(ref, value || "physical");
|
|
102
|
+
return h(
|
|
103
|
+
"label",
|
|
104
|
+
{ htmlFor: id, className: "grid gap-2" },
|
|
105
|
+
h("span", { className: "text-base font-medium" }, t(label)),
|
|
106
|
+
h(
|
|
107
|
+
"select",
|
|
108
|
+
{
|
|
109
|
+
id,
|
|
110
|
+
ref,
|
|
111
|
+
value: value || "physical",
|
|
112
|
+
onChange: (event) => onChange(event.target.value),
|
|
113
|
+
className:
|
|
114
|
+
"rounded-md border border-kumo-line bg-kumo-base p-2 text-base",
|
|
115
|
+
},
|
|
116
|
+
...[
|
|
117
|
+
["physical", "In person"],
|
|
118
|
+
["virtual", "Online"],
|
|
119
|
+
["hybrid", "In person and online"],
|
|
120
|
+
].map(([value, label]) => h("option", { key: value, value }, t(label))),
|
|
121
|
+
),
|
|
122
|
+
);
|
|
123
|
+
}
|
|
124
|
+
function EventStatus({ value, onChange, label, id }) {
|
|
125
|
+
const t = useText();
|
|
126
|
+
return h(
|
|
127
|
+
"label",
|
|
128
|
+
{ htmlFor: id, className: "grid gap-2" },
|
|
129
|
+
h("span", { className: "text-base font-medium" }, t(label)),
|
|
130
|
+
h(
|
|
131
|
+
"select",
|
|
132
|
+
{
|
|
133
|
+
id,
|
|
134
|
+
value: value || "published",
|
|
135
|
+
onChange: (event) => onChange(event.target.value),
|
|
136
|
+
className:
|
|
137
|
+
"rounded-md border border-kumo-line bg-kumo-base p-2 text-base",
|
|
138
|
+
},
|
|
139
|
+
...[
|
|
140
|
+
["published", "Happening as planned"],
|
|
141
|
+
["cancelled", "Cancelled"],
|
|
142
|
+
["postponed", "Postponed (new date to be confirmed)"],
|
|
143
|
+
["rescheduled", "Rescheduled"],
|
|
144
|
+
].map(([value, label]) => h("option", { key: value, value }, t(label))),
|
|
145
|
+
),
|
|
146
|
+
h(
|
|
147
|
+
"span",
|
|
148
|
+
{ className: "text-sm text-kumo-subtle" },
|
|
149
|
+
t("Describes the event itself. Use Publish to make it visible on the site."),
|
|
150
|
+
),
|
|
151
|
+
);
|
|
152
|
+
}
|
|
153
|
+
export const fields = {
|
|
154
|
+
managed: ManagedField,
|
|
155
|
+
"event-status": EventStatus,
|
|
156
|
+
"optional-text": OptionalText,
|
|
157
|
+
"location-type": LocationType,
|
|
158
|
+
};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
// Generated from src/schema/blueprint.ts by scripts/build-host.mjs.
|
|
2
|
+
/** Native schemas. Slugs and publication state are EmDash metadata, not fields. */
|
|
3
|
+
import type { SeedCollection } from "emdash/seed";
|
|
4
|
+
export interface BlueprintField {
|
|
5
|
+
slug: string;
|
|
6
|
+
label: string;
|
|
7
|
+
type: "string" | "text" | "url" | "number" | "integer" | "boolean" | "datetime" | "select" | "multiSelect" | "portableText" | "image" | "file" | "reference" | "json" | "slug" | "repeater";
|
|
8
|
+
required?: boolean;
|
|
9
|
+
unique?: boolean;
|
|
10
|
+
searchable?: boolean;
|
|
11
|
+
indexed?: boolean;
|
|
12
|
+
translatable?: boolean;
|
|
13
|
+
defaultValue?: unknown;
|
|
14
|
+
description?: string;
|
|
15
|
+
options?: Record<string, unknown>;
|
|
16
|
+
widget?: string;
|
|
17
|
+
validation?: Record<string, unknown>;
|
|
18
|
+
sortOrder?: number;
|
|
19
|
+
}
|
|
20
|
+
export interface CollectionBlueprint {
|
|
21
|
+
slug: string;
|
|
22
|
+
label: string;
|
|
23
|
+
labelSingular: string;
|
|
24
|
+
supports?: SeedCollection["supports"];
|
|
25
|
+
routable?: boolean;
|
|
26
|
+
urlPattern?: string;
|
|
27
|
+
fields: BlueprintField[];
|
|
28
|
+
}
|
|
29
|
+
export interface SchemaBlueprintOptions {
|
|
30
|
+
eventCollection?: string;
|
|
31
|
+
venueCollection?: string;
|
|
32
|
+
organizerCollection?: string;
|
|
33
|
+
bindRelations?: boolean;
|
|
34
|
+
/** Opt in only when importing private-storage records from older prototypes. */
|
|
35
|
+
legacyCompatibility?: boolean;
|
|
36
|
+
}
|
|
37
|
+
export declare function createEventsCollectionBlueprint(options?: SchemaBlueprintOptions): CollectionBlueprint;
|
|
38
|
+
export declare function createVenuesCollectionBlueprint(options?: SchemaBlueprintOptions): CollectionBlueprint;
|
|
39
|
+
export declare function createOrganizersCollectionBlueprint(options?: SchemaBlueprintOptions): CollectionBlueprint;
|
|
40
|
+
export interface BlueprintRelation {
|
|
41
|
+
slug: string;
|
|
42
|
+
parentCollection: string;
|
|
43
|
+
childCollection: string;
|
|
44
|
+
parentLabel: string;
|
|
45
|
+
childLabel: string;
|
|
46
|
+
parentLabelSingular?: string;
|
|
47
|
+
childLabelSingular?: string;
|
|
48
|
+
maxChildrenPerParent?: number;
|
|
49
|
+
maxParentsPerChild?: number;
|
|
50
|
+
}
|
|
51
|
+
export declare function createEventRelations(options?: SchemaBlueprintOptions): BlueprintRelation[];
|
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
// Generated from src/schema/blueprint.ts by scripts/build-host.mjs.
|
|
2
|
+
function field(slug, type, translatable = false, extra = {}) {
|
|
3
|
+
return {
|
|
4
|
+
slug,
|
|
5
|
+
label: {
|
|
6
|
+
title: "Title",
|
|
7
|
+
start: "Start", end: "End", start_date: "Start date", end_date: "Last day", all_day: "All-day event", timezone: "Time zone",
|
|
8
|
+
recurrence: "Repeat", exceptions: "Changed dates", occurrence_content: "Announcements for individual dates", categories: "Categories",
|
|
9
|
+
description: "Description",
|
|
10
|
+
excerpt: "Short summary",
|
|
11
|
+
featured_image: "Event image",
|
|
12
|
+
image_url: "External image URL",
|
|
13
|
+
location_type: "Where the event takes place",
|
|
14
|
+
location: "Location note for this language",
|
|
15
|
+
virtual_url: "Online meeting or stream URL",
|
|
16
|
+
external_url: "Registration or event website",
|
|
17
|
+
organizer: "Organizer display name for this language",
|
|
18
|
+
event_status: "Event status",
|
|
19
|
+
name: "Name",
|
|
20
|
+
street: "Street address",
|
|
21
|
+
street2: "Address line 2",
|
|
22
|
+
locality: "Town or city",
|
|
23
|
+
region: "Region",
|
|
24
|
+
postal_code: "Postal code",
|
|
25
|
+
country: "Country",
|
|
26
|
+
directions: "Directions",
|
|
27
|
+
website: "Website",
|
|
28
|
+
contact_url: "Contact page",
|
|
29
|
+
}[slug] ?? slug.replaceAll("_", " "),
|
|
30
|
+
type,
|
|
31
|
+
translatable,
|
|
32
|
+
...([
|
|
33
|
+
"start",
|
|
34
|
+
"end",
|
|
35
|
+
"start_date",
|
|
36
|
+
"end_date",
|
|
37
|
+
"all_day",
|
|
38
|
+
"timezone",
|
|
39
|
+
"venue",
|
|
40
|
+
"venue_id",
|
|
41
|
+
"organizer_ref",
|
|
42
|
+
"organizer_id",
|
|
43
|
+
"organizer_details",
|
|
44
|
+
"categories",
|
|
45
|
+
"recurrence",
|
|
46
|
+
"exceptions",
|
|
47
|
+
"occurrence_content",
|
|
48
|
+
"previous_start_date",
|
|
49
|
+
"schedule_history",
|
|
50
|
+
"legacy_id",
|
|
51
|
+
"legacy_metadata",
|
|
52
|
+
"calendar_uid",
|
|
53
|
+
].includes(slug)
|
|
54
|
+
? { widget: "eventual-editor:managed" }
|
|
55
|
+
: {}),
|
|
56
|
+
...extra,
|
|
57
|
+
options: { ...extra.options, eventualEditor: true },
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
export function createEventsCollectionBlueprint(options = {}) {
|
|
61
|
+
return {
|
|
62
|
+
slug: options.eventCollection ?? "events",
|
|
63
|
+
label: "Events",
|
|
64
|
+
labelSingular: "Event",
|
|
65
|
+
supports: ["drafts", "revisions", "scheduling", "search"],
|
|
66
|
+
routable: true,
|
|
67
|
+
urlPattern: "/events/{slug}",
|
|
68
|
+
fields: [
|
|
69
|
+
field("title", "string", true, { required: true, searchable: true }),
|
|
70
|
+
field("description", "portableText", true, { searchable: true }),
|
|
71
|
+
...(options.legacyCompatibility ? [field("excerpt", "text", true)] : []),
|
|
72
|
+
field("featured_image", "image"),
|
|
73
|
+
...(options.legacyCompatibility ? [field("image_url", "url")] : []),
|
|
74
|
+
// All-day dates are Gregorian civil dates, inclusive at both ends.
|
|
75
|
+
field("start", "datetime", false, { indexed: true }),
|
|
76
|
+
field("end", "datetime"),
|
|
77
|
+
field("start_date", "string"),
|
|
78
|
+
field("end_date", "string"),
|
|
79
|
+
field("all_day", "boolean", false, { defaultValue: false }),
|
|
80
|
+
field("timezone", "string", false, { defaultValue: "Europe/Zurich" }),
|
|
81
|
+
field("location_type", "select", false, {
|
|
82
|
+
widget: "eventual-editor:location-type",
|
|
83
|
+
defaultValue: "physical",
|
|
84
|
+
validation: { options: ["physical", "virtual", "hybrid"] },
|
|
85
|
+
}),
|
|
86
|
+
field("venue", "reference", false, {
|
|
87
|
+
label: "Saved venue",
|
|
88
|
+
options: { collection: options.venueCollection ?? "venues" },
|
|
89
|
+
...(options.bindRelations
|
|
90
|
+
? {
|
|
91
|
+
validation: {
|
|
92
|
+
relation: `${options.eventCollection ?? "events"}_venue`,
|
|
93
|
+
targetCollection: options.venueCollection ?? "venues",
|
|
94
|
+
relationSide: "parent",
|
|
95
|
+
multiple: false,
|
|
96
|
+
},
|
|
97
|
+
}
|
|
98
|
+
: {}),
|
|
99
|
+
}),
|
|
100
|
+
...(options.legacyCompatibility ? [field("location", "string", true)] : []),
|
|
101
|
+
...(options.bindRelations
|
|
102
|
+
? [
|
|
103
|
+
field("venue_id", "reference", false, {
|
|
104
|
+
label: "Saved venue",
|
|
105
|
+
options: { collection: options.venueCollection ?? "venues" },
|
|
106
|
+
}),
|
|
107
|
+
]
|
|
108
|
+
: []),
|
|
109
|
+
field("virtual_url", "url", false, {
|
|
110
|
+
widget: "eventual-editor:optional-text",
|
|
111
|
+
}),
|
|
112
|
+
field("external_url", "url", false, {
|
|
113
|
+
widget: "eventual-editor:optional-text",
|
|
114
|
+
}),
|
|
115
|
+
...(options.legacyCompatibility ? [field("organizer", "string", true)] : []),
|
|
116
|
+
field("organizer_ref", "reference", false, {
|
|
117
|
+
label: "Saved organizer",
|
|
118
|
+
options: { collection: options.organizerCollection ?? "organizers" },
|
|
119
|
+
...(options.bindRelations
|
|
120
|
+
? {
|
|
121
|
+
validation: {
|
|
122
|
+
relation: `${options.eventCollection ?? "events"}_organizer`,
|
|
123
|
+
targetCollection: options.organizerCollection ?? "organizers",
|
|
124
|
+
relationSide: "parent",
|
|
125
|
+
multiple: false,
|
|
126
|
+
},
|
|
127
|
+
}
|
|
128
|
+
: {}),
|
|
129
|
+
}),
|
|
130
|
+
...(options.legacyCompatibility ? [field("organizer_details", "json")] : []),
|
|
131
|
+
...(options.bindRelations
|
|
132
|
+
? [
|
|
133
|
+
field("organizer_id", "reference", false, {
|
|
134
|
+
label: "Saved organizer",
|
|
135
|
+
options: {
|
|
136
|
+
collection: options.organizerCollection ?? "organizers",
|
|
137
|
+
},
|
|
138
|
+
}),
|
|
139
|
+
]
|
|
140
|
+
: []),
|
|
141
|
+
field("categories", options.legacyCompatibility ? "json" : "string", false, {
|
|
142
|
+
description: "Optional. Separate category names with commas.",
|
|
143
|
+
}),
|
|
144
|
+
field("event_status", "select", false, {
|
|
145
|
+
widget: "eventual-editor:event-status",
|
|
146
|
+
defaultValue: "published",
|
|
147
|
+
validation: {
|
|
148
|
+
options: ["published", "cancelled", "postponed", "rescheduled"],
|
|
149
|
+
},
|
|
150
|
+
}),
|
|
151
|
+
field("recurrence", "json"),
|
|
152
|
+
field("exceptions", "json", false, {
|
|
153
|
+
description: "Schedule overrides only; translated occurrence copy belongs in occurrence_content.",
|
|
154
|
+
}),
|
|
155
|
+
field("occurrence_content", "json", true),
|
|
156
|
+
...(options.legacyCompatibility ? [
|
|
157
|
+
field("previous_start_date", "string"),
|
|
158
|
+
field("schedule_history", "json"),
|
|
159
|
+
field("legacy_id", "string", false, { unique: true, indexed: true }),
|
|
160
|
+
field("legacy_metadata", "json"),
|
|
161
|
+
field("calendar_uid", "string"),
|
|
162
|
+
] : []),
|
|
163
|
+
],
|
|
164
|
+
};
|
|
165
|
+
}
|
|
166
|
+
export function createVenuesCollectionBlueprint(options = {}) {
|
|
167
|
+
return {
|
|
168
|
+
slug: "venues",
|
|
169
|
+
label: "Venues",
|
|
170
|
+
labelSingular: "Venue",
|
|
171
|
+
supports: ["search"],
|
|
172
|
+
routable: false,
|
|
173
|
+
fields: [
|
|
174
|
+
field("name", "string", false, { required: true, searchable: true }),
|
|
175
|
+
...[
|
|
176
|
+
"street",
|
|
177
|
+
"street2",
|
|
178
|
+
"locality",
|
|
179
|
+
"region",
|
|
180
|
+
"postal_code",
|
|
181
|
+
"country",
|
|
182
|
+
].map((slug) => field(slug, "string")),
|
|
183
|
+
field("directions", "portableText", true),
|
|
184
|
+
...(options.legacyCompatibility ? [
|
|
185
|
+
field("legacy_id", "string", false, { unique: true, indexed: true }),
|
|
186
|
+
field("legacy_metadata", "json"),
|
|
187
|
+
] : []),
|
|
188
|
+
],
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
export function createOrganizersCollectionBlueprint(options = {}) {
|
|
192
|
+
return {
|
|
193
|
+
slug: "organizers",
|
|
194
|
+
label: "Organizers",
|
|
195
|
+
labelSingular: "Organizer",
|
|
196
|
+
supports: ["search"],
|
|
197
|
+
routable: false,
|
|
198
|
+
fields: [
|
|
199
|
+
field("name", "string", false, { required: true, searchable: true }),
|
|
200
|
+
field("website", "url"),
|
|
201
|
+
field("contact_url", "url"),
|
|
202
|
+
...(options.legacyCompatibility ? [
|
|
203
|
+
field("legacy_id", "string", false, { unique: true, indexed: true }),
|
|
204
|
+
field("legacy_metadata", "json"),
|
|
205
|
+
] : []),
|
|
206
|
+
],
|
|
207
|
+
};
|
|
208
|
+
}
|
|
209
|
+
export function createEventRelations(options = {}) {
|
|
210
|
+
const venueCollection = options.venueCollection ?? "venues";
|
|
211
|
+
const organizerCollection = options.organizerCollection ?? "organizers";
|
|
212
|
+
const eventCollection = options.eventCollection ?? "events";
|
|
213
|
+
return [
|
|
214
|
+
{
|
|
215
|
+
slug: `${eventCollection}_venue`,
|
|
216
|
+
parentCollection: eventCollection,
|
|
217
|
+
childCollection: venueCollection,
|
|
218
|
+
parentLabel: "Events",
|
|
219
|
+
childLabel: venueCollection.charAt(0).toUpperCase() + venueCollection.slice(1),
|
|
220
|
+
parentLabelSingular: "Event",
|
|
221
|
+
childLabelSingular: "Venue",
|
|
222
|
+
maxChildrenPerParent: 1,
|
|
223
|
+
},
|
|
224
|
+
{
|
|
225
|
+
slug: `${eventCollection}_organizer`,
|
|
226
|
+
parentCollection: eventCollection,
|
|
227
|
+
childCollection: organizerCollection,
|
|
228
|
+
parentLabel: "Events",
|
|
229
|
+
childLabel: organizerCollection.charAt(0).toUpperCase() +
|
|
230
|
+
organizerCollection.slice(1),
|
|
231
|
+
parentLabelSingular: "Event",
|
|
232
|
+
childLabelSingular: "Organizer",
|
|
233
|
+
maxChildrenPerParent: 1,
|
|
234
|
+
},
|
|
235
|
+
];
|
|
236
|
+
}
|