typo3-typescript-sources 13.4.20
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.
- package/.github/workflows/sync-and-publish.yml +265 -0
- package/.last-synced-tag +1 -0
- package/LICENSE.txt +339 -0
- package/README-TYPO3.md +166 -0
- package/README.md +28 -0
- package/adminpanel/admin-panel.ts +375 -0
- package/adminpanel/modules/cache.ts +27 -0
- package/adminpanel/modules/preview.ts +75 -0
- package/backend/action-button/abstract-action.ts +22 -0
- package/backend/action-button/deferred-action.ts +41 -0
- package/backend/action-button/immediate-action.ts +31 -0
- package/backend/action-dispatcher.ts +104 -0
- package/backend/ajax-data-handler/message-interface.ts +18 -0
- package/backend/ajax-data-handler/response-interface.ts +20 -0
- package/backend/ajax-data-handler.ts +214 -0
- package/backend/backend-exception.ts +22 -0
- package/backend/broadcast-message.ts +50 -0
- package/backend/broadcast-service.ts +52 -0
- package/backend/browse-database.ts +38 -0
- package/backend/clear-cache.ts +88 -0
- package/backend/clipboard-panel.ts +240 -0
- package/backend/close-current-window.ts +2 -0
- package/backend/code-editor/autocomplete/completion-result.ts +105 -0
- package/backend/code-editor/autocomplete/ts-code-completion.ts +142 -0
- package/backend/code-editor/autocomplete/ts-parser.ts +485 -0
- package/backend/code-editor/autocomplete/ts-ref.ts +164 -0
- package/backend/code-editor/element/code-mirror-element.ts +282 -0
- package/backend/code-editor/language/typoscript.ts +181 -0
- package/backend/code-editor/stream-parser/typoscript.ts +1600 -0
- package/backend/color-picker.ts +158 -0
- package/backend/color-scheme-switch.ts +179 -0
- package/backend/column-selector-button.ts +302 -0
- package/backend/context-help.ts +68 -0
- package/backend/context-menu-actions.ts +322 -0
- package/backend/context-menu.ts +751 -0
- package/backend/copy-to-clipboard.ts +79 -0
- package/backend/date-time-picker.ts +270 -0
- package/backend/document-save-actions.ts +159 -0
- package/backend/drag-tooltip.ts +285 -0
- package/backend/drag-uploader.ts +914 -0
- package/backend/element/alert-element.ts +116 -0
- package/backend/element/dispatch-modal-button.ts +50 -0
- package/backend/element/draggable-resizable-element.ts +249 -0
- package/backend/element/editable-page-title.ts +306 -0
- package/backend/element/icon-element.ts +84 -0
- package/backend/element/immediate-action-element.ts +89 -0
- package/backend/element/pagination.ts +59 -0
- package/backend/element/progress-bar-element.ts +172 -0
- package/backend/element/progress-tracker-element.ts +119 -0
- package/backend/element/pseudo-button.ts +58 -0
- package/backend/element/spinner-element.ts +51 -0
- package/backend/element/thumbnail-element.ts +80 -0
- package/backend/element-browser.ts +182 -0
- package/backend/enum/data-transfer-types.ts +21 -0
- package/backend/enum/icon-types.ts +31 -0
- package/backend/enum/key-types.ts +27 -0
- package/backend/enum/severity.ts +20 -0
- package/backend/enum/viewport/scaffold-identifier.ts +24 -0
- package/backend/event/client-request.ts +25 -0
- package/backend/event/consumable.ts +18 -0
- package/backend/event/consumer-scope.ts +54 -0
- package/backend/event/event-dispatcher.ts +26 -0
- package/backend/event/interaction-request-assignment.ts +24 -0
- package/backend/event/interaction-request-map.ts +75 -0
- package/backend/event/interaction-request.ts +48 -0
- package/backend/event/trigger-request.ts +56 -0
- package/backend/form/submit-interceptor.ts +66 -0
- package/backend/form-engine/container/files-control-container.ts +716 -0
- package/backend/form-engine/container/flex-form-container-container.ts +166 -0
- package/backend/form-engine/container/flex-form-section-container.ts +210 -0
- package/backend/form-engine/container/inline-control-container.ts +1230 -0
- package/backend/form-engine/container/site-language-container.ts +616 -0
- package/backend/form-engine/element/abstract-sortable-select-items.ts +186 -0
- package/backend/form-engine/element/category-element.ts +160 -0
- package/backend/form-engine/element/color-element.ts +81 -0
- package/backend/form-engine/element/datetime-element.ts +66 -0
- package/backend/form-engine/element/extra/char-counter.ts +112 -0
- package/backend/form-engine/element/extra/select-box-filter.ts +85 -0
- package/backend/form-engine/element/folder-element.ts +66 -0
- package/backend/form-engine/element/group-element.ts +47 -0
- package/backend/form-engine/element/json-element.ts +52 -0
- package/backend/form-engine/element/link-element.ts +121 -0
- package/backend/form-engine/element/mfa-info-element.ts +169 -0
- package/backend/form-engine/element/modifier/resizable.ts +27 -0
- package/backend/form-engine/element/modifier/tabbable.ts +29 -0
- package/backend/form-engine/element/online-media-form-element.ts +65 -0
- package/backend/form-engine/element/password-element.ts +71 -0
- package/backend/form-engine/element/select-multiple-side-by-side-element.ts +83 -0
- package/backend/form-engine/element/select-single-element.ts +82 -0
- package/backend/form-engine/element/select-tree-element.ts +148 -0
- package/backend/form-engine/element/select-tree-toolbar.ts +118 -0
- package/backend/form-engine/element/select-tree.ts +210 -0
- package/backend/form-engine/element/slug-element.ts +243 -0
- package/backend/form-engine/element/suggest/result-container.ts +118 -0
- package/backend/form-engine/element/suggest/result-item.ts +90 -0
- package/backend/form-engine/element/table-permission-element.ts +101 -0
- package/backend/form-engine/element/table-wizard-element.ts +427 -0
- package/backend/form-engine/element/text-element.ts +52 -0
- package/backend/form-engine/element/text-table-element.ts +31 -0
- package/backend/form-engine/field-control/add-record.ts +40 -0
- package/backend/form-engine/field-control/edit-popup.ts +64 -0
- package/backend/form-engine/field-control/insert-clipboard.ts +50 -0
- package/backend/form-engine/field-control/link-popup.ts +53 -0
- package/backend/form-engine/field-control/list-module.ts +40 -0
- package/backend/form-engine/field-control/password-generator.ts +102 -0
- package/backend/form-engine/field-control/reset-selection.ts +48 -0
- package/backend/form-engine/field-wizard/localization-state-selector.ts +67 -0
- package/backend/form-engine/field-wizard/value-picker.ts +123 -0
- package/backend/form-engine/field-wizard/value-slider.ts +86 -0
- package/backend/form-engine/inline-relation/ajax-dispatcher.ts +124 -0
- package/backend/form-engine/inline-relation/inline-response-interface.ts +41 -0
- package/backend/form-engine-link-browser-adapter.ts +129 -0
- package/backend/form-engine-review.ts +155 -0
- package/backend/form-engine-suggest.ts +133 -0
- package/backend/form-engine-validation.ts +686 -0
- package/backend/form-engine.ts +1391 -0
- package/backend/global-event-handler.ts +252 -0
- package/backend/grid-editor.ts +1077 -0
- package/backend/hashing/md5.ts +252 -0
- package/backend/helper.ts +24 -0
- package/backend/hotkeys/hotkey-storage.ts +63 -0
- package/backend/hotkeys.ts +216 -0
- package/backend/icons.ts +236 -0
- package/backend/image-manipulation.ts +885 -0
- package/backend/info-window.ts +46 -0
- package/backend/input/clearable.ts +128 -0
- package/backend/input/index.d.ts +8 -0
- package/backend/java-script-module-import-event-handler.ts +19 -0
- package/backend/key-bindings.ts +42 -0
- package/backend/layout-module/drag-drop.ts +359 -0
- package/backend/layout-module/paste.ts +165 -0
- package/backend/link-browser.ts +89 -0
- package/backend/live-search/element/backend-search.ts +34 -0
- package/backend/live-search/element/hint.ts +33 -0
- package/backend/live-search/element/provider/default-result-item.ts +52 -0
- package/backend/live-search/element/provider/page-provider-result-item.ts +52 -0
- package/backend/live-search/element/result/item/action/action-container.ts +135 -0
- package/backend/live-search/element/result/item/action/action.ts +56 -0
- package/backend/live-search/element/result/item/item-container.ts +224 -0
- package/backend/live-search/element/result/item/item.ts +74 -0
- package/backend/live-search/element/result/result-container.ts +110 -0
- package/backend/live-search/element/result/result-detail-container.ts +50 -0
- package/backend/live-search/element/result/result-pagination.ts +122 -0
- package/backend/live-search/element/search-option-item.ts +70 -0
- package/backend/live-search/live-search-configurator.ts +54 -0
- package/backend/live-search/live-search-shortcut.ts +29 -0
- package/backend/live-search/result-types/backend-module-result-type.ts +8 -0
- package/backend/live-search/result-types/default-result-type.ts +21 -0
- package/backend/live-search/result-types/page-result-type.ts +23 -0
- package/backend/localization.ts +390 -0
- package/backend/login-refresh.ts +525 -0
- package/backend/login.ts +179 -0
- package/backend/mail-link-handler.ts +45 -0
- package/backend/modal-interface.ts +19 -0
- package/backend/modal.ts +685 -0
- package/backend/module/iframe.ts +125 -0
- package/backend/module/router.ts +275 -0
- package/backend/module-menu.ts +550 -0
- package/backend/module.ts +133 -0
- package/backend/multi-record-selection-action.ts +44 -0
- package/backend/multi-record-selection-delete-action.ts +108 -0
- package/backend/multi-record-selection-edit-action.ts +56 -0
- package/backend/multi-record-selection.ts +468 -0
- package/backend/multi-step-wizard.ts +568 -0
- package/backend/new-content-element-wizard-button.ts +51 -0
- package/backend/new-multiple-pages.ts +108 -0
- package/backend/new-record-wizard.ts +680 -0
- package/backend/notification.ts +366 -0
- package/backend/offset.ts +40 -0
- package/backend/online-media.ts +110 -0
- package/backend/page-actions.ts +91 -0
- package/backend/page-link-handler.ts +51 -0
- package/backend/pagetsconfig/pagetsconfig-includes.ts +77 -0
- package/backend/popover.ts +165 -0
- package/backend/record-download-button.ts +104 -0
- package/backend/record-link-handler.ts +31 -0
- package/backend/record-search.ts +44 -0
- package/backend/recordlist.ts +230 -0
- package/backend/resource/resource.ts +35 -0
- package/backend/security/element/csp-reports.ts +406 -0
- package/backend/security/element/sudo-mode.ts +249 -0
- package/backend/security/sudo-mode-interceptor.ts +19 -0
- package/backend/settings/editor/editable-setting.ts +231 -0
- package/backend/settings/editor.ts +451 -0
- package/backend/settings/enum/settings-mode.enum.ts +24 -0
- package/backend/settings/type/base.ts +200 -0
- package/backend/settings/type/bool.ts +56 -0
- package/backend/settings/type/color.ts +64 -0
- package/backend/settings/type/int.ts +85 -0
- package/backend/settings/type/number.ts +61 -0
- package/backend/settings/type/page.ts +100 -0
- package/backend/settings/type/string.ts +77 -0
- package/backend/settings/type/stringlist.ts +87 -0
- package/backend/severity.ts +88 -0
- package/backend/site-inline-actions.ts +32 -0
- package/backend/sortable-table.ts +208 -0
- package/backend/storage/abstract-client-storage.ts +76 -0
- package/backend/storage/browser-session.ts +28 -0
- package/backend/storage/client.ts +28 -0
- package/backend/storage/module-state-storage.ts +118 -0
- package/backend/storage/persistent.ts +204 -0
- package/backend/switch-user.ts +82 -0
- package/backend/tabs.ts +72 -0
- package/backend/telephone-link-handler.ts +40 -0
- package/backend/tests/backend/storage/browser-storage-test.ts +87 -0
- package/backend/tests/backend/storage/client-test.ts +87 -0
- package/backend/tests/backend/utility/dom-helper-test.ts +51 -0
- package/backend/tests/backend-exception-test.ts +28 -0
- package/backend/tests/element/immediate-action-element-test.ts +81 -0
- package/backend/tests/form-engine-validation-test.ts +304 -0
- package/backend/tests/grid-editor-test.ts +29 -0
- package/backend/tests/hashing/md5Test.ts +28 -0
- package/backend/tests/icons-test.ts +23 -0
- package/backend/tests/notification-test.ts +161 -0
- package/backend/tests/popover-test.ts +83 -0
- package/backend/toolbar/clear-cache-menu.ts +88 -0
- package/backend/toolbar/live-search.ts +284 -0
- package/backend/toolbar/shortcut-menu.ts +254 -0
- package/backend/toolbar/system-information-menu.ts +161 -0
- package/backend/toolbar.ts +41 -0
- package/backend/tree/file-storage-browser.ts +194 -0
- package/backend/tree/file-storage-tree-container.ts +465 -0
- package/backend/tree/file-storage-tree.ts +42 -0
- package/backend/tree/page-browser.ts +272 -0
- package/backend/tree/page-tree-element.ts +602 -0
- package/backend/tree/page-tree.ts +152 -0
- package/backend/tree/tree-module-state.ts +159 -0
- package/backend/tree/tree-node-toggle.ts +31 -0
- package/backend/tree/tree-node.ts +97 -0
- package/backend/tree/tree-toolbar.ts +117 -0
- package/backend/tree/tree.ts +1595 -0
- package/backend/url-link-handler.ts +36 -0
- package/backend/user-pass-login.ts +255 -0
- package/backend/user-settings-manager.ts +189 -0
- package/backend/utility/collapse-state-persister.ts +205 -0
- package/backend/utility/collapse-state-search.ts +183 -0
- package/backend/utility/dom-helper.ts +91 -0
- package/backend/utility/drag-drop-utility.ts +47 -0
- package/backend/utility/message-utility.ts +45 -0
- package/backend/utility/top-level-module-import.ts +32 -0
- package/backend/utility.ts +194 -0
- package/backend/viewport/abstract-container.ts +22 -0
- package/backend/viewport/content-container.ts +98 -0
- package/backend/viewport/loader.ts +28 -0
- package/backend/viewport/navigation-container.ts +119 -0
- package/backend/viewport/resizable-navigation.ts +176 -0
- package/backend/viewport/toolbar.ts +27 -0
- package/backend/viewport/topbar.ts +39 -0
- package/backend/viewport.ts +46 -0
- package/backend/window-manager.ts +84 -0
- package/backend/wizard/move-content-element.ts +107 -0
- package/backend/wizard/move-page.ts +74 -0
- package/backend/wizard.ts +331 -0
- package/belog/backend-log.ts +88 -0
- package/beuser/backend-user-listing.ts +40 -0
- package/beuser/permissions.ts +291 -0
- package/core/ajax/ajax-request-types.ts +15 -0
- package/core/ajax/ajax-request.ts +202 -0
- package/core/ajax/ajax-response.ts +57 -0
- package/core/ajax/input-transformer.ts +92 -0
- package/core/ajax/simple-response-interface.ts +5 -0
- package/core/authentication/mfa-provider/totp.ts +54 -0
- package/core/cache/dedupe-async-task.ts +95 -0
- package/core/directive/markdown.ts +82 -0
- package/core/directive/nl2br.ts +16 -0
- package/core/document-service.ts +35 -0
- package/core/event/debounce-event.ts +40 -0
- package/core/event/event-interface.ts +24 -0
- package/core/event/regular-event.ts +58 -0
- package/core/event/request-animation-frame-event.ts +42 -0
- package/core/event/throttle-event.ts +54 -0
- package/core/java-script-item-handler.ts +29 -0
- package/core/java-script-item-processor.ts +171 -0
- package/core/lit-helper.ts +126 -0
- package/core/literals.ts +17 -0
- package/core/referrer-refresh.ts +2 -0
- package/core/security-utility.ts +89 -0
- package/core/tests/ajax/ajax-request-test.ts +290 -0
- package/core/tests/ajax/input-transformer-test.ts +64 -0
- package/core/tests/cache/dedupe-async-task-test.ts +152 -0
- package/core/tests/event/throttle-event-test.ts +47 -0
- package/core/tests/literals-test.ts +24 -0
- package/core/tests/security-utility-test.ts +50 -0
- package/core/utility/types.ts +9 -0
- package/dashboard/chart-initializer.ts +136 -0
- package/dashboard/dashboard.ts +1487 -0
- package/extensionmanager/distribution-image.ts +55 -0
- package/extensionmanager/main.ts +291 -0
- package/extensionmanager/repository.ts +195 -0
- package/extensionmanager/update.ts +118 -0
- package/extensionmanager/upload-form.ts +42 -0
- package/filelist/browse-files.ts +148 -0
- package/filelist/browse-folders.ts +94 -0
- package/filelist/context-menu-actions.ts +335 -0
- package/filelist/create-folder.ts +69 -0
- package/filelist/file-delete.ts +69 -0
- package/filelist/file-list-actions.ts +132 -0
- package/filelist/file-list-dragdrop.ts +139 -0
- package/filelist/file-list-rename-handler.ts +128 -0
- package/filelist/file-list-transfer-handler.ts +138 -0
- package/filelist/file-list.ts +396 -0
- package/filelist/file-replace.ts +37 -0
- package/filelist/linkbrowser-file-handler.ts +94 -0
- package/filelist/linkbrowser-folder-handler.ts +74 -0
- package/filelist/rename-file.ts +109 -0
- package/form/backend/form-editor/component/property-grid-editor.ts +340 -0
- package/form/backend/form-editor/core.ts +2104 -0
- package/form/backend/form-editor/helper.ts +226 -0
- package/form/backend/form-editor/inspector-component.ts +2323 -0
- package/form/backend/form-editor/mediator.ts +941 -0
- package/form/backend/form-editor/modals-component.ts +433 -0
- package/form/backend/form-editor/stage-component.ts +908 -0
- package/form/backend/form-editor/tree-component.ts +548 -0
- package/form/backend/form-editor/view-model.ts +1343 -0
- package/form/backend/form-editor.ts +846 -0
- package/form/backend/form-manager/main.ts +39 -0
- package/form/backend/form-manager/view-model.ts +789 -0
- package/form/backend/form-manager.ts +180 -0
- package/form/backend/helper.ts +60 -0
- package/form/frontend/date-picker.ts +38 -0
- package/frontend/default_frontend.ts +82 -0
- package/impexp/context-menu-actions.ts +50 -0
- package/impexp/import-export.ts +62 -0
- package/indexed-search/pagination.ts +26 -0
- package/indexed-search/statistics.ts +50 -0
- package/info/translation-status.ts +48 -0
- package/install/ajax/ajax-queue.ts +83 -0
- package/install/init-install.ts +2 -0
- package/install/init-installer.ts +2 -0
- package/install/install.ts +25 -0
- package/install/installer.ts +458 -0
- package/install/message-interface.ts +18 -0
- package/install/module/abstract-inline-module.ts +27 -0
- package/install/module/abstract-interactable-module.ts +107 -0
- package/install/module/environment/environment-check.ts +92 -0
- package/install/module/environment/folder-structure.ts +145 -0
- package/install/module/environment/image-processing.ts +141 -0
- package/install/module/environment/mail-test.ts +127 -0
- package/install/module/environment/php-info.ts +50 -0
- package/install/module/environment/system-information.ts +50 -0
- package/install/module/maintenance/cache.ts +59 -0
- package/install/module/maintenance/clear-tables.ts +134 -0
- package/install/module/maintenance/clear-typo3temp-files.ts +137 -0
- package/install/module/maintenance/create-admin.ts +126 -0
- package/install/module/maintenance/database-analyzer.ts +266 -0
- package/install/module/maintenance/dump-autoload.ts +58 -0
- package/install/module/maintenance/language-packs.ts +338 -0
- package/install/module/maintenance/reset-backend-user-uc.ts +58 -0
- package/install/module/password-strength.ts +56 -0
- package/install/module/settings/change-install-tool-password.ts +101 -0
- package/install/module/settings/extension-configuration.ts +224 -0
- package/install/module/settings/features.ts +102 -0
- package/install/module/settings/local-configuration.ts +316 -0
- package/install/module/settings/presets.ts +147 -0
- package/install/module/settings/system-maintainer.ts +111 -0
- package/install/module/upgrade/core-update.ts +255 -0
- package/install/module/upgrade/extension-compat-tester.ts +195 -0
- package/install/module/upgrade/extension-scanner.ts +381 -0
- package/install/module/upgrade/tca-ext-tables-check.ts +93 -0
- package/install/module/upgrade/tca-migrations-check.ts +101 -0
- package/install/module/upgrade/upgrade-docs.ts +310 -0
- package/install/module/upgrade/upgrade-wizards.ts +612 -0
- package/install/renderable/clearable.ts +113 -0
- package/install/renderable/flash-message.ts +64 -0
- package/install/renderable/info-box.ts +66 -0
- package/install/renderable/language-packs.ts +304 -0
- package/install/renderable/offset-group.ts +38 -0
- package/install/renderable/severity.ts +49 -0
- package/install/renderable/wrap-group.ts +36 -0
- package/install/router.ts +468 -0
- package/linkvalidator/linkvalidator-modal.ts +45 -0
- package/linkvalidator/linkvalidator.ts +101 -0
- package/lowlevel/query-generator.ts +132 -0
- package/lowlevel/reference-index.ts +44 -0
- package/opendocs/toolbar/opendocs-menu.ts +117 -0
- package/package.json +34 -0
- package/recycler/recycler.ts +539 -0
- package/redirects/event-handler.ts +108 -0
- package/redirects/form-engine-evaluation.ts +34 -0
- package/redirects/redirects-module.ts +58 -0
- package/rte-ckeditor/ckeditor5.ts +402 -0
- package/rte-ckeditor/css-prefixer.ts +94 -0
- package/rte-ckeditor/legacy/ckeditor5-bundle.ts +17 -0
- package/rte-ckeditor/legacy/ckeditor5-inspector.ts +2 -0
- package/rte-ckeditor/plugin/typo3-link.ts +810 -0
- package/rte-ckeditor/plugin/whitespace.ts +114 -0
- package/rte-ckeditor/rte-link-browser.ts +112 -0
- package/rte-ckeditor/tests/css-prefixer-test.ts +314 -0
- package/scheduler/scheduler-add-group.ts +119 -0
- package/scheduler/scheduler-editable-group-name.ts +307 -0
- package/scheduler/scheduler-sortable-groups.ts +59 -0
- package/scheduler/scheduler.ts +466 -0
- package/setup/setup-module.ts +122 -0
- package/styleguide/checkbox-demo.ts +5 -0
- package/styleguide/element/theme-switcher-element.ts +101 -0
- package/styleguide/filter.ts +22 -0
- package/styleguide/find-icons.ts +78 -0
- package/styleguide/processing-indicator.ts +78 -0
- package/styleguide/render-notifications.ts +64 -0
- package/sys-note/element/delete-button.ts +78 -0
- package/tstemplate/constant-editor.ts +64 -0
- package/tstemplate/information-module.ts +31 -0
- package/tstemplate/template-analyzer.ts +77 -0
- package/viewpage/main.ts +253 -0
- package/workspaces/backend.ts +979 -0
- package/workspaces/preview.ts +232 -0
- package/workspaces/renderable/comment-view.ts +79 -0
- package/workspaces/renderable/diff-view.ts +58 -0
- package/workspaces/renderable/history-view.ts +97 -0
- package/workspaces/renderable/record-information.ts +118 -0
- package/workspaces/renderable/record-table.ts +355 -0
- package/workspaces/renderable/send-to-stage-form.ts +108 -0
- package/workspaces/toolbar/workspaces-menu.ts +190 -0
- package/workspaces/utility/icon-helper.ts +57 -0
- package/workspaces/workspaces.ts +136 -0
|
@@ -0,0 +1,282 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* This file is part of the TYPO3 CMS project.
|
|
3
|
+
*
|
|
4
|
+
* It is free software; you can redistribute it and/or modify it under
|
|
5
|
+
* the terms of the GNU General Public License, either version 2
|
|
6
|
+
* of the License, or any later version.
|
|
7
|
+
*
|
|
8
|
+
* For the full copyright and license information, please read the
|
|
9
|
+
* LICENSE.txt file that was distributed with this source code.
|
|
10
|
+
*
|
|
11
|
+
* The TYPO3 project - inspiring people to share!
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
import { LitElement, html, css, type TemplateResult } from 'lit';
|
|
15
|
+
import { customElement, property, state } from 'lit/decorators';
|
|
16
|
+
import {
|
|
17
|
+
EditorView,
|
|
18
|
+
lineNumbers,
|
|
19
|
+
highlightSpecialChars,
|
|
20
|
+
drawSelection,
|
|
21
|
+
keymap,
|
|
22
|
+
placeholder,
|
|
23
|
+
type ViewUpdate,
|
|
24
|
+
type KeyBinding
|
|
25
|
+
} from '@codemirror/view';
|
|
26
|
+
import { EditorState, Compartment, type Extension } from '@codemirror/state';
|
|
27
|
+
import { syntaxHighlighting, defaultHighlightStyle } from '@codemirror/language';
|
|
28
|
+
import { defaultKeymap, indentWithTab } from '@codemirror/commands';
|
|
29
|
+
import { oneDark } from '@codemirror/theme-one-dark';
|
|
30
|
+
import { executeJavaScriptModuleInstruction, loadModule, resolveSubjectRef, type JavaScriptItemPayload } from '@typo3/core/java-script-item-processor';
|
|
31
|
+
import '@typo3/backend/element/spinner-element';
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Module: @typo3/backend/code-editor/element/code-mirror-element
|
|
35
|
+
* Renders CodeMirror into FormEngine
|
|
36
|
+
*/
|
|
37
|
+
@customElement('typo3-t3editor-codemirror')
|
|
38
|
+
export class CodeMirrorElement extends LitElement {
|
|
39
|
+
static override styles = css`
|
|
40
|
+
:host {
|
|
41
|
+
position: relative;
|
|
42
|
+
display: block;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
:host([fullscreen]) {
|
|
46
|
+
position: fixed;
|
|
47
|
+
inset: 64px 0 0;
|
|
48
|
+
z-index: 9;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
:host([fullscreen]) .cm-scroller {
|
|
52
|
+
min-height: initial;
|
|
53
|
+
max-height: 100%;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
:host([autoheight]) .cm-scroller {
|
|
57
|
+
max-height: initial;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.codemirror-label {
|
|
61
|
+
font-size: .875em;
|
|
62
|
+
opacity: .75;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.codemirror-label-top {
|
|
66
|
+
margin-bottom: .25rem;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.codemirror-label-bottom {
|
|
70
|
+
margin-top: .25rem;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
typo3-backend-spinner {
|
|
74
|
+
position: absolute;
|
|
75
|
+
top: 50%;
|
|
76
|
+
left: 50%;
|
|
77
|
+
transform: translate(-50%, -50%);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.cm-editor {
|
|
81
|
+
overflow: hidden;
|
|
82
|
+
border-radius: var(--typo3-input-border-radius);
|
|
83
|
+
border: var(--typo3-input-border-width) solid var(--typo3-input-border-color);
|
|
84
|
+
transition: outline-color .15s ease-in-out, box-shadow .15s ease-in-out;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.cm-focused {
|
|
88
|
+
border-color: var(--typo3-input-focus-border-color);
|
|
89
|
+
outline-offset: 0;
|
|
90
|
+
outline: .25rem solid color-mix(in srgb, var(--typo3-form-control-focus-border-color), transparent 25%);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
.cm-gutters {
|
|
94
|
+
height: auto !important;
|
|
95
|
+
position: relative !important;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
.cm-content {
|
|
99
|
+
min-height: calc(8px + 12px * 1.4 * var(--rows, 18)) !important;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
.cm-scroller {
|
|
103
|
+
min-height: 100%;
|
|
104
|
+
max-height: calc(100dvh - 10rem);
|
|
105
|
+
}
|
|
106
|
+
`;
|
|
107
|
+
|
|
108
|
+
@property({ type: Object }) mode: JavaScriptItemPayload = null;
|
|
109
|
+
@property({ type: Array }) addons: JavaScriptItemPayload[] = [];
|
|
110
|
+
@property({ type: Array }) keymaps: JavaScriptItemPayload[] = [];
|
|
111
|
+
|
|
112
|
+
@property({ type: Number }) lineDigits: number = 0;
|
|
113
|
+
@property({ type: Boolean, reflect: true }) autoheight: boolean = false;
|
|
114
|
+
@property({ type: Boolean }) nolazyload: boolean = false;
|
|
115
|
+
@property({ type: Boolean }) readonly: boolean = false;
|
|
116
|
+
@property({ type: Boolean, reflect: true }) fullscreen: boolean = false;
|
|
117
|
+
|
|
118
|
+
@property({ type: String }) label: string;
|
|
119
|
+
@property({ type: String }) placeholder: string;
|
|
120
|
+
@property({ type: String }) panel: string = 'bottom';
|
|
121
|
+
|
|
122
|
+
@state() editorTheme: Compartment = null;
|
|
123
|
+
@state() editorView: EditorView = null;
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* @internal
|
|
127
|
+
*/
|
|
128
|
+
public setContent(newContent: string): void {
|
|
129
|
+
if (this.editorView !== null) {
|
|
130
|
+
this.editorView.dispatch({
|
|
131
|
+
changes: {
|
|
132
|
+
from: 0,
|
|
133
|
+
to: this.editorView.state.doc.length,
|
|
134
|
+
insert: newContent
|
|
135
|
+
}
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* @internal
|
|
142
|
+
*/
|
|
143
|
+
public getContent(): string {
|
|
144
|
+
return this.editorView.state.doc.toString();
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
protected override render(): TemplateResult {
|
|
148
|
+
return html`
|
|
149
|
+
${this.label && this.panel === 'top' ? html`<div class="codemirror-label codemirror-label-top">${this.label}</div>` : ''}
|
|
150
|
+
<div id="codemirror-parent" @keydown=${(e: KeyboardEvent) => this.onKeydown(e)}></div>
|
|
151
|
+
${this.label && this.panel === 'bottom' ? html`<div class="codemirror-label codemirror-label-bottom">${this.label}</div>` : ''}
|
|
152
|
+
${this.editorView === null ? html`<typo3-backend-spinner size="large"></typo3-backend-spinner>` : ''}
|
|
153
|
+
`;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
protected override firstUpdated(): void {
|
|
157
|
+
if (this.nolazyload) {
|
|
158
|
+
this.initializeEditor(<HTMLTextAreaElement>this.firstElementChild);
|
|
159
|
+
return;
|
|
160
|
+
}
|
|
161
|
+
const observerOptions = {
|
|
162
|
+
root: document.body
|
|
163
|
+
};
|
|
164
|
+
const observer = new IntersectionObserver((entries: IntersectionObserverEntry[]): void => {
|
|
165
|
+
entries.forEach((entry: IntersectionObserverEntry): void => {
|
|
166
|
+
if (entry.intersectionRatio > 0) {
|
|
167
|
+
observer.unobserve(entry.target);
|
|
168
|
+
if (this.firstElementChild && this.firstElementChild.nodeName.toLowerCase() === 'textarea') {
|
|
169
|
+
this.initializeEditor(<HTMLTextAreaElement>this.firstElementChild);
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
});
|
|
173
|
+
}, observerOptions);
|
|
174
|
+
|
|
175
|
+
observer.observe(this);
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
private onKeydown(event: KeyboardEvent): void {
|
|
179
|
+
if (event.ctrlKey && event.altKey && event.key === 'f') {
|
|
180
|
+
event.preventDefault();
|
|
181
|
+
this.fullscreen = true;
|
|
182
|
+
}
|
|
183
|
+
if (event.key === 'Escape' && this.fullscreen) {
|
|
184
|
+
event.preventDefault();
|
|
185
|
+
this.fullscreen = false;
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
private async initializeEditor(textarea: HTMLTextAreaElement): Promise<void> {
|
|
190
|
+
const updateListener = EditorView.updateListener.of((v: ViewUpdate) => {
|
|
191
|
+
if (v.docChanged) {
|
|
192
|
+
textarea.value = v.state.doc.toString();
|
|
193
|
+
textarea.dispatchEvent(new CustomEvent('change', { bubbles: true }));
|
|
194
|
+
}
|
|
195
|
+
});
|
|
196
|
+
|
|
197
|
+
if (this.lineDigits > 0) {
|
|
198
|
+
this.style.setProperty('--rows', this.lineDigits.toString());
|
|
199
|
+
} else if (textarea.getAttribute('rows')) {
|
|
200
|
+
this.style.setProperty('--rows', textarea.getAttribute('rows'));
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
this.editorTheme = new Compartment();
|
|
204
|
+
const extensions: Extension[] = [
|
|
205
|
+
this.editorTheme.of([]),
|
|
206
|
+
updateListener,
|
|
207
|
+
lineNumbers(),
|
|
208
|
+
highlightSpecialChars(),
|
|
209
|
+
drawSelection(),
|
|
210
|
+
EditorState.allowMultipleSelections.of(true),
|
|
211
|
+
syntaxHighlighting(defaultHighlightStyle, { fallback: true }),
|
|
212
|
+
];
|
|
213
|
+
|
|
214
|
+
if (this.readonly) {
|
|
215
|
+
extensions.push(EditorState.readOnly.of(true));
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
if (this.placeholder) {
|
|
219
|
+
extensions.push(placeholder(this.placeholder));
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
if (this.mode) {
|
|
223
|
+
const modeImplementation = <Extension[]>await executeJavaScriptModuleInstruction(this.mode);
|
|
224
|
+
extensions.push(...modeImplementation);
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
if (this.addons.length > 0) {
|
|
228
|
+
extensions.push(...await Promise.all(this.addons.map(moduleInstruction => executeJavaScriptModuleInstruction(moduleInstruction))));
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
const keymaps: KeyBinding[] = [
|
|
232
|
+
...defaultKeymap,
|
|
233
|
+
indentWithTab,
|
|
234
|
+
];
|
|
235
|
+
if (this.keymaps.length > 0) {
|
|
236
|
+
const dynamicKeymaps: KeyBinding[][] = await Promise.all(this.keymaps.map(keymap => loadModule(keymap).then((module) => resolveSubjectRef(module, keymap))));
|
|
237
|
+
dynamicKeymaps.forEach(keymap => keymaps.push(...keymap));
|
|
238
|
+
}
|
|
239
|
+
extensions.push(keymap.of(keymaps));
|
|
240
|
+
|
|
241
|
+
this.editorView = new EditorView({
|
|
242
|
+
state: EditorState.create({
|
|
243
|
+
doc: textarea.value,
|
|
244
|
+
extensions
|
|
245
|
+
}),
|
|
246
|
+
parent: this.renderRoot.querySelector('#codemirror-parent'),
|
|
247
|
+
root: this.renderRoot as ShadowRoot
|
|
248
|
+
});
|
|
249
|
+
|
|
250
|
+
this.toggleDarkMode(this.darkModeEnabled());
|
|
251
|
+
const darkModeMediaQuery = window.matchMedia('(prefers-color-scheme: dark)');
|
|
252
|
+
darkModeMediaQuery.addEventListener('change', (): void => {
|
|
253
|
+
this.toggleDarkMode(this.darkModeEnabled());
|
|
254
|
+
});
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
private darkModeEnabled(): boolean {
|
|
258
|
+
const computedStyle = window.getComputedStyle(this);
|
|
259
|
+
const colorScheme = computedStyle.colorScheme;
|
|
260
|
+
if (colorScheme === 'light only' || colorScheme === 'light') {
|
|
261
|
+
return false;
|
|
262
|
+
} else if (colorScheme === 'dark only' || colorScheme === 'dark') {
|
|
263
|
+
return true;
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
return window.matchMedia('(prefers-color-scheme: dark)').matches;
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
private toggleDarkMode(enabled: boolean): void {
|
|
270
|
+
this.editorView.dispatch({
|
|
271
|
+
effects: this.editorTheme.reconfigure(
|
|
272
|
+
enabled ? oneDark : []
|
|
273
|
+
)
|
|
274
|
+
});
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
declare global {
|
|
279
|
+
interface HTMLElementTagNameMap {
|
|
280
|
+
'typo3-t3editor-codemirror': CodeMirrorElement;
|
|
281
|
+
}
|
|
282
|
+
}
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
import DocumentService from '@typo3/core/document-service';
|
|
2
|
+
import { StreamLanguage, LanguageSupport } from '@codemirror/language';
|
|
3
|
+
import { TypoScriptStreamParserFactory } from '../stream-parser/typoscript';
|
|
4
|
+
import { TsCodeCompletion } from '../autocomplete/ts-code-completion';
|
|
5
|
+
import { syntaxTree } from '@codemirror/language';
|
|
6
|
+
import type { CompletionContext, CompletionResult } from '@codemirror/autocomplete';
|
|
7
|
+
import type { SyntaxNodeRef } from '@lezer/common';
|
|
8
|
+
|
|
9
|
+
interface Token {
|
|
10
|
+
type: string;
|
|
11
|
+
string: string;
|
|
12
|
+
start: number;
|
|
13
|
+
end: number;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export interface CodeMirror5CompatibleCompletionState {
|
|
17
|
+
lineTokens: Token[][];
|
|
18
|
+
currentLineNumber: number;
|
|
19
|
+
currentLine: string;
|
|
20
|
+
lineCount: number;
|
|
21
|
+
completingAfterDot: boolean,
|
|
22
|
+
token?: Token
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Module: @typo3/backend/code-editor/language/typoscript
|
|
27
|
+
*
|
|
28
|
+
* Entry Point module for CodeMirror v6 language highlighting and code completion for TypoScript.
|
|
29
|
+
* This module combines our CodeMirror v5 style typoscript parser (via the StreamLanguage shim) and
|
|
30
|
+
* our CodeMirror v5 style TypoScript hinter (via an own CodeMirror v5 state shim).
|
|
31
|
+
*
|
|
32
|
+
* @todo: This is ideally to be replaced by an own CodeMirror v6 style parser/completion logic
|
|
33
|
+
* based on lezer.codemirror.net at some point.
|
|
34
|
+
*/
|
|
35
|
+
export function typoscript() {
|
|
36
|
+
const language = StreamLanguage.define(
|
|
37
|
+
new TypoScriptStreamParserFactory().create()
|
|
38
|
+
);
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
const completion = language.data.of({
|
|
42
|
+
autocomplete: complete
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
return new LanguageSupport(language, [completion]);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const tsCodeCompletionInitializer = (async (): Promise<TsCodeCompletion> => {
|
|
49
|
+
await DocumentService.ready();
|
|
50
|
+
const effectivePid = parseInt((document.querySelector('input[name="effectivePid"]') as HTMLInputElement)?.value, 10);
|
|
51
|
+
return new TsCodeCompletion(effectivePid);
|
|
52
|
+
})();
|
|
53
|
+
|
|
54
|
+
export async function complete(context: CompletionContext): Promise<CompletionResult | null> {
|
|
55
|
+
if (!context.explicit) {
|
|
56
|
+
return null;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
const cm5state = parseCodeMirror5CompatibleCompletionState(context);
|
|
60
|
+
const tokenPos = context.pos - (cm5state.completingAfterDot ? 1 : 0);
|
|
61
|
+
const token = syntaxTree(context.state).resolveInner(tokenPos, -1);
|
|
62
|
+
const tokenValue = token.name === 'Document' || cm5state.completingAfterDot ? '' : context.state.sliceDoc(token.from, tokenPos);
|
|
63
|
+
const completionStart = token.name === 'Document' || cm5state.completingAfterDot ? context.pos : token.from;
|
|
64
|
+
|
|
65
|
+
let tokenMetadata: Token = {
|
|
66
|
+
start: token.from,
|
|
67
|
+
end: tokenPos,
|
|
68
|
+
string: tokenValue,
|
|
69
|
+
type: token.name
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
// If it's not a 'word-style' token, ignore the token.
|
|
73
|
+
if (!/^[\w$_]*$/.test(tokenValue)) {
|
|
74
|
+
tokenMetadata = {
|
|
75
|
+
start: context.pos,
|
|
76
|
+
end: context.pos,
|
|
77
|
+
string: '',
|
|
78
|
+
type: tokenValue === '.' ? 'property' : null
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
cm5state.token = tokenMetadata;
|
|
82
|
+
|
|
83
|
+
const tsCodeCompletion = await tsCodeCompletionInitializer;
|
|
84
|
+
const keywords = tsCodeCompletion.refreshCodeCompletion(cm5state);
|
|
85
|
+
|
|
86
|
+
if ((token.name === 'string' || token.name === 'comment') && tokenIsSubStringOfKeywords(tokenValue, keywords)) {
|
|
87
|
+
return null;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
const completions = getCompletions(tokenValue, keywords);
|
|
91
|
+
return {
|
|
92
|
+
from: completionStart,
|
|
93
|
+
options: completions.map((result: string) => {
|
|
94
|
+
return { label: result, type: 'keyword' };
|
|
95
|
+
})
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
function parseCodeMirror5CompatibleCompletionState(context: CompletionContext): CodeMirror5CompatibleCompletionState {
|
|
100
|
+
const lineCount = context.state.sliceDoc().split(context.state.lineBreak).length;
|
|
101
|
+
const currentLineNumber = context.state.sliceDoc(0, context.pos).split(context.state.lineBreak).length;
|
|
102
|
+
const currentLine = context.state.sliceDoc().split(context.state.lineBreak)[currentLineNumber - 1];
|
|
103
|
+
const lastChar = context.state.sliceDoc(context.pos - 1, context.pos);
|
|
104
|
+
const completingAfterDot = lastChar === '.';
|
|
105
|
+
const lineTokens = extractCodemirror5StyleLineTokens(lineCount, context);
|
|
106
|
+
|
|
107
|
+
return {
|
|
108
|
+
lineTokens,
|
|
109
|
+
currentLineNumber,
|
|
110
|
+
currentLine,
|
|
111
|
+
lineCount,
|
|
112
|
+
completingAfterDot
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
function extractCodemirror5StyleLineTokens(lineCount: number, context: CompletionContext): Token[][] {
|
|
117
|
+
const lineTokens = Array(lineCount).fill('').map((): Token[] => []);
|
|
118
|
+
|
|
119
|
+
let lastToken = 0;
|
|
120
|
+
let lineNumber = 1;
|
|
121
|
+
syntaxTree(context.state).cursor().iterate((node: SyntaxNodeRef): void => {
|
|
122
|
+
const type = node.type.name || node.name;
|
|
123
|
+
if (type === 'Document') {
|
|
124
|
+
return;
|
|
125
|
+
}
|
|
126
|
+
const start = node.from;
|
|
127
|
+
const end = node.to;
|
|
128
|
+
// syntaxTree(..).cursor().iterate() doesn't deliver all tokens that we are interested in (like dots) – that is because our legacy
|
|
129
|
+
// stream parser doesn't perform proper tokenization.
|
|
130
|
+
// Insert content as null-type token into the lineToken array.
|
|
131
|
+
if (lastToken < start) {
|
|
132
|
+
context.state.sliceDoc(lastToken, start).split(context.state.lineBreak).forEach((part: string) => {
|
|
133
|
+
if (part) {
|
|
134
|
+
lineTokens[Math.min(lineNumber - 1, lineCount - 1)].push({ type: null, string: part, start: lastToken, end: lastToken + part.length });
|
|
135
|
+
lineNumber++;
|
|
136
|
+
lastToken += part.length;
|
|
137
|
+
}
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
const string = context.state.sliceDoc(node.from, node.to);
|
|
141
|
+
lineNumber = context.state.sliceDoc(0, node.from).split(context.state.lineBreak).length;
|
|
142
|
+
lineTokens[lineNumber - 1].push({ type, string, start, end });
|
|
143
|
+
lastToken = end;
|
|
144
|
+
});
|
|
145
|
+
if (lastToken < context.state.doc.length) {
|
|
146
|
+
lineTokens[lineNumber - 1].push({ type: null, string: context.state.sliceDoc(lastToken), start: lastToken, end: context.state.doc.length });
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
return lineTokens;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
function tokenIsSubStringOfKeywords(token: string, keywords: string[]): boolean {
|
|
154
|
+
const tokenLength = token.length;
|
|
155
|
+
for (let i = 0; i < keywords.length; ++i) {
|
|
156
|
+
if (token === keywords[i].substr(tokenLength)) {
|
|
157
|
+
return true;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
return false;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
function getCompletions(token: string, keywords: string[]) {
|
|
165
|
+
const found = new Set();
|
|
166
|
+
|
|
167
|
+
const maybeAdd = (str: string) => {
|
|
168
|
+
if (str.lastIndexOf(token, 0) === 0 && !found.has(str)) {
|
|
169
|
+
found.add(str);
|
|
170
|
+
}
|
|
171
|
+
};
|
|
172
|
+
|
|
173
|
+
for (let i = 0, e = keywords.length; i < e; ++i) {
|
|
174
|
+
maybeAdd(keywords[i]);
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
const completions = Array.from(found);
|
|
178
|
+
completions.sort();
|
|
179
|
+
|
|
180
|
+
return completions;
|
|
181
|
+
}
|