@lo-tek/interfaces 0.0.0-stage → 0.37.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 +3254 -0
- package/LICENSE +21 -0
- package/README.md +129 -2
- 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 +35 -0
- package/dist/components/default-texts.d.ts.map +1 -0
- package/dist/components/default-texts.js +35 -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 +431 -0
- package/dist/components/frame/dialog/lt-dialog.js.map +1 -0
- package/dist/components/frame/error-summary/error-summary.d.ts +40 -0
- package/dist/components/frame/error-summary/error-summary.d.ts.map +1 -0
- package/dist/components/frame/error-summary/error-summary.js +32 -0
- package/dist/components/frame/error-summary/error-summary.js.map +1 -0
- package/dist/components/frame/error-summary/lt-error-summary.d.ts +82 -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 +302 -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 +580 -0
- package/dist/components/frame/field/lt-field.js.map +1 -0
- package/dist/components/frame/popover/lt-popover.d.ts +132 -0
- package/dist/components/frame/popover/lt-popover.d.ts.map +1 -0
- package/dist/components/frame/popover/lt-popover.js +490 -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 +573 -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 +361 -0
- package/dist/components/frame/suggestion/lt-suggestion.d.ts.map +1 -0
- package/dist/components/frame/suggestion/lt-suggestion.js +1152 -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 +404 -0
- package/dist/components/frame/tabs/lt-tabs.d.ts.map +1 -0
- package/dist/components/frame/tabs/lt-tabs.js +1201 -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 +135 -0
- package/dist/components/host-element.d.ts.map +1 -0
- package/dist/components/host-element.js +366 -0
- package/dist/components/host-element.js.map +1 -0
- package/dist/components/standalone/connection-status/connection-status.d.ts +28 -0
- package/dist/components/standalone/connection-status/connection-status.d.ts.map +1 -0
- package/dist/components/standalone/connection-status/connection-status.js +22 -0
- package/dist/components/standalone/connection-status/connection-status.js.map +1 -0
- package/dist/components/standalone/connection-status/lt-connection-status.d.ts +81 -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 +216 -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 +137 -0
- package/dist/diagnostics/core.d.ts.map +1 -0
- package/dist/diagnostics/core.js +72 -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 +492 -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 +1320 -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 +410 -0
- package/dist/vocabulary/elements.js.map +1 -0
- package/dist/vocabulary/types.d.ts +175 -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 +62 -0
- package/manifest/files.json +373 -0
- package/manifest/manifest.json +4965 -0
- package/manifest/manifest.schema.json +513 -0
- package/package.json +404 -4
- 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 +34 -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 +510 -0
- package/src/components/frame/error-summary/error-summary.css +47 -0
- package/src/components/frame/error-summary/error-summary.ts +56 -0
- package/src/components/frame/error-summary/lt-error-summary.ts +344 -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 +753 -0
- package/src/components/frame/popover/lt-popover.ts +555 -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 +681 -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 +1358 -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 +1319 -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 +400 -0
- package/src/components/standalone/connection-status/connection-status.css +41 -0
- package/src/components/standalone/connection-status/connection-status.ts +41 -0
- package/src/components/standalone/connection-status/lt-connection-status.ts +242 -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 +210 -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 +1322 -0
- package/src/vocabulary/elements.ts +412 -0
- package/src/vocabulary/types.ts +178 -0
- package/src/wasi-host.ts +155 -0
- package/web-types.json +800 -0
|
@@ -0,0 +1,472 @@
|
|
|
1
|
+
# LO-TEK in templates and server-written HTML
|
|
2
|
+
|
|
3
|
+
The rulebook for LO-TEK where the server produces the markup: Go templates,
|
|
4
|
+
Razor, PHP, Blade, Twig, Jinja, Django, ERB, Liquid, Handlebars, Nunjucks and
|
|
5
|
+
Edge, and HTML built as strings in Kotlin, Java, C# or Python.
|
|
6
|
+
|
|
7
|
+
This is the environment LO-TEK is made for. The components are CSS classes and
|
|
8
|
+
web components, that is, things the browser understands directly, so a Go
|
|
9
|
+
template gets the same components as a React app without taking in any
|
|
10
|
+
JavaScript framework.
|
|
11
|
+
|
|
12
|
+
It is also the environment with the smallest safety net. No compiler looks at
|
|
13
|
+
the attributes in a template, and no type stops `data-variant="outlined"`.
|
|
14
|
+
That is why item 5 applies more strictly here than anywhere else: the check is
|
|
15
|
+
the only thing that reads your markup.
|
|
16
|
+
|
|
17
|
+
This is @lo-tek/interfaces 0.37.0. The file is generated by the package and
|
|
18
|
+
follows its version, so it can never say anything other than the code next to
|
|
19
|
+
it.
|
|
20
|
+
|
|
21
|
+
## Short version
|
|
22
|
+
|
|
23
|
+
1. **One `<link>` to `lotek.css` in the page template,** once for the whole
|
|
24
|
+
app. Without it, the components look unstyled. The answer is then to add
|
|
25
|
+
the link, never to write your own CSS to make them look right.
|
|
26
|
+
2. **Use only the classes and elements in the tables below.** `lt-modal`,
|
|
27
|
+
`lt-datepicker` and `data-variant="outlined"` exist in other design
|
|
28
|
+
systems, not in LO-TEK. If you are unsure whether something exists, it is
|
|
29
|
+
listed here or it does not exist.
|
|
30
|
+
3. **No hard-coded colours or pixels.** `var(--lt-color-…)` and
|
|
31
|
+
`var(--lt-spacing-…)`.
|
|
32
|
+
4. **Web components are registered once with `defineLt*()`** in the page
|
|
33
|
+
template, and a boolean attribute is true as long as it is there. In a
|
|
34
|
+
template that means a condition around the whole attribute,
|
|
35
|
+
`{{if .Locked}}disabled{{end}}`, not `disabled="{{.Locked}}"`.
|
|
36
|
+
5. **Run the check on what you have written:**
|
|
37
|
+
`npx @lo-tek/interfaces check templates/*.html`. It knows every class,
|
|
38
|
+
every element, every attribute and every allowed value, prints
|
|
39
|
+
`file:line:column: error: message`, or `warning:`, and exits with an error
|
|
40
|
+
code if it finds anything. With the app running, also check every page you
|
|
41
|
+
have changed: `npx @lo-tek/interfaces check http://localhost:8080/page`.
|
|
42
|
+
That also requires every `for` and `aria-describedby` to point to an id
|
|
43
|
+
that exists, and every field to have a label. You are done when both answer
|
|
44
|
+
"The markup matches LO-TEK".
|
|
45
|
+
|
|
46
|
+
## 1. The stylesheet
|
|
47
|
+
|
|
48
|
+
One link in the page template, with all the components:
|
|
49
|
+
|
|
50
|
+
```html
|
|
51
|
+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@lo-tek/interfaces@0.37.0/dist/lotek.css">
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
Or from your own server, if you copy the file into your static assets.
|
|
55
|
+
`lotek.css` is 103 kB, 13 kB compressed, has everything flattened without
|
|
56
|
+
`@import`, and is the fastest option when you link.
|
|
57
|
+
|
|
58
|
+
If you want only the stylesheets the pages actually use, `tokens.css` defines
|
|
59
|
+
all the variables, and all the other stylesheets build on it. It must be
|
|
60
|
+
loaded, and comes first out of habit: the order between it and the others does
|
|
61
|
+
not matter. After that, one stylesheet per component, from the tables below.
|
|
62
|
+
Without a bundler that means more round trips, and one forgotten link is
|
|
63
|
+
enough for something to look unstyled. For a template, one file is nearly
|
|
64
|
+
always the right choice.
|
|
65
|
+
|
|
66
|
+
## 2. What exists
|
|
67
|
+
|
|
68
|
+
35 CSS components and 9 web components, and this is the whole list. The
|
|
69
|
+
classes are `lt-` + kebab-case. Variants are always `data-*` attributes, never
|
|
70
|
+
classes of their own: `data-variant="secondary"`, not `lt-button--secondary`.
|
|
71
|
+
The default variant has no attribute.
|
|
72
|
+
|
|
73
|
+
### CSS components (no JavaScript)
|
|
74
|
+
|
|
75
|
+
| Class | Stylesheet | Attributes |
|
|
76
|
+
| --- | --- | --- |
|
|
77
|
+
| `lt-accordion`<br>`lt-accordion__content` | `https://cdn.jsdelivr.net/npm/@lo-tek/interfaces@0.37.0/src/components/css/accordion/accordion.css` | `data-variant`: plain |
|
|
78
|
+
| `lt-alert`<br>`lt-alert__title` | `https://cdn.jsdelivr.net/npm/@lo-tek/interfaces@0.37.0/src/components/css/alert/alert.css` | `data-color`: info, success, warning, danger |
|
|
79
|
+
| `lt-avatar`<br>`lt-avatar-stack` | `https://cdn.jsdelivr.net/npm/@lo-tek/interfaces@0.37.0/src/components/css/avatar/avatar.css` | `data-variant`: square<br>`data-size`: small, large |
|
|
80
|
+
| `lt-badge` | `https://cdn.jsdelivr.net/npm/@lo-tek/interfaces@0.37.0/src/components/css/badge/badge.css` | `data-color`: success, warning, danger, neutral |
|
|
81
|
+
| `lt-breadcrumbs` | `https://cdn.jsdelivr.net/npm/@lo-tek/interfaces@0.37.0/src/components/css/breadcrumbs/breadcrumbs.css` | none |
|
|
82
|
+
| `lt-button` | `https://cdn.jsdelivr.net/npm/@lo-tek/interfaces@0.37.0/src/components/css/button/button.css` | `data-variant`: secondary, ghost, danger |
|
|
83
|
+
| `lt-card`<br>`lt-card__title` | `https://cdn.jsdelivr.net/npm/@lo-tek/interfaces@0.37.0/src/components/css/card/card.css` | `data-variant`: filled<br>`data-interactive` (flag) |
|
|
84
|
+
| `lt-checkbox`<br>`lt-checkbox-row` | `https://cdn.jsdelivr.net/npm/@lo-tek/interfaces@0.37.0/src/components/css/checkbox/checkbox.css` | `data-state`: invalid, success |
|
|
85
|
+
| `lt-divider` | `https://cdn.jsdelivr.net/npm/@lo-tek/interfaces@0.37.0/src/components/css/divider/divider.css` | `data-variant`: subtle, strong |
|
|
86
|
+
| `lt-error-text` | `https://cdn.jsdelivr.net/npm/@lo-tek/interfaces@0.37.0/src/components/css/error-text/error-text.css` | `data-variant`: warning |
|
|
87
|
+
| `lt-fieldset`<br>`lt-legend` | `https://cdn.jsdelivr.net/npm/@lo-tek/interfaces@0.37.0/src/components/css/fieldset/fieldset.css` | `data-state`: invalid, success<br>`data-required`: symbol, text<br>`data-optional` (flag) |
|
|
88
|
+
| `lt-file-upload`<br>`lt-file-upload-list` | `https://cdn.jsdelivr.net/npm/@lo-tek/interfaces@0.37.0/src/components/css/file-upload/file-upload.css` | `data-state`: invalid, success |
|
|
89
|
+
| `lt-heading` | `https://cdn.jsdelivr.net/npm/@lo-tek/interfaces@0.37.0/src/components/css/heading/heading.css` | `data-size`: xs, s, m, xl, mega |
|
|
90
|
+
| `lt-help-text` | `https://cdn.jsdelivr.net/npm/@lo-tek/interfaces@0.37.0/src/components/css/help-text/help-text.css` | `data-variant`: strong, success, warning |
|
|
91
|
+
| `lt-icon` | `https://cdn.jsdelivr.net/npm/@lo-tek/interfaces@0.37.0/src/components/css/icon/icon.css` | none |
|
|
92
|
+
| `lt-input` | `https://cdn.jsdelivr.net/npm/@lo-tek/interfaces@0.37.0/src/components/css/input/input.css` | `data-state`: invalid, success<br>`data-variant`: date, datetime-local, time |
|
|
93
|
+
| `lt-label` | `https://cdn.jsdelivr.net/npm/@lo-tek/interfaces@0.37.0/src/components/css/label/label.css` | `data-required`: symbol, text<br>`data-optional` (flag) |
|
|
94
|
+
| `lt-link` | `https://cdn.jsdelivr.net/npm/@lo-tek/interfaces@0.37.0/src/components/css/link/link.css` | none |
|
|
95
|
+
| `lt-list` | `https://cdn.jsdelivr.net/npm/@lo-tek/interfaces@0.37.0/src/components/css/list/list.css` | `data-variant`: plain, divided |
|
|
96
|
+
| `lt-pagination`<br>`lt-pagination__gap` | `https://cdn.jsdelivr.net/npm/@lo-tek/interfaces@0.37.0/src/components/css/pagination/pagination.css` | none |
|
|
97
|
+
| `lt-paragraph` | `https://cdn.jsdelivr.net/npm/@lo-tek/interfaces@0.37.0/src/components/css/paragraph/paragraph.css` | `data-variant`: lead<br>`data-size`: small, large |
|
|
98
|
+
| `lt-progress` | `https://cdn.jsdelivr.net/npm/@lo-tek/interfaces@0.37.0/src/components/css/progress/progress.css` | `data-color`: success, warning, danger |
|
|
99
|
+
| `lt-radio`<br>`lt-radio-row` | `https://cdn.jsdelivr.net/npm/@lo-tek/interfaces@0.37.0/src/components/css/radio/radio.css` | `data-state`: invalid, success |
|
|
100
|
+
| `lt-search`<br>`lt-search-row` | `https://cdn.jsdelivr.net/npm/@lo-tek/interfaces@0.37.0/src/components/css/search/search.css` | `data-state`: invalid, success |
|
|
101
|
+
| `lt-select` | `https://cdn.jsdelivr.net/npm/@lo-tek/interfaces@0.37.0/src/components/css/select/select.css` | `data-state`: invalid, success<br>`data-picker`: styled |
|
|
102
|
+
| `lt-skeleton` | `https://cdn.jsdelivr.net/npm/@lo-tek/interfaces@0.37.0/src/components/css/skeleton/skeleton.css` | `data-variant`: text, circle |
|
|
103
|
+
| `lt-skip-link` | `https://cdn.jsdelivr.net/npm/@lo-tek/interfaces@0.37.0/src/components/css/skip-link/skip-link.css` | none |
|
|
104
|
+
| `lt-spinner` | `https://cdn.jsdelivr.net/npm/@lo-tek/interfaces@0.37.0/src/components/css/spinner/spinner.css` | `data-size`: small, large |
|
|
105
|
+
| `lt-sr-only` | `https://cdn.jsdelivr.net/npm/@lo-tek/interfaces@0.37.0/src/components/css/sr-only/sr-only.css` | none |
|
|
106
|
+
| `lt-switch`<br>`lt-switch-row` | `https://cdn.jsdelivr.net/npm/@lo-tek/interfaces@0.37.0/src/components/css/switch/switch.css` | none |
|
|
107
|
+
| `lt-table`<br>`lt-table__sort`<br>`lt-table-scroll` | `https://cdn.jsdelivr.net/npm/@lo-tek/interfaces@0.37.0/src/components/css/table/table.css` | `data-variant`: striped<br>`data-hoverable` (flag) |
|
|
108
|
+
| `lt-tag` | `https://cdn.jsdelivr.net/npm/@lo-tek/interfaces@0.37.0/src/components/css/tag/tag.css` | `data-variant`: filled<br>`data-selectable` (flag) |
|
|
109
|
+
| `lt-textarea` | `https://cdn.jsdelivr.net/npm/@lo-tek/interfaces@0.37.0/src/components/css/textarea/textarea.css` | `data-state`: invalid, success |
|
|
110
|
+
| `lt-toggle-group`<br>`lt-toggle-group__option` | `https://cdn.jsdelivr.net/npm/@lo-tek/interfaces@0.37.0/src/components/css/toggle-group/toggle-group.css` | none |
|
|
111
|
+
| `lt-tooltip`<br>`lt-tooltip__bubble` | `https://cdn.jsdelivr.net/npm/@lo-tek/interfaces@0.37.0/src/components/css/tooltip/tooltip.css` | none |
|
|
112
|
+
|
|
113
|
+
There is also `lt-theme-control`, a class on a radio button that lets the user
|
|
114
|
+
choose a theme. It is in `tokens.css`, and is described under Tokens.
|
|
115
|
+
|
|
116
|
+
## 3. Tokens
|
|
117
|
+
|
|
118
|
+
One layer. A colour is a cell in a matrix of **family**, that is, what it
|
|
119
|
+
means, and **role**, that is, what it does, and the name is
|
|
120
|
+
`--lt-color-<family>-<role>`. Every family has every role, so
|
|
121
|
+
`--lt-color-danger-border` and `--lt-color-success-border` both exist. The
|
|
122
|
+
roles are the same whatever the family: `surface` is a tinted surface, `fill`
|
|
123
|
+
a filled one, `content` the text on top of `fill`, `border` a border, and
|
|
124
|
+
`text` the family's colour as text. Border and text each have a weaker and a
|
|
125
|
+
stronger step next to them.
|
|
126
|
+
|
|
127
|
+
```
|
|
128
|
+
Families: `accent`, `visited`, `brand1`, `brand2`, `brand3`, `neutral`, `danger`, `warning`, `success`.
|
|
129
|
+
|
|
130
|
+
Roles: `surface`, `border-subtle`, `border`, `border-strong`, `fill`, `text`, `text-strong`, `text-subtle`, `content`.
|
|
131
|
+
|
|
132
|
+
Outside the matrix: `--lt-color-disabled-surface`, `--lt-color-disabled-text`, `--lt-color-neutral-canvas`, `--lt-color-neutral-raised`, `--lt-color-overlay`, `--lt-focus-ring`, `--lt-icon-calendar`, `--lt-icon-check`, `--lt-icon-clock`, `--lt-icon-dash`, `--lt-icon-search`, `--lt-shadow-overlay`.
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
Spacing: `--lt-spacing-0-5`, `--lt-spacing-1`, `--lt-spacing-10`,
|
|
136
|
+
`--lt-spacing-12`, `--lt-spacing-16`, `--lt-spacing-2`, `--lt-spacing-3`,
|
|
137
|
+
`--lt-spacing-4`, `--lt-spacing-5`, `--lt-spacing-6`, `--lt-spacing-7`,
|
|
138
|
+
`--lt-spacing-8`, `--lt-spacing-px`.
|
|
139
|
+
|
|
140
|
+
Font: `--lt-font-size-l`, `--lt-font-size-m`, `--lt-font-size-mega`,
|
|
141
|
+
`--lt-font-size-reference`, `--lt-font-size-s`, `--lt-font-size-xl`,
|
|
142
|
+
`--lt-font-size-xs`, `--lt-font-size-xxl`, `--lt-font-size-xxs`,
|
|
143
|
+
`--lt-font-weight-bold`, `--lt-font-weight-medium`,
|
|
144
|
+
`--lt-font-weight-regular`, `--lt-font-weight-semibold`.
|
|
145
|
+
|
|
146
|
+
Line height: `--lt-line-height-article`, `--lt-line-height-compact`,
|
|
147
|
+
`--lt-line-height-default`, `--lt-line-height-heading`.
|
|
148
|
+
|
|
149
|
+
`disabled` and `neutral` are not the same. `disabled` is for controls that are
|
|
150
|
+
turned off, and is exempt from the contrast requirement in WCAG 1.4.3.
|
|
151
|
+
`neutral` is for subdued information the user actually has to read or press,
|
|
152
|
+
and holds 4.5:1. Never use the `disabled` colours to subdue something that is
|
|
153
|
+
meant to be read.
|
|
154
|
+
|
|
155
|
+
### Light and dark
|
|
156
|
+
|
|
157
|
+
Without you doing anything, the colours follow the device's setting. A page
|
|
158
|
+
that wants to decide for itself sets `data-theme="light"` or
|
|
159
|
+
`data-theme="dark"` on `<html>`.
|
|
160
|
+
|
|
161
|
+
The attribute is a **theme boundary** and works on any element, not only on
|
|
162
|
+
the root. One theme can sit inside another, both ways.
|
|
163
|
+
|
|
164
|
+
This is what an embedded component should use. When you put LO-TEK into a page
|
|
165
|
+
you do not control, set the attribute on the component's own root element:
|
|
166
|
+
|
|
167
|
+
```html
|
|
168
|
+
<div data-theme="light">
|
|
169
|
+
<button class="lt-button">Save</button>
|
|
170
|
+
</div>
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
The component is then light whatever the device is set to, and the host is
|
|
174
|
+
left alone.
|
|
175
|
+
|
|
176
|
+
**The host's CSS stops at the boundary.** The host often has rules without a
|
|
177
|
+
layer, such as `button { background: none; border: none }` or a normalize, and
|
|
178
|
+
they beat `@layer lotek`. In that case, set `data-lt-boundary` on the same
|
|
179
|
+
root element:
|
|
180
|
+
|
|
181
|
+
```html
|
|
182
|
+
<div data-lt-boundary data-theme="light">
|
|
183
|
+
<button class="lt-button">Save</button>
|
|
184
|
+
</div>
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
Below the root element the browser then ignores the host's CSS without a
|
|
188
|
+
layer, unless a rule of the host's wins on specificity as described below, and
|
|
189
|
+
LO-TEK's layer applies again. The rule is in `lotek.css` and in
|
|
190
|
+
`https://cdn.jsdelivr.net/npm/@lo-tek/interfaces@0.37.0/src/tokens/boundary.css`.
|
|
191
|
+
Fonts and other inherited properties still come from the host, and the
|
|
192
|
+
`--lt-*` variables work. Three things follow from it:
|
|
193
|
+
|
|
194
|
+
- Your own CSS inside the boundary must be in a layer after `lotek`. CSS
|
|
195
|
+
without a layer disappears there in the same way as the host's.
|
|
196
|
+
- Elements without a LO-TEK class lose the host's CSS without a layer. A layer
|
|
197
|
+
the host has declared before `lotek`, such as Tailwind's Preflight in
|
|
198
|
+
`base`, still applies where LO-TEK sets nothing.
|
|
199
|
+
- The boundary has the specificity (0,2,0). A rule from the host with the same
|
|
200
|
+
specificity wins if it is loaded after the boundary, and one with more
|
|
201
|
+
always wins. So do `!important` and layers the host has declared after
|
|
202
|
+
`lotek`.
|
|
203
|
+
|
|
204
|
+
LO-TEK sets `color-scheme` only where someone has chosen a theme: on
|
|
205
|
+
`[data-theme="light"]`, on `[data-theme="dark"]` and on the options of the
|
|
206
|
+
theme picker below. Bare `:root` never gets it. The property controls the
|
|
207
|
+
browser's own surfaces, that is, scrollbars, dropdowns and calendar panels,
|
|
208
|
+
and it is inherited. A child can opt out with `color-scheme: normal`, but that
|
|
209
|
+
is a counter-rule the host never asked to have to write: with the value on the
|
|
210
|
+
root, it applied to the whole document, including where the package is only a
|
|
211
|
+
guest. If the whole page should follow the system, write
|
|
212
|
+
`color-scheme: light dark` on `<html>` yourself, in the same way as you set
|
|
213
|
+
the layer order yourself.
|
|
214
|
+
|
|
215
|
+
### Letting the user choose a theme
|
|
216
|
+
|
|
217
|
+
`lt-theme-control` on a radio button makes `value` a theme choice. It is plain
|
|
218
|
+
CSS, without a line of JavaScript:
|
|
219
|
+
|
|
220
|
+
```html
|
|
221
|
+
<fieldset class="lt-toggle-group">
|
|
222
|
+
<legend class="lt-sr-only">Theme</legend>
|
|
223
|
+
<label class="lt-toggle-group__option">
|
|
224
|
+
<input class="lt-theme-control" type="radio" name="theme"
|
|
225
|
+
value="auto" checked /> Follow the system
|
|
226
|
+
</label>
|
|
227
|
+
<label class="lt-toggle-group__option">
|
|
228
|
+
<input class="lt-theme-control" type="radio" name="theme"
|
|
229
|
+
value="light" /> Light
|
|
230
|
+
</label>
|
|
231
|
+
<label class="lt-toggle-group__option">
|
|
232
|
+
<input class="lt-theme-control" type="radio" name="theme"
|
|
233
|
+
value="dark" /> Dark
|
|
234
|
+
</label>
|
|
235
|
+
</fieldset>
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
The choice controls two things. LO-TEK's colours come from the tokens, and the
|
|
239
|
+
browser's **own** surfaces from `color-scheme`: `light` gives `light`, `dark`
|
|
240
|
+
gives `dark`, and `auto` gives `light dark`. `light dark` is not a theme, but
|
|
241
|
+
the statement that the page works in both, so the browser can choose by the
|
|
242
|
+
system.
|
|
243
|
+
|
|
244
|
+
"Follow the system" has no theme block, and that is on purpose: a value
|
|
245
|
+
without a block matches nothing, and then the media query applies again.
|
|
246
|
+
|
|
247
|
+
Do not write `color-scheme` yourself when the picker is in use. Such a rule
|
|
248
|
+
outside a layer beats `@layer lotek` and locks the browser's surfaces to the
|
|
249
|
+
system while the user has chosen something else.
|
|
250
|
+
|
|
251
|
+
`light` and `dark` win over `data-theme` on `<html>`, so the server can send
|
|
252
|
+
the stored choice while a click still takes effect before the response is
|
|
253
|
+
back. `auto` does not: it means "no override from me", so if the server has
|
|
254
|
+
written `data-theme`, the server's value stands. For "follow the system" to
|
|
255
|
+
work at once, whatever stores the choice must also remove the attribute.
|
|
256
|
+
|
|
257
|
+
Two things it does not do. It **stores nothing**: submit the group in a form
|
|
258
|
+
and store the choice in a cookie the server reads, or in `localStorage`. And
|
|
259
|
+
it must be in the **same tree as `<html>`**, since `:has()` does not see out
|
|
260
|
+
of its own tree; a control inside a shadow root does not set the theme on the
|
|
261
|
+
page.
|
|
262
|
+
|
|
263
|
+
## 4. Web components
|
|
264
|
+
|
|
265
|
+
Three rules apply to all of them:
|
|
266
|
+
|
|
267
|
+
1. **`defineLt*()` runs once** in the page template, not once per component.
|
|
268
|
+
The import has no side effect on its own; it is the `define` call that
|
|
269
|
+
registers the element.
|
|
270
|
+
2. **Boolean attributes are true as long as they are present.**
|
|
271
|
+
`hidden="false"`, `disabled="false"` and `open="false"` turn it *on*. To
|
|
272
|
+
turn any of them off, remove the attribute entirely.
|
|
273
|
+
3. **You write the markup, the component adds the behaviour.** `<lt-field>`
|
|
274
|
+
does not create your label or your control. You write `for` on the label
|
|
275
|
+
and `id` on the control, or wrap the control in a `<label>`, so the field
|
|
276
|
+
has a name without JavaScript too. The component wires the help text and
|
|
277
|
+
the error text with `aria-describedby` and `aria-invalid`, and never writes
|
|
278
|
+
an id on the control: an id the server did not send makes an update from
|
|
279
|
+
the server replace the field, with the focus and what the user has typed.
|
|
280
|
+
The field is invalid when the error text is there without `hidden`.
|
|
281
|
+
|
|
282
|
+
| Element | Category | Stylesheet | Registration | Attributes | Events | Classes inside |
|
|
283
|
+
| --- | --- | --- | --- | --- | --- | --- |
|
|
284
|
+
| `<lt-field>` | frame | `https://cdn.jsdelivr.net/npm/@lo-tek/interfaces@0.37.0/src/components/frame/field/field.css` | `defineLtField()` from `https://cdn.jsdelivr.net/npm/@lo-tek/interfaces@0.37.0/dist/components/frame/field/lt-field.js` | `disabled` (flag)<br>`optional` (flag)<br>`described-by` (text) | none | none |
|
|
285
|
+
| `<lt-tabs>` | frame | `https://cdn.jsdelivr.net/npm/@lo-tek/interfaces@0.37.0/src/components/frame/tabs/tabs.css` | `defineLtTabs()` from `https://cdn.jsdelivr.net/npm/@lo-tek/interfaces@0.37.0/dist/components/frame/tabs/lt-tabs.js` | `server-controlled` (flag)<br>`activation`: manual, automatic | `tab-select` (index) | `lt-tabs__list`<br>`lt-tabs__panel` |
|
|
286
|
+
| `<lt-error-summary>` | frame | `https://cdn.jsdelivr.net/npm/@lo-tek/interfaces@0.37.0/src/components/frame/error-summary/error-summary.css` | `defineLtErrorSummary()` from `https://cdn.jsdelivr.net/npm/@lo-tek/interfaces@0.37.0/dist/components/frame/error-summary/lt-error-summary.js` | `data-autofocus`: false, true<br>`hidden` (flag) | none | `lt-error-summary`<br>`lt-error-summary__title` |
|
|
287
|
+
| `<lt-popover>` | frame | `https://cdn.jsdelivr.net/npm/@lo-tek/interfaces@0.37.0/src/components/frame/popover/popover.css` | `defineLtPopover()` from `https://cdn.jsdelivr.net/npm/@lo-tek/interfaces@0.37.0/dist/components/frame/popover/lt-popover.js` | `open` (flag)<br>`placement`: bottom-start, bottom-end, top-start, top-end<br>`server-controlled` (flag) | `popover-toggle` (open) | `lt-popover` |
|
|
288
|
+
| `<lt-suggestion>` | frame | `https://cdn.jsdelivr.net/npm/@lo-tek/interfaces@0.37.0/src/components/frame/suggestion/suggestion.css` | `defineLtSuggestion()` from `https://cdn.jsdelivr.net/npm/@lo-tek/interfaces@0.37.0/dist/components/frame/suggestion/lt-suggestion.js` | `prefiltered` (flag)<br>`count-none` (text)<br>`count-zero` (text)<br>`count-one` (text)<br>`count-two` (text)<br>`count-few` (text)<br>`count-many` (text)<br>`count-other` (text)<br>`server-controlled` (flag) | `suggestion-select` (value, label) | `lt-suggestion__list`<br>`lt-suggestion__option`<br>`lt-suggestion__value`<br>`lt-suggestion__empty` |
|
|
289
|
+
| `<lt-dialog>` | frame | `https://cdn.jsdelivr.net/npm/@lo-tek/interfaces@0.37.0/src/components/frame/dialog/dialog.css` | `defineLtDialog()` from `https://cdn.jsdelivr.net/npm/@lo-tek/interfaces@0.37.0/dist/components/frame/dialog/lt-dialog.js` | `open` (flag)<br>`server-controlled` (flag) | `dialog-toggle` (open, returnValue) | `lt-dialog` (`data-color`: brand, info, success, warning, danger)<br>`lt-dialog__body`<br>`lt-dialog__title`<br>`lt-dialog__footer`<br>`lt-dialog__header`<br>`lt-dialog__subtitle` |
|
|
290
|
+
| `<lt-toast>` | standalone | `https://cdn.jsdelivr.net/npm/@lo-tek/interfaces@0.37.0/src/components/standalone/toast/toast.css` | `defineLtToast()` from `https://cdn.jsdelivr.net/npm/@lo-tek/interfaces@0.37.0/dist/components/standalone/toast/lt-toast.js` | `duration` (number)<br>`label` (text)<br>`close-label` (text) | `toast-dismiss` | `lt-toast`<br>`lt-toast__message`<br>`lt-toast__close` |
|
|
291
|
+
| `<lt-session-timeout>` | frame | `https://cdn.jsdelivr.net/npm/@lo-tek/interfaces@0.37.0/src/components/frame/session-timeout/session-timeout.css` | `defineLtSessionTimeout()` from `https://cdn.jsdelivr.net/npm/@lo-tek/interfaces@0.37.0/dist/components/frame/session-timeout/lt-session-timeout.js` | `warn-at` (number)<br>`expires-at` (number)<br>`activity-interval` (number) | `session-warn`<br>`session-extend`<br>`session-logout`<br>`session-expired`<br>`session-activity` | `lt-session-timeout`<br>`lt-session-timeout__dialog`<br>`lt-session-timeout__title`<br>`lt-session-timeout__text`<br>`lt-session-timeout__count`<br>`lt-session-timeout__actions` |
|
|
292
|
+
| `<lt-connection-status>` | standalone | `https://cdn.jsdelivr.net/npm/@lo-tek/interfaces@0.37.0/src/components/standalone/connection-status/connection-status.css` | `defineLtConnectionStatus()` from `https://cdn.jsdelivr.net/npm/@lo-tek/interfaces@0.37.0/dist/components/standalone/connection-status/lt-connection-status.js` | `offline-text` (text)<br>`online-text` (text) | `connection-lost`<br>`connection-restored` | `lt-connection-status`<br>`lt-connection-status__bar` |
|
|
293
|
+
|
|
294
|
+
None of them uses shadow DOM. The content is in plain DOM, so `querySelector`,
|
|
295
|
+
`FormData` and ordinary CSS work straight into it.
|
|
296
|
+
|
|
297
|
+
## 5. A field in a template
|
|
298
|
+
|
|
299
|
+
```html
|
|
300
|
+
<lt-field>
|
|
301
|
+
<label class="lt-label" for="name" data-required="symbol">Full name</label>
|
|
302
|
+
<input class="lt-input" id="name" type="text" name="name" value="{{.Name}}" required />
|
|
303
|
+
{{if .Error}}<p class="lt-error-text">{{.Error}}</p>{{end}}
|
|
304
|
+
</lt-field>
|
|
305
|
+
```
|
|
306
|
+
|
|
307
|
+
The error text is rendered only when the field is invalid, and that is enough:
|
|
308
|
+
the component counts the field as invalid when the error text is visible.
|
|
309
|
+
`value` is always written, so what the user typed is still there when the
|
|
310
|
+
server sends the form back.
|
|
311
|
+
|
|
312
|
+
In a loop the id comes from a key in the data, never from the index or a
|
|
313
|
+
counter:
|
|
314
|
+
|
|
315
|
+
```html
|
|
316
|
+
{{range .Municipalities}}
|
|
317
|
+
<lt-field>
|
|
318
|
+
<label for="note-{{.Code}}">{{.Name}}</label>
|
|
319
|
+
<input class="lt-input" id="note-{{.Code}}" name="note-{{.Code}}" value="{{.Note}}" />
|
|
320
|
+
</lt-field>
|
|
321
|
+
{{end}}
|
|
322
|
+
```
|
|
323
|
+
|
|
324
|
+
The registration, once in the page template:
|
|
325
|
+
|
|
326
|
+
```html
|
|
327
|
+
<script type="module">
|
|
328
|
+
import { defineLtField } from
|
|
329
|
+
"https://cdn.jsdelivr.net/npm/@lo-tek/interfaces@0.37.0/dist/components/frame/field/lt-field.js"
|
|
330
|
+
|
|
331
|
+
defineLtField()
|
|
332
|
+
</script>
|
|
333
|
+
```
|
|
334
|
+
|
|
335
|
+
## 6. When the server sends new HTML
|
|
336
|
+
|
|
337
|
+
If you patch the page as it runs, with htmx, Turbo, Datastar or your own
|
|
338
|
+
`innerHTML` update, the question is what decides the state. By default the web
|
|
339
|
+
component does: `<lt-tabs>` remembers the tab the user selected, and puts it
|
|
340
|
+
back when a patch tears the selection away. The template needs nothing for
|
|
341
|
+
that.
|
|
342
|
+
|
|
343
|
+
This assumes the patch keeps the elements and only changes the attributes, as
|
|
344
|
+
a morph does: Datastar's `outer` and `inner`, htmx with the idiomorph
|
|
345
|
+
extension and Turbo 8 with morphing. The selection is tied to the link itself.
|
|
346
|
+
If the patch replaces the nodes, as `innerHTML`, htmx's ordinary `innerHTML`
|
|
347
|
+
and `outerHTML` swaps, Datastar's `replace` and Turbo without morphing do, the
|
|
348
|
+
tab is a different one. The component then selects the tab the server marked
|
|
349
|
+
with `aria-selected="true"`, otherwise the one the URL points to, otherwise
|
|
350
|
+
the one whose panel the server left without `hidden`, otherwise the first. If
|
|
351
|
+
the server wants to decide, it marks the tab and writes `hidden="until-found"`
|
|
352
|
+
on the other panels, or decides the state alone with `server-controlled`.
|
|
353
|
+
|
|
354
|
+
A morph keeps an element only when the id matches: Datastar and idiomorph do
|
|
355
|
+
not morph an element with an id into one without, they replace it. The
|
|
356
|
+
components therefore never write an id on what the user touches: the field in
|
|
357
|
+
`<lt-field>` and `<lt-suggestion>`, and the tabs in `<lt-tabs>`. Write `for`
|
|
358
|
+
on the label and `id` on the field, or wrap the field in the label. The tabs
|
|
359
|
+
are links without an id, and the panels have the id the link points to, the
|
|
360
|
+
same on every render. The panel in `<lt-popover>` needs an id in the same way,
|
|
361
|
+
for `aria-controls` on the button; the component creates none. The list and
|
|
362
|
+
the options in `<lt-suggestion>` can be replaced; the component wires them
|
|
363
|
+
again and finds the highlighted option again by its text. `<lt-field>` and
|
|
364
|
+
`<lt-suggestion>` warn in the console when a patch replaces the field with one
|
|
365
|
+
that has another id, the same `name` and another value, and `<lt-popover>`
|
|
366
|
+
when a patch replaces the open panel with one that has another id. `<lt-tabs>`
|
|
367
|
+
repairs the selection without a word.
|
|
368
|
+
|
|
369
|
+
If the server should be able to move the state, as in "go on to step 2", say
|
|
370
|
+
so with `server-controlled`. Then every patch decides, and the component stops
|
|
371
|
+
putting the user's choice back:
|
|
372
|
+
|
|
373
|
+
```html
|
|
374
|
+
<lt-tabs server-controlled>
|
|
375
|
+
<ul class="lt-tabs__list" aria-label="Parts of the case">
|
|
376
|
+
<li><a href="#application">Application</a></li>
|
|
377
|
+
<li><a href="#attachments">Attachments</a></li>
|
|
378
|
+
</ul>
|
|
379
|
+
<section class="lt-tabs__panel" id="application">…</section>
|
|
380
|
+
<section class="lt-tabs__panel" id="attachments" hidden="until-found">…</section>
|
|
381
|
+
</lt-tabs>
|
|
382
|
+
```
|
|
383
|
+
|
|
384
|
+
The attribute exists on `<lt-tabs>`, `<lt-popover>`, `<lt-dialog>` and
|
|
385
|
+
`<lt-suggestion>`. Without it the server and the component would fight over
|
|
386
|
+
the same state. Note that the state is always in the markup the server sent:
|
|
387
|
+
`aria-selected` on the tab and `hidden` on the panel in `<lt-tabs>`, `open` on
|
|
388
|
+
`<lt-popover>` and `<lt-dialog>`, and `hidden` on the list and `aria-expanded`
|
|
389
|
+
on the field in `<lt-suggestion>`.
|
|
390
|
+
|
|
391
|
+
## 7. The check is the only thing that reads your markup
|
|
392
|
+
|
|
393
|
+
```bash
|
|
394
|
+
npx @lo-tek/interfaces check templates/*.html
|
|
395
|
+
```
|
|
396
|
+
|
|
397
|
+
One finding gives an error code, so it belongs in CI next to the tests. It
|
|
398
|
+
catches `lt-buton`, `data-variant="secundary"`, `<lt-modal>` and `<lt-field>`
|
|
399
|
+
without a control or a label.
|
|
400
|
+
|
|
401
|
+
It is made for templates. Comments, `<script>` and `<style>` are skipped, and
|
|
402
|
+
`<?…?>` and `<%…%>` inside a tag do not end it early. These are tested and
|
|
403
|
+
give no false findings:
|
|
404
|
+
|
|
405
|
+
```html
|
|
406
|
+
<button class="lt-button {{.Extra}}">Send</button>
|
|
407
|
+
<button class="lt-button" data-variant="{{.Variant}}">Send</button>
|
|
408
|
+
<span class="lt-badge" data-color="{% if x %}danger{% endif %}">1</span>
|
|
409
|
+
<button class="lt-button" data-variant="<?= $variant ?>">Send</button>
|
|
410
|
+
<button class="lt-button" data-variant="@variant">Send</button>
|
|
411
|
+
<button class="lt-button" data-variant="<%= variant %>">Send</button>
|
|
412
|
+
```
|
|
413
|
+
|
|
414
|
+
When the code produces the HTML as strings, there is no file to check. Then
|
|
415
|
+
check the page as the server sends it, as a whole page, with the wiring
|
|
416
|
+
included:
|
|
417
|
+
|
|
418
|
+
```bash
|
|
419
|
+
npx @lo-tek/interfaces check http://localhost:8080/form
|
|
420
|
+
curl -s http://localhost:8080/form | npx @lo-tek/interfaces check --rendered
|
|
421
|
+
```
|
|
422
|
+
|
|
423
|
+
In a test written in JavaScript, `diagnosePage` does the same:
|
|
424
|
+
|
|
425
|
+
```js
|
|
426
|
+
import { diagnosePage } from "@lo-tek/interfaces/diagnostics"
|
|
427
|
+
|
|
428
|
+
const findings = diagnosePage(html)
|
|
429
|
+
// findings is empty when the page is correct
|
|
430
|
+
```
|
|
431
|
+
|
|
432
|
+
The check is also in the editor as you type. The VS Code extension "LO-TEK for
|
|
433
|
+
VS Code" gives completion, explanations, error messages and quick fixes in
|
|
434
|
+
sixteen template languages. WebStorm and IntelliJ IDEA Ultimate read
|
|
435
|
+
`web-types.json` from the package without any extension, and the plugin
|
|
436
|
+
"LO-TEK for IntelliJ" from JetBrains Marketplace adds the error messages and
|
|
437
|
+
completion in HTML in a string marked with `@Language("HTML")` or
|
|
438
|
+
`// language=HTML`.
|
|
439
|
+
|
|
440
|
+
On the JVM without Node there is LO-TEK for Kotlin
|
|
441
|
+
(https://lo-tek.sobernetics.no/kotlin/). `lotek.jar` is the command line as
|
|
442
|
+
`java -jar lotek.jar check`, and is attached to every release on GitHub:
|
|
443
|
+
https://github.com/MarkusAugust/lo-tek/releases/latest. The Maven package
|
|
444
|
+
`io.github.markusaugust:lo-tek-interfaces` with `assertLotek(html)` and the
|
|
445
|
+
Gradle plugin `io.github.markusaugust.lo-tek` are on Maven Central, with the
|
|
446
|
+
same version as the npm package. Not every npm version is on Maven: use the
|
|
447
|
+
newest one there, and never write a `version` you have not seen on Central.
|
|
448
|
+
|
|
449
|
+
## Known pitfalls
|
|
450
|
+
|
|
451
|
+
| Symptom | Cause |
|
|
452
|
+
| --- | --- |
|
|
453
|
+
| The styles are missing | The `<link>` to `lotek.css` is missing, or its address answers 404. With one stylesheet per component instead, `tokens.css` is not loaded |
|
|
454
|
+
| An `<lt-toast>` or `<lt-connection-status>` shows nothing, an `<lt-session-timeout>` never warns, or another component does nothing | The `define` function has not run. `<lt-toast>` and `<lt-connection-status>` create their content themselves and are empty without it, and `<lt-session-timeout>` does not count the time. The markup in the others comes from you and is there regardless, with two exceptions until they are registered. `<lt-tabs>` shows one panel: of those the server left without `hidden`, the one the URL points to, otherwise the first, and under `server-controlled` always the first. `<lt-suggestion>` hides the list |
|
|
455
|
+
| A component speaks English on a page in another language | The text in the markup comes from you, and is written with the app's own translation setup. The few default texts the package has are replaced with `label` and `close-label` on `<lt-toast>`, `offline-text` and `online-text` on `<lt-connection-status>`, `count-none`, `count-one` and `count-other` on `<lt-suggestion>`, and `--lt-label-required-text`, `--lt-label-optional-text` and `--lt-label-required-symbol` in CSS. Numbers and durations follow the nearest `lang`, usually the one on `<html>`. See https://lo-tek.sobernetics.no/translation/ |
|
|
456
|
+
| The error text never shows, and the field counts as valid | `hidden="false"` is set on the error text, and it hides it all the same. The attribute must be removed, not set to `false` |
|
|
457
|
+
| The component does nothing, and nothing says so | The registration runs only on the server, where it does nothing. It must also run in the browser |
|
|
458
|
+
| `SyntaxError` in the browser | TypeScript syntax in a `<script type="module">` without a build step |
|
|
459
|
+
|
|
460
|
+
## When CSS is not enough
|
|
461
|
+
|
|
462
|
+
The components are customised with tokens and `--lt-` variables. If that is
|
|
463
|
+
not enough, `npx @lo-tek/interfaces takeover <component>` copies the source
|
|
464
|
+
code of one component into `src/lotek/<component>/`, so the code is yours to
|
|
465
|
+
change. The copy is TypeScript that imports from the package by name, so it
|
|
466
|
+
needs a build step. It is renamed from `lt-` to `app-`, and a
|
|
467
|
+
`lotek-manifest.json` next to it teaches the check the new names:
|
|
468
|
+
`npx @lo-tek/interfaces check --manifest=src/lotek/<component>/lotek-manifest.json <files>`.
|
|
469
|
+
A complete colour theme from your brand colours is made with
|
|
470
|
+
`npx @lo-tek/interfaces theme`.
|
|
471
|
+
|
|
472
|
+
All of this, with live examples: https://lo-tek.sobernetics.no/
|
|
Binary file
|
package/core/lotek.wasm
ADDED
|
Binary file
|
package/dist/cli.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* The LO-TEK command line, `npx @lo-tek/interfaces`.
|
|
4
|
+
*
|
|
5
|
+
* The commands are written in Rust and run as the WASI module
|
|
6
|
+
* `core/lotek.wasm`. The host, which opens the file system and fetches
|
|
7
|
+
* addresses, is in `wasi-host.ts`. The package is this one: the command line
|
|
8
|
+
* reads the manifest, the colour contract, the rulebooks and the components
|
|
9
|
+
* from here.
|
|
10
|
+
*/
|
|
11
|
+
export {};
|
|
12
|
+
//# sourceMappingURL=cli.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AAEA;;;;;;;;GAQG"}
|
package/dist/cli.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/// <reference types="node" />
|
|
3
|
+
/**
|
|
4
|
+
* The LO-TEK command line, `npx @lo-tek/interfaces`.
|
|
5
|
+
*
|
|
6
|
+
* The commands are written in Rust and run as the WASI module
|
|
7
|
+
* `core/lotek.wasm`. The host, which opens the file system and fetches
|
|
8
|
+
* addresses, is in `wasi-host.ts`. The package is this one: the command line
|
|
9
|
+
* reads the manifest, the colour contract, the rulebooks and the components
|
|
10
|
+
* from here.
|
|
11
|
+
*/
|
|
12
|
+
import { runCommandLine } from "./wasi-host.js";
|
|
13
|
+
process.exit(await runCommandLine(new URL("../core/lotek.wasm", import.meta.url), process.argv.slice(2), new URL("..", import.meta.url)));
|
|
14
|
+
//# sourceMappingURL=cli.js.map
|
package/dist/cli.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AACA,8BAA8B;AAC9B;;;;;;;;GAQG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AAE/C,OAAO,CAAC,IAAI,CACV,MAAM,cAAc,CAClB,IAAI,GAAG,CAAC,oBAAoB,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,EAC9C,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,EACrB,IAAI,GAAG,CAAC,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAC/B,CACF,CAAA"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
export declare const ACCORDION_CLASS: "lt-accordion";
|
|
2
|
+
/** The content shown when the panel is open. */
|
|
3
|
+
export declare const ACCORDION_CONTENT_CLASS: "lt-accordion__content";
|
|
4
|
+
export declare const accordionVariants: readonly ["default", "plain"];
|
|
5
|
+
export type AccordionVariant = (typeof accordionVariants)[number];
|
|
6
|
+
export type NonDefaultAccordionVariant = Exclude<AccordionVariant, "default">;
|
|
7
|
+
export type AccordionOptions = {
|
|
8
|
+
/** Its own frame, or just a line between the panels. Default: `default`. */
|
|
9
|
+
variant?: AccordionVariant;
|
|
10
|
+
};
|
|
11
|
+
export type AccordionAttributes = {
|
|
12
|
+
class: typeof ACCORDION_CLASS;
|
|
13
|
+
"data-variant"?: NonDefaultAccordionVariant;
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* The attributes for a panel that can be expanded.
|
|
17
|
+
*
|
|
18
|
+
* The class goes on a `<details>` with a `<summary>` first. The browser
|
|
19
|
+
* handles opening, closing, the keyboard and screen readers announcing
|
|
20
|
+
* "expanded" or "collapsed". Build the same thing from buttons and
|
|
21
|
+
* `aria-expanded`, and all of that must be written again, and the browser's
|
|
22
|
+
* find in page no longer finds text inside a closed panel.
|
|
23
|
+
*
|
|
24
|
+
* ```ts
|
|
25
|
+
* <details {...accordion()}>
|
|
26
|
+
* <summary>Who can apply?</summary>
|
|
27
|
+
* <div class={accordion.content}>…</div>
|
|
28
|
+
* </details>
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
export declare const accordion: (({ variant }?: AccordionOptions) => AccordionAttributes) & {
|
|
32
|
+
/** The class on the content below the summary. */
|
|
33
|
+
content: "lt-accordion__content";
|
|
34
|
+
variants: readonly ["default", "plain"];
|
|
35
|
+
isVariant: (value: string) => value is "default" | "plain";
|
|
36
|
+
};
|
|
37
|
+
//# sourceMappingURL=accordion.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"accordion.d.ts","sourceRoot":"","sources":["../../../../src/components/css/accordion/accordion.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,eAAe,EAAG,cAAuB,CAAA;AACtD,gDAAgD;AAChD,eAAO,MAAM,uBAAuB,EAAG,uBAAgC,CAAA;AAEvE,eAAO,MAAM,iBAAiB,+BAAgC,CAAA;AAE9D,MAAM,MAAM,gBAAgB,GAAG,CAAC,OAAO,iBAAiB,CAAC,CAAC,MAAM,CAAC,CAAA;AACjE,MAAM,MAAM,0BAA0B,GAAG,OAAO,CAAC,gBAAgB,EAAE,SAAS,CAAC,CAAA;AAE7E,MAAM,MAAM,gBAAgB,GAAG;IAC7B,4EAA4E;IAC5E,OAAO,CAAC,EAAE,gBAAgB,CAAA;CAC3B,CAAA;AAED,MAAM,MAAM,mBAAmB,GAAG;IAChC,KAAK,EAAE,OAAO,eAAe,CAAA;IAC7B,cAAc,CAAC,EAAE,0BAA0B,CAAA;CAC5C,CAAA;AAED;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,SAAS,kBACM,gBAAgB,KAAQ,mBAAmB;IAMnE,kDAAkD;;;;CAKrD,CAAA"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { attributes, createGuard } from "../shared.js";
|
|
2
|
+
export const ACCORDION_CLASS = "lt-accordion";
|
|
3
|
+
/** The content shown when the panel is open. */
|
|
4
|
+
export const ACCORDION_CONTENT_CLASS = "lt-accordion__content";
|
|
5
|
+
export const accordionVariants = ["default", "plain"];
|
|
6
|
+
/**
|
|
7
|
+
* The attributes for a panel that can be expanded.
|
|
8
|
+
*
|
|
9
|
+
* The class goes on a `<details>` with a `<summary>` first. The browser
|
|
10
|
+
* handles opening, closing, the keyboard and screen readers announcing
|
|
11
|
+
* "expanded" or "collapsed". Build the same thing from buttons and
|
|
12
|
+
* `aria-expanded`, and all of that must be written again, and the browser's
|
|
13
|
+
* find in page no longer finds text inside a closed panel.
|
|
14
|
+
*
|
|
15
|
+
* ```ts
|
|
16
|
+
* <details {...accordion()}>
|
|
17
|
+
* <summary>Who can apply?</summary>
|
|
18
|
+
* <div class={accordion.content}>…</div>
|
|
19
|
+
* </details>
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
export const accordion = Object.assign(({ variant = "default" } = {}) => attributes({
|
|
23
|
+
class: ACCORDION_CLASS,
|
|
24
|
+
"data-variant": variant === "default" ? undefined : variant,
|
|
25
|
+
}), {
|
|
26
|
+
/** The class on the content below the summary. */
|
|
27
|
+
content: ACCORDION_CONTENT_CLASS,
|
|
28
|
+
variants: accordionVariants,
|
|
29
|
+
isVariant: createGuard(accordionVariants),
|
|
30
|
+
});
|
|
31
|
+
//# sourceMappingURL=accordion.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"accordion.js","sourceRoot":"","sources":["../../../../src/components/css/accordion/accordion.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAEtD,MAAM,CAAC,MAAM,eAAe,GAAG,cAAuB,CAAA;AACtD,gDAAgD;AAChD,MAAM,CAAC,MAAM,uBAAuB,GAAG,uBAAgC,CAAA;AAEvE,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,SAAS,EAAE,OAAO,CAAU,CAAA;AAe9D;;;;;;;;;;;;;;;GAeG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,MAAM,CAAC,MAAM,CACpC,CAAC,EAAE,OAAO,GAAG,SAAS,KAAuB,EAAE,EAAuB,EAAE,CACtE,UAAU,CAAC;IACT,KAAK,EAAE,eAAe;IACtB,cAAc,EAAE,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,OAAO;CAC5D,CAAC,EACJ;IACE,kDAAkD;IAClD,OAAO,EAAE,uBAAuB;IAChC,QAAQ,EAAE,iBAAiB;IAC3B,SAAS,EAAE,WAAW,CAAC,iBAAiB,CAAC;CAC1C,CACF,CAAA"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
export declare const ALERT_CLASS: "lt-alert";
|
|
2
|
+
/** The heading inside the message. */
|
|
3
|
+
export declare const ALERT_TITLE_CLASS: "lt-alert__title";
|
|
4
|
+
export declare const alertColors: readonly ["info", "success", "warning", "danger"];
|
|
5
|
+
export type AlertColor = (typeof alertColors)[number];
|
|
6
|
+
export type NonNeutralAlertColor = AlertColor;
|
|
7
|
+
export type AlertOptions = {
|
|
8
|
+
/** What the message means. Left out, it is the neutral one. */
|
|
9
|
+
color?: AlertColor;
|
|
10
|
+
};
|
|
11
|
+
export type AlertAttributes = {
|
|
12
|
+
class: typeof ALERT_CLASS;
|
|
13
|
+
"data-color"?: AlertColor;
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* The attributes for a message about the whole page or a whole form.
|
|
17
|
+
*
|
|
18
|
+
* The role is not set here, because it depends on when the message comes.
|
|
19
|
+
* If it is in the markup from the start, it should have no role. If it
|
|
20
|
+
* appears while the page is idle, it needs `role="status"`, or
|
|
21
|
+
* `role="alert"` if the user must stop.
|
|
22
|
+
*
|
|
23
|
+
* ```ts
|
|
24
|
+
* <div {...alert({ color: "warning" })}>
|
|
25
|
+
* <p class={alert.title}>The application has not been sent</p>
|
|
26
|
+
* </div>
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
29
|
+
export declare const alert: (({ color }?: AlertOptions) => AlertAttributes) & {
|
|
30
|
+
/** The class on the heading inside the message. */
|
|
31
|
+
title: "lt-alert__title";
|
|
32
|
+
colors: readonly ["info", "success", "warning", "danger"];
|
|
33
|
+
isColor: (value: string) => value is "warning" | "info" | "success" | "danger";
|
|
34
|
+
};
|
|
35
|
+
//# sourceMappingURL=alert.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"alert.d.ts","sourceRoot":"","sources":["../../../../src/components/css/alert/alert.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,WAAW,EAAG,UAAmB,CAAA;AAC9C,sCAAsC;AACtC,eAAO,MAAM,iBAAiB,EAAG,iBAA0B,CAAA;AAE3D,eAAO,MAAM,WAAW,mDAAoD,CAAA;AAE5E,MAAM,MAAM,UAAU,GAAG,CAAC,OAAO,WAAW,CAAC,CAAC,MAAM,CAAC,CAAA;AACrD,MAAM,MAAM,oBAAoB,GAAG,UAAU,CAAA;AAE7C,MAAM,MAAM,YAAY,GAAG;IACzB,+DAA+D;IAC/D,KAAK,CAAC,EAAE,UAAU,CAAA;CACnB,CAAA;AAED,MAAM,MAAM,eAAe,GAAG;IAC5B,KAAK,EAAE,OAAO,WAAW,CAAA;IACzB,YAAY,CAAC,EAAE,UAAU,CAAA;CAC1B,CAAA;AAED;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,KAAK,gBACJ,YAAY,KAAQ,eAAe;IAM7C,mDAAmD;;;;CAKtD,CAAA"}
|