From 2882b9deb693053bccc36e166f42932f9cc65bbf Mon Sep 17 00:00:00 2001 From: Nikola Hristov Date: Fri, 29 Nov 2024 08:11:41 +0200 Subject: [PATCH] --- .astro/astro/content.d.ts | 183 -------------------------------------- .astro/content.d.ts | 19 ++++ Source/Script/Index.ts | 39 -------- 3 files changed, 19 insertions(+), 222 deletions(-) diff --git a/.astro/astro/content.d.ts b/.astro/astro/content.d.ts index 2badc4f3..e69de29b 100644 --- a/.astro/astro/content.d.ts +++ b/.astro/astro/content.d.ts @@ -1,183 +0,0 @@ -declare module 'astro:content' { - interface RenderResult { - Content: import('astro/runtime/server/index.js').AstroComponentFactory; - headings: import('astro').MarkdownHeading[]; - remarkPluginFrontmatter: Record; - } - interface Render { - '.md': Promise; - } - - export interface RenderedContent { - html: string; - metadata?: { - imagePaths: Array; - [key: string]: unknown; - }; - } -} - -declare module 'astro:content' { - type Flatten = T extends { [K: string]: infer U } ? U : never; - - export type CollectionKey = keyof AnyEntryMap; - - export type CollectionEntry = Flatten; - - export type ContentCollectionKey = keyof ContentEntryMap; - - export type DataCollectionKey = keyof DataEntryMap; - - type AllValuesOf = T extends any ? T[keyof T] : never; - type ValidContentEntrySlug = AllValuesOf< - ContentEntryMap[C] - >['slug']; - - /** @deprecated Use `getEntry` instead. */ - export function getEntryBySlug< - C extends keyof ContentEntryMap, - E extends ValidContentEntrySlug | (string & {}), - >( - collection: C, - // Note that this has to accept a regular string too, for SSR - entrySlug: E, - ): E extends ValidContentEntrySlug - ? Promise> - : Promise | undefined>; - - /** @deprecated Use `getEntry` instead. */ - export function getDataEntryById( - collection: C, - entryId: E, - ): Promise>; - - export function getCollection>( - collection: C, - filter?: (entry: CollectionEntry) => entry is E, - ): Promise; - - export function getCollection( - collection: C, - filter?: (entry: CollectionEntry) => unknown, - ): Promise[]>; - - export function getEntry< - C extends keyof ContentEntryMap, - E extends ValidContentEntrySlug | (string & {}), - >(entry: { - collection: C; - slug: E; - }): E extends ValidContentEntrySlug - ? Promise> - : Promise | undefined>; - - export function getEntry< - C extends keyof DataEntryMap, - E extends keyof DataEntryMap[C] | (string & {}), - >(entry: { - collection: C; - id: E; - }): E extends keyof DataEntryMap[C] - ? Promise - : Promise | undefined>; - - export function getEntry< - C extends keyof ContentEntryMap, - E extends ValidContentEntrySlug | (string & {}), - >( - collection: C, - slug: E, - ): E extends ValidContentEntrySlug - ? Promise> - : Promise | undefined>; - - export function getEntry< - C extends keyof DataEntryMap, - E extends keyof DataEntryMap[C] | (string & {}), - >( - collection: C, - id: E, - ): E extends keyof DataEntryMap[C] - ? Promise - : Promise | undefined>; - - /** Resolve an array of entry references from the same collection */ - export function getEntries( - entries: { - collection: C; - slug: ValidContentEntrySlug; - }[], - ): Promise[]>; - - export function getEntries( - entries: { - collection: C; - id: keyof DataEntryMap[C]; - }[], - ): Promise[]>; - - export function render( - entry: AnyEntryMap[C][string], - ): Promise; - - export function reference( - collection: C, - ): import('astro/zod').ZodEffects< - import('astro/zod').ZodString, - C extends keyof ContentEntryMap - ? { - collection: C; - slug: ValidContentEntrySlug; - } - : { - collection: C; - id: keyof DataEntryMap[C]; - } - >; - // Allow generic `string` to avoid excessive type errors in the config - // if `dev` is not running to update as you edit. - // Invalid collection names will be caught at build time. - export function reference( - collection: C, - ): import('astro/zod').ZodEffects; - - type ReturnTypeOrOriginal = T extends (...args: any[]) => infer R ? R : T; - type InferEntrySchema = import('astro/zod').infer< - ReturnTypeOrOriginal['schema']> - >; - - type ContentEntryMap = { - "en": { -"personal-data-protection-policy.md": { - id: "personal-data-protection-policy.md"; - slug: "personal-data-protection-policy"; - body: string; - collection: "en"; - data: any -} & { render(): Render[".md"] }; -"privacy-policy.md": { - id: "privacy-policy.md"; - slug: "privacy-policy"; - body: string; - collection: "en"; - data: any -} & { render(): Render[".md"] }; -"terms-of-service.md": { - id: "terms-of-service.md"; - slug: "terms-of-service"; - body: string; - collection: "en"; - data: any -} & { render(): Render[".md"] }; -}; - - }; - - type DataEntryMap = { - - }; - - type AnyEntryMap = ContentEntryMap & DataEntryMap; - - export type ContentConfig = never; -} diff --git a/.astro/content.d.ts b/.astro/content.d.ts index 9851826f..adf9b901 100644 --- a/.astro/content.d.ts +++ b/.astro/content.d.ts @@ -1,15 +1,19 @@ declare module 'astro:content' { export interface RenderResult { Content: import('astro/runtime/server/index.js').AstroComponentFactory; + headings: import('astro').MarkdownHeading[]; + remarkPluginFrontmatter: Record; } + interface Render { '.md': Promise; } export interface RenderedContent { html: string; + metadata?: { imagePaths: Array; [key: string]: unknown; @@ -21,12 +25,15 @@ declare module 'astro:content' { type Flatten = T extends { [K: string]: infer U } ? U : never; export type CollectionKey = keyof AnyEntryMap; + export type CollectionEntry = Flatten; export type ContentCollectionKey = keyof ContentEntryMap; + export type DataCollectionKey = keyof DataEntryMap; type AllValuesOf = T extends any ? T[keyof T] : never; + type ValidContentEntrySlug = AllValuesOf< ContentEntryMap[C] >['slug']; @@ -53,6 +60,7 @@ declare module 'astro:content' { collection: C, filter?: (entry: CollectionEntry) => entry is E, ): Promise; + export function getCollection( collection: C, filter?: (entry: CollectionEntry) => unknown, @@ -63,19 +71,23 @@ declare module 'astro:content' { E extends ValidContentEntrySlug | (string & {}), >(entry: { collection: C; + slug: E; }): E extends ValidContentEntrySlug ? Promise> : Promise | undefined>; + export function getEntry< C extends keyof DataEntryMap, E extends keyof DataEntryMap[C] | (string & {}), >(entry: { collection: C; + id: E; }): E extends keyof DataEntryMap[C] ? Promise : Promise | undefined>; + export function getEntry< C extends keyof ContentEntryMap, E extends ValidContentEntrySlug | (string & {}), @@ -85,6 +97,7 @@ declare module 'astro:content' { ): E extends ValidContentEntrySlug ? Promise> : Promise | undefined>; + export function getEntry< C extends keyof DataEntryMap, E extends keyof DataEntryMap[C] | (string & {}), @@ -99,12 +112,15 @@ declare module 'astro:content' { export function getEntries( entries: { collection: C; + slug: ValidContentEntrySlug; }[], ): Promise[]>; + export function getEntries( entries: { collection: C; + id: keyof DataEntryMap[C]; }[], ): Promise[]>; @@ -120,10 +136,12 @@ declare module 'astro:content' { C extends keyof ContentEntryMap ? { collection: C; + slug: ValidContentEntrySlug; } : { collection: C; + id: keyof DataEntryMap[C]; } >; @@ -135,6 +153,7 @@ declare module 'astro:content' { ): import('astro/zod').ZodEffects; type ReturnTypeOrOriginal = T extends (...args: any[]) => infer R ? R : T; + type InferEntrySchema = import('astro/zod').infer< ReturnTypeOrOriginal['schema']> >; diff --git a/Source/Script/Index.ts b/Source/Script/Index.ts index 917b265c..e69de29b 100644 --- a/Source/Script/Index.ts +++ b/Source/Script/Index.ts @@ -1,39 +0,0 @@ -const Debounce = (_Function: any, Delay: number) => { - let Timer = null; - - return function (...Argument) { - if (Timer) { - clearTimeout(Timer); - } - - Timer = setTimeout(() => { - _Function.apply(this, Argument); - Timer = null; - }, Delay); - }; -}; - -const Spinner = document.querySelector("#mce-spinner"); - -document.querySelector("#mce-EMAIL")?.addEventListener( - "input", - Debounce(({ target }: InputEvent) => { - Spinner?.classList.add("hidden"); - - /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(target?.value) - ? document - .querySelector( - '[name="mc-embedded-subscribe-form"]', - ) - ?.submit() - : null; - }, 5000), -); - -document.querySelector("#mce-EMAIL")?.addEventListener( - "input", - Debounce( - ({ target }: InputEvent) => Spinner?.classList.remove("hidden"), - 4000, - ), -);