@hyperbook/types 0.3.0 → 0.5.0

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.
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../src/index.ts"],
4
- "sourcesContent": ["type ElementConfig = {\n version?: string;\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 Language = \"de\" | \"en\" | \"fr\" | \"es\" | \"it\" | \"pt\" | \"nl\";\n\nexport type HyperbookJson = {\n name: string;\n description?: string;\n logo?: string;\n author?: {\n name?: string;\n url?: string;\n };\n font?: string;\n fonts?: {\n heading?: string;\n body?: string;\n code?: string;\n };\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?: string;\n links?: Link[];\n template?: string;\n elements?: {\n bookmarks?: false | ElementConfig;\n excalidraw?: ElementConfig & {\n autoZoom?: boolean;\n center?: boolean;\n aspectRation?: string;\n edit?: boolean;\n };\n };\n};\n\nexport type LanguageString = 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"],
4
+ "sourcesContent": ["type ElementConfig = {\n version?: string;\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};\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 HyperbookPageFrontmatter = {\n name: string;\n lang?: Language;\n description?: string;\n keywords?: string[];\n index?: number;\n hide?: boolean;\n toc?: boolean;\n};\n\nexport type HyperbookSectionFrontmatter = HyperbookPageFrontmatter & {\n virtual?: boolean;\n expanded?: boolean;\n};\n\nexport type HyperbookPage = HyperbookPageFrontmatter & {\n isEmpty?: boolean;\n href?: string;\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 author?: {\n name?: string;\n url?: string;\n };\n font?: string;\n fonts?: {\n heading?: string;\n body?: string;\n code?: string;\n };\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 template?: string;\n elements?: {\n bookmarks?: false | ElementConfig;\n excalidraw?: ElementConfig & {\n autoZoom?: boolean;\n center?: boolean;\n aspectRation?: string;\n edit?: boolean;\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"],
5
5
  "mappings": ";;;;;;;;;;;;;;;;AAAA;AAAA;",
6
6
  "names": []
7
7
  }
package/dist/index.d.ts CHANGED
@@ -1,19 +1,57 @@
1
- declare type ElementConfig = {
1
+ type ElementConfig = {
2
2
  version?: string;
3
3
  };
4
- export declare type LinkWithLinks = {
4
+ export type LinkWithLinks = {
5
5
  label: string;
6
6
  icon?: string;
7
7
  links: Link[];
8
8
  };
9
- export declare type LinkWithHref = {
9
+ export type LinkWithHref = {
10
10
  label: string;
11
11
  icon?: string;
12
12
  href: string;
13
13
  };
14
- export declare type Link = LinkWithHref | LinkWithLinks;
15
- export declare type Language = "de" | "en" | "fr" | "es" | "it" | "pt" | "nl";
16
- export declare type HyperbookJson = {
14
+ export type Link = LinkWithHref | LinkWithLinks;
15
+ export type Navigation = {
16
+ next: HyperbookPage | null;
17
+ previous: HyperbookPage | null;
18
+ current: HyperbookPage | null;
19
+ pages: HyperbookPage[];
20
+ sections: HyperbookSection[];
21
+ };
22
+ export type Term = {
23
+ name: string;
24
+ href: string;
25
+ };
26
+ export type Glossary = Record<string, Term[]>;
27
+ export type Language = "de" | "en" | "fr" | "es" | "it" | "pt" | "nl";
28
+ export type HyperbookPageFrontmatter = {
29
+ name: string;
30
+ lang?: Language;
31
+ description?: string;
32
+ keywords?: string[];
33
+ index?: number;
34
+ hide?: boolean;
35
+ toc?: boolean;
36
+ };
37
+ export type HyperbookSectionFrontmatter = HyperbookPageFrontmatter & {
38
+ virtual?: boolean;
39
+ expanded?: boolean;
40
+ };
41
+ export type HyperbookPage = HyperbookPageFrontmatter & {
42
+ isEmpty?: boolean;
43
+ href?: string;
44
+ repo?: string;
45
+ };
46
+ export type HyperbookSection = HyperbookSectionFrontmatter & {
47
+ isEmpty?: boolean;
48
+ href?: string;
49
+ pages: HyperbookPage[];
50
+ sections: HyperbookSection[];
51
+ repo?: string;
52
+ };
53
+ export type HyperbookFrontmatter = HyperbookPageFrontmatter | HyperbookSectionFrontmatter;
54
+ export type HyperbookJson = {
17
55
  name: string;
18
56
  description?: string;
19
57
  logo?: string;
@@ -45,7 +83,10 @@ export declare type HyperbookJson = {
45
83
  basePath?: string;
46
84
  license?: string;
47
85
  language?: Language;
48
- repo?: string;
86
+ repo?: string | {
87
+ url: string;
88
+ label: string;
89
+ };
49
90
  links?: Link[];
50
91
  template?: string;
51
92
  elements?: {
@@ -58,8 +99,8 @@ export declare type HyperbookJson = {
58
99
  };
59
100
  };
60
101
  };
61
- export declare type LanguageString = Record<Language, string>;
62
- export declare type HyperlibraryJson = {
102
+ export type LanguageString = Partial<Record<Language, string>>;
103
+ export type HyperlibraryJson = {
63
104
  name: string | LanguageString;
64
105
  library: {
65
106
  src: string;
@@ -69,4 +110,15 @@ export declare type HyperlibraryJson = {
69
110
  }[];
70
111
  basePath?: string;
71
112
  };
113
+ export type Hyperproject = {
114
+ name: string | LanguageString;
115
+ basePath?: string;
116
+ icon?: string;
117
+ src: string;
118
+ } & ({
119
+ type: "book";
120
+ } | {
121
+ type: "library";
122
+ projects: Hyperproject[];
123
+ });
72
124
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hyperbook/types",
3
- "version": "0.3.0",
3
+ "version": "0.5.0",
4
4
  "author": "Mike Barkmin",
5
5
  "homepage": "https://github.com/openpatch/hyperbook#readme",
6
6
  "license": "MIT",