@autumnsgrove/groveengine 0.6.1 → 0.6.3
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/auth/jwt.d.ts +10 -4
- package/dist/auth/jwt.js +18 -4
- package/dist/auth/session.d.ts +22 -15
- package/dist/auth/session.js +35 -16
- package/dist/components/admin/GutterManager.svelte +81 -139
- package/dist/components/admin/GutterManager.svelte.d.ts +6 -6
- package/dist/components/admin/MarkdownEditor.svelte +80 -23
- package/dist/components/admin/MarkdownEditor.svelte.d.ts +14 -8
- package/dist/components/admin/composables/useAmbientSounds.svelte.d.ts +52 -2
- package/dist/components/admin/composables/useAmbientSounds.svelte.js +38 -4
- package/dist/components/admin/composables/useCommandPalette.svelte.d.ts +80 -10
- package/dist/components/admin/composables/useCommandPalette.svelte.js +45 -5
- package/dist/components/admin/composables/useDraftManager.svelte.d.ts +76 -14
- package/dist/components/admin/composables/useDraftManager.svelte.js +44 -10
- package/dist/components/admin/composables/useEditorTheme.svelte.d.ts +168 -2
- package/dist/components/admin/composables/useEditorTheme.svelte.js +40 -7
- package/dist/components/admin/composables/useSlashCommands.svelte.d.ts +94 -22
- package/dist/components/admin/composables/useSlashCommands.svelte.js +58 -9
- package/dist/components/admin/composables/useSnippets.svelte.d.ts +51 -2
- package/dist/components/admin/composables/useSnippets.svelte.js +35 -3
- package/dist/components/admin/composables/useWritingSession.svelte.d.ts +64 -6
- package/dist/components/admin/composables/useWritingSession.svelte.js +42 -5
- package/dist/components/custom/ContentWithGutter.svelte +53 -23
- package/dist/components/custom/ContentWithGutter.svelte.d.ts +6 -14
- package/dist/components/custom/GutterItem.svelte +1 -1
- package/dist/components/custom/LeftGutter.svelte +43 -13
- package/dist/components/custom/LeftGutter.svelte.d.ts +6 -6
- package/dist/config/ai-models.js +1 -1
- package/dist/groveauth/client.js +11 -11
- package/dist/index.d.ts +3 -1
- package/dist/index.js +2 -2
- package/dist/server/logger.d.ts +74 -26
- package/dist/server/logger.js +133 -184
- package/dist/server/services/cache.js +1 -10
- package/dist/ui/components/charts/ActivityOverview.svelte +14 -3
- package/dist/ui/components/charts/ActivityOverview.svelte.d.ts +10 -7
- package/dist/ui/components/charts/RepoBreakdown.svelte +9 -3
- package/dist/ui/components/charts/RepoBreakdown.svelte.d.ts +12 -11
- package/dist/ui/components/charts/Sparkline.svelte +18 -7
- package/dist/ui/components/charts/Sparkline.svelte.d.ts +21 -2
- package/dist/ui/components/gallery/ImageGallery.svelte +12 -8
- package/dist/ui/components/gallery/ImageGallery.svelte.d.ts +2 -2
- package/dist/ui/components/gallery/Lightbox.svelte +5 -2
- package/dist/ui/components/gallery/ZoomableImage.svelte +8 -5
- package/dist/ui/components/primitives/accordion/index.d.ts +1 -1
- package/dist/ui/components/primitives/input/input.svelte.d.ts +1 -1
- package/dist/ui/components/primitives/tabs/index.d.ts +1 -1
- package/dist/ui/components/primitives/textarea/textarea.svelte.d.ts +1 -1
- package/dist/ui/components/ui/Button.svelte +5 -0
- package/dist/ui/components/ui/Button.svelte.d.ts +4 -1
- package/dist/ui/components/ui/Input.svelte +4 -0
- package/dist/ui/components/ui/Input.svelte.d.ts +3 -1
- package/dist/ui/components/ui/Logo.svelte +86 -0
- package/dist/ui/components/ui/Logo.svelte.d.ts +25 -0
- package/dist/ui/components/ui/LogoLoader.svelte +71 -0
- package/dist/ui/components/ui/LogoLoader.svelte.d.ts +9 -0
- package/dist/ui/components/ui/index.d.ts +2 -0
- package/dist/ui/components/ui/index.js +2 -0
- package/dist/ui/tailwind.preset.js +8 -8
- package/dist/utils/api.js +2 -1
- package/dist/utils/debounce.d.ts +4 -3
- package/dist/utils/debounce.js +10 -6
- package/dist/utils/gallery.d.ts +58 -32
- package/dist/utils/gallery.js +111 -129
- package/dist/utils/gutter.d.ts +47 -26
- package/dist/utils/gutter.js +116 -124
- package/dist/utils/imageProcessor.d.ts +66 -19
- package/dist/utils/imageProcessor.js +31 -10
- package/dist/utils/index.d.ts +11 -11
- package/dist/utils/index.js +4 -3
- package/dist/utils/json.js +1 -1
- package/dist/utils/markdown.d.ts +183 -103
- package/dist/utils/markdown.js +517 -678
- package/dist/utils/sanitize.d.ts +22 -12
- package/dist/utils/sanitize.js +268 -282
- package/dist/utils/validation.js +4 -3
- package/package.json +4 -3
package/dist/utils/gallery.d.ts
CHANGED
|
@@ -5,62 +5,88 @@
|
|
|
5
5
|
* - minecraft/build_2024-12-01.png → category: minecraft, date: 2024-12-01
|
|
6
6
|
* - selfies/2024-summer.jpg → category: selfies, slug: 2024-summer
|
|
7
7
|
*/
|
|
8
|
+
/** Parsed metadata from an image filename */
|
|
9
|
+
export interface ParsedImageMetadata {
|
|
10
|
+
category: string | null;
|
|
11
|
+
date: string | null;
|
|
12
|
+
slug: string;
|
|
13
|
+
filename: string;
|
|
14
|
+
extension: string | null;
|
|
15
|
+
r2Key: string;
|
|
16
|
+
}
|
|
17
|
+
/** Tag object associated with an image */
|
|
18
|
+
export interface ImageTag {
|
|
19
|
+
slug: string;
|
|
20
|
+
name?: string;
|
|
21
|
+
}
|
|
22
|
+
/** Gallery image object */
|
|
23
|
+
export interface GalleryImage {
|
|
24
|
+
r2_key?: string;
|
|
25
|
+
key?: string;
|
|
26
|
+
custom_title?: string;
|
|
27
|
+
custom_date?: string;
|
|
28
|
+
custom_description?: string;
|
|
29
|
+
parsed_slug?: string;
|
|
30
|
+
parsed_date?: string;
|
|
31
|
+
parsed_category?: string;
|
|
32
|
+
tags?: ImageTag[];
|
|
33
|
+
}
|
|
8
34
|
/**
|
|
9
35
|
* Parse a filename to extract metadata
|
|
10
|
-
* @param
|
|
11
|
-
* @returns
|
|
36
|
+
* @param r2Key - R2 object key (e.g., 'minecraft/build.png' or '2025-01-15_photo.jpg')
|
|
37
|
+
* @returns Parsed metadata: { category, date, slug, filename, extension }
|
|
12
38
|
*/
|
|
13
|
-
export function parseImageFilename(r2Key: string):
|
|
39
|
+
export declare function parseImageFilename(r2Key: string): ParsedImageMetadata;
|
|
14
40
|
/**
|
|
15
41
|
* Get display title for an image (uses custom title or parsed slug)
|
|
16
|
-
* @param
|
|
17
|
-
* @returns
|
|
42
|
+
* @param image - Gallery image object
|
|
43
|
+
* @returns Human-readable title
|
|
18
44
|
*/
|
|
19
|
-
export function getImageTitle(image:
|
|
45
|
+
export declare function getImageTitle(image: GalleryImage): string;
|
|
20
46
|
/**
|
|
21
47
|
* Get display date for an image (uses custom date or parsed date)
|
|
22
|
-
* @param
|
|
23
|
-
* @returns
|
|
48
|
+
* @param image - Gallery image object
|
|
49
|
+
* @returns YYYY-MM-DD date string or null
|
|
24
50
|
*/
|
|
25
|
-
export function getImageDate(image:
|
|
51
|
+
export declare function getImageDate(image: GalleryImage): string | null;
|
|
26
52
|
/**
|
|
27
53
|
* Filter images by search query (searches title, slug, filename)
|
|
28
|
-
* @param
|
|
29
|
-
* @param
|
|
30
|
-
* @returns
|
|
54
|
+
* @param images - Array of gallery images
|
|
55
|
+
* @param query - Search query
|
|
56
|
+
* @returns Filtered images
|
|
31
57
|
*/
|
|
32
|
-
export function searchImages(images:
|
|
58
|
+
export declare function searchImages(images: GalleryImage[], query: string): GalleryImage[];
|
|
33
59
|
/**
|
|
34
60
|
* Filter images by date range
|
|
35
|
-
* @param
|
|
36
|
-
* @param
|
|
37
|
-
* @param
|
|
38
|
-
* @returns
|
|
61
|
+
* @param images - Array of gallery images
|
|
62
|
+
* @param startDate - YYYY-MM-DD start date (inclusive)
|
|
63
|
+
* @param endDate - YYYY-MM-DD end date (inclusive)
|
|
64
|
+
* @returns Filtered images
|
|
39
65
|
*/
|
|
40
|
-
export function filterImagesByDateRange(images:
|
|
66
|
+
export declare function filterImagesByDateRange(images: GalleryImage[], startDate: string | null, endDate: string | null): GalleryImage[];
|
|
41
67
|
/**
|
|
42
68
|
* Filter images by tags
|
|
43
|
-
* @param
|
|
44
|
-
* @param
|
|
45
|
-
* @returns
|
|
69
|
+
* @param images - Array of gallery images (must include 'tags' array)
|
|
70
|
+
* @param tagSlugs - Array of tag slugs to filter by
|
|
71
|
+
* @returns Filtered images
|
|
46
72
|
*/
|
|
47
|
-
export function filterImagesByTags(images:
|
|
73
|
+
export declare function filterImagesByTags(images: GalleryImage[], tagSlugs: string[]): GalleryImage[];
|
|
48
74
|
/**
|
|
49
75
|
* Filter images by category (parsed from path)
|
|
50
|
-
* @param
|
|
51
|
-
* @param
|
|
52
|
-
* @returns
|
|
76
|
+
* @param images - Array of gallery images
|
|
77
|
+
* @param category - Category to filter by
|
|
78
|
+
* @returns Filtered images
|
|
53
79
|
*/
|
|
54
|
-
export function filterImagesByCategory(images:
|
|
80
|
+
export declare function filterImagesByCategory(images: GalleryImage[], category: string | null): GalleryImage[];
|
|
55
81
|
/**
|
|
56
82
|
* Extract unique years from image dates
|
|
57
|
-
* @param
|
|
58
|
-
* @returns
|
|
83
|
+
* @param images - Array of gallery images
|
|
84
|
+
* @returns Sorted array of years (descending)
|
|
59
85
|
*/
|
|
60
|
-
export function getAvailableYears(images:
|
|
86
|
+
export declare function getAvailableYears(images: GalleryImage[]): string[];
|
|
61
87
|
/**
|
|
62
88
|
* Extract unique categories from images
|
|
63
|
-
* @param
|
|
64
|
-
* @returns
|
|
89
|
+
* @param images - Array of gallery images
|
|
90
|
+
* @returns Sorted array of categories
|
|
65
91
|
*/
|
|
66
|
-
export function getAvailableCategories(images:
|
|
92
|
+
export declare function getAvailableCategories(images: GalleryImage[]): string[];
|
package/dist/utils/gallery.js
CHANGED
|
@@ -5,177 +5,159 @@
|
|
|
5
5
|
* - minecraft/build_2024-12-01.png → category: minecraft, date: 2024-12-01
|
|
6
6
|
* - selfies/2024-summer.jpg → category: selfies, slug: 2024-summer
|
|
7
7
|
*/
|
|
8
|
-
|
|
9
8
|
/**
|
|
10
9
|
* Parse a filename to extract metadata
|
|
11
|
-
* @param
|
|
12
|
-
* @returns
|
|
10
|
+
* @param r2Key - R2 object key (e.g., 'minecraft/build.png' or '2025-01-15_photo.jpg')
|
|
11
|
+
* @returns Parsed metadata: { category, date, slug, filename, extension }
|
|
13
12
|
*/
|
|
14
13
|
export function parseImageFilename(r2Key) {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
slug: slug || 'untitled',
|
|
41
|
-
filename,
|
|
42
|
-
extension,
|
|
43
|
-
r2Key
|
|
44
|
-
};
|
|
14
|
+
const parts = r2Key.split("/");
|
|
15
|
+
const filename = parts[parts.length - 1];
|
|
16
|
+
const category = parts.length > 1 ? parts[0] : null;
|
|
17
|
+
// Extract extension
|
|
18
|
+
const extMatch = filename.match(/\.([^.]+)$/);
|
|
19
|
+
const extension = extMatch ? extMatch[1] : null;
|
|
20
|
+
const nameWithoutExt = filename.replace(/\.[^.]+$/, "");
|
|
21
|
+
// Try to extract date (YYYY-MM-DD or YYYY_MM_DD)
|
|
22
|
+
const dateMatch = nameWithoutExt.match(/(\d{4}[-_]\d{2}[-_]\d{2})/);
|
|
23
|
+
const date = dateMatch ? dateMatch[1].replace(/_/g, "-") : null;
|
|
24
|
+
// Extract slug (remove date prefix if present)
|
|
25
|
+
let slug = nameWithoutExt;
|
|
26
|
+
if (date) {
|
|
27
|
+
slug = slug.replace(date, "").replace(/^[-_]+/, "").replace(/[-_]+$/, "");
|
|
28
|
+
}
|
|
29
|
+
// Clean up slug (convert underscores to hyphens)
|
|
30
|
+
slug = slug.replace(/_/g, "-").toLowerCase();
|
|
31
|
+
return {
|
|
32
|
+
category,
|
|
33
|
+
date,
|
|
34
|
+
slug: slug || "untitled",
|
|
35
|
+
filename,
|
|
36
|
+
extension,
|
|
37
|
+
r2Key,
|
|
38
|
+
};
|
|
45
39
|
}
|
|
46
|
-
|
|
47
40
|
/**
|
|
48
41
|
* Get display title for an image (uses custom title or parsed slug)
|
|
49
|
-
* @param
|
|
50
|
-
* @returns
|
|
42
|
+
* @param image - Gallery image object
|
|
43
|
+
* @returns Human-readable title
|
|
51
44
|
*/
|
|
52
45
|
export function getImageTitle(image) {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
46
|
+
if (image.custom_title)
|
|
47
|
+
return image.custom_title;
|
|
48
|
+
if (image.parsed_slug) {
|
|
49
|
+
// Convert slug to Title Case
|
|
50
|
+
return image.parsed_slug
|
|
51
|
+
.split("-")
|
|
52
|
+
.map((word) => word.charAt(0).toUpperCase() + word.slice(1))
|
|
53
|
+
.join(" ");
|
|
54
|
+
}
|
|
55
|
+
return image.r2_key?.split("/").pop() || image.key?.split("/").pop() || "Untitled";
|
|
62
56
|
}
|
|
63
|
-
|
|
64
57
|
/**
|
|
65
58
|
* Get display date for an image (uses custom date or parsed date)
|
|
66
|
-
* @param
|
|
67
|
-
* @returns
|
|
59
|
+
* @param image - Gallery image object
|
|
60
|
+
* @returns YYYY-MM-DD date string or null
|
|
68
61
|
*/
|
|
69
62
|
export function getImageDate(image) {
|
|
70
|
-
|
|
63
|
+
return image.custom_date || image.parsed_date || null;
|
|
71
64
|
}
|
|
72
|
-
|
|
73
65
|
/**
|
|
74
66
|
* Filter images by search query (searches title, slug, filename)
|
|
75
|
-
* @param
|
|
76
|
-
* @param
|
|
77
|
-
* @returns
|
|
67
|
+
* @param images - Array of gallery images
|
|
68
|
+
* @param query - Search query
|
|
69
|
+
* @returns Filtered images
|
|
78
70
|
*/
|
|
79
71
|
export function searchImages(images, query) {
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
filename.includes(lowerQuery) ||
|
|
94
|
-
description.includes(lowerQuery)
|
|
95
|
-
);
|
|
96
|
-
});
|
|
72
|
+
if (!query)
|
|
73
|
+
return images;
|
|
74
|
+
const lowerQuery = query.toLowerCase();
|
|
75
|
+
return images.filter((img) => {
|
|
76
|
+
const title = getImageTitle(img).toLowerCase();
|
|
77
|
+
const slug = (img.parsed_slug || "").toLowerCase();
|
|
78
|
+
const filename = (img.r2_key || img.key || "").toLowerCase();
|
|
79
|
+
const description = (img.custom_description || "").toLowerCase();
|
|
80
|
+
return (title.includes(lowerQuery) ||
|
|
81
|
+
slug.includes(lowerQuery) ||
|
|
82
|
+
filename.includes(lowerQuery) ||
|
|
83
|
+
description.includes(lowerQuery));
|
|
84
|
+
});
|
|
97
85
|
}
|
|
98
|
-
|
|
99
86
|
/**
|
|
100
87
|
* Filter images by date range
|
|
101
|
-
* @param
|
|
102
|
-
* @param
|
|
103
|
-
* @param
|
|
104
|
-
* @returns
|
|
88
|
+
* @param images - Array of gallery images
|
|
89
|
+
* @param startDate - YYYY-MM-DD start date (inclusive)
|
|
90
|
+
* @param endDate - YYYY-MM-DD end date (inclusive)
|
|
91
|
+
* @returns Filtered images
|
|
105
92
|
*/
|
|
106
93
|
export function filterImagesByDateRange(images, startDate, endDate) {
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
94
|
+
if (!startDate && !endDate)
|
|
95
|
+
return images;
|
|
96
|
+
return images.filter((img) => {
|
|
97
|
+
const imgDate = getImageDate(img);
|
|
98
|
+
if (!imgDate)
|
|
99
|
+
return false;
|
|
100
|
+
if (startDate && imgDate < startDate)
|
|
101
|
+
return false;
|
|
102
|
+
if (endDate && imgDate > endDate)
|
|
103
|
+
return false;
|
|
104
|
+
return true;
|
|
105
|
+
});
|
|
118
106
|
}
|
|
119
|
-
|
|
120
107
|
/**
|
|
121
108
|
* Filter images by tags
|
|
122
|
-
* @param
|
|
123
|
-
* @param
|
|
124
|
-
* @returns
|
|
109
|
+
* @param images - Array of gallery images (must include 'tags' array)
|
|
110
|
+
* @param tagSlugs - Array of tag slugs to filter by
|
|
111
|
+
* @returns Filtered images
|
|
125
112
|
*/
|
|
126
113
|
export function filterImagesByTags(images, tagSlugs) {
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
114
|
+
if (!tagSlugs || tagSlugs.length === 0)
|
|
115
|
+
return images;
|
|
116
|
+
return images.filter((img) => {
|
|
117
|
+
if (!img.tags || img.tags.length === 0)
|
|
118
|
+
return false;
|
|
119
|
+
const imgTagSlugs = img.tags.map((t) => t.slug);
|
|
120
|
+
return tagSlugs.every((slug) => imgTagSlugs.includes(slug));
|
|
121
|
+
});
|
|
134
122
|
}
|
|
135
|
-
|
|
136
123
|
/**
|
|
137
124
|
* Filter images by category (parsed from path)
|
|
138
|
-
* @param
|
|
139
|
-
* @param
|
|
140
|
-
* @returns
|
|
125
|
+
* @param images - Array of gallery images
|
|
126
|
+
* @param category - Category to filter by
|
|
127
|
+
* @returns Filtered images
|
|
141
128
|
*/
|
|
142
129
|
export function filterImagesByCategory(images, category) {
|
|
143
|
-
|
|
144
|
-
|
|
130
|
+
if (!category)
|
|
131
|
+
return images;
|
|
132
|
+
return images.filter((img) => img.parsed_category === category);
|
|
145
133
|
}
|
|
146
|
-
|
|
147
134
|
/**
|
|
148
135
|
* Extract unique years from image dates
|
|
149
|
-
* @param
|
|
150
|
-
* @returns
|
|
136
|
+
* @param images - Array of gallery images
|
|
137
|
+
* @returns Sorted array of years (descending)
|
|
151
138
|
*/
|
|
152
139
|
export function getAvailableYears(images) {
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
return Array.from(years).sort((a, b) => b.localeCompare(a));
|
|
140
|
+
const years = new Set();
|
|
141
|
+
images.forEach((img) => {
|
|
142
|
+
const date = getImageDate(img);
|
|
143
|
+
if (date) {
|
|
144
|
+
const year = date.substring(0, 4);
|
|
145
|
+
years.add(year);
|
|
146
|
+
}
|
|
147
|
+
});
|
|
148
|
+
return Array.from(years).sort((a, b) => b.localeCompare(a));
|
|
164
149
|
}
|
|
165
|
-
|
|
166
150
|
/**
|
|
167
151
|
* Extract unique categories from images
|
|
168
|
-
* @param
|
|
169
|
-
* @returns
|
|
152
|
+
* @param images - Array of gallery images
|
|
153
|
+
* @returns Sorted array of categories
|
|
170
154
|
*/
|
|
171
155
|
export function getAvailableCategories(images) {
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
return Array.from(categories).sort();
|
|
156
|
+
const categories = new Set();
|
|
157
|
+
images.forEach((img) => {
|
|
158
|
+
if (img.parsed_category) {
|
|
159
|
+
categories.add(img.parsed_category);
|
|
160
|
+
}
|
|
161
|
+
});
|
|
162
|
+
return Array.from(categories).sort();
|
|
181
163
|
}
|
package/dist/utils/gutter.d.ts
CHANGED
|
@@ -5,50 +5,71 @@
|
|
|
5
5
|
* and anchor resolution. Used by ContentWithGutter component and related
|
|
6
6
|
* functionality across the site.
|
|
7
7
|
*/
|
|
8
|
+
/** Anchor types supported by the gutter system */
|
|
9
|
+
export type AnchorType = "none" | "paragraph" | "tag" | "header";
|
|
10
|
+
/** Parsed anchor result */
|
|
11
|
+
export interface ParsedAnchor {
|
|
12
|
+
type: AnchorType;
|
|
13
|
+
value: string | number | null;
|
|
14
|
+
}
|
|
15
|
+
/** Header object from markdown parsing */
|
|
16
|
+
export interface Header {
|
|
17
|
+
id: string;
|
|
18
|
+
text: string;
|
|
19
|
+
level?: number;
|
|
20
|
+
}
|
|
21
|
+
/** Gutter item with anchor */
|
|
22
|
+
export interface GutterItem {
|
|
23
|
+
anchor?: string;
|
|
24
|
+
type?: string;
|
|
25
|
+
content?: string;
|
|
26
|
+
src?: string;
|
|
27
|
+
[key: string]: unknown;
|
|
28
|
+
}
|
|
8
29
|
/**
|
|
9
30
|
* Parse anchor string to determine anchor type and value
|
|
10
|
-
* @param
|
|
11
|
-
* @returns
|
|
31
|
+
* @param anchor - The anchor string from manifest
|
|
32
|
+
* @returns Object with type and value properties
|
|
12
33
|
*/
|
|
13
|
-
export function parseAnchor(anchor: string):
|
|
34
|
+
export declare function parseAnchor(anchor: string | undefined | null): ParsedAnchor;
|
|
14
35
|
/**
|
|
15
36
|
* Generate a unique key for an anchor (used for grouping and positioning)
|
|
16
|
-
* @param
|
|
17
|
-
* @param
|
|
18
|
-
* @returns
|
|
37
|
+
* @param anchor - The anchor string
|
|
38
|
+
* @param headers - Array of header objects with id and text
|
|
39
|
+
* @returns A unique key for the anchor
|
|
19
40
|
*/
|
|
20
|
-
export function getAnchorKey(anchor: string, headers?:
|
|
41
|
+
export declare function getAnchorKey(anchor: string, headers?: Header[]): string;
|
|
21
42
|
/**
|
|
22
43
|
* Get all unique anchors from items (preserving order)
|
|
23
|
-
* @param
|
|
24
|
-
* @returns
|
|
44
|
+
* @param items - Array of gutter items
|
|
45
|
+
* @returns Array of unique anchor strings
|
|
25
46
|
*/
|
|
26
|
-
export function getUniqueAnchors(items:
|
|
47
|
+
export declare function getUniqueAnchors(items: GutterItem[] | undefined | null): string[];
|
|
27
48
|
/**
|
|
28
49
|
* Get display label for an anchor (used in overflow section)
|
|
29
|
-
* @param
|
|
30
|
-
* @returns
|
|
50
|
+
* @param anchor - The anchor string
|
|
51
|
+
* @returns Human-readable label for the anchor
|
|
31
52
|
*/
|
|
32
|
-
export function getAnchorLabel(anchor: string): string;
|
|
53
|
+
export declare function getAnchorLabel(anchor: string): string;
|
|
33
54
|
/**
|
|
34
55
|
* Get items that match a specific anchor
|
|
35
|
-
* @param
|
|
36
|
-
* @param
|
|
37
|
-
* @returns
|
|
56
|
+
* @param items - Array of gutter items
|
|
57
|
+
* @param anchor - The anchor to match
|
|
58
|
+
* @returns Items matching the anchor
|
|
38
59
|
*/
|
|
39
|
-
export function getItemsForAnchor(items:
|
|
60
|
+
export declare function getItemsForAnchor(items: GutterItem[] | undefined | null, anchor: string): GutterItem[];
|
|
40
61
|
/**
|
|
41
62
|
* Get items that don't have a valid anchor (orphan items shown at top)
|
|
42
|
-
* @param
|
|
43
|
-
* @param
|
|
44
|
-
* @returns
|
|
63
|
+
* @param items - Array of gutter items
|
|
64
|
+
* @param headers - Array of header objects
|
|
65
|
+
* @returns Items without valid anchors
|
|
45
66
|
*/
|
|
46
|
-
export function getOrphanItems(items:
|
|
67
|
+
export declare function getOrphanItems(items: GutterItem[] | undefined | null, headers?: Header[]): GutterItem[];
|
|
47
68
|
/**
|
|
48
69
|
* Find the DOM element for an anchor within a content element
|
|
49
|
-
* @param
|
|
50
|
-
* @param
|
|
51
|
-
* @param
|
|
52
|
-
* @returns
|
|
70
|
+
* @param anchor - The anchor string
|
|
71
|
+
* @param contentEl - The content container element
|
|
72
|
+
* @param headers - Array of header objects
|
|
73
|
+
* @returns The DOM element or null if not found
|
|
53
74
|
*/
|
|
54
|
-
export function findAnchorElement(anchor: string, contentEl: HTMLElement, headers?:
|
|
75
|
+
export declare function findAnchorElement(anchor: string, contentEl: HTMLElement | null, headers?: Header[]): HTMLElement | null;
|