@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 +1 -0
- package/dist/index.es.js +101 -1
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +101 -0
- package/dist/index.js.map +1 -1
- package/dist/quickstarts-full.es.js +101 -1
- package/dist/quickstarts-full.es.js.map +1 -1
- package/dist/utils/asciidoc-procedure-parser.d.ts +12 -0
- package/package.json +1 -1
|
@@ -20535,5 +20535,105 @@ const useLocalStorage = (key, initialValue) => {
|
|
|
20535
20535
|
return [storedValue, setValue];
|
|
20536
20536
|
};
|
|
20537
20537
|
|
|
20538
|
-
|
|
20538
|
+
/* eslint-disable */
|
|
20539
|
+
// Brought in from dev to publish this with QS module
|
|
20540
|
+
// Dev now imports from here
|
|
20541
|
+
const ProcQuickStartParser = (quickStart, environmentVariables) => {
|
|
20542
|
+
var _a;
|
|
20543
|
+
const replaceEnvironmentVariables = (s) => s === null || s === void 0 ? void 0 : s.replace(/\${(\w+)}/, (substring, name) => {
|
|
20544
|
+
return environmentVariables ? ([name] ? environmentVariables[name] : substring) : substring;
|
|
20545
|
+
});
|
|
20546
|
+
quickStart.spec.tasks = (_a = quickStart.spec.tasks) === null || _a === void 0 ? void 0 : _a.map((task, index) => {
|
|
20547
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
20548
|
+
let proc;
|
|
20549
|
+
let answer;
|
|
20550
|
+
if (typeof task === 'string') {
|
|
20551
|
+
proc = task;
|
|
20552
|
+
answer = {};
|
|
20553
|
+
}
|
|
20554
|
+
else {
|
|
20555
|
+
// @ts-ignore
|
|
20556
|
+
proc = task.proc;
|
|
20557
|
+
answer = task;
|
|
20558
|
+
// @ts-ignore
|
|
20559
|
+
delete task.proc;
|
|
20560
|
+
}
|
|
20561
|
+
let description = '', procedure, verification, title, summaryFailed, success, reviewFailed, prerequisites;
|
|
20562
|
+
if (proc) {
|
|
20563
|
+
const taskDOM = document.createElement('div');
|
|
20564
|
+
taskDOM.innerHTML = proc;
|
|
20565
|
+
// remove the screencapture images
|
|
20566
|
+
taskDOM.querySelectorAll('.imageblock.screencapture').forEach((node) => {
|
|
20567
|
+
var _a;
|
|
20568
|
+
(_a = node.parentElement) === null || _a === void 0 ? void 0 : _a.removeChild(node);
|
|
20569
|
+
});
|
|
20570
|
+
title = (_a = taskDOM
|
|
20571
|
+
.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();
|
|
20572
|
+
let sectionBody = taskDOM.querySelector('.sectionbody');
|
|
20573
|
+
if (!(sectionBody === null || sectionBody === void 0 ? void 0 : sectionBody.hasChildNodes())) {
|
|
20574
|
+
// possibly in other templates, where we want to look for article
|
|
20575
|
+
sectionBody = taskDOM.querySelector('article');
|
|
20576
|
+
}
|
|
20577
|
+
if (sectionBody) {
|
|
20578
|
+
for (let i = 0; i < sectionBody.children.length || 0; i++) {
|
|
20579
|
+
/**
|
|
20580
|
+
child typically looks like:
|
|
20581
|
+
|
|
20582
|
+
<div class="paragraph|olist|ulist|admonitionblock">
|
|
20583
|
+
<div class="title">Procedure|Prerequisites|Verification|Note|Warning</div>
|
|
20584
|
+
<ol|ul class="arabic">
|
|
20585
|
+
<li>
|
|
20586
|
+
<li>...
|
|
20587
|
+
</ol|ul>
|
|
20588
|
+
</div>
|
|
20589
|
+
|
|
20590
|
+
And the below code extracts the <ol> or <ul>
|
|
20591
|
+
Except for when there is no <div class="title|heading"/>, then the description is extracted
|
|
20592
|
+
in the else if below
|
|
20593
|
+
*/
|
|
20594
|
+
const child = sectionBody.children.item(i);
|
|
20595
|
+
// find the title
|
|
20596
|
+
const sectionTitle = child === null || child === void 0 ? void 0 : child.querySelector('.heading,.title');
|
|
20597
|
+
// should this section be assigned to a specific section
|
|
20598
|
+
const sectionTitleText = (_b = sectionTitle === null || sectionTitle === void 0 ? void 0 : sectionTitle.textContent) === null || _b === void 0 ? void 0 : _b.trim();
|
|
20599
|
+
const isKnownSection = ['Procedure', 'Verification', 'Prerequisites'].includes((_c = sectionTitle === null || sectionTitle === void 0 ? void 0 : sectionTitle.textContent) === null || _c === void 0 ? void 0 : _c.trim());
|
|
20600
|
+
if (isKnownSection) {
|
|
20601
|
+
switch (sectionTitleText) {
|
|
20602
|
+
case 'Procedure':
|
|
20603
|
+
procedure = (_d = child === null || child === void 0 ? void 0 : child.querySelector(':not(.heading):not(.title)')) === null || _d === void 0 ? void 0 : _d.outerHTML.trim();
|
|
20604
|
+
break;
|
|
20605
|
+
case 'Verification':
|
|
20606
|
+
verification = (_e = child === null || child === void 0 ? void 0 : child.querySelector(':not(.heading):not(.title)')) === null || _e === void 0 ? void 0 : _e.outerHTML.trim();
|
|
20607
|
+
break;
|
|
20608
|
+
case 'Prerequisites':
|
|
20609
|
+
prerequisites = (_f = child === null || child === void 0 ? void 0 : child.querySelector(':not(.heading):not(.title)')) === null || _f === void 0 ? void 0 : _f.outerHTML.trim();
|
|
20610
|
+
break;
|
|
20611
|
+
}
|
|
20612
|
+
}
|
|
20613
|
+
else if (!procedure) {
|
|
20614
|
+
// Otherwise if it comes before a procedure it's part of the description
|
|
20615
|
+
description = description + (child === null || child === void 0 ? void 0 : child.outerHTML.trim());
|
|
20616
|
+
}
|
|
20617
|
+
}
|
|
20618
|
+
}
|
|
20619
|
+
success = (_g = taskDOM.querySelector('.qs-summary.success')) === null || _g === void 0 ? void 0 : _g.innerHTML.trim();
|
|
20620
|
+
reviewFailed = (_h = taskDOM.querySelector('.qs-review.failed')) === null || _h === void 0 ? void 0 : _h.innerHTML.trim();
|
|
20621
|
+
summaryFailed = (_j = taskDOM.querySelector('.qs-summary.failed')) === null || _j === void 0 ? void 0 : _j.innerHTML.trim();
|
|
20622
|
+
}
|
|
20623
|
+
answer.title = replaceEnvironmentVariables(answer.title || title);
|
|
20624
|
+
answer.description = replaceEnvironmentVariables(answer.description || `${description} ${prerequisites || ''} ${procedure}`);
|
|
20625
|
+
answer.review = answer.review || {};
|
|
20626
|
+
answer.review.instructions = replaceEnvironmentVariables(((_k = answer.review) === null || _k === void 0 ? void 0 : _k.instructions) || verification || 'Have you completed these steps?');
|
|
20627
|
+
answer.review.failedTaskHelp = replaceEnvironmentVariables(answer.review.failedTaskHelp ||
|
|
20628
|
+
reviewFailed ||
|
|
20629
|
+
'This task isn’t verified yet. Try the task again.');
|
|
20630
|
+
answer.summary = answer.summary || {};
|
|
20631
|
+
answer.summary.success = replaceEnvironmentVariables(answer.summary.success || success || 'You have completed this task!');
|
|
20632
|
+
answer.summary.failed = replaceEnvironmentVariables(answer.summary.failed || summaryFailed || 'Try the steps again.');
|
|
20633
|
+
return answer;
|
|
20634
|
+
});
|
|
20635
|
+
return quickStart;
|
|
20636
|
+
};
|
|
20637
|
+
|
|
20638
|
+
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 };
|
|
20539
20639
|
//# sourceMappingURL=quickstarts-full.es.js.map
|