@splunk/react-page 5.2.1 → 6.0.2

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 (3) hide show
  1. package/CHANGELOG.md +18 -1
  2. package/lib/index.js +45 -52
  3. package/package.json +12 -7
package/CHANGELOG.md CHANGED
@@ -1,6 +1,23 @@
1
1
  Change Log
2
2
  ============
3
3
 
4
+ 6.0.2 - September 6, 2022
5
+ ----------
6
+ * Fixes an issue where an external requirejs dependency would fail loading Splunk Core APIs.
7
+
8
+ 6.0.1 - August 2, 2022
9
+ ----------
10
+ * Fix backwards compatibility issue to support default theme of "enterprise".
11
+
12
+ 6.0.0 - June 29, 2022
13
+ ----------
14
+ API Changes:
15
+ * `loadingThemeOverride` option has been removed and replaced with `theme`.
16
+ * The Layout API now renders the appropriate `SplunkThemeProvider` so you don't have to.
17
+ Notes:
18
+ * The `layout` API can now be themed with a light or dark theme.
19
+ * To determine the user's current theme preference for the layout API, use the `getUserTheme` function available in versions 2.2.0 and above of `@splunk/splunk-utils/themes`.
20
+
4
21
  5.2.1 - April 5, 2022
5
22
  ----------
6
23
  API Changes:
@@ -10,7 +27,7 @@ API Changes:
10
27
 
11
28
  `styled-components@5.2.0` changed how selectors like `& + &` are compiled; [styled-components PR#3236](https://github.com/styled-components/styled-components/pull/3236).
12
29
  This breaks styles that worked in previous versions of styled-components; [styled-components issue #3265](https://github.com/styled-components/styled-components/issues/3265).
13
-
30
+
14
31
  **Until noted otherwise in a future release of `@splunk/react-page` do not use `styled-components@^5.2.0` with` @splunk/react-page`**.
15
32
 
16
33
  5.2.0 - February 23, 2022
package/lib/index.js CHANGED
@@ -82,7 +82,7 @@ module.exports =
82
82
  /******/
83
83
  /******/
84
84
  /******/ // Load entry module and return exports
85
- /******/ return __webpack_require__(__webpack_require__.s = 12);
85
+ /******/ return __webpack_require__(__webpack_require__.s = 11);
86
86
  /******/ })
87
87
  /************************************************************************/
88
88
  /******/ ([
@@ -113,13 +113,13 @@ module.exports = require("react-dom");
113
113
  /* 4 */
114
114
  /***/ (function(module, exports) {
115
115
 
116
- module.exports = require("prop-types");
116
+ module.exports = require("@splunk/themes/SplunkThemeProvider");
117
117
 
118
118
  /***/ }),
119
119
  /* 5 */
120
120
  /***/ (function(module, exports) {
121
121
 
122
- module.exports = require("@splunk/splunk-utils/themes");
122
+ module.exports = require("prop-types");
123
123
 
124
124
  /***/ }),
125
125
  /* 6 */
@@ -143,22 +143,16 @@ module.exports = require("@splunk/splunk-utils/url");
143
143
  /* 9 */
144
144
  /***/ (function(module, exports) {
145
145
 
146
- module.exports = require("@splunk/themes/SplunkThemeProvider");
147
-
148
- /***/ }),
149
- /* 10 */
150
- /***/ (function(module, exports) {
151
-
152
146
  module.exports = require("@splunk/react-ui/ScreenReaderContent");
153
147
 
154
148
  /***/ }),
155
- /* 11 */
149
+ /* 10 */
156
150
  /***/ (function(module, exports) {
157
151
 
158
152
  module.exports = require("@splunk/ui-utils/i18n");
159
153
 
160
154
  /***/ }),
161
- /* 12 */
155
+ /* 11 */
162
156
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
163
157
 
164
158
  "use strict";
@@ -183,29 +177,26 @@ var Layer_ = __webpack_require__(7);
183
177
  var url_ = __webpack_require__(8);
184
178
 
185
179
  // EXTERNAL MODULE: external "@splunk/themes/SplunkThemeProvider"
186
- var SplunkThemeProvider_ = __webpack_require__(9);
180
+ var SplunkThemeProvider_ = __webpack_require__(4);
187
181
  var SplunkThemeProvider_default = /*#__PURE__*/__webpack_require__.n(SplunkThemeProvider_);
188
182
 
189
- // EXTERNAL MODULE: external "@splunk/splunk-utils/themes"
190
- var themes_ = __webpack_require__(5);
191
-
192
183
  // EXTERNAL MODULE: external "prop-types"
193
- var external_prop_types_ = __webpack_require__(4);
184
+ var external_prop_types_ = __webpack_require__(5);
194
185
  var external_prop_types_default = /*#__PURE__*/__webpack_require__.n(external_prop_types_);
195
186
 
196
187
  // EXTERNAL MODULE: external "@splunk/react-ui/ScreenReaderContent"
197
- var ScreenReaderContent_ = __webpack_require__(10);
188
+ var ScreenReaderContent_ = __webpack_require__(9);
198
189
  var ScreenReaderContent_default = /*#__PURE__*/__webpack_require__.n(ScreenReaderContent_);
199
190
 
200
191
  // EXTERNAL MODULE: external "@splunk/ui-utils/i18n"
201
- var i18n_ = __webpack_require__(11);
192
+ var i18n_ = __webpack_require__(10);
202
193
 
203
194
  // EXTERNAL MODULE: external "styled-components"
204
195
  var external_styled_components_ = __webpack_require__(2);
205
196
  var external_styled_components_default = /*#__PURE__*/__webpack_require__.n(external_styled_components_);
206
197
 
207
198
  // EXTERNAL MODULE: external "@splunk/themes"
208
- var external_splunk_themes_ = __webpack_require__(1);
199
+ var themes_ = __webpack_require__(1);
209
200
 
210
201
  // CONCATENATED MODULE: ./src/LoadingStyles.js
211
202
  function _templateObject6() {
@@ -273,19 +264,19 @@ function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(
273
264
 
274
265
 
275
266
  var blink = Object(external_styled_components_["keyframes"])(_templateObject());
276
- var Main = external_styled_components_default.a.div(_templateObject2(), external_splunk_themes_["variables"].backgroundColorPage);
277
- var SplunkBar = external_styled_components_default.a.div(_templateObject3(), Object(external_splunk_themes_["pick"])({
278
- prisma: external_splunk_themes_["variables"].backgroundColorSection,
279
- enterprise: external_splunk_themes_["variables"].gray20
267
+ var Main = external_styled_components_default.a.div(_templateObject2(), themes_["variables"].backgroundColorPage);
268
+ var SplunkBar = external_styled_components_default.a.div(_templateObject3(), Object(themes_["pick"])({
269
+ prisma: themes_["variables"].backgroundColorSection,
270
+ enterprise: themes_["variables"].gray20
280
271
  }));
281
- var AppBar = external_styled_components_default.a.div(_templateObject4(), Object(external_splunk_themes_["pick"])({
282
- prisma: external_splunk_themes_["variables"].backgroundColorPopup,
283
- enterprise: external_splunk_themes_["variables"].gray30
272
+ var AppBar = external_styled_components_default.a.div(_templateObject4(), Object(themes_["pick"])({
273
+ prisma: themes_["variables"].backgroundColorPopup,
274
+ enterprise: themes_["variables"].gray30
284
275
  }));
285
- var AppBody = external_styled_components_default.a.div(_templateObject5(), external_splunk_themes_["variables"].contentColorInverted);
286
- var Dot = external_styled_components_default.a.div(_templateObject6(), blink, external_splunk_themes_["variables"].neutral500, Object(external_splunk_themes_["pick"])({
287
- prisma: external_splunk_themes_["variables"].spacingMedium,
288
- enterprise: external_splunk_themes_["variables"].spacingHalf
276
+ var AppBody = external_styled_components_default.a.div(_templateObject5(), themes_["variables"].contentColorInverted);
277
+ var Dot = external_styled_components_default.a.div(_templateObject6(), blink, themes_["variables"].neutral500, Object(themes_["pick"])({
278
+ prisma: themes_["variables"].spacingMedium,
279
+ enterprise: themes_["variables"].spacingHalf
289
280
  }));
290
281
 
291
282
  // CONCATENATED MODULE: ./src/Loading.jsx
@@ -327,7 +318,8 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
327
318
 
328
319
 
329
320
 
330
-
321
+ var LIGHT_LAYOUT = 'build/api/layout.js';
322
+ var DARK_LAYOUT = 'build/api/layout-dark.js';
331
323
  /**
332
324
  * Loads the layout from the server, using requirejs if available on the window and scriptjs if not.
333
325
  *
@@ -335,17 +327,13 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
335
327
  * @private
336
328
  */
337
329
 
338
- function getLayoutApi(callback) {
339
- var url = Object(url_["createStaticURL"])('build/api/layout.js');
340
-
341
- if (window.requirejs) {
342
- window.requirejs([url], callback);
343
- } else {
344
- external_scriptjs_default()(url, function () {
345
- // eslint-disable-next-line no-underscore-dangle
346
- callback(window.__splunk_layout__);
347
- });
348
- }
330
+ function getLayoutApi(theme, callback) {
331
+ var themedLayout = theme === 'dark' ? DARK_LAYOUT : LIGHT_LAYOUT;
332
+ var url = Object(url_["createStaticURL"])(themedLayout);
333
+ external_scriptjs_default()(url, function () {
334
+ // eslint-disable-next-line no-underscore-dangle
335
+ callback(window.__splunk_layout__);
336
+ });
349
337
  }
350
338
  /**
351
339
  * Renders a React element into the Layout API.
@@ -362,9 +350,8 @@ function getLayoutApi(callback) {
362
350
  * @param {Boolean} [options.hideSplunkBar = false] - Hides the Splunk bar.
363
351
  * @param {string} [options.layout = 'scrolling'] - Set to `fixed` to fix all navigation bars
364
352
  * to the edge of the page.
365
- * @param {string} [options.loadingThemeOverride] - Allows the theme provided by Splunk Enterprise to the loading screen
366
- * to be overridden with `enterprise` or `enterpriseDark`.
367
353
  * @param {Boolean} [options.useGlobalLayerStack = true] - Wraps elements in @splunk/react-ui's LayerStackGlobalProvider.
354
+ * @param {String} [options.theme = 'light'] - Used to theme UI elements. Ex. "light" or "dark".
368
355
  */
369
356
 
370
357
 
@@ -373,20 +360,26 @@ function layout(element) {
373
360
 
374
361
  var _ref$useGlobalLayerSt = _ref.useGlobalLayerStack,
375
362
  useGlobalLayerStack = _ref$useGlobalLayerSt === void 0 ? true : _ref$useGlobalLayerSt,
376
- loadingThemeOverride = _ref.loadingThemeOverride,
377
363
  pageTitle = _ref.pageTitle,
378
- layoutAPIOptions = _objectWithoutProperties(_ref, ["useGlobalLayerStack", "loadingThemeOverride", "pageTitle"]);
379
-
380
- var loadingContainer = document.createElement('div');
381
- var loadingTheme = Object(themes_["getThemeOptions"])(loadingThemeOverride || Object(themes_["defaultTheme"])());
364
+ _ref$theme = _ref.theme,
365
+ theme = _ref$theme === void 0 ? 'light' : _ref$theme,
366
+ layoutAPIOptions = _objectWithoutProperties(_ref, ["useGlobalLayerStack", "pageTitle", "theme"]);
382
367
 
383
368
  if (pageTitle) {
384
369
  document.title = pageTitle;
385
370
  }
386
371
 
372
+ var loadingContainer = document.createElement('div'); // The "theme" in enterprise used to be "enterprise" instead of "light"...
373
+
374
+ var colorScheme = theme === 'light' || theme === 'enterprise' ? 'light' : 'dark';
375
+ var splunkTheme = {
376
+ family: 'enterprise',
377
+ colorScheme: colorScheme,
378
+ density: 'comfortable'
379
+ };
387
380
  document.body.appendChild(loadingContainer);
388
- Object(external_react_dom_["render"])( /*#__PURE__*/external_react_default.a.createElement(SplunkThemeProvider_default.a, loadingTheme, /*#__PURE__*/external_react_default.a.createElement(src_Loading, layoutAPIOptions)), loadingContainer);
389
- getLayoutApi(function (layoutApi) {
381
+ Object(external_react_dom_["render"])( /*#__PURE__*/external_react_default.a.createElement(SplunkThemeProvider_default.a, splunkTheme, /*#__PURE__*/external_react_default.a.createElement(src_Loading, layoutAPIOptions)), loadingContainer);
382
+ getLayoutApi(theme, function (layoutApi) {
390
383
  var containerEl;
391
384
 
392
385
  if (layoutApi) {
@@ -422,7 +415,7 @@ function layout(element) {
422
415
  setTimeout(function () {
423
416
  Object(external_react_dom_["unmountComponentAtNode"])(loadingContainer);
424
417
  loadingContainer.parentNode.removeChild(loadingContainer);
425
- var wrappedElement = useGlobalLayerStack ? /*#__PURE__*/external_react_default.a.createElement(Layer_["LayerStackGlobalProvider"], null, element) : element;
418
+ var wrappedElement = useGlobalLayerStack ? /*#__PURE__*/external_react_default.a.createElement(Layer_["LayerStackGlobalProvider"], null, /*#__PURE__*/external_react_default.a.createElement(SplunkThemeProvider_default.a, splunkTheme, element)) : /*#__PURE__*/external_react_default.a.createElement(SplunkThemeProvider_default.a, splunkTheme, element);
426
419
  Object(external_react_dom_["render"])(wrappedElement, containerEl);
427
420
  }, 30);
428
421
  });
package/package.json CHANGED
@@ -1,12 +1,15 @@
1
1
  {
2
2
  "name": "@splunk/react-page",
3
- "version": "5.2.1",
3
+ "version": "6.0.2",
4
4
  "description": "Load React components into the latest layout from Splunk Enterprise",
5
5
  "main": "lib/index.js",
6
6
  "license": "Apache-2.0",
7
7
  "author": "Splunk Inc.",
8
8
  "scripts": {
9
- "build": "cross-env NODE_ENV=production webpack --bail",
9
+ "build": "cross-env NODE_ENV=production webpack",
10
+ "docs": "NODE_ENV=production webpack --config docs.gen.webpack.config.js",
11
+ "docs:publish": "cicd-publish-docs docs --force",
12
+ "docs:start": "webpack serve --config docs.gen.webpack.config.js",
10
13
  "eslint": "eslint src --ext \".js,.jsx\"",
11
14
  "eslint:fix": "eslint src --ext \".js, .jsx\" --fix",
12
15
  "eslint:ci": "yarn run eslint -- -f junit -o test-reports/lint-results.xml",
@@ -22,16 +25,17 @@
22
25
  "test:cypress:ci": "echo TODO: SUI-3442"
23
26
  },
24
27
  "dependencies": {
25
- "@splunk/react-ui": "^4.6.0",
26
- "@splunk/splunk-utils": "^2.1.0",
27
- "@splunk/themes": "^0.10.1",
28
- "@splunk/ui-utils": "^1.4.0",
28
+ "@splunk/react-ui": "^4.12.0",
29
+ "@splunk/splunk-utils": "^2.2.2",
30
+ "@splunk/themes": "^0.13.0",
31
+ "@splunk/ui-utils": "^1.5.0",
29
32
  "prop-types": "^15.6.2",
30
33
  "scriptjs": "^2.5.8"
31
34
  },
32
35
  "devDependencies": {
33
36
  "@babel/core": "^7.2.0",
34
37
  "@splunk/babel-preset": "^3.0.0",
38
+ "@splunk/cicd-tools": "^0.4.0",
35
39
  "@splunk/eslint-config": "^4.0.0",
36
40
  "@splunk/stylelint-config": "^4.0.0",
37
41
  "@splunk/wdio-functional-test-runner": "^10.1.0",
@@ -54,7 +58,8 @@
54
58
  "styled-components": "5.1.1",
55
59
  "stylelint": "^13.0.0",
56
60
  "webpack": "^4.16.2",
57
- "webpack-cli": "^3.1.0",
61
+ "webpack-cli": "^4.9.2",
62
+ "webpack-dev-server": "^4.7.4",
58
63
  "webpack-merge": "^4.1.3"
59
64
  },
60
65
  "peerDependencies": {