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,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.StatementQueue = void 0;
|
|
4
|
+
exports.mapToItem = mapToItem;
|
|
5
|
+
exports.mapStatementsToQueueItems = mapStatementsToQueueItems;
|
|
6
|
+
// --- Implements the statement queue
|
|
7
|
+
class StatementQueue {
|
|
8
|
+
constructor() {
|
|
9
|
+
this.items = [];
|
|
10
|
+
}
|
|
11
|
+
// --- The current queue length
|
|
12
|
+
get length() {
|
|
13
|
+
return this.items.length;
|
|
14
|
+
}
|
|
15
|
+
// --- Get the subsequent item in the queue without dequeuing it
|
|
16
|
+
peek() {
|
|
17
|
+
return this.items[0];
|
|
18
|
+
}
|
|
19
|
+
// --- Remove and return the subsequent item from the queue
|
|
20
|
+
dequeue() {
|
|
21
|
+
return this.items.shift();
|
|
22
|
+
}
|
|
23
|
+
// --- Push the specified items into the queue and return the corresponding queue items
|
|
24
|
+
push(statements) {
|
|
25
|
+
this.items.push(...statements);
|
|
26
|
+
}
|
|
27
|
+
// --- Unshift the specified items into the queue in reverse order (starting from the last action) and
|
|
28
|
+
// --- return the corresponding queue items
|
|
29
|
+
unshift(statements) {
|
|
30
|
+
this.items.unshift(...statements);
|
|
31
|
+
}
|
|
32
|
+
// --- Remove all items starting from the beginning of the queue, while not reaching the item with the
|
|
33
|
+
// --- specified label. If the label is found, that remains in the queue; otherwise the queue is emptied
|
|
34
|
+
clearToLabel(label) {
|
|
35
|
+
while (this.items.length > 0 && this.items[0].label !== label) {
|
|
36
|
+
this.items.shift();
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
exports.StatementQueue = StatementQueue;
|
|
41
|
+
// --- The ID of the last used label
|
|
42
|
+
let nextLabelValue = 1;
|
|
43
|
+
// --- Map a single item to a queue statement list
|
|
44
|
+
function mapToItem(statement) {
|
|
45
|
+
return [
|
|
46
|
+
{
|
|
47
|
+
label: nextLabelValue++,
|
|
48
|
+
statement: Object.assign({}, statement)
|
|
49
|
+
}
|
|
50
|
+
];
|
|
51
|
+
}
|
|
52
|
+
// --- Map a single statement into a queue item
|
|
53
|
+
function mapStatementToQueueItem(statement) {
|
|
54
|
+
return {
|
|
55
|
+
label: nextLabelValue++,
|
|
56
|
+
statement: Object.assign({}, statement)
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
// --- Map a list of statements into queue items
|
|
60
|
+
function mapStatementsToQueueItems(statements) {
|
|
61
|
+
return statements.map(mapStatementToQueueItem);
|
|
62
|
+
}
|
|
@@ -0,0 +1,352 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.collectVariableDependencies = collectVariableDependencies;
|
|
4
|
+
const lodash_es_1 = require("lodash-es");
|
|
5
|
+
const process_statement_common_1 = require("./process-statement-common");
|
|
6
|
+
const eval_tree_common_1 = require("./eval-tree-common");
|
|
7
|
+
/**
|
|
8
|
+
* Collects the name of local context variables the specified program depends on
|
|
9
|
+
* @param program Program to visit
|
|
10
|
+
* @param referenceTrackedApis
|
|
11
|
+
*/
|
|
12
|
+
function collectVariableDependencies(program, referenceTrackedApis = {}) {
|
|
13
|
+
// --- We use these variables to keep track of local variable scopes
|
|
14
|
+
const evalContext = {};
|
|
15
|
+
const thread = (0, process_statement_common_1.ensureMainThread)(evalContext);
|
|
16
|
+
const deps = collectDependencies(program);
|
|
17
|
+
// --- Filter out duplicates
|
|
18
|
+
return deps.filter((item, index) => deps.indexOf(item) === index);
|
|
19
|
+
// --- This is the function we call recursively to collect dependencies
|
|
20
|
+
function collectDependencies(program, parent, tag) {
|
|
21
|
+
var _a;
|
|
22
|
+
if (Array.isArray(program)) {
|
|
23
|
+
// --- Visit statements
|
|
24
|
+
let deps = [];
|
|
25
|
+
program.forEach((stmt) => {
|
|
26
|
+
let stmtDeps = [];
|
|
27
|
+
switch (stmt.type) {
|
|
28
|
+
case "BlockS":
|
|
29
|
+
thread.blocks.push({ vars: {} });
|
|
30
|
+
stmtDeps = collectDependencies(stmt.statements, stmt, "block");
|
|
31
|
+
thread.blocks.pop();
|
|
32
|
+
break;
|
|
33
|
+
case "ExprS":
|
|
34
|
+
stmtDeps = collectDependencies(stmt.expression, stmt, "expression");
|
|
35
|
+
break;
|
|
36
|
+
case "ArrowS":
|
|
37
|
+
thread.blocks.push({ vars: {} });
|
|
38
|
+
stmtDeps = collectDependencies(stmt.expression, stmt, "arrow");
|
|
39
|
+
thread.blocks.pop();
|
|
40
|
+
break;
|
|
41
|
+
case "LetS":
|
|
42
|
+
case "ConstS":
|
|
43
|
+
processDeclarations((0, process_statement_common_1.innermostBlockScope)(thread), stmt.declarations);
|
|
44
|
+
stmt.declarations.forEach((decl) => {
|
|
45
|
+
if (decl.expression) {
|
|
46
|
+
stmtDeps = stmtDeps.concat(collectDependencies(decl.expression, stmt, "letOrConst"));
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
break;
|
|
50
|
+
case "IfS":
|
|
51
|
+
stmtDeps = collectDependencies(stmt.condition, stmt, "if");
|
|
52
|
+
stmtDeps = stmtDeps.concat(collectDependencies([stmt.thenBranch], stmt, "if"));
|
|
53
|
+
if (stmt.elseBranch) {
|
|
54
|
+
stmtDeps = stmtDeps.concat(collectDependencies([stmt.elseBranch], stmt, "if"));
|
|
55
|
+
}
|
|
56
|
+
break;
|
|
57
|
+
case "RetS":
|
|
58
|
+
if (stmt.expression) {
|
|
59
|
+
stmtDeps = collectDependencies(stmt.expression, stmt, "return");
|
|
60
|
+
}
|
|
61
|
+
break;
|
|
62
|
+
case "WhileS":
|
|
63
|
+
stmtDeps = collectDependencies(stmt.condition, stmt, "while");
|
|
64
|
+
stmtDeps = stmtDeps.concat(collectDependencies([stmt.body], stmt, "while"));
|
|
65
|
+
break;
|
|
66
|
+
case "DoWS":
|
|
67
|
+
stmtDeps = collectDependencies(stmt.condition, stmt, "doWhile");
|
|
68
|
+
stmtDeps = stmtDeps.concat(collectDependencies([stmt.body], stmt, "doWhile"));
|
|
69
|
+
break;
|
|
70
|
+
case "ForS":
|
|
71
|
+
thread.blocks.push({ vars: {} });
|
|
72
|
+
if (stmt.init) {
|
|
73
|
+
stmtDeps.concat(collectDependencies([stmt.init], stmt, "for"));
|
|
74
|
+
}
|
|
75
|
+
if (stmt.condition) {
|
|
76
|
+
stmtDeps = stmtDeps.concat(collectDependencies(stmt.condition, stmt, "for"));
|
|
77
|
+
}
|
|
78
|
+
if (stmt.update) {
|
|
79
|
+
stmtDeps = stmtDeps.concat(collectDependencies(stmt.update, stmt, "for"));
|
|
80
|
+
}
|
|
81
|
+
stmtDeps = stmtDeps.concat(collectDependencies([stmt.body], stmt, "for"));
|
|
82
|
+
thread.blocks.pop();
|
|
83
|
+
break;
|
|
84
|
+
case "ForInS":
|
|
85
|
+
thread.blocks.push({ vars: {} });
|
|
86
|
+
if (stmt.varBinding !== "none") {
|
|
87
|
+
const block = (0, process_statement_common_1.innermostBlockScope)(thread);
|
|
88
|
+
block.vars[stmt.id] = true;
|
|
89
|
+
}
|
|
90
|
+
stmtDeps = stmtDeps.concat(collectDependencies(stmt.expression, stmt, "forIn"));
|
|
91
|
+
stmtDeps = stmtDeps.concat(collectDependencies([stmt.body], stmt, "forIn"));
|
|
92
|
+
thread.blocks.pop();
|
|
93
|
+
break;
|
|
94
|
+
case "ForOfS":
|
|
95
|
+
thread.blocks.push({ vars: {} });
|
|
96
|
+
if (stmt.varBinding !== "none") {
|
|
97
|
+
const block = (0, process_statement_common_1.innermostBlockScope)(thread);
|
|
98
|
+
block.vars[stmt.id] = true;
|
|
99
|
+
}
|
|
100
|
+
stmtDeps = stmtDeps.concat(collectDependencies(stmt.expression, stmt, "forOf"));
|
|
101
|
+
stmtDeps = stmtDeps.concat(collectDependencies([stmt.body], stmt, "forOf"));
|
|
102
|
+
thread.blocks.pop();
|
|
103
|
+
break;
|
|
104
|
+
case "ThrowS":
|
|
105
|
+
stmtDeps = collectDependencies(stmt.expression, stmt, "throw");
|
|
106
|
+
break;
|
|
107
|
+
case "TryS":
|
|
108
|
+
stmtDeps = collectDependencies([stmt.tryBlock], stmt, "try");
|
|
109
|
+
if (stmt.catchBlock) {
|
|
110
|
+
thread.blocks.push({ vars: {} });
|
|
111
|
+
if (stmt.catchVariable) {
|
|
112
|
+
const block = (0, process_statement_common_1.innermostBlockScope)(thread);
|
|
113
|
+
block.vars[stmt.catchVariable] = true;
|
|
114
|
+
}
|
|
115
|
+
stmtDeps = stmtDeps.concat(collectDependencies([stmt.catchBlock], stmt, "catchBlock"));
|
|
116
|
+
thread.blocks.pop();
|
|
117
|
+
}
|
|
118
|
+
if (stmt.finallyBlock) {
|
|
119
|
+
stmtDeps = stmtDeps.concat(collectDependencies([stmt.finallyBlock], stmt, "finallyBlock"));
|
|
120
|
+
}
|
|
121
|
+
break;
|
|
122
|
+
case "SwitchS":
|
|
123
|
+
stmtDeps = collectDependencies(stmt.expression, stmt, "switch");
|
|
124
|
+
stmt.cases.forEach((c) => {
|
|
125
|
+
if (c.caseExpression) {
|
|
126
|
+
stmtDeps = stmtDeps.concat(collectDependencies(c.caseExpression, stmt, "switch"));
|
|
127
|
+
}
|
|
128
|
+
if (c.statements) {
|
|
129
|
+
stmtDeps = stmtDeps.concat(collectDependencies(c.statements, stmt, "switch"));
|
|
130
|
+
}
|
|
131
|
+
});
|
|
132
|
+
break;
|
|
133
|
+
}
|
|
134
|
+
deps = deps.concat(stmtDeps);
|
|
135
|
+
});
|
|
136
|
+
return deps;
|
|
137
|
+
}
|
|
138
|
+
else {
|
|
139
|
+
// --- Visit expression
|
|
140
|
+
switch (program.type) {
|
|
141
|
+
case "IdE":
|
|
142
|
+
// --- Any non-block-scoped variable is a dependency to return
|
|
143
|
+
const scope = (0, eval_tree_common_1.getIdentifierScope)(program, evalContext, thread);
|
|
144
|
+
return scope.type !== "block" ? [program.name] : [];
|
|
145
|
+
case "MembE":
|
|
146
|
+
// --- Check for a simple member-access chain. If it exist, add the member to the chain with the "." syntax
|
|
147
|
+
const memberChain = traverseMemberAccessChain(program);
|
|
148
|
+
return memberChain ? [memberChain] : collectDependencies(program.object, program, "memberAccess");
|
|
149
|
+
case "CMembE":
|
|
150
|
+
// --- Check for a simple member-access chain. If it exist, add the member to the chain with the "[]" syntax
|
|
151
|
+
const calcMemberChain = traverseMemberAccessChain(program);
|
|
152
|
+
if (calcMemberChain) {
|
|
153
|
+
return [calcMemberChain];
|
|
154
|
+
}
|
|
155
|
+
let calcDeps = collectDependencies(program.object, program, "calculatedMember");
|
|
156
|
+
return calcDeps.concat(collectDependencies(program.member, program, "calculatedMember"));
|
|
157
|
+
case "SeqE":
|
|
158
|
+
let sequenceDeps = [];
|
|
159
|
+
program.expressions.forEach((expr) => {
|
|
160
|
+
sequenceDeps = sequenceDeps.concat(collectDependencies(expr, program, "sequence"));
|
|
161
|
+
});
|
|
162
|
+
return sequenceDeps;
|
|
163
|
+
case "InvokeE":
|
|
164
|
+
let uncDeps = [];
|
|
165
|
+
(_a = program.arguments) === null || _a === void 0 ? void 0 : _a.forEach((arg) => {
|
|
166
|
+
uncDeps = uncDeps.concat(collectDependencies(arg, program, "functionInvocation"));
|
|
167
|
+
});
|
|
168
|
+
if (program.object.type === "MembE") {
|
|
169
|
+
const caller = program.object;
|
|
170
|
+
if (caller.object.type === "IdE") {
|
|
171
|
+
if (typeof (0, lodash_es_1.get)(referenceTrackedApis, `${caller.object.name}.${caller.member}`) === "function") {
|
|
172
|
+
uncDeps.push(`${caller.object.name}.${caller.member}`);
|
|
173
|
+
}
|
|
174
|
+
else {
|
|
175
|
+
uncDeps.push(`${caller.object.name}`);
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
else if (caller.object.type === "MembE" || caller.object.type === "CMembE") {
|
|
179
|
+
uncDeps = uncDeps.concat(collectDependencies(caller.object, caller, "functionInvocation"));
|
|
180
|
+
}
|
|
181
|
+
else {
|
|
182
|
+
uncDeps = uncDeps.concat(collectDependencies(caller, program, "functionInvocation"));
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
else {
|
|
186
|
+
uncDeps = uncDeps.concat(collectDependencies(program.object, program, "functionInvocation"));
|
|
187
|
+
}
|
|
188
|
+
return uncDeps;
|
|
189
|
+
case "ArrowE":
|
|
190
|
+
// --- Process the current arguments
|
|
191
|
+
thread.blocks.push({ vars: {} });
|
|
192
|
+
const block = (0, process_statement_common_1.innermostBlockScope)(thread);
|
|
193
|
+
const argSpecs = program.args;
|
|
194
|
+
for (let i = 0; i < argSpecs.length; i++) {
|
|
195
|
+
// --- Turn argument specification into processable variable declarations
|
|
196
|
+
const argSpec = argSpecs[i];
|
|
197
|
+
let decl;
|
|
198
|
+
switch (argSpec.type) {
|
|
199
|
+
case "IdE": {
|
|
200
|
+
decl = {
|
|
201
|
+
type: "VarD",
|
|
202
|
+
id: argSpec.name,
|
|
203
|
+
};
|
|
204
|
+
break;
|
|
205
|
+
}
|
|
206
|
+
case "Destr": {
|
|
207
|
+
decl = {
|
|
208
|
+
type: "VarD",
|
|
209
|
+
id: argSpec.id,
|
|
210
|
+
arrayDestruct: argSpec.arrayDestruct,
|
|
211
|
+
objectDestruct: argSpec.objectDestruct,
|
|
212
|
+
};
|
|
213
|
+
break;
|
|
214
|
+
}
|
|
215
|
+
default:
|
|
216
|
+
throw new Error("Unexpected arrow argument specification");
|
|
217
|
+
}
|
|
218
|
+
// --- Process declarations
|
|
219
|
+
processDeclarations(block, [decl]);
|
|
220
|
+
}
|
|
221
|
+
// --- Process the arrow expression's body
|
|
222
|
+
const arrowDeps = collectDependencies([program.statement], program, "arrow");
|
|
223
|
+
// --- Remove the block scope
|
|
224
|
+
thread.blocks.pop();
|
|
225
|
+
// --- Done
|
|
226
|
+
return arrowDeps;
|
|
227
|
+
case "OLitE":
|
|
228
|
+
let objectDeps = [];
|
|
229
|
+
program.props.forEach((prop) => {
|
|
230
|
+
if (Array.isArray(prop)) {
|
|
231
|
+
objectDeps = objectDeps.concat(collectDependencies(prop[1], program, "objectLiteral"));
|
|
232
|
+
}
|
|
233
|
+
else {
|
|
234
|
+
objectDeps = objectDeps.concat(collectDependencies(prop, program, "objectLiteral"));
|
|
235
|
+
}
|
|
236
|
+
});
|
|
237
|
+
return objectDeps;
|
|
238
|
+
case "ALitE":
|
|
239
|
+
let arrayDeps = [];
|
|
240
|
+
program.items.forEach((expr) => {
|
|
241
|
+
if (expr) {
|
|
242
|
+
arrayDeps = arrayDeps.concat(collectDependencies(expr, program, "array"));
|
|
243
|
+
}
|
|
244
|
+
});
|
|
245
|
+
return arrayDeps;
|
|
246
|
+
case "UnaryE":
|
|
247
|
+
return collectDependencies(program.operand, program, "unary");
|
|
248
|
+
case "PrefE":
|
|
249
|
+
return collectDependencies(program.operand, program, "prefix");
|
|
250
|
+
case "PostfE":
|
|
251
|
+
return collectDependencies(program.operand, program, "postfix");
|
|
252
|
+
case "BinaryE":
|
|
253
|
+
return collectDependencies(program.left, program, "left").concat(collectDependencies(program.right, program, "right"));
|
|
254
|
+
case "AsgnE":
|
|
255
|
+
return collectDependencies(program.operand, program, "right");
|
|
256
|
+
case "CondE":
|
|
257
|
+
return collectDependencies(program.condition, program, "condition").concat(collectDependencies(program.consequent, program, "trueExpr"), collectDependencies(program.alternate, program, "falseExpr"));
|
|
258
|
+
case "VarD":
|
|
259
|
+
return collectDependencies(program.expression, program, "varDeclaration");
|
|
260
|
+
case "SpreadE":
|
|
261
|
+
return collectDependencies(program.operand, program, "spread");
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
return [];
|
|
265
|
+
}
|
|
266
|
+
// --- Traverses a member access chain. Returns the chain as a string or null
|
|
267
|
+
// --- if the chain is not simple
|
|
268
|
+
function traverseMemberAccessChain(expr) {
|
|
269
|
+
var _a, _b;
|
|
270
|
+
switch (expr.type) {
|
|
271
|
+
case "MembE":
|
|
272
|
+
const memberChain = traverseMemberAccessChain(expr.object);
|
|
273
|
+
return memberChain ? `${memberChain}.${expr.member}` : null;
|
|
274
|
+
case "CMembE":
|
|
275
|
+
let value = null;
|
|
276
|
+
if (expr.member.type === "LitE") {
|
|
277
|
+
value = `'${(_b = (_a = expr.member.value) === null || _a === void 0 ? void 0 : _a.toString()) !== null && _b !== void 0 ? _b : null}'`;
|
|
278
|
+
}
|
|
279
|
+
else if (expr.member.type === "IdE") {
|
|
280
|
+
value = expr.member.name;
|
|
281
|
+
}
|
|
282
|
+
if (!value)
|
|
283
|
+
break;
|
|
284
|
+
const calcMemberChain = traverseMemberAccessChain(expr.object);
|
|
285
|
+
return calcMemberChain ? `${calcMemberChain}[${value}]` : null;
|
|
286
|
+
case "IdE":
|
|
287
|
+
const scope = (0, eval_tree_common_1.getIdentifierScope)(expr, evalContext, thread);
|
|
288
|
+
return scope.type !== "block" ? expr.name : null;
|
|
289
|
+
}
|
|
290
|
+
return null;
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
// --- Process a variable declaration
|
|
294
|
+
function processDeclarations(block, declarations) {
|
|
295
|
+
for (let i = 0; i < declarations.length; i++) {
|
|
296
|
+
visitDeclaration(block, declarations[i]);
|
|
297
|
+
}
|
|
298
|
+
// --- Visit a variable
|
|
299
|
+
function visitDeclaration(block, decl) {
|
|
300
|
+
// --- Process each declaration
|
|
301
|
+
if (decl.id) {
|
|
302
|
+
visitIdDeclaration(block, decl.id);
|
|
303
|
+
}
|
|
304
|
+
else if (decl.arrayDestruct) {
|
|
305
|
+
visitArrayDestruct(block, decl.arrayDestruct);
|
|
306
|
+
}
|
|
307
|
+
else if (decl.objectDestruct) {
|
|
308
|
+
visitObjectDestruct(block, decl.objectDestruct);
|
|
309
|
+
}
|
|
310
|
+
else {
|
|
311
|
+
throw new Error("Unknown declaration specifier");
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
// --- Visits a single ID declaration
|
|
315
|
+
function visitIdDeclaration(block, id) {
|
|
316
|
+
if (block.vars[id]) {
|
|
317
|
+
throw new Error(`Variable ${id} is already declared in the current scope.`);
|
|
318
|
+
}
|
|
319
|
+
block.vars[id] = true;
|
|
320
|
+
}
|
|
321
|
+
// --- Visits an array destructure declaration
|
|
322
|
+
function visitArrayDestruct(block, arrayD) {
|
|
323
|
+
for (let i = 0; i < arrayD.length; i++) {
|
|
324
|
+
const arrDecl = arrayD[i];
|
|
325
|
+
if (arrDecl.id) {
|
|
326
|
+
visitIdDeclaration(block, arrDecl.id);
|
|
327
|
+
}
|
|
328
|
+
else if (arrDecl.arrayDestruct) {
|
|
329
|
+
visitArrayDestruct(block, arrDecl.arrayDestruct);
|
|
330
|
+
}
|
|
331
|
+
else if (arrDecl.objectDestruct) {
|
|
332
|
+
visitObjectDestruct(block, arrDecl.objectDestruct);
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
// --- Visits an object destructure declaration
|
|
337
|
+
function visitObjectDestruct(block, objectD) {
|
|
338
|
+
var _a;
|
|
339
|
+
for (let i = 0; i < objectD.length; i++) {
|
|
340
|
+
const objDecl = objectD[i];
|
|
341
|
+
if (objDecl.arrayDestruct) {
|
|
342
|
+
visitArrayDestruct(block, objDecl.arrayDestruct);
|
|
343
|
+
}
|
|
344
|
+
else if (objDecl.objectDestruct) {
|
|
345
|
+
visitObjectDestruct(block, objDecl.objectDestruct);
|
|
346
|
+
}
|
|
347
|
+
else {
|
|
348
|
+
visitIdDeclaration(block, (_a = objDecl.alias) !== null && _a !== void 0 ? _a : objDecl.id);
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.ThemesContext = exports.ThemeContext = void 0;
|
|
27
|
+
exports.useTheme = useTheme;
|
|
28
|
+
exports.useThemes = useThemes;
|
|
29
|
+
exports.useResourceUrl = useResourceUrl;
|
|
30
|
+
const react_1 = __importStar(require("react"));
|
|
31
|
+
exports.ThemeContext = react_1.default.createContext(undefined);
|
|
32
|
+
exports.ThemesContext = react_1.default.createContext(undefined);
|
|
33
|
+
// This React hook makes the current theme information available within any component logic using the hook.
|
|
34
|
+
function useTheme() {
|
|
35
|
+
return (0, react_1.useContext)(exports.ThemeContext);
|
|
36
|
+
}
|
|
37
|
+
function useThemes() {
|
|
38
|
+
return (0, react_1.useContext)(exports.ThemesContext);
|
|
39
|
+
}
|
|
40
|
+
function useResourceUrl(resourceString) {
|
|
41
|
+
const { getResourceUrl } = useTheme();
|
|
42
|
+
return getResourceUrl(resourceString);
|
|
43
|
+
}
|