This is page 56 of 144. 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
│ ├── every-moments-teach.md
│ ├── fancy-laws-drop.md
│ ├── full-symbols-accept.md
│ └── tricky-zoos-crash.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
│ │ ├── HelloMd.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
│ │ │ └── test-padding.xmlui
│ │ ├── 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/components/FormItem/FormItemNative.tsx:
--------------------------------------------------------------------------------
```typescript
import type { CSSProperties, ReactNode } from "react";
import {
createContext,
Fragment,
memo,
useCallback,
useContext,
useEffect,
useId,
useMemo,
} from "react";
import { useAutoAnimate } from "@formkit/auto-animate/react";
import type { RegisterComponentApiFn, RenderChildFn } from "../../abstractions/RendererDefs";
import type { ComponentDef } from "../../abstractions/ComponentDefs";
import { asOptionalBoolean } from "../../components-core/rendering/valueExtractor";
import type {
FormControlType,
FormItemValidations,
ValidateEventHandler,
ValidationMode,
} from "../Form/FormContext";
import { useFormContextPart, useIsInsideForm } from "../Form/FormContext";
import { TextBox } from "../TextBox/TextBoxNative";
import { Toggle } from "../Toggle/Toggle";
import { FileInput } from "../FileInput/FileInputNative";
import { NumberBox } from "../NumberBox/NumberBoxNative";
import { Select } from "../Select/SelectNative";
import { RadioGroup } from "../RadioGroup/RadioGroupNative";
import {
fieldChanged,
fieldFocused,
fieldInitialized,
fieldLostFocus,
fieldRemoved,
UNBOUND_FIELD_SUFFIX,
} from "../Form/formActions";
import { TextArea } from "../TextArea/TextAreaNative";
import { useEvent } from "../../components-core/utils/misc";
import { DatePicker } from "../DatePicker/DatePickerNative";
import { getByPath } from "../Form/FormNative";
import { AutoComplete } from "../AutoComplete/AutoCompleteNative";
import type { LabelPosition } from "../abstractions";
import type { FormItemMd } from "./FormItem";
import { ItemWithLabel } from "./ItemWithLabel";
import { useValidation, useValidationDisplay } from "./Validations";
import { Slider } from "../Slider/SliderNative";
import { ColorPicker } from "../ColorPicker/ColorPickerNative";
import { HelperText } from "./HelperText";
import { Items } from "../Items/ItemsNative";
import { EMPTY_ARRAY } from "../../components-core/constants";
import { useShallowCompareMemoize } from "../../components-core/utils/hooks";
import styles from "./FormItem.module.scss";
const DEFAULT_LABEL_POSITIONS: Record<FormControlType | string, LabelPosition> = {
checkbox: "end",
};
type Props = {
children?: ReactNode;
style?: CSSProperties;
className?: string;
bindTo: string;
type?: FormControlType;
labelPosition?: LabelPosition;
autoFocus?: boolean;
enabled?: boolean;
label?: string;
labelWidth?: string;
labelBreak?: boolean;
onValidate?: ValidateEventHandler;
customValidationsDebounce?: number;
validationMode?: ValidationMode;
initialValue?: any;
registerComponentApi?: RegisterComponentApiFn;
maxTextLength?: number;
inputRenderer?: any;
itemIndex?: number;
gap?: string;
noSubmit?: boolean;
} & FormItemValidations;
export const defaultProps: Pick<
Props,
"type" | "labelBreak" | "enabled" | "customValidationsDebounce" | "gap" | "noSubmit"
> = {
type: "text",
labelBreak: true,
enabled: true,
customValidationsDebounce: 0,
gap: "0",
noSubmit: false,
};
const FormItemContext = createContext<any>({ parentFormItemId: null });
function ArrayLikeFormItem({
children,
formItemId,
registerComponentApi,
value = EMPTY_ARRAY,
updateState,
}) {
const formContextValue = useMemo(() => {
return {
parentFormItemId: formItemId,
};
}, [formItemId]);
const addItem = useEvent((item) => {
updateState({ value: [...value, item] });
});
const removeItem = useEvent((index) => {
updateState({ value: value.filter((item, i) => i !== index) });
});
useEffect(() => {
registerComponentApi?.({
addItem: addItem,
removeItem: removeItem,
});
}, [addItem, registerComponentApi, removeItem]);
return <FormItemContext.Provider value={formContextValue}>{children}</FormItemContext.Provider>;
}
export const FormItem = memo(function FormItem({
// --- validation props
required,
requiredInvalidMessage,
minLength,
maxLength,
lengthInvalidMessage,
lengthInvalidSeverity,
minValue,
maxValue,
rangeInvalidMessage,
rangeInvalidSeverity,
pattern,
patternInvalidMessage,
patternInvalidSeverity,
regex,
regexInvalidMessage,
regexInvalidSeverity,
// ---
style,
className,
bindTo,
type = defaultProps.type,
label,
enabled = defaultProps.enabled,
labelPosition,
labelWidth,
labelBreak = defaultProps.labelBreak,
children,
onValidate,
customValidationsDebounce = defaultProps.customValidationsDebounce,
validationMode,
registerComponentApi,
maxTextLength,
inputRenderer,
itemIndex,
initialValue: initialValueFromProps,
gap,
noSubmit = defaultProps.noSubmit,
...rest
}: Props) {
const validations: FormItemValidations = useShallowCompareMemoize({
required,
requiredInvalidMessage,
minLength,
maxLength,
lengthInvalidMessage,
lengthInvalidSeverity,
minValue,
maxValue,
rangeInvalidMessage,
rangeInvalidSeverity,
pattern,
patternInvalidMessage,
patternInvalidSeverity,
regex,
regexInvalidMessage,
regexInvalidSeverity,
});
const defaultId = useId();
const { parentFormItemId } = useContext(FormItemContext);
const formItemId = useMemo(() => {
const safeBindTo = bindTo || `${defaultId}${UNBOUND_FIELD_SUFFIX}`;
if (parentFormItemId) {
if (itemIndex !== undefined) {
let parentFieldReference = `${parentFormItemId}[${itemIndex}]`;
if (bindTo !== undefined && bindTo.trim() === "") {
return parentFieldReference;
} else {
return `${parentFieldReference}.${safeBindTo}`;
}
}
} else {
return safeBindTo;
}
}, [bindTo, defaultId, itemIndex, parentFormItemId]);
const labelWidthValue = useFormContextPart((value) => labelWidth || value?.itemLabelWidth);
const labelBreakValue = useFormContextPart((value) =>
labelBreak !== undefined ? labelBreak : value?.itemLabelBreak,
);
const labelPositionValue = useFormContextPart<any>(
(value) => labelPosition || value?.itemLabelPosition || DEFAULT_LABEL_POSITIONS[type],
);
const initialValueFromSubject = useFormContextPart<any>((value) =>
getByPath(value?.originalSubject, formItemId),
);
const initialValue =
initialValueFromSubject === undefined ? initialValueFromProps : initialValueFromSubject;
const value = useFormContextPart<any>((value) => getByPath(value?.subject, formItemId));
const validationResult = useFormContextPart((value) => value?.validationResults[formItemId]);
const dispatch = useFormContextPart((value) => value?.dispatch);
const formEnabled = useFormContextPart((value) => value?.enabled);
const isEnabled = enabled && formEnabled;
useEffect(() => {
// Always dispatch fieldInitialized to ensure noSubmit tracking
// Pass undefined as value when initialValue is undefined to avoid overwriting existing values
dispatch(fieldInitialized(formItemId, initialValue, false, noSubmit));
}, [dispatch, formItemId, initialValue, noSubmit]);
useValidation(validations, onValidate, value, dispatch, formItemId, customValidationsDebounce);
const onStateChange = useCallback(
({ value }: any, options?: any) => {
//we already handled the initial value in the useEffect with fieldInitialized(...);
if (!options?.initial) {
dispatch(fieldChanged(formItemId, value));
}
},
[formItemId, dispatch],
);
useEffect(() => {
return () => {
dispatch(fieldRemoved(formItemId));
};
}, [formItemId, dispatch]);
const { validationStatus, isHelperTextShown } = useValidationDisplay(
formItemId,
value,
validationResult,
validationMode,
);
const onFocus = useEvent(() => {
dispatch(fieldFocused(formItemId));
});
const onBlur = useEvent(() => {
dispatch(fieldLostFocus(formItemId));
});
let formControl = null;
switch (type) {
case "select": {
formControl = (
<Select
{...rest}
value={value}
updateState={onStateChange}
registerComponentApi={registerComponentApi}
onFocus={onFocus}
onBlur={onBlur}
enabled={isEnabled}
validationStatus={validationStatus}
>
{children}
</Select>
);
break;
}
case "autocomplete": {
formControl = (
<AutoComplete
{...rest}
value={value}
updateState={onStateChange}
registerComponentApi={registerComponentApi}
onFocus={onFocus}
onBlur={onBlur}
enabled={isEnabled}
validationStatus={validationStatus}
>
{children}
</AutoComplete>
);
break;
}
case "datePicker": {
formControl = (
<DatePicker
{...rest}
value={value}
updateState={onStateChange}
//registerComponentApi={registerComponentApi}
onFocus={onFocus}
onBlur={onBlur}
enabled={isEnabled}
validationStatus={validationStatus}
/>
);
break;
}
case "radioGroup": {
formControl = (
<RadioGroup
{...rest}
value={value}
updateState={onStateChange}
//registerComponentApi={registerComponentApi}
onFocus={onFocus}
onBlur={onBlur}
enabled={isEnabled}
validationStatus={validationStatus}
>
{children}
</RadioGroup>
);
break;
}
case "number":
case "integer": {
formControl = (
<NumberBox
{...rest}
initialValue={initialValue}
value={value}
updateState={onStateChange}
registerComponentApi={registerComponentApi}
onFocus={onFocus}
onBlur={onBlur}
enabled={isEnabled}
integersOnly={type === "integer"}
validationStatus={validationStatus}
min={validations.minValue}
max={validations.maxValue}
maxLength={maxTextLength ?? validations?.maxLength}
gap={gap}
></NumberBox>
);
break;
}
case "switch":
case "checkbox": {
formControl = (
<Toggle
{...rest}
value={value}
updateState={onStateChange}
registerComponentApi={registerComponentApi}
onFocus={onFocus}
onBlur={onBlur}
enabled={isEnabled}
validationStatus={validationStatus}
variant={type}
inputRenderer={inputRenderer}
/>
);
break;
}
case "file": {
formControl = (
<FileInput
{...rest}
value={value}
updateState={onStateChange}
registerComponentApi={registerComponentApi}
onFocus={onFocus}
onBlur={onBlur}
enabled={isEnabled}
validationStatus={validationStatus}
multiple={asOptionalBoolean((rest as any).multiple, false)} //TODO come up with something for this
/>
);
break;
}
case "text": {
formControl = (
<TextBox
{...rest}
value={value}
updateState={onStateChange}
registerComponentApi={registerComponentApi}
onFocus={onFocus}
onBlur={onBlur}
enabled={isEnabled}
validationStatus={validationStatus}
maxLength={maxTextLength ?? validations?.maxLength}
gap={gap}
/>
);
break;
}
case "password": {
formControl = (
<TextBox
{...rest}
type={"password"}
value={value}
updateState={onStateChange}
registerComponentApi={registerComponentApi}
onFocus={onFocus}
onBlur={onBlur}
enabled={isEnabled}
validationStatus={validationStatus}
maxLength={maxTextLength ?? validations?.maxLength}
/>
);
break;
}
case "textarea": {
formControl = (
<TextArea
{...rest}
value={value}
updateState={onStateChange}
registerComponentApi={registerComponentApi}
onFocus={onFocus}
onBlur={onBlur}
enabled={isEnabled}
validationStatus={validationStatus}
maxLength={maxTextLength ?? validations?.maxLength}
/>
);
break;
}
case "slider": {
formControl = (
<Slider
{...rest}
value={value}
updateState={onStateChange}
registerComponentApi={registerComponentApi}
onFocus={onFocus}
onBlur={onBlur}
enabled={isEnabled}
validationStatus={validationStatus}
min={validations.minValue}
max={validations.maxValue}
/>
);
break;
}
case "colorpicker": {
formControl = (
<ColorPicker
{...rest}
value={value}
updateState={onStateChange}
registerComponentApi={registerComponentApi}
onFocus={onFocus}
onBlur={onBlur}
enabled={isEnabled}
validationStatus={validationStatus}
/>
);
break;
}
case "items": {
formControl = (
<ArrayLikeFormItem
formItemId={formItemId}
registerComponentApi={registerComponentApi}
updateState={onStateChange}
value={value}
>
<Items items={value} renderItem={inputRenderer} />
</ArrayLikeFormItem>
);
break;
}
case "custom": {
formControl = children;
break;
}
default: {
console.warn(`unknown form item type ${type}`);
formControl = <div>{value}</div>;
break;
}
}
const [animateContainerRef] = useAutoAnimate({ duration: 100 });
const isInsideForm = useIsInsideForm();
if (!isInsideForm) {
throw new Error("FormItem must be used inside a Form");
}
return (
<ItemWithLabel
labelPosition={labelPositionValue}
label={label}
labelWidth={labelWidthValue}
labelBreak={labelBreakValue}
enabled={isEnabled}
required={validations.required}
validationInProgress={validationResult?.partial}
onFocus={onFocus}
onBlur={onBlur}
style={style}
className={className}
validationResult={
<div ref={animateContainerRef} className={styles.helperTextContainer}>
{isHelperTextShown &&
validationResult?.validations.map((singleValidation, i) => (
<Fragment key={i}>
{singleValidation.isValid && !!singleValidation.validMessage && (
<HelperText
text={singleValidation.validMessage}
status={"valid"}
style={{ opacity: singleValidation.stale ? 0.5 : undefined }}
/>
)}
{!singleValidation.isValid && !!singleValidation.invalidMessage && (
<HelperText
text={singleValidation.invalidMessage}
status={singleValidation.severity}
style={{ opacity: singleValidation.stale ? 0.5 : undefined }}
/>
)}
</Fragment>
))}
</div>
}
>
{formControl}
</ItemWithLabel>
);
});
type FormItemComponentDef = ComponentDef<typeof FormItemMd>;
export function CustomFormItem({
renderChild,
node,
bindTo,
}: {
renderChild: RenderChildFn;
node: FormItemComponentDef;
bindTo: string;
}) {
// IMPORTANT NOTE:
// why we use useFormContextPart, and not useFormContext?
// because we want to avoid re-rendering the whole form when the form state changes.
const value = useFormContextPart<any>((value) => getByPath(value.subject, bindTo));
const validationResult = useFormContextPart((value) => value.validationResults[bindTo]);
const dispatch = useFormContextPart((value) => value.dispatch);
const decoratedMetadata = useMemo(() => {
return {
type: "Container",
uid: "formFieldContainer - " + bindTo,
vars: node.vars,
contextVars: {
$value: value,
$setValue: (newValue: any) => {
dispatch(fieldChanged(bindTo, newValue));
},
$validationResult: validationResult,
},
children: node.children,
};
}, [bindTo, dispatch, node.children, node.vars, validationResult, value]);
return <>{renderChild(decoratedMetadata as any)}</>;
}
```
--------------------------------------------------------------------------------
/xmlui/tests/components-core/scripts-runner/process-statement-regs.test.ts:
--------------------------------------------------------------------------------
```typescript
import { describe, expect, it, assert } from "vitest";
import { processStatementQueueAsync } from "../../../src/components-core/script-runner/process-statement-async";
import { processStatementQueue } from "../../../src/components-core/script-runner/process-statement-sync";
import { createEvalContext, parseExpression, parseStatements } from "./test-helpers";
describe("Process statements regression (exp)", () => {
it("while with break #2", async () => {
// --- Arrange
const source = "let x = 0; while (true) {x++ ; if (x > 3) break;}; x++";
const evalContext = createEvalContext({
localContext: {},
});
const statements = parseStatements(source);
// --- Act
const diag = await processStatementQueueAsync(statements, evalContext);
// --- Assert
const thread = evalContext.mainThread;
expect(thread!.blocks!.length).equal(1);
expect(thread!.blocks![0].vars.x).equal(5);
expect(diag.processedStatements).equal(22);
expect(diag.maxLoops).equal(1);
expect(diag.maxBlocks).equal(2);
expect(diag.maxQueueLength).equal(5);
expect(diag.clearToLabels).equal(1);
expect(diag.unshiftedItems).equal(21);
});
it("regression #2", async () => {
// --- Arrange
const source = "((maybeUndefined)=> maybeUndefined)()";
const evalContext = createEvalContext({
localContext: {},
});
const statements = parseStatements(source);
// --- Act
const diag = await processStatementQueueAsync(statements, evalContext);
// --- Assert
expect(evalContext.mainThread!.blocks!.length).equal(1);
expect(diag.processedStatements).equal(1);
expect(diag.maxLoops).equal(0);
expect(diag.maxBlocks).equal(1);
expect(diag.maxQueueLength).equal(1);
expect(diag.clearToLabels).equal(0);
expect(diag.unshiftedItems).equal(0);
});
it("recursive arrow regression #1", async () => {
// --- Arrange
const source =
"const fact = n => { if (n === 0) return 1; else return n * fact(n-1); }; x = fact(3)";
const evalContext = createEvalContext({
localContext: {},
});
evalContext.mainThread!.blocks = [
{
vars: {
x: 0,
},
},
];
const statements = parseStatements(source);
// --- Act
const diag = await processStatementQueueAsync(statements, evalContext, evalContext.mainThread);
// --- Assert
const thread = evalContext.mainThread;
expect(thread!.blocks!.length).equal(1);
expect(thread!.blocks![0].vars.x).equal(6);
expect(diag.processedStatements).equal(2);
expect(diag.maxLoops).equal(0);
expect(diag.maxBlocks).equal(1);
expect(diag.maxQueueLength).equal(2);
expect(diag.clearToLabels).equal(0);
expect(diag.unshiftedItems).equal(0);
});
it("mapped arrow regression #1", async () => {
// --- Arrange
const source = "const mapped = [1,2,3].map(id => {return {id: id} }); console.log(mapped)";
const evalContext = createEvalContext({
localContext: {},
});
const statements = parseStatements(source);
// --- Act
const diag = await processStatementQueueAsync(statements, evalContext);
// --- Assert
const thread = evalContext.mainThread;
expect(thread!.blocks!.length).equal(1);
expect(thread!.blocks![0].vars.mapped.length).equal(3);
expect(diag.processedStatements).equal(2);
expect(diag.maxLoops).equal(0);
expect(diag.maxBlocks).equal(1);
expect(diag.maxQueueLength).equal(2);
expect(diag.clearToLabels).equal(0);
expect(diag.unshiftedItems).equal(0);
});
it("arrow with vars sub-property regression #1", async () => {
// --- Arrange
const source = "let arrow = (val) => val.value++; arrow(x)";
const evalContext = createEvalContext({
localContext: {},
});
evalContext.mainThread!.blocks = [
{
vars: {
x: { value: 0 },
},
},
];
const statements = parseStatements(source);
// --- Act
await processStatementQueueAsync(statements, evalContext);
// --- Assert
const thread = evalContext.mainThread;
expect(thread!.blocks!.length).equal(1);
expect(thread!.blocks![0].vars.x.value).equal(1);
});
it("arrow with vars sub-property regression #2", async () => {
// --- Arrange
const source = "let arrow = (val) => val.some++; arrow(x.value)";
const evalContext = createEvalContext({
localContext: {},
});
evalContext.mainThread!.blocks = [
{
vars: {
x: {
value: { some: 0 },
},
},
},
];
const statements = parseStatements(source);
// --- Act
await processStatementQueueAsync(statements, evalContext);
// --- Assert
const thread = evalContext.mainThread;
expect(thread!.blocks!.length).equal(1);
expect(thread!.blocks![0].vars.x.value.some).equal(1);
});
it("arrow with vars sub-property regression (sync) #1", () => {
// --- Arrange
const source = "let arrow = (val) => val.value++; arrow(x)";
const evalContext = createEvalContext({
localContext: {},
});
evalContext.mainThread!.blocks = [
{
vars: {
x: { value: 0 },
},
},
];
const statements = parseStatements(source);
// --- Act
processStatementQueue(statements, evalContext);
// --- Assert
const thread = evalContext.mainThread;
expect(thread!.blocks!.length).equal(1);
expect(thread!.blocks![0].vars.x.value).equal(1);
});
it("arrow with vars sub-property regression (sync) #2", () => {
// --- Arrange
const source = "let arrow = (val) => val.some++; arrow(x.value)";
const evalContext = createEvalContext({
localContext: {},
});
evalContext.mainThread!.blocks = [
{
vars: {
x: {
value: { some: 0 },
},
},
},
];
const statements = parseStatements(source);
// --- Act
processStatementQueue(statements, evalContext);
// --- Assert
const thread = evalContext.mainThread;
expect(thread!.blocks!.length).equal(1);
expect(thread!.blocks![0].vars.x.value.some).equal(1);
});
it("Arrow argument reference indirection", async () => {
// --- Arrange
const source = "incrementFunc(counter.value)";
const evalContext = createEvalContext({
localContext: {},
});
evalContext.mainThread!.blocks = [
{
vars: {
counter: {
value: { some: 0 },
},
incrementFunc: { ...parseExpression("x => x.some++"), _ARROW_EXPR_: true },
},
},
];
const statements = parseStatements(source);
// --- Act
await processStatementQueueAsync(statements, evalContext);
// --- Assert
const thread = evalContext.mainThread;
expect(thread!.blocks!.length).equal(1);
expect(thread!.blocks![0].vars.counter.value.some).equal(1);
});
it("delete #1", async () => {
// --- Arrange
const source = "x = delete alma";
const evalContext = createEvalContext({
localContext: {
x: 0,
alma: {},
},
});
const statements = parseStatements(source);
// --- Act
await processStatementQueueAsync(statements, evalContext);
// --- Assert
expect(evalContext.localContext.x).equal(true);
expect(evalContext.localContext.alma).equal(undefined);
});
it("delete #2", async () => {
// --- Arrange
const source = "x = delete alma.b";
const evalContext = createEvalContext({
localContext: {
x: 0,
alma: { a: "hello", b: "hi" },
},
});
const statements = parseStatements(source);
// --- Act
await processStatementQueueAsync(statements, evalContext);
// --- Assert
expect(evalContext.localContext.x).equal(true);
expect(evalContext.localContext.alma.b).equal(undefined);
expect(evalContext.localContext.alma.a).equal("hello");
});
it("delete #3", async () => {
// --- Arrange
const source = "x = delete alma[1]";
const evalContext = createEvalContext({
localContext: {
x: 0,
alma: [1, 2, 3],
},
});
const statements = parseStatements(source);
// --- Act
await processStatementQueueAsync(statements, evalContext);
// --- Assert
expect(evalContext.localContext.x).equal(true);
expect(evalContext.localContext.alma.length).equal(3);
expect(evalContext.localContext.alma[0]).equal(1);
expect(evalContext.localContext.alma[1]).equal(undefined);
expect(evalContext.localContext.alma[2]).equal(3);
});
it("delete #4", async () => {
// --- Arrange
const source = "x = delete Math.PI";
const evalContext = createEvalContext({
localContext: {
x: 123,
},
});
const statements = parseStatements(source);
// --- Act/Assert
try {
await processStatementQueueAsync(statements, evalContext);
} catch (err) {
expect(err instanceof TypeError).equal(true);
return;
}
assert.fail("Exception expected");
});
it("disallow running banned function #1", async () => {
// --- Arrange
const source = "const x = setTimeout(() => {}, 300)";
const evalContext = createEvalContext({});
const statements = parseStatements(source);
// --- Act/Assert
try {
await processStatementQueueAsync(statements, evalContext);
} catch (err: any) {
expect(err.toString().includes("not allowed to call")).equal(true);
return;
}
assert.fail("Exception expected");
});
it("Arrow function arg regression (async) #1", async () => {
// --- Arrange
const source = "val = [0,1,2,3].filter(k => k === 2 || k === 3);";
const evalContext = createEvalContext({
localContext: {
val: 0,
},
});
const statements = parseStatements(source);
// --- Act
await processStatementQueueAsync(statements, evalContext);
// --- Assert
expect(evalContext.localContext.val).deep.equal([2, 3]);
});
it("Arrow function arg regression (sync) #1", () => {
// --- Arrange
const source = "val = [0,1,2,3].filter(k => k === 2 || k === 3);";
const evalContext = createEvalContext({
localContext: {
val: 0,
},
});
const statements = parseStatements(source);
// --- Act
processStatementQueue(statements, evalContext);
// --- Assert
expect(evalContext.localContext.val).deep.equal([2, 3]);
});
it("Closure regression #1", async () => {
// --- Arrange
const source = `
const func = ()=> {
const dummy = 'dummy';
return {
fireListMessages: () => {
x = dummy;
}
};
}
func().fireListMessages();
`;
const evalContext = createEvalContext({
localContext: {
x: 0,
},
});
const statements = parseStatements(source);
// --- Act
await processStatementQueueAsync(statements, evalContext);
// --- Assert
expect(evalContext.localContext.x).equal("dummy");
});
it("Closure regression #2", async () => {
// --- Arrange
const source = `
const func = ()=> {
const fireListMessages = () => {
x = dummy;
}
const dummy = 'dummy';
return {
fireListMessages
};
}
func().fireListMessages();
`;
const evalContext = createEvalContext({
localContext: {
x: 0,
},
});
const statements = parseStatements(source);
// --- Act
await processStatementQueueAsync(statements, evalContext);
// --- Assert
expect(evalContext.localContext.x).equal("dummy");
});
it("Closure regression #3", async () => {
// --- Arrange
const source = `
const func = ()=> {
const fireListMessages = () => {
const otherDummy = "hey!"
return {
nested: () => {
x = otherDummy;
}
}
}
const dummy = 'dummy';
return {
fireListMessages
};
}
func().fireListMessages().nested();
`;
const evalContext = createEvalContext({
localContext: {
x: 0,
},
});
const statements = parseStatements(source);
// --- Act
await processStatementQueueAsync(statements, evalContext);
// --- Assert
expect(evalContext.localContext.x).equal("hey!");
});
it("Closure regression (sync) #1", () => {
// --- Arrange
const source = `
const func = ()=> {
const dummy = 'dummy';
return {
fireListMessages: () => {
x = dummy;
}
};
}
func().fireListMessages();
`;
const evalContext = createEvalContext({
localContext: {
x: 0,
},
});
const statements = parseStatements(source);
// --- Act
processStatementQueue(statements, evalContext);
// --- Assert
expect(evalContext.localContext.x).equal("dummy");
});
it("Closure regression (sync) #2", () => {
// --- Arrange
const source = `
const func = ()=> {
const fireListMessages = () => {
x = dummy;
}
const dummy = 'dummy';
return {
fireListMessages
};
}
func().fireListMessages();
`;
const evalContext = createEvalContext({
localContext: {
x: 0,
},
});
const statements = parseStatements(source);
// --- Act
processStatementQueue(statements, evalContext);
// --- Assert
expect(evalContext.localContext.x).equal("dummy");
});
it("Closure regression (sync) #3", () => {
// --- Arrange
const source = `
const func = ()=> {
const fireListMessages = () => {
const otherDummy = "hey!"
return {
nested: () => {
x = otherDummy;
}
}
}
const dummy = 'dummy';
return {
fireListMessages
};
}
func().fireListMessages().nested();
`;
const evalContext = createEvalContext({
localContext: {
x: 0,
},
});
const statements = parseStatements(source);
// --- Act
processStatementQueue(statements, evalContext);
// --- Assert
expect(evalContext.localContext.x).equal("hey!");
});
it("Predicate regression #1", async () => {
// --- Arrange
const source = `
const data = [1, 2, 3, 4, 5];
const predicate = v => v % 2 === 0;
x = data.filter(predicate);
`;
const evalContext = createEvalContext({
localContext: {
x: 0,
},
});
const statements = parseStatements(source);
// --- Act
await processStatementQueueAsync(
statements,
evalContext,
evalContext.mainThread,
);
// --- Assert
expect(evalContext.localContext.x).toStrictEqual([2, 4]);
});
it("Predicate regression #1 (sync)", () => {
// --- Arrange
const source = `
const data = [1, 2, 3, 4, 5];
const predicate = v => v % 2 === 0;
x = data.filter(predicate);
`;
const evalContext = createEvalContext({
localContext: {
x: 0,
},
});
const statements = parseStatements(source);
// --- Act
processStatementQueue(statements, evalContext);
// --- Assert
expect(evalContext.localContext.x).toStrictEqual([2, 4]);
});
it("var is not allowed in function body (sync)", () => {
// --- Arrange
const source = `
function test() {
var x = 0;
}
var c = 3;
let a = test();
`;
const evalContext = createEvalContext({
localContext: {
x: 0,
},
});
const statements = parseStatements(source);
// --- Act
try {
processStatementQueue(statements, evalContext);
} catch (err) {
expect(err.toString()).toContain("'var'");
return;
}
assert.fail("Exception expected");
});
it("var is not allowed in function body (async)", async () => {
// --- Arrange
const source = `
function test() {
var x = 0;
}
var c = 3;
let a = test();
`;
const evalContext = createEvalContext({
localContext: {
x: 0,
},
});
const statements = parseStatements(source);
// --- Act
try {
await processStatementQueueAsync(statements, evalContext);
} catch (err) {
expect(err.toString()).toContain("'var'");
return;
}
assert.fail("Exception expected");
});
});
```
--------------------------------------------------------------------------------
/xmlui/tests/parsers/scripting/process-try.test.ts:
--------------------------------------------------------------------------------
```typescript
import { describe, expect, it, assert } from "vitest";
import { processStatementQueueAsync } from "../../../src/components-core/script-runner/process-statement-async";
import { createEvalContext, parseStatements } from "./test-helpers";
describe("Process try statements", () => {
it("throw", async () => {
// --- Arrange
const source = `
throw { type: 'Error' }
`;
const evalContext = createEvalContext({
localContext: {
x: 1,
},
});
const statements = parseStatements(source);
// --- Act
try {
await processStatementQueueAsync(statements, evalContext);
} catch (err: any) {
expect(err.errorObject.type).equal("Error");
return;
}
assert.fail("Exception expected");
});
it("throw a given Error object", async () => {
// --- Arrange
const source = `
throw errObj
`;
const evalContext = createEvalContext({
localContext: {
x: 1,
errObj: new Error("Hello, Error!"),
},
});
const statements = parseStatements(source);
// --- Act
try {
await processStatementQueueAsync(statements, evalContext);
} catch (err: any) {
expect(err.message.toString()).equal("Hello, Error!");
return;
}
assert.fail("Exception expected");
});
it("try - catch, normal", async () => {
// --- Arrange
const source = `
try {
x = 2
} catch {
}
`;
const evalContext = createEvalContext({
localContext: {
x: 1,
},
});
const statements = parseStatements(source);
// --- Act
await processStatementQueueAsync(statements, evalContext);
// --- Assert
expect(evalContext.mainThread!.blocks!.length).equal(1);
expect(evalContext.localContext.x).equal(2);
});
it("try - finally, normal", async () => {
// --- Arrange
const source = `
try {
x = 2
} finally {
x = 3
}
`;
const evalContext = createEvalContext({
localContext: {
x: 1,
},
});
const statements = parseStatements(source);
// --- Act
await processStatementQueueAsync(statements, evalContext);
// --- Assert
expect(evalContext.mainThread!.blocks!.length).equal(1);
expect(evalContext.localContext.x).equal(3);
});
it("try - catch nested, normal", async () => {
// --- Arrange
const source = `
try {
try {
x = 2
} finally {
x = 3
}
} catch {
}
`;
const evalContext = createEvalContext({
localContext: {
x: 1,
},
});
const statements = parseStatements(source);
// --- Act
await processStatementQueueAsync(statements, evalContext);
// --- Assert
expect(evalContext.mainThread!.blocks!.length).equal(1);
expect(evalContext.localContext.x).equal(3);
});
it("try - finally nested, normal", async () => {
// --- Arrange
const source = `
try {
try {
x = 2
} finally {
x = 3
}
} finally {
x = 4
}
`;
const evalContext = createEvalContext({
localContext: {
x: 1,
},
});
const statements = parseStatements(source);
// --- Act
await processStatementQueueAsync(statements, evalContext);
// --- Assert
expect(evalContext.mainThread!.blocks!.length).equal(1);
expect(evalContext.localContext.x).equal(4);
});
it("try - finally with break", async () => {
// --- Arrange
const source = `
while (true) {
try {
break;
x = -4;
} finally {
x = 3
}
}
`;
const evalContext = createEvalContext({
localContext: {
x: 1,
},
});
const statements = parseStatements(source);
// --- Act
await processStatementQueueAsync(statements, evalContext);
// --- Assert
expect(evalContext.mainThread!.blocks!.length).equal(1);
expect(evalContext.localContext.x).equal(3);
});
it("try - finally nested with break", async () => {
// --- 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
await processStatementQueueAsync(statements, evalContext);
// --- Assert
expect(evalContext.mainThread!.blocks!.length).equal(1);
expect(evalContext.localContext.x).equal(4);
});
it("try - finally with continue", async () => {
// --- 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
await processStatementQueueAsync(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", async () => {
// --- 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
await processStatementQueueAsync(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", async () => {
// --- Arrange
const source = `
try {
return 123;
} finally {
x = 1
}
`;
const evalContext = createEvalContext({
localContext: {
x: 0,
},
});
const statements = parseStatements(source);
// --- Act
await processStatementQueueAsync(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", async () => {
// --- Arrange
const source = `
try {
try {
return 123;
} finally {
x++
}
} finally {
x++
}
`;
const evalContext = createEvalContext({
localContext: {
x: 0,
},
});
const statements = parseStatements(source);
// --- Act
await processStatementQueueAsync(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", async () => {
// --- Arrange
const source = `
try {
x = 2;
throw { type: 'Error' }
} finally {
x++
}
`;
const evalContext = createEvalContext({
localContext: {
x: 1,
},
});
const statements = parseStatements(source);
// --- Act
try {
await processStatementQueueAsync(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", async () => {
// --- 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 {
await processStatementQueueAsync(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", async () => {
// --- Arrange
const source = `
try {
x = 2;
throw { type: 'Error' }
} catch {
x++
}
`;
const evalContext = createEvalContext({
localContext: {
x: 1,
},
});
const statements = parseStatements(source);
// --- Act
await processStatementQueueAsync(statements, evalContext);
// --- Assert
expect(evalContext.mainThread!.blocks!.length).equal(1);
expect(evalContext.localContext.x).equal(3);
});
it("try - catch - finally, error", async () => {
// --- Arrange
const source = `
try {
x = 2;
throw { type: 'Error' }
} catch {
x++
} finally {
x++
}
`;
const evalContext = createEvalContext({
localContext: {
x: 1,
},
});
const statements = parseStatements(source);
// --- Act
await processStatementQueueAsync(statements, evalContext);
// --- Assert
expect(evalContext.mainThread!.blocks!.length).equal(1);
expect(evalContext.localContext.x).equal(4);
return;
});
it("try - catch, error rethrown", async () => {
// --- 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 {
await processStatementQueueAsync(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", async () => {
// --- 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 {
await processStatementQueueAsync(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", async () => {
// --- 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 {
await processStatementQueueAsync(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", async () => {
// --- 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 {
await processStatementQueueAsync(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", async () => {
// --- 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 {
await processStatementQueueAsync(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", async () => {
// --- Arrange
const source = `
try {
throw { type: "Error" }
} catch {
x = 1;
return 123;
}
`;
const evalContext = createEvalContext({
localContext: {
x: 0,
},
});
const statements = parseStatements(source);
// --- Act
await processStatementQueueAsync(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", async () => {
// --- Arrange
const source = `
try {
throw { type: "Error" }
} finally {
x = 1;
return 123;
}
`;
const evalContext = createEvalContext({
localContext: {
x: 0,
},
});
const statements = parseStatements(source);
// --- Act
try {
await processStatementQueueAsync(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");
});
it("try - finally with second return", async () => {
// --- Arrange
const source = `
try {
return 234
} finally {
x = 1;
return 123;
}
`;
const evalContext = createEvalContext({
localContext: {
x: 0,
},
});
const statements = parseStatements(source);
// --- Act
await processStatementQueueAsync(statements, evalContext);
expect(evalContext.mainThread!.returnValue).equal(123);
// --- Assert
expect(evalContext.mainThread!.blocks!.length).equal(1);
expect(evalContext.localContext.x).equal(1);
});
it("try - catch, finally with second return", async () => {
// --- Arrange
const source = `
try {
throw { type: "Error" }
} catch {
return 234;
} finally {
x = 1;
return 123;
}
`;
const evalContext = createEvalContext({
localContext: {
x: 0,
},
});
const statements = parseStatements(source);
// --- Act
await processStatementQueueAsync(statements, evalContext);
expect(evalContext.mainThread!.returnValue).equal(123);
// --- Assert
expect(evalContext.mainThread!.blocks!.length).equal(1);
expect(evalContext.localContext.x).equal(1);
});
});
```
--------------------------------------------------------------------------------
/xmlui/src/components-core/script-runner/visitors.ts:
--------------------------------------------------------------------------------
```typescript
import { get } from "lodash-es";
import type {
ArrayDestructure,
Expression,
ObjectDestructure,
Statement,
VarDeclaration,
Identifier} from "./ScriptingSourceTree";
import type { BlockScope } from "../../abstractions/scripting/BlockScope";
import { getIdentifierScope } from "./eval-tree-common";
import {
T_ARRAY_LITERAL,
T_ARROW_EXPRESSION,
T_ARROW_EXPRESSION_STATEMENT,
T_ASSIGNMENT_EXPRESSION,
T_BINARY_EXPRESSION,
T_BLOCK_STATEMENT,
T_CALCULATED_MEMBER_ACCESS_EXPRESSION,
T_CONDITIONAL_EXPRESSION,
T_CONST_STATEMENT,
T_DESTRUCTURE,
T_DO_WHILE_STATEMENT,
T_EXPRESSION_STATEMENT,
T_FOR_IN_STATEMENT,
T_FOR_OF_STATEMENT,
T_FOR_STATEMENT,
T_FUNCTION_INVOCATION_EXPRESSION,
T_IDENTIFIER,
T_IF_STATEMENT,
T_LET_STATEMENT,
T_LITERAL,
T_MEMBER_ACCESS_EXPRESSION,
T_OBJECT_LITERAL,
T_POSTFIX_OP_EXPRESSION,
T_PREFIX_OP_EXPRESSION,
T_RETURN_STATEMENT,
T_SEQUENCE_EXPRESSION,
T_SPREAD_EXPRESSION,
T_SWITCH_CASE,
T_SWITCH_STATEMENT,
T_THROW_STATEMENT,
T_TRY_STATEMENT,
T_UNARY_EXPRESSION,
T_VAR_DECLARATION,
T_WHILE_STATEMENT,
} from "./ScriptingSourceTree";
import type { BindingTreeEvaluationContext } from "./BindingTreeEvaluationContext";
import { ensureMainThread, innermostBlockScope } from "./process-statement-common";
/**
* Collects the name of local context variables the specified program depends on
* @param program Program to visit
* @param referenceTrackedApis
*/
export function collectVariableDependencies(
program: Expression | Statement[],
referenceTrackedApis: Record<string, any> = {},
): string[] {
// --- We use these variables to keep track of local variable scopes
const evalContext: BindingTreeEvaluationContext = {};
const thread = ensureMainThread(evalContext);
const deps = collectDependencies(program);
// --- Filter out duplicates
return deps.filter((item, index) => deps.indexOf(item) === index);
// --- This is the function we call recursively to collect dependencies
function collectDependencies(
program: Expression | Statement[],
parent?: Statement | Expression,
tag?: string,
): string[] {
if (Array.isArray(program)) {
// --- Visit statements
let deps: string[] = [];
program.forEach((stmt) => {
let stmtDeps: string[] = [];
switch (stmt.type) {
case T_BLOCK_STATEMENT:
thread.blocks!.push({ vars: {} });
stmtDeps = collectDependencies(stmt.stmts, stmt, "block");
thread.blocks!.pop();
break;
case T_EXPRESSION_STATEMENT:
stmtDeps = collectDependencies(stmt.expr, stmt, "expression");
break;
case T_ARROW_EXPRESSION_STATEMENT:
thread.blocks!.push({ vars: {} });
stmtDeps = collectDependencies(stmt.expr, stmt, "arrow");
thread.blocks!.pop();
break;
case T_LET_STATEMENT:
case T_CONST_STATEMENT:
processDeclarations(innermostBlockScope(thread)!, stmt.decls);
stmt.decls.forEach((decl) => {
if (decl.expr) {
stmtDeps = stmtDeps.concat(collectDependencies(decl.expr, stmt, "letOrConst"));
}
});
break;
case T_IF_STATEMENT:
stmtDeps = collectDependencies(stmt.cond, stmt, "if");
stmtDeps = stmtDeps.concat(collectDependencies([stmt.thenB], stmt, "if"));
if (stmt.elseB) {
stmtDeps = stmtDeps.concat(collectDependencies([stmt.elseB], stmt, "if"));
}
break;
case T_RETURN_STATEMENT:
if (stmt.expr) {
stmtDeps = collectDependencies(stmt.expr, stmt, "return");
}
break;
case T_WHILE_STATEMENT:
stmtDeps = collectDependencies(stmt.cond, stmt, "while");
stmtDeps = stmtDeps.concat(collectDependencies([stmt.body], stmt, "while"));
break;
case T_DO_WHILE_STATEMENT:
stmtDeps = collectDependencies(stmt.cond, stmt, "doWhile");
stmtDeps = stmtDeps.concat(collectDependencies([stmt.body], stmt, "doWhile"));
break;
case T_FOR_STATEMENT:
thread.blocks!.push({ vars: {} });
if (stmt.init) {
stmtDeps.concat(collectDependencies([stmt.init], stmt, "for"));
}
if (stmt.cond) {
stmtDeps = stmtDeps.concat(collectDependencies(stmt.cond, stmt, "for"));
}
if (stmt.upd) {
stmtDeps = stmtDeps.concat(collectDependencies(stmt.upd, stmt, "for"));
}
stmtDeps = stmtDeps.concat(collectDependencies([stmt.body], stmt, "for"));
thread.blocks!.pop();
break;
case T_FOR_IN_STATEMENT:
thread.blocks!.push({ vars: {} });
if (stmt.varB !== "none") {
const block = innermostBlockScope(thread);
block!.vars[stmt.id.name] = true;
}
stmtDeps = stmtDeps.concat(collectDependencies(stmt.expr, stmt, "forIn"));
stmtDeps = stmtDeps.concat(collectDependencies([stmt.body], stmt, "forIn"));
thread.blocks!.pop();
break;
case T_FOR_OF_STATEMENT:
thread.blocks!.push({ vars: {} });
if (stmt.varB !== "none") {
const block = innermostBlockScope(thread);
block!.vars[stmt.id.name] = true;
}
stmtDeps = stmtDeps.concat(collectDependencies(stmt.expr, stmt, "forOf"));
stmtDeps = stmtDeps.concat(collectDependencies([stmt.body], stmt, "forOf"));
thread.blocks!.pop();
break;
case T_THROW_STATEMENT:
stmtDeps = collectDependencies(stmt.expr, stmt, "throw");
break;
case T_TRY_STATEMENT:
stmtDeps = collectDependencies([stmt.tryB], stmt, "try");
if (stmt.catchB) {
thread.blocks!.push({ vars: {} });
if (stmt.catchV) {
const block = innermostBlockScope(thread);
block!.vars[stmt.catchV.name] = true;
}
stmtDeps = stmtDeps.concat(collectDependencies([stmt.catchB], stmt, "catchBlock"));
thread.blocks!.pop();
}
if (stmt.finallyB) {
stmtDeps = stmtDeps.concat(
collectDependencies([stmt.finallyB], stmt, "finallyBlock"),
);
}
break;
case T_SWITCH_STATEMENT:
stmtDeps = collectDependencies(stmt.expr, stmt, "switch");
stmt.cases.forEach((c) => {
if (c.caseE) {
stmtDeps = stmtDeps.concat(collectDependencies(c.caseE, stmt, "switch"));
}
if (c.stmts) {
stmtDeps = stmtDeps.concat(collectDependencies(c.stmts, stmt, "switch"));
}
});
break;
}
deps = deps.concat(stmtDeps);
});
return deps;
} else {
// --- Visit expression
switch (program.type) {
case T_IDENTIFIER:
// --- Any non-block-scoped variable is a dependency to return
const scope = getIdentifierScope(program, evalContext, thread);
return scope.type !== "block" ? [program.name] : [];
case T_MEMBER_ACCESS_EXPRESSION:
// --- Check for a simple member-access chain. If it exist, add the member to the chain with the "." syntax
const memberChain = traverseMemberAccessChain(program);
return memberChain
? [memberChain]
: collectDependencies(program.obj, program, "memberAccess");
case T_CALCULATED_MEMBER_ACCESS_EXPRESSION:
// --- Check for a simple member-access chain. If it exist, add the member to the chain with the "[]" syntax
const calcMemberChain = traverseMemberAccessChain(program);
if (calcMemberChain) {
return [calcMemberChain];
}
let calcDeps = collectDependencies(program.obj, program, "calculatedMember");
return calcDeps.concat(collectDependencies(program.member, program, "calculatedMember"));
case T_SEQUENCE_EXPRESSION:
let sequenceDeps: string[] = [];
program.exprs.forEach((expr) => {
sequenceDeps = sequenceDeps.concat(collectDependencies(expr, program, "sequence"));
});
return sequenceDeps;
case T_FUNCTION_INVOCATION_EXPRESSION:
let uncDeps: string[] = [];
program.arguments?.forEach((arg) => {
uncDeps = uncDeps.concat(collectDependencies(arg, program, "functionInvocation"));
});
if (program.obj.type === T_MEMBER_ACCESS_EXPRESSION) {
const caller = program.obj;
if (caller.obj.type === T_IDENTIFIER) {
if (
typeof get(referenceTrackedApis, `${caller.obj.name}.${caller.member}`) ===
"function"
) {
uncDeps.push(`${caller.obj.name}.${caller.member}`);
} else {
uncDeps.push(`${caller.obj.name}`);
}
} else if (
caller.obj.type === T_MEMBER_ACCESS_EXPRESSION ||
caller.obj.type === T_CALCULATED_MEMBER_ACCESS_EXPRESSION
) {
uncDeps = uncDeps.concat(
collectDependencies(caller.obj, caller, "functionInvocation"),
);
} else {
uncDeps = uncDeps.concat(collectDependencies(caller, program, "functionInvocation"));
}
} else {
uncDeps = uncDeps.concat(
collectDependencies(program.obj, program, "functionInvocation"),
);
}
return uncDeps;
case T_ARROW_EXPRESSION:
// --- Process the current arguments
thread.blocks!.push({ vars: {} });
const block = innermostBlockScope(thread);
const argSpecs = program.args;
let restFound = false;
for (let i = 0; i < argSpecs.length; i++) {
// --- Turn argument specification into processable variable declarations
const argSpec = argSpecs[i];
let decl: VarDeclaration | undefined;
switch (argSpec.type) {
case T_IDENTIFIER: {
decl = {
type: T_VAR_DECLARATION,
nodeId: argSpec.nodeId,
id: argSpec.name,
};
break;
}
case T_DESTRUCTURE: {
decl = {
type: T_VAR_DECLARATION,
nodeId: argSpec.nodeId,
id: argSpec.id,
aDestr: argSpec.aDestr,
oDestr: argSpec.oDestr,
};
break;
}
case T_SPREAD_EXPRESSION: {
restFound = true;
decl = {
type: T_VAR_DECLARATION,
nodeId: argSpec.nodeId,
id: (argSpec.expr as Identifier).name,
};
break;
}
default:
throw new Error("Unexpected arrow argument specification");
}
// --- Process declarations
processDeclarations(block!, [decl]);
}
// --- Process the arrow expression's body
const arrowDeps = collectDependencies([program.statement], program, "arrow");
// --- Remove the block scope
thread.blocks!.pop();
// --- Done
return arrowDeps;
case T_OBJECT_LITERAL:
let objectDeps: string[] = [];
program.props.forEach((prop) => {
if (Array.isArray(prop)) {
objectDeps = objectDeps.concat(
collectDependencies(prop[1], program, "objectLiteral"),
);
} else {
objectDeps = objectDeps.concat(collectDependencies(prop, program, "objectLiteral"));
}
});
return objectDeps;
case T_ARRAY_LITERAL:
let arrayDeps: string[] = [];
program.items.forEach((expr) => {
if (expr) {
arrayDeps = arrayDeps.concat(collectDependencies(expr, program, "array"));
}
});
return arrayDeps;
case T_UNARY_EXPRESSION:
return collectDependencies(program.expr, program, "unary");
case T_PREFIX_OP_EXPRESSION:
return collectDependencies(program.expr, program, "prefix");
case T_POSTFIX_OP_EXPRESSION:
return collectDependencies(program.expr, program, "postfix");
case T_BINARY_EXPRESSION:
return collectDependencies(program.left, program, "left").concat(
collectDependencies(program.right, program, "right"),
);
case T_ASSIGNMENT_EXPRESSION:
return collectDependencies(program.expr, program, "right");
case T_CONDITIONAL_EXPRESSION:
return collectDependencies(program.cond, program, "condition").concat(
collectDependencies(program.thenE, program, "trueExpr"),
collectDependencies(program.elseE, program, "falseExpr"),
);
case T_VAR_DECLARATION:
return collectDependencies(program.expr, program, "varDeclaration");
case T_SPREAD_EXPRESSION:
return collectDependencies(program.expr, program, "spread");
}
}
return [];
}
// --- Traverses a member access chain. Returns the chain as a string or null
// --- if the chain is not simple
function traverseMemberAccessChain(expr: Expression): string | null {
switch (expr.type) {
case T_MEMBER_ACCESS_EXPRESSION:
const memberChain = traverseMemberAccessChain(expr.obj);
return memberChain ? `${memberChain}.${expr.member}` : null;
case T_CALCULATED_MEMBER_ACCESS_EXPRESSION:
let value: string | null = null;
if (expr.member.type === T_LITERAL) {
value = `'${expr.member.value?.toString() ?? null}'`;
} else if (expr.member.type === T_IDENTIFIER) {
value = expr.member.name;
}
if (!value) break;
const calcMemberChain = traverseMemberAccessChain(expr.obj);
return calcMemberChain ? `${calcMemberChain}[${value}]` : null;
case T_IDENTIFIER:
const scope = getIdentifierScope(expr, evalContext, thread);
return scope.type !== "block" ? expr.name : null;
}
return null;
}
}
// --- Process a variable declaration
function processDeclarations(block: BlockScope, declarations: VarDeclaration[]): void {
for (let i = 0; i < declarations.length; i++) {
visitDeclaration(block, declarations[i]);
}
// --- Visit a variable
function visitDeclaration(block: BlockScope, decl: VarDeclaration): void {
// --- Process each declaration
if (decl.id) {
visitIdDeclaration(block, decl.id);
} else if (decl.aDestr) {
visitArrayDestruct(block, decl.aDestr);
} else if (decl.oDestr) {
visitObjectDestruct(block, decl.oDestr);
} else {
throw new Error("Unknown declaration specifier");
}
}
// --- Visits a single ID declaration
function visitIdDeclaration(block: BlockScope, id: string): void {
if (block.vars[id]) {
throw new Error(`Variable ${id} is already declared in the current scope.`);
}
block.vars[id] = true;
}
// --- Visits an array destructure declaration
function visitArrayDestruct(block: BlockScope, arrayD: ArrayDestructure[]): void {
for (let i = 0; i < arrayD.length; i++) {
const arrDecl = arrayD[i];
if (arrDecl.id) {
visitIdDeclaration(block, arrDecl.id);
} else if (arrDecl.aDestr) {
visitArrayDestruct(block, arrDecl.aDestr);
} else if (arrDecl.oDestr) {
visitObjectDestruct(block, arrDecl.oDestr);
}
}
}
// --- Visits an object destructure declaration
function visitObjectDestruct(block: BlockScope, objectD: ObjectDestructure[]): void {
for (let i = 0; i < objectD.length; i++) {
const objDecl = objectD[i];
if (objDecl.aDestr) {
visitArrayDestruct(block, objDecl.aDestr);
} else if (objDecl.oDestr) {
visitObjectDestruct(block, objDecl.oDestr);
} else {
visitIdDeclaration(block, objDecl.alias ?? objDecl.id!);
}
}
}
}
```
--------------------------------------------------------------------------------
/xmlui/tests/components-core/scripts-runner/process-try.test.ts:
--------------------------------------------------------------------------------
```typescript
import { describe, expect, it, assert } from "vitest";
import { processStatementQueueAsync } from "../../../src/components-core/script-runner/process-statement-async";
import { createEvalContext, parseStatements } from "./test-helpers";
describe("Process try statements (exp)", () => {
it("throw", async () => {
// --- Arrange
const source = `
throw { type: 'Error' }
`;
const evalContext = createEvalContext({
localContext: {
x: 1,
},
});
const statements = parseStatements(source);
// --- Act
try {
await processStatementQueueAsync(statements, evalContext);
} catch (err: any) {
expect(err.errorObject.type).equal("Error");
return;
}
assert.fail("Exception expected");
});
it("throw a given Error object", async () => {
// --- Arrange
const source = `
throw errObj
`;
const evalContext = createEvalContext({
localContext: {
x: 1,
errObj: new Error("Hello, Error!"),
},
});
const statements = parseStatements(source);
// --- Act
try {
await processStatementQueueAsync(statements, evalContext);
} catch (err: any) {
expect(err.message.toString()).equal("Hello, Error!");
return;
}
assert.fail("Exception expected");
});
it("try - catch, normal", async () => {
// --- Arrange
const source = `
try {
x = 2
} catch {
}
`;
const evalContext = createEvalContext({
localContext: {
x: 1,
},
});
const statements = parseStatements(source);
// --- Act
await processStatementQueueAsync(statements, evalContext);
// --- Assert
expect(evalContext.mainThread!.blocks!.length).equal(1);
expect(evalContext.localContext.x).equal(2);
});
it("try - finally, normal", async () => {
// --- Arrange
const source = `
try {
x = 2
} finally {
x = 3
}
`;
const evalContext = createEvalContext({
localContext: {
x: 1,
},
});
const statements = parseStatements(source);
// --- Act
await processStatementQueueAsync(statements, evalContext);
// --- Assert
expect(evalContext.mainThread!.blocks!.length).equal(1);
expect(evalContext.localContext.x).equal(3);
});
it("try - catch nested, normal", async () => {
// --- Arrange
const source = `
try {
try {
x = 2
} finally {
x = 3
}
} catch {
}
`;
const evalContext = createEvalContext({
localContext: {
x: 1,
},
});
const statements = parseStatements(source);
// --- Act
await processStatementQueueAsync(statements, evalContext);
// --- Assert
expect(evalContext.mainThread!.blocks!.length).equal(1);
expect(evalContext.localContext.x).equal(3);
});
it("try - finally nested, normal", async () => {
// --- Arrange
const source = `
try {
try {
x = 2
} finally {
x = 3
}
} finally {
x = 4
}
`;
const evalContext = createEvalContext({
localContext: {
x: 1,
},
});
const statements = parseStatements(source);
// --- Act
await processStatementQueueAsync(statements, evalContext);
// --- Assert
expect(evalContext.mainThread!.blocks!.length).equal(1);
expect(evalContext.localContext.x).equal(4);
});
it("try - finally with break", async () => {
// --- Arrange
const source = `
while (true) {
try {
break;
x = -4;
} finally {
x = 3
}
}
`;
const evalContext = createEvalContext({
localContext: {
x: 1,
},
});
const statements = parseStatements(source);
// --- Act
await processStatementQueueAsync(statements, evalContext);
// --- Assert
expect(evalContext.mainThread!.blocks!.length).equal(1);
expect(evalContext.localContext.x).equal(3);
});
it("try - finally nested with break", async () => {
// --- 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
await processStatementQueueAsync(statements, evalContext);
// --- Assert
expect(evalContext.mainThread!.blocks!.length).equal(1);
expect(evalContext.localContext.x).equal(4);
});
it("try - finally with continue", async () => {
// --- 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
await processStatementQueueAsync(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", async () => {
// --- 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
await processStatementQueueAsync(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", async () => {
// --- Arrange
const source = `
try {
return 123;
} finally {
x = 1
}
`;
const evalContext = createEvalContext({
localContext: {
x: 0,
},
});
const statements = parseStatements(source);
// --- Act
await processStatementQueueAsync(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", async () => {
// --- Arrange
const source = `
try {
try {
return 123;
} finally {
x++
}
} finally {
x++
}
`;
const evalContext = createEvalContext({
localContext: {
x: 0,
},
});
const statements = parseStatements(source);
// --- Act
await processStatementQueueAsync(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", async () => {
// --- Arrange
const source = `
try {
x = 2;
throw { type: 'Error' }
} finally {
x++
}
`;
const evalContext = createEvalContext({
localContext: {
x: 1,
},
});
const statements = parseStatements(source);
// --- Act
try {
await processStatementQueueAsync(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", async () => {
// --- 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 {
await processStatementQueueAsync(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", async () => {
// --- Arrange
const source = `
try {
x = 2;
throw { type: 'Error' }
} catch {
x++
}
`;
const evalContext = createEvalContext({
localContext: {
x: 1,
},
});
const statements = parseStatements(source);
// --- Act
await processStatementQueueAsync(statements, evalContext);
// --- Assert
expect(evalContext.mainThread!.blocks!.length).equal(1);
expect(evalContext.localContext.x).equal(3);
});
it("try - catch - finally, error", async () => {
// --- Arrange
const source = `
try {
x = 2;
throw { type: 'Error' }
} catch {
x++
} finally {
x++
}
`;
const evalContext = createEvalContext({
localContext: {
x: 1,
},
});
const statements = parseStatements(source);
// --- Act
await processStatementQueueAsync(statements, evalContext);
// --- Assert
expect(evalContext.mainThread!.blocks!.length).equal(1);
expect(evalContext.localContext.x).equal(4);
return;
});
it("try - catch, error rethrown", async () => {
// --- 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 {
await processStatementQueueAsync(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", async () => {
// --- 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 {
await processStatementQueueAsync(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", async () => {
// --- 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 {
await processStatementQueueAsync(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", async () => {
// --- 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 {
await processStatementQueueAsync(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", async () => {
// --- 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 {
await processStatementQueueAsync(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", async () => {
// --- Arrange
const source = `
try {
throw { type: "Error" }
} catch {
x = 1;
return 123;
}
`;
const evalContext = createEvalContext({
localContext: {
x: 0,
},
});
const statements = parseStatements(source);
// --- Act
await processStatementQueueAsync(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", async () => {
// --- Arrange
const source = `
try {
throw { type: "Error" }
} finally {
x = 1;
return 123;
}
`;
const evalContext = createEvalContext({
localContext: {
x: 0,
},
});
const statements = parseStatements(source);
// --- Act
try {
await processStatementQueueAsync(statements, evalContext);
} catch (err: any) {
// --- Assert
console.log(err);
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");
});
it("try - finally with second return", async () => {
// --- Arrange
const source = `
try {
return 234
} finally {
x = 1;
return 123;
}
`;
const evalContext = createEvalContext({
localContext: {
x: 0,
},
});
const statements = parseStatements(source);
// --- Act
await processStatementQueueAsync(statements, evalContext);
expect(evalContext.mainThread!.returnValue).equal(123);
// --- Assert
expect(evalContext.mainThread!.blocks!.length).equal(1);
expect(evalContext.localContext.x).equal(1);
});
it("try - catch, finally with second return", async () => {
// --- Arrange
const source = `
try {
throw { type: "Error" }
} catch {
return 234;
} finally {
x = 1;
return 123;
}
`;
const evalContext = createEvalContext({
localContext: {
x: 0,
},
});
const statements = parseStatements(source);
// --- Act
await processStatementQueueAsync(statements, evalContext);
expect(evalContext.mainThread!.returnValue).equal(123);
// --- Assert
expect(evalContext.mainThread!.blocks!.length).equal(1);
expect(evalContext.localContext.x).equal(1);
});
});
```
--------------------------------------------------------------------------------
/xmlui/src/components/abstractions.ts:
--------------------------------------------------------------------------------
```typescript
import type { CSSProperties, ReactNode } from "react";
import type { PropertyValueDescription } from "../abstractions/ComponentDefs";
/**
* Several components offer a list of options to select from. This type describes such an option.
*/
export type Option = {
label: string;
value: string;
enabled?: boolean;
style?: CSSProperties;
className?: string;
readOnly?: boolean;
keywords?: string[];
children?: ReactNode;
optionRenderer?: (contextVars: any) => ReactNode;
};
export type Accordion = {
header: string;
content: ReactNode;
};
export type Tab = {
id?: string;
label: string;
headerRenderer?: (contextVars: any) => ReactNode;
children?: ReactNode;
style?: CSSProperties;
activated?: () => void;
};
export const LinkTargetNames = ["_self", "_blank", "_parent", "_top", "_unfencedTop"] as const;
export type LinkTarget = (typeof LinkTargetNames)[number];
export const LinkTargetMd: PropertyValueDescription[] = [
{
value: "_self",
description: "The link will open in the same frame as it was clicked.",
},
{
value: "_blank",
description: "The link will open in a new window or tab.",
},
{
value: "_parent",
description: "The link will open in the parent frame. If no parent, behaves as _self.",
},
{
value: "_top",
description:
"The topmost browsing context. The link will open in the full body of the window. If no ancestors, behaves as _self.",
},
{
value: "_unfencedTop",
description:
"Allows embedded fenced frames to navigate the top-level frame, i.e. traversing beyond the root of the fenced frame.",
},
];
/**
* Describes the common properties of a link component types.
*/
export type CommonLinkProps = {
/**
* The target URL of the link.
*/
to: string;
/**
* Indicates if the link is enabled.
*/
enabled?: boolean;
/**
* Indicates if the link is active.
*/
active?: boolean;
/** */
target?: LinkTarget;
};
export type LinkAria = "aria-disabled" | "aria-label";
/**
* Represents the theme color a particular component can have.
*/
export type ComponentThemeColor =
| "primary"
| "secondary"
| "success"
| "danger"
| "warning"
| "info"
| "light"
| "dark";
// --- Available view sizes
export const viewportSizeMd: PropertyValueDescription[] = [
{
value: "xs",
description: "Extra small devices (e.g., a small smartphone with low screen resolution)",
},
{ value: "sm", description: "Small devices (e.g., a smartphone in landscape view)" },
{ value: "md", description: "Medium devices (e.g., a tablet)" },
{ value: "lg", description: "Large devices (e.g., a laptop)" },
{ value: "xl", description: 'Extra large devices (e.g., a standard 20" monitor)' },
{ value: "xxl", description: 'Extra extra large devices (e.g., a large 29" monitor)' },
];
export const viewportSizeNames = Object.keys(viewportSizeMd);
// --- Available button sizes
export const sizeValues = ["xs", "sm", "md", "lg", "xl"] as const;
export type SizeType = (typeof sizeValues)[number];
export const sizeMd: PropertyValueDescription<SizeType>[] = [
{ value: "xs", description: "Extra small" },
{ value: "sm", description: "Small" },
{ value: "md", description: "Medium" },
{ value: "lg", description: "Large" },
{ value: "xl", description: "Extra large" },
];
export function isSizeType(value: any): value is SizeType {
return sizeValues.includes(value);
}
// --- Available button themes
export const buttonThemeValues = ["attention", "primary", "secondary"] as const;
export const buttonThemeNames = [...buttonThemeValues];
export type ButtonThemeColor = (typeof buttonThemeValues)[number];
export const buttonThemeMd: PropertyValueDescription[] = [
{ value: "attention", description: "Attention state theme color" },
{ value: "primary", description: "Primary theme color" },
{ value: "secondary", description: "Secondary theme color" },
];
// --- Available button types
export const buttonTypeValues = ["button", "submit", "reset"] as const;
export const buttonTypeNames = [...buttonTypeValues];
export type ButtonType = (typeof buttonTypeValues)[number];
export const buttonTypesMd: PropertyValueDescription[] = [
{
value: "button",
description: "Regular behavior that only executes logic if explicitly determined.",
},
{
value: "submit",
description:
"The button submits the form data to the server. This is the default for buttons in a Form or NativeForm component.",
},
{
value: "reset",
description:
"Resets all the controls to their initial values. Using it is ill advised for UX reasons.",
},
];
// --- Available button variants
export const buttonVariantValues = ["solid", "outlined", "ghost"] as const;
export const buttonVariantNames = [...buttonVariantValues];
export type ButtonVariant = (typeof buttonVariantValues)[number];
export const buttonVariantMd: PropertyValueDescription[] = [
{ value: "solid", description: "A button with a border and a filled background." },
{
value: "outlined",
description: "The button is displayed with a border and a transparent background.",
},
{
value: "ghost",
description:
"A button with no border and fill. Only the label is visible; the background is colored when hovered or clicked.",
},
];
// --- Available button aria attributes
const buttonAriaValues = ["aria-controls", "aria-expanded", "aria-disabled", "aria-label"] as const;
export const buttonAriaNames = [...buttonAriaValues];
export type ButtonAria = (typeof buttonAriaValues)[number];
// --- Available alignment options
export const alignmentOptionValues = ["start", "center", "end"] as const;
export const alignmentOptionNames = [...alignmentOptionValues];
export type AlignmentOptions = (typeof alignmentOptionValues)[number];
export const alignmentOptionMd: PropertyValueDescription[] = [
{ value: "center", description: "Place the content in the middle" },
{
value: "start",
description: "Justify the content to the left (to the right if in right-to-left)",
},
{
value: "end",
description: "Justify the content to the right (to the left if in right-to-left)",
},
];
// --- Available orientation options
export const orientationOptionValues = ["horizontal", "vertical"] as const;
export type OrientationOptions = (typeof orientationOptionValues)[number];
export const orientationOptionMd: PropertyValueDescription[] = [
{ value: "horizontal", description: "The component will fill the available space horizontally" },
{ value: "vertical", description: "The component will fill the available space vertically" },
];
// --- Available icon positions
export const iconPositionValues = ["start", "end"] as const;
export const iconPositionNames = [...iconPositionValues];
export type IconPosition = (typeof iconPositionValues)[number];
export const iconPositionMd: PropertyValueDescription[] = [
{
value: "start",
description:
"The icon will appear at the start (left side when the left-to-right direction is set)",
},
{
value: "end",
description:
"The icon will appear at the end (right side when the left-to-right direction is set)",
},
];
// --- Available status colors
const statusColorValues = [
"primary",
"secondary",
"success",
"danger",
"warning",
"info",
"light",
"dark",
] as const;
export const statusColorNames = [...statusColorValues];
export type StatusColor = (typeof statusColorValues)[number];
export const statusColorMd: PropertyValueDescription[] = [
{ value: "primary", description: "Primary theme color, no default icon" },
{ value: "secondary", description: "Secondary theme color, no default icon" },
{ value: "success", description: 'Success theme color, "success" icon' },
{ value: "danger", description: 'Warning theme color, "warning" icon' },
{ value: "warning", description: 'Danger theme color, "danger" icon' },
{ value: "info", description: 'Info theme color, "info" icon' },
{ value: "light", description: "Light theme color, no default icon" },
{ value: "dark", description: "Dark theme color, no default icon" },
];
// --- Available placements
const placementValues = ["start", "end", "top", "bottom"] as const;
export const placementNames = [...placementValues];
export type Placement = (typeof placementValues)[number];
export const placementMd: PropertyValueDescription[] = [
{
value: "start",
description:
"The left side of the window (left-to-right) or the right side of the window (right-to-left)",
},
{
value: "end",
description:
"The right side of the window (left-to-right) or the left side of the window (right-to-left)",
},
{ value: "top", description: "The top of the window" },
{ value: "bottom", description: "The bottom of the window" },
];
// --- Available label positions
export const labelPositionValues = ["top", "start", "end", "bottom"] as const;
export const labelPositionNames = [...labelPositionValues];
export type LabelPosition = (typeof labelPositionValues)[number];
export const labelPositionMd: PropertyValueDescription[] = [
{
value: "start",
description:
"The left side of the input (left-to-right) or the right side of the input (right-to-left)",
},
{
value: "end",
description:
"The right side of the input (left-to-right) or the left side of the input (right-to-left)",
},
{ value: "top", description: "The top of the input" },
{ value: "bottom", description: "The bottom of the input" },
];
// --- Available trigger positions
const triggerPositionValues = ["start", "end"] as const;
export const triggerPositionNames = [...triggerPositionValues];
export type TriggerPosition = (typeof triggerPositionValues)[number];
// --- The state of a validated UI element
export const validationStatusValues = ["none", "error", "warning", "valid"] as const;
export const validationStatusNames = [...validationStatusValues];
export type ValidationStatus = (typeof validationStatusValues)[number];
export const validationStatusMd: PropertyValueDescription[] = [
// { value: "none", description: "No indicator" },
{ value: "valid", description: "Visual indicator for an input that is accepted" },
{ value: "warning", description: "Visual indicator for an input that produced a warning" },
{ value: "error", description: "Visual indicator for an input that produced an error" },
];
// --- The validation result of a particular component
export type ValidationResult = {
status: ValidationStatus;
message?: string;
};
// --- scroll anchoring
export const scrollAnchoringValues = ["top", "bottom"] as const;
export const scrollAnchoringNames = [...scrollAnchoringValues];
export type ScrollAnchoring = (typeof scrollAnchoringValues)[number];
// --- ordering
export const orderingValues = ["asc", "desc"] as const;
type OrderingDirection = (typeof orderingValues)[number];
export type FieldOrderBy = { field: string; direction: OrderingDirection };
// --- text variants
const TextVariantKeys = [
"abbr", // use <abbr>
"cite", // use <cite>
"code", // use <code>
"deleted", // use <del>
"inherit",
"inserted", // use <ins>
"keyboard", // use <kbd>,
"marked", // use <mark>
"sample", // use <samp>
"sub", // use <sub>
"sup", // use <sup>
"var", // use <variable>
"strong", // use <strong> element for content that is of greater importance (used in Markdown)
"em", // use <em> element changes the meaning of a sentence - as spoken emphasis does (used in Markdown)
"mono", // use monospace font with <![CDATA[
"title", // Title text in the particular context
"subtitle", // Subtitle text in the particular context
"small", // Small text in the particular context
"caption", // Caption text in the particular context
"placeholder", // Placeholder text in the particular context
"paragraph", // use <p>
"subheading", // use a H6 with some specific defaults
"tableheading", // use a H3 with some specific defaults
"secondary", // use a secondary text style
] as const;
export type TextVariant = (typeof TextVariantKeys)[number];
// --- overflow mode for text components
const OverflowModeKeys = [
"none", // Clips text cleanly without ellipsis when maxLines is reached
"ellipsis", // Truncates with an ellipsis (text-overflow: ellipsis)
"scroll", // Enables horizontal scrolling (overflow: auto), ignores maxLines
"flow", // Breaks text into multiple lines with vertical scrolling when needed
] as const;
export type OverflowMode = (typeof OverflowModeKeys)[number];
// --- break mode for text components
const BreakModeKeys = [
"normal", // Uses standard word boundaries for breaking
"word", // Breaks long words when necessary to prevent overflow
"anywhere", // Breaks at any character if needed to fit content
"keep", // Prevents breaking within words entirely
"hyphenate", // Uses automatic hyphenation when breaking words
] as const;
export type BreakMode = (typeof BreakModeKeys)[number];
type TextPropertyValueDescription = PropertyValueDescription & {
value: TextVariant;
description: string;
};
const TextVariantMapping = [
"abbr",
"cite",
"code",
"del",
"em",
"ins",
"kbd",
"mark",
"p",
"pre",
"samp",
"strong",
"sub",
"sup",
"var",
"h6",
"span",
] as const;
type TextVariantMappingType = typeof TextVariantMapping[number];
export const TextVariantElement: Record<TextVariant, TextVariantMappingType> = {
abbr: "abbr",
cite: "cite",
code: "code",
deleted: "del",
inherit: "span",
inserted: "ins",
keyboard: "kbd",
marked: "mark",
sample: "samp",
sub: "sub",
sup: "sup",
var: "var",
mono: "pre",
strong: "strong",
em: "em",
title: "span",
subtitle: "span",
small: "span",
caption: "span",
placeholder: "span",
paragraph: "p",
subheading: "h6",
tableheading: "h6",
secondary: "span",
};
export const variantOptionsMd: TextPropertyValueDescription[] = [
{ value: "abbr", description: "Represents an abbreviation or acronym" },
{ value: "caption", description: "Represents the caption (or title) of a table" },
{ value: "cite", description: "Is used to mark up the title of a cited work" },
{ value: "code", description: "Represents a line of code" },
{ value: "deleted", description: "Represents text that has been deleted" },
{ value: "em", description: "Marks text to stress emphasis" },
{
value: "inherit",
description: "Represents text that inherits the style from its parent element",
},
{
value: "inserted",
description: "Represents a range of text that has been added to a document",
},
{
value: "keyboard",
description:
"Represents a span of text denoting textual user input from a keyboard or voice input",
},
{
value: "marked",
description: "Represents text which is marked or highlighted for reference or notation",
},
{ value: "mono", description: "Text using a mono style font family" },
{ value: "paragraph", description: "Represents a paragraph" },
{
value: "placeholder",
description: "Text that is mostly used as the placeholder style in input controls",
},
{ value: "sample", description: "Represents sample (or quoted) output from a computer program" },
{ value: "secondary", description: "Represents a bit dimmed secondary text" },
{ value: "small", description: "Represents side-comments and small print" },
{ value: "sub", description: "Specifies inline text as subscript" },
{ value: "strong", description: "Contents have strong importance" },
{ value: "subheading", description: "Indicates that the text is the subtitle in a heading" },
{
value: "subtitle",
description: "Indicates that the text is the subtitle of some other content",
},
{ value: "sup", description: "Specifies inline text as superscript" },
{ value: "tableheading", description: "Indicates that the text is a table heading" },
{ value: "title", description: "Indicates that the text is the title of some other content" },
{ value: "var", description: "Represents the name of a variable in a mathematical expression" },
];
const AbbreviationKeys = ["title"] as const;
type Abbreviation = {
title?: string;
};
const InsertedKeys = ["cite", "dateTime"] as const;
type Inserted = {
cite?: string;
dateTime?: string;
};
export const VariantPropsKeys = [...AbbreviationKeys, ...InsertedKeys] as const;
export type VariantProps = Abbreviation | Inserted;
export const httpMethodNames = [
"get",
"post",
"put",
"delete",
"patch",
"head",
"options",
"trace",
"connect",
];
```