@panphora/bevel 0.1.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.
- package/LICENSE +16 -0
- package/README.md +226 -0
- package/bevel-fonts.css +16 -0
- package/bevel.css +3075 -0
- package/bevel.js +2126 -0
- package/dist/react/components/activity-feed.d.ts +89 -0
- package/dist/react/components/activity-feed.js +54 -0
- package/dist/react/components/alert-dialog.d.ts +14 -0
- package/dist/react/components/alert-dialog.js +19 -0
- package/dist/react/components/app-shell.d.ts +98 -0
- package/dist/react/components/app-shell.js +86 -0
- package/dist/react/components/app-toolbar.d.ts +19 -0
- package/dist/react/components/app-toolbar.js +22 -0
- package/dist/react/components/avatar-group.d.ts +67 -0
- package/dist/react/components/avatar-group.js +49 -0
- package/dist/react/components/badge-and-pill.d.ts +34 -0
- package/dist/react/components/badge-and-pill.js +12 -0
- package/dist/react/components/breadcrumbs.d.ts +56 -0
- package/dist/react/components/breadcrumbs.js +44 -0
- package/dist/react/components/bulk-bar.d.ts +22 -0
- package/dist/react/components/bulk-bar.js +59 -0
- package/dist/react/components/button.d.ts +15 -0
- package/dist/react/components/button.js +20 -0
- package/dist/react/components/callout-and-hint.d.ts +17 -0
- package/dist/react/components/callout-and-hint.js +8 -0
- package/dist/react/components/checkbox.d.ts +5 -0
- package/dist/react/components/checkbox.js +13 -0
- package/dist/react/components/chip.d.ts +149 -0
- package/dist/react/components/chip.js +29 -0
- package/dist/react/components/code-block.d.ts +50 -0
- package/dist/react/components/code-block.js +77 -0
- package/dist/react/components/code-editor.d.ts +122 -0
- package/dist/react/components/code-editor.js +695 -0
- package/dist/react/components/column-manager.d.ts +28 -0
- package/dist/react/components/column-manager.js +85 -0
- package/dist/react/components/combobox.d.ts +32 -0
- package/dist/react/components/combobox.js +37 -0
- package/dist/react/components/data-grid.d.ts +108 -0
- package/dist/react/components/data-grid.js +159 -0
- package/dist/react/components/data-table.d.ts +2 -0
- package/dist/react/components/data-table.js +6 -0
- package/dist/react/components/date.d.ts +23 -0
- package/dist/react/components/date.js +11 -0
- package/dist/react/components/details.d.ts +13 -0
- package/dist/react/components/details.js +20 -0
- package/dist/react/components/dialog.d.ts +74 -0
- package/dist/react/components/dialog.js +31 -0
- package/dist/react/components/diff-view.d.ts +73 -0
- package/dist/react/components/diff-view.js +68 -0
- package/dist/react/components/documents.d.ts +70 -0
- package/dist/react/components/documents.js +10 -0
- package/dist/react/components/drawer.d.ts +45 -0
- package/dist/react/components/drawer.js +35 -0
- package/dist/react/components/editable-grid-cells.d.ts +32 -0
- package/dist/react/components/editable-grid-cells.js +116 -0
- package/dist/react/components/eyebrow-kicker-lede-pull-quote.d.ts +39 -0
- package/dist/react/components/eyebrow-kicker-lede-pull-quote.js +12 -0
- package/dist/react/components/field.d.ts +32 -0
- package/dist/react/components/field.js +27 -0
- package/dist/react/components/file-tree.d.ts +75 -0
- package/dist/react/components/file-tree.js +247 -0
- package/dist/react/components/file.d.ts +43 -0
- package/dist/react/components/file.js +73 -0
- package/dist/react/components/files-table.d.ts +174 -0
- package/dist/react/components/files-table.js +237 -0
- package/dist/react/components/filter-builder.d.ts +37 -0
- package/dist/react/components/filter-builder.js +109 -0
- package/dist/react/components/form-error-summary.d.ts +16 -0
- package/dist/react/components/form-error-summary.js +49 -0
- package/dist/react/components/icon-button.d.ts +8 -0
- package/dist/react/components/icon-button.js +14 -0
- package/dist/react/components/icon.d.ts +7 -0
- package/dist/react/components/icon.js +15 -0
- package/dist/react/components/image.d.ts +72 -0
- package/dist/react/components/image.js +24 -0
- package/dist/react/components/inline-edit.d.ts +70 -0
- package/dist/react/components/inline-edit.js +149 -0
- package/dist/react/components/input.d.ts +29 -0
- package/dist/react/components/input.js +20 -0
- package/dist/react/components/kanban-board.d.ts +140 -0
- package/dist/react/components/kanban-board.js +374 -0
- package/dist/react/components/layout.d.ts +51 -0
- package/dist/react/components/layout.js +28 -0
- package/dist/react/components/list.d.ts +28 -0
- package/dist/react/components/list.js +6 -0
- package/dist/react/components/masthead-and-verdict.d.ts +60 -0
- package/dist/react/components/masthead-and-verdict.js +8 -0
- package/dist/react/components/menu.d.ts +26 -0
- package/dist/react/components/menu.js +31 -0
- package/dist/react/components/multi-select-picker.d.ts +49 -0
- package/dist/react/components/multi-select-picker.js +20 -0
- package/dist/react/components/note.d.ts +33 -0
- package/dist/react/components/note.js +8 -0
- package/dist/react/components/number-field.d.ts +16 -0
- package/dist/react/components/number-field.js +17 -0
- package/dist/react/components/pagination.d.ts +45 -0
- package/dist/react/components/pagination.js +87 -0
- package/dist/react/components/persistent-action-banner.d.ts +71 -0
- package/dist/react/components/persistent-action-banner.js +39 -0
- package/dist/react/components/popconfirm.d.ts +42 -0
- package/dist/react/components/popconfirm.js +59 -0
- package/dist/react/components/popover.d.ts +16 -0
- package/dist/react/components/popover.js +21 -0
- package/dist/react/components/progress-and-gauge.d.ts +44 -0
- package/dist/react/components/progress-and-gauge.js +19 -0
- package/dist/react/components/radio.d.ts +7 -0
- package/dist/react/components/radio.js +13 -0
- package/dist/react/components/rich-text-toolbar.d.ts +26 -0
- package/dist/react/components/rich-text-toolbar.js +64 -0
- package/dist/react/components/rows-and-card.d.ts +88 -0
- package/dist/react/components/rows-and-card.js +10 -0
- package/dist/react/components/save-status-indicator.d.ts +11 -0
- package/dist/react/components/save-status-indicator.js +33 -0
- package/dist/react/components/segmented-control.d.ts +21 -0
- package/dist/react/components/segmented-control.js +15 -0
- package/dist/react/components/select.d.ts +29 -0
- package/dist/react/components/select.js +29 -0
- package/dist/react/components/selectable-cards.d.ts +30 -0
- package/dist/react/components/selectable-cards.js +29 -0
- package/dist/react/components/settings-rows.d.ts +51 -0
- package/dist/react/components/settings-rows.js +8 -0
- package/dist/react/components/sidebar-nav.d.ts +77 -0
- package/dist/react/components/sidebar-nav.js +41 -0
- package/dist/react/components/skeleton-and-empty.d.ts +51 -0
- package/dist/react/components/skeleton-and-empty.js +14 -0
- package/dist/react/components/slider.d.ts +19 -0
- package/dist/react/components/slider.js +17 -0
- package/dist/react/components/small-charts.d.ts +60 -0
- package/dist/react/components/small-charts.js +76 -0
- package/dist/react/components/sortable.d.ts +30 -0
- package/dist/react/components/sortable.js +85 -0
- package/dist/react/components/split-button.d.ts +38 -0
- package/dist/react/components/split-button.js +43 -0
- package/dist/react/components/split-panes.d.ts +35 -0
- package/dist/react/components/split-panes.js +102 -0
- package/dist/react/components/stat-tiles.d.ts +54 -0
- package/dist/react/components/stat-tiles.js +8 -0
- package/dist/react/components/steps.d.ts +11 -0
- package/dist/react/components/steps.js +13 -0
- package/dist/react/components/switch.d.ts +6 -0
- package/dist/react/components/switch.js +13 -0
- package/dist/react/components/table.d.ts +61 -0
- package/dist/react/components/table.js +6 -0
- package/dist/react/components/tabs.d.ts +7 -0
- package/dist/react/components/tabs.js +13 -0
- package/dist/react/components/tags.d.ts +33 -0
- package/dist/react/components/tags.js +83 -0
- package/dist/react/components/textarea.d.ts +10 -0
- package/dist/react/components/textarea.js +6 -0
- package/dist/react/components/toast.d.ts +35 -0
- package/dist/react/components/toast.js +90 -0
- package/dist/react/components/tooltip-and-key.d.ts +20 -0
- package/dist/react/components/tooltip-and-key.js +20 -0
- package/dist/react/components/tree-view.d.ts +34 -0
- package/dist/react/components/tree-view.js +118 -0
- package/dist/react/components/upload-dropzone.d.ts +92 -0
- package/dist/react/components/upload-dropzone.js +116 -0
- package/dist/react/components/wizard-shell.d.ts +78 -0
- package/dist/react/components/wizard-shell.js +176 -0
- package/dist/react/fonts.css.d.ts +1 -0
- package/dist/react/index.d.ts +76 -0
- package/dist/react/index.js +77 -0
- package/dist/react/integrations/quickcrop.d.ts +58 -0
- package/dist/react/integrations/quickcrop.js +137 -0
- package/dist/react/integrations/richclay.d.ts +43 -0
- package/dist/react/integrations/richclay.js +129 -0
- package/dist/react/internal/classes.d.ts +3 -0
- package/dist/react/internal/classes.js +10 -0
- package/dist/react/internal/close-mark.d.ts +1 -0
- package/dist/react/internal/close-mark.js +10 -0
- package/dist/react/internal/controllable-state.d.ts +9 -0
- package/dist/react/internal/controllable-state.js +22 -0
- package/dist/react/internal/drop-effect.d.ts +28 -0
- package/dist/react/internal/drop-effect.js +8 -0
- package/dist/react/internal/form-reset.d.ts +2 -0
- package/dist/react/internal/form-reset.js +22 -0
- package/dist/react/internal/format.d.ts +1 -0
- package/dist/react/internal/format.js +14 -0
- package/dist/react/internal/link.d.ts +2 -0
- package/dist/react/internal/link.js +8 -0
- package/dist/react/internal/part.d.ts +20 -0
- package/dist/react/internal/part.js +47 -0
- package/dist/react/internal/pointer-session.d.ts +8 -0
- package/dist/react/internal/pointer-session.js +60 -0
- package/dist/react/internal/refs.d.ts +2 -0
- package/dist/react/internal/refs.js +22 -0
- package/dist/react/internal/rich-text.d.ts +28 -0
- package/dist/react/internal/rich-text.js +4 -0
- package/dist/react/internal/table-context.d.ts +39 -0
- package/dist/react/internal/table-context.js +12 -0
- package/dist/react/internal/use-object-url.d.ts +1 -0
- package/dist/react/internal/use-object-url.js +15 -0
- package/dist/react/layout.css +274 -0
- package/dist/react/layout.css.d.ts +1 -0
- package/dist/react/models/filter.d.ts +31 -0
- package/dist/react/models/filter.js +79 -0
- package/dist/react/models/kanban.d.ts +51 -0
- package/dist/react/models/kanban.js +35 -0
- package/dist/react/models/reorder.d.ts +9 -0
- package/dist/react/models/reorder.js +23 -0
- package/dist/react/models/table.d.ts +85 -0
- package/dist/react/models/table.js +144 -0
- package/dist/react/models/tree.d.ts +16 -0
- package/dist/react/models/tree.js +26 -0
- package/dist/react/provider.d.ts +18 -0
- package/dist/react/provider.js +31 -0
- package/dist/react/recipes/context-hypercms.d.ts +17 -0
- package/dist/react/recipes/context-hypercms.js +71 -0
- package/dist/react/recipes/context-quickcrop.d.ts +8 -0
- package/dist/react/recipes/context-quickcrop.js +49 -0
- package/dist/react/theme.css +8004 -0
- package/dist/react/theme.css.d.ts +1 -0
- package/examples/README.md +34 -0
- package/examples/components/activity-feed.html +28 -0
- package/examples/components/app-shell.html +12 -0
- package/examples/components/app-toolbar.html +38 -0
- package/examples/components/avatar-group.html +27 -0
- package/examples/components/breadcrumbs.html +26 -0
- package/examples/components/bulk-bar.html +22 -0
- package/examples/components/code-block.html +12 -0
- package/examples/components/code-editor.html +25 -0
- package/examples/components/column-manager.html +9 -0
- package/examples/components/combobox.html +13 -0
- package/examples/components/context-hypercms.css +41 -0
- package/examples/components/context-hypercms.html +40 -0
- package/examples/components/context-hypercms.js +62 -0
- package/examples/components/context-quickcrop.html +137 -0
- package/examples/components/diff-view.html +9 -0
- package/examples/components/drawer.html +11 -0
- package/examples/components/editable-grid-cells.html +9 -0
- package/examples/components/file-browser.html +53 -0
- package/examples/components/file-tree.html +34 -0
- package/examples/components/files-table.html +80 -0
- package/examples/components/filter-builder.html +11 -0
- package/examples/components/form-error-summary.html +11 -0
- package/examples/components/index.html +51 -0
- package/examples/components/inline-edit.html +42 -0
- package/examples/components/kanban-board.html +42 -0
- package/examples/components/manifest.json +3279 -0
- package/examples/components/modal.html +11 -0
- package/examples/components/multi-select-picker.html +13 -0
- package/examples/components/pagination.html +32 -0
- package/examples/components/persistent-action-banner.html +23 -0
- package/examples/components/popconfirm.html +13 -0
- package/examples/components/popover-menu.html +13 -0
- package/examples/components/reference/baseline/DECISIONS.md +85 -0
- package/examples/components/reference/baseline/README.md +58 -0
- package/examples/components/reference/baseline/bevel-fonts.css +16 -0
- package/examples/components/reference/baseline/bevel.css +1339 -0
- package/examples/components/reference/baseline/bevel.js +496 -0
- package/examples/components/reference/baseline/fonts/LICENSE-ibm-plex-mono.txt +93 -0
- package/examples/components/reference/baseline/fonts/LICENSE-ibm-plex-sans.txt +93 -0
- package/examples/components/reference/baseline/fonts/LICENSE-newsreader.txt +93 -0
- package/examples/components/reference/baseline/fonts/ibm-plex-mono-latin-400-normal.woff2 +0 -0
- package/examples/components/reference/baseline/fonts/ibm-plex-mono-latin-500-normal.woff2 +0 -0
- package/examples/components/reference/baseline/fonts/ibm-plex-mono-latin-600-normal.woff2 +0 -0
- package/examples/components/reference/baseline/fonts/ibm-plex-sans-latin-400-italic.woff2 +0 -0
- package/examples/components/reference/baseline/fonts/ibm-plex-sans-latin-400-normal.woff2 +0 -0
- package/examples/components/reference/baseline/fonts/ibm-plex-sans-latin-500-normal.woff2 +0 -0
- package/examples/components/reference/baseline/fonts/ibm-plex-sans-latin-600-normal.woff2 +0 -0
- package/examples/components/reference/baseline/fonts/newsreader-latin-opsz-italic.woff2 +0 -0
- package/examples/components/reference/baseline/fonts/newsreader-latin-opsz-normal.woff2 +0 -0
- package/examples/components/reference/fable/IMPROVEMENTS.md +106 -0
- package/examples/components/reference/fable/PARENT-REPAIRS.md +17 -0
- package/examples/components/reference/fable/__pycache__/build_repairs.cpython-311.pyc +0 -0
- package/examples/components/reference/fable/__pycache__/kanban.cpython-311.pyc +0 -0
- package/examples/components/reference/fable/as-authored/IMPROVEMENTS-completed.md +106 -0
- package/examples/components/reference/fable/as-authored/base-astra.css +17 -0
- package/examples/components/reference/fable/as-authored/base-parent.css +416 -0
- package/examples/components/reference/fable/as-authored/build.py +858 -0
- package/examples/components/reference/fable/as-authored/fable.css +823 -0
- package/examples/components/reference/fable/as-authored/kanban-completed.css +235 -0
- package/examples/components/reference/fable/as-authored/kanban-completed.html +53 -0
- package/examples/components/reference/fable/as-authored/kanban-completed.py +212 -0
- package/examples/components/reference/fable/as-authored/kanban.py +207 -0
- package/examples/components/reference/fable/base-astra.css +17 -0
- package/examples/components/reference/fable/base-parent.css +416 -0
- package/examples/components/reference/fable/build.py +858 -0
- package/examples/components/reference/fable/build_repairs.py +25 -0
- package/examples/components/reference/fable/components/activity-feed.html +3 -0
- package/examples/components/reference/fable/components/app-toolbar.html +3 -0
- package/examples/components/reference/fable/components/avatar-group.html +4 -0
- package/examples/components/reference/fable/components/breadcrumbs.html +3 -0
- package/examples/components/reference/fable/components/code-block.html +9 -0
- package/examples/components/reference/fable/components/column-manager.html +3 -0
- package/examples/components/reference/fable/components/combobox.html +6 -0
- package/examples/components/reference/fable/components/context-hypercms.html +3 -0
- package/examples/components/reference/fable/components/context-quickcrop.html +4 -0
- package/examples/components/reference/fable/components/diff-view.html +13 -0
- package/examples/components/reference/fable/components/drawer.html +3 -0
- package/examples/components/reference/fable/components/editable-grid-cells.html +3 -0
- package/examples/components/reference/fable/components/filter-builder.html +3 -0
- package/examples/components/reference/fable/components/form-error-summary.html +4 -0
- package/examples/components/reference/fable/components/inline-edit.html +3 -0
- package/examples/components/reference/fable/components/kanban-board.html +53 -0
- package/examples/components/reference/fable/components/modal.html +3 -0
- package/examples/components/reference/fable/components/multi-select-picker.html +5 -0
- package/examples/components/reference/fable/components/pagination.html +3 -0
- package/examples/components/reference/fable/components/persistent-action-banner.html +4 -0
- package/examples/components/reference/fable/components/popconfirm.html +5 -0
- package/examples/components/reference/fable/components/popover-menu.html +3 -0
- package/examples/components/reference/fable/components/rich-text-toolbar.html +3 -0
- package/examples/components/reference/fable/components/save-status-indicator.html +2 -0
- package/examples/components/reference/fable/components/selectable-cards.html +3 -0
- package/examples/components/reference/fable/components/settings-rows.html +3 -0
- package/examples/components/reference/fable/components/sidebar-nav.html +4 -0
- package/examples/components/reference/fable/components/small-charts.html +5 -0
- package/examples/components/reference/fable/components/split-button.html +4 -0
- package/examples/components/reference/fable/components/split-panes.html +8 -0
- package/examples/components/reference/fable/components/stat-tiles.html +3 -0
- package/examples/components/reference/fable/components/toast-stack.html +5 -0
- package/examples/components/reference/fable/components/tree-view.html +4 -0
- package/examples/components/reference/fable/components/upload-dropzone.html +6 -0
- package/examples/components/reference/fable/components/wizard-shell.html +3 -0
- package/examples/components/reference/fable/coverage.json +414 -0
- package/examples/components/reference/fable/fable.css +823 -0
- package/examples/components/reference/fable/index.html +5 -0
- package/examples/components/reference/fable/kanban.css +237 -0
- package/examples/components/reference/fable/kanban.py +212 -0
- package/examples/components/reference/fable/parent-repairs.css +9 -0
- package/examples/components/reference/fixtures/data.json +102 -0
- package/examples/components/reference/fixtures/host.js +47 -0
- package/examples/components/reference/fixtures/static-host.js +39 -0
- package/examples/components/reference/fixtures/workspace.jpg +0 -0
- package/examples/components/reference/parent/CHANGES.md +179 -0
- package/examples/components/reference/parent/__pycache__/kanban.cpython-311.pyc +0 -0
- package/examples/components/reference/parent/base-astra.css +17 -0
- package/examples/components/reference/parent/base-parent.css +416 -0
- package/examples/components/reference/parent/build.py +148 -0
- package/examples/components/reference/parent/components/activity-feed.html +2 -0
- package/examples/components/reference/parent/components/app-toolbar.html +2 -0
- package/examples/components/reference/parent/components/avatar-group.html +4 -0
- package/examples/components/reference/parent/components/breadcrumbs.html +2 -0
- package/examples/components/reference/parent/components/code-block.html +8 -0
- package/examples/components/reference/parent/components/column-manager.html +2 -0
- package/examples/components/reference/parent/components/combobox.html +6 -0
- package/examples/components/reference/parent/components/context-hypercms.html +2 -0
- package/examples/components/reference/parent/components/context-quickcrop.html +4 -0
- package/examples/components/reference/parent/components/diff-view.html +4 -0
- package/examples/components/reference/parent/components/drawer.html +2 -0
- package/examples/components/reference/parent/components/editable-grid-cells.html +2 -0
- package/examples/components/reference/parent/components/filter-builder.html +2 -0
- package/examples/components/reference/parent/components/form-error-summary.html +2 -0
- package/examples/components/reference/parent/components/inline-edit.html +2 -0
- package/examples/components/reference/parent/components/kanban-board.html +84 -0
- package/examples/components/reference/parent/components/modal.html +2 -0
- package/examples/components/reference/parent/components/multi-select-picker.html +5 -0
- package/examples/components/reference/parent/components/pagination.html +2 -0
- package/examples/components/reference/parent/components/persistent-action-banner.html +4 -0
- package/examples/components/reference/parent/components/popconfirm.html +5 -0
- package/examples/components/reference/parent/components/popover-menu.html +2 -0
- package/examples/components/reference/parent/components/rich-text-toolbar.html +2 -0
- package/examples/components/reference/parent/components/save-status-indicator.html +2 -0
- package/examples/components/reference/parent/components/selectable-cards.html +2 -0
- package/examples/components/reference/parent/components/settings-rows.html +2 -0
- package/examples/components/reference/parent/components/sidebar-nav.html +4 -0
- package/examples/components/reference/parent/components/small-charts.html +2 -0
- package/examples/components/reference/parent/components/split-button.html +5 -0
- package/examples/components/reference/parent/components/split-panes.html +8 -0
- package/examples/components/reference/parent/components/stat-tiles.html +2 -0
- package/examples/components/reference/parent/components/toast-stack.html +5 -0
- package/examples/components/reference/parent/components/tree-view.html +4 -0
- package/examples/components/reference/parent/components/upload-dropzone.html +6 -0
- package/examples/components/reference/parent/components/wizard-shell.html +2 -0
- package/examples/components/reference/parent/coverage.json +414 -0
- package/examples/components/reference/parent/index.html +1 -0
- package/examples/components/reference/parent/kanban.css +114 -0
- package/examples/components/reference/parent/kanban.py +55 -0
- package/examples/components/reference/parent/refinement.css +53 -0
- package/examples/components/reference/selected/build.py +70 -0
- package/examples/components/reference/selected/components/activity-feed.html +3 -0
- package/examples/components/reference/selected/components/app-toolbar.html +3 -0
- package/examples/components/reference/selected/components/avatar-group.html +4 -0
- package/examples/components/reference/selected/components/breadcrumbs.html +3 -0
- package/examples/components/reference/selected/components/code-block.html +9 -0
- package/examples/components/reference/selected/components/column-manager.html +3 -0
- package/examples/components/reference/selected/components/combobox.html +6 -0
- package/examples/components/reference/selected/components/context-hypercms.html +3 -0
- package/examples/components/reference/selected/components/context-quickcrop.html +4 -0
- package/examples/components/reference/selected/components/diff-view.html +13 -0
- package/examples/components/reference/selected/components/drawer.html +3 -0
- package/examples/components/reference/selected/components/editable-grid-cells.html +3 -0
- package/examples/components/reference/selected/components/filter-builder.html +3 -0
- package/examples/components/reference/selected/components/form-error-summary.html +4 -0
- package/examples/components/reference/selected/components/inline-edit.html +3 -0
- package/examples/components/reference/selected/components/kanban-board.html +53 -0
- package/examples/components/reference/selected/components/modal.html +2 -0
- package/examples/components/reference/selected/components/multi-select-picker.html +5 -0
- package/examples/components/reference/selected/components/pagination.html +3 -0
- package/examples/components/reference/selected/components/persistent-action-banner.html +4 -0
- package/examples/components/reference/selected/components/popconfirm.html +5 -0
- package/examples/components/reference/selected/components/popover-menu.html +3 -0
- package/examples/components/reference/selected/components/rich-text-toolbar.html +3 -0
- package/examples/components/reference/selected/components/save-status-indicator.html +2 -0
- package/examples/components/reference/selected/components/selectable-cards.html +3 -0
- package/examples/components/reference/selected/components/settings-rows.html +3 -0
- package/examples/components/reference/selected/components/sidebar-nav.html +4 -0
- package/examples/components/reference/selected/components/small-charts.html +5 -0
- package/examples/components/reference/selected/components/split-button.html +4 -0
- package/examples/components/reference/selected/components/split-panes.html +8 -0
- package/examples/components/reference/selected/components/stat-tiles.html +3 -0
- package/examples/components/reference/selected/components/toast-stack.html +5 -0
- package/examples/components/reference/selected/components/tree-view.html +4 -0
- package/examples/components/reference/selected/components/upload-dropzone.html +6 -0
- package/examples/components/reference/selected/components/wizard-shell.html +3 -0
- package/examples/components/reference/selected/corrections.css +11 -0
- package/examples/components/reference/selected/coverage.json +413 -0
- package/examples/components/reference/selected/gallery-build.mjs +49 -0
- package/examples/components/reference/selected/gallery-spec.json +12 -0
- package/examples/components/reference/selected/index.html +1 -0
- package/examples/components/reference/selected/kanban-comparison.json +6 -0
- package/examples/components/reference/selected/manifest.json +476 -0
- package/examples/components/reference/sha256.json +142 -0
- package/examples/components/reference/sources/diagonal-close.svg +1 -0
- package/examples/components/reference/sources/hyperclay/public-assets/css/hyperclay-app-source.css +614 -0
- package/examples/components/reference/sources/hyperclay/public-assets/js/app.js +94 -0
- package/examples/components/reference/sources/hyperclayjs/src/ui/theModal.js +897 -0
- package/examples/components/reference/sources/hypercms/scripts/build-theme.js +203 -0
- package/examples/components/reference/sources/hypercms/src/anchor.js +24 -0
- package/examples/components/reference/sources/hypercms/src/apply-loop.js +167 -0
- package/examples/components/reference/sources/hypercms/src/diagnostics.js +44 -0
- package/examples/components/reference/sources/hypercms/src/enhance.js +173 -0
- package/examples/components/reference/sources/hypercms/src/events.js +955 -0
- package/examples/components/reference/sources/hypercms/src/form-builder.js +518 -0
- package/examples/components/reference/sources/hypercms/src/form-rules.js +208 -0
- package/examples/components/reference/sources/hypercms/src/hooks.js +100 -0
- package/examples/components/reference/sources/hypercms/src/hypercms-bundle.js +10 -0
- package/examples/components/reference/sources/hypercms/src/hypercms.js +347 -0
- package/examples/components/reference/sources/hypercms/src/morph.js +10 -0
- package/examples/components/reference/sources/hypercms/src/path.js +61 -0
- package/examples/components/reference/sources/hypercms/src/place.js +131 -0
- package/examples/components/reference/sources/hypercms/src/platform.js +131 -0
- package/examples/components/reference/sources/hypercms/src/refresh.js +87 -0
- package/examples/components/reference/sources/hypercms/src/richclay-bridge.js +140 -0
- package/examples/components/reference/sources/hypercms/src/row-identity.js +111 -0
- package/examples/components/reference/sources/hypercms/src/scaffold.js +10 -0
- package/examples/components/reference/sources/hypercms/src/session.js +303 -0
- package/examples/components/reference/sources/hypercms/src/shell.js +248 -0
- package/examples/components/reference/sources/hypercms/src/styles.css +298 -0
- package/examples/components/reference/sources/hypercms/src/targets.js +144 -0
- package/examples/components/reference/sources/hypercms/src/templates.js +656 -0
- package/examples/components/reference/sources/hypercms/src/theme/pixel-quiet.overrides.css +761 -0
- package/examples/components/reference/sources/hypercms/src/theme.generated.css +1772 -0
- package/examples/components/reference/sources/hypercms/src/toggle.js +666 -0
- package/examples/components/reference/sources/hypercms/src/unresolved.js +211 -0
- package/examples/components/reference/sources/hypercms/src/vendor/mirk.vendor.js +212 -0
- package/examples/components/reference/sources/hypercms/src/views/inline-layer.js +421 -0
- package/examples/components/reference/sources/hypercms/src/views/inline.js +1072 -0
- package/examples/components/reference/sources/hypercms/src/views/sidebar.js +97 -0
- package/examples/components/reference/sources/modal-reference.html +301 -0
- package/examples/components/reference/sources/quickcrop/quickcrop.css +124 -0
- package/examples/components/reference/sources/quickcrop/quickcrop.js +400 -0
- package/examples/components/reference/sources/richclay/richclay.css +416 -0
- package/examples/components/reference/sources/richclay/richclay.js +2962 -0
- package/examples/components/reference/sources/richclay/src/a11y.js +67 -0
- package/examples/components/reference/sources/richclay/src/browser-global.js +7 -0
- package/examples/components/reference/sources/richclay/src/buttons.js +254 -0
- package/examples/components/reference/sources/richclay/src/hyperclay.js +470 -0
- package/examples/components/reference/sources/richclay/src/normalize.js +380 -0
- package/examples/components/reference/sources/richclay/src/richclay.js +1356 -0
- package/examples/components/reference/sources/richclay/src/sanitize.js +189 -0
- package/examples/components/reference/sources/richclay/src/styles.js +23 -0
- package/examples/components/reference/sources/richclay/src/toolbar-float.js +175 -0
- package/examples/components/reference/sources/richclay/src/toolbar.js +394 -0
- package/examples/components/reference/sources/richclay/src/vendor-bundle.js +15 -0
- package/examples/components/reference/sources/richclay/vendor/DOMPURIFY-LICENSE +202 -0
- package/examples/components/reference/sources/richclay/vendor/DOMPURIFY-LICENSE-MPL +373 -0
- package/examples/components/reference/sources/richclay/vendor/SQUIRE-LICENSE +21 -0
- package/examples/components/reference/sources/richclay/vendor/purify.es.mjs +2249 -0
- package/examples/components/reference/sources/richclay/vendor/purify.min.js +3 -0
- package/examples/components/reference/sources/richclay/vendor/squire.js +22 -0
- package/examples/components/reference/sources/richclay/vendor/squire.mjs +22 -0
- package/examples/components/reference/sources/richclay/vendor/squire.provenance.json +19 -0
- package/examples/components/rich-text-toolbar.html +43 -0
- package/examples/components/save-status-indicator.html +11 -0
- package/examples/components/selectable-cards.html +9 -0
- package/examples/components/settings-rows.html +10 -0
- package/examples/components/sidebar-nav.html +9 -0
- package/examples/components/small-charts.html +21 -0
- package/examples/components/split-button.html +13 -0
- package/examples/components/split-panes-editor.html +6 -0
- package/examples/components/split-panes.html +9 -0
- package/examples/components/stat-tiles.html +23 -0
- package/examples/components/toast-stack.html +21 -0
- package/examples/components/tree-view.html +9 -0
- package/examples/components/upload-dropzone.html +88 -0
- package/examples/components/wizard-shell.html +50 -0
- package/examples/datastar/index.html +38 -0
- package/examples/datastar/server.mjs +31 -0
- package/examples/fixtures/field-guide.pdf +14 -0
- package/examples/fixtures/workspace.jpg +0 -0
- package/examples/setup-peers.mjs +35 -0
- package/fonts/LICENSE-ibm-plex-mono.txt +93 -0
- package/fonts/LICENSE-ibm-plex-sans.txt +93 -0
- package/fonts/LICENSE-newsreader.txt +93 -0
- package/fonts/ibm-plex-mono-latin-400-normal.woff2 +0 -0
- package/fonts/ibm-plex-mono-latin-500-normal.woff2 +0 -0
- package/fonts/ibm-plex-mono-latin-600-normal.woff2 +0 -0
- package/fonts/ibm-plex-sans-latin-400-italic.woff2 +0 -0
- package/fonts/ibm-plex-sans-latin-400-normal.woff2 +0 -0
- package/fonts/ibm-plex-sans-latin-500-normal.woff2 +0 -0
- package/fonts/ibm-plex-sans-latin-600-normal.woff2 +0 -0
- package/fonts/newsreader-latin-opsz-italic.woff2 +0 -0
- package/fonts/newsreader-latin-opsz-normal.woff2 +0 -0
- package/icons/LICENSE +21 -0
- package/icons/house.json +71 -0
- package/icons/icons.d.ts +17 -0
- package/icons/icons.js +648 -0
- package/icons/icons.svg +126 -0
- package/icons/marks/build-tray.source.mjs +45 -0
- package/icons/marks/hyperclay-local.svg +11 -0
- package/icons/phosphor.json +53 -0
- package/icons/round.json +8 -0
- package/integrations/datastar.js +202 -0
- package/integrations/quickcrop.css +26 -0
- package/integrations/quickcrop.js +56 -0
- package/integrations/richclay.css +100 -0
- package/integrations/richclay.js +131 -0
- package/package.json +630 -0
- package/react/README.md +244 -0
- package/src/README.md +83 -0
- package/vendor/datastar/datastar-1.0.3.js +10 -0
- package/vendor/datastar/provenance.json +6 -0
- package/vendor/floating-ui/LICENSE-core +20 -0
- package/vendor/floating-ui/LICENSE-dom +20 -0
- package/vendor/floating-ui/floating-ui.core.umd.min.js +1 -0
- package/vendor/floating-ui/floating-ui.dom.umd.min.js +1 -0
- package/vendor/floating-ui/provenance.json +17 -0
- package/vendor/richclay/LICENSE +16 -0
- package/vendor/richclay/THIRD-PARTY-NOTICES.md +45 -0
- package/vendor/richclay/provenance.json +17 -0
- package/vendor/richclay/richclay.css +404 -0
- package/vendor/richclay/richclay.js +2940 -0
- package/vendor/richclay/vendor/DOMPURIFY-LICENSE +202 -0
- package/vendor/richclay/vendor/DOMPURIFY-LICENSE-MPL +373 -0
- package/vendor/richclay/vendor/SQUIRE-LICENSE +21 -0
- package/vendor/richclay/vendor/purify.min.js +3 -0
- package/vendor/richclay/vendor/squire.js +22 -0
- package/vendor/richclay/vendor/squire.provenance.json +30 -0
|
@@ -0,0 +1,897 @@
|
|
|
1
|
+
/*
|
|
2
|
+
|
|
3
|
+
theModal
|
|
4
|
+
|
|
5
|
+
// a pretty alternative to window.prompt
|
|
6
|
+
|
|
7
|
+
- set the content of the modal
|
|
8
|
+
- open it
|
|
9
|
+
- user confirms
|
|
10
|
+
- everything about the modal resets
|
|
11
|
+
|
|
12
|
+
themodal.html = content;
|
|
13
|
+
themodal.yes = content;
|
|
14
|
+
themodal.no = content;
|
|
15
|
+
|
|
16
|
+
themodal.disableFocus = true;
|
|
17
|
+
themodal.disableScroll = true;
|
|
18
|
+
|
|
19
|
+
themodal.onYes(content);
|
|
20
|
+
themodal.onNo(content);
|
|
21
|
+
|
|
22
|
+
themodal.open();
|
|
23
|
+
themodal.close();
|
|
24
|
+
|
|
25
|
+
*/
|
|
26
|
+
|
|
27
|
+
/*
|
|
28
|
+
|
|
29
|
+
things you probably want to style
|
|
30
|
+
|
|
31
|
+
.micromodal {}
|
|
32
|
+
.micromodal .micromodal__container {}
|
|
33
|
+
.micromodal .micromodal__content {}
|
|
34
|
+
.micromodal .micromodal__heading {}
|
|
35
|
+
.micromodal .micromodal__input {}
|
|
36
|
+
.micromodal .micromodal__input:focus, .micromodal .micromodal__input:active {}
|
|
37
|
+
.micromodal .micromodal__buttons {}
|
|
38
|
+
.micromodal .micromodal__yes, .micromodal__no {}
|
|
39
|
+
.micromodal .micromodal__yes {}
|
|
40
|
+
.micromodal .micromodal__yes:focus, .micromodal__yes:hover {}
|
|
41
|
+
.micromodal .micromodal__no {}
|
|
42
|
+
.micromodal .micromodal__no:focus, .micromodal__no:hover {}
|
|
43
|
+
.micromodal .micromodal__close {}
|
|
44
|
+
.micromodal .micromodal__close:focus, .micromodal__close:hover {}
|
|
45
|
+
|
|
46
|
+
*/
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
// MicroModal
|
|
54
|
+
// MIT License (c) 2017 Indrashish Ghosh
|
|
55
|
+
// MODIFIED: removed `this.activeElement.focus()` after modal is closed
|
|
56
|
+
|
|
57
|
+
const MicroModal = (() => {
|
|
58
|
+
'use strict'
|
|
59
|
+
|
|
60
|
+
const FOCUSABLE_ELEMENTS = [
|
|
61
|
+
'a[href]',
|
|
62
|
+
'area[href]',
|
|
63
|
+
'input:not([disabled]):not([type="hidden"]):not([aria-hidden])',
|
|
64
|
+
'select:not([disabled]):not([aria-hidden])',
|
|
65
|
+
'textarea:not([disabled]):not([aria-hidden])',
|
|
66
|
+
'button:not([disabled]):not([aria-hidden])',
|
|
67
|
+
'iframe',
|
|
68
|
+
'object',
|
|
69
|
+
'embed',
|
|
70
|
+
'[contenteditable]',
|
|
71
|
+
'[tabindex]:not([tabindex^="-"])'
|
|
72
|
+
]
|
|
73
|
+
|
|
74
|
+
class Modal {
|
|
75
|
+
constructor ({
|
|
76
|
+
targetModal,
|
|
77
|
+
triggers = [],
|
|
78
|
+
onShow = () => { },
|
|
79
|
+
onClose = () => { },
|
|
80
|
+
openTrigger = 'data-micromodal-trigger',
|
|
81
|
+
closeTrigger = 'data-micromodal-close',
|
|
82
|
+
openClass = 'is-open',
|
|
83
|
+
disableScroll = false,
|
|
84
|
+
disableFocus = false,
|
|
85
|
+
awaitCloseAnimation = false,
|
|
86
|
+
awaitOpenAnimation = false,
|
|
87
|
+
debugMode = false
|
|
88
|
+
}) {
|
|
89
|
+
this.modal = document.getElementById(targetModal)
|
|
90
|
+
|
|
91
|
+
this.config = { debugMode, disableScroll, openTrigger, closeTrigger, openClass, onShow, onClose, awaitCloseAnimation, awaitOpenAnimation, disableFocus }
|
|
92
|
+
|
|
93
|
+
if (triggers.length > 0) this.registerTriggers(...triggers)
|
|
94
|
+
|
|
95
|
+
this.onClick = this.onClick.bind(this)
|
|
96
|
+
this.onKeydown = this.onKeydown.bind(this)
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
registerTriggers (...triggers) {
|
|
100
|
+
triggers.filter(Boolean).forEach(trigger => {
|
|
101
|
+
trigger.addEventListener('click', event => this.showModal(event))
|
|
102
|
+
})
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
showModal (event = null) {
|
|
106
|
+
this.activeElement = document.activeElement
|
|
107
|
+
this.modal.setAttribute('aria-hidden', 'false')
|
|
108
|
+
this.modal.classList.add(this.config.openClass)
|
|
109
|
+
this.scrollBehaviour('disable')
|
|
110
|
+
this.addEventListeners()
|
|
111
|
+
|
|
112
|
+
if (this.config.awaitOpenAnimation) {
|
|
113
|
+
const handler = () => {
|
|
114
|
+
this.modal.removeEventListener('animationend', handler, false)
|
|
115
|
+
this.setFocusToFirstNode()
|
|
116
|
+
}
|
|
117
|
+
this.modal.addEventListener('animationend', handler, false)
|
|
118
|
+
} else {
|
|
119
|
+
this.setFocusToFirstNode()
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
this.config.onShow(this.modal, this.activeElement, event)
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
closeModal (event = null) {
|
|
126
|
+
const modal = this.modal
|
|
127
|
+
this.modal.setAttribute('aria-hidden', 'true')
|
|
128
|
+
this.removeEventListeners()
|
|
129
|
+
this.scrollBehaviour('enable')
|
|
130
|
+
this.config.onClose(this.modal, this.activeElement, event)
|
|
131
|
+
|
|
132
|
+
if (this.config.awaitCloseAnimation) {
|
|
133
|
+
const openClass = this.config.openClass // <- old school ftw
|
|
134
|
+
this.modal.addEventListener('animationend', function handler () {
|
|
135
|
+
modal.classList.remove(openClass)
|
|
136
|
+
modal.removeEventListener('animationend', handler, false)
|
|
137
|
+
}, false)
|
|
138
|
+
} else {
|
|
139
|
+
modal.classList.remove(this.config.openClass)
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
closeModalById (targetModal) {
|
|
144
|
+
// Fall back to the stored modal reference when the node was removed from
|
|
145
|
+
// the DOM externally (e.g. a live-sync morph). Without this, getElementById
|
|
146
|
+
// returns null, closeModal() is skipped, and its cleanup never runs — the
|
|
147
|
+
// onClose callback, this.removeEventListeners() (which drops MicroModal's
|
|
148
|
+
// document keydown listener), and scroll restore are all stranded.
|
|
149
|
+
const modal = document.getElementById(targetModal)
|
|
150
|
+
if (modal) this.modal = modal
|
|
151
|
+
if (this.modal) this.closeModal()
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
scrollBehaviour (toggle) {
|
|
155
|
+
if (!this.config.disableScroll) return
|
|
156
|
+
const body = document.querySelector('body')
|
|
157
|
+
switch (toggle) {
|
|
158
|
+
case 'enable':
|
|
159
|
+
Object.assign(body.style, { overflow: '' })
|
|
160
|
+
break
|
|
161
|
+
case 'disable':
|
|
162
|
+
Object.assign(body.style, { overflow: 'hidden' })
|
|
163
|
+
break
|
|
164
|
+
default:
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
addEventListeners () {
|
|
169
|
+
this.modal.addEventListener('touchstart', this.onClick)
|
|
170
|
+
this.modal.addEventListener('click', this.onClick)
|
|
171
|
+
document.addEventListener('keydown', this.onKeydown)
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
removeEventListeners () {
|
|
175
|
+
if (this.modal) {
|
|
176
|
+
this.modal.removeEventListener('touchstart', this.onClick)
|
|
177
|
+
this.modal.removeEventListener('click', this.onClick)
|
|
178
|
+
}
|
|
179
|
+
document.removeEventListener('keydown', this.onKeydown)
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
onClick (event) {
|
|
183
|
+
if (
|
|
184
|
+
event.target.hasAttribute(this.config.closeTrigger) ||
|
|
185
|
+
event.target.parentNode.hasAttribute(this.config.closeTrigger)
|
|
186
|
+
) {
|
|
187
|
+
event.preventDefault()
|
|
188
|
+
event.stopPropagation()
|
|
189
|
+
this.closeModal(event)
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
onKeydown (event) {
|
|
194
|
+
if (event.keyCode === 27) this.closeModal(event) // esc
|
|
195
|
+
if (event.keyCode === 9) this.retainFocus(event) // tab
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
getFocusableNodes () {
|
|
199
|
+
const nodes = this.modal.querySelectorAll(FOCUSABLE_ELEMENTS)
|
|
200
|
+
return Array(...nodes)
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
setFocusToFirstNode () {
|
|
204
|
+
if (this.config.disableFocus) return
|
|
205
|
+
|
|
206
|
+
const focusableNodes = this.getFocusableNodes()
|
|
207
|
+
|
|
208
|
+
if (focusableNodes.length === 0) return
|
|
209
|
+
|
|
210
|
+
const nodesWhichAreNotCloseTargets = focusableNodes.filter(node => {
|
|
211
|
+
return !node.hasAttribute(this.config.closeTrigger)
|
|
212
|
+
})
|
|
213
|
+
|
|
214
|
+
if (nodesWhichAreNotCloseTargets.length > 0) nodesWhichAreNotCloseTargets[0].focus()
|
|
215
|
+
if (nodesWhichAreNotCloseTargets.length === 0) focusableNodes[0].focus()
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
retainFocus (event) {
|
|
219
|
+
let focusableNodes = this.getFocusableNodes()
|
|
220
|
+
|
|
221
|
+
if (focusableNodes.length === 0) return
|
|
222
|
+
|
|
223
|
+
focusableNodes = focusableNodes.filter(node => {
|
|
224
|
+
return (node.offsetParent !== null)
|
|
225
|
+
})
|
|
226
|
+
|
|
227
|
+
if (!this.modal.contains(document.activeElement)) {
|
|
228
|
+
focusableNodes[0].focus()
|
|
229
|
+
} else {
|
|
230
|
+
const focusedItemIndex = focusableNodes.indexOf(document.activeElement)
|
|
231
|
+
|
|
232
|
+
if (event.shiftKey && focusedItemIndex === 0) {
|
|
233
|
+
focusableNodes[focusableNodes.length - 1].focus()
|
|
234
|
+
event.preventDefault()
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
if (!event.shiftKey && focusableNodes.length > 0 && focusedItemIndex === focusableNodes.length - 1) {
|
|
238
|
+
focusableNodes[0].focus()
|
|
239
|
+
event.preventDefault()
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
|
|
246
|
+
// Keep a reference to the opened modal
|
|
247
|
+
let activeModal = null
|
|
248
|
+
|
|
249
|
+
const generateTriggerMap = (triggers, triggerAttr) => {
|
|
250
|
+
const triggerMap = []
|
|
251
|
+
|
|
252
|
+
triggers.forEach(trigger => {
|
|
253
|
+
const targetModal = trigger.attributes[triggerAttr].value
|
|
254
|
+
if (triggerMap[targetModal] === undefined) triggerMap[targetModal] = []
|
|
255
|
+
triggerMap[targetModal].push(trigger)
|
|
256
|
+
})
|
|
257
|
+
|
|
258
|
+
return triggerMap
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
const validateModalPresence = id => {
|
|
262
|
+
if (!document.getElementById(id)) {
|
|
263
|
+
console.warn(`MicroModal: \u2757Seems like you have missed %c'${ id }'`, 'background-color: #f8f9fa;color: #50596c;font-weight: bold;', 'ID somewhere in your code. Refer example below to resolve it.')
|
|
264
|
+
console.warn('%cExample:', 'background-color: #f8f9fa;color: #50596c;font-weight: bold;', `<div class="modal" id="${ id }"></div>`)
|
|
265
|
+
return false
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
const validateTriggerPresence = triggers => {
|
|
270
|
+
if (triggers.length <= 0) {
|
|
271
|
+
console.warn('MicroModal: \u2757Please specify at least one %c\'micromodal-trigger\'', 'background-color: #f8f9fa;color: #50596c;font-weight: bold;', 'data attribute.')
|
|
272
|
+
console.warn('%cExample:', 'background-color: #f8f9fa;color: #50596c;font-weight: bold;', '<a href="#" data-micromodal-trigger="my-modal"></a>')
|
|
273
|
+
return false
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
const validateArgs = (triggers, triggerMap) => {
|
|
278
|
+
validateTriggerPresence(triggers)
|
|
279
|
+
if (!triggerMap) return true
|
|
280
|
+
for (const id in triggerMap) validateModalPresence(id)
|
|
281
|
+
return true
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
const init = config => {
|
|
285
|
+
const options = Object.assign({}, { openTrigger: 'data-micromodal-trigger' }, config)
|
|
286
|
+
|
|
287
|
+
const triggers = [...document.querySelectorAll(`[${ options.openTrigger }]`)]
|
|
288
|
+
|
|
289
|
+
const triggerMap = generateTriggerMap(triggers, options.openTrigger)
|
|
290
|
+
|
|
291
|
+
if (options.debugMode === true && validateArgs(triggers, triggerMap) === false) return
|
|
292
|
+
|
|
293
|
+
for (const key in triggerMap) {
|
|
294
|
+
const value = triggerMap[key]
|
|
295
|
+
options.targetModal = key
|
|
296
|
+
options.triggers = [...value]
|
|
297
|
+
activeModal = new Modal(options) // eslint-disable-line no-new
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
const show = (targetModal, config) => {
|
|
302
|
+
const options = config || {}
|
|
303
|
+
options.targetModal = targetModal
|
|
304
|
+
|
|
305
|
+
if (options.debugMode === true && validateModalPresence(targetModal) === false) return
|
|
306
|
+
|
|
307
|
+
if (activeModal) activeModal.removeEventListeners()
|
|
308
|
+
|
|
309
|
+
activeModal = new Modal(options) // eslint-disable-line no-new
|
|
310
|
+
activeModal.showModal()
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
const close = targetModal => {
|
|
314
|
+
if (!activeModal) return
|
|
315
|
+
targetModal ? activeModal.closeModalById(targetModal) : activeModal.closeModal()
|
|
316
|
+
activeModal = null
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
return { init, show, close }
|
|
320
|
+
})()
|
|
321
|
+
|
|
322
|
+
|
|
323
|
+
|
|
324
|
+
// themodal.js
|
|
325
|
+
// MIT License (c) 2023 David Miranda
|
|
326
|
+
|
|
327
|
+
const modalCss = `<style class="micromodal-css">
|
|
328
|
+
.micromodal {
|
|
329
|
+
display: none;
|
|
330
|
+
color: #fff;
|
|
331
|
+
font-family: var(--hyperclay-modal-font-family, ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace);
|
|
332
|
+
font-size: var(--hyperclay-modal-font-size, 18px);
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
.micromodal button:not(.custom-button) {
|
|
336
|
+
background: none;
|
|
337
|
+
color: inherit;
|
|
338
|
+
border: none;
|
|
339
|
+
padding: 0;
|
|
340
|
+
margin: 0;
|
|
341
|
+
width: auto;
|
|
342
|
+
overflow: visible;
|
|
343
|
+
font: inherit;
|
|
344
|
+
line-height: inherit;
|
|
345
|
+
text-transform: none;
|
|
346
|
+
text-align: center;
|
|
347
|
+
text-decoration: none;
|
|
348
|
+
cursor: pointer;
|
|
349
|
+
-webkit-appearance: none;
|
|
350
|
+
-moz-appearance: none;
|
|
351
|
+
appearance: none;
|
|
352
|
+
outline: 0;
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
.micromodal .micromodal__hide {
|
|
356
|
+
display: none;
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
.micromodal.is-open {
|
|
360
|
+
display: block;
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
.micromodal__overlay {
|
|
364
|
+
position: fixed;
|
|
365
|
+
top: 0;
|
|
366
|
+
left: 0;
|
|
367
|
+
right: 0;
|
|
368
|
+
bottom: 0;
|
|
369
|
+
display: flex;
|
|
370
|
+
justify-content: center;
|
|
371
|
+
align-items: center;
|
|
372
|
+
background: rgba(0,0,0,.65);
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
.micromodal__container {
|
|
376
|
+
position: relative;
|
|
377
|
+
width: 100%;
|
|
378
|
+
min-width: 0;
|
|
379
|
+
max-width: min(550px, calc(100vw - 2rem));
|
|
380
|
+
max-height: calc(100vh - 4rem);
|
|
381
|
+
max-height: calc(100dvh - 2rem);
|
|
382
|
+
box-sizing: border-box;
|
|
383
|
+
overflow: hidden;
|
|
384
|
+
border: 2px solid #FFFFFF;
|
|
385
|
+
background-color: #11131E;
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
.micromodal__inner {
|
|
389
|
+
overflow-x: hidden;
|
|
390
|
+
overflow-y: auto;
|
|
391
|
+
/* Must subtract container's 4px border (2px top + 2px bottom) from max-height,
|
|
392
|
+
otherwise inner overflows past container since box-sizing: border-box
|
|
393
|
+
makes the container's content area smaller than its max-height */
|
|
394
|
+
max-height: calc(100dvh - 2rem - 4px);
|
|
395
|
+
padding: 26px 40px 40px 40px;
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
@media (min-width: 640px) {
|
|
399
|
+
.micromodal .micromodal__inner {
|
|
400
|
+
padding: 52px 64px 60px 64px;
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
.micromodal[aria-hidden="false"] .micromodal__overlay {
|
|
405
|
+
animation: microModalFadeIn .2s cubic-bezier(0.0, 0.0, 0.2, 1);
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
.micromodal[aria-hidden="false"] .micromodal__container {
|
|
409
|
+
animation: microModalSlideIn .2s cubic-bezier(0, 0, .2, 1);
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
.micromodal .micromodal__container,
|
|
413
|
+
.micromodal .micromodal__overlay {
|
|
414
|
+
will-change: transform;
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
@keyframes microModalFadeIn {
|
|
418
|
+
from { opacity: 0; }
|
|
419
|
+
to { opacity: 1; }
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
@keyframes microModalSlideIn {
|
|
423
|
+
from { transform: translateY(15%); }
|
|
424
|
+
to { transform: translateY(0); }
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
.micromodal .micromodal__content {
|
|
428
|
+
margin-bottom: 14px;
|
|
429
|
+
overflow-wrap: anywhere;
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
.micromodal .micromodal__heading {
|
|
433
|
+
display: flex;
|
|
434
|
+
flex-direction: column;
|
|
435
|
+
gap: 2px;
|
|
436
|
+
margin-bottom: 8px;
|
|
437
|
+
overflow-wrap: anywhere;
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
.micromodal .micromodal__input {
|
|
441
|
+
width: min(calc(100vw - 100px), 420px);
|
|
442
|
+
padding: 6px 6px 7px;
|
|
443
|
+
font-size: var(--hyperclay-modal-input-font-size, 16px);
|
|
444
|
+
color: #000;
|
|
445
|
+
background: #fff;
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
.micromodal .micromodal__input:focus, .micromodal .micromodal__input:active {
|
|
449
|
+
outline: 3px solid #6A73B6;
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
.micromodal button.micromodal__yes {
|
|
453
|
+
display: flex;
|
|
454
|
+
justify-content: center;
|
|
455
|
+
align-items: center;
|
|
456
|
+
width: 100%;
|
|
457
|
+
height: 39px;
|
|
458
|
+
line-height: 0;
|
|
459
|
+
border: 3px solid;
|
|
460
|
+
border-top-color: #94BA6F;
|
|
461
|
+
border-left-color: #94BA6F;
|
|
462
|
+
border-bottom-color: #1A3004;
|
|
463
|
+
border-right-color: #1A3004;
|
|
464
|
+
background-color: #49870B;
|
|
465
|
+
}
|
|
466
|
+
|
|
467
|
+
.micromodal button.micromodal__yes:focus,
|
|
468
|
+
.micromodal button.micromodal__yes:hover {
|
|
469
|
+
background-color: #549B0D;
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
.micromodal button.micromodal__yes:active {
|
|
473
|
+
border-top-color: #1A3004;
|
|
474
|
+
border-left-color: #1A3004;
|
|
475
|
+
border-bottom-color: #94BA6F;
|
|
476
|
+
border-right-color: #94BA6F;
|
|
477
|
+
}
|
|
478
|
+
|
|
479
|
+
.micromodal button.micromodal__secondary-btn {
|
|
480
|
+
display: flex;
|
|
481
|
+
justify-content: center;
|
|
482
|
+
align-items: center;
|
|
483
|
+
width: 100%;
|
|
484
|
+
height: 39px;
|
|
485
|
+
line-height: 0;
|
|
486
|
+
border: 3px solid;
|
|
487
|
+
border-top-color: #474C65;
|
|
488
|
+
border-left-color: #474C65;
|
|
489
|
+
border-bottom-color: #131725;
|
|
490
|
+
border-right-color: #131725;
|
|
491
|
+
background-color: #1D1F2F;
|
|
492
|
+
color: #E5E7EB;
|
|
493
|
+
font-family: inherit;
|
|
494
|
+
font-size: inherit;
|
|
495
|
+
font-weight: bold;
|
|
496
|
+
}
|
|
497
|
+
|
|
498
|
+
.micromodal button.micromodal__secondary-btn:focus,
|
|
499
|
+
.micromodal button.micromodal__secondary-btn:hover {
|
|
500
|
+
background-color: #232639;
|
|
501
|
+
}
|
|
502
|
+
|
|
503
|
+
.micromodal button.micromodal__secondary-btn:active {
|
|
504
|
+
border-top-color: #131725;
|
|
505
|
+
border-left-color: #131725;
|
|
506
|
+
border-bottom-color: #474C65;
|
|
507
|
+
border-right-color: #474C65;
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
.micromodal:has(.snippet-code-block) .micromodal__content {
|
|
511
|
+
margin-bottom: 0;
|
|
512
|
+
}
|
|
513
|
+
|
|
514
|
+
.micromodal .snippet-code-block {
|
|
515
|
+
background-color: #292E54;
|
|
516
|
+
padding: 1rem;
|
|
517
|
+
margin-bottom: 14px;
|
|
518
|
+
max-width: 420px;
|
|
519
|
+
overflow-x: auto;
|
|
520
|
+
}
|
|
521
|
+
|
|
522
|
+
.micromodal .snippet-code-block pre {
|
|
523
|
+
color: white;
|
|
524
|
+
font-family: var(--hyperclay-modal-code-font-family, var(--hyperclay-modal-font-family, monospace));
|
|
525
|
+
font-size: 0.875rem;
|
|
526
|
+
white-space: nowrap;
|
|
527
|
+
margin: 0;
|
|
528
|
+
}
|
|
529
|
+
|
|
530
|
+
.micromodal .snippet-warning {
|
|
531
|
+
padding: 0.75rem;
|
|
532
|
+
border: 2px solid #989742;
|
|
533
|
+
background-color: #1E1E11;
|
|
534
|
+
font-size: 0.875rem;
|
|
535
|
+
color: #FBF7B7;
|
|
536
|
+
max-width: 420px;
|
|
537
|
+
}
|
|
538
|
+
|
|
539
|
+
.micromodal .snippet-link-box {
|
|
540
|
+
font-size: 16px;
|
|
541
|
+
margin-top: 0.75rem;
|
|
542
|
+
text-align: right;
|
|
543
|
+
}
|
|
544
|
+
|
|
545
|
+
.micromodal .snippet-link-box a {
|
|
546
|
+
color: #F6F7F9;
|
|
547
|
+
text-decoration: none;
|
|
548
|
+
display: inline-flex;
|
|
549
|
+
align-items: center;
|
|
550
|
+
gap: 0.3rem;
|
|
551
|
+
padding: 0.35rem 0.45rem;
|
|
552
|
+
border: 1px solid #474C64;
|
|
553
|
+
line-height: 1;
|
|
554
|
+
}
|
|
555
|
+
|
|
556
|
+
.micromodal .snippet-link-box a:hover {
|
|
557
|
+
color: #E5E7EB;
|
|
558
|
+
border-color: #75798B;
|
|
559
|
+
}
|
|
560
|
+
|
|
561
|
+
.micromodal .snippet-link-box a svg {
|
|
562
|
+
width: 0.85rem;
|
|
563
|
+
height: 0.85rem;
|
|
564
|
+
flex-shrink: 0;
|
|
565
|
+
}
|
|
566
|
+
|
|
567
|
+
.micromodal button.micromodal__close {
|
|
568
|
+
clip-path: polygon(0% 4%, 0% 0%, 100% 0%, 100% 100%, 94% 100%);
|
|
569
|
+
position: absolute;
|
|
570
|
+
top: -1px;
|
|
571
|
+
right: -1px;
|
|
572
|
+
width: 68px;
|
|
573
|
+
}
|
|
574
|
+
|
|
575
|
+
.micromodal .micromodal__close-bg {
|
|
576
|
+
fill: #1D2032;
|
|
577
|
+
}
|
|
578
|
+
|
|
579
|
+
.micromodal .micromodal__close:hover .micromodal__close-bg {
|
|
580
|
+
fill: #212543;
|
|
581
|
+
}
|
|
582
|
+
|
|
583
|
+
.micromodal .micromodal__close-x {
|
|
584
|
+
fill: #fff;
|
|
585
|
+
}
|
|
586
|
+
|
|
587
|
+
.micromodal .micromodal__tell {
|
|
588
|
+
max-width: 440px;
|
|
589
|
+
margin-bottom: 28px;
|
|
590
|
+
}
|
|
591
|
+
|
|
592
|
+
.micromodal .micromodal__tell > * + * {
|
|
593
|
+
margin-top: 20px;
|
|
594
|
+
}
|
|
595
|
+
|
|
596
|
+
.micromodal .micromodal__tell-title {
|
|
597
|
+
font-size: var(--hyperclay-modal-title-font-size, 20px);
|
|
598
|
+
font-weight: bold;
|
|
599
|
+
}
|
|
600
|
+
|
|
601
|
+
.micromodal .micromodal__tell-content {
|
|
602
|
+
font-size: var(--hyperclay-modal-font-size, 16px);
|
|
603
|
+
font-weight: normal;
|
|
604
|
+
}
|
|
605
|
+
|
|
606
|
+
@media (min-width: 640px) {
|
|
607
|
+
.micromodal .micromodal__tell-title {
|
|
608
|
+
font-size: var(--hyperclay-modal-title-font-size, 22px);
|
|
609
|
+
}
|
|
610
|
+
.micromodal .micromodal__tell-content {
|
|
611
|
+
font-size: var(--hyperclay-modal-font-size, 18px);
|
|
612
|
+
}
|
|
613
|
+
}
|
|
614
|
+
</style>`;
|
|
615
|
+
|
|
616
|
+
const modalHtml = `<div class="micromodal" id="micromodal" aria-hidden="true">
|
|
617
|
+
<div class="micromodal__overlay" tabindex="-1">
|
|
618
|
+
<form class="micromodal__container" role="dialog" aria-modal="true">
|
|
619
|
+
<div class="micromodal__inner">
|
|
620
|
+
<div class="micromodal__content"></div>
|
|
621
|
+
<div class="micromodal__buttons">
|
|
622
|
+
<button class="micromodal__no" type="button"></button>
|
|
623
|
+
<button class="micromodal__yes" type="submit"></button>
|
|
624
|
+
</div>
|
|
625
|
+
</div>
|
|
626
|
+
<button class="micromodal__close" type="button" aria-label="Close modal"></button>
|
|
627
|
+
</form>
|
|
628
|
+
</div>
|
|
629
|
+
</div>`;
|
|
630
|
+
|
|
631
|
+
// Default close button (pixel-art X). Ships with themodal so directly-driven
|
|
632
|
+
// modals get a visible close control; callers can still override closeHtml
|
|
633
|
+
// per-open (including to "" for no visible X).
|
|
634
|
+
const DEFAULT_CLOSE_SVG = `<svg viewBox="0 0 134 134" fill="none" xmlns="http://www.w3.org/2000/svg"><path class="micromodal__close-bg" d="M132 132.5 1 1.5h131v131Z" /><path class="micromodal__close-x" fill-rule="evenodd" clip-rule="evenodd" d="M0 0h3v1.5h1.5V3H6v1.5h1.5V6H9v1.5h1.5V9H12v1.5h1.5V12H15v1.5h1.5V15H18v1.5h1.5V18H21v1.5h1.5V21H24v1.5h1.5V24H27v1.5h1.5V27H30v1.5h1.5V30H33v1.5h1.5V33H36v1.5h1.5V36H39v1.5h1.5V39H42v1.5h1.5V42H45v1.5h1.5V45H48v1.5h1.5V48H51v1.5h1.5V51H54v1.5h1.5V54H57v1.5h1.5V57H60v1.5h1.5V60H63v1.5h1.5V63H66v1.5h1.5V66H69v1.5h1.5V69H72v1.5h1.5V72H75v1.5h1.5V75H78v1.5h1.5V78H81v1.5h1.5V81H84v1.5h1.5V84H87v1.5h1.5V87H90v1.5h1.5V90H93v1.5h1.5V93H96v1.5h1.5V96H99v1.5h1.5V99h1.5v1.5h1.5v1.5h1.5v1.5h1.5v1.5h1.5v1.5h1.5v1.5h1.5v1.5h1.5v1.5h1.5v1.5h1.5v1.5h1.5v1.5h1.5v1.5h1.5v1.5h1.5v1.5h1.5v1.5h1.5v1.5h1.5v1.5h1.5v1.5h1.5v1.5h1.5v1.5h1.5v1.5h1.5v3h-3V132H129v-1.5h-1.5V129H126v-1.5h-1.5V126H123v-1.5h-1.5V123H120v-1.5h-1.5V120H117v-1.5h-1.5V117H114v-1.5h-1.5V114H111v-1.5h-1.5V111H108v-1.5h-1.5V108H105v-1.5h-1.5V105H102v-1.5h-1.5V102H99v-1.5h-1.5V99H96v-1.5h-1.5V96H93v-1.5h-1.5V93H90v-1.5h-1.5V90H87v-1.5h-1.5V87H84v-1.5h-1.5V84H81v-1.5h-1.5V81H78v-1.5h-1.5V78H75v-1.5h-1.5V75H72v-1.5h-1.5V72H69v-1.5h-1.5V69H66v-1.5h-1.5V66H63v-1.5h-1.5V63H60v-1.5h-1.5V60H57v-1.5h-1.5V57H54v-1.5h-1.5V54H51v-1.5h-1.5V51H48v-1.5h-1.5V48H45v-1.5h-1.5V45H42v-1.5h-1.5V42H39v-1.5h-1.5V39H36v-1.5h-1.5V36H33v-1.5h-1.5V33H30v-1.5h-1.5V30H27v-1.5h-1.5V27H24v-1.5h-1.5V24H21v-1.5h-1.5V21H18v-1.5h-1.5V18H15v-1.5h-1.5V15H12v-1.5h-1.5V12H9v-1.5H7.5V9H6V7.5H4.5V6H3V4.5H1.5V3H0V0ZM108.8 22h5.2v5.1h-2.6v2.6H109v2.6h-2.6v2.6h-2.6v2.5h-2.6v5.2h2.6V45h2.6v2.6h2.6v2.6h2.5v2.6h2.6V58h-5.1v-2.6h-2.6V53h-2.6v-2.6h-2.6v-2.6h-2.5v-2.6h-5.2v2.6H91v2.6h-2.6v2.6h-2.6v2.5h-2.6V58H78v-5.1h2.6v-2.6H83v-2.6h2.6v-2.6h2.6v-2.5h2.6v-5.2h-2.6V35h-2.6v-2.6h-2.6v-2.6h-2.5v-2.6H78V22h5.2v2.6h2.5V27h2.6v2.6h2.6v2.6h2.5v2.6h5.2v-2.6h2.5v-2.6h2.6v-2.6h2.6v-2.5h2.5V22Z" /></svg>`;
|
|
635
|
+
|
|
636
|
+
const themodal = (() => {
|
|
637
|
+
let html = "";
|
|
638
|
+
let yes = "";
|
|
639
|
+
let no = "";
|
|
640
|
+
let zIndex = "100";
|
|
641
|
+
let closeHtml = DEFAULT_CLOSE_SVG;
|
|
642
|
+
|
|
643
|
+
let enableClickOutsideCloses = true;
|
|
644
|
+
let disableScroll = true;
|
|
645
|
+
let disableFocus = false;
|
|
646
|
+
|
|
647
|
+
let onYes = [];
|
|
648
|
+
let onNo = [];
|
|
649
|
+
let onOpen = [];
|
|
650
|
+
|
|
651
|
+
const themodalMain = {
|
|
652
|
+
isShowing: false,
|
|
653
|
+
open() {
|
|
654
|
+
// This modal's callbacks were registered (onYes pushed / onNo assigned)
|
|
655
|
+
// immediately before open(). Capture them for THIS open() call, then clear
|
|
656
|
+
// the shared arrays so the next modal starts clean. Every handler below
|
|
657
|
+
// fires ONLY these captured callbacks, so stacked modals can never drain
|
|
658
|
+
// each other's promises.
|
|
659
|
+
const myOnYes = onYes;
|
|
660
|
+
const myOnNo = onNo;
|
|
661
|
+
const myOnOpen = onOpen;
|
|
662
|
+
onYes = [];
|
|
663
|
+
onNo = [];
|
|
664
|
+
onOpen = [];
|
|
665
|
+
|
|
666
|
+
// The prompt promise must settle exactly once: resolve on yes, reject on
|
|
667
|
+
// any dismissal (no / close / backdrop / Esc / superseded). dismiss() runs
|
|
668
|
+
// the no-callbacks at most once; the yes path sets `settled` to block it.
|
|
669
|
+
let settled = false;
|
|
670
|
+
const dismiss = () => {
|
|
671
|
+
if (settled) return;
|
|
672
|
+
settled = true;
|
|
673
|
+
myOnNo.forEach(cb => cb());
|
|
674
|
+
};
|
|
675
|
+
|
|
676
|
+
// Singleton: only one modal on screen at a time. If one is still up (or
|
|
677
|
+
// left stale state behind, e.g. a live-sync morph removed its DOM), reject
|
|
678
|
+
// its promise and tear it down before opening the new one.
|
|
679
|
+
if (this.isShowing || document.querySelector('.micromodal-parent')) {
|
|
680
|
+
this._dismiss?.();
|
|
681
|
+
this._cleanupListeners?.();
|
|
682
|
+
document.querySelectorAll('.micromodal-parent').forEach(n => n.remove());
|
|
683
|
+
this.isShowing = false;
|
|
684
|
+
document.body.style.overflow = '';
|
|
685
|
+
}
|
|
686
|
+
|
|
687
|
+
// Expose this modal's dismiss so a later open()/close can settle it.
|
|
688
|
+
this._dismiss = dismiss;
|
|
689
|
+
|
|
690
|
+
document.body.insertAdjacentHTML("afterbegin", "<div save-remove snapshot-remove class='micromodal-parent'>" + modalCss + modalHtml + "</div>");
|
|
691
|
+
|
|
692
|
+
const modalOverlayElem = document.querySelector(".micromodal__overlay");
|
|
693
|
+
const modalContentElem = document.querySelector(".micromodal__content");
|
|
694
|
+
const modalButtonsElem = document.querySelector(".micromodal__buttons");
|
|
695
|
+
const modalYesElem = document.querySelector(".micromodal__yes");
|
|
696
|
+
const modalNoElem = document.querySelector(".micromodal__no");
|
|
697
|
+
const modalCloseElem = document.querySelector(".micromodal__close");
|
|
698
|
+
|
|
699
|
+
modalContentElem.innerHTML = html;
|
|
700
|
+
modalYesElem.innerHTML = yes;
|
|
701
|
+
modalNoElem.innerHTML = no;
|
|
702
|
+
modalOverlayElem.style.zIndex = zIndex;
|
|
703
|
+
modalCloseElem.innerHTML = closeHtml;
|
|
704
|
+
|
|
705
|
+
// MODIFIED so modal doesn't close if mousedown happened inside the modal
|
|
706
|
+
let mousedownOnBackdrop = false;
|
|
707
|
+
|
|
708
|
+
// MODIFIED so modal doesn't close if mousedown happened inside the modal
|
|
709
|
+
function handleMousedown(event) {
|
|
710
|
+
// Check if mousedown started on backdrop (overlay but not container)
|
|
711
|
+
mousedownOnBackdrop = event.target.closest(".micromodal__overlay") &&
|
|
712
|
+
!event.target.closest(".micromodal__container");
|
|
713
|
+
}
|
|
714
|
+
|
|
715
|
+
function handleClick(event) {
|
|
716
|
+
// Just close on no / close-button / backdrop; onClose runs dismiss().
|
|
717
|
+
if (event.target.closest(".micromodal__no") || event.target.closest(".micromodal__close")) {
|
|
718
|
+
MicroModal.close("micromodal");
|
|
719
|
+
// MODIFIED so modal doesn't close if mousedown happened inside the modal
|
|
720
|
+
} else if (enableClickOutsideCloses && mousedownOnBackdrop && !event.target.closest(".micromodal__container") && event.target.closest(".micromodal__overlay")) {
|
|
721
|
+
MicroModal.close("micromodal");
|
|
722
|
+
}
|
|
723
|
+
|
|
724
|
+
// Reset after handling
|
|
725
|
+
mousedownOnBackdrop = false;
|
|
726
|
+
}
|
|
727
|
+
|
|
728
|
+
function handleSubmit(event) {
|
|
729
|
+
if (event.target.closest("#micromodal")) {
|
|
730
|
+
event.preventDefault();
|
|
731
|
+
|
|
732
|
+
// Execute callbacks and check if any return false or throw errors
|
|
733
|
+
let shouldClose = true;
|
|
734
|
+
|
|
735
|
+
for (const cb of myOnYes) {
|
|
736
|
+
try {
|
|
737
|
+
const result = cb();
|
|
738
|
+
// If callback explicitly returns false, don't close
|
|
739
|
+
if (result === false) {
|
|
740
|
+
shouldClose = false;
|
|
741
|
+
break;
|
|
742
|
+
}
|
|
743
|
+
} catch (error) {
|
|
744
|
+
// If callback throws an error, don't close
|
|
745
|
+
shouldClose = false;
|
|
746
|
+
// Could optionally bubble the error up or handle it here
|
|
747
|
+
break;
|
|
748
|
+
}
|
|
749
|
+
}
|
|
750
|
+
|
|
751
|
+
// Only close if all callbacks succeeded. The yes callbacks already
|
|
752
|
+
// scheduled their resolve, so mark settled to stop onClose rejecting.
|
|
753
|
+
if (shouldClose) {
|
|
754
|
+
settled = true;
|
|
755
|
+
MicroModal.close("micromodal");
|
|
756
|
+
}
|
|
757
|
+
}
|
|
758
|
+
}
|
|
759
|
+
|
|
760
|
+
// MODIFIED so modal doesn't close if mousedown happened inside the modal
|
|
761
|
+
document.addEventListener("mousedown", handleMousedown);
|
|
762
|
+
document.addEventListener("click", handleClick);
|
|
763
|
+
document.addEventListener("submit", handleSubmit);
|
|
764
|
+
|
|
765
|
+
// Store cleanup so stale listeners can be removed if DOM is yanked externally
|
|
766
|
+
this._cleanupListeners = () => {
|
|
767
|
+
document.removeEventListener("mousedown", handleMousedown);
|
|
768
|
+
document.removeEventListener("click", handleClick);
|
|
769
|
+
document.removeEventListener("submit", handleSubmit);
|
|
770
|
+
};
|
|
771
|
+
|
|
772
|
+
function setButtonsVisibility () {
|
|
773
|
+
modalButtonsElem.classList.toggle("micromodal__hide", !yes && !no);
|
|
774
|
+
modalYesElem.classList.toggle("micromodal__hide", !yes);
|
|
775
|
+
modalNoElem.classList.toggle("micromodal__hide", !no);
|
|
776
|
+
}
|
|
777
|
+
|
|
778
|
+
setButtonsVisibility();
|
|
779
|
+
|
|
780
|
+
MicroModal.show("micromodal", {
|
|
781
|
+
disableScroll,
|
|
782
|
+
disableFocus: true, // we use our own
|
|
783
|
+
// reset everything on close
|
|
784
|
+
onClose: modal => {
|
|
785
|
+
// Settle the promise as rejected if it closed without a yes
|
|
786
|
+
// (no / close / backdrop / Esc). No-op once already resolved.
|
|
787
|
+
dismiss();
|
|
788
|
+
|
|
789
|
+
document.querySelector(".micromodal-parent")?.remove();
|
|
790
|
+
|
|
791
|
+
html = "";
|
|
792
|
+
yes = "";
|
|
793
|
+
no = "";
|
|
794
|
+
zIndex = "100";
|
|
795
|
+
closeHtml = DEFAULT_CLOSE_SVG;
|
|
796
|
+
|
|
797
|
+
// reset to defaults
|
|
798
|
+
enableClickOutsideCloses = true;
|
|
799
|
+
disableScroll = true;
|
|
800
|
+
disableFocus = false;
|
|
801
|
+
|
|
802
|
+
// onYes/onNo/onOpen are owned by open() now (captured into this call's
|
|
803
|
+
// locals and cleared there), so they are deliberately not reset here:
|
|
804
|
+
// a late onClose must not wipe a newer modal's freshly-registered cbs.
|
|
805
|
+
|
|
806
|
+
this.isShowing = false;
|
|
807
|
+
|
|
808
|
+
// MODIFIED so modal doesn't close if mousedown happened inside the modal
|
|
809
|
+
document.removeEventListener("mousedown", handleMousedown);
|
|
810
|
+
document.removeEventListener("click", handleClick);
|
|
811
|
+
document.removeEventListener("submit", handleSubmit);
|
|
812
|
+
this._cleanupListeners = null;
|
|
813
|
+
this._dismiss = null;
|
|
814
|
+
}
|
|
815
|
+
});
|
|
816
|
+
|
|
817
|
+
this.isShowing = true;
|
|
818
|
+
|
|
819
|
+
myOnOpen.forEach(cb => cb());
|
|
820
|
+
|
|
821
|
+
if (!disableFocus) {
|
|
822
|
+
let firstInput = modalOverlayElem.querySelector(".micromodal__content :is(input,textarea,button):not(.micromodal__hide), .micromodal__buttons :is(input,textarea,button):not(.micromodal__hide)");
|
|
823
|
+
firstInput?.focus();
|
|
824
|
+
firstInput?.setSelectionRange?.(-1, -1);
|
|
825
|
+
}
|
|
826
|
+
},
|
|
827
|
+
close() {
|
|
828
|
+
// onClose runs the dismiss/reject path; just trigger the close.
|
|
829
|
+
MicroModal.close("micromodal");
|
|
830
|
+
},
|
|
831
|
+
get html() {
|
|
832
|
+
return html;
|
|
833
|
+
},
|
|
834
|
+
set html(newVal) {
|
|
835
|
+
html = newVal;
|
|
836
|
+
},
|
|
837
|
+
get closeHtml() {
|
|
838
|
+
return closeHtml;
|
|
839
|
+
},
|
|
840
|
+
set closeHtml(newVal) {
|
|
841
|
+
closeHtml = newVal;
|
|
842
|
+
},
|
|
843
|
+
get yes() {
|
|
844
|
+
return yes;
|
|
845
|
+
},
|
|
846
|
+
set yes(newVal) {
|
|
847
|
+
yes = newVal;
|
|
848
|
+
},
|
|
849
|
+
get no() {
|
|
850
|
+
return no;
|
|
851
|
+
},
|
|
852
|
+
set no(newVal) {
|
|
853
|
+
no = newVal;
|
|
854
|
+
},
|
|
855
|
+
get zIndex() {
|
|
856
|
+
return zIndex;
|
|
857
|
+
},
|
|
858
|
+
set zIndex(newVal) {
|
|
859
|
+
zIndex = newVal;
|
|
860
|
+
},
|
|
861
|
+
get disableFocus() {
|
|
862
|
+
return disableFocus;
|
|
863
|
+
},
|
|
864
|
+
set disableFocus(newVal) {
|
|
865
|
+
disableFocus = newVal;
|
|
866
|
+
},
|
|
867
|
+
get disableScroll() {
|
|
868
|
+
return disableScroll;
|
|
869
|
+
},
|
|
870
|
+
set disableScroll(newVal) {
|
|
871
|
+
disableScroll = newVal;
|
|
872
|
+
},
|
|
873
|
+
|
|
874
|
+
// Two registration forms are in use across callers: themodal.onYes(cb)
|
|
875
|
+
// (call → push, supports multiple) and themodal.onNo = cb (assign → replace).
|
|
876
|
+
// Expose both via get (returns a push fn) + set (replaces with one cb), so
|
|
877
|
+
// the assign form registers a callback instead of clobbering the method.
|
|
878
|
+
get onYes() { return (cb) => { onYes.push(cb); }; },
|
|
879
|
+
set onYes(cb) { onYes = [cb]; },
|
|
880
|
+
get onNo() { return (cb) => { onNo.push(cb); }; },
|
|
881
|
+
set onNo(cb) { onNo = [cb]; },
|
|
882
|
+
get onOpen() { return (cb) => { onOpen.push(cb); }; },
|
|
883
|
+
set onOpen(cb) { onOpen = [cb]; },
|
|
884
|
+
};
|
|
885
|
+
|
|
886
|
+
return themodalMain;
|
|
887
|
+
})();
|
|
888
|
+
|
|
889
|
+
// Auto-export to window unless suppressed by loader
|
|
890
|
+
if (!window.__hyperclayNoAutoExport) {
|
|
891
|
+
window.themodal = themodal;
|
|
892
|
+
window.hyperclay = window.hyperclay || {};
|
|
893
|
+
window.hyperclay.themodal = themodal;
|
|
894
|
+
window.h = window.hyperclay;
|
|
895
|
+
}
|
|
896
|
+
|
|
897
|
+
export default themodal;
|