blume 1.1.1 → 1.1.2
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 +9 -0
- package/dist/cli/index.js +80 -5
- package/dist/cli/index.js.map +6 -6
- package/dist/types/core/config-input.d.ts +6 -5
- package/dist/types/core/schema.d.ts +19 -18
- package/dist/types/core/types.d.ts +7 -0
- package/dist/types/markdown/themes.d.ts +21 -0
- package/docs/configuration/index.mdx +1 -1
- package/docs/content/components.mdx +1 -1
- package/docs/content/syntax.mdx +14 -0
- package/package.json +1 -1
- package/src/astro/generate.ts +46 -0
- package/src/astro/templates.ts +42 -1
- package/src/components/content/Component.astro +99 -6
- package/src/components/content/diff.ts +53 -4
- package/src/components/layout/RootLayout.astro +9 -1
- package/src/components/layout/nav-utils.ts +18 -7
- package/src/core/config-input.ts +6 -5
- package/src/core/navigation.ts +11 -7
- package/src/core/schema.ts +32 -2
- package/src/core/types.ts +7 -0
- package/src/markdown/index.ts +2 -0
- package/src/markdown/inline-code.ts +1 -1
- package/src/markdown/themes.ts +7 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# blume
|
|
2
2
|
|
|
3
|
+
## 1.1.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 6cf2995: Allow custom Shiki theme objects in `markdown.codeBlocks.theme.light` and `markdown.codeBlocks.theme.dark`. Custom themes now flow through fenced code, inline highlighted code, `<CodeBlock>`, and `<Diff>` alongside bundled Shiki theme names.
|
|
8
|
+
- cb30a40: Recognize the localized/based root tab when scoping the sidebar. With i18n enabled and header tabs configured, a non-default locale's tabs arrive localized (`/` becomes `/en`), but render-time scoping compared the active tab against a bare `/` — so on any `/en/...` route the root tab was misread as a section tab, and a root-level `(group)` folder (whose path is exactly the locale prefix) collapsed the sidebar to that one group. The same bare comparison blanked the sidebar entirely under a `basePath` with a root tab. The navigation now carries its root in the tabs' own path space (`/`, `/en`, `/docs`) and the sidebar scoping compares against it, so non-default locales show the full tree minus tab-owned sections, matching the default locale.
|
|
9
|
+
- aa3f588: Size `<Component>` preview panes to the rendered example instead of the source line count. The generated frame page now observes the example with a ResizeObserver and reports its height to the docs page, which applies it to both the Preview and Code tabs — so short sources that render tall UIs no longer clip, and long sources that render small components no longer float in dead space. The line-count estimate remains the SSR/no-JS initial height (288px floor, 400px ceiling; the measured height is unceilinged up to the viewport), with a height transition so the settle on lazy load doesn't snap. Examples that resize after load keep the pane in sync, and viewport-tracking examples (`h-screen`) can't feed the measurement back into unbounded growth.
|
|
10
|
+
- 103733d: Re-point a cache-restored `.blume/node_modules` junction that resolves a superseded Blume install. A restored build cache (e.g. Vercel's) could resurrect the junction pointing into the previous release's store directory; because releases rarely bump Astro, every astro-based health check passed straight through the stale link, and the freshly generated Astro config then imported the old package — crashing on any export added since (`blumeTwoslashTransformer is not a function`). The junction is now dropped and relinked whenever the directory behind it holds a `blume` other than the one running.
|
|
11
|
+
|
|
3
12
|
## 1.1.1
|
|
4
13
|
|
|
5
14
|
### Patch Changes
|
package/dist/cli/index.js
CHANGED
|
@@ -4770,7 +4770,42 @@ const Example = entry.Component;
|
|
|
4770
4770
|
<!-- Flex + margin:auto centers the example and, unlike place-items, keeps
|
|
4771
4771
|
the top edge reachable when the example outgrows the frame. -->
|
|
4772
4772
|
<body style="display:flex;min-height:100svh;padding:1.5rem">
|
|
4773
|
-
<div style="margin:auto"><Example /></div>
|
|
4773
|
+
<div data-blume-example style="margin:auto"><Example /></div>
|
|
4774
|
+
<script is:inline>
|
|
4775
|
+
(() => {
|
|
4776
|
+
// Report the example's rendered height so the embedding docs page can
|
|
4777
|
+
// size the preview pane to the content. The wrapper is observed rather
|
|
4778
|
+
// than the body: the body stretches to the frame's own height, so it
|
|
4779
|
+
// would only echo the pane back. Direct opens have no distinct parent
|
|
4780
|
+
// and skip out; the frame is same-origin with the docs page (see the
|
|
4781
|
+
// theme sync above), so the origin is pinned on both ends.
|
|
4782
|
+
if (window.parent === window) {
|
|
4783
|
+
return;
|
|
4784
|
+
}
|
|
4785
|
+
const wrapper = document.querySelector("[data-blume-example]");
|
|
4786
|
+
if (!wrapper) {
|
|
4787
|
+
return;
|
|
4788
|
+
}
|
|
4789
|
+
// The body's padding frames the example; fold it into the report so
|
|
4790
|
+
// the parent can apply the number as-is. Read from the live value —
|
|
4791
|
+
// the user's examples.css is injected after Blume's defaults precisely
|
|
4792
|
+
// so their tokens win, so a root font-size override must be honored
|
|
4793
|
+
// rather than assuming 1.5rem is 48px.
|
|
4794
|
+
const bodyStyle = getComputedStyle(document.body);
|
|
4795
|
+
const paddingPx =
|
|
4796
|
+
parseFloat(bodyStyle.paddingTop) + parseFloat(bodyStyle.paddingBottom);
|
|
4797
|
+
new ResizeObserver(() => {
|
|
4798
|
+
window.parent.postMessage(
|
|
4799
|
+
{
|
|
4800
|
+
height:
|
|
4801
|
+
Math.ceil(wrapper.getBoundingClientRect().height) + paddingPx,
|
|
4802
|
+
type: "blume:example-height",
|
|
4803
|
+
},
|
|
4804
|
+
window.location.origin
|
|
4805
|
+
);
|
|
4806
|
+
}).observe(wrapper);
|
|
4807
|
+
})();
|
|
4808
|
+
</script>
|
|
4774
4809
|
</body>
|
|
4775
4810
|
</html>
|
|
4776
4811
|
`;
|
|
@@ -7927,9 +7962,23 @@ var githubConfigSchema = z2.strictObject({
|
|
|
7927
7962
|
owner: z2.string(),
|
|
7928
7963
|
repo: z2.string()
|
|
7929
7964
|
});
|
|
7965
|
+
var codeThemeSchema = z2.custom((value) => {
|
|
7966
|
+
if (typeof value === "string") {
|
|
7967
|
+
return true;
|
|
7968
|
+
}
|
|
7969
|
+
if (typeof value !== "object" || value === null || Array.isArray(value)) {
|
|
7970
|
+
return false;
|
|
7971
|
+
}
|
|
7972
|
+
const theme = value;
|
|
7973
|
+
const settingsValid = theme.settings === undefined || Array.isArray(theme.settings);
|
|
7974
|
+
const tokenColorsValid = theme.tokenColors === undefined || Array.isArray(theme.tokenColors);
|
|
7975
|
+
const colorsValid = theme.colors === undefined || typeof theme.colors === "object" && theme.colors !== null && !Array.isArray(theme.colors);
|
|
7976
|
+
const hasContent = theme.settings !== undefined || theme.tokenColors !== undefined || theme.colors !== undefined;
|
|
7977
|
+
return settingsValid && tokenColorsValid && colorsValid && hasContent;
|
|
7978
|
+
}, "Expected a Shiki theme name or custom theme object");
|
|
7930
7979
|
var codeBlockThemeSchema = z2.strictObject({
|
|
7931
|
-
dark:
|
|
7932
|
-
light:
|
|
7980
|
+
dark: codeThemeSchema.default("github-dark"),
|
|
7981
|
+
light: codeThemeSchema.default("github-light")
|
|
7933
7982
|
});
|
|
7934
7983
|
var codeBlocksConfigSchema = z2.strictObject({
|
|
7935
7984
|
theme: codeBlockThemeSchema.default({})
|
|
@@ -8738,19 +8787,21 @@ var buildNavigation = (pages, options) => {
|
|
|
8738
8787
|
}
|
|
8739
8788
|
}
|
|
8740
8789
|
}
|
|
8790
|
+
const rootTabPath = withBasePath(basePath, options.localizedRoot ?? "/");
|
|
8741
8791
|
if (options.sidebar) {
|
|
8742
8792
|
const sidebar2 = buildConfigSidebar(options.sidebar, byRoute, display, basePath);
|
|
8743
8793
|
return {
|
|
8744
8794
|
featured,
|
|
8795
|
+
root: rootTabPath,
|
|
8745
8796
|
selectors,
|
|
8746
8797
|
sidebar: sidebar2,
|
|
8747
8798
|
tabs: withTabHrefs(tabs, sidebar2)
|
|
8748
8799
|
};
|
|
8749
8800
|
}
|
|
8750
|
-
const rootTabPath = withBasePath(basePath, options.localizedRoot ?? "/");
|
|
8751
8801
|
const sidebar = buildFileSystemSidebar(pages, options.folderMeta, sharedFolderMeta, metaPrefix, display, new Set(tabs.flatMap((tab) => tab.path === rootTabPath ? [] : [tab.path])), options.diagnostics);
|
|
8752
8802
|
return {
|
|
8753
8803
|
featured,
|
|
8804
|
+
root: rootTabPath,
|
|
8754
8805
|
selectors,
|
|
8755
8806
|
sidebar,
|
|
8756
8807
|
tabs: withTabHrefs(tabs, sidebar)
|
|
@@ -12488,6 +12539,7 @@ import {
|
|
|
12488
12539
|
lstat,
|
|
12489
12540
|
mkdir as mkdir6,
|
|
12490
12541
|
readFile as readFile14,
|
|
12542
|
+
realpath,
|
|
12491
12543
|
rename,
|
|
12492
12544
|
rm as rm2,
|
|
12493
12545
|
symlink,
|
|
@@ -14441,6 +14493,28 @@ var astroConflictWarning = (blumeAstroPkg, shadowAstroPkg) => {
|
|
|
14441
14493
|
const pin = blume ?? "<Blume's astro version>";
|
|
14442
14494
|
return `Astro version conflict: another dependency hoisted ${versions} to the project root, so @astrojs/mdx binds to the wrong copy and the build fails on a missing export (e.g. "chunkToString"). A single symlink can't reconcile a split install — pin Blume's Astro by adding a package.json "overrides" (npm/bun/pnpm) or "resolutions" (yarn) entry { "astro": "${pin}" }, then reinstall. Run \`npm ls astro\` to find the dependency pulling the older copy.`;
|
|
14443
14495
|
};
|
|
14496
|
+
var dropStaleDepsLink = async (link, pkgDir) => {
|
|
14497
|
+
let existing;
|
|
14498
|
+
try {
|
|
14499
|
+
existing = await lstat(link);
|
|
14500
|
+
} catch {
|
|
14501
|
+
return;
|
|
14502
|
+
}
|
|
14503
|
+
if (!existing.isSymbolicLink()) {
|
|
14504
|
+
return;
|
|
14505
|
+
}
|
|
14506
|
+
let linkedBlume;
|
|
14507
|
+
let runningBlume;
|
|
14508
|
+
try {
|
|
14509
|
+
linkedBlume = await realpath(join26(link, "blume"));
|
|
14510
|
+
runningBlume = await realpath(pkgDir);
|
|
14511
|
+
} catch {
|
|
14512
|
+
return;
|
|
14513
|
+
}
|
|
14514
|
+
if (linkedBlume !== runningBlume) {
|
|
14515
|
+
await rm2(link, { force: true });
|
|
14516
|
+
}
|
|
14517
|
+
};
|
|
14444
14518
|
var ensureDepsLink = async (outDir, pkgDir = packageRoot()) => {
|
|
14445
14519
|
const astroDir = candidateHolding(pkgDir, "astro");
|
|
14446
14520
|
if (!astroDir) {
|
|
@@ -14448,6 +14522,7 @@ var ensureDepsLink = async (outDir, pkgDir = packageRoot()) => {
|
|
|
14448
14522
|
}
|
|
14449
14523
|
const mdxDir = candidateHolding(pkgDir, "@astrojs", "mdx");
|
|
14450
14524
|
const blumeAstro = resolveAstroPackageJson(astroDir);
|
|
14525
|
+
await dropStaleDepsLink(join26(outDir, "node_modules"), pkgDir);
|
|
14451
14526
|
const outDirAstro = resolvedAstroPath(outDir);
|
|
14452
14527
|
const astroCorrect = blumeAstro !== null && outDirAstro === blumeAstro;
|
|
14453
14528
|
if (astroCorrect && mdxDir === astroDir) {
|
|
@@ -17224,5 +17299,5 @@ process.on("unhandledRejection", (error) => {
|
|
|
17224
17299
|
});
|
|
17225
17300
|
runMain(main);
|
|
17226
17301
|
|
|
17227
|
-
//# debugId=
|
|
17302
|
+
//# debugId=7D02660AA9B8797064756E2164756E21
|
|
17228
17303
|
//# sourceMappingURL=index.js.map
|