mirror of
https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak.git
synced 2026-12-03 03:52:50 +08:00
feat(skin): match Classic toolbar icon buttons for host recovery
Add slot appearance "icon" and "icon-and-label", allow an explicit 22px toolbar height, preserve transparent backgrounds, and introduce hover, surface, gap, and icon-size tokens so host-owned recovery and library buttons can match the Classic microphone control. Shortcut and failed- anchor fallbacks stay full label capsules. Update the example skin, docs, and tests, including a Classic toolbar fixture.
This commit is contained in:
1 parent
4131d9c319
commit
df826f575e
18 files changed
+805
-160
No files matched your search
@@ -48,18 +48,42 @@
|
||||
<button
|
||||
type="button"
|
||||
class="ws-host-toolbar-action"
|
||||
:class="{ 'ws-host-toolbar-action-icon': groupToolbarConfig.appearance === 'icon' }"
|
||||
data-ws-recovery-action="built-in"
|
||||
:aria-label="copy.useBuiltIn"
|
||||
:title="copy.shortcut"
|
||||
@click="useBuiltInSkin"
|
||||
>{{ copy.useBuiltIn }}</button>
|
||||
>
|
||||
<span v-if="groupToolbarConfig.appearance !== 'label'" class="ws-host-toolbar-icon" aria-hidden="true">
|
||||
<svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round" focusable="false">
|
||||
<path d="M8 2.2a5.8 5.8 0 1 0 0 11.6h.9a1.5 1.5 0 0 0 .7-2.83 1.2 1.2 0 0 1 .6-2.25H12A2 2 0 0 0 14 6.8C14 4.1 11.3 2.2 8 2.2Z"/>
|
||||
<circle cx="5" cy="6" r=".7" fill="currentColor" stroke="none"/>
|
||||
<circle cx="7.2" cy="4.6" r=".7" fill="currentColor" stroke="none"/>
|
||||
<circle cx="10" cy="4.9" r=".7" fill="currentColor" stroke="none"/>
|
||||
</svg>
|
||||
</span>
|
||||
<span v-if="groupToolbarConfig.appearance !== 'icon'" class="ws-host-toolbar-label">{{ copy.useBuiltIn }}</span>
|
||||
</button>
|
||||
<button
|
||||
v-if="pluginLibraryAvailable"
|
||||
type="button"
|
||||
class="ws-host-toolbar-action"
|
||||
:class="{ 'ws-host-toolbar-action-icon': groupToolbarConfig.appearance === 'icon' }"
|
||||
data-ws-recovery-action="library"
|
||||
:aria-label="copy.library"
|
||||
:title="copy.library"
|
||||
@click="openLibrary"
|
||||
>{{ copy.library }}</button>
|
||||
>
|
||||
<span v-if="groupToolbarConfig.appearance !== 'label'" class="ws-host-toolbar-icon" aria-hidden="true">
|
||||
<svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round" focusable="false">
|
||||
<rect x="2.2" y="2.2" width="4.6" height="4.6" rx=".8"/>
|
||||
<rect x="9.2" y="2.2" width="4.6" height="4.6" rx=".8"/>
|
||||
<rect x="2.2" y="9.2" width="4.6" height="4.6" rx=".8"/>
|
||||
<rect x="9.2" y="9.2" width="4.6" height="4.6" rx=".8"/>
|
||||
</svg>
|
||||
</span>
|
||||
<span v-if="groupToolbarConfig.appearance !== 'icon'" class="ws-host-toolbar-label">{{ copy.library }}</span>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<!-- Per-action toolbar entries: each action has its own anchor. -->
|
||||
@@ -75,10 +99,22 @@
|
||||
<button
|
||||
type="button"
|
||||
class="ws-host-toolbar-action"
|
||||
:class="{ 'ws-host-toolbar-action-icon': builtInToolbarConfig.appearance === 'icon' }"
|
||||
data-ws-recovery-action="built-in"
|
||||
:aria-label="copy.useBuiltIn"
|
||||
:title="copy.shortcut"
|
||||
@click="useBuiltInSkin"
|
||||
>{{ copy.useBuiltIn }}</button>
|
||||
>
|
||||
<span v-if="builtInToolbarConfig.appearance !== 'label'" class="ws-host-toolbar-icon" aria-hidden="true">
|
||||
<svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round" focusable="false">
|
||||
<path d="M8 2.2a5.8 5.8 0 1 0 0 11.6h.9a1.5 1.5 0 0 0 .7-2.83 1.2 1.2 0 0 1 .6-2.25H12A2 2 0 0 0 14 6.8C14 4.1 11.3 2.2 8 2.2Z"/>
|
||||
<circle cx="5" cy="6" r=".7" fill="currentColor" stroke="none"/>
|
||||
<circle cx="7.2" cy="4.6" r=".7" fill="currentColor" stroke="none"/>
|
||||
<circle cx="10" cy="4.9" r=".7" fill="currentColor" stroke="none"/>
|
||||
</svg>
|
||||
</span>
|
||||
<span v-if="builtInToolbarConfig.appearance !== 'icon'" class="ws-host-toolbar-label">{{ copy.useBuiltIn }}</span>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div
|
||||
@@ -93,10 +129,22 @@
|
||||
<button
|
||||
type="button"
|
||||
class="ws-host-toolbar-action"
|
||||
:class="{ 'ws-host-toolbar-action-icon': libraryToolbarConfig.appearance === 'icon' }"
|
||||
data-ws-recovery-action="library"
|
||||
:aria-label="copy.library"
|
||||
:title="copy.library"
|
||||
@click="openLibrary"
|
||||
>{{ copy.library }}</button>
|
||||
>
|
||||
<span v-if="libraryToolbarConfig.appearance !== 'label'" class="ws-host-toolbar-icon" aria-hidden="true">
|
||||
<svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round" focusable="false">
|
||||
<rect x="2.2" y="2.2" width="4.6" height="4.6" rx=".8"/>
|
||||
<rect x="9.2" y="2.2" width="4.6" height="4.6" rx=".8"/>
|
||||
<rect x="2.2" y="9.2" width="4.6" height="4.6" rx=".8"/>
|
||||
<rect x="9.2" y="9.2" width="4.6" height="4.6" rx=".8"/>
|
||||
</svg>
|
||||
</span>
|
||||
<span v-if="libraryToolbarConfig.appearance !== 'icon'" class="ws-host-toolbar-label">{{ copy.library }}</span>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div
|
||||
@@ -254,7 +302,7 @@ const RECOVERY_LAYER_CSS = `
|
||||
align-items: center;
|
||||
justify-content: flex-start;
|
||||
flex-wrap: wrap;
|
||||
gap: 4px;
|
||||
gap: var(--ws-toolbar-gap, 4px);
|
||||
max-width: calc(100vw - 8px);
|
||||
pointer-events: auto;
|
||||
}
|
||||
@@ -263,6 +311,7 @@ const RECOVERY_LAYER_CSS = `
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 4px;
|
||||
box-sizing: border-box;
|
||||
min-height: var(--ws-toolbar-min-height, var(--ws-control-hit, 28px));
|
||||
max-width: min(320px, calc(100vw - 8px));
|
||||
@@ -281,11 +330,25 @@ const RECOVERY_LAYER_CSS = `
|
||||
cursor: pointer;
|
||||
touch-action: manipulation;
|
||||
}
|
||||
.ws-host-toolbar-action:hover { filter: brightness(.96); }
|
||||
.ws-host-toolbar-action:hover {
|
||||
border-color: var(--ws-toolbar-hover-border, var(--ws-toolbar-border, #9db6b2));
|
||||
background: var(--ws-toolbar-hover-background, var(--ws-toolbar-background, #fff));
|
||||
}
|
||||
.ws-host-toolbar-action:focus-visible {
|
||||
outline: 2px solid var(--ws-toolbar-focus, var(--ws-control-accent, #4c8f88));
|
||||
outline-offset: 2px;
|
||||
}
|
||||
.ws-host-toolbar-icon {
|
||||
display: block;
|
||||
flex: 0 0 auto;
|
||||
width: var(--ws-toolbar-icon-size, 16px);
|
||||
height: var(--ws-toolbar-icon-size, 16px);
|
||||
}
|
||||
.ws-host-toolbar-icon svg { display: block; width: 100%; height: 100%; }
|
||||
.ws-host-toolbar-action-icon {
|
||||
width: max(24px, calc(var(--ws-toolbar-icon-size, 16px) + 8px));
|
||||
padding: 0;
|
||||
}
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
.ws-host-recovery, .ws-host-recovery button, .ws-host-toolbar-action { transition: none !important; }
|
||||
}
|
||||
|
||||
@@ -133,6 +133,7 @@ test("slot declarations are honoured for third-party skins only", () => {
|
||||
align: "end",
|
||||
compact: false,
|
||||
mode: "capsule",
|
||||
appearance: "label",
|
||||
});
|
||||
// A part that is not slottable cannot be selected through chrome.json.
|
||||
assert.equal(activeHostSlot("host.permission"), undefined);
|
||||
|
||||
@@ -13,14 +13,21 @@ import {
|
||||
PERMISSION_CONTROL_DEFAULTS,
|
||||
RECOVERY_CONTROL_DEFAULTS,
|
||||
SKIN_LOAD_RECOVERY_CONTROL_DEFAULTS,
|
||||
TOOLBAR_DEFAULT_GAP,
|
||||
TOOLBAR_DEFAULT_ICON_SIZE,
|
||||
TOOLBAR_DEFAULT_PADDING_X,
|
||||
TOOLBAR_DEFAULT_PADDING_Y,
|
||||
TOOLBAR_DEFAULT_RADIUS,
|
||||
TOOLBAR_MAX_FONT_SIZE,
|
||||
TOOLBAR_MAX_GAP,
|
||||
TOOLBAR_MAX_HEIGHT,
|
||||
TOOLBAR_MAX_ICON_SIZE,
|
||||
TOOLBAR_MAX_PADDING,
|
||||
TOOLBAR_MIN_HEIGHT,
|
||||
TOOLBAR_MIN_ICON_SIZE,
|
||||
applyHostControlTokens,
|
||||
applyHostControlToolbarTokens,
|
||||
compositeRgb,
|
||||
contrastRatio,
|
||||
fontFamilyNames,
|
||||
formatRgb,
|
||||
@@ -30,6 +37,7 @@ import {
|
||||
hostControlTokenProperty,
|
||||
hostToolbarTokenProperty,
|
||||
parseCssColor,
|
||||
parseCssColorWithAlpha,
|
||||
relativeLuminance,
|
||||
resolveHostControlTokens,
|
||||
resolveHostControlToolbarTokens,
|
||||
@@ -265,6 +273,13 @@ test("CSS colours parse to RGB and ignore alpha for contrast", () => {
|
||||
}
|
||||
});
|
||||
|
||||
test("alpha colours parse and composite over opaque toolbar surfaces", () => {
|
||||
assert.deepEqual(parseCssColorWithAlpha("transparent"), { r: 0, g: 0, b: 0, a: 0 });
|
||||
assert.deepEqual(parseCssColorWithAlpha("#10203080"), { r: 16, g: 32, b: 48, a: 128 / 255 });
|
||||
assert.deepEqual(parseCssColorWithAlpha("rgb(255 0 0 / 50%)"), { r: 255, g: 0, b: 0, a: 0.5 });
|
||||
assert.deepEqual(compositeRgb({ r: 0, g: 0, b: 0, a: 0.5 }, { r: 255, g: 255, b: 255 }), { r: 128, g: 128, b: 128 });
|
||||
});
|
||||
|
||||
test("WCAG contrast follows the relative-luminance formula", () => {
|
||||
assert.equal(relativeLuminance({ r: 0, g: 0, b: 0 }), 0);
|
||||
assert.equal(relativeLuminance({ r: 255, g: 255, b: 255 }), 1);
|
||||
@@ -293,12 +308,14 @@ test("host controls ignore fonts registered by a skin @font-face", () => {
|
||||
assert.equal(resolve("Tahoma, ws-community-evil-blank"), SKIN_LOAD_RECOVERY_CONTROL_DEFAULTS.font);
|
||||
});
|
||||
|
||||
const resolveToolbar = (tokens: TokenMap = {}, global: TokenMap = {}) =>
|
||||
const resolveToolbar = (tokens: TokenMap = {}, global: TokenMap = {}, sampledSurface?: { r: number; g: number; b: number }) =>
|
||||
resolveHostControlToolbarTokens(
|
||||
style({ ...prefixed("host", {}), ...tokens, ...global }),
|
||||
style({ ...tokens, ...global }),
|
||||
"host.recovery",
|
||||
raw => raw,
|
||||
RECOVERY_CONTROL_DEFAULTS,
|
||||
undefined,
|
||||
sampledSurface,
|
||||
);
|
||||
|
||||
test("toolbar tokens are independent of the capsule shell and keep host floors", () => {
|
||||
@@ -341,16 +358,98 @@ test("toolbar tokens are independent of the capsule shell and keep host floors",
|
||||
assert.equal(global.foreground, "rgb(255, 255, 255)");
|
||||
});
|
||||
|
||||
test("unreadable or invalid toolbar tokens fall back to a visible, readable button", () => {
|
||||
// Transparent backgrounds are treated as opaque RGB by parseCssColor; the
|
||||
// result is unreadable against the text and the whole pair reverts.
|
||||
const transparent = resolveToolbar({
|
||||
"--skin-recovery-toolbar-background": "rgba(0, 0, 0, 0)",
|
||||
"--skin-recovery-toolbar-foreground": "#111111",
|
||||
test("toolbar colours preserve transparency and check text against an opaque surface", () => {
|
||||
const classic = resolveToolbar({
|
||||
"--skin-recovery-toolbar-background": "transparent",
|
||||
"--skin-recovery-toolbar-foreground": "#1a1a1a",
|
||||
"--skin-recovery-toolbar-border": "transparent",
|
||||
"--skin-recovery-toolbar-hover-background": "#eaf2fd",
|
||||
"--skin-recovery-toolbar-hover-border": "#b8cfe8",
|
||||
}, {}, { r: 255, g: 255, b: 255 });
|
||||
assert.equal(classic.background, "transparent");
|
||||
assert.equal(classic.border, "transparent");
|
||||
assert.equal(classic.foreground, "rgb(26, 26, 26)");
|
||||
assert.equal(classic.hoverBackground, "rgb(234, 242, 253)");
|
||||
assert.equal(classic.hoverBorder, "rgb(184, 207, 232)");
|
||||
|
||||
const explicitDarkSurface = resolveToolbar({
|
||||
"--skin-recovery-toolbar-background": "#00000000",
|
||||
"--skin-recovery-toolbar-foreground": "#ffffff",
|
||||
"--skin-recovery-toolbar-surface": "#102030",
|
||||
}, {}, { r: 255, g: 255, b: 255 });
|
||||
assert.equal(explicitDarkSurface.background, "transparent");
|
||||
assert.equal(explicitDarkSurface.foreground, "rgb(255, 255, 255)");
|
||||
|
||||
const sampledDarkSurface = resolveToolbar({
|
||||
"--skin-recovery-toolbar-background": "transparent",
|
||||
"--skin-recovery-toolbar-foreground": "#ffffff",
|
||||
}, {}, { r: 16, g: 32, b: 48 });
|
||||
assert.equal(sampledDarkSurface.background, "transparent");
|
||||
assert.equal(sampledDarkSurface.foreground, "rgb(255, 255, 255)");
|
||||
|
||||
const globalSurface = resolveToolbar({
|
||||
"--skin-recovery-toolbar-background": "transparent",
|
||||
"--skin-recovery-toolbar-foreground": "#ffffff",
|
||||
}, { "--skin-host-toolbar-surface": "#102030" }, { r: 255, g: 255, b: 255 });
|
||||
assert.equal(globalSurface.foreground, "rgb(255, 255, 255)");
|
||||
});
|
||||
|
||||
test("toolbar hover colours and Classic geometry are sanitized independently", () => {
|
||||
const classic = resolveToolbar({
|
||||
"--skin-recovery-toolbar-height": "22px",
|
||||
"--skin-recovery-toolbar-padding": "0 4px",
|
||||
"--skin-recovery-toolbar-radius": "2px",
|
||||
"--skin-recovery-toolbar-font-size": "11px",
|
||||
"--skin-recovery-toolbar-gap": "1px",
|
||||
"--skin-recovery-toolbar-icon-size": "16px",
|
||||
});
|
||||
assert.equal(transparent.background, "rgb(255, 255, 255)");
|
||||
assert.equal(transparent.foreground, "rgb(49, 82, 79)");
|
||||
assert.ok(contrastRatio(parseCssColor(transparent.foreground)!, parseCssColor(transparent.background)!) >= HOST_CONTROL_MIN_FOREGROUND_CONTRAST);
|
||||
assert.equal(classic.minHeight, 22);
|
||||
assert.equal(classic.paddingX, 4);
|
||||
assert.equal(classic.paddingY, 0);
|
||||
assert.equal(classic.radius, 2);
|
||||
assert.equal(classic.fontSize, 11);
|
||||
assert.equal(classic.gap, 1);
|
||||
assert.equal(classic.iconSize, 16);
|
||||
|
||||
const unreadableHover = resolveToolbar({
|
||||
"--skin-recovery-toolbar-background": "#ffffff",
|
||||
"--skin-recovery-toolbar-foreground": "#757575",
|
||||
"--skin-recovery-toolbar-hover-background": "#eeeeee",
|
||||
"--skin-recovery-toolbar-hover-border": "not-a-colour",
|
||||
});
|
||||
assert.equal(unreadableHover.hoverBackground, "rgb(255, 255, 255)");
|
||||
assert.equal(unreadableHover.hoverBorder, "rgb(157, 182, 178)");
|
||||
|
||||
const clamped = resolveToolbar({
|
||||
"--skin-recovery-toolbar-gap": "100px",
|
||||
"--skin-recovery-toolbar-icon-size": "2px",
|
||||
});
|
||||
assert.equal(clamped.gap, TOOLBAR_MAX_GAP);
|
||||
assert.equal(clamped.iconSize, TOOLBAR_MIN_ICON_SIZE);
|
||||
const oversized = resolveToolbar({ "--skin-recovery-toolbar-icon-size": "100px" });
|
||||
assert.equal(oversized.iconSize, TOOLBAR_MAX_ICON_SIZE);
|
||||
assert.equal(resolveToolbar().gap, TOOLBAR_DEFAULT_GAP);
|
||||
assert.equal(resolveToolbar().iconSize, TOOLBAR_DEFAULT_ICON_SIZE);
|
||||
});
|
||||
|
||||
test("capsule tokens keep their opaque palette and 28px hit target", () => {
|
||||
const capsule = resolveHostControlTokens(style({
|
||||
"--skin-recovery-background": "transparent",
|
||||
"--skin-recovery-foreground": "#1a1a1a",
|
||||
"--skin-recovery-toolbar-height": "22px",
|
||||
}), "host.recovery", raw => raw, RECOVERY_CONTROL_DEFAULTS);
|
||||
assert.equal(capsule.background, "rgb(255, 255, 255)");
|
||||
assert.equal(capsule.hitTarget, 28);
|
||||
});
|
||||
|
||||
test("unreadable or invalid toolbar tokens fall back to a visible, readable button", () => {
|
||||
const transparentUnreadable = resolveToolbar({
|
||||
"--skin-recovery-toolbar-background": "rgba(0, 0, 0, 0)",
|
||||
"--skin-recovery-toolbar-foreground": "#ffffff",
|
||||
}, {}, { r: 255, g: 255, b: 255 });
|
||||
assert.equal(transparentUnreadable.background, "rgb(255, 255, 255)");
|
||||
assert.equal(transparentUnreadable.foreground, "rgb(49, 82, 79)");
|
||||
assert.ok(contrastRatio(parseCssColor(transparentUnreadable.foreground)!, parseCssColor(transparentUnreadable.background)!) >= HOST_CONTROL_MIN_FOREGROUND_CONTRAST);
|
||||
|
||||
const lowContrast = resolveToolbar({
|
||||
"--skin-recovery-toolbar-background": "#777777",
|
||||
@@ -377,7 +476,7 @@ test("unreadable or invalid toolbar tokens fall back to a visible, readable butt
|
||||
// A syntactically valid but oversized padding is clamped, not applied raw.
|
||||
assert.equal(invalid.paddingX, TOOLBAR_MAX_PADDING);
|
||||
assert.equal(invalid.paddingY, TOOLBAR_MAX_PADDING);
|
||||
assert.equal(invalid.minHeight, HOST_CONTROL_MIN_HIT_TARGET);
|
||||
assert.equal(invalid.minHeight, TOOLBAR_MIN_HEIGHT);
|
||||
assert.equal(invalid.shadow, "none");
|
||||
|
||||
const oversized = resolveToolbar({
|
||||
@@ -418,16 +517,24 @@ test("applying and clearing toolbar tokens writes only toolbar variables", () =>
|
||||
},
|
||||
} as unknown as HTMLElement;
|
||||
applyHostControlToolbarTokens(control, resolveToolbar({
|
||||
"--skin-recovery-toolbar-background": "#102030",
|
||||
"--skin-recovery-toolbar-foreground": "#ffffff",
|
||||
"--skin-recovery-toolbar-background": "#ffffff",
|
||||
"--skin-recovery-toolbar-foreground": "#1a1a1a",
|
||||
"--skin-recovery-toolbar-padding": "6px 14px",
|
||||
"--skin-recovery-toolbar-height": "36px",
|
||||
"--skin-recovery-toolbar-hover-background": "#eaf2fd",
|
||||
"--skin-recovery-toolbar-hover-border": "#b8cfe8",
|
||||
"--skin-recovery-toolbar-gap": "1px",
|
||||
"--skin-recovery-toolbar-icon-size": "16px",
|
||||
}));
|
||||
assert.equal(values.get(HOST_TOOLBAR_APPLIED_VARIABLES.background), "rgb(16, 32, 48)");
|
||||
assert.equal(values.get(HOST_TOOLBAR_APPLIED_VARIABLES.foreground), "rgb(255, 255, 255)");
|
||||
assert.equal(values.get(HOST_TOOLBAR_APPLIED_VARIABLES.background), "rgb(255, 255, 255)");
|
||||
assert.equal(values.get(HOST_TOOLBAR_APPLIED_VARIABLES.foreground), "rgb(26, 26, 26)");
|
||||
assert.equal(values.get(HOST_TOOLBAR_APPLIED_VARIABLES.paddingX), "14px");
|
||||
assert.equal(values.get(HOST_TOOLBAR_APPLIED_VARIABLES.paddingY), "6px");
|
||||
assert.equal(values.get(HOST_TOOLBAR_APPLIED_VARIABLES.minHeight), "36px");
|
||||
assert.equal(values.get(HOST_TOOLBAR_APPLIED_VARIABLES.hoverBackground), "rgb(234, 242, 253)");
|
||||
assert.equal(values.get(HOST_TOOLBAR_APPLIED_VARIABLES.hoverBorder), "rgb(184, 207, 232)");
|
||||
assert.equal(values.get(HOST_TOOLBAR_APPLIED_VARIABLES.gap), "1px");
|
||||
assert.equal(values.get(HOST_TOOLBAR_APPLIED_VARIABLES.iconSize), "16px");
|
||||
applyHostControlToolbarTokens(control, null);
|
||||
assert.equal(values.size, 0);
|
||||
});
|
||||
@@ -58,6 +58,7 @@ export type HostControlTokenName = (typeof HOST_CONTROL_TOKEN_NAMES)[number];
|
||||
*/
|
||||
export const HOST_TOOLBAR_TOKEN_NAMES = [
|
||||
"background", "foreground", "border", "radius", "font", "font-size", "padding", "height", "shadow",
|
||||
"hover-background", "hover-border", "surface", "gap", "icon-size",
|
||||
] as const;
|
||||
|
||||
export type HostToolbarTokenName = (typeof HOST_TOOLBAR_TOKEN_NAMES)[number];
|
||||
@@ -72,6 +73,11 @@ export const HOST_TOOLBAR_GLOBAL_TOKEN_PROPERTIES: Readonly<Record<HostToolbarTo
|
||||
padding: "--skin-host-toolbar-padding",
|
||||
height: "--skin-host-toolbar-height",
|
||||
shadow: "--skin-host-toolbar-shadow",
|
||||
"hover-background": "--skin-host-toolbar-hover-background",
|
||||
"hover-border": "--skin-host-toolbar-hover-border",
|
||||
surface: "--skin-host-toolbar-surface",
|
||||
gap: "--skin-host-toolbar-gap",
|
||||
"icon-size": "--skin-host-toolbar-icon-size",
|
||||
};
|
||||
|
||||
/** Global token set read from the active skin root (or a slot anchor). */
|
||||
@@ -135,6 +141,10 @@ export const HOST_TOOLBAR_APPLIED_VARIABLES = {
|
||||
minHeight: "--ws-toolbar-min-height",
|
||||
shadow: "--ws-toolbar-shadow",
|
||||
focus: "--ws-toolbar-focus",
|
||||
hoverBackground: "--ws-toolbar-hover-background",
|
||||
hoverBorder: "--ws-toolbar-hover-border",
|
||||
gap: "--ws-toolbar-gap",
|
||||
iconSize: "--ws-toolbar-icon-size",
|
||||
} as const;
|
||||
|
||||
export interface HostControlRawTokens {
|
||||
@@ -189,9 +199,15 @@ export interface HostControlToolbarTokens {
|
||||
fontSize: number;
|
||||
paddingX: number;
|
||||
paddingY: number;
|
||||
/** Minimum button height; never below the current size tier hit target. */
|
||||
/** Minimum button height; defaults to the size tier and may reach 22px in toolbar mode. */
|
||||
minHeight: number;
|
||||
shadow: string;
|
||||
hoverBackground: string;
|
||||
hoverBorder: string;
|
||||
/** Space between grouped host buttons. */
|
||||
gap: number;
|
||||
/** Size of the host-owned toolbar icon. */
|
||||
iconSize: number;
|
||||
/** Focus ring colour, from the readable accent of the control palette. */
|
||||
focus: string;
|
||||
}
|
||||
@@ -202,6 +218,10 @@ export interface RgbColor {
|
||||
b: number;
|
||||
}
|
||||
|
||||
export interface RgbaColor extends RgbColor {
|
||||
a: number;
|
||||
}
|
||||
|
||||
const DEFAULT_ACCENT: RgbColor = { r: 180, g: 83, b: 9 };
|
||||
const DEFAULT_BACKGROUND: RgbColor = { r: 255, g: 255, b: 255 };
|
||||
const DEFAULT_FOREGROUND: RgbColor = { r: 49, g: 82, b: 79 };
|
||||
@@ -213,7 +233,8 @@ const ON_ACCENT_DARK: RgbColor = { r: 17, g: 24, b: 39 };
|
||||
const MAX_RADIUS = 999;
|
||||
const MAX_FONT_LENGTH = 120;
|
||||
const FONT_FAMILY_PATTERN = /^[A-Za-z0-9 ,'"-]{1,120}$/;
|
||||
/** Toolbar-mode geometry limits; a skin cannot shrink below host minimums. */
|
||||
/** Toolbar-mode geometry limits; only an explicit height may reach 22px. */
|
||||
export const TOOLBAR_MIN_HEIGHT = 22;
|
||||
export const TOOLBAR_DEFAULT_RADIUS = 6;
|
||||
export const TOOLBAR_MAX_RADIUS = 24;
|
||||
export const TOOLBAR_DEFAULT_PADDING_X = 12;
|
||||
@@ -221,9 +242,14 @@ export const TOOLBAR_DEFAULT_PADDING_Y = 6;
|
||||
export const TOOLBAR_MAX_PADDING = 48;
|
||||
export const TOOLBAR_MAX_HEIGHT = 72;
|
||||
export const TOOLBAR_MAX_FONT_SIZE = 20;
|
||||
export const TOOLBAR_DEFAULT_GAP = 4;
|
||||
export const TOOLBAR_MAX_GAP = 16;
|
||||
export const TOOLBAR_DEFAULT_ICON_SIZE = 16;
|
||||
export const TOOLBAR_MIN_ICON_SIZE = 12;
|
||||
export const TOOLBAR_MAX_ICON_SIZE = 24;
|
||||
const MAX_SHADOW_LENGTH = 160;
|
||||
const LENGTH_PX_PATTERN = /^(-?\d+(?:\.\d+)?)px$/i;
|
||||
const PADDING_PATTERN = /^(\d+(?:\.\d+)?)px(?:\s+(\d+(?:\.\d+)?)px)?$/i;
|
||||
const PADDING_PATTERN = /^(0|\d+(?:\.\d+)?px)(?:\s+(0|\d+(?:\.\d+)?px))?$/i;
|
||||
/**
|
||||
* A single box-shadow value: optional `inset`, two to four px offsets/sizes
|
||||
* and one simple colour. `url()`, `var()`, extra shadows and declarations are
|
||||
@@ -289,10 +315,11 @@ export const PERMISSION_CONTROL_DEFAULTS: HostControlDefaults = {
|
||||
},
|
||||
};
|
||||
|
||||
/** Parse `#rgb`, `#rgba`, `#rrggbb`, `#rrggbbaa`, `rgb()` and `rgba()`. */
|
||||
export function parseCssColor(value: string | undefined | null): RgbColor | null {
|
||||
/** Parse CSS colours to sRGB channels plus alpha for toolbar transparency checks. */
|
||||
export function parseCssColorWithAlpha(value: string | undefined | null): RgbaColor | null {
|
||||
if (!value) return null;
|
||||
const text = value.trim().toLowerCase();
|
||||
if (text === "transparent") return { r: 0, g: 0, b: 0, a: 0 };
|
||||
const hex = /^#([0-9a-f]{3,8})$/.exec(text);
|
||||
if (hex) {
|
||||
const digits = hex[1];
|
||||
@@ -301,6 +328,7 @@ export function parseCssColor(value: string | undefined | null): RgbColor | null
|
||||
r: Number.parseInt(digits[0] + digits[0], 16),
|
||||
g: Number.parseInt(digits[1] + digits[1], 16),
|
||||
b: Number.parseInt(digits[2] + digits[2], 16),
|
||||
a: digits.length === 4 ? Number.parseInt(digits[3] + digits[3], 16) / 255 : 1,
|
||||
};
|
||||
}
|
||||
if (digits.length === 6 || digits.length === 8) {
|
||||
@@ -308,6 +336,7 @@ export function parseCssColor(value: string | undefined | null): RgbColor | null
|
||||
r: Number.parseInt(digits.slice(0, 2), 16),
|
||||
g: Number.parseInt(digits.slice(2, 4), 16),
|
||||
b: Number.parseInt(digits.slice(4, 6), 16),
|
||||
a: digits.length === 8 ? Number.parseInt(digits.slice(6, 8), 16) / 255 : 1,
|
||||
};
|
||||
}
|
||||
return null;
|
||||
@@ -325,7 +354,30 @@ export function parseCssColor(value: string | undefined | null): RgbColor | null
|
||||
const channel = percent ? parsed * 2.55 : parsed;
|
||||
channels.push(Math.round(Math.min(255, Math.max(0, channel))));
|
||||
}
|
||||
return { r: channels[0], g: channels[1], b: channels[2] };
|
||||
let alpha = 1;
|
||||
if (parts.length === 4) {
|
||||
const rawAlpha = Number.parseFloat(parts[3]);
|
||||
if (!Number.isFinite(rawAlpha)) return null;
|
||||
alpha = parts[3].endsWith("%") ? rawAlpha / 100 : rawAlpha;
|
||||
alpha = Math.min(1, Math.max(0, alpha));
|
||||
}
|
||||
return { r: channels[0], g: channels[1], b: channels[2], a: alpha };
|
||||
}
|
||||
|
||||
/** Parse `#rgb`, `#rgba`, `#rrggbb`, `#rrggbbaa`, `rgb()` and `rgba()`. */
|
||||
export function parseCssColor(value: string | undefined | null): RgbColor | null {
|
||||
const color = parseCssColorWithAlpha(value);
|
||||
return color ? { r: color.r, g: color.g, b: color.b } : null;
|
||||
}
|
||||
|
||||
/** Composite a possibly translucent colour over an opaque sRGB surface. */
|
||||
export function compositeRgb(foreground: RgbaColor, background: RgbColor): RgbColor {
|
||||
const alpha = Math.min(1, Math.max(0, foreground.a));
|
||||
return {
|
||||
r: Math.round(foreground.r * alpha + background.r * (1 - alpha)),
|
||||
g: Math.round(foreground.g * alpha + background.g * (1 - alpha)),
|
||||
b: Math.round(foreground.b * alpha + background.b * (1 - alpha)),
|
||||
};
|
||||
}
|
||||
|
||||
export function formatRgb(color: RgbColor): string {
|
||||
@@ -572,10 +624,18 @@ function sanitizeToolbarHeight(value: string | undefined, fallback: number): num
|
||||
if (!match) return fallback;
|
||||
const height = Number.parseFloat(match[1]);
|
||||
return Number.isFinite(height)
|
||||
? Math.min(TOOLBAR_MAX_HEIGHT, Math.max(fallback, height))
|
||||
? Math.min(TOOLBAR_MAX_HEIGHT, Math.max(TOOLBAR_MIN_HEIGHT, height))
|
||||
: fallback;
|
||||
}
|
||||
|
||||
function sanitizeToolbarLength(value: string | undefined, fallback: number, min: number, max: number): number {
|
||||
if (!value) return fallback;
|
||||
const match = LENGTH_PX_PATTERN.exec(value.trim());
|
||||
if (!match) return fallback;
|
||||
const length = Number.parseFloat(match[1]);
|
||||
return Number.isFinite(length) ? Math.min(max, Math.max(min, length)) : fallback;
|
||||
}
|
||||
|
||||
function sanitizeToolbarShadow(value: string | undefined): string | undefined {
|
||||
if (!value) return undefined;
|
||||
const shadow = value.trim().replace(/\s+/g, " ");
|
||||
@@ -595,17 +655,57 @@ export function hasHostToolbarTokens(
|
||||
);
|
||||
}
|
||||
|
||||
function parseToolbarColor(raw: string | undefined, probeColor: ColorProbe): RgbaColor | null {
|
||||
return parseCssColorWithAlpha(raw ? probeColor(raw) : undefined);
|
||||
}
|
||||
|
||||
function formatToolbarColor(color: RgbaColor): string {
|
||||
return color.a === 0 ? "transparent" : formatRgb(color);
|
||||
}
|
||||
|
||||
function resolveToolbarSurface(
|
||||
partTokens: Partial<Record<HostToolbarTokenName, string>>,
|
||||
globalTokens: Partial<Record<HostToolbarTokenName, string>>,
|
||||
probeColor: ColorProbe,
|
||||
sampledSurface: RgbColor | null | undefined,
|
||||
defaults: HostControlDefaults,
|
||||
): RgbColor {
|
||||
for (const raw of [partTokens.surface, globalTokens.surface]) {
|
||||
const color = parseToolbarColor(raw, probeColor);
|
||||
if (color?.a === 1) return { r: color.r, g: color.g, b: color.b };
|
||||
}
|
||||
return sampledSurface ?? defaults.background;
|
||||
}
|
||||
|
||||
function resolveToolbarBorder(
|
||||
raw: string | undefined,
|
||||
background: RgbColor,
|
||||
fallback: string,
|
||||
probeColor: ColorProbe,
|
||||
): string {
|
||||
const color = parseToolbarColor(raw, probeColor);
|
||||
if (!color) return fallback;
|
||||
if (color.a === 0) return "transparent";
|
||||
return contrastRatio(color, background) >= HOST_CONTROL_MIN_BORDER_CONTRAST ? formatRgb(color) : fallback;
|
||||
}
|
||||
|
||||
function resolveToolbarHoverBorder(raw: string | undefined, fallback: string, probeColor: ColorProbe): string {
|
||||
const color = parseToolbarColor(raw, probeColor);
|
||||
if (!color) return fallback;
|
||||
// Classic's subtle #b8cfe8 hover edge is intentionally below the 3:1
|
||||
// non-text contrast floor; validate syntax without rejecting that design.
|
||||
return formatToolbarColor(color);
|
||||
}
|
||||
|
||||
/**
|
||||
* Resolve the toolbar button palette and geometry.
|
||||
*
|
||||
* The base control palette is resolved first (background/foreground/accent/
|
||||
* border/font/size, with every existing readability floor). Toolbar tokens
|
||||
* then override colours and radius; an unreadable toolbar colour pair falls
|
||||
* back to the readable base pair, so an invalid or transparent value can never
|
||||
* make the button invisible. `font-size`, `padding` and `height` may raise the
|
||||
* button but never go below `HOST_CONTROL_MIN_FONT_SIZE` / the current hit
|
||||
* target; `shadow` accepts one simple box-shadow value and otherwise becomes
|
||||
* `none` (no fixed capsule shadow).
|
||||
* Transparent backgrounds and borders are valid. Text is checked against an
|
||||
* explicit opaque `surface` token, or the caller's sampled anchor/ancestor
|
||||
* surface, never against transparent black. Opaque colours keep the existing
|
||||
* capsule contrast floors. Hover colours fall back independently to the normal
|
||||
* button colours, and only an explicit toolbar height may reach the 22px
|
||||
* Classic toolbar floor; the size-tier default remains 28/32/36px.
|
||||
*/
|
||||
export function resolveHostControlToolbarTokens(
|
||||
style: Pick<CSSStyleDeclaration, "getPropertyValue"> | null,
|
||||
@@ -613,6 +713,7 @@ export function resolveHostControlToolbarTokens(
|
||||
probeColor: ColorProbe,
|
||||
defaults: HostControlDefaults,
|
||||
isWebFont: WebFontCheck = NO_WEB_FONTS,
|
||||
sampledSurface?: RgbColor | null,
|
||||
): HostControlToolbarTokens {
|
||||
const base = resolveHostControlTokens(style, part, probeColor, defaults, isWebFont);
|
||||
const globalTokens = readToolbarTokenSet(style, (token) => HOST_TOOLBAR_GLOBAL_TOKEN_PROPERTIES[token]);
|
||||
@@ -622,21 +723,30 @@ export function resolveHostControlToolbarTokens(
|
||||
const baseBackground = parseCssColor(base.background) ?? defaults.background;
|
||||
const baseForeground = parseCssColor(base.foreground) ?? defaults.foreground;
|
||||
const baseBorder = parseCssColor(base.border) ?? defaults.border;
|
||||
let background = parseCssColor(probeColor(merged.background)) ?? baseBackground;
|
||||
let foreground = parseCssColor(probeColor(merged.foreground)) ?? baseForeground;
|
||||
// A toolbar colour pair must keep the same text contrast floor as the
|
||||
// capsule; on any failure the already-readable base palette wins as a pair.
|
||||
if (contrastRatio(foreground, background) < HOST_CONTROL_MIN_FOREGROUND_CONTRAST) {
|
||||
background = baseBackground;
|
||||
foreground = baseForeground;
|
||||
const surface = resolveToolbarSurface(partTokens, globalTokens, probeColor, sampledSurface, defaults);
|
||||
let background = parseToolbarColor(merged.background, probeColor) ?? { ...baseBackground, a: 1 };
|
||||
let foreground = parseToolbarColor(merged.foreground, probeColor) ?? { ...baseForeground, a: 1 };
|
||||
let effectiveBackground = background.a === 0 ? surface : background;
|
||||
if (contrastRatio(foreground, effectiveBackground) < HOST_CONTROL_MIN_FOREGROUND_CONTRAST) {
|
||||
background = { ...baseBackground, a: 1 };
|
||||
foreground = { ...baseForeground, a: 1 };
|
||||
effectiveBackground = baseBackground;
|
||||
}
|
||||
const border = resolveBorder(merged.border, background, probeColor) ?? baseBorder;
|
||||
const border = resolveToolbarBorder(merged.border, effectiveBackground, base.border, probeColor);
|
||||
|
||||
let hoverBackground = parseToolbarColor(merged["hover-background"], probeColor) ?? background;
|
||||
let effectiveHoverBackground = hoverBackground.a === 0 ? surface : hoverBackground;
|
||||
if (contrastRatio(foreground, effectiveHoverBackground) < HOST_CONTROL_MIN_FOREGROUND_CONTRAST) {
|
||||
hoverBackground = background;
|
||||
effectiveHoverBackground = effectiveBackground;
|
||||
}
|
||||
const hoverBorder = resolveToolbarHoverBorder(merged["hover-border"], border, probeColor);
|
||||
const padding = sanitizeToolbarPadding(merged.padding);
|
||||
|
||||
return {
|
||||
background: formatRgb(background),
|
||||
background: formatToolbarColor(background),
|
||||
foreground: formatRgb(foreground),
|
||||
border: formatRgb(border),
|
||||
border,
|
||||
radius: sanitizeRadius(merged.radius, TOOLBAR_DEFAULT_RADIUS, TOOLBAR_MAX_RADIUS),
|
||||
font: sanitizeFont(merged.font, base.font, isWebFont),
|
||||
fontSize: sanitizeToolbarFontSize(merged["font-size"], base.fontSize),
|
||||
@@ -644,6 +754,15 @@ export function resolveHostControlToolbarTokens(
|
||||
paddingY: padding?.y ?? TOOLBAR_DEFAULT_PADDING_Y,
|
||||
minHeight: sanitizeToolbarHeight(merged.height, base.hitTarget),
|
||||
shadow: sanitizeToolbarShadow(merged.shadow) ?? "none",
|
||||
hoverBackground: formatToolbarColor(hoverBackground),
|
||||
hoverBorder,
|
||||
gap: sanitizeToolbarLength(merged.gap, TOOLBAR_DEFAULT_GAP, 0, TOOLBAR_MAX_GAP),
|
||||
iconSize: sanitizeToolbarLength(
|
||||
merged["icon-size"],
|
||||
TOOLBAR_DEFAULT_ICON_SIZE,
|
||||
TOOLBAR_MIN_ICON_SIZE,
|
||||
TOOLBAR_MAX_ICON_SIZE,
|
||||
),
|
||||
focus: base.accent,
|
||||
};
|
||||
}
|
||||
@@ -667,6 +786,10 @@ export function applyHostControlToolbarTokens(
|
||||
style.setProperty(HOST_TOOLBAR_APPLIED_VARIABLES.minHeight, `${tokens.minHeight}px`);
|
||||
style.setProperty(HOST_TOOLBAR_APPLIED_VARIABLES.shadow, tokens.shadow);
|
||||
style.setProperty(HOST_TOOLBAR_APPLIED_VARIABLES.focus, tokens.focus);
|
||||
style.setProperty(HOST_TOOLBAR_APPLIED_VARIABLES.hoverBackground, tokens.hoverBackground);
|
||||
style.setProperty(HOST_TOOLBAR_APPLIED_VARIABLES.hoverBorder, tokens.hoverBorder);
|
||||
style.setProperty(HOST_TOOLBAR_APPLIED_VARIABLES.gap, `${tokens.gap}px`);
|
||||
style.setProperty(HOST_TOOLBAR_APPLIED_VARIABLES.iconSize, `${tokens.iconSize}px`);
|
||||
}
|
||||
|
||||
export interface HostControlThemeBindingOptions {
|
||||
@@ -804,8 +927,8 @@ export function createHostControlProbe(shadow: ShadowRoot): HostControlProbe {
|
||||
canvas.fillStyle = "#000";
|
||||
canvas.fillStyle = computed;
|
||||
canvas.fillRect(0, 0, 1, 1);
|
||||
const [r, g, b] = canvas.getImageData(0, 0, 1, 1).data;
|
||||
return formatRgb({ r, g, b });
|
||||
const [r, g, b, a] = canvas.getImageData(0, 0, 1, 1).data;
|
||||
return a === 255 ? formatRgb({ r, g, b }) : `rgba(${r}, ${g}, ${b}, ${a / 255})`;
|
||||
};
|
||||
|
||||
return {
|
||||
|
||||
@@ -21,12 +21,16 @@ import {
|
||||
RECOVERY_CONTROL_DEFAULTS,
|
||||
applyHostControlTokens,
|
||||
applyHostControlToolbarTokens,
|
||||
compositeRgb,
|
||||
createHostControlProbe,
|
||||
findSkinRoot,
|
||||
parseCssColorWithAlpha,
|
||||
resolveHostControlTokens,
|
||||
resolveHostControlToolbarTokens,
|
||||
type HostControlTokens,
|
||||
type HostControlProbe,
|
||||
type RgbColor,
|
||||
type RgbaColor,
|
||||
} from "./host-control-tokens.js";
|
||||
|
||||
export interface SlotViewport {
|
||||
@@ -226,6 +230,22 @@ function rectOf(rect: DOMRect | HostPartRect): HostPartRect {
|
||||
};
|
||||
}
|
||||
|
||||
/** Composite the anchor and top-bar ancestor backgrounds over the page canvas. */
|
||||
export function sampleOpaqueSurface(element: Element | null, doc: Document = document): RgbColor {
|
||||
const view = doc.defaultView;
|
||||
const layers: RgbaColor[] = [];
|
||||
for (let current: Element | null = element; current && view; current = current.parentElement) {
|
||||
const color = parseCssColorWithAlpha(view.getComputedStyle(current).backgroundColor);
|
||||
if (color && color.a > 0) layers.push(color);
|
||||
if (color?.a === 1) break;
|
||||
}
|
||||
let surface: RgbColor = { r: 255, g: 255, b: 255 };
|
||||
for (let index = layers.length - 1; index >= 0; index -= 1) {
|
||||
surface = compositeRgb(layers[index], surface);
|
||||
}
|
||||
return surface;
|
||||
}
|
||||
|
||||
/** Overlap of two rects in CSS pixels on both axes (more than 1px each). */
|
||||
export function rectsOverlap(first: HostPartRect, second: HostPartRect): boolean {
|
||||
const width = Math.min(first.right, second.right) - Math.max(first.left, second.left);
|
||||
@@ -327,9 +347,10 @@ export interface HostSlotBindingOptions {
|
||||
skinId?: string;
|
||||
align?: SkinChromeSlotAlign;
|
||||
/**
|
||||
* `toolbar` also applies `--skin-recovery-toolbar-*` tokens (background,
|
||||
* foreground, border, radius, font, font size, padding, min height, shadow).
|
||||
* The capsule mode keeps the historical control tokens only.
|
||||
* `toolbar` also applies `--skin-recovery-toolbar-*` / `--skin-host-toolbar-*`
|
||||
* tokens for background, foreground, border, hover, radius, font, font size,
|
||||
* padding, height, shadow, surface, gap and icon size. The capsule mode keeps
|
||||
* the historical control tokens only.
|
||||
*/
|
||||
presentation?: "capsule" | "toolbar";
|
||||
/**
|
||||
@@ -451,22 +472,23 @@ export function bindHostSlot(options: HostSlotBindingOptions): HostSlotBinding {
|
||||
const tokenStyle = tokenSource ? win.getComputedStyle(tokenSource) : null;
|
||||
const tokens = readTokens(tokenStyle);
|
||||
applyHostControlTokens(control, tokenStyle ? tokens : null);
|
||||
let toolbarMinHeight: number | undefined;
|
||||
if (options.presentation === "toolbar") {
|
||||
// Toolbar buttons get a second, independent token set so they can match
|
||||
// a neighbouring top-bar button instead of the capsule palette. The
|
||||
// resolver keeps the same contrast/font floors and falls back as a group.
|
||||
applyHostControlToolbarTokens(
|
||||
control,
|
||||
tokenStyle
|
||||
? resolveHostControlToolbarTokens(
|
||||
tokenStyle,
|
||||
"host.recovery",
|
||||
probe.probeColor,
|
||||
RECOVERY_CONTROL_DEFAULTS,
|
||||
probe.isWebFont,
|
||||
)
|
||||
: null,
|
||||
);
|
||||
// a neighbouring top-bar button instead of the capsule palette. A
|
||||
// transparent button is checked against the surface behind its anchor.
|
||||
const toolbarTokens = tokenStyle
|
||||
? resolveHostControlToolbarTokens(
|
||||
tokenStyle,
|
||||
"host.recovery",
|
||||
probe.probeColor,
|
||||
RECOVERY_CONTROL_DEFAULTS,
|
||||
probe.isWebFont,
|
||||
sampleOpaqueSurface(tokenSource, doc),
|
||||
)
|
||||
: null;
|
||||
toolbarMinHeight = toolbarTokens?.minHeight;
|
||||
applyHostControlToolbarTokens(control, toolbarTokens);
|
||||
}
|
||||
|
||||
const controlBox = control.getBoundingClientRect();
|
||||
@@ -522,7 +544,7 @@ export function bindHostSlot(options: HostSlotBindingOptions): HostSlotBinding {
|
||||
anchor: anchorSnapshot,
|
||||
controlRect: intendedRect,
|
||||
viewport,
|
||||
minHitTarget: tokens.hitTarget,
|
||||
minHitTarget: toolbarMinHeight ?? tokens.hitTarget,
|
||||
coversProtected,
|
||||
otherControls: options.otherControls?.(),
|
||||
hitTestOk: placement
|
||||
|
||||
Reference in new issue
Block a user