@designtools/docs 0.1.0 → 0.2.1

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 (56) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/README.md +24 -2
  3. package/dist/anatomy.js +2 -1
  4. package/dist/cli.js +1 -1
  5. package/dist/glossary.d.ts +1 -1
  6. package/dist/glossary.js +13 -6
  7. package/dist/index.d.ts +2 -1
  8. package/dist/index.js +2 -1
  9. package/dist/lib/live.d.ts +10 -0
  10. package/dist/lib/live.js +10 -0
  11. package/dist/lib/lookup.js +3 -2
  12. package/dist/lib/status.d.ts +2 -3
  13. package/dist/lib/terms.d.ts +15 -0
  14. package/dist/lib/terms.js +20 -0
  15. package/dist/next/config.d.ts +24 -4
  16. package/dist/next/index.d.ts +3 -0
  17. package/dist/next/index.js +3 -0
  18. package/dist/next/markdown.js +1 -1
  19. package/dist/next/pages.js +82 -16
  20. package/dist/next/prose.d.ts +2 -2
  21. package/dist/next/prose.js +6 -4
  22. package/dist/pattern.d.ts +4 -1
  23. package/dist/pattern.js +11 -8
  24. package/dist/playground.js +1 -1
  25. package/dist/rule.d.ts +9 -5
  26. package/dist/rule.js +14 -9
  27. package/dist/shell.d.ts +4 -1
  28. package/dist/shell.js +13 -11
  29. package/dist/styles.css +961 -754
  30. package/dist/swatches.d.ts +7 -6
  31. package/dist/swatches.js +50 -16
  32. package/dist/variant-matrix.js +11 -6
  33. package/dist/voice-terms.js +6 -5
  34. package/dist/workbench.js +2 -1
  35. package/package.json +1 -1
  36. package/src/anatomy.tsx +6 -1
  37. package/src/glossary.tsx +39 -40
  38. package/src/index.ts +2 -1
  39. package/src/lib/live.tsx +15 -0
  40. package/src/lib/lookup.tsx +3 -2
  41. package/src/lib/status.tsx +3 -3
  42. package/src/lib/terms.tsx +53 -0
  43. package/src/next/config.ts +25 -4
  44. package/src/next/index.tsx +3 -0
  45. package/src/next/markdown.ts +1 -1
  46. package/src/next/pages.tsx +172 -59
  47. package/src/next/prose.tsx +16 -6
  48. package/src/pattern.tsx +42 -37
  49. package/src/playground.tsx +7 -2
  50. package/src/rule.tsx +108 -59
  51. package/src/shell.tsx +30 -16
  52. package/src/styles.css +4 -2
  53. package/src/swatches.tsx +189 -120
  54. package/src/variant-matrix.tsx +63 -80
  55. package/src/voice-terms.tsx +20 -29
  56. package/src/workbench.tsx +6 -3
@@ -1,5 +1,6 @@
1
1
  import type { TermEntry } from "./lib/manifest-types";
2
- import { inline } from "./lib/text";
2
+ import { TermHead, TermRow } from "./lib/terms";
3
+ import { DocsSection } from "./shell";
3
4
 
4
5
  /** The words to use, beside the ones not to: the product's words first, then the system's names that have wrong forms. */
5
6
  export function VoiceTerms({ terms }: { terms: TermEntry[] }) {
@@ -7,40 +8,30 @@ export function VoiceTerms({ terms }: { terms: TermEntry[] }) {
7
8
  const system = terms.filter((t) => t.kind !== "product" && t.wrong?.length);
8
9
  if (product.length + system.length === 0) return <p className="text-sm text-muted-foreground">No terms yet. Add them to the taxonomy file.</p>;
9
10
  return (
10
- <div data-slot="voice-terms" className="flex flex-col gap-12">
11
- {product.length > 0 && <Group title="In the product" terms={product} />}
12
- {system.length > 0 && <Group title="In the system" terms={system} />}
13
- </div>
11
+ <>
12
+ {product.length > 0 && (
13
+ <DocsSection title="In the product" lead="The words the product uses with the people it serves, in copy, on screens and in emails.">
14
+ <Terms terms={product} />
15
+ </DocsSection>
16
+ )}
17
+ {system.length > 0 && (
18
+ <DocsSection title="In the system" lead="The names the design system gives its parts, and the ones people reach for instead.">
19
+ <Terms terms={system} />
20
+ </DocsSection>
21
+ )}
22
+ </>
14
23
  );
15
24
  }
16
25
 
17
- function Group({ title, terms }: { title: string; terms: TermEntry[] }) {
26
+ function Terms({ terms }: { terms: TermEntry[] }) {
18
27
  return (
19
- <section className="flex flex-col gap-2">
20
- <h3 className="text-xs font-medium tracking-wide text-muted-foreground uppercase">{title}</h3>
21
- <dl className="grid gap-x-12 sm:grid-cols-2">
28
+ <div data-slot="voice-terms">
29
+ <TermHead />
30
+ <dl>
22
31
  {terms.map((t) => (
23
- <div key={`${t.kind}:${t.name}`} data-slot="term" className="flex flex-col gap-1.5 border-t border-border py-5">
24
- <dt className="text-3xl tracking-tight">
25
- {t.name}
26
- <span className="sr-only">, say this</span>
27
- </dt>
28
- {(t.wrong ?? []).length > 0 && (
29
- <dd className="flex flex-wrap gap-x-3 text-base text-muted-foreground">
30
- <span className="sr-only">not </span>
31
- {(t.wrong ?? []).map((w) => (
32
- <s key={w} className="decoration-destructive decoration-2">
33
- {w}
34
- </s>
35
- ))}
36
- </dd>
37
- )}
38
- {(t.note || t.kind !== "product") && (
39
- <dd className="text-sm text-muted-foreground">{t.note ? inline(t.note) : `The ${t.kind}'s name in the code.`}</dd>
40
- )}
41
- </div>
32
+ <TermRow key={`${t.kind}:${t.name}`} term={t} />
42
33
  ))}
43
34
  </dl>
44
- </section>
35
+ </div>
45
36
  );
46
37
  }
package/src/workbench.tsx CHANGED
@@ -1,5 +1,6 @@
1
1
  "use client";
2
2
 
3
+ import { Live } from "./lib/live";
3
4
  import { Tabs } from "@base-ui/react/tabs";
4
5
  import { Toggle } from "@base-ui/react/toggle";
5
6
  import { ToggleGroup } from "@base-ui/react/toggle-group";
@@ -267,9 +268,11 @@ export function Workbench({
267
268
  const dotted = view.bg === "canvas";
268
269
 
269
270
  const node = (
270
- <Component {...base} {...logged} {...chosen}>
271
- {content ?? (text || undefined)}
272
- </Component>
271
+ <Live>
272
+ <Component {...base} {...logged} {...chosen}>
273
+ {content ?? (text || undefined)}
274
+ </Component>
275
+ </Live>
273
276
  );
274
277
  const scope = [
275
278
  entry.name,