This is page 112 of 182. Use http://codebase.md/xmlui-org/xmlui/mockApiDef.js?lines=true&page={x} to view the full context. # Directory Structure ``` ├── .changeset │ ├── config.json │ ├── cool-queens-look.md │ ├── hot-berries-argue.md │ ├── twelve-guests-care.md │ └── wise-towns-dance.md ├── .eslintrc.cjs ├── .github │ ├── build-checklist.png │ ├── ISSUE_TEMPLATE │ │ ├── bug_report.md │ │ └── feature_request.md │ └── workflows │ ├── deploy-blog.yml │ ├── deploy-docs-optimized.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 │ │ │ │ ├── blog-page-component.png │ │ │ │ ├── blog-scrabble.png │ │ │ │ ├── integrated-blog-search.png │ │ │ │ └── lorem-ipsum.png │ │ │ ├── lorem-ipsum.md │ │ │ ├── newest-post.md │ │ │ ├── older-post.md │ │ │ └── welcome-to-the-xmlui-blog.md │ │ ├── mockServiceWorker.js │ │ ├── netlify.toml │ │ ├── resources │ │ │ ├── favicon.ico │ │ │ ├── files │ │ │ │ └── for-download │ │ │ │ └── xmlui │ │ │ │ └── xmlui-standalone.umd.js │ │ │ ├── github.svg │ │ │ ├── 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 │ │ │ ├── Debug.xmlui │ │ │ └── PageNotFound.xmlui │ │ ├── config.ts │ │ ├── Main.xmlui │ │ ├── Main.xmlui.xs │ │ └── themes │ │ ├── docs-theme.ts │ │ ├── earthtone.ts │ │ ├── xmlui-gray-on-default.ts │ │ ├── xmlui-green-on-default.ts │ │ └── xmlui-orange-on-default.ts │ └── tsconfig.json ├── CONTRIBUTING.md ├── docs │ ├── .gitignore │ ├── CHANGELOG.md │ ├── ComponentRefLinks.txt │ ├── content │ │ ├── _meta.json │ │ ├── components │ │ │ ├── _meta.json │ │ │ ├── _overview.md │ │ │ ├── APICall.md │ │ │ ├── App.md │ │ │ ├── AppHeader.md │ │ │ ├── AppState.md │ │ │ ├── AutoComplete.md │ │ │ ├── Avatar.md │ │ │ ├── Backdrop.md │ │ │ ├── Badge.md │ │ │ ├── BarChart.md │ │ │ ├── Bookmark.md │ │ │ ├── Breakout.md │ │ │ ├── Button.md │ │ │ ├── Card.md │ │ │ ├── Carousel.md │ │ │ ├── ChangeListener.md │ │ │ ├── Checkbox.md │ │ │ ├── CHStack.md │ │ │ ├── ColorPicker.md │ │ │ ├── Column.md │ │ │ ├── ContentSeparator.md │ │ │ ├── CVStack.md │ │ │ ├── DataSource.md │ │ │ ├── DateInput.md │ │ │ ├── DatePicker.md │ │ │ ├── DonutChart.md │ │ │ ├── DropdownMenu.md │ │ │ ├── EmojiSelector.md │ │ │ ├── ExpandableItem.md │ │ │ ├── FileInput.md │ │ │ ├── FileUploadDropZone.md │ │ │ ├── FlowLayout.md │ │ │ ├── Footer.md │ │ │ ├── Form.md │ │ │ ├── FormItem.md │ │ │ ├── FormSection.md │ │ │ ├── Fragment.md │ │ │ ├── H1.md │ │ │ ├── H2.md │ │ │ ├── H3.md │ │ │ ├── H4.md │ │ │ ├── H5.md │ │ │ ├── H6.md │ │ │ ├── Heading.md │ │ │ ├── HSplitter.md │ │ │ ├── HStack.md │ │ │ ├── Icon.md │ │ │ ├── IFrame.md │ │ │ ├── Image.md │ │ │ ├── Items.md │ │ │ ├── LabelList.md │ │ │ ├── Legend.md │ │ │ ├── LineChart.md │ │ │ ├── Link.md │ │ │ ├── List.md │ │ │ ├── Logo.md │ │ │ ├── Markdown.md │ │ │ ├── MenuItem.md │ │ │ ├── MenuSeparator.md │ │ │ ├── ModalDialog.md │ │ │ ├── NavGroup.md │ │ │ ├── NavLink.md │ │ │ ├── NavPanel.md │ │ │ ├── NoResult.md │ │ │ ├── NumberBox.md │ │ │ ├── Option.md │ │ │ ├── Page.md │ │ │ ├── PageMetaTitle.md │ │ │ ├── Pages.md │ │ │ ├── Pagination.md │ │ │ ├── PasswordInput.md │ │ │ ├── PieChart.md │ │ │ ├── ProgressBar.md │ │ │ ├── Queue.md │ │ │ ├── RadioGroup.md │ │ │ ├── RealTimeAdapter.md │ │ │ ├── Redirect.md │ │ │ ├── Select.md │ │ │ ├── Slider.md │ │ │ ├── Slot.md │ │ │ ├── SpaceFiller.md │ │ │ ├── Spinner.md │ │ │ ├── Splitter.md │ │ │ ├── Stack.md │ │ │ ├── StickyBox.md │ │ │ ├── SubMenuItem.md │ │ │ ├── Switch.md │ │ │ ├── TabItem.md │ │ │ ├── Table.md │ │ │ ├── TableOfContents.md │ │ │ ├── Tabs.md │ │ │ ├── Text.md │ │ │ ├── TextArea.md │ │ │ ├── TextBox.md │ │ │ ├── Theme.md │ │ │ ├── TimeInput.md │ │ │ ├── Timer.md │ │ │ ├── ToneChangerButton.md │ │ │ ├── ToneSwitch.md │ │ │ ├── Tooltip.md │ │ │ ├── Tree.md │ │ │ ├── VSplitter.md │ │ │ ├── VStack.md │ │ │ ├── xmlui-animations │ │ │ │ ├── _meta.json │ │ │ │ ├── _overview.md │ │ │ │ ├── Animation.md │ │ │ │ ├── FadeAnimation.md │ │ │ │ ├── FadeInAnimation.md │ │ │ │ ├── FadeOutAnimation.md │ │ │ │ ├── ScaleAnimation.md │ │ │ │ └── SlideInAnimation.md │ │ │ ├── xmlui-pdf │ │ │ │ ├── _meta.json │ │ │ │ ├── _overview.md │ │ │ │ └── Pdf.md │ │ │ ├── xmlui-spreadsheet │ │ │ │ ├── _meta.json │ │ │ │ ├── _overview.md │ │ │ │ └── Spreadsheet.md │ │ │ └── xmlui-website-blocks │ │ │ ├── _meta.json │ │ │ ├── _overview.md │ │ │ ├── Carousel.md │ │ │ ├── HelloMd.md │ │ │ ├── HeroSection.md │ │ │ └── ScrollToTop.md │ │ └── extensions │ │ ├── _meta.json │ │ ├── xmlui-animations │ │ │ ├── _meta.json │ │ │ ├── _overview.md │ │ │ ├── Animation.md │ │ │ ├── FadeAnimation.md │ │ │ ├── FadeInAnimation.md │ │ │ ├── FadeOutAnimation.md │ │ │ ├── ScaleAnimation.md │ │ │ └── SlideInAnimation.md │ │ └── xmlui-website-blocks │ │ ├── _meta.json │ │ ├── _overview.md │ │ ├── Carousel.md │ │ ├── HelloMd.md │ │ ├── HeroSection.md │ │ └── ScrollToTop.md │ ├── extensions.ts │ ├── index.html │ ├── index.ts │ ├── package.json │ ├── public │ │ ├── feed.rss │ │ ├── mockServiceWorker.js │ │ ├── pages │ │ │ ├── _meta.json │ │ │ ├── app-structure.md │ │ │ ├── build-editor-component.md │ │ │ ├── build-hello-world-component.md │ │ │ ├── components-intro.md │ │ │ ├── context-variables.md │ │ │ ├── forms.md │ │ │ ├── globals.md │ │ │ ├── glossary.md │ │ │ ├── helper-tags.md │ │ │ ├── hosted-deployment.md │ │ │ ├── howto │ │ │ │ ├── assign-a-complex-json-literal-to-a-component-variable.md │ │ │ │ ├── chain-a-refetch.md │ │ │ │ ├── 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 │ ├── 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 │ │ └── tsconfig.json │ ├── 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 │ │ ├── tsconfig.json │ │ └── 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 │ │ └── tsconfig.json │ ├── 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 │ │ └── tsconfig.json │ ├── 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 │ │ └── tsconfig.json │ ├── 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.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.module.scss │ │ │ │ ├── Preview.tsx │ │ │ │ ├── Select.module.scss │ │ │ │ ├── StandalonePlayground.tsx │ │ │ │ ├── StandalonePlaygroundNative.module.scss │ │ │ │ ├── StandalonePlaygroundNative.tsx │ │ │ │ ├── ThemeSwitcher.module.scss │ │ │ │ ├── ThemeSwitcher.tsx │ │ │ │ ├── ToneSwitcher.tsx │ │ │ │ ├── Tooltip.module.scss │ │ │ │ ├── Tooltip.tsx │ │ │ │ └── utils.ts │ │ │ ├── providers │ │ │ │ ├── Toast.module.scss │ │ │ │ └── ToastProvider.tsx │ │ │ ├── state │ │ │ │ └── store.ts │ │ │ ├── themes │ │ │ │ └── theme.ts │ │ │ └── utils │ │ │ └── helpers.ts │ │ └── tsconfig.json │ ├── 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 │ │ └── tsconfig.json │ ├── xmlui-spreadsheet │ │ ├── .gitignore │ │ ├── demo │ │ │ └── Main.xmlui │ │ ├── index.html │ │ ├── index.ts │ │ ├── meta │ │ │ └── componentsMetadata.ts │ │ ├── package.json │ │ ├── src │ │ │ ├── index.tsx │ │ │ ├── Spreadsheet.tsx │ │ │ └── SpreadsheetNative.tsx │ │ └── tsconfig.json │ └── 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.tsx │ │ │ └── HeroSectionNative.tsx │ │ ├── index.tsx │ │ ├── ScrollToTop │ │ │ ├── ScrollToTop.module.scss │ │ │ ├── ScrollToTop.tsx │ │ │ └── ScrollToTopNative.tsx │ │ └── vite-env.d.ts │ └── tsconfig.json ├── 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.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 │ ├── containers.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 │ ├── state-management.md │ ├── ud-components.md │ └── xmlui-repo.md ├── package.json ├── playwright.config.ts ├── scripts │ ├── coverage-only.js │ ├── e2e-test-summary.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 │ ├── get-langserver-metadata.mjs │ ├── 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.spec.ts │ │ │ │ ├── LabelList.tsx │ │ │ │ ├── LabelListNative.module.scss │ │ │ │ └── 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 │ │ │ ├── MultiSelectOption.tsx │ │ │ ├── OptionContext.ts │ │ │ ├── Select.md │ │ │ ├── Select.module.scss │ │ │ ├── Select.spec.ts │ │ │ ├── Select.tsx │ │ │ ├── SelectContext.tsx │ │ │ ├── SelectNative.tsx │ │ │ ├── SelectOption.tsx │ │ │ └── SimpleSelect.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 │ │ │ ├── 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.mjs │ ├── 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 │ │ │ ├── ModalDialogDriver.ts │ │ │ ├── NumberBoxDriver.ts │ │ │ ├── TextBoxDriver.ts │ │ │ ├── TimeInputDriver.ts │ │ │ ├── TimerDriver.ts │ │ │ └── TreeDriver.ts │ │ ├── fixtures.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.bin.json ├── tsconfig.json ├── tsconfig.node.json ├── vite.config.ts └── vitest.config.ts ``` # Files -------------------------------------------------------------------------------- /xmlui/src/components-core/rendering/Container.tsx: -------------------------------------------------------------------------------- ```typescript 1 | import type { Dispatch, MutableRefObject, ReactNode, RefObject, SetStateAction } from "react"; 2 | import React, { 3 | cloneElement, 4 | forwardRef, 5 | Fragment, 6 | isValidElement, 7 | memo, 8 | useCallback, 9 | useEffect, 10 | useRef, 11 | useTransition, 12 | } from "react"; 13 | import { useLocation, useNavigate } from "@remix-run/react"; 14 | import { cloneDeep, isArray } from "lodash-es"; 15 | import { composeRefs } from "@radix-ui/react-compose-refs"; 16 | import memoizeOne from "memoize-one"; 17 | 18 | import type { 19 | LookupActionOptions, 20 | LookupAsyncFnInner, 21 | LookupSyncFnInner, 22 | } from "../../abstractions/ActionDefs"; 23 | import type { ComponentDef, ParentRenderContext } from "../../abstractions/ComponentDefs"; 24 | import type { ContainerState } from "../../abstractions/ContainerDefs"; 25 | import type { LayoutContext, RenderChildFn } from "../../abstractions/RendererDefs"; 26 | import type { 27 | ArrowExpression, 28 | ArrowExpressionStatement, 29 | Statement, 30 | } from "../script-runner/ScriptingSourceTree"; 31 | import { 32 | T_ARROW_EXPRESSION, 33 | T_ARROW_EXPRESSION_STATEMENT, 34 | } from "../script-runner/ScriptingSourceTree"; 35 | import type { ContainerDispatcher, MemoedVars } from "../abstractions/ComponentRenderer"; 36 | import { ContainerActionKind } from "./containers"; 37 | import { useAppContext } from "../AppContext"; 38 | import { buildProxy } from "../rendering/buildProxy"; 39 | import type { StatePartChangedFn } from "./ContainerWrapper"; 40 | import type { 41 | ComponentCleanupFn, 42 | ContainerWrapperDef, 43 | RegisterComponentApiFnInner, 44 | } from "../rendering/ContainerWrapper"; 45 | import type { BindingTreeEvaluationContext } from "../script-runner/BindingTreeEvaluationContext"; 46 | import { processStatementQueueAsync } from "../script-runner/process-statement-async"; 47 | import { processStatementQueue } from "../script-runner/process-statement-sync"; 48 | import { extractParam, shouldKeep } from "../utils/extractParam"; 49 | import { useIsomorphicLayoutEffect } from "../utils/hooks"; 50 | import { capitalizeFirstLetter, delay, generatedId, useEvent } from "../utils/misc"; 51 | import { parseHandlerCode, prepareHandlerStatements } from "../utils/statementUtils"; 52 | import { renderChild } from "./renderChild"; 53 | import { useTheme } from "../theming/ThemeContext"; 54 | import { LoaderComponent } from "../LoaderComponent"; 55 | import type { AppContextObject } from "../../abstractions/AppContextDefs"; 56 | import { EMPTY_ARRAY } from "../constants"; 57 | import type { ParsedEventValue } from "../../abstractions/scripting/Compilation"; 58 | import { useApiInterceptorContext } from "../interception/useApiInterceptorContext"; 59 | import { mergeProps } from "../utils/mergeProps"; 60 | 61 | type Props = { 62 | node: ContainerWrapperDef; 63 | resolvedKey?: string; 64 | componentState: ContainerState; 65 | dispatch: ContainerDispatcher; 66 | setVersion: Dispatch<SetStateAction<number>>; 67 | version: number; 68 | statePartChanged: StatePartChangedFn; 69 | registerComponentApi: RegisterComponentApiFnInner; 70 | parentRegisterComponentApi: RegisterComponentApiFnInner; 71 | layoutContextRef: MutableRefObject<LayoutContext | undefined>; 72 | memoedVarsRef: MutableRefObject<MemoedVars>; 73 | isImplicit?: boolean; 74 | parentDispatch: ContainerDispatcher; 75 | parentRenderContext?: ParentRenderContext; 76 | uidInfoRef?: RefObject<Record<string, any>>; 77 | children?: ReactNode; 78 | }; 79 | 80 | // React component to display a view container and implement its behavior 81 | export const Container = memo( 82 | forwardRef(function Container( 83 | { 84 | node, 85 | componentState, 86 | dispatch: containerDispatch, 87 | parentDispatch, 88 | resolvedKey, 89 | version, 90 | setVersion, 91 | statePartChanged, 92 | registerComponentApi: containerRegisterComponentApi, 93 | parentRegisterComponentApi, 94 | layoutContextRef, 95 | parentRenderContext, 96 | memoedVarsRef, 97 | isImplicit, 98 | uidInfoRef: parentUidInfoRef, 99 | children, 100 | ...rest 101 | }: Props, 102 | ref, 103 | ) { 104 | const { apiBoundContainer } = node; 105 | const dispatch = isImplicit ? parentDispatch : containerDispatch; 106 | const registerComponentApi = isImplicit 107 | ? parentRegisterComponentApi 108 | : containerRegisterComponentApi; 109 | 110 | const appContext = useAppContext(); 111 | const { getThemeVar } = useTheme(); 112 | const navigate = useNavigate(); 113 | const location = useLocation(); 114 | 115 | const fnsRef = useRef<Record<symbol, any>>({}); 116 | 117 | const stateRef = useRef(componentState); 118 | //generally bad practise to write ref in render (https://react.dev/learn/referencing-values-with-refs#best-practices-for-refs), but: 119 | // this stateRef is only used in runCodeSync/async functions, which are memoized, so it's safe to use it here (as I know: illesg) 120 | // In case we sync up the stateRef with the componentState in the useEffect/useInsertionEffect/useLayoutEffect, the stateRef would lag behind the componentState 121 | 122 | stateRef.current = componentState; 123 | 124 | const parsedStatementsRef = useRef<Record<string, Array<Statement> | null>>({}); 125 | const [_, startTransition] = useTransition(); 126 | const mountedRef = useRef(true); 127 | 128 | // --- This ref holds a map of promises for each statement execution that cause any state change. 129 | const statementPromises = useRef<Map<string, any>>(new Map()); 130 | 131 | // --- Ensure that re-rendering because of version change resolves all pending statement promises. 132 | useIsomorphicLayoutEffect(() => { 133 | for (const resolve of statementPromises.current.values()) { 134 | resolve(); 135 | } 136 | }, [version]); 137 | 138 | // --- Ensure that component disposal resolves all pending statement promises. 139 | useEffect(() => { 140 | mountedRef.current = true; 141 | const leftPromises = statementPromises.current; 142 | return () => { 143 | mountedRef.current = false; 144 | for (const resolve of leftPromises.values()) { 145 | resolve(); 146 | } 147 | }; 148 | }, []); 149 | 150 | const { apiInstance } = useApiInterceptorContext(); 151 | 152 | const runCodeAsync = useEvent( 153 | async ( 154 | source: string | ParsedEventValue | ArrowExpression, 155 | componentUid: symbol, 156 | options: LookupActionOptions | undefined, 157 | ...eventArgs: any[] 158 | ) => { 159 | // --- Check if the event handler can sign its lifecycle state 160 | const canSignEventLifecycle = () => 161 | componentUid.description !== undefined && options?.eventName !== undefined; 162 | 163 | let changes: Array<any> = []; 164 | const getComponentStateClone = () => { 165 | changes.length = 0; 166 | const poj = cloneDeep({ ...stateRef.current, ...(options?.context || {}) }); 167 | poj["$this"] = stateRef.current[componentUid]; 168 | return buildProxy(poj, (changeInfo) => { 169 | const idRoot = (changeInfo.pathArray as string[])?.[0]; 170 | if (idRoot?.startsWith("$")) { 171 | throw new Error("Cannot update a read-only variable"); 172 | } 173 | changes.push(changeInfo); 174 | }); 175 | }; 176 | const evalAppContext = { 177 | ...appContext, 178 | getThemeVar, 179 | }; 180 | const evalContext: BindingTreeEvaluationContext = { 181 | appContext: evalAppContext, 182 | eventArgs, 183 | localContext: getComponentStateClone(), 184 | implicitContextGetter: () => { 185 | return { 186 | uid: componentUid, 187 | state: stateRef.current, 188 | getCurrentState: () => stateRef.current, 189 | dispatch, 190 | appContext: evalAppContext, 191 | apiInstance, 192 | navigate, 193 | location, 194 | lookupAction: (action, uid, actionOptions = {}) => { 195 | return lookupAction(action, uid, { 196 | ...actionOptions, 197 | ephemeral: true, 198 | }); 199 | }, 200 | }; 201 | }, 202 | options: { 203 | defaultToOptionalMemberAccess: 204 | typeof appContext.appGlobals?.defaultToOptionalMemberAccess === "boolean" 205 | ? appContext.appGlobals.defaultToOptionalMemberAccess 206 | : true, 207 | }, 208 | }; 209 | 210 | try { 211 | // --- Prepare the event handler to an arrow expression statement 212 | let statements: Statement[]; 213 | if (typeof source === "string") { 214 | if (!parsedStatementsRef.current[source]) { 215 | parsedStatementsRef.current[source] = prepareHandlerStatements( 216 | parseHandlerCode(source), 217 | evalContext, 218 | ); 219 | } 220 | statements = parsedStatementsRef.current[source]; 221 | } else if (isParsedEventValue(source)) { 222 | const parseId = source.parseId.toString(); 223 | if (!parsedStatementsRef.current[parseId]) { 224 | parsedStatementsRef.current[parseId] = prepareHandlerStatements( 225 | source.statements, 226 | evalContext, 227 | ); 228 | } 229 | statements = parsedStatementsRef.current[parseId]; 230 | } else { 231 | statements = [ 232 | { 233 | type: T_ARROW_EXPRESSION_STATEMENT, 234 | 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) 235 | } as ArrowExpressionStatement, 236 | ]; 237 | } 238 | 239 | if (!statements?.length) { 240 | return; 241 | } 242 | 243 | if (canSignEventLifecycle()) { 244 | // --- Sign the event handler has been started 245 | dispatch({ 246 | type: ContainerActionKind.EVENT_HANDLER_STARTED, 247 | payload: { 248 | uid: componentUid, 249 | eventName: options.eventName, 250 | }, 251 | }); 252 | } 253 | let mainThreadBlockingRuns = 0; 254 | evalContext.onStatementCompleted = async (evalContext) => { 255 | if (changes.length) { 256 | mainThreadBlockingRuns = 0; 257 | changes.forEach((change) => { 258 | statePartChanged( 259 | change.pathArray, 260 | cloneDeep(change.newValue), 261 | change.target, 262 | change.action, 263 | ); 264 | }); 265 | let resolve = null; 266 | const stateUpdatedPromise = new Promise((res) => { 267 | resolve = () => { 268 | res(null); 269 | }; 270 | }); 271 | const key = generatedId(); 272 | statementPromises.current.set(key, resolve); 273 | // We use this to tell react that this update is not high-priority. 274 | // If we don't put it to a transition, the whole app would be blocked if we run a long, 275 | // update intensive queue (e.g. an infinite loop which 276 | // increments a counter, see playground example learning/01_Experiments/01_Event_Framework/app ). 277 | // Before this solution, we used a setTimeout(..., 0); hack, but some browsers (chrome especially) 278 | // do some funky stuff with the background tabs (e.g. all the setTimeouts are 279 | // maximized to run in 1 time / minute, doesn't matter if it's timeout is 0) 280 | // As of 2023. June 20, this solution works with backgrounded tabs, too. 281 | startTransition(() => { 282 | setVersion((prev) => prev + 1); 283 | }); 284 | 285 | //TODO this could be a problem - if this container gets unmounted, we still have to wait for the update, 286 | // but in that case this update probably happened in the parent (e.g. a button's event handler removes the whole container 287 | // where the button lives, but it still has some statements to run). 288 | // with this solution the statement execution doesn't stop, and we fallback waiting with a setTimeout(0) 289 | if (mountedRef.current) { 290 | await stateUpdatedPromise; 291 | } else { 292 | await delay(0); 293 | } 294 | statementPromises.current.delete(key); 295 | changes = []; 296 | } else { 297 | //in this else branch normally we block the main thread (we don't wait for any state promise to be resolved), 298 | // so in a long-running (typically infinite loop) situation, where there aren't any changes in the state 299 | // we block the main thread indefinitely... this 'mainThreadBlockingRuns' var solution makes sure that 300 | // we pause in every 100 runs, and let the main thread breath a bit, so it's not frozen for the whole time 301 | // (we clear that counter above, too, where we use a startTransition call to de-prioritize this work) 302 | mainThreadBlockingRuns++; 303 | if (mainThreadBlockingRuns > 100) { 304 | mainThreadBlockingRuns = 0; 305 | await delay(0); 306 | } 307 | } 308 | evalContext.localContext = getComponentStateClone(); 309 | }; 310 | 311 | await processStatementQueueAsync(statements, evalContext); 312 | 313 | if (canSignEventLifecycle()) { 314 | // --- Sign the event handler has successfully completed 315 | dispatch({ 316 | type: ContainerActionKind.EVENT_HANDLER_COMPLETED, 317 | payload: { 318 | uid: componentUid, 319 | eventName: options.eventName, 320 | }, 321 | }); 322 | } 323 | 324 | if (evalContext.mainThread?.blocks?.length) { 325 | return evalContext.mainThread.blocks[evalContext.mainThread.blocks.length - 1] 326 | .returnValue; 327 | } 328 | } catch (e) { 329 | //if we pass down an event handler to a component, we should sign the error once, not in every step of the component chain 330 | // (we use it in the compoundComponent, resolving it's event handlers) 331 | if (options?.signError !== false) { 332 | appContext.signError(e as Error); 333 | } 334 | if (canSignEventLifecycle()) { 335 | dispatch({ 336 | type: ContainerActionKind.EVENT_HANDLER_ERROR, 337 | payload: { 338 | uid: componentUid, 339 | eventName: options.eventName, 340 | error: e, 341 | }, 342 | }); 343 | } 344 | throw e; 345 | } 346 | }, 347 | ); 348 | 349 | const runCodeSync = useCallback( 350 | (arrowExpression: ArrowExpression, ...eventArgs: any[]) => { 351 | const evalContext: BindingTreeEvaluationContext = { 352 | localContext: cloneDeep(stateRef.current), 353 | appContext, 354 | eventArgs, 355 | }; 356 | try { 357 | const arrowStmt = { 358 | type: T_ARROW_EXPRESSION_STATEMENT, 359 | expr: arrowExpression, 360 | } as ArrowExpressionStatement; 361 | 362 | processStatementQueue([arrowStmt], evalContext); 363 | 364 | if (evalContext.mainThread?.blocks?.length) { 365 | return evalContext.mainThread.blocks[evalContext.mainThread.blocks.length - 1] 366 | .returnValue; 367 | } 368 | } catch (e) { 369 | console.error(e); 370 | throw e; 371 | } 372 | }, 373 | [appContext], 374 | ); 375 | 376 | const getOrCreateEventHandlerFn = useEvent( 377 | ( 378 | src: string | ParsedEventValue | ArrowExpression, 379 | uid: symbol, 380 | options?: LookupActionOptions, 381 | ) => { 382 | if (Array.isArray(src)) { 383 | throw new Error("Multiple event handlers are not supported"); 384 | } 385 | 386 | let fnCacheKey: string; 387 | let handler: (...eventArgs: any[]) => Promise<any>; 388 | if (typeof src === "string") { 389 | // --- We have a string event handler 390 | fnCacheKey = `${options?.eventName};${src}`; 391 | handler = (...eventArgs: any[]) => { 392 | return runCodeAsync(src, uid, options, ...cloneDeep(eventArgs)); 393 | }; 394 | } else if (isParsedEventValue(src)) { 395 | // --- We have the syntax tree to execute, no need to cache 396 | fnCacheKey = `${options?.eventName};${src.parseId}`; 397 | handler = (...eventArgs: any[]) => { 398 | return runCodeAsync(src, uid, options, ...cloneDeep(eventArgs)); 399 | }; 400 | } else if (isArrowExpression(src)) { 401 | // --- We have an arrow expression to execute 402 | fnCacheKey = `${options?.eventName};${src.statement.nodeId}`; 403 | handler = (...eventArgs: any[]) => { 404 | return runCodeAsync(src, uid, options, ...cloneDeep(eventArgs)); 405 | }; 406 | } else if ((src as any).type) { 407 | // --- We have an arrow expression to execute 408 | fnCacheKey = `${options?.eventName};${JSON.stringify(src)}`; 409 | handler = (...eventArgs: any[]) => { 410 | return runCodeAsync(src, uid, options, ...cloneDeep(eventArgs)); 411 | }; 412 | } else { 413 | // --- We have an unknown event handler 414 | throw new Error("Invalid event handler"); 415 | } 416 | 417 | //if we have a context or ephemeral event handler, we don't cache it (otherwise we would have stale reference for the context) 418 | if (options?.ephemeral || options?.context) { 419 | return handler; 420 | } 421 | if (!fnsRef.current[uid]?.[fnCacheKey]) { 422 | fnsRef.current[uid] = fnsRef.current[uid] || {}; 423 | fnsRef.current[uid][fnCacheKey] = handler; 424 | } 425 | return fnsRef.current[uid][fnCacheKey]; 426 | }, 427 | ); 428 | 429 | const getOrCreateSyncCallbackFn = useCallback( 430 | (arrowExpression: ArrowExpression, uid: symbol) => { 431 | const fnCacheKey = `sync-callback-${arrowExpression.nodeId}`; 432 | if (!fnsRef.current[uid]?.[fnCacheKey]) { 433 | fnsRef.current[uid] = fnsRef.current[uid] || {}; 434 | fnsRef.current[uid][fnCacheKey] = memoizeOne((arrowExpression) => { 435 | return (...eventArgs: any[]) => { 436 | return runCodeSync(arrowExpression, ...eventArgs); 437 | }; 438 | }); 439 | } 440 | return fnsRef.current[uid][fnCacheKey](arrowExpression); 441 | }, 442 | [runCodeSync], 443 | ); 444 | 445 | const lookupSyncCallback: LookupSyncFnInner = useCallback( 446 | (action, uid) => { 447 | if (!action) { 448 | return undefined; 449 | } 450 | 451 | if (typeof action === "function") { 452 | return action; 453 | } 454 | 455 | // const resolvedAction = extractParam(componentState, action, appContext, true); 456 | if (!action) { 457 | return undefined; 458 | } 459 | 460 | if (typeof action === "function") { 461 | return action; 462 | } 463 | 464 | if (!(action as any)._ARROW_EXPR_) { 465 | throw new Error("Only arrow expression allowed in sync callback"); 466 | } 467 | return getOrCreateSyncCallbackFn(action, uid); 468 | }, 469 | [getOrCreateSyncCallbackFn], 470 | ); 471 | 472 | const lookupAction: LookupAsyncFnInner = useCallback( 473 | ( 474 | action: string | undefined | ArrowExpression, 475 | uid: symbol, 476 | options?: LookupActionOptions, 477 | ) => { 478 | let safeAction = action; 479 | if (!action && uid.description && options?.eventName) { 480 | const handlerFnName = `${uid.description}_on${capitalizeFirstLetter(options?.eventName)}`; 481 | if (componentState[handlerFnName] && componentState[handlerFnName]._ARROW_EXPR_) { 482 | safeAction = componentState[handlerFnName] as ArrowExpression; 483 | } 484 | } 485 | if (!safeAction) { 486 | return undefined; 487 | } 488 | if (typeof safeAction === "function") { 489 | return safeAction; 490 | } 491 | return getOrCreateEventHandlerFn(safeAction, uid, options); 492 | }, 493 | [componentState, getOrCreateEventHandlerFn], 494 | ); 495 | 496 | const isApiRegisteredInnerRef = useRef(false); 497 | useEffect(() => { 498 | if (!node.api) { 499 | return; 500 | } 501 | if (!node.containerUid) { 502 | return; 503 | } 504 | if (isApiRegisteredInnerRef.current) { 505 | return; 506 | } 507 | isApiRegisteredInnerRef.current = true; 508 | const api: Record<string, any> = {}; 509 | const self = Symbol("$self"); 510 | Object.entries(node.api).forEach(([key, value]) => { 511 | api[key] = lookupAction(value as string, self); 512 | }); 513 | if (!isImplicit) { 514 | registerComponentApi(self, api); //we register the api as $self for the compound components, 515 | } 516 | parentRegisterComponentApi(node.containerUid, api); // and register it for the parent component instance 517 | }, [ 518 | lookupAction, 519 | node.api, 520 | node.containerUid, 521 | node.uid, 522 | isImplicit, 523 | parentRegisterComponentApi, 524 | registerComponentApi, 525 | ]); 526 | 527 | const cleanup = useEvent((uid) => { 528 | // console.log("CLEANUP CALLED FOR", node); 529 | //TODO cleanup registered component api for that uid 530 | //TODO cleanup state for that uid 531 | delete fnsRef.current[uid]; 532 | }); 533 | 534 | // --- The container wraps the `renderChild` function to provide that to the child components 535 | const stableRenderChild: RenderChildFn = useCallback( 536 | (childNode, lc, pRenderContext, uidInfoRef, ref, rest) => { 537 | // TODO: Check if this is a valid use case 538 | if (typeof childNode === "string") { 539 | throw Error("should be resolved for now"); 540 | } 541 | 542 | // --- Make children an array if it's not 543 | const children = isArray(childNode) ? childNode : [childNode]; 544 | 545 | if (!children || !children.length) { 546 | // --- No child, nothing to render 547 | return null; 548 | } 549 | 550 | // --- If there are multiple children, we need to add a `key` to each of them 551 | const wrapWithFragment = children.length > 1; 552 | 553 | // --- Render each child 554 | const renderedChildren = children.map((child, childIndex) => { 555 | if (!child) { 556 | // --- No child, nothing to render: Should not happen 557 | return undefined; 558 | } 559 | 560 | // --- Invoke the jolly-joker `renderChild` function to render the child. Note that 561 | // --- in the context, we pass the `stableRenderChild` function, so the child can 562 | // --- render its children recursively. 563 | const renderedChild = renderChild({ 564 | node: child, 565 | state: componentState, 566 | dispatch, 567 | appContext, 568 | lookupAction, 569 | lookupSyncCallback, 570 | registerComponentApi, 571 | renderChild: stableRenderChild, 572 | statePartChanged: statePartChanged, 573 | layoutContext: lc, 574 | parentRenderContext: pRenderContext, 575 | memoedVarsRef, 576 | cleanup, 577 | uidInfoRef, 578 | }); 579 | 580 | if (renderedChild === undefined) { 581 | // --- No displayable child, nothing to render 582 | return undefined; 583 | } 584 | 585 | // --- Let's process the rendered child 586 | let rendered = renderedChild; 587 | const key = `${childIndex}_${child.uid}`; 588 | 589 | if (wrapWithFragment) { 590 | // --- Add the `key` attribute to the child 591 | if (React.isValidElement(renderedChild)) { 592 | // --- React can display this element 593 | rendered = React.cloneElement(renderedChild, { key }); 594 | } else { 595 | // --- A simple text node (or alike). We need to wrap it in a `Fragment` 596 | rendered = <Fragment key={key}>{renderedChild}</Fragment>; 597 | } 598 | } 599 | 600 | // --- Done. 601 | return rendered; 602 | }); 603 | 604 | // --- At this point we have a React node for each child 605 | if (renderedChildren.length === 1) { 606 | // --- If we have a single (and valid React element) child, we compose its 607 | // --- `ref` with the parent's `ref`. This allows the parent to access the child's 608 | // --- DOM node. Otherwise, we use the child as is. 609 | return ref && renderedChildren[0] && isValidElement(renderedChildren[0]) 610 | ? React.cloneElement(renderedChildren[0], { 611 | ref: composeRefs(ref, (renderedChildren[0] as any).ref), 612 | ...mergeProps(renderedChildren[0].props, rest) 613 | } as any) 614 | : renderedChildren[0]; 615 | } 616 | 617 | // --- Done. 618 | return renderedChildren; 619 | }, 620 | [ 621 | componentState, 622 | dispatch, 623 | appContext, 624 | lookupAction, 625 | lookupSyncCallback, 626 | registerComponentApi, 627 | statePartChanged, 628 | memoedVarsRef, 629 | cleanup, 630 | ], 631 | ); 632 | 633 | // --- Log the component state if you need it for debugging 634 | if ((node.props as any)?.debug) { 635 | console.log(`Container: ${resolvedKey}`, { 636 | componentState, 637 | node, 638 | }); 639 | } 640 | 641 | // --- Use this object to store information about already rendered UIDs. 642 | // --- We do not allow any action, loader, or transform to use the same UID; however (as of now) children 643 | // --- may use the same UID. 644 | const uidInfo: Record<string, string> = {}; 645 | 646 | const thisUidInfoRef = useRef({}); 647 | const uidInfoRef = node.uses === undefined ? parentUidInfoRef : thisUidInfoRef; 648 | 649 | const renderedChildren = stableRenderChild( 650 | node.children, 651 | layoutContextRef?.current, 652 | parentRenderContext, 653 | uidInfoRef, 654 | ref, 655 | rest 656 | ); 657 | 658 | const renderedLoaders = renderLoaders({ 659 | uidInfo, 660 | uidInfoRef, 661 | loaders: node.loaders, 662 | componentState, 663 | memoedVarsRef, 664 | //if it's an api bound container, we always use this container, otherwise use the parent if it's an implicit one 665 | dispatch: apiBoundContainer ? containerDispatch : dispatch, 666 | registerComponentApi: apiBoundContainer 667 | ? containerRegisterComponentApi 668 | : registerComponentApi, 669 | appContext, 670 | lookupAction, 671 | lookupSyncCallback, 672 | cleanup, 673 | }); 674 | //TODO illesg 675 | const containerContent = ( 676 | <> 677 | {renderedLoaders} 678 | {!!children && isValidElement(renderedChildren) 679 | ? cloneElement(renderedChildren, null, children) 680 | : renderedChildren} 681 | </> 682 | ); 683 | return ( 684 | <Fragment 685 | key={ 686 | node.uid 687 | ? `${resolvedKey}>${extractParam(componentState, node.uid, appContext, true)}` 688 | : undefined 689 | } 690 | > 691 | {containerContent} 692 | </Fragment> 693 | ); 694 | }), 695 | ); 696 | 697 | interface LoaderRenderContext { 698 | uidInfo: Record<string, string>; 699 | uidInfoRef: RefObject<Record<string, any>>; 700 | loaders?: ComponentDef[]; 701 | componentState: ContainerState; 702 | dispatch: ContainerDispatcher; 703 | appContext: AppContextObject; 704 | registerComponentApi: RegisterComponentApiFnInner; 705 | lookupAction: LookupAsyncFnInner; 706 | lookupSyncCallback: LookupSyncFnInner; 707 | cleanup: ComponentCleanupFn; 708 | memoedVarsRef: MutableRefObject<MemoedVars>; 709 | } 710 | 711 | function renderLoaders({ 712 | uidInfo, 713 | uidInfoRef, 714 | loaders = EMPTY_ARRAY, 715 | componentState, 716 | dispatch, 717 | appContext, 718 | registerComponentApi, 719 | lookupAction, 720 | lookupSyncCallback, 721 | cleanup, 722 | memoedVarsRef, 723 | }: LoaderRenderContext) { 724 | return loaders.map((loader: ComponentDef) => { 725 | // --- Check for the uniqueness of UIDs 726 | if (loader?.uid) { 727 | if (uidInfo[loader.uid]) { 728 | // --- We have a duplicated ID (another loader) 729 | throw new Error( 730 | `Another ${uidInfo[loader.uid]} definition in this container already uses the uid '${loader.uid}'`, 731 | ); 732 | } 733 | uidInfo[loader.uid] = "loader"; 734 | uidInfoRef.current[loader.uid] = { 735 | type: "loader", 736 | value: "loaderValue", 737 | uid: loader.uid, 738 | }; 739 | } 740 | 741 | // --- Render the current loader 742 | const renderedLoader = renderLoader({ 743 | loader, 744 | componentState, 745 | dispatch, 746 | appContext, 747 | registerComponentApi, 748 | lookupAction, 749 | lookupSyncCallback, 750 | memoedVarsRef, 751 | cleanup, 752 | }); 753 | 754 | // --- Skip loaders with rendering errors 755 | if (renderedLoader === undefined) { 756 | return undefined; 757 | } 758 | 759 | // --- Take care to use a key property for the loader 760 | return <Fragment key={loader.uid}>{renderedLoader}</Fragment>; 761 | }); 762 | 763 | function renderLoader({ 764 | loader, 765 | componentState, 766 | dispatch, 767 | appContext, 768 | registerComponentApi, 769 | lookupAction, 770 | lookupSyncCallback, 771 | cleanup, 772 | memoedVarsRef, 773 | }: { 774 | loader: ComponentDef; 775 | componentState: ContainerState; 776 | dispatch: ContainerDispatcher; 777 | appContext: AppContextObject; 778 | registerComponentApi: RegisterComponentApiFnInner; 779 | lookupAction: LookupAsyncFnInner; 780 | lookupSyncCallback: LookupSyncFnInner; 781 | cleanup: ComponentCleanupFn; 782 | memoedVarsRef: MutableRefObject<MemoedVars>; 783 | }) { 784 | // --- For the sake of avoiding further issues 785 | if (!loader) { 786 | return null; 787 | } 788 | 789 | // --- Evaluate "when" to decide if the loader should be rendered 790 | // --- Render only visible components 791 | if (!shouldKeep(loader.when, componentState, appContext)) { 792 | return null; 793 | } 794 | 795 | // --- Use the loader type's renderer function 796 | return ( 797 | <LoaderComponent 798 | onUnmount={cleanup} 799 | node={loader} 800 | state={componentState} 801 | dispatch={dispatch} 802 | registerComponentApi={registerComponentApi} 803 | lookupAction={lookupAction} 804 | lookupSyncCallback={lookupSyncCallback} 805 | memoedVarsRef={memoedVarsRef} 806 | appContext={appContext} 807 | /> 808 | ); 809 | } 810 | } 811 | 812 | function isParsedEventValue( 813 | value: string | ParsedEventValue | ArrowExpression, 814 | ): value is ParsedEventValue { 815 | return (value as ParsedEventValue).__PARSED === true; 816 | } 817 | 818 | function isArrowExpression( 819 | value: string | ParsedEventValue | ArrowExpression, 820 | ): value is ArrowExpression { 821 | return (value as ArrowExpression).type === T_ARROW_EXPRESSION; 822 | } 823 | ``` -------------------------------------------------------------------------------- /xmlui/tests/components-core/scripts-runner/eval-tree.test.ts: -------------------------------------------------------------------------------- ```typescript 1 | import { describe, expect, it, assert } from "vitest"; 2 | 3 | import { Parser } from "../../../src/parsers/scripting/Parser"; 4 | import { 5 | evalBinding, 6 | evalBindingExpression, 7 | } from "../../../src/components-core/script-runner/eval-tree-sync"; 8 | import { createEvalContext } from "./test-helpers"; 9 | import { evalBindingAsync } from "../../../src/components-core/script-runner/eval-tree-async"; 10 | 11 | describe("Evaluate binding expression tree (exp)", () => { 12 | const literalCases = [ 13 | { src: "undefined", exp: undefined }, 14 | { src: "null", exp: null }, 15 | { src: "Infinity", exp: Infinity }, 16 | { src: "false", exp: false }, 17 | { src: "true", exp: true }, 18 | { src: "123", exp: 123 }, 19 | { src: "123.25", exp: 123.25 }, 20 | { src: "123.25e11", exp: 123.25e11 }, 21 | { src: "0b11_11", exp: 0x0f }, 22 | { src: "0x12_ae", exp: 0x12ae }, 23 | { 24 | src: "123456789123456789123456789", 25 | exp: BigInt("123456789123456789123456789"), 26 | }, 27 | { src: '"Hello"', exp: "Hello" }, 28 | 29 | { src: "Math", exp: Math }, 30 | { src: "Math", con: { Math: 123 }, exp: 123 }, 31 | { src: "::Math", exp: Math }, 32 | { src: "::Math", con: { Math: 123 }, exp: Math }, 33 | ]; 34 | literalCases.forEach((c) => { 35 | it(`Eval literal: ${c.src}`, () => { 36 | // --- Arrange 37 | const wParser = new Parser(c.src); 38 | 39 | // --- Act/Assert 40 | const expr = wParser.parseExpr(); 41 | expect(expr).not.equal(null); 42 | if (!expr) return; 43 | const context = createEvalContext({ localContext: (c as any).con ?? {} }); 44 | const value = evalBinding(expr, context); 45 | expect(value).equal(c.exp); 46 | }); 47 | }); 48 | 49 | it(`Eval literal: NaN`, () => { 50 | // --- Arrange 51 | const wParser = new Parser("NaN"); 52 | 53 | // --- Act/Assert 54 | const expr = wParser.parseExpr(); 55 | expect(expr).not.equal(null); 56 | if (!expr) return; 57 | const context = createEvalContext({ localContext: {} }); 58 | const value = evalBinding(expr, context); 59 | expect(isNaN(value)).equal(true); 60 | }); 61 | 62 | const identifierCases = [ 63 | { src: "alma", con: { alma: undefined }, exp: undefined }, 64 | { src: "alma", con: { alma: 112 }, exp: 112 }, 65 | { src: "banana", con: { alma: 112, banana: 223 }, exp: 223 }, 66 | { src: "alma", con: { alma: "abc", banana: 223 }, exp: "abc" }, 67 | { src: "alma", con: { alma: true, banana: 223 }, exp: true }, 68 | { src: "alma", con: { alma: false, banana: 223 }, exp: false }, 69 | { src: "alma", con: { alma: 123.5, banana: 223 }, exp: 123.5 }, 70 | ]; 71 | identifierCases.forEach((c) => { 72 | it(`Eval identifier: ${c.src}/${JSON.stringify(c.con)}`, () => { 73 | // --- Arrange 74 | const wParser = new Parser(c.src); 75 | 76 | // --- Act/Assert 77 | const expr = wParser.parseExpr(); 78 | expect(expr).not.equal(null); 79 | if (!expr) return; 80 | const context = createEvalContext({ localContext: c.con }); 81 | const value = evalBinding(expr, context); 82 | expect(value).equal(c.exp); 83 | }); 84 | }); 85 | 86 | const memberAccessCases = [ 87 | { src: "alma.b", con: { alma: { b: 123 } }, exp: 123 }, 88 | { src: "alma.b.c", con: { alma: { b: { c: 123, d: 234 } } }, exp: 123 }, 89 | { src: "alma.b.d", con: { alma: { b: { c: 123, d: 234 } } }, exp: 234 }, 90 | { src: "alma.length", con: { alma: "banana" }, exp: 6 }, 91 | { 92 | src: "alma.b.d.length", 93 | con: { alma: { b: { c: 123, d: "hello" } } }, 94 | exp: 5, 95 | }, 96 | { src: "Math.sin", con: { alma: "banana" }, exp: Math.sin }, 97 | ]; 98 | memberAccessCases.forEach((c) => { 99 | it(`Eval member access: ${c.src}/${JSON.stringify(c.con)}`, () => { 100 | // --- Arrange 101 | const wParser = new Parser(c.src); 102 | 103 | // --- Act/Assert 104 | const expr = wParser.parseExpr(); 105 | expect(expr).not.equal(null); 106 | if (!expr) return; 107 | const context = createEvalContext({ localContext: c.con }); 108 | const value = evalBinding(expr, context); 109 | expect(value).equal(c.exp); 110 | }); 111 | }); 112 | 113 | const calculatedMemberAccessCases = [ 114 | { src: 'alma["b"]', con: { alma: { b: 123 } }, exp: 123 }, 115 | { 116 | src: 'alma["b"]["c"]', 117 | con: { alma: { b: { c: 123, d: 234 } } }, 118 | exp: 123, 119 | }, 120 | { 121 | src: 'alma["b"]["d"]', 122 | con: { alma: { b: { c: 123, d: 234 } } }, 123 | exp: 234, 124 | }, 125 | { src: 'alma["length"]', con: { alma: "banana" }, exp: 6 }, 126 | { src: "alma[0]", con: { alma: [1, true, "banana"] }, exp: 1 }, 127 | { src: "alma[1]", con: { alma: [1, true, "banana"] }, exp: true }, 128 | { src: "alma[2]", con: { alma: [1, true, "banana"] }, exp: "banana" }, 129 | ]; 130 | calculatedMemberAccessCases.forEach((c) => { 131 | it(`Eval member access: ${c.src}/${JSON.stringify(c.con)}`, () => { 132 | // --- Arrange 133 | const wParser = new Parser(c.src); 134 | 135 | // --- Act/Assert 136 | const expr = wParser.parseExpr(); 137 | expect(expr).not.equal(null); 138 | if (!expr) return; 139 | const context = createEvalContext({ localContext: c.con }); 140 | const value = evalBinding(expr, context); 141 | expect(value).equal(c.exp); 142 | }); 143 | }); 144 | 145 | const optionalMemberAccessCases = [ 146 | { src: "alma?.b", con: { alma: { b: 123 } }, exp: 123 }, 147 | { src: "alma?.b", con: { alma: { b: null } }, exp: null }, 148 | { src: "alma?.b", con: { pear: { b: 123 }, alma: undefined }, exp: undefined }, 149 | { src: "alma?.b?.c", con: { alma: { b: { c: 123, d: 234 } } }, exp: 123 }, 150 | { src: "alma?.b?.c", con: { alma: { b: { c: null, d: 234 } } }, exp: null }, 151 | { 152 | src: "alma?.b?.c", 153 | con: { pear: { b: { c: 123, d: 234 } }, alma: undefined }, 154 | exp: undefined, 155 | }, 156 | { 157 | src: "alma?.b?.c", 158 | con: { alma: { b: { w: 123, d: 234 } } }, 159 | exp: undefined, 160 | }, 161 | { 162 | src: "alma?.b?.c", 163 | con: { pear: { b: { w: 123, d: 234 } }, alma: undefined }, 164 | exp: undefined, 165 | }, 166 | ]; 167 | optionalMemberAccessCases.forEach((c) => { 168 | it(`Eval member access: ${c.src}/${JSON.stringify(c.con)}`, () => { 169 | // --- Arrange 170 | const wParser = new Parser(c.src); 171 | 172 | // --- Act/Assert 173 | const expr = wParser.parseExpr(); 174 | expect(expr).not.equal(null); 175 | if (!expr) return; 176 | const context = createEvalContext({ localContext: c.con }); 177 | const value = evalBinding(expr, context); 178 | expect(value).equal(c.exp); 179 | }); 180 | }); 181 | 182 | const defaultedMemberAccessCases = [ 183 | { src: "alma.b", con: { alma: { b: 123 } }, exp: 123 }, 184 | { src: "alma.b", con: { alma: { b: null } }, exp: null }, 185 | { src: "alma.b", con: { pear: { b: 123 }, alma: undefined }, exp: undefined }, 186 | { src: "alma.b.c", con: { alma: { b: { c: 123, d: 234 } } }, exp: 123 }, 187 | { src: "alma.b.c", con: { alma: { b: { c: null, d: 234 } } }, exp: null }, 188 | { 189 | src: "alma.b.c", 190 | con: { pear: { b: { c: 123, d: 234 } }, alma: undefined }, 191 | exp: undefined, 192 | }, 193 | { 194 | src: "alma.b.c", 195 | con: { alma: { b: { w: 123, d: 234 } } }, 196 | exp: undefined, 197 | }, 198 | { 199 | src: "alma.b.c", 200 | con: { pear: { b: { w: 123, d: 234 } }, alma: undefined }, 201 | exp: undefined, 202 | }, 203 | ]; 204 | defaultedMemberAccessCases.forEach((c) => { 205 | it(`Eval forced optional member access: ${c.src}/${JSON.stringify(c.con)}`, () => { 206 | // --- Arrange 207 | const wParser = new Parser(c.src); 208 | 209 | // --- Act/Assert 210 | const expr = wParser.parseExpr(); 211 | expect(expr).not.equal(null); 212 | if (!expr) return; 213 | const context = createEvalContext({ 214 | localContext: c.con, 215 | appContext: {}, 216 | options: { defaultToOptionalMemberAccess: true }, 217 | }); 218 | const value = evalBinding(expr, context); 219 | expect(value).equal(c.exp); 220 | }); 221 | }); 222 | 223 | const sequenceCases = [ 224 | { src: "0, alma.b", con: { alma: { b: 123 } }, exp: 123 }, 225 | { 226 | src: "1, a+b, alma.b.c", 227 | con: { alma: { b: { c: 123, d: 234 } }, a: 0, b: 0 }, 228 | exp: 123, 229 | }, 230 | { 231 | src: "2, a+b, alma.b.d", 232 | con: { alma: { b: { c: 123, d: 234 } }, a: 0, b: 0 }, 233 | exp: 234, 234 | }, 235 | { src: "1, 2, 3, alma.length", con: { alma: "banana" }, exp: 6 }, 236 | { 237 | src: "alma, alma, alma.b.d.length", 238 | con: { alma: { b: { c: 123, d: "hello" } } }, 239 | exp: 5, 240 | }, 241 | ]; 242 | sequenceCases.forEach((c) => { 243 | it(`Eval calculated member access: ${c.src}/${JSON.stringify(c.con)}`, () => { 244 | // --- Arrange 245 | const wParser = new Parser(c.src); 246 | 247 | // --- Act/Assert 248 | const expr = wParser.parseExpr(); 249 | expect(expr).not.equal(null); 250 | if (!expr) return; 251 | const context = createEvalContext({ localContext: c.con }); 252 | const value = evalBinding(expr, context); 253 | expect(value).equal(c.exp); 254 | }); 255 | }); 256 | 257 | const arrayLiteralCases = [ 258 | { 259 | src: "[ alma.a, alma.b]", 260 | con: { alma: { a: 234, b: 123 } }, 261 | exp: [234, 123], 262 | }, 263 | { 264 | src: '[ "banana", alma.a, alma.b]', 265 | con: { alma: { a: 234, b: 123 } }, 266 | exp: ["banana", 234, 123], 267 | }, 268 | { 269 | src: '[ "banana", alma.a, alma.b.c]', 270 | con: { alma: { a: 234, b: { f: false, c: true } } }, 271 | exp: ["banana", 234, true], 272 | }, 273 | ]; 274 | arrayLiteralCases.forEach((c) => { 275 | it(`Array literal: ${c.src}/${JSON.stringify(c.con)}`, () => { 276 | // --- Arrange 277 | const wParser = new Parser(c.src); 278 | 279 | // --- Act/Assert 280 | const expr = wParser.parseExpr(); 281 | expect(expr).not.equal(null); 282 | if (!expr) return; 283 | const context = createEvalContext({ localContext: c.con }); 284 | const value = evalBinding(expr, context); 285 | expect(value.length).equal(c.exp.length); 286 | for (let i = 0; i < value.length; i++) { 287 | expect(value[i]).equal(c.exp[i]); 288 | } 289 | }); 290 | }); 291 | 292 | const objectLiteralCases = [ 293 | { 294 | src: "{ a: alma.a, b: alma.b }", 295 | con: { alma: { a: 234, b: 123 } }, 296 | exp: { a: 234, b: 123 }, 297 | }, 298 | { 299 | src: "{ a: true, b: alma.b }", 300 | con: { alma: { a: 234, b: 123 } }, 301 | exp: { a: true, b: 123 }, 302 | }, 303 | { 304 | src: '{ a: alma.a, b: "banana" }', 305 | con: { alma: { a: 234, b: 123 } }, 306 | exp: { a: 234, b: "banana" }, 307 | }, 308 | { 309 | src: '{ "q": alma.a, b: "banana" }', 310 | con: { alma: { a: 234, b: 123 } }, 311 | exp: { q: 234, b: "banana" }, 312 | }, 313 | { 314 | src: '{ 123: alma.a, b: "banana" }', 315 | con: { alma: { a: 234, b: 123 } }, 316 | exp: { 123: 234, b: "banana" }, 317 | }, 318 | { 319 | src: '{ [1+2]: alma.a, b: "banana" }', 320 | con: { alma: { a: 234, b: 123 } }, 321 | exp: { 3: 234, b: "banana" }, 322 | }, 323 | { 324 | src: '{ ["abc".length]: alma.a, b: "banana" }', 325 | con: { alma: { a: 234, b: 123 } }, 326 | exp: { 3: 234, b: "banana" }, 327 | }, 328 | { 329 | src: '{ ["app" + "le"]: alma.a, b: "banana" }', 330 | con: { alma: { a: 234, b: 123 } }, 331 | exp: { apple: 234, b: "banana" }, 332 | }, 333 | ]; 334 | objectLiteralCases.forEach((c) => { 335 | it(`Array literal: ${c.src}/${JSON.stringify(c.con)}`, () => { 336 | // --- Arrange 337 | const wParser = new Parser(c.src); 338 | 339 | // --- Act/Assert 340 | const expr = wParser.parseExpr(); 341 | expect(expr).not.equal(null); 342 | if (!expr) return; 343 | const context = createEvalContext({ localContext: c.con }); 344 | const value = evalBinding(expr, context); 345 | for (const key in c.exp) { 346 | expect(value[key]).equal((c.exp as any)[key]); 347 | } 348 | }); 349 | }); 350 | 351 | const unaryCases = [ 352 | { src: "+alma.b", con: { alma: { b: 123 } }, exp: 123 }, 353 | { src: "-alma.b", con: { alma: { b: 123 } }, exp: -123 }, 354 | { src: "!alma.b", con: { alma: { b: 0 } }, exp: true }, 355 | { src: "!alma.b", con: { alma: { b: 123 } }, exp: false }, 356 | { src: "~alma.b", con: { alma: { b: 123 } }, exp: -124 }, 357 | { src: "~alma.b", con: { alma: { b: 0 } }, exp: -1 }, 358 | { src: "typeof alma.b", con: { alma: { b: 0 } }, exp: "number" }, 359 | { src: "typeof alma.b", con: { alma: { b: "Hello" } }, exp: "string" }, 360 | { src: "typeof alma.b", con: { alma: { b: false } }, exp: "boolean" }, 361 | { src: "typeof alma.b", con: { alma: { b: null } }, exp: "object" }, 362 | { src: "typeof alma.b", con: { alma: {} }, exp: "undefined" }, 363 | { src: "typeof alma.b", con: { alma: { b: {} } }, exp: "object" }, 364 | { src: "typeof alma.b", con: { alma: { b: [1, 2, 3] } }, exp: "object" }, 365 | ]; 366 | unaryCases.forEach((c) => { 367 | it(`Unary operation: ${c.src}/${JSON.stringify(c.con)}`, () => { 368 | // --- Arrange 369 | const wParser = new Parser(c.src); 370 | 371 | // --- Act/Assert 372 | const expr = wParser.parseExpr(); 373 | expect(expr).not.equal(null); 374 | if (!expr) return; 375 | const context = createEvalContext({ localContext: c.con }); 376 | const value = evalBinding(expr, context); 377 | expect(value).equal(c.exp); 378 | }); 379 | }); 380 | 381 | const binaryCases = [ 382 | { src: "alma.b * c", con: { alma: { b: 123 }, c: 3 }, exp: 369 }, 383 | { src: "alma.b / c", con: { alma: { b: 123 }, c: 3 }, exp: 41 }, 384 | { src: "alma.b % c", con: { alma: { b: 125 }, c: 3 }, exp: 2 }, 385 | { src: "alma.b + 3", con: { alma: { b: 123 } }, exp: 126 }, 386 | { 387 | src: "123456789123456789 + 123456789123456789123", 388 | con: {}, 389 | exp: BigInt("123580245912580245912"), 390 | }, 391 | { src: '"👍" + "🚀"', con: {}, exp: "👍🚀" }, 392 | { src: '"Hello," + " World!"', con: {}, exp: "Hello, World!" }, 393 | { src: "alma.b - 3", con: { alma: { b: 123 } }, exp: 120 }, 394 | { src: "alma.b >> 2", con: { alma: { b: 123 } }, exp: 30 }, 395 | { src: "alma.b >> 2", con: { alma: { b: 123 } }, exp: 30 }, 396 | { src: "-alma.b >> 2", con: { alma: { b: 123 } }, exp: -31 }, 397 | { src: "alma.b >>> 2", con: { alma: { b: 123 } }, exp: 30 }, 398 | { src: "-alma.b >>> 2", con: { alma: { b: 123 } }, exp: 1073741793 }, 399 | { src: "alma.b < 3", con: { alma: { b: 123 } }, exp: false }, 400 | { src: "alma.b <= 123", con: { alma: { b: 123 } }, exp: true }, 401 | { src: "alma.b > 123", con: { alma: { b: 123 } }, exp: false }, 402 | { src: "alma.b >= 123", con: { alma: { b: 123 } }, exp: true }, 403 | { src: "alma.b >= 123", con: { alma: { b: 123 } }, exp: true }, 404 | { src: "2 in [12, 123, 1234]", con: { alma: { b: 123 } }, exp: true }, 405 | { src: '"PI" in Math', con: { alma: { b: 123 } }, exp: true }, 406 | { src: "alma.b == 3", con: { alma: { b: 123 } }, exp: false }, 407 | { src: "alma.b == 123", con: { alma: { b: 123 } }, exp: true }, 408 | { src: "alma.b === 123", con: { alma: { b: 123 } }, exp: true }, 409 | { src: "alma.b != 3", con: { alma: { b: 123 } }, exp: true }, 410 | { src: "alma.b != 123", con: { alma: { b: 123 } }, exp: false }, 411 | { src: "alma.b !== 123", con: { alma: { b: 123 } }, exp: false }, 412 | { src: "alma.b & 12", con: { alma: { b: 123 } }, exp: 8 }, 413 | { src: "alma.b | 12", con: { alma: { b: 123 } }, exp: 127 }, 414 | { src: "alma.b ^ 12", con: { alma: { b: 123 } }, exp: 119 }, 415 | { src: "alma.b && 12", con: { alma: { b: 123 } }, exp: 12 }, 416 | { src: "alma.b && 12 > 3", con: { alma: { b: 123 } }, exp: true }, 417 | { src: "alma.b || 12", con: { alma: { b: 123 } }, exp: 123 }, 418 | { src: "alma.b || 12 > 3", con: { alma: { b: 123 } }, exp: 123 }, 419 | { src: "alma.b < 3 || 12 > 3", con: { alma: { b: 123 } }, exp: true }, 420 | { src: "12 + 23 * 4", con: {}, exp: 104 }, 421 | { src: "(12 + 23) * 4", con: {}, exp: 140 }, 422 | { src: "12 * 23 + 4", con: {}, exp: 280 }, 423 | { src: "alma.b ?? 12", con: { alma: { b: null } }, exp: 12 }, 424 | { src: "alma.b ?? 12", con: { alma: { b: undefined } }, exp: 12 }, 425 | { src: "alma.b ?? 12", con: { alma: { b: 234 } }, exp: 234 }, 426 | ]; 427 | binaryCases.forEach((c) => { 428 | it(`Binary operation: ${c.src}/${JSON.stringify(c.con)}`, () => { 429 | const context = createEvalContext({ localContext: c.con }); 430 | const value = evalBindingExpression(c.src, context); 431 | expect(value).equal(c.exp); 432 | }); 433 | }); 434 | 435 | const exponentialCases = [ 436 | { 437 | src: "2**3", 438 | exp: 8, 439 | }, 440 | { 441 | src: "2**3**2", 442 | exp: 512, 443 | }, 444 | { 445 | src: "4**2**3", 446 | exp: 65536, 447 | }, 448 | { 449 | src: "1.5**2", 450 | exp: 2.25, 451 | }, 452 | { 453 | src: "1.5**2**3", 454 | exp: 25.62890625, 455 | }, 456 | ]; 457 | exponentialCases.forEach((c) => { 458 | it(`Conditional: ${c.src}`, () => { 459 | // --- Arrange 460 | const wParser = new Parser(c.src); 461 | 462 | // --- Act/Assert 463 | const expr = wParser.parseExpr(); 464 | expect(expr).not.equal(null); 465 | if (!expr) return; 466 | const context = createEvalContext({ localContext: {} }); 467 | const value = evalBinding(expr, context); 468 | expect(value).equal(c.exp); 469 | }); 470 | }); 471 | 472 | const functionInvocationCases = [ 473 | { 474 | src: "Math.sin(0)", 475 | con: { alma: { a: 234, b: 123 } }, 476 | exp: 0, 477 | }, 478 | { 479 | src: "Math.cos(0.0)", 480 | con: { alma: { a: 234, b: 123 } }, 481 | exp: 1, 482 | }, 483 | { 484 | src: "alma.mul(2, alma.mul(3,4)) + Math.cos(0)", 485 | con: { alma: { mul: (a: any, b: any) => a * b, b: 123 } }, 486 | exp: 25, 487 | }, 488 | ]; 489 | functionInvocationCases.forEach((c) => { 490 | it(`Function call: ${c.src}/${JSON.stringify(c.con)}`, () => { 491 | // --- Arrange 492 | const wParser = new Parser(c.src); 493 | 494 | // --- Act/Assert 495 | const expr = wParser.parseExpr(); 496 | expect(expr).not.equal(null); 497 | if (!expr) return; 498 | const context = createEvalContext({ localContext: c.con }); 499 | const value = evalBinding(expr, context); 500 | expect(value).equal(c.exp); 501 | }); 502 | }); 503 | 504 | const itemReferenceCases = [ 505 | { 506 | src: "$item", 507 | con: { $item: 123 }, 508 | exp: 123, 509 | }, 510 | ]; 511 | itemReferenceCases.forEach((c) => { 512 | it(`Item reference: ${c.src}/${JSON.stringify(c.con)}`, () => { 513 | // --- Arrange 514 | const wParser = new Parser(c.src); 515 | 516 | // --- Act/Assert 517 | const expr = wParser.parseExpr(); 518 | expect(expr).not.equal(null); 519 | if (!expr) return; 520 | const context = createEvalContext({ localContext: c.con }); 521 | const value = evalBinding(expr, context); 522 | expect(value).equal(c.exp); 523 | }); 524 | }); 525 | 526 | const appContextCases = [ 527 | { 528 | src: "alma.b", 529 | con: { pear: 123 }, 530 | aCon: { alma: { b: 234 } }, 531 | exp: 234, 532 | }, 533 | { 534 | src: "alma.b", 535 | con: { alma: { b: 123 } }, 536 | aCon: { alma: { b: 234 } }, 537 | exp: 123, 538 | }, 539 | ]; 540 | appContextCases.forEach((c) => { 541 | it(`App context: ${c.src}/${JSON.stringify(c.con)}`, () => { 542 | // --- Arrange 543 | const wParser = new Parser(c.src); 544 | 545 | // --- Act/Assert 546 | const expr = wParser.parseExpr(); 547 | expect(expr).not.equal(null); 548 | if (!expr) return; 549 | const context = createEvalContext({ localContext: c.con, appContext: c.aCon }); 550 | const value = evalBinding(expr, context); 551 | expect(value).equal(c.exp); 552 | }); 553 | }); 554 | 555 | it("Array literal with spread array", () => { 556 | // --- Arrange 557 | const wParser = new Parser("[5, ...[1,2,3], 4]"); 558 | 559 | // --- Act/Assert 560 | const expr = wParser.parseExpr(); 561 | expect(expr).not.equal(null); 562 | if (!expr) return; 563 | const context = createEvalContext({ localContext: {}, appContext: {} }); 564 | const value = evalBinding(expr, context); 565 | expect(value.length).equal(5); 566 | expect(value[0]).equal(5); 567 | expect(value[1]).equal(1); 568 | expect(value[2]).equal(2); 569 | expect(value[3]).equal(3); 570 | expect(value[4]).equal(4); 571 | }); 572 | 573 | it("Spread out of context", () => { 574 | // --- Arrange 575 | const wParser = new Parser("...[1,2,3]"); 576 | 577 | // --- Act/Assert 578 | const expr = wParser.parseExpr(); 579 | expect(expr).not.equal(null); 580 | if (!expr) return; 581 | try { 582 | const context = createEvalContext({ localContext: {}, appContext: {} }); 583 | evalBinding(expr, context); 584 | } catch (err: any) { 585 | expect(err.message.indexOf("(...)")).greaterThan(-1); 586 | return; 587 | } 588 | assert.fail("Exception expected"); 589 | }); 590 | 591 | it("Array literal with spread object", () => { 592 | // --- Arrange 593 | const wParser = new Parser("[5, ...{a: 1, b: 2}]"); 594 | 595 | // --- Act/Assert 596 | const expr = wParser.parseExpr(); 597 | expect(expr).not.equal(null); 598 | if (!expr) return; 599 | try { 600 | const context = createEvalContext({ localContext: {}, appContext: {} }); 601 | evalBinding(expr, context); 602 | } catch (err: any) { 603 | expect(err.message.indexOf("array operand")).greaterThan(-1); 604 | return; 605 | } 606 | assert.fail("Exception expected"); 607 | }); 608 | 609 | it("Object literal with spread array", () => { 610 | // --- Arrange 611 | const wParser = new Parser("{ a:1, ...[1,2,3], b:4}"); 612 | 613 | // --- Act/Assert 614 | const expr = wParser.parseExpr(); 615 | expect(expr).not.equal(null); 616 | if (!expr) return; 617 | const context = createEvalContext({ localContext: {}, appContext: {} }); 618 | const value = evalBinding(expr, context); 619 | expect(value[0]).equal(1); 620 | expect(value[1]).equal(2); 621 | expect(value[2]).equal(3); 622 | expect(value["a"]).equal(1); 623 | expect(value["b"]).equal(4); 624 | }); 625 | 626 | it("Object literal with spread object", () => { 627 | // --- Arrange 628 | const wParser = new Parser("{ a:1, ...{ c:3, d:5}, b:4}"); 629 | 630 | // --- Act/Assert 631 | const expr = wParser.parseExpr(); 632 | expect(expr).not.equal(null); 633 | if (!expr) return; 634 | const context = createEvalContext({ localContext: {}, appContext: {} }); 635 | const value = evalBinding(expr, context); 636 | expect(value["a"]).equal(1); 637 | expect(value["b"]).equal(4); 638 | expect(value["c"]).equal(3); 639 | expect(value["d"]).equal(5); 640 | }); 641 | 642 | it("Function call with spread array", () => { 643 | // --- Arrange 644 | const wParser = new Parser("myFunc(1, 2, ...[3, 4], 5)"); 645 | 646 | // --- Act/Assert 647 | const expr = wParser.parseExpr(); 648 | expect(expr).not.equal(null); 649 | if (!expr) return; 650 | const context = createEvalContext({ 651 | localContext: { 652 | myFunc(...args: any[]) { 653 | return args.join(":"); 654 | }, 655 | }, 656 | appContext: {}, 657 | }); 658 | const value = evalBinding(expr, context); 659 | expect(value).equal("1:2:3:4:5"); 660 | }); 661 | 662 | it("Function call with spread object", () => { 663 | // --- Arrange 664 | const wParser = new Parser("myFunc(1, 2, ...{a: 1, b:2}, 5)"); 665 | 666 | // --- Act/Assert 667 | const expr = wParser.parseExpr(); 668 | expect(expr).not.equal(null); 669 | if (!expr) return; 670 | 671 | try { 672 | const context = createEvalContext({ 673 | localContext: { 674 | myFunc(...args: any[]) { 675 | return args.join(":"); 676 | }, 677 | }, 678 | appContext: {}, 679 | }); 680 | evalBinding(expr, context); 681 | } catch (err: any) { 682 | expect(err.message.indexOf("array operand")).greaterThan(-1); 683 | return; 684 | } 685 | assert.fail("Exception expected"); 686 | }); 687 | 688 | it("Sync function call with promise raises error", () => { 689 | // --- Arrange 690 | const wParser = new Parser("delay(120)"); 691 | 692 | // --- Act/Assert 693 | const expr = wParser.parseExpr(); 694 | expect(expr).not.equal(null); 695 | if (!expr) return; 696 | 697 | try { 698 | const context = createEvalContext({ 699 | localContext: { 700 | delay: async (time: number) => new Promise((resolve) => setTimeout(resolve, time)), 701 | }, 702 | appContext: {}, 703 | }); 704 | evalBinding(expr, context); 705 | } catch (err: any) { 706 | expect(err.message).contains("Promise"); 707 | return; 708 | } 709 | assert.fail("Exception expected"); 710 | }); 711 | 712 | it("Async function call works", async () => { 713 | // --- Arrange 714 | const wParser = new Parser("delay(120)"); 715 | const expr = wParser.parseExpr(); 716 | expect(expr).not.equal(null); 717 | if (!expr) return; 718 | 719 | // --- Act 720 | const context = createEvalContext({ 721 | localContext: { 722 | delay: async (time: number) => { 723 | new Promise((resolve) => setTimeout(resolve, time)); 724 | return 123; 725 | }, 726 | }, 727 | appContext: {}, 728 | }); 729 | const value = await evalBindingAsync(expr, context, undefined); 730 | 731 | // --- Assert 732 | expect(value).equal(123); 733 | }); 734 | 735 | it("delete alma", () => { 736 | // --- Arrange 737 | const wParser = new Parser("delete alma"); 738 | 739 | // --- Act/Assert 740 | const expr = wParser.parseExpr(); 741 | expect(expr).not.equal(null); 742 | if (!expr) return; 743 | const context = createEvalContext({ localContext: { alma: {} } }); 744 | const value = evalBinding(expr, context); 745 | expect(value).equal(true); 746 | expect(context.localContext.alma).equal(undefined); 747 | }); 748 | 749 | it("delete alma.b #1", () => { 750 | // --- Arrange 751 | const wParser = new Parser("delete alma.b"); 752 | 753 | // --- Act/Assert 754 | const expr = wParser.parseExpr(); 755 | expect(expr).not.equal(null); 756 | if (!expr) return; 757 | const context = createEvalContext({ localContext: { alma: {} } }); 758 | const value = evalBinding(expr, context); 759 | expect(value).equal(true); 760 | expect(context.localContext.alma.b).equal(undefined); 761 | }); 762 | 763 | it("delete alma.b #2", () => { 764 | // --- Arrange 765 | const wParser = new Parser("delete alma.b"); 766 | 767 | // --- Act/Assert 768 | const expr = wParser.parseExpr(); 769 | expect(expr).not.equal(null); 770 | if (!expr) return; 771 | const context = createEvalContext({ localContext: { alma: { b: "hello" } } }); 772 | const value = evalBinding(expr, context); 773 | expect(value).equal(true); 774 | expect(context.localContext.alma.b).equal(undefined); 775 | }); 776 | 777 | it("delete 123", () => { 778 | // --- Arrange 779 | const wParser = new Parser("delete 123"); 780 | 781 | // --- Act/Assert 782 | const expr = wParser.parseExpr(); 783 | expect(expr).not.equal(null); 784 | if (!expr) return; 785 | const context = createEvalContext({}); 786 | const value = evalBinding(expr, context); 787 | expect(value).equal(false); 788 | }); 789 | 790 | it("|| regression #1", () => { 791 | // --- Arrange 792 | const wParser = new Parser("123 || ++a"); 793 | 794 | // --- Act/Assert 795 | const expr = wParser.parseExpr(); 796 | expect(expr).not.equal(null); 797 | if (!expr) return; 798 | const context = createEvalContext({ 799 | localContext: { a: 0 }, 800 | }); 801 | const value = evalBinding(expr, context); 802 | expect(value).equal(123); 803 | expect(context.localContext.a).equal(0); 804 | }); 805 | 806 | it("|| regression #2", () => { 807 | // --- Arrange 808 | const wParser = new Parser("true || ++a"); 809 | 810 | // --- Act/Assert 811 | const expr = wParser.parseExpr(); 812 | expect(expr).not.equal(null); 813 | if (!expr) return; 814 | const context = createEvalContext({ 815 | localContext: { a: 0 }, 816 | }); 817 | const value = evalBinding(expr, context); 818 | expect(value).equal(true); 819 | expect(context.localContext.a).equal(0); 820 | }); 821 | 822 | it("|| regression #3 (async)", async () => { 823 | // --- Arrange 824 | const wParser = new Parser("123 || ++a"); 825 | 826 | // --- Act/Assert 827 | const expr = wParser.parseExpr(); 828 | expect(expr).not.equal(null); 829 | if (!expr) return; 830 | const context = createEvalContext({ 831 | localContext: { a: 0 }, 832 | }); 833 | const value = await evalBindingAsync(expr, context, context.mainThread); 834 | expect(value).equal(123); 835 | expect(context.localContext.a).equal(0); 836 | }); 837 | 838 | it("|| regression #4 (async)", async () => { 839 | // --- Arrange 840 | const wParser = new Parser("true || ++a"); 841 | 842 | // --- Act/Assert 843 | const expr = wParser.parseExpr(); 844 | expect(expr).not.equal(null); 845 | if (!expr) return; 846 | const context = createEvalContext({ 847 | localContext: { a: 0 }, 848 | }); 849 | const value = await evalBindingAsync(expr, context, context.mainThread); 850 | expect(value).equal(true); 851 | expect(context.localContext.a).equal(0); 852 | }); 853 | 854 | it("&& regression #1", () => { 855 | // --- Arrange 856 | const wParser = new Parser("'' && ++a"); 857 | 858 | // --- Act/Assert 859 | const expr = wParser.parseExpr(); 860 | expect(expr).not.equal(null); 861 | if (!expr) return; 862 | const context = createEvalContext({ 863 | localContext: { a: 0 }, 864 | }); 865 | const value = evalBinding(expr, context); 866 | expect(value).equal(""); 867 | expect(context.localContext.a).equal(0); 868 | }); 869 | 870 | it("&& regression #2", () => { 871 | // --- Arrange 872 | const wParser = new Parser("false && ++a"); 873 | 874 | // --- Act/Assert 875 | const expr = wParser.parseExpr(); 876 | expect(expr).not.equal(null); 877 | if (!expr) return; 878 | const context = createEvalContext({ 879 | localContext: { a: 0 }, 880 | }); 881 | const value = evalBinding(expr, context); 882 | expect(value).equal(false); 883 | expect(context.localContext.a).equal(0); 884 | }); 885 | 886 | it("&& regression #3 (async)", async () => { 887 | // --- Arrange 888 | const wParser = new Parser("0 && ++a"); 889 | 890 | // --- Act/Assert 891 | const expr = wParser.parseExpr(); 892 | expect(expr).not.equal(null); 893 | if (!expr) return; 894 | const context = createEvalContext({ 895 | localContext: { a: 0 }, 896 | }); 897 | const value = await evalBindingAsync(expr, context, context.mainThread); 898 | expect(value).equal(0); 899 | expect(context.localContext.a).equal(0); 900 | }); 901 | 902 | it("&& regression #4 (async)", async () => { 903 | // --- Arrange 904 | const wParser = new Parser("false && ++a"); 905 | 906 | // --- Act/Assert 907 | const expr = wParser.parseExpr(); 908 | expect(expr).not.equal(null); 909 | if (!expr) return; 910 | const context = createEvalContext({ 911 | localContext: { a: 0 }, 912 | }); 913 | const value = await evalBindingAsync(expr, context, context.mainThread); 914 | expect(value).equal(false); 915 | expect(context.localContext.a).equal(0); 916 | }); 917 | 918 | it(`Evals template literals`, () => { 919 | // --- Arrange 920 | const wParser = new Parser("`\\u0058\\x59a${2+3}b${var1}d${undef}${NaN}${null}\\${1+2}`"); 921 | 922 | // --- Act/Assert 923 | const expr = wParser.parseExpr(); 924 | const context = createEvalContext({ localContext: { var1: "c", undef: undefined } }); 925 | const value = evalBinding(expr, context); 926 | expect(value).to.equal("XYa5bcdundefinedNaNnull${1+2}"); 927 | }); 928 | 929 | it(`Evals template literals (async)`, async () => { 930 | // --- Arrange 931 | const wParser = new Parser("`\\u0058\\x59a${2+3}b${var1}d${undef}${NaN}${null}\\${1+2}`"); 932 | 933 | // --- Act/Assert 934 | const expr = wParser.parseExpr(); 935 | const context = createEvalContext({ localContext: { var1: "c", undef: undefined } }); 936 | const value = await evalBindingAsync(expr, context, context.mainThread); 937 | expect(value).to.equal("XYa5bcdundefinedNaNnull${1+2}"); 938 | }); 939 | 940 | it(`template literal method call`, async () => { 941 | // --- Arrange 942 | const wParser = new Parser("`a `.trim()"); 943 | 944 | // --- Act/Assert 945 | const expr = wParser.parseExpr(); 946 | const context = createEvalContext({ 947 | localContext: {}, 948 | }); 949 | const value = await evalBindingAsync(expr, context, context.mainThread); 950 | expect(value).to.equal("a"); 951 | }); 952 | }); 953 | ```