///
import { t as clearRouterViewPlugin } from "./plugins-Crhr7ifw.js";
import edge, { Edge, Edge as Edge$1 } from "edge.js";
import { ParserTagDefinitionContract } from "edge.js/types";
//#region src/ViewInstance.d.ts
declare class ViewInstance implements PromiseLike {
readonly name: string;
private renderer;
private runComposers;
private runComposersSync;
private renderName;
private payload;
private composersHaveRun;
constructor(name: string, data: ViewData | undefined, renderer: {
render: (name: string, data?: ViewData) => Promise;
renderSync: (name: string, data?: ViewData) => string;
}, runComposers: ComposerRunner, runComposersSync: SyncComposerRunner, renderName?: string);
get data(): ViewData;
with(key: string, value: any): this;
with(data: ViewData): this;
render(): Promise;
renderSync(): string;
then(onfulfilled?: ((value: string) => TResult1 | PromiseLike) | null, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null): PromiseLike;
private compose;
private composeSync;
}
//#endregion
//#region src/types.d.ts
type ViewErrorValue = string | string[] | Error | {
message?: unknown;
} | unknown;
type ViewErrorRecord = Record;
type ComposerRunner = (view: ViewInstance) => Promise;
type SyncComposerRunner = (view: ViewInstance) => void;
type ViewData = Record;
type ViewName = string;
type ViewComposerHandler = (view: ViewInstance) => void | Promise;
interface ViewComposerObject {
compose: ViewComposerHandler;
}
type ViewComposerClass = new () => ViewComposerObject;
type ViewComposer = ViewComposerHandler | ViewComposerObject | ViewComposerClass;
type ViewComposerName = ViewName | ViewName[];
type ViewFactoryOptions = {
cache?: boolean;
viewsPath?: string | URL;
packageViewsPath?: string;
edge?: Edge$1;
};
//#endregion
//#region src/ViewFactory.d.ts
declare class ViewFactory {
readonly edge: Edge$1;
private sharedData;
private composers;
private mountedPackages;
private packageViewsPath;
constructor(options?: ViewFactoryOptions);
/**
* Create a new view instance for the given view name and data.
*
* @param name
* @param data
* @returns
*/
make(name: ViewName, data?: ViewData): ViewInstance;
/**
* Render the first view that exists from the given list of names.
*
* @param names
* @param data
* @returns
*/
first(names: ViewName[], data?: ViewData): ViewInstance;
/**
* Check if a view exists.
*
* @param name
* @returns
*/
exists(name: ViewName): boolean;
/**
* Share data with all views.
* This data will be available in every view rendered by the factory.
*
* @param key
* @param value
*/
share(key: string, value: any): this;
share(data: ViewData): this;
/**
* Register a view composer for the given view name(s).
* A view composer is a function or object that is called when a view is
* rendered, allowing you to modify the view's data or perform other actions.
*
* @param names
* @param composer
* @returns
*/
composer(names: ViewComposerName, composer: ViewComposer): this;
/**
* Mount a directory containing views.
* If only one argument is provided, it will be treated as the views directory.
* If two arguments are provided, the first will be treated as the disk name and
* the second as the views directory.
*
* @param viewsDirectory
*/
mount(viewsDirectory: string | URL): this;
mount(diskName: string, viewsDirectory: string | URL): this;
/**
* Register a raw template with the given name and contents.
*
* @param name
* @param contents
* @returns
*/
raw(name: ViewName, contents: string): this;
/**
* Register a custom tag with the given name, block type, seekable type,
* and compiler function.
*
* @param tagName
* @param block
* @param seekable
* @param compiler
*/
tag(
/**
* The tag name
*/
tagName: string,
/**
* Tag accepts content within the opening and
* closing tags
*/
block: boolean,
/**
* Tag accepts parameters
*/
seekable: boolean,
/**
* The parser needs the `compile` method on every tag
*/
compiler: ParserTagDefinitionContract['compile']): void;
/**
* Flush all shared data. This will remove all data that has been shared with all views.
*
* @returns
*/
flushShared(): this;
/**
* Flush all registered composers. This will remove all composers that have
* been registered for any view.
*
* @returns
*/
flushComposers(): this;
private getComposers;
private runComposers;
private runComposersSync;
private resolveName;
}
//#endregion
//#region src/View.d.ts
declare class View {
private static factory;
private static usesDefaultFactoryRoot;
/**
* Bootstrap the view service
*/
static boot(): void;
static configure(options?: ViewFactoryOptions): ViewFactory;
static factoryInstance(): ViewFactory;
static make(name: ViewName, data?: ViewData): ViewInstance;
static first(names: ViewName[], data?: ViewData): ViewInstance;
static exists(name: ViewName): boolean;
static share(key: string, value: any): typeof View;
static share(data: ViewData): typeof View;
static composer(names: ViewComposerName, composer: ViewComposer): typeof View;
static mount(viewsDirectory: string | URL): typeof View;
static mount(diskName: string, viewsDirectory: string | URL): typeof View;
static raw(name: ViewName, contents: string): typeof View;
}
//#endregion
//#region src/ViewErrorBag.d.ts
declare class ViewErrorBag {
private bag;
constructor(errors?: ViewErrorRecord | ViewErrorBag | unknown);
add(field: string, message: ViewErrorValue): this;
merge(errors: ViewErrorRecord | ViewErrorBag | unknown): this;
keys(): string[];
get(field?: string): string[];
first(field?: string | null): string;
has(field?: string | string[] | null): boolean;
hasAny(fields: string | string[]): boolean;
missing(fields: string | string[]): boolean;
any(): boolean;
isEmpty(): boolean;
isNotEmpty(): boolean;
count(): number;
all(): string[];
unique(): string[];
clear(field?: string | string[]): this;
forget(field: string): this;
messagesRaw(): Record;
getMessages(): Record;
getMessageBag(): this;
toArray(): Record;
toJSON(): Record;
}
declare const normalizeViewErrors: (errors?: unknown) => Pick;
//#endregion
//#region src/helpers.d.ts
declare function view(): ViewFactory;
declare function view(name: ViewName, data?: ViewData): ViewInstance;
//#endregion
//#region src/packageViews.d.ts
type PackageViewReference = {
source: string;
packageName: string;
nodePackageName: string;
diskName: string;
viewName: string;
edgeName: string;
};
declare const parsePackageViewName: (name: string) => PackageViewReference | null;
declare const resolvePackageViewsPath: (nodePackageName: string, viewPath?: string) => string;
//#endregion
//#region src/vite.d.ts
interface ViteTagOptions {
/** Force development (Vite dev server) tags regardless of `NODE_ENV`. */
hot?: boolean;
/** Vite dev server URL. Defaults to `VITE_DEV_URL` or `http://localhost:5173`. */
devUrl?: string;
/** Path to the Vite build manifest. Defaults to `public/build/.vite/manifest.json`. */
manifest?: string;
/** Public URL prefix the built assets are served from. Defaults to `/build/`. */
buildDir?: string;
}
/**
* Resolve `