bearminion 1.0.1 → 1.2.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.
- package/CHANGELOG.md +24 -0
- package/README.md +5 -5
- package/dist/astro.d.ts +2 -2
- package/dist/astro.js +15 -2
- package/dist/content.d.ts +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.js +60 -8
- package/dist/{options-CxRzVfhi.d.ts → options-CLrSA8kL.d.ts} +1 -1
- package/dist/{page-DgQlGree.d.ts → page-dUWFHv9j.d.ts} +41 -8
- package/dist/preview-BqrZLvQ6.js +125 -0
- package/dist/rich-text.d.ts +1 -1
- package/dist/rich-text.js +18 -1
- package/dist/theme-q19C8cIc.js +58 -0
- package/dist/ui/mount.js +246 -65
- package/package.json +2 -2
- package/dist/preview-C9MHO88K.js +0 -55
- package/dist/theme-DZkec408.js +0 -33
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bearminion",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"description": "A git-based, no-database CMS for Astro: JSON content in your repo, edited inline during astro dev.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Jakub Lange",
|
|
@@ -84,7 +84,7 @@
|
|
|
84
84
|
"typescript": "~5.9.3",
|
|
85
85
|
"vite": "^8.3.1",
|
|
86
86
|
"vitest": "^5.0.4",
|
|
87
|
-
"zod": "^4.
|
|
87
|
+
"zod": "^4.6.7"
|
|
88
88
|
},
|
|
89
89
|
"scripts": {
|
|
90
90
|
"build": "tsdown",
|
package/dist/preview-C9MHO88K.js
DELETED
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
//#region src/errors.ts
|
|
2
|
-
function formatContentIssues(issues) {
|
|
3
|
-
return issues.map((issue) => {
|
|
4
|
-
return ` - ${issue.path.length > 0 ? issue.path.map(String).join(".") : "(root)"}: ${issue.message}`;
|
|
5
|
-
}).join("\n");
|
|
6
|
-
}
|
|
7
|
-
/** Base error for content that cannot be loaded. `filePath` is the file or directory involved. */
|
|
8
|
-
var ContentError = class extends Error {
|
|
9
|
-
filePath;
|
|
10
|
-
constructor(filePath, message) {
|
|
11
|
-
super(message);
|
|
12
|
-
this.name = new.target.name;
|
|
13
|
-
this.filePath = filePath;
|
|
14
|
-
}
|
|
15
|
-
};
|
|
16
|
-
/** `site.json` or a page file failed schema validation. */
|
|
17
|
-
var ContentValidationError = class extends ContentError {
|
|
18
|
-
issues;
|
|
19
|
-
constructor(filePath, issues) {
|
|
20
|
-
super(filePath, `Invalid content in ${filePath}:\n${formatContentIssues(issues)}`);
|
|
21
|
-
this.issues = issues;
|
|
22
|
-
}
|
|
23
|
-
};
|
|
24
|
-
/** A content file or directory is missing, unreadable, or not valid JSON. */
|
|
25
|
-
var ContentReadError = class extends ContentError {};
|
|
26
|
-
//#endregion
|
|
27
|
-
//#region src/preview.ts
|
|
28
|
-
/**
|
|
29
|
-
* Declare a theme's preview renderer. Default-export it from the module named by `previewModule`
|
|
30
|
-
* (default `/src/lib/render-preview.ts`). The model type ties the inputs to your section registry and site:
|
|
31
|
-
*
|
|
32
|
-
* ```ts
|
|
33
|
-
* export default defineThemePreview<typeof contentModel>({
|
|
34
|
-
* async page({ sections, motion }) { ... },
|
|
35
|
-
* async site({ site, pathname }) { ... },
|
|
36
|
-
* })
|
|
37
|
-
* ```
|
|
38
|
-
*/
|
|
39
|
-
function defineThemePreview(preview) {
|
|
40
|
-
if (typeof preview?.page !== "function") throw new TypeError("defineThemePreview needs a `page` function.");
|
|
41
|
-
if (preview.site !== void 0 && typeof preview.site !== "function") throw new TypeError("defineThemePreview: `site` must be a function when given.");
|
|
42
|
-
return preview;
|
|
43
|
-
}
|
|
44
|
-
/** The theme has no renderer for this preview. The API answers 501 instead of 500. */
|
|
45
|
-
var PreviewUnavailableError = class extends Error {};
|
|
46
|
-
/** Load the preview module through the Vite SSR runner and check it default-exports a preview. */
|
|
47
|
-
async function loadThemePreview(environment, previewModule) {
|
|
48
|
-
const runner = environment.runner;
|
|
49
|
-
if (!runner?.import) throw new PreviewUnavailableError("The SSR dev environment cannot render a preview.");
|
|
50
|
-
const preview = (await runner.import(previewModule))?.default;
|
|
51
|
-
if (!preview || typeof preview.page !== "function") throw new Error(`${previewModule} must default-export defineThemePreview({ page, site? }).`);
|
|
52
|
-
return preview;
|
|
53
|
-
}
|
|
54
|
-
//#endregion
|
|
55
|
-
export { ContentReadError as a, ContentError as i, defineThemePreview as n, ContentValidationError as o, loadThemePreview as r, formatContentIssues as s, PreviewUnavailableError as t };
|
package/dist/theme-DZkec408.js
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { F as tones, N as themeModes, j as buttonStyles } from "./page-C0l3CIuz.js";
|
|
2
|
-
import { fontMarks } from "./marks.js";
|
|
3
|
-
//#region src/theme.ts
|
|
4
|
-
const SYSTEM_FONTS = {
|
|
5
|
-
sans: {
|
|
6
|
-
label: "Sans",
|
|
7
|
-
family: "ui-sans-serif, system-ui, sans-serif"
|
|
8
|
-
},
|
|
9
|
-
serif: {
|
|
10
|
-
label: "Serif",
|
|
11
|
-
family: "ui-serif, Georgia, serif"
|
|
12
|
-
},
|
|
13
|
-
mono: {
|
|
14
|
-
label: "Mono",
|
|
15
|
-
family: "ui-monospace, SFMono-Regular, Menlo, monospace"
|
|
16
|
-
}
|
|
17
|
-
};
|
|
18
|
-
/** What a theme tells the editor about itself. Pass the result as `theme` in the content model. */
|
|
19
|
-
function defineTheme(config = {}) {
|
|
20
|
-
return {
|
|
21
|
-
fonts: Object.fromEntries(fontMarks.map((slot) => [slot, {
|
|
22
|
-
...SYSTEM_FONTS[slot],
|
|
23
|
-
...config.fonts?.[slot]
|
|
24
|
-
}])),
|
|
25
|
-
tones,
|
|
26
|
-
modes: themeModes,
|
|
27
|
-
buttonStyles
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
/** Used when the content model has no `theme`. */
|
|
31
|
-
const defaultTheme = defineTheme();
|
|
32
|
-
//#endregion
|
|
33
|
-
export { defineTheme as n, defaultTheme as t };
|