@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
package/dist/react.js
ADDED
|
@@ -0,0 +1,296 @@
|
|
|
1
|
+
import { accordion } from "./components/css/accordion/accordion.js";
|
|
2
|
+
import { alert } from "./components/css/alert/alert.js";
|
|
3
|
+
import { avatar } from "./components/css/avatar/avatar.js";
|
|
4
|
+
import { badge } from "./components/css/badge/badge.js";
|
|
5
|
+
import { breadcrumbs } from "./components/css/breadcrumbs/breadcrumbs.js";
|
|
6
|
+
import { button } from "./components/css/button/button.js";
|
|
7
|
+
import { card } from "./components/css/card/card.js";
|
|
8
|
+
import { checkbox } from "./components/css/checkbox/checkbox.js";
|
|
9
|
+
import { divider } from "./components/css/divider/divider.js";
|
|
10
|
+
import { errorText } from "./components/css/error-text/error-text.js";
|
|
11
|
+
import { fieldset, legend } from "./components/css/fieldset/fieldset.js";
|
|
12
|
+
import { fileUpload } from "./components/css/file-upload/file-upload.js";
|
|
13
|
+
import { heading } from "./components/css/heading/heading.js";
|
|
14
|
+
import { helpText } from "./components/css/help-text/help-text.js";
|
|
15
|
+
import { icon } from "./components/css/icon/icon.js";
|
|
16
|
+
import { input } from "./components/css/input/input.js";
|
|
17
|
+
import { label } from "./components/css/label/label.js";
|
|
18
|
+
import { link } from "./components/css/link/link.js";
|
|
19
|
+
import { list } from "./components/css/list/list.js";
|
|
20
|
+
import { pagination } from "./components/css/pagination/pagination.js";
|
|
21
|
+
import { paragraph } from "./components/css/paragraph/paragraph.js";
|
|
22
|
+
import { progress } from "./components/css/progress/progress.js";
|
|
23
|
+
import { radio } from "./components/css/radio/radio.js";
|
|
24
|
+
import { search } from "./components/css/search/search.js";
|
|
25
|
+
import { select } from "./components/css/select/select.js";
|
|
26
|
+
import { fieldStates, isFieldState, isRequiredMarker, managedNames, rememberManaged, requiredMarkers, } from "./components/css/shared.js";
|
|
27
|
+
import { skeleton } from "./components/css/skeleton/skeleton.js";
|
|
28
|
+
import { skipLink } from "./components/css/skip-link/skip-link.js";
|
|
29
|
+
import { spinner } from "./components/css/spinner/spinner.js";
|
|
30
|
+
import { srOnly } from "./components/css/sr-only/sr-only.js";
|
|
31
|
+
import { switchControl } from "./components/css/switch/switch.js";
|
|
32
|
+
import { table, tableSort } from "./components/css/table/table.js";
|
|
33
|
+
import { tag } from "./components/css/tag/tag.js";
|
|
34
|
+
import { textarea } from "./components/css/textarea/textarea.js";
|
|
35
|
+
import { toggleGroup } from "./components/css/toggle-group/toggle-group.js";
|
|
36
|
+
import { tooltip } from "./components/css/tooltip/tooltip.js";
|
|
37
|
+
import { dialog } from "./components/frame/dialog/dialog.js";
|
|
38
|
+
import { errorSummary } from "./components/frame/error-summary/error-summary.js";
|
|
39
|
+
import { computeFieldAttributes, createFieldId, } from "./components/frame/field/field-core.js";
|
|
40
|
+
import { popover } from "./components/frame/popover/popover.js";
|
|
41
|
+
import { sessionTimeout } from "./components/frame/session-timeout/session-timeout.js";
|
|
42
|
+
import { suggestion } from "./components/frame/suggestion/suggestion.js";
|
|
43
|
+
import { tabsWithState, } from "./components/frame/tabs/tabs.js";
|
|
44
|
+
import { connectionStatus } from "./components/standalone/connection-status/connection-status.js";
|
|
45
|
+
import { toast } from "./components/standalone/toast/toast.js";
|
|
46
|
+
import { setAttributes as setHtmlAttributes } from "./dom.js";
|
|
47
|
+
/**
|
|
48
|
+
* The attributes that have another name in React.
|
|
49
|
+
*
|
|
50
|
+
* `tabindex` came with the compound builder functions, and `autocomplete`
|
|
51
|
+
* with the suggestion field. Without the renaming React warns about every
|
|
52
|
+
* one of them.
|
|
53
|
+
*
|
|
54
|
+
* `aria-*` and `data-*`, on the other hand, stay as they are. React passes
|
|
55
|
+
* them on unchanged, and renaming them would give invalid attributes.
|
|
56
|
+
*
|
|
57
|
+
* `react.browser.test.ts` calls every builder function here with every
|
|
58
|
+
* allowed value it declares, collects all attribute names in the result,
|
|
59
|
+
* including those in lists and nested levels, and rejects every name React
|
|
60
|
+
* spells differently. The list there is React's and is longer than the four
|
|
61
|
+
* we rename, so a builder function that one day outputs `readonly` or
|
|
62
|
+
* `maxlength` stops there and not in a consumer's console.
|
|
63
|
+
*/
|
|
64
|
+
const REACT_NAMES = {
|
|
65
|
+
class: "className",
|
|
66
|
+
for: "htmlFor",
|
|
67
|
+
tabindex: "tabIndex",
|
|
68
|
+
autocomplete: "autoComplete",
|
|
69
|
+
};
|
|
70
|
+
export function toReactAttributes(attributes) {
|
|
71
|
+
const result = {};
|
|
72
|
+
for (const [name, value] of Object.entries(attributes)) {
|
|
73
|
+
// `tabindex` is a string in HTML and a number in React. Everything else
|
|
74
|
+
// passes straight through: it is the names that differ, not the values.
|
|
75
|
+
result[REACT_NAMES[name] ?? name] =
|
|
76
|
+
name === "tabindex" ? Number(value) : value;
|
|
77
|
+
}
|
|
78
|
+
// The new object manages the same as the old one, under the new names, so
|
|
79
|
+
// `setAttributes` below can clean up as much as the main entry point.
|
|
80
|
+
const names = managedNames(attributes);
|
|
81
|
+
if (names)
|
|
82
|
+
rememberManaged(result, names.map((name) => REACT_NAMES[name] ?? name));
|
|
83
|
+
return result;
|
|
84
|
+
}
|
|
85
|
+
/** The names back to HTML, for `setAttributes`. */
|
|
86
|
+
const HTML_NAMES = Object.fromEntries(Object.entries(REACT_NAMES).map(([html, react]) => [react, html]));
|
|
87
|
+
/**
|
|
88
|
+
* Writes a set from this entry point back to the HTML names.
|
|
89
|
+
*
|
|
90
|
+
* `setAttribute` writes the name as given, and in an HTML document it becomes
|
|
91
|
+
* lower case: `className` became the attribute `classname`, and `htmlFor`
|
|
92
|
+
* became `htmlfor`. The new object manages the same as the set it came from,
|
|
93
|
+
* so what is gone in the next call is cleaned up.
|
|
94
|
+
*/
|
|
95
|
+
function toHtmlAttributes(set) {
|
|
96
|
+
const result = {};
|
|
97
|
+
for (const [name, value] of Object.entries(set)) {
|
|
98
|
+
result[HTML_NAMES[name] ?? name] =
|
|
99
|
+
typeof value === "number" ? String(value) : value;
|
|
100
|
+
}
|
|
101
|
+
const names = managedNames(set);
|
|
102
|
+
if (names)
|
|
103
|
+
rememberManaged(result, names.map((name) => HTML_NAMES[name] ?? name));
|
|
104
|
+
return result;
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Like `lt.setAttributes` in the main entry point, for the sets from here.
|
|
108
|
+
*
|
|
109
|
+
* A React app reaches the DOM through a `ref`, and then naturally uses `lt`
|
|
110
|
+
* from this entry point. Passed straight to the main entry point's
|
|
111
|
+
* `setAttributes`, `className` became the attribute `classname`, and the
|
|
112
|
+
* cleanup did not find the builder function behind the set. Here the names
|
|
113
|
+
* are translated back first.
|
|
114
|
+
*/
|
|
115
|
+
export function setAttributes(element, ...sets) {
|
|
116
|
+
setHtmlAttributes(element, ...sets.map((set) => toHtmlAttributes(set)));
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Wraps a builder function so the return value gets the React names.
|
|
120
|
+
*
|
|
121
|
+
* The signature is written as an intersection type so TypeScript can infer
|
|
122
|
+
* both the options type and the extra fields attached to the function, that
|
|
123
|
+
* is `variants`, `isVariant` and the others, in one go.
|
|
124
|
+
*/
|
|
125
|
+
function forReact(fn) {
|
|
126
|
+
const wrapped = (options) => toReactAttributes(fn(options));
|
|
127
|
+
return Object.assign(wrapped, fn);
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Re-exported from the main entry point.
|
|
131
|
+
*
|
|
132
|
+
* `field.mdx` points to it in a section that tells the reader to import from
|
|
133
|
+
* `@lo-tek/interfaces/react`, and without this a React consumer who follows
|
|
134
|
+
* the advice gets "createFieldId is not exported". It is safe only when the
|
|
135
|
+
* markup is rendered once; in a React component `useId()` is the answer,
|
|
136
|
+
* also in an app without a server.
|
|
137
|
+
*/
|
|
138
|
+
export { createFieldId };
|
|
139
|
+
export const lt = {
|
|
140
|
+
accordion: forReact(accordion),
|
|
141
|
+
alert: forReact(alert),
|
|
142
|
+
avatar: forReact(avatar),
|
|
143
|
+
badge: forReact(badge),
|
|
144
|
+
breadcrumbs: forReact(breadcrumbs),
|
|
145
|
+
button: forReact(button),
|
|
146
|
+
card: forReact(card),
|
|
147
|
+
checkbox: forReact(checkbox),
|
|
148
|
+
divider: forReact(divider),
|
|
149
|
+
errorText: forReact(errorText),
|
|
150
|
+
fieldset: forReact(fieldset),
|
|
151
|
+
heading: forReact(heading),
|
|
152
|
+
fileUpload: forReact(fileUpload),
|
|
153
|
+
helpText: forReact(helpText),
|
|
154
|
+
icon: forReact(icon),
|
|
155
|
+
input: forReact(input),
|
|
156
|
+
label: forReact(label),
|
|
157
|
+
legend: forReact(legend),
|
|
158
|
+
link: forReact(link),
|
|
159
|
+
list: forReact(list),
|
|
160
|
+
pagination: forReact(pagination),
|
|
161
|
+
paragraph: forReact(paragraph),
|
|
162
|
+
radio: forReact(radio),
|
|
163
|
+
search: forReact(search),
|
|
164
|
+
select: forReact(select),
|
|
165
|
+
skeleton: forReact(skeleton),
|
|
166
|
+
skipLink: forReact(skipLink),
|
|
167
|
+
progress: forReact(progress),
|
|
168
|
+
spinner: forReact(spinner),
|
|
169
|
+
srOnly: forReact(srOnly),
|
|
170
|
+
switch: forReact(switchControl),
|
|
171
|
+
toggleGroup: forReact(toggleGroup),
|
|
172
|
+
tooltip: forReact(tooltip),
|
|
173
|
+
table: forReact(table),
|
|
174
|
+
tableSort: Object.assign((options) => {
|
|
175
|
+
const built = tableSort(options);
|
|
176
|
+
return {
|
|
177
|
+
header: built.header,
|
|
178
|
+
button: toReactAttributes(built.button),
|
|
179
|
+
};
|
|
180
|
+
}, { isDirection: tableSort.isDirection }),
|
|
181
|
+
tag: forReact(tag),
|
|
182
|
+
textarea: forReact(textarea),
|
|
183
|
+
/**
|
|
184
|
+
* Wires a whole field, with `className` and `htmlFor` on the label.
|
|
185
|
+
*
|
|
186
|
+
* `control`, `help` and `error` have no keys that need renaming, and are
|
|
187
|
+
* therefore the same in both entry points.
|
|
188
|
+
*/
|
|
189
|
+
field: (options) => {
|
|
190
|
+
const field = computeFieldAttributes(options);
|
|
191
|
+
return { ...field, label: toReactAttributes(field.label) };
|
|
192
|
+
},
|
|
193
|
+
/**
|
|
194
|
+
* The compound builder functions return one attribute set per element,
|
|
195
|
+
* and each set must be renamed on its own. `host` has `tabindex`, and the
|
|
196
|
+
* panels in `lt.tabs()` have both `tabindex` and `class`.
|
|
197
|
+
*/
|
|
198
|
+
errorSummary: (options = {}) => {
|
|
199
|
+
const built = errorSummary(options);
|
|
200
|
+
return {
|
|
201
|
+
host: toReactAttributes(built.host),
|
|
202
|
+
title: toReactAttributes(built.title),
|
|
203
|
+
};
|
|
204
|
+
},
|
|
205
|
+
dialog: Object.assign((options) => {
|
|
206
|
+
const built = dialog(options);
|
|
207
|
+
return {
|
|
208
|
+
host: built.host,
|
|
209
|
+
dialog: toReactAttributes(built.dialog),
|
|
210
|
+
header: toReactAttributes(built.header),
|
|
211
|
+
title: toReactAttributes(built.title),
|
|
212
|
+
subtitle: toReactAttributes(built.subtitle),
|
|
213
|
+
body: toReactAttributes(built.body),
|
|
214
|
+
footer: toReactAttributes(built.footer),
|
|
215
|
+
};
|
|
216
|
+
}, {
|
|
217
|
+
dialog: dialog.dialog,
|
|
218
|
+
header: dialog.header,
|
|
219
|
+
title: dialog.title,
|
|
220
|
+
subtitle: dialog.subtitle,
|
|
221
|
+
body: dialog.body,
|
|
222
|
+
footer: dialog.footer,
|
|
223
|
+
colors: dialog.colors,
|
|
224
|
+
isColor: dialog.isColor,
|
|
225
|
+
}),
|
|
226
|
+
popover: Object.assign((options) => {
|
|
227
|
+
const built = popover(options);
|
|
228
|
+
return {
|
|
229
|
+
host: built.host,
|
|
230
|
+
trigger: toReactAttributes(built.trigger),
|
|
231
|
+
panel: toReactAttributes(built.panel),
|
|
232
|
+
};
|
|
233
|
+
}, { isPlacement: popover.isPlacement }),
|
|
234
|
+
/**
|
|
235
|
+
* The whole state, not just the links: React reports a mismatch for every
|
|
236
|
+
* attribute the component writes on an element React has rendered. See
|
|
237
|
+
* `tabsWithState`.
|
|
238
|
+
*/
|
|
239
|
+
tabs: (options) => {
|
|
240
|
+
const built = tabsWithState(options);
|
|
241
|
+
return {
|
|
242
|
+
list: toReactAttributes(built.list),
|
|
243
|
+
item: toReactAttributes(built.item),
|
|
244
|
+
tabs: built.tabs.map(toReactAttributes),
|
|
245
|
+
panels: built.panels.map(toReactAttributes),
|
|
246
|
+
};
|
|
247
|
+
},
|
|
248
|
+
suggestion: (options) => {
|
|
249
|
+
const built = suggestion(options);
|
|
250
|
+
return {
|
|
251
|
+
...built,
|
|
252
|
+
label: toReactAttributes(built.label),
|
|
253
|
+
control: toReactAttributes(built.control),
|
|
254
|
+
list: toReactAttributes(built.list),
|
|
255
|
+
options: built.options.map(toReactAttributes),
|
|
256
|
+
empty: toReactAttributes(built.empty),
|
|
257
|
+
status: toReactAttributes(built.status),
|
|
258
|
+
value: toReactAttributes(built.value),
|
|
259
|
+
};
|
|
260
|
+
},
|
|
261
|
+
toast: (options = {}) => {
|
|
262
|
+
const built = toast(options);
|
|
263
|
+
return {
|
|
264
|
+
host: toReactAttributes(built.host),
|
|
265
|
+
message: toReactAttributes(built.message),
|
|
266
|
+
close: toReactAttributes(built.close),
|
|
267
|
+
};
|
|
268
|
+
},
|
|
269
|
+
sessionTimeout: Object.assign((options) => {
|
|
270
|
+
const built = sessionTimeout(options);
|
|
271
|
+
return {
|
|
272
|
+
host: toReactAttributes(built.host),
|
|
273
|
+
dialog: toReactAttributes(built.dialog),
|
|
274
|
+
title: toReactAttributes(built.title),
|
|
275
|
+
text: toReactAttributes(built.text),
|
|
276
|
+
count: toReactAttributes(built.count),
|
|
277
|
+
live: toReactAttributes(built.live),
|
|
278
|
+
actions: toReactAttributes(built.actions),
|
|
279
|
+
extend: toReactAttributes(built.extend),
|
|
280
|
+
logout: toReactAttributes(built.logout),
|
|
281
|
+
};
|
|
282
|
+
}, {
|
|
283
|
+
dialog: sessionTimeout.dialog,
|
|
284
|
+
title: sessionTimeout.title,
|
|
285
|
+
text: sessionTimeout.text,
|
|
286
|
+
count: sessionTimeout.count,
|
|
287
|
+
actions: sessionTimeout.actions,
|
|
288
|
+
}),
|
|
289
|
+
connectionStatus: forReact(connectionStatus),
|
|
290
|
+
setAttributes,
|
|
291
|
+
states: fieldStates,
|
|
292
|
+
isState: isFieldState,
|
|
293
|
+
markers: requiredMarkers,
|
|
294
|
+
isMarker: isRequiredMarker,
|
|
295
|
+
};
|
|
296
|
+
//# sourceMappingURL=react.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"react.js","sourceRoot":"","sources":["../src/react.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAA;AACnE,OAAO,EAAE,KAAK,EAAE,MAAM,iCAAiC,CAAA;AACvD,OAAO,EAAE,MAAM,EAAE,MAAM,mCAAmC,CAAA;AAC1D,OAAO,EAAE,KAAK,EAAE,MAAM,iCAAiC,CAAA;AACvD,OAAO,EAAE,WAAW,EAAE,MAAM,6CAA6C,CAAA;AACzE,OAAO,EAAE,MAAM,EAAE,MAAM,mCAAmC,CAAA;AAC1D,OAAO,EAAE,IAAI,EAAE,MAAM,+BAA+B,CAAA;AACpD,OAAO,EAAE,QAAQ,EAAE,MAAM,uCAAuC,CAAA;AAChE,OAAO,EAAE,OAAO,EAAE,MAAM,qCAAqC,CAAA;AAC7D,OAAO,EAAE,SAAS,EAAE,MAAM,2CAA2C,CAAA;AACrE,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,uCAAuC,CAAA;AACxE,OAAO,EAAE,UAAU,EAAE,MAAM,6CAA6C,CAAA;AACxE,OAAO,EAAE,OAAO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QAAQ,EAAE,gBAAgB;CAClB,CAAA"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Registers all the web components in one call.
|
|
3
|
+
*
|
|
4
|
+
* Each component has its own `defineLt*`, and an app that only uses the field
|
|
5
|
+
* can settle for `defineLtField()` and keep the rest out of its bundle. But
|
|
6
|
+
* most apps use several, and a demo app had seven calls in a `useEffect`,
|
|
7
|
+
* that is, after the first paint. Then the elements in the markup are plain
|
|
8
|
+
* `HTMLElement`s when React paints them, and the first call to
|
|
9
|
+
* `reportSuccess()` came before the effect. One call, at import, closes the
|
|
10
|
+
* gap.
|
|
11
|
+
*
|
|
12
|
+
* Like the individual functions, it does nothing on a server, so it can sit
|
|
13
|
+
* at the top of a module that runs in both places.
|
|
14
|
+
*/
|
|
15
|
+
export type { LtEventMap } from "./components/events.js";
|
|
16
|
+
export declare function defineLt(): void;
|
|
17
|
+
//# sourceMappingURL=register.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"register.d.ts","sourceRoot":"","sources":["../src/register.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAiBH,YAAY,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAA;AAExD,wBAAgB,QAAQ,IAAI,IAAI,CAU/B"}
|
package/dist/register.js
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Registers all the web components in one call.
|
|
3
|
+
*
|
|
4
|
+
* Each component has its own `defineLt*`, and an app that only uses the field
|
|
5
|
+
* can settle for `defineLtField()` and keep the rest out of its bundle. But
|
|
6
|
+
* most apps use several, and a demo app had seven calls in a `useEffect`,
|
|
7
|
+
* that is, after the first paint. Then the elements in the markup are plain
|
|
8
|
+
* `HTMLElement`s when React paints them, and the first call to
|
|
9
|
+
* `reportSuccess()` came before the effect. One call, at import, closes the
|
|
10
|
+
* gap.
|
|
11
|
+
*
|
|
12
|
+
* Like the individual functions, it does nothing on a server, so it can sit
|
|
13
|
+
* at the top of a module that runs in both places.
|
|
14
|
+
*/
|
|
15
|
+
import { defineLtDialog } from "./components/frame/dialog/lt-dialog.js";
|
|
16
|
+
import { defineLtErrorSummary } from "./components/frame/error-summary/lt-error-summary.js";
|
|
17
|
+
import { defineLtField } from "./components/frame/field/lt-field.js";
|
|
18
|
+
import { defineLtPopover } from "./components/frame/popover/lt-popover.js";
|
|
19
|
+
import { defineLtSessionTimeout } from "./components/frame/session-timeout/lt-session-timeout.js";
|
|
20
|
+
import { defineLtSuggestion } from "./components/frame/suggestion/lt-suggestion.js";
|
|
21
|
+
import { defineLtTabs } from "./components/frame/tabs/lt-tabs.js";
|
|
22
|
+
import { defineLtConnectionStatus } from "./components/standalone/connection-status/lt-connection-status.js";
|
|
23
|
+
import { defineLtToast } from "./components/standalone/toast/lt-toast.js";
|
|
24
|
+
export function defineLt() {
|
|
25
|
+
defineLtField();
|
|
26
|
+
defineLtTabs();
|
|
27
|
+
defineLtErrorSummary();
|
|
28
|
+
defineLtPopover();
|
|
29
|
+
defineLtSuggestion();
|
|
30
|
+
defineLtDialog();
|
|
31
|
+
defineLtToast();
|
|
32
|
+
defineLtSessionTimeout();
|
|
33
|
+
defineLtConnectionStatus();
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=register.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"register.js","sourceRoot":"","sources":["../src/register.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,wCAAwC,CAAA;AACvE,OAAO,EAAE,oBAAoB,EAAE,MAAM,sDAAsD,CAAA;AAC3F,OAAO,EAAE,aAAa,EAAE,MAAM,sCAAsC,CAAA;AACpE,OAAO,EAAE,eAAe,EAAE,MAAM,0CAA0C,CAAA;AAC1E,OAAO,EAAE,sBAAsB,EAAE,MAAM,0DAA0D,CAAA;AACjG,OAAO,EAAE,kBAAkB,EAAE,MAAM,gDAAgD,CAAA;AACnF,OAAO,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAA;AACjE,OAAO,EAAE,wBAAwB,EAAE,MAAM,mEAAmE,CAAA;AAC5G,OAAO,EAAE,aAAa,EAAE,MAAM,2CAA2C,CAAA;AASzE,MAAM,UAAU,QAAQ;IACtB,aAAa,EAAE,CAAA;IACf,YAAY,EAAE,CAAA;IACd,oBAAoB,EAAE,CAAA;IACtB,eAAe,EAAE,CAAA;IACjB,kBAAkB,EAAE,CAAA;IACpB,cAAc,EAAE,CAAA;IAChB,aAAa,EAAE,CAAA;IACf,sBAAsB,EAAE,CAAA;IACxB,wBAAwB,EAAE,CAAA;AAC5B,CAAC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
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
|
+
export type Rgb = {
|
|
20
|
+
r: number;
|
|
21
|
+
g: number;
|
|
22
|
+
b: number;
|
|
23
|
+
};
|
|
24
|
+
export type Oklch = {
|
|
25
|
+
l: number;
|
|
26
|
+
c: number;
|
|
27
|
+
h: number;
|
|
28
|
+
};
|
|
29
|
+
/** Reads `#rrggbb` or `#rgb`. */
|
|
30
|
+
export declare function parseHex(hex: string): Rgb;
|
|
31
|
+
export declare function toHex({ r, g, b }: Rgb): string;
|
|
32
|
+
export declare function rgbToOklch({ r, g, b }: Rgb): Oklch;
|
|
33
|
+
/**
|
|
34
|
+
* Converts an OKLCH colour to an rgb colour a screen can show.
|
|
35
|
+
*
|
|
36
|
+
* Not every combination of lightness and chroma can be shown in sRGB. If the
|
|
37
|
+
* colour falls outside, the chroma is reduced until it is inside, instead of
|
|
38
|
+
* clipping each channel separately. Clipping would change the hue.
|
|
39
|
+
*/
|
|
40
|
+
export declare function oklchToRgb(color: Oklch): Rgb;
|
|
41
|
+
/** The contrast ratio between two colours, as WCAG 2.1 computes it. */
|
|
42
|
+
export declare function contrastRatio(a: Rgb, b: Rgb): number;
|
|
43
|
+
//# sourceMappingURL=color.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"color.d.ts","sourceRoot":"","sources":["../../src/tokens/color.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,MAAM,MAAM,GAAG,GAAG;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAAE,CAAA;AACrD,MAAM,MAAM,KAAK,GAAG;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAAE,CAAA;AAEvD,iCAAiC;AACjC,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAmBzC;AAED,wBAAgB,KAAK,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,GAAG,GAAG,MAAM,CAO9C;AAeD,wBAAgB,UAAU,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,GAAG,GAAG,KAAK,CAsBlD;AA6BD;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,KAAK,GAAG,GAAG,CAc5C;AAMD,uEAAuE;AACvE,wBAAgB,aAAa,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,GAAG,MAAM,CAIpD"}
|
|
@@ -0,0 +1,123 @@
|
|
|
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
|
+
/** Reads `#rrggbb` or `#rgb`. */
|
|
20
|
+
export function parseHex(hex) {
|
|
21
|
+
const clean = hex.trim().replace(/^#/, "");
|
|
22
|
+
const full = clean.length === 3
|
|
23
|
+
? clean
|
|
24
|
+
.split("")
|
|
25
|
+
.map((char) => char + char)
|
|
26
|
+
.join("")
|
|
27
|
+
: clean;
|
|
28
|
+
if (!/^[0-9a-fA-F]{6}$/.test(full)) {
|
|
29
|
+
throw new Error(`"${hex}" is not a valid hexadecimal colour`);
|
|
30
|
+
}
|
|
31
|
+
return {
|
|
32
|
+
r: Number.parseInt(full.slice(0, 2), 16),
|
|
33
|
+
g: Number.parseInt(full.slice(2, 4), 16),
|
|
34
|
+
b: Number.parseInt(full.slice(4, 6), 16),
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
export function toHex({ r, g, b }) {
|
|
38
|
+
const channel = (value) => Math.round(Math.min(255, Math.max(0, value)))
|
|
39
|
+
.toString(16)
|
|
40
|
+
.padStart(2, "0");
|
|
41
|
+
return `#${channel(r)}${channel(g)}${channel(b)}`;
|
|
42
|
+
}
|
|
43
|
+
function toLinear(channel) {
|
|
44
|
+
const c = channel / 255;
|
|
45
|
+
return c <= 0.04045 ? c / 12.92 : ((c + 0.055) / 1.055) ** 2.4;
|
|
46
|
+
}
|
|
47
|
+
function fromLinear(channel) {
|
|
48
|
+
const c = channel <= 0.0031308
|
|
49
|
+
? channel * 12.92
|
|
50
|
+
: 1.055 * channel ** (1 / 2.4) - 0.055;
|
|
51
|
+
return c * 255;
|
|
52
|
+
}
|
|
53
|
+
export function rgbToOklch({ r, g, b }) {
|
|
54
|
+
const lr = toLinear(r);
|
|
55
|
+
const lg = toLinear(g);
|
|
56
|
+
const lb = toLinear(b);
|
|
57
|
+
const l = 0.4122214708 * lr + 0.5363325363 * lg + 0.0514459929 * lb;
|
|
58
|
+
const m = 0.2119034982 * lr + 0.6806995451 * lg + 0.1073969566 * lb;
|
|
59
|
+
const s = 0.0883024619 * lr + 0.2817188376 * lg + 0.6299787005 * lb;
|
|
60
|
+
const l_ = Math.cbrt(l);
|
|
61
|
+
const m_ = Math.cbrt(m);
|
|
62
|
+
const s_ = Math.cbrt(s);
|
|
63
|
+
const lightness = 0.2104542553 * l_ + 0.793617785 * m_ - 0.0040720468 * s_;
|
|
64
|
+
const a = 1.9779984951 * l_ - 2.428592205 * m_ + 0.4505937099 * s_;
|
|
65
|
+
const bb = 0.0259040371 * l_ + 0.7827717662 * m_ - 0.808675766 * s_;
|
|
66
|
+
return {
|
|
67
|
+
l: lightness,
|
|
68
|
+
c: Math.hypot(a, bb),
|
|
69
|
+
h: (Math.atan2(bb, a) * 180) / Math.PI,
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
function oklchToRgbRaw({ l, c, h }) {
|
|
73
|
+
const rad = (h * Math.PI) / 180;
|
|
74
|
+
const a = c * Math.cos(rad);
|
|
75
|
+
const b = c * Math.sin(rad);
|
|
76
|
+
const l_ = l + 0.3963377774 * a + 0.2158037573 * b;
|
|
77
|
+
const m_ = l - 0.1055613458 * a - 0.0638541728 * b;
|
|
78
|
+
const s_ = l - 0.0894841775 * a - 1.291485548 * b;
|
|
79
|
+
const lr = l_ ** 3;
|
|
80
|
+
const mr = m_ ** 3;
|
|
81
|
+
const sr = s_ ** 3;
|
|
82
|
+
return {
|
|
83
|
+
r: fromLinear(4.0767416621 * lr - 3.3077115913 * mr + 0.2309699292 * sr),
|
|
84
|
+
g: fromLinear(-1.2684380046 * lr + 2.6097574011 * mr - 0.3413193965 * sr),
|
|
85
|
+
b: fromLinear(-0.0041960863 * lr - 0.7034186147 * mr + 1.707614701 * sr),
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
function outside({ r, g, b }) {
|
|
89
|
+
const margin = 0.5;
|
|
90
|
+
return [r, g, b].some((channel) => channel < -margin || channel > 255 + margin);
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Converts an OKLCH colour to an rgb colour a screen can show.
|
|
94
|
+
*
|
|
95
|
+
* Not every combination of lightness and chroma can be shown in sRGB. If the
|
|
96
|
+
* colour falls outside, the chroma is reduced until it is inside, instead of
|
|
97
|
+
* clipping each channel separately. Clipping would change the hue.
|
|
98
|
+
*/
|
|
99
|
+
export function oklchToRgb(color) {
|
|
100
|
+
const attempt = oklchToRgbRaw(color);
|
|
101
|
+
if (!outside(attempt))
|
|
102
|
+
return attempt;
|
|
103
|
+
let low = 0;
|
|
104
|
+
let high = color.c;
|
|
105
|
+
for (let i = 0; i < 24; i += 1) {
|
|
106
|
+
const middle = (low + high) / 2;
|
|
107
|
+
if (outside(oklchToRgbRaw({ ...color, c: middle })))
|
|
108
|
+
high = middle;
|
|
109
|
+
else
|
|
110
|
+
low = middle;
|
|
111
|
+
}
|
|
112
|
+
return oklchToRgbRaw({ ...color, c: low });
|
|
113
|
+
}
|
|
114
|
+
function luminance({ r, g, b }) {
|
|
115
|
+
return 0.2126 * toLinear(r) + 0.7152 * toLinear(g) + 0.0722 * toLinear(b);
|
|
116
|
+
}
|
|
117
|
+
/** The contrast ratio between two colours, as WCAG 2.1 computes it. */
|
|
118
|
+
export function contrastRatio(a, b) {
|
|
119
|
+
const la = luminance(a);
|
|
120
|
+
const lb = luminance(b);
|
|
121
|
+
return (Math.max(la, lb) + 0.05) / (Math.min(la, lb) + 0.05);
|
|
122
|
+
}
|
|
123
|
+
//# sourceMappingURL=color.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"color.js","sourceRoot":"","sources":["../../src/tokens/color.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAKH,iCAAiC;AACjC,MAAM,UAAU,QAAQ,CAAC,GAAW;IAClC,MAAM,KAAK,GAAG,GAAG,CAAC,IAAI,EAAE,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,CAAA;IAC1C,MAAM,IAAI,GACR,KAAK,CAAC,MAAM,KAAK,CAAC;QAChB,CAAC,CAAC,KAAK;aACF,KAAK,CAAC,EAAE,CAAC;aACT,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,GAAG,IAAI,CAAC;aAC1B,IAAI,CAAC,EAAE,CAAC;QACb,CAAC,CAAC,KAAK,CAAA;IAEX,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;QACnC,MAAM,IAAI,KAAK,CAAC,IAAI,GAAG,qCAAqC,CAAC,CAAA;IAC/D,CAAC;IAED,OAAO;QACL,CAAC,EAAE,MA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E,GAAG,SAAS,CAAC,CAAC,CAAC,CAAA;IACvB,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,EAAE,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,EAAE,CAAC,GAAG,IAAI,CAAC,CAAA;AAC9D,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
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
|
+
export { type Appearance, NEUTRAL_LAYERS, REQUIREMENT, ROLES, type Role, } from "./matrix-cells.js";
|
|
18
|
+
//# sourceMappingURL=contract.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contract.d.ts","sourceRoot":"","sources":["../../src/tokens/contract.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EACL,KAAK,UAAU,EACf,cAAc,EACd,WAAW,EACX,KAAK,EACL,KAAK,IAAI,GACV,MAAM,mBAAmB,CAAA"}
|
|
@@ -0,0 +1,18 @@
|
|
|
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
|
+
export { NEUTRAL_LAYERS, REQUIREMENT, ROLES, } from "./matrix-cells.js";
|
|
18
|
+
//# sourceMappingURL=contract.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contract.js","sourceRoot":"","sources":["../../src/tokens/contract.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAEL,cAAc,EACd,WAAW,EACX,KAAK,GAEN,MAAM,mBAAmB,CAAA"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/** The families LO-TEK ships itself. A consumer can have others. */
|
|
2
|
+
export declare const FAMILIES: readonly ["accent", "visited", "brand1", "brand2", "brand3", "neutral", "danger", "warning", "success"];
|
|
3
|
+
export type Family = (typeof FAMILIES)[number];
|
|
4
|
+
/** LO-TEK's own brand colours. */
|
|
5
|
+
export declare const LOTEK_BRANDS: Record<Family, string>;
|
|
6
|
+
/** A role is a job a colour does, and it is the same in every family. */
|
|
7
|
+
export type Role = "surface" | "borderSubtle" | "border" | "borderStrong" | "fill" | "text" | "textStrong" | "textSubtle" | "content";
|
|
8
|
+
/** Light or dark. A theme is one or the other, never both. */
|
|
9
|
+
export type Appearance = "light" | "dark";
|
|
10
|
+
type Spec = {
|
|
11
|
+
lightness: Record<Appearance, number>;
|
|
12
|
+
chroma: number;
|
|
13
|
+
};
|
|
14
|
+
/** Lightness and chroma share per role, in each appearance. */
|
|
15
|
+
export declare const ROLES: Record<Role, Spec>;
|
|
16
|
+
/** The page and the raised surface, which only the neutral family has. */
|
|
17
|
+
export declare const NEUTRAL_LAYERS: Record<"canvas" | "raised", Spec>;
|
|
18
|
+
/** The contrast requirements, with a margin above WCAG. Text is 4.5 and graphics 3. */
|
|
19
|
+
export declare const REQUIREMENT: {
|
|
20
|
+
readonly text: 4.6;
|
|
21
|
+
readonly graphic: 3.1;
|
|
22
|
+
};
|
|
23
|
+
/** Every name the matrix emits. */
|
|
24
|
+
export type MatrixToken = "--lt-color-accent-surface" | "--lt-color-accent-border-subtle" | "--lt-color-accent-border" | "--lt-color-accent-border-strong" | "--lt-color-accent-fill" | "--lt-color-accent-text" | "--lt-color-accent-text-strong" | "--lt-color-accent-text-subtle" | "--lt-color-accent-content" | "--lt-color-visited-surface" | "--lt-color-visited-border-subtle" | "--lt-color-visited-border" | "--lt-color-visited-border-strong" | "--lt-color-visited-fill" | "--lt-color-visited-text" | "--lt-color-visited-text-strong" | "--lt-color-visited-text-subtle" | "--lt-color-visited-content" | "--lt-color-brand1-surface" | "--lt-color-brand1-border-subtle" | "--lt-color-brand1-border" | "--lt-color-brand1-border-strong" | "--lt-color-brand1-fill" | "--lt-color-brand1-text" | "--lt-color-brand1-text-strong" | "--lt-color-brand1-text-subtle" | "--lt-color-brand1-content" | "--lt-color-brand2-surface" | "--lt-color-brand2-border-subtle" | "--lt-color-brand2-border" | "--lt-color-brand2-border-strong" | "--lt-color-brand2-fill" | "--lt-color-brand2-text" | "--lt-color-brand2-text-strong" | "--lt-color-brand2-text-subtle" | "--lt-color-brand2-content" | "--lt-color-brand3-surface" | "--lt-color-brand3-border-subtle" | "--lt-color-brand3-border" | "--lt-color-brand3-border-strong" | "--lt-color-brand3-fill" | "--lt-color-brand3-text" | "--lt-color-brand3-text-strong" | "--lt-color-brand3-text-subtle" | "--lt-color-brand3-content" | "--lt-color-neutral-surface" | "--lt-color-neutral-border-subtle" | "--lt-color-neutral-border" | "--lt-color-neutral-border-strong" | "--lt-color-neutral-fill" | "--lt-color-neutral-text" | "--lt-color-neutral-text-strong" | "--lt-color-neutral-text-subtle" | "--lt-color-neutral-content" | "--lt-color-danger-surface" | "--lt-color-danger-border-subtle" | "--lt-color-danger-border" | "--lt-color-danger-border-strong" | "--lt-color-danger-fill" | "--lt-color-danger-text" | "--lt-color-danger-text-strong" | "--lt-color-danger-text-subtle" | "--lt-color-danger-content" | "--lt-color-warning-surface" | "--lt-color-warning-border-subtle" | "--lt-color-warning-border" | "--lt-color-warning-border-strong" | "--lt-color-warning-fill" | "--lt-color-warning-text" | "--lt-color-warning-text-strong" | "--lt-color-warning-text-subtle" | "--lt-color-warning-content" | "--lt-color-success-surface" | "--lt-color-success-border-subtle" | "--lt-color-success-border" | "--lt-color-success-border-strong" | "--lt-color-success-fill" | "--lt-color-success-text" | "--lt-color-success-text-strong" | "--lt-color-success-text-subtle" | "--lt-color-success-content" | "--lt-color-neutral-canvas" | "--lt-color-neutral-raised";
|
|
25
|
+
/** LO-TEK's own colours in the light theme. */
|
|
26
|
+
export declare const lightCells: Record<MatrixToken, string>;
|
|
27
|
+
/** LO-TEK's own colours in the dark theme. */
|
|
28
|
+
export declare const darkCells: Record<MatrixToken, string>;
|
|
29
|
+
export {};
|
|
30
|
+
//# sourceMappingURL=matrix-cells.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"matrix-cells.d.ts","sourceRoot":"","sources":["../../src/tokens/matrix-cells.ts"],"names":[],"mappings":"AAEA,oEAAoE;AACpE,eAAO,MAAM,QAAQ,yGAAkG,CAAA;AAEvH,MAAM,MAAM,MAAM,GAAG,CAAC,OAAO,QAAQ,CAAC,CAAC,MAAM,CAAC,CAAA;AAE9C,kCAAkC;AAClC,eAAO,MAAM,YAAY,EAAE,MA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