@lo-tek/interfaces 0.0.0 → 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 +128 -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 +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 +398 -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 +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,104 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* The boundary towards a host page: `data-lt-boundary` on the root element of
|
|
3
|
+
* a component embedded in a page you do not control.
|
|
4
|
+
*
|
|
5
|
+
* This file is deliberately outside `@layer lotek`, the only one in the
|
|
6
|
+
* package. Unlayered styles beat every layer, so the host's
|
|
7
|
+
* `button { background: none }` removes the background from `.lt-button`.
|
|
8
|
+
* `revert-layer` in an unlayered rule ignores every unlayered rule for the
|
|
9
|
+
* element and falls back to the layers. Then `@layer lotek` applies again,
|
|
10
|
+
* and where no layer says anything, the browser's default rules apply.
|
|
11
|
+
*
|
|
12
|
+
* `all` does not touch custom properties, so `--lt-*` works as before. The
|
|
13
|
+
* root itself is not matched: it is left to the consumer, and inheritance
|
|
14
|
+
* from the host, such as the font, comes in through it.
|
|
15
|
+
*
|
|
16
|
+
* The attribute is written twice for specificity. With one, the rule was
|
|
17
|
+
* (0,1,0) and lost to common resets such as `button:not(:disabled)`,
|
|
18
|
+
* `a:hover` and `input[type="text"]`, which are all (0,1,1). Source order
|
|
19
|
+
* cannot decide it, since the host's stylesheet is often loaded after this
|
|
20
|
+
* one. A host rule with (0,2,0) wins if it comes after this one, one with
|
|
21
|
+
* more always wins, and so does `!important`.
|
|
22
|
+
*
|
|
23
|
+
* The pseudo-elements are the ones LO-TEK styles, and the ones normalize
|
|
24
|
+
* styles, since it is the most common reset a host has. Each has a rule of
|
|
25
|
+
* its own. A pseudo-element the browser does not recognise makes the whole
|
|
26
|
+
* rule invalid, and Firefox drops a list with `::picker(select)` in it, so
|
|
27
|
+
* the boundary would have disappeared there.
|
|
28
|
+
*/
|
|
29
|
+
|
|
30
|
+
[data-lt-boundary][data-lt-boundary] * {
|
|
31
|
+
all: revert-layer;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
[data-lt-boundary][data-lt-boundary] *::before {
|
|
35
|
+
all: revert-layer;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
[data-lt-boundary][data-lt-boundary] *::after {
|
|
39
|
+
all: revert-layer;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
[data-lt-boundary][data-lt-boundary] *::marker {
|
|
43
|
+
all: revert-layer;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
[data-lt-boundary][data-lt-boundary] *::placeholder {
|
|
47
|
+
all: revert-layer;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
[data-lt-boundary][data-lt-boundary] *::backdrop {
|
|
51
|
+
all: revert-layer;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
[data-lt-boundary][data-lt-boundary] *::file-selector-button {
|
|
55
|
+
all: revert-layer;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
[data-lt-boundary][data-lt-boundary] *::checkmark {
|
|
59
|
+
all: revert-layer;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
[data-lt-boundary][data-lt-boundary] *::picker-icon {
|
|
63
|
+
all: revert-layer;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
[data-lt-boundary][data-lt-boundary] *::picker(select) {
|
|
67
|
+
all: revert-layer;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
[data-lt-boundary][data-lt-boundary] *::-webkit-details-marker {
|
|
71
|
+
all: revert-layer;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
[data-lt-boundary][data-lt-boundary] *::-webkit-search-cancel-button {
|
|
75
|
+
all: revert-layer;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
[data-lt-boundary][data-lt-boundary] *::-webkit-search-decoration {
|
|
79
|
+
all: revert-layer;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
[data-lt-boundary][data-lt-boundary] *::-webkit-inner-spin-button {
|
|
83
|
+
all: revert-layer;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
[data-lt-boundary][data-lt-boundary] *::-webkit-outer-spin-button {
|
|
87
|
+
all: revert-layer;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
[data-lt-boundary][data-lt-boundary] *::-webkit-calendar-picker-indicator {
|
|
91
|
+
all: revert-layer;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
[data-lt-boundary][data-lt-boundary] *::-webkit-progress-bar {
|
|
95
|
+
all: revert-layer;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
[data-lt-boundary][data-lt-boundary] *::-webkit-progress-value {
|
|
99
|
+
all: revert-layer;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
[data-lt-boundary][data-lt-boundary] *::-moz-progress-bar {
|
|
103
|
+
all: revert-layer;
|
|
104
|
+
}
|
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$comment": "The colour contract: the families, LO-TEK's brand colours, the lightness and saturation per role, the layers only the neutral family has, the contrast requirements and the promises. Read by the core (core/src/theme/) and by the scripts in interfaces/. A promise with own: true is checked against the family's own role, otherwise against the layer in the neutral family.",
|
|
3
|
+
"families": [
|
|
4
|
+
"accent",
|
|
5
|
+
"visited",
|
|
6
|
+
"brand1",
|
|
7
|
+
"brand2",
|
|
8
|
+
"brand3",
|
|
9
|
+
"neutral",
|
|
10
|
+
"danger",
|
|
11
|
+
"warning",
|
|
12
|
+
"success"
|
|
13
|
+
],
|
|
14
|
+
"brands": {
|
|
15
|
+
"accent": "#1362ae",
|
|
16
|
+
"visited": "#5a77a8",
|
|
17
|
+
"brand1": "#0d7a5f",
|
|
18
|
+
"brand2": "#5b3fa0",
|
|
19
|
+
"brand3": "#b04c5c",
|
|
20
|
+
"neutral": "#24272b",
|
|
21
|
+
"danger": "#a82e39",
|
|
22
|
+
"warning": "#896508",
|
|
23
|
+
"success": "#316f2a"
|
|
24
|
+
},
|
|
25
|
+
"roles": {
|
|
26
|
+
"surface": {
|
|
27
|
+
"lightness": {
|
|
28
|
+
"light": 0.96,
|
|
29
|
+
"dark": 0.26
|
|
30
|
+
},
|
|
31
|
+
"chroma": 0.22
|
|
32
|
+
},
|
|
33
|
+
"borderSubtle": {
|
|
34
|
+
"lightness": {
|
|
35
|
+
"light": 0.88,
|
|
36
|
+
"dark": 0.34
|
|
37
|
+
},
|
|
38
|
+
"chroma": 0.35
|
|
39
|
+
},
|
|
40
|
+
"border": {
|
|
41
|
+
"lightness": {
|
|
42
|
+
"light": 0.575,
|
|
43
|
+
"dark": 0.625
|
|
44
|
+
},
|
|
45
|
+
"chroma": 0.55
|
|
46
|
+
},
|
|
47
|
+
"borderStrong": {
|
|
48
|
+
"lightness": {
|
|
49
|
+
"light": 0.48,
|
|
50
|
+
"dark": 0.74
|
|
51
|
+
},
|
|
52
|
+
"chroma": 0.6
|
|
53
|
+
},
|
|
54
|
+
"fill": {
|
|
55
|
+
"lightness": {
|
|
56
|
+
"light": 0.53,
|
|
57
|
+
"dark": 0.65
|
|
58
|
+
},
|
|
59
|
+
"chroma": 1
|
|
60
|
+
},
|
|
61
|
+
"text": {
|
|
62
|
+
"lightness": {
|
|
63
|
+
"light": 0.42,
|
|
64
|
+
"dark": 0.82
|
|
65
|
+
},
|
|
66
|
+
"chroma": 0.85
|
|
67
|
+
},
|
|
68
|
+
"textStrong": {
|
|
69
|
+
"lightness": {
|
|
70
|
+
"light": 0.28,
|
|
71
|
+
"dark": 0.93
|
|
72
|
+
},
|
|
73
|
+
"chroma": 0.5
|
|
74
|
+
},
|
|
75
|
+
"textSubtle": {
|
|
76
|
+
"lightness": {
|
|
77
|
+
"light": 0.485,
|
|
78
|
+
"dark": 0.73
|
|
79
|
+
},
|
|
80
|
+
"chroma": 0.7
|
|
81
|
+
},
|
|
82
|
+
"content": {
|
|
83
|
+
"lightness": {
|
|
84
|
+
"light": 0.99,
|
|
85
|
+
"dark": 0.16
|
|
86
|
+
},
|
|
87
|
+
"chroma": 0.04
|
|
88
|
+
}
|
|
89
|
+
},
|
|
90
|
+
"layers": {
|
|
91
|
+
"canvas": {
|
|
92
|
+
"lightness": {
|
|
93
|
+
"light": 1,
|
|
94
|
+
"dark": 0.18
|
|
95
|
+
},
|
|
96
|
+
"chroma": 0.08
|
|
97
|
+
},
|
|
98
|
+
"raised": {
|
|
99
|
+
"lightness": {
|
|
100
|
+
"light": 0.92,
|
|
101
|
+
"dark": 0.32
|
|
102
|
+
},
|
|
103
|
+
"chroma": 0.12
|
|
104
|
+
}
|
|
105
|
+
},
|
|
106
|
+
"requirements": {
|
|
107
|
+
"text": 4.6,
|
|
108
|
+
"graphic": 3.1
|
|
109
|
+
},
|
|
110
|
+
"promises": [
|
|
111
|
+
{
|
|
112
|
+
"name": "text on canvas",
|
|
113
|
+
"foreground": "text",
|
|
114
|
+
"background": "canvas",
|
|
115
|
+
"own": false,
|
|
116
|
+
"requirement": "text"
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
"name": "text on surface",
|
|
120
|
+
"foreground": "text",
|
|
121
|
+
"background": "surface",
|
|
122
|
+
"own": false,
|
|
123
|
+
"requirement": "text"
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
"name": "text on raised",
|
|
127
|
+
"foreground": "text",
|
|
128
|
+
"background": "raised",
|
|
129
|
+
"own": false,
|
|
130
|
+
"requirement": "text"
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
"name": "text on its own surface",
|
|
134
|
+
"foreground": "text",
|
|
135
|
+
"background": "surface",
|
|
136
|
+
"own": true,
|
|
137
|
+
"requirement": "text"
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
"name": "textStrong on canvas",
|
|
141
|
+
"foreground": "textStrong",
|
|
142
|
+
"background": "canvas",
|
|
143
|
+
"own": false,
|
|
144
|
+
"requirement": "text"
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
"name": "textStrong on surface",
|
|
148
|
+
"foreground": "textStrong",
|
|
149
|
+
"background": "surface",
|
|
150
|
+
"own": false,
|
|
151
|
+
"requirement": "text"
|
|
152
|
+
},
|
|
153
|
+
{
|
|
154
|
+
"name": "textStrong on raised",
|
|
155
|
+
"foreground": "textStrong",
|
|
156
|
+
"background": "raised",
|
|
157
|
+
"own": false,
|
|
158
|
+
"requirement": "text"
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
"name": "textSubtle on canvas",
|
|
162
|
+
"foreground": "textSubtle",
|
|
163
|
+
"background": "canvas",
|
|
164
|
+
"own": false,
|
|
165
|
+
"requirement": "text"
|
|
166
|
+
},
|
|
167
|
+
{
|
|
168
|
+
"name": "textSubtle on surface",
|
|
169
|
+
"foreground": "textSubtle",
|
|
170
|
+
"background": "surface",
|
|
171
|
+
"own": false,
|
|
172
|
+
"requirement": "text"
|
|
173
|
+
},
|
|
174
|
+
{
|
|
175
|
+
"name": "textSubtle on raised",
|
|
176
|
+
"foreground": "textSubtle",
|
|
177
|
+
"background": "raised",
|
|
178
|
+
"own": false,
|
|
179
|
+
"requirement": "text"
|
|
180
|
+
},
|
|
181
|
+
{
|
|
182
|
+
"name": "border on canvas",
|
|
183
|
+
"foreground": "border",
|
|
184
|
+
"background": "canvas",
|
|
185
|
+
"own": false,
|
|
186
|
+
"requirement": "graphic"
|
|
187
|
+
},
|
|
188
|
+
{
|
|
189
|
+
"name": "border on raised",
|
|
190
|
+
"foreground": "border",
|
|
191
|
+
"background": "raised",
|
|
192
|
+
"own": false,
|
|
193
|
+
"requirement": "graphic"
|
|
194
|
+
},
|
|
195
|
+
{
|
|
196
|
+
"name": "border on its own surface",
|
|
197
|
+
"foreground": "border",
|
|
198
|
+
"background": "surface",
|
|
199
|
+
"own": true,
|
|
200
|
+
"requirement": "graphic"
|
|
201
|
+
},
|
|
202
|
+
{
|
|
203
|
+
"name": "fill on canvas",
|
|
204
|
+
"foreground": "fill",
|
|
205
|
+
"background": "canvas",
|
|
206
|
+
"own": false,
|
|
207
|
+
"requirement": "graphic"
|
|
208
|
+
},
|
|
209
|
+
{
|
|
210
|
+
"name": "fill on raised",
|
|
211
|
+
"foreground": "fill",
|
|
212
|
+
"background": "raised",
|
|
213
|
+
"own": false,
|
|
214
|
+
"requirement": "graphic"
|
|
215
|
+
},
|
|
216
|
+
{
|
|
217
|
+
"name": "content on top of fill",
|
|
218
|
+
"foreground": "content",
|
|
219
|
+
"background": "fill",
|
|
220
|
+
"own": true,
|
|
221
|
+
"requirement": "text"
|
|
222
|
+
},
|
|
223
|
+
{
|
|
224
|
+
"name": "content on top of text",
|
|
225
|
+
"foreground": "content",
|
|
226
|
+
"background": "text",
|
|
227
|
+
"own": true,
|
|
228
|
+
"requirement": "text"
|
|
229
|
+
}
|
|
230
|
+
]
|
|
231
|
+
}
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Colour arithmetic: sRGB, OKLCH and contrast, as `@lo-tek/interfaces/color`.
|
|
3
|
+
*
|
|
4
|
+
* The theme is computed in the core, written in Rust (`core/src/theme/color.rs`).
|
|
5
|
+
* These five calculations are the same, for anyone who wants to compute colours
|
|
6
|
+
* in JavaScript, including in the browser. The tests that check the colours a
|
|
7
|
+
* browser actually paints use them too, and so check the core against an
|
|
8
|
+
* independent implementation of the formula.
|
|
9
|
+
*
|
|
10
|
+
* The arithmetic is done in OKLCH, not HSL. In HSL, lightness means something
|
|
11
|
+
* different for each hue: `hsl(60 100% 50%)` is bright yellow and
|
|
12
|
+
* `hsl(240 100% 50%)` is almost black, with the same numbers. In OKLCH the
|
|
13
|
+
* lightness is the same perceived lightness whatever the hue, so the contract
|
|
14
|
+
* can set one lightness per role and apply it to every colour.
|
|
15
|
+
*
|
|
16
|
+
* Contrast is computed with the WCAG 2.1 formula, the same one the tests use,
|
|
17
|
+
* so the contract and the check agree.
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
export type Rgb = { r: number; g: number; b: number }
|
|
21
|
+
export type Oklch = { l: number; c: number; h: number }
|
|
22
|
+
|
|
23
|
+
/** Reads `#rrggbb` or `#rgb`. */
|
|
24
|
+
export function parseHex(hex: string): Rgb {
|
|
25
|
+
const clean = hex.trim().replace(/^#/, "")
|
|
26
|
+
const full =
|
|
27
|
+
clean.length === 3
|
|
28
|
+
? clean
|
|
29
|
+
.split("")
|
|
30
|
+
.map((char) => char + char)
|
|
31
|
+
.join("")
|
|
32
|
+
: clean
|
|
33
|
+
|
|
34
|
+
if (!/^[0-9a-fA-F]{6}$/.test(full)) {
|
|
35
|
+
throw new Error(`"${hex}" is not a valid hexadecimal colour`)
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
return {
|
|
39
|
+
r: Number.parseInt(full.slice(0, 2), 16),
|
|
40
|
+
g: Number.parseInt(full.slice(2, 4), 16),
|
|
41
|
+
b: Number.parseInt(full.slice(4, 6), 16),
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export function toHex({ r, g, b }: Rgb): string {
|
|
46
|
+
const channel = (value: number) =>
|
|
47
|
+
Math.round(Math.min(255, Math.max(0, value)))
|
|
48
|
+
.toString(16)
|
|
49
|
+
.padStart(2, "0")
|
|
50
|
+
|
|
51
|
+
return `#${channel(r)}${channel(g)}${channel(b)}`
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
function toLinear(channel: number): number {
|
|
55
|
+
const c = channel / 255
|
|
56
|
+
return c <= 0.04045 ? c / 12.92 : ((c + 0.055) / 1.055) ** 2.4
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
function fromLinear(channel: number): number {
|
|
60
|
+
const c =
|
|
61
|
+
channel <= 0.0031308
|
|
62
|
+
? channel * 12.92
|
|
63
|
+
: 1.055 * channel ** (1 / 2.4) - 0.055
|
|
64
|
+
return c * 255
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export function rgbToOklch({ r, g, b }: Rgb): Oklch {
|
|
68
|
+
const lr = toLinear(r)
|
|
69
|
+
const lg = toLinear(g)
|
|
70
|
+
const lb = toLinear(b)
|
|
71
|
+
|
|
72
|
+
const l = 0.4122214708 * lr + 0.5363325363 * lg + 0.0514459929 * lb
|
|
73
|
+
const m = 0.2119034982 * lr + 0.6806995451 * lg + 0.1073969566 * lb
|
|
74
|
+
const s = 0.0883024619 * lr + 0.2817188376 * lg + 0.6299787005 * lb
|
|
75
|
+
|
|
76
|
+
const l_ = Math.cbrt(l)
|
|
77
|
+
const m_ = Math.cbrt(m)
|
|
78
|
+
const s_ = Math.cbrt(s)
|
|
79
|
+
|
|
80
|
+
const lightness = 0.2104542553 * l_ + 0.793617785 * m_ - 0.0040720468 * s_
|
|
81
|
+
const a = 1.9779984951 * l_ - 2.428592205 * m_ + 0.4505937099 * s_
|
|
82
|
+
const bb = 0.0259040371 * l_ + 0.7827717662 * m_ - 0.808675766 * s_
|
|
83
|
+
|
|
84
|
+
return {
|
|
85
|
+
l: lightness,
|
|
86
|
+
c: Math.hypot(a, bb),
|
|
87
|
+
h: (Math.atan2(bb, a) * 180) / Math.PI,
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
function oklchToRgbRaw({ l, c, h }: Oklch): Rgb {
|
|
92
|
+
const rad = (h * Math.PI) / 180
|
|
93
|
+
const a = c * Math.cos(rad)
|
|
94
|
+
const b = c * Math.sin(rad)
|
|
95
|
+
|
|
96
|
+
const l_ = l + 0.3963377774 * a + 0.2158037573 * b
|
|
97
|
+
const m_ = l - 0.1055613458 * a - 0.0638541728 * b
|
|
98
|
+
const s_ = l - 0.0894841775 * a - 1.291485548 * b
|
|
99
|
+
|
|
100
|
+
const lr = l_ ** 3
|
|
101
|
+
const mr = m_ ** 3
|
|
102
|
+
const sr = s_ ** 3
|
|
103
|
+
|
|
104
|
+
return {
|
|
105
|
+
r: fromLinear(4.0767416621 * lr - 3.3077115913 * mr + 0.2309699292 * sr),
|
|
106
|
+
g: fromLinear(-1.2684380046 * lr + 2.6097574011 * mr - 0.3413193965 * sr),
|
|
107
|
+
b: fromLinear(-0.0041960863 * lr - 0.7034186147 * mr + 1.707614701 * sr),
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
function outside({ r, g, b }: Rgb): boolean {
|
|
112
|
+
const margin = 0.5
|
|
113
|
+
return [r, g, b].some(
|
|
114
|
+
(channel) => channel < -margin || channel > 255 + margin,
|
|
115
|
+
)
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* Converts an OKLCH colour to an rgb colour a screen can show.
|
|
120
|
+
*
|
|
121
|
+
* Not every combination of lightness and chroma can be shown in sRGB. If the
|
|
122
|
+
* colour falls outside, the chroma is reduced until it is inside, instead of
|
|
123
|
+
* clipping each channel separately. Clipping would change the hue.
|
|
124
|
+
*/
|
|
125
|
+
export function oklchToRgb(color: Oklch): Rgb {
|
|
126
|
+
const attempt = oklchToRgbRaw(color)
|
|
127
|
+
if (!outside(attempt)) return attempt
|
|
128
|
+
|
|
129
|
+
let low = 0
|
|
130
|
+
let high = color.c
|
|
131
|
+
|
|
132
|
+
for (let i = 0; i < 24; i += 1) {
|
|
133
|
+
const middle = (low + high) / 2
|
|
134
|
+
if (outside(oklchToRgbRaw({ ...color, c: middle }))) high = middle
|
|
135
|
+
else low = middle
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
return oklchToRgbRaw({ ...color, c: low })
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
function luminance({ r, g, b }: Rgb): number {
|
|
142
|
+
return 0.2126 * toLinear(r) + 0.7152 * toLinear(g) + 0.0722 * toLinear(b)
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
/** The contrast ratio between two colours, as WCAG 2.1 computes it. */
|
|
146
|
+
export function contrastRatio(a: Rgb, b: Rgb): number {
|
|
147
|
+
const la = luminance(a)
|
|
148
|
+
const lb = luminance(b)
|
|
149
|
+
return (Math.max(la, lb) + 0.05) / (Math.min(la, lb) + 0.05)
|
|
150
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The colour contract, as `@lo-tek/interfaces/contract`: what each role is,
|
|
3
|
+
* and what it promises.
|
|
4
|
+
*
|
|
5
|
+
* One colour layer, not two. A colour is a point in a matrix of **family**
|
|
6
|
+
* (what it means) and **role** (what it does), and every family has the same
|
|
7
|
+
* roles. The hue comes from the consumer, the lightness from the role, and so
|
|
8
|
+
* the contrast is guaranteed by construction rather than by a check
|
|
9
|
+
* afterwards.
|
|
10
|
+
*
|
|
11
|
+
* The numbers are in `color-contract.json`, which the core reads, and the
|
|
12
|
+
* arithmetic happens there. Here is the data, for anyone who wants to read it.
|
|
13
|
+
* A theme is built with `buildTheme` from `@lo-tek/interfaces/theme`, and a
|
|
14
|
+
* hand-written theme is checked with `inspectTheme` from
|
|
15
|
+
* `@lo-tek/interfaces/theme-check`.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
export {
|
|
19
|
+
type Appearance,
|
|
20
|
+
NEUTRAL_LAYERS,
|
|
21
|
+
REQUIREMENT,
|
|
22
|
+
ROLES,
|
|
23
|
+
type Role,
|
|
24
|
+
} from "./matrix-cells.js"
|