@patternfly/quickstarts 2.2.2 → 2.2.3

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/dist/index.d.ts CHANGED
@@ -11,5 +11,6 @@ export * from './utils/help-topic-context';
11
11
  export * from './utils/help-topic-types';
12
12
  export * from './utils/quick-start-utils';
13
13
  export * from './utils/useLocalStorage';
14
+ export * from './utils/asciidoc-procedure-parser';
14
15
  export { default as QuickStartPanelContent } from './QuickStartPanelContent';
15
16
  export { default as QuickStartCloseModal } from './QuickStartCloseModal';
package/dist/index.es.js CHANGED
@@ -2458,5 +2458,105 @@ const useLocalStorage = (key, initialValue) => {
2458
2458
  return [storedValue, setValue];
2459
2459
  };
2460
2460
 
2461
- export { Box, CamelCaseWrap, EmptyBox, HELP_TOPIC_NAME_KEY, HelpTopicContainer, HelpTopicContext, HelpTopicContextDefaults, HelpTopicDrawer, Loading, LoadingBox, QUICKSTART_ID_FILTER_KEY, QUICKSTART_SEARCH_FILTER_KEY, QUICKSTART_STATUS_FILTER_KEY, QUICKSTART_TASKS_INITIAL_STATES, QUICK_START_NAME, QuickStartCatalog, QuickStartCatalogEmptyState, QuickStartCatalogFilter, QuickStartCatalogFilterCount, QuickStartCatalogFilterCountWrapper, QuickStartCatalogFilterSearch, QuickStartCatalogFilterSearchWrapper, QuickStartCatalogFilterSelect, QuickStartCatalogFilterStatusWrapper, QuickStartCatalogHeader, QuickStartCatalogPage, QuickStartCatalogSection, QuickStartCatalogToolbar, QuickStartCloseModal, QuickStartContainer, QuickStartContext, QuickStartContextDefaults, QuickStartContextProvider, QuickStartDrawer, QuickStartPanelContent, QuickStartStatus, QuickStartTaskStatus, QuickStartTile, QuickStartTileDescription, QuickStartTileFooter, QuickStartTileFooterExternal, QuickStartTileHeader, camelize, clearFilterParams, equalsIgnoreOrder, filterQuickStarts, getDefaultQuickStartState, getDisabledQuickStarts, getQuickStartByName, getQuickStartStatus, getQuickStartStatusCount, getResource, getTaskStatusKey, history, isDisabledQuickStart, removeQueryArgument, setQueryArgument, useLocalStorage, useValuesForHelpTopicContext, useValuesForQuickStartContext };
2461
+ /* eslint-disable */
2462
+ // Brought in from dev to publish this with QS module
2463
+ // Dev now imports from here
2464
+ const ProcQuickStartParser = (quickStart, environmentVariables) => {
2465
+ var _a;
2466
+ const replaceEnvironmentVariables = (s) => s === null || s === void 0 ? void 0 : s.replace(/\${(\w+)}/, (substring, name) => {
2467
+ return environmentVariables ? ([name] ? environmentVariables[name] : substring) : substring;
2468
+ });
2469
+ quickStart.spec.tasks = (_a = quickStart.spec.tasks) === null || _a === void 0 ? void 0 : _a.map((task, index) => {
2470
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
2471
+ let proc;
2472
+ let answer;
2473
+ if (typeof task === 'string') {
2474
+ proc = task;
2475
+ answer = {};
2476
+ }
2477
+ else {
2478
+ // @ts-ignore
2479
+ proc = task.proc;
2480
+ answer = task;
2481
+ // @ts-ignore
2482
+ delete task.proc;
2483
+ }
2484
+ let description = '', procedure, verification, title, summaryFailed, success, reviewFailed, prerequisites;
2485
+ if (proc) {
2486
+ const taskDOM = document.createElement('div');
2487
+ taskDOM.innerHTML = proc;
2488
+ // remove the screencapture images
2489
+ taskDOM.querySelectorAll('.imageblock.screencapture').forEach((node) => {
2490
+ var _a;
2491
+ (_a = node.parentElement) === null || _a === void 0 ? void 0 : _a.removeChild(node);
2492
+ });
2493
+ title = (_a = taskDOM
2494
+ .querySelector('h1:first-child,h2:first-child,h3:first-child,h4:first-child,h5:first-child')) === null || _a === void 0 ? void 0 : _a.innerHTML.trim();
2495
+ let sectionBody = taskDOM.querySelector('.sectionbody');
2496
+ if (!(sectionBody === null || sectionBody === void 0 ? void 0 : sectionBody.hasChildNodes())) {
2497
+ // possibly in other templates, where we want to look for article
2498
+ sectionBody = taskDOM.querySelector('article');
2499
+ }
2500
+ if (sectionBody) {
2501
+ for (let i = 0; i < sectionBody.children.length || 0; i++) {
2502
+ /**
2503
+ child typically looks like:
2504
+
2505
+ <div class="paragraph|olist|ulist|admonitionblock">
2506
+ <div class="title">Procedure|Prerequisites|Verification|Note|Warning</div>
2507
+ <ol|ul class="arabic">
2508
+ <li>
2509
+ <li>...
2510
+ </ol|ul>
2511
+ </div>
2512
+
2513
+ And the below code extracts the <ol> or <ul>
2514
+ Except for when there is no <div class="title|heading"/>, then the description is extracted
2515
+ in the else if below
2516
+ */
2517
+ const child = sectionBody.children.item(i);
2518
+ // find the title
2519
+ const sectionTitle = child === null || child === void 0 ? void 0 : child.querySelector('.heading,.title');
2520
+ // should this section be assigned to a specific section
2521
+ const sectionTitleText = (_b = sectionTitle === null || sectionTitle === void 0 ? void 0 : sectionTitle.textContent) === null || _b === void 0 ? void 0 : _b.trim();
2522
+ const isKnownSection = ['Procedure', 'Verification', 'Prerequisites'].includes((_c = sectionTitle === null || sectionTitle === void 0 ? void 0 : sectionTitle.textContent) === null || _c === void 0 ? void 0 : _c.trim());
2523
+ if (isKnownSection) {
2524
+ switch (sectionTitleText) {
2525
+ case 'Procedure':
2526
+ procedure = (_d = child === null || child === void 0 ? void 0 : child.querySelector(':not(.heading):not(.title)')) === null || _d === void 0 ? void 0 : _d.outerHTML.trim();
2527
+ break;
2528
+ case 'Verification':
2529
+ verification = (_e = child === null || child === void 0 ? void 0 : child.querySelector(':not(.heading):not(.title)')) === null || _e === void 0 ? void 0 : _e.outerHTML.trim();
2530
+ break;
2531
+ case 'Prerequisites':
2532
+ prerequisites = (_f = child === null || child === void 0 ? void 0 : child.querySelector(':not(.heading):not(.title)')) === null || _f === void 0 ? void 0 : _f.outerHTML.trim();
2533
+ break;
2534
+ }
2535
+ }
2536
+ else if (!procedure) {
2537
+ // Otherwise if it comes before a procedure it's part of the description
2538
+ description = description + (child === null || child === void 0 ? void 0 : child.outerHTML.trim());
2539
+ }
2540
+ }
2541
+ }
2542
+ success = (_g = taskDOM.querySelector('.qs-summary.success')) === null || _g === void 0 ? void 0 : _g.innerHTML.trim();
2543
+ reviewFailed = (_h = taskDOM.querySelector('.qs-review.failed')) === null || _h === void 0 ? void 0 : _h.innerHTML.trim();
2544
+ summaryFailed = (_j = taskDOM.querySelector('.qs-summary.failed')) === null || _j === void 0 ? void 0 : _j.innerHTML.trim();
2545
+ }
2546
+ answer.title = replaceEnvironmentVariables(answer.title || title);
2547
+ answer.description = replaceEnvironmentVariables(answer.description || `${description} ${prerequisites || ''} ${procedure}`);
2548
+ answer.review = answer.review || {};
2549
+ answer.review.instructions = replaceEnvironmentVariables(((_k = answer.review) === null || _k === void 0 ? void 0 : _k.instructions) || verification || 'Have you completed these steps?');
2550
+ answer.review.failedTaskHelp = replaceEnvironmentVariables(answer.review.failedTaskHelp ||
2551
+ reviewFailed ||
2552
+ 'This task isn’t verified yet. Try the task again.');
2553
+ answer.summary = answer.summary || {};
2554
+ answer.summary.success = replaceEnvironmentVariables(answer.summary.success || success || 'You have completed this task!');
2555
+ answer.summary.failed = replaceEnvironmentVariables(answer.summary.failed || summaryFailed || 'Try the steps again.');
2556
+ return answer;
2557
+ });
2558
+ return quickStart;
2559
+ };
2560
+
2561
+ export { Box, CamelCaseWrap, EmptyBox, HELP_TOPIC_NAME_KEY, HelpTopicContainer, HelpTopicContext, HelpTopicContextDefaults, HelpTopicDrawer, Loading, LoadingBox, ProcQuickStartParser, QUICKSTART_ID_FILTER_KEY, QUICKSTART_SEARCH_FILTER_KEY, QUICKSTART_STATUS_FILTER_KEY, QUICKSTART_TASKS_INITIAL_STATES, QUICK_START_NAME, QuickStartCatalog, QuickStartCatalogEmptyState, QuickStartCatalogFilter, QuickStartCatalogFilterCount, QuickStartCatalogFilterCountWrapper, QuickStartCatalogFilterSearch, QuickStartCatalogFilterSearchWrapper, QuickStartCatalogFilterSelect, QuickStartCatalogFilterStatusWrapper, QuickStartCatalogHeader, QuickStartCatalogPage, QuickStartCatalogSection, QuickStartCatalogToolbar, QuickStartCloseModal, QuickStartContainer, QuickStartContext, QuickStartContextDefaults, QuickStartContextProvider, QuickStartDrawer, QuickStartPanelContent, QuickStartStatus, QuickStartTaskStatus, QuickStartTile, QuickStartTileDescription, QuickStartTileFooter, QuickStartTileFooterExternal, QuickStartTileHeader, camelize, clearFilterParams, equalsIgnoreOrder, filterQuickStarts, getDefaultQuickStartState, getDisabledQuickStarts, getQuickStartByName, getQuickStartStatus, getQuickStartStatusCount, getResource, getTaskStatusKey, history, isDisabledQuickStart, removeQueryArgument, setQueryArgument, useLocalStorage, useValuesForHelpTopicContext, useValuesForQuickStartContext };
2462
2562
  //# sourceMappingURL=index.es.js.map