@lo-tek/interfaces 0.0.0 → 0.38.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/CHANGELOG.md +3389 -0
- package/LICENSE +21 -0
- package/README.md +129 -1
- package/agent/astro.md +400 -0
- package/agent/bundles.md +429 -0
- package/agent/datastar.md +409 -0
- package/agent/html.md +388 -0
- package/agent/react.md +440 -0
- package/agent/templates.md +472 -0
- package/core/lotek-core.wasm +0 -0
- package/core/lotek.wasm +0 -0
- package/dist/cli.d.ts +12 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +14 -0
- package/dist/cli.js.map +1 -0
- package/dist/components/css/accordion/accordion.d.ts +37 -0
- package/dist/components/css/accordion/accordion.d.ts.map +1 -0
- package/dist/components/css/accordion/accordion.js +31 -0
- package/dist/components/css/accordion/accordion.js.map +1 -0
- package/dist/components/css/alert/alert.d.ts +35 -0
- package/dist/components/css/alert/alert.d.ts.map +1 -0
- package/dist/components/css/alert/alert.js +29 -0
- package/dist/components/css/alert/alert.js.map +1 -0
- package/dist/components/css/avatar/avatar.d.ts +40 -0
- package/dist/components/css/avatar/avatar.d.ts.map +1 -0
- package/dist/components/css/avatar/avatar.js +30 -0
- package/dist/components/css/avatar/avatar.js.map +1 -0
- package/dist/components/css/badge/badge.d.ts +24 -0
- package/dist/components/css/badge/badge.d.ts.map +1 -0
- package/dist/components/css/badge/badge.js +24 -0
- package/dist/components/css/badge/badge.js.map +1 -0
- package/dist/components/css/breadcrumbs/breadcrumbs.d.ts +26 -0
- package/dist/components/css/breadcrumbs/breadcrumbs.d.ts.map +1 -0
- package/dist/components/css/breadcrumbs/breadcrumbs.js +24 -0
- package/dist/components/css/breadcrumbs/breadcrumbs.js.map +1 -0
- package/dist/components/css/button/button.d.ts +26 -0
- package/dist/components/css/button/button.d.ts.map +1 -0
- package/dist/components/css/button/button.js +25 -0
- package/dist/components/css/button/button.js.map +1 -0
- package/dist/components/css/card/card.d.ts +36 -0
- package/dist/components/css/card/card.d.ts.map +1 -0
- package/dist/components/css/card/card.js +28 -0
- package/dist/components/css/card/card.js.map +1 -0
- package/dist/components/css/checkbox/checkbox.d.ts +32 -0
- package/dist/components/css/checkbox/checkbox.d.ts.map +1 -0
- package/dist/components/css/checkbox/checkbox.js +27 -0
- package/dist/components/css/checkbox/checkbox.js.map +1 -0
- package/dist/components/css/divider/divider.d.ts +29 -0
- package/dist/components/css/divider/divider.d.ts.map +1 -0
- package/dist/components/css/divider/divider.js +23 -0
- package/dist/components/css/divider/divider.js.map +1 -0
- package/dist/components/css/error-text/error-text.d.ts +24 -0
- package/dist/components/css/error-text/error-text.d.ts.map +1 -0
- package/dist/components/css/error-text/error-text.js +18 -0
- package/dist/components/css/error-text/error-text.js.map +1 -0
- package/dist/components/css/fieldset/fieldset.d.ts +55 -0
- package/dist/components/css/fieldset/fieldset.d.ts.map +1 -0
- package/dist/components/css/fieldset/fieldset.js +39 -0
- package/dist/components/css/fieldset/fieldset.js.map +1 -0
- package/dist/components/css/file-upload/file-upload.d.ts +41 -0
- package/dist/components/css/file-upload/file-upload.d.ts.map +1 -0
- package/dist/components/css/file-upload/file-upload.js +32 -0
- package/dist/components/css/file-upload/file-upload.js.map +1 -0
- package/dist/components/css/heading/heading.d.ts +29 -0
- package/dist/components/css/heading/heading.d.ts.map +1 -0
- package/dist/components/css/heading/heading.js +23 -0
- package/dist/components/css/heading/heading.js.map +1 -0
- package/dist/components/css/help-text/help-text.d.ts +24 -0
- package/dist/components/css/help-text/help-text.d.ts.map +1 -0
- package/dist/components/css/help-text/help-text.js +23 -0
- package/dist/components/css/help-text/help-text.js.map +1 -0
- package/dist/components/css/icon/icon.d.ts +34 -0
- package/dist/components/css/icon/icon.d.ts.map +1 -0
- package/dist/components/css/icon/icon.js +25 -0
- package/dist/components/css/icon/icon.js.map +1 -0
- package/dist/components/css/input/input.d.ts +40 -0
- package/dist/components/css/input/input.d.ts.map +1 -0
- package/dist/components/css/input/input.js +45 -0
- package/dist/components/css/input/input.js.map +1 -0
- package/dist/components/css/label/label.d.ts +33 -0
- package/dist/components/css/label/label.d.ts.map +1 -0
- package/dist/components/css/label/label.js +23 -0
- package/dist/components/css/label/label.js.map +1 -0
- package/dist/components/css/link/link.d.ts +28 -0
- package/dist/components/css/link/link.d.ts.map +1 -0
- package/dist/components/css/link/link.js +20 -0
- package/dist/components/css/link/link.js.map +1 -0
- package/dist/components/css/list/list.d.ts +31 -0
- package/dist/components/css/list/list.d.ts.map +1 -0
- package/dist/components/css/list/list.js +25 -0
- package/dist/components/css/list/list.js.map +1 -0
- package/dist/components/css/pagination/pagination.d.ts +27 -0
- package/dist/components/css/pagination/pagination.d.ts.map +1 -0
- package/dist/components/css/pagination/pagination.js +25 -0
- package/dist/components/css/pagination/pagination.js.map +1 -0
- package/dist/components/css/paragraph/paragraph.d.ts +36 -0
- package/dist/components/css/paragraph/paragraph.d.ts.map +1 -0
- package/dist/components/css/paragraph/paragraph.js +26 -0
- package/dist/components/css/paragraph/paragraph.js.map +1 -0
- package/dist/components/css/progress/progress.d.ts +53 -0
- package/dist/components/css/progress/progress.d.ts.map +1 -0
- package/dist/components/css/progress/progress.js +38 -0
- package/dist/components/css/progress/progress.js.map +1 -0
- package/dist/components/css/radio/radio.d.ts +32 -0
- package/dist/components/css/radio/radio.d.ts.map +1 -0
- package/dist/components/css/radio/radio.js +27 -0
- package/dist/components/css/radio/radio.js.map +1 -0
- package/dist/components/css/search/search.d.ts +34 -0
- package/dist/components/css/search/search.d.ts.map +1 -0
- package/dist/components/css/search/search.js +32 -0
- package/dist/components/css/search/search.js.map +1 -0
- package/dist/components/css/select/select.d.ts +40 -0
- package/dist/components/css/select/select.d.ts.map +1 -0
- package/dist/components/css/select/select.js +31 -0
- package/dist/components/css/select/select.js.map +1 -0
- package/dist/components/css/shared.d.ts +90 -0
- package/dist/components/css/shared.d.ts.map +1 -0
- package/dist/components/css/shared.js +167 -0
- package/dist/components/css/shared.js.map +1 -0
- package/dist/components/css/skeleton/skeleton.d.ts +29 -0
- package/dist/components/css/skeleton/skeleton.d.ts.map +1 -0
- package/dist/components/css/skeleton/skeleton.js +23 -0
- package/dist/components/css/skeleton/skeleton.js.map +1 -0
- package/dist/components/css/skip-link/skip-link.d.ts +18 -0
- package/dist/components/css/skip-link/skip-link.d.ts.map +1 -0
- package/dist/components/css/skip-link/skip-link.js +16 -0
- package/dist/components/css/skip-link/skip-link.js.map +1 -0
- package/dist/components/css/spinner/spinner.d.ts +33 -0
- package/dist/components/css/spinner/spinner.d.ts.map +1 -0
- package/dist/components/css/spinner/spinner.js +25 -0
- package/dist/components/css/spinner/spinner.js.map +1 -0
- package/dist/components/css/sr-only/sr-only.d.ts +17 -0
- package/dist/components/css/sr-only/sr-only.d.ts.map +1 -0
- package/dist/components/css/sr-only/sr-only.js +15 -0
- package/dist/components/css/sr-only/sr-only.js.map +1 -0
- package/dist/components/css/switch/switch.d.ts +37 -0
- package/dist/components/css/switch/switch.d.ts.map +1 -0
- package/dist/components/css/switch/switch.js +29 -0
- package/dist/components/css/switch/switch.js.map +1 -0
- package/dist/components/css/table/table.d.ts +76 -0
- package/dist/components/css/table/table.d.ts.map +1 -0
- package/dist/components/css/table/table.js +59 -0
- package/dist/components/css/table/table.js.map +1 -0
- package/dist/components/css/tag/tag.d.ts +35 -0
- package/dist/components/css/tag/tag.d.ts.map +1 -0
- package/dist/components/css/tag/tag.js +27 -0
- package/dist/components/css/tag/tag.js.map +1 -0
- package/dist/components/css/textarea/textarea.d.ts +23 -0
- package/dist/components/css/textarea/textarea.d.ts.map +1 -0
- package/dist/components/css/textarea/textarea.js +18 -0
- package/dist/components/css/textarea/textarea.js.map +1 -0
- package/dist/components/css/toggle-group/toggle-group.d.ts +31 -0
- package/dist/components/css/toggle-group/toggle-group.d.ts.map +1 -0
- package/dist/components/css/toggle-group/toggle-group.js +29 -0
- package/dist/components/css/toggle-group/toggle-group.js.map +1 -0
- package/dist/components/css/tooltip/tooltip.d.ts +31 -0
- package/dist/components/css/tooltip/tooltip.d.ts.map +1 -0
- package/dist/components/css/tooltip/tooltip.js +29 -0
- package/dist/components/css/tooltip/tooltip.js.map +1 -0
- package/dist/components/default-texts.d.ts +41 -0
- package/dist/components/default-texts.d.ts.map +1 -0
- package/dist/components/default-texts.js +41 -0
- package/dist/components/default-texts.js.map +1 -0
- package/dist/components/events.d.ts +77 -0
- package/dist/components/events.d.ts.map +1 -0
- package/dist/components/events.js +3 -0
- package/dist/components/events.js.map +1 -0
- package/dist/components/frame/dialog/dialog.d.ts +122 -0
- package/dist/components/frame/dialog/dialog.d.ts.map +1 -0
- package/dist/components/frame/dialog/dialog.js +112 -0
- package/dist/components/frame/dialog/dialog.js.map +1 -0
- package/dist/components/frame/dialog/lt-dialog.d.ts +104 -0
- package/dist/components/frame/dialog/lt-dialog.d.ts.map +1 -0
- package/dist/components/frame/dialog/lt-dialog.js +434 -0
- package/dist/components/frame/dialog/lt-dialog.js.map +1 -0
- package/dist/components/frame/error-summary/error-summary.d.ts +53 -0
- package/dist/components/frame/error-summary/error-summary.d.ts.map +1 -0
- package/dist/components/frame/error-summary/error-summary.js +54 -0
- package/dist/components/frame/error-summary/error-summary.js.map +1 -0
- package/dist/components/frame/error-summary/lt-error-summary.d.ts +93 -0
- package/dist/components/frame/error-summary/lt-error-summary.d.ts.map +1 -0
- package/dist/components/frame/error-summary/lt-error-summary.js +408 -0
- package/dist/components/frame/error-summary/lt-error-summary.js.map +1 -0
- package/dist/components/frame/field/field-core.d.ts +92 -0
- package/dist/components/frame/field/field-core.d.ts.map +1 -0
- package/dist/components/frame/field/field-core.js +63 -0
- package/dist/components/frame/field/field-core.js.map +1 -0
- package/dist/components/frame/field/lt-field.d.ts +173 -0
- package/dist/components/frame/field/lt-field.d.ts.map +1 -0
- package/dist/components/frame/field/lt-field.js +600 -0
- package/dist/components/frame/field/lt-field.js.map +1 -0
- package/dist/components/frame/popover/lt-popover.d.ts +136 -0
- package/dist/components/frame/popover/lt-popover.d.ts.map +1 -0
- package/dist/components/frame/popover/lt-popover.js +520 -0
- package/dist/components/frame/popover/lt-popover.js.map +1 -0
- package/dist/components/frame/popover/popover.d.ts +49 -0
- package/dist/components/frame/popover/popover.d.ts.map +1 -0
- package/dist/components/frame/popover/popover.js +64 -0
- package/dist/components/frame/popover/popover.js.map +1 -0
- package/dist/components/frame/session-timeout/lt-session-timeout.d.ts +198 -0
- package/dist/components/frame/session-timeout/lt-session-timeout.d.ts.map +1 -0
- package/dist/components/frame/session-timeout/lt-session-timeout.js +610 -0
- package/dist/components/frame/session-timeout/lt-session-timeout.js.map +1 -0
- package/dist/components/frame/session-timeout/session-timeout.d.ts +113 -0
- package/dist/components/frame/session-timeout/session-timeout.d.ts.map +1 -0
- package/dist/components/frame/session-timeout/session-timeout.js +101 -0
- package/dist/components/frame/session-timeout/session-timeout.js.map +1 -0
- package/dist/components/frame/suggestion/lt-suggestion.d.ts +367 -0
- package/dist/components/frame/suggestion/lt-suggestion.d.ts.map +1 -0
- package/dist/components/frame/suggestion/lt-suggestion.js +1171 -0
- package/dist/components/frame/suggestion/lt-suggestion.js.map +1 -0
- package/dist/components/frame/suggestion/suggestion.d.ts +143 -0
- package/dist/components/frame/suggestion/suggestion.d.ts.map +1 -0
- package/dist/components/frame/suggestion/suggestion.js +127 -0
- package/dist/components/frame/suggestion/suggestion.js.map +1 -0
- package/dist/components/frame/tabs/lt-tabs.d.ts +426 -0
- package/dist/components/frame/tabs/lt-tabs.d.ts.map +1 -0
- package/dist/components/frame/tabs/lt-tabs.js +1265 -0
- package/dist/components/frame/tabs/lt-tabs.js.map +1 -0
- package/dist/components/frame/tabs/tabs.d.ts +112 -0
- package/dist/components/frame/tabs/tabs.d.ts.map +1 -0
- package/dist/components/frame/tabs/tabs.js +107 -0
- package/dist/components/frame/tabs/tabs.js.map +1 -0
- package/dist/components/host-element.d.ts +184 -0
- package/dist/components/host-element.d.ts.map +1 -0
- package/dist/components/host-element.js +440 -0
- package/dist/components/host-element.js.map +1 -0
- package/dist/components/standalone/connection-status/connection-status.d.ts +32 -0
- package/dist/components/standalone/connection-status/connection-status.d.ts.map +1 -0
- package/dist/components/standalone/connection-status/connection-status.js +26 -0
- package/dist/components/standalone/connection-status/connection-status.js.map +1 -0
- package/dist/components/standalone/connection-status/lt-connection-status.d.ts +86 -0
- package/dist/components/standalone/connection-status/lt-connection-status.d.ts.map +1 -0
- package/dist/components/standalone/connection-status/lt-connection-status.js +240 -0
- package/dist/components/standalone/connection-status/lt-connection-status.js.map +1 -0
- package/dist/components/standalone/toast/lt-toast.d.ts +109 -0
- package/dist/components/standalone/toast/lt-toast.d.ts.map +1 -0
- package/dist/components/standalone/toast/lt-toast.js +256 -0
- package/dist/components/standalone/toast/lt-toast.js.map +1 -0
- package/dist/components/standalone/toast/toast.d.ts +52 -0
- package/dist/components/standalone/toast/toast.d.ts.map +1 -0
- package/dist/components/standalone/toast/toast.js +42 -0
- package/dist/components/standalone/toast/toast.js.map +1 -0
- package/dist/diagnostics/core.d.ts +171 -0
- package/dist/diagnostics/core.d.ts.map +1 -0
- package/dist/diagnostics/core.js +84 -0
- package/dist/diagnostics/core.js.map +1 -0
- package/dist/diagnostics/default-core.d.ts +10 -0
- package/dist/diagnostics/default-core.d.ts.map +1 -0
- package/dist/diagnostics/default-core.js +72 -0
- package/dist/diagnostics/default-core.js.map +1 -0
- package/dist/diagnostics/index.d.ts +84 -0
- package/dist/diagnostics/index.d.ts.map +1 -0
- package/dist/diagnostics/index.js +106 -0
- package/dist/diagnostics/index.js.map +1 -0
- package/dist/dom.d.ts +55 -0
- package/dist/dom.d.ts.map +1 -0
- package/dist/dom.js +162 -0
- package/dist/dom.js.map +1 -0
- package/dist/index.d.ts +97 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +58 -0
- package/dist/index.js.map +1 -0
- package/dist/jsx/react.d.ts +180 -0
- package/dist/jsx/react.d.ts.map +1 -0
- package/dist/jsx/react.js +2 -0
- package/dist/jsx/react.js.map +1 -0
- package/dist/lotek.css +3617 -0
- package/dist/lt.d.ts +325 -0
- package/dist/lt.d.ts.map +1 -0
- package/dist/lt.js +183 -0
- package/dist/lt.js.map +1 -0
- package/dist/react.d.ts +494 -0
- package/dist/react.d.ts.map +1 -0
- package/dist/react.js +296 -0
- package/dist/react.js.map +1 -0
- package/dist/register.d.ts +17 -0
- package/dist/register.d.ts.map +1 -0
- package/dist/register.js +35 -0
- package/dist/register.js.map +1 -0
- package/dist/tokens/color.d.ts +43 -0
- package/dist/tokens/color.d.ts.map +1 -0
- package/dist/tokens/color.js +123 -0
- package/dist/tokens/color.js.map +1 -0
- package/dist/tokens/contract.d.ts +18 -0
- package/dist/tokens/contract.d.ts.map +1 -0
- package/dist/tokens/contract.js +18 -0
- package/dist/tokens/contract.js.map +1 -0
- package/dist/tokens/matrix-cells.d.ts +30 -0
- package/dist/tokens/matrix-cells.d.ts.map +1 -0
- package/dist/tokens/matrix-cells.js +273 -0
- package/dist/tokens/matrix-cells.js.map +1 -0
- package/dist/tokens/matrix.d.ts +18 -0
- package/dist/tokens/matrix.d.ts.map +1 -0
- package/dist/tokens/matrix.js +21 -0
- package/dist/tokens/matrix.js.map +1 -0
- package/dist/tokens/theme-check.d.ts +42 -0
- package/dist/tokens/theme-check.d.ts.map +1 -0
- package/dist/tokens/theme-check.js +10 -0
- package/dist/tokens/theme-check.js.map +1 -0
- package/dist/tokens/theme.d.ts +94 -0
- package/dist/tokens/theme.d.ts.map +1 -0
- package/dist/tokens/theme.js +14 -0
- package/dist/tokens/theme.js.map +1 -0
- package/dist/tokens/tokens.d.ts +122 -0
- package/dist/tokens/tokens.d.ts.map +1 -0
- package/dist/tokens/tokens.js +158 -0
- package/dist/tokens/tokens.js.map +1 -0
- package/dist/vocabulary/classes.d.ts +3 -0
- package/dist/vocabulary/classes.d.ts.map +1 -0
- package/dist/vocabulary/classes.js +1354 -0
- package/dist/vocabulary/classes.js.map +1 -0
- package/dist/vocabulary/elements.d.ts +3 -0
- package/dist/vocabulary/elements.d.ts.map +1 -0
- package/dist/vocabulary/elements.js +490 -0
- package/dist/vocabulary/elements.js.map +1 -0
- package/dist/vocabulary/types.d.ts +229 -0
- package/dist/vocabulary/types.d.ts.map +1 -0
- package/dist/vocabulary/types.js +11 -0
- package/dist/vocabulary/types.js.map +1 -0
- package/dist/wasi-host.d.ts +24 -0
- package/dist/wasi-host.d.ts.map +1 -0
- package/dist/wasi-host.js +140 -0
- package/dist/wasi-host.js.map +1 -0
- package/live-templates.xml +63 -0
- package/manifest/files.json +373 -0
- package/manifest/manifest.json +5090 -0
- package/manifest/manifest.schema.json +586 -0
- package/package.json +399 -5
- package/src/cli.ts +21 -0
- package/src/components/css/accordion/accordion.css +102 -0
- package/src/components/css/accordion/accordion.ts +50 -0
- package/src/components/css/alert/alert.css +53 -0
- package/src/components/css/alert/alert.ts +48 -0
- package/src/components/css/avatar/avatar.css +96 -0
- package/src/components/css/avatar/avatar.ts +57 -0
- package/src/components/css/badge/badge.css +42 -0
- package/src/components/css/badge/badge.ts +43 -0
- package/src/components/css/breadcrumbs/breadcrumbs.css +62 -0
- package/src/components/css/breadcrumbs/breadcrumbs.ts +30 -0
- package/src/components/css/button/button.css +128 -0
- package/src/components/css/button/button.ts +44 -0
- package/src/components/css/card/card.css +65 -0
- package/src/components/css/card/card.ts +50 -0
- package/src/components/css/checkbox/checkbox.css +114 -0
- package/src/components/css/checkbox/checkbox.ts +50 -0
- package/src/components/css/divider/divider.css +38 -0
- package/src/components/css/divider/divider.ts +42 -0
- package/src/components/css/error-text/error-text.css +21 -0
- package/src/components/css/error-text/error-text.ts +37 -0
- package/src/components/css/fieldset/fieldset.css +72 -0
- package/src/components/css/fieldset/fieldset.ts +87 -0
- package/src/components/css/file-upload/file-upload.css +102 -0
- package/src/components/css/file-upload/file-upload.ts +65 -0
- package/src/components/css/heading/heading.css +33 -0
- package/src/components/css/heading/heading.ts +42 -0
- package/src/components/css/help-text/help-text.css +24 -0
- package/src/components/css/help-text/help-text.ts +42 -0
- package/src/components/css/icon/icon.css +20 -0
- package/src/components/css/icon/icon.ts +44 -0
- package/src/components/css/input/input.css +145 -0
- package/src/components/css/input/input.ts +77 -0
- package/src/components/css/label/label.css +42 -0
- package/src/components/css/label/label.ts +51 -0
- package/src/components/css/link/link.css +38 -0
- package/src/components/css/link/link.ts +38 -0
- package/src/components/css/list/list.css +53 -0
- package/src/components/css/list/list.ts +44 -0
- package/src/components/css/pagination/pagination.css +95 -0
- package/src/components/css/pagination/pagination.ts +33 -0
- package/src/components/css/paragraph/paragraph.css +31 -0
- package/src/components/css/paragraph/paragraph.ts +53 -0
- package/src/components/css/progress/progress.css +161 -0
- package/src/components/css/progress/progress.ts +78 -0
- package/src/components/css/radio/radio.css +94 -0
- package/src/components/css/radio/radio.ts +50 -0
- package/src/components/css/search/search.css +50 -0
- package/src/components/css/search/search.ts +56 -0
- package/src/components/css/select/select.css +321 -0
- package/src/components/css/select/select.ts +63 -0
- package/src/components/css/shared.ts +199 -0
- package/src/components/css/skeleton/skeleton.css +62 -0
- package/src/components/css/skeleton/skeleton.ts +43 -0
- package/src/components/css/skip-link/skip-link.css +41 -0
- package/src/components/css/skip-link/skip-link.ts +22 -0
- package/src/components/css/spinner/spinner.css +48 -0
- package/src/components/css/spinner/spinner.ts +48 -0
- package/src/components/css/sr-only/sr-only.css +16 -0
- package/src/components/css/sr-only/sr-only.ts +21 -0
- package/src/components/css/switch/switch.css +105 -0
- package/src/components/css/switch/switch.ts +50 -0
- package/src/components/css/table/table.css +159 -0
- package/src/components/css/table/table.ts +107 -0
- package/src/components/css/tag/tag.css +58 -0
- package/src/components/css/tag/tag.ts +49 -0
- package/src/components/css/textarea/textarea.css +83 -0
- package/src/components/css/textarea/textarea.ts +40 -0
- package/src/components/css/toggle-group/toggle-group.css +92 -0
- package/src/components/css/toggle-group/toggle-group.ts +37 -0
- package/src/components/css/tooltip/tooltip.css +89 -0
- package/src/components/css/tooltip/tooltip.ts +37 -0
- package/src/components/default-texts.ts +41 -0
- package/src/components/events.ts +68 -0
- package/src/components/frame/dialog/dialog.css +306 -0
- package/src/components/frame/dialog/dialog.ts +166 -0
- package/src/components/frame/dialog/lt-dialog.ts +513 -0
- package/src/components/frame/error-summary/error-summary.css +47 -0
- package/src/components/frame/error-summary/error-summary.ts +90 -0
- package/src/components/frame/error-summary/lt-error-summary.ts +458 -0
- package/src/components/frame/field/field-core.ts +152 -0
- package/src/components/frame/field/field.css +17 -0
- package/src/components/frame/field/lt-field.ts +790 -0
- package/src/components/frame/popover/lt-popover.ts +586 -0
- package/src/components/frame/popover/popover.css +50 -0
- package/src/components/frame/popover/popover.ts +102 -0
- package/src/components/frame/session-timeout/lt-session-timeout.ts +715 -0
- package/src/components/frame/session-timeout/session-timeout.css +50 -0
- package/src/components/frame/session-timeout/session-timeout.ts +156 -0
- package/src/components/frame/suggestion/lt-suggestion.ts +1379 -0
- package/src/components/frame/suggestion/suggestion.css +132 -0
- package/src/components/frame/suggestion/suggestion.ts +172 -0
- package/src/components/frame/tabs/lt-tabs.ts +1395 -0
- package/src/components/frame/tabs/tabs.css +128 -0
- package/src/components/frame/tabs/tabs.ts +188 -0
- package/src/components/host-element.ts +493 -0
- package/src/components/standalone/connection-status/connection-status.css +41 -0
- package/src/components/standalone/connection-status/connection-status.ts +47 -0
- package/src/components/standalone/connection-status/lt-connection-status.ts +268 -0
- package/src/components/standalone/toast/lt-toast.ts +300 -0
- package/src/components/standalone/toast/toast.css +78 -0
- package/src/components/standalone/toast/toast.ts +70 -0
- package/src/diagnostics/core.ts +227 -0
- package/src/diagnostics/default-core.ts +81 -0
- package/src/diagnostics/index.ts +150 -0
- package/src/dom.ts +185 -0
- package/src/index.ts +218 -0
- package/src/jsx/react.ts +212 -0
- package/src/lt.ts +192 -0
- package/src/react.ts +411 -0
- package/src/register.ts +43 -0
- package/src/tailwind/tailwind.css +169 -0
- package/src/tokens/boundary.css +104 -0
- package/src/tokens/color-contract.json +231 -0
- package/src/tokens/color.ts +150 -0
- package/src/tokens/contract.ts +24 -0
- package/src/tokens/matrix-cells.ts +375 -0
- package/src/tokens/matrix.ts +32 -0
- package/src/tokens/theme-check.ts +51 -0
- package/src/tokens/theme.ts +104 -0
- package/src/tokens/tokens.css +569 -0
- package/src/tokens/tokens.ts +223 -0
- package/src/vocabulary/classes.ts +1356 -0
- package/src/vocabulary/elements.ts +492 -0
- package/src/vocabulary/types.ts +228 -0
- package/src/wasi-host.ts +155 -0
- package/web-types.json +800 -0
|
@@ -0,0 +1,306 @@
|
|
|
1
|
+
@layer lotek {
|
|
2
|
+
/* The host is not a box. Without this it is `inline` like every other
|
|
3
|
+
web component, and an empty `<lt-dialog>` in a layout with
|
|
4
|
+
`gap` moves its neighbour. */
|
|
5
|
+
lt-dialog {
|
|
6
|
+
display: contents;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.lt-dialog {
|
|
10
|
+
box-sizing: border-box;
|
|
11
|
+
/*
|
|
12
|
+
* `100%` and not only `100vw`: a real dialog in the top layer sizes itself
|
|
13
|
+
* against the viewport, but in a narrower box, as in the documentation,
|
|
14
|
+
* it stuck out. `min()` takes the smallest of the three.
|
|
15
|
+
*/
|
|
16
|
+
inline-size: var(
|
|
17
|
+
--lt-dialog-width,
|
|
18
|
+
min(32rem, 100%, calc(100vw - var(--lt-spacing-8)))
|
|
19
|
+
);
|
|
20
|
+
max-block-size: calc(100vh - var(--lt-spacing-16));
|
|
21
|
+
padding: var(--lt-dialog-padding, var(--lt-spacing-5));
|
|
22
|
+
font-family: inherit;
|
|
23
|
+
font-size: var(--lt-font-size-m);
|
|
24
|
+
line-height: var(--lt-line-height-default);
|
|
25
|
+
color: var(--lt-color-neutral-text-strong);
|
|
26
|
+
background: var(--lt-color-neutral-canvas);
|
|
27
|
+
border: 1px solid var(--lt-color-neutral-border-subtle);
|
|
28
|
+
border-radius: var(--lt-dialog-radius, var(--lt-spacing-2));
|
|
29
|
+
box-shadow: var(--lt-shadow-overlay);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/*
|
|
33
|
+
* A column, but only when the body is where it should be.
|
|
34
|
+
*
|
|
35
|
+
* `.lt-dialog__body` has had `overflow-y: auto` since the component arrived,
|
|
36
|
+
* without being able to scroll: the dialog is a block, so the body's height
|
|
37
|
+
* is set by its content and is never clipped. What scrolled was the dialog
|
|
38
|
+
* itself, and only when it was modal, so the heading and the button row
|
|
39
|
+
* disappeared from view along with the text.
|
|
40
|
+
*
|
|
41
|
+
* The child combinator is not decoration. The column works only when the
|
|
42
|
+
* body is a direct child, and it also changes how everything else is laid
|
|
43
|
+
* out: margins between paragraphs stop collapsing, and text and buttons
|
|
44
|
+
* placed directly in the dialog become rows of their own in full width. If
|
|
45
|
+
* the body is wrapped in something, or does not exist, the block layout is
|
|
46
|
+
* still the right one, and then it stays.
|
|
47
|
+
*/
|
|
48
|
+
.lt-dialog:has(> .lt-dialog__body) {
|
|
49
|
+
display: flex;
|
|
50
|
+
flex-direction: column;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/*
|
|
54
|
+
* And then back what the rule above took away.
|
|
55
|
+
*
|
|
56
|
+
* A `<dialog>` without `open` is hidden by the browser's own stylesheet,
|
|
57
|
+
* with `display: none`. An author rule beats the browser's whatever the
|
|
58
|
+
* layer and specificity, so the moment the class got a `display`, a closed
|
|
59
|
+
* dialog became visible: it lay as a card on top of the content around it,
|
|
60
|
+
* from page load and after every close. Tested in all three engines.
|
|
61
|
+
*
|
|
62
|
+
* The rule applies only to `<dialog>`. A `<div>` with the class, as in the
|
|
63
|
+
* preview in the documentation, has no hidden state to restore.
|
|
64
|
+
*
|
|
65
|
+
* The exception for popover is where the specification's own stylesheet has
|
|
66
|
+
* it. A popover never sets `open`, so without it a
|
|
67
|
+
* `<dialog class="lt-dialog" popover>` shown with `showPopover()` was
|
|
68
|
+
* invisible, in all three engines and without a word.
|
|
69
|
+
*
|
|
70
|
+
* The `:is()` around it is not decoration. `:not()` takes an unforgiving
|
|
71
|
+
* list, so in an engine that knows `:has()` but not `:popover-open`, and
|
|
72
|
+
* there is a window where both are true, the whole rule would have been
|
|
73
|
+
* invalid while the column above stayed. Then we are back to what the rule
|
|
74
|
+
* exists for: a closed dialog lying as a card over the content. `:is()` is
|
|
75
|
+
* forgiving, so an unknown pseudo-class inside it only makes that part
|
|
76
|
+
* false. Checked in all three engines with a pseudo-class none of them
|
|
77
|
+
* knows.
|
|
78
|
+
*/
|
|
79
|
+
dialog.lt-dialog:not([open]):not(:is(:popover-open)) {
|
|
80
|
+
display: none;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/* The backdrop behind the dialog. It exists only when the dialog was
|
|
84
|
+
opened with showModal(); a plain show() gives no ::backdrop. */
|
|
85
|
+
.lt-dialog::backdrop {
|
|
86
|
+
background: var(--lt-color-overlay);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/*
|
|
90
|
+
* The dialog is in the right place before it has become a real modal.
|
|
91
|
+
*
|
|
92
|
+
* A dialog the server wants to show is sent with `open`, or the content
|
|
93
|
+
* does not exist without JavaScript. The browser then puts it in the normal
|
|
94
|
+
* flow, as a box somewhere on the page, and only when the component calls
|
|
95
|
+
* `showModal()` is it moved to the top layer and centred. Between those two
|
|
96
|
+
* moments it jumps, and on a slow connection the jump is clearly visible:
|
|
97
|
+
* tested in Chromium, it stood at top 0 and landed at top 128.
|
|
98
|
+
*
|
|
99
|
+
* Here it is placed like a modal already before it is one, so there is
|
|
100
|
+
* nothing to jump from. The backdrop is painted with a shadow, since
|
|
101
|
+
* `::backdrop` exists only in the top layer.
|
|
102
|
+
*
|
|
103
|
+
* The rule applies only inside `<lt-dialog>`. A `.lt-dialog` used without
|
|
104
|
+
* the component, and deliberately not modal, stays where it is.
|
|
105
|
+
*/
|
|
106
|
+
lt-dialog .lt-dialog[open]:not(:modal) {
|
|
107
|
+
position: fixed;
|
|
108
|
+
z-index: var(--lt-dialog-layer, 40);
|
|
109
|
+
|
|
110
|
+
/*
|
|
111
|
+
* The same geometry as a modal, not only the same place.
|
|
112
|
+
*
|
|
113
|
+
* The values are the ones the HTML specification's suggested stylesheet
|
|
114
|
+
* gives a modal: `margin: auto` and the inline insets from the base rule
|
|
115
|
+
* for `dialog`, and the block insets, `overflow` and the maximum sizes
|
|
116
|
+
* from `dialog:modal`. The maximum
|
|
117
|
+
* width is written logically, since the project requires logical properties, and the
|
|
118
|
+
* two forms are the same in horizontal writing modes. Without it the
|
|
119
|
+
* width is ours, and when the dialog becomes modal the browser clips it:
|
|
120
|
+
* tested at 390 pixels, it went from 358 to 352 pixels wide and moved
|
|
121
|
+
* three pixels to the right. The vertical jump was gone, and a horizontal
|
|
122
|
+
* one came instead.
|
|
123
|
+
*
|
|
124
|
+
* `6px` and `2em` are the browser's own numbers, not our spacing scale.
|
|
125
|
+
* So they must not become tokens: being identical is the whole point.
|
|
126
|
+
*
|
|
127
|
+
* The maximum height is deliberately not here. `.lt-dialog` already has
|
|
128
|
+
* it, and an author rule beats the browser's `dialog:modal`, so the one
|
|
129
|
+
* value applies in both states. Had it been here too, this one would have
|
|
130
|
+
* won on specificity before the dialog became modal and dropped away
|
|
131
|
+
* afterwards, and a tall dialog would have jumped 13 pixels vertically
|
|
132
|
+
* instead. Tested in all three engines.
|
|
133
|
+
*/
|
|
134
|
+
inset: 0;
|
|
135
|
+
margin: auto;
|
|
136
|
+
max-inline-size: calc(100% - 6px - 2em);
|
|
137
|
+
overflow: auto;
|
|
138
|
+
|
|
139
|
+
box-shadow:
|
|
140
|
+
var(--lt-shadow-overlay),
|
|
141
|
+
0 0 0 100vmax var(--lt-color-overlay);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
.lt-dialog__title {
|
|
145
|
+
margin: 0 0 var(--lt-spacing-2);
|
|
146
|
+
font-size: var(--lt-font-size-l);
|
|
147
|
+
font-weight: var(--lt-font-weight-semibold);
|
|
148
|
+
line-height: var(--lt-line-height-compact);
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
/* The part that scrolls when the dialog is full. A flex item that does
|
|
152
|
+
not have `overflow: visible` has an automatic minimum size of zero, so
|
|
153
|
+
it shrinks by itself; no `min-block-size: 0` is needed, and that is
|
|
154
|
+
checked in all three engines. */
|
|
155
|
+
.lt-dialog__body {
|
|
156
|
+
margin: 0;
|
|
157
|
+
overflow-y: auto;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
.lt-dialog__footer {
|
|
161
|
+
display: flex;
|
|
162
|
+
flex-wrap: wrap;
|
|
163
|
+
justify-content: flex-end;
|
|
164
|
+
gap: var(--lt-spacing-2);
|
|
165
|
+
margin-block-start: var(--lt-spacing-5);
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
/*
|
|
169
|
+
* A header, which can be coloured.
|
|
170
|
+
*
|
|
171
|
+
* With `.lt-dialog__header` as a direct child the padding moves from the
|
|
172
|
+
* dialog to the parts: the header, the body and the button row each get
|
|
173
|
+
* their `padding`, so a coloured band reaches all the way to the edges.
|
|
174
|
+
* Without the header everything is as before. The condition is in the
|
|
175
|
+
* selector, as for the column above: two dialogs in the demo rewrote the
|
|
176
|
+
* padding on three classes to get this, and that is a dependency on how
|
|
177
|
+
* the dialog distributes its spacing, which broke on an upgrade.
|
|
178
|
+
*/
|
|
179
|
+
.lt-dialog:has(> .lt-dialog__header) {
|
|
180
|
+
padding: 0;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
.lt-dialog__header {
|
|
184
|
+
flex: none;
|
|
185
|
+
padding: var(--lt-dialog-padding, var(--lt-spacing-5));
|
|
186
|
+
/* One pixel less than the dialog: the header sits inside the border,
|
|
187
|
+
and the inside of a corner is the radius minus the border width. */
|
|
188
|
+
border-start-start-radius: calc(
|
|
189
|
+
var(--lt-dialog-radius, var(--lt-spacing-2)) -
|
|
190
|
+
1px
|
|
191
|
+
);
|
|
192
|
+
border-start-end-radius: calc(
|
|
193
|
+
var(--lt-dialog-radius, var(--lt-spacing-2)) -
|
|
194
|
+
1px
|
|
195
|
+
);
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
/*
|
|
199
|
+
* Without a colour the header is no stripe. The bottom spacing is the
|
|
200
|
+
* heading's normal margin, and what follows counts from there: the body
|
|
201
|
+
* starts without top spacing of its own, so the distance down to the text
|
|
202
|
+
* is the same as without a header, and the button row gets the rest of the
|
|
203
|
+
* dialog's spacing, so the distance there is the same too. The first
|
|
204
|
+
* version set the bottom spacing to zero, and a dialog with only a heading
|
|
205
|
+
* and buttons then got zero pixels between them.
|
|
206
|
+
*
|
|
207
|
+
* The rules apply to anything that is not one of the five colours. Before,
|
|
208
|
+
* they matched only a dialog without the attribute, and `neutral`, which is
|
|
209
|
+
* the default and which the editor suggests, got 20 pixels below the
|
|
210
|
+
* heading instead of 8. So did an empty value from a template.
|
|
211
|
+
*/
|
|
212
|
+
.lt-dialog:not(
|
|
213
|
+
[data-color="brand"],
|
|
214
|
+
[data-color="info"],
|
|
215
|
+
[data-color="success"],
|
|
216
|
+
[data-color="warning"],
|
|
217
|
+
[data-color="danger"]
|
|
218
|
+
)
|
|
219
|
+
> .lt-dialog__header {
|
|
220
|
+
padding-block-end: var(--lt-spacing-2);
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
.lt-dialog:not(
|
|
224
|
+
[data-color="brand"],
|
|
225
|
+
[data-color="info"],
|
|
226
|
+
[data-color="success"],
|
|
227
|
+
[data-color="warning"],
|
|
228
|
+
[data-color="danger"]
|
|
229
|
+
)
|
|
230
|
+
> .lt-dialog__header
|
|
231
|
+
+ .lt-dialog__body {
|
|
232
|
+
padding-block-start: 0;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
.lt-dialog:not(
|
|
236
|
+
[data-color="brand"],
|
|
237
|
+
[data-color="info"],
|
|
238
|
+
[data-color="success"],
|
|
239
|
+
[data-color="warning"],
|
|
240
|
+
[data-color="danger"]
|
|
241
|
+
)
|
|
242
|
+
> .lt-dialog__header
|
|
243
|
+
+ .lt-dialog__footer {
|
|
244
|
+
padding-block-start: calc(
|
|
245
|
+
var(--lt-dialog-padding, var(--lt-spacing-5)) -
|
|
246
|
+
var(--lt-spacing-2)
|
|
247
|
+
);
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
.lt-dialog__header .lt-dialog__title {
|
|
251
|
+
margin: 0;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
/* The same colour as the heading, without opacity: at 0.85 the text fell
|
|
255
|
+
below 4.5:1 on the success and warning bands. */
|
|
256
|
+
.lt-dialog__subtitle {
|
|
257
|
+
margin: var(--lt-spacing-1) 0 0;
|
|
258
|
+
font-size: var(--lt-font-size-s);
|
|
259
|
+
line-height: var(--lt-line-height-default);
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
.lt-dialog:has(> .lt-dialog__header) > .lt-dialog__body {
|
|
263
|
+
padding: var(--lt-dialog-padding, var(--lt-spacing-5));
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
.lt-dialog:has(> .lt-dialog__header) > .lt-dialog__footer {
|
|
267
|
+
margin-block-start: 0;
|
|
268
|
+
padding: 0 var(--lt-dialog-padding, var(--lt-spacing-5))
|
|
269
|
+
var(--lt-dialog-padding, var(--lt-spacing-5));
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
/* The colours are the alert's, plus the brand colour. The text follows,
|
|
273
|
+
so the contrast holds on every band. */
|
|
274
|
+
.lt-dialog[data-color="brand"] > .lt-dialog__header {
|
|
275
|
+
color: var(--lt-color-accent-content);
|
|
276
|
+
background: var(--lt-color-accent-fill);
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
.lt-dialog[data-color="info"] > .lt-dialog__header {
|
|
280
|
+
color: var(--lt-color-accent-text);
|
|
281
|
+
background: var(--lt-color-accent-surface);
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
.lt-dialog[data-color="success"] > .lt-dialog__header {
|
|
285
|
+
color: var(--lt-color-success-text);
|
|
286
|
+
background: var(--lt-color-success-surface);
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
.lt-dialog[data-color="warning"] > .lt-dialog__header {
|
|
290
|
+
color: var(--lt-color-warning-text);
|
|
291
|
+
background: var(--lt-color-warning-surface);
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
.lt-dialog[data-color="danger"] > .lt-dialog__header {
|
|
295
|
+
color: var(--lt-color-danger-text);
|
|
296
|
+
background: var(--lt-color-danger-surface);
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
/* High contrast removes the background colours. A line below the header
|
|
300
|
+
keeps the header and the body apart. */
|
|
301
|
+
@media (forced-colors: active) {
|
|
302
|
+
.lt-dialog__header {
|
|
303
|
+
border-block-end: 1px solid CanvasText;
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
}
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
import { attributes, createGuard, idOrFallback } from "../../css/shared.js"
|
|
2
|
+
|
|
3
|
+
export const DIALOG_CLASS = "lt-dialog" as const
|
|
4
|
+
export const DIALOG_HEADER_CLASS = "lt-dialog__header" as const
|
|
5
|
+
export const DIALOG_TITLE_CLASS = "lt-dialog__title" as const
|
|
6
|
+
export const DIALOG_SUBTITLE_CLASS = "lt-dialog__subtitle" as const
|
|
7
|
+
export const DIALOG_BODY_CLASS = "lt-dialog__body" as const
|
|
8
|
+
export const DIALOG_FOOTER_CLASS = "lt-dialog__footer" as const
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* The colour of the header, and what it means.
|
|
12
|
+
*
|
|
13
|
+
* `neutral` is the default and gives no colour. The four status colours are
|
|
14
|
+
* the same ones the alert uses, and `brand` is the brand colour, for a header
|
|
15
|
+
* that says who is speaking rather than how it went.
|
|
16
|
+
*/
|
|
17
|
+
export const dialogColors = [
|
|
18
|
+
"neutral",
|
|
19
|
+
"brand",
|
|
20
|
+
"info",
|
|
21
|
+
"success",
|
|
22
|
+
"warning",
|
|
23
|
+
"danger",
|
|
24
|
+
] as const
|
|
25
|
+
export type DialogColor = (typeof dialogColors)[number]
|
|
26
|
+
|
|
27
|
+
export type DialogOptions = {
|
|
28
|
+
/** Id of the heading. The dialog takes its name from it with `aria-labelledby`. */
|
|
29
|
+
titleId: string
|
|
30
|
+
/**
|
|
31
|
+
* The dialog is open. Default: closed.
|
|
32
|
+
*
|
|
33
|
+
* This is the server telling `<lt-dialog>` to show it. If you control the
|
|
34
|
+
* dialog from the browser yourself, with `showModal()`, leave it out: the
|
|
35
|
+
* call throws `InvalidStateError` on a dialog that is already open.
|
|
36
|
+
*/
|
|
37
|
+
open?: boolean
|
|
38
|
+
/**
|
|
39
|
+
* Colour of the header. Default: none.
|
|
40
|
+
*
|
|
41
|
+
* The colour applies to `header`, so the header must be in the markup for
|
|
42
|
+
* it to show: `<div {...box.header}>` around the heading. Without a header
|
|
43
|
+
* there is nothing to colour.
|
|
44
|
+
*/
|
|
45
|
+
color?: DialogColor
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export type DialogAttributes = {
|
|
49
|
+
host: {
|
|
50
|
+
open?: true
|
|
51
|
+
}
|
|
52
|
+
dialog: {
|
|
53
|
+
class: typeof DIALOG_CLASS
|
|
54
|
+
"aria-labelledby": string
|
|
55
|
+
open?: true
|
|
56
|
+
"data-color"?: Exclude<DialogColor, "neutral">
|
|
57
|
+
}
|
|
58
|
+
/** The header, holding the heading and an optional subtitle. Optional. */
|
|
59
|
+
header: { class: typeof DIALOG_HEADER_CLASS }
|
|
60
|
+
title: {
|
|
61
|
+
class: typeof DIALOG_TITLE_CLASS
|
|
62
|
+
id: string
|
|
63
|
+
}
|
|
64
|
+
/** A line below the heading, inside the header. Optional. */
|
|
65
|
+
subtitle: { class: typeof DIALOG_SUBTITLE_CLASS }
|
|
66
|
+
body: { class: typeof DIALOG_BODY_CLASS }
|
|
67
|
+
footer: { class: typeof DIALOG_FOOTER_CLASS }
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* The attributes for a dialog.
|
|
72
|
+
*
|
|
73
|
+
* Opening a dialog is a call, not an attribute: only `showModal()` moves
|
|
74
|
+
* focus in, keeps focus inside the dialog, closes on Escape and makes the
|
|
75
|
+
* rest of the page inert. A `<dialog open>` in the markup is a box on the page.
|
|
76
|
+
*
|
|
77
|
+
* That is a problem for a server that only sends HTML, since it cannot call
|
|
78
|
+
* anything in the browser. So the server says the dialog is open, and
|
|
79
|
+
* `<lt-dialog>` makes the call.
|
|
80
|
+
*
|
|
81
|
+
* The two `open`s are not the same, and it is worth keeping them apart:
|
|
82
|
+
*
|
|
83
|
+
* - `open` on the **host** is the server saying the dialog should be shown.
|
|
84
|
+
* It is not preserved. If it were, the server could never open the dialog
|
|
85
|
+
* again after the user had closed it once. If the server sends the region
|
|
86
|
+
* again with `open` still set, the dialog opens again. For a dismissal to
|
|
87
|
+
* last, the app must tell the server.
|
|
88
|
+
* - `open` on the **`<dialog>`** is set by the browser itself when
|
|
89
|
+
* `showModal()` is called. It is not in the server's HTML, so a morph
|
|
90
|
+
* removes it, and the component puts it back. The server also writes it
|
|
91
|
+
* when it knows the dialog should be shown: without JavaScript a `<dialog>`
|
|
92
|
+
* without `open` is hidden, and its content does not exist for the reader.
|
|
93
|
+
* With the attribute it stands as a box on the page until the component
|
|
94
|
+
* turns it into a modal.
|
|
95
|
+
*
|
|
96
|
+
* ```ts
|
|
97
|
+
* const box = lt.dialog({ titleId: "delete-title", open: true })
|
|
98
|
+
* ```
|
|
99
|
+
* ```html
|
|
100
|
+
* <lt-dialog {...box.host}>
|
|
101
|
+
* <dialog {...box.dialog}>
|
|
102
|
+
* <h2 {...box.title}>Delete the application?</h2>
|
|
103
|
+
* <div {...box.body}>The application and its attachments will be gone.</div>
|
|
104
|
+
* <form method="dialog" {...box.footer}>
|
|
105
|
+
* <button class="lt-button" value="cancel">Cancel</button>
|
|
106
|
+
* </form>
|
|
107
|
+
* </dialog>
|
|
108
|
+
* </lt-dialog>
|
|
109
|
+
* ```
|
|
110
|
+
*/
|
|
111
|
+
export const dialog = Object.assign(
|
|
112
|
+
({
|
|
113
|
+
titleId: givenId,
|
|
114
|
+
open = false,
|
|
115
|
+
color = "neutral",
|
|
116
|
+
}: DialogOptions): DialogAttributes => {
|
|
117
|
+
// The fallback only matters to someone without a type check.
|
|
118
|
+
const titleId = idOrFallback("lt.dialog()", givenId, "titleId")
|
|
119
|
+
|
|
120
|
+
return {
|
|
121
|
+
host: attributes({
|
|
122
|
+
open: open ? (true as const) : undefined,
|
|
123
|
+
}),
|
|
124
|
+
dialog: attributes({
|
|
125
|
+
class: DIALOG_CLASS,
|
|
126
|
+
"aria-labelledby": titleId,
|
|
127
|
+
/*
|
|
128
|
+
* `open` is in both places when the dialog should be shown, on
|
|
129
|
+
* purpose.
|
|
130
|
+
*
|
|
131
|
+
* Without JavaScript a `<dialog>` without `open` is hidden, so the
|
|
132
|
+
* content the server wanted to show did not exist for the reader. With
|
|
133
|
+
* `open` it stands there as a box on the page, and the component turns
|
|
134
|
+
* it into a real modal with `showModal()` once it gets to run.
|
|
135
|
+
*
|
|
136
|
+
* In React it is also the only thing that matches: the component sets
|
|
137
|
+
* `open` on the `<dialog>` before React hydrates, and when it was not in
|
|
138
|
+
* the server's HTML, React reported a mismatch on every single page load.
|
|
139
|
+
*/
|
|
140
|
+
open: open ? (true as const) : undefined,
|
|
141
|
+
"data-color": color === "neutral" ? undefined : color,
|
|
142
|
+
}),
|
|
143
|
+
header: attributes({ class: DIALOG_HEADER_CLASS }),
|
|
144
|
+
title: attributes({ class: DIALOG_TITLE_CLASS, id: titleId }),
|
|
145
|
+
subtitle: attributes({ class: DIALOG_SUBTITLE_CLASS }),
|
|
146
|
+
body: attributes({ class: DIALOG_BODY_CLASS }),
|
|
147
|
+
footer: attributes({ class: DIALOG_FOOTER_CLASS }),
|
|
148
|
+
}
|
|
149
|
+
},
|
|
150
|
+
{
|
|
151
|
+
/** The class on the `<dialog>` itself. */
|
|
152
|
+
dialog: DIALOG_CLASS,
|
|
153
|
+
/** The class on the header, which `color` can colour. */
|
|
154
|
+
header: DIALOG_HEADER_CLASS,
|
|
155
|
+
/** The class on the heading in the dialog. */
|
|
156
|
+
title: DIALOG_TITLE_CLASS,
|
|
157
|
+
/** The class on the subtitle in the header. */
|
|
158
|
+
subtitle: DIALOG_SUBTITLE_CLASS,
|
|
159
|
+
/** The class on the content, which scrolls when the dialog gets too tall. */
|
|
160
|
+
body: DIALOG_BODY_CLASS,
|
|
161
|
+
/** The class on the row of buttons at the bottom. */
|
|
162
|
+
footer: DIALOG_FOOTER_CLASS,
|
|
163
|
+
colors: dialogColors,
|
|
164
|
+
isColor: createGuard(dialogColors),
|
|
165
|
+
},
|
|
166
|
+
)
|