@microsoft/sp-component-base 1.22.0-beta.2 → 1.22.0-beta.4

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.
Files changed (101) hide show
  1. package/dist/467dc675-7cc5-4709-8aac-78e3b71bd2f6.manifest.json +1 -1
  2. package/lib/BaseComponent.d.ts +115 -0
  3. package/lib/BaseComponent.d.ts.map +1 -0
  4. package/lib/BaseComponent.js +162 -0
  5. package/lib/BaseComponentContext.d.ts +142 -0
  6. package/lib/BaseComponentContext.d.ts.map +1 -0
  7. package/lib/BaseComponentContext.js +221 -0
  8. package/lib/DynamicDataProvider.d.ts +166 -0
  9. package/lib/DynamicDataProvider.d.ts.map +1 -0
  10. package/lib/DynamicDataProvider.js +420 -0
  11. package/lib/DynamicDataSourceManager.d.ts +160 -0
  12. package/lib/DynamicDataSourceManager.d.ts.map +1 -0
  13. package/lib/DynamicDataSourceManager.js +382 -0
  14. package/lib/DynamicProperty.d.ts +204 -0
  15. package/lib/DynamicProperty.d.ts.map +1 -0
  16. package/lib/DynamicProperty.js +390 -0
  17. package/lib/EnsureIsolatedDomainUrl.d.ts +9 -0
  18. package/lib/EnsureIsolatedDomainUrl.d.ts.map +1 -0
  19. package/lib/EnsureIsolatedDomainUrl.js +26 -0
  20. package/lib/IComponentPosition.d.ts +28 -0
  21. package/lib/IComponentPosition.d.ts.map +1 -0
  22. package/lib/IComponentPosition.js +2 -0
  23. package/lib/IComponentPropertyMetadata.d.ts +100 -0
  24. package/lib/IComponentPropertyMetadata.d.ts.map +1 -0
  25. package/lib/IComponentPropertyMetadata.js +2 -0
  26. package/lib/ISerializedServerProcessedData.d.ts +166 -0
  27. package/lib/ISerializedServerProcessedData.d.ts.map +1 -0
  28. package/lib/ISerializedServerProcessedData.js +28 -0
  29. package/lib/LegacyThirdPartyFabricCoreLoader.d.ts +40 -0
  30. package/lib/LegacyThirdPartyFabricCoreLoader.d.ts.map +1 -0
  31. package/lib/LegacyThirdPartyFabricCoreLoader.js +90 -0
  32. package/lib/PropertyMetadataProcessor.d.ts +54 -0
  33. package/lib/PropertyMetadataProcessor.d.ts.map +1 -0
  34. package/lib/PropertyMetadataProcessor.js +297 -0
  35. package/lib/ShimmerFactory.d.ts +17 -0
  36. package/lib/ShimmerFactory.d.ts.map +1 -0
  37. package/lib/ShimmerFactory.js +62 -0
  38. package/lib/chunks/legacy-third-party-fabric-core/FabricLocalFont.d.ts +17 -0
  39. package/lib/chunks/legacy-third-party-fabric-core/FabricLocalFont.d.ts.map +1 -0
  40. package/lib/chunks/legacy-third-party-fabric-core/FabricLocalFont.js +17 -0
  41. package/lib/chunks/legacy-third-party-fabric-core/fabric-core-sass/Fabric.LocalFont.global.scss.css +9247 -0
  42. package/lib/chunks/legacy-third-party-fabric-core/fabric-core-sass/Fabric.LocalFontKillSwitchActivated.scss.css +11165 -0
  43. package/lib/chunks/legacy-third-party-fabric-core/fabric-core-shim.global.scss.css +2063 -0
  44. package/lib/chunks/legacy-third-party-fabric-core/fabric-core-shimKillSwitchActivated.scss.css +2164 -0
  45. package/lib/chunks/legacy-third-party-fabric-core/iconDefinitions.css +6 -0
  46. package/lib/common/Flights.d.ts +3 -0
  47. package/lib/common/Flights.d.ts.map +1 -0
  48. package/lib/common/Flights.js +10 -0
  49. package/lib/common/KillSwitches.d.ts +2 -0
  50. package/lib/common/KillSwitches.d.ts.map +1 -0
  51. package/lib/common/KillSwitches.js +5 -0
  52. package/lib/dataCollector/IWebPartLoadData.d.ts +140 -0
  53. package/lib/dataCollector/IWebPartLoadData.d.ts.map +1 -0
  54. package/lib/dataCollector/IWebPartLoadData.js +40 -0
  55. package/lib/dataCollector/WebPartLoadDataCollector.d.ts +14 -0
  56. package/lib/dataCollector/WebPartLoadDataCollector.d.ts.map +1 -0
  57. package/lib/dataCollector/WebPartLoadDataCollector.js +137 -0
  58. package/lib/index.d.ts +34 -0
  59. package/lib/index.d.ts.map +1 -0
  60. package/lib/index.js +27 -0
  61. package/lib/loc/Strings.resx.d.ts +44 -0
  62. package/lib/loc/Strings.resx.json +1 -0
  63. package/lib/sp-component-base.manifest.json +9 -0
  64. package/lib/styles/shimmer.module.scss.css +11 -0
  65. package/lib/teams/DeferredTeamsAppsClient.d.ts +17 -0
  66. package/lib/teams/DeferredTeamsAppsClient.d.ts.map +1 -0
  67. package/lib/teams/DeferredTeamsAppsClient.js +39 -0
  68. package/lib/teams/ITeamsAppCatalog.d.ts +72 -0
  69. package/lib/teams/ITeamsAppCatalog.d.ts.map +1 -0
  70. package/lib/teams/ITeamsAppCatalog.js +2 -0
  71. package/lib/teams/TeamsAppsClient.d.ts +113 -0
  72. package/lib/teams/TeamsAppsClient.d.ts.map +1 -0
  73. package/lib/teams/TeamsAppsClient.js +440 -0
  74. package/lib/test-api/MockComponent.d.ts +8 -0
  75. package/lib/test-api/MockComponent.d.ts.map +1 -0
  76. package/lib/test-api/MockComponent.js +31 -0
  77. package/lib/test-api/MockComponentContext.d.ts +6 -0
  78. package/lib/test-api/MockComponentContext.d.ts.map +1 -0
  79. package/lib/test-api/MockComponentContext.js +27 -0
  80. package/lib/test-api/index.d.ts +3 -0
  81. package/lib/test-api/index.d.ts.map +1 -0
  82. package/lib/test-api/index.js +3 -0
  83. package/lib/themeProvider/ThemeProvider.d.ts +71 -0
  84. package/lib/themeProvider/ThemeProvider.d.ts.map +1 -0
  85. package/lib/themeProvider/ThemeProvider.js +99 -0
  86. package/lib/themeProvider/themeInterfaces/IFontStyles.d.ts +26 -0
  87. package/lib/themeProvider/themeInterfaces/IFontStyles.d.ts.map +1 -0
  88. package/lib/themeProvider/themeInterfaces/IFontStyles.js +2 -0
  89. package/lib/themeProvider/themeInterfaces/IPalette.d.ts +7 -0
  90. package/lib/themeProvider/themeInterfaces/IPalette.d.ts.map +1 -0
  91. package/lib/themeProvider/themeInterfaces/IPalette.js +2 -0
  92. package/lib/themeProvider/themeInterfaces/ISemanticColors.d.ts +56 -0
  93. package/lib/themeProvider/themeInterfaces/ISemanticColors.d.ts.map +1 -0
  94. package/lib/themeProvider/themeInterfaces/ISemanticColors.js +2 -0
  95. package/lib/themeProvider/themeInterfaces/ISemanticTextColors.d.ts +7 -0
  96. package/lib/themeProvider/themeInterfaces/ISemanticTextColors.d.ts.map +1 -0
  97. package/lib/themeProvider/themeInterfaces/ISemanticTextColors.js +2 -0
  98. package/lib/themeProvider/themeInterfaces/ITheme.d.ts +16 -0
  99. package/lib/themeProvider/themeInterfaces/ITheme.d.ts.map +1 -0
  100. package/lib/themeProvider/themeInterfaces/ITheme.js +2 -0
  101. package/package.json +15 -15
@@ -0,0 +1,297 @@
1
+ import { _SPKillSwitch } from '@microsoft/sp-core-library';
2
+ import * as lodash from '@microsoft/sp-lodash-subset';
3
+ import { isServerPropertiesSanitizedEnabled } from './common/Flights';
4
+ import { _QosMonitor } from '@microsoft/sp-diagnostics';
5
+ import { SafeHtml } from '@msinternal/sp-safehtml';
6
+ /**
7
+ * The processor to serialize and deserialize the server processed content and component properties
8
+ * based on component metadata.
9
+ *
10
+ * @internal
11
+ */
12
+ var PropertyMetadataProcessor = /** @class */ (function () {
13
+ function PropertyMetadataProcessor() {
14
+ }
15
+ /**
16
+ * Serialize the properties into server processed content as declared in metadata.
17
+ *
18
+ * @param propertiesMetadata - The component properties metadata.
19
+ * @param properties - The component properties. This object will be modified during serialization.
20
+ * @param serverProcessedContent - The serialized server processed content. This object will be modified.
21
+ */
22
+ PropertyMetadataProcessor.serializeServerProcessedData = function (propertiesMetadata, properties, serverProcessedContent) {
23
+ var _this = this;
24
+ this._forEachPropertyWithMetaData(propertiesMetadata, properties, function (propPath, metadata, iteration) {
25
+ // Remove fields with shouldNotPersist metadata
26
+ if (metadata.shouldNotPersist) {
27
+ lodash.set(properties, propPath, undefined);
28
+ }
29
+ // Use the property path as the key in server-processed content maps
30
+ var key = propPath;
31
+ // WARNING: This is critical code. Please do not modify without fully understanding the data pipeline
32
+ var value = lodash.get(properties, propPath);
33
+ // Skip if the property is non-string or undefined
34
+ if (serverProcessedContent && typeof value === 'string' && value) {
35
+ if (serverProcessedContent.htmlStrings && metadata.isHtmlString) {
36
+ serverProcessedContent.htmlStrings[key] = value;
37
+ }
38
+ else if (serverProcessedContent.searchablePlainTexts && metadata.isSearchablePlainText) {
39
+ serverProcessedContent.searchablePlainTexts[key] = value;
40
+ }
41
+ else if (serverProcessedContent.links && metadata.isLink) {
42
+ serverProcessedContent.links[key] = value;
43
+ }
44
+ else if (serverProcessedContent.imageSources && metadata.isImageSource) {
45
+ serverProcessedContent.imageSources[key] = value;
46
+ }
47
+ else if (metadata.isComponentDependency) {
48
+ if (!serverProcessedContent.componentDependencies) {
49
+ serverProcessedContent.componentDependencies = {};
50
+ }
51
+ serverProcessedContent.componentDependencies[key] = value;
52
+ }
53
+ if (metadata.customMetadata) {
54
+ // Build custom metadata for the given property path
55
+ var customMetadata_1 = {};
56
+ if (metadata && metadata.customMetadata) {
57
+ var _loop_1 = function (propName, customMetadataPropPath) {
58
+ var normalizedCustomMetadataPropPath = customMetadataPropPath;
59
+ if (iteration !== undefined && normalizedCustomMetadataPropPath.indexOf('*') !== -1) {
60
+ // Custom metadata should be resolved with current iteration of wildcard
61
+ normalizedCustomMetadataPropPath = normalizedCustomMetadataPropPath.replace('*', iteration.toString());
62
+ }
63
+ _this._validateAndIteratePath(normalizedCustomMetadataPropPath, properties, function (fixedPropPath, customIteration) {
64
+ // Custom metadata should be resolved without iteration
65
+ if (customIteration === undefined && metadata.customMetadata) {
66
+ var customValue = lodash.get(properties, fixedPropPath);
67
+ if (serverProcessedContent && customValue !== undefined) {
68
+ // Insert custom metadata key and value
69
+ if (isFixCustomMetadataKeyKillSwitchActivated()) {
70
+ customMetadata_1[fixedPropPath] = customValue;
71
+ }
72
+ else {
73
+ customMetadata_1[propName] = customValue;
74
+ }
75
+ }
76
+ }
77
+ });
78
+ };
79
+ for (var _i = 0, _a = Object.entries(metadata.customMetadata); _i < _a.length; _i++) {
80
+ var _b = _a[_i], propName = _b[0], customMetadataPropPath = _b[1];
81
+ _loop_1(propName, customMetadataPropPath);
82
+ }
83
+ }
84
+ if (!serverProcessedContent.customMetadata) {
85
+ serverProcessedContent.customMetadata = {};
86
+ }
87
+ // Store serialized custom metadata for the given the property path.
88
+ serverProcessedContent.customMetadata[key] = customMetadata_1;
89
+ }
90
+ // Unset the extracted property to avoid duplication
91
+ lodash.set(properties, propPath, undefined);
92
+ }
93
+ });
94
+ };
95
+ /**
96
+ * Reapply the serialized server processed content on the properties based on the metadata.
97
+ * This process will result in the properties bag as it was when the serialization happened.
98
+ *
99
+ * @param propertiesMetadata - The component properties metadata.
100
+ * @param properties - The component properties. This object will be modified during serialization.
101
+ * @param serverProcessedContent - The serialized server processed content.
102
+ * @param manifest - The optional component manifest.
103
+ */
104
+ PropertyMetadataProcessor.reInstateServerProcessedData = function (propertiesMetadata, properties, serverProcessedContent, manifest) {
105
+ var _this = this;
106
+ var propertyPathsNotInServerProcessedContent = new Set();
107
+ if (manifest) {
108
+ // @privateRemarks Clear out the properties with isHtmlString metadata for security reasons. We only want to
109
+ // propagate values from the serverProcessed content as they are security sanitized by the server. Note, there is a
110
+ // scenario when an end user can update the list item with whatever data they like. In that case, they can
111
+ // eliminate the serverProcessed content and that can cause a potential security hole. Hence, we always want
112
+ // clear out the property values that have isHtmlString metadata.
113
+ this._forEachPropertyWithMetaData(propertiesMetadata, properties, function (propPath, metadata) {
114
+ if (!isServerPropertiesSanitizedEnabled()) {
115
+ // This is a temporary hack to make sure that the webparts published using the Mobile app keep rendering.
116
+ // Currently, for those pages, the DocumentEmbedWebPart does not have HTMLProperties pupulated. Hence,
117
+ // we are doing this work around to not unset the property bag.
118
+ // (SPPPLAT VSO#289988) tracks removal of this code.
119
+ if (manifest.id !== 'b7dd04e1-19ce-4b24-9132-b60a1c2b910d' && metadata.isHtmlString) {
120
+ lodash.set(properties, propPath, undefined);
121
+ }
122
+ }
123
+ else {
124
+ // We should always sanitize the deserialized property bag for any property
125
+ // that is marked with propertiesMetadata. It is possible for the content to have been
126
+ // modified at rest and therefore work around the assumption of the serverProcessedContent
127
+ // properties matching the propertiesMetadata. Since the propertiesMetadata is generated at
128
+ // runtime we should enforce an expectation of the serverProcessedContent to match.
129
+ //
130
+ // This implicitly means a web part will receive a property bag that could not have properties it is expecting
131
+ // if the data has been incorrectly modified at rest. The web part is expected to handle that.
132
+ //
133
+ // If the path is already undefined then we can skip setting to undefined and the enforcement
134
+ if (manifest.id === 'b7dd04e1-19ce-4b24-9132-b60a1c2b910d' &&
135
+ _SPKillSwitch.isActivated('71b68bd4-eb7a-4330-93bd-dc6d382123c1' /* '9/28/2023', 'Do not serverProcessContent sanitization for DocumentEmbedWebPart' */)) {
136
+ return;
137
+ }
138
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
139
+ var propValue = lodash.get(properties, propPath);
140
+ if (propValue !== undefined) {
141
+ var qosMonitor = new _QosMonitor('PropertyMetadataProcessor.clearMetadataValue');
142
+ if (metadata.isLink) {
143
+ propertyPathsNotInServerProcessedContent.add(propPath);
144
+ if (!_this._isSafeLink(propValue)) {
145
+ qosMonitor.writeUnexpectedFailure('ClearingLinkProperty', new Error(propPath));
146
+ lodash.set(properties, propPath, undefined);
147
+ }
148
+ }
149
+ if (metadata.isHtmlString) {
150
+ propertyPathsNotInServerProcessedContent.add(propPath);
151
+ var safeHtml = _this._getSafeHtml(propValue);
152
+ if (safeHtml !== propValue) {
153
+ qosMonitor.writeUnexpectedFailure('SettingSafeHtml', new Error(propPath));
154
+ lodash.set(properties, propPath, safeHtml);
155
+ }
156
+ }
157
+ if (!qosMonitor.hasEnded) {
158
+ qosMonitor.writeSuccess();
159
+ }
160
+ }
161
+ }
162
+ });
163
+ }
164
+ if (serverProcessedContent) {
165
+ // Re-instate the server processed values in the specified path in the property bag.
166
+ // There is a change that the new shape of the property bag is different. But the
167
+ // the purpose of the inbuilt deserialization is to provide the same properties object
168
+ // back to the web part that has the same shape as when the serialization happened.
169
+ // CustomMetadata is only processed on the server so we do not round trip the data back
170
+ // into the web part properties. This is by design of the feature
171
+ var htmlMaps = [
172
+ serverProcessedContent.htmlStrings,
173
+ serverProcessedContent.searchablePlainTexts,
174
+ serverProcessedContent.imageSources,
175
+ serverProcessedContent.links,
176
+ serverProcessedContent.componentDependencies
177
+ ];
178
+ for (var _i = 0, htmlMaps_1 = htmlMaps; _i < htmlMaps_1.length; _i++) {
179
+ var htmlMap = htmlMaps_1[_i];
180
+ if (htmlMap) {
181
+ for (var _a = 0, _b = Object.entries(htmlMap); _a < _b.length; _a++) {
182
+ var _c = _b[_a], propPath = _c[0], value = _c[1];
183
+ // WARNING: This is critical code. Please do not modify without fully understanding the data pipeline
184
+ if (typeof value === 'string') {
185
+ lodash.set(properties, propPath, value);
186
+ if (isServerPropertiesSanitizedEnabled()) {
187
+ propertyPathsNotInServerProcessedContent.delete(propPath);
188
+ }
189
+ }
190
+ }
191
+ }
192
+ }
193
+ }
194
+ if (isServerPropertiesSanitizedEnabled() &&
195
+ manifest &&
196
+ propertyPathsNotInServerProcessedContent.size > 0) {
197
+ var logServerPropertiesMissing = new _QosMonitor('PropertyMetadataProcessor.serverProcessedContentMissing');
198
+ logServerPropertiesMissing.writeUnexpectedFailure('Missing Content', undefined, {
199
+ manifest: manifest.id,
200
+ properties: Array.from(propertyPathsNotInServerProcessedContent).join(',')
201
+ });
202
+ }
203
+ };
204
+ PropertyMetadataProcessor._isSafeLink = function (link) {
205
+ try {
206
+ var safeLinkUrl = new URL(link);
207
+ return SafeHtml.isSafeLinkProtocol(safeLinkUrl.protocol);
208
+ }
209
+ catch (_a) {
210
+ try {
211
+ var safeLinkUrl = new URL(link, window.location.origin);
212
+ return SafeHtml.isSafeLinkProtocol(safeLinkUrl.protocol);
213
+ }
214
+ catch (_b) {
215
+ return false;
216
+ }
217
+ }
218
+ };
219
+ PropertyMetadataProcessor._getSafeHtml = function (html) {
220
+ return SafeHtml.clean(html);
221
+ };
222
+ /**
223
+ * Iterates and validates each metadata property before calling metadata processor.
224
+ *
225
+ * @param propertiesMetadata - Component properties metadata.
226
+ * @param properties - Component properties.
227
+ * @param metadataProcessor - Callback handler to to process validated metadata.
228
+ *
229
+ * @internal
230
+ */
231
+ PropertyMetadataProcessor._forEachPropertyWithMetaData = function (propertiesMetadata, properties, metadataProcessor) {
232
+ if (propertiesMetadata) {
233
+ var _loop_2 = function (propPath, metadata) {
234
+ this_1._validateAndIteratePath(propPath, properties, function (fixedPropPath, index) {
235
+ metadataProcessor(fixedPropPath, metadata, index);
236
+ });
237
+ };
238
+ var this_1 = this;
239
+ for (var _i = 0, _a = Object.entries(propertiesMetadata); _i < _a.length; _i++) {
240
+ var _b = _a[_i], propPath = _b[0], metadata = _b[1];
241
+ _loop_2(propPath, metadata);
242
+ }
243
+ }
244
+ };
245
+ /**
246
+ * Validates path and iterate over one or multiple wildcard paths
247
+ *
248
+ * @param propPath - Original property path provided in metadata
249
+ * @param properties - Properties to look for the given path.
250
+ * @param propertyPathHandler - Handler to process validated and fixed path
251
+ */
252
+ PropertyMetadataProcessor._validateAndIteratePath = function (propPath, properties, propertyPathHandler) {
253
+ var wildcardCount = (propPath.match(/\*/g) || []).length;
254
+ if (wildcardCount > 1) {
255
+ // Skip if there are more than one asterisks in the path (not supported)
256
+ // eslint-disable-next-line no-console
257
+ console.warn("Invalid property path: Multiple wildcards are not supported in property paths.\nEntry with path '".concat(propPath, "' got ignored in the properties metadata."));
258
+ return;
259
+ }
260
+ else if (wildcardCount === 1) {
261
+ var index = propPath.indexOf('[*]');
262
+ if (index < -1) {
263
+ // eslint-disable-next-line no-console
264
+ console.warn("Invalid property path: Wildcards are only supported inside brackets to select array\nindices as in 'foo[*].bar'. Entry with path '".concat(propPath, "' got ignored in the properties metadata."));
265
+ // Skip if the wildcard is not used for an array (not supported)
266
+ return;
267
+ }
268
+ else {
269
+ // Handle the array wildcard by generating each individual property path
270
+ var arrayPath = propPath.substr(0, index);
271
+ var arrayInstance = lodash.get(properties, arrayPath);
272
+ if (!arrayInstance) {
273
+ // eslint-disable-next-line no-console
274
+ console.warn("Invalid property path: Could not find an array named '".concat(arrayPath, "' in the properties.\nEntry with path '").concat(propPath, "' got ignored in the properties metadata."));
275
+ return;
276
+ }
277
+ else {
278
+ for (var i = 0; i < arrayInstance.length; i++) {
279
+ var fixedPropPath = propPath.replace('*', "".concat(i));
280
+ propertyPathHandler(fixedPropPath, i);
281
+ }
282
+ }
283
+ }
284
+ }
285
+ else {
286
+ propertyPathHandler(propPath);
287
+ }
288
+ };
289
+ return PropertyMetadataProcessor;
290
+ }());
291
+ export { PropertyMetadataProcessor };
292
+ function isFixCustomMetadataKeyKillSwitchActivated() {
293
+ return _SPKillSwitch.isActivated('bf085c27-422d-4b62-a93a-43efa89e77ee'
294
+ /* '2022-03-28', 'Fix custom metadata key' */
295
+ );
296
+ }
297
+ //# sourceMappingURL=PropertyMetadataProcessor.js.map
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Class to create shimmers for applications.
3
+ *
4
+ * @internal
5
+ */
6
+ export default class ShimmerFactory {
7
+ /**
8
+ * Method that creates a shimmer for applications using an svg.
9
+ * @param width - Width of the shimmer
10
+ * @param height - Height of the shimmer
11
+ * @param componentTag - ID for the shimmer
12
+ * @param loadingMessage - Displays message when the shimmer loads
13
+ */
14
+ static createShimmer(width: number, height: number | undefined, componentTag: string, loadingMessage: string, containerMargin?: number | undefined): HTMLDivElement;
15
+ private static _shimmerRect;
16
+ }
17
+ //# sourceMappingURL=ShimmerFactory.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ShimmerFactory.d.ts","sourceRoot":"","sources":["../src/ShimmerFactory.ts"],"names":[],"mappings":"AAeA;;;;GAIG;AACH,MAAM,CAAC,OAAO,OAAO,cAAc;IACjC;;;;;;OAMG;WACW,aAAa,CACzB,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,GAAG,SAAS,EAC1B,YAAY,EAAE,MAAM,EACpB,cAAc,EAAE,MAAM,EACtB,eAAe,GAAE,MAAM,GAAG,SAAqB,GAC9C,cAAc;IAwEjB,OAAO,CAAC,MAAM,CAAC,YAAY;CAiB5B"}
@@ -0,0 +1,62 @@
1
+ import styles from './styles/shimmer.module.scss';
2
+ // These constants are taken from generic shimmer design.
3
+ var SHIMMER_WIDTH_DEFAULT = 100;
4
+ var SHIMMER_HEIGHT_DEFAULT = 100;
5
+ var SHIMMER_RECTANGLE_HEIGHT_MAX = 16;
6
+ var SHIMMER_RECTANGLE_COUNT = 4;
7
+ var SHIMMER_ELEMENT_COUNT = 2 * SHIMMER_RECTANGLE_COUNT + 1;
8
+ var RECTANGLE_X = 8;
9
+ var SHIMMER_MAIN_RECTANGLE_SIZE_RATIO = 0.9;
10
+ var RECTANGLE_1_LENGTH = 20;
11
+ var RECTANGLE_2_LENGTH = 40;
12
+ var RECTANGLE_3_LENGTH = 90;
13
+ var RECTANGLE_4_LENGTH = 80;
14
+ /**
15
+ * Class to create shimmers for applications.
16
+ *
17
+ * @internal
18
+ */
19
+ var ShimmerFactory = /** @class */ (function () {
20
+ function ShimmerFactory() {
21
+ }
22
+ /**
23
+ * Method that creates a shimmer for applications using an svg.
24
+ * @param width - Width of the shimmer
25
+ * @param height - Height of the shimmer
26
+ * @param componentTag - ID for the shimmer
27
+ * @param loadingMessage - Displays message when the shimmer loads
28
+ */
29
+ ShimmerFactory.createShimmer = function (width, height, componentTag, loadingMessage, containerMargin) {
30
+ if (containerMargin === void 0) { containerMargin = undefined; }
31
+ width = width || SHIMMER_WIDTH_DEFAULT;
32
+ height = height || SHIMMER_HEIGHT_DEFAULT;
33
+ var shimmerContainerDiv = document.createElement('div');
34
+ shimmerContainerDiv.className = styles.shimmerContainer;
35
+ var shimmerDiv = document.createElement('div');
36
+ var mainRectangleHeight = height * SHIMMER_MAIN_RECTANGLE_SIZE_RATIO;
37
+ var rectangleHeight = mainRectangleHeight / SHIMMER_ELEMENT_COUNT;
38
+ rectangleHeight = Math.min(SHIMMER_RECTANGLE_HEIGHT_MAX, rectangleHeight);
39
+ var gap = 2 * rectangleHeight;
40
+ var rectangle1Y = rectangleHeight;
41
+ var rectangle2Y = rectangle1Y + gap;
42
+ var rectangle3Y = rectangle2Y + gap;
43
+ var rectangle4Y = rectangle3Y + gap;
44
+ var className = styles.shimmerElementFill;
45
+ shimmerDiv.innerHTML = "<svg width=".concat(width, " height=").concat(height, " viewBox=\"0 0 ").concat(width, " ").concat(height, "\" version=\"1.1\"\n xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n <title>").concat(loadingMessage, "</title>\n <g id=").concat(componentTag, "_Shimmer stroke=\"none\" stroke-width=\"1\" fill=\"none\" fill-rule=\"evenodd\">\n <rect x=\"0\" y=\"0\" width=").concat(width, " height=").concat(height, "></rect>\n ").concat(ShimmerFactory._shimmerRect(componentTag + '_1', className, RECTANGLE_X, rectangle1Y, RECTANGLE_1_LENGTH, rectangleHeight), "\n ").concat(ShimmerFactory._shimmerRect(componentTag + '_2', className, RECTANGLE_X, rectangle2Y, RECTANGLE_2_LENGTH, rectangleHeight), "\n ").concat(ShimmerFactory._shimmerRect(componentTag + '_3', className, RECTANGLE_X, rectangle3Y, RECTANGLE_3_LENGTH, rectangleHeight), "\n ").concat(ShimmerFactory._shimmerRect(componentTag + '_4', className, RECTANGLE_X, rectangle4Y, RECTANGLE_4_LENGTH, rectangleHeight), "\n </g>\n </svg>");
46
+ if (containerMargin !== undefined) {
47
+ shimmerContainerDiv.style.margin = containerMargin + '';
48
+ }
49
+ shimmerContainerDiv.appendChild(shimmerDiv);
50
+ var shimmerAccessibilityContainerDiv = document.createElement('div');
51
+ shimmerAccessibilityContainerDiv.setAttribute('role', 'status');
52
+ shimmerAccessibilityContainerDiv.setAttribute('aria-live', 'polite');
53
+ shimmerContainerDiv.appendChild(shimmerAccessibilityContainerDiv);
54
+ return shimmerContainerDiv;
55
+ };
56
+ ShimmerFactory._shimmerRect = function (id, className, x, y, width, height) {
57
+ return "<rect id=".concat(id, " class=").concat(className, " x=").concat(x, " y=").concat(y, " width=\"").concat(width, "%\" height=").concat(height, ">\n <animate\n attributeName=\"opacity\"\n dur=\"1s\"\n values=\"0.2;0.5;0.9\"\n repeatCount=\"indefinite\"\n begin=\"0\"/>\n </rect>");
58
+ };
59
+ return ShimmerFactory;
60
+ }());
61
+ export default ShimmerFactory;
62
+ //# sourceMappingURL=ShimmerFactory.js.map
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Include Fabric here so we aren't dependent on the Fabric CDN
3
+ *
4
+ * These are legacy styles from fabric-core statically copied on 11/24/2017.
5
+ * SPFx is exporting them to support backward compatibilty for the existing
6
+ * third-party production web parts.
7
+ *
8
+ * Please DO NOT update these styles with new styles.All new development should
9
+ * use \@microsoft/sp-office-ui-fabric-core package for core styles.
10
+ *
11
+ * NOTE: Fabric.LocalFont is a modified copy of legacy Fabric that removes the
12
+ * use of Segoe CSS font-face in favor of local fonts (Segoe/SF/Roboto).
13
+ */
14
+ import './fabric-core-sass/Fabric.LocalFont.global.scss';
15
+ import './fabric-core-shim.global.scss';
16
+ import './iconDefinitions.css';
17
+ //# sourceMappingURL=FabricLocalFont.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FabricLocalFont.d.ts","sourceRoot":"","sources":["../../../src/chunks/legacy-third-party-fabric-core/FabricLocalFont.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,iDAAiD,CAAC;AACzD,OAAO,gCAAgC,CAAC;AAExC,OAAO,uBAAuB,CAAC"}
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Include Fabric here so we aren't dependent on the Fabric CDN
3
+ *
4
+ * These are legacy styles from fabric-core statically copied on 11/24/2017.
5
+ * SPFx is exporting them to support backward compatibilty for the existing
6
+ * third-party production web parts.
7
+ *
8
+ * Please DO NOT update these styles with new styles.All new development should
9
+ * use \@microsoft/sp-office-ui-fabric-core package for core styles.
10
+ *
11
+ * NOTE: Fabric.LocalFont is a modified copy of legacy Fabric that removes the
12
+ * use of Segoe CSS font-face in favor of local fonts (Segoe/SF/Roboto).
13
+ */
14
+ import './fabric-core-sass/Fabric.LocalFont.global.scss';
15
+ import './fabric-core-shim.global.scss';
16
+ import './iconDefinitions.css';
17
+ //# sourceMappingURL=FabricLocalFont.js.map