Skip to content

Commit ee995d8

Browse files
authored
Remove foundation as a dependency (#7257)
# Pull Request ## πŸ“– Description This PR removes the deprecated `@microsoft/fast-foundation` package from the mono repo dependency tree. ## πŸ‘©β€πŸ’» Reviewer Notes Intended as a clean up task before the conversion of all tests to Playwright and v3 release. ## βœ… Checklist ### General - [ ] I have included a change request file using `$ npm run change` - [ ] I have added tests for my changes. - [x] I have tested my changes. - [ ] I have updated the project documentation to reflect my changes. - [x] I have read the [CONTRIBUTING](https://github.com/microsoft/fast/blob/main/CONTRIBUTING.md) documentation and followed the [standards](https://github.com/microsoft/fast/blob/main/CODE_OF_CONDUCT.md#our-standards) for this project.
1 parent b5ed37b commit ee995d8

File tree

10 files changed

+22
-181
lines changed

10 files changed

+22
-181
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"type": "none",
3+
"comment": "Remove foundation as a dependency",
4+
"packageName": "@microsoft/fast-ssr",
5+
"email": "7559015+janechu@users.noreply.github.com",
6+
"dependentChangeType": "none"
7+
}

β€Žexamples/ssr/package.jsonβ€Ž

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
},
2525
"dependencies": {
2626
"@microsoft/fast-element": "^2.9.2",
27-
"@microsoft/fast-foundation": "^3.0.0-alpha.33",
2827
"@microsoft/fast-ssr": "^1.0.0-beta.37",
2928
"@microsoft/fast-todo-app-example": "1.0.0"
3029
}

β€Žexamples/todo-app/package.jsonβ€Ž

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
},
2424
"dependencies": {
2525
"@microsoft/fast-element": "^2.9.2",
26-
"@microsoft/fast-foundation": "^3.0.0-alpha.33",
2726
"tslib": "^2.6.3"
2827
},
2928
"devDependencies": {

β€Žexamples/todo-app/src/design-tokens.tsβ€Ž

Lines changed: 0 additions & 7 deletions
This file was deleted.

β€Žexamples/todo-app/src/main.tsβ€Ž

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { DesignToken } from "@microsoft/fast-foundation";
21
import { DefaultTodoList, TodoList } from "./todo-list.js";
32
import { app } from "./todo-app.js";
43

@@ -11,8 +10,5 @@ import { app } from "./todo-app.js";
1110
// in time.
1211
TodoList.provide(document, new DefaultTodoList());
1312

14-
// Emit CSS for DesignToken default values
15-
DesignToken.registerDefaultStyleTarget();
16-
1713
// Define the todo-app custom element
1814
app.define();

β€Žexamples/todo-app/src/todo-app.styles.tsβ€Ž

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
11
import { css } from "@microsoft/fast-element";
2-
import { fontFamily, neutralForeground } from "./design-tokens.js";
32

43
export const styles = css`
54
:host {
65
display: block;
76
padding: 16px;
87
max-width: 320px;
9-
font-family: ${fontFamily};
10-
color: ${neutralForeground};
118
}
129
1310
h2 {

β€Žpackage-lock.jsonβ€Ž

Lines changed: 1 addition & 56 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

β€Žpackage.jsonβ€Ž

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -120,9 +120,6 @@
120120
},
121121
"read-package-json": {
122122
"glob": "$glob"
123-
},
124-
"@microsoft/fast-foundation": {
125-
"@microsoft/fast-element": "file:./packages/fast-element"
126123
}
127124
}
128125
}

β€Žpackages/fast-ssr/package.jsonβ€Ž

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,7 @@
5959
"@microsoft/fast-element": "^2.9.2"
6060
},
6161
"devDependencies": {
62-
"@microsoft/fast-element": "^2.9.2",
63-
"@microsoft/fast-foundation": "^3.0.0-alpha.33"
62+
"@microsoft/fast-element": "^2.9.2"
6463
},
6564
"beachball": {
6665
"disallowedChangeTypes": [

β€Žpackages/fast-ssr/src/dom-shim.spec.tsβ€Ž

Lines changed: 13 additions & 104 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import "./install-dom-shim.js";
22
import { expect, test } from "@playwright/test";
3-
import * as Foundation from "@microsoft/fast-foundation";
4-
import { ElementViewTemplate, FASTElement } from "@microsoft/fast-element";
3+
import { FASTElement, html } from "@microsoft/fast-element";
54
import { createWindow } from "./dom-shim.js";
65
import fastSSR from "./exports.js";
76
import { uniqueElementName } from "@microsoft/fast-element/testing.js";
@@ -29,110 +28,20 @@ test.describe("createWindow", () => {
2928
});
3029
});
3130

32-
function deriveName(ctor: typeof FASTElement) {
33-
const baseName = ctor.name.toLowerCase();
34-
return `fast-${baseName}`;
35-
}
36-
37-
const dataGrid = deriveName(Foundation.FASTDataGrid);
38-
const dataGridRow = deriveName(Foundation.FASTDataGridRow);
39-
const dataGridCell = deriveName(Foundation.FASTDataGridCell);
40-
const anchoredRegion = deriveName(Foundation.FASTAnchoredRegion);
41-
const pickerList = deriveName(Foundation.FASTPickerList);
42-
const pickerListItem = deriveName(Foundation.FASTPickerListItem);
43-
const pickerMenu = deriveName(Foundation.FASTPickerMenu);
44-
const pickerMenuOption = deriveName(Foundation.FASTPickerMenuOption);
45-
const progressRing = deriveName(Foundation.FASTProgressRing);
46-
47-
const componentsAndTemplates: [typeof FASTElement, ElementViewTemplate][] = [
48-
[Foundation.FASTAccordion, Foundation.accordionTemplate()],
49-
[Foundation.FASTAccordionItem, Foundation.accordionItemTemplate()],
50-
[Foundation.FASTAnchor, Foundation.anchorTemplate()],
51-
[Foundation.FASTAnchoredRegion, Foundation.anchoredRegionTemplate()],
52-
[Foundation.FASTAvatar, Foundation.avatarTemplate()],
53-
[Foundation.FASTBadge, Foundation.badgeTemplate()],
54-
[Foundation.FASTBreadcrumb, Foundation.breadcrumbTemplate()],
55-
[Foundation.FASTBreadcrumbItem, Foundation.breadcrumbItemTemplate()],
56-
[Foundation.FASTButton, Foundation.buttonTemplate()],
57-
[
58-
Foundation.FASTCalendar,
59-
Foundation.calendarTemplate({
60-
dataGrid,
61-
dataGridRow,
62-
dataGridCell,
63-
}),
64-
],
65-
[Foundation.FASTCard, Foundation.cardTemplate()],
66-
[Foundation.FASTCheckbox, Foundation.checkboxTemplate()],
67-
[Foundation.FASTCombobox, Foundation.comboboxTemplate()],
68-
[
69-
Foundation.FASTDataGrid,
70-
Foundation.dataGridTemplate({
71-
dataGridRow,
72-
}),
73-
],
74-
[Foundation.FASTDataGridCell, Foundation.dataGridCellTemplate()],
75-
[
76-
Foundation.FASTDataGridRow,
77-
Foundation.dataGridRowTemplate({
78-
dataGridCell,
79-
}),
80-
],
81-
[Foundation.FASTDialog, Foundation.dialogTemplate()],
82-
[Foundation.FASTDisclosure, Foundation.disclosureTemplate()],
83-
[Foundation.FASTDivider, Foundation.dividerTemplate()],
84-
[Foundation.FASTFlipper, Foundation.flipperTemplate()],
85-
[Foundation.FASTHorizontalScroll, Foundation.horizontalScrollTemplate()],
86-
[Foundation.FASTListbox as any as typeof FASTElement, Foundation.listboxTemplate()],
87-
[Foundation.FASTListboxOption, Foundation.listboxOptionTemplate()],
88-
[Foundation.FASTMenu, Foundation.menuTemplate()],
89-
[Foundation.FASTMenuItem, Foundation.menuItemTemplate()],
90-
[Foundation.FASTNumberField, Foundation.numberFieldTemplate()],
91-
[
92-
Foundation.FASTPicker,
93-
Foundation.pickerTemplate({
94-
anchoredRegion,
95-
pickerList,
96-
pickerListItem,
97-
pickerMenu,
98-
pickerMenuOption,
99-
progressRing,
100-
}),
101-
],
102-
[Foundation.FASTPickerList, Foundation.pickerListTemplate()],
103-
[Foundation.FASTPickerListItem, Foundation.pickerListItemTemplate()],
104-
[Foundation.FASTPickerMenu, Foundation.pickerMenuTemplate()],
105-
[Foundation.FASTPickerMenuOption, Foundation.pickerMenuOptionTemplate()],
106-
[Foundation.FASTProgress, Foundation.progressTemplate()],
107-
[Foundation.FASTProgressRing, Foundation.progressRingTemplate()],
108-
[Foundation.FASTRadio, Foundation.radioTemplate()],
109-
[Foundation.FASTRadioGroup, Foundation.radioGroupTemplate()],
110-
[Foundation.FASTSearch, Foundation.searchTemplate()],
111-
[Foundation.FASTSkeleton, Foundation.skeletonTemplate()],
112-
[Foundation.FASTSlider, Foundation.sliderTemplate()],
113-
[Foundation.FASTSliderLabel, Foundation.sliderLabelTemplate()],
114-
[Foundation.FASTSwitch, Foundation.switchTemplate()],
115-
[Foundation.FASTTab, Foundation.tabTemplate()],
116-
[Foundation.FASTTabPanel, Foundation.tabPanelTemplate()],
117-
[Foundation.FASTTabs, Foundation.tabsTemplate()],
118-
[Foundation.FASTTextArea, Foundation.textAreaTemplate()],
119-
[Foundation.FASTTextField, Foundation.textFieldTemplate()],
120-
[Foundation.FASTToolbar, Foundation.toolbarTemplate()],
121-
[Foundation.FASTTooltip,Foundation.tooltipTemplate()],
122-
[Foundation.FASTTreeItem, Foundation.treeItemTemplate()],
123-
[Foundation.FASTTreeView, Foundation.treeViewTemplate()],
124-
];
125-
12631
test.describe("The DOM shim", () => {
127-
componentsAndTemplates.forEach(([ctor, template]) => {
128-
const name = deriveName(ctor);
129-
ctor.define({ name, template });
130-
131-
test(`should support construction and connection of the ${ctor.name} component and template during SSR rendering`, () => {
132-
const { templateRenderer } = fastSSR();
133-
const templateString = `<${name}></${name}>`;
134-
expect(() => templateRenderer.render(templateString)).not.toThrow();
32+
test(`should support construction and connection of a component and template during SSR rendering`, () => {
33+
class MyComponent extends FASTElement {}
34+
35+
const name = "my-component";
36+
37+
MyComponent.define({
38+
name,
39+
template: html``
13540
});
41+
42+
const { templateRenderer } = fastSSR();
43+
const templateString = `<${name}></${name}>`;
44+
expect(() => templateRenderer.render(templateString)).not.toThrow();
13645
});
13746

13847
test.describe("has a CSSStyleSheet implementation", () => {

0 commit comments

Comments
Β (0)