@filipgutica/design-system 1.0.9 → 1.0.11
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.
- package/README.md +1 -1
- package/language/components.html +31 -11
- package/language/components.md +3 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Filip's design language for any framework: the spec, the tokens, the component catalogue, and the editor themes. It ships as the npm package `@filipgutica/design-system`.
|
|
4
4
|
|
|
5
|
-
- **Agents** get `language/` at `~/design-language` through filip-stack host config.
|
|
5
|
+
- **Agents** get `language/` at `~/design-language` through filip-stack host config, or by copying it from the package; the site's [Agents](https://filipgutica.github.io/design-system/#agents) section has both.
|
|
6
6
|
- **Vue apps** use [`@filipgutica/ui`](https://github.com/filipgutica/ui), which implements this design language.
|
|
7
7
|
- **Site:** <https://filipgutica.github.io/design-system/> has the Overview, Foundations, and Components pages, with `index.json` and `llms.txt` for agents.
|
|
8
8
|
|
package/language/components.html
CHANGED
|
@@ -733,6 +733,19 @@
|
|
|
733
733
|
.rail-specimen { display: grid; gap: var(--space-3); width: 240px; }
|
|
734
734
|
.phone-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-2) var(--space-3); width: min(100%, 360px); padding-block: var(--space-2); border-bottom: 1px solid var(--color-text); }
|
|
735
735
|
.phone-head > .strip { flex-basis: 100%; margin-inline: -2px; }
|
|
736
|
+
/* At 640px and narrower, one or two links stay on the switcher's row as plain text links, 12px apart:
|
|
737
|
+
no row padding or hover fill, and the current page in the accent with no fill. The picker ends the row;
|
|
738
|
+
where all of it does not fit, as at 320px, only the picker wraps. */
|
|
739
|
+
.phone-head > .projects:has(~ .text-links) { margin-inline-end: auto; }
|
|
740
|
+
.navlist.text-links { display: flex; gap: var(--space-3); width: auto; }
|
|
741
|
+
.navlist.text-links a { min-height: var(--control-lg); padding-inline: 0; }
|
|
742
|
+
@media (hover: hover) { .navlist.text-links a:hover { background: none; } }
|
|
743
|
+
.navlist.text-links a[aria-current="page"] { background: none; box-shadow: none; color: var(--color-accent); }
|
|
744
|
+
.navlist.text-links a:is(:focus-visible, .is-focus) { outline-offset: var(--focus-offset); }
|
|
745
|
+
/* Forced colors: an underline marks the current page, as the system border would touch the text. */
|
|
746
|
+
@media (forced-colors: active) {
|
|
747
|
+
.navlist.text-links a[aria-current="page"] { border-inline-start: 0; padding-inline-start: 0; text-decoration: underline; }
|
|
748
|
+
}
|
|
736
749
|
|
|
737
750
|
/* By purpose: each group with its components, in two balanced columns. */
|
|
738
751
|
.index { display: grid; gap: var(--space-4); }
|
|
@@ -1320,6 +1333,7 @@
|
|
|
1320
1333
|
</div></div>
|
|
1321
1334
|
<div class="row"><h4>Phone header</h4><div class="states">
|
|
1322
1335
|
<div class="state wide" inert><div class="phone-head"><details class="projects"><summary class="quiet-action" aria-label="Project: Design system, phone sample"><span>Design system</span><svg class="icon" aria-hidden="true"><use href="#i-chevron-down"/></svg></summary></details><div class="segmented" role="group" aria-label="Appearance, phone sample" data-size="lg" data-icon-only><button type="button" aria-pressed="true" aria-label="System" title="System"><svg class="icon" aria-hidden="true"><use href="#i-system"/></svg></button><button type="button" aria-pressed="false" aria-label="Light" title="Light"><svg class="icon" aria-hidden="true"><use href="#i-light"/></svg></button><button type="button" aria-pressed="false" aria-label="Dark" title="Dark"><svg class="icon" aria-hidden="true"><use href="#i-dark"/></svg></button></div><nav class="navlist strip" aria-label="Pages, phone sample"><a href="#section-rail" data-label="Overview">Overview</a><a href="#section-rail" data-label="Foundations">Foundations</a><a href="#section-rail" aria-current="page" data-label="Components">Components</a><a href="#section-rail" data-label="Themes">Themes</a></nav></div><button class="btn secondary menu-glyph" type="button" data-size="lg">Components: By purpose</button><span class="caption">Rest at tablet width: the switcher and appearance, then the pages, then the labelled trigger below the header</span></div>
|
|
1336
|
+
<div class="state wide" inert><div class="phone-head"><details class="projects"><summary class="quiet-action" aria-label="Project: ui, phone sample with two links"><span>ui</span><svg class="icon" aria-hidden="true"><use href="#i-chevron-down"/></svg></summary></details><nav class="navlist text-links" aria-label="Site links, phone sample"><a href="#section-rail" aria-current="page">Docs</a><a href="#section-rail">GitHub</a></nav><div class="segmented" role="group" aria-label="Appearance, phone sample with two links" data-size="lg" data-icon-only><button type="button" aria-pressed="true" aria-label="System" title="System"><svg class="icon" aria-hidden="true"><use href="#i-system"/></svg></button><button type="button" aria-pressed="false" aria-label="Light" title="Light"><svg class="icon" aria-hidden="true"><use href="#i-light"/></svg></button><button type="button" aria-pressed="false" aria-label="Dark" title="Dark"><svg class="icon" aria-hidden="true"><use href="#i-dark"/></svg></button></div></div><span class="caption">Phone, two links: text links after the switcher, Docs current; where the row is full, only the picker wraps. A documentation page hides them, and its footer carries them</span></div>
|
|
1323
1337
|
</div></div>
|
|
1324
1338
|
</section>
|
|
1325
1339
|
|
|
@@ -1693,6 +1707,7 @@
|
|
|
1693
1707
|
});
|
|
1694
1708
|
|
|
1695
1709
|
// Full size: open the selected capture in a named modal; the native dialog restores focus to the trigger.
|
|
1710
|
+
// Safari does not focus a button on click, so the trigger takes focus first and the dialog has it to return to.
|
|
1696
1711
|
const viewer = document.getElementById('capture-viewer');
|
|
1697
1712
|
document.querySelectorAll('[data-full-size]').forEach((button) => button.addEventListener('click', () => {
|
|
1698
1713
|
const panel = button.closest('.capture').querySelector('.tabpanel:not([hidden])');
|
|
@@ -1701,6 +1716,7 @@
|
|
|
1701
1716
|
const screen = panel.querySelector('.screen').cloneNode(true);
|
|
1702
1717
|
screen.setAttribute('aria-label', `${name} capture, full size`);
|
|
1703
1718
|
document.getElementById('capture-viewer-body').replaceChildren(screen, panel.querySelector('.capture-caption').cloneNode(true));
|
|
1719
|
+
button.focus({ preventScroll: true });
|
|
1704
1720
|
viewer.showModal();
|
|
1705
1721
|
}));
|
|
1706
1722
|
|
|
@@ -1739,6 +1755,20 @@
|
|
|
1739
1755
|
button.focus();
|
|
1740
1756
|
document.getElementById(button.dataset.open).showModal();
|
|
1741
1757
|
}));
|
|
1758
|
+
// A tap or click on the backdrop, which belongs to the dialog element, lands outside the dialog's box and
|
|
1759
|
+
// closes it. closedby="any" would do this, but Safari does not support it. Only a press that starts outside
|
|
1760
|
+
// counts, so a drag out of the dialog keeps it open. It closes on the click, not the press: a dialog that
|
|
1761
|
+
// closes at once would otherwise pass the release and its click to the page behind.
|
|
1762
|
+
const closeOnBackdrop = (dialog, close) => {
|
|
1763
|
+
const outside = (e) => {
|
|
1764
|
+
const box = dialog.getBoundingClientRect();
|
|
1765
|
+
return e.clientX < box.left || e.clientX > box.right || e.clientY < box.top || e.clientY > box.bottom;
|
|
1766
|
+
};
|
|
1767
|
+
let pressedOutside = false;
|
|
1768
|
+
dialog.addEventListener('pointerdown', (e) => { pressedOutside = outside(e); });
|
|
1769
|
+
dialog.addEventListener('click', (e) => { if (pressedOutside && e.target === dialog && outside(e)) close(); });
|
|
1770
|
+
};
|
|
1771
|
+
document.querySelectorAll('dialog.dialog').forEach((dialog) => closeOnBackdrop(dialog, () => dialog.close()));
|
|
1742
1772
|
// Following an in-page link closes the drawer, then focus moves to the destination instead of the trigger.
|
|
1743
1773
|
// Every close path slides the drawer out first. Under reduced motion there is no animation, so it closes at once.
|
|
1744
1774
|
// A slide that is cancelled, such as by turning on reduced motion mid-slide, still closes the drawer.
|
|
@@ -1759,17 +1789,7 @@
|
|
|
1759
1789
|
};
|
|
1760
1790
|
drawer.addEventListener('cancel', (e) => { e.preventDefault(); slideOut(); });
|
|
1761
1791
|
drawer.querySelector('form[method="dialog"]')?.addEventListener('submit', (e) => { e.preventDefault(); slideOut(); });
|
|
1762
|
-
|
|
1763
|
-
// closes it. closedby="any" would do this, but Safari does not support it. Only a press that starts outside
|
|
1764
|
-
// counts, so a drag out of the drawer keeps it open. It closes on the click, not the press: a drawer that
|
|
1765
|
-
// closes at once, under reduced motion, would otherwise pass the release and its click to the page behind.
|
|
1766
|
-
const outside = (e) => {
|
|
1767
|
-
const box = drawer.getBoundingClientRect();
|
|
1768
|
-
return e.clientX < box.left || e.clientX > box.right || e.clientY < box.top || e.clientY > box.bottom;
|
|
1769
|
-
};
|
|
1770
|
-
let pressedOutside = false;
|
|
1771
|
-
drawer.addEventListener('pointerdown', (e) => { pressedOutside = outside(e); });
|
|
1772
|
-
drawer.addEventListener('click', (e) => { if (pressedOutside && e.target === drawer && outside(e)) slideOut(); });
|
|
1792
|
+
closeOnBackdrop(drawer, slideOut);
|
|
1773
1793
|
drawer.addEventListener('click', (e) => {
|
|
1774
1794
|
const link = e.target.closest('a[href^="#"]');
|
|
1775
1795
|
if (!link || e.button !== 0 || e.metaKey || e.ctrlKey || e.altKey || e.shiftKey) return;
|
package/language/components.md
CHANGED
|
@@ -279,6 +279,7 @@ Layer: Core. ui: `UiDialog`.
|
|
|
279
279
|
- **Do.** Use a dialog for a short task the reader must finish or cancel before the page continues, such as confirming a deletion. Title it with that task.
|
|
280
280
|
- **Don't.** A dialog that opens without the reader asking, such as on page load, or one that holds a long form. A long form gets its own page.
|
|
281
281
|
- **Keyboard and screen reader.** `role="dialog"`, `aria-modal="true"`, named by its title. Focus moves in on open and is trapped. Escape closes it, and focus returns to the trigger. A native `<dialog>` opened with `showModal()` provides most of this.
|
|
282
|
+
- **Backdrop.** A tap or click on the backdrop, outside the dialog, closes it, the same way Escape does, and focus returns to the trigger. Only a press that starts outside counts: a drag that starts inside the dialog and ends outside leaves it open. Safari does not support `closedby="any"`, so a script closes it.
|
|
282
283
|
- **Motion.** None: it opens and closes at once. Only the drawer slides, because it enters from an edge.
|
|
283
284
|
- **Forced colors.** The shadow drops and the transparent border draws as the system edge, so the dialog keeps its outline over the page.
|
|
284
285
|
|
|
@@ -473,10 +474,10 @@ Layer: Identity. ui: `UiSiteHeader`, `UiSiteAppearancePicker`.
|
|
|
473
474
|
- **States.** The project menu is closed or open; while open, its summary keeps the quiet action's hover tint. Site links take the navigation row states.
|
|
474
475
|
- **Do.** Keep the same header and site links, six at most and in one order, on every page of a personal product site.
|
|
475
476
|
- **Don't.** The site header on an application screen. An application keeps its own navigation.
|
|
476
|
-
- **Phone.** At `max-width: 800px` the header is static, with `--space-2` above, below, and between its rows. The first row holds the switcher at the start and the picker at the end. Where both do not fit, as at 320px, the picker wraps to its own row at the start; the project name never truncates. With three or more links, the links take the next row, as a strip that scrolls with its fades. Where the strip clips a link, at least 16px of that link stays in view under the fade: on the narrowest phones (a strip 340px wide or less, by container query) the strip's rows take 6px (`0.375rem`) side padding. A page with a [section rail](#section-rail) puts the rail's labelled trigger `--space-2` below the header.
|
|
477
|
+
- **Phone.** At `max-width: 800px` the header is static, with `--space-2` above, below, and between its rows. The first row holds the switcher at the start and the picker at the end. Where both do not fit, as at 320px, the picker wraps to its own row at the start; the project name never truncates. With three or more links, the links take the next row, as a strip that scrolls with its fades. Where the strip clips a link, at least 16px of that link stays in view under the fade: on the narrowest phones (a strip 340px wide or less, by container query) the strip's rows take 6px (`0.375rem`) side padding. One or two links stay on the first row, beside the picker; at `max-width: 640px` they become plain text links after the switcher, 12px (`--space-3`) apart, and the current link takes `--color-accent` text in medium weight, with no fill. A documentation page hides them at that width, because its [footer](#page-type-and-helpers) carries them. A page with a [section rail](#section-rail) puts the rail's labelled trigger `--space-2` below the header.
|
|
477
478
|
- **Keyboard and screen reader.** The summary is named "Project: <name>". Escape closes the menu and returns focus to the summary; moving focus out of it closes it.
|
|
478
479
|
- **Motion.** The chevron turns 180° while the menu is open, over `--duration-fast` with `--ease-out`. The menu itself opens at once.
|
|
479
|
-
- **Forced colors.** The rule below the header takes the system text colour, and the menu and the site links follow the navigation list rules.
|
|
480
|
+
- **Forced colors.** The rule below the header takes the system text colour, and the menu and the site links follow the navigation list rules. A current text link on a phone takes an underline instead of the system border.
|
|
480
481
|
|
|
481
482
|
## Page type and helpers
|
|
482
483
|
|