First implementation of the 'React Fluent UI Theme Variant' sample

This commit is contained in:
Fabio Franzini 2021-08-05 16:29:38 +02:00
parent 4ea97e510d
commit ec8162e8ea
23 changed files with 22394 additions and 0 deletions

View File

@ -0,0 +1,33 @@
# Logs
logs
*.log
npm-debug.log*
# Dependency directories
node_modules
# Build generated files
dist
lib
release
solution
temp
*.sppkg
# Coverage directory used by tools like istanbul
coverage
# OSX
.DS_Store
# Visual Studio files
.ntvs_analysis.dat
.vs
bin
obj
# Resx Generated Code
*.resx.ts
# Styles Generated Code
*.scss.ts

View File

@ -0,0 +1,12 @@
{
"@microsoft/generator-sharepoint": {
"isCreatingSolution": true,
"environment": "spo",
"version": "1.12.1",
"libraryName": "react-fluentui-theme-variant",
"libraryId": "241da19a-7c8a-4ab9-8b32-bfc5fb77d9d2",
"packageManager": "npm",
"isDomainIsolated": false,
"componentType": "webpart"
}
}

View File

@ -0,0 +1,73 @@
# react-fluentui-theme-variant
## Summary
Short summary on functionality and used technologies.
[picture of the solution in action, if possible]
## Used SharePoint Framework Version
![version](https://img.shields.io/npm/v/@microsoft/sp-component-base/latest?color=green)
## Applies to
- [SharePoint Framework](https://aka.ms/spfx)
- [Microsoft 365 tenant](https://docs.microsoft.com/en-us/sharepoint/dev/spfx/set-up-your-developer-tenant)
> Get your own free development tenant by subscribing to [Microsoft 365 developer program](http://aka.ms/o365devprogram)
## Prerequisites
> Any special pre-requisites?
## Solution
Solution|Author(s)
--------|---------
folder name | Author details (name, company, twitter alias with link)
## Version history
Version|Date|Comments
-------|----|--------
1.1|March 10, 2021|Update comment
1.0|January 29, 2021|Initial release
## Disclaimer
**THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.**
---
## Minimal Path to Awesome
- Clone this repository
- Ensure that you are at the solution folder
- in the command-line run:
- **npm install**
- **gulp serve**
> Include any additional steps as needed.
## Features
Description of the extension that expands upon high-level summary above.
This extension illustrates the following concepts:
- topic 1
- topic 2
- topic 3
> Notice that better pictures and documentation will increase the sample usage and the value you are providing for others. Thanks for your submissions advance.
> Share your web part with others through Microsoft 365 Patterns and Practices program to get visibility and exposure. More details on the community, open-source projects and other activities from http://aka.ms/m365pnp.
## References
- [Getting started with SharePoint Framework](https://docs.microsoft.com/en-us/sharepoint/dev/spfx/set-up-your-developer-tenant)
- [Building for Microsoft teams](https://docs.microsoft.com/en-us/sharepoint/dev/spfx/build-for-teams-overview)
- [Use Microsoft Graph in your solution](https://docs.microsoft.com/en-us/sharepoint/dev/spfx/web-parts/get-started/using-microsoft-graph-apis)
- [Publish SharePoint Framework applications to the Marketplace](https://docs.microsoft.com/en-us/sharepoint/dev/spfx/publish-to-marketplace-overview)
- [Microsoft 365 Patterns and Practices](https://aka.ms/m365pnp) - Guidance, tooling, samples and open-source controls for your Microsoft 365 development

View File

@ -0,0 +1,19 @@
{
"$schema": "https://developer.microsoft.com/json-schemas/spfx-build/config.2.0.schema.json",
"version": "2.0",
"bundles": {
"fluent-ui-theme-variant-web-part": {
"components": [
{
"entrypoint": "./lib/webparts/fluentUiThemeVariant/FluentUiThemeVariantWebPart.js",
"manifest": "./src/webparts/fluentUiThemeVariant/FluentUiThemeVariantWebPart.manifest.json"
}
]
}
},
"externals": {},
"localizedResources": {
"FluentUiThemeVariantWebPartStrings": "lib/webparts/fluentUiThemeVariant/loc/{locale}.js",
"PropertyControlStrings": "node_modules/@pnp/spfx-property-controls/lib/loc/{locale}.js"
}
}

View File

@ -0,0 +1,4 @@
{
"$schema": "https://developer.microsoft.com/json-schemas/spfx-build/copy-assets.schema.json",
"deployCdnPath": "./release/assets/"
}

View File

@ -0,0 +1,7 @@
{
"$schema": "https://developer.microsoft.com/json-schemas/spfx-build/deploy-azure-storage.schema.json",
"workingDir": "./release/assets/",
"account": "<!-- STORAGE ACCOUNT NAME -->",
"container": "react-fluentui-theme-variant",
"accessKey": "<!-- ACCESS KEY -->"
}

View File

@ -0,0 +1,20 @@
{
"$schema": "https://developer.microsoft.com/json-schemas/spfx-build/package-solution.schema.json",
"solution": {
"name": "react-fluentui-theme-variant-client-side-solution",
"id": "241da19a-7c8a-4ab9-8b32-bfc5fb77d9d2",
"version": "1.0.0.0",
"includeClientSideAssets": true,
"isDomainIsolated": false,
"developer": {
"name": "",
"websiteUrl": "",
"privacyUrl": "",
"termsOfUseUrl": "",
"mpnId": ""
}
},
"paths": {
"zippedPackage": "solution/react-fluentui-theme-variant.sppkg"
}
}

View File

@ -0,0 +1,10 @@
{
"$schema": "https://developer.microsoft.com/json-schemas/core-build/serve.schema.json",
"port": 4321,
"https": true,
"initialPage": "https://localhost:5432/workbench",
"api": {
"port": 5432,
"entryPath": "node_modules/@microsoft/sp-webpart-workbench/lib/api/"
}
}

View File

@ -0,0 +1,4 @@
{
"$schema": "https://developer.microsoft.com/json-schemas/spfx-build/write-manifests.schema.json",
"cdnBasePath": "<!-- PATH TO CDN -->"
}

View File

@ -0,0 +1,16 @@
'use strict';
const build = require('@microsoft/sp-build-web');
build.addSuppression(`Warning - [sass] The local CSS class 'ms-Grid' is not camelCase and will not be type-safe.`);
var getTasks = build.rig.getTasks;
build.rig.getTasks = function () {
var result = getTasks.call(build.rig);
result.set('serve', result.get('serve-deprecated'));
return result;
};
build.initialize(require('gulp'));

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,36 @@
{
"name": "react-fluentui-theme-variant",
"version": "0.0.1",
"private": true,
"main": "lib/index.js",
"scripts": {
"build": "gulp bundle",
"clean": "gulp clean",
"test": "gulp test"
},
"dependencies": {
"@fluentui/react-theme-provider": "^0.18.5",
"@fluentui/scheme-utilities": "^8.1.6",
"@microsoft/sp-core-library": "1.12.1",
"@microsoft/sp-lodash-subset": "1.12.1",
"@microsoft/sp-office-ui-fabric-core": "1.12.1",
"@microsoft/sp-property-pane": "1.12.1",
"@microsoft/sp-webpart-base": "1.12.1",
"@pnp/spfx-property-controls": "^3.2.0",
"office-ui-fabric-react": "7.156.0",
"react": "16.9.0",
"react-dom": "16.9.0"
},
"devDependencies": {
"@types/react": "16.9.36",
"@types/react-dom": "16.9.8",
"@microsoft/sp-build-web": "1.12.1",
"@microsoft/sp-tslint-rules": "1.12.1",
"@microsoft/sp-module-interfaces": "1.12.1",
"@microsoft/sp-webpart-workbench": "1.12.1",
"@microsoft/rush-stack-compiler-3.7": "0.2.3",
"gulp": "~4.0.2",
"ajv": "~5.2.2",
"@types/webpack-env": "1.13.1"
}
}

View File

@ -0,0 +1 @@
// A file is required to be in the root of the /src directory by the TypeScript compiler

View File

@ -0,0 +1,121 @@
import { Theme } from "@fluentui/react-theme-provider";
import { getNeutralVariant, getSoftVariant, getStrongVariant } from "@fluentui/scheme-utilities/lib/variants";
import { IReadonlyTheme } from '@microsoft/sp-component-base';
import { ServiceKey, ServiceScope } from "@microsoft/sp-core-library";
import { BaseSlots, createTheme, FabricSlots, getColorFromString, getContrastRatio, getTheme, IColor, isDark, ThemeGenerator, themeRulesStandardCreator } from "office-ui-fabric-react";
export interface IContrastRatioPair {
contrastRatioValue: string;
contrastRatioPair: string;
colorPair: string;
}
export enum ThemeType {
current = "current",
section = "section",
custom = "custom"
}
export enum BackgroundShadingType {
none = "none",
neutral = "neutral",
soft = "soft",
strong = "strong"
}
export interface IThemeService {
setCustomColors(primaryColor: string, textColor: string, backgroundColor: string): void;
setThemeVariant(themeVariant: IReadonlyTheme | Theme): void;
generateTheme(themeType: ThemeType, backgroundShadingType: BackgroundShadingType): IReadonlyTheme | Theme;
}
const ThemeService_ServiceKey = 'ReactFluentUIThemeVariant:ThemeService';
export class ThemeService implements IThemeService {
public static ServiceKey: ServiceKey<IThemeService> = ServiceKey.create(ThemeService_ServiceKey, ThemeService);
private serviceScope: ServiceScope;
private themeRules = themeRulesStandardCreator();
private themeVariant: IReadonlyTheme | Theme;
private primaryColor: string;
private textColor: string;
private backgroundColor: string;
public constructor(serviceScope: ServiceScope) {
this.serviceScope = serviceScope;
}
public setCustomColors(primaryColor: string, textColor: string, backgroundColor: string): void {
if (!primaryColor)
throw 'primaryColor == null or undefined';
else
this.primaryColor = primaryColor;
if (!textColor)
throw 'textColor == null or undefined';
else
this.textColor = textColor;
if (!backgroundColor)
throw 'backgroundColor == null or undefined';
this.backgroundColor = backgroundColor;
}
public setThemeVariant(themeVariant: IReadonlyTheme | Theme): void {
this.themeVariant = themeVariant;
}
public generateTheme(themeType: ThemeType, backgroundShadingType: BackgroundShadingType): IReadonlyTheme | Theme {
let currentTheme: IReadonlyTheme | Theme;
switch (themeType) {
case ThemeType.current: currentTheme = this.getDefaultTheme();
break;
case ThemeType.section: currentTheme = this.themeVariant;
break;
case ThemeType.custom: currentTheme = this.generateThemeFromColors();
break;
}
switch (backgroundShadingType) {
case BackgroundShadingType.none: currentTheme = currentTheme;
break;
case BackgroundShadingType.neutral: currentTheme = getNeutralVariant(currentTheme);
break;
case BackgroundShadingType.soft: currentTheme = getSoftVariant(currentTheme);
break;
case BackgroundShadingType.strong: currentTheme = getStrongVariant(currentTheme);
break;
}
return currentTheme;
}
private getDefaultTheme(): Theme {
let currentTheme;
const themeColorsFromWindow: any = (window as any).__themeState__.theme;
if (themeColorsFromWindow) {
currentTheme = createTheme({
palette: themeColorsFromWindow
});
}
else
currentTheme = getTheme();
return currentTheme;
}
private generateThemeFromColors(): Theme {
ThemeGenerator.setSlot(this.themeRules[BaseSlots[BaseSlots.primaryColor]], getColorFromString(this.primaryColor), false, true, true);
ThemeGenerator.setSlot(this.themeRules[BaseSlots[BaseSlots.foregroundColor]], getColorFromString(this.textColor), false, true, true);
ThemeGenerator.setSlot(this.themeRules[BaseSlots[BaseSlots.backgroundColor]], getColorFromString(this.backgroundColor), false, true, true);
ThemeGenerator.insureSlots(this.themeRules, false);
let generatedTheme = createTheme({
...{ palette: ThemeGenerator.getThemeAsJson(this.themeRules) },
isInverted: isDark(this.themeRules[BaseSlots[BaseSlots.backgroundColor]].color!),
});
return generatedTheme;
}
}

View File

@ -0,0 +1,22 @@
{
"$schema": "https://developer.microsoft.com/json-schemas/spfx/client-side-web-part-manifest.schema.json",
"id": "91003ade-424e-44d5-8c1e-af1273519a18",
"alias": "FluentUiThemeVariantWebPart",
"componentType": "WebPart",
"version": "*",
"manifestVersion": 2,
"requiresCustomScript": false,
"supportedHosts": ["SharePointWebPart"],
"supportsThemeVariants": true,
"preconfiguredEntries": [{
"groupId": "5c03119e-3074-46fd-976b-c60198311f70",
"group": { "default": "Other" },
"title": { "default": "Fluent UI Theme Variant" },
"description": { "default": "Example on how to apply Fluent UI theme variant not only at Section level but at Web Part level" },
"officeFabricIconFontName": "BackgroundColor",
"properties": {
"themeType": "current",
"backgroundShadingType": "none"
}
}]
}

View File

@ -0,0 +1,234 @@
import { IReadonlyTheme, ThemeChangedEventArgs, ThemeProvider } from '@microsoft/sp-component-base';
import { Version } from '@microsoft/sp-core-library';
import { isEqual } from '@microsoft/sp-lodash-subset';
import {
IPropertyPaneConfiguration,
PropertyPaneChoiceGroup,
PropertyPaneDropdown
} from '@microsoft/sp-property-pane';
import { BaseClientSideWebPart } from '@microsoft/sp-webpart-base';
import { PropertyFieldColorPicker, PropertyFieldColorPickerStyle } from '@pnp/spfx-property-controls/lib/PropertyFieldColorPicker';
import { PropertyFieldMessage } from '@pnp/spfx-property-controls/lib/PropertyFieldMessage';
import * as strings from 'FluentUiThemeVariantWebPartStrings';
import { MessageBarType } from 'office-ui-fabric-react/lib/MessageBar';
import * as React from 'react';
import * as ReactDom from 'react-dom';
import { BackgroundShadingType, IContrastRatioPair, IThemeService, ThemeService, ThemeType } from '../../services/ThemeService';
import FluentUiThemeVariant, { IFluentUiThemeVariantProps } from './components/FluentUiThemeVariant';
export interface IFluentUiThemeVariantWebPartProps {
themeType: ThemeType;
backgroundShadingType: BackgroundShadingType;
primaryColor: string;
textColor: string;
backgroundColor: string;
}
export default class FluentUiThemeVariantWebPart extends BaseClientSideWebPart<IFluentUiThemeVariantWebPartProps> {
private themeService: IThemeService;
protected themeProvider: ThemeProvider;
protected themeVariant: IReadonlyTheme;
protected onInit(): Promise<void> {
this.themeService = this.context.serviceScope.consume<IThemeService>(ThemeService.ServiceKey);
this.themeProvider = this.context.serviceScope.consume(ThemeProvider.serviceKey);
this.themeVariant = this.themeProvider.tryGetTheme();
this.themeProvider.themeChangedEvent.add(this, (args: ThemeChangedEventArgs): void => {
if (!isEqual(this.themeVariant, args.theme)) {
this.themeVariant = args.theme;
this.themeService.setThemeVariant(this.themeVariant);
this.render();
}
});
if (!this.properties.primaryColor)
this.properties.primaryColor = "#0078d4";
if (!this.properties.textColor)
this.properties.textColor = "#323130";
if (!this.properties.backgroundColor)
this.properties.backgroundColor = "#ffffff";
this.themeService.setThemeVariant(this.themeVariant);
this.themeService.setCustomColors(this.properties.primaryColor, this.properties.textColor, this.properties.backgroundColor);
return super.onInit();
}
public render(): void {
const element: React.ReactElement<IFluentUiThemeVariantProps> = React.createElement(
FluentUiThemeVariant,
{
themeVariant: this.themeService.generateTheme(
this.properties.themeType,
this.properties.backgroundShadingType)
}
);
ReactDom.render(element, this.domElement);
}
protected onDispose(): void {
ReactDom.unmountComponentAtNode(this.domElement);
}
protected get dataVersion(): Version {
return Version.parse('1.0');
}
protected getPropertyPaneConfiguration(): IPropertyPaneConfiguration {
let inlineSvgNone = this.generateInlineSvgForBackgroundShadingType(BackgroundShadingType.none);
let inlineSvgNeutral = this.generateInlineSvgForBackgroundShadingType(BackgroundShadingType.neutral);
let inlineSvgSoft = this.generateInlineSvgForBackgroundShadingType(BackgroundShadingType.soft);
let inlineSvgStrong = this.generateInlineSvgForBackgroundShadingType(BackgroundShadingType.strong);
console.log(inlineSvgNone);
console.log(inlineSvgStrong);
return {
pages: [
{
header: {
description: strings.PropertyPaneDescription
},
groups: [
{
groupName: strings.BasicGroupName,
groupFields: [
PropertyPaneDropdown('themeType', {
label: strings.ThemeTypeField,
options: [
{ key: ThemeType.current, text: strings.Texts.Current },
{ key: ThemeType.section, text: strings.Texts.Section },
{ key: ThemeType.custom, text: strings.Texts.Custom }
]
}),
// PropertyFieldMessage("", {
// key: "colorPaletteAccessibilityErrors",
// text: this.getNonAccessiblePairsMessage(this.themeService.getNonAccessiblePairs()),
// multiline: true,
// messageType: MessageBarType.warning,
// isVisible: this.properties.themeType == ThemeType.custom && this.themeService.getNonAccessiblePairs().length > 0,
// }),
PropertyFieldColorPicker('primaryColor', {
label: strings.PrimaryColorField,
selectedColor: this.properties.primaryColor,
onPropertyChange: this.onCustomPropertyPaneFieldChanged,
properties: this.properties,
disabled: false,
isHidden: this.properties.themeType != ThemeType.custom,
alphaSliderHidden: false,
style: PropertyFieldColorPickerStyle.Inline,
iconName: 'Color',
key: 'primaryColorFieldId'
}),
PropertyFieldColorPicker('textColor', {
label: strings.TextColorField,
selectedColor: this.properties.textColor,
onPropertyChange: this.onCustomPropertyPaneFieldChanged,
properties: this.properties,
disabled: false,
isHidden: this.properties.themeType != ThemeType.custom,
alphaSliderHidden: false,
style: PropertyFieldColorPickerStyle.Inline,
iconName: 'Color',
key: 'textColorFieldId'
}),
PropertyFieldColorPicker('backgroundColor', {
label: strings.BackgroundColorField,
selectedColor: this.properties.backgroundColor,
onPropertyChange: this.onCustomPropertyPaneFieldChanged,
properties: this.properties,
disabled: false,
isHidden: this.properties.themeType != ThemeType.custom,
alphaSliderHidden: false,
style: PropertyFieldColorPickerStyle.Inline,
iconName: 'Color',
key: 'backgroundColorFieldId'
}),
PropertyPaneChoiceGroup('backgroundShadingType', {
label: strings.BackgroundShadingTypeField,
options: [{
key: BackgroundShadingType.none,
text: strings.Texts.None,
imageSize: {
width: 40,
height: 40
},
imageSrc: inlineSvgNone,
selectedImageSrc: inlineSvgNone
},
{
key: BackgroundShadingType.neutral,
text: strings.Texts.Neutral,
imageSize: {
width: 40,
height: 40
},
imageSrc: inlineSvgNeutral,
selectedImageSrc: inlineSvgNeutral
},
{
key: BackgroundShadingType.soft,
text: strings.Texts.Soft,
imageSize: {
width: 40,
height: 40
},
imageSrc: inlineSvgSoft,
selectedImageSrc: inlineSvgSoft
},
{
key: BackgroundShadingType.strong,
text: strings.Texts.Strong,
imageSize: {
width: 40,
height: 40
},
imageSrc: inlineSvgStrong,
selectedImageSrc: inlineSvgStrong
}]
})
]
}
]
}
]
};
}
private generateInlineSvgForBackgroundShadingType(type: BackgroundShadingType): string {
let currentTheme = this.themeService.generateTheme(this.properties.themeType, type);
let backgroundColor = currentTheme.semanticColors.bodyBackground.replace("#", "%23");
let textColor = currentTheme.semanticColors.bodyText.replace("#", "%23");
return `data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='45' height='45'%3E%3Crect x='0' y='0' width='45' height='45' stroke='black' stroke-width='2px' fill='${backgroundColor}'/%3E%3Ctext fill='${textColor}' font-family='Segoe UI, sans-serif' x='50%25' y='55%25' dominant-baseline='middle' text-anchor='middle'%3EAa%3C/text%3E%3C/svg%3E`;
}
private onCustomPropertyPaneFieldChanged = (targetProperty: string, oldValue: string, newValue: string) => {
if (targetProperty == "primaryColor" || targetProperty == "textColor" || targetProperty == "backgroundColor") {
this.themeService.setCustomColors(this.properties.primaryColor, this.properties.textColor, this.properties.backgroundColor);
//this.themeService.calculateContrastRatioPairs();
}
this.onPropertyPaneFieldChanged(targetProperty, oldValue, newValue);
}
// private getNonAccessiblePairsMessage(contrastRatios: IContrastRatioPair[]): string {
// let message = `Your color palette has ${this.themeService.getNonAccessiblePairs().length} accessibility errors:`;
// contrastRatios.forEach((element, index) => {
// message += (index > 0) ? `, ${element.colorPair}` : ` ${element.colorPair}`;
// });
// return message;
// }
}

View File

@ -0,0 +1,54 @@
import { ThemeProvider } from '@fluentui/react-theme-provider';
import { DefaultButton, DetailsList, DetailsListLayoutMode, Label, Link, PrimaryButton, Stack } from 'office-ui-fabric-react';
import * as React from 'react';
import { useEffect } from 'react';
import { PartialTheme, Theme } from '@fluentui/react-theme-provider';
export interface IFluentUiThemeVariantProps {
themeVariant: PartialTheme | Theme;
}
export default function FluentUiThemeVariant(props: IFluentUiThemeVariantProps) {
const [items, setItems] = React.useState(new Array());
useEffect(() => {
// Populate with items for demos.
let allItems = [];
for (let i = 0; i < 5; i++) {
allItems.push({
key: i,
name: 'Item ' + i,
value: i,
});
}
setItems(allItems);
}, [props.themeVariant]);
return (
<ThemeProvider theme={props.themeVariant}>
<Stack tokens={{ childrenGap: 5, padding: 5 }}>
<Label>This Web Part implements an example on how to use the 'Fluent UI' theme library and how to apply/generate theme variation for the Web Part itself.</Label>
<PrimaryButton>Primary Button</PrimaryButton>
<DefaultButton>Default Button</DefaultButton>
<Link>Link</Link>
<DetailsList
items={items}
columns={
[
{ key: 'column1', name: 'Name', fieldName: 'name', minWidth: 100, maxWidth: 200, isResizable: true },
{ key: 'column2', name: 'Value', fieldName: 'value', minWidth: 100, maxWidth: 200, isResizable: true },
]
}
setKey="set"
layoutMode={DetailsListLayoutMode.justified}
selectionPreservedOnEmptyClick={true}
ariaLabelForSelectionColumn="Toggle selection"
ariaLabelForSelectAllCheckbox="Toggle selection for all items"
checkButtonAriaLabel="Row checkbox"
/>
</Stack>
</ThemeProvider>
);
}

View File

@ -0,0 +1,20 @@
define([], function() {
return {
"PropertyPaneDescription": "Web Part Configuration",
"BasicGroupName": "Core Settings",
"ThemeTypeField": "Theme Type",
"PrimaryColorField": "Primary Color",
"TextColorField": "Text Color",
"BackgroundColorField": "Background Color",
"BackgroundShadingTypeField": "Background Shading",
"Texts": {
"Current": "Current SharePoint Theme",
"Section": "Current Section Variation",
"Custom": "Custom",
"None": "None",
"Neutral": "Neutral",
"Soft": "Soft",
"Strong": "Strong",
}
}
});

View File

@ -0,0 +1,23 @@
declare interface IFluentUiThemeVariantWebPartStrings {
PropertyPaneDescription: string;
BasicGroupName: string;
ThemeTypeField: string;
PrimaryColorField: string;
TextColorField: string;
BackgroundColorField: string;
BackgroundShadingTypeField: string;
Texts: {
Current: string;
Section: string;
Custom: string;
None: string;
Neutral: string;
Soft: string;
Strong: string;
}
}
declare module 'FluentUiThemeVariantWebPartStrings' {
const strings: IFluentUiThemeVariantWebPartStrings;
export = strings;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 383 B

View File

@ -0,0 +1,35 @@
{
"extends": "./node_modules/@microsoft/rush-stack-compiler-3.7/includes/tsconfig-web.json",
"compilerOptions": {
"target": "es5",
"forceConsistentCasingInFileNames": true,
"module": "esnext",
"moduleResolution": "node",
"jsx": "react",
"declaration": true,
"sourceMap": true,
"experimentalDecorators": true,
"skipLibCheck": true,
"outDir": "lib",
"inlineSources": false,
"strictNullChecks": false,
"noUnusedLocals": false,
"typeRoots": [
"./node_modules/@types",
"./node_modules/@microsoft"
],
"types": [
"webpack-env"
],
"lib": [
"es5",
"dom",
"es2015.collection",
"es2015.promise"
]
},
"include": [
"src/**/*.ts",
"src/**/*.tsx"
]
}

View File

@ -0,0 +1,30 @@
{
"extends": "./node_modules/@microsoft/sp-tslint-rules/base-tslint.json",
"rules": {
"class-name": false,
"export-name": false,
"forin": false,
"label-position": false,
"member-access": true,
"no-arg": false,
"no-console": false,
"no-construct": false,
"no-duplicate-variable": true,
"no-eval": false,
"no-function-expression": true,
"no-internal-module": true,
"no-shadowed-variable": true,
"no-switch-case-fall-through": true,
"no-unnecessary-semicolons": true,
"no-unused-expression": true,
"no-use-before-declare": true,
"no-with-statement": true,
"semicolon": true,
"trailing-comma": false,
"typedef": false,
"typedef-whitespace": false,
"use-named-parameter": true,
"variable-name": false,
"whitespace": false
}
}