@clepit/core 0.2.0-beta.322

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.
Files changed (188) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/LICENSE +21 -0
  3. package/README.md +79 -0
  4. package/dist/core/editor/action-bar/css.d.ts +3 -0
  5. package/dist/core/editor/action-bar/index.d.ts +18 -0
  6. package/dist/core/editor/css.d.ts +3 -0
  7. package/dist/core/editor/index.d.ts +18 -0
  8. package/dist/core/editor/views/edit.d.ts +4 -0
  9. package/dist/core/editor/views/index.d.ts +4 -0
  10. package/dist/core/editor/views/json.d.ts +9 -0
  11. package/dist/core/editor/views/preview.d.ts +4 -0
  12. package/dist/core/element/index.d.ts +101 -0
  13. package/dist/core/i18n/index.d.ts +43 -0
  14. package/dist/core/managers/block/css.d.ts +3 -0
  15. package/dist/core/managers/block/index.d.ts +40 -0
  16. package/dist/core/managers/event.d.ts +13 -0
  17. package/dist/core/managers/style.d.ts +181 -0
  18. package/dist/core/renderer/draw.d.ts +27 -0
  19. package/dist/core/renderer/index.d.ts +15 -0
  20. package/dist/core/renderer/invalid-data.d.ts +4 -0
  21. package/dist/core/renderer/page.d.ts +37 -0
  22. package/dist/core/store.d.ts +42 -0
  23. package/dist/core/theme/css.d.ts +4 -0
  24. package/dist/core/theme/index.d.ts +42 -0
  25. package/dist/core/toolbars/block/css.d.ts +3 -0
  26. package/dist/core/toolbars/block/index.d.ts +38 -0
  27. package/dist/core/toolbars/inline/css.d.ts +6 -0
  28. package/dist/core/toolbars/inline/index.d.ts +43 -0
  29. package/dist/index.d.ts +12 -0
  30. package/dist/index.js +2 -0
  31. package/dist/index.mjs +2 -0
  32. package/dist/tools/block/alert/css.d.ts +5 -0
  33. package/dist/tools/block/alert/index.d.ts +13 -0
  34. package/dist/tools/block/alert/input.d.ts +13 -0
  35. package/dist/tools/block/alert/output.d.ts +9 -0
  36. package/dist/tools/block/audio/css.d.ts +5 -0
  37. package/dist/tools/block/audio/index.d.ts +13 -0
  38. package/dist/tools/block/audio/input.d.ts +22 -0
  39. package/dist/tools/block/audio/output.d.ts +9 -0
  40. package/dist/tools/block/checklist/css.d.ts +5 -0
  41. package/dist/tools/block/checklist/index.d.ts +13 -0
  42. package/dist/tools/block/checklist/input.d.ts +14 -0
  43. package/dist/tools/block/checklist/output.d.ts +9 -0
  44. package/dist/tools/block/code/css.d.ts +5 -0
  45. package/dist/tools/block/code/grammar/engine.d.ts +52 -0
  46. package/dist/tools/block/code/grammar/languages.d.ts +6 -0
  47. package/dist/tools/block/code/highlight.d.ts +22 -0
  48. package/dist/tools/block/code/index.d.ts +13 -0
  49. package/dist/tools/block/code/input.d.ts +57 -0
  50. package/dist/tools/block/code/loaders/language.d.ts +17 -0
  51. package/dist/tools/block/code/loaders/theme.d.ts +21 -0
  52. package/dist/tools/block/code/output.d.ts +32 -0
  53. package/dist/tools/block/code/theme-css.d.ts +14 -0
  54. package/dist/tools/block/code/theme-generator.d.ts +27 -0
  55. package/dist/tools/block/code/variants.d.ts +14 -0
  56. package/dist/tools/block/collapsible/css.d.ts +6 -0
  57. package/dist/tools/block/collapsible/index.d.ts +13 -0
  58. package/dist/tools/block/collapsible/input.d.ts +13 -0
  59. package/dist/tools/block/collapsible/output.d.ts +16 -0
  60. package/dist/tools/block/collection/css.d.ts +6 -0
  61. package/dist/tools/block/collection/index.d.ts +13 -0
  62. package/dist/tools/block/collection/input.d.ts +11 -0
  63. package/dist/tools/block/collection/output.d.ts +12 -0
  64. package/dist/tools/block/columns/css.d.ts +6 -0
  65. package/dist/tools/block/columns/index.d.ts +13 -0
  66. package/dist/tools/block/columns/input.d.ts +12 -0
  67. package/dist/tools/block/columns/output.d.ts +11 -0
  68. package/dist/tools/block/date/css.d.ts +6 -0
  69. package/dist/tools/block/date/index.d.ts +13 -0
  70. package/dist/tools/block/date/input.d.ts +12 -0
  71. package/dist/tools/block/date/output.d.ts +10 -0
  72. package/dist/tools/block/delimiter/css.d.ts +5 -0
  73. package/dist/tools/block/delimiter/index.d.ts +13 -0
  74. package/dist/tools/block/delimiter/input.d.ts +12 -0
  75. package/dist/tools/block/delimiter/output.d.ts +9 -0
  76. package/dist/tools/block/doc-card/css.d.ts +6 -0
  77. package/dist/tools/block/doc-card/index.d.ts +13 -0
  78. package/dist/tools/block/doc-card/input.d.ts +11 -0
  79. package/dist/tools/block/doc-card/output.d.ts +11 -0
  80. package/dist/tools/block/embed/css.d.ts +6 -0
  81. package/dist/tools/block/embed/index.d.ts +13 -0
  82. package/dist/tools/block/embed/input.d.ts +11 -0
  83. package/dist/tools/block/embed/output.d.ts +23 -0
  84. package/dist/tools/block/embed/providers.d.ts +5 -0
  85. package/dist/tools/block/file/css.d.ts +6 -0
  86. package/dist/tools/block/file/index.d.ts +13 -0
  87. package/dist/tools/block/file/input.d.ts +14 -0
  88. package/dist/tools/block/file/output.d.ts +10 -0
  89. package/dist/tools/block/glance/css.d.ts +5 -0
  90. package/dist/tools/block/glance/index.d.ts +13 -0
  91. package/dist/tools/block/glance/input.d.ts +11 -0
  92. package/dist/tools/block/glance/output.d.ts +18 -0
  93. package/dist/tools/block/header/css.d.ts +5 -0
  94. package/dist/tools/block/header/index.d.ts +13 -0
  95. package/dist/tools/block/header/input.d.ts +13 -0
  96. package/dist/tools/block/header/output.d.ts +9 -0
  97. package/dist/tools/block/image/css.d.ts +5 -0
  98. package/dist/tools/block/image/index.d.ts +13 -0
  99. package/dist/tools/block/image/input.d.ts +22 -0
  100. package/dist/tools/block/image/output.d.ts +9 -0
  101. package/dist/tools/block/list/css.d.ts +5 -0
  102. package/dist/tools/block/list/index.d.ts +13 -0
  103. package/dist/tools/block/list/input.d.ts +16 -0
  104. package/dist/tools/block/list/output.d.ts +9 -0
  105. package/dist/tools/block/openapi/css.d.ts +5 -0
  106. package/dist/tools/block/openapi/index.d.ts +13 -0
  107. package/dist/tools/block/openapi/input.d.ts +11 -0
  108. package/dist/tools/block/openapi/output.d.ts +24 -0
  109. package/dist/tools/block/openapi/schema.d.ts +17 -0
  110. package/dist/tools/block/openapi/snippets.d.ts +5 -0
  111. package/dist/tools/block/openapi/spec.d.ts +46 -0
  112. package/dist/tools/block/paragraph/css.d.ts +5 -0
  113. package/dist/tools/block/paragraph/index.d.ts +13 -0
  114. package/dist/tools/block/paragraph/input.d.ts +12 -0
  115. package/dist/tools/block/paragraph/output.d.ts +13 -0
  116. package/dist/tools/block/quote/css.d.ts +5 -0
  117. package/dist/tools/block/quote/index.d.ts +13 -0
  118. package/dist/tools/block/quote/input.d.ts +15 -0
  119. package/dist/tools/block/quote/output.d.ts +14 -0
  120. package/dist/tools/block/sketch/css.d.ts +6 -0
  121. package/dist/tools/block/sketch/index.d.ts +13 -0
  122. package/dist/tools/block/sketch/input.d.ts +14 -0
  123. package/dist/tools/block/sketch/output.d.ts +16 -0
  124. package/dist/tools/block/table/css.d.ts +5 -0
  125. package/dist/tools/block/table/index.d.ts +13 -0
  126. package/dist/tools/block/table/input.d.ts +28 -0
  127. package/dist/tools/block/table/output.d.ts +28 -0
  128. package/dist/tools/block/toc/css.d.ts +6 -0
  129. package/dist/tools/block/toc/index.d.ts +13 -0
  130. package/dist/tools/block/toc/input.d.ts +11 -0
  131. package/dist/tools/block/toc/output.d.ts +18 -0
  132. package/dist/tools/block/typeset/css.d.ts +6 -0
  133. package/dist/tools/block/typeset/index.d.ts +22 -0
  134. package/dist/tools/block/typeset/input.d.ts +18 -0
  135. package/dist/tools/block/typeset/latex/layout.d.ts +32 -0
  136. package/dist/tools/block/typeset/latex/model.d.ts +64 -0
  137. package/dist/tools/block/typeset/latex/parse.d.ts +3 -0
  138. package/dist/tools/block/typeset/latex/render.d.ts +7 -0
  139. package/dist/tools/block/typeset/latex/symbols.d.ts +26 -0
  140. package/dist/tools/block/typeset/mermaid/layout.d.ts +71 -0
  141. package/dist/tools/block/typeset/mermaid/model.d.ts +78 -0
  142. package/dist/tools/block/typeset/mermaid/parse.d.ts +3 -0
  143. package/dist/tools/block/typeset/mermaid/render.d.ts +7 -0
  144. package/dist/tools/block/typeset/output.d.ts +46 -0
  145. package/dist/tools/block/updates/css.d.ts +6 -0
  146. package/dist/tools/block/updates/index.d.ts +13 -0
  147. package/dist/tools/block/updates/input.d.ts +14 -0
  148. package/dist/tools/block/updates/output.d.ts +19 -0
  149. package/dist/tools/block/video/css.d.ts +5 -0
  150. package/dist/tools/block/video/index.d.ts +13 -0
  151. package/dist/tools/block/video/input.d.ts +22 -0
  152. package/dist/tools/block/video/output.d.ts +9 -0
  153. package/dist/tools/index.d.ts +3 -0
  154. package/dist/tools/inline/bold/css.d.ts +3 -0
  155. package/dist/tools/inline/bold/index.d.ts +10 -0
  156. package/dist/tools/inline/code/css.d.ts +3 -0
  157. package/dist/tools/inline/code/index.d.ts +12 -0
  158. package/dist/tools/inline/italic/css.d.ts +3 -0
  159. package/dist/tools/inline/italic/index.d.ts +10 -0
  160. package/dist/tools/inline/link/css.d.ts +3 -0
  161. package/dist/tools/inline/link/dialog.d.ts +31 -0
  162. package/dist/tools/inline/link/index.d.ts +11 -0
  163. package/dist/tools/inline/marker/css.d.ts +3 -0
  164. package/dist/tools/inline/marker/index.d.ts +16 -0
  165. package/dist/tools/inline/mention/css.d.ts +3 -0
  166. package/dist/tools/inline/mention/index.d.ts +10 -0
  167. package/dist/tools/inline/status/css.d.ts +3 -0
  168. package/dist/tools/inline/status/dialog.d.ts +30 -0
  169. package/dist/tools/inline/status/index.d.ts +12 -0
  170. package/dist/tools/inline/strikethrough/css.d.ts +3 -0
  171. package/dist/tools/inline/strikethrough/index.d.ts +10 -0
  172. package/dist/tools/inline/tooltip/css.d.ts +3 -0
  173. package/dist/tools/inline/tooltip/dialog.d.ts +52 -0
  174. package/dist/tools/inline/tooltip/index.d.ts +21 -0
  175. package/dist/tools/inline/underline/css.d.ts +3 -0
  176. package/dist/tools/inline/underline/index.d.ts +10 -0
  177. package/dist/types.d.ts +947 -0
  178. package/dist/utils/dialogs/css.d.ts +3 -0
  179. package/dist/utils/dom.d.ts +20 -0
  180. package/dist/utils/icons.d.ts +7 -0
  181. package/dist/utils/platform.d.ts +82 -0
  182. package/dist/utils/sanitize-html-nodom.d.ts +2 -0
  183. package/dist/utils/switch/css.d.ts +3 -0
  184. package/dist/utils/switch/index.d.ts +30 -0
  185. package/dist/utils/tooltip/css.d.ts +3 -0
  186. package/dist/utils/tooltip/index.d.ts +4 -0
  187. package/dist/utils/url.d.ts +52 -0
  188. package/package.json +66 -0
@@ -0,0 +1,947 @@
1
+ import { Override, Prettify } from '@bomdisoft/typescript-config/types';
2
+ import { ThemeTokens } from './core/theme';
3
+ import { AlertInput } from './tools/block/alert/input';
4
+ import { AlertOutput } from './tools/block/alert/output';
5
+ import { AudioInput } from './tools/block/audio/input';
6
+ import { AudioOutput } from './tools/block/audio/output';
7
+ import { ChecklistInput } from './tools/block/checklist/input';
8
+ import { ChecklistOutput } from './tools/block/checklist/output';
9
+ import { CodeInput } from './tools/block/code/input';
10
+ import { CodeOutput } from './tools/block/code/output';
11
+ import { CollapsibleInput } from './tools/block/collapsible/input';
12
+ import { CollapsibleOutput } from './tools/block/collapsible/output';
13
+ import { CollectionInput } from './tools/block/collection/input';
14
+ import { CollectionOutput } from './tools/block/collection/output';
15
+ import { ColumnsInput } from './tools/block/columns/input';
16
+ import { ColumnsOutput } from './tools/block/columns/output';
17
+ import { DateInput } from './tools/block/date/input';
18
+ import { DateOutput } from './tools/block/date/output';
19
+ import { DelimiterInput } from './tools/block/delimiter/input';
20
+ import { DelimiterOutput } from './tools/block/delimiter/output';
21
+ import { DocCardInput } from './tools/block/doc-card/input';
22
+ import { DocCardOutput } from './tools/block/doc-card/output';
23
+ import { EmbedInput } from './tools/block/embed/input';
24
+ import { EmbedOutput } from './tools/block/embed/output';
25
+ import { FileInput } from './tools/block/file/input';
26
+ import { FileOutput } from './tools/block/file/output';
27
+ import { GlanceInput } from './tools/block/glance/input';
28
+ import { GlanceOutput } from './tools/block/glance/output';
29
+ import { HeaderInput } from './tools/block/header/input';
30
+ import { HeaderOutput } from './tools/block/header/output';
31
+ import { ImageInput } from './tools/block/image/input';
32
+ import { ImageOutput } from './tools/block/image/output';
33
+ import { ListInput } from './tools/block/list/input';
34
+ import { ListOutput } from './tools/block/list/output';
35
+ import { OpenApiInput } from './tools/block/openapi/input';
36
+ import { OpenApiOutput } from './tools/block/openapi/output';
37
+ import { ParagraphInput } from './tools/block/paragraph/input';
38
+ import { ParagraphOutput } from './tools/block/paragraph/output';
39
+ import { QuoteInput } from './tools/block/quote/input';
40
+ import { QuoteOutput } from './tools/block/quote/output';
41
+ import { SketchInput } from './tools/block/sketch/input';
42
+ import { SketchOutput } from './tools/block/sketch/output';
43
+ import { TableInput } from './tools/block/table/input';
44
+ import { TableOutput } from './tools/block/table/output';
45
+ import { TocInput } from './tools/block/toc/input';
46
+ import { TocOutput } from './tools/block/toc/output';
47
+ import { LatexInput, MermaidInput } from './tools/block/typeset/input';
48
+ import { LatexOutput, MermaidOutput } from './tools/block/typeset/output';
49
+ import { UpdatesInput } from './tools/block/updates/input';
50
+ import { UpdatesOutput } from './tools/block/updates/output';
51
+ import { VideoInput } from './tools/block/video/input';
52
+ import { VideoOutput } from './tools/block/video/output';
53
+ export declare const ALERT_VARIANTS: readonly ["error", "info", "plain", "success", "warning"];
54
+ export declare const DELIMITER_VARIANTS: readonly ["line", "stars"];
55
+ export declare const LIST_TYPES: readonly ["ordered", "unordered"];
56
+ export declare const ALIGNMENTS: readonly ["center", "left", "right"];
57
+ export declare const HEADER_LEVELS: readonly ["h1", "h2", "h3", "h4", "h5", "h6"];
58
+ export declare const INLINE_TOOLS: readonly ["bold", "inline-code", "italic", "link", "marker", "strikethrough", "tooltip", "underline"];
59
+ export declare const BLOCK_TOOLS: readonly ["alert", "audio", "checklist", "code", "collapsible", "collection", "columns", "date", "delimiter", "doc_card", "embed", "file", "glance", "header", "image", "latex", "list", "mermaid", "openapi", "paragraph", "quote", "sketch", "table", "toc", "updates", "video"];
60
+ export type CodeLanguage = 'assembly' | 'bash' | 'clojure' | 'cobol' | 'cpp' | 'csharp' | 'css' | 'dart' | 'diff' | 'dockerfile' | 'erlang' | 'fortran' | 'go' | 'graphql' | 'groovy' | 'haskell' | 'html' | 'java' | 'javascript' | 'json' | 'jsx' | 'julia' | 'kotlin' | 'lua' | 'markdown' | 'nginx' | 'objectivec' | 'pascal' | 'perl' | 'php' | 'plaintext' | 'powershell' | 'protobuf' | 'python' | 'r' | 'ruby' | 'rust' | 'scala' | 'scheme' | 'shell' | 'sql' | 'swift' | 'toml' | 'tsx' | 'typescript' | 'vb' | 'verilog' | 'vhdl' | 'xml' | 'yaml';
61
+ export type CodeTheme = 'auto' | 'dark' | 'default' | 'dracula' | 'github' | 'github-dark' | 'light' | 'monokai' | 'solarized' | 'solarized-dark' | 'tomorrow';
62
+ export type AlertVariant = (typeof ALERT_VARIANTS)[number];
63
+ export type DelimiterVariant = (typeof DELIMITER_VARIANTS)[number];
64
+ export type ListType = (typeof LIST_TYPES)[number];
65
+ export type Alignment = (typeof ALIGNMENTS)[number];
66
+ export type HeaderLevel = (typeof HEADER_LEVELS)[number];
67
+ export type InlineToolType = (typeof INLINE_TOOLS)[number];
68
+ export type BlockToolType = (typeof BLOCK_TOOLS)[number];
69
+ export type ToolType = BlockToolType | InlineToolType;
70
+ export type Tool = {
71
+ icon: string;
72
+ label: string;
73
+ shortcut: string;
74
+ testId: string;
75
+ type: ToolType;
76
+ input: typeof AlertInput | typeof CollapsibleInput | typeof CollectionInput | typeof EmbedInput | typeof SketchInput | typeof LatexInput | typeof MermaidInput | typeof ColumnsInput | typeof DateInput | typeof DocCardInput | typeof FileInput | typeof TocInput | typeof UpdatesInput | typeof GlanceInput | typeof DelimiterInput | typeof ListInput | typeof OpenApiInput | typeof HeaderInput | typeof QuoteInput | typeof CodeInput | typeof TableInput | typeof ImageInput | typeof AudioInput | typeof VideoInput | typeof ParagraphInput | typeof ChecklistInput;
77
+ output: typeof AlertOutput | typeof CollapsibleOutput | typeof CollectionOutput | typeof EmbedOutput | typeof SketchOutput | typeof LatexOutput | typeof MermaidOutput | typeof ColumnsOutput | typeof DateOutput | typeof DocCardOutput | typeof FileOutput | typeof TocOutput | typeof UpdatesOutput | typeof GlanceOutput | typeof DelimiterOutput | typeof ListOutput | typeof OpenApiOutput | typeof HeaderOutput | typeof QuoteOutput | typeof CodeOutput | typeof TableOutput | typeof ImageOutput | typeof AudioOutput | typeof VideoOutput | typeof ParagraphOutput | typeof ChecklistOutput;
78
+ };
79
+ export type CSSValue = string | number | ((val: CSSProperties) => string | number) | undefined;
80
+ export type CSSProperties = Prettify<{
81
+ [key: string]: CSSValue;
82
+ }>;
83
+ export type InputConfig<T extends ToolType> = {
84
+ styles?: BlockStyles[T];
85
+ classNames?: BlockClassNames[T];
86
+ margins?: {
87
+ top?: number;
88
+ bottom?: number;
89
+ };
90
+ };
91
+ export type ParagraphData = {
92
+ html: string;
93
+ };
94
+ export type HeaderData = {
95
+ html: string;
96
+ level?: HeaderLevel;
97
+ };
98
+ export type ListData = {
99
+ type: ListType;
100
+ items: string[];
101
+ };
102
+ export type QuoteData = {
103
+ html: string;
104
+ author?: string;
105
+ };
106
+ /** One tab of a multi-language code block. */
107
+ export type CodeVariant = {
108
+ code: string;
109
+ label?: string;
110
+ language?: CodeLanguage;
111
+ };
112
+ export type CodeData = {
113
+ code: string;
114
+ language?: CodeLanguage;
115
+ theme?: CodeTheme;
116
+ showCopy?: boolean;
117
+ syncKey?: string;
118
+ variants?: CodeVariant[];
119
+ };
120
+ export type OpenApiFilter = {
121
+ paths?: string[];
122
+ tags?: string[];
123
+ };
124
+ export type OpenApiData = {
125
+ defaultServer?: string;
126
+ exclude?: OpenApiFilter;
127
+ include?: OpenApiFilter;
128
+ snippetLanguages?: CodeLanguage[];
129
+ spec?: unknown;
130
+ url?: string;
131
+ };
132
+ export type AlertData = {
133
+ html: string;
134
+ variant: AlertVariant;
135
+ };
136
+ export type TableData = {
137
+ data: string[][];
138
+ caption?: string;
139
+ showDownload?: boolean;
140
+ };
141
+ export type ImageData = {
142
+ url: string;
143
+ caption?: string;
144
+ alt?: string;
145
+ alignment?: Alignment;
146
+ };
147
+ export type AudioData = {
148
+ url: string;
149
+ caption?: string;
150
+ alt?: string;
151
+ alignment?: Alignment;
152
+ };
153
+ export type VideoData = {
154
+ url: string;
155
+ caption?: string;
156
+ alt?: string;
157
+ alignment?: Alignment;
158
+ };
159
+ export type DelimiterData = {
160
+ variant: DelimiterVariant;
161
+ };
162
+ export type ChecklistData = {
163
+ items: ChecklistItem[];
164
+ };
165
+ /** One label-to-value pair in an at-a-glance box. `label` is plain text so it
166
+ * stays a scannable rail; `html` carries inline formatting because values are
167
+ * often code identifiers or links. */
168
+ export type GlanceRow = {
169
+ html: string;
170
+ label: string;
171
+ };
172
+ export type GlanceData = {
173
+ caption?: string;
174
+ rows: GlanceRow[];
175
+ variant?: AlertVariant;
176
+ };
177
+ export type CollapsibleData = {
178
+ html: string;
179
+ open?: boolean;
180
+ children?: Block[];
181
+ };
182
+ export type ColumnsData = {
183
+ columns: Block[][];
184
+ };
185
+ export type DateData = {
186
+ date: string;
187
+ };
188
+ export type TocData = Record<string, never>;
189
+ export type CollectionData = {
190
+ collectionId: string;
191
+ };
192
+ export type UpdatesData = {
193
+ pageId?: string;
194
+ };
195
+ /** `link` is a first-class outcome, not a failure: most services publish no
196
+ * supported public iframe. `invalid` is a URL we refuse to render at all. */
197
+ export type EmbedProvider = 'airtable' | 'drawio' | 'figma' | 'googleMaps' | 'invalid' | 'link' | 'miro' | 'youtube';
198
+ /** Points are a FLAT x,y list — a sketch is thousands of points and the flat
199
+ * form roughly halves the stored JSON. */
200
+ export type SketchStroke = {
201
+ points: number[];
202
+ color?: string;
203
+ width?: number;
204
+ };
205
+ export type SketchData = {
206
+ strokes: SketchStroke[];
207
+ };
208
+ /** LaTeX and Mermaid both store SOURCE and never rendered output, so a better
209
+ * renderer later improves every document that already exists. */
210
+ export type TypesetData = {
211
+ source: string;
212
+ /** Describes what the diagram or formula IS, not that it's a diagram — shown
213
+ * in place of the bare language name when present. */
214
+ title?: string;
215
+ };
216
+ export type EmbedData = {
217
+ url: string;
218
+ title?: string;
219
+ description?: string;
220
+ imageUrl?: string;
221
+ };
222
+ export type EmbedResolution = {
223
+ url: string;
224
+ provider: EmbedProvider;
225
+ embedUrl: string | null;
226
+ aspect?: number;
227
+ };
228
+ export type EmbedResolveOptions = {
229
+ mapsEmbedKey?: string;
230
+ };
231
+ export type DocCardData = {
232
+ pageId: string;
233
+ title: string;
234
+ icon?: string;
235
+ description?: string;
236
+ };
237
+ export type FileData = {
238
+ url: string;
239
+ name: string;
240
+ size?: number;
241
+ contentType?: string;
242
+ };
243
+ export type ChecklistItem = {
244
+ text: string;
245
+ checked: boolean;
246
+ };
247
+ export type Block<T = BlockToolType> = T extends 'alert' ? {
248
+ id?: string;
249
+ type: T;
250
+ data: AlertData;
251
+ tunes?: BlockTunes;
252
+ } : T extends 'delimiter' ? {
253
+ id?: string;
254
+ type: T;
255
+ data: DelimiterData;
256
+ tunes?: BlockTunes;
257
+ } : T extends 'list' ? {
258
+ id?: string;
259
+ type: T;
260
+ data: ListData;
261
+ tunes?: BlockTunes;
262
+ } : T extends 'header' ? {
263
+ id?: string;
264
+ type: T;
265
+ data: HeaderData;
266
+ tunes?: BlockTunes;
267
+ } : T extends 'quote' ? {
268
+ id?: string;
269
+ type: T;
270
+ data: QuoteData;
271
+ tunes?: BlockTunes;
272
+ } : T extends 'code' ? {
273
+ id?: string;
274
+ type: T;
275
+ data: CodeData;
276
+ tunes?: BlockTunes;
277
+ } : T extends 'collapsible' ? {
278
+ id?: string;
279
+ type: T;
280
+ data: CollapsibleData;
281
+ tunes?: BlockTunes;
282
+ } : T extends 'columns' ? {
283
+ id?: string;
284
+ type: T;
285
+ data: ColumnsData;
286
+ tunes?: BlockTunes;
287
+ } : T extends 'date' ? {
288
+ id?: string;
289
+ type: T;
290
+ data: DateData;
291
+ tunes?: BlockTunes;
292
+ } : T extends 'toc' ? {
293
+ id?: string;
294
+ type: T;
295
+ data: TocData;
296
+ tunes?: BlockTunes;
297
+ } : T extends 'glance' ? {
298
+ id?: string;
299
+ type: T;
300
+ data: GlanceData;
301
+ tunes?: BlockTunes;
302
+ } : T extends 'openapi' ? {
303
+ id?: string;
304
+ type: T;
305
+ data: OpenApiData;
306
+ tunes?: BlockTunes;
307
+ } : T extends 'latex' | 'mermaid' ? {
308
+ id?: string;
309
+ type: T;
310
+ data: TypesetData;
311
+ tunes?: BlockTunes;
312
+ } : T extends 'sketch' ? {
313
+ id?: string;
314
+ type: T;
315
+ data: SketchData;
316
+ tunes?: BlockTunes;
317
+ } : T extends 'embed' ? {
318
+ id?: string;
319
+ type: T;
320
+ data: EmbedData;
321
+ tunes?: BlockTunes;
322
+ } : T extends 'collection' ? {
323
+ id?: string;
324
+ type: T;
325
+ data: CollectionData;
326
+ tunes?: BlockTunes;
327
+ } : T extends 'updates' ? {
328
+ id?: string;
329
+ type: T;
330
+ data: UpdatesData;
331
+ tunes?: BlockTunes;
332
+ } : T extends 'doc_card' ? {
333
+ id?: string;
334
+ type: T;
335
+ data: DocCardData;
336
+ tunes?: BlockTunes;
337
+ } : T extends 'file' ? {
338
+ id?: string;
339
+ type: T;
340
+ data: FileData;
341
+ tunes?: BlockTunes;
342
+ } : T extends 'table' ? {
343
+ id?: string;
344
+ type: T;
345
+ data: TableData;
346
+ tunes?: BlockTunes;
347
+ } : T extends 'image' ? {
348
+ id?: string;
349
+ type: T;
350
+ data: ImageData;
351
+ tunes?: BlockTunes;
352
+ } : T extends 'audio' ? {
353
+ id?: string;
354
+ type: T;
355
+ data: AudioData;
356
+ tunes?: BlockTunes;
357
+ } : T extends 'video' ? {
358
+ id?: string;
359
+ type: T;
360
+ data: VideoData;
361
+ tunes?: BlockTunes;
362
+ } : T extends 'paragraph' ? {
363
+ id?: string;
364
+ type: T;
365
+ data: ParagraphData;
366
+ tunes?: BlockTunes;
367
+ } : T extends 'checklist' ? {
368
+ id?: string;
369
+ type: T;
370
+ data: ChecklistData;
371
+ tunes?: BlockTunes;
372
+ } : never;
373
+ export type EditorData = {
374
+ time?: number;
375
+ blocks: Block[];
376
+ version?: string;
377
+ };
378
+ export type EditorStyles = {
379
+ container?: CSSProperties;
380
+ editorContent?: CSSProperties;
381
+ blocks?: BlockStyles;
382
+ blockToolbar?: {
383
+ container?: CSSProperties;
384
+ button?: CSSProperties;
385
+ };
386
+ inlineToolbar?: {
387
+ container?: CSSProperties;
388
+ button?: CSSProperties;
389
+ };
390
+ blockTypeMenu?: {
391
+ container?: CSSProperties;
392
+ item?: {
393
+ container?: CSSProperties;
394
+ icon?: CSSProperties;
395
+ text?: CSSProperties;
396
+ shortcut?: CSSProperties;
397
+ };
398
+ input?: CSSProperties;
399
+ };
400
+ operationsMenu?: {
401
+ container?: CSSProperties;
402
+ item?: {
403
+ container?: CSSProperties;
404
+ icon?: CSSProperties;
405
+ text?: CSSProperties;
406
+ shortcut?: CSSProperties;
407
+ };
408
+ input?: CSSProperties;
409
+ divider?: CSSProperties;
410
+ };
411
+ convertSubmenu?: {
412
+ container?: CSSProperties;
413
+ item?: {
414
+ container?: CSSProperties;
415
+ icon?: CSSProperties;
416
+ text?: CSSProperties;
417
+ shortcut?: CSSProperties;
418
+ };
419
+ input?: CSSProperties;
420
+ };
421
+ controls?: {
422
+ group?: CSSProperties;
423
+ button?: CSSProperties;
424
+ };
425
+ dialogs?: {
426
+ overlay?: CSSProperties;
427
+ container?: CSSProperties;
428
+ title?: CSSProperties;
429
+ group?: CSSProperties;
430
+ label?: CSSProperties;
431
+ input?: CSSProperties;
432
+ buttons?: CSSProperties;
433
+ cancelButton?: CSSProperties;
434
+ saveButton?: CSSProperties;
435
+ };
436
+ tooltips?: {
437
+ container?: CSSProperties;
438
+ content?: CSSProperties;
439
+ arrow?: CSSProperties;
440
+ };
441
+ switch?: {
442
+ container?: CSSProperties;
443
+ input?: CSSProperties;
444
+ label?: CSSProperties;
445
+ labelText?: CSSProperties;
446
+ };
447
+ };
448
+ export type EditorClassNames = {
449
+ container?: string;
450
+ editorContent?: string;
451
+ blocks?: BlockClassNames;
452
+ blockToolbar?: {
453
+ container?: string;
454
+ button?: string;
455
+ };
456
+ inlineToolbar?: {
457
+ container?: string;
458
+ button?: string;
459
+ };
460
+ blockTypeMenu?: {
461
+ container?: string;
462
+ input?: string;
463
+ item?: {
464
+ container?: string;
465
+ icon?: string;
466
+ text?: string;
467
+ shortcut?: string;
468
+ };
469
+ };
470
+ operationsMenu?: {
471
+ container?: string;
472
+ input?: string;
473
+ item?: {
474
+ container?: string;
475
+ icon?: string;
476
+ text?: string;
477
+ shortcut?: string;
478
+ };
479
+ divider?: string;
480
+ };
481
+ convertSubmenu?: {
482
+ container?: string;
483
+ input?: string;
484
+ item?: {
485
+ container?: string;
486
+ icon?: string;
487
+ text?: string;
488
+ shortcut?: string;
489
+ };
490
+ };
491
+ controls?: {
492
+ group?: string;
493
+ button?: string;
494
+ };
495
+ dialogs?: {
496
+ overlay?: string;
497
+ container?: string;
498
+ title?: string;
499
+ group?: string;
500
+ label?: string;
501
+ input?: string;
502
+ buttons?: string;
503
+ cancelButton?: string;
504
+ saveButton?: string;
505
+ };
506
+ tooltips?: {
507
+ container?: string;
508
+ content?: string;
509
+ arrow?: string;
510
+ };
511
+ switch?: {
512
+ container?: string;
513
+ input?: string;
514
+ label?: string;
515
+ labelText?: string;
516
+ };
517
+ };
518
+ export type BlockMargins = {
519
+ top?: number;
520
+ bottom?: number;
521
+ };
522
+ export type EditorView = 'edit' | 'preview' | 'json';
523
+ export type BlockStyles = Prettify<Override<Partial<{
524
+ [key in ToolType]?: CSSProperties;
525
+ }>, {
526
+ alert?: {
527
+ [key in AlertVariant]?: CSSProperties;
528
+ };
529
+ collapsible?: {
530
+ section?: CSSProperties;
531
+ };
532
+ columns?: {
533
+ container?: CSSProperties;
534
+ column?: CSSProperties;
535
+ };
536
+ date?: {
537
+ pill?: CSSProperties;
538
+ };
539
+ toc?: {
540
+ list?: CSSProperties;
541
+ entry?: CSSProperties;
542
+ };
543
+ collection?: {
544
+ wrapper?: CSSProperties;
545
+ };
546
+ updates?: {
547
+ wrapper?: CSSProperties;
548
+ };
549
+ glance?: {
550
+ wrapper?: CSSProperties;
551
+ };
552
+ embed?: {
553
+ wrapper?: CSSProperties;
554
+ card?: CSSProperties;
555
+ };
556
+ sketch?: {
557
+ wrapper?: CSSProperties;
558
+ };
559
+ openapi?: {
560
+ container?: CSSProperties;
561
+ };
562
+ latex?: {
563
+ wrapper?: CSSProperties;
564
+ };
565
+ mermaid?: {
566
+ wrapper?: CSSProperties;
567
+ };
568
+ doc_card?: {
569
+ card?: CSSProperties;
570
+ };
571
+ file?: {
572
+ row?: CSSProperties;
573
+ };
574
+ delimiter?: {
575
+ [key in DelimiterVariant]?: CSSProperties;
576
+ };
577
+ list?: {
578
+ [key in ListType]?: {
579
+ item?: CSSProperties;
580
+ container?: CSSProperties;
581
+ };
582
+ };
583
+ header?: {
584
+ [key in HeaderLevel]?: CSSProperties;
585
+ };
586
+ code?: {
587
+ container?: CSSProperties;
588
+ header?: {
589
+ wrapper?: CSSProperties;
590
+ text?: CSSProperties;
591
+ };
592
+ copyButton?: CSSProperties;
593
+ copySwitch?: CSSProperties;
594
+ copySwitchInput?: CSSProperties;
595
+ copySwitchLabel?: CSSProperties;
596
+ };
597
+ image?: {
598
+ caption?: CSSProperties;
599
+ container?: CSSProperties;
600
+ dropArea?: {
601
+ container?: CSSProperties;
602
+ icon?: CSSProperties;
603
+ text?: CSSProperties;
604
+ subtext?: CSSProperties;
605
+ deleteButton?: CSSProperties;
606
+ };
607
+ };
608
+ audio?: {
609
+ caption?: CSSProperties;
610
+ container?: CSSProperties;
611
+ dropArea?: {
612
+ container?: CSSProperties;
613
+ icon?: CSSProperties;
614
+ text?: CSSProperties;
615
+ subtext?: CSSProperties;
616
+ deleteButton?: CSSProperties;
617
+ };
618
+ };
619
+ video?: {
620
+ caption?: CSSProperties;
621
+ container?: CSSProperties;
622
+ dropArea?: {
623
+ container?: CSSProperties;
624
+ icon?: CSSProperties;
625
+ text?: CSSProperties;
626
+ subtext?: CSSProperties;
627
+ deleteButton?: CSSProperties;
628
+ };
629
+ };
630
+ quote?: {
631
+ author?: CSSProperties;
632
+ container?: CSSProperties;
633
+ text?: CSSProperties;
634
+ divider?: CSSProperties;
635
+ };
636
+ table?: {
637
+ caption?: CSSProperties;
638
+ container?: CSSProperties;
639
+ table?: CSSProperties;
640
+ header?: CSSProperties;
641
+ cell?: CSSProperties;
642
+ row?: CSSProperties;
643
+ downloadButton?: CSSProperties;
644
+ downloadSwitch?: CSSProperties;
645
+ downloadSwitchInput?: CSSProperties;
646
+ downloadSwitchLabel?: CSSProperties;
647
+ rowMenuButton?: CSSProperties;
648
+ columnMenuButton?: CSSProperties;
649
+ menu?: CSSProperties;
650
+ menuItem?: CSSProperties;
651
+ footer?: CSSProperties;
652
+ footerContainer?: CSSProperties;
653
+ };
654
+ checklist?: {
655
+ container?: CSSProperties;
656
+ item?: CSSProperties;
657
+ checkbox?: CSSProperties;
658
+ text?: CSSProperties;
659
+ };
660
+ }>>;
661
+ export type BlockClassNames = Prettify<Override<{
662
+ [key in ToolType]?: string;
663
+ }, {
664
+ alert?: {
665
+ [key in AlertVariant]?: string;
666
+ };
667
+ collapsible?: {
668
+ section?: string;
669
+ };
670
+ columns?: {
671
+ container?: string;
672
+ column?: string;
673
+ };
674
+ date?: {
675
+ pill?: string;
676
+ };
677
+ toc?: {
678
+ list?: string;
679
+ entry?: string;
680
+ };
681
+ collection?: {
682
+ wrapper?: string;
683
+ };
684
+ updates?: {
685
+ wrapper?: string;
686
+ };
687
+ glance?: {
688
+ wrapper?: string;
689
+ };
690
+ embed?: {
691
+ wrapper?: string;
692
+ card?: string;
693
+ };
694
+ sketch?: {
695
+ wrapper?: string;
696
+ };
697
+ openapi?: {
698
+ container?: string;
699
+ };
700
+ latex?: {
701
+ wrapper?: string;
702
+ };
703
+ mermaid?: {
704
+ wrapper?: string;
705
+ };
706
+ doc_card?: {
707
+ card?: string;
708
+ };
709
+ file?: {
710
+ row?: string;
711
+ };
712
+ delimiter?: {
713
+ [key in DelimiterVariant]?: string;
714
+ };
715
+ list?: {
716
+ [key in ListType]?: {
717
+ item?: string;
718
+ container?: string;
719
+ };
720
+ };
721
+ header?: {
722
+ [key in HeaderLevel]?: string;
723
+ };
724
+ code?: {
725
+ container?: string;
726
+ header?: {
727
+ wrapper?: string;
728
+ text?: string;
729
+ };
730
+ copyButton?: string;
731
+ copySwitch?: string;
732
+ copySwitchInput?: string;
733
+ copySwitchLabel?: string;
734
+ };
735
+ audio?: {
736
+ caption?: string;
737
+ container?: string;
738
+ dropArea?: {
739
+ container?: string;
740
+ icon?: string;
741
+ text?: string;
742
+ subtext?: string;
743
+ deleteButton?: string;
744
+ };
745
+ };
746
+ image?: {
747
+ caption?: string;
748
+ container?: string;
749
+ dropArea?: {
750
+ container?: string;
751
+ icon?: string;
752
+ text?: string;
753
+ subtext?: string;
754
+ deleteButton?: string;
755
+ };
756
+ };
757
+ video?: {
758
+ caption?: string;
759
+ container?: string;
760
+ dropArea?: {
761
+ container?: string;
762
+ icon?: string;
763
+ text?: string;
764
+ subtext?: string;
765
+ deleteButton?: string;
766
+ };
767
+ };
768
+ paragraph?: string;
769
+ quote?: {
770
+ author?: string;
771
+ container?: string;
772
+ text?: string;
773
+ divider?: string;
774
+ };
775
+ table?: {
776
+ caption?: string;
777
+ container?: string;
778
+ table?: string;
779
+ header?: string;
780
+ cell?: string;
781
+ row?: string;
782
+ downloadButton?: string;
783
+ downloadSwitch?: string;
784
+ downloadSwitchInput?: string;
785
+ downloadSwitchLabel?: string;
786
+ rowMenuButton?: string;
787
+ columnMenuButton?: string;
788
+ menu?: string;
789
+ menuItem?: string;
790
+ footer?: string;
791
+ footerContainer?: string;
792
+ };
793
+ checklist?: {
794
+ container?: string;
795
+ item?: string;
796
+ checkbox?: string;
797
+ text?: string;
798
+ };
799
+ }>>;
800
+ export type OutputConfig = {
801
+ margins?: BlockMargins;
802
+ tooltipClassNames?: {
803
+ container?: string;
804
+ content?: string;
805
+ arrow?: string;
806
+ };
807
+ };
808
+ export interface OutputComponent {
809
+ render: <T extends ToolType>(data: Block<T>['data'], config?: OutputConfig, styles?: BlockStyles[T], classNames?: BlockClassNames[T]) => HTMLElement;
810
+ validate: <T extends ToolType>(data: Block<T>['data']) => boolean;
811
+ sanitize: <T extends ToolType>(data: Block<T>['data']) => Block<T>['data'];
812
+ }
813
+ export interface BlockTune {
814
+ name: string;
815
+ icon: string;
816
+ title: string;
817
+ apply: (element: HTMLElement, data: BlockTuneData) => void;
818
+ save: (element: HTMLElement) => BlockTuneData;
819
+ }
820
+ export type UploadFunction = (file: File) => Promise<string>;
821
+ export type BlockTuneData = {
822
+ [key: string]: string | number | boolean | null | undefined;
823
+ };
824
+ export type BlockTunes = {
825
+ [key: string]: BlockTuneData;
826
+ };
827
+ export type BlockTypeOutputConfigs = {
828
+ [K in ToolType]: OutputConfig;
829
+ };
830
+ export type InputClassNames = BlockClassNames;
831
+ export type InputStyles = BlockStyles;
832
+ export type EditorConfig = {
833
+ containerId: string;
834
+ /**
835
+ * The locale being edited. Omit and the editor behaves exactly as it did
836
+ * before multilingual content existed: fields are read and written as bare
837
+ * strings.
838
+ */
839
+ locale?: string;
840
+ /** The document's own language, used as the fallback. Defaults to `locale`. */
841
+ defaultLocale?: string;
842
+ /**
843
+ * Told which locale a block is actually showing when it is not the one being
844
+ * edited, so the host can surface "showing English" rather than leaving the
845
+ * reader to guess why the text did not change.
846
+ */
847
+ onLocaleFallback?: (info: {
848
+ blockId: string;
849
+ field: string;
850
+ showing: string;
851
+ requested: string;
852
+ }) => void;
853
+ maxHeight?: number;
854
+ minHeight?: number;
855
+ onChange?: (data: EditorData) => void;
856
+ onReady?: () => void;
857
+ placeholder?: string;
858
+ initialData?: EditorData;
859
+ initialView?: EditorView;
860
+ allowJsonViewEditing?: boolean;
861
+ margins?: BlockMargins;
862
+ styles?: EditorStyles;
863
+ classNames?: EditorClassNames;
864
+ imageUploader?: UploadFunction;
865
+ audioUploader?: UploadFunction;
866
+ videoUploader?: UploadFunction;
867
+ fileUploader?: UploadFunction;
868
+ theme?: 'auto' | 'light' | 'dark';
869
+ themeOverrides?: {
870
+ light?: ThemeTokens;
871
+ dark?: ThemeTokens;
872
+ };
873
+ onInlineRewrite?: (selection: string, action: InlineRewriteAction) => Promise<string | null>;
874
+ inlineRewriteLabels?: Partial<Record<InlineRewriteAction, string>>;
875
+ blockToolLabels?: Partial<Record<BlockToolType, string>>;
876
+ blockToolbarLabels?: Partial<Record<BlockToolbarOperation, string>>;
877
+ };
878
+ export declare const BLOCK_TOOLBAR_OPERATIONS: readonly ["convert", "moveUp", "moveDown", "delete"];
879
+ export type BlockToolbarOperation = (typeof BLOCK_TOOLBAR_OPERATIONS)[number];
880
+ export declare const INLINE_REWRITE_ACTIONS: readonly ["improve", "shorten", "lengthen", "simplify", "fix_grammar"];
881
+ export type InlineRewriteAction = (typeof INLINE_REWRITE_ACTIONS)[number];
882
+ export type RendererConfig = {
883
+ containerId: string;
884
+ data: EditorData;
885
+ /**
886
+ * The locale to render. Omit and no translation resolution happens at all,
887
+ * which is the behaviour every existing caller gets.
888
+ */
889
+ locale?: string;
890
+ /** The document's own language, used as the fallback. Defaults to `locale`. */
891
+ defaultLocale?: string;
892
+ margins?: BlockMargins;
893
+ styles?: BlockStyles;
894
+ classNames?: BlockClassNames;
895
+ editorClassNames?: EditorClassNames;
896
+ configs?: Partial<BlockTypeOutputConfigs>;
897
+ theme?: 'auto' | 'light' | 'dark';
898
+ themeOverrides?: {
899
+ light?: ThemeTokens;
900
+ dark?: ThemeTokens;
901
+ };
902
+ };
903
+ export interface EditorInstance {
904
+ currentView: EditorView;
905
+ contentId: string;
906
+ data: EditorData;
907
+ config: EditorConfig;
908
+ isReady: boolean;
909
+ }
910
+ export type EditorAPI = {
911
+ blocks: {
912
+ getAll: () => Block[];
913
+ get: (blockId: string) => Block | null;
914
+ insert: <T extends BlockToolType>(type: T, data: Block<T>['data'], index: number) => HTMLElement | null;
915
+ update: <T extends BlockToolType>(blockId: string, data: Block<T>['data']) => void;
916
+ remove: (index: number) => void;
917
+ move: (fromIndex: number, toIndex: number) => void;
918
+ count: () => number;
919
+ convert: (blockId: string, newType: BlockToolType) => void;
920
+ };
921
+ selection: {
922
+ get: () => Selection | null;
923
+ set: (selection: Selection) => void;
924
+ clear: () => void;
925
+ };
926
+ data: {
927
+ extract: () => EditorData;
928
+ set: (data: EditorData) => void;
929
+ clearContent: () => void;
930
+ clear: () => void;
931
+ clearStorage: () => void;
932
+ };
933
+ ui: {
934
+ showToolbar: (x: number, y: number) => void;
935
+ hideToolbar: () => void;
936
+ showBlockMenu: (block: HTMLElement) => void;
937
+ hideBlockMenu: () => void;
938
+ };
939
+ view: {
940
+ getCurrentView: (containerId: string) => EditorView | null;
941
+ switchView: (containerId: string, view: EditorView) => void;
942
+ };
943
+ destroy: () => void;
944
+ focus: () => void;
945
+ blur: () => void;
946
+ };
947
+ //# sourceMappingURL=types.d.ts.map