@owlmeans/web-panel 0.1.18-rc.9 → 0.1.18
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/README.md +510 -143
- package/THIRD-PARTY-NOTICES.txt +24 -0
- package/agent-meta/manifest.json +163 -4
- package/agent-meta/skills/web-panel/SKILL.md +136 -83
- package/agent-meta/skills/web-panel/parts/consent.md +114 -0
- package/agent-meta/skills/web-panel/parts/editor.md +47 -0
- package/agent-meta/skills/web-panel/parts/forms.md +85 -0
- package/agent-meta/skills/web-panel/parts/navigation.md +203 -0
- package/agent-meta/skills/web-panel/parts/picker.md +164 -0
- package/agent-meta/skills/web-panel/parts/reload.md +46 -0
- package/agent-meta/skills/web-panel/parts/sign-in.md +65 -0
- package/agent-meta/skills/web-panel/parts/theme.md +74 -0
- package/build/@/components/ui/alert-dialog.d.ts +15 -0
- package/build/@/components/ui/alert-dialog.d.ts.map +1 -0
- package/build/@/components/ui/alert-dialog.js +39 -0
- package/build/@/components/ui/alert-dialog.js.map +1 -0
- package/build/@/components/ui/alert.js +1 -1
- package/build/@/components/ui/alert.js.map +1 -1
- package/build/@/components/ui/button.js +1 -1
- package/build/@/components/ui/button.js.map +1 -1
- package/build/@/components/ui/card.js +1 -1
- package/build/@/components/ui/card.js.map +1 -1
- package/build/@/components/ui/input.js +1 -1
- package/build/@/components/ui/input.js.map +1 -1
- package/build/@/components/ui/label.js +1 -1
- package/build/@/components/ui/label.js.map +1 -1
- package/build/@/components/ui/navigation-menu.js +1 -1
- package/build/@/components/ui/navigation-menu.js.map +1 -1
- package/build/@/components/ui/popover.d.ts +8 -0
- package/build/@/components/ui/popover.d.ts.map +1 -0
- package/build/@/components/ui/popover.js +17 -0
- package/build/@/components/ui/popover.js.map +1 -0
- package/build/@/components/ui/progress.js +1 -1
- package/build/@/components/ui/progress.js.map +1 -1
- package/build/@/components/ui/separator.js +1 -1
- package/build/@/components/ui/separator.js.map +1 -1
- package/build/@/components/ui/sheet.d.ts +15 -0
- package/build/@/components/ui/sheet.d.ts.map +1 -0
- package/build/@/components/ui/sheet.js +40 -0
- package/build/@/components/ui/sheet.js.map +1 -0
- package/build/auth/context.d.ts.map +1 -1
- package/build/auth/context.js +0 -1
- package/build/auth/context.js.map +1 -1
- package/build/auth/entrypoints.d.ts +10 -0
- package/build/auth/entrypoints.d.ts.map +1 -0
- package/build/auth/entrypoints.js +4 -0
- package/build/auth/entrypoints.js.map +1 -0
- package/build/auth/exports.d.ts +4 -4
- package/build/auth/exports.d.ts.map +1 -1
- package/build/auth/exports.js +3 -3
- package/build/auth/exports.js.map +1 -1
- package/build/auth/modules.d.ts +1 -1
- package/build/auth/modules.d.ts.map +1 -1
- package/build/auth/plugins/basic-ed25519.js +4 -4
- package/build/auth/plugins/basic-ed25519.js.map +1 -1
- package/build/auth/plugins/re-captcha.js +3 -3
- package/build/auth/plugins/re-captcha.js.map +1 -1
- package/build/auth/plugins/tunnel-consumer.js +1 -1
- package/build/auth/plugins/tunnel-consumer.js.map +1 -1
- package/build/components/block.js +2 -2
- package/build/components/block.js.map +1 -1
- package/build/components/consts.local.d.ts +14 -0
- package/build/components/consts.local.d.ts.map +1 -0
- package/build/components/consts.local.js +26 -0
- package/build/components/consts.local.js.map +1 -0
- package/build/components/footer/component.d.ts +19 -1
- package/build/components/footer/component.d.ts.map +1 -1
- package/build/components/footer/component.js +38 -11
- package/build/components/footer/component.js.map +1 -1
- package/build/components/footer/credit.d.ts +27 -0
- package/build/components/footer/credit.d.ts.map +1 -0
- package/build/components/footer/credit.js +42 -0
- package/build/components/footer/credit.js.map +1 -0
- package/build/components/footer/index.d.ts +1 -0
- package/build/components/footer/index.d.ts.map +1 -1
- package/build/components/footer/index.js +1 -0
- package/build/components/footer/index.js.map +1 -1
- package/build/components/footer/types.d.ts +22 -1
- package/build/components/footer/types.d.ts.map +1 -1
- package/build/components/form/button/component.d.ts.map +1 -1
- package/build/components/form/button/component.js +5 -3
- package/build/components/form/button/component.js.map +1 -1
- package/build/components/form/component.js +2 -2
- package/build/components/form/component.js.map +1 -1
- package/build/components/form/text/component.js +2 -2
- package/build/components/form/text/component.js.map +1 -1
- package/build/components/helper.d.ts.map +1 -1
- package/build/components/helper.js +1 -12
- package/build/components/helper.js.map +1 -1
- package/build/components/index.d.ts +4 -0
- package/build/components/index.d.ts.map +1 -1
- package/build/components/index.js +4 -0
- package/build/components/index.js.map +1 -1
- package/build/components/link.js +3 -3
- package/build/components/link.js.map +1 -1
- package/build/components/login/append.d.ts +15 -0
- package/build/components/login/append.d.ts.map +1 -0
- package/build/components/login/append.js +26 -0
- package/build/components/login/append.js.map +1 -0
- package/build/components/login/consts.d.ts +3 -0
- package/build/components/login/consts.d.ts.map +1 -0
- package/build/components/login/consts.js +3 -0
- package/build/components/login/consts.js.map +1 -0
- package/build/components/login/consts.local.d.ts +4 -0
- package/build/components/login/consts.local.d.ts.map +1 -0
- package/build/components/login/consts.local.js +8 -0
- package/build/components/login/consts.local.js.map +1 -0
- package/build/components/login/credit.d.ts +12 -0
- package/build/components/login/credit.d.ts.map +1 -0
- package/build/components/login/credit.js +18 -0
- package/build/components/login/credit.js.map +1 -0
- package/build/components/login/i18n/be.json +10 -0
- package/build/components/login/i18n/de.json +10 -0
- package/build/components/login/i18n/en.json +10 -0
- package/build/components/login/i18n/es.json +10 -0
- package/build/components/login/i18n/fr.json +10 -0
- package/build/components/login/i18n/pl.json +10 -0
- package/build/components/login/i18n/ru.json +10 -0
- package/build/components/login/i18n/uk.json +10 -0
- package/build/components/login/i18n.d.ts +2 -0
- package/build/components/login/i18n.d.ts.map +1 -0
- package/build/components/login/i18n.js +28 -0
- package/build/components/login/i18n.js.map +1 -0
- package/build/components/login/icons.d.ts +14 -0
- package/build/components/login/icons.d.ts.map +1 -0
- package/build/components/login/icons.js +29 -0
- package/build/components/login/icons.js.map +1 -0
- package/build/components/login/index.d.ts +11 -0
- package/build/components/login/index.d.ts.map +1 -0
- package/build/components/login/index.js +10 -0
- package/build/components/login/index.js.map +1 -0
- package/build/components/login/notify.d.ts +18 -0
- package/build/components/login/notify.d.ts.map +1 -0
- package/build/components/login/notify.js +41 -0
- package/build/components/login/notify.js.map +1 -0
- package/build/components/login/provider.d.ts +20 -0
- package/build/components/login/provider.d.ts.map +1 -0
- package/build/components/login/provider.js +31 -0
- package/build/components/login/provider.js.map +1 -0
- package/build/components/login/screen.d.ts +24 -0
- package/build/components/login/screen.d.ts.map +1 -0
- package/build/components/login/screen.js +92 -0
- package/build/components/login/screen.js.map +1 -0
- package/build/components/login/terms.d.ts +19 -0
- package/build/components/login/terms.d.ts.map +1 -0
- package/build/components/login/terms.js +32 -0
- package/build/components/login/terms.js.map +1 -0
- package/build/components/login/types.d.ts +28 -0
- package/build/components/login/types.d.ts.map +1 -0
- package/build/components/login/types.js +2 -0
- package/build/components/login/types.js.map +1 -0
- package/build/components/nav/consts.local.d.ts +41 -0
- package/build/components/nav/consts.local.d.ts.map +1 -0
- package/build/components/nav/consts.local.js +60 -0
- package/build/components/nav/consts.local.js.map +1 -0
- package/build/components/nav/index.d.ts +1 -0
- package/build/components/nav/index.d.ts.map +1 -1
- package/build/components/nav/index.js +1 -0
- package/build/components/nav/index.js.map +1 -1
- package/build/components/nav/layout.d.ts +9 -2
- package/build/components/nav/layout.d.ts.map +1 -1
- package/build/components/nav/layout.js +48 -7
- package/build/components/nav/layout.js.map +1 -1
- package/build/components/nav/mobile.d.ts +21 -0
- package/build/components/nav/mobile.d.ts.map +1 -0
- package/build/components/nav/mobile.js +55 -0
- package/build/components/nav/mobile.js.map +1 -0
- package/build/components/nav/side.d.ts.map +1 -1
- package/build/components/nav/side.js +10 -10
- package/build/components/nav/side.js.map +1 -1
- package/build/components/nav/top.d.ts.map +1 -1
- package/build/components/nav/top.js +12 -8
- package/build/components/nav/top.js.map +1 -1
- package/build/components/nav/types.d.ts +64 -1
- package/build/components/nav/types.d.ts.map +1 -1
- package/build/components/nav/viewport.d.ts +3 -0
- package/build/components/nav/viewport.d.ts.map +1 -0
- package/build/components/nav/viewport.js +14 -0
- package/build/components/nav/viewport.js.map +1 -0
- package/build/components/panel-app/component.d.ts.map +1 -1
- package/build/components/panel-app/component.js +4 -3
- package/build/components/panel-app/component.js.map +1 -1
- package/build/components/picker/color-picker.d.ts +9 -0
- package/build/components/picker/color-picker.d.ts.map +1 -0
- package/build/components/picker/color-picker.js +9 -0
- package/build/components/picker/color-picker.js.map +1 -0
- package/build/components/picker/consts.local.d.ts +76 -0
- package/build/components/picker/consts.local.d.ts.map +1 -0
- package/build/components/picker/consts.local.js +214 -0
- package/build/components/picker/consts.local.js.map +1 -0
- package/build/components/picker/dot.d.ts +8 -0
- package/build/components/picker/dot.d.ts.map +1 -0
- package/build/components/picker/dot.js +10 -0
- package/build/components/picker/dot.js.map +1 -0
- package/build/components/picker/grid.d.ts +17 -0
- package/build/components/picker/grid.d.ts.map +1 -0
- package/build/components/picker/grid.js +73 -0
- package/build/components/picker/grid.js.map +1 -0
- package/build/components/picker/i18n/be.json +60 -0
- package/build/components/picker/i18n/de.json +60 -0
- package/build/components/picker/i18n/en.json +60 -0
- package/build/components/picker/i18n/es.json +60 -0
- package/build/components/picker/i18n/fr.json +60 -0
- package/build/components/picker/i18n/pl.json +60 -0
- package/build/components/picker/i18n/ru.json +60 -0
- package/build/components/picker/i18n/uk.json +60 -0
- package/build/components/picker/i18n.d.ts +2 -0
- package/build/components/picker/i18n.d.ts.map +1 -0
- package/build/components/picker/i18n.js +18 -0
- package/build/components/picker/i18n.js.map +1 -0
- package/build/components/picker/icon-color-picker.d.ts +14 -0
- package/build/components/picker/icon-color-picker.d.ts.map +1 -0
- package/build/components/picker/icon-color-picker.js +15 -0
- package/build/components/picker/icon-color-picker.js.map +1 -0
- package/build/components/picker/icon-picker.d.ts +8 -0
- package/build/components/picker/icon-picker.d.ts.map +1 -0
- package/build/components/picker/icon-picker.js +8 -0
- package/build/components/picker/icon-picker.js.map +1 -0
- package/build/components/picker/index.d.ts +11 -0
- package/build/components/picker/index.d.ts.map +1 -0
- package/build/components/picker/index.js +10 -0
- package/build/components/picker/index.js.map +1 -0
- package/build/components/picker/panel.d.ts +9 -0
- package/build/components/picker/panel.d.ts.map +1 -0
- package/build/components/picker/panel.js +23 -0
- package/build/components/picker/panel.js.map +1 -0
- package/build/components/picker/root.d.ts +13 -0
- package/build/components/picker/root.d.ts.map +1 -0
- package/build/components/picker/root.js +55 -0
- package/build/components/picker/root.js.map +1 -0
- package/build/components/picker/roving.d.ts +8 -0
- package/build/components/picker/roving.d.ts.map +1 -0
- package/build/components/picker/roving.js +62 -0
- package/build/components/picker/roving.js.map +1 -0
- package/build/components/picker/surface.d.ts +18 -0
- package/build/components/picker/surface.d.ts.map +1 -0
- package/build/components/picker/surface.js +36 -0
- package/build/components/picker/surface.js.map +1 -0
- package/build/components/picker/swatches/custom.d.ts +10 -0
- package/build/components/picker/swatches/custom.d.ts.map +1 -0
- package/build/components/picker/swatches/custom.js +65 -0
- package/build/components/picker/swatches/custom.js.map +1 -0
- package/build/components/picker/swatches.d.ts +16 -0
- package/build/components/picker/swatches.d.ts.map +1 -0
- package/build/components/picker/swatches.js +35 -0
- package/build/components/picker/swatches.js.map +1 -0
- package/build/components/picker/text.d.ts +5 -0
- package/build/components/picker/text.d.ts.map +1 -0
- package/build/components/picker/text.js +29 -0
- package/build/components/picker/text.js.map +1 -0
- package/build/components/picker/tile.d.ts +11 -0
- package/build/components/picker/tile.d.ts.map +1 -0
- package/build/components/picker/tile.js +19 -0
- package/build/components/picker/tile.js.map +1 -0
- package/build/components/picker/translate.d.ts +9 -0
- package/build/components/picker/translate.d.ts.map +1 -0
- package/build/components/picker/translate.js +13 -0
- package/build/components/picker/translate.js.map +1 -0
- package/build/components/picker/trigger.d.ts +12 -0
- package/build/components/picker/trigger.d.ts.map +1 -0
- package/build/components/picker/trigger.js +29 -0
- package/build/components/picker/trigger.js.map +1 -0
- package/build/components/picker/types.d.ts +114 -0
- package/build/components/picker/types.d.ts.map +1 -0
- package/build/components/picker/types.js +2 -0
- package/build/components/picker/types.js.map +1 -0
- package/build/components/picker/types.local.d.ts +143 -0
- package/build/components/picker/types.local.d.ts.map +1 -0
- package/build/components/picker/types.local.js +2 -0
- package/build/components/picker/types.local.js.map +1 -0
- package/build/components/scheme/consts.local.d.ts +8 -0
- package/build/components/scheme/consts.local.d.ts.map +1 -0
- package/build/components/scheme/consts.local.js +13 -0
- package/build/components/scheme/consts.local.js.map +1 -0
- package/build/components/scheme/hook.d.ts +16 -0
- package/build/components/scheme/hook.d.ts.map +1 -0
- package/build/components/scheme/hook.js +52 -0
- package/build/components/scheme/hook.js.map +1 -0
- package/build/components/scheme/index.d.ts +4 -0
- package/build/components/scheme/index.d.ts.map +1 -0
- package/build/components/scheme/index.js +3 -0
- package/build/components/scheme/index.js.map +1 -0
- package/build/components/scheme/toggle.d.ts +14 -0
- package/build/components/scheme/toggle.d.ts.map +1 -0
- package/build/components/scheme/toggle.js +24 -0
- package/build/components/scheme/toggle.js.map +1 -0
- package/build/components/scheme/types.d.ts +21 -0
- package/build/components/scheme/types.d.ts.map +1 -0
- package/build/components/scheme/types.js +2 -0
- package/build/components/scheme/types.js.map +1 -0
- package/build/components/socket/i18n/be.json +9 -0
- package/build/components/socket/i18n/de.json +9 -0
- package/build/components/socket/i18n/en.json +9 -0
- package/build/components/socket/i18n/es.json +9 -0
- package/build/components/socket/i18n/fr.json +9 -0
- package/build/components/socket/i18n/pl.json +9 -0
- package/build/components/socket/i18n/ru.json +9 -0
- package/build/components/socket/i18n/uk.json +9 -0
- package/build/components/socket/i18n.d.ts +2 -0
- package/build/components/socket/i18n.d.ts.map +1 -0
- package/build/components/socket/i18n.js +18 -0
- package/build/components/socket/i18n.js.map +1 -0
- package/build/components/socket/index.d.ts +3 -0
- package/build/components/socket/index.d.ts.map +1 -0
- package/build/components/socket/index.js +3 -0
- package/build/components/socket/index.js.map +1 -0
- package/build/components/socket/reload-dialog.d.ts +22 -0
- package/build/components/socket/reload-dialog.d.ts.map +1 -0
- package/build/components/socket/reload-dialog.js +34 -0
- package/build/components/socket/reload-dialog.js.map +1 -0
- package/build/components/status.js +1 -1
- package/build/components/status.js.map +1 -1
- package/build/components/text.d.ts.map +1 -1
- package/build/components/text.js +2 -13
- package/build/components/text.js.map +1 -1
- package/build/components/toaster.d.ts +16 -0
- package/build/components/toaster.d.ts.map +1 -0
- package/build/components/toaster.js +52 -0
- package/build/components/toaster.js.map +1 -0
- package/build/components/uploader/consts.local.d.ts +4 -0
- package/build/components/uploader/consts.local.d.ts.map +1 -0
- package/build/components/uploader/consts.local.js +6 -0
- package/build/components/uploader/consts.local.js.map +1 -0
- package/build/components/uploader/image.d.ts.map +1 -1
- package/build/components/uploader/image.js +2 -6
- package/build/components/uploader/image.js.map +1 -1
- package/build/consent/component.d.ts +27 -0
- package/build/consent/component.d.ts.map +1 -0
- package/build/consent/component.js +60 -0
- package/build/consent/component.js.map +1 -0
- package/build/consent/consts.d.ts +2 -0
- package/build/consent/consts.d.ts.map +1 -0
- package/build/consent/consts.js +2 -0
- package/build/consent/consts.js.map +1 -0
- package/build/consent/consts.local.d.ts +9 -0
- package/build/consent/consts.local.d.ts.map +1 -0
- package/build/consent/consts.local.js +9 -0
- package/build/consent/consts.local.js.map +1 -0
- package/build/consent/geo.d.ts +17 -0
- package/build/consent/geo.d.ts.map +1 -0
- package/build/consent/geo.js +19 -0
- package/build/consent/geo.js.map +1 -0
- package/build/consent/index.d.ts +11 -0
- package/build/consent/index.d.ts.map +1 -0
- package/build/consent/index.js +9 -0
- package/build/consent/index.js.map +1 -0
- package/build/consent/language.d.ts +12 -0
- package/build/consent/language.d.ts.map +1 -0
- package/build/consent/language.js +11 -0
- package/build/consent/language.js.map +1 -0
- package/build/consent/menu-widget.d.ts +13 -0
- package/build/consent/menu-widget.d.ts.map +1 -0
- package/build/consent/menu-widget.js +20 -0
- package/build/consent/menu-widget.js.map +1 -0
- package/build/consent/presence.d.ts +30 -0
- package/build/consent/presence.d.ts.map +1 -0
- package/build/consent/presence.js +40 -0
- package/build/consent/presence.js.map +1 -0
- package/build/consent/service.d.ts +18 -0
- package/build/consent/service.d.ts.map +1 -0
- package/build/consent/service.js +53 -0
- package/build/consent/service.js.map +1 -0
- package/build/consent/translate.d.ts +14 -0
- package/build/consent/translate.d.ts.map +1 -0
- package/build/consent/translate.js +28 -0
- package/build/consent/translate.js.map +1 -0
- package/build/consent/types.d.ts +39 -0
- package/build/consent/types.d.ts.map +1 -0
- package/build/consent/types.js +2 -0
- package/build/consent/types.js.map +1 -0
- package/build/consent/types.local.d.ts +6 -0
- package/build/consent/types.local.d.ts.map +1 -0
- package/build/consent/types.local.js +2 -0
- package/build/consent/types.local.js.map +1 -0
- package/build/context.d.ts.map +1 -1
- package/build/context.js +10 -0
- package/build/context.js.map +1 -1
- package/build/editor/component.d.ts +4 -0
- package/build/editor/component.d.ts.map +1 -0
- package/build/editor/component.js +103 -0
- package/build/editor/component.js.map +1 -0
- package/build/editor/consts.local.d.ts +6 -0
- package/build/editor/consts.local.d.ts.map +1 -0
- package/build/editor/consts.local.js +58 -0
- package/build/editor/consts.local.js.map +1 -0
- package/build/editor/index.d.ts +3 -0
- package/build/editor/index.d.ts.map +1 -0
- package/build/editor/index.js +2 -0
- package/build/editor/index.js.map +1 -0
- package/build/editor/types.d.ts +24 -0
- package/build/editor/types.d.ts.map +1 -0
- package/build/editor/types.js +2 -0
- package/build/editor/types.js.map +1 -0
- package/build/entrypoints.d.ts +8 -0
- package/build/entrypoints.d.ts.map +1 -0
- package/build/entrypoints.js +4 -0
- package/build/entrypoints.js.map +1 -0
- package/build/exports.d.ts +6 -5
- package/build/exports.d.ts.map +1 -1
- package/build/exports.js +5 -5
- package/build/exports.js.map +1 -1
- package/build/index.d.ts +1 -1
- package/build/index.d.ts.map +1 -1
- package/build/index.js +1 -1
- package/build/index.js.map +1 -1
- package/build/main.d.ts +1 -4
- package/build/main.d.ts.map +1 -1
- package/build/main.js.map +1 -1
- package/build/modules.d.ts +1 -1
- package/build/modules.d.ts.map +1 -1
- package/build/permission/i18n/be.json +13 -0
- package/build/permission/i18n/de.json +13 -0
- package/build/permission/i18n/en.json +13 -0
- package/build/permission/i18n/es.json +13 -0
- package/build/permission/i18n/fr.json +13 -0
- package/build/permission/i18n/pl.json +13 -0
- package/build/permission/i18n/ru.json +13 -0
- package/build/permission/i18n/uk.json +13 -0
- package/build/permission/i18n.d.ts +2 -0
- package/build/permission/i18n.d.ts.map +1 -0
- package/build/permission/i18n.js +13 -0
- package/build/permission/i18n.js.map +1 -0
- package/build/permission/index.d.ts +6 -0
- package/build/permission/index.d.ts.map +1 -0
- package/build/permission/index.js +27 -0
- package/build/permission/index.js.map +1 -0
- package/build/permission/toast.d.ts +5 -0
- package/build/permission/toast.d.ts.map +1 -0
- package/build/permission/toast.js +8 -0
- package/build/permission/toast.js.map +1 -0
- package/build/permission/types.d.ts +6 -0
- package/build/permission/types.d.ts.map +1 -0
- package/build/permission/types.js +2 -0
- package/build/permission/types.js.map +1 -0
- package/build/picker/icons/consts.d.ts +9 -0
- package/build/picker/icons/consts.d.ts.map +1 -0
- package/build/picker/icons/consts.js +264 -0
- package/build/picker/icons/consts.js.map +1 -0
- package/build/picker/icons/types.d.ts +18 -0
- package/build/picker/icons/types.d.ts.map +1 -0
- package/build/picker/icons/types.js +2 -0
- package/build/picker/icons/types.js.map +1 -0
- package/build/picker/icons.d.ts +4 -0
- package/build/picker/icons.d.ts.map +1 -0
- package/build/picker/icons.js +54 -0
- package/build/picker/icons.js.map +1 -0
- package/build/picker/index.d.ts +11 -0
- package/build/picker/index.d.ts.map +1 -0
- package/build/picker/index.js +10 -0
- package/build/picker/index.js.map +1 -0
- package/build/picker/utils/color/types.d.ts +35 -0
- package/build/picker/utils/color/types.d.ts.map +1 -0
- package/build/picker/utils/color/types.js +2 -0
- package/build/picker/utils/color/types.js.map +1 -0
- package/build/picker/utils/color.d.ts +4 -0
- package/build/picker/utils/color.d.ts.map +1 -0
- package/build/picker/utils/color.js +96 -0
- package/build/picker/utils/color.js.map +1 -0
- package/build/picker/vocabulary/consts.d.ts +26 -0
- package/build/picker/vocabulary/consts.d.ts.map +1 -0
- package/build/picker/vocabulary/consts.js +336 -0
- package/build/picker/vocabulary/consts.js.map +1 -0
- package/build/picker/vocabulary/types.d.ts +67 -0
- package/build/picker/vocabulary/types.d.ts.map +1 -0
- package/build/picker/vocabulary/types.js +2 -0
- package/build/picker/vocabulary/types.js.map +1 -0
- package/build/picker/vocabulary.d.ts +11 -0
- package/build/picker/vocabulary.d.ts.map +1 -0
- package/build/picker/vocabulary.js +83 -0
- package/build/picker/vocabulary.js.map +1 -0
- package/build/scheme/consts.d.ts +8 -0
- package/build/scheme/consts.d.ts.map +1 -0
- package/build/scheme/consts.js +8 -0
- package/build/scheme/consts.js.map +1 -0
- package/build/scheme/index.d.ts +4 -0
- package/build/scheme/index.d.ts.map +1 -0
- package/build/scheme/index.js +3 -0
- package/build/scheme/index.js.map +1 -0
- package/build/scheme/scheme.d.ts +16 -0
- package/build/scheme/scheme.d.ts.map +1 -0
- package/build/scheme/scheme.js +58 -0
- package/build/scheme/scheme.js.map +1 -0
- package/build/scheme/types.d.ts +30 -0
- package/build/scheme/types.d.ts.map +1 -0
- package/build/scheme/types.js +2 -0
- package/build/scheme/types.js.map +1 -0
- package/build/types.d.ts +18 -2
- package/build/types.d.ts.map +1 -1
- package/package.json +107 -52
- package/src/@/components/ui/alert-dialog.tsx +156 -0
- package/src/@/components/ui/alert.tsx +1 -1
- package/src/@/components/ui/button.tsx +1 -1
- package/src/@/components/ui/card.tsx +1 -1
- package/src/@/components/ui/input.tsx +1 -1
- package/src/@/components/ui/label.tsx +1 -1
- package/src/@/components/ui/navigation-menu.tsx +1 -1
- package/src/@/components/ui/popover.tsx +47 -0
- package/src/@/components/ui/progress.tsx +1 -1
- package/src/@/components/ui/separator.tsx +1 -1
- package/src/@/components/ui/sheet.tsx +142 -0
- package/src/auth/context.ts +0 -2
- package/src/auth/entrypoints.ts +5 -0
- package/src/auth/exports.ts +4 -4
- package/src/auth/plugins/basic-ed25519.tsx +4 -4
- package/src/auth/plugins/re-captcha.tsx +3 -3
- package/src/auth/plugins/tunnel-consumer.tsx +1 -1
- package/src/components/block.tsx +2 -2
- package/src/components/consts.local.ts +29 -0
- package/src/components/footer/component.tsx +58 -16
- package/src/components/footer/credit.tsx +61 -0
- package/src/components/footer/index.ts +1 -0
- package/src/components/footer/types.ts +22 -1
- package/src/components/form/button/component.tsx +7 -4
- package/src/components/form/component.tsx +2 -2
- package/src/components/form/text/component.tsx +2 -2
- package/src/components/helper.ts +1 -13
- package/src/components/index.ts +4 -0
- package/src/components/link.tsx +3 -3
- package/src/components/login/append.ts +34 -0
- package/src/components/login/consts.local.ts +10 -0
- package/src/components/login/consts.ts +2 -0
- package/src/components/login/credit.tsx +33 -0
- package/src/components/login/i18n/be.json +10 -0
- package/src/components/login/i18n/de.json +10 -0
- package/src/components/login/i18n/en.json +10 -0
- package/src/components/login/i18n/es.json +10 -0
- package/src/components/login/i18n/fr.json +10 -0
- package/src/components/login/i18n/pl.json +10 -0
- package/src/components/login/i18n/ru.json +10 -0
- package/src/components/login/i18n/uk.json +10 -0
- package/src/components/login/i18n.ts +29 -0
- package/src/components/login/icons.tsx +39 -0
- package/src/components/login/index.ts +11 -0
- package/src/components/login/notify.ts +48 -0
- package/src/components/login/provider.tsx +57 -0
- package/src/components/login/screen.tsx +178 -0
- package/src/components/login/terms.tsx +75 -0
- package/src/components/login/types.ts +30 -0
- package/src/components/nav/consts.local.ts +64 -0
- package/src/components/nav/index.ts +1 -0
- package/src/components/nav/layout.tsx +184 -26
- package/src/components/nav/mobile.tsx +165 -0
- package/src/components/nav/side.tsx +43 -27
- package/src/components/nav/top.tsx +44 -22
- package/src/components/nav/types.ts +65 -2
- package/src/components/nav/viewport.ts +16 -0
- package/src/components/panel-app/component.tsx +9 -1
- package/src/components/picker/color-picker.tsx +15 -0
- package/src/components/picker/consts.local.ts +267 -0
- package/src/components/picker/dot.tsx +21 -0
- package/src/components/picker/grid.tsx +138 -0
- package/src/components/picker/i18n/be.json +60 -0
- package/src/components/picker/i18n/de.json +60 -0
- package/src/components/picker/i18n/en.json +60 -0
- package/src/components/picker/i18n/es.json +60 -0
- package/src/components/picker/i18n/fr.json +60 -0
- package/src/components/picker/i18n/pl.json +60 -0
- package/src/components/picker/i18n/ru.json +60 -0
- package/src/components/picker/i18n/uk.json +60 -0
- package/src/components/picker/i18n.ts +19 -0
- package/src/components/picker/icon-color-picker.tsx +25 -0
- package/src/components/picker/icon-picker.tsx +13 -0
- package/src/components/picker/index.ts +11 -0
- package/src/components/picker/panel.tsx +61 -0
- package/src/components/picker/root.tsx +81 -0
- package/src/components/picker/roving.ts +70 -0
- package/src/components/picker/surface.tsx +62 -0
- package/src/components/picker/swatches/custom.tsx +110 -0
- package/src/components/picker/swatches.tsx +67 -0
- package/src/components/picker/text.ts +46 -0
- package/src/components/picker/tile.tsx +35 -0
- package/src/components/picker/translate.ts +15 -0
- package/src/components/picker/trigger.tsx +54 -0
- package/src/components/picker/types.local.ts +154 -0
- package/src/components/picker/types.ts +125 -0
- package/src/components/scheme/consts.local.ts +13 -0
- package/src/components/scheme/hook.ts +62 -0
- package/src/components/scheme/index.ts +4 -0
- package/src/components/scheme/toggle.tsx +32 -0
- package/src/components/scheme/types.ts +23 -0
- package/src/components/socket/i18n/be.json +9 -0
- package/src/components/socket/i18n/de.json +9 -0
- package/src/components/socket/i18n/en.json +9 -0
- package/src/components/socket/i18n/es.json +9 -0
- package/src/components/socket/i18n/fr.json +9 -0
- package/src/components/socket/i18n/pl.json +9 -0
- package/src/components/socket/i18n/ru.json +9 -0
- package/src/components/socket/i18n/uk.json +9 -0
- package/src/components/socket/i18n.ts +19 -0
- package/src/components/socket/index.ts +2 -0
- package/src/components/socket/reload-dialog.tsx +61 -0
- package/src/components/status.tsx +1 -1
- package/src/components/text.tsx +2 -14
- package/src/components/toaster.tsx +65 -0
- package/src/components/uploader/consts.local.ts +7 -0
- package/src/components/uploader/image.tsx +2 -6
- package/src/consent/component.tsx +84 -0
- package/src/consent/consts.local.ts +10 -0
- package/src/consent/consts.ts +1 -0
- package/src/consent/geo.ts +26 -0
- package/src/consent/index.ts +24 -0
- package/src/consent/language.ts +12 -0
- package/src/consent/menu-widget.tsx +22 -0
- package/src/consent/presence.ts +45 -0
- package/src/consent/service.ts +75 -0
- package/src/consent/translate.ts +31 -0
- package/src/consent/types.local.ts +6 -0
- package/src/consent/types.ts +43 -0
- package/src/context.ts +12 -0
- package/src/editor/component.tsx +172 -0
- package/src/editor/consts.local.ts +62 -0
- package/src/editor/index.ts +2 -0
- package/src/editor/types.ts +24 -0
- package/src/entrypoints.ts +5 -0
- package/src/exports.ts +6 -5
- package/src/index.ts +1 -1
- package/src/main.tsx +2 -6
- package/src/permission/i18n/be.json +13 -0
- package/src/permission/i18n/de.json +13 -0
- package/src/permission/i18n/en.json +13 -0
- package/src/permission/i18n/es.json +13 -0
- package/src/permission/i18n/fr.json +13 -0
- package/src/permission/i18n/pl.json +13 -0
- package/src/permission/i18n/ru.json +13 -0
- package/src/permission/i18n/uk.json +13 -0
- package/src/permission/i18n.ts +13 -0
- package/src/permission/index.ts +27 -0
- package/src/permission/toast.tsx +20 -0
- package/src/permission/types.ts +5 -0
- package/src/picker/icons/consts.ts +309 -0
- package/src/picker/icons/types.ts +18 -0
- package/src/picker/icons.ts +70 -0
- package/src/picker/index.ts +11 -0
- package/src/picker/utils/color/types.ts +37 -0
- package/src/picker/utils/color.ts +119 -0
- package/src/picker/vocabulary/consts.ts +347 -0
- package/src/picker/vocabulary/types.ts +72 -0
- package/src/picker/vocabulary.ts +111 -0
- package/src/scheme/consts.ts +8 -0
- package/src/scheme/index.ts +3 -0
- package/src/scheme/scheme.ts +66 -0
- package/src/scheme/types.ts +30 -0
- package/src/types.ts +19 -2
- package/tests/consent-language.spec.ts +31 -0
- package/tests/consent.spec.ts +112 -0
- package/tests/context.ts +4 -0
- package/tests/editor.spec.ts +58 -0
- package/tests/harness/editor.tsx +32 -0
- package/tests/harness/index.html +1 -0
- package/tests/harness/lazy-screen.tsx +9 -0
- package/tests/harness/mount.tsx +370 -29
- package/tests/harness/picker.tsx +110 -0
- package/tests/lazy.spec.ts +104 -0
- package/tests/login-provider.spec.ts +114 -0
- package/tests/login.spec.ts +447 -0
- package/tests/nav.spec.ts +449 -3
- package/tests/package-boundary.spec.ts +19 -0
- package/tests/picker-shots.spec.ts +174 -0
- package/tests/picker-vocabulary.spec.ts +217 -0
- package/tests/picker.spec.ts +333 -0
- package/tests/scheme.spec.ts +149 -0
- package/tests/smoke.spec.ts +2 -2
- package/tests/socket-dialog.spec.ts +154 -0
- package/tests/toaster.spec.ts +59 -0
- package/zz-tw.d.mts +2 -0
- package/zz-tw.d.mts.map +1 -0
- package/build/.gitkeep +0 -0
- package/src/auth/modules.ts +0 -5
- package/src/modules.ts +0 -5
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
import { describe, expect, test } from 'bun:test'
|
|
2
|
+
import { readdirSync, readFileSync } from 'node:fs'
|
|
3
|
+
import { join } from 'node:path'
|
|
4
|
+
import {
|
|
5
|
+
PICKER_COLORS, PICKER_COLOR_KEYS, PICKER_FALLBACK_COLOR, PICKER_FALLBACK_ICON, PICKER_ICON_CATEGORIES,
|
|
6
|
+
PICKER_ICON_ENTRIES, PICKER_ICON_NAMES, pickerColorHelper,
|
|
7
|
+
} from '../src/picker/vocabulary.js'
|
|
8
|
+
import { PICKER_ICONS } from '../src/picker/icons/consts.js'
|
|
9
|
+
import { pickerIconHelper } from '../src/picker/icons.js'
|
|
10
|
+
|
|
11
|
+
// Colour arithmetic written here, independently of the package's own, so the palette is checked
|
|
12
|
+
// against the definitions rather than against itself.
|
|
13
|
+
const channels = (hex: string): number[] => [1, 3, 5].map(at => parseInt(hex.slice(at, at + 2), 16) / 255)
|
|
14
|
+
const linear = (c: number): number => c <= 0.04045 ? c / 12.92 : ((c + 0.055) / 1.055) ** 2.4
|
|
15
|
+
const luminance = (hex: string): number => {
|
|
16
|
+
const [r, g, b] = channels(hex).map(linear)
|
|
17
|
+
|
|
18
|
+
return 0.2126 * r + 0.7152 * g + 0.0722 * b
|
|
19
|
+
}
|
|
20
|
+
const contrast = (a: string, b: string): number => {
|
|
21
|
+
const [x, y] = [luminance(a), luminance(b)]
|
|
22
|
+
|
|
23
|
+
return (Math.max(x, y) + 0.05) / (Math.min(x, y) + 0.05)
|
|
24
|
+
}
|
|
25
|
+
const oklab = (hex: string): number[] => {
|
|
26
|
+
const [r, g, b] = channels(hex).map(linear)
|
|
27
|
+
const l = Math.cbrt(0.4122214708 * r + 0.5363325363 * g + 0.0514459929 * b)
|
|
28
|
+
const m = Math.cbrt(0.2119034982 * r + 0.6806995451 * g + 0.1073969566 * b)
|
|
29
|
+
const s = Math.cbrt(0.0883024619 * r + 0.2817188376 * g + 0.6299787005 * b)
|
|
30
|
+
|
|
31
|
+
return [
|
|
32
|
+
0.2104542553 * l + 0.793617785 * m - 0.0040720468 * s,
|
|
33
|
+
1.9779984951 * l - 2.428592205 * m + 0.4505937099 * s,
|
|
34
|
+
0.0259040371 * l + 0.7827717662 * m - 0.808675766 * s,
|
|
35
|
+
]
|
|
36
|
+
}
|
|
37
|
+
const distance = (a: string, b: string): number => {
|
|
38
|
+
const [x, y] = [oklab(a), oklab(b)]
|
|
39
|
+
|
|
40
|
+
return Math.hypot(x[0] - y[0], x[1] - y[1], x[2] - y[2])
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/** The ten hues the generated targets' look has always used — their values may never move. */
|
|
44
|
+
const LEGACY: Record<string, [string, string, string, string]> = {
|
|
45
|
+
slate: ['#334155', '#F1F5F9', '#CBD5E1', '#1E293B'],
|
|
46
|
+
blue: ['#1D4ED8', '#DBEAFE', '#93C5FD', '#172554'],
|
|
47
|
+
sky: ['#0369A1', '#E0F2FE', '#7DD3FC', '#082F49'],
|
|
48
|
+
teal: ['#115E59', '#CCFBF1', '#5EEAD4', '#042F2E'],
|
|
49
|
+
green: ['#166534', '#DCFCE7', '#86EFAC', '#052E16'],
|
|
50
|
+
amber: ['#92400E', '#FEF3C7', '#FCD34D', '#451A03'],
|
|
51
|
+
orange: ['#9A3412', '#FFEDD5', '#FDBA74', '#431407'],
|
|
52
|
+
red: ['#B91C1C', '#FEE2E2', '#FCA5A5', '#450A0A'],
|
|
53
|
+
pink: ['#BE185D', '#FCE7F3', '#F9A8D4', '#500724'],
|
|
54
|
+
violet: ['#6D28D9', '#EDE9FE', '#C4B5FD', '#2E1065'],
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Minimum OKLab distance between two inks of one mode. A just-noticeable difference is about 0.02.
|
|
59
|
+
* Two legacy neighbours sit closest — orange and amber's light inks, 0.028 — and their values are
|
|
60
|
+
* fixed, so every pair keeps 0.025; a pair with at least one of the fourteen newer colours keeps 0.045.
|
|
61
|
+
*/
|
|
62
|
+
const MIN_DISTANCE = 0.025
|
|
63
|
+
const MIN_DISTANCE_NEW = 0.045
|
|
64
|
+
|
|
65
|
+
/** The icons the planning kits use (viable-agent `KIT_ICONS`) — the catalogue must hold every one. */
|
|
66
|
+
const KIT_ICONS = [
|
|
67
|
+
'circle', 'tag', 'layers', 'flag', 'target', 'star', 'briefcase', 'folder', 'book-open', 'file-text', 'sparkles',
|
|
68
|
+
'lightbulb', 'rocket', 'bug', 'shield', 'square-check', 'list-checks', 'clipboard-list', 'funnel', 'trending-up',
|
|
69
|
+
'handshake', 'building', 'contact', 'user-round', 'user-round-check', 'users', 'phone', 'mail', 'message-square',
|
|
70
|
+
'megaphone', 'calendar', 'calendar-check', 'clock', 'headset', 'inbox', 'siren', 'warehouse', 'package', 'receipt',
|
|
71
|
+
'truck', 'map', 'map-pin', 'wrench', 'workflow', 'send', 'stamp',
|
|
72
|
+
]
|
|
73
|
+
|
|
74
|
+
describe('@owlmeans/web-panel/picker/vocabulary — the palette', () => {
|
|
75
|
+
test('24 unique keys in hue order; the ten legacy hues keep their exact values', () => {
|
|
76
|
+
expect(PICKER_COLORS.map(color => color.key)).toEqual([...PICKER_COLOR_KEYS])
|
|
77
|
+
expect(new Set(PICKER_COLOR_KEYS).size).toBe(24)
|
|
78
|
+
expect(PICKER_COLOR_KEYS).toContain(PICKER_FALLBACK_COLOR)
|
|
79
|
+
for (const [key, values] of Object.entries(LEGACY)) {
|
|
80
|
+
const color = PICKER_COLORS.find(candidate => candidate.key === key)
|
|
81
|
+
expect({ key, values: [color?.ink, color?.soft, color?.inkDark, color?.softDark] }).toEqual({ key, values })
|
|
82
|
+
}
|
|
83
|
+
})
|
|
84
|
+
|
|
85
|
+
test('every ink keeps 4.5:1 on its ground and on the page, in both modes; every value is distinct', () => {
|
|
86
|
+
for (const color of PICKER_COLORS) {
|
|
87
|
+
const dark = { ink: color.inkDark ?? color.ink, soft: color.softDark ?? color.soft }
|
|
88
|
+
const ratios = {
|
|
89
|
+
key: color.key,
|
|
90
|
+
onSoft: contrast(color.ink, color.soft) >= 4.5,
|
|
91
|
+
onWhite: contrast(color.ink, '#FFFFFF') >= 4.5,
|
|
92
|
+
onSoftDark: contrast(dark.ink, dark.soft) >= 4.5,
|
|
93
|
+
onBlack: contrast(dark.ink, '#000000') >= 4.5,
|
|
94
|
+
}
|
|
95
|
+
expect(ratios).toEqual({ key: color.key, onSoft: true, onWhite: true, onSoftDark: true, onBlack: true })
|
|
96
|
+
}
|
|
97
|
+
const values = PICKER_COLORS.flatMap(color => [color.swatch, color.ink, color.soft, color.inkDark, color.softDark])
|
|
98
|
+
.map(value => value?.toLowerCase())
|
|
99
|
+
expect(values.every(value => value != null && /^#[0-9a-f]{6}$/.test(value))).toBe(true)
|
|
100
|
+
expect(new Set(values).size).toBe(PICKER_COLORS.length * 5)
|
|
101
|
+
})
|
|
102
|
+
|
|
103
|
+
test('the inks of one mode stay apart in OKLab', () => {
|
|
104
|
+
for (const mode of ['ink', 'inkDark'] as const) {
|
|
105
|
+
for (let i = 0; i < PICKER_COLORS.length; i++) {
|
|
106
|
+
for (let j = i + 1; j < PICKER_COLORS.length; j++) {
|
|
107
|
+
const [a, b] = [PICKER_COLORS[i], PICKER_COLORS[j]]
|
|
108
|
+
const legacy = a.key in LEGACY && b.key in LEGACY
|
|
109
|
+
const apart = distance(a[mode] ?? a.ink, b[mode] ?? b.ink)
|
|
110
|
+
expect({ mode, pair: `${a.key}/${b.key}`, apart: apart >= (legacy ? MIN_DISTANCE : MIN_DISTANCE_NEW) })
|
|
111
|
+
.toEqual({ mode, pair: `${a.key}/${b.key}`, apart: true })
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
})
|
|
116
|
+
})
|
|
117
|
+
|
|
118
|
+
describe('@owlmeans/web-panel/picker/vocabulary — pickerColorHelper', () => {
|
|
119
|
+
test('normalizes hex and resolves keys, hex and unknown values', () => {
|
|
120
|
+
expect(pickerColorHelper.normalizeHex('#ABC')).toBe('#aabbcc')
|
|
121
|
+
expect(pickerColorHelper.normalizeHex('abc')).toBe('#aabbcc')
|
|
122
|
+
expect(pickerColorHelper.normalizeHex(' AABBCC ')).toBe('#aabbcc')
|
|
123
|
+
expect(pickerColorHelper.normalizeHex('#abcd')).toBeNull()
|
|
124
|
+
expect(pickerColorHelper.normalizeHex('blue')).toBeNull()
|
|
125
|
+
expect(pickerColorHelper.isHex('#aBc')).toBe(true)
|
|
126
|
+
expect(pickerColorHelper.isHex('aabbcc')).toBe(false)
|
|
127
|
+
expect(pickerColorHelper.isHex(42)).toBe(false)
|
|
128
|
+
|
|
129
|
+
expect(pickerColorHelper.resolve('blue')).toMatchObject({ key: 'blue', custom: false, label: 'Blue', inkDark: '#93C5FD' })
|
|
130
|
+
expect(pickerColorHelper.resolve('#0F766E')).toMatchObject({ key: '#0f766e', custom: true, label: '#0F766E', swatch: '#0f766e' })
|
|
131
|
+
expect(pickerColorHelper.resolve('abc')).toBeNull()
|
|
132
|
+
expect(pickerColorHelper.resolve('nope')).toBeNull()
|
|
133
|
+
expect(pickerColorHelper.resolve('')).toBeNull()
|
|
134
|
+
expect(pickerColorHelper.resolve(null)).toBeNull()
|
|
135
|
+
|
|
136
|
+
const statuses = [
|
|
137
|
+
{ key: 'neutral', swatch: 'var(--tone-neutral)', ink: 'var(--tone-neutral)', soft: 'var(--tone-neutral-soft)' },
|
|
138
|
+
{ key: 'info', swatch: 'var(--tone-info)', ink: 'var(--tone-info)', soft: 'var(--tone-info-soft)', label: 'In progress' },
|
|
139
|
+
]
|
|
140
|
+
expect(pickerColorHelper.resolve('info', statuses)).toMatchObject({ label: 'In progress', inkDark: 'var(--tone-info)' })
|
|
141
|
+
expect(pickerColorHelper.styleOf('unknown', statuses)['--pick-ink']).toBe('var(--tone-neutral)')
|
|
142
|
+
expect(pickerColorHelper.styleOf('unknown')).toEqual({
|
|
143
|
+
'--pick-swatch': '#64748B', '--pick-ink': '#334155', '--pick-soft': '#F1F5F9',
|
|
144
|
+
'--pick-ink-dark': '#CBD5E1', '--pick-soft-dark': '#1E293B',
|
|
145
|
+
})
|
|
146
|
+
expect(pickerColorHelper.hashKey('card-42')).toBe(pickerColorHelper.hashKey('card-42'))
|
|
147
|
+
expect(PICKER_COLOR_KEYS).toContain(pickerColorHelper.hashKey('card-42') as typeof PICKER_COLOR_KEYS[number])
|
|
148
|
+
expect(new Set(Array.from({ length: 200 }, (_, n) => pickerColorHelper.hashKey(`seed-${n}`))).size).toBeGreaterThan(18)
|
|
149
|
+
})
|
|
150
|
+
|
|
151
|
+
test('a custom colour gets inks that keep 4.5:1 on its grounds and the page, in both modes', () => {
|
|
152
|
+
let seed = 7
|
|
153
|
+
const random = (): string => {
|
|
154
|
+
seed = (seed * 1103515245 + 12345) % 2147483648
|
|
155
|
+
|
|
156
|
+
return `#${(seed % 0x1000000).toString(16).padStart(6, '0')}`
|
|
157
|
+
}
|
|
158
|
+
const samples = [
|
|
159
|
+
'#ffffff', '#000000', '#ffff00', '#00ff00', '#00ffff', '#0000ff', '#ff0000', '#ff00ff', '#808080',
|
|
160
|
+
'#3b82f6', '#fde047', '#0f766e', '#111827', '#f5f5f5', '#7f1d1d', ...Array.from({ length: 60 }, random),
|
|
161
|
+
]
|
|
162
|
+
for (const hex of samples) {
|
|
163
|
+
const color = pickerColorHelper.resolve(hex)
|
|
164
|
+
expect(color?.custom).toBe(true)
|
|
165
|
+
const safe = color != null
|
|
166
|
+
&& contrast(color.ink, color.soft) >= 4.5 && contrast(color.ink, '#ffffff') >= 4.5
|
|
167
|
+
&& contrast(color.inkDark, color.softDark) >= 4.5 && contrast(color.inkDark, '#000000') >= 4.5
|
|
168
|
+
expect({ hex, safe }).toEqual({ hex, safe: true })
|
|
169
|
+
}
|
|
170
|
+
})
|
|
171
|
+
})
|
|
172
|
+
|
|
173
|
+
describe('@owlmeans/web-panel/picker/vocabulary — the icon catalogue', () => {
|
|
174
|
+
test('entries and components name the same icons; kebab names, known categories, the kit icons included', () => {
|
|
175
|
+
expect(Object.keys(PICKER_ICONS).sort()).toEqual([...PICKER_ICON_NAMES].sort())
|
|
176
|
+
expect(new Set(PICKER_ICON_NAMES).size).toBe(PICKER_ICON_NAMES.length)
|
|
177
|
+
expect(PICKER_ICON_NAMES.length).toBeGreaterThanOrEqual(200)
|
|
178
|
+
expect(PICKER_ICON_NAMES.every(name => /^[a-z0-9]+(-[a-z0-9]+)*$/.test(name))).toBe(true)
|
|
179
|
+
expect(PICKER_ICON_ENTRIES.every(entry => entry.keywords.length > 0)).toBe(true)
|
|
180
|
+
for (const category of PICKER_ICON_CATEGORIES) {
|
|
181
|
+
expect({ category, icons: PICKER_ICON_ENTRIES.filter(entry => entry.category === category).length >= 15 })
|
|
182
|
+
.toEqual({ category, icons: true })
|
|
183
|
+
}
|
|
184
|
+
expect(KIT_ICONS.filter(name => !PICKER_ICON_NAMES.includes(name))).toEqual([])
|
|
185
|
+
expect(PICKER_ICON_NAMES).toContain(PICKER_FALLBACK_ICON)
|
|
186
|
+
})
|
|
187
|
+
|
|
188
|
+
test('pickerIconHelper looks up, falls back and searches', () => {
|
|
189
|
+
expect(pickerIconHelper.iconOf('rocket')).toBe(PICKER_ICONS.rocket)
|
|
190
|
+
expect(pickerIconHelper.iconOf('no-such-icon')).toBe(PICKER_ICONS[PICKER_FALLBACK_ICON])
|
|
191
|
+
expect(pickerIconHelper.iconOf(null)).toBe(PICKER_ICONS[PICKER_FALLBACK_ICON])
|
|
192
|
+
expect(pickerIconHelper.has('truck')).toBe(true)
|
|
193
|
+
expect(pickerIconHelper.has('toString')).toBe(false)
|
|
194
|
+
|
|
195
|
+
expect(pickerIconHelper.search('').length).toBe(PICKER_ICON_NAMES.length)
|
|
196
|
+
expect(pickerIconHelper.search('Rocket')[0]?.name).toBe('rocket')
|
|
197
|
+
expect(pickerIconHelper.search('hand').map(entry => entry.name).slice(0, 2)).toEqual(['hand', 'handshake'])
|
|
198
|
+
expect(pickerIconHelper.search('deal').map(entry => entry.name)).toContain('handshake')
|
|
199
|
+
expect(pickerIconHelper.search('user check').map(entry => entry.name)).toContain('user-round-check')
|
|
200
|
+
expect(pickerIconHelper.search('zzzz')).toEqual([])
|
|
201
|
+
expect(pickerIconHelper.search('', ['truck', 'nope', 'bug']).map(entry => entry.name)).toEqual(['truck', 'bug'])
|
|
202
|
+
expect(pickerIconHelper.byCategory('places').every(entry => entry.category === 'places')).toBe(true)
|
|
203
|
+
})
|
|
204
|
+
|
|
205
|
+
test('the vocabulary imports nothing outside the picker — no React, no icon set', () => {
|
|
206
|
+
const roots = [join(import.meta.dir, '../src/picker'), join(import.meta.dir, '../src/picker/vocabulary'),
|
|
207
|
+
join(import.meta.dir, '../src/picker/utils'), join(import.meta.dir, '../src/picker/utils/color')]
|
|
208
|
+
const files = [
|
|
209
|
+
join(roots[0], 'vocabulary.ts'), join(roots[2], 'color.ts'),
|
|
210
|
+
...readdirSync(roots[1]).map(file => join(roots[1], file)), ...readdirSync(roots[3]).map(file => join(roots[3], file)),
|
|
211
|
+
]
|
|
212
|
+
for (const file of files) {
|
|
213
|
+
const specifiers = [...readFileSync(file, 'utf8').matchAll(/from\s+['"]([^'"]+)['"]/g)].map(match => match[1])
|
|
214
|
+
expect({ file, outside: specifiers.filter(specifier => !specifier.startsWith('.')) }).toEqual({ file, outside: [] })
|
|
215
|
+
}
|
|
216
|
+
})
|
|
217
|
+
})
|
|
@@ -0,0 +1,333 @@
|
|
|
1
|
+
import { afterAll, describe, expect, test } from 'bun:test'
|
|
2
|
+
import { readFileSync } from 'node:fs'
|
|
3
|
+
import { join } from 'node:path'
|
|
4
|
+
import { browserHelper, mountComponent } from '@owlmeans/test-ui'
|
|
5
|
+
import type { Page } from '@owlmeans/test-ui'
|
|
6
|
+
import { HARNESS_URL } from './context.js'
|
|
7
|
+
import { PICKER_COLOR_KEYS, PICKER_ICON_CATEGORIES } from '../src/picker/vocabulary.js'
|
|
8
|
+
|
|
9
|
+
const TIMEOUT = 30_000
|
|
10
|
+
|
|
11
|
+
afterAll(async () => {
|
|
12
|
+
await browserHelper.closeBrowser()
|
|
13
|
+
})
|
|
14
|
+
|
|
15
|
+
const url = (path: string): string => `${HARNESS_URL.replace(/\/$/, '')}${path}`
|
|
16
|
+
const open = async (path: string) => mountComponent({ url: url(path) })
|
|
17
|
+
|
|
18
|
+
/** A phone: 375px wide, touch, a coarse pointer. */
|
|
19
|
+
const phone = async (path: string) => {
|
|
20
|
+
const browser = await browserHelper.launchBrowser()
|
|
21
|
+
const context = await browser.newContext({ viewport: { width: 375, height: 812 }, hasTouch: true, isMobile: true })
|
|
22
|
+
const page = await context.newPage()
|
|
23
|
+
await page.goto(url(path), { waitUntil: 'domcontentloaded' })
|
|
24
|
+
|
|
25
|
+
return { page, close: () => context.close() }
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const mark = async (page: Page): Promise<Record<string, string>> =>
|
|
29
|
+
JSON.parse(await page.locator('#mark-value').textContent() ?? '{}') as Record<string, string>
|
|
30
|
+
|
|
31
|
+
const active = (page: Page) => page.evaluate(() => {
|
|
32
|
+
const element = document.activeElement as HTMLElement | null
|
|
33
|
+
|
|
34
|
+
return {
|
|
35
|
+
trigger: element?.hasAttribute('data-picker-trigger') === true,
|
|
36
|
+
search: element?.hasAttribute('data-picker-search') === true,
|
|
37
|
+
icon: element?.getAttribute('data-picker-icon') ?? null,
|
|
38
|
+
inSurface: element?.closest('[data-picker-surface]') != null,
|
|
39
|
+
}
|
|
40
|
+
})
|
|
41
|
+
|
|
42
|
+
/** Focus goes back to the trigger once the surface's focus scope has unmounted — a tick after it detaches. */
|
|
43
|
+
const backOnTrigger = async (page: Page): Promise<boolean> => {
|
|
44
|
+
await page.waitForFunction(() => document.activeElement?.hasAttribute('data-picker-trigger') === true)
|
|
45
|
+
|
|
46
|
+
return (await active(page)).trigger
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
describe('@owlmeans/web-panel/picker — IconColorPicker on a desktop', () => {
|
|
50
|
+
test('opens a popover, commits a colour and an icon, searches, and Esc gives focus back', async () => {
|
|
51
|
+
const { page, close } = await open('/picker')
|
|
52
|
+
try {
|
|
53
|
+
const trigger = page.locator('[data-picker-trigger]').first()
|
|
54
|
+
await trigger.click()
|
|
55
|
+
const surface = page.locator('[data-picker-surface="popover"]')
|
|
56
|
+
await surface.waitFor()
|
|
57
|
+
expect(await surface.locator('[data-picker-swatches] [data-picker-color]').count()).toBe(24)
|
|
58
|
+
// A fine pointer lands in the search field.
|
|
59
|
+
expect((await active(page)).search).toBe(true)
|
|
60
|
+
|
|
61
|
+
await surface.locator('[data-picker-color="emerald"]').click()
|
|
62
|
+
expect(await mark(page)).toEqual({ icon: 'rocket', color: 'emerald' })
|
|
63
|
+
expect(await surface.locator('[data-picker-color="emerald"]').getAttribute('aria-pressed')).toBe('true')
|
|
64
|
+
// The composite stays open for its other half.
|
|
65
|
+
expect(await surface.isVisible()).toBe(true)
|
|
66
|
+
|
|
67
|
+
await surface.locator('[data-picker-search]').fill('hand')
|
|
68
|
+
expect(await surface.locator('[data-picker-icon]').first().getAttribute('data-picker-icon')).toBe('hand')
|
|
69
|
+
expect(await surface.locator('[data-picker-icon="handshake"]').count()).toBe(1)
|
|
70
|
+
await surface.locator('[data-picker-icon="handshake"]').click()
|
|
71
|
+
expect(await mark(page)).toEqual({ icon: 'handshake', color: 'emerald' })
|
|
72
|
+
|
|
73
|
+
await surface.locator('[data-picker-search]').fill('zzzz')
|
|
74
|
+
await surface.locator('[data-picker-empty]').waitFor()
|
|
75
|
+
|
|
76
|
+
await page.keyboard.press('Escape')
|
|
77
|
+
await surface.waitFor({ state: 'detached' })
|
|
78
|
+
expect(await backOnTrigger(page)).toBe(true)
|
|
79
|
+
expect(await trigger.getAttribute('aria-label')).toBe('Mark: Handshake · Emerald')
|
|
80
|
+
} finally {
|
|
81
|
+
await close()
|
|
82
|
+
}
|
|
83
|
+
}, TIMEOUT)
|
|
84
|
+
|
|
85
|
+
test('the keyboard walks the grid: ArrowDown from the search, arrows in two dimensions, Enter picks', async () => {
|
|
86
|
+
const { page, close } = await open('/picker')
|
|
87
|
+
try {
|
|
88
|
+
await page.locator('[data-picker-trigger]').first().click()
|
|
89
|
+
await page.locator('[data-picker-surface]').waitFor()
|
|
90
|
+
await page.keyboard.press('ArrowDown')
|
|
91
|
+
// The selected icon is the grid's tab stop.
|
|
92
|
+
expect((await active(page)).icon).toBe('rocket')
|
|
93
|
+
const columns = await page.locator('[data-picker-surface] [data-picker-icon]').evaluateAll(cells => {
|
|
94
|
+
const top = (cells[0] as HTMLElement).offsetTop
|
|
95
|
+
|
|
96
|
+
return cells.filter(cell => (cell as HTMLElement).offsetTop === top).length
|
|
97
|
+
})
|
|
98
|
+
expect(columns).toBeGreaterThanOrEqual(8)
|
|
99
|
+
await page.keyboard.press('ArrowRight')
|
|
100
|
+
expect((await active(page)).icon).toBe('lightbulb')
|
|
101
|
+
const before = await page.locator('[data-picker-surface] [data-picker-icon]').evaluateAll(
|
|
102
|
+
cells => cells.map(cell => cell.getAttribute('data-picker-icon'))
|
|
103
|
+
)
|
|
104
|
+
await page.keyboard.press('ArrowDown')
|
|
105
|
+
expect((await active(page)).icon).toBe(before[before.indexOf('lightbulb') + columns])
|
|
106
|
+
await page.keyboard.press('Home')
|
|
107
|
+
expect((await active(page)).icon).toBe('briefcase')
|
|
108
|
+
await page.keyboard.press('Enter')
|
|
109
|
+
expect((await mark(page)).icon).toBe('briefcase')
|
|
110
|
+
// ArrowUp from the first row goes back to the search field.
|
|
111
|
+
await page.keyboard.press('ArrowUp')
|
|
112
|
+
expect((await active(page)).search).toBe(true)
|
|
113
|
+
} finally {
|
|
114
|
+
await close()
|
|
115
|
+
}
|
|
116
|
+
}, TIMEOUT)
|
|
117
|
+
|
|
118
|
+
test('a pick never submits the form, and the parts are plain buttons with names', async () => {
|
|
119
|
+
const { page, close } = await open('/picker')
|
|
120
|
+
try {
|
|
121
|
+
await page.locator('[data-picker-trigger]').nth(1).click()
|
|
122
|
+
const surface = page.locator('[data-picker-surface]')
|
|
123
|
+
await surface.waitFor()
|
|
124
|
+
const buttons = surface.locator('button')
|
|
125
|
+
expect(await buttons.count()).toBeGreaterThan(20)
|
|
126
|
+
expect(await surface.locator('button:not([type="button"]), button:not([aria-label])').count()).toBe(0)
|
|
127
|
+
expect(await page.locator('[data-picker-surface] [data-slot="button"], [data-picker-surface] [data-tone]').count()).toBe(0)
|
|
128
|
+
expect(await page.locator('[data-picker-trigger][data-slot="button"], [data-picker-trigger][data-tone]').count()).toBe(0)
|
|
129
|
+
// A single-purpose picker closes on the pick.
|
|
130
|
+
await surface.locator('[data-picker-color="violet"]').click()
|
|
131
|
+
await surface.waitFor({ state: 'detached' })
|
|
132
|
+
expect(await page.locator('#color-value').textContent()).toBe('violet')
|
|
133
|
+
|
|
134
|
+
await page.locator('[data-picker-trigger]').nth(2).click()
|
|
135
|
+
await page.locator('[data-picker-surface] [data-picker-icon="bug"]').click()
|
|
136
|
+
expect(await page.locator('#icon-value').textContent()).toBe('bug')
|
|
137
|
+
expect(await page.locator('#submits').textContent()).toBe('0')
|
|
138
|
+
} finally {
|
|
139
|
+
await close()
|
|
140
|
+
}
|
|
141
|
+
}, TIMEOUT)
|
|
142
|
+
|
|
143
|
+
test('inside an application\'s own Sheet the popover scrolls with the wheel and keeps focus', async () => {
|
|
144
|
+
const { page, close } = await open('/picker?inSheet=1')
|
|
145
|
+
try {
|
|
146
|
+
await page.locator('#open-sheet').click()
|
|
147
|
+
const sheet = page.locator('[data-slot="sheet-content"]:not([data-picker-surface])')
|
|
148
|
+
await sheet.waitFor()
|
|
149
|
+
await sheet.locator('[data-picker-trigger]').first().click()
|
|
150
|
+
const surface = page.locator('[data-picker-surface="popover"]')
|
|
151
|
+
await surface.waitFor()
|
|
152
|
+
expect((await active(page)).inSurface).toBe(true)
|
|
153
|
+
|
|
154
|
+
const body = surface.locator('[data-picker-scroll]')
|
|
155
|
+
const box = await body.boundingBox()
|
|
156
|
+
await page.mouse.move((box?.x ?? 0) + (box?.width ?? 0) / 2, (box?.y ?? 0) + (box?.height ?? 0) / 2)
|
|
157
|
+
await page.mouse.wheel(0, 600)
|
|
158
|
+
await page.waitForFunction(
|
|
159
|
+
() => (document.querySelector('[data-picker-surface] [data-picker-scroll]')?.scrollTop ?? 0) > 100
|
|
160
|
+
)
|
|
161
|
+
expect((await active(page)).inSurface).toBe(true)
|
|
162
|
+
|
|
163
|
+
await surface.locator('[data-picker-icon="truck"]').click()
|
|
164
|
+
expect((await mark(page)).icon).toBe('truck')
|
|
165
|
+
await page.keyboard.press('Escape')
|
|
166
|
+
await surface.waitFor({ state: 'detached' })
|
|
167
|
+
// Only the picker closed; the application's sheet is still there, focus on the trigger in it.
|
|
168
|
+
expect(await sheet.isVisible()).toBe(true)
|
|
169
|
+
expect(await backOnTrigger(page)).toBe(true)
|
|
170
|
+
} finally {
|
|
171
|
+
await close()
|
|
172
|
+
}
|
|
173
|
+
}, TIMEOUT)
|
|
174
|
+
})
|
|
175
|
+
|
|
176
|
+
describe('@owlmeans/web-panel/picker — on a phone', () => {
|
|
177
|
+
test('opens a bottom sheet with 44px cells, seven icons a row and a Done button', async () => {
|
|
178
|
+
const { page, close } = await phone('/picker')
|
|
179
|
+
try {
|
|
180
|
+
const trigger = page.locator('[data-picker-trigger]').first()
|
|
181
|
+
await trigger.waitFor()
|
|
182
|
+
expect((await trigger.boundingBox())?.height ?? 0).toBeGreaterThanOrEqual(44)
|
|
183
|
+
await trigger.tap()
|
|
184
|
+
const surface = page.locator('[data-picker-surface="sheet"]')
|
|
185
|
+
await surface.waitFor()
|
|
186
|
+
// No on-screen keyboard: the search field does not take focus on a touch screen.
|
|
187
|
+
expect((await active(page)).search).toBe(false)
|
|
188
|
+
|
|
189
|
+
const sizes = async (selector: string) => surface.locator(selector).evaluateAll(cells => cells.map(cell => {
|
|
190
|
+
const rect = cell.getBoundingClientRect()
|
|
191
|
+
|
|
192
|
+
return { width: rect.width, height: rect.height, top: Math.round(rect.top) }
|
|
193
|
+
}))
|
|
194
|
+
const swatches = await sizes('[data-picker-swatches] [data-picker-color]')
|
|
195
|
+
expect(swatches.every(cell => cell.width >= 44 && cell.height >= 44)).toBe(true)
|
|
196
|
+
expect(swatches.filter(cell => cell.top === swatches[0].top).length).toBe(6)
|
|
197
|
+
const icons = await sizes('[data-picker-icon]')
|
|
198
|
+
expect(icons.every(cell => cell.width >= 44 && cell.height >= 44)).toBe(true)
|
|
199
|
+
expect(icons.filter(cell => cell.top === icons[0].top).length).toBe(7)
|
|
200
|
+
const chips = await sizes('[data-picker-category]')
|
|
201
|
+
expect(chips.every(cell => cell.height >= 44)).toBe(true)
|
|
202
|
+
|
|
203
|
+
const done = surface.locator('[data-picker-done]')
|
|
204
|
+
const doneBox = await done.boundingBox()
|
|
205
|
+
expect((doneBox?.width ?? 0) >= 44 && (doneBox?.height ?? 0) >= 44).toBe(true)
|
|
206
|
+
expect(await page.evaluate(() => document.documentElement.scrollWidth)).toBeLessThanOrEqual(375)
|
|
207
|
+
|
|
208
|
+
await surface.locator('[data-picker-color="navy"]').tap()
|
|
209
|
+
expect((await mark(page)).color).toBe('navy')
|
|
210
|
+
await done.tap()
|
|
211
|
+
await surface.waitFor({ state: 'detached' })
|
|
212
|
+
expect(await backOnTrigger(page)).toBe(true)
|
|
213
|
+
} finally {
|
|
214
|
+
await close()
|
|
215
|
+
}
|
|
216
|
+
}, TIMEOUT)
|
|
217
|
+
})
|
|
218
|
+
|
|
219
|
+
describe('@owlmeans/web-panel/picker — custom colours', () => {
|
|
220
|
+
test('a valid hex commits normalized; an invalid one is marked and changes nothing', async () => {
|
|
221
|
+
const { page, close } = await open('/picker?custom=1')
|
|
222
|
+
try {
|
|
223
|
+
await page.locator('[data-picker-trigger]').first().click()
|
|
224
|
+
const surface = page.locator('[data-picker-surface]')
|
|
225
|
+
await surface.locator('[data-picker-color="custom"]').click()
|
|
226
|
+
const hex = surface.locator('[data-picker-hex]')
|
|
227
|
+
await hex.fill('#0F766E')
|
|
228
|
+
expect((await mark(page)).color).toBe('#0f766e')
|
|
229
|
+
expect(await surface.locator('[data-picker-color="custom"]').getAttribute('data-selected')).toBe('true')
|
|
230
|
+
expect(await surface.locator('[data-picker-swatches] [aria-pressed="true"]').count()).toBe(0)
|
|
231
|
+
|
|
232
|
+
await hex.fill('#12')
|
|
233
|
+
await hex.press('Enter')
|
|
234
|
+
expect(await hex.getAttribute('aria-invalid')).toBe('true')
|
|
235
|
+
expect((await mark(page)).color).toBe('#0f766e')
|
|
236
|
+
|
|
237
|
+
await hex.fill('ABC')
|
|
238
|
+
await hex.press('Enter')
|
|
239
|
+
expect(await hex.getAttribute('aria-invalid')).toBeNull()
|
|
240
|
+
expect((await mark(page)).color).toBe('#aabbcc')
|
|
241
|
+
expect(await page.locator('#submits').textContent()).toBe('0')
|
|
242
|
+
} finally {
|
|
243
|
+
await close()
|
|
244
|
+
}
|
|
245
|
+
}, TIMEOUT)
|
|
246
|
+
})
|
|
247
|
+
|
|
248
|
+
describe('@owlmeans/web-panel/picker — strings', () => {
|
|
249
|
+
test('renders and opens with no PanelApp and no i18n instance, in English', async () => {
|
|
250
|
+
const { page, close } = await open('/picker?bare=1')
|
|
251
|
+
const errors: string[] = []
|
|
252
|
+
page.on('pageerror', error => errors.push(error.message))
|
|
253
|
+
try {
|
|
254
|
+
const trigger = page.locator('[data-picker-trigger]').first()
|
|
255
|
+
await trigger.click()
|
|
256
|
+
const surface = page.locator('[data-picker-surface]')
|
|
257
|
+
await surface.waitFor()
|
|
258
|
+
expect(await surface.locator('[data-picker-search]').getAttribute('placeholder')).toBe('Search icons…')
|
|
259
|
+
expect(await surface.locator('[data-picker-category="all"]').textContent()).toBe('All')
|
|
260
|
+
expect(errors).toEqual([])
|
|
261
|
+
} finally {
|
|
262
|
+
await close()
|
|
263
|
+
}
|
|
264
|
+
}, TIMEOUT)
|
|
265
|
+
|
|
266
|
+
test('usePickerTranslate reads the packaged bundle in the current language', async () => {
|
|
267
|
+
const browser = await browserHelper.launchBrowser()
|
|
268
|
+
const context = await browser.newContext()
|
|
269
|
+
await context.addInitScript(() => window.localStorage.setItem('owlmeans-lng', 'de'))
|
|
270
|
+
const page = await context.newPage()
|
|
271
|
+
try {
|
|
272
|
+
await page.goto(url('/picker'), { waitUntil: 'domcontentloaded' })
|
|
273
|
+
// Icon names stay English; colour names and chrome translate.
|
|
274
|
+
await page.locator('[data-picker-trigger]').nth(1).waitFor()
|
|
275
|
+
expect(await page.locator('[data-picker-trigger]').nth(1).textContent()).toBe('Petrol')
|
|
276
|
+
await page.locator('[data-picker-trigger]').first().click()
|
|
277
|
+
expect(await page.locator('[data-picker-surface] [data-picker-search]').getAttribute('placeholder')).toBe('Symbole suchen…')
|
|
278
|
+
expect(await page.locator('[data-picker-surface] [data-picker-summary]').textContent()).toBe('Rocket · Indigo')
|
|
279
|
+
} finally {
|
|
280
|
+
await context.close()
|
|
281
|
+
}
|
|
282
|
+
}, TIMEOUT)
|
|
283
|
+
|
|
284
|
+
test('the picker bundle carries the same keys in all eight languages', () => {
|
|
285
|
+
const dir = join(import.meta.dir, '../src/components/picker/i18n')
|
|
286
|
+
const keysOf = (value: unknown, prefix = ''): string[] => typeof value === 'object' && value != null
|
|
287
|
+
? Object.entries(value).flatMap(([key, child]) => keysOf(child, prefix === '' ? key : `${prefix}.${key}`))
|
|
288
|
+
: [prefix]
|
|
289
|
+
const english = JSON.parse(readFileSync(join(dir, 'en.json'), 'utf8')) as Record<string, Record<string, string>>
|
|
290
|
+
expect(Object.keys(english.colors)).toEqual([...PICKER_COLOR_KEYS])
|
|
291
|
+
expect(Object.keys(english.categories)).toEqual([...PICKER_ICON_CATEGORIES])
|
|
292
|
+
for (const language of ['pl', 'ru', 'be', 'uk', 'es', 'de', 'fr']) {
|
|
293
|
+
const bundle = JSON.parse(readFileSync(join(dir, `${language}.json`), 'utf8')) as unknown
|
|
294
|
+
expect({ language, keys: keysOf(bundle) }).toEqual({ language, keys: keysOf(english) })
|
|
295
|
+
}
|
|
296
|
+
})
|
|
297
|
+
})
|
|
298
|
+
|
|
299
|
+
describe('@owlmeans/web-panel/picker — light and dark', () => {
|
|
300
|
+
test('a stored mark follows .dark and the system dark unless .light', async () => {
|
|
301
|
+
const { page, close } = await open('/picker')
|
|
302
|
+
try {
|
|
303
|
+
const tile = page.locator('#samples [data-icon-tile][data-color="blue"]').first()
|
|
304
|
+
await tile.waitFor()
|
|
305
|
+
const look = () => tile.evaluate(element => {
|
|
306
|
+
const style = window.getComputedStyle(element)
|
|
307
|
+
|
|
308
|
+
return [style.color, style.backgroundColor]
|
|
309
|
+
})
|
|
310
|
+
const dot = () => page.locator('#samples [data-color-dot][data-color="blue"]')
|
|
311
|
+
.evaluate(element => window.getComputedStyle(element).backgroundColor)
|
|
312
|
+
const classes = (names: string[]) => page.evaluate(list => {
|
|
313
|
+
document.documentElement.classList.remove('light', 'dark')
|
|
314
|
+
document.documentElement.classList.add(...list)
|
|
315
|
+
}, names)
|
|
316
|
+
const LIGHT = ['rgb(29, 78, 216)', 'rgb(219, 234, 254)']
|
|
317
|
+
const DARK = ['rgb(147, 197, 253)', 'rgb(23, 37, 84)']
|
|
318
|
+
|
|
319
|
+
expect(await look()).toEqual(LIGHT)
|
|
320
|
+
expect(await dot()).toBe(LIGHT[0])
|
|
321
|
+
await classes(['dark'])
|
|
322
|
+
expect(await look()).toEqual(DARK)
|
|
323
|
+
expect(await dot()).toBe(DARK[0])
|
|
324
|
+
await classes([])
|
|
325
|
+
await page.emulateMedia({ colorScheme: 'dark' })
|
|
326
|
+
expect(await look()).toEqual(DARK)
|
|
327
|
+
await classes(['light'])
|
|
328
|
+
expect(await look()).toEqual(LIGHT)
|
|
329
|
+
} finally {
|
|
330
|
+
await close()
|
|
331
|
+
}
|
|
332
|
+
}, TIMEOUT)
|
|
333
|
+
})
|