Skip to content

Commit

Permalink
fix(web-components): remove final dependencies on fast-foundation (#3…
Browse files Browse the repository at this point in the history
…1009)

Co-authored-by: Christopher Holt <=>
  • Loading branch information
chrisdholt authored and radium-v committed May 3, 2024
1 parent 9997c97 commit 5e6340f
Show file tree
Hide file tree
Showing 34 changed files with 326 additions and 55 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,9 @@ import * as React from 'react';
import { StoryContext } from '@storybook/addons';
import { ComponentStory } from '@storybook/react';
import { FASTElement, customElement, html, attr } from '@microsoft/fast-element';
import { DesignToken } from '@microsoft/fast-foundation';
import { teamsLightTheme, teamsDarkTheme, webLightTheme, webDarkTheme } from '@fluentui/tokens';
import { setThemeFor } from '@fluentui/web-components';

DesignToken.registerDefaultStyleTarget();

const themes = [
{ id: 'web-light', label: 'Web Light', theme: webLightTheme },
{ id: 'web-dark', label: 'Web Dark', theme: webDarkTheme },
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "prerelease",
"comment": "fix(web-components): remove final dependencies on fast-foundation",
"packageName": "@fluentui/web-components",
"email": "=",
"dependentChangeType": "patch"
}
46 changes: 46 additions & 0 deletions packages/web-components/docs/api-report.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ 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 type { SyntheticViewTemplate } from '@microsoft/fast-element';
Expand Down Expand Up @@ -1648,6 +1650,9 @@ export const CounterBadgeStyles: ElementStyles;
// @public
export const CounterBadgeTemplate: ElementViewTemplate<CounterBadge>;

// @public
export type CSSDisplayPropertyValue = 'block' | 'contents' | 'flex' | 'grid' | 'inherit' | 'initial' | 'inline' | 'inline-block' | 'inline-flex' | 'inline-grid' | 'inline-table' | 'list-item' | 'none' | 'run-in' | 'table' | 'table-caption' | 'table-cell' | 'table-column' | 'table-column-group' | 'table-footer-group' | 'table-header-group' | 'table-row' | 'table-row-group';

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

Expand Down Expand Up @@ -1675,6 +1680,9 @@ export const curveEasyEaseMax = "var(--curveEasyEaseMax)";
// @public (undocumented)
export const curveLinear = "var(--curveLinear)";

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

// Warning: (ae-internal-mixed-release-tag) Mixed release tags are not allowed for "DelegatesARIAButton" because one of its declarations is marked as @internal
//
// @public
Expand Down Expand Up @@ -1741,6 +1749,9 @@ export const DialogStyles: ElementStyles;
// @public
export const DialogTemplate: ElementViewTemplate<Dialog>;

// @public
export function display(displayValue: CSSDisplayPropertyValue): string;

// @public
export class Divider extends FASTElement {
alignContent?: DividerAlignContent;
Expand Down Expand Up @@ -1880,6 +1891,15 @@ export const fontWeightRegular = "var(--fontWeightRegular)";
// @public (undocumented)
export const fontWeightSemibold = "var(--fontWeightSemibold)";

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

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

// @public
export const hidden = ":host([hidden]){display:none}";

// @public
class Image_2 extends FASTElement {
block?: boolean;
Expand Down Expand Up @@ -1940,6 +1960,9 @@ export const LabelStyles: ElementStyles;
// @public (undocumented)
export const LabelTemplate: ElementViewTemplate<Label>;

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

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

Expand Down Expand Up @@ -1970,6 +1993,29 @@ export const lineHeightHero800 = "var(--lineHeightHero800)";
// @public (undocumented)
export const lineHeightHero900 = "var(--lineHeightHero900)";

// @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 {
cleanup?: () => void;
Expand Down
2 changes: 1 addition & 1 deletion packages/web-components/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -205,9 +205,9 @@
},
"dependencies": {
"@microsoft/fast-element": "2.0.0-beta.26",
"@microsoft/fast-foundation": "3.0.0-alpha.31",
"@microsoft/fast-web-utilities": "^6.0.0",
"@fluentui/tokens": "1.0.0-alpha.2",
"tabbable": "^6.2.0",
"tslib": "^2.1.0"
},
"beachball": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { css } from '@microsoft/fast-element';
import { display } from '@microsoft/fast-foundation/utilities.js';
import { display } from '../utils/index.js';
import {
borderRadiusMedium,
borderRadiusSmall,
Expand Down
2 changes: 1 addition & 1 deletion packages/web-components/src/accordion/accordion.styles.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { css } from '@microsoft/fast-element';
import { display } from '@microsoft/fast-foundation/utilities.js';
import { display } from '../utils/index.js';

export const styles = css`
${display('flex')}
Expand Down
2 changes: 1 addition & 1 deletion packages/web-components/src/avatar/avatar.styles.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { css } from '@microsoft/fast-element';
import { display } from '@microsoft/fast-foundation/utilities.js';
import { display } from '../utils/index.js';
import {
borderRadiusCircular,
borderRadiusLarge,
Expand Down
2 changes: 1 addition & 1 deletion 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 '@microsoft/fast-foundation/utilities.js';
import { display, forcedColorsStylesheetBehavior } from '../utils/index.js';
import {
borderRadiusCircular,
borderRadiusLarge,
Expand Down
2 changes: 1 addition & 1 deletion packages/web-components/src/checkbox/checkbox.styles.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { css } from '@microsoft/fast-element';
import { display } from '@microsoft/fast-foundation/utilities.js';
import { display } from '../utils/index.js';
import {
borderRadiusCircular,
borderRadiusMedium,
Expand Down
2 changes: 1 addition & 1 deletion packages/web-components/src/dialog/dialog.styles.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { css } from '@microsoft/fast-element';
import { display } from '@microsoft/fast-foundation';
import { display } from '../utils/index.js';
import {
borderRadiusXLarge,
colorBackgroundOverlay,
Expand Down
2 changes: 1 addition & 1 deletion 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 '@microsoft/fast-foundation/utilities.js';
import { display, forcedColorsStylesheetBehavior } from '../utils/index.js';
import {
colorBrandForeground1,
colorBrandStroke1,
Expand Down
4 changes: 4 additions & 0 deletions packages/web-components/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,7 @@ export * from './toggle-button/index.js';

export * from './fluent-design-system.js';
export * from './theme/index.js';

export * from './utils/direction.js';
export * from './utils/display.js';
export * from './utils/behaviors/match-media-stylesheet-behavior.js';
2 changes: 1 addition & 1 deletion packages/web-components/src/label/label.styles.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { css } from '@microsoft/fast-element';
import { display } from '@microsoft/fast-foundation/utilities.js';
import { display } from '../utils/index.js';
import {
colorNeutralForeground1,
colorNeutralForegroundDisabled,
Expand Down
2 changes: 1 addition & 1 deletion 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 } from '@microsoft/fast-foundation/utilities.js';
import { display } from '../utils/index.js';
import {
borderRadiusMedium,
colorCompoundBrandForeground1Hover,
Expand Down
2 changes: 1 addition & 1 deletion packages/web-components/src/menu-list/menu-list.styles.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { css } from '@microsoft/fast-element';
import { display } from '@microsoft/fast-foundation/utilities.js';
import { display } from '../utils/index.js';
import {
borderRadiusMedium,
colorNeutralBackground1,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { css } from '@microsoft/fast-element';
import { display, forcedColorsStylesheetBehavior } from '@microsoft/fast-foundation/utilities.js';
import { display, forcedColorsStylesheetBehavior } from '../utils/index.js';
import {
borderRadiusMedium,
colorBrandBackground2,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { css } from '@microsoft/fast-element';
import { display } from '@microsoft/fast-foundation/utilities.js';
import { display } from '../utils/index.js';
import {
colorNeutralForeground1,
colorNeutralForegroundDisabled,
Expand Down
2 changes: 1 addition & 1 deletion packages/web-components/src/radio/radio.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 '@microsoft/fast-foundation/utilities.js';
import { display, forcedColorsStylesheetBehavior } from '../utils/index.js';
import {
borderRadiusCircular,
borderRadiusSmall,
Expand Down
2 changes: 1 addition & 1 deletion packages/web-components/src/slider/slider.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 '@microsoft/fast-foundation/utilities.js';
import { display, forcedColorsStylesheetBehavior } from '../utils/index.js';
import {
borderRadiusCircular,
borderRadiusMedium,
Expand Down
2 changes: 1 addition & 1 deletion packages/web-components/src/spinner/spinner.styles.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { css } from '@microsoft/fast-element';
import { display } from '@microsoft/fast-foundation/utilities.js';
import { display } from '../utils/index.js';
import { colorBrandStroke1, colorBrandStroke2, colorNeutralStrokeOnBrand2 } from '../theme/design-tokens.js';

export const styles = css`
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { css } from '@microsoft/fast-element';
import { display } from '@microsoft/fast-foundation/utilities.js';
import { display } from '../../utils/index.js';
import {
borderRadiusCircular,
colorBrandBackground,
Expand Down
2 changes: 1 addition & 1 deletion packages/web-components/src/switch/switch.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 '@microsoft/fast-foundation/utilities.js';
import { display, forcedColorsStylesheetBehavior } from '../utils/index.js';
import {
borderRadiusCircular,
colorCompoundBrandBackground,
Expand Down
2 changes: 1 addition & 1 deletion packages/web-components/src/tab-panel/tab-panel.styles.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { css } from '@microsoft/fast-element';
import { display } from '@microsoft/fast-foundation/utilities.js';
import { display } from '../utils/index.js';
import { spacingHorizontalM, spacingHorizontalMNudge } from '../theme/design-tokens.js';

export const styles = css`
Expand Down
2 changes: 1 addition & 1 deletion packages/web-components/src/tab/tab.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 '@microsoft/fast-foundation/utilities.js';
import { display, forcedColorsStylesheetBehavior } from '../utils/index.js';
import {
borderRadiusCircular,
borderRadiusMedium,
Expand Down
2 changes: 1 addition & 1 deletion packages/web-components/src/tabs/tabs.styles.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { css } from '@microsoft/fast-element';
import { display } from '@microsoft/fast-foundation/utilities.js';
import { display } from '../utils/index.js';
import {
borderRadiusCircular,
borderRadiusMedium,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { css } from '@microsoft/fast-element';
import { display } from '@microsoft/fast-foundation/utilities.js';
import { display } from '../utils/index.js';
import {
borderRadiusMedium,
colorCompoundBrandStroke,
Expand Down
2 changes: 1 addition & 1 deletion packages/web-components/src/text/text.styles.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { css } from '@microsoft/fast-element';
import { display } from '@microsoft/fast-foundation/utilities.js';
import { display } from '../utils/index.js';
import {
fontFamilyBase,
fontFamilyMonospace,
Expand Down
17 changes: 7 additions & 10 deletions packages/web-components/src/theme/theme.stories.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
import { DesignToken } from '@microsoft/fast-foundation/design-token.js';
import * as tokens from '../theme/design-tokens.js';

DesignToken.registerDefaultStyleTarget();

export default {
title: 'Theme/Tokens',
};
Expand All @@ -12,13 +9,13 @@ export const Tokens = () => `
<h3>Theme Tokens</h3>
<p>Debug story which uses theme tokens to style the element below.</p>
<div style="
font-family: var(${tokens.fontFamilyBase});
font-size: var(${tokens.fontSizeBase300});
background: var(${tokens.colorBrandBackground});
color: var(${tokens.colorNeutralForegroundOnBrand});
border: var(${tokens.strokeWidthThicker}) solid var(${tokens.colorNeutralStroke1});
padding: var(${tokens.spacingVerticalS}) var(${tokens.spacingHorizontalM});
box-shadow: var(${tokens.shadow28});
font-family: ${tokens.fontFamilyBase};
font-size: ${tokens.fontSizeBase300};
background: ${tokens.colorBrandBackground};
color: ${tokens.colorNeutralForegroundOnBrand};
border: ${tokens.strokeWidthThicker} solid ${tokens.colorNeutralStroke1};
padding: ${tokens.spacingVerticalS} ${tokens.spacingHorizontalM};
box-shadow: ${tokens.shadow28};
">colorNeutralForegroundOnBrand on colorBrandBackground with shadow28</div>
</div>
`;
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { css } from '@microsoft/fast-element';
import { forcedColorsStylesheetBehavior } from '@microsoft/fast-foundation/utilities.js';
import { forcedColorsStylesheetBehavior } from '../utils/index.js';
import { styles as ButtonStyles } from '../button/button.styles.js';
import {
colorBrandBackgroundHover,
Expand Down
Loading

0 comments on commit 5e6340f

Please sign in to comment.