Skip to content

Canvix — Free & open-source graphic design tool. A community-built Canva alternative with a drag-and-drop editor, templates, shapes, text, images & one-click export. Works on desktop, tablet & mobile.

2.7 KB
Raw Blame
// ─────────────────────────────────────────────────────────────
// Canvix built-in template library (seeded into DB + used client-side)
//
// v0.8: 110 templates, organised as collections so the library can
// keep growing without monster files:
//   · collection-v07        — the original 60 (starters + premium)
//   · collection-v08-*      — 50 new premium-grade originals across
//                             every category, styled after what's
//                             trending on the big template platforms
//                             (original designs — nothing is copied)
//
// Every template is free forever. The "premium" badge is a quality
// label, never a paywall.
// ─────────────────────────────────────────────────────────────

import { createPage, type PageData, type TemplateRecord } from '../types'
import type { TemplateDef } from './helpers'
import { COLLECTION_V07 } from './collection-v07'
import { COLLECTION_V08_SOCIAL } from './collection-v08-social'
import { COLLECTION_V08_DECKS } from './collection-v08-decks'
import { COLLECTION_V08_PRINT } from './collection-v08-print'
import { COLLECTION_V08_DOCS } from './collection-v08-docs'
import { COLLECTION_V08_THUMBNAILS } from './collection-v08-thumbnails'
import { COLLECTION_V08_LOGOS } from './collection-v08-logos'
import { COLLECTION_V17_FIELDS } from './collection-v17-fields'
import { templateVariants } from './variants'

export type { TemplateDef } from './helpers'

/** the hand-authored library (122 designs) */
export const BASE_TEMPLATES: TemplateDef[] = [
  ...COLLECTION_V07,
  ...COLLECTION_V08_SOCIAL,
  ...COLLECTION_V08_DECKS,
  ...COLLECTION_V08_PRINT,
  ...COLLECTION_V08_DOCS,
  ...COLLECTION_V08_THUMBNAILS,
  ...COLLECTION_V08_LOGOS,
  ...COLLECTION_V17_FIELDS,
]

/**
 * The full library: 122 originals + 244 computed variants (Aurora
 * colourways + Ink typography swaps — see variants.ts) = 366 designs.
 * Variants are derived at module load, so the shipped bytes stay at
 * the originals' size; the DB seed materialises the same list.
 */
export const TEMPLATES: TemplateDef[] = [...BASE_TEMPLATES, ...templateVariants(BASE_TEMPLATES)]

export function templatesAsRecords(): TemplateRecord[] {
  return TEMPLATES.map((t) => ({
    id: t.slug,
    slug: t.slug,
    name: t.name,
    category: t.category,
    width: t.width,
    height: t.height,
    accent: t.accent,
    pages: t.pages,
    ...(t.fields ? { fields: t.fields } : {}),
  }))
}

export function blankPage(): PageData {
  return createPage()
}