@rtkelly-labs/design-system 0.19.0 → 0.20.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 (63) hide show
  1. package/CHANGELOG.md +31 -0
  2. package/dist/components/BracketText.js +3 -2
  3. package/dist/components/BracketText.js.map +1 -1
  4. package/dist/components/Button.js.map +1 -1
  5. package/dist/components/Card.js +2 -1
  6. package/dist/components/Card.js.map +1 -1
  7. package/dist/components/DataTable.js.map +1 -1
  8. package/dist/components/Divider.js +21 -14
  9. package/dist/components/Divider.js.map +1 -1
  10. package/dist/components/InlineAction.js.map +1 -1
  11. package/dist/components/PageTitle.js +5 -1
  12. package/dist/components/PageTitle.js.map +1 -1
  13. package/dist/components/ResourceState.js.map +1 -1
  14. package/dist/components/SocialIcon.js.map +1 -1
  15. package/dist/components/StatCard.js +2 -2
  16. package/dist/components/StatCard.js.map +1 -1
  17. package/dist/components/StatusPage.js.map +1 -1
  18. package/dist/components/docs/figures/ActivityGrid.js.map +1 -1
  19. package/dist/components/docs/figures/ChangeSummary.js +68 -25
  20. package/dist/components/docs/figures/ChangeSummary.js.map +1 -1
  21. package/dist/components/docs/figures/FigureFrame.js.map +1 -1
  22. package/dist/components/docs/figures/index.js.map +1 -1
  23. package/dist/components/experiments/ExperimentsView.js.map +1 -1
  24. package/dist/components/marketing/FeatureGrid.js.map +1 -1
  25. package/dist/components/marketing/Hero.js +2 -2
  26. package/dist/components/marketing/Hero.js.map +1 -1
  27. package/dist/components/marketing/PricingGrid.js.map +1 -1
  28. package/dist/components/review/ChangeBar.js +29 -0
  29. package/dist/components/review/ChangeBar.js.map +1 -0
  30. package/dist/components/review/ChangeCount.js +27 -0
  31. package/dist/components/review/ChangeCount.js.map +1 -0
  32. package/dist/components/review/ChangeIndex.js +50 -0
  33. package/dist/components/review/ChangeIndex.js.map +1 -0
  34. package/dist/components/review/DeltaValue.js +87 -0
  35. package/dist/components/review/DeltaValue.js.map +1 -0
  36. package/dist/components/review/DiffView.js +115 -0
  37. package/dist/components/review/DiffView.js.map +1 -0
  38. package/dist/components/review/KeyedDiff.js +43 -0
  39. package/dist/components/review/KeyedDiff.js.map +1 -0
  40. package/dist/components/review/ProvenanceStrip.js +17 -0
  41. package/dist/components/review/ProvenanceStrip.js.map +1 -0
  42. package/dist/components/review/PullRequestPage.js +223 -0
  43. package/dist/components/review/PullRequestPage.js.map +1 -0
  44. package/dist/components/review/ReviewReportPage.js +111 -0
  45. package/dist/components/review/ReviewReportPage.js.map +1 -0
  46. package/dist/components/review/StatusMark.js +32 -0
  47. package/dist/components/review/StatusMark.js.map +1 -0
  48. package/dist/components/review/VerdictBand.js +45 -0
  49. package/dist/components/review/VerdictBand.js.map +1 -0
  50. package/dist/components/review/diff.js +53 -0
  51. package/dist/components/review/diff.js.map +1 -0
  52. package/dist/components/review/index.js +16 -0
  53. package/dist/components/review/index.js.map +1 -0
  54. package/dist/components/review/samples.js +235 -0
  55. package/dist/components/review/samples.js.map +1 -0
  56. package/dist/components/review/vocabulary.js +51 -0
  57. package/dist/components/review/vocabulary.js.map +1 -0
  58. package/dist/components/saas/SaasLandingPage.js +10 -2
  59. package/dist/components/saas/SaasLandingPage.js.map +1 -1
  60. package/dist/index.d.ts +640 -24
  61. package/dist/index.js +2 -1
  62. package/dist/index.js.map +1 -1
  63. package/package.json +8 -2
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/components/ResourceState.tsx"],"sourcesContent":["import { forwardRef } from 'react';\nimport type { ForwardedRef, HTMLAttributes, ReactElement, ReactNode, RefAttributes } from 'react';\nimport { recipe } from '../lib/recipe';\nimport { NoteBlock } from './NoteBlock';\nimport { Skeleton } from './Skeleton';\n\n/** Which of the four states a `ResourceState` is showing. */\nexport type ResourceStatus = 'loading' | 'failed' | 'stale' | 'ready';\n\n/**\n * What `ResourceState` reads. `usePolledResource`'s result fits as it is; so\n * does any `{ data, error }` from another loader.\n */\nexport interface ResourceStateValue<T> {\n /** The last good answer, or `undefined` before there is one. */\n data: T | undefined;\n /** Why the latest load failed, or `undefined` when it did not. */\n error: string | undefined;\n /** A load is in flight. Sets `aria-busy` on the region; absent reads as loading while there is no data. */\n loading?: boolean;\n}\n\nexport interface ResourceStateProps<T> extends Omit<HTMLAttributes<HTMLDivElement>, 'children'> {\n /** The resource to render — `usePolledResource`'s result, or any structurally compatible `{ data, error }`. */\n state: ResourceStateValue<T>;\n /** Renders the data once there is some. Called with the data, never with `undefined`. */\n children: (data: T) => ReactNode;\n /** Shown while there is no data and no error. Default one block `Skeleton`; pass the shape of the real content to keep the page still when it lands. */\n loading?: ReactNode;\n /** The warning title when the load failed and there is nothing to show. Default `Could not load`. */\n errorTitle?: string;\n /** The warning title above data kept from an earlier load after a later one failed. Default `Showing the last good data`. */\n staleTitle?: string;\n}\n\n/** Which state the region is in, from data first: data on screen is never hidden by a failure. */\nfunction resourceStatus({ data, error }: Pick<ResourceStateValue<unknown>, 'data' | 'error'>): ResourceStatus {\n if (data === undefined) return error !== undefined ? 'failed' : 'loading';\n return error !== undefined ? 'stale' : 'ready';\n}\n\nconst resourceState = recipe({\n slots: {\n root: 'block',\n },\n});\n\nfunction ResourceStateInner<T>(\n {\n state,\n children,\n loading,\n errorTitle = 'Could not load',\n staleTitle = 'Showing the last good data',\n className,\n ...props\n }: ResourceStateProps<T>,\n ref: ForwardedRef<HTMLDivElement>,\n) {\n const status = resourceStatus(state);\n const busy = state.loading ?? status === 'loading';\n const styles = resourceState();\n let body: ReactNode;\n if (state.data === undefined) {\n body = state.error !== undefined ? (\n <NoteBlock type=\"warning\" title={errorTitle}>\n {state.error}\n </NoteBlock>\n ) : (\n (loading ?? <Skeleton shape=\"block\" />)\n );\n } else {\n body = (\n <>\n {state.error !== undefined ? (\n <NoteBlock type=\"important\" title={staleTitle}>\n {state.error}\n </NoteBlock>\n ) : null}\n {children(state.data)}\n </>\n );\n }\n return (\n <div\n ref={ref}\n data-slot=\"resource-state\"\n data-state={status}\n aria-busy={busy}\n {...props}\n className={styles.root({ class: className })}\n >\n {body}\n </div>\n );\n}\n\n/** `forwardRef` erases a generic; this restores it, so `children` is typed by `state`. */\ntype ResourceStateComponent = (<T>(props: ResourceStateProps<T> & RefAttributes<HTMLDivElement>) => ReactElement | null) & {\n displayName?: string;\n};\n\n/**\n * The loading, failed and stale states around a view of loaded data, so every\n * panel says them the same way.\n *\n * - **Loading** — no data yet and no error: the `loading` slot, a `Skeleton`\n * unless overridden.\n * - **Failed** — no data and an error: a `NoteBlock` warning, in the danger\n * role, carrying the error message under `errorTitle`.\n * - **Stale** — data from an earlier load, and a later load failed: a\n * `NoteBlock` in the warning role, under `staleTitle`, then the data. The data\n * stays because an older answer is more use than none, and the note stays\n * because an older answer shown as current is a lie.\n * - **Ready** — data and no error: `children(data)`.\n *\n * The region carries `aria-busy` while a load is in flight and `data-state`\n * naming the state. Pair it with `usePolledResource`, and put a\n * `FreshnessIndicator` fed its `updatedAt` near the view, to say how old the\n * data on screen is as well as whether it is.\n */\nexport const ResourceState = forwardRef(ResourceStateInner) as ResourceStateComponent;\n\nResourceState.displayName = 'ResourceState';\n"],"mappings":";AAAA,SAAS,kBAAkB;AAE3B,SAAS,cAAc;AACvB,SAAS,iBAAiB;AAC1B,SAAS,gBAAgB;AA6DnB,SAQA,UARA,KAQA,YARA;AA7BN,SAAS,eAAe,EAAE,MAAM,MAAM,GAAwE;AAC5G,MAAI,SAAS,OAAW,QAAO,UAAU,SAAY,WAAW;AAChE,SAAO,UAAU,SAAY,UAAU;AACzC;AAEA,IAAM,gBAAgB,OAAO;AAAA,EAC3B,OAAO;AAAA,IACL,MAAM;AAAA,EACR;AACF,CAAC;AAED,SAAS,mBACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA,aAAa;AAAA,EACb,aAAa;AAAA,EACb;AAAA,EACA,GAAG;AACL,GACA,KACA;AACA,QAAM,SAAS,eAAe,KAAK;AACnC,QAAM,OAAO,MAAM,WAAW,WAAW;AACzC,QAAM,SAAS,cAAc;AAC7B,MAAI;AACJ,MAAI,MAAM,SAAS,QAAW;AAC5B,WAAO,MAAM,UAAU,SACrB,oBAAC,aAAU,MAAK,WAAU,OAAO,YAC9B,gBAAM,OACT,IAEC,WAAW,oBAAC,YAAS,OAAM,SAAQ;AAAA,EAExC,OAAO;AACL,WACE,iCACG;AAAA,YAAM,UAAU,SACf,oBAAC,aAAU,MAAK,aAAY,OAAO,YAChC,gBAAM,OACT,IACE;AAAA,MACH,SAAS,MAAM,IAAI;AAAA,OACtB;AAAA,EAEJ;AACA,SACE;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA,aAAU;AAAA,MACV,cAAY;AAAA,MACZ,aAAW;AAAA,MACV,GAAG;AAAA,MACJ,WAAW,OAAO,KAAK,EAAE,OAAO,UAAU,CAAC;AAAA,MAE1C;AAAA;AAAA,EACH;AAEJ;AA0BO,IAAM,gBAAgB,WAAW,kBAAkB;AAE1D,cAAc,cAAc;","names":[]}
1
+ {"version":3,"sources":["../../src/components/ResourceState.tsx"],"sourcesContent":["import { forwardRef } from 'react';\nimport type { ForwardedRef, HTMLAttributes, ReactElement, ReactNode, RefAttributes } from 'react';\nimport { recipe } from '../lib/recipe';\nimport { NoteBlock } from './NoteBlock';\nimport { Skeleton } from './Skeleton';\n\n/** Which of the four states a `ResourceState` is showing. */\nexport type ResourceStatus = 'loading' | 'failed' | 'stale' | 'ready';\n\n/**\n * What `ResourceState` reads. `usePolledResource`'s result fits as it is; so\n * does any `{ data, error }` from another loader.\n */\nexport interface ResourceStateValue<T> {\n /** The last good answer, or `undefined` before there is one. */\n data: T | undefined;\n /** Why the latest load failed, or `undefined` when it did not. */\n error: string | undefined;\n /** A load is in flight. Sets `aria-busy` on the region; absent reads as loading while there is no data. */\n loading?: boolean;\n}\n\nexport interface ResourceStateProps<T> extends Omit<HTMLAttributes<HTMLDivElement>, 'children'> {\n /** The resource to render — `usePolledResource`'s result, or any structurally compatible `{ data, error }`. */\n state: ResourceStateValue<T>;\n /** Renders the data once there is some. Called with the data, never with `undefined`. */\n children: (data: T) => ReactNode;\n /** Shown while there is no data and no error. Default one block `Skeleton`; pass the shape of the real content to keep the page still when it lands. */\n loading?: ReactNode;\n /** The warning title when the load failed and there is nothing to show. Default `Could not load`. */\n errorTitle?: string;\n /** The warning title above data kept from an earlier load after a later one failed. Default `Showing the last good data`. */\n staleTitle?: string;\n}\n\n/** Which state the region is in, from data first: data on screen is never hidden by a failure. */\nfunction resourceStatus({ data, error }: Pick<ResourceStateValue<unknown>, 'data' | 'error'>): ResourceStatus {\n if (data === undefined) return error !== undefined ? 'failed' : 'loading';\n return error !== undefined ? 'stale' : 'ready';\n}\n\nconst resourceState = recipe({\n slots: {\n root: 'block',\n },\n});\n\nfunction ResourceStateInner<T>(\n {\n state,\n children,\n loading,\n errorTitle = 'Could not load',\n staleTitle = 'Showing the last good data',\n className,\n ...props\n }: ResourceStateProps<T>,\n ref: ForwardedRef<HTMLDivElement>,\n) {\n const status = resourceStatus(state);\n const busy = state.loading ?? status === 'loading';\n const styles = resourceState();\n let body: ReactNode;\n if (state.data === undefined) {\n body = state.error !== undefined ? (\n <NoteBlock type=\"warning\" title={errorTitle}>\n {state.error}\n </NoteBlock>\n ) : (\n (loading ?? <Skeleton shape=\"block\" />)\n );\n } else {\n body = (\n <>\n {state.error !== undefined ? (\n <NoteBlock type=\"important\" title={staleTitle}>\n {state.error}\n </NoteBlock>\n ) : null}\n {children(state.data)}\n </>\n );\n }\n return (\n <div\n ref={ref}\n data-slot=\"resource-state\"\n data-state={status}\n aria-busy={busy}\n {...props}\n className={styles.root({ class: className })}\n >\n {body}\n </div>\n );\n}\n\n/** `forwardRef` erases a generic; this restores it, so `children` is typed by `state`. */\nexport type ResourceStateComponent = (<T>(props: ResourceStateProps<T> & RefAttributes<HTMLDivElement>) => ReactElement | null) & {\n displayName?: string;\n};\n\n/**\n * The loading, failed and stale states around a view of loaded data, so every\n * panel says them the same way.\n *\n * - **Loading** — no data yet and no error: the `loading` slot, a `Skeleton`\n * unless overridden.\n * - **Failed** — no data and an error: a `NoteBlock` warning, in the danger\n * role, carrying the error message under `errorTitle`.\n * - **Stale** — data from an earlier load, and a later load failed: a\n * `NoteBlock` in the warning role, under `staleTitle`, then the data. The data\n * stays because an older answer is more use than none, and the note stays\n * because an older answer shown as current is a lie.\n * - **Ready** — data and no error: `children(data)`.\n *\n * The region carries `aria-busy` while a load is in flight and `data-state`\n * naming the state. Pair it with `usePolledResource`, and put a\n * `FreshnessIndicator` fed its `updatedAt` near the view, to say how old the\n * data on screen is as well as whether it is.\n */\nexport const ResourceState = forwardRef(ResourceStateInner) as ResourceStateComponent;\n\nResourceState.displayName = 'ResourceState';\n"],"mappings":";AAAA,SAAS,kBAAkB;AAE3B,SAAS,cAAc;AACvB,SAAS,iBAAiB;AAC1B,SAAS,gBAAgB;AA6DnB,SAQA,UARA,KAQA,YARA;AA7BN,SAAS,eAAe,EAAE,MAAM,MAAM,GAAwE;AAC5G,MAAI,SAAS,OAAW,QAAO,UAAU,SAAY,WAAW;AAChE,SAAO,UAAU,SAAY,UAAU;AACzC;AAEA,IAAM,gBAAgB,OAAO;AAAA,EAC3B,OAAO;AAAA,IACL,MAAM;AAAA,EACR;AACF,CAAC;AAED,SAAS,mBACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA,aAAa;AAAA,EACb,aAAa;AAAA,EACb;AAAA,EACA,GAAG;AACL,GACA,KACA;AACA,QAAM,SAAS,eAAe,KAAK;AACnC,QAAM,OAAO,MAAM,WAAW,WAAW;AACzC,QAAM,SAAS,cAAc;AAC7B,MAAI;AACJ,MAAI,MAAM,SAAS,QAAW;AAC5B,WAAO,MAAM,UAAU,SACrB,oBAAC,aAAU,MAAK,WAAU,OAAO,YAC9B,gBAAM,OACT,IAEC,WAAW,oBAAC,YAAS,OAAM,SAAQ;AAAA,EAExC,OAAO;AACL,WACE,iCACG;AAAA,YAAM,UAAU,SACf,oBAAC,aAAU,MAAK,aAAY,OAAO,YAChC,gBAAM,OACT,IACE;AAAA,MACH,SAAS,MAAM,IAAI;AAAA,OACtB;AAAA,EAEJ;AACA,SACE;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA,aAAU;AAAA,MACV,cAAY;AAAA,MACZ,aAAW;AAAA,MACV,GAAG;AAAA,MACJ,WAAW,OAAO,KAAK,EAAE,OAAO,UAAU,CAAC;AAAA,MAE1C;AAAA;AAAA,EACH;AAEJ;AA0BO,IAAM,gBAAgB,WAAW,kBAAkB;AAE1D,cAAc,cAAc;","names":[]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/components/SocialIcon.tsx"],"sourcesContent":["import { forwardRef, type AnchorHTMLAttributes, type Ref, type SVGProps } from 'react';\nimport type { AccentToken } from '../lib/theme';\nimport { accentTextClass } from '../lib/accentClasses';\nimport { cn } from '../lib/recipe';\n\n/** Brand names supported by {@link SocialIcon}. */\nexport type SocialIconName = 'github' | 'linkedin' | 'bluesky' | 'x' | 'mail';\n\nconst LABELS: Record<SocialIconName, string> = {\n github: 'GitHub',\n linkedin: 'LinkedIn',\n bluesky: 'Bluesky',\n x: 'X',\n mail: 'Email',\n};\n\n/**\n * Paths are kept here rather than pulled from a second icon package. Social\n * marks are rendering primitives, and the design system owns their accessible\n * name, current-colour treatment, and link behaviour.\n */\nconst PATHS: Record<SocialIconName, string> = {\n github:\n 'M12 2C6.477 2 2 6.477 2 12c0 4.419 2.865 8.167 6.839 9.49.5.092.682-.217.682-.482 0-.237-.009-.866-.013-1.7-2.782.604-3.369-1.34-3.369-1.34-.454-1.156-1.11-1.463-1.11-1.463-.908-.62.069-.608.069-.608 1.003.07 1.531 1.03 1.531 1.03.892 1.529 2.341 1.087 2.91.832.091-.647.35-1.087.636-1.338-2.22-.253-4.555-1.11-4.555-4.943 0-1.091.39-1.984 1.029-2.682-.103-.253-.446-1.27.098-2.647 0 0 .84-.269 2.75 1.025A9.564 9.564 0 0 1 12 6.844a9.58 9.58 0 0 1 2.504.337c1.909-1.294 2.748-1.025 2.748-1.025.546 1.377.202 2.394.1 2.647.64.698 1.028 1.591 1.028 2.682 0 3.842-2.339 4.687-4.566 4.935.359.309.678.919.678 1.852 0 1.336-.012 2.415-.012 2.744 0 .267.18.578.688.48A10.003 10.003 0 0 0 22 12c0-5.523-4.477-10-10-10Z',\n linkedin:\n 'M20.447 20.452h-3.554v-5.569c0-1.328-.027-3.037-1.852-3.037-1.853 0-2.136 1.445-2.136 2.939v5.667H9.35V8.999h3.414v1.561h.046c.477-.9 1.637-1.85 3.37-1.85 3.602 0 4.267 2.37 4.267 5.455v6.287ZM5.337 7.433a2.062 2.062 0 1 1 0-4.124 2.062 2.062 0 0 1 0 4.124ZM7.119 20.452H3.555V8.999h3.564v11.453ZM22.225 0H1.771C.792 0 0 .774 0 1.729v20.542C0 23.227.792 24 1.771 24h20.451C23.2 24 24 23.227 24 22.271V1.729C24 .774 23.2 0 22.225 0Z',\n bluesky:\n 'M12 10.8C10.5 7.9 6.42 2.5 2.62 2.5 1.1 2.5.5 3.4.5 4.6c0 1.1.6 6.4 1 7.4.7 1.7 3.1 2.3 5.8 1.9-4.4.7-8.1 2.4-5.6 5.3 2.6 3 6.9-.7 10.3-3.6 3.4 2.9 7.7 6.6 10.3 3.6 2.5-2.9-1.2-4.6-5.6-5.3 2.7.4 5.1-.2 5.8-1.9.4-1 1-6.3 1-7.4 0-1.2-.6-2.1-2.12-2.1-3.8 0-7.88 5.4-9.38 8.3Z',\n x: 'M18.244 2.25h3.308l-7.227 8.26 8.502 11.24h-6.657l-5.214-6.817-5.965 6.817H1.681l7.73-8.835L1.255 2.25h6.826l4.713 6.231 5.45-6.231Zm-1.161 17.52h1.833L7.084 4.126H5.117L17.083 19.77Z',\n mail: 'M2.5 4.5h19a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-19a1 1 0 0 1-1-1v-13a1 1 0 0 1 1-1Zm0 1.8v.35l9.5 6.1 9.5-6.1V6.3L12.54 12.4a1 1 0 0 1-1.08 0L2.5 6.3Zm19 11.4V8.8l-8.54 5.48a1.8 1.8 0 0 1-1.92 0L2.5 8.8v8.9h19Z',\n};\n\nexport interface SocialIconProps extends Omit<SVGProps<SVGSVGElement>, 'color'> {\n /** Brand mark to render. */\n name: SocialIconName;\n /** Semantic role used for the current-colour mark. */\n accent?: AccentToken;\n /** Accessible name. Defaults to the brand name. */\n label?: string;\n /** Optional destination. When set, the icon is wrapped in an anchor. */\n href?: string;\n /** Link target. `_blank` automatically receives a safe `rel` value. */\n target?: AnchorHTMLAttributes<HTMLAnchorElement>['target'];\n /** Explicit link relationship, overriding the `_blank` default. */\n rel?: string;\n}\n\n/**\n * Accessible brand SVG for estate social and contact links.\n *\n * Without `href` this is a labelled image. With `href` it becomes a labelled\n * link and the SVG is hidden from assistive technology to avoid two names.\n * All marks use semantic accent roles and `currentColor`, so both theme levels\n * resolve through the design-system token ladder.\n */\nexport const SocialIcon = forwardRef<SVGSVGElement | HTMLAnchorElement, SocialIconProps>(\n function SocialIcon(\n { name, accent = 'primary', label, href, target, rel, className, ...svgProps },\n ref,\n ) {\n const accessibleName = label ?? svgProps['aria-label'] ?? LABELS[name];\n const svg = (\n <svg\n {...svgProps}\n // The ref follows the rendered root only: inside an anchor the SVG is\n // decoration, and a callback ref fired on both would run element\n // setup/cleanup logic against the nested mark first.\n ref={href ? undefined : (ref as Ref<SVGSVGElement>)}\n data-slot=\"social-icon\"\n viewBox=\"0 0 24 24\"\n fill=\"currentColor\"\n aria-hidden={href ? true : undefined}\n aria-label={href ? undefined : accessibleName}\n role={href ? undefined : 'img'}\n className={cn('inline-block size-5 shrink-0', accentTextClass(accent), className)}\n >\n <path d={PATHS[name]} />\n </svg>\n );\n\n if (!href) return svg;\n\n return (\n <a\n ref={ref as Ref<HTMLAnchorElement>}\n href={href}\n target={target}\n rel={rel ?? (target === '_blank' ? 'noopener noreferrer' : undefined)}\n aria-label={accessibleName}\n className=\"inline-flex items-center focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-accent-primary\"\n >\n {svg}\n </a>\n );\n },\n);\n\nSocialIcon.displayName = 'SocialIcon';\n\ntype NamedSocialIconProps = Omit<SocialIconProps, 'name'>;\n\n/** GitHub brand mark. */\nexport function GitHubIcon(props: NamedSocialIconProps) {\n return <SocialIcon name=\"github\" {...props} />;\n}\n\n/** LinkedIn brand mark. */\nexport function LinkedInIcon(props: NamedSocialIconProps) {\n return <SocialIcon name=\"linkedin\" {...props} />;\n}\n\n/** Bluesky brand mark. */\nexport function BlueskyIcon(props: NamedSocialIconProps) {\n return <SocialIcon name=\"bluesky\" {...props} />;\n}\n\n/** X brand mark. */\nexport function XIcon(props: NamedSocialIconProps) {\n return <SocialIcon name=\"x\" {...props} />;\n}\n\n/** Email envelope mark. */\nexport function MailIcon(props: NamedSocialIconProps) {\n return <SocialIcon name=\"mail\" {...props} />;\n}\n"],"mappings":";AAAA,SAAS,kBAAsE;AAE/E,SAAS,uBAAuB;AAChC,SAAS,UAAU;AAyEX;AApER,IAAM,SAAyC;AAAA,EAC7C,QAAQ;AAAA,EACR,UAAU;AAAA,EACV,SAAS;AAAA,EACT,GAAG;AAAA,EACH,MAAM;AACR;AAOA,IAAM,QAAwC;AAAA,EAC5C,QACE;AAAA,EACF,UACE;AAAA,EACF,SACE;AAAA,EACF,GAAG;AAAA,EACH,MAAM;AACR;AAyBO,IAAM,aAAa;AAAA,EACxB,SAASA,YACP,EAAE,MAAM,SAAS,WAAW,OAAO,MAAM,QAAQ,KAAK,WAAW,GAAG,SAAS,GAC7E,KACA;AACA,UAAM,iBAAiB,SAAS,SAAS,YAAY,KAAK,OAAO,IAAI;AACrE,UAAM,MACJ;AAAA,MAAC;AAAA;AAAA,QACE,GAAG;AAAA,QAIJ,KAAK,OAAO,SAAa;AAAA,QACzB,aAAU;AAAA,QACV,SAAQ;AAAA,QACR,MAAK;AAAA,QACL,eAAa,OAAO,OAAO;AAAA,QAC3B,cAAY,OAAO,SAAY;AAAA,QAC/B,MAAM,OAAO,SAAY;AAAA,QACzB,WAAW,GAAG,gCAAgC,gBAAgB,MAAM,GAAG,SAAS;AAAA,QAEhF,8BAAC,UAAK,GAAG,MAAM,IAAI,GAAG;AAAA;AAAA,IACxB;AAGF,QAAI,CAAC,KAAM,QAAO;AAElB,WACE;AAAA,MAAC;AAAA;AAAA,QACC;AAAA,QACA;AAAA,QACA;AAAA,QACA,KAAK,QAAQ,WAAW,WAAW,wBAAwB;AAAA,QAC3D,cAAY;AAAA,QACZ,WAAU;AAAA,QAET;AAAA;AAAA,IACH;AAAA,EAEJ;AACF;AAEA,WAAW,cAAc;AAKlB,SAAS,WAAW,OAA6B;AACtD,SAAO,oBAAC,cAAW,MAAK,UAAU,GAAG,OAAO;AAC9C;AAGO,SAAS,aAAa,OAA6B;AACxD,SAAO,oBAAC,cAAW,MAAK,YAAY,GAAG,OAAO;AAChD;AAGO,SAAS,YAAY,OAA6B;AACvD,SAAO,oBAAC,cAAW,MAAK,WAAW,GAAG,OAAO;AAC/C;AAGO,SAAS,MAAM,OAA6B;AACjD,SAAO,oBAAC,cAAW,MAAK,KAAK,GAAG,OAAO;AACzC;AAGO,SAAS,SAAS,OAA6B;AACpD,SAAO,oBAAC,cAAW,MAAK,QAAQ,GAAG,OAAO;AAC5C;","names":["SocialIcon"]}
1
+ {"version":3,"sources":["../../src/components/SocialIcon.tsx"],"sourcesContent":["import { forwardRef, type AnchorHTMLAttributes, type Ref, type SVGProps } from 'react';\nimport type { AccentToken } from '../lib/theme';\nimport { accentTextClass } from '../lib/accentClasses';\nimport { cn } from '../lib/recipe';\n\n/** Brand names supported by {@link SocialIcon}. */\nexport type SocialIconName = 'github' | 'linkedin' | 'bluesky' | 'x' | 'mail';\n\nconst LABELS: Record<SocialIconName, string> = {\n github: 'GitHub',\n linkedin: 'LinkedIn',\n bluesky: 'Bluesky',\n x: 'X',\n mail: 'Email',\n};\n\n/**\n * Paths are kept here rather than pulled from a second icon package. Social\n * marks are rendering primitives, and the design system owns their accessible\n * name, current-colour treatment, and link behaviour.\n */\nconst PATHS: Record<SocialIconName, string> = {\n github:\n 'M12 2C6.477 2 2 6.477 2 12c0 4.419 2.865 8.167 6.839 9.49.5.092.682-.217.682-.482 0-.237-.009-.866-.013-1.7-2.782.604-3.369-1.34-3.369-1.34-.454-1.156-1.11-1.463-1.11-1.463-.908-.62.069-.608.069-.608 1.003.07 1.531 1.03 1.531 1.03.892 1.529 2.341 1.087 2.91.832.091-.647.35-1.087.636-1.338-2.22-.253-4.555-1.11-4.555-4.943 0-1.091.39-1.984 1.029-2.682-.103-.253-.446-1.27.098-2.647 0 0 .84-.269 2.75 1.025A9.564 9.564 0 0 1 12 6.844a9.58 9.58 0 0 1 2.504.337c1.909-1.294 2.748-1.025 2.748-1.025.546 1.377.202 2.394.1 2.647.64.698 1.028 1.591 1.028 2.682 0 3.842-2.339 4.687-4.566 4.935.359.309.678.919.678 1.852 0 1.336-.012 2.415-.012 2.744 0 .267.18.578.688.48A10.003 10.003 0 0 0 22 12c0-5.523-4.477-10-10-10Z',\n linkedin:\n 'M20.447 20.452h-3.554v-5.569c0-1.328-.027-3.037-1.852-3.037-1.853 0-2.136 1.445-2.136 2.939v5.667H9.35V8.999h3.414v1.561h.046c.477-.9 1.637-1.85 3.37-1.85 3.602 0 4.267 2.37 4.267 5.455v6.287ZM5.337 7.433a2.062 2.062 0 1 1 0-4.124 2.062 2.062 0 0 1 0 4.124ZM7.119 20.452H3.555V8.999h3.564v11.453ZM22.225 0H1.771C.792 0 0 .774 0 1.729v20.542C0 23.227.792 24 1.771 24h20.451C23.2 24 24 23.227 24 22.271V1.729C24 .774 23.2 0 22.225 0Z',\n bluesky:\n 'M12 10.8C10.5 7.9 6.42 2.5 2.62 2.5 1.1 2.5.5 3.4.5 4.6c0 1.1.6 6.4 1 7.4.7 1.7 3.1 2.3 5.8 1.9-4.4.7-8.1 2.4-5.6 5.3 2.6 3 6.9-.7 10.3-3.6 3.4 2.9 7.7 6.6 10.3 3.6 2.5-2.9-1.2-4.6-5.6-5.3 2.7.4 5.1-.2 5.8-1.9.4-1 1-6.3 1-7.4 0-1.2-.6-2.1-2.12-2.1-3.8 0-7.88 5.4-9.38 8.3Z',\n x: 'M18.244 2.25h3.308l-7.227 8.26 8.502 11.24h-6.657l-5.214-6.817-5.965 6.817H1.681l7.73-8.835L1.255 2.25h6.826l4.713 6.231 5.45-6.231Zm-1.161 17.52h1.833L7.084 4.126H5.117L17.083 19.77Z',\n mail: 'M2.5 4.5h19a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-19a1 1 0 0 1-1-1v-13a1 1 0 0 1 1-1Zm0 1.8v.35l9.5 6.1 9.5-6.1V6.3L12.54 12.4a1 1 0 0 1-1.08 0L2.5 6.3Zm19 11.4V8.8l-8.54 5.48a1.8 1.8 0 0 1-1.92 0L2.5 8.8v8.9h19Z',\n};\n\nexport interface SocialIconProps extends Omit<SVGProps<SVGSVGElement>, 'color'> {\n /** Brand mark to render. */\n name: SocialIconName;\n /** Semantic role used for the current-colour mark. */\n accent?: AccentToken;\n /** Accessible name. Defaults to the brand name. */\n label?: string;\n /** Optional destination. When set, the icon is wrapped in an anchor. */\n href?: string;\n /** Link target. `_blank` automatically receives a safe `rel` value. */\n target?: AnchorHTMLAttributes<HTMLAnchorElement>['target'];\n /** Explicit link relationship, overriding the `_blank` default. */\n rel?: string;\n}\n\n/**\n * Accessible brand SVG for estate social and contact links.\n *\n * Without `href` this is a labelled image. With `href` it becomes a labelled\n * link and the SVG is hidden from assistive technology to avoid two names.\n * All marks use semantic accent roles and `currentColor`, so both theme levels\n * resolve through the design-system token ladder.\n */\nexport const SocialIcon = forwardRef<SVGSVGElement | HTMLAnchorElement, SocialIconProps>(\n function SocialIcon(\n { name, accent = 'primary', label, href, target, rel, className, ...svgProps },\n ref,\n ) {\n const accessibleName = label ?? svgProps['aria-label'] ?? LABELS[name];\n const svg = (\n <svg\n {...svgProps}\n // The ref follows the rendered root only: inside an anchor the SVG is\n // decoration, and a callback ref fired on both would run element\n // setup/cleanup logic against the nested mark first.\n ref={href ? undefined : (ref as Ref<SVGSVGElement>)}\n data-slot=\"social-icon\"\n viewBox=\"0 0 24 24\"\n fill=\"currentColor\"\n aria-hidden={href ? true : undefined}\n aria-label={href ? undefined : accessibleName}\n role={href ? undefined : 'img'}\n className={cn('inline-block size-5 shrink-0', accentTextClass(accent), className)}\n >\n <path d={PATHS[name]} />\n </svg>\n );\n\n if (!href) return svg;\n\n return (\n <a\n ref={ref as Ref<HTMLAnchorElement>}\n href={href}\n target={target}\n rel={rel ?? (target === '_blank' ? 'noopener noreferrer' : undefined)}\n aria-label={accessibleName}\n className=\"inline-flex items-center focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-accent-primary\"\n >\n {svg}\n </a>\n );\n },\n);\n\nSocialIcon.displayName = 'SocialIcon';\n\nexport type NamedSocialIconProps = Omit<SocialIconProps, 'name'>;\n\n/** GitHub brand mark. */\nexport function GitHubIcon(props: NamedSocialIconProps) {\n return <SocialIcon name=\"github\" {...props} />;\n}\n\n/** LinkedIn brand mark. */\nexport function LinkedInIcon(props: NamedSocialIconProps) {\n return <SocialIcon name=\"linkedin\" {...props} />;\n}\n\n/** Bluesky brand mark. */\nexport function BlueskyIcon(props: NamedSocialIconProps) {\n return <SocialIcon name=\"bluesky\" {...props} />;\n}\n\n/** X brand mark. */\nexport function XIcon(props: NamedSocialIconProps) {\n return <SocialIcon name=\"x\" {...props} />;\n}\n\n/** Email envelope mark. */\nexport function MailIcon(props: NamedSocialIconProps) {\n return <SocialIcon name=\"mail\" {...props} />;\n}\n"],"mappings":";AAAA,SAAS,kBAAsE;AAE/E,SAAS,uBAAuB;AAChC,SAAS,UAAU;AAyEX;AApER,IAAM,SAAyC;AAAA,EAC7C,QAAQ;AAAA,EACR,UAAU;AAAA,EACV,SAAS;AAAA,EACT,GAAG;AAAA,EACH,MAAM;AACR;AAOA,IAAM,QAAwC;AAAA,EAC5C,QACE;AAAA,EACF,UACE;AAAA,EACF,SACE;AAAA,EACF,GAAG;AAAA,EACH,MAAM;A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  subtitle,
16
16
  icon: Icon,
17
17
  accent = "primary",
18
+ appearance = "boxed",
18
19
  className
19
20
  }) {
20
21
  return /* @__PURE__ */ jsxs(
@@ -22,8 +23,7 @@ function StatCard({
22
23
  {
23
24
  "data-slot": "stat-card",
24
25
  className: cn(
25
- "bg-surface-raised border-2 border-edge-strong p-6 transition-all duration-200",
26
- accentHoverEdgeClass(accent),
26
+ appearance === "boxed" ? ["bg-surface-raised border-2 border-edge-strong p-6 transition-all duration-200", accentHoverEdgeClass(accent)] : "border-l border-dashed border-edge-subtle px-6 py-4 first:border-l-0 first:pl-0",
27
27
  className
28
28
  ),
29
29
  children: [
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/components/StatCard.tsx"],"sourcesContent":["import type { ElementType } from 'react';\nimport { accentHoverEdgeClass, accentTextClass } from '../lib/accentClasses';\nimport { cn } from '../lib/recipe';\nimport type { AccentToken } from '../lib/theme';\n\n/**\n * Accepted accents. Widened from the four palette names to the full role set;\n * the old names still resolve to the same roles, so existing call sites keep\n * rendering identically.\n */\nexport type StatCardAccent = AccentToken;\n\nexport interface StatCardProps {\n title: string;\n value: string | number;\n change?: string;\n changeType?: 'positive' | 'negative' | 'neutral';\n subtitle?: string;\n icon?: ElementType<{ className?: string }>;\n accent?: StatCardAccent;\n className?: string;\n}\n\n/**\n * A change is meaning, not decoration, so it reads from the intent roles rather\n * than the card's accent — a card accented `danger` still shows a rise in the\n * success colour.\n */\nconst CHANGE_CLASS: Record<NonNullable<StatCardProps['changeType']>, string> = {\n positive: 'text-intent-success',\n negative: 'text-intent-danger',\n neutral: 'text-content-muted',\n};\n\nexport function StatCard({\n title,\n value,\n change,\n changeType = 'positive',\n subtitle,\n icon: Icon,\n accent = 'primary',\n className,\n}: StatCardProps) {\n return (\n <div data-slot=\"stat-card\"\n className={cn(\n 'bg-surface-raised border-2 border-edge-strong p-6 transition-all duration-200',\n accentHoverEdgeClass(accent),\n className,\n )}\n >\n <div data-slot=\"statcard-header\" className=\"flex justify-between items-start mb-2\">\n <span data-slot=\"statcard-label\" className=\"font-mono text-xs font-bold uppercase tracking-wider text-content-muted\">\n [ {title} ]\n </span>\n {Icon && <Icon className={cn('h-6 w-6', accentTextClass(accent))} />}\n </div>\n <div data-slot=\"statcard-value-row\" className=\"flex items-baseline gap-3 my-1\">\n <span data-slot=\"statcard-value\" className=\"font-display text-4xl font-extrabold text-content-primary tracking-tight\">\n {value}\n </span>\n {change && (\n <span data-slot=\"statcard-change\" className={cn('font-mono text-xs font-bold', CHANGE_CLASS[changeType])}>\n {change}\n </span>\n )}\n </div>\n {subtitle && (\n <p data-slot=\"statcard-detail\" className=\"font-mono text-xs text-content-muted mt-2\">\n &gt; {subtitle}\n </p>\n )}\n </div>\n );\n}\n"],"mappings":";AACA,SAAS,sBAAsB,uBAAuB;AACtD,SAAS,UAAU;AAmDX,SAGS,KAHT;AAzBR,IAAM,eAAyE;AAAA,EAC7E,UAAU;AAAA,EACV,UAAU;AAAA,EACV,SAAS;AACX;AAEO,SAAS,SAAS;AAAA,EACvB;AAAA,EACA;AAAA,EACA;AAAA,EACA,aAAa;AAAA,EACb;AAAA,EACA,MAAM;AAAA,EACN,SAAS;AAAA,EACT;AACF,GAAkB;AAChB,SACE;AAAA,IAAC;AAAA;AAAA,MAAI,aAAU;AAAA,MACb,WAAW;AAAA,QACT;AAAA,QACA,qBAAqB,MAAM;AAAA,QAC3B;AAAA,MACF;AAAA,MAEA;AAAA,6BAAC,SAAI,aAAU,mBAAkB,WAAU,yCACzC;AAAA,+BAAC,UAAK,aAAU,kBAAiB,WAAU,2EAA0E;AAAA;AAAA,YAChH;AAAA,YAAM;AAAA,aACX;AAAA,UACC,QAAQ,oBAAC,QAAK,WAAW,GAAG,WAAW,gBAAgB,MAAM,CAAC,GAAG;AAAA,WACpE;AAAA,QACA,qBAAC,SAAI,aAAU,sBAAqB,WAAU,kCAC5C;AAAA,8BAAC,UAAK,aAAU,kBAAiB,WAAU,4EACxC,iBACH;AAAA,UACC,UACC,oBAAC,UAAK,aAAU,mBAAkB,WAAW,GAAG,+BAA+B,aAAa,UAAU,CAAC,GACpG,kBACH;AAAA,WAEJ;AAAA,QACC,YACC,qBAAC,OAAE,aAAU,mBAAkB,WAAU,6CAA4C;AAAA;AAAA,UAC7E;AAAA,WACR;AAAA;AAAA;AAAA,EAEJ;AAEJ;","names":[]}
1
+ {"version":3,"sources":["../../src/components/StatCard.tsx"],"sourcesContent":["import type { ElementType } from 'react';\nimport { accentHoverEdgeClass, accentTextClass } from '../lib/accentClasses';\nimport { cn } from '../lib/recipe';\nimport type { AccentToken } from '../lib/theme';\n\n/**\n * Accepted accents. Widened from the four palette names to the full role set;\n * the old names still resolve to the same roles, so existing call sites keep\n * rendering identically.\n */\nexport type StatCardAccent = AccentToken;\n\n/**\n * `boxed` is the brand's 2px panel, for a figure that stands alone. `quiet` drops the box: a\n * figure in a row of figures, separated from its neighbour by a dashed hairline, so the row reads\n * as one strip rather than as one heavy object per number — see `docs/edge-hierarchy.md`.\n */\nexport type StatCardAppearance = 'boxed' | 'quiet';\n\nexport interface StatCardProps {\n title: string;\n value: string | number;\n change?: string;\n changeType?: 'positive' | 'negative' | 'neutral';\n subtitle?: string;\n icon?: ElementType<{ className?: string }>;\n accent?: StatCardAccent;\n /** `boxed` by default. `quiet` for a card in a row of cards. */\n appearance?: StatCardAppearance;\n className?: string;\n}\n\n/**\n * A change is meaning, not decoration, so it reads from the intent roles rather\n * than the card's accent — a card accented `danger` still shows a rise in the\n * success colour.\n */\nconst CHANGE_CLASS: Record<NonNullable<StatCardProps['changeType']>, string> = {\n positive: 'text-intent-success',\n negative: 'text-intent-danger',\n neutral: 'text-content-muted',\n};\n\nexport function StatCard({\n title,\n value,\n change,\n changeType = 'positive',\n subtitle,\n icon: Icon,\n accent = 'primary',\n appearance = 'boxed',\n className,\n}: StatCardProps) {\n return (\n <div data-slot=\"stat-card\"\n className={cn(\n appearance === 'boxed'\n ? ['bg-surface-raised border-2 border-edge-strong p-6 transition-all duration-200', accentHoverEdgeClass(accent)]\n : 'border-l border-dashed border-edge-subtle px-6 py-4 first:border-l-0 first:pl-0',\n className,\n )}\n >\n <div data-slot=\"statcard-header\" className=\"flex justify-between items-start mb-2\">\n <span data-slot=\"statcard-label\" className=\"font-mono text-xs font-bold uppercase tracking-wider text-content-muted\">\n [ {title} ]\n </span>\n {Icon && <Icon className={cn('h-6 w-6', accentTextClass(accent))} />}\n </div>\n <div data-slot=\"statcard-value-row\" className=\"flex items-baseline gap-3 my-1\">\n <span data-slot=\"statcard-value\" className=\"font-display text-4xl font-extrabold text-content-primary tracking-tight\">\n {value}\n </span>\n {change && (\n <span data-slot=\"statcard-change\" className={cn('font-mono text-xs font-bold', CHANGE_CLASS[changeType])}>\n {change}\n </span>\n )}\n </div>\n {subtitle && (\n <p data-slot=\"statcard-detail\" className=\"font-mono text-xs text-content-muted mt-2\">\n &gt; {subtitle}\n </p>\n )}\n </div>\n );\n}\n"],"mappings":";AACA,SAAS,sBAAsB,uBAAuB;AACtD,SAAS,UAAU;AA8DX,SAGS,KAHT;AA3BR,IAAM,eAAyE;AAAA,EAC7E,UAAU;AAAA,EACV,UAAU;AAAA,EACV,SAAS;AACX;AAEO,SAAS,SAAS;AAAA,EACvB;AAAA,EACA;AAAA,EACA;AAAA,EACA,aAAa;AAAA,EACb;AAAA,EACA,MAAM;AAAA,EACN,SAAS;AAAA,EACT,aAAa;AAAA,EACb;AACF,GAAkB;AAChB,SACE;AAAA,IAAC;AAAA;AAAA,MAAI,aAAU;AAAA,MACb,WAAW;AAAA,QACT,eAAe,UACX,CAAC,iFAAiF,qBAAqB,MAAM,CAAC,IAC9G;AAAA,QACJ;AAAA,MACF;AAAA,MAEA;AAAA,6BAAC,SAAI,aAAU,mBAAkB,WAAU,yCACzC;AAAA,+BAAC,UAAK,aAAU,kBAAiB,WAAU,2EAA0E;AAAA;AAAA,YAChH;AAAA,YAAM;AAAA,aACX;AAAA,UACC,QAAQ,oBAAC,QAAK,WAAW,GAAG,WAAW,gBAAgB,MAAM,CAAC,GAAG;AAAA,WACpE;AAAA,QACA,qBAAC,SAAI,aAAU,sBAAqB,WAAU,kCAC5C;AAAA,8BAAC,UAAK,aAAU,kBAAiB,WAAU,4EACxC,iBACH;AAAA,UACC,UACC,oBAAC,UAAK,aAAU,mBAAkB,WAAW,GAAG,+BAA+B,aAAa,UAAU,CAAC,GACpG,kBACH;AAAA,WAEJ;AAAA,QACC,YACC,qBAAC,OAAE,aAAU,mBAAkB,WAAU,6CAA4C;AAAA;AAAA,UAC7E;AAAA,WACR;AAAA;AAAA;AAAA,EAEJ;AAEJ;","names":[]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/components/StatusPage.tsx"],"sourcesContent":["import { forwardRef } from 'react';\nimport type { HTMLAttributes, ReactNode, Ref } from 'react';\nimport { recipe } from '../lib/recipe';\nimport { Button } from './Button';\nimport { EmptyState } from './EmptyState';\n\n/**\n * The page frame around an `EmptyState`, and nothing more.\n *\n * `standalone` is the one real variant: inside the site chrome the page is a\n * region of the consumer's `<main>`; outside it — a 500 served because the\n * shell itself failed, a maintenance page from the edge — it has to be the\n * `<main>` and fill the viewport on its own ground.\n *\n * The title is resized through its `data-slot` rather than a second recipe,\n * because it is `EmptyState`'s title: one element, sized for a page here.\n */\nconst statusPage = recipe({\n slots: {\n root: 'flex w-full justify-center px-4 py-16 md:py-24',\n state:\n 'w-full max-w-2xl '\n + '[&_[data-slot=empty-state-title]]:text-2xl md:[&_[data-slot=empty-state-title]]:text-3xl',\n /**\n * The status code: large, and in the muted role like `EmptyState`'s own\n * glyph, because the title carries the status in words and this only\n * repeats it. Large text is gated at 3:1, which muted clears on every Level.\n */\n code: 'font-display text-6xl font-black leading-none tracking-tight md:text-8xl',\n },\n variants: {\n standalone: {\n true: { root: 'min-h-dvh items-center bg-surface-base text-content-primary' },\n false: {},\n },\n },\n defaultVariants: { standalone: false },\n});\n\nexport interface StatusPageProps\n extends Omit<HTMLAttributes<HTMLElement>, 'title' | 'children' | 'className'> {\n /**\n * The page's `<h1>` — the status, in words: \"Page not found\", \"Down for\n * maintenance\". This is what a screen reader and a search result read, so it\n * must say the state on its own, without the `code` beside it.\n */\n title: string;\n /**\n * A short code shown large above the title — `404`, `503`. Rendered as text,\n * so it is read out before the heading. A decorative glyph can go here too;\n * give that node `aria-hidden` so it is not read as a word.\n */\n code?: ReactNode;\n /** What happened, and whether it is the reader's to fix. */\n description?: ReactNode;\n /**\n * The route back to somewhere useful — normally a `Button` with an `href`.\n * Links rather than handlers, so the way out works when the page is served\n * without its JavaScript.\n */\n action?: ReactNode;\n /** Anything else: a reference id to quote to support, a status-page link. */\n children?: ReactNode;\n /**\n * Render as the page's `<main>`, filling the viewport on `bg-surface-base`,\n * for a page served without the site chrome. Off by default, when the page is\n * placed inside the consumer's own `<main>` between `SiteHeader` and\n * `SiteFooter` and renders a plain `<div>`.\n */\n standalone?: boolean;\n /** Merged into the root's classes. */\n className?: string;\n}\n\n/**\n * A whole-page system state — not found, server error, maintenance, offline,\n * unauthorized — composed from `EmptyState`.\n *\n * It adds three things to the empty state and no more: the title becomes the\n * page's single `<h1>`, an optional status `code` sits above it, and the frame\n * either sits inside the site chrome or, with `standalone`, stands in for it.\n * `NotFoundPage` and `ServerErrorPage` are this with their copy filled in;\n * maintenance, offline and unauthorized pages are written with it directly,\n * because their copy is different on every product.\n *\n * @example\n * ```tsx\n * <StatusPage\n * standalone\n * code=\"503\"\n * title=\"Down for maintenance\"\n * description=\"Back by 09:00 UTC.\"\n * action={<Button href=\"https://status.example.com\">STATUS PAGE</Button>}\n * />\n * ```\n */\nexport const StatusPage = forwardRef<HTMLElement, StatusPageProps>(function StatusPage(\n { title, code, description, action, children, standalone = false, className, ...props },\n ref,\n) {\n const styles = statusPage({ standalone });\n const rootProps = {\n 'data-slot': 'status-page',\n ...props,\n className: styles.root({ class: className }),\n };\n const state = (\n <EmptyState\n className={styles.state()}\n headingLevel={1}\n icon={\n code ? (\n <p data-slot=\"status-page-code\" className={styles.code()}>\n {code}\n </p>\n ) : undefined\n }\n title={title}\n description={description}\n action={action}\n >\n {children}\n </EmptyState>\n );\n\n // Two elements, not an `as` prop: a `<main>` is a landmark with rules (one\n // per page), and the choice is the one thing `standalone` means.\n return standalone ? (\n <main ref={ref} {...rootProps}>\n {state}\n </main>\n ) : (\n <div ref={ref as Ref<HTMLDivElement>} {...rootProps}>\n {state}\n </div>\n );\n});\n\n/** Shared by the two presets: every `StatusPage` prop, with the copy optional. */\ninterface StatusPagePresetProps extends Omit<StatusPageProps, 'title'> {\n /** Where the default action goes. The site root, `/`, by default. */\n homeHref?: string;\n /** The default action's label. `GO HOME` by default. */\n homeLabel?: string;\n}\n\nfunction homeAction(homeHref: string, homeLabel: string) {\n return (\n <Button href={homeHref} variant=\"primary\" bracketed>\n {homeLabel}\n </Button>\n );\n}\n\nexport interface NotFoundPageProps extends StatusPagePresetProps {\n /** The page's `<h1>`. \"Page not found\" by default; `code` is `404`. */\n title?: string;\n}\n\n/**\n * The 404 page: `StatusPage` with the copy every site writes identically.\n *\n * Code `404`, the title \"Page not found\", a sentence that does not blame the\n * reader, and a link home. Every one of them is a prop, so a site that wants\n * search in the page or a different way out passes `action` or `children`\n * rather than rebuilding the page.\n *\n * @example\n * ```tsx\n * <main id=\"main-content\"><NotFoundPage /></main>\n * ```\n */\nexport const NotFoundPage = forwardRef<HTMLElement, NotFoundPageProps>(function NotFoundPage(\n {\n title = 'Page not found',\n code = '404',\n description = 'Nothing lives at this address. It may have moved, or the link that brought you here may be wrong.',\n homeHref = '/',\n homeLabel = 'GO HOME',\n action,\n ...props\n },\n ref,\n) {\n return (\n <StatusPage\n ref={ref}\n title={title}\n code={code}\n description={description}\n action={action ?? homeAction(homeHref, homeLabel)}\n {...props}\n />\n );\n});\n\nexport interface ServerErrorPageProps extends StatusPagePresetProps {\n /** The page's `<h1>`. \"Something went wrong\" by default; `code` is `500`. */\n title?: string;\n /**\n * `true` by default, unlike `StatusPage` and `NotFoundPage`. A 500 is usually\n * served because the application failed, and the shell that would frame it\n * may be what failed. Pass `standalone={false}` for an error the shell\n * survived, inside the consumer's own `<main>`.\n */\n standalone?: boolean;\n}\n\n/**\n * The 500 page: `StatusPage` with the copy every site writes identically.\n *\n * Code `500`, the title \"Something went wrong\", a sentence saying it is not\n * the reader's fault, and a link home. It is standalone by default, since the\n * page is usually served because the application failed and the shell that\n * would have framed it is what may not render. Pass `standalone={false}` to\n * place it inside the site chrome. A request or incident id to quote to\n * support belongs in `children`.\n *\n * @example\n * ```tsx\n * <ServerErrorPage>\n * <p>Reference: {requestId}</p>\n * </ServerErrorPage>\n * ```\n */\nexport const ServerErrorPage = forwardRef<HTMLElement, ServerErrorPageProps>(function ServerErrorPage(\n {\n title = 'Something went wrong',\n code = '500',\n description = 'The server hit an error it could not recover from. It is not something you did — try again in a moment.',\n homeHref = '/',\n homeLabel = 'GO HOME',\n action,\n standalone = true,\n ...props\n },\n ref,\n) {\n return (\n <StatusPage\n ref={ref}\n title={title}\n code={code}\n description={description}\n action={action ?? homeAction(homeHref, homeLabel)}\n standalone={standalone}\n {...props}\n />\n );\n});\n"],"mappings":";AAAA,SAAS,kBAAkB;AAE3B,SAAS,cAAc;AACvB,SAAS,cAAc;AACvB,SAAS,kBAAkB;AA4GjB;AA/FV,IAAM,aAAa,OAAO;AAAA,EACxB,OAAO;AAAA,IACL,MAAM;AAAA,IACN,OACE;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAOF,MAAM;AAAA,EACR;AAAA,EACA,UAAU;AAAA,IACR,YAAY;AAAA,MACV,MAAM,EAAE,MAAM,8DAA8D;AAAA,MAC5E,OAAO,CAAC;AAAA,IACV;AAAA,EACF;AAAA,EACA,iBAAiB,EAAE,YAAY,MAAM;AACvC,CAAC;AA2DM,IAAM,aAAa,WAAyC,SAASA,YAC1E,EAAE,OAAO,MAAM,aAAa,QAAQ,UAAU,aAAa,OAAO,WAAW,GAAG,MAAM,GACtF,KACA;AACA,QAAM,SAAS,WAAW,EAAE,WAAW,C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AAA;AAAA,EACN;AAEJ,CAAC;","names":["StatusPage","NotFoundPage","ServerErrorPage"]}
1
+ {"version":3,"sources":["../../src/components/StatusPage.tsx"],"sourcesContent":["import { forwardRef } from 'react';\nimport type { HTMLAttributes, ReactNode, Ref } from 'react';\nimport { recipe } from '../lib/recipe';\nimport { Button } from './Button';\nimport { EmptyState } from './EmptyState';\n\n/**\n * The page frame around an `EmptyState`, and nothing more.\n *\n * `standalone` is the one real variant: inside the site chrome the page is a\n * region of the consumer's `<main>`; outside it — a 500 served because the\n * shell itself failed, a maintenance page from the edge — it has to be the\n * `<main>` and fill the viewport on its own ground.\n *\n * The title is resized through its `data-slot` rather than a second recipe,\n * because it is `EmptyState`'s title: one element, sized for a page here.\n */\nconst statusPage = recipe({\n slots: {\n root: 'flex w-full justify-center px-4 py-16 md:py-24',\n state:\n 'w-full max-w-2xl '\n + '[&_[data-slot=empty-state-title]]:text-2xl md:[&_[data-slot=empty-state-title]]:text-3xl',\n /**\n * The status code: large, and in the muted role like `EmptyState`'s own\n * glyph, because the title carries the status in words and this only\n * repeats it. Large text is gated at 3:1, which muted clears on every Level.\n */\n code: 'font-display text-6xl font-black leading-none tracking-tight md:text-8xl',\n },\n variants: {\n standalone: {\n true: { root: 'min-h-dvh items-center bg-surface-base text-content-primary' },\n false: {},\n },\n },\n defaultVariants: { standalone: false },\n});\n\nexport interface StatusPageProps\n extends Omit<HTMLAttributes<HTMLElement>, 'title' | 'children' | 'className'> {\n /**\n * The page's `<h1>` — the status, in words: \"Page not found\", \"Down for\n * maintenance\". This is what a screen reader and a search result read, so it\n * must say the state on its own, without the `code` beside it.\n */\n title: string;\n /**\n * A short code shown large above the title — `404`, `503`. Rendered as text,\n * so it is read out before the heading. A decorative glyph can go here too;\n * give that node `aria-hidden` so it is not read as a word.\n */\n code?: ReactNode;\n /** What happened, and whether it is the reader's to fix. */\n description?: ReactNode;\n /**\n * The route back to somewhere useful — normally a `Button` with an `href`.\n * Links rather than handlers, so the way out works when the page is served\n * without its JavaScript.\n */\n action?: ReactNode;\n /** Anything else: a reference id to quote to support, a status-page link. */\n children?: ReactNode;\n /**\n * Render as the page's `<main>`, filling the viewport on `bg-surface-base`,\n * for a page served without the site chrome. Off by default, when the page is\n * placed inside the consumer's own `<main>` between `SiteHeader` and\n * `SiteFooter` and renders a plain `<div>`.\n */\n standalone?: boolean;\n /** Merged into the root's classes. */\n className?: string;\n}\n\n/**\n * A whole-page system state — not found, server error, maintenance, offline,\n * unauthorized — composed from `EmptyState`.\n *\n * It adds three things to the empty state and no more: the title becomes the\n * page's single `<h1>`, an optional status `code` sits above it, and the frame\n * either sits inside the site chrome or, with `standalone`, stands in for it.\n * `NotFoundPage` and `ServerErrorPage` are this with their copy filled in;\n * maintenance, offline and unauthorized pages are written with it directly,\n * because their copy is different on every product.\n *\n * @example\n * ```tsx\n * <StatusPage\n * standalone\n * code=\"503\"\n * title=\"Down for maintenance\"\n * description=\"Back by 09:00 UTC.\"\n * action={<Button href=\"https://status.example.com\">STATUS PAGE</Button>}\n * />\n * ```\n */\nexport const StatusPage = forwardRef<HTMLElement, StatusPageProps>(function StatusPage(\n { title, code, description, action, children, standalone = false, className, ...props },\n ref,\n) {\n const styles = statusPage({ standalone });\n const rootProps = {\n 'data-slot': 'status-page',\n ...props,\n className: styles.root({ class: className }),\n };\n const state = (\n <EmptyState\n className={styles.state()}\n headingLevel={1}\n icon={\n code ? (\n <p data-slot=\"status-page-code\" className={styles.code()}>\n {code}\n </p>\n ) : undefined\n }\n title={title}\n description={description}\n action={action}\n >\n {children}\n </EmptyState>\n );\n\n // Two elements, not an `as` prop: a `<main>` is a landmark with rules (one\n // per page), and the choice is the one thing `standalone` means.\n return standalone ? (\n <main ref={ref} {...rootProps}>\n {state}\n </main>\n ) : (\n <div ref={ref as Ref<HTMLDivElement>} {...rootProps}>\n {state}\n </div>\n );\n});\n\n/** Shared by the two presets: every `StatusPage` prop, with the copy optional. */\nexport interface StatusPagePresetProps extends Omit<StatusPageProps, 'title'> {\n /** Where the default action goes. The site root, `/`, by default. */\n homeHref?: string;\n /** The default action's label. `GO HOME` by default. */\n homeLabel?: string;\n}\n\nfunction homeAction(homeHref: string, homeLabel: string) {\n return (\n <Button href={homeHref} variant=\"primary\" bracketed>\n {homeLabel}\n </Button>\n );\n}\n\nexport interface NotFoundPageProps extends StatusPagePresetProps {\n /** The page's `<h1>`. \"Page not found\" by default; `code` is `404`. */\n title?: string;\n}\n\n/**\n * The 404 page: `StatusPage` with the copy every site writes identically.\n *\n * Code `404`, the title \"Page not found\", a sentence that does not blame the\n * reader, and a link home. Every one of them is a prop, so a site that wants\n * search in the page or a different way out passes `action` or `children`\n * rather than rebuilding the page.\n *\n * @example\n * ```tsx\n * <main id=\"main-content\"><NotFoundPage /></main>\n * ```\n */\nexport const NotFoundPage = forwardRef<HTMLElement, NotFoundPageProps>(function NotFoundPage(\n {\n title = 'Page not found',\n code = '404',\n description = 'Nothing lives at this address. It may have moved, or the link that brought you here may be wrong.',\n homeHref = '/',\n homeLabel = 'GO HOME',\n action,\n ...props\n },\n ref,\n) {\n return (\n <StatusPage\n ref={ref}\n title={title}\n code={code}\n description={description}\n action={action ?? homeAction(homeHref, homeLabel)}\n {...props}\n />\n );\n});\n\nexport interface ServerErrorPageProps extends StatusPagePresetProps {\n /** The page's `<h1>`. \"Something went wrong\" by default; `code` is `500`. */\n title?: string;\n /**\n * `true` by default, unlike `StatusPage` and `NotFoundPage`. A 500 is usually\n * served because the application failed, and the shell that would frame it\n * may be what failed. Pass `standalone={false}` for an error the shell\n * survived, inside the consumer's own `<main>`.\n */\n standalone?: boolean;\n}\n\n/**\n * The 500 page: `StatusPage` with the copy every site writes identically.\n *\n * Code `500`, the title \"Something went wrong\", a sentence saying it is not\n * the reader's fault, and a link home. It is standalone by default, since the\n * page is usually served because the application failed and the shell that\n * would have framed it is what may not render. Pass `standalone={false}` to\n * place it inside the site chrome. A request or incident id to quote to\n * support belongs in `children`.\n *\n * @example\n * ```tsx\n * <ServerErrorPage>\n * <p>Reference: {requestId}</p>\n * </ServerErrorPage>\n * ```\n */\nexport const ServerErrorPage = forwardRef<HTMLElement, ServerErrorPageProps>(function ServerErrorPage(\n {\n title = 'Something went wrong',\n code = '500',\n description = 'The server hit an error it could not recover from. It is not something you did — try again in a moment.',\n homeHref = '/',\n homeLabel = 'GO HOME',\n action,\n standalone = true,\n ...props\n },\n ref,\n) {\n return (\n <StatusPage\n ref={ref}\n title={title}\n code={code}\n description={description}\n action={action ?? homeAction(homeHref, homeLabel)}\n standalone={standalone}\n {...props}\n />\n );\n});\n"],"mappings":";AAAA,SAAS,kBAAkB;AAE3B,SAAS,cAAc;AACvB,SAAS,cAAc;AACvB,SAAS,kBAAkB;AA4GjB;AA/FV,IAAM,aAAa,OAAO;AAAA,EACxB,OAAO;AAAA,IACL,MAAM;AAAA,IACN,OACE;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAOF,MAAM;AAAA,EACR;AAAA,EACA,UAAU;AAAA,IACR,YAAY;AAAA,MACV,MAAM,EAAE,MAAM,8DAA8D;AAAA,MAC5E,OAAO,CAAC;AAAA,IACV;AAAA,EACF;AAAA,EACA,iBAAiB,EAAE,YAAY,MAAM;AACvC,CAAC;AA2DM,IAAM,aAAa,WAAyC,SAASA,YAC1E,EAAE,OAAO,MAAM,aAAa,QAAQ,UAAU,aAAa,OAAO,WAAW,GAAG,MAAM,GACtF,KACA;AACA,QAAM,SAAS,WAAW,EAAE,WAAW,CAAC;AACxC,QAAM,YAAY;AAAA,IAChB,aAAa;AAAA,IACb,GAAG;AAAA,IACH,WAAW,OAAO,KAAK,EAAE,OAAO,UAAU,CAAC;AAAA,EAC7C;AACA,QAAM,QACJ;AAAA,IAAC;AAAA;AAAA,MACC,WAAW,OAAO,MAAM;AAAA,MACxB,cAAc;AAAA,MACd,MACE,OACE,oBAAC,OAAE,aAAU,oBAAmB,WAAW,OAAO,KAAK,GACpD,gBACH,IACE;AAAA,MAEN;AAAA,MACA;AAAA,MACA;AAAA,MAEC;AAAA;AAAA,EACH;AAKF,SAAO,aACL,oBAAC,UAAK,KAAW,GAAG,WACjB,iBACH,IAEA,oBAAC,SAAI,KAAkC,GAAG,WACvC,iBACH;AAEJ,CAAC;AAUD,SAAS,WAAW,UAAkB,WAAmB;AACvD,SACE,oBAAC,UAAO,MAAM,UAAU,SAAQ,WAAU,WAAS,MAChD,qBACH;AAEJ;AAoBO,IAAM,eAAe,WAA2C,SAASC,cAC9E;AAAA,EACE,QAAQ;AAAA,EACR,OAAO;AAAA,EACP,cAAc;AAAA,EACd,WAAW;AAAA,EACX,YAAY;AAAA,EACZ;AAAA,EACA,GAAG;AACL,GACA,KACA;AACA,SACE;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA,QAAQ,UAAU,WAAW,UAAU,SAAS;AAAA,MAC/C,GAAG;AAAA;AAAA,EACN;AAEJ,CAAC;AA+BM,IAAM,kBAAkB,WAA8C,SAASC,iBACpF;AAAA,EACE,QAAQ;AAAA,EACR,OAAO;AAAA,EACP,cAAc;AAAA,EACd,WAAW;AAAA,EACX,YAAY;AAAA,EACZ;AAAA,EACA,aAAa;AAAA,EACb,GAAG;AACL,GACA,KACA;AACA,SACE;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA,QAAQ,UAAU,WAAW,UAAU,SAAS;AAAA,MAChD;AAAA,MACC,GAAG;AAAA;AAAA,EACN;AAEJ,CAAC;","names":["StatusPage","NotFoundPage","ServerErrorPage"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/docs/figures/ActivityGrid.tsx"],"sourcesContent":["/**\n * Adapted from mdxcn by Keshav Bagaade, MIT licensed.\n * Source: https://github.com/keshav-exe/mdxcn/blob/2928126ba146ebbae9c2351deca27d27bb40e744/registry/default/graph-activity/graph-activity.tsx\n * The local port removes motion and graph variables in favour of deterministic\n * rendering and the design system's semantic token classes.\n */\n\nimport * as React from 'react';\nimport { cn } from '../../../lib/recipe';\n\nconst DAY_MS = 86_400_000;\nconst MAX_DAYS = 3660;\nconst MONTHS = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'] as const;\nconst DEFAULT_GLYPHS = ['·', '░', '▒', '▓', '█'];\ntype Glyphs = 'shade' | 'ascii' | 'hash' | 'bar' | readonly string[];\ntype FigurePalette = 'mono' | 'duo' | 'multi';\n\nfunction glyphsOf(glyphs?: Glyphs): readonly string[] {\n if (Array.isArray(glyphs)) return glyphs.length ? glyphs : DEFAULT_GLYPHS;\n if (glyphs === 'ascii') return ['.', '-', '=', '#', '@'];\n if (glyphs === 'hash') return ['.', ':', '+', '#', '█'];\n if (glyphs === 'bar') return ['▁', '▂', '▃', '▅', '█'];\n return DEFAULT_GLYPHS;\n}\nfunction intensity(level: number, max: number): number { return level <= 0 || max <= 0 ? 0 : Math.max(1, Math.round(Math.min(1, level / max) * 4)); }\nfunction colorClass(level: number, palette: FigurePalette = 'mono'): string {\n if (!level) return 'text-content-muted';\n if (palette === 'mono') return level <= 2 ? 'text-content-secondary' : 'text-content-primary';\n return level === 1 ? 'text-accent-secondary' : level === 2 && palette === 'multi' ? 'text-accent-tertiary' : 'text-accent-primary';\n}\nfunction renderGlyph(level: number, glyphs: readonly string[]): string { return glyphs[Math.round(Math.max(0, Math.min(4, level)) / 4 * (glyphs.length - 1))] ?? glyphs[0] ?? '·'; }\n\nexport interface ActivityDay {\n /** Calendar date in ISO `YYYY-MM-DD` form, interpreted in UTC. */\n date: string;\n /** Non-negative activity count for the date. */\n count: number;\n}\n\nexport interface ActivityGridProps extends React.HTMLAttributes<HTMLElement> {\n /** Dated counts used to derive the contribution grid. */\n data: ActivityDay[];\n /** First weekday in each column: Sunday (0) or Monday (1). */\n weekStartsOn?: 0 | 1;\n /** Optional upper bound for intensity scaling. */\n max?: number;\n /** Render the less/more glyph legend. */\n legend?: boolean;\n /** Glyph set name or custom glyph sequence. */\n glyphs?: Glyphs;\n /** Accent palette used for intensity levels. */\n palette?: FigurePalette;\n /** Additional classes for the renderer root. */\n className?: string;\n}\n\ninterface Cell { date: string; count: number; inRange: boolean }\n\nfunction parseDate(value: string): number | null {\n const match = /^(\\d{4})-(\\d{2})-(\\d{2})$/.exec(value);\n if (!match) return null;\n const [, y, m, d] = match;\n const date = new Date(0);\n date.setUTCHours(0, 0, 0, 0);\n date.setUTCFullYear(Number(y), Number(m) - 1, Number(d));\n return date.getUTCFullYear() === Number(y) && date.getUTCMonth() === Number(m) - 1 && date.getUTCDate() === Number(d) ? date.getTime() : null;\n}\n\nfunction iso(time: number): string { return new Date(time).toISOString().slice(0, 10); }\n\nfunction dailyCounts(data: ActivityDay[]): ActivityDay[] {\n const counts = new Map<string, number>();\n for (const item of data) {\n if (parseDate(item.date) === null) continue;\n const count = Number.isFinite(item.count) ? Math.max(0, item.count) : 0;\n counts.set(item.date, (counts.get(item.date) ?? 0) + count);\n }\n return Array.from(counts, ([date, count]) => ({ date, count }));\n}\n\nfunction makeWeeks(data: ActivityDay[], weekStartsOn: 0 | 1): Cell[][] {\n const valid = data.map((item) => ({ item, time: parseDate(item.date) })).filter((entry): entry is { item: ActivityDay; time: number } => entry.time !== null);\n if (!valid.length) return [];\n const min = valid.reduce((earliest, entry) => Math.min(earliest, entry.time), Infinity);\n const max = valid.reduce((latest, entry) => Math.max(latest, entry.time), -Infinity);\n const span = Math.floor((max - min) / DAY_MS) + 1;\n if (span > MAX_DAYS) return [];\n const first = min - ((new Date(min).getUTCDay() - weekStartsOn + 7) % 7) * DAY_MS;\n const last = max + ((weekStartsOn + 6 - new Date(max).getUTCDay() + 7) % 7) * DAY_MS;\n const counts = new Map(valid.map(({ item }) => [item.date, Math.max(0, Number.isFinite(item.count) ? item.count : 0)]));\n const weeks: Cell[][] = [];\n for (let time = first; time <= last; time += 7 * DAY_MS) {\n weeks.push(Array.from({ length: 7 }, (_, offset) => {\n const dateTime = time + offset * DAY_MS;\n const date = iso(dateTime);\n const inRange = dateTime >= min && dateTime <= max;\n return { date, count: inRange ? counts.get(date) ?? 0 : 0, inRange };\n }));\n }\n return weeks;\n}\n\nfunction Legend({ glyphs, palette }: { glyphs: readonly string[]; palette?: FigurePalette }) {\n return <p className=\"flex items-center gap-2 text-content-muted\"><span>Less</span><span aria-hidden=\"true\" className=\"flex select-none\">{glyphs.map((glyph, index) => <span className={cn('w-[1ch] text-center', colorClass(Math.round(index / Math.max(glyphs.length - 1, 1) * 4), palette))} key={`${glyph}-${index}`}>{glyph}</span>)}</span><span>More</span></p>;\n}\n\n/** Renders dated counts as a bounded, UTC-stable contribution grid. */\nexport const ActivityGrid = React.forwardRef<HTMLElement, ActivityGridProps>(function ActivityGrid({ data, weekStartsOn = 0, max, legend = true, glyphs, palette, className, ...rest }, ref) {\n const valid = dailyCounts(data);\n const weeks = makeWeeks(valid, weekStartsOn);\n const total = valid.reduce((sum, item) => sum + item.count, 0);\n const summary = `${total.toLocaleString('en-US')} contributions across ${valid.length} dates`;\n const glyphSet = glyphsOf(glyphs);\n const peak = max == null ? valid.reduce((largest, item) => Math.max(largest, item.count), 0) : Math.max(0, max);\n const weekdayLabels = weekStartsOn === 1 ? ['Mon', '', 'Wed', '', 'Fri', '', ''] : ['', 'Tue', '', 'Thu', '', 'Sat', ''];\n\n if (!valid.length || !weeks.length) return <section data-slot=\"activity-grid\" ref={ref} aria-label=\"Activity grid\" {...rest} className={cn('font-mono text-sm text-content-primary', className)}><p className=\"text-content-muted\">{valid.length ? 'Date range is too large to display.' : 'No activity dates to display.'}</p><p className=\"sr-only\">{summary}</p></section>;\n\n return <section data-slot=\"activity-grid\" ref={ref} aria-label=\"Activity grid\" {...rest} className={cn('flex w-fit max-w-full min-w-0 flex-col gap-3 font-mono text-sm text-content-primary', className)}>\n <p className=\"sr-only\">{summary}, from {valid.reduce((a, b) => a.date < b.date ? a : b).date} to {valid.reduce((a, b) => a.date > b.date ? a : b).date}.</p>\n <div className=\"overflow-x-auto\" role=\"img\" aria-label={summary}>\n <div className=\"min-w-max\">\n <div className=\"flex pl-[4ch]\" aria-hidden=\"true\">{weeks.map((week, i) => { const firstOfMonth = week.find((cell) => cell.inRange && cell.date.slice(-2) === '01'); return <span className=\"w-[2ch] shrink-0 text-content-muted\" key={i}>{firstOfMonth ? MONTHS[Number(firstOfMonth.date.slice(5, 7)) - 1] : ''}</span>; })}</div>\n <div className=\"flex gap-1\"><div className=\"flex w-[3ch] shrink-0 flex-col\" aria-hidden=\"true\">{weekdayLabels.map((label, i) => <span className=\"h-[1.2em] text-[0.7em] text-content-muted\" key={i}>{label}</span>)}</div><div className=\"flex gap-1\">{weeks.map((week) => <div className=\"flex flex-col\" key={week[0].date}>{week.map((cell) => { const level = cell.inRange ? intensity(cell.count, peak) : 0; return <span aria-hidden=\"true\" title={cell.inRange ? `${cell.date}: ${cell.count} contributions` : undefined} className={cn('flex h-[1.2em] w-[2ch] items-center justify-center leading-none', cell.inRange ? colorClass(level, palette) : 'text-transparent')} key={cell.date}>{cell.inRange ? renderGlyph(level, glyphSet) : (glyphSet[0] ?? '·')}</span>; })}</div>)}</div></div>\n </div>\n </div>\n {legend ? <div className=\"flex justify-end\"><Legend glyphs={glyphSet} palette={palette} /></div> : null}\n </section>;\n});\n"],"mappings":";AAOA,YAAY,WAAW;AACvB,SAAS,UAAU;AA+FV,SAA0D,KAA1D;AA7FT,IAAM,SAAS;AACf,IAAM,WAAW;AACjB,IAAM,SAAS,CAAC,OAAO,OAAO,OAAO,OAAO,OAAO,OAAO,OAAO,OAAO,OAAO,OAAO,OAAO,KAAK;AAClG,IAAM,iBAAiB,CAAC,QAAK,UAAK,UAAK,UAAK,QAAG;AAI/C,SAAS,SAAS,QAAoC;AACpD,MAAI,MAAM,QAAQ,MAAM,EAAG,QAAO,OAAO,SAAS,SAAS;AAC3D,MAAI,WAAW,QAAS,QAAO,CAAC,KAAK,KAAK,KAAK,KAAK,GAAG;AACvD,MAAI,WAAW,OA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AAAA,MAC5T,qBAAC,SAAI,WAAU,cAAa;AAAA,4BAAC,SAAI,WAAU,kCAAiC,eAAY,QAAQ,wBAAc,IAAI,CAAC,OAAO,MAAM,oBAAC,UAAK,WAAU,6CAAqD,mBAAJ,CAAU,CAAO,GAAE;AAAA,QAAM,oBAAC,SAAI,WAAU,cAAc,gBAAM,IAAI,CAAC,SAAS,oBAAC,SAAI,WAAU,iBAAoC,eAAK,IAAI,CAAC,SAAS;AAAE,gBAAM,QAAQ,KAAK,UAAU,UAAU,KAAK,OAAO,IAAI,IAAI;AAAG,iBAAO,oBAAC,UAAK,eAAY,QAAO,OAAO,KAAK,UAAU,GAAG,KAAK,IAAI,KAAK,KAAK,KAAK,mBAAmB,QAAW,WAAW,GAAG,mEAAmE,KAAK,UAAU,WAAW,OAAO,OAAO,IAAI,kBAAkB,GAAoB,eAAK,UAAU,YAAY,OAAO,QAAQ,IAAK,SAAS,CAAC,KAAK,UAA1E,KAAK,IAA0E;AAAA,QAAS,CAAC,KAAjc,KAAK,CAAC,EAAE,IAA2b,CAAM,GAAE;AAAA,SAAM;AAAA,OAClwB,GACF;AAAA,IACC,SAAS,oBAAC,SAAI,WAAU,oBAAmB,8BAAC,UAAO,QAAQ,UAAU,SAAkB,GAAE,IAAS;AAAA,KACrG;AACF,CAAC;","names":["ActivityGrid"]}
1
+ {"version":3,"sources":["../../../../src/components/docs/figures/ActivityGrid.tsx"],"sourcesContent":["/**\n * Adapted from mdxcn by Keshav Bagaade, MIT licensed.\n * Source: https://github.com/keshav-exe/mdxcn/blob/2928126ba146ebbae9c2351deca27d27bb40e744/registry/default/graph-activity/graph-activity.tsx\n * The local port removes motion and graph variables in favour of deterministic\n * rendering and the design system's semantic token classes.\n */\n\nimport * as React from 'react';\nimport { cn } from '../../../lib/recipe';\nimport type { FigurePalette, Glyphs } from './FigureFrame';\n\nconst DAY_MS = 86_400_000;\nconst MAX_DAYS = 3660;\nconst MONTHS = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'] as const;\nconst DEFAULT_GLYPHS = ['·', '░', '▒', '▓', '█'];\n\nfunction glyphsOf(glyphs?: Glyphs): readonly string[] {\n if (Array.isArray(glyphs)) return glyphs.length ? glyphs : DEFAULT_GLYPHS;\n if (glyphs === 'ascii') return ['.', '-', '=', '#', '@'];\n if (glyphs === 'hash') return ['.', ':', '+', '#', '█'];\n if (glyphs === 'bar') return ['▁', '▂', '▃', '▅', '█'];\n return DEFAULT_GLYPHS;\n}\nfunction intensity(level: number, max: number): number { return level <= 0 || max <= 0 ? 0 : Math.max(1, Math.round(Math.min(1, level / max) * 4)); }\nfunction colorClass(level: number, palette: FigurePalette = 'mono'): string {\n if (!level) return 'text-content-muted';\n if (palette === 'mono') return level <= 2 ? 'text-content-secondary' : 'text-content-primary';\n return level === 1 ? 'text-accent-secondary' : level === 2 && palette === 'multi' ? 'text-accent-tertiary' : 'text-accent-primary';\n}\nfunction renderGlyph(level: number, glyphs: readonly string[]): string { return glyphs[Math.round(Math.max(0, Math.min(4, level)) / 4 * (glyphs.length - 1))] ?? glyphs[0] ?? '·'; }\n\nexport interface ActivityDay {\n /** Calendar date in ISO `YYYY-MM-DD` form, interpreted in UTC. */\n date: string;\n /** Non-negative activity count for the date. */\n count: number;\n}\n\nexport interface ActivityGridProps extends React.HTMLAttributes<HTMLElement> {\n /** Dated counts used to derive the contribution grid. */\n data: ActivityDay[];\n /** First weekday in each column: Sunday (0) or Monday (1). */\n weekStartsOn?: 0 | 1;\n /** Optional upper bound for intensity scaling. */\n max?: number;\n /** Render the less/more glyph legend. */\n legend?: boolean;\n /** Glyph set name or custom glyph sequence. */\n glyphs?: Glyphs;\n /** Accent palette used for intensity levels. */\n palette?: FigurePalette;\n /** Additional classes for the renderer root. */\n className?: string;\n}\n\ninterface Cell { date: string; count: number; inRange: boolean }\n\nfunction parseDate(value: string): number | null {\n const match = /^(\\d{4})-(\\d{2})-(\\d{2})$/.exec(value);\n if (!match) return null;\n const [, y, m, d] = match;\n const date = new Date(0);\n date.setUTCHours(0, 0, 0, 0);\n date.setUTCFullYear(Number(y), Number(m) - 1, Number(d));\n return date.getUTCFullYear() === Number(y) && date.getUTCMonth() === Number(m) - 1 && date.getUTCDate() === Number(d) ? date.getTime() : null;\n}\n\nfunction iso(time: number): string { return new Date(time).toISOString().slice(0, 10); }\n\nfunction dailyCounts(data: ActivityDay[]): ActivityDay[] {\n const counts = new Map<string, number>();\n for (const item of data) {\n if (parseDate(item.date) === null) continue;\n const count = Number.isFinite(item.count) ? Math.max(0, item.count) : 0;\n counts.set(item.date, (counts.get(item.date) ?? 0) + count);\n }\n return Array.from(counts, ([date, count]) => ({ date, count }));\n}\n\nfunction makeWeeks(data: ActivityDay[], weekStartsOn: 0 | 1): Cell[][] {\n const valid = data.map((item) => ({ item, time: parseDate(item.date) })).filter((entry): entry is { item: ActivityDay; time: number } => entry.time !== null);\n if (!valid.length) return [];\n const min = valid.reduce((earliest, entry) => Math.min(earliest, entry.time), Infinity);\n const max = valid.reduce((latest, entry) => Math.max(latest, entry.time), -Infinity);\n const span = Math.floor((max - min) / DAY_MS) + 1;\n if (span > MAX_DAYS) return [];\n const first = min - ((new Date(min).getUTCDay() - weekStartsOn + 7) % 7) * DAY_MS;\n const last = max + ((weekStartsOn + 6 - new Date(max).getUTCDay() + 7) % 7) * DAY_MS;\n const counts = new Map(valid.map(({ item }) => [item.date, Math.max(0, Number.isFinite(item.count) ? item.count : 0)]));\n const weeks: Cell[][] = [];\n for (let time = first; time <= last; time += 7 * DAY_MS) {\n weeks.push(Array.from({ length: 7 }, (_, offset) => {\n const dateTime = time + offset * DAY_MS;\n const date = iso(dateTime);\n const inRange = dateTime >= min && dateTime <= max;\n return { date, count: inRange ? counts.get(date) ?? 0 : 0, inRange };\n }));\n }\n return weeks;\n}\n\nfunction Legend({ glyphs, palette }: { glyphs: readonly string[]; palette?: FigurePalette }) {\n return <p className=\"flex items-center gap-2 text-content-muted\"><span>Less</span><span aria-hidden=\"true\" className=\"flex select-none\">{glyphs.map((glyph, index) => <span className={cn('w-[1ch] text-center', colorClass(Math.round(index / Math.max(glyphs.length - 1, 1) * 4), palette))} key={`${glyph}-${index}`}>{glyph}</span>)}</span><span>More</span></p>;\n}\n\n/** Renders dated counts as a bounded, UTC-stable contribution grid. */\nexport const ActivityGrid = React.forwardRef<HTMLElement, ActivityGridProps>(function ActivityGrid({ data, weekStartsOn = 0, max, legend = true, glyphs, palette, className, ...rest }, ref) {\n const valid = dailyCounts(data);\n const weeks = makeWeeks(valid, weekStartsOn);\n const total = valid.reduce((sum, item) => sum + item.count, 0);\n const summary = `${total.toLocaleString('en-US')} contributions across ${valid.length} dates`;\n const glyphSet = glyphsOf(glyphs);\n const peak = max == null ? valid.reduce((largest, item) => Math.max(largest, item.count), 0) : Math.max(0, max);\n const weekdayLabels = weekStartsOn === 1 ? ['Mon', '', 'Wed', '', 'Fri', '', ''] : ['', 'Tue', '', 'Thu', '', 'Sat', ''];\n\n if (!valid.length || !weeks.length) return <section data-slot=\"activity-grid\" ref={ref} aria-label=\"Activity grid\" {...rest} className={cn('font-mono text-sm text-content-primary', className)}><p className=\"text-content-muted\">{valid.length ? 'Date range is too large to display.' : 'No activity dates to display.'}</p><p className=\"sr-only\">{summary}</p></section>;\n\n return <section data-slot=\"activity-grid\" ref={ref} aria-label=\"Activity grid\" {...rest} className={cn('flex w-fit max-w-full min-w-0 flex-col gap-3 font-mono text-sm text-content-primary', className)}>\n <p className=\"sr-only\">{summary}, from {valid.reduce((a, b) => a.date < b.date ? a : b).date} to {valid.reduce((a, b) => a.date > b.date ? a : b).date}.</p>\n <div className=\"overflow-x-auto\" role=\"img\" aria-label={summary}>\n <div className=\"min-w-max\">\n <div className=\"flex pl-[4ch]\" aria-hidden=\"true\">{weeks.map((week, i) => { const firstOfMonth = week.find((cell) => cell.inRange && cell.date.slice(-2) === '01'); return <span className=\"w-[2ch] shrink-0 text-content-muted\" key={i}>{firstOfMonth ? MONTHS[Number(firstOfMonth.date.slice(5, 7)) - 1] : ''}</span>; })}</div>\n <div className=\"flex gap-1\"><div className=\"flex w-[3ch] shrink-0 flex-col\" aria-hidden=\"true\">{weekdayLabels.map((label, i) => <span className=\"h-[1.2em] text-[0.7em] text-content-muted\" key={i}>{label}</span>)}</div><div className=\"flex gap-1\">{weeks.map((week) => <div className=\"flex flex-col\" key={week[0].date}>{week.map((cell) => { const level = cell.inRange ? intensity(cell.count, peak) : 0; return <span aria-hidden=\"true\" title={cell.inRange ? `${cell.date}: ${cell.count} contributions` : undefined} className={cn('flex h-[1.2em] w-[2ch] items-center justify-center leading-none', cell.inRange ? colorClass(level, palette) : 'text-transparent')} key={cell.date}>{cell.inRange ? renderGlyph(level, glyphSet) : (glyphSet[0] ?? '·')}</span>; })}</div>)}</div></div>\n </div>\n </div>\n {legend ? <div className=\"flex justify-end\"><Legend glyphs={glyphSet} palette={palette} /></div> : null}\n </section>;\n});\n"],"mappings":";AAOA,YAAY,WAAW;AACvB,SAAS,UAAU;AA8FV,SAA0D,KAA1D;AA3FT,IAAM,SAAS;AACf,IAAM,WAAW;AACjB,IAAM,SAAS,CAAC,OAAO,OAAO,OAAO,OAAO,OAAO,OAAO,OAAO,OAAO,OAAO,OAAO,OAAO,KAAK;AAClG,IAAM,iBAAiB,CAAC,QAAK,UAAK,UAAK,UAAK,QAAG;AAE/C,SAAS,SAAS,QAAoC;AACpD,MAAI,MAAM,QAAQ,MAAM,EAAG,QAAO,OAAO,SAAS,SAAS;AAC3D,MAAI,WAAW,QAAS,QAAO,CAAC,KAAK,KAAK,KAAK,KAAK,GAAG;AACvD,MAAI,WAAW,OAAQ,QAAO,CAAC,KAAK,KAAK,KAAK,KAAK,QAAG;AACtD,MAAI,WAAW,MAAO,QAAO,CAAC,UAAK,UAAK,UAAK,UAAK,QAAG;AACrD,SAAO;AACT;AACA,SAAS,UAAU,OAAe,KAAqB;AAAE,SAAO,SAAS,KAAK,OAAO,IAAI,IAAI,K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AAc,gBAAM,IAAI,CAAC,SAAS,oBAAC,SAAI,WAAU,iBAAoC,eAAK,IAAI,CAAC,SAAS;AAAE,gBAAM,QAAQ,KAAK,UAAU,UAAU,KAAK,OAAO,IAAI,IAAI;AAAG,iBAAO,oBAAC,UAAK,eAAY,QAAO,OAAO,KAAK,UAAU,GAAG,KAAK,IAAI,KAAK,KAAK,KAAK,mBAAmB,QAAW,WAAW,GAAG,mEAAmE,KAAK,UAAU,WAAW,OAAO,OAAO,IAAI,kBAAkB,GAAoB,eAAK,UAAU,YAAY,OAAO,QAAQ,IAAK,SAAS,CAAC,KAAK,UAA1E,KAAK,IAA0E;AAAA,QAAS,CAAC,KAAjc,KAAK,CAAC,EAAE,IAA2b,CAAM,GAAE;AAAA,SAAM;AAAA,OAClwB,GACF;AAAA,IACC,SAAS,oBAAC,SAAI,WAAU,oBAAmB,8BAAC,UAAO,QAAQ,UAAU,SAAkB,GAAE,IAAS;AAAA,KACrG;AACF,CAAC;","names":["ActivityGrid"]}
@@ -12,6 +12,7 @@ import {
12
12
  textOf
13
13
  } from "./FigureFrame.js";
14
14
  import { cn } from "../../../lib/recipe.js";
15
+ import { deltaSignificance, deltaTrend, trendTone } from "../../review/DeltaValue.js";
15
16
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
16
17
  var Line = defineAsciiItem("Line");
17
18
  function signOf(value) {
@@ -19,52 +20,94 @@ function signOf(value) {
19
20
  if (/^[−-]/.test(value.trim())) return "remove";
20
21
  return void 0;
21
22
  }
23
+ function relativeOf(text) {
24
+ const match = /\s*\(([+−-]?\d+(?:\.\d+)?)\s*%\)\s*$/.exec(text);
25
+ if (!match) return { text };
26
+ return { text: text.slice(0, match.index), relative: Number(match[1].replace("\u2212", "-")) / 100 };
27
+ }
22
28
  function diffFromList(children) {
23
29
  return listItems(children).map((item) => {
24
- const { label, rest } = splitLabel(itemText(item));
30
+ const { label, rest: raw } = splitLabel(itemText(item));
31
+ const { text: rest, relative } = relativeOf(raw);
25
32
  const content = item.props.children;
26
33
  return {
27
34
  label,
28
35
  value: rest.replace(/^[+−-]\s*/, "") || rest,
29
- sign: signOf(rest),
36
+ sign: signOf(rest) ?? (relative ? relative > 0 ? "add" : "remove" : void 0),
37
+ relative,
30
38
  total: hasHost(content, ["strong", "b"])
31
39
  };
32
40
  });
33
41
  }
34
- function signClass(sign) {
35
- if (sign === "add") return "text-delta-added";
36
- if (sign === "remove") return "text-delta-removed";
37
- return "text-content-primary";
38
- }
39
42
  function lineText(row) {
40
43
  return `${row.label ?? ""} ${row.value}`.trim();
41
44
  }
42
- var ChangeSummary = React.forwardRef(function ChangeSummary2({ label = "Change summary", rows: rowsProp, footer: footerProp, children, palette: _palette, className, ...rest }, ref) {
45
+ function percent(relative) {
46
+ const value = Math.abs(relative * 100);
47
+ return `${relative > 0 ? "+" : relative < 0 ? "\u2212" : ""}${value < 10 ? Number(value.toFixed(1)) : Math.round(value)}%`;
48
+ }
49
+ var GRID = "grid grid-cols-[1.25rem_minmax(0,1fr)_auto] items-baseline gap-x-3";
50
+ function judge(row, direction, bands) {
51
+ const sign = row.sign ?? (row.relative ? row.relative > 0 ? "add" : "remove" : "keep");
52
+ const change = sign === "add" ? 1 : sign === "remove" ? -1 : 0;
53
+ return { row, sign, trend: deltaTrend(change, row.direction ?? direction), size: change === 0 ? "noise" : deltaSignificance(row.relative, bands) };
54
+ }
55
+ function Row({ judged, scale, total = false }) {
56
+ const { row, sign, trend, size } = judged;
57
+ const directed = trend != null;
58
+ const tone = directed ? trendTone(trend, size) : sign === "add" ? "text-delta-added" : sign === "remove" ? "text-delta-removed" : "text-content-primary";
59
+ const mark = sign === "keep" ? " " : directed ? sign === "add" ? "\u25B2" : "\u25BC" : sign === "add" ? "+" : "-";
60
+ const heavy = directed && size === "major";
61
+ const bar = !total && row.relative != null && sign !== "keep" ? Math.max(0.04, Math.min(1, Math.abs(row.relative) / scale)) : 0;
62
+ const verdict = directed ? size === "noise" ? "within noise" : trend === "against" ? "worse" : "better" : sign;
63
+ return /* @__PURE__ */ jsxs(
64
+ "li",
65
+ {
66
+ className: cn(GRID, "gap-y-1", heavy && "-ml-2 border-l-4 pl-1", heavy && (trend === "against" ? "border-intent-danger" : "border-intent-success")),
67
+ "data-trend": trend,
68
+ "data-significance": directed ? size : void 0,
69
+ "aria-label": `${total ? "total" : verdict}: ${lineText(row)}${row.relative != null ? ` (${percent(row.relative)})` : ""}`,
70
+ children: [
71
+ /* @__PURE__ */ jsx("span", { "aria-hidden": "true", className: cn("select-none text-center text-xs", sign === "keep" ? "text-content-muted" : tone), children: mark }),
72
+ /* @__PURE__ */ jsx("span", { className: cn(directed ? "text-content-primary" : tone, heavy && "font-bold", directed && size === "noise" && "text-content-secondary"), children: row.label }),
73
+ /* @__PURE__ */ jsxs("span", { className: "flex items-baseline justify-end gap-2 whitespace-nowrap tabular-nums", children: [
74
+ /* @__PURE__ */ jsx("span", { className: cn(tone, heavy && "text-lg font-bold"), children: row.value }),
75
+ row.relative != null ? /* @__PURE__ */ jsx("span", { className: cn("text-xs", directed && size !== "noise" ? tone : "text-content-muted"), children: percent(row.relative) }) : null
76
+ ] }),
77
+ bar > 0 ? /* @__PURE__ */ jsxs("svg", { "aria-hidden": "true", viewBox: "0 0 100 1", preserveAspectRatio: "none", className: "col-start-2 col-end-4 block h-1.5 w-full fill-surface-sunken", children: [
78
+ /* @__PURE__ */ jsx("rect", { width: "100", height: "1" }),
79
+ /* @__PURE__ */ jsx("rect", { width: bar * 100, height: "1", className: directed ? size === "noise" ? "fill-content-muted" : trend === "against" ? "fill-intent-danger" : "fill-intent-success" : sign === "add" ? "fill-delta-added" : "fill-delta-removed" })
80
+ ] }) : null
81
+ ]
82
+ }
83
+ );
84
+ }
85
+ var ChangeSummary = React.forwardRef(function ChangeSummary2({ label = "Change summary", rows: rowsProp, footer: footerProp, direction, significance, children, palette: _palette, className, ...rest }, ref) {
43
86
  const listed = diffFromList(children);
44
87
  const tagged = childItems(children, Line).map((entry) => ({ ...entry, label: entry.label ?? textOf(entry.children) }));
45
88
  const lines = listed.length > 0 ? listed : tagged;
46
- const rows = (rowsProp ?? lines.filter((entry) => !entry.total)).map((entry) => ({ ...entry, label: entry.label ?? "" }));
89
+ const rows = (rowsProp ?? lines.filter((entry) => !entry.total)).map((entry) => judge({ ...entry, label: entry.label ?? "" }, direction, significance));
47
90
  const footerLine = footerProp ?? lines.find((entry) => entry.total);
48
- const footer = footerLine ? { ...footerLine, label: footerLine.label ?? "" } : void 0;
91
+ const footer = footerLine ? judge({ ...footerLine, label: footerLine.label ?? "" }, direction, significance) : void 0;
92
+ const scale = Math.max(1e-9, ...rows.map((r) => Math.abs(r.row.relative ?? 0)));
93
+ const directed = rows.filter((r) => r.trend != null);
94
+ const tally = [
95
+ { word: "worse", count: directed.filter((r) => r.size !== "noise" && r.trend === "against").length, tone: "text-intent-danger" },
96
+ { word: "better", count: directed.filter((r) => r.size !== "noise" && r.trend === "with").length, tone: "text-intent-success" },
97
+ { word: "within noise", count: directed.filter((r) => r.size === "noise").length, tone: "text-content-secondary" }
98
+ ].filter((t) => t.count > 0);
49
99
  return /* @__PURE__ */ jsxs(AsciiFrameBody, { "data-slot": "change-summary", ref, ...rest, className: cn("flex flex-col gap-3", className), children: [
50
- /* @__PURE__ */ jsx("ul", { className: "flex flex-col gap-2", "aria-label": label, children: rows.map((row, index) => {
51
- const sign = row.sign ?? "keep";
52
- const tone = signClass(sign);
53
- return /* @__PURE__ */ jsxs("li", { className: "grid grid-cols-[1.25rem_minmax(0,1fr)_8ch] items-baseline gap-x-3", "aria-label": `${sign}: ${lineText(row)}`, children: [
54
- /* @__PURE__ */ jsx("span", { "aria-hidden": "true", className: cn("select-none text-center", sign === "keep" ? "text-content-muted" : tone), children: sign === "keep" ? " " : sign === "add" ? "+" : "-" }),
55
- /* @__PURE__ */ jsx("span", { className: tone, children: row.label }),
56
- /* @__PURE__ */ jsx("span", { className: cn("text-right tabular-nums", tone), children: row.value })
57
- ] }, `${lineText(row)}-${index}`);
58
- }) }),
100
+ tally.length > 0 ? /* @__PURE__ */ jsx("p", { "data-slot": "change-summary-tally", className: "m-0 flex flex-wrap gap-x-4 gap-y-1 text-xs font-bold uppercase tracking-wider", children: tally.map((t) => /* @__PURE__ */ jsxs("span", { className: t.tone, children: [
101
+ /* @__PURE__ */ jsx("span", { className: "text-base tabular-nums", children: t.count }),
102
+ " ",
103
+ t.word
104
+ ] }, t.word)) }) : null,
105
+ /* @__PURE__ */ jsx("ul", { className: "flex flex-col gap-2.5", "aria-label": label, children: rows.map((judged, index) => /* @__PURE__ */ jsx(Row, { judged, scale }, `${lineText(judged.row)}-${index}`)) }),
59
106
  footer ? /* @__PURE__ */ jsxs(Fragment, { children: [
60
107
  /* @__PURE__ */ jsx(AsciiFrameRule, {}),
61
- /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-[1.25rem_minmax(0,1fr)_8ch] items-baseline gap-x-3", "aria-label": `total: ${lineText(footer)}`, children: [
62
- /* @__PURE__ */ jsx("span", { "aria-hidden": "true", className: "text-content-muted", children: " " }),
63
- /* @__PURE__ */ jsx("span", { className: "text-content-primary", children: footer.label }),
64
- /* @__PURE__ */ jsx("span", { className: "text-right tabular-nums text-content-primary", children: footer.value })
65
- ] })
108
+ /* @__PURE__ */ jsx("ul", { className: "flex flex-col", children: /* @__PURE__ */ jsx(Row, { judged: footer, scale, total: true }) })
66
109
  ] }) : null,
67
- /* @__PURE__ */ jsx("span", { className: "sr-only", children: rows.length === 0 && !footer ? "Empty diff." : `${rows.length} changed row${rows.length === 1 ? "" : "s"}${footer ? `, total ${lineText(footer)}` : ""}.` })
110
+ /* @__PURE__ */ jsx("span", { className: "sr-only", children: rows.length === 0 && !footer ? "Empty diff." : `${rows.length} changed row${rows.length === 1 ? "" : "s"}${footer ? `, total ${lineText(footer.row)}` : ""}.` })
68
111
  ] });
69
112
  });
70
113
  export {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/docs/figures/ChangeSummary.tsx"],"sourcesContent":["/**\n * Adapted from mdxcn by Keshav Bagaade, MIT licensed.\n * Source: https://github.com/keshav-exe/mdxcn/blob/2928126ba146ebbae9c2351deca27d27bb40e744/registry/default/graph-diff/graph-diff.tsx\n * The local port removes motion and graph variables while retaining the\n * source component's Markdown and `<Line>` data forms.\n */\n\nimport type { ReactNode } from 'react';\nimport * as React from 'react';\nimport {\n childItems,\n defineAsciiItem,\n AsciiFrameBody,\n AsciiFrameRule,\n hasHost,\n itemText,\n listItems,\n splitLabel,\n textOf,\n type FigurePalette,\n} from './FigureFrame';\nimport { cn } from '../../../lib/recipe';\n\nexport type DiffSign = 'add' | 'remove' | 'keep';\n\nexport interface DiffRow {\n /** Falls back to the child text for `<Line value=\"31 kb\">app</Line>`. */\n label?: string;\n value: string;\n sign?: DiffSign;\n}\n\nexport interface DiffLineProps extends DiffRow {\n /** Draw the row under a rule as the total. */\n total?: boolean;\n}\n\nexport interface ChangeSummaryProps extends React.HTMLAttributes<HTMLDivElement> {\n /** Accessible name; the enclosing FigureFrame owns the caption. */\n label?: string;\n /** Data form. If omitted, the component reads Markdown or `<Line>` children. */\n rows?: DiffRow[];\n /** Optional typed total shown below the row rule. */\n footer?: DiffRow;\n /** Markdown list or `<Line>` content used to derive rows. */\n children?: ReactNode;\n /**\n * Accepted for symmetry with the other figures and ignored: additions and removals take the\n * `delta` roles, so a summary reads the same in a `multi` figure as in a `mono` one.\n */\n palette?: FigurePalette;\n /** Additional classes for this summary. */\n className?: string;\n}\n\n/** MDX-only diff item, for example `<Line sign=\"add\" value=\"31 kb\">app</Line>`. */\nexport const Line = defineAsciiItem<DiffLineProps>('Line');\n\nfunction signOf(value: string): DiffSign | undefined {\n if (/^\\+/.test(value.trim())) return 'add';\n if (/^[−-]/.test(value.trim())) return 'remove';\n return undefined;\n}\n\nfunction diffFromList(children: ReactNode): DiffLineProps[] {\n return listItems(children).map((item) => {\n const { label, rest } = splitLabel(itemText(item));\n const content = (item.props as { children?: ReactNode }).children;\n return {\n label,\n value: rest.replace(/^[+−-]\\s*/, '') || rest,\n sign: signOf(rest),\n total: hasHost(content, ['strong', 'b']),\n };\n });\n}\n\n/** Signs are change, so they take the `delta` roles whatever palette the surrounding figures use. */\nfunction signClass(sign: DiffSign): string {\n if (sign === 'add') return 'text-delta-added';\n if (sign === 'remove') return 'text-delta-removed';\n return 'text-content-primary';\n}\n\nfunction lineText(row: DiffRow): string {\n return `${row.label ?? ''} ${row.value}`.trim();\n}\n\n/** Renders additions, removals, and unchanged rows with a readable text summary. */\nexport const ChangeSummary = React.forwardRef<HTMLDivElement, ChangeSummaryProps>(function ChangeSummary({ label = 'Change summary', rows: rowsProp, footer: footerProp, children, palette: _palette, className, ...rest }, ref) {\n const listed = diffFromList(children);\n const tagged = childItems(children, Line).map((entry) => ({ ...entry, label: entry.label ?? textOf(entry.children) }));\n const lines = listed.length > 0 ? listed : tagged;\n const rows = (rowsProp ?? lines.filter((entry) => !entry.total)).map((entry) => ({ ...entry, label: entry.label ?? '' }));\n const footerLine = footerProp ?? lines.find((entry) => entry.total);\n const footer = footerLine ? { ...footerLine, label: footerLine.label ?? '' } : undefined;\n\n return (\n <AsciiFrameBody data-slot=\"change-summary\" ref={ref} {...rest} className={cn('flex flex-col gap-3', className)}>\n <ul className=\"flex flex-col gap-2\" aria-label={label}>\n {rows.map((row, index) => {\n const sign = row.sign ?? 'keep';\n const tone = signClass(sign);\n return (\n <li className=\"grid grid-cols-[1.25rem_minmax(0,1fr)_8ch] items-baseline gap-x-3\" key={`${lineText(row)}-${index}`} aria-label={`${sign}: ${lineText(row)}`}>\n <span aria-hidden=\"true\" className={cn('select-none text-center', sign === 'keep' ? 'text-content-muted' : tone)}>{sign === 'keep' ? ' ' : sign === 'add' ? '+' : '-'}</span>\n <span className={tone}>{row.label}</span>\n <span className={cn('text-right tabular-nums', tone)}>{row.value}</span>\n </li>\n );\n })}\n </ul>\n {footer ? <><AsciiFrameRule /><div className=\"grid grid-cols-[1.25rem_minmax(0,1fr)_8ch] items-baseline gap-x-3\" aria-label={`total: ${lineText(footer)}`}><span aria-hidden=\"true\" className=\"text-content-muted\"> </span><span className=\"text-content-primary\">{footer.label}</span><span className=\"text-right tabular-nums text-content-primary\">{footer.value}</span></div></> : null}\n <span className=\"sr-only\">{rows.length === 0 && !footer ? 'Empty diff.' : `${rows.length} changed row${rows.length === 1 ? '' : 's'}${footer ? `, total ${lineText(footer)}` : ''}.`}</span>\n </AsciiFrameBody>\n );\n});\n"],"mappings":";AAQA,YAAY,WAAW;AACvB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAEK;AACP,SAAS,UAAU;AAmFL,SAQI,UAPF,KADF;AAhDP,IAAM,OAAO,gBAA+B,MAAM;AAEzD,SAAS,OAAO,OAAqC;AACnD,MAAI,MAAM,KAAK,MAAM,KAAK,CAAC,EAAG,QAAO;AACrC,MAAI,QAAQ,KAAK,MAAM,KAAK,CAAC,EAAG,QAAO;AACvC,SAAO;AACT;AAEA,SAAS,aAAa,UAAsC;AAC1D,SAAO,UAAU,QAAQ,EAAE,IAAI,CAAC,SAAS;AACvC,UAAM,EAAE,OAAO,KAAK,IAAI,WAAW,SAAS,IAAI,CAAC;AACjD,UAAM,UAAW,KAAK,MAAmC;AACzD,WAAO;AAAA,MACL;AAAA,MACA,OAAO,KAAK,QAAQ,aAAa,EAAE,KAAK;AAAA,MACxC,MAAM,OAAO,IAAI;AAAA,MACjB,OAAO,QAAQ,SAAS,CAAC,UAAU,GAAG,CAAC;AAAA,IACzC;AAAA,EACF,CAAC;AACH;AAGA,SAAS,UAAU,MAAwB;AACzC,MAAI,SAAS,MAAO,QAAO;AAC3B,MAAI,SAAS,SAAU,QAAO;AAC9B,SAAO;AACT;AAEA,SAAS,SAAS,KAAsB;AACtC,SAAO,GAAG,IAAI,SAAS,EAAE,IAAI,IAAI,KAAK,GAAG,KAAK;AAChD;AAGO,IAAM,gBAAsB,iBAA+C,SAASA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,IACC,SAAS,iCAAE;AAAA,0BAAC,kBAAe;AAAA,MAAE,qBAAC,SAAI,WAAU,qEAAoE,cAAY,UAAU,SAAS,MAAM,CAAC,IAAI;AAAA,4BAAC,UAAK,eAAY,QAAO,WAAU,sBAAqB,eAAC;AAAA,QAAO,oBAAC,UAAK,WAAU,wBAAwB,iBAAO,OAAM;AAAA,QAAO,oBAAC,UAAK,WAAU,gDAAgD,iBAAO,OAAM;AAAA,SAAO;AAAA,OAAM,IAAM;AAAA,IACvX,oBAAC,UAAK,WAAU,WAAW,eAAK,WAAW,KAAK,CAAC,SAAS,gBAAgB,GAAG,KAAK,MAAM,eAAe,KAAK,WAAW,IAAI,KAAK,GAAG,GAAG,SAAS,WAAW,SAAS,MAAM,CAAC,KAAK,EAAE,KAAI;AAAA,KACvL;AAEN,CAAC;","names":["ChangeSummary"]}
1
+ {"version":3,"sources":["../../../../src/components/docs/figures/ChangeSummary.tsx"],"sourcesContent":["/**\n * Adapted from mdxcn by Keshav Bagaade, MIT licensed.\n * Source: https://github.com/keshav-exe/mdxcn/blob/2928126ba146ebbae9c2351deca27d27bb40e744/registry/default/graph-diff/graph-diff.tsx\n * The local port removes motion and graph variables while retaining the\n * source component's Markdown and `<Line>` data forms.\n */\n\nimport type { ReactNode } from 'react';\nimport * as React from 'react';\nimport {\n childItems,\n defineAsciiItem,\n AsciiFrameBody,\n AsciiFrameRule,\n hasHost,\n itemText,\n listItems,\n splitLabel,\n textOf,\n type FigurePalette,\n} from './FigureFrame';\nimport { cn } from '../../../lib/recipe';\nimport { deltaSignificance, deltaTrend, trendTone, type DeltaSignificance, type MetricDirection } from '../../review/DeltaValue';\n\nexport type DiffSign = 'add' | 'remove' | 'keep';\n\nexport interface DiffRow {\n /** Falls back to the child text for `<Line value=\"31 kb\">app</Line>`. */\n label?: string;\n value: string;\n sign?: DiffSign;\n /** The change relative to its baseline, as a signed fraction: `0.18` for +18%. Sizes the row's bar and decides whether it is noise. */\n relative?: number;\n /** Which way this row is preferred to move, overriding the summary's `direction`. */\n direction?: MetricDirection;\n}\n\nexport interface DiffLineProps extends DiffRow {\n /** Draw the row under a rule as the total. */\n total?: boolean;\n}\n\nexport interface ChangeSummaryProps extends React.HTMLAttributes<HTMLDivElement> {\n /** Accessible name; the enclosing FigureFrame owns the caption. */\n label?: string;\n /** Data form. If omitted, the component reads Markdown or `<Line>` children. */\n rows?: DiffRow[];\n /** Optional typed total shown below the row rule. */\n footer?: DiffRow;\n /**\n * Which way the rows are preferred to move. Given one, a row reads as better (success) or worse\n * (danger) instead of as an addition or removal, and a tally of each leads the summary.\n */\n direction?: MetricDirection;\n /** Relative-change bands. Rows under `noise` are drawn quiet; rows at or over `major` heavy. */\n significance?: DeltaSignificance;\n /** Markdown list or `<Line>` content used to derive rows. */\n children?: ReactNode;\n /**\n * Accepted for symmetry with the other figures and ignored: additions and removals take the\n * `delta` roles, so a summary reads the same in a `multi` figure as in a `mono` one.\n */\n palette?: FigurePalette;\n /** Additional classes for this summary. */\n className?: string;\n}\n\n/** MDX-only diff item, for example `<Line sign=\"add\" value=\"31 kb\">app</Line>`. */\nexport const Line = defineAsciiItem<DiffLineProps>('Line');\n\nfunction signOf(value: string): DiffSign | undefined {\n if (/^\\+/.test(value.trim())) return 'add';\n if (/^[−-]/.test(value.trim())) return 'remove';\n return undefined;\n}\n\n/** A trailing `(+18%)` on a Markdown row is its relative change. */\nfunction relativeOf(text: string): { text: string; relative?: number } {\n const match = /\\s*\\(([+−-]?\\d+(?:\\.\\d+)?)\\s*%\\)\\s*$/.exec(text);\n if (!match) return { text };\n return { text: text.slice(0, match.index), relative: Number(match[1]!.replace('−', '-')) / 100 };\n}\n\nfunction diffFromList(children: ReactNode): DiffLineProps[] {\n return listItems(children).map((item) => {\n const { label, rest: raw } = splitLabel(itemText(item));\n const { text: rest, relative } = relativeOf(raw);\n const content = (item.props as { children?: ReactNode }).children;\n return {\n label,\n value: rest.replace(/^[+−-]\\s*/, '') || rest,\n sign: signOf(rest) ?? (relative ? (relative > 0 ? 'add' : 'remove') : undefined),\n relative,\n total: hasHost(content, ['strong', 'b']),\n };\n });\n}\n\nfunction lineText(row: DiffRow): string {\n return `${row.label ?? ''} ${row.value}`.trim();\n}\n\nfunction percent(relative: number): string {\n const value = Math.abs(relative * 100);\n return `${relative > 0 ? '+' : relative < 0 ? '−' : ''}${value < 10 ? Number(value.toFixed(1)) : Math.round(value)}%`;\n}\n\nconst GRID = 'grid grid-cols-[1.25rem_minmax(0,1fr)_auto] items-baseline gap-x-3';\n\ninterface Judged {\n row: DiffRow & { label: string };\n sign: DiffSign;\n trend: 'against' | 'with' | undefined;\n size: 'noise' | 'notable' | 'major';\n}\n\nfunction judge(row: DiffRow & { label: string }, direction: MetricDirection | undefined, bands: DeltaSignificance | undefined): Judged {\n // A typed row with a relative move but no sign takes its sign from the move, as a Markdown row does.\n const sign = row.sign ?? (row.relative ? (row.relative > 0 ? 'add' : 'remove') : 'keep');\n const change = sign === 'add' ? 1 : sign === 'remove' ? -1 : 0;\n return { row, sign, trend: deltaTrend(change, row.direction ?? direction), size: change === 0 ? 'noise' : deltaSignificance(row.relative, bands) };\n}\n\nfunction Row({ judged, scale, total = false }: { judged: Judged; scale: number; total?: boolean }) {\n const { row, sign, trend, size } = judged;\n const directed = trend != null;\n // Undirected change keeps the `delta` roles: it is an addition or a removal, not better or worse.\n const tone = directed ? trendTone(trend, size) : sign === 'add' ? 'text-delta-added' : sign === 'remove' ? 'text-delta-removed' : 'text-content-primary';\n const mark = sign === 'keep' ? ' ' : directed ? (sign === 'add' ? '▲' : '▼') : sign === 'add' ? '+' : '-';\n const heavy = directed && size === 'major';\n const bar = !total && row.relative != null && sign !== 'keep' ? Math.max(0.04, Math.min(1, Math.abs(row.relative) / scale)) : 0;\n const verdict = directed ? (size === 'noise' ? 'within noise' : trend === 'against' ? 'worse' : 'better') : sign;\n return (\n <li\n className={cn(GRID, 'gap-y-1', heavy && '-ml-2 border-l-4 pl-1', heavy && (trend === 'against' ? 'border-intent-danger' : 'border-intent-success'))}\n data-trend={trend}\n data-significance={directed ? size : undefined}\n aria-label={`${total ? 'total' : verdict}: ${lineText(row)}${row.relative != null ? ` (${percent(row.relative)})` : ''}`}\n >\n <span aria-hidden=\"true\" className={cn('select-none text-center text-xs', sign === 'keep' ? 'text-content-muted' : tone)}>{mark}</span>\n <span className={cn(directed ? 'text-content-primary' : tone, heavy && 'font-bold', directed && size === 'noise' && 'text-content-secondary')}>{row.label}</span>\n <span className=\"flex items-baseline justify-end gap-2 whitespace-nowrap tabular-nums\">\n <span className={cn(tone, heavy && 'text-lg font-bold')}>{row.value}</span>\n {row.relative != null ? <span className={cn('text-xs', directed && size !== 'noise' ? tone : 'text-content-muted')}>{percent(row.relative)}</span> : null}\n </span>\n {bar > 0 ? (\n <svg aria-hidden=\"true\" viewBox=\"0 0 100 1\" preserveAspectRatio=\"none\" className=\"col-start-2 col-end-4 block h-1.5 w-full fill-surface-sunken\">\n <rect width=\"100\" height=\"1\" />\n <rect width={bar * 100} height=\"1\" className={directed ? (size === 'noise' ? 'fill-content-muted' : trend === 'against' ? 'fill-intent-danger' : 'fill-intent-success') : sign === 'add' ? 'fill-delta-added' : 'fill-delta-removed'} />\n </svg>\n ) : null}\n </li>\n );\n}\n\n/**\n * Renders additions, removals, and unchanged rows with a readable text summary.\n *\n * Given a `direction`, rows read as better or worse instead: colour says which way a row moved\n * against what is preferred, and its relative size says how loudly. A move under the noise band\n * stays quiet, a major one is bold with a rule beside it, and a bar under each row shows its\n * relative size against the largest move in the summary.\n */\nexport const ChangeSummary = React.forwardRef<HTMLDivElement, ChangeSummaryProps>(function ChangeSummary({ label = 'Change summary', rows: rowsProp, footer: footerProp, direction, significance, children, palette: _palette, className, ...rest }, ref) {\n const listed = diffFromList(children);\n const tagged = childItems(children, Line).map((entry) => ({ ...entry, label: entry.label ?? textOf(entry.children) }));\n const lines = listed.length > 0 ? listed : tagged;\n const rows = (rowsProp ?? lines.filter((entry) => !entry.total)).map((entry) => judge({ ...entry, label: entry.label ?? '' }, direction, significance));\n const footerLine = footerProp ?? lines.find((entry) => entry.total);\n const footer = footerLine ? judge({ ...footerLine, label: footerLine.label ?? '' }, direction, significance) : undefined;\n const scale = Math.max(1e-9, ...rows.map((r) => Math.abs(r.row.relative ?? 0)));\n const directed = rows.filter((r) => r.trend != null);\n const tally = [\n { word: 'worse', count: directed.filter((r) => r.size !== 'noise' && r.trend === 'against').length, tone: 'text-intent-danger' },\n { word: 'better', count: directed.filter((r) => r.size !== 'noise' && r.trend === 'with').length, tone: 'text-intent-success' },\n { word: 'within noise', count: directed.filter((r) => r.size === 'noise').length, tone: 'text-content-secondary' },\n ].filter((t) => t.count > 0);\n\n return (\n <AsciiFrameBody data-slot=\"change-summary\" ref={ref} {...rest} className={cn('flex flex-col gap-3', className)}>\n {tally.length > 0 ? (\n <p data-slot=\"change-summary-tally\" className=\"m-0 flex flex-wrap gap-x-4 gap-y-1 text-xs font-bold uppercase tracking-wider\">\n {tally.map((t) => (\n <span key={t.word} className={t.tone}>\n <span className=\"text-base tabular-nums\">{t.count}</span> {t.word}\n </span>\n ))}\n </p>\n ) : null}\n <ul className=\"flex flex-col gap-2.5\" aria-label={label}>\n {rows.map((judged, index) => (\n <Row key={`${lineText(judged.row)}-${index}`} judged={judged} scale={scale} />\n ))}\n </ul>\n {footer ? <><AsciiFrameRule /><ul className=\"flex flex-col\"><Row judged={footer} scale={scale} total /></ul></> : null}\n <span className=\"sr-only\">{rows.length === 0 && !footer ? 'Empty diff.' : `${rows.length} changed row${rows.length === 1 ? '' : 's'}${footer ? `, total ${lineText(footer.row)}` : ''}.`}</span>\n </AsciiFrameBody>\n );\n});\n"],"mappings":";AAQA,YAAY,WAAW;AACvB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAEK;AACP,SAAS,UAAU;AACnB,SAAS,mBAAmB,YAAY,iBAA+D;AAqHjG,SAuDY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AAgB,SAApD,GAAG,SAAS,OAAO,GAAG,CAAC,IAAI,KAAK,EAAkC,CAC7E,GACH;AAAA,IACC,SAAS,iCAAE;AAAA,0BAAC,kBAAe;AAAA,MAAE,oBAAC,QAAG,WAAU,iBAAgB,8BAAC,OAAI,QAAQ,QAAQ,OAAc,OAAK,MAAC,GAAE;AAAA,OAAK,IAAM;AAAA,IAClH,oBAAC,UAAK,WAAU,WAAW,eAAK,WAAW,KAAK,CAAC,SAAS,gBAAgB,GAAG,KAAK,MAAM,eAAe,KAAK,WAAW,IAAI,KAAK,GAAG,GAAG,SAAS,WAAW,SAAS,OAAO,GAAG,CAAC,KAAK,EAAE,KAAI;AAAA,KAC3L;AAEN,CAAC;","names":["ChangeSummary"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/docs/figures/FigureFrame.tsx"],"sourcesContent":["/**\n * Adapted from mdxcn by Keshav Bagaade, MIT licensed.\n * Source: https://github.com/keshav-exe/mdxcn/blob/2928126ba146ebbae9c2351deca27d27bb40e744/registry/default/graph-frame/graph-frame.tsx\n * The port replaces mdxcn's motion runtime and graph variables with this\n * package's deterministic rendering and semantic token contracts.\n */\n\nimport * as React from 'react';\nimport type { ReactElement, ReactNode } from 'react';\nimport { cn } from '../../../lib/recipe';\n\nexport type FigurePalette = 'mono' | 'duo' | 'multi';\nexport type FigureTone = 'primary' | 'secondary' | 'tertiary' | 'idle' | 'empty';\n\nexport const DIM_OPACITY = 0.4;\n\nexport const GLYPH_SETS = {\n shade: ['·', '░', '▒', '▓', '█'],\n ascii: ['.', '-', '=', '#', '@'],\n hash: ['.', ':', '+', '#', '█'],\n bar: ['▁', '▂', '▃', '▅', '█'],\n} as const;\n\nexport type GlyphSetName = keyof typeof GLYPH_SETS;\nexport type Glyphs = GlyphSetName | readonly string[];\n\nexport function resolveGlyphs(glyphs?: Glyphs): readonly string[] {\n if (glyphs == null) return GLYPH_SETS.shade;\n if (typeof glyphs === 'string') return GLYPH_SETS[glyphs] ?? GLYPH_SETS.shade;\n return glyphs.length > 0 ? glyphs : GLYPH_SETS.shade;\n}\n\nexport function toneClass(palette: FigurePalette | undefined, tone: FigureTone): string {\n if (tone === 'empty') return 'text-content-muted';\n if (tone === 'idle') return 'text-content-secondary';\n if (tone === 'primary') return 'text-accent-primary';\n if (tone === 'secondary') {\n return palette === 'mono' || palette == null ? 'text-content-secondary' : 'text-accent-secondary';\n }\n return palette === 'multi' ? 'text-accent-tertiary' : 'text-accent-secondary';\n}\n\nexport function intensityClass(level: number, palette: FigurePalette = 'mono'): string {\n const value = Math.min(4, Math.max(0, Math.round(level)));\n if (value === 0) return toneClass(palette, 'empty');\n if (palette === 'mono') return value <= 2 ? toneClass(palette, 'idle') : 'text-content-primary';\n return value === 1 ? toneClass(palette, 'secondary') : value === 2 ? toneClass(palette, 'tertiary') : toneClass(palette, 'primary');\n}\n\nexport function intensityLevel(value: number, max: number): number {\n if (value <= 0 || max <= 0) return 0;\n return Math.max(1, Math.round(Math.min(1, value / max) * 4));\n}\n\nexport function intensityGlyph(level: number, glyphs: readonly string[] = GLYPH_SETS.shade): string {\n if (glyphs.length === 0) return '·';\n const clamped = Math.min(4, Math.max(0, Math.round(level)));\n return glyphs[Math.round((clamped / 4) * (glyphs.length - 1))] ?? glyphs[0] ?? '·';\n}\n\nexport function words<T extends string>(value: T[] | string): T[] {\n return Array.isArray(value) ? value : value.split(/[\\s,]+/).filter(Boolean) as T[];\n}\n\nexport interface FigureFrameProps extends Omit<React.ComponentProps<'figure'>, 'title'> {\n /** Short uppercase caption drawn across the top edge. */\n title?: string;\n /** Character used at each frame corner. */\n corner?: string;\n}\n\n/**\n * Shared border and caption for one or more documentation renderers.\n * Renderers own their data and can also appear without a frame.\n */\nexport const FigureFrame = React.forwardRef<HTMLElement, FigureFrameProps>(function FigureFrame({ title, corner = '+', className, children, ...rest }, ref) {\n return (\n <figure data-slot=\"figure-frame\"\n ref={ref}\n aria-label={title ?? 'Document figure'}\n className={cn(\n 'relative mx-auto my-8 w-full max-w-5xl border-2 border-dashed border-edge-strong bg-surface-base font-mono text-sm text-content-primary',\n className,\n )}\n {...rest}\n >\n <span aria-hidden=\"true\" className=\"pointer-events-none absolute left-0 top-0 z-10 flex size-4 -translate-x-1/2 -translate-y-1/2 items-center justify-center bg-surface-base font-mono text-xs leading-none text-content-muted\">\n {corner}\n </span>\n <span aria-hidden=\"true\" className=\"pointer-events-none absolute right-0 top-0 z-10 flex size-4 translate-x-1/2 -translate-y-1/2 items-center justify-center bg-surface-base font-mono text-xs leading-none text-content-muted\">\n {corner}\n </span>\n <span aria-hidden=\"true\" className=\"pointer-events-none absolute bottom-0 left-0 z-10 flex size-4 -translate-x-1/2 translate-y-1/2 items-center justify-center bg-surface-base font-mono text-xs leading-none text-content-muted\">\n {corner}\n </span>\n <span aria-hidden=\"true\" className=\"pointer-events-none absolute bottom-0 right-0 z-10 flex size-4 translate-x-1/2 translate-y-1/2 items-center justify-center bg-surface-base font-mono text-xs leading-none text-content-muted\">\n {corner}\n </span>\n {title ? <figcaption className=\"absolute left-1/2 top-0 z-10 -translate-x-1/2 -translate-y-1/2 whitespace-nowrap bg-surface-base px-3 uppercase tracking-wide text-accent-primary\">[ {title} ]</figcaption> : null}\n <div className=\"flex min-w-0 flex-col gap-6 px-5 py-7 sm:px-8 sm:py-8\">{children}</div>\n </figure>\n );\n});\n\n/** Internal root for a renderer. The frame owns the inset. */\nexport const AsciiFrameBody = React.forwardRef<HTMLDivElement, React.ComponentProps<'div'>>(function AsciiFrameBody({ className, ...props }, ref) {\n return <div data-slot=\"ascii-frame-body\" ref={ref} className={cn('min-w-0', className)} {...props} />;\n});\n\n/** Markdown children inside a documentation visual. */\nexport function AsciiFrameProse({ className, ...props }: React.ComponentProps<'div'>) {\n return (\n <div data-slot=\"ascii-frame-prose\"\n className={cn(\n 'flex min-w-0 flex-col gap-3 leading-relaxed',\n '[&_p]:m-0 [&_p]:text-pretty',\n '[&_ul]:m-0 [&_ul]:flex [&_ul]:list-none [&_ul]:flex-col [&_ul]:gap-1 [&_ul]:p-0',\n '[&_ol]:m-0 [&_ol]:flex [&_ol]:list-none [&_ol]:flex-col [&_ol]:gap-1 [&_ol]:p-0',\n '[&_li]:relative [&_li]:pl-4 [&_li]:before:absolute [&_li]:before:left-0 [&_li]:before:text-content-muted [&_li]:before:content-[\\'-\\']',\n '[&_a]:text-content-primary [&_a]:underline [&_a]:decoration-dashed [&_a]:underline-offset-[0.2em]',\n '[&_code]:font-semibold [&_code]:text-content-primary',\n '[&_pre]:m-0 [&_pre]:whitespace-pre-wrap [&_pre_code]:font-normal [&_pre_code]:text-inherit',\n '[&_strong]:font-semibold [&_strong]:text-content-primary',\n '[&_em]:text-content-secondary [&_em]:not-italic',\n className,\n )}\n {...props}\n />\n );\n}\n\n/** A dashed horizontal rule inside a documentation visual. */\nexport function AsciiFrameRule({ className, ...props }: React.ComponentProps<'div'>) {\n return <div data-slot=\"ascii-frame-rule\" aria-hidden=\"true\" className={cn('my-1 h-px w-full border-t border-dashed border-edge-subtle', className)} {...props} />;\n}\n\n/** A dashed vertical rule inside a documentation visual. */\nexport function AsciiFrameRuleY({ className, ...props }: React.ComponentProps<'div'>) {\n return <div data-slot=\"ascii-frame-rule-y\" aria-hidden=\"true\" className={cn('w-px self-stretch border-l border-dashed border-edge-subtle', className)} {...props} />;\n}\n\n/** A full-width character track used by uptime and related figures. */\nexport function AsciiFrameTrack({ className, ...props }: React.ComponentProps<'span'>) {\n return <span data-slot=\"ascii-frame-track\" aria-hidden=\"true\" className={cn('flex w-full min-w-0 select-none', className)} {...props} />;\n}\n\n/** One flexible cell in a character track. */\nexport function AsciiFrameTick({ className, ...props }: React.ComponentProps<'span'>) {\n return <span data-slot=\"ascii-frame-tick\" className={cn('min-w-0 flex-1 overflow-hidden text-center', className)} {...props} />;\n}\n\n/** ASCII arrow used by flow diagrams. */\nexport function AsciiFrameArrow({ accent = false, stretch = false, className }: { accent?: boolean; stretch?: boolean; className?: string }) {\n return (\n <span data-slot=\"ascii-frame-arrow\" aria-hidden=\"true\" className={cn('flex min-w-6 items-center text-content-muted', stretch && 'flex-1', className)}>\n <span className={cn('w-full border-t border-dashed border-current', accent && 'text-accent-primary')} />\n <span className={cn('-ml-1', accent ? 'text-accent-primary' : 'text-content-muted')}>▶</span>\n </span>\n );\n}\n\ntype WithChildren<P> = P & { children?: ReactNode };\ntype AsciiItemComponent<P extends object> = ((props: WithChildren<P>) => null) & {\n graphItem: string;\n displayName?: string;\n};\n\n/** Defines an MDX-only data child that its parent renderer reads. */\nexport function defineAsciiItem<P extends object>(name: string): AsciiItemComponent<P> {\n const Item = (() => null) as unknown as AsciiItemComponent<P>;\n Item.displayName = name;\n Item.graphItem = name;\n return Item;\n}\n\nfunction typeName(type: unknown): string {\n if (typeof type === 'string') return type;\n if (typeof type === 'function') {\n const fn = type as { graphItem?: string; displayName?: string; name?: string };\n return fn.graphItem || fn.displayName || fn.name || '';\n }\n if (type && typeof type === 'object') {\n const value = type as { graphItem?: string; displayName?: string; name?: string; $$id?: string };\n if (value.graphItem) return value.graphItem;\n if (value.displayName) return value.displayName;\n if (typeof value.$$id === 'string') return value.$$id.split('#').pop()?.split('@')[0] ?? '';\n return value.name || '';\n }\n return '';\n}\n\nexport function isHost(element: ReactElement, tags: string | readonly string[]): boolean {\n const name = typeName(element.type).toLowerCase();\n const list = typeof tags === 'string' ? [tags] : tags;\n return list.some((tag) => tag.toLowerCase() === name);\n}\n\nexport function elementsOf(children: ReactNode): ReactElement[] {\n const result: ReactElement[] = [];\n for (const child of React.Children.toArray(children)) {\n if (!React.isValidElement(child)) continue;\n if (child.type === React.Fragment) {\n result.push(...elementsOf((child.props as { children?: ReactNode }).children));\n } else {\n result.push(child);\n }\n }\n return result;\n}\n\nexport function textOf(children: ReactNode): string {\n return React.Children.toArray(children)\n .map((child) => (React.isValidElement(child) ? textOf((child.props as { children?: ReactNode }).children) : String(child)))\n .join('');\n}\n\nexport function itemText(item: ReactElement): string {\n const children = (item.props as { children?: ReactNode }).children;\n return textOf(children).replace(/\\s+/g, ' ').trim();\n}\n\nexport function listItems(children: ReactNode): ReactElement[] {\n const elements = elementsOf(children);\n const lists = elements.filter((element) => isHost(element, ['ul', 'ol']));\n const items = lists.length > 0\n ? lists.flatMap((list) => elementsOf((list.props as { children?: ReactNode }).children))\n : elements;\n return items.filter((element) => isHost(element, 'li'));\n}\n\nexport function nestedList(item: ReactElement): ReactElement[] {\n return listItems((item.props as { children?: ReactNode }).children);\n}\n\nexport function paragraphsOf(children: ReactNode): ReactElement[] {\n return elementsOf(children).filter((element) => isHost(element, 'p'));\n}\n\nexport function hasHost(children: ReactNode, tags: string | readonly string[]): boolean {\n return React.Children.toArray(children).some((child) => {\n if (!React.isValidElement(child)) return false;\n return isHost(child, tags) || hasHost((child.props as { children?: ReactNode }).children, tags);\n });\n}\n\nexport function childItems<P extends object>(children: ReactNode, item: AsciiItemComponent<P>): (P & { children?: ReactNode })[] {\n return elementsOf(children)\n .filter((element) => typeName(element.type) === item.graphItem)\n .map((element) => element.props as P & { children?: ReactNode });\n}\n\nexport function splitLabel(value: string): { label: string; rest: string } {\n const match = value.match(/^([^:—–-]+?)\\s*:\\s*(.*)$/);\n if (!match) return { label: value.trim(), rest: '' };\n return { label: match[1]?.trim() ?? '', rest: match[2]?.trim() ?? '' };\n}\n\nexport function splitDash(value: string): { label: string; rest: string } {\n const match = value.match(/^(.+?)\\s+[-—–]\\s+(.+)$/);\n if (!match) return { label: value.trim(), rest: '' };\n return { label: match[1]?.trim() ?? '', rest: match[2]?.trim() ?? '' };\n}\n\nexport function numberOf(value: number | string): number {\n if (typeof value === 'number') return value;\n const parsed = Number(value.replace(/[^\\d.+-]/g, ''));\n return Number.isFinite(parsed) ? parsed : 0;\n}\n"],"mappings":";AAOA,YAAY,WAAW;AAEvB,SAAS,UAAU;AA6Eb,cAYS,YAZT;AAxEC,IAAM,cAAc;AAEpB,IAAM,aAAa;AAAA,EACxB,OAAO,CAAC,QAAK,UAAK,UAAK,UAAK,QAAG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G,MAAM,GAAG;AACnD,SAAO,EAAE,OAAO,MAAM,CAAC,GAAG,KAAK,KAAK,IAAI,MAAM,MAAM,CAAC,GAAG,KAAK,KAAK,GAAG;AACvE;AAEO,SAAS,SAAS,OAAgC;AACvD,MAAI,OAAO,UAAU,SAAU,QAAO;AACtC,QAAM,SAAS,OAAO,MAAM,QAAQ,aAAa,EAAE,CAAC;AACpD,SAAO,OAAO,SAAS,MAAM,IAAI,SAAS;AAC5C;","names":["FigureFrame","AsciiFrameBody"]}
1
+ {"version":3,"sources":["../../../../src/components/docs/figures/FigureFrame.tsx"],"sourcesContent":["/**\n * Adapted from mdxcn by Keshav Bagaade, MIT licensed.\n * Source: https://github.com/keshav-exe/mdxcn/blob/2928126ba146ebbae9c2351deca27d27bb40e744/registry/default/graph-frame/graph-frame.tsx\n * The port replaces mdxcn's motion runtime and graph variables with this\n * package's deterministic rendering and semantic token contracts.\n */\n\nimport * as React from 'react';\nimport type { ReactElement, ReactNode } from 'react';\nimport { cn } from '../../../lib/recipe';\n\nexport type FigurePalette = 'mono' | 'duo' | 'multi';\nexport type FigureTone = 'primary' | 'secondary' | 'tertiary' | 'idle' | 'empty';\n\nexport const DIM_OPACITY = 0.4;\n\n/** A named glyph ramp, from empty to full. */\nexport type GlyphSetName = 'shade' | 'ascii' | 'hash' | 'bar';\n\n// Spelled out above and checked here, rather than `keyof typeof GLYPH_SETS`:\n// the public type then names no internal constant.\nexport const GLYPH_SETS = {\n shade: ['·', '░', '▒', '▓', '█'],\n ascii: ['.', '-', '=', '#', '@'],\n hash: ['.', ':', '+', '#', '█'],\n bar: ['▁', '▂', '▃', '▅', '█'],\n} as const satisfies Record<GlyphSetName, readonly string[]>;\n\nexport type Glyphs = GlyphSetName | readonly string[];\n\nexport function resolveGlyphs(glyphs?: Glyphs): readonly string[] {\n if (glyphs == null) return GLYPH_SETS.shade;\n if (typeof glyphs === 'string') return GLYPH_SETS[glyphs] ?? GLYPH_SETS.shade;\n return glyphs.length > 0 ? glyphs : GLYPH_SETS.shade;\n}\n\nexport function toneClass(palette: FigurePalette | undefined, tone: FigureTone): string {\n if (tone === 'empty') return 'text-content-muted';\n if (tone === 'idle') return 'text-content-secondary';\n if (tone === 'primary') return 'text-accent-primary';\n if (tone === 'secondary') {\n return palette === 'mono' || palette == null ? 'text-content-secondary' : 'text-accent-secondary';\n }\n return palette === 'multi' ? 'text-accent-tertiary' : 'text-accent-secondary';\n}\n\nexport function intensityClass(level: number, palette: FigurePalette = 'mono'): string {\n const value = Math.min(4, Math.max(0, Math.round(level)));\n if (value === 0) return toneClass(palette, 'empty');\n if (palette === 'mono') return value <= 2 ? toneClass(palette, 'idle') : 'text-content-primary';\n return value === 1 ? toneClass(palette, 'secondary') : value === 2 ? toneClass(palette, 'tertiary') : toneClass(palette, 'primary');\n}\n\nexport function intensityLevel(value: number, max: number): number {\n if (value <= 0 || max <= 0) return 0;\n return Math.max(1, Math.round(Math.min(1, value / max) * 4));\n}\n\nexport function intensityGlyph(level: number, glyphs: readonly string[] = GLYPH_SETS.shade): string {\n if (glyphs.length === 0) return '·';\n const clamped = Math.min(4, Math.max(0, Math.round(level)));\n return glyphs[Math.round((clamped / 4) * (glyphs.length - 1))] ?? glyphs[0] ?? '·';\n}\n\nexport function words<T extends string>(value: T[] | string): T[] {\n return Array.isArray(value) ? value : value.split(/[\\s,]+/).filter(Boolean) as T[];\n}\n\nexport interface FigureFrameProps extends Omit<React.ComponentProps<'figure'>, 'title'> {\n /** Short uppercase caption drawn across the top edge. */\n title?: string;\n /** Character used at each frame corner. */\n corner?: string;\n}\n\n/**\n * Shared border and caption for one or more documentation renderers.\n * Renderers own their data and can also appear without a frame.\n */\nexport const FigureFrame = React.forwardRef<HTMLElement, FigureFrameProps>(function FigureFrame({ title, corner = '+', className, children, ...rest }, ref) {\n return (\n <figure data-slot=\"figure-frame\"\n ref={ref}\n aria-label={title ?? 'Document figure'}\n className={cn(\n 'relative mx-auto my-8 w-full max-w-5xl border-2 border-dashed border-edge-strong bg-surface-base font-mono text-sm text-content-primary',\n className,\n )}\n {...rest}\n >\n <span aria-hidden=\"true\" className=\"pointer-events-none absolute left-0 top-0 z-10 flex size-4 -translate-x-1/2 -translate-y-1/2 items-center justify-center bg-surface-base font-mono text-xs leading-none text-content-muted\">\n {corner}\n </span>\n <span aria-hidden=\"true\" className=\"pointer-events-none absolute right-0 top-0 z-10 flex size-4 translate-x-1/2 -translate-y-1/2 items-center justify-center bg-surface-base font-mono text-xs leading-none text-content-muted\">\n {corner}\n </span>\n <span aria-hidden=\"true\" className=\"pointer-events-none absolute bottom-0 left-0 z-10 flex size-4 -translate-x-1/2 translate-y-1/2 items-center justify-center bg-surface-base font-mono text-xs leading-none text-content-muted\">\n {corner}\n </span>\n <span aria-hidden=\"true\" className=\"pointer-events-none absolute bottom-0 right-0 z-10 flex size-4 translate-x-1/2 translate-y-1/2 items-center justify-center bg-surface-base font-mono text-xs leading-none text-content-muted\">\n {corner}\n </span>\n {title ? <figcaption className=\"absolute left-1/2 top-0 z-10 -translate-x-1/2 -translate-y-1/2 whitespace-nowrap bg-surface-base px-3 uppercase tracking-wide text-accent-primary\">[ {title} ]</figcaption> : null}\n <div className=\"flex min-w-0 flex-col gap-6 px-5 py-7 sm:px-8 sm:py-8\">{children}</div>\n </figure>\n );\n});\n\n/** Internal root for a renderer. The frame owns the inset. */\nexport const AsciiFrameBody = React.forwardRef<HTMLDivElement, React.ComponentProps<'div'>>(function AsciiFrameBody({ className, ...props }, ref) {\n return <div data-slot=\"ascii-frame-body\" ref={ref} className={cn('min-w-0', className)} {...props} />;\n});\n\n/** Markdown children inside a documentation visual. */\nexport function AsciiFrameProse({ className, ...props }: React.ComponentProps<'div'>) {\n return (\n <div data-slot=\"ascii-frame-prose\"\n className={cn(\n 'flex min-w-0 flex-col gap-3 leading-relaxed',\n '[&_p]:m-0 [&_p]:text-pretty',\n '[&_ul]:m-0 [&_ul]:flex [&_ul]:list-none [&_ul]:flex-col [&_ul]:gap-1 [&_ul]:p-0',\n '[&_ol]:m-0 [&_ol]:flex [&_ol]:list-none [&_ol]:flex-col [&_ol]:gap-1 [&_ol]:p-0',\n '[&_li]:relative [&_li]:pl-4 [&_li]:before:absolute [&_li]:before:left-0 [&_li]:before:text-content-muted [&_li]:before:content-[\\'-\\']',\n '[&_a]:text-content-primary [&_a]:underline [&_a]:decoration-dashed [&_a]:underline-offset-[0.2em]',\n '[&_code]:font-semibold [&_code]:text-content-primary',\n '[&_pre]:m-0 [&_pre]:whitespace-pre-wrap [&_pre_code]:font-normal [&_pre_code]:text-inherit',\n '[&_strong]:font-semibold [&_strong]:text-content-primary',\n '[&_em]:text-content-secondary [&_em]:not-italic',\n className,\n )}\n {...props}\n />\n );\n}\n\n/** A dashed horizontal rule inside a documentation visual. */\nexport function AsciiFrameRule({ className, ...props }: React.ComponentProps<'div'>) {\n return <div data-slot=\"ascii-frame-rule\" aria-hidden=\"true\" className={cn('my-1 h-px w-full border-t border-dashed border-edge-subtle', className)} {...props} />;\n}\n\n/** A dashed vertical rule inside a documentation visual. */\nexport function AsciiFrameRuleY({ className, ...props }: React.ComponentProps<'div'>) {\n return <div data-slot=\"ascii-frame-rule-y\" aria-hidden=\"true\" className={cn('w-px self-stretch border-l border-dashed border-edge-subtle', className)} {...props} />;\n}\n\n/** A full-width character track used by uptime and related figures. */\nexport function AsciiFrameTrack({ className, ...props }: React.ComponentProps<'span'>) {\n return <span data-slot=\"ascii-frame-track\" aria-hidden=\"true\" className={cn('flex w-full min-w-0 select-none', className)} {...props} />;\n}\n\n/** One flexible cell in a character track. */\nexport function AsciiFrameTick({ className, ...props }: React.ComponentProps<'span'>) {\n return <span data-slot=\"ascii-frame-tick\" className={cn('min-w-0 flex-1 overflow-hidden text-center', className)} {...props} />;\n}\n\n/** ASCII arrow used by flow diagrams. */\nexport function AsciiFrameArrow({ accent = false, stretch = false, className }: { accent?: boolean; stretch?: boolean; className?: string }) {\n return (\n <span data-slot=\"ascii-frame-arrow\" aria-hidden=\"true\" className={cn('flex min-w-6 items-center text-content-muted', stretch && 'flex-1', className)}>\n <span className={cn('w-full border-t border-dashed border-current', accent && 'text-accent-primary')} />\n <span className={cn('-ml-1', accent ? 'text-accent-primary' : 'text-content-muted')}>▶</span>\n </span>\n );\n}\n\ntype WithChildren<P> = P & { children?: ReactNode };\ntype AsciiItemComponent<P extends object> = ((props: WithChildren<P>) => null) & {\n graphItem: string;\n displayName?: string;\n};\n\n/** Defines an MDX-only data child that its parent renderer reads. */\nexport function defineAsciiItem<P extends object>(name: string): AsciiItemComponent<P> {\n const Item = (() => null) as unknown as AsciiItemComponent<P>;\n Item.displayName = name;\n Item.graphItem = name;\n return Item;\n}\n\nfunction typeName(type: unknown): string {\n if (typeof type === 'string') return type;\n if (typeof type === 'function') {\n const fn = type as { graphItem?: string; displayName?: string; name?: string };\n return fn.graphItem || fn.displayName || fn.name || '';\n }\n if (type && typeof type === 'object') {\n const value = type as { graphItem?: string; displayName?: string; name?: string; $$id?: string };\n if (value.graphItem) return value.graphItem;\n if (value.displayName) return value.displayName;\n if (typeof value.$$id === 'string') return value.$$id.split('#').pop()?.split('@')[0] ?? '';\n return value.name || '';\n }\n return '';\n}\n\nexport function isHost(element: ReactElement, tags: string | readonly string[]): boolean {\n const name = typeName(element.type).toLowerCase();\n const list = typeof tags === 'string' ? [tags] : tags;\n return list.some((tag) => tag.toLowerCase() === name);\n}\n\nexport function elementsOf(children: ReactNode): ReactElement[] {\n const result: ReactElement[] = [];\n for (const child of React.Children.toArray(children)) {\n if (!React.isValidElement(child)) continue;\n if (child.type === React.Fragment) {\n result.push(...elementsOf((child.props as { children?: ReactNode }).children));\n } else {\n result.push(child);\n }\n }\n return result;\n}\n\nexport function textOf(children: ReactNode): string {\n return React.Children.toArray(children)\n .map((child) => (React.isValidElement(child) ? textOf((child.props as { children?: ReactNode }).children) : String(child)))\n .join('');\n}\n\nexport function itemText(item: ReactElement): string {\n const children = (item.props as { children?: ReactNode }).children;\n return textOf(children).replace(/\\s+/g, ' ').trim();\n}\n\nexport function listItems(children: ReactNode): ReactElement[] {\n const elements = elementsOf(children);\n const lists = elements.filter((element) => isHost(element, ['ul', 'ol']));\n const items = lists.length > 0\n ? lists.flatMap((list) => elementsOf((list.props as { children?: ReactNode }).children))\n : elements;\n return items.filter((element) => isHost(element, 'li'));\n}\n\nexport function nestedList(item: ReactElement): ReactElement[] {\n return listItems((item.props as { children?: ReactNode }).children);\n}\n\nexport function paragraphsOf(children: ReactNode): ReactElement[] {\n return elementsOf(children).filter((element) => isHost(element, 'p'));\n}\n\nexport function hasHost(children: ReactNode, tags: string | readonly string[]): boolean {\n return React.Children.toArray(children).some((child) => {\n if (!React.isValidElement(child)) return false;\n return isHost(child, tags) || hasHost((child.props as { children?: ReactNode }).children, tags);\n });\n}\n\nexport function childItems<P extends object>(children: ReactNode, item: AsciiItemComponent<P>): (P & { children?: ReactNode })[] {\n return elementsOf(children)\n .filter((element) => typeName(element.type) === item.graphItem)\n .map((element) => element.props as P & { children?: ReactNode });\n}\n\nexport function splitLabel(value: string): { label: string; rest: string } {\n const match = value.match(/^([^:—–-]+?)\\s*:\\s*(.*)$/);\n if (!match) return { label: value.trim(), rest: '' };\n return { label: match[1]?.trim() ?? '', rest: match[2]?.trim() ?? '' };\n}\n\nexport function splitDash(value: string): { label: string; rest: string } {\n const match = value.match(/^(.+?)\\s+[-—–]\\s+(.+)$/);\n if (!match) return { label: value.trim(), rest: '' };\n return { label: match[1]?.trim() ?? '', rest: match[2]?.trim() ?? '' };\n}\n\nexport function numberOf(value: number | string): number {\n if (typeof value === 'number') return value;\n const parsed = Number(value.replace(/[^\\d.+-]/g, ''));\n return Number.isFinite(parsed) ? parsed : 0;\n}\n"],"mappings":";AAOA,YAAY,WAAW;AAEvB,SAAS,UAAU;AAiFb,cAYS,YAZT;AA5EC,IAAM,cAAc;AAOpB,IAAM,aAAa;AAAA,EACxB,OAAO,CAAC,QAAK,UAAK,UAAK,UAAK,QAAG;AAAA,EAC/B,OAAO,CAAC,KAAK,KAA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O,MAAM,CAAC,GAAG,KAAK,KAAK,IAAI,MAAM,MAAM,CAAC,GAAG,KAAK,KAAK,GAAG;AACvE;AAEO,SAAS,SAAS,OAAgC;AACvD,MAAI,OAAO,UAAU,SAAU,QAAO;AACtC,QAAM,SAAS,OAAO,MAAM,QAAQ,aAAa,EAAE,CAAC;AACpD,SAAO,OAAO,SAAS,MAAM,IAAI,SAAS;AAC5C;","names":["FigureFrame","AsciiFrameBody"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/docs/figures/index.ts"],"sourcesContent":["export { FigureFrame } from './FigureFrame';\nexport type { FigureFrameProps } from './FigureFrame';\nexport * from './FlowDiagram';\nexport * from './Timeline';\nexport * from './ChangeSummary';\nexport * from './BeforeAfter';\nexport * from './UptimeStrip';\nexport * from './TreeDiagram';\nexport * from './FileChangeTree';\nexport * from './DrawingSheet';\nexport * from './IndexedSection';\nexport type { FigureSurface } from './FigureSurfaceContext';\nexport * from './ActivityGrid';\nexport * from './GanttChart';\nexport * from './Terminal';\nexport * from './Steps';\nexport * from './SwatchCompare';\nexport * from './MetricStrip';\nexport * from './TokenTable';\nexport * from './Decision';\nexport * from './TermGrid';\n"],"mappings":";AAAA,SAAS,mBAAmB;AAE5B,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AAEd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;","names":[]}
1
+ {"version":3,"sources":["../../../../src/components/docs/figures/index.ts"],"sourcesContent":["export { FigureFrame } from './FigureFrame';\nexport type { FigureFrameProps, FigurePalette, GlyphSetName, Glyphs } from './FigureFrame';\nexport * from './FlowDiagram';\nexport * from './Timeline';\nexport * from './ChangeSummary';\nexport * from './BeforeAfter';\nexport * from './UptimeStrip';\nexport * from './TreeDiagram';\nexport * from './FileChangeTree';\nexport * from './DrawingSheet';\nexport * from './IndexedSection';\nexport type { FigureSurface } from './FigureSurfaceContext';\nexport * from './ActivityGrid';\nexport * from './GanttChart';\nexport * from './Terminal';\nexport * from './Steps';\nexport * from './SwatchCompare';\nexport * from './MetricStrip';\nexport * from './TokenTable';\nexport * from './Decision';\nexport * from './TermGrid';\n"],"mappings":";AAAA,SAAS,mBAAmB;AAE5B,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AAEd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;","names":[]}