@lo-tek/interfaces 0.0.0 → 0.38.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +3389 -0
- package/LICENSE +21 -0
- package/README.md +129 -1
- package/agent/astro.md +400 -0
- package/agent/bundles.md +429 -0
- package/agent/datastar.md +409 -0
- package/agent/html.md +388 -0
- package/agent/react.md +440 -0
- package/agent/templates.md +472 -0
- package/core/lotek-core.wasm +0 -0
- package/core/lotek.wasm +0 -0
- package/dist/cli.d.ts +12 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +14 -0
- package/dist/cli.js.map +1 -0
- package/dist/components/css/accordion/accordion.d.ts +37 -0
- package/dist/components/css/accordion/accordion.d.ts.map +1 -0
- package/dist/components/css/accordion/accordion.js +31 -0
- package/dist/components/css/accordion/accordion.js.map +1 -0
- package/dist/components/css/alert/alert.d.ts +35 -0
- package/dist/components/css/alert/alert.d.ts.map +1 -0
- package/dist/components/css/alert/alert.js +29 -0
- package/dist/components/css/alert/alert.js.map +1 -0
- package/dist/components/css/avatar/avatar.d.ts +40 -0
- package/dist/components/css/avatar/avatar.d.ts.map +1 -0
- package/dist/components/css/avatar/avatar.js +30 -0
- package/dist/components/css/avatar/avatar.js.map +1 -0
- package/dist/components/css/badge/badge.d.ts +24 -0
- package/dist/components/css/badge/badge.d.ts.map +1 -0
- package/dist/components/css/badge/badge.js +24 -0
- package/dist/components/css/badge/badge.js.map +1 -0
- package/dist/components/css/breadcrumbs/breadcrumbs.d.ts +26 -0
- package/dist/components/css/breadcrumbs/breadcrumbs.d.ts.map +1 -0
- package/dist/components/css/breadcrumbs/breadcrumbs.js +24 -0
- package/dist/components/css/breadcrumbs/breadcrumbs.js.map +1 -0
- package/dist/components/css/button/button.d.ts +26 -0
- package/dist/components/css/button/button.d.ts.map +1 -0
- package/dist/components/css/button/button.js +25 -0
- package/dist/components/css/button/button.js.map +1 -0
- package/dist/components/css/card/card.d.ts +36 -0
- package/dist/components/css/card/card.d.ts.map +1 -0
- package/dist/components/css/card/card.js +28 -0
- package/dist/components/css/card/card.js.map +1 -0
- package/dist/components/css/checkbox/checkbox.d.ts +32 -0
- package/dist/components/css/checkbox/checkbox.d.ts.map +1 -0
- package/dist/components/css/checkbox/checkbox.js +27 -0
- package/dist/components/css/checkbox/checkbox.js.map +1 -0
- package/dist/components/css/divider/divider.d.ts +29 -0
- package/dist/components/css/divider/divider.d.ts.map +1 -0
- package/dist/components/css/divider/divider.js +23 -0
- package/dist/components/css/divider/divider.js.map +1 -0
- package/dist/components/css/error-text/error-text.d.ts +24 -0
- package/dist/components/css/error-text/error-text.d.ts.map +1 -0
- package/dist/components/css/error-text/error-text.js +18 -0
- package/dist/components/css/error-text/error-text.js.map +1 -0
- package/dist/components/css/fieldset/fieldset.d.ts +55 -0
- package/dist/components/css/fieldset/fieldset.d.ts.map +1 -0
- package/dist/components/css/fieldset/fieldset.js +39 -0
- package/dist/components/css/fieldset/fieldset.js.map +1 -0
- package/dist/components/css/file-upload/file-upload.d.ts +41 -0
- package/dist/components/css/file-upload/file-upload.d.ts.map +1 -0
- package/dist/components/css/file-upload/file-upload.js +32 -0
- package/dist/components/css/file-upload/file-upload.js.map +1 -0
- package/dist/components/css/heading/heading.d.ts +29 -0
- package/dist/components/css/heading/heading.d.ts.map +1 -0
- package/dist/components/css/heading/heading.js +23 -0
- package/dist/components/css/heading/heading.js.map +1 -0
- package/dist/components/css/help-text/help-text.d.ts +24 -0
- package/dist/components/css/help-text/help-text.d.ts.map +1 -0
- package/dist/components/css/help-text/help-text.js +23 -0
- package/dist/components/css/help-text/help-text.js.map +1 -0
- package/dist/components/css/icon/icon.d.ts +34 -0
- package/dist/components/css/icon/icon.d.ts.map +1 -0
- package/dist/components/css/icon/icon.js +25 -0
- package/dist/components/css/icon/icon.js.map +1 -0
- package/dist/components/css/input/input.d.ts +40 -0
- package/dist/components/css/input/input.d.ts.map +1 -0
- package/dist/components/css/input/input.js +45 -0
- package/dist/components/css/input/input.js.map +1 -0
- package/dist/components/css/label/label.d.ts +33 -0
- package/dist/components/css/label/label.d.ts.map +1 -0
- package/dist/components/css/label/label.js +23 -0
- package/dist/components/css/label/label.js.map +1 -0
- package/dist/components/css/link/link.d.ts +28 -0
- package/dist/components/css/link/link.d.ts.map +1 -0
- package/dist/components/css/link/link.js +20 -0
- package/dist/components/css/link/link.js.map +1 -0
- package/dist/components/css/list/list.d.ts +31 -0
- package/dist/components/css/list/list.d.ts.map +1 -0
- package/dist/components/css/list/list.js +25 -0
- package/dist/components/css/list/list.js.map +1 -0
- package/dist/components/css/pagination/pagination.d.ts +27 -0
- package/dist/components/css/pagination/pagination.d.ts.map +1 -0
- package/dist/components/css/pagination/pagination.js +25 -0
- package/dist/components/css/pagination/pagination.js.map +1 -0
- package/dist/components/css/paragraph/paragraph.d.ts +36 -0
- package/dist/components/css/paragraph/paragraph.d.ts.map +1 -0
- package/dist/components/css/paragraph/paragraph.js +26 -0
- package/dist/components/css/paragraph/paragraph.js.map +1 -0
- package/dist/components/css/progress/progress.d.ts +53 -0
- package/dist/components/css/progress/progress.d.ts.map +1 -0
- package/dist/components/css/progress/progress.js +38 -0
- package/dist/components/css/progress/progress.js.map +1 -0
- package/dist/components/css/radio/radio.d.ts +32 -0
- package/dist/components/css/radio/radio.d.ts.map +1 -0
- package/dist/components/css/radio/radio.js +27 -0
- package/dist/components/css/radio/radio.js.map +1 -0
- package/dist/components/css/search/search.d.ts +34 -0
- package/dist/components/css/search/search.d.ts.map +1 -0
- package/dist/components/css/search/search.js +32 -0
- package/dist/components/css/search/search.js.map +1 -0
- package/dist/components/css/select/select.d.ts +40 -0
- package/dist/components/css/select/select.d.ts.map +1 -0
- package/dist/components/css/select/select.js +31 -0
- package/dist/components/css/select/select.js.map +1 -0
- package/dist/components/css/shared.d.ts +90 -0
- package/dist/components/css/shared.d.ts.map +1 -0
- package/dist/components/css/shared.js +167 -0
- package/dist/components/css/shared.js.map +1 -0
- package/dist/components/css/skeleton/skeleton.d.ts +29 -0
- package/dist/components/css/skeleton/skeleton.d.ts.map +1 -0
- package/dist/components/css/skeleton/skeleton.js +23 -0
- package/dist/components/css/skeleton/skeleton.js.map +1 -0
- package/dist/components/css/skip-link/skip-link.d.ts +18 -0
- package/dist/components/css/skip-link/skip-link.d.ts.map +1 -0
- package/dist/components/css/skip-link/skip-link.js +16 -0
- package/dist/components/css/skip-link/skip-link.js.map +1 -0
- package/dist/components/css/spinner/spinner.d.ts +33 -0
- package/dist/components/css/spinner/spinner.d.ts.map +1 -0
- package/dist/components/css/spinner/spinner.js +25 -0
- package/dist/components/css/spinner/spinner.js.map +1 -0
- package/dist/components/css/sr-only/sr-only.d.ts +17 -0
- package/dist/components/css/sr-only/sr-only.d.ts.map +1 -0
- package/dist/components/css/sr-only/sr-only.js +15 -0
- package/dist/components/css/sr-only/sr-only.js.map +1 -0
- package/dist/components/css/switch/switch.d.ts +37 -0
- package/dist/components/css/switch/switch.d.ts.map +1 -0
- package/dist/components/css/switch/switch.js +29 -0
- package/dist/components/css/switch/switch.js.map +1 -0
- package/dist/components/css/table/table.d.ts +76 -0
- package/dist/components/css/table/table.d.ts.map +1 -0
- package/dist/components/css/table/table.js +59 -0
- package/dist/components/css/table/table.js.map +1 -0
- package/dist/components/css/tag/tag.d.ts +35 -0
- package/dist/components/css/tag/tag.d.ts.map +1 -0
- package/dist/components/css/tag/tag.js +27 -0
- package/dist/components/css/tag/tag.js.map +1 -0
- package/dist/components/css/textarea/textarea.d.ts +23 -0
- package/dist/components/css/textarea/textarea.d.ts.map +1 -0
- package/dist/components/css/textarea/textarea.js +18 -0
- package/dist/components/css/textarea/textarea.js.map +1 -0
- package/dist/components/css/toggle-group/toggle-group.d.ts +31 -0
- package/dist/components/css/toggle-group/toggle-group.d.ts.map +1 -0
- package/dist/components/css/toggle-group/toggle-group.js +29 -0
- package/dist/components/css/toggle-group/toggle-group.js.map +1 -0
- package/dist/components/css/tooltip/tooltip.d.ts +31 -0
- package/dist/components/css/tooltip/tooltip.d.ts.map +1 -0
- package/dist/components/css/tooltip/tooltip.js +29 -0
- package/dist/components/css/tooltip/tooltip.js.map +1 -0
- package/dist/components/default-texts.d.ts +41 -0
- package/dist/components/default-texts.d.ts.map +1 -0
- package/dist/components/default-texts.js +41 -0
- package/dist/components/default-texts.js.map +1 -0
- package/dist/components/events.d.ts +77 -0
- package/dist/components/events.d.ts.map +1 -0
- package/dist/components/events.js +3 -0
- package/dist/components/events.js.map +1 -0
- package/dist/components/frame/dialog/dialog.d.ts +122 -0
- package/dist/components/frame/dialog/dialog.d.ts.map +1 -0
- package/dist/components/frame/dialog/dialog.js +112 -0
- package/dist/components/frame/dialog/dialog.js.map +1 -0
- package/dist/components/frame/dialog/lt-dialog.d.ts +104 -0
- package/dist/components/frame/dialog/lt-dialog.d.ts.map +1 -0
- package/dist/components/frame/dialog/lt-dialog.js +434 -0
- package/dist/components/frame/dialog/lt-dialog.js.map +1 -0
- package/dist/components/frame/error-summary/error-summary.d.ts +53 -0
- package/dist/components/frame/error-summary/error-summary.d.ts.map +1 -0
- package/dist/components/frame/error-summary/error-summary.js +54 -0
- package/dist/components/frame/error-summary/error-summary.js.map +1 -0
- package/dist/components/frame/error-summary/lt-error-summary.d.ts +93 -0
- package/dist/components/frame/error-summary/lt-error-summary.d.ts.map +1 -0
- package/dist/components/frame/error-summary/lt-error-summary.js +408 -0
- package/dist/components/frame/error-summary/lt-error-summary.js.map +1 -0
- package/dist/components/frame/field/field-core.d.ts +92 -0
- package/dist/components/frame/field/field-core.d.ts.map +1 -0
- package/dist/components/frame/field/field-core.js +63 -0
- package/dist/components/frame/field/field-core.js.map +1 -0
- package/dist/components/frame/field/lt-field.d.ts +173 -0
- package/dist/components/frame/field/lt-field.d.ts.map +1 -0
- package/dist/components/frame/field/lt-field.js +600 -0
- package/dist/components/frame/field/lt-field.js.map +1 -0
- package/dist/components/frame/popover/lt-popover.d.ts +136 -0
- package/dist/components/frame/popover/lt-popover.d.ts.map +1 -0
- package/dist/components/frame/popover/lt-popover.js +520 -0
- package/dist/components/frame/popover/lt-popover.js.map +1 -0
- package/dist/components/frame/popover/popover.d.ts +49 -0
- package/dist/components/frame/popover/popover.d.ts.map +1 -0
- package/dist/components/frame/popover/popover.js +64 -0
- package/dist/components/frame/popover/popover.js.map +1 -0
- package/dist/components/frame/session-timeout/lt-session-timeout.d.ts +198 -0
- package/dist/components/frame/session-timeout/lt-session-timeout.d.ts.map +1 -0
- package/dist/components/frame/session-timeout/lt-session-timeout.js +610 -0
- package/dist/components/frame/session-timeout/lt-session-timeout.js.map +1 -0
- package/dist/components/frame/session-timeout/session-timeout.d.ts +113 -0
- package/dist/components/frame/session-timeout/session-timeout.d.ts.map +1 -0
- package/dist/components/frame/session-timeout/session-timeout.js +101 -0
- package/dist/components/frame/session-timeout/session-timeout.js.map +1 -0
- package/dist/components/frame/suggestion/lt-suggestion.d.ts +367 -0
- package/dist/components/frame/suggestion/lt-suggestion.d.ts.map +1 -0
- package/dist/components/frame/suggestion/lt-suggestion.js +1171 -0
- package/dist/components/frame/suggestion/lt-suggestion.js.map +1 -0
- package/dist/components/frame/suggestion/suggestion.d.ts +143 -0
- package/dist/components/frame/suggestion/suggestion.d.ts.map +1 -0
- package/dist/components/frame/suggestion/suggestion.js +127 -0
- package/dist/components/frame/suggestion/suggestion.js.map +1 -0
- package/dist/components/frame/tabs/lt-tabs.d.ts +426 -0
- package/dist/components/frame/tabs/lt-tabs.d.ts.map +1 -0
- package/dist/components/frame/tabs/lt-tabs.js +1265 -0
- package/dist/components/frame/tabs/lt-tabs.js.map +1 -0
- package/dist/components/frame/tabs/tabs.d.ts +112 -0
- package/dist/components/frame/tabs/tabs.d.ts.map +1 -0
- package/dist/components/frame/tabs/tabs.js +107 -0
- package/dist/components/frame/tabs/tabs.js.map +1 -0
- package/dist/components/host-element.d.ts +184 -0
- package/dist/components/host-element.d.ts.map +1 -0
- package/dist/components/host-element.js +440 -0
- package/dist/components/host-element.js.map +1 -0
- package/dist/components/standalone/connection-status/connection-status.d.ts +32 -0
- package/dist/components/standalone/connection-status/connection-status.d.ts.map +1 -0
- package/dist/components/standalone/connection-status/connection-status.js +26 -0
- package/dist/components/standalone/connection-status/connection-status.js.map +1 -0
- package/dist/components/standalone/connection-status/lt-connection-status.d.ts +86 -0
- package/dist/components/standalone/connection-status/lt-connection-status.d.ts.map +1 -0
- package/dist/components/standalone/connection-status/lt-connection-status.js +240 -0
- package/dist/components/standalone/connection-status/lt-connection-status.js.map +1 -0
- package/dist/components/standalone/toast/lt-toast.d.ts +109 -0
- package/dist/components/standalone/toast/lt-toast.d.ts.map +1 -0
- package/dist/components/standalone/toast/lt-toast.js +256 -0
- package/dist/components/standalone/toast/lt-toast.js.map +1 -0
- package/dist/components/standalone/toast/toast.d.ts +52 -0
- package/dist/components/standalone/toast/toast.d.ts.map +1 -0
- package/dist/components/standalone/toast/toast.js +42 -0
- package/dist/components/standalone/toast/toast.js.map +1 -0
- package/dist/diagnostics/core.d.ts +171 -0
- package/dist/diagnostics/core.d.ts.map +1 -0
- package/dist/diagnostics/core.js +84 -0
- package/dist/diagnostics/core.js.map +1 -0
- package/dist/diagnostics/default-core.d.ts +10 -0
- package/dist/diagnostics/default-core.d.ts.map +1 -0
- package/dist/diagnostics/default-core.js +72 -0
- package/dist/diagnostics/default-core.js.map +1 -0
- package/dist/diagnostics/index.d.ts +84 -0
- package/dist/diagnostics/index.d.ts.map +1 -0
- package/dist/diagnostics/index.js +106 -0
- package/dist/diagnostics/index.js.map +1 -0
- package/dist/dom.d.ts +55 -0
- package/dist/dom.d.ts.map +1 -0
- package/dist/dom.js +162 -0
- package/dist/dom.js.map +1 -0
- package/dist/index.d.ts +97 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +58 -0
- package/dist/index.js.map +1 -0
- package/dist/jsx/react.d.ts +180 -0
- package/dist/jsx/react.d.ts.map +1 -0
- package/dist/jsx/react.js +2 -0
- package/dist/jsx/react.js.map +1 -0
- package/dist/lotek.css +3617 -0
- package/dist/lt.d.ts +325 -0
- package/dist/lt.d.ts.map +1 -0
- package/dist/lt.js +183 -0
- package/dist/lt.js.map +1 -0
- package/dist/react.d.ts +494 -0
- package/dist/react.d.ts.map +1 -0
- package/dist/react.js +296 -0
- package/dist/react.js.map +1 -0
- package/dist/register.d.ts +17 -0
- package/dist/register.d.ts.map +1 -0
- package/dist/register.js +35 -0
- package/dist/register.js.map +1 -0
- package/dist/tokens/color.d.ts +43 -0
- package/dist/tokens/color.d.ts.map +1 -0
- package/dist/tokens/color.js +123 -0
- package/dist/tokens/color.js.map +1 -0
- package/dist/tokens/contract.d.ts +18 -0
- package/dist/tokens/contract.d.ts.map +1 -0
- package/dist/tokens/contract.js +18 -0
- package/dist/tokens/contract.js.map +1 -0
- package/dist/tokens/matrix-cells.d.ts +30 -0
- package/dist/tokens/matrix-cells.d.ts.map +1 -0
- package/dist/tokens/matrix-cells.js +273 -0
- package/dist/tokens/matrix-cells.js.map +1 -0
- package/dist/tokens/matrix.d.ts +18 -0
- package/dist/tokens/matrix.d.ts.map +1 -0
- package/dist/tokens/matrix.js +21 -0
- package/dist/tokens/matrix.js.map +1 -0
- package/dist/tokens/theme-check.d.ts +42 -0
- package/dist/tokens/theme-check.d.ts.map +1 -0
- package/dist/tokens/theme-check.js +10 -0
- package/dist/tokens/theme-check.js.map +1 -0
- package/dist/tokens/theme.d.ts +94 -0
- package/dist/tokens/theme.d.ts.map +1 -0
- package/dist/tokens/theme.js +14 -0
- package/dist/tokens/theme.js.map +1 -0
- package/dist/tokens/tokens.d.ts +122 -0
- package/dist/tokens/tokens.d.ts.map +1 -0
- package/dist/tokens/tokens.js +158 -0
- package/dist/tokens/tokens.js.map +1 -0
- package/dist/vocabulary/classes.d.ts +3 -0
- package/dist/vocabulary/classes.d.ts.map +1 -0
- package/dist/vocabulary/classes.js +1354 -0
- package/dist/vocabulary/classes.js.map +1 -0
- package/dist/vocabulary/elements.d.ts +3 -0
- package/dist/vocabulary/elements.d.ts.map +1 -0
- package/dist/vocabulary/elements.js +490 -0
- package/dist/vocabulary/elements.js.map +1 -0
- package/dist/vocabulary/types.d.ts +229 -0
- package/dist/vocabulary/types.d.ts.map +1 -0
- package/dist/vocabulary/types.js +11 -0
- package/dist/vocabulary/types.js.map +1 -0
- package/dist/wasi-host.d.ts +24 -0
- package/dist/wasi-host.d.ts.map +1 -0
- package/dist/wasi-host.js +140 -0
- package/dist/wasi-host.js.map +1 -0
- package/live-templates.xml +63 -0
- package/manifest/files.json +373 -0
- package/manifest/manifest.json +5090 -0
- package/manifest/manifest.schema.json +586 -0
- package/package.json +399 -5
- package/src/cli.ts +21 -0
- package/src/components/css/accordion/accordion.css +102 -0
- package/src/components/css/accordion/accordion.ts +50 -0
- package/src/components/css/alert/alert.css +53 -0
- package/src/components/css/alert/alert.ts +48 -0
- package/src/components/css/avatar/avatar.css +96 -0
- package/src/components/css/avatar/avatar.ts +57 -0
- package/src/components/css/badge/badge.css +42 -0
- package/src/components/css/badge/badge.ts +43 -0
- package/src/components/css/breadcrumbs/breadcrumbs.css +62 -0
- package/src/components/css/breadcrumbs/breadcrumbs.ts +30 -0
- package/src/components/css/button/button.css +128 -0
- package/src/components/css/button/button.ts +44 -0
- package/src/components/css/card/card.css +65 -0
- package/src/components/css/card/card.ts +50 -0
- package/src/components/css/checkbox/checkbox.css +114 -0
- package/src/components/css/checkbox/checkbox.ts +50 -0
- package/src/components/css/divider/divider.css +38 -0
- package/src/components/css/divider/divider.ts +42 -0
- package/src/components/css/error-text/error-text.css +21 -0
- package/src/components/css/error-text/error-text.ts +37 -0
- package/src/components/css/fieldset/fieldset.css +72 -0
- package/src/components/css/fieldset/fieldset.ts +87 -0
- package/src/components/css/file-upload/file-upload.css +102 -0
- package/src/components/css/file-upload/file-upload.ts +65 -0
- package/src/components/css/heading/heading.css +33 -0
- package/src/components/css/heading/heading.ts +42 -0
- package/src/components/css/help-text/help-text.css +24 -0
- package/src/components/css/help-text/help-text.ts +42 -0
- package/src/components/css/icon/icon.css +20 -0
- package/src/components/css/icon/icon.ts +44 -0
- package/src/components/css/input/input.css +145 -0
- package/src/components/css/input/input.ts +77 -0
- package/src/components/css/label/label.css +42 -0
- package/src/components/css/label/label.ts +51 -0
- package/src/components/css/link/link.css +38 -0
- package/src/components/css/link/link.ts +38 -0
- package/src/components/css/list/list.css +53 -0
- package/src/components/css/list/list.ts +44 -0
- package/src/components/css/pagination/pagination.css +95 -0
- package/src/components/css/pagination/pagination.ts +33 -0
- package/src/components/css/paragraph/paragraph.css +31 -0
- package/src/components/css/paragraph/paragraph.ts +53 -0
- package/src/components/css/progress/progress.css +161 -0
- package/src/components/css/progress/progress.ts +78 -0
- package/src/components/css/radio/radio.css +94 -0
- package/src/components/css/radio/radio.ts +50 -0
- package/src/components/css/search/search.css +50 -0
- package/src/components/css/search/search.ts +56 -0
- package/src/components/css/select/select.css +321 -0
- package/src/components/css/select/select.ts +63 -0
- package/src/components/css/shared.ts +199 -0
- package/src/components/css/skeleton/skeleton.css +62 -0
- package/src/components/css/skeleton/skeleton.ts +43 -0
- package/src/components/css/skip-link/skip-link.css +41 -0
- package/src/components/css/skip-link/skip-link.ts +22 -0
- package/src/components/css/spinner/spinner.css +48 -0
- package/src/components/css/spinner/spinner.ts +48 -0
- package/src/components/css/sr-only/sr-only.css +16 -0
- package/src/components/css/sr-only/sr-only.ts +21 -0
- package/src/components/css/switch/switch.css +105 -0
- package/src/components/css/switch/switch.ts +50 -0
- package/src/components/css/table/table.css +159 -0
- package/src/components/css/table/table.ts +107 -0
- package/src/components/css/tag/tag.css +58 -0
- package/src/components/css/tag/tag.ts +49 -0
- package/src/components/css/textarea/textarea.css +83 -0
- package/src/components/css/textarea/textarea.ts +40 -0
- package/src/components/css/toggle-group/toggle-group.css +92 -0
- package/src/components/css/toggle-group/toggle-group.ts +37 -0
- package/src/components/css/tooltip/tooltip.css +89 -0
- package/src/components/css/tooltip/tooltip.ts +37 -0
- package/src/components/default-texts.ts +41 -0
- package/src/components/events.ts +68 -0
- package/src/components/frame/dialog/dialog.css +306 -0
- package/src/components/frame/dialog/dialog.ts +166 -0
- package/src/components/frame/dialog/lt-dialog.ts +513 -0
- package/src/components/frame/error-summary/error-summary.css +47 -0
- package/src/components/frame/error-summary/error-summary.ts +90 -0
- package/src/components/frame/error-summary/lt-error-summary.ts +458 -0
- package/src/components/frame/field/field-core.ts +152 -0
- package/src/components/frame/field/field.css +17 -0
- package/src/components/frame/field/lt-field.ts +790 -0
- package/src/components/frame/popover/lt-popover.ts +586 -0
- package/src/components/frame/popover/popover.css +50 -0
- package/src/components/frame/popover/popover.ts +102 -0
- package/src/components/frame/session-timeout/lt-session-timeout.ts +715 -0
- package/src/components/frame/session-timeout/session-timeout.css +50 -0
- package/src/components/frame/session-timeout/session-timeout.ts +156 -0
- package/src/components/frame/suggestion/lt-suggestion.ts +1379 -0
- package/src/components/frame/suggestion/suggestion.css +132 -0
- package/src/components/frame/suggestion/suggestion.ts +172 -0
- package/src/components/frame/tabs/lt-tabs.ts +1395 -0
- package/src/components/frame/tabs/tabs.css +128 -0
- package/src/components/frame/tabs/tabs.ts +188 -0
- package/src/components/host-element.ts +493 -0
- package/src/components/standalone/connection-status/connection-status.css +41 -0
- package/src/components/standalone/connection-status/connection-status.ts +47 -0
- package/src/components/standalone/connection-status/lt-connection-status.ts +268 -0
- package/src/components/standalone/toast/lt-toast.ts +300 -0
- package/src/components/standalone/toast/toast.css +78 -0
- package/src/components/standalone/toast/toast.ts +70 -0
- package/src/diagnostics/core.ts +227 -0
- package/src/diagnostics/default-core.ts +81 -0
- package/src/diagnostics/index.ts +150 -0
- package/src/dom.ts +185 -0
- package/src/index.ts +218 -0
- package/src/jsx/react.ts +212 -0
- package/src/lt.ts +192 -0
- package/src/react.ts +411 -0
- package/src/register.ts +43 -0
- package/src/tailwind/tailwind.css +169 -0
- package/src/tokens/boundary.css +104 -0
- package/src/tokens/color-contract.json +231 -0
- package/src/tokens/color.ts +150 -0
- package/src/tokens/contract.ts +24 -0
- package/src/tokens/matrix-cells.ts +375 -0
- package/src/tokens/matrix.ts +32 -0
- package/src/tokens/theme-check.ts +51 -0
- package/src/tokens/theme.ts +104 -0
- package/src/tokens/tokens.css +569 -0
- package/src/tokens/tokens.ts +223 -0
- package/src/vocabulary/classes.ts +1356 -0
- package/src/vocabulary/elements.ts +492 -0
- package/src/vocabulary/types.ts +228 -0
- package/src/wasi-host.ts +155 -0
- package/web-types.json +800 -0
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The class on the host, that is, the region the messages are in.
|
|
3
|
+
*
|
|
4
|
+
* Until 0.28.0 this was the class on each message, and the region was styled
|
|
5
|
+
* by its element name. Registered under another name, with
|
|
6
|
+
* `defineLtToast("my-toast")`, it then lost its position.
|
|
7
|
+
*/
|
|
8
|
+
export declare const TOAST_CLASS: "lt-toast";
|
|
9
|
+
export declare const TOAST_MESSAGE_CLASS: "lt-toast__message";
|
|
10
|
+
export declare const TOAST_CLOSE_CLASS: "lt-toast__close";
|
|
11
|
+
export type ToastOptions = {
|
|
12
|
+
/** Text that says what the region is. Becomes `aria-label`. */
|
|
13
|
+
label?: string;
|
|
14
|
+
/**
|
|
15
|
+
* The screen reader name of the close button in each message. Default:
|
|
16
|
+
* "Close message". `closeLabel` in `show()` overrides it for one message.
|
|
17
|
+
*/
|
|
18
|
+
closeLabel?: string;
|
|
19
|
+
};
|
|
20
|
+
export type ToastAttributes = {
|
|
21
|
+
host: {
|
|
22
|
+
class: typeof TOAST_CLASS;
|
|
23
|
+
role: "status";
|
|
24
|
+
"aria-live": "polite";
|
|
25
|
+
"aria-atomic": "false";
|
|
26
|
+
"aria-label": string;
|
|
27
|
+
"close-label"?: string;
|
|
28
|
+
"data-ignore-morph": "";
|
|
29
|
+
};
|
|
30
|
+
message: {
|
|
31
|
+
class: typeof TOAST_MESSAGE_CLASS;
|
|
32
|
+
};
|
|
33
|
+
close: {
|
|
34
|
+
class: typeof TOAST_CLOSE_CLASS;
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* The attributes for the toast region.
|
|
39
|
+
*
|
|
40
|
+
* The region is `role="status"` and not `role="alert"`. A message that comes
|
|
41
|
+
* because something went well should not interrupt what the screen reader is
|
|
42
|
+
* doing.
|
|
43
|
+
*
|
|
44
|
+
* `data-ignore-morph` is not optional. `<lt-toast>` creates and removes its
|
|
45
|
+
* message elements inside the region, and without the attribute the Datastar
|
|
46
|
+
* morph tears them away at the next patch, because the server's version of
|
|
47
|
+
* the region is empty. The attribute must be in the HTML the server sends:
|
|
48
|
+
* the component cannot set it on itself, since the morph reads it from the
|
|
49
|
+
* server's node.
|
|
50
|
+
*/
|
|
51
|
+
export declare const toast: ({ label, closeLabel, }?: ToastOptions) => ToastAttributes;
|
|
52
|
+
//# sourceMappingURL=toast.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toast.d.ts","sourceRoot":"","sources":["../../../../src/components/standalone/toast/toast.ts"],"names":[],"mappings":"AAGA;;;;;;GAMG;AACH,eAAO,MAAM,WAAW,EAAG,UAAmB,CAAA;AAC9C,eAAO,MAAM,mBAAmB,EAAG,mBAA4B,CAAA;AAC/D,eAAO,MAAM,iBAAiB,EAAG,iBAA0B,CAAA;AAE3D,MAAM,MAAM,YAAY,GAAG;IACzB,+DAA+D;IAC/D,KAAK,CAAC,EAAE,MAAM,CAAA;IACd;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAA;CACpB,CAAA;AAED,MAAM,MAAM,eAAe,GAAG;IAC5B,IAAI,EAAE;QACJ,KAAK,EAAE,OAAO,WAAW,CAAA;QACzB,IAAI,EAAE,QAAQ,CAAA;QACd,WAAW,EAAE,QAAQ,CAAA;QACrB,aAAa,EAAE,OAAO,CAAA;QACtB,YAAY,EAAE,MAAM,CAAA;QACpB,aAAa,CAAC,EAAE,MAAM,CAAA;QACtB,mBAAmB,EAAE,EAAE,CAAA;KACxB,CAAA;IACD,OAAO,EAAE;QAAE,KAAK,EAAE,OAAO,mBAAmB,CAAA;KAAE,CAAA;IAC9C,KAAK,EAAE;QAAE,KAAK,EAAE,OAAO,iBAAiB,CAAA;KAAE,CAAA;CAC3C,CAAA;AAED;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,KAAK,GAAI,yBAGnB,YAAiB,KAAG,eAcrB,CAAA"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { attributes } from "../../css/shared.js";
|
|
2
|
+
import { DEFAULT_TEXTS } from "../../default-texts.js";
|
|
3
|
+
/**
|
|
4
|
+
* The class on the host, that is, the region the messages are in.
|
|
5
|
+
*
|
|
6
|
+
* Until 0.28.0 this was the class on each message, and the region was styled
|
|
7
|
+
* by its element name. Registered under another name, with
|
|
8
|
+
* `defineLtToast("my-toast")`, it then lost its position.
|
|
9
|
+
*/
|
|
10
|
+
export const TOAST_CLASS = "lt-toast";
|
|
11
|
+
export const TOAST_MESSAGE_CLASS = "lt-toast__message";
|
|
12
|
+
export const TOAST_CLOSE_CLASS = "lt-toast__close";
|
|
13
|
+
/**
|
|
14
|
+
* The attributes for the toast region.
|
|
15
|
+
*
|
|
16
|
+
* The region is `role="status"` and not `role="alert"`. A message that comes
|
|
17
|
+
* because something went well should not interrupt what the screen reader is
|
|
18
|
+
* doing.
|
|
19
|
+
*
|
|
20
|
+
* `data-ignore-morph` is not optional. `<lt-toast>` creates and removes its
|
|
21
|
+
* message elements inside the region, and without the attribute the Datastar
|
|
22
|
+
* morph tears them away at the next patch, because the server's version of
|
|
23
|
+
* the region is empty. The attribute must be in the HTML the server sends:
|
|
24
|
+
* the component cannot set it on itself, since the morph reads it from the
|
|
25
|
+
* server's node.
|
|
26
|
+
*/
|
|
27
|
+
export const toast = ({ label = DEFAULT_TEXTS.toastRegion, closeLabel, } = {}) => ({
|
|
28
|
+
host: attributes({
|
|
29
|
+
class: TOAST_CLASS,
|
|
30
|
+
role: "status",
|
|
31
|
+
"aria-live": "polite",
|
|
32
|
+
// `status` is atomic by default, and then the whole stack is announced
|
|
33
|
+
// again for every message that is added.
|
|
34
|
+
"aria-atomic": "false",
|
|
35
|
+
"aria-label": label,
|
|
36
|
+
"close-label": closeLabel,
|
|
37
|
+
"data-ignore-morph": "",
|
|
38
|
+
}),
|
|
39
|
+
message: attributes({ class: TOAST_MESSAGE_CLASS }),
|
|
40
|
+
close: attributes({ class: TOAST_CLOSE_CLASS }),
|
|
41
|
+
});
|
|
42
|
+
//# sourceMappingURL=toast.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toast.js","sourceRoot":"","sources":["../../../../src/components/standalone/toast/toast.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAA;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAA;AAEtD;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,UAAmB,CAAA;AAC9C,MAAM,CAAC,MAAM,mBAAmB,GAAG,mBAA4B,CAAA;AAC/D,MAAM,CAAC,MAAM,iBAAiB,GAAG,iBAA0B,CAAA;AA0B3D;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,MAAM,KAAK,GAAG,CAAC,EACpB,KAAK,GAAG,aAAa,CAAC,WAAW,EACjC,UAAU,MACM,EAAE,EAAmB,EAAE,CAAC,CAAC;IACzC,IAAI,EAAE,UAAU,CAAC;QACf,KAAK,EAAE,WAAW;QAClB,IAAI,EAAE,QAAiB;QACvB,WAAW,EAAE,QAAiB;QAC9B,uEAAuE;QACvE,yCAAyC;QACzC,aAAa,EAAE,OAAgB;QAC/B,YAAY,EAAE,KAAK;QACnB,aAAa,EAAE,UAAU;QACzB,mBAAmB,EAAE,EAAW;KACjC,CAAC;IACF,OAAO,EAAE,UAAU,CAAC,EAAE,KAAK,EAAE,mBAAmB,EAAE,CAAC;IACnD,KAAK,EAAE,UAAU,CAAC,EAAE,KAAK,EAAE,iBAAiB,EAAE,CAAC;CAChD,CAAC,CAAA"}
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The core: LO-TEK's check and theme generator, written in Rust and built to
|
|
3
|
+
* a single WebAssembly module.
|
|
4
|
+
*
|
|
5
|
+
* The same module runs here, in VS Code, on the JVM (Chicory) and in
|
|
6
|
+
* IntelliJ, and gives the same answer everywhere. The module has no imports,
|
|
7
|
+
* so it needs no glue: the loader writes the text in as UTF-8 and reads the
|
|
8
|
+
* answer out as JSON, as every host language does.
|
|
9
|
+
*
|
|
10
|
+
* The core carries no data. The vocabulary and the colour contract are given
|
|
11
|
+
* to it with `loadManifest` and `loadContract`, from the files in the package.
|
|
12
|
+
*
|
|
13
|
+
* `diagnoseMarkup` and `diagnosePage` in `index.ts` load the module and the
|
|
14
|
+
* files from the package themselves. `loadCore` is for anyone who has the
|
|
15
|
+
* module some other way, such as an extension that bundles it, or a browser:
|
|
16
|
+
*
|
|
17
|
+
* ```ts
|
|
18
|
+
* const core = loadCore(await WebAssembly.compileStreaming(fetch(url)))
|
|
19
|
+
* core.loadManifest(await (await fetch(manifestUrl)).text())
|
|
20
|
+
* core.diagnosePage(html)
|
|
21
|
+
* ```
|
|
22
|
+
*
|
|
23
|
+
* Synchronous, because Node, Bun and VS Code allow it. In the browser the
|
|
24
|
+
* module must be compiled with `WebAssembly.compile` first, and the compiled
|
|
25
|
+
* module passed here.
|
|
26
|
+
*/
|
|
27
|
+
export type Severity = "error" | "warning";
|
|
28
|
+
/** One edit in a fix: replace the text from `start` to `end` with `text`. */
|
|
29
|
+
export type Edit = {
|
|
30
|
+
start: number;
|
|
31
|
+
end: number;
|
|
32
|
+
text: string;
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* A fix the editor can offer: one or more edits that belong together, such
|
|
36
|
+
* as `id` on the field and `for` on the label. They are in text order and do
|
|
37
|
+
* not overlap; apply them from the end, so the positions hold. `preferred`
|
|
38
|
+
* marks the safe one, such as `onlinetext` to `online-text`: the same
|
|
39
|
+
* letters, only written differently. A suggestion at a distance is a
|
|
40
|
+
* suggestion.
|
|
41
|
+
*/
|
|
42
|
+
export type Fix = {
|
|
43
|
+
title: string;
|
|
44
|
+
edits: Edit[];
|
|
45
|
+
preferred?: boolean;
|
|
46
|
+
};
|
|
47
|
+
export type Finding = {
|
|
48
|
+
/** Where the finding starts, as an index into the text (UTF-16, like a `string`). */
|
|
49
|
+
start: number;
|
|
50
|
+
end: number;
|
|
51
|
+
/** The line the finding starts on, from 1. */
|
|
52
|
+
line: number;
|
|
53
|
+
/** The column the finding starts at, from 1, in UTF-16 units. */
|
|
54
|
+
column: number;
|
|
55
|
+
message: string;
|
|
56
|
+
severity: Severity;
|
|
57
|
+
/** The name of the rule, such as `unknown-class`. That is what `lotek-ignore-next` takes. */
|
|
58
|
+
rule: string;
|
|
59
|
+
/** The component page, as a link in the message. */
|
|
60
|
+
link: string;
|
|
61
|
+
fix?: Fix;
|
|
62
|
+
};
|
|
63
|
+
export type CoreVersion = {
|
|
64
|
+
/** The version of the core. */
|
|
65
|
+
core: string;
|
|
66
|
+
/** The version of `@lo-tek/interfaces` the manifest was written from, or `null` without a manifest. */
|
|
67
|
+
manifest: string | null;
|
|
68
|
+
/** The manifest format the core understands. */
|
|
69
|
+
schemaVersion: number;
|
|
70
|
+
};
|
|
71
|
+
/** A promise in the colour contract that does not hold. */
|
|
72
|
+
export type Violation = {
|
|
73
|
+
family: string;
|
|
74
|
+
promise: string;
|
|
75
|
+
ratio: number;
|
|
76
|
+
required: number;
|
|
77
|
+
};
|
|
78
|
+
/** The theme `buildTheme` returns: the tokens per appearance, the promises that break, and the CSS. */
|
|
79
|
+
export type CoreTheme = {
|
|
80
|
+
light: Record<string, string>;
|
|
81
|
+
dark: Record<string, string>;
|
|
82
|
+
/** Promises that do not hold. Empty when the theme is sound. */
|
|
83
|
+
violations: Violation[];
|
|
84
|
+
css: string;
|
|
85
|
+
};
|
|
86
|
+
/** What `inspectTheme` found in a theme the consumer has written by hand. */
|
|
87
|
+
export type CoreThemeReport = {
|
|
88
|
+
problems: {
|
|
89
|
+
selector: string;
|
|
90
|
+
message: string;
|
|
91
|
+
}[];
|
|
92
|
+
/** Blocks that were actually read. */
|
|
93
|
+
blocks: number;
|
|
94
|
+
/** Values the consumer wrote, and that were understood. */
|
|
95
|
+
declarations: number;
|
|
96
|
+
/** Promises that were actually checked. */
|
|
97
|
+
promises: number;
|
|
98
|
+
};
|
|
99
|
+
/** What `inspectStyles` found in a stylesheet. */
|
|
100
|
+
export type CoreStyles = {
|
|
101
|
+
/** Every class that appears in a selector. */
|
|
102
|
+
classes: string[];
|
|
103
|
+
/** Every class with an attribute, and the value when the selector requires one. */
|
|
104
|
+
attributes: {
|
|
105
|
+
class: string;
|
|
106
|
+
attribute: string;
|
|
107
|
+
value?: string;
|
|
108
|
+
}[];
|
|
109
|
+
/** The URLs in `@import`. */
|
|
110
|
+
imports: string[];
|
|
111
|
+
};
|
|
112
|
+
export type Core = {
|
|
113
|
+
/** Checks a template or a fragment. Throws without a manifest. */
|
|
114
|
+
diagnoseMarkup(html: string): Finding[];
|
|
115
|
+
/** Checks a whole page, including the wiring. Throws without a manifest. */
|
|
116
|
+
diagnosePage(html: string): Finding[];
|
|
117
|
+
/** Gives the core the vocabulary. Throws with the core's explanation if it cannot be read. */
|
|
118
|
+
loadManifest(json: string): void;
|
|
119
|
+
/** Gives the core the colour contract. Throws with the core's explanation if it cannot be read. */
|
|
120
|
+
loadContract(json: string): void;
|
|
121
|
+
version(): CoreVersion;
|
|
122
|
+
/** Builds a theme from the recipe. Throws without a colour contract, or when the recipe cannot be used. */
|
|
123
|
+
buildTheme(recipe: unknown): CoreTheme;
|
|
124
|
+
/** Checks every promise in a theme written as CSS. Throws without a colour contract. */
|
|
125
|
+
inspectTheme(css: string): CoreThemeReport;
|
|
126
|
+
/** The classes and attribute values a stylesheet styles, read with the core's CSS reader. */
|
|
127
|
+
inspectStyles(css: string): CoreStyles;
|
|
128
|
+
/**
|
|
129
|
+
* The check with the stylesheets as well: a class none of them styles, and
|
|
130
|
+
* a value without a rule. `page` checks as `diagnosePage`, otherwise as
|
|
131
|
+
* `diagnoseMarkup`. Throws without a manifest.
|
|
132
|
+
*/
|
|
133
|
+
diagnoseStyled(html: string, css: string[], page: boolean): Finding[];
|
|
134
|
+
};
|
|
135
|
+
type Exports = {
|
|
136
|
+
memory: WebAssembly.Memory;
|
|
137
|
+
alloc(length: number): number;
|
|
138
|
+
diagnose_markup_raw(pointer: number, length: number): number;
|
|
139
|
+
diagnose_page_raw(pointer: number, length: number): number;
|
|
140
|
+
load_manifest_raw(pointer: number, length: number): number;
|
|
141
|
+
load_contract_raw(pointer: number, length: number): number;
|
|
142
|
+
version_raw(): void;
|
|
143
|
+
build_theme_raw(pointer: number, length: number): number;
|
|
144
|
+
inspect_theme_raw(pointer: number, length: number): number;
|
|
145
|
+
inspect_styles_raw(pointer: number, length: number): void;
|
|
146
|
+
diagnose_styled_raw(pointer: number, length: number): number;
|
|
147
|
+
accessibility_tree_raw(pointer: number, length: number): number;
|
|
148
|
+
accessibility_facts_raw(): void;
|
|
149
|
+
accessibility_roles_raw(): void;
|
|
150
|
+
accessibility_states_raw(): void;
|
|
151
|
+
result_ptr(): number;
|
|
152
|
+
result_len(): number;
|
|
153
|
+
};
|
|
154
|
+
/**
|
|
155
|
+
* @internal Not part of the package's API.
|
|
156
|
+
*
|
|
157
|
+
* An instance of the core and the helpers every call goes through: the text
|
|
158
|
+
* written into the module's memory, and the answer read back. Not part of
|
|
159
|
+
* the package: `index.ts` exports `loadCore`. The tests reach the core's
|
|
160
|
+
* other functions, such as the accessibility tree, through this.
|
|
161
|
+
*/
|
|
162
|
+
export declare function instantiate(source: BufferSource | WebAssembly.Module): {
|
|
163
|
+
e: Exports;
|
|
164
|
+
write: (text: string) => [number, number];
|
|
165
|
+
read: <T>() => T;
|
|
166
|
+
answer: <T>(status: number) => T;
|
|
167
|
+
};
|
|
168
|
+
/** Loads the core from the module's bytes or an already compiled module. */
|
|
169
|
+
export declare function loadCore(source: BufferSource | WebAssembly.Module): Core;
|
|
170
|
+
export {};
|
|
171
|
+
//# sourceMappingURL=core.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../../src/diagnostics/core.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,MAAM,MAAM,QAAQ,GAAG,OAAO,GAAG,SAAS,CAAA;AAE1C,6EAA6E;AAC7E,MAAM,MAAM,IAAI,GAAG;IACjB,KAAK,EAAE,MAAM,CAAA;IACb,GAAG,EAAE,MAAM,CAAA;IACX,IAAI,EAAE,MAAM,CAAA;CACb,CAAA;AAED;;;;;;;GAOG;AACH,MAAM,MAAM,GAAG,GAAG;IAChB,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,EAAE,IAAI,EAAE,CAAA;IACb,SAAS,CAAC,EAAE,OAAO,CAAA;CACpB,CAAA;AAED,MAAM,MAAM,OAAO,GAAG;IACpB,qFAAqF;IACrF,KAAK,EAAE,MAAM,CAAA;IACb,GAAG,EAAE,MAAM,CAAA;IACX,8CAA8C;IAC9C,IAAI,EAAE,MAAM,CAAA;IACZ,iEAAiE;IACjE,MAAM,EAAE,MAAM,CAAA;IACd,OAAO,EAAE,MAAM,CAAA;IACf,QAAQ,EAAE,QAAQ,CAAA;IAClB,6FAA6F;IAC7F,IAAI,EAAE,MAAM,CAAA;IACZ,oDAAoD;IACpD,IAAI,EAAE,MAAM,CAAA;IACZ,GAAG,CAAC,EAAE,GAAG,CAAA;CACV,CAAA;AAED,MAAM,MAAM,WAAW,GAAG;IACxB,+BAA+B;IAC/B,IAAI,EAAE,MAAM,CAAA;IACZ,uGAAuG;IACvG,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAA;IACvB,gDAAgD;IAChD,aAAa,EAAE,MAAM,CAAA;CACtB,CAAA;AAED,2DAA2D;AAC3D,MAAM,MAAM,SAAS,GAAG;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,GAAG,MAAM,CAAA;IAC5D,sBAAsB,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAAA;IAC/D,uBAAuB,IAAI,IAAI,CAAA;IAC/B,uBAAuB,IAAI,IAAI,CAAA;IAC/B,wBAAwB,IAAI,IAAI,CAAA;IAChC,UAAU,IAAI,MAAM,CAAA;IACpB,UAAU,IAAI,MAAM,CAAA;CACrB,CAAA;AAED;;;;;;;GAOG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,YAAY,GAAG,WAAW,CAAC,MAAM;;kBAU9C,MAAM,KAAG,CAAC,MAAM,EAAE,MAAM,CAAC;WAOhC,CAAC,OAAK,CAAC;aAOL,CAAC,UAAU,MAAM,KAAG,CAAC;EAKtC;AAED,4EAA4E;AAC5E,wBAAgB,QAAQ,CAAC,MAAM,EAAE,YAAY,GAAG,WAAW,CAAC,MAAM,GAAG,IAAI,CA4BxE"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The core: LO-TEK's check and theme generator, written in Rust and built to
|
|
3
|
+
* a single WebAssembly module.
|
|
4
|
+
*
|
|
5
|
+
* The same module runs here, in VS Code, on the JVM (Chicory) and in
|
|
6
|
+
* IntelliJ, and gives the same answer everywhere. The module has no imports,
|
|
7
|
+
* so it needs no glue: the loader writes the text in as UTF-8 and reads the
|
|
8
|
+
* answer out as JSON, as every host language does.
|
|
9
|
+
*
|
|
10
|
+
* The core carries no data. The vocabulary and the colour contract are given
|
|
11
|
+
* to it with `loadManifest` and `loadContract`, from the files in the package.
|
|
12
|
+
*
|
|
13
|
+
* `diagnoseMarkup` and `diagnosePage` in `index.ts` load the module and the
|
|
14
|
+
* files from the package themselves. `loadCore` is for anyone who has the
|
|
15
|
+
* module some other way, such as an extension that bundles it, or a browser:
|
|
16
|
+
*
|
|
17
|
+
* ```ts
|
|
18
|
+
* const core = loadCore(await WebAssembly.compileStreaming(fetch(url)))
|
|
19
|
+
* core.loadManifest(await (await fetch(manifestUrl)).text())
|
|
20
|
+
* core.diagnosePage(html)
|
|
21
|
+
* ```
|
|
22
|
+
*
|
|
23
|
+
* Synchronous, because Node, Bun and VS Code allow it. In the browser the
|
|
24
|
+
* module must be compiled with `WebAssembly.compile` first, and the compiled
|
|
25
|
+
* module passed here.
|
|
26
|
+
*/
|
|
27
|
+
/**
|
|
28
|
+
* @internal Not part of the package's API.
|
|
29
|
+
*
|
|
30
|
+
* An instance of the core and the helpers every call goes through: the text
|
|
31
|
+
* written into the module's memory, and the answer read back. Not part of
|
|
32
|
+
* the package: `index.ts` exports `loadCore`. The tests reach the core's
|
|
33
|
+
* other functions, such as the accessibility tree, through this.
|
|
34
|
+
*/
|
|
35
|
+
export function instantiate(source) {
|
|
36
|
+
const module = source instanceof WebAssembly.Module
|
|
37
|
+
? source
|
|
38
|
+
: new WebAssembly.Module(source);
|
|
39
|
+
const e = new WebAssembly.Instance(module, {}).exports;
|
|
40
|
+
const encoder = new TextEncoder();
|
|
41
|
+
const decoder = new TextDecoder();
|
|
42
|
+
/** Writes the text into the module's memory and returns the pointer and length. */
|
|
43
|
+
const write = (text) => {
|
|
44
|
+
const bytes = encoder.encode(text);
|
|
45
|
+
const pointer = e.alloc(bytes.length);
|
|
46
|
+
// The memory can grow on every call, so the view is created after `alloc`.
|
|
47
|
+
new Uint8Array(e.memory.buffer, pointer, bytes.length).set(bytes);
|
|
48
|
+
return [pointer, bytes.length];
|
|
49
|
+
};
|
|
50
|
+
const read = () => JSON.parse(decoder.decode(new Uint8Array(e.memory.buffer, e.result_ptr(), e.result_len())));
|
|
51
|
+
/** The answer from a call that can be rejected: the value, or the core's explanation as an error. */
|
|
52
|
+
const answer = (status) => {
|
|
53
|
+
if (status !== 0)
|
|
54
|
+
throw new Error(read().error);
|
|
55
|
+
return read();
|
|
56
|
+
};
|
|
57
|
+
return { e, write, read, answer };
|
|
58
|
+
}
|
|
59
|
+
/** Loads the core from the module's bytes or an already compiled module. */
|
|
60
|
+
export function loadCore(source) {
|
|
61
|
+
const { e, write, read, answer } = instantiate(source);
|
|
62
|
+
return {
|
|
63
|
+
diagnoseMarkup: (html) => answer(e.diagnose_markup_raw(...write(html))),
|
|
64
|
+
diagnosePage: (html) => answer(e.diagnose_page_raw(...write(html))),
|
|
65
|
+
loadManifest: (json) => {
|
|
66
|
+
answer(e.load_manifest_raw(...write(json)));
|
|
67
|
+
},
|
|
68
|
+
loadContract: (json) => {
|
|
69
|
+
answer(e.load_contract_raw(...write(json)));
|
|
70
|
+
},
|
|
71
|
+
version: () => {
|
|
72
|
+
e.version_raw();
|
|
73
|
+
return read();
|
|
74
|
+
},
|
|
75
|
+
buildTheme: (recipe) => answer(e.build_theme_raw(...write(JSON.stringify(recipe)))),
|
|
76
|
+
inspectTheme: (css) => answer(e.inspect_theme_raw(...write(css))),
|
|
77
|
+
inspectStyles: (css) => {
|
|
78
|
+
e.inspect_styles_raw(...write(css));
|
|
79
|
+
return read();
|
|
80
|
+
},
|
|
81
|
+
diagnoseStyled: (html, css, page) => answer(e.diagnose_styled_raw(...write(JSON.stringify({ html, css, page })))),
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
//# sourceMappingURL=core.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"core.js","sourceRoot":"","sources":["../../src/diagnostics/core.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAqIH;;;;;;;GAOG;AACH,MAAM,UAAU,WAAW,CAAC,MAAyC;IACnE,MAAM,MAAM,GACV,MAAM,YAAY,WAAW,CAAC,MAAM;QAClC,CAAC,CAAC,MAAM;QACR,CAAC,CAAC,IAAI,WAAW,CAAC,MAAM,CAAC,MAAM,CAAC,CAAA;IACpC,MAAM,CAAC,GAAG,IAAI,WAAW,CAAC,QAAQ,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,OAA6B,CAAA;IAC5E,MAAM,OAAO,GAAG,IAAI,WAAW,EAAE,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C,CAAC,CAAC,CACrE;KACJ,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The core from the package itself, loaded the first time it is needed, with
|
|
3
|
+
* the package's manifest and colour contract, which sit next to the module.
|
|
4
|
+
*
|
|
5
|
+
* Both the check (`@lo-tek/interfaces/diagnostics`) and the theme
|
|
6
|
+
* (`@lo-tek/interfaces/theme` and `theme-check`) use the same instance.
|
|
7
|
+
*/
|
|
8
|
+
import { type Core } from "./core.js";
|
|
9
|
+
export declare function defaultCore(): Core;
|
|
10
|
+
//# sourceMappingURL=default-core.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"default-core.d.ts","sourceRoot":"","sources":["../../src/diagnostics/default-core.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,KAAK,IAAI,EAAY,MAAM,WAAW,CAAA;AAoB/C,wBAAgB,WAAW,IAAI,IAAI,CAoDlC"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The core from the package itself, loaded the first time it is needed, with
|
|
3
|
+
* the package's manifest and colour contract, which sit next to the module.
|
|
4
|
+
*
|
|
5
|
+
* Both the check (`@lo-tek/interfaces/diagnostics`) and the theme
|
|
6
|
+
* (`@lo-tek/interfaces/theme` and `theme-check`) use the same instance.
|
|
7
|
+
*/
|
|
8
|
+
import { loadCore } from "./core.js";
|
|
9
|
+
/** The files in the package, seen from both `src/diagnostics/` and `dist/diagnostics/`. */
|
|
10
|
+
const MODULE = new URL("../../core/lotek-core.wasm", import.meta.url);
|
|
11
|
+
const MANIFEST = new URL("../../manifest/manifest.json", import.meta.url);
|
|
12
|
+
const CONTRACT = new URL("../../src/tokens/color-contract.json", import.meta.url);
|
|
13
|
+
let core;
|
|
14
|
+
/*
|
|
15
|
+
* Loaded the first time it is needed, not when the module is imported:
|
|
16
|
+
* anyone who only wants the types, or `loadCore`, should not pay for it.
|
|
17
|
+
*
|
|
18
|
+
* `node:fs` is fetched with `process.getBuiltinModule` instead of an import,
|
|
19
|
+
* so the file can be bundled for the browser without the bundler looking
|
|
20
|
+
* for `fs`.
|
|
21
|
+
*/
|
|
22
|
+
export function defaultCore() {
|
|
23
|
+
if (core)
|
|
24
|
+
return core;
|
|
25
|
+
const fs = globalThis.process?.getBuiltinModule?.("node:fs");
|
|
26
|
+
if (!fs) {
|
|
27
|
+
// `getBuiltinModule` arrived in Node 20.16 and 22.3, so Node 21 and 22.0
|
|
28
|
+
// to 22.2 are excluded even though they are newer than 20.16. `engines`
|
|
29
|
+
// in package.json says the same. A Node without it is still Node, and
|
|
30
|
+
// should be told that the version is wrong, with both limits, so Node
|
|
31
|
+
// 22.1 is not told it is older than 20.16.
|
|
32
|
+
const node = globalThis.process?.versions?.node;
|
|
33
|
+
throw new Error(node
|
|
34
|
+
? `LO-TEK requires Node 20.16 or later in the 20 series, or Node 22.3 or later, and this is Node ${node}.`
|
|
35
|
+
: "LO-TEK reads the core from the package, which requires Node, Bun or Deno. In the browser, load lotek-core.wasm yourself, pass it to loadCore, and give the core manifest.json with loadManifest and color-contract.json with loadContract.");
|
|
36
|
+
}
|
|
37
|
+
let bytes;
|
|
38
|
+
try {
|
|
39
|
+
bytes = fs.readFileSync(MODULE);
|
|
40
|
+
}
|
|
41
|
+
catch {
|
|
42
|
+
throw new Error(`Could not find the core at ${MODULE.pathname}. In the repository it is built with "bun run core" in interfaces/, which requires Rust.`);
|
|
43
|
+
}
|
|
44
|
+
// The manifest is only needed by the check, and the colour contract only
|
|
45
|
+
// by the theme. Each is read the first time a call needs it.
|
|
46
|
+
const loaded = loadCore(bytes);
|
|
47
|
+
let manifest = false;
|
|
48
|
+
let contract = false;
|
|
49
|
+
const withManifest = () => {
|
|
50
|
+
if (!manifest)
|
|
51
|
+
loaded.loadManifest(fs.readFileSync(MANIFEST, "utf8"));
|
|
52
|
+
manifest = true;
|
|
53
|
+
return loaded;
|
|
54
|
+
};
|
|
55
|
+
const withContract = () => {
|
|
56
|
+
if (!contract)
|
|
57
|
+
loaded.loadContract(fs.readFileSync(CONTRACT, "utf8"));
|
|
58
|
+
contract = true;
|
|
59
|
+
return loaded;
|
|
60
|
+
};
|
|
61
|
+
core = {
|
|
62
|
+
...loaded,
|
|
63
|
+
diagnoseMarkup: (html) => withManifest().diagnoseMarkup(html),
|
|
64
|
+
diagnosePage: (html) => withManifest().diagnosePage(html),
|
|
65
|
+
diagnoseStyled: (html, css, page) => withManifest().diagnoseStyled(html, css, page),
|
|
66
|
+
version: () => withManifest().version(),
|
|
67
|
+
buildTheme: (recipe) => withContract().buildTheme(recipe),
|
|
68
|
+
inspectTheme: (css) => withContract().inspectTheme(css),
|
|
69
|
+
};
|
|
70
|
+
return core;
|
|
71
|
+
}
|
|
72
|
+
//# sourceMappingURL=default-core.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"default-core.js","sourceRoot":"","sources":["../../src/diagnostics/default-core.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAa,QAAQ,EAAE,MAAM,WAAW,CAAA;AAE/C,2FAA2F;AAC3F,MAAM,MAAM,GAAG,IAAI,GAAG,CAAC,4BAA4B,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;AACrE,MAAM,QAAQ,GAAG,IAAI,GAAG,CAAC,8BAA8B,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;AACzE,MAAM,QAAQ,GAAG,IAAI,GAAG,CACtB,sCAAsC,EACtC,MAAM,CAAC,IAAI,CAAC,GAAG,CAChB,CAAA;AAED,IAAI,IAAsB,CAAA;AAE1B;;;;;;;GAOG;AACH,MAAM,UAAU,WAAW;IACzB,IAAI,IAAI;QAAE,OAAO,IAAI,CAAA;IACrB,MAAM,EAAE,GAAG,UAAU,CAAC,OAAO,EAAE,gBAAgB,EAAE,CAAC,SAAS,CAE9C,CAAA;IACb,IAAI,CAAC,EA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QAC7D,YAAY,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,YAAY,EAAE,CAAC,YAAY,CAAC,IAAI,CAAC;QACzD,cAAc,EAAE,CAAC,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,EAAE,CAClC,YAAY,EAAE,CAAC,cAAc,CAAC,IAAI,EAAE,GAAG,EAAE,IAAI,CAAC;QAChD,OAAO,EAAE,GAAG,EAAE,CAAC,YAAY,EAAE,CAAC,OAAO,EAAE;QACvC,UAAU,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,YAAY,EAAE,CAAC,UAAU,CAAC,MAAM,CAAC;QACzD,YAAY,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,YAAY,EAAE,CAAC,YAAY,CAAC,GAAG,CAAC;KACxD,CAAA;IACD,OAAO,IAAI,CAAA;AACb,CAAC"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Checks markup against LO-TEK, outside the browser.
|
|
3
|
+
*
|
|
4
|
+
* `diagnoseMarkup(html)` is the same check the editor extensions run while
|
|
5
|
+
* you type, and that `lotek check` runs on the command line. It is here
|
|
6
|
+
* because markup produced without JavaScript, in a Go template, a Kotlin
|
|
7
|
+
* string or a Razor view, has no compiler looking at the attributes. A test
|
|
8
|
+
* in the app can then run it over the HTML the server actually sends:
|
|
9
|
+
*
|
|
10
|
+
* ```ts
|
|
11
|
+
* import { diagnosePage } from "@lo-tek/interfaces/diagnostics"
|
|
12
|
+
*
|
|
13
|
+
* expect(diagnosePage(html)).toEqual([])
|
|
14
|
+
* ```
|
|
15
|
+
*
|
|
16
|
+
* The check is the core, written in Rust and built to WebAssembly (see
|
|
17
|
+
* `core.ts`). The module ships with the package, and is loaded the first
|
|
18
|
+
* time one of the functions is called, in Node, Bun and Deno. In the
|
|
19
|
+
* browser, or where the module is bundled some other way, `loadCore` loads
|
|
20
|
+
* it.
|
|
21
|
+
*/
|
|
22
|
+
import type { Finding } from "./core.js";
|
|
23
|
+
export type { Manifest } from "../vocabulary/types.js";
|
|
24
|
+
export { type Core, type CoreStyles, type CoreTheme, type CoreThemeReport, type CoreVersion, type Finding, type Fix, loadCore, type Severity, type Violation, } from "./core.js";
|
|
25
|
+
/** Options for the check. */
|
|
26
|
+
export type DiagnoseOptions = {
|
|
27
|
+
/**
|
|
28
|
+
* The stylesheets the page loads, as text. With them the check also
|
|
29
|
+
* reports a class none of them styles, as when the component's stylesheet
|
|
30
|
+
* is not loaded, and a value without a rule, such as a variant added to a
|
|
31
|
+
* taken-over component without the CSS getting it.
|
|
32
|
+
*/
|
|
33
|
+
css?: string[];
|
|
34
|
+
};
|
|
35
|
+
/** Every finding in the text: the vocabulary, for a template or a fragment of a page. */
|
|
36
|
+
export declare function diagnoseMarkup(text: string, options?: DiagnoseOptions): Finding[];
|
|
37
|
+
/**
|
|
38
|
+
* Every finding on a whole page: what `diagnoseMarkup` finds, and also that
|
|
39
|
+
* every `for`, `aria-describedby`, `aria-labelledby` and `aria-controls`
|
|
40
|
+
* points to an id that exists, that no id appears twice, and that every
|
|
41
|
+
* LO-TEK field and every help text and error text is wired.
|
|
42
|
+
*
|
|
43
|
+
* Use it on the HTML the server sends, not on a template: in a template split
|
|
44
|
+
* into pieces, the id can be in another file.
|
|
45
|
+
*
|
|
46
|
+
* ```ts
|
|
47
|
+
* const html = await (await fetch("http://localhost:8080/form")).text()
|
|
48
|
+
* expect(diagnosePage(html)).toEqual([])
|
|
49
|
+
* ```
|
|
50
|
+
*/
|
|
51
|
+
export declare function diagnosePage(text: string, options?: DiagnoseOptions): Finding[];
|
|
52
|
+
/** What `diagnoseRendered` needs from a page: `evaluate`, as in Playwright. */
|
|
53
|
+
export type RenderedPage = {
|
|
54
|
+
evaluate<T>(script: () => Promise<T>): Promise<T>;
|
|
55
|
+
};
|
|
56
|
+
/**
|
|
57
|
+
* Reads the rendered page in the browser: the DOM as it stands now, and the
|
|
58
|
+
* text of every stylesheet, with what they import. A stylesheet from another
|
|
59
|
+
* origin, such as a CDN, cannot be read through the CSSOM without
|
|
60
|
+
* `crossorigin`, and is then fetched again with `fetch`.
|
|
61
|
+
*
|
|
62
|
+
* The function runs in the browser, and cannot use anything outside itself.
|
|
63
|
+
*/
|
|
64
|
+
export declare const READ_RENDERED_PAGE: () => Promise<{
|
|
65
|
+
html: string;
|
|
66
|
+
css: string[];
|
|
67
|
+
}>;
|
|
68
|
+
/**
|
|
69
|
+
* Checks the page as the browser has rendered it, with the stylesheets it
|
|
70
|
+
* has loaded: what `diagnosePage` finds, and what the stylesheets do not
|
|
71
|
+
* style. Markup the web components have added, and a class JavaScript has
|
|
72
|
+
* set, are included.
|
|
73
|
+
*
|
|
74
|
+
* ```ts
|
|
75
|
+
* import { diagnoseRendered } from "@lo-tek/interfaces/diagnostics"
|
|
76
|
+
*
|
|
77
|
+
* await page.goto("http://localhost:8080/form")
|
|
78
|
+
* expect(await diagnoseRendered(page)).toEqual([])
|
|
79
|
+
* ```
|
|
80
|
+
*
|
|
81
|
+
* `page` is a Playwright page, or anything with `evaluate`.
|
|
82
|
+
*/
|
|
83
|
+
export declare function diagnoseRendered(page: RenderedPage): Promise<Finding[]>;
|
|
84
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/diagnostics/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAExC,YAAY,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAA;AAItD,OAAO,EACL,KAAK,IAAI,EACT,KAAK,UAAU,EACf,KAAK,SAAS,EACd,KAAK,eAAe,EACpB,KAAK,WAAW,EAChB,KAAK,OAAO,EACZ,KAAK,GAAG,EACR,QAAQ,EACR,KAAK,QAAQ,EACb,KAAK,SAAS,GACf,MAAM,WAAW,CAAA;AAElB,6BAA6B;AAC7B,MAAM,MAAM,eAAe,GAAG;IAC5B;;;;;OAKG;IACH,GAAG,CAAC,EAAE,MAAM,EAAE,CAAA;CACf,CAAA;AAED,yFAAyF;AACzF,wBAAgB,cAAc,CAC5B,IAAI,EAAE,MAAM,EACZ,OAAO,GAAE,eAAoB,GAC5B,OAAO,EAAE,CAIX;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,YAAY,CAC1B,IAAI,EAAE,MAAM,EACZ,OAAO,GAAE,eAAoB,GAC5B,OAAO,EAAE,CAIX;AAED,+EAA+E;AAC/E,MAAM,MAAM,YAAY,GAAG;IACzB,QAAQ,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAA;CAClD,CAAA;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,kBAAkB,QAAa,OAAO,CAAC;IAClD,IAAI,EAAE,MAAM,CAAA;IACZ,GAAG,EAAE,MAAM,EAAE,CAAA;CACd,CA4BA,CAAA;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,gBAAgB,CAAC,IAAI,EAAE,YAAY,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC,CAG7E"}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Checks markup against LO-TEK, outside the browser.
|
|
3
|
+
*
|
|
4
|
+
* `diagnoseMarkup(html)` is the same check the editor extensions run while
|
|
5
|
+
* you type, and that `lotek check` runs on the command line. It is here
|
|
6
|
+
* because markup produced without JavaScript, in a Go template, a Kotlin
|
|
7
|
+
* string or a Razor view, has no compiler looking at the attributes. A test
|
|
8
|
+
* in the app can then run it over the HTML the server actually sends:
|
|
9
|
+
*
|
|
10
|
+
* ```ts
|
|
11
|
+
* import { diagnosePage } from "@lo-tek/interfaces/diagnostics"
|
|
12
|
+
*
|
|
13
|
+
* expect(diagnosePage(html)).toEqual([])
|
|
14
|
+
* ```
|
|
15
|
+
*
|
|
16
|
+
* The check is the core, written in Rust and built to WebAssembly (see
|
|
17
|
+
* `core.ts`). The module ships with the package, and is loaded the first
|
|
18
|
+
* time one of the functions is called, in Node, Bun and Deno. In the
|
|
19
|
+
* browser, or where the module is bundled some other way, `loadCore` loads
|
|
20
|
+
* it.
|
|
21
|
+
*/
|
|
22
|
+
import { defaultCore } from "./default-core.js";
|
|
23
|
+
export { loadCore, } from "./core.js";
|
|
24
|
+
/** Every finding in the text: the vocabulary, for a template or a fragment of a page. */
|
|
25
|
+
export function diagnoseMarkup(text, options = {}) {
|
|
26
|
+
return options.css
|
|
27
|
+
? defaultCore().diagnoseStyled(text, options.css, false)
|
|
28
|
+
: defaultCore().diagnoseMarkup(text);
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Every finding on a whole page: what `diagnoseMarkup` finds, and also that
|
|
32
|
+
* every `for`, `aria-describedby`, `aria-labelledby` and `aria-controls`
|
|
33
|
+
* points to an id that exists, that no id appears twice, and that every
|
|
34
|
+
* LO-TEK field and every help text and error text is wired.
|
|
35
|
+
*
|
|
36
|
+
* Use it on the HTML the server sends, not on a template: in a template split
|
|
37
|
+
* into pieces, the id can be in another file.
|
|
38
|
+
*
|
|
39
|
+
* ```ts
|
|
40
|
+
* const html = await (await fetch("http://localhost:8080/form")).text()
|
|
41
|
+
* expect(diagnosePage(html)).toEqual([])
|
|
42
|
+
* ```
|
|
43
|
+
*/
|
|
44
|
+
export function diagnosePage(text, options = {}) {
|
|
45
|
+
return options.css
|
|
46
|
+
? defaultCore().diagnoseStyled(text, options.css, true)
|
|
47
|
+
: defaultCore().diagnosePage(text);
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Reads the rendered page in the browser: the DOM as it stands now, and the
|
|
51
|
+
* text of every stylesheet, with what they import. A stylesheet from another
|
|
52
|
+
* origin, such as a CDN, cannot be read through the CSSOM without
|
|
53
|
+
* `crossorigin`, and is then fetched again with `fetch`.
|
|
54
|
+
*
|
|
55
|
+
* The function runs in the browser, and cannot use anything outside itself.
|
|
56
|
+
*/
|
|
57
|
+
export const READ_RENDERED_PAGE = async () => {
|
|
58
|
+
const sheets = [
|
|
59
|
+
...document.styleSheets,
|
|
60
|
+
...document.adoptedStyleSheets,
|
|
61
|
+
];
|
|
62
|
+
const css = [];
|
|
63
|
+
const read = async (sheet) => {
|
|
64
|
+
let rules;
|
|
65
|
+
try {
|
|
66
|
+
rules = sheet.cssRules;
|
|
67
|
+
}
|
|
68
|
+
catch {
|
|
69
|
+
if (!sheet.href)
|
|
70
|
+
return;
|
|
71
|
+
const answer = await fetch(sheet.href);
|
|
72
|
+
if (!answer.ok)
|
|
73
|
+
throw new Error(`The stylesheet ${sheet.href} could not be read, and answered ${answer.status} when it was fetched again.`);
|
|
74
|
+
css.push(await answer.text());
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
for (const rule of rules)
|
|
78
|
+
if (rule instanceof CSSImportRule && rule.styleSheet)
|
|
79
|
+
await read(rule.styleSheet);
|
|
80
|
+
css.push([...rules].map((rule) => rule.cssText).join("\n"));
|
|
81
|
+
};
|
|
82
|
+
for (const sheet of sheets)
|
|
83
|
+
await read(sheet);
|
|
84
|
+
const doctype = document.doctype ? `<!DOCTYPE ${document.doctype.name}>` : "";
|
|
85
|
+
return { html: doctype + document.documentElement.outerHTML, css };
|
|
86
|
+
};
|
|
87
|
+
/**
|
|
88
|
+
* Checks the page as the browser has rendered it, with the stylesheets it
|
|
89
|
+
* has loaded: what `diagnosePage` finds, and what the stylesheets do not
|
|
90
|
+
* style. Markup the web components have added, and a class JavaScript has
|
|
91
|
+
* set, are included.
|
|
92
|
+
*
|
|
93
|
+
* ```ts
|
|
94
|
+
* import { diagnoseRendered } from "@lo-tek/interfaces/diagnostics"
|
|
95
|
+
*
|
|
96
|
+
* await page.goto("http://localhost:8080/form")
|
|
97
|
+
* expect(await diagnoseRendered(page)).toEqual([])
|
|
98
|
+
* ```
|
|
99
|
+
*
|
|
100
|
+
* `page` is a Playwright page, or anything with `evaluate`.
|
|
101
|
+
*/
|
|
102
|
+
export async function diagnoseRendered(page) {
|
|
103
|
+
const { html, css } = await page.evaluate(READ_RENDERED_PAGE);
|
|
104
|
+
return defaultCore().diagnoseStyled(html, css, true);
|
|
105
|
+
}
|
|
106
|
+
//# sourceMappingURL=index.js.map
|