xmlui 0.4.0
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/Pdf-DeGhSMXe.mjs +19537 -0
- package/dist/Pdf.css +1 -0
- package/dist/apiInterceptorWorker-CwuUhYyc.mjs +9229 -0
- package/dist/array-USo-Szhp.mjs +12 -0
- package/dist/index-C24dkfpd.mjs +1434 -0
- package/dist/index-ao27SnVp.mjs +145185 -0
- package/dist/index.css +1 -0
- package/dist/nivo-bar.es-CWh0ZlxB.mjs +1666 -0
- package/dist/nivo-geo.es-BTqNt5Db.mjs +1579 -0
- package/dist/nivo-legends.es-BuIxHGSU.mjs +6916 -0
- package/dist/nivo-pie.es-BvCBFA0L.mjs +700 -0
- package/dist/react-apexcharts.min-DqWuDOyO.mjs +8881 -0
- package/dist/scripts/bin/bootstrap.js +11 -0
- package/dist/scripts/bin/build.js +256 -0
- package/dist/scripts/bin/index.js +88 -0
- package/dist/scripts/bin/preview.js +27 -0
- package/dist/scripts/bin/start.js +41 -0
- package/dist/scripts/bin/vite-ueml-plugin.js +113 -0
- package/dist/scripts/bin/viteConfig.js +112 -0
- package/dist/scripts/src/abstractions/ActionDefs.js +2 -0
- package/dist/scripts/src/abstractions/AppContextDefs.js +2 -0
- package/dist/scripts/src/abstractions/BlockScope.js +4 -0
- package/dist/scripts/src/abstractions/ComponentDefs.js +2 -0
- package/dist/scripts/src/abstractions/ComponentDescriptorDefs.js +2 -0
- package/dist/scripts/src/abstractions/ContainerDefs.js +2 -0
- package/dist/scripts/src/abstractions/FunctionDefs.js +2 -0
- package/dist/scripts/src/abstractions/RendererDefs.js +2 -0
- package/dist/scripts/src/abstractions/scripting/ScriptParserError.js +2 -0
- package/dist/scripts/src/abstractions/scripting/ScriptingSourceTree.js +2 -0
- package/dist/scripts/src/abstractions/scripting/Token.js +110 -0
- package/dist/scripts/src/components/App/App.js +253 -0
- package/dist/scripts/src/components/App/AppLayoutContext.js +9 -0
- package/dist/scripts/src/components/App/AppStateContext.js +9 -0
- package/dist/scripts/src/components/App/Sheet.js +89 -0
- package/dist/scripts/src/components/AppHeader/AppHeader.js +121 -0
- package/dist/scripts/src/components/AppState/AppState.js +29 -0
- package/dist/scripts/src/components/Avatar/Avatar.js +81 -0
- package/dist/scripts/src/components/Badge/Badge.js +56 -0
- package/dist/scripts/src/components/BarChart/BarChart.js +199 -0
- package/dist/scripts/src/components/Bookmark/Bookmark.js +11 -0
- package/dist/scripts/src/components/Button/Button.js +196 -0
- package/dist/scripts/src/components/Card/Card.js +65 -0
- package/dist/scripts/src/components/ChangeListener/ChangeListener.js +43 -0
- package/dist/scripts/src/components/Chart/Chart.js +158 -0
- package/dist/scripts/src/components/Checkbox/Checkbox.js +43 -0
- package/dist/scripts/src/components/Combobox/Combobox.js +145 -0
- package/dist/scripts/src/components/ComponentProvider.js +357 -0
- package/dist/scripts/src/components/ContentSeparator/ContentSeparator.js +40 -0
- package/dist/scripts/src/components/DatePicker/DatePicker.js +196 -0
- package/dist/scripts/src/components/DropdownMenu/DropdownMenu.js +175 -0
- package/dist/scripts/src/components/EmojiSelector/EmojiSelector.js +56 -0
- package/dist/scripts/src/components/FileInput/FileInput.js +127 -0
- package/dist/scripts/src/components/FileUploadDropZone/FileUploadDropZone.js +106 -0
- package/dist/scripts/src/components/FlowLayout/FlowLayout.js +139 -0
- package/dist/scripts/src/components/Footer/Footer.js +42 -0
- package/dist/scripts/src/components/Form/Form.js +320 -0
- package/dist/scripts/src/components/Form/FormContext.js +9 -0
- package/dist/scripts/src/components/Form/formActions.js +86 -0
- package/dist/scripts/src/components/FormItem/FormItem.js +204 -0
- package/dist/scripts/src/components/FormItem/HelperText.js +27 -0
- package/dist/scripts/src/components/FormItem/ItemWithLabel.js +39 -0
- package/dist/scripts/src/components/FormItem/Validations.js +346 -0
- package/dist/scripts/src/components/FormSection/FormSection.js +45 -0
- package/dist/scripts/src/components/Heading/Heading.js +206 -0
- package/dist/scripts/src/components/HoverCard/HoverCard.js +45 -0
- package/dist/scripts/src/components/Icon/ApiIcon.js +10 -0
- package/dist/scripts/src/components/Icon/Attach.js +10 -0
- package/dist/scripts/src/components/Icon/Binding.js +11 -0
- package/dist/scripts/src/components/Icon/BoardIcon.js +7 -0
- package/dist/scripts/src/components/Icon/BoxIcon.js +10 -0
- package/dist/scripts/src/components/Icon/CheckIcon.js +7 -0
- package/dist/scripts/src/components/Icon/ChevronDownIcon.js +7 -0
- package/dist/scripts/src/components/Icon/ChevronLeft.js +7 -0
- package/dist/scripts/src/components/Icon/ChevronRight.js +7 -0
- package/dist/scripts/src/components/Icon/ChevronUpIcon.js +7 -0
- package/dist/scripts/src/components/Icon/CodeFileIcon.js +10 -0
- package/dist/scripts/src/components/Icon/CodeSandbox.js +10 -0
- package/dist/scripts/src/components/Icon/CompactListIcon.js +7 -0
- package/dist/scripts/src/components/Icon/ContentCopyIcon.js +7 -0
- package/dist/scripts/src/components/Icon/DatabaseIcon.js +11 -0
- package/dist/scripts/src/components/Icon/DocFileIcon.js +10 -0
- package/dist/scripts/src/components/Icon/DocIcon.js +10 -0
- package/dist/scripts/src/components/Icon/DotMenuHorizontalIcon.js +7 -0
- package/dist/scripts/src/components/Icon/DotMenuIcon.js +7 -0
- package/dist/scripts/src/components/Icon/EmailIcon.js +7 -0
- package/dist/scripts/src/components/Icon/EmptyFolderIcon.js +10 -0
- package/dist/scripts/src/components/Icon/ErrorIcon.js +7 -0
- package/dist/scripts/src/components/Icon/ExpressionIcon.js +10 -0
- package/dist/scripts/src/components/Icon/FillPlusCricleIcon.js +7 -0
- package/dist/scripts/src/components/Icon/FilterIcon.js +10 -0
- package/dist/scripts/src/components/Icon/FolderIcon.js +10 -0
- package/dist/scripts/src/components/Icon/GlobeIcon.js +7 -0
- package/dist/scripts/src/components/Icon/HomeIcon.js +7 -0
- package/dist/scripts/src/components/Icon/HyperLinkIcon.js +7 -0
- package/dist/scripts/src/components/Icon/Icon.js +101 -0
- package/dist/scripts/src/components/Icon/ImageFileIcon.js +10 -0
- package/dist/scripts/src/components/Icon/LinkIcon.js +7 -0
- package/dist/scripts/src/components/Icon/ListIcon.js +7 -0
- package/dist/scripts/src/components/Icon/LooseListIcon.js +7 -0
- package/dist/scripts/src/components/Icon/MoonIcon.js +10 -0
- package/dist/scripts/src/components/Icon/MoreOptionsIcon.js +7 -0
- package/dist/scripts/src/components/Icon/PDFIcon.js +10 -0
- package/dist/scripts/src/components/Icon/PenIcon.js +7 -0
- package/dist/scripts/src/components/Icon/PhoneIcon.js +7 -0
- package/dist/scripts/src/components/Icon/PhotoIcon.js +10 -0
- package/dist/scripts/src/components/Icon/PlusIcon.js +7 -0
- package/dist/scripts/src/components/Icon/SearchIcon.js +7 -0
- package/dist/scripts/src/components/Icon/ShareIcon.js +10 -0
- package/dist/scripts/src/components/Icon/SunIcon.js +10 -0
- package/dist/scripts/src/components/Icon/TrashIcon.js +7 -0
- package/dist/scripts/src/components/Icon/TxtIcon.js +10 -0
- package/dist/scripts/src/components/Icon/UnknownFileIcon.js +10 -0
- package/dist/scripts/src/components/Icon/UnlinkIcon.js +10 -0
- package/dist/scripts/src/components/Icon/UserIcon.js +7 -0
- package/dist/scripts/src/components/Icon/WarningIcon.js +7 -0
- package/dist/scripts/src/components/Icon/XlsIcon.js +10 -0
- package/dist/scripts/src/components/IconProvider.js +249 -0
- package/dist/scripts/src/components/IconRegistryContext.js +307 -0
- package/dist/scripts/src/components/Image/Image.js +34 -0
- package/dist/scripts/src/components/Input/InputAdornment.js +14 -0
- package/dist/scripts/src/components/Input/input-abstractions.js +44 -0
- package/dist/scripts/src/components/Items/Items.js +48 -0
- package/dist/scripts/src/components/Link/Link.js +72 -0
- package/dist/scripts/src/components/List/List.js +442 -0
- package/dist/scripts/src/components/Logo/Logo.js +25 -0
- package/dist/scripts/src/components/Map/Map.js +60 -0
- package/dist/scripts/src/components/Map/world_countries.json +45307 -0
- package/dist/scripts/src/components/Markdown/Markdown.js +120 -0
- package/dist/scripts/src/components/ModalDialog/ConfirmationModalContextProvider.js +106 -0
- package/dist/scripts/src/components/ModalDialog/Dialog.js +20 -0
- package/dist/scripts/src/components/ModalDialog/ModalDialog.js +145 -0
- package/dist/scripts/src/components/MultiCombobox/MultiCombobox.js +249 -0
- package/dist/scripts/src/components/MultiSelect/MultiSelect.js +192 -0
- package/dist/scripts/src/components/NavGroup/NavGroup.js +113 -0
- package/dist/scripts/src/components/NavLink/NavLink.js +115 -0
- package/dist/scripts/src/components/NavPanel/NavPanel.js +101 -0
- package/dist/scripts/src/components/NoResult/NoResult.js +39 -0
- package/dist/scripts/src/components/NumberBox/NumberBox.js +373 -0
- package/dist/scripts/src/components/Option/Option.js +41 -0
- package/dist/scripts/src/components/PageMetaTitle/PageMetaTitle.js +22 -0
- package/dist/scripts/src/components/Pages/Pages.js +74 -0
- package/dist/scripts/src/components/Pdf/LazyPdf.js +44 -0
- package/dist/scripts/src/components/Pdf/Pdf.js +19 -0
- package/dist/scripts/src/components/PieChart/PieChart.js +184 -0
- package/dist/scripts/src/components/PositionedContainer/PositionedContainer.js +29 -0
- package/dist/scripts/src/components/ProgressBar/ProgressBar.js +38 -0
- package/dist/scripts/src/components/Queue/Queue.js +286 -0
- package/dist/scripts/src/components/Queue/queueActions.js +87 -0
- package/dist/scripts/src/components/RadioGroup/RadioGroup.js +144 -0
- package/dist/scripts/src/components/RealTimeAdapter/RealTimeAdapter.js +147 -0
- package/dist/scripts/src/components/Redirect/Redirect.js +10 -0
- package/dist/scripts/src/components/Select/Select.js +139 -0
- package/dist/scripts/src/components/Select/SelectContext.js +45 -0
- package/dist/scripts/src/components/SelectionStore/SelectionStore.js +88 -0
- package/dist/scripts/src/components/SpaceFiller/SpaceFiller.js +22 -0
- package/dist/scripts/src/components/Spinner/Spinner.js +59 -0
- package/dist/scripts/src/components/Splitter/Splitter.js +205 -0
- package/dist/scripts/src/components/Splitter/utils.js +17 -0
- package/dist/scripts/src/components/Stack/Stack.js +117 -0
- package/dist/scripts/src/components/StickyBox/StickyBox.js +33 -0
- package/dist/scripts/src/components/Switch/Switch.js +50 -0
- package/dist/scripts/src/components/Table/Table.js +499 -0
- package/dist/scripts/src/components/Table/useRowSelection.js +169 -0
- package/dist/scripts/src/components/TableColumnDef/TableColumnDef.js +44 -0
- package/dist/scripts/src/components/TableColumnDef/TableContext.js +12 -0
- package/dist/scripts/src/components/Tabs/Tabs.js +85 -0
- package/dist/scripts/src/components/Text/Text.js +175 -0
- package/dist/scripts/src/components/TextArea/TextArea.js +194 -0
- package/dist/scripts/src/components/TextArea/TextAreaResizable.js +63 -0
- package/dist/scripts/src/components/TextArea/useComposedRef.js +50 -0
- package/dist/scripts/src/components/TextBox/TextBox.js +145 -0
- package/dist/scripts/src/components/Theme/NotificationToast.js +39 -0
- package/dist/scripts/src/components/Theme/Theme.js +153 -0
- package/dist/scripts/src/components/ThemeChanger/ThemeChanger.js +125 -0
- package/dist/scripts/src/components/Toggle/Toggle.js +88 -0
- package/dist/scripts/src/components/Tree/TreeComponent.js +79 -0
- package/dist/scripts/src/components/ValidationSummary/ValidationSummary.js +59 -0
- package/dist/scripts/src/components/ViewComponentRegistryContext.js +34 -0
- package/dist/scripts/src/components/abstractions.js +2 -0
- package/dist/scripts/src/components/chart-color-schemes.js +43 -0
- package/dist/scripts/src/components/component-utils.js +32 -0
- package/dist/scripts/src/components/container-helpers.js +18 -0
- package/dist/scripts/src/components-core/ApiBoundComponent.js +189 -0
- package/dist/scripts/src/components-core/AppContext.js +17 -0
- package/dist/scripts/src/components-core/ChildrenSlot.js +10 -0
- package/dist/scripts/src/components-core/Component.js +280 -0
- package/dist/scripts/src/components-core/ComponentDecorator.js +63 -0
- package/dist/scripts/src/components-core/CompoundComponent.js +132 -0
- package/dist/scripts/src/components-core/EngineError.js +91 -0
- package/dist/scripts/src/components-core/ErrorBoundary.js +58 -0
- package/dist/scripts/src/components-core/Fragment.js +14 -0
- package/dist/scripts/src/components-core/InvalidComponent.js +15 -0
- package/dist/scripts/src/components-core/LoaderComponent.js +78 -0
- package/dist/scripts/src/components-core/RestApiProxy.js +341 -0
- package/dist/scripts/src/components-core/RootComponent.js +272 -0
- package/dist/scripts/src/components-core/RouteContext.js +45 -0
- package/dist/scripts/src/components-core/ScrollContext.js +9 -0
- package/dist/scripts/src/components-core/UnknownComponent.js +15 -0
- package/dist/scripts/src/components-core/abstractions/ComponentRenderer.js +2 -0
- package/dist/scripts/src/components-core/abstractions/LoaderRenderer.js +2 -0
- package/dist/scripts/src/components-core/abstractions/containers.js +18 -0
- package/dist/scripts/src/components-core/abstractions/treeAbstractions.js +2 -0
- package/dist/scripts/src/components-core/action/ApiAction.js +276 -0
- package/dist/scripts/src/components-core/action/DownloadFileAction.js +80 -0
- package/dist/scripts/src/components-core/action/NavigateAction.js +20 -0
- package/dist/scripts/src/components-core/action/TimedAction.js +21 -0
- package/dist/scripts/src/components-core/action/UploadAction.js +88 -0
- package/dist/scripts/src/components-core/action/actions.js +15 -0
- package/dist/scripts/src/components-core/appContext/date-functions.js +19 -0
- package/dist/scripts/src/components-core/appContext/misc-utils.js +12 -0
- package/dist/scripts/src/components-core/component-hooks.js +25 -0
- package/dist/scripts/src/components-core/constants.js +18 -0
- package/dist/scripts/src/components-core/container/Container.js +1110 -0
- package/dist/scripts/src/components-core/container/ContainerComponentDef.js +16 -0
- package/dist/scripts/src/components-core/container/buildProxy.js +54 -0
- package/dist/scripts/src/components-core/container/collectFnVarDeps.js +26 -0
- package/dist/scripts/src/components-core/container/valueExtractor.js +195 -0
- package/dist/scripts/src/components-core/descriptorHelper.js +75 -0
- package/dist/scripts/src/components-core/interception/abstractions.js +2 -0
- package/dist/scripts/src/components-core/interception/useApiInterceptorContext.js +9 -0
- package/dist/scripts/src/components-core/loader/ApiLoader.js +46 -0
- package/dist/scripts/src/components-core/loader/DataLoader.js +160 -0
- package/dist/scripts/src/components-core/loader/ExternalDataLoader.js +52 -0
- package/dist/scripts/src/components-core/loader/Loader.js +115 -0
- package/dist/scripts/src/components-core/loader/MockLoaderRenderer.js +32 -0
- package/dist/scripts/src/components-core/loader/PageableLoader.js +240 -0
- package/dist/scripts/src/components-core/renderers.js +45 -0
- package/dist/scripts/src/components-core/reportEngineError.js +59 -0
- package/dist/scripts/src/components-core/script-runner/BindingTreeEvaluationContext.js +35 -0
- package/dist/scripts/src/components-core/script-runner/ICustomOperations.js +34 -0
- package/dist/scripts/src/components-core/script-runner/LogicalThread.js +2 -0
- package/dist/scripts/src/components-core/script-runner/LoopScope.js +2 -0
- package/dist/scripts/src/components-core/script-runner/ParameterParser.js +117 -0
- package/dist/scripts/src/components-core/script-runner/TryScope.js +2 -0
- package/dist/scripts/src/components-core/script-runner/asyncProxy.js +96 -0
- package/dist/scripts/src/components-core/script-runner/bannedFunctions.js +34 -0
- package/dist/scripts/src/components-core/script-runner/custom-operations-registry.js +40 -0
- package/dist/scripts/src/components-core/script-runner/custom-ui-data.js +40 -0
- package/dist/scripts/src/components-core/script-runner/eval-tree-async.js +551 -0
- package/dist/scripts/src/components-core/script-runner/eval-tree-common.js +498 -0
- package/dist/scripts/src/components-core/script-runner/eval-tree-sync.js +434 -0
- package/dist/scripts/src/components-core/script-runner/modules.js +250 -0
- package/dist/scripts/src/components-core/script-runner/process-statement-async.js +818 -0
- package/dist/scripts/src/components-core/script-runner/process-statement-common.js +193 -0
- package/dist/scripts/src/components-core/script-runner/process-statement-sync.js +740 -0
- package/dist/scripts/src/components-core/script-runner/statement-queue.js +62 -0
- package/dist/scripts/src/components-core/script-runner/visitors.js +352 -0
- package/dist/scripts/src/components-core/theming/ThemeContext.js +43 -0
- package/dist/scripts/src/components-core/theming/ThemeProvider.js +334 -0
- package/dist/scripts/src/components-core/theming/abstractions.js +11 -0
- package/dist/scripts/src/components-core/theming/extendThemeUtils.js +114 -0
- package/dist/scripts/src/components-core/theming/hvar.js +105 -0
- package/dist/scripts/src/components-core/theming/themeVars.js +62 -0
- package/dist/scripts/src/components-core/theming/themes/base-utils.js +31 -0
- package/dist/scripts/src/components-core/theming/themes/palette.js +53 -0
- package/dist/scripts/src/components-core/theming/themes/root.js +257 -0
- package/dist/scripts/src/components-core/theming/themes/solid.js +16 -0
- package/dist/scripts/src/components-core/theming/themes/theme-colors.js +407 -0
- package/dist/scripts/src/components-core/theming/themes/xmlui.js +32 -0
- package/dist/scripts/src/components-core/theming/transformThemeVars.js +286 -0
- package/dist/scripts/src/components-core/utils/DataLoaderQueryKeyGenerator.js +34 -0
- package/dist/scripts/src/components-core/utils/LruCache.js +184 -0
- package/dist/scripts/src/components-core/utils/actionUtils.js +32 -0
- package/dist/scripts/src/components-core/utils/classnames.js +58 -0
- package/dist/scripts/src/components-core/utils/css-utils.js +127 -0
- package/dist/scripts/src/components-core/utils/date-utils.js +78 -0
- package/dist/scripts/src/components-core/utils/extractParam.js +148 -0
- package/dist/scripts/src/components-core/utils/hooks.js +221 -0
- package/dist/scripts/src/components-core/utils/mergeProps.js +45 -0
- package/dist/scripts/src/components-core/utils/misc.js +460 -0
- package/dist/scripts/src/components-core/utils/statementUtils.js +205 -0
- package/dist/scripts/src/components-core/utils/treeUtils.js +48 -0
- package/dist/scripts/src/components-core/xmlui-parser.js +52 -0
- package/dist/scripts/src/parsers/scripting/InputStream.js +59 -0
- package/dist/scripts/src/parsers/scripting/Lexer.js +1028 -0
- package/dist/scripts/src/parsers/scripting/Parser.js +2647 -0
- package/dist/scripts/src/parsers/scripting/ParserError.js +46 -0
- package/dist/scripts/src/parsers/scripting/TokenTrait.js +109 -0
- package/dist/scripts/src/parsers/scripting/code-behind-collect.js +118 -0
- package/dist/scripts/src/parsers/scripting/tree-visitor.js +602 -0
- package/dist/scripts/src/parsers/style-parser/StyleInputStream.js +39 -0
- package/dist/scripts/src/parsers/style-parser/StyleLexer.js +621 -0
- package/dist/scripts/src/parsers/style-parser/StyleParser.js +1000 -0
- package/dist/scripts/src/parsers/style-parser/errors.js +37 -0
- package/dist/scripts/src/parsers/style-parser/source-tree.js +2 -0
- package/dist/scripts/src/parsers/style-parser/style-compiler.js +513 -0
- package/dist/scripts/src/parsers/style-parser/tokens.js +42 -0
- package/dist/scripts/src/parsers/ueml/ParserError.js +54 -0
- package/dist/scripts/src/parsers/ueml/UemlHelper.js +579 -0
- package/dist/scripts/src/parsers/ueml/UemlInputStream.js +59 -0
- package/dist/scripts/src/parsers/ueml/UemlLexer.js +868 -0
- package/dist/scripts/src/parsers/ueml/UemlParser.js +1439 -0
- package/dist/scripts/src/parsers/ueml/UemlToken.js +24 -0
- package/dist/scripts/src/parsers/ueml/fileExtensions.js +6 -0
- package/dist/scripts/src/parsers/ueml/source-tree.js +2 -0
- package/dist/scripts/src/parsers/ueml/ueml-tree.js +2 -0
- package/dist/scripts/src/parsers/xmlui-parser/CharacterCodes.js +136 -0
- package/dist/scripts/src/parsers/xmlui-parser/diagnostics.js +100 -0
- package/dist/scripts/src/parsers/xmlui-parser/parser.js +476 -0
- package/dist/scripts/src/parsers/xmlui-parser/scanner.js +415 -0
- package/dist/scripts/src/parsers/xmlui-parser/syntax-kind.js +106 -0
- package/dist/scripts/src/parsers/xmlui-parser/syntax-node.js +2 -0
- package/dist/scripts/src/parsers/xmlui-parser/transform.js +922 -0
- package/dist/scripts/src/parsers/xmlui-parser/utils.js +83 -0
- package/dist/xmlui.es.d.ts +1667 -0
- package/dist/xmlui.es.js +17 -0
- package/dist/xmlui.umd.js +1589 -0
- package/package.json +175 -0
|
@@ -0,0 +1,286 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.resolveThemeVar = resolveThemeVar;
|
|
7
|
+
exports.generateBaseTones = generateBaseTones;
|
|
8
|
+
exports.generateBaseSpacings = generateBaseSpacings;
|
|
9
|
+
exports.generateBaseFontSizes = generateBaseFontSizes;
|
|
10
|
+
exports.generateButtonTones = generateButtonTones;
|
|
11
|
+
const color_1 = __importDefault(require("color"));
|
|
12
|
+
const hvar_1 = require("@components-core/theming/hvar");
|
|
13
|
+
function resolveThemeVar(varName, theme = {}) {
|
|
14
|
+
const value = theme[varName];
|
|
15
|
+
if (typeof value === "string" && value.startsWith("$")) {
|
|
16
|
+
return resolveThemeVar(value.substring(1), theme);
|
|
17
|
+
}
|
|
18
|
+
return value;
|
|
19
|
+
}
|
|
20
|
+
function generateBaseTones(theme) {
|
|
21
|
+
if (!theme) {
|
|
22
|
+
return {};
|
|
23
|
+
}
|
|
24
|
+
const resolvedTheme = resolveThemeVars(theme);
|
|
25
|
+
let colorTones = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, generateBaseTonesForColor("color-primary", resolvedTheme)), generateBaseTonesForColor("color-secondary", resolvedTheme)), generateBaseTonesForColor("color-info", resolvedTheme)), generateBaseTonesForColor("color-success", resolvedTheme)), generateBaseTonesForColor("color-warn", resolvedTheme)), generateBaseTonesForColor("color-danger", resolvedTheme)), generateBaseTonesForColor("color-surface", resolvedTheme, { distributeEven: true }));
|
|
26
|
+
return Object.assign(Object.assign(Object.assign({}, colorTones), generateRbgChannelsForTone("color-surface", Object.assign(Object.assign({}, resolvedTheme), colorTones))), generateRbgChannelsForTone("color-primary", Object.assign(Object.assign({}, resolvedTheme), colorTones)));
|
|
27
|
+
}
|
|
28
|
+
function generateBaseSpacings(theme) {
|
|
29
|
+
if (!theme) {
|
|
30
|
+
return {};
|
|
31
|
+
}
|
|
32
|
+
const resolvedTheme = resolveThemeVars(theme);
|
|
33
|
+
const base = resolvedTheme["space-base"];
|
|
34
|
+
if (!base || typeof base !== "string") {
|
|
35
|
+
return {};
|
|
36
|
+
}
|
|
37
|
+
let baseTrimmed = base.trim();
|
|
38
|
+
if (baseTrimmed.startsWith(".")) {
|
|
39
|
+
//if we have something like .5rem
|
|
40
|
+
baseTrimmed = `0${baseTrimmed}`;
|
|
41
|
+
}
|
|
42
|
+
const baseNum = parseFloat(baseTrimmed);
|
|
43
|
+
let baseUnit = baseTrimmed.replace(baseNum + "", "") || "px";
|
|
44
|
+
// a) non-baseNum -> "0px"
|
|
45
|
+
if (Number.isNaN(baseNum)) {
|
|
46
|
+
return {};
|
|
47
|
+
}
|
|
48
|
+
const scale = [0, 0.5, 1, 1.5, 2, 2.5, 3, 3.5, 4, 5, 6, 7, 8, 9, 10, 11, 12, 14, 16, 20, 24, 28, 32, 36, 40, 44, 48, 52, 56, 60, 64, 72, 80, 96];
|
|
49
|
+
const ret = {};
|
|
50
|
+
scale.forEach((step) => {
|
|
51
|
+
ret[`space-${(step + "").replace(".", "_")}`] = `${step * baseNum}${baseUnit}`;
|
|
52
|
+
});
|
|
53
|
+
return ret;
|
|
54
|
+
}
|
|
55
|
+
function generateBaseFontSizes(theme) {
|
|
56
|
+
if (!theme) {
|
|
57
|
+
return {};
|
|
58
|
+
}
|
|
59
|
+
const resolvedTheme = resolveThemeVars(theme);
|
|
60
|
+
const base = resolvedTheme["font-size"];
|
|
61
|
+
if (!base || typeof base !== "string") {
|
|
62
|
+
return {};
|
|
63
|
+
}
|
|
64
|
+
let baseTrimmed = base.trim();
|
|
65
|
+
if (baseTrimmed.startsWith(".")) {
|
|
66
|
+
//if we have something like .5rem
|
|
67
|
+
baseTrimmed = `0${baseTrimmed}`;
|
|
68
|
+
}
|
|
69
|
+
const baseNum = parseFloat(baseTrimmed);
|
|
70
|
+
let baseUnit = baseTrimmed.replace(baseNum + "", "") || "px";
|
|
71
|
+
// a) non-baseNum -> "0px"
|
|
72
|
+
if (Number.isNaN(baseNum)) {
|
|
73
|
+
return {};
|
|
74
|
+
}
|
|
75
|
+
const ret = {};
|
|
76
|
+
ret[`font-size-large`] = `${1.5 * baseNum}${baseUnit}`;
|
|
77
|
+
ret[`font-size-medium`] = `${1.25 * baseNum}${baseUnit}`;
|
|
78
|
+
ret[`font-size-normal`] = base;
|
|
79
|
+
ret[`font-size-small`] = `${0.875 * baseNum}${baseUnit}`;
|
|
80
|
+
ret[`font-size-smaller`] = `${0.75 * baseNum}${baseUnit}`;
|
|
81
|
+
ret[`font-size-tiny`] = `${0.625 * baseNum}${baseUnit}`;
|
|
82
|
+
return ret;
|
|
83
|
+
}
|
|
84
|
+
function generateButtonTones(theme) {
|
|
85
|
+
if (!theme) {
|
|
86
|
+
return {};
|
|
87
|
+
}
|
|
88
|
+
const resolvedTheme = resolveThemeVars(theme);
|
|
89
|
+
const variants = ["primary", "secondary", "attention"];
|
|
90
|
+
let ret = {};
|
|
91
|
+
variants.forEach((variant) => {
|
|
92
|
+
const solidTones = mapTones(findClosest(resolvedTheme, `color-Button-${variant}-solid`), (tones) => {
|
|
93
|
+
return {
|
|
94
|
+
[`color-bg-Button-${variant}-solid`]: tones.base,
|
|
95
|
+
[`color-bg-Button-${variant}-solid--hover`]: tones.tone1,
|
|
96
|
+
[`color-bg-Button-${variant}-solid--active`]: tones.tone2,
|
|
97
|
+
[`color-border-Button-${variant}-solid`]: tones.base,
|
|
98
|
+
[`color-border-Button-${variant}-solid--hover`]: tones.base,
|
|
99
|
+
[`color-border-Button-${variant}-solid--active`]: tones.base,
|
|
100
|
+
[`color-text-Button-${variant}-solid`]: tones.tone3,
|
|
101
|
+
[`color-text-Button-${variant}-solid--hover`]: tones.tone3,
|
|
102
|
+
[`color-text-Button-${variant}-solid--active`]: tones.tone3,
|
|
103
|
+
};
|
|
104
|
+
});
|
|
105
|
+
const outlinedTones = mapTones(findClosest(resolvedTheme, `color-Button-${variant}-outlined`), (tones) => {
|
|
106
|
+
return {
|
|
107
|
+
[`color-bg-Button-${variant}-outlined--hover`]: tones.alpha1,
|
|
108
|
+
[`color-bg-Button-${variant}-outlined--active`]: tones.alpha2,
|
|
109
|
+
[`color-border-Button-${variant}-outlined`]: tones.base,
|
|
110
|
+
[`color-border-Button-${variant}-outlined--hover`]: tones.tone1,
|
|
111
|
+
[`color-border-Button-${variant}-outlined--active`]: tones.tone2,
|
|
112
|
+
[`color-text-Button-${variant}-outlined`]: tones.base,
|
|
113
|
+
[`color-text-Button-${variant}-outlined--hover`]: tones.tone1,
|
|
114
|
+
[`color-text-Button-${variant}-outlined--active`]: tones.tone2,
|
|
115
|
+
};
|
|
116
|
+
});
|
|
117
|
+
const ghostTones = mapTones(findClosest(resolvedTheme, `color-Button-${variant}-ghost`), (tones) => {
|
|
118
|
+
return {
|
|
119
|
+
[`color-bg-Button-${variant}-ghost--active`]: tones.alpha2,
|
|
120
|
+
[`color-bg-Button-${variant}-ghost--hover`]: tones.alpha1,
|
|
121
|
+
[`color-text-Button-${variant}-ghost`]: tones.base,
|
|
122
|
+
[`color-text-Button-${variant}-ghost--hover`]: tones.tone1,
|
|
123
|
+
[`color-text-Button-${variant}-ghost--active`]: tones.tone2,
|
|
124
|
+
};
|
|
125
|
+
});
|
|
126
|
+
ret = Object.assign(Object.assign(Object.assign(Object.assign({}, ret), solidTones), outlinedTones), ghostTones);
|
|
127
|
+
});
|
|
128
|
+
return ret;
|
|
129
|
+
}
|
|
130
|
+
function findClosest(theme, themeVarName) {
|
|
131
|
+
if (theme[themeVarName]) {
|
|
132
|
+
return theme[themeVarName];
|
|
133
|
+
}
|
|
134
|
+
const hVar = (0, hvar_1.parseHVar)(themeVarName);
|
|
135
|
+
if (!hVar) {
|
|
136
|
+
return null;
|
|
137
|
+
}
|
|
138
|
+
let closest = null;
|
|
139
|
+
let closestKey = null;
|
|
140
|
+
Object.keys(theme).forEach((themeVar) => {
|
|
141
|
+
const parsedVar = (0, hvar_1.parseHVar)(themeVar);
|
|
142
|
+
if (!parsedVar || parsedVar.component !== hVar.component || parsedVar.attribute !== hVar.attribute) {
|
|
143
|
+
return;
|
|
144
|
+
}
|
|
145
|
+
if (parsedVar.states.length) {
|
|
146
|
+
return;
|
|
147
|
+
}
|
|
148
|
+
if (parsedVar.traits.every((tr) => hVar.traits.includes(tr)) &&
|
|
149
|
+
(!closest || closest.traits.length <= parsedVar.traits.length)) {
|
|
150
|
+
closest = parsedVar;
|
|
151
|
+
closestKey = themeVar;
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
154
|
+
});
|
|
155
|
+
if (closestKey) {
|
|
156
|
+
// console.log("found closest for", themeVarName, closestKey);
|
|
157
|
+
return theme[closestKey];
|
|
158
|
+
}
|
|
159
|
+
return null;
|
|
160
|
+
}
|
|
161
|
+
function resolveThemeVars(theme) {
|
|
162
|
+
const ret = {};
|
|
163
|
+
Object.keys(theme).forEach((key) => {
|
|
164
|
+
ret[key] = resolveThemeVar(key, theme);
|
|
165
|
+
});
|
|
166
|
+
return ret;
|
|
167
|
+
}
|
|
168
|
+
function getRgbChannelsString(colorStr) {
|
|
169
|
+
if (!colorStr) {
|
|
170
|
+
return undefined;
|
|
171
|
+
}
|
|
172
|
+
const color = (0, color_1.default)(colorStr);
|
|
173
|
+
let rgb = color.rgb();
|
|
174
|
+
return `${rgb.red()},${rgb.green()},${rgb.blue()}`;
|
|
175
|
+
}
|
|
176
|
+
function generateBaseTonesForColor(varName, theme, options = { distributeEven: false }) {
|
|
177
|
+
const { distributeEven } = options;
|
|
178
|
+
const color = theme[varName];
|
|
179
|
+
if (!color || typeof color !== "string") {
|
|
180
|
+
return {};
|
|
181
|
+
}
|
|
182
|
+
const baseColor = (0, color_1.default)(color);
|
|
183
|
+
let color50;
|
|
184
|
+
let color100;
|
|
185
|
+
let color200;
|
|
186
|
+
let color300;
|
|
187
|
+
let color400;
|
|
188
|
+
let color500;
|
|
189
|
+
let color600;
|
|
190
|
+
let color700;
|
|
191
|
+
let color800;
|
|
192
|
+
let color900;
|
|
193
|
+
let color950;
|
|
194
|
+
if (distributeEven) {
|
|
195
|
+
color50 = baseColor.lightness(98);
|
|
196
|
+
color100 = baseColor.lightness(95);
|
|
197
|
+
color200 = baseColor.lightness(83);
|
|
198
|
+
color300 = baseColor.lightness(75);
|
|
199
|
+
color400 = baseColor.lightness(63);
|
|
200
|
+
color500 = baseColor.lightness(52);
|
|
201
|
+
color600 = baseColor.lightness(40);
|
|
202
|
+
color700 = baseColor.lightness(32);
|
|
203
|
+
color800 = baseColor.lightness(27);
|
|
204
|
+
color900 = baseColor.lightness(16);
|
|
205
|
+
color950 = baseColor.lightness(13);
|
|
206
|
+
}
|
|
207
|
+
else {
|
|
208
|
+
const baseL = baseColor.hsl().l();
|
|
209
|
+
const darkStep = baseL / 5;
|
|
210
|
+
const lightStep = (100 - baseL) / 5;
|
|
211
|
+
color50 = baseColor.lightness(baseL + lightStep * 4.5);
|
|
212
|
+
color100 = baseColor.lightness(baseL + lightStep * 4);
|
|
213
|
+
color200 = baseColor.lightness(baseL + lightStep * 3);
|
|
214
|
+
color300 = baseColor.lightness(baseL + lightStep * 2);
|
|
215
|
+
color400 = baseColor.lightness(baseL + lightStep * 1);
|
|
216
|
+
color500 = baseColor;
|
|
217
|
+
color600 = baseColor.lightness(baseL - darkStep * 1);
|
|
218
|
+
color700 = baseColor.lightness(baseL - darkStep * 2);
|
|
219
|
+
color800 = baseColor.lightness(baseL - darkStep * 3);
|
|
220
|
+
color900 = baseColor.lightness(baseL - darkStep * 4);
|
|
221
|
+
color950 = baseColor.lightness(baseL - darkStep * 4.5);
|
|
222
|
+
}
|
|
223
|
+
return {
|
|
224
|
+
[`${varName}-50`]: color50.toString(),
|
|
225
|
+
[`${varName}-100`]: color100.toString(),
|
|
226
|
+
[`${varName}-200`]: color200.toString(),
|
|
227
|
+
[`${varName}-300`]: color300.toString(),
|
|
228
|
+
[`${varName}-400`]: color400.toString(),
|
|
229
|
+
[`${varName}-500`]: color500.toString(),
|
|
230
|
+
[`${varName}-600`]: color600.toString(),
|
|
231
|
+
[`${varName}-700`]: color700.toString(),
|
|
232
|
+
[`${varName}-800`]: color800.toString(),
|
|
233
|
+
[`${varName}-900`]: color900.toString(),
|
|
234
|
+
[`${varName}-950`]: color950.toString(),
|
|
235
|
+
};
|
|
236
|
+
}
|
|
237
|
+
function generateRbgChannelsForTone(varName, theme) {
|
|
238
|
+
return {
|
|
239
|
+
[`${varName}-50-rgb`]: getRgbChannelsString(theme[`${varName}-50`]),
|
|
240
|
+
[`${varName}-100-rgb`]: getRgbChannelsString(theme[`${varName}-100`]),
|
|
241
|
+
[`${varName}-200-rgb`]: getRgbChannelsString(theme[`${varName}-200`]),
|
|
242
|
+
[`${varName}-300-rgb`]: getRgbChannelsString(theme[`${varName}-300`]),
|
|
243
|
+
[`${varName}-400-rgb`]: getRgbChannelsString(theme[`${varName}-400`]),
|
|
244
|
+
[`${varName}-500-rgb`]: getRgbChannelsString(theme[`${varName}-500`]),
|
|
245
|
+
[`${varName}-600-rgb`]: getRgbChannelsString(theme[`${varName}-600`]),
|
|
246
|
+
[`${varName}-700-rgb`]: getRgbChannelsString(theme[`${varName}-700`]),
|
|
247
|
+
[`${varName}-800-rgb`]: getRgbChannelsString(theme[`${varName}-800`]),
|
|
248
|
+
[`${varName}-900-rgb`]: getRgbChannelsString(theme[`${varName}-900`]),
|
|
249
|
+
[`${varName}-950-rgb`]: getRgbChannelsString(theme[`${varName}-950`]),
|
|
250
|
+
};
|
|
251
|
+
}
|
|
252
|
+
function mapTones(baseColor, mapper) {
|
|
253
|
+
const tones = generateTones(baseColor);
|
|
254
|
+
if (!tones) {
|
|
255
|
+
return {};
|
|
256
|
+
}
|
|
257
|
+
return mapper(tones);
|
|
258
|
+
}
|
|
259
|
+
function generateTones(baseColorStr) {
|
|
260
|
+
if (!baseColorStr || typeof baseColorStr !== "string" || baseColorStr.startsWith("$"))
|
|
261
|
+
return null; //TODO illesg here the startsWidth $ should be something else
|
|
262
|
+
const baseColor = (0, color_1.default)(baseColorStr);
|
|
263
|
+
let tone1;
|
|
264
|
+
let tone2;
|
|
265
|
+
let tone3;
|
|
266
|
+
if (baseColor.isLight()) {
|
|
267
|
+
tone1 = baseColor.darken(0.2).toString();
|
|
268
|
+
tone2 = baseColor.darken(0.1).toString();
|
|
269
|
+
tone3 = baseColor.darken(0.95).toString();
|
|
270
|
+
}
|
|
271
|
+
else {
|
|
272
|
+
tone1 = baseColor.lighten(0.2).toString();
|
|
273
|
+
tone2 = baseColor.lighten(0.1).toString();
|
|
274
|
+
tone3 = baseColor.lighten(0.95).toString();
|
|
275
|
+
}
|
|
276
|
+
const alpha1 = baseColor.alpha(0.1).toString();
|
|
277
|
+
const alpha2 = baseColor.alpha(0.2).toString();
|
|
278
|
+
return {
|
|
279
|
+
base: baseColorStr,
|
|
280
|
+
tone1,
|
|
281
|
+
tone2,
|
|
282
|
+
tone3,
|
|
283
|
+
alpha1,
|
|
284
|
+
alpha2,
|
|
285
|
+
};
|
|
286
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DataLoaderQueryKeyGenerator = void 0;
|
|
4
|
+
const lodash_es_1 = require("lodash-es");
|
|
5
|
+
class DataLoaderQueryKeyGenerator {
|
|
6
|
+
constructor(url, queryParams) {
|
|
7
|
+
this.url = url;
|
|
8
|
+
this.queryParams = queryParams;
|
|
9
|
+
if (queryParams) {
|
|
10
|
+
this.key = [url, queryParams];
|
|
11
|
+
}
|
|
12
|
+
else {
|
|
13
|
+
this.key = [url];
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
asKey() {
|
|
17
|
+
if (!this.key) {
|
|
18
|
+
throw new Error("no key defined");
|
|
19
|
+
}
|
|
20
|
+
return this.key;
|
|
21
|
+
}
|
|
22
|
+
asPredicate() {
|
|
23
|
+
if (!this.key) {
|
|
24
|
+
throw new Error("no key defined");
|
|
25
|
+
}
|
|
26
|
+
return {
|
|
27
|
+
predicate: (query) => {
|
|
28
|
+
const queryKey = query.queryKey;
|
|
29
|
+
return queryKey[0] === this.url && (!this.queryParams || (0, lodash_es_1.isEqual)(queryKey[1], this.queryParams));
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
exports.DataLoaderQueryKeyGenerator = DataLoaderQueryKeyGenerator;
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// ====================================================================================================================
|
|
3
|
+
// Types to implement an LRU cache we use to provide stable
|
|
4
|
+
// Implementation source: https://www.nickang.com/2021-11-28-how-to-implement-an-lru-cache-in-javascript/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.LRUCache = void 0;
|
|
7
|
+
/**
|
|
8
|
+
* A single node of the LRU cache
|
|
9
|
+
*/
|
|
10
|
+
class DoublyLinkedNode {
|
|
11
|
+
constructor(value, key) {
|
|
12
|
+
this.value = value;
|
|
13
|
+
this.key = key;
|
|
14
|
+
this.next = undefined;
|
|
15
|
+
this.prev = undefined;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* We keep values in the LRU cache in a doubly linked list
|
|
20
|
+
*/
|
|
21
|
+
class DoublyLinkedList {
|
|
22
|
+
constructor() {
|
|
23
|
+
this.size = 0;
|
|
24
|
+
this.head = undefined;
|
|
25
|
+
this.tail = undefined;
|
|
26
|
+
this.size = 0;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Adds a new node to the head of the list
|
|
30
|
+
* @param node The node to add to head of list
|
|
31
|
+
*/
|
|
32
|
+
unshift(node) {
|
|
33
|
+
// case 1: there is only a root node in the list
|
|
34
|
+
// point node.prev to root node
|
|
35
|
+
// point node.next to undefined
|
|
36
|
+
// point DoublyLinkedList head to node
|
|
37
|
+
// point DoublyLinkedList tail to node
|
|
38
|
+
// increment DoublyLinkedList size by 1
|
|
39
|
+
// case 2: there are data nodes in the list
|
|
40
|
+
// point head node.prev to node
|
|
41
|
+
// point node.next to head node
|
|
42
|
+
// point node.prev to root node
|
|
43
|
+
// point DoublyLinkedList head to node
|
|
44
|
+
// increment DoublyLinkedList size by 1
|
|
45
|
+
if (this.size === 0) {
|
|
46
|
+
// case 1
|
|
47
|
+
this.head = node;
|
|
48
|
+
this.tail = node;
|
|
49
|
+
this.size++;
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
52
|
+
// case 2
|
|
53
|
+
this.head.prev = node;
|
|
54
|
+
node.next = this.head;
|
|
55
|
+
node.prev = undefined;
|
|
56
|
+
this.head = node;
|
|
57
|
+
this.size++;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Remove least recently used node from tail
|
|
62
|
+
*/
|
|
63
|
+
pop() {
|
|
64
|
+
const node = this.tail;
|
|
65
|
+
if (!node) {
|
|
66
|
+
return undefined;
|
|
67
|
+
}
|
|
68
|
+
else if (this.head === this.tail) {
|
|
69
|
+
this.head = undefined;
|
|
70
|
+
this.tail = undefined;
|
|
71
|
+
}
|
|
72
|
+
else {
|
|
73
|
+
this.tail.prev.next = undefined;
|
|
74
|
+
}
|
|
75
|
+
this.tail = node.prev;
|
|
76
|
+
this.size--;
|
|
77
|
+
return node;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Moves the specified node to the head
|
|
81
|
+
*/
|
|
82
|
+
moveToHead(node) {
|
|
83
|
+
if (node === this.head) {
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
if (node === this.head && node === this.tail) {
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
if (node === this.tail) {
|
|
90
|
+
// set tail to tail node.prev
|
|
91
|
+
this.tail = this.tail.prev;
|
|
92
|
+
// set new tail node.next to undefined
|
|
93
|
+
this.tail.next = undefined;
|
|
94
|
+
// set node.next to current head
|
|
95
|
+
node.next = this.head;
|
|
96
|
+
// set current head node.prev to node
|
|
97
|
+
this.head.prev = node;
|
|
98
|
+
// set head to node
|
|
99
|
+
this.head = node;
|
|
100
|
+
// set node.prev to undefined
|
|
101
|
+
node.prev = undefined;
|
|
102
|
+
}
|
|
103
|
+
else {
|
|
104
|
+
// set node.prev.next to node.next
|
|
105
|
+
node.prev.next = node.next;
|
|
106
|
+
// set node.next.prev to node.prev
|
|
107
|
+
node.next.prev = node.prev;
|
|
108
|
+
// set node.next to current head
|
|
109
|
+
node.next = this.head;
|
|
110
|
+
// set current head node.prev to node
|
|
111
|
+
this.head.prev = node;
|
|
112
|
+
// set node as new head
|
|
113
|
+
this.head = node;
|
|
114
|
+
// set node.prev to undefined
|
|
115
|
+
node.prev = undefined;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* This class implements the LRU cache
|
|
121
|
+
*/
|
|
122
|
+
class LRUCache {
|
|
123
|
+
constructor(maxSize) {
|
|
124
|
+
this.maxSize = maxSize;
|
|
125
|
+
this.store = {};
|
|
126
|
+
this.list = new DoublyLinkedList();
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Gets the number of items stored in the cache
|
|
130
|
+
*/
|
|
131
|
+
get length() {
|
|
132
|
+
return this.list.size;
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Gets the value with the specified key
|
|
136
|
+
* @param key
|
|
137
|
+
*/
|
|
138
|
+
get(key) {
|
|
139
|
+
// case 1: node with this key found
|
|
140
|
+
// update position of node to head of DoublyLinkedList
|
|
141
|
+
// return existing node
|
|
142
|
+
// case 2: node with this key not found (i.e. doesn't exist)
|
|
143
|
+
// return undefined
|
|
144
|
+
const existingNode = this.store[key];
|
|
145
|
+
if (existingNode) {
|
|
146
|
+
this.list.moveToHead(existingNode);
|
|
147
|
+
}
|
|
148
|
+
return existingNode === null || existingNode === void 0 ? void 0 : existingNode.value;
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* Sets the value for a particular key within the cache
|
|
152
|
+
* @param key Cache item key
|
|
153
|
+
* @param value Cache item value
|
|
154
|
+
*/
|
|
155
|
+
set(key, value) {
|
|
156
|
+
// case 1: search and found existing node with this key
|
|
157
|
+
// use get() to obtain node
|
|
158
|
+
// if not exist, go to case 2
|
|
159
|
+
// if exist, let get() handle re-ordering in DoublyLinkedList
|
|
160
|
+
// set node to hold new value
|
|
161
|
+
const existingNode = this.get(key);
|
|
162
|
+
if (existingNode) {
|
|
163
|
+
existingNode.value = value;
|
|
164
|
+
}
|
|
165
|
+
// case 2: search and couldn't find existing node with this key
|
|
166
|
+
// create new node
|
|
167
|
+
// insert key-value pair into store
|
|
168
|
+
// insert as new head of DoublyLinkedList
|
|
169
|
+
const newNode = new DoublyLinkedNode(value, key);
|
|
170
|
+
this.store[key] = newNode;
|
|
171
|
+
this.list.unshift(newNode);
|
|
172
|
+
if (this.hasReachedMaxSize()) {
|
|
173
|
+
this.evictLeastRecentlyUsed();
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
hasReachedMaxSize() {
|
|
177
|
+
return this.list.size === this.maxSize + 1;
|
|
178
|
+
}
|
|
179
|
+
evictLeastRecentlyUsed() {
|
|
180
|
+
const evictedNode = this.list.pop();
|
|
181
|
+
delete this.store[evictedNode.key];
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
exports.LRUCache = LRUCache;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.invalidateQueries = invalidateQueries;
|
|
13
|
+
const DataLoaderQueryKeyGenerator_1 = require("@components-core/utils/DataLoaderQueryKeyGenerator");
|
|
14
|
+
const extractParam_1 = require("@components-core/utils/extractParam");
|
|
15
|
+
function invalidateQueries(invalidates, appContext, state) {
|
|
16
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
17
|
+
var _a;
|
|
18
|
+
if (invalidates) {
|
|
19
|
+
let arrayToInvalidate = [invalidates];
|
|
20
|
+
if (Array.isArray(invalidates)) {
|
|
21
|
+
arrayToInvalidate = invalidates;
|
|
22
|
+
}
|
|
23
|
+
arrayToInvalidate.forEach((invalidate) => {
|
|
24
|
+
var _a;
|
|
25
|
+
(_a = appContext.queryClient) === null || _a === void 0 ? void 0 : _a.invalidateQueries(new DataLoaderQueryKeyGenerator_1.DataLoaderQueryKeyGenerator((0, extractParam_1.extractParam)(state, invalidate, appContext)).asPredicate());
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
else {
|
|
29
|
+
yield ((_a = appContext.queryClient) === null || _a === void 0 ? void 0 : _a.invalidateQueries());
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = clsx;
|
|
4
|
+
/**
|
|
5
|
+
* This utility function adds class names from CSS Modules to React components making it more readable to add multiple
|
|
6
|
+
* class styles to a single component.
|
|
7
|
+
* @param input class names that should be concatenated
|
|
8
|
+
* @returns Concatenated string of class names separated by a space
|
|
9
|
+
*/
|
|
10
|
+
function clsx(...input) {
|
|
11
|
+
// filter falsy (null, undefined, "", false) values
|
|
12
|
+
const args = input.filter(Boolean);
|
|
13
|
+
let i = 0, tmp, x = "", str = "";
|
|
14
|
+
while (i < args.length) {
|
|
15
|
+
tmp = args[i++];
|
|
16
|
+
if (tmp) {
|
|
17
|
+
x = toVal(tmp);
|
|
18
|
+
if (x) {
|
|
19
|
+
str && (str += " ");
|
|
20
|
+
str += x;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
return str;
|
|
25
|
+
/**
|
|
26
|
+
* Converts the specified value to its string representation
|
|
27
|
+
* @param mix
|
|
28
|
+
*/
|
|
29
|
+
function toVal(mix) {
|
|
30
|
+
let k, y, str = "";
|
|
31
|
+
if (typeof mix === "string" || typeof mix === "number") {
|
|
32
|
+
str += mix;
|
|
33
|
+
}
|
|
34
|
+
else if (typeof mix === "object") {
|
|
35
|
+
if (Array.isArray(mix)) {
|
|
36
|
+
for (k = 0; k < mix.length; k++) {
|
|
37
|
+
if (mix[k]) {
|
|
38
|
+
y = toVal(mix[k]);
|
|
39
|
+
if (y) {
|
|
40
|
+
str && (str += " ");
|
|
41
|
+
str += y;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
for (k in mix) {
|
|
48
|
+
// @ts-ignore
|
|
49
|
+
if (mix[k]) {
|
|
50
|
+
str && (str += " ");
|
|
51
|
+
str += k;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
return str;
|
|
57
|
+
}
|
|
58
|
+
}
|