/** * This Source Code is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * Copyright (c) Infonomic Company Limited */ /** * Context passed to a `SlugifierFn`. * * `locale` - The content locale being slugified (e.g. the default * content locale when deriving a document's `path` * row in `byline_document_paths`). * `collectionPath` - The collection that owns the value being slugified. * Lets installation-supplied slugifiers branch by * collection if URL policies differ. */ export type SlugifyContext = { locale: string; collectionPath: string; }; /** * A pure function that converts a raw value into a URL-safe slug. * * Implementations must be synchronous and side-effect free — they are * called both server-side at write time and client-side for live form * preview / validation, and the two MUST agree on output. */ export type SlugifierFn = (value: string, ctx: SlugifyContext) => string; /** * Detects whether a string value looks like an ISO 8601 datetime. * * Used to decide between date-style and text-style slug formatting when * the source field is a date/datetime. */ export declare function looksLikeISODate(value: string): boolean; /** * Default slug formatter. Strips HTML, folds accented Latin to ASCII * while preserving letters and digits across all other scripts (CJK, * Cyrillic, Arabic, Thai, Devanagari, Greek, Kana, Hangul, …), replaces * whitespace and punctuation with hyphens, and lowercases the result. * * Used by core when no installation slugifier is configured on * `ServerConfig.slugifier`. */ export declare function formatTextValue(value: string): string; /** * The default slugifier shipped with `@byline/core`. * * Branches on the value to keep ISO datetimes legible (`2026-04-22` * rather than the slugified `2026-04-22t12-00-00z`). * * Callers must coerce non-string source values (e.g. `Date`) to a string * before invocation — typically `value instanceof Date ? value.toISOString() : String(value)`. */ export declare const slugify: SlugifierFn;