@microsoft/generator-sharepoint 1.13.0-beta.20 → 1.13.0-beta.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/common/BaseGenerator.d.ts +14 -15
- package/lib/common/BaseGenerator.d.ts.map +1 -1
- package/lib/common/BaseGenerator.js +17 -21
- package/lib/common/ConfigJsonManager.d.ts +4 -4
- package/lib/common/ConfigJsonManager.d.ts.map +1 -1
- package/lib/common/ConfigJsonManager.js +3 -2
- package/lib/common/JsonManager.d.ts +3 -3
- package/lib/common/JsonManager.d.ts.map +1 -1
- package/lib/common/PackageJsonManager.d.ts +2 -2
- package/lib/common/PackageJsonManager.d.ts.map +1 -1
- package/lib/common/PackageJsonManager.js +0 -1
- package/lib/common/PackageSolutionJsonManager.d.ts +4 -4
- package/lib/common/PackageSolutionJsonManager.d.ts.map +1 -1
- package/lib/common/PackageSolutionJsonManager.js +2 -1
- package/lib/common/ServeJsonManager.d.ts +3 -3
- package/lib/common/ServeJsonManager.d.ts.map +1 -1
- package/lib/common/TeamsManifestJsonManager.d.ts +3 -3
- package/lib/common/TeamsManifestJsonManager.d.ts.map +1 -1
- package/lib/common/YeomanConfiguration.d.ts +1 -1
- package/lib/common/YeomanConfiguration.d.ts.map +1 -1
- package/lib/common/dependency/adaptiveCardExtension/firstParty.json +7 -7
- package/lib/common/dependency/adaptiveCardExtension/firstPartyPlusBeta.json +7 -7
- package/lib/common/dependency/applicationCustomizer.json +2 -2
- package/lib/common/dependency/applicationCustomizerPlusBeta.json +2 -2
- package/lib/common/dependency/commandSet.json +2 -2
- package/lib/common/dependency/commandSetPlusBeta.json +2 -2
- package/lib/common/dependency/extension/firstParty.json +6 -6
- package/lib/common/dependency/extension/firstPartyPlusBeta.json +6 -6
- package/lib/common/dependency/fieldCustomizer.json +1 -1
- package/lib/common/dependency/fieldCustomizerPlusBeta.json +1 -1
- package/lib/common/dependency/library/firstParty.json +4 -4
- package/lib/common/dependency/library/firstPartyPlusBeta.json +4 -4
- package/lib/common/dependency/react.json +4 -4
- package/lib/common/dependency/searchQueryModifier.json +1 -1
- package/lib/common/dependency/searchQueryModifierPlusBeta.json +1 -1
- package/lib/common/dependency/webpart/firstParty.json +9 -9
- package/lib/common/dependency/webpart/firstPartyPlusBeta.json +9 -9
- package/lib/generators/adaptiveCardExtension/index.d.ts +3 -3
- package/lib/generators/adaptiveCardExtension/index.d.ts.map +1 -1
- package/lib/generators/adaptiveCardExtension/index.js +0 -4
- package/lib/generators/app/index.d.ts +1 -1
- package/lib/generators/app/index.d.ts.map +1 -1
- package/lib/generators/app/index.js +1 -2
- package/lib/generators/applicationCustomizer/index.d.ts +3 -3
- package/lib/generators/applicationCustomizer/index.d.ts.map +1 -1
- package/lib/generators/applicationCustomizer/index.js +0 -3
- package/lib/generators/commandSet/index.d.ts +3 -3
- package/lib/generators/commandSet/index.d.ts.map +1 -1
- package/lib/generators/commandSet/index.js +0 -3
- package/lib/generators/component/BaseComponentGenerator.d.ts +1 -1
- package/lib/generators/component/BaseComponentGenerator.d.ts.map +1 -1
- package/lib/generators/component/BaseComponentGenerator.js +0 -2
- package/lib/generators/component/index.d.ts +2 -2
- package/lib/generators/component/index.d.ts.map +1 -1
- package/lib/generators/component/index.js +0 -2
- package/lib/generators/extension/BaseExtensionGenerator.d.ts +3 -3
- package/lib/generators/extension/BaseExtensionGenerator.d.ts.map +1 -1
- package/lib/generators/extension/BaseExtensionGenerator.js +0 -1
- package/lib/generators/extension/index.d.ts +3 -3
- package/lib/generators/extension/index.d.ts.map +1 -1
- package/lib/generators/extension/index.js +0 -3
- package/lib/generators/fieldCustomizer/index.d.ts +3 -3
- package/lib/generators/fieldCustomizer/index.d.ts.map +1 -1
- package/lib/generators/fieldCustomizer/index.js +0 -3
- package/lib/generators/fieldCustomizer/templates/none/{componentClassName}.module.scss +4 -4
- package/lib/generators/fieldCustomizer/templates/react/components/{componentName}.module.scss +4 -4
- package/lib/generators/library/index.d.ts +3 -3
- package/lib/generators/library/index.d.ts.map +1 -1
- package/lib/generators/library/index.js +1 -4
- package/lib/generators/searchQueryModifier/index.d.ts +3 -3
- package/lib/generators/searchQueryModifier/index.d.ts.map +1 -1
- package/lib/generators/searchQueryModifier/index.js +0 -3
- package/lib/generators/solution/index.d.ts +2 -2
- package/lib/generators/solution/index.d.ts.map +1 -1
- package/lib/generators/solution/index.js +3 -5
- package/lib/generators/solution/templates/base/README.md +1 -1
- package/lib/generators/solution/templates/base/tslint.json +0 -1
- package/lib/generators/solution/templates/spo/tsconfig.json +1 -1
- package/lib/generators/webpart/index.d.ts +3 -3
- package/lib/generators/webpart/index.d.ts.map +1 -1
- package/lib/generators/webpart/index.js +0 -3
- package/lib/generators/webpart/templates/base/loc/en-us.js +1 -5
- package/lib/generators/webpart/templates/base/loc/mystrings.d.ts +0 -4
- package/lib/generators/webpart/templates/images/color.png +0 -0
- package/lib/generators/webpart/templates/images/outline.png +0 -0
- package/lib/generators/webpart/templates/none/{componentClassName}.module.scss +47 -40
- package/lib/generators/webpart/templates/none/{componentClassName}.ts +12 -170
- package/lib/generators/webpart/templates/react/components/I{componentName}Props.ts +0 -4
- package/lib/generators/webpart/templates/react/components/{componentName}.module.scss +47 -40
- package/lib/generators/webpart/templates/react/components/{componentName}.tsx +8 -38
- package/lib/generators/webpart/templates/react/{componentClassName}.ts +1 -138
- package/package.json +3 -3
- package/lib/generators/solution/templates/base/config/copy-assets.json +0 -4
- package/lib/generators/webpart/templates/base/assets/welcome-dark.png +0 -0
- package/lib/generators/webpart/templates/base/assets/welcome-light.png +0 -0
|
@@ -6,12 +6,6 @@ import {
|
|
|
6
6
|
PropertyPaneTextField
|
|
7
7
|
} from '@microsoft/sp-property-pane';
|
|
8
8
|
import { BaseClientSideWebPart } from '@microsoft/sp-webpart-base';
|
|
9
|
-
import {
|
|
10
|
-
ThemeProvider,
|
|
11
|
-
ThemeChangedEventArgs,
|
|
12
|
-
IReadonlyTheme,
|
|
13
|
-
ITheme
|
|
14
|
-
} from '@microsoft/sp-component-base';
|
|
15
9
|
|
|
16
10
|
import * as strings from '<%= componentStrings %>';
|
|
17
11
|
import <%= componentName %> from './components/<%= componentName %>';
|
|
@@ -23,150 +17,19 @@ export interface I<%= componentClassName %>Props {
|
|
|
23
17
|
|
|
24
18
|
export default class <%= componentClassName %> extends BaseClientSideWebPart<I<%= componentClassName %>Props> {
|
|
25
19
|
|
|
26
|
-
private _themeProvider: ThemeProvider;
|
|
27
|
-
private _themeVariant: IReadonlyTheme | undefined;
|
|
28
|
-
private _isDarkTheme: boolean = false;
|
|
29
|
-
private _environmentMessage: string = '';
|
|
30
|
-
private _hasTeamsContext: boolean = false;
|
|
31
|
-
|
|
32
|
-
protected onInit(): Promise<void> {
|
|
33
|
-
this._hasTeamsContext = !!this.context.sdks.microsoftTeams;
|
|
34
|
-
|
|
35
|
-
if (this._hasTeamsContext) {
|
|
36
|
-
// handling MS Teams theme
|
|
37
|
-
const teamsTheme = this.context.sdks.microsoftTeams.context.theme;
|
|
38
|
-
this._updateTheme(teamsTheme);
|
|
39
|
-
|
|
40
|
-
this.context.sdks.microsoftTeams.teamsJs.registerOnThemeChangeHandler(this._handleTeamsThemeChangedEvent);
|
|
41
|
-
}
|
|
42
|
-
else {
|
|
43
|
-
// Consume the new ThemeProvider service
|
|
44
|
-
this._themeProvider = this.context.serviceScope.consume(ThemeProvider.serviceKey);
|
|
45
|
-
|
|
46
|
-
// If it exists, get the theme variant
|
|
47
|
-
this._themeVariant = this._themeProvider.tryGetTheme();
|
|
48
|
-
this._updateTheme(this._themeVariant);
|
|
49
|
-
|
|
50
|
-
// Register a handler to be notified if the theme variant changes
|
|
51
|
-
this._themeProvider.themeChangedEvent.add(this, this._handleSPThemeChangedEvent);
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
this._environmentMessage = this._getEnvironmentMessage();
|
|
55
|
-
|
|
56
|
-
return super.onInit();
|
|
57
|
-
}
|
|
58
|
-
|
|
59
20
|
public render(): void {
|
|
60
21
|
const element: React.ReactElement<I<%= componentName %>Props> = React.createElement(
|
|
61
22
|
<%= componentName %>,
|
|
62
23
|
{
|
|
63
|
-
description: this.properties.description
|
|
64
|
-
isDarkTheme: this._isDarkTheme,
|
|
65
|
-
environmentMessage: this._environmentMessage,
|
|
66
|
-
hasTeamsContext: this._hasTeamsContext,
|
|
67
|
-
userDisplayName: this.context.pageContext.user.displayName
|
|
24
|
+
description: this.properties.description
|
|
68
25
|
}
|
|
69
26
|
);
|
|
70
27
|
|
|
71
28
|
ReactDom.render(element, this.domElement);
|
|
72
29
|
}
|
|
73
30
|
|
|
74
|
-
/**
|
|
75
|
-
* Update the current theme variant reference and re-render.
|
|
76
|
-
*
|
|
77
|
-
* @param args The new theme
|
|
78
|
-
*/
|
|
79
|
-
private _handleSPThemeChangedEvent = (args: ThemeChangedEventArgs): void => {
|
|
80
|
-
this._themeVariant = args.theme;
|
|
81
|
-
this._updateTheme(this._themeVariant);
|
|
82
|
-
this.render();
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
/**
|
|
86
|
-
* Handle Teams theme change callback.
|
|
87
|
-
*
|
|
88
|
-
* @param args The new theme
|
|
89
|
-
*/
|
|
90
|
-
private _handleTeamsThemeChangedEvent = (theme: string): void => {
|
|
91
|
-
this._updateTheme(theme);
|
|
92
|
-
this.render();
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
/**
|
|
96
|
-
* Updates fields based on the new theme
|
|
97
|
-
* @param currentTheme updated theme
|
|
98
|
-
*/
|
|
99
|
-
private _updateTheme = (currentTheme: IReadonlyTheme | string) => {
|
|
100
|
-
this._setIsDarkTheme(currentTheme);
|
|
101
|
-
this._setCSSVariables();
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
/**
|
|
105
|
-
* Updates the _isDarkTheme based on current SharePoint or Teams theme
|
|
106
|
-
*/
|
|
107
|
-
private _setIsDarkTheme = (currentTheme: IReadonlyTheme | string) => {
|
|
108
|
-
if (typeof currentTheme === 'string') { // Teams theme
|
|
109
|
-
this._isDarkTheme = currentTheme !== 'default'; // contrast theme is interpreted as dark
|
|
110
|
-
}
|
|
111
|
-
else { // SharePoint theme
|
|
112
|
-
const theme = currentTheme as ITheme;
|
|
113
|
-
this._isDarkTheme = !!theme && !!theme.isInverted;
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
private _setCSSVariables = () => {
|
|
118
|
-
let primaryText = '#323130'; // default
|
|
119
|
-
let linkText = '#03787c';
|
|
120
|
-
if (this._themeVariant) {
|
|
121
|
-
const {
|
|
122
|
-
semanticColors
|
|
123
|
-
} = this._themeVariant;
|
|
124
|
-
primaryText = semanticColors.bodyText;
|
|
125
|
-
linkText = semanticColors.link;
|
|
126
|
-
}
|
|
127
|
-
else if (this._hasTeamsContext) { // fallback for Teams
|
|
128
|
-
primaryText = this._isDarkTheme ? '#FFFFFF' : '#242424';
|
|
129
|
-
linkText = this._isDarkTheme ? '#FFFFFF' : '#494B83';
|
|
130
|
-
}
|
|
131
|
-
else { // fallback for single app page
|
|
132
|
-
primaryText = this._isDarkTheme ? '#3a96dd' : '#323130';
|
|
133
|
-
linkText = this._isDarkTheme ? '#3a96dd' : '#03787c';
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
this.domElement.style.setProperty('--primaryText', primaryText);
|
|
137
|
-
this.domElement.style.setProperty('--linkText', linkText);
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
private _getEnvironmentMessage = (): string => {
|
|
141
|
-
// checking for local environment
|
|
142
|
-
let isLocal: boolean = false;
|
|
143
|
-
const {
|
|
144
|
-
loaderConfig
|
|
145
|
-
} = this.manifest;
|
|
146
|
-
|
|
147
|
-
if (loaderConfig && loaderConfig.internalModuleBaseUrls && loaderConfig.internalModuleBaseUrls.length) {
|
|
148
|
-
isLocal = /^http(s)?\:\/\/localhost/gmi.test(loaderConfig.internalModuleBaseUrls[0]);
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
if (this._hasTeamsContext) { // running in Teams
|
|
152
|
-
return isLocal ? strings.AppLocalEnvironmentTeams : strings.AppTeamsTabEnvironment;
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
return isLocal ? strings.AppLocalEnvironmentSharePoint : strings.AppSharePointEnvironment;
|
|
156
|
-
}
|
|
157
|
-
|
|
158
31
|
protected onDispose(): void {
|
|
159
32
|
ReactDom.unmountComponentAtNode(this.domElement);
|
|
160
|
-
|
|
161
|
-
//
|
|
162
|
-
// unregistering theme changed handlers
|
|
163
|
-
//
|
|
164
|
-
if (this._hasTeamsContext) {
|
|
165
|
-
this.context.sdks.microsoftTeams.teamsJs.registerOnThemeChangeHandler(null);
|
|
166
|
-
}
|
|
167
|
-
else {
|
|
168
|
-
this._themeProvider.themeChangedEvent.remove(this, this._handleSPThemeChangedEvent);
|
|
169
|
-
}
|
|
170
33
|
}
|
|
171
34
|
|
|
172
35
|
protected get dataVersion(): Version {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@microsoft/generator-sharepoint",
|
|
3
|
-
"version": "1.13.0-beta.
|
|
3
|
+
"version": "1.13.0-beta.22",
|
|
4
4
|
"description": "Yeoman generator for the SharePoint Framework",
|
|
5
5
|
"scripts": {},
|
|
6
6
|
"engines": {
|
|
@@ -13,13 +13,13 @@
|
|
|
13
13
|
"homepage": "http://aka.ms/spfx",
|
|
14
14
|
"main": "lib/generators/app/index.js",
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@microsoft/spfx-heft-plugins": "1.13.0-beta.
|
|
16
|
+
"@microsoft/spfx-heft-plugins": "1.13.0-beta.22",
|
|
17
17
|
"@rushstack/node-core-library": "3.40.0",
|
|
18
18
|
"colors": "~1.2.1",
|
|
19
19
|
"lodash": "4.17.21",
|
|
20
20
|
"update-notifier": "5.1.0",
|
|
21
21
|
"uuid": "~3.1.0",
|
|
22
|
-
"yeoman-generator": "5.
|
|
22
|
+
"yeoman-generator": "5.4.2",
|
|
23
23
|
"yosay": "2.0.2"
|
|
24
24
|
}
|
|
25
25
|
}
|
|
Binary file
|
|
Binary file
|