@patternfly/quickstarts 2.2.3 → 2.3.1
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/README.md +4 -4
- package/dist/ConsoleShared/src/components/markdown-extensions/inline-clipboard-extension.d.ts +1 -1
- package/dist/ConsoleShared/src/components/markdown-extensions/multiline-clipboard-extension.d.ts +1 -1
- package/dist/HelpTopicDrawer.d.ts +8 -2
- package/dist/QuickStartDrawer.d.ts +21 -2
- package/dist/controller/QuickStartTaskHeader.d.ts +1 -1
- package/dist/index.es.js +14 -13
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +14 -13
- package/dist/index.js.map +1 -1
- package/dist/patternfly-docs/quick-starts/design-guidelines/design-guidelines.md +105 -0
- package/dist/patternfly-docs/quick-starts/design-guidelines/img/card-elements copy.png +0 -0
- package/dist/patternfly-docs/quick-starts/design-guidelines/img/card-elements.png +0 -0
- package/dist/patternfly-docs/quick-starts/design-guidelines/img/catalog-elements.png +0 -0
- package/dist/patternfly-docs/quick-starts/design-guidelines/img/check-your-work.png +0 -0
- package/dist/patternfly-docs/quick-starts/design-guidelines/img/introduction-screen.png +0 -0
- package/dist/patternfly-docs/quick-starts/design-guidelines/img/mixed-catalog.png +0 -0
- package/dist/patternfly-docs/quick-starts/design-guidelines/img/prerequisites.png +0 -0
- package/dist/patternfly-docs/quick-starts/design-guidelines/img/qs-context.png +0 -0
- package/dist/patternfly-docs/quick-starts/design-guidelines/img/side-panel-elements.png +0 -0
- package/dist/patternfly-docs/quick-starts/design-guidelines/img/side-panel-resized.png +0 -0
- package/dist/patternfly-docs/quick-starts/design-guidelines/img/side-panel.png +0 -0
- package/dist/patternfly-docs/quick-starts/design-guidelines/img/task-no.png +0 -0
- package/dist/patternfly-docs/quick-starts/design-guidelines/img/task-yes.png +0 -0
- package/dist/patternfly-docs/quick-starts/design-guidelines/img/task.png +0 -0
- package/dist/patternfly-docs/quick-starts/examples/Basic.jsx +73 -0
- package/dist/patternfly-docs/quick-starts/examples/HelpTopic.jsx +53 -0
- package/dist/patternfly-docs/quick-starts/examples/about.md +77 -0
- package/dist/patternfly-docs/quick-starts/examples/basic.md +27 -0
- package/dist/patternfly-docs/quick-starts/examples/example-data/example-help-topics.js +173 -0
- package/dist/patternfly-docs/quick-starts/examples/example-data/example-quickstarts.js +215 -0
- package/dist/patternfly-docs/quick-starts/examples/example-data/index.js +15 -0
- package/dist/patternfly-docs/quick-starts/examples/help-topics.md +25 -0
- package/dist/patternfly-docs/quick-starts/examples/img/catalog.png +0 -0
- package/dist/patternfly-docs/quick-starts/examples/img/help-topic.png +0 -0
- package/dist/patternfly-docs/quick-starts/examples/img/side-panel.png +0 -0
- package/dist/quickstarts-base.css +24 -24
- package/dist/quickstarts-full.es.js +14 -13
- package/dist/quickstarts-full.es.js.map +1 -1
- package/dist/quickstarts.css +24 -24
- package/dist/quickstarts.min.css +1 -1
- package/package.json +11 -4
- package/src/ConsoleInternal/components/_icon-and-text.scss +14 -0
- package/src/ConsoleInternal/components/_markdown-view.scss +19 -0
- package/src/ConsoleInternal/components/catalog/_catalog.scss +390 -0
- package/src/ConsoleInternal/components/markdown-view.tsx +305 -0
- package/src/ConsoleInternal/components/utils/_status-box.scss +58 -0
- package/src/ConsoleInternal/components/utils/camel-case-wrap.tsx +33 -0
- package/src/ConsoleInternal/components/utils/index.tsx +3 -0
- package/src/ConsoleInternal/components/utils/router.ts +47 -0
- package/src/ConsoleInternal/components/utils/status-box.tsx +94 -0
- package/src/ConsoleInternal/module/k8s/types.ts +53 -0
- package/src/ConsoleShared/index.ts +1 -0
- package/src/ConsoleShared/src/components/index.ts +7 -0
- package/src/ConsoleShared/src/components/layout/PageLayout.scss +29 -0
- package/src/ConsoleShared/src/components/markdown-extensions/MarkdownCopyClipboard.tsx +93 -0
- package/src/ConsoleShared/src/components/markdown-extensions/__tests__/MarkdownCopyClipboard.spec.tsx +25 -0
- package/src/ConsoleShared/src/components/markdown-extensions/__tests__/test-data.ts +5 -0
- package/src/ConsoleShared/src/components/markdown-extensions/admonition-extension.tsx +66 -0
- package/src/ConsoleShared/src/components/markdown-extensions/code-extension.tsx +25 -0
- package/src/ConsoleShared/src/components/markdown-extensions/const.ts +3 -0
- package/src/ConsoleShared/src/components/markdown-extensions/index.ts +5 -0
- package/src/ConsoleShared/src/components/markdown-extensions/inline-clipboard-extension.tsx +39 -0
- package/src/ConsoleShared/src/components/markdown-extensions/multiline-clipboard-extension.tsx +44 -0
- package/src/ConsoleShared/src/components/markdown-extensions/showdown-extension.scss +52 -0
- package/src/ConsoleShared/src/components/markdown-extensions/utils.ts +3 -0
- package/src/ConsoleShared/src/components/markdown-highlight-extension/MarkdownHighlightExtension.tsx +64 -0
- package/src/ConsoleShared/src/components/markdown-highlight-extension/highlight-consts.ts +9 -0
- package/src/ConsoleShared/src/components/markdown-highlight-extension/index.ts +1 -0
- package/src/ConsoleShared/src/components/modal/Modal.scss +3 -0
- package/src/ConsoleShared/src/components/modal/Modal.tsx +19 -0
- package/src/ConsoleShared/src/components/modal/index.ts +1 -0
- package/src/ConsoleShared/src/components/popper/Portal.tsx +23 -0
- package/src/ConsoleShared/src/components/popper/SimplePopper.tsx +90 -0
- package/src/ConsoleShared/src/components/popper/index.ts +2 -0
- package/src/ConsoleShared/src/components/spotlight/InteractiveSpotlight.tsx +58 -0
- package/src/ConsoleShared/src/components/spotlight/Spotlight.tsx +35 -0
- package/src/ConsoleShared/src/components/spotlight/StaticSpotlight.tsx +32 -0
- package/src/ConsoleShared/src/components/spotlight/index.ts +1 -0
- package/src/ConsoleShared/src/components/spotlight/spotlight.scss +63 -0
- package/src/ConsoleShared/src/components/status/GenericStatus.tsx +33 -0
- package/src/ConsoleShared/src/components/status/NotStartedIcon.tsx +27 -0
- package/src/ConsoleShared/src/components/status/PopoverStatus.tsx +42 -0
- package/src/ConsoleShared/src/components/status/Status.tsx +38 -0
- package/src/ConsoleShared/src/components/status/StatusIconAndText.tsx +42 -0
- package/src/ConsoleShared/src/components/status/icons.tsx +77 -0
- package/src/ConsoleShared/src/components/status/index.tsx +1 -0
- package/src/ConsoleShared/src/components/status/statuses.tsx +36 -0
- package/src/ConsoleShared/src/components/status/types.ts +7 -0
- package/src/ConsoleShared/src/components/utils/FallbackImg.tsx +20 -0
- package/src/ConsoleShared/src/components/utils/index.ts +1 -0
- package/src/ConsoleShared/src/constants/index.ts +1 -0
- package/src/ConsoleShared/src/constants/ui.ts +1 -0
- package/src/ConsoleShared/src/hooks/index.ts +6 -0
- package/src/ConsoleShared/src/hooks/scroll.ts +52 -0
- package/src/ConsoleShared/src/hooks/useBoundingClientRect.ts +18 -0
- package/src/ConsoleShared/src/hooks/useEventListener.ts +14 -0
- package/src/ConsoleShared/src/hooks/useForceRender.ts +6 -0
- package/src/ConsoleShared/src/hooks/useResizeObserver.ts +20 -0
- package/src/ConsoleShared/src/hooks/useScrollShadows.ts +45 -0
- package/src/ConsoleShared/src/index.ts +4 -0
- package/src/ConsoleShared/src/utils/index.ts +1 -0
- package/src/ConsoleShared/src/utils/useCombineRefs.ts +17 -0
- package/src/HelpTopicDrawer.tsx +124 -0
- package/src/HelpTopicPanelContent.tsx +152 -0
- package/src/QuickStartCatalogPage.tsx +190 -0
- package/src/QuickStartCloseModal.tsx +47 -0
- package/src/QuickStartController.tsx +113 -0
- package/src/QuickStartDrawer.scss +11 -0
- package/src/QuickStartDrawer.tsx +265 -0
- package/src/QuickStartMarkdownView.tsx +75 -0
- package/src/QuickStartPanelContent.scss +46 -0
- package/src/QuickStartPanelContent.tsx +153 -0
- package/src/__tests__/quick-start-utils.spec.tsx +16 -0
- package/src/catalog/Catalog/QuickStartCatalogHeader.tsx +18 -0
- package/src/catalog/Catalog/QuickStartCatalogSection.tsx +9 -0
- package/src/catalog/Catalog/QuickStartCatalogToolbar.tsx +12 -0
- package/src/catalog/Catalog/index.ts +3 -0
- package/src/catalog/QuickStartCatalog.scss +8 -0
- package/src/catalog/QuickStartCatalog.tsx +42 -0
- package/src/catalog/QuickStartTile.scss +11 -0
- package/src/catalog/QuickStartTile.tsx +105 -0
- package/src/catalog/QuickStartTileDescription.scss +29 -0
- package/src/catalog/QuickStartTileDescription.tsx +79 -0
- package/src/catalog/QuickStartTileFooter.tsx +101 -0
- package/src/catalog/QuickStartTileFooterExternal.tsx +40 -0
- package/src/catalog/QuickStartTileHeader.scss +12 -0
- package/src/catalog/QuickStartTileHeader.tsx +77 -0
- package/src/catalog/Toolbar/QuickStartCatalogFilter.scss +25 -0
- package/src/catalog/Toolbar/QuickStartCatalogFilter.tsx +34 -0
- package/src/catalog/Toolbar/QuickStartCatalogFilterItems.tsx +199 -0
- package/src/catalog/__tests__/QuickStartCatalog.spec.tsx +35 -0
- package/src/catalog/__tests__/QuickStartTile.spec.tsx +38 -0
- package/src/catalog/__tests__/QuickStartTileDescription.spec.tsx +44 -0
- package/src/catalog/index.ts +9 -0
- package/src/controller/QuickStartConclusion.tsx +63 -0
- package/src/controller/QuickStartContent.scss +12 -0
- package/src/controller/QuickStartContent.tsx +72 -0
- package/src/controller/QuickStartFooter.scss +13 -0
- package/src/controller/QuickStartFooter.tsx +128 -0
- package/src/controller/QuickStartIntroduction.scss +35 -0
- package/src/controller/QuickStartIntroduction.tsx +66 -0
- package/src/controller/QuickStartTaskHeader.scss +58 -0
- package/src/controller/QuickStartTaskHeader.tsx +116 -0
- package/src/controller/QuickStartTaskHeaderList.scss +17 -0
- package/src/controller/QuickStartTaskHeaderList.tsx +35 -0
- package/src/controller/QuickStartTaskReview.scss +30 -0
- package/src/controller/QuickStartTaskReview.tsx +81 -0
- package/src/controller/QuickStartTasks.scss +89 -0
- package/src/controller/QuickStartTasks.tsx +75 -0
- package/src/controller/__tests__/QuickStartConclusion.spec.tsx +95 -0
- package/src/controller/__tests__/QuickStartContent.spec.tsx +52 -0
- package/src/controller/__tests__/QuickStartFooter.spec.tsx +148 -0
- package/src/controller/__tests__/QuickStartTaskHeader.spec.tsx +56 -0
- package/src/controller/__tests__/QuickStartTaskReview.spec.tsx +45 -0
- package/src/controller/__tests__/QuickStartTasks.spec.tsx +81 -0
- package/src/data/mocks/json/explore-pipeline-quickstart.ts +66 -0
- package/src/data/mocks/json/explore-serverless-quickstart.ts +90 -0
- package/src/data/mocks/json/monitor-sampleapp-quickstart.ts +77 -0
- package/src/data/mocks/json/tour-icons.ts +3 -0
- package/src/data/mocks/yamls/add-healthchecks-quickstart.yaml +67 -0
- package/src/data/mocks/yamls/explore-pipeline-quickstart.yaml +57 -0
- package/src/data/mocks/yamls/explore-serverless-quickstart.yaml +83 -0
- package/src/data/mocks/yamls/install-associate-pipeline-quickstart.yaml +74 -0
- package/src/data/mocks/yamls/monitor-sampleapp-quickstart.yaml +66 -0
- package/src/data/mocks/yamls/sample-application-quickstart.yaml +97 -0
- package/src/data/mocks/yamls/serverless-application-quickstart.yaml +141 -0
- package/src/data/quick-start-test-data.ts +10 -0
- package/src/data/test-utils.ts +11 -0
- package/src/declaration.d.ts +2 -0
- package/src/index.ts +17 -0
- package/src/locales/en/quickstart.json +46 -0
- package/src/styles/_base.scss +54 -0
- package/src/styles/_dark-custom-override.scss +62 -0
- package/src/styles/legacy-bootstrap/README.md +21 -0
- package/src/styles/legacy-bootstrap/_code.scss +44 -0
- package/src/styles/legacy-bootstrap/_tables.scss +38 -0
- package/src/styles/legacy-bootstrap/_type.scss +90 -0
- package/src/styles/legacy-bootstrap/_variables.scss +48 -0
- package/src/styles/legacy-bootstrap.scss +5 -0
- package/src/styles/patternfly-global-entry.ts +1 -0
- package/src/styles/patternfly-global.scss +28 -0
- package/src/styles/patternfly-nested-entry.ts +1 -0
- package/src/styles/patternfly-nested.scss +18 -0
- package/src/styles/quickstarts-standalone-entry.ts +1 -0
- package/src/styles/quickstarts-standalone.scss +7 -0
- package/src/styles/style.scss +12 -0
- package/src/styles/vendor-entry.ts +1 -0
- package/src/styles/vendor.scss +7 -0
- package/src/utils/PluralResolver.ts +356 -0
- package/src/utils/asciidoc-procedure-parser.ts +132 -0
- package/src/utils/const.ts +10 -0
- package/src/utils/help-topic-context.tsx +74 -0
- package/src/utils/help-topic-types.ts +16 -0
- package/src/utils/quick-start-context.tsx +477 -0
- package/src/utils/quick-start-types.ts +72 -0
- package/src/utils/quick-start-utils.ts +92 -0
- package/src/utils/useLocalStorage.ts +38 -0
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
// PF4 overrides
|
|
2
|
+
$font-size-base: 14px;
|
|
3
|
+
$font-size-h1: var(--pf-global--FontSize--2xl);
|
|
4
|
+
$font-size-h2: 20px; // must be literal value because of calculation in patternfly/dist/sass/patternfly/_list-view.scss
|
|
5
|
+
$font-size-h3: var(--pf-global--FontSize--lg);
|
|
6
|
+
$font-size-h4: var(--pf-global--FontSize--md);
|
|
7
|
+
$font-size-h5: var(--pf-global--FontSize--md);
|
|
8
|
+
$font-size-h6: var(--pf-global--FontSize--md);
|
|
9
|
+
$grid-gutter-width: 30px;
|
|
10
|
+
$headings-font-family: var(--pf-global--FontFamily--heading--sans-serif);
|
|
11
|
+
$headings-font-weight: var(--pf-global--FontWeight--normal);
|
|
12
|
+
|
|
13
|
+
// PF3 variables
|
|
14
|
+
$color-pf-black: #030303 !default;
|
|
15
|
+
$color-pf-black-600: #72767b !default;
|
|
16
|
+
$color-pf-white: #fff !default;
|
|
17
|
+
$color-pf-black-150: #f5f5f5 !default;
|
|
18
|
+
$color-pf-blue-600: #004368 !default;
|
|
19
|
+
$color-pf-blue-50: #def3ff !default;
|
|
20
|
+
$color-pf-black-100: #fafafa !default;
|
|
21
|
+
|
|
22
|
+
// PF3 bootstrap overrides
|
|
23
|
+
$line-height-base: 1.66666667 !default; // 20/12
|
|
24
|
+
$line-height-computed: floor(($font-size-base * $line-height-base)) !default;
|
|
25
|
+
$gray-light: lighten($color-pf-black, 60%) !default; // #999
|
|
26
|
+
$gray-lighter: lighten($color-pf-black, 93.5%) !default; // #eee
|
|
27
|
+
$gray-dark: lighten($color-pf-black, 20%) !default; // #333
|
|
28
|
+
$font-family-monospace: Menlo, Monaco, Consolas, monospace !default;
|
|
29
|
+
$code-color: $color-pf-blue-600 !default;
|
|
30
|
+
$code-bg: $color-pf-blue-50 !default;
|
|
31
|
+
$pre-bg: $color-pf-black-100 !default;
|
|
32
|
+
$border-radius-base: 1px !default;
|
|
33
|
+
$table-cell-padding: 10px !default;
|
|
34
|
+
|
|
35
|
+
// bootstrap variables
|
|
36
|
+
$screen-sm: 768px !default;
|
|
37
|
+
$screen-sm-min: $screen-sm !default;
|
|
38
|
+
$grid-float-breakpoint: $screen-sm-min !default;
|
|
39
|
+
$screen-md: 992px !default;
|
|
40
|
+
$headings-line-height: 1.1 !default;
|
|
41
|
+
$headings-color: inherit !default;
|
|
42
|
+
$gray-base: #000 !default;
|
|
43
|
+
$blockquote-font-size: ($font-size-base * 1.25) !default;
|
|
44
|
+
$blockquote-border-color: $gray-lighter !default;
|
|
45
|
+
$pre-color: $gray-dark !default;
|
|
46
|
+
$pre-border-color: #ccc !default;
|
|
47
|
+
$table-bg: transparent !default;
|
|
48
|
+
$text-muted: $gray-light !default;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import './patternfly-global.scss';
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
// pulls in the patternfly drawer styles, in case the consumer does not have them
|
|
2
|
+
// which can happen when they're not using PatternFly, or a different (older) version
|
|
3
|
+
// some global styles that quickstarts uses (Drawer, Popover, Modal, Backdrop, Bullseye)
|
|
4
|
+
|
|
5
|
+
// TODO: Investigate if we can remove and/or nest these within patternfly-nested.css
|
|
6
|
+
// what do we really need to expose globally?
|
|
7
|
+
// here are the classes that exist outside the scope of .pfext-quick-start__base:
|
|
8
|
+
// class="pf-c-popover pfext-quick-start__base pf-m-right"
|
|
9
|
+
// class="pf-c-modal-box pfext-modal pfext-quick-start-drawer__modal pfext-quick-start__base pf-m-sm"
|
|
10
|
+
// class="pf-c-backdrop__open"
|
|
11
|
+
// class="pf-c-backdrop"
|
|
12
|
+
// class="pf-l-bullseye"
|
|
13
|
+
// class="pf-c-tooltip pf-m-top pfext-quick-start__base"
|
|
14
|
+
|
|
15
|
+
@import '@patternfly/patternfly/sass-utilities/all';
|
|
16
|
+
// gets added globally to :root
|
|
17
|
+
@import '@patternfly/patternfly/base/variables';
|
|
18
|
+
|
|
19
|
+
@import '@patternfly/patternfly/components/Drawer/drawer.scss';
|
|
20
|
+
@import '@patternfly/patternfly/components/Popover/popover.scss';
|
|
21
|
+
|
|
22
|
+
// for the 'Leave quick start?` modal
|
|
23
|
+
@import '@patternfly/patternfly/components/ModalBox/modal-box.scss';
|
|
24
|
+
@import '@patternfly/patternfly/components/Backdrop/backdrop.scss';
|
|
25
|
+
@import '@patternfly/patternfly/layouts/Bullseye/bullseye.scss';
|
|
26
|
+
|
|
27
|
+
// for the markdown extension that lets users copy text to clipboard
|
|
28
|
+
@import '@patternfly/patternfly/components/Tooltip/tooltip.scss';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import './patternfly-nested.scss';
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
// pulls in the patternfly styles, in case the consumer does not have them
|
|
2
|
+
// which can happen when they're not using PatternFly, or a different (older) version
|
|
3
|
+
// that could be incompatible with the version of PatternFly that we're using
|
|
4
|
+
|
|
5
|
+
@import '@patternfly/patternfly/sass-utilities/all';
|
|
6
|
+
|
|
7
|
+
.pfext-quick-start__base {
|
|
8
|
+
$pf-global--enable-reset: false;
|
|
9
|
+
@import '@patternfly/patternfly/base/common';
|
|
10
|
+
@import '@patternfly/patternfly/utilities/Accessibility/accessibility.scss';
|
|
11
|
+
|
|
12
|
+
// it's okay that we include everything since we'll purge the unused styles
|
|
13
|
+
@import '@patternfly/patternfly/components/all';
|
|
14
|
+
@import '@patternfly/patternfly/layouts/all';
|
|
15
|
+
|
|
16
|
+
// some apps globally set text-align: center
|
|
17
|
+
text-align: left;
|
|
18
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import './quickstarts-standalone.scss';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
@import '@patternfly/patternfly/sass-utilities/all';
|
|
2
|
+
@import './legacy-bootstrap/variables';
|
|
3
|
+
|
|
4
|
+
@import './base';
|
|
5
|
+
@import './dark-custom-override';
|
|
6
|
+
|
|
7
|
+
// React Components
|
|
8
|
+
@import '../ConsoleInternal/**/*.scss';
|
|
9
|
+
@import '../ConsoleShared/**/*.scss';
|
|
10
|
+
|
|
11
|
+
// legacy bootstrap typography styles for markdown content
|
|
12
|
+
@import './legacy-bootstrap.scss';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import './vendor.scss';
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
// be careful about adding additional stylesheets here, they are bundled into the quickstarts.css
|
|
2
|
+
|
|
3
|
+
@import '@patternfly/patternfly/sass-utilities/all';
|
|
4
|
+
|
|
5
|
+
@import '@patternfly/react-catalog-view-extension/dist/sass/react-catalog-view-extension.scss';
|
|
6
|
+
@import '@patternfly/patternfly/components/ClipboardCopy/clipboard-copy.scss';
|
|
7
|
+
@import '@patternfly/patternfly/components/CodeBlock/code-block.scss';
|
|
@@ -0,0 +1,356 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
// @ts-nocheck
|
|
3
|
+
// https://github.com/i18next/i18next/blob/master/src/PluralResolver.js
|
|
4
|
+
|
|
5
|
+
const sets = [
|
|
6
|
+
{
|
|
7
|
+
lngs: [
|
|
8
|
+
'ach',
|
|
9
|
+
'ak',
|
|
10
|
+
'am',
|
|
11
|
+
'arn',
|
|
12
|
+
'br',
|
|
13
|
+
'fil',
|
|
14
|
+
'gun',
|
|
15
|
+
'ln',
|
|
16
|
+
'mfe',
|
|
17
|
+
'mg',
|
|
18
|
+
'mi',
|
|
19
|
+
'oc',
|
|
20
|
+
'pt',
|
|
21
|
+
'pt-BR',
|
|
22
|
+
'tg',
|
|
23
|
+
'tl',
|
|
24
|
+
'ti',
|
|
25
|
+
'tr',
|
|
26
|
+
'uz',
|
|
27
|
+
'wa',
|
|
28
|
+
],
|
|
29
|
+
nr: [1, 2],
|
|
30
|
+
fc: 1,
|
|
31
|
+
},
|
|
32
|
+
|
|
33
|
+
{
|
|
34
|
+
lngs: [
|
|
35
|
+
'af',
|
|
36
|
+
'an',
|
|
37
|
+
'ast',
|
|
38
|
+
'az',
|
|
39
|
+
'bg',
|
|
40
|
+
'bn',
|
|
41
|
+
'ca',
|
|
42
|
+
'da',
|
|
43
|
+
'de',
|
|
44
|
+
'dev',
|
|
45
|
+
'el',
|
|
46
|
+
'en',
|
|
47
|
+
'eo',
|
|
48
|
+
'es',
|
|
49
|
+
'et',
|
|
50
|
+
'eu',
|
|
51
|
+
'fi',
|
|
52
|
+
'fo',
|
|
53
|
+
'fur',
|
|
54
|
+
'fy',
|
|
55
|
+
'gl',
|
|
56
|
+
'gu',
|
|
57
|
+
'ha',
|
|
58
|
+
'hi',
|
|
59
|
+
'hu',
|
|
60
|
+
'hy',
|
|
61
|
+
'ia',
|
|
62
|
+
'it',
|
|
63
|
+
'kk',
|
|
64
|
+
'kn',
|
|
65
|
+
'ku',
|
|
66
|
+
'lb',
|
|
67
|
+
'mai',
|
|
68
|
+
'ml',
|
|
69
|
+
'mn',
|
|
70
|
+
'mr',
|
|
71
|
+
'nah',
|
|
72
|
+
'nap',
|
|
73
|
+
'nb',
|
|
74
|
+
'ne',
|
|
75
|
+
'nl',
|
|
76
|
+
'nn',
|
|
77
|
+
'no',
|
|
78
|
+
'nso',
|
|
79
|
+
'pa',
|
|
80
|
+
'pap',
|
|
81
|
+
'pms',
|
|
82
|
+
'ps',
|
|
83
|
+
'pt-PT',
|
|
84
|
+
'rm',
|
|
85
|
+
'sco',
|
|
86
|
+
'se',
|
|
87
|
+
'si',
|
|
88
|
+
'so',
|
|
89
|
+
'son',
|
|
90
|
+
'sq',
|
|
91
|
+
'sv',
|
|
92
|
+
'sw',
|
|
93
|
+
'ta',
|
|
94
|
+
'te',
|
|
95
|
+
'tk',
|
|
96
|
+
'ur',
|
|
97
|
+
'yo',
|
|
98
|
+
],
|
|
99
|
+
nr: [1, 2],
|
|
100
|
+
fc: 2,
|
|
101
|
+
},
|
|
102
|
+
|
|
103
|
+
{
|
|
104
|
+
lngs: [
|
|
105
|
+
'ay',
|
|
106
|
+
'bo',
|
|
107
|
+
'cgg',
|
|
108
|
+
'fa',
|
|
109
|
+
'ht',
|
|
110
|
+
'id',
|
|
111
|
+
'ja',
|
|
112
|
+
'jbo',
|
|
113
|
+
'ka',
|
|
114
|
+
'km',
|
|
115
|
+
'ko',
|
|
116
|
+
'ky',
|
|
117
|
+
'lo',
|
|
118
|
+
'ms',
|
|
119
|
+
'sah',
|
|
120
|
+
'su',
|
|
121
|
+
'th',
|
|
122
|
+
'tt',
|
|
123
|
+
'ug',
|
|
124
|
+
'vi',
|
|
125
|
+
'wo',
|
|
126
|
+
'zh',
|
|
127
|
+
],
|
|
128
|
+
nr: [1],
|
|
129
|
+
fc: 3,
|
|
130
|
+
},
|
|
131
|
+
|
|
132
|
+
{ lngs: ['be', 'bs', 'cnr', 'dz', 'hr', 'ru', 'sr', 'uk'], nr: [1, 2, 5], fc: 4 },
|
|
133
|
+
|
|
134
|
+
{ lngs: ['ar'], nr: [0, 1, 2, 3, 11, 100], fc: 5 },
|
|
135
|
+
{ lngs: ['cs', 'sk'], nr: [1, 2, 5], fc: 6 },
|
|
136
|
+
{ lngs: ['csb', 'pl'], nr: [1, 2, 5], fc: 7 },
|
|
137
|
+
{ lngs: ['cy'], nr: [1, 2, 3, 8], fc: 8 },
|
|
138
|
+
{ lngs: ['fr'], nr: [1, 2], fc: 9 },
|
|
139
|
+
{ lngs: ['ga'], nr: [1, 2, 3, 7, 11], fc: 10 },
|
|
140
|
+
{ lngs: ['gd'], nr: [1, 2, 3, 20], fc: 11 },
|
|
141
|
+
{ lngs: ['is'], nr: [1, 2], fc: 12 },
|
|
142
|
+
{ lngs: ['jv'], nr: [0, 1], fc: 13 },
|
|
143
|
+
{ lngs: ['kw'], nr: [1, 2, 3, 4], fc: 14 },
|
|
144
|
+
{ lngs: ['lt'], nr: [1, 2, 10], fc: 15 },
|
|
145
|
+
{ lngs: ['lv'], nr: [1, 2, 0], fc: 16 },
|
|
146
|
+
{ lngs: ['mk'], nr: [1, 2], fc: 17 },
|
|
147
|
+
{ lngs: ['mnk'], nr: [0, 1, 2], fc: 18 },
|
|
148
|
+
{ lngs: ['mt'], nr: [1, 2, 11, 20], fc: 19 },
|
|
149
|
+
{ lngs: ['or'], nr: [2, 1], fc: 2 },
|
|
150
|
+
{ lngs: ['ro'], nr: [1, 2, 20], fc: 20 },
|
|
151
|
+
{ lngs: ['sl'], nr: [5, 1, 2, 3], fc: 21 },
|
|
152
|
+
{ lngs: ['he', 'iw'], nr: [1, 2, 20, 21], fc: 22 },
|
|
153
|
+
];
|
|
154
|
+
|
|
155
|
+
const _rulesPluralsTypes = {
|
|
156
|
+
1: function(n) {
|
|
157
|
+
return Number(n > 1);
|
|
158
|
+
},
|
|
159
|
+
2: function(n) {
|
|
160
|
+
return Number(n != 1);
|
|
161
|
+
},
|
|
162
|
+
3: function(n) {
|
|
163
|
+
return 0;
|
|
164
|
+
},
|
|
165
|
+
4: function(n) {
|
|
166
|
+
return Number(
|
|
167
|
+
n % 10 == 1 && n % 100 != 11
|
|
168
|
+
? 0
|
|
169
|
+
: n % 10 >= 2 && n % 10 <= 4 && (n % 100 < 10 || n % 100 >= 20)
|
|
170
|
+
? 1
|
|
171
|
+
: 2,
|
|
172
|
+
);
|
|
173
|
+
},
|
|
174
|
+
5: function(n) {
|
|
175
|
+
return Number(
|
|
176
|
+
n == 0
|
|
177
|
+
? 0
|
|
178
|
+
: n == 1
|
|
179
|
+
? 1
|
|
180
|
+
: n == 2
|
|
181
|
+
? 2
|
|
182
|
+
: n % 100 >= 3 && n % 100 <= 10
|
|
183
|
+
? 3
|
|
184
|
+
: n % 100 >= 11
|
|
185
|
+
? 4
|
|
186
|
+
: 5,
|
|
187
|
+
);
|
|
188
|
+
},
|
|
189
|
+
6: function(n) {
|
|
190
|
+
return Number(n == 1 ? 0 : n >= 2 && n <= 4 ? 1 : 2);
|
|
191
|
+
},
|
|
192
|
+
7: function(n) {
|
|
193
|
+
return Number(
|
|
194
|
+
n == 1 ? 0 : n % 10 >= 2 && n % 10 <= 4 && (n % 100 < 10 || n % 100 >= 20) ? 1 : 2,
|
|
195
|
+
);
|
|
196
|
+
},
|
|
197
|
+
8: function(n) {
|
|
198
|
+
return Number(n == 1 ? 0 : n == 2 ? 1 : n != 8 && n != 11 ? 2 : 3);
|
|
199
|
+
},
|
|
200
|
+
9: function(n) {
|
|
201
|
+
return Number(n >= 2);
|
|
202
|
+
},
|
|
203
|
+
10: function(n) {
|
|
204
|
+
return Number(n == 1 ? 0 : n == 2 ? 1 : n < 7 ? 2 : n < 11 ? 3 : 4);
|
|
205
|
+
},
|
|
206
|
+
11: function(n) {
|
|
207
|
+
return Number(n == 1 || n == 11 ? 0 : n == 2 || n == 12 ? 1 : n > 2 && n < 20 ? 2 : 3);
|
|
208
|
+
},
|
|
209
|
+
12: function(n) {
|
|
210
|
+
return Number(n % 10 != 1 || n % 100 == 11);
|
|
211
|
+
},
|
|
212
|
+
13: function(n) {
|
|
213
|
+
return Number(n !== 0);
|
|
214
|
+
},
|
|
215
|
+
14: function(n) {
|
|
216
|
+
return Number(n == 1 ? 0 : n == 2 ? 1 : n == 3 ? 2 : 3);
|
|
217
|
+
},
|
|
218
|
+
15: function(n) {
|
|
219
|
+
return Number(
|
|
220
|
+
n % 10 == 1 && n % 100 != 11 ? 0 : n % 10 >= 2 && (n % 100 < 10 || n % 100 >= 20) ? 1 : 2,
|
|
221
|
+
);
|
|
222
|
+
},
|
|
223
|
+
16: function(n) {
|
|
224
|
+
return Number(n % 10 == 1 && n % 100 != 11 ? 0 : n !== 0 ? 1 : 2);
|
|
225
|
+
},
|
|
226
|
+
17: function(n) {
|
|
227
|
+
return Number(n == 1 || (n % 10 == 1 && n % 100 != 11) ? 0 : 1);
|
|
228
|
+
},
|
|
229
|
+
18: function(n) {
|
|
230
|
+
return Number(n == 0 ? 0 : n == 1 ? 1 : 2);
|
|
231
|
+
},
|
|
232
|
+
19: function(n) {
|
|
233
|
+
return Number(
|
|
234
|
+
n == 1
|
|
235
|
+
? 0
|
|
236
|
+
: n == 0 || (n % 100 > 1 && n % 100 < 11)
|
|
237
|
+
? 1
|
|
238
|
+
: n % 100 > 10 && n % 100 < 20
|
|
239
|
+
? 2
|
|
240
|
+
: 3,
|
|
241
|
+
);
|
|
242
|
+
},
|
|
243
|
+
20: function(n) {
|
|
244
|
+
return Number(n == 1 ? 0 : n == 0 || (n % 100 > 0 && n % 100 < 20) ? 1 : 2);
|
|
245
|
+
},
|
|
246
|
+
21: function(n) {
|
|
247
|
+
return Number(n % 100 == 1 ? 1 : n % 100 == 2 ? 2 : n % 100 == 3 || n % 100 == 4 ? 3 : 0);
|
|
248
|
+
},
|
|
249
|
+
22: function(n) {
|
|
250
|
+
return Number(n == 1 ? 0 : n == 2 ? 1 : (n < 0 || n > 10) && n % 10 == 0 ? 2 : 3);
|
|
251
|
+
},
|
|
252
|
+
};
|
|
253
|
+
|
|
254
|
+
function createRules() {
|
|
255
|
+
const rules = {};
|
|
256
|
+
sets.forEach((set) => {
|
|
257
|
+
set.lngs.forEach((l) => {
|
|
258
|
+
rules[l] = {
|
|
259
|
+
numbers: set.nr,
|
|
260
|
+
plurals: _rulesPluralsTypes[set.fc],
|
|
261
|
+
};
|
|
262
|
+
});
|
|
263
|
+
});
|
|
264
|
+
return rules;
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
class PluralResolver {
|
|
268
|
+
constructor(options = {}) {
|
|
269
|
+
this.options = options;
|
|
270
|
+
|
|
271
|
+
this.rules = createRules();
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
addRule(lng, obj) {
|
|
275
|
+
this.rules[lng] = obj;
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
getRule(code) {
|
|
279
|
+
return this.rules[code];
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
needsPlural(code) {
|
|
283
|
+
const rule = this.getRule(code);
|
|
284
|
+
|
|
285
|
+
return rule && rule.numbers.length > 1;
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
getPluralFormsOfKey(code, key) {
|
|
289
|
+
return this.getSuffixes(code).map((suffix) => key + suffix);
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
getSuffixes(code) {
|
|
293
|
+
const rule = this.getRule(code);
|
|
294
|
+
|
|
295
|
+
if (!rule) {
|
|
296
|
+
return [];
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
return rule.numbers.map((number) => this.getSuffix(code, number));
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
getSuffix(code, count) {
|
|
303
|
+
const rule = this.getRule(code);
|
|
304
|
+
|
|
305
|
+
if (rule) {
|
|
306
|
+
// if (rule.numbers.length === 1) return ''; // only singular
|
|
307
|
+
|
|
308
|
+
const idx = rule.noAbs ? rule.plurals(count) : rule.plurals(Math.abs(count));
|
|
309
|
+
let suffix = rule.numbers[idx];
|
|
310
|
+
|
|
311
|
+
// special treatment for lngs only having singular and plural
|
|
312
|
+
if (this.options.simplifyPluralSuffix && rule.numbers.length === 2 && rule.numbers[0] === 1) {
|
|
313
|
+
if (suffix === 2) {
|
|
314
|
+
suffix = 'plural';
|
|
315
|
+
} else if (suffix === 1) {
|
|
316
|
+
suffix = '';
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
const returnSuffix = () =>
|
|
321
|
+
this.options.prepend && suffix.toString()
|
|
322
|
+
? this.options.prepend + suffix.toString()
|
|
323
|
+
: suffix.toString();
|
|
324
|
+
|
|
325
|
+
// COMPATIBILITY JSON
|
|
326
|
+
// v1
|
|
327
|
+
if (this.options.compatibilityJSON === 'v1') {
|
|
328
|
+
if (suffix === 1) {
|
|
329
|
+
return '';
|
|
330
|
+
}
|
|
331
|
+
if (typeof suffix === 'number') {
|
|
332
|
+
return `_plural_${suffix.toString()}`;
|
|
333
|
+
}
|
|
334
|
+
return returnSuffix();
|
|
335
|
+
}
|
|
336
|
+
if (/* v2 */ this.options.compatibilityJSON === 'v2') {
|
|
337
|
+
return returnSuffix();
|
|
338
|
+
}
|
|
339
|
+
if (
|
|
340
|
+
/* v3 - gettext index */ this.options.simplifyPluralSuffix &&
|
|
341
|
+
rule.numbers.length === 2 &&
|
|
342
|
+
rule.numbers[0] === 1
|
|
343
|
+
) {
|
|
344
|
+
return returnSuffix();
|
|
345
|
+
}
|
|
346
|
+
return this.options.prepend && idx.toString()
|
|
347
|
+
? this.options.prepend + idx.toString()
|
|
348
|
+
: idx.toString();
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
// this.logger.warn(`no plural rule found for: ${code}`);
|
|
352
|
+
return '';
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
export default PluralResolver;
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
// Brought in from dev to publish this with QS module
|
|
3
|
+
// Dev now imports from here
|
|
4
|
+
|
|
5
|
+
import { QuickStart, QuickStartTask } from './quick-start-types';
|
|
6
|
+
|
|
7
|
+
export const ProcQuickStartParser = (
|
|
8
|
+
quickStart: QuickStart & {
|
|
9
|
+
spec: {
|
|
10
|
+
tasks: undefined | QuickStartTask[] | string[];
|
|
11
|
+
};
|
|
12
|
+
},
|
|
13
|
+
environmentVariables?: { [name: string]: string },
|
|
14
|
+
) => {
|
|
15
|
+
const replaceEnvironmentVariables = (s: string | undefined) =>
|
|
16
|
+
s?.replace(/\${(\w+)}/, (substring, name) => {
|
|
17
|
+
return environmentVariables ? ([name] ? environmentVariables[name] : substring) : substring;
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
quickStart.spec.tasks = quickStart.spec.tasks?.map((task: QuickStartTask | string, index) => {
|
|
21
|
+
let proc: string;
|
|
22
|
+
let answer: QuickStartTask;
|
|
23
|
+
if (typeof task === 'string') {
|
|
24
|
+
proc = task;
|
|
25
|
+
answer = {};
|
|
26
|
+
} else {
|
|
27
|
+
// @ts-ignore
|
|
28
|
+
proc = task.proc;
|
|
29
|
+
answer = task;
|
|
30
|
+
// @ts-ignore
|
|
31
|
+
delete task.proc;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
let description = '',
|
|
35
|
+
procedure,
|
|
36
|
+
verification,
|
|
37
|
+
title,
|
|
38
|
+
summaryFailed,
|
|
39
|
+
success,
|
|
40
|
+
reviewFailed: string | undefined,
|
|
41
|
+
prerequisites;
|
|
42
|
+
if (proc) {
|
|
43
|
+
const taskDOM = document.createElement('div');
|
|
44
|
+
taskDOM.innerHTML = proc;
|
|
45
|
+
|
|
46
|
+
// remove the screencapture images
|
|
47
|
+
taskDOM.querySelectorAll('.imageblock.screencapture').forEach((node) => {
|
|
48
|
+
node.parentElement?.removeChild(node);
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
title = taskDOM
|
|
52
|
+
.querySelector('h1:first-child,h2:first-child,h3:first-child,h4:first-child,h5:first-child')
|
|
53
|
+
?.innerHTML.trim();
|
|
54
|
+
let sectionBody = taskDOM.querySelector('.sectionbody');
|
|
55
|
+
if (!sectionBody?.hasChildNodes()) {
|
|
56
|
+
// possibly in other templates, where we want to look for article
|
|
57
|
+
sectionBody = taskDOM.querySelector('article');
|
|
58
|
+
}
|
|
59
|
+
if (sectionBody) {
|
|
60
|
+
for (let i = 0; i < sectionBody.children.length || 0; i++) {
|
|
61
|
+
/**
|
|
62
|
+
child typically looks like:
|
|
63
|
+
|
|
64
|
+
<div class="paragraph|olist|ulist|admonitionblock">
|
|
65
|
+
<div class="title">Procedure|Prerequisites|Verification|Note|Warning</div>
|
|
66
|
+
<ol|ul class="arabic">
|
|
67
|
+
<li>
|
|
68
|
+
<li>...
|
|
69
|
+
</ol|ul>
|
|
70
|
+
</div>
|
|
71
|
+
|
|
72
|
+
And the below code extracts the <ol> or <ul>
|
|
73
|
+
Except for when there is no <div class="title|heading"/>, then the description is extracted
|
|
74
|
+
in the else if below
|
|
75
|
+
*/
|
|
76
|
+
const child = sectionBody.children.item(i);
|
|
77
|
+
// find the title
|
|
78
|
+
const sectionTitle = child?.querySelector('.heading,.title');
|
|
79
|
+
// should this section be assigned to a specific section
|
|
80
|
+
const sectionTitleText = sectionTitle?.textContent?.trim();
|
|
81
|
+
const isKnownSection = ['Procedure', 'Verification', 'Prerequisites'].includes(
|
|
82
|
+
sectionTitle?.textContent?.trim(),
|
|
83
|
+
);
|
|
84
|
+
if (isKnownSection) {
|
|
85
|
+
switch (sectionTitleText) {
|
|
86
|
+
case 'Procedure':
|
|
87
|
+
procedure = child?.querySelector(':not(.heading):not(.title)')?.outerHTML.trim();
|
|
88
|
+
break;
|
|
89
|
+
case 'Verification':
|
|
90
|
+
verification = child?.querySelector(':not(.heading):not(.title)')?.outerHTML.trim();
|
|
91
|
+
break;
|
|
92
|
+
case 'Prerequisites':
|
|
93
|
+
prerequisites = child
|
|
94
|
+
?.querySelector(':not(.heading):not(.title)')
|
|
95
|
+
?.outerHTML.trim();
|
|
96
|
+
break;
|
|
97
|
+
}
|
|
98
|
+
} else if (!procedure) {
|
|
99
|
+
// Otherwise if it comes before a procedure it's part of the description
|
|
100
|
+
description = description + child?.outerHTML.trim();
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
success = taskDOM.querySelector('.qs-summary.success')?.innerHTML.trim();
|
|
105
|
+
reviewFailed = taskDOM.querySelector('.qs-review.failed')?.innerHTML.trim();
|
|
106
|
+
summaryFailed = taskDOM.querySelector('.qs-summary.failed')?.innerHTML.trim();
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
answer.title = replaceEnvironmentVariables(answer.title || title);
|
|
110
|
+
answer.description = replaceEnvironmentVariables(
|
|
111
|
+
answer.description || `${description} ${prerequisites || ''} ${procedure}`,
|
|
112
|
+
);
|
|
113
|
+
answer.review = answer.review || {};
|
|
114
|
+
answer.review.instructions = replaceEnvironmentVariables(
|
|
115
|
+
answer.review?.instructions || verification || 'Have you completed these steps?',
|
|
116
|
+
);
|
|
117
|
+
answer.review.failedTaskHelp = replaceEnvironmentVariables(
|
|
118
|
+
answer.review.failedTaskHelp ||
|
|
119
|
+
reviewFailed ||
|
|
120
|
+
'This task isn’t verified yet. Try the task again.',
|
|
121
|
+
);
|
|
122
|
+
answer.summary = answer.summary || {};
|
|
123
|
+
answer.summary.success = replaceEnvironmentVariables(
|
|
124
|
+
answer.summary.success || success || 'You have completed this task!',
|
|
125
|
+
);
|
|
126
|
+
answer.summary.failed = replaceEnvironmentVariables(
|
|
127
|
+
answer.summary.failed || summaryFailed || 'Try the steps again.',
|
|
128
|
+
);
|
|
129
|
+
return answer;
|
|
130
|
+
});
|
|
131
|
+
return quickStart;
|
|
132
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { QuickStartTaskStatus } from './quick-start-types';
|
|
2
|
+
|
|
3
|
+
export const QUICKSTART_SEARCH_FILTER_KEY = 'keyword';
|
|
4
|
+
export const QUICKSTART_STATUS_FILTER_KEY = 'status';
|
|
5
|
+
export const QUICKSTART_ID_FILTER_KEY = 'quickstart';
|
|
6
|
+
export const QUICKSTART_TASKS_INITIAL_STATES = [
|
|
7
|
+
QuickStartTaskStatus.INIT,
|
|
8
|
+
QuickStartTaskStatus.VISITED,
|
|
9
|
+
];
|
|
10
|
+
export const HELP_TOPIC_NAME_KEY = 'topic';
|