mirror of
https://github.com/simonw/datasette.git
synced 2026-07-15 20:14:38 +02:00
All eight modal dialogs (create table, alter table, insert/edit row, delete row, set column type, column chooser, mobile column actions and the navigation jump menu) previously each implemented their own <dialog> creation, header/footer markup, backdrop-click and Escape handling, busy-state guards, focus restoration and near-identical frame CSS. This extracts all of that into a new <datasette-modal> web component (datasette/static/datasette-modal.js) that wraps a native <dialog> and provides: - The standard modal frame, header (title + meta chip), footer and button styles, distributed via a stylesheet adopted into whichever document or shadow root the element is connected to - so it also works inside the shadow DOM of column-chooser and navigation-search - Close on backdrop click and Escape, a busy property that blocks dismissal during saves, and a closeGuard hook for discard-changes confirmation prompts - Focus restoration to the triggering element on close - datasette-modal-open and datasette-modal-close events - Per-dialog sizing via --datasette-modal-width / --datasette-modal-max-height custom properties The component is exposed as window.DatasetteModal and via a new datasetteManager.createModal() method, and is documented in docs/javascript_plugins.rst as a stable public API for plugins. This removes roughly 1,200 lines of duplicated frame markup, event wiring and CSS across table.js, edit-tools.js, mobile-column-actions.js, column-chooser.js, navigation-search.js and app.css, while keeping the existing dialog ids, class names and inner structure intact. Also adds Playwright coverage for the column chooser, mobile column actions and set-column-type dialogs, which previously had none. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TShiUYVMmmF4zyJR6GMw34 |
||
|---|---|---|
| .. | ||
| _static | ||
| _templates | ||
| .gitignore | ||
| authentication.rst | ||
| auto-build.sh | ||
| binary_data.rst | ||
| changelog.rst | ||
| cli-reference.rst | ||
| codespell-ignore-words.txt | ||
| conf.py | ||
| configuration.rst | ||
| contributing.rst | ||
| csv_export.rst | ||
| custom_templates.rst | ||
| datasette-0.51.png | ||
| datasette-logo.svg | ||
| deploying.rst | ||
| ecosystem.rst | ||
| events.md | ||
| facets.rst | ||
| full_text_search.rst | ||
| getting_started.rst | ||
| index.rst | ||
| installation.rst | ||
| internals.rst | ||
| introspection.rst | ||
| javascript_plugins.rst | ||
| json_api.rst | ||
| json_api_doc.py | ||
| Makefile | ||
| metadata.rst | ||
| metadata_doc.py | ||
| pages.rst | ||
| performance.rst | ||
| plugin_hooks.rst | ||
| plugins.rst | ||
| publish.rst | ||
| settings.rst | ||
| spatialite.rst | ||
| sql_queries.rst | ||
| template_context.rst | ||
| template_context_doc.py | ||
| testing_plugins.rst | ||
| upgrade-1.0a20.md | ||
| upgrade_guide.md | ||
| writing_plugins.rst | ||