@shapio/schema 0.3.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import { a as isEmptyRichText, i as RichTextResult, n as RichTextNode, o as richTextMediaIds, r as RichTextProblem, s as validateRichText, t as RichTextDocument } from "./validate-Oyo0GJ9j.js";
2
+ import { S as SeoFieldKey, _ as SEO_FIELD_IDS, a as EMPTY_SEO_DEFAULTS, b as SEO_TITLE_TEMPLATE_PATTERN, c as seoDefaultsForLocale, d as SeoLocaleDefaults, f as SeoLocaleDefaultsSchema, g as SEO_EDITOR_ID, h as SEO_DESCRIPTION_SOFT_MAX, i as resolveSeo, l as SeoDefaults, m as SEO_COMPONENT_ID, n as ResolveSeoContext, o as applyTitleTemplate, p as SEO_COMPONENT_API_KEY, r as SeoKeys, s as isValidTitleTemplate, t as DEFAULT_SEO_KEYS, u as SeoDefaultsSchema, v as SEO_TITLE_PLACEHOLDER, x as SEO_TWITTER_HANDLE_PATTERN, y as SEO_TITLE_SOFT_MAX } from "./resolve-7-z9VQqw.js";
2
3
  import { Static, TSchema, Type } from "typebox";
3
4
  //#region src/ids.d.ts
4
5
  /**
@@ -1151,5 +1152,73 @@ export declare const richTextToPlainText: (document: RichTextDocument) => string
1151
1152
  /** Plain text → a document of paragraphs (blank lines split paragraphs; single newlines are hard breaks). */
1152
1153
  export declare const plainTextToRichText: (text: string) => RichTextDocument;
1153
1154
  //#endregion
1154
- export { RichTextDocument, RichTextNode, RichTextProblem, RichTextResult, isEmptyRichText, richTextMediaIds, validateRichText };
1155
+ //#region src/themes/tokens.d.ts
1156
+ /**
1157
+ * Admin themes (docs/plans/themes.md): a theme is a named, complete set of these tokens for a light variant, a
1158
+ * dark variant or both. One list, shared by the admin's stylesheets (and their tests) and the API, which
1159
+ * validates themes declared by extensions (`shapio.config` `themes`).
1160
+ */
1161
+ /** The UI tokens: every theme variant sets all of them. */
1162
+ export declare const THEME_SEMANTIC_TOKENS: readonly ["background", "foreground", "card", "card-foreground", "popover", "popover-foreground", "primary", "primary-foreground", "primary-hover", "secondary", "secondary-foreground", "muted", "muted-foreground", "accent", "accent-foreground", "destructive", "destructive-foreground", "destructive-muted", "success", "success-muted", "warning", "warning-muted", "info", "info-muted", "border", "input", "ring", "link", "overlay", "sidebar", "sidebar-foreground", "sidebar-primary", "sidebar-primary-foreground", "sidebar-accent", "sidebar-accent-foreground", "sidebar-border", "sidebar-ring"];
1163
+ /**
1164
+ * The logo (tile, S, letters) and the signed-out screens' brand panel. Built-in themes set them all; an
1165
+ * extension theme may leave them out and gets Shapio's for that variant.
1166
+ */
1167
+ export declare const THEME_BRAND_TOKENS: readonly ["brand-logo", "brand-logo-foreground", "brand-letters", "brand-panel-from", "brand-panel-to", "brand-panel-foreground", "brand-panel-mark"];
1168
+ export declare const THEME_TOKENS: readonly ["background", "foreground", "card", "card-foreground", "popover", "popover-foreground", "primary", "primary-foreground", "primary-hover", "secondary", "secondary-foreground", "muted", "muted-foreground", "accent", "accent-foreground", "destructive", "destructive-foreground", "destructive-muted", "success", "success-muted", "warning", "warning-muted", "info", "info-muted", "border", "input", "ring", "link", "overlay", "sidebar", "sidebar-foreground", "sidebar-primary", "sidebar-primary-foreground", "sidebar-accent", "sidebar-accent-foreground", "sidebar-border", "sidebar-ring", "brand-logo", "brand-logo-foreground", "brand-letters", "brand-panel-from", "brand-panel-to", "brand-panel-foreground", "brand-panel-mark"];
1169
+ export type ThemeToken = (typeof THEME_TOKENS)[number];
1170
+ export declare const THEME_VARIANTS: readonly ["light", "dark"];
1171
+ export type ThemeVariant = (typeof THEME_VARIANTS)[number];
1172
+ /** A theme key: used in `data-theme` and in CSS selectors, so deliberately narrow. */
1173
+ export declare const THEME_KEY_PATTERN: RegExp;
1174
+ /** The themes the admin ships; an extension theme may not reuse these keys. */
1175
+ export declare const BUILT_IN_THEME_KEYS: readonly ["shapio", "classic", "murdered-out", "forest", "snowed", "butter"];
1176
+ export type BuiltInThemeKey = (typeof BUILT_IN_THEME_KEYS)[number];
1177
+ /**
1178
+ * A token value an extension may use: a hex colour or a colour function whose arguments are numbers, units
1179
+ * and separators only (no `;`, quotes, braces or nested functions such as `url()` or `var()`), so a value
1180
+ * can never escape its declaration.
1181
+ */
1182
+ export declare const THEME_COLOUR_PATTERN: RegExp;
1183
+ //#endregion
1184
+ //#region src/themes/contrast.d.ts
1185
+ /**
1186
+ * WCAG 2.1 AA contrast of a theme's tokens: text pairs need 4.5:1 (1.4.3); what identifies a control or the
1187
+ * focus (input borders, unchecked switches, focus rings, primary buttons against the page) needs 3:1 (1.4.11).
1188
+ * The admin's built-in themes are gated on this by a unit test; extension themes get warnings from
1189
+ * `shapio extensions check`. axe checks rendered text only, not these pairs.
1190
+ */
1191
+ export type ContrastPair = readonly [foreground: string, background: string];
1192
+ export declare const THEME_TEXT_PAIRS: readonly ContrastPair[];
1193
+ export declare const THEME_UI_PAIRS: readonly ContrastPair[];
1194
+ /**
1195
+ * Dark only: control borders on the selection surface. In light, selected table rows use accent/40, which
1196
+ * passes, and other selected surfaces hold no controls.
1197
+ */
1198
+ export declare const THEME_DARK_UI_PAIRS: readonly ContrastPair[];
1199
+ /** The WCAG contrast ratio of two `#rrggbb` colours. */
1200
+ export declare const contrastRatio: (a: string, b: string) => number;
1201
+ export type ContrastCheck = {
1202
+ foreground: string;
1203
+ background: string;
1204
+ /** 4.5 for text, 3 for controls. */
1205
+ required: number;
1206
+ /** Undefined when a value is not a `#rrggbb` colour (functions such as `oklch()` are not checked). */
1207
+ ratio: number | undefined;
1208
+ };
1209
+ /** Every pair the variant must meet, with its ratio. Missing tokens report an undefined ratio. */
1210
+ export declare const checkThemeContrast: (tokens: Readonly<Record<string, string>>, variant: ThemeVariant) => ContrastCheck[];
1211
+ //#endregion
1212
+ //#region src/seo/field.d.ts
1213
+ /** Whether a field holds the built-in SEO component (by stable ID, whatever its API ID or editor). */
1214
+ export declare const isSeoField: (field: FieldDefinition) => boolean;
1215
+ //#endregion
1216
+ //#region src/seo/definition.d.ts
1217
+ /**
1218
+ * The built-in SEO component as first created. All fields are public and none has a length limit: the 70 and
1219
+ * 160 character marks are admin-only counters (`SEO_TITLE_SOFT_MAX`), never validation.
1220
+ */
1221
+ export declare const seoComponentDefinition: () => ComponentDefinition;
1222
+ //#endregion
1223
+ export { DEFAULT_SEO_KEYS, EMPTY_SEO_DEFAULTS, ResolveSeoContext, RichTextDocument, RichTextNode, RichTextProblem, RichTextResult, SEO_COMPONENT_API_KEY, SEO_COMPONENT_ID, SEO_DESCRIPTION_SOFT_MAX, SEO_EDITOR_ID, SEO_FIELD_IDS, SEO_TITLE_PLACEHOLDER, SEO_TITLE_SOFT_MAX, SEO_TITLE_TEMPLATE_PATTERN, SEO_TWITTER_HANDLE_PATTERN, SeoDefaults, SeoDefaultsSchema, SeoFieldKey, SeoKeys, SeoLocaleDefaults, SeoLocaleDefaultsSchema, applyTitleTemplate, isEmptyRichText, isValidTitleTemplate, resolveSeo, richTextMediaIds, seoDefaultsForLocale, validateRichText };
1155
1224
  //# sourceMappingURL=index.d.ts.map