astronaut-cms 0.0.1 → 1.0.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 (119) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +84 -3
  3. package/dist/admin/THIRD_PARTY_LICENSES.md +7598 -0
  4. package/dist/admin/assets/assistant-DkS355co.js +201 -0
  5. package/dist/admin/assets/badge-BXsOvOPX.js +1 -0
  6. package/dist/admin/assets/changes-Ba0G_GN1.js +1 -0
  7. package/dist/admin/assets/client-VKp75fDU.js +5 -0
  8. package/dist/admin/assets/clsx-DB0hHKMi.js +1 -0
  9. package/dist/admin/assets/collapsible-B6P_J0Bg.js +1 -0
  10. package/dist/admin/assets/collapsible-item-UaoJaaPw.js +1 -0
  11. package/dist/admin/assets/collections._collection-BE1enDCq.js +1 -0
  12. package/dist/admin/assets/collections._collection._entry-D3UksnCo.js +52 -0
  13. package/dist/admin/assets/collections._collection.index-BN5d8UIY.js +1 -0
  14. package/dist/admin/assets/component-lookup-CUCiK8Xh.js +4 -0
  15. package/dist/admin/assets/config-Pm_BHLNT.js +1 -0
  16. package/dist/admin/assets/copy-DezZzPMV.js +1 -0
  17. package/dist/admin/assets/css-BGIxQoYs.js +1 -0
  18. package/dist/admin/assets/css-DgaLhXQH.js +1 -0
  19. package/dist/admin/assets/diff-woXpYk--.js +1 -0
  20. package/dist/admin/assets/dist-DzkcSBZl.js +1 -0
  21. package/dist/admin/assets/dist-UbA1s2kM.js +1 -0
  22. package/dist/admin/assets/docx-BctAmX91.js +56 -0
  23. package/dist/admin/assets/editor-FGqMznBK.js +2 -0
  24. package/dist/admin/assets/empty-DSBYiI_7.js +1 -0
  25. package/dist/admin/assets/entry-link-CQLN2Zpf.js +158 -0
  26. package/dist/admin/assets/error-banner-yskeRXe8.js +159 -0
  27. package/dist/admin/assets/errors-DkJ5E_ak.js +1 -0
  28. package/dist/admin/assets/field-BDK5tt3J.js +41 -0
  29. package/dist/admin/assets/field-schema-CacrjSYw.js +1 -0
  30. package/dist/admin/assets/file-text-BzBif8ui.js +1 -0
  31. package/dist/admin/assets/github-dark-C-LZuMrd.js +1 -0
  32. package/dist/admin/assets/github-light-EUqPIrTm.js +1 -0
  33. package/dist/admin/assets/highlighted-body-JLMTFACH-CIQujGv2.js +1 -0
  34. package/dist/admin/assets/html-CvFb5cGI.js +1 -0
  35. package/dist/admin/assets/javascript-BzbQS41l.js +1 -0
  36. package/dist/admin/assets/javascript-CpIGwZ_Y.js +1 -0
  37. package/dist/admin/assets/json-qhed-kSA.js +1 -0
  38. package/dist/admin/assets/jsx-Bz0zcwM4.js +1 -0
  39. package/dist/admin/assets/lib-CMURo-7A.js +21 -0
  40. package/dist/admin/assets/library-Cr3f75Es.js +1 -0
  41. package/dist/admin/assets/list-skeleton-BdTNfVXs.js +1 -0
  42. package/dist/admin/assets/markdown-BYOwaDjH.js +1 -0
  43. package/dist/admin/assets/matchContext-Bq5Es9aD.js +2 -0
  44. package/dist/admin/assets/media-browser-9-CPTCks.js +1 -0
  45. package/dist/admin/assets/media._library-BfFaEZLR.js +1 -0
  46. package/dist/admin/assets/mermaid-WFAXDIZX-CJ3hhA0i.js +1 -0
  47. package/dist/admin/assets/page-header-B4nvAsVA.js +1 -0
  48. package/dist/admin/assets/pdf-DgessaF0.js +106 -0
  49. package/dist/admin/assets/python-gzcpVVnB.js +1 -0
  50. package/dist/admin/assets/react-kbcsfQYH.js +1 -0
  51. package/dist/admin/assets/rolldown-runtime-BWaJ3C7D.js +1 -0
  52. package/dist/admin/assets/routes-CBt04sNR.js +1 -0
  53. package/dist/admin/assets/routes-D7tEdYGV.js +1 -0
  54. package/dist/admin/assets/save-actions-Cz0TkpcP.js +32 -0
  55. package/dist/admin/assets/select-Bv2EoLhN.js +1 -0
  56. package/dist/admin/assets/separator-DlYj_PoQ.js +3 -0
  57. package/dist/admin/assets/shell-DBEiq06l.js +1 -0
  58. package/dist/admin/assets/shellscript-CLZ0U2zV.js +1 -0
  59. package/dist/admin/assets/skeleton-CKiqTaRh.js +1 -0
  60. package/dist/admin/assets/sql-CEbI0hMM.js +1 -0
  61. package/dist/admin/assets/syntax-BAXqRKRO.js +8 -0
  62. package/dist/admin/assets/toggle-Y2UpJZyU.js +1 -0
  63. package/dist/admin/assets/toml-BPTmHmyx.js +1 -0
  64. package/dist/admin/assets/tsx-udAQXfEw.js +1 -0
  65. package/dist/admin/assets/typescript-bsJCZSQ-.js +1 -0
  66. package/dist/admin/assets/ui.module.css-WaO_77ml.js +56 -0
  67. package/dist/admin/assets/use-entries-B2lsaiK9.js +1 -0
  68. package/dist/admin/assets/useSelector-CWr3iU9K.js +1 -0
  69. package/dist/admin/assets/yaml-rwi0_p6S.js +1 -0
  70. package/dist/admin/assets/zwitch-Wwuax-dJ.js +1 -0
  71. package/dist/admin/bootstrap.d.ts +1 -0
  72. package/dist/admin/bootstrap.js +1 -0
  73. package/dist/admin/editor.d.ts +57 -0
  74. package/dist/admin/editor.js +1 -0
  75. package/dist/server/assets.d.ts +2 -0
  76. package/dist/server/assets.js +30 -0
  77. package/dist/server/chunks/anchors-DuZ1fokt.js +86 -0
  78. package/dist/server/chunks/auth-DJP9ryVd.js +44 -0
  79. package/dist/server/chunks/cms-markers-CUqrOnfA.js +78 -0
  80. package/dist/server/chunks/component-lookup-DAFg_Qg8.js +128 -0
  81. package/dist/server/chunks/config-WQqG4mNH.d.ts +193 -0
  82. package/dist/server/chunks/digest-BYzWNJea.js +753 -0
  83. package/dist/server/chunks/entry-checks-CKMag1G4.js +608 -0
  84. package/dist/server/chunks/field-schema-CfdN75jT.js +48 -0
  85. package/dist/server/chunks/http-BnsNh57m.d.ts +35 -0
  86. package/dist/server/chunks/i18n-BPmx7ESy.d.ts +15 -0
  87. package/dist/server/chunks/index-CYbkNvu5.d.ts +22 -0
  88. package/dist/server/chunks/media-BhqUVVYY.js +223 -0
  89. package/dist/server/chunks/paths-CEW9fvg8.js +17 -0
  90. package/dist/server/chunks/paths-Dztx2eUw.js +13 -0
  91. package/dist/server/chunks/types-DOR5XaJO.js +397 -0
  92. package/dist/server/chunks/types-Dkx4Xovf.d.ts +359 -0
  93. package/dist/server/chunks/types-DwA-C6Br.d.ts +266 -0
  94. package/dist/server/chunks/user-config-DoypbpQf.js +283 -0
  95. package/dist/server/chunks/xml-D8qPILJU.js +81 -0
  96. package/dist/server/config.d.ts +3 -0
  97. package/dist/server/config.js +18 -0
  98. package/dist/server/content.d.ts +48 -0
  99. package/dist/server/content.js +89 -0
  100. package/dist/server/endpoint.d.ts +11 -0
  101. package/dist/server/endpoint.js +2712 -0
  102. package/dist/server/integration.d.ts +7 -0
  103. package/dist/server/integration.js +1174 -0
  104. package/dist/server/internal.d.ts +65 -0
  105. package/dist/server/internal.js +30 -0
  106. package/dist/server/server-local.d.ts +453 -0
  107. package/dist/server/server-local.js +336 -0
  108. package/dist/styles/THIRD_PARTY_LICENSES.md +193 -0
  109. package/dist/styles/assets/geist-cyrillic-ext-wght-normal-DjL33-gN.woff2 +0 -0
  110. package/dist/styles/assets/geist-cyrillic-wght-normal-BEAKL7Jp.woff2 +0 -0
  111. package/dist/styles/assets/geist-latin-ext-wght-normal-DC-KSUi6.woff2 +0 -0
  112. package/dist/styles/assets/geist-latin-wght-normal-BgDaEnEv.woff2 +0 -0
  113. package/dist/styles/assets/geist-vietnamese-wght-normal-6IgcOCM7.woff2 +0 -0
  114. package/dist/styles/styles.css +3 -0
  115. package/package.json +151 -5
  116. package/src/astro/Image.astro +28 -0
  117. package/src/astro/Video.astro +44 -0
  118. package/src/astro/admin.astro +137 -0
  119. package/src/astro/licenses.ts +5 -0
@@ -0,0 +1,193 @@
1
+ import { n as ResolvedImage } from "./index-CYbkNvu5.js";
2
+ import { i as CollectionSort } from "./types-DwA-C6Br.js";
3
+ import { z } from "zod";
4
+ import { ReactElement, ReactNode } from "react";
5
+ import { RootContent } from "mdast";
6
+ /** `name="value"`, or `name={expression}` with the expression as source text. */
7
+ interface MdxJsxAttribute {
8
+ type: "mdxJsxAttribute";
9
+ name: string;
10
+ value?: string | {
11
+ type: "mdxJsxAttributeValueExpression";
12
+ value: string;
13
+ } | null;
14
+ }
15
+ /** `{...expression}`, as source text. */
16
+ interface MdxJsxExpressionAttribute {
17
+ type: "mdxJsxExpressionAttribute";
18
+ value: string;
19
+ }
20
+ /** The MDX element a component is written as. */
21
+ interface MdxJsxElement {
22
+ type: "mdxJsxFlowElement" | "mdxJsxTextElement";
23
+ name: string | null;
24
+ attributes: (MdxJsxAttribute | MdxJsxExpressionAttribute)[];
25
+ children: RootContent[];
26
+ }
27
+ /** The props a custom editor is rendered with. */
28
+ interface JsxEditorProps {
29
+ /** The element being edited. */
30
+ mdastNode: MdxJsxElement;
31
+ /** The component the element renders. */
32
+ descriptor: {
33
+ name: string | null;
34
+ kind: "flow" | "text";
35
+ hasChildren?: boolean;
36
+ };
37
+ }
38
+ /** A component's own editor in the admin, in place of the generated form. */
39
+ type JsxEditor = (props: JsxEditorProps) => ReactNode;
40
+ interface NestedLexicalEditorProps {
41
+ /** The part of the element to edit, usually its `children`. */
42
+ getContent: (node: MdxJsxElement) => RootContent[];
43
+ /** The element with the edited content put back. */
44
+ getUpdatedMdastNode: (node: MdxJsxElement, content: RootContent[]) => MdxJsxElement;
45
+ /** Whether the content is blocks (paragraphs, lists) rather than inline text. */
46
+ block?: boolean;
47
+ }
48
+ /** The runtime exports of `astronaut-cms/editor`. */
49
+ interface EditorExports {
50
+ /** A rich-text editor for content nested inside the element, such as its children. */
51
+ NestedLexicalEditor: (props: NestedLexicalEditorProps) => ReactElement;
52
+ /** Merges fields into the element being edited. */
53
+ useMdastNodeUpdater: () => (node: Partial<MdxJsxElement>) => void;
54
+ /** Removes the element being edited from the document. */
55
+ useLexicalNodeRemove: () => () => void;
56
+ }
57
+ /** What a component's `image()` prop is resolved with, `resolveImage` on the site. */
58
+ type ImageResolver = (path: string) => Promise<ResolvedImage>;
59
+ /**
60
+ * A collection image field that takes a file from either media library: an
61
+ * object-store URL as it is, or anything else through astro's own `image()`,
62
+ * which imports a repository file as ever. Typed as what arrives, so rendering a
63
+ * URL where only `ImageMetadata` is handled is a compile error rather than a
64
+ * failed build. The URL is left to astro, which optimizes it as a remote image,
65
+ * and whether it names a library file is checked when content is written.
66
+ *
67
+ * @example
68
+ * ```ts
69
+ * schema: ({ image }) => z.object({ cover: libraryImage(image) })
70
+ * ```
71
+ */
72
+ declare function libraryImage<T extends z.ZodType>(image: () => T): z.ZodUnion<readonly [z.ZodURL, T]>;
73
+ /** A Zod string naming a file in the media library, resolved to a bundled URL. */
74
+ declare const fileMarker: () => z.ZodString;
75
+ /**
76
+ * A Zod string holding a URL: relative, http, https, mailto or tel. The only
77
+ * field a URL may be written into, since plain text is refused as one. The check
78
+ * is part of the schema itself, so the site's own content validation enforces it
79
+ * too, not only the CMS.
80
+ */
81
+ declare const linkMarker: () => z.ZodString;
82
+ /**
83
+ * A Zod string holding an element id that the component or layout renders, such
84
+ * as a section's `id`. Declaring it is what lets a `#id` link in the same entry
85
+ * be checked, since the CMS cannot tell which prop ends up as an id otherwise.
86
+ */
87
+ declare const anchorMarker: () => z.ZodString;
88
+ /**
89
+ * One value per content language, such as a translated title in an otherwise
90
+ * language-neutral entry. Stored as `{ de: "…", en: "…" }` and read with
91
+ * `pickLocale` from `astronaut-cms/content`. The admin edits it in a tab per
92
+ * language, and the default language is required, which the build and every
93
+ * save check, since only the CMS knows the site's languages.
94
+ */
95
+ declare const localizedMarker: <T extends z.ZodType>(schema: T) => z.ZodRecord<z.ZodString, T>;
96
+ /** A Zod string that references an entry id in another collection. */
97
+ declare const referenceMarker: (collection: string) => z.ZodString;
98
+ /**
99
+ * What a component's props function is handed, mirroring the `({ image })` bag
100
+ * astro gives a collection schema. Handing them in rather than exporting them is
101
+ * what keeps an `image()` meant for a component prop out of a `content.config.ts`,
102
+ * where astro's own helper is the only one that resolves.
103
+ */
104
+ declare function schemaHelpers(resolveImage: ImageResolver): {
105
+ image: () => z.ZodPipe<z.ZodString, z.ZodTransform<string | import("astro").ImageMetadata, string>>;
106
+ file: typeof fileMarker;
107
+ link: typeof linkMarker;
108
+ anchor: typeof anchorMarker;
109
+ localized: typeof localizedMarker;
110
+ reference: typeof referenceMarker;
111
+ };
112
+ /** An icon for the admin, such as one of `lucide-react`'s. */
113
+ type ComponentIcon = (props: {
114
+ className?: string;
115
+ }) => ReactNode;
116
+ /**
117
+ * Filled in for each site by the types the integration generates, with the
118
+ * collection names of its content config. Empty where those types are not loaded.
119
+ */
120
+ interface CollectionRegistry {}
121
+ /** A collection of the content config, or any string before `astro sync` names them. */
122
+ type CollectionName = CollectionRegistry extends {
123
+ name: infer N extends string;
124
+ } ? N : string;
125
+ type Helpers = ReturnType<typeof schemaHelpers>;
126
+ /**
127
+ * The asset, link, anchor and reference helpers a component's props function
128
+ * receives. An `image()` prop is written as a path and rendered as the image it
129
+ * resolves to, as a collection's `image()` field arrives.
130
+ */
131
+ type SchemaHelpers = Omit<Helpers, "reference"> & {
132
+ reference: (collection: CollectionName) => ReturnType<Helpers["reference"]>;
133
+ };
134
+ type ChildrenConfig = "markdown" | Record<string, ComponentDefinition>;
135
+ interface ComponentDefinition<T extends z.ZodType<object> = z.ZodType<object>, C extends ChildrenConfig = ChildrenConfig> {
136
+ /**
137
+ * The component's props, either as a Zod object or as a function handed the
138
+ * schema helpers, exactly like astro's collection `schema`. Reach for the
139
+ * function form only when a prop names an asset, a link, an anchor or an entry.
140
+ * Left out, the component takes no props.
141
+ */
142
+ props?: T | ((helpers: SchemaHelpers) => T);
143
+ /**
144
+ * The `.astro` component that renders it, imported as the site imports it,
145
+ * such as `"@/components/Hero.astro"`, or relative to `cms.config`.
146
+ * Every MDX body can use it by name, with the schema's defaults applied.
147
+ */
148
+ component: string;
149
+ children?: C;
150
+ kind?: "flow" | "text";
151
+ label?: string;
152
+ /** What the component is for, shown when inserting and editing it. */
153
+ description?: string;
154
+ /**
155
+ * The collections whose entries the component renders, such as `["projects"]`.
156
+ * Selecting it in the admin links to them, since that is where its content is edited.
157
+ */
158
+ collections?: CollectionName[];
159
+ /**
160
+ * The prop that names an instance in the admin, such as `"title"`. Defaults to
161
+ * the first required text prop with a value, then to any text prop with one.
162
+ */
163
+ summary?: string;
164
+ icon?: ComponentIcon;
165
+ editor?: JsxEditor;
166
+ }
167
+ /** What `cms.config` adds to one collection of the content config. */
168
+ interface CollectionOptions {
169
+ /**
170
+ * How entries are ordered, both in the admin and for the site through
171
+ * `sortEntries` from `astronaut-cms/content` (default: "id", astro's own
172
+ * order). "file" keeps the order of a `file()` collection's file, which
173
+ * editors can then change.
174
+ */
175
+ sort?: CollectionSort;
176
+ /** What the admin calls the collection (default: its name, title-cased). */
177
+ label?: string;
178
+ /** What the collection is for, shown in the admin and told to agents. */
179
+ description?: string;
180
+ icon?: ComponentIcon;
181
+ }
182
+ /**
183
+ * One entry of the `collections` export of `cms.config`, keyed like the
184
+ * collections of `content.config`, as {@link defineComponent} is one entry of
185
+ * `components`.
186
+ */
187
+ declare function defineCollection(options: CollectionOptions): CollectionOptions;
188
+ /**
189
+ * One entry of the `components` export of `cms.config`. The integration renders
190
+ * it in MDX through a generated wrapper, which `astronaut-cms:components` exports.
191
+ */
192
+ declare function defineComponent<T extends z.ZodType<object> = z.ZodObject<{}>, C extends ChildrenConfig = never>(def: ComponentDefinition<T, C>): ComponentDefinition<T, C>;
193
+ export { EditorExports as _, ComponentDefinition as a, defineCollection as c, anchorMarker as d, fileMarker as f, referenceMarker as g, localizedMarker as h, CollectionRegistry as i, defineComponent as l, linkMarker as m, CollectionName as n, ComponentIcon as o, libraryImage as p, CollectionOptions as r, SchemaHelpers as s, ChildrenConfig as t, ImageResolver as u, JsxEditor as v, JsxEditorProps as y };