This is page 51 of 143. Use http://codebase.md/xmlui-org/xmlui/xmlui/mockApiDef.js?lines=false&page={x} to view the full context.
# Directory Structure
```
├── .changeset
│ ├── config.json
│ └── cyan-tools-design.md
├── .eslintrc.cjs
├── .github
│ ├── build-checklist.png
│ ├── ISSUE_TEMPLATE
│ │ ├── bug_report.md
│ │ └── feature_request.md
│ └── workflows
│ ├── deploy-blog-optimized.yml
│ ├── deploy-blog-swa.yml
│ ├── deploy-blog.yml
│ ├── deploy-docs-optimized.yml
│ ├── deploy-docs-swa.yml
│ ├── deploy-docs.yml
│ ├── prepare-versions.yml
│ ├── release-packages.yml
│ ├── run-all-tests.yml
│ └── run-smoke-tests.yml
├── .gitignore
├── .prettierrc.js
├── .vscode
│ ├── launch.json
│ └── settings.json
├── blog
│ ├── .gitignore
│ ├── .gitkeep
│ ├── CHANGELOG.md
│ ├── extensions.ts
│ ├── index.html
│ ├── index.ts
│ ├── package.json
│ ├── public
│ │ ├── blog
│ │ │ ├── images
│ │ │ │ ├── an-advanced-codefence.gif
│ │ │ │ ├── an-advanced-codefence.mp4
│ │ │ │ ├── blog-page-component.png
│ │ │ │ ├── blog-scrabble.png
│ │ │ │ ├── codefence-runner.png
│ │ │ │ ├── integrated-blog-search.png
│ │ │ │ ├── lorem-ipsum.png
│ │ │ │ ├── playground-checkbox-source.png
│ │ │ │ ├── playground.png
│ │ │ │ ├── use-xmlui-mcp-to-find-a-howto.png
│ │ │ │ └── xmlui-demo-gallery.png
│ │ │ ├── introducing-xmlui.md
│ │ │ ├── lorem-ipsum.md
│ │ │ ├── newest-post.md
│ │ │ ├── older-post.md
│ │ │ ├── xmlui-playground.md
│ │ │ └── xmlui-powered-blog.md
│ │ ├── mockServiceWorker.js
│ │ ├── resources
│ │ │ ├── favicon.ico
│ │ │ ├── files
│ │ │ │ └── for-download
│ │ │ │ └── xmlui
│ │ │ │ └── xmlui-standalone.umd.js
│ │ │ ├── github.svg
│ │ │ ├── llms.txt
│ │ │ ├── logo-dark.svg
│ │ │ ├── logo.svg
│ │ │ ├── pg-popout.svg
│ │ │ ├── rss.svg
│ │ │ └── xmlui-logo.svg
│ │ ├── serve.json
│ │ ├── staticwebapp.config.json
│ │ └── web.config
│ ├── scripts
│ │ ├── download-latest-xmlui.js
│ │ ├── generate-rss.js
│ │ ├── get-releases.js
│ │ └── utils.js
│ ├── src
│ │ ├── components
│ │ │ ├── BlogOverview.xmlui
│ │ │ ├── BlogPage.xmlui
│ │ │ └── PageNotFound.xmlui
│ │ ├── config.ts
│ │ ├── Main.xmlui
│ │ └── themes
│ │ └── blog-theme.ts
│ └── tsconfig.json
├── CONTRIBUTING.md
├── docs
│ ├── .gitignore
│ ├── CHANGELOG.md
│ ├── ComponentRefLinks.txt
│ ├── content
│ │ ├── _meta.json
│ │ ├── components
│ │ │ ├── _meta.json
│ │ │ ├── _overview.md
│ │ │ ├── APICall.md
│ │ │ ├── App.md
│ │ │ ├── AppHeader.md
│ │ │ ├── AppState.md
│ │ │ ├── AutoComplete.md
│ │ │ ├── Avatar.md
│ │ │ ├── Backdrop.md
│ │ │ ├── Badge.md
│ │ │ ├── BarChart.md
│ │ │ ├── Bookmark.md
│ │ │ ├── Breakout.md
│ │ │ ├── Button.md
│ │ │ ├── Card.md
│ │ │ ├── Carousel.md
│ │ │ ├── ChangeListener.md
│ │ │ ├── Checkbox.md
│ │ │ ├── CHStack.md
│ │ │ ├── ColorPicker.md
│ │ │ ├── Column.md
│ │ │ ├── ContentSeparator.md
│ │ │ ├── CVStack.md
│ │ │ ├── DataSource.md
│ │ │ ├── DateInput.md
│ │ │ ├── DatePicker.md
│ │ │ ├── DonutChart.md
│ │ │ ├── DropdownMenu.md
│ │ │ ├── EmojiSelector.md
│ │ │ ├── ExpandableItem.md
│ │ │ ├── FileInput.md
│ │ │ ├── FileUploadDropZone.md
│ │ │ ├── FlowLayout.md
│ │ │ ├── Footer.md
│ │ │ ├── Form.md
│ │ │ ├── FormItem.md
│ │ │ ├── FormSection.md
│ │ │ ├── Fragment.md
│ │ │ ├── H1.md
│ │ │ ├── H2.md
│ │ │ ├── H3.md
│ │ │ ├── H4.md
│ │ │ ├── H5.md
│ │ │ ├── H6.md
│ │ │ ├── Heading.md
│ │ │ ├── HSplitter.md
│ │ │ ├── HStack.md
│ │ │ ├── Icon.md
│ │ │ ├── IFrame.md
│ │ │ ├── Image.md
│ │ │ ├── Items.md
│ │ │ ├── LabelList.md
│ │ │ ├── Legend.md
│ │ │ ├── LineChart.md
│ │ │ ├── Link.md
│ │ │ ├── List.md
│ │ │ ├── Logo.md
│ │ │ ├── Markdown.md
│ │ │ ├── MenuItem.md
│ │ │ ├── MenuSeparator.md
│ │ │ ├── ModalDialog.md
│ │ │ ├── NavGroup.md
│ │ │ ├── NavLink.md
│ │ │ ├── NavPanel.md
│ │ │ ├── NoResult.md
│ │ │ ├── NumberBox.md
│ │ │ ├── Option.md
│ │ │ ├── Page.md
│ │ │ ├── PageMetaTitle.md
│ │ │ ├── Pages.md
│ │ │ ├── Pagination.md
│ │ │ ├── PasswordInput.md
│ │ │ ├── PieChart.md
│ │ │ ├── ProgressBar.md
│ │ │ ├── Queue.md
│ │ │ ├── RadioGroup.md
│ │ │ ├── RealTimeAdapter.md
│ │ │ ├── Redirect.md
│ │ │ ├── Select.md
│ │ │ ├── Slider.md
│ │ │ ├── Slot.md
│ │ │ ├── SpaceFiller.md
│ │ │ ├── Spinner.md
│ │ │ ├── Splitter.md
│ │ │ ├── Stack.md
│ │ │ ├── StickyBox.md
│ │ │ ├── SubMenuItem.md
│ │ │ ├── Switch.md
│ │ │ ├── TabItem.md
│ │ │ ├── Table.md
│ │ │ ├── TableOfContents.md
│ │ │ ├── Tabs.md
│ │ │ ├── Text.md
│ │ │ ├── TextArea.md
│ │ │ ├── TextBox.md
│ │ │ ├── Theme.md
│ │ │ ├── TimeInput.md
│ │ │ ├── Timer.md
│ │ │ ├── ToneChangerButton.md
│ │ │ ├── ToneSwitch.md
│ │ │ ├── Tooltip.md
│ │ │ ├── Tree.md
│ │ │ ├── VSplitter.md
│ │ │ ├── VStack.md
│ │ │ ├── xmlui-animations
│ │ │ │ ├── _meta.json
│ │ │ │ ├── _overview.md
│ │ │ │ ├── Animation.md
│ │ │ │ ├── FadeAnimation.md
│ │ │ │ ├── FadeInAnimation.md
│ │ │ │ ├── FadeOutAnimation.md
│ │ │ │ ├── ScaleAnimation.md
│ │ │ │ └── SlideInAnimation.md
│ │ │ ├── xmlui-pdf
│ │ │ │ ├── _meta.json
│ │ │ │ ├── _overview.md
│ │ │ │ └── Pdf.md
│ │ │ ├── xmlui-spreadsheet
│ │ │ │ ├── _meta.json
│ │ │ │ ├── _overview.md
│ │ │ │ └── Spreadsheet.md
│ │ │ └── xmlui-website-blocks
│ │ │ ├── _meta.json
│ │ │ ├── _overview.md
│ │ │ ├── Carousel.md
│ │ │ ├── HelloMd.md
│ │ │ ├── HeroSection.md
│ │ │ └── ScrollToTop.md
│ │ └── extensions
│ │ ├── _meta.json
│ │ ├── xmlui-animations
│ │ │ ├── _meta.json
│ │ │ ├── _overview.md
│ │ │ ├── Animation.md
│ │ │ ├── FadeAnimation.md
│ │ │ ├── FadeInAnimation.md
│ │ │ ├── FadeOutAnimation.md
│ │ │ ├── ScaleAnimation.md
│ │ │ └── SlideInAnimation.md
│ │ └── xmlui-website-blocks
│ │ ├── _meta.json
│ │ ├── _overview.md
│ │ ├── Carousel.md
│ │ ├── FancyButton.md
│ │ ├── HeroSection.md
│ │ └── ScrollToTop.md
│ ├── extensions.ts
│ ├── index.html
│ ├── index.ts
│ ├── package.json
│ ├── public
│ │ ├── feed.rss
│ │ ├── mockServiceWorker.js
│ │ ├── pages
│ │ │ ├── _meta.json
│ │ │ ├── app-structure.md
│ │ │ ├── build-editor-component.md
│ │ │ ├── build-hello-world-component.md
│ │ │ ├── components-intro.md
│ │ │ ├── context-variables.md
│ │ │ ├── forms.md
│ │ │ ├── globals.md
│ │ │ ├── glossary.md
│ │ │ ├── helper-tags.md
│ │ │ ├── hosted-deployment.md
│ │ │ ├── howto
│ │ │ │ ├── assign-a-complex-json-literal-to-a-component-variable.md
│ │ │ │ ├── chain-a-refetch.md
│ │ │ │ ├── control-cache-invalidation.md
│ │ │ │ ├── debounce-user-input-for-api-calls.md
│ │ │ │ ├── debounce-with-changelistener.md
│ │ │ │ ├── debug-a-component.md
│ │ │ │ ├── delay-a-datasource-until-another-datasource-is-ready.md
│ │ │ │ ├── delegate-a-method.md
│ │ │ │ ├── do-custom-form-validation.md
│ │ │ │ ├── expose-a-method-from-a-component.md
│ │ │ │ ├── filter-and-transform-data-from-an-api.md
│ │ │ │ ├── group-items-in-list-by-a-property.md
│ │ │ │ ├── handle-background-operations.md
│ │ │ │ ├── hide-an-element-until-its-datasource-is-ready.md
│ │ │ │ ├── make-a-set-of-equal-width-cards.md
│ │ │ │ ├── make-a-table-responsive.md
│ │ │ │ ├── make-navpanel-width-responsive.md
│ │ │ │ ├── modify-a-value-reported-in-a-column.md
│ │ │ │ ├── paginate-a-list.md
│ │ │ │ ├── pass-data-to-a-modal-dialog.md
│ │ │ │ ├── react-to-button-click-not-keystrokes.md
│ │ │ │ ├── set-the-initial-value-of-a-select-from-fetched-data.md
│ │ │ │ ├── share-a-modaldialog-across-components.md
│ │ │ │ ├── sync-selections-between-table-and-list-views.md
│ │ │ │ ├── update-ui-optimistically.md
│ │ │ │ ├── use-built-in-form-validation.md
│ │ │ │ └── use-the-same-modaldialog-to-add-or-edit.md
│ │ │ ├── howto.md
│ │ │ ├── intro.md
│ │ │ ├── layout.md
│ │ │ ├── markup.md
│ │ │ ├── mcp.md
│ │ │ ├── modal-dialogs.md
│ │ │ ├── news-and-reviews.md
│ │ │ ├── reactive-intro.md
│ │ │ ├── refactoring.md
│ │ │ ├── routing-and-links.md
│ │ │ ├── samples
│ │ │ │ ├── color-palette.xmlui
│ │ │ │ ├── color-values.xmlui
│ │ │ │ ├── shadow-sizes.xmlui
│ │ │ │ ├── spacing-sizes.xmlui
│ │ │ │ ├── swatch.xmlui
│ │ │ │ ├── theme-gallery-brief.xmlui
│ │ │ │ └── theme-gallery.xmlui
│ │ │ ├── scoping.md
│ │ │ ├── scripting.md
│ │ │ ├── styles-and-themes
│ │ │ │ ├── common-units.md
│ │ │ │ ├── layout-props.md
│ │ │ │ ├── theme-variable-defaults.md
│ │ │ │ ├── theme-variables.md
│ │ │ │ └── themes.md
│ │ │ ├── template-properties.md
│ │ │ ├── test.md
│ │ │ ├── tutorial-01.md
│ │ │ ├── tutorial-02.md
│ │ │ ├── tutorial-03.md
│ │ │ ├── tutorial-04.md
│ │ │ ├── tutorial-05.md
│ │ │ ├── tutorial-06.md
│ │ │ ├── tutorial-07.md
│ │ │ ├── tutorial-08.md
│ │ │ ├── tutorial-09.md
│ │ │ ├── tutorial-10.md
│ │ │ ├── tutorial-11.md
│ │ │ ├── tutorial-12.md
│ │ │ ├── universal-properties.md
│ │ │ ├── user-defined-components.md
│ │ │ ├── vscode.md
│ │ │ ├── working-with-markdown.md
│ │ │ ├── working-with-text.md
│ │ │ ├── xmlui-animations
│ │ │ │ ├── _meta.json
│ │ │ │ ├── _overview.md
│ │ │ │ ├── Animation.md
│ │ │ │ ├── FadeAnimation.md
│ │ │ │ ├── FadeInAnimation.md
│ │ │ │ ├── FadeOutAnimation.md
│ │ │ │ ├── ScaleAnimation.md
│ │ │ │ └── SlideInAnimation.md
│ │ │ ├── xmlui-charts
│ │ │ │ ├── _meta.json
│ │ │ │ ├── _overview.md
│ │ │ │ ├── BarChart.md
│ │ │ │ ├── DonutChart.md
│ │ │ │ ├── LabelList.md
│ │ │ │ ├── Legend.md
│ │ │ │ ├── LineChart.md
│ │ │ │ └── PieChart.md
│ │ │ ├── xmlui-pdf
│ │ │ │ ├── _meta.json
│ │ │ │ ├── _overview.md
│ │ │ │ └── Pdf.md
│ │ │ └── xmlui-spreadsheet
│ │ │ ├── _meta.json
│ │ │ ├── _overview.md
│ │ │ └── Spreadsheet.md
│ │ ├── resources
│ │ │ ├── devdocs
│ │ │ │ ├── debug-proxy-object-2.png
│ │ │ │ ├── debug-proxy-object.png
│ │ │ │ ├── table_editor_01.png
│ │ │ │ ├── table_editor_02.png
│ │ │ │ ├── table_editor_03.png
│ │ │ │ ├── table_editor_04.png
│ │ │ │ ├── table_editor_05.png
│ │ │ │ ├── table_editor_06.png
│ │ │ │ ├── table_editor_07.png
│ │ │ │ ├── table_editor_08.png
│ │ │ │ ├── table_editor_09.png
│ │ │ │ ├── table_editor_10.png
│ │ │ │ ├── table_editor_11.png
│ │ │ │ ├── table-editor-01.png
│ │ │ │ ├── table-editor-02.png
│ │ │ │ ├── table-editor-03.png
│ │ │ │ ├── table-editor-04.png
│ │ │ │ ├── table-editor-06.png
│ │ │ │ ├── table-editor-07.png
│ │ │ │ ├── table-editor-08.png
│ │ │ │ ├── table-editor-09.png
│ │ │ │ └── xmlui-rendering-of-tiptap-markdown.png
│ │ │ ├── favicon.ico
│ │ │ ├── files
│ │ │ │ ├── clients.json
│ │ │ │ ├── daily-revenue.json
│ │ │ │ ├── dashboard-stats.json
│ │ │ │ ├── demo.xmlui
│ │ │ │ ├── demo.xmlui.xs
│ │ │ │ ├── downloads
│ │ │ │ │ └── downloads.json
│ │ │ │ ├── for-download
│ │ │ │ │ ├── index-with-api.html
│ │ │ │ │ ├── index.html
│ │ │ │ │ ├── mockApi.js
│ │ │ │ │ ├── start-darwin.sh
│ │ │ │ │ ├── start-linux.sh
│ │ │ │ │ ├── start.bat
│ │ │ │ │ └── xmlui
│ │ │ │ │ └── xmlui-standalone.umd.js
│ │ │ │ ├── getting-started
│ │ │ │ │ ├── cl-tutorial-final.zip
│ │ │ │ │ ├── cl-tutorial.zip
│ │ │ │ │ ├── cl-tutorial2.zip
│ │ │ │ │ ├── cl-tutorial3.zip
│ │ │ │ │ ├── cl-tutorial4.zip
│ │ │ │ │ ├── cl-tutorial5.zip
│ │ │ │ │ ├── cl-tutorial6.zip
│ │ │ │ │ ├── getting-started.zip
│ │ │ │ │ ├── hello-xmlui.zip
│ │ │ │ │ ├── xmlui-empty.zip
│ │ │ │ │ └── xmlui-starter.zip
│ │ │ │ ├── howto
│ │ │ │ │ └── component-icons
│ │ │ │ │ └── up-arrow.svg
│ │ │ │ ├── invoices.json
│ │ │ │ ├── monthly-status.json
│ │ │ │ ├── news-and-reviews.json
│ │ │ │ ├── products.json
│ │ │ │ ├── releases.json
│ │ │ │ ├── tutorials
│ │ │ │ │ ├── datasource
│ │ │ │ │ │ └── api.ts
│ │ │ │ │ └── p2do
│ │ │ │ │ ├── api.ts
│ │ │ │ │ └── todo-logo.svg
│ │ │ │ └── xmlui.json
│ │ │ ├── github.svg
│ │ │ ├── images
│ │ │ │ ├── apiaction-tutorial
│ │ │ │ │ ├── add-success.png
│ │ │ │ │ ├── apiaction-param.png
│ │ │ │ │ ├── change-completed.png
│ │ │ │ │ ├── change-in-progress.png
│ │ │ │ │ ├── confirm-delete.png
│ │ │ │ │ ├── data-error.png
│ │ │ │ │ ├── data-progress.png
│ │ │ │ │ ├── data-success.png
│ │ │ │ │ ├── display-1.png
│ │ │ │ │ ├── item-deleted.png
│ │ │ │ │ ├── item-updated.png
│ │ │ │ │ ├── missing-api-key.png
│ │ │ │ │ ├── new-item-added.png
│ │ │ │ │ └── test-message.png
│ │ │ │ ├── chat-api
│ │ │ │ │ └── domain-model.svg
│ │ │ │ ├── components
│ │ │ │ │ ├── image
│ │ │ │ │ │ └── breakfast.jpg
│ │ │ │ │ ├── markdown
│ │ │ │ │ │ └── colors.png
│ │ │ │ │ └── modal
│ │ │ │ │ ├── deep_link_dialog_1.jpg
│ │ │ │ │ └── deep_link_dialog_2.jpg
│ │ │ │ ├── create-apps
│ │ │ │ │ ├── collapsed-vertical.png
│ │ │ │ │ ├── using-forms-warning-dialog.png
│ │ │ │ │ └── using-forms.png
│ │ │ │ ├── datasource-tutorial
│ │ │ │ │ ├── data-with-header.png
│ │ │ │ │ ├── filtered-data.png
│ │ │ │ │ ├── filtered-items.png
│ │ │ │ │ ├── initial-page-items.png
│ │ │ │ │ ├── list-items.png
│ │ │ │ │ ├── next-page-items.png
│ │ │ │ │ ├── no-data.png
│ │ │ │ │ ├── pagination-1.jpg
│ │ │ │ │ ├── pagination-1.png
│ │ │ │ │ ├── polling-1.png
│ │ │ │ │ ├── refetch-data.png
│ │ │ │ │ ├── slow-loading.png
│ │ │ │ │ ├── test-message.png
│ │ │ │ │ ├── Thumbs.db
│ │ │ │ │ ├── unconventional-data.png
│ │ │ │ │ └── unfiltered-items.png
│ │ │ │ ├── flower.jpg
│ │ │ │ ├── get-started
│ │ │ │ │ ├── add-new-contact.png
│ │ │ │ │ ├── app-modified.png
│ │ │ │ │ ├── app-start.png
│ │ │ │ │ ├── app-with-boxes.png
│ │ │ │ │ ├── app-with-toast.png
│ │ │ │ │ ├── boilerplate-structure.png
│ │ │ │ │ ├── cl-initial.png
│ │ │ │ │ ├── cl-start.png
│ │ │ │ │ ├── contact-counts.png
│ │ │ │ │ ├── contact-dialog-title.png
│ │ │ │ │ ├── contact-dialog.png
│ │ │ │ │ ├── contact-menus.png
│ │ │ │ │ ├── contact-predicates.png
│ │ │ │ │ ├── context-menu.png
│ │ │ │ │ ├── dashboard-numbers.png
│ │ │ │ │ ├── default-contact-list.png
│ │ │ │ │ ├── delete-contact.png
│ │ │ │ │ ├── delete-task.png
│ │ │ │ │ ├── detailed-template.png
│ │ │ │ │ ├── edit-contact-details.png
│ │ │ │ │ ├── edited-contact-saved.png
│ │ │ │ │ ├── empty-sections.png
│ │ │ │ │ ├── filter-completed.png
│ │ │ │ │ ├── fullwidth-desktop.png
│ │ │ │ │ ├── fullwidth-mobile.png
│ │ │ │ │ ├── initial-table.png
│ │ │ │ │ ├── items-and-badges.png
│ │ │ │ │ ├── loading-message.png
│ │ │ │ │ ├── new-contact-button.png
│ │ │ │ │ ├── new-contact-saved.png
│ │ │ │ │ ├── no-empty-sections.png
│ │ │ │ │ ├── personal-todo-initial.png
│ │ │ │ │ ├── piechart.png
│ │ │ │ │ ├── review-today.png
│ │ │ │ │ ├── rudimentary-dashboard.png
│ │ │ │ │ ├── section-collapsed.png
│ │ │ │ │ ├── sectioned-items.png
│ │ │ │ │ ├── sections-ordered.png
│ │ │ │ │ ├── spacex-list-with-links.png
│ │ │ │ │ ├── spacex-list.png
│ │ │ │ │ ├── start-personal-todo-1.png
│ │ │ │ │ ├── submit-new-contact.png
│ │ │ │ │ ├── submit-new-task.png
│ │ │ │ │ ├── syntax-highlighting.png
│ │ │ │ │ ├── table-with-badge.png
│ │ │ │ │ ├── template-with-card.png
│ │ │ │ │ ├── test-emulated-api.png
│ │ │ │ │ ├── Thumbs.db
│ │ │ │ │ ├── todo-logo.png
│ │ │ │ │ └── xmlui-tools.png
│ │ │ │ ├── HelloApp.png
│ │ │ │ ├── HelloApp2.png
│ │ │ │ ├── logos
│ │ │ │ │ ├── xmlui1.svg
│ │ │ │ │ ├── xmlui2.svg
│ │ │ │ │ ├── xmlui3.svg
│ │ │ │ │ ├── xmlui4.svg
│ │ │ │ │ ├── xmlui5.svg
│ │ │ │ │ ├── xmlui6.svg
│ │ │ │ │ └── xmlui7.svg
│ │ │ │ ├── pdf
│ │ │ │ │ └── dummy-pdf.jpg
│ │ │ │ ├── rendering-engine
│ │ │ │ │ ├── AppEngine-flow.svg
│ │ │ │ │ ├── Component.svg
│ │ │ │ │ ├── CompoundComponent.svg
│ │ │ │ │ ├── RootComponent.svg
│ │ │ │ │ └── tree-with-containers.svg
│ │ │ │ ├── reviewers-guide
│ │ │ │ │ ├── AppEngine-flow.svg
│ │ │ │ │ └── incbutton-in-action.png
│ │ │ │ ├── tools
│ │ │ │ │ └── boilerplate-structure.png
│ │ │ │ ├── try.svg
│ │ │ │ ├── tutorial
│ │ │ │ │ ├── app-chat-history.png
│ │ │ │ │ ├── app-content-placeholder.png
│ │ │ │ │ ├── app-header-and-content.png
│ │ │ │ │ ├── app-links-channel-selected.png
│ │ │ │ │ ├── app-links-click.png
│ │ │ │ │ ├── app-navigation.png
│ │ │ │ │ ├── finished-ex01.png
│ │ │ │ │ ├── finished-ex02.png
│ │ │ │ │ ├── hello.png
│ │ │ │ │ ├── splash-screen-advanced.png
│ │ │ │ │ ├── splash-screen-after-click.png
│ │ │ │ │ ├── splash-screen-centered.png
│ │ │ │ │ ├── splash-screen-events.png
│ │ │ │ │ ├── splash-screen-expression.png
│ │ │ │ │ ├── splash-screen-reuse-after.png
│ │ │ │ │ ├── splash-screen-reuse-before.png
│ │ │ │ │ └── splash-screen.png
│ │ │ │ └── tutorial-01.png
│ │ │ ├── llms.txt
│ │ │ ├── logo-dark.svg
│ │ │ ├── logo.svg
│ │ │ ├── pg-popout.svg
│ │ │ └── xmlui-logo.svg
│ │ ├── serve.json
│ │ └── web.config
│ ├── scripts
│ │ ├── download-latest-xmlui.js
│ │ ├── generate-rss.js
│ │ ├── get-releases.js
│ │ └── utils.js
│ ├── src
│ │ ├── components
│ │ │ ├── BlogOverview.xmlui
│ │ │ ├── BlogPage.xmlui
│ │ │ ├── Boxes.xmlui
│ │ │ ├── Breadcrumb.xmlui
│ │ │ ├── ChangeLog.xmlui
│ │ │ ├── ColorPalette.xmlui
│ │ │ ├── DocumentLinks.xmlui
│ │ │ ├── DocumentPage.xmlui
│ │ │ ├── DocumentPageNoTOC.xmlui
│ │ │ ├── Icons.xmlui
│ │ │ ├── IncButton.xmlui
│ │ │ ├── IncButton2.xmlui
│ │ │ ├── NameValue.xmlui
│ │ │ ├── PageNotFound.xmlui
│ │ │ ├── PaletteItem.xmlui
│ │ │ ├── Palettes.xmlui
│ │ │ ├── SectionHeader.xmlui
│ │ │ ├── TBD.xmlui
│ │ │ ├── Test.xmlui
│ │ │ ├── ThemesIntro.xmlui
│ │ │ ├── ThousandThemes.xmlui
│ │ │ ├── TubeStops.xmlui
│ │ │ ├── TubeStops.xmlui.xs
│ │ │ └── TwoColumnCode.xmlui
│ │ ├── config.ts
│ │ ├── Main.xmlui
│ │ └── themes
│ │ ├── docs-theme.ts
│ │ ├── earthtone.ts
│ │ ├── xmlui-gray-on-default.ts
│ │ ├── xmlui-green-on-default.ts
│ │ └── xmlui-orange-on-default.ts
│ └── tsconfig.json
├── LICENSE
├── package-lock.json
├── package.json
├── packages
│ ├── tsconfig.json
│ ├── xmlui-animations
│ │ ├── .gitignore
│ │ ├── CHANGELOG.md
│ │ ├── demo
│ │ │ └── Main.xmlui
│ │ ├── index.html
│ │ ├── index.ts
│ │ ├── meta
│ │ │ └── componentsMetadata.ts
│ │ ├── package.json
│ │ └── src
│ │ ├── Animation.tsx
│ │ ├── AnimationNative.tsx
│ │ ├── FadeAnimation.tsx
│ │ ├── FadeInAnimation.tsx
│ │ ├── FadeOutAnimation.tsx
│ │ ├── index.tsx
│ │ ├── ScaleAnimation.tsx
│ │ └── SlideInAnimation.tsx
│ ├── xmlui-devtools
│ │ ├── .gitignore
│ │ ├── CHANGELOG.md
│ │ ├── demo
│ │ │ └── Main.xmlui
│ │ ├── index.html
│ │ ├── index.ts
│ │ ├── meta
│ │ │ └── componentsMetadata.ts
│ │ ├── package.json
│ │ ├── src
│ │ │ ├── devtools
│ │ │ │ ├── DevTools.tsx
│ │ │ │ ├── DevToolsNative.module.scss
│ │ │ │ ├── DevToolsNative.tsx
│ │ │ │ ├── ModalDialog.module.scss
│ │ │ │ ├── ModalDialog.tsx
│ │ │ │ ├── ModalVisibilityContext.tsx
│ │ │ │ ├── Tooltip.module.scss
│ │ │ │ ├── Tooltip.tsx
│ │ │ │ └── utils.ts
│ │ │ ├── editor
│ │ │ │ └── Editor.tsx
│ │ │ └── index.tsx
│ │ └── vite.config-overrides.ts
│ ├── xmlui-hello-world
│ │ ├── .gitignore
│ │ ├── index.ts
│ │ ├── meta
│ │ │ └── componentsMetadata.ts
│ │ ├── package.json
│ │ └── src
│ │ ├── HelloWorld.module.scss
│ │ ├── HelloWorld.tsx
│ │ ├── HelloWorldNative.tsx
│ │ └── index.tsx
│ ├── xmlui-os-frames
│ │ ├── .gitignore
│ │ ├── demo
│ │ │ └── Main.xmlui
│ │ ├── index.html
│ │ ├── index.ts
│ │ ├── meta
│ │ │ └── componentsMetadata.ts
│ │ ├── package.json
│ │ └── src
│ │ ├── index.tsx
│ │ ├── IPhoneFrame.module.scss
│ │ ├── IPhoneFrame.tsx
│ │ ├── MacOSAppFrame.module.scss
│ │ ├── MacOSAppFrame.tsx
│ │ ├── WindowsAppFrame.module.scss
│ │ └── WindowsAppFrame.tsx
│ ├── xmlui-pdf
│ │ ├── .gitignore
│ │ ├── CHANGELOG.md
│ │ ├── demo
│ │ │ ├── components
│ │ │ │ └── Pdf.xmlui
│ │ │ └── Main.xmlui
│ │ ├── index.html
│ │ ├── index.ts
│ │ ├── meta
│ │ │ └── componentsMetadata.ts
│ │ ├── package.json
│ │ └── src
│ │ ├── index.tsx
│ │ ├── LazyPdfNative.tsx
│ │ ├── Pdf.module.scss
│ │ └── Pdf.tsx
│ ├── xmlui-playground
│ │ ├── .gitignore
│ │ ├── CHANGELOG.md
│ │ ├── demo
│ │ │ └── Main.xmlui
│ │ ├── index.html
│ │ ├── index.ts
│ │ ├── meta
│ │ │ └── componentsMetadata.ts
│ │ ├── package.json
│ │ └── src
│ │ ├── hooks
│ │ │ ├── usePlayground.ts
│ │ │ └── useToast.ts
│ │ ├── index.tsx
│ │ ├── playground
│ │ │ ├── Box.module.scss
│ │ │ ├── Box.tsx
│ │ │ ├── CodeSelector.module.scss
│ │ │ ├── CodeSelector.tsx
│ │ │ ├── ConfirmationDialog.module.scss
│ │ │ ├── ConfirmationDialog.tsx
│ │ │ ├── Editor.tsx
│ │ │ ├── Header.module.scss
│ │ │ ├── Header.tsx
│ │ │ ├── Playground.tsx
│ │ │ ├── PlaygroundContent.module.scss
│ │ │ ├── PlaygroundContent.tsx
│ │ │ ├── PlaygroundNative.module.scss
│ │ │ ├── PlaygroundNative.tsx
│ │ │ ├── Preview.tsx
│ │ │ ├── StandalonePlayground.tsx
│ │ │ ├── StandalonePlaygroundNative.module.scss
│ │ │ ├── StandalonePlaygroundNative.tsx
│ │ │ ├── ThemeSwitcher.module.scss
│ │ │ ├── ThemeSwitcher.tsx
│ │ │ └── utils.ts
│ │ ├── providers
│ │ │ ├── Toast.module.scss
│ │ │ └── ToastProvider.tsx
│ │ ├── state
│ │ │ └── store.ts
│ │ ├── themes
│ │ │ └── theme.ts
│ │ └── utils
│ │ └── helpers.ts
│ ├── xmlui-search
│ │ ├── .gitignore
│ │ ├── CHANGELOG.md
│ │ ├── demo
│ │ │ └── Main.xmlui
│ │ ├── index.html
│ │ ├── index.ts
│ │ ├── meta
│ │ │ └── componentsMetadata.ts
│ │ ├── package.json
│ │ └── src
│ │ ├── index.tsx
│ │ ├── Search.module.scss
│ │ └── Search.tsx
│ ├── xmlui-spreadsheet
│ │ ├── .gitignore
│ │ ├── demo
│ │ │ └── Main.xmlui
│ │ ├── index.html
│ │ ├── index.ts
│ │ ├── meta
│ │ │ └── componentsMetadata.ts
│ │ ├── package.json
│ │ └── src
│ │ ├── index.tsx
│ │ ├── Spreadsheet.tsx
│ │ └── SpreadsheetNative.tsx
│ └── xmlui-website-blocks
│ ├── .gitignore
│ ├── CHANGELOG.md
│ ├── demo
│ │ ├── components
│ │ │ ├── HeroBackgroundBreakoutPage.xmlui
│ │ │ ├── HeroBackgroundsPage.xmlui
│ │ │ ├── HeroContentsPage.xmlui
│ │ │ ├── HeroTextAlignPage.xmlui
│ │ │ ├── HeroTextPage.xmlui
│ │ │ └── HeroTonesPage.xmlui
│ │ ├── Main.xmlui
│ │ └── themes
│ │ └── default.ts
│ ├── index.html
│ ├── index.ts
│ ├── meta
│ │ └── componentsMetadata.ts
│ ├── package.json
│ ├── public
│ │ └── resources
│ │ ├── building.jpg
│ │ └── xmlui-logo.svg
│ └── src
│ ├── Carousel
│ │ ├── Carousel.module.scss
│ │ ├── Carousel.tsx
│ │ ├── CarouselContext.tsx
│ │ └── CarouselNative.tsx
│ ├── FancyButton
│ │ ├── FancyButton.module.scss
│ │ ├── FancyButton.tsx
│ │ └── FancyButton.xmlui
│ ├── Hello
│ │ ├── Hello.tsx
│ │ ├── Hello.xmlui
│ │ └── Hello.xmlui.xs
│ ├── HeroSection
│ │ ├── HeroSection.module.scss
│ │ ├── HeroSection.spec.ts
│ │ ├── HeroSection.tsx
│ │ └── HeroSectionNative.tsx
│ ├── index.tsx
│ ├── ScrollToTop
│ │ ├── ScrollToTop.module.scss
│ │ ├── ScrollToTop.tsx
│ │ └── ScrollToTopNative.tsx
│ └── vite-env.d.ts
├── playwright.config.ts
├── README.md
├── tools
│ ├── codefence
│ │ └── xmlui-code-fence-docs.md
│ ├── create-app
│ │ ├── .gitignore
│ │ ├── CHANGELOG.md
│ │ ├── create-app.ts
│ │ ├── helpers
│ │ │ ├── copy.ts
│ │ │ ├── get-pkg-manager.ts
│ │ │ ├── git.ts
│ │ │ ├── install.ts
│ │ │ ├── is-folder-empty.ts
│ │ │ ├── is-writeable.ts
│ │ │ ├── make-dir.ts
│ │ │ └── validate-pkg.ts
│ │ ├── index.ts
│ │ ├── package.json
│ │ ├── templates
│ │ │ ├── default
│ │ │ │ └── ts
│ │ │ │ ├── gitignore
│ │ │ │ ├── index.html
│ │ │ │ ├── index.ts
│ │ │ │ ├── public
│ │ │ │ │ ├── mockServiceWorker.js
│ │ │ │ │ ├── resources
│ │ │ │ │ │ ├── favicon.ico
│ │ │ │ │ │ └── xmlui-logo.svg
│ │ │ │ │ └── serve.json
│ │ │ │ └── src
│ │ │ │ ├── components
│ │ │ │ │ ├── ApiAware.xmlui
│ │ │ │ │ ├── Home.xmlui
│ │ │ │ │ ├── IncButton.xmlui
│ │ │ │ │ └── PagePanel.xmlui
│ │ │ │ ├── config.ts
│ │ │ │ └── Main.xmlui
│ │ │ ├── index.ts
│ │ │ └── types.ts
│ │ └── tsconfig.json
│ ├── create-xmlui-hello-world
│ │ ├── index.js
│ │ └── package.json
│ └── vscode
│ ├── .gitignore
│ ├── .vscode
│ │ ├── launch.json
│ │ └── tasks.json
│ ├── .vscodeignore
│ ├── build.sh
│ ├── CHANGELOG.md
│ ├── esbuild.js
│ ├── eslint.config.mjs
│ ├── formatter-docs.md
│ ├── generate-test-sample.sh
│ ├── LICENSE.md
│ ├── package-lock.json
│ ├── package.json
│ ├── README.md
│ ├── resources
│ │ ├── xmlui-logo.png
│ │ └── xmlui-markup-syntax-highlighting.png
│ ├── src
│ │ ├── extension.ts
│ │ └── server.ts
│ ├── syntaxes
│ │ └── xmlui.tmLanguage.json
│ ├── test-samples
│ │ └── sample.xmlui
│ ├── tsconfig.json
│ └── tsconfig.tsbuildinfo
├── turbo.json
└── xmlui
├── .gitignore
├── bin
│ ├── bootstrap.cjs
│ ├── bootstrap.js
│ ├── build-lib.ts
│ ├── build.ts
│ ├── index.ts
│ ├── preview.ts
│ ├── start.ts
│ ├── vite-xmlui-plugin.ts
│ └── viteConfig.ts
├── CHANGELOG.md
├── conventions
│ ├── component-qa-checklist.md
│ ├── copilot-conventions.md
│ ├── create-xmlui-components.md
│ ├── mermaid.md
│ ├── testing-conventions.md
│ └── xmlui-in-a-nutshell.md
├── dev-docs
│ ├── accessibility.md
│ ├── build-system.md
│ ├── build-xmlui.md
│ ├── component-behaviors.md
│ ├── component-metadata.md
│ ├── components-with-options.md
│ ├── containers.md
│ ├── data-operations.md
│ ├── glossary.md
│ ├── index.md
│ ├── next
│ │ ├── component-dev-guide.md
│ │ ├── configuration-management-enhancement-summary.md
│ │ ├── documentation-scripts-refactoring-complete-summary.md
│ │ ├── documentation-scripts-refactoring-plan.md
│ │ ├── duplicate-pattern-extraction-summary.md
│ │ ├── error-handling-standardization-summary.md
│ │ ├── generating-component-reference.md
│ │ ├── index.md
│ │ ├── logging-consistency-implementation-summary.md
│ │ ├── project-build.md
│ │ ├── project-structure.md
│ │ ├── theme-context.md
│ │ ├── tiptap-design-considerations.md
│ │ ├── working-with-code.md
│ │ ├── xmlui-runtime-architecture
│ │ └── xmlui-wcag-accessibility-report.md
│ ├── react-fundamentals.md
│ ├── release-method.md
│ ├── standalone-app.md
│ ├── theme-variables-refactoring.md
│ ├── ud-components.md
│ └── xmlui-repo.md
├── package.json
├── scripts
│ ├── coverage-only.js
│ ├── e2e-test-summary.js
│ ├── extract-component-metadata.js
│ ├── generate-docs
│ │ ├── build-downloads-map.mjs
│ │ ├── build-pages-map.mjs
│ │ ├── components-config.json
│ │ ├── configuration-management.mjs
│ │ ├── constants.mjs
│ │ ├── create-theme-files.mjs
│ │ ├── DocsGenerator.mjs
│ │ ├── error-handling.mjs
│ │ ├── extensions-config.json
│ │ ├── folders.mjs
│ │ ├── generate-summary-files.mjs
│ │ ├── get-docs.mjs
│ │ ├── input-handler.mjs
│ │ ├── logger.mjs
│ │ ├── logging-standards.mjs
│ │ ├── MetadataProcessor.mjs
│ │ ├── pattern-utilities.mjs
│ │ └── utils.mjs
│ ├── generate-metadata-markdown.js
│ ├── get-langserver-metadata.js
│ ├── inline-links.mjs
│ └── README-e2e-summary.md
├── src
│ ├── abstractions
│ │ ├── _conventions.md
│ │ ├── ActionDefs.ts
│ │ ├── AppContextDefs.ts
│ │ ├── ComponentDefs.ts
│ │ ├── ContainerDefs.ts
│ │ ├── ExtensionDefs.ts
│ │ ├── FunctionDefs.ts
│ │ ├── RendererDefs.ts
│ │ ├── scripting
│ │ │ ├── BlockScope.ts
│ │ │ ├── Compilation.ts
│ │ │ ├── LogicalThread.ts
│ │ │ ├── LoopScope.ts
│ │ │ ├── modules.ts
│ │ │ ├── ScriptParserError.ts
│ │ │ ├── Token.ts
│ │ │ ├── TryScope.ts
│ │ │ └── TryScopeExp.ts
│ │ └── ThemingDefs.ts
│ ├── components
│ │ ├── _conventions.md
│ │ ├── abstractions.ts
│ │ ├── Accordion
│ │ │ ├── Accordion.md
│ │ │ ├── Accordion.module.scss
│ │ │ ├── Accordion.spec.ts
│ │ │ ├── Accordion.tsx
│ │ │ ├── AccordionContext.tsx
│ │ │ ├── AccordionItem.tsx
│ │ │ ├── AccordionItemNative.tsx
│ │ │ └── AccordionNative.tsx
│ │ ├── Animation
│ │ │ └── AnimationNative.tsx
│ │ ├── APICall
│ │ │ ├── APICall.md
│ │ │ ├── APICall.spec.ts
│ │ │ ├── APICall.tsx
│ │ │ └── APICallNative.tsx
│ │ ├── App
│ │ │ ├── App.md
│ │ │ ├── App.module.scss
│ │ │ ├── App.spec.ts
│ │ │ ├── App.tsx
│ │ │ ├── AppLayoutContext.ts
│ │ │ ├── AppNative.tsx
│ │ │ ├── AppStateContext.ts
│ │ │ ├── doc-resources
│ │ │ │ ├── condensed-sticky.xmlui
│ │ │ │ ├── condensed.xmlui
│ │ │ │ ├── horizontal-sticky.xmlui
│ │ │ │ ├── horizontal.xmlui
│ │ │ │ ├── vertical-full-header.xmlui
│ │ │ │ ├── vertical-sticky.xmlui
│ │ │ │ └── vertical.xmlui
│ │ │ ├── IndexerContext.ts
│ │ │ ├── LinkInfoContext.ts
│ │ │ ├── SearchContext.tsx
│ │ │ ├── Sheet.module.scss
│ │ │ └── Sheet.tsx
│ │ ├── AppHeader
│ │ │ ├── AppHeader.md
│ │ │ ├── AppHeader.module.scss
│ │ │ ├── AppHeader.spec.ts
│ │ │ ├── AppHeader.tsx
│ │ │ └── AppHeaderNative.tsx
│ │ ├── AppState
│ │ │ ├── AppState.md
│ │ │ ├── AppState.spec.ts
│ │ │ ├── AppState.tsx
│ │ │ └── AppStateNative.tsx
│ │ ├── AutoComplete
│ │ │ ├── AutoComplete.md
│ │ │ ├── AutoComplete.module.scss
│ │ │ ├── AutoComplete.spec.ts
│ │ │ ├── AutoComplete.tsx
│ │ │ ├── AutoCompleteContext.tsx
│ │ │ └── AutoCompleteNative.tsx
│ │ ├── Avatar
│ │ │ ├── Avatar.md
│ │ │ ├── Avatar.module.scss
│ │ │ ├── Avatar.spec.ts
│ │ │ ├── Avatar.tsx
│ │ │ └── AvatarNative.tsx
│ │ ├── Backdrop
│ │ │ ├── Backdrop.md
│ │ │ ├── Backdrop.module.scss
│ │ │ ├── Backdrop.spec.ts
│ │ │ ├── Backdrop.tsx
│ │ │ └── BackdropNative.tsx
│ │ ├── Badge
│ │ │ ├── Badge.md
│ │ │ ├── Badge.module.scss
│ │ │ ├── Badge.spec.ts
│ │ │ ├── Badge.tsx
│ │ │ └── BadgeNative.tsx
│ │ ├── Bookmark
│ │ │ ├── Bookmark.md
│ │ │ ├── Bookmark.module.scss
│ │ │ ├── Bookmark.spec.ts
│ │ │ ├── Bookmark.tsx
│ │ │ └── BookmarkNative.tsx
│ │ ├── Breakout
│ │ │ ├── Breakout.module.scss
│ │ │ ├── Breakout.spec.ts
│ │ │ ├── Breakout.tsx
│ │ │ └── BreakoutNative.tsx
│ │ ├── Button
│ │ │ ├── Button-style.spec.ts
│ │ │ ├── Button.md
│ │ │ ├── Button.module.scss
│ │ │ ├── Button.spec.ts
│ │ │ ├── Button.tsx
│ │ │ └── ButtonNative.tsx
│ │ ├── Card
│ │ │ ├── Card.md
│ │ │ ├── Card.module.scss
│ │ │ ├── Card.spec.ts
│ │ │ ├── Card.tsx
│ │ │ └── CardNative.tsx
│ │ ├── Carousel
│ │ │ ├── Carousel.md
│ │ │ ├── Carousel.module.scss
│ │ │ ├── Carousel.spec.ts
│ │ │ ├── Carousel.tsx
│ │ │ ├── CarouselContext.tsx
│ │ │ ├── CarouselItem.tsx
│ │ │ ├── CarouselItemNative.tsx
│ │ │ └── CarouselNative.tsx
│ │ ├── ChangeListener
│ │ │ ├── ChangeListener.md
│ │ │ ├── ChangeListener.spec.ts
│ │ │ ├── ChangeListener.tsx
│ │ │ └── ChangeListenerNative.tsx
│ │ ├── chart-color-schemes.ts
│ │ ├── Charts
│ │ │ ├── AreaChart
│ │ │ │ ├── AreaChart.md
│ │ │ │ ├── AreaChart.spec.ts
│ │ │ │ ├── AreaChart.tsx
│ │ │ │ └── AreaChartNative.tsx
│ │ │ ├── BarChart
│ │ │ │ ├── BarChart.md
│ │ │ │ ├── BarChart.module.scss
│ │ │ │ ├── BarChart.spec.ts
│ │ │ │ ├── BarChart.tsx
│ │ │ │ └── BarChartNative.tsx
│ │ │ ├── DonutChart
│ │ │ │ ├── DonutChart.spec.ts
│ │ │ │ └── DonutChart.tsx
│ │ │ ├── LabelList
│ │ │ │ ├── LabelList.module.scss
│ │ │ │ ├── LabelList.spec.ts
│ │ │ │ ├── LabelList.tsx
│ │ │ │ └── LabelListNative.tsx
│ │ │ ├── Legend
│ │ │ │ ├── Legend.spec.ts
│ │ │ │ ├── Legend.tsx
│ │ │ │ └── LegendNative.tsx
│ │ │ ├── LineChart
│ │ │ │ ├── LineChart.md
│ │ │ │ ├── LineChart.module.scss
│ │ │ │ ├── LineChart.spec.ts
│ │ │ │ ├── LineChart.tsx
│ │ │ │ └── LineChartNative.tsx
│ │ │ ├── PieChart
│ │ │ │ ├── PieChart.md
│ │ │ │ ├── PieChart.spec.ts
│ │ │ │ ├── PieChart.tsx
│ │ │ │ ├── PieChartNative.module.scss
│ │ │ │ └── PieChartNative.tsx
│ │ │ ├── RadarChart
│ │ │ │ ├── RadarChart.md
│ │ │ │ ├── RadarChart.spec.ts
│ │ │ │ ├── RadarChart.tsx
│ │ │ │ └── RadarChartNative.tsx
│ │ │ ├── Tooltip
│ │ │ │ ├── TooltipContent.module.scss
│ │ │ │ ├── TooltipContent.spec.ts
│ │ │ │ └── TooltipContent.tsx
│ │ │ └── utils
│ │ │ ├── abstractions.ts
│ │ │ └── ChartProvider.tsx
│ │ ├── Checkbox
│ │ │ ├── Checkbox.md
│ │ │ ├── Checkbox.spec.ts
│ │ │ └── Checkbox.tsx
│ │ ├── CodeBlock
│ │ │ ├── CodeBlock.module.scss
│ │ │ ├── CodeBlock.spec.ts
│ │ │ ├── CodeBlock.tsx
│ │ │ ├── CodeBlockNative.tsx
│ │ │ └── highlight-code.ts
│ │ ├── collectedComponentMetadata.ts
│ │ ├── ColorPicker
│ │ │ ├── ColorPicker.md
│ │ │ ├── ColorPicker.module.scss
│ │ │ ├── ColorPicker.spec.ts
│ │ │ ├── ColorPicker.tsx
│ │ │ └── ColorPickerNative.tsx
│ │ ├── Column
│ │ │ ├── Column.md
│ │ │ ├── Column.tsx
│ │ │ ├── ColumnNative.tsx
│ │ │ ├── doc-resources
│ │ │ │ └── list-component-data.js
│ │ │ └── TableContext.tsx
│ │ ├── component-utils.ts
│ │ ├── ComponentProvider.tsx
│ │ ├── ComponentRegistryContext.tsx
│ │ ├── container-helpers.tsx
│ │ ├── ContentSeparator
│ │ │ ├── ContentSeparator.md
│ │ │ ├── ContentSeparator.module.scss
│ │ │ ├── ContentSeparator.spec.ts
│ │ │ ├── ContentSeparator.tsx
│ │ │ └── ContentSeparatorNative.tsx
│ │ ├── DataSource
│ │ │ ├── DataSource.md
│ │ │ └── DataSource.tsx
│ │ ├── DateInput
│ │ │ ├── DateInput.md
│ │ │ ├── DateInput.module.scss
│ │ │ ├── DateInput.spec.ts
│ │ │ ├── DateInput.tsx
│ │ │ └── DateInputNative.tsx
│ │ ├── DatePicker
│ │ │ ├── DatePicker.md
│ │ │ ├── DatePicker.module.scss
│ │ │ ├── DatePicker.spec.ts
│ │ │ ├── DatePicker.tsx
│ │ │ └── DatePickerNative.tsx
│ │ ├── DropdownMenu
│ │ │ ├── DropdownMenu.md
│ │ │ ├── DropdownMenu.module.scss
│ │ │ ├── DropdownMenu.spec.ts
│ │ │ ├── DropdownMenu.tsx
│ │ │ ├── DropdownMenuNative.tsx
│ │ │ ├── MenuItem.md
│ │ │ └── SubMenuItem.md
│ │ ├── EmojiSelector
│ │ │ ├── EmojiSelector.md
│ │ │ ├── EmojiSelector.spec.ts
│ │ │ ├── EmojiSelector.tsx
│ │ │ └── EmojiSelectorNative.tsx
│ │ ├── ExpandableItem
│ │ │ ├── ExpandableItem.module.scss
│ │ │ ├── ExpandableItem.spec.ts
│ │ │ ├── ExpandableItem.tsx
│ │ │ └── ExpandableItemNative.tsx
│ │ ├── FileInput
│ │ │ ├── FileInput.md
│ │ │ ├── FileInput.module.scss
│ │ │ ├── FileInput.spec.ts
│ │ │ ├── FileInput.tsx
│ │ │ └── FileInputNative.tsx
│ │ ├── FileUploadDropZone
│ │ │ ├── FileUploadDropZone.md
│ │ │ ├── FileUploadDropZone.module.scss
│ │ │ ├── FileUploadDropZone.spec.ts
│ │ │ ├── FileUploadDropZone.tsx
│ │ │ └── FileUploadDropZoneNative.tsx
│ │ ├── FlowLayout
│ │ │ ├── FlowLayout.md
│ │ │ ├── FlowLayout.module.scss
│ │ │ ├── FlowLayout.spec.ts
│ │ │ ├── FlowLayout.spec.ts-snapshots
│ │ │ │ └── Edge-cases-boxShadow-is-not-clipped-1-non-smoke-darwin.png
│ │ │ ├── FlowLayout.tsx
│ │ │ └── FlowLayoutNative.tsx
│ │ ├── Footer
│ │ │ ├── Footer.md
│ │ │ ├── Footer.module.scss
│ │ │ ├── Footer.spec.ts
│ │ │ ├── Footer.tsx
│ │ │ └── FooterNative.tsx
│ │ ├── Form
│ │ │ ├── Form.md
│ │ │ ├── Form.module.scss
│ │ │ ├── Form.spec.ts
│ │ │ ├── Form.tsx
│ │ │ ├── formActions.ts
│ │ │ ├── FormContext.ts
│ │ │ └── FormNative.tsx
│ │ ├── FormItem
│ │ │ ├── FormItem.md
│ │ │ ├── FormItem.module.scss
│ │ │ ├── FormItem.spec.ts
│ │ │ ├── FormItem.tsx
│ │ │ ├── FormItemNative.tsx
│ │ │ ├── HelperText.module.scss
│ │ │ ├── HelperText.tsx
│ │ │ ├── ItemWithLabel.tsx
│ │ │ └── Validations.ts
│ │ ├── FormSection
│ │ │ ├── FormSection.md
│ │ │ ├── FormSection.ts
│ │ │ └── FormSection.xmlui
│ │ ├── Fragment
│ │ │ ├── Fragment.spec.ts
│ │ │ └── Fragment.tsx
│ │ ├── Heading
│ │ │ ├── abstractions.ts
│ │ │ ├── H1.md
│ │ │ ├── H1.spec.ts
│ │ │ ├── H2.md
│ │ │ ├── H2.spec.ts
│ │ │ ├── H3.md
│ │ │ ├── H3.spec.ts
│ │ │ ├── H4.md
│ │ │ ├── H4.spec.ts
│ │ │ ├── H5.md
│ │ │ ├── H5.spec.ts
│ │ │ ├── H6.md
│ │ │ ├── H6.spec.ts
│ │ │ ├── Heading.md
│ │ │ ├── Heading.module.scss
│ │ │ ├── Heading.spec.ts
│ │ │ ├── Heading.tsx
│ │ │ └── HeadingNative.tsx
│ │ ├── HoverCard
│ │ │ ├── HoverCard.tsx
│ │ │ └── HovercardNative.tsx
│ │ ├── HtmlTags
│ │ │ ├── HtmlTags.module.scss
│ │ │ ├── HtmlTags.spec.ts
│ │ │ └── HtmlTags.tsx
│ │ ├── Icon
│ │ │ ├── AdmonitionDanger.tsx
│ │ │ ├── AdmonitionInfo.tsx
│ │ │ ├── AdmonitionNote.tsx
│ │ │ ├── AdmonitionTip.tsx
│ │ │ ├── AdmonitionWarning.tsx
│ │ │ ├── ApiIcon.tsx
│ │ │ ├── ArrowDropDown.module.scss
│ │ │ ├── ArrowDropDown.tsx
│ │ │ ├── ArrowDropUp.module.scss
│ │ │ ├── ArrowDropUp.tsx
│ │ │ ├── ArrowLeft.module.scss
│ │ │ ├── ArrowLeft.tsx
│ │ │ ├── ArrowRight.module.scss
│ │ │ ├── ArrowRight.tsx
│ │ │ ├── Attach.tsx
│ │ │ ├── Binding.module.scss
│ │ │ ├── Binding.tsx
│ │ │ ├── BoardIcon.tsx
│ │ │ ├── BoxIcon.tsx
│ │ │ ├── CheckIcon.tsx
│ │ │ ├── ChevronDownIcon.tsx
│ │ │ ├── ChevronLeft.tsx
│ │ │ ├── ChevronRight.tsx
│ │ │ ├── ChevronUpIcon.tsx
│ │ │ ├── CodeFileIcon.tsx
│ │ │ ├── CodeSandbox.tsx
│ │ │ ├── CompactListIcon.tsx
│ │ │ ├── ContentCopyIcon.tsx
│ │ │ ├── DarkToLightIcon.tsx
│ │ │ ├── DatabaseIcon.module.scss
│ │ │ ├── DatabaseIcon.tsx
│ │ │ ├── DocFileIcon.tsx
│ │ │ ├── DocIcon.tsx
│ │ │ ├── DotMenuHorizontalIcon.tsx
│ │ │ ├── DotMenuIcon.tsx
│ │ │ ├── EmailIcon.tsx
│ │ │ ├── EmptyFolderIcon.tsx
│ │ │ ├── ErrorIcon.tsx
│ │ │ ├── ExpressionIcon.tsx
│ │ │ ├── FillPlusCricleIcon.tsx
│ │ │ ├── FilterIcon.tsx
│ │ │ ├── FolderIcon.tsx
│ │ │ ├── GlobeIcon.tsx
│ │ │ ├── HomeIcon.tsx
│ │ │ ├── HyperLinkIcon.tsx
│ │ │ ├── Icon.md
│ │ │ ├── Icon.module.scss
│ │ │ ├── Icon.spec.ts
│ │ │ ├── Icon.tsx
│ │ │ ├── IconNative.tsx
│ │ │ ├── ImageFileIcon.tsx
│ │ │ ├── Inspect.tsx
│ │ │ ├── LightToDark.tsx
│ │ │ ├── LinkIcon.tsx
│ │ │ ├── ListIcon.tsx
│ │ │ ├── LooseListIcon.tsx
│ │ │ ├── MoonIcon.tsx
│ │ │ ├── MoreOptionsIcon.tsx
│ │ │ ├── NoSortIcon.tsx
│ │ │ ├── PDFIcon.tsx
│ │ │ ├── PenIcon.tsx
│ │ │ ├── PhoneIcon.tsx
│ │ │ ├── PhotoIcon.tsx
│ │ │ ├── PlusIcon.tsx
│ │ │ ├── SearchIcon.tsx
│ │ │ ├── ShareIcon.tsx
│ │ │ ├── SortAscendingIcon.tsx
│ │ │ ├── SortDescendingIcon.tsx
│ │ │ ├── StarsIcon.tsx
│ │ │ ├── SunIcon.tsx
│ │ │ ├── svg
│ │ │ │ ├── admonition_danger.svg
│ │ │ │ ├── admonition_info.svg
│ │ │ │ ├── admonition_note.svg
│ │ │ │ ├── admonition_tip.svg
│ │ │ │ ├── admonition_warning.svg
│ │ │ │ ├── api.svg
│ │ │ │ ├── arrow-dropdown.svg
│ │ │ │ ├── arrow-left.svg
│ │ │ │ ├── arrow-right.svg
│ │ │ │ ├── arrow-up.svg
│ │ │ │ ├── attach.svg
│ │ │ │ ├── binding.svg
│ │ │ │ ├── box.svg
│ │ │ │ ├── bulb.svg
│ │ │ │ ├── code-file.svg
│ │ │ │ ├── code-sandbox.svg
│ │ │ │ ├── dark_to_light.svg
│ │ │ │ ├── database.svg
│ │ │ │ ├── doc.svg
│ │ │ │ ├── empty-folder.svg
│ │ │ │ ├── expression.svg
│ │ │ │ ├── eye-closed.svg
│ │ │ │ ├── eye-dark.svg
│ │ │ │ ├── eye.svg
│ │ │ │ ├── file-text.svg
│ │ │ │ ├── filter.svg
│ │ │ │ ├── folder.svg
│ │ │ │ ├── img.svg
│ │ │ │ ├── inspect.svg
│ │ │ │ ├── light_to_dark.svg
│ │ │ │ ├── moon.svg
│ │ │ │ ├── pdf.svg
│ │ │ │ ├── photo.svg
│ │ │ │ ├── share.svg
│ │ │ │ ├── stars.svg
│ │ │ │ ├── sun.svg
│ │ │ │ ├── trending-down.svg
│ │ │ │ ├── trending-level.svg
│ │ │ │ ├── trending-up.svg
│ │ │ │ ├── txt.svg
│ │ │ │ ├── unknown-file.svg
│ │ │ │ ├── unlink.svg
│ │ │ │ └── xls.svg
│ │ │ ├── TableDeleteColumnIcon.tsx
│ │ │ ├── TableDeleteRowIcon.tsx
│ │ │ ├── TableInsertColumnIcon.tsx
│ │ │ ├── TableInsertRowIcon.tsx
│ │ │ ├── TrashIcon.tsx
│ │ │ ├── TrendingDownIcon.tsx
│ │ │ ├── TrendingLevelIcon.tsx
│ │ │ ├── TrendingUpIcon.tsx
│ │ │ ├── TxtIcon.tsx
│ │ │ ├── UnknownFileIcon.tsx
│ │ │ ├── UnlinkIcon.tsx
│ │ │ ├── UserIcon.tsx
│ │ │ ├── WarningIcon.tsx
│ │ │ └── XlsIcon.tsx
│ │ ├── IconProvider.tsx
│ │ ├── IconRegistryContext.tsx
│ │ ├── IFrame
│ │ │ ├── IFrame.md
│ │ │ ├── IFrame.module.scss
│ │ │ ├── IFrame.spec.ts
│ │ │ ├── IFrame.tsx
│ │ │ └── IFrameNative.tsx
│ │ ├── Image
│ │ │ ├── Image.md
│ │ │ ├── Image.module.scss
│ │ │ ├── Image.spec.ts
│ │ │ ├── Image.tsx
│ │ │ └── ImageNative.tsx
│ │ ├── Input
│ │ │ ├── index.ts
│ │ │ ├── InputAdornment.module.scss
│ │ │ ├── InputAdornment.tsx
│ │ │ ├── InputDivider.module.scss
│ │ │ ├── InputDivider.tsx
│ │ │ ├── InputLabel.module.scss
│ │ │ ├── InputLabel.tsx
│ │ │ ├── PartialInput.module.scss
│ │ │ └── PartialInput.tsx
│ │ ├── InspectButton
│ │ │ ├── InspectButton.module.scss
│ │ │ └── InspectButton.tsx
│ │ ├── Items
│ │ │ ├── Items.md
│ │ │ ├── Items.spec.ts
│ │ │ ├── Items.tsx
│ │ │ └── ItemsNative.tsx
│ │ ├── Link
│ │ │ ├── Link.md
│ │ │ ├── Link.module.scss
│ │ │ ├── Link.spec.ts
│ │ │ ├── Link.tsx
│ │ │ └── LinkNative.tsx
│ │ ├── List
│ │ │ ├── doc-resources
│ │ │ │ └── list-component-data.js
│ │ │ ├── List.md
│ │ │ ├── List.module.scss
│ │ │ ├── List.spec.ts
│ │ │ ├── List.tsx
│ │ │ └── ListNative.tsx
│ │ ├── Logo
│ │ │ ├── doc-resources
│ │ │ │ └── xmlui-logo.svg
│ │ │ ├── Logo.md
│ │ │ ├── Logo.tsx
│ │ │ └── LogoNative.tsx
│ │ ├── Markdown
│ │ │ ├── CodeText.module.scss
│ │ │ ├── CodeText.tsx
│ │ │ ├── Markdown.md
│ │ │ ├── Markdown.module.scss
│ │ │ ├── Markdown.spec.ts
│ │ │ ├── Markdown.tsx
│ │ │ ├── MarkdownNative.tsx
│ │ │ ├── parse-binding-expr.ts
│ │ │ └── utils.ts
│ │ ├── metadata-helpers.ts
│ │ ├── ModalDialog
│ │ │ ├── ConfirmationModalContextProvider.tsx
│ │ │ ├── Dialog.module.scss
│ │ │ ├── Dialog.tsx
│ │ │ ├── ModalDialog.md
│ │ │ ├── ModalDialog.module.scss
│ │ │ ├── ModalDialog.spec.ts
│ │ │ ├── ModalDialog.tsx
│ │ │ ├── ModalDialogNative.tsx
│ │ │ └── ModalVisibilityContext.tsx
│ │ ├── NavGroup
│ │ │ ├── NavGroup.md
│ │ │ ├── NavGroup.module.scss
│ │ │ ├── NavGroup.spec.ts
│ │ │ ├── NavGroup.tsx
│ │ │ ├── NavGroupContext.ts
│ │ │ └── NavGroupNative.tsx
│ │ ├── NavLink
│ │ │ ├── NavLink.md
│ │ │ ├── NavLink.module.scss
│ │ │ ├── NavLink.spec.ts
│ │ │ ├── NavLink.tsx
│ │ │ └── NavLinkNative.tsx
│ │ ├── NavPanel
│ │ │ ├── NavPanel.md
│ │ │ ├── NavPanel.module.scss
│ │ │ ├── NavPanel.spec.ts
│ │ │ ├── NavPanel.tsx
│ │ │ └── NavPanelNative.tsx
│ │ ├── NestedApp
│ │ │ ├── AppWithCodeView.module.scss
│ │ │ ├── AppWithCodeView.tsx
│ │ │ ├── AppWithCodeViewNative.tsx
│ │ │ ├── defaultProps.tsx
│ │ │ ├── logo.svg
│ │ │ ├── NestedApp.module.scss
│ │ │ ├── NestedApp.tsx
│ │ │ ├── NestedAppNative.tsx
│ │ │ ├── Tooltip.module.scss
│ │ │ ├── Tooltip.tsx
│ │ │ └── utils.ts
│ │ ├── NoResult
│ │ │ ├── NoResult.md
│ │ │ ├── NoResult.module.scss
│ │ │ ├── NoResult.spec.ts
│ │ │ ├── NoResult.tsx
│ │ │ └── NoResultNative.tsx
│ │ ├── NumberBox
│ │ │ ├── numberbox-abstractions.ts
│ │ │ ├── NumberBox.md
│ │ │ ├── NumberBox.module.scss
│ │ │ ├── NumberBox.spec.ts
│ │ │ ├── NumberBox.tsx
│ │ │ └── NumberBoxNative.tsx
│ │ ├── Option
│ │ │ ├── Option.md
│ │ │ ├── Option.spec.ts
│ │ │ ├── Option.tsx
│ │ │ ├── OptionNative.tsx
│ │ │ └── OptionTypeProvider.tsx
│ │ ├── PageMetaTitle
│ │ │ ├── PageMetaTilteNative.tsx
│ │ │ ├── PageMetaTitle.md
│ │ │ ├── PageMetaTitle.spec.ts
│ │ │ └── PageMetaTitle.tsx
│ │ ├── Pages
│ │ │ ├── Page.md
│ │ │ ├── Pages.md
│ │ │ ├── Pages.module.scss
│ │ │ ├── Pages.tsx
│ │ │ └── PagesNative.tsx
│ │ ├── Pagination
│ │ │ ├── Pagination.md
│ │ │ ├── Pagination.module.scss
│ │ │ ├── Pagination.spec.ts
│ │ │ ├── Pagination.tsx
│ │ │ └── PaginationNative.tsx
│ │ ├── PositionedContainer
│ │ │ ├── PositionedContainer.module.scss
│ │ │ ├── PositionedContainer.tsx
│ │ │ └── PositionedContainerNative.tsx
│ │ ├── ProfileMenu
│ │ │ ├── ProfileMenu.module.scss
│ │ │ └── ProfileMenu.tsx
│ │ ├── ProgressBar
│ │ │ ├── ProgressBar.md
│ │ │ ├── ProgressBar.module.scss
│ │ │ ├── ProgressBar.spec.ts
│ │ │ ├── ProgressBar.tsx
│ │ │ └── ProgressBarNative.tsx
│ │ ├── Queue
│ │ │ ├── Queue.md
│ │ │ ├── Queue.spec.ts
│ │ │ ├── Queue.tsx
│ │ │ ├── queueActions.ts
│ │ │ └── QueueNative.tsx
│ │ ├── RadioGroup
│ │ │ ├── RadioGroup.md
│ │ │ ├── RadioGroup.module.scss
│ │ │ ├── RadioGroup.spec.ts
│ │ │ ├── RadioGroup.tsx
│ │ │ ├── RadioGroupNative.tsx
│ │ │ ├── RadioItem.tsx
│ │ │ └── RadioItemNative.tsx
│ │ ├── RealTimeAdapter
│ │ │ ├── RealTimeAdapter.tsx
│ │ │ └── RealTimeAdapterNative.tsx
│ │ ├── Redirect
│ │ │ ├── Redirect.md
│ │ │ ├── Redirect.spec.ts
│ │ │ └── Redirect.tsx
│ │ ├── ResponsiveBar
│ │ │ ├── README.md
│ │ │ ├── ResponsiveBar.md
│ │ │ ├── ResponsiveBar.module.scss
│ │ │ ├── ResponsiveBar.spec.ts
│ │ │ ├── ResponsiveBar.tsx
│ │ │ └── ResponsiveBarNative.tsx
│ │ ├── Select
│ │ │ ├── HiddenOption.tsx
│ │ │ ├── OptionContext.ts
│ │ │ ├── Select.md
│ │ │ ├── Select.module.scss
│ │ │ ├── Select.spec.ts
│ │ │ ├── Select.tsx
│ │ │ ├── SelectContext.tsx
│ │ │ └── SelectNative.tsx
│ │ ├── SelectionStore
│ │ │ ├── SelectionStore.md
│ │ │ ├── SelectionStore.tsx
│ │ │ └── SelectionStoreNative.tsx
│ │ ├── Slider
│ │ │ ├── Slider.md
│ │ │ ├── Slider.module.scss
│ │ │ ├── Slider.spec.ts
│ │ │ ├── Slider.tsx
│ │ │ └── SliderNative.tsx
│ │ ├── Slot
│ │ │ ├── Slot.md
│ │ │ ├── Slot.spec.ts
│ │ │ └── Slot.ts
│ │ ├── SlotItem.tsx
│ │ ├── SpaceFiller
│ │ │ ├── SpaceFiller.md
│ │ │ ├── SpaceFiller.module.scss
│ │ │ ├── SpaceFiller.spec.ts
│ │ │ ├── SpaceFiller.tsx
│ │ │ └── SpaceFillerNative.tsx
│ │ ├── Spinner
│ │ │ ├── Spinner.md
│ │ │ ├── Spinner.module.scss
│ │ │ ├── Spinner.spec.ts
│ │ │ ├── Spinner.tsx
│ │ │ └── SpinnerNative.tsx
│ │ ├── Splitter
│ │ │ ├── HSplitter.md
│ │ │ ├── HSplitter.spec.ts
│ │ │ ├── Splitter.md
│ │ │ ├── Splitter.module.scss
│ │ │ ├── Splitter.spec.ts
│ │ │ ├── Splitter.tsx
│ │ │ ├── SplitterNative.tsx
│ │ │ ├── utils.ts
│ │ │ ├── VSplitter.md
│ │ │ └── VSplitter.spec.ts
│ │ ├── Stack
│ │ │ ├── CHStack.md
│ │ │ ├── CHStack.spec.ts
│ │ │ ├── CVStack.md
│ │ │ ├── CVStack.spec.ts
│ │ │ ├── HStack.md
│ │ │ ├── HStack.spec.ts
│ │ │ ├── Stack.md
│ │ │ ├── Stack.module.scss
│ │ │ ├── Stack.spec.ts
│ │ │ ├── Stack.tsx
│ │ │ ├── StackNative.tsx
│ │ │ ├── VStack.md
│ │ │ └── VStack.spec.ts
│ │ ├── StickyBox
│ │ │ ├── StickyBox.md
│ │ │ ├── StickyBox.module.scss
│ │ │ ├── StickyBox.tsx
│ │ │ └── StickyBoxNative.tsx
│ │ ├── Switch
│ │ │ ├── Switch.md
│ │ │ ├── Switch.spec.ts
│ │ │ └── Switch.tsx
│ │ ├── Table
│ │ │ ├── doc-resources
│ │ │ │ └── list-component-data.js
│ │ │ ├── react-table-config.d.ts
│ │ │ ├── Table.md
│ │ │ ├── Table.module.scss
│ │ │ ├── Table.spec.ts
│ │ │ ├── Table.tsx
│ │ │ ├── TableNative.tsx
│ │ │ └── useRowSelection.tsx
│ │ ├── TableOfContents
│ │ │ ├── TableOfContents.module.scss
│ │ │ ├── TableOfContents.spec.ts
│ │ │ ├── TableOfContents.tsx
│ │ │ └── TableOfContentsNative.tsx
│ │ ├── Tabs
│ │ │ ├── TabContext.tsx
│ │ │ ├── TabItem.md
│ │ │ ├── TabItem.tsx
│ │ │ ├── TabItemNative.tsx
│ │ │ ├── Tabs.md
│ │ │ ├── Tabs.module.scss
│ │ │ ├── Tabs.spec.ts
│ │ │ ├── Tabs.tsx
│ │ │ └── TabsNative.tsx
│ │ ├── Text
│ │ │ ├── Text.md
│ │ │ ├── Text.module.scss
│ │ │ ├── Text.spec.ts
│ │ │ ├── Text.tsx
│ │ │ └── TextNative.tsx
│ │ ├── TextArea
│ │ │ ├── TextArea.md
│ │ │ ├── TextArea.module.scss
│ │ │ ├── TextArea.spec.ts
│ │ │ ├── TextArea.tsx
│ │ │ ├── TextAreaNative.tsx
│ │ │ ├── TextAreaResizable.tsx
│ │ │ └── useComposedRef.ts
│ │ ├── TextBox
│ │ │ ├── TextBox.md
│ │ │ ├── TextBox.module.scss
│ │ │ ├── TextBox.spec.ts
│ │ │ ├── TextBox.tsx
│ │ │ └── TextBoxNative.tsx
│ │ ├── Theme
│ │ │ ├── NotificationToast.tsx
│ │ │ ├── Theme.md
│ │ │ ├── Theme.module.scss
│ │ │ ├── Theme.spec.ts
│ │ │ ├── Theme.tsx
│ │ │ └── ThemeNative.tsx
│ │ ├── TimeInput
│ │ │ ├── TimeInput.md
│ │ │ ├── TimeInput.module.scss
│ │ │ ├── TimeInput.spec.ts
│ │ │ ├── TimeInput.tsx
│ │ │ ├── TimeInputNative.tsx
│ │ │ └── utils.ts
│ │ ├── Timer
│ │ │ ├── Timer.md
│ │ │ ├── Timer.spec.ts
│ │ │ ├── Timer.tsx
│ │ │ └── TimerNative.tsx
│ │ ├── Toggle
│ │ │ ├── Toggle.module.scss
│ │ │ └── Toggle.tsx
│ │ ├── ToneChangerButton
│ │ │ ├── ToneChangerButton.md
│ │ │ ├── ToneChangerButton.spec.ts
│ │ │ └── ToneChangerButton.tsx
│ │ ├── ToneSwitch
│ │ │ ├── ToneSwitch.md
│ │ │ ├── ToneSwitch.module.scss
│ │ │ ├── ToneSwitch.spec.ts
│ │ │ ├── ToneSwitch.tsx
│ │ │ └── ToneSwitchNative.tsx
│ │ ├── Tooltip
│ │ │ ├── Tooltip.md
│ │ │ ├── Tooltip.module.scss
│ │ │ ├── Tooltip.spec.ts
│ │ │ ├── Tooltip.tsx
│ │ │ └── TooltipNative.tsx
│ │ ├── Tree
│ │ │ ├── testData.ts
│ │ │ ├── Tree-dynamic.spec.ts
│ │ │ ├── Tree-icons.spec.ts
│ │ │ ├── Tree.md
│ │ │ ├── Tree.spec.ts
│ │ │ ├── TreeComponent.module.scss
│ │ │ ├── TreeComponent.tsx
│ │ │ └── TreeNative.tsx
│ │ ├── TreeDisplay
│ │ │ ├── TreeDisplay.md
│ │ │ ├── TreeDisplay.module.scss
│ │ │ ├── TreeDisplay.tsx
│ │ │ └── TreeDisplayNative.tsx
│ │ ├── ValidationSummary
│ │ │ ├── ValidationSummary.module.scss
│ │ │ └── ValidationSummary.tsx
│ │ └── VisuallyHidden.tsx
│ ├── components-core
│ │ ├── abstractions
│ │ │ ├── ComponentRenderer.ts
│ │ │ ├── LoaderRenderer.ts
│ │ │ ├── standalone.ts
│ │ │ └── treeAbstractions.ts
│ │ ├── action
│ │ │ ├── actions.ts
│ │ │ ├── APICall.tsx
│ │ │ ├── FileDownloadAction.tsx
│ │ │ ├── FileUploadAction.tsx
│ │ │ ├── NavigateAction.tsx
│ │ │ └── TimedAction.tsx
│ │ ├── ApiBoundComponent.tsx
│ │ ├── appContext
│ │ │ ├── date-functions.ts
│ │ │ ├── math-function.ts
│ │ │ └── misc-utils.ts
│ │ ├── AppContext.tsx
│ │ ├── behaviors
│ │ │ ├── Behavior.tsx
│ │ │ └── CoreBehaviors.tsx
│ │ ├── component-hooks.ts
│ │ ├── ComponentDecorator.tsx
│ │ ├── ComponentViewer.tsx
│ │ ├── CompoundComponent.tsx
│ │ ├── constants.ts
│ │ ├── DebugViewProvider.tsx
│ │ ├── descriptorHelper.ts
│ │ ├── devtools
│ │ │ ├── InspectorDialog.module.scss
│ │ │ ├── InspectorDialog.tsx
│ │ │ └── InspectorDialogVisibilityContext.tsx
│ │ ├── EngineError.ts
│ │ ├── event-handlers.ts
│ │ ├── InspectorButton.module.scss
│ │ ├── InspectorContext.tsx
│ │ ├── interception
│ │ │ ├── abstractions.ts
│ │ │ ├── ApiInterceptor.ts
│ │ │ ├── ApiInterceptorProvider.tsx
│ │ │ ├── apiInterceptorWorker.ts
│ │ │ ├── Backend.ts
│ │ │ ├── Errors.ts
│ │ │ ├── IndexedDb.ts
│ │ │ ├── initMock.ts
│ │ │ ├── InMemoryDb.ts
│ │ │ ├── ReadonlyCollection.ts
│ │ │ └── useApiInterceptorContext.tsx
│ │ ├── loader
│ │ │ ├── ApiLoader.tsx
│ │ │ ├── DataLoader.tsx
│ │ │ ├── ExternalDataLoader.tsx
│ │ │ ├── Loader.tsx
│ │ │ ├── MockLoaderRenderer.tsx
│ │ │ └── PageableLoader.tsx
│ │ ├── LoaderComponent.tsx
│ │ ├── markup-check.ts
│ │ ├── parts.ts
│ │ ├── renderers.ts
│ │ ├── rendering
│ │ │ ├── AppContent.tsx
│ │ │ ├── AppRoot.tsx
│ │ │ ├── AppWrapper.tsx
│ │ │ ├── buildProxy.ts
│ │ │ ├── collectFnVarDeps.ts
│ │ │ ├── ComponentAdapter.tsx
│ │ │ ├── ComponentWrapper.tsx
│ │ │ ├── Container.tsx
│ │ │ ├── containers.ts
│ │ │ ├── ContainerWrapper.tsx
│ │ │ ├── ErrorBoundary.module.scss
│ │ │ ├── ErrorBoundary.tsx
│ │ │ ├── InvalidComponent.module.scss
│ │ │ ├── InvalidComponent.tsx
│ │ │ ├── nodeUtils.ts
│ │ │ ├── reducer.ts
│ │ │ ├── renderChild.tsx
│ │ │ ├── StandaloneComponent.tsx
│ │ │ ├── StateContainer.tsx
│ │ │ ├── UnknownComponent.module.scss
│ │ │ ├── UnknownComponent.tsx
│ │ │ └── valueExtractor.ts
│ │ ├── reportEngineError.ts
│ │ ├── RestApiProxy.ts
│ │ ├── script-runner
│ │ │ ├── asyncProxy.ts
│ │ │ ├── AttributeValueParser.ts
│ │ │ ├── bannedFunctions.ts
│ │ │ ├── BindingTreeEvaluationContext.ts
│ │ │ ├── eval-tree-async.ts
│ │ │ ├── eval-tree-common.ts
│ │ │ ├── eval-tree-sync.ts
│ │ │ ├── ParameterParser.ts
│ │ │ ├── process-statement-async.ts
│ │ │ ├── process-statement-common.ts
│ │ │ ├── process-statement-sync.ts
│ │ │ ├── ScriptingSourceTree.ts
│ │ │ ├── simplify-expression.ts
│ │ │ ├── statement-queue.ts
│ │ │ └── visitors.ts
│ │ ├── StandaloneApp.tsx
│ │ ├── StandaloneExtensionManager.ts
│ │ ├── TableOfContentsContext.tsx
│ │ ├── theming
│ │ │ ├── _themes.scss
│ │ │ ├── component-layout-resolver.ts
│ │ │ ├── extendThemeUtils.ts
│ │ │ ├── hvar.ts
│ │ │ ├── layout-resolver.ts
│ │ │ ├── parse-layout-props.ts
│ │ │ ├── StyleContext.tsx
│ │ │ ├── StyleRegistry.ts
│ │ │ ├── ThemeContext.tsx
│ │ │ ├── ThemeProvider.tsx
│ │ │ ├── themes
│ │ │ │ ├── base-utils.ts
│ │ │ │ ├── palette.ts
│ │ │ │ ├── root.ts
│ │ │ │ ├── solid.ts
│ │ │ │ ├── theme-colors.ts
│ │ │ │ └── xmlui.ts
│ │ │ ├── themeVars.module.scss
│ │ │ ├── themeVars.ts
│ │ │ ├── transformThemeVars.ts
│ │ │ └── utils.ts
│ │ ├── utils
│ │ │ ├── actionUtils.ts
│ │ │ ├── audio-utils.ts
│ │ │ ├── base64-utils.ts
│ │ │ ├── compound-utils.ts
│ │ │ ├── css-utils.ts
│ │ │ ├── DataLoaderQueryKeyGenerator.ts
│ │ │ ├── date-utils.ts
│ │ │ ├── extractParam.ts
│ │ │ ├── hooks.tsx
│ │ │ ├── LruCache.ts
│ │ │ ├── mergeProps.ts
│ │ │ ├── misc.ts
│ │ │ ├── request-params.ts
│ │ │ ├── statementUtils.ts
│ │ │ └── treeUtils.ts
│ │ └── xmlui-parser.ts
│ ├── index-standalone.ts
│ ├── index.scss
│ ├── index.ts
│ ├── language-server
│ │ ├── server-common.ts
│ │ ├── server-web-worker.ts
│ │ ├── server.ts
│ │ ├── services
│ │ │ ├── common
│ │ │ │ ├── docs-generation.ts
│ │ │ │ ├── lsp-utils.ts
│ │ │ │ ├── metadata-utils.ts
│ │ │ │ └── syntax-node-utilities.ts
│ │ │ ├── completion.ts
│ │ │ ├── diagnostic.ts
│ │ │ ├── format.ts
│ │ │ └── hover.ts
│ │ └── xmlui-metadata-generated.js
│ ├── logging
│ │ ├── LoggerContext.tsx
│ │ ├── LoggerInitializer.tsx
│ │ ├── LoggerService.ts
│ │ └── xmlui.ts
│ ├── logo.svg
│ ├── parsers
│ │ ├── common
│ │ │ ├── GenericToken.ts
│ │ │ ├── InputStream.ts
│ │ │ └── utils.ts
│ │ ├── scripting
│ │ │ ├── code-behind-collect.ts
│ │ │ ├── Lexer.ts
│ │ │ ├── modules.ts
│ │ │ ├── Parser.ts
│ │ │ ├── ParserError.ts
│ │ │ ├── ScriptingNodeTypes.ts
│ │ │ ├── TokenTrait.ts
│ │ │ ├── TokenType.ts
│ │ │ └── tree-visitor.ts
│ │ ├── style-parser
│ │ │ ├── errors.ts
│ │ │ ├── source-tree.ts
│ │ │ ├── StyleInputStream.ts
│ │ │ ├── StyleLexer.ts
│ │ │ ├── StyleParser.ts
│ │ │ └── tokens.ts
│ │ └── xmlui-parser
│ │ ├── CharacterCodes.ts
│ │ ├── diagnostics.ts
│ │ ├── fileExtensions.ts
│ │ ├── index.ts
│ │ ├── lint.ts
│ │ ├── parser.ts
│ │ ├── ParserError.ts
│ │ ├── scanner.ts
│ │ ├── syntax-kind.ts
│ │ ├── syntax-node.ts
│ │ ├── transform.ts
│ │ ├── utils.ts
│ │ ├── xmlui-serializer.ts
│ │ └── xmlui-tree.ts
│ ├── react-app-env.d.ts
│ ├── syntax
│ │ ├── monaco
│ │ │ ├── grammar.monacoLanguage.ts
│ │ │ ├── index.ts
│ │ │ ├── xmlui-dark.ts
│ │ │ ├── xmlui-light.ts
│ │ │ └── xmluiscript.monacoLanguage.ts
│ │ └── textMate
│ │ ├── index.ts
│ │ ├── xmlui-dark.json
│ │ ├── xmlui-light.json
│ │ ├── xmlui.json
│ │ └── xmlui.tmLanguage.json
│ ├── testing
│ │ ├── assertions.ts
│ │ ├── component-test-helpers.ts
│ │ ├── ComponentDrivers.ts
│ │ ├── drivers
│ │ │ ├── DateInputDriver.ts
│ │ │ ├── index.ts
│ │ │ ├── ModalDialogDriver.ts
│ │ │ ├── NumberBoxDriver.ts
│ │ │ ├── TextBoxDriver.ts
│ │ │ ├── TimeInputDriver.ts
│ │ │ ├── TimerDriver.ts
│ │ │ └── TreeDriver.ts
│ │ ├── fixtures.ts
│ │ ├── index.ts
│ │ ├── infrastructure
│ │ │ ├── index.html
│ │ │ ├── main.tsx
│ │ │ ├── public
│ │ │ │ ├── mockServiceWorker.js
│ │ │ │ ├── resources
│ │ │ │ │ ├── bell.svg
│ │ │ │ │ ├── box.svg
│ │ │ │ │ ├── doc.svg
│ │ │ │ │ ├── eye.svg
│ │ │ │ │ ├── flower-640x480.jpg
│ │ │ │ │ ├── sun.svg
│ │ │ │ │ ├── test-image-100x100.jpg
│ │ │ │ │ └── txt.svg
│ │ │ │ └── serve.json
│ │ │ └── TestBed.tsx
│ │ └── themed-app-test-helpers.ts
│ └── vite-env.d.ts
├── tests
│ ├── components
│ │ ├── CodeBlock
│ │ │ └── hightlight-code.test.ts
│ │ ├── playground-pattern.test.ts
│ │ └── Tree
│ │ └── Tree-states.test.ts
│ ├── components-core
│ │ ├── abstractions
│ │ │ └── treeAbstractions.test.ts
│ │ ├── container
│ │ │ └── buildProxy.test.ts
│ │ ├── interception
│ │ │ ├── orderBy.test.ts
│ │ │ ├── ReadOnlyCollection.test.ts
│ │ │ └── request-param-converter.test.ts
│ │ ├── scripts-runner
│ │ │ ├── AttributeValueParser.test.ts
│ │ │ ├── eval-tree-arrow-async.test.ts
│ │ │ ├── eval-tree-arrow.test.ts
│ │ │ ├── eval-tree-func-decl-async.test.ts
│ │ │ ├── eval-tree-func-decl.test.ts
│ │ │ ├── eval-tree-pre-post.test.ts
│ │ │ ├── eval-tree-regression.test.ts
│ │ │ ├── eval-tree.test.ts
│ │ │ ├── function-proxy.test.ts
│ │ │ ├── parser-regression.test.ts
│ │ │ ├── process-event.test.ts
│ │ │ ├── process-function.test.ts
│ │ │ ├── process-implicit-context.test.ts
│ │ │ ├── process-statement-asgn.test.ts
│ │ │ ├── process-statement-destruct.test.ts
│ │ │ ├── process-statement-regs.test.ts
│ │ │ ├── process-statement-sync.test.ts
│ │ │ ├── process-statement.test.ts
│ │ │ ├── process-switch-sync.test.ts
│ │ │ ├── process-switch.test.ts
│ │ │ ├── process-try-sync.test.ts
│ │ │ ├── process-try.test.ts
│ │ │ └── test-helpers.ts
│ │ ├── test-metadata-handler.ts
│ │ ├── theming
│ │ │ ├── border-segments.test.ts
│ │ │ ├── component-layout.resolver.test.ts
│ │ │ ├── layout-property-parser.test.ts
│ │ │ ├── layout-resolver.test.ts
│ │ │ ├── layout-resolver2.test.ts
│ │ │ ├── layout-vp-override.test.ts
│ │ │ └── padding-segments.test.ts
│ │ └── utils
│ │ ├── date-utils.test.ts
│ │ ├── format-human-elapsed-time.test.ts
│ │ └── LruCache.test.ts
│ ├── language-server
│ │ ├── completion.test.ts
│ │ ├── format.test.ts
│ │ ├── hover.test.ts
│ │ └── mockData.ts
│ └── parsers
│ ├── common
│ │ └── input-stream.test.ts
│ ├── markdown
│ │ └── parse-binding-expression.test.ts
│ ├── parameter-parser.test.ts
│ ├── paremeter-parser.test.ts
│ ├── scripting
│ │ ├── eval-tree-arrow.test.ts
│ │ ├── eval-tree-pre-post.test.ts
│ │ ├── eval-tree.test.ts
│ │ ├── function-proxy.test.ts
│ │ ├── lexer-literals.test.ts
│ │ ├── lexer-misc.test.ts
│ │ ├── module-parse.test.ts
│ │ ├── parser-arrow.test.ts
│ │ ├── parser-assignments.test.ts
│ │ ├── parser-binary.test.ts
│ │ ├── parser-destructuring.test.ts
│ │ ├── parser-errors.test.ts
│ │ ├── parser-expressions.test.ts
│ │ ├── parser-function.test.ts
│ │ ├── parser-literals.test.ts
│ │ ├── parser-primary.test.ts
│ │ ├── parser-regex.test.ts
│ │ ├── parser-statements.test.ts
│ │ ├── parser-unary.test.ts
│ │ ├── process-event.test.ts
│ │ ├── process-implicit-context.test.ts
│ │ ├── process-statement-asgn.test.ts
│ │ ├── process-statement-destruct.test.ts
│ │ ├── process-statement-regs.test.ts
│ │ ├── process-statement-sync.test.ts
│ │ ├── process-statement.test.ts
│ │ ├── process-switch-sync.test.ts
│ │ ├── process-switch.test.ts
│ │ ├── process-try-sync.test.ts
│ │ ├── process-try.test.ts
│ │ ├── simplify-expression.test.ts
│ │ ├── statement-hooks.test.ts
│ │ └── test-helpers.ts
│ ├── style-parser
│ │ ├── generateHvarChain.test.ts
│ │ ├── parseHVar.test.ts
│ │ ├── parser.test.ts
│ │ └── tokens.test.ts
│ └── xmlui
│ ├── lint.test.ts
│ ├── parser.test.ts
│ ├── scanner.test.ts
│ ├── transform.attr.test.ts
│ ├── transform.circular.test.ts
│ ├── transform.element.test.ts
│ ├── transform.errors.test.ts
│ ├── transform.escape.test.ts
│ ├── transform.regression.test.ts
│ ├── transform.script.test.ts
│ ├── transform.test.ts
│ └── xmlui.ts
├── tests-e2e
│ ├── api-bound-component-regression.spec.ts
│ ├── api-call-as-extracted-component.spec.ts
│ ├── assign-to-object-or-array-regression.spec.ts
│ ├── binding-regression.spec.ts
│ ├── children-as-template-context-vars.spec.ts
│ ├── compound-component.spec.ts
│ ├── context-vars-regression.spec.ts
│ ├── data-bindings.spec.ts
│ ├── datasource-and-api-usage-in-var.spec.ts
│ ├── datasource-direct-binding.spec.ts
│ ├── datasource-onLoaded-regression.spec.ts
│ ├── modify-array-item-regression.spec.ts
│ ├── namespaces.spec.ts
│ ├── push-to-array-regression.spec.ts
│ ├── screen-breakpoints.spec.ts
│ ├── scripting.spec.ts
│ ├── state-scope-in-pages.spec.ts
│ └── state-var-scopes.spec.ts
├── tsconfig.json
├── tsdown.config.ts
├── vite.config.ts
└── vitest.config.ts
```
# Files
--------------------------------------------------------------------------------
/xmlui/src/parsers/style-parser/StyleParser.ts:
--------------------------------------------------------------------------------
```typescript
import type { StyleErrorCodes } from "./errors";
import type { StyleToken } from "./tokens";
import type {
BaseNode,
BorderNode,
BorderStyleNode,
ColorNode,
SizeNode,
StyleNode,
ThemeIdDescriptor,
} from "./source-tree";
import { styleErrorMessages, StyleParserError } from "./errors";
import { StyleInputStream } from "./StyleInputStream";
import { StyleLexer } from "./StyleLexer";
import { StyleTokenType } from "./tokens";
export const THEME_VAR_PREFIX = "xmlui";
type StyleParserErrorMessage = {
code: StyleErrorCodes;
text: string;
position: number;
};
/**
* This class parses a binding expression and transforms it into an evaluable expression tree
*/
export class StyleParser {
// --- Keep track of error messages
private _parseErrors: StyleParserErrorMessage[] = [];
// --- Use this lexer
private _lexer: StyleLexer;
/**
* Initializes the parser with the specified source code
* @param source Source code to parse
*/
constructor(public readonly source: string) {
this._lexer = new StyleLexer(new StyleInputStream(source));
}
/**
* Tests if the parse is complete
*/
testCompleted(): boolean {
const token = this._lexer.peek(true);
if (token.type === StyleTokenType.Eof) return true;
if (token.type === StyleTokenType.Ws) {
this._lexer.get(true);
return this._lexer.peek().type === StyleTokenType.Eof;
} else {
return false;
}
}
/**
* Parses a size value with its unit
*/
parseSize(): SizeNode | null {
return this.parseSizeLike("px");
}
/**
* Parses a border (size, style, color in arbitrary order)
*/
parseBorder(): BorderNode | null {
const startToken = this._lexer.peek();
const themeIdNode = this.tryThemeId<BorderNode>();
let themeId1: ThemeIdDescriptor | undefined;
let maxStyleTokens = 3;
if (themeIdNode) {
if (this.testCompleted()) {
return themeIdNode;
}
maxStyleTokens = 2;
themeId1 = themeIdNode.themeId;
}
let sizeFound: SizeNode | null = null;
let styleFound: BorderStyleNode | null = null;
let colorFound: ColorNode | null = null;
let themeId2: ThemeIdDescriptor | undefined;
let themeId3: ThemeIdDescriptor | undefined;
for (let i = 0; i < maxStyleTokens; i++) {
const nextToken = this._lexer.peek();
if (isThemeId(nextToken)) {
if (!themeId1) {
themeId1 = this.parseThemeId();
} else if (!themeId2) {
themeId2 = this.parseThemeId();
} else {
themeId3 = this.parseThemeId();
}
} else {
switch (nextToken.type) {
case StyleTokenType.Number:
if (sizeFound) {
this.reportError("S016", nextToken);
return null;
}
sizeFound = this.parseSize();
break;
case StyleTokenType.BorderStyle:
if (styleFound) {
this.reportError("S016", nextToken);
return null;
}
styleFound = this.parseBorderStyle();
break;
case StyleTokenType.ColorName:
case StyleTokenType.ColorFunc:
case StyleTokenType.HexaColor:
if (colorFound) {
this.reportError("S016", nextToken);
return null;
}
colorFound = this.parseColor();
break;
default:
this.reportError("S016", nextToken);
return null;
}
}
const spToken = this._lexer.peek(true);
if (spToken.type === StyleTokenType.Eof) break;
if (spToken.type === StyleTokenType.Ws) {
this._lexer.get(true);
}
}
return this.createNode<BorderNode>(
"Border",
{
themeId1,
themeId2,
themeId3,
widthValue: sizeFound?.value,
widthUnit: sizeFound?.unit,
color: colorFound?.value,
styleValue: styleFound?.value,
},
startToken,
);
}
/**
* Parses a border style value with its unit
*/
private parseBorderStyle(): BorderStyleNode | null {
const startToken = this._lexer.peek();
if (startToken.type !== StyleTokenType.BorderStyle && startToken.type !== StyleTokenType.None) {
this.reportError("S004", startToken);
return null;
}
// --- Done.
this._lexer.get();
return this.createNode<BorderStyleNode>(
"BorderStyle",
{
value: startToken.text,
},
startToken,
);
}
/**
* Parses a color value
*/
private parseColor(): ColorNode | null {
const startToken = this._lexer.peek();
const themeIdNode = this.tryThemeId<ColorNode>();
if (themeIdNode) return themeIdNode;
/**
* Parses color function parameters
*/
const parseColorParameters = (pars: string[]): boolean => {
// --- Skip the color function name token
this._lexer.get();
// --- Expect "("
this.expectToken(StyleTokenType.LParent, "S007");
// --- Iterate through pars
for (let i = 0; i < pars.length; i++) {
// --- Get the parameter value
const value = this.getNumber();
if (value === null) return false;
// --- Get optional parameter unit
const unit = this._lexer.peek(true);
// --- Process the value & unit
switch (pars[i]) {
// 0-255 or 0%-100%
case "V%":
if (unit.type === StyleTokenType.Percentage) {
if (value < 0 || value > 100) {
this.reportError("S008");
return false;
}
this._lexer.get();
} else {
if (value < 0 || value > 255) {
this.reportError("S009");
return false;
}
}
break;
// 0%-100%
case "%":
if (unit.type !== StyleTokenType.Percentage || value < 0 || value > 100) {
this.reportError("S008");
return false;
}
this._lexer.get();
break;
case "angle":
if (unit.type === StyleTokenType.Angle) {
this._lexer.get();
}
break;
// alpha with units
case "alpha":
if (unit.type === StyleTokenType.Percentage) {
if (value < 0 || value > 100) {
this.reportError("S008");
return false;
}
this._lexer.get();
} else {
if (value < 0 || value > 1) {
this.reportError("S011");
return false;
}
}
break;
}
// --- No separator expected after the last parameter
if (i === pars.length - 1) continue;
// --- Process the separator
let sepToken = this._lexer.peek(true);
if (sepToken.type === StyleTokenType.Ws) {
this._lexer.get();
sepToken = this._lexer.peek(true);
if (sepToken.type === StyleTokenType.Comma) {
this._lexer.get();
}
} else {
this.expectToken(StyleTokenType.Comma);
}
sepToken = this._lexer.peek();
if (sepToken.type === StyleTokenType.Ws) {
this._lexer.get();
}
}
// --- Process the optional separator
let aSepToken = this._lexer.peek();
if (aSepToken.type === StyleTokenType.Ws) {
this._lexer.get();
}
// --- Expect ")"
this.expectToken(StyleTokenType.RParent, "S010");
return true;
};
switch (startToken.type) {
case StyleTokenType.ColorName:
this._lexer.get();
return this.createNode<ColorNode>(
"Color",
{
value: startToken.text.toLowerCase(),
},
startToken,
);
case StyleTokenType.HexaColor:
this._lexer.get();
return this.createNode<ColorNode>(
"Color",
{
value: startToken.text,
},
startToken,
);
case StyleTokenType.ColorFunc:
let success = false;
switch (startToken.text) {
case "rgb":
success = parseColorParameters(["V%", "V%", "V%"]);
break;
case "rgba":
success = parseColorParameters(["V%", "V%", "V%", "alpha"]);
break;
case "hsl":
success = parseColorParameters(["angle", "%", "%"]);
break;
case "hsla":
success = parseColorParameters(["angle", "%", "%", "alpha"]);
break;
default:
this.reportError("S006", startToken, startToken.text);
return null;
}
if (success) {
return {
type: "Color",
startPosition: startToken.start,
endPosition: this._lexer.peek().start,
value: this.getSource(startToken, this._lexer.peek()),
};
}
return null;
default:
this.reportError("S005", startToken);
return null;
}
}
private getNumber(): number | null {
const token = this._lexer.get();
if (token.type === StyleTokenType.Number) {
return parseFloat(token.text);
}
this.reportError("S001", token);
return null;
}
private expectToken(
type: StyleTokenType,
errorCode?: StyleErrorCodes,
allowEof?: boolean,
): StyleToken | null {
const next = this._lexer.peek();
if (next.type === type || (allowEof && next.type === StyleTokenType.Eof)) {
// --- Skip the expected token
return this._lexer.get();
}
this.reportError(errorCode ?? "S007", next, next.text);
return null;
}
/**
* Reports the specified error
* @param errorCode Error code
* @param token Token that represents the error's position
* @param options Error message options
*/
private reportError(errorCode: StyleErrorCodes, token?: StyleToken, ...options: any[]): void {
let errorText: string = styleErrorMessages[errorCode] ?? "Unknown error";
if (options) {
options.forEach(
(o, idx) => (errorText = replace(errorText, `{${idx}}`, options[idx].toString())),
);
}
if (!token) {
token = this._lexer.peek(true);
}
this._parseErrors.push({
code: errorCode,
text: errorText,
position: token.start,
});
throw new StyleParserError(errorText, errorCode);
function replace(input: string, placeholder: string, replacement: string): string {
do {
input = input.replace(placeholder, replacement);
} while (input.includes(placeholder));
return input;
}
}
/**
* Creates an expression node
* @param type Expression type
* @param stump Stump properties
* @param startToken The token that starts the expression
* @param endToken The token that ends the expression
* @param source Expression source code to store to the node
*/
private createNode<T extends BaseNode>(
type: StyleNode["type"],
stump: any,
startToken: StyleToken,
endToken?: StyleToken,
source?: string,
): T {
if (!endToken) {
endToken = this._lexer.peek(true);
}
const startPosition = startToken.start;
const endPosition = endToken.start;
return Object.assign({}, stump, {
type,
startPosition,
endPosition,
source: source ?? this.getSource(startToken, endToken),
} as BaseNode);
}
/**
* Gets the source code for the specified token range
* @param start Start token
* @param end Optional end token
* @returns The source code for the token range
*/
private getSource(start: StyleToken, end?: StyleToken): string {
if (!end) end = this._lexer.peek();
return this.source.substring(start.start, end.start);
}
private tryThemeId<T extends BaseNode>(): T | null {
const token = this._lexer.peek();
if (isThemeId(token)) {
return this.createNode<T>(
"Boolean",
{
themeId: this.parseThemeId(),
},
token,
);
}
return null;
}
private parseThemeId(): ThemeIdDescriptor {
const startToken = this._lexer.peek();
this._lexer.get();
return {
id: startToken.text,
};
}
/**
* Parses a size value with its unit
*/
private parseSizeLike(defUnit = ""): SizeNode | null {
const startToken = this._lexer.peek();
const themeIdNode = this.tryThemeId<SizeNode>();
if (themeIdNode) return themeIdNode;
if (startToken.type === StyleTokenType.Star) {
this._lexer.get();
const nextToken = this._lexer.peek(true);
if (nextToken.type === StyleTokenType.Ws) {
this._lexer.get(true);
} else if (nextToken.type !== StyleTokenType.Eof) {
this.reportError("S016", nextToken);
return null;
}
// --- Done with "*"
return this.createNode<SizeNode>(
"Size",
{
value: 1,
unit: "*",
},
startToken,
);
}
const value = this.getNumber();
if (value === null) return null;
// --- Get the unit
let unit = "";
const unitToken = this._lexer.peek(true);
if (
unitToken.type === StyleTokenType.SizeUnit ||
unitToken.type === StyleTokenType.Star ||
unitToken.type === StyleTokenType.Percentage
) {
unit = this._lexer.get(true).text;
} else if (unitToken.type === StyleTokenType.Ws) {
this._lexer.get(true);
} else if (unitToken.type !== StyleTokenType.Eof) {
this.reportError("S016", unitToken);
return null;
}
// --- Done.
return this.createNode<SizeNode>(
"Size",
{
value,
unit: unit ? unit : value ? defUnit : "",
},
startToken,
);
}
}
/**
* Tests if the specified token is a theme identifier
* @param value Token to test
*/
function isThemeId(value: StyleToken): boolean {
return value.type === StyleTokenType.Identifier && value.text.charAt(0) === "$";
}
/**
* Converts the specified themeID to a CSS var string
* @param c segment to convert
*/
export function toCssVar(c: string | ThemeIdDescriptor): string {
if (typeof c === "string") {
return `var(--${THEME_VAR_PREFIX}-${c.substring(1)})`;
}
if (c.defaultValue && c.defaultValue.length > 0) {
let defaultValueString = "";
for (const segment of c.defaultValue) {
defaultValueString += typeof segment === "string" ? segment : toCssVar(segment);
}
return `var(--${THEME_VAR_PREFIX}-${c.id.substring(1)}, ${defaultValueString})`;
} else {
return `var(--${THEME_VAR_PREFIX}-${c.id.substring(1)})`;
}
}
```
--------------------------------------------------------------------------------
/xmlui/src/components-core/script-runner/simplify-expression.ts:
--------------------------------------------------------------------------------
```typescript
import type {
ArrowExpression,
BlockStatement,
Expression,
ReactiveVarDeclaration,
Statement,
VarDeclaration,
ExpressionStatement,
LetStatement,
SwitchCase,
ArrayDestructure,
ObjectDestructure,
UnaryExpression,
ObjectLiteral,
BinaryExpression} from "./ScriptingSourceTree";
import {
T_UNARY_EXPRESSION,
T_BINARY_EXPRESSION,
T_SEQUENCE_EXPRESSION,
T_CONDITIONAL_EXPRESSION,
T_FUNCTION_INVOCATION_EXPRESSION,
T_MEMBER_ACCESS_EXPRESSION,
T_CALCULATED_MEMBER_ACCESS_EXPRESSION,
T_SPREAD_EXPRESSION,
T_ARRAY_LITERAL,
T_OBJECT_LITERAL,
T_ASSIGNMENT_EXPRESSION,
T_ARROW_EXPRESSION,
T_PREFIX_OP_EXPRESSION,
T_POSTFIX_OP_EXPRESSION,
T_VAR_DECLARATION,
T_REACTIVE_VAR_DECLARATION,
T_SWITCH_CASE,
T_BLOCK_STATEMENT,
T_EXPRESSION_STATEMENT,
T_ARROW_EXPRESSION_STATEMENT,
T_LET_STATEMENT,
T_CONST_STATEMENT,
T_VAR_STATEMENT,
T_IF_STATEMENT,
T_RETURN_STATEMENT,
T_WHILE_STATEMENT,
T_DO_WHILE_STATEMENT,
T_THROW_STATEMENT,
T_TRY_STATEMENT,
T_FOR_STATEMENT,
T_FOR_IN_STATEMENT,
T_FOR_OF_STATEMENT,
T_SWITCH_STATEMENT,
T_FUNCTION_DECLARATION,
T_LITERAL,
} from "./ScriptingSourceTree";
export function simplifyExpression(expr?: Expression): Expression | undefined {
let orig = expr;
let newExpr = expr;
do {
orig = newExpr;
newExpr = simplify(orig);
} while (orig !== newExpr);
return newExpr;
function simplify(expr?: Expression): Expression | undefined {
if (!expr) return expr;
switch (expr.type) {
case T_UNARY_EXPRESSION: {
const simplified = simplifyUnaryExpression(expr);
if (simplified !== expr) return simplified;
return updateExpr(expr, { expr: simplifyExpression(expr.expr) });
}
case T_BINARY_EXPRESSION: {
const simplified = simplifyBinaryExpression(expr);
if (simplified !== expr) return simplified;
return updateExpr(expr, {
left: simplifyExpression(expr.left),
right: simplifyExpression(expr.right),
});
}
case T_SEQUENCE_EXPRESSION:
return updateExpr(expr, {
exprs: simplifyExpressionList(expr.exprs),
});
case T_CONDITIONAL_EXPRESSION:
// TODO: Check for constant expressions and evaluate them
return updateExpr(expr, {
cond: simplifyExpression(expr.cond),
thenE: simplifyExpression(expr.thenE),
elseE: simplifyExpression(expr.elseE),
});
case T_FUNCTION_INVOCATION_EXPRESSION:
return updateExpr(expr, {
obj: simplifyExpression(expr.obj),
arguments: simplifyExpressionList(expr.arguments),
});
case T_MEMBER_ACCESS_EXPRESSION:
return updateExpr(expr, {
obj: simplifyExpression(expr.obj),
});
case T_CALCULATED_MEMBER_ACCESS_EXPRESSION:
return updateExpr(expr, {
obj: simplifyExpression(expr.obj),
member: simplifyExpression(expr.member),
});
case T_SPREAD_EXPRESSION:
return updateExpr(expr, {
expr: simplifyExpression(expr.expr),
});
case T_ARRAY_LITERAL:
return updateExpr(expr, {
items: simplifyExpressionList(expr.items),
});
case T_OBJECT_LITERAL:
return updateExpr(expr, simplifyObjectLiteral(expr));
case T_ASSIGNMENT_EXPRESSION:
return updateExpr(expr, {
leftValue: simplifyExpression(expr.leftValue),
expr: simplifyExpression(expr.expr),
});
case T_ARROW_EXPRESSION:
return updateExpr(expr, {
args: simplifyExpressionList(expr.args),
statement: simplifyStatement(expr.statement),
});
case T_PREFIX_OP_EXPRESSION:
case T_POSTFIX_OP_EXPRESSION:
return updateExpr(expr, {
expr: simplifyExpression(expr.expr),
});
case T_VAR_DECLARATION:
return simplifyVarDeclaration(expr);
case T_REACTIVE_VAR_DECLARATION:
return updateExpr(expr, {
expr: simplifyExpression(expr.expr),
});
case T_SWITCH_CASE:
return updateExpr(expr, {
caseE: simplifyExpression(expr.caseE),
stmts: simplifyStatementList(expr.stmts),
});
}
return expr;
}
}
function simplifyExpressionList(exprs: Expression[]): Expression[] {
const newExprList = exprs.map(simplifyExpression);
const isUpdated = newExprList.some((expr, i) => expr !== exprs[i]);
return isUpdated ? newExprList : exprs;
}
export function simplifyStatement(stmt?: Statement): Statement | undefined {
let orig = stmt;
let newStmt = stmt;
do {
orig = newStmt;
newStmt = simplify(orig);
} while (orig !== newStmt);
return newStmt;
function simplify(stmt?: Statement): Statement | undefined {
if (!stmt) return stmt;
switch (stmt.type) {
case T_BLOCK_STATEMENT:
return updateStmt(stmt, {
stmts: simplifyStatementList(stmt.stmts),
});
case T_EXPRESSION_STATEMENT:
return updateStmt(stmt, {
expr: simplifyExpression(stmt.expr),
});
case T_ARROW_EXPRESSION_STATEMENT:
return updateStmt(stmt, {
expr: simplifyExpression(stmt.expr) as ArrowExpression,
});
case T_LET_STATEMENT:
case T_CONST_STATEMENT:
return updateStmt(stmt, {
decls: simplifyVarDeclarationList(stmt.decls) as VarDeclaration[],
});
case T_VAR_STATEMENT:
return updateStmt(stmt, {
decls: simplifyExpressionList(stmt.decls) as ReactiveVarDeclaration[],
});
case T_IF_STATEMENT:
return updateStmt(stmt, {
cond: simplifyExpression(stmt.cond),
thenB: simplifyStatement(stmt.thenB)!,
elseB: simplifyStatement(stmt.elseB),
});
case T_RETURN_STATEMENT:
return updateStmt(stmt, {
expr: simplifyExpression(stmt.expr),
});
case T_WHILE_STATEMENT:
return updateStmt(stmt, {
cond: simplifyExpression(stmt.cond),
body: simplifyStatement(stmt.body)!,
});
case T_DO_WHILE_STATEMENT:
return updateStmt(stmt, {
cond: simplifyExpression(stmt.cond),
body: simplifyStatement(stmt.body)!,
});
case T_THROW_STATEMENT:
return updateStmt(stmt, {
expr: simplifyExpression(stmt.expr),
});
case T_TRY_STATEMENT:
return updateStmt(stmt, {
tryB: simplifyStatement(stmt.tryB)! as BlockStatement,
catchB: simplifyStatement(stmt.catchB) as BlockStatement,
finallyB: simplifyStatement(stmt.finallyB) as BlockStatement,
});
case T_FOR_STATEMENT:
return updateStmt(stmt, {
init: simplifyStatement(stmt.init) as ExpressionStatement | LetStatement,
cond: simplifyExpression(stmt.cond),
upd: simplifyExpression(stmt.upd),
body: simplifyStatement(stmt.body)!,
});
case T_FOR_IN_STATEMENT:
return updateStmt(stmt, {
expr: simplifyExpression(stmt.expr),
body: simplifyStatement(stmt.body)!,
});
case T_FOR_OF_STATEMENT:
return updateStmt(stmt, {
expr: simplifyExpression(stmt.expr),
body: simplifyStatement(stmt.body)!,
});
case T_SWITCH_STATEMENT:
return updateStmt(stmt, {
expr: simplifyExpression(stmt.expr),
cases: simplifyExpressionList(stmt.cases) as SwitchCase[],
});
case T_FUNCTION_DECLARATION:
return updateStmt(stmt, {
args: simplifyExpressionList(stmt.args),
stmt: simplifyStatement(stmt.stmt)! as BlockStatement,
});
}
return stmt;
}
}
function simplifyStatementList(stmts?: Statement[]): Statement[] | undefined {
if (!stmts) return stmts;
const newStmtList = stmts.map(simplifyStatement);
const isUpdated = newStmtList.some((stmt, i) => stmt !== stmts[i]);
return isUpdated ? newStmtList : stmts;
}
function simplifyDestructure(destr: ArrayDestructure | ObjectDestructure): ArrayDestructure | ObjectDestructure {
const newArrayDestr = destr.aDestr?.map(simplifyDestructure);
const newObjectDestr = destr.oDestr?.map(simplifyDestructure);
const isUpdated =
newArrayDestr?.some((destr, i) => destr !== destr.aDestr![i]) ||
newObjectDestr?.some((destr, i) => destr !== destr.oDestr![i]);
return isUpdated
? {
...destr,
aDestr: newArrayDestr,
oDestr: newObjectDestr,
} as any
: destr;
}
function simplifyVarDeclaration(destr: VarDeclaration): VarDeclaration {
const newArrayDestr = destr.aDestr?.map(simplifyDestructure);
const newObjectDestr = destr.oDestr?.map(simplifyDestructure);
const newEpr = simplifyExpression(destr.expr);
const isUpdated =
newArrayDestr?.some((destr, i) => destr !== destr.aDestr![i]) ||
newObjectDestr?.some((destr, i) => destr !== destr.oDestr![i]) ||
newEpr !== destr.expr;
return isUpdated
? {
...destr,
aDestr: newArrayDestr,
oDestr: newObjectDestr,
expr: newEpr,
} as any
: destr;
}
function simplifyVarDeclarationList(decls: VarDeclaration[]): VarDeclaration[] {
const newDeclList = decls.map(simplifyVarDeclaration);
const isUpdated = newDeclList.some((decl, i) => decl !== decls[i]);
return isUpdated ? newDeclList : decls;
}
function simplifyObjectLiteral(obj: ObjectLiteral): ObjectLiteral {
const newProps = obj.props.map((prop) => {
if (Array.isArray(prop)) {
const prop0 = simplifyExpression(prop[0]);
const prop1 = simplifyExpression(prop[1]);
return prop0 !== prop[0] || prop1 !== prop[1] ? [prop0, prop1] : prop;
} else {
return {
...prop,
value: simplifyExpression(prop),
};
}
});
const isUpdated = newProps.some((prop, i) => prop !== obj.props[i]);
return isUpdated ? { ...obj, props: newProps } as any : obj;
}
function updateExpr<T extends Expression>(expr: T, props: Partial<T>): T {
const isUpdated = Object.keys(props).some((key: any) => (expr as any)[key] !== (props as any)[key]);
return isUpdated ? { ...expr, ...props } as any : expr;
}
function updateStmt<T extends Statement>(stmt: T, props: Partial<T>): T {
const isUpdated = Object.keys(props).some((key: any) => (stmt as any)[key] !== (props as any)[key]);
return isUpdated ? { ...stmt, ...props } as any : stmt;
}
function simplifyUnaryExpression(unary: UnaryExpression): Expression {
if (unary.expr.type === T_LITERAL) {
let newValue = unary.expr.value;
try {
switch (unary.op) {
case "typeof":
newValue = typeof unary.expr.value;
break;
case "!":
newValue = !unary.expr.value;
break;
case "-":
newValue = -unary.expr.value;
break;
case "~":
newValue = ~unary.expr.value;
break;
}
} catch {
// --- Intentionally ignored. In case of error, we keep the original value
}
if (newValue !== unary.expr.value) {
return { type: "LitE", value: newValue } as any;
}
}
return unary;
}
function simplifyBinaryExpression(binary: BinaryExpression): Expression {
if (binary.left.type === T_LITERAL && binary.right.type === T_LITERAL) {
let newValue: any = undefined;
try {
switch (binary.op) {
case "**":
newValue = binary.left.value ** binary.right.value;
break;
case "*":
newValue = binary.left.value * binary.right.value;
break;
case "/":
newValue = binary.left.value / binary.right.value;
break;
case "%":
newValue = binary.left.value % binary.right.value;
break;
case "+":
newValue = binary.left.value + binary.right.value;
break;
case "-":
newValue = binary.left.value - binary.right.value;
break;
case "<<":
newValue = binary.left.value << binary.right.value;
break;
case ">>":
newValue = binary.left.value >> binary.right.value;
break;
case ">>>":
newValue = binary.left.value >>> binary.right.value;
break;
case "<":
newValue = binary.left.value < binary.right.value;
break;
case "<=":
newValue = binary.left.value <= binary.right.value;
break;
case ">":
newValue = binary.left.value > binary.right.value;
break;
case ">=":
newValue = binary.left.value >= binary.right.value;
break;
case "==":
newValue = binary.left.value == binary.right.value;
break;
case "===":
newValue = binary.left.value === binary.right.value;
break;
case "!=":
newValue = binary.left.value != binary.right.value;
break;
case "!==":
newValue = binary.left.value !== binary.right.value;
break;
case "&":
newValue = binary.left.value & binary.right.value;
break;
case "|":
newValue = binary.left.value | binary.right.value;
break;
case "^":
newValue = binary.left.value ^ binary.right.value;
break;
case "&&":
newValue = binary.left.value && binary.right.value;
break;
case "||":
newValue = binary.left.value || binary.right.value;
break;
}
} catch {
// --- Intentionally ignored. In case of error, we keep the original value
}
if (newValue !== undefined) {
return { type: T_LITERAL, value: newValue } as any;
}
} else if (binary.op === "+" && binary.left.type === T_LITERAL && binary.left.value === 0) {
return binary.right;
} else if (binary.op === "+" && binary.right.type === T_LITERAL && binary.right.value === 0) {
return binary.left;
} else if (binary.op === "-" && binary.right.type === T_LITERAL && binary.right.value === 0) {
return binary.left;
} else if (binary.op === "*" && binary.left.type === T_LITERAL && binary.left.value === 1) {
return binary.right;
} else if (binary.op === "*" && binary.right.type === T_LITERAL && binary.right.value === 1) {
return binary.left;
} else if (binary.op === "*" && binary.right.type === T_LITERAL && binary.right.value === 0) {
return { type: "LitE", value: 0 } as any;
} else if (binary.op === "*" && binary.left.type === T_LITERAL && binary.left.value === 0) {
return { type: "LitE", value: 0 } as any;
} else if (binary.op === "/" && binary.right.type === T_LITERAL && binary.right.value === 1) {
return binary.left;
}
return binary;
}
```
--------------------------------------------------------------------------------
/xmlui/tests/parsers/scripting/parser-arrow.test.ts:
--------------------------------------------------------------------------------
```typescript
import { describe, expect, it, assert } from "vitest";
import { Parser } from "../../../src/parsers/scripting/Parser";
import {
ArrowExpression,
BlockStatement,
Destructure,
FunctionInvocationExpression,
Identifier,
SpreadExpression,
T_ARROW_EXPRESSION,
T_BLOCK_STATEMENT,
T_EXPRESSION_STATEMENT,
T_FUNCTION_INVOCATION_EXPRESSION,
T_LET_STATEMENT,
} from "../../../src/components-core/script-runner/ScriptingSourceTree";
describe("Parser - arrow expressions", () => {
it("No param", () => {
// --- Arrange
const source = "() => 2*v";
const wParser = new Parser(source);
// --- Act
const expr = wParser.parseExpr();
// --- Assert
expect(expr).not.equal(null);
if (!expr) return;
expect(expr.type).equal(T_ARROW_EXPRESSION);
const arrowExpr = expr as ArrowExpression;
expect(arrowExpr.args.length).equal(0);
expect(arrowExpr.statement.type).equal(T_EXPRESSION_STATEMENT);
});
it("Single param", () => {
// --- Arrange
const source = "v => 2*v";
const wParser = new Parser(source);
// --- Act
const expr = wParser.parseExpr();
// --- Assert
expect(expr).not.equal(null);
if (!expr) return;
expect(expr.type).equal(T_ARROW_EXPRESSION);
const arrowExpr = expr as ArrowExpression;
expect(arrowExpr.args.length).equal(1);
expect((arrowExpr.args[0] as Identifier).name).equal("v");
expect(arrowExpr.statement.type).equal(T_EXPRESSION_STATEMENT);
});
it("Single (param)", () => {
// --- Arrange
const source = "(v) => 2*v";
const wParser = new Parser(source);
// --- Act
const expr = wParser.parseExpr();
// --- Assert
expect(expr).not.equal(null);
if (!expr) return;
expect(expr.type).equal(T_ARROW_EXPRESSION);
const arrowExpr = expr as ArrowExpression;
expect(arrowExpr.args.length).equal(1);
expect((arrowExpr.args[0] as Identifier).name).equal("v");
expect(arrowExpr.statement.type).equal(T_EXPRESSION_STATEMENT);
});
const invalidLeftCases = [
"2 => 2*v",
"a+2 => 2*v",
"(a, a+2) => 2*v",
"(a+2) => 2*v",
"(!a) => 2*v",
"((a)) => 2*v",
];
invalidLeftCases.forEach((c) => {
it(`Invalid param: '${c}' `, () => {
// --- Arrange
const wParser = new Parser(c);
// --- Act/Assert
try {
wParser.parseExpr();
} catch (err: any) {
expect(err.toString()).contains("Invalid");
return;
}
assert.fail("Exception expected");
});
});
it("multiple params", () => {
// --- Arrange
const source = "(v, w) => 2*v + w";
const wParser = new Parser(source);
// --- Act
const expr = wParser.parseExpr();
// --- Assert
expect(expr).not.equal(null);
if (!expr) return;
expect(expr.type).equal(T_ARROW_EXPRESSION);
const arrowExpr = expr as ArrowExpression;
expect(arrowExpr.args.length).equal(2);
expect((arrowExpr.args[0] as Identifier).name).equal("v");
expect((arrowExpr.args[1] as Identifier).name).equal("w");
expect(arrowExpr.statement.type).equal(T_EXPRESSION_STATEMENT);
});
it("Block statement #1", () => {
// --- Arrange
const source = "(v, w) => { 2*v + w }";
const wParser = new Parser(source);
// --- Act
const expr = wParser.parseExpr();
// --- Assert
expect(expr).not.equal(null);
if (!expr) return;
expect(expr.type).equal(T_ARROW_EXPRESSION);
const arrowExpr = expr as ArrowExpression;
expect(arrowExpr.args.length).equal(2);
expect((arrowExpr.args[0] as Identifier).name).equal("v");
expect((arrowExpr.args[1] as Identifier).name).equal("w");
expect(arrowExpr.statement.type).equal(T_BLOCK_STATEMENT);
const stmts = arrowExpr.statement as BlockStatement;
expect(stmts.stmts.length).equal(1);
expect(stmts.stmts[0].type).equal(T_EXPRESSION_STATEMENT);
});
it("Block statement #2", () => {
// --- Arrange
const source = "(v, w) => { let x = 3; 2*v + w + x }";
const wParser = new Parser(source);
// --- Act
const expr = wParser.parseExpr();
// --- Assert
expect(expr).not.equal(null);
if (!expr) return;
expect(expr.type).equal(T_ARROW_EXPRESSION);
const arrowExpr = expr as ArrowExpression;
expect(arrowExpr.args.length).equal(2);
expect((arrowExpr.args[0] as Identifier).name).equal("v");
expect((arrowExpr.args[1] as Identifier).name).equal("w");
expect(arrowExpr.statement.type).equal(T_BLOCK_STATEMENT);
const stmts = arrowExpr.statement as BlockStatement;
expect(stmts.stmts.length).equal(2);
expect(stmts.stmts[0].type).equal(T_LET_STATEMENT);
expect(stmts.stmts[1].type).equal(T_EXPRESSION_STATEMENT);
});
it("Block statement #3", () => {
// --- Arrange
const source = "() => { Action.somethings() }";
const wParser = new Parser(source);
// --- Act
const expr = wParser.parseExpr();
// --- Assert
expect(expr).not.equal(null);
if (!expr) return;
expect(expr.type).equal(T_ARROW_EXPRESSION);
const arrowExpr = expr as ArrowExpression;
expect(arrowExpr.args.length).equal(0);
expect(arrowExpr.statement.type).equal(T_BLOCK_STATEMENT);
});
it("Block statement #4", () => {
// --- Arrange
const source =
"(item) => { \n" +
" Actions.DeleteEntityAction({\n" +
' entityId: "apiFile",\n' +
" entityDisplayName: item,\n" +
" params: {\n" +
" nodeId: $props.nodeId,\n" +
" id: item\n" +
" }\n" +
" })\n" +
"}";
const wParser = new Parser(source);
// --- Act
const expr = wParser.parseExpr();
// --- Assert
expect(expr).not.equal(null);
if (!expr) return;
expect(expr.type).equal(T_ARROW_EXPRESSION);
const arrowExpr = expr as ArrowExpression;
expect(arrowExpr.args.length).equal(1);
expect(arrowExpr.statement.type).equal(T_BLOCK_STATEMENT);
});
it("Arrow function invocation #1", () => {
// --- Arrange
const source = "(() => 2*v)()";
const wParser = new Parser(source);
// --- Act
const expr = wParser.parseExpr();
// --- Assert
expect(expr).not.equal(null);
if (!expr) return;
expect(expr.type).equal(T_FUNCTION_INVOCATION_EXPRESSION);
const funcExpr = expr as FunctionInvocationExpression;
expect(funcExpr.arguments.length).equal(0);
expect(funcExpr.obj.type).equal(T_ARROW_EXPRESSION);
});
it("Arrow function invocation #2", () => {
// --- Arrange
const source = "((x, y) => x + y)(12, 23)";
const wParser = new Parser(source);
// --- Act
const expr = wParser.parseExpr();
// --- Assert
expect(expr).not.equal(null);
if (!expr) return;
expect(expr.type).equal(T_FUNCTION_INVOCATION_EXPRESSION);
const funcExpr = expr as FunctionInvocationExpression;
expect(funcExpr.arguments.length).equal(2);
expect(funcExpr.obj.type).equal(T_ARROW_EXPRESSION);
});
it("Arrow function invocation #2", () => {
// --- Arrange
const source = "((x, y) => x + y)(12, 23)";
const wParser = new Parser(source);
// --- Act
const expr = wParser.parseExpr();
// --- Assert
expect(expr).not.equal(null);
if (!expr) return;
expect(expr.type).equal(T_FUNCTION_INVOCATION_EXPRESSION);
const funcExpr = expr as FunctionInvocationExpression;
expect(funcExpr.arguments.length).equal(2);
expect(funcExpr.obj.type).equal(T_ARROW_EXPRESSION);
});
it("Single object destructure #1", () => {
// --- Arrange
const source = "({x, y}) => x + y";
const wParser = new Parser(source);
// --- Act
const expr = wParser.parseExpr();
// --- Assert
expect(expr).not.equal(null);
if (!expr) return;
expect(expr.type).equal(T_ARROW_EXPRESSION);
const arrowExpr = expr as ArrowExpression;
expect(arrowExpr.args.length).equal(1);
expect((arrowExpr.args[0] as Destructure).oDestr![0].id).equal("x");
expect((arrowExpr.args[0] as Destructure).oDestr![1].id).equal("y");
expect(arrowExpr.statement.type).equal(T_EXPRESSION_STATEMENT);
});
it("Single object destructure #2", () => {
// --- Arrange
const source = "({x, y:q}) => x + q";
const wParser = new Parser(source);
// --- Act
const expr = wParser.parseExpr();
// --- Assert
expect(expr).not.equal(null);
if (!expr) return;
expect(expr.type).equal(T_ARROW_EXPRESSION);
const arrowExpr = expr as ArrowExpression;
expect(arrowExpr.args.length).equal(1);
expect((arrowExpr.args[0] as Destructure).oDestr![0].id).equal("x");
expect((arrowExpr.args[0] as Destructure).oDestr![1].id).equal("y");
expect((arrowExpr.args[0] as Destructure).oDestr![1].alias).equal("q");
expect(arrowExpr.statement.type).equal(T_EXPRESSION_STATEMENT);
});
it("Single object destructure #3", () => {
// --- Arrange
const source = "({x, y: {v, w}}) => 3";
const wParser = new Parser(source);
// --- Act
const expr = wParser.parseExpr();
// --- Assert
expect(expr).not.equal(null);
if (!expr) return;
expect(expr.type).equal(T_ARROW_EXPRESSION);
const arrowExpr = expr as ArrowExpression;
expect(arrowExpr.args.length).equal(1);
expect((arrowExpr.args[0] as Destructure).oDestr![0].id).equal("x");
expect((arrowExpr.args[0] as Destructure).oDestr![1].oDestr![0].id).equal("v");
expect((arrowExpr.args[0] as Destructure).oDestr![1].oDestr![1].id).equal("w");
expect(arrowExpr.statement.type).equal(T_EXPRESSION_STATEMENT);
});
it("Single array destructure #1", () => {
// --- Arrange
const source = "([x, y]) => x + y";
const wParser = new Parser(source);
// --- Act
const expr = wParser.parseExpr();
// --- Assert
expect(expr).not.equal(null);
if (!expr) return;
expect(expr.type).equal(T_ARROW_EXPRESSION);
const arrowExpr = expr as ArrowExpression;
expect(arrowExpr.args.length).equal(1);
expect((arrowExpr.args[0] as Destructure).aDestr![0].id).equal("x");
expect((arrowExpr.args[0] as Destructure).aDestr![1].id).equal("y");
expect(arrowExpr.statement.type).equal(T_EXPRESSION_STATEMENT);
});
it("Single array destructure #2", () => {
// --- Arrange
const source = "([x,, y]) => x + y";
const wParser = new Parser(source);
// --- Act
const expr = wParser.parseExpr();
// --- Assert
expect(expr).not.equal(null);
if (!expr) return;
expect(expr.type).equal(T_ARROW_EXPRESSION);
const arrowExpr = expr as ArrowExpression;
expect(arrowExpr.args.length).equal(1);
expect((arrowExpr.args[0] as Destructure).aDestr![0].id).equal("x");
expect((arrowExpr.args[0] as Destructure).aDestr![1].id).equal(undefined);
expect((arrowExpr.args[0] as Destructure).aDestr![2].id).equal("y");
expect(arrowExpr.statement.type).equal(T_EXPRESSION_STATEMENT);
});
it("Complex destructure #1", () => {
// --- Arrange
const source = "([a,, b], {c, y:d}) => 1";
const wParser = new Parser(source);
// --- Act
const expr = wParser.parseExpr();
// --- Assert
expect(expr).not.equal(null);
if (!expr) return;
expect(expr.type).equal(T_ARROW_EXPRESSION);
const arrowExpr = expr as ArrowExpression;
expect(arrowExpr.args.length).equal(2);
expect((arrowExpr.args[0] as Destructure).aDestr![0].id).equal("a");
expect((arrowExpr.args[0] as Destructure).aDestr![1].id).equal(undefined);
expect((arrowExpr.args[0] as Destructure).aDestr![2].id).equal("b");
expect((arrowExpr.args[1] as Destructure).oDestr![0].id).equal("c");
expect((arrowExpr.args[1] as Destructure).oDestr![1].id).equal("y");
expect((arrowExpr.args[1] as Destructure).oDestr![1].alias).equal("d");
expect(arrowExpr.statement.type).equal(T_EXPRESSION_STATEMENT);
});
it("Complex destructure #2", () => {
// --- Arrange
const source = "([a,, b], {c, y:d}, e) => 1";
const wParser = new Parser(source);
// --- Act
const expr = wParser.parseExpr();
// --- Assert
expect(expr).not.equal(null);
if (!expr) return;
expect(expr.type).equal(T_ARROW_EXPRESSION);
const arrowExpr = expr as ArrowExpression;
expect(arrowExpr.args.length).equal(3);
expect((arrowExpr.args[0] as Destructure).aDestr![0].id).equal("a");
expect((arrowExpr.args[0] as Destructure).aDestr![1].id).equal(undefined);
expect((arrowExpr.args[0] as Destructure).aDestr![2].id).equal("b");
expect((arrowExpr.args[1] as Destructure).oDestr![0].id).equal("c");
expect((arrowExpr.args[1] as Destructure).oDestr![1].id).equal("y");
expect((arrowExpr.args[2] as Identifier).name).equal("e");
expect(arrowExpr.statement.type).equal(T_EXPRESSION_STATEMENT);
});
it("Single rest param", () => {
// --- Arrange
const source = "(...v) => 2*v";
const wParser = new Parser(source);
// --- Act
const expr = wParser.parseExpr();
// --- Assert
expect(expr).not.equal(null);
if (!expr) return;
expect(expr.type).equal(T_ARROW_EXPRESSION);
const arrowExpr = expr as ArrowExpression;
expect(arrowExpr.args.length).equal(1);
const spread = arrowExpr.args[0] as SpreadExpression;
expect((spread.expr as Identifier).name).equal("v");
expect(arrowExpr.statement.type).equal(T_EXPRESSION_STATEMENT);
});
it("Multiple rest param", () => {
// --- Arrange
const source = "(v, ...w) => 2*v";
const wParser = new Parser(source);
// --- Act
const expr = wParser.parseExpr();
// --- Assert
expect(expr).not.equal(null);
if (!expr) return;
expect(expr.type).equal(T_ARROW_EXPRESSION);
const arrowExpr = expr as ArrowExpression;
expect(arrowExpr.args.length).equal(2);
const id = arrowExpr.args[0] as Identifier;
expect(id.name).equal("v");
const spread = arrowExpr.args[1] as SpreadExpression;
expect((spread.expr as Identifier).name).equal("w");
expect(arrowExpr.statement.type).equal(T_EXPRESSION_STATEMENT);
});
it("Fails with rest params #1", () => {
// --- Arrange
const source = "(...a, b) => { return 2*v; }";
const wParser = new Parser(source);
// --- Act
try {
wParser.parseStatements()!;
} catch (err) {
// --- Assert
expect(err.toString().includes("argument")).toBe(true);
return;
}
assert.fail("Exception expected");
});
it("Fails with rest params #2", () => {
// --- Arrange
const source = "(...(a+b)) => { return 2*v; }";
const wParser = new Parser(source);
// --- Act
try {
wParser.parseStatements()!;
} catch (err) {
// --- Assert
expect(err.toString().includes("argument")).toBe(true);
return;
}
assert.fail("Exception expected");
});
});
```
--------------------------------------------------------------------------------
/xmlui/src/testing/assertions.ts:
--------------------------------------------------------------------------------
```typescript
import { expect as baseExpect } from "@playwright/test";
import type { Locator } from "playwright-core";
import {
type BorderSide,
type CSSBorder,
type CSSBorderStyle,
type CSSColor,
type NumericCSS,
isBorderSide,
numericCSSToString,
parseAsCssBorder,
parseAsCSSBorderStyle,
parseAsCSSColor,
parseAsNumericCss,
} from "./component-test-helpers";
// --- Extending Expect
export const expect = baseExpect.extend({
/**
* Asserts whether the Button component has the expected label either through the `label` property
* or as a text node child.
*
* **Usage**
*
* ```js
* await initTestBed(`<Button label="hello" />`);
* const driver = await createButtonDriver();
* await expect(driver.component).toHaveLabel("hello"); // <- resolves to true
* ```
*
* @param expected Expected string label
*/
async toHaveExplicitLabel(locator: Locator, expected: string) {
const assertionName = "toHaveExplicitLabel";
let pass = false;
const label = await locator.evaluate(
(element) =>
[...element.childNodes]
.filter((e) => e.nodeType === Node.TEXT_NODE && e.textContent.trim())
.map((e) => e.textContent.trim())?.[0],
);
if (label === expected) {
pass = true;
}
const message = pass
? () =>
this.utils.matcherHint(assertionName, locator, expected, { isNot: this.isNot }) +
"\n\n" +
`Expected: ${this.isNot ? "not" : ""}${this.utils.printExpected(expected)}\n` +
`Received: ${this.utils.printReceived(label)}`
: () =>
this.utils.matcherHint(assertionName, locator, expected, { isNot: this.isNot }) +
"\n\n" +
`Expected: ${this.utils.printExpected(expected)}\n` +
`Received: ${this.utils.printReceived(label)}`;
return {
message,
pass,
name: assertionName,
expected,
actual: undefined,
};
},
/**
* Compares two numbers with an optional tolerance value. If the tolerance is set to 0 the comparator acts as `toEqual`.
* Used to compare element dimensions on different platforms because of half pixel rendering.
*
* **Usage**
*
* ```js
* const value = 8;
* expect(value).toEqualWithTolerance(10, 2); // true
* ```
*
* @param expected Expected value
* @param tolerance Tolerance value, **default is 1**
*/
toEqualWithTolerance(provided: number, expected: number, tolerance: number = 1) {
const assertionName = "toEqualWithTolerance";
let pass = false;
if (provided >= expected - (tolerance || 0) && provided <= expected + (tolerance || 0)) {
pass = true;
}
const message = pass
? () =>
this.utils.matcherHint(assertionName, provided, expected, { isNot: this.isNot }) +
"\n\n" +
`Expected: ${this.isNot ? "not" : ""}${this.utils.printExpected(expected)}\n` +
`Received: ${this.utils.printReceived(provided)}`
: () =>
this.utils.matcherHint(assertionName, provided, expected, { isNot: this.isNot }) +
"\n\n" +
`Expected: ${this.utils.printExpected(expected)}\n` +
`Received: ${this.utils.printReceived(provided)}`;
return {
message,
pass,
name: assertionName,
expected,
actual: undefined,
};
},
// ---
// --- NOTE: Assertations below this line are experimental and are reserved for future test cases (ex. comparison tests)
// ---
/**
* Asserts whether a component has the correct CSS `border-color` styling.
*
* @param expected Expected CSS color
* @param border Border side(s), Default: **"all"**
*
* ---
* **Usage**
*
* ```js
* await initTestBed(`<Button label="hello" />`, {
* testThemeVars: { "borderLeftColor-Button": "rgb(0, 0, 0)" },
* });
* const driver = await createButtonDriver();
* await expect(driver.component).toHaveBorderColor("rgb(0, 0, 0)", "left");
* ```
*/
async toHaveBorderColor(
locator: Locator,
expected: string,
border: "all" | BorderSide | BorderSide[] = "all",
) {
const assertionName = "toHaveBorder";
let expectedBorderColor: CSSColor;
try {
expectedBorderColor = parseAsCSSColor(expected);
if (Object.values(expectedBorderColor).length === 0) {
throw new Error("Empty color!");
}
} catch (e) {
return {
message: () =>
"In " +
this.utils.matcherHint(assertionName, locator, expected, { isNot: this.isNot }) +
":\n" +
(e instanceof Error ? e.message : String(e)) +
"\n\n" +
`Expected: Correct CSS border color to expect (e.g. "red", "rgb(0, 0, 0)", "#AA0011")\n` +
`Received: ${this.utils.printReceived(expected)}`,
pass: false,
name: assertionName,
expected,
actual: undefined,
};
}
let _border: BorderSide[] = [];
if (typeof border === "string") {
if (border === "all") {
_border = ["top", "bottom", "left", "right"];
} else {
_border = [border];
}
} else {
_border = Array.from(new Set(border)).filter(isBorderSide);
}
let pass = true;
let matcherResult: any;
const colorStr = `rgb(${expectedBorderColor.rgb().join(", ")})`;
try {
for (let b of _border) {
await baseExpect(locator).toHaveCSS(`border-${b}-color`, colorStr);
}
} catch (e: any) {
matcherResult = e.matcherResult;
pass = false;
}
const message = pass
? () =>
this.utils.matcherHint(assertionName, undefined, undefined, { isNot: this.isNot }) +
"\n\n" +
`Expected: not ${this.utils.printExpected(expected)}\n` +
(matcherResult ? `Received: ${this.utils.printReceived(matcherResult.actual)}` : "")
: () =>
this.utils.matcherHint(assertionName, undefined, undefined, { isNot: this.isNot }) +
"\n\n" +
`Expected: ${this.utils.printExpected(expected)}\n` +
(matcherResult ? `Received: ${this.utils.printReceived(matcherResult.actual)}` : "");
return {
message,
pass,
name: assertionName,
expected,
actual: matcherResult?.actual,
};
},
/**
* Asserts whether a component has the correct CSS `border-width` styling.
*
* @param expected Expected CSS size
* @param border Border side(s), Default: **"all"**
*
* ---
* **Usage**
*
* ```js
* await initTestBed(`<Button label="hello" />`, {
* testThemeVars: { "borderLeftWidth-Button": "12px" },
* });
* const driver = await createButtonDriver();
* await expect(driver.component).toHaveBorderWidth("12px", "left");
* ```
*/
async toHaveBorderWidth(
locator: Locator,
expected: string,
border: "all" | BorderSide | BorderSide[] = "all",
) {
const assertionName = "toHaveBorder";
let expectedBorderWidth: NumericCSS;
try {
expectedBorderWidth = parseAsNumericCss(expected);
if (Object.values(expectedBorderWidth).length === 0) {
throw new Error("Empty width!");
}
} catch (e) {
return {
message: () =>
"In " +
this.utils.matcherHint(assertionName, locator, expected, { isNot: this.isNot }) +
":\n" +
(e instanceof Error ? e.message : String(e)) +
"\n\n" +
`Expected: Correct CSS border width to expect (e.g. "1px", "2rem")\n` +
`Received: ${this.utils.printReceived(expected)}`,
pass: false,
name: assertionName,
expected,
actual: undefined,
};
}
let _border: BorderSide[] = [];
if (typeof border === "string") {
if (border === "all") {
_border = ["top", "bottom", "left", "right"];
} else {
_border = [border];
}
} else {
_border = Array.from(new Set(border)).filter(isBorderSide);
}
let pass = true;
let matcherResult: any;
const widthStr = numericCSSToString(expectedBorderWidth);
try {
for (let b of _border) {
await baseExpect(locator).toHaveCSS(`border-${b}-width`, widthStr);
}
} catch (e: any) {
matcherResult = e.matcherResult;
pass = false;
}
const message = pass
? () =>
this.utils.matcherHint(assertionName, undefined, undefined, { isNot: this.isNot }) +
"\n\n" +
`Expected: not ${this.utils.printExpected(expected)}\n` +
(matcherResult ? `Received: ${this.utils.printReceived(matcherResult.actual)}` : "")
: () =>
this.utils.matcherHint(assertionName, undefined, undefined, { isNot: this.isNot }) +
"\n\n" +
`Expected: ${this.utils.printExpected(expected)}\n` +
(matcherResult ? `Received: ${this.utils.printReceived(matcherResult.actual)}` : "");
return {
message,
pass,
name: assertionName,
expected,
actual: matcherResult?.actual,
};
},
/**
* Asserts whether a component has the correct CSS `border-style` styling.
*
* @param expected Expected CSS border style
* @param border Border side(s), default: **"all"**
*
* ---
* **Usage**
*
* ```js
* await initTestBed(`<Button label="hello" />`, {
* testThemeVars: { "borderLeftStyle-Button": "dotted" },
* });
* const driver = await createButtonDriver();
* await expect(driver.component).toHaveBorderStyle("dotted", "left");
* ```
*/
async toHaveBorderStyle(
locator: Locator,
expected: string,
border: "all" | BorderSide | BorderSide[] = "all",
) {
const assertionName = "toHaveBorder";
let expectedBorderStyle: CSSBorderStyle;
try {
expectedBorderStyle = parseAsCSSBorderStyle(expected);
if (Object.values(expectedBorderStyle).length === 0) {
throw new Error("Empty border style!");
}
} catch (e) {
return {
message: () =>
"In " +
this.utils.matcherHint(assertionName, locator, expected, { isNot: this.isNot }) +
":\n" +
(e instanceof Error ? e.message : String(e)) +
"\n\n" +
`Expected: Correct CSS border style to expect (e.g. "1px solid black")\n` +
`Received: ${this.utils.printReceived(expected)}`,
pass: false,
name: assertionName,
expected,
actual: undefined,
};
}
let _border: BorderSide[] = [];
if (typeof border === "string") {
if (border === "all") {
_border = ["top", "bottom", "left", "right"];
} else {
_border = [border];
}
} else {
_border = Array.from(new Set(border)).filter(isBorderSide);
}
let pass = true;
let matcherResult: any;
try {
for (let b of _border) {
await baseExpect(locator).toHaveCSS(`border-${b}-style`, expectedBorderStyle);
}
} catch (e: any) {
matcherResult = e.matcherResult;
pass = false;
}
const message = pass
? () =>
this.utils.matcherHint(assertionName, undefined, undefined, { isNot: this.isNot }) +
"\n\n" +
`Expected: not ${this.utils.printExpected(expected)}\n` +
(matcherResult ? `Received: ${this.utils.printReceived(matcherResult.actual)}` : "")
: () =>
this.utils.matcherHint(assertionName, undefined, undefined, { isNot: this.isNot }) +
"\n\n" +
`Expected: ${this.utils.printExpected(expected)}\n` +
(matcherResult ? `Received: ${this.utils.printReceived(matcherResult.actual)}` : "");
return {
message,
pass,
name: assertionName,
expected,
actual: matcherResult?.actual,
};
},
/**
* Asserts whether a component has the correct CSS `border` shorthand set:
* `color`, `width`, `style`.
*
* @param expected Expected string label
* @param border Border side(s), Default: **"all"**
*
* ---
* **Usage**
*
* ```js
* await initTestBed(`<Button label="hello" />`, {
* testThemeVars: { "borderLeft-Button": "1px solid black" },
* });
* const driver = await createButtonDriver();
* await expect(driver.component).toHaveBorder("1px solid black", "left");
* ```
*/
async toHaveBorder(
locator: Locator,
expected: string,
border: "all" | BorderSide | BorderSide[] = "all",
) {
const assertionName = "toHaveBorder";
let expectedBorder: CSSBorder;
try {
expectedBorder = parseAsCssBorder(expected);
if (Object.values(expectedBorder).length === 0) {
throw new Error("Empty style!");
}
} catch (e) {
return {
message: () =>
"In " +
this.utils.matcherHint(assertionName, locator, expected, { isNot: this.isNot }) +
":\n" +
(e instanceof Error ? e.message : String(e)) +
"\n\n" +
`Expected: Correct CSS border style to expect (e.g. "1px solid black")\n` +
`Received: ${this.utils.printReceived(expected)}`,
pass: false,
name: assertionName,
expected,
actual: undefined,
};
}
let _border: BorderSide[] = [];
if (typeof border === "string") {
if (border === "all") {
_border = ["top", "bottom", "left", "right"];
} else {
_border = [border];
}
} else {
_border = Array.from(new Set(border)).filter(isBorderSide);
}
let pass = true;
let matcherResult: any;
try {
if (expectedBorder?.color) {
const colorStr = `rgb(${expectedBorder.color.rgb().join(", ")})`;
await expect(locator).toHaveBorderColor(colorStr, _border);
}
if (expectedBorder?.width) {
await expect(locator).toHaveBorderWidth(numericCSSToString(expectedBorder.width), _border);
}
if (expectedBorder?.style) {
await expect(locator).toHaveBorderStyle(expectedBorder.style, _border);
}
} catch (e: any) {
matcherResult = e.matcherResult;
pass = false;
}
const message = pass
? () =>
this.utils.matcherHint(assertionName, undefined, undefined, { isNot: this.isNot }) +
"\n\n" +
`Expected: not ${this.utils.printExpected(expected)}\n` +
(matcherResult ? `Received: ${this.utils.printReceived(matcherResult.actual)}` : "")
: () =>
this.utils.matcherHint(assertionName, undefined, undefined, { isNot: this.isNot }) +
"\n\n" +
`Expected: ${this.utils.printExpected(expected)}\n` +
(matcherResult ? `Received: ${this.utils.printReceived(matcherResult.actual)}` : "");
return {
message,
pass,
name: assertionName,
expected,
actual: matcherResult?.actual,
};
},
});
```
--------------------------------------------------------------------------------
/docs/content/extensions/xmlui-website-blocks/HeroSection.md:
--------------------------------------------------------------------------------
```markdown
# HeroSection [#herosection]
HeroSection
## Properties
### `backgroundTemplate`
The template for the background of the hero section
### `className`
Additional CSS class names to apply to the hero section
### `contentAlignment` (default: "center")
Horizontal alignment of the content within its area
### `contentPlacement` (default: "bottom")
Position of the content area relative to the header
### `contentTone` (default: "dark")
The tone for the content section, affecting text colors
### `contentWidth` (default: "$maxWidth-content")
Width of the hero content (header + content sections)
### `ctaButtonIcon`
The icon for the call-to-action button
### `ctaButtonTemplate`
The template for the call-to-action button
### `ctaButtonText`
The text for the call-to-action button
### `fullWidthBackground` (default: true)
Whether the background should span the full width of the viewport
### `gap`
Gap between header and content sections
### `headerAlignment` (default: "center")
Alignment of the header content
### `headerTone` (default: "dark")
The tone for the header section, affecting text colors
### `headerWidth` (default: "50%")
Width of the header section in horizontal layouts
### `headline`
The headline text for the hero section
### `image`
The image for the hero section
### `imageHeight`
The height of the image
### `imageWidth`
The width of the image
### `mainText`
The main text content for the hero section
### `mainTextTemplate`
The template for the text content in the hero section
### `preamble`
The preamble text for the hero section
### `subheadline`
The subheadline text for the hero section
## Events
### `ctaClick`
Triggered when the call-to-action button is clicked
## Exposed Methods
This component does not expose any methods.
## Parts
The component has some parts that can be styled through layout properties and theme variables separately:
- **`background`**: The background template area of the hero section
- **`content`**: The content section containing image and children
- **`ctaButton`**: The call-to-action button for the hero section
- **`header`**: The header section containing all text content and CTA button
- **`headingSection`**: The heading section containing preamble, headline, and subheadline
- **`headline`**: The headline text for the hero section
- **`image`**: The image for the hero section
- **`mainText`**: The main text content for the hero section
- **`preamble`**: The preamble text for the hero section
- **`subheadline`**: The subheadline text for the hero section
## Styling
### Theme Variables
| Variable | Default Value (Light) | Default Value (Dark) |
| --- | --- | --- |
| [backgroundColor](../styles-and-themes/common-units/#color)-headline-HeroSection | *none* | *none* |
| [backgroundColor](../styles-and-themes/common-units/#color)-mainText-HeroSection | *none* | *none* |
| [backgroundColor](../styles-and-themes/common-units/#color)-preamble-HeroSection | *none* | *none* |
| [backgroundColor](../styles-and-themes/common-units/#color)-subheadline-HeroSection | *none* | *none* |
| [direction](../styles-and-themes/layout-props#direction)-headline-HeroSection | *none* | *none* |
| [direction](../styles-and-themes/layout-props#direction)-mainText-HeroSection | *none* | *none* |
| [direction](../styles-and-themes/layout-props#direction)-preamble-HeroSection | *none* | *none* |
| [direction](../styles-and-themes/layout-props#direction)-subheadline-HeroSection | *none* | *none* |
| [fontFamily](../styles-and-themes/common-units/#fontFamily)-headline-HeroSection | *none* | *none* |
| [fontFamily](../styles-and-themes/common-units/#fontFamily)-mainText-HeroSection | *none* | *none* |
| [fontFamily](../styles-and-themes/common-units/#fontFamily)-preamble-HeroSection | *none* | *none* |
| [fontFamily](../styles-and-themes/common-units/#fontFamily)-subheadline-HeroSection | *none* | *none* |
| [fontSize](../styles-and-themes/common-units/#size)-headline-HeroSection | 3em | 3em |
| [fontSize](../styles-and-themes/common-units/#size)-mainText-HeroSection | 1.4em | 1.4em |
| [fontSize](../styles-and-themes/common-units/#size)-preamble-HeroSection | *none* | *none* |
| [fontSize](../styles-and-themes/common-units/#size)-subheadline-HeroSection | 2em | 2em |
| [fontStretch](../styles-and-themes/common-units/#fontStretch)-headline-HeroSection | *none* | *none* |
| [fontStretch](../styles-and-themes/common-units/#fontStretch)-mainText-HeroSection | *none* | *none* |
| [fontStretch](../styles-and-themes/common-units/#fontStretch)-preamble-HeroSection | *none* | *none* |
| [fontStretch](../styles-and-themes/common-units/#fontStretch)-subheadline-HeroSection | *none* | *none* |
| [fontStyle](../styles-and-themes/common-units/#fontStyle)-headline-HeroSection | *none* | *none* |
| [fontStyle](../styles-and-themes/common-units/#fontStyle)-mainText-HeroSection | *none* | *none* |
| [fontStyle](../styles-and-themes/common-units/#fontStyle)-preamble-HeroSection | *none* | *none* |
| [fontStyle](../styles-and-themes/common-units/#fontStyle)-subheadline-HeroSection | *none* | *none* |
| [fontVariant](../styles-and-themes/common-units/#font-variant)-headline-HeroSection | *none* | *none* |
| [fontVariant](../styles-and-themes/common-units/#font-variant)-mainText-HeroSection | *none* | *none* |
| [fontVariant](../styles-and-themes/common-units/#font-variant)-preamble-HeroSection | *none* | *none* |
| [fontVariant](../styles-and-themes/common-units/#font-variant)-subheadline-HeroSection | *none* | *none* |
| [fontWeight](../styles-and-themes/common-units/#fontWeight)-headline-HeroSection | $fontWeight-bold | $fontWeight-bold |
| [fontWeight](../styles-and-themes/common-units/#fontWeight)-mainText-HeroSection | *none* | *none* |
| [fontWeight](../styles-and-themes/common-units/#fontWeight)-preamble-HeroSection | *none* | *none* |
| [fontWeight](../styles-and-themes/common-units/#fontWeight)-subheadline-HeroSection | $fontWeight-bold | $fontWeight-bold |
| [gap](../styles-and-themes/common-units/#size)-headline-HeroSection | $space-8 | $space-8 |
| [gap](../styles-and-themes/common-units/#size)-mainText-HeroSection | $space-4 | $space-4 |
| [gap](../styles-and-themes/common-units/#size)-preamble-HeroSection | *none* | *none* |
| [gap](../styles-and-themes/common-units/#size)-subheadline-HeroSection | $space-4 | $space-4 |
| [letterSpacing](../styles-and-themes/common-units/#size)-headline-HeroSection | *none* | *none* |
| [letterSpacing](../styles-and-themes/common-units/#size)-mainText-HeroSection | *none* | *none* |
| [letterSpacing](../styles-and-themes/common-units/#size)-preamble-HeroSection | *none* | *none* |
| [letterSpacing](../styles-and-themes/common-units/#size)-subheadline-HeroSection | *none* | *none* |
| [lineBreak](../styles-and-themes/common-units/#line-break)-headline-HeroSection | *none* | *none* |
| [lineBreak](../styles-and-themes/common-units/#line-break)-mainText-HeroSection | *none* | *none* |
| [lineBreak](../styles-and-themes/common-units/#line-break)-preamble-HeroSection | *none* | *none* |
| [lineBreak](../styles-and-themes/common-units/#line-break)-subheadline-HeroSection | *none* | *none* |
| [lineHeight](../styles-and-themes/common-units/#size)-headline-HeroSection | 1.4em | 1.4em |
| [lineHeight](../styles-and-themes/common-units/#size)-mainText-HeroSection | 1.1em | 1.1em |
| [lineHeight](../styles-and-themes/common-units/#size)-preamble-HeroSection | *none* | *none* |
| [lineHeight](../styles-and-themes/common-units/#size)-subheadline-HeroSection | 1.1em | 1.1em |
| [maxWidth-content](../styles-and-themes/common-units/#size) | *none* | *none* |
| [padding](../styles-and-themes/common-units/#size)-HeroSection | *none* | *none* |
| [paddingBottom](../styles-and-themes/common-units/#size)-HeroSection | $space-12 | $space-12 |
| [paddingHorizontal](../styles-and-themes/common-units/#size)-HeroSection | $space-12 | $space-12 |
| [paddingLeft](../styles-and-themes/common-units/#size)-HeroSection | *none* | *none* |
| [paddingRight](../styles-and-themes/common-units/#size)-HeroSection | *none* | *none* |
| [paddingTop](../styles-and-themes/common-units/#size)-HeroSection | $space-12 | $space-12 |
| [paddingVertical](../styles-and-themes/common-units/#size)-HeroSection | *none* | *none* |
| [textAlign](../styles-and-themes/common-units/#text-align)-headline-HeroSection | *none* | *none* |
| [textAlign](../styles-and-themes/common-units/#text-align)-mainText-HeroSection | *none* | *none* |
| [textAlign](../styles-and-themes/common-units/#text-align)-preamble-HeroSection | *none* | *none* |
| [textAlign](../styles-and-themes/common-units/#text-align)-subheadline-HeroSection | *none* | *none* |
| [textAlignLast](../styles-and-themes/common-units/#text-align)-headline-HeroSection | *none* | *none* |
| [textAlignLast](../styles-and-themes/common-units/#text-align)-mainText-HeroSection | *none* | *none* |
| [textAlignLast](../styles-and-themes/common-units/#text-align)-preamble-HeroSection | *none* | *none* |
| [textAlignLast](../styles-and-themes/common-units/#text-align)-subheadline-HeroSection | *none* | *none* |
| [textColor](../styles-and-themes/common-units/#color)-headline-HeroSection | $textColor-primary | $textColor-primary |
| [textColor](../styles-and-themes/common-units/#color)-mainText-HeroSection | $textColor-primary | $textColor-primary |
| [textColor](../styles-and-themes/common-units/#color)-preamble-HeroSection | $textColor-primary | $textColor-primary |
| [textColor](../styles-and-themes/common-units/#color)-subheadline-HeroSection | $textColor-primary | $textColor-primary |
| [textDecorationColor](../styles-and-themes/common-units/#color)-headline-HeroSection | *none* | *none* |
| [textDecorationColor](../styles-and-themes/common-units/#color)-mainText-HeroSection | *none* | *none* |
| [textDecorationColor](../styles-and-themes/common-units/#color)-preamble-HeroSection | *none* | *none* |
| [textDecorationColor](../styles-and-themes/common-units/#color)-subheadline-HeroSection | *none* | *none* |
| [textDecorationLine](../styles-and-themes/common-units/#textDecoration)-headline-HeroSection | *none* | *none* |
| [textDecorationLine](../styles-and-themes/common-units/#textDecoration)-mainText-HeroSection | *none* | *none* |
| [textDecorationLine](../styles-and-themes/common-units/#textDecoration)-preamble-HeroSection | *none* | *none* |
| [textDecorationLine](../styles-and-themes/common-units/#textDecoration)-subheadline-HeroSection | *none* | *none* |
| [textDecorationStyle](../styles-and-themes/common-units/#textDecoration)-headline-HeroSection | *none* | *none* |
| [textDecorationStyle](../styles-and-themes/common-units/#textDecoration)-mainText-HeroSection | *none* | *none* |
| [textDecorationStyle](../styles-and-themes/common-units/#textDecoration)-preamble-HeroSection | *none* | *none* |
| [textDecorationStyle](../styles-and-themes/common-units/#textDecoration)-subheadline-HeroSection | *none* | *none* |
| [textDecorationThickness](../styles-and-themes/common-units/#textDecoration)-headline-HeroSection | *none* | *none* |
| [textDecorationThickness](../styles-and-themes/common-units/#textDecoration)-mainText-HeroSection | *none* | *none* |
| [textDecorationThickness](../styles-and-themes/common-units/#textDecoration)-preamble-HeroSection | *none* | *none* |
| [textDecorationThickness](../styles-and-themes/common-units/#textDecoration)-subheadline-HeroSection | *none* | *none* |
| [textIndent](../styles-and-themes/common-units/#text-indent)-headline-HeroSection | *none* | *none* |
| [textIndent](../styles-and-themes/common-units/#text-indent)-mainText-HeroSection | *none* | *none* |
| [textIndent](../styles-and-themes/common-units/#text-indent)-preamble-HeroSection | *none* | *none* |
| [textIndent](../styles-and-themes/common-units/#text-indent)-subheadline-HeroSection | *none* | *none* |
| [textShadow](../styles-and-themes/common-units/#text-shadow)-headline-HeroSection | *none* | *none* |
| [textShadow](../styles-and-themes/common-units/#text-shadow)-mainText-HeroSection | *none* | *none* |
| [textShadow](../styles-and-themes/common-units/#text-shadow)-preamble-HeroSection | *none* | *none* |
| [textShadow](../styles-and-themes/common-units/#text-shadow)-subheadline-HeroSection | *none* | *none* |
| [textTransform](../styles-and-themes/common-units/#textTransform)-headline-HeroSection | *none* | *none* |
| [textTransform](../styles-and-themes/common-units/#textTransform)-mainText-HeroSection | *none* | *none* |
| [textTransform](../styles-and-themes/common-units/#textTransform)-preamble-HeroSection | *none* | *none* |
| [textTransform](../styles-and-themes/common-units/#textTransform)-subheadline-HeroSection | *none* | *none* |
| [textUnderlineOffset](../styles-and-themes/common-units/#size)-headline-HeroSection | *none* | *none* |
| [textUnderlineOffset](../styles-and-themes/common-units/#size)-mainText-HeroSection | *none* | *none* |
| [textUnderlineOffset](../styles-and-themes/common-units/#size)-preamble-HeroSection | *none* | *none* |
| [textUnderlineOffset](../styles-and-themes/common-units/#size)-subheadline-HeroSection | *none* | *none* |
| [wordBreak](../styles-and-themes/common-units/#word-break)-headline-HeroSection | *none* | *none* |
| [wordBreak](../styles-and-themes/common-units/#word-break)-mainText-HeroSection | *none* | *none* |
| [wordBreak](../styles-and-themes/common-units/#word-break)-preamble-HeroSection | *none* | *none* |
| [wordBreak](../styles-and-themes/common-units/#word-break)-subheadline-HeroSection | *none* | *none* |
| [wordSpacing](../styles-and-themes/common-units/#word-spacing)-headline-HeroSection | *none* | *none* |
| [wordSpacing](../styles-and-themes/common-units/#word-spacing)-mainText-HeroSection | *none* | *none* |
| [wordSpacing](../styles-and-themes/common-units/#word-spacing)-preamble-HeroSection | *none* | *none* |
| [wordSpacing](../styles-and-themes/common-units/#word-spacing)-subheadline-HeroSection | *none* | *none* |
| [wordWrap](../styles-and-themes/common-units/#word-wrap)-headline-HeroSection | *none* | *none* |
| [wordWrap](../styles-and-themes/common-units/#word-wrap)-mainText-HeroSection | *none* | *none* |
| [wordWrap](../styles-and-themes/common-units/#word-wrap)-preamble-HeroSection | *none* | *none* |
| [wordWrap](../styles-and-themes/common-units/#word-wrap)-subheadline-HeroSection | *none* | *none* |
| [writingMode](../styles-and-themes/common-units/#writing-mode)-headline-HeroSection | *none* | *none* |
| [writingMode](../styles-and-themes/common-units/#writing-mode)-mainText-HeroSection | *none* | *none* |
| [writingMode](../styles-and-themes/common-units/#writing-mode)-preamble-HeroSection | *none* | *none* |
| [writingMode](../styles-and-themes/common-units/#writing-mode)-subheadline-HeroSection | *none* | *none* |
```
--------------------------------------------------------------------------------
/xmlui/tests/parsers/scripting/process-try-sync.test.ts:
--------------------------------------------------------------------------------
```typescript
import { describe, expect, it, assert } from "vitest";
import { processStatementQueue } from "../../../src/components-core/script-runner/process-statement-sync";
import { createEvalContext, parseStatements } from "./test-helpers";
describe("Process try statements (sync)", () => {
it("throw", () => {
// --- Arrange
const source = `
throw { type: 'Error' }
`;
const evalContext = createEvalContext({
localContext: {
x: 1,
},
});
const statements = parseStatements(source);
// --- Act
try {
processStatementQueue(statements, evalContext);
} catch (err: any) {
expect(err.errorObject.type).equal("Error");
return;
}
assert.fail("Exception expected");
});
it("throw a given Error object", () => {
// --- Arrange
const source = `
throw errObj
`;
const evalContext = createEvalContext({
localContext: {
x: 1,
errObj: new Error("Hello, Error!"),
},
});
const statements = parseStatements(source);
// --- Act
try {
processStatementQueue(statements, evalContext);
} catch (err: any) {
expect(err.message.toString()).equal("Hello, Error!");
return;
}
assert.fail("Exception expected");
});
it("try - catch, normal", () => {
// --- Arrange
const source = `
try {
x = 2
} catch {
}
`;
const evalContext = createEvalContext({
localContext: {
x: 1,
},
});
const statements = parseStatements(source);
// --- Act
processStatementQueue(statements, evalContext);
// --- Assert
expect(evalContext.mainThread!.blocks!.length).equal(1);
expect(evalContext.localContext.x).equal(2);
});
it("try - finally, normal", () => {
// --- Arrange
const source = `
try {
x = 2
} finally {
x = 3
}
`;
const evalContext = createEvalContext({
localContext: {
x: 1,
},
});
const statements = parseStatements(source);
// --- Act
processStatementQueue(statements, evalContext);
// --- Assert
expect(evalContext.mainThread!.blocks!.length).equal(1);
expect(evalContext.localContext.x).equal(3);
});
it("try - catch nested, normal", () => {
// --- Arrange
const source = `
try {
try {
x = 2
} finally {
x = 3
}
} catch {
}
`;
const evalContext = createEvalContext({
localContext: {
x: 1,
},
});
const statements = parseStatements(source);
// --- Act
processStatementQueue(statements, evalContext);
// --- Assert
expect(evalContext.mainThread!.blocks!.length).equal(1);
expect(evalContext.localContext.x).equal(3);
});
it("try - finally nested, normal", () => {
// --- Arrange
const source = `
try {
try {
x = 2
} finally {
x = 3
}
} finally {
x = 4
}
`;
const evalContext = createEvalContext({
localContext: {
x: 1,
},
});
const statements = parseStatements(source);
// --- Act
processStatementQueue(statements, evalContext);
// --- Assert
expect(evalContext.mainThread!.blocks!.length).equal(1);
expect(evalContext.localContext.x).equal(4);
});
it("try - finally with break", () => {
// --- Arrange
const source = `
while (true) {
try {
break;
x = -4;
} finally {
x = 3
}
}
`;
const evalContext = createEvalContext({
localContext: {
x: 1,
},
});
const statements = parseStatements(source);
// --- Act
processStatementQueue(statements, evalContext);
// --- Assert
expect(evalContext.mainThread!.blocks!.length).equal(1);
expect(evalContext.localContext.x).equal(3);
});
it("try - finally nested with break", () => {
// --- Arrange
const source = `
while (true) {
try {
try {
break;
x = -4;
} finally {
x = 3
}
} finally {
x = 4
}
}
`;
const evalContext = createEvalContext({
localContext: {
x: 1,
},
});
const statements = parseStatements(source);
// --- Act
processStatementQueue(statements, evalContext);
// --- Assert
expect(evalContext.mainThread!.blocks!.length).equal(1);
expect(evalContext.localContext.x).equal(4);
});
it("try - finally with continue", () => {
// --- Arrange
const source = `
while (x < 3) {
try {
z++;
if (x === 1) continue;
z++;
} finally {
x++
}
}
`;
const evalContext = createEvalContext({
localContext: {
z: 0,
x: 0,
},
});
const statements = parseStatements(source);
// --- Act
processStatementQueue(statements, evalContext);
// --- Assert
expect(evalContext.mainThread!.blocks!.length).equal(1);
expect(evalContext.localContext.x).equal(3);
expect(evalContext.localContext.z).equal(5);
});
it("try - finally nested with continue", () => {
// --- Arrange
const source = `
while (x < 3) {
try {
try {
z++;
if (x === 1) continue;
z++;
} finally {
x++
}
} finally {
z += 100
}
}
`;
const evalContext = createEvalContext({
localContext: {
z: 0,
x: 0,
},
});
const statements = parseStatements(source);
// --- Act
processStatementQueue(statements, evalContext);
// --- Assert
expect(evalContext.mainThread!.blocks!.length).equal(1);
expect(evalContext.localContext.x).equal(3);
expect(evalContext.localContext.z).equal(305);
});
it("try - finally with return", () => {
// --- Arrange
const source = `
try {
return 123;
} finally {
x = 1
}
`;
const evalContext = createEvalContext({
localContext: {
x: 0,
},
});
const statements = parseStatements(source);
// --- Act
processStatementQueue(statements, evalContext);
expect(evalContext.mainThread!.returnValue).equal(123);
// --- Assert
expect(evalContext.mainThread!.blocks!.length).equal(1);
expect(evalContext.localContext.x).equal(1);
});
it("try - finally nested with return", () => {
// --- Arrange
const source = `
try {
try {
return 123;
} finally {
x++
}
} finally {
x++
}
`;
const evalContext = createEvalContext({
localContext: {
x: 0,
},
});
const statements = parseStatements(source);
// --- Act
processStatementQueue(statements, evalContext);
expect(evalContext.mainThread!.returnValue).equal(123);
// --- Assert
expect(evalContext.mainThread!.blocks!.length).equal(1);
expect(evalContext.localContext.x).equal(2);
});
it("try - finally, error", () => {
// --- Arrange
const source = `
try {
x = 2;
throw { type: 'Error' }
} finally {
x++
}
`;
const evalContext = createEvalContext({
localContext: {
x: 1,
},
});
const statements = parseStatements(source);
// --- Act
try {
processStatementQueue(statements, evalContext);
} catch (err: any) {
// --- Assert
expect(evalContext.mainThread!.blocks!.length).equal(1);
expect(evalContext.localContext.x).equal(3);
expect(err.errorObject.type).equal("Error");
return;
}
assert.fail("Exception expected");
});
it("try - finally nested, error", () => {
// --- Arrange
const source = `
try {
try {
x = 2;
throw { type: 'Error' }
} finally {
x++
}
} finally {
x++
}
`;
const evalContext = createEvalContext({
localContext: {
x: 1,
},
});
const statements = parseStatements(source);
// --- Act
try {
processStatementQueue(statements, evalContext);
} catch (err: any) {
// --- Assert
expect(evalContext.mainThread!.blocks!.length).equal(1);
expect(evalContext.localContext.x).equal(4);
expect(err.errorObject.type).equal("Error");
return;
}
assert.fail("Exception expected");
});
it("try - catch, error", () => {
// --- Arrange
const source = `
try {
x = 2;
throw { type: 'Error' }
} catch {
x++
}
`;
const evalContext = createEvalContext({
localContext: {
x: 1,
},
});
const statements = parseStatements(source);
// --- Act
processStatementQueue(statements, evalContext);
// --- Assert
expect(evalContext.mainThread!.blocks!.length).equal(1);
expect(evalContext.localContext.x).equal(3);
});
it("try - catch - finally, error", () => {
// --- Arrange
const source = `
try {
x = 2;
throw { type: 'Error' }
} catch {
x++
} finally {
x++
}
`;
const evalContext = createEvalContext({
localContext: {
x: 1,
},
});
const statements = parseStatements(source);
// --- Act
processStatementQueue(statements, evalContext);
// --- Assert
expect(evalContext.mainThread!.blocks!.length).equal(1);
expect(evalContext.localContext.x).equal(4);
return;
});
it("try - catch, error rethrown", () => {
// --- Arrange
const source = `
try {
x = 2;
throw { type: 'Error' }
} catch (err) {
x++;
throw err
}
`;
const evalContext = createEvalContext({
localContext: {
x: 1,
},
});
const statements = parseStatements(source);
// --- Act
try {
processStatementQueue(statements, evalContext);
} catch (err: any) {
// --- Assert
expect(evalContext.mainThread!.blocks!.length).equal(1);
expect(evalContext.localContext.x).equal(3);
expect(err.errorObject.type).equal("Error");
return;
}
assert.fail("Exception expected");
});
it("try - catch, error rethrown, finally", () => {
// --- Arrange
const source = `
try {
x = 2;
throw { type: 'Error' }
} catch (err) {
x++;
throw err
} finally {
x++
}
`;
const evalContext = createEvalContext({
localContext: {
x: 1,
},
});
const statements = parseStatements(source);
// --- Act
try {
processStatementQueue(statements, evalContext);
} catch (err: any) {
// --- Assert
expect(evalContext.mainThread!.blocks!.length).equal(1);
expect(evalContext.localContext.x).equal(4);
expect(err.errorObject.type).equal("Error");
return;
}
assert.fail("Exception expected");
});
it("try - catch, error rethrown other", () => {
// --- Arrange
const source = `
try {
x = 2;
throw { type: 'Error' }
} catch (err) {
x++;
throw { type: "Other" }
}
`;
const evalContext = createEvalContext({
localContext: {
x: 1,
},
});
const statements = parseStatements(source);
// --- Act
try {
processStatementQueue(statements, evalContext);
} catch (err: any) {
// --- Assert
expect(evalContext.mainThread!.blocks!.length).equal(1);
expect(evalContext.localContext.x).equal(3);
expect(err.errorObject.type).equal("Other");
return;
}
assert.fail("Exception expected");
});
it("try - catch, error rethrown other, finally", () => {
// --- Arrange
const source = `
try {
x = 2;
throw { type: 'Error' }
} catch (err) {
x++;
throw { type: "Other" }
} finally {
x++
}
`;
const evalContext = createEvalContext({
localContext: {
x: 1,
},
});
const statements = parseStatements(source);
// --- Act
try {
processStatementQueue(statements, evalContext);
} catch (err: any) {
// --- Assert
expect(evalContext.mainThread!.blocks!.length).equal(1);
expect(evalContext.localContext.x).equal(4);
expect(err.errorObject.type).equal("Other");
return;
}
assert.fail("Exception expected");
});
it("try - catch - finally, error in finally", () => {
// --- Arrange
const source = `
try {
x = 2;
throw { type: 'Error' }
} catch {
x++
} finally {
x++;
throw { type: "finallyError" }
}
`;
const evalContext = createEvalContext({
localContext: {
x: 1,
},
});
const statements = parseStatements(source);
// --- Act
try {
processStatementQueue(statements, evalContext);
} catch (err: any) {
// --- Assert
expect(evalContext.mainThread!.blocks!.length).equal(1);
expect(evalContext.localContext.x).equal(4);
expect(err.errorObject.type).equal("finallyError");
return;
}
assert.fail("Exception expected");
});
it("try - catch with return", () => {
// --- Arrange
const source = `
try {
throw { type: "Error" }
} catch {
x = 1;
return 123;
}
`;
const evalContext = createEvalContext({
localContext: {
x: 0,
},
});
const statements = parseStatements(source);
// --- Act
processStatementQueue(statements, evalContext);
expect(evalContext.mainThread!.returnValue).equal(123);
// --- Assert
expect(evalContext.mainThread!.blocks!.length).equal(1);
expect(evalContext.localContext.x).equal(1);
});
it("try - finally with return", () => {
// --- Arrange
const source = `
try {
throw { type: "Error" }
} finally {
x = 1;
return 123;
}
`;
const evalContext = createEvalContext({
localContext: {
x: 0,
},
});
const statements = parseStatements(source);
// --- Act
try {
processStatementQueue(statements, evalContext);
} catch (err: any) {
// --- Assert
expect(evalContext.mainThread!.returnValue).equal(123);
expect(evalContext.mainThread!.blocks!.length).equal(1);
expect(evalContext.localContext.x).equal(1);
expect(err.errorObject.type).equal("Error");
return;
}
assert.fail("Exception expected");
});
});
```