@scattered-light/loomiere 0.2.0 → 0.3.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.
@@ -313,13 +313,72 @@ function brandBook({ theme, brand, byPath, cssName, usageOf, tokens, tiers, styl
313
313
  '',
314
314
  );
315
315
  if (componentNames.length) {
316
+ const has = (n) => componentNames.includes(n);
317
+ const pick = (list) => list.filter(([n]) => has(n)).map(([n, use]) => `| \`${n}\` | ${use} |`);
316
318
  out.push(
317
319
  '## Components',
318
320
  '',
319
- `The components are [Base UI](https://base-ui.com) parts styled by class name: ${componentNames.map((n) => `\`${n}\``).join(', ')}. Each component's README lists the classes its parts take and the data attributes they answer to (\`data-size="sm|lg"\`, \`data-emphasis\`, \`data-color\`). In previews and designs they are \`window.Loomiere.<Name>\`; Button, Input, Field, Fieldset, Form and NavigationMenu are wrappers that put their classes on themselves.`,
321
+ `The components are [Base UI](https://base-ui.com) parts styled by class name: ${componentNames.map((n) => `\`${n}\``).join(', ')}. Each component's README lists the classes its parts take and the data attributes they answer to (\`data-size="sm|lg"\`, \`data-emphasis\`, \`data-color\`).`,
320
322
  '',
321
323
  'Icons are Material Symbols Outlined by ligature name (`<span class="material-symbols-outlined">search</span>`, or `Loomiere.MaterialSymbol name="search"`), sized by the `.icon-<tier>` utilities to match the text beside them.',
322
324
  '',
325
+ '### Using the components in a page or design',
326
+ '',
327
+ 'Load three things, in this order:',
328
+ '',
329
+ '1. `components/bundle.css`: the whole theme in one sheet. It holds every token (light, dark, high contrast and color vision modes), the text style, icon and focus utilities, the brand pairs, and every component\'s styles, and it imports the brand fonts and Material Symbols from Google Fonts itself. Nothing else is needed for styling; `tokens.json` is the same tokens as data for the Design System page.',
330
+ '2. React 18 and ReactDOM 18 as the `window.React` and `window.ReactDOM` globals. A design canvas or the preview frame already has them.',
331
+ '3. `components/bundle.js`: one classic script that sets `window.Loomiere`.',
332
+ '',
333
+ '`window.Loomiere` holds two kinds of component:',
334
+ '',
335
+ `- **Wrappers** put their own classes on, so use them bare: ${['Button', 'IconButton', 'Input', 'Field', 'Fieldset', 'Form', 'NavigationMenu'].filter(has).map((n) => `\`Loomiere.${n}\``).join(', ')}. \`Loomiere.Button\` also takes \`emphasis\` (\`bold|standard|subtle|quiet\`) and \`palette\` props, and a Button holding only an icon draws itself square (it sets \`data-icon-only\`). A plain \`.Button\`, such as a Popover or Toolbar trigger, is drawn square when it has an \`aria-label\` and a single icon inside, or when you set \`data-icon-only\` on it.`,
336
+ '- **Everything else is the bare Base UI part** under its usual name (`Loomiere.Popover.Popup`, `Loomiere.ToggleGroup`). It draws nothing until you give each part its class, which is the component and part names joined: `<Loomiere.Popover.Popup className="PopoverPopup">`, `<Loomiere.Toggle className="Toggle">`. The component READMEs list every class.',
337
+ '',
338
+ '`Loomiere.Base` holds the bare Base UI parts for the wrappers too (`Loomiere.Base.Button`), for when you need the part without its classes.',
339
+ '',
340
+ '### Choosing a component',
341
+ '',
342
+ 'Pick by what the person is doing, not by look:',
343
+ '',
344
+ '| Component | Use it to |',
345
+ '|---|---|',
346
+ ...pick([
347
+ ['Button', 'Run one action. Set its emphasis by how much the action matters.'],
348
+ ['IconButton', 'Run a small, frequent action shown as an icon alone, where a Button would be too loud: calendar arrows, row actions, a clear button. Always give it an aria-label.'],
349
+ ['Switch', 'Turn one setting on or off, taking effect at once.'],
350
+ ['Checkbox', 'Turn one option on or off inside a form that is submitted later.'],
351
+ ['Toggle', 'A tool that stays pressed, such as Bold in a toolbar.'],
352
+ ['ToggleGroup', 'Switch between 2 to 5 short modes or views that apply at once (Single date / Date range, List / Grid).'],
353
+ ['Tabs', 'Switch between panels of content in the same place.'],
354
+ ['Radio', 'Choose one of 2 to 6 options in a form, where each option can carry a label and description.'],
355
+ ['CheckboxGroup', 'Choose any number of a few visible options.'],
356
+ ['Select', 'Choose one of a fixed list too long to show (about 6 to 15 items).'],
357
+ ['Combobox', 'Choose one or more from a long list by typing to filter it.'],
358
+ ['Autocomplete', 'Type free text, with suggestions to speed it up.'],
359
+ ['NumberField', 'Enter an exact number, with steppers.'],
360
+ ['Slider', 'Set a value in a range where roughly is good enough.'],
361
+ ['OTPField', 'Enter a one-time code.'],
362
+ ['Menu', 'Offer commands from a button. Menus run actions; they don\'t hold a value.'],
363
+ ['ContextMenu', 'Offer commands on right-click or long press.'],
364
+ ['Menubar', 'An app\'s top row of menus.'],
365
+ ['Toolbar', 'A row of buttons, toggles and fields that act on one thing.'],
366
+ ['NavigationMenu', 'Site navigation, with panels of links.'],
367
+ ['Tooltip', 'Name an icon-only control. Never put anything you can click inside one.'],
368
+ ['PreviewCard', 'Preview what a link leads to on hover.'],
369
+ ['Popover', 'Show interactive content beside its trigger: a picker, a short form, filters.'],
370
+ ['Dialog', 'A task that needs full attention before the page goes on.'],
371
+ ['AlertDialog', 'Confirm a destructive or hard-to-undo action.'],
372
+ ['Drawer', 'A side task or detail panel that keeps the page in view.'],
373
+ ['Accordion', 'Several sections where only some need to be open.'],
374
+ ['Collapsible', 'One section to show or hide.'],
375
+ ['Toast', 'Report the result of an action, briefly.'],
376
+ ['Progress', 'Show how far a task has got.'],
377
+ ['Meter', 'Show a measured amount within known limits, such as storage used.'],
378
+ ]),
379
+ '',
380
+ `A list of choices that stays on screen inside a panel, one of them selected (quick picks, saved filters, presets), has no Base UI part. Make each row a \`<button aria-pressed>\` drawn from the item concept: \`--${theme.prefix}-item-padding-block\`, \`-padding-inline\`, \`-radius\` and \`-gap\`, \`--${theme.prefix}-item-background-hover\` and \`-color-hover\` on hover, \`--${theme.prefix}-item-background-selected\` and \`-color-selected\` with the \`-selected\` text style when chosen. These are the same rows menus and selects use. When the choice is a form value, use Radio instead.`,
381
+ '',
323
382
  );
324
383
  }
325
384
  return `${out.join('\n')}\n`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scattered-light/loomiere",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
4
4
  "description": "Turns a small brand file into a full design token theme: OKLCH color ramps, a type scale, light, dark and high-contrast modes, plus Tailwind, MUI, Chakra, AG Grid and Figma exports.",
5
5
  "keywords": ["design-tokens", "theme", "style-dictionary", "dtcg", "oklch", "base-ui", "ag-grid", "tailwind"],
6
6
  "repository": {
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "popover": {
3
3
  "$description": "Popover's own sizes. Everything else is the popup and close concepts, text styles and CSS.",
4
- "popup-max-width": {
5
- "$value": "400px",
6
- "$description": "Keeps longer text to a readable line length."
4
+ "text-max-width": {
5
+ "$value": "{measure.narrow}",
6
+ "$description": "Keeps the title and description to a readable line length. The popup itself has no fixed cap, so wider content such as a calendar or a form fits; it stops at the space Base UI reports beside the trigger."
7
7
  },
8
8
  "popup-min-width": {
9
9
  "$value": "{popup.min-width}",