@thebuilder/umbraco-docs 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.
- package/README.md +54 -0
- package/components/EcosystemSection.astro +40 -0
- package/components/InstallCommand.astro +14 -0
- package/components/LandingHero.astro +27 -0
- package/components/LandingRoot.astro +18 -0
- package/components/PageShell.astro +34 -0
- package/components/ScreenshotFrame.astro +10 -0
- package/components/SectionHeading.astro +10 -0
- package/components/index.ts +7 -0
- package/dist/behaviors.d.ts +1 -0
- package/dist/behaviors.js +50 -0
- package/dist/behaviors.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -0
- package/dist/og/cli.d.ts +2 -0
- package/dist/og/cli.js +14 -0
- package/dist/og/cli.js.map +1 -0
- package/dist/og/generator.d.ts +6 -0
- package/dist/og/generator.js +110 -0
- package/dist/og/generator.js.map +1 -0
- package/dist/og/index.d.ts +3 -0
- package/dist/og/index.js +3 -0
- package/dist/og/index.js.map +1 -0
- package/dist/og/types.d.ts +18 -0
- package/dist/og/types.js +33 -0
- package/dist/og/types.js.map +1 -0
- package/dist/package.d.ts +24 -0
- package/dist/package.js +67 -0
- package/dist/package.js.map +1 -0
- package/dist/validation.d.ts +4 -0
- package/dist/validation.js +17 -0
- package/dist/validation.js.map +1 -0
- package/favicon.png +0 -0
- package/icon.png +0 -0
- package/package.json +65 -0
- package/public/logo.png +0 -0
- package/styles/landing.css +63 -0
package/README.md
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img src="public/logo.png" width="96" height="96" alt="@thebuilder/umbraco-docs" />
|
|
3
|
+
</p>
|
|
4
|
+
|
|
5
|
+
# @thebuilder/umbraco-docs
|
|
6
|
+
|
|
7
|
+
Shared, composable presentation and metadata contracts for TheBuilder's Umbraco package documentation. Product facts and product-specific content stay in each consumer repository.
|
|
8
|
+
|
|
9
|
+
## Consumer manifest
|
|
10
|
+
|
|
11
|
+
```ts
|
|
12
|
+
import { defineUmbracoPackage } from "@thebuilder/umbraco-docs";
|
|
13
|
+
|
|
14
|
+
export const packageManifest = defineUmbracoPackage({
|
|
15
|
+
id: "thebuilder.example",
|
|
16
|
+
name: "Example",
|
|
17
|
+
summary: "A focused Umbraco package.",
|
|
18
|
+
links: {
|
|
19
|
+
docs: "https://example.com",
|
|
20
|
+
nuget: "https://www.nuget.org/packages/TheBuilder.Example",
|
|
21
|
+
marketplace: "https://marketplace.umbraco.com/package/thebuilder.example",
|
|
22
|
+
github: "https://github.com/thebuilder/example",
|
|
23
|
+
},
|
|
24
|
+
logo: "/logo.svg",
|
|
25
|
+
compatibility: { umbraco: ">=17 <19" },
|
|
26
|
+
status: "stable",
|
|
27
|
+
categories: ["Developer Tools"],
|
|
28
|
+
});
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Astro consumers can import individual components from `@thebuilder/umbraco-docs/components/*`. Wrap composed landing content in `LandingRoot`; it owns the scoped cascade-layer stylesheet plus clipboard and reduced-motion-safe reveal behavior.
|
|
32
|
+
|
|
33
|
+
```astro
|
|
34
|
+
---
|
|
35
|
+
import { InstallCommand, LandingHero, LandingRoot } from "@thebuilder/umbraco-docs/astro";
|
|
36
|
+
---
|
|
37
|
+
|
|
38
|
+
<LandingRoot>
|
|
39
|
+
<LandingHero title="Example" description="A focused Umbraco package." logo="/logo.svg">
|
|
40
|
+
<InstallCommand slot="install" command="dotnet add package TheBuilder.Example" />
|
|
41
|
+
</LandingHero>
|
|
42
|
+
</LandingRoot>
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## Open Graph images
|
|
46
|
+
|
|
47
|
+
Create `umbraco-docs.config.mjs` with content/public directories, a `/social` or `/og` prefix, and root card copy. Pages opt in with Blume-native `title`, `description`, and `seo.image` frontmatter. Then run:
|
|
48
|
+
|
|
49
|
+
```sh
|
|
50
|
+
pnpm exec umbraco-docs-og
|
|
51
|
+
pnpm exec umbraco-docs-og --check
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
Generation is deterministic. Check mode fails when an expected image is missing or stale.
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
---
|
|
2
|
+
import type { UmbracoPackage } from "@thebuilder/umbraco-docs";
|
|
3
|
+
import SectionHeading from "./SectionHeading.astro";
|
|
4
|
+
|
|
5
|
+
interface Props {
|
|
6
|
+
packages: readonly UmbracoPackage[];
|
|
7
|
+
currentPackageId?: string;
|
|
8
|
+
title?: string;
|
|
9
|
+
description?: string;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const {
|
|
13
|
+
packages,
|
|
14
|
+
currentPackageId,
|
|
15
|
+
title = "More from TheBuilder",
|
|
16
|
+
description = "Focused packages for modern Umbraco projects.",
|
|
17
|
+
} = Astro.props;
|
|
18
|
+
const visiblePackages = packages.filter((item) => item.id !== currentPackageId);
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
{visiblePackages.length > 0 && (
|
|
22
|
+
<section class="udocs-shell udocs-ecosystem" aria-labelledby="udocs-ecosystem-title">
|
|
23
|
+
<SectionHeading id="udocs-ecosystem-title" title={title} description={description} />
|
|
24
|
+
<ul class="udocs-ecosystem__list" role="list">
|
|
25
|
+
{visiblePackages.map((item) => (
|
|
26
|
+
<li class="udocs-ecosystem__item" data-udocs-reveal>
|
|
27
|
+
<img src={item.logo} width="48" height="48" alt="" loading="lazy" />
|
|
28
|
+
<div>
|
|
29
|
+
<div class="udocs-ecosystem__title">
|
|
30
|
+
<h3>{item.name}</h3>
|
|
31
|
+
<span>{item.status}</span>
|
|
32
|
+
</div>
|
|
33
|
+
<p>{item.summary}</p>
|
|
34
|
+
<a href={item.links.docs}>Read the docs <span aria-hidden="true">→</span></a>
|
|
35
|
+
</div>
|
|
36
|
+
</li>
|
|
37
|
+
))}
|
|
38
|
+
</ul>
|
|
39
|
+
</section>
|
|
40
|
+
)}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
---
|
|
2
|
+
interface Props { command: string; label?: string; }
|
|
3
|
+
const { command, label = "Copy install command" } = Astro.props;
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
<div class="udocs-install" data-udocs-reveal>
|
|
7
|
+
<span aria-hidden="true">$</span>
|
|
8
|
+
<code>{command}</code>
|
|
9
|
+
<button type="button" data-udocs-copy={command} aria-label={label}>
|
|
10
|
+
<svg data-copy-icon viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true"><rect x="9" y="9" width="13" height="13" rx="2"></rect><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"></path></svg>
|
|
11
|
+
<svg data-done-icon viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor" stroke-width="2.5" aria-hidden="true"><path d="m20 6-11 11-5-5"></path></svg>
|
|
12
|
+
</button>
|
|
13
|
+
<span class="udocs-visually-hidden" data-udocs-copy-status aria-live="polite"></span>
|
|
14
|
+
</div>
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
---
|
|
2
|
+
interface Props {
|
|
3
|
+
title: string;
|
|
4
|
+
description: string;
|
|
5
|
+
logo: string;
|
|
6
|
+
logoAlt?: string;
|
|
7
|
+
accent?: string;
|
|
8
|
+
compatibility?: string;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
const { title, description, logo, logoAlt = "", accent, compatibility } = Astro.props;
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
<section class="udocs-hero" aria-labelledby="udocs-hero-title">
|
|
15
|
+
<div class="udocs-hero__glow" aria-hidden="true"></div>
|
|
16
|
+
<div class="udocs-shell udocs-hero__inner">
|
|
17
|
+
<img class="udocs-hero__logo" src={logo} width="72" height="72" alt={logoAlt} data-udocs-reveal />
|
|
18
|
+
<h1 id="udocs-hero-title" class="udocs-hero__title" data-udocs-reveal>
|
|
19
|
+
{title}{accent && <> <span class="udocs-hero__accent">{accent}</span></>}
|
|
20
|
+
</h1>
|
|
21
|
+
<p class="udocs-hero__description" data-udocs-reveal>{description}</p>
|
|
22
|
+
<div class="udocs-hero__actions" data-udocs-reveal><slot name="actions" /></div>
|
|
23
|
+
<slot name="install" />
|
|
24
|
+
{compatibility && <p class="udocs-hero__compatibility" data-udocs-reveal>{compatibility}</p>}
|
|
25
|
+
</div>
|
|
26
|
+
<slot />
|
|
27
|
+
</section>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
---
|
|
2
|
+
import "../styles/landing.css";
|
|
3
|
+
|
|
4
|
+
interface Props { class?: string; }
|
|
5
|
+
const { class: className } = Astro.props;
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
<div class:list={["udocs-landing", className]} data-udocs-root>
|
|
9
|
+
<slot />
|
|
10
|
+
</div>
|
|
11
|
+
|
|
12
|
+
<script>
|
|
13
|
+
import { initializeUmbracoDocs } from "@thebuilder/umbraco-docs/behaviors";
|
|
14
|
+
|
|
15
|
+
const initialize = () => initializeUmbracoDocs(document);
|
|
16
|
+
initialize();
|
|
17
|
+
document.addEventListener("astro:page-load", initialize);
|
|
18
|
+
</script>
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
---
|
|
2
|
+
// Blume 1.x exposes PageLayout and its generated site data at these stable entry points.
|
|
3
|
+
import PageLayout from "blume/components/layout/PageLayout.astro";
|
|
4
|
+
import data from "blume:data";
|
|
5
|
+
|
|
6
|
+
interface Props {
|
|
7
|
+
title: string;
|
|
8
|
+
description: string;
|
|
9
|
+
route?: string;
|
|
10
|
+
ogImage?: string;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const { title, description, route = "/", ogImage } = Astro.props;
|
|
14
|
+
const { config } = data;
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
<PageLayout
|
|
18
|
+
site={{ title: config.title, description: config.description }}
|
|
19
|
+
logo={config.logo}
|
|
20
|
+
favicon={config.favicon}
|
|
21
|
+
banner={config.banner}
|
|
22
|
+
analytics={config.analytics}
|
|
23
|
+
navigation={data.navigation}
|
|
24
|
+
fontCssVars={data.fontCssVars}
|
|
25
|
+
themeMode={config.theme.mode}
|
|
26
|
+
searchEnabled={config.search.enabled}
|
|
27
|
+
siteUrl={config.site}
|
|
28
|
+
ogEnabled={Boolean(ogImage)}
|
|
29
|
+
ogImage={ogImage}
|
|
30
|
+
page={{ title, description, route }}
|
|
31
|
+
>
|
|
32
|
+
<slot />
|
|
33
|
+
<slot name="footer" slot="footer" />
|
|
34
|
+
</PageLayout>
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
---
|
|
2
|
+
interface Props { src: string; alt: string; width: number; height: number; eager?: boolean; }
|
|
3
|
+
const { src, alt, width, height, eager = false } = Astro.props;
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
<figure class="udocs-screenshot" data-udocs-reveal>
|
|
7
|
+
<div class="udocs-screenshot__bar" aria-hidden="true"><span></span><span></span><span></span></div>
|
|
8
|
+
<img src={src} alt={alt} width={width} height={height} loading={eager ? "eager" : "lazy"} decoding="async" />
|
|
9
|
+
<slot name="caption" />
|
|
10
|
+
</figure>
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
---
|
|
2
|
+
interface Props { id: string; title: string; description?: string; align?: "start" | "center"; }
|
|
3
|
+
const { id, title, description, align = "center" } = Astro.props;
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
<header class:list={["udocs-section-heading", `udocs-section-heading--${align}`]} data-udocs-reveal>
|
|
7
|
+
<span class="udocs-section-heading__rule" aria-hidden="true"></span>
|
|
8
|
+
<h2 id={id}>{title}</h2>
|
|
9
|
+
{description && <p>{description}</p>}
|
|
10
|
+
</header>
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { default as EcosystemSection } from "./EcosystemSection.astro";
|
|
2
|
+
export { default as InstallCommand } from "./InstallCommand.astro";
|
|
3
|
+
export { default as LandingHero } from "./LandingHero.astro";
|
|
4
|
+
export { default as LandingRoot } from "./LandingRoot.astro";
|
|
5
|
+
export { default as PageShell } from "./PageShell.astro";
|
|
6
|
+
export { default as ScreenshotFrame } from "./ScreenshotFrame.astro";
|
|
7
|
+
export { default as SectionHeading } from "./SectionHeading.astro";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function initializeUmbracoDocs(root?: ParentNode): void;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
const initialized = new WeakSet();
|
|
2
|
+
export function initializeUmbracoDocs(root = document) {
|
|
3
|
+
const reducedMotion = window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
4
|
+
for (const landing of root.querySelectorAll("[data-udocs-root]")) {
|
|
5
|
+
if (initialized.has(landing))
|
|
6
|
+
continue;
|
|
7
|
+
initialized.add(landing);
|
|
8
|
+
const reveals = landing.querySelectorAll("[data-udocs-reveal]");
|
|
9
|
+
if (!reducedMotion && "IntersectionObserver" in window) {
|
|
10
|
+
landing.dataset.udocsMotion = "true";
|
|
11
|
+
const observer = new IntersectionObserver((entries) => {
|
|
12
|
+
for (const entry of entries) {
|
|
13
|
+
if (!entry.isIntersecting)
|
|
14
|
+
continue;
|
|
15
|
+
entry.target.dataset.udocsVisible = "true";
|
|
16
|
+
observer.unobserve(entry.target);
|
|
17
|
+
}
|
|
18
|
+
}, { rootMargin: "0px 0px -10%", threshold: 0.1 });
|
|
19
|
+
reveals.forEach((element) => observer.observe(element));
|
|
20
|
+
}
|
|
21
|
+
else {
|
|
22
|
+
reveals.forEach((element) => { element.dataset.udocsVisible = "true"; });
|
|
23
|
+
}
|
|
24
|
+
landing.querySelectorAll("[data-udocs-copy]").forEach((button) => {
|
|
25
|
+
const status = button.parentElement?.querySelector("[data-udocs-copy-status]");
|
|
26
|
+
button.addEventListener("click", async () => {
|
|
27
|
+
const value = button.dataset.udocsCopy;
|
|
28
|
+
if (!value)
|
|
29
|
+
return;
|
|
30
|
+
try {
|
|
31
|
+
await navigator.clipboard.writeText(value);
|
|
32
|
+
button.dataset.udocsCopied = "true";
|
|
33
|
+
if (status)
|
|
34
|
+
status.textContent = "Copied";
|
|
35
|
+
window.setTimeout(() => {
|
|
36
|
+
delete button.dataset.udocsCopied;
|
|
37
|
+
if (status)
|
|
38
|
+
status.textContent = "";
|
|
39
|
+
}, 1600);
|
|
40
|
+
}
|
|
41
|
+
catch {
|
|
42
|
+
button.dataset.udocsCopyFailed = "true";
|
|
43
|
+
if (status)
|
|
44
|
+
status.textContent = "Copy failed. Select and copy the command manually.";
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=behaviors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"behaviors.js","sourceRoot":"","sources":["../src/behaviors.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,GAAG,IAAI,OAAO,EAAe,CAAC;AAE/C,MAAM,UAAU,qBAAqB,CAAC,OAAmB,QAAQ;IAC/D,MAAM,aAAa,GAAG,MAAM,CAAC,UAAU,CAAC,kCAAkC,CAAC,CAAC,OAAO,CAAC;IAEpF,KAAK,MAAM,OAAO,IAAI,IAAI,CAAC,gBAAgB,CAAc,mBAAmB,CAAC,EAAE,CAAC;QAC9E,IAAI,WAAW,CAAC,GAAG,CAAC,OAAO,CAAC;YAAE,SAAS;QACvC,WAAW,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;QACzB,MAAM,OAAO,GAAG,OAAO,CAAC,gBAAgB,CAAc,qBAAqB,CAAC,CAAC;QAC7E,IAAI,CAAC,aAAa,IAAI,sBAAsB,IAAI,MAAM,EAAE,CAAC;YACvD,OAAO,CAAC,OAAO,CAAC,WAAW,GAAG,MAAM,CAAC;YACrC,MAAM,QAAQ,GAAG,IAAI,oBAAoB,CAAC,CAAC,OAAO,EAAE,EAAE;gBACpD,KAAK,MAAM,KAAK,IAAI,OAAO,EAAE,CAAC;oBAC5B,IAAI,CAAC,KAAK,CAAC,cAAc;wBAAE,SAAS;oBACnC,KAAK,CAAC,MAA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BAAC,MAAM,CAAC;oBACP,MAAM,CAAC,OAAO,CAAC,eAAe,GAAG,MAAM,CAAC;oBACxC,IAAI,MAAM;wBAAE,MAAM,CAAC,WAAW,GAAG,oDAAoD,CAAC;gBACxF,CAAC;YACH,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC;AACH,CAAC"}
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,wBAAwB,EACxB,oBAAoB,EACpB,sBAAsB,GACvB,MAAM,cAAc,CAAC"}
|
package/dist/og/cli.d.ts
ADDED
package/dist/og/cli.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { pathToFileURL } from "node:url";
|
|
3
|
+
import path from "node:path";
|
|
4
|
+
import { generateOgImages } from "./generator.js";
|
|
5
|
+
const args = process.argv.slice(2);
|
|
6
|
+
const check = args.includes("--check");
|
|
7
|
+
const configArgument = args.find((argument) => !argument.startsWith("--")) ?? "umbraco-docs.config.mjs";
|
|
8
|
+
const configPath = path.resolve(configArgument);
|
|
9
|
+
const imported = await import(pathToFileURL(configPath).href);
|
|
10
|
+
if (!imported.default)
|
|
11
|
+
throw new TypeError(`${configPath} must default-export an OG config`);
|
|
12
|
+
const cards = await generateOgImages(imported.default, { check });
|
|
13
|
+
console.log(`${check ? "Checked" : "Generated"} ${cards.length} Open Graph image${cards.length === 1 ? "" : "s"}.`);
|
|
14
|
+
//# sourceMappingURL=cli.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../../src/og/cli.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAGlD,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AACnC,MAAM,KAAK,GAAG,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;AACvC,MAAM,cAAc,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC,QAAQ,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,IAAI,yBAAyB,CAAC;AACxG,MAAM,UAAU,GAAG,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC;AAChD,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC,IAAI,CAAsC,CAAC;AACnG,IAAI,CAAC,QAAQ,CAAC,OAAO;IAAE,MAAM,IAAI,SAAS,CAAC,GAAG,UAAU,mCAAmC,CAAC,CAAC;AAC7F,MAAM,KAAK,GAAG,MAAM,gBAAgB,CAAC,QAAQ,CAAC,OAAO,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC;AAClE,OAAO,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,WAAW,IAAI,KAAK,CAAC,MAAM,oBAAoB,KAAK,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { OgCardInput, UmbracoDocsOgConfig } from "./types.js";
|
|
2
|
+
export declare function resolvePublicImagePath(publicDir: string, image: string, prefix?: string): string;
|
|
3
|
+
export declare function collectOgCards(config: UmbracoDocsOgConfig): Promise<OgCardInput[]>;
|
|
4
|
+
export declare function generateOgImages(config: UmbracoDocsOgConfig, options?: {
|
|
5
|
+
check?: boolean;
|
|
6
|
+
}): Promise<OgCardInput[]>;
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { readFile, readdir, mkdir, writeFile } from "node:fs/promises";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import matter from "gray-matter";
|
|
4
|
+
import sharp from "sharp";
|
|
5
|
+
import { validateOgConfig } from "./types.js";
|
|
6
|
+
const WIDTH = 1200;
|
|
7
|
+
const HEIGHT = 630;
|
|
8
|
+
function escapeXml(value) {
|
|
9
|
+
return value.replace(/[<>&"']/g, (character) => ({ "<": "<", ">": ">", "&": "&", '"': """, "'": "'" })[character] ?? character);
|
|
10
|
+
}
|
|
11
|
+
function wrap(value, max = 42) {
|
|
12
|
+
const words = value.trim().split(/\s+/);
|
|
13
|
+
const lines = [];
|
|
14
|
+
for (const word of words) {
|
|
15
|
+
const current = lines.at(-1);
|
|
16
|
+
if (!current || current.length + word.length + 1 > max)
|
|
17
|
+
lines.push(word);
|
|
18
|
+
else
|
|
19
|
+
lines[lines.length - 1] = `${current} ${word}`;
|
|
20
|
+
}
|
|
21
|
+
return lines.slice(0, 3);
|
|
22
|
+
}
|
|
23
|
+
export function resolvePublicImagePath(publicDir, image, prefix = "/social") {
|
|
24
|
+
if (!image.startsWith(`${prefix}/`) || !image.endsWith(".png") || image.includes("\\") || image.split("/").includes("..")) {
|
|
25
|
+
throw new TypeError(`Unsafe OG image path ${image}; expected a .png below ${prefix}/`);
|
|
26
|
+
}
|
|
27
|
+
const root = path.resolve(publicDir);
|
|
28
|
+
const output = path.resolve(root, `.${image}`);
|
|
29
|
+
if (!output.startsWith(`${root}${path.sep}`))
|
|
30
|
+
throw new TypeError(`OG image escapes public directory: ${image}`);
|
|
31
|
+
return output;
|
|
32
|
+
}
|
|
33
|
+
async function contentFiles(directory) {
|
|
34
|
+
const entries = await readdir(directory, { withFileTypes: true });
|
|
35
|
+
const nested = await Promise.all(entries.map(async (entry) => {
|
|
36
|
+
const absolute = path.join(directory, entry.name);
|
|
37
|
+
if (entry.isDirectory())
|
|
38
|
+
return contentFiles(absolute);
|
|
39
|
+
return /\.mdx?$/.test(entry.name) ? [absolute] : [];
|
|
40
|
+
}));
|
|
41
|
+
return nested.flat().sort();
|
|
42
|
+
}
|
|
43
|
+
export async function collectOgCards(config) {
|
|
44
|
+
const validated = validateOgConfig(config);
|
|
45
|
+
return collectValidatedOgCards(validated);
|
|
46
|
+
}
|
|
47
|
+
async function collectValidatedOgCards(validated) {
|
|
48
|
+
const prefix = validated.prefix ?? "/social";
|
|
49
|
+
const cards = [{
|
|
50
|
+
title: validated.root.title,
|
|
51
|
+
description: validated.root.description,
|
|
52
|
+
image: validated.root.image ?? `${prefix}/index.png`,
|
|
53
|
+
}];
|
|
54
|
+
for (const file of await contentFiles(validated.contentDir)) {
|
|
55
|
+
const { data } = matter(await readFile(file, "utf8"));
|
|
56
|
+
const image = data.seo?.image;
|
|
57
|
+
if (image === undefined)
|
|
58
|
+
continue;
|
|
59
|
+
if (typeof image !== "string")
|
|
60
|
+
throw new TypeError(`${file}: seo.image must be a string`);
|
|
61
|
+
if (typeof data.title !== "string" || !data.title.trim())
|
|
62
|
+
throw new TypeError(`${file}: title must be a non-empty string when seo.image is set`);
|
|
63
|
+
if (typeof data.description !== "string" || !data.description.trim())
|
|
64
|
+
throw new TypeError(`${file}: description must be a non-empty string when seo.image is set`);
|
|
65
|
+
cards.push({ title: data.title, description: data.description, image });
|
|
66
|
+
}
|
|
67
|
+
const byImage = new Map();
|
|
68
|
+
for (const card of cards) {
|
|
69
|
+
resolvePublicImagePath(validated.publicDir, card.image, prefix);
|
|
70
|
+
if (byImage.has(card.image))
|
|
71
|
+
throw new TypeError(`Duplicate OG image path: ${card.image}`);
|
|
72
|
+
byImage.set(card.image, card);
|
|
73
|
+
}
|
|
74
|
+
return [...byImage.values()].sort((a, b) => a.image.localeCompare(b.image));
|
|
75
|
+
}
|
|
76
|
+
async function renderCard(card, config) {
|
|
77
|
+
const titleLines = wrap(card.title);
|
|
78
|
+
const title = titleLines.map((line, index) => `<text x="72" y="${220 + index * 74}" class="title">${escapeXml(line)}</text>`).join("");
|
|
79
|
+
const description = wrap(card.description, 72).slice(0, 2).map((line, index) => `<text x="72" y="${480 + index * 34}" class="description">${escapeXml(line)}</text>`).join("");
|
|
80
|
+
const svg = `<svg width="${WIDTH}" height="${HEIGHT}" xmlns="http://www.w3.org/2000/svg"><style>.brand{font:600 26px system-ui,sans-serif;fill:#94a3b8}.title{font:700 58px system-ui,sans-serif;fill:#f8fafc}.description{font:400 26px system-ui,sans-serif;fill:#cbd5e1}</style><rect width="1200" height="630" fill="#0f172a"/><rect x="0" width="12" height="630" fill="${escapeXml(config.accent ?? "#2563eb")}"/><text x="72" y="92" class="brand">${escapeXml(config.brand ?? "TheBuilder · Umbraco")}</text>${title}${description}</svg>`;
|
|
81
|
+
return sharp(Buffer.from(svg)).png({ compressionLevel: 9, adaptiveFiltering: false, palette: false }).toBuffer();
|
|
82
|
+
}
|
|
83
|
+
export async function generateOgImages(config, options = {}) {
|
|
84
|
+
const validated = validateOgConfig(config);
|
|
85
|
+
const cards = await collectValidatedOgCards(validated);
|
|
86
|
+
const outputs = await Promise.all(cards.map(async (card) => ({
|
|
87
|
+
card,
|
|
88
|
+
output: resolvePublicImagePath(validated.publicDir, card.image, validated.prefix),
|
|
89
|
+
expected: await renderCard(card, validated),
|
|
90
|
+
})));
|
|
91
|
+
if (options.check) {
|
|
92
|
+
await Promise.all(outputs.map(async ({ card, output, expected }) => {
|
|
93
|
+
let actual;
|
|
94
|
+
try {
|
|
95
|
+
actual = await readFile(output);
|
|
96
|
+
}
|
|
97
|
+
catch { /* Report as stale below. */ }
|
|
98
|
+
if (!actual?.equals(expected))
|
|
99
|
+
throw new Error(`OG image is missing or stale: ${card.image}`);
|
|
100
|
+
}));
|
|
101
|
+
}
|
|
102
|
+
else {
|
|
103
|
+
await Promise.all(outputs.map(async ({ output, expected }) => {
|
|
104
|
+
await mkdir(path.dirname(output), { recursive: true });
|
|
105
|
+
await writeFile(output, expected);
|
|
106
|
+
}));
|
|
107
|
+
}
|
|
108
|
+
return cards;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AAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export interface OgCardInput {
|
|
2
|
+
title: string;
|
|
3
|
+
description: string;
|
|
4
|
+
image: string;
|
|
5
|
+
}
|
|
6
|
+
export interface OgRootCard extends Omit<OgCardInput, "image"> {
|
|
7
|
+
image?: string;
|
|
8
|
+
}
|
|
9
|
+
export interface UmbracoDocsOgConfig {
|
|
10
|
+
contentDir: string;
|
|
11
|
+
publicDir: string;
|
|
12
|
+
prefix?: "/social" | "/og" | `/${string}`;
|
|
13
|
+
root: OgRootCard;
|
|
14
|
+
brand?: string;
|
|
15
|
+
accent?: string;
|
|
16
|
+
}
|
|
17
|
+
export declare function validateOgConfig(value: unknown): UmbracoDocsOgConfig;
|
|
18
|
+
export declare function defineOgConfig(config: UmbracoDocsOgConfig): UmbracoDocsOgConfig;
|
package/dist/og/types.js
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
function isSafePrefix(value) {
|
|
2
|
+
const segments = value.slice(1).split("/");
|
|
3
|
+
return /^\/[a-z0-9._~-]+(?:\/[a-z0-9._~-]+)*$/i.test(value) && !segments.some((segment) => segment === "." || segment === "..");
|
|
4
|
+
}
|
|
5
|
+
function requirePrefix(value) {
|
|
6
|
+
const prefix = requireString(value, "prefix");
|
|
7
|
+
if (!isSafePrefix(prefix)) {
|
|
8
|
+
throw new TypeError("prefix must be a safe absolute public path such as /og or /social");
|
|
9
|
+
}
|
|
10
|
+
return prefix;
|
|
11
|
+
}
|
|
12
|
+
export function validateOgConfig(value) {
|
|
13
|
+
const input = requireRecord(value, "OG config");
|
|
14
|
+
const root = requireRecord(input.root, "root");
|
|
15
|
+
const prefix = input.prefix === undefined ? undefined : requirePrefix(input.prefix);
|
|
16
|
+
return Object.freeze({
|
|
17
|
+
contentDir: requireString(input.contentDir, "contentDir"),
|
|
18
|
+
publicDir: requireString(input.publicDir, "publicDir"),
|
|
19
|
+
...(prefix === undefined ? {} : { prefix }),
|
|
20
|
+
root: Object.freeze({
|
|
21
|
+
title: requireString(root.title, "root.title"),
|
|
22
|
+
description: requireString(root.description, "root.description"),
|
|
23
|
+
...(root.image === undefined ? {} : { image: requireString(root.image, "root.image") }),
|
|
24
|
+
}),
|
|
25
|
+
...(input.brand === undefined ? {} : { brand: requireString(input.brand, "brand") }),
|
|
26
|
+
...(input.accent === undefined ? {} : { accent: requireString(input.accent, "accent") }),
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
export function defineOgConfig(config) {
|
|
30
|
+
return validateOgConfig(config);
|
|
31
|
+
}
|
|
32
|
+
import { requireRecord, requireString } from "../validation.js";
|
|
33
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/og/types.ts"],"names":[],"mappings":"AAmBA,SAAS,YAAY,CAAC,KAAa;IACjC,MAAM,QAAQ,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAC3C,OAAO,wCAAwC,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,KAAK,GAAG,IAAI,OAAO,KAAK,IAAI,CAAC,CAAC;AAClI,CAAC;AAED,SAAS,aAAa,CAAC,KAAc;IACnC,MAAM,MAAM,GAAG,aAAa,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;IAC9C,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,EAAE,CAAC;QAC1B,MAAM,IAAI,SAAS,CAAC,mEAAmE,CAAC,CAAC;IAC3F,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,MAAM,UAAU,gBAAgB,CAAC,KAAc;IAC7C,MAAM,KAAK,GAAG,aAAa,CAAC,KAAK,EAAE,WAAW,CAAC,CAAC;IAChD,MAAM,IAAI,GA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ACxD,OAAO,gBAAgB,CAAC,MAAM,CAAC,CAAC;AAClC,CAAC;AACD,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export declare const UMBRACO_PACKAGE_STATUSES: readonly ["preview", "stable", "maintenance", "deprecated"];
|
|
2
|
+
export type UmbracoPackageStatus = (typeof UMBRACO_PACKAGE_STATUSES)[number];
|
|
3
|
+
export interface UmbracoPackageLinks {
|
|
4
|
+
docs: string;
|
|
5
|
+
nuget: string;
|
|
6
|
+
marketplace: string;
|
|
7
|
+
github: string;
|
|
8
|
+
}
|
|
9
|
+
export interface UmbracoCompatibility {
|
|
10
|
+
umbraco: string;
|
|
11
|
+
dotnet?: string;
|
|
12
|
+
}
|
|
13
|
+
export interface UmbracoPackage {
|
|
14
|
+
id: string;
|
|
15
|
+
name: string;
|
|
16
|
+
summary: string;
|
|
17
|
+
links: UmbracoPackageLinks;
|
|
18
|
+
logo: string;
|
|
19
|
+
compatibility: UmbracoCompatibility;
|
|
20
|
+
status: UmbracoPackageStatus;
|
|
21
|
+
categories?: readonly string[];
|
|
22
|
+
}
|
|
23
|
+
export declare function validateUmbracoPackage(value: unknown): UmbracoPackage;
|
|
24
|
+
export declare function defineUmbracoPackage(value: UmbracoPackage): UmbracoPackage;
|
package/dist/package.js
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { isNonEmptyString, requireRecord, requireString } from "./validation.js";
|
|
2
|
+
export const UMBRACO_PACKAGE_STATUSES = ["preview", "stable", "maintenance", "deprecated"];
|
|
3
|
+
const stableId = /^[a-z0-9]+(?:[.-][a-z0-9]+)*$/;
|
|
4
|
+
const publicRootPath = /^\/(?!\/)(?!.*(?:^|\/)\.\.(?:\/|$))[^\s\\?#]+$/;
|
|
5
|
+
function isHttpsUrl(value) {
|
|
6
|
+
if (typeof value !== "string")
|
|
7
|
+
return false;
|
|
8
|
+
try {
|
|
9
|
+
const url = new URL(value);
|
|
10
|
+
return url.protocol === "https:" && Boolean(url.hostname) && !url.username && !url.password;
|
|
11
|
+
}
|
|
12
|
+
catch {
|
|
13
|
+
return false;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
function requireHttpsUrl(value, field) {
|
|
17
|
+
if (!isHttpsUrl(value))
|
|
18
|
+
throw new TypeError(`${field} must be an absolute https URL`);
|
|
19
|
+
return value;
|
|
20
|
+
}
|
|
21
|
+
function requireStatus(value) {
|
|
22
|
+
const status = UMBRACO_PACKAGE_STATUSES.find((candidate) => candidate === value);
|
|
23
|
+
if (!status)
|
|
24
|
+
throw new TypeError("status is invalid");
|
|
25
|
+
return status;
|
|
26
|
+
}
|
|
27
|
+
export function validateUmbracoPackage(value) {
|
|
28
|
+
const input = requireRecord(value, "package");
|
|
29
|
+
const id = requireString(input.id, "id");
|
|
30
|
+
if (!stableId.test(id))
|
|
31
|
+
throw new TypeError("id must be a stable lowercase dotted or dashed identifier");
|
|
32
|
+
const logo = requireString(input.logo, "logo");
|
|
33
|
+
if (!publicRootPath.test(logo))
|
|
34
|
+
throw new TypeError("logo must be a safe public-root path beginning with one /");
|
|
35
|
+
const rawLinks = requireRecord(input.links, "links");
|
|
36
|
+
const links = Object.freeze({
|
|
37
|
+
docs: requireHttpsUrl(rawLinks.docs, "links.docs"),
|
|
38
|
+
nuget: requireHttpsUrl(rawLinks.nuget, "links.nuget"),
|
|
39
|
+
marketplace: requireHttpsUrl(rawLinks.marketplace, "links.marketplace"),
|
|
40
|
+
github: requireHttpsUrl(rawLinks.github, "links.github"),
|
|
41
|
+
});
|
|
42
|
+
const rawCompatibility = requireRecord(input.compatibility, "compatibility");
|
|
43
|
+
const dotnet = rawCompatibility.dotnet === undefined ? undefined : requireString(rawCompatibility.dotnet, "compatibility.dotnet");
|
|
44
|
+
const compatibility = Object.freeze({
|
|
45
|
+
umbraco: requireString(rawCompatibility.umbraco, "compatibility.umbraco"),
|
|
46
|
+
...(dotnet === undefined ? {} : { dotnet }),
|
|
47
|
+
});
|
|
48
|
+
const status = requireStatus(input.status);
|
|
49
|
+
const rawCategories = input.categories;
|
|
50
|
+
if (rawCategories !== undefined && (!Array.isArray(rawCategories) || rawCategories.some((category) => !isNonEmptyString(category)))) {
|
|
51
|
+
throw new TypeError("categories must contain only non-empty strings");
|
|
52
|
+
}
|
|
53
|
+
return Object.freeze({
|
|
54
|
+
id,
|
|
55
|
+
name: requireString(input.name, "name"),
|
|
56
|
+
summary: requireString(input.summary, "summary"),
|
|
57
|
+
links,
|
|
58
|
+
logo,
|
|
59
|
+
compatibility,
|
|
60
|
+
status,
|
|
61
|
+
...(rawCategories === undefined ? {} : { categories: Object.freeze(rawCategories.map((category) => requireString(category, "category"))) }),
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
export function defineUmbracoPackage(value) {
|
|
65
|
+
return validateUmbracoPackage(value);
|
|
66
|
+
}
|
|
67
|
+
//# sourceMappingURL=package.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"package.js","sourceRoot":"","sources":["../src/package.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEjF,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,SAAS,EAAE,QAAQ,EAAE,aAAa,EAAE,YAAY,CAAU,CAAC;AA2BpG,MAAM,QAAQ,GAAG,+BAA+B,CAAC;AACjD,MAAM,cAAc,GAAG,gDAAgD,CAAC;AAExE,SAAS,UAAU,CAAC,KAAc;IAChC,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAC;IAC5C,IAAI,CAAC;QACH,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,KAAK,CAAC,CAAC;QAC3B,OAAO,GAAG,CAAC,QAAQ,KAAK,QAAQ,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,QAA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AE,SAAS,CAAC;QAChD,KAAK;QACL,IAAI;QACJ,aAAa;QACb,MAAM;QACN,GAAG,CAAC,aAAa,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,UAAU,EAAE,MAAM,CAAC,MAAM,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,aAAa,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC,CAAC,EAAE,CAAC;KAC5I,CAAC,CAAC;AACL,CAAC;AAED,MAAM,UAAU,oBAAoB,CAAC,KAAqB;IACxD,OAAO,sBAAsB,CAAC,KAAK,CAAC,CAAC;AACvC,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare function isRecord(value: unknown): value is Record<string, unknown>;
|
|
2
|
+
export declare function isNonEmptyString(value: unknown): value is string;
|
|
3
|
+
export declare function requireRecord(value: unknown, field: string): Record<string, unknown>;
|
|
4
|
+
export declare function requireString(value: unknown, field: string): string;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export function isRecord(value) {
|
|
2
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
3
|
+
}
|
|
4
|
+
export function isNonEmptyString(value) {
|
|
5
|
+
return typeof value === "string" && value.trim().length > 0;
|
|
6
|
+
}
|
|
7
|
+
export function requireRecord(value, field) {
|
|
8
|
+
if (!isRecord(value))
|
|
9
|
+
throw new TypeError(`${field} must be an object`);
|
|
10
|
+
return value;
|
|
11
|
+
}
|
|
12
|
+
export function requireString(value, field) {
|
|
13
|
+
if (!isNonEmptyString(value))
|
|
14
|
+
throw new TypeError(`${field} must be a non-empty string`);
|
|
15
|
+
return value;
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=validation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validation.js","sourceRoot":"","sources":["../src/validation.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,QAAQ,CAAC,KAAc;IACrC,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAC9E,CAAC;AAED,MAAM,UAAU,gBAAgB,CAAC,KAAc;IAC7C,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,IAAI,EAAE,CAAC,MAAM,GAAG,CAAC,CAAC;AAC9D,CAAC;AAED,MAAM,UAAU,aAAa,CAAC,KAAc,EAAE,KAAa;IACzD,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC;QAAE,MAAM,IAAI,SAAS,CAAC,GAAG,KAAK,oBAAoB,CAAC,CAAC;IACxE,OAAO,KAAK,CAAC;AACf,CAAC;AAED,MAAM,UAAU,aAAa,CAAC,KAAc,EAAE,KAAa;IACzD,IAAI,CAAC,gBAAgB,CAAC,KAAK,CAAC;QAAE,MAAM,IAAI,SAAS,CAAC,GAAG,KAAK,6BAA6B,CAAC,CAAC;IACzF,OAAO,KAAK,CAAC;AACf,CAAC"}
|
package/favicon.png
ADDED
|
Binary file
|
package/icon.png
ADDED
|
Binary file
|
package/package.json
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@thebuilder/umbraco-docs",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Composable Blume presentation and metadata contracts for TheBuilder Umbraco package documentation.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/thebuilder/umbraco-docs.git"
|
|
10
|
+
},
|
|
11
|
+
"publishConfig": {
|
|
12
|
+
"access": "public"
|
|
13
|
+
},
|
|
14
|
+
"engines": {
|
|
15
|
+
"node": ">=22.12"
|
|
16
|
+
},
|
|
17
|
+
"packageManager": "pnpm@10.33.0",
|
|
18
|
+
"files": [
|
|
19
|
+
"dist",
|
|
20
|
+
"components",
|
|
21
|
+
"styles",
|
|
22
|
+
"public/logo.png",
|
|
23
|
+
"favicon.png",
|
|
24
|
+
"icon.png"
|
|
25
|
+
],
|
|
26
|
+
"exports": {
|
|
27
|
+
".": {
|
|
28
|
+
"types": "./dist/index.d.ts",
|
|
29
|
+
"import": "./dist/index.js"
|
|
30
|
+
},
|
|
31
|
+
"./astro": "./components/index.ts",
|
|
32
|
+
"./components/*": "./components/*.astro",
|
|
33
|
+
"./styles/landing.css": "./styles/landing.css",
|
|
34
|
+
"./behaviors": "./dist/behaviors.js",
|
|
35
|
+
"./og": {
|
|
36
|
+
"types": "./dist/og/index.d.ts",
|
|
37
|
+
"import": "./dist/og/index.js"
|
|
38
|
+
},
|
|
39
|
+
"./package.json": "./package.json"
|
|
40
|
+
},
|
|
41
|
+
"bin": {
|
|
42
|
+
"umbraco-docs-og": "./dist/og/cli.js"
|
|
43
|
+
},
|
|
44
|
+
"scripts": {
|
|
45
|
+
"build": "tsc -p tsconfig.build.json",
|
|
46
|
+
"check": "tsc -p tsconfig.json --noEmit",
|
|
47
|
+
"generate:brand": "node scripts/generate-brand.mjs",
|
|
48
|
+
"test": "node --test tests/*.test.mjs",
|
|
49
|
+
"test:fixtures": "node scripts/test-fixtures.mjs",
|
|
50
|
+
"verify": "pnpm run check && pnpm run build && pnpm run test && pnpm run test:fixtures",
|
|
51
|
+
"prepack": "pnpm run build"
|
|
52
|
+
},
|
|
53
|
+
"dependencies": {
|
|
54
|
+
"gray-matter": "4.0.3",
|
|
55
|
+
"sharp": "0.35.3"
|
|
56
|
+
},
|
|
57
|
+
"peerDependencies": {
|
|
58
|
+
"blume": ">=1.4.3 <2"
|
|
59
|
+
},
|
|
60
|
+
"devDependencies": {
|
|
61
|
+
"@types/node": "^24.10.1",
|
|
62
|
+
"blume": "1.4.3",
|
|
63
|
+
"typescript": "^5.9.2"
|
|
64
|
+
}
|
|
65
|
+
}
|
package/public/logo.png
ADDED
|
Binary file
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
@layer udocs.tokens, udocs.components, udocs.motion;
|
|
2
|
+
|
|
3
|
+
@layer udocs.tokens {
|
|
4
|
+
:where([data-udocs-root]) {
|
|
5
|
+
--udocs-accent: var(--blume-accent, #2563eb);
|
|
6
|
+
--udocs-gradient: linear-gradient(105deg, #60a5fa, #a78bfa 52%, #f472b6);
|
|
7
|
+
--udocs-border: var(--blume-border, #d4d4d8);
|
|
8
|
+
--udocs-muted: var(--blume-muted, #f4f4f5);
|
|
9
|
+
--udocs-muted-foreground: var(--blume-muted-foreground, #52525b);
|
|
10
|
+
--udocs-foreground: var(--blume-foreground, #18181b);
|
|
11
|
+
--udocs-radius: var(--blume-radius, 0.5rem);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
@layer udocs.components {
|
|
16
|
+
.udocs-shell { width: 100%; max-width: 72rem; margin-inline: auto; padding-inline: 1.5rem; }
|
|
17
|
+
.udocs-visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
|
|
18
|
+
.udocs-hero { position: relative; overflow: clip; padding-block: clamp(3rem, 8vw, 6rem); }
|
|
19
|
+
.udocs-hero__glow { position: absolute; inset: -30% -10% auto; height: 40rem; background: radial-gradient(circle at top, color-mix(in oklab, var(--udocs-accent) 24%, transparent), transparent 70%); pointer-events: none; }
|
|
20
|
+
.udocs-hero__inner { position: relative; display: flex; flex-direction: column; align-items: center; gap: 1.5rem; text-align: center; }
|
|
21
|
+
.udocs-hero__logo { width: 4.5rem; height: 4.5rem; object-fit: contain; }
|
|
22
|
+
.udocs-hero__title { max-width: 20ch; margin: 0; font-family: var(--blume-font-display, system-ui); font-size: clamp(2.4rem, 6vw, 4rem); line-height: 1.05; letter-spacing: -0.02em; text-wrap: balance; }
|
|
23
|
+
.udocs-hero__accent { color: transparent; background: var(--udocs-gradient); background-clip: text; -webkit-background-clip: text; }
|
|
24
|
+
.udocs-hero__description { max-width: 44rem; margin: 0; color: var(--udocs-muted-foreground); font-size: clamp(1.05rem, 1.6vw, 1.25rem); line-height: 1.65; }
|
|
25
|
+
.udocs-hero__actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.75rem; }
|
|
26
|
+
.udocs-hero__compatibility { margin: 0; color: var(--udocs-muted-foreground); font-size: 0.875rem; }
|
|
27
|
+
.udocs-install { display: inline-flex; align-items: center; max-width: 100%; gap: 0.75rem; padding: 0.55rem 0.6rem 0.55rem 1rem; border: 1px solid var(--udocs-border); border-radius: var(--udocs-radius); background: var(--blume-code-background, var(--udocs-muted)); font-family: var(--blume-font-mono, monospace); font-size: 0.9rem; }
|
|
28
|
+
.udocs-install > span { color: var(--udocs-muted-foreground); user-select: none; }
|
|
29
|
+
.udocs-install code { overflow-x: auto; color: var(--udocs-foreground); white-space: nowrap; }
|
|
30
|
+
.udocs-install button { display: grid; flex: none; width: 2rem; height: 2rem; place-items: center; border: 0; border-radius: var(--udocs-radius); background: transparent; color: var(--udocs-muted-foreground); cursor: pointer; }
|
|
31
|
+
.udocs-install button:focus-visible { outline: 2px solid var(--udocs-accent); outline-offset: 2px; }
|
|
32
|
+
.udocs-install button svg { grid-area: 1 / 1; }
|
|
33
|
+
.udocs-install [data-done-icon] { opacity: 0; }
|
|
34
|
+
.udocs-install button[data-udocs-copied] [data-copy-icon] { opacity: 0; }
|
|
35
|
+
.udocs-install button[data-udocs-copied] [data-done-icon] { opacity: 1; color: var(--udocs-accent); }
|
|
36
|
+
.udocs-section-heading { max-width: 42rem; margin-bottom: 2.5rem; }
|
|
37
|
+
.udocs-section-heading--center { margin-inline: auto; text-align: center; }
|
|
38
|
+
.udocs-section-heading__rule { display: block; width: 2.75rem; height: 0.25rem; margin-bottom: 1.15rem; border-radius: 999px; background: var(--udocs-gradient); }
|
|
39
|
+
.udocs-section-heading--center .udocs-section-heading__rule { margin-inline: auto; }
|
|
40
|
+
.udocs-section-heading h2 { margin: 0 0 0.75rem; font-family: var(--blume-font-display, system-ui); font-size: clamp(1.7rem, 3.5vw, 2.4rem); line-height: 1.15; text-wrap: balance; }
|
|
41
|
+
.udocs-section-heading p { margin: 0; color: var(--udocs-muted-foreground); font-size: 1.05rem; line-height: 1.65; }
|
|
42
|
+
.udocs-screenshot { margin: 2.5rem 0 0; overflow: hidden; border: 1px solid var(--udocs-border); border-radius: calc(var(--udocs-radius) * 1.4); background: var(--udocs-muted); box-shadow: 0 24px 55px -30px color-mix(in oklab, var(--udocs-accent) 40%, transparent); }
|
|
43
|
+
.udocs-screenshot__bar { display: flex; gap: 0.4rem; padding: 0.7rem 0.9rem; border-bottom: 1px solid var(--udocs-border); }
|
|
44
|
+
.udocs-screenshot__bar span { width: 0.65rem; height: 0.65rem; border-radius: 50%; background: color-mix(in oklab, var(--udocs-muted-foreground) 40%, transparent); }
|
|
45
|
+
.udocs-screenshot img { display: block; width: 100%; height: auto; }
|
|
46
|
+
.udocs-ecosystem { margin-block: clamp(4rem, 9vw, 7rem); }
|
|
47
|
+
.udocs-ecosystem__list { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 20rem), 1fr)); gap: 1rem; padding: 0; list-style: none; }
|
|
48
|
+
.udocs-ecosystem__item { display: grid; grid-template-columns: auto 1fr; gap: 1rem; padding: 1.5rem; border: 1px solid var(--udocs-border); border-radius: calc(var(--udocs-radius) * 1.2); background: color-mix(in oklab, var(--udocs-muted) 40%, transparent); }
|
|
49
|
+
.udocs-ecosystem__title { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.5rem; }
|
|
50
|
+
.udocs-ecosystem h3, .udocs-ecosystem p { margin: 0; }
|
|
51
|
+
.udocs-ecosystem__title span { color: var(--udocs-muted-foreground); font-size: 0.75rem; text-transform: capitalize; }
|
|
52
|
+
.udocs-ecosystem p { margin-block: 0.4rem 0.8rem; color: var(--udocs-muted-foreground); line-height: 1.55; }
|
|
53
|
+
.udocs-ecosystem a { color: var(--udocs-accent); font-weight: 650; text-decoration: none; }
|
|
54
|
+
.udocs-ecosystem a:hover { text-decoration: underline; }
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
@layer udocs.motion {
|
|
58
|
+
[data-udocs-motion="true"] [data-udocs-reveal] { opacity: 0; transform: translateY(0.75rem); transition: opacity 0.45s ease, transform 0.45s ease; }
|
|
59
|
+
[data-udocs-motion="true"] [data-udocs-visible="true"] { opacity: 1; transform: none; }
|
|
60
|
+
@media (prefers-reduced-motion: reduce) {
|
|
61
|
+
[data-udocs-reveal] { opacity: 1 !important; transform: none !important; transition: none !important; }
|
|
62
|
+
}
|
|
63
|
+
}
|