Merge branch 'feature/safari' into develop

# Conflicts:
#	src/components/searchModes/fuzzyMode.tsx
This commit is contained in:
EnixCoda 2022-02-12 21:54:05 +08:00
commit 162fda29dd
37 changed files with 1562 additions and 81 deletions

View file

@ -13,6 +13,10 @@ build:
rm -rf dist
yarn build
copy-build-safari:
rm -rf Safari/Gitako/Gitako\ Extension/Resources/*
cd dist && cp -r . ../Safari/Gitako/Gitako\ Extension/Resources
test:
yarn test

28
Safari/.gitignore vendored Normal file
View file

@ -0,0 +1,28 @@
# Xcode
#
# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore
## User settings
xcuserdata/
## compatibility with Xcode 8 and earlier (ignoring not required starting Xcode 9)
*.xcscmblueprint
*.xccheckout
## compatibility with Xcode 3 and earlier (ignoring not required starting Xcode 4)
build/
DerivedData/
*.moved-aside
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3
## Gcc Patch
/*.gcno
Resources

View file

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.security.app-sandbox</key>
<true/>
<key>com.apple.security.files.user-selected.read-only</key>
<true/>
</dict>
</plist>

View file

@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleDisplayName</key>
<string>Gitako Extension</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string>
<key>CFBundleShortVersionString</key>
<string>$(MARKETING_VERSION)</string>
<key>CFBundleVersion</key>
<string>$(MARKETING_VERSION)</string>
<key>LSMinimumSystemVersion</key>
<string>$(MACOSX_DEPLOYMENT_TARGET)</string>
<key>NSExtension</key>
<dict>
<key>NSExtensionPointIdentifier</key>
<string>com.apple.Safari.web-extension</string>
<key>NSExtensionPrincipalClass</key>
<string>$(PRODUCT_MODULE_NAME).SafariWebExtensionHandler</string>
</dict>
</dict>
</plist>

View file

@ -0,0 +1,14 @@
//
// SafariWebExtensionHandler.swift
// Gitako Extension
//
// Created by Enix on 13/6/2021.
//
import SafariServices
import os.log
let SFExtensionMessageKey = "message"
class SafariWebExtensionHandler: NSObject {
}

View file

@ -0,0 +1,787 @@
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 50;
objects = {
/* Begin PBXBuildFile section */
0EA3131B2675C39B00D5C092 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0EA3131A2675C39B00D5C092 /* AppDelegate.swift */; };
0EA3131E2675C39B00D5C092 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 0EA3131C2675C39B00D5C092 /* Main.storyboard */; };
0EA313202675C39B00D5C092 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0EA3131F2675C39B00D5C092 /* ViewController.swift */; };
0EA313222675C39C00D5C092 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 0EA313212675C39C00D5C092 /* Assets.xcassets */; };
0EA3132D2675C39D00D5C092 /* GitakoTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0EA3132C2675C39D00D5C092 /* GitakoTests.swift */; };
0EA313382675C39D00D5C092 /* GitakoUITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0EA313372675C39D00D5C092 /* GitakoUITests.swift */; };
0EA3133F2675C39D00D5C092 /* Gitako Extension.appex in Embed App Extensions */ = {isa = PBXBuildFile; fileRef = 0EA3133E2675C39D00D5C092 /* Gitako Extension.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };
0EA313442675C39D00D5C092 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0EA313432675C39D00D5C092 /* Cocoa.framework */; };
0EA313472675C39D00D5C092 /* SafariWebExtensionHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0EA313462675C39D00D5C092 /* SafariWebExtensionHandler.swift */; };
0EA3134E2675C39D00D5C092 /* manifest.json in Resources */ = {isa = PBXBuildFile; fileRef = 0EA3134D2675C39D00D5C092 /* manifest.json */; };
0EA313502675C39D00D5C092 /* background.js in Resources */ = {isa = PBXBuildFile; fileRef = 0EA3134F2675C39D00D5C092 /* background.js */; };
0EA313522675C39D00D5C092 /* content.js in Resources */ = {isa = PBXBuildFile; fileRef = 0EA313512675C39D00D5C092 /* content.js */; };
0EA3136A2675C82800D5C092 /* content.js in Resources */ = {isa = PBXBuildFile; fileRef = 0EA313512675C39D00D5C092 /* content.js */; };
0EA313722675C9A300D5C092 /* firefox-shim.js in Resources */ = {isa = PBXBuildFile; fileRef = 0EA3136B2675C9A300D5C092 /* firefox-shim.js */; };
0EA313732675C9A300D5C092 /* content.css in Resources */ = {isa = PBXBuildFile; fileRef = 0EA3136C2675C9A300D5C092 /* content.css */; };
0EA313742675C9A300D5C092 /* browser-polyfill.js in Resources */ = {isa = PBXBuildFile; fileRef = 0EA313702675C9A300D5C092 /* browser-polyfill.js */; };
0EA313752675C9A300D5C092 /* icons in Resources */ = {isa = PBXBuildFile; fileRef = 0EA313712675C9A300D5C092 /* icons */; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
0EA313292675C39C00D5C092 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 0EA3130E2675C39B00D5C092 /* Project object */;
proxyType = 1;
remoteGlobalIDString = 0EA313152675C39B00D5C092;
remoteInfo = Gitako;
};
0EA313342675C39D00D5C092 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 0EA3130E2675C39B00D5C092 /* Project object */;
proxyType = 1;
remoteGlobalIDString = 0EA313152675C39B00D5C092;
remoteInfo = Gitako;
};
0EA313402675C39D00D5C092 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 0EA3130E2675C39B00D5C092 /* Project object */;
proxyType = 1;
remoteGlobalIDString = 0EA3133D2675C39D00D5C092;
remoteInfo = "Gitako Extension";
};
/* End PBXContainerItemProxy section */
/* Begin PBXCopyFilesBuildPhase section */
0EA313602675C39D00D5C092 /* Embed App Extensions */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 2147483647;
dstPath = "";
dstSubfolderSpec = 13;
files = (
0EA3133F2675C39D00D5C092 /* Gitako Extension.appex in Embed App Extensions */,
);
name = "Embed App Extensions";
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */
0EA313162675C39B00D5C092 /* Gitako.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Gitako.app; sourceTree = BUILT_PRODUCTS_DIR; };
0EA313192675C39B00D5C092 /* Gitako.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = Gitako.entitlements; sourceTree = "<group>"; };
0EA3131A2675C39B00D5C092 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
0EA3131D2675C39B00D5C092 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
0EA3131F2675C39B00D5C092 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = "<group>"; };
0EA313212675C39C00D5C092 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
0EA313232675C39C00D5C092 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
0EA313282675C39C00D5C092 /* GitakoTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = GitakoTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
0EA3132C2675C39D00D5C092 /* GitakoTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GitakoTests.swift; sourceTree = "<group>"; };
0EA3132E2675C39D00D5C092 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
0EA313332675C39D00D5C092 /* GitakoUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = GitakoUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
0EA313372675C39D00D5C092 /* GitakoUITests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GitakoUITests.swift; sourceTree = "<group>"; };
0EA313392675C39D00D5C092 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
0EA3133E2675C39D00D5C092 /* Gitako Extension.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.app-extension"; includeInIndex = 0; path = "Gitako Extension.appex"; sourceTree = BUILT_PRODUCTS_DIR; };
0EA313432675C39D00D5C092 /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = System/Library/Frameworks/Cocoa.framework; sourceTree = SDKROOT; };
0EA313462675C39D00D5C092 /* SafariWebExtensionHandler.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SafariWebExtensionHandler.swift; sourceTree = "<group>"; };
0EA3134D2675C39D00D5C092 /* manifest.json */ = {isa = PBXFileReference; lastKnownFileType = text.json; path = manifest.json; sourceTree = "<group>"; };
0EA3134F2675C39D00D5C092 /* background.js */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.javascript; path = background.js; sourceTree = "<group>"; };
0EA313512675C39D00D5C092 /* content.js */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.javascript; path = content.js; sourceTree = "<group>"; };
0EA313592675C39D00D5C092 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
0EA3135A2675C39D00D5C092 /* Gitako_Extension.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = Gitako_Extension.entitlements; sourceTree = "<group>"; };
0EA3136B2675C9A300D5C092 /* firefox-shim.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = "firefox-shim.js"; sourceTree = "<group>"; };
0EA3136C2675C9A300D5C092 /* content.css */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.css; path = content.css; sourceTree = "<group>"; };
0EA3136D2675C9A300D5C092 /* content.js.map */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = "sourcecode.module-map"; path = content.js.map; sourceTree = "<group>"; };
0EA3136E2675C9A300D5C092 /* content.css.map */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = "sourcecode.module-map"; path = content.css.map; sourceTree = "<group>"; };
0EA3136F2675C9A300D5C092 /* background.js.map */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = "sourcecode.module-map"; path = background.js.map; sourceTree = "<group>"; };
0EA313702675C9A300D5C092 /* browser-polyfill.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = "browser-polyfill.js"; sourceTree = "<group>"; };
0EA313712675C9A300D5C092 /* icons */ = {isa = PBXFileReference; lastKnownFileType = folder; path = icons; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
0EA313132675C39B00D5C092 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
0EA313252675C39C00D5C092 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
0EA313302675C39D00D5C092 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
0EA3133B2675C39D00D5C092 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
0EA313442675C39D00D5C092 /* Cocoa.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
0EA3130D2675C39B00D5C092 = {
isa = PBXGroup;
children = (
0EA313182675C39B00D5C092 /* Gitako */,
0EA3132B2675C39C00D5C092 /* GitakoTests */,
0EA313362675C39D00D5C092 /* GitakoUITests */,
0EA313452675C39D00D5C092 /* Gitako Extension */,
0EA313422675C39D00D5C092 /* Frameworks */,
0EA313172675C39B00D5C092 /* Products */,
);
sourceTree = "<group>";
};
0EA313172675C39B00D5C092 /* Products */ = {
isa = PBXGroup;
children = (
0EA313162675C39B00D5C092 /* Gitako.app */,
0EA313282675C39C00D5C092 /* GitakoTests.xctest */,
0EA313332675C39D00D5C092 /* GitakoUITests.xctest */,
0EA3133E2675C39D00D5C092 /* Gitako Extension.appex */,
);
name = Products;
sourceTree = "<group>";
};
0EA313182675C39B00D5C092 /* Gitako */ = {
isa = PBXGroup;
children = (
0EA313192675C39B00D5C092 /* Gitako.entitlements */,
0EA3131A2675C39B00D5C092 /* AppDelegate.swift */,
0EA3131C2675C39B00D5C092 /* Main.storyboard */,
0EA3131F2675C39B00D5C092 /* ViewController.swift */,
0EA313212675C39C00D5C092 /* Assets.xcassets */,
0EA313232675C39C00D5C092 /* Info.plist */,
);
path = Gitako;
sourceTree = "<group>";
};
0EA3132B2675C39C00D5C092 /* GitakoTests */ = {
isa = PBXGroup;
children = (
0EA3132C2675C39D00D5C092 /* GitakoTests.swift */,
0EA3132E2675C39D00D5C092 /* Info.plist */,
);
path = GitakoTests;
sourceTree = "<group>";
};
0EA313362675C39D00D5C092 /* GitakoUITests */ = {
isa = PBXGroup;
children = (
0EA313372675C39D00D5C092 /* GitakoUITests.swift */,
0EA313392675C39D00D5C092 /* Info.plist */,
);
path = GitakoUITests;
sourceTree = "<group>";
};
0EA313422675C39D00D5C092 /* Frameworks */ = {
isa = PBXGroup;
children = (
0EA313432675C39D00D5C092 /* Cocoa.framework */,
);
name = Frameworks;
sourceTree = "<group>";
};
0EA313452675C39D00D5C092 /* Gitako Extension */ = {
isa = PBXGroup;
children = (
0EA313462675C39D00D5C092 /* SafariWebExtensionHandler.swift */,
0EA313592675C39D00D5C092 /* Info.plist */,
0EA3135A2675C39D00D5C092 /* Gitako_Extension.entitlements */,
0EA313482675C39D00D5C092 /* Resources */,
);
path = "Gitako Extension";
sourceTree = "<group>";
};
0EA313482675C39D00D5C092 /* Resources */ = {
isa = PBXGroup;
children = (
0EA3136F2675C9A300D5C092 /* background.js.map */,
0EA313702675C9A300D5C092 /* browser-polyfill.js */,
0EA3136C2675C9A300D5C092 /* content.css */,
0EA3136E2675C9A300D5C092 /* content.css.map */,
0EA3136D2675C9A300D5C092 /* content.js.map */,
0EA3136B2675C9A300D5C092 /* firefox-shim.js */,
0EA313712675C9A300D5C092 /* icons */,
0EA3134D2675C39D00D5C092 /* manifest.json */,
0EA3134F2675C39D00D5C092 /* background.js */,
0EA313512675C39D00D5C092 /* content.js */,
);
path = Resources;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
0EA313152675C39B00D5C092 /* Gitako */ = {
isa = PBXNativeTarget;
buildConfigurationList = 0EA313612675C39D00D5C092 /* Build configuration list for PBXNativeTarget "Gitako" */;
buildPhases = (
0EA313122675C39B00D5C092 /* Sources */,
0EA313132675C39B00D5C092 /* Frameworks */,
0EA313142675C39B00D5C092 /* Resources */,
0EA313602675C39D00D5C092 /* Embed App Extensions */,
);
buildRules = (
);
dependencies = (
0EA313412675C39D00D5C092 /* PBXTargetDependency */,
);
name = Gitako;
productName = Gitako;
productReference = 0EA313162675C39B00D5C092 /* Gitako.app */;
productType = "com.apple.product-type.application";
};
0EA313272675C39C00D5C092 /* GitakoTests */ = {
isa = PBXNativeTarget;
buildConfigurationList = 0EA313642675C39D00D5C092 /* Build configuration list for PBXNativeTarget "GitakoTests" */;
buildPhases = (
0EA313242675C39C00D5C092 /* Sources */,
0EA313252675C39C00D5C092 /* Frameworks */,
0EA313262675C39C00D5C092 /* Resources */,
);
buildRules = (
);
dependencies = (
0EA3132A2675C39C00D5C092 /* PBXTargetDependency */,
);
name = GitakoTests;
productName = GitakoTests;
productReference = 0EA313282675C39C00D5C092 /* GitakoTests.xctest */;
productType = "com.apple.product-type.bundle.unit-test";
};
0EA313322675C39D00D5C092 /* GitakoUITests */ = {
isa = PBXNativeTarget;
buildConfigurationList = 0EA313672675C39D00D5C092 /* Build configuration list for PBXNativeTarget "GitakoUITests" */;
buildPhases = (
0EA3132F2675C39D00D5C092 /* Sources */,
0EA313302675C39D00D5C092 /* Frameworks */,
0EA313312675C39D00D5C092 /* Resources */,
);
buildRules = (
);
dependencies = (
0EA313352675C39D00D5C092 /* PBXTargetDependency */,
);
name = GitakoUITests;
productName = GitakoUITests;
productReference = 0EA313332675C39D00D5C092 /* GitakoUITests.xctest */;
productType = "com.apple.product-type.bundle.ui-testing";
};
0EA3133D2675C39D00D5C092 /* Gitako Extension */ = {
isa = PBXNativeTarget;
buildConfigurationList = 0EA3135D2675C39D00D5C092 /* Build configuration list for PBXNativeTarget "Gitako Extension" */;
buildPhases = (
0EA3133A2675C39D00D5C092 /* Sources */,
0EA3133B2675C39D00D5C092 /* Frameworks */,
0EA3133C2675C39D00D5C092 /* Resources */,
);
buildRules = (
);
dependencies = (
);
name = "Gitako Extension";
productName = "Gitako Extension";
productReference = 0EA3133E2675C39D00D5C092 /* Gitako Extension.appex */;
productType = "com.apple.product-type.app-extension";
};
/* End PBXNativeTarget section */
/* Begin PBXProject section */
0EA3130E2675C39B00D5C092 /* Project object */ = {
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 1250;
LastUpgradeCheck = 1250;
TargetAttributes = {
0EA313152675C39B00D5C092 = {
CreatedOnToolsVersion = 12.5;
};
0EA313272675C39C00D5C092 = {
CreatedOnToolsVersion = 12.5;
TestTargetID = 0EA313152675C39B00D5C092;
};
0EA313322675C39D00D5C092 = {
CreatedOnToolsVersion = 12.5;
TestTargetID = 0EA313152675C39B00D5C092;
};
0EA3133D2675C39D00D5C092 = {
CreatedOnToolsVersion = 12.5;
};
};
};
buildConfigurationList = 0EA313112675C39B00D5C092 /* Build configuration list for PBXProject "Gitako" */;
compatibilityVersion = "Xcode 9.3";
developmentRegion = en;
hasScannedForEncodings = 0;
knownRegions = (
en,
Base,
);
mainGroup = 0EA3130D2675C39B00D5C092;
productRefGroup = 0EA313172675C39B00D5C092 /* Products */;
projectDirPath = "";
projectRoot = "";
targets = (
0EA313152675C39B00D5C092 /* Gitako */,
0EA313272675C39C00D5C092 /* GitakoTests */,
0EA313322675C39D00D5C092 /* GitakoUITests */,
0EA3133D2675C39D00D5C092 /* Gitako Extension */,
);
};
/* End PBXProject section */
/* Begin PBXResourcesBuildPhase section */
0EA313142675C39B00D5C092 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
0EA3136A2675C82800D5C092 /* content.js in Resources */,
0EA313222675C39C00D5C092 /* Assets.xcassets in Resources */,
0EA3131E2675C39B00D5C092 /* Main.storyboard in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
0EA313262675C39C00D5C092 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
0EA313312675C39D00D5C092 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
0EA3133C2675C39D00D5C092 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
0EA313502675C39D00D5C092 /* background.js in Resources */,
0EA3134E2675C39D00D5C092 /* manifest.json in Resources */,
0EA313522675C39D00D5C092 /* content.js in Resources */,
0EA313732675C9A300D5C092 /* content.css in Resources */,
0EA313742675C9A300D5C092 /* browser-polyfill.js in Resources */,
0EA313752675C9A300D5C092 /* icons in Resources */,
0EA313722675C9A300D5C092 /* firefox-shim.js in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXResourcesBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
0EA313122675C39B00D5C092 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
0EA313202675C39B00D5C092 /* ViewController.swift in Sources */,
0EA3131B2675C39B00D5C092 /* AppDelegate.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
0EA313242675C39C00D5C092 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
0EA3132D2675C39D00D5C092 /* GitakoTests.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
0EA3132F2675C39D00D5C092 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
0EA313382675C39D00D5C092 /* GitakoUITests.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
0EA3133A2675C39D00D5C092 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
0EA313472675C39D00D5C092 /* SafariWebExtensionHandler.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin PBXTargetDependency section */
0EA3132A2675C39C00D5C092 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = 0EA313152675C39B00D5C092 /* Gitako */;
targetProxy = 0EA313292675C39C00D5C092 /* PBXContainerItemProxy */;
};
0EA313352675C39D00D5C092 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = 0EA313152675C39B00D5C092 /* Gitako */;
targetProxy = 0EA313342675C39D00D5C092 /* PBXContainerItemProxy */;
};
0EA313412675C39D00D5C092 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = 0EA3133D2675C39D00D5C092 /* Gitako Extension */;
targetProxy = 0EA313402675C39D00D5C092 /* PBXContainerItemProxy */;
};
/* End PBXTargetDependency section */
/* Begin PBXVariantGroup section */
0EA3131C2675C39B00D5C092 /* Main.storyboard */ = {
isa = PBXVariantGroup;
children = (
0EA3131D2675C39B00D5C092 /* Base */,
);
name = Main.storyboard;
sourceTree = "<group>";
};
/* End PBXVariantGroup section */
/* Begin XCBuildConfiguration section */
0EA3135B2675C39D00D5C092 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
CLANG_CXX_LIBRARY = "libc++";
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;
GCC_C_LANGUAGE_STANDARD = gnu11;
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;
MACOSX_DEPLOYMENT_TARGET = 10.14;
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = macosx;
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
};
name = Debug;
};
0EA3135C2675C39D00D5C092 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
CLANG_CXX_LIBRARY = "libc++";
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;
GCC_C_LANGUAGE_STANDARD = gnu11;
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;
MACOSX_DEPLOYMENT_TARGET = 10.14;
MTL_ENABLE_DEBUG_INFO = NO;
MTL_FAST_MATH = YES;
SDKROOT = macosx;
SWIFT_COMPILATION_MODE = wholemodule;
SWIFT_OPTIMIZATION_LEVEL = "-O";
};
name = Release;
};
0EA3135E2675C39D00D5C092 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
CODE_SIGN_ENTITLEMENTS = "Gitako Extension/Gitako_Extension.entitlements";
CODE_SIGN_IDENTITY = "-";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
INFOPLIST_FILE = "Gitako Extension/Info.plist";
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/../Frameworks",
"@executable_path/../../../../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 10.14;
MARKETING_VERSION = 3.7.0;
PRODUCT_BUNDLE_IDENTIFIER = enixcoda.Gitako.Extension;
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
SWIFT_VERSION = 5.0;
};
name = Debug;
};
0EA3135F2675C39D00D5C092 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
CODE_SIGN_ENTITLEMENTS = "Gitako Extension/Gitako_Extension.entitlements";
CODE_SIGN_IDENTITY = "-";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
INFOPLIST_FILE = "Gitako Extension/Info.plist";
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/../Frameworks",
"@executable_path/../../../../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 10.14;
MARKETING_VERSION = 3.7.0;
PRODUCT_BUNDLE_IDENTIFIER = enixcoda.Gitako.Extension;
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
SWIFT_VERSION = 5.0;
};
name = Release;
};
0EA313622675C39D00D5C092 /* 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 = Gitako/Gitako.entitlements;
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 1;
INFOPLIST_FILE = Gitako/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 10.14;
MARKETING_VERSION = 3.7.0;
PRODUCT_BUNDLE_IDENTIFIER = enixcoda.Gitako;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 5.0;
};
name = Debug;
};
0EA313632675C39D00D5C092 /* 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 = Gitako/Gitako.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = KVT97368XL;
INFOPLIST_FILE = Gitako/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 10.14;
MARKETING_VERSION = 3.7.0;
PRODUCT_BUNDLE_IDENTIFIER = enixcoda.Gitako;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 5.0;
};
name = Release;
};
0EA313652675C39D00D5C092 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
BUNDLE_LOADER = "$(TEST_HOST)";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
INFOPLIST_FILE = GitakoTests/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/../Frameworks",
"@loader_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 10.14;
PRODUCT_BUNDLE_IDENTIFIER = enixcoda.GitakoTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 5.0;
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Gitako.app/Contents/MacOS/Gitako";
};
name = Debug;
};
0EA313662675C39D00D5C092 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
BUNDLE_LOADER = "$(TEST_HOST)";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
INFOPLIST_FILE = GitakoTests/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/../Frameworks",
"@loader_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 10.14;
PRODUCT_BUNDLE_IDENTIFIER = enixcoda.GitakoTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 5.0;
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Gitako.app/Contents/MacOS/Gitako";
};
name = Release;
};
0EA313682675C39D00D5C092 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
INFOPLIST_FILE = GitakoUITests/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/../Frameworks",
"@loader_path/../Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = enixcoda.GitakoUITests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 5.0;
TEST_TARGET_NAME = Gitako;
};
name = Debug;
};
0EA313692675C39D00D5C092 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
INFOPLIST_FILE = GitakoUITests/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/../Frameworks",
"@loader_path/../Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = enixcoda.GitakoUITests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 5.0;
TEST_TARGET_NAME = Gitako;
};
name = Release;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
0EA313112675C39B00D5C092 /* Build configuration list for PBXProject "Gitako" */ = {
isa = XCConfigurationList;
buildConfigurations = (
0EA3135B2675C39D00D5C092 /* Debug */,
0EA3135C2675C39D00D5C092 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
0EA3135D2675C39D00D5C092 /* Build configuration list for PBXNativeTarget "Gitako Extension" */ = {
isa = XCConfigurationList;
buildConfigurations = (
0EA3135E2675C39D00D5C092 /* Debug */,
0EA3135F2675C39D00D5C092 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
0EA313612675C39D00D5C092 /* Build configuration list for PBXNativeTarget "Gitako" */ = {
isa = XCConfigurationList;
buildConfigurations = (
0EA313622675C39D00D5C092 /* Debug */,
0EA313632675C39D00D5C092 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
0EA313642675C39D00D5C092 /* Build configuration list for PBXNativeTarget "GitakoTests" */ = {
isa = XCConfigurationList;
buildConfigurations = (
0EA313652675C39D00D5C092 /* Debug */,
0EA313662675C39D00D5C092 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
0EA313672675C39D00D5C092 /* Build configuration list for PBXNativeTarget "GitakoUITests" */ = {
isa = XCConfigurationList;
buildConfigurations = (
0EA313682675C39D00D5C092 /* Debug */,
0EA313692675C39D00D5C092 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
rootObject = 0EA3130E2675C39B00D5C092 /* Project object */;
}

View file

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "self:">
</FileRef>
</Workspace>

View file

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>

View file

@ -0,0 +1,25 @@
//
// AppDelegate.swift
// Gitako
//
// Created by Enix on 13/6/2021.
//
import Cocoa
@main
class AppDelegate: NSObject, NSApplicationDelegate {
func applicationDidFinishLaunching(_ notification: Notification) {
// Insert code here to initialize your application
}
func applicationWillTerminate(_ notification: Notification) {
// Insert code here to tear down your application
}
func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool {
return true
}
}

View file

@ -0,0 +1,11 @@
{
"colors" : [
{
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

View file

@ -0,0 +1,61 @@
{
"images" : [
{
"idiom" : "mac",
"scale" : "1x",
"size" : "16x16"
},
{
"idiom" : "mac",
"scale" : "2x",
"size" : "16x16"
},
{
"idiom" : "mac",
"scale" : "1x",
"size" : "32x32"
},
{
"filename" : "Gitako-64.png",
"idiom" : "mac",
"scale" : "2x",
"size" : "32x32"
},
{
"filename" : "Gitako-128.png",
"idiom" : "mac",
"scale" : "1x",
"size" : "128x128"
},
{
"idiom" : "mac",
"scale" : "2x",
"size" : "128x128"
},
{
"filename" : "Gitako-256.png",
"idiom" : "mac",
"scale" : "1x",
"size" : "256x256"
},
{
"idiom" : "mac",
"scale" : "2x",
"size" : "256x256"
},
{
"idiom" : "mac",
"scale" : "1x",
"size" : "512x512"
},
{
"idiom" : "mac",
"scale" : "2x",
"size" : "512x512"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

View file

@ -0,0 +1,6 @@
{
"info" : {
"author" : "xcode",
"version" : 1
}
}

View file

@ -0,0 +1,167 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.Storyboard.XIB" version="3.0" toolsVersion="16085" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" initialViewController="B8D-0N-5wS">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="16085"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
<!--Application-->
<scene sceneID="JPo-4y-FX3">
<objects>
<application id="hnw-xV-0zn" sceneMemberID="viewController">
<menu key="mainMenu" title="Main Menu" systemMenu="main" id="AYu-sK-qS6">
<items>
<menuItem title="Gitako" id="1Xt-HY-uBw">
<modifierMask key="keyEquivalentModifierMask"/>
<menu key="submenu" title="Gitako" systemMenu="apple" id="uQy-DD-JDr">
<items>
<menuItem title="About Gitako" id="5kV-Vb-QxS">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="orderFrontStandardAboutPanel:" target="Ady-hI-5gd" id="Exp-CZ-Vem"/>
</connections>
</menuItem>
<menuItem isSeparatorItem="YES" id="VOq-y0-SEH"/>
<menuItem title="Hide Gitako" keyEquivalent="h" id="Olw-nP-bQN">
<connections>
<action selector="hide:" target="Ady-hI-5gd" id="PnN-Uc-m68"/>
</connections>
</menuItem>
<menuItem title="Hide Others" keyEquivalent="h" id="Vdr-fp-XzO">
<modifierMask key="keyEquivalentModifierMask" option="YES" command="YES"/>
<connections>
<action selector="hideOtherApplications:" target="Ady-hI-5gd" id="VT4-aY-XCT"/>
</connections>
</menuItem>
<menuItem title="Show All" id="Kd2-mp-pUS">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="unhideAllApplications:" target="Ady-hI-5gd" id="Dhg-Le-xox"/>
</connections>
</menuItem>
<menuItem isSeparatorItem="YES" id="kCx-OE-vgT"/>
<menuItem title="Quit Gitako" keyEquivalent="q" id="4sb-4s-VLi">
<connections>
<action selector="terminate:" target="Ady-hI-5gd" id="Te7-pn-YzF"/>
</connections>
</menuItem>
</items>
</menu>
</menuItem>
<menuItem title="Help" id="wpr-3q-Mcd">
<modifierMask key="keyEquivalentModifierMask"/>
<menu key="submenu" title="Help" systemMenu="help" id="F2S-fz-NVQ">
<items>
<menuItem title="Gitako Help" keyEquivalent="?" id="FKE-Sm-Kum">
<connections>
<action selector="showHelp:" target="Ady-hI-5gd" id="y7X-2Q-9no"/>
</connections>
</menuItem>
</items>
</menu>
</menuItem>
</items>
</menu>
<connections>
<outlet property="delegate" destination="Voe-Tx-rLC" id="PrD-fu-P6m"/>
</connections>
</application>
<customObject id="Voe-Tx-rLC" customClass="AppDelegate" customModuleProvider="target"/>
<customObject id="YLy-65-1bz" customClass="NSFontManager"/>
<customObject id="Ady-hI-5gd" userLabel="First Responder" customClass="NSResponder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="76" y="-134"/>
</scene>
<!--Window Controller-->
<scene sceneID="R2V-B0-nI4">
<objects>
<windowController showSeguePresentationStyle="single" id="B8D-0N-5wS" sceneMemberID="viewController">
<window key="window" title="Gitako" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" restorable="NO" releasedWhenClosed="NO" animationBehavior="default" titlebarAppearsTransparent="YES" id="IQv-IB-iLA">
<windowStyleMask key="styleMask" titled="YES" closable="YES"/>
<windowCollectionBehavior key="collectionBehavior" fullScreenNone="YES"/>
<rect key="contentRect" x="196" y="240" width="480" height="270"/>
<rect key="screenRect" x="0.0" y="0.0" width="1680" height="1027"/>
<connections>
<outlet property="delegate" destination="B8D-0N-5wS" id="98r-iN-zZc"/>
</connections>
</window>
<connections>
<segue destination="XfG-lQ-9wD" kind="relationship" relationship="window.shadowedContentViewController" id="cq2-FE-JQM"/>
</connections>
</windowController>
<customObject id="Oky-zY-oP4" userLabel="First Responder" customClass="NSResponder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="75" y="250"/>
</scene>
<!--View Controller-->
<scene sceneID="hIz-AP-VOD">
<objects>
<viewController id="XfG-lQ-9wD" customClass="ViewController" customModuleProvider="target" sceneMemberID="viewController">
<view key="view" id="m2S-Jp-Qdl">
<rect key="frame" x="0.0" y="0.0" width="480" height="344"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<stackView distribution="fill" orientation="vertical" alignment="centerX" spacing="42" horizontalStackHuggingPriority="249.99998474121094" verticalStackHuggingPriority="249.99998474121094" detachesHiddenViews="YES" translatesAutoresizingMaskIntoConstraints="NO" id="ZLV-xE-AGT">
<rect key="frame" x="0.0" y="34" width="480" height="265"/>
<subviews>
<imageView horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="FWV-e2-WQh" userLabel="IconView">
<rect key="frame" x="176" y="137" width="128" height="128"/>
<imageCell key="cell" refusesFirstResponder="YES" alignment="left" image="AppIcon" id="Hhb-TZ-Dhg"/>
</imageView>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="EB0-ac-UZR">
<rect key="frame" x="38" y="63" width="404" height="32"/>
<constraints>
<constraint firstAttribute="width" relation="lessThanOrEqual" constant="400" id="pZE-0p-Ce8"/>
</constraints>
<textFieldCell key="cell" alignment="center" title="App Name's extension is currently off. You can turn it on in Safari Extensions preferences." id="S7v-7o-3vW">
<font key="font" metaFont="system"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="ooh-eV-eLQ">
<rect key="frame" x="79" y="-7" width="322" height="32"/>
<buttonCell key="cell" type="push" title="Quit and Open Safari Extensions Preferences…" alternateTitle="Install" bezelStyle="rounded" alignment="center" lineBreakMode="truncatingMiddle" state="on" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="Srx-0j-A4D">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="system"/>
<string key="keyEquivalent" base64-UTF8="YES">
DQ
</string>
<connections>
<action selector="openSafariExtensionPreferences:" target="XfG-lQ-9wD" id="vKk-Xb-MPh"/>
</connections>
</buttonCell>
</button>
</subviews>
<visibilityPriorities>
<integer value="1000"/>
<integer value="1000"/>
<integer value="1000"/>
</visibilityPriorities>
<customSpacing>
<real value="3.4028234663852886e+38"/>
<real value="3.4028234663852886e+38"/>
<real value="3.4028234663852886e+38"/>
</customSpacing>
</stackView>
</subviews>
<constraints>
<constraint firstAttribute="trailing" secondItem="ZLV-xE-AGT" secondAttribute="trailing" id="7aD-Ze-9ed"/>
<constraint firstItem="ZLV-xE-AGT" firstAttribute="top" secondItem="m2S-Jp-Qdl" secondAttribute="top" constant="45" id="AJ3-sx-ZQx"/>
<constraint firstAttribute="bottom" secondItem="ZLV-xE-AGT" secondAttribute="bottom" constant="34" id="KVY-ss-lTJ"/>
<constraint firstItem="ZLV-xE-AGT" firstAttribute="leading" secondItem="m2S-Jp-Qdl" secondAttribute="leading" id="mT6-ee-vkp"/>
</constraints>
</view>
<connections>
<outlet property="appNameLabel" destination="EB0-ac-UZR" id="SDO-j1-PQa"/>
</connections>
</viewController>
<customObject id="rPt-NT-nkU" userLabel="First Responder" customClass="NSResponder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="75" y="655"/>
</scene>
</scenes>
<resources>
<image name="AppIcon" width="128" height="128"/>
</resources>
</document>

View file

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.security.app-sandbox</key>
<true/>
<key>com.apple.security.files.user-selected.read-only</key>
<true/>
</dict>
</plist>

View file

@ -0,0 +1,32 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIconFile</key>
<string></string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string>
<key>CFBundleShortVersionString</key>
<string>$(MARKETING_VERSION)</string>
<key>CFBundleVersion</key>
<string>$(MARKETING_VERSION)</string>
<key>LSApplicationCategoryType</key>
<string>public.app-category.productivity</string>
<key>LSMinimumSystemVersion</key>
<string>$(MACOSX_DEPLOYMENT_TARGET)</string>
<key>NSMainStoryboardFile</key>
<string>Main</string>
<key>NSPrincipalClass</key>
<string>NSApplication</string>
</dict>
</plist>

View file

@ -0,0 +1,51 @@
//
// ViewController.swift
// Gitako
//
// Created by Enix on 13/6/2021.
//
import Cocoa
import SafariServices.SFSafariApplication
import SafariServices.SFSafariExtensionManager
let appName = "Gitako"
let extensionBundleIdentifier = "enixcoda.Gitako.Extension"
class ViewController: NSViewController {
@IBOutlet var appNameLabel: NSTextField!
override func viewDidLoad() {
super.viewDidLoad()
self.appNameLabel.stringValue = appName
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 (state.isEnabled) {
self.appNameLabel.stringValue = "\(appName)'s extension is currently on. You can close this window now."
} else {
self.appNameLabel.stringValue = "\(appName)'s extension is currently off. You can turn it on in Safari Extensions preferences."
}
}
}
}
@IBAction func openSafariExtensionPreferences(_ sender: AnyObject?) {
SFSafariApplication.showPreferencesForExtension(withIdentifier: extensionBundleIdentifier) { error in
guard error == nil else {
// Insert code to inform the user that something went wrong.
return
}
DispatchQueue.main.async {
NSApplication.shared.terminate(nil)
}
}
}
}

View file

@ -0,0 +1,33 @@
//
// GitakoTests.swift
// GitakoTests
//
// Created by Enix on 13/6/2021.
//
import XCTest
@testable import Gitako
class GitakoTests: XCTestCase {
override func setUpWithError() throws {
// Put setup code here. This method is called before the invocation of each test method in the class.
}
override func tearDownWithError() throws {
// Put teardown code here. This method is called after the invocation of each test method in the class.
}
func testExample() throws {
// This is an example of a functional test case.
// Use XCTAssert and related functions to verify your tests produce the correct results.
}
func testPerformanceExample() throws {
// This is an example of a performance test case.
self.measure {
// Put the code you want to measure the time of here.
}
}
}

View file

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleVersion</key>
<string>1</string>
</dict>
</plist>

View file

@ -0,0 +1,42 @@
//
// GitakoUITests.swift
// GitakoUITests
//
// Created by Enix on 13/6/2021.
//
import XCTest
class GitakoUITests: XCTestCase {
override func setUpWithError() throws {
// Put setup code here. This method is called before the invocation of each test method in the class.
// In UI tests it is usually best to stop immediately when a failure occurs.
continueAfterFailure = false
// In UI tests its important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this.
}
override func tearDownWithError() throws {
// Put teardown code here. This method is called after the invocation of each test method in the class.
}
func testExample() throws {
// UI tests must launch the application that they test.
let app = XCUIApplication()
app.launch()
// Use recording to get started writing UI tests.
// Use XCTAssert and related functions to verify your tests produce the correct results.
}
func testLaunchPerformance() throws {
if #available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 7.0, *) {
// This measures how long it takes to launch your application.
measure(metrics: [XCTApplicationLaunchMetric()]) {
XCUIApplication().launch()
}
}
}
}

View file

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleVersion</key>
<string>1</string>
</dict>
</plist>

View file

@ -8,7 +8,8 @@
"private": true,
"homepage": "https://github.com/EnixCoda/Gitako",
"scripts": {
"start": "VERSION=dev-v$(node scripts/get-version.js) webpack --watch",
"dev": "VERSION=dev-v$(node scripts/get-version.js) webpack --watch",
"dev-safari": "TARGET=safari yarn run dev",
"debug-firefox": "web-ext run -s dist",
"analyse-bundle": "ANALYSE= NODE_ENV=production webpack",
"postinstall": "rm -rf node_modules/@types/react-native && node scripts/fix-pjax-api",

View file

@ -1,18 +1,23 @@
import * as React from 'react'
export function Highlight(props: { text: string; match?: RegExp }) {
export function Highlight(props: { text: string; match?: RegExp | string }) {
const { text, match } = props
const $match = React.useMemo(() => {
if (match instanceof RegExp) {
if (match.flags.includes('g')) return match
return new RegExp(match.source, 'g' + match.flags)
if (match) {
if (match instanceof RegExp) {
if (match.flags.includes('g')) return match
return new RegExp(match.source, 'g' + match.flags)
}
return new RegExp(match, 'g')
}
return null
}, [match])
if (!($match instanceof RegExp) || typeof text !== 'string') return <>{text}</>
if (!$match) return <>{text}</>
const matchedPieces = Array.from(text.matchAll($match)).map(([text]) => text)
const matchedPieces = Array.from(text.matchAll($match)).map(
([text, highlightText = text]) => highlightText,
)
const preservedPieces = text.split($match)
const content = []

View file

@ -0,0 +1,17 @@
import * as React from 'react';
export function HighlightOnIndexes(props: { text: string; indexes?: number[]; }) {
const { text, indexes } = props;
if (!indexes?.length)
return <>{text}</>;
return (
<>
{text
.split('')
.map((char, i) => indexes.includes(i) ? <mark key={i}>{char}</mark> : <span key={i}>{char}</span>
)}
</>
);
}

View file

@ -75,7 +75,9 @@ export function useResizeHandler(
return () => window.removeEventListener('pointerup', onPointerUp)
}, [])
const onPointerDown = React.useCallback(({ clientX, clientY }: React.PointerEvent) => {
const onPointerDown = React.useCallback((e: React.PointerEvent) => {
e.preventDefault() // Prevent unexpected selection when dragging in Safari
const { clientX, clientY } = e
pointerDown.current = true
initialSizeRef.current = [clientX, clientY]
baseSize.current = latestPropSize.current

View file

@ -11,21 +11,24 @@ export function SelectInput<T>({
}
>) {
return (
<select
onChange={e => {
const key = e.target.value
const option = options.find(option => option.key === key)
onChange(option!?.value)
}}
value={options.find(option => option.value === value)?.key}
{...selectProps}
>
{options.map(option => (
<option key={option.key} value={option.key}>
{option.label}
</option>
))}
</select>
<div className={'select-wrapper'}>
<select
onChange={e => {
const key = e.target.value
const option = options.find(option => option.key === key)
onChange(option!?.value)
}}
value={options.find(option => option.value === value)?.key}
{...selectProps}
>
{options.map(option => (
<option key={option.key} value={option.key}>
{option.label}
</option>
))}
</select>
<span className={'chevron'} />
</div>
)
}
export type Option<T> = {

View file

@ -10,7 +10,7 @@ import { platform } from 'platforms'
import * as React from 'react'
import { cx } from 'utils/cx'
import * as DOMHelper from 'utils/DOMHelper'
import { run } from 'utils/general'
import { detectBrowser, run } from 'utils/general'
import { useCatchNetworkError } from 'utils/hooks/useCatchNetworkError'
import { useLoadedContext } from 'utils/hooks/useLoadedContext'
import { useOnPJAXDone, usePJAX } from 'utils/hooks/usePJAX'
@ -49,6 +49,10 @@ export function SideBar() {
}
}, [hasMetaData])
React.useEffect(() => {
if (detectBrowser() === 'Safari') DOMHelper.markGitakoSafariFlag()
}, [])
const sidebarToggleMode = configContext.value.sidebarToggleMode
const intelligentToggle = configContext.value.intelligentToggle
const $shouldShow = useStateIO(intelligentToggle === null ? false : intelligentToggle)

View file

@ -6,6 +6,8 @@ import { defaultConfigs } from 'utils/config/helper'
import { cx } from 'utils/cx'
import { setCSSVariable } from 'utils/DOMHelper'
import * as features from 'utils/features'
import { detectBrowser } from 'utils/general'
import { useConditionalHook } from '../utils/hooks/useConditionalHook'
type Size = number
export type Size2D = [Size, Size]
@ -36,6 +38,11 @@ export function SideBarBodyWrapper({
const configContext = useConfigs()
const blockLeaveRef = React.useRef(false)
const heightForSafari = useConditionalHook(
() => detectBrowser() === 'Safari',
() => useWindowSize().height,
)
React.useEffect(() => {
setSize(baseSize)
}, [baseSize])
@ -95,11 +102,12 @@ export function SideBarBodyWrapper({
[onLeave],
)
const newLocal: [number, number] = React.useMemo(() => [size, size], [size])
const dummySize: [number, number] = React.useMemo(() => [size, size], [size])
return (
<div
ref={bodyWrapperRef}
className={cx('gitako-side-bar-body-wrapper', className)}
style={{ height: heightForSafari }}
onMouseLeave={onMouseLeave}
>
<div className={'gitako-side-bar-body-wrapper-content'}>{children}</div>
@ -113,7 +121,7 @@ export function SideBarBodyWrapper({
onResizeStateChange={state => {
blockLeaveRef.current = state === 'resizing'
}}
size={newLocal}
size={dummySize}
/>
)}
</div>

View file

@ -2,7 +2,7 @@ import * as React from 'react'
import { cx } from 'utils/cx'
import { hasUpperCase } from 'utils/general'
import { ModeShape } from '.'
import { Highlight } from '../Highlight'
import { HighlightOnIndexes } from '../HighlightOnIndexes'
export const fuzzyMode: ModeShape = {
getSearchParams(searchKey) {
@ -26,13 +26,13 @@ export const fuzzyMode: ModeShape = {
let progress = 0
return chunks.map((chunk, index, chunks) => {
const chunkIndexes = indexes.filter(i => i >= progress && i < chunk.length + progress)
const regexp = chunkIndexes.length
? new RegExp(chunkIndexes.map(i => `(?<=^.{${i - progress}}).`).join('|'))
: undefined
progress += chunk.length + 1
const highlightIndexes = chunkIndexes.length ? chunkIndexes.map(i => i - progress) : undefined
progress += chunk.length + 1 // not neat side effect in map function
return (
<span key={index} className={cx({ prefix: index + 1 !== chunks.length })}>
<Highlight match={regexp} text={index + 1 === chunks.length ? chunk : chunk + '/'} />
<HighlightOnIndexes indexes={highlightIndexes} text={index + 1 === chunks.length ? chunk : chunk + '/'} />
</span>
)
})

View file

@ -1,29 +1,22 @@
import * as React from 'react'
import { cx } from 'utils/cx'
import { hasUpperCase, isValidRegexpSource, searchKeyToRegexp } from 'utils/general'
import { searchKeyToRegexp } from 'utils/general'
import { ModeShape } from '.'
import { Highlight } from '../Highlight'
export const regexMode: ModeShape = {
getSearchParams(searchKey) {
if (!searchKey) return null
const regexp = searchKeyToRegexp(searchKey)
if (regexp) {
const matchNode = (node: TreeNode) => regexp.test(node.name)
return {
matchNode,
matchNode: node => regexp.test(node.name),
}
}
return null
},
renderNodeLabelText(node, searchKey) {
const regex =
searchKey && isValidRegexpSource(searchKey)
? new RegExp(searchKey, 'g' + (hasUpperCase(searchKey) ? '' : 'i'))
: undefined
const regex = searchKeyToRegexp(searchKey) || undefined
const { name } = node
return name.includes('/') ? (
name.split('/').map((chunk, index, chunks) => (

View file

@ -86,6 +86,19 @@ $minimal-z-index: max(
}
}
@mixin pseudo-primer-icon($icon-name) {
content: '';
display: block;
cursor: pointer;
user-select: none;
-webkit-mask-image: url('~@primer/octicons/build/svg/' + $icon-name + '.svg?inline');
mask-image: url('~@primer/octicons/build/svg/' + $icon-name + '.svg?inline');
-webkit-mask-size: contain;
mask-size: contain;
-webkit-mask-position: center;
mask-position: center;
}
.#{$name}-ready {
// github
// code folding start
@ -116,19 +129,10 @@ $minimal-z-index: max(
align-items: center;
&::before {
content: '';
display: block;
width: 10px;
height: 20px;
cursor: pointer;
user-select: none;
transition: 0.25s ease;
-webkit-mask-image: url('~@primer/octicons/build/svg/chevron-down.svg?inline');
mask-image: url('~@primer/octicons/build/svg/chevron-down.svg?inline');
-webkit-mask-size: contain;
mask-size: contain;
-webkit-mask-position: center;
mask-position: center;
@include pseudo-primer-icon('chevron-down');
}
@include interactive-background-on-before(
@ -894,16 +898,38 @@ $minimal-z-index: max(
cursor: not-allowed;
}
}
select {
width: 100%;
-moz-appearance: menulist-button;
// make it look like text inputs
height: 36px;
border-radius: 6px;
border: 1px solid var(--gitako-border-default);
background: var(--gitako-canvas-default);
color: var(--gitako-fg-default);
box-shadow: var(--gitako-primer-shadow-inset);
.select-wrapper {
position: relative;
select {
width: 100%;
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
// make it look like text inputs
height: 36px;
padding: 0 6px;
border-radius: 6px;
border: 1px solid var(--gitako-border-default);
background: var(--gitako-canvas-default);
color: var(--gitako-fg-default);
box-shadow: var(--gitako-primer-shadow-inset);
}
.chevron {
position: absolute;
right: 6px;
top: 8px;
width: 10px;
height: 20px;
&::before {
width: 10px;
height: 20px;
background-color: var(--gitako-fg-subtle);
@include pseudo-primer-icon('chevron-down');
}
}
}
&.field-checkbox {
padding-left: 20px;

View file

@ -2,15 +2,24 @@
* this helper helps manipulating DOM
*/
export function setGitakoBodyClass(className: string, enable: boolean) {
const classList = document.body.classList
if (enable) classList.add(className)
else classList.remove(className)
}
/**
* when gitako is ready, make page's header narrower
* or cancel it
*/
export function markGitakoReadyState(ready: boolean) {
const readyClassName = 'gitako-ready'
const classList = document.body.classList
if (ready) classList.add(readyClassName)
else classList.remove(readyClassName)
return setGitakoBodyClass(readyClassName, ready)
}
export function markGitakoSafariFlag(enable = true) {
const className = 'gitako-safari'
return setGitakoBodyClass(className, enable)
}
/**

View file

@ -34,6 +34,16 @@ function detectOS(): OperatingSystems {
export const os = detectOS()
export const detectBrowser = () => {
const ua = navigator.userAgent.toLowerCase()
if (ua.includes('safari')) {
if (ua.includes('chrome')) return 'Chrome'
return 'Safari'
}
return 'Other'
}
export function friendlyFormatShortcut(shortcut?: string) {
if (!shortcut) return ''
if (os === OperatingSystems.Windows) {
@ -133,13 +143,7 @@ export async function JSONRequest(url: string, data: any, extra: RequestInit = {
export function searchKeyToRegexp(searchKey: string) {
if (!searchKey) return null
try {
const flags = hasUpperCase(searchKey) ? '' : 'i'
// case-sensitive when searchKey contains uppercase char
return new RegExp(searchKey, flags)
} catch (err) {
return null // matching nothing if failed transforming regexp
}
return safeRegexp(searchKey, hasUpperCase(searchKey) ? 'g' : 'gi')
}
export function hasUpperCase(input: string) {
@ -155,15 +159,18 @@ export async function renderReact(element: ReactElement) {
})
}
export function isValidRegexpSource(source: string) {
export function safeRegexp(pattern: string | RegExp, flags?: string | undefined) {
try {
new RegExp(source)
return true
return new RegExp(pattern, flags)
} catch (err) {
return false
return null
}
}
export function isValidRegexpSource(source: string) {
return Boolean(safeRegexp(source))
}
export function withEffect<Method extends (...args: any[]) => any>(
method: Method,
effect: (payload: ReturnType<Method>) => void,

View file

@ -0,0 +1,6 @@
import * as React from "react";
export function useConditionalHook<T>(condition: () => boolean, hook: () => T) {
const [use] = React.useState(condition)
if (use) return hook()
}

View file

@ -9,6 +9,18 @@ const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPl
const srcPath = path.resolve(__dirname, 'src')
const packagesPath = path.resolve(__dirname, 'packages')
function resolvePathInput(input) {
return path.isAbsolute(input) ? input : path.resolve(process.cwd(), input)
}
const buildTarget = process.env.TARGET
const buildTargetOutputMap = {
safari: 'Safari/Gitako/Gitako Extension/Resources',
}
const envOutputDir = process.env.OUTPUT_DIR || buildTargetOutputMap[buildTarget]
const outputPath = envOutputDir ? resolvePathInput(envOutputDir) : path.resolve(__dirname, 'dist')
const IN_PRODUCTION_MODE = process.env.NODE_ENV === 'production'
const plugins = [
new CopyWebpackPlugin([
{
@ -17,9 +29,25 @@ const plugins = [
transform(content) {
const { version, description, author, homepage: homepage_url } = require('./package.json')
const manifest = JSON.parse(content)
return JSON.stringify(
Object.assign(manifest, { version, description, author, homepage_url }),
)
Object.assign(manifest, {
version,
description,
author,
homepage_url,
})
// Disable custom domains for Safari
if (buildTarget === 'safari') {
Reflect.deleteProperty(manifest, 'optional_permissions')
Reflect.deleteProperty(manifest, 'background')
}
if (!IN_PRODUCTION_MODE) {
Object.assign(manifest, {
web_accessible_resources: manifest.web_accessible_resources.concat('*.map'), // enable source mapping while developing
})
}
return JSON.stringify(manifest)
},
},
{
@ -50,7 +78,6 @@ if (analyse) {
console.log(`BundleAnalyzerPlugin added`)
}
const IN_PRODUCTION_MODE = process.env.NODE_ENV === 'production'
plugins.push(
new webpack.DefinePlugin({
'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV),
@ -66,7 +93,7 @@ module.exports = {
devtool: IN_PRODUCTION_MODE ? 'source-map' : 'inline-source-map',
mode: IN_PRODUCTION_MODE ? 'production' : 'development',
output: {
path: path.resolve(__dirname, 'dist'),
path: outputPath,
filename: '[name].js',
},
resolve: {