This is page 108 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 ├── .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 │ ├── layout-changes.md │ ├── 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 │ │ ├── resources │ │ │ ├── favicon.ico │ │ │ ├── files │ │ │ │ └── for-download │ │ │ │ └── xmlui │ │ │ │ └── xmlui-standalone.umd.js │ │ │ ├── github.svg │ │ │ ├── llms.txt │ │ │ ├── logo-dark.svg │ │ │ ├── logo.svg │ │ │ ├── pg-popout.svg │ │ │ ├── rss.svg │ │ │ └── xmlui-logo.svg │ │ ├── serve.json │ │ └── web.config │ ├── scripts │ │ ├── download-latest-xmlui.js │ │ ├── generate-rss.js │ │ ├── get-releases.js │ │ └── utils.js │ ├── src │ │ ├── components │ │ │ ├── BlogOverview.xmlui │ │ │ ├── BlogPage.xmlui │ │ │ └── PageNotFound.xmlui │ │ ├── config.ts │ │ ├── Main.xmlui │ │ └── themes │ │ └── blog-theme.ts │ └── tsconfig.json ├── CONTRIBUTING.md ├── docs │ ├── .gitignore │ ├── CHANGELOG.md │ ├── ComponentRefLinks.txt │ ├── content │ │ ├── _meta.json │ │ ├── components │ │ │ ├── _meta.json │ │ │ ├── _overview.md │ │ │ ├── APICall.md │ │ │ ├── App.md │ │ │ ├── AppHeader.md │ │ │ ├── AppState.md │ │ │ ├── AutoComplete.md │ │ │ ├── Avatar.md │ │ │ ├── Backdrop.md │ │ │ ├── Badge.md │ │ │ ├── BarChart.md │ │ │ ├── Bookmark.md │ │ │ ├── Breakout.md │ │ │ ├── Button.md │ │ │ ├── Card.md │ │ │ ├── Carousel.md │ │ │ ├── ChangeListener.md │ │ │ ├── Checkbox.md │ │ │ ├── CHStack.md │ │ │ ├── ColorPicker.md │ │ │ ├── Column.md │ │ │ ├── ContentSeparator.md │ │ │ ├── CVStack.md │ │ │ ├── DataSource.md │ │ │ ├── DateInput.md │ │ │ ├── DatePicker.md │ │ │ ├── DonutChart.md │ │ │ ├── DropdownMenu.md │ │ │ ├── EmojiSelector.md │ │ │ ├── ExpandableItem.md │ │ │ ├── FileInput.md │ │ │ ├── FileUploadDropZone.md │ │ │ ├── FlowLayout.md │ │ │ ├── Footer.md │ │ │ ├── Form.md │ │ │ ├── FormItem.md │ │ │ ├── FormSection.md │ │ │ ├── Fragment.md │ │ │ ├── H1.md │ │ │ ├── H2.md │ │ │ ├── H3.md │ │ │ ├── H4.md │ │ │ ├── H5.md │ │ │ ├── H6.md │ │ │ ├── Heading.md │ │ │ ├── HSplitter.md │ │ │ ├── HStack.md │ │ │ ├── Icon.md │ │ │ ├── IFrame.md │ │ │ ├── Image.md │ │ │ ├── Items.md │ │ │ ├── LabelList.md │ │ │ ├── Legend.md │ │ │ ├── LineChart.md │ │ │ ├── Link.md │ │ │ ├── List.md │ │ │ ├── Logo.md │ │ │ ├── Markdown.md │ │ │ ├── MenuItem.md │ │ │ ├── MenuSeparator.md │ │ │ ├── ModalDialog.md │ │ │ ├── NavGroup.md │ │ │ ├── NavLink.md │ │ │ ├── NavPanel.md │ │ │ ├── NoResult.md │ │ │ ├── NumberBox.md │ │ │ ├── Option.md │ │ │ ├── Page.md │ │ │ ├── PageMetaTitle.md │ │ │ ├── Pages.md │ │ │ ├── Pagination.md │ │ │ ├── PasswordInput.md │ │ │ ├── PieChart.md │ │ │ ├── ProgressBar.md │ │ │ ├── Queue.md │ │ │ ├── RadioGroup.md │ │ │ ├── RealTimeAdapter.md │ │ │ ├── Redirect.md │ │ │ ├── Select.md │ │ │ ├── Slider.md │ │ │ ├── Slot.md │ │ │ ├── SpaceFiller.md │ │ │ ├── Spinner.md │ │ │ ├── Splitter.md │ │ │ ├── Stack.md │ │ │ ├── StickyBox.md │ │ │ ├── SubMenuItem.md │ │ │ ├── Switch.md │ │ │ ├── TabItem.md │ │ │ ├── Table.md │ │ │ ├── TableOfContents.md │ │ │ ├── Tabs.md │ │ │ ├── Text.md │ │ │ ├── TextArea.md │ │ │ ├── TextBox.md │ │ │ ├── Theme.md │ │ │ ├── TimeInput.md │ │ │ ├── Timer.md │ │ │ ├── ToneChangerButton.md │ │ │ ├── ToneSwitch.md │ │ │ ├── Tooltip.md │ │ │ ├── Tree.md │ │ │ ├── VSplitter.md │ │ │ ├── VStack.md │ │ │ ├── xmlui-animations │ │ │ │ ├── _meta.json │ │ │ │ ├── _overview.md │ │ │ │ ├── Animation.md │ │ │ │ ├── FadeAnimation.md │ │ │ │ ├── FadeInAnimation.md │ │ │ │ ├── FadeOutAnimation.md │ │ │ │ ├── ScaleAnimation.md │ │ │ │ └── SlideInAnimation.md │ │ │ ├── xmlui-pdf │ │ │ │ ├── _meta.json │ │ │ │ ├── _overview.md │ │ │ │ └── Pdf.md │ │ │ ├── xmlui-spreadsheet │ │ │ │ ├── _meta.json │ │ │ │ ├── _overview.md │ │ │ │ └── Spreadsheet.md │ │ │ └── xmlui-website-blocks │ │ │ ├── _meta.json │ │ │ ├── _overview.md │ │ │ ├── Carousel.md │ │ │ ├── HelloMd.md │ │ │ ├── HeroSection.md │ │ │ └── ScrollToTop.md │ │ └── extensions │ │ ├── _meta.json │ │ ├── xmlui-animations │ │ │ ├── _meta.json │ │ │ ├── _overview.md │ │ │ ├── Animation.md │ │ │ ├── FadeAnimation.md │ │ │ ├── FadeInAnimation.md │ │ │ ├── FadeOutAnimation.md │ │ │ ├── ScaleAnimation.md │ │ │ └── SlideInAnimation.md │ │ └── xmlui-website-blocks │ │ ├── _meta.json │ │ ├── _overview.md │ │ ├── Carousel.md │ │ ├── HelloMd.md │ │ ├── HeroSection.md │ │ └── ScrollToTop.md │ ├── extensions.ts │ ├── index.html │ ├── index.ts │ ├── package.json │ ├── public │ │ ├── feed.rss │ │ ├── mockServiceWorker.js │ │ ├── pages │ │ │ ├── _meta.json │ │ │ ├── app-structure.md │ │ │ ├── build-editor-component.md │ │ │ ├── build-hello-world-component.md │ │ │ ├── components-intro.md │ │ │ ├── context-variables.md │ │ │ ├── forms.md │ │ │ ├── globals.md │ │ │ ├── glossary.md │ │ │ ├── helper-tags.md │ │ │ ├── hosted-deployment.md │ │ │ ├── howto │ │ │ │ ├── assign-a-complex-json-literal-to-a-component-variable.md │ │ │ │ ├── chain-a-refetch.md │ │ │ │ ├── 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 │ │ │ ├── base64-utils.ts │ │ │ ├── compound-utils.ts │ │ │ ├── css-utils.ts │ │ │ ├── DataLoaderQueryKeyGenerator.ts │ │ │ ├── date-utils.ts │ │ │ ├── extractParam.ts │ │ │ ├── hooks.tsx │ │ │ ├── LruCache.ts │ │ │ ├── mergeProps.ts │ │ │ ├── misc.ts │ │ │ ├── request-params.ts │ │ │ ├── statementUtils.ts │ │ │ └── treeUtils.ts │ │ └── xmlui-parser.ts │ ├── index-standalone.ts │ ├── index.scss │ ├── index.ts │ ├── language-server │ │ ├── server-common.ts │ │ ├── server-web-worker.ts │ │ ├── server.ts │ │ ├── services │ │ │ ├── common │ │ │ │ ├── docs-generation.ts │ │ │ │ ├── lsp-utils.ts │ │ │ │ ├── metadata-utils.ts │ │ │ │ └── syntax-node-utilities.ts │ │ │ ├── completion.ts │ │ │ ├── diagnostic.ts │ │ │ ├── format.ts │ │ │ └── hover.ts │ │ └── xmlui-metadata-generated.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/script-runner/eval-tree-async.ts: -------------------------------------------------------------------------------- ```typescript 1 | import { isPlainObject } from "lodash-es"; 2 | 3 | import type { TemplateLiteralExpression } from "./ScriptingSourceTree"; 4 | import { 5 | T_ARRAY_LITERAL, 6 | T_ARROW_EXPRESSION, 7 | T_ASSIGNMENT_EXPRESSION, 8 | T_BINARY_EXPRESSION, 9 | T_BLOCK_STATEMENT, 10 | T_CALCULATED_MEMBER_ACCESS_EXPRESSION, 11 | T_CONDITIONAL_EXPRESSION, 12 | T_DESTRUCTURE, 13 | T_EMPTY_STATEMENT, 14 | T_EXPRESSION_STATEMENT, 15 | T_FUNCTION_INVOCATION_EXPRESSION, 16 | T_IDENTIFIER, 17 | T_LITERAL, 18 | T_MEMBER_ACCESS_EXPRESSION, 19 | T_OBJECT_LITERAL, 20 | T_POSTFIX_OP_EXPRESSION, 21 | T_PREFIX_OP_EXPRESSION, 22 | T_RETURN_STATEMENT, 23 | T_SEQUENCE_EXPRESSION, 24 | T_SPREAD_EXPRESSION, 25 | T_TEMPLATE_LITERAL_EXPRESSION, 26 | T_UNARY_EXPRESSION, 27 | T_VAR_DECLARATION, 28 | type ArrayLiteral, 29 | type ArrowExpression, 30 | type AssignmentExpression, 31 | type BinaryExpression, 32 | type CalculatedMemberAccessExpression, 33 | type ConditionalExpression, 34 | type Expression, 35 | type FunctionInvocationExpression, 36 | type Identifier, 37 | type MemberAccessExpression, 38 | type ObjectLiteral, 39 | type PostfixOpExpression, 40 | type PrefixOpExpression, 41 | type ReturnStatement, 42 | type SequenceExpression, 43 | type Statement, 44 | type UnaryExpression, 45 | type VarDeclaration, 46 | } from "./ScriptingSourceTree"; 47 | import type { BlockScope } from "../../abstractions/scripting/BlockScope"; 48 | import type { LogicalThread } from "../../abstractions/scripting/LogicalThread"; 49 | import type { BindingTreeEvaluationContext } from "./BindingTreeEvaluationContext"; 50 | import { processDeclarationsAsync, processStatementQueueAsync } from "./process-statement-async"; 51 | import { 52 | evalArrow, 53 | evalAssignmentCore, 54 | evalBinaryCore, 55 | evalCalculatedMemberAccessCore, 56 | evalIdentifier, 57 | evalLiteral, 58 | evalMemberAccessCore, 59 | evalPreOrPostCore, 60 | evalTemplateLiteralCore, 61 | evalUnaryCore, 62 | getExprValue, 63 | getRootIdScope, 64 | isPromise, 65 | setExprValue, 66 | } from "./eval-tree-common"; 67 | import { ensureMainThread } from "./process-statement-common"; 68 | import { getAsyncProxy } from "./asyncProxy"; 69 | import { isBannedFunction } from "./bannedFunctions"; 70 | 71 | type EvaluatorAsyncFunction = ( 72 | thisStack: any[], 73 | expr: Expression, 74 | evalContext: BindingTreeEvaluationContext, 75 | thread: LogicalThread, 76 | ) => Promise<any>; 77 | 78 | /** 79 | * Evaluates a binding represented by the specified expression 80 | * @param expr Expression to evaluate 81 | * @param evalContext Evaluation context to use 82 | * @param thread The logical thread to use for evaluation 83 | * @param onStatementCompleted Execute this function when a statement is completed 84 | */ 85 | export async function evalBindingAsync( 86 | expr: Expression, 87 | evalContext: BindingTreeEvaluationContext, 88 | thread: LogicalThread | undefined, 89 | ): Promise<any> { 90 | // --- Prepare the evaluation context 91 | const thisStack: any[] = []; 92 | ensureMainThread(evalContext); 93 | thread ??= evalContext.mainThread; 94 | 95 | // --- Evaluate the expression using the context 96 | return await evalBindingExpressionTreeAsync( 97 | thisStack, 98 | expr, 99 | evalContext, 100 | thread ?? evalContext.mainThread!, 101 | ); 102 | } 103 | 104 | /** 105 | * Executes the specified arrow function 106 | * @param expr Arrow function expression to run 107 | * @param evalContext Evaluation context to use 108 | * @param onStatementCompleted Execute this function when a statement is completed 109 | * @param thread The logical thread to use for evaluation 110 | * @param args Arguments of the arrow function to execute 111 | */ 112 | export async function executeArrowExpression( 113 | expr: ArrowExpression, 114 | evalContext: BindingTreeEvaluationContext, 115 | thread?: LogicalThread, 116 | ...args: any[] 117 | ): Promise<any> { 118 | // --- Just an extra safety check 119 | if (expr.type !== T_ARROW_EXPRESSION) { 120 | throw new Error("executeArrowExpression expects an 'ArrowExpression' object."); 121 | } 122 | 123 | // --- This is the evaluator that an arrow expression uses internally 124 | const evaluator: EvaluatorAsyncFunction = evalBindingExpressionTreeAsync; 125 | 126 | // --- Compiles the Arrow function to a JavaScript function 127 | const nativeFunction = await createArrowFunctionAsync(evaluator, expr); 128 | 129 | // --- Run the compiled arrow function. Note, we have two prefix arguments: 130 | // --- #1: The names of arrow function arguments 131 | // --- #2: The evaluation context the arrow function runs in 132 | // --- #others: The real arguments of the arrow function 133 | return await nativeFunction(expr.args, evalContext, thread ?? evalContext.mainThread, ...args); 134 | } 135 | 136 | /** 137 | * Evaluates the specified binding expression tree and retrieves the evaluated value 138 | * @param expr Binding tree expression 139 | * @param thisStack Stack of "this" object to use with function calls 140 | * @param evalContext Evaluation context 141 | * @param thread The logical thread to use for evaluation 142 | * @param onStatementCompleted Execute this function when a statement is completed 143 | * This code uses the JavaScript semantics and errors when evaluating the code. 144 | * We use `thisStack` to keep track of the partial results of the evaluation tree so that we can set 145 | * the real `this` context when invoking a function. 146 | */ 147 | async function evalBindingExpressionTreeAsync( 148 | thisStack: any[], 149 | expr: Expression, 150 | evalContext: BindingTreeEvaluationContext, 151 | thread: LogicalThread, 152 | ): Promise<any> { 153 | if (!evalContext.options) { 154 | evalContext.options = { defaultToOptionalMemberAccess: true }; 155 | } 156 | 157 | // --- Prepare evaluation 158 | const evaluator: EvaluatorAsyncFunction = evalBindingExpressionTreeAsync; 159 | 160 | // --- Process the expression according to its type 161 | 162 | try { 163 | switch (expr.type) { 164 | case T_TEMPLATE_LITERAL_EXPRESSION: 165 | return evalTemplateLiteralAsync(evaluator, thisStack, expr, evalContext, thread); 166 | 167 | case T_LITERAL: 168 | return evalLiteral(thisStack, expr, thread); 169 | 170 | case T_IDENTIFIER: 171 | return evalIdentifier(thisStack, expr, evalContext, thread); 172 | 173 | case T_MEMBER_ACCESS_EXPRESSION: 174 | return await evalMemberAccessAsync(evaluator, thisStack, expr, evalContext, thread); 175 | 176 | case T_CALCULATED_MEMBER_ACCESS_EXPRESSION: 177 | return await evalCalculatedMemberAccessAsync( 178 | evaluator, 179 | thisStack, 180 | expr, 181 | evalContext, 182 | thread, 183 | ); 184 | 185 | case T_SEQUENCE_EXPRESSION: 186 | return await evalSequenceAsync(evaluator, thisStack, expr, evalContext, thread); 187 | 188 | case T_ARRAY_LITERAL: 189 | return await evalArrayLiteralAsync(evaluator, thisStack, expr, evalContext, thread); 190 | 191 | case T_OBJECT_LITERAL: 192 | return await evalObjectLiteralAsync(evaluator, thisStack, expr, evalContext, thread); 193 | 194 | case T_UNARY_EXPRESSION: 195 | return await evalUnaryAsync(evaluator, thisStack, expr, evalContext, thread); 196 | 197 | case T_BINARY_EXPRESSION: 198 | return await evalBinaryAsync(evaluator, thisStack, expr, evalContext, thread); 199 | 200 | case T_CONDITIONAL_EXPRESSION: 201 | return await evalConditionalAsync(evaluator, thisStack, expr, evalContext, thread); 202 | 203 | case T_ASSIGNMENT_EXPRESSION: 204 | return await evalAssignmentAsync(evaluator, thisStack, expr, evalContext, thread); 205 | 206 | case T_PREFIX_OP_EXPRESSION: 207 | case T_POSTFIX_OP_EXPRESSION: 208 | return await evalPreOrPostAsync(evaluator, thisStack, expr, evalContext, thread); 209 | 210 | case T_FUNCTION_INVOCATION_EXPRESSION: 211 | // --- Special async handling 212 | return await evalFunctionInvocationAsync(evaluator, thisStack, expr, evalContext, thread); 213 | 214 | case T_ARROW_EXPRESSION: 215 | return evalArrow(thisStack, expr, thread); 216 | 217 | case T_SPREAD_EXPRESSION: 218 | throw new Error("Cannot use spread expression (...) with the current intermediate value."); 219 | 220 | default: 221 | throw new Error(`Unknown expression tree node: ${(expr as any).type}`); 222 | } 223 | } catch (e) { 224 | //TODO decorate error with expression details (startColumn, startLine, startPosition, etc.) 225 | throw e; 226 | } 227 | } 228 | 229 | async function evalMemberAccessAsync( 230 | evaluator: EvaluatorAsyncFunction, 231 | thisStack: any[], 232 | expr: MemberAccessExpression, 233 | evalContext: BindingTreeEvaluationContext, 234 | thread: LogicalThread, 235 | ): Promise<any> { 236 | await evaluator(thisStack, expr.obj, evalContext, thread); 237 | await completeExprValue(expr.obj, thread); 238 | // --- At this point we definitely keep the parent object on `thisStack`, as it will be the context object 239 | // --- of a FunctionInvocationExpression, if that follows the MemberAccess. Other operations would call 240 | // --- `thisStack.pop()` to remove the result from the previous `evalBindingExpressionTree` call. 241 | return evalMemberAccessCore(thisStack, expr, evalContext, thread); 242 | } 243 | 244 | async function evalCalculatedMemberAccessAsync( 245 | evaluator: EvaluatorAsyncFunction, 246 | thisStack: any[], 247 | expr: CalculatedMemberAccessExpression, 248 | evalContext: BindingTreeEvaluationContext, 249 | thread: LogicalThread, 250 | ): Promise<any> { 251 | await evaluator(thisStack, expr.obj, evalContext, thread); 252 | await completeExprValue(expr.obj, thread); 253 | await evaluator(thisStack, expr.member, evalContext, thread); 254 | thisStack.pop(); 255 | await completeExprValue(expr.member, thread); 256 | return evalCalculatedMemberAccessCore(thisStack, expr, evalContext, thread); 257 | } 258 | 259 | function evalSequenceAsync( 260 | evaluator: EvaluatorAsyncFunction, 261 | thisStack: any[], 262 | expr: SequenceExpression, 263 | evalContext: BindingTreeEvaluationContext, 264 | thread: LogicalThread, 265 | ): Promise<any> { 266 | if (!expr.exprs || expr.exprs.length === 0) { 267 | throw new Error(`Missing expression sequence`); 268 | } 269 | const result = expr.exprs.map(async (e) => { 270 | const value = await evaluator(thisStack, e, evalContext, thread); 271 | setExprValue(e, { value }, thread); 272 | thisStack.pop(); 273 | return value; 274 | }); 275 | const lastObj = result[result.length - 1]; 276 | thisStack.push(lastObj); 277 | return lastObj; 278 | } 279 | 280 | async function evalArrayLiteralAsync( 281 | evaluator: EvaluatorAsyncFunction, 282 | thisStack: any[], 283 | expr: ArrayLiteral, 284 | evalContext: BindingTreeEvaluationContext, 285 | thread: LogicalThread, 286 | ): Promise<any> { 287 | const value: any[] = []; 288 | for (const item of expr.items) { 289 | if (item.type === T_SPREAD_EXPRESSION) { 290 | const spreadArray = await evaluator(thisStack, item.expr, evalContext, thread); 291 | thisStack.pop(); 292 | if (!Array.isArray(spreadArray)) { 293 | throw new Error("Spread operator within an array literal expects an array operand."); 294 | } 295 | value.push(...spreadArray); 296 | } else { 297 | value.push(await evaluator(thisStack, item, evalContext, thread)); 298 | thisStack.pop(); 299 | thisStack.push(value); 300 | } 301 | } 302 | 303 | // --- Done. 304 | setExprValue(expr, { value }, thread); 305 | thisStack.push(value); 306 | return value; 307 | } 308 | 309 | async function evalObjectLiteralAsync( 310 | evaluator: EvaluatorAsyncFunction, 311 | thisStack: any[], 312 | expr: ObjectLiteral, 313 | evalContext: BindingTreeEvaluationContext, 314 | thread: LogicalThread, 315 | ): Promise<any> { 316 | const objectHash: any = {}; 317 | for (const prop of expr.props) { 318 | if (!Array.isArray(prop)) { 319 | // --- We're using a spread expression 320 | const spreadItems = await evaluator(thisStack, prop.expr, evalContext, thread); 321 | thisStack.pop(); 322 | if (Array.isArray(spreadItems)) { 323 | // --- Spread of an array 324 | for (let i = 0; i < spreadItems.length; i++) { 325 | objectHash[i] = spreadItems[i]; 326 | } 327 | } else if (typeof spreadItems === "object") { 328 | // --- Spread of a hash object 329 | for (const [key, value] of Object.entries(spreadItems)) { 330 | objectHash[key] = value; 331 | } 332 | } 333 | continue; 334 | } 335 | 336 | // --- We're using key/[value] pairs 337 | let key: any; 338 | switch (prop[0].type) { 339 | case T_LITERAL: 340 | key = prop[0].value; 341 | break; 342 | case T_IDENTIFIER: 343 | key = prop[0].name; 344 | break; 345 | default: 346 | key = await evaluator(thisStack, prop[0], evalContext, thread); 347 | thisStack.pop(); 348 | break; 349 | } 350 | objectHash[key] = await evaluator(thisStack, prop[1], evalContext, thread); 351 | thisStack.pop(); 352 | } 353 | 354 | // --- Done. 355 | setExprValue(expr, { value: objectHash }, thread); 356 | thisStack.push(objectHash); 357 | return objectHash; 358 | } 359 | 360 | async function evalUnaryAsync( 361 | evaluator: EvaluatorAsyncFunction, 362 | thisStack: any[], 363 | expr: UnaryExpression, 364 | evalContext: BindingTreeEvaluationContext, 365 | thread: LogicalThread, 366 | ): Promise<any> { 367 | await evaluator(thisStack, expr.expr, evalContext, thread); 368 | thisStack.pop(); 369 | await completeExprValue(expr.expr, thread); 370 | return evalUnaryCore(expr, thisStack, evalContext, thread); 371 | } 372 | 373 | async function evalBinaryAsync( 374 | evaluator: EvaluatorAsyncFunction, 375 | thisStack: any[], 376 | expr: BinaryExpression, 377 | evalContext: BindingTreeEvaluationContext, 378 | thread: LogicalThread, 379 | ): Promise<any> { 380 | await evaluator(thisStack, expr.left, evalContext, thread); 381 | thisStack.pop(); 382 | const l = await completeExprValue(expr.left, thread); 383 | if (expr.op === "&&" && !l) { 384 | setExprValue(expr, { value: l }, thread); 385 | return l; 386 | } 387 | if (expr.op === "||" && l) { 388 | setExprValue(expr, { value: l }, thread); 389 | return l; 390 | } 391 | await evaluator(thisStack, expr.right, evalContext, thread); 392 | thisStack.pop(); 393 | await completeExprValue(expr.right, thread); 394 | return evalBinaryCore(expr, thisStack, evalContext, thread); 395 | } 396 | 397 | async function evalConditionalAsync( 398 | evaluator: EvaluatorAsyncFunction, 399 | thisStack: any[], 400 | expr: ConditionalExpression, 401 | evalContext: BindingTreeEvaluationContext, 402 | thread: LogicalThread, 403 | ): Promise<any> { 404 | await evaluator(thisStack, expr.cond, evalContext, thread); 405 | thisStack.pop(); 406 | const condition = await completeExprValue(expr.cond, thread); 407 | const value = await evaluator( 408 | thisStack, 409 | condition ? expr.thenE : expr.elseE, 410 | evalContext, 411 | thread, 412 | ); 413 | setExprValue(expr, { value }, thread); 414 | return value; 415 | } 416 | 417 | async function evalAssignmentAsync( 418 | evaluator: EvaluatorAsyncFunction, 419 | thisStack: any[], 420 | expr: AssignmentExpression, 421 | evalContext: BindingTreeEvaluationContext, 422 | thread: LogicalThread, 423 | ): Promise<any> { 424 | const leftValue = expr.leftValue; 425 | const rootScope = getRootIdScope(leftValue, evalContext, thread); 426 | const updatesState = rootScope && rootScope.type !== "block"; 427 | if (updatesState && evalContext.onWillUpdate) { 428 | void evalContext.onWillUpdate(rootScope, rootScope.name, "assignment"); 429 | } 430 | await evaluator(thisStack, leftValue, evalContext, thread); 431 | thisStack.pop(); 432 | await completeExprValue(leftValue, thread); 433 | await evaluator(thisStack, expr.expr, evalContext, thread); 434 | thisStack.pop(); 435 | await completeExprValue(expr.expr, thread); 436 | const value = evalAssignmentCore(thisStack, expr, evalContext, thread); 437 | if (updatesState && evalContext.onDidUpdate) { 438 | void evalContext.onDidUpdate(rootScope, rootScope.name, "assignment"); 439 | } 440 | return value; 441 | } 442 | 443 | async function evalPreOrPostAsync( 444 | evaluator: EvaluatorAsyncFunction, 445 | thisStack: any[], 446 | expr: PrefixOpExpression | PostfixOpExpression, 447 | evalContext: BindingTreeEvaluationContext, 448 | thread: LogicalThread, 449 | ): Promise<any> { 450 | const rootScope = getRootIdScope(expr.expr, evalContext, thread); 451 | const updatesState = rootScope && rootScope.type !== "block"; 452 | if (updatesState && evalContext.onWillUpdate) { 453 | void evalContext.onWillUpdate(rootScope, rootScope.name, "pre-post"); 454 | } 455 | await evaluator(thisStack, expr.expr, evalContext, thread); 456 | thisStack.pop(); 457 | await completeExprValue(expr.expr, thread); 458 | const value = evalPreOrPostCore(thisStack, expr, evalContext, thread); 459 | if (updatesState && evalContext.onDidUpdate) { 460 | void evalContext.onDidUpdate(rootScope, rootScope.name, "pre-post"); 461 | } 462 | return value; 463 | } 464 | 465 | async function evalFunctionInvocationAsync( 466 | evaluator: EvaluatorAsyncFunction, 467 | thisStack: any[], 468 | expr: FunctionInvocationExpression, 469 | evalContext: BindingTreeEvaluationContext, 470 | thread: LogicalThread, 471 | ): Promise<any> { 472 | let functionObj: any; 473 | let implicitContextObject: any = null; 474 | 475 | // --- Check for contexted object 476 | if (expr.obj.type === T_MEMBER_ACCESS_EXPRESSION) { 477 | const hostObject = await evaluator(thisStack, expr.obj.obj, evalContext, thread); 478 | await completeExprValue(expr.obj.obj, thread); 479 | functionObj = evalMemberAccessCore(thisStack, expr.obj, evalContext, thread); 480 | if (expr.obj.obj.type === T_IDENTIFIER && hostObject?._SUPPORT_IMPLICIT_CONTEXT) { 481 | implicitContextObject = hostObject; 482 | } 483 | } else { 484 | // --- Get the object on which to invoke the function 485 | await evaluator(thisStack, expr.obj, evalContext, thread); 486 | functionObj = await completeExprValue(expr.obj, thread); 487 | } 488 | thisStack.pop(); 489 | 490 | // --- Keep function arguments here, we pass it to the function later 491 | const functionArgs: any[] = []; 492 | 493 | // --- The functionObj may be an ArrowExpression. In this care we need to create the invokable arrow function 494 | if (functionObj?._ARROW_EXPR_) { 495 | functionArgs.push( 496 | functionObj.args, 497 | evalContext, 498 | thread, 499 | ...expr.arguments.map((a) => ({ ...a, _EXPRESSION_: true })), 500 | ); 501 | functionObj = await createArrowFunctionAsync(evaluator, functionObj as ArrowExpression); 502 | } else if (expr.obj.type === T_ARROW_EXPRESSION) { 503 | // --- We delay evaluating expression values. We pass the argument names as the first parameter, and then 504 | // --- all parameter expressions 505 | functionArgs.push( 506 | expr.obj.args.map((a) => (a as Identifier).name), 507 | evalContext, 508 | thread, 509 | ...expr.arguments.map((a) => ({ ...a, _EXPRESSION_: true })), 510 | ); 511 | } else { 512 | // --- We evaluate the argument values to pass to a JavaScript function 513 | for (let i = 0; i < expr.arguments.length; i++) { 514 | const arg = expr.arguments[i]; 515 | if (arg.type === T_SPREAD_EXPRESSION) { 516 | await evaluator([], arg.expr, evalContext, thread); 517 | const funcArg = await completeExprValue(arg.expr, thread); 518 | if (!Array.isArray(funcArg)) { 519 | throw new Error("Spread operator within a function invocation expects an array operand."); 520 | } 521 | functionArgs.push(...funcArg); 522 | } else { 523 | if (arg.type === T_ARROW_EXPRESSION) { 524 | const funcArg = createArrowFunctionAsync(evaluator, arg); 525 | const wrappedFunc = (...args: any[]) => { 526 | return funcArg(arg.args, evalContext, thread, ...args); 527 | }; 528 | functionArgs.push(wrappedFunc); 529 | } else { 530 | await evaluator([], arg, evalContext, thread); 531 | const funcArg = await completeExprValue(arg, thread); 532 | if (funcArg?._ARROW_EXPR_) { 533 | const wrappedFuncArg = createArrowFunctionAsync(evaluator, funcArg); 534 | const wrappedFunc = (...args: any[]) => 535 | wrappedFuncArg(funcArg.args, evalContext, thread, ...args); 536 | functionArgs.push(wrappedFunc); 537 | } else { 538 | functionArgs.push(funcArg); 539 | } 540 | } 541 | } 542 | } 543 | 544 | // --- We can pass implicit arguments to JavaScript function 545 | if (implicitContextObject) { 546 | // --- Let's obtain the implicit context 547 | if (evalContext.implicitContextGetter) { 548 | const implicitContext = evalContext.implicitContextGetter(implicitContextObject); 549 | functionArgs.unshift(implicitContext); 550 | } else { 551 | throw new Error("Cannot use implicitContextGetter, it is undefined"); 552 | } 553 | } 554 | } 555 | 556 | // --- Check if the function is banned from running 557 | const bannedInfo = isBannedFunction(functionObj); 558 | if (bannedInfo.banned) { 559 | throw new Error( 560 | `Function ${bannedInfo.func?.name ?? "unknown"} is not allowed to call. ${bannedInfo?.help ?? ""}`, 561 | ); 562 | } 563 | 564 | // --- We use context for "this" 565 | const currentContext = thisStack.length > 0 ? thisStack.pop() : evalContext.localContext; 566 | 567 | // --- We need to use proxies for JavaScript functions (such as Array.prototype.filter) not supporting 568 | // --- async arguments 569 | functionObj = getAsyncProxy(functionObj, functionArgs, currentContext); 570 | 571 | // --- Now, invoke the function 572 | const rootScope = getRootIdScope(expr.obj, evalContext, thread); 573 | const updatesState = rootScope && rootScope.type !== "block"; 574 | if (updatesState && evalContext.onWillUpdate) { 575 | void evalContext.onWillUpdate(rootScope, rootScope.name, "function-call"); 576 | } 577 | const value = evalContext.options?.defaultToOptionalMemberAccess 578 | ? (functionObj as Function)?.call(currentContext, ...functionArgs) 579 | : (functionObj as Function).call(currentContext, ...functionArgs); 580 | 581 | let returnValue = await completePromise(value); 582 | if (updatesState && evalContext.onDidUpdate) { 583 | void evalContext.onDidUpdate(rootScope, rootScope.name, "function-call"); 584 | } 585 | 586 | // --- Done. 587 | setExprValue(expr, { value: returnValue }, thread); 588 | thisStack.push(returnValue); 589 | return returnValue; 590 | } 591 | 592 | function createArrowFunctionAsync( 593 | evaluator: EvaluatorAsyncFunction, 594 | expr: ArrowExpression, 595 | ): Function { 596 | // --- Use this function, it evaluates the arrow function 597 | return async (...args: any[]) => { 598 | // --- Prepare the variables to pass 599 | const runTimeEvalContext = args[1] as BindingTreeEvaluationContext; 600 | const runtimeThread = args[2] as LogicalThread; 601 | 602 | // --- Create the thread that runs the arrow function 603 | const workingThread: LogicalThread = { 604 | parent: runtimeThread, 605 | childThreads: [], 606 | blocks: [{ vars: {} }], 607 | loops: [], 608 | breakLabelValue: -1, 609 | closures: (expr as any).closureContext, 610 | }; 611 | runtimeThread.childThreads.push(workingThread); 612 | 613 | // --- Create a block for a named arrow function 614 | if (expr.name) { 615 | const functionBlock: BlockScope = { vars: {} }; 616 | workingThread.blocks ??= []; 617 | workingThread.blocks.push(functionBlock); 618 | functionBlock.vars[expr.name] = expr; 619 | functionBlock.constVars = new Set([expr.name]); 620 | } 621 | 622 | // --- Assign argument values to names 623 | const arrowBlock: BlockScope = { vars: {} }; 624 | workingThread.blocks ??= []; 625 | workingThread.blocks.push(arrowBlock); 626 | const argSpecs = args[0] as Expression[]; 627 | let restFound = false; 628 | for (let i = 0; i < argSpecs.length; i++) { 629 | // --- Turn argument specification into processable variable declarations 630 | const argSpec = argSpecs[i]; 631 | let decl: VarDeclaration | undefined; 632 | switch (argSpec.type) { 633 | case T_IDENTIFIER: { 634 | decl = { 635 | type: T_VAR_DECLARATION, 636 | id: argSpec.name, 637 | } as VarDeclaration; 638 | break; 639 | } 640 | case T_DESTRUCTURE: { 641 | decl = { 642 | type: T_VAR_DECLARATION, 643 | id: argSpec.id, 644 | aDestr: argSpec.aDestr, 645 | oDestr: argSpec.oDestr, 646 | } as VarDeclaration; 647 | break; 648 | } 649 | case T_SPREAD_EXPRESSION: { 650 | restFound = true; 651 | decl = { 652 | type: T_VAR_DECLARATION, 653 | id: (argSpec.expr as unknown as Identifier).name, 654 | } as VarDeclaration; 655 | break; 656 | } 657 | 658 | default: 659 | throw new Error("Unexpected arrow argument specification"); 660 | } 661 | 662 | if (decl) { 663 | if (restFound) { 664 | // --- Get the rest of the arguments 665 | const restArgs = args.slice(i + 3); 666 | let argVals: any[] = []; 667 | for (const arg of restArgs) { 668 | if (arg?._EXPRESSION_) { 669 | argVals.push(await evaluator([], arg, runTimeEvalContext, runtimeThread)); 670 | } else { 671 | argVals.push(arg); 672 | } 673 | } 674 | await processDeclarationsAsync( 675 | arrowBlock, 676 | runTimeEvalContext, 677 | runtimeThread, 678 | [decl], 679 | false, 680 | true, 681 | argVals, 682 | ); 683 | } else { 684 | // --- Get the actual value to work with 685 | let argVal = args[i + 3]; 686 | if (argVal?._EXPRESSION_) { 687 | argVal = await evaluator([], argVal, runTimeEvalContext, runtimeThread); 688 | } 689 | await processDeclarationsAsync( 690 | arrowBlock, 691 | runTimeEvalContext, 692 | runtimeThread, 693 | [decl], 694 | false, 695 | true, 696 | argVal, 697 | ); 698 | } 699 | } 700 | } 701 | 702 | // --- Evaluate the arrow expression body 703 | let returnValue: any; 704 | let statements: Statement[]; 705 | 706 | switch (expr.statement.type) { 707 | case T_EMPTY_STATEMENT: 708 | statements = []; 709 | break; 710 | case T_EXPRESSION_STATEMENT: 711 | // --- Create a new thread for the call 712 | statements = [ 713 | { 714 | type: T_RETURN_STATEMENT, 715 | expr: expr.statement.expr, 716 | } as ReturnStatement, 717 | ]; 718 | break; 719 | case T_BLOCK_STATEMENT: 720 | // --- Create a new thread for the call 721 | statements = expr.statement.stmts; 722 | break; 723 | default: 724 | throw new Error( 725 | `Arrow expression with a body of '${expr.statement.type}' is not supported yet.`, 726 | ); 727 | } 728 | 729 | // --- Process the statement with a new processor 730 | await processStatementQueueAsync(statements, runTimeEvalContext, workingThread); 731 | 732 | // --- Return value is in a return value slot 733 | returnValue = workingThread.returnValue; 734 | 735 | // --- Remove the current working thread 736 | const workingIndex = runtimeThread.childThreads.indexOf(workingThread); 737 | if (workingIndex < 0) { 738 | throw new Error("Cannot find thread to remove."); 739 | } 740 | runtimeThread.childThreads.splice(workingIndex, 1); 741 | 742 | // --- Remove the function level block 743 | workingThread.blocks.pop(); 744 | 745 | // --- Return the function value 746 | return returnValue; 747 | }; 748 | } 749 | 750 | // --- Completes all promises within the input 751 | function completePromise(input: any): Promise<any> { 752 | const visited = new Map<any, any>(); 753 | 754 | return completePromiseInternal(input); 755 | 756 | async function completePromiseInternal(input: any): Promise<any> { 757 | // --- No need to resolve undefined or null 758 | if (input === undefined || input === null) return input; 759 | 760 | // --- Already visited? 761 | const resolved = visited.get(input); 762 | if (resolved) return resolved; 763 | 764 | // --- Resolve the chain of promises 765 | if (isPromise(input)) { 766 | const awaited = await input; 767 | visited.set(input, awaited); 768 | return completePromiseInternal(awaited); 769 | } 770 | 771 | // --- In any other cases, we keep the input reference 772 | visited.set(input, input); 773 | 774 | // --- Resolve promises within an array 775 | if (Array.isArray(input)) { 776 | for (let i = 0; i < input.length; i++) { 777 | const completedPromise = await completePromiseInternal(input[i]); 778 | if (input[i] !== completedPromise) { 779 | //prevent write if it's the same reference (can cause problems in frozen objects) 780 | input.splice(i, 1, completedPromise); 781 | } 782 | } 783 | return input; 784 | } 785 | 786 | // --- Resolve promises in object properties 787 | if (isPlainObject(input)) { 788 | for (const key of Object.keys(input)) { 789 | let completedPromise = await completePromiseInternal(input[key]); 790 | if (input[key] !== completedPromise) { 791 | //prevent write if it's the same reference (can cause problems in frozen objects) 792 | input[key] = completedPromise; 793 | } 794 | } 795 | return input; 796 | } 797 | 798 | // --- Done. 799 | return input; 800 | } 801 | } 802 | 803 | async function evalTemplateLiteralAsync( 804 | evaluator: EvaluatorAsyncFunction, 805 | thisStack: any[], 806 | expr: TemplateLiteralExpression, 807 | evalContext: BindingTreeEvaluationContext, 808 | thread: LogicalThread, 809 | ): Promise<any> { 810 | const segmentValues = new Array(expr.segments.length); 811 | for (let i = 0; i < expr.segments.length; ++i) { 812 | await evaluator(thisStack, expr.segments[i], evalContext, thread); 813 | thisStack.pop(); 814 | const evaledValue = await completeExprValue(expr.segments[i], thread); 815 | segmentValues[i] = evaledValue; 816 | } 817 | const value = evalTemplateLiteralCore(segmentValues); 818 | setExprValue(expr, { value }, thread); 819 | thisStack.push(value); 820 | return value; 821 | } 822 | 823 | export async function completeExprValue(expr: Expression, thread: LogicalThread): Promise<any> { 824 | const exprValue = getExprValue(expr, thread); 825 | const awaited = await completePromise(exprValue?.value); 826 | setExprValue(expr, { ...exprValue, value: awaited }, thread); 827 | return awaited; 828 | } 829 | ``` -------------------------------------------------------------------------------- /xmlui/src/components-core/theming/transformThemeVars.ts: -------------------------------------------------------------------------------- ```typescript 1 | import Color from "color"; 2 | 3 | import { type HVar, parseHVar } from "../theming/hvar"; 4 | import { StyleParser } from "../../parsers/style-parser/StyleParser"; 5 | import { toCssVar } from "./layout-resolver"; 6 | 7 | export function isThemeVarName(varName: any) { 8 | return typeof varName === "string" && varName?.startsWith("$"); 9 | } 10 | 11 | export function resolveThemeVar( 12 | varName: string | undefined, 13 | theme: Record<string, string> = {}, 14 | ): string { 15 | let safeVarName = varName; 16 | if (isThemeVarName(varName)) { 17 | safeVarName = varName.substring(1); 18 | } 19 | const value = theme[safeVarName]; 20 | if (typeof value === "string" && isThemeVarName(value)) { 21 | return resolveThemeVar(value, theme); 22 | } 23 | return value; 24 | } 25 | 26 | export function generateBaseTones(theme: Record<string, string> | undefined) { 27 | if (!theme) { 28 | return {}; 29 | } 30 | const resolvedTheme = resolveThemeVars(theme); 31 | return { 32 | ...generateBaseTonesForColor("color-primary", resolvedTheme), 33 | ...generateBaseTonesForColor("color-secondary", resolvedTheme), 34 | ...generateBaseTonesForColor("color-info", resolvedTheme), 35 | ...generateBaseTonesForColor("color-success", resolvedTheme), 36 | ...generateBaseTonesForColor("color-warn", resolvedTheme), 37 | ...generateBaseTonesForColor("color-danger", resolvedTheme), 38 | ...generateBaseTonesForColor("color-surface", resolvedTheme, { distributeEven: true }), 39 | }; 40 | } 41 | 42 | export function generateBaseSpacings(theme: Record<string, string> | undefined) { 43 | if (!theme) { 44 | return {}; 45 | } 46 | const resolvedTheme = resolveThemeVars(theme); 47 | const base = resolvedTheme["space-base"]; 48 | if (!base || typeof base !== "string") { 49 | return {}; 50 | } 51 | let baseTrimmed = base.trim(); 52 | if (baseTrimmed.startsWith(".")) { 53 | //if we have something like .5rem 54 | baseTrimmed = `0${baseTrimmed}`; 55 | } 56 | const baseNum = parseFloat(baseTrimmed); 57 | let baseUnit = baseTrimmed.replace(baseNum + "", "") || "px"; 58 | 59 | // a) non-baseNum -> "0px" 60 | if (Number.isNaN(baseNum)) { 61 | return {}; 62 | } 63 | 64 | const scale = [ 65 | 0, 0.5, 1, 1.5, 2, 2.5, 3, 3.5, 4, 5, 6, 7, 8, 9, 10, 11, 12, 14, 16, 20, 24, 28, 32, 36, 40, 66 | 44, 48, 52, 56, 60, 64, 72, 80, 96, 67 | ]; 68 | const ret: Record<string, string> = {}; 69 | 70 | scale.forEach((step) => { 71 | ret[`space-${(step + "").replace(".", "_")}`] = `${step * baseNum}${baseUnit}`; 72 | }); 73 | 74 | return ret; 75 | } 76 | 77 | export function generateBaseFontSizes(theme: Record<string, string> | undefined) { 78 | if (!theme) { 79 | return {}; 80 | } 81 | const resolvedTheme = resolveThemeVars(theme); 82 | const base = resolvedTheme["fontSize"]; 83 | if (!base || typeof base !== "string") { 84 | return {}; 85 | } 86 | 87 | let baseTrimmed = base.trim(); 88 | if (baseTrimmed.startsWith(".")) { 89 | //if we have something like .5rem 90 | baseTrimmed = `0${baseTrimmed}`; 91 | } 92 | const baseNum = parseFloat(baseTrimmed); 93 | let baseUnit = baseTrimmed.replace(baseNum + "", "") || "px"; 94 | 95 | // a) non-baseNum -> "0px" 96 | if (Number.isNaN(baseNum)) { 97 | return {}; 98 | } 99 | const ret: Record<string, string> = {}; 100 | ret[`fontSize-tiny`] = `${0.625 * baseNum}${baseUnit}`; 101 | ret[`fontSize-xs`] = `${0.75 * baseNum}${baseUnit}`; 102 | ret[`fontSize-code`] = `${0.85 * baseNum}${baseUnit}`; 103 | ret[`fontSize-sm`] = `${0.875 * baseNum}${baseUnit}`; 104 | ret[`fontSize-base`] = base; 105 | ret[`fontSize-lg`] = `${1.125 * baseNum}${baseUnit}`; 106 | ret[`fontSize-xl`] = `${1.25 * baseNum}${baseUnit}`; 107 | ret[`fontSize-2xl`] = `${1.5 * baseNum}${baseUnit}`; 108 | ret[`fontSize-3xl`] = `${1.875 * baseNum}${baseUnit}`; 109 | ret[`fontSize-4xl`] = `${2.25 * baseNum}${baseUnit}`; 110 | ret[`fontSize-5xl`] = `${3 * baseNum}${baseUnit}`; 111 | ret[`fontSize-6xl`] = `${3.75 * baseNum}${baseUnit}`; 112 | ret[`fontSize-7xl`] = `${4.5 * baseNum}${baseUnit}`; 113 | ret[`fontSize-8xl`] = `${6 * baseNum}${baseUnit}`; 114 | ret[`fontSize-9xl`] = `${8 * baseNum}${baseUnit}`; 115 | 116 | return ret; 117 | } 118 | 119 | export function generateTextFontSizes(theme: Record<string, string> | undefined) { 120 | if (!theme) { 121 | return {}; 122 | } 123 | const resolvedTheme = resolveThemeVars(theme); 124 | const base = resolvedTheme["fontSize-Text"]; 125 | if (!base || typeof base !== "string") { 126 | return {}; 127 | } 128 | 129 | // --- Get the CSS variable name of fontSize-Text-keyboard 130 | 131 | const ret: Record<string, string> = {}; 132 | ret[`fontSize-Text-keyboard`] = `calc(${toCssVar("$fontSize-Text")} * 0.875)`; 133 | ret[`fontSize-Text-sample`] = `calc(${toCssVar("$fontSize-Text")} * 0.875)`; 134 | ret[`fontSize-Text-sup`] = `calc(${toCssVar("$fontSize-Text")} * 0.625)`; 135 | ret[`fontSize-Text-sub`] = `calc(${toCssVar("$fontSize-Text")} * 0.625)`; 136 | ret[`fontSize-Text-title`] = `calc(${toCssVar("$fontSize-Text")} * 1.5)`; 137 | ret[`fontSize-Text-subtitle`] = `calc(${toCssVar("$fontSize-Text")} * 1.25)`; 138 | ret[`fontSize-Text-small`] = `calc(${toCssVar("$fontSize-Text")} * 0.875)`; 139 | ret[`fontSize-Text-placeholder`] = `calc(${toCssVar("$fontSize-Text")} * 0.875)`; 140 | ret[`fontSize-Text-paragraph`] = toCssVar("$fontSize-Text"); 141 | ret[`fontSize-Text-subheading`] = `calc(${toCssVar("$fontSize-Text")} * 0.625)`; 142 | ret[`fontSize-Text-tableheading`] = `calc(${toCssVar("$fontSize-Text")} * 0.625)`; 143 | ret[`fontSize-Text-secondary`] = `calc(${toCssVar("$fontSize-Text")} * 0.875)`; 144 | 145 | return ret; 146 | } 147 | 148 | export function generateButtonTones(theme?: Record<string, string>) { 149 | if (!theme) { 150 | return {}; 151 | } 152 | const resolvedTheme = resolveThemeVars(theme); 153 | const variants = ["primary", "secondary", "attention"]; 154 | 155 | let ret = {}; 156 | 157 | variants.forEach((variant) => { 158 | const solidTones = mapTones( 159 | findClosest(resolvedTheme, `color-Button-${variant}-solid`), 160 | (tones) => { 161 | return { 162 | [`backgroundColor-Button-${variant}-solid`]: tones.base, 163 | [`backgroundColor-Button-${variant}-solid--hover`]: tones.tone1, 164 | [`backgroundColor-Button-${variant}-solid--active`]: tones.tone2, 165 | [`borderColor-Button-${variant}-solid`]: tones.base, 166 | [`borderColor-Button-${variant}-solid--hover`]: tones.base, 167 | [`borderColor-Button-${variant}-solid--active`]: tones.base, 168 | [`textColor-Button-${variant}-solid`]: tones.tone3, 169 | [`textColor-Button-${variant}-solid--hover`]: tones.tone3, 170 | [`textColor-Button-${variant}-solid--active`]: tones.tone3, 171 | }; 172 | }, 173 | ); 174 | 175 | const outlinedTones = mapTones( 176 | findClosest(resolvedTheme, `color-Button-${variant}-outlined`), 177 | (tones) => { 178 | return { 179 | [`backgroundColor-Button-${variant}-outlined--hover`]: tones.alpha1, 180 | [`backgroundColor-Button-${variant}-outlined--active`]: tones.alpha2, 181 | [`borderColor-Button-${variant}-outlined`]: tones.base, 182 | [`borderColor-Button-${variant}-outlined--hover`]: tones.tone1, 183 | [`borderColor-Button-${variant}-outlined--active`]: tones.tone2, 184 | [`textColor-Button-${variant}-outlined`]: tones.base, 185 | [`textColor-Button-${variant}-outlined--hover`]: tones.tone1, 186 | [`textColor-Button-${variant}-outlined--active`]: tones.tone2, 187 | }; 188 | }, 189 | ); 190 | 191 | const ghostTones = mapTones( 192 | findClosest(resolvedTheme, `color-Button-${variant}-ghost`), 193 | (tones) => { 194 | return { 195 | [`backgroundColor-Button-${variant}-ghost--active`]: tones.alpha2, 196 | [`backgroundColor-Button-${variant}-ghost--hover`]: tones.alpha1, 197 | [`textColor-Button-${variant}-ghost`]: tones.base, 198 | [`textColor-Button-${variant}-ghost--hover`]: tones.tone1, 199 | [`textColor-Button-${variant}-ghost--active`]: tones.tone2, 200 | }; 201 | }, 202 | ); 203 | ret = { 204 | ...ret, 205 | ...solidTones, 206 | ...outlinedTones, 207 | ...ghostTones, 208 | }; 209 | }); 210 | return ret; 211 | } 212 | 213 | const paddingRegEx = /^padding-(?!(?:horizontal|vertical|left|right|top|bottom)-)(.+)$/; 214 | const paddingHorizontalRegEx = /^paddingHorizontal-(.+)$/; 215 | const paddingVerticalRegEx = /^paddingVertical-(.+)$/; 216 | 217 | /** 218 | * Segment the padding values into top, right, bottom, left to provide consistency 219 | */ 220 | export function generatePaddingSegments(theme?: Record<string, string>) { 221 | if (!theme) { 222 | return {}; 223 | } 224 | const result = { ...theme }; 225 | 226 | // --- Iterate through theme variables and split padding values 227 | Object.entries(theme).forEach(([key, value]) => { 228 | if (value === null || value === undefined) { 229 | // --- We want to allow theme files to use null or undefined as a synonim for 230 | // --- "pretend this theme variable is not defined". 231 | delete result[key]; 232 | return; 233 | } 234 | 235 | // --- Check the "paddingHorizontal" theme variables 236 | let match = paddingHorizontalRegEx.exec(key); 237 | if (match) { 238 | // --- We have a paddingHorizontal value to segment 239 | const remainder = match[1]; 240 | result[`paddingLeft-${remainder}`] ??= value; 241 | result[`paddingRight-${remainder}`] ??= value; 242 | } 243 | 244 | // --- Check the "paddingVertical" theme variables 245 | match = paddingVerticalRegEx.exec(key); 246 | if (match) { 247 | // --- We have a paddingVertical value to segment 248 | const remainder = match[1]; 249 | result[`paddingTop-${remainder}`] ??= value; 250 | result[`paddingBottom-${remainder}`] ??= value; 251 | } 252 | 253 | // --- Check the "padding" theme variables 254 | match = paddingRegEx.exec(key); 255 | if (!match) return; 256 | const remainder = match[1]; 257 | 258 | // --- Check for horizontal and vertical padding values 259 | const horizontal = theme[`paddingHorizontal-${remainder}`]; 260 | const vertical = theme[`paddingVertical-${remainder}`]; 261 | 262 | // --- We have a padding value to segment 263 | const segments = value.trim().replace(/ +/g, " ").split(" "); 264 | switch (segments.length) { 265 | case 1: 266 | result[`paddingTop-${remainder}`] ??= vertical ?? segments[0]; 267 | result[`paddingRight-${remainder}`] ??= horizontal ?? segments[0]; 268 | result[`paddingBottom-${remainder}`] ??= vertical ?? segments[0]; 269 | result[`paddingLeft-${remainder}`] ??= horizontal ?? segments[0]; 270 | break; 271 | case 2: 272 | result[`paddingTop-${remainder}`] ??= vertical ?? segments[0]; 273 | result[`paddingRight-${remainder}`] ??= horizontal ?? segments[1]; 274 | result[`paddingBottom-${remainder}`] ??= vertical ?? segments[0]; 275 | result[`paddingLeft-${remainder}`] ??= horizontal ?? segments[1]; 276 | break; 277 | case 3: 278 | result[`paddingTop-${remainder}`] ??= vertical ?? segments[0]; 279 | result[`paddingRight-${remainder}`] ??= horizontal ?? segments[1]; 280 | result[`paddingBottom-${remainder}`] ??= vertical ?? segments[2]; 281 | result[`paddingLeft-${remainder}`] ??= horizontal ?? segments[1]; 282 | break; 283 | case 4: 284 | result[`paddingTop-${remainder}`] ??= vertical ?? segments[0]; 285 | result[`paddingRight-${remainder}`] ??= horizontal ?? segments[1]; 286 | result[`paddingBottom-${remainder}`] ??= vertical ?? segments[2]; 287 | result[`paddingLeft-${remainder}`] ??= horizontal ?? segments[3]; 288 | break; 289 | default: 290 | return; 291 | } 292 | }); 293 | 294 | // --- Done 295 | return result; 296 | } 297 | 298 | const borderRegEx = /^border-(.+)$/; 299 | const thicknessBorderRegEx = /^borderWidth-(.+)$/; 300 | const thicknessBorderHorizontalRegEx = /^borderHorizontalWidth-(.+)$/; 301 | const thicknessBorderVerticalRegEx = /^borderVerticalWidth-(.+)$/; 302 | const styleBorderRegEx = /^borderStyle-(.+)$/; 303 | const styleBorderHorizontalRegEx = /^borderHorizontalStyle-(.+)$/; 304 | const styleBorderVerticalRegEx = /^borderVerticalStyle-(.+)$/; 305 | const borderLeftRegEx = /^borderLeft-(.+)$/; 306 | const borderRightRegEx = /^borderRight-(.+)$/; 307 | const borderTopRegEx = /^borderTop-(.+)$/; 308 | const borderBottomRegEx = /^borderBottom-(.+)$/; 309 | const borderHorizontalRegEx = /^borderHorizontal-(.+)$/; 310 | const borderVerticalRegEx = /^borderVertical-(.+)$/; 311 | const colorBorderRegEx = /^borderColor-(.+)$/; 312 | const colorBorderHorizontalRegEx = /^borderHorizontalColor-(.+)$/; 313 | const colorBorderVerticalRegEx = /^borderVerticalColor-(.+)$/; 314 | 315 | /** 316 | * Segment the border values to provide consistency 317 | */ 318 | export function generateBorderSegments(theme?: Record<string, string>) { 319 | if (!theme) { 320 | return {}; 321 | } 322 | const result = { ...theme }; 323 | 324 | // --- Iterate through theme variables and split border values 325 | Object.entries(theme).forEach(([key, value]) => { 326 | // --- Check "border-" theme variables 327 | let match = borderRegEx.exec(key); 328 | if (match) { 329 | const remainder = match[1]; 330 | 331 | // --- Flow down the border value 332 | result[`borderLeft-${remainder}`] = value; 333 | result[`borderRight-${remainder}`] = value; 334 | result[`borderTop-${remainder}`] = value; 335 | result[`borderBottom-${remainder}`] = value; 336 | 337 | // --- We have a border value to segment 338 | const border = getBorderSegments(value); 339 | result[`borderWidth-${remainder}`] ??= border.thickness; 340 | result[`borderStyle-${remainder}`] ??= border.style; 341 | result[`borderColor-${remainder}`] ??= border.color; 342 | } 343 | 344 | // --- Check "borderWidth-" theme variables 345 | match = thicknessBorderRegEx.exec(key); 346 | if (match) { 347 | // --- We have a borderWidth value to flow down 348 | const remainder = match[1]; 349 | result[`borderLeftWidth-${remainder}`] = value; 350 | result[`borderRightWidth-${remainder}`] = value; 351 | result[`borderTopWidth-${remainder}`] = value; 352 | result[`borderBottomWidth-${remainder}`] = value; 353 | } 354 | 355 | // --- Check "borderStyle-" theme variables 356 | match = styleBorderRegEx.exec(key); 357 | if (match) { 358 | // --- We have a borderStyle value to flow down 359 | const remainder = match[1]; 360 | result[`borderLeftStyle-${remainder}`] = value; 361 | result[`borderRightStyle-${remainder}`] = value; 362 | result[`borderTopStyle-${remainder}`] = value; 363 | result[`borderBottomStyle-${remainder}`] = value; 364 | } 365 | 366 | // --- Check "borderColor-" theme variables 367 | match = colorBorderRegEx.exec(key); 368 | if (match) { 369 | // --- We have a borderColor value to flow down 370 | const remainder = match[1]; 371 | result[`borderLeftColor-${remainder}`] = value; 372 | result[`borderRightColor-${remainder}`] = value; 373 | result[`borderTopColor-${remainder}`] = value; 374 | result[`borderBottomColor-${remainder}`] = value; 375 | } 376 | 377 | // --- Check "borderHorizontal" theme variables 378 | match = borderHorizontalRegEx.exec(key); 379 | if (match) { 380 | // --- We have a borderHorizontal value to segment 381 | const remainder = match[1]; 382 | 383 | // --- Flow down the border value 384 | result[`borderLeft-${remainder}`] = value; 385 | result[`borderRight-${remainder}`] = value; 386 | 387 | const border = getBorderSegments(value); 388 | if (border.thickness) { 389 | result[`borderLeftWidth-${remainder}`] = border.thickness; 390 | result[`borderRightWidth-${remainder}`] = border.thickness; 391 | } 392 | if (border.style) { 393 | result[`borderLeftStyle-${remainder}`] = border.style; 394 | result[`borderRightStyle-${remainder}`] = border.style; 395 | } 396 | if (border.color) { 397 | result[`borderLeftColor-${remainder}`] = border.color; 398 | result[`borderRightColor-${remainder}`] = border.color; 399 | } 400 | } 401 | 402 | // --- Check "borderVertical" theme variables 403 | match = borderVerticalRegEx.exec(key); 404 | if (match) { 405 | // --- We have a borderVertical value to segment 406 | const remainder = match[1]; 407 | // --- Flow down the border value 408 | result[`borderTop-${remainder}`] = value; 409 | result[`borderBottom-${remainder}`] = value; 410 | 411 | const border = getBorderSegments(value); 412 | if (border.thickness) { 413 | result[`borderTopWidth-${remainder}`] = border.thickness; 414 | result[`borderBottomWidth-${remainder}`] = border.thickness; 415 | } 416 | if (border.style) { 417 | result[`borderTopStyle-${remainder}`] = border.style; 418 | result[`borderBottomStyle-${remainder}`] = border.style; 419 | } 420 | if (border.color) { 421 | result[`borderTopColor-${remainder}`] = border.color; 422 | result[`borderBottomColor-${remainder}`] = border.color; 423 | } 424 | } 425 | 426 | // --- Check "borderLeft" theme variables 427 | match = borderLeftRegEx.exec(key); 428 | if (match) { 429 | // --- We have a borderLeft value to segment 430 | const remainder = match[1]; 431 | const border = getBorderSegments(value); 432 | if (border.thickness && !theme[`borderLeftWidth-${remainder}`]) { 433 | result[`borderLeftWidth-${remainder}`] = border.thickness; 434 | } 435 | if (border.style && !theme[`borderLeftStyle-${remainder}`]) { 436 | result[`borderLeftStyle-${remainder}`] = border.style; 437 | } 438 | if (border.color && !theme[`borderLeftColor-${remainder}`]) { 439 | result[`borderLeftColor-${remainder}`] = border.color; 440 | } 441 | } 442 | 443 | // --- Check "borderRight" theme variables 444 | match = borderRightRegEx.exec(key); 445 | if (match) { 446 | // --- We have a borderRight value to segment 447 | const remainder = match[1]; 448 | const border = getBorderSegments(value); 449 | if (border.thickness) { 450 | result[`borderRightWidth-${remainder}`] = border.thickness; 451 | } 452 | if (border.style) { 453 | result[`borderRightStyle-${remainder}`] = border.style; 454 | } 455 | if (border.color) { 456 | result[`borderRightColor-${remainder}`] = border.color; 457 | } 458 | } 459 | 460 | // --- Check "borderTop" theme variables 461 | match = borderTopRegEx.exec(key); 462 | if (match) { 463 | // --- We have a borderTop value to segment 464 | const remainder = match[1]; 465 | const border = getBorderSegments(value); 466 | if (border.thickness) { 467 | result[`borderTopWidth-${remainder}`] = border.thickness; 468 | } 469 | if (border.style) { 470 | result[`borderTopStyle-${remainder}`] = border.style; 471 | } 472 | if (border.color) { 473 | result[`borderTopColor-${remainder}`] = border.color; 474 | } 475 | } 476 | 477 | // --- Check "borderBottom" theme variables 478 | match = borderBottomRegEx.exec(key); 479 | if (match) { 480 | // --- We have a borderBottom value to segment 481 | const remainder = match[1]; 482 | const border = getBorderSegments(value); 483 | if (border.thickness) { 484 | result[`borderBottomWidth-${remainder}`] = border.thickness; 485 | } 486 | if (border.style) { 487 | result[`borderBottomStyle-${remainder}`] = border.style; 488 | } 489 | if (border.color) { 490 | result[`borderBottomColor-${remainder}`] = border.color; 491 | } 492 | } 493 | 494 | // --- Check "borderHorizontalWidth" theme variables 495 | match = thicknessBorderHorizontalRegEx.exec(key); 496 | if (match) { 497 | // --- We have a borderHorizontalWidth value to flow down 498 | const remainder = match[1]; 499 | result[`borderLeftWidth-${remainder}`] = value; 500 | result[`borderRightWidth-${remainder}`] = value; 501 | } 502 | 503 | // --- Check "borderVerticalWidth" theme variables 504 | match = thicknessBorderVerticalRegEx.exec(key); 505 | if (match) { 506 | // --- We have a borderVerticalWidth value to flow down 507 | const remainder = match[1]; 508 | result[`borderTopWidth-${remainder}`] = value; 509 | result[`borderBottomWidth-${remainder}`] = value; 510 | } 511 | 512 | // --- Check "borderHorizontalStyle" theme variables 513 | match = styleBorderHorizontalRegEx.exec(key); 514 | if (match) { 515 | // --- We have a borderHorizontalStyle value to flow down 516 | const remainder = match[1]; 517 | result[`borderLeftStyle-${remainder}`] = value; 518 | result[`borderRightStyle-${remainder}`] = value; 519 | } 520 | 521 | // --- Check "borderVerticalStyle" theme variables 522 | match = styleBorderVerticalRegEx.exec(key); 523 | if (match) { 524 | // --- We have a borderVerticalStyle value to flow down 525 | const remainder = match[1]; 526 | result[`borderTopStyle-${remainder}`] = value; 527 | result[`borderBottomStyle-${remainder}`] = value; 528 | } 529 | 530 | // --- Check "borderHorizontalColor" theme variables 531 | match = colorBorderHorizontalRegEx.exec(key); 532 | if (match) { 533 | // --- We have a borderHorizontalColor value to flow down 534 | const remainder = match[1]; 535 | result[`borderLeftColor-${remainder}`] = value; 536 | result[`borderRightColor-${remainder}`] = value; 537 | } 538 | 539 | // --- Check "borderVerticalColor" theme variables 540 | match = colorBorderVerticalRegEx.exec(key); 541 | if (match) { 542 | // --- We have a borderVerticalColor value to flow down 543 | const remainder = match[1]; 544 | result[`borderTopColor-${remainder}`] = value; 545 | result[`borderBottomColor-${remainder}`] = value; 546 | } 547 | }); 548 | 549 | // --- Done 550 | return result; 551 | 552 | function getBorderSegments(value: string) { 553 | try { 554 | const sParser = new StyleParser(value); 555 | const parsed = sParser.parseBorder(); 556 | 557 | // --- Get the parsed result 558 | const result = { 559 | style: parsed.styleValue, 560 | thickness: 561 | parsed.widthValue !== undefined 562 | ? `${parsed.widthValue}${parsed.widthUnit ?? "px"}` 563 | : undefined, 564 | color: 565 | parsed.color === undefined 566 | ? undefined 567 | : typeof parsed.color === "string" 568 | ? parsed.color 569 | : parsed.color.toString(), 570 | }; 571 | 572 | // --- All theme variables are present? 573 | if (parsed.themeId1 && parsed.themeId2 && parsed.themeId3) { 574 | return { 575 | thickness: parsed.themeId1.id, 576 | style: parsed.themeId2.id, 577 | color: parsed.themeId3.id, 578 | }; 579 | } 580 | 581 | // --- Two theme variables are present? 582 | if (parsed.themeId1 && parsed.themeId2) { 583 | if (result.thickness) { 584 | return { 585 | thickness: result.thickness, 586 | style: parsed.themeId1.id, 587 | color: parsed.themeId2.id, 588 | }; 589 | } 590 | if (result.style) { 591 | return { 592 | thickness: parsed.themeId1.id, 593 | style: result.style, 594 | color: parsed.themeId2.id, 595 | }; 596 | } 597 | return { 598 | thickness: parsed.themeId1.id, 599 | style: parsed.themeId2.id, 600 | color: result.color, 601 | }; 602 | } 603 | 604 | // --- One theme variable is present? 605 | if (parsed.themeId1) { 606 | if (result.thickness && result.style) { 607 | return { 608 | thickness: result.thickness, 609 | style: result.style, 610 | color: parsed.themeId1.id, 611 | }; 612 | } 613 | if (result.thickness && result.color) { 614 | return { 615 | thickness: result.thickness, 616 | style: parsed.themeId1.id, 617 | color: result.color, 618 | }; 619 | } 620 | if (result.style && result.color) { 621 | return { 622 | thickness: parsed.themeId1.id, 623 | style: result.style, 624 | color: result.color, 625 | }; 626 | } 627 | } 628 | return { 629 | thickness: result.thickness?.trim(), 630 | style: result.style?.trim(), 631 | color: result.color?.trim(), 632 | }; 633 | } catch (e) { 634 | return { 635 | thickness: undefined, 636 | style: undefined, 637 | color: undefined, 638 | }; 639 | } 640 | } 641 | } 642 | 643 | function findClosest(theme: Record<string, string>, themeVarName: string) { 644 | if (theme[themeVarName]) { 645 | return theme[themeVarName]; 646 | } 647 | const hVar = parseHVar(themeVarName); 648 | if (!hVar) { 649 | return null; 650 | } 651 | let closest: HVar | null = null; 652 | let closestKey: string | null = null; 653 | Object.keys(theme).forEach((themeVar) => { 654 | const parsedVar = parseHVar(themeVar); 655 | if ( 656 | !parsedVar || 657 | parsedVar.component !== hVar.component || 658 | parsedVar.attribute !== hVar.attribute 659 | ) { 660 | return; 661 | } 662 | if (parsedVar.states.length) { 663 | return; 664 | } 665 | if ( 666 | parsedVar.traits.every((tr) => hVar.traits.includes(tr)) && 667 | (!closest || closest.traits.length <= parsedVar.traits.length) 668 | ) { 669 | closest = parsedVar; 670 | closestKey = themeVar; 671 | return; 672 | } 673 | }); 674 | if (closestKey) { 675 | // console.log("found closest for", themeVarName, closestKey); 676 | return theme[closestKey]; 677 | } 678 | return null; 679 | } 680 | 681 | function resolveThemeVars(theme: Record<string, string>) { 682 | const ret: Record<string, string> = {}; 683 | Object.keys(theme).forEach((key) => { 684 | ret[key] = resolveThemeVar(key, theme); 685 | }); 686 | return ret; 687 | } 688 | 689 | function getRgbChannelsString(colorStr?: string) { 690 | if (!colorStr) { 691 | return undefined; 692 | } 693 | const color = Color(colorStr); 694 | let rgb = color.rgb(); 695 | return `${rgb.red()},${rgb.green()},${rgb.blue()}`; 696 | } 697 | 698 | function generateBaseTonesForColor( 699 | varName: string, 700 | theme: Record<string, string>, 701 | options = { distributeEven: false }, 702 | ) { 703 | try { 704 | const { distributeEven } = options; 705 | const color = theme[varName]; 706 | if (!color || typeof color !== "string") { 707 | return {}; 708 | } 709 | const baseColor = Color(color); 710 | let color0; 711 | let color50; 712 | let color100; 713 | let color200; 714 | let color300; 715 | let color400; 716 | let color500; 717 | let color600; 718 | let color700; 719 | let color800; 720 | let color900; 721 | let color950; 722 | let color1000; 723 | if (distributeEven) { 724 | color0 = baseColor.lightness(100); 725 | color50 = baseColor.lightness(98); 726 | color100 = baseColor.lightness(95); 727 | color200 = baseColor.lightness(83); 728 | color300 = baseColor.lightness(75); 729 | color400 = baseColor.lightness(63); 730 | color500 = baseColor.lightness(52); 731 | color600 = baseColor.lightness(40); 732 | color700 = baseColor.lightness(32); 733 | color800 = baseColor.lightness(27); 734 | color900 = baseColor.lightness(16); 735 | color950 = baseColor.lightness(13); 736 | color1000 = baseColor.lightness(9); 737 | } else { 738 | const baseL = baseColor.hsl().l(); 739 | const darkStep = baseL / 5; 740 | const lightStep = (100 - baseL) / 5; 741 | color0 = baseColor.lightness(100); 742 | color50 = baseColor.lightness(baseL + lightStep * 4.5); 743 | color100 = baseColor.lightness(baseL + lightStep * 4); 744 | color200 = baseColor.lightness(baseL + lightStep * 3); 745 | color300 = baseColor.lightness(baseL + lightStep * 2); 746 | color400 = baseColor.lightness(baseL + lightStep * 1); 747 | color500 = baseColor.lightness(baseL); 748 | color600 = baseColor.lightness(baseL - darkStep * 1); 749 | color700 = baseColor.lightness(baseL - darkStep * 2); 750 | color800 = baseColor.lightness(baseL - darkStep * 3); 751 | color900 = baseColor.lightness(baseL - darkStep * 4); 752 | color950 = baseColor.lightness(baseL - darkStep * 4.5); 753 | color1000 = baseColor.lightness(baseL - darkStep * 5); 754 | } 755 | 756 | return { 757 | [`const-${varName}-0`]: color0.toString(), 758 | [`const-${varName}-50`]: color50.toString(), 759 | [`const-${varName}-100`]: color100.toString(), 760 | [`const-${varName}-200`]: color200.toString(), 761 | [`const-${varName}-300`]: color300.toString(), 762 | [`const-${varName}-400`]: color400.toString(), 763 | [`const-${varName}-500`]: color500.toString(), 764 | [`const-${varName}-600`]: color600.toString(), 765 | [`const-${varName}-700`]: color700.toString(), 766 | [`const-${varName}-800`]: color800.toString(), 767 | [`const-${varName}-900`]: color900.toString(), 768 | [`const-${varName}-950`]: color950.toString(), 769 | [`const-${varName}-1000`]: color1000.toString(), 770 | }; 771 | } catch (e) { 772 | console.error("Error generating base tones for color:", varName); 773 | return {}; 774 | } 775 | } 776 | 777 | function mapTones( 778 | baseColor: string | undefined | null, 779 | mapper: (tones: ColorTones) => Record<string, string>, 780 | ) { 781 | const tones = generateTones(baseColor); 782 | if (!tones) { 783 | return {}; 784 | } 785 | return mapper(tones); 786 | } 787 | 788 | function generateTones(baseColorStr: string | null | undefined): ColorTones | null { 789 | if (!baseColorStr || typeof baseColorStr !== "string" || baseColorStr.startsWith("$")) 790 | return null; //TODO illesg here the startsWidth $ should be something else 791 | 792 | const baseColor = Color(baseColorStr); 793 | let tone1; 794 | let tone2; 795 | let tone3; 796 | if (baseColor.isLight()) { 797 | tone1 = baseColor.darken(0.2).toString(); 798 | tone2 = baseColor.darken(0.1).toString(); 799 | tone3 = baseColor.darken(0.95).toString(); 800 | } else { 801 | tone1 = baseColor.lighten(0.2).toString(); 802 | tone2 = baseColor.lighten(0.1).toString(); 803 | tone3 = baseColor.lighten(0.95).toString(); 804 | } 805 | 806 | const alpha1 = baseColor.alpha(0.1).toString(); 807 | const alpha2 = baseColor.alpha(0.2).toString(); 808 | return { 809 | base: baseColorStr, 810 | tone1, 811 | tone2, 812 | tone3, 813 | alpha1, 814 | alpha2, 815 | }; 816 | } 817 | 818 | type ColorTones = { 819 | base: string; 820 | tone1: string; 821 | tone2: string; 822 | tone3: string; 823 | alpha1: string; 824 | alpha2: string; 825 | }; 826 | ```