@limetech/lime-elements 38.33.7 → 38.34.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/dist/cjs/lime-elements.cjs.js +1 -1
  3. package/dist/cjs/{limel-breadcrumbs_8.cjs.entry.js → limel-breadcrumbs_7.cjs.entry.js} +1 -35
  4. package/dist/cjs/limel-breadcrumbs_7.cjs.entry.js.map +1 -0
  5. package/dist/cjs/limel-code-editor.cjs.entry.js +97 -5
  6. package/dist/cjs/limel-code-editor.cjs.entry.js.map +1 -1
  7. package/dist/cjs/limel-helper-line_2.cjs.entry.js +79 -0
  8. package/dist/cjs/limel-helper-line_2.cjs.entry.js.map +1 -0
  9. package/dist/cjs/limel-prosemirror-adapter.cjs.entry.js +3 -0
  10. package/dist/cjs/limel-prosemirror-adapter.cjs.entry.js.map +1 -1
  11. package/dist/cjs/loader.cjs.js +1 -1
  12. package/dist/collection/components/code-editor/code-editor.css +29 -0
  13. package/dist/collection/components/code-editor/code-editor.js +202 -11
  14. package/dist/collection/components/code-editor/code-editor.js.map +1 -1
  15. package/dist/collection/components/text-editor/prosemirror-adapter/prosemirror-adapter.js +3 -0
  16. package/dist/collection/components/text-editor/prosemirror-adapter/prosemirror-adapter.js.map +1 -1
  17. package/dist/esm/lime-elements.js +1 -1
  18. package/dist/esm/{limel-breadcrumbs_8.entry.js → limel-breadcrumbs_7.entry.js} +2 -35
  19. package/dist/esm/limel-breadcrumbs_7.entry.js.map +1 -0
  20. package/dist/esm/limel-code-editor.entry.js +98 -6
  21. package/dist/esm/limel-code-editor.entry.js.map +1 -1
  22. package/dist/esm/limel-helper-line_2.entry.js +74 -0
  23. package/dist/esm/limel-helper-line_2.entry.js.map +1 -0
  24. package/dist/esm/limel-prosemirror-adapter.entry.js +3 -0
  25. package/dist/esm/limel-prosemirror-adapter.entry.js.map +1 -1
  26. package/dist/esm/loader.js +1 -1
  27. package/dist/lime-elements/lime-elements.esm.js +1 -1
  28. package/dist/lime-elements/lime-elements.esm.js.map +1 -1
  29. package/dist/lime-elements/{p-033a0aa9.entry.js → p-668e583c.entry.js} +11 -11
  30. package/dist/lime-elements/p-668e583c.entry.js.map +1 -0
  31. package/dist/lime-elements/p-93ea4214.entry.js +2 -0
  32. package/dist/lime-elements/p-93ea4214.entry.js.map +1 -0
  33. package/dist/lime-elements/{p-787be044.entry.js → p-df9bcace.entry.js} +2 -2
  34. package/dist/lime-elements/{p-787be044.entry.js.map → p-df9bcace.entry.js.map} +1 -1
  35. package/dist/lime-elements/p-f1ec1eeb.entry.js +2 -0
  36. package/dist/lime-elements/p-f1ec1eeb.entry.js.map +1 -0
  37. package/dist/types/components/code-editor/code-editor.d.ts +40 -1
  38. package/dist/types/components.d.ts +46 -2
  39. package/package.json +1 -1
  40. package/dist/cjs/limel-breadcrumbs_8.cjs.entry.js.map +0 -1
  41. package/dist/cjs/limel-helper-line.cjs.entry.js +0 -45
  42. package/dist/cjs/limel-helper-line.cjs.entry.js.map +0 -1
  43. package/dist/esm/limel-breadcrumbs_8.entry.js.map +0 -1
  44. package/dist/esm/limel-helper-line.entry.js +0 -41
  45. package/dist/esm/limel-helper-line.entry.js.map +0 -1
  46. package/dist/lime-elements/p-033a0aa9.entry.js.map +0 -1
  47. package/dist/lime-elements/p-2bf4fc20.entry.js +0 -2
  48. package/dist/lime-elements/p-2bf4fc20.entry.js.map +0 -1
  49. package/dist/lime-elements/p-e4bafb75.entry.js +0 -2
  50. package/dist/lime-elements/p-e4bafb75.entry.js.map +0 -1
@@ -14,7 +14,7 @@ const patchEsm = () => {
14
14
  const defineCustomElements = (win, options) => {
15
15
  if (typeof window === 'undefined') return Promise.resolve();
16
16
  return patchEsm().then(() => {
17
- return index.bootstrapLazy(JSON.parse("[[\"limel-text-editor.cjs\",[[17,\"limel-text-editor\",{\"contentType\":[1,\"content-type\"],\"language\":[513],\"disabled\":[516],\"readonly\":[516],\"helperText\":[513,\"helper-text\"],\"placeholder\":[513],\"label\":[513],\"invalid\":[516],\"value\":[513],\"customElements\":[16],\"triggers\":[16],\"required\":[516],\"allowResize\":[516,\"allow-resize\"],\"ui\":[513]}]]],[\"limel-card.cjs\",[[1,\"limel-card\",{\"heading\":[513],\"subheading\":[513],\"image\":[16],\"icon\":[513],\"value\":[1],\"actions\":[16],\"clickable\":[516],\"orientation\":[513]}]]],[\"limel-file.cjs\",[[1,\"limel-file\",{\"value\":[16],\"label\":[513],\"required\":[516],\"disabled\":[516],\"readonly\":[516],\"invalid\":[516],\"accept\":[513],\"language\":[1]}]]],[\"limel-list-item.cjs\",[[0,\"limel-list-item\",{\"language\":[513],\"value\":[8],\"text\":[513],\"secondaryText\":[513,\"secondary-text\"],\"disabled\":[516],\"icon\":[1],\"iconSize\":[513,\"icon-size\"],\"badgeIcon\":[516,\"badge-icon\"],\"selected\":[516],\"actions\":[16],\"primaryComponent\":[16],\"image\":[16],\"type\":[513]}]]],[\"limel-picker.cjs\",[[1,\"limel-picker\",{\"disabled\":[4],\"readonly\":[516],\"label\":[1],\"searchLabel\":[1,\"search-label\"],\"helperText\":[513,\"helper-text\"],\"leadingIcon\":[1,\"leading-icon\"],\"emptyResultMessage\":[1,\"empty-result-message\"],\"required\":[4],\"invalid\":[516],\"value\":[16],\"searcher\":[16],\"allItems\":[16],\"multiple\":[4],\"delimiter\":[513],\"actions\":[16],\"actionPosition\":[1,\"action-position\"],\"actionScrollBehavior\":[1,\"action-scroll-behavior\"],\"badgeIcons\":[516,\"badge-icons\"],\"items\":[32],\"textValue\":[32],\"loading\":[32],\"chips\":[32]}]]],[\"limel-split-button.cjs\",[[17,\"limel-split-button\",{\"label\":[513],\"primary\":[516],\"icon\":[513],\"disabled\":[516],\"loading\":[516],\"loadingFailed\":[516,\"loading-failed\"],\"items\":[16]}]]],[\"limel-file-viewer.cjs\",[[1,\"limel-file-viewer\",{\"url\":[513],\"filename\":[513],\"alt\":[513],\"allowFullscreen\":[516,\"allow-fullscreen\"],\"allowOpenInNewTab\":[516,\"allow-open-in-new-tab\"],\"allowDownload\":[516,\"allow-download\"],\"language\":[1],\"officeViewer\":[513,\"office-viewer\"],\"actions\":[16],\"isFullscreen\":[32],\"fileType\":[32],\"loading\":[32],\"fileUrl\":[32]}]]],[\"limel-color-picker.cjs\",[[1,\"limel-color-picker\",{\"value\":[513],\"label\":[513],\"helperText\":[513,\"helper-text\"],\"tooltipLabel\":[513,\"tooltip-label\"],\"required\":[516],\"disabled\":[516],\"readonly\":[516],\"invalid\":[516],\"placeholder\":[513],\"manualInput\":[516,\"manual-input\"],\"palette\":[16],\"paletteColumnCount\":[514,\"palette-column-count\"],\"isOpen\":[32]}]]],[\"limel-profile-picture.cjs\",[[1,\"limel-profile-picture\",{\"language\":[513],\"label\":[513],\"icon\":[1],\"helperText\":[1,\"helper-text\"],\"disabled\":[516],\"readonly\":[516],\"required\":[516],\"invalid\":[516],\"loading\":[516],\"value\":[1],\"imageFit\":[513,\"image-fit\"],\"accept\":[513],\"resize\":[16],\"objectUrl\":[32],\"imageError\":[32],\"isErrorMessagePopoverOpen\":[32]}]]],[\"limel-date-picker.cjs\",[[1,\"limel-date-picker\",{\"disabled\":[516],\"readonly\":[516],\"invalid\":[516],\"label\":[513],\"placeholder\":[513],\"helperText\":[513,\"helper-text\"],\"required\":[516],\"value\":[16],\"type\":[513],\"format\":[513],\"language\":[513],\"formatter\":[16],\"internalFormat\":[32],\"showPortal\":[32]}]]],[\"limel-dock.cjs\",[[1,\"limel-dock\",{\"dockItems\":[16],\"dockFooterItems\":[16],\"accessibleLabel\":[513,\"accessible-label\"],\"expanded\":[516],\"allowResize\":[516,\"allow-resize\"],\"mobileBreakPoint\":[514,\"mobile-break-point\"],\"useMobileLayout\":[32]}]]],[\"limel-snackbar.cjs\",[[1,\"limel-snackbar\",{\"open\":[516],\"message\":[1],\"timeout\":[514],\"actionText\":[1,\"action-text\"],\"dismissible\":[4],\"multiline\":[4],\"language\":[1],\"offset\":[32],\"isOpen\":[32],\"closing\":[32],\"show\":[64]},[[0,\"changeOffset\",\"onChangeIndex\"]]]]],[\"limel-select.cjs\",[[1,\"limel-select\",{\"disabled\":[516],\"readonly\":[516],\"invalid\":[516],\"required\":[516],\"label\":[513],\"helperText\":[513,\"helper-text\"],\"value\":[16],\"options\":[16],\"multiple\":[4],\"menuOpen\":[32]}]]],[\"limel-button-group.cjs\",[[1,\"limel-button-group\",{\"value\":[16],\"disabled\":[516],\"selectedButtonId\":[32]}]]],[\"limel-chart.cjs\",[[1,\"limel-chart\",{\"language\":[513],\"accessibleLabel\":[513,\"accessible-label\"],\"accessibleItemsLabel\":[513,\"accessible-items-label\"],\"items\":[16],\"type\":[513],\"orientation\":[513],\"maxValue\":[514,\"max-value\"],\"axisIncrement\":[514,\"axis-increment\"],\"loading\":[516]}]]],[\"limel-collapsible-section.cjs\",[[1,\"limel-collapsible-section\",{\"isOpen\":[1540,\"is-open\"],\"header\":[513],\"icon\":[1],\"invalid\":[516],\"actions\":[16],\"language\":[513]}]]],[\"limel-help.cjs\",[[1,\"limel-help\",{\"value\":[1],\"trigger\":[1],\"readMoreLink\":[16],\"openDirection\":[513,\"open-direction\"],\"isOpen\":[32]}]]],[\"limel-info-tile.cjs\",[[1,\"limel-info-tile\",{\"value\":[520],\"icon\":[1],\"label\":[513],\"prefix\":[513],\"suffix\":[513],\"disabled\":[516],\"badge\":[520],\"loading\":[516],\"link\":[16],\"progress\":[16],\"hasPrimarySlot\":[32]}]]],[\"limel-checkbox.cjs\",[[1,\"limel-checkbox\",{\"disabled\":[516],\"readonly\":[516],\"invalid\":[516],\"label\":[513],\"helperText\":[513,\"helper-text\"],\"checked\":[516],\"indeterminate\":[516],\"required\":[516],\"readonlyLabels\":[16],\"modified\":[32]}]]],[\"limel-table.cjs\",[[1,\"limel-table\",{\"data\":[16],\"columns\":[16],\"mode\":[1],\"layout\":[1],\"pageSize\":[2,\"page-size\"],\"totalRows\":[2,\"total-rows\"],\"sorting\":[16],\"activeRow\":[1040],\"movableColumns\":[4,\"movable-columns\"],\"sortableColumns\":[4,\"sortable-columns\"],\"loading\":[4],\"page\":[2],\"emptyMessage\":[1,\"empty-message\"],\"aggregates\":[16],\"selectable\":[4],\"selection\":[16],\"language\":[513]}]]],[\"limel-drag-handle.cjs\",[[0,\"limel-drag-handle\",{\"dragDirection\":[513,\"drag-direction\"],\"tooltipOpenDirection\":[513,\"tooltip-open-direction\"],\"language\":[513]}]]],[\"limel-shortcut.cjs\",[[1,\"limel-shortcut\",{\"icon\":[513],\"label\":[513],\"disabled\":[516],\"badge\":[520],\"link\":[16]}]]],[\"limel-switch.cjs\",[[1,\"limel-switch\",{\"label\":[513],\"disabled\":[516],\"readonly\":[516],\"invalid\":[516],\"value\":[516],\"helperText\":[513,\"helper-text\"],\"readonlyLabels\":[16],\"fieldId\":[32]}]]],[\"limel-tab-bar.cjs\",[[1,\"limel-tab-bar\",{\"tabs\":[1040],\"canScrollLeft\":[32],\"canScrollRight\":[32]},[[9,\"resize\",\"handleWindowResize\"]]]]],[\"limel-tab-panel.cjs\",[[1,\"limel-tab-panel\",{\"tabs\":[1040]}]]],[\"limel-dialog.cjs\",[[1,\"limel-dialog\",{\"heading\":[1],\"fullscreen\":[516],\"open\":[1540],\"closingActions\":[16]}]]],[\"limel-progress-flow.cjs\",[[1,\"limel-progress-flow\",{\"flowItems\":[16],\"disabled\":[4],\"readonly\":[4]}]]],[\"limel-slider.cjs\",[[1,\"limel-slider\",{\"disabled\":[516],\"readonly\":[516],\"factor\":[514],\"label\":[513],\"helperText\":[513,\"helper-text\"],\"required\":[516],\"invalid\":[516],\"unit\":[513],\"value\":[514],\"valuemax\":[514],\"valuemin\":[514],\"step\":[514],\"percentageClass\":[32]}]]],[\"limel-banner.cjs\",[[1,\"limel-banner\",{\"message\":[513],\"icon\":[513],\"isOpen\":[32],\"open\":[64],\"close\":[64]}]]],[\"limel-form.cjs\",[[1,\"limel-form\",{\"schema\":[16],\"value\":[16],\"disabled\":[4],\"propsFactory\":[16],\"transformErrors\":[16],\"errors\":[16]}]]],[\"limel-menu-item-meta.cjs\",[[1,\"limel-menu-item-meta\",{\"commandText\":[1,\"command-text\"],\"badge\":[8],\"showChevron\":[4,\"show-chevron\"]}]]],[\"limel-radio-button-group.cjs\",[[0,\"limel-radio-button-group\",{\"items\":[16],\"selectedItem\":[16],\"disabled\":[516],\"badgeIcons\":[516,\"badge-icons\"],\"maxLinesSecondaryText\":[514,\"max-lines-secondary-text\"]}]]],[\"limel-ai-avatar.cjs\",[[1,\"limel-ai-avatar\",{\"isThinking\":[516,\"is-thinking\"],\"language\":[513]}]]],[\"limel-code-editor.cjs\",[[1,\"limel-code-editor\",{\"value\":[1],\"language\":[1],\"readonly\":[4],\"lineNumbers\":[4,\"line-numbers\"],\"lineWrapping\":[4,\"line-wrapping\"],\"fold\":[4],\"lint\":[4],\"colorScheme\":[1,\"color-scheme\"],\"random\":[32]}]]],[\"limel-config.cjs\",[[1,\"limel-config\",{\"config\":[16]}]]],[\"limel-flex-container.cjs\",[[1,\"limel-flex-container\",{\"direction\":[513],\"justify\":[513],\"align\":[513],\"reverse\":[516]}]]],[\"limel-grid.cjs\",[[1,\"limel-grid\"]]],[\"limel-action-bar-item_2.cjs\",[[0,\"limel-action-bar-overflow-menu\",{\"items\":[16],\"openDirection\":[513,\"open-direction\"],\"overFlowIcon\":[16]}],[0,\"limel-action-bar-item\",{\"item\":[16],\"isVisible\":[516,\"is-visible\"],\"selected\":[516]}]]],[\"limel-action-bar_2.cjs\",[[1,\"limel-text-editor-link-menu\",{\"link\":[16],\"language\":[513],\"isOpen\":[516,\"is-open\"]}],[1,\"limel-action-bar\",{\"actions\":[16],\"language\":[513],\"accessibleLabel\":[513,\"accessible-label\"],\"layout\":[513],\"collapsible\":[516],\"openDirection\":[513,\"open-direction\"],\"overflowCutoff\":[32],\"actionBarIsShrunk\":[32]}]]],[\"limel-prosemirror-adapter.cjs\",[[17,\"limel-prosemirror-adapter\",{\"contentType\":[1,\"content-type\"],\"value\":[1],\"language\":[513],\"disabled\":[516],\"customElements\":[16],\"triggerCharacters\":[16],\"ui\":[1],\"view\":[32],\"actionBarItems\":[32],\"link\":[32],\"isLinkMenuOpen\":[32]}]]],[\"limel-color-picker-palette.cjs\",[[17,\"limel-color-picker-palette\",{\"value\":[513],\"label\":[513],\"helperText\":[513,\"helper-text\"],\"placeholder\":[513],\"required\":[516],\"invalid\":[516],\"manualInput\":[516,\"manual-input\"],\"columnCount\":[514,\"column-count\"],\"palette\":[16]}]]],[\"limel-dock-button.cjs\",[[0,\"limel-dock-button\",{\"item\":[16],\"expanded\":[516],\"useMobileLayout\":[516,\"use-mobile-layout\"],\"isOpen\":[32]}]]],[\"limel-callout.cjs\",[[1,\"limel-callout\",{\"heading\":[513],\"icon\":[513],\"type\":[513],\"language\":[1]}]]],[\"limel-header.cjs\",[[1,\"limel-header\",{\"icon\":[1],\"heading\":[1],\"subheading\":[1],\"supportingText\":[1,\"supporting-text\"],\"subheadingDivider\":[1,\"subheading-divider\"]}]]],[\"limel-help-content.cjs\",[[1,\"limel-help-content\",{\"value\":[1],\"readMoreLink\":[16]}]]],[\"limel-progress-flow-item.cjs\",[[0,\"limel-progress-flow-item\",{\"item\":[16],\"disabled\":[4],\"readonly\":[4],\"currentStep\":[4,\"current-step\"]}]]],[\"limel-circular-progress.cjs\",[[1,\"limel-circular-progress\",{\"value\":[2],\"maxValue\":[2,\"max-value\"],\"prefix\":[513],\"suffix\":[1],\"displayPercentageColors\":[4,\"display-percentage-colors\"],\"size\":[513]}]]],[\"limel-flatpickr-adapter.cjs\",[[1,\"limel-flatpickr-adapter\",{\"value\":[16],\"type\":[1],\"format\":[1],\"isOpen\":[4,\"is-open\"],\"inputElement\":[16],\"language\":[1],\"formatter\":[16]}]]],[\"limel-radio-button.cjs\",[[0,\"limel-radio-button\",{\"checked\":[516],\"disabled\":[516],\"id\":[1],\"label\":[1],\"onChange\":[16]}]]],[\"limel-3d-hover-effect-glow.cjs\",[[1,\"limel-3d-hover-effect-glow\"]]],[\"limel-icon.cjs\",[[1,\"limel-icon\",{\"size\":[513],\"name\":[513],\"badge\":[516]}]]],[\"limel-portal_3.cjs\",[[1,\"limel-tooltip\",{\"elementId\":[513,\"element-id\"],\"label\":[513],\"helperLabel\":[513,\"helper-label\"],\"maxlength\":[514],\"openDirection\":[513,\"open-direction\"],\"open\":[32]}],[1,\"limel-tooltip-content\",{\"label\":[513],\"helperLabel\":[513,\"helper-label\"],\"maxlength\":[514]}],[1,\"limel-portal\",{\"openDirection\":[513,\"open-direction\"],\"position\":[513],\"containerId\":[513,\"container-id\"],\"containerStyle\":[16],\"inheritParentWidth\":[516,\"inherit-parent-width\"],\"visible\":[516],\"anchor\":[16]}]]],[\"limel-icon-button.cjs\",[[17,\"limel-icon-button\",{\"icon\":[1],\"elevated\":[516],\"label\":[513],\"disabled\":[516]}]]],[\"limel-file-dropzone_2.cjs\",[[1,\"limel-file-dropzone\",{\"accept\":[513],\"disabled\":[4],\"text\":[1],\"helperText\":[1,\"helper-text\"],\"hasFileToDrop\":[32]}],[1,\"limel-file-input\",{\"accept\":[513],\"disabled\":[516],\"multiple\":[516]}]]],[\"limel-dynamic-label.cjs\",[[1,\"limel-dynamic-label\",{\"value\":[8],\"defaultLabel\":[16],\"labels\":[16]}]]],[\"limel-helper-line.cjs\",[[1,\"limel-helper-line\",{\"helperText\":[513,\"helper-text\"],\"length\":[514],\"maxLength\":[514,\"max-length\"],\"invalid\":[516],\"helperTextId\":[513,\"helper-text-id\"]}]]],[\"limel-chip_2.cjs\",[[1,\"limel-chip-set\",{\"value\":[16],\"type\":[513],\"label\":[513],\"helperText\":[513,\"helper-text\"],\"disabled\":[516],\"readonly\":[516],\"invalid\":[516],\"inputType\":[513,\"input-type\"],\"maxItems\":[514,\"max-items\"],\"required\":[516],\"searchLabel\":[513,\"search-label\"],\"emptyInputOnBlur\":[516,\"empty-input-on-blur\"],\"clearAllButton\":[4,\"clear-all-button\"],\"leadingIcon\":[513,\"leading-icon\"],\"delimiter\":[513],\"autocomplete\":[513],\"language\":[1],\"editMode\":[32],\"textValue\":[32],\"blurred\":[32],\"inputChipIndexSelected\":[32],\"selectedChipIds\":[32],\"getEditMode\":[64],\"setFocus\":[64],\"emptyInput\":[64]}],[17,\"limel-chip\",{\"language\":[513],\"text\":[513],\"icon\":[1],\"image\":[16],\"link\":[16],\"badge\":[520],\"disabled\":[516],\"readonly\":[516],\"selected\":[516],\"invalid\":[516],\"removable\":[516],\"type\":[513],\"loading\":[516],\"progress\":[514],\"identifier\":[520],\"size\":[513],\"menuItems\":[16]}]]],[\"limel-button.cjs\",[[17,\"limel-button\",{\"label\":[513],\"primary\":[516],\"outlined\":[516],\"icon\":[513],\"disabled\":[516],\"loading\":[516],\"loadingFailed\":[516,\"loading-failed\"],\"justLoaded\":[32]}]]],[\"limel-linear-progress.cjs\",[[1,\"limel-linear-progress\",{\"language\":[513],\"value\":[514],\"indeterminate\":[516],\"accessibleLabel\":[513,\"accessible-label\"]}]]],[\"limel-markdown.cjs\",[[1,\"limel-markdown\",{\"value\":[1],\"whitelist\":[16],\"lazyLoadImages\":[4,\"lazy-load-images\"]}]]],[\"limel-popover_2.cjs\",[[1,\"limel-popover\",{\"open\":[4],\"openDirection\":[513,\"open-direction\"]}],[1,\"limel-popover-surface\",{\"contentCollection\":[16]}]]],[\"limel-badge.cjs\",[[1,\"limel-badge\",{\"label\":[520]}]]],[\"limel-breadcrumbs_8.cjs\",[[1,\"limel-menu\",{\"items\":[16],\"disabled\":[516],\"openDirection\":[513,\"open-direction\"],\"surfaceWidth\":[513,\"surface-width\"],\"open\":[1540],\"badgeIcons\":[516,\"badge-icons\"],\"gridLayout\":[516,\"grid-layout\"],\"loading\":[516],\"currentSubMenu\":[1040],\"rootItem\":[16],\"searcher\":[16],\"emptyResultMessage\":[1,\"empty-result-message\"],\"loadingSubItems\":[32],\"searchValue\":[32],\"searchResults\":[32]}],[1,\"limel-breadcrumbs\",{\"items\":[16],\"divider\":[1]}],[17,\"limel-menu-list\",{\"items\":[16],\"badgeIcons\":[4,\"badge-icons\"],\"iconSize\":[1,\"icon-size\"]}],[1,\"limel-input-field\",{\"disabled\":[516],\"readonly\":[516],\"invalid\":[516],\"label\":[513],\"placeholder\":[513],\"helperText\":[513,\"helper-text\"],\"prefix\":[513],\"suffix\":[513],\"required\":[516],\"value\":[513],\"trailingIcon\":[513,\"trailing-icon\"],\"leadingIcon\":[513,\"leading-icon\"],\"pattern\":[513],\"type\":[513],\"formatNumber\":[516,\"format-number\"],\"step\":[520],\"max\":[514],\"min\":[514],\"maxlength\":[514],\"minlength\":[514],\"completions\":[16],\"showLink\":[516,\"show-link\"],\"locale\":[513],\"isFocused\":[32],\"wasInvalid\":[32],\"showCompletions\":[32]}],[1,\"limel-menu-surface\",{\"open\":[4],\"allowClicksElement\":[16]}],[1,\"limel-spinner\",{\"size\":[513],\"limeBranded\":[4,\"lime-branded\"]}],[17,\"limel-list\",{\"items\":[16],\"badgeIcons\":[4,\"badge-icons\"],\"iconSize\":[1,\"icon-size\"],\"type\":[1],\"maxLinesSecondaryText\":[2,\"max-lines-secondary-text\"]}],[4,\"limel-notched-outline\",{\"required\":[516],\"readonly\":[516],\"invalid\":[516],\"disabled\":[516],\"label\":[513],\"labelId\":[513,\"label-id\"],\"hasValue\":[516,\"has-value\"],\"hasLeadingIcon\":[516,\"has-leading-icon\"],\"hasFloatingLabel\":[516,\"has-floating-label\"]}]]]]"), options);
17
+ return index.bootstrapLazy(JSON.parse("[[\"limel-text-editor.cjs\",[[17,\"limel-text-editor\",{\"contentType\":[1,\"content-type\"],\"language\":[513],\"disabled\":[516],\"readonly\":[516],\"helperText\":[513,\"helper-text\"],\"placeholder\":[513],\"label\":[513],\"invalid\":[516],\"value\":[513],\"customElements\":[16],\"triggers\":[16],\"required\":[516],\"allowResize\":[516,\"allow-resize\"],\"ui\":[513]}]]],[\"limel-card.cjs\",[[1,\"limel-card\",{\"heading\":[513],\"subheading\":[513],\"image\":[16],\"icon\":[513],\"value\":[1],\"actions\":[16],\"clickable\":[516],\"orientation\":[513]}]]],[\"limel-file.cjs\",[[1,\"limel-file\",{\"value\":[16],\"label\":[513],\"required\":[516],\"disabled\":[516],\"readonly\":[516],\"invalid\":[516],\"accept\":[513],\"language\":[1]}]]],[\"limel-list-item.cjs\",[[0,\"limel-list-item\",{\"language\":[513],\"value\":[8],\"text\":[513],\"secondaryText\":[513,\"secondary-text\"],\"disabled\":[516],\"icon\":[1],\"iconSize\":[513,\"icon-size\"],\"badgeIcon\":[516,\"badge-icon\"],\"selected\":[516],\"actions\":[16],\"primaryComponent\":[16],\"image\":[16],\"type\":[513]}]]],[\"limel-picker.cjs\",[[1,\"limel-picker\",{\"disabled\":[4],\"readonly\":[516],\"label\":[1],\"searchLabel\":[1,\"search-label\"],\"helperText\":[513,\"helper-text\"],\"leadingIcon\":[1,\"leading-icon\"],\"emptyResultMessage\":[1,\"empty-result-message\"],\"required\":[4],\"invalid\":[516],\"value\":[16],\"searcher\":[16],\"allItems\":[16],\"multiple\":[4],\"delimiter\":[513],\"actions\":[16],\"actionPosition\":[1,\"action-position\"],\"actionScrollBehavior\":[1,\"action-scroll-behavior\"],\"badgeIcons\":[516,\"badge-icons\"],\"items\":[32],\"textValue\":[32],\"loading\":[32],\"chips\":[32]}]]],[\"limel-split-button.cjs\",[[17,\"limel-split-button\",{\"label\":[513],\"primary\":[516],\"icon\":[513],\"disabled\":[516],\"loading\":[516],\"loadingFailed\":[516,\"loading-failed\"],\"items\":[16]}]]],[\"limel-file-viewer.cjs\",[[1,\"limel-file-viewer\",{\"url\":[513],\"filename\":[513],\"alt\":[513],\"allowFullscreen\":[516,\"allow-fullscreen\"],\"allowOpenInNewTab\":[516,\"allow-open-in-new-tab\"],\"allowDownload\":[516,\"allow-download\"],\"language\":[1],\"officeViewer\":[513,\"office-viewer\"],\"actions\":[16],\"isFullscreen\":[32],\"fileType\":[32],\"loading\":[32],\"fileUrl\":[32]}]]],[\"limel-color-picker.cjs\",[[1,\"limel-color-picker\",{\"value\":[513],\"label\":[513],\"helperText\":[513,\"helper-text\"],\"tooltipLabel\":[513,\"tooltip-label\"],\"required\":[516],\"disabled\":[516],\"readonly\":[516],\"invalid\":[516],\"placeholder\":[513],\"manualInput\":[516,\"manual-input\"],\"palette\":[16],\"paletteColumnCount\":[514,\"palette-column-count\"],\"isOpen\":[32]}]]],[\"limel-profile-picture.cjs\",[[1,\"limel-profile-picture\",{\"language\":[513],\"label\":[513],\"icon\":[1],\"helperText\":[1,\"helper-text\"],\"disabled\":[516],\"readonly\":[516],\"required\":[516],\"invalid\":[516],\"loading\":[516],\"value\":[1],\"imageFit\":[513,\"image-fit\"],\"accept\":[513],\"resize\":[16],\"objectUrl\":[32],\"imageError\":[32],\"isErrorMessagePopoverOpen\":[32]}]]],[\"limel-date-picker.cjs\",[[1,\"limel-date-picker\",{\"disabled\":[516],\"readonly\":[516],\"invalid\":[516],\"label\":[513],\"placeholder\":[513],\"helperText\":[513,\"helper-text\"],\"required\":[516],\"value\":[16],\"type\":[513],\"format\":[513],\"language\":[513],\"formatter\":[16],\"internalFormat\":[32],\"showPortal\":[32]}]]],[\"limel-dock.cjs\",[[1,\"limel-dock\",{\"dockItems\":[16],\"dockFooterItems\":[16],\"accessibleLabel\":[513,\"accessible-label\"],\"expanded\":[516],\"allowResize\":[516,\"allow-resize\"],\"mobileBreakPoint\":[514,\"mobile-break-point\"],\"useMobileLayout\":[32]}]]],[\"limel-snackbar.cjs\",[[1,\"limel-snackbar\",{\"open\":[516],\"message\":[1],\"timeout\":[514],\"actionText\":[1,\"action-text\"],\"dismissible\":[4],\"multiline\":[4],\"language\":[1],\"offset\":[32],\"isOpen\":[32],\"closing\":[32],\"show\":[64]},[[0,\"changeOffset\",\"onChangeIndex\"]]]]],[\"limel-select.cjs\",[[1,\"limel-select\",{\"disabled\":[516],\"readonly\":[516],\"invalid\":[516],\"required\":[516],\"label\":[513],\"helperText\":[513,\"helper-text\"],\"value\":[16],\"options\":[16],\"multiple\":[4],\"menuOpen\":[32]}]]],[\"limel-button-group.cjs\",[[1,\"limel-button-group\",{\"value\":[16],\"disabled\":[516],\"selectedButtonId\":[32]}]]],[\"limel-chart.cjs\",[[1,\"limel-chart\",{\"language\":[513],\"accessibleLabel\":[513,\"accessible-label\"],\"accessibleItemsLabel\":[513,\"accessible-items-label\"],\"items\":[16],\"type\":[513],\"orientation\":[513],\"maxValue\":[514,\"max-value\"],\"axisIncrement\":[514,\"axis-increment\"],\"loading\":[516]}]]],[\"limel-collapsible-section.cjs\",[[1,\"limel-collapsible-section\",{\"isOpen\":[1540,\"is-open\"],\"header\":[513],\"icon\":[1],\"invalid\":[516],\"actions\":[16],\"language\":[513]}]]],[\"limel-help.cjs\",[[1,\"limel-help\",{\"value\":[1],\"trigger\":[1],\"readMoreLink\":[16],\"openDirection\":[513,\"open-direction\"],\"isOpen\":[32]}]]],[\"limel-info-tile.cjs\",[[1,\"limel-info-tile\",{\"value\":[520],\"icon\":[1],\"label\":[513],\"prefix\":[513],\"suffix\":[513],\"disabled\":[516],\"badge\":[520],\"loading\":[516],\"link\":[16],\"progress\":[16],\"hasPrimarySlot\":[32]}]]],[\"limel-checkbox.cjs\",[[1,\"limel-checkbox\",{\"disabled\":[516],\"readonly\":[516],\"invalid\":[516],\"label\":[513],\"helperText\":[513,\"helper-text\"],\"checked\":[516],\"indeterminate\":[516],\"required\":[516],\"readonlyLabels\":[16],\"modified\":[32]}]]],[\"limel-table.cjs\",[[1,\"limel-table\",{\"data\":[16],\"columns\":[16],\"mode\":[1],\"layout\":[1],\"pageSize\":[2,\"page-size\"],\"totalRows\":[2,\"total-rows\"],\"sorting\":[16],\"activeRow\":[1040],\"movableColumns\":[4,\"movable-columns\"],\"sortableColumns\":[4,\"sortable-columns\"],\"loading\":[4],\"page\":[2],\"emptyMessage\":[1,\"empty-message\"],\"aggregates\":[16],\"selectable\":[4],\"selection\":[16],\"language\":[513]}]]],[\"limel-drag-handle.cjs\",[[0,\"limel-drag-handle\",{\"dragDirection\":[513,\"drag-direction\"],\"tooltipOpenDirection\":[513,\"tooltip-open-direction\"],\"language\":[513]}]]],[\"limel-shortcut.cjs\",[[1,\"limel-shortcut\",{\"icon\":[513],\"label\":[513],\"disabled\":[516],\"badge\":[520],\"link\":[16]}]]],[\"limel-switch.cjs\",[[1,\"limel-switch\",{\"label\":[513],\"disabled\":[516],\"readonly\":[516],\"invalid\":[516],\"value\":[516],\"helperText\":[513,\"helper-text\"],\"readonlyLabels\":[16],\"fieldId\":[32]}]]],[\"limel-tab-bar.cjs\",[[1,\"limel-tab-bar\",{\"tabs\":[1040],\"canScrollLeft\":[32],\"canScrollRight\":[32]},[[9,\"resize\",\"handleWindowResize\"]]]]],[\"limel-tab-panel.cjs\",[[1,\"limel-tab-panel\",{\"tabs\":[1040]}]]],[\"limel-code-editor.cjs\",[[1,\"limel-code-editor\",{\"value\":[1],\"language\":[1],\"readonly\":[516],\"disabled\":[516],\"invalid\":[516],\"required\":[516],\"label\":[513],\"helperText\":[513,\"helper-text\"],\"lineNumbers\":[516,\"line-numbers\"],\"lineWrapping\":[516,\"line-wrapping\"],\"fold\":[516],\"lint\":[516],\"colorScheme\":[513,\"color-scheme\"],\"random\":[32]}]]],[\"limel-dialog.cjs\",[[1,\"limel-dialog\",{\"heading\":[1],\"fullscreen\":[516],\"open\":[1540],\"closingActions\":[16]}]]],[\"limel-progress-flow.cjs\",[[1,\"limel-progress-flow\",{\"flowItems\":[16],\"disabled\":[4],\"readonly\":[4]}]]],[\"limel-slider.cjs\",[[1,\"limel-slider\",{\"disabled\":[516],\"readonly\":[516],\"factor\":[514],\"label\":[513],\"helperText\":[513,\"helper-text\"],\"required\":[516],\"invalid\":[516],\"unit\":[513],\"value\":[514],\"valuemax\":[514],\"valuemin\":[514],\"step\":[514],\"percentageClass\":[32]}]]],[\"limel-banner.cjs\",[[1,\"limel-banner\",{\"message\":[513],\"icon\":[513],\"isOpen\":[32],\"open\":[64],\"close\":[64]}]]],[\"limel-form.cjs\",[[1,\"limel-form\",{\"schema\":[16],\"value\":[16],\"disabled\":[4],\"propsFactory\":[16],\"transformErrors\":[16],\"errors\":[16]}]]],[\"limel-menu-item-meta.cjs\",[[1,\"limel-menu-item-meta\",{\"commandText\":[1,\"command-text\"],\"badge\":[8],\"showChevron\":[4,\"show-chevron\"]}]]],[\"limel-radio-button-group.cjs\",[[0,\"limel-radio-button-group\",{\"items\":[16],\"selectedItem\":[16],\"disabled\":[516],\"badgeIcons\":[516,\"badge-icons\"],\"maxLinesSecondaryText\":[514,\"max-lines-secondary-text\"]}]]],[\"limel-ai-avatar.cjs\",[[1,\"limel-ai-avatar\",{\"isThinking\":[516,\"is-thinking\"],\"language\":[513]}]]],[\"limel-config.cjs\",[[1,\"limel-config\",{\"config\":[16]}]]],[\"limel-flex-container.cjs\",[[1,\"limel-flex-container\",{\"direction\":[513],\"justify\":[513],\"align\":[513],\"reverse\":[516]}]]],[\"limel-grid.cjs\",[[1,\"limel-grid\"]]],[\"limel-action-bar-item_2.cjs\",[[0,\"limel-action-bar-overflow-menu\",{\"items\":[16],\"openDirection\":[513,\"open-direction\"],\"overFlowIcon\":[16]}],[0,\"limel-action-bar-item\",{\"item\":[16],\"isVisible\":[516,\"is-visible\"],\"selected\":[516]}]]],[\"limel-action-bar_2.cjs\",[[1,\"limel-text-editor-link-menu\",{\"link\":[16],\"language\":[513],\"isOpen\":[516,\"is-open\"]}],[1,\"limel-action-bar\",{\"actions\":[16],\"language\":[513],\"accessibleLabel\":[513,\"accessible-label\"],\"layout\":[513],\"collapsible\":[516],\"openDirection\":[513,\"open-direction\"],\"overflowCutoff\":[32],\"actionBarIsShrunk\":[32]}]]],[\"limel-prosemirror-adapter.cjs\",[[17,\"limel-prosemirror-adapter\",{\"contentType\":[1,\"content-type\"],\"value\":[1],\"language\":[513],\"disabled\":[516],\"customElements\":[16],\"triggerCharacters\":[16],\"ui\":[1],\"view\":[32],\"actionBarItems\":[32],\"link\":[32],\"isLinkMenuOpen\":[32]}]]],[\"limel-color-picker-palette.cjs\",[[17,\"limel-color-picker-palette\",{\"value\":[513],\"label\":[513],\"helperText\":[513,\"helper-text\"],\"placeholder\":[513],\"required\":[516],\"invalid\":[516],\"manualInput\":[516,\"manual-input\"],\"columnCount\":[514,\"column-count\"],\"palette\":[16]}]]],[\"limel-dock-button.cjs\",[[0,\"limel-dock-button\",{\"item\":[16],\"expanded\":[516],\"useMobileLayout\":[516,\"use-mobile-layout\"],\"isOpen\":[32]}]]],[\"limel-callout.cjs\",[[1,\"limel-callout\",{\"heading\":[513],\"icon\":[513],\"type\":[513],\"language\":[1]}]]],[\"limel-header.cjs\",[[1,\"limel-header\",{\"icon\":[1],\"heading\":[1],\"subheading\":[1],\"supportingText\":[1,\"supporting-text\"],\"subheadingDivider\":[1,\"subheading-divider\"]}]]],[\"limel-help-content.cjs\",[[1,\"limel-help-content\",{\"value\":[1],\"readMoreLink\":[16]}]]],[\"limel-progress-flow-item.cjs\",[[0,\"limel-progress-flow-item\",{\"item\":[16],\"disabled\":[4],\"readonly\":[4],\"currentStep\":[4,\"current-step\"]}]]],[\"limel-circular-progress.cjs\",[[1,\"limel-circular-progress\",{\"value\":[2],\"maxValue\":[2,\"max-value\"],\"prefix\":[513],\"suffix\":[1],\"displayPercentageColors\":[4,\"display-percentage-colors\"],\"size\":[513]}]]],[\"limel-flatpickr-adapter.cjs\",[[1,\"limel-flatpickr-adapter\",{\"value\":[16],\"type\":[1],\"format\":[1],\"isOpen\":[4,\"is-open\"],\"inputElement\":[16],\"language\":[1],\"formatter\":[16]}]]],[\"limel-radio-button.cjs\",[[0,\"limel-radio-button\",{\"checked\":[516],\"disabled\":[516],\"id\":[1],\"label\":[1],\"onChange\":[16]}]]],[\"limel-3d-hover-effect-glow.cjs\",[[1,\"limel-3d-hover-effect-glow\"]]],[\"limel-icon.cjs\",[[1,\"limel-icon\",{\"size\":[513],\"name\":[513],\"badge\":[516]}]]],[\"limel-portal_3.cjs\",[[1,\"limel-tooltip\",{\"elementId\":[513,\"element-id\"],\"label\":[513],\"helperLabel\":[513,\"helper-label\"],\"maxlength\":[514],\"openDirection\":[513,\"open-direction\"],\"open\":[32]}],[1,\"limel-tooltip-content\",{\"label\":[513],\"helperLabel\":[513,\"helper-label\"],\"maxlength\":[514]}],[1,\"limel-portal\",{\"openDirection\":[513,\"open-direction\"],\"position\":[513],\"containerId\":[513,\"container-id\"],\"containerStyle\":[16],\"inheritParentWidth\":[516,\"inherit-parent-width\"],\"visible\":[516],\"anchor\":[16]}]]],[\"limel-icon-button.cjs\",[[17,\"limel-icon-button\",{\"icon\":[1],\"elevated\":[516],\"label\":[513],\"disabled\":[516]}]]],[\"limel-file-dropzone_2.cjs\",[[1,\"limel-file-dropzone\",{\"accept\":[513],\"disabled\":[4],\"text\":[1],\"helperText\":[1,\"helper-text\"],\"hasFileToDrop\":[32]}],[1,\"limel-file-input\",{\"accept\":[513],\"disabled\":[516],\"multiple\":[516]}]]],[\"limel-dynamic-label.cjs\",[[1,\"limel-dynamic-label\",{\"value\":[8],\"defaultLabel\":[16],\"labels\":[16]}]]],[\"limel-badge.cjs\",[[1,\"limel-badge\",{\"label\":[520]}]]],[\"limel-chip_2.cjs\",[[1,\"limel-chip-set\",{\"value\":[16],\"type\":[513],\"label\":[513],\"helperText\":[513,\"helper-text\"],\"disabled\":[516],\"readonly\":[516],\"invalid\":[516],\"inputType\":[513,\"input-type\"],\"maxItems\":[514,\"max-items\"],\"required\":[516],\"searchLabel\":[513,\"search-label\"],\"emptyInputOnBlur\":[516,\"empty-input-on-blur\"],\"clearAllButton\":[4,\"clear-all-button\"],\"leadingIcon\":[513,\"leading-icon\"],\"delimiter\":[513],\"autocomplete\":[513],\"language\":[1],\"editMode\":[32],\"textValue\":[32],\"blurred\":[32],\"inputChipIndexSelected\":[32],\"selectedChipIds\":[32],\"getEditMode\":[64],\"setFocus\":[64],\"emptyInput\":[64]}],[17,\"limel-chip\",{\"language\":[513],\"text\":[513],\"icon\":[1],\"image\":[16],\"link\":[16],\"badge\":[520],\"disabled\":[516],\"readonly\":[516],\"selected\":[516],\"invalid\":[516],\"removable\":[516],\"type\":[513],\"loading\":[516],\"progress\":[514],\"identifier\":[520],\"size\":[513],\"menuItems\":[16]}]]],[\"limel-button.cjs\",[[17,\"limel-button\",{\"label\":[513],\"primary\":[516],\"outlined\":[516],\"icon\":[513],\"disabled\":[516],\"loading\":[516],\"loadingFailed\":[516,\"loading-failed\"],\"justLoaded\":[32]}]]],[\"limel-linear-progress.cjs\",[[1,\"limel-linear-progress\",{\"language\":[513],\"value\":[514],\"indeterminate\":[516],\"accessibleLabel\":[513,\"accessible-label\"]}]]],[\"limel-markdown.cjs\",[[1,\"limel-markdown\",{\"value\":[1],\"whitelist\":[16],\"lazyLoadImages\":[4,\"lazy-load-images\"]}]]],[\"limel-popover_2.cjs\",[[1,\"limel-popover\",{\"open\":[4],\"openDirection\":[513,\"open-direction\"]}],[1,\"limel-popover-surface\",{\"contentCollection\":[16]}]]],[\"limel-helper-line_2.cjs\",[[4,\"limel-notched-outline\",{\"required\":[516],\"readonly\":[516],\"invalid\":[516],\"disabled\":[516],\"label\":[513],\"labelId\":[513,\"label-id\"],\"hasValue\":[516,\"has-value\"],\"hasLeadingIcon\":[516,\"has-leading-icon\"],\"hasFloatingLabel\":[516,\"has-floating-label\"]}],[1,\"limel-helper-line\",{\"helperText\":[513,\"helper-text\"],\"length\":[514],\"maxLength\":[514,\"max-length\"],\"invalid\":[516],\"helperTextId\":[513,\"helper-text-id\"]}]]],[\"limel-breadcrumbs_7.cjs\",[[1,\"limel-menu\",{\"items\":[16],\"disabled\":[516],\"openDirection\":[513,\"open-direction\"],\"surfaceWidth\":[513,\"surface-width\"],\"open\":[1540],\"badgeIcons\":[516,\"badge-icons\"],\"gridLayout\":[516,\"grid-layout\"],\"loading\":[516],\"currentSubMenu\":[1040],\"rootItem\":[16],\"searcher\":[16],\"emptyResultMessage\":[1,\"empty-result-message\"],\"loadingSubItems\":[32],\"searchValue\":[32],\"searchResults\":[32]}],[1,\"limel-breadcrumbs\",{\"items\":[16],\"divider\":[1]}],[17,\"limel-menu-list\",{\"items\":[16],\"badgeIcons\":[4,\"badge-icons\"],\"iconSize\":[1,\"icon-size\"]}],[1,\"limel-input-field\",{\"disabled\":[516],\"readonly\":[516],\"invalid\":[516],\"label\":[513],\"placeholder\":[513],\"helperText\":[513,\"helper-text\"],\"prefix\":[513],\"suffix\":[513],\"required\":[516],\"value\":[513],\"trailingIcon\":[513,\"trailing-icon\"],\"leadingIcon\":[513,\"leading-icon\"],\"pattern\":[513],\"type\":[513],\"formatNumber\":[516,\"format-number\"],\"step\":[520],\"max\":[514],\"min\":[514],\"maxlength\":[514],\"minlength\":[514],\"completions\":[16],\"showLink\":[516,\"show-link\"],\"locale\":[513],\"isFocused\":[32],\"wasInvalid\":[32],\"showCompletions\":[32]}],[1,\"limel-menu-surface\",{\"open\":[4],\"allowClicksElement\":[16]}],[1,\"limel-spinner\",{\"size\":[513],\"limeBranded\":[4,\"lime-branded\"]}],[17,\"limel-list\",{\"items\":[16],\"badgeIcons\":[4,\"badge-icons\"],\"iconSize\":[1,\"icon-size\"],\"type\":[1],\"maxLinesSecondaryText\":[2,\"max-lines-secondary-text\"]}]]]]"), options);
18
18
  });
19
19
  };
20
20
 
@@ -538,6 +538,8 @@ span.CodeMirror-selectedtext { background: none; }
538
538
  */
539
539
  :host {
540
540
  display: flex;
541
+ flex-direction: column;
542
+ width: 100%;
541
543
  font-size: var(--code-editor-font-size, 0.8125rem);
542
544
  --code-editor-neutral-text-color: var(--contrast-1100);
543
545
  --code-editor-background-color: var(--contrast-200);
@@ -685,6 +687,7 @@ span.CodeMirror-selectedtext { background: none; }
685
687
  display: flex;
686
688
  align-items: stretch;
687
689
  width: 100%;
690
+ min-height: 2.5rem;
688
691
  }
689
692
  .editor.readonly .CodeMirror-focused .CodeMirror-cursors {
690
693
  visibility: visible !important;
@@ -722,6 +725,9 @@ span.CodeMirror-selectedtext { background: none; }
722
725
  border-color: rgba(var(--code-editor-neutral-text-color), 0.5);
723
726
  border-width: 0.125rem;
724
727
  }
728
+ .cm-s-lime .CodeMirror-lines {
729
+ padding: 0.25rem 0;
730
+ }
725
731
  .cm-s-lime .CodeMirror-activeline-background {
726
732
  background: rgba(var(--code-editor-selection-lowlight-color), 0.5);
727
733
  }
@@ -794,4 +800,27 @@ span.CodeMirror-selectedtext { background: none; }
794
800
  }
795
801
  .cm-s-lime .CodeMirror-foldgutter-folded {
796
802
  opacity: 0.7;
803
+ }
804
+
805
+ limel-notched-outline {
806
+ flex-grow: 1;
807
+ }
808
+
809
+ :host(limel-code-editor:focus),
810
+ :host(limel-code-editor:focus-visible),
811
+ :host(limel-code-editor:focus-within) {
812
+ --limel-h-l-grid-template-rows-transition-speed: 0.46s;
813
+ --limel-h-l-grid-template-rows: 1fr;
814
+ }
815
+
816
+ :host(limel-code-editor) {
817
+ --limel-h-l-grid-template-rows-transition-speed: 0.3s;
818
+ --limel-h-l-grid-template-rows: 0fr;
819
+ }
820
+
821
+ :host(limel-code-editor:focus) limel-helper-line,
822
+ :host(limel-code-editor:focus-visible) limel-helper-line,
823
+ :host(limel-code-editor:focus-within) limel-helper-line,
824
+ :host(limel-code-editor:hover) limel-helper-line {
825
+ will-change: grid-template-rows;
797
826
  }
@@ -1,4 +1,5 @@
1
- import { h, } from '@stencil/core';
1
+ import { h, Host, } from '@stencil/core';
2
+ import { createRandomString } from '../../util/random-string';
2
3
  import CodeMirror from 'codemirror';
3
4
  import 'codemirror/mode/css/css';
4
5
  import 'codemirror/mode/htmlmixed/htmlmixed';
@@ -17,6 +18,7 @@ import jslint from 'jsonlint-mod';
17
18
  * @exampleComponent limel-example-code-editor
18
19
  * @exampleComponent limel-example-code-editor-readonly-with-line-numbers
19
20
  * @exampleComponent limel-example-code-editor-fold-lint-wrap
21
+ * @exampleComponent limel-example-code-editor-composite
20
22
  */
21
23
  export class CodeEditor {
22
24
  constructor() {
@@ -35,15 +37,28 @@ export class CodeEditor {
35
37
  }
36
38
  this.editor.refresh();
37
39
  };
40
+ this.renderHelperLine = () => {
41
+ if (!this.helperText) {
42
+ return;
43
+ }
44
+ return (h("limel-helper-line", { helperText: this.helperText, helperTextId: this.helperTextId, invalid: this.invalid }));
45
+ };
38
46
  this.value = '';
39
47
  this.language = undefined;
40
48
  this.readonly = false;
49
+ this.disabled = false;
50
+ this.invalid = false;
51
+ this.required = false;
52
+ this.label = undefined;
53
+ this.helperText = undefined;
41
54
  this.lineNumbers = false;
42
55
  this.lineWrapping = false;
43
56
  this.fold = false;
44
57
  this.lint = false;
45
58
  this.colorScheme = 'auto';
46
59
  this.random = undefined;
60
+ this.labelId = createRandomString();
61
+ this.helperTextId = createRandomString();
47
62
  }
48
63
  connectedCallback() {
49
64
  this.observer = new ResizeObserver(this.handleResize);
@@ -67,6 +82,7 @@ export class CodeEditor {
67
82
  return;
68
83
  }
69
84
  this.editor = this.createEditor();
85
+ this.updateInputFieldAccessibilityAttributes();
70
86
  }
71
87
  watchValue(newValue) {
72
88
  if (!this.editor) {
@@ -80,6 +96,23 @@ export class CodeEditor {
80
96
  }
81
97
  this.editor.getDoc().setValue(newValue || '');
82
98
  }
99
+ watchDisabled() {
100
+ this.updateEditorReadOnlyState();
101
+ this.updateInputFieldAccessibilityAttributes();
102
+ }
103
+ watchReadonly() {
104
+ this.updateEditorReadOnlyState();
105
+ this.updateInputFieldAccessibilityAttributes();
106
+ }
107
+ watchInvalid() {
108
+ this.updateInputFieldAccessibilityAttributes();
109
+ }
110
+ watchRequired() {
111
+ this.updateInputFieldAccessibilityAttributes();
112
+ }
113
+ watchHelperText() {
114
+ this.updateInputFieldAccessibilityAttributes();
115
+ }
83
116
  createEditor() {
84
117
  const options = this.getOptions();
85
118
  const editor = CodeMirror(this.host.shadowRoot.querySelector('.editor'), options);
@@ -130,7 +163,7 @@ export class CodeEditor {
130
163
  mode: mode,
131
164
  value: this.value || '',
132
165
  theme: theme,
133
- readOnly: this.readonly,
166
+ readOnly: this.getReadOnlyOption(),
134
167
  tabSize: TAB_SIZE,
135
168
  indentUnit: TAB_SIZE,
136
169
  lineNumbers: this.lineNumbers,
@@ -152,11 +185,12 @@ export class CodeEditor {
152
185
  render() {
153
186
  const classList = {
154
187
  editor: true,
155
- readonly: this.readonly,
188
+ readonly: this.readonly || this.disabled,
189
+ disabled: this.disabled,
156
190
  'is-dark-mode': this.isDarkMode(),
157
191
  'is-light-mode': !this.isDarkMode(),
158
192
  };
159
- return h("div", { class: classList });
193
+ return (h(Host, null, h("limel-notched-outline", { labelId: this.labelId, label: this.label, required: this.required, invalid: this.invalid, disabled: this.disabled, readonly: this.readonly, hasValue: !!this.value, hasFloatingLabel: true }, h("div", { slot: "content", class: classList })), this.renderHelperLine()));
160
194
  }
161
195
  forceRedraw() {
162
196
  // eslint-disable-next-line sonarjs/pseudo-random
@@ -165,6 +199,60 @@ export class CodeEditor {
165
199
  get darkMode() {
166
200
  return matchMedia('(prefers-color-scheme: dark)');
167
201
  }
202
+ updateEditorReadOnlyState() {
203
+ if (!this.editor) {
204
+ return;
205
+ }
206
+ this.editor.setOption('readOnly', this.getReadOnlyOption());
207
+ }
208
+ getReadOnlyOption() {
209
+ if (this.disabled) {
210
+ return 'nocursor';
211
+ }
212
+ return this.readonly;
213
+ }
214
+ updateInputFieldAccessibilityAttributes() {
215
+ if (!this.editor) {
216
+ return;
217
+ }
218
+ const inputField = this.editor.getInputField();
219
+ if (!inputField) {
220
+ return;
221
+ }
222
+ inputField.id = this.labelId;
223
+ if (this.helperText) {
224
+ inputField.setAttribute('aria-describedby', this.helperTextId);
225
+ inputField.setAttribute('aria-controls', this.helperTextId);
226
+ }
227
+ else {
228
+ inputField.removeAttribute('aria-describedby');
229
+ inputField.removeAttribute('aria-controls');
230
+ }
231
+ if (this.required) {
232
+ inputField.setAttribute('aria-required', 'true');
233
+ }
234
+ else {
235
+ inputField.removeAttribute('aria-required');
236
+ }
237
+ if (this.invalid) {
238
+ inputField.setAttribute('aria-invalid', 'true');
239
+ }
240
+ else {
241
+ inputField.removeAttribute('aria-invalid');
242
+ }
243
+ if (this.disabled) {
244
+ inputField.setAttribute('aria-disabled', 'true');
245
+ }
246
+ else {
247
+ inputField.removeAttribute('aria-disabled');
248
+ }
249
+ if (this.readonly || this.disabled) {
250
+ inputField.setAttribute('aria-readonly', 'true');
251
+ }
252
+ else {
253
+ inputField.removeAttribute('aria-readonly');
254
+ }
255
+ }
168
256
  static get is() { return "limel-code-editor"; }
169
257
  static get encapsulation() { return "shadow"; }
170
258
  static get originalStyleUrls() {
@@ -231,12 +319,100 @@ export class CodeEditor {
231
319
  "optional": false,
232
320
  "docs": {
233
321
  "tags": [],
234
- "text": "Disables editing of the editor content"
322
+ "text": "Set to `true` to make the editor read-only.\nUse `readonly` when the editor is only there to present the data it holds,\nand will not become possible for the current user to edit."
235
323
  },
236
324
  "attribute": "readonly",
237
- "reflect": false,
325
+ "reflect": true,
326
+ "defaultValue": "false"
327
+ },
328
+ "disabled": {
329
+ "type": "boolean",
330
+ "mutable": false,
331
+ "complexType": {
332
+ "original": "boolean",
333
+ "resolved": "boolean",
334
+ "references": {}
335
+ },
336
+ "required": false,
337
+ "optional": false,
338
+ "docs": {
339
+ "tags": [],
340
+ "text": "Set to `true` to disable the editor.\nUse `disabled` to indicate that the editor can normally be interacted\nwith, but is currently disabled. This tells the user that if certain\nrequirements are met, the editor may become enabled again."
341
+ },
342
+ "attribute": "disabled",
343
+ "reflect": true,
344
+ "defaultValue": "false"
345
+ },
346
+ "invalid": {
347
+ "type": "boolean",
348
+ "mutable": false,
349
+ "complexType": {
350
+ "original": "boolean",
351
+ "resolved": "boolean",
352
+ "references": {}
353
+ },
354
+ "required": false,
355
+ "optional": false,
356
+ "docs": {
357
+ "tags": [],
358
+ "text": "Set to `true` to indicate that the current value of the input editor is\ninvalid."
359
+ },
360
+ "attribute": "invalid",
361
+ "reflect": true,
362
+ "defaultValue": "false"
363
+ },
364
+ "required": {
365
+ "type": "boolean",
366
+ "mutable": false,
367
+ "complexType": {
368
+ "original": "boolean",
369
+ "resolved": "boolean",
370
+ "references": {}
371
+ },
372
+ "required": false,
373
+ "optional": false,
374
+ "docs": {
375
+ "tags": [],
376
+ "text": "Set to `true` to indicate that the field is required."
377
+ },
378
+ "attribute": "required",
379
+ "reflect": true,
238
380
  "defaultValue": "false"
239
381
  },
382
+ "label": {
383
+ "type": "string",
384
+ "mutable": false,
385
+ "complexType": {
386
+ "original": "string",
387
+ "resolved": "string",
388
+ "references": {}
389
+ },
390
+ "required": false,
391
+ "optional": true,
392
+ "docs": {
393
+ "tags": [],
394
+ "text": "The input label."
395
+ },
396
+ "attribute": "label",
397
+ "reflect": true
398
+ },
399
+ "helperText": {
400
+ "type": "string",
401
+ "mutable": false,
402
+ "complexType": {
403
+ "original": "string",
404
+ "resolved": "string",
405
+ "references": {}
406
+ },
407
+ "required": false,
408
+ "optional": true,
409
+ "docs": {
410
+ "tags": [],
411
+ "text": "Optional helper text to display below the input field when it has focus"
412
+ },
413
+ "attribute": "helper-text",
414
+ "reflect": true
415
+ },
240
416
  "lineNumbers": {
241
417
  "type": "boolean",
242
418
  "mutable": false,
@@ -252,7 +428,7 @@ export class CodeEditor {
252
428
  "text": "Displays line numbers in the editor"
253
429
  },
254
430
  "attribute": "line-numbers",
255
- "reflect": false,
431
+ "reflect": true,
256
432
  "defaultValue": "false"
257
433
  },
258
434
  "lineWrapping": {
@@ -270,7 +446,7 @@ export class CodeEditor {
270
446
  "text": "Wraps long lines instead of showing horizontal scrollbar"
271
447
  },
272
448
  "attribute": "line-wrapping",
273
- "reflect": false,
449
+ "reflect": true,
274
450
  "defaultValue": "false"
275
451
  },
276
452
  "fold": {
@@ -288,7 +464,7 @@ export class CodeEditor {
288
464
  "text": "Allows the user to fold code"
289
465
  },
290
466
  "attribute": "fold",
291
- "reflect": false,
467
+ "reflect": true,
292
468
  "defaultValue": "false"
293
469
  },
294
470
  "lint": {
@@ -306,7 +482,7 @@ export class CodeEditor {
306
482
  "text": "Enables linting of JSON content"
307
483
  },
308
484
  "attribute": "lint",
309
- "reflect": false,
485
+ "reflect": true,
310
486
  "defaultValue": "false"
311
487
  },
312
488
  "colorScheme": {
@@ -329,7 +505,7 @@ export class CodeEditor {
329
505
  "text": "Select color scheme for the editor"
330
506
  },
331
507
  "attribute": "color-scheme",
332
- "reflect": false,
508
+ "reflect": true,
333
509
  "defaultValue": "'auto'"
334
510
  }
335
511
  };
@@ -362,6 +538,21 @@ export class CodeEditor {
362
538
  return [{
363
539
  "propName": "value",
364
540
  "methodName": "watchValue"
541
+ }, {
542
+ "propName": "disabled",
543
+ "methodName": "watchDisabled"
544
+ }, {
545
+ "propName": "readonly",
546
+ "methodName": "watchReadonly"
547
+ }, {
548
+ "propName": "invalid",
549
+ "methodName": "watchInvalid"
550
+ }, {
551
+ "propName": "required",
552
+ "methodName": "watchRequired"
553
+ }, {
554
+ "propName": "helperText",
555
+ "methodName": "watchHelperText"
365
556
  }];
366
557
  }
367
558
  }
@@ -1 +1 @@
1
- {"version":3,"file":"code-editor.js","sourceRoot":"","sources":["../../../src/components/code-editor/code-editor.tsx"],"names":[],"mappings":"AAAA,OAAO,EACH,SAAS,EACT,CAAC,EACD,IAAI,EACJ,OAAO,EACP,KAAK,EAEL,KAAK,EACL,KAAK,GACR,MAAM,eAAe,CAAC;AAEvB,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,yBAAyB,CAAC;AACjC,OAAO,qCAAqC,CAAC;AAC7C,OAAO,uCAAuC,CAAC;AAC/C,OAAO,+BAA+B,CAAC;AACvC,OAAO,wCAAwC,CAAC;AAChD,OAAO,qCAAqC,CAAC;AAC7C,OAAO,iCAAiC,CAAC;AACzC,OAAO,4BAA4B,CAAC;AACpC,OAAO,iCAAiC,CAAC;AACzC,OAAO,kCAAkC,CAAC;AAC1C,OAAO,kCAAkC,CAAC;AAC1C,OAAO,gCAAgC,CAAC;AACxC,OAAO,MAAM,MAAM,cAAc,CAAC;AAElC;;;;GAIG;AAMH,MAAM,OAAO,UAAU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AE,IAAI,EAAE;MAC7B,IAAI,EAAE,IAAI,CAAC,IAAI;MACf,UAAU,EAAE,IAAI,CAAC,IAAI;MACrB,OAAO,EAAE,OAAO;KACnB,CAAC;EACN,CAAC;EAEO,UAAU;IACd,IAAI,IAAI,CAAC,WAAW,KAAK,MAAM,EAAE;MAC7B,OAAO,IAAI,CAAC,WAAW,KAAK,MAAM,CAAC;KACtC;IAED,OAAO,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC;EACjC,CAAC;EAEM,MAAM;IACT,MAAM,SAAS,GAAG;MACd,MAAM,EAAE,IAAI;MACZ,QAAQ,EAAE,IAAI,CAAC,QAAQ;MACvB,cAAc,EAAE,IAAI,CAAC,UAAU,EAAE;MACjC,eAAe,EAAE,CAAC,IAAI,CAAC,UAAU,EAAE;KACtC,CAAC;IAEF,OAAO,WAAK,KAAK,EAAE,SAAS,GAAI,CAAC;EACrC,CAAC;EAEO,WAAW;IACf,iDAAiD;IACjD,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC;EAChC,CAAC;EAED,IAAY,QAAQ;IAChB,OAAO,UAAU,CAAC,8BAA8B,CAAC,CAAC;EACtD,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACJ","sourcesContent":["import {\n Component,\n h,\n Prop,\n Element,\n Event,\n EventEmitter,\n State,\n Watch,\n} from '@stencil/core';\nimport { ColorScheme, Language } from './code-editor.types';\nimport CodeMirror from 'codemirror';\nimport 'codemirror/mode/css/css';\nimport 'codemirror/mode/htmlmixed/htmlmixed';\nimport 'codemirror/mode/javascript/javascript';\nimport 'codemirror/mode/jinja2/jinja2';\nimport 'codemirror/addon/selection/active-line';\nimport 'codemirror/addon/edit/matchbrackets';\nimport 'codemirror/addon/edit/matchtags';\nimport 'codemirror/addon/lint/lint';\nimport 'codemirror/addon/lint/json-lint';\nimport 'codemirror/addon/fold/foldgutter';\nimport 'codemirror/addon/fold/brace-fold';\nimport 'codemirror/addon/fold/xml-fold';\nimport jslint from 'jsonlint-mod';\n\n/**\n * @exampleComponent limel-example-code-editor\n * @exampleComponent limel-example-code-editor-readonly-with-line-numbers\n * @exampleComponent limel-example-code-editor-fold-lint-wrap\n */\n@Component({\n tag: 'limel-code-editor',\n shadow: true,\n styleUrl: 'code-editor.scss',\n})\nexport class CodeEditor {\n /**\n * The code to be rendered\n */\n @Prop()\n public value: string = '';\n\n /**\n * The language of the code\n */\n @Prop()\n public language: Language;\n\n /**\n * Disables editing of the editor content\n */\n @Prop()\n public readonly: boolean = false;\n\n /**\n * Displays line numbers in the editor\n */\n @Prop()\n public lineNumbers: boolean = false;\n\n /**\n * Wraps long lines instead of showing horizontal scrollbar\n */\n @Prop()\n public lineWrapping: boolean = false;\n\n /**\n * Allows the user to fold code\n */\n @Prop()\n public fold: boolean = false;\n\n /**\n * Enables linting of JSON content\n */\n @Prop()\n public lint: boolean = false;\n\n /**\n * Select color scheme for the editor\n */\n @Prop()\n public colorScheme: ColorScheme = 'auto';\n\n /**\n * Emitted when the code has changed. Will only be emitted when the code\n * area has lost focus\n */\n @Event()\n public change: EventEmitter<string>;\n\n @Element()\n private host: HTMLLimelCodeEditorElement;\n\n /**\n * This is only used to trigger a redraw if the\n * `(prefers-color-scheme: dark)` media query is changed\n */\n @State()\n protected random: number;\n\n private editor: CodeMirror.Editor;\n private observer: ResizeObserver;\n\n public connectedCallback() {\n this.observer = new ResizeObserver(this.handleResize) as any;\n this.observer.observe(this.host);\n\n this.darkMode.addEventListener('change', this.handleChangeDarkMode);\n }\n\n public disconnectedCallback() {\n this.observer.unobserve(this.host);\n this.editor?.off('change', this.handleChange);\n this.editor = null;\n\n this.darkMode.removeEventListener('change', this.handleChangeDarkMode);\n\n const editorElement = this.host.shadowRoot.querySelector('.editor');\n // eslint-disable-next-line no-unsafe-optional-chaining\n for (const child of editorElement?.childNodes) {\n child.remove();\n }\n }\n\n public componentDidRender() {\n if (this.editor) {\n return;\n }\n\n this.editor = this.createEditor();\n }\n\n @Watch('value')\n protected watchValue(newValue: string) {\n if (!this.editor) {\n return;\n }\n\n const currentValue = this.editor.getValue();\n if (newValue === currentValue) {\n // Circuit breaker for when the change comes from the editor itself\n // The caret position will be reset without this\n return;\n }\n\n this.editor.getDoc().setValue(newValue || '');\n }\n\n private handleChangeDarkMode = () => {\n if (this.colorScheme !== 'auto') {\n return;\n }\n\n this.forceRedraw();\n };\n\n private handleChange = () => {\n this.change.emit(this.editor.getValue());\n };\n\n private handleResize = () => {\n if (!this.editor) {\n return;\n }\n\n this.editor.refresh();\n };\n\n private createEditor() {\n const options = this.getOptions();\n\n const editor = CodeMirror(\n this.host.shadowRoot.querySelector('.editor'),\n options\n );\n\n editor.on('change', this.handleChange);\n\n // Replace tab with spaces and use the actual indent setting for\n // the space count\n editor.setOption('extraKeys', {\n Tab: (codeMirror) => {\n const spaces = ' '.repeat(codeMirror.getOption('indentUnit'));\n codeMirror.replaceSelection(spaces);\n },\n });\n\n return editor;\n }\n\n private getOptions(): CodeMirror.EditorConfiguration {\n let mode: string | CodeMirror.ModeSpec<any> = this.language;\n const TAB_SIZE = 4;\n let theme = 'lime light';\n const gutters = [];\n\n if (this.isDarkMode()) {\n theme = 'lime dark';\n }\n\n if (this.language === 'json') {\n mode = {\n name: 'application/json',\n json: true,\n };\n if (this.lint) {\n gutters.push('CodeMirror-lint-markers');\n if (!('jsonlint' in window)) {\n window['jsonlint'] = jslint;\n }\n }\n } else if (this.language === 'typescript') {\n mode = {\n name: 'application/typescript',\n typescript: true,\n };\n } else if (this.language === 'html') {\n mode = 'htmlmixed';\n }\n\n if (this.fold) {\n gutters.push('CodeMirror-foldgutter');\n }\n\n return {\n mode: mode,\n value: this.value || '',\n theme: theme,\n readOnly: this.readonly,\n tabSize: TAB_SIZE,\n indentUnit: TAB_SIZE,\n lineNumbers: this.lineNumbers,\n lineWrapping: this.lineWrapping,\n styleActiveLine: true,\n matchBrackets: true,\n matchTags: { bothTags: true },\n lint: this.lint,\n foldGutter: this.fold,\n gutters: gutters,\n };\n }\n\n private isDarkMode(): boolean {\n if (this.colorScheme !== 'auto') {\n return this.colorScheme === 'dark';\n }\n\n return this.darkMode.matches;\n }\n\n public render() {\n const classList = {\n editor: true,\n readonly: this.readonly,\n 'is-dark-mode': this.isDarkMode(),\n 'is-light-mode': !this.isDarkMode(),\n };\n\n return <div class={classList} />;\n }\n\n private forceRedraw() {\n // eslint-disable-next-line sonarjs/pseudo-random\n this.random = Math.random();\n }\n\n private get darkMode(): MediaQueryList {\n return matchMedia('(prefers-color-scheme: dark)');\n }\n}\n"]}
1
+ {"version":3,"file":"code-editor.js","sourceRoot":"","sources":["../../../src/components/code-editor/code-editor.tsx"],"names":[],"mappings":"AAAA,OAAO,EACH,SAAS,EACT,CAAC,EACD,IAAI,EACJ,OAAO,EACP,KAAK,EAEL,KAAK,EACL,KAAK,EACL,IAAI,GACP,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAE9D,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,yBAAyB,CAAC;AACjC,OAAO,qCAAqC,CAAC;AAC7C,OAAO,uCAAuC,CAAC;AAC/C,OAAO,+BAA+B,CAAC;AACvC,OAAO,wCAAwC,CAAC;AAChD,OAAO,qCAAqC,CAAC;AAC7C,OAAO,iCAAiC,CAAC;AACzC,OAAO,4BAA4B,CAAC;AACpC,OAAO,iCAAiC,CAAC;AACzC,OAAO,kCAAkC,CAAC;AAC1C,OAAO,kCAAkC,CAAC;AAC1C,OAAO,gCAAgC,CAAC;AACxC,OAAO,MAAM,MAAM,cAAc,CAAC;AAElC;;;;;GAKG;AAMH,MAAM,OAAO,UAA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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACJ","sourcesContent":["import {\n Component,\n h,\n Prop,\n Element,\n Event,\n EventEmitter,\n State,\n Watch,\n Host,\n} from '@stencil/core';\nimport { createRandomString } from '../../util/random-string';\nimport { ColorScheme, Language } from './code-editor.types';\nimport CodeMirror from 'codemirror';\nimport 'codemirror/mode/css/css';\nimport 'codemirror/mode/htmlmixed/htmlmixed';\nimport 'codemirror/mode/javascript/javascript';\nimport 'codemirror/mode/jinja2/jinja2';\nimport 'codemirror/addon/selection/active-line';\nimport 'codemirror/addon/edit/matchbrackets';\nimport 'codemirror/addon/edit/matchtags';\nimport 'codemirror/addon/lint/lint';\nimport 'codemirror/addon/lint/json-lint';\nimport 'codemirror/addon/fold/foldgutter';\nimport 'codemirror/addon/fold/brace-fold';\nimport 'codemirror/addon/fold/xml-fold';\nimport jslint from 'jsonlint-mod';\n\n/**\n * @exampleComponent limel-example-code-editor\n * @exampleComponent limel-example-code-editor-readonly-with-line-numbers\n * @exampleComponent limel-example-code-editor-fold-lint-wrap\n * @exampleComponent limel-example-code-editor-composite\n */\n@Component({\n tag: 'limel-code-editor',\n shadow: true,\n styleUrl: 'code-editor.scss',\n})\nexport class CodeEditor {\n /**\n * The code to be rendered\n */\n @Prop()\n public value: string = '';\n\n /**\n * The language of the code\n */\n @Prop()\n public language: Language;\n\n /**\n * Set to `true` to make the editor read-only.\n * Use `readonly` when the editor is only there to present the data it holds,\n * and will not become possible for the current user to edit.\n */\n @Prop({ reflect: true })\n public readonly = false;\n\n /**\n * Set to `true` to disable the editor.\n * Use `disabled` to indicate that the editor can normally be interacted\n * with, but is currently disabled. This tells the user that if certain\n * requirements are met, the editor may become enabled again.\n */\n @Prop({ reflect: true })\n public disabled = false;\n\n /**\n * Set to `true` to indicate that the current value of the input editor is\n * invalid.\n */\n @Prop({ reflect: true })\n public invalid = false;\n\n /**\n * Set to `true` to indicate that the field is required.\n */\n @Prop({ reflect: true })\n public required = false;\n\n /**\n * The input label.\n */\n @Prop({ reflect: true })\n public label?: string;\n\n /**\n * Optional helper text to display below the input field when it has focus\n */\n @Prop({ reflect: true })\n public helperText?: string;\n\n /**\n * Displays line numbers in the editor\n */\n @Prop({ reflect: true })\n public lineNumbers = false;\n\n /**\n * Wraps long lines instead of showing horizontal scrollbar\n */\n @Prop({ reflect: true })\n public lineWrapping = false;\n\n /**\n * Allows the user to fold code\n */\n @Prop({ reflect: true })\n public fold = false;\n\n /**\n * Enables linting of JSON content\n */\n @Prop({ reflect: true })\n public lint = false;\n\n /**\n * Select color scheme for the editor\n */\n @Prop({ reflect: true })\n public colorScheme: ColorScheme = 'auto';\n\n /**\n * Emitted when the code has changed. Will only be emitted when the code\n * area has lost focus\n */\n @Event()\n public change: EventEmitter<string>;\n\n @Element()\n private host: HTMLLimelCodeEditorElement;\n\n /**\n * This is only used to trigger a redraw if the\n * `(prefers-color-scheme: dark)` media query is changed\n */\n @State()\n protected random: number;\n\n private editor: CodeMirror.Editor;\n private observer: ResizeObserver;\n private labelId: string;\n private helperTextId: string;\n\n public constructor() {\n this.labelId = createRandomString();\n this.helperTextId = createRandomString();\n }\n\n public connectedCallback() {\n this.observer = new ResizeObserver(this.handleResize) as any;\n this.observer.observe(this.host);\n\n this.darkMode.addEventListener('change', this.handleChangeDarkMode);\n }\n\n public disconnectedCallback() {\n this.observer.unobserve(this.host);\n this.editor?.off('change', this.handleChange);\n this.editor = null;\n\n this.darkMode.removeEventListener('change', this.handleChangeDarkMode);\n\n const editorElement = this.host.shadowRoot.querySelector('.editor');\n // eslint-disable-next-line no-unsafe-optional-chaining\n for (const child of editorElement?.childNodes) {\n child.remove();\n }\n }\n\n public componentDidRender() {\n if (this.editor) {\n return;\n }\n\n this.editor = this.createEditor();\n this.updateInputFieldAccessibilityAttributes();\n }\n\n @Watch('value')\n protected watchValue(newValue: string) {\n if (!this.editor) {\n return;\n }\n\n const currentValue = this.editor.getValue();\n if (newValue === currentValue) {\n // Circuit breaker for when the change comes from the editor itself\n // The caret position will be reset without this\n return;\n }\n\n this.editor.getDoc().setValue(newValue || '');\n }\n\n @Watch('disabled')\n protected watchDisabled() {\n this.updateEditorReadOnlyState();\n this.updateInputFieldAccessibilityAttributes();\n }\n\n @Watch('readonly')\n protected watchReadonly() {\n this.updateEditorReadOnlyState();\n this.updateInputFieldAccessibilityAttributes();\n }\n\n @Watch('invalid')\n protected watchInvalid() {\n this.updateInputFieldAccessibilityAttributes();\n }\n\n @Watch('required')\n protected watchRequired() {\n this.updateInputFieldAccessibilityAttributes();\n }\n\n @Watch('helperText')\n protected watchHelperText() {\n this.updateInputFieldAccessibilityAttributes();\n }\n\n private handleChangeDarkMode = () => {\n if (this.colorScheme !== 'auto') {\n return;\n }\n\n this.forceRedraw();\n };\n\n private handleChange = () => {\n this.change.emit(this.editor.getValue());\n };\n\n private handleResize = () => {\n if (!this.editor) {\n return;\n }\n\n this.editor.refresh();\n };\n\n private createEditor() {\n const options = this.getOptions();\n\n const editor = CodeMirror(\n this.host.shadowRoot.querySelector('.editor'),\n options\n );\n\n editor.on('change', this.handleChange);\n\n // Replace tab with spaces and use the actual indent setting for\n // the space count\n editor.setOption('extraKeys', {\n Tab: (codeMirror) => {\n const spaces = ' '.repeat(codeMirror.getOption('indentUnit'));\n codeMirror.replaceSelection(spaces);\n },\n });\n\n return editor;\n }\n\n private getOptions(): CodeMirror.EditorConfiguration {\n let mode: string | CodeMirror.ModeSpec<any> = this.language;\n const TAB_SIZE = 4;\n let theme = 'lime light';\n const gutters = [];\n\n if (this.isDarkMode()) {\n theme = 'lime dark';\n }\n\n if (this.language === 'json') {\n mode = {\n name: 'application/json',\n json: true,\n };\n if (this.lint) {\n gutters.push('CodeMirror-lint-markers');\n if (!('jsonlint' in window)) {\n window['jsonlint'] = jslint;\n }\n }\n } else if (this.language === 'typescript') {\n mode = {\n name: 'application/typescript',\n typescript: true,\n };\n } else if (this.language === 'html') {\n mode = 'htmlmixed';\n }\n\n if (this.fold) {\n gutters.push('CodeMirror-foldgutter');\n }\n\n return {\n mode: mode,\n value: this.value || '',\n theme: theme,\n readOnly: this.getReadOnlyOption(),\n tabSize: TAB_SIZE,\n indentUnit: TAB_SIZE,\n lineNumbers: this.lineNumbers,\n lineWrapping: this.lineWrapping,\n styleActiveLine: true,\n matchBrackets: true,\n matchTags: { bothTags: true },\n lint: this.lint,\n foldGutter: this.fold,\n gutters: gutters,\n };\n }\n\n private isDarkMode(): boolean {\n if (this.colorScheme !== 'auto') {\n return this.colorScheme === 'dark';\n }\n\n return this.darkMode.matches;\n }\n\n public render() {\n const classList = {\n editor: true,\n readonly: this.readonly || this.disabled,\n disabled: this.disabled,\n 'is-dark-mode': this.isDarkMode(),\n 'is-light-mode': !this.isDarkMode(),\n };\n\n return (\n <Host>\n <limel-notched-outline\n labelId={this.labelId}\n label={this.label}\n required={this.required}\n invalid={this.invalid}\n disabled={this.disabled}\n readonly={this.readonly}\n hasValue={!!this.value}\n hasFloatingLabel={true}\n >\n <div slot=\"content\" class={classList} />\n </limel-notched-outline>\n {this.renderHelperLine()}\n </Host>\n );\n }\n\n private renderHelperLine = () => {\n if (!this.helperText) {\n return;\n }\n\n return (\n <limel-helper-line\n helperText={this.helperText}\n helperTextId={this.helperTextId}\n invalid={this.invalid}\n />\n );\n };\n\n private forceRedraw() {\n // eslint-disable-next-line sonarjs/pseudo-random\n this.random = Math.random();\n }\n\n private get darkMode(): MediaQueryList {\n return matchMedia('(prefers-color-scheme: dark)');\n }\n\n private updateEditorReadOnlyState() {\n if (!this.editor) {\n return;\n }\n\n this.editor.setOption('readOnly', this.getReadOnlyOption());\n }\n\n private getReadOnlyOption(): boolean | 'nocursor' {\n if (this.disabled) {\n return 'nocursor';\n }\n\n return this.readonly;\n }\n\n private updateInputFieldAccessibilityAttributes() {\n if (!this.editor) {\n return;\n }\n\n const inputField = this.editor.getInputField();\n if (!inputField) {\n return;\n }\n\n inputField.id = this.labelId;\n\n if (this.helperText) {\n inputField.setAttribute('aria-describedby', this.helperTextId);\n inputField.setAttribute('aria-controls', this.helperTextId);\n } else {\n inputField.removeAttribute('aria-describedby');\n inputField.removeAttribute('aria-controls');\n }\n\n if (this.required) {\n inputField.setAttribute('aria-required', 'true');\n } else {\n inputField.removeAttribute('aria-required');\n }\n\n if (this.invalid) {\n inputField.setAttribute('aria-invalid', 'true');\n } else {\n inputField.removeAttribute('aria-invalid');\n }\n\n if (this.disabled) {\n inputField.setAttribute('aria-disabled', 'true');\n } else {\n inputField.removeAttribute('aria-disabled');\n }\n\n if (this.readonly || this.disabled) {\n inputField.setAttribute('aria-readonly', 'true');\n } else {\n inputField.removeAttribute('aria-readonly');\n }\n }\n}\n"]}
@@ -135,6 +135,7 @@ export class ProsemirrorAdapter {
135
135
  const { doc, tr } = this.view.state;
136
136
  const resolvedPos = doc.resolve(this.lastClickedPos);
137
137
  const selection = Selection.near(resolvedPos);
138
+ tr.setMeta('pointer', true);
138
139
  this.view.dispatch(tr.setSelection(selection));
139
140
  }
140
141
  }, 0);
@@ -257,6 +258,8 @@ export class ProsemirrorAdapter {
257
258
  if (this.value) {
258
259
  this.updateView(this.value);
259
260
  }
261
+ // Initialize lastEmittedValue to prevent false change events
262
+ this.lastEmittedValue = this.contentConverter.serialize(this.view, this.schema);
260
263
  }
261
264
  initializeSchema() {
262
265
  let nodes = schema.spec.nodes;