diff --git a/src/command/render/filters.ts b/src/command/render/filters.ts index 597275fd1f0..8490d9a9e90 100644 --- a/src/command/render/filters.ts +++ b/src/command/render/filters.ts @@ -8,6 +8,7 @@ import { existsSync } from "fs/mod.ts"; import { kBibliography, + kBrand, kCitationLocation, kCiteMethod, kClearCellOptions, @@ -192,6 +193,7 @@ export async function filterParamsJson( [kIsShinyPython]: isShinyPython, [kShinyPythonExec]: isShinyPython ? await pythonExec() : undefined, [kExecutionEngine]: options.executionEngine, + [kBrand]: options.format.render[kBrand], }; return JSON.stringify(params); } diff --git a/src/command/render/render-contexts.ts b/src/command/render/render-contexts.ts index d5259fbba95..14ad0fa0d23 100644 --- a/src/command/render/render-contexts.ts +++ b/src/command/render/render-contexts.ts @@ -1,7 +1,7 @@ /* * render-contexts.ts * - * Copyright (C) 2021-2023 Posit Software, PBC + * Copyright (C) 2021-2024 Posit Software, PBC */ import { Format, FormatExecute, Metadata } from "../../config/types.ts"; @@ -89,6 +89,7 @@ import { } from "../../core/pandoc/pandoc-formats.ts"; import { ExtensionContext } from "../../extension/types.ts"; import { NotebookContext } from "../../render/notebook/notebook-types.ts"; +import { Brand } from "../../resources/types/schema-types.ts"; export async function resolveFormatsFromMetadata( metadata: Metadata, @@ -394,7 +395,7 @@ async function resolveFormats( engine: ExecutionEngine, options: RenderOptions, _notebookContext: NotebookContext, - project?: ProjectContext, + project: ProjectContext, enforceProjectFormats: boolean = true, ): Promise> { // input level metadata @@ -598,6 +599,9 @@ async function resolveFormats( ); }; + // resolve brand in project and forward it to format + mergedFormats[format].render.brand = await project.resolveBrand(); + // ensure that we have a valid forma const formatIsValid = isValidFormat( formatDesc, diff --git a/src/config/constants.ts b/src/config/constants.ts index 8c4d1d9ba02..1422028dc9b 100644 --- a/src/config/constants.ts +++ b/src/config/constants.ts @@ -109,6 +109,7 @@ export const kPreferHtml = "prefer-html"; export const kSelfContainedMath = "self-contained-math"; export const kBiblioConfig = "biblio-config"; export const kBodyClasses = "body-classes"; +export const kBrand = "brand"; export const kLatexAutoMk = "latex-auto-mk"; export const kLatexAutoInstall = "latex-auto-install"; diff --git a/src/config/types.ts b/src/config/types.ts index 22172d00507..abef33aa097 100644 --- a/src/config/types.ts +++ b/src/config/types.ts @@ -13,6 +13,7 @@ import { kBackToTop, kBaseFormat, kBodyClasses, + kBrand, kCache, kCalloutCautionCaption, kCalloutImportantCaption, @@ -246,6 +247,7 @@ import { import { HtmlPostProcessor, RenderServices } from "../command/render/types.ts"; import { QuartoFilterSpec } from "../command/render/types.ts"; import { ProjectContext } from "../project/types.ts"; +import { Brand } from "../resources/types/schema-types.ts"; export const kDependencies = "dependencies"; export const kSassBundles = "sass-bundles"; @@ -493,6 +495,7 @@ export interface FormatRender { [kValidateYaml]?: boolean; [kCanonicalUrl]?: boolean | string; [kBodyClasses]?: string; + [kBrand]?: Brand; } export interface FormatExecute { diff --git a/src/project/project-context.ts b/src/project/project-context.ts index 3ceadffd8ef..1e8349f27e7 100644 --- a/src/project/project-context.ts +++ b/src/project/project-context.ts @@ -66,6 +66,7 @@ import { ignoreFieldsForProjectType, normalizeFormatYaml, projectConfigFile, + projectResolveBrand, projectResolveFullMarkdownForFile, projectVarsFile, } from "./project-shared.ts"; @@ -254,6 +255,7 @@ export async function projectContext( } const result: ProjectContext = { + resolveBrand: async () => projectResolveBrand(result), resolveFullMarkdownForFile: ( engine: ExecutionEngine | undefined, file: string, @@ -333,6 +335,7 @@ export async function projectContext( } else { debug(`projectContext: Found Quarto project in ${dir}`); const result: ProjectContext = { + resolveBrand: async () => projectResolveBrand(result), resolveFullMarkdownForFile: ( engine: ExecutionEngine | undefined, file: string, @@ -390,6 +393,7 @@ export async function projectContext( configResolvers.shift(); } else if (force) { const context: ProjectContext = { + resolveBrand: async () => projectResolveBrand(context), resolveFullMarkdownForFile: ( engine: ExecutionEngine | undefined, file: string, diff --git a/src/project/project-shared.ts b/src/project/project-shared.ts index d4556b76c99..b5bbd35cde2 100644 --- a/src/project/project-shared.ts +++ b/src/project/project-shared.ts @@ -46,6 +46,8 @@ import { mappedIndexToLineCol } from "../core/lib/mapped-text.ts"; import { normalizeNewlines } from "../core/lib/text.ts"; import { DirectiveCell } from "../core/lib/break-quarto-md-types.ts"; import { QuartoJSONSchema } from "../core/yaml.ts"; +import { refSchema } from "../core/lib/yaml-schema/common.ts"; +import { Brand } from "../resources/types/schema-types.ts"; export function projectExcludeDirs(context: ProjectContext): string[] { const outputDir = projectOutputDir(context); @@ -484,3 +486,23 @@ const ensureFileInformationCache = (project: ProjectContext, file: string) => { } return project.fileInformationCache.get(file)!; }; + +export async function projectResolveBrand(project: ProjectContext) { + if (project.brandCache) { + return project.brandCache.brand; + } + project.brandCache = {}; + for (const brandFile of ["_brand.yml", "_brand.yaml"]) { + const brandPath = join(project.dir, brandFile); + if (!existsSync(brandPath)) { + continue; + } + const brand = await readAndValidateYamlFromFile( + brandPath, + refSchema("brand", "Format-independent brand configuration."), + "Brand validation failed for " + brandPath + ".", + ) as Brand; + project.brandCache.brand = brand; + } + return project.brandCache.brand; +} diff --git a/src/project/types.ts b/src/project/types.ts index b248acb97e3..d17ef386b63 100644 --- a/src/project/types.ts +++ b/src/project/types.ts @@ -13,6 +13,7 @@ import { ExecutionEngine, ExecutionTarget } from "../execute/types.ts"; import { InspectedMdCell } from "../quarto-core/inspect-types.ts"; import { NotebookContext } from "../render/notebook/notebook-types.ts"; import { + Brand, NavigationItem as NavItem, NavigationItemObject, NavigationItemObject as SidebarTool, @@ -66,6 +67,10 @@ export interface ProjectContext { fileInformationCache: Map; + // This is a cache of _brand.yml for a project + brandCache?: { brand?: Brand }; + resolveBrand: () => Promise; + // expands markdown for a file // input file doesn't have to be markdown; it can be, for example, a knitr spin file // output file is always markdown, though, and it is cached in the project diff --git a/src/project/types/single-file/single-file.ts b/src/project/types/single-file/single-file.ts index 41621d7b56c..f8847cd4c7a 100644 --- a/src/project/types/single-file/single-file.ts +++ b/src/project/types/single-file/single-file.ts @@ -19,7 +19,10 @@ import { renderFormats } from "../../../command/render/render-contexts.ts"; import { RenderFlags } from "../../../command/render/types.ts"; import { MappedString } from "../../../core/mapped-text.ts"; import { fileExecutionEngineAndTarget } from "../../../execute/engine.ts"; -import { projectResolveFullMarkdownForFile } from "../../project-shared.ts"; +import { + projectResolveBrand, + projectResolveFullMarkdownForFile, +} from "../../project-shared.ts"; import { ExecutionEngine } from "../../../execute/types.ts"; export function singleFileProjectContext( @@ -30,6 +33,7 @@ export function singleFileProjectContext( const environmentMemoizer = makeProjectEnvironmentMemoizer(notebookContext); const result: ProjectContext = { + resolveBrand: () => projectResolveBrand(result), dir: normalizePath(dirname(source)), engines: [], files: { diff --git a/src/resources/editor/tools/vs-code.mjs b/src/resources/editor/tools/vs-code.mjs index c1f78198a67..4c176627789 100644 --- a/src/resources/editor/tools/vs-code.mjs +++ b/src/resources/editor/tools/vs-code.mjs @@ -11784,6 +11784,488 @@ var require_yaml_intelligence_resources = __commonJS({ } } } + }, + { + id: "brand-meta", + description: "Metadata for a brand, including the brand name and important links.\n", + object: { + closed: false, + properties: { + name: { + description: "The brand name.", + anyOf: [ + "string", + { + object: { + properties: { + full: { + string: { + description: "The full, official or legal name of the company or brand." + } + }, + short: { + string: { + description: "The short, informal, or common name of the company or brand." + } + } + } + } + } + ] + }, + link: { + description: "Important links for the brand, including social media links. If a single string, it is the brand's home page or website. Additional fields are allowed for internal use.\n", + anyOf: [ + "string", + { + object: { + properties: { + home: { + string: { + description: "The brand's home page or website." + } + }, + mastodon: { + string: { + description: "The brand's Mastodon URL." + } + }, + github: { + string: { + description: "The brand's GitHub URL." + } + }, + linkedin: { + string: { + description: "The brand's LinkedIn URL." + } + }, + twitter: { + string: { + description: "The brand's Twitter URL." + } + }, + facebook: { + string: { + description: "The brand's Facebook URL." + } + } + } + } + } + ] + } + } + } + }, + { + id: "brand-string-light-dark", + anyOf: [ + "string", + { + object: { + closed: true, + properties: { + light: { + schema: "string", + description: "A link or path to the brand's light-colored logo or icon.\n" + }, + dark: { + schema: "string", + description: "A link or path to the brand's dark-colored logo or icon.\n" + } + } + } + } + ] + }, + { + id: "brand-logo", + description: "Provide links to the brand's logo in various formats and sizes.\n", + anyOf: [ + "string", + { + object: { + closed: true, + properties: { + small: { + description: "A link or path to the brand's small-sized logo or icon, or a link or path to both the light and dark versions.\n", + schema: { + ref: "brand-string-light-dark" + } + }, + medium: { + description: "A link or path to the brand's medium-sized logo, or a link or path to both the light and dark versions.\n", + schema: { + ref: "brand-string-light-dark" + } + }, + large: { + description: "A link or path to the brand's large- or full-sized logo, or a link or path to both the light and dark versions.\n", + schema: { + ref: "brand-string-light-dark" + } + } + } + } + } + ] + }, + { + id: "brand-color", + description: "The brand's custom color palette and theme.\n", + object: { + closed: true, + properties: { + palette: { + description: "The brand's custom color palette. Any number of colors can be defined, each color having a custom name.\n", + object: { + closed: false, + additionalProperties: { + schema: "string" + } + } + }, + theme: { + description: "The brand's theme colors. These are semantic or theme-oriented colors.\n", + object: { + closed: true, + properties: { + foreground: { + description: "The foreground color, used for text.", + schema: "string", + default: "black" + }, + background: { + description: "The background color, used for the page background.", + schema: "string", + default: "white" + }, + primary: { + description: "The primary accent color, i.e. the main theme color. Typically used for hyperlinks, active states, primary action buttons, etc.\n", + schema: "string" + }, + secondary: { + description: "The secondary accent color. Typically used for lighter text or disabled states.\n", + schema: "string" + }, + tertiary: { + description: "The tertiary accent color. Typically an even lighter color, used for hover states, accents, and wells.\n", + schema: "string" + }, + success: { + description: "The color used for positive or successful actions and information.", + schema: "string" + }, + info: { + description: "The color used for neutral or informational actions and information.", + schema: "string" + }, + warning: { + description: "The color used for warning or cautionary actions and information.", + schema: "string" + }, + danger: { + description: "The color used for errors, dangerous actions, or negative information.", + schema: "string" + }, + light: { + description: "A bright color, used as a high-contrast foreground color on dark elements or low-contrast background color on light elements.\n", + schema: "string" + }, + dark: { + description: "A dark color, used as a high-contrast foreground color on light elements or high-contrast background color on light elements.\n", + schema: "string" + } + } + } + } + } + } + }, + { + id: "brand-maybe-named-color", + description: "A color, which may be a named brand color.\n", + anyOf: [ + { + ref: "brand-named-theme-color" + }, + { + schema: "string" + } + ] + }, + { + id: "brand-named-theme-color", + description: "A named brand color, taken either from `color.theme` or `color.palette` (in that order).\n", + enum: [ + "foreground", + "background", + "primary", + "secondary", + "tertiary", + "success", + "info", + "warning", + "danger", + "light", + "dark", + "emphasis", + "link" + ] + }, + { + id: "brand-typography", + description: "Typography definitions for the brand.", + object: { + closed: true, + properties: { + font: { + description: "Font files and definitions for the brand.", + ref: "brand-font" + }, + base: { + description: "The base font settings for the brand. These are used as the default for all text.\n", + ref: "brand-typography-options" + }, + headings: { + description: "The font settings for headings.\n", + ref: "brand-typography-options-no-size" + }, + monospace: { + description: "The font settings for monospace text. Color in this context refers to inline code.\n", + ref: "brand-typography-options" + }, + emphasis: { + description: "The text properties used for emphasized (or emboldened) text.", + object: { + closed: true, + properties: { + weight: { + ref: "brand-font-weight" + }, + color: { + ref: "brand-maybe-named-color" + }, + "background-color": { + ref: "brand-maybe-named-color" + } + } + } + }, + link: { + description: "The text properties used for hyperlinks.", + object: { + closed: true, + properties: { + weight: { + ref: "brand-font-weight" + }, + decoration: "string", + color: { + ref: "brand-maybe-named-color", + default: "primary" + }, + "background-color": { + ref: "brand-maybe-named-color" + } + } + } + } + } + } + }, + { + id: "brand-typography-options", + description: "Typographic options.", + object: { + closed: true, + properties: { + family: "string", + size: "string", + "line-height": "string", + weight: { + ref: "brand-font-weight" + }, + style: { + ref: "brand-font-style" + }, + color: { + ref: "brand-maybe-named-color" + }, + "background-color": { + ref: "brand-maybe-named-color" + } + } + } + }, + { + id: "brand-typography-options-no-size", + description: "Typographic options without a font size.", + object: { + closed: true, + properties: { + family: "string", + "line-height": "string", + weight: { + ref: "brand-font-weight" + }, + style: { + ref: "brand-font-style" + }, + color: { + ref: "brand-maybe-named-color" + }, + "background-color": { + ref: "brand-maybe-named-color" + } + } + } + }, + { + id: "brand-font", + description: "Font files and definitions for the brand.", + arrayOf: { + anyOf: [ + { + ref: "brand-font-google" + }, + { + ref: "brand-font-file" + }, + { + ref: "brand-font-family" + } + ] + } + }, + { + id: "brand-font-weight", + description: "A font weight.", + enum: [ + 100, + 200, + 300, + 400, + 500, + 600, + 700, + 800, + 900 + ], + default: 400 + }, + { + id: "brand-font-style", + description: "A font style.", + enum: [ + "normal", + "italic" + ], + default: "normal" + }, + { + id: "brand-font-google", + description: "A Google Font definition.", + object: { + closed: true, + properties: { + google: { + anyOf: [ + "string", + { + object: { + closed: true, + properties: { + family: { + description: "The font family name, which must match the name of the font on Google Fonts.", + schema: "string" + }, + weight: { + description: "The font weights to include.", + maybeArrayOf: { + ref: "brand-font-weight" + }, + default: [ + 400, + 700 + ] + }, + style: { + description: "The font style to include.", + maybeArrayOf: { + ref: "brand-font-style" + }, + default: [ + "normal", + "italic" + ] + }, + display: { + description: "The font display method, determines how a font face is font face is shown depending on its download status and readiness for use.\n", + enum: [ + "auto", + "block", + "swap", + "fallback", + "optional" + ], + default: "swap" + } + } + } + } + ] + } + } + } + }, + { + id: "brand-font-file", + description: "A method for providing font files directly, either locally or from an online location.", + object: { + closed: true, + properties: { + family: { + description: "The font family name.", + schema: "string" + }, + files: { + maybeArrayOf: { + anyOf: [ + "path", + "string" + ] + }, + description: "The font files to include. These can be local or online. Local file paths should be relative to the `brand.yml` file. Online paths should be complete URLs.\n" + } + } + } + }, + { + id: "brand-font-family", + description: "A locally-installed font family name. When used, the end-user is responsible for ensuring that the font is installed on their system.\n", + schema: "string" + }, + { + id: "brand", + object: { + closed: false, + properties: { + meta: { + ref: "brand-meta" + }, + logo: { + ref: "brand-logo" + }, + color: { + ref: "brand-color" + }, + typography: { + ref: "brand-typography" + } + } + } } ], "schema/document-about.yml": [ @@ -20814,6 +21296,60 @@ var require_yaml_intelligence_resources = __commonJS({ "Additional file resources to be copied to output directory", "Files that specify the execution environment (e.g. renv.lock,\nrequirements.text, etc\u2026)", "Files that specify the execution environment (e.g. renv.lock,\nrequirements.text, etc\u2026)", + "Metadata for a brand, including the brand name and important\nlinks.", + "The brand name.", + "The full, official or legal name of the company or brand.", + "The short, informal, or common name of the company or brand.", + "Important links for the brand, including social media links. If a\nsingle string, it is the brand\u2019s home page or website. Additional fields\nare allowed for internal use.", + "The brand\u2019s home page or website.", + "The brand\u2019s Mastodon URL.", + "The brand\u2019s GitHub URL.", + "The brand\u2019s LinkedIn URL.", + "The brand\u2019s Twitter URL.", + "The brand\u2019s Facebook URL.", + "A link or path to the brand\u2019s light-colored logo or icon.", + "A link or path to the brand\u2019s dark-colored logo or icon.", + "Provide links to the brand\u2019s logo in various formats and sizes.", + "A link or path to the brand\u2019s small-sized logo or icon, or a link or\npath to both the light and dark versions.", + "A link or path to the brand\u2019s medium-sized logo, or a link or path to\nboth the light and dark versions.", + "A link or path to the brand\u2019s large- or full-sized logo, or a link or\npath to both the light and dark versions.", + "The brand\u2019s custom color palette and theme.", + "The brand\u2019s custom color palette. Any number of colors can be\ndefined, each color having a custom name.", + "The brand\u2019s theme colors. These are semantic or theme-oriented\ncolors.", + "The foreground color, used for text.", + "The background color, used for the page background.", + "The primary accent color, i.e. the main theme color. Typically used\nfor hyperlinks, active states, primary action buttons, etc.", + "The secondary accent color. Typically used for lighter text or\ndisabled states.", + "The tertiary accent color. Typically an even lighter color, used for\nhover states, accents, and wells.", + "The color used for positive or successful actions and\ninformation.", + "The color used for neutral or informational actions and\ninformation.", + "The color used for warning or cautionary actions and information.", + "The color used for errors, dangerous actions, or negative\ninformation.", + "A bright color, used as a high-contrast foreground color on dark\nelements or low-contrast background color on light elements.", + "A dark color, used as a high-contrast foreground color on light\nelements or high-contrast background color on light elements.", + "A color, which may be a named brand color.", + "A named brand color, taken either from color.theme or\ncolor.palette (in that order).", + "Typography definitions for the brand.", + "Font files and definitions for the brand.", + "The base font settings for the brand. These are used as the default\nfor all text.", + "The font settings for headings.", + "The font settings for monospace text. Color in this context refers to\ninline code.", + "The text properties used for emphasized (or emboldened) text.", + "The text properties used for hyperlinks.", + "Typographic options.", + "Typographic options without a font size.", + "Font files and definitions for the brand.", + "A font weight.", + "A font style.", + "A Google Font definition.", + "The font family name, which must match the name of the font on Google\nFonts.", + "The font weights to include.", + "The font style to include.", + "The font display method, determines how a font face is font face is\nshown depending on its download status and readiness for use.", + "A method for providing font files directly, either locally or from an\nonline location.", + "The font family name.", + "The font files to include. These can be local or online. Local file\npaths should be relative to the brand.yml file. Online\npaths should be complete URLs.", + "A locally-installed font family name. When used, the end-user is\nresponsible for ensuring that the font is installed on their system.", { short: "Unique label for code cell", long: "Unique label for code cell. Used when other code needs to refer to\nthe cell (e.g. for cross references fig-samples or\ntbl-summary)" @@ -23095,12 +23631,12 @@ var require_yaml_intelligence_resources = __commonJS({ mermaid: "%%" }, "handlers/mermaid/schema.yml": { - _internalId: 186714, + _internalId: 187345, type: "object", description: "be an object", properties: { "mermaid-format": { - _internalId: 186706, + _internalId: 187337, type: "enum", enum: [ "png", @@ -23116,7 +23652,7 @@ var require_yaml_intelligence_resources = __commonJS({ exhaustiveCompletions: true }, theme: { - _internalId: 186713, + _internalId: 187344, type: "anyOf", anyOf: [ { diff --git a/src/resources/editor/tools/yaml/web-worker.js b/src/resources/editor/tools/yaml/web-worker.js index 1bda7fc0f05..7c2e97e0ff5 100644 --- a/src/resources/editor/tools/yaml/web-worker.js +++ b/src/resources/editor/tools/yaml/web-worker.js @@ -11785,6 +11785,488 @@ try { } } } + }, + { + id: "brand-meta", + description: "Metadata for a brand, including the brand name and important links.\n", + object: { + closed: false, + properties: { + name: { + description: "The brand name.", + anyOf: [ + "string", + { + object: { + properties: { + full: { + string: { + description: "The full, official or legal name of the company or brand." + } + }, + short: { + string: { + description: "The short, informal, or common name of the company or brand." + } + } + } + } + } + ] + }, + link: { + description: "Important links for the brand, including social media links. If a single string, it is the brand's home page or website. Additional fields are allowed for internal use.\n", + anyOf: [ + "string", + { + object: { + properties: { + home: { + string: { + description: "The brand's home page or website." + } + }, + mastodon: { + string: { + description: "The brand's Mastodon URL." + } + }, + github: { + string: { + description: "The brand's GitHub URL." + } + }, + linkedin: { + string: { + description: "The brand's LinkedIn URL." + } + }, + twitter: { + string: { + description: "The brand's Twitter URL." + } + }, + facebook: { + string: { + description: "The brand's Facebook URL." + } + } + } + } + } + ] + } + } + } + }, + { + id: "brand-string-light-dark", + anyOf: [ + "string", + { + object: { + closed: true, + properties: { + light: { + schema: "string", + description: "A link or path to the brand's light-colored logo or icon.\n" + }, + dark: { + schema: "string", + description: "A link or path to the brand's dark-colored logo or icon.\n" + } + } + } + } + ] + }, + { + id: "brand-logo", + description: "Provide links to the brand's logo in various formats and sizes.\n", + anyOf: [ + "string", + { + object: { + closed: true, + properties: { + small: { + description: "A link or path to the brand's small-sized logo or icon, or a link or path to both the light and dark versions.\n", + schema: { + ref: "brand-string-light-dark" + } + }, + medium: { + description: "A link or path to the brand's medium-sized logo, or a link or path to both the light and dark versions.\n", + schema: { + ref: "brand-string-light-dark" + } + }, + large: { + description: "A link or path to the brand's large- or full-sized logo, or a link or path to both the light and dark versions.\n", + schema: { + ref: "brand-string-light-dark" + } + } + } + } + } + ] + }, + { + id: "brand-color", + description: "The brand's custom color palette and theme.\n", + object: { + closed: true, + properties: { + palette: { + description: "The brand's custom color palette. Any number of colors can be defined, each color having a custom name.\n", + object: { + closed: false, + additionalProperties: { + schema: "string" + } + } + }, + theme: { + description: "The brand's theme colors. These are semantic or theme-oriented colors.\n", + object: { + closed: true, + properties: { + foreground: { + description: "The foreground color, used for text.", + schema: "string", + default: "black" + }, + background: { + description: "The background color, used for the page background.", + schema: "string", + default: "white" + }, + primary: { + description: "The primary accent color, i.e. the main theme color. Typically used for hyperlinks, active states, primary action buttons, etc.\n", + schema: "string" + }, + secondary: { + description: "The secondary accent color. Typically used for lighter text or disabled states.\n", + schema: "string" + }, + tertiary: { + description: "The tertiary accent color. Typically an even lighter color, used for hover states, accents, and wells.\n", + schema: "string" + }, + success: { + description: "The color used for positive or successful actions and information.", + schema: "string" + }, + info: { + description: "The color used for neutral or informational actions and information.", + schema: "string" + }, + warning: { + description: "The color used for warning or cautionary actions and information.", + schema: "string" + }, + danger: { + description: "The color used for errors, dangerous actions, or negative information.", + schema: "string" + }, + light: { + description: "A bright color, used as a high-contrast foreground color on dark elements or low-contrast background color on light elements.\n", + schema: "string" + }, + dark: { + description: "A dark color, used as a high-contrast foreground color on light elements or high-contrast background color on light elements.\n", + schema: "string" + } + } + } + } + } + } + }, + { + id: "brand-maybe-named-color", + description: "A color, which may be a named brand color.\n", + anyOf: [ + { + ref: "brand-named-theme-color" + }, + { + schema: "string" + } + ] + }, + { + id: "brand-named-theme-color", + description: "A named brand color, taken either from `color.theme` or `color.palette` (in that order).\n", + enum: [ + "foreground", + "background", + "primary", + "secondary", + "tertiary", + "success", + "info", + "warning", + "danger", + "light", + "dark", + "emphasis", + "link" + ] + }, + { + id: "brand-typography", + description: "Typography definitions for the brand.", + object: { + closed: true, + properties: { + font: { + description: "Font files and definitions for the brand.", + ref: "brand-font" + }, + base: { + description: "The base font settings for the brand. These are used as the default for all text.\n", + ref: "brand-typography-options" + }, + headings: { + description: "The font settings for headings.\n", + ref: "brand-typography-options-no-size" + }, + monospace: { + description: "The font settings for monospace text. Color in this context refers to inline code.\n", + ref: "brand-typography-options" + }, + emphasis: { + description: "The text properties used for emphasized (or emboldened) text.", + object: { + closed: true, + properties: { + weight: { + ref: "brand-font-weight" + }, + color: { + ref: "brand-maybe-named-color" + }, + "background-color": { + ref: "brand-maybe-named-color" + } + } + } + }, + link: { + description: "The text properties used for hyperlinks.", + object: { + closed: true, + properties: { + weight: { + ref: "brand-font-weight" + }, + decoration: "string", + color: { + ref: "brand-maybe-named-color", + default: "primary" + }, + "background-color": { + ref: "brand-maybe-named-color" + } + } + } + } + } + } + }, + { + id: "brand-typography-options", + description: "Typographic options.", + object: { + closed: true, + properties: { + family: "string", + size: "string", + "line-height": "string", + weight: { + ref: "brand-font-weight" + }, + style: { + ref: "brand-font-style" + }, + color: { + ref: "brand-maybe-named-color" + }, + "background-color": { + ref: "brand-maybe-named-color" + } + } + } + }, + { + id: "brand-typography-options-no-size", + description: "Typographic options without a font size.", + object: { + closed: true, + properties: { + family: "string", + "line-height": "string", + weight: { + ref: "brand-font-weight" + }, + style: { + ref: "brand-font-style" + }, + color: { + ref: "brand-maybe-named-color" + }, + "background-color": { + ref: "brand-maybe-named-color" + } + } + } + }, + { + id: "brand-font", + description: "Font files and definitions for the brand.", + arrayOf: { + anyOf: [ + { + ref: "brand-font-google" + }, + { + ref: "brand-font-file" + }, + { + ref: "brand-font-family" + } + ] + } + }, + { + id: "brand-font-weight", + description: "A font weight.", + enum: [ + 100, + 200, + 300, + 400, + 500, + 600, + 700, + 800, + 900 + ], + default: 400 + }, + { + id: "brand-font-style", + description: "A font style.", + enum: [ + "normal", + "italic" + ], + default: "normal" + }, + { + id: "brand-font-google", + description: "A Google Font definition.", + object: { + closed: true, + properties: { + google: { + anyOf: [ + "string", + { + object: { + closed: true, + properties: { + family: { + description: "The font family name, which must match the name of the font on Google Fonts.", + schema: "string" + }, + weight: { + description: "The font weights to include.", + maybeArrayOf: { + ref: "brand-font-weight" + }, + default: [ + 400, + 700 + ] + }, + style: { + description: "The font style to include.", + maybeArrayOf: { + ref: "brand-font-style" + }, + default: [ + "normal", + "italic" + ] + }, + display: { + description: "The font display method, determines how a font face is font face is shown depending on its download status and readiness for use.\n", + enum: [ + "auto", + "block", + "swap", + "fallback", + "optional" + ], + default: "swap" + } + } + } + } + ] + } + } + } + }, + { + id: "brand-font-file", + description: "A method for providing font files directly, either locally or from an online location.", + object: { + closed: true, + properties: { + family: { + description: "The font family name.", + schema: "string" + }, + files: { + maybeArrayOf: { + anyOf: [ + "path", + "string" + ] + }, + description: "The font files to include. These can be local or online. Local file paths should be relative to the `brand.yml` file. Online paths should be complete URLs.\n" + } + } + } + }, + { + id: "brand-font-family", + description: "A locally-installed font family name. When used, the end-user is responsible for ensuring that the font is installed on their system.\n", + schema: "string" + }, + { + id: "brand", + object: { + closed: false, + properties: { + meta: { + ref: "brand-meta" + }, + logo: { + ref: "brand-logo" + }, + color: { + ref: "brand-color" + }, + typography: { + ref: "brand-typography" + } + } + } } ], "schema/document-about.yml": [ @@ -20815,6 +21297,60 @@ try { "Additional file resources to be copied to output directory", "Files that specify the execution environment (e.g. renv.lock,\nrequirements.text, etc\u2026)", "Files that specify the execution environment (e.g. renv.lock,\nrequirements.text, etc\u2026)", + "Metadata for a brand, including the brand name and important\nlinks.", + "The brand name.", + "The full, official or legal name of the company or brand.", + "The short, informal, or common name of the company or brand.", + "Important links for the brand, including social media links. If a\nsingle string, it is the brand\u2019s home page or website. Additional fields\nare allowed for internal use.", + "The brand\u2019s home page or website.", + "The brand\u2019s Mastodon URL.", + "The brand\u2019s GitHub URL.", + "The brand\u2019s LinkedIn URL.", + "The brand\u2019s Twitter URL.", + "The brand\u2019s Facebook URL.", + "A link or path to the brand\u2019s light-colored logo or icon.", + "A link or path to the brand\u2019s dark-colored logo or icon.", + "Provide links to the brand\u2019s logo in various formats and sizes.", + "A link or path to the brand\u2019s small-sized logo or icon, or a link or\npath to both the light and dark versions.", + "A link or path to the brand\u2019s medium-sized logo, or a link or path to\nboth the light and dark versions.", + "A link or path to the brand\u2019s large- or full-sized logo, or a link or\npath to both the light and dark versions.", + "The brand\u2019s custom color palette and theme.", + "The brand\u2019s custom color palette. Any number of colors can be\ndefined, each color having a custom name.", + "The brand\u2019s theme colors. These are semantic or theme-oriented\ncolors.", + "The foreground color, used for text.", + "The background color, used for the page background.", + "The primary accent color, i.e. the main theme color. Typically used\nfor hyperlinks, active states, primary action buttons, etc.", + "The secondary accent color. Typically used for lighter text or\ndisabled states.", + "The tertiary accent color. Typically an even lighter color, used for\nhover states, accents, and wells.", + "The color used for positive or successful actions and\ninformation.", + "The color used for neutral or informational actions and\ninformation.", + "The color used for warning or cautionary actions and information.", + "The color used for errors, dangerous actions, or negative\ninformation.", + "A bright color, used as a high-contrast foreground color on dark\nelements or low-contrast background color on light elements.", + "A dark color, used as a high-contrast foreground color on light\nelements or high-contrast background color on light elements.", + "A color, which may be a named brand color.", + "A named brand color, taken either from color.theme or\ncolor.palette (in that order).", + "Typography definitions for the brand.", + "Font files and definitions for the brand.", + "The base font settings for the brand. These are used as the default\nfor all text.", + "The font settings for headings.", + "The font settings for monospace text. Color in this context refers to\ninline code.", + "The text properties used for emphasized (or emboldened) text.", + "The text properties used for hyperlinks.", + "Typographic options.", + "Typographic options without a font size.", + "Font files and definitions for the brand.", + "A font weight.", + "A font style.", + "A Google Font definition.", + "The font family name, which must match the name of the font on Google\nFonts.", + "The font weights to include.", + "The font style to include.", + "The font display method, determines how a font face is font face is\nshown depending on its download status and readiness for use.", + "A method for providing font files directly, either locally or from an\nonline location.", + "The font family name.", + "The font files to include. These can be local or online. Local file\npaths should be relative to the brand.yml file. Online\npaths should be complete URLs.", + "A locally-installed font family name. When used, the end-user is\nresponsible for ensuring that the font is installed on their system.", { short: "Unique label for code cell", long: "Unique label for code cell. Used when other code needs to refer to\nthe cell (e.g. for cross references fig-samples or\ntbl-summary)" @@ -23096,12 +23632,12 @@ try { mermaid: "%%" }, "handlers/mermaid/schema.yml": { - _internalId: 186714, + _internalId: 187345, type: "object", description: "be an object", properties: { "mermaid-format": { - _internalId: 186706, + _internalId: 187337, type: "enum", enum: [ "png", @@ -23117,7 +23653,7 @@ try { exhaustiveCompletions: true }, theme: { - _internalId: 186713, + _internalId: 187344, type: "anyOf", anyOf: [ { diff --git a/src/resources/editor/tools/yaml/yaml-intelligence-resources.json b/src/resources/editor/tools/yaml/yaml-intelligence-resources.json index f98d09e3b5f..3ff3988e33c 100644 --- a/src/resources/editor/tools/yaml/yaml-intelligence-resources.json +++ b/src/resources/editor/tools/yaml/yaml-intelligence-resources.json @@ -4756,6 +4756,488 @@ } } } + }, + { + "id": "brand-meta", + "description": "Metadata for a brand, including the brand name and important links.\n", + "object": { + "closed": false, + "properties": { + "name": { + "description": "The brand name.", + "anyOf": [ + "string", + { + "object": { + "properties": { + "full": { + "string": { + "description": "The full, official or legal name of the company or brand." + } + }, + "short": { + "string": { + "description": "The short, informal, or common name of the company or brand." + } + } + } + } + } + ] + }, + "link": { + "description": "Important links for the brand, including social media links. If a single string, it is the brand's home page or website. Additional fields are allowed for internal use.\n", + "anyOf": [ + "string", + { + "object": { + "properties": { + "home": { + "string": { + "description": "The brand's home page or website." + } + }, + "mastodon": { + "string": { + "description": "The brand's Mastodon URL." + } + }, + "github": { + "string": { + "description": "The brand's GitHub URL." + } + }, + "linkedin": { + "string": { + "description": "The brand's LinkedIn URL." + } + }, + "twitter": { + "string": { + "description": "The brand's Twitter URL." + } + }, + "facebook": { + "string": { + "description": "The brand's Facebook URL." + } + } + } + } + } + ] + } + } + } + }, + { + "id": "brand-string-light-dark", + "anyOf": [ + "string", + { + "object": { + "closed": true, + "properties": { + "light": { + "schema": "string", + "description": "A link or path to the brand's light-colored logo or icon.\n" + }, + "dark": { + "schema": "string", + "description": "A link or path to the brand's dark-colored logo or icon.\n" + } + } + } + } + ] + }, + { + "id": "brand-logo", + "description": "Provide links to the brand's logo in various formats and sizes.\n", + "anyOf": [ + "string", + { + "object": { + "closed": true, + "properties": { + "small": { + "description": "A link or path to the brand's small-sized logo or icon, or a link or path to both the light and dark versions.\n", + "schema": { + "ref": "brand-string-light-dark" + } + }, + "medium": { + "description": "A link or path to the brand's medium-sized logo, or a link or path to both the light and dark versions.\n", + "schema": { + "ref": "brand-string-light-dark" + } + }, + "large": { + "description": "A link or path to the brand's large- or full-sized logo, or a link or path to both the light and dark versions.\n", + "schema": { + "ref": "brand-string-light-dark" + } + } + } + } + } + ] + }, + { + "id": "brand-color", + "description": "The brand's custom color palette and theme.\n", + "object": { + "closed": true, + "properties": { + "palette": { + "description": "The brand's custom color palette. Any number of colors can be defined, each color having a custom name.\n", + "object": { + "closed": false, + "additionalProperties": { + "schema": "string" + } + } + }, + "theme": { + "description": "The brand's theme colors. These are semantic or theme-oriented colors.\n", + "object": { + "closed": true, + "properties": { + "foreground": { + "description": "The foreground color, used for text.", + "schema": "string", + "default": "black" + }, + "background": { + "description": "The background color, used for the page background.", + "schema": "string", + "default": "white" + }, + "primary": { + "description": "The primary accent color, i.e. the main theme color. Typically used for hyperlinks, active states, primary action buttons, etc.\n", + "schema": "string" + }, + "secondary": { + "description": "The secondary accent color. Typically used for lighter text or disabled states.\n", + "schema": "string" + }, + "tertiary": { + "description": "The tertiary accent color. Typically an even lighter color, used for hover states, accents, and wells.\n", + "schema": "string" + }, + "success": { + "description": "The color used for positive or successful actions and information.", + "schema": "string" + }, + "info": { + "description": "The color used for neutral or informational actions and information.", + "schema": "string" + }, + "warning": { + "description": "The color used for warning or cautionary actions and information.", + "schema": "string" + }, + "danger": { + "description": "The color used for errors, dangerous actions, or negative information.", + "schema": "string" + }, + "light": { + "description": "A bright color, used as a high-contrast foreground color on dark elements or low-contrast background color on light elements.\n", + "schema": "string" + }, + "dark": { + "description": "A dark color, used as a high-contrast foreground color on light elements or high-contrast background color on light elements.\n", + "schema": "string" + } + } + } + } + } + } + }, + { + "id": "brand-maybe-named-color", + "description": "A color, which may be a named brand color.\n", + "anyOf": [ + { + "ref": "brand-named-theme-color" + }, + { + "schema": "string" + } + ] + }, + { + "id": "brand-named-theme-color", + "description": "A named brand color, taken either from `color.theme` or `color.palette` (in that order).\n", + "enum": [ + "foreground", + "background", + "primary", + "secondary", + "tertiary", + "success", + "info", + "warning", + "danger", + "light", + "dark", + "emphasis", + "link" + ] + }, + { + "id": "brand-typography", + "description": "Typography definitions for the brand.", + "object": { + "closed": true, + "properties": { + "font": { + "description": "Font files and definitions for the brand.", + "ref": "brand-font" + }, + "base": { + "description": "The base font settings for the brand. These are used as the default for all text.\n", + "ref": "brand-typography-options" + }, + "headings": { + "description": "The font settings for headings.\n", + "ref": "brand-typography-options-no-size" + }, + "monospace": { + "description": "The font settings for monospace text. Color in this context refers to inline code.\n", + "ref": "brand-typography-options" + }, + "emphasis": { + "description": "The text properties used for emphasized (or emboldened) text.", + "object": { + "closed": true, + "properties": { + "weight": { + "ref": "brand-font-weight" + }, + "color": { + "ref": "brand-maybe-named-color" + }, + "background-color": { + "ref": "brand-maybe-named-color" + } + } + } + }, + "link": { + "description": "The text properties used for hyperlinks.", + "object": { + "closed": true, + "properties": { + "weight": { + "ref": "brand-font-weight" + }, + "decoration": "string", + "color": { + "ref": "brand-maybe-named-color", + "default": "primary" + }, + "background-color": { + "ref": "brand-maybe-named-color" + } + } + } + } + } + } + }, + { + "id": "brand-typography-options", + "description": "Typographic options.", + "object": { + "closed": true, + "properties": { + "family": "string", + "size": "string", + "line-height": "string", + "weight": { + "ref": "brand-font-weight" + }, + "style": { + "ref": "brand-font-style" + }, + "color": { + "ref": "brand-maybe-named-color" + }, + "background-color": { + "ref": "brand-maybe-named-color" + } + } + } + }, + { + "id": "brand-typography-options-no-size", + "description": "Typographic options without a font size.", + "object": { + "closed": true, + "properties": { + "family": "string", + "line-height": "string", + "weight": { + "ref": "brand-font-weight" + }, + "style": { + "ref": "brand-font-style" + }, + "color": { + "ref": "brand-maybe-named-color" + }, + "background-color": { + "ref": "brand-maybe-named-color" + } + } + } + }, + { + "id": "brand-font", + "description": "Font files and definitions for the brand.", + "arrayOf": { + "anyOf": [ + { + "ref": "brand-font-google" + }, + { + "ref": "brand-font-file" + }, + { + "ref": "brand-font-family" + } + ] + } + }, + { + "id": "brand-font-weight", + "description": "A font weight.", + "enum": [ + 100, + 200, + 300, + 400, + 500, + 600, + 700, + 800, + 900 + ], + "default": 400 + }, + { + "id": "brand-font-style", + "description": "A font style.", + "enum": [ + "normal", + "italic" + ], + "default": "normal" + }, + { + "id": "brand-font-google", + "description": "A Google Font definition.", + "object": { + "closed": true, + "properties": { + "google": { + "anyOf": [ + "string", + { + "object": { + "closed": true, + "properties": { + "family": { + "description": "The font family name, which must match the name of the font on Google Fonts.", + "schema": "string" + }, + "weight": { + "description": "The font weights to include.", + "maybeArrayOf": { + "ref": "brand-font-weight" + }, + "default": [ + 400, + 700 + ] + }, + "style": { + "description": "The font style to include.", + "maybeArrayOf": { + "ref": "brand-font-style" + }, + "default": [ + "normal", + "italic" + ] + }, + "display": { + "description": "The font display method, determines how a font face is font face is shown depending on its download status and readiness for use.\n", + "enum": [ + "auto", + "block", + "swap", + "fallback", + "optional" + ], + "default": "swap" + } + } + } + } + ] + } + } + } + }, + { + "id": "brand-font-file", + "description": "A method for providing font files directly, either locally or from an online location.", + "object": { + "closed": true, + "properties": { + "family": { + "description": "The font family name.", + "schema": "string" + }, + "files": { + "maybeArrayOf": { + "anyOf": [ + "path", + "string" + ] + }, + "description": "The font files to include. These can be local or online. Local file paths should be relative to the `brand.yml` file. Online paths should be complete URLs.\n" + } + } + } + }, + { + "id": "brand-font-family", + "description": "A locally-installed font family name. When used, the end-user is responsible for ensuring that the font is installed on their system.\n", + "schema": "string" + }, + { + "id": "brand", + "object": { + "closed": false, + "properties": { + "meta": { + "ref": "brand-meta" + }, + "logo": { + "ref": "brand-logo" + }, + "color": { + "ref": "brand-color" + }, + "typography": { + "ref": "brand-typography" + } + } + } } ], "schema/document-about.yml": [ @@ -13786,6 +14268,60 @@ "Additional file resources to be copied to output directory", "Files that specify the execution environment (e.g. renv.lock,\nrequirements.text, etc…)", "Files that specify the execution environment (e.g. renv.lock,\nrequirements.text, etc…)", + "Metadata for a brand, including the brand name and important\nlinks.", + "The brand name.", + "The full, official or legal name of the company or brand.", + "The short, informal, or common name of the company or brand.", + "Important links for the brand, including social media links. If a\nsingle string, it is the brand’s home page or website. Additional fields\nare allowed for internal use.", + "The brand’s home page or website.", + "The brand’s Mastodon URL.", + "The brand’s GitHub URL.", + "The brand’s LinkedIn URL.", + "The brand’s Twitter URL.", + "The brand’s Facebook URL.", + "A link or path to the brand’s light-colored logo or icon.", + "A link or path to the brand’s dark-colored logo or icon.", + "Provide links to the brand’s logo in various formats and sizes.", + "A link or path to the brand’s small-sized logo or icon, or a link or\npath to both the light and dark versions.", + "A link or path to the brand’s medium-sized logo, or a link or path to\nboth the light and dark versions.", + "A link or path to the brand’s large- or full-sized logo, or a link or\npath to both the light and dark versions.", + "The brand’s custom color palette and theme.", + "The brand’s custom color palette. Any number of colors can be\ndefined, each color having a custom name.", + "The brand’s theme colors. These are semantic or theme-oriented\ncolors.", + "The foreground color, used for text.", + "The background color, used for the page background.", + "The primary accent color, i.e. the main theme color. Typically used\nfor hyperlinks, active states, primary action buttons, etc.", + "The secondary accent color. Typically used for lighter text or\ndisabled states.", + "The tertiary accent color. Typically an even lighter color, used for\nhover states, accents, and wells.", + "The color used for positive or successful actions and\ninformation.", + "The color used for neutral or informational actions and\ninformation.", + "The color used for warning or cautionary actions and information.", + "The color used for errors, dangerous actions, or negative\ninformation.", + "A bright color, used as a high-contrast foreground color on dark\nelements or low-contrast background color on light elements.", + "A dark color, used as a high-contrast foreground color on light\nelements or high-contrast background color on light elements.", + "A color, which may be a named brand color.", + "A named brand color, taken either from color.theme or\ncolor.palette (in that order).", + "Typography definitions for the brand.", + "Font files and definitions for the brand.", + "The base font settings for the brand. These are used as the default\nfor all text.", + "The font settings for headings.", + "The font settings for monospace text. Color in this context refers to\ninline code.", + "The text properties used for emphasized (or emboldened) text.", + "The text properties used for hyperlinks.", + "Typographic options.", + "Typographic options without a font size.", + "Font files and definitions for the brand.", + "A font weight.", + "A font style.", + "A Google Font definition.", + "The font family name, which must match the name of the font on Google\nFonts.", + "The font weights to include.", + "The font style to include.", + "The font display method, determines how a font face is font face is\nshown depending on its download status and readiness for use.", + "A method for providing font files directly, either locally or from an\nonline location.", + "The font family name.", + "The font files to include. These can be local or online. Local file\npaths should be relative to the brand.yml file. Online\npaths should be complete URLs.", + "A locally-installed font family name. When used, the end-user is\nresponsible for ensuring that the font is installed on their system.", { "short": "Unique label for code cell", "long": "Unique label for code cell. Used when other code needs to refer to\nthe cell (e.g. for cross references fig-samples or\ntbl-summary)" @@ -16067,12 +16603,12 @@ "mermaid": "%%" }, "handlers/mermaid/schema.yml": { - "_internalId": 186714, + "_internalId": 187345, "type": "object", "description": "be an object", "properties": { "mermaid-format": { - "_internalId": 186706, + "_internalId": 187337, "type": "enum", "enum": [ "png", @@ -16088,7 +16624,7 @@ "exhaustiveCompletions": true }, "theme": { - "_internalId": 186713, + "_internalId": 187344, "type": "anyOf", "anyOf": [ { diff --git a/src/resources/schema/definitions.yml b/src/resources/schema/definitions.yml index e4854ab2182..582706dc269 100644 --- a/src/resources/schema/definitions.yml +++ b/src/resources/schema/definitions.yml @@ -2453,3 +2453,348 @@ maybeArrayOf: schema: path description: "Files that specify the execution environment (e.g. renv.lock, requirements.text, etc...)" + +- id: brand-meta + description: > + Metadata for a brand, including the brand name and important links. + object: + closed: false + properties: + name: + description: The brand name. + anyOf: + - string + - object: + properties: + full: + string: + description: The full, official or legal name of the company or brand. + short: + string: + description: The short, informal, or common name of the company or brand. + link: + description: > + Important links for the brand, including social media links. + If a single string, it is the brand's home page or website. + Additional fields are allowed for internal use. + anyOf: + - string + - object: + properties: + home: + string: + description: The brand's home page or website. + mastodon: + string: + description: The brand's Mastodon URL. + github: + string: + description: The brand's GitHub URL. + linkedin: + string: + description: The brand's LinkedIn URL. + twitter: + string: + description: The brand's Twitter URL. + facebook: + string: + description: The brand's Facebook URL. + +- id: brand-string-light-dark + anyOf: + - string + - object: + closed: true + properties: + light: + schema: string + description: > + A link or path to the brand's light-colored logo or icon. + dark: + schema: string + description: > + A link or path to the brand's dark-colored logo or icon. + +- id: brand-logo + description: > + Provide links to the brand's logo in various formats and sizes. + anyOf: + - string + - object: + closed: true + properties: + small: + description: > + A link or path to the brand's small-sized logo or icon, or a link or path + to both the light and dark versions. + schema: + ref: brand-string-light-dark + medium: + description: > + A link or path to the brand's medium-sized logo, or a link or path + to both the light and dark versions. + schema: + ref: brand-string-light-dark + large: + description: > + A link or path to the brand's large- or full-sized logo, or a link or path + to both the light and dark versions. + schema: + ref: brand-string-light-dark + +- id: brand-color + description: > + The brand's custom color palette and theme. + object: + closed: true + properties: + palette: + description: > + The brand's custom color palette. Any number of colors can be defined, + each color having a custom name. + object: + closed: false + # We don't know the exact properties yet, but we do know they'll all be strings. + # I'm not sure how to express that in the spec. + additionalProperties: + schema: string + theme: + description: > + The brand's theme colors. These are semantic or theme-oriented colors. + object: + closed: true + properties: + foreground: + description: The foreground color, used for text. + schema: string + default: black + background: + description: The background color, used for the page background. + schema: string + default: white + primary: + description: > + The primary accent color, i.e. the main theme color. Typically used for + hyperlinks, active states, primary action buttons, etc. + schema: string + secondary: + description: > + The secondary accent color. Typically used for lighter text or disabled states. + schema: string + tertiary: + description: > + The tertiary accent color. Typically an even lighter color, used for hover states, + accents, and wells. + schema: string + success: + description: The color used for positive or successful actions and information. + schema: string + info: + description: The color used for neutral or informational actions and information. + schema: string + warning: + description: The color used for warning or cautionary actions and information. + schema: string + danger: + description: The color used for errors, dangerous actions, or negative information. + schema: string + light: + description: > + A bright color, used as a high-contrast foreground color on dark elements + or low-contrast background color on light elements. + schema: string + dark: + description: > + A dark color, used as a high-contrast foreground color on light elements + or high-contrast background color on light elements. + schema: string + +- id: brand-maybe-named-color + description: > + A color, which may be a named brand color. + anyOf: + - ref: brand-named-theme-color + - schema: string + +- id: brand-named-theme-color + description: > + A named brand color, taken either from `color.theme` or `color.palette` (in that order). + enum: + [ + foreground, + background, + primary, + secondary, + tertiary, + success, + info, + warning, + danger, + light, + dark, + emphasis, + link, + ] + +- id: brand-typography + description: Typography definitions for the brand. + object: + closed: true + properties: + font: + description: Font files and definitions for the brand. + ref: brand-font + base: + description: > + The base font settings for the brand. These are used as the default for all text. + ref: brand-typography-options + headings: + description: > + The font settings for headings. + ref: brand-typography-options-no-size + monospace: + description: > + The font settings for monospace text. Color in this context refers to inline code. + ref: brand-typography-options + emphasis: + description: The text properties used for emphasized (or emboldened) text. + object: + closed: true + properties: + weight: + ref: brand-font-weight + color: + ref: brand-maybe-named-color + background-color: + ref: brand-maybe-named-color + link: + description: The text properties used for hyperlinks. + object: + closed: true + properties: + weight: + ref: brand-font-weight + decoration: string + color: + schema: + ref: brand-maybe-named-color + default: primary + background-color: + ref: brand-maybe-named-color + +- id: brand-typography-options + description: Typographic options. + object: + closed: true + properties: + family: string + size: string + line-height: string + weight: + ref: brand-font-weight + style: + ref: brand-font-style + color: + ref: brand-maybe-named-color + background-color: + ref: brand-maybe-named-color + +- id: brand-typography-options-no-size + description: Typographic options without a font size. + object: + closed: true + properties: + family: string + line-height: string + weight: + ref: brand-font-weight + style: + ref: brand-font-style + color: + ref: brand-maybe-named-color + background-color: + ref: brand-maybe-named-color + +- id: brand-font + description: Font files and definitions for the brand. + arrayOf: + anyOf: + - ref: brand-font-google + - ref: brand-font-file + - ref: brand-font-family + +- id: brand-font-weight + description: A font weight. + enum: [100, 200, 300, 400, 500, 600, 700, 800, 900] + default: 400 + +- id: brand-font-style + description: A font style. + enum: [normal, italic] + default: normal + +- id: brand-font-google + description: A Google Font definition. + object: + closed: true + properties: + google: + anyOf: + - string + - object: + closed: true + properties: + family: + description: The font family name, which must match the name of the font on Google Fonts. + schema: string + weight: + description: The font weights to include. + maybeArrayOf: + ref: brand-font-weight + default: [400, 700] + style: + description: The font style to include. + maybeArrayOf: + ref: brand-font-style + default: [normal, italic] + display: + description: > + The font display method, determines how a font face is font face is shown + depending on its download status and readiness for use. + enum: [auto, block, swap, fallback, optional] + default: swap + +- id: brand-font-file + description: A method for providing font files directly, either locally or from an online location. + object: + closed: true + properties: + family: + description: The font family name. + schema: string + files: + maybeArrayOf: + anyOf: [path, string] + description: > + The font files to include. These can be local or online. + Local file paths should be relative to the `brand.yml` file. + Online paths should be complete URLs. + +- id: brand-font-family + description: > + A locally-installed font family name. When used, the end-user is responsible + for ensuring that the font is installed on their system. + schema: string + +- id: brand + object: + closed: false + properties: + meta: + ref: brand-meta + logo: + ref: brand-logo + color: + ref: brand-color + typography: + ref: brand-typography diff --git a/src/resources/types/schema-types.ts b/src/resources/types/schema-types.ts index fc3066a5334..af1ca18a41e 100644 --- a/src/resources/types/schema-types.ts +++ b/src/resources/types/schema-types.ts @@ -1263,6 +1263,154 @@ export type ManuscriptSchema = { >; /* Additional file resources to be copied to output directory */ }; +export type BrandMeta = { + link?: string | { + facebook?: string /* The brand's Facebook URL. */; + github?: string /* The brand's GitHub URL. */; + home?: string /* The brand's home page or website. */; + linkedin?: string /* The brand's LinkedIn URL. */; + mastodon?: string /* The brand's Mastodon URL. */; + twitter?: string; /* The brand's Twitter URL. */ + } /* Important links for the brand, including social media links. If a single string, it is the brand's home page or website. Additional fields are allowed for internal use. */; + name?: string | { + full?: + string /* The full, official or legal name of the company or brand. */; + short?: + string; /* The short, informal, or common name of the company or brand. */ + }; /* The brand name. */ +}; /* Metadata for a brand, including the brand name and important links. */ + +export type BrandStringLightDark = string | { dark?: string; light?: string }; + +export type BrandLogo = string | { + large?: BrandStringLightDark; + medium?: BrandStringLightDark; + small?: BrandStringLightDark; +}; /* Provide links to the brand's logo in various formats and sizes. */ + +export type BrandColor = { + palette?: + SchemaObject /* The brand's custom color palette. Any number of colors can be defined, each color having a custom name. */; + theme?: { + background?: string; + danger?: string; + dark?: string; + foreground?: string; + info?: string; + light?: string; + primary?: string; + secondary?: string; + success?: string; + tertiary?: string; + warning?: string; + }; /* The brand's theme colors. These are semantic or theme-oriented colors. */ +}; /* The brand's custom color palette and theme. */ + +export type BrandMaybeNamedColor = + | BrandNamedThemeColor + | string; /* A color, which may be a named brand color. */ + +export type BrandNamedThemeColor = + | "foreground" + | "background" + | "primary" + | "secondary" + | "tertiary" + | "success" + | "info" + | "warning" + | "danger" + | "light" + | "dark" + | "emphasis" + | "link"; /* A named brand color, taken either from `color.theme` or `color.palette` (in that order). */ + +export type BrandTypography = { + base?: BrandTypographyOptions; + emphasis?: { + "background-color"?: BrandMaybeNamedColor; + color?: BrandMaybeNamedColor; + weight?: BrandFontWeight; + } /* The text properties used for emphasized (or emboldened) text. */; + font?: BrandFont; + headings?: BrandTypographyOptionsNoSize; + link?: { + "background-color"?: BrandMaybeNamedColor; + color?: BrandMaybeNamedColor; + decoration?: string; + weight?: BrandFontWeight; + } /* The text properties used for hyperlinks. */; + monospace?: BrandTypographyOptions; +}; /* Typography definitions for the brand. */ + +export type BrandTypographyOptions = { + "line-height"?: string; + "background-color"?: BrandMaybeNamedColor; + color?: BrandMaybeNamedColor; + family?: string; + size?: string; + style?: BrandFontStyle; + weight?: BrandFontWeight; +}; /* Typographic options. */ + +export type BrandTypographyOptionsNoSize = { + "line-height"?: string; + "background-color"?: BrandMaybeNamedColor; + color?: BrandMaybeNamedColor; + family?: string; + style?: BrandFontStyle; + weight?: BrandFontWeight; +}; /* Typographic options without a font size. */ + +export type BrandFont = (( + | BrandFontGoogle + | BrandFontFile + | BrandFontFamily +))[]; /* Font files and definitions for the brand. */ + +export type BrandFontWeight = + | 100 + | 200 + | 300 + | 400 + | 500 + | 600 + | 700 + | 800 + | 900; /* A font weight. */ + +export type BrandFontStyle = "normal" | "italic"; /* A font style. */ + +export type BrandFontGoogle = { + google?: string | { + display?: + | "auto" + | "block" + | "swap" + | "fallback" + | "optional" /* The font display method, determines how a font face is font face is shown depending on its download status and readiness for use. */; + family?: string; + style?: MaybeArrayOf /* The font style to include. */; + weight?: MaybeArrayOf; /* The font weights to include. */ + }; +}; /* A Google Font definition. */ + +export type BrandFontFile = { + family?: string; + files?: MaybeArrayOf< + (string | string) + >; /* The font files to include. These can be local or online. Local file paths should be relative to the `brand.yml` file. Online paths should be complete URLs. */ +}; /* A method for providing font files directly, either locally or from an online location. */ + +export type BrandFontFamily = string; + +export type Brand = { + color?: BrandColor; + logo?: BrandLogo; + meta?: BrandMeta; + typography?: BrandTypography; +}; + export type ProjectConfig = { "execute-dir"?: | "file"