@conundrum/ts 0.0.3 → 0.0.5

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 (63) hide show
  1. package/dist/blog_post_nav-BZQvuEof.mjs +458 -0
  2. package/dist/blog_post_nav-BZQvuEof.mjs.map +1 -0
  3. package/dist/blog_post_nav-BpUDqfSu.js +457 -0
  4. package/dist/blog_post_nav-BpUDqfSu.js.map +1 -0
  5. package/dist/codegenTypeshare.cjs +6 -0
  6. package/dist/codegenTypeshare.cjs.map +1 -1
  7. package/dist/codegenTypeshare.mjs +6 -0
  8. package/dist/codegenTypeshare.mjs.map +1 -1
  9. package/dist/framework.cjs +1 -0
  10. package/dist/framework.cjs.map +1 -1
  11. package/dist/framework.mjs +2 -1
  12. package/dist/server.cjs +155 -0
  13. package/dist/server.cjs.map +1 -0
  14. package/dist/server.d.ts +2 -0
  15. package/dist/server.mjs +155 -0
  16. package/dist/server.mjs.map +1 -0
  17. package/dist/src/code_gen/typeshare/conundrum.d.ts +62 -48
  18. package/dist/src/code_gen/typeshare/conundrum.d.ts.map +1 -1
  19. package/dist/src/prebuilt_ui/blog/components/blog_index.d.ts +34 -0
  20. package/dist/src/prebuilt_ui/blog/components/blog_index.d.ts.map +1 -0
  21. package/dist/src/prebuilt_ui/blog/components/blog_post_nav.d.ts +19 -0
  22. package/dist/src/prebuilt_ui/blog/components/blog_post_nav.d.ts.map +1 -0
  23. package/dist/src/prebuilt_ui/blog/components/blog_shell.d.ts +16 -0
  24. package/dist/src/prebuilt_ui/blog/components/blog_shell.d.ts.map +1 -0
  25. package/dist/src/prebuilt_ui/blog/components/blog_sidebar.d.ts +24 -0
  26. package/dist/src/prebuilt_ui/blog/components/blog_sidebar.d.ts.map +1 -0
  27. package/dist/src/prebuilt_ui/blog/components/shared.d.ts +25 -0
  28. package/dist/src/prebuilt_ui/blog/components/shared.d.ts.map +1 -0
  29. package/dist/src/prebuilt_ui/blog/index.d.ts +7 -2
  30. package/dist/src/prebuilt_ui/blog/index.d.ts.map +1 -1
  31. package/dist/src/prebuilt_ui/blog/index_ssr.d.ts +7 -2
  32. package/dist/src/prebuilt_ui/blog/index_ssr.d.ts.map +1 -1
  33. package/dist/src/prebuilt_ui/blog/model/blog_filter.d.ts +26 -0
  34. package/dist/src/prebuilt_ui/blog/model/blog_filter.d.ts.map +1 -0
  35. package/dist/src/prebuilt_ui/blog/model/blog_model.d.ts +60 -0
  36. package/dist/src/prebuilt_ui/blog/model/blog_model.d.ts.map +1 -0
  37. package/dist/src/prebuilt_ui/blog/{index_page → model}/summarize_blog_post.d.ts +10 -7
  38. package/dist/src/prebuilt_ui/blog/model/summarize_blog_post.d.ts.map +1 -0
  39. package/dist/src/server/conundrum_database.d.ts +32 -0
  40. package/dist/src/server/conundrum_database.d.ts.map +1 -0
  41. package/dist/src/server/create_search_route.d.ts +28 -0
  42. package/dist/src/server/create_search_route.d.ts.map +1 -0
  43. package/dist/src/server/index.d.ts +4 -0
  44. package/dist/src/server/index.d.ts.map +1 -0
  45. package/dist/src/server/search_conundrum.d.ts +46 -0
  46. package/dist/src/server/search_conundrum.d.ts.map +1 -0
  47. package/dist/uiBlog.cjs +19 -8
  48. package/dist/uiBlog.cjs.map +1 -1
  49. package/dist/uiBlog.mjs +144 -133
  50. package/dist/uiBlog.mjs.map +1 -1
  51. package/dist/uiBlogSSR.cjs +19 -8
  52. package/dist/uiBlogSSR.cjs.map +1 -1
  53. package/dist/uiBlogSSR.mjs +18 -7
  54. package/package.json +13 -5
  55. package/src/prebuilt_ui/blog/blog.css +709 -0
  56. package/dist/blog_index-DbEZPK0j.mjs +0 -223
  57. package/dist/blog_index-DbEZPK0j.mjs.map +0 -1
  58. package/dist/blog_index-Dd7fy5LS.js +0 -222
  59. package/dist/blog_index-Dd7fy5LS.js.map +0 -1
  60. package/dist/src/prebuilt_ui/blog/index_page/blog_index.d.ts +0 -63
  61. package/dist/src/prebuilt_ui/blog/index_page/blog_index.d.ts.map +0 -1
  62. package/dist/src/prebuilt_ui/blog/index_page/summarize_blog_post.d.ts.map +0 -1
  63. package/src/prebuilt_ui/blog/blog_index.css +0 -355
@@ -0,0 +1,16 @@
1
+ import { ReactNode } from 'react';
2
+ import { BlogSidebarProps } from './blog_sidebar';
3
+ export interface BlogShellProps extends Omit<BlogSidebarProps, "idPrefix" | "className"> {
4
+ children: ReactNode;
5
+ className?: string;
6
+ }
7
+ /**
8
+ * The blog's page layout: the sidebar beside the content on wide screens, and a "Browse" menu
9
+ * above it on narrow ones. Both are in the server-rendered HTML and CSS picks one, so nothing
10
+ * moves once the page has loaded. The page scrolls normally; the sidebar stays in place.
11
+ */
12
+ export declare const BlogShell: {
13
+ ({ children, className, banner, ...sidebar }: BlogShellProps): ReactNode;
14
+ displayName: string;
15
+ };
16
+ //# sourceMappingURL=blog_shell.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"blog_shell.d.ts","sourceRoot":"","sources":["../../../../../src/prebuilt_ui/blog/components/blog_shell.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAC9C,OAAO,EAAe,KAAK,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAGpE,MAAM,WAAW,cAAe,SAAQ,IAAI,CAAC,gBAAgB,EAAE,UAAU,GAAG,WAAW,CAAC;IACpF,QAAQ,EAAE,SAAS,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;;;GAIG;AACH,eAAO,MAAM,SAAS;kDAAiD,cAAc,GAAG,SAAS;;CAkBhG,CAAC"}
@@ -0,0 +1,24 @@
1
+ import { ReactNode } from 'react';
2
+ import { BlogModel } from '../model/blog_model';
3
+ import { BlogFilter } from '../model/blog_filter';
4
+ export interface BlogSidebarProps {
5
+ model: BlogModel;
6
+ /** What the index is showing, to mark the current subject or tag. */
7
+ filter?: BlogFilter;
8
+ /** The relative path of the post being read, on post pages. Its subject opens to list its posts. */
9
+ activePost?: string | null;
10
+ /** Shown at the top, e.g. your logo linking home. */
11
+ banner?: ReactNode;
12
+ /** Prefix for element ids, so two copies of the sidebar can share a page. */
13
+ idPrefix?: string;
14
+ className?: string;
15
+ }
16
+ /**
17
+ * The blog's navigation: search, every subject with its post count, and tags. The subject being
18
+ * read opens to list its posts. Plain links and a GET form, so it works without JavaScript.
19
+ */
20
+ export declare const BlogSidebar: {
21
+ ({ model, filter, activePost, banner, idPrefix, className, }: BlogSidebarProps): ReactNode;
22
+ displayName: string;
23
+ };
24
+ //# sourceMappingURL=blog_sidebar.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"blog_sidebar.d.ts","sourceRoot":"","sources":["../../../../../src/prebuilt_ui/blog/components/blog_sidebar.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAC9C,OAAO,EAAE,KAAK,SAAS,EAAc,MAAM,qBAAqB,CAAC;AACjE,OAAO,EAAE,KAAK,UAAU,EAA8B,MAAM,sBAAsB,CAAC;AAGnF,MAAM,WAAW,gBAAgB;IAC7B,KAAK,EAAE,SAAS,CAAC;IACjB,qEAAqE;IACrE,MAAM,CAAC,EAAE,UAAU,CAAC;IACpB,oGAAoG;IACpG,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,qDAAqD;IACrD,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB,6EAA6E;IAC7E,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;CACtB;AAID;;;GAGG;AACH,eAAO,MAAM,WAAW;kEAOrB,gBAAgB,GAAG,SAAS;;CAqG9B,CAAC"}
@@ -0,0 +1,25 @@
1
+ import { CSSProperties, ReactNode } from 'react';
2
+ import { BlogPost } from '../model/blog_model';
3
+ /** Sets `--cdrm-subject` for a subject's marker. */
4
+ export declare const subjectStyle: (color: string) => CSSProperties;
5
+ export declare const SubjectSwatch: {
6
+ ({ color }: {
7
+ color: string;
8
+ }): ReactNode;
9
+ displayName: string;
10
+ };
11
+ export declare const readingTime: (minutes: number) => string;
12
+ /** A post's subject, topic and reading time. */
13
+ export declare const PostMeta: {
14
+ ({ post, showSubject, }: {
15
+ post: BlogPost;
16
+ showSubject?: boolean;
17
+ }): ReactNode;
18
+ displayName: string;
19
+ };
20
+ export declare const SearchIcon: {
21
+ (): ReactNode;
22
+ displayName: string;
23
+ };
24
+ export declare const classNames: (...names: (string | false | null | undefined)[]) => string;
25
+ //# sourceMappingURL=shared.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../../../../../src/prebuilt_ui/blog/components/shared.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,KAAK,aAAa,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAClE,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAEpD,oDAAoD;AACpD,eAAO,MAAM,YAAY,GAAI,OAAO,MAAM,KAAG,aACK,CAAC;AAEnD,eAAO,MAAM,aAAa;gBAAe;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,GAAG,SAAS;;CAErE,CAAC;AAIF,eAAO,MAAM,WAAW,GAAI,SAAS,MAAM,KAAG,MAA+B,CAAC;AAE9E,gDAAgD;AAChD,eAAO,MAAM,QAAQ;6BAGlB;QACC,IAAI,EAAE,QAAQ,CAAC;QACf,WAAW,CAAC,EAAE,OAAO,CAAC;KACzB,GAAG,SAAS;;CAWZ,CAAC;AAIF,eAAO,MAAM,UAAU;QAAO,SAAS;;CAgBtC,CAAC;AAIF,eAAO,MAAM,UAAU,GAAI,GAAG,OAAO,CAAC,MAAM,GAAG,KAAK,GAAG,IAAI,GAAG,SAAS,CAAC,EAAE,KAAG,MAC1C,CAAC"}
@@ -2,6 +2,11 @@ export * from './sidebar/sidebar_item_panel';
2
2
  export * from './sidebar/sidebar_item_container';
3
3
  export * from './sidebar/sidebar_toggle_button';
4
4
  export type * from './types';
5
- export * from './index_page/blog_index';
6
- export * from './index_page/summarize_blog_post';
5
+ export * from './model/summarize_blog_post';
6
+ export * from './model/blog_model';
7
+ export * from './model/blog_filter';
8
+ export * from './components/blog_shell';
9
+ export * from './components/blog_sidebar';
10
+ export * from './components/blog_index';
11
+ export * from './components/blog_post_nav';
7
12
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/prebuilt_ui/blog/index.ts"],"names":[],"mappings":"AAAA,cAAc,8BAA8B,CAAC;AAC7C,cAAc,kCAAkC,CAAC;AACjD,cAAc,iCAAiC,CAAC;AAChD,mBAAmB,SAAS,CAAC;AAC7B,cAAc,yBAAyB,CAAC;AACxC,cAAc,kCAAkC,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/prebuilt_ui/blog/index.ts"],"names":[],"mappings":"AAAA,cAAc,8BAA8B,CAAC;AAC7C,cAAc,kCAAkC,CAAC;AACjD,cAAc,iCAAiC,CAAC;AAChD,mBAAmB,SAAS,CAAC;AAC7B,cAAc,6BAA6B,CAAC;AAC5C,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,yBAAyB,CAAC;AACxC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,yBAAyB,CAAC;AACxC,cAAc,4BAA4B,CAAC"}
@@ -1,6 +1,11 @@
1
1
  export * from './sidebar/sidebar_panel_item';
2
2
  export * from './sidebar/permanent_left_sidebar';
3
3
  export * from './methods/blog_search_params_to_query';
4
- export * from './index_page/blog_index';
5
- export * from './index_page/summarize_blog_post';
4
+ export * from './model/summarize_blog_post';
5
+ export * from './model/blog_model';
6
+ export * from './model/blog_filter';
7
+ export * from './components/blog_shell';
8
+ export * from './components/blog_sidebar';
9
+ export * from './components/blog_index';
10
+ export * from './components/blog_post_nav';
6
11
  //# sourceMappingURL=index_ssr.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index_ssr.d.ts","sourceRoot":"","sources":["../../../../src/prebuilt_ui/blog/index_ssr.ts"],"names":[],"mappings":"AAAA,cAAc,8BAA8B,CAAC;AAC7C,cAAc,kCAAkC,CAAC;AACjD,cAAc,uCAAuC,CAAC;AACtD,cAAc,yBAAyB,CAAC;AACxC,cAAc,kCAAkC,CAAC"}
1
+ {"version":3,"file":"index_ssr.d.ts","sourceRoot":"","sources":["../../../../src/prebuilt_ui/blog/index_ssr.ts"],"names":[],"mappings":"AAAA,cAAc,8BAA8B,CAAC;AAC7C,cAAc,kCAAkC,CAAC;AACjD,cAAc,uCAAuC,CAAC;AACtD,cAAc,6BAA6B,CAAC;AAC5C,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,yBAAyB,CAAC;AACxC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,yBAAyB,CAAC;AACxC,cAAc,4BAA4B,CAAC"}
@@ -0,0 +1,26 @@
1
+ import { BlogModel, BlogPost } from './blog_model';
2
+ /** What the blog index is showing. Every field narrows the posts; none shows them all. */
3
+ export interface BlogFilter {
4
+ subject?: string | null;
5
+ topic?: string | null;
6
+ tag?: string | null;
7
+ /** Words to search for in titles, summaries, subjects, topics, tags and post text. */
8
+ query?: string | null;
9
+ }
10
+ type SearchParamValue = string | string[] | undefined | null;
11
+ /**
12
+ * Reads a filter from URL search parameters: `subject`, `topic`, `tag` (or `tagAnyOf`) and `q`.
13
+ * Works with Next.js's `searchParams` and with `URLSearchParams`.
14
+ */
15
+ export declare const blogFilterFromSearchParams: (params: Record<string, SearchParamValue> | URLSearchParams | null | undefined) => BlogFilter;
16
+ /** True when the filter narrows the posts at all. */
17
+ export declare const isFiltering: (filter: BlogFilter) => boolean;
18
+ /** The URL of the blog index showing `filter`. */
19
+ export declare const blogFilterUrl: (baseUrl: string, filter?: BlogFilter) => string;
20
+ /**
21
+ * The posts matching `filter`. Searches rank matches in titles first, then summaries, subjects,
22
+ * topics and tags, then the text of the post; every word has to match somewhere.
23
+ */
24
+ export declare const filterBlogPosts: (model: BlogModel, filter: BlogFilter) => BlogPost[];
25
+ export {};
26
+ //# sourceMappingURL=blog_filter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"blog_filter.d.ts","sourceRoot":"","sources":["../../../../../src/prebuilt_ui/blog/model/blog_filter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,QAAQ,EAAc,MAAM,cAAc,CAAC;AAEzE,0FAA0F;AAC1F,MAAM,WAAW,UAAU;IACvB,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,GAAG,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,sFAAsF;IACtF,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACzB;AAED,KAAK,gBAAgB,GAAG,MAAM,GAAG,MAAM,EAAE,GAAG,SAAS,GAAG,IAAI,CAAC;AAO7D;;;GAGG;AACH,eAAO,MAAM,0BAA0B,GACnC,QAAQ,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAAC,GAAG,eAAe,GAAG,IAAI,GAAG,SAAS,KAC9E,UAWF,CAAC;AAEF,qDAAqD;AACrD,eAAO,MAAM,WAAW,GAAI,QAAQ,UAAU,KAAG,OACwB,CAAC;AAE1E,kDAAkD;AAClD,eAAO,MAAM,aAAa,GAAI,SAAS,MAAM,EAAE,SAAQ,UAAe,KAAG,MAQxE,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,eAAe,GAAI,OAAO,SAAS,EAAE,QAAQ,UAAU,KAAG,QAAQ,EA8B9E,CAAC"}
@@ -0,0 +1,60 @@
1
+ import { BlogConfig } from '../../../code_gen/typeshare/conundrum';
2
+ import { AnyBlogFile, BlogPostSummary } from './summarize_blog_post';
3
+ /** A post with its subject's color. */
4
+ export interface BlogPost extends BlogPostSummary {
5
+ /** The subject's CSS color. */
6
+ color: string;
7
+ }
8
+ export interface BlogSubject {
9
+ name: string;
10
+ color: string;
11
+ posts: BlogPost[];
12
+ /** The subject's topics, in the order they first appear. */
13
+ topics: {
14
+ name: string;
15
+ count: number;
16
+ }[];
17
+ }
18
+ /** Everything the blog components show, built once per request by {@link createBlogModel}. */
19
+ export interface BlogModel {
20
+ title: string;
21
+ description: string | null;
22
+ /** The blog's URL, e.g. `/blog`. */
23
+ baseUrl: string;
24
+ /** Every listed post, in the output's order. */
25
+ posts: BlogPost[];
26
+ /** The featured posts, lead first. */
27
+ featured: BlogPost[];
28
+ /** Subjects with at least one listed post, in display order. */
29
+ subjects: BlogSubject[];
30
+ /** Tags with their post counts: featured tags first, then by count. */
31
+ tags: {
32
+ name: string;
33
+ count: number;
34
+ }[];
35
+ /** How many posts each subject shows on the front page. */
36
+ postsPerSubject: number;
37
+ }
38
+ export interface BlogModelOptions {
39
+ /** The blog's URL. Default: `/blog`. */
40
+ baseUrl?: string;
41
+ /** A post's URL. Default: `/blog/by_path/<relative path without extension>`. */
42
+ postUrl?: (relativePath: string) => string;
43
+ /** Settings that replace the output's `blog` settings, field by field. */
44
+ config?: Partial<BlogConfig>;
45
+ }
46
+ /** The builder output, or anything with its `files` (and optionally `blog`). */
47
+ export interface BlogSource {
48
+ files: AnyBlogFile[];
49
+ blog?: Partial<BlogConfig> | null;
50
+ }
51
+ /** Posts without a subject are listed under this name. */
52
+ export declare const NO_SUBJECT = "Other";
53
+ /** A color for a subject without one configured, derived from its name so it never changes. */
54
+ export declare const subjectColorFromName: (subject: string) => string;
55
+ /**
56
+ * Builds the blog from compiled notes and the project's `blog` settings: which posts are listed,
57
+ * the featured posts, the subjects with their colors and topics, and the tags.
58
+ */
59
+ export declare const createBlogModel: (source: BlogSource, options?: BlogModelOptions) => BlogModel;
60
+ //# sourceMappingURL=blog_model.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"blog_model.d.ts","sourceRoot":"","sources":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C;AAED,gFAAgF;AAChF,MAAM,WAAW,UAAU;IACvB,KAAK,EAAE,WAAW,EAAE,CAAC;IACrB,IAAI,CAAC,EAAE,OAAO,CAAC,UAAU,CAAC,GAAG,IAAI,CAAC;CACrC;AAED,0DAA0D;AAC1D,eAAO,MAAM,UAAU,UAAU,CAAC;AAElC,+FAA+F;AAC/F,eAAO,MAAM,oBAAoB,GAAI,SAAS,MAAM,KAAG,MAMtD,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,eAAe,GAAI,QAAQ,UAAU,EAAE,UAAS,gBAAqB,KAAG,SAoEpF,CAAC"}
@@ -1,6 +1,7 @@
1
1
  import { BlogFileSummary } from '../../../code_gen/typeshare/conundrum';
2
2
  import { WithNullableOptionals } from '../../../types/general';
3
- /** What the blog index shows for one post. */
3
+ export type AnyBlogFile = BlogFileSummary | WithNullableOptionals<BlogFileSummary>;
4
+ /** One post, as the blog components show it. */
4
5
  export interface BlogPostSummary {
5
6
  relativePath: string;
6
7
  url: string;
@@ -15,19 +16,21 @@ export interface BlogPostSummary {
15
16
  alt: string;
16
17
  } | null;
17
18
  readingMinutes: number;
19
+ /** The post's visible text, for search. */
20
+ plainText: string;
18
21
  }
19
- type AnyBlogFile = BlogFileSummary | WithNullableOptionals<BlogFileSummary>;
20
22
  /** The first `<img>` in compiled HTML. */
21
23
  export declare const firstImage: (html: string) => {
22
24
  src: string;
23
25
  alt: string;
24
26
  } | null;
25
- /** Minutes to read compiled HTML: its visible words, ignoring math markup, scripts and styles. */
26
- export declare const readingMinutes: (html: string) => number;
27
+ /** The visible text of compiled HTML, without math markup, scripts or styles. */
28
+ export declare const htmlToPlainText: (html: string) => string;
29
+ /** Minutes to read some text, at least one. */
30
+ export declare const readingMinutes: (text: string) => number;
27
31
  /**
28
- * The blog index's view of a compiled note, or `null` for notes that aren't posts: ones without
29
- * a `title` and `summary` in their front matter.
32
+ * A compiled note as a post, or `null` for notes that aren't posts: ones without a `title` and
33
+ * `summary` in their front matter.
30
34
  */
31
35
  export declare const summarizeBlogPost: (file: AnyBlogFile, toUrl?: (relativePath: string) => string) => BlogPostSummary | null;
32
- export {};
33
36
  //# sourceMappingURL=summarize_blog_post.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"summarize_blog_post.d.ts","sourceRoot":"","sources":["../../../../../src/prebuilt_ui/blog/model/summarize_blog_post.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,uCAAuC,CAAC;AAC7E,OAAO,EAAE,KAAK,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAKpE,MAAM,MAAM,WAAW,GAAG,eAAe,GAAG,qBAAqB,CAAC,eAAe,CAAC,CAAC;AAEnF,gDAAgD;AAChD,MAAM,WAAW,eAAe;IAC5B,YAAY,EAAE,MAAM,CAAC;IACrB,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,sDAAsD;IACtD,KAAK,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;IAC3C,cAAc,EAAE,MAAM,CAAC;IACvB,2CAA2C;IAC3C,SAAS,EAAE,MAAM,CAAC;CACrB;AAED,0CAA0C;AAC1C,eAAO,MAAM,UAAU,GAAI,MAAM,MAAM,KAAG;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,GAAG,IAWxE,CAAC;AAEF,iFAAiF;AACjF,eAAO,MAAM,eAAe,GAAI,MAAM,MAAM,KAAG,MAQhC,CAAC;AAEhB,+CAA+C;AAC/C,eAAO,MAAM,cAAc,GAAI,MAAM,MAAM,KAAG,MAG7C,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,iBAAiB,GAC1B,MAAM,WAAW,EACjB,QAAO,CAAC,YAAY,EAAE,MAAM,KAAK,MAA8B,KAChE,eAAe,GAAG,IAkBpB,CAAC"}
@@ -0,0 +1,32 @@
1
+ import { BlogConfig, BlogFileSummary, NextJsConundrumOutput } from '../code_gen/typeshare/conundrum';
2
+ /** The schema version `cdrm` writes (`PRAGMA user_version`). */
3
+ export declare const CONUNDRUM_DATABASE_VERSION = 1;
4
+ /**
5
+ * What the server helpers need from a SQLite connection. Node's built-in `node:sqlite`
6
+ * (`DatabaseSync`) and `better-sqlite3` both fit, so either can be passed in.
7
+ */
8
+ export interface ConundrumDatabase {
9
+ prepare(sql: string): {
10
+ all(...params: (string | number | null)[]): unknown[];
11
+ get(...params: (string | number | null)[]): unknown;
12
+ };
13
+ }
14
+ /**
15
+ * Opens a database written by `cdrm` read-only with Node's built-in SQLite (Node 22.13 or later).
16
+ * The connection is kept and reused until `cdrm` replaces the file, so `cdrm watch-directory`
17
+ * works with a running dev server. Throws if it was written with a different schema version.
18
+ */
19
+ export declare const openConundrumDatabase: (path: string) => ConundrumDatabase;
20
+ /** The project's `blog` settings stored in the database. */
21
+ export declare const readBlogConfig: (db: ConundrumDatabase) => Partial<BlogConfig>;
22
+ /** One compiled note by its relative path (e.g. `blog_posts/launch.cdrm`). */
23
+ export declare const getConundrumNote: (db: ConundrumDatabase, relativePath: string) => BlogFileSummary | null;
24
+ /** Every compiled note, sorted by relative path. */
25
+ export declare const listConundrumNotes: (db: ConundrumDatabase) => BlogFileSummary[];
26
+ /**
27
+ * Reads `cdrm`'s output for a Next.js app, whichever `blog.storage` wrote it: a SQLite database or
28
+ * a JSON file (told apart by the file's contents, not its name). The result is cached until the
29
+ * file changes, and fits `createBlogModel` directly.
30
+ */
31
+ export declare const loadConundrumOutput: (path: string) => NextJsConundrumOutput;
32
+ //# sourceMappingURL=conundrum_database.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"conundrum_database.d.ts","sourceRoot":"","sources":["../../../src/server/conundrum_database.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,UAAU,EAAE,KAAK,eAAe,EAAE,KAAK,qBAAqB,EAAE,MAAM,iCAAiC,CAAC;AAEpH,gEAAgE;AAChE,eAAO,MAAM,0BAA0B,IAAI,CAAC;AAE5C;;;GAGG;AACH,MAAM,WAAW,iBAAiB;IAC9B,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG;QAClB,GAAG,CAAC,GAAG,MAAM,EAAE,CAAC,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC,EAAE,GAAG,OAAO,EAAE,CAAC;QACtD,GAAG,CAAC,GAAG,MAAM,EAAE,CAAC,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC,EAAE,GAAG,OAAO,CAAC;KACvD,CAAC;CACL;AAID;;;;GAIG;AACH,eAAO,MAAM,qBAAqB,GAAI,MAAM,MAAM,KAAG,iBAiBpD,CAAC;AAEF,4DAA4D;AAC5D,eAAO,MAAM,cAAc,GAAI,IAAI,iBAAiB,KAAG,OAAO,CAAC,UAAU,CAGxE,CAAC;AAgBF,8EAA8E;AAC9E,eAAO,MAAM,gBAAgB,GAAI,IAAI,iBAAiB,EAAE,cAAc,MAAM,KAAG,eAAe,GAAG,IAKhG,CAAC;AAEF,oDAAoD;AACpD,eAAO,MAAM,kBAAkB,GAAI,IAAI,iBAAiB,KAAG,eAAe,EAGzD,CAAC;AAKlB;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,GAAI,MAAM,MAAM,KAAG,qBAgBlD,CAAC"}
@@ -0,0 +1,28 @@
1
+ import { ConundrumDatabase } from './conundrum_database';
2
+ export interface SearchRouteOptions {
3
+ /** The database's path, or a function returning an open database. */
4
+ database: string | (() => ConundrumDatabase);
5
+ /** A note's URL. Default: `/blog/by_path/<relative path without extension>`. */
6
+ postUrl?: (relativePath: string) => string;
7
+ /** Results per request when `limit` isn't given. Default: 10. */
8
+ defaultLimit?: number;
9
+ /** The most results one request may ask for. Default: 50. */
10
+ maxLimit?: number;
11
+ /** The response's `Cache-Control`. The database only changes on deploy, so CDNs may cache. */
12
+ cacheControl?: string;
13
+ }
14
+ /**
15
+ * A search endpoint over `cdrm`'s SQLite output, for a Next.js route handler:
16
+ *
17
+ * ```ts
18
+ * // app/api/blog/search/route.ts
19
+ * export const { GET } = createSearchRoute({ database: path.join(process.cwd(), "cdrm.db") });
20
+ * ```
21
+ *
22
+ * `GET ?q=…&subject=…&topic=…&tag=…&limit=…&offset=…` answers with a
23
+ * {@link ConundrumSearchResponse} as JSON.
24
+ */
25
+ export declare const createSearchRoute: (options: SearchRouteOptions) => {
26
+ GET: (request: Request) => Response;
27
+ };
28
+ //# sourceMappingURL=create_search_route.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create_search_route.d.ts","sourceRoot":"","sources":["../../../src/server/create_search_route.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,iBAAiB,EAAyB,MAAM,sBAAsB,CAAC;AAGrF,MAAM,WAAW,kBAAkB;IAC/B,qEAAqE;IACrE,QAAQ,EAAE,MAAM,GAAG,CAAC,MAAM,iBAAiB,CAAC,CAAC;IAC7C,gFAAgF;IAChF,OAAO,CAAC,EAAE,CAAC,YAAY,EAAE,MAAM,KAAK,MAAM,CAAC;IAC3C,iEAAiE;IACjE,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,6DAA6D;IAC7D,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,8FAA8F;IAC9F,YAAY,CAAC,EAAE,MAAM,CAAC;CACzB;AAOD;;;;;;;;;;GAUG;AACH,eAAO,MAAM,iBAAiB,GAAI,SAAS,kBAAkB;mBAQnC,OAAO,KAAG,QAAQ;CAc3C,CAAC"}
@@ -0,0 +1,4 @@
1
+ export * from './conundrum_database';
2
+ export * from './search_conundrum';
3
+ export * from './create_search_route';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/server/index.ts"],"names":[],"mappings":"AACA,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC;AACnC,cAAc,uBAAuB,CAAC"}
@@ -0,0 +1,46 @@
1
+ import { ConundrumDatabase } from './conundrum_database';
2
+ export interface ConundrumSearchOptions {
3
+ /** What the reader typed. Every word must match the start of a word in the note. */
4
+ query: string;
5
+ subject?: string | null;
6
+ topic?: string | null;
7
+ tag?: string | null;
8
+ /** Default: 10. */
9
+ limit?: number;
10
+ /** Default: 0. */
11
+ offset?: number;
12
+ /**
13
+ * Only notes the blog lists (with a `title` and `summary`, not hidden by the `blog`
14
+ * settings). Default: `true`.
15
+ */
16
+ listedOnly?: boolean;
17
+ /** A note's URL. Default: `/blog/by_path/<relative path without extension>`. */
18
+ postUrl?: (relativePath: string) => string;
19
+ }
20
+ export interface ConundrumSearchResult {
21
+ relativePath: string;
22
+ url: string;
23
+ title: string | null;
24
+ summary: string | null;
25
+ subject: string | null;
26
+ topic: string | null;
27
+ tags: string[];
28
+ /** A short passage around the match, as plain text. */
29
+ snippet: string;
30
+ /** The same passage as HTML, with the matched words in `<mark>`. Safe to render. */
31
+ snippetHtml: string;
32
+ }
33
+ export interface ConundrumSearchResponse {
34
+ query: string;
35
+ /** Matches in all, for paging. */
36
+ total: number;
37
+ results: ConundrumSearchResult[];
38
+ }
39
+ /**
40
+ * Turns what the reader typed into an FTS5 query that can't fail to parse: every word quoted and
41
+ * matched as a prefix, so "relativ" finds "relativity" and results update while typing.
42
+ */
43
+ export declare const toFtsQuery: (query: string) => string;
44
+ /** Searches the notes in a database written by `cdrm`, best matches first. */
45
+ export declare const searchConundrum: (db: ConundrumDatabase, options: ConundrumSearchOptions) => ConundrumSearchResponse;
46
+ //# sourceMappingURL=search_conundrum.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"search_conundrum.d.ts","sourceRoot":"","sources":["../../../src/server/search_conundrum.ts"],"names":[],"mappings":"AACA,OAAO,EAA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,7 +2,7 @@
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const jsxRuntime = require("react/jsx-runtime");
4
4
  const React = require("react");
5
- const blog_index = require("./blog_index-Dd7fy5LS.js");
5
+ const blog_post_nav = require("./blog_post_nav-BpUDqfSu.js");
6
6
  const LayoutGroupContext = React.createContext({});
7
7
  function useConstant(init) {
8
8
  const ref = React.useRef(null);
@@ -7990,13 +7990,24 @@ const SidebarToggleButton = () => {
7990
7990
  );
7991
7991
  };
7992
7992
  SidebarToggleButton.displayName = "SidebarToggleButton";
7993
- exports.BlogIndex = blog_index.BlogIndex;
7994
- exports.BlogPostRow = blog_index.BlogPostRow;
7995
- exports.BlogSubjectNav = blog_index.BlogSubjectNav;
7996
- exports.FeaturedBlogPost = blog_index.FeaturedBlogPost;
7997
- exports.firstImage = blog_index.firstImage;
7998
- exports.readingMinutes = blog_index.readingMinutes;
7999
- exports.summarizeBlogPost = blog_index.summarizeBlogPost;
7993
+ exports.BlogBreadcrumb = blog_post_nav.BlogBreadcrumb;
7994
+ exports.BlogIndex = blog_post_nav.BlogIndex;
7995
+ exports.BlogLeadPost = blog_post_nav.BlogLeadPost;
7996
+ exports.BlogPostEntry = blog_post_nav.BlogPostEntry;
7997
+ exports.BlogPostNav = blog_post_nav.BlogPostNav;
7998
+ exports.BlogShell = blog_post_nav.BlogShell;
7999
+ exports.BlogSidebar = blog_post_nav.BlogSidebar;
8000
+ exports.NO_SUBJECT = blog_post_nav.NO_SUBJECT;
8001
+ exports.blogFilterFromSearchParams = blog_post_nav.blogFilterFromSearchParams;
8002
+ exports.blogFilterUrl = blog_post_nav.blogFilterUrl;
8003
+ exports.createBlogModel = blog_post_nav.createBlogModel;
8004
+ exports.filterBlogPosts = blog_post_nav.filterBlogPosts;
8005
+ exports.firstImage = blog_post_nav.firstImage;
8006
+ exports.htmlToPlainText = blog_post_nav.htmlToPlainText;
8007
+ exports.isFiltering = blog_post_nav.isFiltering;
8008
+ exports.readingMinutes = blog_post_nav.readingMinutes;
8009
+ exports.subjectColorFromName = blog_post_nav.subjectColorFromName;
8010
+ exports.summarizeBlogPost = blog_post_nav.summarizeBlogPost;
8000
8011
  exports.SidebarItemContainer = SidebarItemContainer;
8001
8012
  exports.SidebarItemPanel = SidebarItemPanel;
8002
8013
  exports.SidebarToggleButton = SidebarToggleButton;