feat: improve preset building

This commit is contained in:
Carlos Valente
2025-07-20 07:37:54 +02:00
committed by Carlos Valente
parent 5bc286145d
commit a1fab10bfd
26 changed files with 614 additions and 299 deletions
@@ -1,5 +1,22 @@
/**
* Describes all views in Ontime
*/
export enum OntimeView {
Editor = 'editor',
Cuesheet = 'cuesheet',
Operator = 'op',
Timer = 'timer',
Backstage = 'backstage',
Timeline = 'timeline',
StudioClock = 'studio',
Countdown = 'countdown',
ProjectInfo = 'info',
}
export type URLPreset = {
// presets cannot target the editor view
target: Omit<OntimeView, 'editor'>;
enabled: boolean;
alias: string;
pathAndParams: string;
search: string;
};
+1 -1
View File
@@ -52,7 +52,7 @@ export type { ViewSettings } from './definitions/core/Views.type.js';
export type { TimeFormat } from './definitions/core/TimeFormat.type.js';
// ---> URL Presets
export type { URLPreset } from './definitions/core/UrlPreset.type.js';
export { OntimeView, type URLPreset } from './definitions/core/UrlPreset.type.js';
// ---> Custom Fields
export type {
@@ -8,7 +8,6 @@ export const regex = {
isASCII: /^[ -~]+$/, // https://catonmat.net/my-favorite-regex
isASCIIorEmpty: /^$|^[ -~]+$/, // https://catonmat.net/my-favorite-regex
isNotEmpty: /\S/,
isUrlSafe: /^[a-zA-Z0-9_-]*$/, // https://stackoverflow.com/questions/24419067/validate-a-string-to-be-url-safe-using-regex
};
export const checkRegex = {
@@ -21,5 +20,4 @@ export const checkRegex = {
isASCII: (text: string): boolean => regex.isASCII.test(text),
isASCIIorEmpty: (text: string): boolean => regex.isASCIIorEmpty.test(text),
isNotEmpty: (text: string): boolean => regex.isNotEmpty.test(text),
isUrlSafe: (text: string): boolean => regex.isUrlSafe.test(text),
};