Skip to content

Commit

Permalink
chore: consolidate text schemas and native element definitions betwee…
Browse files Browse the repository at this point in the history
…n the creator and component explorer site (#3254)
  • Loading branch information
janechu authored Jun 11, 2020
1 parent 94440c5 commit 66ce1ad
Show file tree
Hide file tree
Showing 28 changed files with 99 additions and 221 deletions.
9 changes: 7 additions & 2 deletions sites/fast-component-explorer/app/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,15 @@ import { get, omit } from "lodash-es";
import { MenuItem } from "@microsoft/fast-tooling-react";
import { createBrowserHistory } from "history";
import { SchemaDictionary } from "@microsoft/fast-tooling";
import { fastComponentSchemas, nativeElementSchemas } from "@microsoft/site-utilities";
import textSchema from "./utilities/text.schema";
import {
fastComponentSchemas,
nativeElementSchemas,
textSchema,
} from "@microsoft/site-utilities";
import { fastMenuItemId } from "./fast-components/configs/fast-menu";
import { fastSliderLabelId } from "./fast-components/configs/fast-slider";
import { fastTabId, fastTabPanelId } from "./fast-components/configs/fast-tabs";
import { fastDesignSystemProviderId } from "./fast-components/configs/fast-design-system-provider";

const schemaDictionary: SchemaDictionary = {
...fastComponentSchemas,
Expand All @@ -23,6 +27,7 @@ const menu: MenuItem[] = generateMenu(
fastSliderLabelId,
fastTabId,
fastTabPanelId,
fastDesignSystemProviderId,
...Object.entries(nativeElementSchemas).map(
([, nativeElementSchema]: [string, any]) => {
return nativeElementSchema.id;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { fastComponentSchemas } from "@microsoft/site-utilities";
import textSchema from "../../utilities/text.schema";
import { fastComponentSchemas, textSchema } from "@microsoft/site-utilities";
import Guidance from "../../.tmp/anchor/guidance";
import { ComponentViewConfig } from "./data.props";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { fastComponentSchemas } from "@microsoft/site-utilities";
import textSchema from "../../utilities/text.schema";
import { fastComponentSchemas, textSchema } from "@microsoft/site-utilities";
import Guidance from "../../.tmp/badge/guidance";
import { ComponentViewConfig } from "./data.props";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { fastComponentSchemas } from "@microsoft/site-utilities";
import textSchema from "../../utilities/text.schema";
import { fastComponentSchemas, textSchema } from "@microsoft/site-utilities";
import Guidance from "../../.tmp/button/guidance";
import { ComponentViewConfig } from "./data.props";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import { fastComponentSchemas } from "@microsoft/site-utilities";
import textSchema from "../../utilities/text.schema";
import { fastComponentSchemas, textSchema } from "@microsoft/site-utilities";
import Guidance from "../../.tmp/card/guidance";
import { imageSchema } from "../../utilities";
import { ComponentViewConfig } from "./data.props";
import { fastButtonId } from "./fast-button";

Expand Down Expand Up @@ -33,7 +31,7 @@ const fastCardConfig: ComponentViewConfig = {
id: "root",
dataLocation: "Slot",
},
schemaId: imageSchema.id,
schemaId: "img",
data: {
src: "https://placehold.it/300x200/414141",
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { fastComponentSchemas } from "@microsoft/site-utilities";
import textSchema from "../../utilities/text.schema";
import { fastComponentSchemas, textSchema } from "@microsoft/site-utilities";
import Guidance from "../../.tmp/checkbox/guidance";
import { ComponentViewConfig } from "./data.props";

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const fastDesignSystemProviderId = "fast-design-system-provider";
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { fastComponentSchemas } from "@microsoft/site-utilities";
import textSchema from "../../utilities/text.schema";
import { fastComponentSchemas, textSchema } from "@microsoft/site-utilities";
import Guidance from "../../.tmp/dialog/guidance";
import { ComponentViewConfig } from "./data.props";
import { fastButtonId } from "./fast-button";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { fastComponentSchemas } from "@microsoft/site-utilities";
import textSchema from "../../utilities/text.schema";
import { fastComponentSchemas, textSchema } from "@microsoft/site-utilities";
import Guidance from "../../.tmp/menu/guidance";
import { ComponentViewConfig } from "./data.props";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { fastComponentSchemas } from "@microsoft/site-utilities";
import textSchema from "../../utilities/text.schema";
import { fastComponentSchemas, textSchema } from "@microsoft/site-utilities";
import Guidance from "../../.tmp/radio-group/guidance";
import { ComponentViewConfig } from "./data.props";
import { fastRadioId } from "./fast-radio";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { fastComponentSchemas } from "@microsoft/site-utilities";
import textSchema from "../../utilities/text.schema";
import { fastComponentSchemas, textSchema } from "@microsoft/site-utilities";
import Guidance from "../../.tmp/radio/guidance";
import { ComponentViewConfig } from "./data.props";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { fastComponentSchemas } from "@microsoft/site-utilities";
import textSchema from "../../utilities/text.schema";
import { fastComponentSchemas, textSchema } from "@microsoft/site-utilities";
import Guidance from "../../.tmp/tabs/guidance";
import { ComponentViewConfig } from "./data.props";

Expand Down
29 changes: 13 additions & 16 deletions sites/fast-component-explorer/app/preview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ import {
previewDirection,
previewTheme,
} from "./explorer";
import { nativeElementTags } from "./utilities";

// Prevent tree shaking
FASTComponents;
Expand Down Expand Up @@ -197,21 +196,19 @@ class Preview extends Foundation<
tags: Object.entries({
...componentDefinitions,
...nativeElementDefinitions,
})
.reduce(
(
previousValue: WebComponentDefinitionTag[],
currentValue: [string, WebComponentDefinition]
) => {
if (Array.isArray(currentValue[1].tags)) {
return previousValue.concat(currentValue[1].tags);
}

return previousValue;
},
[]
)
.concat(nativeElementTags),
}).reduce(
(
previousValue: WebComponentDefinitionTag[],
currentValue: [string, WebComponentDefinition]
) => {
if (Array.isArray(currentValue[1].tags)) {
return previousValue.concat(currentValue[1].tags);
}

return previousValue;
},
[]
),
}),
resolver: htmlResolver,
})
Expand Down
23 changes: 0 additions & 23 deletions sites/fast-component-explorer/app/utilities/image.definition.ts

This file was deleted.

1 change: 0 additions & 1 deletion sites/fast-component-explorer/app/utilities/index.ts

This file was deleted.

19 changes: 0 additions & 19 deletions sites/fast-component-explorer/app/utilities/label.definition.ts

This file was deleted.

This file was deleted.

3 changes: 0 additions & 3 deletions sites/fast-creator/app/configs/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
export * from "./map-component-definition-to-json-schema";
export * from "./map-native-element-definition-to-json-schema";
export * from "./fast-design-system-provider.definition";
export * from "./linked-data-examples";
Loading

0 comments on commit 66ce1ad

Please sign in to comment.