mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-11-28 23:50:08 +00:00
feat(studio): book themes with palette, font pairing and motif set
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { BookmarkMinus, BookmarkPlus, Copy, Ruler, Sparkles } from 'lucide-react';
|
||||
import { BookmarkMinus, BookmarkPlus, Copy, Palette, Ruler, Sparkles } from 'lucide-react';
|
||||
|
||||
import type { PackLook } from '../cardTypes';
|
||||
|
||||
@@ -19,6 +19,7 @@ export const BOOK_DESIGN_LOOK = {
|
||||
verbs: {
|
||||
designBook: { Icon: Sparkles, tone: 'info', labelKey: 'assistant.change.verb.designBook' },
|
||||
setBookSetup: { Icon: Ruler, tone: 'info', labelKey: 'assistant.change.verb.setBookSetup' },
|
||||
setBookTheme: { Icon: Palette, tone: 'info', labelKey: 'assistant.change.verb.setBookTheme' },
|
||||
duplicateBookPage: { Icon: Copy, tone: 'success', labelKey: 'assistant.change.verb.duplicateBookPage' },
|
||||
saveBookLayout: { Icon: BookmarkPlus, tone: 'success', labelKey: 'assistant.change.verb.saveBookLayout' },
|
||||
removeBookLayout: { Icon: BookmarkMinus, tone: 'danger', labelKey: 'assistant.change.verb.removeBookLayout' },
|
||||
|
||||
@@ -24,6 +24,19 @@ const STYLE_LOOK: Readonly<Record<BookDesignStyle, { labelKey: string }>> = {
|
||||
journal: { labelKey: 'assistant.card.bookDesign.style.journal' },
|
||||
bold: { labelKey: 'assistant.card.bookDesign.style.bold' },
|
||||
scrapbook: { labelKey: 'assistant.card.bookDesign.style.scrapbook' },
|
||||
// A design in one of the themes is called by the theme's own name.
|
||||
'poster-pop': { labelKey: 'studio.theme.name.posterPop' },
|
||||
cutout: { labelKey: 'studio.theme.name.cutout' },
|
||||
postcard: { labelKey: 'studio.theme.name.postcard' },
|
||||
riviera: { labelKey: 'studio.theme.name.riviera' },
|
||||
'fabric-classic': { labelKey: 'studio.theme.name.fabricClassic' },
|
||||
'minimal-serif': { labelKey: 'studio.theme.name.minimalSerif' },
|
||||
'grid-badge': { labelKey: 'studio.theme.name.gridBadge' },
|
||||
'scrapbook-script': { labelKey: 'studio.theme.name.scrapbookScript' },
|
||||
tropical: { labelKey: 'studio.theme.name.tropical' },
|
||||
nordic: { labelKey: 'studio.theme.name.nordic' },
|
||||
alpine: { labelKey: 'studio.theme.name.alpine' },
|
||||
'india-stamp': { labelKey: 'studio.theme.name.indiaStamp' },
|
||||
};
|
||||
|
||||
type Translate = (key: string, params?: Record<string, string | number>) => string;
|
||||
|
||||
@@ -13,7 +13,7 @@ import { StudioStickerInspector } from './StudioStickerInspector'
|
||||
import { Swatches } from './StudioSwatches'
|
||||
import { StudioBackgroundSection } from './StudioBackgroundSection'
|
||||
import { StudioShapePaint } from './StudioShapePaint'
|
||||
import { formatBookCoords } from '@trek/shared'
|
||||
import { formatBookCoords, withThemeLinks } from '@trek/shared'
|
||||
import { iconComponent, iconLabel, searchIcons } from './iconLibrary'
|
||||
import { Choice, Line, NumField, Section, Switch } from './StudioControls'
|
||||
import { StudioFontPicker } from './StudioFontPicker'
|
||||
@@ -26,6 +26,7 @@ import { StudioArrangeSection } from './StudioArrangeSection'
|
||||
import { selectionTitle } from './studioLayerRows'
|
||||
import { EdgeSection } from './StudioEdgeControls'
|
||||
import { LineInspector } from './StudioLineInspector'
|
||||
import { StudioThemeLink } from './theme/StudioThemeLink'
|
||||
|
||||
/** How many icons the swap grid offers at once. A search narrows it below this. */
|
||||
const ICON_CHOICES = 60
|
||||
@@ -202,7 +203,8 @@ export function StudioInspector({
|
||||
...d,
|
||||
spreads: d.spreads.map((sp, i) => (i !== spreadIndex ? sp : {
|
||||
...sp,
|
||||
elements: sp.elements.map(e => (selection.includes(e.id) ? ({ ...e, ...patch } as BookElement) : e)),
|
||||
// A colour or face set by hand stops following the theme; a link set here takes the theme's value.
|
||||
elements: sp.elements.map(e => (selection.includes(e.id) ? withThemeLinks({ ...e, ...patch } as BookElement, patch, d.theme) : e)),
|
||||
})),
|
||||
}))
|
||||
|
||||
@@ -390,6 +392,8 @@ export function StudioInspector({
|
||||
<Section label={t('journey.studio.colour')}>
|
||||
<Line label={t('journey.studio.text')} wide>
|
||||
<Swatches value={el.color} onPick={c => set({ color: c })} />
|
||||
<StudioThemeLink theme={doc?.theme} token={el.token} t={t}
|
||||
onLink={(token, color) => set({ color, token })} onUnlink={() => set({ token: undefined })} />
|
||||
</Line>
|
||||
</Section>
|
||||
</>
|
||||
@@ -543,6 +547,8 @@ export function StudioInspector({
|
||||
spreadIndex={spreadIndex}
|
||||
selection={selection}
|
||||
onStroke={c => set({ stroke: c, strokeWidth: el.strokeWidth || 0.5 })}
|
||||
theme={doc?.theme}
|
||||
set={set}
|
||||
t={t}
|
||||
/>
|
||||
|
||||
@@ -619,6 +625,8 @@ export function StudioInspector({
|
||||
<Section label={t('journey.studio.colour')}>
|
||||
<Line label={t('journey.studio.icon')} wide>
|
||||
<Swatches value={el.color} onPick={c => set({ color: c })} />
|
||||
<StudioThemeLink theme={doc?.theme} token={el.token} t={t}
|
||||
onLink={(token, color) => set({ color, token })} onUnlink={() => set({ token: undefined })} />
|
||||
</Line>
|
||||
<div style={{ marginTop: 10 }}>
|
||||
<NumField
|
||||
|
||||
@@ -1,9 +1,17 @@
|
||||
import { shapePaint, withShapePaint, type BookElement, type BookShapeElement } from '@trek/shared';
|
||||
import {
|
||||
shapePaint,
|
||||
withShapePaint,
|
||||
withThemeLinks,
|
||||
type BookElement,
|
||||
type BookShapeElement,
|
||||
type BookTheme,
|
||||
} from '@trek/shared';
|
||||
import { usePaintChannel } from './paint/usePaintChannel';
|
||||
import { Line, Section } from './StudioControls';
|
||||
import { StudioPaintPicker } from './StudioPaintPicker';
|
||||
import type { StudioT } from './StudioSidebar';
|
||||
import { Swatches } from './StudioSwatches';
|
||||
import { StudioThemeLink } from './theme/StudioThemeLink';
|
||||
|
||||
/** The outline a shape is given when its fill goes and it has none, so it never turns invisible. */
|
||||
const OUTLINE = '#141414';
|
||||
@@ -21,12 +29,18 @@ export function StudioShapePaint({
|
||||
spreadIndex,
|
||||
selection,
|
||||
onStroke,
|
||||
theme,
|
||||
set,
|
||||
t,
|
||||
}: {
|
||||
el: BookShapeElement;
|
||||
spreadIndex: number;
|
||||
selection: readonly string[];
|
||||
onStroke: (color: string) => void;
|
||||
/** The book's theme, for the theme colours under each row; none without one. */
|
||||
theme?: BookTheme;
|
||||
/** The inspector's write, for linking a colour to the theme. */
|
||||
set?: (patch: Partial<BookShapeElement>) => void;
|
||||
t: StudioT;
|
||||
}) {
|
||||
const channel = usePaintChannel((paint) => (doc) => ({
|
||||
@@ -38,7 +52,8 @@ export function StudioShapePaint({
|
||||
...sp,
|
||||
elements: sp.elements.map((e): BookElement => {
|
||||
if (e.kind !== 'shape' || !selection.includes(e.id)) return e;
|
||||
const painted = withShapePaint(e, paint);
|
||||
// A paint picked by hand stops the fill following the theme.
|
||||
const painted = withThemeLinks(withShapePaint(e, paint), { paint }, doc.theme);
|
||||
return paint === null && !e.stroke
|
||||
? { ...painted, stroke: OUTLINE, strokeWidth: e.strokeWidth || 0.5 }
|
||||
: painted;
|
||||
@@ -51,9 +66,27 @@ export function StudioShapePaint({
|
||||
<Section label={t('journey.studio.colour')}>
|
||||
<Line label={t('journey.studio.fill')} wide>
|
||||
<StudioPaintPicker value={shapePaint(el)} channel={channel} t={t} noneLabel={t('journey.studio.paint.none')} />
|
||||
{set && (
|
||||
<StudioThemeLink
|
||||
theme={theme}
|
||||
token={el.token}
|
||||
t={t}
|
||||
onLink={(token, fill) => set({ fill, token, paint: undefined })}
|
||||
onUnlink={() => set({ token: undefined })}
|
||||
/>
|
||||
)}
|
||||
</Line>
|
||||
<Line label={t('journey.studio.stroke')} wide>
|
||||
<Swatches value={el.stroke ?? OUTLINE} onPick={onStroke} />
|
||||
{set && (
|
||||
<StudioThemeLink
|
||||
theme={theme}
|
||||
token={el.strokeToken}
|
||||
t={t}
|
||||
onLink={(strokeToken, stroke) => set({ stroke, strokeToken, strokeWidth: el.strokeWidth || 0.5 })}
|
||||
onUnlink={() => set({ strokeToken: undefined })}
|
||||
/>
|
||||
)}
|
||||
</Line>
|
||||
</Section>
|
||||
);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { useEffect, useMemo, useRef, useState } from 'react'
|
||||
import {
|
||||
Camera, ChevronDown, ImagePlus, ChevronUp, Compass, Copy, FileDown, Files, ImageIcon, Layers, LayoutTemplate,
|
||||
Plus, Search, Shapes, Sticker, Trash2, Upload, X,
|
||||
Palette, Plus, Search, Shapes, Sticker, Trash2, Upload, X,
|
||||
} from 'lucide-react'
|
||||
import type { BookElement, BookPageSetup, JourneyStats } from '@trek/shared'
|
||||
import { useElementSize } from '../../hooks/useElementSize'
|
||||
@@ -24,6 +24,7 @@ import { StudioElementsPanel } from './StudioElementsPanel'
|
||||
import { StudioStickersPanel } from './StudioStickersPanel'
|
||||
import { StudioLayersPanel } from './StudioLayersPanel'
|
||||
import { StudioTravelPanel } from './StudioTravelPanel'
|
||||
import { StudioThemePanel } from './theme/StudioThemePanel'
|
||||
import { StudioSavedLayouts } from './StudioSavedLayouts'
|
||||
import { MAX_SPREAD_FILE_BYTES, importSpread } from './spreadFile'
|
||||
import { StudioContentFilter } from './StudioContentFilter'
|
||||
@@ -41,7 +42,7 @@ import type { StudioUploader } from './studioUpload'
|
||||
* costs 52px and gives the panel the room a photo browser actually needs.
|
||||
*/
|
||||
|
||||
type Section = 'pages' | 'content' | 'elements' | 'stickers' | 'travel' | 'templates' | 'layers'
|
||||
type Section = 'pages' | 'content' | 'elements' | 'stickers' | 'travel' | 'templates' | 'layers' | 'theme'
|
||||
|
||||
export interface JourneySource {
|
||||
entries: {
|
||||
@@ -124,6 +125,7 @@ export function StudioSidebar({
|
||||
{ id: 'travel', icon: Compass, labelKey: 'journey.studio.travel' },
|
||||
{ id: 'templates', icon: LayoutTemplate, labelKey: 'journey.studio.templates' },
|
||||
{ id: 'layers', icon: Layers, labelKey: 'journey.studio.layers' },
|
||||
{ id: 'theme', icon: Palette, labelKey: 'studio.theme.panel' },
|
||||
]
|
||||
|
||||
return (
|
||||
@@ -163,6 +165,7 @@ export function StudioSidebar({
|
||||
/>
|
||||
)}
|
||||
{section === 'layers' && <StudioLayersPanel t={t} />}
|
||||
{section === 'theme' && <StudioThemePanel t={t} />}
|
||||
{section === 'templates' && <TemplatesPanel page={page} pxPerMm={pxPerMm} t={t} onOpenContent={() => setSection('content')} />}
|
||||
</aside>
|
||||
</>
|
||||
|
||||
@@ -12,6 +12,8 @@ import { printDpi, tileView } from './mapTiles'
|
||||
import { useCartoApiKey } from '../../hooks/useTileUrl'
|
||||
import { Choice, Line, Picks, Section, Switch } from './StudioControls'
|
||||
import { fetchRoads } from './roadRoute'
|
||||
import { useStudioStore } from '../../store/studioStore'
|
||||
import { StudioThemeLink } from './theme/StudioThemeLink'
|
||||
|
||||
/**
|
||||
* Properties of the travel elements.
|
||||
@@ -40,6 +42,7 @@ interface Props<T> {
|
||||
}
|
||||
|
||||
export function TravelInspector({ el, stats, path, set, t }: TravelInspectorProps) {
|
||||
const theme = useStudioStore(s => s.doc?.theme)
|
||||
if (
|
||||
el.kind !== 'map' && el.kind !== 'stats' && el.kind !== 'countries'
|
||||
&& el.kind !== 'badge' && el.kind !== 'list'
|
||||
@@ -120,6 +123,9 @@ export function TravelInspector({ el, stats, path, set, t }: TravelInspectorProp
|
||||
<Section label={t('journey.studio.colour')}>
|
||||
<Line label={t('journey.studio.accent')} wide>
|
||||
<Swatches value={el.accent} onPick={c => set({ accent: c } as Partial<BookElement>)} />
|
||||
<StudioThemeLink theme={theme} token={el.accentToken} t={t}
|
||||
onLink={(accentToken, accent) => set({ accent, accentToken } as Partial<BookElement>)}
|
||||
onUnlink={() => set({ accentToken: undefined } as Partial<BookElement>)} />
|
||||
</Line>
|
||||
<Line label={t('journey.studio.text')} wide>
|
||||
{/*
|
||||
@@ -134,6 +140,11 @@ export function TravelInspector({ el, stats, path, set, t }: TravelInspectorProp
|
||||
(el.kind === 'badge' ? { color: c, autoColor: false } : { color: c }) as Partial<BookElement>,
|
||||
)}
|
||||
/>
|
||||
<StudioThemeLink theme={theme} token={el.token} t={t}
|
||||
onLink={(token, color) => set(
|
||||
(el.kind === 'badge' ? { color, token, autoColor: false } : { color, token }) as Partial<BookElement>,
|
||||
)}
|
||||
onUnlink={() => set({ token: undefined } as Partial<BookElement>)} />
|
||||
</Line>
|
||||
{el.kind === 'badge' && (
|
||||
<div style={{ marginTop: 10 }}>
|
||||
|
||||
@@ -0,0 +1,60 @@
|
||||
import { BOOK_COLOR_TOKENS, bookThemeColor, type BookColorToken, type BookTheme } from '@trek/shared';
|
||||
import { Unlink } from 'lucide-react';
|
||||
import '../../../styles/studio-theme.css';
|
||||
|
||||
/**
|
||||
* The book's theme colours under a colour's own swatches in the inspector.
|
||||
* Picking one sets the colour and links it, so the element follows the next
|
||||
* theme the book takes; the chain button unlinks it and keeps the colour. A
|
||||
* book without a theme shows nothing here.
|
||||
*/
|
||||
export function StudioThemeLink({
|
||||
theme,
|
||||
token,
|
||||
onLink,
|
||||
onUnlink,
|
||||
t,
|
||||
}: {
|
||||
theme: BookTheme | undefined;
|
||||
/** The token the colour follows now, if any. */
|
||||
token: BookColorToken | undefined;
|
||||
onLink: (token: BookColorToken, hex: string) => void;
|
||||
onUnlink: () => void;
|
||||
t: (k: string) => string;
|
||||
}) {
|
||||
if (!theme) return null;
|
||||
return (
|
||||
<div className="st-theme-link">
|
||||
<span className="st-theme-link-label">{t('studio.theme.linked')}</span>
|
||||
<div className="st-swatches">
|
||||
{BOOK_COLOR_TOKENS.map((key) => {
|
||||
const hex = bookThemeColor(theme, key);
|
||||
const name = t(`studio.theme.token.${key}`);
|
||||
return (
|
||||
<button
|
||||
type="button"
|
||||
key={key}
|
||||
className={`st-swatch ${token === key ? 'is-linked' : ''}`}
|
||||
style={{ background: hex }}
|
||||
title={name}
|
||||
aria-label={name}
|
||||
aria-pressed={token === key}
|
||||
onClick={() => onLink(key, hex)}
|
||||
/>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
{token && (
|
||||
<button
|
||||
type="button"
|
||||
className="st-theme-unlink"
|
||||
onClick={onUnlink}
|
||||
title={t('studio.theme.unlink')}
|
||||
aria-label={t('studio.theme.unlink')}
|
||||
>
|
||||
<Unlink size={13} />
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,259 @@
|
||||
import {
|
||||
BOOK_FONT_SLOTS,
|
||||
BOOK_PALETTE_KEYS,
|
||||
BOOK_THEME_DECORATIONS,
|
||||
BOOK_THEME_MOTIFS,
|
||||
BOOK_THEME_PRESETS,
|
||||
bookThemeOf,
|
||||
type BookFontSlot,
|
||||
type BookPaletteKey,
|
||||
type BookThemeFont,
|
||||
type BookThemePreset,
|
||||
} from '@trek/shared';
|
||||
import { Check, ImageIcon, RotateCcw } from 'lucide-react';
|
||||
import { useMemo } from 'react';
|
||||
import '../../../styles/studio-theme.css';
|
||||
import { useToast } from '../../shared/Toast';
|
||||
import { fontStack } from '../bookFonts';
|
||||
import { Choice, Line, Picks, Section, Switch } from '../StudioControls';
|
||||
import { StudioFontPicker } from '../StudioFontPicker';
|
||||
import { PanelHead } from '../StudioPanelHead';
|
||||
import type { StudioT } from '../StudioSidebar';
|
||||
import { useStudioTheme } from './useStudioTheme';
|
||||
|
||||
/**
|
||||
* The Theme section of the rail: twelve built-in looks, the palette, the
|
||||
* typefaces and the motifs of the one being put together, and applying it to
|
||||
* the book or to the page that is open.
|
||||
*
|
||||
* Nothing changes on the page until it is applied: picking a theme and
|
||||
* trying colours is a draft, so the panel can be played with freely, and an
|
||||
* apply is one undo step however many pages it recoloured.
|
||||
*/
|
||||
|
||||
/** One built-in theme as a card: its paper, its display face in its ink, its three accents. */
|
||||
function ThemeCard({
|
||||
preset,
|
||||
on,
|
||||
inUse,
|
||||
onPick,
|
||||
t,
|
||||
}: {
|
||||
preset: BookThemePreset;
|
||||
on: boolean;
|
||||
inUse: boolean;
|
||||
onPick: () => void;
|
||||
t: StudioT;
|
||||
}) {
|
||||
const display = useMemo(() => bookThemeOf(preset.id).fonts.display, [preset.id]);
|
||||
const { palette } = preset;
|
||||
return (
|
||||
<button
|
||||
type="button"
|
||||
className={`st-theme-card ${on ? 'is-on' : ''}`}
|
||||
aria-pressed={on}
|
||||
onClick={onPick}
|
||||
title={t(preset.descrKey)}
|
||||
>
|
||||
<span className="st-theme-sheet" style={{ background: palette.paper }}>
|
||||
<span
|
||||
className="st-theme-word"
|
||||
style={{
|
||||
fontFamily: fontStack(display.font),
|
||||
color: palette.ink,
|
||||
fontStyle: display.italic ? 'italic' : undefined,
|
||||
}}
|
||||
>
|
||||
Aa
|
||||
</span>
|
||||
<span className="st-theme-dots" aria-hidden>
|
||||
{[palette.accent, palette.accent2, palette.accent3].map((c, i) => (
|
||||
<span key={i} style={{ background: c }} />
|
||||
))}
|
||||
</span>
|
||||
</span>
|
||||
<span className="st-theme-name">
|
||||
<span>{t(preset.labelKey)}</span>
|
||||
{inUse && (
|
||||
<span className="st-theme-inuse" title={t('studio.theme.inUse')} aria-label={t('studio.theme.inUse')}>
|
||||
<Check size={12} strokeWidth={2.6} />
|
||||
</span>
|
||||
)}
|
||||
</span>
|
||||
</button>
|
||||
);
|
||||
}
|
||||
|
||||
/** One palette entry: its colour, which is the picker, and its name. */
|
||||
function PaletteEntry({
|
||||
name,
|
||||
hex,
|
||||
onPick,
|
||||
t,
|
||||
}: {
|
||||
name: BookPaletteKey;
|
||||
hex: string;
|
||||
onPick: (hex: string) => void;
|
||||
t: StudioT;
|
||||
}) {
|
||||
const label = t(`studio.theme.token.${name}`);
|
||||
return (
|
||||
<label className="st-theme-colour">
|
||||
<span className="st-theme-chip" style={{ background: hex }}>
|
||||
<input type="color" value={hex} aria-label={label} onChange={(e) => onPick(e.target.value)} />
|
||||
</span>
|
||||
<span className="st-theme-colour-name">{label}</span>
|
||||
</label>
|
||||
);
|
||||
}
|
||||
|
||||
/** The script a theme falls back to when one is switched on: the handwriting most themes pair with. */
|
||||
const DEFAULT_SCRIPT = 'caveat';
|
||||
|
||||
/**
|
||||
* One typeface slot, in the Studio's own font picker. The script can be
|
||||
* switched off, since a calm theme sets no handwriting at all.
|
||||
*/
|
||||
function FontSlot({
|
||||
slot,
|
||||
face,
|
||||
onPick,
|
||||
t,
|
||||
}: {
|
||||
slot: BookFontSlot;
|
||||
face: BookThemeFont | null;
|
||||
onPick: (font: string | null, weight?: number) => void;
|
||||
t: StudioT;
|
||||
}) {
|
||||
const label = t(`studio.theme.slot.${slot}`);
|
||||
const picker = face && (
|
||||
<StudioFontPicker font={face.font} weight={face.weight ?? 400} onPick={(p) => onPick(p.font, p.weight)} t={t} />
|
||||
);
|
||||
if (slot !== 'script')
|
||||
return (
|
||||
<Line label={label} wide>
|
||||
{picker}
|
||||
</Line>
|
||||
);
|
||||
return (
|
||||
<div className="st-theme-script">
|
||||
<Switch label={label} on={!!face} onToggle={() => onPick(face ? null : DEFAULT_SCRIPT)} />
|
||||
{picker ?? <p className="st-hint">{t('studio.theme.noScript')}</p>}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export function StudioThemePanel({ t }: { t: StudioT }) {
|
||||
const theme = useStudioTheme();
|
||||
const toast = useToast();
|
||||
const { draft } = theme;
|
||||
|
||||
const apply = (scope: 'book' | 'page') => {
|
||||
const done = theme.apply(scope);
|
||||
if (!done) return;
|
||||
if (done.pages > 0) toast.success(t('studio.theme.applied'));
|
||||
else toast.info(t('studio.theme.nothing'));
|
||||
};
|
||||
|
||||
const fromPhotos = async () => {
|
||||
if (!(await theme.fromPhotos())) toast.info(t('studio.theme.noPhotoColours'));
|
||||
};
|
||||
|
||||
return (
|
||||
<>
|
||||
<PanelHead label={t('studio.theme.panel')} />
|
||||
<div className="st-panel-scroll st-theme">
|
||||
<p className="st-hint">{t('studio.theme.intro')}</p>
|
||||
|
||||
<div className="st-section-label">{t('studio.theme.themes')}</div>
|
||||
<div className="st-theme-grid">
|
||||
{BOOK_THEME_PRESETS.map((preset) => (
|
||||
<ThemeCard
|
||||
key={preset.id}
|
||||
preset={preset}
|
||||
on={draft.id === preset.id}
|
||||
inUse={theme.current?.id === preset.id}
|
||||
onPick={() => theme.pick(preset.id)}
|
||||
t={t}
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
|
||||
{theme.edited && (
|
||||
<button type="button" className="st-theme-reset" onClick={theme.reset}>
|
||||
<RotateCcw size={13} />
|
||||
{t('studio.theme.reset')}
|
||||
</button>
|
||||
)}
|
||||
|
||||
<Section label={t('studio.theme.palette')}>
|
||||
<div className="st-theme-palette">
|
||||
{BOOK_PALETTE_KEYS.map((key) => (
|
||||
<PaletteEntry
|
||||
key={key}
|
||||
name={key}
|
||||
hex={draft.palette[key]}
|
||||
onPick={(hex) => theme.setColour(key, hex)}
|
||||
t={t}
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
<button
|
||||
type="button"
|
||||
className="st-theme-photos"
|
||||
onClick={() => void fromPhotos()}
|
||||
disabled={!theme.hasPhotos || theme.reading}
|
||||
>
|
||||
<ImageIcon size={14} />
|
||||
{t('studio.theme.fromPhotos')}
|
||||
</button>
|
||||
</Section>
|
||||
|
||||
<Section label={t('studio.theme.fonts')}>
|
||||
{BOOK_FONT_SLOTS.map((slot) => (
|
||||
<FontSlot
|
||||
key={slot}
|
||||
slot={slot}
|
||||
face={draft.fonts[slot]}
|
||||
onPick={(font, weight) => theme.setFont(slot, font, weight)}
|
||||
t={t}
|
||||
/>
|
||||
))}
|
||||
</Section>
|
||||
|
||||
<Section label={t('studio.theme.motifs')} hint={t('studio.theme.motifsHint')} defaultOpen={false}>
|
||||
<Picks
|
||||
value={draft.motifs}
|
||||
options={BOOK_THEME_MOTIFS.map((m) => ({ value: m, label: t(`studio.theme.motif.${m}`) }))}
|
||||
onToggle={theme.toggleMotif}
|
||||
/>
|
||||
</Section>
|
||||
|
||||
<Section label={t('studio.theme.decoration')} defaultOpen={false}>
|
||||
<Choice
|
||||
value={draft.decoration}
|
||||
options={BOOK_THEME_DECORATIONS.map((d) => ({ value: d, label: t(`studio.theme.decoration.${d}`) }))}
|
||||
onPick={theme.setDecoration}
|
||||
ariaLabel={t('studio.theme.decoration')}
|
||||
/>
|
||||
</Section>
|
||||
|
||||
<div className="st-theme-apply">
|
||||
<Switch label={t('studio.theme.adopt')} on={theme.adopt} onToggle={() => theme.setAdopt(!theme.adopt)} />
|
||||
<p className="st-hint">{t('studio.theme.adoptHint')}</p>
|
||||
<button
|
||||
type="button"
|
||||
className="st-theme-btn is-primary"
|
||||
onClick={() => apply('book')}
|
||||
disabled={!theme.canApply}
|
||||
>
|
||||
{t('studio.theme.applyBook')}
|
||||
</button>
|
||||
<button type="button" className="st-theme-btn" onClick={() => apply('page')} disabled={!theme.canApply}>
|
||||
{t('studio.theme.applyPage')}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
import type { BookDocument, PaletteSwatch } from '@trek/shared';
|
||||
|
||||
/**
|
||||
* The colours of the book's photographs, for "palette from photos".
|
||||
*
|
||||
* Read in the browser from the thumbnails the Studio already shows: each one
|
||||
* is drawn 24 pixels across onto a canvas that never reaches the page, its
|
||||
* pixels are put into coarse buckets, and the fullest buckets are the photo's
|
||||
* swatches. The shared engine clusters them across photos and picks the
|
||||
* accents (bookPaletteFromPhotos), so the choice itself is the same one the
|
||||
* assistant's design makes from a photo palette.
|
||||
*/
|
||||
|
||||
/** The side of the sample drawn from each photo. */
|
||||
const SAMPLE = 24;
|
||||
/** How many photos are read at most: enough for a book's character, few enough to be instant. */
|
||||
const MAX_THEME_PHOTOS = 12;
|
||||
/** How many swatches one photo gives. */
|
||||
const PER_PHOTO = 6;
|
||||
|
||||
const toHex = (r: number, g: number, b: number) =>
|
||||
`#${[r, g, b]
|
||||
.map((v) =>
|
||||
Math.max(0, Math.min(255, Math.round(v)))
|
||||
.toString(16)
|
||||
.padStart(2, '0')
|
||||
)
|
||||
.join('')}`;
|
||||
|
||||
/**
|
||||
* The swatches of an RGBA buffer: the pixels grouped by their top four bits a
|
||||
* channel, each group's mean colour and its share of the opaque pixels.
|
||||
*/
|
||||
export function swatchesFromPixels(data: ArrayLike<number>): PaletteSwatch[] {
|
||||
const buckets = new Map<number, { r: number; g: number; b: number; n: number }>();
|
||||
let total = 0;
|
||||
for (let i = 0; i + 3 < data.length; i += 4) {
|
||||
if ((data[i + 3] ?? 0) < 128) continue;
|
||||
const r = data[i] ?? 0;
|
||||
const g = data[i + 1] ?? 0;
|
||||
const b = data[i + 2] ?? 0;
|
||||
const key = ((r >> 4) << 8) | ((g >> 4) << 4) | (b >> 4);
|
||||
const bucket = buckets.get(key) ?? { r: 0, g: 0, b: 0, n: 0 };
|
||||
bucket.r += r;
|
||||
bucket.g += g;
|
||||
bucket.b += b;
|
||||
bucket.n += 1;
|
||||
buckets.set(key, bucket);
|
||||
total += 1;
|
||||
}
|
||||
if (!total) return [];
|
||||
return [...buckets.values()]
|
||||
.sort((a, b) => b.n - a.n)
|
||||
.slice(0, PER_PHOTO)
|
||||
.map((c) => ({ hex: toHex(c.r / c.n, c.g / c.n, c.b / c.n), share: c.n / total }));
|
||||
}
|
||||
|
||||
/** The photo ids a book shows, placed first, each once, at most MAX_THEME_PHOTOS. */
|
||||
export function bookPhotoIds(doc: BookDocument | null): number[] {
|
||||
const ids = (doc?.spreads ?? []).flatMap((s) =>
|
||||
s.elements.flatMap((e) => (e.kind === 'photo' && e.photoId != null ? [e.photoId] : []))
|
||||
);
|
||||
return [...new Set(ids)].slice(0, MAX_THEME_PHOTOS);
|
||||
}
|
||||
|
||||
/** One photo's swatches, or none when it cannot be read (gone, refused, still loading when aborted). */
|
||||
export async function readPhotoSwatches(src: string, signal?: AbortSignal): Promise<PaletteSwatch[]> {
|
||||
try {
|
||||
const img = new Image();
|
||||
img.decoding = 'async';
|
||||
img.src = src;
|
||||
await img.decode();
|
||||
if (signal?.aborted) return [];
|
||||
const canvas = document.createElement('canvas');
|
||||
canvas.width = SAMPLE;
|
||||
canvas.height = SAMPLE;
|
||||
const ctx = canvas.getContext('2d', { willReadFrequently: true });
|
||||
if (!ctx) return [];
|
||||
ctx.drawImage(img, 0, 0, SAMPLE, SAMPLE);
|
||||
return swatchesFromPixels(ctx.getImageData(0, 0, SAMPLE, SAMPLE).data);
|
||||
} catch {
|
||||
// A photo that will not load or will not be read gives no colours; the others still do.
|
||||
return [];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,144 @@
|
||||
import {
|
||||
BOOK_THEME_IDS,
|
||||
bookPaletteFromPhotos,
|
||||
bookThemeOf,
|
||||
setBookTheme,
|
||||
type BookFontSlot,
|
||||
type BookPaletteKey,
|
||||
type BookTheme,
|
||||
type BookThemeDecoration,
|
||||
type BookThemeId,
|
||||
type BookThemeMotif,
|
||||
type SetBookThemeRequest,
|
||||
} from '@trek/shared';
|
||||
import { useCallback, useMemo, useState } from 'react';
|
||||
import { useStudioStore } from '../../../store/studioStore';
|
||||
import { photoSrc } from '../bookRender';
|
||||
import { bookPhotoIds, readPhotoSwatches } from './themePhotoColours';
|
||||
|
||||
/**
|
||||
* The Theme panel's state: the theme being put together (a draft, so trying
|
||||
* colours costs nothing until it is applied), and applying it through the
|
||||
* same `setBookTheme` the assistant's `set_book_theme` runs, so the panel and
|
||||
* the assistant cannot recolour a book two different ways.
|
||||
*/
|
||||
|
||||
/** What an apply did: how many pages changed, or null when the book refused it (read-only, no book). */
|
||||
type ThemeApplyResult = { pages: number } | null;
|
||||
|
||||
/** The theme a book without one starts the panel on: the first of the list. */
|
||||
const firstTheme = (): BookTheme => bookThemeOf(BOOK_THEME_IDS[0]);
|
||||
|
||||
/** The draft as `set_book_theme` takes it: the whole of it, so the result is exactly what the panel shows. */
|
||||
export function themeRequest(draft: BookTheme, spreadIds: string[] | undefined, adopt: boolean): SetBookThemeRequest {
|
||||
return {
|
||||
...(draft.id ? { theme: draft.id } : {}),
|
||||
palette: { ...draft.palette },
|
||||
fonts: { ...draft.fonts },
|
||||
motifs: [...draft.motifs],
|
||||
decoration: draft.decoration,
|
||||
...(spreadIds ? { spreadIds } : {}),
|
||||
adopt,
|
||||
};
|
||||
}
|
||||
|
||||
/** Whether a draft differs from the built-in theme it is named after. */
|
||||
export function isEdited(draft: BookTheme): boolean {
|
||||
if (!draft.id) return false;
|
||||
return JSON.stringify(draft) !== JSON.stringify(bookThemeOf(draft.id));
|
||||
}
|
||||
|
||||
export function useStudioTheme() {
|
||||
const doc = useStudioStore((s) => s.doc);
|
||||
const active = useStudioStore((s) => s.activeSpread);
|
||||
const readOnly = useStudioStore((s) => s.readOnly);
|
||||
const commit = useStudioStore((s) => s.commit);
|
||||
const current = doc?.theme;
|
||||
|
||||
const [draft, setDraft] = useState<BookTheme>(() => current ?? firstTheme());
|
||||
const [adopt, setAdopt] = useState(true);
|
||||
const [reading, setReading] = useState(false);
|
||||
|
||||
// The book's theme changed under the panel (applied, undone, another editor): the draft follows it,
|
||||
// set while rendering rather than in an effect, so the panel never paints the old draft first.
|
||||
const [seen, setSeen] = useState(current);
|
||||
if (seen !== current) {
|
||||
setSeen(current);
|
||||
if (current) setDraft(current);
|
||||
}
|
||||
|
||||
const pick = useCallback((id: BookThemeId) => setDraft(bookThemeOf(id)), []);
|
||||
const setColour = useCallback(
|
||||
(key: BookPaletteKey, hex: string) => setDraft((d) => ({ ...d, palette: { ...d.palette, [key]: hex } })),
|
||||
[]
|
||||
);
|
||||
const setFont = useCallback(
|
||||
(slot: BookFontSlot, font: string | null, weight?: number) =>
|
||||
setDraft((d) => {
|
||||
if (font === null) return slot === 'script' ? { ...d, fonts: { ...d.fonts, script: null } } : d;
|
||||
// A family picked by hand is set upright, at the weight the picker snapped to that family.
|
||||
return { ...d, fonts: { ...d.fonts, [slot]: weight === undefined ? { font } : { font, weight } } };
|
||||
}),
|
||||
[]
|
||||
);
|
||||
const toggleMotif = useCallback(
|
||||
(motif: BookThemeMotif) =>
|
||||
setDraft((d) => ({
|
||||
...d,
|
||||
motifs: d.motifs.includes(motif) ? d.motifs.filter((m) => m !== motif) : [...d.motifs, motif],
|
||||
})),
|
||||
[]
|
||||
);
|
||||
const setDecoration = useCallback((decoration: BookThemeDecoration) => setDraft((d) => ({ ...d, decoration })), []);
|
||||
const reset = useCallback(() => setDraft((d) => (d.id ? bookThemeOf(d.id) : d)), []);
|
||||
|
||||
const photoIds = useMemo(() => bookPhotoIds(doc), [doc]);
|
||||
|
||||
/** Accents from the book's photos. Resolves false when the photos give no colour to take. */
|
||||
const fromPhotos = useCallback(async (): Promise<boolean> => {
|
||||
setReading(true);
|
||||
try {
|
||||
const swatches = await Promise.all(photoIds.map((id) => readPhotoSwatches(photoSrc(id, false))));
|
||||
const palette = bookPaletteFromPhotos(draft.palette, swatches);
|
||||
if (palette) setDraft((d) => ({ ...d, palette }));
|
||||
return palette !== null;
|
||||
} finally {
|
||||
setReading(false);
|
||||
}
|
||||
}, [photoIds, draft.palette]);
|
||||
|
||||
const apply = useCallback(
|
||||
(scope: 'book' | 'page'): ThemeApplyResult => {
|
||||
const spread = doc?.spreads[active];
|
||||
if (!doc || readOnly || (scope === 'page' && !spread)) return null;
|
||||
let result: ThemeApplyResult = null;
|
||||
commit((d) => {
|
||||
const made = setBookTheme(d, themeRequest(draft, scope === 'page' && spread ? [spread.id] : undefined, adopt));
|
||||
if (!made.ok) return d;
|
||||
result = { pages: made.spreadIds.length };
|
||||
return made.doc;
|
||||
});
|
||||
return result;
|
||||
},
|
||||
[doc, active, readOnly, commit, draft, adopt]
|
||||
);
|
||||
|
||||
return {
|
||||
draft,
|
||||
current,
|
||||
edited: isEdited(draft),
|
||||
adopt,
|
||||
setAdopt,
|
||||
reading,
|
||||
hasPhotos: photoIds.length > 0,
|
||||
canApply: !!doc && !readOnly,
|
||||
pick,
|
||||
setColour,
|
||||
setFont,
|
||||
toggleMotif,
|
||||
setDecoration,
|
||||
reset,
|
||||
fromPhotos,
|
||||
apply,
|
||||
};
|
||||
}
|
||||
@@ -3,6 +3,7 @@ import type { BookDocument, BookElement, BookFrame, BookLayout, BookSpread } fro
|
||||
import {
|
||||
MAX_BOOK_LAYOUTS, MAX_SPREAD_ELEMENTS, applySavedBookLayout as applySavedLayout,
|
||||
bookLayoutFromSpread as layoutFromSpread, canEditSpread as isMovableSpread, innerSpreadBounds as innerBounds,
|
||||
withThemeLinks,
|
||||
} from '@trek/shared'
|
||||
import { pastedElements, type StudioClipboard } from '../components/Studio/studioClipboard'
|
||||
import { regroupCopies, tidyGroups, withCopies, bookElementId } from '@trek/shared'
|
||||
@@ -203,10 +204,11 @@ export const useStudioStore = create<StudioState>((set, get) => ({
|
||||
|
||||
apply: fn => set(s => (s.doc && !s.readOnly ? { doc: fn(s.doc) } : {})),
|
||||
|
||||
// A colour or face set by hand stops following the theme; a link set here takes the theme's value.
|
||||
updateElement: (spreadIndex, id, patch) => get().apply(doc =>
|
||||
replaceSpread(doc, spreadIndex, sp => ({
|
||||
...sp,
|
||||
elements: sp.elements.map(e => (e.id === id ? ({ ...e, ...patch } as BookElement) : e)),
|
||||
elements: sp.elements.map(e => (e.id === id ? withThemeLinks({ ...e, ...patch } as BookElement, patch, doc.theme) : e)),
|
||||
}))),
|
||||
|
||||
setFrame: (spreadIndex, id, frame) => get().apply(doc =>
|
||||
|
||||
@@ -0,0 +1,267 @@
|
||||
/* ============================================================================
|
||||
TREK Studio: the Theme panel and the inspector's theme colour row.
|
||||
|
||||
Scoped under `.trek-dash` like every Studio rule (see the head of
|
||||
studio.css for why), and drawn in the dashboard tokens. The only colours
|
||||
that are not tokens are the themes' own, set inline from the data: a theme
|
||||
card shows its paper, ink and accents because that is what it offers.
|
||||
============================================================================ */
|
||||
|
||||
.trek-dash .st-theme-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
gap: 8px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.trek-dash .st-theme-card {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 6px;
|
||||
padding: 5px;
|
||||
border-radius: 12px;
|
||||
border: 1px solid var(--line-2);
|
||||
background: var(--surface);
|
||||
text-align: start;
|
||||
transition:
|
||||
border-color 0.16s,
|
||||
box-shadow 0.16s,
|
||||
transform 0.16s;
|
||||
}
|
||||
.trek-dash .st-theme-card:hover {
|
||||
border-color: color-mix(in oklch, var(--accent) 45%, var(--line-2));
|
||||
}
|
||||
.trek-dash .st-theme-card:active {
|
||||
transform: scale(0.98);
|
||||
}
|
||||
.trek-dash .st-theme-card.is-on {
|
||||
border-color: var(--accent);
|
||||
box-shadow: 0 0 0 1px var(--accent);
|
||||
}
|
||||
.trek-dash .st-theme-card:focus {
|
||||
outline: none;
|
||||
}
|
||||
.trek-dash .st-theme-card:focus-visible {
|
||||
box-shadow:
|
||||
0 0 0 2px var(--accent-soft),
|
||||
0 0 0 3px var(--accent);
|
||||
}
|
||||
|
||||
/* The theme's own paper, as a little page. Flat like every sheet in Studio. */
|
||||
.trek-dash .st-theme-sheet {
|
||||
position: relative;
|
||||
display: flex;
|
||||
align-items: flex-end;
|
||||
justify-content: space-between;
|
||||
gap: 6px;
|
||||
height: 58px;
|
||||
padding: 7px 8px;
|
||||
border-radius: 8px;
|
||||
box-shadow: inset 0 0 0 1px color-mix(in oklch, var(--ink) 8%, transparent);
|
||||
overflow: hidden;
|
||||
}
|
||||
.trek-dash .st-theme-word {
|
||||
font-size: 26px;
|
||||
line-height: 1;
|
||||
letter-spacing: -0.01em;
|
||||
}
|
||||
.trek-dash .st-theme-dots {
|
||||
display: flex;
|
||||
gap: 3px;
|
||||
padding-bottom: 2px;
|
||||
}
|
||||
.trek-dash .st-theme-dots > span {
|
||||
width: 11px;
|
||||
height: 11px;
|
||||
border-radius: 999px;
|
||||
box-shadow: inset 0 0 0 1px color-mix(in oklch, var(--ink) 12%, transparent);
|
||||
}
|
||||
|
||||
.trek-dash .st-theme-name {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 4px;
|
||||
min-width: 0;
|
||||
padding: 0 3px 2px;
|
||||
font-size: 11.5px;
|
||||
font-weight: 600;
|
||||
color: var(--ink-2);
|
||||
}
|
||||
.trek-dash .st-theme-name > span:first-child {
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.trek-dash .st-theme-inuse {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
flex: none;
|
||||
width: 18px;
|
||||
height: 18px;
|
||||
border-radius: 999px;
|
||||
background: var(--accent);
|
||||
color: var(--accent-text, #fff);
|
||||
}
|
||||
|
||||
.trek-dash .st-theme-reset {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
margin: 0 0 4px;
|
||||
padding: 4px 2px;
|
||||
font-size: 12px;
|
||||
font-weight: 500;
|
||||
color: var(--ink-3);
|
||||
transition: color 0.14s;
|
||||
}
|
||||
.trek-dash .st-theme-reset:hover {
|
||||
color: var(--ink);
|
||||
}
|
||||
|
||||
.trek-dash .st-theme-palette {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(5, minmax(0, 1fr));
|
||||
gap: 6px;
|
||||
}
|
||||
.trek-dash .st-theme-colour {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
gap: 5px;
|
||||
min-width: 0;
|
||||
cursor: pointer;
|
||||
}
|
||||
.trek-dash .st-theme-chip {
|
||||
position: relative;
|
||||
width: 100%;
|
||||
aspect-ratio: 1;
|
||||
border-radius: 8px;
|
||||
border: 1px solid var(--line-2);
|
||||
box-shadow: var(--sh-xs);
|
||||
overflow: hidden;
|
||||
transition: transform 0.14s;
|
||||
}
|
||||
.trek-dash .st-theme-colour:hover .st-theme-chip {
|
||||
transform: scale(1.05);
|
||||
}
|
||||
.trek-dash .st-theme-chip input {
|
||||
position: absolute;
|
||||
inset: -6px;
|
||||
opacity: 0;
|
||||
cursor: pointer;
|
||||
}
|
||||
.trek-dash .st-theme-colour-name {
|
||||
max-width: 100%;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
font-size: 10.5px;
|
||||
color: var(--ink-3);
|
||||
}
|
||||
|
||||
.trek-dash .st-theme-photos,
|
||||
.trek-dash .st-theme-btn {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 6px;
|
||||
width: 100%;
|
||||
height: 32px;
|
||||
border-radius: 8px;
|
||||
font-size: 12px;
|
||||
font-weight: 600;
|
||||
transition:
|
||||
background 0.16s,
|
||||
color 0.16s,
|
||||
border-color 0.16s,
|
||||
opacity 0.16s;
|
||||
}
|
||||
.trek-dash .st-theme-photos {
|
||||
margin-top: 10px;
|
||||
border: 1px dashed var(--line-2);
|
||||
color: var(--ink-3);
|
||||
}
|
||||
.trek-dash .st-theme-photos:hover:not(:disabled) {
|
||||
background: var(--surface);
|
||||
border-color: color-mix(in oklch, var(--accent) 45%, var(--line-2));
|
||||
color: var(--ink);
|
||||
}
|
||||
.trek-dash .st-theme-photos:disabled,
|
||||
.trek-dash .st-theme-btn:disabled {
|
||||
opacity: 0.45;
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
.trek-dash .st-theme-script {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 6px;
|
||||
margin-top: 6px;
|
||||
}
|
||||
.trek-dash .st-theme-script .st-hint {
|
||||
padding: 0 2px;
|
||||
}
|
||||
|
||||
.trek-dash .st-theme-apply {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 8px;
|
||||
margin-top: 6px;
|
||||
padding-top: 12px;
|
||||
border-top: 1px solid var(--line-2);
|
||||
}
|
||||
.trek-dash .st-theme-apply .st-hint {
|
||||
padding: 0 2px;
|
||||
margin-top: -4px;
|
||||
}
|
||||
.trek-dash .st-theme-btn {
|
||||
border: 1px solid var(--line-2);
|
||||
background: var(--surface);
|
||||
color: var(--ink);
|
||||
}
|
||||
.trek-dash .st-theme-btn:hover:not(:disabled) {
|
||||
border-color: color-mix(in oklch, var(--accent) 45%, var(--line-2));
|
||||
}
|
||||
.trek-dash .st-theme-btn.is-primary {
|
||||
border-color: transparent;
|
||||
background: var(--accent);
|
||||
color: var(--accent-text, #fff);
|
||||
}
|
||||
.trek-dash .st-theme-btn.is-primary:hover:not(:disabled) {
|
||||
background: color-mix(in oklch, var(--accent) 88%, var(--ink));
|
||||
}
|
||||
|
||||
/* The inspector's row of theme colours, under a colour's own swatches. */
|
||||
.trek-dash .st-theme-link {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
gap: 4px;
|
||||
margin-top: 8px;
|
||||
}
|
||||
.trek-dash .st-theme-link-label {
|
||||
flex-basis: 100%;
|
||||
font-size: 11px;
|
||||
color: var(--ink-3);
|
||||
}
|
||||
.trek-dash .st-theme-link .st-swatch.is-linked {
|
||||
box-shadow: 0 0 0 2px var(--accent);
|
||||
}
|
||||
.trek-dash .st-theme-unlink {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 22px;
|
||||
height: 22px;
|
||||
border-radius: 7px;
|
||||
color: var(--ink-3);
|
||||
transition:
|
||||
background 0.14s,
|
||||
color 0.14s;
|
||||
}
|
||||
.trek-dash .st-theme-unlink:hover {
|
||||
background: color-mix(in oklch, var(--ink) 8%, transparent);
|
||||
color: var(--ink);
|
||||
}
|
||||
@@ -0,0 +1,232 @@
|
||||
import { act, renderHook } from '@testing-library/react';
|
||||
import type { BookDocument, BookElement } from '@trek/shared';
|
||||
import { bookPageSetupSchema, bookTextElementSchema, bookThemeOf } from '@trek/shared';
|
||||
import { beforeEach, describe, expect, it, vi } from 'vitest';
|
||||
import { StudioThemeLink } from '../../../src/components/Studio/theme/StudioThemeLink';
|
||||
import { StudioThemePanel } from '../../../src/components/Studio/theme/StudioThemePanel';
|
||||
import * as photoColours from '../../../src/components/Studio/theme/themePhotoColours';
|
||||
import { isEdited, themeRequest, useStudioTheme } from '../../../src/components/Studio/theme/useStudioTheme';
|
||||
import { useStudioStore } from '../../../src/store/studioStore';
|
||||
import { fireEvent, render, screen } from '../../helpers/render';
|
||||
|
||||
vi.mock('../../../src/components/Studio/theme/themePhotoColours', async (importOriginal) => ({
|
||||
...(await importOriginal<typeof import('../../../src/components/Studio/theme/themePhotoColours')>()),
|
||||
readPhotoSwatches: vi.fn(async () => []),
|
||||
}));
|
||||
|
||||
/**
|
||||
* The Theme panel and the inspector's theme colours (WP7): a draft that
|
||||
* changes nothing until it is applied, an apply through the one engine the
|
||||
* assistant uses, and links that a colour picked by hand takes away.
|
||||
*/
|
||||
|
||||
const FRAME = { x: 20, y: 30, w: 60, h: 40 };
|
||||
const t = (k: string) => k;
|
||||
|
||||
const text = (over: Record<string, unknown> = {}): BookElement =>
|
||||
bookTextElementSchema.parse({
|
||||
id: 't1',
|
||||
kind: 'text',
|
||||
frame: FRAME,
|
||||
text: 'Harbour',
|
||||
color: '#1a1a1a',
|
||||
...over,
|
||||
}) as BookElement;
|
||||
|
||||
function load(elements: BookElement[] = [text()], extra: Partial<BookDocument> = {}) {
|
||||
useStudioStore.getState().load({
|
||||
version: 1,
|
||||
title: 'T',
|
||||
page: bookPageSetupSchema.parse({}),
|
||||
spreads: [
|
||||
{ id: 'sp1', role: 'inner', background: null, elements, parked: [], entryId: null },
|
||||
{ id: 'sp2', role: 'inner', background: null, elements: [text({ id: 't2' })], parked: [], entryId: null },
|
||||
],
|
||||
...extra,
|
||||
} as BookDocument);
|
||||
useStudioStore.getState().setReadOnly(false);
|
||||
}
|
||||
|
||||
const doc = () => useStudioStore.getState().doc as BookDocument;
|
||||
const toast = vi.hoisted(() => ({ success: vi.fn(), info: vi.fn(), error: vi.fn(), warning: vi.fn() }));
|
||||
vi.mock('../../../src/components/shared/Toast', () => ({ useToast: () => toast }));
|
||||
|
||||
beforeEach(() => {
|
||||
load();
|
||||
vi.clearAllMocks();
|
||||
});
|
||||
|
||||
describe('the theme draft', () => {
|
||||
it('FE-STUDIO-THEME-001: starts on the first theme, or on the book own one', () => {
|
||||
const { result } = renderHook(() => useStudioTheme());
|
||||
expect(result.current.draft.id).toBe('poster-pop');
|
||||
expect(result.current.current).toBeUndefined();
|
||||
load([text()], { theme: bookThemeOf('nordic') });
|
||||
const again = renderHook(() => useStudioTheme());
|
||||
expect(again.result.current.draft.id).toBe('nordic');
|
||||
});
|
||||
|
||||
it('FE-STUDIO-THEME-002: picks, recolours, sets faces, motifs and decoration, and resets an edited theme', () => {
|
||||
const { result } = renderHook(() => useStudioTheme());
|
||||
act(() => result.current.pick('alpine'));
|
||||
expect(result.current.edited).toBe(false);
|
||||
act(() => result.current.setColour('accent', '#ff0000'));
|
||||
act(() => result.current.setFont('heading', 'playfair', 700));
|
||||
act(() => result.current.setFont('script', null));
|
||||
act(() => result.current.setFont('body', null));
|
||||
act(() => result.current.toggleMotif('sea'));
|
||||
act(() => result.current.toggleMotif('mountains'));
|
||||
act(() => result.current.setDecoration('rich'));
|
||||
const d = result.current.draft;
|
||||
expect([d.palette.accent, d.fonts.heading, d.fonts.script, d.motifs, d.decoration]).toEqual([
|
||||
'#ff0000',
|
||||
{ font: 'playfair', weight: 700 },
|
||||
null,
|
||||
['sea'],
|
||||
'rich',
|
||||
]);
|
||||
expect(d.fonts.body).toEqual(bookThemeOf('alpine').fonts.body);
|
||||
expect(result.current.edited).toBe(true);
|
||||
act(() => result.current.reset());
|
||||
expect(result.current.draft).toEqual(bookThemeOf('alpine'));
|
||||
// Nothing reached the book.
|
||||
expect(doc().theme).toBeUndefined();
|
||||
});
|
||||
|
||||
it('FE-STUDIO-THEME-003: builds the whole request, and calls a theme of the book own never edited', () => {
|
||||
const theme = { ...bookThemeOf('cutout'), id: null };
|
||||
expect(themeRequest(theme, ['sp1'], false)).toMatchObject({ spreadIds: ['sp1'], adopt: false });
|
||||
expect(themeRequest(theme, undefined, true)).not.toHaveProperty('theme');
|
||||
expect(themeRequest(bookThemeOf('cutout'), undefined, true)).toMatchObject({ theme: 'cutout' });
|
||||
expect(isEdited(theme)).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe('applying a theme', () => {
|
||||
it('FE-STUDIO-THEME-004: to the book adopts and recolours every page in one undo step', () => {
|
||||
const { result } = renderHook(() => useStudioTheme());
|
||||
act(() => result.current.pick('tropical'));
|
||||
let done: ReturnType<typeof result.current.apply> = null;
|
||||
act(() => {
|
||||
done = result.current.apply('book');
|
||||
});
|
||||
expect(done).toEqual({ pages: 2 });
|
||||
const tropical = bookThemeOf('tropical');
|
||||
expect(doc().theme?.id).toBe('tropical');
|
||||
expect(doc().spreads.map((s) => s.background)).toEqual([tropical.palette.paper, tropical.palette.paper]);
|
||||
expect(doc().spreads[0]?.elements[0]).toMatchObject({ token: 'ink', color: tropical.palette.ink });
|
||||
act(() => useStudioStore.getState().undo());
|
||||
expect(doc().theme).toBeUndefined();
|
||||
});
|
||||
|
||||
it('FE-STUDIO-THEME-005: to the page open, without adopting when told, and never in a read-only book', () => {
|
||||
const { result } = renderHook(() => useStudioTheme());
|
||||
act(() => result.current.setAdopt(false));
|
||||
let done: ReturnType<typeof result.current.apply> = null;
|
||||
act(() => {
|
||||
done = result.current.apply('page');
|
||||
});
|
||||
expect(done).toEqual({ pages: 0 });
|
||||
expect(doc().theme?.id).toBe('poster-pop');
|
||||
act(() => result.current.setAdopt(true));
|
||||
act(() => {
|
||||
done = result.current.apply('page');
|
||||
});
|
||||
expect(done).toEqual({ pages: 1 });
|
||||
expect(doc().spreads[1]?.background).toBeNull();
|
||||
act(() => useStudioStore.getState().setReadOnly(true));
|
||||
const readOnly = renderHook(() => useStudioTheme());
|
||||
expect(readOnly.result.current.canApply).toBe(false);
|
||||
expect(readOnly.result.current.apply('book')).toBeNull();
|
||||
});
|
||||
|
||||
it('FE-STUDIO-THEME-006: takes the accents from the photos, or says the photos have none', async () => {
|
||||
const read = vi.mocked(photoColours.readPhotoSwatches);
|
||||
load([{ id: 'p1', kind: 'photo', frame: FRAME, photoId: 5 } as unknown as BookElement]);
|
||||
const { result } = renderHook(() => useStudioTheme());
|
||||
expect(result.current.hasPhotos).toBe(true);
|
||||
read.mockResolvedValueOnce([{ hex: '#1f6fbf', share: 1 }]);
|
||||
let found = false;
|
||||
await act(async () => {
|
||||
found = await result.current.fromPhotos();
|
||||
});
|
||||
expect(found).toBe(true);
|
||||
expect(result.current.draft.palette.accent).toBe('#1f6fbf');
|
||||
read.mockResolvedValueOnce([{ hex: '#808080', share: 1 }]);
|
||||
await act(async () => {
|
||||
found = await result.current.fromPhotos();
|
||||
});
|
||||
expect(found).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe('the Theme panel', () => {
|
||||
it('FE-STUDIO-THEME-007: shows twelve themes, applies the one picked and says so', () => {
|
||||
render(<StudioThemePanel t={t} />);
|
||||
const cards = screen
|
||||
.getAllByRole('button', { pressed: false })
|
||||
.filter((b) => b.classList.contains('st-theme-card'));
|
||||
expect(cards).toHaveLength(11);
|
||||
fireEvent.click(screen.getByTitle('studio.theme.descr.riviera'));
|
||||
fireEvent.click(screen.getByText('studio.theme.applyBook'));
|
||||
expect(doc().theme?.id).toBe('riviera');
|
||||
expect(toast.success).toHaveBeenCalledWith('studio.theme.applied');
|
||||
expect(screen.getByLabelText('studio.theme.inUse')).toBeTruthy();
|
||||
});
|
||||
|
||||
it('FE-STUDIO-THEME-008: edits a colour and a face, and says when nothing followed the theme', () => {
|
||||
render(<StudioThemePanel t={t} />);
|
||||
fireEvent.change(screen.getByLabelText('studio.theme.token.accent'), { target: { value: '#00aa00' } });
|
||||
// The script switched off says so, and back on it is a face again.
|
||||
fireEvent.click(screen.getByLabelText('studio.theme.slot.script'));
|
||||
expect(screen.getByText('studio.theme.noScript')).toBeTruthy();
|
||||
fireEvent.click(screen.getByLabelText('studio.theme.slot.script'));
|
||||
expect(screen.queryByText('studio.theme.noScript')).toBeNull();
|
||||
fireEvent.click(screen.getByText('studio.theme.reset'));
|
||||
fireEvent.click(screen.getByLabelText('studio.theme.adopt'));
|
||||
fireEvent.click(screen.getByText('studio.theme.applyPage'));
|
||||
expect(toast.info).toHaveBeenCalledWith('studio.theme.nothing');
|
||||
});
|
||||
});
|
||||
|
||||
describe('the inspector theme colours', () => {
|
||||
it('FE-STUDIO-THEME-009: show nothing without a theme, link a colour and take the link away', () => {
|
||||
const onLink = vi.fn();
|
||||
const onUnlink = vi.fn();
|
||||
const { container, rerender } = render(
|
||||
<StudioThemeLink theme={undefined} token={undefined} onLink={onLink} onUnlink={onUnlink} t={t} />
|
||||
);
|
||||
expect(container.querySelector('.st-theme-link')).toBeNull();
|
||||
const nordic = bookThemeOf('nordic');
|
||||
rerender(<StudioThemeLink theme={nordic} token="accent" onLink={onLink} onUnlink={onUnlink} t={t} />);
|
||||
fireEvent.click(screen.getByLabelText('studio.theme.token.accent2'));
|
||||
expect(onLink).toHaveBeenCalledWith('accent2', nordic.palette.accent2);
|
||||
fireEvent.click(screen.getByLabelText('studio.theme.unlink'));
|
||||
expect(onUnlink).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('FE-STUDIO-THEME-010: a colour picked by hand in the store stops following the theme', () => {
|
||||
load([text({ token: 'accent' })], { theme: bookThemeOf('nordic') });
|
||||
useStudioStore.getState().updateElement(0, 't1', { color: '#123456' } as Partial<BookElement>);
|
||||
expect(doc().spreads[0]?.elements[0]).not.toHaveProperty('token');
|
||||
useStudioStore.getState().updateElement(0, 't1', { token: 'accent2' } as Partial<BookElement>);
|
||||
expect(doc().spreads[0]?.elements[0]).toMatchObject({ color: bookThemeOf('nordic').palette.accent2 });
|
||||
});
|
||||
});
|
||||
|
||||
describe('the colours of the photos', () => {
|
||||
it('FE-STUDIO-THEME-011: are the fullest buckets of a sample, and the book photos each once', () => {
|
||||
const px = [255, 0, 0, 255, 250, 2, 2, 255, 0, 0, 255, 255, 9, 9, 9, 0];
|
||||
const swatches = photoColours.swatchesFromPixels(px);
|
||||
expect(swatches[0]).toEqual({ hex: '#fd0101', share: 2 / 3 });
|
||||
expect(swatches).toHaveLength(2);
|
||||
expect(photoColours.swatchesFromPixels([0, 0, 0, 0])).toEqual([]);
|
||||
load([
|
||||
{ id: 'a', kind: 'photo', frame: FRAME, photoId: 4 } as unknown as BookElement,
|
||||
{ id: 'b', kind: 'photo', frame: FRAME, photoId: 4 } as unknown as BookElement,
|
||||
{ id: 'c', kind: 'photo', frame: FRAME, photoId: null } as unknown as BookElement,
|
||||
]);
|
||||
expect(photoColours.bookPhotoIds(doc())).toEqual([4]);
|
||||
expect(photoColours.bookPhotoIds(null)).toEqual([]);
|
||||
});
|
||||
});
|
||||
@@ -36,6 +36,7 @@ const STUDIO_ONLY_TOOLS: Readonly<Record<string, string>> = Object.fromEntries(
|
||||
'set_book_cover',
|
||||
'suggest_book_photos',
|
||||
'set_book_setup',
|
||||
'set_book_theme',
|
||||
'duplicate_book_page',
|
||||
'save_book_layout',
|
||||
'remove_book_layout',
|
||||
|
||||
@@ -36,6 +36,12 @@ function describeSetup(args: ToolArgs): Described {
|
||||
return described(new Rows().add('type', text(args.preset)).add('position', text(numbers.position)));
|
||||
}
|
||||
|
||||
/** A theme names the theme it starts from and the accent it sets, when it sets one. */
|
||||
function describeTheme(args: ToolArgs): Described {
|
||||
const palette = args.palette && typeof args.palette === 'object' ? (args.palette as ToolArgs) : {};
|
||||
return described(new Rows().add('type', text(args.theme)).add('color', text(palette.accent)));
|
||||
}
|
||||
|
||||
/** A layout kept or taken away, by its name or its id. */
|
||||
function describeLayout(args: ToolArgs, key: 'name' | 'layoutId'): Described {
|
||||
return described(new Rows().add('name', text(args[key])));
|
||||
@@ -64,6 +70,11 @@ export const BOOK_DESIGN_CARDS: DomainCards = {
|
||||
describe: (_ctx, args) => describeSetup(args),
|
||||
undo: SETUP_BACK,
|
||||
},
|
||||
set_book_theme: {
|
||||
write: { verbKey: 'setBookTheme', entity: 'book_page' },
|
||||
describe: (_ctx, args) => describeTheme(args),
|
||||
undo: RESTORE_REVISION,
|
||||
},
|
||||
duplicate_book_page: {
|
||||
write: { verbKey: 'duplicateBookPage', entity: 'book_page' },
|
||||
describe: () => described(new Rows()),
|
||||
|
||||
@@ -32,6 +32,7 @@ import {
|
||||
saveBookLayout,
|
||||
setBookCover,
|
||||
setBookSetup,
|
||||
setBookTheme,
|
||||
spreadFindings,
|
||||
summarizeBook,
|
||||
summarizeSpread,
|
||||
@@ -61,6 +62,7 @@ import {
|
||||
type SetBookCoverRequest,
|
||||
type SetBookSetupRequest,
|
||||
type ListBookAssetsRequest,
|
||||
type SetBookThemeRequest,
|
||||
} from '@trek/shared';
|
||||
import { bookStickerLookup, listBookAssets } from '@trek/shared/stickers';
|
||||
|
||||
@@ -96,6 +98,8 @@ interface WriteOptions {
|
||||
extra?: (before: BookDocument | null, made: BookMade) => Partial<BookWriteResult>;
|
||||
/** The engine needs the journey's figures, route and entries (travel elements, a page laid out again). */
|
||||
travel?: boolean;
|
||||
/** Keep the book as it was as a revision, and answer its `revision_id`: the undo of a book-wide change. */
|
||||
keepRevision?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -336,6 +340,16 @@ export class JourneyBookEditService {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* `set_book_theme`: a theme applied to the whole book or to some pages. It
|
||||
* can recolour every page at once, so the book as it was is kept as a
|
||||
* revision and `revision_id` names it; the assistant's undo puts it back
|
||||
* with `restore_book_revision` while nothing was saved since.
|
||||
*/
|
||||
async setTheme(journeyId: number, userId: number, args: SetBookThemeRequest): Promise<BookWriteAnswer> {
|
||||
return this.write(journeyId, userId, (doc) => setBookTheme(stored(doc), args), { keepRevision: true });
|
||||
}
|
||||
|
||||
/** `duplicate_book_page`: a copy of an inner page with new ids, right after it. */
|
||||
async duplicatePage(journeyId: number, userId: number, args: DuplicateBookPageRequest): Promise<BookWriteAnswer> {
|
||||
return this.write(journeyId, userId, (doc, ctx) => duplicateBookPage(stored(doc), args, ctx));
|
||||
@@ -432,7 +446,7 @@ export class JourneyBookEditService {
|
||||
if (!journey) throw journeyNotFound();
|
||||
// Read before the transaction: the figures take a while and need not be read in it.
|
||||
const travel = options.travel ? await this.travelContext(journeyId, userId) : undefined;
|
||||
const { record, result } = await this.books.editBook(
|
||||
const { record, result, revisionId } = await this.books.editBook(
|
||||
journeyId,
|
||||
userId,
|
||||
async (current) => {
|
||||
@@ -444,7 +458,7 @@ export class JourneyBookEditService {
|
||||
const title = current?.title ?? made.doc.title;
|
||||
return { title, document: made.doc, unchanged, result: { before, made, ctx } };
|
||||
},
|
||||
{ expectedVersion: options.expectedVersion },
|
||||
{ expectedVersion: options.expectedVersion, keepRevision: options.keepRevision },
|
||||
);
|
||||
const answer = pagesOf(record.document, result.made, result.ctx);
|
||||
return {
|
||||
@@ -459,6 +473,7 @@ export class JourneyBookEditService {
|
||||
page_digests: digestsOf(record.document, result.made.spreadIds),
|
||||
}
|
||||
: {}),
|
||||
...(options.keepRevision ? { revision_id: revisionId } : {}),
|
||||
...options.extra?.(result.before, result.made),
|
||||
};
|
||||
}
|
||||
|
||||
@@ -32,6 +32,8 @@ import {
|
||||
saveBookLayoutArgs,
|
||||
setBookCoverArgs,
|
||||
setBookSetupArgs,
|
||||
setBookThemeArgs,
|
||||
bookThemeCatalogue,
|
||||
type AddBookPagesRequest,
|
||||
type CreateBookRequest,
|
||||
type DeleteBookPagesRequest,
|
||||
@@ -45,6 +47,7 @@ import {
|
||||
type SaveBookLayoutRequest,
|
||||
type SetBookCoverRequest,
|
||||
type SetBookSetupRequest,
|
||||
type SetBookThemeRequest,
|
||||
} from '@trek/shared';
|
||||
|
||||
const journeyAddonOn = addonGate(ADDON_IDS.JOURNEY);
|
||||
@@ -226,6 +229,18 @@ export class JourneyBookMcp {
|
||||
return ok(await this.books.setSetup(journeyId, ctx.userId, args));
|
||||
}
|
||||
|
||||
@Tool({
|
||||
name: 'set_book_theme',
|
||||
description: `Apply a theme to a journey's book: its paper, ink and three accents, its display, heading, body and script faces, and the motifs and decoration it suits. Start from a built-in theme (theme) or the book's own, change any colour, face, motif or decoration on top, and apply it to every page or only to spreadIds. Only colours and texts linked to the theme change (describe_book_page says what each element follows); with adopt (the default) what is not linked yet is linked first, words in white over photos staying as they are. Positions, photos and words never move. The themes: ${bookThemeCatalogue()} The answer names the revision the book was kept as before it, under revision_id. ${WRITE_ANSWER}`,
|
||||
inputSchema: { journeyId: idSchema, ...setBookThemeArgs },
|
||||
annotations: TOOL_ANNOTATIONS_WRITE,
|
||||
when: journeyAddonOn,
|
||||
access: { group: 'journey', mode: 'write' },
|
||||
})
|
||||
async setBookTheme({ journeyId, ...args }: OnJourney & SetBookThemeRequest, ctx: McpContext) {
|
||||
return ok(await this.books.setTheme(journeyId, ctx.userId, args));
|
||||
}
|
||||
|
||||
@Tool({
|
||||
name: 'duplicate_book_page',
|
||||
description: `Copy one inner double spread with everything on it, with new element ids, right after it. The cover, first, last and back pages cannot be copied. ${WRITE_ANSWER}`,
|
||||
|
||||
@@ -228,6 +228,7 @@ const BOOK_WRITES = [
|
||||
'apply_book_design',
|
||||
'restore_book_revision',
|
||||
'set_book_setup',
|
||||
'set_book_theme',
|
||||
'duplicate_book_page',
|
||||
'save_book_layout',
|
||||
'remove_book_layout',
|
||||
|
||||
@@ -288,4 +288,26 @@ describe('Studio book over MCP and REST', () => {
|
||||
expect(after.schemaRev).toBe(BOOK_SCHEMA_REV);
|
||||
expect(after.spreads[2]?.elements.find((e) => e.id === frame?.id)).toMatchObject(look);
|
||||
});
|
||||
|
||||
it('JBE2E-008: a theme set over MCP is what GET reads next, every page in its paper, stamped with this revision', async () => {
|
||||
const { owner, viewer, journey, everyone } = await journeyWithBook();
|
||||
|
||||
const themed = bookWriteResultSchema.parse(
|
||||
await callTool(owner.id, 'set_book_theme', { journeyId: journey.id, theme: 'nordic' }),
|
||||
);
|
||||
expect(themed.revision_id).toBeGreaterThan(0);
|
||||
expect(sent()).toEqual(everyone.map((id) => [id, 'journey:book:saved', undefined]));
|
||||
const res = await request(app.getHttpServer())
|
||||
.get(`/api/journeys/${journey.id}/book`)
|
||||
.set('Cookie', authCookie(viewer.id));
|
||||
expect(res.body.book.document.theme.id).toBe('nordic');
|
||||
expect(res.body.book.document.schemaRev).toBe(BOOK_SCHEMA_REV);
|
||||
const papers = new Set(
|
||||
(res.body.book.document.spreads as Array<{ background: string | null }>).map((s) => s.background),
|
||||
);
|
||||
expect([...papers]).toEqual(['#f3f1ec']);
|
||||
expect(await callTool(viewer.id, 'set_book_theme', { journeyId: journey.id, theme: 'alpine' })).toEqual({
|
||||
error: "You can read this journey's book but not change it: only its owner and editors can.",
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1110,6 +1110,14 @@ const bookCases: ParityCase[] = [
|
||||
rest: saveBook(1),
|
||||
expect: [{ event: 'journey:book:saved', user: 'actor' }],
|
||||
},
|
||||
{
|
||||
tool: 'set_book_theme',
|
||||
needs: ['journey'],
|
||||
setup: seedBook,
|
||||
args: (s) => ({ journeyId: s.journey.id, theme: 'nordic' }),
|
||||
rest: saveBook(1),
|
||||
expect: [{ event: 'journey:book:saved', user: 'actor' }],
|
||||
},
|
||||
{
|
||||
tool: 'duplicate_book_page',
|
||||
needs: ['journey'],
|
||||
|
||||
@@ -161,6 +161,19 @@ describe('the book-level changes', () => {
|
||||
expect(BOOK_DESIGN_CARDS.tools.design_book?.write).toBeUndefined();
|
||||
});
|
||||
|
||||
it('ASTBD-005b: a theme is a book change named by its theme, taken back through the revision it kept', () => {
|
||||
expect(ASSISTANT_WRITE_TOOLS.set_book_theme).toEqual({ verbKey: 'setBookTheme', entity: 'book_page' });
|
||||
const rows = describedOf('set_book_theme', ctx, { theme: 'riviera', palette: { accent: '#aa0000' } }, null);
|
||||
expect(rows?.rows.rows.map((r) => [r.labelKey, r.after])).toEqual([
|
||||
['type', 'riviera'],
|
||||
['color', '#aa0000'],
|
||||
]);
|
||||
expect(describedOf('set_book_theme', ctx, { decoration: 'rich' }, null)?.rows.rows).toEqual([]);
|
||||
const undo = ASSISTANT_UNDO_MAP.set_book_theme;
|
||||
expect(undo?.tool).toBe('restore_book_revision');
|
||||
expect(undo?.args({}, { revision_id: 31, version: 9 }, null)).toEqual({ revisionId: 31, expectedVersion: 9 });
|
||||
});
|
||||
|
||||
it('ASTBD-006: an applied design goes back to its revision at the version it left; none without a revision', () => {
|
||||
const undo = ASSISTANT_UNDO_MAP.apply_book_design;
|
||||
expect(undo?.tool).toBe('restore_book_revision');
|
||||
|
||||
@@ -105,6 +105,7 @@ const TOOLS: Array<[ClassRef, string, string, 'read' | 'write']> = [
|
||||
[JourneyBookDesignMcp as unknown as ClassRef, 'applyBookDesign', 'apply_book_design', 'write'],
|
||||
[JourneyBookDesignMcp as unknown as ClassRef, 'restoreBookRevision', 'restore_book_revision', 'write'],
|
||||
[JourneyBookMcp as unknown as ClassRef, 'setBookSetup', 'set_book_setup', 'write'],
|
||||
[JourneyBookMcp as unknown as ClassRef, 'setBookTheme', 'set_book_theme', 'write'],
|
||||
[JourneyBookMcp as unknown as ClassRef, 'duplicateBookPage', 'duplicate_book_page', 'write'],
|
||||
[JourneyBookMcp as unknown as ClassRef, 'saveBookLayout', 'save_book_layout', 'write'],
|
||||
[JourneyBookMcp as unknown as ClassRef, 'removeBookLayout', 'remove_book_layout', 'write'],
|
||||
@@ -165,6 +166,9 @@ describe('the design tools', () => {
|
||||
await expect(designs.designBook({ journeyId: journey.id }, ctx(stranger.id))).rejects.toThrow('Journey not found');
|
||||
const format = { journeyId: journey.id, preset: 'a4-portrait' as const };
|
||||
await expect(books.setBookSetup(format, ctx(viewer.id))).rejects.toThrow('Not allowed');
|
||||
const theme = { journeyId: journey.id, theme: 'alpine' as const };
|
||||
await expect(books.setBookTheme(theme, ctx(viewer.id))).rejects.toThrow('Not allowed');
|
||||
await expect(books.setBookTheme(theme, ctx(stranger.id))).rejects.toThrow('Journey not found');
|
||||
});
|
||||
|
||||
it('JBDMCP-004: the book-level tools answer as book writes, with what takes them back', async () => {
|
||||
@@ -194,6 +198,10 @@ describe('the design tools', () => {
|
||||
const back = { journeyId: journey.id, layout, expectedVersion: removed.version };
|
||||
const restored = bookWriteResultSchema.parse(answered(await books.restoreBookLayout(back, ctx(owner.id))));
|
||||
expect(restored.version).toBe(removed.version + 1);
|
||||
const themed = bookWriteResultSchema.parse(
|
||||
answered(await books.setBookTheme({ journeyId: journey.id, theme: 'riviera' }, ctx(owner.id))),
|
||||
);
|
||||
expect(themed.revision_id).toBeGreaterThan(0);
|
||||
});
|
||||
|
||||
it('JBDMCP-005: the other tools refuse an outsider, and a viewer every change, before a draft is read', async () => {
|
||||
|
||||
@@ -0,0 +1,139 @@
|
||||
/**
|
||||
* `set_book_theme` through JourneyBookEditService (JBTHM-*): a theme applied
|
||||
* to the whole book or to some pages, the book as it was kept as a revision
|
||||
* its undo restores, an apply that changes nothing written nowhere, and the
|
||||
* refusals a viewer and a bad request get. Taken from JourneyBookDesignModule
|
||||
* over a snapshot test db, with the realtime fake.
|
||||
*/
|
||||
import { JourneyBookRevisions } from '../../../../src/db/entities/JourneyBookRevisions.entity';
|
||||
import { catchDomainError, DomainError } from '../../../../src/nest/common/domain-error';
|
||||
import { JourneyBookDesignModule } from '../../../../src/nest/journey/journey-book-design.module';
|
||||
import { JourneyBookDesignService } from '../../../../src/nest/journey/journey-book-design.service';
|
||||
import { JourneyBookEditService } from '../../../../src/nest/journey/journey-book-edit.service';
|
||||
import { JourneyBookService } from '../../../../src/nest/journey/journey-book.service';
|
||||
import { PhotoResolverService } from '../../../../src/nest/memories/photo-resolver.service';
|
||||
import { createSnapshotTestDb } from '../../../helpers/db-mock';
|
||||
import { addJourneyContributor, makeJourney } from '../../../helpers/factories/journeys';
|
||||
import { findRow } from '../../../helpers/factories/rows';
|
||||
import { makeUser } from '../../../helpers/factories/users';
|
||||
import { resetTestDb } from '../../../helpers/test-db';
|
||||
import { createTestModule, type TestModule } from '../../../helpers/test-module';
|
||||
import { createTestOrm, type TestOrm } from '../../../helpers/test-orm';
|
||||
import { bookThemeOf, bookWriteResultSchema } from '@trek/shared';
|
||||
|
||||
import { afterAll, beforeAll, beforeEach, describe, expect, it } from 'vitest';
|
||||
|
||||
const db = createSnapshotTestDb();
|
||||
let t: TestModule;
|
||||
let orm: TestOrm;
|
||||
let edit: JourneyBookEditService;
|
||||
let designs: JourneyBookDesignService;
|
||||
let books: JourneyBookService;
|
||||
|
||||
beforeAll(async () => {
|
||||
t = await createTestModule({
|
||||
db,
|
||||
imports: [JourneyBookDesignModule],
|
||||
overrides: [{ provide: PhotoResolverService, useValue: { readForSignals: async () => ({ kind: 'none' }) } }],
|
||||
});
|
||||
edit = t.get(JourneyBookEditService);
|
||||
designs = t.get(JourneyBookDesignService);
|
||||
books = t.get(JourneyBookService);
|
||||
orm = await createTestOrm(db);
|
||||
});
|
||||
beforeEach(() => {
|
||||
resetTestDb(db);
|
||||
orm.clear();
|
||||
t.realtime.reset();
|
||||
});
|
||||
afterAll(async () => {
|
||||
await orm.close();
|
||||
await t.close();
|
||||
db.close();
|
||||
});
|
||||
|
||||
/** A journey with its owner and a viewer, and a blank book. */
|
||||
async function crew() {
|
||||
const { user: owner } = await makeUser(orm);
|
||||
const { user: viewer } = await makeUser(orm);
|
||||
const journey = await makeJourney(orm, owner.id, { title: 'Lisbon' });
|
||||
await addJourneyContributor(orm, journey.id, viewer.id, 'viewer');
|
||||
const created = await edit.createBook(journey.id, owner.id, {});
|
||||
const inner = created.pages.find((p) => p.role === 'inner')?.id ?? 'no inner page';
|
||||
t.realtime.reset();
|
||||
return { owner, viewer, journey, created, inner };
|
||||
}
|
||||
|
||||
async function refusal(pending: () => Promise<unknown>) {
|
||||
const err = await catchDomainError(pending);
|
||||
if (!(err instanceof DomainError)) throw new Error('the call was not refused');
|
||||
return { status: err.getStatus(), code: err.code };
|
||||
}
|
||||
|
||||
const stored = async (journeyId: number, userId: number) => (await books.getBook(journeyId, userId))?.document;
|
||||
|
||||
describe('set_book_theme', () => {
|
||||
it('JBTHM-001: applies a theme to every page, keeps the book as it was as a revision, and answers its id', async () => {
|
||||
const { journey, owner, created } = await crew();
|
||||
|
||||
const done = await edit.setTheme(journey.id, owner.id, { theme: 'alpine' });
|
||||
|
||||
expect(bookWriteResultSchema.safeParse(done).success).toBe(true);
|
||||
expect(done.version).toBe(created.version + 1);
|
||||
expect(done.spread_ids).toHaveLength(created.pages.length);
|
||||
const revisionId = done.revision_id ?? 0;
|
||||
expect(revisionId).toBeGreaterThan(0);
|
||||
expect(await findRow(orm, JourneyBookRevisions, { id: revisionId })).toBeTruthy();
|
||||
const doc = await stored(journey.id, owner.id);
|
||||
expect(doc?.theme?.id).toBe('alpine');
|
||||
expect(doc?.spreads.every((s) => s.background === bookThemeOf('alpine').palette.paper)).toBe(true);
|
||||
});
|
||||
|
||||
it('JBTHM-002: is taken back by restoring that revision', async () => {
|
||||
const { journey, owner } = await crew();
|
||||
const done = await edit.setTheme(journey.id, owner.id, { theme: 'cutout' });
|
||||
|
||||
await designs.restoreRevision(journey.id, owner.id, {
|
||||
revisionId: done.revision_id ?? 0,
|
||||
expectedVersion: done.version,
|
||||
});
|
||||
|
||||
const doc = await stored(journey.id, owner.id);
|
||||
expect(doc?.theme).toBeUndefined();
|
||||
expect(doc?.spreads.every((s) => s.background === null)).toBe(true);
|
||||
});
|
||||
|
||||
it('JBTHM-003: recolours only the pages named, and writes nothing when nothing would change', async () => {
|
||||
const { journey, owner, inner } = await crew();
|
||||
const one = await edit.setTheme(journey.id, owner.id, { theme: 'nordic', spreadIds: [inner] });
|
||||
expect(one.spread_ids).toEqual([inner]);
|
||||
t.realtime.reset();
|
||||
|
||||
const again = await edit.setTheme(journey.id, owner.id, { theme: 'nordic', spreadIds: [inner] });
|
||||
|
||||
expect(again.version).toBe(one.version);
|
||||
expect(t.realtime.broadcastToUserMock.mock.calls).toHaveLength(0);
|
||||
});
|
||||
|
||||
it('JBTHM-004: refuses a viewer, a page the book does not have and a face this build does not set', async () => {
|
||||
const { journey, owner, viewer } = await crew();
|
||||
expect(await refusal(() => edit.setTheme(journey.id, viewer.id, { theme: 'alpine' }))).toMatchObject({
|
||||
status: 403,
|
||||
});
|
||||
const gone = await refusal(() => edit.setTheme(journey.id, owner.id, { theme: 'alpine', spreadIds: ['sp-none'] }));
|
||||
expect(gone.status).toBeGreaterThanOrEqual(400);
|
||||
const font = await refusal(() =>
|
||||
edit.setTheme(journey.id, owner.id, { theme: 'alpine', fonts: { body: { font: 'comic' } } }),
|
||||
);
|
||||
expect(font.status).toBeGreaterThanOrEqual(400);
|
||||
// Nothing of it reached the book.
|
||||
expect((await stored(journey.id, owner.id))?.theme).toBeUndefined();
|
||||
});
|
||||
|
||||
it('JBTHM-005: refuses a theme for a journey without a book', async () => {
|
||||
const { user: owner } = await makeUser(orm);
|
||||
const journey = await makeJourney(orm, owner.id, { title: 'Porto' });
|
||||
const none = await refusal(() => edit.setTheme(journey.id, owner.id, { theme: 'alpine' }));
|
||||
expect(none.status).toBeGreaterThanOrEqual(400);
|
||||
});
|
||||
});
|
||||
@@ -13,6 +13,7 @@ export const BOOK_DESIGN_CARD_SCHEMAS = [bookDesignCardSchema] as const;
|
||||
export const BOOK_DESIGN_VERB_KEYS = [
|
||||
'designBook',
|
||||
'setBookSetup',
|
||||
'setBookTheme',
|
||||
'duplicateBookPage',
|
||||
'saveBookLayout',
|
||||
'removeBookLayout',
|
||||
|
||||
@@ -44,6 +44,7 @@ import {
|
||||
bookStickerElementSchema,
|
||||
bookTextElementSchema,
|
||||
} from './book.schema';
|
||||
import { THEMED_ICON_IN, THEMED_SHAPE_IN, THEMED_TEXT_IN, THEMED_TYPESET_IN } from './theme/book-theme.schema';
|
||||
|
||||
import { z } from 'zod';
|
||||
|
||||
@@ -90,6 +91,7 @@ const TYPESET = {
|
||||
accent: map.accent.unwrap().optional(),
|
||||
textScale: map.textScale.unwrap().optional(),
|
||||
weight: map.weight.unwrap().optional(),
|
||||
...THEMED_TYPESET_IN,
|
||||
};
|
||||
|
||||
const PHOTO_PROPS = {
|
||||
@@ -114,7 +116,7 @@ export const TEXT_STYLE_FIELDS = {
|
||||
tracking: text.tracking.unwrap().optional(),
|
||||
color: text.color.unwrap().optional(),
|
||||
};
|
||||
const TEXT_PROPS = { ...COMMON, ...TEXT_STYLE_FIELDS };
|
||||
const TEXT_PROPS = { ...COMMON, ...TEXT_STYLE_FIELDS, ...THEMED_TEXT_IN };
|
||||
const SHAPE_PROPS = {
|
||||
...COMMON,
|
||||
fill: shape.fill.unwrap().optional(),
|
||||
@@ -126,9 +128,11 @@ const SHAPE_PROPS = {
|
||||
strokeStyle: bookStrokeStyleSchema.optional(),
|
||||
radius: z.number().finite().min(0).max(500).optional(),
|
||||
...BOOK_EDGE_PROPS,
|
||||
...THEMED_SHAPE_IN,
|
||||
};
|
||||
const ICON_PROPS = {
|
||||
...COMMON,
|
||||
...THEMED_ICON_IN,
|
||||
color: icon.color.unwrap().optional(),
|
||||
lineWidth: icon.lineWidth.unwrap().optional(),
|
||||
};
|
||||
|
||||
@@ -46,6 +46,8 @@ import type {
|
||||
BookSpread,
|
||||
BookTextElement,
|
||||
} from './book.schema';
|
||||
import { withThemeLinks } from './theme/book-theme-links';
|
||||
import type { BookTheme } from './theme/book-theme.schema';
|
||||
|
||||
import type { z } from 'zod';
|
||||
|
||||
@@ -153,10 +155,10 @@ const MM_KEYS: ReadonlySet<string> = new Set(['radius', 'strokeWidth', 'edgeSize
|
||||
|
||||
/**
|
||||
* The element with the given look fields set; millimetre fields rounded as the
|
||||
* document stores them, and the weight moved onto one its family has, as the
|
||||
* Studio's weight control does.
|
||||
* document stores them, the weight moved onto one its family has, as the
|
||||
* Studio's weight control does, and its theme links kept in step (book-theme-links.ts).
|
||||
*/
|
||||
function withProps(el: BookElement, props: Record<string, unknown>): BookElement {
|
||||
function withProps(el: BookElement, props: Record<string, unknown>, theme?: BookTheme): BookElement {
|
||||
if (el.kind === 'line') return bookLineStyled(el, props);
|
||||
const keys = PROP_KEYS.get(el.kind) ?? [];
|
||||
const next: Record<string, unknown> = { ...el };
|
||||
@@ -171,7 +173,7 @@ function withProps(el: BookElement, props: Record<string, unknown>): BookElement
|
||||
next[key] = MM_KEYS.has(key) && typeof value === 'number' ? round2(value) : value;
|
||||
}
|
||||
const made = withRealWeight(next as unknown as BookElement);
|
||||
return made.kind === 'shape' ? withPaintProps(made, props) : made;
|
||||
return withThemeLinks(made.kind === 'shape' ? withPaintProps(made, props) : made, props, theme);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -191,7 +193,8 @@ function withPaintProps(el: BookShapeElement, props: Record<string, unknown>): B
|
||||
|
||||
function opAdd(spread: BookSpread, op: Op<'add'>, env: ElementOpEnv): BookSpread {
|
||||
roomFor(spread, 1, env.opIndex);
|
||||
const made = withProps(created(spread, op.element, op.frame ? roundFrame(op.frame) : null, env), lookOf(op.element));
|
||||
const blank = created(spread, op.element, op.frame ? roundFrame(op.frame) : null, env);
|
||||
const made = withProps(blank, lookOf(op.element), env.doc.theme);
|
||||
const el = op.rotation !== undefined ? { ...made, rotation: op.rotation } : made;
|
||||
const parked =
|
||||
el.kind === 'photo' && el.photoId != null
|
||||
@@ -432,7 +435,7 @@ function opStyle(spread: BookSpread, op: Op<'style'>, env: ElementOpEnv): BookSp
|
||||
if (op.set.kind !== el.kind) {
|
||||
throw failOp('wrong_kind', `${el.id} is a ${el.kind}; set.kind says ${op.set.kind}`, env.opIndex, el.id);
|
||||
}
|
||||
return replaceAll(spread, [withProps(el, op.set)]);
|
||||
return replaceAll(spread, [withProps(el, op.set, env.doc.theme)]);
|
||||
}
|
||||
|
||||
function opLock(spread: BookSpread, op: Op<'lock'>, env: ElementOpEnv): BookSpread {
|
||||
|
||||
@@ -504,5 +504,7 @@ export const bookWriteResultSchema = z.object({
|
||||
previous_layout: bookLayoutSchema.optional(),
|
||||
/** From `save_book_layout`: the new layout's id, to take it away again. */
|
||||
layout_id: z.string().max(40).optional(),
|
||||
/** From `set_book_theme`: the revision the book was kept as before it, null for a book that was new. */
|
||||
revision_id: z.number().int().positive().nullable().optional(),
|
||||
});
|
||||
export type BookWriteResult = z.infer<typeof bookWriteResultSchema>;
|
||||
|
||||
@@ -123,11 +123,14 @@ function applyOne(spread: BookSpread, op: BookPageOp, env: Env): BookSpread {
|
||||
return opFrame(spread, op, env);
|
||||
case 'remove':
|
||||
return opRemove(spread, op, env);
|
||||
case 'background':
|
||||
case 'background': {
|
||||
// A colour set by hand stops following the theme's paper.
|
||||
const { backgroundToken: _unlinked, ...rest } = spread;
|
||||
return withSpreadPaint(
|
||||
spread,
|
||||
rest,
|
||||
op.paint !== undefined ? op.paint : op.color ? { type: 'solid', color: op.color } : null,
|
||||
);
|
||||
}
|
||||
default:
|
||||
return isGroupOp(op) ? applyGroupOp(spread, op, env) : applyElementOp(spread, op, env);
|
||||
}
|
||||
|
||||
@@ -38,8 +38,10 @@ import type { BookDocument } from './book.schema';
|
||||
* - 6: the photo look (`border`, `shadow`, `zoom`, `flipX`, `adjust`, `duotone`, `cutout`, book-photo-look.schema.ts).
|
||||
* - 7: the second shelf of shapes, the cut edge of a shape and a photo (`edge`, `edgeSize`,
|
||||
* book-shapes-more.ts) and the line kind (book-line.schema.ts).
|
||||
* - 8: themes (the document's `theme`, and the `token`, `strokeToken`, `accentToken`,
|
||||
* `fontRole` and `backgroundToken` links, theme/book-theme.schema.ts).
|
||||
*/
|
||||
export const BOOK_SCHEMA_REV = 7;
|
||||
export const BOOK_SCHEMA_REV = 8;
|
||||
|
||||
/** The `code` a refused save carries in its body when the stored book is newer than the writer. */
|
||||
export const BOOK_SCHEMA_NEWER_CODE = 'book_schema_newer';
|
||||
|
||||
@@ -4,6 +4,7 @@ import { bookPaintFieldSchema } from './book-paint.schema';
|
||||
import { BOOK_PHOTO_LOOK_FIELDS } from './book-photo-look.schema';
|
||||
import { BOOK_EDGE_FIELDS, BOOK_SHAPES_MORE } from './book-shapes-more';
|
||||
import { MAX_STICKER_SLOTS } from './stickers/sticker-types';
|
||||
import * as themed from './theme/book-theme.schema';
|
||||
|
||||
import { z } from 'zod';
|
||||
|
||||
@@ -279,6 +280,7 @@ export const bookTextElementSchema = z.object({
|
||||
/** Ems, may be negative. */
|
||||
tracking: z.number().min(-0.2).max(1).default(0),
|
||||
color: hex.default('#1a1a1a'),
|
||||
...themed.THEMED_TEXT,
|
||||
/** Where this text came from, when it came from the journey. */
|
||||
binding: z
|
||||
.object({
|
||||
@@ -341,6 +343,7 @@ export const bookShapeElementSchema = z.object({
|
||||
/** A fill beyond one flat colour (book-paint.schema.ts); `fill` keeps the colour that stands for it. */
|
||||
paint: bookPaintFieldSchema,
|
||||
stroke: hex.nullable().default(null),
|
||||
...themed.THEMED_SHAPE,
|
||||
strokeWidth: mm.default(0),
|
||||
/**
|
||||
* A dashed rule is a different thing from a solid one — it reads as a fold, a
|
||||
@@ -413,6 +416,7 @@ const typeset = {
|
||||
weight: bookWeightSchema.default(700),
|
||||
/** Set when the journey has moved on since these values were taken. */
|
||||
stale: z.boolean().default(false),
|
||||
...themed.THEMED_TYPESET,
|
||||
};
|
||||
|
||||
/** Kilometres or miles. Stored metric; the element converts when it draws. */
|
||||
@@ -778,6 +782,7 @@ export const bookIconElementSchema = z.object({
|
||||
.regex(/^[A-Z][A-Za-z0-9]*$/, 'expected a lucide icon name')
|
||||
.max(60),
|
||||
color: hex.default('#111827'),
|
||||
...themed.THEMED_ICON,
|
||||
/**
|
||||
* How heavy the drawing is, against lucide's own 24-unit grid — not
|
||||
* millimetres, which is why it is not called `strokeWidth`: three separate
|
||||
@@ -907,6 +912,7 @@ export const bookSpreadSchema = z.object({
|
||||
background: hex.nullable().default(null),
|
||||
/** A page painted beyond one flat colour; `background` keeps the colour that stands for it. */
|
||||
backgroundPaint: bookPaintFieldSchema,
|
||||
...themed.THEMED_SPREAD,
|
||||
/** Back to front. */
|
||||
elements: z.array(bookElementSchema).max(MAX_SPREAD_ELEMENTS).default([]),
|
||||
/**
|
||||
@@ -1032,5 +1038,7 @@ export const bookDocumentSchema = z.object({
|
||||
spreads: z.array(bookSpreadSchema).max(MAX_SPREADS).default([]),
|
||||
/** The book's own layouts (#2316). Optional so a document from before still reads. */
|
||||
layouts: z.array(bookLayoutSchema).max(MAX_BOOK_LAYOUTS).optional(),
|
||||
/** Palette, typefaces and motifs; elements link to it through the fields of theme/book-theme.schema.ts. */
|
||||
theme: themed.bookThemeFieldSchema,
|
||||
});
|
||||
export type BookDocument = z.infer<typeof bookDocumentSchema>;
|
||||
|
||||
@@ -24,6 +24,7 @@ import {
|
||||
type BookSpread,
|
||||
} from './book.schema';
|
||||
import { bookEdgeWords, bookLineWords } from './describe-lines';
|
||||
import { bookThemeLine, themeBackgroundWords, themeLinkWords } from './theme/book-theme-describe';
|
||||
|
||||
/**
|
||||
* A page in words, for a model that cannot see it and as the text beside a
|
||||
@@ -163,6 +164,7 @@ function elementLine(el: BookElement, i: number, photos: readonly BookPhotoInfo[
|
||||
el.hidden ? 'hidden (not on the page or in print)' : '',
|
||||
el.group ? `in group ${el.group}` : '',
|
||||
el.name ? `named "${head(el.name, 40)}"` : '',
|
||||
themeLinkWords(el),
|
||||
].filter(Boolean);
|
||||
const tail = extra.length ? `; ${extra.join(', ')}` : '';
|
||||
return `${i + 1}. ${el.kind} ${el.id} at ${n(x)}, ${n(y)}, ${n(w)} x ${n(h)}: ${elementWords(el, photos)}${tail}`;
|
||||
@@ -202,7 +204,7 @@ function pageLine(doc: BookDocument, spread: BookSpread, index: number): string
|
||||
? `${n(p.pageWidth)} x ${n(p.pageHeight)} mm`
|
||||
: `${n(p.pageWidth * 2)} x ${n(p.pageHeight)} mm (two pages of ${n(p.pageWidth)} x ${n(p.pageHeight)}), fold at x ${n(p.pageWidth)}`;
|
||||
const entry = spread.entryId != null ? ` From entry ${spread.entryId}.` : '';
|
||||
return `Page ${index + 1} of ${doc.spreads.length} (${spread.id}): ${ROLE_WORDS[spread.role]}, ${size}; bleed ${n(p.bleed)}, safe ${n(p.safe)}. Background ${backgroundWords(spread)}.${entry}`;
|
||||
return `Page ${index + 1} of ${doc.spreads.length} (${spread.id}): ${ROLE_WORDS[spread.role]}, ${size}; bleed ${n(p.bleed)}, safe ${n(p.safe)}. Background ${backgroundWords(spread)}.${themeBackgroundWords(spread)}${entry}`;
|
||||
}
|
||||
|
||||
function backgroundWords(spread: BookSpread): string {
|
||||
@@ -259,7 +261,7 @@ export function describeSpread(
|
||||
const spread = doc.spreads[index];
|
||||
if (!spread) return null;
|
||||
const findings = pageFindings(spread, doc.page, photos);
|
||||
const lines = [pageLine(doc, spread, index)];
|
||||
const lines = [pageLine(doc, spread, index), bookThemeLine(doc.theme)];
|
||||
if (spread.elements.length) {
|
||||
lines.push('Elements, back to front (frame in mm: x, y, w x h):');
|
||||
spread.elements.forEach((el, i) => lines.push(elementLine(el, i, photos)));
|
||||
|
||||
@@ -23,6 +23,7 @@ import type { BookDesignBeat } from './design-pacing';
|
||||
import { choosePhotos, type BookDesignLeftOut } from './design-photos';
|
||||
import { repairSpread } from './design-repair';
|
||||
import { designGrid, designLook, paperBackground, type BookDesignLook } from './design-style';
|
||||
import { themeDesignedSpread, unlinkDrifted } from './design-theme';
|
||||
|
||||
/**
|
||||
* The assistant designs the whole photo book.
|
||||
@@ -240,7 +241,7 @@ export function designBook(
|
||||
ownSubtitle: directives.cover?.subtitle,
|
||||
};
|
||||
const cover = coverPhoto(input, directives, usedPhotos);
|
||||
const titlePage = directives.style === 'editorial' || directives.style === 'journal';
|
||||
const titlePage = TITLE_PAGE_STYLES.has(directives.style);
|
||||
const first = titlePage ? composeTitlePage(c, words, placed) : blank(c, 'first');
|
||||
const framing: DesignedSpread[] = [
|
||||
{ spread: composeCover(c, words, cover), beat: 'cover', chapter: null, findings: [] },
|
||||
@@ -252,10 +253,10 @@ export function designBook(
|
||||
];
|
||||
const repairCtx = { page, photos: input.photos, look, newId };
|
||||
const designed = [...framing, ...inner.spreads, ...closing].map((d): DesignedSpread => {
|
||||
const fixed = repairSpread(d.spread, repairCtx);
|
||||
const fixed = repairSpread(themeDesignedSpread(d.spread, look), repairCtx);
|
||||
// Every face at a weight its family has: a travel element's bold in a one-weight poster face would be faked.
|
||||
const spread = { ...fixed.spread, elements: fixed.spread.elements.map(withRealWeight) };
|
||||
return { ...d, spread, findings: fixed.findings };
|
||||
const weighted = { ...fixed.spread, elements: fixed.spread.elements.map(withRealWeight) };
|
||||
return { ...d, spread: unlinkDrifted(weighted, look.theme), findings: fixed.findings };
|
||||
});
|
||||
|
||||
const merged = mergeDesign(doc, designed, directives.keep);
|
||||
@@ -267,6 +268,7 @@ export function designBook(
|
||||
page: { ...page, pageNumbers: { ...pageNumbers, startAt: 1 } },
|
||||
spreads: merged.spreads,
|
||||
...(doc?.layouts ? { layouts: doc.layouts } : {}),
|
||||
theme: look.theme,
|
||||
};
|
||||
const residual = designed.flatMap((d) => d.findings.filter((f) => f.severity !== 'info'));
|
||||
return {
|
||||
@@ -282,6 +284,9 @@ export function designBook(
|
||||
};
|
||||
}
|
||||
|
||||
/** The styles that open the book on a title page: the quiet, bookish ones. */
|
||||
const TITLE_PAGE_STYLES: ReadonlySet<string> = new Set(['editorial', 'journal', 'fabric-classic', 'minimal-serif']);
|
||||
|
||||
/** An empty single page of a role, on the book's paper. */
|
||||
function blank(c: ComposeCtx, role: 'first' | 'last'): BookSpread {
|
||||
return { id: c.newId('sp'), role, background: paperBackground(c.look), elements: [], parked: [], entryId: null };
|
||||
|
||||
@@ -2,6 +2,8 @@ import { idSchema } from '../../common/primitives.schema';
|
||||
import { bookFontIdSchema, bookMetricSchema, bookPagePresetSchema } from '../book-op-enums';
|
||||
import { bookCoverTemplateIdSchema } from '../book-ops.schema';
|
||||
import { MAX_BOOK_TITLE } from '../book.schema';
|
||||
import { bookThemeCatalogue } from '../theme/book-theme-describe';
|
||||
import { BOOK_THEME_IDS } from '../theme/book-theme.schema';
|
||||
|
||||
import { z } from 'zod';
|
||||
|
||||
@@ -18,14 +20,22 @@ const pageCount = z.number().int().min(1).max(146);
|
||||
const ids300 = z.array(idSchema).max(300);
|
||||
const ids200 = z.array(idSchema).max(200);
|
||||
|
||||
export const BOOK_DESIGN_STYLES = ['classic', 'minimal', 'editorial', 'journal', 'bold', 'scrapbook'] as const;
|
||||
/** The six looks the design engine started with. */
|
||||
export const BOOK_DESIGN_LOOKS = ['classic', 'minimal', 'editorial', 'journal', 'bold', 'scrapbook'] as const;
|
||||
export type BookDesignLookStyle = (typeof BOOK_DESIGN_LOOKS)[number];
|
||||
/** Every style a design takes: the six looks, then each built-in theme by its id (theme/book-themes.data.ts). */
|
||||
export const BOOK_DESIGN_STYLES = [...BOOK_DESIGN_LOOKS, ...BOOK_THEME_IDS] as const;
|
||||
export type BookDesignStyle = (typeof BOOK_DESIGN_STYLES)[number];
|
||||
|
||||
/** Whether a style is one of the six looks rather than a theme. */
|
||||
export const isBookDesignLook = (style: BookDesignStyle): style is BookDesignLookStyle =>
|
||||
(BOOK_DESIGN_LOOKS as readonly string[]).includes(style);
|
||||
|
||||
export const bookDesignDirectivesSchema = z.strictObject({
|
||||
style: z
|
||||
.enum(BOOK_DESIGN_STYLES)
|
||||
.describe(
|
||||
'The look: classic (white, sans, one warm accent), minimal (white, Inter, grey), editorial (cream, Playfair over Garamond), journal (warm paper, framed photos), bold (black paper, Bebas caps, strong accent), scrapbook (cream paper, MuseoModerno headings, polaroids turned a little).',
|
||||
`The look: classic (white, sans, one warm accent), minimal (white, Inter, grey), editorial (cream, Playfair over Garamond), journal (warm paper, framed photos), bold (black paper, Bebas caps, strong accent), scrapbook (cream paper, MuseoModerno headings, polaroids turned a little), or one of the themes, which also keep the book in that theme for set_book_theme: ${bookThemeCatalogue()}`,
|
||||
)
|
||||
.default('classic'),
|
||||
/** Photos per spread: airy 1 to 2, balanced 2 to 4, rich 4 to 6. */
|
||||
|
||||
@@ -1,8 +1,16 @@
|
||||
import { accentFromPalettes, contrastRatio, parseHex, readPalette, readableInk, toHex } from '../book-colour';
|
||||
import { accentFromPalettes, contrastRatio, readPalette } from '../book-colour';
|
||||
import { bookFontCountsInMix, bookFontSuits } from '../book-fonts';
|
||||
import type { BookPhotoInfo } from '../book-ops-core';
|
||||
import type { BookFontFamily, BookPageSetup, BookPhotoElement } from '../book.schema';
|
||||
import type { BookDesignDirectives, BookDesignStyle } from './design-directives.schema';
|
||||
import { mutedOn, readableOn } from '../theme/book-theme';
|
||||
import type { BookTheme } from '../theme/book-theme.schema';
|
||||
import {
|
||||
isBookDesignLook,
|
||||
type BookDesignDirectives,
|
||||
type BookDesignLookStyle,
|
||||
type BookDesignStyle,
|
||||
} from './design-directives.schema';
|
||||
import { designTheme, themeStylePreset } from './design-theme';
|
||||
|
||||
/**
|
||||
* The look of a designed book: its paper, ink, accent, the two typefaces,
|
||||
@@ -45,9 +53,11 @@ export interface BookDesignLook {
|
||||
tilt: number;
|
||||
/** The map style that reads on this paper. */
|
||||
mapStyle: 'minimal' | 'outline' | 'dark' | 'paper';
|
||||
/** The theme the designed book is kept in, so "apply theme" can take it on from there. */
|
||||
theme: BookTheme;
|
||||
}
|
||||
|
||||
interface StylePreset {
|
||||
export interface StylePreset {
|
||||
paper: string;
|
||||
ink: string;
|
||||
accent: string;
|
||||
@@ -58,7 +68,7 @@ interface StylePreset {
|
||||
mapStyle: BookDesignLook['mapStyle'];
|
||||
}
|
||||
|
||||
const PRESETS: Record<BookDesignStyle, StylePreset> = {
|
||||
const PRESETS: Record<BookDesignLookStyle, StylePreset> = {
|
||||
classic: {
|
||||
paper: '#ffffff',
|
||||
ink: '#1a1a1a',
|
||||
@@ -130,18 +140,9 @@ const MAX_PT = 200;
|
||||
|
||||
const round1 = (v: number) => Math.round(v * 10) / 10;
|
||||
|
||||
/** A colour part way from `a` to `b`. */
|
||||
function mix(a: string, b: string, t: number): string {
|
||||
const ca = parseHex(a);
|
||||
const cb = parseHex(b);
|
||||
if (!ca || !cb) return a;
|
||||
return toHex({ r: ca.r + (cb.r - ca.r) * t, g: ca.g + (cb.g - ca.g) * t, b: ca.b + (cb.b - ca.b) * t });
|
||||
}
|
||||
|
||||
/** The ink, unless it reads under 4.5:1 on the paper, then whichever of near black and white reads better. */
|
||||
function readableOn(paper: string, ink: string): string {
|
||||
return contrastRatio(ink, paper) >= 4.5 ? ink : readableInk(paper);
|
||||
}
|
||||
/** The preset of a style: one of the six looks below, or one of the themes (design-theme.ts). */
|
||||
const presetOf = (style: BookDesignStyle): StylePreset =>
|
||||
isBookDesignLook(style) ? PRESETS[style] : themeStylePreset(style);
|
||||
|
||||
/** The paper, ink and accent the palette directive asks for. */
|
||||
function paletteOf(
|
||||
@@ -170,11 +171,10 @@ export function designLook(
|
||||
page: BookPageSetup,
|
||||
usedPhotos: readonly BookPhotoInfo[],
|
||||
): BookDesignLook {
|
||||
const preset = PRESETS[directives.style];
|
||||
const preset = presetOf(directives.style);
|
||||
const colours = paletteOf(preset, directives.palette, usedPhotos);
|
||||
const ink = readableOn(colours.paper, colours.ink);
|
||||
const softer = mix(ink, colours.paper, 0.3);
|
||||
const muted = contrastRatio(softer, colours.paper) >= 4.6 ? softer : ink;
|
||||
const muted = mutedOn(colours.paper, ink);
|
||||
const scale = (page.pageWidth / 210) * (directives.type?.scale ?? 1);
|
||||
const size = (role: keyof typeof BASE_SIZES, times = 1) =>
|
||||
Math.min(MAX_PT, Math.max(FLOOR[role], round1(BASE_SIZES[role] * scale * times)));
|
||||
@@ -204,6 +204,7 @@ export function designLook(
|
||||
frameStyle: preset.frameStyle,
|
||||
tilt: preset.tilt,
|
||||
mapStyle: preset.mapStyle,
|
||||
theme: designTheme(directives.style, { paper: colours.paper, ink, accent: colours.accent }, { heading, body }),
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,133 @@
|
||||
import {
|
||||
bookPageSetupSchema,
|
||||
bookSpreadSchema,
|
||||
bookTextElementSchema,
|
||||
type BookDocument,
|
||||
type BookTextElement,
|
||||
} from '../book.schema';
|
||||
import { bookThemeColor, bookThemeOf } from '../theme/book-theme';
|
||||
import { setBookTheme } from '../theme/book-theme-ops';
|
||||
import { designBook, type BookDesignInput } from './design-book';
|
||||
import { BOOK_DESIGN_STYLES, bookDesignDirectivesSchema, isBookDesignLook } from './design-directives.schema';
|
||||
import { designLook } from './design-style';
|
||||
import { designTheme, themeStylePreset, unlinkDrifted } from './design-theme';
|
||||
|
||||
import { readFileSync } from 'node:fs';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
import { describe, expect, it } from 'vitest';
|
||||
|
||||
// BKDTHM-001 to BKDTHM-007
|
||||
|
||||
const here = (file: string) => fileURLToPath(new URL(file, import.meta.url));
|
||||
const fixtures = JSON.parse(readFileSync(here('./design-book.fixtures.json'), 'utf8')) as {
|
||||
rich: { input: BookDesignInput };
|
||||
};
|
||||
|
||||
function rich(): BookDesignInput {
|
||||
let n = 0;
|
||||
return { ...fixtures.rich.input, newId: (p) => `${p}-${++n}` };
|
||||
}
|
||||
|
||||
const page = bookPageSetupSchema.parse({ preset: 'square-210', pageWidth: 210, pageHeight: 210 });
|
||||
|
||||
function coverTitle(doc: BookDocument): BookTextElement | undefined {
|
||||
const cover = doc.spreads.find((s) => s.role === 'cover');
|
||||
return cover?.elements.find((e): e is BookTextElement => e.kind === 'text' && e.binding?.source === 'journey.title');
|
||||
}
|
||||
|
||||
describe('the themes as design styles', () => {
|
||||
it('BKDTHM-001: are styles after the six looks, each looking like its theme', () => {
|
||||
expect(BOOK_DESIGN_STYLES.slice(0, 6)).toEqual(['classic', 'minimal', 'editorial', 'journal', 'bold', 'scrapbook']);
|
||||
expect(BOOK_DESIGN_STYLES).toContain('india-stamp');
|
||||
expect(isBookDesignLook('bold')).toBe(true);
|
||||
expect(isBookDesignLook('alpine')).toBe(false);
|
||||
const cutout = themeStylePreset('cutout');
|
||||
expect([cutout.paper, cutout.mapStyle, cutout.frameStyle]).toEqual(['#2445b8', 'dark', 'white']);
|
||||
expect(themeStylePreset('grid-badge').mapStyle).toBe('minimal');
|
||||
expect(themeStylePreset('riviera').mapStyle).toBe('paper');
|
||||
const look = designLook(bookDesignDirectivesSchema.parse({ style: 'postcard' }), page, []);
|
||||
expect([look.paper, look.accent, look.theme.id]).toEqual(['#e3f1e8', '#c8453d', 'postcard']);
|
||||
});
|
||||
|
||||
it('BKDTHM-002: keep a design in one of the older looks as a theme of its own', () => {
|
||||
const theme = designTheme(
|
||||
'editorial',
|
||||
{ paper: '#faf8f4', ink: '#161616', accent: '#8c2f1b' },
|
||||
{
|
||||
heading: 'playfair',
|
||||
body: 'garamond',
|
||||
},
|
||||
);
|
||||
expect(theme).toMatchObject({ id: null, decoration: 'none', motifs: [], fonts: { script: null } });
|
||||
expect(theme.fonts.display).toEqual({ font: 'playfair' });
|
||||
expect(new Set(Object.values(theme.palette)).size).toBe(5);
|
||||
});
|
||||
|
||||
it('BKDTHM-003: a faces choice of the person replaces the theme face, the rest stays the theme', () => {
|
||||
const theme = designTheme(
|
||||
'nordic',
|
||||
{ paper: '#f3f1ec', ink: '#2e3a45', accent: '#a8741c' },
|
||||
{
|
||||
heading: 'playfair',
|
||||
body: 'inter',
|
||||
},
|
||||
);
|
||||
expect(theme.id).toBe('nordic');
|
||||
expect(theme.fonts.heading).toEqual({ font: 'playfair' });
|
||||
expect(theme.fonts.body).toEqual(bookThemeOf('nordic').fonts.body);
|
||||
});
|
||||
});
|
||||
|
||||
describe('a book designed in a theme', () => {
|
||||
it('BKDTHM-004: is kept in the theme, its paper, ink and title linked, the title in the display face', () => {
|
||||
const result = designBook(null, rich(), { style: 'tropical' });
|
||||
const tropical = bookThemeOf('tropical');
|
||||
expect(result.doc.theme?.id).toBe('tropical');
|
||||
const title = coverTitle(result.doc);
|
||||
expect(title?.fontRole).toBe('display');
|
||||
expect(title?.font).toBe(tropical.fonts.display.font);
|
||||
const inner = result.doc.spreads.filter((s) => s.role === 'inner');
|
||||
expect(inner.some((s) => s.backgroundToken === 'paper')).toBe(true);
|
||||
const linked = inner.flatMap((s) => s.elements).filter((e) => e.kind === 'text' && e.token === 'ink');
|
||||
expect(linked.length).toBeGreaterThan(0);
|
||||
for (const e of linked) expect((e as BookTextElement).color).toBe(bookThemeColor(tropical, 'ink'));
|
||||
});
|
||||
|
||||
it('BKDTHM-005: designed in an older look, takes another theme with one call and keeps its layout', () => {
|
||||
const designed = designBook(null, rich(), { style: 'editorial' }).doc;
|
||||
expect(designed.theme?.id).toBeNull();
|
||||
const done = setBookTheme(designed, { theme: 'alpine', adopt: false });
|
||||
if (!done.ok) throw new Error('refused');
|
||||
const alpine = bookThemeOf('alpine');
|
||||
const before = designed.spreads.flatMap((s) => s.elements.map((e) => e.frame));
|
||||
const after = done.doc.spreads.flatMap((s) => s.elements.map((e) => e.frame));
|
||||
expect(after).toEqual(before);
|
||||
const texts = done.doc.spreads.flatMap((s) => s.elements).filter((e) => e.kind === 'text' && e.token === 'ink');
|
||||
expect(texts.length).toBeGreaterThan(0);
|
||||
for (const e of texts) expect((e as BookTextElement).color).toBe(alpine.palette.ink);
|
||||
});
|
||||
|
||||
it('BKDTHM-006: designs the same book twice the same way', () => {
|
||||
const a = designBook(null, rich(), { style: 'india-stamp' });
|
||||
const b = designBook(null, rich(), { style: 'india-stamp' });
|
||||
expect(JSON.stringify(b.doc)).toBe(JSON.stringify(a.doc));
|
||||
});
|
||||
|
||||
it('BKDTHM-007: unlinks a colour the repair changed, so the next theme keeps the repaired one', () => {
|
||||
const theme = bookThemeOf('riviera');
|
||||
const words = bookTextElementSchema.parse({
|
||||
id: 't',
|
||||
kind: 'text',
|
||||
frame: { x: 1, y: 1, w: 10, h: 10 },
|
||||
color: '#ffffff',
|
||||
token: 'ink',
|
||||
});
|
||||
const kept = bookTextElementSchema.parse({ ...words, id: 'k', color: theme.palette.ink });
|
||||
const spread = bookSpreadSchema.parse({ id: 's', elements: [words, kept] });
|
||||
const fixed = unlinkDrifted(spread, theme);
|
||||
expect('token' in (fixed.elements[0] as object)).toBe(false);
|
||||
expect(fixed.elements[1]).toMatchObject({ token: 'ink' });
|
||||
const clean = bookSpreadSchema.parse({ id: 'e', elements: [kept] });
|
||||
expect(unlinkDrifted(clean, theme)).toBe(clean);
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,187 @@
|
||||
import { luminance, parseHex } from '../book-colour';
|
||||
import type { BookElement, BookFontFamily, BookSpread } from '../book.schema';
|
||||
import {
|
||||
bookThemeColor,
|
||||
bookThemeFromPreset,
|
||||
bookThemeOf,
|
||||
bookThemePreset,
|
||||
isBookFontFamily,
|
||||
mixHex,
|
||||
} from '../theme/book-theme';
|
||||
import { themedSpread } from '../theme/book-theme-apply';
|
||||
import type { BookColorToken, BookTheme, BookThemeId } from '../theme/book-theme.schema';
|
||||
import type { BookDesignStyle } from './design-directives.schema';
|
||||
import type { BookDesignLook, StylePreset } from './design-style';
|
||||
|
||||
/**
|
||||
* The design engine and the themes, one look: a theme is a style the
|
||||
* assistant can design in, and every designed book is kept in a theme, so
|
||||
* the Theme panel and `set_book_theme` can take it on from there.
|
||||
*
|
||||
* The composers keep setting real colours and faces from the look. Once a
|
||||
* page is composed, `themeDesignedSpread` links every colour that is the
|
||||
* look's paper, ink, muted ink or accent, and every text set in the look's
|
||||
* faces, then lets the theme set what the look cannot say alone: the cover
|
||||
* title in the display face, the weights the theme asks for.
|
||||
*/
|
||||
|
||||
/** The map style that reads on a paper: dark on a dark one, plain on white, the paper style on a tinted one. */
|
||||
function mapStyleOn(paper: string): StylePreset['mapStyle'] {
|
||||
const c = parseHex(paper);
|
||||
const lum = c ? luminance(c) : 1;
|
||||
if (lum < 0.2) return 'dark';
|
||||
return paper.toLowerCase() === '#ffffff' ? 'minimal' : 'paper';
|
||||
}
|
||||
|
||||
/** A theme as one of the design engine's style presets. */
|
||||
export function themeStylePreset(id: BookThemeId): StylePreset {
|
||||
const theme = bookThemeOf(id);
|
||||
const family = (f: string): BookFontFamily => (isBookFontFamily(f) ? f : 'sans');
|
||||
return {
|
||||
paper: theme.palette.paper,
|
||||
ink: theme.palette.ink,
|
||||
accent: theme.palette.accent,
|
||||
heading: family(theme.fonts.heading.font),
|
||||
body: family(theme.fonts.body.font),
|
||||
frameStyle: theme.frameStyle,
|
||||
tilt: theme.tilt,
|
||||
mapStyle: mapStyleOn(theme.palette.paper),
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* The theme a design is kept in. A theme style is that theme, its colours as
|
||||
* the directives left them (photos, a palette of the person's own) and its
|
||||
* faces as `type` chose them. One of the six older looks becomes a theme of
|
||||
* the book's own, its second and third accents drawn from its first.
|
||||
*/
|
||||
export function designTheme(
|
||||
style: BookDesignStyle,
|
||||
colours: { paper: string; ink: string; accent: string },
|
||||
faces: { heading: BookFontFamily; body: BookFontFamily },
|
||||
): BookTheme {
|
||||
const preset = bookThemePreset(style);
|
||||
const base = preset ? bookThemeFromPreset(preset) : null;
|
||||
const heading = base && base.fonts.heading.font === faces.heading ? base.fonts.heading : { font: faces.heading };
|
||||
const body = base && base.fonts.body.font === faces.body ? base.fonts.body : { font: faces.body };
|
||||
return {
|
||||
id: base ? base.id : null,
|
||||
palette: {
|
||||
...colours,
|
||||
accent2: base?.palette.accent2 ?? mixHex(colours.accent, colours.paper, 0.45),
|
||||
accent3: base?.palette.accent3 ?? mixHex(colours.ink, colours.accent, 0.5),
|
||||
},
|
||||
fonts: {
|
||||
display: base?.fonts.display ?? heading,
|
||||
heading,
|
||||
body,
|
||||
script: base ? base.fonts.script : null,
|
||||
},
|
||||
motifs: base ? base.motifs : [],
|
||||
decoration: base ? base.decoration : 'none',
|
||||
frameStyle: base ? base.frameStyle : 'none',
|
||||
tilt: base ? base.tilt : 0,
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* The token a colour of the look stands for, if it is one. Words are never
|
||||
* linked to the paper: white words on a white book's cover sit on a scrim
|
||||
* over a photo, and must not take the paper of the next theme.
|
||||
*/
|
||||
function lookToken(hex: string | null, look: BookDesignLook, words = false): BookColorToken | undefined {
|
||||
if (!hex) return undefined;
|
||||
const c = hex.toLowerCase();
|
||||
if (c === look.ink.toLowerCase()) return 'ink';
|
||||
if (c === look.muted.toLowerCase()) return 'muted';
|
||||
if (c === look.accent.toLowerCase()) return 'accent';
|
||||
return !words && c === look.paper.toLowerCase() ? 'paper' : undefined;
|
||||
}
|
||||
|
||||
/** Whether a text is the cover's title: bound to the journey's, or the largest words on the cover. */
|
||||
function isCoverTitle(el: Extract<BookElement, { kind: 'text' }>, spread: BookSpread): boolean {
|
||||
if (spread.role !== 'cover') return false;
|
||||
if (el.binding?.source === 'journey.title') return true;
|
||||
const sizes = spread.elements.flatMap((e) => (e.kind === 'text' ? [e.size] : []));
|
||||
return el.size >= Math.max(...sizes) && !spread.elements.some((e) => e.kind === 'text' && e.binding);
|
||||
}
|
||||
|
||||
/** A designed element with its links to the look. */
|
||||
function linkToLook(el: BookElement, spread: BookSpread, look: BookDesignLook): BookElement {
|
||||
switch (el.kind) {
|
||||
case 'photo':
|
||||
case 'sticker':
|
||||
return el;
|
||||
case 'text': {
|
||||
const token = lookToken(el.color, look, true);
|
||||
const heading = el.font === look.heading && (el.font !== look.body || el.size >= look.sizes.sub);
|
||||
const slot = isCoverTitle(el, spread) ? 'display' : heading ? 'heading' : el.font === look.body ? 'body' : null;
|
||||
return { ...el, ...(token ? { token } : {}), ...(slot ? { fontRole: slot } : {}) };
|
||||
}
|
||||
case 'shape': {
|
||||
if (el.gradient !== 'none') return el;
|
||||
const token = lookToken(el.fill, look);
|
||||
const strokeToken = lookToken(el.stroke, look);
|
||||
return { ...el, ...(token ? { token } : {}), ...(strokeToken ? { strokeToken } : {}) };
|
||||
}
|
||||
case 'icon': {
|
||||
const token = lookToken(el.color, look, true);
|
||||
return token ? { ...el, token } : el;
|
||||
}
|
||||
default: {
|
||||
const token = lookToken(el.color, look, true);
|
||||
const accentToken = lookToken(el.accent, look, true);
|
||||
const fontRole = el.font === look.heading ? 'heading' : el.font === look.body ? 'body' : null;
|
||||
return {
|
||||
...el,
|
||||
...(token ? { token } : {}),
|
||||
...(accentToken ? { accentToken } : {}),
|
||||
...(fontRole ? { fontRole } : {}),
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** A composed page linked to its look and set by the book's theme: the step between composing and repair. */
|
||||
export function themeDesignedSpread(spread: BookSpread, look: BookDesignLook): BookSpread {
|
||||
const paper = look.paper.toLowerCase();
|
||||
const onPaper = spread.background === null || spread.background.toLowerCase() === paper;
|
||||
const linked: BookSpread = {
|
||||
...spread,
|
||||
...(onPaper ? { backgroundToken: 'paper' as const } : {}),
|
||||
elements: spread.elements.map((e) => linkToLook(e, spread, look)),
|
||||
};
|
||||
return themedSpread(linked, look.theme);
|
||||
}
|
||||
|
||||
/** The colour fields each link sets, as `unlinkDrifted` checks them. */
|
||||
const LINKED: readonly (readonly [link: 'token' | 'strokeToken' | 'accentToken', field: string])[] = [
|
||||
['token', 'color'],
|
||||
['token', 'fill'],
|
||||
['strokeToken', 'stroke'],
|
||||
['accentToken', 'accent'],
|
||||
];
|
||||
|
||||
/**
|
||||
* A repaired page with the links taken off every colour the repair changed:
|
||||
* a caption put in the light ink over a busy photo keeps that ink, rather than
|
||||
* going back to the theme's on the next apply.
|
||||
*/
|
||||
export function unlinkDrifted(spread: BookSpread, theme: BookTheme): BookSpread {
|
||||
let changed = false;
|
||||
const elements = spread.elements.map((el) => {
|
||||
const rec = el as unknown as Record<string, unknown>;
|
||||
const next = { ...rec };
|
||||
for (const [link, field] of LINKED) {
|
||||
const token = rec[link] as BookColorToken | undefined;
|
||||
const value = rec[field];
|
||||
if (!token || typeof value !== 'string' || (field === 'color' && el.kind === 'shape')) continue;
|
||||
if (field === 'fill' && el.kind !== 'shape') continue;
|
||||
if (value.toLowerCase() !== bookThemeColor(theme, token).toLowerCase()) delete next[link];
|
||||
}
|
||||
if (Object.keys(next).length === Object.keys(rec).length) return el;
|
||||
changed = true;
|
||||
return next as unknown as BookElement;
|
||||
});
|
||||
return changed ? { ...spread, elements } : spread;
|
||||
}
|
||||
@@ -0,0 +1,212 @@
|
||||
import { contrastRatio, deltaE, parseHex, toHsl } from '../book-colour';
|
||||
import type { BookDocument, BookElement, BookSpread } from '../book.schema';
|
||||
import { bookThemeColor } from './book-theme';
|
||||
import {
|
||||
BOOK_COLOR_TOKENS,
|
||||
BOOK_FONT_SLOTS,
|
||||
type BookColorToken,
|
||||
type BookFontSlot,
|
||||
type BookTheme,
|
||||
} from './book-theme.schema';
|
||||
|
||||
/**
|
||||
* Linking what is not linked yet, so a book made before themes (or by hand)
|
||||
* can take one: the first step of "apply theme" with `adopt`.
|
||||
*
|
||||
* The rules read each colour against the page it sits on, because that is
|
||||
* what decides what it is for:
|
||||
*
|
||||
* - A page's own background is the paper.
|
||||
* - A neutral colour that reads on its page (3:1 or more) is the ink, or the
|
||||
* muted ink for small grey type. A neutral that does not read on its page,
|
||||
* white words over a photograph, is left alone: it answers to the picture,
|
||||
* not to the paper.
|
||||
* - A coloured one is an accent. The book's coloured inks are ranked by how
|
||||
* often they are used and take accent, accent2 and accent3 in that order,
|
||||
* the same mapping on every page, so two pages that shared a colour still
|
||||
* share one; a fourth goes to whichever of those three it is nearest.
|
||||
* - A fading shape is a scrim over a photo and is left alone.
|
||||
* - Texts take a typeface slot by size: a cover title from 36 pt is display,
|
||||
* anything from 15 pt a heading, the rest body. The travel elements take
|
||||
* the heading face, as the design engine sets them.
|
||||
*
|
||||
* With a previous theme, a colour or face that is (nearly) one of its own is
|
||||
* linked to that entry first, so applying one theme after another keeps
|
||||
* every role it had.
|
||||
*/
|
||||
|
||||
/** Colours closer than this (CIE76) are the same entry of a palette. */
|
||||
const SAME = 6;
|
||||
|
||||
/** A coloured ink to a token, for the whole book. */
|
||||
type BookAdoptionMap = ReadonlyMap<string, BookColorToken>;
|
||||
|
||||
const ACCENTS = ['accent', 'accent2', 'accent3'] as const;
|
||||
|
||||
function isNeutral(hex: string): boolean {
|
||||
const c = parseHex(hex);
|
||||
if (!c) return true;
|
||||
const { s, l } = toHsl(c);
|
||||
return s < 0.15 || l < 0.08 || l > 0.95;
|
||||
}
|
||||
|
||||
/** The token of a previous theme a colour already is, near enough. */
|
||||
function previousToken(hex: string, prev: BookTheme | null): BookColorToken | undefined {
|
||||
if (!prev) return undefined;
|
||||
return BOOK_COLOR_TOKENS.find((t) => deltaE(bookThemeColor(prev, t), hex) < SAME);
|
||||
}
|
||||
|
||||
/** The coloured inks an element is drawn in, as adoption would read them. */
|
||||
function chromaticInks(el: BookElement): string[] {
|
||||
switch (el.kind) {
|
||||
case 'photo':
|
||||
case 'sticker':
|
||||
return [];
|
||||
case 'text':
|
||||
case 'icon':
|
||||
return [el.color];
|
||||
case 'shape':
|
||||
return el.gradient !== 'none' ? [] : [el.fill, el.stroke].filter((c): c is string => c !== null);
|
||||
default:
|
||||
return [el.color, el.accent];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The book's coloured inks to accent tokens, most used first. The previous
|
||||
* theme's own accents keep their tokens; the rest share out what is left.
|
||||
*/
|
||||
export function adoptionMap(doc: BookDocument, prev: BookTheme | null): BookAdoptionMap {
|
||||
const counts = new Map<string, number>();
|
||||
for (const spread of doc.spreads) {
|
||||
for (const el of [...spread.elements, ...spread.parked]) {
|
||||
for (const ink of chromaticInks(el)) {
|
||||
const key = ink.toLowerCase();
|
||||
if (!isNeutral(key)) counts.set(key, (counts.get(key) ?? 0) + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
const map = new Map<string, BookColorToken>();
|
||||
const ranked = [...counts.entries()].sort((a, b) => b[1] - a[1] || a[0].localeCompare(b[0])).map(([c]) => c);
|
||||
for (const c of ranked) {
|
||||
const known = previousToken(c, prev);
|
||||
if (known) map.set(c, known);
|
||||
}
|
||||
const free = ACCENTS.filter((t) => ![...map.values()].includes(t));
|
||||
const firsts: [string, BookColorToken][] = [];
|
||||
for (const c of ranked) {
|
||||
if (map.has(c)) continue;
|
||||
const token = free.shift();
|
||||
if (token) {
|
||||
map.set(c, token);
|
||||
firsts.push([c, token]);
|
||||
continue;
|
||||
}
|
||||
const pool = firsts.length ? firsts : [...map.entries()];
|
||||
const nearest = pool.reduce((best, cur) => (deltaE(cur[0], c) < deltaE(best[0], c) ? cur : best), pool[0]!);
|
||||
map.set(c, nearest[1]);
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
/** What a colour on a page links to, or undefined to leave it as it is. */
|
||||
function inkToken(
|
||||
hex: string,
|
||||
ground: string,
|
||||
map: BookAdoptionMap,
|
||||
prev: BookTheme | null,
|
||||
small = false,
|
||||
): BookColorToken | undefined {
|
||||
const key = hex.toLowerCase();
|
||||
if (!isNeutral(key)) return map.get(key) ?? previousToken(key, prev);
|
||||
const known = previousToken(key, prev);
|
||||
if (known && known !== 'paper') return known;
|
||||
const contrast = contrastRatio(key, ground);
|
||||
if (contrast < 3) return undefined;
|
||||
return small && contrast < 9 ? 'muted' : 'ink';
|
||||
}
|
||||
|
||||
/** The slot a text is set in, by the face it has under the previous theme, else by its size. */
|
||||
function textSlot(font: string, size: number, cover: boolean, prev: BookTheme | null): BookFontSlot {
|
||||
const own = prev ? BOOK_FONT_SLOTS.find((s) => prev.fonts[s]?.font === font) : undefined;
|
||||
if (own && !(own === 'display' && size < 15)) return own;
|
||||
if (size >= 36) return cover ? 'display' : 'heading';
|
||||
return size >= 15 ? 'heading' : 'body';
|
||||
}
|
||||
|
||||
/** The background link a page takes, or none. */
|
||||
function backgroundToken(spread: BookSpread, map: BookAdoptionMap, prev: BookTheme | null): BookColorToken | undefined {
|
||||
if (spread.backgroundPaint && spread.backgroundPaint.type !== 'solid') return undefined;
|
||||
if (spread.background === null) return 'paper';
|
||||
const known = previousToken(spread.background, prev);
|
||||
if (known) return known;
|
||||
if (isNeutral(spread.background)) return 'paper';
|
||||
return map.get(spread.background.toLowerCase());
|
||||
}
|
||||
|
||||
/** An element with links for what it did not link yet. */
|
||||
function adoptElement(
|
||||
el: BookElement,
|
||||
ground: string,
|
||||
cover: boolean,
|
||||
map: BookAdoptionMap,
|
||||
prev: BookTheme | null,
|
||||
): BookElement {
|
||||
if (el.locked) return el;
|
||||
switch (el.kind) {
|
||||
// A sticker keeps the colours of its slots: they are a drawing, not the page's inks.
|
||||
case 'photo':
|
||||
case 'sticker':
|
||||
return el;
|
||||
case 'text': {
|
||||
const token = el.token ?? inkToken(el.color, ground, map, prev, el.size <= 9);
|
||||
const fontRole = el.fontRole ?? textSlot(el.font, el.size, cover, prev);
|
||||
return token === el.token && fontRole === el.fontRole ? el : { ...el, token, fontRole };
|
||||
}
|
||||
case 'shape': {
|
||||
// A scrim over a photo, or a gradient or pattern of the person's own: not the theme's to recolour.
|
||||
if (el.gradient !== 'none' || (el.paint && el.paint.type !== 'solid')) return el;
|
||||
const token = el.token ?? (el.fill !== null ? inkToken(el.fill, ground, map, prev) : undefined);
|
||||
const strokeToken = el.strokeToken ?? (el.stroke !== null ? inkToken(el.stroke, ground, map, prev) : undefined);
|
||||
return token === el.token && strokeToken === el.strokeToken ? el : { ...el, token, strokeToken };
|
||||
}
|
||||
case 'icon': {
|
||||
const token = el.token ?? inkToken(el.color, ground, map, prev);
|
||||
return token === el.token ? el : { ...el, token };
|
||||
}
|
||||
default: {
|
||||
const token = el.token ?? inkToken(el.color, ground, map, prev);
|
||||
const accentToken = el.accentToken ?? inkToken(el.accent, ground, map, prev);
|
||||
const fontRole = el.fontRole ?? (prev?.fonts.body.font === el.font ? 'body' : 'heading');
|
||||
if (token === el.token && accentToken === el.accentToken && fontRole === el.fontRole) return el;
|
||||
return { ...el, token, accentToken, fontRole };
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** Drop the links adoption left undefined, so a document carries no empty keys. */
|
||||
function clean<T extends object>(el: T): T {
|
||||
const out = { ...el } as Record<string, unknown>;
|
||||
for (const key of ['token', 'strokeToken', 'accentToken', 'fontRole', 'backgroundToken']) {
|
||||
if (key in out && out[key] === undefined) delete out[key];
|
||||
}
|
||||
return out as T;
|
||||
}
|
||||
|
||||
/** A page with links for everything adoption can read; the same object when it links nothing new. */
|
||||
export function adoptSpread(spread: BookSpread, map: BookAdoptionMap, prev: BookTheme | null): BookSpread {
|
||||
const ground = spread.background ?? '#ffffff';
|
||||
const cover = spread.role === 'cover';
|
||||
const adopt = (el: BookElement) => {
|
||||
const next = adoptElement(el, ground, cover, map, prev);
|
||||
return next === el ? el : clean(next);
|
||||
};
|
||||
const elements = spread.elements.map(adopt);
|
||||
const parked = spread.parked.map(adopt);
|
||||
const bg = spread.backgroundToken ?? backgroundToken(spread, map, prev);
|
||||
const same =
|
||||
bg === spread.backgroundToken &&
|
||||
elements.every((e, i) => e === spread.elements[i]) &&
|
||||
parked.every((e, i) => e === spread.parked[i]);
|
||||
return same ? spread : clean({ ...spread, backgroundToken: bg, elements, parked });
|
||||
}
|
||||
@@ -0,0 +1,185 @@
|
||||
import {
|
||||
bookDocumentSchema,
|
||||
bookIconElementSchema,
|
||||
bookPhotoElementSchema,
|
||||
bookShapeElementSchema,
|
||||
bookSpreadSchema,
|
||||
bookStatsElementSchema,
|
||||
bookTextElementSchema,
|
||||
type BookDocument,
|
||||
type BookElement,
|
||||
type BookSpread,
|
||||
} from '../book.schema';
|
||||
import { bookThemeColor, bookThemeOf } from './book-theme';
|
||||
import { adoptSpread, adoptionMap } from './book-theme-adopt';
|
||||
import { applyBookTheme, changedSpreadIds, themedElement, themedSpread } from './book-theme-apply';
|
||||
|
||||
import { describe, expect, it } from 'vitest';
|
||||
|
||||
// BKTHAP-001 to BKTHAP-012
|
||||
|
||||
const frame = { x: 10, y: 10, w: 80, h: 20 };
|
||||
const text = (over: Record<string, unknown> = {}) =>
|
||||
bookTextElementSchema.parse({ id: 't1', kind: 'text', frame, text: 'Hello', ...over });
|
||||
const shape = (over: Record<string, unknown> = {}) =>
|
||||
bookShapeElementSchema.parse({ id: 's1', kind: 'shape', frame, ...over });
|
||||
const icon = (over: Record<string, unknown> = {}) =>
|
||||
bookIconElementSchema.parse({ id: 'i1', kind: 'icon', frame, name: 'Compass', ...over });
|
||||
const stats = (over: Record<string, unknown> = {}) =>
|
||||
bookStatsElementSchema.parse({ id: 'st1', kind: 'stats', frame, ...over });
|
||||
const photo = () => bookPhotoElementSchema.parse({ id: 'p1', kind: 'photo', frame, photoId: 3 });
|
||||
const spread = (elements: BookElement[], over: Record<string, unknown> = {}): BookSpread =>
|
||||
bookSpreadSchema.parse({ id: 'sp1', elements, ...over });
|
||||
const book = (spreads: BookSpread[]): BookDocument => bookDocumentSchema.parse({ spreads });
|
||||
|
||||
const tropical = bookThemeOf('tropical');
|
||||
const nordic = bookThemeOf('nordic');
|
||||
|
||||
describe('one element under a theme', () => {
|
||||
it('BKTHAP-001: takes the linked colour and face, and nothing else', () => {
|
||||
const el = text({ token: 'accent', fontRole: 'body', size: 12, color: '#000000' });
|
||||
const done = themedElement(el, tropical);
|
||||
expect(done.color).toBe(tropical.palette.accent);
|
||||
expect(done.font).toBe(tropical.fonts.body.font);
|
||||
expect([done.size, done.text, done.frame]).toEqual([12, 'Hello', frame]);
|
||||
});
|
||||
|
||||
it('BKTHAP-002: leaves an unlinked, locked or photo element as the very same object', () => {
|
||||
const plain = text();
|
||||
expect(themedElement(plain, tropical)).toBe(plain);
|
||||
const locked = text({ token: 'ink', locked: true });
|
||||
expect(themedElement(locked, tropical)).toBe(locked);
|
||||
const pic = photo();
|
||||
expect(themedElement(pic, tropical)).toBe(pic);
|
||||
});
|
||||
|
||||
it('BKTHAP-003: sets a shape fill and stroke, an icon and a travel element ink and accent', () => {
|
||||
const s = themedElement(shape({ token: 'accent2', strokeToken: 'ink', stroke: '#000000', strokeWidth: 1 }), nordic);
|
||||
expect([s.fill, s.stroke]).toEqual([nordic.palette.accent2, nordic.palette.ink]);
|
||||
// A shape with no fill keeps having none: the link waits for a fill to follow.
|
||||
expect(themedElement(shape({ token: 'accent', fill: null }), nordic).fill).toBeNull();
|
||||
expect(themedElement(icon({ token: 'accent3' }), nordic).color).toBe(nordic.palette.accent3);
|
||||
const figures = themedElement(stats({ token: 'muted', accentToken: 'accent', fontRole: 'heading' }), nordic);
|
||||
expect([figures.color, figures.accent, figures.font]).toEqual([
|
||||
bookThemeColor(nordic, 'muted'),
|
||||
nordic.palette.accent,
|
||||
nordic.fonts.heading.font,
|
||||
]);
|
||||
});
|
||||
|
||||
it('BKTHAP-004: sets a script in the theme face, and in the heading face upright when the theme has none', () => {
|
||||
const words = text({ fontRole: 'script' });
|
||||
const scripted = themedElement(words, tropical);
|
||||
expect(scripted.font).toBe(tropical.fonts.script?.font);
|
||||
const minimal = bookThemeOf('minimal-serif');
|
||||
const none = themedElement(text({ fontRole: 'script', italic: true }), minimal);
|
||||
expect([none.font, none.italic]).toEqual([minimal.fonts.heading.font, false]);
|
||||
});
|
||||
});
|
||||
|
||||
describe('a page and a book under a theme', () => {
|
||||
it('BKTHAP-005: recolours a linked background, the paper of a white theme being no background', () => {
|
||||
const page = spread([], { background: '#123456', backgroundToken: 'paper' });
|
||||
expect(themedSpread(page, tropical).background).toBe(tropical.palette.paper);
|
||||
expect(themedSpread(page, bookThemeOf('grid-badge')).background).toBeNull();
|
||||
expect(themedSpread(spread([], { backgroundToken: 'accent' }), nordic).background).toBe(nordic.palette.accent);
|
||||
const still = spread([text()]);
|
||||
expect(themedSpread(still, nordic)).toBe(still);
|
||||
});
|
||||
|
||||
it('BKTHAP-006: keeps the theme on the book, recolours only the pages named, parked elements too', () => {
|
||||
const a = spread([text({ token: 'ink' })], { id: 'a' });
|
||||
const b = spread([text({ token: 'ink' })], { id: 'b', parked: [text({ id: 't2', token: 'accent' })] });
|
||||
const doc = book([a, b]);
|
||||
const done = applyBookTheme(doc, nordic, { spreadIds: ['b'] });
|
||||
expect(done.theme).toEqual(nordic);
|
||||
expect(done.spreads[0]).toBe(doc.spreads[0]);
|
||||
expect(done.spreads[1]?.parked[0]).toMatchObject({ color: nordic.palette.accent });
|
||||
expect(changedSpreadIds(doc, done)).toEqual(['b']);
|
||||
});
|
||||
});
|
||||
|
||||
describe('adopting what is not linked', () => {
|
||||
const page = (elements: BookElement[], over: Record<string, unknown> = {}) => spread(elements, over);
|
||||
|
||||
it('BKTHAP-007: links the paper, dark words to the ink and small grey ones to the muted ink', () => {
|
||||
const dark = text({ id: 'a', color: '#1a1a1a', size: 20 });
|
||||
const grey = text({ id: 'b', color: '#6b6b6b', size: 7 });
|
||||
const sp = page([dark, grey]);
|
||||
const done = adoptSpread(sp, adoptionMap(book([sp]), null), null);
|
||||
expect(done.backgroundToken).toBe('paper');
|
||||
expect(done.elements.map((e) => (e.kind === 'text' ? [e.token, e.fontRole] : null))).toEqual([
|
||||
['ink', 'heading'],
|
||||
['muted', 'body'],
|
||||
]);
|
||||
});
|
||||
|
||||
it('BKTHAP-008: leaves white words over a photo, a scrim and a locked element alone', () => {
|
||||
const white = text({ id: 'w', color: '#ffffff', size: 30 });
|
||||
const scrim = shape({ id: 'sc', fill: '#111111', gradient: 'up' });
|
||||
const locked = text({ id: 'l', color: '#1a1a1a', locked: true });
|
||||
const sp = page([photo(), scrim, white, locked]);
|
||||
const done = adoptSpread(sp, adoptionMap(book([sp]), null), null);
|
||||
const byId = new Map(done.elements.map((e) => [e.id, e]));
|
||||
expect(byId.get('sc')).toBe(scrim);
|
||||
expect(byId.get('l')).toBe(locked);
|
||||
expect((byId.get('w') as BookElement & { token?: string }).token).toBeUndefined();
|
||||
expect('token' in (byId.get('w') as object)).toBe(false);
|
||||
});
|
||||
|
||||
it('BKTHAP-009: takes white words on a dark page as the ink, the page as the paper', () => {
|
||||
const sp = page([text({ color: '#ffffff' })], { background: '#111111' });
|
||||
const done = adoptSpread(sp, adoptionMap(book([sp]), null), null);
|
||||
expect(done.backgroundToken).toBe('paper');
|
||||
expect(done.elements[0]).toMatchObject({ token: 'ink' });
|
||||
});
|
||||
|
||||
it('BKTHAP-010: ranks the book coloured inks into the three accents, a fourth going to the nearest', () => {
|
||||
const els = [
|
||||
shape({ id: 'a', fill: '#c2410c' }),
|
||||
shape({ id: 'b', fill: '#c2410c' }),
|
||||
shape({ id: 'c', fill: '#1e3a8a' }),
|
||||
icon({ id: 'd', color: '#0f766e' }),
|
||||
text({ id: 'e', color: '#1d3d90', size: 30 }),
|
||||
];
|
||||
const sp = page(els);
|
||||
const map = adoptionMap(book([sp]), null);
|
||||
expect(map.get('#c2410c')).toBe('accent');
|
||||
expect(new Set([map.get('#1e3a8a'), map.get('#0f766e'), map.get('#1d3d90')])).toEqual(
|
||||
new Set(['accent2', 'accent3']),
|
||||
);
|
||||
expect(map.get('#1d3d90')).toBe(map.get('#1e3a8a'));
|
||||
});
|
||||
|
||||
it('BKTHAP-011: keeps the roles of a previous theme, its colours and its faces', () => {
|
||||
const prev = bookThemeOf('postcard');
|
||||
const els = [
|
||||
text({ id: 'a', color: prev.palette.accent2, font: prev.fonts.display.font, size: 40 }),
|
||||
shape({ id: 'b', fill: prev.palette.accent3 }),
|
||||
];
|
||||
const sp = page(els, { background: prev.palette.paper, role: 'cover' });
|
||||
const done = adoptSpread(sp, adoptionMap(book([sp]), prev), prev);
|
||||
expect(done.backgroundToken).toBe('paper');
|
||||
expect(done.elements[0]).toMatchObject({ token: 'accent2', fontRole: 'display' });
|
||||
expect(done.elements[1]).toMatchObject({ token: 'accent3' });
|
||||
});
|
||||
|
||||
it('BKTHAP-012: adopts on apply, so a book made by hand takes the theme, and a cover title its display face', () => {
|
||||
const title = text({ id: 'title', color: '#1a1a1a', size: 48 });
|
||||
const sp = page([title], { role: 'cover' });
|
||||
const done = applyBookTheme(book([sp]), tropical, { adopt: true });
|
||||
const cover = done.spreads[0] as BookSpread;
|
||||
expect(cover.background).toBe(tropical.palette.paper);
|
||||
expect(cover.elements[0]).toMatchObject({
|
||||
token: 'ink',
|
||||
fontRole: 'display',
|
||||
color: tropical.palette.ink,
|
||||
font: tropical.fonts.display.font,
|
||||
});
|
||||
// Without adopt, nothing was linked, and only the theme is kept.
|
||||
const doc = book([sp]);
|
||||
const plain = applyBookTheme(doc, tropical);
|
||||
expect(plain.spreads[0]).toBe(doc.spreads[0]);
|
||||
expect(plain.theme).toEqual(tropical);
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,153 @@
|
||||
import { withRealWeight } from '../book-fonts';
|
||||
import {
|
||||
bookTextElementSchema,
|
||||
type BookDocument,
|
||||
type BookElement,
|
||||
type BookSpread,
|
||||
type BookTextElement,
|
||||
} from '../book.schema';
|
||||
import { bookThemeColor, bookThemeFont, isBookFontFamily, themePaperBackground } from './book-theme';
|
||||
import { adoptSpread, adoptionMap } from './book-theme-adopt';
|
||||
import type { BookColorToken, BookFontSlot, BookTheme, BookThemeFont } from './book-theme.schema';
|
||||
|
||||
/**
|
||||
* Applying a theme to a book: every linked colour takes the theme's value,
|
||||
* every linked text its face, and nothing else moves. Positions, sizes,
|
||||
* photos, words and every colour nobody linked stay exactly as they were, so
|
||||
* a theme can be tried and tried again without the pages drifting.
|
||||
*
|
||||
* With `adopt`, what is not linked yet is linked first (book-theme-adopt.ts),
|
||||
* which is how a book made before themes, or by hand, takes one at all.
|
||||
* Locked elements are left as they are, as every other edit leaves them.
|
||||
*/
|
||||
|
||||
export interface ApplyBookThemeOptions {
|
||||
/** Only these pages; every page when left out. */
|
||||
spreadIds?: readonly string[];
|
||||
/** Link what is not linked yet before recolouring. */
|
||||
adopt?: boolean;
|
||||
}
|
||||
|
||||
const weightSchema = bookTextElementSchema.shape.weight.unwrap();
|
||||
|
||||
/** The weight a face asks for, when this build's text takes it; otherwise the element keeps its own. */
|
||||
function weightOf(face: BookThemeFont): Partial<Pick<BookTextElement, 'weight'>> {
|
||||
if (face.weight === undefined) return {};
|
||||
const parsed = weightSchema.safeParse(face.weight);
|
||||
return parsed.success ? { weight: parsed.data } : {};
|
||||
}
|
||||
|
||||
/** The fields a face sets on a typeset element. */
|
||||
function faceFields(face: BookThemeFont | null): Record<string, unknown> {
|
||||
// A family this build does not set (a theme from a newer one) leaves the text in its own.
|
||||
if (!face || !isBookFontFamily(face.font)) return {};
|
||||
return { font: face.font, ...weightOf(face), ...(face.italic !== undefined ? { italic: face.italic } : {}) };
|
||||
}
|
||||
|
||||
/** A face for a slot; a theme without a script sets script words in its heading face, upright. */
|
||||
function slotFace(theme: BookTheme, slot: BookFontSlot): BookThemeFont | null {
|
||||
return bookThemeFont(theme, slot) ?? { ...theme.fonts.heading, italic: false };
|
||||
}
|
||||
|
||||
/** Set `key` to the token's colour when the element links it. */
|
||||
function tokenColour(
|
||||
next: Record<string, unknown>,
|
||||
theme: BookTheme,
|
||||
key: string,
|
||||
token: BookColorToken | undefined,
|
||||
): void {
|
||||
if (token) next[key] = bookThemeColor(theme, token);
|
||||
}
|
||||
|
||||
/** One element as the theme sets it: its linked colours and its linked face, the rest as it was. */
|
||||
export function themedElement<E extends BookElement>(el: E, theme: BookTheme): E {
|
||||
if (el.locked) return el;
|
||||
const next: Record<string, unknown> = { ...el };
|
||||
switch (el.kind) {
|
||||
case 'photo':
|
||||
case 'sticker':
|
||||
return el;
|
||||
case 'text': {
|
||||
tokenColour(next, theme, 'color', el.token);
|
||||
if (el.fontRole) Object.assign(next, faceFields(slotFace(theme, el.fontRole)));
|
||||
break;
|
||||
}
|
||||
case 'shape':
|
||||
if (el.token && el.fill !== null) {
|
||||
tokenColour(next, theme, 'fill', el.token);
|
||||
// A flat paint is the fill with an alpha: it follows too. A gradient or a pattern stays the person's.
|
||||
const color = bookThemeColor(theme, el.token);
|
||||
if (el.paint?.type === 'solid' && el.paint.color !== color) next.paint = { ...el.paint, color };
|
||||
}
|
||||
if (el.strokeToken && el.stroke !== null) tokenColour(next, theme, 'stroke', el.strokeToken);
|
||||
break;
|
||||
case 'icon':
|
||||
tokenColour(next, theme, 'color', el.token);
|
||||
break;
|
||||
default: {
|
||||
tokenColour(next, theme, 'color', el.token);
|
||||
tokenColour(next, theme, 'accent', el.accentToken);
|
||||
if (el.fontRole) {
|
||||
const { italic: _upright, ...face } = faceFields(slotFace(theme, el.fontRole));
|
||||
Object.assign(next, face);
|
||||
}
|
||||
}
|
||||
}
|
||||
// A face the theme sets without a weight keeps the element's, moved onto one the family has.
|
||||
const out = 'fontRole' in el && el.fontRole ? withRealWeight(next as E) : (next as E);
|
||||
const changed = Object.keys(out).some(
|
||||
(k) => (out as Record<string, unknown>)[k] !== (el as Record<string, unknown>)[k],
|
||||
);
|
||||
return changed ? out : el;
|
||||
}
|
||||
|
||||
/** A page as the theme sets it; the very same object when nothing on it is linked. */
|
||||
export function themedSpread(spread: BookSpread, theme: BookTheme): BookSpread {
|
||||
const elements = spread.elements.map((e) => themedElement(e, theme));
|
||||
const parked = spread.parked.map((e) => themedElement(e, theme));
|
||||
const background = spread.backgroundToken
|
||||
? spread.backgroundToken === 'paper'
|
||||
? themePaperBackground(theme)
|
||||
: bookThemeColor(theme, spread.backgroundToken)
|
||||
: spread.background;
|
||||
// A flat paint on the page follows its link too; on a white paper it goes, the paper being the page.
|
||||
const paint = spread.backgroundPaint;
|
||||
const flat = spread.backgroundToken !== undefined && paint?.type === 'solid';
|
||||
const backgroundPaint =
|
||||
flat && paint?.type === 'solid'
|
||||
? background === null
|
||||
? undefined
|
||||
: paint.color === background
|
||||
? paint
|
||||
: { ...paint, color: background }
|
||||
: paint;
|
||||
const same =
|
||||
background === spread.background &&
|
||||
backgroundPaint === spread.backgroundPaint &&
|
||||
elements.every((e, i) => e === spread.elements[i]) &&
|
||||
parked.every((e, i) => e === spread.parked[i]);
|
||||
if (same) return spread;
|
||||
const { backgroundPaint: _old, ...rest } = spread;
|
||||
return { ...rest, background, ...(backgroundPaint ? { backgroundPaint } : {}), elements, parked };
|
||||
}
|
||||
|
||||
/**
|
||||
* The book with the theme applied to the pages named (all by default) and
|
||||
* kept as the book's theme. Pages the theme leaves as they were keep their
|
||||
* identity, so a caller can tell which ones changed.
|
||||
*/
|
||||
export function applyBookTheme(doc: BookDocument, theme: BookTheme, options: ApplyBookThemeOptions = {}): BookDocument {
|
||||
const only = options.spreadIds ? new Set(options.spreadIds) : null;
|
||||
const map = options.adopt ? adoptionMap(doc, doc.theme ?? null) : null;
|
||||
const spreads = doc.spreads.map((spread) => {
|
||||
if (only && !only.has(spread.id)) return spread;
|
||||
const linked = map ? adoptSpread(spread, map, doc.theme ?? null) : spread;
|
||||
return themedSpread(linked, theme);
|
||||
});
|
||||
return { ...doc, theme, spreads };
|
||||
}
|
||||
|
||||
/** The ids of the pages whose content differs between two versions of a book, by identity. */
|
||||
export function changedSpreadIds(before: BookDocument, after: BookDocument): string[] {
|
||||
return after.spreads.filter((s, i) => before.spreads[i] !== s).map((s) => s.id);
|
||||
}
|
||||
@@ -0,0 +1,99 @@
|
||||
import { contrastRatio } from '../book-colour';
|
||||
import { blankBook } from '../book-pages';
|
||||
import {
|
||||
bookIconElementSchema,
|
||||
bookMapElementSchema,
|
||||
bookShapeElementSchema,
|
||||
bookTextElementSchema,
|
||||
type BookSpread,
|
||||
} from '../book.schema';
|
||||
import { describeSpread } from '../describe-spread';
|
||||
import { bookThemeOf } from './book-theme';
|
||||
import { bookThemeCatalogue, bookThemeLine, themeBackgroundWords, themeLinkWords } from './book-theme-describe';
|
||||
import { bookPaletteFromPhotos } from './book-theme-photos';
|
||||
import { BOOK_THEME_IDS } from './book-theme.schema';
|
||||
|
||||
import { describe, expect, it } from 'vitest';
|
||||
|
||||
// BKTHDS-001 to BKTHDS-006
|
||||
|
||||
const frame = { x: 1, y: 1, w: 10, h: 10 };
|
||||
|
||||
describe('the theme in words', () => {
|
||||
it('BKTHDS-001: says which theme a book is in, its colours, faces, motifs and decoration', () => {
|
||||
const line = bookThemeLine(bookThemeOf('india-stamp'));
|
||||
expect(line).toMatch(/^Theme: india-stamp \(Stamp collage:/);
|
||||
expect(line).toContain('accent #bd2275');
|
||||
expect(line).toContain('motifs asia, ephemera; decoration rich.');
|
||||
expect(bookThemeLine(bookThemeOf('minimal-serif'))).toContain('script none');
|
||||
expect(bookThemeLine({ ...bookThemeOf('nordic'), id: null, motifs: [] })).toMatch(/^Theme: its own;.*motifs none/);
|
||||
expect(bookThemeLine(undefined)).toBe('Theme: none yet (set_book_theme applies one).');
|
||||
});
|
||||
|
||||
it('BKTHDS-002: says what each element and the page follow', () => {
|
||||
const t = bookTextElementSchema.parse({ id: 't', kind: 'text', frame, token: 'accent', fontRole: 'display' });
|
||||
expect(themeLinkWords(t)).toBe('follows the theme: colour accent, display face');
|
||||
const s = bookShapeElementSchema.parse({ id: 's', kind: 'shape', frame, token: 'paper', strokeToken: 'ink' });
|
||||
expect(themeLinkWords(s)).toBe('follows the theme: fill paper, stroke ink');
|
||||
const m = bookMapElementSchema.parse({ id: 'm', kind: 'map', frame, accentToken: 'accent2' });
|
||||
expect(themeLinkWords(m)).toBe('follows the theme: accent accent2');
|
||||
expect(themeLinkWords(bookIconElementSchema.parse({ id: 'i', kind: 'icon', frame, name: 'Sun' }))).toBe('');
|
||||
expect(themeBackgroundWords({ backgroundToken: 'paper' } as BookSpread)).toBe(" It follows the theme's paper.");
|
||||
});
|
||||
|
||||
it('BKTHDS-003: describe_book_page carries the theme line and the links', () => {
|
||||
const doc = blankBook({ title: 'T', newId: (p) => `${p}-1` });
|
||||
const cover = doc.spreads[0] as BookSpread;
|
||||
const themed = {
|
||||
...doc,
|
||||
theme: bookThemeOf('alpine'),
|
||||
spreads: [
|
||||
{
|
||||
...cover,
|
||||
backgroundToken: 'paper' as const,
|
||||
elements: [bookTextElementSchema.parse({ id: 'tt', kind: 'text', frame, text: 'Hi', token: 'ink' })],
|
||||
},
|
||||
],
|
||||
};
|
||||
const text = describeSpread(themed, cover.id)?.text ?? '';
|
||||
expect(text).toContain('Theme: alpine');
|
||||
expect(text).toContain("It follows the theme's paper.");
|
||||
expect(text).toContain('follows the theme: colour ink');
|
||||
});
|
||||
|
||||
it('BKTHDS-004: lists every built-in theme for the tool description', () => {
|
||||
const catalogue = bookThemeCatalogue();
|
||||
for (const id of BOOK_THEME_IDS) expect(catalogue).toContain(`${id}:`);
|
||||
});
|
||||
});
|
||||
|
||||
describe('a palette from the photos', () => {
|
||||
const base = bookThemeOf('minimal-serif').palette;
|
||||
|
||||
it('BKTHDS-005: takes the most shared colours as accents, the first readable on the paper', () => {
|
||||
const photos = [
|
||||
[
|
||||
{ hex: '#f2d35a', share: 0.5 },
|
||||
{ hex: '#2f6db0', share: 0.3 },
|
||||
{ hex: '#808080', share: 0.2 },
|
||||
],
|
||||
[
|
||||
{ hex: '#f0d058', share: 0.4 },
|
||||
{ hex: '#3a8a3a', share: 0.4 },
|
||||
],
|
||||
];
|
||||
const palette = bookPaletteFromPhotos(base, photos);
|
||||
expect(palette?.paper).toBe(base.paper);
|
||||
expect(palette?.ink).toBe(base.ink);
|
||||
expect(contrastRatio(palette?.accent ?? '#ffffff', base.paper)).toBeGreaterThanOrEqual(3);
|
||||
expect([palette?.accent2, palette?.accent3]).toEqual(['#3a8a3a', '#2f6db0']);
|
||||
});
|
||||
|
||||
it('BKTHDS-006: gives nothing for grey photos, and derives the missing accents from one colour', () => {
|
||||
expect(bookPaletteFromPhotos(base, [[{ hex: '#777777', share: 1 }]])).toBeNull();
|
||||
const one = bookPaletteFromPhotos(base, [[{ hex: '#1f6fbf', share: 1 }]]);
|
||||
expect(one?.accent).toBe('#1f6fbf');
|
||||
expect(one?.accent2).not.toBe(one?.accent);
|
||||
expect(one?.accent3).not.toBe(one?.accent2);
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,43 @@
|
||||
import type { BookElement, BookSpread } from '../book.schema';
|
||||
import { bookThemeColor, bookThemePreset } from './book-theme';
|
||||
import type { BookTheme, BookThemeFont } from './book-theme.schema';
|
||||
import { BOOK_THEME_PRESETS } from './book-themes.data';
|
||||
|
||||
/**
|
||||
* The theme in words, for a model that reads a page as text: which theme the
|
||||
* book is in, and what each element and the page follow of it.
|
||||
*/
|
||||
|
||||
const face = (f: BookThemeFont | null) =>
|
||||
f ? `${f.font}${f.weight ? ` ${f.weight}` : ''}${f.italic ? ' italic' : ''}` : 'none';
|
||||
|
||||
/** One line on the book's theme, or how to give it one. */
|
||||
export function bookThemeLine(theme: BookTheme | undefined): string {
|
||||
if (!theme) return 'Theme: none yet (set_book_theme applies one).';
|
||||
const name = theme.id ? `${theme.id} (${bookThemePreset(theme.id)?.descr ?? ''})` : 'its own';
|
||||
const p = theme.palette;
|
||||
const fonts = `display ${face(theme.fonts.display)}, heading ${face(theme.fonts.heading)}, body ${face(theme.fonts.body)}, script ${face(theme.fonts.script)}`;
|
||||
const motifs = theme.motifs.length ? theme.motifs.join(', ') : 'none';
|
||||
return `Theme: ${name}; paper ${p.paper}, ink ${p.ink}, muted ${bookThemeColor(theme, 'muted')}, accent ${p.accent}, accent2 ${p.accent2}, accent3 ${p.accent3}; ${fonts}; motifs ${motifs}; decoration ${theme.decoration}.`;
|
||||
}
|
||||
|
||||
/** What an element follows of the theme, as words for its line ('' when nothing). */
|
||||
export function themeLinkWords(el: BookElement): string {
|
||||
if (el.kind === 'photo' || el.kind === 'sticker') return '';
|
||||
const parts: string[] = [];
|
||||
if (el.token) parts.push(`${el.kind === 'shape' ? 'fill' : 'colour'} ${el.token}`);
|
||||
if (el.kind === 'shape' && el.strokeToken) parts.push(`stroke ${el.strokeToken}`);
|
||||
if ('accentToken' in el && el.accentToken) parts.push(`accent ${el.accentToken}`);
|
||||
if ('fontRole' in el && el.fontRole) parts.push(`${el.fontRole} face`);
|
||||
return parts.length ? `follows the theme: ${parts.join(', ')}` : '';
|
||||
}
|
||||
|
||||
/** What a page's background follows of the theme ('' when nothing). */
|
||||
export function themeBackgroundWords(spread: BookSpread): string {
|
||||
return spread.backgroundToken ? ` It follows the theme's ${spread.backgroundToken}.` : '';
|
||||
}
|
||||
|
||||
/** The built-in themes in one line each, for a tool description. */
|
||||
export function bookThemeCatalogue(): string {
|
||||
return BOOK_THEME_PRESETS.map((p) => `${p.id}: ${p.descr}`).join(' ');
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
import type { BookElement } from '../book.schema';
|
||||
import { themedElement } from './book-theme-apply';
|
||||
import type { BookTheme } from './book-theme.schema';
|
||||
|
||||
/**
|
||||
* Keeping an element's theme links honest when it is edited: one rule for
|
||||
* the inspector and for the `add` and `style` operations alike.
|
||||
*
|
||||
* - A colour set by hand, without its link in the same change, unlinks it:
|
||||
* the person chose that colour, and the next theme must not take it away.
|
||||
* A face chosen by hand unlinks `fontRole` the same way.
|
||||
* - A link set in the change takes the theme's value at once, when the book
|
||||
* has a theme, so linking and recolouring are one step.
|
||||
* - A link set to null is taken away, and the colour stays as it is.
|
||||
*/
|
||||
|
||||
/** Which link each colour or face field has, per kind. */
|
||||
const LINKS: Record<string, readonly (readonly [field: string, link: string])[]> = {
|
||||
text: [
|
||||
['color', 'token'],
|
||||
['font', 'fontRole'],
|
||||
],
|
||||
icon: [['color', 'token']],
|
||||
photo: [],
|
||||
sticker: [],
|
||||
shape: [
|
||||
['fill', 'token'],
|
||||
['paint', 'token'],
|
||||
['stroke', 'strokeToken'],
|
||||
],
|
||||
typeset: [
|
||||
['color', 'token'],
|
||||
['accent', 'accentToken'],
|
||||
['font', 'fontRole'],
|
||||
],
|
||||
};
|
||||
|
||||
const linksOf = (kind: BookElement['kind']) => LINKS[kind] ?? (LINKS.typeset as readonly (readonly [string, string])[]);
|
||||
|
||||
/** The link fields of an element's kind, for a caller that strips or lists them. */
|
||||
export function themeLinkFields(kind: BookElement['kind']): string[] {
|
||||
return [...new Set(linksOf(kind).map(([, link]) => link))];
|
||||
}
|
||||
|
||||
/**
|
||||
* The element as the change leaves it, its links kept in step: `el` already
|
||||
* carries the change, `change` is what was asked, `theme` the book's own.
|
||||
*/
|
||||
export function withThemeLinks<E extends BookElement>(
|
||||
el: E,
|
||||
change: Readonly<Record<string, unknown>>,
|
||||
theme: BookTheme | undefined,
|
||||
): E {
|
||||
const next: Record<string, unknown> = { ...el };
|
||||
let linked = false;
|
||||
for (const [field, link] of linksOf(el.kind)) {
|
||||
const asked = change[link];
|
||||
if (asked === null) delete next[link];
|
||||
else if (asked !== undefined) linked = true;
|
||||
else if (change[field] !== undefined) delete next[link];
|
||||
}
|
||||
const out = next as E;
|
||||
return linked && theme ? themedElement(out, theme) : out;
|
||||
}
|
||||
@@ -0,0 +1,167 @@
|
||||
import { applyBookOps } from '../book-ops';
|
||||
import { blankBook } from '../book-pages';
|
||||
import {
|
||||
bookShapeElementSchema,
|
||||
bookTextElementSchema,
|
||||
type BookDocument,
|
||||
type BookElement,
|
||||
type BookSpread,
|
||||
} from '../book.schema';
|
||||
import { bookThemeColor, bookThemeOf } from './book-theme';
|
||||
import { themeLinkFields, withThemeLinks } from './book-theme-links';
|
||||
import { requestedBookTheme, setBookTheme } from './book-theme-ops';
|
||||
|
||||
import { describe, expect, it } from 'vitest';
|
||||
|
||||
// BKTHOP-001 to BKTHOP-010
|
||||
|
||||
const frame = { x: 230, y: 20, w: 100, h: 20 };
|
||||
const text = (over: Record<string, unknown> = {}) =>
|
||||
bookTextElementSchema.parse({ id: 't-1', kind: 'text', frame, text: 'Hello', ...over }) as BookElement;
|
||||
|
||||
function book(elements: BookElement[] = [text({ color: '#1a1a1a' })]): BookDocument {
|
||||
const doc = blankBook({ title: 'Iceland', newId: (p) => `${p}-x` });
|
||||
const ids = ['sp-cover', 'sp-first', 'sp-in', 'sp-last', 'sp-back'];
|
||||
const spreads = doc.spreads.map((s, i) => ({ ...s, id: ids[i] as string }));
|
||||
spreads[2] = { ...(spreads[2] as BookSpread), elements };
|
||||
return { ...doc, spreads };
|
||||
}
|
||||
|
||||
function ok<R extends { ok: boolean }>(result: R): Extract<R, { ok: true }> {
|
||||
if (!result.ok) throw new Error(JSON.stringify(result));
|
||||
return result as Extract<R, { ok: true }>;
|
||||
}
|
||||
|
||||
const inner = (doc: BookDocument) => doc.spreads[2] as BookSpread;
|
||||
|
||||
describe('set_book_theme', () => {
|
||||
it('BKTHOP-001: applies a built-in theme to the whole book, adopting what is not linked, and names the pages', () => {
|
||||
const done = ok(setBookTheme(book(), { theme: 'alpine' }));
|
||||
const alpine = bookThemeOf('alpine');
|
||||
expect(done.doc.theme).toEqual(alpine);
|
||||
expect(inner(done.doc).elements[0]).toMatchObject({ token: 'ink', color: alpine.palette.ink });
|
||||
expect(inner(done.doc).background).toBe(alpine.palette.paper);
|
||||
expect(done.spreadIds).toEqual(['sp-cover', 'sp-first', 'sp-in', 'sp-last', 'sp-back']);
|
||||
});
|
||||
|
||||
it('BKTHOP-002: applies to the pages named only, and refuses a page the book does not have', () => {
|
||||
const done = ok(setBookTheme(book(), { theme: 'nordic', spreadIds: ['sp-in'] }));
|
||||
expect(done.spreadIds).toEqual(['sp-in']);
|
||||
expect(setBookTheme(book(), { theme: 'nordic', spreadIds: ['sp-gone'] })).toMatchObject({
|
||||
ok: false,
|
||||
error: { code: 'spread_not_found' },
|
||||
});
|
||||
});
|
||||
|
||||
it('BKTHOP-003: changes what is named on top of the theme, and of the book own theme when none is named', () => {
|
||||
const first = ok(setBookTheme(book(), { theme: 'riviera', palette: { accent: '#aa0000' }, decoration: 'rich' }));
|
||||
expect([first.doc.theme?.palette.accent, first.doc.theme?.decoration, first.doc.theme?.id]).toEqual([
|
||||
'#aa0000',
|
||||
'rich',
|
||||
'riviera',
|
||||
]);
|
||||
const second = ok(
|
||||
setBookTheme(first.doc, { fonts: { body: { font: 'garamond' }, script: null }, motifs: ['sea'] }),
|
||||
);
|
||||
expect(second.doc.theme).toMatchObject({
|
||||
palette: { accent: '#aa0000' },
|
||||
fonts: { body: { font: 'garamond' }, script: null },
|
||||
motifs: ['sea'],
|
||||
});
|
||||
});
|
||||
|
||||
it('BKTHOP-004: refuses what it cannot do: no theme to start from, an unknown face, a missing slot, a bad shape', () => {
|
||||
expect(setBookTheme(book(), { palette: { ink: '#000000' } })).toMatchObject({ error: { code: 'invalid_op' } });
|
||||
expect(setBookTheme(book(), { theme: 'nordic', fonts: { heading: { font: 'comic' } } })).toMatchObject({
|
||||
error: { code: 'invalid_op' },
|
||||
});
|
||||
expect(setBookTheme(book(), { theme: 'nordic', fonts: { heading: null } })).toMatchObject({ ok: false });
|
||||
expect(requestedBookTheme(book(), { theme: 'nordic', fonts: { display: null as never } })).toBe(
|
||||
'the display face cannot be left out',
|
||||
);
|
||||
expect(setBookTheme(book(), { theme: 'nordic', adopt: 'yes' })).toMatchObject({ error: { code: 'invalid_op' } });
|
||||
});
|
||||
|
||||
it('BKTHOP-005: hands the very same book back when the theme it applies changes nothing', () => {
|
||||
const once = ok(setBookTheme(book(), { theme: 'tropical' })).doc;
|
||||
const again = ok(setBookTheme(once, { theme: 'tropical' }));
|
||||
expect(again.doc).toBe(once);
|
||||
expect(again.spreadIds).toEqual([]);
|
||||
});
|
||||
|
||||
it('BKTHOP-006: without adopt, recolours only what was linked', () => {
|
||||
const doc = book([text({ color: '#1a1a1a' }), text({ id: 't-2', token: 'accent' })]);
|
||||
const done = ok(setBookTheme(doc, { theme: 'cutout', adopt: false }));
|
||||
const [plain, linked] = inner(done.doc).elements;
|
||||
expect(plain).toMatchObject({ color: '#1a1a1a' });
|
||||
expect(linked).toMatchObject({ color: bookThemeOf('cutout').palette.accent });
|
||||
});
|
||||
});
|
||||
|
||||
describe('the links when an element is edited', () => {
|
||||
const nordic = bookThemeOf('nordic');
|
||||
|
||||
it('BKTHOP-007: a colour or face set by hand unlinks it; a link set takes the theme value', () => {
|
||||
const el = text({ token: 'accent', fontRole: 'heading' });
|
||||
const recoloured = withThemeLinks({ ...el, color: '#123456' } as BookElement, { color: '#123456' }, nordic);
|
||||
expect('token' in recoloured).toBe(false);
|
||||
expect(recoloured).toMatchObject({ fontRole: 'heading' });
|
||||
const refaced = withThemeLinks({ ...el, font: 'serif' } as BookElement, { font: 'serif' }, nordic);
|
||||
expect('fontRole' in refaced).toBe(false);
|
||||
const linked = withThemeLinks({ ...text(), token: 'accent2' } as BookElement, { token: 'accent2' }, nordic);
|
||||
expect(linked).toMatchObject({ color: nordic.palette.accent2 });
|
||||
// Without a theme the link is kept for the theme to come, the colour as it is.
|
||||
const waiting = withThemeLinks({ ...text(), token: 'accent2' } as BookElement, { token: 'accent2' }, undefined);
|
||||
expect(waiting).toMatchObject({ token: 'accent2', color: '#1a1a1a' });
|
||||
const unlinked = withThemeLinks({ ...el, token: null } as unknown as BookElement, { token: null }, nordic);
|
||||
expect('token' in unlinked).toBe(false);
|
||||
});
|
||||
|
||||
it('BKTHOP-008: names the link fields of each kind', () => {
|
||||
expect(themeLinkFields('text')).toEqual(['token', 'fontRole']);
|
||||
expect(themeLinkFields('shape')).toEqual(['token', 'strokeToken']);
|
||||
expect(themeLinkFields('map')).toEqual(['token', 'accentToken', 'fontRole']);
|
||||
expect(themeLinkFields('photo')).toEqual([]);
|
||||
});
|
||||
|
||||
it('BKTHOP-009: the style and add operations link, unlink and recolour like the inspector', () => {
|
||||
const doc = ok(setBookTheme(book(), { theme: 'nordic' })).doc;
|
||||
const styled = ok(
|
||||
applyBookOps(doc, {
|
||||
spreadId: 'sp-in',
|
||||
ops: [
|
||||
{ op: 'style', elementId: 't-1', set: { kind: 'text', token: 'accent3' } },
|
||||
{ op: 'add', element: { kind: 'shape', shape: 'rect', token: 'accent' } },
|
||||
],
|
||||
}),
|
||||
);
|
||||
const [words, block] = inner(styled.doc).elements;
|
||||
expect(words).toMatchObject({ token: 'accent3', color: nordic.palette.accent3 });
|
||||
expect(block).toMatchObject({ token: 'accent', fill: nordic.palette.accent });
|
||||
const handPicked = ok(
|
||||
applyBookOps(styled.doc, {
|
||||
spreadId: 'sp-in',
|
||||
ops: [{ op: 'style', elementId: 't-1', set: { kind: 'text', color: '#00ff00' } }],
|
||||
}),
|
||||
);
|
||||
expect('token' in (inner(handPicked.doc).elements[0] as object)).toBe(false);
|
||||
const cleared = ok(
|
||||
applyBookOps(styled.doc, {
|
||||
spreadId: 'sp-in',
|
||||
ops: [{ op: 'style', elementId: 't-1', set: { kind: 'text', token: null } }],
|
||||
}),
|
||||
);
|
||||
expect(inner(cleared.doc).elements[0]).toMatchObject({ color: nordic.palette.accent3 });
|
||||
expect('token' in (inner(cleared.doc).elements[0] as object)).toBe(false);
|
||||
expect(bookShapeElementSchema.safeParse(block).success).toBe(true);
|
||||
});
|
||||
|
||||
it('BKTHOP-010: a background set by hand stops following the paper', () => {
|
||||
const doc = ok(setBookTheme(book(), { theme: 'nordic' })).doc;
|
||||
expect(inner(doc).backgroundToken).toBe('paper');
|
||||
const set = ok(applyBookOps(doc, { spreadId: 'sp-in', ops: [{ op: 'background', color: '#ff0000' }] }));
|
||||
expect(inner(set.doc)).toMatchObject({ background: '#ff0000' });
|
||||
expect('backgroundToken' in inner(set.doc)).toBe(false);
|
||||
expect(bookThemeColor(nordic, 'paper')).toBe(nordic.palette.paper);
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,79 @@
|
||||
import { invalidOp, type BookEditResult, type BookOpError } from '../book-ops-core';
|
||||
import type { BookDocument } from '../book.schema';
|
||||
import { bookThemeFromPreset, bookThemePreset, isBookFontFamily } from './book-theme';
|
||||
import { applyBookTheme, changedSpreadIds } from './book-theme-apply';
|
||||
import {
|
||||
BOOK_FONT_SLOTS,
|
||||
setBookThemeRequestSchema,
|
||||
type BookTheme,
|
||||
type BookThemeFont,
|
||||
type SetBookThemeRequest,
|
||||
} from './book-theme.schema';
|
||||
|
||||
/**
|
||||
* `set_book_theme`, the one way the Studio's Theme panel and the assistant
|
||||
* apply a theme: a built-in theme or the book's own, with whatever colours,
|
||||
* faces, motifs or decoration are named changed on top, applied to the whole
|
||||
* book or to the pages named. The answer names the pages it recoloured.
|
||||
*/
|
||||
|
||||
const refused = (code: BookOpError['code'], message: string): BookEditResult => ({
|
||||
ok: false,
|
||||
error: { code, message, opIndex: null },
|
||||
});
|
||||
|
||||
/** The faces named, on top of the theme's own; an unknown family is a refusal the model can act on. */
|
||||
function withFonts(base: BookTheme, fonts: SetBookThemeRequest['fonts']): BookTheme | string {
|
||||
if (!fonts) return base;
|
||||
const next = { ...base.fonts };
|
||||
for (const slot of BOOK_FONT_SLOTS) {
|
||||
const face = fonts[slot];
|
||||
if (face === undefined) continue;
|
||||
if (face === null) {
|
||||
if (slot !== 'script') return `the ${slot} face cannot be left out`;
|
||||
next.script = null;
|
||||
continue;
|
||||
}
|
||||
if (!isBookFontFamily(face.font)) return `there is no font ${face.font}; use one of the font ids`;
|
||||
const set: BookThemeFont = { font: face.font };
|
||||
if (face.weight !== undefined) set.weight = face.weight;
|
||||
if (face.italic !== undefined) set.italic = face.italic;
|
||||
next[slot] = set;
|
||||
}
|
||||
return { ...base, fonts: next };
|
||||
}
|
||||
|
||||
/** The theme a request asks for: the preset or the book's own, with what it names changed. */
|
||||
export function requestedBookTheme(doc: BookDocument, args: SetBookThemeRequest): BookTheme | string {
|
||||
const preset = args.theme ? bookThemePreset(args.theme) : undefined;
|
||||
const base = preset ? bookThemeFromPreset(preset) : doc.theme;
|
||||
if (!base) return 'this book has no theme yet: name one with theme';
|
||||
const fonted = withFonts(base, args.fonts);
|
||||
if (typeof fonted === 'string') return fonted;
|
||||
return {
|
||||
...fonted,
|
||||
palette: { ...fonted.palette, ...stripUndefined(args.palette ?? {}) },
|
||||
...(args.motifs ? { motifs: [...new Set(args.motifs)] } : {}),
|
||||
...(args.decoration ? { decoration: args.decoration } : {}),
|
||||
};
|
||||
}
|
||||
|
||||
function stripUndefined<T extends Record<string, string | undefined>>(o: T): Record<string, string> {
|
||||
return Object.fromEntries(Object.entries(o).filter((e): e is [string, string] => e[1] !== undefined));
|
||||
}
|
||||
|
||||
/** Apply a theme to a book, as `set_book_theme` takes it. Adopts what is not linked yet unless told not to. */
|
||||
export function setBookTheme(doc: BookDocument, args: unknown): BookEditResult {
|
||||
const parsed = setBookThemeRequestSchema.safeParse(args);
|
||||
if (!parsed.success) return { ok: false, error: invalidOp(parsed.error, null) };
|
||||
const a = parsed.data;
|
||||
const missing = a.spreadIds?.find((id) => !doc.spreads.some((s) => s.id === id));
|
||||
if (missing) return refused('spread_not_found', `no page ${missing}`);
|
||||
const theme = requestedBookTheme(doc, a);
|
||||
if (typeof theme === 'string') return refused('invalid_op', theme);
|
||||
const next = applyBookTheme(doc, theme, { spreadIds: a.spreadIds, adopt: a.adopt ?? true });
|
||||
const spreadIds = changedSpreadIds(doc, next);
|
||||
// Nothing moved: the very same document back, so the server writes nothing.
|
||||
const same = spreadIds.length === 0 && JSON.stringify(doc.theme) === JSON.stringify(theme);
|
||||
return { ok: true, doc: same ? doc : next, spreadIds, created: [], dropped: [] };
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
import { clusterPalettes, contrastRatio, deltaE, parseHex, toHsl, type PaletteSwatch } from '../book-colour';
|
||||
import { mixHex } from './book-theme';
|
||||
import type { BookPalette } from './book-theme.schema';
|
||||
|
||||
/**
|
||||
* A palette from the book's own photographs: the paper and the ink stay as
|
||||
* the theme has them, and the three accents become the colours the pictures
|
||||
* share most, as long as each is a colour at all and plainly another one
|
||||
* than the accents before it. The first accent is the one words and marks
|
||||
* take, so it is darkened towards the ink until it reads at 3:1 on the paper.
|
||||
*/
|
||||
|
||||
/** Accents closer than this (CIE76) count as one. */
|
||||
const DISTINCT = 18;
|
||||
|
||||
function isColour(hex: string): boolean {
|
||||
const c = parseHex(hex);
|
||||
if (!c) return false;
|
||||
const { s, l } = toHsl(c);
|
||||
return s > 0.22 && l > 0.18 && l < 0.82;
|
||||
}
|
||||
|
||||
/** A colour moved towards the ink in steps until it reads at `ratio` on the paper. */
|
||||
function readableAccent(hex: string, palette: BookPalette, ratio = 3): string {
|
||||
let out = hex;
|
||||
for (let step = 1; step <= 8 && contrastRatio(out, palette.paper) < ratio; step++) {
|
||||
out = mixHex(hex, palette.ink, step / 10);
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
/**
|
||||
* The palette with accents from the photos' palettes, or null when the photos
|
||||
* are too grey to give even one.
|
||||
*/
|
||||
export function bookPaletteFromPhotos(palette: BookPalette, photos: readonly PaletteSwatch[][]): BookPalette | null {
|
||||
const picked: string[] = [];
|
||||
for (const swatch of clusterPalettes(photos)) {
|
||||
if (picked.length === 3) break;
|
||||
if (!isColour(swatch.hex) || picked.some((p) => deltaE(p, swatch.hex) < DISTINCT)) continue;
|
||||
picked.push(swatch.hex);
|
||||
}
|
||||
const [first, second, third] = picked;
|
||||
if (!first) return null;
|
||||
return {
|
||||
...palette,
|
||||
accent: readableAccent(first, palette),
|
||||
accent2: second ?? mixHex(first, palette.paper, 0.45),
|
||||
accent3: third ?? mixHex(palette.ink, first, 0.5),
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,248 @@
|
||||
import { z } from 'zod';
|
||||
|
||||
/**
|
||||
* A book's theme: its palette, its typefaces by role and the motifs that
|
||||
* belong to it, kept on the document so "apply theme" has something to
|
||||
* apply and the next one something to replace.
|
||||
*
|
||||
* ── Concrete values, optional links ──────────────────────────────────────
|
||||
*
|
||||
* Every element keeps its real `#rrggbb` and its real font, exactly as
|
||||
* before. A theme adds a *link* beside them: `token` names the palette entry
|
||||
* a colour came from, `fontRole` the typeface slot a text was set in. Applying
|
||||
* a theme rewrites what is linked and leaves the rest alone, so a reader from
|
||||
* before themes still draws every page, and a colour somebody picked by hand
|
||||
* stays theirs.
|
||||
*
|
||||
* This file imports nothing from book.schema.ts, which imports from it. The
|
||||
* fonts a theme names are plain ids here, checked against the catalogue
|
||||
* (book-fonts.data.ts) where they are applied, so a theme naming a family a
|
||||
* newer build added leaves those texts in their own face rather than failing.
|
||||
*/
|
||||
|
||||
const hex = z.string().regex(/^#[0-9a-fA-F]{6}$/, 'expected #rrggbb');
|
||||
|
||||
/** The five colours a theme is made of. */
|
||||
export const BOOK_PALETTE_KEYS = ['paper', 'ink', 'accent', 'accent2', 'accent3'] as const;
|
||||
export type BookPaletteKey = (typeof BOOK_PALETTE_KEYS)[number];
|
||||
|
||||
/**
|
||||
* What a colour may be linked to: the five palette entries, and `muted`, the
|
||||
* softer ink captions and meta lines are set in. Muted is not stored; it is
|
||||
* derived from the ink and the paper (book-theme.ts), which is what keeps a
|
||||
* caption readable on whatever paper the next theme brings.
|
||||
*/
|
||||
export const BOOK_COLOR_TOKENS = ['paper', 'ink', 'muted', 'accent', 'accent2', 'accent3'] as const;
|
||||
export type BookColorToken = (typeof BOOK_COLOR_TOKENS)[number];
|
||||
|
||||
/** The typeface slots of a theme, by what they set. */
|
||||
export const BOOK_FONT_SLOTS = ['display', 'heading', 'body', 'script'] as const;
|
||||
export type BookFontSlot = (typeof BOOK_FONT_SLOTS)[number];
|
||||
|
||||
/** The built-in themes, in the order the Studio shows them. */
|
||||
export const BOOK_THEME_IDS = [
|
||||
'poster-pop',
|
||||
'cutout',
|
||||
'postcard',
|
||||
'riviera',
|
||||
'fabric-classic',
|
||||
'minimal-serif',
|
||||
'grid-badge',
|
||||
'scrapbook-script',
|
||||
'tropical',
|
||||
'nordic',
|
||||
'alpine',
|
||||
'india-stamp',
|
||||
] as const;
|
||||
export type BookThemeId = (typeof BOOK_THEME_IDS)[number];
|
||||
|
||||
/**
|
||||
* The motif sets a theme may name. The same twelve groups the sticker library
|
||||
* is sorted by, so a theme's motifs are a shelf of that library.
|
||||
*/
|
||||
export const BOOK_THEME_MOTIFS = [
|
||||
'ephemera',
|
||||
'landmarks',
|
||||
'tropical',
|
||||
'mediterranean',
|
||||
'sea',
|
||||
'mountains',
|
||||
'nordic',
|
||||
'asia',
|
||||
'food',
|
||||
'paper',
|
||||
'doodles',
|
||||
'ornaments',
|
||||
] as const;
|
||||
export type BookThemeMotif = (typeof BOOK_THEME_MOTIFS)[number];
|
||||
|
||||
/** How much a theme decorates: no stickers, one or two a spread, or three to six. */
|
||||
export const BOOK_THEME_DECORATIONS = ['none', 'light', 'rich'] as const;
|
||||
export type BookThemeDecoration = (typeof BOOK_THEME_DECORATIONS)[number];
|
||||
|
||||
/** The photo frame styles a theme may default to (bookPhotoElementSchema's `frameStyle`, pinned by a spec). */
|
||||
export const BOOK_THEME_FRAMES = ['none', 'polaroid', 'white', 'shadow', 'film', 'tape'] as const;
|
||||
|
||||
/** A font id as a theme stores it: any family name, checked against the build's own list when it is used. */
|
||||
const fontId = z
|
||||
.string()
|
||||
.regex(/^[a-z][a-z0-9]*$/, 'expected a font id')
|
||||
.max(32);
|
||||
|
||||
/** One typeface slot: the family, and the weight and slant it is set at when the theme says. */
|
||||
export const bookThemeFontSchema = z.object({
|
||||
font: fontId,
|
||||
weight: z.number().int().min(100).max(900).multipleOf(100).optional(),
|
||||
italic: z.boolean().optional(),
|
||||
});
|
||||
export type BookThemeFont = z.infer<typeof bookThemeFontSchema>;
|
||||
|
||||
export const bookPaletteSchema = z.object({
|
||||
paper: hex,
|
||||
ink: hex,
|
||||
accent: hex,
|
||||
accent2: hex,
|
||||
accent3: hex,
|
||||
});
|
||||
export type BookPalette = z.infer<typeof bookPaletteSchema>;
|
||||
|
||||
const knownMotifs = (list: readonly string[]): BookThemeMotif[] =>
|
||||
[...new Set(list)].filter((m): m is BookThemeMotif => (BOOK_THEME_MOTIFS as readonly string[]).includes(m));
|
||||
|
||||
/**
|
||||
* The theme as the document keeps it.
|
||||
*
|
||||
* `id` names the built-in theme it started from, or null for a palette of
|
||||
* the book's own (an assistant design in one of the older styles, or a theme
|
||||
* somebody edited past recognition). Edited colours stay under the same id:
|
||||
* the id says where the look came from, the palette what it is now. Every
|
||||
* field falls back rather than failing, so a theme this build cannot read
|
||||
* whole costs the theme, never the book.
|
||||
*/
|
||||
export const bookThemeSchema = z.object({
|
||||
id: z.enum(BOOK_THEME_IDS).nullable().catch(null),
|
||||
palette: bookPaletteSchema,
|
||||
fonts: z.object({
|
||||
display: bookThemeFontSchema,
|
||||
heading: bookThemeFontSchema,
|
||||
body: bookThemeFontSchema,
|
||||
/** Null for a theme that sets no script at all. */
|
||||
script: bookThemeFontSchema.nullable(),
|
||||
}),
|
||||
motifs: z.array(z.string().max(24)).max(BOOK_THEME_MOTIFS.length).catch([]).transform(knownMotifs),
|
||||
decoration: z.enum(BOOK_THEME_DECORATIONS).catch('light'),
|
||||
/** The frame new photos take, and the turn a scrapbook gives them, in degrees. */
|
||||
frameStyle: z.enum(BOOK_THEME_FRAMES).catch('none'),
|
||||
tilt: z.number().min(0).max(8).catch(0),
|
||||
});
|
||||
export type BookTheme = z.infer<typeof bookThemeSchema>;
|
||||
|
||||
/** The document's optional `theme`: unreadable is no theme, and the pages keep their colours. */
|
||||
export const bookThemeFieldSchema = bookThemeSchema.optional().catch(undefined);
|
||||
|
||||
/** An element's link to a palette entry. An unknown one reads as no link, never as a broken element. */
|
||||
export const bookColorTokenFieldSchema = z.enum(BOOK_COLOR_TOKENS).optional().catch(undefined);
|
||||
|
||||
/** A text's link to a typeface slot, read the same lenient way. */
|
||||
export const bookFontSlotFieldSchema = z.enum(BOOK_FONT_SLOTS).optional().catch(undefined);
|
||||
|
||||
/*
|
||||
* ── As the operations take them ─────────────────────────────────────────
|
||||
*
|
||||
* Strict and described, as every operation is: the tool schema is all a
|
||||
* model reads. Null on a link takes it away, so the element keeps its colour
|
||||
* and stops following the theme.
|
||||
*/
|
||||
|
||||
export const bookColorTokenInSchema = z
|
||||
.enum(BOOK_COLOR_TOKENS)
|
||||
.nullable()
|
||||
.describe(
|
||||
"Link the colour to the book's theme: paper, ink, muted (the softer ink of captions), accent, accent2 or accent3. The colour is taken from the theme and follows it when the theme changes; null unlinks it and keeps the colour.",
|
||||
);
|
||||
|
||||
export const bookFontSlotInSchema = z
|
||||
.enum(BOOK_FONT_SLOTS)
|
||||
.nullable()
|
||||
.describe(
|
||||
"Link the typeface to the theme's display (cover titles), heading, body or script face; it is set in that face now and whenever the theme changes. Null unlinks it.",
|
||||
);
|
||||
|
||||
const paletteIn = z.strictObject({
|
||||
paper: hex.optional(),
|
||||
ink: hex.optional(),
|
||||
accent: hex.optional(),
|
||||
accent2: hex.optional(),
|
||||
accent3: hex.optional(),
|
||||
});
|
||||
|
||||
const themeFontIn = z.strictObject({
|
||||
font: fontId.describe('A font id, as the font enum of the text operations lists them.'),
|
||||
weight: z.number().int().min(100).max(900).multipleOf(100).optional(),
|
||||
italic: z.boolean().optional(),
|
||||
});
|
||||
|
||||
/**
|
||||
* `set_book_theme`: start from a built-in theme or from the book's own, change
|
||||
* what is named, and apply it to the whole book or to some pages.
|
||||
*/
|
||||
export const setBookThemeArgs = {
|
||||
theme: z
|
||||
.enum(BOOK_THEME_IDS)
|
||||
.describe('A built-in theme to start from; left out, the book keeps its own and only what is named changes.')
|
||||
.optional(),
|
||||
palette: paletteIn.describe('Colours to change on top of the theme, each #rrggbb.').optional(),
|
||||
fonts: z
|
||||
.strictObject({
|
||||
display: themeFontIn.optional(),
|
||||
heading: themeFontIn.optional(),
|
||||
body: themeFontIn.optional(),
|
||||
script: themeFontIn.nullable().optional(),
|
||||
})
|
||||
.describe('Typefaces to change on top of the theme, by slot; script null sets no script.')
|
||||
.optional(),
|
||||
motifs: z.array(z.enum(BOOK_THEME_MOTIFS)).max(BOOK_THEME_MOTIFS.length).optional(),
|
||||
decoration: z
|
||||
.enum(BOOK_THEME_DECORATIONS)
|
||||
.describe('How much the theme decorates: none, light (one or two stickers a spread), rich (three to six).')
|
||||
.optional(),
|
||||
spreadIds: z
|
||||
.array(z.string().min(1).max(40))
|
||||
.min(1)
|
||||
.max(150)
|
||||
.describe('Recolour only these pages; left out, every page of the book.')
|
||||
.optional(),
|
||||
adopt: z
|
||||
.boolean()
|
||||
.describe(
|
||||
'Also link what is not linked yet: page backgrounds to the paper, dark neutral words and shapes to the ink, coloured ones to the nearest accent, texts to a typeface slot by size. Words in white over photos stay as they are. Default true.',
|
||||
)
|
||||
.optional(),
|
||||
};
|
||||
export const setBookThemeRequestSchema = z.strictObject(setBookThemeArgs);
|
||||
export type SetBookThemeRequest = z.infer<typeof setBookThemeRequestSchema>;
|
||||
|
||||
/*
|
||||
* ── The links, as book.schema.ts spreads them into each kind ────────────
|
||||
*
|
||||
* `token` is the entry the element's main colour follows (a text's or an
|
||||
* icon's colour, a shape's fill, a travel element's ink); `strokeToken` and
|
||||
* `accentToken` the second colour where there is one; `fontRole` the
|
||||
* typeface slot. A page links its background through `backgroundToken`.
|
||||
*/
|
||||
export const THEMED_TEXT = { token: bookColorTokenFieldSchema, fontRole: bookFontSlotFieldSchema };
|
||||
export const THEMED_ICON = { token: bookColorTokenFieldSchema };
|
||||
export const THEMED_SHAPE = { token: bookColorTokenFieldSchema, strokeToken: bookColorTokenFieldSchema };
|
||||
export const THEMED_TYPESET = {
|
||||
token: bookColorTokenFieldSchema,
|
||||
accentToken: bookColorTokenFieldSchema,
|
||||
fontRole: bookFontSlotFieldSchema,
|
||||
};
|
||||
export const THEMED_SPREAD = { backgroundToken: bookColorTokenFieldSchema };
|
||||
|
||||
/** The same links as the `add` and `style` operations take them, null taking one away. */
|
||||
const tokenIn = bookColorTokenInSchema.optional();
|
||||
export const THEMED_TEXT_IN = { token: tokenIn, fontRole: bookFontSlotInSchema.optional() };
|
||||
export const THEMED_ICON_IN = { token: tokenIn };
|
||||
export const THEMED_SHAPE_IN = { token: tokenIn, strokeToken: tokenIn };
|
||||
export const THEMED_TYPESET_IN = { token: tokenIn, accentToken: tokenIn, fontRole: bookFontSlotInSchema.optional() };
|
||||
@@ -0,0 +1,145 @@
|
||||
import { contrastRatio } from '../book-colour';
|
||||
import { bookFontHasWeight, bookFontRole } from '../book-fonts';
|
||||
import { BOOK_FONTS_IDS, bookDocumentSchema, bookPhotoElementSchema, bookTextElementSchema } from '../book.schema';
|
||||
import {
|
||||
bookThemeColor,
|
||||
bookThemeFont,
|
||||
bookThemeOf,
|
||||
bookThemePreset,
|
||||
isBookFontFamily,
|
||||
isBookThemeId,
|
||||
mutedOn,
|
||||
readableOn,
|
||||
themePaperBackground,
|
||||
} from './book-theme';
|
||||
import {
|
||||
BOOK_THEME_FRAMES,
|
||||
BOOK_THEME_IDS,
|
||||
BOOK_THEME_MOTIFS,
|
||||
bookColorTokenFieldSchema,
|
||||
bookThemeFieldSchema,
|
||||
bookThemeSchema,
|
||||
} from './book-theme.schema';
|
||||
import { BOOK_THEME_PRESETS } from './book-themes.data';
|
||||
|
||||
import { describe, expect, it } from 'vitest';
|
||||
|
||||
// BKTHEME-001 to BKTHEME-010
|
||||
|
||||
describe('the built-in themes', () => {
|
||||
it('BKTHEME-001: are twelve, one per id, in the order of the ids', () => {
|
||||
expect(BOOK_THEME_PRESETS.map((p) => p.id)).toEqual([...BOOK_THEME_IDS]);
|
||||
expect(BOOK_THEME_IDS).toHaveLength(12);
|
||||
for (const id of BOOK_THEME_IDS) expect(bookThemeOf(id).id).toBe(id);
|
||||
expect(bookThemePreset('nope')).toBeUndefined();
|
||||
expect(() => bookThemeOf('nope' as never)).toThrow();
|
||||
});
|
||||
|
||||
it('BKTHEME-002: each set ink that reads on its paper and a first accent that marks on it', () => {
|
||||
for (const p of BOOK_THEME_PRESETS) {
|
||||
expect(contrastRatio(p.palette.ink, p.palette.paper), p.id).toBeGreaterThanOrEqual(7);
|
||||
expect(contrastRatio(p.palette.accent, p.palette.paper), p.id).toBeGreaterThanOrEqual(3);
|
||||
const colours = Object.values(p.palette);
|
||||
expect(new Set(colours).size, p.id).toBe(colours.length);
|
||||
}
|
||||
});
|
||||
|
||||
it('BKTHEME-003: set every slot in a family of the catalogue at a weight it ships, with motifs of the library', () => {
|
||||
for (const p of BOOK_THEME_PRESETS) {
|
||||
const picks = [p.fonts.display, p.fonts.heading, p.fonts.body, p.fonts.script].filter((f) => f !== null);
|
||||
for (const pick of picks) {
|
||||
expect((BOOK_FONTS_IDS as readonly string[]).includes(pick.font), `${p.id} ${pick.font}`).toBe(true);
|
||||
if (pick.weight !== undefined)
|
||||
expect(bookFontHasWeight(pick.font, pick.weight), `${p.id} ${pick.font}`).toBe(true);
|
||||
}
|
||||
if (p.fonts.script) expect(bookFontRole(p.fonts.script.font), p.id).toBe('script');
|
||||
expect(p.motifs.length).toBeGreaterThan(0);
|
||||
for (const m of p.motifs) expect(BOOK_THEME_MOTIFS).toContain(m);
|
||||
expect(p.descr).not.toMatch(/[\u2013\u2014]| - /);
|
||||
expect(p.labelKey).toMatch(/^studio\.theme\.name\./);
|
||||
expect(p.descrKey).toMatch(/^studio\.theme\.descr\./);
|
||||
}
|
||||
});
|
||||
|
||||
it('BKTHEME-004: offer exactly the photo frame styles the document knows', () => {
|
||||
expect([...BOOK_THEME_FRAMES]).toEqual(bookPhotoElementSchema.shape.frameStyle.unwrap().options);
|
||||
});
|
||||
});
|
||||
|
||||
describe('a theme slot in this build', () => {
|
||||
it('BKTHEME-005: copies the faces of a preset, so editing a theme never edits the catalogue', () => {
|
||||
const theme = bookThemeOf('poster-pop');
|
||||
expect(theme.fonts.display).toEqual({ font: 'archivo', weight: 400 });
|
||||
theme.fonts.display.font = 'inter';
|
||||
expect(bookThemeOf('poster-pop').fonts.display.font).toBe('archivo');
|
||||
expect(isBookFontFamily('serif')).toBe(true);
|
||||
expect(isBookFontFamily('comic')).toBe(false);
|
||||
});
|
||||
|
||||
it('BKTHEME-006: resolves every built-in slot to a family the text schema takes', () => {
|
||||
for (const id of BOOK_THEME_IDS) {
|
||||
const theme = bookThemeOf(id);
|
||||
for (const slot of ['display', 'heading', 'body', 'script'] as const) {
|
||||
const face = bookThemeFont(theme, slot);
|
||||
if (face) expect(bookTextElementSchema.shape.font.safeParse(face.font).success, `${id} ${slot}`).toBe(true);
|
||||
}
|
||||
}
|
||||
expect(bookThemeOf('minimal-serif').fonts.script).toBeNull();
|
||||
});
|
||||
});
|
||||
|
||||
describe('the colours of a theme', () => {
|
||||
it('BKTHEME-007: answer each token, the muted ink derived and still readable', () => {
|
||||
const theme = bookThemeOf('riviera');
|
||||
expect(bookThemeColor(theme, 'paper')).toBe(theme.palette.paper);
|
||||
expect(bookThemeColor(theme, 'accent3')).toBe(theme.palette.accent3);
|
||||
const muted = bookThemeColor(theme, 'muted');
|
||||
expect(muted).not.toBe(theme.palette.ink);
|
||||
expect(contrastRatio(muted, theme.palette.paper)).toBeGreaterThanOrEqual(4.6);
|
||||
// An ink that does not read on its paper is replaced, and so is a muted one that would not.
|
||||
expect(readableOn('#ffffff', '#fefefe')).toBe('#1a1a1a');
|
||||
expect(mutedOn('#ffffff', '#777777')).toBe('#777777');
|
||||
});
|
||||
|
||||
it('BKTHEME-008: put white paper on a page as no background, and any other as itself', () => {
|
||||
expect(themePaperBackground(bookThemeOf('grid-badge'))).toBeNull();
|
||||
expect(themePaperBackground(bookThemeOf('cutout'))).toBe('#2445b8');
|
||||
});
|
||||
});
|
||||
|
||||
describe('a theme as the document reads it', () => {
|
||||
it('BKTHEME-009: falls back field by field, and an unreadable theme is no theme', () => {
|
||||
const theme = bookThemeOf('poster-pop');
|
||||
const odd = bookThemeSchema.parse({
|
||||
...theme,
|
||||
id: 'gone',
|
||||
motifs: ['sea', 'volcanoes', 'sea'],
|
||||
decoration: 'loud',
|
||||
frameStyle: 'gold',
|
||||
tilt: 40,
|
||||
});
|
||||
expect([odd.id, odd.motifs, odd.decoration, odd.frameStyle, odd.tilt]).toEqual([null, ['sea'], 'light', 'none', 0]);
|
||||
expect(bookThemeFieldSchema.parse({ palette: 'red' })).toBeUndefined();
|
||||
expect(bookColorTokenFieldSchema.parse('accent9')).toBeUndefined();
|
||||
expect(isBookThemeId('nordic')).toBe(true);
|
||||
expect(isBookThemeId('classic')).toBe(false);
|
||||
});
|
||||
|
||||
it('BKTHEME-010: keeps a book whose theme or links it cannot read, with its pages whole', () => {
|
||||
const doc = bookDocumentSchema.parse({
|
||||
theme: { id: 'nordic' },
|
||||
spreads: [
|
||||
{
|
||||
id: 's1',
|
||||
backgroundToken: 'gold',
|
||||
elements: [{ id: 't1', kind: 'text', frame: { x: 1, y: 1, w: 10, h: 5 }, token: 'nope', fontRole: 7 }],
|
||||
},
|
||||
],
|
||||
});
|
||||
expect(doc.theme).toBeUndefined();
|
||||
expect(doc.spreads[0]?.backgroundToken).toBeUndefined();
|
||||
expect(doc.spreads[0]?.elements).toHaveLength(1);
|
||||
const kept = bookDocumentSchema.parse({ theme: bookThemeOf('alpine') });
|
||||
expect(kept.theme?.id).toBe('alpine');
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,88 @@
|
||||
import { contrastRatio, parseHex, readableInk, toHex } from '../book-colour';
|
||||
import { BOOK_FONTS_IDS, type BookFontFamily } from '../book.schema';
|
||||
import {
|
||||
BOOK_THEME_IDS,
|
||||
type BookColorToken,
|
||||
type BookFontSlot,
|
||||
type BookTheme,
|
||||
type BookThemeFont,
|
||||
type BookThemeId,
|
||||
} from './book-theme.schema';
|
||||
import { BOOK_THEME_PRESETS, type BookThemePreset } from './book-themes.data';
|
||||
|
||||
/** Reading a theme: the built-in presets by id, the faces of its slots, and the colour a token stands for. */
|
||||
|
||||
/** Whether this build sets type in a family. */
|
||||
export const isBookFontFamily = (id: string): id is BookFontFamily =>
|
||||
(BOOK_FONTS_IDS as readonly string[]).includes(id);
|
||||
|
||||
/** Whether a string names a built-in theme. */
|
||||
export const isBookThemeId = (id: string): id is BookThemeId => (BOOK_THEME_IDS as readonly string[]).includes(id);
|
||||
|
||||
/** The built-in theme of an id, or undefined. */
|
||||
export function bookThemePreset(id: string): BookThemePreset | undefined {
|
||||
return BOOK_THEME_PRESETS.find((p) => p.id === id);
|
||||
}
|
||||
|
||||
/** A built-in theme as the document keeps it. */
|
||||
export function bookThemeFromPreset(preset: BookThemePreset): BookTheme {
|
||||
return {
|
||||
id: preset.id,
|
||||
palette: { ...preset.palette },
|
||||
fonts: {
|
||||
display: { ...preset.fonts.display },
|
||||
heading: { ...preset.fonts.heading },
|
||||
body: { ...preset.fonts.body },
|
||||
script: preset.fonts.script ? { ...preset.fonts.script } : null,
|
||||
},
|
||||
motifs: [...preset.motifs],
|
||||
decoration: preset.decoration,
|
||||
frameStyle: preset.frameStyle,
|
||||
tilt: preset.tilt,
|
||||
};
|
||||
}
|
||||
|
||||
/** A built-in theme by id, as the document keeps it. Every id has one (a spec holds the list to the data). */
|
||||
export function bookThemeOf(id: BookThemeId): BookTheme {
|
||||
const preset = bookThemePreset(id);
|
||||
if (!preset) throw new Error(`no built-in theme ${id}`);
|
||||
return bookThemeFromPreset(preset);
|
||||
}
|
||||
|
||||
/** A colour part way from `a` to `b`. */
|
||||
export function mixHex(a: string, b: string, t: number): string {
|
||||
const ca = parseHex(a);
|
||||
const cb = parseHex(b);
|
||||
if (!ca || !cb) return a;
|
||||
return toHex({ r: ca.r + (cb.r - ca.r) * t, g: ca.g + (cb.g - ca.g) * t, b: ca.b + (cb.b - ca.b) * t });
|
||||
}
|
||||
|
||||
/** The ink, unless it reads under 4.5:1 on the paper; then whichever of near black and white reads better. */
|
||||
export function readableOn(paper: string, ink: string): string {
|
||||
return contrastRatio(ink, paper) >= 4.5 ? ink : readableInk(paper);
|
||||
}
|
||||
|
||||
/**
|
||||
* The softer ink of captions and meta lines: a third of the way to the
|
||||
* paper, as long as it still reads at 4.6:1, else the ink itself.
|
||||
*/
|
||||
export function mutedOn(paper: string, ink: string): string {
|
||||
const softer = mixHex(ink, paper, 0.3);
|
||||
return contrastRatio(softer, paper) >= 4.6 ? softer : ink;
|
||||
}
|
||||
|
||||
/** The colour a token stands for in a theme. */
|
||||
export function bookThemeColor(theme: BookTheme, token: BookColorToken): string {
|
||||
const { palette } = theme;
|
||||
if (token === 'muted') return mutedOn(palette.paper, readableOn(palette.paper, palette.ink));
|
||||
return palette[token];
|
||||
}
|
||||
|
||||
/** The face a slot is set in, or null for a theme without a script. */
|
||||
export function bookThemeFont(theme: BookTheme, slot: BookFontSlot): BookThemeFont | null {
|
||||
return theme.fonts[slot];
|
||||
}
|
||||
|
||||
/** A theme's paper as a page background: none for white, which is the paper itself. */
|
||||
export const themePaperBackground = (theme: BookTheme): string | null =>
|
||||
theme.palette.paper.toLowerCase() === '#ffffff' ? null : theme.palette.paper.toLowerCase();
|
||||
@@ -0,0 +1,256 @@
|
||||
import type { BookFontFamily, BookWeight } from '../book-fonts.data';
|
||||
import type {
|
||||
BookPalette,
|
||||
BookThemeDecoration,
|
||||
BookThemeId,
|
||||
BookThemeMotif,
|
||||
BOOK_THEME_FRAMES,
|
||||
} from './book-theme.schema';
|
||||
|
||||
/**
|
||||
* The twelve built-in themes, each a look of its own rather than a recolour:
|
||||
* a paper and an ink that read together, three accents that belong to the
|
||||
* same place, a display face for the cover, a heading and a body face that
|
||||
* pair, a script for the words laid over a photo, and the motifs that suit.
|
||||
*
|
||||
* The faces are families of the book's own catalogue (book-fonts.data.ts),
|
||||
* each at a weight it really ships, which a spec holds them to.
|
||||
*/
|
||||
|
||||
/** One typeface slot of a built-in theme: the family and, where the theme says, its weight. */
|
||||
export interface BookThemeFontPick {
|
||||
font: BookFontFamily;
|
||||
weight?: BookWeight;
|
||||
}
|
||||
|
||||
export interface BookThemePreset {
|
||||
id: BookThemeId;
|
||||
/** What the Studio calls it. */
|
||||
labelKey: string;
|
||||
/** One line on what it looks like, for the Studio's card. */
|
||||
descrKey: string;
|
||||
/** The same line in English, for a model picking a theme it cannot see. */
|
||||
descr: string;
|
||||
palette: BookPalette;
|
||||
fonts: {
|
||||
display: BookThemeFontPick;
|
||||
heading: BookThemeFontPick;
|
||||
body: BookThemeFontPick;
|
||||
script: BookThemeFontPick | null;
|
||||
};
|
||||
motifs: readonly BookThemeMotif[];
|
||||
decoration: BookThemeDecoration;
|
||||
frameStyle: (typeof BOOK_THEME_FRAMES)[number];
|
||||
tilt: number;
|
||||
}
|
||||
|
||||
export const BOOK_THEME_PRESETS: readonly BookThemePreset[] = [
|
||||
{
|
||||
id: 'poster-pop',
|
||||
labelKey: 'studio.theme.name.posterPop',
|
||||
descrKey: 'studio.theme.descr.posterPop',
|
||||
descr:
|
||||
'Loud travel poster: cream paper, hot coral and sunflower blocks, heavy condensed titles, tropical stickers.',
|
||||
palette: { paper: '#fbf1de', ink: '#1d1a2f', accent: '#ef4e45', accent2: '#ffbf3c', accent3: '#13807b' },
|
||||
fonts: {
|
||||
display: { font: 'archivo', weight: 400 },
|
||||
heading: { font: 'anton', weight: 400 },
|
||||
body: { font: 'inter' },
|
||||
script: { font: 'kaushan', weight: 400 },
|
||||
},
|
||||
motifs: ['tropical', 'doodles'],
|
||||
decoration: 'rich',
|
||||
frameStyle: 'white',
|
||||
tilt: 4,
|
||||
},
|
||||
{
|
||||
id: 'cutout',
|
||||
labelKey: 'studio.theme.name.cutout',
|
||||
descrKey: 'studio.theme.descr.cutout',
|
||||
descr: 'Matisse cut-outs: cobalt paper, coral and sand shapes, white type, spaced condensed caps.',
|
||||
palette: { paper: '#2445b8', ink: '#fdf8ef', accent: '#ff7a59', accent2: '#f1d9b5', accent3: '#9fd3ff' },
|
||||
fonts: {
|
||||
display: { font: 'shoulders', weight: 800 },
|
||||
heading: { font: 'oswald', weight: 500 },
|
||||
body: { font: 'inter' },
|
||||
script: { font: 'caveat', weight: 400 },
|
||||
},
|
||||
motifs: ['sea', 'doodles'],
|
||||
decoration: 'light',
|
||||
frameStyle: 'white',
|
||||
tilt: 2,
|
||||
},
|
||||
{
|
||||
id: 'postcard',
|
||||
labelKey: 'studio.theme.name.postcard',
|
||||
descrKey: 'studio.theme.descr.postcard',
|
||||
descr:
|
||||
'Illustrated postcard: pastel mint paper, navy ink, stamp red and peach, a display serif with a script subtitle.',
|
||||
palette: { paper: '#e3f1e8', ink: '#1f2d4d', accent: '#c8453d', accent2: '#ec8f6a', accent3: '#f3d58a' },
|
||||
fonts: {
|
||||
display: { font: 'dmserif', weight: 400 },
|
||||
heading: { font: 'montserrat', weight: 600 },
|
||||
body: { font: 'inter' },
|
||||
script: { font: 'dancing', weight: 400 },
|
||||
},
|
||||
motifs: ['landmarks', 'mediterranean'],
|
||||
decoration: 'light',
|
||||
frameStyle: 'white',
|
||||
tilt: 0,
|
||||
},
|
||||
{
|
||||
id: 'riviera',
|
||||
labelKey: 'studio.theme.name.riviera',
|
||||
descrKey: 'studio.theme.descr.riviera',
|
||||
descr: 'Mediterranean summer: warm white paper, azure, olive and lemon yellow, a soft serif with a flowing script.',
|
||||
palette: { paper: '#fffaf0', ink: '#22324a', accent: '#2a78bd', accent2: '#6f7f34', accent3: '#e9b824' },
|
||||
fonts: {
|
||||
display: { font: 'fraunces', weight: 600 },
|
||||
heading: { font: 'montserrat', weight: 500 },
|
||||
body: { font: 'serif' },
|
||||
script: { font: 'vibes', weight: 400 },
|
||||
},
|
||||
motifs: ['mediterranean', 'sea'],
|
||||
decoration: 'light',
|
||||
frameStyle: 'none',
|
||||
tilt: 0,
|
||||
},
|
||||
{
|
||||
id: 'fabric-classic',
|
||||
labelKey: 'studio.theme.name.fabricClassic',
|
||||
descrKey: 'studio.theme.descr.fabricClassic',
|
||||
descr:
|
||||
'Linen-bound classic: linen paper, dusty blue and terracotta, an elegant serif over Garamond, fine ornaments.',
|
||||
palette: { paper: '#efe8db', ink: '#2e2a26', accent: '#5f7d99', accent2: '#b0603c', accent3: '#97a184' },
|
||||
fonts: {
|
||||
display: { font: 'cormorant', weight: 500 },
|
||||
heading: { font: 'montserrat', weight: 500 },
|
||||
body: { font: 'garamond' },
|
||||
script: { font: 'sacramento', weight: 400 },
|
||||
},
|
||||
motifs: ['nordic', 'ornaments'],
|
||||
decoration: 'light',
|
||||
frameStyle: 'none',
|
||||
tilt: 0,
|
||||
},
|
||||
{
|
||||
id: 'minimal-serif',
|
||||
labelKey: 'studio.theme.name.minimalSerif',
|
||||
descrKey: 'studio.theme.descr.minimalSerif',
|
||||
descr:
|
||||
'Gallery minimal: white paper, warm grey and sand, a very large thin serif title, hairline ornaments, no script.',
|
||||
palette: { paper: '#ffffff', ink: '#222222', accent: '#857d72', accent2: '#cbbda6', accent3: '#54504a' },
|
||||
fonts: {
|
||||
display: { font: 'cormorant', weight: 300 },
|
||||
heading: { font: 'montserrat', weight: 300 },
|
||||
body: { font: 'inter' },
|
||||
script: null,
|
||||
},
|
||||
motifs: ['ornaments'],
|
||||
decoration: 'none',
|
||||
frameStyle: 'none',
|
||||
tilt: 0,
|
||||
},
|
||||
{
|
||||
id: 'grid-badge',
|
||||
labelKey: 'studio.theme.name.gridBadge',
|
||||
descrKey: 'studio.theme.descr.gridBadge',
|
||||
descr: 'Photo grid with a badge: white paper, black ink, one red accent, heavy geometric caps, travel ephemera.',
|
||||
palette: { paper: '#ffffff', ink: '#141414', accent: '#e2412f', accent2: '#f2eee7', accent3: '#6f6f6f' },
|
||||
fonts: {
|
||||
display: { font: 'montserrat', weight: 800 },
|
||||
heading: { font: 'montserrat', weight: 600 },
|
||||
body: { font: 'inter' },
|
||||
script: { font: 'allura', weight: 400 },
|
||||
},
|
||||
motifs: ['ephemera'],
|
||||
decoration: 'light',
|
||||
frameStyle: 'none',
|
||||
tilt: 0,
|
||||
},
|
||||
{
|
||||
id: 'scrapbook-script',
|
||||
labelKey: 'studio.theme.name.scrapbookScript',
|
||||
descrKey: 'studio.theme.descr.scrapbookScript',
|
||||
descr: 'Handmade scrapbook: kraft paper, cream and red, marker titles, handwriting, tape, doodles and tickets.',
|
||||
palette: { paper: '#dcc6a2', ink: '#2b2118', accent: '#c2342a', accent2: '#f8f1e1', accent3: '#2f4f7a' },
|
||||
fonts: {
|
||||
display: { font: 'marker', weight: 400 },
|
||||
heading: { font: 'caveat', weight: 700 },
|
||||
body: { font: 'serif' },
|
||||
script: { font: 'homemade', weight: 400 },
|
||||
},
|
||||
motifs: ['paper', 'doodles', 'ephemera'],
|
||||
decoration: 'rich',
|
||||
frameStyle: 'polaroid',
|
||||
tilt: 3,
|
||||
},
|
||||
{
|
||||
id: 'tropical',
|
||||
labelKey: 'studio.theme.name.tropical',
|
||||
descrKey: 'studio.theme.descr.tropical',
|
||||
descr: 'Tropical holiday: cream paper, jungle green, hibiscus red and mango, a fat retro title and a beach script.',
|
||||
palette: { paper: '#fbf5e6', ink: '#13382a', accent: '#1d7a4c', accent2: '#dc3446', accent3: '#f29d34' },
|
||||
fonts: {
|
||||
display: { font: 'shrikhand', weight: 400 },
|
||||
heading: { font: 'oswald', weight: 500 },
|
||||
body: { font: 'sans' },
|
||||
script: { font: 'pacifico', weight: 400 },
|
||||
},
|
||||
motifs: ['tropical'],
|
||||
decoration: 'rich',
|
||||
frameStyle: 'white',
|
||||
tilt: 2,
|
||||
},
|
||||
{
|
||||
id: 'nordic',
|
||||
labelKey: 'studio.theme.name.nordic',
|
||||
descrKey: 'studio.theme.descr.nordic',
|
||||
descr: 'Nordic calm: pale grey paper, slate ink, ochre and rose, a friendly grotesque, row houses and pines.',
|
||||
palette: { paper: '#f3f1ec', ink: '#2e3a45', accent: '#a8741c', accent2: '#cf7d7d', accent3: '#566d83' },
|
||||
fonts: {
|
||||
display: { font: 'bricolage', weight: 700 },
|
||||
heading: { font: 'montserrat', weight: 600 },
|
||||
body: { font: 'inter' },
|
||||
script: { font: 'satisfy', weight: 400 },
|
||||
},
|
||||
motifs: ['nordic', 'mountains'],
|
||||
decoration: 'light',
|
||||
frameStyle: 'none',
|
||||
tilt: 0,
|
||||
},
|
||||
{
|
||||
id: 'alpine',
|
||||
labelKey: 'studio.theme.name.alpine',
|
||||
descrKey: 'studio.theme.descr.alpine',
|
||||
descr: 'Alpine lodge: snow white paper, forest green ink, rust and sky blue, a slab title over condensed caps.',
|
||||
palette: { paper: '#f7f7f2', ink: '#1e3a2c', accent: '#b0502a', accent2: '#2f5d46', accent3: '#6f9cbd' },
|
||||
fonts: {
|
||||
display: { font: 'alfa', weight: 400 },
|
||||
heading: { font: 'oswald', weight: 500 },
|
||||
body: { font: 'inter' },
|
||||
script: { font: 'caveat', weight: 400 },
|
||||
},
|
||||
motifs: ['mountains'],
|
||||
decoration: 'light',
|
||||
frameStyle: 'white',
|
||||
tilt: 0,
|
||||
},
|
||||
{
|
||||
id: 'india-stamp',
|
||||
labelKey: 'studio.theme.name.indiaStamp',
|
||||
descrKey: 'studio.theme.descr.indiaStamp',
|
||||
descr: 'Stamp collage: warm paper, magenta, saffron and teal, a high-contrast display serif, stamps and postmarks.',
|
||||
palette: { paper: '#fbf2e2', ink: '#2a1b2e', accent: '#bd2275', accent2: '#e9801a', accent3: '#12807f' },
|
||||
fonts: {
|
||||
display: { font: 'abril', weight: 400 },
|
||||
heading: { font: 'montserrat', weight: 600 },
|
||||
body: { font: 'serif' },
|
||||
script: { font: 'parisienne', weight: 400 },
|
||||
},
|
||||
motifs: ['asia', 'ephemera'],
|
||||
decoration: 'rich',
|
||||
frameStyle: 'white',
|
||||
tilt: 2,
|
||||
},
|
||||
];
|
||||
@@ -3,6 +3,7 @@ import type { TranslationStrings } from '../types';
|
||||
const assistantBookDesign: TranslationStrings = {
|
||||
'assistant.change.verb.designBook': 'تطبيق تصميم الكتاب',
|
||||
'assistant.change.verb.setBookSetup': 'تغيير مقاس الصفحات',
|
||||
'assistant.change.verb.setBookTheme': 'تطبيق سمة على الكتاب',
|
||||
'assistant.change.verb.duplicateBookPage': 'تكرار الصفحة',
|
||||
'assistant.change.verb.saveBookLayout': 'حفظ الصفحة كتخطيط',
|
||||
'assistant.change.verb.removeBookLayout': 'إزالة تخطيط محفوظ',
|
||||
|
||||
@@ -65,6 +65,7 @@ import studioPaint from './studioPaint';
|
||||
import studioPhoto from './studioPhoto';
|
||||
import studioStickers from './studioStickers';
|
||||
import studioShapes from './studioShapes';
|
||||
import studioThemes from './studioThemes';
|
||||
import system_notice from './system_notice';
|
||||
import todo from './todo';
|
||||
import tourCollection from './tourCollection';
|
||||
@@ -149,6 +150,7 @@ const locale = {
|
||||
...assistantBudget,
|
||||
...assistantBook,
|
||||
...assistantBookDesign,
|
||||
...studioThemes,
|
||||
...assistantBooking,
|
||||
...assistantCollab,
|
||||
...assistantCollection,
|
||||
|
||||
@@ -0,0 +1,76 @@
|
||||
import type { TranslationStrings } from '../types';
|
||||
|
||||
const studioThemes: TranslationStrings = {
|
||||
'studio.theme.name.posterPop': 'ملصق بوب',
|
||||
'studio.theme.name.cutout': 'قصاصات ورقية',
|
||||
'studio.theme.name.postcard': 'بطاقة بريدية',
|
||||
'studio.theme.name.riviera': 'الريفيرا',
|
||||
'studio.theme.name.fabricClassic': 'كتان كلاسيكي',
|
||||
'studio.theme.name.minimalSerif': 'خط مذيل بسيط',
|
||||
'studio.theme.name.gridBadge': 'شبكة وشارة',
|
||||
'studio.theme.name.scrapbookScript': 'دفتر قصاصات',
|
||||
'studio.theme.name.tropical': 'استوائي',
|
||||
'studio.theme.name.nordic': 'شمالي',
|
||||
'studio.theme.name.alpine': 'جبال الألب',
|
||||
'studio.theme.name.indiaStamp': 'مجموعة طوابع',
|
||||
'studio.theme.descr.posterPop': 'ورق كريمي ومرجاني ودوّار الشمس وعناوين ملصقات عريضة',
|
||||
'studio.theme.descr.cutout': 'ورق كوبالتي وأشكال بلون المرجان والرمل وكتابة بيضاء',
|
||||
'studio.theme.descr.postcard': 'ورق بلون النعناع وحبر كحلي وأحمر الختم وعنوان فرعي بخط اليد',
|
||||
'studio.theme.descr.riviera': 'أبيض دافئ وأزرق سماوي وزيتوني وليموني وخط مذيل ناعم',
|
||||
'studio.theme.descr.fabricClassic': 'ورق كتان وأزرق باهت وطين محروق وأذيال رفيعة',
|
||||
'studio.theme.descr.minimalSerif': 'ورق أبيض ودرجات رمادي دافئة وخط مذيل كبير ورفيع',
|
||||
'studio.theme.descr.gridBadge': 'ورق أبيض وحبر أسود ولمسة حمراء واحدة',
|
||||
'studio.theme.descr.scrapbookScript': 'ورق كرافت وعناوين بالقلم العريض وخط اليد وشريط لاصق',
|
||||
'studio.theme.descr.tropical': 'أخضر الغابة وأحمر الكركديه والمانجو على خلفية كريمية',
|
||||
'studio.theme.descr.nordic': 'ورق رمادي فاتح مع لون الأردواز والمغرة والوردي',
|
||||
'studio.theme.descr.alpine': 'أبيض ثلجي مع أخضر الغابات ولون الصدأ وأزرق السماء',
|
||||
'studio.theme.descr.indiaStamp': 'ورق دافئ مع الأرجواني والزعفراني والأزرق المخضر',
|
||||
'studio.theme.panel': 'السمة',
|
||||
'studio.theme.intro': 'اختر مظهرًا للكتاب كله. الألوان والخطوط التي تتبع السمة تتغير معها، وكل ما عداها يبقى كما هو.',
|
||||
'studio.theme.themes': 'السمات',
|
||||
'studio.theme.inUse': 'مستخدمة',
|
||||
'studio.theme.reset': 'العودة إلى السمة الأصلية',
|
||||
'studio.theme.palette': 'لوحة الألوان',
|
||||
'studio.theme.token.paper': 'الورق',
|
||||
'studio.theme.token.ink': 'الحبر',
|
||||
'studio.theme.token.muted': 'باهت',
|
||||
'studio.theme.token.accent': 'لون مميز',
|
||||
'studio.theme.token.accent2': 'لون مميز 2',
|
||||
'studio.theme.token.accent3': 'لون مميز 3',
|
||||
'studio.theme.fromPhotos': 'ألوان من الصور',
|
||||
'studio.theme.noPhotoColours': 'لا تحتوي الصور على لون يمكن أخذه',
|
||||
'studio.theme.fonts': 'الخطوط',
|
||||
'studio.theme.slot.display': 'خط العناوين الكبيرة',
|
||||
'studio.theme.slot.heading': 'العنوان',
|
||||
'studio.theme.slot.body': 'النص',
|
||||
'studio.theme.slot.script': 'خط اليد',
|
||||
'studio.theme.noScript': 'بلا خط يد',
|
||||
'studio.theme.motifs': 'الزخارف',
|
||||
'studio.theme.motifsHint': 'مجموعات الملصقات التي تناسب هذه السمة.',
|
||||
'studio.theme.motif.ephemera': 'تذكارات السفر',
|
||||
'studio.theme.motif.landmarks': 'المعالم',
|
||||
'studio.theme.motif.tropical': 'استوائي',
|
||||
'studio.theme.motif.mediterranean': 'البحر المتوسط',
|
||||
'studio.theme.motif.sea': 'البحر والساحل',
|
||||
'studio.theme.motif.mountains': 'الجبال',
|
||||
'studio.theme.motif.nordic': 'الشمال',
|
||||
'studio.theme.motif.asia': 'آسيا',
|
||||
'studio.theme.motif.food': 'الطعام والمقاهي',
|
||||
'studio.theme.motif.paper': 'الورق والشريط',
|
||||
'studio.theme.motif.doodles': 'خربشات',
|
||||
'studio.theme.motif.ornaments': 'نقوش',
|
||||
'studio.theme.decoration': 'الزينة',
|
||||
'studio.theme.decoration.none': 'بلا',
|
||||
'studio.theme.decoration.light': 'خفيفة',
|
||||
'studio.theme.decoration.rich': 'غنية',
|
||||
'studio.theme.adopt': 'أعد تنسيق ما لم يُربط بعد أيضًا',
|
||||
'studio.theme.adoptHint': 'يربط الخلفيات والنصوص والأشكال بالسمة أولًا. الكتابة البيضاء فوق الصور تبقى كما هي.',
|
||||
'studio.theme.applyBook': 'تطبيق على الكتاب',
|
||||
'studio.theme.applyPage': 'تطبيق على هذه الصفحة',
|
||||
'studio.theme.applied': 'تم تطبيق السمة',
|
||||
'studio.theme.nothing': 'لا شيء هنا يتبع السمة بعد. فعّل إعادة التنسيق لربطه.',
|
||||
'studio.theme.linked': 'لون السمة',
|
||||
'studio.theme.unlink': 'التوقف عن اتباع السمة',
|
||||
};
|
||||
|
||||
export default studioThemes;
|
||||
@@ -3,6 +3,7 @@ import type { TranslationStrings } from '../types';
|
||||
const assistantBookDesign: TranslationStrings = {
|
||||
'assistant.change.verb.designBook': 'Kitab dizaynını tətbiq et',
|
||||
'assistant.change.verb.setBookSetup': 'Səhifə formatını dəyiş',
|
||||
'assistant.change.verb.setBookTheme': 'Kitaba mövzu tətbiq et',
|
||||
'assistant.change.verb.duplicateBookPage': 'Səhifənin surətini çıxar',
|
||||
'assistant.change.verb.saveBookLayout': 'Səhifəni maket kimi saxla',
|
||||
'assistant.change.verb.removeBookLayout': 'Saxlanmış maketi sil',
|
||||
|
||||
@@ -65,6 +65,7 @@ import studioPaint from './studioPaint';
|
||||
import studioPhoto from './studioPhoto';
|
||||
import studioStickers from './studioStickers';
|
||||
import studioShapes from './studioShapes';
|
||||
import studioThemes from './studioThemes';
|
||||
import system_notice from './system_notice';
|
||||
import todo from './todo';
|
||||
import tourCollection from './tourCollection';
|
||||
@@ -149,6 +150,7 @@ const locale = {
|
||||
...assistantBudget,
|
||||
...assistantBook,
|
||||
...assistantBookDesign,
|
||||
...studioThemes,
|
||||
...assistantBooking,
|
||||
...assistantCollab,
|
||||
...assistantCollection,
|
||||
|
||||
@@ -0,0 +1,78 @@
|
||||
import type { TranslationStrings } from '../types';
|
||||
|
||||
const studioThemes: TranslationStrings = {
|
||||
'studio.theme.name.posterPop': 'Afişa pop',
|
||||
'studio.theme.name.cutout': 'Kəsik kağız',
|
||||
'studio.theme.name.postcard': 'Açıqca',
|
||||
'studio.theme.name.riviera': 'Rivyera',
|
||||
'studio.theme.name.fabricClassic': 'Klassik kətan',
|
||||
'studio.theme.name.minimalSerif': 'Sadə serif',
|
||||
'studio.theme.name.gridBadge': 'Tor və nişan',
|
||||
'studio.theme.name.scrapbookScript': 'Xatirə albomu',
|
||||
'studio.theme.name.tropical': 'Tropik',
|
||||
'studio.theme.name.nordic': 'Şimal',
|
||||
'studio.theme.name.alpine': 'Alp',
|
||||
'studio.theme.name.indiaStamp': 'Marka kollajı',
|
||||
'studio.theme.descr.posterPop': 'Krem kağız, mərcan və günəbaxan, qalın afişa başlıqları',
|
||||
'studio.theme.descr.cutout': 'Kobalt kağız, mərcan və qum rəngli fiqurlar, ağ yazı',
|
||||
'studio.theme.descr.postcard': 'Nanə rəngli kağız, tünd göy mürəkkəb, möhür qırmızısı və əl yazısı ilə alt başlıq',
|
||||
'studio.theme.descr.riviera': 'İsti ağ, göy, zeytun və limon, yumşaq serif',
|
||||
'studio.theme.descr.fabricClassic': 'Kətan kağız, tozlu mavi və terrakota, incə seriflər',
|
||||
'studio.theme.descr.minimalSerif': 'Ağ kağız, isti boz tonlar və iri, nazik serif',
|
||||
'studio.theme.descr.gridBadge': 'Ağ kağız, qara mürəkkəb və tək qırmızı vurğu',
|
||||
'studio.theme.descr.scrapbookScript': 'Kraft kağız, markerlə başlıqlar, əl yazısı və lent',
|
||||
'studio.theme.descr.tropical': 'Krem üzərində cəngəllik yaşılı, hibiskus qırmızısı və manqo',
|
||||
'studio.theme.descr.nordic': 'Şifer, oxra və çəhrayı ilə açıq boz kağız',
|
||||
'studio.theme.descr.alpine': 'Meşə yaşılı, pas və səma mavisi ilə qar ağı',
|
||||
'studio.theme.descr.indiaStamp': 'Bənövşəyi, zəfəran və firuzəyi ilə isti kağız',
|
||||
'studio.theme.panel': 'Mövzu',
|
||||
'studio.theme.intro':
|
||||
'Bütün kitab üçün bir görünüş seçin. Mövzunu izləyən rənglər və yazı onunla birlikdə dəyişir, qalan hər şey olduğu kimi qalır.',
|
||||
'studio.theme.themes': 'Mövzular',
|
||||
'studio.theme.inUse': 'İstifadədə',
|
||||
'studio.theme.reset': 'Orijinal mövzuya qayıt',
|
||||
'studio.theme.palette': 'Palitra',
|
||||
'studio.theme.token.paper': 'Kağız',
|
||||
'studio.theme.token.ink': 'Mürəkkəb',
|
||||
'studio.theme.token.muted': 'Solğun',
|
||||
'studio.theme.token.accent': 'Vurğu',
|
||||
'studio.theme.token.accent2': 'Vurğu 2',
|
||||
'studio.theme.token.accent3': 'Vurğu 3',
|
||||
'studio.theme.fromPhotos': 'Fotolardan rənglər',
|
||||
'studio.theme.noPhotoColours': 'Fotolarda götürüləcək rəng yoxdur',
|
||||
'studio.theme.fonts': 'Şriftlər',
|
||||
'studio.theme.slot.display': 'Böyük başlıq',
|
||||
'studio.theme.slot.heading': 'Başlıq',
|
||||
'studio.theme.slot.body': 'Mətn',
|
||||
'studio.theme.slot.script': 'Əl yazısı',
|
||||
'studio.theme.noScript': 'Əl yazısı yoxdur',
|
||||
'studio.theme.motifs': 'Motivlər',
|
||||
'studio.theme.motifsHint': 'Bu mövzuya uyğun stiker dəstləri.',
|
||||
'studio.theme.motif.ephemera': 'Səyahət xatirələri',
|
||||
'studio.theme.motif.landmarks': 'Görməli yerlər',
|
||||
'studio.theme.motif.tropical': 'Tropik',
|
||||
'studio.theme.motif.mediterranean': 'Aralıq dənizi',
|
||||
'studio.theme.motif.sea': 'Dəniz və sahil',
|
||||
'studio.theme.motif.mountains': 'Dağlar',
|
||||
'studio.theme.motif.nordic': 'Şimal',
|
||||
'studio.theme.motif.asia': 'Asiya',
|
||||
'studio.theme.motif.food': 'Yemək və kafe',
|
||||
'studio.theme.motif.paper': 'Kağız və lent',
|
||||
'studio.theme.motif.doodles': 'Cızmaqaralar',
|
||||
'studio.theme.motif.ornaments': 'Naxışlar',
|
||||
'studio.theme.decoration': 'Bəzək',
|
||||
'studio.theme.decoration.none': 'Yoxdur',
|
||||
'studio.theme.decoration.light': 'Yüngül',
|
||||
'studio.theme.decoration.rich': 'Zəngin',
|
||||
'studio.theme.adopt': 'Hələ bağlanmayanları da yenidən tərtib et',
|
||||
'studio.theme.adoptHint':
|
||||
'Əvvəlcə fonları, mətnləri və fiqurları mövzuya bağlayır. Fotoların üzərindəki ağ yazı olduğu kimi qalır.',
|
||||
'studio.theme.applyBook': 'Kitaba tətbiq et',
|
||||
'studio.theme.applyPage': 'Bu səhifəyə tətbiq et',
|
||||
'studio.theme.applied': 'Mövzu tətbiq edildi',
|
||||
'studio.theme.nothing': 'Burada hələ heç nə mövzunu izləmir. Bağlamaq üçün yenidən tərtibi yandırın.',
|
||||
'studio.theme.linked': 'Mövzu rəngi',
|
||||
'studio.theme.unlink': 'Mövzunu izləməyi dayandır',
|
||||
};
|
||||
|
||||
export default studioThemes;
|
||||
@@ -3,6 +3,7 @@ import type { TranslationStrings } from '../types';
|
||||
const assistantBookDesign: TranslationStrings = {
|
||||
'assistant.change.verb.designBook': 'Aplicar o design do livro',
|
||||
'assistant.change.verb.setBookSetup': 'Mudar o formato da página',
|
||||
'assistant.change.verb.setBookTheme': 'Aplicar um tema ao livro',
|
||||
'assistant.change.verb.duplicateBookPage': 'Duplicar a página',
|
||||
'assistant.change.verb.saveBookLayout': 'Salvar a página como layout',
|
||||
'assistant.change.verb.removeBookLayout': 'Remover um layout salvo',
|
||||
|
||||
@@ -65,6 +65,7 @@ import studioPaint from './studioPaint';
|
||||
import studioPhoto from './studioPhoto';
|
||||
import studioStickers from './studioStickers';
|
||||
import studioShapes from './studioShapes';
|
||||
import studioThemes from './studioThemes';
|
||||
import system_notice from './system_notice';
|
||||
import todo from './todo';
|
||||
import tourCollection from './tourCollection';
|
||||
@@ -149,6 +150,7 @@ const locale = {
|
||||
...assistantBudget,
|
||||
...assistantBook,
|
||||
...assistantBookDesign,
|
||||
...studioThemes,
|
||||
...assistantBooking,
|
||||
...assistantCollab,
|
||||
...assistantCollection,
|
||||
|
||||
@@ -0,0 +1,78 @@
|
||||
import type { TranslationStrings } from '../types';
|
||||
|
||||
const studioThemes: TranslationStrings = {
|
||||
'studio.theme.name.posterPop': 'Pôster pop',
|
||||
'studio.theme.name.cutout': 'Recortes',
|
||||
'studio.theme.name.postcard': 'Cartão-postal',
|
||||
'studio.theme.name.riviera': 'Riviera', // same-as-en
|
||||
'studio.theme.name.fabricClassic': 'Linho clássico',
|
||||
'studio.theme.name.minimalSerif': 'Serifa mínima',
|
||||
'studio.theme.name.gridBadge': 'Grade e selo',
|
||||
'studio.theme.name.scrapbookScript': 'Álbum de recortes',
|
||||
'studio.theme.name.tropical': 'Tropical', // same-as-en
|
||||
'studio.theme.name.nordic': 'Nórdico',
|
||||
'studio.theme.name.alpine': 'Alpino',
|
||||
'studio.theme.name.indiaStamp': 'Colagem de selos',
|
||||
'studio.theme.descr.posterPop': 'Papel creme, coral e girassol, títulos de pôster encorpados',
|
||||
'studio.theme.descr.cutout': 'Papel cobalto, formas em coral e areia, letras brancas',
|
||||
'studio.theme.descr.postcard': 'Papel menta, tinta azul-marinho, vermelho de carimbo e um subtítulo manuscrito',
|
||||
'studio.theme.descr.riviera': 'Branco quente, azul-celeste, oliva e limão, uma serifa suave',
|
||||
'studio.theme.descr.fabricClassic': 'Papel de linho, azul empoeirado e terracota, serifas finas',
|
||||
'studio.theme.descr.minimalSerif': 'Papel branco, cinzas quentes e uma serifa grande e fina',
|
||||
'studio.theme.descr.gridBadge': 'Papel branco, tinta preta e um único destaque vermelho',
|
||||
'studio.theme.descr.scrapbookScript': 'Papel kraft, títulos a canetão, letra à mão e fita adesiva',
|
||||
'studio.theme.descr.tropical': 'Verde-selva, vermelho-hibisco e manga sobre creme',
|
||||
'studio.theme.descr.nordic': 'Papel cinza-claro com ardósia, ocre e rosa',
|
||||
'studio.theme.descr.alpine': 'Branco-neve com verde-floresta, ferrugem e azul-céu',
|
||||
'studio.theme.descr.indiaStamp': 'Papel quente com magenta, açafrão e verde-petróleo',
|
||||
'studio.theme.panel': 'Tema',
|
||||
'studio.theme.intro':
|
||||
'Escolha um visual para o livro todo. As cores e as letras que seguem o tema mudam com ele, todo o resto continua como está.',
|
||||
'studio.theme.themes': 'Temas',
|
||||
'studio.theme.inUse': 'Em uso',
|
||||
'studio.theme.reset': 'Voltar ao tema original',
|
||||
'studio.theme.palette': 'Paleta',
|
||||
'studio.theme.token.paper': 'Papel',
|
||||
'studio.theme.token.ink': 'Tinta',
|
||||
'studio.theme.token.muted': 'Suave',
|
||||
'studio.theme.token.accent': 'Destaque',
|
||||
'studio.theme.token.accent2': 'Destaque 2',
|
||||
'studio.theme.token.accent3': 'Destaque 3',
|
||||
'studio.theme.fromPhotos': 'Cores das fotos',
|
||||
'studio.theme.noPhotoColours': 'As fotos não têm cor para aproveitar',
|
||||
'studio.theme.fonts': 'Fontes',
|
||||
'studio.theme.slot.display': 'Título grande',
|
||||
'studio.theme.slot.heading': 'Título',
|
||||
'studio.theme.slot.body': 'Corpo',
|
||||
'studio.theme.slot.script': 'Manuscrita',
|
||||
'studio.theme.noScript': 'Sem manuscrita',
|
||||
'studio.theme.motifs': 'Motivos',
|
||||
'studio.theme.motifsHint': 'Os conjuntos de adesivos que combinam com este tema.',
|
||||
'studio.theme.motif.ephemera': 'Lembranças de viagem',
|
||||
'studio.theme.motif.landmarks': 'Monumentos',
|
||||
'studio.theme.motif.tropical': 'Tropical', // same-as-en
|
||||
'studio.theme.motif.mediterranean': 'Mediterrâneo',
|
||||
'studio.theme.motif.sea': 'Mar e litoral',
|
||||
'studio.theme.motif.mountains': 'Montanhas',
|
||||
'studio.theme.motif.nordic': 'Nórdico',
|
||||
'studio.theme.motif.asia': 'Ásia',
|
||||
'studio.theme.motif.food': 'Comida e café',
|
||||
'studio.theme.motif.paper': 'Papel e fita',
|
||||
'studio.theme.motif.doodles': 'Rabiscos',
|
||||
'studio.theme.motif.ornaments': 'Ornamentos',
|
||||
'studio.theme.decoration': 'Decoração',
|
||||
'studio.theme.decoration.none': 'Nenhuma',
|
||||
'studio.theme.decoration.light': 'Leve',
|
||||
'studio.theme.decoration.rich': 'Farta',
|
||||
'studio.theme.adopt': 'Reestilizar também o que ainda não está vinculado',
|
||||
'studio.theme.adoptHint':
|
||||
'Primeiro vincula fundos, textos e formas ao tema. Texto branco sobre fotos fica como está.',
|
||||
'studio.theme.applyBook': 'Aplicar ao livro',
|
||||
'studio.theme.applyPage': 'Aplicar a esta página',
|
||||
'studio.theme.applied': 'Tema aplicado',
|
||||
'studio.theme.nothing': 'Nada aqui segue o tema ainda. Ative a reestilização para vincular.',
|
||||
'studio.theme.linked': 'Cor do tema',
|
||||
'studio.theme.unlink': 'Parar de seguir o tema',
|
||||
};
|
||||
|
||||
export default studioThemes;
|
||||
@@ -3,6 +3,7 @@ import type { TranslationStrings } from '../types';
|
||||
const assistantBookDesign: TranslationStrings = {
|
||||
'assistant.change.verb.designBook': 'Aplicar el disseny del llibre',
|
||||
'assistant.change.verb.setBookSetup': 'Canviar el format de pàgina',
|
||||
'assistant.change.verb.setBookTheme': 'Aplicar un tema al llibre',
|
||||
'assistant.change.verb.duplicateBookPage': 'Duplicar la pàgina',
|
||||
'assistant.change.verb.saveBookLayout': 'Desar la pàgina com a disseny',
|
||||
'assistant.change.verb.removeBookLayout': 'Treure un disseny desat',
|
||||
|
||||
@@ -65,6 +65,7 @@ import studioPaint from './studioPaint';
|
||||
import studioPhoto from './studioPhoto';
|
||||
import studioStickers from './studioStickers';
|
||||
import studioShapes from './studioShapes';
|
||||
import studioThemes from './studioThemes';
|
||||
import system_notice from './system_notice';
|
||||
import todo from './todo';
|
||||
import tourCollection from './tourCollection';
|
||||
@@ -149,6 +150,7 @@ const locale = {
|
||||
...assistantBudget,
|
||||
...assistantBook,
|
||||
...assistantBookDesign,
|
||||
...studioThemes,
|
||||
...assistantBooking,
|
||||
...assistantCollab,
|
||||
...assistantCollection,
|
||||
|
||||
@@ -0,0 +1,78 @@
|
||||
import type { TranslationStrings } from '../types';
|
||||
|
||||
const studioThemes: TranslationStrings = {
|
||||
'studio.theme.name.posterPop': 'Pòster pop',
|
||||
'studio.theme.name.cutout': 'Retalls',
|
||||
'studio.theme.name.postcard': 'Postal',
|
||||
'studio.theme.name.riviera': 'Riviera', // same-as-en
|
||||
'studio.theme.name.fabricClassic': 'Lli clàssic',
|
||||
'studio.theme.name.minimalSerif': 'Serifa mínima',
|
||||
'studio.theme.name.gridBadge': 'Graella i insígnia',
|
||||
'studio.theme.name.scrapbookScript': 'Àlbum de retalls',
|
||||
'studio.theme.name.tropical': 'Tropical', // same-as-en
|
||||
'studio.theme.name.nordic': 'Nòrdic',
|
||||
'studio.theme.name.alpine': 'Alpí',
|
||||
'studio.theme.name.indiaStamp': 'Collage de segells',
|
||||
'studio.theme.descr.posterPop': 'Paper crema, corall i gira-sol, títols de pòster gruixuts',
|
||||
'studio.theme.descr.cutout': 'Paper cobalt, formes corall i sorra, lletra blanca',
|
||||
'studio.theme.descr.postcard': 'Paper menta, tinta blau marí, vermell de segell i un subtítol manuscrit',
|
||||
'studio.theme.descr.riviera': 'Blanc càlid, atzur, oliva i llimona, una serifa suau',
|
||||
'studio.theme.descr.fabricClassic': 'Paper de lli, blau empolsat i terracota, serifes fines',
|
||||
'studio.theme.descr.minimalSerif': 'Paper blanc, grisos càlids i una serifa gran i fina',
|
||||
'studio.theme.descr.gridBadge': 'Paper blanc, tinta negra i un sol accent vermell',
|
||||
'studio.theme.descr.scrapbookScript': 'Paper kraft, títols amb retolador, lletra a mà i cinta',
|
||||
'studio.theme.descr.tropical': 'Verd jungla, vermell d’hibisc i mango sobre crema',
|
||||
'studio.theme.descr.nordic': 'Paper gris clar amb pissarra, ocre i rosa',
|
||||
'studio.theme.descr.alpine': 'Blanc de neu amb verd bosc, rovell i blau cel',
|
||||
'studio.theme.descr.indiaStamp': 'Paper càlid amb magenta, safrà i verd blavós',
|
||||
'studio.theme.panel': 'Tema',
|
||||
'studio.theme.intro':
|
||||
'Tria un estil per a tot el llibre. Els colors i la lletra que segueixen el tema canvien amb ell, tota la resta es queda com està.',
|
||||
'studio.theme.themes': 'Temes',
|
||||
'studio.theme.inUse': 'En ús',
|
||||
'studio.theme.reset': 'Tornar al tema original',
|
||||
'studio.theme.palette': 'Paleta',
|
||||
'studio.theme.token.paper': 'Paper', // same-as-en
|
||||
'studio.theme.token.ink': 'Tinta',
|
||||
'studio.theme.token.muted': 'Atenuat',
|
||||
'studio.theme.token.accent': 'Accent', // same-as-en
|
||||
'studio.theme.token.accent2': 'Accent 2', // same-as-en
|
||||
'studio.theme.token.accent3': 'Accent 3', // same-as-en
|
||||
'studio.theme.fromPhotos': 'Colors de les fotos',
|
||||
'studio.theme.noPhotoColours': 'Les fotos no tenen cap color per agafar',
|
||||
'studio.theme.fonts': 'Tipografies',
|
||||
'studio.theme.slot.display': 'Titular',
|
||||
'studio.theme.slot.heading': 'Encapçalament',
|
||||
'studio.theme.slot.body': 'Cos del text',
|
||||
'studio.theme.slot.script': 'Manuscrita',
|
||||
'studio.theme.noScript': 'Sense manuscrita',
|
||||
'studio.theme.motifs': 'Motius',
|
||||
'studio.theme.motifsHint': 'Els jocs d’adhesius que van amb aquest tema.',
|
||||
'studio.theme.motif.ephemera': 'Records de viatge',
|
||||
'studio.theme.motif.landmarks': 'Monuments',
|
||||
'studio.theme.motif.tropical': 'Tropical', // same-as-en
|
||||
'studio.theme.motif.mediterranean': 'Mediterrani',
|
||||
'studio.theme.motif.sea': 'Mar i costa',
|
||||
'studio.theme.motif.mountains': 'Muntanyes',
|
||||
'studio.theme.motif.nordic': 'Nòrdic',
|
||||
'studio.theme.motif.asia': 'Àsia',
|
||||
'studio.theme.motif.food': 'Menjar i cafè',
|
||||
'studio.theme.motif.paper': 'Paper i cinta',
|
||||
'studio.theme.motif.doodles': 'Gargots',
|
||||
'studio.theme.motif.ornaments': 'Ornaments', // same-as-en
|
||||
'studio.theme.decoration': 'Decoració',
|
||||
'studio.theme.decoration.none': 'Cap',
|
||||
'studio.theme.decoration.light': 'Lleugera',
|
||||
'studio.theme.decoration.rich': 'Abundant',
|
||||
'studio.theme.adopt': 'Reestilitzar també el que encara no està vinculat',
|
||||
'studio.theme.adoptHint':
|
||||
'Primer vincula fons, textos i formes al tema. El text blanc sobre fotos es queda com està.',
|
||||
'studio.theme.applyBook': 'Aplicar al llibre',
|
||||
'studio.theme.applyPage': 'Aplicar a aquesta pàgina',
|
||||
'studio.theme.applied': 'Tema aplicat',
|
||||
'studio.theme.nothing': 'Aquí encara res no segueix el tema. Activa la reestilització per vincular-ho.',
|
||||
'studio.theme.linked': 'Color del tema',
|
||||
'studio.theme.unlink': 'Deixar de seguir el tema',
|
||||
};
|
||||
|
||||
export default studioThemes;
|
||||
@@ -3,6 +3,7 @@ import type { TranslationStrings } from '../types';
|
||||
const assistantBookDesign: TranslationStrings = {
|
||||
'assistant.change.verb.designBook': 'Použít návrh knihy',
|
||||
'assistant.change.verb.setBookSetup': 'Změnit formát stránek',
|
||||
'assistant.change.verb.setBookTheme': 'Použít motiv na knihu',
|
||||
'assistant.change.verb.duplicateBookPage': 'Duplikovat stránku',
|
||||
'assistant.change.verb.saveBookLayout': 'Uložit stránku jako rozvržení',
|
||||
'assistant.change.verb.removeBookLayout': 'Odebrat uložené rozvržení',
|
||||
|
||||
@@ -65,6 +65,7 @@ import studioPaint from './studioPaint';
|
||||
import studioPhoto from './studioPhoto';
|
||||
import studioStickers from './studioStickers';
|
||||
import studioShapes from './studioShapes';
|
||||
import studioThemes from './studioThemes';
|
||||
import system_notice from './system_notice';
|
||||
import todo from './todo';
|
||||
import tourCollection from './tourCollection';
|
||||
@@ -149,6 +150,7 @@ const locale = {
|
||||
...assistantBudget,
|
||||
...assistantBook,
|
||||
...assistantBookDesign,
|
||||
...studioThemes,
|
||||
...assistantBooking,
|
||||
...assistantCollab,
|
||||
...assistantCollection,
|
||||
|
||||
@@ -0,0 +1,77 @@
|
||||
import type { TranslationStrings } from '../types';
|
||||
|
||||
const studioThemes: TranslationStrings = {
|
||||
'studio.theme.name.posterPop': 'Plakátový pop',
|
||||
'studio.theme.name.cutout': 'Vystřihovánky',
|
||||
'studio.theme.name.postcard': 'Pohlednice',
|
||||
'studio.theme.name.riviera': 'Riviéra',
|
||||
'studio.theme.name.fabricClassic': 'Klasické plátno',
|
||||
'studio.theme.name.minimalSerif': 'Střídmá patka',
|
||||
'studio.theme.name.gridBadge': 'Mřížka s odznakem',
|
||||
'studio.theme.name.scrapbookScript': 'Album vzpomínek',
|
||||
'studio.theme.name.tropical': 'Tropy',
|
||||
'studio.theme.name.nordic': 'Severský',
|
||||
'studio.theme.name.alpine': 'Alpský',
|
||||
'studio.theme.name.indiaStamp': 'Koláž známek',
|
||||
'studio.theme.descr.posterPop': 'Krémový papír, korálová a slunečnicová, výrazné plakátové nadpisy',
|
||||
'studio.theme.descr.cutout': 'Kobaltový papír, tvary v korálové a písková, bílé písmo',
|
||||
'studio.theme.descr.postcard': 'Mátový papír, námořnická modř, razítková červená a psaný podtitul',
|
||||
'studio.theme.descr.riviera': 'Teplá bílá, azur, olivová a citronová, měkké patkové písmo',
|
||||
'studio.theme.descr.fabricClassic': 'Lněný papír, prašně modrá a terakota, jemné patky',
|
||||
'studio.theme.descr.minimalSerif': 'Bílý papír, teplé šedé a velké tenké patkové písmo',
|
||||
'studio.theme.descr.gridBadge': 'Bílý papír, černá barva a jediný červený akcent',
|
||||
'studio.theme.descr.scrapbookScript': 'Balicí papír, nadpisy fixou, ruční písmo a páska',
|
||||
'studio.theme.descr.tropical': 'Džunglově zelená, ibiškově červená a mango na krémové',
|
||||
'studio.theme.descr.nordic': 'Světle šedý papír s břidlicovou, okrovou a růžovou',
|
||||
'studio.theme.descr.alpine': 'Sněhově bílá s lesní zelenou, rezavou a nebeskou modří',
|
||||
'studio.theme.descr.indiaStamp': 'Teplý papír s purpurovou, šafránovou a petrolejovou',
|
||||
'studio.theme.panel': 'Motiv',
|
||||
'studio.theme.intro':
|
||||
'Vyberte vzhled pro celou knihu. Barvy a písmo, které motiv následují, se změní s ním, vše ostatní zůstane, jak je.',
|
||||
'studio.theme.themes': 'Motivy',
|
||||
'studio.theme.inUse': 'Používá se',
|
||||
'studio.theme.reset': 'Zpět na původní motiv',
|
||||
'studio.theme.palette': 'Paleta',
|
||||
'studio.theme.token.paper': 'Papír',
|
||||
'studio.theme.token.ink': 'Inkoust',
|
||||
'studio.theme.token.muted': 'Tlumená',
|
||||
'studio.theme.token.accent': 'Akcent',
|
||||
'studio.theme.token.accent2': 'Akcent 2',
|
||||
'studio.theme.token.accent3': 'Akcent 3',
|
||||
'studio.theme.fromPhotos': 'Barvy z fotek',
|
||||
'studio.theme.noPhotoColours': 'Fotky nemají žádnou barvu k převzetí',
|
||||
'studio.theme.fonts': 'Písma',
|
||||
'studio.theme.slot.display': 'Titulkové',
|
||||
'studio.theme.slot.heading': 'Nadpis',
|
||||
'studio.theme.slot.body': 'Text',
|
||||
'studio.theme.slot.script': 'Psané',
|
||||
'studio.theme.noScript': 'Bez psaného písma',
|
||||
'studio.theme.motifs': 'Ozdoby',
|
||||
'studio.theme.motifsHint': 'Sady nálepek, které se k motivu hodí.',
|
||||
'studio.theme.motif.ephemera': 'Cestovní drobnosti',
|
||||
'studio.theme.motif.landmarks': 'Památky',
|
||||
'studio.theme.motif.tropical': 'Tropy',
|
||||
'studio.theme.motif.mediterranean': 'Středomoří',
|
||||
'studio.theme.motif.sea': 'Moře a pobřeží',
|
||||
'studio.theme.motif.mountains': 'Hory',
|
||||
'studio.theme.motif.nordic': 'Sever',
|
||||
'studio.theme.motif.asia': 'Asie',
|
||||
'studio.theme.motif.food': 'Jídlo a kavárna',
|
||||
'studio.theme.motif.paper': 'Papír a páska',
|
||||
'studio.theme.motif.doodles': 'Čmáranice',
|
||||
'studio.theme.motif.ornaments': 'Ornamenty',
|
||||
'studio.theme.decoration': 'Zdobení',
|
||||
'studio.theme.decoration.none': 'Žádné',
|
||||
'studio.theme.decoration.light': 'Střídmé',
|
||||
'studio.theme.decoration.rich': 'Bohaté',
|
||||
'studio.theme.adopt': 'Přestylovat i to, co ještě není propojené',
|
||||
'studio.theme.adoptHint': 'Nejdřív propojí pozadí, texty a tvary s motivem. Bílý text na fotkách zůstane, jak je.',
|
||||
'studio.theme.applyBook': 'Použít na knihu',
|
||||
'studio.theme.applyPage': 'Použít na tuto stránku',
|
||||
'studio.theme.applied': 'Motiv použit',
|
||||
'studio.theme.nothing': 'Tady zatím nic motiv nenásleduje. Zapněte přestylování a propojte to.',
|
||||
'studio.theme.linked': 'Barva motivu',
|
||||
'studio.theme.unlink': 'Přestat následovat motiv',
|
||||
};
|
||||
|
||||
export default studioThemes;
|
||||
@@ -3,6 +3,7 @@ import type { TranslationStrings } from '../types';
|
||||
const assistantBookDesign: TranslationStrings = {
|
||||
'assistant.change.verb.designBook': 'Buchdesign übernehmen',
|
||||
'assistant.change.verb.setBookSetup': 'Seitenformat ändern',
|
||||
'assistant.change.verb.setBookTheme': 'Ein Thema auf das Buch anwenden',
|
||||
'assistant.change.verb.duplicateBookPage': 'Seite duplizieren',
|
||||
'assistant.change.verb.saveBookLayout': 'Seite als Layout speichern',
|
||||
'assistant.change.verb.removeBookLayout': 'Gespeichertes Layout entfernen',
|
||||
|
||||
@@ -65,6 +65,7 @@ import studioPaint from './studioPaint';
|
||||
import studioPhoto from './studioPhoto';
|
||||
import studioStickers from './studioStickers';
|
||||
import studioShapes from './studioShapes';
|
||||
import studioThemes from './studioThemes';
|
||||
import system_notice from './system_notice';
|
||||
import todo from './todo';
|
||||
import tourCollection from './tourCollection';
|
||||
@@ -149,6 +150,7 @@ const locale = {
|
||||
...assistantBudget,
|
||||
...assistantBook,
|
||||
...assistantBookDesign,
|
||||
...studioThemes,
|
||||
...assistantBooking,
|
||||
...assistantCollab,
|
||||
...assistantCollection,
|
||||
|
||||
@@ -0,0 +1,78 @@
|
||||
import type { TranslationStrings } from '../types';
|
||||
|
||||
const studioThemes: TranslationStrings = {
|
||||
'studio.theme.name.posterPop': 'Poster-Pop',
|
||||
'studio.theme.name.cutout': 'Scherenschnitt',
|
||||
'studio.theme.name.postcard': 'Postkarte',
|
||||
'studio.theme.name.riviera': 'Riviera', // same-as-en
|
||||
'studio.theme.name.fabricClassic': 'Leinen klassisch',
|
||||
'studio.theme.name.minimalSerif': 'Schlichte Serife',
|
||||
'studio.theme.name.gridBadge': 'Raster mit Plakette',
|
||||
'studio.theme.name.scrapbookScript': 'Sammelalbum',
|
||||
'studio.theme.name.tropical': 'Tropisch',
|
||||
'studio.theme.name.nordic': 'Nordisch',
|
||||
'studio.theme.name.alpine': 'Alpin',
|
||||
'studio.theme.name.indiaStamp': 'Briefmarken-Collage',
|
||||
'studio.theme.descr.posterPop': 'Cremepapier, Koralle und Sonnengelb, kräftige Plakattitel',
|
||||
'studio.theme.descr.cutout': 'Kobaltpapier, Formen in Koralle und Sand, weiße Schrift',
|
||||
'studio.theme.descr.postcard': 'Mintpapier, Marineblau, Stempelrot und ein Untertitel in Schreibschrift',
|
||||
'studio.theme.descr.riviera': 'Warmweiß, Azur, Oliv und Zitrone, eine weiche Serifenschrift',
|
||||
'studio.theme.descr.fabricClassic': 'Leinenpapier, Taubenblau und Terrakotta, feine Serifen',
|
||||
'studio.theme.descr.minimalSerif': 'Weißes Papier, warme Grautöne und eine große, feine Serife',
|
||||
'studio.theme.descr.gridBadge': 'Weißes Papier, schwarze Schrift und ein roter Akzent',
|
||||
'studio.theme.descr.scrapbookScript': 'Packpapier, Filzstifttitel, Handschrift und Klebeband',
|
||||
'studio.theme.descr.tropical': 'Dschungelgrün, Hibiskusrot und Mango auf Creme',
|
||||
'studio.theme.descr.nordic': 'Hellgraues Papier mit Schiefer, Ocker und Rosé',
|
||||
'studio.theme.descr.alpine': 'Schneeweiß mit Waldgrün, Rost und Himmelblau',
|
||||
'studio.theme.descr.indiaStamp': 'Warmes Papier mit Magenta, Safran und Petrol',
|
||||
'studio.theme.panel': 'Thema',
|
||||
'studio.theme.intro':
|
||||
'Wähle einen Look für das ganze Buch. Farben und Schrift, die dem Thema folgen, ändern sich mit, alles andere bleibt, wie es ist.',
|
||||
'studio.theme.themes': 'Themen',
|
||||
'studio.theme.inUse': 'In Verwendung',
|
||||
'studio.theme.reset': 'Zurück zum ursprünglichen Thema',
|
||||
'studio.theme.palette': 'Palette', // same-as-en
|
||||
'studio.theme.token.paper': 'Papier',
|
||||
'studio.theme.token.ink': 'Tinte',
|
||||
'studio.theme.token.muted': 'Gedämpft',
|
||||
'studio.theme.token.accent': 'Akzent',
|
||||
'studio.theme.token.accent2': 'Akzent 2',
|
||||
'studio.theme.token.accent3': 'Akzent 3',
|
||||
'studio.theme.fromPhotos': 'Farben aus den Fotos',
|
||||
'studio.theme.noPhotoColours': 'Die Fotos haben keine Farbe zum Übernehmen',
|
||||
'studio.theme.fonts': 'Schriften',
|
||||
'studio.theme.slot.display': 'Titelschrift',
|
||||
'studio.theme.slot.heading': 'Überschrift',
|
||||
'studio.theme.slot.body': 'Fließtext',
|
||||
'studio.theme.slot.script': 'Schreibschrift',
|
||||
'studio.theme.noScript': 'Keine Schreibschrift',
|
||||
'studio.theme.motifs': 'Motive',
|
||||
'studio.theme.motifsHint': 'Die Sticker-Sets, die zu diesem Thema passen.',
|
||||
'studio.theme.motif.ephemera': 'Reise-Ephemera',
|
||||
'studio.theme.motif.landmarks': 'Wahrzeichen',
|
||||
'studio.theme.motif.tropical': 'Tropisch',
|
||||
'studio.theme.motif.mediterranean': 'Mittelmeer',
|
||||
'studio.theme.motif.sea': 'Meer und Küste',
|
||||
'studio.theme.motif.mountains': 'Berge',
|
||||
'studio.theme.motif.nordic': 'Nordisch',
|
||||
'studio.theme.motif.asia': 'Asien',
|
||||
'studio.theme.motif.food': 'Essen und Café',
|
||||
'studio.theme.motif.paper': 'Papier und Klebeband',
|
||||
'studio.theme.motif.doodles': 'Kritzeleien',
|
||||
'studio.theme.motif.ornaments': 'Ornamente',
|
||||
'studio.theme.decoration': 'Dekoration',
|
||||
'studio.theme.decoration.none': 'Keine',
|
||||
'studio.theme.decoration.light': 'Leicht',
|
||||
'studio.theme.decoration.rich': 'Üppig',
|
||||
'studio.theme.adopt': 'Auch noch nicht Verknüpftes neu gestalten',
|
||||
'studio.theme.adoptHint':
|
||||
'Verknüpft zuerst Hintergründe, Texte und Formen mit dem Thema. Weiße Schrift auf Fotos bleibt, wie sie ist.',
|
||||
'studio.theme.applyBook': 'Auf das Buch anwenden',
|
||||
'studio.theme.applyPage': 'Auf diese Seite anwenden',
|
||||
'studio.theme.applied': 'Thema angewendet',
|
||||
'studio.theme.nothing': 'Hier folgt noch nichts dem Thema. Schalte das Neugestalten ein, um es zu verknüpfen.',
|
||||
'studio.theme.linked': 'Themenfarbe',
|
||||
'studio.theme.unlink': 'Dem Thema nicht mehr folgen',
|
||||
};
|
||||
|
||||
export default studioThemes;
|
||||
@@ -3,6 +3,7 @@ import type { TranslationStrings } from '../types';
|
||||
const assistantBookDesign: TranslationStrings = {
|
||||
'assistant.change.verb.designBook': 'Apply the book design',
|
||||
'assistant.change.verb.setBookSetup': 'Change the page format',
|
||||
'assistant.change.verb.setBookTheme': 'Apply a theme to the book',
|
||||
'assistant.change.verb.duplicateBookPage': 'Duplicate the page',
|
||||
'assistant.change.verb.saveBookLayout': 'Save the page as a layout',
|
||||
'assistant.change.verb.removeBookLayout': 'Remove a saved layout',
|
||||
|
||||
@@ -65,6 +65,7 @@ import studioPaint from './studioPaint';
|
||||
import studioPhoto from './studioPhoto';
|
||||
import studioStickers from './studioStickers';
|
||||
import studioShapes from './studioShapes';
|
||||
import studioThemes from './studioThemes';
|
||||
import system_notice from './system_notice';
|
||||
import todo from './todo';
|
||||
import tourCollection from './tourCollection';
|
||||
@@ -149,6 +150,7 @@ const locale = {
|
||||
...assistantBudget,
|
||||
...assistantBook,
|
||||
...assistantBookDesign,
|
||||
...studioThemes,
|
||||
...assistantBooking,
|
||||
...assistantCollab,
|
||||
...assistantCollection,
|
||||
|
||||
@@ -0,0 +1,78 @@
|
||||
import type { TranslationStrings } from '../types';
|
||||
|
||||
const studioThemes: TranslationStrings = {
|
||||
'studio.theme.name.posterPop': 'Poster pop',
|
||||
'studio.theme.name.cutout': 'Cut-out',
|
||||
'studio.theme.name.postcard': 'Postcard',
|
||||
'studio.theme.name.riviera': 'Riviera',
|
||||
'studio.theme.name.fabricClassic': 'Linen classic',
|
||||
'studio.theme.name.minimalSerif': 'Minimal serif',
|
||||
'studio.theme.name.gridBadge': 'Grid and badge',
|
||||
'studio.theme.name.scrapbookScript': 'Scrapbook',
|
||||
'studio.theme.name.tropical': 'Tropical',
|
||||
'studio.theme.name.nordic': 'Nordic',
|
||||
'studio.theme.name.alpine': 'Alpine',
|
||||
'studio.theme.name.indiaStamp': 'Stamp collage',
|
||||
'studio.theme.descr.posterPop': 'Cream paper, coral and sunflower, heavy poster titles',
|
||||
'studio.theme.descr.cutout': 'Cobalt paper, coral and sand shapes, white type',
|
||||
'studio.theme.descr.postcard': 'Mint paper, navy ink, stamp red and a script subtitle',
|
||||
'studio.theme.descr.riviera': 'Warm white, azure, olive and lemon, a soft serif',
|
||||
'studio.theme.descr.fabricClassic': 'Linen paper, dusty blue and terracotta, fine serifs',
|
||||
'studio.theme.descr.minimalSerif': 'White paper, warm greys and a large thin serif',
|
||||
'studio.theme.descr.gridBadge': 'White paper, black ink and one red accent',
|
||||
'studio.theme.descr.scrapbookScript': 'Kraft paper, marker titles, handwriting and tape',
|
||||
'studio.theme.descr.tropical': 'Jungle green, hibiscus red and mango on cream',
|
||||
'studio.theme.descr.nordic': 'Pale grey paper with slate, ochre and rose',
|
||||
'studio.theme.descr.alpine': 'Snow white with forest green, rust and sky blue',
|
||||
'studio.theme.descr.indiaStamp': 'Warm paper with magenta, saffron and teal',
|
||||
'studio.theme.panel': 'Theme',
|
||||
'studio.theme.intro':
|
||||
'Pick a look for the whole book. Colours and type that follow the theme change with it, everything else stays as it is.',
|
||||
'studio.theme.themes': 'Themes',
|
||||
'studio.theme.inUse': 'In use',
|
||||
'studio.theme.reset': 'Back to the original theme',
|
||||
'studio.theme.palette': 'Palette',
|
||||
'studio.theme.token.paper': 'Paper',
|
||||
'studio.theme.token.ink': 'Ink',
|
||||
'studio.theme.token.muted': 'Muted',
|
||||
'studio.theme.token.accent': 'Accent',
|
||||
'studio.theme.token.accent2': 'Accent 2',
|
||||
'studio.theme.token.accent3': 'Accent 3',
|
||||
'studio.theme.fromPhotos': 'Colours from the photos',
|
||||
'studio.theme.noPhotoColours': 'The photos have no colour to take',
|
||||
'studio.theme.fonts': 'Typefaces',
|
||||
'studio.theme.slot.display': 'Display',
|
||||
'studio.theme.slot.heading': 'Heading',
|
||||
'studio.theme.slot.body': 'Body',
|
||||
'studio.theme.slot.script': 'Script',
|
||||
'studio.theme.noScript': 'No script',
|
||||
'studio.theme.motifs': 'Motifs',
|
||||
'studio.theme.motifsHint': 'The sticker sets that suit this theme.',
|
||||
'studio.theme.motif.ephemera': 'Travel ephemera',
|
||||
'studio.theme.motif.landmarks': 'Landmarks',
|
||||
'studio.theme.motif.tropical': 'Tropical',
|
||||
'studio.theme.motif.mediterranean': 'Mediterranean',
|
||||
'studio.theme.motif.sea': 'Sea and coast',
|
||||
'studio.theme.motif.mountains': 'Mountains',
|
||||
'studio.theme.motif.nordic': 'Nordic',
|
||||
'studio.theme.motif.asia': 'Asia',
|
||||
'studio.theme.motif.food': 'Food and café',
|
||||
'studio.theme.motif.paper': 'Paper and tape',
|
||||
'studio.theme.motif.doodles': 'Doodles',
|
||||
'studio.theme.motif.ornaments': 'Ornaments',
|
||||
'studio.theme.decoration': 'Decoration',
|
||||
'studio.theme.decoration.none': 'None',
|
||||
'studio.theme.decoration.light': 'Light',
|
||||
'studio.theme.decoration.rich': 'Rich',
|
||||
'studio.theme.adopt': "Also restyle what isn't linked yet",
|
||||
'studio.theme.adoptHint':
|
||||
'Links backgrounds, text and shapes to the theme first. White words over photos stay as they are.',
|
||||
'studio.theme.applyBook': 'Apply to the book',
|
||||
'studio.theme.applyPage': 'Apply to this page',
|
||||
'studio.theme.applied': 'Theme applied',
|
||||
'studio.theme.nothing': 'Nothing here follows the theme yet. Switch on restyling to link it.',
|
||||
'studio.theme.linked': 'Theme colour',
|
||||
'studio.theme.unlink': 'Stop following the theme',
|
||||
};
|
||||
|
||||
export default studioThemes;
|
||||
@@ -3,6 +3,7 @@ import type { TranslationStrings } from '../types';
|
||||
const assistantBookDesign: TranslationStrings = {
|
||||
'assistant.change.verb.designBook': 'Aplicar el diseño del libro',
|
||||
'assistant.change.verb.setBookSetup': 'Cambiar el formato de página',
|
||||
'assistant.change.verb.setBookTheme': 'Aplicar un tema al libro',
|
||||
'assistant.change.verb.duplicateBookPage': 'Duplicar la página',
|
||||
'assistant.change.verb.saveBookLayout': 'Guardar la página como diseño',
|
||||
'assistant.change.verb.removeBookLayout': 'Quitar un diseño guardado',
|
||||
|
||||
@@ -65,6 +65,7 @@ import studioPaint from './studioPaint';
|
||||
import studioPhoto from './studioPhoto';
|
||||
import studioStickers from './studioStickers';
|
||||
import studioShapes from './studioShapes';
|
||||
import studioThemes from './studioThemes';
|
||||
import system_notice from './system_notice';
|
||||
import todo from './todo';
|
||||
import tourCollection from './tourCollection';
|
||||
@@ -149,6 +150,7 @@ const locale = {
|
||||
...assistantBudget,
|
||||
...assistantBook,
|
||||
...assistantBookDesign,
|
||||
...studioThemes,
|
||||
...assistantBooking,
|
||||
...assistantCollab,
|
||||
...assistantCollection,
|
||||
|
||||
@@ -0,0 +1,78 @@
|
||||
import type { TranslationStrings } from '../types';
|
||||
|
||||
const studioThemes: TranslationStrings = {
|
||||
'studio.theme.name.posterPop': 'Póster pop',
|
||||
'studio.theme.name.cutout': 'Recortes',
|
||||
'studio.theme.name.postcard': 'Postal',
|
||||
'studio.theme.name.riviera': 'Riviera', // same-as-en
|
||||
'studio.theme.name.fabricClassic': 'Lino clásico',
|
||||
'studio.theme.name.minimalSerif': 'Serifa mínima',
|
||||
'studio.theme.name.gridBadge': 'Cuadrícula e insignia',
|
||||
'studio.theme.name.scrapbookScript': 'Álbum de recortes',
|
||||
'studio.theme.name.tropical': 'Tropical', // same-as-en
|
||||
'studio.theme.name.nordic': 'Nórdico',
|
||||
'studio.theme.name.alpine': 'Alpino',
|
||||
'studio.theme.name.indiaStamp': 'Collage de sellos',
|
||||
'studio.theme.descr.posterPop': 'Papel crema, coral y girasol, títulos de póster gruesos',
|
||||
'studio.theme.descr.cutout': 'Papel cobalto, formas coral y arena, letra blanca',
|
||||
'studio.theme.descr.postcard': 'Papel menta, tinta marino, rojo de sello y un subtítulo manuscrito',
|
||||
'studio.theme.descr.riviera': 'Blanco cálido, azur, oliva y limón, una serifa suave',
|
||||
'studio.theme.descr.fabricClassic': 'Papel de lino, azul empolvado y terracota, serifas finas',
|
||||
'studio.theme.descr.minimalSerif': 'Papel blanco, grises cálidos y una serifa grande y fina',
|
||||
'studio.theme.descr.gridBadge': 'Papel blanco, tinta negra y un solo acento rojo',
|
||||
'studio.theme.descr.scrapbookScript': 'Papel kraft, títulos a rotulador, letra a mano y cinta',
|
||||
'studio.theme.descr.tropical': 'Verde selva, rojo hibisco y mango sobre crema',
|
||||
'studio.theme.descr.nordic': 'Papel gris claro con pizarra, ocre y rosa',
|
||||
'studio.theme.descr.alpine': 'Blanco nieve con verde bosque, óxido y azul cielo',
|
||||
'studio.theme.descr.indiaStamp': 'Papel cálido con magenta, azafrán y verde azulado',
|
||||
'studio.theme.panel': 'Tema',
|
||||
'studio.theme.intro':
|
||||
'Elige un estilo para todo el libro. Los colores y la letra que siguen al tema cambian con él, todo lo demás se queda como está.',
|
||||
'studio.theme.themes': 'Temas',
|
||||
'studio.theme.inUse': 'En uso',
|
||||
'studio.theme.reset': 'Volver al tema original',
|
||||
'studio.theme.palette': 'Paleta',
|
||||
'studio.theme.token.paper': 'Papel',
|
||||
'studio.theme.token.ink': 'Tinta',
|
||||
'studio.theme.token.muted': 'Atenuado',
|
||||
'studio.theme.token.accent': 'Acento',
|
||||
'studio.theme.token.accent2': 'Acento 2',
|
||||
'studio.theme.token.accent3': 'Acento 3',
|
||||
'studio.theme.fromPhotos': 'Colores de las fotos',
|
||||
'studio.theme.noPhotoColours': 'Las fotos no tienen ningún color que tomar',
|
||||
'studio.theme.fonts': 'Tipografías',
|
||||
'studio.theme.slot.display': 'Titular',
|
||||
'studio.theme.slot.heading': 'Encabezado',
|
||||
'studio.theme.slot.body': 'Cuerpo',
|
||||
'studio.theme.slot.script': 'Manuscrita',
|
||||
'studio.theme.noScript': 'Sin manuscrita',
|
||||
'studio.theme.motifs': 'Motivos',
|
||||
'studio.theme.motifsHint': 'Los juegos de pegatinas que van con este tema.',
|
||||
'studio.theme.motif.ephemera': 'Recuerdos de viaje',
|
||||
'studio.theme.motif.landmarks': 'Monumentos',
|
||||
'studio.theme.motif.tropical': 'Tropical', // same-as-en
|
||||
'studio.theme.motif.mediterranean': 'Mediterráneo',
|
||||
'studio.theme.motif.sea': 'Mar y costa',
|
||||
'studio.theme.motif.mountains': 'Montañas',
|
||||
'studio.theme.motif.nordic': 'Nórdico',
|
||||
'studio.theme.motif.asia': 'Asia', // same-as-en
|
||||
'studio.theme.motif.food': 'Comida y café',
|
||||
'studio.theme.motif.paper': 'Papel y cinta',
|
||||
'studio.theme.motif.doodles': 'Garabatos',
|
||||
'studio.theme.motif.ornaments': 'Ornamentos',
|
||||
'studio.theme.decoration': 'Decoración',
|
||||
'studio.theme.decoration.none': 'Ninguna',
|
||||
'studio.theme.decoration.light': 'Ligera',
|
||||
'studio.theme.decoration.rich': 'Abundante',
|
||||
'studio.theme.adopt': 'Restilizar también lo que aún no está vinculado',
|
||||
'studio.theme.adoptHint':
|
||||
'Primero vincula fondos, textos y formas al tema. El texto blanco sobre fotos se queda como está.',
|
||||
'studio.theme.applyBook': 'Aplicar al libro',
|
||||
'studio.theme.applyPage': 'Aplicar a esta página',
|
||||
'studio.theme.applied': 'Tema aplicado',
|
||||
'studio.theme.nothing': 'Aquí todavía nada sigue al tema. Activa el restilizado para vincularlo.',
|
||||
'studio.theme.linked': 'Color del tema',
|
||||
'studio.theme.unlink': 'Dejar de seguir el tema',
|
||||
};
|
||||
|
||||
export default studioThemes;
|
||||
@@ -3,6 +3,7 @@ import type { TranslationStrings } from '../types';
|
||||
const assistantBookDesign: TranslationStrings = {
|
||||
'assistant.change.verb.designBook': 'Rakenda raamatu kujundus',
|
||||
'assistant.change.verb.setBookSetup': 'Muuda lehekülje formaati',
|
||||
'assistant.change.verb.setBookTheme': 'Rakenda raamatule teema',
|
||||
'assistant.change.verb.duplicateBookPage': 'Tee leheküljest koopia',
|
||||
'assistant.change.verb.saveBookLayout': 'Salvesta lehekülg paigutusena',
|
||||
'assistant.change.verb.removeBookLayout': 'Eemalda salvestatud paigutus',
|
||||
|
||||
@@ -65,6 +65,7 @@ import studioPaint from './studioPaint';
|
||||
import studioPhoto from './studioPhoto';
|
||||
import studioStickers from './studioStickers';
|
||||
import studioShapes from './studioShapes';
|
||||
import studioThemes from './studioThemes';
|
||||
import system_notice from './system_notice';
|
||||
import todo from './todo';
|
||||
import tourCollection from './tourCollection';
|
||||
@@ -149,6 +150,7 @@ const locale = {
|
||||
...assistantBudget,
|
||||
...assistantBook,
|
||||
...assistantBookDesign,
|
||||
...studioThemes,
|
||||
...assistantBooking,
|
||||
...assistantCollab,
|
||||
...assistantCollection,
|
||||
|
||||
@@ -0,0 +1,77 @@
|
||||
import type { TranslationStrings } from '../types';
|
||||
|
||||
const studioThemes: TranslationStrings = {
|
||||
'studio.theme.name.posterPop': 'Plakatipop',
|
||||
'studio.theme.name.cutout': 'Väljalõiked',
|
||||
'studio.theme.name.postcard': 'Postkaart',
|
||||
'studio.theme.name.riviera': 'Rivjeera',
|
||||
'studio.theme.name.fabricClassic': 'Linane klassika',
|
||||
'studio.theme.name.minimalSerif': 'Minimaalne seriif',
|
||||
'studio.theme.name.gridBadge': 'Ruudustik ja märk',
|
||||
'studio.theme.name.scrapbookScript': 'Mälestusalbum',
|
||||
'studio.theme.name.tropical': 'Troopika',
|
||||
'studio.theme.name.nordic': 'Põhjamaine',
|
||||
'studio.theme.name.alpine': 'Alpi',
|
||||
'studio.theme.name.indiaStamp': 'Postmargikollaaž',
|
||||
'studio.theme.descr.posterPop': 'Kreemjas paber, korall ja päevalill, jõulised plakatipealkirjad',
|
||||
'studio.theme.descr.cutout': 'Koobaltpaber, korall- ja liivakarva kujundid, valge kiri',
|
||||
'studio.theme.descr.postcard': 'Mündiroheline paber, meresinine tint, templipunane ja käsikirjaline alapealkiri',
|
||||
'studio.theme.descr.riviera': 'Soe valge, taevasinine, oliiv ja sidrun, pehme seriif',
|
||||
'studio.theme.descr.fabricClassic': 'Linane paber, tolmusinine ja terrakota, peened seriifid',
|
||||
'studio.theme.descr.minimalSerif': 'Valge paber, soojad hallid ja suur peenike seriif',
|
||||
'studio.theme.descr.gridBadge': 'Valge paber, must tint ja üks punane aktsent',
|
||||
'studio.theme.descr.scrapbookScript': 'Pakkepaber, markeriga pealkirjad, käekiri ja teip',
|
||||
'studio.theme.descr.tropical': 'Džunglirohe, hibiskipunane ja mango kreemjal põhjal',
|
||||
'studio.theme.descr.nordic': 'Helehall paber kiltkivi, ookri ja roosaga',
|
||||
'studio.theme.descr.alpine': 'Lumivalge metsarohelise, rooste ja taevasinisega',
|
||||
'studio.theme.descr.indiaStamp': 'Soe paber magenta, safrani ja sinakasrohelisega',
|
||||
'studio.theme.panel': 'Teema',
|
||||
'studio.theme.intro':
|
||||
'Vali kogu raamatule üks välimus. Teemat järgivad värvid ja kiri muutuvad koos sellega, kõik muu jääb samaks.',
|
||||
'studio.theme.themes': 'Teemad',
|
||||
'studio.theme.inUse': 'Kasutusel',
|
||||
'studio.theme.reset': 'Tagasi algse teema juurde',
|
||||
'studio.theme.palette': 'Palett',
|
||||
'studio.theme.token.paper': 'Paber',
|
||||
'studio.theme.token.ink': 'Tint',
|
||||
'studio.theme.token.muted': 'Summutatud',
|
||||
'studio.theme.token.accent': 'Aktsent',
|
||||
'studio.theme.token.accent2': 'Aktsent 2',
|
||||
'studio.theme.token.accent3': 'Aktsent 3',
|
||||
'studio.theme.fromPhotos': 'Värvid fotodelt',
|
||||
'studio.theme.noPhotoColours': 'Fotodel pole värvi, mida võtta',
|
||||
'studio.theme.fonts': 'Kirjatüübid',
|
||||
'studio.theme.slot.display': 'Tiitelkiri',
|
||||
'studio.theme.slot.heading': 'Pealkiri',
|
||||
'studio.theme.slot.body': 'Põhitekst',
|
||||
'studio.theme.slot.script': 'Käekiri',
|
||||
'studio.theme.noScript': 'Käekirjata',
|
||||
'studio.theme.motifs': 'Motiivid',
|
||||
'studio.theme.motifsHint': 'Selle teemaga sobivad kleebisekomplektid.',
|
||||
'studio.theme.motif.ephemera': 'Reisimälestused',
|
||||
'studio.theme.motif.landmarks': 'Vaatamisväärsused',
|
||||
'studio.theme.motif.tropical': 'Troopika',
|
||||
'studio.theme.motif.mediterranean': 'Vahemeri',
|
||||
'studio.theme.motif.sea': 'Meri ja rannik',
|
||||
'studio.theme.motif.mountains': 'Mäed',
|
||||
'studio.theme.motif.nordic': 'Põhjala',
|
||||
'studio.theme.motif.asia': 'Aasia',
|
||||
'studio.theme.motif.food': 'Toit ja kohvik',
|
||||
'studio.theme.motif.paper': 'Paber ja teip',
|
||||
'studio.theme.motif.doodles': 'Sodimised',
|
||||
'studio.theme.motif.ornaments': 'Ornamendid',
|
||||
'studio.theme.decoration': 'Kaunistus',
|
||||
'studio.theme.decoration.none': 'Puudub',
|
||||
'studio.theme.decoration.light': 'Kerge',
|
||||
'studio.theme.decoration.rich': 'Rikkalik',
|
||||
'studio.theme.adopt': 'Kujunda ümber ka see, mis pole veel seotud',
|
||||
'studio.theme.adoptHint': 'Seob kõigepealt taustad, tekstid ja kujundid teemaga. Valge kiri fotodel jääb samaks.',
|
||||
'studio.theme.applyBook': 'Rakenda raamatule',
|
||||
'studio.theme.applyPage': 'Rakenda sellele lehele',
|
||||
'studio.theme.applied': 'Teema rakendatud',
|
||||
'studio.theme.nothing': 'Siin ei järgi veel miski teemat. Lülita ümberkujundamine sisse, et see siduda.',
|
||||
'studio.theme.linked': 'Teema värv',
|
||||
'studio.theme.unlink': 'Lõpeta teema järgimine',
|
||||
};
|
||||
|
||||
export default studioThemes;
|
||||
@@ -3,6 +3,7 @@ import type { TranslationStrings } from '../types';
|
||||
const assistantBookDesign: TranslationStrings = {
|
||||
'assistant.change.verb.designBook': 'Appliquer la maquette du livre',
|
||||
'assistant.change.verb.setBookSetup': 'Changer le format des pages',
|
||||
'assistant.change.verb.setBookTheme': 'Appliquer un thème au livre',
|
||||
'assistant.change.verb.duplicateBookPage': 'Dupliquer la page',
|
||||
'assistant.change.verb.saveBookLayout': 'Enregistrer la page comme mise en page',
|
||||
'assistant.change.verb.removeBookLayout': 'Supprimer une mise en page enregistrée',
|
||||
|
||||
@@ -65,6 +65,7 @@ import studioPaint from './studioPaint';
|
||||
import studioPhoto from './studioPhoto';
|
||||
import studioStickers from './studioStickers';
|
||||
import studioShapes from './studioShapes';
|
||||
import studioThemes from './studioThemes';
|
||||
import system_notice from './system_notice';
|
||||
import todo from './todo';
|
||||
import tourCollection from './tourCollection';
|
||||
@@ -149,6 +150,7 @@ const locale = {
|
||||
...assistantBudget,
|
||||
...assistantBook,
|
||||
...assistantBookDesign,
|
||||
...studioThemes,
|
||||
...assistantBooking,
|
||||
...assistantCollab,
|
||||
...assistantCollection,
|
||||
|
||||
@@ -0,0 +1,78 @@
|
||||
import type { TranslationStrings } from '../types';
|
||||
|
||||
const studioThemes: TranslationStrings = {
|
||||
'studio.theme.name.posterPop': 'Affiche pop',
|
||||
'studio.theme.name.cutout': 'Papiers découpés',
|
||||
'studio.theme.name.postcard': 'Carte postale',
|
||||
'studio.theme.name.riviera': 'Riviera', // same-as-en
|
||||
'studio.theme.name.fabricClassic': 'Lin classique',
|
||||
'studio.theme.name.minimalSerif': 'Empattement minimal',
|
||||
'studio.theme.name.gridBadge': 'Grille et badge',
|
||||
'studio.theme.name.scrapbookScript': 'Album souvenir',
|
||||
'studio.theme.name.tropical': 'Tropical', // same-as-en
|
||||
'studio.theme.name.nordic': 'Nordique',
|
||||
'studio.theme.name.alpine': 'Alpin',
|
||||
'studio.theme.name.indiaStamp': 'Collage de timbres',
|
||||
'studio.theme.descr.posterPop': 'Papier crème, corail et tournesol, titres d’affiche épais',
|
||||
'studio.theme.descr.cutout': 'Papier cobalt, formes corail et sable, texte blanc',
|
||||
'studio.theme.descr.postcard': 'Papier menthe, encre marine, rouge tampon et sous-titre manuscrit',
|
||||
'studio.theme.descr.riviera': 'Blanc chaud, azur, olive et citron, un empattement doux',
|
||||
'studio.theme.descr.fabricClassic': 'Papier lin, bleu poudré et terracotta, empattements fins',
|
||||
'studio.theme.descr.minimalSerif': 'Papier blanc, gris chauds et un grand empattement fin',
|
||||
'studio.theme.descr.gridBadge': 'Papier blanc, encre noire et un seul accent rouge',
|
||||
'studio.theme.descr.scrapbookScript': 'Papier kraft, titres au feutre, écriture manuscrite et ruban adhésif',
|
||||
'studio.theme.descr.tropical': 'Vert jungle, rouge hibiscus et mangue sur crème',
|
||||
'studio.theme.descr.nordic': 'Papier gris pâle avec ardoise, ocre et rose',
|
||||
'studio.theme.descr.alpine': 'Blanc neige avec vert forêt, rouille et bleu ciel',
|
||||
'studio.theme.descr.indiaStamp': 'Papier chaud avec magenta, safran et bleu canard',
|
||||
'studio.theme.panel': 'Thème',
|
||||
'studio.theme.intro':
|
||||
'Choisissez un style pour tout le livre. Les couleurs et le texte qui suivent le thème changent avec lui, tout le reste reste tel quel.',
|
||||
'studio.theme.themes': 'Thèmes',
|
||||
'studio.theme.inUse': 'Utilisé',
|
||||
'studio.theme.reset': 'Revenir au thème d’origine',
|
||||
'studio.theme.palette': 'Palette', // same-as-en
|
||||
'studio.theme.token.paper': 'Papier',
|
||||
'studio.theme.token.ink': 'Encre',
|
||||
'studio.theme.token.muted': 'Atténué',
|
||||
'studio.theme.token.accent': 'Accent', // same-as-en
|
||||
'studio.theme.token.accent2': 'Accent 2', // same-as-en
|
||||
'studio.theme.token.accent3': 'Accent 3', // same-as-en
|
||||
'studio.theme.fromPhotos': 'Couleurs des photos',
|
||||
'studio.theme.noPhotoColours': 'Les photos n’ont aucune couleur à reprendre',
|
||||
'studio.theme.fonts': 'Polices',
|
||||
'studio.theme.slot.display': 'Titrage',
|
||||
'studio.theme.slot.heading': 'Titre',
|
||||
'studio.theme.slot.body': 'Corps de texte',
|
||||
'studio.theme.slot.script': 'Manuscrite',
|
||||
'studio.theme.noScript': 'Pas de manuscrite',
|
||||
'studio.theme.motifs': 'Motifs', // same-as-en
|
||||
'studio.theme.motifsHint': 'Les jeux d’autocollants qui vont avec ce thème.',
|
||||
'studio.theme.motif.ephemera': 'Souvenirs de voyage',
|
||||
'studio.theme.motif.landmarks': 'Monuments',
|
||||
'studio.theme.motif.tropical': 'Tropical', // same-as-en
|
||||
'studio.theme.motif.mediterranean': 'Méditerranée',
|
||||
'studio.theme.motif.sea': 'Mer et côte',
|
||||
'studio.theme.motif.mountains': 'Montagnes',
|
||||
'studio.theme.motif.nordic': 'Nordique',
|
||||
'studio.theme.motif.asia': 'Asie',
|
||||
'studio.theme.motif.food': 'Cuisine et café',
|
||||
'studio.theme.motif.paper': 'Papier et ruban adhésif',
|
||||
'studio.theme.motif.doodles': 'Gribouillis',
|
||||
'studio.theme.motif.ornaments': 'Ornements',
|
||||
'studio.theme.decoration': 'Décoration',
|
||||
'studio.theme.decoration.none': 'Aucune',
|
||||
'studio.theme.decoration.light': 'Légère',
|
||||
'studio.theme.decoration.rich': 'Riche',
|
||||
'studio.theme.adopt': 'Restyler aussi ce qui n’est pas encore lié',
|
||||
'studio.theme.adoptHint':
|
||||
'Lie d’abord les fonds, les textes et les formes au thème. Le texte blanc sur les photos reste tel quel.',
|
||||
'studio.theme.applyBook': 'Appliquer au livre',
|
||||
'studio.theme.applyPage': 'Appliquer à cette page',
|
||||
'studio.theme.applied': 'Thème appliqué',
|
||||
'studio.theme.nothing': 'Rien ici ne suit encore le thème. Activez le restylage pour le lier.',
|
||||
'studio.theme.linked': 'Couleur du thème',
|
||||
'studio.theme.unlink': 'Ne plus suivre le thème',
|
||||
};
|
||||
|
||||
export default studioThemes;
|
||||
@@ -3,6 +3,7 @@ import type { TranslationStrings } from '../types';
|
||||
const assistantBookDesign: TranslationStrings = {
|
||||
'assistant.change.verb.designBook': 'Εφαρμογή σχεδίου βιβλίου',
|
||||
'assistant.change.verb.setBookSetup': 'Αλλαγή μορφής σελίδας',
|
||||
'assistant.change.verb.setBookTheme': 'Εφαρμογή θέματος στο βιβλίο',
|
||||
'assistant.change.verb.duplicateBookPage': 'Αντιγραφή της σελίδας',
|
||||
'assistant.change.verb.saveBookLayout': 'Αποθήκευση σελίδας ως διάταξη',
|
||||
'assistant.change.verb.removeBookLayout': 'Αφαίρεση αποθηκευμένης διάταξης',
|
||||
|
||||
@@ -65,6 +65,7 @@ import studioPaint from './studioPaint';
|
||||
import studioPhoto from './studioPhoto';
|
||||
import studioStickers from './studioStickers';
|
||||
import studioShapes from './studioShapes';
|
||||
import studioThemes from './studioThemes';
|
||||
import system_notice from './system_notice';
|
||||
import todo from './todo';
|
||||
import tourCollection from './tourCollection';
|
||||
@@ -149,6 +150,7 @@ const locale = {
|
||||
...assistantBudget,
|
||||
...assistantBook,
|
||||
...assistantBookDesign,
|
||||
...studioThemes,
|
||||
...assistantBooking,
|
||||
...assistantCollab,
|
||||
...assistantCollection,
|
||||
|
||||
@@ -0,0 +1,78 @@
|
||||
import type { TranslationStrings } from '../types';
|
||||
|
||||
const studioThemes: TranslationStrings = {
|
||||
'studio.theme.name.posterPop': 'Ποπ αφίσα',
|
||||
'studio.theme.name.cutout': 'Χαρτοκοπτική',
|
||||
'studio.theme.name.postcard': 'Καρτ ποστάλ',
|
||||
'studio.theme.name.riviera': 'Ριβιέρα',
|
||||
'studio.theme.name.fabricClassic': 'Λινό κλασικό',
|
||||
'studio.theme.name.minimalSerif': 'Λιτή πατούρα',
|
||||
'studio.theme.name.gridBadge': 'Πλέγμα με σήμα',
|
||||
'studio.theme.name.scrapbookScript': 'Λεύκωμα αναμνήσεων',
|
||||
'studio.theme.name.tropical': 'Τροπικό',
|
||||
'studio.theme.name.nordic': 'Σκανδιναβικό',
|
||||
'studio.theme.name.alpine': 'Αλπικό',
|
||||
'studio.theme.name.indiaStamp': 'Κολάζ γραμματοσήμων',
|
||||
'studio.theme.descr.posterPop': 'Κρεμ χαρτί, κοραλλί και ηλιοτρόπιο, βαριοί τίτλοι αφίσας',
|
||||
'studio.theme.descr.cutout': 'Χαρτί κοβαλτίου, σχήματα σε κοραλλί και άμμο, λευκά γράμματα',
|
||||
'studio.theme.descr.postcard': 'Χαρτί μέντας, μπλε σκούρο μελάνι, κόκκινο σφραγίδας και χειρόγραφος υπότιτλος',
|
||||
'studio.theme.descr.riviera': 'Ζεστό λευκό, γαλάζιο, λαδί και λεμονί, μια απαλή γραμματοσειρά με πατούρες',
|
||||
'studio.theme.descr.fabricClassic': 'Λινό χαρτί, ξεθωριασμένο μπλε και τερακότα, λεπτές πατούρες',
|
||||
'studio.theme.descr.minimalSerif': 'Λευκό χαρτί, ζεστά γκρι και μια μεγάλη λεπτή γραμματοσειρά με πατούρες',
|
||||
'studio.theme.descr.gridBadge': 'Λευκό χαρτί, μαύρο μελάνι και μία κόκκινη πινελιά',
|
||||
'studio.theme.descr.scrapbookScript': 'Χαρτί κραφτ, τίτλοι με μαρκαδόρο, χειρόγραφα και ταινία',
|
||||
'studio.theme.descr.tropical': 'Πράσινο ζούγκλας, κόκκινο ιβίσκου και μάνγκο σε κρεμ',
|
||||
'studio.theme.descr.nordic': 'Ανοιχτό γκρι χαρτί με σχιστόλιθο, ώχρα και ροζ',
|
||||
'studio.theme.descr.alpine': 'Χιονάτο λευκό με πράσινο του δάσους, σκουριά και γαλανό του ουρανού',
|
||||
'studio.theme.descr.indiaStamp': 'Ζεστό χαρτί με ματζέντα, σαφράν και πετρόλ',
|
||||
'studio.theme.panel': 'Θέμα',
|
||||
'studio.theme.intro':
|
||||
'Διάλεξε ένα ύφος για όλο το βιβλίο. Τα χρώματα και τα γράμματα που ακολουθούν το θέμα αλλάζουν μαζί του, όλα τα άλλα μένουν ως έχουν.',
|
||||
'studio.theme.themes': 'Θέματα',
|
||||
'studio.theme.inUse': 'Σε χρήση',
|
||||
'studio.theme.reset': 'Επιστροφή στο αρχικό θέμα',
|
||||
'studio.theme.palette': 'Παλέτα',
|
||||
'studio.theme.token.paper': 'Χαρτί',
|
||||
'studio.theme.token.ink': 'Μελάνι',
|
||||
'studio.theme.token.muted': 'Απαλό',
|
||||
'studio.theme.token.accent': 'Τόνος',
|
||||
'studio.theme.token.accent2': 'Τόνος 2',
|
||||
'studio.theme.token.accent3': 'Τόνος 3',
|
||||
'studio.theme.fromPhotos': 'Χρώματα από τις φωτογραφίες',
|
||||
'studio.theme.noPhotoColours': 'Οι φωτογραφίες δεν έχουν χρώμα να πάρουμε',
|
||||
'studio.theme.fonts': 'Γραμματοσειρές',
|
||||
'studio.theme.slot.display': 'Τίτλου',
|
||||
'studio.theme.slot.heading': 'Επικεφαλίδα',
|
||||
'studio.theme.slot.body': 'Κείμενο',
|
||||
'studio.theme.slot.script': 'Χειρόγραφη',
|
||||
'studio.theme.noScript': 'Χωρίς χειρόγραφη',
|
||||
'studio.theme.motifs': 'Μοτίβα',
|
||||
'studio.theme.motifsHint': 'Τα σετ αυτοκόλλητων που ταιριάζουν με αυτό το θέμα.',
|
||||
'studio.theme.motif.ephemera': 'Ταξιδιωτικά ενθύμια',
|
||||
'studio.theme.motif.landmarks': 'Αξιοθέατα',
|
||||
'studio.theme.motif.tropical': 'Τροπικά',
|
||||
'studio.theme.motif.mediterranean': 'Μεσόγειος',
|
||||
'studio.theme.motif.sea': 'Θάλασσα και ακτή',
|
||||
'studio.theme.motif.mountains': 'Βουνά',
|
||||
'studio.theme.motif.nordic': 'Βορράς',
|
||||
'studio.theme.motif.asia': 'Ασία',
|
||||
'studio.theme.motif.food': 'Φαγητό και καφέ',
|
||||
'studio.theme.motif.paper': 'Χαρτί και ταινία',
|
||||
'studio.theme.motif.doodles': 'Μουτζούρες',
|
||||
'studio.theme.motif.ornaments': 'Διακοσμητικά',
|
||||
'studio.theme.decoration': 'Διακόσμηση',
|
||||
'studio.theme.decoration.none': 'Καμία',
|
||||
'studio.theme.decoration.light': 'Ελαφριά',
|
||||
'studio.theme.decoration.rich': 'Πλούσια',
|
||||
'studio.theme.adopt': 'Αναμόρφωση και όσων δεν έχουν συνδεθεί ακόμη',
|
||||
'studio.theme.adoptHint':
|
||||
'Πρώτα συνδέει φόντα, κείμενα και σχήματα με το θέμα. Τα λευκά γράμματα πάνω σε φωτογραφίες μένουν ως έχουν.',
|
||||
'studio.theme.applyBook': 'Εφαρμογή στο βιβλίο',
|
||||
'studio.theme.applyPage': 'Εφαρμογή σε αυτή τη σελίδα',
|
||||
'studio.theme.applied': 'Το θέμα εφαρμόστηκε',
|
||||
'studio.theme.nothing': 'Εδώ τίποτα δεν ακολουθεί ακόμη το θέμα. Ενεργοποίησε την αναμόρφωση για να το συνδέσεις.',
|
||||
'studio.theme.linked': 'Χρώμα θέματος',
|
||||
'studio.theme.unlink': 'Να μην ακολουθεί πια το θέμα',
|
||||
};
|
||||
|
||||
export default studioThemes;
|
||||
@@ -3,6 +3,7 @@ import type { TranslationStrings } from '../types';
|
||||
const assistantBookDesign: TranslationStrings = {
|
||||
'assistant.change.verb.designBook': 'Könyvterv alkalmazása',
|
||||
'assistant.change.verb.setBookSetup': 'Oldalformátum módosítása',
|
||||
'assistant.change.verb.setBookTheme': 'Téma alkalmazása a könyvre',
|
||||
'assistant.change.verb.duplicateBookPage': 'Oldal megkettőzése',
|
||||
'assistant.change.verb.saveBookLayout': 'Oldal mentése elrendezésként',
|
||||
'assistant.change.verb.removeBookLayout': 'Mentett elrendezés eltávolítása',
|
||||
|
||||
@@ -65,6 +65,7 @@ import studioPaint from './studioPaint';
|
||||
import studioPhoto from './studioPhoto';
|
||||
import studioStickers from './studioStickers';
|
||||
import studioShapes from './studioShapes';
|
||||
import studioThemes from './studioThemes';
|
||||
import system_notice from './system_notice';
|
||||
import todo from './todo';
|
||||
import tourCollection from './tourCollection';
|
||||
@@ -149,6 +150,7 @@ const locale = {
|
||||
...assistantBudget,
|
||||
...assistantBook,
|
||||
...assistantBookDesign,
|
||||
...studioThemes,
|
||||
...assistantBooking,
|
||||
...assistantCollab,
|
||||
...assistantCollection,
|
||||
|
||||
@@ -0,0 +1,78 @@
|
||||
import type { TranslationStrings } from '../types';
|
||||
|
||||
const studioThemes: TranslationStrings = {
|
||||
'studio.theme.name.posterPop': 'Plakát pop',
|
||||
'studio.theme.name.cutout': 'Papírkivágás',
|
||||
'studio.theme.name.postcard': 'Képeslap',
|
||||
'studio.theme.name.riviera': 'Riviéra',
|
||||
'studio.theme.name.fabricClassic': 'Klasszikus vászon',
|
||||
'studio.theme.name.minimalSerif': 'Letisztult talpas',
|
||||
'studio.theme.name.gridBadge': 'Rács jelvénnyel',
|
||||
'studio.theme.name.scrapbookScript': 'Emlékalbum',
|
||||
'studio.theme.name.tropical': 'Trópusi',
|
||||
'studio.theme.name.nordic': 'Északi',
|
||||
'studio.theme.name.alpine': 'Alpesi',
|
||||
'studio.theme.name.indiaStamp': 'Bélyegkollázs',
|
||||
'studio.theme.descr.posterPop': 'Krémszínű papír, korall és napraforgó, vastag plakátcímek',
|
||||
'studio.theme.descr.cutout': 'Kobaltpapír, korall és homok formák, fehér betűk',
|
||||
'studio.theme.descr.postcard': 'Mentazöld papír, tengerészkék tinta, bélyegzővörös és kézírásos alcím',
|
||||
'studio.theme.descr.riviera': 'Meleg fehér, azúr, olíva és citrom, lágy talpas betű',
|
||||
'studio.theme.descr.fabricClassic': 'Vászonpapír, poros kék és terrakotta, finom talpak',
|
||||
'studio.theme.descr.minimalSerif': 'Fehér papír, meleg szürkék és egy nagy, vékony talpas betű',
|
||||
'studio.theme.descr.gridBadge': 'Fehér papír, fekete tinta és egyetlen piros kiemelés',
|
||||
'studio.theme.descr.scrapbookScript': 'Csomagolópapír, filces címek, kézírás és ragasztószalag',
|
||||
'studio.theme.descr.tropical': 'Dzsungelzöld, hibiszkuszpiros és mangó krémszínen',
|
||||
'studio.theme.descr.nordic': 'Halványszürke papír palaszürkével, okkerrel és rózsaszínnel',
|
||||
'studio.theme.descr.alpine': 'Hófehér erdőzölddel, rozsdával és égkékkel',
|
||||
'studio.theme.descr.indiaStamp': 'Meleg papír bíborral, sáfránnyal és kékeszölddel',
|
||||
'studio.theme.panel': 'Téma',
|
||||
'studio.theme.intro':
|
||||
'Válassz megjelenést az egész könyvnek. A témát követő színek és betűk vele változnak, minden más marad, ahogy van.',
|
||||
'studio.theme.themes': 'Témák',
|
||||
'studio.theme.inUse': 'Használatban',
|
||||
'studio.theme.reset': 'Vissza az eredeti témához',
|
||||
'studio.theme.palette': 'Paletta',
|
||||
'studio.theme.token.paper': 'Papír',
|
||||
'studio.theme.token.ink': 'Tinta',
|
||||
'studio.theme.token.muted': 'Tompa',
|
||||
'studio.theme.token.accent': 'Kiemelés',
|
||||
'studio.theme.token.accent2': 'Kiemelés 2',
|
||||
'studio.theme.token.accent3': 'Kiemelés 3',
|
||||
'studio.theme.fromPhotos': 'Színek a fotókból',
|
||||
'studio.theme.noPhotoColours': 'A fotókon nincs átvehető szín',
|
||||
'studio.theme.fonts': 'Betűtípusok',
|
||||
'studio.theme.slot.display': 'Címbetű',
|
||||
'studio.theme.slot.heading': 'Címsor',
|
||||
'studio.theme.slot.body': 'Szövegtörzs',
|
||||
'studio.theme.slot.script': 'Kézírás',
|
||||
'studio.theme.noScript': 'Nincs kézírás',
|
||||
'studio.theme.motifs': 'Motívumok',
|
||||
'studio.theme.motifsHint': 'A témához illő matricakészletek.',
|
||||
'studio.theme.motif.ephemera': 'Úti emlékek',
|
||||
'studio.theme.motif.landmarks': 'Nevezetességek',
|
||||
'studio.theme.motif.tropical': 'Trópusi',
|
||||
'studio.theme.motif.mediterranean': 'Mediterrán',
|
||||
'studio.theme.motif.sea': 'Tenger és part',
|
||||
'studio.theme.motif.mountains': 'Hegyek',
|
||||
'studio.theme.motif.nordic': 'Északi',
|
||||
'studio.theme.motif.asia': 'Ázsia',
|
||||
'studio.theme.motif.food': 'Étel és kávézó',
|
||||
'studio.theme.motif.paper': 'Papír és szalag',
|
||||
'studio.theme.motif.doodles': 'Firkák',
|
||||
'studio.theme.motif.ornaments': 'Díszítőelemek',
|
||||
'studio.theme.decoration': 'Díszítés',
|
||||
'studio.theme.decoration.none': 'Nincs',
|
||||
'studio.theme.decoration.light': 'Visszafogott',
|
||||
'studio.theme.decoration.rich': 'Gazdag',
|
||||
'studio.theme.adopt': 'A még nem kapcsoltakat is alakítsa át',
|
||||
'studio.theme.adoptHint':
|
||||
'Először a hátteret, a szövegeket és a formákat kapcsolja a témához. A fotókon lévő fehér szöveg marad, ahogy van.',
|
||||
'studio.theme.applyBook': 'Alkalmazás a könyvre',
|
||||
'studio.theme.applyPage': 'Alkalmazás erre az oldalra',
|
||||
'studio.theme.applied': 'Téma alkalmazva',
|
||||
'studio.theme.nothing': 'Itt még semmi sem követi a témát. Kapcsold be az átalakítást a kapcsoláshoz.',
|
||||
'studio.theme.linked': 'Témaszín',
|
||||
'studio.theme.unlink': 'Ne kövesse tovább a témát',
|
||||
};
|
||||
|
||||
export default studioThemes;
|
||||
@@ -3,6 +3,7 @@ import type { TranslationStrings } from '../types';
|
||||
const assistantBookDesign: TranslationStrings = {
|
||||
'assistant.change.verb.designBook': 'Terapkan desain buku foto',
|
||||
'assistant.change.verb.setBookSetup': 'Ubah format halaman',
|
||||
'assistant.change.verb.setBookTheme': 'Terapkan tema ke buku',
|
||||
'assistant.change.verb.duplicateBookPage': 'Duplikat halaman',
|
||||
'assistant.change.verb.saveBookLayout': 'Simpan halaman sebagai tata letak',
|
||||
'assistant.change.verb.removeBookLayout': 'Hapus tata letak tersimpan',
|
||||
|
||||
@@ -65,6 +65,7 @@ import studioPaint from './studioPaint';
|
||||
import studioPhoto from './studioPhoto';
|
||||
import studioStickers from './studioStickers';
|
||||
import studioShapes from './studioShapes';
|
||||
import studioThemes from './studioThemes';
|
||||
import system_notice from './system_notice';
|
||||
import todo from './todo';
|
||||
import tourCollection from './tourCollection';
|
||||
@@ -149,6 +150,7 @@ const locale = {
|
||||
...assistantBudget,
|
||||
...assistantBook,
|
||||
...assistantBookDesign,
|
||||
...studioThemes,
|
||||
...assistantBooking,
|
||||
...assistantCollab,
|
||||
...assistantCollection,
|
||||
|
||||
@@ -0,0 +1,78 @@
|
||||
import type { TranslationStrings } from '../types';
|
||||
|
||||
const studioThemes: TranslationStrings = {
|
||||
'studio.theme.name.posterPop': 'Gaya poster',
|
||||
'studio.theme.name.cutout': 'Guntingan',
|
||||
'studio.theme.name.postcard': 'Kartu pos',
|
||||
'studio.theme.name.riviera': 'Riviera', // same-as-en
|
||||
'studio.theme.name.fabricClassic': 'Linen klasik',
|
||||
'studio.theme.name.minimalSerif': 'Serif minimal',
|
||||
'studio.theme.name.gridBadge': 'Kisi dan lencana',
|
||||
'studio.theme.name.scrapbookScript': 'Buku tempel',
|
||||
'studio.theme.name.tropical': 'Tropis',
|
||||
'studio.theme.name.nordic': 'Nordik',
|
||||
'studio.theme.name.alpine': 'Alpen',
|
||||
'studio.theme.name.indiaStamp': 'Kolase perangko',
|
||||
'studio.theme.descr.posterPop': 'Kertas krem, koral dan bunga matahari, judul poster tebal',
|
||||
'studio.theme.descr.cutout': 'Kertas kobalt, bentuk koral dan pasir, huruf putih',
|
||||
'studio.theme.descr.postcard': 'Kertas mint, tinta biru dongker, merah stempel dan subjudul tulisan tangan',
|
||||
'studio.theme.descr.riviera': 'Putih hangat, biru langit, zaitun dan lemon, serif yang lembut',
|
||||
'studio.theme.descr.fabricClassic': 'Kertas linen, biru pudar dan terakota, serif halus',
|
||||
'studio.theme.descr.minimalSerif': 'Kertas putih, abu-abu hangat dan serif besar yang tipis',
|
||||
'studio.theme.descr.gridBadge': 'Kertas putih, tinta hitam dan satu aksen merah',
|
||||
'studio.theme.descr.scrapbookScript': 'Kertas kraft, judul spidol, tulisan tangan dan selotip',
|
||||
'studio.theme.descr.tropical': 'Hijau rimba, merah kembang sepatu dan mangga di atas krem',
|
||||
'studio.theme.descr.nordic': 'Kertas abu-abu muda dengan batu tulis, oker dan merah muda',
|
||||
'studio.theme.descr.alpine': 'Putih salju dengan hijau hutan, karat dan biru langit',
|
||||
'studio.theme.descr.indiaStamp': 'Kertas hangat dengan magenta, kunyit dan hijau toska',
|
||||
'studio.theme.panel': 'Tema',
|
||||
'studio.theme.intro':
|
||||
'Pilih tampilan untuk seluruh buku. Warna dan huruf yang mengikuti tema ikut berubah, selebihnya tetap seperti semula.',
|
||||
'studio.theme.themes': 'Tema-tema',
|
||||
'studio.theme.inUse': 'Dipakai',
|
||||
'studio.theme.reset': 'Kembali ke tema asli',
|
||||
'studio.theme.palette': 'Palet',
|
||||
'studio.theme.token.paper': 'Kertas',
|
||||
'studio.theme.token.ink': 'Tinta',
|
||||
'studio.theme.token.muted': 'Redup',
|
||||
'studio.theme.token.accent': 'Aksen',
|
||||
'studio.theme.token.accent2': 'Aksen 2',
|
||||
'studio.theme.token.accent3': 'Aksen 3',
|
||||
'studio.theme.fromPhotos': 'Warna dari foto',
|
||||
'studio.theme.noPhotoColours': 'Foto tidak punya warna untuk diambil',
|
||||
'studio.theme.fonts': 'Jenis huruf',
|
||||
'studio.theme.slot.display': 'Judul besar',
|
||||
'studio.theme.slot.heading': 'Judul',
|
||||
'studio.theme.slot.body': 'Isi',
|
||||
'studio.theme.slot.script': 'Tulisan tangan',
|
||||
'studio.theme.noScript': 'Tanpa tulisan tangan',
|
||||
'studio.theme.motifs': 'Motif',
|
||||
'studio.theme.motifsHint': 'Set stiker yang cocok dengan tema ini.',
|
||||
'studio.theme.motif.ephemera': 'Kenangan perjalanan',
|
||||
'studio.theme.motif.landmarks': 'Tengara',
|
||||
'studio.theme.motif.tropical': 'Tropis',
|
||||
'studio.theme.motif.mediterranean': 'Mediterania',
|
||||
'studio.theme.motif.sea': 'Laut dan pantai',
|
||||
'studio.theme.motif.mountains': 'Pegunungan',
|
||||
'studio.theme.motif.nordic': 'Nordik',
|
||||
'studio.theme.motif.asia': 'Asia', // same-as-en
|
||||
'studio.theme.motif.food': 'Makanan dan kafe',
|
||||
'studio.theme.motif.paper': 'Kertas dan selotip',
|
||||
'studio.theme.motif.doodles': 'Coretan',
|
||||
'studio.theme.motif.ornaments': 'Ornamen',
|
||||
'studio.theme.decoration': 'Dekorasi',
|
||||
'studio.theme.decoration.none': 'Tidak ada',
|
||||
'studio.theme.decoration.light': 'Ringan',
|
||||
'studio.theme.decoration.rich': 'Ramai',
|
||||
'studio.theme.adopt': 'Atur ulang juga yang belum ditautkan',
|
||||
'studio.theme.adoptHint':
|
||||
'Menautkan latar, teks, dan bentuk ke tema terlebih dahulu. Tulisan putih di atas foto tetap seperti semula.',
|
||||
'studio.theme.applyBook': 'Terapkan ke buku',
|
||||
'studio.theme.applyPage': 'Terapkan ke halaman ini',
|
||||
'studio.theme.applied': 'Tema diterapkan',
|
||||
'studio.theme.nothing': 'Belum ada yang mengikuti tema di sini. Nyalakan pengaturan ulang untuk menautkannya.',
|
||||
'studio.theme.linked': 'Warna tema',
|
||||
'studio.theme.unlink': 'Berhenti mengikuti tema',
|
||||
};
|
||||
|
||||
export default studioThemes;
|
||||
@@ -3,6 +3,7 @@ import type { TranslationStrings } from '../types';
|
||||
const assistantBookDesign: TranslationStrings = {
|
||||
'assistant.change.verb.designBook': 'Applica il design del libro',
|
||||
'assistant.change.verb.setBookSetup': 'Cambia il formato delle pagine',
|
||||
'assistant.change.verb.setBookTheme': 'Applica un tema al libro',
|
||||
'assistant.change.verb.duplicateBookPage': 'Duplica la pagina',
|
||||
'assistant.change.verb.saveBookLayout': 'Salva la pagina come layout',
|
||||
'assistant.change.verb.removeBookLayout': 'Rimuovi un layout salvato',
|
||||
|
||||
@@ -65,6 +65,7 @@ import studioPaint from './studioPaint';
|
||||
import studioPhoto from './studioPhoto';
|
||||
import studioStickers from './studioStickers';
|
||||
import studioShapes from './studioShapes';
|
||||
import studioThemes from './studioThemes';
|
||||
import system_notice from './system_notice';
|
||||
import todo from './todo';
|
||||
import tourCollection from './tourCollection';
|
||||
@@ -149,6 +150,7 @@ const locale = {
|
||||
...assistantBudget,
|
||||
...assistantBook,
|
||||
...assistantBookDesign,
|
||||
...studioThemes,
|
||||
...assistantBooking,
|
||||
...assistantCollab,
|
||||
...assistantCollection,
|
||||
|
||||
@@ -0,0 +1,77 @@
|
||||
import type { TranslationStrings } from '../types';
|
||||
|
||||
const studioThemes: TranslationStrings = {
|
||||
'studio.theme.name.posterPop': 'Manifesto pop',
|
||||
'studio.theme.name.cutout': 'Ritagli',
|
||||
'studio.theme.name.postcard': 'Cartolina',
|
||||
'studio.theme.name.riviera': 'Riviera', // same-as-en
|
||||
'studio.theme.name.fabricClassic': 'Lino classico',
|
||||
'studio.theme.name.minimalSerif': 'Grazie minimali',
|
||||
'studio.theme.name.gridBadge': 'Griglia e distintivo',
|
||||
'studio.theme.name.scrapbookScript': 'Album di ricordi',
|
||||
'studio.theme.name.tropical': 'Tropicale',
|
||||
'studio.theme.name.nordic': 'Nordico',
|
||||
'studio.theme.name.alpine': 'Alpino',
|
||||
'studio.theme.name.indiaStamp': 'Collage di francobolli',
|
||||
'studio.theme.descr.posterPop': 'Carta crema, corallo e girasole, titoli da poster corposi',
|
||||
'studio.theme.descr.cutout': 'Carta cobalto, forme corallo e sabbia, testo bianco',
|
||||
'studio.theme.descr.postcard': 'Carta menta, inchiostro blu navy, rosso timbro e un sottotitolo corsivo',
|
||||
'studio.theme.descr.riviera': 'Bianco caldo, azzurro, oliva e limone, un graziato morbido',
|
||||
'studio.theme.descr.fabricClassic': 'Carta di lino, azzurro polvere e terracotta, grazie sottili',
|
||||
'studio.theme.descr.minimalSerif': 'Carta bianca, grigi caldi e un grande graziato sottile',
|
||||
'studio.theme.descr.gridBadge': 'Carta bianca, inchiostro nero e un solo accento rosso',
|
||||
'studio.theme.descr.scrapbookScript': 'Carta kraft, titoli a pennarello, scrittura a mano e nastro',
|
||||
'studio.theme.descr.tropical': 'Verde giungla, rosso ibisco e mango su crema',
|
||||
'studio.theme.descr.nordic': 'Carta grigio chiaro con ardesia, ocra e rosa',
|
||||
'studio.theme.descr.alpine': 'Bianco neve con verde bosco, ruggine e azzurro cielo',
|
||||
'studio.theme.descr.indiaStamp': 'Carta calda con magenta, zafferano e verde acqua',
|
||||
'studio.theme.panel': 'Tema',
|
||||
'studio.theme.intro':
|
||||
'Scegli uno stile per tutto il libro. Colori e testi che seguono il tema cambiano con esso, tutto il resto resta com’è.',
|
||||
'studio.theme.themes': 'Temi',
|
||||
'studio.theme.inUse': 'In uso',
|
||||
'studio.theme.reset': 'Torna al tema originale',
|
||||
'studio.theme.palette': 'Tavolozza',
|
||||
'studio.theme.token.paper': 'Carta',
|
||||
'studio.theme.token.ink': 'Inchiostro',
|
||||
'studio.theme.token.muted': 'Attenuato',
|
||||
'studio.theme.token.accent': 'Accento',
|
||||
'studio.theme.token.accent2': 'Accento 2',
|
||||
'studio.theme.token.accent3': 'Accento 3',
|
||||
'studio.theme.fromPhotos': 'Colori dalle foto',
|
||||
'studio.theme.noPhotoColours': 'Le foto non hanno colori da prendere',
|
||||
'studio.theme.fonts': 'Caratteri',
|
||||
'studio.theme.slot.display': 'Titolo grande',
|
||||
'studio.theme.slot.heading': 'Intestazione',
|
||||
'studio.theme.slot.body': 'Corpo del testo',
|
||||
'studio.theme.slot.script': 'Corsivo',
|
||||
'studio.theme.noScript': 'Nessun corsivo',
|
||||
'studio.theme.motifs': 'Motivi',
|
||||
'studio.theme.motifsHint': 'I set di adesivi adatti a questo tema.',
|
||||
'studio.theme.motif.ephemera': 'Ricordi di viaggio',
|
||||
'studio.theme.motif.landmarks': 'Monumenti',
|
||||
'studio.theme.motif.tropical': 'Tropicale',
|
||||
'studio.theme.motif.mediterranean': 'Mediterraneo',
|
||||
'studio.theme.motif.sea': 'Mare e costa',
|
||||
'studio.theme.motif.mountains': 'Montagne',
|
||||
'studio.theme.motif.nordic': 'Nordico',
|
||||
'studio.theme.motif.asia': 'Asia', // same-as-en
|
||||
'studio.theme.motif.food': 'Cibo e caffè',
|
||||
'studio.theme.motif.paper': 'Carta e nastro',
|
||||
'studio.theme.motif.doodles': 'Scarabocchi',
|
||||
'studio.theme.motif.ornaments': 'Ornamenti',
|
||||
'studio.theme.decoration': 'Decorazione',
|
||||
'studio.theme.decoration.none': 'Nessuna',
|
||||
'studio.theme.decoration.light': 'Leggera',
|
||||
'studio.theme.decoration.rich': 'Ricca',
|
||||
'studio.theme.adopt': 'Ridisegna anche ciò che non è ancora collegato',
|
||||
'studio.theme.adoptHint': 'Collega prima sfondi, testi e forme al tema. Il testo bianco sulle foto resta com’è.',
|
||||
'studio.theme.applyBook': 'Applica al libro',
|
||||
'studio.theme.applyPage': 'Applica a questa pagina',
|
||||
'studio.theme.applied': 'Tema applicato',
|
||||
'studio.theme.nothing': 'Qui niente segue ancora il tema. Attiva il ridisegno per collegarlo.',
|
||||
'studio.theme.linked': 'Colore del tema',
|
||||
'studio.theme.unlink': 'Non seguire più il tema',
|
||||
};
|
||||
|
||||
export default studioThemes;
|
||||
@@ -3,6 +3,7 @@ import type { TranslationStrings } from '../types';
|
||||
const assistantBookDesign: TranslationStrings = {
|
||||
'assistant.change.verb.designBook': 'フォトブックのデザインを適用',
|
||||
'assistant.change.verb.setBookSetup': 'ページ形式を変更',
|
||||
'assistant.change.verb.setBookTheme': '本にテーマを適用',
|
||||
'assistant.change.verb.duplicateBookPage': 'ページを複製',
|
||||
'assistant.change.verb.saveBookLayout': 'ページをレイアウトとして保存',
|
||||
'assistant.change.verb.removeBookLayout': '保存したレイアウトを削除',
|
||||
|
||||
@@ -65,6 +65,7 @@ import studioPaint from './studioPaint';
|
||||
import studioPhoto from './studioPhoto';
|
||||
import studioStickers from './studioStickers';
|
||||
import studioShapes from './studioShapes';
|
||||
import studioThemes from './studioThemes';
|
||||
import system_notice from './system_notice';
|
||||
import todo from './todo';
|
||||
import tourCollection from './tourCollection';
|
||||
@@ -149,6 +150,7 @@ const locale = {
|
||||
...assistantBudget,
|
||||
...assistantBook,
|
||||
...assistantBookDesign,
|
||||
...studioThemes,
|
||||
...assistantBooking,
|
||||
...assistantCollab,
|
||||
...assistantCollection,
|
||||
|
||||
@@ -0,0 +1,76 @@
|
||||
import type { TranslationStrings } from '../types';
|
||||
|
||||
const studioThemes: TranslationStrings = {
|
||||
'studio.theme.name.posterPop': 'ポスターポップ',
|
||||
'studio.theme.name.cutout': '切り絵',
|
||||
'studio.theme.name.postcard': 'ポストカード',
|
||||
'studio.theme.name.riviera': 'リヴィエラ',
|
||||
'studio.theme.name.fabricClassic': 'リネンクラシック',
|
||||
'studio.theme.name.minimalSerif': 'ミニマルセリフ',
|
||||
'studio.theme.name.gridBadge': 'グリッドとバッジ',
|
||||
'studio.theme.name.scrapbookScript': 'スクラップブック',
|
||||
'studio.theme.name.tropical': 'トロピカル',
|
||||
'studio.theme.name.nordic': '北欧',
|
||||
'studio.theme.name.alpine': 'アルパイン',
|
||||
'studio.theme.name.indiaStamp': '切手コラージュ',
|
||||
'studio.theme.descr.posterPop': 'クリーム色の紙にコーラルとひまわり色、太いポスター見出し',
|
||||
'studio.theme.descr.cutout': 'コバルトの紙にコーラルと砂色の形、白い文字',
|
||||
'studio.theme.descr.postcard': 'ミントの紙に紺のインク、スタンプの赤と手書きのサブタイトル',
|
||||
'studio.theme.descr.riviera': '温かな白に紺碧、オリーブ、レモン、やわらかなセリフ',
|
||||
'studio.theme.descr.fabricClassic': 'リネンの紙にくすんだ青とテラコッタ、繊細なセリフ',
|
||||
'studio.theme.descr.minimalSerif': '白い紙に温かなグレーと大きく細いセリフ',
|
||||
'studio.theme.descr.gridBadge': '白い紙に黒のインクと赤のアクセントひとつ',
|
||||
'studio.theme.descr.scrapbookScript': 'クラフト紙にマーカーの見出し、手書きとテープ',
|
||||
'studio.theme.descr.tropical': 'クリーム色の上にジャングルグリーン、ハイビスカスの赤、マンゴー',
|
||||
'studio.theme.descr.nordic': '淡いグレーの紙にスレート、オーカー、ローズ',
|
||||
'studio.theme.descr.alpine': 'スノーホワイトにフォレストグリーン、ラスト、スカイブルー',
|
||||
'studio.theme.descr.indiaStamp': '温かな紙にマゼンタ、サフラン、ティール',
|
||||
'studio.theme.panel': 'テーマ',
|
||||
'studio.theme.intro': '本全体の見た目を選びます。テーマに従う色と書体は一緒に変わり、それ以外はそのままです。',
|
||||
'studio.theme.themes': 'テーマ一覧',
|
||||
'studio.theme.inUse': '使用中',
|
||||
'studio.theme.reset': '元のテーマに戻す',
|
||||
'studio.theme.palette': 'パレット',
|
||||
'studio.theme.token.paper': '紙',
|
||||
'studio.theme.token.ink': 'インク',
|
||||
'studio.theme.token.muted': '控えめ',
|
||||
'studio.theme.token.accent': 'アクセント',
|
||||
'studio.theme.token.accent2': 'アクセント 2',
|
||||
'studio.theme.token.accent3': 'アクセント 3',
|
||||
'studio.theme.fromPhotos': '写真から色を取る',
|
||||
'studio.theme.noPhotoColours': '写真から取れる色がありません',
|
||||
'studio.theme.fonts': '書体',
|
||||
'studio.theme.slot.display': 'ディスプレイ',
|
||||
'studio.theme.slot.heading': '見出し',
|
||||
'studio.theme.slot.body': '本文',
|
||||
'studio.theme.slot.script': '手書き',
|
||||
'studio.theme.noScript': '手書きなし',
|
||||
'studio.theme.motifs': 'モチーフ',
|
||||
'studio.theme.motifsHint': 'このテーマに合うステッカーのセット。',
|
||||
'studio.theme.motif.ephemera': '旅の小物',
|
||||
'studio.theme.motif.landmarks': '名所',
|
||||
'studio.theme.motif.tropical': 'トロピカル',
|
||||
'studio.theme.motif.mediterranean': '地中海',
|
||||
'studio.theme.motif.sea': '海と海岸',
|
||||
'studio.theme.motif.mountains': '山',
|
||||
'studio.theme.motif.nordic': '北欧',
|
||||
'studio.theme.motif.asia': 'アジア',
|
||||
'studio.theme.motif.food': '食とカフェ',
|
||||
'studio.theme.motif.paper': '紙とテープ',
|
||||
'studio.theme.motif.doodles': '落書き',
|
||||
'studio.theme.motif.ornaments': '装飾',
|
||||
'studio.theme.decoration': 'デコレーション',
|
||||
'studio.theme.decoration.none': 'なし',
|
||||
'studio.theme.decoration.light': '控えめ',
|
||||
'studio.theme.decoration.rich': 'たっぷり',
|
||||
'studio.theme.adopt': 'まだ連動していないものも整える',
|
||||
'studio.theme.adoptHint': '先に背景、テキスト、図形をテーマに連動させます。写真の上の白い文字はそのままです。',
|
||||
'studio.theme.applyBook': '本に適用',
|
||||
'studio.theme.applyPage': 'このページに適用',
|
||||
'studio.theme.applied': 'テーマを適用しました',
|
||||
'studio.theme.nothing': 'ここにはまだテーマに従うものがありません。整えるをオンにして連動させてください。',
|
||||
'studio.theme.linked': 'テーマの色',
|
||||
'studio.theme.unlink': 'テーマに従わない',
|
||||
};
|
||||
|
||||
export default studioThemes;
|
||||
@@ -3,6 +3,7 @@ import type { TranslationStrings } from '../types';
|
||||
const assistantBookDesign: TranslationStrings = {
|
||||
'assistant.change.verb.designBook': '포토북 디자인 적용',
|
||||
'assistant.change.verb.setBookSetup': '페이지 형식 변경',
|
||||
'assistant.change.verb.setBookTheme': '책에 테마 적용',
|
||||
'assistant.change.verb.duplicateBookPage': '페이지 복제',
|
||||
'assistant.change.verb.saveBookLayout': '페이지를 레이아웃으로 저장',
|
||||
'assistant.change.verb.removeBookLayout': '저장한 레이아웃 삭제',
|
||||
|
||||
@@ -65,6 +65,7 @@ import studioPaint from './studioPaint';
|
||||
import studioPhoto from './studioPhoto';
|
||||
import studioStickers from './studioStickers';
|
||||
import studioShapes from './studioShapes';
|
||||
import studioThemes from './studioThemes';
|
||||
import system_notice from './system_notice';
|
||||
import todo from './todo';
|
||||
import tourCollection from './tourCollection';
|
||||
@@ -149,6 +150,7 @@ const locale = {
|
||||
...assistantBudget,
|
||||
...assistantBook,
|
||||
...assistantBookDesign,
|
||||
...studioThemes,
|
||||
...assistantBooking,
|
||||
...assistantCollab,
|
||||
...assistantCollection,
|
||||
|
||||
@@ -0,0 +1,76 @@
|
||||
import type { TranslationStrings } from '../types';
|
||||
|
||||
const studioThemes: TranslationStrings = {
|
||||
'studio.theme.name.posterPop': '포스터 팝',
|
||||
'studio.theme.name.cutout': '종이 오리기',
|
||||
'studio.theme.name.postcard': '엽서',
|
||||
'studio.theme.name.riviera': '리비에라',
|
||||
'studio.theme.name.fabricClassic': '리넨 클래식',
|
||||
'studio.theme.name.minimalSerif': '미니멀 세리프',
|
||||
'studio.theme.name.gridBadge': '그리드와 배지',
|
||||
'studio.theme.name.scrapbookScript': '스크랩북',
|
||||
'studio.theme.name.tropical': '트로피컬',
|
||||
'studio.theme.name.nordic': '북유럽',
|
||||
'studio.theme.name.alpine': '알파인',
|
||||
'studio.theme.name.indiaStamp': '우표 콜라주',
|
||||
'studio.theme.descr.posterPop': '크림색 종이에 코럴과 해바라기색, 굵은 포스터 제목',
|
||||
'studio.theme.descr.cutout': '코발트 종이에 코럴과 모래색 도형, 흰 글씨',
|
||||
'studio.theme.descr.postcard': '민트 종이에 남색 잉크, 도장 빨강과 손글씨 부제',
|
||||
'studio.theme.descr.riviera': '따뜻한 흰색에 하늘색, 올리브, 레몬, 부드러운 세리프',
|
||||
'studio.theme.descr.fabricClassic': '리넨 종이에 흐린 파랑과 테라코타, 섬세한 세리프',
|
||||
'studio.theme.descr.minimalSerif': '흰 종이에 따뜻한 회색과 크고 가는 세리프',
|
||||
'studio.theme.descr.gridBadge': '흰 종이에 검은 잉크와 빨간 포인트 하나',
|
||||
'studio.theme.descr.scrapbookScript': '크라프트지에 마커 제목, 손글씨와 테이프',
|
||||
'studio.theme.descr.tropical': '크림색 위의 정글 그린, 히비스커스 레드, 망고',
|
||||
'studio.theme.descr.nordic': '연회색 종이에 슬레이트, 황토, 로즈',
|
||||
'studio.theme.descr.alpine': '눈처럼 흰 바탕에 숲 초록, 녹색, 하늘색',
|
||||
'studio.theme.descr.indiaStamp': '따뜻한 종이에 마젠타, 사프란, 청록',
|
||||
'studio.theme.panel': '테마',
|
||||
'studio.theme.intro': '책 전체의 분위기를 고르세요. 테마를 따르는 색과 글꼴은 함께 바뀌고 나머지는 그대로 남습니다.',
|
||||
'studio.theme.themes': '테마 목록',
|
||||
'studio.theme.inUse': '사용 중',
|
||||
'studio.theme.reset': '원래 테마로 되돌리기',
|
||||
'studio.theme.palette': '팔레트',
|
||||
'studio.theme.token.paper': '종이',
|
||||
'studio.theme.token.ink': '잉크',
|
||||
'studio.theme.token.muted': '차분한 색',
|
||||
'studio.theme.token.accent': '포인트',
|
||||
'studio.theme.token.accent2': '포인트 2',
|
||||
'studio.theme.token.accent3': '포인트 3',
|
||||
'studio.theme.fromPhotos': '사진에서 색 가져오기',
|
||||
'studio.theme.noPhotoColours': '사진에서 가져올 색이 없습니다',
|
||||
'studio.theme.fonts': '글꼴',
|
||||
'studio.theme.slot.display': '디스플레이',
|
||||
'studio.theme.slot.heading': '제목',
|
||||
'studio.theme.slot.body': '본문',
|
||||
'studio.theme.slot.script': '손글씨',
|
||||
'studio.theme.noScript': '손글씨 없음',
|
||||
'studio.theme.motifs': '모티프',
|
||||
'studio.theme.motifsHint': '이 테마에 어울리는 스티커 세트입니다.',
|
||||
'studio.theme.motif.ephemera': '여행 소품',
|
||||
'studio.theme.motif.landmarks': '명소',
|
||||
'studio.theme.motif.tropical': '트로피컬',
|
||||
'studio.theme.motif.mediterranean': '지중해',
|
||||
'studio.theme.motif.sea': '바다와 해안',
|
||||
'studio.theme.motif.mountains': '산',
|
||||
'studio.theme.motif.nordic': '북유럽',
|
||||
'studio.theme.motif.asia': '아시아',
|
||||
'studio.theme.motif.food': '음식과 카페',
|
||||
'studio.theme.motif.paper': '종이와 테이프',
|
||||
'studio.theme.motif.doodles': '낙서',
|
||||
'studio.theme.motif.ornaments': '장식 무늬',
|
||||
'studio.theme.decoration': '장식',
|
||||
'studio.theme.decoration.none': '없음',
|
||||
'studio.theme.decoration.light': '가볍게',
|
||||
'studio.theme.decoration.rich': '풍성하게',
|
||||
'studio.theme.adopt': '아직 연결되지 않은 것도 다시 꾸미기',
|
||||
'studio.theme.adoptHint': '먼저 배경, 텍스트, 도형을 테마에 연결합니다. 사진 위의 흰 글씨는 그대로 둡니다.',
|
||||
'studio.theme.applyBook': '책에 적용',
|
||||
'studio.theme.applyPage': '이 페이지에 적용',
|
||||
'studio.theme.applied': '테마를 적용했습니다',
|
||||
'studio.theme.nothing': '아직 여기에는 테마를 따르는 것이 없습니다. 다시 꾸미기를 켜서 연결하세요.',
|
||||
'studio.theme.linked': '테마 색',
|
||||
'studio.theme.unlink': '테마 따르지 않기',
|
||||
};
|
||||
|
||||
export default studioThemes;
|
||||
@@ -3,6 +3,7 @@ import type { TranslationStrings } from '../types';
|
||||
const assistantBookDesign: TranslationStrings = {
|
||||
'assistant.change.verb.designBook': 'Boekontwerp toepassen',
|
||||
'assistant.change.verb.setBookSetup': 'Paginaformaat wijzigen',
|
||||
'assistant.change.verb.setBookTheme': 'Een thema op het boek toepassen',
|
||||
'assistant.change.verb.duplicateBookPage': 'Pagina dupliceren',
|
||||
'assistant.change.verb.saveBookLayout': 'Pagina als lay-out opslaan',
|
||||
'assistant.change.verb.removeBookLayout': 'Opgeslagen lay-out verwijderen',
|
||||
|
||||
@@ -65,6 +65,7 @@ import studioPaint from './studioPaint';
|
||||
import studioPhoto from './studioPhoto';
|
||||
import studioStickers from './studioStickers';
|
||||
import studioShapes from './studioShapes';
|
||||
import studioThemes from './studioThemes';
|
||||
import system_notice from './system_notice';
|
||||
import todo from './todo';
|
||||
import tourCollection from './tourCollection';
|
||||
@@ -149,6 +150,7 @@ const locale = {
|
||||
...assistantBudget,
|
||||
...assistantBook,
|
||||
...assistantBookDesign,
|
||||
...studioThemes,
|
||||
...assistantBooking,
|
||||
...assistantCollab,
|
||||
...assistantCollection,
|
||||
|
||||
@@ -0,0 +1,78 @@
|
||||
import type { TranslationStrings } from '../types';
|
||||
|
||||
const studioThemes: TranslationStrings = {
|
||||
'studio.theme.name.posterPop': 'Posterpop',
|
||||
'studio.theme.name.cutout': 'Knipwerk',
|
||||
'studio.theme.name.postcard': 'Ansichtkaart',
|
||||
'studio.theme.name.riviera': 'Rivièra',
|
||||
'studio.theme.name.fabricClassic': 'Linnen klassiek',
|
||||
'studio.theme.name.minimalSerif': 'Minimale schreef',
|
||||
'studio.theme.name.gridBadge': 'Raster met badge',
|
||||
'studio.theme.name.scrapbookScript': 'Plakboek',
|
||||
'studio.theme.name.tropical': 'Tropisch',
|
||||
'studio.theme.name.nordic': 'Noords',
|
||||
'studio.theme.name.alpine': 'Alpien',
|
||||
'studio.theme.name.indiaStamp': 'Postzegelcollage',
|
||||
'studio.theme.descr.posterPop': 'Crèmepapier, koraal en zonnebloem, zware postertitels',
|
||||
'studio.theme.descr.cutout': 'Kobaltpapier, vormen in koraal en zand, witte letters',
|
||||
'studio.theme.descr.postcard': 'Muntgroen papier, marineblauw, stempelrood en een ondertitel in schrijfletter',
|
||||
'studio.theme.descr.riviera': 'Warm wit, azuur, olijf en citroen, een zachte schreef',
|
||||
'studio.theme.descr.fabricClassic': 'Linnenpapier, stoffig blauw en terracotta, fijne schreven',
|
||||
'studio.theme.descr.minimalSerif': 'Wit papier, warme grijstinten en een grote dunne schreef',
|
||||
'studio.theme.descr.gridBadge': 'Wit papier, zwarte inkt en één rood accent',
|
||||
'studio.theme.descr.scrapbookScript': 'Kraftpapier, stifttitels, handschrift en plakband',
|
||||
'studio.theme.descr.tropical': 'Junglegroen, hibiscusrood en mango op crème',
|
||||
'studio.theme.descr.nordic': 'Lichtgrijs papier met leisteen, oker en roze',
|
||||
'studio.theme.descr.alpine': 'Sneeuwwit met bosgroen, roest en hemelsblauw',
|
||||
'studio.theme.descr.indiaStamp': 'Warm papier met magenta, saffraan en petrol',
|
||||
'studio.theme.panel': 'Thema',
|
||||
'studio.theme.intro':
|
||||
'Kies een stijl voor het hele boek. Kleuren en letters die het thema volgen veranderen mee, al het andere blijft zoals het is.',
|
||||
'studio.theme.themes': 'Thema’s',
|
||||
'studio.theme.inUse': 'In gebruik',
|
||||
'studio.theme.reset': 'Terug naar het oorspronkelijke thema',
|
||||
'studio.theme.palette': 'Palet',
|
||||
'studio.theme.token.paper': 'Papier',
|
||||
'studio.theme.token.ink': 'Inkt',
|
||||
'studio.theme.token.muted': 'Gedempt',
|
||||
'studio.theme.token.accent': 'Accent', // same-as-en
|
||||
'studio.theme.token.accent2': 'Accent 2', // same-as-en
|
||||
'studio.theme.token.accent3': 'Accent 3', // same-as-en
|
||||
'studio.theme.fromPhotos': 'Kleuren uit de foto’s',
|
||||
'studio.theme.noPhotoColours': 'De foto’s hebben geen kleur om over te nemen',
|
||||
'studio.theme.fonts': 'Lettertypen',
|
||||
'studio.theme.slot.display': 'Displayletter',
|
||||
'studio.theme.slot.heading': 'Kop',
|
||||
'studio.theme.slot.body': 'Broodtekst',
|
||||
'studio.theme.slot.script': 'Schrijfletter',
|
||||
'studio.theme.noScript': 'Geen schrijfletter',
|
||||
'studio.theme.motifs': 'Motieven',
|
||||
'studio.theme.motifsHint': 'De stickersets die bij dit thema passen.',
|
||||
'studio.theme.motif.ephemera': 'Reissouvenirs',
|
||||
'studio.theme.motif.landmarks': 'Bezienswaardigheden',
|
||||
'studio.theme.motif.tropical': 'Tropisch',
|
||||
'studio.theme.motif.mediterranean': 'Middellandse Zee',
|
||||
'studio.theme.motif.sea': 'Zee en kust',
|
||||
'studio.theme.motif.mountains': 'Bergen',
|
||||
'studio.theme.motif.nordic': 'Noords',
|
||||
'studio.theme.motif.asia': 'Azië',
|
||||
'studio.theme.motif.food': 'Eten en café',
|
||||
'studio.theme.motif.paper': 'Papier en plakband',
|
||||
'studio.theme.motif.doodles': 'Krabbels',
|
||||
'studio.theme.motif.ornaments': 'Ornamenten',
|
||||
'studio.theme.decoration': 'Decoratie',
|
||||
'studio.theme.decoration.none': 'Geen',
|
||||
'studio.theme.decoration.light': 'Licht',
|
||||
'studio.theme.decoration.rich': 'Rijk',
|
||||
'studio.theme.adopt': 'Ook restylen wat nog niet gekoppeld is',
|
||||
'studio.theme.adoptHint':
|
||||
'Koppelt eerst achtergronden, teksten en vormen aan het thema. Witte tekst op foto’s blijft zoals hij is.',
|
||||
'studio.theme.applyBook': 'Op het boek toepassen',
|
||||
'studio.theme.applyPage': 'Op deze pagina toepassen',
|
||||
'studio.theme.applied': 'Thema toegepast',
|
||||
'studio.theme.nothing': 'Hier volgt nog niets het thema. Zet restylen aan om het te koppelen.',
|
||||
'studio.theme.linked': 'Themakleur',
|
||||
'studio.theme.unlink': 'Het thema niet meer volgen',
|
||||
};
|
||||
|
||||
export default studioThemes;
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user