From 39df173454f773d0cabf3c54150eda25abd9419d Mon Sep 17 00:00:00 2001 From: Lee Willis Date: Mon, 18 Nov 2024 12:18:49 +0000 Subject: [PATCH] Import v1.1.0 --- CHANGELOG.md | 10 + package-lock.json | 247 +++++++------- .../dist/build/assets/supersonic-e058825b.js | 1 + resources/dist/build/manifest.json | 2 +- .../js/components/supersonic-key-listener.vue | 5 + src/Controllers/ActionInfoController.php | 302 ++++++++++++++++-- 6 files changed, 432 insertions(+), 135 deletions(-) create mode 100644 CHANGELOG.md create mode 100644 resources/dist/build/assets/supersonic-e058825b.js diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..198efdb --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,10 @@ +# 1.1.0 + +- [new] Add palette actions to swap the currently active site +- [new] Add palette actions for blueprints +- [fix] Use localised strings, not always EN +- [new] Clicking outside the modal closes it + +# 1.0.0 + +- Initial public release diff --git a/package-lock.json b/package-lock.json index ab32a5b..81e4e09 100644 --- a/package-lock.json +++ b/package-lock.json @@ -4,6 +4,7 @@ "requires": true, "packages": { "": { + "name": "supersonic", "dependencies": { "lodash.debounce": "^4.0.8", "lodash.throttle": "^4.1.1", @@ -1113,9 +1114,9 @@ } }, "node_modules/cross-spawn": { - "version": "7.0.3", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", - "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", + "version": "7.0.5", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.5.tgz", + "integrity": "sha512-ZVJrKKYunU38/76t0RMOulHOnUcbU9GbpWKAOZ0mhjr7CX6FVrH+4FrAapSOekrgFQ3f/8gwMEuIft0aKq6Hug==", "license": "MIT", "dependencies": { "path-key": "^3.1.0", @@ -1369,9 +1370,9 @@ } }, "node_modules/immutable": { - "version": "4.3.7", - "resolved": "https://registry.npmjs.org/immutable/-/immutable-4.3.7.tgz", - "integrity": "sha512-1hqclzwYwjRDFLjcFxOM5AYkkG0rpFPpr1RLPMEuGczoS7YA8gLhy8SWXYRAA/XwfEHpfo3cw5JGioS32fnMRw==", + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/immutable/-/immutable-5.0.2.tgz", + "integrity": "sha512-1NU7hWZDkV7hJ4PJ9dur9gTNQ4ePNPN4k9/0YhwjzykTi/+3Q5pF93YU5QoVj8BuOnhLgaY8gs0U2pj4kSYVcw==", "license": "MIT" }, "node_modules/is-binary-path": { @@ -1726,9 +1727,9 @@ } }, "node_modules/postcss": { - "version": "8.4.47", - "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.47.tgz", - "integrity": "sha512-56rxCq7G/XfB4EkXq9Egn5GCqugWvDFjafDOThIdMBsI15iqPqR5r15TfSr1YPYeEI19YeaXMCbY6u88Y76GLQ==", + "version": "8.4.49", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.49.tgz", + "integrity": "sha512-OCVPnIObs4N29kxTjzLfUryOkvZEq+pf8jTF0lg8E7uETuWHA+v7j3c/xJmiqpX450191LlmZfUKkXxkTry7nA==", "funding": [ { "type": "opencollective", @@ -1746,7 +1747,7 @@ "license": "MIT", "dependencies": { "nanoid": "^3.3.7", - "picocolors": "^1.1.0", + "picocolors": "^1.1.1", "source-map-js": "^1.2.1" }, "engines": { @@ -2016,13 +2017,13 @@ } }, "node_modules/sass": { - "version": "1.80.6", - "resolved": "https://registry.npmjs.org/sass/-/sass-1.80.6.tgz", - "integrity": "sha512-ccZgdHNiBF1NHBsWvacvT5rju3y1d/Eu+8Ex6c21nHp2lZGLBEtuwc415QfiI1PJa1TpCo3iXwwSRjRpn2Ckjg==", + "version": "1.81.0", + "resolved": "https://registry.npmjs.org/sass/-/sass-1.81.0.tgz", + "integrity": "sha512-Q4fOxRfhmv3sqCLoGfvrC9pRV8btc0UtqL9mN6Yrv6Qi9ScL55CVH1vlPP863ISLEEMNLLuu9P+enCeGHlnzhA==", "license": "MIT", "dependencies": { "chokidar": "^4.0.0", - "immutable": "^4.0.0", + "immutable": "^5.0.2", "source-map-js": ">=0.6.2 <2.0.0" }, "bin": { @@ -2036,17 +2037,18 @@ } }, "node_modules/sass-embedded": { - "version": "1.80.6", - "resolved": "https://registry.npmjs.org/sass-embedded/-/sass-embedded-1.80.6.tgz", - "integrity": "sha512-Og4aqBnaA3oJfIpHaLuNATAqzBRgUJDYJy2X15V59cot2wYOtiT/ciPnyuq1o7vpDEeOkHhEd+mSviSlXoETug==", + "version": "1.81.0", + "resolved": "https://registry.npmjs.org/sass-embedded/-/sass-embedded-1.81.0.tgz", + "integrity": "sha512-uZQ2Faxb1oWBHpeSSzjxnhClbMb3QadN0ql0ZFNuqWOLUxwaVhrMlMhPq6TDPbbfDUjihuwrMCuy695Bgna5RA==", "license": "MIT", "dependencies": { "@bufbuild/protobuf": "^2.0.0", "buffer-builder": "^0.2.0", "colorjs.io": "^0.5.0", - "immutable": "^4.0.0", + "immutable": "^5.0.2", "rxjs": "^7.4.0", "supports-color": "^8.1.1", + "sync-child-process": "^1.0.2", "varint": "^6.0.0" }, "bin": { @@ -2056,32 +2058,32 @@ "node": ">=16.0.0" }, "optionalDependencies": { - "sass-embedded-android-arm": "1.80.6", - "sass-embedded-android-arm64": "1.80.6", - "sass-embedded-android-ia32": "1.80.6", - "sass-embedded-android-riscv64": "1.80.6", - "sass-embedded-android-x64": "1.80.6", - "sass-embedded-darwin-arm64": "1.80.6", - "sass-embedded-darwin-x64": "1.80.6", - "sass-embedded-linux-arm": "1.80.6", - "sass-embedded-linux-arm64": "1.80.6", - "sass-embedded-linux-ia32": "1.80.6", - "sass-embedded-linux-musl-arm": "1.80.6", - "sass-embedded-linux-musl-arm64": "1.80.6", - "sass-embedded-linux-musl-ia32": "1.80.6", - "sass-embedded-linux-musl-riscv64": "1.80.6", - "sass-embedded-linux-musl-x64": "1.80.6", - "sass-embedded-linux-riscv64": "1.80.6", - "sass-embedded-linux-x64": "1.80.6", - "sass-embedded-win32-arm64": "1.80.6", - "sass-embedded-win32-ia32": "1.80.6", - "sass-embedded-win32-x64": "1.80.6" + "sass-embedded-android-arm": "1.81.0", + "sass-embedded-android-arm64": "1.81.0", + "sass-embedded-android-ia32": "1.81.0", + "sass-embedded-android-riscv64": "1.81.0", + "sass-embedded-android-x64": "1.81.0", + "sass-embedded-darwin-arm64": "1.81.0", + "sass-embedded-darwin-x64": "1.81.0", + "sass-embedded-linux-arm": "1.81.0", + "sass-embedded-linux-arm64": "1.81.0", + "sass-embedded-linux-ia32": "1.81.0", + "sass-embedded-linux-musl-arm": "1.81.0", + "sass-embedded-linux-musl-arm64": "1.81.0", + "sass-embedded-linux-musl-ia32": "1.81.0", + "sass-embedded-linux-musl-riscv64": "1.81.0", + "sass-embedded-linux-musl-x64": "1.81.0", + "sass-embedded-linux-riscv64": "1.81.0", + "sass-embedded-linux-x64": "1.81.0", + "sass-embedded-win32-arm64": "1.81.0", + "sass-embedded-win32-ia32": "1.81.0", + "sass-embedded-win32-x64": "1.81.0" } }, "node_modules/sass-embedded-android-arm": { - "version": "1.80.6", - "resolved": "https://registry.npmjs.org/sass-embedded-android-arm/-/sass-embedded-android-arm-1.80.6.tgz", - "integrity": "sha512-UeUKMTRsnz4/dh7IzvhjONxa4/jmVp539CHDd8VZOsqg9M3HcNJNIkUzQWbuwZ+nSlWrTuo7Tvn3XlypopCBzw==", + "version": "1.81.0", + "resolved": "https://registry.npmjs.org/sass-embedded-android-arm/-/sass-embedded-android-arm-1.81.0.tgz", + "integrity": "sha512-NWEmIuaIEsGFNsIRa+5JpIpPJyZ32H15E85CNZqEIhhwWlk9UNw7vlOCmTH8MtabtnACwC/2NG8VyNa3nxKzUQ==", "cpu": [ "arm" ], @@ -2095,9 +2097,9 @@ } }, "node_modules/sass-embedded-android-arm64": { - "version": "1.80.6", - "resolved": "https://registry.npmjs.org/sass-embedded-android-arm64/-/sass-embedded-android-arm64-1.80.6.tgz", - "integrity": "sha512-4rC4ZGM/k4ENVjLXnK3JTst8e8FI9MHSol2Fl7dCdYyJ3KLnlt4qL4AEYfU8zq1tcBb7CBOSZVR+CzCKubnXdg==", + "version": "1.81.0", + "resolved": "https://registry.npmjs.org/sass-embedded-android-arm64/-/sass-embedded-android-arm64-1.81.0.tgz", + "integrity": "sha512-I36P77/PKAHx6sqOmexO2iEY5kpsmQ1VxcgITZSOxPMQhdB6m4t3bTabfDuWQQmCrqqiNFtLQHeytB65bUqwiw==", "cpu": [ "arm64" ], @@ -2111,9 +2113,9 @@ } }, "node_modules/sass-embedded-android-ia32": { - "version": "1.80.6", - "resolved": "https://registry.npmjs.org/sass-embedded-android-ia32/-/sass-embedded-android-ia32-1.80.6.tgz", - "integrity": "sha512-Lxz2SXE2KdHnynuHF+D6flDvrd55/zaEAWUeka9MxEr6FmR66d8UBOIy5ETwCSUd//S/SE5Jl6oTnHppgD1zNA==", + "version": "1.81.0", + "resolved": "https://registry.npmjs.org/sass-embedded-android-ia32/-/sass-embedded-android-ia32-1.81.0.tgz", + "integrity": "sha512-k8V1usXw30w1GVxvrteG1RzgYJzYQ9PfL2aeOqGdroBN7zYTD9VGJXTGcxA4IeeRxmRd7szVW2mKXXS472fh8g==", "cpu": [ "ia32" ], @@ -2127,9 +2129,9 @@ } }, "node_modules/sass-embedded-android-riscv64": { - "version": "1.80.6", - "resolved": "https://registry.npmjs.org/sass-embedded-android-riscv64/-/sass-embedded-android-riscv64-1.80.6.tgz", - "integrity": "sha512-hKdxY/oOqB+JJhSoBTDM5DJO1j/xtxQgayh2cLCCUx37IQQe3SEdc3V2JFf/4mIo5peaS4cjqwwSATF+l2zaXg==", + "version": "1.81.0", + "resolved": "https://registry.npmjs.org/sass-embedded-android-riscv64/-/sass-embedded-android-riscv64-1.81.0.tgz", + "integrity": "sha512-RXlanyLXEpN/DEehXgLuKPsqT//GYlsGFxKXgRiCc8hIPAueFLQXKJmLWlL3BEtHgmFdbsStIu4aZCcb1hOFlQ==", "cpu": [ "riscv64" ], @@ -2143,9 +2145,9 @@ } }, "node_modules/sass-embedded-android-x64": { - "version": "1.80.6", - "resolved": "https://registry.npmjs.org/sass-embedded-android-x64/-/sass-embedded-android-x64-1.80.6.tgz", - "integrity": "sha512-Eap2Fi3kTx/rVLBsOnOp5RYPr5+lFjTZ652zR24dmYFe9/sDgasakJIOPjOvD2bRuL9z0uWEY1AXVeeOPeZKrg==", + "version": "1.81.0", + "resolved": "https://registry.npmjs.org/sass-embedded-android-x64/-/sass-embedded-android-x64-1.81.0.tgz", + "integrity": "sha512-RQG0FxGQ1DERNyUDED8+BDVaLIjI+BNg8lVcyqlLZUrWY6NhzjwYEeiN/DNZmMmHtqDucAPNDcsdVUNQqsBy2A==", "cpu": [ "x64" ], @@ -2159,9 +2161,9 @@ } }, "node_modules/sass-embedded-darwin-arm64": { - "version": "1.80.6", - "resolved": "https://registry.npmjs.org/sass-embedded-darwin-arm64/-/sass-embedded-darwin-arm64-1.80.6.tgz", - "integrity": "sha512-0mnAx8Vq6Gxj3PQt3imgITfK33hhqrSKpyHSuab71gZZni5opsdtoggq2JawW+1taRFTEZwbZJLKZ0MBDbwCCA==", + "version": "1.81.0", + "resolved": "https://registry.npmjs.org/sass-embedded-darwin-arm64/-/sass-embedded-darwin-arm64-1.81.0.tgz", + "integrity": "sha512-gLKbsfII9Ppua76N41ODFnKGutla9qv0OGAas8gxe0jYBeAQFi/1iKQYdNtQtKi4mA9n5TQTqz+HHCKszZCoyA==", "cpu": [ "arm64" ], @@ -2175,9 +2177,9 @@ } }, "node_modules/sass-embedded-darwin-x64": { - "version": "1.80.6", - "resolved": "https://registry.npmjs.org/sass-embedded-darwin-x64/-/sass-embedded-darwin-x64-1.80.6.tgz", - "integrity": "sha512-Ib20yNZFOrJ7YVT+ltoe+JQNKPcRclM3iLAK69XZZYcSeFM/72SCoQBAaVGIpT23dxDp7FXiE4lO602c3xTRwQ==", + "version": "1.81.0", + "resolved": "https://registry.npmjs.org/sass-embedded-darwin-x64/-/sass-embedded-darwin-x64-1.81.0.tgz", + "integrity": "sha512-7uMOlT9hD2KUJCbTN2XcfghDxt/rc50ujjfSjSHjX1SYj7mGplkINUXvVbbvvaV2wt6t9vkGkCo5qNbeBhfwBg==", "cpu": [ "x64" ], @@ -2191,9 +2193,9 @@ } }, "node_modules/sass-embedded-linux-arm": { - "version": "1.80.6", - "resolved": "https://registry.npmjs.org/sass-embedded-linux-arm/-/sass-embedded-linux-arm-1.80.6.tgz", - "integrity": "sha512-QR0Q6TZox/ThuU2r9c0s3fKCgU2rXAEocpitdgxFp6tta+GsQlMFV3oON2unAa8Bwnuxkmf0YOaK0Oy/TwzkXw==", + "version": "1.81.0", + "resolved": "https://registry.npmjs.org/sass-embedded-linux-arm/-/sass-embedded-linux-arm-1.81.0.tgz", + "integrity": "sha512-REqR9qM4RchCE3cKqzRy9Q4zigIV82SbSpCi/O4O3oK3pg2I1z7vkb3TiJsivusG/li7aqKZGmYOtAXjruGQDA==", "cpu": [ "arm" ], @@ -2207,9 +2209,9 @@ } }, "node_modules/sass-embedded-linux-arm64": { - "version": "1.80.6", - "resolved": "https://registry.npmjs.org/sass-embedded-linux-arm64/-/sass-embedded-linux-arm64-1.80.6.tgz", - "integrity": "sha512-n5r98pBXawrQQKaxIYCMM1zDpnngsqxTkOrmvsYLFiAMCSbR0lWf/7sBB33k/Pm0D6dsbp3jpHilCoQNKI3jIw==", + "version": "1.81.0", + "resolved": "https://registry.npmjs.org/sass-embedded-linux-arm64/-/sass-embedded-linux-arm64-1.81.0.tgz", + "integrity": "sha512-jy4bvhdUmqbyw1jv1f3Uxl+MF8EU/Y/GDx4w6XPJm4Ds+mwH/TwnyAwsxxoBhWfnBnW8q2ADy039DlS5p+9csQ==", "cpu": [ "arm64" ], @@ -2223,9 +2225,9 @@ } }, "node_modules/sass-embedded-linux-ia32": { - "version": "1.80.6", - "resolved": "https://registry.npmjs.org/sass-embedded-linux-ia32/-/sass-embedded-linux-ia32-1.80.6.tgz", - "integrity": "sha512-O6dWZdcOkryRdDCxVMGOeVowgblpDgVcAuRtZ1F1X7XfbpDriTQm64D+9vVZIrywYSPoJfQMJJ662cr0wUs9IQ==", + "version": "1.81.0", + "resolved": "https://registry.npmjs.org/sass-embedded-linux-ia32/-/sass-embedded-linux-ia32-1.81.0.tgz", + "integrity": "sha512-ga/Jk4q5Bn1aC+iHJteDZuLSKnmBUiS3dEg1fnl/Z7GaHIChceKDJOw0zNaILRXI0qT2E1at9MwzoRaRA5Nn/g==", "cpu": [ "ia32" ], @@ -2239,9 +2241,9 @@ } }, "node_modules/sass-embedded-linux-musl-arm": { - "version": "1.80.6", - "resolved": "https://registry.npmjs.org/sass-embedded-linux-musl-arm/-/sass-embedded-linux-musl-arm-1.80.6.tgz", - "integrity": "sha512-X9FC8s8fvQGRiXc+eATlZ57N44Iq3nNa0M0ugi3ysdJwkaNYvOeS4QzBHKQAaw3QiTqdxTnLUHHVBkyzdCi9pw==", + "version": "1.81.0", + "resolved": "https://registry.npmjs.org/sass-embedded-linux-musl-arm/-/sass-embedded-linux-musl-arm-1.81.0.tgz", + "integrity": "sha512-oWVUvQ4d5Kx1Md75YXZl5z1WBjc+uOhfRRqzkJ3nWc8tjszxJN+y/5EOJavhsNI3/2yoTt6eMXRTqDD9b0tWSQ==", "cpu": [ "arm" ], @@ -2255,9 +2257,9 @@ } }, "node_modules/sass-embedded-linux-musl-arm64": { - "version": "1.80.6", - "resolved": "https://registry.npmjs.org/sass-embedded-linux-musl-arm64/-/sass-embedded-linux-musl-arm64-1.80.6.tgz", - "integrity": "sha512-VeUSHUi3MAsvOlg9QI4X/2j04h1659aE+7qKP/282CYBTrGkjFGSXZhIki9WKWDgIpDiSInRYXfQQRWhPhjCDg==", + "version": "1.81.0", + "resolved": "https://registry.npmjs.org/sass-embedded-linux-musl-arm64/-/sass-embedded-linux-musl-arm64-1.81.0.tgz", + "integrity": "sha512-hpntWf5kjkoxncA1Vh8vhsUOquZ8AROZKx0rQh7ZjSRs4JrYZASz1cfevPKaEM3wIim/nYa6TJqm0VqWsrERlA==", "cpu": [ "arm64" ], @@ -2271,9 +2273,9 @@ } }, "node_modules/sass-embedded-linux-musl-ia32": { - "version": "1.80.6", - "resolved": "https://registry.npmjs.org/sass-embedded-linux-musl-ia32/-/sass-embedded-linux-musl-ia32-1.80.6.tgz", - "integrity": "sha512-GqitS2Nab8ah0+wfCqaxW1hnI1piC08FimL6+lM9YWK5DbCOOF82IapbvJOy0feUmd/wNnHmyNTgE9h0zVMFdQ==", + "version": "1.81.0", + "resolved": "https://registry.npmjs.org/sass-embedded-linux-musl-ia32/-/sass-embedded-linux-musl-ia32-1.81.0.tgz", + "integrity": "sha512-UEXUYkBuqTSwg5JNWiNlfMZ1Jx6SJkaEdx+fsL3Tk099L8cKSoJWH2EPz4ZJjNbyIMymrSdVfymheTeZ8u24xA==", "cpu": [ "ia32" ], @@ -2287,9 +2289,9 @@ } }, "node_modules/sass-embedded-linux-musl-riscv64": { - "version": "1.80.6", - "resolved": "https://registry.npmjs.org/sass-embedded-linux-musl-riscv64/-/sass-embedded-linux-musl-riscv64-1.80.6.tgz", - "integrity": "sha512-ySs15z7QSRRQK/aByEEqaJLYW/sTpfynefNPZCtsVNVEzNRwy+DRpxNChtxo+QjKq97ocXETbdG5KLik7QOTJg==", + "version": "1.81.0", + "resolved": "https://registry.npmjs.org/sass-embedded-linux-musl-riscv64/-/sass-embedded-linux-musl-riscv64-1.81.0.tgz", + "integrity": "sha512-1D7OznytbIhx2XDHWi1nuQ8d/uCVR7FGGzELgaU//T8A9DapVTUgPKvB70AF1k4GzChR9IXU/WvFZs2hDTbaJg==", "cpu": [ "riscv64" ], @@ -2303,9 +2305,9 @@ } }, "node_modules/sass-embedded-linux-musl-x64": { - "version": "1.80.6", - "resolved": "https://registry.npmjs.org/sass-embedded-linux-musl-x64/-/sass-embedded-linux-musl-x64-1.80.6.tgz", - "integrity": "sha512-DzeNqU/SN0mWFznoOH4RtVGcrg3Eoa41pUQhKMtrhNbCmIE1zNDunUiAEVTNpdHJF4nxf7ELUPXWmStM31CbUQ==", + "version": "1.81.0", + "resolved": "https://registry.npmjs.org/sass-embedded-linux-musl-x64/-/sass-embedded-linux-musl-x64-1.81.0.tgz", + "integrity": "sha512-ia6VCTeVDQtBSMktXRFza1AZCt8/6aUoujot6Ugf4KmdytQqPJIHxkHaGftm5xwi9WdrMGYS7zgolToPijR11A==", "cpu": [ "x64" ], @@ -2319,9 +2321,9 @@ } }, "node_modules/sass-embedded-linux-riscv64": { - "version": "1.80.6", - "resolved": "https://registry.npmjs.org/sass-embedded-linux-riscv64/-/sass-embedded-linux-riscv64-1.80.6.tgz", - "integrity": "sha512-AyoHJ3icV9xuJjq1YzJqpEj2XfiC/KBkVYTUrCELKiXP0DN1gi/BpUwZNCAgCM3CyEdMef4LQM/ztCYJxYzdyg==", + "version": "1.81.0", + "resolved": "https://registry.npmjs.org/sass-embedded-linux-riscv64/-/sass-embedded-linux-riscv64-1.81.0.tgz", + "integrity": "sha512-KbxSsqu4tT1XbhZfJV/5NfW0VtJIGlD58RjqJqJBi8Rnjrx29/upBsuwoDWtsPV/LhoGwwU1XkSa9Q1ifCz4fQ==", "cpu": [ "riscv64" ], @@ -2335,9 +2337,9 @@ } }, "node_modules/sass-embedded-linux-x64": { - "version": "1.80.6", - "resolved": "https://registry.npmjs.org/sass-embedded-linux-x64/-/sass-embedded-linux-x64-1.80.6.tgz", - "integrity": "sha512-EohsE9CEqx0ycylnsEj/0DNPG99Tb0qAVZspiAs5xHFCJjXOFfp3cRQu0BRf+lZ1b72IhPFXymzVtojvzUHb7g==", + "version": "1.81.0", + "resolved": "https://registry.npmjs.org/sass-embedded-linux-x64/-/sass-embedded-linux-x64-1.81.0.tgz", + "integrity": "sha512-AMDeVY2T9WAnSFkuQcsOn5c29GRs/TuqnCiblKeXfxCSKym5uKdBl/N7GnTV6OjzoxiJBbkYKdVIaS5By7Gj4g==", "cpu": [ "x64" ], @@ -2351,9 +2353,9 @@ } }, "node_modules/sass-embedded-win32-arm64": { - "version": "1.80.6", - "resolved": "https://registry.npmjs.org/sass-embedded-win32-arm64/-/sass-embedded-win32-arm64-1.80.6.tgz", - "integrity": "sha512-29wETQi1ykeVvpd4zMVokpQKFSOZskGJzZawuuNCdo7BHjHKIRDsqbz8YT1CewHPBshI0hfD21fenmjxYjGXPQ==", + "version": "1.81.0", + "resolved": "https://registry.npmjs.org/sass-embedded-win32-arm64/-/sass-embedded-win32-arm64-1.81.0.tgz", + "integrity": "sha512-YOmBRYnygwWUmCoH14QbMRHjcvCJufeJBAp0m61tOJXIQh64ziwV4mjdqjS/Rx3zhTT4T+nulDUw4d3kLiMncA==", "cpu": [ "arm64" ], @@ -2367,9 +2369,9 @@ } }, "node_modules/sass-embedded-win32-ia32": { - "version": "1.80.6", - "resolved": "https://registry.npmjs.org/sass-embedded-win32-ia32/-/sass-embedded-win32-ia32-1.80.6.tgz", - "integrity": "sha512-1s3OpK2iTIfIL/a91QhAQnffsbuWfnsM8Lx4Fxt0f7ErnxjCV6q8MUFTV/UhcLtLyTFnPCA62DLjp2KGCjMI9A==", + "version": "1.81.0", + "resolved": "https://registry.npmjs.org/sass-embedded-win32-ia32/-/sass-embedded-win32-ia32-1.81.0.tgz", + "integrity": "sha512-HFfr/C+uLJGGTENdnssuNTmXI/xnIasUuEHEKqI+2J0FHCWT5cpz3PGAOHymPyJcZVYGUG/7gIxIx/d7t0LFYw==", "cpu": [ "ia32" ], @@ -2383,9 +2385,9 @@ } }, "node_modules/sass-embedded-win32-x64": { - "version": "1.80.6", - "resolved": "https://registry.npmjs.org/sass-embedded-win32-x64/-/sass-embedded-win32-x64-1.80.6.tgz", - "integrity": "sha512-0pH4Zr9silHkcmLPC0ghnD3DI0vMsjA7dKvGR32/RbbjOSvHV5cDQRLiuVJAPp34dfMA7kJd1ysSchRdH0igAQ==", + "version": "1.81.0", + "resolved": "https://registry.npmjs.org/sass-embedded-win32-x64/-/sass-embedded-win32-x64-1.81.0.tgz", + "integrity": "sha512-wxj52jDcIAwWcXb7ShZ7vQYKcVUkJ+04YM9l46jDY+qwHzliGuorAUyujLyKTE9heGD3gShJ3wPPC1lXzq6v9A==", "cpu": [ "x64" ], @@ -2595,34 +2597,55 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/sync-child-process": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/sync-child-process/-/sync-child-process-1.0.2.tgz", + "integrity": "sha512-8lD+t2KrrScJ/7KXCSyfhT3/hRq78rC0wBFqNJXv3mZyn6hW2ypM05JmlSvtqRbeq6jqA94oHbxAr2vYsJ8vDA==", + "license": "MIT", + "dependencies": { + "sync-message-port": "^1.0.0" + }, + "engines": { + "node": ">=16.0.0" + } + }, + "node_modules/sync-message-port": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/sync-message-port/-/sync-message-port-1.1.3.tgz", + "integrity": "sha512-GTt8rSKje5FilG+wEdfCkOcLL7LWqpMlr2c3LRuKt/YXxcJ52aGSbGBAdI4L3aaqfrBt6y711El53ItyH1NWzg==", + "license": "MIT", + "engines": { + "node": ">=16.0.0" + } + }, "node_modules/tailwindcss": { - "version": "3.4.14", - "resolved": "https://registry.npmjs.org/tailwindcss/-/tailwindcss-3.4.14.tgz", - "integrity": "sha512-IcSvOcTRcUtQQ7ILQL5quRDg7Xs93PdJEk1ZLbhhvJc7uj/OAhYOnruEiwnGgBvUtaUAJ8/mhSw1o8L2jCiENA==", + "version": "3.4.15", + "resolved": "https://registry.npmjs.org/tailwindcss/-/tailwindcss-3.4.15.tgz", + "integrity": "sha512-r4MeXnfBmSOuKUWmXe6h2CcyfzJCEk4F0pptO5jlnYSIViUkVmsawj80N5h2lO3gwcmSb4n3PuN+e+GC1Guylw==", "license": "MIT", "dependencies": { "@alloc/quick-lru": "^5.2.0", "arg": "^5.0.2", - "chokidar": "^3.5.3", + "chokidar": "^3.6.0", "didyoumean": "^1.2.2", "dlv": "^1.1.3", - "fast-glob": "^3.3.0", + "fast-glob": "^3.3.2", "glob-parent": "^6.0.2", "is-glob": "^4.0.3", - "jiti": "^1.21.0", + "jiti": "^1.21.6", "lilconfig": "^2.1.0", - "micromatch": "^4.0.5", + "micromatch": "^4.0.8", "normalize-path": "^3.0.0", "object-hash": "^3.0.0", - "picocolors": "^1.0.0", - "postcss": "^8.4.23", + "picocolors": "^1.1.1", + "postcss": "^8.4.47", "postcss-import": "^15.1.0", "postcss-js": "^4.0.1", - "postcss-load-config": "^4.0.1", - "postcss-nested": "^6.0.1", - "postcss-selector-parser": "^6.0.11", - "resolve": "^1.22.2", - "sucrase": "^3.32.0" + "postcss-load-config": "^4.0.2", + "postcss-nested": "^6.2.0", + "postcss-selector-parser": "^6.1.2", + "resolve": "^1.22.8", + "sucrase": "^3.35.0" }, "bin": { "tailwind": "lib/cli.js", diff --git a/resources/dist/build/assets/supersonic-e058825b.js b/resources/dist/build/assets/supersonic-e058825b.js new file mode 100644 index 0000000..7a1bdf3 --- /dev/null +++ b/resources/dist/build/assets/supersonic-e058825b.js @@ -0,0 +1 @@ +var w=(t,e,i)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,i)};var _=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function D(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var K="Expected a function",C=0/0,M="[object Symbol]",H=/^\s+|\s+$/g,U=/^[-+]0x[0-9a-f]+$/i,W=/^0b[01]+$/i,q=/^0o[0-7]+$/i,X=parseInt,G=typeof _=="object"&&_&&_.Object===Object&&_,z=typeof self=="object"&&self&&self.Object===Object&&self,J=G||z||Function("return this")(),Q=Object.prototype,Y=Q.toString,Z=Math.max,ee=Math.min,k=function(){return J.Date.now()};function te(t,e,i){var n,c,h,d,a,s,o=0,y=!1,f=!1,l=!0;if(typeof t!="function")throw new TypeError(K);e=L(e)||0,x(i)&&(y=!!i.leading,f="maxWait"in i,h=f?Z(L(i.maxWait)||0,e):h,l="trailing"in i?!!i.trailing:l);function p(r){var u=n,m=c;return n=c=void 0,o=r,d=t.apply(m,u),d}function b(r){return o=r,a=setTimeout(v,e),y?p(r):d}function A(r){var u=r-s,m=r-o,I=e-u;return f?ee(I,h-m):I}function S(r){var u=r-s,m=r-o;return s===void 0||u>=e||u<0||f&&m>=h}function v(){var r=k();if(S(r))return $(r);a=setTimeout(v,A(r))}function $(r){return a=void 0,l&&n?p(r):(n=c=void 0,d)}function V(){a!==void 0&&clearTimeout(a),o=0,n=s=c=a=void 0}function T(){return a===void 0?d:$(k())}function g(){var r=k(),u=S(r);if(n=arguments,c=this,s=r,u){if(a===void 0)return b(s);if(f)return a=setTimeout(v,e),p(s)}return a===void 0&&(a=setTimeout(v,e)),d}return g.cancel=V,g.flush=T,g}function ie(t,e,i){var n=!0,c=!0;if(typeof t!="function")throw new TypeError(K);return x(i)&&(n="leading"in i?!!i.leading:n,c="trailing"in i?!!i.trailing:c),te(t,e,{leading:n,maxWait:e,trailing:c})}function x(t){var e=typeof t;return!!t&&(e=="object"||e=="function")}function ne(t){return!!t&&typeof t=="object"}function re(t){return typeof t=="symbol"||ne(t)&&Y.call(t)==M}function L(t){if(typeof t=="number")return t;if(re(t))return C;if(x(t)){var e=typeof t.valueOf=="function"?t.valueOf():t;t=x(e)?e+"":e}if(typeof t!="string")return t===0?t:+t;t=t.replace(H,"");var i=W.test(t);return i||q.test(t)?X(t.slice(2),i?2:8):U.test(t)?C:+t}var se=ie;const ce=D(se);var ae="Expected a function",N=0/0,oe="[object Symbol]",le=/^\s+|\s+$/g,ue=/^[-+]0x[0-9a-f]+$/i,de=/^0b[01]+$/i,fe=/^0o[0-7]+$/i,he=parseInt,me=typeof _=="object"&&_&&_.Object===Object&&_,pe=typeof self=="object"&&self&&self.Object===Object&&self,ve=me||pe||Function("return this")(),_e=Object.prototype,ye=_e.toString,ge=Math.max,be=Math.min,j=function(){return ve.Date.now()};function Se(t,e,i){var n,c,h,d,a,s,o=0,y=!1,f=!1,l=!0;if(typeof t!="function")throw new TypeError(ae);e=P(e)||0,O(i)&&(y=!!i.leading,f="maxWait"in i,h=f?ge(P(i.maxWait)||0,e):h,l="trailing"in i?!!i.trailing:l);function p(r){var u=n,m=c;return n=c=void 0,o=r,d=t.apply(m,u),d}function b(r){return o=r,a=setTimeout(v,e),y?p(r):d}function A(r){var u=r-s,m=r-o,I=e-u;return f?be(I,h-m):I}function S(r){var u=r-s,m=r-o;return s===void 0||u>=e||u<0||f&&m>=h}function v(){var r=j();if(S(r))return $(r);a=setTimeout(v,A(r))}function $(r){return a=void 0,l&&n?p(r):(n=c=void 0,d)}function V(){a!==void 0&&clearTimeout(a),o=0,n=s=c=a=void 0}function T(){return a===void 0?d:$(j())}function g(){var r=j(),u=S(r);if(n=arguments,c=this,s=r,u){if(a===void 0)return b(s);if(f)return a=setTimeout(v,e),p(s)}return a===void 0&&(a=setTimeout(v,e)),d}return g.cancel=V,g.flush=T,g}function O(t){var e=typeof t;return!!t&&(e=="object"||e=="function")}function $e(t){return!!t&&typeof t=="object"}function Ie(t){return typeof t=="symbol"||$e(t)&&ye.call(t)==oe}function P(t){if(typeof t=="number")return t;if(Ie(t))return N;if(O(t)){var e=typeof t.valueOf=="function"?t.valueOf():t;t=O(e)?e+"":e}if(typeof t!="string")return t===0?t:+t;t=t.replace(le,"");var i=de.test(t);return i||fe.test(t)?he(t.slice(2),i?2:8):ue.test(t)?N:+t}var xe=Se;const Ae=D(xe);function E(t,e,i,n,c,h,d,a){var s=typeof t=="function"?t.options:t;e&&(s.render=e,s.staticRenderFns=i,s._compiled=!0),n&&(s.functional=!0),h&&(s._scopeId="data-v-"+h);var o;if(d?(o=function(l){l=l||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext,!l&&typeof __VUE_SSR_CONTEXT__<"u"&&(l=__VUE_SSR_CONTEXT__),c&&c.call(this,l),l&&l._registeredComponents&&l._registeredComponents.add(d)},s._ssrRegister=o):c&&(o=a?function(){c.call(this,(s.functional?this.parent:this).$root.$options.shadowRoot)}:c),o)if(s.functional){s._injectStyles=o;var y=s.render;s.render=function(p,b){return o.call(b),y(p,b)}}else{var f=s.beforeCreate;s.beforeCreate=f?[].concat(f,o):[o]}return{exports:t,options:s}}const Ve={props:{actions:{type:Object,required:!0},isVisible:{type:Boolean,required:!0},mode:{type:String,required:!0}},data(){return{filterVal:"",filteredActions:{},selectedIdx:0,searchVal:"",errorSearching:!1,searchResults:[],selectedSearchIdx:0,isSearching:!1,searchUrl:""}},mounted(){this.debouncedFilter=ce(()=>{this.filter()},100),this.filter(),this.debouncedSearch=Ae(()=>{this.search()},300)},beforeUnmount(){this.debouncedFilter.cancel()},watch:{filterVal(){this.debouncedFilter()},searchVal(){this.debouncedSearch()}},methods:{filter(){this.filteredActions={};var t=this.filterVal.toLowerCase(),e=!1,i=0;this.selectedIdx=0;for(var n in this.actions)this.actions[n].searchName.includes(t)&&(this.filteredActions[i]=Object.assign({isSelected:!e,...this.actions[n]}),e=e||this.filteredActions[i].isSelected,i++)},async search(){this.isSearching=!0,this.errorSearching=!1,this.searchResults=[],this.searchVal.toLowerCase();const t=await fetch(this.searchUrl+"?"+new URLSearchParams({s:this.searchVal})).then(e=>(this.selectedSearchIdx=0,e.ok?e.json():(this.errorSearching=!0,[]))).catch(()=>(this.errorSearching=!0,[]));this.searchResults=await t,this.searchResults.length>0&&(this.searchResults.isSelected=!0),this.isSearching=!1},toggleVisibility(){this.isVisible||(this.filterVal="",this.mode="main"),this.isVisible=!this.isVisible,this.isVisible&&Vue.nextTick(()=>{document.getElementById("supersonic-filter").focus()})},visibilityHide(){this.isVisible=!1},mainSelectNext(){this.selectedIdx+10&&this.selectedIdx--,document.getElementById("action-"+this.selectedIdx).scrollIntoView({block:"center"})},leaveSearchAction(){this.mode="main"},selectNextSearchResult(){this.selectedSearchIdx+10&&this.selectedSearchIdx--,document.getElementById("action-"+this.selectedSearchIdx).scrollIntoView({block:"center"})},doAction(t){var n,c;var e=null;if(this.mode==="main"?e=(n=this.filteredActions[this.selectedIdx])==null?void 0:n.actions:e=(c=this.searchResults[this.selectedSearchIdx])==null?void 0:c.actions,typeof e[t]>"u")return;const i=e[t];if(i.type==="link"){if(typeof i.url>"u")return;window.location=i.url;return}if(i.type==="search"){this.searchVal="",this.searchResults=[],this.isSearching=!1,this.searchUrl=i.url,this.mode="search",Vue.nextTick(()=>{document.getElementById("supersonic-filter").focus()});return}},clickAction(t){this.mode==="main"?(this.selectedIdx=t,this.doAction("primary")):(this.selectedSearchIdx=t,this.doAction("primary"))}}};var Te=function(){var e=this,i=e._self._c;return i("div",{directives:[{name:"show",rawName:"v-show",value:e.isVisible,expression:"isVisible"}],staticClass:"modal-container"},[i("div",{staticClass:"modal"},[i("h2",[e._v(e._s(e.__("Supersonic")))]),e.mode==="main"?i("div",[i("p",[i("input",{directives:[{name:"model",rawName:"v-model",value:e.filterVal,expression:"filterVal"}],attrs:{type:"text",id:"supersonic-filter"},domProps:{value:e.filterVal},on:{input:function(n){n.target.composing||(e.filterVal=n.target.value)}}})]),i("supersonic-action-list",{attrs:{actions:e.filteredActions,selectedIdx:e.selectedIdx},on:{clickAction:e.clickAction}}),i("supersonic-key-listener",{attrs:{isVisible:e.isVisible},on:{toggleVisibility:function(n){return e.toggleVisibility()},visibilityHide:function(n){return e.visibilityHide()},selectNext:function(n){return e.mainSelectNext()},selectPrevious:function(n){return e.mainSelectPrevious()},primaryAction:function(n){return e.doAction("primary")},secondaryAction:function(n){return e.doAction("secondary")},tertiaryAction:function(n){return e.doAction("tertiary")}}})],1):e._e(),e.mode==="search"?i("div",[i("p",[i("input",{directives:[{name:"model",rawName:"v-model",value:e.searchVal,expression:"searchVal"}],attrs:{type:"text",id:"supersonic-filter"},domProps:{value:e.searchVal},on:{input:function(n){n.target.composing||(e.searchVal=n.target.value)}}})]),!e.isSearching&&this.searchResults.length>0?i("supersonic-action-list",{attrs:{actions:e.searchResults,selectedIdx:e.selectedSearchIdx},on:{clickAction:e.clickAction}}):e._e(),!e.isSearching&&this.searchResults.length<1?i("div",{staticClass:"no-results-container"},[this.errorSearching?i("p",[e._v(" "+e._s(e.__("There was an error fetching results. Sorry."))+" ")]):e._e(),!this.errorSearching&&this.searchVal.length>0?i("p",[e._v(" "+e._s(e.__("No results"))+" ")]):e._e(),!this.errorSearching&&this.searchVal.length<1?i("p",[e._v(" "+e._s(e.__("Type to search in "))+e._s(this.filteredActions[e.selectedIdx].path+" » "+this.filteredActions[e.selectedIdx].name)+" ")]):e._e()]):e._e(),e.isSearching?i("div",{staticClass:"spinner-container"},[i("div",[e._m(0),i("p",[e._v(" "+e._s(e.__("Searching..."))+" ")])])]):e._e(),i("supersonic-key-listener",{attrs:{isVisible:e.isVisible},on:{toggleVisibility:function(n){return e.toggleVisibility()},visibilityHide:function(n){return e.visibilityHide()},selectNext:function(n){return e.selectNextSearchResult()},selectPrevious:function(n){return e.selectPreviousSearchResult()},primaryAction:function(n){return e.doAction("primary")},secondaryAction:function(n){return e.doAction("secondary")},tertiaryAction:function(n){return e.doAction("tertiary")},backAction:function(n){return e.leaveSearchAction()}}})],1):e._e()])])},ke=[function(){var t=this,e=t._self._c;return e("div",{staticClass:"lds-ring"},[e("div"),e("div"),e("div"),e("div")])}],je=E(Ve,Te,ke,!1,null,"3cda0e88",null,null);const Oe=je.exports;const Re={props:{actions:{type:Object,required:!0},selectedIdx:{type:Number,required:!0}},data(){return{}}};var Ee=function(){var e=this,i=e._self._c;return i("div",{staticClass:"list-container"},[i("ul",e._l(e.actions,function(n,c){return i("li",{class:"indent-"+n.depth+" "+(Number(c)===e.selectedIdx?"action-selected":""),attrs:{id:"action-"+c},on:{click:function(h){return e.$emit("clickAction",c)}}},[i("span",{staticClass:"action-icon",domProps:{innerHTML:e._s(n.svgIcon)}}),e._v(" "+e._s(n.name)+" "),i("span",{staticClass:"action-path"},[e._v(e._s(n.path))])])}),0)])},we=[],Ce=E(Re,Ee,we,!1,null,"39e22802",null,null);const Le=Ce.exports,Ne={props:{isVisible:{type:Boolean,required:!0}},data(){return{}},mounted(){document.addEventListener("click",t=>{t.target.classList.contains("modal-container")&&this.$emit("visibilityHide")}),document.addEventListener("keydown",t=>{if(!(!t.target instanceof HTMLElement&&!t.target instanceof document)){if((t.metaKey||t.ctrlKey)&&t.code==="KeyK")return this.$emit("toggleVisibility"),t.preventDefault();if(t.code==="Escape")return this.$emit("visibilityHide"),t.preventDefault();if(this.isVisible){if(t.code==="ArrowDown")return this.$emit("selectNext"),t.preventDefault();if(t.code==="ArrowUp")return this.$emit("selectPrevious"),t.preventDefault();if(!(t.metaKey||t.ctrlKey)&&t.code==="Enter")return this.$emit("primaryAction"),t.preventDefault();if((t.metaKey||t.ctrlKey)&&t.code==="Enter")return this.$emit("secondaryAction"),t.preventDefault();if((t.metaKey||t.ctrlKey)&&t.code==="ArrowRight")return this.$emit("tertiaryAction"),t.preventDefault();if((t.metaKey||t.ctrlKey)&&t.code==="ArrowLeft")return this.$emit("backAction"),t.preventDefault()}}})}};var Pe=function(){var e=this,i=e._self._c;return i("div")},Fe=[],Be=E(Ne,Pe,Fe,!1,null,null,null,null);const De=Be.exports;var R;class Ke{constructor(){w(this,R,void 0)}async init(){const e=await fetch("/cp/!/ademti-apps/supersonic/actions").then(i=>i.ok?i.json():{}).catch(()=>({}));this.data=await e}get(){return this.data}}R=new WeakMap;Statamic.booting(()=>{Statamic.$components.register("supersonic-app",Oe),Statamic.$components.register("supersonic-action-list",Le),Statamic.$components.register("supersonic-key-listener",De)});const F=new Ke;async function B(){await F.init(),Statamic.$components.append("supersonic-app",{props:{actions:F.get(),isVisible:!1,mode:"main"}})}document.readyState!=="loading"?B():document.addEventListener("DOMContentLoaded",B); diff --git a/resources/dist/build/manifest.json b/resources/dist/build/manifest.json index 489d957..a920907 100644 --- a/resources/dist/build/manifest.json +++ b/resources/dist/build/manifest.json @@ -7,7 +7,7 @@ "css": [ "assets/supersonic-71a66aee.css" ], - "file": "assets/supersonic-ff95129e.js", + "file": "assets/supersonic-e058825b.js", "isEntry": true, "src": "resources/js/supersonic.js" }, diff --git a/resources/js/components/supersonic-key-listener.vue b/resources/js/components/supersonic-key-listener.vue index 92871c3..ddde3db 100644 --- a/resources/js/components/supersonic-key-listener.vue +++ b/resources/js/components/supersonic-key-listener.vue @@ -10,6 +10,11 @@ export default { }; }, mounted() { + document.addEventListener('click', (e) => { + if (e.target.classList.contains('modal-container')) { + this.$emit('visibilityHide'); + } + }); document.addEventListener( 'keydown', (e) => { diff --git a/src/Controllers/ActionInfoController.php b/src/Controllers/ActionInfoController.php index 2d20f58..dd1b981 100644 --- a/src/Controllers/ActionInfoController.php +++ b/src/Controllers/ActionInfoController.php @@ -8,13 +8,18 @@ use Illuminate\Http\JsonResponse; use Statamic\CP\Navigation\CoreNav; use Statamic\Facades\AssetContainer; +use Statamic\Facades\Blueprint; use Statamic\Facades\Collection as CollectionRepository; use Statamic\Facades\CP\Nav; use Statamic\Facades\Fieldset; +use Statamic\Facades\Form; +use Statamic\Facades\GlobalSet; use Statamic\Facades\Nav as NavigationRepository; +use Statamic\Facades\Site; use Statamic\Facades\Taxonomy as TaxonomyRepository; use Statamic\Facades\User; use Statamic\Statamic; +use Statamic\Support\Str; use function array_merge; use function response; use function route; @@ -44,7 +49,9 @@ public function __invoke(AddonInfo $addon) $actions = $this->addNavigationActions($actions); $actions = $this->addTaxonomyActions($actions); $actions = $this->addAssetContainerActions($actions); + $actions = $this->addFieldsetActions($actions); $actions = $this->addBlueprintActions($actions); + $actions = $this->addMultisiteActions($actions); // Sort them. uasort($actions, function ($a, $b) { @@ -60,8 +67,8 @@ public function __invoke(AddonInfo $addon) 'Supersonic', [ 'primary' => [ - 'type' => 'link', - 'url' => 'https://supersonic.ademti-software.co.uk', + 'type' => 'link', + 'url' => 'https://supersonic.ademti-software.co.uk', ] ], 0 @@ -72,8 +79,8 @@ public function __invoke(AddonInfo $addon) 'Supersonic', [ 'primary' => [ - 'type' => 'link', - 'url' => 'https://supersonic.ademti-software.co.uk/using-supersonic', + 'type' => 'link', + 'url' => 'https://supersonic.ademti-software.co.uk/using-supersonic', ] ], 1 @@ -84,8 +91,8 @@ public function __invoke(AddonInfo $addon) 'Supersonic', [ 'primary' => [ - 'type' => 'link', - 'url' => 'https://supersonic.ademti-software.co.uk/feature-requests', + 'type' => 'link', + 'url' => 'https://supersonic.ademti-software.co.uk/feature-requests', ] ], 1 @@ -96,8 +103,8 @@ public function __invoke(AddonInfo $addon) 'Supersonic', [ 'primary' => [ - 'type' => 'link', - 'url' => 'https://supersonic.ademti-software.co.uk/contact', + 'type' => 'link', + 'url' => 'https://supersonic.ademti-software.co.uk/contact', ] ], 1 @@ -137,8 +144,8 @@ private function getCpNavActions(): array $name .= $navItem->display(); $actions[$id] = new Action( $id, - $name, - $path, + __($name), + __($path), [ 'primary' => [ 'type' => 'link', @@ -203,12 +210,13 @@ private function addChildActions($actions, $parentId, $repository, $subActions) // Special case for the Fieldset class which has a title method, but no title prop. if ($repository === Fieldset::class) { $query = $repository::all()->sort(fn($a, $b) => $a->title() > $b->title()); + } elseif ($repository === \Statamic\Sites\Site::class) { + $query = $respository::all()->sortBy('name'); } else { $query = $repository::all()->sortBy('title'); } $query->each(function ($item) use ($parentAction, $path, &$childActions, $subActions) { - // Generate URLs from any actions that are specified by route. foreach ($subActions as $idx => $subAction) { $hasPermission = false; foreach ($subAction['permissions'] as $permission) { @@ -217,19 +225,32 @@ private function addChildActions($actions, $parentId, $repository, $subActions) } // Bail if either the user doesn't have permission, or the item is not available on this site. - if ( ! $hasPermission ) { + if ( ! $hasPermission) { unset($subActions[$idx]); continue; } unset($subActions[$idx]['permissions']); + // Generate URLs from any actions that are specified by route. if ( ! empty($subAction['route'])) { $subActions[$idx]['url'] = route($subAction['route'], [$item->handle()]); unset($subActions[$idx]['route']); } + // Replace placholders in any URLs. + if ( ! empty($subAction['url'])) { + $subActions[$idx]['url'] = str_replace('{handle}', $item->handle(), $subActions[$idx]['url']); + } } if ( ! empty($subActions)) { - // Special case for the Fieldset class which has a title method, but no title prop. - $title = $item->title ?? $item->title(); + if ($item instanceof \Statamic\Sites\Site) { + // Site has a name, not a title. + $title = $item->name(); + } elseif ($item instanceof \Statamic\Fields\Fieldset) { + // Fieldset class has a title method, but no title prop. + $title = $item->title(); + } else { + $title = $item->title; + } + // Add the actions $childActions[$parentAction->id . '::' . $item->handle()] = new Action( $parentAction->id . '::' . $item->handle(), @@ -263,12 +284,12 @@ private function addCollectionActions(array $actions): array $collectionActions = array_merge( $collectionActions, [ - 'secondary' => [ + 'secondary' => [ 'type' => 'link', 'route' => 'statamic.cp.collections.edit', 'permissions' => ['configure collections'], ], - 'tertiary' => [ + 'tertiary' => [ 'type' => 'search', 'route' => 'statamic.cp.ademti-apps.supersonic.search.collection-entries', 'permissions' => ['edit {handle} entries', 'configure collections'] @@ -297,7 +318,7 @@ private function addNavigationActions(array $actions): array 'content::navigation', NavigationRepository::class, [ - 'primary' => [ + 'primary' => [ 'type' => 'link', 'route' => 'statamic.cp.navigation.show', 'permissions' => ['edit {handle} nav', 'configure navs'] @@ -329,12 +350,12 @@ private function addTaxonomyActions(array $actions): array $taxonomyActions = array_merge( $taxonomyActions, [ - 'secondary' => [ + 'secondary' => [ 'type' => 'link', 'route' => 'statamic.cp.taxonomies.edit', 'permissions' => ['configure taxonomies',] ], - 'tertiary' => [ + 'tertiary' => [ 'type' => 'search', 'route' => 'statamic.cp.ademti-apps.supersonic.search.terms', 'permissions' => ['edit {handle} terms', 'configure taxonomies'] @@ -393,21 +414,258 @@ private function addAssetContainerActions(array $actions): array * * @return array */ - private function addBlueprintActions(array $actions): array + private function addFieldsetActions(array $actions): array { - // @TODO - Add per-blueprint actions - behind licensing + $fieldsetActions = [ + 'primary' => [ + 'type' => 'link', + 'route' => 'statamic.cp.fieldsets.edit', + 'permissions' => ['configure fields'], + ], + ]; + return $this->addChildActions( $actions, 'fields::fieldsets', Fieldset::class, + $fieldsetActions + ); + } + + private function addMultisiteActions(array $actions): array + { + if ( ! Site::multiEnabled()) { + return $actions; + } + + return $this->addChildActions( + $actions, + 'settings::sites', + Site::class, + [ + 'primary' => [ + 'type' => 'link', + 'url' => '/cp/select-site/{handle}', + 'permissions' => ['access {handle} site'], + ], + ] + ); + } + + private function addBlueprintActions(array $actions): array + { + // Collection blueprints. + foreach (CollectionRepository::all() as $collection) { + $actions = $this->addBlueprintChildActions( + $actions, + 'collections', + __('Collections'), + $collection, + $collection->entryBlueprints(), + [ + 'primary' => [ + 'type' => 'link', + 'route' => 'statamic.cp.collections.blueprints.edit', + 'permissions' => ['configure fields'], + ], + ] + ); + } + + // Taxonomy blueprints. + foreach (TaxonomyRepository::all() as $taxonomy) { + $actions = $this->addBlueprintChildActions( + $actions, + 'taxonomies', + __('Taxonomies'), + $taxonomy, + $taxonomy->termBlueprints(), + [ + 'primary' => [ + 'type' => 'link', + 'route' => 'statamic.cp.taxonomies.blueprints.edit', + 'permissions' => ['configure fields'], + ], + ] + ); + } + + // Navigation blueprints. + $actions = $this->addBlueprintChildActions( + $actions, + 'navigations', + __('Navigations'), + null, + NavigationRepository::all(), + [ + 'primary' => [ + 'type' => 'link', + 'route' => 'statamic.cp.navigation.blueprint.edit', + 'permissions' => ['configure fields'], + ], + ] + ); + + // Globalset blueprints. + $actions = $this->addBlueprintChildActions( + $actions, + 'globals', + __('Globals'), + null, + GlobalSet::all(), [ 'primary' => [ 'type' => 'link', - 'route' => 'statamic.cp.fieldsets.edit', + 'route' => 'statamic.cp.globals.blueprint.edit', 'permissions' => ['configure fields'], ], ] ); + + // Asset container blueprints. + $actions = $this->addBlueprintChildActions( + $actions, + 'asset-containers', + __('Asset Containers'), + null, + AssetContainer::all(), + [ + 'primary' => [ + 'type' => 'link', + 'route' => 'statamic.cp.asset-containers.blueprint.edit', + 'permissions' => ['configure fields'], + ], + ] + ); + + // Form blueprints. + $actions = $this->addBlueprintChildActions( + $actions, + 'forms', + __('Forms'), + null, + Form::all(), + [ + 'primary' => [ + 'type' => 'link', + 'route' => 'statamic.cp.forms.blueprint.edit', + 'permissions' => ['configure form fields'], + ], + ] + ); + + // User blueprint. + if (User::current()->can(['configure fields'])) { + $actions['fields::blueprints::user'] = new Action( + 'fields::blueprints::user', + __('User'), + 'Fields » Blueprints', + [ + 'primary' => [ + 'type' => 'link', + 'url' => route('statamic.cp.users.blueprint.edit'), + ], + ], + 1 + ); + $actions['fields::blueprints::user-groups'] = new Action( + 'fields::blueprints::user-group', + __('Group'), + 'Fields » Blueprints', + [ + 'primary' => [ + 'type' => 'link', + 'url' => route('statamic.cp.user-groups.blueprint.edit'), + ], + ], + 1 + ); + } + + return $actions; } + /** + * @param array $actions The current list of actions to be added to. + * @param string $parentId A conceptual "ID" to site these blueprints as a child of. + * @param string $parentName A conceptual path name to site these blueprints under. + * @param Entry|null $entry The entry that tis blueprint relates to. + * @param Collection $items The items to generate actions for. + * @param array $subActions Array of sub-actions that can be invoked on this action. + * + * @return array + */ + private function addBlueprintChildActions($actions, $parentId, $parentName, $entry, $items, $subActions) + { + $grandparentAction = $actions['fields::blueprints']; + $path = $grandparentAction->path . ' » ' . + $grandparentAction->name . ' » ' . + $parentName; + if ($entry) { + $path .= ' » ' . $entry->title; + } + $childActions = []; + + $items->each(function ($item) use ($grandparentAction, $entry, $parentId, $path, &$childActions, $subActions) { + foreach ($subActions as $idx => $subAction) { + $hasPermission = false; + foreach ($subAction['permissions'] as $permission) { + $permission = str_replace('{handle}', $item->handle(), $permission); + $hasPermission |= User::current()->can($permission, $item); + } + + // Bail if either the user doesn't have permission, or the item is not available on this site. + if ( ! $hasPermission) { + unset($subActions[$idx]); + continue; + } + unset($subActions[$idx]['permissions']); + // Generate URLs from any actions that are specified by route. + if ( ! empty($subAction['route'])) { + switch ($subAction['route']) { + case 'statamic.cp.collections.blueprints.edit': + $routeArgs = ['collection' => $entry->handle(), 'blueprint' => $item->handle()]; + break; + case 'statamic.cp.taxonomies.blueprints.edit': + $routeArgs = ['taxonomy' => $entry->handle(), 'blueprint' => $item->handle()]; + break; + + case 'statamic.cp.navigation.blueprint.edit': + $routeArgs = ['navigation' => $item->handle()]; + break; + case 'statamic.cp.asset-containers.blueprint.edit': + $routeArgs = ['asset_container' => $item->handle()]; + break; + case 'statamic.cp.globals.blueprint.edit': + $routeArgs = ['global_set' => $item->handle()]; + break; + case 'statamic.cp.forms.blueprint.edit': + $routeArgs = ['form' => $item->handle()]; + break; + } + $subActions[$idx]['url'] = route($subAction['route'], $routeArgs); + unset($subActions[$idx]['route']); + } + // Replace placholders in any URLs. + if ( ! empty($subAction['url'])) { + $subActions[$idx]['url'] = str_replace('{handle}', $item->handle(), $subActions[$idx]['url']); + } + } + if ( ! empty($subActions)) { + // Add the actions + $key = $grandparentAction->id . '::' . $parentId . '::' . $item->handle(); + $childActions[$key] = new Action( + $key, + $item->title ?? $item->title(), + $path, + $subActions, + 1 + ); + } + }); + + return array_merge($actions, $childActions); + } + + }