@aiquants/markdown-explorer 0.22.0 → 0.24.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.
Files changed (58) hide show
  1. package/CHANGELOG.md +143 -0
  2. package/README.md +63 -17
  3. package/dist/{EditSurface-BesNcSQj.cjs → EditSurface-CRc4g0Qa.cjs} +5 -5
  4. package/dist/{EditSurface-DNjI8pV3.js → EditSurface-CcWEczj3.js} +333 -336
  5. package/dist/{ExplorerSplit-GUdzpDPg.js → ExplorerSplit-97SeIAOS.js} +81 -81
  6. package/dist/{ExplorerSplit-B4oNvydP.cjs → ExplorerSplit-ByxxXlgs.cjs} +1 -1
  7. package/dist/{MultiLayout-DtKChQ_s.cjs → MultiLayout-B_yMVDt_.cjs} +1 -1
  8. package/dist/{MultiLayout-BJ-s6AaD.js → MultiLayout-CnbuAlxd.js} +4 -4
  9. package/dist/{NativeScrollBar-D10fsk-7.js → NativeScrollBar-BXdaM3EA.js} +1 -1
  10. package/dist/{NativeScrollBar-DJKlPWvD.cjs → NativeScrollBar-D4a7fBOS.cjs} +1 -1
  11. package/dist/{TreeLayout-DQT5p2vI.js → TreeLayout-BIQBKAkV.js} +3 -3
  12. package/dist/{TreeLayout-C1mTmoPp.cjs → TreeLayout-C6QDpEBS.cjs} +1 -1
  13. package/dist/core/config.d.cts +13 -0
  14. package/dist/core/config.d.ts +13 -0
  15. package/dist/core/contracts.d.cts +29 -4
  16. package/dist/core/contracts.d.ts +29 -4
  17. package/dist/core/labels.d.cts +21 -0
  18. package/dist/core/labels.d.ts +21 -0
  19. package/dist/core/textEncoding.d.cts +4 -0
  20. package/dist/core/textEncoding.d.ts +4 -0
  21. package/dist/{dataRoute-CObbjNxG.js → dataRoute-BEvesOvN.js} +108 -99
  22. package/dist/dataRoute-Cv7fgCW7.cjs +1 -0
  23. package/dist/index-BwTVYkTR.cjs +13 -0
  24. package/dist/index-CeZDCyEl.js +4088 -0
  25. package/dist/index.cjs +1 -1
  26. package/dist/index.d.cts +2 -2
  27. package/dist/index.d.ts +2 -2
  28. package/dist/index.js +24 -23
  29. package/dist/location-CasigkBk.cjs +1 -0
  30. package/dist/location-gXXmC7CQ.js +643 -0
  31. package/dist/{merge-DauzoA2W.js → merge-DqjUgcV_.js} +1 -1
  32. package/dist/{merge-CTkzzHtn.cjs → merge-QLktbpZY.cjs} +1 -1
  33. package/dist/{sanitizePolicy-gEXeavb-.cjs → sanitizePolicy-CZwOaJ92.cjs} +1 -1
  34. package/dist/{sanitizePolicy-BWQtWhsL.js → sanitizePolicy-gVKBhabq.js} +1 -1
  35. package/dist/sanitizeWorker.cjs +1 -1
  36. package/dist/sanitizeWorker.js +1 -1
  37. package/dist/server/fileSystemSource.d.cts +1 -0
  38. package/dist/server/fileSystemSource.d.ts +1 -0
  39. package/dist/server/ports.d.cts +9 -1
  40. package/dist/server/ports.d.ts +9 -1
  41. package/dist/server.cjs +1 -1
  42. package/dist/server.d.cts +1 -0
  43. package/dist/server.d.ts +1 -0
  44. package/dist/server.js +852 -834
  45. package/dist/styles/markdown-explorer.css +1 -1
  46. package/dist/{useSplitPersistence-Cc4tDxB4.js → useSplitPersistence-BPNjvuJi.js} +1 -1
  47. package/dist/{useSplitPersistence-Ba-v64n-.cjs → useSplitPersistence-Bmpb2prR.cjs} +1 -1
  48. package/docs/behavior/dom-hooks.md +13 -6
  49. package/docs/behavior/layout.md +22 -8
  50. package/docs/behavior/localization.md +9 -5
  51. package/docs/behavior/security.md +6 -4
  52. package/docs/behavior/url-contract.md +2 -2
  53. package/package.json +5 -5
  54. package/dist/dataRoute-BONacTPi.cjs +0 -1
  55. package/dist/index-0pnuyLUO.js +0 -3662
  56. package/dist/index-T98wklgM.cjs +0 -13
  57. package/dist/location-B-m9scLf.js +0 -499
  58. package/dist/location-BVEN_Ihk.cjs +0 -1
@@ -32,6 +32,10 @@ export type ExplorerConfigInput = {
32
32
  readonly linkCardSize?: LinkCardSize;
33
33
  };
34
34
  readonly defaultTreeSettings?: Partial<TreeSettings>;
35
+ readonly legacyTextEncoding?: string;
36
+ readonly spreadsheets?: {
37
+ readonly maxBytes?: number;
38
+ };
35
39
  };
36
40
  export type ExplorerConfig = {
37
41
  readonly basePath: string;
@@ -53,6 +57,10 @@ export type ExplorerConfig = {
53
57
  readonly iframeHosts: readonly string[];
54
58
  readonly embeds: MarkdownEmbeds;
55
59
  readonly defaultTreeSettings: TreeSettings;
60
+ readonly legacyTextEncoding: string | null;
61
+ readonly spreadsheets: {
62
+ readonly maxBytes: number;
63
+ };
56
64
  };
57
65
  export declare const DEFAULT_VIEW_SLUGS: ExplorerViewSlugs;
58
66
  export declare const MULTI_VIEW_PANEL_LIMITS: Readonly<{
@@ -80,6 +88,11 @@ export declare const REVEAL_DOCUMENT_DEPTH_LIMITS: Readonly<{
80
88
  min: 1;
81
89
  max: 64;
82
90
  }>;
91
+ export declare const SPREADSHEET_BYTE_LIMITS: Readonly<{
92
+ default: number;
93
+ min: 1;
94
+ max: number;
95
+ }>;
83
96
  export declare const defineExplorerConfig: (input: ExplorerConfigInput) => ExplorerConfig;
84
97
  export declare const revalidateExplorerConfig: (config: ExplorerConfig) => ExplorerConfig;
85
98
  export declare const isExplorerSourceId: (value: unknown) => value is string;
@@ -21,6 +21,16 @@ export declare const EXPLORER_MEDIA_TYPES: readonly [
21
21
  "pdf"
22
22
  ];
23
23
  export type ExplorerMediaType = (typeof EXPLORER_MEDIA_TYPES)[number];
24
+ export declare const EXPLORER_IMAGE_TYPES: readonly [
25
+ "raster",
26
+ "svg"
27
+ ];
28
+ export type ExplorerImageType = (typeof EXPLORER_IMAGE_TYPES)[number];
29
+ export declare const EXPLORER_SPREADSHEET_FORMATS: readonly [
30
+ "csv",
31
+ "tsv"
32
+ ];
33
+ export type ExplorerSpreadsheetFormat = (typeof EXPLORER_SPREADSHEET_FORMATS)[number];
24
34
  export declare const EXPLORER_NOTICE_TONES: readonly [
25
35
  "info",
26
36
  "warning",
@@ -32,6 +42,7 @@ export declare const EXPLORER_DOCUMENT_KINDS: readonly [
32
42
  "text",
33
43
  "image",
34
44
  "media",
45
+ "spreadsheet",
35
46
  "file",
36
47
  "failure"
37
48
  ];
@@ -110,13 +121,22 @@ export type ExplorerTextDocument = {
110
121
  readonly truncated: boolean;
111
122
  readonly url: string;
112
123
  };
124
+ export type ExplorerExternalEdit = {
125
+ readonly kind: "external";
126
+ readonly href: string;
127
+ };
113
128
  export type ExplorerDocumentEdit = {
114
129
  readonly kind: "inline";
115
130
  } | {
116
131
  readonly kind: "draft";
117
- } | {
118
- readonly kind: "external";
119
- readonly href: string;
132
+ } | ExplorerExternalEdit;
133
+ export type ExplorerSpreadsheetDocument = {
134
+ readonly kind: "spreadsheet";
135
+ readonly name: string;
136
+ readonly url: string;
137
+ readonly format: ExplorerSpreadsheetFormat;
138
+ readonly firstSheetOnly: boolean;
139
+ readonly edit: ExplorerExternalEdit | null;
120
140
  };
121
141
  export type ExplorerDocument = {
122
142
  readonly kind: "markdown";
@@ -128,12 +148,13 @@ export type ExplorerDocument = {
128
148
  readonly kind: "image";
129
149
  readonly name: string;
130
150
  readonly url: string;
151
+ readonly imageType: ExplorerImageType;
131
152
  } | {
132
153
  readonly kind: "media";
133
154
  readonly name: string;
134
155
  readonly url: string;
135
156
  readonly mediaType: ExplorerMediaType;
136
- } | {
157
+ } | ExplorerSpreadsheetDocument | {
137
158
  readonly kind: "file";
138
159
  readonly name: string;
139
160
  readonly url: string;
@@ -217,6 +238,8 @@ export type ExplorerSourceSummary = {
217
238
  export declare const isExplorerFailureReason: (value: unknown) => value is ExplorerFailureReason;
218
239
  export declare const isExplorerEntryType: (value: unknown) => value is ExplorerEntryType;
219
240
  export declare const isExplorerMediaType: (value: unknown) => value is ExplorerMediaType;
241
+ export declare const isExplorerImageType: (value: unknown) => value is ExplorerImageType;
242
+ export declare const isExplorerSpreadsheetFormat: (value: unknown) => value is ExplorerSpreadsheetFormat;
220
243
  export declare const isExplorerNoticeTone: (value: unknown) => value is ExplorerNoticeTone;
221
244
  export declare const isExplorerDocumentKind: (value: unknown) => value is ExplorerDocumentKind;
222
245
  export declare const isExplorerFailureCode: (code: unknown) => code is string;
@@ -232,6 +255,8 @@ export declare const documentViolation: (value: unknown) => string | null;
232
255
  export declare const isExplorerDocument: (value: unknown) => value is ExplorerDocument;
233
256
  export declare const isExplorerTextAnswer: (value: unknown) => value is ExplorerTextAnswer;
234
257
  export declare const editViolation: (value: unknown) => string | null;
258
+ export declare const externalEditViolation: (value: unknown) => string | null;
259
+ export declare const spreadsheetFieldsViolation: (record: Readonly<Record<string, unknown>>) => string | null;
235
260
  export declare const isExplorerEditToken: (value: unknown) => value is string;
236
261
  export declare const revisionViolation: (value: unknown) => string | null;
237
262
  export declare const editAnswerViolation: (value: unknown, kinds: readonly string[]) => string | null;
@@ -21,6 +21,16 @@ export declare const EXPLORER_MEDIA_TYPES: readonly [
21
21
  "pdf"
22
22
  ];
23
23
  export type ExplorerMediaType = (typeof EXPLORER_MEDIA_TYPES)[number];
24
+ export declare const EXPLORER_IMAGE_TYPES: readonly [
25
+ "raster",
26
+ "svg"
27
+ ];
28
+ export type ExplorerImageType = (typeof EXPLORER_IMAGE_TYPES)[number];
29
+ export declare const EXPLORER_SPREADSHEET_FORMATS: readonly [
30
+ "csv",
31
+ "tsv"
32
+ ];
33
+ export type ExplorerSpreadsheetFormat = (typeof EXPLORER_SPREADSHEET_FORMATS)[number];
24
34
  export declare const EXPLORER_NOTICE_TONES: readonly [
25
35
  "info",
26
36
  "warning",
@@ -32,6 +42,7 @@ export declare const EXPLORER_DOCUMENT_KINDS: readonly [
32
42
  "text",
33
43
  "image",
34
44
  "media",
45
+ "spreadsheet",
35
46
  "file",
36
47
  "failure"
37
48
  ];
@@ -110,13 +121,22 @@ export type ExplorerTextDocument = {
110
121
  readonly truncated: boolean;
111
122
  readonly url: string;
112
123
  };
124
+ export type ExplorerExternalEdit = {
125
+ readonly kind: "external";
126
+ readonly href: string;
127
+ };
113
128
  export type ExplorerDocumentEdit = {
114
129
  readonly kind: "inline";
115
130
  } | {
116
131
  readonly kind: "draft";
117
- } | {
118
- readonly kind: "external";
119
- readonly href: string;
132
+ } | ExplorerExternalEdit;
133
+ export type ExplorerSpreadsheetDocument = {
134
+ readonly kind: "spreadsheet";
135
+ readonly name: string;
136
+ readonly url: string;
137
+ readonly format: ExplorerSpreadsheetFormat;
138
+ readonly firstSheetOnly: boolean;
139
+ readonly edit: ExplorerExternalEdit | null;
120
140
  };
121
141
  export type ExplorerDocument = {
122
142
  readonly kind: "markdown";
@@ -128,12 +148,13 @@ export type ExplorerDocument = {
128
148
  readonly kind: "image";
129
149
  readonly name: string;
130
150
  readonly url: string;
151
+ readonly imageType: ExplorerImageType;
131
152
  } | {
132
153
  readonly kind: "media";
133
154
  readonly name: string;
134
155
  readonly url: string;
135
156
  readonly mediaType: ExplorerMediaType;
136
- } | {
157
+ } | ExplorerSpreadsheetDocument | {
137
158
  readonly kind: "file";
138
159
  readonly name: string;
139
160
  readonly url: string;
@@ -217,6 +238,8 @@ export type ExplorerSourceSummary = {
217
238
  export declare const isExplorerFailureReason: (value: unknown) => value is ExplorerFailureReason;
218
239
  export declare const isExplorerEntryType: (value: unknown) => value is ExplorerEntryType;
219
240
  export declare const isExplorerMediaType: (value: unknown) => value is ExplorerMediaType;
241
+ export declare const isExplorerImageType: (value: unknown) => value is ExplorerImageType;
242
+ export declare const isExplorerSpreadsheetFormat: (value: unknown) => value is ExplorerSpreadsheetFormat;
220
243
  export declare const isExplorerNoticeTone: (value: unknown) => value is ExplorerNoticeTone;
221
244
  export declare const isExplorerDocumentKind: (value: unknown) => value is ExplorerDocumentKind;
222
245
  export declare const isExplorerFailureCode: (code: unknown) => code is string;
@@ -232,6 +255,8 @@ export declare const documentViolation: (value: unknown) => string | null;
232
255
  export declare const isExplorerDocument: (value: unknown) => value is ExplorerDocument;
233
256
  export declare const isExplorerTextAnswer: (value: unknown) => value is ExplorerTextAnswer;
234
257
  export declare const editViolation: (value: unknown) => string | null;
258
+ export declare const externalEditViolation: (value: unknown) => string | null;
259
+ export declare const spreadsheetFieldsViolation: (record: Readonly<Record<string, unknown>>) => string | null;
235
260
  export declare const isExplorerEditToken: (value: unknown) => value is string;
236
261
  export declare const revisionViolation: (value: unknown) => string | null;
237
262
  export declare const editAnswerViolation: (value: unknown, kinds: readonly string[]) => string | null;
@@ -24,6 +24,8 @@ export type MarkdownExplorerLabels = MarkdownExplorerSpreadsheetLabels & {
24
24
  readonly documentRefreshFailed: (reason: string) => string;
25
25
  readonly showMarkupLabel: string;
26
26
  readonly showMarkup: string;
27
+ readonly showSvgMarkup: string;
28
+ readonly showSpreadsheetMarkup: (format: string) => string;
27
29
  readonly showMarkupNamed: (name: string) => string;
28
30
  readonly editDocumentLabel: string;
29
31
  readonly editDocument: string;
@@ -158,6 +160,7 @@ export type MarkdownExplorerLabels = MarkdownExplorerSpreadsheetLabels & {
158
160
  readonly folderReadmeMissing: (name: string) => string;
159
161
  readonly documentLoading: string;
160
162
  readonly markupLoading: string;
163
+ readonly spreadsheetLoading: string;
161
164
  readonly documentShown: (name: string) => string;
162
165
  readonly documentFailed: (name: string, title: string) => string;
163
166
  readonly announcementSequence: (messages: readonly string[]) => string;
@@ -194,6 +197,13 @@ export type MarkdownExplorerLabels = MarkdownExplorerSpreadsheetLabels & {
194
197
  readonly mediaUnsupported: string;
195
198
  readonly fileNotShown: string;
196
199
  readonly pdfNotShown: string;
200
+ readonly spreadsheetFirstSheetOnly: string;
201
+ readonly spreadsheetTruncated: string;
202
+ readonly spreadsheetUnreadableEncoding: (encodings: readonly string[]) => string;
203
+ readonly spreadsheetEmpty: string;
204
+ readonly spreadsheetNotText: string;
205
+ readonly spreadsheetLongRow: string;
206
+ readonly spreadsheetFullscreen: (name: string) => string;
197
207
  readonly viewerLoading: string;
198
208
  readonly viewerErrorPrefix: string;
199
209
  readonly viewerStyleTitle: string;
@@ -237,6 +247,17 @@ export type MarkdownExplorerLabels = MarkdownExplorerSpreadsheetLabels & {
237
247
  readonly viewerEmbeddedVideo: string;
238
248
  readonly viewerEmbeddedPost: string;
239
249
  readonly viewerEmbeddedFrame: string;
250
+ readonly viewerBlockFailed: string;
251
+ readonly viewerSvgImageToolbar: string;
252
+ readonly viewerSvgImageSource: string;
253
+ readonly viewerSvgImageSourceRegion: string;
254
+ readonly viewerSvgImageLoading: string;
255
+ readonly viewerSvgImageFailed: string;
256
+ readonly viewerSvgImageRetry: string;
257
+ readonly viewerSvgImageTruncated: string;
258
+ readonly viewerSvgImageCopy: string;
259
+ readonly viewerSvgImageCopied: string;
260
+ readonly viewerSvgImageCopyFailed: string;
240
261
  readonly multiRegion: string;
241
262
  readonly multiEmpty: string;
242
263
  readonly panelLimit: (max: number) => string;
@@ -24,6 +24,8 @@ export type MarkdownExplorerLabels = MarkdownExplorerSpreadsheetLabels & {
24
24
  readonly documentRefreshFailed: (reason: string) => string;
25
25
  readonly showMarkupLabel: string;
26
26
  readonly showMarkup: string;
27
+ readonly showSvgMarkup: string;
28
+ readonly showSpreadsheetMarkup: (format: string) => string;
27
29
  readonly showMarkupNamed: (name: string) => string;
28
30
  readonly editDocumentLabel: string;
29
31
  readonly editDocument: string;
@@ -158,6 +160,7 @@ export type MarkdownExplorerLabels = MarkdownExplorerSpreadsheetLabels & {
158
160
  readonly folderReadmeMissing: (name: string) => string;
159
161
  readonly documentLoading: string;
160
162
  readonly markupLoading: string;
163
+ readonly spreadsheetLoading: string;
161
164
  readonly documentShown: (name: string) => string;
162
165
  readonly documentFailed: (name: string, title: string) => string;
163
166
  readonly announcementSequence: (messages: readonly string[]) => string;
@@ -194,6 +197,13 @@ export type MarkdownExplorerLabels = MarkdownExplorerSpreadsheetLabels & {
194
197
  readonly mediaUnsupported: string;
195
198
  readonly fileNotShown: string;
196
199
  readonly pdfNotShown: string;
200
+ readonly spreadsheetFirstSheetOnly: string;
201
+ readonly spreadsheetTruncated: string;
202
+ readonly spreadsheetUnreadableEncoding: (encodings: readonly string[]) => string;
203
+ readonly spreadsheetEmpty: string;
204
+ readonly spreadsheetNotText: string;
205
+ readonly spreadsheetLongRow: string;
206
+ readonly spreadsheetFullscreen: (name: string) => string;
197
207
  readonly viewerLoading: string;
198
208
  readonly viewerErrorPrefix: string;
199
209
  readonly viewerStyleTitle: string;
@@ -237,6 +247,17 @@ export type MarkdownExplorerLabels = MarkdownExplorerSpreadsheetLabels & {
237
247
  readonly viewerEmbeddedVideo: string;
238
248
  readonly viewerEmbeddedPost: string;
239
249
  readonly viewerEmbeddedFrame: string;
250
+ readonly viewerBlockFailed: string;
251
+ readonly viewerSvgImageToolbar: string;
252
+ readonly viewerSvgImageSource: string;
253
+ readonly viewerSvgImageSourceRegion: string;
254
+ readonly viewerSvgImageLoading: string;
255
+ readonly viewerSvgImageFailed: string;
256
+ readonly viewerSvgImageRetry: string;
257
+ readonly viewerSvgImageTruncated: string;
258
+ readonly viewerSvgImageCopy: string;
259
+ readonly viewerSvgImageCopied: string;
260
+ readonly viewerSvgImageCopyFailed: string;
240
261
  readonly multiRegion: string;
241
262
  readonly multiEmpty: string;
242
263
  readonly panelLimit: (max: number) => string;
@@ -0,0 +1,4 @@
1
+ export declare const legacyTextEncodingOf: (label: string) => string;
2
+ export declare const textEncodingsOf: (bytes: Uint8Array, complete: boolean, legacyEncoding: string | null) => readonly string[];
3
+ export declare const decodeText: (bytes: Uint8Array, complete: boolean, legacyEncoding: string | null) => string | null;
4
+ export declare const decodeTextLeniently: (bytes: Uint8Array, complete: boolean, legacyEncoding: string | null) => string;
@@ -0,0 +1,4 @@
1
+ export declare const legacyTextEncodingOf: (label: string) => string;
2
+ export declare const textEncodingsOf: (bytes: Uint8Array, complete: boolean, legacyEncoding: string | null) => readonly string[];
3
+ export declare const decodeText: (bytes: Uint8Array, complete: boolean, legacyEncoding: string | null) => string | null;
4
+ export declare const decodeTextLeniently: (bytes: Uint8Array, complete: boolean, legacyEncoding: string | null) => string;