diff --git a/AGENTS.md b/AGENTS.md index c47b28a..633aaa9 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -99,12 +99,14 @@ All components use Svelte 5 runes syntax — **never** `export let`, `$:`, or `o ### Block System Pages are composed of `ContentBlock[]`. Each block has `{ id, type, data }`. Block types are defined in `packages/shared/src/types.ts` (re-exported via `$lib/types` in each app): -`text | image_text | timeline | hero | button | spacer | testimonials | upcoming_calendar | shop | checkout` +`text | image_text | timeline | hero | button | spacer | testimonials | upcoming_calendar | shop | checkout | cards | faq | html` - **Renderers (shared)**: `packages/shared/src/blocks/Block.svelte` — one renderer per type, imported by both apps via `$shared/blocks/...`. The admin preview iframe uses the same shared renderers. - **Admin editors**: `app-admin/src/lib/admin/editors/BlockEditor.svelte` — switches editor UI by type - **Defaults**: `app-admin/src/lib/admin/blockDefaults.ts` — `createBlock(type)` generates a new block with sensible defaults - **Block list**: `app-admin/src/lib/admin/BlockList.svelte` — draggable reorder, select, delete +- **Settings on every block** (keys starting with `_`, edited below each block's own fields): `_background`, `_foreground` (colours) and `_anchor` (id for `#anchor` links), applied by `BackgroundWrapper.svelte`. +- **Text is edited visually**: `RichTextEditor.svelte` (Tiptap) only produces `p, h2, h3, strong, em, s, a, ul, ol, li, blockquote, br, hr` — no inline styles or layout HTML. That list is `EDITOR_TAGS` in `packages/shared/src/richText.ts`; keep it and the editor's extensions in step. A layout people keep needing becomes a block (as Cards and FAQ did), never HTML in a text block; one-offs and embeds go in an `html` block. Old text blocks holding other HTML are turned into `html` blocks (or centred text) by `upgradeLegacyBlocks()` on backup import and by migration `1793300000_text_blocks_visual_editor.js`. To add a new block type: add to `BlockType` union in `packages/shared/src/types.ts`, create renderer in `packages/shared/src/blocks/`, add editor case in `app-admin/src/lib/admin/editors/BlockEditor.svelte`, add default in `app-admin/src/lib/admin/blockDefaults.ts`, add import in `packages/shared/src/blocks/BlockRenderer.svelte`. @@ -149,7 +151,7 @@ To add an email block type: add to `EmailBlockType` in `packages/shared/src/type - Editors with unsaved state use `use:enhance` + `warnOnUnsavedChanges()`. - **Dates, times and prices shown to people** use `DISPLAY_LOCALE` (`en-GB`: day-month-year, 24-hour clock) and the helpers in `$shared/calendar` (`formatInstant`, `formatPrice` with the shop `currency`, `formatDateTime`) — never `toLocale*(undefined)`, which renders US formats on the server. Booking times on the public site are shown in `SITE_TIMEZONE` too (layout data `timezone`, read by blocks via `page.data.timezone`). Native `` fields follow the visitor's browser language and can't be changed from the page. - **Dates/times in admin**: entered and displayed in `SITE_TIMEZONE` (layout data `timezone`), via `toZonedDatetimeInput`, `zonedInputToIso`, `formatDateTime` in `$shared/calendar`. Never `new Date(localInput)` on the server — the container runs in UTC. -- **Prose**: `.prose-wellness` class for rich text content styling +- **Prose**: `.prose-wellness` class for rich text content styling (in both apps' `app.css`, which must stay alike: the admin preview uses it). A *Quote* in the editor is the pull quote (`blockquote`). ### Routing - **Admin app** (`app-admin`): All routes except `/login` are auth-guarded in `hooks.server.ts` (which also refreshes the token per request and sets the cookie's `Secure` flag from the real scheme). The root layout renders the admin shell (grouped sidebar) except on `/login` and `/preview`. The `/preview` route reads `sessionStorage` set by the page editor (same-origin, so it works). diff --git a/README.md b/README.md index 4d5e826..e14caf8 100644 --- a/README.md +++ b/README.md @@ -136,7 +136,7 @@ All routes in `app-admin` except `/login` are guarded in `src/hooks.server.ts`. - `/login` — sign in - `/pages` — list/create pages -- `/pages/[slug]` — block editor with draft preview +- `/pages/[slug]` — block editor with draft preview. Text is edited visually (headings, bold, italic, strikethrough, links, lists, pull quotes, lines; alignment and a small *footnote* size per block). Layouts have their own blocks: **Cards** (pictures or numbered steps, optionally linked — e.g. *Who I work with*, *Read next*, *How it works*) and **FAQ** (questions that open to show the answer). An **HTML** block takes raw HTML for embeds and one-offs (inline styles only; anything it loads from another site shares visitors' IPs). Every block has an *Anchor*, so a button or link to `#prices` jumps to it. - `/calendar` — events shown by Upcoming Calendar blocks - `/items` — services, products and bundles shown in Shop blocks - `/slots` — when the practitioner can be booked: **windows** (e.g. 09:00–12:00, with the services bookable in it and where bookings may start — in fixed steps (every 10–60 min, default 30), or only at the start/end of the free time) and **group sessions** (one service at one of its lengths, fixed time, places). Month calendar, a day view with free time and bookings, and bulk tools — *Generate slots* (date range × weekdays × hours → windows, or sessions spaced by length + get-ready time), *Copy a week* (repeat into the next 1–12 weeks) and *Clear slots* (slots with nothing booked). Windows may not overlap each other, nor sessions of the same service; bulk tools preview first and skip past or overlapping slots. A window can't shrink past a booking in it. diff --git a/app-admin/src/app.css b/app-admin/src/app.css index 811e139..c6be313 100644 --- a/app-admin/src/app.css +++ b/app-admin/src/app.css @@ -109,6 +109,36 @@ h4 { padding-left: 1.5rem; } +/* The visual editor wraps list items in

. */ +.prose-wellness li > p { + margin: 0; +} + +.prose-wellness ol { + list-style: decimal; + padding-left: 1.5rem; +} + +/* Pull quote: a "Quote" in the visual editor. */ +.prose-wellness blockquote { + margin: 0.75rem 0; + padding-left: 1.25rem; + border-left: 3px solid var(--color-primary, #8a9a7b); + font-family: 'Playfair Display', Georgia, serif; + font-size: 1.35rem; + font-style: italic; +} + +.prose-wellness.text-center blockquote { + border-left: 0; + padding-left: 0; +} + +.prose-wellness hr { + margin: 2rem 0; + border-color: color-mix(in srgb, currentColor 20%, transparent); +} + .prose-wellness a { color: color-mix(in srgb, var(--color-primary, #8a9a7b) 90%, #000); text-decoration: underline; @@ -147,3 +177,15 @@ h4 { html { scroll-behavior: smooth; } + +/* Visual editor (RichTextEditor): roughly how the site shows text, sized for the sidebar. */ +.rich-text h2 { font-size: 1.5rem; font-weight: 700; margin: 0.75rem 0 0.25rem; } +.rich-text h3 { font-size: 1.2rem; font-weight: 700; margin: 0.75rem 0 0.25rem; } +.rich-text p { margin: 0.4rem 0; } +.rich-text ul { list-style: disc; padding-left: 1.5rem; } +.rich-text ol { list-style: decimal; padding-left: 1.5rem; } +.rich-text blockquote { border-left: 3px solid var(--color-primary); padding-left: 1rem; font-style: italic; } +.rich-text hr { margin: 1rem 0; border-color: var(--color-base-300); } +.rich-text a { text-decoration: underline; } +.rich-text > :first-child { margin-top: 0; } +.rich-text li > p { margin: 0; } diff --git a/app-admin/src/lib/admin/blockDefaults.ts b/app-admin/src/lib/admin/blockDefaults.ts index 5b6f454..97b93c9 100644 --- a/app-admin/src/lib/admin/blockDefaults.ts +++ b/app-admin/src/lib/admin/blockDefaults.ts @@ -11,7 +11,10 @@ export const blockLabels: Record = { testimonials: 'Testimonials', upcoming_calendar: 'Upcoming Calendar', shop: 'Shop', - checkout: 'Checkout' + checkout: 'Checkout', + cards: 'Cards', + faq: 'FAQ', + html: 'HTML' }; export const blockTypes = Object.keys(blockLabels) as BlockType[]; @@ -80,6 +83,24 @@ export function createBlock(type: BlockType): ContentBlock { notesLabel: 'Notes or special requests' }; break; + case 'cards': + base.data = { + heading: 'Section heading', + intro: '', + align: 'center', + style: 'image', + items: [1, 2, 3].map((n) => ({ imageUrl: '', imageAlt: '', title: `Card ${n}`, subtitle: '', text: '

A sentence or two.

', href: '', linkLabel: '' })) + }; + break; + case 'faq': + base.data = { + heading: 'Questions people ask', + items: [{ question: 'What happens in the first session?', answer: '

Answer it here.

' }] + }; + break; + case 'html': + base.data = { html: '' }; + break; } base.data._background = { type: 'none', color: '', attachment: 'scroll', overlay: false, overlayOpacity: 40 }; return base; diff --git a/app-admin/src/lib/admin/editors/BlockEditor.svelte b/app-admin/src/lib/admin/editors/BlockEditor.svelte index cb756f7..d0a1f42 100644 --- a/app-admin/src/lib/admin/editors/BlockEditor.svelte +++ b/app-admin/src/lib/admin/editors/BlockEditor.svelte @@ -38,6 +38,18 @@ updateData({ [key]: (block.data[key] || []).filter((_: unknown, i: number) => i !== index) }); } + function moveArrayItem(key: string, index: number, by: number) { + if (!block) return; + const items = [...(block.data[key] || [])]; + const to = index + by; + if (to < 0 || to >= items.length) return; + [items[index], items[to]] = [items[to], items[index]]; + updateData({ [key]: items }); + } + + // "#prices" links jump to the block with anchor "prices"; keep it to characters that work in an address. + const toAnchor = (value: string) => value.trim().toLowerCase().replace(/^#/, '').replace(/[^a-z0-9_-]+/g, '-').replace(/^-+|-+$/g, ''); + function toggleCategory(category: string) { if (!block) return; const categories = block.data.categories || []; @@ -76,6 +88,10 @@ {#if block.type === 'text'} updateData({ content })} /> +
+ updateData({ align: v })} /> + updateData({ size: v })} formatLabel={(v) => (v === 'small' ? 'Small (footnote)' : 'Normal')} /> +
{:else if block.type === 'image_text'}
updateData(image)} /> @@ -163,9 +179,77 @@ {:else if block.type === 'checkout'} + {:else if block.type === 'cards'} + {@render field('Heading', block.data.heading || '', (heading) => updateData({ heading }), 'Optional')} + +
+ updateData({ align: v })} /> + updateData({ style: v })} formatLabel={(v) => (v === 'image' ? 'A picture' : 'A number')} /> +
+
+ {#each block.data.items || [] as card, i} +
+
+ Card {i + 1} + + + +
+ {#if block.data.style !== 'numbered'} + updateArray('items', i, { imageUrl: image.url, imageAlt: image.alt })} /> + {/if} +
+ {@render field('Title', card.title || '', (title) => updateArray('items', i, { title }))} + {@render field('Subtitle', card.subtitle || '', (subtitle) => updateArray('items', i, { subtitle }), 'Optional, shown lighter')} +
+ Text + updateArray('items', i, { text })} /> +
+ {@render field('Link', card.href || '', (href) => updateArray('items', i, { href }), '/page, #anchor or https://…')} + {@render field('Link text', card.linkLabel || '', (linkLabel) => updateArray('items', i, { linkLabel }), 'Optional, e.g. Read more')} +
+
+ {/each} + +

With a link, the whole card is clickable.

+
+ {:else if block.type === 'faq'} + {@render field('Heading', block.data.heading || '', (heading) => updateData({ heading }), 'Optional')} +
+ {#each block.data.items || [] as item, i} +
+
+ Question {i + 1} + + + +
+ updateArray('items', i, { question: e.currentTarget.value })} /> + updateArray('items', i, { answer })} /> +
+ {/each} + +

Visitors click a question to show its answer.

+
+ {:else if block.type === 'html'} + {/if}
+ + +
+ updateBackground({ type })} /> {#if block.data._background?.type === 'color'} diff --git a/app-admin/src/lib/admin/editors/RichTextEditor.svelte b/app-admin/src/lib/admin/editors/RichTextEditor.svelte index 99b7f73..7ac5cb4 100644 --- a/app-admin/src/lib/admin/editors/RichTextEditor.svelte +++ b/app-admin/src/lib/admin/editors/RichTextEditor.svelte @@ -1,78 +1,127 @@ -{#if mounted} -
-
- - - - - - - -
-
{ if (e.key === 'Tab') { e.preventDefault(); exec('insertHTML', ' '); } }} - >
+
+ -{:else} -
Loading editor…
-{/if} +
+ {#if !editor}
Loading editor…
{/if} +
+
diff --git a/app-admin/src/routes/api/import/+server.ts b/app-admin/src/routes/api/import/+server.ts index f50609a..160d63f 100644 --- a/app-admin/src/routes/api/import/+server.ts +++ b/app-admin/src/routes/api/import/+server.ts @@ -7,6 +7,8 @@ import { validateSiteExport, type SiteExport } from '$lib/exportImport'; +import { upgradeLegacyBlocks } from '$shared/richText'; +import type { ContentBlock } from '$lib/types'; export const POST: RequestHandler = async ({ request, locals }) => { let body: SiteExport; @@ -54,7 +56,8 @@ export const POST: RequestHandler = async ({ request, locals }) => { // 2. Import pages for (const page of body.pages) { try { - const blocks = restorePlaceholders(page.blocks, keyToUrl); + // Files exported before the visual editor may hold raw HTML in text blocks. + const blocks = upgradeLegacyBlocks(restorePlaceholders(page.blocks, keyToUrl) as ContentBlock[]); // Try to find existing page by slug let existing; diff --git a/app-public/src/app.css b/app-public/src/app.css index ac2fb7e..240aba2 100644 --- a/app-public/src/app.css +++ b/app-public/src/app.css @@ -99,6 +99,36 @@ h4 { padding-left: 1.5rem; } +/* The visual editor wraps list items in

. */ +.prose-wellness li > p { + margin: 0; +} + +.prose-wellness ol { + list-style: decimal; + padding-left: 1.5rem; +} + +/* Pull quote: a "Quote" in the visual editor. */ +.prose-wellness blockquote { + margin: 0.75rem 0; + padding-left: 1.25rem; + border-left: 3px solid var(--color-primary, #8a9a7b); + font-family: 'Playfair Display', Georgia, serif; + font-size: 1.35rem; + font-style: italic; +} + +.prose-wellness.text-center blockquote { + border-left: 0; + padding-left: 0; +} + +.prose-wellness hr { + margin: 2rem 0; + border-color: color-mix(in srgb, currentColor 20%, transparent); +} + .prose-wellness a { color: color-mix(in srgb, var(--color-primary, #8a9a7b) 90%, #000); text-decoration: underline; diff --git a/packages/shared/src/blocks/BackgroundWrapper.svelte b/packages/shared/src/blocks/BackgroundWrapper.svelte index d58a926..d670408 100644 --- a/packages/shared/src/blocks/BackgroundWrapper.svelte +++ b/packages/shared/src/blocks/BackgroundWrapper.svelte @@ -4,10 +4,13 @@ let { background = { type: 'none', color: '', imageUrl: '', attachment: 'scroll', overlay: false, overlayOpacity: 40 } satisfies BlockBackground, foreground = {} as BlockForeground, + anchor = '', children } = $props<{ background?: BlockBackground; foreground?: BlockForeground; + /** Block setting: lets links like "#prices" jump here. */ + anchor?: string; children?: import('svelte').Snippet; }>(); @@ -41,7 +44,8 @@ } -

+ +
{#if background.type === 'image' && background.overlay && background.imageUrl}
{#each blocks as block (block.id)} - + {#if block.type === 'text'} {:else if block.type === 'image_text'} @@ -49,6 +52,12 @@ {:else if block.type === 'checkout'} + {:else if block.type === 'cards'} + + {:else if block.type === 'faq'} + + {:else if block.type === 'html'} + {/if} {/each} diff --git a/packages/shared/src/blocks/CardsBlock.svelte b/packages/shared/src/blocks/CardsBlock.svelte new file mode 100644 index 0000000..6812e53 --- /dev/null +++ b/packages/shared/src/blocks/CardsBlock.svelte @@ -0,0 +1,54 @@ + + +
+ {#if data.heading || data.intro} +
+ {#if data.heading}

{data.heading}

{/if} + {#if data.intro}

{data.intro}

{/if} +
+ {/if} +
+ {#each data.items || [] as card, i (i)} + +
+ {#if !numbered && card.imageUrl} + {card.imageAlt + {/if} +
+ {#if numbered} + {i + 1} + {/if} + + + + {#if card.href}{card.title}{:else}{card.title}{/if} + + {#if card.subtitle}

{card.subtitle}

{/if} + {#if card.text}
{@html card.text}
{/if} + {#if card.href && card.linkLabel} +

{card.linkLabel}

+ {/if} +
+
+ {/each} +
+
+ + diff --git a/packages/shared/src/blocks/FaqBlock.svelte b/packages/shared/src/blocks/FaqBlock.svelte new file mode 100644 index 0000000..d5e27bc --- /dev/null +++ b/packages/shared/src/blocks/FaqBlock.svelte @@ -0,0 +1,21 @@ + + +
+
+ {#if data.heading}

{data.heading}

{/if} + {#each data.items || [] as item, i (i)} +
+ + {item.question} + + + {@html item.answer || ''} +
+ {/each} +
+
diff --git a/packages/shared/src/blocks/HtmlBlock.svelte b/packages/shared/src/blocks/HtmlBlock.svelte new file mode 100644 index 0000000..f9fc859 --- /dev/null +++ b/packages/shared/src/blocks/HtmlBlock.svelte @@ -0,0 +1,14 @@ + + + +
+
+ {@html data.html || ''} +
+
diff --git a/packages/shared/src/blocks/TextBlock.svelte b/packages/shared/src/blocks/TextBlock.svelte index 92fd79d..120a93a 100644 --- a/packages/shared/src/blocks/TextBlock.svelte +++ b/packages/shared/src/blocks/TextBlock.svelte @@ -1,11 +1,15 @@ -
-
+ +
+
{@html data.content || '

Welcome

Add warm, inviting copy in the CMS.

'}
diff --git a/packages/shared/src/richText.ts b/packages/shared/src/richText.ts new file mode 100644 index 0000000..4a39e46 --- /dev/null +++ b/packages/shared/src/richText.ts @@ -0,0 +1,46 @@ +import type { ContentBlock } from './types'; + +// Text blocks hold the HTML the admin's visual editor (Tiptap, see +// app-admin RichTextEditor.svelte) produces: these tags, and attributes only +// on links. Anything else (layouts, inline styles, embeds) belongs in an HTML +// block. Keep this list and the editor's extensions in step, and mirror changes +// in pocketbase/pb_migrations/1793300000_text_blocks_visual_editor.js. +const EDITOR_TAGS = new Set(['p', 'h2', 'h3', 'strong', 'b', 'em', 'i', 's', 'a', 'ul', 'ol', 'li', 'blockquote', 'br', 'hr']); +const LINK_ATTRS = new Set(['href', 'target', 'rel']); + +/** Whether `html` only uses what the visual editor can produce (so editing it loses nothing). */ +export function isEditorHtml(html: string): boolean { + for (const [, name, attrs] of html.matchAll(/<\/?([a-zA-Z][a-zA-Z0-9]*)([^>]*)>/g)) { + const tag = name.toLowerCase(); + if (!EDITOR_TAGS.has(tag)) return false; + for (const [, attr] of attrs.matchAll(/([a-zA-Z-]+)\s*=/g)) { + if (tag !== 'a' || !LINK_ATTRS.has(attr.toLowerCase())) return false; + } + } + return true; +} + +const CENTRED = /\s+style="text-align:\s*center;?"/gi; +const BLOCK_START = /<(p|h2|h3|ul|ol|blockquote)\b/gi; + +/** + * Text blocks written before the visual editor (raw HTML) become what they can + * be without losing anything: clean text (with `align: 'center'` when every + * paragraph and heading was centred), or else an HTML block that renders them + * exactly as before. Other blocks are returned unchanged. + */ +export function upgradeLegacyBlock(block: ContentBlock): ContentBlock { + if (block.type !== 'text') return block; + const { content = '', ...rest } = block.data; + if (isEditorHtml(content)) return block; + const centred = (content.match(CENTRED) || []).length; + const stripped = content.replace(CENTRED, ''); + if (centred && centred === (stripped.match(BLOCK_START) || []).length && isEditorHtml(stripped)) { + return { ...block, data: { ...rest, content: stripped, align: 'center' } }; + } + return { ...block, type: 'html', data: { ...rest, html: content } }; +} + +export function upgradeLegacyBlocks(blocks: ContentBlock[]): ContentBlock[] { + return Array.isArray(blocks) ? blocks.map(upgradeLegacyBlock) : blocks; +} diff --git a/packages/shared/src/types.ts b/packages/shared/src/types.ts index b5ad914..d4cc139 100644 --- a/packages/shared/src/types.ts +++ b/packages/shared/src/types.ts @@ -8,7 +8,10 @@ export type BlockType = | 'testimonials' | 'upcoming_calendar' | 'shop' - | 'checkout'; + | 'checkout' + | 'cards' + | 'faq' + | 'html'; export type BlockBackground = { type: 'none' | 'color' | 'image'; diff --git a/pocketbase/pb_migrations/1793300000_text_blocks_visual_editor.js b/pocketbase/pb_migrations/1793300000_text_blocks_visual_editor.js new file mode 100644 index 0000000..ab48b2f --- /dev/null +++ b/pocketbase/pb_migrations/1793300000_text_blocks_visual_editor.js @@ -0,0 +1,74 @@ +/// + +// Text blocks get a visual editor (Tiptap) that only produces simple HTML: +// paragraphs, h2/h3, bold, italic, strikethrough, links, lists, quotes, +// lines. Layouts that used to be written as HTML in a text block have their +// own blocks now (Cards, FAQ), and anything else goes in an `html` block. +// +// Existing text blocks the editor can't represent would be mangled the first +// time someone edits them, so they become `html` blocks (rendering exactly as +// before), except text that is simply centred everywhere: that becomes clean +// text with `align: 'center'`. Same rule as upgradeLegacyBlock() in +// packages/shared/src/richText.ts, which backup import uses; keep them alike. +// +// Data only (blocks is JSON); no schema change. + +const EDITOR_TAGS = ['p', 'h2', 'h3', 'strong', 'b', 'em', 'i', 's', 'a', 'ul', 'ol', 'li', 'blockquote', 'br', 'hr']; +const LINK_ATTRS = ['href', 'target', 'rel']; + +function isEditorHtml(html) { + const tags = /<\/?([a-zA-Z][a-zA-Z0-9]*)([^>]*)>/g; + let match; + while ((match = tags.exec(html))) { + const tag = match[1].toLowerCase(); + if (EDITOR_TAGS.indexOf(tag) < 0) return false; + const attrs = /([a-zA-Z-]+)\s*=/g; + let attr; + while ((attr = attrs.exec(match[2]))) { + if (tag !== 'a' || LINK_ATTRS.indexOf(attr[1].toLowerCase()) < 0) return false; + } + } + return true; +} + +function upgrade(block) { + if (!block || block.type !== 'text' || !block.data) return block; + const content = String(block.data.content || ''); + if (isEditorHtml(content)) return block; + const centredRe = /\s+style="text-align:\s*center;?"/gi; + const centred = (content.match(centredRe) || []).length; + const stripped = content.replace(centredRe, ''); + const starts = (stripped.match(/<(p|h2|h3|ul|ol|blockquote)\b/gi) || []).length; + const data = Object.assign({}, block.data); + delete data.content; + if (centred && centred === starts && isEditorHtml(stripped)) { + return Object.assign({}, block, { data: Object.assign(data, { content: stripped, align: 'center' }) }); + } + return Object.assign({}, block, { type: 'html', data: Object.assign(data, { html: content }) }); +} + +migrate( + (app) => { + let pages; + try { + pages = app.findAllRecords('pages'); + } catch (e) { + return; // fresh install: no pages yet + } + for (const page of pages) { + try { + const blocks = JSON.parse(page.getString('blocks') || '[]'); + if (!Array.isArray(blocks)) continue; + const upgraded = blocks.map(upgrade); + if (JSON.stringify(upgraded) === JSON.stringify(blocks)) continue; + page.set('blocks', upgraded); + app.saveNoValidate(page); + } catch (e) { + console.log(`[migration] could not upgrade the text blocks of page ${page.id}: ${e}`); + } + } + }, + () => { + // Nothing to undo: html blocks render the same HTML the text blocks had. + } +);