@fusion.dev/helix-docs 0.0.0-dev

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 (62) hide show
  1. package/LICENSE +21 -0
  2. package/content/accessibility.mdx +117 -0
  3. package/content/angular.mdx +60 -0
  4. package/content/browser-support.mdx +83 -0
  5. package/content/building-on-the-headless-tier.mdx +143 -0
  6. package/content/charting.mdx +93 -0
  7. package/content/coding-agents.mdx +139 -0
  8. package/content/color-modes.mdx +87 -0
  9. package/content/color.mdx +92 -0
  10. package/content/composition.mdx +171 -0
  11. package/content/elevation-and-material.mdx +93 -0
  12. package/content/events.mdx +125 -0
  13. package/content/forms.mdx +170 -0
  14. package/content/iconography.mdx +80 -0
  15. package/content/installation.mdx +125 -0
  16. package/content/intent-reference.mdx +107 -0
  17. package/content/introduction.mdx +69 -0
  18. package/content/localization.mdx +95 -0
  19. package/content/metrics.mdx +399 -0
  20. package/content/motion.mdx +91 -0
  21. package/content/other-frameworks.mdx +70 -0
  22. package/content/overlays.mdx +102 -0
  23. package/content/overriding-a-component.mdx +160 -0
  24. package/content/react.mdx +144 -0
  25. package/content/recipes.mdx +131 -0
  26. package/content/routing.mdx +208 -0
  27. package/content/sandbox.mdx +76 -0
  28. package/content/server-rendering.mdx +103 -0
  29. package/content/shape-and-borders.mdx +80 -0
  30. package/content/size-and-density.mdx +86 -0
  31. package/content/space-and-size.mdx +89 -0
  32. package/content/state-and-control.mdx +132 -0
  33. package/content/surfaces-and-separation.mdx +99 -0
  34. package/content/svelte.mdx +45 -0
  35. package/content/theme-builder.mdx +66 -0
  36. package/content/theming.mdx +111 -0
  37. package/content/tiers.mdx +159 -0
  38. package/content/tokens.mdx +88 -0
  39. package/content/typography.mdx +117 -0
  40. package/content/using-helix-with-an-agent.mdx +231 -0
  41. package/content/using-the-elements.mdx +125 -0
  42. package/content/versioning.mdx +72 -0
  43. package/content/visual-axes.mdx +75 -0
  44. package/content/vue.mdx +80 -0
  45. package/content/without-a-bundler.mdx +119 -0
  46. package/dist/catalog.d.ts +186 -0
  47. package/dist/catalog.js +296 -0
  48. package/dist/index.d.ts +7 -0
  49. package/dist/index.js +6 -0
  50. package/dist/naming.d.ts +14 -0
  51. package/dist/naming.js +28 -0
  52. package/dist/pages.generated.d.ts +7 -0
  53. package/dist/pages.generated.js +284 -0
  54. package/dist/reference.d.ts +105 -0
  55. package/dist/reference.js +181 -0
  56. package/dist/registry.d.ts +89 -0
  57. package/dist/registry.js +70 -0
  58. package/dist/sections.d.ts +44 -0
  59. package/dist/sections.js +36 -0
  60. package/dist/sources.generated.d.ts +6 -0
  61. package/dist/sources.generated.js +5158 -0
  62. package/package.json +46 -0
@@ -0,0 +1,70 @@
1
+ /**
2
+ * Documentation registry for Helix.
3
+ *
4
+ * Docs are a package rather than a folder inside a site so that the docs are
5
+ * pinned to the version of the code they describe. A site renders this
6
+ * registry; it does not own it.
7
+ *
8
+ * **There is no version axis in here.** The package version is the version:
9
+ * `@fusion.dev/helix-docs@0.2.0` documents Helix 0.2.0, because every package in a
10
+ * domain moves in lockstep. A `versions` array beside that would be a second
11
+ * source of truth with nothing keeping the two in step, and the first time they
12
+ * disagreed the registry would win over the package that shipped it.
13
+ *
14
+ * A site serving several versions installs several versions, which is the
15
+ * mechanism npm already provides and the only one that cannot drift.
16
+ *
17
+ * **Nothing about a page is written here.** `pages.generated.ts` is derived
18
+ * from each file's frontmatter by `bun run docs`, because the frontmatter is
19
+ * what a `.md` consumer receives and a second copy would be a second source of
20
+ * truth. This module is the types and the reading of them; `sections.ts` is the
21
+ * spine that frontmatter has nowhere to live.
22
+ */
23
+ import { docPages } from './pages.generated.js';
24
+ import { docSections } from './sections.js';
25
+ export { docPages as pages, docSections as sections };
26
+ export const findPage = (slug) => docPages.find((page) => page.slug === slug);
27
+ /** Case-insensitive, so `Tokens` and `tokens` do not sort into two groups. */
28
+ const byTitle = (a, b) => a.title.toLowerCase() < b.title.toLowerCase() ? -1 : 1;
29
+ /**
30
+ * The pages of one section, in the order a sidebar renders them.
31
+ *
32
+ * **Alphabetical, except a section that is a path, and except one pinned entry
33
+ * page where a section has one.** The exemption is the same one `CLAUDE.md`
34
+ * grants positional arguments and middleware chains, that ordering is skipped
35
+ * where order is semantic. Written down so a section is not silently reordered
36
+ * by whoever next notices it is not alphabetical.
37
+ */
38
+ const ordered = (pages, section) => {
39
+ if (section.path) {
40
+ return [...pages].sort((a, b) => (a.order ?? 0) - (b.order ?? 0));
41
+ }
42
+ const pinned = pages.filter((page) => page.pinned);
43
+ const rest = pages.filter((page) => !page.pinned).sort(byTitle);
44
+ return [...pinned, ...rest];
45
+ };
46
+ /**
47
+ * The whole sidebar: every declared section, its pages in render order, and
48
+ * each page's children beneath it.
49
+ *
50
+ * A section with no pages cannot appear, because `bun run check:docs` refuses
51
+ * to generate one. Children are alphabetical, because nesting exists for the
52
+ * per-framework installation pages and a reader picking their framework out of
53
+ * a list is looking one up rather than reading a sequence, and then the
54
+ * `trailing` ones, which are the pages that answer "none of the above" and
55
+ * which the alphabet was interleaving with the answers they follow from.
56
+ */
57
+ export const navigation = () => docSections.map((section) => {
58
+ const own = docPages.filter((page) => page.section === section.title && page.parent === undefined);
59
+ return {
60
+ ...section,
61
+ pages: ordered(own, section).map((page) => ({
62
+ ...page,
63
+ children: docPages
64
+ .filter((child) => child.parent === page.slug)
65
+ .sort((a, b) => Number(a.trailing ?? false) - Number(b.trailing ?? false) || byTitle(a, b)),
66
+ })),
67
+ };
68
+ });
69
+ /** Path to a page's MDX, relative to the package root. */
70
+ export const contentPath = (page) => `content/${page.slug}.mdx`;
@@ -0,0 +1,44 @@
1
+ /**
2
+ * The navigation's spine: which sections exist, in what order, and how each
3
+ * one orders the pages inside it.
4
+ *
5
+ * **Hand-authored, where the pages are not.** A page's own facts come from its
6
+ * frontmatter and are generated into `pages.generated.ts`, because the
7
+ * frontmatter is what a `.md` consumer actually receives and a second copy in
8
+ * a registry is a second source of truth. A section is not a page and has no
9
+ * frontmatter to derive from, so it is written here.
10
+ *
11
+ * **A section with no pages is not declared.** A navigation entry is the
12
+ * strongest existence claim a site can make, and the sections this library
13
+ * intends to grow (Foundations, Components, Tooling) have nothing in them yet.
14
+ * `bun run check:docs` fails on an empty section rather than rendering a
15
+ * heading with nothing under it.
16
+ *
17
+ * See [`plan/23-helix-docs.md`](plan/23-helix-docs.md) for the
18
+ * navigation this is a subset of.
19
+ */
20
+ /** A top-level grouping in the sidebar. */
21
+ export interface DocSection {
22
+ /**
23
+ * Whether this section is a sequence rather than a lookup table.
24
+ *
25
+ * A path is read in order and its pages carry an explicit `order`. Every
26
+ * other section sorts its pinned entry first and the rest alphabetically,
27
+ * which is the right shape when a reader arrives knowing what they are
28
+ * looking for. Getting started is the only path today.
29
+ */
30
+ path?: boolean;
31
+ /** Display name, and the value a page's `section` frontmatter matches. */
32
+ title: string;
33
+ }
34
+ /**
35
+ * Every section, in the order the sidebar renders them.
36
+ *
37
+ * Deliberately an array rather than an alphabetized record: this is the one
38
+ * place where order is the content. Foundations sits above Theming because a
39
+ * reader needs the vocabulary before the thing that changes it, and no
40
+ * alphabetization expresses that.
41
+ */
42
+ export declare const docSections: DocSection[];
43
+ /** The section of a given name, if it is declared. */
44
+ export declare const findSection: (title: string) => DocSection | undefined;
@@ -0,0 +1,36 @@
1
+ /**
2
+ * The navigation's spine: which sections exist, in what order, and how each
3
+ * one orders the pages inside it.
4
+ *
5
+ * **Hand-authored, where the pages are not.** A page's own facts come from its
6
+ * frontmatter and are generated into `pages.generated.ts`, because the
7
+ * frontmatter is what a `.md` consumer actually receives and a second copy in
8
+ * a registry is a second source of truth. A section is not a page and has no
9
+ * frontmatter to derive from, so it is written here.
10
+ *
11
+ * **A section with no pages is not declared.** A navigation entry is the
12
+ * strongest existence claim a site can make, and the sections this library
13
+ * intends to grow (Foundations, Components, Tooling) have nothing in them yet.
14
+ * `bun run check:docs` fails on an empty section rather than rendering a
15
+ * heading with nothing under it.
16
+ *
17
+ * See [`plan/23-helix-docs.md`](plan/23-helix-docs.md) for the
18
+ * navigation this is a subset of.
19
+ */
20
+ /**
21
+ * Every section, in the order the sidebar renders them.
22
+ *
23
+ * Deliberately an array rather than an alphabetized record: this is the one
24
+ * place where order is the content. Foundations sits above Theming because a
25
+ * reader needs the vocabulary before the thing that changes it, and no
26
+ * alphabetization expresses that.
27
+ */
28
+ export const docSections = [
29
+ { path: true, title: 'Getting started' },
30
+ { title: 'Foundations' },
31
+ { title: 'Theming' },
32
+ { title: 'Essentials' },
33
+ { title: 'Tooling' },
34
+ ];
35
+ /** The section of a given name, if it is declared. */
36
+ export const findSection = (title) => docSections.find((section) => section.title === title);
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Every page's MDX, inlined by `bun run docs`. Do not edit: the files in
3
+ * `content/` are the source, and `bun run check:docs` fails when this module
4
+ * and they disagree.
5
+ */
6
+ export declare const docSources: Record<string, string>;