@instacks/peak 1.4.0 → 1.6.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.
- package/README.md +8 -2
- package/dist/peak-commands.js +34 -0
- package/dist/peak.css +55 -0
- package/dist/peak.min.css +1 -1
- package/dist/peak.scoped.css +55 -0
- package/dist/peak.scoped.min.css +1 -1
- package/package.json +5 -3
package/README.md
CHANGED
|
@@ -275,6 +275,9 @@ All of these work without JavaScript.
|
|
|
275
275
|
<!-- A toast in the corner; showing it after an action needs showPopover() -->
|
|
276
276
|
<div class="peak-toast success" popover="manual" role="status" id="saved">Saved.</div>
|
|
277
277
|
|
|
278
|
+
<!-- An icon: any single-color SVG as a mask, drawn in the text color (.sm, .lg, .xl) -->
|
|
279
|
+
<span class="peak-icon" style="--peak-icon: url(/icons/mail.svg)" aria-hidden="true"></span>
|
|
280
|
+
|
|
278
281
|
<!-- Stats, steps, avatars, pagination, sidebar navigation -->
|
|
279
282
|
<dl class="peak-stats"><div><dt>Downloads</dt><dd>1,284</dd></div></dl>
|
|
280
283
|
<ol class="peak-steps"><li>Download</li><li aria-current="step">Install</li><li>Activate</li></ol>
|
|
@@ -283,9 +286,12 @@ All of these work without JavaScript.
|
|
|
283
286
|
<aside><nav class="peak-sidebar-nav"><ul><li><a aria-current="page">…</a></li></ul></nav></aside>
|
|
284
287
|
```
|
|
285
288
|
|
|
286
|
-
|
|
289
|
+
Two small scripts ship for what CSS can't do. `@instacks/peak/scheme` (`dist/peak-scheme.js`)
|
|
287
290
|
remembers a `<select class="peak-scheme">` light/dark choice across pages. Load it in `<head>`
|
|
288
|
-
without `defer`; the select works for the current page without it.
|
|
291
|
+
without `defer`; the select works for the current page without it. `@instacks/peak/commands`
|
|
292
|
+
(`dist/peak-commands.js`) makes `command`/`commandfor` buttons and `closedby="any"` work in
|
|
293
|
+
browsers that don't have them yet (they arrived in 2025); where the browser has them it does
|
|
294
|
+
nothing.
|
|
289
295
|
|
|
290
296
|
## Accessibility preferences
|
|
291
297
|
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* peak-commands.js: command/commandfor and closedby="any" for browsers that don't have them yet
|
|
3
|
+
* (docs: site/pages/dialogs.html).
|
|
4
|
+
*
|
|
5
|
+
* Peak's dialogs and drawers open and close with attributes only (Invoker Commands,
|
|
6
|
+
* <button command="show-modal" commandfor="id">), which reached the major browsers during 2025,
|
|
7
|
+
* after Peak's browser baseline. Load this anywhere on the page (defer is fine) to make those
|
|
8
|
+
* buttons work in older browsers too. Where the browser has both features it does nothing.
|
|
9
|
+
*/
|
|
10
|
+
(() => {
|
|
11
|
+
if (!("command" in HTMLButtonElement.prototype)) {
|
|
12
|
+
document.addEventListener("click", (event) => {
|
|
13
|
+
const button = event.target.closest?.("button[commandfor]");
|
|
14
|
+
if (!button) return;
|
|
15
|
+
const target = document.getElementById(button.getAttribute("commandfor"));
|
|
16
|
+
const command = button.getAttribute("command");
|
|
17
|
+
if (!target) return;
|
|
18
|
+
if (command === "show-modal") target.showModal();
|
|
19
|
+
else if (command === "close") target.close(button.value || undefined);
|
|
20
|
+
else if (command === "request-close") (target.requestClose ?? target.close).call(target);
|
|
21
|
+
else if (command === "toggle-popover") target.togglePopover();
|
|
22
|
+
else if (command === "show-popover") target.showPopover();
|
|
23
|
+
else if (command === "hide-popover") target.hidePopover();
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
// closedby="any": a click on the dialog's own box outside its content (the backdrop) closes it
|
|
28
|
+
if (typeof HTMLDialogElement !== "undefined" && !("closedBy" in HTMLDialogElement.prototype)) {
|
|
29
|
+
document.addEventListener("click", (event) => {
|
|
30
|
+
const dialog = event.target;
|
|
31
|
+
if (dialog instanceof HTMLDialogElement && dialog.open && dialog.getAttribute("closedby") === "any") dialog.close();
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
})();
|
package/dist/peak.css
CHANGED
|
@@ -3939,6 +3939,10 @@
|
|
|
3939
3939
|
min-inline-size: 60%;
|
|
3940
3940
|
}
|
|
3941
3941
|
|
|
3942
|
+
.peak-with-sidebar.end > :is(aside, .peak-sidebar), .peak-with-sidebar.end > .out:has( > .peak-sidebar) {
|
|
3943
|
+
order: 1;
|
|
3944
|
+
}
|
|
3945
|
+
|
|
3942
3946
|
@container peak-sidebar (width >= 45rem) {
|
|
3943
3947
|
.peak-with-sidebar.sticky > :is(aside, .peak-sidebar), .peak-with-sidebar.sticky > .out:has( > .peak-sidebar) {
|
|
3944
3948
|
align-self: start;
|
|
@@ -3974,6 +3978,10 @@
|
|
|
3974
3978
|
align-items: center;
|
|
3975
3979
|
}
|
|
3976
3980
|
|
|
3981
|
+
.peak-media.end > :first-child {
|
|
3982
|
+
order: 1;
|
|
3983
|
+
}
|
|
3984
|
+
|
|
3977
3985
|
.peak-switcher {
|
|
3978
3986
|
gap: var(--peak-gap, var(--pico-spacing));
|
|
3979
3987
|
flex-wrap: wrap;
|
|
@@ -4080,6 +4088,10 @@
|
|
|
4080
4088
|
margin-block-start: var(--pico-typography-spacing-vertical) !important;
|
|
4081
4089
|
}
|
|
4082
4090
|
|
|
4091
|
+
:is(.peak-callout, .peak-accordion > details, [popover], .site-footer, :scope.site-footer) > .out:last-child > .stacks_in > :last-child {
|
|
4092
|
+
margin-block-end: 0;
|
|
4093
|
+
}
|
|
4094
|
+
|
|
4083
4095
|
@media (width < 576px) {
|
|
4084
4096
|
.stacks_in.peak-hide-below-sm {
|
|
4085
4097
|
display: none !important;
|
|
@@ -4144,6 +4156,10 @@
|
|
|
4144
4156
|
}
|
|
4145
4157
|
}
|
|
4146
4158
|
|
|
4159
|
+
[data-peak-anchor] > [popovertarget] {
|
|
4160
|
+
margin-block-end: 0;
|
|
4161
|
+
}
|
|
4162
|
+
|
|
4147
4163
|
:is([popover="hint"], [role="tooltip"][popover]) {
|
|
4148
4164
|
border-radius: var(--pico-border-radius);
|
|
4149
4165
|
background-color: var(--pico-tooltip-background-color);
|
|
@@ -5136,6 +5152,45 @@
|
|
|
5136
5152
|
background-clip: text;
|
|
5137
5153
|
}
|
|
5138
5154
|
|
|
5155
|
+
.peak-icon {
|
|
5156
|
+
inline-size: var(--peak-icon-size, 1.25em);
|
|
5157
|
+
block-size: var(--peak-icon-size, 1.25em);
|
|
5158
|
+
vertical-align: middle;
|
|
5159
|
+
mask: var(--peak-icon) center / contain no-repeat;
|
|
5160
|
+
forced-color-adjust: none;
|
|
5161
|
+
-webkit-print-color-adjust: exact;
|
|
5162
|
+
print-color-adjust: exact;
|
|
5163
|
+
background-color: currentColor;
|
|
5164
|
+
flex: none;
|
|
5165
|
+
display: inline-block;
|
|
5166
|
+
}
|
|
5167
|
+
|
|
5168
|
+
.peak-icon.sm {
|
|
5169
|
+
--peak-icon-size: 1em;
|
|
5170
|
+
}
|
|
5171
|
+
|
|
5172
|
+
.peak-icon.lg {
|
|
5173
|
+
--peak-icon-size: 1.75em;
|
|
5174
|
+
}
|
|
5175
|
+
|
|
5176
|
+
.peak-icon.xl {
|
|
5177
|
+
--peak-icon-size: 2.5em;
|
|
5178
|
+
}
|
|
5179
|
+
|
|
5180
|
+
:where(a:not([role="button"], aside li a, .dropdown li a, [popover] li a):has( > .peak-icon)) {
|
|
5181
|
+
align-items: baseline;
|
|
5182
|
+
gap: .25em;
|
|
5183
|
+
display: inline-flex;
|
|
5184
|
+
}
|
|
5185
|
+
|
|
5186
|
+
:where(a:not([role="button"], aside li a, .dropdown li a, [popover] li a)) > .peak-icon {
|
|
5187
|
+
line-height: var(--peak-icon-size, 1.25em);
|
|
5188
|
+
}
|
|
5189
|
+
|
|
5190
|
+
:where(a:not([role="button"], aside li a, .dropdown li a, [popover] li a)) > .peak-icon:before {
|
|
5191
|
+
content: "" / "";
|
|
5192
|
+
}
|
|
5193
|
+
|
|
5139
5194
|
.site-nav .site-menu, .site-nav .site-menu-popover[popover] {
|
|
5140
5195
|
display: contents;
|
|
5141
5196
|
}
|