Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "fix: remove behaviors in favor of direct css inclusion",
"packageName": "@fluentui/chart-web-components",
"email": "13071055+chrisdholt@users.noreply.github.com",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
Comment thread
chrisdholt marked this conversation as resolved.
"type": "prerelease",
"comment": "fix: remove behaviors in favor of direct css inclusion",
"packageName": "@fluentui/web-components",
"email": "13071055+chrisdholt@users.noreply.github.com",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import {
colorStrokeFocus2,
colorTransparentStroke,
display,
forcedColorsStylesheetBehavior,
spacingHorizontalL,
spacingHorizontalNone,
spacingHorizontalS,
Expand Down Expand Up @@ -139,8 +138,8 @@ export const styles = css`
.tooltip-content-y {
${typographyTitle2Styles}
}
`.withBehaviors(
forcedColorsStylesheetBehavior(css`

@media (forced-colors: active) {
.text-inside-donut {
fill: CanvasText;
}
Expand All @@ -155,5 +154,5 @@ export const styles = css`
forced-color-adjust: auto;
color: CanvasText;
}
`),
);
}
`;
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import {
colorNeutralForeground1,
colorNeutralStrokeAccessible,
display,
forcedColorsStylesheetBehavior,
shadow4,
spacingHorizontalL,
spacingHorizontalNone,
Expand Down Expand Up @@ -171,8 +170,8 @@ export const styles: ElementStyles = css`
${typographyBody1StrongStyles}
color: ${colorNeutralForeground1};
}
`.withBehaviors(
forcedColorsStylesheetBehavior(css`

@media (forced-colors: active) {
.legend-rect,
.tooltip-line,
.triangle {
Expand All @@ -186,5 +185,5 @@ export const styles: ElementStyles = css`
.bar-label {
fill: CanvasText !important;
}
`),
);
}
`;
34 changes: 0 additions & 34 deletions packages/web-components/docs/web-components.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ import { ElementStyles } from '@microsoft/fast-element';
import { ElementViewTemplate } from '@microsoft/fast-element';
import { FASTElement } from '@microsoft/fast-element';
import { FASTElementDefinition } from '@microsoft/fast-element';
import type { HostBehavior } from '@microsoft/fast-element';
import type { HostController } from '@microsoft/fast-element';
import { HTMLDirective } from '@microsoft/fast-element';
import { Orientation } from '@microsoft/fast-web-utilities';
import { SyntheticViewTemplate } from '@microsoft/fast-element';
Expand Down Expand Up @@ -2517,9 +2515,6 @@ export const curveEasyEaseMax = "var(--curveEasyEaseMax)";
// @public
export const curveLinear = "var(--curveLinear)";

// @public
export const darkModeStylesheetBehavior: (styles: ElementStyles) => MatchMediaStyleSheetBehavior;

// @public
export class Dialog extends FASTElement {
ariaDescribedby?: string;
Expand Down Expand Up @@ -2980,9 +2975,6 @@ export const fontWeightRegular = "var(--fontWeightRegular)";
// @public
export const fontWeightSemibold = "var(--fontWeightSemibold)";

// @public
export const forcedColorsStylesheetBehavior: (styles: ElementStyles) => MatchMediaStyleSheetBehavior;

// @public
export const getDirection: (rootNode: HTMLElement) => Direction;

Expand Down Expand Up @@ -3088,9 +3080,6 @@ export const LabelWeight: {
// @public
export type LabelWeight = ValuesOf<typeof LabelWeight>;

// @public
export const lightModeStylesheetBehavior: (styles: ElementStyles) => MatchMediaStyleSheetBehavior;

// @public
export const lineHeightBase100 = "var(--lineHeightBase100)";

Expand Down Expand Up @@ -3201,29 +3190,6 @@ export const ListboxTemplate: ElementViewTemplate<Listbox>;
// @public
export function listboxTemplate<T extends Listbox>(): ElementViewTemplate<T>;

// @public
export abstract class MatchMediaBehavior implements HostBehavior {
constructor(query: MediaQueryList);
connectedCallback(controller: HostController): void;
protected abstract constructListener(controller: HostController): MediaQueryListListener;
disconnectedCallback(controller: HostController): void;
readonly query: MediaQueryList;
}

// @public
export class MatchMediaStyleSheetBehavior extends MatchMediaBehavior {
constructor(query: MediaQueryList, styles: ElementStyles);
protected constructListener(controller: HostController): MediaQueryListListener;
readonly query: MediaQueryList;
// @internal
removedCallback(controller: HostController<any>): void;
readonly styles: ElementStyles;
static with(query: MediaQueryList): (styles: ElementStyles) => MatchMediaStyleSheetBehavior;
}

// @public
export type MediaQueryListListener = (this: MediaQueryList, ev?: MediaQueryListEvent) => void;

// @public
export class Menu extends FASTElement {
closeMenu: (event?: Event) => void;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { css } from '@microsoft/fast-element';
import { baseButtonStyles } from '../button/button.styles.js';
import { forcedColorsStylesheetBehavior } from '../utils/index.js';

// Need to support icon hover styles
export const styles = css`
Expand All @@ -10,11 +9,11 @@ export const styles = css`
position: absolute;
inset: 0;
}
`.withBehaviors(
forcedColorsStylesheetBehavior(css`

@media (forced-colors: active) {
:host {
border-color: LinkText;
color: LinkText;
}
`),
);
}
`;
9 changes: 4 additions & 5 deletions packages/web-components/src/badge/badge.styles.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { css } from '@microsoft/fast-element';
import { forcedColorsStylesheetBehavior } from '../utils/index.js';
import {
badgeBaseStyles,
badgeFilledStyles,
Expand Down Expand Up @@ -32,12 +31,12 @@ export const styles = css`
${badgeFilledStyles}
${badgeSizeStyles}
${badgeBaseStyles}
`.withBehaviors(
forcedColorsStylesheetBehavior(css`

@media (forced-colors: active) {
:host,
:host([appearance='outline']),
:host([appearance='tint']) {
border-color: CanvasText;
}
`),
);
}
`;
10 changes: 5 additions & 5 deletions packages/web-components/src/button/button.styles.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { css } from '@microsoft/fast-element';
import { display, forcedColorsStylesheetBehavior } from '../utils/index.js';
import { display } from '../utils/index.js';
import {
borderRadiusCircular,
borderRadiusLarge,
Expand Down Expand Up @@ -310,8 +310,8 @@ export const styles = css`
border-color: transparent;
background-color: ${colorTransparentBackground};
}
`.withBehaviors(
forcedColorsStylesheetBehavior(css`

@media (forced-colors: active) {
:host {
background-color: ButtonFace;
color: ButtonText;
Expand All @@ -332,5 +332,5 @@ export const styles = css`
color: GrayText;
border-color: ButtonText;
}
`),
);
}
`;
9 changes: 4 additions & 5 deletions packages/web-components/src/checkbox/checkbox.styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import {
strokeWidthThick,
strokeWidthThin,
} from '../theme/design-tokens.js';
import { forcedColorsStylesheetBehavior } from '../utils/behaviors/match-media-stylesheet-behavior.js';
import { display } from '../utils/display.js';

/** Checkbox styles
Expand Down Expand Up @@ -153,8 +152,8 @@ export const styles = css`
:host([disabled]${checkedState}) .checked-indicator {
color: ${colorNeutralStrokeDisabled};
}
`.withBehaviors(
forcedColorsStylesheetBehavior(css`

@media (forced-colors: active) {
:host {
border-color: FieldText;
}
Expand Down Expand Up @@ -196,5 +195,5 @@ export const styles = css`
:host([disabled]${checkedState}) .checked-indicator {
color: GrayText;
}
`),
);
}
`;
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import {
spacingHorizontalSNudge,
spacingHorizontalXS,
} from '../theme/design-tokens.js';
import { forcedColorsStylesheetBehavior } from '../utils/index.js';

// Need to support icon hover styles
export const styles = css`
Expand Down Expand Up @@ -118,11 +117,11 @@ export const styles = css`
:host([size='large']) ::slotted([slot='description']) {
font-size: ${fontSizeBase300};
}
`.withBehaviors(
forcedColorsStylesheetBehavior(css`

@media (forced-colors: active) {
:host([appearance='primary']:not(:hover, :focus-visible, :disabled, [disabled-focusable]))
::slotted([slot='description']) {
color: HighlightText;
}
`),
);
}
`;
9 changes: 4 additions & 5 deletions packages/web-components/src/dialog/dialog.styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import {
shadow64,
strokeWidthThin,
} from '../theme/design-tokens.js';
import { forcedColorsStylesheetBehavior } from '../utils/behaviors/match-media-stylesheet-behavior.js';

/** Dialog styles
* @public
Expand Down Expand Up @@ -95,12 +94,12 @@ export const styles = css`
}
}
}
`.withBehaviors(
forcedColorsStylesheetBehavior(css`

@media (forced-colors: active) {
@layer base {
dialog {
border: ${strokeWidthThin} solid ${colorTransparentStroke};
}
}
`),
);
}
`;
10 changes: 5 additions & 5 deletions packages/web-components/src/divider/divider.styles.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { css } from '@microsoft/fast-element';
import { display, forcedColorsStylesheetBehavior } from '../utils/index.js';
import { display } from '../utils/index.js';
import {
colorBrandForeground1,
colorBrandStroke1,
Expand Down Expand Up @@ -123,8 +123,8 @@ export const styles = css`
:host([appearance='subtle']) ::slotted(*) {
color: ${colorNeutralForeground3};
}
`.withBehaviors(
forcedColorsStylesheetBehavior(css`

@media (forced-colors: active) {
:host([appearance='strong'])::before,
:host([appearance='strong'])::after,
:host([appearance='brand'])::before,
Expand All @@ -136,5 +136,5 @@ export const styles = css`
background: WindowText;
color: WindowText;
}
`),
);
}
`;
8 changes: 0 additions & 8 deletions packages/web-components/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -331,13 +331,5 @@ export {
export { BaseTree, Tree, TreeDefinition, TreeTemplate, TreeStyles } from './tree/index.js';
export { TreeItem, TreeItemDefinition, TreeItemTemplate, TreeItemStyles } from './tree-item/index.js';
export type { isTreeItem, TreeItemAppearance, TreeItemSize } from './tree-item/index.js';
export {
darkModeStylesheetBehavior,
forcedColorsStylesheetBehavior,
lightModeStylesheetBehavior,
MatchMediaBehavior,
MatchMediaStyleSheetBehavior,
} from './utils/behaviors/match-media-stylesheet-behavior.js';
export type { MediaQueryListListener } from './utils/behaviors/match-media-stylesheet-behavior.js';
export { getDirection } from './utils/direction.js';
export { display } from './utils/display.js';
10 changes: 5 additions & 5 deletions packages/web-components/src/link/link.styles.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { css } from '@microsoft/fast-element';
import { display, forcedColorsStylesheetBehavior } from '../utils/index.js';
import { display } from '../utils/index.js';
import {
colorBrandForegroundLink,
colorBrandForegroundLinkHover,
Expand Down Expand Up @@ -75,10 +75,10 @@ export const styles = css`
position: absolute;
inset: 0;
}
`.withBehaviors(
forcedColorsStylesheetBehavior(css`

@media (forced-colors: active) {
:host {
color: LinkText;
}
`),
);
}
`;
10 changes: 5 additions & 5 deletions packages/web-components/src/menu-item/menu-item.styles.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { css } from '@microsoft/fast-element';
import { display, forcedColorsStylesheetBehavior } from '../utils/index.js';
import { display } from '../utils/index.js';
import {
borderRadiusMedium,
colorCompoundBrandForeground1Pressed,
Expand Down Expand Up @@ -169,12 +169,12 @@ export const styles = css`
}
}
}
`.withBehaviors(
forcedColorsStylesheetBehavior(css`

@media (forced-colors: active) {
:host(${disabledState}),
:host(${disabledState}) ::slotted([slot='start']),
:host(${disabledState}) ::slotted([slot='end']) {
color: GrayText;
}
`),
);
}
`;
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { css } from '@microsoft/fast-element';
import { display, forcedColorsStylesheetBehavior } from '../utils/index.js';
import { display } from '../utils/index.js';
import {
borderRadiusMedium,
borderRadiusNone,
Expand Down Expand Up @@ -103,14 +103,14 @@ export const styles = css`
inset-inline-start: 100%;
}
}
`.withBehaviors(
forcedColorsStylesheetBehavior(css`

@media (forced-colors: active) {
:host {
background-color: CanvasText;
}
.indicator,
:host(:is([validation-state='success'], [validation-state='warning'], [validation-state='error'])) .indicator {
background-color: Highlight;
}
`),
);
}
`;
Loading
Loading