diff --git a/.prettierignore b/.prettierignore index c0e2e21489d5..d936c5649eb7 100644 --- a/.prettierignore +++ b/.prettierignore @@ -3,6 +3,8 @@ **/dist/** **/build/** **/npm/** +**/.output/** +**/.browser-profiles/** **/__tests__/integration/fixtures/** packages/**/.wxt/** packages/playwright diff --git a/package-lock.json b/package-lock.json index 260d3fb03776..70bc764a6fe7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -8716,30 +8716,30 @@ "dev": true }, "node_modules/@webext-pegasus/rpc": { - "version": "0.0.4", - "resolved": "https://registry.npmjs.org/@webext-pegasus/rpc/-/rpc-0.0.4.tgz", - "integrity": "sha512-PjfJ1vQgwKS/XJBZC3xvbx/i1cljm2x3pb1osFbAbPs4Tnmv2FewdVC2hhBTBNy9i27KyHTsMvd42rttZQvRoA==", + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/@webext-pegasus/rpc/-/rpc-0.2.0.tgz", + "integrity": "sha512-tcxVwmEHZobzhiJzmGA35pqT6b7f/D2Ky57ARpWMAqCXDvEPlwUM58G1afG2xSlrhvzm9QX0dP6+T+gJGukv+A==", "dependencies": { - "@webext-pegasus/transport": "^0.0.4", + "@webext-pegasus/transport": "^0.2.0", "type-fest": "^0.21.3" } }, "node_modules/@webext-pegasus/store": { - "version": "0.0.4", - "resolved": "https://registry.npmjs.org/@webext-pegasus/store/-/store-0.0.4.tgz", - "integrity": "sha512-nvfwxlglcGDie0b3pd2WZVLnYbll24tzBVSQ+0XgKa5tL6ntAMjRPqQWO3QNlUJANbmcXabzAd5R+7dxCTrTyw==", + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/@webext-pegasus/store/-/store-0.2.0.tgz", + "integrity": "sha512-ejMLj/e+F8jJh0F9w5Lpcpki1ZoAX5vsZXf+JQyAxctjz0qw4JIVpA/gedTumMx4ejQa0oBTNaCOGPwhvsMqUA==", "dependencies": { - "@webext-pegasus/rpc": "^0.0.4", - "@webext-pegasus/transport": "^0.0.4", + "@webext-pegasus/rpc": "^0.2.0", + "@webext-pegasus/transport": "^0.2.0", "type-fest": "^0.21.3" } }, "node_modules/@webext-pegasus/store-zustand": { - "version": "0.0.4", - "resolved": "https://registry.npmjs.org/@webext-pegasus/store-zustand/-/store-zustand-0.0.4.tgz", - "integrity": "sha512-5M/ZRwSzno8ebWZeu+A1GplVTVc/ruU/whWCyOkJNtKkCyuKwFZBWLBUfzKKIgNhCqSeGqxwi4F/ggvS42glPQ==", + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/@webext-pegasus/store-zustand/-/store-zustand-0.2.0.tgz", + "integrity": "sha512-WPx3nqxsju5BNlwN5ZrJ5m4nVMvUKavsNy6mV8Uga4gq73UeLKyBc8GgxAT763mwQkA5f5vDCvD/R/72eyXQbg==", "dependencies": { - "@webext-pegasus/store": "^0.0.4", + "@webext-pegasus/store": "^0.2.0", "type-fest": "^0.21.3" }, "peerDependencies": { @@ -8747,9 +8747,9 @@ } }, "node_modules/@webext-pegasus/transport": { - "version": "0.0.4", - "resolved": "https://registry.npmjs.org/@webext-pegasus/transport/-/transport-0.0.4.tgz", - "integrity": "sha512-s6iWeo3vpoEa7d3UZtNVDWFQjT3OAdgxN064Z7P0fJNbfIMVa/Twvo8dJtcsSg5VGxxoxIqwLJ7FX6LgmBAmpg==", + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/@webext-pegasus/transport/-/transport-0.2.0.tgz", + "integrity": "sha512-tcjvE/D7I80aagFkOm+c08BFom2IOEbLjXcIkiUP8g4qQPpyOQx8scZ9dP/dk7hZb7M0yoA6Ebe9vzLErLEFkQ==", "dependencies": { "@types/webextension-polyfill": "^0.10.7", "nanoevents": "^6.0.2", @@ -32644,9 +32644,9 @@ "@chakra-ui/react": "^2.8.2", "@emotion/react": "^11.11.4", "@emotion/styled": "^11.11.5", - "@webext-pegasus/rpc": "^0.0.4", - "@webext-pegasus/store-zustand": "^0.0.4", - "@webext-pegasus/transport": "^0.0.4", + "@webext-pegasus/rpc": "^0.2.0", + "@webext-pegasus/store-zustand": "^0.2.0", + "@webext-pegasus/transport": "^0.2.0", "framer-motion": "^11.1.5", "react": "^18.2.0", "react-dom": "^18.2.0", @@ -37386,9 +37386,9 @@ "@types/react": "^18.2.46", "@types/react-dom": "^18.2.18", "@vitejs/plugin-react": "^4.2.1", - "@webext-pegasus/rpc": "^0.0.4", - "@webext-pegasus/store-zustand": "^0.0.4", - "@webext-pegasus/transport": "^0.0.4", + "@webext-pegasus/rpc": "^0.2.0", + "@webext-pegasus/store-zustand": "^0.2.0", + "@webext-pegasus/transport": "^0.2.0", "framer-motion": "^11.1.5", "lexical": "0.15.0", "react": "^18.2.0", @@ -39361,37 +39361,37 @@ "dev": true }, "@webext-pegasus/rpc": { - "version": "0.0.4", - "resolved": "https://registry.npmjs.org/@webext-pegasus/rpc/-/rpc-0.0.4.tgz", - "integrity": "sha512-PjfJ1vQgwKS/XJBZC3xvbx/i1cljm2x3pb1osFbAbPs4Tnmv2FewdVC2hhBTBNy9i27KyHTsMvd42rttZQvRoA==", + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/@webext-pegasus/rpc/-/rpc-0.2.0.tgz", + "integrity": "sha512-tcxVwmEHZobzhiJzmGA35pqT6b7f/D2Ky57ARpWMAqCXDvEPlwUM58G1afG2xSlrhvzm9QX0dP6+T+gJGukv+A==", "requires": { - "@webext-pegasus/transport": "^0.0.4", + "@webext-pegasus/transport": "^0.2.0", "type-fest": "^0.21.3" } }, "@webext-pegasus/store": { - "version": "0.0.4", - "resolved": "https://registry.npmjs.org/@webext-pegasus/store/-/store-0.0.4.tgz", - "integrity": "sha512-nvfwxlglcGDie0b3pd2WZVLnYbll24tzBVSQ+0XgKa5tL6ntAMjRPqQWO3QNlUJANbmcXabzAd5R+7dxCTrTyw==", + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/@webext-pegasus/store/-/store-0.2.0.tgz", + "integrity": "sha512-ejMLj/e+F8jJh0F9w5Lpcpki1ZoAX5vsZXf+JQyAxctjz0qw4JIVpA/gedTumMx4ejQa0oBTNaCOGPwhvsMqUA==", "requires": { - "@webext-pegasus/rpc": "^0.0.4", - "@webext-pegasus/transport": "^0.0.4", + "@webext-pegasus/rpc": "^0.2.0", + "@webext-pegasus/transport": "^0.2.0", "type-fest": "^0.21.3" } }, "@webext-pegasus/store-zustand": { - "version": "0.0.4", - "resolved": "https://registry.npmjs.org/@webext-pegasus/store-zustand/-/store-zustand-0.0.4.tgz", - "integrity": "sha512-5M/ZRwSzno8ebWZeu+A1GplVTVc/ruU/whWCyOkJNtKkCyuKwFZBWLBUfzKKIgNhCqSeGqxwi4F/ggvS42glPQ==", + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/@webext-pegasus/store-zustand/-/store-zustand-0.2.0.tgz", + "integrity": "sha512-WPx3nqxsju5BNlwN5ZrJ5m4nVMvUKavsNy6mV8Uga4gq73UeLKyBc8GgxAT763mwQkA5f5vDCvD/R/72eyXQbg==", "requires": { - "@webext-pegasus/store": "^0.0.4", + "@webext-pegasus/store": "^0.2.0", "type-fest": "^0.21.3" } }, "@webext-pegasus/transport": { - "version": "0.0.4", - "resolved": "https://registry.npmjs.org/@webext-pegasus/transport/-/transport-0.0.4.tgz", - "integrity": "sha512-s6iWeo3vpoEa7d3UZtNVDWFQjT3OAdgxN064Z7P0fJNbfIMVa/Twvo8dJtcsSg5VGxxoxIqwLJ7FX6LgmBAmpg==", + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/@webext-pegasus/transport/-/transport-0.2.0.tgz", + "integrity": "sha512-tcjvE/D7I80aagFkOm+c08BFom2IOEbLjXcIkiUP8g4qQPpyOQx8scZ9dP/dk7hZb7M0yoA6Ebe9vzLErLEFkQ==", "requires": { "@types/webextension-polyfill": "^0.10.7", "nanoevents": "^6.0.2", diff --git a/packages/lexical-devtools/README.md b/packages/lexical-devtools/README.md index 74d27cb9925b..c5031cdffca3 100644 --- a/packages/lexical-devtools/README.md +++ b/packages/lexical-devtools/README.md @@ -2,6 +2,13 @@ This is the source code for the Lexical DevTools browser extension. +[link-edge]: https://microsoftedge.microsoft.com/addons/detail/lexical-developer-tools/pclbkaofdgafcfhlnimcdhhkkhcabpcb 'Version published on Edge Add-ons Store' +[link-firefox]: https://addons.mozilla.org/en-US/firefox/addon/lexical-developer-tools/ 'Version published on Mozilla Add-ons' + +[Chrome][link-edge] [][link-edge] + +[Firefox][link-firefox] [][link-firefox] + ## Local development Lexical DevTools extension uses [WXT](https://wxt.dev/) framework to simplify development. Please refer to [WXT Development Guide](https://wxt.dev/guide/development.html) for comprehensive documentation. @@ -18,6 +25,23 @@ $ npm run dev - WXT Framework debugging: `DEBUG_WXT=1 npm run dev` - If you detach the Dev Tools in a separate window, and press `Cmd+Option+I` while Dev Tools window is focused, you will invoke the Dev Tools for the Dev Tools window. +**Safari:** + +To develop and run Safari version of the extension you (obviously) need a Mac and Xcode installed. Safari on the contrary to other browsers doesn't accept web extensions as a zip archive but rather requires you to [wrap it in native code (Swift) wrapper](https://developer.apple.com/documentation/safariservices/safari_web_extensions/converting_a_web_extension_for_safari/). Fortunately this process is mostly automated here. + +```bash +# Install Xcode + +# Environment setup +sudo xcode-select -s /Applications/Xcode.app +xcodebuild --install +sudo xcodebuild -license +xcodebuild -runFirstLaunch + +# Normal operation +npm run dev:safari +``` + ## Design This extension follows typical [Browser DevTools architecture](https://developer.chrome.com/docs/extensions/how-to/devtools/extend-devtools) that includes sereral independent contexts that communicate via events or extension APIs. diff --git a/packages/lexical-devtools/package.json b/packages/lexical-devtools/package.json index 7f40106fb86f..d0dc802c97b9 100644 --- a/packages/lexical-devtools/package.json +++ b/packages/lexical-devtools/package.json @@ -8,7 +8,8 @@ "dev": "wxt", "dev:firefox": "wxt -b firefox", "dev:edge": "wxt -b edge", - "dev:safari": "xcrun safari-web-extension-converter --macos-only --no-prompt .output/safari-mv2", + "dev:safari": "npm run build:safari -- --mode development && xcodebuild -configuration Debug -scheme Lexical\\ Developer\\ Tools -project ./safari-xcode//Lexical\\ Developer\\ Tools/Lexical\\ Developer\\ Tools.xcodeproj && echo \"Open Safari, allow unsigned extensions in developer settings, enable extension in extensions manager (if needed)\"", + "safari:convert": "xcrun safari-web-extension-converter --app-name 'Lexical Developer Tools' --project-location ./safari-xcode --macos-only --no-prompt --force --no-open .output/safari-mv2", "build": "npm-run-all build:chrome build:firefox build:edge build:safari", "build:chrome": "wxt build -b chrome", "build:firefox": "wxt build -b firefox", @@ -27,9 +28,9 @@ "@chakra-ui/react": "^2.8.2", "@emotion/react": "^11.11.4", "@emotion/styled": "^11.11.5", - "@webext-pegasus/rpc": "^0.0.4", - "@webext-pegasus/store-zustand": "^0.0.4", - "@webext-pegasus/transport": "^0.0.4", + "@webext-pegasus/rpc": "^0.2.0", + "@webext-pegasus/store-zustand": "^0.2.0", + "@webext-pegasus/transport": "^0.2.0", "framer-motion": "^11.1.5", "react": "^18.2.0", "react-dom": "^18.2.0", diff --git a/packages/lexical-devtools/safari-xcode/.gitignore b/packages/lexical-devtools/safari-xcode/.gitignore new file mode 100644 index 000000000000..5fcea4d314b0 --- /dev/null +++ b/packages/lexical-devtools/safari-xcode/.gitignore @@ -0,0 +1,7 @@ +xcuserdata/ +*.xcworkspace +build/ +fastlane/report.xml +fastlane/Preview.html +fastlane/screenshots/**/*.png +fastlane/test_output diff --git a/packages/lexical-devtools/safari-xcode/Lexical Developer Tools/Lexical Developer Tools Extension/Info.plist b/packages/lexical-devtools/safari-xcode/Lexical Developer Tools/Lexical Developer Tools Extension/Info.plist new file mode 100644 index 000000000000..9ee504dc51f3 --- /dev/null +++ b/packages/lexical-devtools/safari-xcode/Lexical Developer Tools/Lexical Developer Tools Extension/Info.plist @@ -0,0 +1,13 @@ + + + + + NSExtension + + NSExtensionPointIdentifier + com.apple.Safari.web-extension + NSExtensionPrincipalClass + $(PRODUCT_MODULE_NAME).SafariWebExtensionHandler + + + diff --git a/packages/lexical-devtools/safari-xcode/Lexical Developer Tools/Lexical Developer Tools Extension/Lexical_Developer_Tools_Extension.entitlements b/packages/lexical-devtools/safari-xcode/Lexical Developer Tools/Lexical Developer Tools Extension/Lexical_Developer_Tools_Extension.entitlements new file mode 100644 index 000000000000..f2ef3ae0265b --- /dev/null +++ b/packages/lexical-devtools/safari-xcode/Lexical Developer Tools/Lexical Developer Tools Extension/Lexical_Developer_Tools_Extension.entitlements @@ -0,0 +1,10 @@ + + + + + com.apple.security.app-sandbox + + com.apple.security.files.user-selected.read-only + + + diff --git a/packages/lexical-devtools/safari-xcode/Lexical Developer Tools/Lexical Developer Tools Extension/SafariWebExtensionHandler.swift b/packages/lexical-devtools/safari-xcode/Lexical Developer Tools/Lexical Developer Tools Extension/SafariWebExtensionHandler.swift new file mode 100644 index 000000000000..19e6d50d8d30 --- /dev/null +++ b/packages/lexical-devtools/safari-xcode/Lexical Developer Tools/Lexical Developer Tools Extension/SafariWebExtensionHandler.swift @@ -0,0 +1,38 @@ +// +// SafariWebExtensionHandler.swift +// Lexical Developer Tools Extension +// +// Created by Vladlen Fedosov on 5/14/24. +// + +import SafariServices +import os.log + +class SafariWebExtensionHandler: NSObject, NSExtensionRequestHandling { + + func beginRequest(with context: NSExtensionContext) { + let request = context.inputItems.first as? NSExtensionItem + + let profile: UUID? + if #available(iOS 17.0, macOS 14.0, *) { + profile = request?.userInfo?[SFExtensionProfileKey] as? UUID + } else { + profile = request?.userInfo?["profile"] as? UUID + } + + let message: Any? + if #available(iOS 17.0, macOS 14.0, *) { + message = request?.userInfo?[SFExtensionMessageKey] + } else { + message = request?.userInfo?["message"] + } + + os_log(.default, "Received message from browser.runtime.sendNativeMessage: %@ (profile: %@)", String(describing: message), profile?.uuidString ?? "none") + + let response = NSExtensionItem() + response.userInfo = [ SFExtensionMessageKey: [ "echo": message ] ] + + context.completeRequest(returningItems: [ response ], completionHandler: nil) + } + +} diff --git a/packages/lexical-devtools/safari-xcode/Lexical Developer Tools/Lexical Developer Tools.xcodeproj/project.pbxproj b/packages/lexical-devtools/safari-xcode/Lexical Developer Tools/Lexical Developer Tools.xcodeproj/project.pbxproj new file mode 100644 index 000000000000..6c0327fb0181 --- /dev/null +++ b/packages/lexical-devtools/safari-xcode/Lexical Developer Tools/Lexical Developer Tools.xcodeproj/project.pbxproj @@ -0,0 +1,624 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 56; + objects = { + +/* Begin PBXBuildFile section */ + B93AA6A02BF4162C00E27710 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = B93AA69F2BF4162C00E27710 /* AppDelegate.swift */; }; + B93AA6A42BF4162C00E27710 /* Base in Resources */ = {isa = PBXBuildFile; fileRef = B93AA6A32BF4162C00E27710 /* Base */; }; + B93AA6A62BF4162C00E27710 /* Icon.png in Resources */ = {isa = PBXBuildFile; fileRef = B93AA6A52BF4162C00E27710 /* Icon.png */; }; + B93AA6A82BF4162C00E27710 /* Style.css in Resources */ = {isa = PBXBuildFile; fileRef = B93AA6A72BF4162C00E27710 /* Style.css */; }; + B93AA6AA2BF4162C00E27710 /* Script.js in Resources */ = {isa = PBXBuildFile; fileRef = B93AA6A92BF4162C00E27710 /* Script.js */; }; + B93AA6AC2BF4162C00E27710 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = B93AA6AB2BF4162C00E27710 /* ViewController.swift */; }; + B93AA6AF2BF4162C00E27710 /* Base in Resources */ = {isa = PBXBuildFile; fileRef = B93AA6AE2BF4162C00E27710 /* Base */; }; + B93AA6B12BF4162F00E27710 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = B93AA6B02BF4162F00E27710 /* Assets.xcassets */; }; + B93AA6BA2BF4162F00E27710 /* Lexical Developer Tools Extension.appex in Embed Foundation Extensions */ = {isa = PBXBuildFile; fileRef = B93AA6B92BF4162F00E27710 /* Lexical Developer Tools Extension.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; }; + B93AA6BF2BF4163000E27710 /* SafariWebExtensionHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = B93AA6BE2BF4163000E27710 /* SafariWebExtensionHandler.swift */; }; + B93AA6D92BF4163000E27710 /* inspect.svg in Resources */ = {isa = PBXBuildFile; fileRef = B93AA6CC2BF4163000E27710 /* inspect.svg */; }; + B93AA6DA2BF4163000E27710 /* lexical.svg in Resources */ = {isa = PBXBuildFile; fileRef = B93AA6CD2BF4163000E27710 /* lexical.svg */; }; + B93AA6DB2BF4163000E27710 /* background.js in Resources */ = {isa = PBXBuildFile; fileRef = B93AA6CE2BF4163000E27710 /* background.js */; }; + B93AA6DC2BF4163000E27710 /* devtools.html in Resources */ = {isa = PBXBuildFile; fileRef = B93AA6CF2BF4163000E27710 /* devtools.html */; }; + B93AA6DD2BF4163000E27710 /* popup.html in Resources */ = {isa = PBXBuildFile; fileRef = B93AA6D02BF4163000E27710 /* popup.html */; }; + B93AA6DF2BF4163000E27710 /* chunks in Resources */ = {isa = PBXBuildFile; fileRef = B93AA6D22BF4163000E27710 /* chunks */; }; + B93AA6E02BF4163000E27710 /* content-scripts in Resources */ = {isa = PBXBuildFile; fileRef = B93AA6D32BF4163000E27710 /* content-scripts */; }; + B93AA6E12BF4163000E27710 /* injected.js in Resources */ = {isa = PBXBuildFile; fileRef = B93AA6D42BF4163000E27710 /* injected.js */; }; + B93AA6E22BF4163000E27710 /* manifest.json in Resources */ = {isa = PBXBuildFile; fileRef = B93AA6D52BF4163000E27710 /* manifest.json */; }; + B93AA6E32BF4163000E27710 /* icon in Resources */ = {isa = PBXBuildFile; fileRef = B93AA6D62BF4163000E27710 /* icon */; }; + B93AA6E42BF4163000E27710 /* assets in Resources */ = {isa = PBXBuildFile; fileRef = B93AA6D72BF4163000E27710 /* assets */; }; + B93AA6E52BF4163000E27710 /* devtools-panel.html in Resources */ = {isa = PBXBuildFile; fileRef = B93AA6D82BF4163000E27710 /* devtools-panel.html */; }; +/* End PBXBuildFile section */ + +/* Begin PBXContainerItemProxy section */ + B93AA6BB2BF4162F00E27710 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = B93AA6942BF4162B00E27710 /* Project object */; + proxyType = 1; + remoteGlobalIDString = B93AA6B82BF4162F00E27710; + remoteInfo = "Lexical Developer Tools Extension"; + }; +/* End PBXContainerItemProxy section */ + +/* Begin PBXCopyFilesBuildPhase section */ + B93AA6C72BF4163000E27710 /* Embed Foundation Extensions */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 13; + files = ( + B93AA6BA2BF4162F00E27710 /* Lexical Developer Tools Extension.appex in Embed Foundation Extensions */, + ); + name = "Embed Foundation Extensions"; + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXCopyFilesBuildPhase section */ + +/* Begin PBXFileReference section */ + B93AA69C2BF4162C00E27710 /* Lexical Developer Tools.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "Lexical Developer Tools.app"; sourceTree = BUILT_PRODUCTS_DIR; }; + B93AA69F2BF4162C00E27710 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; + B93AA6A32BF4162C00E27710 /* Base */ = {isa = PBXFileReference; lastKnownFileType = text.html; name = Base; path = ../Base.lproj/Main.html; sourceTree = ""; }; + B93AA6A52BF4162C00E27710 /* Icon.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = Icon.png; sourceTree = ""; }; + B93AA6A72BF4162C00E27710 /* Style.css */ = {isa = PBXFileReference; lastKnownFileType = text.css; path = Style.css; sourceTree = ""; }; + B93AA6A92BF4162C00E27710 /* Script.js */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.javascript; path = Script.js; sourceTree = ""; }; + B93AA6AB2BF4162C00E27710 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; + B93AA6AE2BF4162C00E27710 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; + B93AA6B02BF4162F00E27710 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; + B93AA6B22BF4162F00E27710 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + B93AA6B32BF4162F00E27710 /* Lexical_Developer_Tools.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = Lexical_Developer_Tools.entitlements; sourceTree = ""; }; + B93AA6B42BF4162F00E27710 /* Lexical Developer Tools.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = "Lexical Developer Tools.entitlements"; sourceTree = ""; }; + B93AA6B92BF4162F00E27710 /* Lexical Developer Tools Extension.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.app-extension"; includeInIndex = 0; path = "Lexical Developer Tools Extension.appex"; sourceTree = BUILT_PRODUCTS_DIR; }; + B93AA6BE2BF4163000E27710 /* SafariWebExtensionHandler.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SafariWebExtensionHandler.swift; sourceTree = ""; }; + B93AA6C02BF4163000E27710 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + B93AA6C12BF4163000E27710 /* Lexical_Developer_Tools_Extension.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = Lexical_Developer_Tools_Extension.entitlements; sourceTree = ""; }; + B93AA6CC2BF4163000E27710 /* inspect.svg */ = {isa = PBXFileReference; lastKnownFileType = text; name = inspect.svg; path = "../../../.output/safari-mv2/inspect.svg"; sourceTree = ""; }; + B93AA6CD2BF4163000E27710 /* lexical.svg */ = {isa = PBXFileReference; lastKnownFileType = text; name = lexical.svg; path = "../../../.output/safari-mv2/lexical.svg"; sourceTree = ""; }; + B93AA6CE2BF4163000E27710 /* background.js */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.javascript; name = background.js; path = "../../../.output/safari-mv2/background.js"; sourceTree = ""; }; + B93AA6CF2BF4163000E27710 /* devtools.html */ = {isa = PBXFileReference; lastKnownFileType = text.html; name = devtools.html; path = "../../../.output/safari-mv2/devtools.html"; sourceTree = ""; }; + B93AA6D02BF4163000E27710 /* popup.html */ = {isa = PBXFileReference; lastKnownFileType = text.html; name = popup.html; path = "../../../.output/safari-mv2/popup.html"; sourceTree = ""; }; + B93AA6D22BF4163000E27710 /* chunks */ = {isa = PBXFileReference; lastKnownFileType = folder; name = chunks; path = "../../../.output/safari-mv2/chunks"; sourceTree = ""; }; + B93AA6D32BF4163000E27710 /* content-scripts */ = {isa = PBXFileReference; lastKnownFileType = folder; name = "content-scripts"; path = "../../../.output/safari-mv2/content-scripts"; sourceTree = ""; }; + B93AA6D42BF4163000E27710 /* injected.js */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.javascript; name = injected.js; path = "../../../.output/safari-mv2/injected.js"; sourceTree = ""; }; + B93AA6D52BF4163000E27710 /* manifest.json */ = {isa = PBXFileReference; lastKnownFileType = text.json; name = manifest.json; path = "../../../.output/safari-mv2/manifest.json"; sourceTree = ""; }; + B93AA6D62BF4163000E27710 /* icon */ = {isa = PBXFileReference; lastKnownFileType = folder; name = icon; path = "../../../.output/safari-mv2/icon"; sourceTree = ""; }; + B93AA6D72BF4163000E27710 /* assets */ = {isa = PBXFileReference; lastKnownFileType = folder; name = assets; path = "../../../.output/safari-mv2/assets"; sourceTree = ""; }; + B93AA6D82BF4163000E27710 /* devtools-panel.html */ = {isa = PBXFileReference; lastKnownFileType = text.html; name = "devtools-panel.html"; path = "../../../.output/safari-mv2/devtools-panel.html"; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + B93AA6992BF4162B00E27710 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + B93AA6B62BF4162F00E27710 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + B93AA6932BF4162B00E27710 = { + isa = PBXGroup; + children = ( + B93AA69E2BF4162C00E27710 /* Lexical Developer Tools */, + B93AA6BD2BF4162F00E27710 /* Lexical Developer Tools Extension */, + B93AA69D2BF4162C00E27710 /* Products */, + ); + sourceTree = ""; + }; + B93AA69D2BF4162C00E27710 /* Products */ = { + isa = PBXGroup; + children = ( + B93AA69C2BF4162C00E27710 /* Lexical Developer Tools.app */, + B93AA6B92BF4162F00E27710 /* Lexical Developer Tools Extension.appex */, + ); + name = Products; + sourceTree = ""; + }; + B93AA69E2BF4162C00E27710 /* Lexical Developer Tools */ = { + isa = PBXGroup; + children = ( + B93AA69F2BF4162C00E27710 /* AppDelegate.swift */, + B93AA6AB2BF4162C00E27710 /* ViewController.swift */, + B93AA6AD2BF4162C00E27710 /* Main.storyboard */, + B93AA6B02BF4162F00E27710 /* Assets.xcassets */, + B93AA6B22BF4162F00E27710 /* Info.plist */, + B93AA6B32BF4162F00E27710 /* Lexical_Developer_Tools.entitlements */, + B93AA6B42BF4162F00E27710 /* Lexical Developer Tools.entitlements */, + B93AA6A12BF4162C00E27710 /* Resources */, + ); + path = "Lexical Developer Tools"; + sourceTree = ""; + }; + B93AA6A12BF4162C00E27710 /* Resources */ = { + isa = PBXGroup; + children = ( + B93AA6A22BF4162C00E27710 /* Main.html */, + B93AA6A52BF4162C00E27710 /* Icon.png */, + B93AA6A72BF4162C00E27710 /* Style.css */, + B93AA6A92BF4162C00E27710 /* Script.js */, + ); + path = Resources; + sourceTree = ""; + }; + B93AA6BD2BF4162F00E27710 /* Lexical Developer Tools Extension */ = { + isa = PBXGroup; + children = ( + B93AA6CB2BF4163000E27710 /* Resources */, + B93AA6BE2BF4163000E27710 /* SafariWebExtensionHandler.swift */, + B93AA6C02BF4163000E27710 /* Info.plist */, + B93AA6C12BF4163000E27710 /* Lexical_Developer_Tools_Extension.entitlements */, + ); + path = "Lexical Developer Tools Extension"; + sourceTree = ""; + }; + B93AA6CB2BF4163000E27710 /* Resources */ = { + isa = PBXGroup; + children = ( + B93AA6CC2BF4163000E27710 /* inspect.svg */, + B93AA6CD2BF4163000E27710 /* lexical.svg */, + B93AA6CE2BF4163000E27710 /* background.js */, + B93AA6CF2BF4163000E27710 /* devtools.html */, + B93AA6D02BF4163000E27710 /* popup.html */, + B93AA6D22BF4163000E27710 /* chunks */, + B93AA6D32BF4163000E27710 /* content-scripts */, + B93AA6D42BF4163000E27710 /* injected.js */, + B93AA6D52BF4163000E27710 /* manifest.json */, + B93AA6D62BF4163000E27710 /* icon */, + B93AA6D72BF4163000E27710 /* assets */, + B93AA6D82BF4163000E27710 /* devtools-panel.html */, + ); + name = Resources; + path = "Lexical Developer Tools Extension"; + sourceTree = SOURCE_ROOT; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + B93AA69B2BF4162B00E27710 /* Lexical Developer Tools */ = { + isa = PBXNativeTarget; + buildConfigurationList = B93AA6C82BF4163000E27710 /* Build configuration list for PBXNativeTarget "Lexical Developer Tools" */; + buildPhases = ( + B93AA6982BF4162B00E27710 /* Sources */, + B93AA6992BF4162B00E27710 /* Frameworks */, + B93AA69A2BF4162B00E27710 /* Resources */, + B93AA6C72BF4163000E27710 /* Embed Foundation Extensions */, + ); + buildRules = ( + ); + dependencies = ( + B93AA6BC2BF4162F00E27710 /* PBXTargetDependency */, + ); + name = "Lexical Developer Tools"; + productName = "Lexical Developer Tools"; + productReference = B93AA69C2BF4162C00E27710 /* Lexical Developer Tools.app */; + productType = "com.apple.product-type.application"; + }; + B93AA6B82BF4162F00E27710 /* Lexical Developer Tools Extension */ = { + isa = PBXNativeTarget; + buildConfigurationList = B93AA6C42BF4163000E27710 /* Build configuration list for PBXNativeTarget "Lexical Developer Tools Extension" */; + buildPhases = ( + B93AA6B52BF4162F00E27710 /* Sources */, + B93AA6B62BF4162F00E27710 /* Frameworks */, + B93AA6B72BF4162F00E27710 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = "Lexical Developer Tools Extension"; + productName = "Lexical Developer Tools Extension"; + productReference = B93AA6B92BF4162F00E27710 /* Lexical Developer Tools Extension.appex */; + productType = "com.apple.product-type.app-extension"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + B93AA6942BF4162B00E27710 /* Project object */ = { + isa = PBXProject; + attributes = { + BuildIndependentTargetsInParallel = 1; + LastSwiftUpdateCheck = 1530; + LastUpgradeCheck = 1530; + TargetAttributes = { + B93AA69B2BF4162B00E27710 = { + CreatedOnToolsVersion = 15.3; + }; + B93AA6B82BF4162F00E27710 = { + CreatedOnToolsVersion = 15.3; + }; + }; + }; + buildConfigurationList = B93AA6972BF4162B00E27710 /* Build configuration list for PBXProject "Lexical Developer Tools" */; + compatibilityVersion = "Xcode 14.0"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = B93AA6932BF4162B00E27710; + productRefGroup = B93AA69D2BF4162C00E27710 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + B93AA69B2BF4162B00E27710 /* Lexical Developer Tools */, + B93AA6B82BF4162F00E27710 /* Lexical Developer Tools Extension */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + B93AA69A2BF4162B00E27710 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + B93AA6A62BF4162C00E27710 /* Icon.png in Resources */, + B93AA6AA2BF4162C00E27710 /* Script.js in Resources */, + B93AA6A42BF4162C00E27710 /* Base in Resources */, + B93AA6A82BF4162C00E27710 /* Style.css in Resources */, + B93AA6B12BF4162F00E27710 /* Assets.xcassets in Resources */, + B93AA6AF2BF4162C00E27710 /* Base in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + B93AA6B72BF4162F00E27710 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + B93AA6DC2BF4163000E27710 /* devtools.html in Resources */, + B93AA6E12BF4163000E27710 /* injected.js in Resources */, + B93AA6E22BF4163000E27710 /* manifest.json in Resources */, + B93AA6DD2BF4163000E27710 /* popup.html in Resources */, + B93AA6E32BF4163000E27710 /* icon in Resources */, + B93AA6D92BF4163000E27710 /* inspect.svg in Resources */, + B93AA6E52BF4163000E27710 /* devtools-panel.html in Resources */, + B93AA6DF2BF4163000E27710 /* chunks in Resources */, + B93AA6DB2BF4163000E27710 /* background.js in Resources */, + B93AA6E42BF4163000E27710 /* assets in Resources */, + B93AA6DA2BF4163000E27710 /* lexical.svg in Resources */, + B93AA6E02BF4163000E27710 /* content-scripts in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + B93AA6982BF4162B00E27710 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + B93AA6AC2BF4162C00E27710 /* ViewController.swift in Sources */, + B93AA6A02BF4162C00E27710 /* AppDelegate.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + B93AA6B52BF4162F00E27710 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + B93AA6BF2BF4163000E27710 /* SafariWebExtensionHandler.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXTargetDependency section */ + B93AA6BC2BF4162F00E27710 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = B93AA6B82BF4162F00E27710 /* Lexical Developer Tools Extension */; + targetProxy = B93AA6BB2BF4162F00E27710 /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + +/* Begin PBXVariantGroup section */ + B93AA6A22BF4162C00E27710 /* Main.html */ = { + isa = PBXVariantGroup; + children = ( + B93AA6A32BF4162C00E27710 /* Base */, + ); + name = Main.html; + sourceTree = ""; + }; + B93AA6AD2BF4162C00E27710 /* Main.storyboard */ = { + isa = PBXVariantGroup; + children = ( + B93AA6AE2BF4162C00E27710 /* Base */, + ); + name = Main.storyboard; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + B93AA6C22BF4163000E27710 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++20"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + ENABLE_USER_SCRIPT_SANDBOXING = YES; + GCC_C_LANGUAGE_STANDARD = gnu17; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + LOCALIZATION_PREFERS_STRING_CATALOGS = YES; + MACOSX_DEPLOYMENT_TARGET = 14.4; + MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; + MTL_FAST_MATH = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = macosx; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = "DEBUG $(inherited)"; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + }; + name = Debug; + }; + B93AA6C32BF4163000E27710 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++20"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_USER_SCRIPT_SANDBOXING = YES; + GCC_C_LANGUAGE_STANDARD = gnu17; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + LOCALIZATION_PREFERS_STRING_CATALOGS = YES; + MACOSX_DEPLOYMENT_TARGET = 14.4; + MTL_ENABLE_DEBUG_INFO = NO; + MTL_FAST_MATH = YES; + SDKROOT = macosx; + SWIFT_COMPILATION_MODE = wholemodule; + }; + name = Release; + }; + B93AA6C52BF4163000E27710 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + CODE_SIGN_ENTITLEMENTS = "Lexical Developer Tools Extension/Lexical_Developer_Tools_Extension.entitlements"; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + ENABLE_HARDENED_RUNTIME = YES; + GENERATE_INFOPLIST_FILE = YES; + INFOPLIST_FILE = "Lexical Developer Tools Extension/Info.plist"; + INFOPLIST_KEY_CFBundleDisplayName = "Lexical Developer Tools Extension"; + INFOPLIST_KEY_NSHumanReadableCopyright = ""; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/../Frameworks", + "@executable_path/../../../../Frameworks", + ); + MACOSX_DEPLOYMENT_TARGET = 10.14; + MARKETING_VERSION = 1.0; + OTHER_LDFLAGS = ( + "-framework", + SafariServices, + ); + PRODUCT_BUNDLE_IDENTIFIER = "dev.lexical.Lexical-Developer-Tools.Extension"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SKIP_INSTALL = YES; + SWIFT_EMIT_LOC_STRINGS = YES; + SWIFT_VERSION = 5.0; + }; + name = Debug; + }; + B93AA6C62BF4163000E27710 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + CODE_SIGN_ENTITLEMENTS = "Lexical Developer Tools Extension/Lexical_Developer_Tools_Extension.entitlements"; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + ENABLE_HARDENED_RUNTIME = YES; + GENERATE_INFOPLIST_FILE = YES; + INFOPLIST_FILE = "Lexical Developer Tools Extension/Info.plist"; + INFOPLIST_KEY_CFBundleDisplayName = "Lexical Developer Tools Extension"; + INFOPLIST_KEY_NSHumanReadableCopyright = ""; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/../Frameworks", + "@executable_path/../../../../Frameworks", + ); + MACOSX_DEPLOYMENT_TARGET = 10.14; + MARKETING_VERSION = 1.0; + OTHER_LDFLAGS = ( + "-framework", + SafariServices, + ); + PRODUCT_BUNDLE_IDENTIFIER = "dev.lexical.Lexical-Developer-Tools.Extension"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SKIP_INSTALL = YES; + SWIFT_EMIT_LOC_STRINGS = YES; + SWIFT_VERSION = 5.0; + }; + name = Release; + }; + B93AA6C92BF4163000E27710 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; + CODE_SIGN_ENTITLEMENTS = "Lexical Developer Tools/Lexical Developer Tools.entitlements"; + CODE_SIGN_STYLE = Automatic; + COMBINE_HIDPI_IMAGES = YES; + CURRENT_PROJECT_VERSION = 1; + ENABLE_HARDENED_RUNTIME = YES; + GENERATE_INFOPLIST_FILE = YES; + INFOPLIST_FILE = "Lexical Developer Tools/Info.plist"; + INFOPLIST_KEY_CFBundleDisplayName = "Lexical Developer Tools"; + INFOPLIST_KEY_NSHumanReadableCopyright = ""; + INFOPLIST_KEY_NSMainStoryboardFile = Main; + INFOPLIST_KEY_NSPrincipalClass = NSApplication; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/../Frameworks", + ); + MACOSX_DEPLOYMENT_TARGET = 10.14; + MARKETING_VERSION = 1.0; + OTHER_LDFLAGS = ( + "-framework", + SafariServices, + "-framework", + WebKit, + ); + PRODUCT_BUNDLE_IDENTIFIER = "dev.lexical.Lexical-Developer-Tools"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_EMIT_LOC_STRINGS = YES; + SWIFT_VERSION = 5.0; + }; + name = Debug; + }; + B93AA6CA2BF4163000E27710 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; + CODE_SIGN_ENTITLEMENTS = "Lexical Developer Tools/Lexical Developer Tools.entitlements"; + CODE_SIGN_STYLE = Automatic; + COMBINE_HIDPI_IMAGES = YES; + CURRENT_PROJECT_VERSION = 1; + ENABLE_HARDENED_RUNTIME = YES; + GENERATE_INFOPLIST_FILE = YES; + INFOPLIST_FILE = "Lexical Developer Tools/Info.plist"; + INFOPLIST_KEY_CFBundleDisplayName = "Lexical Developer Tools"; + INFOPLIST_KEY_NSHumanReadableCopyright = ""; + INFOPLIST_KEY_NSMainStoryboardFile = Main; + INFOPLIST_KEY_NSPrincipalClass = NSApplication; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/../Frameworks", + ); + MACOSX_DEPLOYMENT_TARGET = 10.14; + MARKETING_VERSION = 1.0; + OTHER_LDFLAGS = ( + "-framework", + SafariServices, + "-framework", + WebKit, + ); + PRODUCT_BUNDLE_IDENTIFIER = "dev.lexical.Lexical-Developer-Tools"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_EMIT_LOC_STRINGS = YES; + SWIFT_VERSION = 5.0; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + B93AA6972BF4162B00E27710 /* Build configuration list for PBXProject "Lexical Developer Tools" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + B93AA6C22BF4163000E27710 /* Debug */, + B93AA6C32BF4163000E27710 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + B93AA6C42BF4163000E27710 /* Build configuration list for PBXNativeTarget "Lexical Developer Tools Extension" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + B93AA6C52BF4163000E27710 /* Debug */, + B93AA6C62BF4163000E27710 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + B93AA6C82BF4163000E27710 /* Build configuration list for PBXNativeTarget "Lexical Developer Tools" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + B93AA6C92BF4163000E27710 /* Debug */, + B93AA6CA2BF4163000E27710 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = B93AA6942BF4162B00E27710 /* Project object */; +} diff --git a/packages/lexical-devtools/safari-xcode/Lexical Developer Tools/Lexical Developer Tools/AppDelegate.swift b/packages/lexical-devtools/safari-xcode/Lexical Developer Tools/Lexical Developer Tools/AppDelegate.swift new file mode 100644 index 000000000000..de47fe2b2ceb --- /dev/null +++ b/packages/lexical-devtools/safari-xcode/Lexical Developer Tools/Lexical Developer Tools/AppDelegate.swift @@ -0,0 +1,21 @@ +// +// AppDelegate.swift +// Lexical Developer Tools +// +// Created by Vladlen Fedosov on 5/14/24. +// + +import Cocoa + +@main +class AppDelegate: NSObject, NSApplicationDelegate { + + func applicationDidFinishLaunching(_ notification: Notification) { + // Override point for customization after application launch. + } + + func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool { + return true + } + +} diff --git a/packages/lexical-devtools/safari-xcode/Lexical Developer Tools/Lexical Developer Tools/Assets.xcassets/AccentColor.colorset/Contents.json b/packages/lexical-devtools/safari-xcode/Lexical Developer Tools/Lexical Developer Tools/Assets.xcassets/AccentColor.colorset/Contents.json new file mode 100644 index 000000000000..0afb3cf0eec8 --- /dev/null +++ b/packages/lexical-devtools/safari-xcode/Lexical Developer Tools/Lexical Developer Tools/Assets.xcassets/AccentColor.colorset/Contents.json @@ -0,0 +1,11 @@ +{ + "colors": [ + { + "idiom": "universal" + } + ], + "info": { + "author": "xcode", + "version": 1 + } +} diff --git a/packages/lexical-devtools/safari-xcode/Lexical Developer Tools/Lexical Developer Tools/Assets.xcassets/AppIcon.appiconset/Contents.json b/packages/lexical-devtools/safari-xcode/Lexical Developer Tools/Lexical Developer Tools/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 000000000000..50cb3489e09c --- /dev/null +++ b/packages/lexical-devtools/safari-xcode/Lexical Developer Tools/Lexical Developer Tools/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,68 @@ +{ + "images": [ + { + "size": "16x16", + "idiom": "mac", + "filename": "mac-icon-16@1x.png", + "scale": "1x" + }, + { + "size": "16x16", + "idiom": "mac", + "filename": "mac-icon-16@2x.png", + "scale": "2x" + }, + { + "size": "32x32", + "idiom": "mac", + "filename": "mac-icon-32@1x.png", + "scale": "1x" + }, + { + "size": "32x32", + "idiom": "mac", + "filename": "mac-icon-32@2x.png", + "scale": "2x" + }, + { + "size": "128x128", + "idiom": "mac", + "filename": "mac-icon-128@1x.png", + "scale": "1x" + }, + { + "size": "128x128", + "idiom": "mac", + "filename": "mac-icon-128@2x.png", + "scale": "2x" + }, + { + "size": "256x256", + "idiom": "mac", + "filename": "mac-icon-256@1x.png", + "scale": "1x" + }, + { + "size": "256x256", + "idiom": "mac", + "filename": "mac-icon-256@2x.png", + "scale": "2x" + }, + { + "size": "512x512", + "idiom": "mac", + "filename": "mac-icon-512@1x.png", + "scale": "1x" + }, + { + "size": "512x512", + "idiom": "mac", + "filename": "mac-icon-512@2x.png", + "scale": "2x" + } + ], + "info": { + "version": 1, + "author": "xcode" + } +} diff --git a/packages/lexical-devtools/safari-xcode/Lexical Developer Tools/Lexical Developer Tools/Assets.xcassets/AppIcon.appiconset/mac-icon-128@1x.png b/packages/lexical-devtools/safari-xcode/Lexical Developer Tools/Lexical Developer Tools/Assets.xcassets/AppIcon.appiconset/mac-icon-128@1x.png new file mode 100644 index 000000000000..30fe8673387b Binary files /dev/null and b/packages/lexical-devtools/safari-xcode/Lexical Developer Tools/Lexical Developer Tools/Assets.xcassets/AppIcon.appiconset/mac-icon-128@1x.png differ diff --git a/packages/lexical-devtools/safari-xcode/Lexical Developer Tools/Lexical Developer Tools/Assets.xcassets/AppIcon.appiconset/mac-icon-128@2x.png b/packages/lexical-devtools/safari-xcode/Lexical Developer Tools/Lexical Developer Tools/Assets.xcassets/AppIcon.appiconset/mac-icon-128@2x.png new file mode 100644 index 000000000000..9c42895401d1 Binary files /dev/null and b/packages/lexical-devtools/safari-xcode/Lexical Developer Tools/Lexical Developer Tools/Assets.xcassets/AppIcon.appiconset/mac-icon-128@2x.png differ diff --git a/packages/lexical-devtools/safari-xcode/Lexical Developer Tools/Lexical Developer Tools/Assets.xcassets/AppIcon.appiconset/mac-icon-16@1x.png b/packages/lexical-devtools/safari-xcode/Lexical Developer Tools/Lexical Developer Tools/Assets.xcassets/AppIcon.appiconset/mac-icon-16@1x.png new file mode 100644 index 000000000000..755c05b5deec Binary files /dev/null and b/packages/lexical-devtools/safari-xcode/Lexical Developer Tools/Lexical Developer Tools/Assets.xcassets/AppIcon.appiconset/mac-icon-16@1x.png differ diff --git a/packages/lexical-devtools/safari-xcode/Lexical Developer Tools/Lexical Developer Tools/Assets.xcassets/AppIcon.appiconset/mac-icon-16@2x.png b/packages/lexical-devtools/safari-xcode/Lexical Developer Tools/Lexical Developer Tools/Assets.xcassets/AppIcon.appiconset/mac-icon-16@2x.png new file mode 100644 index 000000000000..15410bfb48bb Binary files /dev/null and b/packages/lexical-devtools/safari-xcode/Lexical Developer Tools/Lexical Developer Tools/Assets.xcassets/AppIcon.appiconset/mac-icon-16@2x.png differ diff --git a/packages/lexical-devtools/safari-xcode/Lexical Developer Tools/Lexical Developer Tools/Assets.xcassets/AppIcon.appiconset/mac-icon-256@1x.png b/packages/lexical-devtools/safari-xcode/Lexical Developer Tools/Lexical Developer Tools/Assets.xcassets/AppIcon.appiconset/mac-icon-256@1x.png new file mode 100644 index 000000000000..9c42895401d1 Binary files /dev/null and b/packages/lexical-devtools/safari-xcode/Lexical Developer Tools/Lexical Developer Tools/Assets.xcassets/AppIcon.appiconset/mac-icon-256@1x.png differ diff --git a/packages/lexical-devtools/safari-xcode/Lexical Developer Tools/Lexical Developer Tools/Assets.xcassets/AppIcon.appiconset/mac-icon-256@2x.png b/packages/lexical-devtools/safari-xcode/Lexical Developer Tools/Lexical Developer Tools/Assets.xcassets/AppIcon.appiconset/mac-icon-256@2x.png new file mode 100644 index 000000000000..7cf9eb717c3b Binary files /dev/null and b/packages/lexical-devtools/safari-xcode/Lexical Developer Tools/Lexical Developer Tools/Assets.xcassets/AppIcon.appiconset/mac-icon-256@2x.png differ diff --git a/packages/lexical-devtools/safari-xcode/Lexical Developer Tools/Lexical Developer Tools/Assets.xcassets/AppIcon.appiconset/mac-icon-32@1x.png b/packages/lexical-devtools/safari-xcode/Lexical Developer Tools/Lexical Developer Tools/Assets.xcassets/AppIcon.appiconset/mac-icon-32@1x.png new file mode 100644 index 000000000000..15410bfb48bb Binary files /dev/null and b/packages/lexical-devtools/safari-xcode/Lexical Developer Tools/Lexical Developer Tools/Assets.xcassets/AppIcon.appiconset/mac-icon-32@1x.png differ diff --git a/packages/lexical-devtools/safari-xcode/Lexical Developer Tools/Lexical Developer Tools/Assets.xcassets/AppIcon.appiconset/mac-icon-32@2x.png b/packages/lexical-devtools/safari-xcode/Lexical Developer Tools/Lexical Developer Tools/Assets.xcassets/AppIcon.appiconset/mac-icon-32@2x.png new file mode 100644 index 000000000000..890b4217b9dc Binary files /dev/null and b/packages/lexical-devtools/safari-xcode/Lexical Developer Tools/Lexical Developer Tools/Assets.xcassets/AppIcon.appiconset/mac-icon-32@2x.png differ diff --git a/packages/lexical-devtools/safari-xcode/Lexical Developer Tools/Lexical Developer Tools/Assets.xcassets/AppIcon.appiconset/mac-icon-512@1x.png b/packages/lexical-devtools/safari-xcode/Lexical Developer Tools/Lexical Developer Tools/Assets.xcassets/AppIcon.appiconset/mac-icon-512@1x.png new file mode 100644 index 000000000000..7cf9eb717c3b Binary files /dev/null and b/packages/lexical-devtools/safari-xcode/Lexical Developer Tools/Lexical Developer Tools/Assets.xcassets/AppIcon.appiconset/mac-icon-512@1x.png differ diff --git a/packages/lexical-devtools/safari-xcode/Lexical Developer Tools/Lexical Developer Tools/Assets.xcassets/AppIcon.appiconset/mac-icon-512@2x.png b/packages/lexical-devtools/safari-xcode/Lexical Developer Tools/Lexical Developer Tools/Assets.xcassets/AppIcon.appiconset/mac-icon-512@2x.png new file mode 100644 index 000000000000..456c99a52086 Binary files /dev/null and b/packages/lexical-devtools/safari-xcode/Lexical Developer Tools/Lexical Developer Tools/Assets.xcassets/AppIcon.appiconset/mac-icon-512@2x.png differ diff --git a/packages/lexical-devtools/safari-xcode/Lexical Developer Tools/Lexical Developer Tools/Assets.xcassets/Contents.json b/packages/lexical-devtools/safari-xcode/Lexical Developer Tools/Lexical Developer Tools/Assets.xcassets/Contents.json new file mode 100644 index 000000000000..74d6a722cf39 --- /dev/null +++ b/packages/lexical-devtools/safari-xcode/Lexical Developer Tools/Lexical Developer Tools/Assets.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info": { + "author": "xcode", + "version": 1 + } +} diff --git a/packages/lexical-devtools/safari-xcode/Lexical Developer Tools/Lexical Developer Tools/Assets.xcassets/LargeIcon.imageset/Contents.json b/packages/lexical-devtools/safari-xcode/Lexical Developer Tools/Lexical Developer Tools/Assets.xcassets/LargeIcon.imageset/Contents.json new file mode 100644 index 000000000000..ae524e7542bd --- /dev/null +++ b/packages/lexical-devtools/safari-xcode/Lexical Developer Tools/Lexical Developer Tools/Assets.xcassets/LargeIcon.imageset/Contents.json @@ -0,0 +1,20 @@ +{ + "images": [ + { + "idiom": "universal", + "scale": "1x" + }, + { + "idiom": "universal", + "scale": "2x" + }, + { + "idiom": "universal", + "scale": "3x" + } + ], + "info": { + "author": "xcode", + "version": 1 + } +} diff --git a/packages/lexical-devtools/safari-xcode/Lexical Developer Tools/Lexical Developer Tools/Base.lproj/Main.html b/packages/lexical-devtools/safari-xcode/Lexical Developer Tools/Lexical Developer Tools/Base.lproj/Main.html new file mode 100644 index 000000000000..acdfbf974e73 --- /dev/null +++ b/packages/lexical-devtools/safari-xcode/Lexical Developer Tools/Lexical Developer Tools/Base.lproj/Main.html @@ -0,0 +1,36 @@ + + + + + + + + + + + + + Lexical Developer Tools Icon +

+ You can turn on Lexical Developer Tools’s extension in Safari Extensions + preferences. +

+

+ Lexical Developer Tools’s extension is currently on. You can turn it off + in Safari Extensions preferences. +

+

+ Lexical Developer Tools’s extension is currently off. You can turn it on + in Safari Extensions preferences. +

+ + + diff --git a/packages/lexical-devtools/safari-xcode/Lexical Developer Tools/Lexical Developer Tools/Base.lproj/Main.storyboard b/packages/lexical-devtools/safari-xcode/Lexical Developer Tools/Lexical Developer Tools/Base.lproj/Main.storyboard new file mode 100644 index 000000000000..bdfbba66b047 --- /dev/null +++ b/packages/lexical-devtools/safari-xcode/Lexical Developer Tools/Lexical Developer Tools/Base.lproj/Main.storyboard @@ -0,0 +1,124 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/packages/lexical-devtools/safari-xcode/Lexical Developer Tools/Lexical Developer Tools/Info.plist b/packages/lexical-devtools/safari-xcode/Lexical Developer Tools/Lexical Developer Tools/Info.plist new file mode 100644 index 000000000000..04ed2a4fb0ab --- /dev/null +++ b/packages/lexical-devtools/safari-xcode/Lexical Developer Tools/Lexical Developer Tools/Info.plist @@ -0,0 +1,8 @@ + + + + + SFSafariWebExtensionConverterVersion + 15.3 + + diff --git a/packages/lexical-devtools/safari-xcode/Lexical Developer Tools/Lexical Developer Tools/Lexical Developer Tools.entitlements b/packages/lexical-devtools/safari-xcode/Lexical Developer Tools/Lexical Developer Tools/Lexical Developer Tools.entitlements new file mode 100644 index 000000000000..625af03d99b2 --- /dev/null +++ b/packages/lexical-devtools/safari-xcode/Lexical Developer Tools/Lexical Developer Tools/Lexical Developer Tools.entitlements @@ -0,0 +1,12 @@ + + + + + com.apple.security.app-sandbox + + com.apple.security.files.user-selected.read-only + + com.apple.security.network.client + + + diff --git a/packages/lexical-devtools/safari-xcode/Lexical Developer Tools/Lexical Developer Tools/Lexical_Developer_Tools.entitlements b/packages/lexical-devtools/safari-xcode/Lexical Developer Tools/Lexical Developer Tools/Lexical_Developer_Tools.entitlements new file mode 100644 index 000000000000..18aff0ce43c2 --- /dev/null +++ b/packages/lexical-devtools/safari-xcode/Lexical Developer Tools/Lexical Developer Tools/Lexical_Developer_Tools.entitlements @@ -0,0 +1,10 @@ + + + + + com.apple.security.app-sandbox + + com.apple.security.files.user-selected.read-only + + + diff --git a/packages/lexical-devtools/safari-xcode/Lexical Developer Tools/Lexical Developer Tools/Resources/Icon.png b/packages/lexical-devtools/safari-xcode/Lexical Developer Tools/Lexical Developer Tools/Resources/Icon.png new file mode 100644 index 000000000000..5028124debf6 Binary files /dev/null and b/packages/lexical-devtools/safari-xcode/Lexical Developer Tools/Lexical Developer Tools/Resources/Icon.png differ diff --git a/packages/lexical-devtools/safari-xcode/Lexical Developer Tools/Lexical Developer Tools/Resources/Script.js b/packages/lexical-devtools/safari-xcode/Lexical Developer Tools/Lexical Developer Tools/Resources/Script.js new file mode 100644 index 000000000000..052594e82bcf --- /dev/null +++ b/packages/lexical-devtools/safari-xcode/Lexical Developer Tools/Lexical Developer Tools/Resources/Script.js @@ -0,0 +1,39 @@ +/** + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + */ +/* eslint-disable strict */ + +// eslint-disable-next-line no-unused-vars +function show(enabled, useSettingsInsteadOfPreferences) { + if (useSettingsInsteadOfPreferences) { + document.getElementsByClassName('state-on')[0].innerText = + 'Lexical Developer Tools’s extension is currently on. You can turn it off in the Extensions section of Safari Settings.'; + document.getElementsByClassName('state-off')[0].innerText = + 'Lexical Developer Tools’s extension is currently off. You can turn it on in the Extensions section of Safari Settings.'; + document.getElementsByClassName('state-unknown')[0].innerText = + 'You can turn on Lexical Developer Tools’s extension in the Extensions section of Safari Settings.'; + document.getElementsByClassName('open-preferences')[0].innerText = + 'Quit and Open Safari Settings…'; + } + + if (typeof enabled === 'boolean') { + document.body.classList.toggle(`state-on`, enabled); + document.body.classList.toggle(`state-off`, !enabled); + } else { + document.body.classList.remove(`state-on`); + document.body.classList.remove(`state-off`); + } +} + +function openPreferences() { + // eslint-disable-next-line no-undef + webkit.messageHandlers.controller.postMessage('open-preferences'); +} + +document + .querySelector('button.open-preferences') + .addEventListener('click', openPreferences); diff --git a/packages/lexical-devtools/safari-xcode/Lexical Developer Tools/Lexical Developer Tools/Resources/Style.css b/packages/lexical-devtools/safari-xcode/Lexical Developer Tools/Lexical Developer Tools/Resources/Style.css new file mode 100644 index 000000000000..ef4dcde3314b --- /dev/null +++ b/packages/lexical-devtools/safari-xcode/Lexical Developer Tools/Lexical Developer Tools/Resources/Style.css @@ -0,0 +1,45 @@ +* { + -webkit-user-select: none; + -webkit-user-drag: none; + cursor: default; +} + +:root { + color-scheme: light dark; + + --spacing: 20px; +} + +html { + height: 100%; +} + +body { + display: flex; + align-items: center; + justify-content: center; + flex-direction: column; + + gap: var(--spacing); + margin: 0 calc(var(--spacing) * 2); + height: 100%; + + font: -apple-system-short-body; + text-align: center; +} + +body:not(.state-on, .state-off) :is(.state-on, .state-off) { + display: none; +} + +body.state-on :is(.state-off, .state-unknown) { + display: none; +} + +body.state-off :is(.state-on, .state-unknown) { + display: none; +} + +button { + font-size: 1em; +} diff --git a/packages/lexical-devtools/safari-xcode/Lexical Developer Tools/Lexical Developer Tools/ViewController.swift b/packages/lexical-devtools/safari-xcode/Lexical Developer Tools/Lexical Developer Tools/ViewController.swift new file mode 100644 index 000000000000..5b64734dc377 --- /dev/null +++ b/packages/lexical-devtools/safari-xcode/Lexical Developer Tools/Lexical Developer Tools/ViewController.swift @@ -0,0 +1,57 @@ +// +// ViewController.swift +// Lexical Developer Tools +// +// Created by Vladlen Fedosov on 5/14/24. +// + +import Cocoa +import SafariServices +import WebKit + +let extensionBundleIdentifier = "dev.lexical.Lexical-Developer-Tools.Extension" + +class ViewController: NSViewController, WKNavigationDelegate, WKScriptMessageHandler { + + @IBOutlet var webView: WKWebView! + + override func viewDidLoad() { + super.viewDidLoad() + + self.webView.navigationDelegate = self + + self.webView.configuration.userContentController.add(self, name: "controller") + + self.webView.loadFileURL(Bundle.main.url(forResource: "Main", withExtension: "html")!, allowingReadAccessTo: Bundle.main.resourceURL!) + } + + func webView(_ webView: WKWebView, didFinish navigation: WKNavigation!) { + SFSafariExtensionManager.getStateOfSafariExtension(withIdentifier: extensionBundleIdentifier) { (state, error) in + guard let state = state, error == nil else { + // Insert code to inform the user that something went wrong. + return + } + + DispatchQueue.main.async { + if #available(macOS 13, *) { + webView.evaluateJavaScript("show(\(state.isEnabled), true)") + } else { + webView.evaluateJavaScript("show(\(state.isEnabled), false)") + } + } + } + } + + func userContentController(_ userContentController: WKUserContentController, didReceive message: WKScriptMessage) { + if (message.body as! String != "open-preferences") { + return; + } + + SFSafariApplication.showPreferencesForExtension(withIdentifier: extensionBundleIdentifier) { error in + DispatchQueue.main.async { + NSApplication.shared.terminate(nil) + } + } + } + +} diff --git a/packages/lexical-devtools/src/entrypoints/background/ActionIconWatchdog.ts b/packages/lexical-devtools/src/entrypoints/background/ActionIconWatchdog.ts index ee27b29348be..849720fba842 100644 --- a/packages/lexical-devtools/src/entrypoints/background/ActionIconWatchdog.ts +++ b/packages/lexical-devtools/src/entrypoints/background/ActionIconWatchdog.ts @@ -8,7 +8,7 @@ import type {Tabs} from 'wxt/browser'; import type {StoreApi} from 'zustand'; -import {IS_FIREFOX} from 'shared/environment'; +import {IS_FIREFOX, IS_SAFARI} from 'shared/environment'; import {ExtensionState} from '../../store'; @@ -39,7 +39,8 @@ export default class ActionIconWatchdog { lexicalBuildType: 'restricted' | 'enabled', tabId: number, ) { - const action = IS_FIREFOX ? browser.browserAction : browser.action; + const action = + IS_FIREFOX || IS_SAFARI ? browser.browserAction : browser.action; await action.setIcon({ path: {