mirror of
https://github.com/simonw/datasette.git
synced 2026-09-18 14:34:20 +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 |
||
|---|---|---|
| .. | ||
| default_permissions | ||
| publish | ||
| static | ||
| templates | ||
| utils | ||
| views | ||
| __init__.py | ||
| __main__.py | ||
| _pytest_plugin.py | ||
| actor_auth_cookie.py | ||
| app.py | ||
| blob_renderer.py | ||
| cli.py | ||
| column_types.py | ||
| csrf.py | ||
| database.py | ||
| default_actions.py | ||
| default_column_types.py | ||
| default_database_actions.py | ||
| default_debug_menu.py | ||
| default_jump_items.py | ||
| default_magic_parameters.py | ||
| default_query_actions.py | ||
| default_table_actions.py | ||
| events.py | ||
| extras.py | ||
| facets.py | ||
| filters.py | ||
| fixtures.py | ||
| forbidden.py | ||
| handle_exception.py | ||
| hookspecs.py | ||
| inspect.py | ||
| jump.py | ||
| permissions.py | ||
| plugins.py | ||
| renderer.py | ||
| resources.py | ||
| sql_functions.py | ||
| stored_queries.py | ||
| template_contexts.py | ||
| tokens.py | ||
| tracer.py | ||
| url_builder.py | ||
| version.py | ||
| write_sql.py | ||