ShtukbaseStandard
файл пакета→ .shtukbase/packages/design-lenses/test/fixtures/project/lib/design/components.data.js

test/fixtures/project/lib/design/components.data.js

91 строка, 5.4 КБ.

Файл как есть в пакете: код и комментарии в нём не переводятся.

  1. // A test fixture of lib/design/components.data.js (build contract, section 6), written by hand for the design lenses.
  2. (function () {
  3. const card = (attrs, title, desc) =>
  4. '<div data-slot="package-card" class="package-card"' + attrs + '><div class="icon-plate" data-slot="icon-plate"><i></i></div>'
  5. + '<div><h4 data-slot="card-title">' + title + '</h4><p data-slot="card-description">' + desc + '</p>'
  6. + '<span class="chip" data-slot="chip" data-tone="accent">0.1.0</span> <span class="chip" data-slot="chip">design</span></div></div>';
  7. window.SB_COMPONENTS = {
  8. version: 1,
  9. style: "demo",
  10. css: ["/design/demo/tokens.css", "/design/demo-ui/ui.css"],
  11. components: [
  12. {
  13. id: "button", title: "Button", level: "primitive", description: "A compact action button.",
  14. uses: [], parts: ["button"], states: ["default", "hover", "disabled"], status: [],
  15. controls: {
  16. variant: { kind: "select", options: ["default", "outline", "ghost", "destructive"], default: "default" },
  17. size: { kind: "segment", options: ["s", "m", "l"], default: "m" },
  18. },
  19. cssProperties: ["--primary", "--radius"],
  20. html: {
  21. source: "/design/demo-ui/components/primitive/button/button.html",
  22. css: "/design/demo-ui/components/primitive/button/button.css",
  23. templates: {
  24. default: '<button data-slot="button" class="button">Install</button>',
  25. hover: '<button data-slot="button" class="button" data-state="hover">Install</button>',
  26. disabled: '<button data-slot="button" class="button" disabled>Install</button>',
  27. },
  28. },
  29. react: { source: "/components/ui/button.tsx" },
  30. page: "/design/components/button.md",
  31. },
  32. {
  33. id: "chip", title: "Chip", level: "primitive", description: "A small label: a version, a group, a state.",
  34. uses: [], parts: [], states: ["default"], status: [],
  35. controls: { tone: { kind: "swatch", options: ["default", "accent", "blue"], colors: ["#e9e9e7", "#e04a72", "#2383e2"], default: "default" } },
  36. cssProperties: ["--sb-hue-1", "--sb-hue-2"],
  37. html: {
  38. source: "/design/demo-ui/components/primitive/chip/chip.html", css: "/design/demo-ui/components/primitive/chip/chip.css",
  39. templates: { default: '<span data-slot="chip" class="chip">design</span>' },
  40. },
  41. react: null,
  42. page: "/design/components/chip.md",
  43. },
  44. {
  45. id: "package-card", title: "Package card", level: "composite", description: "A package on a white card: icon plate, title, description, chips.",
  46. uses: ["icon-plate", "chip", "kicker"], parts: ["card-header", "card-title", "card-description", "card-content", "card-footer"],
  47. states: ["default", "hover", "selected"], status: ["loading", "empty", "error"],
  48. controls: {
  49. preset: { kind: "select", options: ["base", "compact", "editorial"], default: "base", section: "Look" },
  50. glow: { kind: "bool", default: false, section: "Look" },
  51. width: { kind: "range", min: 220, max: 420, step: 10, unit: "px", default: 300, section: "Size" },
  52. },
  53. cssProperties: ["--sb-glow", "--sb-edge"],
  54. html: {
  55. source: "/design/demo-ui/components/composite/package-card/package-card.html",
  56. css: "/design/demo-ui/components/composite/package-card/package-card.css",
  57. templates: {
  58. default: card('', "Design tokens", "The token contract and the build of tokens.css."),
  59. hover: card(' data-state="hover"', "Design tokens", "The token contract and the build of tokens.css."),
  60. selected: card(' data-state="selected"', "Design tokens", "The token contract and the build of tokens.css."),
  61. loading: card(' data-status="loading"', "Design tokens", "The token contract and the build."),
  62. empty: card(' data-status="empty"', "No package", "Nothing is installed yet."),
  63. error: card(' data-status="error"', "Design tokens", "The package could not be read."),
  64. },
  65. },
  66. react: { source: "/components/ui/package-card.tsx" },
  67. page: "/design/components/package-card.md",
  68. },
  69. {
  70. id: "package-grid", title: "Package grid", level: "block", description: "Package cards on a sheet, two columns.",
  71. uses: ["package-card"], parts: [], states: ["default"], status: ["empty"],
  72. controls: { density: { kind: "segment", options: ["normal", "tight"], default: "normal" } },
  73. cssProperties: [],
  74. html: {
  75. source: "/design/demo-ui/components/block/package-grid/package-grid.html", css: "/design/demo-ui/components/block/package-grid/package-grid.css",
  76. templates: {
  77. default: '<div data-slot="package-grid" class="package-grid">' + card('', "Lenses", "HTML lenses over a base.") + card('', "Kit style", "The lens kit style and skins.") + '</div>',
  78. empty: '<div data-slot="package-grid" class="package-grid" data-status="empty"><span class="chip">No packages</span></div>',
  79. },
  80. },
  81. react: null,
  82. page: "/design/components/package-grid.md",
  83. },
  84. {
  85. id: "settings-page", title: "Settings page", level: "page", description: "A page with no HTML template yet.",
  86. uses: ["package-grid"], parts: [], states: [], status: [], controls: {}, cssProperties: [],
  87. html: null, react: { source: "/components/pages/settings.tsx" }, page: "/design/components/settings-page.md",
  88. },
  89. ],
  90. };
  91. })();