This is page 86 of 143. Use http://codebase.md/xmlui-org/xmlui/xmlui/tools/vscode/resources/xmlui-markup-syntax-highlighting.png?lines=false&page={x} to view the full context.
# Directory Structure
```
├── .changeset
│ ├── config.json
│ └── cyan-tools-design.md
├── .eslintrc.cjs
├── .github
│ ├── build-checklist.png
│ ├── ISSUE_TEMPLATE
│ │ ├── bug_report.md
│ │ └── feature_request.md
│ └── workflows
│ ├── deploy-blog-optimized.yml
│ ├── deploy-blog-swa.yml
│ ├── deploy-blog.yml
│ ├── deploy-docs-optimized.yml
│ ├── deploy-docs-swa.yml
│ ├── deploy-docs.yml
│ ├── prepare-versions.yml
│ ├── release-packages.yml
│ ├── run-all-tests.yml
│ └── run-smoke-tests.yml
├── .gitignore
├── .prettierrc.js
├── .vscode
│ ├── launch.json
│ └── settings.json
├── blog
│ ├── .gitignore
│ ├── .gitkeep
│ ├── CHANGELOG.md
│ ├── extensions.ts
│ ├── index.html
│ ├── index.ts
│ ├── package.json
│ ├── public
│ │ ├── blog
│ │ │ ├── images
│ │ │ │ ├── an-advanced-codefence.gif
│ │ │ │ ├── an-advanced-codefence.mp4
│ │ │ │ ├── blog-page-component.png
│ │ │ │ ├── blog-scrabble.png
│ │ │ │ ├── codefence-runner.png
│ │ │ │ ├── integrated-blog-search.png
│ │ │ │ ├── lorem-ipsum.png
│ │ │ │ ├── playground-checkbox-source.png
│ │ │ │ ├── playground.png
│ │ │ │ ├── use-xmlui-mcp-to-find-a-howto.png
│ │ │ │ └── xmlui-demo-gallery.png
│ │ │ ├── introducing-xmlui.md
│ │ │ ├── lorem-ipsum.md
│ │ │ ├── newest-post.md
│ │ │ ├── older-post.md
│ │ │ ├── xmlui-playground.md
│ │ │ └── xmlui-powered-blog.md
│ │ ├── mockServiceWorker.js
│ │ ├── resources
│ │ │ ├── favicon.ico
│ │ │ ├── files
│ │ │ │ └── for-download
│ │ │ │ └── xmlui
│ │ │ │ └── xmlui-standalone.umd.js
│ │ │ ├── github.svg
│ │ │ ├── llms.txt
│ │ │ ├── logo-dark.svg
│ │ │ ├── logo.svg
│ │ │ ├── pg-popout.svg
│ │ │ ├── rss.svg
│ │ │ └── xmlui-logo.svg
│ │ ├── serve.json
│ │ ├── staticwebapp.config.json
│ │ └── web.config
│ ├── scripts
│ │ ├── download-latest-xmlui.js
│ │ ├── generate-rss.js
│ │ ├── get-releases.js
│ │ └── utils.js
│ ├── src
│ │ ├── components
│ │ │ ├── BlogOverview.xmlui
│ │ │ ├── BlogPage.xmlui
│ │ │ └── PageNotFound.xmlui
│ │ ├── config.ts
│ │ ├── Main.xmlui
│ │ └── themes
│ │ └── blog-theme.ts
│ └── tsconfig.json
├── CONTRIBUTING.md
├── docs
│ ├── .gitignore
│ ├── CHANGELOG.md
│ ├── ComponentRefLinks.txt
│ ├── content
│ │ ├── _meta.json
│ │ ├── components
│ │ │ ├── _meta.json
│ │ │ ├── _overview.md
│ │ │ ├── APICall.md
│ │ │ ├── App.md
│ │ │ ├── AppHeader.md
│ │ │ ├── AppState.md
│ │ │ ├── AutoComplete.md
│ │ │ ├── Avatar.md
│ │ │ ├── Backdrop.md
│ │ │ ├── Badge.md
│ │ │ ├── BarChart.md
│ │ │ ├── Bookmark.md
│ │ │ ├── Breakout.md
│ │ │ ├── Button.md
│ │ │ ├── Card.md
│ │ │ ├── Carousel.md
│ │ │ ├── ChangeListener.md
│ │ │ ├── Checkbox.md
│ │ │ ├── CHStack.md
│ │ │ ├── ColorPicker.md
│ │ │ ├── Column.md
│ │ │ ├── ContentSeparator.md
│ │ │ ├── CVStack.md
│ │ │ ├── DataSource.md
│ │ │ ├── DateInput.md
│ │ │ ├── DatePicker.md
│ │ │ ├── DonutChart.md
│ │ │ ├── DropdownMenu.md
│ │ │ ├── EmojiSelector.md
│ │ │ ├── ExpandableItem.md
│ │ │ ├── FileInput.md
│ │ │ ├── FileUploadDropZone.md
│ │ │ ├── FlowLayout.md
│ │ │ ├── Footer.md
│ │ │ ├── Form.md
│ │ │ ├── FormItem.md
│ │ │ ├── FormSection.md
│ │ │ ├── Fragment.md
│ │ │ ├── H1.md
│ │ │ ├── H2.md
│ │ │ ├── H3.md
│ │ │ ├── H4.md
│ │ │ ├── H5.md
│ │ │ ├── H6.md
│ │ │ ├── Heading.md
│ │ │ ├── HSplitter.md
│ │ │ ├── HStack.md
│ │ │ ├── Icon.md
│ │ │ ├── IFrame.md
│ │ │ ├── Image.md
│ │ │ ├── Items.md
│ │ │ ├── LabelList.md
│ │ │ ├── Legend.md
│ │ │ ├── LineChart.md
│ │ │ ├── Link.md
│ │ │ ├── List.md
│ │ │ ├── Logo.md
│ │ │ ├── Markdown.md
│ │ │ ├── MenuItem.md
│ │ │ ├── MenuSeparator.md
│ │ │ ├── ModalDialog.md
│ │ │ ├── NavGroup.md
│ │ │ ├── NavLink.md
│ │ │ ├── NavPanel.md
│ │ │ ├── NoResult.md
│ │ │ ├── NumberBox.md
│ │ │ ├── Option.md
│ │ │ ├── Page.md
│ │ │ ├── PageMetaTitle.md
│ │ │ ├── Pages.md
│ │ │ ├── Pagination.md
│ │ │ ├── PasswordInput.md
│ │ │ ├── PieChart.md
│ │ │ ├── ProgressBar.md
│ │ │ ├── Queue.md
│ │ │ ├── RadioGroup.md
│ │ │ ├── RealTimeAdapter.md
│ │ │ ├── Redirect.md
│ │ │ ├── Select.md
│ │ │ ├── Slider.md
│ │ │ ├── Slot.md
│ │ │ ├── SpaceFiller.md
│ │ │ ├── Spinner.md
│ │ │ ├── Splitter.md
│ │ │ ├── Stack.md
│ │ │ ├── StickyBox.md
│ │ │ ├── SubMenuItem.md
│ │ │ ├── Switch.md
│ │ │ ├── TabItem.md
│ │ │ ├── Table.md
│ │ │ ├── TableOfContents.md
│ │ │ ├── Tabs.md
│ │ │ ├── Text.md
│ │ │ ├── TextArea.md
│ │ │ ├── TextBox.md
│ │ │ ├── Theme.md
│ │ │ ├── TimeInput.md
│ │ │ ├── Timer.md
│ │ │ ├── ToneChangerButton.md
│ │ │ ├── ToneSwitch.md
│ │ │ ├── Tooltip.md
│ │ │ ├── Tree.md
│ │ │ ├── VSplitter.md
│ │ │ ├── VStack.md
│ │ │ ├── xmlui-animations
│ │ │ │ ├── _meta.json
│ │ │ │ ├── _overview.md
│ │ │ │ ├── Animation.md
│ │ │ │ ├── FadeAnimation.md
│ │ │ │ ├── FadeInAnimation.md
│ │ │ │ ├── FadeOutAnimation.md
│ │ │ │ ├── ScaleAnimation.md
│ │ │ │ └── SlideInAnimation.md
│ │ │ ├── xmlui-pdf
│ │ │ │ ├── _meta.json
│ │ │ │ ├── _overview.md
│ │ │ │ └── Pdf.md
│ │ │ ├── xmlui-spreadsheet
│ │ │ │ ├── _meta.json
│ │ │ │ ├── _overview.md
│ │ │ │ └── Spreadsheet.md
│ │ │ └── xmlui-website-blocks
│ │ │ ├── _meta.json
│ │ │ ├── _overview.md
│ │ │ ├── Carousel.md
│ │ │ ├── HelloMd.md
│ │ │ ├── HeroSection.md
│ │ │ └── ScrollToTop.md
│ │ └── extensions
│ │ ├── _meta.json
│ │ ├── xmlui-animations
│ │ │ ├── _meta.json
│ │ │ ├── _overview.md
│ │ │ ├── Animation.md
│ │ │ ├── FadeAnimation.md
│ │ │ ├── FadeInAnimation.md
│ │ │ ├── FadeOutAnimation.md
│ │ │ ├── ScaleAnimation.md
│ │ │ └── SlideInAnimation.md
│ │ └── xmlui-website-blocks
│ │ ├── _meta.json
│ │ ├── _overview.md
│ │ ├── Carousel.md
│ │ ├── FancyButton.md
│ │ ├── HeroSection.md
│ │ └── ScrollToTop.md
│ ├── extensions.ts
│ ├── index.html
│ ├── index.ts
│ ├── package.json
│ ├── public
│ │ ├── feed.rss
│ │ ├── mockServiceWorker.js
│ │ ├── pages
│ │ │ ├── _meta.json
│ │ │ ├── app-structure.md
│ │ │ ├── build-editor-component.md
│ │ │ ├── build-hello-world-component.md
│ │ │ ├── components-intro.md
│ │ │ ├── context-variables.md
│ │ │ ├── forms.md
│ │ │ ├── globals.md
│ │ │ ├── glossary.md
│ │ │ ├── helper-tags.md
│ │ │ ├── hosted-deployment.md
│ │ │ ├── howto
│ │ │ │ ├── assign-a-complex-json-literal-to-a-component-variable.md
│ │ │ │ ├── chain-a-refetch.md
│ │ │ │ ├── control-cache-invalidation.md
│ │ │ │ ├── debounce-user-input-for-api-calls.md
│ │ │ │ ├── debounce-with-changelistener.md
│ │ │ │ ├── debug-a-component.md
│ │ │ │ ├── delay-a-datasource-until-another-datasource-is-ready.md
│ │ │ │ ├── delegate-a-method.md
│ │ │ │ ├── do-custom-form-validation.md
│ │ │ │ ├── expose-a-method-from-a-component.md
│ │ │ │ ├── filter-and-transform-data-from-an-api.md
│ │ │ │ ├── group-items-in-list-by-a-property.md
│ │ │ │ ├── handle-background-operations.md
│ │ │ │ ├── hide-an-element-until-its-datasource-is-ready.md
│ │ │ │ ├── make-a-set-of-equal-width-cards.md
│ │ │ │ ├── make-a-table-responsive.md
│ │ │ │ ├── make-navpanel-width-responsive.md
│ │ │ │ ├── modify-a-value-reported-in-a-column.md
│ │ │ │ ├── paginate-a-list.md
│ │ │ │ ├── pass-data-to-a-modal-dialog.md
│ │ │ │ ├── react-to-button-click-not-keystrokes.md
│ │ │ │ ├── set-the-initial-value-of-a-select-from-fetched-data.md
│ │ │ │ ├── share-a-modaldialog-across-components.md
│ │ │ │ ├── sync-selections-between-table-and-list-views.md
│ │ │ │ ├── update-ui-optimistically.md
│ │ │ │ ├── use-built-in-form-validation.md
│ │ │ │ └── use-the-same-modaldialog-to-add-or-edit.md
│ │ │ ├── howto.md
│ │ │ ├── intro.md
│ │ │ ├── layout.md
│ │ │ ├── markup.md
│ │ │ ├── mcp.md
│ │ │ ├── modal-dialogs.md
│ │ │ ├── news-and-reviews.md
│ │ │ ├── reactive-intro.md
│ │ │ ├── refactoring.md
│ │ │ ├── routing-and-links.md
│ │ │ ├── samples
│ │ │ │ ├── color-palette.xmlui
│ │ │ │ ├── color-values.xmlui
│ │ │ │ ├── shadow-sizes.xmlui
│ │ │ │ ├── spacing-sizes.xmlui
│ │ │ │ ├── swatch.xmlui
│ │ │ │ ├── theme-gallery-brief.xmlui
│ │ │ │ └── theme-gallery.xmlui
│ │ │ ├── scoping.md
│ │ │ ├── scripting.md
│ │ │ ├── styles-and-themes
│ │ │ │ ├── common-units.md
│ │ │ │ ├── layout-props.md
│ │ │ │ ├── theme-variable-defaults.md
│ │ │ │ ├── theme-variables.md
│ │ │ │ └── themes.md
│ │ │ ├── template-properties.md
│ │ │ ├── test.md
│ │ │ ├── tutorial-01.md
│ │ │ ├── tutorial-02.md
│ │ │ ├── tutorial-03.md
│ │ │ ├── tutorial-04.md
│ │ │ ├── tutorial-05.md
│ │ │ ├── tutorial-06.md
│ │ │ ├── tutorial-07.md
│ │ │ ├── tutorial-08.md
│ │ │ ├── tutorial-09.md
│ │ │ ├── tutorial-10.md
│ │ │ ├── tutorial-11.md
│ │ │ ├── tutorial-12.md
│ │ │ ├── universal-properties.md
│ │ │ ├── user-defined-components.md
│ │ │ ├── vscode.md
│ │ │ ├── working-with-markdown.md
│ │ │ ├── working-with-text.md
│ │ │ ├── xmlui-animations
│ │ │ │ ├── _meta.json
│ │ │ │ ├── _overview.md
│ │ │ │ ├── Animation.md
│ │ │ │ ├── FadeAnimation.md
│ │ │ │ ├── FadeInAnimation.md
│ │ │ │ ├── FadeOutAnimation.md
│ │ │ │ ├── ScaleAnimation.md
│ │ │ │ └── SlideInAnimation.md
│ │ │ ├── xmlui-charts
│ │ │ │ ├── _meta.json
│ │ │ │ ├── _overview.md
│ │ │ │ ├── BarChart.md
│ │ │ │ ├── DonutChart.md
│ │ │ │ ├── LabelList.md
│ │ │ │ ├── Legend.md
│ │ │ │ ├── LineChart.md
│ │ │ │ └── PieChart.md
│ │ │ ├── xmlui-pdf
│ │ │ │ ├── _meta.json
│ │ │ │ ├── _overview.md
│ │ │ │ └── Pdf.md
│ │ │ └── xmlui-spreadsheet
│ │ │ ├── _meta.json
│ │ │ ├── _overview.md
│ │ │ └── Spreadsheet.md
│ │ ├── resources
│ │ │ ├── devdocs
│ │ │ │ ├── debug-proxy-object-2.png
│ │ │ │ ├── debug-proxy-object.png
│ │ │ │ ├── table_editor_01.png
│ │ │ │ ├── table_editor_02.png
│ │ │ │ ├── table_editor_03.png
│ │ │ │ ├── table_editor_04.png
│ │ │ │ ├── table_editor_05.png
│ │ │ │ ├── table_editor_06.png
│ │ │ │ ├── table_editor_07.png
│ │ │ │ ├── table_editor_08.png
│ │ │ │ ├── table_editor_09.png
│ │ │ │ ├── table_editor_10.png
│ │ │ │ ├── table_editor_11.png
│ │ │ │ ├── table-editor-01.png
│ │ │ │ ├── table-editor-02.png
│ │ │ │ ├── table-editor-03.png
│ │ │ │ ├── table-editor-04.png
│ │ │ │ ├── table-editor-06.png
│ │ │ │ ├── table-editor-07.png
│ │ │ │ ├── table-editor-08.png
│ │ │ │ ├── table-editor-09.png
│ │ │ │ └── xmlui-rendering-of-tiptap-markdown.png
│ │ │ ├── favicon.ico
│ │ │ ├── files
│ │ │ │ ├── clients.json
│ │ │ │ ├── daily-revenue.json
│ │ │ │ ├── dashboard-stats.json
│ │ │ │ ├── demo.xmlui
│ │ │ │ ├── demo.xmlui.xs
│ │ │ │ ├── downloads
│ │ │ │ │ └── downloads.json
│ │ │ │ ├── for-download
│ │ │ │ │ ├── index-with-api.html
│ │ │ │ │ ├── index.html
│ │ │ │ │ ├── mockApi.js
│ │ │ │ │ ├── start-darwin.sh
│ │ │ │ │ ├── start-linux.sh
│ │ │ │ │ ├── start.bat
│ │ │ │ │ └── xmlui
│ │ │ │ │ └── xmlui-standalone.umd.js
│ │ │ │ ├── getting-started
│ │ │ │ │ ├── cl-tutorial-final.zip
│ │ │ │ │ ├── cl-tutorial.zip
│ │ │ │ │ ├── cl-tutorial2.zip
│ │ │ │ │ ├── cl-tutorial3.zip
│ │ │ │ │ ├── cl-tutorial4.zip
│ │ │ │ │ ├── cl-tutorial5.zip
│ │ │ │ │ ├── cl-tutorial6.zip
│ │ │ │ │ ├── getting-started.zip
│ │ │ │ │ ├── hello-xmlui.zip
│ │ │ │ │ ├── xmlui-empty.zip
│ │ │ │ │ └── xmlui-starter.zip
│ │ │ │ ├── howto
│ │ │ │ │ └── component-icons
│ │ │ │ │ └── up-arrow.svg
│ │ │ │ ├── invoices.json
│ │ │ │ ├── monthly-status.json
│ │ │ │ ├── news-and-reviews.json
│ │ │ │ ├── products.json
│ │ │ │ ├── releases.json
│ │ │ │ ├── tutorials
│ │ │ │ │ ├── datasource
│ │ │ │ │ │ └── api.ts
│ │ │ │ │ └── p2do
│ │ │ │ │ ├── api.ts
│ │ │ │ │ └── todo-logo.svg
│ │ │ │ └── xmlui.json
│ │ │ ├── github.svg
│ │ │ ├── images
│ │ │ │ ├── apiaction-tutorial
│ │ │ │ │ ├── add-success.png
│ │ │ │ │ ├── apiaction-param.png
│ │ │ │ │ ├── change-completed.png
│ │ │ │ │ ├── change-in-progress.png
│ │ │ │ │ ├── confirm-delete.png
│ │ │ │ │ ├── data-error.png
│ │ │ │ │ ├── data-progress.png
│ │ │ │ │ ├── data-success.png
│ │ │ │ │ ├── display-1.png
│ │ │ │ │ ├── item-deleted.png
│ │ │ │ │ ├── item-updated.png
│ │ │ │ │ ├── missing-api-key.png
│ │ │ │ │ ├── new-item-added.png
│ │ │ │ │ └── test-message.png
│ │ │ │ ├── chat-api
│ │ │ │ │ └── domain-model.svg
│ │ │ │ ├── components
│ │ │ │ │ ├── image
│ │ │ │ │ │ └── breakfast.jpg
│ │ │ │ │ ├── markdown
│ │ │ │ │ │ └── colors.png
│ │ │ │ │ └── modal
│ │ │ │ │ ├── deep_link_dialog_1.jpg
│ │ │ │ │ └── deep_link_dialog_2.jpg
│ │ │ │ ├── create-apps
│ │ │ │ │ ├── collapsed-vertical.png
│ │ │ │ │ ├── using-forms-warning-dialog.png
│ │ │ │ │ └── using-forms.png
│ │ │ │ ├── datasource-tutorial
│ │ │ │ │ ├── data-with-header.png
│ │ │ │ │ ├── filtered-data.png
│ │ │ │ │ ├── filtered-items.png
│ │ │ │ │ ├── initial-page-items.png
│ │ │ │ │ ├── list-items.png
│ │ │ │ │ ├── next-page-items.png
│ │ │ │ │ ├── no-data.png
│ │ │ │ │ ├── pagination-1.jpg
│ │ │ │ │ ├── pagination-1.png
│ │ │ │ │ ├── polling-1.png
│ │ │ │ │ ├── refetch-data.png
│ │ │ │ │ ├── slow-loading.png
│ │ │ │ │ ├── test-message.png
│ │ │ │ │ ├── Thumbs.db
│ │ │ │ │ ├── unconventional-data.png
│ │ │ │ │ └── unfiltered-items.png
│ │ │ │ ├── flower.jpg
│ │ │ │ ├── get-started
│ │ │ │ │ ├── add-new-contact.png
│ │ │ │ │ ├── app-modified.png
│ │ │ │ │ ├── app-start.png
│ │ │ │ │ ├── app-with-boxes.png
│ │ │ │ │ ├── app-with-toast.png
│ │ │ │ │ ├── boilerplate-structure.png
│ │ │ │ │ ├── cl-initial.png
│ │ │ │ │ ├── cl-start.png
│ │ │ │ │ ├── contact-counts.png
│ │ │ │ │ ├── contact-dialog-title.png
│ │ │ │ │ ├── contact-dialog.png
│ │ │ │ │ ├── contact-menus.png
│ │ │ │ │ ├── contact-predicates.png
│ │ │ │ │ ├── context-menu.png
│ │ │ │ │ ├── dashboard-numbers.png
│ │ │ │ │ ├── default-contact-list.png
│ │ │ │ │ ├── delete-contact.png
│ │ │ │ │ ├── delete-task.png
│ │ │ │ │ ├── detailed-template.png
│ │ │ │ │ ├── edit-contact-details.png
│ │ │ │ │ ├── edited-contact-saved.png
│ │ │ │ │ ├── empty-sections.png
│ │ │ │ │ ├── filter-completed.png
│ │ │ │ │ ├── fullwidth-desktop.png
│ │ │ │ │ ├── fullwidth-mobile.png
│ │ │ │ │ ├── initial-table.png
│ │ │ │ │ ├── items-and-badges.png
│ │ │ │ │ ├── loading-message.png
│ │ │ │ │ ├── new-contact-button.png
│ │ │ │ │ ├── new-contact-saved.png
│ │ │ │ │ ├── no-empty-sections.png
│ │ │ │ │ ├── personal-todo-initial.png
│ │ │ │ │ ├── piechart.png
│ │ │ │ │ ├── review-today.png
│ │ │ │ │ ├── rudimentary-dashboard.png
│ │ │ │ │ ├── section-collapsed.png
│ │ │ │ │ ├── sectioned-items.png
│ │ │ │ │ ├── sections-ordered.png
│ │ │ │ │ ├── spacex-list-with-links.png
│ │ │ │ │ ├── spacex-list.png
│ │ │ │ │ ├── start-personal-todo-1.png
│ │ │ │ │ ├── submit-new-contact.png
│ │ │ │ │ ├── submit-new-task.png
│ │ │ │ │ ├── syntax-highlighting.png
│ │ │ │ │ ├── table-with-badge.png
│ │ │ │ │ ├── template-with-card.png
│ │ │ │ │ ├── test-emulated-api.png
│ │ │ │ │ ├── Thumbs.db
│ │ │ │ │ ├── todo-logo.png
│ │ │ │ │ └── xmlui-tools.png
│ │ │ │ ├── HelloApp.png
│ │ │ │ ├── HelloApp2.png
│ │ │ │ ├── logos
│ │ │ │ │ ├── xmlui1.svg
│ │ │ │ │ ├── xmlui2.svg
│ │ │ │ │ ├── xmlui3.svg
│ │ │ │ │ ├── xmlui4.svg
│ │ │ │ │ ├── xmlui5.svg
│ │ │ │ │ ├── xmlui6.svg
│ │ │ │ │ └── xmlui7.svg
│ │ │ │ ├── pdf
│ │ │ │ │ └── dummy-pdf.jpg
│ │ │ │ ├── rendering-engine
│ │ │ │ │ ├── AppEngine-flow.svg
│ │ │ │ │ ├── Component.svg
│ │ │ │ │ ├── CompoundComponent.svg
│ │ │ │ │ ├── RootComponent.svg
│ │ │ │ │ └── tree-with-containers.svg
│ │ │ │ ├── reviewers-guide
│ │ │ │ │ ├── AppEngine-flow.svg
│ │ │ │ │ └── incbutton-in-action.png
│ │ │ │ ├── tools
│ │ │ │ │ └── boilerplate-structure.png
│ │ │ │ ├── try.svg
│ │ │ │ ├── tutorial
│ │ │ │ │ ├── app-chat-history.png
│ │ │ │ │ ├── app-content-placeholder.png
│ │ │ │ │ ├── app-header-and-content.png
│ │ │ │ │ ├── app-links-channel-selected.png
│ │ │ │ │ ├── app-links-click.png
│ │ │ │ │ ├── app-navigation.png
│ │ │ │ │ ├── finished-ex01.png
│ │ │ │ │ ├── finished-ex02.png
│ │ │ │ │ ├── hello.png
│ │ │ │ │ ├── splash-screen-advanced.png
│ │ │ │ │ ├── splash-screen-after-click.png
│ │ │ │ │ ├── splash-screen-centered.png
│ │ │ │ │ ├── splash-screen-events.png
│ │ │ │ │ ├── splash-screen-expression.png
│ │ │ │ │ ├── splash-screen-reuse-after.png
│ │ │ │ │ ├── splash-screen-reuse-before.png
│ │ │ │ │ └── splash-screen.png
│ │ │ │ └── tutorial-01.png
│ │ │ ├── llms.txt
│ │ │ ├── logo-dark.svg
│ │ │ ├── logo.svg
│ │ │ ├── pg-popout.svg
│ │ │ └── xmlui-logo.svg
│ │ ├── serve.json
│ │ └── web.config
│ ├── scripts
│ │ ├── download-latest-xmlui.js
│ │ ├── generate-rss.js
│ │ ├── get-releases.js
│ │ └── utils.js
│ ├── src
│ │ ├── components
│ │ │ ├── BlogOverview.xmlui
│ │ │ ├── BlogPage.xmlui
│ │ │ ├── Boxes.xmlui
│ │ │ ├── Breadcrumb.xmlui
│ │ │ ├── ChangeLog.xmlui
│ │ │ ├── ColorPalette.xmlui
│ │ │ ├── DocumentLinks.xmlui
│ │ │ ├── DocumentPage.xmlui
│ │ │ ├── DocumentPageNoTOC.xmlui
│ │ │ ├── Icons.xmlui
│ │ │ ├── IncButton.xmlui
│ │ │ ├── IncButton2.xmlui
│ │ │ ├── NameValue.xmlui
│ │ │ ├── PageNotFound.xmlui
│ │ │ ├── PaletteItem.xmlui
│ │ │ ├── Palettes.xmlui
│ │ │ ├── SectionHeader.xmlui
│ │ │ ├── TBD.xmlui
│ │ │ ├── Test.xmlui
│ │ │ ├── ThemesIntro.xmlui
│ │ │ ├── ThousandThemes.xmlui
│ │ │ ├── TubeStops.xmlui
│ │ │ ├── TubeStops.xmlui.xs
│ │ │ └── TwoColumnCode.xmlui
│ │ ├── config.ts
│ │ ├── Main.xmlui
│ │ └── themes
│ │ ├── docs-theme.ts
│ │ ├── earthtone.ts
│ │ ├── xmlui-gray-on-default.ts
│ │ ├── xmlui-green-on-default.ts
│ │ └── xmlui-orange-on-default.ts
│ └── tsconfig.json
├── LICENSE
├── package-lock.json
├── package.json
├── packages
│ ├── tsconfig.json
│ ├── xmlui-animations
│ │ ├── .gitignore
│ │ ├── CHANGELOG.md
│ │ ├── demo
│ │ │ └── Main.xmlui
│ │ ├── index.html
│ │ ├── index.ts
│ │ ├── meta
│ │ │ └── componentsMetadata.ts
│ │ ├── package.json
│ │ └── src
│ │ ├── Animation.tsx
│ │ ├── AnimationNative.tsx
│ │ ├── FadeAnimation.tsx
│ │ ├── FadeInAnimation.tsx
│ │ ├── FadeOutAnimation.tsx
│ │ ├── index.tsx
│ │ ├── ScaleAnimation.tsx
│ │ └── SlideInAnimation.tsx
│ ├── xmlui-devtools
│ │ ├── .gitignore
│ │ ├── CHANGELOG.md
│ │ ├── demo
│ │ │ └── Main.xmlui
│ │ ├── index.html
│ │ ├── index.ts
│ │ ├── meta
│ │ │ └── componentsMetadata.ts
│ │ ├── package.json
│ │ ├── src
│ │ │ ├── devtools
│ │ │ │ ├── DevTools.tsx
│ │ │ │ ├── DevToolsNative.module.scss
│ │ │ │ ├── DevToolsNative.tsx
│ │ │ │ ├── ModalDialog.module.scss
│ │ │ │ ├── ModalDialog.tsx
│ │ │ │ ├── ModalVisibilityContext.tsx
│ │ │ │ ├── Tooltip.module.scss
│ │ │ │ ├── Tooltip.tsx
│ │ │ │ └── utils.ts
│ │ │ ├── editor
│ │ │ │ └── Editor.tsx
│ │ │ └── index.tsx
│ │ └── vite.config-overrides.ts
│ ├── xmlui-hello-world
│ │ ├── .gitignore
│ │ ├── index.ts
│ │ ├── meta
│ │ │ └── componentsMetadata.ts
│ │ ├── package.json
│ │ └── src
│ │ ├── HelloWorld.module.scss
│ │ ├── HelloWorld.tsx
│ │ ├── HelloWorldNative.tsx
│ │ └── index.tsx
│ ├── xmlui-os-frames
│ │ ├── .gitignore
│ │ ├── demo
│ │ │ └── Main.xmlui
│ │ ├── index.html
│ │ ├── index.ts
│ │ ├── meta
│ │ │ └── componentsMetadata.ts
│ │ ├── package.json
│ │ └── src
│ │ ├── index.tsx
│ │ ├── IPhoneFrame.module.scss
│ │ ├── IPhoneFrame.tsx
│ │ ├── MacOSAppFrame.module.scss
│ │ ├── MacOSAppFrame.tsx
│ │ ├── WindowsAppFrame.module.scss
│ │ └── WindowsAppFrame.tsx
│ ├── xmlui-pdf
│ │ ├── .gitignore
│ │ ├── CHANGELOG.md
│ │ ├── demo
│ │ │ ├── components
│ │ │ │ └── Pdf.xmlui
│ │ │ └── Main.xmlui
│ │ ├── index.html
│ │ ├── index.ts
│ │ ├── meta
│ │ │ └── componentsMetadata.ts
│ │ ├── package.json
│ │ └── src
│ │ ├── index.tsx
│ │ ├── LazyPdfNative.tsx
│ │ ├── Pdf.module.scss
│ │ └── Pdf.tsx
│ ├── xmlui-playground
│ │ ├── .gitignore
│ │ ├── CHANGELOG.md
│ │ ├── demo
│ │ │ └── Main.xmlui
│ │ ├── index.html
│ │ ├── index.ts
│ │ ├── meta
│ │ │ └── componentsMetadata.ts
│ │ ├── package.json
│ │ └── src
│ │ ├── hooks
│ │ │ ├── usePlayground.ts
│ │ │ └── useToast.ts
│ │ ├── index.tsx
│ │ ├── playground
│ │ │ ├── Box.module.scss
│ │ │ ├── Box.tsx
│ │ │ ├── CodeSelector.module.scss
│ │ │ ├── CodeSelector.tsx
│ │ │ ├── ConfirmationDialog.module.scss
│ │ │ ├── ConfirmationDialog.tsx
│ │ │ ├── Editor.tsx
│ │ │ ├── Header.module.scss
│ │ │ ├── Header.tsx
│ │ │ ├── Playground.tsx
│ │ │ ├── PlaygroundContent.module.scss
│ │ │ ├── PlaygroundContent.tsx
│ │ │ ├── PlaygroundNative.module.scss
│ │ │ ├── PlaygroundNative.tsx
│ │ │ ├── Preview.tsx
│ │ │ ├── StandalonePlayground.tsx
│ │ │ ├── StandalonePlaygroundNative.module.scss
│ │ │ ├── StandalonePlaygroundNative.tsx
│ │ │ ├── ThemeSwitcher.module.scss
│ │ │ ├── ThemeSwitcher.tsx
│ │ │ └── utils.ts
│ │ ├── providers
│ │ │ ├── Toast.module.scss
│ │ │ └── ToastProvider.tsx
│ │ ├── state
│ │ │ └── store.ts
│ │ ├── themes
│ │ │ └── theme.ts
│ │ └── utils
│ │ └── helpers.ts
│ ├── xmlui-search
│ │ ├── .gitignore
│ │ ├── CHANGELOG.md
│ │ ├── demo
│ │ │ └── Main.xmlui
│ │ ├── index.html
│ │ ├── index.ts
│ │ ├── meta
│ │ │ └── componentsMetadata.ts
│ │ ├── package.json
│ │ └── src
│ │ ├── index.tsx
│ │ ├── Search.module.scss
│ │ └── Search.tsx
│ ├── xmlui-spreadsheet
│ │ ├── .gitignore
│ │ ├── demo
│ │ │ └── Main.xmlui
│ │ ├── index.html
│ │ ├── index.ts
│ │ ├── meta
│ │ │ └── componentsMetadata.ts
│ │ ├── package.json
│ │ └── src
│ │ ├── index.tsx
│ │ ├── Spreadsheet.tsx
│ │ └── SpreadsheetNative.tsx
│ └── xmlui-website-blocks
│ ├── .gitignore
│ ├── CHANGELOG.md
│ ├── demo
│ │ ├── components
│ │ │ ├── HeroBackgroundBreakoutPage.xmlui
│ │ │ ├── HeroBackgroundsPage.xmlui
│ │ │ ├── HeroContentsPage.xmlui
│ │ │ ├── HeroTextAlignPage.xmlui
│ │ │ ├── HeroTextPage.xmlui
│ │ │ └── HeroTonesPage.xmlui
│ │ ├── Main.xmlui
│ │ └── themes
│ │ └── default.ts
│ ├── index.html
│ ├── index.ts
│ ├── meta
│ │ └── componentsMetadata.ts
│ ├── package.json
│ ├── public
│ │ └── resources
│ │ ├── building.jpg
│ │ └── xmlui-logo.svg
│ └── src
│ ├── Carousel
│ │ ├── Carousel.module.scss
│ │ ├── Carousel.tsx
│ │ ├── CarouselContext.tsx
│ │ └── CarouselNative.tsx
│ ├── FancyButton
│ │ ├── FancyButton.module.scss
│ │ ├── FancyButton.tsx
│ │ └── FancyButton.xmlui
│ ├── Hello
│ │ ├── Hello.tsx
│ │ ├── Hello.xmlui
│ │ └── Hello.xmlui.xs
│ ├── HeroSection
│ │ ├── HeroSection.module.scss
│ │ ├── HeroSection.spec.ts
│ │ ├── HeroSection.tsx
│ │ └── HeroSectionNative.tsx
│ ├── index.tsx
│ ├── ScrollToTop
│ │ ├── ScrollToTop.module.scss
│ │ ├── ScrollToTop.tsx
│ │ └── ScrollToTopNative.tsx
│ └── vite-env.d.ts
├── playwright.config.ts
├── README.md
├── tools
│ ├── codefence
│ │ └── xmlui-code-fence-docs.md
│ ├── create-app
│ │ ├── .gitignore
│ │ ├── CHANGELOG.md
│ │ ├── create-app.ts
│ │ ├── helpers
│ │ │ ├── copy.ts
│ │ │ ├── get-pkg-manager.ts
│ │ │ ├── git.ts
│ │ │ ├── install.ts
│ │ │ ├── is-folder-empty.ts
│ │ │ ├── is-writeable.ts
│ │ │ ├── make-dir.ts
│ │ │ └── validate-pkg.ts
│ │ ├── index.ts
│ │ ├── package.json
│ │ ├── templates
│ │ │ ├── default
│ │ │ │ └── ts
│ │ │ │ ├── gitignore
│ │ │ │ ├── index.html
│ │ │ │ ├── index.ts
│ │ │ │ ├── public
│ │ │ │ │ ├── mockServiceWorker.js
│ │ │ │ │ ├── resources
│ │ │ │ │ │ ├── favicon.ico
│ │ │ │ │ │ └── xmlui-logo.svg
│ │ │ │ │ └── serve.json
│ │ │ │ └── src
│ │ │ │ ├── components
│ │ │ │ │ ├── ApiAware.xmlui
│ │ │ │ │ ├── Home.xmlui
│ │ │ │ │ ├── IncButton.xmlui
│ │ │ │ │ └── PagePanel.xmlui
│ │ │ │ ├── config.ts
│ │ │ │ └── Main.xmlui
│ │ │ ├── index.ts
│ │ │ └── types.ts
│ │ └── tsconfig.json
│ ├── create-xmlui-hello-world
│ │ ├── index.js
│ │ └── package.json
│ └── vscode
│ ├── .gitignore
│ ├── .vscode
│ │ ├── launch.json
│ │ └── tasks.json
│ ├── .vscodeignore
│ ├── build.sh
│ ├── CHANGELOG.md
│ ├── esbuild.js
│ ├── eslint.config.mjs
│ ├── formatter-docs.md
│ ├── generate-test-sample.sh
│ ├── LICENSE.md
│ ├── package-lock.json
│ ├── package.json
│ ├── README.md
│ ├── resources
│ │ ├── xmlui-logo.png
│ │ └── xmlui-markup-syntax-highlighting.png
│ ├── src
│ │ ├── extension.ts
│ │ └── server.ts
│ ├── syntaxes
│ │ └── xmlui.tmLanguage.json
│ ├── test-samples
│ │ └── sample.xmlui
│ ├── tsconfig.json
│ └── tsconfig.tsbuildinfo
├── turbo.json
└── xmlui
├── .gitignore
├── bin
│ ├── bootstrap.cjs
│ ├── bootstrap.js
│ ├── build-lib.ts
│ ├── build.ts
│ ├── index.ts
│ ├── preview.ts
│ ├── start.ts
│ ├── vite-xmlui-plugin.ts
│ └── viteConfig.ts
├── CHANGELOG.md
├── conventions
│ ├── component-qa-checklist.md
│ ├── copilot-conventions.md
│ ├── create-xmlui-components.md
│ ├── mermaid.md
│ ├── testing-conventions.md
│ └── xmlui-in-a-nutshell.md
├── dev-docs
│ ├── accessibility.md
│ ├── build-system.md
│ ├── build-xmlui.md
│ ├── component-behaviors.md
│ ├── component-metadata.md
│ ├── components-with-options.md
│ ├── containers.md
│ ├── data-operations.md
│ ├── glossary.md
│ ├── index.md
│ ├── next
│ │ ├── component-dev-guide.md
│ │ ├── configuration-management-enhancement-summary.md
│ │ ├── documentation-scripts-refactoring-complete-summary.md
│ │ ├── documentation-scripts-refactoring-plan.md
│ │ ├── duplicate-pattern-extraction-summary.md
│ │ ├── error-handling-standardization-summary.md
│ │ ├── generating-component-reference.md
│ │ ├── index.md
│ │ ├── logging-consistency-implementation-summary.md
│ │ ├── project-build.md
│ │ ├── project-structure.md
│ │ ├── theme-context.md
│ │ ├── tiptap-design-considerations.md
│ │ ├── working-with-code.md
│ │ ├── xmlui-runtime-architecture
│ │ └── xmlui-wcag-accessibility-report.md
│ ├── react-fundamentals.md
│ ├── release-method.md
│ ├── standalone-app.md
│ ├── theme-variables-refactoring.md
│ ├── ud-components.md
│ └── xmlui-repo.md
├── package.json
├── scripts
│ ├── coverage-only.js
│ ├── e2e-test-summary.js
│ ├── extract-component-metadata.js
│ ├── generate-docs
│ │ ├── build-downloads-map.mjs
│ │ ├── build-pages-map.mjs
│ │ ├── components-config.json
│ │ ├── configuration-management.mjs
│ │ ├── constants.mjs
│ │ ├── create-theme-files.mjs
│ │ ├── DocsGenerator.mjs
│ │ ├── error-handling.mjs
│ │ ├── extensions-config.json
│ │ ├── folders.mjs
│ │ ├── generate-summary-files.mjs
│ │ ├── get-docs.mjs
│ │ ├── input-handler.mjs
│ │ ├── logger.mjs
│ │ ├── logging-standards.mjs
│ │ ├── MetadataProcessor.mjs
│ │ ├── pattern-utilities.mjs
│ │ └── utils.mjs
│ ├── generate-metadata-markdown.js
│ ├── get-langserver-metadata.js
│ ├── inline-links.mjs
│ └── README-e2e-summary.md
├── src
│ ├── abstractions
│ │ ├── _conventions.md
│ │ ├── ActionDefs.ts
│ │ ├── AppContextDefs.ts
│ │ ├── ComponentDefs.ts
│ │ ├── ContainerDefs.ts
│ │ ├── ExtensionDefs.ts
│ │ ├── FunctionDefs.ts
│ │ ├── RendererDefs.ts
│ │ ├── scripting
│ │ │ ├── BlockScope.ts
│ │ │ ├── Compilation.ts
│ │ │ ├── LogicalThread.ts
│ │ │ ├── LoopScope.ts
│ │ │ ├── modules.ts
│ │ │ ├── ScriptParserError.ts
│ │ │ ├── Token.ts
│ │ │ ├── TryScope.ts
│ │ │ └── TryScopeExp.ts
│ │ └── ThemingDefs.ts
│ ├── components
│ │ ├── _conventions.md
│ │ ├── abstractions.ts
│ │ ├── Accordion
│ │ │ ├── Accordion.md
│ │ │ ├── Accordion.module.scss
│ │ │ ├── Accordion.spec.ts
│ │ │ ├── Accordion.tsx
│ │ │ ├── AccordionContext.tsx
│ │ │ ├── AccordionItem.tsx
│ │ │ ├── AccordionItemNative.tsx
│ │ │ └── AccordionNative.tsx
│ │ ├── Animation
│ │ │ └── AnimationNative.tsx
│ │ ├── APICall
│ │ │ ├── APICall.md
│ │ │ ├── APICall.spec.ts
│ │ │ ├── APICall.tsx
│ │ │ └── APICallNative.tsx
│ │ ├── App
│ │ │ ├── App.md
│ │ │ ├── App.module.scss
│ │ │ ├── App.spec.ts
│ │ │ ├── App.tsx
│ │ │ ├── AppLayoutContext.ts
│ │ │ ├── AppNative.tsx
│ │ │ ├── AppStateContext.ts
│ │ │ ├── doc-resources
│ │ │ │ ├── condensed-sticky.xmlui
│ │ │ │ ├── condensed.xmlui
│ │ │ │ ├── horizontal-sticky.xmlui
│ │ │ │ ├── horizontal.xmlui
│ │ │ │ ├── vertical-full-header.xmlui
│ │ │ │ ├── vertical-sticky.xmlui
│ │ │ │ └── vertical.xmlui
│ │ │ ├── IndexerContext.ts
│ │ │ ├── LinkInfoContext.ts
│ │ │ ├── SearchContext.tsx
│ │ │ ├── Sheet.module.scss
│ │ │ └── Sheet.tsx
│ │ ├── AppHeader
│ │ │ ├── AppHeader.md
│ │ │ ├── AppHeader.module.scss
│ │ │ ├── AppHeader.spec.ts
│ │ │ ├── AppHeader.tsx
│ │ │ └── AppHeaderNative.tsx
│ │ ├── AppState
│ │ │ ├── AppState.md
│ │ │ ├── AppState.spec.ts
│ │ │ ├── AppState.tsx
│ │ │ └── AppStateNative.tsx
│ │ ├── AutoComplete
│ │ │ ├── AutoComplete.md
│ │ │ ├── AutoComplete.module.scss
│ │ │ ├── AutoComplete.spec.ts
│ │ │ ├── AutoComplete.tsx
│ │ │ ├── AutoCompleteContext.tsx
│ │ │ └── AutoCompleteNative.tsx
│ │ ├── Avatar
│ │ │ ├── Avatar.md
│ │ │ ├── Avatar.module.scss
│ │ │ ├── Avatar.spec.ts
│ │ │ ├── Avatar.tsx
│ │ │ └── AvatarNative.tsx
│ │ ├── Backdrop
│ │ │ ├── Backdrop.md
│ │ │ ├── Backdrop.module.scss
│ │ │ ├── Backdrop.spec.ts
│ │ │ ├── Backdrop.tsx
│ │ │ └── BackdropNative.tsx
│ │ ├── Badge
│ │ │ ├── Badge.md
│ │ │ ├── Badge.module.scss
│ │ │ ├── Badge.spec.ts
│ │ │ ├── Badge.tsx
│ │ │ └── BadgeNative.tsx
│ │ ├── Bookmark
│ │ │ ├── Bookmark.md
│ │ │ ├── Bookmark.module.scss
│ │ │ ├── Bookmark.spec.ts
│ │ │ ├── Bookmark.tsx
│ │ │ └── BookmarkNative.tsx
│ │ ├── Breakout
│ │ │ ├── Breakout.module.scss
│ │ │ ├── Breakout.spec.ts
│ │ │ ├── Breakout.tsx
│ │ │ └── BreakoutNative.tsx
│ │ ├── Button
│ │ │ ├── Button-style.spec.ts
│ │ │ ├── Button.md
│ │ │ ├── Button.module.scss
│ │ │ ├── Button.spec.ts
│ │ │ ├── Button.tsx
│ │ │ └── ButtonNative.tsx
│ │ ├── Card
│ │ │ ├── Card.md
│ │ │ ├── Card.module.scss
│ │ │ ├── Card.spec.ts
│ │ │ ├── Card.tsx
│ │ │ └── CardNative.tsx
│ │ ├── Carousel
│ │ │ ├── Carousel.md
│ │ │ ├── Carousel.module.scss
│ │ │ ├── Carousel.spec.ts
│ │ │ ├── Carousel.tsx
│ │ │ ├── CarouselContext.tsx
│ │ │ ├── CarouselItem.tsx
│ │ │ ├── CarouselItemNative.tsx
│ │ │ └── CarouselNative.tsx
│ │ ├── ChangeListener
│ │ │ ├── ChangeListener.md
│ │ │ ├── ChangeListener.spec.ts
│ │ │ ├── ChangeListener.tsx
│ │ │ └── ChangeListenerNative.tsx
│ │ ├── chart-color-schemes.ts
│ │ ├── Charts
│ │ │ ├── AreaChart
│ │ │ │ ├── AreaChart.md
│ │ │ │ ├── AreaChart.spec.ts
│ │ │ │ ├── AreaChart.tsx
│ │ │ │ └── AreaChartNative.tsx
│ │ │ ├── BarChart
│ │ │ │ ├── BarChart.md
│ │ │ │ ├── BarChart.module.scss
│ │ │ │ ├── BarChart.spec.ts
│ │ │ │ ├── BarChart.tsx
│ │ │ │ └── BarChartNative.tsx
│ │ │ ├── DonutChart
│ │ │ │ ├── DonutChart.spec.ts
│ │ │ │ └── DonutChart.tsx
│ │ │ ├── LabelList
│ │ │ │ ├── LabelList.module.scss
│ │ │ │ ├── LabelList.spec.ts
│ │ │ │ ├── LabelList.tsx
│ │ │ │ └── LabelListNative.tsx
│ │ │ ├── Legend
│ │ │ │ ├── Legend.spec.ts
│ │ │ │ ├── Legend.tsx
│ │ │ │ └── LegendNative.tsx
│ │ │ ├── LineChart
│ │ │ │ ├── LineChart.md
│ │ │ │ ├── LineChart.module.scss
│ │ │ │ ├── LineChart.spec.ts
│ │ │ │ ├── LineChart.tsx
│ │ │ │ └── LineChartNative.tsx
│ │ │ ├── PieChart
│ │ │ │ ├── PieChart.md
│ │ │ │ ├── PieChart.spec.ts
│ │ │ │ ├── PieChart.tsx
│ │ │ │ ├── PieChartNative.module.scss
│ │ │ │ └── PieChartNative.tsx
│ │ │ ├── RadarChart
│ │ │ │ ├── RadarChart.md
│ │ │ │ ├── RadarChart.spec.ts
│ │ │ │ ├── RadarChart.tsx
│ │ │ │ └── RadarChartNative.tsx
│ │ │ ├── Tooltip
│ │ │ │ ├── TooltipContent.module.scss
│ │ │ │ ├── TooltipContent.spec.ts
│ │ │ │ └── TooltipContent.tsx
│ │ │ └── utils
│ │ │ ├── abstractions.ts
│ │ │ └── ChartProvider.tsx
│ │ ├── Checkbox
│ │ │ ├── Checkbox.md
│ │ │ ├── Checkbox.spec.ts
│ │ │ └── Checkbox.tsx
│ │ ├── CodeBlock
│ │ │ ├── CodeBlock.module.scss
│ │ │ ├── CodeBlock.spec.ts
│ │ │ ├── CodeBlock.tsx
│ │ │ ├── CodeBlockNative.tsx
│ │ │ └── highlight-code.ts
│ │ ├── collectedComponentMetadata.ts
│ │ ├── ColorPicker
│ │ │ ├── ColorPicker.md
│ │ │ ├── ColorPicker.module.scss
│ │ │ ├── ColorPicker.spec.ts
│ │ │ ├── ColorPicker.tsx
│ │ │ └── ColorPickerNative.tsx
│ │ ├── Column
│ │ │ ├── Column.md
│ │ │ ├── Column.tsx
│ │ │ ├── ColumnNative.tsx
│ │ │ ├── doc-resources
│ │ │ │ └── list-component-data.js
│ │ │ └── TableContext.tsx
│ │ ├── component-utils.ts
│ │ ├── ComponentProvider.tsx
│ │ ├── ComponentRegistryContext.tsx
│ │ ├── container-helpers.tsx
│ │ ├── ContentSeparator
│ │ │ ├── ContentSeparator.md
│ │ │ ├── ContentSeparator.module.scss
│ │ │ ├── ContentSeparator.spec.ts
│ │ │ ├── ContentSeparator.tsx
│ │ │ └── ContentSeparatorNative.tsx
│ │ ├── DataSource
│ │ │ ├── DataSource.md
│ │ │ └── DataSource.tsx
│ │ ├── DateInput
│ │ │ ├── DateInput.md
│ │ │ ├── DateInput.module.scss
│ │ │ ├── DateInput.spec.ts
│ │ │ ├── DateInput.tsx
│ │ │ └── DateInputNative.tsx
│ │ ├── DatePicker
│ │ │ ├── DatePicker.md
│ │ │ ├── DatePicker.module.scss
│ │ │ ├── DatePicker.spec.ts
│ │ │ ├── DatePicker.tsx
│ │ │ └── DatePickerNative.tsx
│ │ ├── DropdownMenu
│ │ │ ├── DropdownMenu.md
│ │ │ ├── DropdownMenu.module.scss
│ │ │ ├── DropdownMenu.spec.ts
│ │ │ ├── DropdownMenu.tsx
│ │ │ ├── DropdownMenuNative.tsx
│ │ │ ├── MenuItem.md
│ │ │ └── SubMenuItem.md
│ │ ├── EmojiSelector
│ │ │ ├── EmojiSelector.md
│ │ │ ├── EmojiSelector.spec.ts
│ │ │ ├── EmojiSelector.tsx
│ │ │ └── EmojiSelectorNative.tsx
│ │ ├── ExpandableItem
│ │ │ ├── ExpandableItem.module.scss
│ │ │ ├── ExpandableItem.spec.ts
│ │ │ ├── ExpandableItem.tsx
│ │ │ └── ExpandableItemNative.tsx
│ │ ├── FileInput
│ │ │ ├── FileInput.md
│ │ │ ├── FileInput.module.scss
│ │ │ ├── FileInput.spec.ts
│ │ │ ├── FileInput.tsx
│ │ │ └── FileInputNative.tsx
│ │ ├── FileUploadDropZone
│ │ │ ├── FileUploadDropZone.md
│ │ │ ├── FileUploadDropZone.module.scss
│ │ │ ├── FileUploadDropZone.spec.ts
│ │ │ ├── FileUploadDropZone.tsx
│ │ │ └── FileUploadDropZoneNative.tsx
│ │ ├── FlowLayout
│ │ │ ├── FlowLayout.md
│ │ │ ├── FlowLayout.module.scss
│ │ │ ├── FlowLayout.spec.ts
│ │ │ ├── FlowLayout.spec.ts-snapshots
│ │ │ │ └── Edge-cases-boxShadow-is-not-clipped-1-non-smoke-darwin.png
│ │ │ ├── FlowLayout.tsx
│ │ │ └── FlowLayoutNative.tsx
│ │ ├── Footer
│ │ │ ├── Footer.md
│ │ │ ├── Footer.module.scss
│ │ │ ├── Footer.spec.ts
│ │ │ ├── Footer.tsx
│ │ │ └── FooterNative.tsx
│ │ ├── Form
│ │ │ ├── Form.md
│ │ │ ├── Form.module.scss
│ │ │ ├── Form.spec.ts
│ │ │ ├── Form.tsx
│ │ │ ├── formActions.ts
│ │ │ ├── FormContext.ts
│ │ │ └── FormNative.tsx
│ │ ├── FormItem
│ │ │ ├── FormItem.md
│ │ │ ├── FormItem.module.scss
│ │ │ ├── FormItem.spec.ts
│ │ │ ├── FormItem.tsx
│ │ │ ├── FormItemNative.tsx
│ │ │ ├── HelperText.module.scss
│ │ │ ├── HelperText.tsx
│ │ │ ├── ItemWithLabel.tsx
│ │ │ └── Validations.ts
│ │ ├── FormSection
│ │ │ ├── FormSection.md
│ │ │ ├── FormSection.ts
│ │ │ └── FormSection.xmlui
│ │ ├── Fragment
│ │ │ ├── Fragment.spec.ts
│ │ │ └── Fragment.tsx
│ │ ├── Heading
│ │ │ ├── abstractions.ts
│ │ │ ├── H1.md
│ │ │ ├── H1.spec.ts
│ │ │ ├── H2.md
│ │ │ ├── H2.spec.ts
│ │ │ ├── H3.md
│ │ │ ├── H3.spec.ts
│ │ │ ├── H4.md
│ │ │ ├── H4.spec.ts
│ │ │ ├── H5.md
│ │ │ ├── H5.spec.ts
│ │ │ ├── H6.md
│ │ │ ├── H6.spec.ts
│ │ │ ├── Heading.md
│ │ │ ├── Heading.module.scss
│ │ │ ├── Heading.spec.ts
│ │ │ ├── Heading.tsx
│ │ │ └── HeadingNative.tsx
│ │ ├── HoverCard
│ │ │ ├── HoverCard.tsx
│ │ │ └── HovercardNative.tsx
│ │ ├── HtmlTags
│ │ │ ├── HtmlTags.module.scss
│ │ │ ├── HtmlTags.spec.ts
│ │ │ └── HtmlTags.tsx
│ │ ├── Icon
│ │ │ ├── AdmonitionDanger.tsx
│ │ │ ├── AdmonitionInfo.tsx
│ │ │ ├── AdmonitionNote.tsx
│ │ │ ├── AdmonitionTip.tsx
│ │ │ ├── AdmonitionWarning.tsx
│ │ │ ├── ApiIcon.tsx
│ │ │ ├── ArrowDropDown.module.scss
│ │ │ ├── ArrowDropDown.tsx
│ │ │ ├── ArrowDropUp.module.scss
│ │ │ ├── ArrowDropUp.tsx
│ │ │ ├── ArrowLeft.module.scss
│ │ │ ├── ArrowLeft.tsx
│ │ │ ├── ArrowRight.module.scss
│ │ │ ├── ArrowRight.tsx
│ │ │ ├── Attach.tsx
│ │ │ ├── Binding.module.scss
│ │ │ ├── Binding.tsx
│ │ │ ├── BoardIcon.tsx
│ │ │ ├── BoxIcon.tsx
│ │ │ ├── CheckIcon.tsx
│ │ │ ├── ChevronDownIcon.tsx
│ │ │ ├── ChevronLeft.tsx
│ │ │ ├── ChevronRight.tsx
│ │ │ ├── ChevronUpIcon.tsx
│ │ │ ├── CodeFileIcon.tsx
│ │ │ ├── CodeSandbox.tsx
│ │ │ ├── CompactListIcon.tsx
│ │ │ ├── ContentCopyIcon.tsx
│ │ │ ├── DarkToLightIcon.tsx
│ │ │ ├── DatabaseIcon.module.scss
│ │ │ ├── DatabaseIcon.tsx
│ │ │ ├── DocFileIcon.tsx
│ │ │ ├── DocIcon.tsx
│ │ │ ├── DotMenuHorizontalIcon.tsx
│ │ │ ├── DotMenuIcon.tsx
│ │ │ ├── EmailIcon.tsx
│ │ │ ├── EmptyFolderIcon.tsx
│ │ │ ├── ErrorIcon.tsx
│ │ │ ├── ExpressionIcon.tsx
│ │ │ ├── FillPlusCricleIcon.tsx
│ │ │ ├── FilterIcon.tsx
│ │ │ ├── FolderIcon.tsx
│ │ │ ├── GlobeIcon.tsx
│ │ │ ├── HomeIcon.tsx
│ │ │ ├── HyperLinkIcon.tsx
│ │ │ ├── Icon.md
│ │ │ ├── Icon.module.scss
│ │ │ ├── Icon.spec.ts
│ │ │ ├── Icon.tsx
│ │ │ ├── IconNative.tsx
│ │ │ ├── ImageFileIcon.tsx
│ │ │ ├── Inspect.tsx
│ │ │ ├── LightToDark.tsx
│ │ │ ├── LinkIcon.tsx
│ │ │ ├── ListIcon.tsx
│ │ │ ├── LooseListIcon.tsx
│ │ │ ├── MoonIcon.tsx
│ │ │ ├── MoreOptionsIcon.tsx
│ │ │ ├── NoSortIcon.tsx
│ │ │ ├── PDFIcon.tsx
│ │ │ ├── PenIcon.tsx
│ │ │ ├── PhoneIcon.tsx
│ │ │ ├── PhotoIcon.tsx
│ │ │ ├── PlusIcon.tsx
│ │ │ ├── SearchIcon.tsx
│ │ │ ├── ShareIcon.tsx
│ │ │ ├── SortAscendingIcon.tsx
│ │ │ ├── SortDescendingIcon.tsx
│ │ │ ├── StarsIcon.tsx
│ │ │ ├── SunIcon.tsx
│ │ │ ├── svg
│ │ │ │ ├── admonition_danger.svg
│ │ │ │ ├── admonition_info.svg
│ │ │ │ ├── admonition_note.svg
│ │ │ │ ├── admonition_tip.svg
│ │ │ │ ├── admonition_warning.svg
│ │ │ │ ├── api.svg
│ │ │ │ ├── arrow-dropdown.svg
│ │ │ │ ├── arrow-left.svg
│ │ │ │ ├── arrow-right.svg
│ │ │ │ ├── arrow-up.svg
│ │ │ │ ├── attach.svg
│ │ │ │ ├── binding.svg
│ │ │ │ ├── box.svg
│ │ │ │ ├── bulb.svg
│ │ │ │ ├── code-file.svg
│ │ │ │ ├── code-sandbox.svg
│ │ │ │ ├── dark_to_light.svg
│ │ │ │ ├── database.svg
│ │ │ │ ├── doc.svg
│ │ │ │ ├── empty-folder.svg
│ │ │ │ ├── expression.svg
│ │ │ │ ├── eye-closed.svg
│ │ │ │ ├── eye-dark.svg
│ │ │ │ ├── eye.svg
│ │ │ │ ├── file-text.svg
│ │ │ │ ├── filter.svg
│ │ │ │ ├── folder.svg
│ │ │ │ ├── img.svg
│ │ │ │ ├── inspect.svg
│ │ │ │ ├── light_to_dark.svg
│ │ │ │ ├── moon.svg
│ │ │ │ ├── pdf.svg
│ │ │ │ ├── photo.svg
│ │ │ │ ├── share.svg
│ │ │ │ ├── stars.svg
│ │ │ │ ├── sun.svg
│ │ │ │ ├── trending-down.svg
│ │ │ │ ├── trending-level.svg
│ │ │ │ ├── trending-up.svg
│ │ │ │ ├── txt.svg
│ │ │ │ ├── unknown-file.svg
│ │ │ │ ├── unlink.svg
│ │ │ │ └── xls.svg
│ │ │ ├── TableDeleteColumnIcon.tsx
│ │ │ ├── TableDeleteRowIcon.tsx
│ │ │ ├── TableInsertColumnIcon.tsx
│ │ │ ├── TableInsertRowIcon.tsx
│ │ │ ├── TrashIcon.tsx
│ │ │ ├── TrendingDownIcon.tsx
│ │ │ ├── TrendingLevelIcon.tsx
│ │ │ ├── TrendingUpIcon.tsx
│ │ │ ├── TxtIcon.tsx
│ │ │ ├── UnknownFileIcon.tsx
│ │ │ ├── UnlinkIcon.tsx
│ │ │ ├── UserIcon.tsx
│ │ │ ├── WarningIcon.tsx
│ │ │ └── XlsIcon.tsx
│ │ ├── IconProvider.tsx
│ │ ├── IconRegistryContext.tsx
│ │ ├── IFrame
│ │ │ ├── IFrame.md
│ │ │ ├── IFrame.module.scss
│ │ │ ├── IFrame.spec.ts
│ │ │ ├── IFrame.tsx
│ │ │ └── IFrameNative.tsx
│ │ ├── Image
│ │ │ ├── Image.md
│ │ │ ├── Image.module.scss
│ │ │ ├── Image.spec.ts
│ │ │ ├── Image.tsx
│ │ │ └── ImageNative.tsx
│ │ ├── Input
│ │ │ ├── index.ts
│ │ │ ├── InputAdornment.module.scss
│ │ │ ├── InputAdornment.tsx
│ │ │ ├── InputDivider.module.scss
│ │ │ ├── InputDivider.tsx
│ │ │ ├── InputLabel.module.scss
│ │ │ ├── InputLabel.tsx
│ │ │ ├── PartialInput.module.scss
│ │ │ └── PartialInput.tsx
│ │ ├── InspectButton
│ │ │ ├── InspectButton.module.scss
│ │ │ └── InspectButton.tsx
│ │ ├── Items
│ │ │ ├── Items.md
│ │ │ ├── Items.spec.ts
│ │ │ ├── Items.tsx
│ │ │ └── ItemsNative.tsx
│ │ ├── Link
│ │ │ ├── Link.md
│ │ │ ├── Link.module.scss
│ │ │ ├── Link.spec.ts
│ │ │ ├── Link.tsx
│ │ │ └── LinkNative.tsx
│ │ ├── List
│ │ │ ├── doc-resources
│ │ │ │ └── list-component-data.js
│ │ │ ├── List.md
│ │ │ ├── List.module.scss
│ │ │ ├── List.spec.ts
│ │ │ ├── List.tsx
│ │ │ └── ListNative.tsx
│ │ ├── Logo
│ │ │ ├── doc-resources
│ │ │ │ └── xmlui-logo.svg
│ │ │ ├── Logo.md
│ │ │ ├── Logo.tsx
│ │ │ └── LogoNative.tsx
│ │ ├── Markdown
│ │ │ ├── CodeText.module.scss
│ │ │ ├── CodeText.tsx
│ │ │ ├── Markdown.md
│ │ │ ├── Markdown.module.scss
│ │ │ ├── Markdown.spec.ts
│ │ │ ├── Markdown.tsx
│ │ │ ├── MarkdownNative.tsx
│ │ │ ├── parse-binding-expr.ts
│ │ │ └── utils.ts
│ │ ├── metadata-helpers.ts
│ │ ├── ModalDialog
│ │ │ ├── ConfirmationModalContextProvider.tsx
│ │ │ ├── Dialog.module.scss
│ │ │ ├── Dialog.tsx
│ │ │ ├── ModalDialog.md
│ │ │ ├── ModalDialog.module.scss
│ │ │ ├── ModalDialog.spec.ts
│ │ │ ├── ModalDialog.tsx
│ │ │ ├── ModalDialogNative.tsx
│ │ │ └── ModalVisibilityContext.tsx
│ │ ├── NavGroup
│ │ │ ├── NavGroup.md
│ │ │ ├── NavGroup.module.scss
│ │ │ ├── NavGroup.spec.ts
│ │ │ ├── NavGroup.tsx
│ │ │ ├── NavGroupContext.ts
│ │ │ └── NavGroupNative.tsx
│ │ ├── NavLink
│ │ │ ├── NavLink.md
│ │ │ ├── NavLink.module.scss
│ │ │ ├── NavLink.spec.ts
│ │ │ ├── NavLink.tsx
│ │ │ └── NavLinkNative.tsx
│ │ ├── NavPanel
│ │ │ ├── NavPanel.md
│ │ │ ├── NavPanel.module.scss
│ │ │ ├── NavPanel.spec.ts
│ │ │ ├── NavPanel.tsx
│ │ │ └── NavPanelNative.tsx
│ │ ├── NestedApp
│ │ │ ├── AppWithCodeView.module.scss
│ │ │ ├── AppWithCodeView.tsx
│ │ │ ├── AppWithCodeViewNative.tsx
│ │ │ ├── defaultProps.tsx
│ │ │ ├── logo.svg
│ │ │ ├── NestedApp.module.scss
│ │ │ ├── NestedApp.tsx
│ │ │ ├── NestedAppNative.tsx
│ │ │ ├── Tooltip.module.scss
│ │ │ ├── Tooltip.tsx
│ │ │ └── utils.ts
│ │ ├── NoResult
│ │ │ ├── NoResult.md
│ │ │ ├── NoResult.module.scss
│ │ │ ├── NoResult.spec.ts
│ │ │ ├── NoResult.tsx
│ │ │ └── NoResultNative.tsx
│ │ ├── NumberBox
│ │ │ ├── numberbox-abstractions.ts
│ │ │ ├── NumberBox.md
│ │ │ ├── NumberBox.module.scss
│ │ │ ├── NumberBox.spec.ts
│ │ │ ├── NumberBox.tsx
│ │ │ └── NumberBoxNative.tsx
│ │ ├── Option
│ │ │ ├── Option.md
│ │ │ ├── Option.spec.ts
│ │ │ ├── Option.tsx
│ │ │ ├── OptionNative.tsx
│ │ │ └── OptionTypeProvider.tsx
│ │ ├── PageMetaTitle
│ │ │ ├── PageMetaTilteNative.tsx
│ │ │ ├── PageMetaTitle.md
│ │ │ ├── PageMetaTitle.spec.ts
│ │ │ └── PageMetaTitle.tsx
│ │ ├── Pages
│ │ │ ├── Page.md
│ │ │ ├── Pages.md
│ │ │ ├── Pages.module.scss
│ │ │ ├── Pages.tsx
│ │ │ └── PagesNative.tsx
│ │ ├── Pagination
│ │ │ ├── Pagination.md
│ │ │ ├── Pagination.module.scss
│ │ │ ├── Pagination.spec.ts
│ │ │ ├── Pagination.tsx
│ │ │ └── PaginationNative.tsx
│ │ ├── PositionedContainer
│ │ │ ├── PositionedContainer.module.scss
│ │ │ ├── PositionedContainer.tsx
│ │ │ └── PositionedContainerNative.tsx
│ │ ├── ProfileMenu
│ │ │ ├── ProfileMenu.module.scss
│ │ │ └── ProfileMenu.tsx
│ │ ├── ProgressBar
│ │ │ ├── ProgressBar.md
│ │ │ ├── ProgressBar.module.scss
│ │ │ ├── ProgressBar.spec.ts
│ │ │ ├── ProgressBar.tsx
│ │ │ └── ProgressBarNative.tsx
│ │ ├── Queue
│ │ │ ├── Queue.md
│ │ │ ├── Queue.spec.ts
│ │ │ ├── Queue.tsx
│ │ │ ├── queueActions.ts
│ │ │ └── QueueNative.tsx
│ │ ├── RadioGroup
│ │ │ ├── RadioGroup.md
│ │ │ ├── RadioGroup.module.scss
│ │ │ ├── RadioGroup.spec.ts
│ │ │ ├── RadioGroup.tsx
│ │ │ ├── RadioGroupNative.tsx
│ │ │ ├── RadioItem.tsx
│ │ │ └── RadioItemNative.tsx
│ │ ├── RealTimeAdapter
│ │ │ ├── RealTimeAdapter.tsx
│ │ │ └── RealTimeAdapterNative.tsx
│ │ ├── Redirect
│ │ │ ├── Redirect.md
│ │ │ ├── Redirect.spec.ts
│ │ │ └── Redirect.tsx
│ │ ├── ResponsiveBar
│ │ │ ├── README.md
│ │ │ ├── ResponsiveBar.md
│ │ │ ├── ResponsiveBar.module.scss
│ │ │ ├── ResponsiveBar.spec.ts
│ │ │ ├── ResponsiveBar.tsx
│ │ │ └── ResponsiveBarNative.tsx
│ │ ├── Select
│ │ │ ├── HiddenOption.tsx
│ │ │ ├── OptionContext.ts
│ │ │ ├── Select.md
│ │ │ ├── Select.module.scss
│ │ │ ├── Select.spec.ts
│ │ │ ├── Select.tsx
│ │ │ ├── SelectContext.tsx
│ │ │ └── SelectNative.tsx
│ │ ├── SelectionStore
│ │ │ ├── SelectionStore.md
│ │ │ ├── SelectionStore.tsx
│ │ │ └── SelectionStoreNative.tsx
│ │ ├── Slider
│ │ │ ├── Slider.md
│ │ │ ├── Slider.module.scss
│ │ │ ├── Slider.spec.ts
│ │ │ ├── Slider.tsx
│ │ │ └── SliderNative.tsx
│ │ ├── Slot
│ │ │ ├── Slot.md
│ │ │ ├── Slot.spec.ts
│ │ │ └── Slot.ts
│ │ ├── SlotItem.tsx
│ │ ├── SpaceFiller
│ │ │ ├── SpaceFiller.md
│ │ │ ├── SpaceFiller.module.scss
│ │ │ ├── SpaceFiller.spec.ts
│ │ │ ├── SpaceFiller.tsx
│ │ │ └── SpaceFillerNative.tsx
│ │ ├── Spinner
│ │ │ ├── Spinner.md
│ │ │ ├── Spinner.module.scss
│ │ │ ├── Spinner.spec.ts
│ │ │ ├── Spinner.tsx
│ │ │ └── SpinnerNative.tsx
│ │ ├── Splitter
│ │ │ ├── HSplitter.md
│ │ │ ├── HSplitter.spec.ts
│ │ │ ├── Splitter.md
│ │ │ ├── Splitter.module.scss
│ │ │ ├── Splitter.spec.ts
│ │ │ ├── Splitter.tsx
│ │ │ ├── SplitterNative.tsx
│ │ │ ├── utils.ts
│ │ │ ├── VSplitter.md
│ │ │ └── VSplitter.spec.ts
│ │ ├── Stack
│ │ │ ├── CHStack.md
│ │ │ ├── CHStack.spec.ts
│ │ │ ├── CVStack.md
│ │ │ ├── CVStack.spec.ts
│ │ │ ├── HStack.md
│ │ │ ├── HStack.spec.ts
│ │ │ ├── Stack.md
│ │ │ ├── Stack.module.scss
│ │ │ ├── Stack.spec.ts
│ │ │ ├── Stack.tsx
│ │ │ ├── StackNative.tsx
│ │ │ ├── VStack.md
│ │ │ └── VStack.spec.ts
│ │ ├── StickyBox
│ │ │ ├── StickyBox.md
│ │ │ ├── StickyBox.module.scss
│ │ │ ├── StickyBox.tsx
│ │ │ └── StickyBoxNative.tsx
│ │ ├── Switch
│ │ │ ├── Switch.md
│ │ │ ├── Switch.spec.ts
│ │ │ └── Switch.tsx
│ │ ├── Table
│ │ │ ├── doc-resources
│ │ │ │ └── list-component-data.js
│ │ │ ├── react-table-config.d.ts
│ │ │ ├── Table.md
│ │ │ ├── Table.module.scss
│ │ │ ├── Table.spec.ts
│ │ │ ├── Table.tsx
│ │ │ ├── TableNative.tsx
│ │ │ └── useRowSelection.tsx
│ │ ├── TableOfContents
│ │ │ ├── TableOfContents.module.scss
│ │ │ ├── TableOfContents.spec.ts
│ │ │ ├── TableOfContents.tsx
│ │ │ └── TableOfContentsNative.tsx
│ │ ├── Tabs
│ │ │ ├── TabContext.tsx
│ │ │ ├── TabItem.md
│ │ │ ├── TabItem.tsx
│ │ │ ├── TabItemNative.tsx
│ │ │ ├── Tabs.md
│ │ │ ├── Tabs.module.scss
│ │ │ ├── Tabs.spec.ts
│ │ │ ├── Tabs.tsx
│ │ │ └── TabsNative.tsx
│ │ ├── Text
│ │ │ ├── Text.md
│ │ │ ├── Text.module.scss
│ │ │ ├── Text.spec.ts
│ │ │ ├── Text.tsx
│ │ │ └── TextNative.tsx
│ │ ├── TextArea
│ │ │ ├── TextArea.md
│ │ │ ├── TextArea.module.scss
│ │ │ ├── TextArea.spec.ts
│ │ │ ├── TextArea.tsx
│ │ │ ├── TextAreaNative.tsx
│ │ │ ├── TextAreaResizable.tsx
│ │ │ └── useComposedRef.ts
│ │ ├── TextBox
│ │ │ ├── TextBox.md
│ │ │ ├── TextBox.module.scss
│ │ │ ├── TextBox.spec.ts
│ │ │ ├── TextBox.tsx
│ │ │ └── TextBoxNative.tsx
│ │ ├── Theme
│ │ │ ├── NotificationToast.tsx
│ │ │ ├── Theme.md
│ │ │ ├── Theme.module.scss
│ │ │ ├── Theme.spec.ts
│ │ │ ├── Theme.tsx
│ │ │ └── ThemeNative.tsx
│ │ ├── TimeInput
│ │ │ ├── TimeInput.md
│ │ │ ├── TimeInput.module.scss
│ │ │ ├── TimeInput.spec.ts
│ │ │ ├── TimeInput.tsx
│ │ │ ├── TimeInputNative.tsx
│ │ │ └── utils.ts
│ │ ├── Timer
│ │ │ ├── Timer.md
│ │ │ ├── Timer.spec.ts
│ │ │ ├── Timer.tsx
│ │ │ └── TimerNative.tsx
│ │ ├── Toggle
│ │ │ ├── Toggle.module.scss
│ │ │ └── Toggle.tsx
│ │ ├── ToneChangerButton
│ │ │ ├── ToneChangerButton.md
│ │ │ ├── ToneChangerButton.spec.ts
│ │ │ └── ToneChangerButton.tsx
│ │ ├── ToneSwitch
│ │ │ ├── ToneSwitch.md
│ │ │ ├── ToneSwitch.module.scss
│ │ │ ├── ToneSwitch.spec.ts
│ │ │ ├── ToneSwitch.tsx
│ │ │ └── ToneSwitchNative.tsx
│ │ ├── Tooltip
│ │ │ ├── Tooltip.md
│ │ │ ├── Tooltip.module.scss
│ │ │ ├── Tooltip.spec.ts
│ │ │ ├── Tooltip.tsx
│ │ │ └── TooltipNative.tsx
│ │ ├── Tree
│ │ │ ├── testData.ts
│ │ │ ├── Tree-dynamic.spec.ts
│ │ │ ├── Tree-icons.spec.ts
│ │ │ ├── Tree.md
│ │ │ ├── Tree.spec.ts
│ │ │ ├── TreeComponent.module.scss
│ │ │ ├── TreeComponent.tsx
│ │ │ └── TreeNative.tsx
│ │ ├── TreeDisplay
│ │ │ ├── TreeDisplay.md
│ │ │ ├── TreeDisplay.module.scss
│ │ │ ├── TreeDisplay.tsx
│ │ │ └── TreeDisplayNative.tsx
│ │ ├── ValidationSummary
│ │ │ ├── ValidationSummary.module.scss
│ │ │ └── ValidationSummary.tsx
│ │ └── VisuallyHidden.tsx
│ ├── components-core
│ │ ├── abstractions
│ │ │ ├── ComponentRenderer.ts
│ │ │ ├── LoaderRenderer.ts
│ │ │ ├── standalone.ts
│ │ │ └── treeAbstractions.ts
│ │ ├── action
│ │ │ ├── actions.ts
│ │ │ ├── APICall.tsx
│ │ │ ├── FileDownloadAction.tsx
│ │ │ ├── FileUploadAction.tsx
│ │ │ ├── NavigateAction.tsx
│ │ │ └── TimedAction.tsx
│ │ ├── ApiBoundComponent.tsx
│ │ ├── appContext
│ │ │ ├── date-functions.ts
│ │ │ ├── math-function.ts
│ │ │ └── misc-utils.ts
│ │ ├── AppContext.tsx
│ │ ├── behaviors
│ │ │ ├── Behavior.tsx
│ │ │ └── CoreBehaviors.tsx
│ │ ├── component-hooks.ts
│ │ ├── ComponentDecorator.tsx
│ │ ├── ComponentViewer.tsx
│ │ ├── CompoundComponent.tsx
│ │ ├── constants.ts
│ │ ├── DebugViewProvider.tsx
│ │ ├── descriptorHelper.ts
│ │ ├── devtools
│ │ │ ├── InspectorDialog.module.scss
│ │ │ ├── InspectorDialog.tsx
│ │ │ └── InspectorDialogVisibilityContext.tsx
│ │ ├── EngineError.ts
│ │ ├── event-handlers.ts
│ │ ├── InspectorButton.module.scss
│ │ ├── InspectorContext.tsx
│ │ ├── interception
│ │ │ ├── abstractions.ts
│ │ │ ├── ApiInterceptor.ts
│ │ │ ├── ApiInterceptorProvider.tsx
│ │ │ ├── apiInterceptorWorker.ts
│ │ │ ├── Backend.ts
│ │ │ ├── Errors.ts
│ │ │ ├── IndexedDb.ts
│ │ │ ├── initMock.ts
│ │ │ ├── InMemoryDb.ts
│ │ │ ├── ReadonlyCollection.ts
│ │ │ └── useApiInterceptorContext.tsx
│ │ ├── loader
│ │ │ ├── ApiLoader.tsx
│ │ │ ├── DataLoader.tsx
│ │ │ ├── ExternalDataLoader.tsx
│ │ │ ├── Loader.tsx
│ │ │ ├── MockLoaderRenderer.tsx
│ │ │ └── PageableLoader.tsx
│ │ ├── LoaderComponent.tsx
│ │ ├── markup-check.ts
│ │ ├── parts.ts
│ │ ├── renderers.ts
│ │ ├── rendering
│ │ │ ├── AppContent.tsx
│ │ │ ├── AppRoot.tsx
│ │ │ ├── AppWrapper.tsx
│ │ │ ├── buildProxy.ts
│ │ │ ├── collectFnVarDeps.ts
│ │ │ ├── ComponentAdapter.tsx
│ │ │ ├── ComponentWrapper.tsx
│ │ │ ├── Container.tsx
│ │ │ ├── containers.ts
│ │ │ ├── ContainerWrapper.tsx
│ │ │ ├── ErrorBoundary.module.scss
│ │ │ ├── ErrorBoundary.tsx
│ │ │ ├── InvalidComponent.module.scss
│ │ │ ├── InvalidComponent.tsx
│ │ │ ├── nodeUtils.ts
│ │ │ ├── reducer.ts
│ │ │ ├── renderChild.tsx
│ │ │ ├── StandaloneComponent.tsx
│ │ │ ├── StateContainer.tsx
│ │ │ ├── UnknownComponent.module.scss
│ │ │ ├── UnknownComponent.tsx
│ │ │ └── valueExtractor.ts
│ │ ├── reportEngineError.ts
│ │ ├── RestApiProxy.ts
│ │ ├── script-runner
│ │ │ ├── asyncProxy.ts
│ │ │ ├── AttributeValueParser.ts
│ │ │ ├── bannedFunctions.ts
│ │ │ ├── BindingTreeEvaluationContext.ts
│ │ │ ├── eval-tree-async.ts
│ │ │ ├── eval-tree-common.ts
│ │ │ ├── eval-tree-sync.ts
│ │ │ ├── ParameterParser.ts
│ │ │ ├── process-statement-async.ts
│ │ │ ├── process-statement-common.ts
│ │ │ ├── process-statement-sync.ts
│ │ │ ├── ScriptingSourceTree.ts
│ │ │ ├── simplify-expression.ts
│ │ │ ├── statement-queue.ts
│ │ │ └── visitors.ts
│ │ ├── StandaloneApp.tsx
│ │ ├── StandaloneExtensionManager.ts
│ │ ├── TableOfContentsContext.tsx
│ │ ├── theming
│ │ │ ├── _themes.scss
│ │ │ ├── component-layout-resolver.ts
│ │ │ ├── extendThemeUtils.ts
│ │ │ ├── hvar.ts
│ │ │ ├── layout-resolver.ts
│ │ │ ├── parse-layout-props.ts
│ │ │ ├── StyleContext.tsx
│ │ │ ├── StyleRegistry.ts
│ │ │ ├── ThemeContext.tsx
│ │ │ ├── ThemeProvider.tsx
│ │ │ ├── themes
│ │ │ │ ├── base-utils.ts
│ │ │ │ ├── palette.ts
│ │ │ │ ├── root.ts
│ │ │ │ ├── solid.ts
│ │ │ │ ├── theme-colors.ts
│ │ │ │ └── xmlui.ts
│ │ │ ├── themeVars.module.scss
│ │ │ ├── themeVars.ts
│ │ │ ├── transformThemeVars.ts
│ │ │ └── utils.ts
│ │ ├── utils
│ │ │ ├── actionUtils.ts
│ │ │ ├── audio-utils.ts
│ │ │ ├── base64-utils.ts
│ │ │ ├── compound-utils.ts
│ │ │ ├── css-utils.ts
│ │ │ ├── DataLoaderQueryKeyGenerator.ts
│ │ │ ├── date-utils.ts
│ │ │ ├── extractParam.ts
│ │ │ ├── hooks.tsx
│ │ │ ├── LruCache.ts
│ │ │ ├── mergeProps.ts
│ │ │ ├── misc.ts
│ │ │ ├── request-params.ts
│ │ │ ├── statementUtils.ts
│ │ │ └── treeUtils.ts
│ │ └── xmlui-parser.ts
│ ├── index-standalone.ts
│ ├── index.scss
│ ├── index.ts
│ ├── language-server
│ │ ├── server-common.ts
│ │ ├── server-web-worker.ts
│ │ ├── server.ts
│ │ ├── services
│ │ │ ├── common
│ │ │ │ ├── docs-generation.ts
│ │ │ │ ├── lsp-utils.ts
│ │ │ │ ├── metadata-utils.ts
│ │ │ │ └── syntax-node-utilities.ts
│ │ │ ├── completion.ts
│ │ │ ├── diagnostic.ts
│ │ │ ├── format.ts
│ │ │ └── hover.ts
│ │ └── xmlui-metadata-generated.js
│ ├── logging
│ │ ├── LoggerContext.tsx
│ │ ├── LoggerInitializer.tsx
│ │ ├── LoggerService.ts
│ │ └── xmlui.ts
│ ├── logo.svg
│ ├── parsers
│ │ ├── common
│ │ │ ├── GenericToken.ts
│ │ │ ├── InputStream.ts
│ │ │ └── utils.ts
│ │ ├── scripting
│ │ │ ├── code-behind-collect.ts
│ │ │ ├── Lexer.ts
│ │ │ ├── modules.ts
│ │ │ ├── Parser.ts
│ │ │ ├── ParserError.ts
│ │ │ ├── ScriptingNodeTypes.ts
│ │ │ ├── TokenTrait.ts
│ │ │ ├── TokenType.ts
│ │ │ └── tree-visitor.ts
│ │ ├── style-parser
│ │ │ ├── errors.ts
│ │ │ ├── source-tree.ts
│ │ │ ├── StyleInputStream.ts
│ │ │ ├── StyleLexer.ts
│ │ │ ├── StyleParser.ts
│ │ │ └── tokens.ts
│ │ └── xmlui-parser
│ │ ├── CharacterCodes.ts
│ │ ├── diagnostics.ts
│ │ ├── fileExtensions.ts
│ │ ├── index.ts
│ │ ├── lint.ts
│ │ ├── parser.ts
│ │ ├── ParserError.ts
│ │ ├── scanner.ts
│ │ ├── syntax-kind.ts
│ │ ├── syntax-node.ts
│ │ ├── transform.ts
│ │ ├── utils.ts
│ │ ├── xmlui-serializer.ts
│ │ └── xmlui-tree.ts
│ ├── react-app-env.d.ts
│ ├── syntax
│ │ ├── monaco
│ │ │ ├── grammar.monacoLanguage.ts
│ │ │ ├── index.ts
│ │ │ ├── xmlui-dark.ts
│ │ │ ├── xmlui-light.ts
│ │ │ └── xmluiscript.monacoLanguage.ts
│ │ └── textMate
│ │ ├── index.ts
│ │ ├── xmlui-dark.json
│ │ ├── xmlui-light.json
│ │ ├── xmlui.json
│ │ └── xmlui.tmLanguage.json
│ ├── testing
│ │ ├── assertions.ts
│ │ ├── component-test-helpers.ts
│ │ ├── ComponentDrivers.ts
│ │ ├── drivers
│ │ │ ├── DateInputDriver.ts
│ │ │ ├── index.ts
│ │ │ ├── ModalDialogDriver.ts
│ │ │ ├── NumberBoxDriver.ts
│ │ │ ├── TextBoxDriver.ts
│ │ │ ├── TimeInputDriver.ts
│ │ │ ├── TimerDriver.ts
│ │ │ └── TreeDriver.ts
│ │ ├── fixtures.ts
│ │ ├── index.ts
│ │ ├── infrastructure
│ │ │ ├── index.html
│ │ │ ├── main.tsx
│ │ │ ├── public
│ │ │ │ ├── mockServiceWorker.js
│ │ │ │ ├── resources
│ │ │ │ │ ├── bell.svg
│ │ │ │ │ ├── box.svg
│ │ │ │ │ ├── doc.svg
│ │ │ │ │ ├── eye.svg
│ │ │ │ │ ├── flower-640x480.jpg
│ │ │ │ │ ├── sun.svg
│ │ │ │ │ ├── test-image-100x100.jpg
│ │ │ │ │ └── txt.svg
│ │ │ │ └── serve.json
│ │ │ └── TestBed.tsx
│ │ └── themed-app-test-helpers.ts
│ └── vite-env.d.ts
├── tests
│ ├── components
│ │ ├── CodeBlock
│ │ │ └── hightlight-code.test.ts
│ │ ├── playground-pattern.test.ts
│ │ └── Tree
│ │ └── Tree-states.test.ts
│ ├── components-core
│ │ ├── abstractions
│ │ │ └── treeAbstractions.test.ts
│ │ ├── container
│ │ │ └── buildProxy.test.ts
│ │ ├── interception
│ │ │ ├── orderBy.test.ts
│ │ │ ├── ReadOnlyCollection.test.ts
│ │ │ └── request-param-converter.test.ts
│ │ ├── scripts-runner
│ │ │ ├── AttributeValueParser.test.ts
│ │ │ ├── eval-tree-arrow-async.test.ts
│ │ │ ├── eval-tree-arrow.test.ts
│ │ │ ├── eval-tree-func-decl-async.test.ts
│ │ │ ├── eval-tree-func-decl.test.ts
│ │ │ ├── eval-tree-pre-post.test.ts
│ │ │ ├── eval-tree-regression.test.ts
│ │ │ ├── eval-tree.test.ts
│ │ │ ├── function-proxy.test.ts
│ │ │ ├── parser-regression.test.ts
│ │ │ ├── process-event.test.ts
│ │ │ ├── process-function.test.ts
│ │ │ ├── process-implicit-context.test.ts
│ │ │ ├── process-statement-asgn.test.ts
│ │ │ ├── process-statement-destruct.test.ts
│ │ │ ├── process-statement-regs.test.ts
│ │ │ ├── process-statement-sync.test.ts
│ │ │ ├── process-statement.test.ts
│ │ │ ├── process-switch-sync.test.ts
│ │ │ ├── process-switch.test.ts
│ │ │ ├── process-try-sync.test.ts
│ │ │ ├── process-try.test.ts
│ │ │ └── test-helpers.ts
│ │ ├── test-metadata-handler.ts
│ │ ├── theming
│ │ │ ├── border-segments.test.ts
│ │ │ ├── component-layout.resolver.test.ts
│ │ │ ├── layout-property-parser.test.ts
│ │ │ ├── layout-resolver.test.ts
│ │ │ ├── layout-resolver2.test.ts
│ │ │ ├── layout-vp-override.test.ts
│ │ │ └── padding-segments.test.ts
│ │ └── utils
│ │ ├── date-utils.test.ts
│ │ ├── format-human-elapsed-time.test.ts
│ │ └── LruCache.test.ts
│ ├── language-server
│ │ ├── completion.test.ts
│ │ ├── format.test.ts
│ │ ├── hover.test.ts
│ │ └── mockData.ts
│ └── parsers
│ ├── common
│ │ └── input-stream.test.ts
│ ├── markdown
│ │ └── parse-binding-expression.test.ts
│ ├── parameter-parser.test.ts
│ ├── paremeter-parser.test.ts
│ ├── scripting
│ │ ├── eval-tree-arrow.test.ts
│ │ ├── eval-tree-pre-post.test.ts
│ │ ├── eval-tree.test.ts
│ │ ├── function-proxy.test.ts
│ │ ├── lexer-literals.test.ts
│ │ ├── lexer-misc.test.ts
│ │ ├── module-parse.test.ts
│ │ ├── parser-arrow.test.ts
│ │ ├── parser-assignments.test.ts
│ │ ├── parser-binary.test.ts
│ │ ├── parser-destructuring.test.ts
│ │ ├── parser-errors.test.ts
│ │ ├── parser-expressions.test.ts
│ │ ├── parser-function.test.ts
│ │ ├── parser-literals.test.ts
│ │ ├── parser-primary.test.ts
│ │ ├── parser-regex.test.ts
│ │ ├── parser-statements.test.ts
│ │ ├── parser-unary.test.ts
│ │ ├── process-event.test.ts
│ │ ├── process-implicit-context.test.ts
│ │ ├── process-statement-asgn.test.ts
│ │ ├── process-statement-destruct.test.ts
│ │ ├── process-statement-regs.test.ts
│ │ ├── process-statement-sync.test.ts
│ │ ├── process-statement.test.ts
│ │ ├── process-switch-sync.test.ts
│ │ ├── process-switch.test.ts
│ │ ├── process-try-sync.test.ts
│ │ ├── process-try.test.ts
│ │ ├── simplify-expression.test.ts
│ │ ├── statement-hooks.test.ts
│ │ └── test-helpers.ts
│ ├── style-parser
│ │ ├── generateHvarChain.test.ts
│ │ ├── parseHVar.test.ts
│ │ ├── parser.test.ts
│ │ └── tokens.test.ts
│ └── xmlui
│ ├── lint.test.ts
│ ├── parser.test.ts
│ ├── scanner.test.ts
│ ├── transform.attr.test.ts
│ ├── transform.circular.test.ts
│ ├── transform.element.test.ts
│ ├── transform.errors.test.ts
│ ├── transform.escape.test.ts
│ ├── transform.regression.test.ts
│ ├── transform.script.test.ts
│ ├── transform.test.ts
│ └── xmlui.ts
├── tests-e2e
│ ├── api-bound-component-regression.spec.ts
│ ├── api-call-as-extracted-component.spec.ts
│ ├── assign-to-object-or-array-regression.spec.ts
│ ├── binding-regression.spec.ts
│ ├── children-as-template-context-vars.spec.ts
│ ├── compound-component.spec.ts
│ ├── context-vars-regression.spec.ts
│ ├── data-bindings.spec.ts
│ ├── datasource-and-api-usage-in-var.spec.ts
│ ├── datasource-direct-binding.spec.ts
│ ├── datasource-onLoaded-regression.spec.ts
│ ├── modify-array-item-regression.spec.ts
│ ├── namespaces.spec.ts
│ ├── push-to-array-regression.spec.ts
│ ├── screen-breakpoints.spec.ts
│ ├── scripting.spec.ts
│ ├── state-scope-in-pages.spec.ts
│ └── state-var-scopes.spec.ts
├── tsconfig.json
├── tsdown.config.ts
├── vite.config.ts
└── vitest.config.ts
```
# Files
--------------------------------------------------------------------------------
/xmlui/src/components-core/rendering/Container.tsx:
--------------------------------------------------------------------------------
```typescript
import type { Dispatch, MutableRefObject, ReactNode, RefObject, SetStateAction } from "react";
import React, {
cloneElement,
forwardRef,
Fragment,
isValidElement,
memo,
useCallback,
useEffect,
useRef,
useTransition,
} from "react";
import { useLocation, useNavigate } from "@remix-run/react";
import { cloneDeep, isArray } from "lodash-es";
import { composeRefs } from "@radix-ui/react-compose-refs";
import memoizeOne from "memoize-one";
import type {
LookupActionOptions,
LookupAsyncFnInner,
LookupSyncFnInner,
} from "../../abstractions/ActionDefs";
import type { ComponentDef, ParentRenderContext } from "../../abstractions/ComponentDefs";
import type { ContainerState } from "../../abstractions/ContainerDefs";
import type { LayoutContext, RenderChildFn } from "../../abstractions/RendererDefs";
import type {
ArrowExpression,
ArrowExpressionStatement,
Statement,
} from "../script-runner/ScriptingSourceTree";
import {
T_ARROW_EXPRESSION,
T_ARROW_EXPRESSION_STATEMENT,
} from "../script-runner/ScriptingSourceTree";
import type { ContainerDispatcher, MemoedVars } from "../abstractions/ComponentRenderer";
import { ContainerActionKind } from "./containers";
import { useAppContext } from "../AppContext";
import { buildProxy } from "../rendering/buildProxy";
import type { StatePartChangedFn } from "./ContainerWrapper";
import type {
ComponentCleanupFn,
ContainerWrapperDef,
RegisterComponentApiFnInner,
} from "../rendering/ContainerWrapper";
import type { BindingTreeEvaluationContext } from "../script-runner/BindingTreeEvaluationContext";
import { processStatementQueueAsync } from "../script-runner/process-statement-async";
import { processStatementQueue } from "../script-runner/process-statement-sync";
import { extractParam, shouldKeep } from "../utils/extractParam";
import { useIsomorphicLayoutEffect } from "../utils/hooks";
import { capitalizeFirstLetter, delay, generatedId, useEvent } from "../utils/misc";
import { parseHandlerCode, prepareHandlerStatements } from "../utils/statementUtils";
import { renderChild } from "./renderChild";
import { useTheme } from "../theming/ThemeContext";
import { LoaderComponent } from "../LoaderComponent";
import type { AppContextObject } from "../../abstractions/AppContextDefs";
import { EMPTY_ARRAY } from "../constants";
import type { ParsedEventValue } from "../../abstractions/scripting/Compilation";
import { useApiInterceptorContext } from "../interception/useApiInterceptorContext";
import { mergeProps } from "../utils/mergeProps";
type Props = {
node: ContainerWrapperDef;
resolvedKey?: string;
componentState: ContainerState;
dispatch: ContainerDispatcher;
setVersion: Dispatch<SetStateAction<number>>;
version: number;
statePartChanged: StatePartChangedFn;
registerComponentApi: RegisterComponentApiFnInner;
parentRegisterComponentApi: RegisterComponentApiFnInner;
layoutContextRef: MutableRefObject<LayoutContext | undefined>;
memoedVarsRef: MutableRefObject<MemoedVars>;
isImplicit?: boolean;
parentDispatch: ContainerDispatcher;
parentRenderContext?: ParentRenderContext;
uidInfoRef?: RefObject<Record<string, any>>;
children?: ReactNode;
};
// React component to display a view container and implement its behavior
export const Container = memo(
forwardRef(function Container(
{
node,
componentState,
dispatch: containerDispatch,
parentDispatch,
resolvedKey,
version,
setVersion,
statePartChanged,
registerComponentApi: containerRegisterComponentApi,
parentRegisterComponentApi,
layoutContextRef,
parentRenderContext,
memoedVarsRef,
isImplicit,
uidInfoRef: parentUidInfoRef,
children,
...rest
}: Props,
ref,
) {
const { apiBoundContainer } = node;
const dispatch = isImplicit ? parentDispatch : containerDispatch;
const registerComponentApi = isImplicit
? parentRegisterComponentApi
: containerRegisterComponentApi;
const appContext = useAppContext();
const { getThemeVar } = useTheme();
const navigate = useNavigate();
const location = useLocation();
const fnsRef = useRef<Record<symbol, any>>({});
const stateRef = useRef(componentState);
//generally bad practise to write ref in render (https://react.dev/learn/referencing-values-with-refs#best-practices-for-refs), but:
// this stateRef is only used in runCodeSync/async functions, which are memoized, so it's safe to use it here (as I know: illesg)
// In case we sync up the stateRef with the componentState in the useEffect/useInsertionEffect/useLayoutEffect, the stateRef would lag behind the componentState
stateRef.current = componentState;
const parsedStatementsRef = useRef<Record<string, Array<Statement> | null>>({});
const [_, startTransition] = useTransition();
const mountedRef = useRef(true);
// --- This ref holds a map of promises for each statement execution that cause any state change.
const statementPromises = useRef<Map<string, any>>(new Map());
// --- Ensure that re-rendering because of version change resolves all pending statement promises.
useIsomorphicLayoutEffect(() => {
for (const resolve of statementPromises.current.values()) {
resolve();
}
}, [version]);
// --- Ensure that component disposal resolves all pending statement promises.
useEffect(() => {
mountedRef.current = true;
const leftPromises = statementPromises.current;
return () => {
mountedRef.current = false;
for (const resolve of leftPromises.values()) {
resolve();
}
};
}, []);
const { apiInstance } = useApiInterceptorContext();
const runCodeAsync = useEvent(
async (
source: string | ParsedEventValue | ArrowExpression,
componentUid: symbol,
options: LookupActionOptions | undefined,
...eventArgs: any[]
) => {
// --- Check if the event handler can sign its lifecycle state
const canSignEventLifecycle = () => {
return componentUid.description !== undefined && options?.eventName !== undefined;
};
let changes: Array<any> = [];
const getComponentStateClone = () => {
changes.length = 0;
const poj = cloneDeep({ ...stateRef.current, ...(options?.context || {}) });
poj["$this"] = stateRef.current[componentUid];
return buildProxy(poj, (changeInfo) => {
const idRoot = (changeInfo.pathArray as string[])?.[0];
if (idRoot?.startsWith("$")) {
throw new Error("Cannot update a read-only variable");
}
changes.push(changeInfo);
});
};
const evalAppContext = {
...appContext,
getThemeVar,
};
const evalContext: BindingTreeEvaluationContext = {
appContext: evalAppContext,
eventArgs,
localContext: getComponentStateClone(),
implicitContextGetter: () => {
return {
uid: componentUid,
state: stateRef.current,
getCurrentState: () => stateRef.current,
dispatch,
appContext: evalAppContext,
apiInstance,
navigate,
location,
lookupAction: (action, uid, actionOptions = {}) => {
return lookupAction(action, uid, {
...actionOptions,
ephemeral: true,
});
},
};
},
options: {
defaultToOptionalMemberAccess:
typeof appContext.appGlobals?.defaultToOptionalMemberAccess === "boolean"
? appContext.appGlobals.defaultToOptionalMemberAccess
: true,
},
};
try {
// --- Prepare the event handler to an arrow expression statement
let statements: Statement[];
if (typeof source === "string") {
if (!parsedStatementsRef.current[source]) {
parsedStatementsRef.current[source] = prepareHandlerStatements(
parseHandlerCode(source),
evalContext,
);
}
statements = parsedStatementsRef.current[source];
} else if (isParsedEventValue(source)) {
const parseId = source.parseId.toString();
if (!parsedStatementsRef.current[parseId]) {
parsedStatementsRef.current[parseId] = prepareHandlerStatements(
source.statements,
evalContext,
);
}
statements = parsedStatementsRef.current[parseId];
} else {
statements = [
{
type: T_ARROW_EXPRESSION_STATEMENT,
expr: source, //TODO illesg (talk it through why we need to deep clone, it it's omitted, it gets slower every time we run it)
} as ArrowExpressionStatement,
];
}
if (!statements?.length) {
return;
}
if (canSignEventLifecycle()) {
// --- Sign the event handler has been started
dispatch({
type: ContainerActionKind.EVENT_HANDLER_STARTED,
payload: {
uid: componentUid,
eventName: options.eventName,
},
});
}
let mainThreadBlockingRuns = 0;
evalContext.onStatementCompleted = async (evalContext) => {
if (changes.length) {
mainThreadBlockingRuns = 0;
changes.forEach((change) => {
statePartChanged(
change.pathArray,
cloneDeep(change.newValue),
change.target,
change.action,
);
});
let resolve = null;
const stateUpdatedPromise = new Promise((res) => {
resolve = () => {
res(null);
};
});
const key = generatedId();
statementPromises.current.set(key, resolve);
// We use this to tell react that this update is not high-priority.
// If we don't put it to a transition, the whole app would be blocked if we run a long,
// update intensive queue (e.g. an infinite loop which
// increments a counter, see playground example learning/01_Experiments/01_Event_Framework/app ).
// Before this solution, we used a setTimeout(..., 0); hack, but some browsers (chrome especially)
// do some funky stuff with the background tabs (e.g. all the setTimeouts are
// maximized to run in 1 time / minute, doesn't matter if it's timeout is 0)
// As of 2023. June 20, this solution works with backgrounded tabs, too.
startTransition(() => {
setVersion((prev) => prev + 1);
});
//TODO this could be a problem - if this container gets unmounted, we still have to wait for the update,
// but in that case this update probably happened in the parent (e.g. a button's event handler removes the whole container
// where the button lives, but it still has some statements to run).
// with this solution the statement execution doesn't stop, and we fallback waiting with a setTimeout(0)
if (mountedRef.current) {
await stateUpdatedPromise;
} else {
await delay(0);
}
statementPromises.current.delete(key);
changes = [];
} else {
//in this else branch normally we block the main thread (we don't wait for any state promise to be resolved),
// so in a long-running (typically infinite loop) situation, where there aren't any changes in the state
// we block the main thread indefinitely... this 'mainThreadBlockingRuns' var solution makes sure that
// we pause in every 100 runs, and let the main thread breath a bit, so it's not frozen for the whole time
// (we clear that counter above, too, where we use a startTransition call to de-prioritize this work)
mainThreadBlockingRuns++;
if (mainThreadBlockingRuns > 100) {
mainThreadBlockingRuns = 0;
await delay(0);
}
}
evalContext.localContext = getComponentStateClone();
};
await processStatementQueueAsync(statements, evalContext);
if (canSignEventLifecycle()) {
// --- Sign the event handler has successfully completed
dispatch({
type: ContainerActionKind.EVENT_HANDLER_COMPLETED,
payload: {
uid: componentUid,
eventName: options.eventName,
},
});
}
if (evalContext.mainThread?.blocks?.length) {
return evalContext.mainThread.blocks[evalContext.mainThread.blocks.length - 1]
.returnValue;
}
} catch (e) {
//if we pass down an event handler to a component, we should sign the error once, not in every step of the component chain
// (we use it in the compoundComponent, resolving it's event handlers)
if (options?.signError !== false) {
appContext.signError(e as Error);
}
if (canSignEventLifecycle()) {
dispatch({
type: ContainerActionKind.EVENT_HANDLER_ERROR,
payload: {
uid: componentUid,
eventName: options.eventName,
error: e,
},
});
}
throw e;
}
},
);
const runCodeSync = useCallback(
(arrowExpression: ArrowExpression, ...eventArgs: any[]) => {
const evalContext: BindingTreeEvaluationContext = {
localContext: cloneDeep(stateRef.current),
appContext,
eventArgs,
};
try {
const arrowStmt = {
type: T_ARROW_EXPRESSION_STATEMENT,
expr: arrowExpression,
} as ArrowExpressionStatement;
processStatementQueue([arrowStmt], evalContext);
if (evalContext.mainThread?.blocks?.length) {
return evalContext.mainThread.blocks[evalContext.mainThread.blocks.length - 1]
.returnValue;
}
} catch (e) {
console.error(e);
throw e;
}
},
[appContext],
);
const getOrCreateEventHandlerFn = useEvent(
(
src: string | ParsedEventValue | ArrowExpression,
uid: symbol,
options?: LookupActionOptions,
) => {
if (Array.isArray(src)) {
throw new Error("Multiple event handlers are not supported");
}
let fnCacheKey: string;
let handler: (...eventArgs: any[]) => Promise<any>;
if (typeof src === "string") {
// --- We have a string event handler
fnCacheKey = `${options?.eventName};${src}`;
handler = (...eventArgs: any[]) => {
return runCodeAsync(src, uid, options, ...cloneDeep(eventArgs));
};
} else if (isParsedEventValue(src)) {
// --- We have the syntax tree to execute, no need to cache
fnCacheKey = `${options?.eventName};${src.parseId}`;
handler = (...eventArgs: any[]) => {
return runCodeAsync(src, uid, options, ...cloneDeep(eventArgs));
};
} else if (isArrowExpression(src)) {
// --- We have an arrow expression to execute
fnCacheKey = `${options?.eventName};${src.statement.nodeId}`;
handler = (...eventArgs: any[]) => {
return runCodeAsync(src, uid, options, ...cloneDeep(eventArgs));
};
} else if ((src as any).type) {
// --- We have an arrow expression to execute
fnCacheKey = `${options?.eventName};${JSON.stringify(src)}`;
handler = (...eventArgs: any[]) => {
return runCodeAsync(src, uid, options, ...cloneDeep(eventArgs));
};
} else {
// --- We have an unknown event handler
throw new Error("Invalid event handler");
}
//if we have a context or ephemeral event handler, we don't cache it (otherwise we would have stale reference for the context)
if (options?.ephemeral || options?.context) {
return handler;
}
if (!fnsRef.current[uid]?.[fnCacheKey]) {
fnsRef.current[uid] = fnsRef.current[uid] || {};
fnsRef.current[uid][fnCacheKey] = handler;
}
return fnsRef.current[uid][fnCacheKey];
},
);
const getOrCreateSyncCallbackFn = useCallback(
(arrowExpression: ArrowExpression, uid: symbol) => {
const fnCacheKey = `sync-callback-${arrowExpression.nodeId}`;
if (!fnsRef.current[uid]?.[fnCacheKey]) {
fnsRef.current[uid] = fnsRef.current[uid] || {};
fnsRef.current[uid][fnCacheKey] = memoizeOne((arrowExpression) => {
return (...eventArgs: any[]) => {
return runCodeSync(arrowExpression, ...eventArgs);
};
});
}
return fnsRef.current[uid][fnCacheKey](arrowExpression);
},
[runCodeSync],
);
const lookupSyncCallback: LookupSyncFnInner = useCallback(
(action, uid) => {
if (!action) {
return undefined;
}
if (typeof action === "function") {
return action;
}
// const resolvedAction = extractParam(componentState, action, appContext, true);
if (!action) {
return undefined;
}
if (typeof action === "function") {
return action;
}
if (!(action as any)._ARROW_EXPR_) {
throw new Error("Only arrow expression allowed in sync callback");
}
return getOrCreateSyncCallbackFn(action, uid);
},
[getOrCreateSyncCallbackFn],
);
const lookupAction: LookupAsyncFnInner = useCallback(
(
action: string | undefined | ArrowExpression,
uid: symbol,
options?: LookupActionOptions,
) => {
let safeAction = action;
if (!action && uid.description && options?.eventName) {
const handlerFnName = `${uid.description}_on${capitalizeFirstLetter(options?.eventName)}`;
if (componentState[handlerFnName] && componentState[handlerFnName]._ARROW_EXPR_) {
safeAction = componentState[handlerFnName] as ArrowExpression;
}
}
if (!safeAction) {
return undefined;
}
if (typeof safeAction === "function") {
return safeAction;
}
return getOrCreateEventHandlerFn(safeAction, uid, options);
},
[componentState, getOrCreateEventHandlerFn],
);
const isApiRegisteredInnerRef = useRef(false);
useEffect(() => {
if (!node.api) {
return;
}
if (!node.containerUid) {
return;
}
if (isApiRegisteredInnerRef.current) {
return;
}
isApiRegisteredInnerRef.current = true;
const api: Record<string, any> = {};
const self = Symbol("$self");
Object.entries(node.api).forEach(([key, value]) => {
api[key] = lookupAction(value as string, self);
});
if (!isImplicit) {
registerComponentApi(self, api); //we register the api as $self for the compound components,
}
parentRegisterComponentApi(node.containerUid, api); // and register it for the parent component instance
}, [
lookupAction,
node.api,
node.containerUid,
node.uid,
isImplicit,
parentRegisterComponentApi,
registerComponentApi,
]);
const cleanup = useEvent((uid) => {
delete fnsRef.current[uid];
});
// --- The container wraps the `renderChild` function to provide that to the child components
const stableRenderChild: RenderChildFn = useCallback(
(childNode, lc, pRenderContext, uidInfoRef, ref, rest) => {
// TODO: Check if this is a valid use case
if (typeof childNode === "string") {
throw Error("should be resolved for now");
}
// --- Make children an array if it's not
const children = isArray(childNode) ? childNode : [childNode];
if (!children || !children.length) {
// --- No child, nothing to render
return null;
}
// --- If there are multiple children, we need to add a `key` to each of them
const wrapWithFragment = children.length > 1;
// --- Render each child
const renderedChildren = children.map((child, childIndex) => {
if (!child) {
// --- No child, nothing to render: Should not happen
return undefined;
}
// --- Invoke the jolly-joker `renderChild` function to render the child. Note that
// --- in the context, we pass the `stableRenderChild` function, so the child can
// --- render its children recursively.
const renderedChild = renderChild({
node: child,
state: componentState,
dispatch,
appContext,
lookupAction,
lookupSyncCallback,
registerComponentApi,
renderChild: stableRenderChild,
statePartChanged: statePartChanged,
layoutContext: lc,
parentRenderContext: pRenderContext,
memoedVarsRef,
cleanup,
uidInfoRef,
});
if (renderedChild === undefined) {
// --- No displayable child, nothing to render
return undefined;
}
// --- Let's process the rendered child
let rendered = renderedChild;
const key = `${childIndex}_${child.uid}`;
if (wrapWithFragment) {
// --- Add the `key` attribute to the child
if (React.isValidElement(renderedChild)) {
// --- React can display this element
rendered = React.cloneElement(renderedChild, { key });
} else {
// --- A simple text node (or alike). We need to wrap it in a `Fragment`
rendered = <Fragment key={key}>{renderedChild}</Fragment>;
}
}
// --- Done.
return rendered;
});
// --- At this point we have a React node for each child
if (renderedChildren.length === 1) {
// --- If we have a single (and valid React element) child, we compose its
// --- `ref` with the parent's `ref`. This allows the parent to access the child's
// --- DOM node. Otherwise, we use the child as is.
return ref && renderedChildren[0] && isValidElement(renderedChildren[0])
? React.cloneElement(renderedChildren[0], {
ref: composeRefs(ref, (renderedChildren[0] as any).ref),
...mergeProps(renderedChildren[0].props, rest)
} as any)
: renderedChildren[0];
}
// --- Done.
return renderedChildren;
},
[
componentState,
dispatch,
appContext,
lookupAction,
lookupSyncCallback,
registerComponentApi,
statePartChanged,
memoedVarsRef,
cleanup,
],
);
// --- Log the component state if you need it for debugging
if ((node.props as any)?.debug) {
console.log(`Container: ${resolvedKey}`, {
componentState,
node,
});
}
// --- Use this object to store information about already rendered UIDs.
// --- We do not allow any action, loader, or transform to use the same UID; however (as of now) children
// --- may use the same UID.
const uidInfo: Record<string, string> = {};
const thisUidInfoRef = useRef({});
const uidInfoRef = node.uses === undefined ? parentUidInfoRef : thisUidInfoRef;
const renderedChildren = stableRenderChild(
node.children,
layoutContextRef?.current,
parentRenderContext,
uidInfoRef,
ref,
rest
);
const renderedLoaders = renderLoaders({
uidInfo,
uidInfoRef,
loaders: node.loaders,
componentState,
memoedVarsRef,
//if it's an api bound container, we always use this container, otherwise use the parent if it's an implicit one
dispatch: apiBoundContainer ? containerDispatch : dispatch,
registerComponentApi: apiBoundContainer
? containerRegisterComponentApi
: registerComponentApi,
appContext,
lookupAction,
lookupSyncCallback,
cleanup,
});
//TODO illesg
const containerContent = (
<>
{renderedLoaders}
{!!children && isValidElement(renderedChildren)
? cloneElement(renderedChildren, null, children)
: renderedChildren}
</>
);
return (
<Fragment
key={
node.uid
? `${resolvedKey}>${extractParam(componentState, node.uid, appContext, true)}`
: undefined
}
>
{containerContent}
</Fragment>
);
}),
);
interface LoaderRenderContext {
uidInfo: Record<string, string>;
uidInfoRef: RefObject<Record<string, any>>;
loaders?: ComponentDef[];
componentState: ContainerState;
dispatch: ContainerDispatcher;
appContext: AppContextObject;
registerComponentApi: RegisterComponentApiFnInner;
lookupAction: LookupAsyncFnInner;
lookupSyncCallback: LookupSyncFnInner;
cleanup: ComponentCleanupFn;
memoedVarsRef: MutableRefObject<MemoedVars>;
}
function renderLoaders({
uidInfo,
uidInfoRef,
loaders = EMPTY_ARRAY,
componentState,
dispatch,
appContext,
registerComponentApi,
lookupAction,
lookupSyncCallback,
cleanup,
memoedVarsRef,
}: LoaderRenderContext) {
return loaders.map((loader: ComponentDef) => {
// --- Check for the uniqueness of UIDs
if (loader?.uid) {
if (uidInfo[loader.uid]) {
// --- We have a duplicated ID (another loader)
throw new Error(
`Another ${uidInfo[loader.uid]} definition in this container already uses the uid '${loader.uid}'`,
);
}
uidInfo[loader.uid] = "loader";
uidInfoRef.current[loader.uid] = {
type: "loader",
value: "loaderValue",
uid: loader.uid,
};
}
// --- Render the current loader
const renderedLoader = renderLoader({
loader,
componentState,
dispatch,
appContext,
registerComponentApi,
lookupAction,
lookupSyncCallback,
memoedVarsRef,
cleanup,
});
// --- Skip loaders with rendering errors
if (renderedLoader === undefined) {
return undefined;
}
// --- Take care to use a key property for the loader
return <Fragment key={loader.uid}>{renderedLoader}</Fragment>;
});
function renderLoader({
loader,
componentState,
dispatch,
appContext,
registerComponentApi,
lookupAction,
lookupSyncCallback,
cleanup,
memoedVarsRef,
}: {
loader: ComponentDef;
componentState: ContainerState;
dispatch: ContainerDispatcher;
appContext: AppContextObject;
registerComponentApi: RegisterComponentApiFnInner;
lookupAction: LookupAsyncFnInner;
lookupSyncCallback: LookupSyncFnInner;
cleanup: ComponentCleanupFn;
memoedVarsRef: MutableRefObject<MemoedVars>;
}) {
// --- For the sake of avoiding further issues
if (!loader) {
return null;
}
// --- Evaluate "when" to decide if the loader should be rendered
// --- Render only visible components
if (!shouldKeep(loader.when, componentState, appContext)) {
return null;
}
// --- Use the loader type's renderer function
return (
<LoaderComponent
onUnmount={cleanup}
node={loader}
state={componentState}
dispatch={dispatch}
registerComponentApi={registerComponentApi}
lookupAction={lookupAction}
lookupSyncCallback={lookupSyncCallback}
memoedVarsRef={memoedVarsRef}
appContext={appContext}
/>
);
}
}
function isParsedEventValue(
value: string | ParsedEventValue | ArrowExpression,
): value is ParsedEventValue {
return (value as ParsedEventValue).__PARSED === true;
}
function isArrowExpression(
value: string | ParsedEventValue | ArrowExpression,
): value is ArrowExpression {
return (value as ArrowExpression).type === T_ARROW_EXPRESSION;
}
```
--------------------------------------------------------------------------------
/xmlui/tests/components-core/scripts-runner/eval-tree.test.ts:
--------------------------------------------------------------------------------
```typescript
import { describe, expect, it, assert } from "vitest";
import { Parser } from "../../../src/parsers/scripting/Parser";
import {
evalBinding,
evalBindingExpression,
} from "../../../src/components-core/script-runner/eval-tree-sync";
import { createEvalContext } from "./test-helpers";
import { evalBindingAsync } from "../../../src/components-core/script-runner/eval-tree-async";
describe("Evaluate binding expression tree (exp)", () => {
const literalCases = [
{ src: "undefined", exp: undefined },
{ src: "null", exp: null },
{ src: "Infinity", exp: Infinity },
{ src: "false", exp: false },
{ src: "true", exp: true },
{ src: "123", exp: 123 },
{ src: "123.25", exp: 123.25 },
{ src: "123.25e11", exp: 123.25e11 },
{ src: "0b11_11", exp: 0x0f },
{ src: "0x12_ae", exp: 0x12ae },
{
src: "123456789123456789123456789",
exp: BigInt("123456789123456789123456789"),
},
{ src: '"Hello"', exp: "Hello" },
{ src: "Math", exp: Math },
{ src: "Math", con: { Math: 123 }, exp: 123 },
{ src: "::Math", exp: Math },
{ src: "::Math", con: { Math: 123 }, exp: Math },
];
literalCases.forEach((c) => {
it(`Eval literal: ${c.src}`, () => {
// --- Arrange
const wParser = new Parser(c.src);
// --- Act/Assert
const expr = wParser.parseExpr();
expect(expr).not.equal(null);
if (!expr) return;
const context = createEvalContext({ localContext: (c as any).con ?? {} });
const value = evalBinding(expr, context);
expect(value).equal(c.exp);
});
});
it(`Eval literal: NaN`, () => {
// --- Arrange
const wParser = new Parser("NaN");
// --- Act/Assert
const expr = wParser.parseExpr();
expect(expr).not.equal(null);
if (!expr) return;
const context = createEvalContext({ localContext: {} });
const value = evalBinding(expr, context);
expect(isNaN(value)).equal(true);
});
const identifierCases = [
{ src: "alma", con: { alma: undefined }, exp: undefined },
{ src: "alma", con: { alma: 112 }, exp: 112 },
{ src: "banana", con: { alma: 112, banana: 223 }, exp: 223 },
{ src: "alma", con: { alma: "abc", banana: 223 }, exp: "abc" },
{ src: "alma", con: { alma: true, banana: 223 }, exp: true },
{ src: "alma", con: { alma: false, banana: 223 }, exp: false },
{ src: "alma", con: { alma: 123.5, banana: 223 }, exp: 123.5 },
];
identifierCases.forEach((c) => {
it(`Eval identifier: ${c.src}/${JSON.stringify(c.con)}`, () => {
// --- Arrange
const wParser = new Parser(c.src);
// --- Act/Assert
const expr = wParser.parseExpr();
expect(expr).not.equal(null);
if (!expr) return;
const context = createEvalContext({ localContext: c.con });
const value = evalBinding(expr, context);
expect(value).equal(c.exp);
});
});
const memberAccessCases = [
{ src: "alma.b", con: { alma: { b: 123 } }, exp: 123 },
{ src: "alma.b.c", con: { alma: { b: { c: 123, d: 234 } } }, exp: 123 },
{ src: "alma.b.d", con: { alma: { b: { c: 123, d: 234 } } }, exp: 234 },
{ src: "alma.length", con: { alma: "banana" }, exp: 6 },
{
src: "alma.b.d.length",
con: { alma: { b: { c: 123, d: "hello" } } },
exp: 5,
},
{ src: "Math.sin", con: { alma: "banana" }, exp: Math.sin },
];
memberAccessCases.forEach((c) => {
it(`Eval member access: ${c.src}/${JSON.stringify(c.con)}`, () => {
// --- Arrange
const wParser = new Parser(c.src);
// --- Act/Assert
const expr = wParser.parseExpr();
expect(expr).not.equal(null);
if (!expr) return;
const context = createEvalContext({ localContext: c.con });
const value = evalBinding(expr, context);
expect(value).equal(c.exp);
});
});
const calculatedMemberAccessCases = [
{ src: 'alma["b"]', con: { alma: { b: 123 } }, exp: 123 },
{
src: 'alma["b"]["c"]',
con: { alma: { b: { c: 123, d: 234 } } },
exp: 123,
},
{
src: 'alma["b"]["d"]',
con: { alma: { b: { c: 123, d: 234 } } },
exp: 234,
},
{ src: 'alma["length"]', con: { alma: "banana" }, exp: 6 },
{ src: "alma[0]", con: { alma: [1, true, "banana"] }, exp: 1 },
{ src: "alma[1]", con: { alma: [1, true, "banana"] }, exp: true },
{ src: "alma[2]", con: { alma: [1, true, "banana"] }, exp: "banana" },
];
calculatedMemberAccessCases.forEach((c) => {
it(`Eval member access: ${c.src}/${JSON.stringify(c.con)}`, () => {
// --- Arrange
const wParser = new Parser(c.src);
// --- Act/Assert
const expr = wParser.parseExpr();
expect(expr).not.equal(null);
if (!expr) return;
const context = createEvalContext({ localContext: c.con });
const value = evalBinding(expr, context);
expect(value).equal(c.exp);
});
});
const optionalMemberAccessCases = [
{ src: "alma?.b", con: { alma: { b: 123 } }, exp: 123 },
{ src: "alma?.b", con: { alma: { b: null } }, exp: null },
{ src: "alma?.b", con: { pear: { b: 123 }, alma: undefined }, exp: undefined },
{ src: "alma?.b?.c", con: { alma: { b: { c: 123, d: 234 } } }, exp: 123 },
{ src: "alma?.b?.c", con: { alma: { b: { c: null, d: 234 } } }, exp: null },
{
src: "alma?.b?.c",
con: { pear: { b: { c: 123, d: 234 } }, alma: undefined },
exp: undefined,
},
{
src: "alma?.b?.c",
con: { alma: { b: { w: 123, d: 234 } } },
exp: undefined,
},
{
src: "alma?.b?.c",
con: { pear: { b: { w: 123, d: 234 } }, alma: undefined },
exp: undefined,
},
];
optionalMemberAccessCases.forEach((c) => {
it(`Eval member access: ${c.src}/${JSON.stringify(c.con)}`, () => {
// --- Arrange
const wParser = new Parser(c.src);
// --- Act/Assert
const expr = wParser.parseExpr();
expect(expr).not.equal(null);
if (!expr) return;
const context = createEvalContext({ localContext: c.con });
const value = evalBinding(expr, context);
expect(value).equal(c.exp);
});
});
const defaultedMemberAccessCases = [
{ src: "alma.b", con: { alma: { b: 123 } }, exp: 123 },
{ src: "alma.b", con: { alma: { b: null } }, exp: null },
{ src: "alma.b", con: { pear: { b: 123 }, alma: undefined }, exp: undefined },
{ src: "alma.b.c", con: { alma: { b: { c: 123, d: 234 } } }, exp: 123 },
{ src: "alma.b.c", con: { alma: { b: { c: null, d: 234 } } }, exp: null },
{
src: "alma.b.c",
con: { pear: { b: { c: 123, d: 234 } }, alma: undefined },
exp: undefined,
},
{
src: "alma.b.c",
con: { alma: { b: { w: 123, d: 234 } } },
exp: undefined,
},
{
src: "alma.b.c",
con: { pear: { b: { w: 123, d: 234 } }, alma: undefined },
exp: undefined,
},
];
defaultedMemberAccessCases.forEach((c) => {
it(`Eval forced optional member access: ${c.src}/${JSON.stringify(c.con)}`, () => {
// --- Arrange
const wParser = new Parser(c.src);
// --- Act/Assert
const expr = wParser.parseExpr();
expect(expr).not.equal(null);
if (!expr) return;
const context = createEvalContext({
localContext: c.con,
appContext: {},
options: { defaultToOptionalMemberAccess: true },
});
const value = evalBinding(expr, context);
expect(value).equal(c.exp);
});
});
const sequenceCases = [
{ src: "0, alma.b", con: { alma: { b: 123 } }, exp: 123 },
{
src: "1, a+b, alma.b.c",
con: { alma: { b: { c: 123, d: 234 } }, a: 0, b: 0 },
exp: 123,
},
{
src: "2, a+b, alma.b.d",
con: { alma: { b: { c: 123, d: 234 } }, a: 0, b: 0 },
exp: 234,
},
{ src: "1, 2, 3, alma.length", con: { alma: "banana" }, exp: 6 },
{
src: "alma, alma, alma.b.d.length",
con: { alma: { b: { c: 123, d: "hello" } } },
exp: 5,
},
];
sequenceCases.forEach((c) => {
it(`Eval calculated member access: ${c.src}/${JSON.stringify(c.con)}`, () => {
// --- Arrange
const wParser = new Parser(c.src);
// --- Act/Assert
const expr = wParser.parseExpr();
expect(expr).not.equal(null);
if (!expr) return;
const context = createEvalContext({ localContext: c.con });
const value = evalBinding(expr, context);
expect(value).equal(c.exp);
});
});
const arrayLiteralCases = [
{
src: "[ alma.a, alma.b]",
con: { alma: { a: 234, b: 123 } },
exp: [234, 123],
},
{
src: '[ "banana", alma.a, alma.b]',
con: { alma: { a: 234, b: 123 } },
exp: ["banana", 234, 123],
},
{
src: '[ "banana", alma.a, alma.b.c]',
con: { alma: { a: 234, b: { f: false, c: true } } },
exp: ["banana", 234, true],
},
];
arrayLiteralCases.forEach((c) => {
it(`Array literal: ${c.src}/${JSON.stringify(c.con)}`, () => {
// --- Arrange
const wParser = new Parser(c.src);
// --- Act/Assert
const expr = wParser.parseExpr();
expect(expr).not.equal(null);
if (!expr) return;
const context = createEvalContext({ localContext: c.con });
const value = evalBinding(expr, context);
expect(value.length).equal(c.exp.length);
for (let i = 0; i < value.length; i++) {
expect(value[i]).equal(c.exp[i]);
}
});
});
const objectLiteralCases = [
{
src: "{ a: alma.a, b: alma.b }",
con: { alma: { a: 234, b: 123 } },
exp: { a: 234, b: 123 },
},
{
src: "{ a: true, b: alma.b }",
con: { alma: { a: 234, b: 123 } },
exp: { a: true, b: 123 },
},
{
src: '{ a: alma.a, b: "banana" }',
con: { alma: { a: 234, b: 123 } },
exp: { a: 234, b: "banana" },
},
{
src: '{ "q": alma.a, b: "banana" }',
con: { alma: { a: 234, b: 123 } },
exp: { q: 234, b: "banana" },
},
{
src: '{ 123: alma.a, b: "banana" }',
con: { alma: { a: 234, b: 123 } },
exp: { 123: 234, b: "banana" },
},
{
src: '{ [1+2]: alma.a, b: "banana" }',
con: { alma: { a: 234, b: 123 } },
exp: { 3: 234, b: "banana" },
},
{
src: '{ ["abc".length]: alma.a, b: "banana" }',
con: { alma: { a: 234, b: 123 } },
exp: { 3: 234, b: "banana" },
},
{
src: '{ ["app" + "le"]: alma.a, b: "banana" }',
con: { alma: { a: 234, b: 123 } },
exp: { apple: 234, b: "banana" },
},
];
objectLiteralCases.forEach((c) => {
it(`Array literal: ${c.src}/${JSON.stringify(c.con)}`, () => {
// --- Arrange
const wParser = new Parser(c.src);
// --- Act/Assert
const expr = wParser.parseExpr();
expect(expr).not.equal(null);
if (!expr) return;
const context = createEvalContext({ localContext: c.con });
const value = evalBinding(expr, context);
for (const key in c.exp) {
expect(value[key]).equal((c.exp as any)[key]);
}
});
});
const unaryCases = [
{ src: "+alma.b", con: { alma: { b: 123 } }, exp: 123 },
{ src: "-alma.b", con: { alma: { b: 123 } }, exp: -123 },
{ src: "!alma.b", con: { alma: { b: 0 } }, exp: true },
{ src: "!alma.b", con: { alma: { b: 123 } }, exp: false },
{ src: "~alma.b", con: { alma: { b: 123 } }, exp: -124 },
{ src: "~alma.b", con: { alma: { b: 0 } }, exp: -1 },
{ src: "typeof alma.b", con: { alma: { b: 0 } }, exp: "number" },
{ src: "typeof alma.b", con: { alma: { b: "Hello" } }, exp: "string" },
{ src: "typeof alma.b", con: { alma: { b: false } }, exp: "boolean" },
{ src: "typeof alma.b", con: { alma: { b: null } }, exp: "object" },
{ src: "typeof alma.b", con: { alma: {} }, exp: "undefined" },
{ src: "typeof alma.b", con: { alma: { b: {} } }, exp: "object" },
{ src: "typeof alma.b", con: { alma: { b: [1, 2, 3] } }, exp: "object" },
];
unaryCases.forEach((c) => {
it(`Unary operation: ${c.src}/${JSON.stringify(c.con)}`, () => {
// --- Arrange
const wParser = new Parser(c.src);
// --- Act/Assert
const expr = wParser.parseExpr();
expect(expr).not.equal(null);
if (!expr) return;
const context = createEvalContext({ localContext: c.con });
const value = evalBinding(expr, context);
expect(value).equal(c.exp);
});
});
const binaryCases = [
{ src: "alma.b * c", con: { alma: { b: 123 }, c: 3 }, exp: 369 },
{ src: "alma.b / c", con: { alma: { b: 123 }, c: 3 }, exp: 41 },
{ src: "alma.b % c", con: { alma: { b: 125 }, c: 3 }, exp: 2 },
{ src: "alma.b + 3", con: { alma: { b: 123 } }, exp: 126 },
{
src: "123456789123456789 + 123456789123456789123",
con: {},
exp: BigInt("123580245912580245912"),
},
{ src: '"👍" + "🚀"', con: {}, exp: "👍🚀" },
{ src: '"Hello," + " World!"', con: {}, exp: "Hello, World!" },
{ src: "alma.b - 3", con: { alma: { b: 123 } }, exp: 120 },
{ src: "alma.b >> 2", con: { alma: { b: 123 } }, exp: 30 },
{ src: "alma.b >> 2", con: { alma: { b: 123 } }, exp: 30 },
{ src: "-alma.b >> 2", con: { alma: { b: 123 } }, exp: -31 },
{ src: "alma.b >>> 2", con: { alma: { b: 123 } }, exp: 30 },
{ src: "-alma.b >>> 2", con: { alma: { b: 123 } }, exp: 1073741793 },
{ src: "alma.b < 3", con: { alma: { b: 123 } }, exp: false },
{ src: "alma.b <= 123", con: { alma: { b: 123 } }, exp: true },
{ src: "alma.b > 123", con: { alma: { b: 123 } }, exp: false },
{ src: "alma.b >= 123", con: { alma: { b: 123 } }, exp: true },
{ src: "alma.b >= 123", con: { alma: { b: 123 } }, exp: true },
{ src: "2 in [12, 123, 1234]", con: { alma: { b: 123 } }, exp: true },
{ src: '"PI" in Math', con: { alma: { b: 123 } }, exp: true },
{ src: "alma.b == 3", con: { alma: { b: 123 } }, exp: false },
{ src: "alma.b == 123", con: { alma: { b: 123 } }, exp: true },
{ src: "alma.b === 123", con: { alma: { b: 123 } }, exp: true },
{ src: "alma.b != 3", con: { alma: { b: 123 } }, exp: true },
{ src: "alma.b != 123", con: { alma: { b: 123 } }, exp: false },
{ src: "alma.b !== 123", con: { alma: { b: 123 } }, exp: false },
{ src: "alma.b & 12", con: { alma: { b: 123 } }, exp: 8 },
{ src: "alma.b | 12", con: { alma: { b: 123 } }, exp: 127 },
{ src: "alma.b ^ 12", con: { alma: { b: 123 } }, exp: 119 },
{ src: "alma.b && 12", con: { alma: { b: 123 } }, exp: 12 },
{ src: "alma.b && 12 > 3", con: { alma: { b: 123 } }, exp: true },
{ src: "alma.b || 12", con: { alma: { b: 123 } }, exp: 123 },
{ src: "alma.b || 12 > 3", con: { alma: { b: 123 } }, exp: 123 },
{ src: "alma.b < 3 || 12 > 3", con: { alma: { b: 123 } }, exp: true },
{ src: "12 + 23 * 4", con: {}, exp: 104 },
{ src: "(12 + 23) * 4", con: {}, exp: 140 },
{ src: "12 * 23 + 4", con: {}, exp: 280 },
{ src: "alma.b ?? 12", con: { alma: { b: null } }, exp: 12 },
{ src: "alma.b ?? 12", con: { alma: { b: undefined } }, exp: 12 },
{ src: "alma.b ?? 12", con: { alma: { b: 234 } }, exp: 234 },
];
binaryCases.forEach((c) => {
it(`Binary operation: ${c.src}/${JSON.stringify(c.con)}`, () => {
const context = createEvalContext({ localContext: c.con });
const value = evalBindingExpression(c.src, context);
expect(value).equal(c.exp);
});
});
const exponentialCases = [
{
src: "2**3",
exp: 8,
},
{
src: "2**3**2",
exp: 512,
},
{
src: "4**2**3",
exp: 65536,
},
{
src: "1.5**2",
exp: 2.25,
},
{
src: "1.5**2**3",
exp: 25.62890625,
},
];
exponentialCases.forEach((c) => {
it(`Conditional: ${c.src}`, () => {
// --- Arrange
const wParser = new Parser(c.src);
// --- Act/Assert
const expr = wParser.parseExpr();
expect(expr).not.equal(null);
if (!expr) return;
const context = createEvalContext({ localContext: {} });
const value = evalBinding(expr, context);
expect(value).equal(c.exp);
});
});
const functionInvocationCases = [
{
src: "Math.sin(0)",
con: { alma: { a: 234, b: 123 } },
exp: 0,
},
{
src: "Math.cos(0.0)",
con: { alma: { a: 234, b: 123 } },
exp: 1,
},
{
src: "alma.mul(2, alma.mul(3,4)) + Math.cos(0)",
con: { alma: { mul: (a: any, b: any) => a * b, b: 123 } },
exp: 25,
},
];
functionInvocationCases.forEach((c) => {
it(`Function call: ${c.src}/${JSON.stringify(c.con)}`, () => {
// --- Arrange
const wParser = new Parser(c.src);
// --- Act/Assert
const expr = wParser.parseExpr();
expect(expr).not.equal(null);
if (!expr) return;
const context = createEvalContext({ localContext: c.con });
const value = evalBinding(expr, context);
expect(value).equal(c.exp);
});
});
const itemReferenceCases = [
{
src: "$item",
con: { $item: 123 },
exp: 123,
},
];
itemReferenceCases.forEach((c) => {
it(`Item reference: ${c.src}/${JSON.stringify(c.con)}`, () => {
// --- Arrange
const wParser = new Parser(c.src);
// --- Act/Assert
const expr = wParser.parseExpr();
expect(expr).not.equal(null);
if (!expr) return;
const context = createEvalContext({ localContext: c.con });
const value = evalBinding(expr, context);
expect(value).equal(c.exp);
});
});
const appContextCases = [
{
src: "alma.b",
con: { pear: 123 },
aCon: { alma: { b: 234 } },
exp: 234,
},
{
src: "alma.b",
con: { alma: { b: 123 } },
aCon: { alma: { b: 234 } },
exp: 123,
},
];
appContextCases.forEach((c) => {
it(`App context: ${c.src}/${JSON.stringify(c.con)}`, () => {
// --- Arrange
const wParser = new Parser(c.src);
// --- Act/Assert
const expr = wParser.parseExpr();
expect(expr).not.equal(null);
if (!expr) return;
const context = createEvalContext({ localContext: c.con, appContext: c.aCon });
const value = evalBinding(expr, context);
expect(value).equal(c.exp);
});
});
it("Array literal with spread array", () => {
// --- Arrange
const wParser = new Parser("[5, ...[1,2,3], 4]");
// --- Act/Assert
const expr = wParser.parseExpr();
expect(expr).not.equal(null);
if (!expr) return;
const context = createEvalContext({ localContext: {}, appContext: {} });
const value = evalBinding(expr, context);
expect(value.length).equal(5);
expect(value[0]).equal(5);
expect(value[1]).equal(1);
expect(value[2]).equal(2);
expect(value[3]).equal(3);
expect(value[4]).equal(4);
});
it("Spread out of context", () => {
// --- Arrange
const wParser = new Parser("...[1,2,3]");
// --- Act/Assert
const expr = wParser.parseExpr();
expect(expr).not.equal(null);
if (!expr) return;
try {
const context = createEvalContext({ localContext: {}, appContext: {} });
evalBinding(expr, context);
} catch (err: any) {
expect(err.message.indexOf("(...)")).greaterThan(-1);
return;
}
assert.fail("Exception expected");
});
it("Array literal with spread object", () => {
// --- Arrange
const wParser = new Parser("[5, ...{a: 1, b: 2}]");
// --- Act/Assert
const expr = wParser.parseExpr();
expect(expr).not.equal(null);
if (!expr) return;
try {
const context = createEvalContext({ localContext: {}, appContext: {} });
evalBinding(expr, context);
} catch (err: any) {
expect(err.message.indexOf("array operand")).greaterThan(-1);
return;
}
assert.fail("Exception expected");
});
it("Object literal with spread array", () => {
// --- Arrange
const wParser = new Parser("{ a:1, ...[1,2,3], b:4}");
// --- Act/Assert
const expr = wParser.parseExpr();
expect(expr).not.equal(null);
if (!expr) return;
const context = createEvalContext({ localContext: {}, appContext: {} });
const value = evalBinding(expr, context);
expect(value[0]).equal(1);
expect(value[1]).equal(2);
expect(value[2]).equal(3);
expect(value["a"]).equal(1);
expect(value["b"]).equal(4);
});
it("Object literal with spread object", () => {
// --- Arrange
const wParser = new Parser("{ a:1, ...{ c:3, d:5}, b:4}");
// --- Act/Assert
const expr = wParser.parseExpr();
expect(expr).not.equal(null);
if (!expr) return;
const context = createEvalContext({ localContext: {}, appContext: {} });
const value = evalBinding(expr, context);
expect(value["a"]).equal(1);
expect(value["b"]).equal(4);
expect(value["c"]).equal(3);
expect(value["d"]).equal(5);
});
it("Function call with spread array", () => {
// --- Arrange
const wParser = new Parser("myFunc(1, 2, ...[3, 4], 5)");
// --- Act/Assert
const expr = wParser.parseExpr();
expect(expr).not.equal(null);
if (!expr) return;
const context = createEvalContext({
localContext: {
myFunc(...args: any[]) {
return args.join(":");
},
},
appContext: {},
});
const value = evalBinding(expr, context);
expect(value).equal("1:2:3:4:5");
});
it("Function call with spread object", () => {
// --- Arrange
const wParser = new Parser("myFunc(1, 2, ...{a: 1, b:2}, 5)");
// --- Act/Assert
const expr = wParser.parseExpr();
expect(expr).not.equal(null);
if (!expr) return;
try {
const context = createEvalContext({
localContext: {
myFunc(...args: any[]) {
return args.join(":");
},
},
appContext: {},
});
evalBinding(expr, context);
} catch (err: any) {
expect(err.message.indexOf("array operand")).greaterThan(-1);
return;
}
assert.fail("Exception expected");
});
it("Sync function call with promise raises error", () => {
// --- Arrange
const wParser = new Parser("delay(120)");
// --- Act/Assert
const expr = wParser.parseExpr();
expect(expr).not.equal(null);
if (!expr) return;
try {
const context = createEvalContext({
localContext: {
delay: async (time: number) => new Promise((resolve) => setTimeout(resolve, time)),
},
appContext: {},
});
evalBinding(expr, context);
} catch (err: any) {
expect(err.message).contains("Promise");
return;
}
assert.fail("Exception expected");
});
it("Async function call works", async () => {
// --- Arrange
const wParser = new Parser("delay(120)");
const expr = wParser.parseExpr();
expect(expr).not.equal(null);
if (!expr) return;
// --- Act
const context = createEvalContext({
localContext: {
delay: async (time: number) => {
new Promise((resolve) => setTimeout(resolve, time));
return 123;
},
},
appContext: {},
});
const value = await evalBindingAsync(expr, context, undefined);
// --- Assert
expect(value).equal(123);
});
it("delete alma", () => {
// --- Arrange
const wParser = new Parser("delete alma");
// --- Act/Assert
const expr = wParser.parseExpr();
expect(expr).not.equal(null);
if (!expr) return;
const context = createEvalContext({ localContext: { alma: {} } });
const value = evalBinding(expr, context);
expect(value).equal(true);
expect(context.localContext.alma).equal(undefined);
});
it("delete alma.b #1", () => {
// --- Arrange
const wParser = new Parser("delete alma.b");
// --- Act/Assert
const expr = wParser.parseExpr();
expect(expr).not.equal(null);
if (!expr) return;
const context = createEvalContext({ localContext: { alma: {} } });
const value = evalBinding(expr, context);
expect(value).equal(true);
expect(context.localContext.alma.b).equal(undefined);
});
it("delete alma.b #2", () => {
// --- Arrange
const wParser = new Parser("delete alma.b");
// --- Act/Assert
const expr = wParser.parseExpr();
expect(expr).not.equal(null);
if (!expr) return;
const context = createEvalContext({ localContext: { alma: { b: "hello" } } });
const value = evalBinding(expr, context);
expect(value).equal(true);
expect(context.localContext.alma.b).equal(undefined);
});
it("delete 123", () => {
// --- Arrange
const wParser = new Parser("delete 123");
// --- Act/Assert
const expr = wParser.parseExpr();
expect(expr).not.equal(null);
if (!expr) return;
const context = createEvalContext({});
const value = evalBinding(expr, context);
expect(value).equal(false);
});
it("|| regression #1", () => {
// --- Arrange
const wParser = new Parser("123 || ++a");
// --- Act/Assert
const expr = wParser.parseExpr();
expect(expr).not.equal(null);
if (!expr) return;
const context = createEvalContext({
localContext: { a: 0 },
});
const value = evalBinding(expr, context);
expect(value).equal(123);
expect(context.localContext.a).equal(0);
});
it("|| regression #2", () => {
// --- Arrange
const wParser = new Parser("true || ++a");
// --- Act/Assert
const expr = wParser.parseExpr();
expect(expr).not.equal(null);
if (!expr) return;
const context = createEvalContext({
localContext: { a: 0 },
});
const value = evalBinding(expr, context);
expect(value).equal(true);
expect(context.localContext.a).equal(0);
});
it("|| regression #3 (async)", async () => {
// --- Arrange
const wParser = new Parser("123 || ++a");
// --- Act/Assert
const expr = wParser.parseExpr();
expect(expr).not.equal(null);
if (!expr) return;
const context = createEvalContext({
localContext: { a: 0 },
});
const value = await evalBindingAsync(expr, context, context.mainThread);
expect(value).equal(123);
expect(context.localContext.a).equal(0);
});
it("|| regression #4 (async)", async () => {
// --- Arrange
const wParser = new Parser("true || ++a");
// --- Act/Assert
const expr = wParser.parseExpr();
expect(expr).not.equal(null);
if (!expr) return;
const context = createEvalContext({
localContext: { a: 0 },
});
const value = await evalBindingAsync(expr, context, context.mainThread);
expect(value).equal(true);
expect(context.localContext.a).equal(0);
});
it("&& regression #1", () => {
// --- Arrange
const wParser = new Parser("'' && ++a");
// --- Act/Assert
const expr = wParser.parseExpr();
expect(expr).not.equal(null);
if (!expr) return;
const context = createEvalContext({
localContext: { a: 0 },
});
const value = evalBinding(expr, context);
expect(value).equal("");
expect(context.localContext.a).equal(0);
});
it("&& regression #2", () => {
// --- Arrange
const wParser = new Parser("false && ++a");
// --- Act/Assert
const expr = wParser.parseExpr();
expect(expr).not.equal(null);
if (!expr) return;
const context = createEvalContext({
localContext: { a: 0 },
});
const value = evalBinding(expr, context);
expect(value).equal(false);
expect(context.localContext.a).equal(0);
});
it("&& regression #3 (async)", async () => {
// --- Arrange
const wParser = new Parser("0 && ++a");
// --- Act/Assert
const expr = wParser.parseExpr();
expect(expr).not.equal(null);
if (!expr) return;
const context = createEvalContext({
localContext: { a: 0 },
});
const value = await evalBindingAsync(expr, context, context.mainThread);
expect(value).equal(0);
expect(context.localContext.a).equal(0);
});
it("&& regression #4 (async)", async () => {
// --- Arrange
const wParser = new Parser("false && ++a");
// --- Act/Assert
const expr = wParser.parseExpr();
expect(expr).not.equal(null);
if (!expr) return;
const context = createEvalContext({
localContext: { a: 0 },
});
const value = await evalBindingAsync(expr, context, context.mainThread);
expect(value).equal(false);
expect(context.localContext.a).equal(0);
});
it(`Evals template literals`, () => {
// --- Arrange
const wParser = new Parser("`\\u0058\\x59a${2+3}b${var1}d${undef}${NaN}${null}\\${1+2}`");
// --- Act/Assert
const expr = wParser.parseExpr();
const context = createEvalContext({ localContext: { var1: "c", undef: undefined } });
const value = evalBinding(expr, context);
expect(value).to.equal("XYa5bcdundefinedNaNnull${1+2}");
});
it(`Evals template literals (async)`, async () => {
// --- Arrange
const wParser = new Parser("`\\u0058\\x59a${2+3}b${var1}d${undef}${NaN}${null}\\${1+2}`");
// --- Act/Assert
const expr = wParser.parseExpr();
const context = createEvalContext({ localContext: { var1: "c", undef: undefined } });
const value = await evalBindingAsync(expr, context, context.mainThread);
expect(value).to.equal("XYa5bcdundefinedNaNnull${1+2}");
});
it(`template literal method call`, async () => {
// --- Arrange
const wParser = new Parser("`a `.trim()");
// --- Act/Assert
const expr = wParser.parseExpr();
const context = createEvalContext({
localContext: {},
});
const value = await evalBindingAsync(expr, context, context.mainThread);
expect(value).to.equal("a");
});
});
```
--------------------------------------------------------------------------------
/xmlui/src/components-core/script-runner/process-statement-sync.ts:
--------------------------------------------------------------------------------
```typescript
import type { LogicalThread } from "../../abstractions/scripting/LogicalThread";
import type { LoopScope } from "../../abstractions/scripting/LoopScope";
import type { BlockScope } from "../../abstractions/scripting/BlockScope";
import {
T_ARROW_EXPRESSION_STATEMENT,
T_ASSIGNMENT_EXPRESSION,
T_BLOCK_STATEMENT,
T_BREAK_STATEMENT,
T_CONST_STATEMENT,
T_CONTINUE_STATEMENT,
T_DO_WHILE_STATEMENT,
T_EMPTY_STATEMENT,
T_EXPRESSION_STATEMENT,
T_FOR_IN_STATEMENT,
T_FOR_OF_STATEMENT,
T_FOR_STATEMENT,
T_FUNCTION_DECLARATION,
T_IDENTIFIER,
T_IF_STATEMENT,
T_LET_STATEMENT,
T_LITERAL,
T_RETURN_STATEMENT,
T_SWITCH_STATEMENT,
T_THROW_STATEMENT,
T_TRY_STATEMENT,
T_VAR_STATEMENT,
T_WHILE_STATEMENT,
type ArrayDestructure,
type AssignmentExpression,
type Identifier,
type Literal,
type ObjectDestructure,
type Statement,
type VarDeclaration,
} from "./ScriptingSourceTree";
import { reportEngineError } from "../reportEngineError";
import { StatementExecutionError, ThrowStatementError } from "../EngineError";
import {
innermostBlockScope,
innermostLoopScope,
createLoopScope,
provideLoopBody,
releaseLoopScope,
ensureMainThread,
innermostTryScope,
provideTryBody,
createTryScope,
provideCatchBody,
provideFinallyBody,
provideFinallyErrorBody,
hoistFunctionDeclarations,
toStatementItems,
closing,
guard,
} from "./process-statement-common";
import type { BindingTreeEvaluationContext } from "./BindingTreeEvaluationContext";
import { evalBinding, executeArrowExpressionSync } from "./eval-tree-sync";
import type {
StatementRunTimeInfo,
StatementWithInfo,
QueueInfo,
StatementQueueItem,
ProcessOutcome,
} from "./statement-queue";
import { StatementQueue, mapStatementsToQueueItems, mapToItem } from "./statement-queue";
import { createXmlUiTreeNodeId } from "../../parsers/scripting/Parser";
const SYNC_EVAL_TIMEOUT = 1000;
// --- Helper function to process the entire queue synchronously
export function processStatementQueue(
statements: Statement[],
evalContext: BindingTreeEvaluationContext,
thread?: LogicalThread,
): QueueInfo {
if (!thread) {
// --- Create the main thread for the queue
thread = ensureMainThread(evalContext);
}
// --- Hoist function declarations to the top scope
hoistFunctionDeclarations(thread, statements);
// --- Set start tick to observe timeout
evalContext.startTick = new Date().valueOf();
// --- Fill the queue with items
const queue = new StatementQueue();
queue.push(mapStatementsToQueueItems(toStatementItems(statements)));
// --- Prepare queue diagnostics information
const diagInfo: QueueInfo = {
processedStatements: 0,
maxQueueLength: queue.length,
unshiftedItems: 0,
clearToLabels: 0,
maxBlocks: 0,
maxLoops: 0,
};
// --- Consume the queue
while (queue.length > 0) {
// --- Check sync timeout
if (
evalContext.startTick !== undefined &&
new Date().valueOf() - evalContext.startTick > SYNC_EVAL_TIMEOUT
) {
throw new Error(`Sync evaluation timeout exceeded ${SYNC_EVAL_TIMEOUT} milliseconds`);
}
// --- Process the first item
const queueItem = queue.dequeue();
thread.breakLabelValue = queue.length > 0 ? queue.peek()!.label : -1;
let outcome: ProcessOutcome | undefined;
try {
// --- Sign that the statement is about to start
void evalContext?.onStatementStarted?.(evalContext, queueItem!.statement);
// --- Execute the statement
outcome = processStatement(
queueItem!.statement,
queueItem!.execInfo ?? {},
evalContext,
thread,
);
} catch (err) {
if (thread.tryBlocks && thread.tryBlocks.length > 0) {
// --- We have a try block to handle this error
const tryScope = thread.tryBlocks[thread.tryBlocks.length - 1];
// --- Sign the error to raise. Next time the guarded try block will execute the catch block, if there is any
tryScope.errorToThrow = err;
tryScope.errorSource = tryScope.processingPhase;
tryScope.processingPhase = "error";
// --- Let's skip the remaining parts of the current block (try/catch/finally)
outcome = {
clearToLabel: tryScope.tryLabel,
};
} else {
if (err instanceof ThrowStatementError) {
reportEngineError(err);
} else {
// TODO: Provide source code information
reportEngineError(
new StatementExecutionError(err as any /* queueItem!.statement?.source */),
err,
);
}
}
}
// --- Modify the queue's content according to the outcome
if (outcome) {
if (outcome.toUnshift) {
queue.unshift(outcome.toUnshift);
diagInfo.unshiftedItems += outcome.toUnshift.length;
}
if (outcome.clearToLabel !== undefined) {
queue.clearToLabel(outcome.clearToLabel);
diagInfo.clearToLabels++;
}
}
// --- Sign that the statement has been completed
void evalContext?.onStatementCompleted?.(evalContext, queueItem!.statement);
// --- Provide diagnostics
if (queue.length > diagInfo.maxQueueLength) {
diagInfo.maxQueueLength = queue.length;
}
if (thread.blocks && thread.blocks!.length > diagInfo.maxBlocks) {
diagInfo.maxBlocks = thread.blocks!.length;
}
if (thread.loops && thread.loops.length > diagInfo.maxLoops) {
diagInfo.maxLoops = thread.loops.length;
}
diagInfo.processedStatements++;
}
// --- Done.
return diagInfo;
}
/**
* Process the specified statement synchronously
* @param statement Statement to process
* @param evalContext Evaluation context used for processing
* @param thread Logical thread to use for statement processing
* @returns Items to put back into the queue of statements
*/
function processStatement(
statement: Statement,
execInfo: StatementRunTimeInfo,
evalContext: BindingTreeEvaluationContext,
thread: LogicalThread,
): ProcessOutcome {
// --- These items should be put in the statement queue after return
let toUnshift: StatementQueueItem[] = [];
let clearToLabel: number | undefined;
// --- Process the statement according to its type
switch (statement.type) {
case T_FUNCTION_DECLARATION:
// --- Function declarations are already hoisted, nothing to do
break;
case T_VAR_STATEMENT:
if (thread !== evalContext.mainThread) {
throw new Error("'var' declarations are not allowed within functions");
}
break;
case T_EMPTY_STATEMENT:
// --- Nothing to do
break;
case T_BLOCK_STATEMENT:
// --- No statement, nothing to process
if (statement.stmts.length === 0) break;
// --- Create a new block scope
thread.blocks ??= [];
thread.blocks.push({ vars: {} });
// --- Hoist function declarations to the innermost block scope
hoistFunctionDeclarations(thread, statement.stmts);
// --- Queue the block scope's body...
toUnshift = mapStatementsToQueueItems([
...toStatementItems(statement.stmts),
// --- ...and an empty statement to remove the block scope
closing(),
]);
break;
case T_EXPRESSION_STATEMENT:
// --- Just evaluate it
const statementValue = evalBinding(statement.expr, evalContext, thread);
if (thread.blocks && thread.blocks.length !== 0) {
thread.blocks[thread.blocks.length - 1].returnValue = statementValue;
}
break;
case T_ARROW_EXPRESSION_STATEMENT:
// --- Compile the arrow expression
const arrowFuncValue = executeArrowExpressionSync(
statement.expr,
evalContext,
thread,
...(evalContext.eventArgs ?? []),
);
if (thread.blocks && thread.blocks.length !== 0) {
thread.blocks[thread.blocks.length - 1].returnValue = arrowFuncValue;
}
break;
case T_LET_STATEMENT: {
// --- Create a new variable in the innermost scope
const block = innermostBlockScope(thread);
if (!block) {
throw new Error("Missing block scope");
}
processDeclarations(block, evalContext, thread, statement.decls);
break;
}
case T_CONST_STATEMENT: {
// --- Create a new variable in the innermost scope
const block = innermostBlockScope(thread);
if (!block) {
throw new Error("Missing block scope");
}
processDeclarations(block, evalContext, thread, statement.decls, true);
break;
}
case T_IF_STATEMENT:
// --- Evaluate the condition
const condition = !!evalBinding(statement.cond, evalContext, thread);
if (condition) {
toUnshift = mapToItem(statement.thenB);
} else if (statement.elseB) {
toUnshift = mapToItem(statement.elseB);
}
break;
case T_RETURN_STATEMENT: {
// --- Check if return is valid here
let blockScope = innermostBlockScope(thread);
if (blockScope === undefined) {
throw new Error("Return requires a block scope");
}
// --- Store the return value
thread.returnValue = statement.expr
? evalBinding(statement.expr, evalContext, thread)
: undefined;
// --- Check for try blocks
if ((thread.tryBlocks ?? []).length > 0) {
// --- Mark the loop's try scope to exit with "return"
const returnTryScope = thread.tryBlocks![0];
returnTryScope.exitType = "return";
// --- Remove the try/catch/finally block's scope
if (returnTryScope.processingPhase !== "postFinally") {
thread.blocks!.pop();
}
// --- Clear the last part of the try/catch/finally block
const tryScope = innermostTryScope(thread);
clearToLabel = tryScope.tryLabel;
} else {
// --- Delete the remaining part of the queue
clearToLabel = -1;
}
break;
}
case T_WHILE_STATEMENT: {
// --- Create or get the loop's scope (guard is falsy for the first execution)
let loopScope = execInfo.guard ? innermostLoopScope(thread) : createLoopScope(thread);
// --- Evaluate the loop condition
const condition = !!evalBinding(statement.cond, evalContext, thread);
if (condition) {
toUnshift = provideLoopBody(loopScope!, statement, thread.breakLabelValue);
} else {
// --- When the condition is not met, we're done.
releaseLoopScope(thread);
}
break;
}
case T_DO_WHILE_STATEMENT: {
if (!execInfo.guard) {
// --- First loop execution (do-while is a post-test loop)
toUnshift = provideLoopBody(createLoopScope(thread), statement, thread.breakLabelValue);
break;
}
// --- Evaluate the loop condition
const condition = !!evalBinding(statement.cond, evalContext, thread);
if (condition) {
toUnshift = provideLoopBody(innermostLoopScope(thread), statement, thread.breakLabelValue);
} else {
// --- When the condition is not met, we're done.
releaseLoopScope(thread);
}
break;
}
case T_CONTINUE_STATEMENT: {
// --- Search for the innermost non-switch loop scope, release the switch scopes
if (!thread.loops || thread.loops.length === 0) {
throw new Error("Missing loop scope");
}
let loopScope: LoopScope | undefined;
while (thread.loops.length > 0) {
loopScope = innermostLoopScope(thread);
if (!loopScope.isSwitch) {
break;
}
thread.loops.pop();
}
if (!loopScope) {
throw new Error("Missing loop scope");
}
if (
loopScope.tryBlockDepth >= 0 &&
loopScope.tryBlockDepth < (thread.tryBlocks ?? []).length
) {
// --- Mark the loop's try scope to exit with "continue"
for (let i = loopScope.tryBlockDepth; i < thread.tryBlocks!.length; i++) {
thread.tryBlocks![loopScope.tryBlockDepth]!.exitType = "continue";
}
// --- Clear the last part of the try/catch/finally block
const tryScope = innermostTryScope(thread);
clearToLabel = tryScope.tryLabel;
} else {
clearToLabel = loopScope.continueLabel;
releaseLoopScope(thread, false);
}
break;
}
case T_BREAK_STATEMENT: {
const loopScope = innermostLoopScope(thread);
if (loopScope === undefined) {
throw new Error("Missing loop scope");
}
if (!!loopScope.isSwitch) {
// --- Break is in a switch case
clearToLabel = loopScope.breakLabel;
break;
}
// --- Break is in a loop construct
if (
loopScope.tryBlockDepth >= 0 &&
loopScope.tryBlockDepth < (thread.tryBlocks ?? []).length
) {
// --- Mark the loop's try scope to exit with "break"
for (let i = loopScope.tryBlockDepth; i < thread.tryBlocks!.length; i++) {
thread.tryBlocks![loopScope.tryBlockDepth]!.exitType = "break";
}
// --- Clear the last part of the try/catch/finally block
const tryScope = innermostTryScope(thread);
clearToLabel = tryScope.tryLabel;
} else {
clearToLabel = loopScope.breakLabel;
releaseLoopScope(thread);
}
break;
}
case T_FOR_STATEMENT:
if (!execInfo.guard) {
// --- Init the loop with a new scope
createLoopScope(thread, 1);
// --- Create a new block for the loop variables
thread.blocks ??= [];
thread.blocks.push({ vars: {} });
const guardStatement = guard(statement);
if (statement.init) {
// --- Unshift the initialization part and the guarded for-loop
toUnshift = mapStatementsToQueueItems([{ statement: statement.init }, guardStatement]);
} else {
// --- No init, unshift only the guard statement
toUnshift = mapStatementsToQueueItems([guardStatement]);
}
} else {
// --- Initialization already done. Evaluate the condition
if (!statement.cond || evalBinding(statement.cond, evalContext, thread)) {
// --- Stay in the loop, inject the body, the update expression, and the loop guard
const loopScope = innermostLoopScope(thread);
if (statement.upd) {
const updateStmt: StatementWithInfo = {
statement: {
type: T_EXPRESSION_STATEMENT,
nodeId: createXmlUiTreeNodeId(),
expr: statement.upd,
},
};
toUnshift = mapStatementsToQueueItems([
{ statement: statement.body },
updateStmt,
{ statement, execInfo },
]);
} else {
toUnshift = mapStatementsToQueueItems([
{ statement: statement.body },
{ statement, execInfo },
]);
}
// --- The next queue label is for "break"
loopScope.breakLabel = thread.breakLabelValue ?? -1;
// --- The guard action's label is for "continue"
loopScope.continueLabel = toUnshift[1].label;
} else {
// --- The condition is not met, we're done. Remove the loop's scope from the evaluation context
releaseLoopScope(thread);
}
}
break;
case T_FOR_IN_STATEMENT:
if (!execInfo.guard) {
// --- Get the object keys
const keyedObject = evalBinding(statement.expr, evalContext, thread);
if (keyedObject == undefined) {
// --- Nothing to do, no object to traverse
break;
}
// --- Init the loop with a new scope
createLoopScope(thread, 1);
// --- Create a new block for the loop variables
thread.blocks ??= [];
thread.blocks.push({ vars: {} });
toUnshift = mapStatementsToQueueItems([
{ statement, execInfo: { guard: true, keys: Object.keys(keyedObject), keyIndex: 0 } },
]);
} else {
// --- Just for the sake of extra safety
if (execInfo.keyIndex === undefined || execInfo.keys === undefined) {
throw new Error("Keys information expected in for..in loop");
}
// --- Any key left?
if (execInfo.keyIndex < execInfo.keys.length) {
// --- Set the binding variable to the next key
const propValue = execInfo.keys[execInfo.keyIndex++];
switch (statement.varB) {
case "none": {
const assigmentExpr: AssignmentExpression = {
type: T_ASSIGNMENT_EXPRESSION,
leftValue: {
type: T_IDENTIFIER,
name: statement.id.name,
} as Identifier,
op: "=",
expr: {
type: T_LITERAL,
value: propValue,
} as Literal,
} as AssignmentExpression;
evalBinding(assigmentExpr, evalContext, thread);
break;
}
case "const":
case "let":
{
// --- Create a new variable in the innermost scope
const block = innermostBlockScope(thread);
if (!block) {
throw new Error("Missing block scope");
}
block.vars[statement.id.name] = propValue;
if (statement.varB === "const") {
block.constVars ??= new Set<string>();
block.constVars.add(statement.id.name);
}
}
break;
}
// --- Inject the loop body
const loopScope = innermostLoopScope(thread);
toUnshift = mapStatementsToQueueItems([
{ statement: statement.body },
{ statement, execInfo },
]);
// --- The next queue label is for "break"
loopScope.breakLabel = thread.breakLabelValue ?? -1;
// --- The guard action's label is for "continue"
loopScope.continueLabel = toUnshift[1].label;
} else {
// --- The for..in loop is complete. Remove the loop's scope from the evaluation context
releaseLoopScope(thread);
}
}
break;
case T_FOR_OF_STATEMENT:
if (!execInfo.guard) {
// --- Get the object keys
const iteratorObject = evalBinding(statement.expr, evalContext, thread);
if (iteratorObject == null || typeof iteratorObject[Symbol.iterator] !== "function") {
// --- The object is not an iterator
throw new Error("Object in for..of is not iterable");
}
// --- Init the loop with a new scope
createLoopScope(thread, 1);
// --- Create a new block for the loop variables
thread.blocks ??= [];
thread.blocks.push({ vars: {} });
toUnshift = mapStatementsToQueueItems([
{ statement, execInfo: { guard: true, iterator: iteratorObject[Symbol.iterator]() } },
]);
} else {
// --- Just for the sake of extra safety
if (execInfo.iterator === undefined) {
throw new Error("Iterator expected in for..of loop");
}
// --- Any iteration left?
const nextIteration = execInfo.iterator.next();
if (nextIteration.done) {
// --- The for..of loop is complete. Remove the loop's scope from the evaluation context
releaseLoopScope(thread);
break;
}
// --- Set the binding variable to the next key
const propValue = nextIteration.value;
switch (statement.varB) {
case "none": {
const assigmentExpr: AssignmentExpression = {
type: T_ASSIGNMENT_EXPRESSION,
leftValue: {
type: T_IDENTIFIER,
name: statement.id.name,
} as Identifier,
op: "=",
expr: {
type: T_LITERAL,
value: propValue,
} as Literal,
} as AssignmentExpression;
evalBinding(assigmentExpr, evalContext, thread);
break;
}
case "const":
case "let":
{
// --- Create a new variable in the innermost scope
const block = innermostBlockScope(thread);
if (!block) {
throw new Error("Missing block scope");
}
block.vars[statement.id.name] = propValue;
if (statement.varB === "const") {
block.constVars ??= new Set<string>();
block.constVars.add(statement.id.name);
}
}
break;
}
// --- Inject the loop body
const loopScope = innermostLoopScope(thread);
toUnshift = mapStatementsToQueueItems([
{ statement: statement.body },
{ statement, execInfo },
]);
// --- The next queue label is for "break"
loopScope.breakLabel = thread.breakLabelValue ?? -1;
// --- The guard action's label is for "continue"
loopScope.continueLabel = toUnshift[1].label;
}
break;
case T_THROW_STATEMENT: {
throw new ThrowStatementError(evalBinding(statement.expr, evalContext, thread));
}
case T_TRY_STATEMENT: {
if (!execInfo.guard) {
// --- Execute the try block
toUnshift = provideTryBody(thread, createTryScope(thread, statement));
break;
}
// --- Evaluate try
const tryScope = innermostTryScope(thread);
switch (tryScope.processingPhase) {
case "error":
// --- There was an error we may handle with catch
switch (tryScope.errorSource) {
case "try":
// --- Remove the "try" block's scope
thread.blocks!.pop();
// --- Go on with catch or finally
if (statement.catchB) {
if (tryScope.statement.catchV) {
const block = innermostBlockScope(thread)!;
block.vars[tryScope.statement.catchV.name] =
tryScope.errorToThrow instanceof ThrowStatementError
? tryScope.errorToThrow.errorObject
: tryScope.errorToThrow;
}
delete tryScope.errorToThrow;
tryScope.processingPhase = "catch";
toUnshift = provideCatchBody(thread, tryScope);
} else if (tryScope.statement.finallyB) {
// --- No catch, move on finally
tryScope.processingPhase = "finally";
toUnshift = provideFinallyBody(thread, tryScope);
}
break;
case "catch":
// --- Remove the "catch" block's scope
thread.blocks!.pop();
// --- Move to the finally block
tryScope.processingPhase = "finally";
toUnshift = provideFinallyBody(thread, tryScope);
break;
case "finally":
// --- Remove the "finally" block's scope
thread.blocks!.pop();
// --- Move to the post finally execution
tryScope.processingPhase = "postFinally";
toUnshift = provideFinallyErrorBody(tryScope);
break;
}
break;
case "try":
// --- We completed the try block successfully
tryScope.processingPhase = "finally";
if (statement.finallyB) {
toUnshift = provideFinallyBody(thread, tryScope);
}
break;
case "catch":
// --- We completed the catch block successfully, remove the handled error
tryScope.processingPhase = "finally";
if (statement.finallyB) {
toUnshift = provideFinallyBody(thread, tryScope);
}
break;
case "finally":
tryScope.processingPhase = "postFinally";
toUnshift = provideFinallyErrorBody(tryScope);
break;
case "postFinally":
// --- We completed the finally block successfully
const innermostTry = thread.tryBlocks!.pop()!;
// --- Is there any special exit type?
switch (innermostTry.exitType) {
case "break": {
const loopScope = innermostLoopScope(thread);
if (loopScope === undefined) {
throw new Error("Missing loop scope");
}
releaseLoopScope(thread);
clearToLabel = loopScope.breakLabel;
break;
}
case "continue": {
const loopScope = innermostLoopScope(thread);
if (loopScope === undefined) {
throw new Error("Missing loop scope");
}
clearToLabel = loopScope.continueLabel;
releaseLoopScope(thread, false);
break;
}
case "return":
clearToLabel = -1;
break;
}
// --- Should we raise an error?
if (innermostTry.errorToThrow) {
throw innermostTry.errorToThrow;
}
break;
}
break;
}
case T_SWITCH_STATEMENT: {
// --- Create or get the loop's scope (guard is falsy for the first execution)
if (execInfo.guard) {
// --- Complete the switch
releaseLoopScope(thread);
} else {
let loopScope = createLoopScope(thread);
loopScope.isSwitch = true;
thread.blocks!.push({ vars: {} });
// --- Evaluate the switch value
const switchValue = evalBinding(statement.expr, evalContext, thread);
// --- Find the matching label
let matchingIndex = -1;
for (let i = 0; i < statement.cases.length; i++) {
const currentCase = statement.cases[i];
// --- Check for default case
if (currentCase.caseE === undefined) {
matchingIndex = i;
break;
}
// --- Check for matching case
const caseValue = evalBinding(currentCase.caseE, evalContext, thread);
if (caseValue === switchValue) {
matchingIndex = i;
break;
}
}
// --- Merge all statements from the matching label
const statementFlow: Statement[] = [];
if (matchingIndex >= 0) {
for (let i = matchingIndex; i < statement.cases.length; i++) {
statementFlow.push(...statement.cases[i].stmts!);
}
}
// --- Queue the statement flow and the guard
toUnshift = mapStatementsToQueueItems([
...toStatementItems(statementFlow),
guard(statement),
]);
loopScope.breakLabel = toUnshift[toUnshift.length - 1].label;
}
break;
}
}
// --- The statement may remove the innermost scope
if (execInfo.removeBlockScope) {
if (thread.blocks && thread.blocks.length > 0) {
thread.blocks.pop();
}
}
// --- Done.
return { toUnshift, clearToLabel };
}
// --- Process a variable declaration
export function processDeclarations(
block: BlockScope,
evalContext: BindingTreeEvaluationContext,
thread: LogicalThread,
declarations: VarDeclaration[],
addConst = false,
useValue = false,
baseValue = undefined,
): void {
for (let i = 0; i < declarations.length; i++) {
let value: any;
const decl = declarations[i];
if (useValue) {
value = baseValue;
} else if (decl.expr) {
//TODO illesg here, functionInvocation for global function (e.g. window.confirm... )
value = evalBinding(decl.expr, evalContext, thread);
}
visitDeclaration(block, decl, value, addConst);
}
// --- Visit a variable
function visitDeclaration(
block: BlockScope,
decl: VarDeclaration,
baseValue: any,
addConst: boolean,
): void {
// --- Process each declaration
if (decl.id) {
visitIdDeclaration(block, decl.id, baseValue, addConst);
} else if (decl.aDestr) {
visitArrayDestruct(block, decl.aDestr, baseValue, addConst);
} else if (decl.oDestr) {
visitObjectDestruct(block, decl.oDestr, baseValue, addConst);
} else {
throw new Error("Unknown declaration specifier");
}
}
// --- Visits a single ID declaration
function visitIdDeclaration(
block: BlockScope,
id: string,
baseValue: any,
addConst: boolean,
): void {
if (block.vars[id]) {
throw new Error(`Variable ${id} is already declared in the current scope.`);
}
block.vars[id] = baseValue;
if (addConst) {
block.constVars ??= new Set<string>();
block.constVars.add(id);
}
}
// --- Visits an array destructure declaration
function visitArrayDestruct(
block: BlockScope,
arrayD: ArrayDestructure[],
baseValue: any,
addConst: boolean,
): void {
for (let i = 0; i < arrayD.length; i++) {
const arrDecl = arrayD[i];
const value = baseValue?.[i];
if (arrDecl.id) {
visitIdDeclaration(block, arrDecl.id, value, addConst);
} else if (arrDecl.aDestr) {
visitArrayDestruct(block, arrDecl.aDestr, value, addConst);
} else if (arrDecl.oDestr) {
visitObjectDestruct(block, arrDecl.oDestr, value, addConst);
}
}
}
// --- Visits an object destructure declaration
function visitObjectDestruct(
block: BlockScope,
objectD: ObjectDestructure[],
baseValue: any,
addConst: boolean,
): void {
for (let i = 0; i < objectD.length; i++) {
const objDecl = objectD[i];
const value = baseValue?.[objDecl.id!];
if (objDecl.aDestr) {
visitArrayDestruct(block, objDecl.aDestr, value, addConst);
} else if (objDecl.oDestr) {
visitObjectDestruct(block, objDecl.oDestr, value, addConst);
} else {
visitIdDeclaration(block, objDecl.alias ?? objDecl.id!, value, addConst);
}
}
}
}
```