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,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.styleErrorMessages = exports.StyleParserError = void 0;
|
|
4
|
+
// The common root class of all parser error objects
|
|
5
|
+
class StyleParserError extends Error {
|
|
6
|
+
constructor(message, code) {
|
|
7
|
+
super(message);
|
|
8
|
+
this.code = code;
|
|
9
|
+
// --- Set the prototype explicitly.
|
|
10
|
+
Object.setPrototypeOf(this, StyleParserError.prototype);
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
exports.StyleParserError = StyleParserError;
|
|
14
|
+
// The error messages of error codes
|
|
15
|
+
exports.styleErrorMessages = {
|
|
16
|
+
S001: "A numeric value expected",
|
|
17
|
+
S002: "A dimension unit expected",
|
|
18
|
+
S003: "An alignment value expected",
|
|
19
|
+
S004: "A border style value expected",
|
|
20
|
+
S005: "A color value or expression expected",
|
|
21
|
+
S006: "Unknown color function name '{0}'",
|
|
22
|
+
S007: "'(' expected, but '{0}' received",
|
|
23
|
+
S008: "A color channel percentage value expected between 0 and 100",
|
|
24
|
+
S009: "A color channel value expected between 0 and 255",
|
|
25
|
+
S010: "')' expected, but '{0}' received",
|
|
26
|
+
S011: "An alpha channel value expected between 0.0 and 1.0",
|
|
27
|
+
S012: "A scrolling value expected",
|
|
28
|
+
S013: "A direction value expected",
|
|
29
|
+
S014: "A fontFamily value expected",
|
|
30
|
+
S015: "A fontWeight value expected",
|
|
31
|
+
S016: "Unexpected token found",
|
|
32
|
+
S017: "A Boolean value expected",
|
|
33
|
+
S018: "An orientation value expected",
|
|
34
|
+
S019: "']' expected",
|
|
35
|
+
S020: "A user-select value expected",
|
|
36
|
+
S021: "A text transform value expected",
|
|
37
|
+
};
|
|
@@ -0,0 +1,513 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.compileLayout = compileLayout;
|
|
4
|
+
const lodash_es_1 = require("lodash-es");
|
|
5
|
+
const constants_1 = require("@components-core/constants");
|
|
6
|
+
const StyleParser_1 = require("./StyleParser");
|
|
7
|
+
const defaultCompResult = {
|
|
8
|
+
cssProps: {},
|
|
9
|
+
nonCssProps: {},
|
|
10
|
+
};
|
|
11
|
+
// Compile style properties into an object that can be directly used as the "style" attribute of elements
|
|
12
|
+
function compileLayout(layoutProps = constants_1.EMPTY_OBJECT, themeVars, layoutContext) {
|
|
13
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28, _29, _30, _31, _32, _33, _34, _35, _36, _37, _38, _39, _40, _41;
|
|
14
|
+
const result = {
|
|
15
|
+
cssProps: {},
|
|
16
|
+
nonCssProps: {},
|
|
17
|
+
};
|
|
18
|
+
const css = result.cssProps;
|
|
19
|
+
// --- Compile alignment
|
|
20
|
+
const horizontalAlignment = compileAlignment("horizontalAlignment", (_a = layoutProps === null || layoutProps === void 0 ? void 0 : layoutProps.horizontalAlignment) === null || _a === void 0 ? void 0 : _a.toString());
|
|
21
|
+
if (horizontalAlignment) {
|
|
22
|
+
result.nonCssProps.horizontalAlignment = horizontalAlignment;
|
|
23
|
+
}
|
|
24
|
+
const verticalAlignment = compileAlignment("verticalAlignment", (_b = layoutProps === null || layoutProps === void 0 ? void 0 : layoutProps.verticalAlignment) === null || _b === void 0 ? void 0 : _b.toString());
|
|
25
|
+
if (verticalAlignment) {
|
|
26
|
+
result.nonCssProps.verticalAlignment = verticalAlignment;
|
|
27
|
+
}
|
|
28
|
+
const orientation = compileOrientation("orientation", (_c = layoutProps === null || layoutProps === void 0 ? void 0 : layoutProps.orientation) === null || _c === void 0 ? void 0 : _c.toString());
|
|
29
|
+
if (orientation) {
|
|
30
|
+
result.nonCssProps.orientation = orientation;
|
|
31
|
+
}
|
|
32
|
+
// --- Compile dimensions
|
|
33
|
+
if (!!getOrientation(layoutContext)) {
|
|
34
|
+
// --- In a container, we always use "flex-shrink: 0"
|
|
35
|
+
css.flexShrink = 0;
|
|
36
|
+
}
|
|
37
|
+
const widthResult = compileSize("width", (_d = layoutProps.width) === null || _d === void 0 ? void 0 : _d.toString());
|
|
38
|
+
if (widthResult.value)
|
|
39
|
+
css.width = widthResult.value;
|
|
40
|
+
if (isHorizontalAndStartSize(widthResult, layoutContext)) {
|
|
41
|
+
// --- In a horizontal container, we use "flex" when width is in start-size
|
|
42
|
+
css.flex = widthResult.ratio;
|
|
43
|
+
css.flexShrink = 1; //if it's star sizing, we allow shrinking
|
|
44
|
+
}
|
|
45
|
+
const minWidthResult = compileSize("minWidth", (_e = layoutProps.minWidth) === null || _e === void 0 ? void 0 : _e.toString());
|
|
46
|
+
if (minWidthResult.value)
|
|
47
|
+
css.minWidth = minWidthResult.value;
|
|
48
|
+
const maxWidthResult = compileSize("maxWidth", (_f = layoutProps.maxWidth) === null || _f === void 0 ? void 0 : _f.toString());
|
|
49
|
+
if (maxWidthResult.value)
|
|
50
|
+
css.maxWidth = maxWidthResult.value;
|
|
51
|
+
const heightResult = compileSize("height", (_g = layoutProps.height) === null || _g === void 0 ? void 0 : _g.toString());
|
|
52
|
+
if (heightResult.value)
|
|
53
|
+
css.height = heightResult.value;
|
|
54
|
+
if (isVerticalAndStarSize(heightResult, layoutContext)) {
|
|
55
|
+
// --- In a vertical container, we use "flex" when height is in star-size
|
|
56
|
+
css.flex = heightResult.ratio;
|
|
57
|
+
css.flexShrink = 1;
|
|
58
|
+
}
|
|
59
|
+
const minHeightResult = compileSize("minHeight", (_h = layoutProps.minHeight) === null || _h === void 0 ? void 0 : _h.toString());
|
|
60
|
+
if (minHeightResult.value)
|
|
61
|
+
css.minHeight = minHeightResult.value;
|
|
62
|
+
const maxHeightResult = compileSize("maxHeight", (_j = layoutProps.maxHeight) === null || _j === void 0 ? void 0 : _j.toString());
|
|
63
|
+
if (maxHeightResult.value)
|
|
64
|
+
css.maxHeight = maxHeightResult.value;
|
|
65
|
+
// --- Compile positions
|
|
66
|
+
const top = compileSize("top", (_k = layoutProps.top) === null || _k === void 0 ? void 0 : _k.toString());
|
|
67
|
+
if (top.value)
|
|
68
|
+
css.top = top.value;
|
|
69
|
+
const right = compileSize("right", (_l = layoutProps.right) === null || _l === void 0 ? void 0 : _l.toString());
|
|
70
|
+
if (right.value)
|
|
71
|
+
css.right = right.value;
|
|
72
|
+
const bottom = compileSize("bottom", (_m = layoutProps.bottom) === null || _m === void 0 ? void 0 : _m.toString());
|
|
73
|
+
if (bottom.value)
|
|
74
|
+
css.bottom = bottom.value;
|
|
75
|
+
const left = compileSize("left", (_o = layoutProps.left) === null || _o === void 0 ? void 0 : _o.toString());
|
|
76
|
+
if (left.value)
|
|
77
|
+
css.left = left.value;
|
|
78
|
+
// --- Compile gap
|
|
79
|
+
const gap = compileSize("gap", (_p = layoutProps.gap) === null || _p === void 0 ? void 0 : _p.toString());
|
|
80
|
+
if (gap.value)
|
|
81
|
+
css.gap = gap.value;
|
|
82
|
+
// --- Compile border
|
|
83
|
+
const border = compileBorder("border", (_q = layoutProps.border) === null || _q === void 0 ? void 0 : _q.toString());
|
|
84
|
+
if (border)
|
|
85
|
+
css.border = border;
|
|
86
|
+
const borderTop = compileBorder("borderTop", (_r = layoutProps.borderTop) === null || _r === void 0 ? void 0 : _r.toString());
|
|
87
|
+
if (borderTop)
|
|
88
|
+
css.borderTop = borderTop;
|
|
89
|
+
const borderRight = compileBorder("borderRight", (_s = layoutProps.borderRight) === null || _s === void 0 ? void 0 : _s.toString());
|
|
90
|
+
if (borderRight)
|
|
91
|
+
css.borderRight = borderRight;
|
|
92
|
+
const borderBottom = compileBorder("borderBottom", (_t = layoutProps.borderBottom) === null || _t === void 0 ? void 0 : _t.toString());
|
|
93
|
+
if (borderBottom)
|
|
94
|
+
css.borderBottom = borderBottom;
|
|
95
|
+
const borderLeft = compileBorder("borderLeft", (_u = layoutProps.borderLeft) === null || _u === void 0 ? void 0 : _u.toString());
|
|
96
|
+
if (borderLeft)
|
|
97
|
+
css.borderLeft = borderLeft;
|
|
98
|
+
// --- Compile radius
|
|
99
|
+
const radius = compileRadius("radius", (_v = layoutProps.radius) === null || _v === void 0 ? void 0 : _v.toString());
|
|
100
|
+
if (radius)
|
|
101
|
+
css.borderRadius = radius;
|
|
102
|
+
const radiusTopLeft = compileRadius("radiusTopLeft", (_w = layoutProps.radiusTopLeft) === null || _w === void 0 ? void 0 : _w.toString());
|
|
103
|
+
if (radiusTopLeft)
|
|
104
|
+
css.borderTopLeftRadius = radiusTopLeft;
|
|
105
|
+
const radiusTopRight = compileRadius("radiusTopRight", (_x = layoutProps.radiusTopRight) === null || _x === void 0 ? void 0 : _x.toString());
|
|
106
|
+
if (radiusTopRight)
|
|
107
|
+
css.borderTopRightRadius = radiusTopRight;
|
|
108
|
+
const radiusBottomLeft = compileRadius("radiusBottomLeft", (_y = layoutProps.radiusBottomLeft) === null || _y === void 0 ? void 0 : _y.toString());
|
|
109
|
+
if (radiusBottomLeft)
|
|
110
|
+
css.borderBottomLeftRadius = radiusBottomLeft;
|
|
111
|
+
const radiusBottomRight = compileRadius("radiusBottomRight", (_z = layoutProps.radiusBottomRight) === null || _z === void 0 ? void 0 : _z.toString());
|
|
112
|
+
if (radiusBottomRight)
|
|
113
|
+
css.borderBottomRightRadius = radiusBottomRight;
|
|
114
|
+
// --- Compile padding
|
|
115
|
+
const padding = compileSize("padding", (_0 = layoutProps.padding) === null || _0 === void 0 ? void 0 : _0.toString());
|
|
116
|
+
if (padding.value)
|
|
117
|
+
css.padding = padding.value;
|
|
118
|
+
const horizontalPadding = compileSize("horizontalPadding", (_1 = layoutProps.horizontalPadding) === null || _1 === void 0 ? void 0 : _1.toString());
|
|
119
|
+
const verticalPadding = compileSize("verticalPadding", (_2 = layoutProps.verticalPadding) === null || _2 === void 0 ? void 0 : _2.toString());
|
|
120
|
+
const paddingLeft = mergeSizes(compileSize("leftPadding", (_3 = layoutProps.paddingLeft) === null || _3 === void 0 ? void 0 : _3.toString()), horizontalPadding);
|
|
121
|
+
if (paddingLeft.value)
|
|
122
|
+
css.paddingLeft = paddingLeft.value;
|
|
123
|
+
const paddingRight = mergeSizes(compileSize("rightPadding", (_4 = layoutProps.paddingRight) === null || _4 === void 0 ? void 0 : _4.toString()), horizontalPadding);
|
|
124
|
+
if (paddingRight.value)
|
|
125
|
+
css.paddingRight = paddingRight.value;
|
|
126
|
+
const paddingTop = mergeSizes(compileSize("topPadding", (_5 = layoutProps.paddingTop) === null || _5 === void 0 ? void 0 : _5.toString()), verticalPadding);
|
|
127
|
+
if (paddingTop.value)
|
|
128
|
+
css.paddingTop = paddingTop.value;
|
|
129
|
+
const paddingBottom = mergeSizes(compileSize("bottomPadding", (_6 = layoutProps.paddingBottom) === null || _6 === void 0 ? void 0 : _6.toString()), verticalPadding);
|
|
130
|
+
if (paddingBottom.value)
|
|
131
|
+
css.paddingBottom = paddingBottom.value;
|
|
132
|
+
// --- Compile margin
|
|
133
|
+
const margin = compileMargin("margin", (_7 = layoutProps.margin) === null || _7 === void 0 ? void 0 : _7.toString());
|
|
134
|
+
if (margin)
|
|
135
|
+
css.margin = margin;
|
|
136
|
+
const horizontalMargin = compileMargin("horizontalMargin", (_8 = layoutProps.horizontalMargin) === null || _8 === void 0 ? void 0 : _8.toString());
|
|
137
|
+
const verticalMargin = compileMargin("verticalMargin", (_9 = layoutProps.verticalMargin) === null || _9 === void 0 ? void 0 : _9.toString());
|
|
138
|
+
const marginLeft = (_11 = compileMargin("leftMargin", (_10 = layoutProps.marginLeft) === null || _10 === void 0 ? void 0 : _10.toString())) !== null && _11 !== void 0 ? _11 : horizontalMargin;
|
|
139
|
+
if (marginLeft)
|
|
140
|
+
css.marginLeft = marginLeft;
|
|
141
|
+
const marginRight = (_13 = compileMargin("rightMargin", (_12 = layoutProps.marginRight) === null || _12 === void 0 ? void 0 : _12.toString())) !== null && _13 !== void 0 ? _13 : horizontalMargin;
|
|
142
|
+
if (marginRight)
|
|
143
|
+
css.marginRight = marginRight;
|
|
144
|
+
const marginTop = (_15 = compileMargin("topMargin", (_14 = layoutProps.marginTop) === null || _14 === void 0 ? void 0 : _14.toString())) !== null && _15 !== void 0 ? _15 : verticalMargin;
|
|
145
|
+
if (marginTop)
|
|
146
|
+
css.marginTop = marginTop;
|
|
147
|
+
const marginBottom = (_17 = compileMargin("bottomMargin", (_16 = layoutProps.marginBottom) === null || _16 === void 0 ? void 0 : _16.toString())) !== null && _17 !== void 0 ? _17 : verticalMargin;
|
|
148
|
+
if (marginBottom)
|
|
149
|
+
css.marginBottom = marginBottom;
|
|
150
|
+
// --- Compile other
|
|
151
|
+
const backgroundColor = compileColor("backgroundColor", (_18 = layoutProps.backgroundColor) === null || _18 === void 0 ? void 0 : _18.toString());
|
|
152
|
+
if (backgroundColor)
|
|
153
|
+
css.backgroundColor = backgroundColor;
|
|
154
|
+
//TODO illesg
|
|
155
|
+
const background = compileBackground("background", (_19 = layoutProps.background) === null || _19 === void 0 ? void 0 : _19.toString());
|
|
156
|
+
if (background)
|
|
157
|
+
css.background = background;
|
|
158
|
+
const boxShadow = compileShadow("shadow", (_20 = layoutProps.shadow) === null || _20 === void 0 ? void 0 : _20.toString());
|
|
159
|
+
if (boxShadow)
|
|
160
|
+
css.boxShadow = boxShadow;
|
|
161
|
+
const direction = compileDirection("direction", (_21 = layoutProps.direction) === null || _21 === void 0 ? void 0 : _21.toString());
|
|
162
|
+
if (direction)
|
|
163
|
+
css.direction = direction;
|
|
164
|
+
const overflowX = compileScrolling("horizontalOverflow", (_22 = layoutProps.horizontalOverflow) === null || _22 === void 0 ? void 0 : _22.toString());
|
|
165
|
+
if (overflowX)
|
|
166
|
+
css.overflowX = overflowX;
|
|
167
|
+
const overflowY = compileScrolling("verticalOverflow", (_23 = layoutProps.verticalOverflow) === null || _23 === void 0 ? void 0 : _23.toString());
|
|
168
|
+
if (overflowY)
|
|
169
|
+
css.overflowY = overflowY;
|
|
170
|
+
const zIndex = compileZIndex("zIndex", (_24 = layoutProps.zIndex) === null || _24 === void 0 ? void 0 : _24.toString());
|
|
171
|
+
if (zIndex)
|
|
172
|
+
css.zIndex = zIndex;
|
|
173
|
+
const opacity = compileOpacity("zIndex", (_25 = layoutProps === null || layoutProps === void 0 ? void 0 : layoutProps.opacity) === null || _25 === void 0 ? void 0 : _25.toString());
|
|
174
|
+
if (opacity)
|
|
175
|
+
css.opacity = opacity;
|
|
176
|
+
// --- Compile typography
|
|
177
|
+
const color = compileColor("color", (_26 = layoutProps.color) === null || _26 === void 0 ? void 0 : _26.toString());
|
|
178
|
+
if (color)
|
|
179
|
+
css.color = color;
|
|
180
|
+
const fontFamily = compileFontFamily("fontFamily", (_27 = layoutProps.fontFamily) === null || _27 === void 0 ? void 0 : _27.toString());
|
|
181
|
+
if (fontFamily)
|
|
182
|
+
css.fontFamily = fontFamily;
|
|
183
|
+
const fontSize = compileSize("fontSize", (_28 = layoutProps.fontSize) === null || _28 === void 0 ? void 0 : _28.toString());
|
|
184
|
+
if (fontSize.value)
|
|
185
|
+
css.fontSize = fontSize.value;
|
|
186
|
+
const fontWeight = compileFontWeight("fontWeight", (_29 = layoutProps.fontWeight) === null || _29 === void 0 ? void 0 : _29.toString());
|
|
187
|
+
if (fontWeight)
|
|
188
|
+
css.fontWeight = fontWeight;
|
|
189
|
+
const fontStyle = compileItalic("italic", (_30 = layoutProps.italic) === null || _30 === void 0 ? void 0 : _30.toString());
|
|
190
|
+
if (fontStyle)
|
|
191
|
+
css.fontStyle = fontStyle;
|
|
192
|
+
const textDecoration = compileTextDecoration("textDecoration", (_31 = layoutProps.textDecoration) === null || _31 === void 0 ? void 0 : _31.toString());
|
|
193
|
+
if (textDecoration)
|
|
194
|
+
css.textDecoration = textDecoration;
|
|
195
|
+
const userSelect = compileUserSelect("userSelect", (_32 = layoutProps === null || layoutProps === void 0 ? void 0 : layoutProps.userSelect) === null || _32 === void 0 ? void 0 : _32.toString());
|
|
196
|
+
if (userSelect)
|
|
197
|
+
css.userSelect = userSelect;
|
|
198
|
+
const letterSpacing = compileSize("letterSpacing", (_33 = layoutProps === null || layoutProps === void 0 ? void 0 : layoutProps.letterSpacing) === null || _33 === void 0 ? void 0 : _33.toString());
|
|
199
|
+
if (letterSpacing.value)
|
|
200
|
+
css.letterSpacing = letterSpacing.value;
|
|
201
|
+
const textTransform = compileTextTransform("textTransform", (_34 = layoutProps === null || layoutProps === void 0 ? void 0 : layoutProps.textTransform) === null || _34 === void 0 ? void 0 : _34.toString());
|
|
202
|
+
if (textTransform)
|
|
203
|
+
css.textTransform = textTransform;
|
|
204
|
+
const lineHeight = compileLineHeight("lineHeight", (_35 = layoutProps === null || layoutProps === void 0 ? void 0 : layoutProps.lineHeight) === null || _35 === void 0 ? void 0 : _35.toString());
|
|
205
|
+
if (lineHeight)
|
|
206
|
+
css.lineHeight = lineHeight;
|
|
207
|
+
const textAlign = compileTextAlign("textAlign", (_36 = layoutProps === null || layoutProps === void 0 ? void 0 : layoutProps.textAlign) === null || _36 === void 0 ? void 0 : _36.toString());
|
|
208
|
+
if (textAlign)
|
|
209
|
+
css.textAlign = textAlign;
|
|
210
|
+
const textAlignLast = compileTextAlign("textAlignLast", (_37 = layoutProps === null || layoutProps === void 0 ? void 0 : layoutProps.textAlignLast) === null || _37 === void 0 ? void 0 : _37.toString());
|
|
211
|
+
if (textAlignLast)
|
|
212
|
+
css.textAlignLast = textAlignLast;
|
|
213
|
+
//TODO illesg
|
|
214
|
+
const textWrap = (_38 = layoutProps === null || layoutProps === void 0 ? void 0 : layoutProps.textWrap) === null || _38 === void 0 ? void 0 : _38.toString();
|
|
215
|
+
if (textWrap)
|
|
216
|
+
css.textWrap = textWrap;
|
|
217
|
+
// --- Compile content rendering
|
|
218
|
+
const wrapContent = compileWrapContent("wrapContent", (_39 = layoutProps === null || layoutProps === void 0 ? void 0 : layoutProps.wrapContent) === null || _39 === void 0 ? void 0 : _39.toString());
|
|
219
|
+
if (wrapContent)
|
|
220
|
+
css.flexWrap = wrapContent;
|
|
221
|
+
const canShrink = compileCanShrink("canShrink", (_40 = layoutProps === null || layoutProps === void 0 ? void 0 : layoutProps.canShrink) === null || _40 === void 0 ? void 0 : _40.toString());
|
|
222
|
+
if (canShrink)
|
|
223
|
+
css.flexShrink = canShrink;
|
|
224
|
+
// --- Other
|
|
225
|
+
const cursor = compileCursor("cursor", (_41 = layoutProps === null || layoutProps === void 0 ? void 0 : layoutProps.cursor) === null || _41 === void 0 ? void 0 : _41.toString());
|
|
226
|
+
if (cursor)
|
|
227
|
+
css.cursor = cursor;
|
|
228
|
+
// --- Done
|
|
229
|
+
//if we didn't set any props, return a referentially stable result
|
|
230
|
+
if ((0, lodash_es_1.isEmpty)(result.cssProps) && (0, lodash_es_1.isEmpty)(result.nonCssProps) && (0, lodash_es_1.isEmpty)(result.issues)) {
|
|
231
|
+
return defaultCompResult;
|
|
232
|
+
}
|
|
233
|
+
return result;
|
|
234
|
+
function mergeSizes(size, defSize) {
|
|
235
|
+
return size.value ? size : defSize;
|
|
236
|
+
}
|
|
237
|
+
function getThemeVar(themeVar) {
|
|
238
|
+
return themeVars === null || themeVars === void 0 ? void 0 : themeVars[themeVar.id.substring(1)];
|
|
239
|
+
}
|
|
240
|
+
function isCssVarResolved(themeVar) {
|
|
241
|
+
const varValue = getThemeVar(themeVar);
|
|
242
|
+
if (varValue === undefined || varValue === "") {
|
|
243
|
+
return false;
|
|
244
|
+
}
|
|
245
|
+
return true;
|
|
246
|
+
}
|
|
247
|
+
function compile(propName, source, parseFn, convertFn) {
|
|
248
|
+
var _a, _b;
|
|
249
|
+
if (!source)
|
|
250
|
+
return undefined;
|
|
251
|
+
const parser = new StyleParser_1.StyleParser(source);
|
|
252
|
+
try {
|
|
253
|
+
const node = parseFn(parser);
|
|
254
|
+
if (!node)
|
|
255
|
+
return source;
|
|
256
|
+
if (!parser.testCompleted()) {
|
|
257
|
+
(_a = result.issues) !== null && _a !== void 0 ? _a : (result.issues = {});
|
|
258
|
+
result.issues[propName] = `Unexpected tail after the ${propName}`;
|
|
259
|
+
return source;
|
|
260
|
+
}
|
|
261
|
+
//TODO illesg
|
|
262
|
+
// if (hasOnlyUnresolvedVars(node.themeId)) {
|
|
263
|
+
// return undefined;
|
|
264
|
+
// }
|
|
265
|
+
if (node.themeId) {
|
|
266
|
+
return (0, StyleParser_1.toCssVar)(node.themeId);
|
|
267
|
+
}
|
|
268
|
+
return convertFn(node);
|
|
269
|
+
}
|
|
270
|
+
catch (err) {
|
|
271
|
+
(_b = result.issues) !== null && _b !== void 0 ? _b : (result.issues = {});
|
|
272
|
+
result.issues[propName] = err === null || err === void 0 ? void 0 : err.toString();
|
|
273
|
+
//TODO illesg
|
|
274
|
+
return source;
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
// --- Compiles an alignment definition into a CSS size property
|
|
278
|
+
function compileAlignment(propName, source) {
|
|
279
|
+
return compile(propName, source, (p) => p.parseAlignment(), (n) => n.value);
|
|
280
|
+
}
|
|
281
|
+
// --- Compiles an alignment definition into a CSS size property
|
|
282
|
+
function compileTextAlign(propName, source) {
|
|
283
|
+
return compile(propName, source, (p) => p.parseTextAlign(), (n) => n.value);
|
|
284
|
+
}
|
|
285
|
+
// --- Compiles a user select definition into a CSS size property
|
|
286
|
+
function compileUserSelect(propName, source) {
|
|
287
|
+
return compile(propName, source, (p) => p.parseUserSelect(), (n) => n.value);
|
|
288
|
+
}
|
|
289
|
+
// --- Compiles a text transform definition into a CSS size property
|
|
290
|
+
function compileTextTransform(propName, source) {
|
|
291
|
+
return compile(propName, source, (p) => p.parseTextTransform(), (n) => n.value);
|
|
292
|
+
}
|
|
293
|
+
function compileOrientation(propName, source) {
|
|
294
|
+
return compile(propName, source, (p) => p.parseOrientation(), (n) => n.value);
|
|
295
|
+
}
|
|
296
|
+
// --- Compiles a size definition into a CSS size property
|
|
297
|
+
function compileLineHeight(propName, source) {
|
|
298
|
+
return compile(propName, source, (p) => p.parseLineHeight(), (n) => `${n.value}${n.unit}`);
|
|
299
|
+
}
|
|
300
|
+
// --- Compiles a size definition into a CSS size property
|
|
301
|
+
function compileOpacity(propName, source) {
|
|
302
|
+
return compile(propName, source, (p) => p.parseOpacity(), (n) => `${n.value}${n.unit}`);
|
|
303
|
+
}
|
|
304
|
+
// --- Compiles a size definition into a CSS size property
|
|
305
|
+
function compileSize(propName, source) {
|
|
306
|
+
let isStarSize = false;
|
|
307
|
+
let ratio;
|
|
308
|
+
let value = compile(propName, source, (p) => {
|
|
309
|
+
var _a;
|
|
310
|
+
const sizeNode = p.parseSize();
|
|
311
|
+
isStarSize = (sizeNode === null || sizeNode === void 0 ? void 0 : sizeNode.unit) === "*";
|
|
312
|
+
if (isStarSize) {
|
|
313
|
+
ratio = (_a = sizeNode === null || sizeNode === void 0 ? void 0 : sizeNode.value) !== null && _a !== void 0 ? _a : 1;
|
|
314
|
+
}
|
|
315
|
+
return sizeNode;
|
|
316
|
+
}, (n) => { var _a; return (_a = n.extSize) !== null && _a !== void 0 ? _a : `${n.value}${n.unit}`; });
|
|
317
|
+
return {
|
|
318
|
+
value: value ? replaceThemeVar(value) : undefined,
|
|
319
|
+
ratio,
|
|
320
|
+
isStarSize,
|
|
321
|
+
};
|
|
322
|
+
}
|
|
323
|
+
// --- Compiles a size definition into a CSS size property
|
|
324
|
+
function compileMargin(propName, source) {
|
|
325
|
+
return compile(propName, source, (p) => p.parseMargin(), (n) => { var _a; return (_a = n.extSize) !== null && _a !== void 0 ? _a : `${n.value}${n.unit}`; });
|
|
326
|
+
}
|
|
327
|
+
// --- Compiles a zIndex definition into a CSS zIndex property
|
|
328
|
+
function compileZIndex(propName, source) {
|
|
329
|
+
return compile(propName, source, (p) => p.parseZIndex(), (n) => n.value.toString());
|
|
330
|
+
}
|
|
331
|
+
function compileScrolling(propName, source) {
|
|
332
|
+
return compile(propName, source, (p) => p.parseScrolling(), (n) => n.value);
|
|
333
|
+
}
|
|
334
|
+
function compileDirection(propName, source) {
|
|
335
|
+
return compile(propName, source, (p) => p.parseDirection(), (n) => n.value);
|
|
336
|
+
}
|
|
337
|
+
function compileCursor(propName, source) {
|
|
338
|
+
return compile(propName, source, (p) => p.parseCursor(), (n) => n.value);
|
|
339
|
+
}
|
|
340
|
+
function compileFontWeight(propName, source) {
|
|
341
|
+
return compile(propName, source, (p) => p.parseFontWeight(), (n) => { var _a; return (_a = n.value) === null || _a === void 0 ? void 0 : _a.toString(); });
|
|
342
|
+
}
|
|
343
|
+
function compileFontFamily(propName, source) {
|
|
344
|
+
return compile(propName, source, (p) => p.parseFontFamily(), (n) => n.value);
|
|
345
|
+
}
|
|
346
|
+
function compileColor(propName, source) {
|
|
347
|
+
return compile(propName, source, (p) => p.parseColor(), (n) => n.value !== undefined
|
|
348
|
+
? typeof n.value === "number"
|
|
349
|
+
? `#${n.value.toString(16).padStart(8, "0")}`
|
|
350
|
+
: n.value
|
|
351
|
+
: undefined);
|
|
352
|
+
}
|
|
353
|
+
function compileBackground(propName, source) {
|
|
354
|
+
return compile(propName, source, (p) => p.parseColor(), (n) => n.value !== undefined
|
|
355
|
+
? typeof n.value === "number"
|
|
356
|
+
? `#${n.value.toString(16).padStart(8, "0")}`
|
|
357
|
+
: n.value
|
|
358
|
+
: undefined);
|
|
359
|
+
}
|
|
360
|
+
function hasOnlyUnresolvedVars(...themeIds) {
|
|
361
|
+
let definedThemeIds = themeIds.filter((id) => id !== undefined);
|
|
362
|
+
if (!definedThemeIds.length) {
|
|
363
|
+
return false;
|
|
364
|
+
}
|
|
365
|
+
for (let i = 0; i < definedThemeIds.length; i++) {
|
|
366
|
+
const themeId = definedThemeIds[i];
|
|
367
|
+
if (isCssVarResolved(themeId)) {
|
|
368
|
+
return false;
|
|
369
|
+
}
|
|
370
|
+
if (themeId.defaultValue) {
|
|
371
|
+
const hasStringDefaultValue = themeId.defaultValue.find((value) => typeof value === "string") !== undefined;
|
|
372
|
+
if (hasStringDefaultValue) {
|
|
373
|
+
return false;
|
|
374
|
+
}
|
|
375
|
+
const themeVarDefaultValues = themeId.defaultValue.filter((value) => typeof value !== "string");
|
|
376
|
+
if (!hasOnlyUnresolvedVars(...themeVarDefaultValues)) {
|
|
377
|
+
return false;
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
return true;
|
|
382
|
+
}
|
|
383
|
+
function compileBorder(propName, source) {
|
|
384
|
+
return compile(propName, source, (p) => p.parseBorder(), (n) => {
|
|
385
|
+
var _a, _b, _c;
|
|
386
|
+
if (hasOnlyUnresolvedVars(n.themeId1, n.themeId2, n.themeId3)) {
|
|
387
|
+
return undefined;
|
|
388
|
+
}
|
|
389
|
+
return ((`${n.themeId1 ? (0, StyleParser_1.toCssVar)(n.themeId1) : ""} ` +
|
|
390
|
+
`${n.themeId2 ? (0, StyleParser_1.toCssVar)(n.themeId2) : ""} ` +
|
|
391
|
+
`${n.themeId3 ? (0, StyleParser_1.toCssVar)(n.themeId3) : ""}`).trim() +
|
|
392
|
+
" " +
|
|
393
|
+
`${(_a = n.widthValue) !== null && _a !== void 0 ? _a : ""}${(_b = n.widthUnit) !== null && _b !== void 0 ? _b : ""}` +
|
|
394
|
+
`${n.widthValue && n.styleValue ? " " : ""}` +
|
|
395
|
+
`${(_c = n.styleValue) !== null && _c !== void 0 ? _c : ""}` +
|
|
396
|
+
`${(n.widthValue || n.styleValue) && n.color ? " " : ""}` +
|
|
397
|
+
`${n.color !== undefined
|
|
398
|
+
? typeof n.color === "number"
|
|
399
|
+
? `#${n.color.toString(16).padStart(8, "0")}`
|
|
400
|
+
: n.color
|
|
401
|
+
: ""}`).trim();
|
|
402
|
+
});
|
|
403
|
+
}
|
|
404
|
+
function compileTextDecoration(propName, source) {
|
|
405
|
+
return compile(propName, source, (p) => p.parseTextDecoration(), (n) => {
|
|
406
|
+
var _a, _b, _c;
|
|
407
|
+
if (n.none) {
|
|
408
|
+
return "none";
|
|
409
|
+
}
|
|
410
|
+
if (hasOnlyUnresolvedVars(n.themeId1, n.themeId2, n.themeId3)) {
|
|
411
|
+
return undefined;
|
|
412
|
+
}
|
|
413
|
+
return ((`${n.themeId1 ? (0, StyleParser_1.toCssVar)(n.themeId1) : ""} ` +
|
|
414
|
+
`${n.themeId2 ? (0, StyleParser_1.toCssVar)(n.themeId2) : ""} ` +
|
|
415
|
+
`${n.themeId3 ? (0, StyleParser_1.toCssVar)(n.themeId3) : ""}`).trim() +
|
|
416
|
+
" " +
|
|
417
|
+
`${(_a = n.line) !== null && _a !== void 0 ? _a : ""}` +
|
|
418
|
+
`${n.line && n.style ? " " : ""}` +
|
|
419
|
+
`${(_b = n.style) !== null && _b !== void 0 ? _b : ""}` +
|
|
420
|
+
`${(n.line || n.style) && n.color ? " " : ""}` +
|
|
421
|
+
`${(_c = n.color) !== null && _c !== void 0 ? _c : ""}`).trim();
|
|
422
|
+
});
|
|
423
|
+
}
|
|
424
|
+
function compileRadius(propName, source) {
|
|
425
|
+
return compile(propName, source, (p) => p.parseRadius(), (n) => {
|
|
426
|
+
var _a, _b, _c, _d;
|
|
427
|
+
if (hasOnlyUnresolvedVars(n.themeId1, n.themeId2)) {
|
|
428
|
+
return undefined;
|
|
429
|
+
}
|
|
430
|
+
const theme1 = `${n.themeId1 ? (0, StyleParser_1.toCssVar)(n.themeId1) : ""}`;
|
|
431
|
+
const value1 = `${(_a = n.value1) !== null && _a !== void 0 ? _a : ""}${(_b = n.unit1) !== null && _b !== void 0 ? _b : ""}`;
|
|
432
|
+
const theme2 = `${n.themeId2 ? (0, StyleParser_1.toCssVar)(n.themeId2) : ""}`;
|
|
433
|
+
const value2 = `${(_c = n.value2) !== null && _c !== void 0 ? _c : ""}${(_d = n.unit2) !== null && _d !== void 0 ? _d : ""}`;
|
|
434
|
+
let part = `${theme1}${value1}`;
|
|
435
|
+
let part2 = `${theme2}${value2}`;
|
|
436
|
+
part += part2 ? " / " + part2 : "";
|
|
437
|
+
return part.trim();
|
|
438
|
+
});
|
|
439
|
+
}
|
|
440
|
+
function compileShadow(propName, source) {
|
|
441
|
+
return compile(propName, source, (p) => p.parseShadow(), (n) => {
|
|
442
|
+
var _a;
|
|
443
|
+
let css = "";
|
|
444
|
+
for (const sg of (_a = n.segments) !== null && _a !== void 0 ? _a : []) {
|
|
445
|
+
if (css) {
|
|
446
|
+
css += ", ";
|
|
447
|
+
}
|
|
448
|
+
css += sg.inset ? "inset " : "";
|
|
449
|
+
css += `${sg.offsetXValue}${sg.offsetXUnit} ${sg.offsetYValue}${sg.offsetYUnit}`;
|
|
450
|
+
if (sg.blurRadiusValue !== undefined) {
|
|
451
|
+
css += ` ${sg.blurRadiusValue}${sg.blurRadiusUnit}`;
|
|
452
|
+
}
|
|
453
|
+
if (sg.spreadRadiusValue !== undefined) {
|
|
454
|
+
css += ` ${sg.spreadRadiusValue}${sg.spreadRadiusUnit}`;
|
|
455
|
+
}
|
|
456
|
+
if (sg.color !== undefined) {
|
|
457
|
+
css += ` ${sg.color}`;
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
return css;
|
|
461
|
+
});
|
|
462
|
+
}
|
|
463
|
+
// --- Compiles a Boolean definition into a CSS font-style size property
|
|
464
|
+
function compileItalic(propName, source) {
|
|
465
|
+
return compile(propName, source, (p) => p.parseBoolean(), (n) => (n.value ? "italic" : "normal"));
|
|
466
|
+
}
|
|
467
|
+
// --- Compiles a Boolean definition into a CSS flex-wrap property
|
|
468
|
+
function compileWrapContent(propName, source) {
|
|
469
|
+
return compile(propName, source, (p) => p.parseBoolean(), (n) => (n.value ? "wrap" : "nowrap"));
|
|
470
|
+
}
|
|
471
|
+
// --- Compiles a Boolean definition into a CSS flex-shrink property
|
|
472
|
+
function compileCanShrink(propName, source) {
|
|
473
|
+
return compile(propName, source, (p) => p.parseBoolean(), (n) => (n.value ? "1" : "0"));
|
|
474
|
+
}
|
|
475
|
+
function compileBoolean(propName, defValue, source) {
|
|
476
|
+
const compiledValue = compile(propName, source, (p) => (source ? p.parseBoolean() : null), (n) => (n.value ? "true" : "false"));
|
|
477
|
+
return compiledValue === undefined ? defValue : (compiledValue === null || compiledValue === void 0 ? void 0 : compiledValue.toString()) === "true";
|
|
478
|
+
}
|
|
479
|
+
function isHorizontalAndStartSize(size, layoutContext) {
|
|
480
|
+
if (!size.value)
|
|
481
|
+
return false;
|
|
482
|
+
const orientation = getOrientation(layoutContext);
|
|
483
|
+
return orientation === "horizontal" && size.isStarSize;
|
|
484
|
+
}
|
|
485
|
+
function isVerticalAndStarSize(size, layoutContext) {
|
|
486
|
+
if (!size.value)
|
|
487
|
+
return false;
|
|
488
|
+
const orientation = getOrientation(layoutContext);
|
|
489
|
+
return orientation === "vertical" && size.isStarSize;
|
|
490
|
+
}
|
|
491
|
+
function getOrientation(layoutContext) {
|
|
492
|
+
if (!layoutContext)
|
|
493
|
+
return;
|
|
494
|
+
let orientation = (layoutContext === null || layoutContext === void 0 ? void 0 : layoutContext.type) === "Stack" && (layoutContext === null || layoutContext === void 0 ? void 0 : layoutContext.orientation);
|
|
495
|
+
return orientation === null || orientation === void 0 ? void 0 : orientation.toString();
|
|
496
|
+
}
|
|
497
|
+
function replaceThemeVar(input) {
|
|
498
|
+
const regex = /\$([a-zA-Z0-9_-]+)/gi;
|
|
499
|
+
let matches = input.matchAll(regex);
|
|
500
|
+
// --- We go from 1, because result[1] is the whole stuff
|
|
501
|
+
if (matches) {
|
|
502
|
+
let ret = input;
|
|
503
|
+
for (let match of matches) {
|
|
504
|
+
const varName = match[0];
|
|
505
|
+
if (varName) {
|
|
506
|
+
ret = ret.replace(match[0], (0, StyleParser_1.toCssVar)(varName));
|
|
507
|
+
}
|
|
508
|
+
}
|
|
509
|
+
return ret;
|
|
510
|
+
}
|
|
511
|
+
return input;
|
|
512
|
+
}
|
|
513
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.StyleTokenType = void 0;
|
|
4
|
+
// Token types used in layout parsing
|
|
5
|
+
var StyleTokenType;
|
|
6
|
+
(function (StyleTokenType) {
|
|
7
|
+
StyleTokenType[StyleTokenType["Eof"] = -1] = "Eof";
|
|
8
|
+
StyleTokenType[StyleTokenType["Ws"] = -2] = "Ws";
|
|
9
|
+
StyleTokenType[StyleTokenType["Unknown"] = 0] = "Unknown";
|
|
10
|
+
// --- Binding Expression specific tokens
|
|
11
|
+
StyleTokenType[StyleTokenType["Identifier"] = 1] = "Identifier";
|
|
12
|
+
StyleTokenType[StyleTokenType["Star"] = 2] = "Star";
|
|
13
|
+
StyleTokenType[StyleTokenType["Percentage"] = 3] = "Percentage";
|
|
14
|
+
StyleTokenType[StyleTokenType["Number"] = 4] = "Number";
|
|
15
|
+
StyleTokenType[StyleTokenType["LParent"] = 5] = "LParent";
|
|
16
|
+
StyleTokenType[StyleTokenType["RParent"] = 6] = "RParent";
|
|
17
|
+
StyleTokenType[StyleTokenType["Comma"] = 7] = "Comma";
|
|
18
|
+
StyleTokenType[StyleTokenType["Slash"] = 8] = "Slash";
|
|
19
|
+
StyleTokenType[StyleTokenType["None"] = 9] = "None";
|
|
20
|
+
StyleTokenType[StyleTokenType["UserSelect"] = 10] = "UserSelect";
|
|
21
|
+
StyleTokenType[StyleTokenType["SizeUnit"] = 11] = "SizeUnit";
|
|
22
|
+
StyleTokenType[StyleTokenType["FitToContent"] = 12] = "FitToContent";
|
|
23
|
+
StyleTokenType[StyleTokenType["Auto"] = 13] = "Auto";
|
|
24
|
+
StyleTokenType[StyleTokenType["Alignment"] = 14] = "Alignment";
|
|
25
|
+
StyleTokenType[StyleTokenType["TextAlignment"] = 15] = "TextAlignment";
|
|
26
|
+
StyleTokenType[StyleTokenType["BorderStyle"] = 16] = "BorderStyle";
|
|
27
|
+
StyleTokenType[StyleTokenType["Scrolling"] = 17] = "Scrolling";
|
|
28
|
+
StyleTokenType[StyleTokenType["TextTransform"] = 18] = "TextTransform";
|
|
29
|
+
StyleTokenType[StyleTokenType["Direction"] = 19] = "Direction";
|
|
30
|
+
StyleTokenType[StyleTokenType["Angle"] = 20] = "Angle";
|
|
31
|
+
StyleTokenType[StyleTokenType["HexaColor"] = 21] = "HexaColor";
|
|
32
|
+
StyleTokenType[StyleTokenType["ColorFunc"] = 22] = "ColorFunc";
|
|
33
|
+
StyleTokenType[StyleTokenType["FontFamily"] = 23] = "FontFamily";
|
|
34
|
+
StyleTokenType[StyleTokenType["ColorName"] = 24] = "ColorName";
|
|
35
|
+
StyleTokenType[StyleTokenType["FontWeight"] = 25] = "FontWeight";
|
|
36
|
+
StyleTokenType[StyleTokenType["DecorationLine"] = 26] = "DecorationLine";
|
|
37
|
+
StyleTokenType[StyleTokenType["Orientation"] = 27] = "Orientation";
|
|
38
|
+
StyleTokenType[StyleTokenType["Cursor"] = 28] = "Cursor";
|
|
39
|
+
StyleTokenType[StyleTokenType["Default"] = 29] = "Default";
|
|
40
|
+
StyleTokenType[StyleTokenType["Boolean"] = 30] = "Boolean";
|
|
41
|
+
StyleTokenType[StyleTokenType["String"] = 31] = "String";
|
|
42
|
+
})(StyleTokenType || (exports.StyleTokenType = StyleTokenType = {}));
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.errorMessages = exports.ParserError = void 0;
|
|
4
|
+
// The common root class of all parser error objects
|
|
5
|
+
class ParserError extends Error {
|
|
6
|
+
constructor(message, code) {
|
|
7
|
+
super(`${code ? `${code}: ` : ""}${message}`);
|
|
8
|
+
this.code = code;
|
|
9
|
+
// --- Set the prototype explicitly.
|
|
10
|
+
Object.setPrototypeOf(this, ParserError.prototype);
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
exports.ParserError = ParserError;
|
|
14
|
+
// The error messages of error codes
|
|
15
|
+
exports.errorMessages = {
|
|
16
|
+
U001: "Unexpected token: {0}",
|
|
17
|
+
U002: "A component definition can have exactly one UEML element",
|
|
18
|
+
U003: "A '<' token expected",
|
|
19
|
+
U004: "A node identifier expected",
|
|
20
|
+
U005: "A '</' token expected",
|
|
21
|
+
U006: "A '>' or '/>' token expected",
|
|
22
|
+
U007: "An '{0}' ID expected in the closing tag but '{1}' received",
|
|
23
|
+
U008: "A '>' token expected",
|
|
24
|
+
U009: "An attribute identifier expected",
|
|
25
|
+
U010: "An '=' token expected",
|
|
26
|
+
U011: "An attribute value expected",
|
|
27
|
+
U012: "Duplicated attribute: '{0}'",
|
|
28
|
+
U013: "Attribute name cannot start with an uppercase letter",
|
|
29
|
+
U014: "An '{0}' ID expected in the closing tag's namespace but '{1}' received",
|
|
30
|
+
U015: "Unexpected token in text element: {0}",
|
|
31
|
+
T001: "A component definition must have exactly one UEML element",
|
|
32
|
+
T002: "A component definition's name must start with an uppercase letter",
|
|
33
|
+
T003: "A reusable component must have a non-empty name",
|
|
34
|
+
T004: "A reusable component's name must start with an uppercase letter",
|
|
35
|
+
T005: "A reusable component must have at least one nested component definition",
|
|
36
|
+
T006: "A reusable component definition cannot nest another one",
|
|
37
|
+
T007: `Invalid attribute name: '{0}'`,
|
|
38
|
+
T008: `Event attribute names should not start with 'on' prefix: '{0}'`,
|
|
39
|
+
T009: `Invalid node name '{0}' in a component definition`,
|
|
40
|
+
T010: `The '{0}' element does not accept a text child`,
|
|
41
|
+
T011: "Only 'name', 'value', and type hint attributes are accepted in '{0}'",
|
|
42
|
+
T012: "The 'name' attribute in '{0}' is required",
|
|
43
|
+
T013: "A loader element must have an id",
|
|
44
|
+
T014: "A loader element must not have '{0}'",
|
|
45
|
+
T015: "The uses element must define only a non-empty 'value' attribute",
|
|
46
|
+
T016: "Only 'field' or 'item' are accepted as a child element",
|
|
47
|
+
T017: "Cannot mix 'field' and 'item' nodes within an element",
|
|
48
|
+
T018: "The '{0}' node cannot have a 'name' attribute",
|
|
49
|
+
T019: "The 'value' attribute in '{0}' is required",
|
|
50
|
+
T020: "Cannot mix nested components and non-component children",
|
|
51
|
+
T021: "Invalid reusable component attribute '{0}'",
|
|
52
|
+
T022: "The 'script' tag must not have any attribute",
|
|
53
|
+
T023: "A 'script' tag cannot nest other child nodes, only text"
|
|
54
|
+
};
|