staffa 0.13.0 → 0.15.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 +19 -16
- package/dist/components/dialog.js +1 -1
- package/dist/components/main.d.ts +37 -48
- package/dist/components/main.js +25 -61
- package/dist/components/menu.d.ts +8 -0
- package/dist/components/menu.js +40 -6
- package/dist/components/panels.d.ts +114 -82
- package/dist/components/panels.js +198 -230
- package/dist/components/select.js +4 -2
- package/dist/components/tabs.js +5 -4
- package/dist/components/tooltip.js +2 -1
- package/dist/index.d.ts +1 -1
- package/dist/staffa.esm.js +1 -1
- package/dist/theme.d.ts +13 -65
- package/dist/theme.js +21 -8
- package/package.json +1 -1
- package/skill/FloatingMenuOptions.md +10 -0
- package/skill/MainOptions.md +35 -49
- package/skill/Panel.md +31 -32
- package/skill/PanelStack.md +4 -4
- package/skill/SKILL.md +29 -16
- package/skill/main.md +2 -1
- package/src/components/dialog.ts +1 -1
- package/src/components/main.ts +62 -108
- package/src/components/menu.ts +50 -7
- package/src/components/panels.ts +269 -290
- package/src/components/select.ts +4 -2
- package/src/components/tabs.ts +3 -2
- package/src/components/tooltip.ts +2 -1
- package/src/index.ts +1 -1
- package/src/theme.ts +24 -9
package/src/components/select.ts
CHANGED
|
@@ -37,8 +37,10 @@ A.insertGlobalCss({
|
|
|
37
37
|
*/
|
|
38
38
|
export function select(opts: SelectOptions): void {
|
|
39
39
|
drawField(opts, (id, isInvalid) => {
|
|
40
|
-
A("div.s-select_wrap",
|
|
41
|
-
|
|
40
|
+
A("div.s-select_wrap", () => {
|
|
41
|
+
// On the <select> itself, like every other field control — an
|
|
42
|
+
// aria-label on the wrapper div would label nothing.
|
|
43
|
+
A("select.s-input", opts.inputAttrs, () => {
|
|
42
44
|
applyControlAttrs(opts, id, isInvalid);
|
|
43
45
|
|
|
44
46
|
A("change=", (e: Event) => {
|
package/src/components/tabs.ts
CHANGED
|
@@ -144,8 +144,9 @@ export function revealInStrip(el: HTMLElement): void {
|
|
|
144
144
|
// revealed item from sitting right against one.
|
|
145
145
|
const pad = parseFloat(getComputedStyle(row).fontSize) * 2.6;
|
|
146
146
|
const box = el.getBoundingClientRect(), strip = row.getBoundingClientRect();
|
|
147
|
-
|
|
148
|
-
|
|
147
|
+
const left = box.left - strip.left, right = box.right - strip.right;
|
|
148
|
+
if (left < pad) row.scrollBy({ left: left - pad, behavior: "smooth" });
|
|
149
|
+
else if (right > -pad) row.scrollBy({ left: right + pad, behavior: "smooth" });
|
|
149
150
|
}
|
|
150
151
|
|
|
151
152
|
/**
|
|
@@ -96,7 +96,8 @@ mountPortal(() => {
|
|
|
96
96
|
|
|
97
97
|
requestAnimationFrame(() => {
|
|
98
98
|
if (!document.body.contains(tipEl)) return;
|
|
99
|
-
const
|
|
99
|
+
const rect = anchor.getBoundingClientRect();
|
|
100
|
+
const { x, y } = computePos(rect, tipEl.offsetWidth, tipEl.offsetHeight, placement);
|
|
100
101
|
tipEl.style.left = x + "px";
|
|
101
102
|
tipEl.style.top = y + "px";
|
|
102
103
|
tipEl.style.visibility = "";
|
package/src/index.ts
CHANGED
|
@@ -41,7 +41,7 @@ export { buttonGroup, type ButtonGroupOptions } from "./components/buttonGroup.j
|
|
|
41
41
|
export { checkbox, type CheckboxOptions } from "./components/checkbox.js";
|
|
42
42
|
export { form, type FormOptions } from "./components/form.js";
|
|
43
43
|
export { main, closeNav, type MainOptions } from "./components/main.js";
|
|
44
|
-
export { type PanelStack, type Panel, type Routes, type RouteHandler, type RouteTable, type AncestorsHandler, type AncestorTable, type PathParams, type SegParams } from "./components/panels.js";
|
|
44
|
+
export { type PanelStack, type Panel, type PanelSize, type Routes, type RouteHandler, type RouteTable, type AncestorsHandler, type AncestorTable, type PathParams, type SegParams } from "./components/panels.js";
|
|
45
45
|
export { menu, menuButton, showFloatingMenu, addContextMenu, isFloatingMenuOpen, closeFloatingMenu, type MenuListOptions, type MenuOptions, type MenuEntry, type MenuItem, type MenuSeparator, type FloatingMenuOptions, type ContextMenuOptions } from "./components/menu.js";
|
|
46
46
|
export { dialog, alert, confirm, prompt, isDialogOpen, type DialogOptions } from "./components/dialog.js";
|
|
47
47
|
export { select, type SelectOptions, type SelectOptionInput } from "./components/select.js";
|
package/src/theme.ts
CHANGED
|
@@ -59,16 +59,31 @@ import A from "aberdeen";
|
|
|
59
59
|
*/
|
|
60
60
|
|
|
61
61
|
/**
|
|
62
|
-
* The
|
|
63
|
-
*
|
|
64
|
-
*
|
|
65
|
-
*
|
|
66
|
-
*
|
|
67
|
-
* used by panels.ts, where the routed columns have to visually *be* the
|
|
68
|
-
* surface around them.
|
|
62
|
+
* The subtle single-colour wash a surface is painted with, as a `background:`
|
|
63
|
+
* declaration, at the given angle. Shared constants rather than a CSS custom
|
|
64
|
+
* property, deliberately: `var()`s inside a custom property resolve where the
|
|
65
|
+
* property is *defined*, so a `--s-sheen` at `:root` would paint every surface
|
|
66
|
+
* with the page's wash instead of its own `$s-bg`'s.
|
|
69
67
|
*/
|
|
70
|
-
|
|
71
|
-
|
|
68
|
+
const sheen = (angle: string) =>
|
|
69
|
+
`background: linear-gradient(${angle}, color-mix(in oklab, $s-bg, white 9%), color-mix(in oklab, $s-bg, black 9%));`;
|
|
70
|
+
|
|
71
|
+
/** The surface sheen: the wash every surface (and the page) is painted with. */
|
|
72
|
+
export const SURFACE_SHEEN = sheen("170deg");
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* The same wash, straight down — for panels.ts, where the routed columns and
|
|
76
|
+
* the ground beside them have to look like one continuous surface.
|
|
77
|
+
*
|
|
78
|
+
* A gradient at an angle takes its extent from the box's *width* as well as its
|
|
79
|
+
* height, so a 430px column and the 1720px region behind it would paint
|
|
80
|
+
* different slices of the same wash and meet at a visible step. Straight down,
|
|
81
|
+
* the extent is the height alone — which every column shares exactly with the
|
|
82
|
+
* region (a column is `top:0 bottom:0` in it) and so with every other column.
|
|
83
|
+
* The 10° of tilt is worth losing there; it buys the one place in the app where
|
|
84
|
+
* boxes of *different widths* must be seamless.
|
|
85
|
+
*/
|
|
86
|
+
export const PANEL_SHEEN = sheen("180deg");
|
|
72
87
|
|
|
73
88
|
const STORAGE_KEY = "staffa:darkMode";
|
|
74
89
|
|