From 21c368c9fe831a1e146169dd9ed2ddb569a43085 Mon Sep 17 00:00:00 2001 From: Whatsaaaa Date: Fri, 13 Nov 2026 19:18:00 +0100 Subject: [PATCH 01/10] Install the Whatsaaaa design system and Shiki in the Vue app The design system comes from npm like any other package, and needs Node 22.18 or 24.12, so the app's engines follow it. Shiki highlights code in the design system's code theme. --- vue-event-registration/package.json | 4 +- vue-event-registration/pnpm-lock.yaml | 363 +++++++++++++++++++++ vue-event-registration/pnpm-workspace.yaml | 1 + vue-event-registration/public/favicon.svg | 1 - 4 files changed, 367 insertions(+), 2 deletions(-) delete mode 100644 vue-event-registration/public/favicon.svg diff --git a/vue-event-registration/package.json b/vue-event-registration/package.json index bf9b6a1..970c1dc 100644 --- a/vue-event-registration/package.json +++ b/vue-event-registration/package.json @@ -15,9 +15,11 @@ }, "dependencies": { "@formisch/vue": "^1.2.0", + "@whatsaaaa/design-system": "^0.1.0", "@whatsaaaa/form-builder-affects": "0.2.2-rc.0", "@whatsaaaa/form-builder-schema": "1.0.0-rc.0", "@whatsaaaa/form-builder-vue": "1.0.0-rc.0", + "shiki": "^4.6.0", "valibot": "^1.5.0", "vue": "^3.5.44" }, @@ -40,6 +42,6 @@ }, "packageManager": "pnpm@11.27.0", "engines": { - "node": ">=20.19" + "node": "^22.18.0 || >=24.12.0" } } diff --git a/vue-event-registration/pnpm-lock.yaml b/vue-event-registration/pnpm-lock.yaml index 67a46cc..56ba163 100644 --- a/vue-event-registration/pnpm-lock.yaml +++ b/vue-event-registration/pnpm-lock.yaml @@ -11,6 +11,9 @@ importers: '@formisch/vue': specifier: ^1.2.0 version: 1.2.0(typescript@6.0.3)(valibot@1.5.0(typescript@6.0.3))(vue@3.5.45(typescript@6.0.3)) + '@whatsaaaa/design-system': + specifier: ^0.1.0 + version: 0.1.0(vue@3.5.45(typescript@6.0.3)) '@whatsaaaa/form-builder-affects': specifier: 0.2.2-rc.0 version: 0.2.2-rc.0(@whatsaaaa/form-builder-schema@1.0.0-rc.0(valibot@1.5.0(typescript@6.0.3)))(valibot@1.5.0(typescript@6.0.3)) @@ -20,6 +23,9 @@ importers: '@whatsaaaa/form-builder-vue': specifier: 1.0.0-rc.0 version: 1.0.0-rc.0(@formisch/vue@1.2.0(typescript@6.0.3)(valibot@1.5.0(typescript@6.0.3))(vue@3.5.45(typescript@6.0.3)))(@whatsaaaa/form-builder-schema@1.0.0-rc.0(valibot@1.5.0(typescript@6.0.3)))(valibot@1.5.0(typescript@6.0.3))(vue@3.5.45(typescript@6.0.3)) + shiki: + specifier: ^4.6.0 + version: 4.6.0 valibot: specifier: ^1.5.0 version: 1.5.0(typescript@6.0.3) @@ -314,6 +320,40 @@ packages: '@rolldown/pluginutils@1.1.0': resolution: {integrity: sha512-K+NU2HDCEem4sClgHH4ZZXwdJeNFkJo+hRk479DIwdIviAPN2hFJH1KHHwg8CxHQXvi0M5XY4deTXINfIiSG6w==} + '@shikijs/core@4.6.0': + resolution: {integrity: sha512-bfd4OKgvoyXYiYmMRuleA656P4V7M/Du9lcTl38Ngm6KszMj7bq4J1IGZwSYR4c95Tv5UQALtYNWUwaI9UT3xw==} + engines: {node: '>=20'} + + '@shikijs/engine-javascript@4.6.0': + resolution: {integrity: sha512-K0oqxFoL+kEMdz89mHLFO15Tsbv3kFZ6WR1cXZKMvLSc+oqaM00A6pyga1qSeXB22dP0tTiSApRcGBaKWsEccg==} + engines: {node: '>=20'} + + '@shikijs/engine-oniguruma@4.6.0': + resolution: {integrity: sha512-aggd6Q7SuJOXNnsUbfG2XesxBJKBMAw/PDTUo9PyRjMaaJJ2dNrI+q0C+25ARXAK9yLHAlwxc9oRT2u68YKZ7w==} + engines: {node: '>=20'} + + '@shikijs/langs@4.6.0': + resolution: {integrity: sha512-1yMEX3oCVV54LUq/ovfpRkDQoYDkcvjSWFFa/YLUDMiSoRzMi2uxLJYbv41ahT8Lu9lFMaa7hecd3Q39trqUyg==} + engines: {node: '>=20'} + + '@shikijs/primitive@4.6.0': + resolution: {integrity: sha512-c54+TQEo9ToqgfL/AU8FpjnV09+GA9Oa7M5ROkkXteZfp5XzpAJGXjjvZQFQioJOwm/w/6Z3lIzQstAkl8coag==} + engines: {node: '>=20'} + + '@shikijs/themes@4.6.0': + resolution: {integrity: sha512-qHAVAs80RiGD+IRuH9G+JPDOEc9A/kHsng4EzCUCwB9bLzW6Z0y9WETh2YyCcADJBmfrIaJ1Jp7KBNP6FHkgtQ==} + engines: {node: '>=20'} + + '@shikijs/types@4.6.0': + resolution: {integrity: sha512-+ENG1adsKt/X7cRYw1Nl7BEpBmPOjmQ7bR/eGmHuMlT8gtOFf3KEi5l31DJYyAWhW6Y6bjP1plU7FmaxWGENFw==} + engines: {node: '>=20'} + + '@shikijs/vscode-textmate@10.1.0': + resolution: {integrity: sha512-cVBuhDQjBZaNMTwBquYfPydrUP+E3hE6oYGasx8h6ZrODIM7/r+gxLDXdd66oszbrggZHEntdE6j+5gYIVyMWQ==} + + '@terrazzo/token-types@2.10.0': + resolution: {integrity: sha512-93HnrQPUFsZv0k9Z2L0zsxwd2IVLmoI78TwfnHhKPDnGrE+hVyzYRlFi/5ihspNFIbfnXMHW1EmxeiF9m6UPiQ==} + '@tybys/wasm-util@0.10.4': resolution: {integrity: sha512-W3c4gRigFS0T/Ma4qIYF3GDAc5AQdHb1yL5znJT1Zv1YaD9Kitx656wBjvr19qbiosmZT8lWDM5BEMynUqX65A==} @@ -329,12 +369,21 @@ packages: '@types/estree@1.0.10': resolution: {integrity: sha512-lTyOMnOcmRBzdCv6/4zUZCrEhV0xrqQiUZBZtVcbmLHBXKLnN8q89v/wKRF/Q0HbwVsqbIG3o5HDoFl9sduM+g==} + '@types/hast@3.0.5': + resolution: {integrity: sha512-rp/ezSWaD1m44dPKICGhiskI13nVr7qTloFwDa/IYkhhf5nzwP+zIQcIJh3WIFSBOy/H1PzB40jPjMDksN4F+g==} + '@types/json-schema@7.0.15': resolution: {integrity: sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==} + '@types/mdast@4.0.4': + resolution: {integrity: sha512-kGaNbPh1k7AFzgpud/gMdvIm5xuECykRR+JnWKQno9TAXVa6WIVCGTPvYGekIDL4uwCZQSYbUxNBSb1aUo79oA==} + '@types/node@24.19.2': resolution: {integrity: sha512-93d49wCWJkCyN87MxLpNN6KXPCwFw7bVUg79mGUV1OS40JGWwVCr8n61DXCSqz7CV6/VfPkb7xec7uP2M+QHWQ==} + '@types/unist@3.0.3': + resolution: {integrity: sha512-ko/gIFJRv177XgZsZcBwnqJN5x/Gien8qNOn0D5bQU/zAzVf9Zt3BlcUiLqhV9y4ARk0GbT3tnUiPNgnTXzc/Q==} + '@typescript-eslint/eslint-plugin@8.72.2': resolution: {integrity: sha512-222PKFXKihmFpi/pS5njoBgdAqsPhj2/GBmFbrNw8Tq8gEG9Sv+kSlKFy4u2q+mJv9ZzJgM2Gkv/bUzRZwZw5g==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} @@ -394,6 +443,9 @@ packages: resolution: {integrity: sha512-NAGrjn0Pitjqzq/GkgMC4kBYm233PQ8GffyQ9+kTA3AlNQYEzOf25EIM02BAHZv5FRJSpHpJk+OGUxVkOB93GQ==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + '@ungap/structured-clone@1.4.0': + resolution: {integrity: sha512-1mEZtMKPM09vDmQt5y7YvmN2+DFTP7Tg0EWXdic8/C6VRnpb33e4ghisCIE3WZjsE2N8mf+QV1Zqh7ZFYLWInQ==} + '@vitejs/plugin-vue@6.0.10': resolution: {integrity: sha512-b80aUQh3n+qEzzZm5oQp3rT2QImeCx58K6eFl/RkJ3d65KW0kTuv5lNsLRVAjbW9YRUpo/wzmvzMgV34bTAItA==} engines: {node: ^20.19.0 || >=22.12.0} @@ -478,6 +530,18 @@ packages: vue: optional: true + '@whatsaaaa/design-system@0.1.0': + resolution: {integrity: sha512-ZqYSDsLeRRSZAkS4zpva5TFUeq/zaMNJQ8hDcwlOYTzN6uHyrjCYJrIJUBDLHRugGK12gs0I9HM7xlWcfdCE0w==} + engines: {node: ^22.18.0 || >=24.12.0} + peerDependencies: + vitepress: ^1.6.4 + vue: ^3.5.0 + peerDependenciesMeta: + vitepress: + optional: true + vue: + optional: true + '@whatsaaaa/form-builder-affects@0.2.2-rc.0': resolution: {integrity: sha512-fnrn8Zo4CS9ErFC3s8+oFC8HA81M5u2mswJRZdezw+b/0vlujl7gh4csMsbh+kjjvqfrMbAuD/PIBl6MJUFeCg==} peerDependencies: @@ -535,10 +599,22 @@ packages: cacheable@2.5.0: resolution: {integrity: sha512-60cyAOytib/OzBw1JNSoSV/boK1AtHryDIjvVBk7XbN4ugfkM3+Sry7fEjNgPMGgOjuaZPAp8ruZ0Cxafwyq9g==} + ccount@2.0.1: + resolution: {integrity: sha512-eyrF0jiFpY+3drT6383f1qhkbGsLSifNAjA61IUjZjmLCWjItY6LB9ft9YhoDgwfmclB2zhu51Lc7+95b8NRAg==} + chai@6.3.0: resolution: {integrity: sha512-XWAtwJ6OHO+tj0EKCs0Y2UamnyOxseZWltU4x2U2wh8g4AigdjwvtUjvLP2tqkA/avxHEtzxNaqGq/YGNwckKg==} engines: {node: '>=18'} + character-entities-html4@2.1.0: + resolution: {integrity: sha512-1v7fgQRj6hnSwFpq1Eu0ynr/CDEw0rXo2B61qXrLNdHZmPKgb7fqS1a2JwF0rISo9q77jDI8VMEHoApn8qDoZA==} + + character-entities-legacy@3.0.0: + resolution: {integrity: sha512-RpPp0asT/6ufRm//AJVwpViZbGM/MkjQFxJccQRHmISF/22NBtsHqAWmL+/pmkPWoIUJdWyeVleTl1wydHATVQ==} + + comma-separated-tokens@2.0.3: + resolution: {integrity: sha512-Fu4hJdvzeylCfQPp9SGWidpzrMs7tTrlu6Vb8XGaRGck8QSNZJJp538Wrb60Lax4fPwR64ViY468OIUTbRlGZg==} + cross-spawn@7.0.6: resolution: {integrity: sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==} engines: {node: '>= 8'} @@ -558,10 +634,17 @@ packages: deep-is@0.1.4: resolution: {integrity: sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==} + dequal@2.0.3: + resolution: {integrity: sha512-0je+qPKHEMohvfRTCEo3CrPG6cAzAYgmzKyxRiYSSDkS6eGJdyVJm7WaYA5ECaAD9wLB2T4EEeymA5aFVcYXCA==} + engines: {node: '>=6'} + detect-libc@2.1.2: resolution: {integrity: sha512-Btj2BOOO83o3WyH59e8MgXsxEQVcarkUOpEYrubB0urwnN10yQ364rsiByU11nZlqWYZm05i/of7io4mzihBtQ==} engines: {node: '>=8'} + devlop@1.1.0: + resolution: {integrity: sha512-RWmIqhcFf1lRYBvNmr7qTNuyCt/7/ns2jbpp1+PalgE/rDQcBT0fioSMUpJ93irlUhC5hrg4cYqe6U+0ImW0rA==} + entities@7.0.1: resolution: {integrity: sha512-TWrgLOFUQTH994YUyl1yT4uyavY5nNB5muff+RtWaqNVCAK408b5ZnnbNAUEWLTCpum9w6arT70i1XdQ4UeOPA==} engines: {node: '>=0.12'} @@ -693,12 +776,21 @@ packages: resolution: {integrity: sha512-iZyKG96/JwPz1N55vj2Ie2vXbhu440zfUfJvSwEqEbeLluk7NnapfGqa7LH0mOsnDxTF85Mx8/dyR6HfqcbmbQ==} engines: {node: '>=20'} + hast-util-to-html@9.0.6: + resolution: {integrity: sha512-1SZUxCN3TtJAE7e2BQN2MBHsoZ1gnmi9GoCP5Di59CSWptIezSAW09yDZyVbanb78V9eCwrKqdQsjtfVTxYHWA==} + + hast-util-whitespace@3.0.0: + resolution: {integrity: sha512-88JUN06ipLwsnv+dVn+OIYOvAuvBMy/Qoi6O7mQHxdPXpjy+Cd6xRkWwux7DKO+4sYILtLBRIKgsdpS2gQc7qw==} + hookified@1.15.1: resolution: {integrity: sha512-MvG/clsADq1GPM2KGo2nyfaWVyn9naPiXrqIe4jYjXNZQt238kWyOGrsyc/DmRAQ+Re6yeo6yX/yoNCG5KAEVg==} hookified@2.2.0: resolution: {integrity: sha512-p/LgFzRN5FeoD3DLS6bkUapeye6E4SI6yJs6KetENd18S+FBthqYq2amJUWpt5z0EQwwHemidjY5OqJGEKm5uA==} + html-void-elements@3.0.0: + resolution: {integrity: sha512-bEqo66MRXsUGxWHV5IP0PUiAWwoEjba4VCzg0LjFJBpchPaTfyfCKTG6bc5F8ucKec3q5y6qOdGyYTSBEvhCrg==} + ignore@5.3.2: resolution: {integrity: sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g==} engines: {node: '>= 4'} @@ -819,6 +911,24 @@ packages: magic-string@1.4.5: resolution: {integrity: sha512-oLLC2+YvQUfAa+vxoufE/yc1icb87M9iXIRqAoR/2EhE/8cb3SF/+Gi0c2By1B+5Vz2e2vQtUvHiu1+63Znh+w==} + mdast-util-to-hast@13.2.1: + resolution: {integrity: sha512-cctsq2wp5vTsLIcaymblUriiTcZd0CwWtCbLvrOzYCDZoWyMNV8sZ7krj09FSnsiJi3WVsHLM4k6Dq/yaPyCXA==} + + micromark-util-character@2.1.1: + resolution: {integrity: sha512-wv8tdUTJ3thSFFFJKtpYKOYiGP2+v96Hvk4Tu8KpCAsTMs6yi+nVmGh1syvSCsaxz45J6Jbw+9DD6g97+NV67Q==} + + micromark-util-encode@2.0.1: + resolution: {integrity: sha512-c3cVx2y4KqUnwopcO9b/SCdo2O67LwJJ/UyqGfbigahfegL9myoEFoDYZgkT7f36T0bLrM9hZTAaAyH+PCAXjw==} + + micromark-util-sanitize-uri@2.0.1: + resolution: {integrity: sha512-9N9IomZ/YuGGZZmQec1MbgxtlgougxTodVwDzzEouPKo3qFWvymFHWcnDi2vzV1ff6kas9ucW+o3yzJK9YB1AQ==} + + micromark-util-symbol@2.0.1: + resolution: {integrity: sha512-vs5t8Apaud9N28kgCrRUdEed4UJ+wWNvicHLPxCa9ENlYuAY31M0ETy5y1vA33YoNPDFTghEbnh6efaE8h4x0Q==} + + micromark-util-types@2.0.3: + resolution: {integrity: sha512-oxB2Ik03hI0gv+VNn9tnh1t1YEe9MDPptViAEgfdf3YQHsn0pzGTgCdlSCJXcwhqm8phaEuM7zeEu3QQzVBrPg==} + minimatch@10.2.6: resolution: {integrity: sha512-vpLQEs+VLCr1nU0BXS07maYoFwlDAH0gngQuuttxIwutDFEMHq2blX+8vpgxDdK3J1PwjCJiep77OitTZ4Ll1A==} engines: {node: 18 || 20 || >=22} @@ -844,6 +954,12 @@ packages: resolution: {integrity: sha512-5vvB5+W7ePv+p3uqxi+RcW1XAzLW0/hxt3/4X4Lc4qHudzOhmBiBwOY6DRob4WnanAEGvNcLjF+KNOufrUoEQw==} engines: {node: '>=12.20.0'} + oniguruma-parser@0.12.2: + resolution: {integrity: sha512-6HVa5oIrgMC6aA6WF6XyyqbhRPJrKR02L20+2+zpDtO5QAzGHAUGw5TKQvwi5vctNnRHkJYmjAhRVQF2EKdTQw==} + + oniguruma-to-es@4.3.6: + resolution: {integrity: sha512-csuQ9x3Yr0cEIs/Zgx/OEt9iBw9vqIunAPQkx19R/fiMq2oGVTgcMqO/V3Ybqefr1TBvosI6jU539ksaBULJyA==} + optionator@0.9.4: resolution: {integrity: sha512-6IpQ7mKUxRcZNLIObR0hz7lxsapSSIYNZJwXPGeF0mTVqGKFIXj1DQcMoT22S3ROcLyY/rz0PWaWZ9ayWmad9g==} engines: {node: '>= 0.8.0'} @@ -901,6 +1017,9 @@ packages: engines: {node: '>=14'} hasBin: true + property-information@7.2.0: + resolution: {integrity: sha512-IAtzIB6sUiWaJYrX9smp3V46pBGbBeLFRGdh25kg1334VcBlD8HzhPeNIWQH9zhGmo2itIe25EHt9dQP7G5hmg==} + punycode@2.3.1: resolution: {integrity: sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==} engines: {node: '>=6'} @@ -909,6 +1028,15 @@ packages: resolution: {integrity: sha512-+Owyggi9IxT1ePKGafcI87ubSmxol6smwJ+RAHDQlx9+9cPwFWDiKFFCPuWhr9ignlGpZ9vDQLw67N4dcTVFEA==} engines: {node: '>=20'} + regex-recursion@6.0.2: + resolution: {integrity: sha512-0YCaSCq2VRIebiaUviZNs0cBz1kg5kVS2UKUfNIx8YVs1cN3AV7NTctO5FOKBA+UT2BPJIWZauYHPqJODG50cg==} + + regex-utilities@2.3.0: + resolution: {integrity: sha512-8VhliFJAWRaUiVvREIiW2NXXTmHs4vMNnSzuJVhscgmGav3g9VDxLrQndI3dZZVVdp0ZO/5v0xmX516/7M9cng==} + + regex@6.1.0: + resolution: {integrity: sha512-6VwtthbV4o/7+OaAF9I5L5V3llLEsoPyq9P1JVXkedTP33c7MfCG0/5NOPcSJn0TzXcG9YUrR0gQSWioew3LDg==} + rolldown@1.2.19: resolution: {integrity: sha512-QIiV1J9d0pzN4jeeTH4sjPy0AZ6cAy2cG0ExeoE1+U8Rvj+hR3gYkokx0YbeUNGlZqiQJJ2utcETe0oKXwzsuA==} engines: {node: ^20.19.0 || >=22.12.0} @@ -927,13 +1055,23 @@ packages: resolution: {integrity: sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==} engines: {node: '>=8'} + shiki@4.6.0: + resolution: {integrity: sha512-imjLsVHgPuWhvpU3P+zOekvMYqnel7QmKsFC4Sn0fCuAvaaalBsxwKEsrU8Ko5BdFnZA6Go/8a0RzahS634UgA==} + engines: {node: '>=20'} + source-map-js@1.2.2: resolution: {integrity: sha512-KGj/8Y43x35aZVDtt+J4mK1hoLGHULMYfSkODJNQjNDC3oW1PqPoxMwo0pLUsWM/UEGzON/NxeHywEfNXNP3Vw==} engines: {node: '>=0.10.0'} + space-separated-tokens@2.0.2: + resolution: {integrity: sha512-PEGlAwrG8yXGXRjW32fGbg66JAlOAwbObuqVoJpv/mRgoWDQfgH1wDPvtzWyUSNAXBGSk8h755YDbbcEy3SH2Q==} + std-env@4.3.0: resolution: {integrity: sha512-OtU/EgQ1kIm5KwqQpBC6ZEMXrZRui11w8zgfTWp8cdO9B8OaPsbA8bTHO2P+HNo1VlUTGMVBwPhydu6poeXiag==} + stringify-entities@4.0.4: + resolution: {integrity: sha512-IwfBptatlO+QCJUo19AqvrPNqlVMpW9YEL2LIVY+Rpv2qsjCGxaDLNRgeGsQWJhfItebuJhsGSLjaBbNSQ+ieg==} + tinybench@6.2.3: resolution: {integrity: sha512-Al01C2JIBnO2CXCAPbpAl6sUiOZHeThGtHYNTa51JRw9PyWOCdr+9Ong05R4qg/Sk3+H645E8ov1h2c58ityNw==} engines: {node: '>=20.0.0'} @@ -946,6 +1084,9 @@ packages: resolution: {integrity: sha512-wXR/dYpcqKmfWpEdZjiKJOwCNFndD0DMnrW/cYjVGttEkBfVgcLFHoNrlj47mjOVic9yyNu65alsgF4NQyTa2g==} engines: {node: '>=12.0.0'} + trim-lines@3.0.1: + resolution: {integrity: sha512-kRj8B+YHZCc9kQYdWfJB2/oUl9rA99qbowYYBtr4ui4mZyAQ2JpvVBd/6U2YloATfqBhBTSMhTpgBHtU0Mf3Rg==} + ts-api-utils@2.5.0: resolution: {integrity: sha512-OJ/ibxhPlqrMM0UiNHJ/0CKQkoKF243/AEmplt3qpRgkW8VG7IfOS41h7V8TjITqdByHzrjcS/2si+y4lIh8NA==} engines: {node: '>=18.12'} @@ -974,6 +1115,21 @@ packages: undici-types@7.24.6: resolution: {integrity: sha512-WRNW+sJgj5OBN4/0JpHFqtqzhpbnV0GuB+OozA9gCL7a993SmU+1JBZCzLNxYsbMfIeDL+lTsphD5jN5N+n0zg==} + unist-util-is@6.0.1: + resolution: {integrity: sha512-LsiILbtBETkDz8I9p1dQ0uyRUWuaQzd/cuEeS1hoRSyW5E5XGmTzlwY1OrNzzakGowI9Dr/I8HVaw4hTtnxy8g==} + + unist-util-position@5.0.0: + resolution: {integrity: sha512-fucsC7HjXvkB5R3kTCO7kUjRdrS0BJt3M/FPxmHMBOm8JQi2BsHAHFsy27E0EolP8rp0NzXsJ+jNPyDWvOJZPA==} + + unist-util-stringify-position@4.0.0: + resolution: {integrity: sha512-0ASV06AAoKCDkS2+xw5RXJywruurpbC4JZSm7nr7MOt1ojAzvyyaO+UxZf18j8FCF6kmzCZKcAgN/yu2gm2XgQ==} + + unist-util-visit-parents@6.1.0: + resolution: {integrity: sha512-vKXxz6O38sKDj1mtx/k2cWvkkFBuYGx6uGrlzBkVeWCRF/F8sdI0j3Wbkz/5rVNRRuVc8UrgRdbCxNhmYXgP3w==} + + unist-util-visit@5.2.0: + resolution: {integrity: sha512-fpsYs/VVoZxfGY9/j3FQpZmN8wdLJaV1Pt38AaJNZu9uKIHcFU3halCdBveEq1HGKO1OEfJY65w1zvoFV1b3qQ==} + uri-js@4.4.1: resolution: {integrity: sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==} @@ -988,6 +1144,12 @@ packages: typescript: optional: true + vfile-message@4.0.4: + resolution: {integrity: sha512-66ycRswIkNmHH9PHku7ADtv5RVwgIrOcuv3J8Svz6h4qgGRrKVa+9/neuKyJZUXyOpYwLTvS+whZ4R2urHHgQg==} + + vfile@6.0.3: + resolution: {integrity: sha512-KzIbH/9tXat2u30jf+smMwFCsno4wHVdNmzFyL+T/L3UGqqk6JKfVqOFOZEpZSHADH1k40ab6NUIXZq422ov3Q==} + vite@8.3.8: resolution: {integrity: sha512-LzOn3h9rG/0vhLdXrV4yJ4QFA9eEoqCl+Yx+kGJd7aB9w6nfNgVHKSYwLPZUHrz4ZGa+t+kXjV9itvcHDLQouA==} engines: {node: ^20.19.0 || >=22.12.0} @@ -1130,6 +1292,9 @@ packages: resolution: {integrity: sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==} engines: {node: '>=10'} + zwitch@2.0.4: + resolution: {integrity: sha512-bXE4cR/kVZhKZX/RjPEflHaKVhUVl85noU3v6b8apfQEc1x4A+zBxjZ4lN8LqGd6WZ3dl98pY4o717VFmoPp+A==} + snapshots: '@babel/helper-string-parser@7.29.13': {} @@ -1314,6 +1479,48 @@ snapshots: '@rolldown/pluginutils@1.1.0': {} + '@shikijs/core@4.6.0': + dependencies: + '@shikijs/primitive': 4.6.0 + '@shikijs/types': 4.6.0 + '@shikijs/vscode-textmate': 10.1.0 + '@types/hast': 3.0.5 + hast-util-to-html: 9.0.6 + + '@shikijs/engine-javascript@4.6.0': + dependencies: + '@shikijs/types': 4.6.0 + '@shikijs/vscode-textmate': 10.1.0 + oniguruma-to-es: 4.3.6 + + '@shikijs/engine-oniguruma@4.6.0': + dependencies: + '@shikijs/types': 4.6.0 + '@shikijs/vscode-textmate': 10.1.0 + + '@shikijs/langs@4.6.0': + dependencies: + '@shikijs/types': 4.6.0 + + '@shikijs/primitive@4.6.0': + dependencies: + '@shikijs/types': 4.6.0 + '@shikijs/vscode-textmate': 10.1.0 + '@types/hast': 3.0.5 + + '@shikijs/themes@4.6.0': + dependencies: + '@shikijs/types': 4.6.0 + + '@shikijs/types@4.6.0': + dependencies: + '@shikijs/vscode-textmate': 10.1.0 + '@types/hast': 3.0.5 + + '@shikijs/vscode-textmate@10.1.0': {} + + '@terrazzo/token-types@2.10.0': {} + '@tybys/wasm-util@0.10.4': dependencies: tslib: 2.9.1 @@ -1330,12 +1537,22 @@ snapshots: '@types/estree@1.0.10': {} + '@types/hast@3.0.5': + dependencies: + '@types/unist': 3.0.3 + '@types/json-schema@7.0.15': {} + '@types/mdast@4.0.4': + dependencies: + '@types/unist': 3.0.3 + '@types/node@24.19.2': dependencies: undici-types: 7.24.6 + '@types/unist@3.0.3': {} + '@typescript-eslint/eslint-plugin@8.72.2(@typescript-eslint/parser@8.72.2(eslint@10.14.0)(typescript@6.0.3))(eslint@10.14.0)(typescript@6.0.3)': dependencies: '@eslint-community/regexpp': 4.12.3 @@ -1427,6 +1644,8 @@ snapshots: '@typescript-eslint/types': 8.72.2 eslint-visitor-keys: 5.0.1 + '@ungap/structured-clone@1.4.0': {} + '@vitejs/plugin-vue@6.0.10(vite@8.3.8(@types/node@24.19.2))(vue@3.5.45(typescript@6.0.3))': dependencies: '@rolldown/pluginutils': 1.1.0 @@ -1537,6 +1756,12 @@ snapshots: typescript: 6.0.3 vue: 3.5.45(typescript@6.0.3) + '@whatsaaaa/design-system@0.1.0(vue@3.5.45(typescript@6.0.3))': + dependencies: + '@terrazzo/token-types': 2.10.0 + optionalDependencies: + vue: 3.5.45(typescript@6.0.3) + '@whatsaaaa/form-builder-affects@0.2.2-rc.0(@whatsaaaa/form-builder-schema@1.0.0-rc.0(valibot@1.5.0(typescript@6.0.3)))(valibot@1.5.0(typescript@6.0.3))': dependencies: '@whatsaaaa/form-builder-schema': 1.0.0-rc.0(valibot@1.5.0(typescript@6.0.3)) @@ -1586,8 +1811,16 @@ snapshots: keyv: 5.6.0 qified: 0.10.1 + ccount@2.0.1: {} + chai@6.3.0: {} + character-entities-html4@2.1.0: {} + + character-entities-legacy@3.0.0: {} + + comma-separated-tokens@2.0.3: {} + cross-spawn@7.0.6: dependencies: path-key: 3.1.1 @@ -1602,8 +1835,14 @@ snapshots: deep-is@0.1.4: {} + dequal@2.0.3: {} + detect-libc@2.1.2: {} + devlop@1.1.0: + dependencies: + dequal: 2.0.3 + entities@7.0.1: {} es-module-lexer@2.3.2: {} @@ -1739,10 +1978,30 @@ snapshots: dependencies: hookified: 1.15.1 + hast-util-to-html@9.0.6: + dependencies: + '@types/hast': 3.0.5 + '@types/unist': 3.0.3 + ccount: 2.0.1 + comma-separated-tokens: 2.0.3 + hast-util-whitespace: 3.0.0 + html-void-elements: 3.0.0 + mdast-util-to-hast: 13.2.1 + property-information: 7.2.0 + space-separated-tokens: 2.0.2 + stringify-entities: 4.0.4 + zwitch: 2.0.4 + + hast-util-whitespace@3.0.0: + dependencies: + '@types/hast': 3.0.5 + hookified@1.15.1: {} hookified@2.2.0: {} + html-void-elements@3.0.0: {} + ignore@5.3.2: {} ignore@7.0.14: {} @@ -1831,6 +2090,35 @@ snapshots: dependencies: '@jridgewell/sourcemap-codec': 1.6.0 + mdast-util-to-hast@13.2.1: + dependencies: + '@types/hast': 3.0.5 + '@types/mdast': 4.0.4 + '@ungap/structured-clone': 1.4.0 + devlop: 1.1.0 + micromark-util-sanitize-uri: 2.0.1 + trim-lines: 3.0.1 + unist-util-position: 5.0.0 + unist-util-visit: 5.2.0 + vfile: 6.0.3 + + micromark-util-character@2.1.1: + dependencies: + micromark-util-symbol: 2.0.1 + micromark-util-types: 2.0.3 + + micromark-util-encode@2.0.1: {} + + micromark-util-sanitize-uri@2.0.1: + dependencies: + micromark-util-character: 2.1.1 + micromark-util-encode: 2.0.1 + micromark-util-symbol: 2.0.1 + + micromark-util-symbol@2.0.1: {} + + micromark-util-types@2.0.3: {} + minimatch@10.2.6: dependencies: brace-expansion: 5.0.12 @@ -1849,6 +2137,14 @@ snapshots: obug@3.0.0: {} + oniguruma-parser@0.12.2: {} + + oniguruma-to-es@4.3.6: + dependencies: + oniguruma-parser: 0.12.2 + regex: 6.1.0 + regex-recursion: 6.0.2 + optionator@0.9.4: dependencies: deep-is: 0.1.4 @@ -1896,12 +2192,24 @@ snapshots: prettier@3.9.10: {} + property-information@7.2.0: {} + punycode@2.3.1: {} qified@0.10.1: dependencies: hookified: 2.2.0 + regex-recursion@6.0.2: + dependencies: + regex-utilities: 2.3.0 + + regex-utilities@2.3.0: {} + + regex@6.1.0: + dependencies: + regex-utilities: 2.3.0 + rolldown@1.2.19: dependencies: '@oxc-project/types': 0.156.0 @@ -1932,10 +2240,28 @@ snapshots: shebang-regex@3.0.0: {} + shiki@4.6.0: + dependencies: + '@shikijs/core': 4.6.0 + '@shikijs/engine-javascript': 4.6.0 + '@shikijs/engine-oniguruma': 4.6.0 + '@shikijs/langs': 4.6.0 + '@shikijs/themes': 4.6.0 + '@shikijs/types': 4.6.0 + '@shikijs/vscode-textmate': 10.1.0 + '@types/hast': 3.0.5 + source-map-js@1.2.2: {} + space-separated-tokens@2.0.2: {} + std-env@4.3.0: {} + stringify-entities@4.0.4: + dependencies: + character-entities-html4: 2.1.0 + character-entities-legacy: 3.0.0 + tinybench@6.2.3: {} tinyexec@1.3.1: {} @@ -1945,6 +2271,8 @@ snapshots: fdir: 6.5.0(picomatch@4.0.7) picomatch: 4.0.7 + trim-lines@3.0.1: {} + ts-api-utils@2.5.0(typescript@6.0.3): dependencies: typescript: 6.0.3 @@ -1971,6 +2299,29 @@ snapshots: undici-types@7.24.6: {} + unist-util-is@6.0.1: + dependencies: + '@types/unist': 3.0.3 + + unist-util-position@5.0.0: + dependencies: + '@types/unist': 3.0.3 + + unist-util-stringify-position@4.0.0: + dependencies: + '@types/unist': 3.0.3 + + unist-util-visit-parents@6.1.0: + dependencies: + '@types/unist': 3.0.3 + unist-util-is: 6.0.1 + + unist-util-visit@5.2.0: + dependencies: + '@types/unist': 3.0.3 + unist-util-is: 6.0.1 + unist-util-visit-parents: 6.1.0 + uri-js@4.4.1: dependencies: punycode: 2.3.1 @@ -1981,6 +2332,16 @@ snapshots: optionalDependencies: typescript: 6.0.3 + vfile-message@4.0.4: + dependencies: + '@types/unist': 3.0.3 + unist-util-stringify-position: 4.0.0 + + vfile@6.0.3: + dependencies: + '@types/unist': 3.0.3 + vfile-message: 4.0.4 + vite@8.3.8(@types/node@24.19.2): dependencies: lightningcss: 1.33.0 @@ -2065,3 +2426,5 @@ snapshots: xml-name-validator@5.0.0: {} yocto-queue@0.1.0: {} + + zwitch@2.0.4: {} diff --git a/vue-event-registration/pnpm-workspace.yaml b/vue-event-registration/pnpm-workspace.yaml index e001592..09f6534 100644 --- a/vue-event-registration/pnpm-workspace.yaml +++ b/vue-event-registration/pnpm-workspace.yaml @@ -2,3 +2,4 @@ minimumReleaseAgeExclude: - '@whatsaaaa/form-builder-schema@1.0.0-rc.0' - '@whatsaaaa/form-builder-vue@1.0.0-rc.0' - '@whatsaaaa/form-builder-affects@0.2.2-rc.0' + - '@whatsaaaa/design-system@0.1.0' diff --git a/vue-event-registration/public/favicon.svg b/vue-event-registration/public/favicon.svg deleted file mode 100644 index 6893eb1..0000000 --- a/vue-event-registration/public/favicon.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file From ec846cfffa9ffe74cb119da7882a201be563654c Mon Sep 17 00:00:00 2001 From: Whatsaaaa Date: Fri, 13 Nov 2026 19:18:03 +0100 Subject: [PATCH 02/10] Restyle the Vue app on the design system's terminal frame The page is the design system's window: a tab bar with form-builder's mark, a link to its docs and the ghost, and a status line with the mode, the theme switch and the switch for the shortcut keys. Every color, font, size, space, radius and border comes from a design system token, in both themes. The form controls are styled from the system's roles: field borders for outlines, the interactive color for focus, checked controls and the primary button, mono labels, sans values, hints under the fields and no placeholders, errors with an icon and a word. The submitted JSON is a code block highlighted in the system's code theme. The head scripts that apply a remembered theme and keys before the first paint come from the package. --- vue-event-registration/index.html | 6 +- .../public/apple-touch-icon.png | Bin 0 -> 913 bytes vue-event-registration/public/favicon.ico | Bin 0 -> 15086 bytes vue-event-registration/public/favicon.svg | 1 + vue-event-registration/src/App.vue | 1 + vue-event-registration/src/styles.css | 679 ++++++++++++------ vue-event-registration/src/ui/CodeBlock.vue | 26 +- vue-event-registration/src/ui/PageShell.vue | 24 +- vue-event-registration/src/ui/StatusLine.vue | 81 +++ .../src/ui/StepIndicator.vue | 6 +- vue-event-registration/src/ui/TabBar.vue | 44 ++ .../src/ui/assets/mark-on-dark.svg | 1 + .../src/ui/assets/mark-on-light.svg | 1 + .../src/ui/fields/FieldShell.vue | 3 +- .../src/ui/fields/SelectInput.vue | 43 +- .../src/ui/fields/TextInput.vue | 1 - .../src/ui/fields/TextareaInput.vue | 1 - vue-event-registration/src/ui/highlight.ts | 21 + vue-event-registration/vite.config.ts | 24 +- 19 files changed, 710 insertions(+), 253 deletions(-) create mode 100644 vue-event-registration/public/apple-touch-icon.png create mode 100644 vue-event-registration/public/favicon.ico create mode 100644 vue-event-registration/public/favicon.svg create mode 100644 vue-event-registration/src/ui/StatusLine.vue create mode 100644 vue-event-registration/src/ui/TabBar.vue create mode 100644 vue-event-registration/src/ui/assets/mark-on-dark.svg create mode 100644 vue-event-registration/src/ui/assets/mark-on-light.svg create mode 100644 vue-event-registration/src/ui/highlight.ts diff --git a/vue-event-registration/index.html b/vue-event-registration/index.html index c8006d5..9833b40 100644 --- a/vue-event-registration/index.html +++ b/vue-event-registration/index.html @@ -2,9 +2,11 @@ - - Event registration - form-builder sample + Harbour Conf 2027 registration - form-builder sample + + +
diff --git a/vue-event-registration/public/apple-touch-icon.png b/vue-event-registration/public/apple-touch-icon.png new file mode 100644 index 0000000000000000000000000000000000000000..f4ade4017b17ae3268826231fd401b805c19ad3e GIT binary patch literal 913 zcmeAS@N?(olHy`uVBq!ia0vp^TR@nD4M^IaWiw)6V2uUj5`vTc9CzPkV49{=TT5ikj4@fC3tcD>*t zNOk6v+s$=<|Np9Zc=`1D>Bp<(9Y2ROsdX*rRLWSyF-wCK=IiFRbRpdC16uTL`r>t; z?kC=^)80H+;ETi5#re1MQ@05>$*m~*lKXq@nKGvf%%Oeza`#WY>BmvE;MB$KZ?_xW z=5*u_vHZ2|Z&;eO;)_Nt_xs!KpUP2Zu?=|o;`X=bnQvPbu&FW4NW;F&+S3j3^P6f0l$>|5KYjT1z^9MTuD3Fwr^>3$G)qx=(J!e z$d~4s5uVq0(){E(t{02T<)m0$O^P2j-)ek$?Mh6 zR$SJ%#kc$z-;x$iTfG&R^=vVtUSNOwae(E+*M7 zRWhFC$96Gk`N#B(7t`~7wu?!&OO=dg`LW#~o5z8bzpi>K?_KdN{~>*RVZc#QQI#SGVgIr31(2x2pjdOdcFePaK8vg&KM z;re?6aIpqBU(q%}rh{UwG3Ewi(>?`mk-`n0-hB!*eLTvX(cS^>*=XyzuKhLUU+rt) z9xZYRbNfiLp-{Iqjr|;Z9^u+QcD<$f$f^hFkCE$G8-(|XTdWRc-uspFXj_DJ=zHF+ zb~x&@PCoZi$~Ycq_?}R|3HwvE&qs4)O1=AJThH$&%isBI;=K(`9wP_dxnASVx?}M7 z#$=9~^kU_*)3{o?TpYDH7Dr95;pWn5{48BAj#?axqo&tzbLljGmM#}ZEsn)e(`&f7 zbQ(WPmy4qo$Kt5zHQZb}ji05<#c_xe>^b)7xAlp0vG%*$=w*LR^_RY$aw@*ZUdHv< zOB?CyDNEmdm1W#iOzG<>r{a6;Wn7QFw2{7^vh>|oS;kGpl)j#FD!#{F#`V}s8|gcg zhv(Lz`+)3weJH2aw-1~phk<|mdvTekLzRd8_b~tE`{dbuYTNY2zWhJQ>|<~Eq^_Ch z-7x)^C)KY9_VPOoEPpwform-builder diff --git a/vue-event-registration/src/App.vue b/vue-event-registration/src/App.vue index 7c78229..72de27c 100644 --- a/vue-event-registration/src/App.vue +++ b/vue-event-registration/src/App.vue @@ -52,6 +52,7 @@ function startOver() {

This is what the form submitted:

Register someone else diff --git a/vue-event-registration/src/styles.css b/vue-event-registration/src/styles.css index ef4006e..c6ca9c0 100644 --- a/vue-event-registration/src/styles.css +++ b/vue-event-registration/src/styles.css @@ -1,79 +1,28 @@ /* - * The whole look of the app. It is plain on purpose: the components under src/ui carry the class - * names, and this file gives them a look, so a restyle swaps this file and those components only. + * The whole look of the app, on the Whatsaaaa design system. The design system brings the fonts, + * the tokens and the terminal frame; this file lays the page out in that frame and gives the form + * controls, which the design system leaves to each app, their look from its roles. The components + * under src/ui carry the class names, so a restyle swaps this file and those components only. */ -:root { - --color-page: #f4f4f2; - --color-surface: #ffffff; - --color-text: #1c1d1f; - --color-muted: #5a5e66; - --color-border: #c9ccd1; - --color-border-strong: #868b94; - --color-accent: #1d4ed8; - --color-accent-strong: #1a3fae; - --color-on-accent: #ffffff; - --color-error: #b42318; - --color-error-surface: #fef3f2; - --color-success: #17663a; - --color-success-surface: #f0f9f3; - - --radius: 6px; - --space-1: 0.25rem; - --space-2: 0.5rem; - --space-3: 0.75rem; - --space-4: 1rem; - --space-5: 1.5rem; - --space-6: 2rem; - - --control-height: 2.75rem; - - font-family: - system-ui, - -apple-system, - 'Segoe UI', - Roboto, - 'Helvetica Neue', - Arial, - sans-serif; - font-size: 100%; - line-height: 1.5; - color: var(--color-text); - background: var(--color-page); -} - -*, -*::before, -*::after { - box-sizing: border-box; -} - -body { - margin: 0; -} - -h1, -h2, -h3, -p, -dl, -dd, -ol, -ul { - margin: 0; -} - -button, -input, -select, -textarea { - font: inherit; - color: inherit; -} +@import '@whatsaaaa/design-system/index.css'; -:focus-visible { - outline: 3px solid var(--color-accent); - outline-offset: 2px; +:root { + /* + * The space between the window's edge and what is in it: the tab bar's own, so the edges of the + * form line up with the brand on the left and with the links on the right. + */ + --page-gutter: var(--ws-space-20); + /* The height of a one-line field and of a button. */ + --control-height: var(--ws-space-40); + /* A tick, drawn as a mask like the design system's icons: only its shape counts. It fills its box. */ + --icon-check: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='2 2 12 12' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 8.5 6.5 12 13 4.5'/%3E%3C/svg%3E"); +} + +@media (width < 64rem) { + :root { + --page-gutter: var(--ws-space-16); + } } .visually-hidden { @@ -88,26 +37,148 @@ textarea { border: 0; } -/* Page */ +/* The window: as tall as the screen, as wide as the form. Its content scrolls inside it. */ + +body { + padding: var(--ws-space-20); +} .page { - max-width: 46rem; - margin: 0 auto; - padding: var(--space-6) var(--space-4); + max-width: calc( + var(--ws-size-content) + 2 * var(--page-gutter) + 2 * + var(--ws-border-width-thin) + ); + height: calc(100dvh - 2 * var(--ws-space-20)); + margin-inline: auto; +} + +.page__main { + overflow: auto; +} + +.page__content { + padding: var(--ws-space-40) var(--page-gutter) var(--ws-space-48); +} + +/* On a narrow screen the window grows with the form, and the page scrolls. */ +@media (width < 64rem) { + body { + padding: var(--ws-space-12); + } + + .page { + height: auto; + min-height: calc(100dvh - 2 * var(--ws-space-12)); + } + + .page__main { + overflow: visible; + } + + .page__content { + padding-block: var(--ws-space-24) var(--ws-space-40); + } +} + +/* Tab bar */ + +/* + * The mark at 32 px, two screen pixels to a sprite pixel. Its file keeps two empty sprite columns + * on each side, so it reaches past its box by them: its pixels start where the form does, and + * they stand off the name by the bar's own gap. + */ +.tab-bar__mark { + width: var(--ws-space-32); + height: var(--ws-space-32); + margin-inline: calc(-1 * var(--ws-space-4)); +} + +/* + * The cut of the mark for the page's theme. The same rule as the design system's for the name of + * the theme in the status line: an image has no token to switch. + */ +[data-theme='dark'] .tab-bar__mark--light, +[data-theme='light'] .tab-bar__mark--dark { + display: none; +} + +@media (prefers-color-scheme: light) { + :root:not([data-theme]) .tab-bar__mark--dark { + display: none; + } +} + +@media not (prefers-color-scheme: light) { + :root:not([data-theme]) .tab-bar__mark--light { + display: none; + } +} + +/* The ghost keeps its body in the text color, as everywhere. */ +.ws-tab-bar__end .tab-bar__ghost { + color: var(--ws-color-text); + line-height: 0; +} + +/* Status line */ + +.status-line__theme { + margin: 0; + border-block: 0; + border-right: 0; + color: inherit; + font: inherit; + cursor: pointer; + background: none; +} + +.status-line__theme:hover { + color: var(--ws-color-text); } +/* + * The focus ring of a control in the status line goes inside it, as the keys switch's does: the + * line cuts off what reaches past its edges. A key hint gets room for the ring from the gap + * around it, so nothing moves. + */ +.ws-status-line__keys :is(button, a) { + margin-inline: calc(-1 * var(--ws-space-6)); + padding-inline: var(--ws-space-6); +} + +.ws-status-line__keys :is(button, a):focus-visible, +.status-line__theme:focus-visible { + outline-offset: calc(-1 * var(--ws-border-width-medium)); +} + +/* The theme's name is the last item, in the window's corner: its ring follows that curve. */ +.status-line__theme:focus-visible { + border-radius: var(--ws-radius-sm) var(--ws-radius-sm) + calc(var(--ws-radius-xl) - var(--ws-border-width-thin)) var(--ws-radius-sm); +} + +/* Page header */ + .page__header { - margin-bottom: var(--space-5); + margin-bottom: var(--ws-space-32); } .page__title { - font-size: 1.75rem; - line-height: 1.2; + font: var(--ws-text-h1); + letter-spacing: var(--ws-text-h1-letter-spacing); } .page__lead { - margin-top: var(--space-2); - color: var(--color-muted); + margin-top: var(--ws-space-8); + color: var(--ws-color-text-secondary); + font: var(--ws-text-lead); +} + +@media (width < 64rem) { + .page__title { + font: var(--ws-text-h1-compact); + letter-spacing: var(--ws-text-h1-compact-letter-spacing); + } } /* Form */ @@ -115,19 +186,12 @@ textarea { .form { display: flex; flex-direction: column; - gap: var(--space-5); -} - -.form__step { - padding: var(--space-5); - background: var(--color-surface); - border: 1px solid var(--color-border); - border-radius: var(--radius); + gap: var(--ws-space-32); } .form__step-title { - font-size: 1.25rem; - line-height: 1.3; + font: var(--ws-text-h2); + letter-spacing: var(--ws-text-h2-letter-spacing); } /* Focused by script when the step changes, never by the Tab key. */ @@ -136,18 +200,26 @@ textarea { } .form__step-lead { - margin-top: var(--space-1); - color: var(--color-muted); + margin-top: var(--ws-space-4); + color: var(--ws-color-text-secondary); + font: var(--ws-text-body-sm); } .form__step > .stack { - margin-top: var(--space-5); + margin-top: var(--ws-space-24); +} + +@media (width < 64rem) { + .form__step-title { + font: var(--ws-text-h2-compact); + letter-spacing: var(--ws-text-h2-compact-letter-spacing); + } } .stack { display: flex; flex-direction: column; - gap: var(--space-5); + gap: var(--ws-space-24); min-width: 0; } @@ -156,54 +228,58 @@ textarea { .steps { display: flex; flex-wrap: wrap; - gap: var(--space-2) var(--space-4); - padding: 0; - list-style: none; + gap: var(--ws-space-12) var(--ws-space-24); + padding-bottom: var(--ws-space-24); + border-bottom: var(--ws-border-width-thin) solid var(--ws-color-border); } .steps__button { display: flex; align-items: center; - gap: var(--space-2); - padding: var(--space-1) 0; - color: var(--color-muted); + gap: var(--ws-space-8); + margin: 0; + padding: 0; + border: 0; + color: var(--ws-color-text-secondary); + font: var(--ws-text-label); cursor: pointer; background: none; - border: 0; - border-radius: var(--radius); } -.steps__button:hover .steps__label { - text-decoration: underline; +.steps__button:hover { + color: var(--ws-color-text); } .steps__number { - display: inline-flex; + display: grid; flex: none; - align-items: center; - justify-content: center; - width: 1.75rem; - height: 1.75rem; - font-size: 0.875rem; - font-weight: 600; - border: 1px solid var(--color-border-strong); - border-radius: 50%; + place-items: center; + width: var(--ws-space-24); + height: var(--ws-space-24); + border: var(--ws-border-width-thin) solid var(--ws-color-field-border); + border-radius: var(--ws-radius-full); + font: var(--ws-text-label-sm); + font-weight: var(--ws-font-weight-bold); } -.steps__item--done .steps__number { - color: var(--color-text); - border-color: var(--color-text); +.steps__item--done .steps__number::before { + width: var(--ws-space-12); + height: var(--ws-space-12); + content: ''; + background: currentColor; + mask: var(--icon-check) center / contain no-repeat; } +/* The current step is marked like the mode in the status line: a solid chip. */ .steps__item--current .steps__button { - font-weight: 600; - color: var(--color-text); + color: var(--ws-color-text); + font-weight: var(--ws-font-weight-semibold); } .steps__item--current .steps__number { - color: var(--color-on-accent); - background: var(--color-accent); - border-color: var(--color-accent); + border-color: var(--ws-color-brand-fill); + color: var(--ws-color-on-brand); + background: var(--ws-color-brand-fill); } /* Fields */ @@ -211,7 +287,7 @@ textarea { .field { display: flex; flex-direction: column; - gap: var(--space-1); + gap: var(--ws-space-6); min-width: 0; margin: 0; padding: 0; @@ -220,115 +296,241 @@ textarea { .field__label { padding: 0; - font-weight: 600; + color: var(--ws-color-text); + font: var(--ws-text-label); } .field__required { - color: var(--color-error); + color: var(--ws-color-brand); } .field__hint { - font-size: 0.875rem; - color: var(--color-muted); + color: var(--ws-color-text-secondary); + font: var(--ws-text-body-sm); } +/* An error is a word with the danger icon before it, never a color alone. */ .field__error { - font-size: 0.875rem; - font-weight: 600; - color: var(--color-error); + display: flex; + gap: var(--ws-space-6); + color: var(--ws-color-danger-text); + font: var(--ws-text-body-sm); + font-weight: var(--ws-font-weight-medium); +} + +.field__error::before { + flex: none; + width: var(--ws-space-16); + height: 1lh; + content: ''; + background: var(--ws-color-danger); + mask: var(--ws-icon-danger) center / var(--ws-space-16) no-repeat; } .input { display: block; width: 100%; min-width: 0; - min-height: var(--control-height); - padding: var(--space-2) var(--space-3); - background: var(--color-surface); - border: 1px solid var(--color-border-strong); - border-radius: var(--radius); + height: var(--control-height); + padding: 0 var(--ws-space-12); + border: var(--ws-border-width-thin) solid var(--ws-color-field-border); + border-radius: var(--ws-radius-md); + color: var(--ws-color-text); + font-family: var(--ws-font-family-sans); + font-size: var(--ws-font-size-16); + line-height: var(--ws-font-line-height-normal); + background: var(--ws-color-bg); +} + +.input:hover { + border-color: var(--ws-color-text-secondary); } .input--multiline { + height: auto; + min-height: var(--control-height); + padding-block: var(--ws-space-8); resize: vertical; } -/* A native select indents its text a little more than an input does. */ -select.input { - padding-inline-start: calc(var(--space-3) - 0.25rem); +/* A select draws no arrow of its own here: its box draws one, where the field's text would end. */ +.select { + position: relative; } -.field--invalid .input { - border-color: var(--color-error); - box-shadow: 0 0 0 1px var(--color-error); +/* Room on the right for the arrow, with the field's own padding on both sides of it. */ +.select .input { + padding-right: calc(3 * var(--ws-space-12)); + cursor: pointer; + appearance: none; +} + +.select::after { + position: absolute; + top: 50%; + right: var(--ws-space-12); + width: var(--ws-space-12); + height: var(--ws-space-12); + content: ''; + background: var(--ws-color-text-secondary); + mask: var(--ws-icon-chevron) center / contain no-repeat; + translate: 0 -50%; + rotate: 90deg; + pointer-events: none; +} + +.field--invalid .input, +.field--invalid .input:hover { + border-color: var(--ws-color-danger); + box-shadow: inset 0 0 0 var(--ws-border-width-thin) var(--ws-color-danger); } .choices { display: flex; flex-direction: column; - gap: var(--space-2); - margin-top: var(--space-1); + gap: var(--ws-space-10); + margin-top: var(--ws-space-4); } .choice { display: flex; align-items: flex-start; - gap: var(--space-2); + gap: var(--ws-space-10); + cursor: pointer; +} + +.choice__label { + min-width: 0; + font-family: var(--ws-font-family-sans); + font-size: var(--ws-font-size-16); + line-height: var(--ws-font-line-height-normal); } +/* A box or a dot of the system's colors, on the first line of its label. */ .choice__input { + display: grid; flex: none; - width: 1.125rem; - height: 1.125rem; - margin: 0.1875rem 0 0; - accent-color: var(--color-accent); + place-content: center; + width: var(--ws-space-20); + height: var(--ws-space-20); + margin: var(--ws-space-2) 0 0; + border: var(--ws-border-width-thin) solid var(--ws-color-field-border); + border-radius: var(--ws-radius-xs); + cursor: pointer; + background: var(--ws-color-bg); + appearance: none; } -.choice__label { - min-width: 0; +.choice__input[type='radio'] { + border-radius: var(--ws-radius-full); } -/* Groups, lists and sections */ +.choice__input::before { + width: var(--ws-space-12); + height: var(--ws-space-12); + content: ''; + background: var(--ws-color-on-interactive); + mask: var(--icon-check) center / contain no-repeat; + scale: 0; +} + +.choice__input[type='radio']::before { + width: var(--ws-space-8); + height: var(--ws-space-8); + border-radius: var(--ws-radius-full); + mask: none; +} + +.choice__input:hover { + border-color: var(--ws-color-text-secondary); +} + +.choice__input:checked { + border-color: var(--ws-color-interactive); + background: var(--ws-color-interactive); +} + +.choice__input:checked::before { + scale: 1; +} + +.field--invalid .choice__input:not(:checked) { + border-color: var(--ws-color-danger); +} + +@media (prefers-reduced-motion: no-preference) { + .choice__input::before { + transition: scale var(--ws-motion-duration-fast) + var(--ws-motion-easing-standard); + } +} + +/* Nothing in the form is disabled today. Should something be, it is faint and says so. */ +.input:disabled, +.choice__input:disabled, +.button:disabled { + border-color: var(--ws-color-text-faint); + color: var(--ws-color-text-faint); + cursor: not-allowed; + background: none; +} + +.choice:has(:disabled) { + color: var(--ws-color-text-faint); + cursor: not-allowed; +} + +/* Groups, lists and sections: a box with its name in the top edge. */ .group { min-width: 0; margin: 0; - padding: var(--space-4); - border: 1px solid var(--color-border); - border-radius: var(--radius); + padding: var(--ws-space-16) var(--ws-space-20) var(--ws-space-20); + border: var(--ws-border-width-thin) solid var(--ws-color-border); + border-radius: var(--ws-radius-lg); } +/* The name sits in the edge with room around it, and its text starts where the fields do. */ .group__label { - padding: 0 var(--space-2); - font-weight: 600; + margin-left: calc(-1 * var(--ws-space-6)); + padding: 0 var(--ws-space-6); + color: var(--ws-color-text-secondary); + font: var(--ws-text-overline); + letter-spacing: var(--ws-text-overline-letter-spacing); + text-transform: uppercase; } .group__hint { - margin-bottom: var(--space-4); - font-size: 0.875rem; - color: var(--color-muted); + margin-bottom: var(--ws-space-16); + color: var(--ws-color-text-secondary); + font: var(--ws-text-body-sm); +} + +@media (width < 64rem) { + .group { + padding: var(--ws-space-12) var(--ws-space-16) var(--ws-space-16); + } } .list__empty { - color: var(--color-muted); + color: var(--ws-color-text-secondary); } .list__item { - padding: var(--space-4); - background: var(--color-page); - border-radius: var(--radius); + padding-top: var(--ws-space-16); + border-top: var(--ws-border-width-thin) dashed var(--ws-color-border); } .list__item-header { display: flex; - align-items: center; + align-items: baseline; justify-content: space-between; - gap: var(--space-3); - margin-bottom: var(--space-3); + gap: var(--ws-space-12); + margin-bottom: var(--ws-space-16); } .list__item-title { - font-size: 1rem; + font: var(--ws-text-h4); } /* Rows: one line of a 12-column grid, stacked on a narrow screen */ @@ -336,24 +538,24 @@ select.input { .row { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); - gap: var(--space-5) var(--space-4); + gap: var(--ws-space-24) var(--ws-space-16); } .row__cell { - grid-column: 1 / -1; + grid-column: span var(--span, 12); min-width: 0; } -@media (min-width: 40rem) { +@media (width < 64rem) { .row__cell { - grid-column: span var(--span, 12); + grid-column: 1 / -1; } } /* Display elements */ .paragraph { - color: var(--color-muted); + color: var(--ws-color-text-secondary); } /* Buttons */ @@ -362,41 +564,62 @@ select.input { display: flex; flex-wrap: wrap; justify-content: flex-end; - gap: var(--space-3); + gap: var(--ws-space-12); + padding-top: var(--ws-space-24); + border-top: var(--ws-border-width-thin) solid var(--ws-color-border); } .button { + display: inline-flex; + align-items: center; + justify-content: center; min-height: var(--control-height); - padding: var(--space-2) var(--space-4); - font-weight: 600; + margin: 0; + padding: 0 var(--ws-space-20); + border: var(--ws-border-width-thin) solid var(--ws-color-field-border); + border-radius: var(--ws-radius-md); + color: var(--ws-color-text); + font: var(--ws-text-label); + font-weight: var(--ws-font-weight-semibold); cursor: pointer; - background: var(--color-surface); - border: 1px solid var(--color-border-strong); - border-radius: var(--radius); + background: none; } .button:hover { - border-color: var(--color-text); + border-color: var(--ws-color-text-secondary); + background: var(--ws-color-raised); } .button--primary { - color: var(--color-on-accent); - background: var(--color-accent); - border-color: var(--color-accent); + border-color: var(--ws-color-interactive); + color: var(--ws-color-on-interactive); + background: var(--ws-color-interactive); } +/* The system has no hover color for the interactive fill: a touch of the text color lifts it. */ .button--primary:hover { - background: var(--color-accent-strong); - border-color: var(--color-accent-strong); + --hover: color-mix( + in oklab, + var(--ws-color-interactive) 85%, + var(--ws-color-text) + ); + + border-color: var(--hover); + background: var(--hover); } .button--quiet { - min-height: 2rem; - padding: var(--space-1) var(--space-2); - font-weight: 400; + min-height: 0; + padding: 0; + border: 0; + color: var(--ws-color-interactive); + font-weight: var(--ws-font-weight-regular); text-decoration: underline; +} + +.button--quiet:hover { background: none; - border-color: transparent; + text-decoration-thickness: var(--ws-border-width-medium); } /* Summary */ @@ -404,28 +627,34 @@ select.input { .summary { display: flex; flex-direction: column; - gap: var(--space-4); + gap: var(--ws-space-24); } .summary__title { - margin-bottom: var(--space-2); - font-size: 1rem; + margin-bottom: var(--ws-space-8); + color: var(--ws-color-text-secondary); + font: var(--ws-text-overline); + letter-spacing: var(--ws-text-overline-letter-spacing); + text-transform: uppercase; } .summary__rows { - border-top: 1px solid var(--color-border); + border-top: var(--ws-border-width-thin) dashed var(--ws-color-border); } +/* A term in the voice of a label, its value in the face of a field, on one baseline. */ .summary__row { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); - gap: var(--space-3); - padding: var(--space-2) 0; - border-bottom: 1px solid var(--color-border); + align-items: baseline; + gap: var(--ws-space-16); + padding-block: var(--ws-space-8); + border-bottom: var(--ws-border-width-thin) dashed var(--ws-color-border); } .summary__term { - color: var(--color-muted); + color: var(--ws-color-text-secondary); + font: var(--ws-text-label); } .summary__value { @@ -438,36 +667,52 @@ select.input { display: flex; flex-direction: column; align-items: flex-start; - gap: var(--space-3); - padding: var(--space-5); - border: 1px solid; - border-radius: var(--radius); + gap: var(--ws-space-16); } -.notice--success { - background: var(--color-success-surface); - border-color: var(--color-success); +.notice__title { + display: flex; + gap: var(--ws-space-12); + font: var(--ws-text-h2); + letter-spacing: var(--ws-text-h2-letter-spacing); +} + +/* The title says what happened, and the icon of its status goes before its first line. */ +.notice__title::before { + flex: none; + width: var(--ws-space-16); + height: 1lh; + content: ''; + background: var(--ws-color-tip); + mask: var(--icon-check) center / var(--ws-space-16) no-repeat; } .notice--error { - background: var(--color-error-surface); - border-color: var(--color-error); + padding: var(--ws-space-16) var(--ws-space-20) var(--ws-space-20); + border-left: var(--ws-border-width-thick) solid var(--ws-color-danger); + border-radius: 0 var(--ws-radius-lg) var(--ws-radius-lg) 0; + background: var(--ws-color-danger-tint); } -.notice__title { - font-size: 1.25rem; - line-height: 1.3; +.notice--error .notice__title::before { + width: var(--ws-space-20); + background: var(--ws-color-danger); + mask-image: var(--ws-icon-danger); + mask-size: var(--ws-space-20); +} + +.notice--error li { + font: var(--ws-text-label); } -.notice__code { +.notice .ws-code { align-self: stretch; - max-height: 24rem; margin: 0; - padding: var(--space-3); - overflow: auto; - font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; - font-size: 0.875rem; - background: var(--color-surface); - border: 1px solid var(--color-border); - border-radius: var(--radius); +} + +@media (width < 64rem) { + .notice__title { + font: var(--ws-text-h2-compact); + letter-spacing: var(--ws-text-h2-compact-letter-spacing); + } } diff --git a/vue-event-registration/src/ui/CodeBlock.vue b/vue-event-registration/src/ui/CodeBlock.vue index 98e618d..44caf7c 100644 --- a/vue-event-registration/src/ui/CodeBlock.vue +++ b/vue-event-registration/src/ui/CodeBlock.vue @@ -1,7 +1,29 @@ diff --git a/vue-event-registration/src/ui/PageShell.vue b/vue-event-registration/src/ui/PageShell.vue index 70e291d..2002a2b 100644 --- a/vue-event-registration/src/ui/PageShell.vue +++ b/vue-event-registration/src/ui/PageShell.vue @@ -1,13 +1,23 @@ diff --git a/vue-event-registration/src/ui/StatusLine.vue b/vue-event-registration/src/ui/StatusLine.vue new file mode 100644 index 0000000..9da6cee --- /dev/null +++ b/vue-event-registration/src/ui/StatusLine.vue @@ -0,0 +1,81 @@ + + + diff --git a/vue-event-registration/src/ui/StepIndicator.vue b/vue-event-registration/src/ui/StepIndicator.vue index 0c47b6e..bb44906 100644 --- a/vue-event-registration/src/ui/StepIndicator.vue +++ b/vue-event-registration/src/ui/StepIndicator.vue @@ -27,8 +27,12 @@ defineEmits<{ goTo: [index: number] }>() :aria-current="index === current ? 'step' : undefined" @click="$emit('goTo', index)" > - + + {{ label }} + (done) diff --git a/vue-event-registration/src/ui/TabBar.vue b/vue-event-registration/src/ui/TabBar.vue new file mode 100644 index 0000000..e7244fe --- /dev/null +++ b/vue-event-registration/src/ui/TabBar.vue @@ -0,0 +1,44 @@ + + + diff --git a/vue-event-registration/src/ui/assets/mark-on-dark.svg b/vue-event-registration/src/ui/assets/mark-on-dark.svg new file mode 100644 index 0000000..dd3b4ae --- /dev/null +++ b/vue-event-registration/src/ui/assets/mark-on-dark.svg @@ -0,0 +1 @@ +form-builder mark diff --git a/vue-event-registration/src/ui/assets/mark-on-light.svg b/vue-event-registration/src/ui/assets/mark-on-light.svg new file mode 100644 index 0000000..fee9952 --- /dev/null +++ b/vue-event-registration/src/ui/assets/mark-on-light.svg @@ -0,0 +1 @@ +form-builder mark diff --git a/vue-event-registration/src/ui/fields/FieldShell.vue b/vue-event-registration/src/ui/fields/FieldShell.vue index 649198a..8ba9be6 100644 --- a/vue-event-registration/src/ui/fields/FieldShell.vue +++ b/vue-event-registration/src/ui/fields/FieldShell.vue @@ -2,7 +2,8 @@ import { describedBy } from './a11y' // The frame every field shares: its label, hint and error. A set of inputs, like radios, is a -// fieldset with a legend instead of a label. +// fieldset with a legend instead of a label. No input has a placeholder: the hint, from the +// definition's `description`, goes under it. defineProps<{ id: string label?: string diff --git a/vue-event-registration/src/ui/fields/SelectInput.vue b/vue-event-registration/src/ui/fields/SelectInput.vue index c94f24e..81d2897 100644 --- a/vue-event-registration/src/ui/fields/SelectInput.vue +++ b/vue-event-registration/src/ui/fields/SelectInput.vue @@ -25,25 +25,28 @@ const selected = computed(() => :errors="errors" :required="required" > - + +
+ +
diff --git a/vue-event-registration/src/ui/fields/TextInput.vue b/vue-event-registration/src/ui/fields/TextInput.vue index eec40b6..6ebd135 100644 --- a/vue-event-registration/src/ui/fields/TextInput.vue +++ b/vue-event-registration/src/ui/fields/TextInput.vue @@ -31,7 +31,6 @@ const inputTypes: Record = { class="input" :type="inputTypes[field.type] ?? 'text'" :value="input ?? ''" - :placeholder="field.placeholder" :required="required" :autocomplete="uiHint(field, 'autocomplete')" :aria-invalid="errors ? 'true' : undefined" diff --git a/vue-event-registration/src/ui/fields/TextareaInput.vue b/vue-event-registration/src/ui/fields/TextareaInput.vue index 10bdf34..c3b7fb2 100644 --- a/vue-event-registration/src/ui/fields/TextareaInput.vue +++ b/vue-event-registration/src/ui/fields/TextareaInput.vue @@ -23,7 +23,6 @@ const id = useId() class="input input--multiline" rows="4" :value="String(input ?? '')" - :placeholder="field.placeholder" :required="required" :aria-invalid="errors ? 'true' : undefined" :aria-describedby="describedBy(id, field.description, errors)" diff --git a/vue-event-registration/src/ui/highlight.ts b/vue-event-registration/src/ui/highlight.ts new file mode 100644 index 0000000..58d08a7 --- /dev/null +++ b/vue-event-registration/src/ui/highlight.ts @@ -0,0 +1,21 @@ +import { codeTheme } from '@whatsaaaa/design-system/shiki' +import { + codeToTokensBase, + createShikiPrimitive, + type ThemedToken, +} from 'shiki/core' +import { createJavaScriptRegexEngine } from 'shiki/engine/javascript' +import json from 'shiki/langs/json.mjs' + +// JSON is the one language the app shows. Shiki's primitive gives tokens and leaves out its HTML +// renderer, and the JavaScript engine needs no WebAssembly, so a block is highlighted at once. +const shiki = createShikiPrimitive({ + themes: [codeTheme], + langs: [json], + engine: createJavaScriptRegexEngine(), +}) + +/** The lines of a piece of JSON, as tokens colored by the design system's code theme. */ +export function highlightJson(code: string): ThemedToken[][] { + return codeToTokensBase(shiki, code, { lang: 'json', theme: codeTheme.name }) +} diff --git a/vue-event-registration/vite.config.ts b/vue-event-registration/vite.config.ts index 20f96d1..1c35be6 100644 --- a/vue-event-registration/vite.config.ts +++ b/vue-event-registration/vite.config.ts @@ -1,9 +1,31 @@ +import { keysInitScript } from '@whatsaaaa/design-system/shortcuts' +import { themeInitScript } from '@whatsaaaa/design-system/theme' import vue from '@vitejs/plugin-vue' +import type { Plugin } from 'vite' import { defineConfig } from 'vitest/config' +/** + * The design system's head scripts, inline in the before the stylesheet: a remembered + * theme and a remembered "keys off" apply before the first paint. They come from the installed + * package, so they stay in step with it. + */ +function designSystemHead(): Plugin { + return { + name: 'design-system-head', + transformIndexHtml: { + // before Vite adds the stylesheet and the app's script at the end of the + order: 'pre', + handler: () => [ + { tag: 'script', children: themeInitScript, injectTo: 'head' }, + { tag: 'script', children: keysInitScript, injectTo: 'head' }, + ], + }, + } +} + // https://vite.dev/config/ export default defineConfig({ - plugins: [vue()], + plugins: [vue(), designSystemHead()], test: { include: ['src/**/*.test.ts'], }, From a9279f3487123dc6a0dd0b78d09fbbfd6729ee76 Mon Sep 17 00:00:00 2001 From: Whatsaaaa Date: Fri, 13 Nov 2026 19:18:03 +0100 Subject: [PATCH 03/10] Check the Vue app at 390 px in both themes, and its theme and keys switches --- vue-event-registration/e2e/frame.spec.ts | 116 ++++++++++++++++++ .../e2e/registration.spec.ts | 77 ++++++++++++ 2 files changed, 193 insertions(+) create mode 100644 vue-event-registration/e2e/frame.spec.ts diff --git a/vue-event-registration/e2e/frame.spec.ts b/vue-event-registration/e2e/frame.spec.ts new file mode 100644 index 0000000..c836416 --- /dev/null +++ b/vue-event-registration/e2e/frame.spec.ts @@ -0,0 +1,116 @@ +import { expect, test, type Page } from '@playwright/test' + +/** The item of the status line that names the theme on show, and switches it. */ +function themeName(page: Page, name: 'rose-pine' | 'rose-pine-dawn') { + return page.getByRole('button', { + name: `Switch theme, now ${name}`, + exact: true, + }) +} + +function keysSwitch(page: Page) { + return page.getByRole('switch', { name: 'Shortcut keys' }) +} + +/** The color of the page behind the window: it changes with the theme. */ +function pageColor(page: Page) { + return page.evaluate(() => getComputedStyle(document.body).backgroundColor) +} + +test.beforeEach(async ({ page }) => { + await page.goto('/') +}) + +test.describe('on a light system', () => { + test.use({ colorScheme: 'light' }) + + test('switches the theme, and remembers it', async ({ page }) => { + const html = page.locator('html') + + // Until it is switched, the theme is the system's. + await expect(html).not.toHaveAttribute('data-theme') + await expect(themeName(page, 'rose-pine-dawn')).toBeVisible() + await expect(themeName(page, 'rose-pine')).toBeHidden() + const light = await pageColor(page) + + await themeName(page, 'rose-pine-dawn').click() + await expect(html).toHaveAttribute('data-theme', 'dark') + await expect(themeName(page, 'rose-pine')).toBeVisible() + await expect(themeName(page, 'rose-pine-dawn')).toBeHidden() + const dark = await pageColor(page) + expect(dark).not.toBe(light) + + // The head script applies the choice again before the page is drawn. + await page.reload() + await expect(html).toHaveAttribute('data-theme', 'dark') + expect(await pageColor(page)).toBe(dark) + + await themeName(page, 'rose-pine').click() + await expect(html).toHaveAttribute('data-theme', 'light') + expect(await pageColor(page)).toBe(light) + }) +}) + +test('switches the shortcut keys off and on, and remembers it', async ({ + page, +}) => { + const html = page.locator('html') + await expect(keysSwitch(page)).toBeChecked() + await expect(keysSwitch(page)).toHaveText(/keys\s*on/, { + useInnerText: true, + }) + await expect(html).toHaveAttribute('data-ws-keys', 'on') + + await keysSwitch(page).click() + await expect(keysSwitch(page)).not.toBeChecked() + await expect(keysSwitch(page)).toHaveText(/keys\s*off/, { + useInnerText: true, + }) + await expect(html).toHaveAttribute('data-ws-keys', 'off') + + await page.reload() + await expect(keysSwitch(page)).not.toBeChecked() + await expect(html).toHaveAttribute('data-ws-keys', 'off') + + await keysSwitch(page).click() + await expect(keysSwitch(page)).toBeChecked() + await expect(html).toHaveAttribute('data-ws-keys', 'on') +}) + +test.describe('on a dark system', () => { + test.use({ colorScheme: 'dark' }) + + test('switches the theme with the t key while the keys are on', async ({ + page, + isMobile, + }) => { + test.skip(isMobile, 'Key hints show on a wide screen only') + const html = page.locator('html') + const hint = page.getByRole('button', { name: 'Switch theme', exact: true }) + const mode = page.locator('.ws-status-line__mode') + await expect(hint.locator('kbd')).toBeVisible() + await expect(mode).toHaveText('NORMAL') + + await page.keyboard.press('t') + await expect(html).toHaveAttribute('data-theme', 'light') + await page.keyboard.press('t') + await expect(html).toHaveAttribute('data-theme', 'dark') + + // A key typed into a field is only a letter. + const firstName = page.getByRole('textbox', { name: 'First name' }) + await firstName.press('t') + await expect(firstName).toHaveValue('t') + await expect(mode).toHaveText('INSERT') + await expect(html).toHaveAttribute('data-theme', 'dark') + await firstName.blur() + await expect(mode).toHaveText('NORMAL') + + // With the keys off, the key rests and its cap goes, but the button still works by hand. + await keysSwitch(page).click() + await expect(hint.locator('kbd')).toBeHidden() + await page.keyboard.press('t') + await expect(html).toHaveAttribute('data-theme', 'dark') + await hint.click() + await expect(html).toHaveAttribute('data-theme', 'light') + }) +}) diff --git a/vue-event-registration/e2e/registration.spec.ts b/vue-event-registration/e2e/registration.spec.ts index 853a46e..27c97e8 100644 --- a/vue-event-registration/e2e/registration.spec.ts +++ b/vue-event-registration/e2e/registration.spec.ts @@ -306,3 +306,80 @@ test('moves with Enter and with the step indicator', async ({ page }) => { await expect(currentStep(page)).toHaveText(/Invoice/) await expect(page.getByText('Enter the company name')).toBeVisible() }) + +for (const colorScheme of ['dark', 'light'] as const) { + test.describe(`on a 390 px screen, in the ${colorScheme} theme`, () => { + test.use({ viewport: { width: 390, height: 844 }, colorScheme }) + + test('fits the screen at every step, with its errors', async ({ page }) => { + // The page follows the system's theme, and names it in the status line. + const name = colorScheme === 'dark' ? 'rose-pine' : 'rose-pine-dawn' + await expect( + page.getByRole('button', { + name: `Switch theme, now ${name}`, + exact: true, + }), + ).toBeVisible() + + await next(page) + await expect(page.getByText('Enter your first name')).toBeVisible() + await expectNoSidewaysScroll(page) + await fillAboutYou(page, 'Business') + await page + .getByRole('textbox', { name: 'Phone' }) + .fill('+381 61 234 5678') + await next(page) + + await next(page) + await expect(page.getByText('Pick at least one session')).toBeVisible() + await expectNoSidewaysScroll(page) + await page + .getByRole('checkbox', { name: 'Hands-on forms workshop' }) + .check() + await page.getByLabel('Workshop level').selectOption('Advanced') + await page + .getByRole('checkbox', { name: 'I have access or dietary needs' }) + .check() + await page + .getByLabel('What do you need?') + .fill('Pristup bez stepenica, i čaj bez šećera za večeru.') + await expectNoSidewaysScroll(page) + await next(page) + + await page.getByRole('button', { name: 'Add guest' }).click() + await next(page) + await expect(page.getByText("Enter the guest's name")).toBeVisible() + await expectNoSidewaysScroll(page) + await page + .getByRole('region', { name: 'Guest 1' }) + .getByRole('textbox', { name: 'Name' }) + .fill('Đurđa Živković') + await next(page) + + await next(page) + await expect(page.getByText('Enter the company name')).toBeVisible() + await expectNoSidewaysScroll(page) + await page.getByLabel('Company name').fill('Petrović d.o.o.') + await page.getByLabel('Street and number').fill('Knez Mihailova 1') + await page.getByLabel('City').fill('Belgrade') + await page.getByLabel('ZIP code').fill('11000') + await page.getByLabel('Country').selectOption('Serbia') + await next(page) + + await expect(currentStep(page)).toHaveText(/Confirm/) + await page.getByRole('button', { name: 'Register' }).click() + await expect( + page.getByText('Please accept the code of conduct'), + ).toBeVisible() + await expectNoSidewaysScroll(page) + await page + .getByRole('checkbox', { name: 'I accept the code of conduct' }) + .check() + await page.getByRole('button', { name: 'Register' }).click() + await expect( + page.getByRole('heading', { name: "You're registered" }), + ).toBeVisible() + await expectNoSidewaysScroll(page) + }) + }) +} From f66660bf177f3b6758ac4d8154ba9b9cd23d5e88 Mon Sep 17 00:00:00 2001 From: Whatsaaaa Date: Fri, 13 Nov 2026 19:18:03 +0100 Subject: [PATCH 04/10] Say in the README that the apps take their look from the design system --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 5f8bbd4..2da3d1f 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # form-builder-sample -Two small apps built with [form-builder](https://whatsaaaa.github.io/form-builder/) `1.0.0-rc.0`, using only what a new user has: the documentation site and the packages on npm. The repository is the release-candidate trial for form-builder 1.0: it shows that real forms can be built from the public material, and records every problem met on the way. +Two small apps built with [form-builder](https://whatsaaaa.github.io/form-builder/) `1.0.0-rc.0`, using only what a new user has: the documentation site and the packages on npm. The repository is the release-candidate trial for form-builder 1.0: it shows that real forms can be built from the public material, and records every problem met on the way. The apps take their look from the [Whatsaaaa design system](https://github.com/whatsaaaa/design-system), installed from npm as `@whatsaaaa/design-system` like any other package: the Vue app now, the React app once its own restyle lands. **The record of the trial is [FRICTION-LOG.md](FRICTION-LOG.md).** Start there if you work on form-builder. @@ -11,9 +11,9 @@ Two small apps built with [form-builder](https://whatsaaaa.github.io/form-builde | [`vue-event-registration`](vue-event-registration) | A multi-step event registration in Vue | Steps, rows, a section and a slot, conditional fields and a conditional step, a repeating guest list, form rules, a definition loaded from a JSON file | | [`react-checkout`](react-checkout) | A checkout in React, with a small server | A definition served by the server and validated again there, messages in English and German, a repeating list of items, conditional fields, server errors shown on the fields | -Each app is self-contained: its own `package.json`, lockfile and tooling. Both need Node 20.19 or later and pnpm 11. +Each app is self-contained: its own `package.json`, lockfile and tooling. Both need pnpm 11. The Vue app needs Node 22.18 or a later 22, or Node 24.12 or later, as the design system does. The React app needs Node 20.19 or later. -Both look plain on purpose. Everything visual lives in each app's `src/ui` folder (field, layout and page components) and its one stylesheet, `src/styles.css`, so a later restyle swaps those and leaves the forms alone. +Everything visual lives in each app's `src/ui` folder (field, layout and page components) and its one stylesheet, `src/styles.css`, so a restyle swaps those and leaves the forms alone. The Vue app is restyled on the design system: its page is the system's terminal frame, with a tab bar, a status line that switches the theme and the shortcut keys, and a dark and a light theme. The React app still looks plain until its own restyle lands. ## Run the Vue app From e727bef082a862b36f2946a240cb825c4a0c3d65 Mon Sep 17 00:00:00 2001 From: Whatsaaaa Date: Fri, 13 Nov 2026 19:23:35 +0100 Subject: [PATCH 05/10] Match the date icon to the select arrow, and wrap long JSON lines The date picker's icon is drawn like the select's arrow: in the theme's secondary text color, on the same edge. A long line of the submitted JSON, such as a typed note, wraps inside the code block and hangs under its own text, instead of running out of the block on a phone. --- vue-event-registration/src/styles.css | 30 ++++++++++++++++++++- vue-event-registration/src/ui/CodeBlock.vue | 16 ++++++++--- 2 files changed, 42 insertions(+), 4 deletions(-) diff --git a/vue-event-registration/src/styles.css b/vue-event-registration/src/styles.css index c6ca9c0..e44a055 100644 --- a/vue-event-registration/src/styles.css +++ b/vue-event-registration/src/styles.css @@ -17,6 +17,8 @@ --control-height: var(--ws-space-40); /* A tick, drawn as a mask like the design system's icons: only its shape counts. It fills its box. */ --icon-check: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='2 2 12 12' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 8.5 6.5 12 13 4.5'/%3E%3C/svg%3E"); + /* A calendar for the date picker's button, the same way. */ + --icon-calendar: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='1.5 1.25 13 13' fill='none' stroke='black' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='2.5' y='3.5' width='11' height='10' rx='1.5'/%3E%3Cpath d='M2.5 6.5h11M5.5 2v3M10.5 2v3'/%3E%3C/svg%3E"); } @media (width < 64rem) { @@ -346,6 +348,17 @@ body { border-color: var(--ws-color-text-secondary); } +/* The date picker's button, drawn like the select's arrow: in the system's color, on the field's padding. */ +.input::-webkit-calendar-picker-indicator { + width: var(--ws-space-16); + height: var(--ws-space-16); + margin: 0; + padding: 0; + cursor: pointer; + background: var(--ws-color-text-secondary); + mask: var(--icon-calendar) center / contain no-repeat; +} + .input--multiline { height: auto; min-height: var(--control-height); @@ -368,7 +381,7 @@ body { .select::after { position: absolute; top: 50%; - right: var(--ws-space-12); + right: calc(var(--ws-space-12) + var(--ws-border-width-thin)); width: var(--ws-space-12); height: var(--ws-space-12); content: ''; @@ -710,6 +723,21 @@ body { margin: 0; } +/* + * What a person typed can be long. Its line wraps inside the block, and the rest of it starts one + * level in from the line's own text, so the shape of the JSON still reads. + */ +.code { + white-space: pre-wrap; + overflow-wrap: anywhere; +} + +.code__line { + display: block; + padding-left: calc(var(--hang) * 1ch); + text-indent: calc(var(--hang) * -1ch); +} + @media (width < 64rem) { .notice__title { font: var(--ws-text-h2-compact); diff --git a/vue-event-registration/src/ui/CodeBlock.vue b/vue-event-registration/src/ui/CodeBlock.vue index 44caf7c..87c1fa3 100644 --- a/vue-event-registration/src/ui/CodeBlock.vue +++ b/vue-event-registration/src/ui/CodeBlock.vue @@ -12,7 +12,16 @@ const props = defineProps<{ // The attributes of the block, like a test id, go to its code, so they are on the text alone. defineOptions({ inheritAttrs: false }) -const lines = computed(() => highlightJson(props.code)) +/** + * The lines, each with the column its wrapped rest starts at: one level in from its own text, + * so a long value wraps inside the block instead of running out of it. + */ +const lines = computed(() => + highlightJson(props.code).map((tokens) => { + const text = tokens.map((token) => token.content).join('') + return { tokens, hang: text.length - text.trimStart().length + 2 } + }), +) From 9e2b8f3681b21298f0ba10791ecea3bbc596cb43 Mon Sep 17 00:00:00 2001 From: Whatsaaaa Date: Fri, 13 Nov 2026 19:41:31 +0100 Subject: [PATCH 06/10] no-mistakes(review): Check the window frame for sideways overflow too --- vue-event-registration/e2e/registration.spec.ts | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/vue-event-registration/e2e/registration.spec.ts b/vue-event-registration/e2e/registration.spec.ts index 27c97e8..6102dde 100644 --- a/vue-event-registration/e2e/registration.spec.ts +++ b/vue-event-registration/e2e/registration.spec.ts @@ -15,14 +15,17 @@ async function next(page: Page) { await page.getByRole('button', { name: 'Next' }).click() } -/** Fails when the page scrolls sideways: something is wider than the screen. */ +/** + * Fails when something is wider than the screen: the page scrolls sideways, or the window frame + * clips it or scrolls it sideways in its main area. + */ async function expectNoSidewaysScroll(page: Page) { - const overflow = await page.evaluate( - () => - document.documentElement.scrollWidth - - document.documentElement.clientWidth, - ) - expect(overflow).toBeLessThanOrEqual(0) + for (const selector of ['html', '.page', '.page__main']) { + const overflow = await page + .locator(selector) + .evaluate((element) => element.scrollWidth - element.clientWidth) + expect(overflow, `${selector} is wider than its box`).toBeLessThanOrEqual(0) + } } async function fillAboutYou( From e2859fea21e6f50099807803344a3d529b00dc9e Mon Sep 17 00:00:00 2001 From: Whatsaaaa Date: Fri, 13 Nov 2026 19:55:23 +0100 Subject: [PATCH 07/10] no-mistakes(review): Keep checked boxes and marks visible in forced colors --- vue-event-registration/src/styles.css | 38 +++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/vue-event-registration/src/styles.css b/vue-event-registration/src/styles.css index e44a055..c59baff 100644 --- a/vue-event-registration/src/styles.css +++ b/vue-event-registration/src/styles.css @@ -744,3 +744,41 @@ body { letter-spacing: var(--ws-text-h2-compact-letter-spacing); } } + +/* + * In forced colors the browser paints every background in the page's own color, and with it the + * marks drawn as a mask on one. Here they take the system's colors: a checked box and the current + * step as a selection, every other mark in the color of the text it stands with. The current + * step's number keeps its colors as they are, as the page's color behind its text would hide it. + */ +@media (forced-colors: active) { + .choice__input:checked, + .steps__item--current .steps__number { + border-color: Highlight; + color: HighlightText; + background: Highlight; + } + + .steps__item--current .steps__number { + forced-color-adjust: none; + } + + .choice__input:checked::before { + background: HighlightText; + } + + .steps__item--done .steps__number::before { + background: ButtonText; + } + + .input::-webkit-calendar-picker-indicator, + .select::after { + background: FieldText; + } + + .field__error::before, + .notice__title::before, + .notice--error .notice__title::before { + background: CanvasText; + } +} From 27653b05389e42874c9f5ad0cd899ef47a6860ec Mon Sep 17 00:00:00 2001 From: Whatsaaaa Date: Fri, 13 Nov 2026 20:09:10 +0100 Subject: [PATCH 08/10] no-mistakes(review): Keep the status line's switches whole at 320 px --- .../e2e/registration.spec.ts | 180 ++++++++++-------- vue-event-registration/src/styles.css | 13 ++ 2 files changed, 112 insertions(+), 81 deletions(-) diff --git a/vue-event-registration/e2e/registration.spec.ts b/vue-event-registration/e2e/registration.spec.ts index 6102dde..3b7dd4f 100644 --- a/vue-event-registration/e2e/registration.spec.ts +++ b/vue-event-registration/e2e/registration.spec.ts @@ -16,15 +16,23 @@ async function next(page: Page) { } /** - * Fails when something is wider than the screen: the page scrolls sideways, or the window frame - * clips it or scrolls it sideways in its main area. + * Fails when something is wider than the screen: the page scrolls sideways, or a part of the + * window frame clips it or scrolls it sideways: the window, its main area, its status line, or a + * code block on show. */ async function expectNoSidewaysScroll(page: Page) { - for (const selector of ['html', '.page', '.page__main']) { - const overflow = await page - .locator(selector) - .evaluate((element) => element.scrollWidth - element.clientWidth) - expect(overflow, `${selector} is wider than its box`).toBeLessThanOrEqual(0) + const boxes = [ + page.locator('html'), + page.locator('.page'), + page.locator('.page__main'), + page.locator('.ws-status-line'), + ...(await page.locator('.ws-code, .ws-code > pre').all()), + ] + for (const box of boxes) { + const overflow = await box.evaluate( + (element) => element.scrollWidth - element.clientWidth, + ) + expect(overflow, `${box} is wider than its box`).toBeLessThanOrEqual(0) } } @@ -310,79 +318,89 @@ test('moves with Enter and with the step indicator', async ({ page }) => { await expect(page.getByText('Enter the company name')).toBeVisible() }) -for (const colorScheme of ['dark', 'light'] as const) { - test.describe(`on a 390 px screen, in the ${colorScheme} theme`, () => { - test.use({ viewport: { width: 390, height: 844 }, colorScheme }) - - test('fits the screen at every step, with its errors', async ({ page }) => { - // The page follows the system's theme, and names it in the status line. - const name = colorScheme === 'dark' ? 'rose-pine' : 'rose-pine-dawn' - await expect( - page.getByRole('button', { - name: `Switch theme, now ${name}`, - exact: true, - }), - ).toBeVisible() - - await next(page) - await expect(page.getByText('Enter your first name')).toBeVisible() - await expectNoSidewaysScroll(page) - await fillAboutYou(page, 'Business') - await page - .getByRole('textbox', { name: 'Phone' }) - .fill('+381 61 234 5678') - await next(page) - - await next(page) - await expect(page.getByText('Pick at least one session')).toBeVisible() - await expectNoSidewaysScroll(page) - await page - .getByRole('checkbox', { name: 'Hands-on forms workshop' }) - .check() - await page.getByLabel('Workshop level').selectOption('Advanced') - await page - .getByRole('checkbox', { name: 'I have access or dietary needs' }) - .check() - await page - .getByLabel('What do you need?') - .fill('Pristup bez stepenica, i čaj bez šećera za večeru.') - await expectNoSidewaysScroll(page) - await next(page) - - await page.getByRole('button', { name: 'Add guest' }).click() - await next(page) - await expect(page.getByText("Enter the guest's name")).toBeVisible() - await expectNoSidewaysScroll(page) - await page - .getByRole('region', { name: 'Guest 1' }) - .getByRole('textbox', { name: 'Name' }) - .fill('Đurđa Živković') - await next(page) - - await next(page) - await expect(page.getByText('Enter the company name')).toBeVisible() - await expectNoSidewaysScroll(page) - await page.getByLabel('Company name').fill('Petrović d.o.o.') - await page.getByLabel('Street and number').fill('Knez Mihailova 1') - await page.getByLabel('City').fill('Belgrade') - await page.getByLabel('ZIP code').fill('11000') - await page.getByLabel('Country').selectOption('Serbia') - await next(page) - - await expect(currentStep(page)).toHaveText(/Confirm/) - await page.getByRole('button', { name: 'Register' }).click() - await expect( - page.getByText('Please accept the code of conduct'), - ).toBeVisible() - await expectNoSidewaysScroll(page) - await page - .getByRole('checkbox', { name: 'I accept the code of conduct' }) - .check() - await page.getByRole('button', { name: 'Register' }).click() - await expect( - page.getByRole('heading', { name: "You're registered" }), - ).toBeVisible() - await expectNoSidewaysScroll(page) +// 320 px is the width the content must reflow to (WCAG 1.4.10), and 390 px a common phone. +for (const width of [320, 390]) { + for (const colorScheme of ['dark', 'light'] as const) { + test.describe(`on a ${width} px screen, in the ${colorScheme} theme`, () => { + test.use({ viewport: { width, height: 844 }, colorScheme }) + + test('fits the screen at every step, with its errors', async ({ + page, + }) => { + // The page follows the system's theme, and names it in the status line. + const name = colorScheme === 'dark' ? 'rose-pine' : 'rose-pine-dawn' + await expect( + page.getByRole('button', { + name: `Switch theme, now ${name}`, + exact: true, + }), + ).toBeVisible() + + await next(page) + await expect(page.getByText('Enter your first name')).toBeVisible() + await expectNoSidewaysScroll(page) + // The keys switch is a letter wider off than on, and the status line still holds it. + const keys = page.getByRole('switch', { name: 'Shortcut keys' }) + await keys.click() + await expect(keys).toHaveText(/keys\s*off/, { useInnerText: true }) + await expectNoSidewaysScroll(page) + await fillAboutYou(page, 'Business') + await page + .getByRole('textbox', { name: 'Phone' }) + .fill('+381 61 234 5678') + await next(page) + + await next(page) + await expect(page.getByText('Pick at least one session')).toBeVisible() + await expectNoSidewaysScroll(page) + await page + .getByRole('checkbox', { name: 'Hands-on forms workshop' }) + .check() + await page.getByLabel('Workshop level').selectOption('Advanced') + await page + .getByRole('checkbox', { name: 'I have access or dietary needs' }) + .check() + await page + .getByLabel('What do you need?') + .fill('Pristup bez stepenica, i čaj bez šećera za večeru.') + await expectNoSidewaysScroll(page) + await next(page) + + await page.getByRole('button', { name: 'Add guest' }).click() + await next(page) + await expect(page.getByText("Enter the guest's name")).toBeVisible() + await expectNoSidewaysScroll(page) + await page + .getByRole('region', { name: 'Guest 1' }) + .getByRole('textbox', { name: 'Name' }) + .fill('Đurđa Živković') + await next(page) + + await next(page) + await expect(page.getByText('Enter the company name')).toBeVisible() + await expectNoSidewaysScroll(page) + await page.getByLabel('Company name').fill('Petrović d.o.o.') + await page.getByLabel('Street and number').fill('Knez Mihailova 1') + await page.getByLabel('City').fill('Belgrade') + await page.getByLabel('ZIP code').fill('11000') + await page.getByLabel('Country').selectOption('Serbia') + await next(page) + + await expect(currentStep(page)).toHaveText(/Confirm/) + await page.getByRole('button', { name: 'Register' }).click() + await expect( + page.getByText('Please accept the code of conduct'), + ).toBeVisible() + await expectNoSidewaysScroll(page) + await page + .getByRole('checkbox', { name: 'I accept the code of conduct' }) + .check() + await page.getByRole('button', { name: 'Register' }).click() + await expect( + page.getByRole('heading', { name: "You're registered" }), + ).toBeVisible() + await expectNoSidewaysScroll(page) + }) }) - }) + } } diff --git a/vue-event-registration/src/styles.css b/vue-event-registration/src/styles.css index c59baff..b3a7f2c 100644 --- a/vue-event-registration/src/styles.css +++ b/vue-event-registration/src/styles.css @@ -124,6 +124,19 @@ body { /* Status line */ +/* + * The path is what gives way on a narrow screen, so the switches after it always fit: it shrinks + * to its ellipsis, and then out of sight with its padding. + */ +.ws-status-line__file { + padding-inline: 0; + overflow: hidden; +} + +.ws-status-line__file > span { + padding-inline: var(--ws-space-14); +} + .status-line__theme { margin: 0; border-block: 0; From 3faafe0bae750dd10cfaa6755c789beaf7cbf5e7 Mon Sep 17 00:00:00 2001 From: Whatsaaaa Date: Fri, 13 Nov 2026 20:27:11 +0100 Subject: [PATCH 09/10] no-mistakes(review): Show the status line path whole or not at all --- vue-event-registration/e2e/frame.spec.ts | 79 ++++++++++++++++++++ vue-event-registration/src/styles.css | 19 +++-- vue-event-registration/src/ui/StatusLine.vue | 10 ++- 3 files changed, 97 insertions(+), 11 deletions(-) diff --git a/vue-event-registration/e2e/frame.spec.ts b/vue-event-registration/e2e/frame.spec.ts index c836416..4032fbf 100644 --- a/vue-event-registration/e2e/frame.spec.ts +++ b/vue-event-registration/e2e/frame.spec.ts @@ -12,6 +12,59 @@ function keysSwitch(page: Page) { return page.getByRole('switch', { name: 'Shortcut keys' }) } +/** + * Fails when the status line cuts what it holds. It fits in the line, and its path shows whole or + * not at all: when it shows, "~…" fits in its text box, and the text has as much room before the + * keys switch as after the mode. + */ +async function expectStatusLineWhole(page: Page) { + const line = await page.locator('.ws-status-line').evaluate((line) => { + const find = (selector: string) => { + const element = line.querySelector(selector) + if (!element) throw new Error(`The status line has no ${selector}`) + return element + } + const path = find('.ws-status-line__file') + if (!path.checkVisibility()) { + return { overflow: line.scrollWidth - line.clientWidth, path: undefined } + } + const text = find('.ws-status-line__file > span') + const style = getComputedStyle(text) + const box = text.getBoundingClientRect() + const left = box.left + parseFloat(style.paddingLeft) + const right = box.right - parseFloat(style.paddingRight) + const probe = document.createElement('span') + probe.style.position = 'absolute' + probe.style.font = style.font + probe.textContent = '~…' + document.body.append(probe) + const shortest = probe.getBoundingClientRect().width + probe.remove() + return { + overflow: line.scrollWidth - line.clientWidth, + path: { + text: right - left, + shortest, + before: + left - find('.ws-status-line__mode').getBoundingClientRect().right, + after: + find('.ws-status-line__switch').getBoundingClientRect().left - right, + }, + } + }) + expect(line.overflow, 'the status line cuts its end').toBeLessThanOrEqual(0) + if (line.path) { + expect(line.path.text, 'the path shows a cut glyph').toBeGreaterThanOrEqual( + line.path.shortest, + ) + expect( + line.path.after, + 'the path runs into the keys switch', + ).toBeGreaterThanOrEqual(line.path.before) + } + return line.path !== undefined +} + /** The color of the page behind the window: it changes with the theme. */ function pageColor(page: Page) { return page.evaluate(() => getComputedStyle(document.body).backgroundColor) @@ -114,3 +167,29 @@ test.describe('on a dark system', () => { await expect(html).toHaveAttribute('data-theme', 'light') }) }) + +for (const colorScheme of ['dark', 'light'] as const) { + test.describe(`in the ${colorScheme} theme`, () => { + test.use({ colorScheme }) + + // From the width the content must reflow to (WCAG 1.4.10) up, with each width of the switch. + test('keeps the status line whole on a narrow screen', async ({ page }) => { + let shown = 0 + for (const keys of ['on', 'off']) { + if (keys === 'off') await keysSwitch(page).click() + await expect(keysSwitch(page)).toHaveText( + new RegExp(`keys\\s*${keys}`), + { + useInnerText: true, + }, + ) + for (let width = 320; width <= 400; width += 2) { + await page.setViewportSize({ width, height: 700 }) + if (await expectStatusLineWhole(page)) shown++ + } + } + // The path gives way only when it must. + expect(shown).toBeGreaterThan(0) + }) + }) +} diff --git a/vue-event-registration/src/styles.css b/vue-event-registration/src/styles.css index b3a7f2c..409ba14 100644 --- a/vue-event-registration/src/styles.css +++ b/vue-event-registration/src/styles.css @@ -125,16 +125,21 @@ body { /* Status line */ /* - * The path is what gives way on a narrow screen, so the switches after it always fit: it shrinks - * to its ellipsis, and then out of sight with its padding. + * The path is what gives way on a narrow screen, so the switches after it always fit. Its box + * takes the room left in the line, as the spacer would: the path shrinks to its ellipsis in it, + * and goes as a whole once "~…" no longer fits inside its padding. The padding is the path's own + * --ws-space-14 on each side, as a container query takes no var(). */ -.ws-status-line__file { - padding-inline: 0; - overflow: hidden; +.status-line__path { + display: flex; + flex: 1; + container-type: inline-size; } -.ws-status-line__file > span { - padding-inline: var(--ws-space-14); +@container (width < calc(2ch + 2 * 0.875rem)) { + .ws-status-line__file { + display: none; + } } .status-line__theme { diff --git a/vue-event-registration/src/ui/StatusLine.vue b/vue-event-registration/src/ui/StatusLine.vue index 9da6cee..7de0e4a 100644 --- a/vue-event-registration/src/ui/StatusLine.vue +++ b/vue-event-registration/src/ui/StatusLine.vue @@ -30,10 +30,12 @@ onUnmounted(() => {