@hyperbook/types 0.23.1 → 0.23.2

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
@@ -169,6 +169,16 @@ export type HyperbookJson = {
169
169
  db?: string;
170
170
  height?: string | number;
171
171
  };
172
+ emoji?: ElementConfig & {
173
+ /**
174
+ * How emojis are rendered.
175
+ * - "native": Emojis are kept as text and drawn with the emoji font of
176
+ * the reader's operating system (default).
177
+ * - "twemoji": Emojis are replaced with Twemoji images, so they look the
178
+ * same on every platform.
179
+ */
180
+ style?: "native" | "twemoji";
181
+ };
172
182
  };
173
183
  };
174
184
  export type LanguageString = Partial<Record<Language, string>>;
@@ -210,4 +220,10 @@ export interface HyperbookContext {
210
220
  */
211
221
  dependencies?: Set<string>;
212
222
  }
223
+ /**
224
+ * Checks whether a path is an absolute URL and therefore must be passed
225
+ * through untouched by `makeUrl`, instead of being resolved against the
226
+ * hyperbook's base path.
227
+ */
228
+ export declare const isExternalUrl: (path: string) => boolean;
213
229
  export {};
package/dist/index.js CHANGED
@@ -1 +1,7 @@
1
+ // src/index.ts
2
+ var URL_SCHEME = /^[a-zA-Z][a-zA-Z0-9+.-]*:/;
3
+ var isExternalUrl = (path) => URL_SCHEME.test(path);
4
+ export {
5
+ isExternalUrl
6
+ };
1
7
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": [],
4
- "sourcesContent": [],
5
- "mappings": "",
3
+ "sources": ["../src/index.ts"],
4
+ "sourcesContent": ["type ElementConfig = {\n version?: string;\n};\n\nexport type Script =\n | string\n | {\n type?: \"module\" | \"plain/text\";\n src: string;\n crossorigin?: boolean;\n position: \"head\" | \"body\";\n versioned?: boolean;\n };\n\nexport type LinkWithLinks = {\n label: string;\n icon?: string;\n links: Link[];\n};\n\nexport type LinkWithHref = {\n label: string;\n icon?: string;\n href: string;\n};\n\nexport type Link = LinkWithHref | LinkWithLinks;\n\nexport type Navigation = {\n next: HyperbookPage | null;\n previous: HyperbookPage | null;\n current: HyperbookPage | null;\n pages: HyperbookPage[];\n sections: HyperbookSection[];\n glossary: HyperbookPage[];\n};\n\nexport type Term = {\n name: string;\n href: string;\n};\n\nexport type Glossary = Record<string, Term[]>;\n\nexport type Language = \"de\" | \"en\" | \"fr\" | \"es\" | \"it\" | \"pt\" | \"nl\";\n\nexport type Layout = \"default\" | \"wide\" | \"standalone\";\n\nexport type BreadcrumbConfig = {\n home?: string;\n separator?: string;\n};\n\nexport type PageNavigation = \"default\" | \"hidden\";\n\nexport type SectionNavigation =\n | \"default\"\n | \"hidden\"\n | \"virtual\"\n | \"page\"\n | \"expanded\";\n\nexport type HyperbookPageFrontmatter = {\n name: string;\n title?: string;\n permaid?: string;\n lang?: Language;\n qrcode?: boolean;\n description?: string;\n keywords?: string[];\n scripts?: string[];\n styles?: string[];\n index?: number;\n hide?: boolean;\n toc?: boolean;\n next?: string;\n prev?: string;\n layout?: Layout;\n breadcrumb?: boolean | BreadcrumbConfig;\n navigation?: PageNavigation;\n};\n\nexport type HyperbookSectionFrontmatter = Omit<\n HyperbookPageFrontmatter,\n \"navigation\"\n> & {\n virtual?: boolean;\n expanded?: boolean;\n navigation?: SectionNavigation;\n};\n\nexport type HyperbookPage = HyperbookPageFrontmatter & {\n isEmpty?: boolean;\n href?: string;\n path?: {\n directory: string;\n relative: string;\n absolute: string;\n href: string | null;\n permalink: string | null;\n };\n repo?: string;\n};\n\nexport type HyperbookSection = HyperbookSectionFrontmatter & {\n isEmpty?: boolean;\n href?: string;\n pages: HyperbookPage[];\n sections: HyperbookSection[];\n repo?: string;\n};\n\nexport type HyperbookFrontmatter =\n | HyperbookPageFrontmatter\n | HyperbookSectionFrontmatter;\n\nexport type HyperbookJson = {\n name: string;\n description?: string;\n logo?: string;\n allowDangerousHtml?: boolean;\n trailingSlash?: boolean;\n importExport?: boolean;\n search?: boolean;\n qrcode?: boolean;\n toc?: boolean;\n llms?: boolean;\n breadcrumb?: boolean | BreadcrumbConfig;\n author?: {\n name?: string;\n url?: string;\n };\n /**\n * Controls how the Hyperbook version is displayed.\n * - \"text\": Shows version below the \"Powered by Hyperbook\" label.\n * - \"tooltip\": Shows version on hover of the \"Powered by Hyperbook\" label.\n * - \"console\": Outputs version as ASCII art in the browser console (default).\n */\n version?: \"text\" | \"tooltip\" | \"console\";\n font?: string;\n fonts?: {\n heading?: string;\n body?: string;\n code?: string;\n };\n scripts?: string[];\n styles?: string[];\n colors?: {\n /**\n * @format color-hex\n */\n brand?: string;\n /**\n * @format color-hex\n */\n brandDark?: string;\n /**\n * @format color-hex\n */\n brandText?: string;\n inverted?: boolean;\n };\n basePath?: string;\n license?: string;\n language?: Language;\n repo?:\n | string\n | {\n url: string;\n label: string;\n };\n links?: Link[];\n cloud?: {\n url: string;\n id: string;\n };\n elements?: {\n bookmarks?: false | ElementConfig;\n code?: ElementConfig & {\n theme?:\n | {\n dark: string;\n light: string;\n }\n | string;\n bypassInline?: boolean;\n showLineNumbers?: boolean;\n };\n excalidraw?: ElementConfig & {\n autoZoom?: boolean;\n center?: boolean;\n aspectRatio?: string;\n edit?: boolean;\n };\n onlineide?: ElementConfig & {\n height?: string | number;\n };\n kirimoto?: ElementConfig & {\n height?: string;\n settings?: string;\n };\n sqlide?: ElementConfig & {\n db?: string;\n height?: string | number;\n };\n emoji?: ElementConfig & {\n /**\n * How emojis are rendered.\n * - \"native\": Emojis are kept as text and drawn with the emoji font of\n * the reader's operating system (default).\n * - \"twemoji\": Emojis are replaced with Twemoji images, so they look the\n * same on every platform.\n */\n style?: \"native\" | \"twemoji\";\n };\n };\n};\n\nexport type LanguageString = Partial<Record<Language, string>>;\n\nexport type HyperlibraryJson = {\n name: string | LanguageString;\n library: {\n src: string;\n basePath: string;\n icon?: string;\n name?: string | LanguageString;\n }[];\n basePath?: string;\n};\n\nexport type Hyperproject = {\n name: string | LanguageString;\n basePath?: string;\n icon?: string;\n src: string;\n} & ({ type: \"book\" } | { type: \"library\"; projects: Hyperproject[] });\n\nexport interface HyperbookContext {\n root: string;\n config: HyperbookJson;\n library?: HyperlibraryJson;\n project?: Hyperproject;\n version?: string;\n makeUrl(\n path: string | string[],\n base: \"public\" | \"book\" | \"archive\" | \"glossary\" | \"assets\",\n page?: HyperbookPage,\n options?: {\n versioned?: boolean;\n },\n ): string;\n navigation: Navigation;\n /**\n * Collects absolute paths of files inlined into the page while it is being\n * processed, so the dev server can rebuild exactly the pages that used them.\n * Only set during a build that tracks dependencies.\n */\n dependencies?: Set<string>;\n}\n\n/**\n * Matches a URI scheme at the start of a string, as defined by RFC 3986.\n * This covers `https://` and `data:` as well as schemes without an authority\n * like `mailto:`, `tel:` or `sms:`.\n */\nconst URL_SCHEME = /^[a-zA-Z][a-zA-Z0-9+.-]*:/;\n\n/**\n * Checks whether a path is an absolute URL and therefore must be passed\n * through untouched by `makeUrl`, instead of being resolved against the\n * hyperbook's base path.\n */\nexport const isExternalUrl = (path: string): boolean => URL_SCHEME.test(path);\n"],
5
+ "mappings": ";AA0QA,IAAM,aAAa;AAOZ,IAAM,gBAAgB,CAAC,SAA0B,WAAW,KAAK,IAAI;",
6
6
  "names": []
7
7
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hyperbook/types",
3
- "version": "0.23.1",
3
+ "version": "0.23.2",
4
4
  "author": "Mike Barkmin",
5
5
  "homepage": "https://github.com/openpatch/hyperbook#readme",
6
6
  "license": "MIT",