├── .eslintignore ├── .eslintrc ├── .gitignore ├── .prettierrc ├── .vscode └── settings.json ├── LICENSE ├── README.md ├── assets ├── banner1.png └── banner2.png ├── contributors.json ├── package.json ├── packages ├── README.md ├── api │ ├── Objective-C-API │ │ ├── Foundation │ │ │ ├── JSBNSArray.h │ │ │ ├── JSBNSAttributedString.h │ │ │ ├── JSBNSCharacterSet.h │ │ │ ├── JSBNSCountedSet.h │ │ │ ├── JSBNSData.h │ │ │ ├── JSBNSDate.h │ │ │ ├── JSBNSDateComponents.h │ │ │ ├── JSBNSDateFormatter.h │ │ │ ├── JSBNSDecimalNumber.h │ │ │ ├── JSBNSDictionary.h │ │ │ ├── JSBNSEnumerator.h │ │ │ ├── JSBNSError.h │ │ │ ├── JSBNSFileHandle.h │ │ │ ├── JSBNSFileManager.h │ │ │ ├── JSBNSFormatter.h │ │ │ ├── JSBNSHTTPURLResponse.h │ │ │ ├── JSBNSHashTable.h │ │ │ ├── JSBNSIndexPath.h │ │ │ ├── JSBNSIndexSet.h │ │ │ ├── JSBNSJSONSerialization.h │ │ │ ├── JSBNSKeyedArchiver.h │ │ │ ├── JSBNSKeyedUnarchiver.h │ │ │ ├── JSBNSLocale.h │ │ │ ├── JSBNSMapTable.h │ │ │ ├── JSBNSMutableArray.h │ │ │ ├── JSBNSMutableAttributedString.h │ │ │ ├── JSBNSMutableCharacterSet.h │ │ │ ├── JSBNSMutableData.h │ │ │ ├── JSBNSMutableDictionary.h │ │ │ ├── JSBNSMutableIndexSet.h │ │ │ ├── JSBNSMutableOrderedSet.h │ │ │ ├── JSBNSMutableSet.h │ │ │ ├── JSBNSMutableString.h │ │ │ ├── JSBNSMutableURLRequest.h │ │ │ ├── JSBNSNotification.h │ │ │ ├── JSBNSNotificationCenter.h │ │ │ ├── JSBNSNull.h │ │ │ ├── JSBNSNumber.h │ │ │ ├── JSBNSNumberFormatter.h │ │ │ ├── JSBNSOperation.h │ │ │ ├── JSBNSOperationQueue.h │ │ │ ├── JSBNSOrderedSet.h │ │ │ ├── JSBNSPointerArray.h │ │ │ ├── JSBNSPredicate.h │ │ │ ├── JSBNSProxy.h │ │ │ ├── JSBNSScanner.h │ │ │ ├── JSBNSSet.h │ │ │ ├── JSBNSSimpleCString.h │ │ │ ├── JSBNSTimeZone.h │ │ │ ├── JSBNSTimer.h │ │ │ ├── JSBNSURL.h │ │ │ ├── JSBNSURLComponents.h │ │ │ ├── JSBNSURLConnection.h │ │ │ ├── JSBNSURLRequest.h │ │ │ ├── JSBNSURLResponse.h │ │ │ ├── JSBNSUUID.h │ │ │ ├── JSBNSUserDefaults.h │ │ │ └── JSBNSValue.h │ │ ├── JSBJSExtension.h │ │ ├── MarginNote(old version) │ │ │ ├── Application │ │ │ │ ├── JSBApplication.h │ │ │ │ ├── JSBDocumentController.h │ │ │ │ ├── JSBMindMapNode.h │ │ │ │ ├── JSBMindMapView.h │ │ │ │ ├── JSBNotebookController.h │ │ │ │ ├── JSBOutlineView.h │ │ │ │ ├── JSBReaderController.h │ │ │ │ └── JSBStudyController.h │ │ │ ├── NoteDatabase │ │ │ │ ├── JSBMbBook.h │ │ │ │ ├── JSBMbBookNote.h │ │ │ │ ├── JSBMbModelTool.h │ │ │ │ └── JSBMbTopic.h │ │ │ └── Utility │ │ │ │ ├── JSBMenuController.h │ │ │ │ ├── JSBSQLite.h │ │ │ │ ├── JSBSpeechManager.h │ │ │ │ ├── JSBUndoManager.h │ │ │ │ └── JSBZipArchive.h │ │ ├── QuartzCore │ │ │ ├── JSBCAAnimation.h │ │ │ ├── JSBCAAnimationGroup.h │ │ │ ├── JSBCABasicAnimation.h │ │ │ ├── JSBCAGradientLayer.h │ │ │ ├── JSBCAKeyframeAnimation.h │ │ │ ├── JSBCALayer.h │ │ │ ├── JSBCAMediaTimingFunction.h │ │ │ ├── JSBCAPropertyAnimation.h │ │ │ ├── JSBCAReplicatorLayer.h │ │ │ ├── JSBCAScrollLayer.h │ │ │ ├── JSBCAShapeLayer.h │ │ │ ├── JSBCATextLayer.h │ │ │ ├── JSBCATiledLayer.h │ │ │ ├── JSBCATransaction.h │ │ │ ├── JSBCATransformLayer.h │ │ │ ├── JSBCATransition.h │ │ │ └── JSBCAValueFunction.h │ │ └── UIKit │ │ │ ├── JSBNSMutableParagraphStyle.h │ │ │ ├── JSBNSParagraphStyle.h │ │ │ ├── JSBNSTextStorage.h │ │ │ ├── JSBUIActivityIndicatorView.h │ │ │ ├── JSBUIAlertView.h │ │ │ ├── JSBUIApplication.h │ │ │ ├── JSBUIBarButtonItem.h │ │ │ ├── JSBUIBarItem.h │ │ │ ├── JSBUIBezierPath.h │ │ │ ├── JSBUIButton.h │ │ │ ├── JSBUICollectionView.h │ │ │ ├── JSBUICollectionViewCell.h │ │ │ ├── JSBUICollectionViewController.h │ │ │ ├── JSBUICollectionViewLayout.h │ │ │ ├── JSBUICollectionViewLayoutAttributes.h │ │ │ ├── JSBUIColor.h │ │ │ ├── JSBUIControl.h │ │ │ ├── JSBUIDatePicker.h │ │ │ ├── JSBUIDevice.h │ │ │ ├── JSBUIEvent.h │ │ │ ├── JSBUIFont.h │ │ │ ├── JSBUIGestureRecognizer.h │ │ │ ├── JSBUIImage.h │ │ │ ├── JSBUIImagePickerController.h │ │ │ ├── JSBUIImageView.h │ │ │ ├── JSBUIKeyCommand.h │ │ │ ├── JSBUILabel.h │ │ │ ├── JSBUILocalNotification.h │ │ │ ├── JSBUILongPressGestureRecognizer.h │ │ │ ├── JSBUINavigationBar.h │ │ │ ├── JSBUINavigationController.h │ │ │ ├── JSBUINavigationItem.h │ │ │ ├── JSBUIPageControl.h │ │ │ ├── JSBUIPageViewController.h │ │ │ ├── JSBUIPanGestureRecognizer.h │ │ │ ├── JSBUIPasteboard.h │ │ │ ├── JSBUIPickerView.h │ │ │ ├── JSBUIPinchGestureRecognizer.h │ │ │ ├── JSBUIPopoverController.h │ │ │ ├── JSBUIResponder.h │ │ │ ├── JSBUIRotationGestureRecognizer.h │ │ │ ├── JSBUIScreen.h │ │ │ ├── JSBUIScreenMode.h │ │ │ ├── JSBUIScrollView.h │ │ │ ├── JSBUISearchBar.h │ │ │ ├── JSBUISegmentedControl.h │ │ │ ├── JSBUISlider.h │ │ │ ├── JSBUISwipeGestureRecognizer.h │ │ │ ├── JSBUISwitch.h │ │ │ ├── JSBUITabBar.h │ │ │ ├── JSBUITabBarController.h │ │ │ ├── JSBUITabBarItem.h │ │ │ ├── JSBUITableView.h │ │ │ ├── JSBUITableViewCell.h │ │ │ ├── JSBUITableViewController.h │ │ │ ├── JSBUITapGestureRecognizer.h │ │ │ ├── JSBUITextField.h │ │ │ ├── JSBUITextInputMode.h │ │ │ ├── JSBUITextPosition.h │ │ │ ├── JSBUITextRange.h │ │ │ ├── JSBUITextView.h │ │ │ ├── JSBUIToolbar.h │ │ │ ├── JSBUITouch.h │ │ │ ├── JSBUIView.h │ │ │ ├── JSBUIViewController.h │ │ │ ├── JSBUIWebView.h │ │ │ └── JSBUIWindow.h │ ├── README.md │ ├── package.json │ ├── src │ │ ├── high-level │ │ │ ├── common.ts │ │ │ ├── delay.ts │ │ │ ├── file.ts │ │ │ ├── handler.ts │ │ │ ├── index.ts │ │ │ ├── lang.ts │ │ │ ├── mn.ts │ │ │ ├── network.ts │ │ │ ├── node.ts │ │ │ ├── note.ts │ │ │ ├── nsvalue.ts │ │ │ ├── page.ts │ │ │ ├── popup.ts │ │ │ └── utils.ts │ │ ├── index.ts │ │ ├── low-level │ │ │ ├── Foundation │ │ │ │ ├── NSData.ts │ │ │ │ ├── NSFileManages.ts │ │ │ │ ├── NSIndexSet.ts │ │ │ │ ├── NSJSONSerialization.ts │ │ │ │ ├── NSLocale.ts │ │ │ │ ├── NSNotification.ts │ │ │ │ ├── NSOperationQueue.ts │ │ │ │ ├── NSTimer.ts │ │ │ │ ├── NSURL.ts │ │ │ │ ├── NSURLConnection.ts │ │ │ │ ├── NSURLRequest.ts │ │ │ │ ├── NSUserDefaults.ts │ │ │ │ ├── NSValue.ts │ │ │ │ └── index.ts │ │ │ ├── MarginNote │ │ │ │ ├── Application.ts │ │ │ │ ├── JSExtension.ts │ │ │ │ ├── MbBookNote.ts │ │ │ │ ├── NoteComment.ts │ │ │ │ ├── NoteDatabase.ts │ │ │ │ ├── SQLite.ts │ │ │ │ ├── Utility.ts │ │ │ │ └── index.ts │ │ │ ├── UIKit │ │ │ │ ├── UIAlertView.ts │ │ │ │ ├── UIApplication.ts │ │ │ │ ├── UIButton.ts │ │ │ │ ├── UIColor.ts │ │ │ │ ├── UIControl.ts │ │ │ │ ├── UIEvent.ts │ │ │ │ ├── UIFont.ts │ │ │ │ ├── UIGestureRecognizer.ts │ │ │ │ ├── UIImage.ts │ │ │ │ ├── UILabel.ts │ │ │ │ ├── UIPasteboard.ts │ │ │ │ ├── UIPopoverController.ts │ │ │ │ ├── UIResponder.ts │ │ │ │ ├── UISwitch.ts │ │ │ │ ├── UITableView.ts │ │ │ │ ├── UITableViewCell.ts │ │ │ │ ├── UITableViewController.ts │ │ │ │ ├── UITextField.ts │ │ │ │ ├── UIVIewController.ts │ │ │ │ ├── UIView.ts │ │ │ │ ├── UIWebView.ts │ │ │ │ └── index.ts │ │ │ └── index.ts │ │ └── self.d.ts │ └── tsconfig.json ├── create-ohmymn │ ├── package.json │ ├── src │ │ └── index.ts │ └── templates │ │ ├── base │ │ ├── README.md │ │ ├── assets │ │ │ └── logo.png │ │ ├── build.ts │ │ ├── manifest.ts │ │ ├── package.json │ │ ├── scripts │ │ │ └── utils.ts │ │ ├── src │ │ │ ├── addon.ts │ │ │ ├── coreModule.ts │ │ │ ├── jsExtension │ │ │ │ ├── handleReceivedEvent.ts │ │ │ │ ├── index.ts │ │ │ │ ├── lang.ts │ │ │ │ ├── lifecycle.ts │ │ │ │ └── switchPanel.ts │ │ │ ├── main.ts │ │ │ ├── self.d.ts │ │ │ ├── typings │ │ │ │ ├── index.ts │ │ │ │ └── utils.d.ts │ │ │ └── utils │ │ │ │ └── index.ts │ │ └── tsconfig.json │ │ ├── panel │ │ ├── README.md │ │ ├── assets │ │ │ └── logo.png │ │ ├── build.ts │ │ ├── manifest.ts │ │ ├── package.json │ │ ├── scripts │ │ │ └── utils.ts │ │ ├── src │ │ │ ├── addon.ts │ │ │ ├── coreModule.ts │ │ │ ├── dataSource │ │ │ │ ├── index.ts │ │ │ │ ├── lang.ts │ │ │ │ └── more.ts │ │ │ ├── jsExtension │ │ │ │ ├── handleMagicAction │ │ │ │ │ ├── handleCardAction.ts │ │ │ │ │ └── index.ts │ │ │ │ ├── handleReceivedEvent.ts │ │ │ │ ├── index.ts │ │ │ │ ├── lang.ts │ │ │ │ ├── lifecycle.ts │ │ │ │ └── switchPanel.ts │ │ │ ├── main.ts │ │ │ ├── modules │ │ │ │ ├── addon │ │ │ │ │ ├── index.ts │ │ │ │ │ ├── lang.ts │ │ │ │ │ └── typings.ts │ │ │ │ ├── index.ts │ │ │ │ └── magicaction │ │ │ │ │ ├── index.ts │ │ │ │ │ └── lang.ts │ │ │ ├── profile │ │ │ │ ├── default.ts │ │ │ │ ├── index.ts │ │ │ │ ├── lang.ts │ │ │ │ ├── profileAction.ts │ │ │ │ ├── profileAuto.ts │ │ │ │ ├── typings.ts │ │ │ │ ├── updateDataSource.ts │ │ │ │ └── utils.ts │ │ │ ├── self.d.ts │ │ │ ├── settingViewController │ │ │ │ ├── handleUserAction.ts │ │ │ │ ├── index.ts │ │ │ │ ├── lang.ts │ │ │ │ ├── lifecycle.ts │ │ │ │ └── settingView.ts │ │ │ ├── typings │ │ │ │ ├── DataSource.ts │ │ │ │ ├── Module.ts │ │ │ │ ├── index.ts │ │ │ │ └── utils.d.ts │ │ │ └── utils │ │ │ │ ├── checkInput.ts │ │ │ │ ├── index.ts │ │ │ │ ├── input.ts │ │ │ │ ├── lang.ts │ │ │ │ ├── number.ts │ │ │ │ ├── text.ts │ │ │ │ └── third party │ │ │ │ ├── LICENSE │ │ │ │ ├── base64.js │ │ │ │ ├── md5.js │ │ │ │ ├── mustache-wax.js │ │ │ │ ├── mustache.js │ │ │ │ ├── pangu.js │ │ │ │ └── toTitleCase.js │ │ └── tsconfig.json │ │ └── profile │ │ ├── README.md │ │ ├── assets │ │ └── logo.png │ │ ├── build.ts │ │ ├── manifest.ts │ │ ├── package.json │ │ ├── scripts │ │ └── utils.ts │ │ ├── src │ │ ├── addon.ts │ │ ├── coreModule.ts │ │ ├── dataSource │ │ │ ├── index.ts │ │ │ ├── lang.ts │ │ │ └── more.ts │ │ ├── jsExtension │ │ │ ├── handleMagicAction │ │ │ │ ├── handleCardAction.ts │ │ │ │ └── index.ts │ │ │ ├── handleReceivedEvent.ts │ │ │ ├── index.ts │ │ │ ├── lang.ts │ │ │ ├── lifecycle.ts │ │ │ └── switchPanel.ts │ │ ├── main.ts │ │ ├── modules │ │ │ ├── addon │ │ │ │ ├── index.ts │ │ │ │ ├── lang.ts │ │ │ │ └── typings.ts │ │ │ ├── index.ts │ │ │ └── magicaction │ │ │ │ ├── index.ts │ │ │ │ └── lang.ts │ │ ├── profile │ │ │ ├── default.ts │ │ │ ├── index.ts │ │ │ ├── lang.ts │ │ │ ├── profileAction.ts │ │ │ ├── profileAuto.ts │ │ │ ├── typings.ts │ │ │ ├── updateDataSource.ts │ │ │ └── utils.ts │ │ ├── self.d.ts │ │ ├── settingViewController │ │ │ ├── handleUserAction.ts │ │ │ ├── index.ts │ │ │ ├── lang.ts │ │ │ ├── lifecycle.ts │ │ │ └── settingView.ts │ │ ├── typings │ │ │ ├── DataSource.ts │ │ │ ├── Module.ts │ │ │ ├── index.ts │ │ │ └── utils.d.ts │ │ └── utils │ │ │ ├── checkInput.ts │ │ │ ├── index.ts │ │ │ ├── input.ts │ │ │ ├── lang.ts │ │ │ ├── number.ts │ │ │ ├── text.ts │ │ │ └── third party │ │ │ ├── LICENSE │ │ │ ├── base64.js │ │ │ ├── md5.js │ │ │ ├── mustache-wax.js │ │ │ ├── mustache.js │ │ │ ├── pangu.js │ │ │ └── toTitleCase.js │ │ └── tsconfig.json ├── docs │ ├── .gitignore │ ├── .vitepress │ │ ├── components │ │ │ ├── AIShortcut.vue │ │ │ ├── Contributors.vue │ │ │ ├── Feature-en.vue │ │ │ ├── Feature.vue │ │ │ ├── HomePage-en.vue │ │ │ ├── HomePage.vue │ │ │ ├── Shortcut-en.vue │ │ │ ├── Shortcut.vue │ │ │ ├── VPFeature.vue │ │ │ └── VPFeatures.vue │ │ ├── config │ │ │ ├── en.ts │ │ │ ├── index.ts │ │ │ ├── shared.ts │ │ │ └── zh.ts │ │ ├── contributors.ts │ │ ├── markdown-it │ │ │ └── media.ts │ │ ├── meta.ts │ │ ├── scripts │ │ │ ├── assets.ts │ │ │ ├── build-pwa.mjs │ │ │ └── fetch-avatars.ts │ │ ├── shim.d.ts │ │ ├── style │ │ │ ├── main.css │ │ │ └── vars.css │ │ └── theme │ │ │ ├── index.ts │ │ │ └── pwa.ts │ ├── README.md │ ├── api │ │ ├── foundation.md │ │ ├── index.md │ │ ├── marginnote │ │ │ ├── application.md │ │ │ ├── database.md │ │ │ ├── delay.md │ │ │ ├── dev.md │ │ │ ├── fetch.md │ │ │ ├── file.md │ │ │ ├── index.md │ │ │ ├── mbbooknote.md │ │ │ ├── mbbooktopic.md │ │ │ ├── nodenote.md │ │ │ ├── note.md │ │ │ ├── other.md │ │ │ ├── popup.md │ │ │ ├── studycontroller.md │ │ │ └── utility.md │ │ ├── ohmymn │ │ │ ├── input.md │ │ │ ├── module.md │ │ │ └── text.md │ │ ├── transform.md │ │ └── uikit.md │ ├── dev │ │ ├── events.md │ │ ├── index.md │ │ ├── jsextension.md │ │ ├── lifecycle.md │ │ ├── lite.md │ │ ├── module │ │ │ ├── how.md │ │ │ └── index.md │ │ ├── ohmymn │ │ │ ├── esbuild.md │ │ │ ├── i18n.md │ │ │ ├── index.md │ │ │ ├── manifest.md │ │ │ ├── profile.md │ │ │ └── structure.md │ │ ├── store.md │ │ └── structure.md │ ├── docsearch.json │ ├── en │ │ ├── api │ │ │ ├── foundation.md │ │ │ ├── index.md │ │ │ ├── marginnote │ │ │ │ ├── application.md │ │ │ │ ├── database.md │ │ │ │ ├── delay.md │ │ │ │ ├── dev.md │ │ │ │ ├── fetch.md │ │ │ │ ├── file.md │ │ │ │ ├── index.md │ │ │ │ ├── mbbooknote.md │ │ │ │ ├── mbbooktopic.md │ │ │ │ ├── nodenote.md │ │ │ │ ├── note.md │ │ │ │ ├── other.md │ │ │ │ ├── popup.md │ │ │ │ ├── studycontroller.md │ │ │ │ └── utility.md │ │ │ ├── ohmymn │ │ │ │ ├── input.md │ │ │ │ ├── module.md │ │ │ │ └── text.md │ │ │ ├── transform.md │ │ │ └── uikit.md │ │ ├── dev │ │ │ ├── events.md │ │ │ ├── index.md │ │ │ ├── jsextension.md │ │ │ ├── lifecycle.md │ │ │ ├── lite.md │ │ │ ├── module │ │ │ │ ├── how.md │ │ │ │ └── index.md │ │ │ ├── ohmymn │ │ │ │ ├── esbuild.md │ │ │ │ ├── i18n.md │ │ │ │ ├── index.md │ │ │ │ ├── manifest.md │ │ │ │ ├── profile.md │ │ │ │ └── structure.md │ │ │ ├── store.md │ │ │ └── structure.md │ │ ├── guide │ │ │ ├── attention.md │ │ │ ├── concept.md │ │ │ ├── custom.md │ │ │ ├── index.md │ │ │ ├── modules │ │ │ │ ├── anotherautodef.md │ │ │ │ ├── anotherautotitle.md │ │ │ │ ├── autocomment.md │ │ │ │ ├── autocomplete.md │ │ │ │ ├── autoformat.md │ │ │ │ ├── autolist.md │ │ │ │ ├── autoocr.md │ │ │ │ ├── autoreplace.md │ │ │ │ ├── autosimplify.md │ │ │ │ ├── autostyle.md │ │ │ │ ├── autotag.md │ │ │ │ ├── autotranslate.md │ │ │ │ ├── copysearch.md │ │ │ │ ├── gesture.md │ │ │ │ ├── magicaction4card.md │ │ │ │ ├── magicaction4text.md │ │ │ │ ├── ohmymn.md │ │ │ │ └── shortcut.md │ │ │ ├── mustache.md │ │ │ ├── profile.md │ │ │ ├── regex.md │ │ │ ├── replace.md │ │ │ ├── serial.md │ │ │ ├── split.md │ │ │ └── vars.md │ │ └── index.md │ ├── guide │ │ ├── attention.md │ │ ├── concept.md │ │ ├── custom.md │ │ ├── index.md │ │ ├── modules │ │ │ ├── ai.md │ │ │ ├── anotherautodef.md │ │ │ ├── anotherautotitle.md │ │ │ ├── autocomment.md │ │ │ ├── autocomplete.md │ │ │ ├── autoformat.md │ │ │ ├── autolist.md │ │ │ ├── autoocr.md │ │ │ ├── autoreplace.md │ │ │ ├── autosimplify.md │ │ │ ├── autostyle.md │ │ │ ├── autotag.md │ │ │ ├── autotranslate.md │ │ │ ├── copysearch.md │ │ │ ├── gesture.md │ │ │ ├── magicaction4card.md │ │ │ ├── magicaction4text.md │ │ │ ├── ohmymn.md │ │ │ ├── shortcut.md │ │ │ └── toolbar.md │ │ ├── mustache.md │ │ ├── profile.md │ │ ├── regex.md │ │ ├── replace.md │ │ ├── serial.md │ │ ├── split.md │ │ └── vars.md │ ├── index.md │ ├── modules.ts │ ├── package.json │ ├── public │ │ ├── _headers │ │ ├── apple-touch-icon.png │ │ ├── favicon.ico │ │ ├── logo-shadow.svg │ │ ├── logo.svg │ │ ├── og-original.jpg │ │ ├── og.jpg │ │ ├── pwa-192x192.png │ │ ├── pwa-512x512.png │ │ ├── robots.txt │ │ └── user-avatars │ │ │ ├── BryanHuang66.png │ │ │ ├── ourongxing.png │ │ │ └── zzhirong.png │ ├── tsconfig.json │ ├── update.md │ └── vite.config.ts ├── export2anywhere │ └── README.md ├── metadata │ └── README.md ├── ohmymn │ ├── README.md │ ├── assets │ │ ├── AutoSimplifyData.json │ │ ├── icon │ │ │ ├── QRCodeOCR.png │ │ │ ├── addComment.png │ │ │ ├── addTag.png │ │ │ ├── aiActionPrompts.png │ │ │ ├── aiActionPromptsText.png │ │ │ ├── answerWithCard.png │ │ │ ├── changeColor.png │ │ │ ├── changeStyle.png │ │ │ ├── close.png │ │ │ ├── completeWord.png │ │ │ ├── copyCardInfo.png │ │ │ ├── copyText.png │ │ │ ├── customShortcut1.png │ │ │ ├── customShortcut2.png │ │ │ ├── customShortcut3.png │ │ │ ├── customShortcut4.png │ │ │ ├── customShortcut5.png │ │ │ ├── customShortcut6.png │ │ │ ├── customShortcut7.png │ │ │ ├── customShortcut8.png │ │ │ ├── extractTitle.png │ │ │ ├── filterCard.png │ │ │ ├── formatCard.png │ │ │ ├── formulaOCR.png │ │ │ ├── genWordCard.png │ │ │ ├── handWrittingOCR.png │ │ │ ├── listCard.png │ │ │ ├── manageProfile.png │ │ │ ├── mergeCard.png │ │ │ ├── mergeText.png │ │ │ ├── renameTitle.png │ │ │ ├── replaceCard.png │ │ │ ├── searchCardInfo.png │ │ │ ├── searchText.png │ │ │ ├── simplifyCard.png │ │ │ ├── simplifyText.png │ │ │ ├── splitExcerpt.png │ │ │ ├── switchPanel.png │ │ │ ├── switchTitle.png │ │ │ ├── textOCR.png │ │ │ ├── translateCard.png │ │ │ └── translateText.png │ │ └── logo.png │ ├── build.ts │ ├── manifest.ts │ ├── package.json │ ├── scripts │ │ ├── updateVersion.ts │ │ └── utils.ts │ ├── src │ │ ├── addon.ts │ │ ├── coreModule.ts │ │ ├── dataSource │ │ │ ├── index.ts │ │ │ ├── lang.ts │ │ │ └── more.ts │ │ ├── jsExtension │ │ │ ├── fetchNodeProperties.ts │ │ │ ├── handleExcerpt │ │ │ │ ├── genNewExcerpt.ts │ │ │ │ └── index.ts │ │ │ ├── handleGestureEvent.ts │ │ │ ├── handleMagicAction │ │ │ │ ├── handleCardAction.ts │ │ │ │ ├── handleTextAction.ts │ │ │ │ └── index.ts │ │ │ ├── handleReceivedEvent.ts │ │ │ ├── index.ts │ │ │ ├── lang.ts │ │ │ ├── lifecycle.ts │ │ │ ├── mustacheFunc.ts │ │ │ ├── overlayView.ts │ │ │ └── switchPanel.ts │ │ ├── main.ts │ │ ├── modules │ │ │ ├── addon │ │ │ │ ├── index.ts │ │ │ │ ├── lang.ts │ │ │ │ └── typings.ts │ │ │ ├── ai │ │ │ │ ├── index.ts │ │ │ │ ├── lang.ts │ │ │ │ ├── typings.ts │ │ │ │ └── utils.ts │ │ │ ├── anotherautodef │ │ │ │ ├── index.ts │ │ │ │ ├── lang.ts │ │ │ │ ├── typings.ts │ │ │ │ └── utils.ts │ │ │ ├── anotherautotitle │ │ │ │ ├── index.ts │ │ │ │ ├── lang.ts │ │ │ │ └── typings.ts │ │ │ ├── autocomment │ │ │ │ ├── index.ts │ │ │ │ ├── lang.ts │ │ │ │ └── typings.ts │ │ │ ├── autocomplete │ │ │ │ ├── index.ts │ │ │ │ ├── lang.ts │ │ │ │ ├── typings.ts │ │ │ │ └── utils.ts │ │ │ ├── autoformat │ │ │ │ ├── index.ts │ │ │ │ ├── lang.ts │ │ │ │ ├── typings.ts │ │ │ │ └── utils.ts │ │ │ ├── autolist │ │ │ │ ├── index.ts │ │ │ │ ├── lang.ts │ │ │ │ ├── typings.ts │ │ │ │ └── utils.ts │ │ │ ├── autoocr │ │ │ │ ├── index.ts │ │ │ │ ├── lang.ts │ │ │ │ ├── typings.ts │ │ │ │ └── utils.ts │ │ │ ├── autoreplace │ │ │ │ ├── index.ts │ │ │ │ ├── lang.ts │ │ │ │ └── typings.ts │ │ │ ├── autosimplify │ │ │ │ ├── index.ts │ │ │ │ ├── lang.ts │ │ │ │ └── opencc.ts │ │ │ ├── autostyle │ │ │ │ ├── index.ts │ │ │ │ ├── lang.ts │ │ │ │ ├── typings.ts │ │ │ │ └── utils.ts │ │ │ ├── autotag │ │ │ │ ├── index.ts │ │ │ │ ├── lang.ts │ │ │ │ └── typings.ts │ │ │ ├── autotranslate │ │ │ │ ├── index.ts │ │ │ │ ├── lang.ts │ │ │ │ ├── typings.ts │ │ │ │ └── utils.ts │ │ │ ├── copysearch │ │ │ │ ├── index.ts │ │ │ │ ├── lang.ts │ │ │ │ ├── typings.ts │ │ │ │ └── utils.ts │ │ │ ├── gesture │ │ │ │ ├── index.ts │ │ │ │ ├── lang.ts │ │ │ │ └── utils.ts │ │ │ ├── index.ts │ │ │ ├── magicaction4card │ │ │ │ ├── index.ts │ │ │ │ ├── lang.ts │ │ │ │ ├── renameTitle.ts │ │ │ │ └── typings.ts │ │ │ ├── magicaction4text │ │ │ │ ├── index.ts │ │ │ │ └── lang.ts │ │ │ ├── shortcut │ │ │ │ ├── index.ts │ │ │ │ ├── lang.ts │ │ │ │ └── utils.ts │ │ │ └── toolbar │ │ │ │ ├── index.ts │ │ │ │ ├── lang.ts │ │ │ │ └── utils.ts │ │ ├── profile │ │ │ ├── default.ts │ │ │ ├── index.ts │ │ │ ├── lang.ts │ │ │ ├── profileAction.ts │ │ │ ├── profileAuto.ts │ │ │ ├── rewrite.ts │ │ │ ├── typings.ts │ │ │ ├── updateDataSource.ts │ │ │ └── utils.ts │ │ ├── self.d.ts │ │ ├── settingViewController │ │ │ ├── handleUserAction.ts │ │ │ ├── index.ts │ │ │ ├── lang.ts │ │ │ ├── lifecycle.ts │ │ │ └── settingView.ts │ │ ├── typings │ │ │ ├── AutoUtils.ts │ │ │ ├── DataSource.ts │ │ │ ├── Module.ts │ │ │ ├── index.ts │ │ │ └── utils.d.ts │ │ └── utils │ │ │ ├── checkInput.ts │ │ │ ├── index.ts │ │ │ ├── input.ts │ │ │ ├── lang.ts │ │ │ ├── number.ts │ │ │ ├── text.ts │ │ │ └── third party │ │ │ ├── LICENSE │ │ │ ├── base64.js │ │ │ ├── md5.js │ │ │ ├── mustache-wax.js │ │ │ ├── mustache.js │ │ │ ├── pangu.js │ │ │ └── toTitleCase.js │ └── tsconfig.json └── raycast │ ├── .gitignore │ ├── CHANGELOG.md │ ├── README-ZH.md │ ├── README.md │ ├── assets │ ├── icon │ │ ├── QRCodeOCR.png │ │ ├── addComment.png │ │ ├── addTag.png │ │ ├── changeColor.png │ │ ├── changeStyle.png │ │ ├── completeWord.png │ │ ├── copyCardInfo.png │ │ ├── copyText.png │ │ ├── extractTitle.png │ │ ├── filterCard.png │ │ ├── formatCard.png │ │ ├── formulaOCR.png │ │ ├── handWrittingOCR.png │ │ ├── listCard.png │ │ ├── manageProfile.png │ │ ├── mergeCard.png │ │ ├── mergeText.png │ │ ├── renameTitle.png │ │ ├── replaceCard.png │ │ ├── searchCardInfo.png │ │ ├── searchText.png │ │ ├── simplifyCard.png │ │ ├── simplifyText.png │ │ ├── splitExcerpt.png │ │ ├── switchTitle.png │ │ ├── textOCR.png │ │ ├── translateCard.png │ │ └── translateText.png │ └── logo.png │ ├── metadata │ ├── marginnote-1.png │ └── marginnote-2.png │ ├── package.json │ ├── pnpm-lock.yaml │ ├── raycast-env.d.ts │ ├── src │ ├── create_normal_shortcuts_quicklink.tsx │ ├── find_custom_shortcuts.tsx │ ├── gen_custom_shortcut.tsx │ ├── hooks │ │ └── index.ts │ ├── store.ts │ ├── typings.d.ts │ └── utils │ │ ├── applescript.ts │ │ ├── date.ts │ │ ├── index.ts │ │ └── raycast.ts │ └── tsconfig.json ├── pnpm-lock.yaml └── pnpm-workspace.yaml /.eslintignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | dist 3 | pnpm-lock.yaml 4 | test 5 | MarginNote 6 | UIKit 7 | Foundation 8 | *.js -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | dist 3 | yarn.lock 4 | yarn-error.log 5 | test* 6 | .eslintcache 7 | .pnpm* 8 | .DS_Store 9 | .local_history 10 | *.db 11 | *.zip 12 | .vercel/ 13 | cache/ 14 | tmp/ 15 | temp/ 16 | .env -------------------------------------------------------------------------------- /.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "printWidth": 80, 3 | "semi": false, 4 | "arrowParens": "avoid", 5 | "trailingComma": "none", 6 | "overrides": [ 7 | { 8 | "files": ".prettierrc", 9 | "options": { 10 | "parser": "json" 11 | } 12 | } 13 | ] 14 | } 15 | -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "typescript.tsdk": "node_modules/typescript/lib" 3 | } 4 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 Ou Rongxing 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /assets/banner1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ourongxing/ohmymn/b0bb5f16e20c9cb5e8d8d5c6d411eb39b8b10aac/assets/banner1.png -------------------------------------------------------------------------------- /assets/banner2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ourongxing/ohmymn/b0bb5f16e20c9cb5e8d8d5c6d411eb39b8b10aac/assets/banner2.png -------------------------------------------------------------------------------- /contributors.json: -------------------------------------------------------------------------------- 1 | ["ourongxing", "BryanHuang66", "zzhirong"] 2 | -------------------------------------------------------------------------------- /packages/README.md: -------------------------------------------------------------------------------- 1 | ## License 2 | 3 | MIT 4 | -------------------------------------------------------------------------------- /packages/api/Objective-C-API/Foundation/JSBNSCountedSet.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | 4 | @import Foundation; 5 | @import JavaScriptCore; 6 | 7 | @protocol JSBNSMutableSet; 8 | 9 | @protocol JSBNSCountedSet 10 | 11 | #pragma clang diagnostic push 12 | #pragma clang diagnostic ignored "-Wdeprecated-declarations" 13 | 14 | - (NSUInteger)countForObject:(id)object; 15 | - (NSEnumerator *)objectEnumerator; 16 | - (void)addObject:(id)object; 17 | - (void)removeObject:(id)object; 18 | 19 | #pragma clang diagnostic pop 20 | 21 | @end 22 | -------------------------------------------------------------------------------- /packages/api/Objective-C-API/Foundation/JSBNSEnumerator.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | @import Foundation; 4 | @import JavaScriptCore; 5 | 6 | @protocol JSBNSObject; 7 | 8 | @protocol JSBNSEnumerator 9 | 10 | #pragma clang diagnostic push 11 | #pragma clang diagnostic ignored "-Wdeprecated-declarations" 12 | 13 | - (id)nextObject; 14 | - (NSArray *)allObjects; 15 | 16 | #pragma clang diagnostic pop 17 | 18 | @end 19 | -------------------------------------------------------------------------------- /packages/api/Objective-C-API/Foundation/JSBNSError.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | @import Foundation; 4 | @import JavaScriptCore; 5 | 6 | @protocol JSBNSObject; 7 | 8 | @protocol JSBNSError 9 | 10 | #pragma clang diagnostic push 11 | #pragma clang diagnostic ignored "-Wdeprecated-declarations" 12 | 13 | + (id)errorWithDomain:(NSString *)domain code:(NSInteger)code userInfo:(NSDictionary *)dict; 14 | 15 | - (id)initWithDomain:(NSString *)domain code:(NSInteger)code userInfo:(NSDictionary *)dict; 16 | @property (nonatomic,readonly) NSString *domain; 17 | @property (nonatomic,readonly) NSInteger code; 18 | @property (nonatomic,readonly) NSDictionary *userInfo; 19 | @property (nonatomic,readonly) NSString *localizedDescription; 20 | @property (nonatomic,readonly) NSString *localizedFailureReason; 21 | @property (nonatomic,readonly) NSString *localizedRecoverySuggestion; 22 | @property (nonatomic,readonly) NSArray *localizedRecoveryOptions; 23 | - (id)recoveryAttempter; 24 | @property (nonatomic,readonly) NSString *helpAnchor; 25 | 26 | #pragma clang diagnostic pop 27 | 28 | @end 29 | -------------------------------------------------------------------------------- /packages/api/Objective-C-API/Foundation/JSBNSFormatter.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | 4 | @import Foundation; 5 | @import JavaScriptCore; 6 | 7 | @protocol JSBNSObject; 8 | 9 | @protocol JSBNSFormatter 10 | 11 | #pragma clang diagnostic push 12 | #pragma clang diagnostic ignored "-Wdeprecated-declarations" 13 | 14 | - (NSString *)stringForObjectValue:(id)obj; 15 | - (NSAttributedString *)attributedStringForObjectValue:(id)obj withDefaultAttributes:(NSDictionary *)attrs; 16 | - (NSString *)editingStringForObjectValue:(id)obj; 17 | - (BOOL)getObjectValue:(out id *)obj forString:(NSString *)string errorDescription:(out NSString **)error; 18 | - (BOOL)isPartialStringValid:(NSString *)partialString newEditingString:(NSString **)newString errorDescription:(NSString **)error; 19 | - (BOOL)isPartialStringValid:(NSString **)partialStringPtr proposedSelectedRange:(NSRangePointer)proposedSelRangePtr originalString:(NSString *)origString originalSelectedRange:(NSRange)origSelRange errorDescription:(NSString **)error; 20 | 21 | #pragma clang diagnostic pop 22 | 23 | @end 24 | -------------------------------------------------------------------------------- /packages/api/Objective-C-API/Foundation/JSBNSHTTPURLResponse.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | @import Foundation; 4 | @import JavaScriptCore; 5 | 6 | @protocol JSBNSURLResponse; 7 | 8 | @protocol JSBNSHTTPURLResponse 9 | 10 | #pragma clang diagnostic push 11 | #pragma clang diagnostic ignored "-Wdeprecated-declarations" 12 | 13 | + (NSString *)localizedStringForStatusCode:(NSInteger)statusCode; 14 | 15 | - (id)initWithURL:(NSURL *)url statusCode:(NSInteger)statusCode HTTPVersion:(NSString *)HTTPVersion headerFields:(NSDictionary *)headerFields; 16 | - (NSInteger)statusCode; 17 | - (NSDictionary *)allHeaderFields; 18 | 19 | #pragma clang diagnostic pop 20 | 21 | @end 22 | -------------------------------------------------------------------------------- /packages/api/Objective-C-API/Foundation/JSBNSJSONSerialization.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | @import Foundation; 4 | @import JavaScriptCore; 5 | 6 | @protocol JSBNSObject; 7 | 8 | @protocol JSBNSJSONSerialization 9 | 10 | #pragma clang diagnostic push 11 | #pragma clang diagnostic ignored "-Wdeprecated-declarations" 12 | 13 | + (BOOL)isValidJSONObject:(id)obj; 14 | + (NSData *)dataWithJSONObject:(id)obj options:(NSJSONWritingOptions)opt error:(id)error; 15 | + (id)JSONObjectWithData:(NSData *)data options:(NSJSONReadingOptions)opt error:(id)error; 16 | + (NSInteger)writeJSONObject:(id)obj toStream:(NSOutputStream *)stream options:(NSJSONWritingOptions)opt error:(id)error; 17 | + (id)JSONObjectWithStream:(NSInputStream *)stream options:(NSJSONReadingOptions)opt error:(id)error; 18 | 19 | #pragma clang diagnostic pop 20 | 21 | @end 22 | -------------------------------------------------------------------------------- /packages/api/Objective-C-API/Foundation/JSBNSMapTable.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | #import 4 | 5 | @import Foundation; 6 | @import JavaScriptCore; 7 | 8 | @protocol JSBNSObject; 9 | 10 | @protocol JSBNSMapTable 11 | 12 | #pragma clang diagnostic push 13 | #pragma clang diagnostic ignored "-Wdeprecated-declarations" 14 | 15 | + (id)mapTableWithKeyOptions:(NSPointerFunctionsOptions)keyOptions valueOptions:(NSPointerFunctionsOptions)valueOptions; 16 | + (id)strongToStrongObjectsMapTable; 17 | + (id)weakToStrongObjectsMapTable; 18 | + (id)strongToWeakObjectsMapTable; 19 | + (id)weakToWeakObjectsMapTable; 20 | 21 | - (NSPointerFunctions *)keyPointerFunctions; 22 | - (NSPointerFunctions *)valuePointerFunctions; 23 | - (id)objectForKey:(id)aKey; 24 | - (void)removeObjectForKey:(id)aKey; 25 | - (void)setObject:(id)anObject forKey:(id)aKey; 26 | - (NSUInteger)count; 27 | - (NSEnumerator *)keyEnumerator; 28 | - (NSEnumerator *)objectEnumerator; 29 | - (void)removeAllObjects; 30 | - (NSDictionary *)dictionaryRepresentation; 31 | 32 | #pragma clang diagnostic pop 33 | 34 | @end 35 | -------------------------------------------------------------------------------- /packages/api/Objective-C-API/Foundation/JSBNSMutableCharacterSet.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | #import 4 | #import 5 | 6 | @import Foundation; 7 | @import JavaScriptCore; 8 | 9 | @protocol JSBNSCharacterSet; 10 | 11 | @protocol JSBNSMutableCharacterSet 12 | 13 | #pragma clang diagnostic push 14 | #pragma clang diagnostic ignored "-Wdeprecated-declarations" 15 | 16 | - (void)addCharactersInRange:(NSRange)aRange; 17 | - (void)removeCharactersInRange:(NSRange)aRange; 18 | - (void)addCharactersInString:(NSString *)aString; 19 | - (void)removeCharactersInString:(NSString *)aString; 20 | - (void)formUnionWithCharacterSet:(NSCharacterSet *)otherSet; 21 | - (void)formIntersectionWithCharacterSet:(NSCharacterSet *)otherSet; 22 | - (void)invert; 23 | 24 | #pragma clang diagnostic pop 25 | 26 | @end 27 | -------------------------------------------------------------------------------- /packages/api/Objective-C-API/Foundation/JSBNSMutableData.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | 4 | @import Foundation; 5 | @import JavaScriptCore; 6 | 7 | @protocol JSBNSData; 8 | 9 | @protocol JSBNSMutableData 10 | 11 | #pragma clang diagnostic push 12 | #pragma clang diagnostic ignored "-Wdeprecated-declarations" 13 | 14 | + (id)dataWithCapacity:(NSUInteger)aNumItems; 15 | + (id)dataWithLength:(NSUInteger)length; 16 | 17 | - (void *)mutableBytes; 18 | - (void)setLength:(NSUInteger)length; 19 | - (void)appendBytes:(const void *)bytes length:(NSUInteger)length; 20 | - (void)appendData:(NSData *)other; 21 | - (void)increaseLengthBy:(NSUInteger)extraLength; 22 | - (void)replaceBytesInRange:(NSRange)range withBytes:(const void *)bytes; 23 | - (void)resetBytesInRange:(NSRange)range; 24 | - (void)setData:(NSData *)data; 25 | - (void)replaceBytesInRange:(NSRange)range withBytes:(const void *)replacementBytes length:(NSUInteger)replacementLength; 26 | 27 | #pragma clang diagnostic pop 28 | 29 | @end 30 | -------------------------------------------------------------------------------- /packages/api/Objective-C-API/Foundation/JSBNSMutableDictionary.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | 4 | @import Foundation; 5 | @import JavaScriptCore; 6 | 7 | @protocol JSBNSDictionary; 8 | 9 | @protocol JSBNSMutableDictionary 10 | 11 | #pragma clang diagnostic push 12 | #pragma clang diagnostic ignored "-Wdeprecated-declarations" 13 | 14 | + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems; 15 | + (id)sharedKeySetForKeys:(NSArray *)keys; 16 | + (id)dictionaryWithSharedKeySet:(id)keyset; 17 | 18 | - (void)removeObjectForKey:(id)aKey; 19 | - (void)setObject:(id)anObject forKey:(id )aKey; 20 | - (void)addEntriesFromDictionary:(NSDictionary *)otherDictionary; 21 | - (void)removeAllObjects; 22 | - (void)removeObjectsForKeys:(NSArray *)keyArray; 23 | - (void)setDictionary:(NSDictionary *)otherDictionary; 24 | - (void)setObject:(id)obj forKeyedSubscript:(id )key; 25 | - (void)setValue:(id)value forKey:(NSString *)key; 26 | 27 | #pragma clang diagnostic pop 28 | 29 | @end 30 | -------------------------------------------------------------------------------- /packages/api/Objective-C-API/Foundation/JSBNSMutableIndexSet.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | 4 | @import Foundation; 5 | @import JavaScriptCore; 6 | 7 | @protocol JSBNSIndexSet; 8 | 9 | @protocol JSBNSMutableIndexSet 10 | 11 | #pragma clang diagnostic push 12 | #pragma clang diagnostic ignored "-Wdeprecated-declarations" 13 | 14 | - (void)addIndexes:(NSIndexSet *)indexSet; 15 | - (void)removeIndexes:(NSIndexSet *)indexSet; 16 | - (void)removeAllIndexes; 17 | - (void)addIndex:(NSUInteger)value; 18 | - (void)removeIndex:(NSUInteger)value; 19 | - (void)addIndexesInRange:(NSRange)range; 20 | - (void)removeIndexesInRange:(NSRange)range; 21 | - (void)shiftIndexesStartingAtIndex:(NSUInteger)index by:(NSInteger)delta; 22 | 23 | #pragma clang diagnostic pop 24 | 25 | @end 26 | -------------------------------------------------------------------------------- /packages/api/Objective-C-API/Foundation/JSBNSMutableSet.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | 4 | @import Foundation; 5 | @import JavaScriptCore; 6 | 7 | @protocol JSBNSSet; 8 | 9 | @protocol JSBNSMutableSet 10 | 11 | #pragma clang diagnostic push 12 | #pragma clang diagnostic ignored "-Wdeprecated-declarations" 13 | 14 | + (instancetype)setWithCapacity:(NSUInteger)numItems; 15 | 16 | - (void)addObject:(id)object; 17 | - (void)removeObject:(id)object; 18 | - (void)addObjectsFromArray:(NSArray *)array; 19 | - (void)intersectSet:(NSSet *)otherSet; 20 | - (void)minusSet:(NSSet *)otherSet; 21 | - (void)removeAllObjects; 22 | - (void)unionSet:(NSSet *)otherSet; 23 | - (void)setSet:(NSSet *)otherSet; 24 | - (void)filterUsingPredicate:(NSPredicate *)predicate; 25 | 26 | #pragma clang diagnostic pop 27 | 28 | @end 29 | -------------------------------------------------------------------------------- /packages/api/Objective-C-API/Foundation/JSBNSMutableString.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | #import 4 | #import 5 | 6 | @import Foundation; 7 | @import JavaScriptCore; 8 | 9 | @protocol JSBNSString; 10 | 11 | @protocol JSBNSMutableString 12 | 13 | #pragma clang diagnostic push 14 | #pragma clang diagnostic ignored "-Wdeprecated-declarations" 15 | 16 | + (id)string; 17 | + (id)stringWithCapacity:(NSUInteger)capacity; 18 | 19 | - (void)replaceCharactersInRange:(NSRange)range withString:(NSString *)aString; 20 | - (void)insertString:(NSString *)aString atIndex:(NSUInteger)loc; 21 | - (void)deleteCharactersInRange:(NSRange)range; 22 | - (void)appendString:(NSString *)aString; 23 | JSExportAs(appendFormat, 24 | - (void)__appendFormat:(NSString *)format arguments:(NSArray *)arguments); 25 | - (void)setString:(NSString *)aString; 26 | - (id)initWithCapacity:(NSUInteger)capacity; 27 | - (NSUInteger)replaceOccurrencesOfString:(NSString *)target withString:(NSString *)replacement options:(NSStringCompareOptions)options range:(NSRange)searchRange; 28 | 29 | #pragma clang diagnostic pop 30 | 31 | @end 32 | -------------------------------------------------------------------------------- /packages/api/Objective-C-API/Foundation/JSBNSNotification.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | @import Foundation; 4 | @import JavaScriptCore; 5 | 6 | @protocol JSBNSObject; 7 | 8 | @protocol JSBNSNotification 9 | 10 | #pragma clang diagnostic push 11 | #pragma clang diagnostic ignored "-Wdeprecated-declarations" 12 | 13 | + (instancetype)notificationWithName:(NSString *)aName object:(id)anObject; 14 | + (instancetype)notificationWithName:(NSString *)aName object:(id)anObject userInfo:(NSDictionary *)aUserInfo; 15 | 16 | @property (nonatomic, readonly) NSString *name; 17 | @property (nonatomic, readonly) id object; 18 | @property (nonatomic, readonly) NSDictionary *userInfo; 19 | - (instancetype)initWithName:(NSString *)name object:(id)object userInfo:(NSDictionary *)userInfo; 20 | 21 | #pragma clang diagnostic pop 22 | 23 | @end 24 | -------------------------------------------------------------------------------- /packages/api/Objective-C-API/Foundation/JSBNSNotificationCenter.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | @import Foundation; 4 | @import JavaScriptCore; 5 | 6 | @protocol JSBNSObject; 7 | 8 | @protocol JSBNSNotificationCenter 9 | 10 | #pragma clang diagnostic push 11 | #pragma clang diagnostic ignored "-Wdeprecated-declarations" 12 | 13 | + (instancetype)defaultCenter; 14 | 15 | - (instancetype)init; 16 | JSExportAs(addObserverSelectorName, 17 | - (void)_addObserver:(id)observer selector:(NSString*)aSelector name:(NSString *)aName); 18 | - (void)postNotification:(NSNotification *)notification; 19 | - (void)postNotificationName:(NSString *)aName object:(id)anObject; 20 | - (void)postNotificationName:(NSString *)aName object:(id)anObject userInfo:(NSDictionary *)aUserInfo; 21 | - (void)removeObserver:(id)observer; 22 | JSExportAs(removeObserverName, 23 | - (void)_removeObserver:(id)observer name:(NSString *)aName); 24 | 25 | #pragma clang diagnostic pop 26 | 27 | @end 28 | -------------------------------------------------------------------------------- /packages/api/Objective-C-API/Foundation/JSBNSNull.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | @import Foundation; 4 | @import JavaScriptCore; 5 | 6 | @protocol JSBNSObject; 7 | 8 | @protocol JSBNSNull 9 | 10 | #pragma clang diagnostic push 11 | #pragma clang diagnostic ignored "-Wdeprecated-declarations" 12 | 13 | + (NSNull *)null; 14 | 15 | #pragma clang diagnostic pop 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /packages/api/Objective-C-API/Foundation/JSBNSOperation.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | @import Foundation; 4 | @import JavaScriptCore; 5 | 6 | @protocol JSBNSObject; 7 | 8 | @protocol JSBNSOperation 9 | 10 | #pragma clang diagnostic push 11 | #pragma clang diagnostic ignored "-Wdeprecated-declarations" 12 | 13 | - (void)start; 14 | - (void)main; 15 | - (BOOL)isCancelled; 16 | - (void)cancel; 17 | - (BOOL)isExecuting; 18 | - (BOOL)isFinished; 19 | - (BOOL)isConcurrent; 20 | - (BOOL)isReady; 21 | - (void)addDependency:(NSOperation *)op; 22 | - (void)removeDependency:(NSOperation *)op; 23 | - (NSArray *)dependencies; 24 | - (NSOperationQueuePriority)queuePriority; 25 | - (void)setQueuePriority:(NSOperationQueuePriority)p; 26 | - (void (^)(void))completionBlock; 27 | - (void)setCompletionBlock:(void (^)(void))block; 28 | - (void)waitUntilFinished; 29 | - (double)threadPriority; 30 | - (void)setThreadPriority:(double)p; 31 | 32 | #pragma clang diagnostic pop 33 | 34 | @end 35 | -------------------------------------------------------------------------------- /packages/api/Objective-C-API/Foundation/JSBNSOperationQueue.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | @import Foundation; 4 | @import JavaScriptCore; 5 | 6 | @protocol JSBNSObject; 7 | 8 | @protocol JSBNSOperationQueue 9 | 10 | #pragma clang diagnostic push 11 | #pragma clang diagnostic ignored "-Wdeprecated-declarations" 12 | 13 | + (id)currentQueue; 14 | + (id)mainQueue; 15 | 16 | - (void)addOperation:(NSOperation *)op; 17 | - (void)addOperations:(NSArray *)ops waitUntilFinished:(BOOL)wait; 18 | - (void)addOperationWithBlock:(void (^)(void))block; 19 | - (NSArray *)operations; 20 | - (NSUInteger)operationCount; 21 | - (NSInteger)maxConcurrentOperationCount; 22 | - (void)setMaxConcurrentOperationCount:(NSInteger)cnt; 23 | - (void)setSuspended:(BOOL)b; 24 | - (BOOL)isSuspended; 25 | - (void)setName:(NSString *)n; 26 | - (NSString *)name; 27 | - (void)cancelAllOperations; 28 | - (void)waitUntilAllOperationsAreFinished; 29 | 30 | #pragma clang diagnostic pop 31 | 32 | @end 33 | -------------------------------------------------------------------------------- /packages/api/Objective-C-API/Foundation/JSBNSPointerArray.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | #import 4 | 5 | @import Foundation; 6 | @import JavaScriptCore; 7 | 8 | @protocol JSBNSObject; 9 | 10 | @protocol JSBNSPointerArray 11 | 12 | #pragma clang diagnostic push 13 | #pragma clang diagnostic ignored "-Wdeprecated-declarations" 14 | 15 | + pointerArrayWithOptions:(NSPointerFunctionsOptions)options; 16 | + pointerArrayWithPointerFunctions:(NSPointerFunctions *)functions; 17 | + (id)strongObjectsPointerArray; 18 | + (id)weakObjectsPointerArray; 19 | 20 | - (NSPointerFunctions *)pointerFunctions; 21 | - (void *)pointerAtIndex:(NSUInteger)index; 22 | - (void)addPointer:(void *)pointer; 23 | - (void)removePointerAtIndex:(NSUInteger)index; 24 | - (void)insertPointer:(void *)item atIndex:(NSUInteger)index; 25 | - (void)replacePointerAtIndex:(NSUInteger)index withPointer:(void *)item; 26 | - (void)compact; 27 | - (NSUInteger)count; 28 | - (void)setCount:(NSUInteger)count; 29 | - (NSArray *)allObjects; 30 | 31 | #pragma clang diagnostic pop 32 | 33 | @end 34 | -------------------------------------------------------------------------------- /packages/api/Objective-C-API/Foundation/JSBNSProxy.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | @import Foundation; 4 | @import JavaScriptCore; 5 | 6 | @protocol JSBNSObject; 7 | 8 | @protocol JSBNSProxy 9 | 10 | #pragma clang diagnostic push 11 | #pragma clang diagnostic ignored "-Wdeprecated-declarations" 12 | 13 | + (id)alloc; 14 | + (id)allocWithZone:(NSZone *)zone; 15 | + (Class)class; 16 | + (BOOL)respondsToSelector:(SEL)aSelector; 17 | 18 | - (void)forwardInvocation:(NSInvocation *)invocation; 19 | - (NSMethodSignature *)methodSignatureForSelector:(SEL)sel; 20 | - (void)dealloc; 21 | - (void)finalize; 22 | - (NSString *)description; 23 | - (NSString *)debugDescription; 24 | - (BOOL)allowsWeakReference; 25 | - (BOOL)retainWeakReference; 26 | 27 | #pragma clang diagnostic pop 28 | 29 | @end 30 | -------------------------------------------------------------------------------- /packages/api/Objective-C-API/Foundation/JSBNSSimpleCString.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | #import 4 | #import 5 | 6 | @import Foundation; 7 | @import JavaScriptCore; 8 | 9 | @protocol JSBNSString; 10 | 11 | @protocol JSBNSSimpleCString 12 | 13 | #pragma clang diagnostic push 14 | #pragma clang diagnostic ignored "-Wdeprecated-declarations" 15 | 16 | #pragma clang diagnostic pop 17 | 18 | @end 19 | -------------------------------------------------------------------------------- /packages/api/Objective-C-API/Foundation/JSBNSTimer.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | 4 | @import Foundation; 5 | @import JavaScriptCore; 6 | 7 | @protocol JSBNSObject; 8 | 9 | @protocol JSBNSTimer 10 | 11 | #pragma clang diagnostic push 12 | #pragma clang diagnostic ignored "-Wdeprecated-declarations" 13 | 14 | JSExportAs(scheduledTimerWithTimeInterval, 15 | + (NSTimer *)_scheduledTimerWithTimeInterval:(NSTimeInterval)ti repeats:(BOOL)yesOrNo block:(JSValue*)block); 16 | 17 | - (void)fire; 18 | - (NSDate *)fireDate; 19 | - (void)setFireDate:(NSDate *)date; 20 | - (NSTimeInterval)timeInterval; 21 | - (NSTimeInterval)tolerance; 22 | - (void)setTolerance:(NSTimeInterval)tolerance; 23 | - (void)invalidate; 24 | - (BOOL)isValid; 25 | - (id)userInfo; 26 | 27 | #pragma clang diagnostic pop 28 | 29 | @end 30 | -------------------------------------------------------------------------------- /packages/api/Objective-C-API/Foundation/JSBNSURLResponse.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | @import Foundation; 4 | @import JavaScriptCore; 5 | 6 | @protocol JSBNSObject; 7 | 8 | @protocol JSBNSURLResponse 9 | 10 | #pragma clang diagnostic push 11 | #pragma clang diagnostic ignored "-Wdeprecated-declarations" 12 | 13 | - (id)initWithURL:(NSURL *)URL MIMEType:(NSString *)MIMEType expectedContentLength:(NSInteger)length textEncodingName:(NSString *)name; 14 | - (NSURL *)URL; 15 | - (NSString *)MIMEType; 16 | - (long long)expectedContentLength; 17 | - (NSString *)textEncodingName; 18 | - (NSString *)suggestedFilename; 19 | 20 | #pragma clang diagnostic pop 21 | 22 | @end 23 | -------------------------------------------------------------------------------- /packages/api/Objective-C-API/Foundation/JSBNSUUID.h: -------------------------------------------------------------------------------- 1 | #import 2 | #include 3 | #include 4 | 5 | @import Foundation; 6 | @import JavaScriptCore; 7 | 8 | @protocol JSBNSObject; 9 | 10 | @protocol JSBNSUUID 11 | 12 | #pragma clang diagnostic push 13 | #pragma clang diagnostic ignored "-Wdeprecated-declarations" 14 | 15 | + (id)UUID; 16 | 17 | - (void)getUUIDBytes:(uuid_t)uuid; 18 | - (NSString *)UUIDString; 19 | 20 | #pragma clang diagnostic pop 21 | 22 | @end 23 | -------------------------------------------------------------------------------- /packages/api/Objective-C-API/MarginNote(old version)/Application/JSBDocumentController.h: -------------------------------------------------------------------------------- 1 | #import "MbAppDelegate.h" 2 | #import "JSBMindMapView.h" 3 | #import "JSBUIViewController.h" 4 | 5 | @import Foundation; 6 | @import JavaScriptCore; 7 | 8 | @protocol JSBDocumentController 9 | 10 | #pragma clang diagnostic push 11 | #pragma clang diagnostic ignored "-Wdeprecated-declarations" 12 | @property (nonatomic, readonly, getter=currBook) MbBook* document; 13 | @property (nonatomic, readonly, getter=currentBookMd5) NSString* docMd5; 14 | @property (nonatomic, readonly, getter=currTopicId) NSString* notebookId; 15 | @property (nonatomic, readonly, getter=focusNote) MbBookNote* focusNote; 16 | @property (nonatomic, readonly, getter=visibleFocusNote) MbBookNote* visibleFocusNote; 17 | @property (nonatomic, readonly, getter=selectionText) NSString* selectionText; 18 | 19 | #pragma clang diagnostic pop 20 | 21 | @end 22 | -------------------------------------------------------------------------------- /packages/api/Objective-C-API/MarginNote(old version)/Application/JSBMindMapNode.h: -------------------------------------------------------------------------------- 1 | #import "MbAppDelegate.h" 2 | #import "JSBMbBookNote.h" 3 | @import Foundation; 4 | @import JavaScriptCore; 5 | @class MindMapNote; 6 | @class MbBookNote; 7 | 8 | @protocol JSBMindMapNode 9 | #pragma clang diagnostic push 10 | #pragma clang diagnostic ignored "-Wdeprecated-declarations" 11 | 12 | @property (nonatomic,readonly) MbBookNote * note; 13 | @property (nonatomic,readonly,getter=parentNote) MindMapNote* parentNode; 14 | @property (nonatomic,readonly) NSArray* summaryLinks; 15 | @property (nonatomic,readonly,getter=childNotes) NSArray* childNodes; 16 | @property (nonatomic,readonly) CGRect frame; 17 | 18 | #pragma clang diagnostic pop 19 | 20 | @end 21 | -------------------------------------------------------------------------------- /packages/api/Objective-C-API/MarginNote(old version)/Application/JSBMindMapView.h: -------------------------------------------------------------------------------- 1 | #import "MbAppDelegate.h" 2 | #import "JSBUIScrollView.h" 3 | #import "JSBMindMapNode.h" 4 | @import Foundation; 5 | @import JavaScriptCore; 6 | 7 | @protocol JSBMindMapView 8 | #pragma clang diagnostic push 9 | #pragma clang diagnostic ignored "-Wdeprecated-declarations" 10 | 11 | @property (nonatomic,readonly) NSArray * mindmapNodes; 12 | @property (nonatomic,readonly) NSArray * selViewLst; 13 | #pragma clang diagnostic pop 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /packages/api/Objective-C-API/MarginNote(old version)/Application/JSBNotebookController.h: -------------------------------------------------------------------------------- 1 | #import "MbAppDelegate.h" 2 | #import "JSBMindMapView.h" 3 | #import "JSBOutlineView.h" 4 | #import "JSBUIViewController.h" 5 | 6 | @import Foundation; 7 | @import JavaScriptCore; 8 | 9 | @protocol JSBNotebookController 10 | 11 | #pragma clang diagnostic push 12 | #pragma clang diagnostic ignored "-Wdeprecated-declarations" 13 | @property (nonatomic,readonly) id outlineView; 14 | @property (nonatomic,readonly,getter=noteMindMap) id mindmapView; 15 | @property (nonatomic, readonly, getter=currTopic) NSString* notebookId; 16 | @property (nonatomic, readonly, getter=focusNote) MbBookNote* focusNote; 17 | @property (nonatomic, readonly, getter=visibleFocusNote) MbBookNote* visibleFocusNote; 18 | 19 | #pragma clang diagnostic pop 20 | 21 | @end 22 | -------------------------------------------------------------------------------- /packages/api/Objective-C-API/MarginNote(old version)/Application/JSBOutlineView.h: -------------------------------------------------------------------------------- 1 | #import "MbAppDelegate.h" 2 | #import "JSBUITableView.h" 3 | #import "JSBMindMapNode.h" 4 | @import Foundation; 5 | @import JavaScriptCore; 6 | @class MbBookNote; 7 | 8 | @protocol JSBOutlineView 9 | #pragma clang diagnostic push 10 | #pragma clang diagnostic ignored "-Wdeprecated-declarations" 11 | - (MbBookNote*)noteFromIndexPath:(NSIndexPath*)indexPath; 12 | #pragma clang diagnostic pop 13 | 14 | @end 15 | -------------------------------------------------------------------------------- /packages/api/Objective-C-API/MarginNote(old version)/Application/JSBReaderController.h: -------------------------------------------------------------------------------- 1 | #import "MbAppDelegate.h" 2 | #import "JSBMindMapView.h" 3 | #import "JSBUIViewController.h" 4 | #import "JSBDocumentController.h" 5 | 6 | @import Foundation; 7 | @import JavaScriptCore; 8 | 9 | @protocol JSBReaderController 10 | 11 | #pragma clang diagnostic push 12 | #pragma clang diagnostic ignored "-Wdeprecated-declarations" 13 | @property (nonatomic, readonly, getter=fBookViewController) id currentDocumentController; 14 | @property (nonatomic, readonly, getter=bookViewControllers) NSMutableArray* documentControllers; 15 | 16 | #pragma clang diagnostic pop 17 | 18 | @end 19 | -------------------------------------------------------------------------------- /packages/api/Objective-C-API/MarginNote(old version)/NoteDatabase/JSBMbBook.h: -------------------------------------------------------------------------------- 1 | #import "MbBook.h" 2 | 3 | @import Foundation; 4 | @import JavaScriptCore; 5 | 6 | @protocol JSBMbBook 7 | 8 | #pragma clang diagnostic push 9 | #pragma clang diagnostic ignored "-Wdeprecated-declarations" 10 | 11 | @property (nonatomic,readonly,getter=currenttopicid) NSString * currentTopicId; 12 | @property (nonatomic,readonly,getter=lastvisit) NSDate * lastVisit; 13 | @property (nonatomic,readonly,getter=md5real) NSString * docMd5; 14 | @property (nonatomic,readonly) NSString * pathFile; 15 | @property (nonatomic,readonly,getter=bookTitle) NSString * docTitle; 16 | #pragma clang diagnostic pop 17 | 18 | @end 19 | -------------------------------------------------------------------------------- /packages/api/Objective-C-API/MarginNote(old version)/Utility/JSBMenuController.h: -------------------------------------------------------------------------------- 1 | #import "MbAppDelegate.h" 2 | #import "JSBMindMapView.h" 3 | #import "JSBUIViewController.h" 4 | 5 | @import Foundation; 6 | @import JavaScriptCore; 7 | 8 | @protocol JSBMenuController 9 | 10 | #pragma clang diagnostic push 11 | #pragma clang diagnostic ignored "-Wdeprecated-declarations" 12 | @property (nonatomic,retain) UITableView* menuTableView; 13 | @property (nonatomic,retain) NSArray* commandTable; 14 | @property (nonatomic,retain) NSArray* sections; 15 | @property (nonatomic,assign) int rowHeight; 16 | @property (nonatomic,assign) int secHeight; 17 | @property (nonatomic,assign) int fontSize; 18 | 19 | #pragma clang diagnostic pop 20 | 21 | @end 22 | -------------------------------------------------------------------------------- /packages/api/Objective-C-API/MarginNote(old version)/Utility/JSBSpeechManager.h: -------------------------------------------------------------------------------- 1 | #import "MbAppDelegate.h" 2 | 3 | @import Foundation; 4 | @import JavaScriptCore; 5 | 6 | @class SpeechManager; 7 | 8 | @protocol JSBSpeechManager 9 | 10 | #pragma clang diagnostic push 11 | #pragma clang diagnostic ignored "-Wdeprecated-declarations" 12 | - (void)startSpeechNotes:(NSArray*)notes; 13 | - (void)stopSpeech; 14 | - (void)pauseSpeech; 15 | - (void)continueSpeech; 16 | - (void)prevSpeech; 17 | - (void)nextSpeech; 18 | - (BOOL)canPrev; 19 | - (BOOL)canNext; 20 | - (void)playText:(NSString*)text; 21 | - (void)playText:(NSString *)text languageTxt:(NSString*)languageTxt; 22 | @property (nonatomic,readonly) BOOL speaking; 23 | @property (nonatomic,readonly) BOOL paused; 24 | @property (nonatomic,weak) UIWindow * sceneWindow; 25 | @property (nonatomic,strong) NSString * languageCode; 26 | + (SpeechManager *)sharedInstance; 27 | 28 | #pragma clang diagnostic pop 29 | 30 | @end 31 | -------------------------------------------------------------------------------- /packages/api/Objective-C-API/MarginNote(old version)/Utility/JSBUndoManager.h: -------------------------------------------------------------------------------- 1 | #import "MbAppDelegate.h" 2 | #import "JSBMindMapView.h" 3 | #import "JSBUIViewController.h" 4 | 5 | @import Foundation; 6 | @import JavaScriptCore; 7 | 8 | @protocol JSBUndoManager 9 | 10 | #pragma clang diagnostic push 11 | #pragma clang diagnostic ignored "-Wdeprecated-declarations" 12 | + (id)sharedInstance; 13 | JSExportAs(undoGrouping, 14 | - (void)undoGrouping:(NSString*)actionName inNotebook:(NSString*)topicid block:(JSValue*)block); 15 | - (void)undo; 16 | - (void)redo; 17 | - (BOOL)canUndo; 18 | - (BOOL)canRedo; 19 | - (void)clearAll; 20 | 21 | #pragma clang diagnostic pop 22 | 23 | @end 24 | -------------------------------------------------------------------------------- /packages/api/Objective-C-API/MarginNote(old version)/Utility/JSBZipArchive.h: -------------------------------------------------------------------------------- 1 | #import "SSZipArchive.h" 2 | 3 | #import "JSBNSObject.h" 4 | @import Foundation; 5 | @import JavaScriptCore; 6 | 7 | @protocol JSBSSZipArchive 8 | 9 | #pragma clang diagnostic push 10 | #pragma clang diagnostic ignored "-Wdeprecated-declarations" 11 | 12 | // Unzip 13 | + (BOOL)unzipFileAtPath:(NSString *)path toDestination:(NSString *)destination; 14 | + (BOOL)unzipFileAtPath:(NSString *)path toDestination:(NSString *)destination overwrite:(BOOL)overwrite password:(NSString *)password; 15 | 16 | // Zip 17 | + (BOOL)createZipFileAtPath:(NSString *)path withFilesAtPaths:(NSArray *)filenames; 18 | + (BOOL)createZipFileAtPath:(NSString *)path withContentsOfDirectory:(NSString *)directoryPath; 19 | 20 | - (id)initWithPath:(NSString *)path; 21 | - (BOOL)open; 22 | - (BOOL)writeFile:(NSString *)path; 23 | - (BOOL)writeData:(NSData *)data filename:(NSString *)filename; 24 | - (BOOL)close; 25 | 26 | #pragma clang diagnostic pop 27 | 28 | @end 29 | -------------------------------------------------------------------------------- /packages/api/Objective-C-API/QuartzCore/JSBCAAnimation.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | 4 | @import QuartzCore; 5 | @import JavaScriptCore; 6 | 7 | @protocol JSBNSObject; 8 | 9 | @protocol JSBCAAnimation 10 | 11 | #pragma clang diagnostic push 12 | #pragma clang diagnostic ignored "-Wdeprecated-declarations" 13 | 14 | + (id)animation; 15 | + (id)defaultValueForKey:(NSString *)key; 16 | 17 | - (BOOL)shouldArchiveValueForKey:(NSString *)key; 18 | 19 | #pragma clang diagnostic pop 20 | 21 | @end 22 | -------------------------------------------------------------------------------- /packages/api/Objective-C-API/QuartzCore/JSBCABasicAnimation.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | 4 | @import QuartzCore; 5 | @import JavaScriptCore; 6 | 7 | @protocol JSBCAPropertyAnimation; 8 | 9 | @protocol JSBCABasicAnimation 10 | 11 | #pragma clang diagnostic push 12 | #pragma clang diagnostic ignored "-Wdeprecated-declarations" 13 | 14 | #pragma clang diagnostic pop 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /packages/api/Objective-C-API/QuartzCore/JSBCAGradientLayer.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | @import QuartzCore; 4 | @import JavaScriptCore; 5 | 6 | @protocol JSBCALayer; 7 | 8 | @protocol JSBCAGradientLayer 9 | 10 | #pragma clang diagnostic push 11 | #pragma clang diagnostic ignored "-Wdeprecated-declarations" 12 | 13 | @property (copy) NSArray *colors; 14 | @property (copy) NSString *type; 15 | @property (copy) NSArray *locations; 16 | @property CGPoint startPoint, endPoint; 17 | 18 | #pragma clang diagnostic pop 19 | 20 | @end 21 | -------------------------------------------------------------------------------- /packages/api/Objective-C-API/QuartzCore/JSBCAKeyframeAnimation.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | 4 | @import QuartzCore; 5 | @import JavaScriptCore; 6 | 7 | @protocol JSBCAPropertyAnimation; 8 | 9 | @protocol JSBCAKeyframeAnimation 10 | 11 | #pragma clang diagnostic push 12 | #pragma clang diagnostic ignored "-Wdeprecated-declarations" 13 | 14 | #pragma clang diagnostic pop 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /packages/api/Objective-C-API/QuartzCore/JSBCAMediaTimingFunction.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | 4 | @import QuartzCore; 5 | @import JavaScriptCore; 6 | 7 | @protocol JSBNSObject; 8 | 9 | @protocol JSBCAMediaTimingFunction 10 | 11 | #pragma clang diagnostic push 12 | #pragma clang diagnostic ignored "-Wdeprecated-declarations" 13 | 14 | + (id)functionWithName:(NSString *)name; 15 | + (id)functionWithControlPoints:(float)c1x :(float)c1y :(float)c2x :(float)c2y; 16 | 17 | - (id)initWithControlPoints:(float)c1x :(float)c1y :(float)c2x :(float)c2y; 18 | - (void)getControlPointAtIndex:(size_t)idx values:(float [2])ptr; 19 | 20 | #pragma clang diagnostic pop 21 | 22 | @end 23 | -------------------------------------------------------------------------------- /packages/api/Objective-C-API/QuartzCore/JSBCAReplicatorLayer.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | @import QuartzCore; 4 | @import JavaScriptCore; 5 | 6 | @protocol JSBCALayer; 7 | 8 | @protocol JSBCAReplicatorLayer 9 | 10 | #pragma clang diagnostic push 11 | #pragma clang diagnostic ignored "-Wdeprecated-declarations" 12 | 13 | @property BOOL preservesDepth; 14 | @property NSInteger instanceCount; 15 | @property id instanceColor; 16 | @property CATransform3D instanceTransform; 17 | @property float instanceRedOffset, instanceGreenOffset; 18 | @property CFTimeInterval instanceDelay; 19 | @property float instanceBlueOffset, instanceAlphaOffset; 20 | 21 | #pragma clang diagnostic pop 22 | 23 | @end 24 | -------------------------------------------------------------------------------- /packages/api/Objective-C-API/QuartzCore/JSBCAScrollLayer.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | @import QuartzCore; 4 | @import JavaScriptCore; 5 | 6 | @protocol JSBCALayer; 7 | 8 | @protocol JSBCAScrollLayer 9 | 10 | #pragma clang diagnostic push 11 | #pragma clang diagnostic ignored "-Wdeprecated-declarations" 12 | 13 | - (void)scrollToPoint:(CGPoint)p; 14 | - (void)scrollToRect:(CGRect)r; 15 | 16 | #pragma clang diagnostic pop 17 | 18 | @end 19 | -------------------------------------------------------------------------------- /packages/api/Objective-C-API/QuartzCore/JSBCAShapeLayer.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | @import QuartzCore; 4 | @import JavaScriptCore; 5 | 6 | @protocol JSBCALayer; 7 | 8 | @protocol JSBCAShapeLayer 9 | 10 | #pragma clang diagnostic push 11 | #pragma clang diagnostic ignored "-Wdeprecated-declarations" 12 | 13 | @property CGFloat miterLimit; 14 | @property (copy) NSString *lineCap; 15 | @property (copy) NSArray *lineDashPattern; 16 | @property CGFloat lineDashPhase; 17 | @property (nullable,getter=_fillColor,setter=_setFillColor:) id fillColor; 18 | @property CGFloat strokeStart, strokeEnd; 19 | @property (nullable,getter=_strokeColor,setter=_setStrokeColor:) id strokeColor; 20 | @property (nullable,getter=_path,setter=_setPath:) id path; 21 | @property (copy) NSString *fillRule; 22 | @property (copy) NSString *lineJoin; 23 | @property CGFloat lineWidth; 24 | 25 | #pragma clang diagnostic pop 26 | 27 | @end 28 | -------------------------------------------------------------------------------- /packages/api/Objective-C-API/QuartzCore/JSBCATextLayer.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | @import QuartzCore; 4 | @import JavaScriptCore; 5 | 6 | @protocol JSBCALayer; 7 | 8 | @protocol JSBCATextLayer 9 | 10 | #pragma clang diagnostic push 11 | #pragma clang diagnostic ignored "-Wdeprecated-declarations" 12 | 13 | @property (copy) id string; 14 | @property (copy) NSString *truncationMode; 15 | @property CGFloat fontSize; 16 | @property id foregroundColor; 17 | @property (copy) NSString *alignmentMode; 18 | @property id font; 19 | @property (getter = isWrapped) BOOL wrapped; 20 | 21 | #pragma clang diagnostic pop 22 | 23 | @end 24 | -------------------------------------------------------------------------------- /packages/api/Objective-C-API/QuartzCore/JSBCATiledLayer.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | @import QuartzCore; 4 | @import JavaScriptCore; 5 | 6 | @protocol JSBCALayer; 7 | 8 | @protocol JSBCATiledLayer 9 | 10 | #pragma clang diagnostic push 11 | #pragma clang diagnostic ignored "-Wdeprecated-declarations" 12 | 13 | @property size_t levelsOfDetailBias; 14 | @property size_t levelsOfDetail; 15 | @property CGSize tileSize; 16 | 17 | + (CFTimeInterval)fadeDuration; 18 | 19 | #pragma clang diagnostic pop 20 | 21 | @end 22 | -------------------------------------------------------------------------------- /packages/api/Objective-C-API/QuartzCore/JSBCATransaction.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | 4 | @import QuartzCore; 5 | @import JavaScriptCore; 6 | 7 | @protocol JSBNSObject; 8 | 9 | @protocol JSBCATransaction 10 | 11 | #pragma clang diagnostic push 12 | #pragma clang diagnostic ignored "-Wdeprecated-declarations" 13 | 14 | + (void)begin; 15 | + (void)commit; 16 | + (void)flush; 17 | + (void)lock; 18 | + (void)unlock; 19 | + (CFTimeInterval)animationDuration; 20 | + (void)setAnimationDuration:(CFTimeInterval)dur; 21 | + (CAMediaTimingFunction *)animationTimingFunction; 22 | + (void)setAnimationTimingFunction:(CAMediaTimingFunction *)function; 23 | + (BOOL)disableActions; 24 | + (void)setDisableActions:(BOOL)flag; 25 | + (void (^)(void))completionBlock; 26 | + (void)setCompletionBlock:(void (^)(void))block; 27 | + (id)valueForKey:(NSString *)key; 28 | + (void)setValue:(id)anObject forKey:(NSString *)key; 29 | 30 | #pragma clang diagnostic pop 31 | 32 | @end 33 | -------------------------------------------------------------------------------- /packages/api/Objective-C-API/QuartzCore/JSBCATransformLayer.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | @import QuartzCore; 4 | @import JavaScriptCore; 5 | 6 | @protocol JSBCALayer; 7 | 8 | @protocol JSBCATransformLayer 9 | 10 | #pragma clang diagnostic push 11 | #pragma clang diagnostic ignored "-Wdeprecated-declarations" 12 | 13 | #pragma clang diagnostic pop 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /packages/api/Objective-C-API/QuartzCore/JSBCAValueFunction.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | 4 | @import QuartzCore; 5 | @import JavaScriptCore; 6 | 7 | @protocol JSBNSObject; 8 | 9 | @protocol JSBCAValueFunction 10 | 11 | #pragma clang diagnostic push 12 | #pragma clang diagnostic ignored "-Wdeprecated-declarations" 13 | 14 | @property (readonly) NSString *name; 15 | 16 | + (id)functionWithName:(NSString *)name; 17 | 18 | #pragma clang diagnostic pop 19 | 20 | @end 21 | -------------------------------------------------------------------------------- /packages/api/Objective-C-API/UIKit/JSBNSMutableParagraphStyle.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | 4 | #import 5 | @import JavaScriptCore; 6 | 7 | @protocol JSBNSParagraphStyle; 8 | 9 | @protocol JSBNSMutableParagraphStyle 10 | 11 | #pragma clang diagnostic push 12 | #pragma clang diagnostic ignored "-Wdeprecated-declarations" 13 | 14 | #pragma clang diagnostic pop 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /packages/api/Objective-C-API/UIKit/JSBNSTextStorage.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | #import 4 | 5 | #import 6 | @import JavaScriptCore; 7 | 8 | @protocol JSBNSMutableAttributedString; 9 | 10 | @protocol JSBNSTextStorage 11 | 12 | #pragma clang diagnostic push 13 | #pragma clang diagnostic ignored "-Wdeprecated-declarations" 14 | 15 | @property (readonly) BOOL fixesAttributesLazily; 16 | @property NSTextStorageEditActions editedMask; 17 | @property (readonly) NSArray *layoutManagers; 18 | @property (assign) id delegate; 19 | @property NSInteger changeInLength; 20 | @property NSRange editedRange; 21 | 22 | - (void)addLayoutManager:(NSLayoutManager *)aLayoutManager; 23 | - (void)removeLayoutManager:(NSLayoutManager *)aLayoutManager; 24 | - (void)edited:(NSTextStorageEditActions)editedMask range:(NSRange)editedRange changeInLength:(NSInteger)delta; 25 | - (void)processEditing; 26 | - (void)invalidateAttributesInRange:(NSRange)range; 27 | - (void)ensureAttributesAreFixedInRange:(NSRange)range; 28 | 29 | #pragma clang diagnostic pop 30 | 31 | @end 32 | -------------------------------------------------------------------------------- /packages/api/Objective-C-API/UIKit/JSBUIActivityIndicatorView.h: -------------------------------------------------------------------------------- 1 | #import 2 | @import JavaScriptCore; 3 | 4 | @protocol JSBUIView; 5 | 6 | @protocol JSBUIActivityIndicatorView 7 | 8 | #pragma clang diagnostic push 9 | #pragma clang diagnostic ignored "-Wdeprecated-declarations" 10 | 11 | @property (nonatomic) UIActivityIndicatorViewStyle activityIndicatorViewStyle; 12 | @property (nonatomic) BOOL hidesWhenStopped; 13 | @property (readwrite, nonatomic, retain) UIColor *color; 14 | 15 | //- (id)initWithActivityIndicatorStyle:(UIActivityIndicatorViewStyle)style; 16 | - (void)startAnimating; 17 | - (void)stopAnimating; 18 | - (BOOL)isAnimating; 19 | 20 | #pragma clang diagnostic pop 21 | 22 | @end 23 | -------------------------------------------------------------------------------- /packages/api/Objective-C-API/UIKit/JSBUIBarItem.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | #import 4 | @import JavaScriptCore; 5 | 6 | @protocol JSBNSObject; 7 | 8 | @protocol JSBUIBarItem 9 | 10 | #pragma clang diagnostic push 11 | #pragma clang diagnostic ignored "-Wdeprecated-declarations" 12 | 13 | @property (nonatomic, getter = isEnabled) BOOL enabled; 14 | @property (nonatomic, copy) NSString *title; 15 | @property (nonatomic, retain) UIImage *image; 16 | @property (nonatomic) NSInteger tag; 17 | @property (nonatomic) UIEdgeInsets imageInsets; 18 | @property (nonatomic) UIEdgeInsets landscapeImagePhoneInsets; 19 | @property (nonatomic, retain) UIImage *landscapeImagePhone; 20 | 21 | - (void)setTitleTextAttributes:(NSDictionary *)attributes forState:(UIControlState)state; 22 | - (NSDictionary *)titleTextAttributesForState:(UIControlState)state; 23 | 24 | #pragma clang diagnostic pop 25 | 26 | @end 27 | -------------------------------------------------------------------------------- /packages/api/Objective-C-API/UIKit/JSBUICollectionViewCell.h: -------------------------------------------------------------------------------- 1 | 2 | #import 3 | @import JavaScriptCore; 4 | 5 | @protocol JSBUICollectionReusableView; 6 | 7 | @protocol JSBUICollectionViewCell 8 | 9 | #pragma clang diagnostic push 10 | #pragma clang diagnostic ignored "-Wdeprecated-declarations" 11 | 12 | #pragma clang diagnostic pop 13 | 14 | @end 15 | -------------------------------------------------------------------------------- /packages/api/Objective-C-API/UIKit/JSBUICollectionViewController.h: -------------------------------------------------------------------------------- 1 | 2 | #import 3 | @import JavaScriptCore; 4 | 5 | @protocol JSBUIViewController; 6 | 7 | @protocol JSBUICollectionViewController 8 | 9 | #pragma clang diagnostic push 10 | #pragma clang diagnostic ignored "-Wdeprecated-declarations" 11 | 12 | @property (nonatomic) BOOL clearsSelectionOnViewWillAppear; 13 | @property (nonatomic, readonly) UICollectionViewLayout *collectionViewLayout; 14 | @property (nonatomic, assign) BOOL useLayoutToLayoutNavigationTransitions; 15 | @property (nonatomic, retain) UICollectionView *collectionView; 16 | 17 | - (id)initWithCollectionViewLayout:(UICollectionViewLayout *)layout; 18 | 19 | #pragma clang diagnostic pop 20 | 21 | @end 22 | -------------------------------------------------------------------------------- /packages/api/Objective-C-API/UIKit/JSBUIDatePicker.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | @import JavaScriptCore; 4 | 5 | @protocol JSBUIControl; 6 | 7 | @protocol JSBUIDatePicker 8 | 9 | #pragma clang diagnostic push 10 | #pragma clang diagnostic ignored "-Wdeprecated-declarations" 11 | 12 | @property (nonatomic, retain) NSLocale *locale; 13 | @property (nonatomic) UIDatePickerMode datePickerMode; 14 | @property (nonatomic, retain) NSTimeZone *timeZone; 15 | @property (nonatomic) NSTimeInterval countDownDuration; 16 | @property (nonatomic) NSInteger minuteInterval; 17 | @property (nonatomic, retain) NSDate *date; 18 | @property (nonatomic, retain) NSDate *minimumDate; 19 | @property (nonatomic, copy) NSCalendar *calendar; 20 | @property (nonatomic, retain) NSDate *maximumDate; 21 | 22 | - (void)setDate:(NSDate *)date animated:(BOOL)animated; 23 | 24 | #pragma clang diagnostic pop 25 | 26 | @end 27 | -------------------------------------------------------------------------------- /packages/api/Objective-C-API/UIKit/JSBUIEvent.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | #import 4 | @import JavaScriptCore; 5 | 6 | @protocol JSBNSObject; 7 | 8 | @protocol JSBUIEvent 9 | 10 | #pragma clang diagnostic push 11 | #pragma clang diagnostic ignored "-Wdeprecated-declarations" 12 | 13 | @property (nonatomic, readonly) UIEventType type; 14 | @property (nonatomic, readonly) UIEventSubtype subtype; 15 | @property (nonatomic, readonly) NSTimeInterval timestamp; 16 | 17 | - (NSSet *)allTouches; 18 | - (NSSet *)touchesForWindow:(UIWindow *)window; 19 | - (NSSet *)touchesForView:(UIView *)view; 20 | - (NSSet *)touchesForGestureRecognizer:(UIGestureRecognizer *)gesture; 21 | 22 | #pragma clang diagnostic pop 23 | 24 | @end 25 | -------------------------------------------------------------------------------- /packages/api/Objective-C-API/UIKit/JSBUIFont.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | @import JavaScriptCore; 4 | 5 | @protocol JSBNSObject; 6 | 7 | @protocol JSBUIFont 8 | 9 | #pragma clang diagnostic push 10 | #pragma clang diagnostic ignored "-Wdeprecated-declarations" 11 | 12 | + (CGFloat)labelFontSize; 13 | + (CGFloat)buttonFontSize; 14 | + (CGFloat)smallSystemFontSize; 15 | + (CGFloat)systemFontSize; 16 | + (UIFont *)preferredFontForTextStyle:(NSString *)style; 17 | + (UIFont *)fontWithName:(NSString *)fontName size:(CGFloat)fontSize; 18 | + (NSArray *)familyNames; 19 | + (NSArray *)fontNamesForFamilyName:(NSString *)familyName; 20 | + (UIFont *)systemFontOfSize:(CGFloat)fontSize; 21 | + (UIFont *)boldSystemFontOfSize:(CGFloat)fontSize; 22 | + (UIFont *)italicSystemFontOfSize:(CGFloat)fontSize; 23 | //+ (UIFont *)fontWithDescriptor:(UIFontDescriptor *)descriptor size:(CGFloat)pointSize; 24 | 25 | - (UIFont *)fontWithSize:(CGFloat)fontSize; 26 | //- (UIFontDescriptor *)fontDescriptor; 27 | 28 | #pragma clang diagnostic pop 29 | 30 | @end 31 | -------------------------------------------------------------------------------- /packages/api/Objective-C-API/UIKit/JSBUIImageView.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | @import JavaScriptCore; 4 | 5 | @protocol JSBUIView; 6 | 7 | @protocol JSBUIImageView 8 | 9 | #pragma clang diagnostic push 10 | #pragma clang diagnostic ignored "-Wdeprecated-declarations" 11 | 12 | @property (nonatomic) NSInteger animationRepeatCount; 13 | @property (nonatomic, copy) NSArray *highlightedAnimationImages; 14 | @property (nonatomic, getter = isHighlighted) BOOL highlighted; 15 | @property (nonatomic) NSTimeInterval animationDuration; 16 | @property (nonatomic, retain) UIImage *image; 17 | @property (nonatomic, copy) NSArray *animationImages; 18 | @property (nonatomic, retain) UIImage *highlightedImage; 19 | 20 | //- (id)initWithImage:(UIImage *)image; 21 | //- (id)initWithImage:(UIImage *)image highlightedImage:(UIImage *)highlightedImage; 22 | - (void)startAnimating; 23 | - (void)stopAnimating; 24 | - (BOOL)isAnimating; 25 | 26 | #pragma clang diagnostic pop 27 | 28 | @end 29 | -------------------------------------------------------------------------------- /packages/api/Objective-C-API/UIKit/JSBUIKeyCommand.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | @import JavaScriptCore; 4 | 5 | @protocol JSBNSObject; 6 | 7 | @protocol JSBUIKeyCommand 8 | 9 | #pragma clang diagnostic push 10 | #pragma clang diagnostic ignored "-Wdeprecated-declarations" 11 | 12 | @property (nonatomic, readonly) NSString *input; 13 | @property (nonatomic, readonly) NSUndoManager *undoManager; 14 | @property (nonatomic, readonly) NSArray *keyCommands; 15 | //@property (readonly, retain) UITextInputMode *textInputMode; 16 | @property (nonatomic, readonly) UIKeyModifierFlags modifierFlags; 17 | @property (readonly, retain) UIView *inputView; 18 | @property (readonly, retain) NSString *textInputContextIdentifier; 19 | @property (readonly, retain) UIView *inputAccessoryView; 20 | 21 | + (UIKeyCommand *)keyCommandWithInput:(NSString *)input modifierFlags:(UIKeyModifierFlags)modifierFlags action:(SEL)action; 22 | 23 | #pragma clang diagnostic pop 24 | 25 | @end 26 | -------------------------------------------------------------------------------- /packages/api/Objective-C-API/UIKit/JSBUILocalNotification.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | @import JavaScriptCore; 4 | 5 | @protocol JSBNSObject; 6 | 7 | @protocol JSBUILocalNotification 8 | 9 | #pragma clang diagnostic push 10 | #pragma clang diagnostic ignored "-Wdeprecated-declarations" 11 | 12 | @property (nonatomic, copy) NSTimeZone *timeZone; 13 | @property (nonatomic, copy) NSDictionary *userInfo; 14 | @property (nonatomic, copy) NSString *alertBody; 15 | @property (nonatomic, copy) NSString *soundName; 16 | @property (nonatomic, copy) NSDate *fireDate; 17 | 18 | #pragma clang diagnostic pop 19 | 20 | @end 21 | -------------------------------------------------------------------------------- /packages/api/Objective-C-API/UIKit/JSBUILongPressGestureRecognizer.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | #import 4 | 5 | #import 6 | @import JavaScriptCore; 7 | 8 | @protocol JSBUIGestureRecognizer; 9 | 10 | @protocol JSBUILongPressGestureRecognizer 11 | 12 | #pragma clang diagnostic push 13 | #pragma clang diagnostic ignored "-Wdeprecated-declarations" 14 | 15 | @property (nonatomic) CGFloat allowableMovement; 16 | @property (nonatomic) CFTimeInterval minimumPressDuration; 17 | @property (nonatomic) NSUInteger numberOfTapsRequired; 18 | @property (nonatomic) NSUInteger numberOfTouchesRequired; 19 | 20 | #pragma clang diagnostic pop 21 | 22 | @end 23 | -------------------------------------------------------------------------------- /packages/api/Objective-C-API/UIKit/JSBUIPageControl.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | @import JavaScriptCore; 4 | 5 | @protocol JSBUIControl; 6 | 7 | @protocol JSBUIPageControl 8 | 9 | #pragma clang diagnostic push 10 | #pragma clang diagnostic ignored "-Wdeprecated-declarations" 11 | 12 | @property (nonatomic) NSInteger numberOfPages; 13 | @property (nonatomic) BOOL defersCurrentPageDisplay; 14 | @property (nonatomic, retain) UIColor *pageIndicatorTintColor; 15 | @property (nonatomic) BOOL hidesForSinglePage; 16 | @property (nonatomic) NSInteger currentPage; 17 | @property (nonatomic, retain) UIColor *currentPageIndicatorTintColor; 18 | 19 | - (void)updateCurrentPageDisplay; 20 | - (CGSize)sizeForNumberOfPages:(NSInteger)pageCount; 21 | 22 | #pragma clang diagnostic pop 23 | 24 | @end 25 | -------------------------------------------------------------------------------- /packages/api/Objective-C-API/UIKit/JSBUIPanGestureRecognizer.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | 4 | #import 5 | @import JavaScriptCore; 6 | 7 | @protocol JSBUIGestureRecognizer; 8 | 9 | @protocol JSBUIPanGestureRecognizer 10 | 11 | #pragma clang diagnostic push 12 | #pragma clang diagnostic ignored "-Wdeprecated-declarations" 13 | 14 | @property (nonatomic) NSUInteger minimumNumberOfTouches; 15 | @property (nonatomic) NSUInteger maximumNumberOfTouches; 16 | 17 | - (CGPoint)translationInView:(UIView *)view; 18 | - (void)setTranslation:(CGPoint)translation inView:(UIView *)view; 19 | - (CGPoint)velocityInView:(UIView *)view; 20 | 21 | #pragma clang diagnostic pop 22 | 23 | @end 24 | -------------------------------------------------------------------------------- /packages/api/Objective-C-API/UIKit/JSBUIPickerView.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | #import 4 | @import JavaScriptCore; 5 | 6 | @protocol JSBUIView; 7 | 8 | @protocol JSBUIPickerView 9 | 10 | #pragma clang diagnostic push 11 | #pragma clang diagnostic ignored "-Wdeprecated-declarations" 12 | 13 | @property (nonatomic) BOOL showsSelectionIndicator; 14 | @property (nonatomic, assign) id dataSource; 15 | @property (nonatomic, assign) id delegate; 16 | @property (nonatomic, readonly) NSInteger numberOfComponents; 17 | 18 | - (NSInteger)numberOfRowsInComponent:(NSInteger)component; 19 | - (CGSize)rowSizeForComponent:(NSInteger)component; 20 | - (UIView *)viewForRow:(NSInteger)row forComponent:(NSInteger)component; 21 | - (void)reloadAllComponents; 22 | - (void)reloadComponent:(NSInteger)component; 23 | - (void)selectRow:(NSInteger)row inComponent:(NSInteger)component animated:(BOOL)animated; 24 | - (NSInteger)selectedRowInComponent:(NSInteger)component; 25 | 26 | #pragma clang diagnostic pop 27 | 28 | @end 29 | -------------------------------------------------------------------------------- /packages/api/Objective-C-API/UIKit/JSBUIPinchGestureRecognizer.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | 4 | #import 5 | @import JavaScriptCore; 6 | 7 | @protocol JSBUIGestureRecognizer; 8 | 9 | @protocol JSBUIPinchGestureRecognizer 10 | 11 | #pragma clang diagnostic push 12 | #pragma clang diagnostic ignored "-Wdeprecated-declarations" 13 | 14 | @property (nonatomic) CGFloat scale; 15 | @property (nonatomic, readonly) CGFloat velocity; 16 | 17 | #pragma clang diagnostic pop 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /packages/api/Objective-C-API/UIKit/JSBUIRotationGestureRecognizer.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | 4 | #import 5 | @import JavaScriptCore; 6 | 7 | @protocol JSBUIGestureRecognizer; 8 | 9 | @protocol JSBUIRotationGestureRecognizer 10 | 11 | #pragma clang diagnostic push 12 | #pragma clang diagnostic ignored "-Wdeprecated-declarations" 13 | 14 | @property (nonatomic) CGFloat rotation; 15 | @property (nonatomic, readonly) CGFloat velocity; 16 | 17 | #pragma clang diagnostic pop 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /packages/api/Objective-C-API/UIKit/JSBUIScreenMode.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | 4 | #import 5 | @import JavaScriptCore; 6 | 7 | @protocol JSBNSObject; 8 | 9 | @protocol JSBUIScreenMode 10 | 11 | #pragma clang diagnostic push 12 | #pragma clang diagnostic ignored "-Wdeprecated-declarations" 13 | 14 | @property (readonly, nonatomic) CGFloat pixelAspectRatio; 15 | @property (readonly, nonatomic) CGSize size; 16 | 17 | #pragma clang diagnostic pop 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /packages/api/Objective-C-API/UIKit/JSBUISwipeGestureRecognizer.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | 4 | #import 5 | @import JavaScriptCore; 6 | 7 | @protocol JSBUIGestureRecognizer; 8 | 9 | @protocol JSBUISwipeGestureRecognizer 10 | 11 | #pragma clang diagnostic push 12 | #pragma clang diagnostic ignored "-Wdeprecated-declarations" 13 | 14 | @property (nonatomic) NSUInteger numberOfTouchesRequired; 15 | @property (nonatomic) UISwipeGestureRecognizerDirection direction; 16 | 17 | #pragma clang diagnostic pop 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /packages/api/Objective-C-API/UIKit/JSBUISwitch.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | #import 4 | @import JavaScriptCore; 5 | 6 | @protocol JSBUIControl; 7 | 8 | @protocol JSBUISwitch 9 | 10 | #pragma clang diagnostic push 11 | #pragma clang diagnostic ignored "-Wdeprecated-declarations" 12 | 13 | @property (nonatomic, retain) UIColor *onTintColor; 14 | @property (nonatomic, getter = isOn) BOOL on; 15 | 16 | - (void)setOn:(BOOL)on animated:(BOOL)animated; 17 | 18 | #pragma clang diagnostic pop 19 | 20 | @end 21 | -------------------------------------------------------------------------------- /packages/api/Objective-C-API/UIKit/JSBUITabBarController.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | @import JavaScriptCore; 4 | 5 | @protocol JSBUIViewController; 6 | 7 | @protocol JSBUITabBarController 8 | 9 | #pragma clang diagnostic push 10 | #pragma clang diagnostic ignored "-Wdeprecated-declarations" 11 | 12 | @property (nonatomic, readonly) UITabBar *tabBar; 13 | @property (nonatomic, assign) UIViewController *selectedViewController; 14 | @property (nonatomic, readonly) UINavigationController *moreNavigationController; 15 | @property (nonatomic, readonly, retain) UITabBarController *tabBarController; 16 | @property (nonatomic, retain) UITabBarItem *tabBarItem; 17 | @property (nonatomic, copy) NSArray *customizableViewControllers; 18 | @property (nonatomic, copy) NSArray *viewControllers; 19 | @property (nonatomic, assign) id delegate; 20 | @property (nonatomic) NSUInteger selectedIndex; 21 | 22 | - (void)setViewControllers:(NSArray *)viewControllers animated:(BOOL)animated; 23 | 24 | #pragma clang diagnostic pop 25 | 26 | @end 27 | -------------------------------------------------------------------------------- /packages/api/Objective-C-API/UIKit/JSBUITabBarItem.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | @import JavaScriptCore; 4 | 5 | @protocol JSBUIBarItem; 6 | 7 | @protocol JSBUITabBarItem 8 | 9 | #pragma clang diagnostic push 10 | #pragma clang diagnostic ignored "-Wdeprecated-declarations" 11 | 12 | @property (nonatomic, retain) UIImage *selectedImage; 13 | @property (nonatomic, copy) NSString *badgeValue; 14 | 15 | //- (id)initWithTitle:(NSString *)title image:(UIImage *)image tag:(NSInteger)tag; 16 | //- (instancetype)initWithTitle:(NSString *)title image:(UIImage *)image selectedImage:(UIImage *)selectedImage; 17 | //- (id)initWithTabBarSystemItem:(UITabBarSystemItem)systemItem tag:(NSInteger)tag; 18 | - (void)setFinishedSelectedImage:(UIImage *)selectedImage withFinishedUnselectedImage:(UIImage *)unselectedImage; 19 | - (UIImage *)finishedSelectedImage; 20 | - (UIImage *)finishedUnselectedImage; 21 | - (void)setTitlePositionAdjustment:(UIOffset)adjustment; 22 | - (UIOffset)titlePositionAdjustment; 23 | 24 | #pragma clang diagnostic pop 25 | 26 | @end 27 | -------------------------------------------------------------------------------- /packages/api/Objective-C-API/UIKit/JSBUITableViewController.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | @import JavaScriptCore; 4 | 5 | @protocol JSBUIViewController; 6 | 7 | @protocol JSBUITableViewController 8 | 9 | #pragma clang diagnostic push 10 | #pragma clang diagnostic ignored "-Wdeprecated-declarations" 11 | 12 | @property (nonatomic) BOOL clearsSelectionOnViewWillAppear; 13 | @property (nonatomic, retain) UITableView *tableView; 14 | 15 | - (id)initWithStyle:(UITableViewStyle)style; 16 | 17 | #pragma clang diagnostic pop 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /packages/api/Objective-C-API/UIKit/JSBUITapGestureRecognizer.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | #import 4 | 5 | #import 6 | @import JavaScriptCore; 7 | 8 | @protocol JSBUIGestureRecognizer; 9 | 10 | @protocol JSBUITapGestureRecognizer 11 | 12 | #pragma clang diagnostic push 13 | #pragma clang diagnostic ignored "-Wdeprecated-declarations" 14 | 15 | @property (nonatomic) NSUInteger numberOfTapsRequired; 16 | @property (nonatomic) NSUInteger numberOfTouchesRequired; 17 | 18 | #pragma clang diagnostic pop 19 | 20 | @end 21 | -------------------------------------------------------------------------------- /packages/api/Objective-C-API/UIKit/JSBUIToolbar.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | @import JavaScriptCore; 4 | 5 | @protocol JSBUIView; 6 | 7 | @protocol JSBUIToolbar 8 | 9 | #pragma clang diagnostic push 10 | #pragma clang diagnostic ignored "-Wdeprecated-declarations" 11 | 12 | @property (nonatomic, assign) id delegate; 13 | @property (nonatomic, copy) NSArray *items; 14 | @property (nonatomic, assign, getter = isTranslucent) BOOL translucent; 15 | @property (nonatomic, retain) UIColor *barTintColor; 16 | @property (nonatomic) UIBarStyle barStyle; 17 | 18 | - (void)setItems:(NSArray *)items animated:(BOOL)animated; 19 | 20 | #pragma clang diagnostic pop 21 | 22 | @end 23 | -------------------------------------------------------------------------------- /packages/api/Objective-C-API/UIKit/JSBUIWindow.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | #import 4 | @import JavaScriptCore; 5 | 6 | @protocol JSBUIView; 7 | 8 | @protocol JSBUIWindow 9 | 10 | #pragma clang diagnostic push 11 | #pragma clang diagnostic ignored "-Wdeprecated-declarations" 12 | 13 | @property (nonatomic, retain) UIScreen *screen; 14 | @property (nonatomic, readonly, getter = isKeyWindow) BOOL keyWindow; 15 | @property (nonatomic, retain) UIViewController *rootViewController; 16 | @property (nonatomic) UIWindowLevel windowLevel; 17 | 18 | - (void)becomeKeyWindow; 19 | - (void)resignKeyWindow; 20 | - (void)makeKeyWindow; 21 | - (void)makeKeyAndVisible; 22 | - (void)sendEvent:(UIEvent *)event; 23 | - (CGPoint)convertPoint:(CGPoint)point toWindow:(UIWindow *)window; 24 | - (CGPoint)convertPoint:(CGPoint)point fromWindow:(UIWindow *)window; 25 | - (CGRect)convertRect:(CGRect)rect toWindow:(UIWindow *)window; 26 | - (CGRect)convertRect:(CGRect)rect fromWindow:(UIWindow *)window; 27 | 28 | #pragma clang diagnostic pop 29 | 30 | @end 31 | -------------------------------------------------------------------------------- /packages/api/README.md: -------------------------------------------------------------------------------- 1 | # MarginNote API 2 | 3 |

4 | npm-version 5 | marginnote-version 6 | license 7 |

8 | 9 | > **Warning** 10 | > 11 | > The MarginNote API is still in early alpha and is subject to change at any time! 12 | 13 | Type definitions for the latest MarginNote API, and some utility functions that allow you to develop more powerful addon. 14 | 15 | ## Usage 16 | 17 | ```shell 18 | pnpm add marginnote 19 | # or 20 | npm install marginnote 21 | # or 22 | yarn add marginnote 23 | ``` 24 | 25 | then 26 | 27 | ```ts 28 | import { MN } from "marginnote" 29 | ``` 30 | 31 | ## Documentation 32 | 33 | [简体中文](https://ohmymn.marginnote.cn/api) 34 | 35 | ## License 36 | 37 | MIT -------------------------------------------------------------------------------- /packages/api/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "marginnote", 3 | "description": "Type definitions of the latest MarginNote API.", 4 | "license": "MIT", 5 | "version": "0.9.34", 6 | "author": "ourongxing", 7 | "homepage": "https://github.com/ourongxing/ohmymn/tree/main/packages/api#readme", 8 | "repository": { 9 | "type": "git", 10 | "url": "git+https://github.com/ourongxing/ohmymn.git", 11 | "directory": "packages/api" 12 | }, 13 | "main": "dist/index.js", 14 | "types": "dist/index.d.ts", 15 | "scripts": { 16 | "build": "tsup src/index.ts --format cjs --dts", 17 | "dev": "tsup src/index.ts --format cjs --dts --watch", 18 | "publish": "npm publish --access public --no-git-checks" 19 | }, 20 | "files": [ 21 | "dist/**/*.js", 22 | "dist/**/*.d.ts" 23 | ], 24 | "dependencies": { 25 | "semver": "7.3.8" 26 | }, 27 | "keywords": [ 28 | "marginote", 29 | "addon", 30 | "plugin", 31 | "typescript", 32 | "api" 33 | ] 34 | } 35 | -------------------------------------------------------------------------------- /packages/api/src/high-level/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./mn" 2 | export * from "./common" 3 | export * from "./delay" 4 | export * from "./nsvalue" 5 | export * from "./network" 6 | export * from "./popup" 7 | export * from "./note" 8 | export * from "./file" 9 | export * from "./handler" 10 | export * from "./node" 11 | export * from "./page" 12 | -------------------------------------------------------------------------------- /packages/api/src/high-level/lang.ts: -------------------------------------------------------------------------------- 1 | import { MN } from "." 2 | 3 | const zh = { 4 | copy_success: "复制成功, 快去粘贴吧!", 5 | copy_empty: "要复制的内容为空", 6 | sure: "确定", 7 | cancel: "🙅 取消", 8 | not_JSON: "返回值不是有效的 JSON 格式", 9 | not_receive: "没有收到返回值,请检查网络", 10 | make_your_choice: "做出你的选择" 11 | } 12 | 13 | const en: typeof zh = { 14 | copy_success: "Copy successfully, go ahead and paste", 15 | copy_empty: "The content to be copied is empty", 16 | sure: "Confirm", 17 | cancel: "🙅‍♀️ Cancel", 18 | not_JSON: "The returned value is not a valid JSON format", 19 | not_receive: "No return value received, please check the network", 20 | make_your_choice: "Make your choice" 21 | } 22 | 23 | export const lang = MN.isZH ? zh : en 24 | -------------------------------------------------------------------------------- /packages/api/src/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./low-level" 2 | export * from "./high-level" 3 | -------------------------------------------------------------------------------- /packages/api/src/low-level/Foundation/NSFileManages.ts: -------------------------------------------------------------------------------- 1 | import { NSDictionary } from "." 2 | 3 | declare global { 4 | const NSFileManager: { 5 | defaultManager(): NSFileManager 6 | } 7 | } 8 | 9 | export declare type NSFileManager = { 10 | contentsOfDirectoryAtPath(path: string): string[] 11 | subpathsOfDirectoryAtPath(path: string): string[] 12 | fileExistsAtPath(path: string): boolean 13 | isDirectoryAtPath(path: string): boolean 14 | moveItemAtPathToPath(path: string, toPath: string): boolean 15 | copyItemAtPathToPath(path: string, toPath: string): boolean 16 | // removeItemAtPath(path: string): boolean 17 | createDirectoryAtPathAttributes( 18 | path: string, 19 | attributes: NSDictionary 20 | ): boolean 21 | // createFileAtPathContentsAttributes( 22 | // path: string, 23 | // contents: NSData | undefined, 24 | // attributes: NSDictionary 25 | // ): boolean 26 | } 27 | -------------------------------------------------------------------------------- /packages/api/src/low-level/Foundation/NSIndexSet.ts: -------------------------------------------------------------------------------- 1 | declare global { 2 | const NSIndexSet: { 3 | indexSetWithIndex(index: number): NSIndexSet 4 | } 5 | } 6 | 7 | export declare type NSIndexSet = { 8 | isEqualToIndexSet(indexSet: NSIndexSet): boolean 9 | firstIndex(): number 10 | lastIndex(): number 11 | } 12 | -------------------------------------------------------------------------------- /packages/api/src/low-level/Foundation/NSJSONSerialization.ts: -------------------------------------------------------------------------------- 1 | import type { NSData } from "./NSData" 2 | 3 | export const enum NSJSONWritingOptions { 4 | PrettyPrinted = 0, 5 | SortedKeys, 6 | FragmentsAllowed, 7 | WithoutEscapingSlashes 8 | } 9 | 10 | export const enum NSJSONReadingOptions { 11 | MutableContainers = 1 << 0, 12 | MutableLeaves = 1 << 1, 13 | FragmentsAllowed = 1 << 2, 14 | JSON5Allowed = 1 << 3, 15 | TopLevelDictionaryAssumed = 1 << 4 16 | } 17 | 18 | declare global { 19 | const NSJSONSerialization: { 20 | isValidJSONObject(obj: any): boolean 21 | JSONObjectWithDataOptions(data: NSData, options: NSJSONReadingOptions): any 22 | dataWithJSONObjectOptions(obj: any, options: NSJSONWritingOptions): NSData 23 | } 24 | } 25 | 26 | export declare type NSJSONSerialization = {} 27 | -------------------------------------------------------------------------------- /packages/api/src/low-level/Foundation/NSOperationQueue.ts: -------------------------------------------------------------------------------- 1 | declare global { 2 | const NSOperationQueue: { 3 | mainQueue(): NSOperationQueue 4 | } 5 | } 6 | export declare type NSOperationQueue = {} 7 | -------------------------------------------------------------------------------- /packages/api/src/low-level/Foundation/NSTimer.ts: -------------------------------------------------------------------------------- 1 | declare global { 2 | const NSTimer: { 3 | /** 4 | * @returns NSTimer* 5 | * @param f JSValue* 6 | */ 7 | scheduledTimerWithTimeInterval( 8 | ti: NSTimeInterval, 9 | yesOrNo: boolean, 10 | f: (timer: NSTimer) => void 11 | ): NSTimer 12 | } 13 | } 14 | 15 | export declare type NSTimeInterval = number 16 | export declare type NSTimer = { 17 | fire(): void 18 | /** 19 | * @returns NSDate* 20 | */ 21 | fireDate(): Date 22 | /** 23 | * @param date NSDate* 24 | */ 25 | setFireDate(date: Date): void 26 | timeInterval(): NSTimeInterval 27 | tolerance(): NSTimeInterval 28 | setTolerance(tolerance: NSTimeInterval): void 29 | invalidate(): void 30 | isValid(): boolean 31 | userInfo(): any 32 | } 33 | -------------------------------------------------------------------------------- /packages/api/src/low-level/Foundation/NSURLConnection.ts: -------------------------------------------------------------------------------- 1 | import type { JSValue, NSURLRequest, NSOperationQueue } from "." 2 | 3 | declare global { 4 | const NSURLConnection: { 5 | sendAsynchronousRequestQueueCompletionHandler( 6 | request: NSURLRequest, 7 | queue: NSOperationQueue, 8 | completionHandler: JSValue 9 | ): NSURLRequest 10 | connectionWithRequest(request: NSURLRequest, delegate: any): NSURLConnection 11 | } 12 | } 13 | 14 | export declare type NSURLConnection = {} 15 | -------------------------------------------------------------------------------- /packages/api/src/low-level/Foundation/NSValue.ts: -------------------------------------------------------------------------------- 1 | import { CGPoint, CGSize, CGRect } from "../UIKit" 2 | import { NSValue2String } from "src/high-level" 3 | 4 | /** 5 | * Can't read directly, use {@link NSValue2String} to convert to string 6 | */ 7 | export declare type NSValue = { 8 | CGPointValue(): CGPoint 9 | CGSizeValue(): CGSize 10 | CGRectValue(): CGRect 11 | } 12 | -------------------------------------------------------------------------------- /packages/api/src/low-level/MarginNote/SQLite.ts: -------------------------------------------------------------------------------- 1 | import { DictObj } from ".." 2 | 3 | declare global { 4 | const SQLiteDatabase: { 5 | databaseWithPath(path: string): SQLiteDatabase 6 | } 7 | } 8 | 9 | export declare type SQLiteDatabase = { 10 | open(): boolean 11 | close(): boolean 12 | executeQueryWithArgumentsInArray(sql: string, args: any[]): SQLiteResultSet 13 | } 14 | 15 | export declare class SQLiteResultSet { 16 | stringForColumn(columnName: string): string 17 | next(): boolean 18 | close(): void 19 | resultDictionary(): DictObj 20 | } 21 | -------------------------------------------------------------------------------- /packages/api/src/low-level/MarginNote/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./Application" 2 | export * from "./NoteDatabase" 3 | export * from "./Utility" 4 | export * from "./MbBookNote" 5 | export * from "./SQLite" 6 | export * from "./JSExtension" 7 | export * from "./NoteComment" 8 | -------------------------------------------------------------------------------- /packages/api/src/low-level/UIKit/UIApplication.ts: -------------------------------------------------------------------------------- 1 | import type { JSValue, NSDictionary, NSURL } from "../Foundation" 2 | 3 | declare global { 4 | const UIApplication: { 5 | sharedApplication(): UIApplication 6 | } 7 | } 8 | 9 | export declare type UIApplication = { 10 | networkActivityIndicatorVisible: boolean 11 | idleTimerDisabled: boolean 12 | openURL(url: NSURL): boolean 13 | canOpenURL(url: NSURL): boolean 14 | openURLOptionsCompletionHandler( 15 | url: NSURL, 16 | options: NSDictionary, 17 | completionHandler: JSValue 18 | ): void 19 | } 20 | -------------------------------------------------------------------------------- /packages/api/src/low-level/UIKit/UIButton.ts: -------------------------------------------------------------------------------- 1 | import { UIControl, UIColor, UIImage } from "." 2 | 3 | export const enum UIButtonType { 4 | system = 0 5 | } 6 | export const enum NSLineBreakMode {} 7 | export type UIEdgeInsets = { 8 | top: number 9 | left: number 10 | bottom: number 11 | right: number 12 | } 13 | export const enum UIControlState {} 14 | declare global { 15 | class UIButton extends UIControl { 16 | static buttonWithType(buttonType: UIButtonType): UIButton 17 | buttonType: UIButtonType 18 | titleEdgeInsets: UIEdgeInsets 19 | lineBreakMode: NSLineBreakMode 20 | adjustsImageWhenHighlighted: boolean 21 | setTitleForState(title: string, state: UIControlState): void 22 | setImageForState(image: UIImage, state: UIControlState): void 23 | setTitleColorForState(color: UIColor, state: UIControlState): void 24 | titleLabel: UILabel 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /packages/api/src/low-level/UIKit/UIColor.ts: -------------------------------------------------------------------------------- 1 | import { CGFloat } from "." 2 | 3 | declare global { 4 | const UIColor: { 5 | colorWithHexString(rgbHex: string): UIColor 6 | blackColor(): UIColor 7 | darkGrayColor(): UIColor 8 | lightGrayColor(): UIColor 9 | whiteColor(): UIColor 10 | grayColor(): UIColor 11 | redColor(): UIColor 12 | greenColor(): UIColor 13 | blueColor(): UIColor 14 | cyanColor(): UIColor 15 | yellowColor(): UIColor 16 | magentaColor(): UIColor 17 | orangeColor(): UIColor 18 | purpleColor(): UIColor 19 | brownColor(): UIColor 20 | clearColor(): UIColor 21 | } 22 | } 23 | 24 | export declare type UIColor = { 25 | hexStringValue: string 26 | colorWithAlphaComponent(alpha: CGFloat): UIColor 27 | } 28 | -------------------------------------------------------------------------------- /packages/api/src/low-level/UIKit/UIControl.ts: -------------------------------------------------------------------------------- 1 | export declare class UIControl extends UIView { 2 | enabled: boolean 3 | highlighted: boolean 4 | selected: boolean 5 | addTargetActionForControlEvents( 6 | target: any, 7 | action: string, 8 | controlEvent: UIControlEvents 9 | ): void 10 | removeTargetActionForControlEvents( 11 | target: any, 12 | action: string, 13 | controlEvent: UIControlEvents 14 | ): void 15 | } 16 | 17 | export const enum UIControlEvents {} 18 | -------------------------------------------------------------------------------- /packages/api/src/low-level/UIKit/UIEvent.ts: -------------------------------------------------------------------------------- 1 | export declare class UIEvent {} 2 | -------------------------------------------------------------------------------- /packages/api/src/low-level/UIKit/UIFont.ts: -------------------------------------------------------------------------------- 1 | declare global { 2 | const UIFont: { 3 | /** 4 | * 默认 17 5 | */ 6 | systemFontOfSize(fontSize: number): UIFont 7 | boldSystemFontOfSize(fontSize: number): UIFont 8 | italicSystemFontOfSize(fontSize: number): UIFont 9 | } 10 | } 11 | 12 | export declare type UIFont = {} 13 | -------------------------------------------------------------------------------- /packages/api/src/low-level/UIKit/UILabel.ts: -------------------------------------------------------------------------------- 1 | import type { UIFont } from "./UIFont" 2 | import type { UIColor } from "./UIColor" 3 | import { NSTextAlignment } from "./UITextField" 4 | 5 | declare global { 6 | class UILabel extends UIView { 7 | constructor() 8 | text: string 9 | font: UIFont 10 | textColor: UIColor 11 | textAlignment: NSTextAlignment 12 | numberOfLines: number 13 | lineBreakMode: number 14 | opaque: boolean 15 | adjustsFontSizeToFitWidth: boolean 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /packages/api/src/low-level/UIKit/UIPopoverController.ts: -------------------------------------------------------------------------------- 1 | import { CGRect, UIControl, UIViewController } from "." 2 | 3 | declare global { 4 | class UIPopoverController extends UIControl { 5 | delegate: any 6 | constructor(viewController: UIViewController) 7 | presentPopoverFromRect( 8 | rect: CGRect, 9 | view: UIView, 10 | arrowDirections: number, 11 | animated: boolean 12 | ): void 13 | dismissPopoverAnimated(animated: boolean): void 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /packages/api/src/low-level/UIKit/UIResponder.ts: -------------------------------------------------------------------------------- 1 | export declare class UIResponder { 2 | nextResponder: UIResponder 3 | canBecomeFirstResponder(): boolean 4 | becomeFirstResponder(): boolean 5 | canResignFirstResponder(): boolean 6 | resignFirstResponder(): boolean 7 | isFirstResponder(): boolean 8 | } 9 | -------------------------------------------------------------------------------- /packages/api/src/low-level/UIKit/UISwitch.ts: -------------------------------------------------------------------------------- 1 | import { UIControl, UIColor } from "." 2 | 3 | declare global { 4 | class UISwitch extends UIControl { 5 | onTintColor: UIColor 6 | on: boolean 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /packages/api/src/low-level/UIKit/UITableViewCell.ts: -------------------------------------------------------------------------------- 1 | import { UIImageView } from "." 2 | import { NSIndexSet } from "../Foundation" 3 | 4 | export const enum UITableViewCellSelectionStyle {} 5 | export const enum UITableViewCellAccessoryTypeStyle {} 6 | export const enum UITableViewCellStyle { 7 | Default = 0, 8 | Value1 = 1, 9 | Value2 = 2, 10 | Subtitle = 3 11 | } 12 | 13 | declare global { 14 | const UITableViewCell: { 15 | makeWithStyleReuseIdentifier( 16 | style: UITableViewCellStyle, 17 | reuseIdentifier: string 18 | ): UITableViewCell 19 | } 20 | } 21 | 22 | export declare type UITableViewCell = { 23 | readonly contentView: UIView 24 | readonly textLabel: UILabel 25 | readonly detailTextLabel: UILabel 26 | readonly imageView: UIImageView 27 | hidden: boolean 28 | indexPath: NSIndexSet 29 | backgroundView: UIView 30 | selectedBackgroundView: UIView 31 | selectionStyle: UITableViewCellAccessoryTypeStyle 32 | accessoryType: UITableViewCellSelectionStyle 33 | selected: boolean 34 | 35 | /** not available */ 36 | setSelected(selected: boolean, animated: boolean): void 37 | } 38 | -------------------------------------------------------------------------------- /packages/api/src/low-level/UIKit/UITableViewController.ts: -------------------------------------------------------------------------------- 1 | import { UITableView, UIViewController } from "." 2 | 3 | export declare class UITableViewController extends UIViewController { 4 | [k: string]: any 5 | view: UIView 6 | tableView?: UITableView 7 | clearsSelectionOnViewWillAppear: boolean 8 | } 9 | 10 | // tableviewcontrol 里面全是执行 tableview 的 datasoure 协议和 delegate 协议 11 | // 自己没什么东西,这两个协议由于要加前缀,不知道在 TS 里怎么处理 12 | -------------------------------------------------------------------------------- /packages/api/src/low-level/UIKit/UITextField.ts: -------------------------------------------------------------------------------- 1 | import { CGRect, UIControl } from "." 2 | import type { UIImage, UIColor } from "." 3 | 4 | export const enum NSTextAlignment { 5 | Left, //左对齐 6 | Center, //居中 7 | Right, //右对齐 8 | Justified, //最后一行自然对齐 9 | Natural //默认对齐脚本 10 | } 11 | export enum UITextBorderStyle {} 12 | declare global { 13 | class UITextField extends UIControl { 14 | [x: string]: any 15 | constructor(frame?: CGRect) 16 | delegate: any 17 | textColor: UIColor 18 | background: UIImage 19 | placeholder: string 20 | textAlignment: NSTextAlignment 21 | leftView: UIView 22 | font: any 23 | text: string 24 | rightView: UIView 25 | editing: boolean 26 | borderStyle: UITextBorderStyle 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /packages/api/src/low-level/UIKit/UIVIewController.ts: -------------------------------------------------------------------------------- 1 | export declare class UIViewController { 2 | loadView(): void 3 | viewWillUnload(): void 4 | viewDidUnload(): void 5 | viewDidLoad(): void 6 | isViewLoaded(): void 7 | viewWillAppear(animated: boolean): void 8 | viewDidAppear(animated: boolean): void 9 | viewWillDisappear(animate: boolean): void 10 | viewDidDisappear(animate: boolean): void 11 | viewWillLayoutSubviews(): void 12 | viewDidLayoutSubviews(): void 13 | didReceiveMemoryWarning(): void 14 | isBeingPresented(): boolean 15 | isBeingDismissed(): boolean 16 | isMovingToParentViewController(): boolean 17 | isMovingFromParentViewController(): boolean 18 | } 19 | -------------------------------------------------------------------------------- /packages/api/src/low-level/UIKit/UIWebView.ts: -------------------------------------------------------------------------------- 1 | import { CGRect } from "." 2 | import type { NSURL } from "../Foundation" 3 | 4 | declare global { 5 | class UIWebView extends UIView { 6 | constructor(frame: CGRect) 7 | [k: string]: any 8 | scalesPageToFit: boolean 9 | autoresizingMask: number 10 | delegate: any 11 | scrollView: any 12 | loadFileURLAllowingReadAccessToURL(URL: NSURL, readAccessURL: NSURL): void 13 | evaluateJavaScript(script: string, res: (res: string) => void): void 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /packages/api/src/low-level/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./Foundation" 2 | export * from "./MarginNote" 3 | export * from "./UIKit" 4 | 5 | declare global { 6 | const JSB: { 7 | defineClass( 8 | declaration: string, 9 | instanceMethods?: object, 10 | classMethods?: object 11 | ): any 12 | require(name: string): any 13 | log(format: string, arguments: string[] | string): void 14 | dump(object: any): void 15 | newAddon(mainPath: string): any 16 | } 17 | } 18 | 19 | export declare type DictObj = { 20 | [k: string]: any 21 | } 22 | -------------------------------------------------------------------------------- /packages/api/src/self.d.ts: -------------------------------------------------------------------------------- 1 | export {} 2 | declare global { 3 | const self: { 4 | [k: string]: any 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /packages/api/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "noEmit": true, 4 | "module": "ESNext", 5 | "target": "ES2020", 6 | "allowJs": true, 7 | "sourceMap": false, 8 | "noImplicitAny": true, 9 | "downlevelIteration": true, 10 | "moduleResolution": "node", 11 | "allowSyntheticDefaultImports": true, 12 | "resolveJsonModule": true, 13 | "importHelpers": true, 14 | "strict": true, 15 | "baseUrl": ".", 16 | "lib": ["ES2020"] 17 | }, 18 | "include": ["src/**/*.ts"] 19 | } 20 | -------------------------------------------------------------------------------- /packages/create-ohmymn/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "create-ohmymn", 3 | "description": "", 4 | "license": "MIT", 5 | "version": "0.0.3", 6 | "author": "ourongxing", 7 | "homepage": "https://github.com/ourongxing/ohmymn/tree/main/packages/create-ohmymn#readme", 8 | "scripts": { 9 | "build": "tsup src/index.ts --format cjs --clean", 10 | "dev": "pnpm build --watch" 11 | }, 12 | "repository": { 13 | "type": "git", 14 | "url": "git+https://github.com/ourongxing/ohmymn.git", 15 | "directory": "packages/create-ohmymn" 16 | }, 17 | "files": [ 18 | "dist", 19 | "templates" 20 | ], 21 | "bin": "dist/index.js", 22 | "main": "dist/index.js", 23 | "devDependencies": { 24 | "@types/minimist": "^1.2.2", 25 | "@types/prompts": "^2.4.2", 26 | "tsup": "^6.2.3" 27 | }, 28 | "dependencies": { 29 | "chokidar": "^3.5.3", 30 | "kolorist": "^1.8.0", 31 | "minimist": "^1.2.8", 32 | "prompts": "^2.4.2" 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /packages/create-ohmymn/templates/base/assets/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ourongxing/ohmymn/b0bb5f16e20c9cb5e8d8d5c6d411eb39b8b10aac/packages/create-ohmymn/templates/base/assets/logo.png -------------------------------------------------------------------------------- /packages/create-ohmymn/templates/base/manifest.ts: -------------------------------------------------------------------------------- 1 | import { author, version } from "package.json" 2 | import { defineManifest } from "scripts/utils" 3 | 4 | export default defineManifest({ 5 | author, 6 | version, 7 | key: "template-base", 8 | title: "Template Base", 9 | minMarginNoteVersion: "3.7.21", 10 | files: ["assets/logo.png"] 11 | }) 12 | -------------------------------------------------------------------------------- /packages/create-ohmymn/templates/base/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "template-base", 3 | "author": "ourongxing", 4 | "homepage": "https://github.com/ourongxing/ohmymn", 5 | "version": "0.0.0", 6 | "license": "MIT", 7 | "description": "MarginNote Adddon Development Framework", 8 | "scripts": { 9 | "dev": "tsx ./build.ts", 10 | "build": "NODE_ENV=production pnpm dev", 11 | "build:iPad": "pnpm build && airdrop ./dist/*.mnaddon" 12 | }, 13 | "keywords": [ 14 | "marginote", 15 | "addon", 16 | "typescript" 17 | ], 18 | "devDependencies": { 19 | "@kossnocorp/estrella": "^1.4.1", 20 | "@types/querystringify": "^2.0.0", 21 | "esbuild": "^0.15.7", 22 | "esbuild-plugin-mxn-copy": "^1.0.1", 23 | "unplugin-auto-import": "^0.11.2", 24 | "tsx": "^3.9.0", 25 | "typescript": "4.7.4", 26 | "fs-extra": "^11.1.0", 27 | "@types/semver": "7.3.12", 28 | "@types/fs-extra": "^9.0.13", 29 | "@types/node": "^18.7.16" 30 | }, 31 | "dependencies": { 32 | "semver": "7.3.8", 33 | "marginnote": "^0.9.30", 34 | "querystringify": "^2.2.0" 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /packages/create-ohmymn/templates/base/scripts/utils.ts: -------------------------------------------------------------------------------- 1 | export function defineManifest(manifest: Manifest) { 2 | return manifest 3 | } 4 | 5 | interface Manifest { 6 | key: string 7 | author: string 8 | title: string 9 | version: string 10 | github?: string 11 | minMarginNoteVersion: string 12 | profileKey?: { 13 | global: string 14 | doc: string 15 | notebook: string 16 | } 17 | certKey?: string 18 | /** 19 | * Panel color 20 | */ 21 | color?: { 22 | border: string 23 | button: string 24 | } 25 | /** Chinese forum url */ 26 | forumZH?: string 27 | forum?: string 28 | docZH?: string 29 | doc?: string 30 | /** Files to be copied to the addon folder */ 31 | files?: string[] 32 | } 33 | -------------------------------------------------------------------------------- /packages/create-ohmymn/templates/base/src/addon.ts: -------------------------------------------------------------------------------- 1 | import manifest from "../manifest" 2 | 3 | class MNADDON { 4 | path!: string 5 | readonly key = manifest.key 6 | readonly title = manifest.title 7 | readonly author = manifest.author 8 | readonly version = manifest.version 9 | readonly github = manifest.github 10 | readonly forum = MN.isZH ? manifest.forumZH : manifest.forum 11 | readonly doc = MN.isZH ? manifest.docZH : manifest.doc 12 | } 13 | 14 | export const Addon = new MNADDON() 15 | -------------------------------------------------------------------------------- /packages/create-ohmymn/templates/base/src/jsExtension/handleReceivedEvent.ts: -------------------------------------------------------------------------------- 1 | import { defineEventHandlers, eventObserverController } from "marginnote" 2 | 3 | const events = ["AddonBroadcast"] as const 4 | 5 | export const eventObservers = eventObserverController([...events]) 6 | 7 | export default defineEventHandlers<(typeof events)[number]>({ 8 | async onAddonBroadcast(sender) { 9 | if (self.window !== MN.currentWindow) return 10 | MN.log("Addon broadcast", "event") 11 | } 12 | }) 13 | -------------------------------------------------------------------------------- /packages/create-ohmymn/templates/base/src/jsExtension/index.ts: -------------------------------------------------------------------------------- 1 | import { getObjCClassDeclar } from "marginnote" 2 | import { Addon } from "~/addon" 3 | import handleReceivedEvent from "./handleReceivedEvent" 4 | import lifecycle from "./lifecycle" 5 | import switchPanel from "./switchPanel" 6 | 7 | export default JSB.defineClass( 8 | getObjCClassDeclar(Addon.title, "JSExtension"), 9 | { 10 | ...lifecycle.instanceMethods, 11 | ...switchPanel, 12 | ...handleReceivedEvent 13 | }, 14 | lifecycle.classMethods 15 | ) 16 | -------------------------------------------------------------------------------- /packages/create-ohmymn/templates/base/src/jsExtension/lang.ts: -------------------------------------------------------------------------------- 1 | import { i18n } from "marginnote" 2 | 3 | export default i18n({ 4 | zh: { 5 | none: "无", 6 | sure: "确定" 7 | }, 8 | en: { 9 | none: "None", 10 | sure: "Confirm" 11 | } 12 | }) 13 | -------------------------------------------------------------------------------- /packages/create-ohmymn/templates/base/src/jsExtension/switchPanel.ts: -------------------------------------------------------------------------------- 1 | import { setLocalDataByKey } from "marginnote" 2 | import { Addon } from "~/addon" 3 | 4 | export function closePanel() { 5 | if (!self.panel.status) return 6 | self.panel.status = false 7 | MN.studyController.refreshAddonCommands() 8 | setLocalDataByKey(false, Addon.key) 9 | } 10 | 11 | export function openPanel() { 12 | if (self.panel.status) return 13 | self.panel.status = true 14 | MN.studyController.refreshAddonCommands() 15 | setLocalDataByKey(true, Addon.key) 16 | } 17 | 18 | /** 19 | * 点击插件按钮时触发 20 | */ 21 | export function switchPanel() { 22 | if (self.panel.status) closePanel() 23 | else openPanel() 24 | } 25 | 26 | function queryAddonCommandStatus() { 27 | return MN.currnetNotebookId && 28 | MN.currentDocmd5 && 29 | MN.currentDocmd5 !== "00000000" 30 | ? { 31 | image: "logo.png", 32 | object: self, 33 | selector: "switchPanel:", 34 | checked: self.panel.status 35 | } 36 | : null 37 | } 38 | 39 | export default { 40 | queryAddonCommandStatus, 41 | switchPanel 42 | } 43 | -------------------------------------------------------------------------------- /packages/create-ohmymn/templates/base/src/main.ts: -------------------------------------------------------------------------------- 1 | import { Addon } from "~/addon" 2 | import JSExtension from "./JSExtension" 3 | 4 | JSB.newAddon = path => { 5 | Addon.path = path 6 | return JSExtension 7 | } 8 | -------------------------------------------------------------------------------- /packages/create-ohmymn/templates/base/src/self.d.ts: -------------------------------------------------------------------------------- 1 | import type { UIWindow, UITableView } from "marginnote" 2 | 3 | declare global { 4 | const MN: typeof import("marginnote")["MN"] 5 | const self: { 6 | useConsole?: boolean 7 | addon?: { 8 | key: string 9 | title: string 10 | } 11 | panel: { 12 | status: boolean 13 | } 14 | window: UIWindow 15 | view: UIView 16 | noteid: string 17 | tableView: UITableView 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /packages/create-ohmymn/templates/base/src/typings/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./Module" 2 | export * from "./DataSource" 3 | export * from "./AutoUtils" 4 | 5 | export const enum CellViewType { 6 | PlainText = 0, 7 | Switch = 1, 8 | Button = 2, 9 | ButtonWithInput = 3, 10 | Input = 4, 11 | InlineInput = 5, 12 | Select = 6, 13 | MuiltSelect = 7, 14 | Expland = 8 15 | } 16 | -------------------------------------------------------------------------------- /packages/create-ohmymn/templates/base/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "noEmit": true, 4 | "module": "ESNext", 5 | "target": "ES2020", 6 | "allowJs": true, 7 | "sourceMap": false, 8 | "noImplicitAny": true, 9 | "downlevelIteration": true, 10 | "moduleResolution": "node", 11 | "allowSyntheticDefaultImports": true, 12 | "suppressImplicitAnyIndexErrors": true, 13 | "resolveJsonModule": true, 14 | "importHelpers": true, 15 | "strict": true, 16 | "baseUrl": ".", 17 | "paths": { 18 | "~/*": ["./src/*"] 19 | }, 20 | "lib": ["ES2020"] 21 | }, 22 | "include": ["src/**/*.ts", "src/utils/third party/*.js"] 23 | } 24 | -------------------------------------------------------------------------------- /packages/create-ohmymn/templates/panel/assets/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ourongxing/ohmymn/b0bb5f16e20c9cb5e8d8d5c6d411eb39b8b10aac/packages/create-ohmymn/templates/panel/assets/logo.png -------------------------------------------------------------------------------- /packages/create-ohmymn/templates/panel/manifest.ts: -------------------------------------------------------------------------------- 1 | import { author, version } from "package.json" 2 | import { defineManifest } from "scripts/utils" 3 | 4 | export default defineManifest({ 5 | author, 6 | version, 7 | key: "template-panel", 8 | title: "Template Panel", 9 | minMarginNoteVersion: "3.7.21", 10 | profileKey: { 11 | global: "template_panel_profile_global", 12 | doc: "template_panel_profile_doc", 13 | notebook: "template_panel_profile_notebook" 14 | }, 15 | color: { 16 | border: "#8A95A2", 17 | button: "#8A95A2" 18 | }, 19 | files: ["assets/logo.png"] 20 | }) 21 | -------------------------------------------------------------------------------- /packages/create-ohmymn/templates/panel/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "template-panel", 3 | "author": "ourongxing", 4 | "homepage": "https://github.com/ourongxing/ohmymn", 5 | "version": "0.0.0", 6 | "license": "MIT", 7 | "description": "MarginNote Adddon Development Framework", 8 | "scripts": { 9 | "dev": "tsx ./build.ts", 10 | "build": "NODE_ENV=production pnpm dev", 11 | "build:iPad": "pnpm build && airdrop ./dist/*.mnaddon" 12 | }, 13 | "keywords": [ 14 | "marginote", 15 | "addon", 16 | "typescript" 17 | ], 18 | "devDependencies": { 19 | "@kossnocorp/estrella": "^1.4.1", 20 | "@types/querystringify": "^2.0.0", 21 | "esbuild": "^0.15.7", 22 | "esbuild-plugin-mxn-copy": "^1.0.1", 23 | "unplugin-auto-import": "^0.11.2", 24 | "tsx": "^3.9.0", 25 | "typescript": "4.7.4", 26 | "fs-extra": "^11.1.0", 27 | "@types/semver": "7.3.12", 28 | "@types/fs-extra": "^9.0.13", 29 | "@types/node": "^18.7.16" 30 | }, 31 | "dependencies": { 32 | "semver": "7.3.8", 33 | "marginnote": "^0.9.30", 34 | "querystringify": "^2.2.0" 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /packages/create-ohmymn/templates/panel/scripts/utils.ts: -------------------------------------------------------------------------------- 1 | export function defineManifest(manifest: Manifest) { 2 | return manifest 3 | } 4 | 5 | interface Manifest { 6 | key: string 7 | author: string 8 | title: string 9 | version: string 10 | github?: string 11 | minMarginNoteVersion: string 12 | profileKey?: { 13 | global: string 14 | doc: string 15 | notebook: string 16 | } 17 | certKey?: string 18 | /** 19 | * Panel color 20 | */ 21 | color?: { 22 | border: string 23 | button: string 24 | } 25 | /** Chinese forum url */ 26 | forumZH?: string 27 | forum?: string 28 | docZH?: string 29 | doc?: string 30 | /** Files to be copied to the addon folder */ 31 | files?: string[] 32 | } 33 | -------------------------------------------------------------------------------- /packages/create-ohmymn/templates/panel/src/addon.ts: -------------------------------------------------------------------------------- 1 | import manifest from "../manifest" 2 | 3 | class MNADDON { 4 | path!: string 5 | lastVersion!: string 6 | textColor = UIColor.blackColor() 7 | readonly key = manifest.key 8 | readonly title = manifest.title 9 | readonly author = manifest.author 10 | readonly version = manifest.version 11 | readonly globalProfileKey = manifest.profileKey!.global 12 | readonly docProfileKey = manifest.profileKey!.doc 13 | readonly notebookProfileKey = manifest.profileKey!.notebook 14 | readonly borderColor = UIColor.colorWithHexString(manifest.color!.border) 15 | readonly buttonColor = UIColor.colorWithHexString(manifest.color!.button) 16 | readonly github = manifest.github 17 | readonly forum = MN.isZH ? manifest.forumZH : manifest.forum 18 | readonly doc = MN.isZH ? manifest.docZH : manifest.doc 19 | } 20 | 21 | export const Addon = new MNADDON() 22 | -------------------------------------------------------------------------------- /packages/create-ohmymn/templates/panel/src/dataSource/lang.ts: -------------------------------------------------------------------------------- 1 | import { i18n } from "marginnote" 2 | 3 | export default i18n({ 4 | zh: { 5 | magicaction_from_which_module: (module: string) => 6 | `该动作来自于 ${module},与其使用相同的设置。`, 7 | open_panel: "切换控制面板", 8 | none: "无" 9 | }, 10 | en: { 11 | magicaction_from_which_module: (module: string) => 12 | `This action comes from ${module} and uses the same settings. `, 13 | open_panel: "Switch Control Panel", 14 | none: "None" 15 | } 16 | }) 17 | -------------------------------------------------------------------------------- /packages/create-ohmymn/templates/panel/src/dataSource/more.ts: -------------------------------------------------------------------------------- 1 | import { CellViewType, type ISection } from "~/typings" 2 | 3 | export const more: ISection = { 4 | header: "More", 5 | key: "more", 6 | rows: [ 7 | { 8 | type: CellViewType.PlainText, 9 | label: "\n\n\n\n\n\n\n\n\n\n", 10 | link: "" 11 | } 12 | ] 13 | } 14 | -------------------------------------------------------------------------------- /packages/create-ohmymn/templates/panel/src/jsExtension/handleMagicAction/handleCardAction.ts: -------------------------------------------------------------------------------- 1 | import { NodeNote } from "marginnote" 2 | import { actions as actions } from "~/coreModule" 3 | import { closePanel } from "../switchPanel" 4 | 5 | export default async function (key: string, option: number, content: string) { 6 | const nodes = NodeNote.getSelectedNodes() 7 | switch (key) { 8 | default: 9 | await actions[key]({ 10 | content, 11 | nodes, 12 | option 13 | }) 14 | } 15 | closePanel() 16 | } 17 | -------------------------------------------------------------------------------- /packages/create-ohmymn/templates/panel/src/jsExtension/index.ts: -------------------------------------------------------------------------------- 1 | import { getObjCClassDeclar } from "marginnote" 2 | import { Addon } from "~/addon" 3 | import handleReceivedEvent from "./handleReceivedEvent" 4 | import lifecycle from "./lifecycle" 5 | import switchPanel from "./switchPanel" 6 | 7 | export default JSB.defineClass( 8 | getObjCClassDeclar(Addon.title, "JSExtension"), 9 | { 10 | ...lifecycle.instanceMethods, 11 | ...switchPanel, 12 | ...handleReceivedEvent 13 | }, 14 | lifecycle.classMethods 15 | ) 16 | -------------------------------------------------------------------------------- /packages/create-ohmymn/templates/panel/src/main.ts: -------------------------------------------------------------------------------- 1 | import { Addon } from "~/addon" 2 | import JSExtension from "./JSExtension" 3 | 4 | JSB.newAddon = path => { 5 | Addon.path = path 6 | return JSExtension 7 | } 8 | -------------------------------------------------------------------------------- /packages/create-ohmymn/templates/panel/src/modules/addon/typings.ts: -------------------------------------------------------------------------------- 1 | export const enum PanelPosition { 2 | Auto, 3 | Left, 4 | Center, 5 | Right 6 | } 7 | 8 | export const enum PanelHeight { 9 | Higher, 10 | Standard, 11 | Lower 12 | } 13 | 14 | export const enum PanelControl { 15 | DoubleClickOpen, 16 | DoubleClickClose, 17 | CompleteClose 18 | } 19 | 20 | export const enum DragMerge { 21 | NotGenTitle, 22 | Conditions, 23 | AlwaysTurnTitle 24 | } 25 | 26 | export const enum HasTitleThen { 27 | NotTurnTitle, 28 | MergeTitle, 29 | OverrideTitle 30 | } 31 | 32 | export const enum RemoveExcerpt { 33 | Now, 34 | Later 35 | } 36 | -------------------------------------------------------------------------------- /packages/create-ohmymn/templates/panel/src/modules/index.ts: -------------------------------------------------------------------------------- 1 | import addon from "./addon" 2 | import magicaction from "./magicaction" 3 | 4 | export const requiredModules = { addon, magicaction } 5 | -------------------------------------------------------------------------------- /packages/create-ohmymn/templates/panel/src/modules/magicaction/index.ts: -------------------------------------------------------------------------------- 1 | import { openURL } from "marginnote" 2 | import { defineConfig } from "~/profile" 3 | import { CellViewType } from "~/typings" 4 | import lang from "./lang" 5 | 6 | export default defineConfig({ 7 | intro: lang.intro, 8 | name: "MagicAction", 9 | key: "magicaction", 10 | link: "https://ohmymn.marginnote.cn/dev/", 11 | settings: [], 12 | actions: [ 13 | { 14 | key: "openDoc", 15 | type: CellViewType.Button, 16 | label: "打开开发文档", 17 | method() { 18 | openURL("https://ohmymn.marginnote.cn/dev/") 19 | } 20 | } 21 | ] 22 | }) 23 | -------------------------------------------------------------------------------- /packages/create-ohmymn/templates/panel/src/modules/magicaction/lang.ts: -------------------------------------------------------------------------------- 1 | import { i18n } from "marginnote" 2 | 3 | export default i18n({ 4 | zh: { 5 | intro: "点击查看具体的使用方法和注意事项。" 6 | }, 7 | en: { 8 | intro: "Click to view the specific usage method and precautions." 9 | } 10 | }) 11 | -------------------------------------------------------------------------------- /packages/create-ohmymn/templates/panel/src/profile/default.ts: -------------------------------------------------------------------------------- 1 | import { Addon } from "~/addon" 2 | 3 | export const defaultGlobalProfile = { 4 | addon: { 5 | panelControl: [], 6 | panelPosition: [0], 7 | panelHeight: [1], 8 | autoBackup: false, 9 | backupID: "", 10 | doubleLink: false 11 | }, 12 | magicaction: {}, 13 | additional: { 14 | lastVision: Addon.version 15 | } 16 | } 17 | 18 | // Each document has a independent profile 19 | export const defaultDocProfile = { 20 | additional: {} 21 | } 22 | 23 | export const defaultNotebookProfile = { 24 | additional: {} 25 | } 26 | -------------------------------------------------------------------------------- /packages/create-ohmymn/templates/panel/src/profile/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./utils" 2 | export * from "./updateDataSource" 3 | export * from "./default" 4 | export * from "./typings" 5 | export * from "./profileAction" 6 | export * from "./profileAuto" 7 | -------------------------------------------------------------------------------- /packages/create-ohmymn/templates/panel/src/settingViewController/index.ts: -------------------------------------------------------------------------------- 1 | import { getObjCClassDeclar } from "marginnote" 2 | import handleUserAction from "./handleUserAction" 3 | import lifecycle from "./lifecycle" 4 | import settingView from "./settingView" 5 | 6 | export default JSB.defineClass( 7 | getObjCClassDeclar("SettingViewController", "UITableViewController"), 8 | { 9 | ...lifecycle, 10 | ...settingView, 11 | ...handleUserAction 12 | } 13 | ) 14 | -------------------------------------------------------------------------------- /packages/create-ohmymn/templates/panel/src/settingViewController/lang.ts: -------------------------------------------------------------------------------- 1 | import { i18n } from "marginnote" 2 | 3 | export default i18n({ 4 | zh: { 5 | input_enter: "输入完按回车(Enter)保存", 6 | none: "无", 7 | expand: "▶ 点击展开所有选项", 8 | collapse: "▼ 点击收起所有选项" 9 | }, 10 | en: { 11 | input_enter: "Press Enter to save", 12 | none: "None", 13 | expand: "▶ Click to expand all options", 14 | collapse: "▼ Click to collapse all options" 15 | } 16 | }) 17 | -------------------------------------------------------------------------------- /packages/create-ohmymn/templates/panel/src/settingViewController/lifecycle.ts: -------------------------------------------------------------------------------- 1 | import { Addon } from "~/addon" 2 | export default { 3 | viewDidLoad() { 4 | self.tableView.allowsSelection = true 5 | self.view.layer.cornerRadius = 10 6 | self.view.layer.borderWidth = 2 7 | }, 8 | //Execute when each time it is opened 9 | viewWillAppear() { 10 | self.tableView.reloadData() 11 | if (MN.isMacMN3) { 12 | self.tableView.backgroundColor = MN.currentThemeColor 13 | Addon.textColor = 14 | MN.app.currentTheme == "Gray" || MN.app.currentTheme == "Dark" 15 | ? UIColor.whiteColor() 16 | : UIColor.blackColor() 17 | } 18 | self.view.layer.borderColor = Addon.buttonColor 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /packages/create-ohmymn/templates/panel/src/typings/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./Module" 2 | export * from "./DataSource" 3 | 4 | export const enum CellViewType { 5 | PlainText = 0, 6 | Switch = 1, 7 | Button = 2, 8 | ButtonWithInput = 3, 9 | Input = 4, 10 | InlineInput = 5, 11 | Select = 6, 12 | MuiltSelect = 7, 13 | Expland = 8 14 | } 15 | -------------------------------------------------------------------------------- /packages/create-ohmymn/templates/panel/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "noEmit": true, 4 | "module": "ESNext", 5 | "target": "ES2020", 6 | "allowJs": true, 7 | "sourceMap": false, 8 | "noImplicitAny": true, 9 | "downlevelIteration": true, 10 | "moduleResolution": "node", 11 | "allowSyntheticDefaultImports": true, 12 | "suppressImplicitAnyIndexErrors": true, 13 | "resolveJsonModule": true, 14 | "importHelpers": true, 15 | "strict": true, 16 | "baseUrl": ".", 17 | "paths": { 18 | "~/*": ["./src/*"] 19 | }, 20 | "lib": ["ES2020"] 21 | }, 22 | "include": ["src/**/*.ts", "src/utils/third party/*.js"] 23 | } 24 | -------------------------------------------------------------------------------- /packages/create-ohmymn/templates/profile/assets/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ourongxing/ohmymn/b0bb5f16e20c9cb5e8d8d5c6d411eb39b8b10aac/packages/create-ohmymn/templates/profile/assets/logo.png -------------------------------------------------------------------------------- /packages/create-ohmymn/templates/profile/manifest.ts: -------------------------------------------------------------------------------- 1 | import { author, version } from "package.json" 2 | import { defineManifest } from "scripts/utils" 3 | 4 | export default defineManifest({ 5 | author, 6 | version, 7 | key: "template-profile", 8 | title: "Template Profile", 9 | minMarginNoteVersion: "3.7.21", 10 | profileKey: { 11 | global: "template_profile_global", 12 | doc: "template_profile_doc", 13 | notebook: "template_profile_notebook" 14 | }, 15 | color: { 16 | border: "#8A95A2", 17 | button: "#8A95A2" 18 | }, 19 | files: ["assets/logo.png"] 20 | }) 21 | -------------------------------------------------------------------------------- /packages/create-ohmymn/templates/profile/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "template-profile", 3 | "author": "ourongxing", 4 | "homepage": "https://github.com/ourongxing/ohmymn", 5 | "version": "0.0.0", 6 | "license": "MIT", 7 | "description": "MarginNote Adddon Development Framework", 8 | "scripts": { 9 | "dev": "tsx ./build.ts", 10 | "build": "NODE_ENV=production pnpm dev", 11 | "build:iPad": "pnpm build && airdrop ./dist/*.mnaddon" 12 | }, 13 | "keywords": [ 14 | "marginote", 15 | "addon", 16 | "typescript" 17 | ], 18 | "devDependencies": { 19 | "@kossnocorp/estrella": "^1.4.1", 20 | "@types/querystringify": "^2.0.0", 21 | "esbuild": "^0.15.7", 22 | "esbuild-plugin-mxn-copy": "^1.0.1", 23 | "unplugin-auto-import": "^0.11.2", 24 | "tsx": "^3.9.0", 25 | "typescript": "4.7.4", 26 | "fs-extra": "^11.1.0", 27 | "@types/semver": "7.3.12", 28 | "@types/fs-extra": "^9.0.13", 29 | "@types/node": "^18.7.16" 30 | }, 31 | "dependencies": { 32 | "semver": "7.3.8", 33 | "marginnote": "^0.9.30", 34 | "querystringify": "^2.2.0" 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /packages/create-ohmymn/templates/profile/scripts/utils.ts: -------------------------------------------------------------------------------- 1 | export function defineManifest(manifest: Manifest) { 2 | return manifest 3 | } 4 | 5 | interface Manifest { 6 | key: string 7 | author: string 8 | title: string 9 | version: string 10 | github?: string 11 | minMarginNoteVersion: string 12 | profileKey?: { 13 | global: string 14 | doc: string 15 | notebook: string 16 | } 17 | certKey?: string 18 | /** 19 | * Panel color 20 | */ 21 | color?: { 22 | border: string 23 | button: string 24 | } 25 | /** Chinese forum url */ 26 | forumZH?: string 27 | forum?: string 28 | docZH?: string 29 | doc?: string 30 | /** Files to be copied to the addon folder */ 31 | files?: string[] 32 | } 33 | -------------------------------------------------------------------------------- /packages/create-ohmymn/templates/profile/src/addon.ts: -------------------------------------------------------------------------------- 1 | import manifest from "../manifest" 2 | 3 | class MNADDON { 4 | path!: string 5 | lastVersion!: string 6 | textColor = UIColor.blackColor() 7 | readonly key = manifest.key 8 | readonly title = manifest.title 9 | readonly author = manifest.author 10 | readonly version = manifest.version 11 | readonly globalProfileKey = manifest.profileKey!.global 12 | readonly docProfileKey = manifest.profileKey!.doc 13 | readonly notebookProfileKey = manifest.profileKey!.notebook 14 | readonly borderColor = UIColor.colorWithHexString(manifest.color!.border) 15 | readonly buttonColor = UIColor.colorWithHexString(manifest.color!.button) 16 | readonly github = manifest.github 17 | readonly forum = MN.isZH ? manifest.forumZH : manifest.forum 18 | readonly doc = MN.isZH ? manifest.docZH : manifest.doc 19 | } 20 | 21 | export const Addon = new MNADDON() 22 | -------------------------------------------------------------------------------- /packages/create-ohmymn/templates/profile/src/dataSource/lang.ts: -------------------------------------------------------------------------------- 1 | import { i18n } from "marginnote" 2 | 3 | export default i18n({ 4 | zh: { 5 | magicaction_from_which_module: (module: string) => 6 | `该动作来自于 ${module},与其使用相同的设置。`, 7 | open_panel: "切换控制面板", 8 | none: "无" 9 | }, 10 | en: { 11 | magicaction_from_which_module: (module: string) => 12 | `This action comes from ${module} and uses the same settings. `, 13 | open_panel: "Switch Control Panel", 14 | none: "None" 15 | } 16 | }) 17 | -------------------------------------------------------------------------------- /packages/create-ohmymn/templates/profile/src/dataSource/more.ts: -------------------------------------------------------------------------------- 1 | import { CellViewType, type ISection } from "~/typings" 2 | 3 | export const more: ISection = { 4 | header: "More", 5 | key: "more", 6 | rows: [ 7 | { 8 | type: CellViewType.PlainText, 9 | label: "\n\n\n\n\n\n\n\n\n\n", 10 | link: "" 11 | } 12 | ] 13 | } 14 | -------------------------------------------------------------------------------- /packages/create-ohmymn/templates/profile/src/jsExtension/handleMagicAction/handleCardAction.ts: -------------------------------------------------------------------------------- 1 | import { 2 | HUDController, 3 | NodeNote, 4 | popup, 5 | showHUD, 6 | UIAlertViewStyle, 7 | undoGroupingWithRefresh 8 | } from "marginnote" 9 | import { actions as actions } from "~/coreModule" 10 | import { PanelControl } from "~/modules/addon/typings" 11 | import { manageProfileAction } from "~/profile" 12 | import lang from "../lang" 13 | import { closePanel } from "../switchPanel" 14 | 15 | export default async function (key: string, option: number, content: string) { 16 | const nodes = NodeNote.getSelectedNodes() 17 | switch (key) { 18 | case "manageProfile": 19 | if (option > 1) await manageProfileAction(nodes[0], option) 20 | else { 21 | if (!nodes.length) { 22 | showHUD(lang.not_select_card) 23 | return 24 | } 25 | await manageProfileAction(nodes[0], option) 26 | } 27 | return 28 | default: 29 | await actions[key]({ 30 | content, 31 | nodes, 32 | option 33 | }) 34 | } 35 | closePanel() 36 | } 37 | -------------------------------------------------------------------------------- /packages/create-ohmymn/templates/profile/src/jsExtension/index.ts: -------------------------------------------------------------------------------- 1 | import { getObjCClassDeclar } from "marginnote" 2 | import { Addon } from "~/addon" 3 | import handleReceivedEvent from "./handleReceivedEvent" 4 | import lifecycle from "./lifecycle" 5 | import switchPanel from "./switchPanel" 6 | 7 | export default JSB.defineClass( 8 | getObjCClassDeclar(Addon.title, "JSExtension"), 9 | { 10 | ...lifecycle.instanceMethods, 11 | ...switchPanel, 12 | ...handleReceivedEvent 13 | }, 14 | lifecycle.classMethods 15 | ) 16 | -------------------------------------------------------------------------------- /packages/create-ohmymn/templates/profile/src/main.ts: -------------------------------------------------------------------------------- 1 | import { Addon } from "~/addon" 2 | import JSExtension from "./JSExtension" 3 | 4 | JSB.newAddon = path => { 5 | Addon.path = path 6 | return JSExtension 7 | } 8 | -------------------------------------------------------------------------------- /packages/create-ohmymn/templates/profile/src/modules/addon/typings.ts: -------------------------------------------------------------------------------- 1 | export const enum PanelPosition { 2 | Auto, 3 | Left, 4 | Center, 5 | Right 6 | } 7 | 8 | export const enum PanelHeight { 9 | Higher, 10 | Standard, 11 | Lower 12 | } 13 | 14 | export const enum PanelControl { 15 | DoubleClickOpen, 16 | DoubleClickClose, 17 | CompleteClose 18 | } 19 | 20 | export const enum DragMerge { 21 | NotGenTitle, 22 | Conditions, 23 | AlwaysTurnTitle 24 | } 25 | 26 | export const enum HasTitleThen { 27 | NotTurnTitle, 28 | MergeTitle, 29 | OverrideTitle 30 | } 31 | 32 | export const enum RemoveExcerpt { 33 | Now, 34 | Later 35 | } 36 | -------------------------------------------------------------------------------- /packages/create-ohmymn/templates/profile/src/modules/index.ts: -------------------------------------------------------------------------------- 1 | import addon from "./addon" 2 | import magicaction from "./magicaction" 3 | 4 | export const requiredModules = { addon, magicaction } 5 | -------------------------------------------------------------------------------- /packages/create-ohmymn/templates/profile/src/modules/magicaction/index.ts: -------------------------------------------------------------------------------- 1 | import { openURL } from "marginnote" 2 | import { defineConfig } from "~/profile" 3 | import { CellViewType } from "~/typings" 4 | import lang from "./lang" 5 | 6 | export default defineConfig({ 7 | intro: lang.intro, 8 | name: "MagicAction", 9 | key: "magicaction", 10 | link: "https://ohmymn.marginnote.cn/dev/", 11 | settings: [], 12 | actions: [ 13 | { 14 | key: "manageProfile", 15 | type: CellViewType.Button, 16 | label: lang.manage_profile.label, 17 | option: lang.manage_profile.$option4, 18 | help: lang.manage_profile.help, 19 | method: () => { 20 | // 21 | } 22 | }, 23 | { 24 | key: "openDoc", 25 | type: CellViewType.Button, 26 | label: "打开开发文档", 27 | method() { 28 | openURL("https://ohmymn.marginnote.cn/dev/") 29 | } 30 | } 31 | ] 32 | }) 33 | -------------------------------------------------------------------------------- /packages/create-ohmymn/templates/profile/src/modules/magicaction/lang.ts: -------------------------------------------------------------------------------- 1 | import { i18n } from "marginnote" 2 | 3 | export default i18n({ 4 | zh: { 5 | intro: "点击查看具体的使用方法和注意事项。", 6 | manage_profile: { 7 | label: "配置管理", 8 | $option4: [ 9 | "读取配置", 10 | "写入配置", 11 | "重置配置", 12 | "同步其他窗口的配置" 13 | ] as StringTuple<4>, 14 | help: "写入配置时请确保该卡片至少有一张子卡片。多张子卡片可以一起分担配置,防止单张卡片字数过多。" 15 | } 16 | }, 17 | en: { 18 | intro: "Click to view the specific usage method and precautions.", 19 | manage_profile: { 20 | label: "Manage Profile", 21 | $option4: [ 22 | "Read Profile", 23 | "Write Profile", 24 | "Reset Profile", 25 | "Sync Profile with Other Windows" 26 | ], 27 | help: "Please make sure that the card has at least one child card when writing the profile. Multiple child cards can share the profile together to prevent a single card from having too many words." 28 | } 29 | } 30 | }) 31 | -------------------------------------------------------------------------------- /packages/create-ohmymn/templates/profile/src/profile/default.ts: -------------------------------------------------------------------------------- 1 | import { Addon } from "~/addon" 2 | 3 | export const defaultGlobalProfile = { 4 | addon: { 5 | panelControl: [], 6 | panelPosition: [0], 7 | panelHeight: [1], 8 | autoBackup: false, 9 | backupID: "", 10 | doubleLink: false 11 | }, 12 | magicaction: {}, 13 | additional: { 14 | lastVision: Addon.version 15 | } 16 | } 17 | 18 | // Each document has a independent profile 19 | export const defaultDocProfile = { 20 | additional: {} 21 | } 22 | 23 | export const defaultNotebookProfile = { 24 | addon: { 25 | profile: [0] 26 | }, 27 | additional: {} 28 | } 29 | -------------------------------------------------------------------------------- /packages/create-ohmymn/templates/profile/src/profile/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./utils" 2 | export * from "./updateDataSource" 3 | export * from "./default" 4 | export * from "./typings" 5 | export * from "./profileAction" 6 | export * from "./profileAuto" 7 | -------------------------------------------------------------------------------- /packages/create-ohmymn/templates/profile/src/settingViewController/index.ts: -------------------------------------------------------------------------------- 1 | import { getObjCClassDeclar } from "marginnote" 2 | import handleUserAction from "./handleUserAction" 3 | import lifecycle from "./lifecycle" 4 | import settingView from "./settingView" 5 | 6 | export default JSB.defineClass( 7 | getObjCClassDeclar("SettingViewController", "UITableViewController"), 8 | { 9 | ...lifecycle, 10 | ...settingView, 11 | ...handleUserAction 12 | } 13 | ) 14 | -------------------------------------------------------------------------------- /packages/create-ohmymn/templates/profile/src/settingViewController/lang.ts: -------------------------------------------------------------------------------- 1 | import { i18n } from "marginnote" 2 | 3 | export default i18n({ 4 | zh: { 5 | input_enter: "输入完按回车(Enter)保存", 6 | none: "无", 7 | expand: "▶ 点击展开所有选项", 8 | collapse: "▼ 点击收起所有选项" 9 | }, 10 | en: { 11 | input_enter: "Press Enter to save", 12 | none: "None", 13 | expand: "▶ Click to expand all options", 14 | collapse: "▼ Click to collapse all options" 15 | } 16 | }) 17 | -------------------------------------------------------------------------------- /packages/create-ohmymn/templates/profile/src/settingViewController/lifecycle.ts: -------------------------------------------------------------------------------- 1 | import { Addon } from "~/addon" 2 | export default { 3 | viewDidLoad() { 4 | self.tableView.allowsSelection = true 5 | self.view.layer.cornerRadius = 10 6 | self.view.layer.borderWidth = 2 7 | }, 8 | //Execute when each time it is opened 9 | viewWillAppear() { 10 | self.tableView.reloadData() 11 | if (MN.isMacMN3) { 12 | self.tableView.backgroundColor = MN.currentThemeColor 13 | Addon.textColor = 14 | MN.app.currentTheme == "Gray" || MN.app.currentTheme == "Dark" 15 | ? UIColor.whiteColor() 16 | : UIColor.blackColor() 17 | } 18 | self.view.layer.borderColor = Addon.buttonColor 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /packages/create-ohmymn/templates/profile/src/typings/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./Module" 2 | export * from "./DataSource" 3 | 4 | export const enum CellViewType { 5 | PlainText = 0, 6 | Switch = 1, 7 | Button = 2, 8 | ButtonWithInput = 3, 9 | Input = 4, 10 | InlineInput = 5, 11 | Select = 6, 12 | MuiltSelect = 7, 13 | Expland = 8 14 | } 15 | -------------------------------------------------------------------------------- /packages/create-ohmymn/templates/profile/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "noEmit": true, 4 | "module": "ESNext", 5 | "target": "ES2020", 6 | "allowJs": true, 7 | "sourceMap": false, 8 | "noImplicitAny": true, 9 | "downlevelIteration": true, 10 | "moduleResolution": "node", 11 | "allowSyntheticDefaultImports": true, 12 | "suppressImplicitAnyIndexErrors": true, 13 | "resolveJsonModule": true, 14 | "importHelpers": true, 15 | "strict": true, 16 | "baseUrl": ".", 17 | "paths": { 18 | "~/*": ["./src/*"] 19 | }, 20 | "lib": ["ES2020"] 21 | }, 22 | "include": ["src/**/*.ts", "src/utils/third party/*.js"] 23 | } 24 | -------------------------------------------------------------------------------- /packages/docs/.gitignore: -------------------------------------------------------------------------------- 1 | .vercel 2 | -------------------------------------------------------------------------------- /packages/docs/.vitepress/components/Contributors.vue: -------------------------------------------------------------------------------- 1 | 4 | 5 | 13 | -------------------------------------------------------------------------------- /packages/docs/.vitepress/components/Feature.vue: -------------------------------------------------------------------------------- 1 | 38 | 39 | 42 | -------------------------------------------------------------------------------- /packages/docs/.vitepress/components/HomePage-en.vue: -------------------------------------------------------------------------------- 1 | 4 | 5 | 21 | -------------------------------------------------------------------------------- /packages/docs/.vitepress/components/HomePage.vue: -------------------------------------------------------------------------------- 1 | 4 | 5 | 21 | -------------------------------------------------------------------------------- /packages/docs/.vitepress/config/index.ts: -------------------------------------------------------------------------------- 1 | import { defineConfig } from "vitepress" 2 | import { enConfig } from "./en" 3 | import { sharedConfig } from "./shared" 4 | import { zhConfig } from "./zh" 5 | 6 | export default defineConfig({ 7 | ...sharedConfig, 8 | locales: { 9 | en: { label: "English", lang: "en-US", link: "/en/", ...enConfig }, 10 | root: { label: "简体中文", lang: "zh-CN", link: "/", ...zhConfig } 11 | } 12 | }) 13 | -------------------------------------------------------------------------------- /packages/docs/.vitepress/contributors.ts: -------------------------------------------------------------------------------- 1 | import contributorNames from "../../../contributors.json" 2 | 3 | export interface Contributor { 4 | name: string 5 | avatar: string 6 | } 7 | 8 | export interface SocialEntry { 9 | icon: string 10 | link: string 11 | } 12 | 13 | export interface CoreTeam { 14 | avatar: string 15 | name: string 16 | // required to download avatars from GitHub 17 | github: string 18 | twitter: string 19 | sponsor?: string 20 | title?: string 21 | org?: string 22 | desc?: string 23 | links?: SocialEntry[] 24 | } 25 | 26 | const contributorsAvatars: Record = {} 27 | 28 | const getAvatarUrl = (name: string) => 29 | import.meta.hot 30 | ? `https://github.com/${name}.png` 31 | : `/user-avatars/${name}.png` 32 | 33 | export const contributors = (contributorNames as string[]).reduce( 34 | (acc, name) => { 35 | contributorsAvatars[name] = getAvatarUrl(name) 36 | acc.push({ name, avatar: contributorsAvatars[name] }) 37 | return acc 38 | }, 39 | [] as Contributor[] 40 | ) 41 | -------------------------------------------------------------------------------- /packages/docs/.vitepress/scripts/build-pwa.mjs: -------------------------------------------------------------------------------- 1 | import { fileURLToPath } from 'url' 2 | import { resolveConfig } from 'vite' 3 | import jiti from 'jiti' 4 | 5 | const rebuildPwa = async () => { 6 | const config = await resolveConfig({}, 'build', 'production') 7 | // when `vite-plugin-pwa` is presented, use it to regenerate SW after rendering 8 | const pwaPlugin = config.plugins.find(i => i.name === 'vite-plugin-pwa')?.api 9 | const pwa = pwaPlugin && !pwaPlugin.disabled 10 | const assets = jiti(fileURLToPath(import.meta.url))('./assets.ts') 11 | await assets.optimizePages(pwa) 12 | if (pwa) 13 | await pwaPlugin.generateSW() 14 | } 15 | 16 | rebuildPwa() 17 | -------------------------------------------------------------------------------- /packages/docs/.vitepress/shim.d.ts: -------------------------------------------------------------------------------- 1 | declare module "*.vue" { 2 | import { ComponentOptions } from "vue" 3 | const componentOptions: ComponentOptions 4 | export default componentOptions 5 | } 6 | -------------------------------------------------------------------------------- /packages/docs/.vitepress/theme/index.ts: -------------------------------------------------------------------------------- 1 | import Theme from "vitepress/theme" 2 | import { inBrowser } from "vitepress" 3 | import "../style/main.css" 4 | import "../style/vars.css" 5 | import "element-plus/theme-chalk/dark/css-vars.css" 6 | import "element-plus/theme-chalk/src/index.scss" 7 | import "uno.css" 8 | 9 | if (inBrowser) import("./pwa") 10 | 11 | export default { 12 | ...Theme 13 | } 14 | -------------------------------------------------------------------------------- /packages/docs/.vitepress/theme/pwa.ts: -------------------------------------------------------------------------------- 1 | import { registerSW } from 'virtual:pwa-register' 2 | 3 | registerSW({ immediate: true }) 4 | -------------------------------------------------------------------------------- /packages/docs/README.md: -------------------------------------------------------------------------------- 1 | # Documentation of [OhMyMN](https://github.com/ourongxing/ohmymn) 2 | 3 | [简体中文](https://ohmymn.marginnote.cn) | [English](https://ohmymn.marginnote.cn/en) (Only user guide) 4 | 5 | ## License 6 | 7 | MIT -------------------------------------------------------------------------------- /packages/docs/api/index.md: -------------------------------------------------------------------------------- 1 | # 简介 2 | 3 | 首先要明白 MN 的插件底层 API 是基于 Objective-C 的,虽然看上去插件是用 JS 写,但其实只是通过 JSBridge 调用 Objective-C 的 API 来实现。 4 | 5 | API 分为四个部分: 6 | 7 | - OhMyMN 8 | - MarginNote 9 | - High-Level API 10 | - Low-Level API 11 | - Foundation 12 | - UIKit 13 | 14 | OhMyMN 的 API 用于 OhMyMN 插件的开发。 15 | 16 | MarginNote 的 API 又分为 Low-Level API 和 High-Level API。 17 | 18 | Low-Level API 实际上就是将 Objective-C 语法直接转换为 JS 语法,提供类型声明文件,使其可以在 TypeScript 中使用。High-Level API 是对 Low-Level API 的封装,使用起来更加方便。 19 | 20 | ::: tip 21 | 事实上,High-Level API 就是从 OhMyMN API 中抽取出来的通用部分,方便在其它插件中使用。所以目前提供的 High-Level API 并不完整,只覆盖掉了 OhMyMN 常用的部分。 22 | ::: 23 | 24 | Foundation 和 UIKit 是 Apple 提供的两个框架,用于开发 iOS/MacOS 应用。MN 插件对其提供有限的支持。同样属于 Objective-C Low-Level API。目前只转换了部分 API 到 TypeScript。High-Level API 其实也封装了部分 Foundation 和 UIKit 的 API。 25 | 26 | 所有的 API 代码都可以在 [marinnoteapp/ohmymn/packages/api](https://github.com/ourongxing/ohmymn/tree/main/packages/api) 找到。其中包括了 Objective-C 和 TypeScript 两种语言的代码。 27 | 28 | 推荐使用 VSCode 作为代码编辑器,可以检查类型,自动补全。导入 `marginnote` 包,以获得更好的开发体验。这个包里还包括了部分 Foundation 和 UIKit API。 29 | ```shell 30 | pnpm install marginnote 31 | ``` -------------------------------------------------------------------------------- /packages/docs/dev/lifecycle.md: -------------------------------------------------------------------------------- 1 | # 生命周期 2 | 所谓生命周期,也就是 MN 和插件在运行的各个阶段调用的特定方法。 3 | 4 | ## 实例方法 5 | MN 的执行顺序 6 | 7 | ![](https://testmnbbs.oss-cn-zhangjiakou.aliyuncs.com/pic/mermaid-diagram-2023-04-27-015512.svg?x-oss-process=base_webp) 8 | 9 | ::: warning 注意 10 | iPad 上直接划掉后台,不会触发关闭事件,包括关闭笔记本和关闭文档。请在进入后台的时候触发相关动作。 11 | ::: 12 | ### sceneWillConnect() 13 | 创建新的 MN 窗口时触发,MN 支持多窗口,每次新建窗口都会触发这个方法。 14 | ### sceneDidDisconnect() 15 | 关闭 MN 窗口时触发。 16 | ### sceneWillResignActive() 17 | MN 窗口失去焦点时触发。 18 | ### sceneDidBecomeActive() 19 | MN 窗口获得焦点时触发。 20 | ### notebookWillOpen(topicid: string) 21 | 打开笔记本时触发。可以获取笔记本的 id。 22 | ### notebookWillClose(topicid: string) 23 | 关闭笔记本时触发。可以获取笔记本的 id。 24 | ### documentDidOpen(docmd5: string) 25 | 打开文档时触发。可以获取文档的 md5。 26 | ### documentWillClose(docmd5: string) 27 | 关闭文档时触发。可以获取文档的 md5。 28 | 29 | ## 静态方法 30 | ### addonDidConnect() 31 | 插件安装,启用,注意启动 MN 时也会触发。 32 | ### addonWillDisconnect() 33 | 插件卸载,停用时触发。 -------------------------------------------------------------------------------- /packages/docs/dev/module/index.md: -------------------------------------------------------------------------------- 1 | # OhMyMN 模块开发 2 | OhMyMN 是一个可以自动处理摘录的工具箱,也可以手动处理卡片。里面所有的功能都是模块化的,可以轻松扩展。 3 | 4 | 目前已经多达 15 个可选模块。[点击查看更多细节](/guide/index.md)。 5 | 6 | 如果你也想开发处理摘录或者处理卡片相关的功能,直接开发 OhMyMN 的模块会十分轻松,也更加强大。 7 | 8 | OhMyMN 有个不成文的约定,如果会摘录时自动执行,模块名一般以 `auto` 开头,并且需要提供 `on` 的选项,用来关闭摘录时自动执行。 9 | ## 模块注册 10 | 所有的模块都需要在注册 `modules/index.ts`,才能被 OhMyMN 加载。分为可选模块和必选模块。 11 | ```ts 12 | export const optionalModules = { shortcut } 13 | export const requiredModules = { addon, magicaction4card, magicaction4text } 14 | ``` -------------------------------------------------------------------------------- /packages/docs/dev/ohmymn/esbuild.md: -------------------------------------------------------------------------------- 1 | # 打包插件 2 | 3 | OhMyMN 使用 [esbuild](https://esbuild.github.io/) 打包插件,将所有代码打包成一个文件。它很快,但不会检查 TypeScript 类型。在 OhMyMN 中,类型的正确非常重要。所以我使用了 ESBuild 的上层封装,也就是 [estrella](https://github.com/rsms/estrella),它可以快速检查 TypeScript 类型。 4 | 5 | 在 `build.ts` 里修改打包的配置。 6 | 7 | ## 开发 8 | 9 | ```ts 10 | pnpm dev 11 | 12 | ``` 13 | 在开发阶段,可以监听文件变化,自动重新编译,生成 `main.js` 文件,然后将其复制到 MarginNote 的插件目录。 14 | 15 | 每次修改都会检查 TypeScript 类型,如果有错误,会提示错误信息。 16 | 17 | ::: warning 注意 18 | MarginNote 无法自动读取新的插件代码,需要手动重启 MarginNote。可以使用 [mnaddon](../lite.md#cli) 工具快速重启 MarginNote,以及跳过弹窗。 19 | ::: 20 | 21 | ## 构建 22 | ```ts 23 | pnpm build 24 | ``` 25 | 打包插件,在 dist 目录下生成 `.mnaddon` 文件,可以直接安装到 MarginNote 中。 26 | 27 | 为了更方便的在 iPad 上调试插件,可以使用 28 | ```ts 29 | pnpm run build:iPad 30 | ``` 31 | 会在打包后自动通过 AirDrop 将插件发送到 iPad 上。 32 | 33 | ::: tip 34 | 需要安装 [airdrop-cli](https://github.com/vldmrkl/airdrop-cli),才能在命令行里使用 AirDrop。 35 | ```sh 36 | brew install vldmrkl/formulae/airdrop-cli 37 | ``` 38 | ::: 39 | -------------------------------------------------------------------------------- /packages/docs/dev/ohmymn/i18n.md: -------------------------------------------------------------------------------- 1 | # 国际化 2 | 通常我们创建一个 `lang.ts` 文件来存放两种语言的文本。使用 `i18n` 函数来创建一个国际化对象,会自动根据 MN 的语言得到对应的文字。 3 | 4 | ```ts 5 | import { i18n } from "marginnote" 6 | 7 | export default i18n({ 8 | zh: { 9 | intro: `当前版本:${Addon.version}`, 10 | double_link: "双击打开链接", 11 | profile: { 12 | $option5: [ 13 | "配置 1", 14 | "配置 2", 15 | "配置 3", 16 | "配置 4", 17 | "初始化" 18 | ] as StringTuple<5>, 19 | label: "选择全局配置", 20 | help: "【仅当前笔记本】不同场景,不同配置。" 21 | } 22 | }, 23 | 24 | en: { 25 | intro: `Current Version: ${Addon.version}`, 26 | double_link: "Double Click to Open Link", 27 | profile: { 28 | $option5: [ 29 | "Profile 1", 30 | "Profile 2", 31 | "Profile 3", 32 | "Profile 4", 33 | "Initialize" 34 | ], 35 | label: "Select Global Profile", 36 | help: "[Only Current Notebook] Different Scenes, Different Profile." 37 | } 38 | }) 39 | 40 | ``` 41 | 42 | 需要做一些约定: 43 | 44 | OhMyMN 里菜单选项都是直接传入的字符串数组,虽然这样做非常简单,但是会直接影响到代码的逻辑,比如数组的长度不一样,所以我们需要使用 `StringTuple` 来约束数组长度。并且 key 必须以 `$` 开头,后面跟着数字,表示数组长度。 -------------------------------------------------------------------------------- /packages/docs/dev/store.md: -------------------------------------------------------------------------------- 1 | # 数据存储 2 | 3 | ```ts 4 | function getLocalDataByKey(key: string) { 5 | return NSUserDefaults.standardUserDefaults().objectForKey(key) 6 | } 7 | function setLocalDataByKey(data: any, key: string) { 8 | NSUserDefaults.standardUserDefaults().setObjectForKey(data, key) 9 | } 10 | ``` 11 | 12 | 持久化数据,也就是存到本地。但这并不是文件。可以直接存储 JSON 对象,不需要转换成字符串。但注意不要有 undefined,否则会报错。 13 | 14 | 可以直接导入使用 15 | ```ts 16 | import { getLocalDataByKey, setLocalDataByKey } from "marginnote" 17 | ``` -------------------------------------------------------------------------------- /packages/docs/dev/structure.md: -------------------------------------------------------------------------------- 1 | # 插件结构 2 | 3 | MN 插件文件以 `.mnaddon` 为后缀,本质上是一个 `.zip` 压缩包,里面包含了插件的所有文件。[mnaddon](./lite.md#cli) 工具提供了打包和解包的命令。 4 | 5 | ### `mnaddon.json` 6 | 插件的描述清单,包含了插件的基本信息,比如名称、版本、作者等。 7 | ```json 8 | { 9 | "addonid": "marginnote.extension.ohmymn", 10 | "author": "ourongxing", 11 | "title": "OhMyMN", 12 | "version": "4.2.0", 13 | "marginnote_version_min": "3.7.21", 14 | "cert_key": "" 15 | } 16 | ``` 17 | 18 | - `addonid` 是插件的唯一标识,不能重复,统一使用 `marginnote.extension.` 开头,后面跟上你的插件 id/key。 19 | - `marginnote_version_min` 是插件最低支持的版本,如果 MN 低于该版本,将无法安装。 20 | - `cert_key` 是插件的签名,需要向 MarginNote 官方申请,[申请方法](https://bbs.marginnote.cn/t/topic/8042)。没有签名的插件默认无法安装,需要打开 `允许加载未经认证的插件` 选项,但是仍然会有弹窗警告。每次插件更新均需要重新申请签名。 21 | 22 | ### `main.js` 23 | 插件代码 24 | ### `logo.png` 25 | 插件图标,尺寸必须是 44x44,否则会被缩放。文件名不限,需要在 `queryAddonCommandStatus` 中手动指定。 -------------------------------------------------------------------------------- /packages/docs/docsearch.json: -------------------------------------------------------------------------------- 1 | { 2 | "index_name": "doc", 3 | "start_urls": ["https://ohmymn.marginnote.cn"], 4 | "selectors": { 5 | "lvl0": "", 6 | "lvl1": ".content h1", 7 | "lvl2": ".content h2", 8 | "lvl3": ".content h3", 9 | "lvl4": ".content h4", 10 | "lvl5": ".content h5", 11 | "content": ".content p, .content li", 12 | "lang": { 13 | "selector": "/html/@lang", 14 | "type": "xpath", 15 | "global": true 16 | } 17 | }, 18 | "strip_chars": " .,;:#", 19 | "selectors_exclude": [".sr-only"], 20 | "custom_settings": { 21 | "attributesForFaceting": ["lang", "tags"] 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /packages/docs/en/api/index.md: -------------------------------------------------------------------------------- 1 | # 简介 2 | 3 | 首先要明白 MN 的插件底层 API 是基于 Objective-C 的,虽然看上去插件是用 JS 写,但其实只是通过 JSBridge 调用 Objective-C 的 API 来实现。 4 | 5 | API 分为四个部分: 6 | 7 | - OhMyMN 8 | - MarginNote 9 | - High-Level API 10 | - Low-Level API 11 | - Foundation 12 | - UIKit 13 | 14 | OhMyMN 的 API 用于 OhMyMN 插件的开发。 15 | 16 | MarginNote 的 API 又分为 Low-Level API 和 High-Level API。 17 | 18 | Low-Level API 实际上就是将 Objective-C 语法直接转换为 JS 语法,提供类型声明文件,使其可以在 TypeScript 中使用。High-Level API 是对 Low-Level API 的封装,使用起来更加方便。 19 | 20 | ::: tip 21 | 事实上,High-Level API 就是从 OhMyMN API 中抽取出来的通用部分,方便在其它插件中使用。所以目前提供的 High-Level API 并不完整,只覆盖掉了 OhMyMN 常用的部分。 22 | ::: 23 | 24 | Foundation 和 UIKit 是 Apple 提供的两个框架,用于开发 iOS/MacOS 应用。MN 插件对其提供有限的支持。同样属于 Objective-C Low-Level API。目前只转换了部分 API 到 TypeScript。High-Level API 其实也封装了部分 Foundation 和 UIKit 的 API。 25 | 26 | 所有的 API 代码都可以在 [marinnoteapp/ohmymn/packages/api](https://github.com/ourongxing/ohmymn/tree/main/packages/api) 找到。其中包括了 Objective-C 和 TypeScript 两种语言的代码。 27 | 28 | 推荐使用 VSCode 作为代码编辑器,可以检查类型,自动补全。导入 `marginnote` 包,以获得更好的开发体验。这个包里还包括了部分 Foundation 和 UIKit API。 29 | ```shell 30 | pnpm install marginnote 31 | ``` -------------------------------------------------------------------------------- /packages/docs/en/dev/lifecycle.md: -------------------------------------------------------------------------------- 1 | # 生命周期 2 | 所谓生命周期,也就是 MN 和插件在运行的各个阶段调用的特定方法。 3 | 4 | ## 实例方法 5 | MN 的执行顺序 6 | 7 | ![](https://testmnbbs.oss-cn-zhangjiakou.aliyuncs.com/pic/mermaid-diagram-2023-04-27-015512.svg?x-oss-process=base_webp) 8 | 9 | ::: warning 注意 10 | iPad 上直接划掉后台,不会触发关闭事件,包括关闭笔记本和关闭文档。请在进入后台的时候触发相关动作。 11 | ::: 12 | ### sceneWillConnect() 13 | 创建新的 MN 窗口时触发,MN 支持多窗口,每次新建窗口都会触发这个方法。 14 | ### sceneDidDisconnect() 15 | 关闭 MN 窗口时触发。 16 | ### sceneWillResignActive() 17 | MN 窗口失去焦点时触发。 18 | ### sceneDidBecomeActive() 19 | MN 窗口获得焦点时触发。 20 | ### notebookWillOpen(topicid: string) 21 | 打开笔记本时触发。可以获取笔记本的 id。 22 | ### notebookWillClose(topicid: string) 23 | 关闭笔记本时触发。可以获取笔记本的 id。 24 | ### documentDidOpen(docmd5: string) 25 | 打开文档时触发。可以获取文档的 md5。 26 | ### documentWillClose(docmd5: string) 27 | 关闭文档时触发。可以获取文档的 md5。 28 | 29 | ## 静态方法 30 | ### addonDidConnect() 31 | 插件安装,启用,注意启动 MN 时也会触发。 32 | ### addonWillDisconnect() 33 | 插件卸载,停用时触发。 -------------------------------------------------------------------------------- /packages/docs/en/dev/module/index.md: -------------------------------------------------------------------------------- 1 | # OhMyMN 模块开发 2 | OhMyMN 是一个可以自动处理摘录的工具箱,也可以手动处理卡片。里面所有的功能都是模块化的,可以轻松扩展。 3 | 4 | 目前已经多达 15 个可选模块。[点击查看更多细节](/guide/index.md)。 5 | 6 | 如果你也想开发处理摘录或者处理卡片相关的功能,直接开发 OhMyMN 的模块会十分轻松,也更加强大。 7 | 8 | OhMyMN 有个不成文的约定,如果会摘录时自动执行,模块名一般以 `auto` 开头,并且需要提供 `on` 的选项,用来关闭摘录时自动执行。 9 | ## 模块注册 10 | 所有的模块都需要在注册 `modules/index.ts`,才能被 OhMyMN 加载。分为可选模块和必选模块。 11 | ```ts 12 | export const optionalModules = { shortcut } 13 | export const requiredModules = { addon, magicaction4card, magicaction4text } 14 | ``` -------------------------------------------------------------------------------- /packages/docs/en/dev/ohmymn/esbuild.md: -------------------------------------------------------------------------------- 1 | # 打包插件 2 | 3 | OhMyMN 使用 [esbuild](https://esbuild.github.io/) 打包插件,将所有代码打包成一个文件。它很快,但不会检查 TypeScript 类型。在 OhMyMN 中,类型的正确非常重要。所以我使用了 ESBuild 的上层封装,也就是 [estrella](https://github.com/rsms/estrella),它可以快速检查 TypeScript 类型。 4 | 5 | 在 `build.ts` 里修改打包的配置。 6 | 7 | ## 开发 8 | 9 | ```ts 10 | pnpm dev 11 | 12 | ``` 13 | 在开发阶段,可以监听文件变化,自动重新编译,生成 `main.js` 文件,然后将其复制到 MarginNote 的插件目录。 14 | 15 | 每次修改都会检查 TypeScript 类型,如果有错误,会提示错误信息。 16 | 17 | ::: warning 注意 18 | MarginNote 无法自动读取新的插件代码,需要手动重启 MarginNote。可以使用 [mnaddon](../lite.md#cli) 工具快速重启 MarginNote,以及跳过弹窗。 19 | ::: 20 | 21 | ## 构建 22 | ```ts 23 | pnpm build 24 | ``` 25 | 打包插件,在 dist 目录下生成 `.mnaddon` 文件,可以直接安装到 MarginNote 中。 26 | 27 | 为了更方便的在 iPad 上调试插件,可以使用 28 | ```ts 29 | pnpm run build:iPad 30 | ``` 31 | 会在打包后自动通过 AirDrop 将插件发送到 iPad 上。 32 | 33 | ::: tip 34 | 需要安装 [airdrop-cli](https://github.com/vldmrkl/airdrop-cli),才能在命令行里使用 AirDrop。 35 | ```sh 36 | brew install vldmrkl/formulae/airdrop-cli 37 | ``` 38 | ::: 39 | -------------------------------------------------------------------------------- /packages/docs/en/dev/ohmymn/i18n.md: -------------------------------------------------------------------------------- 1 | # 国际化 2 | 通常我们创建一个 `lang.ts` 文件来存放两种语言的文本。使用 `i18n` 函数来创建一个国际化对象,会自动根据 MN 的语言得到对应的文字。 3 | 4 | ```ts 5 | import { i18n } from "marginnote" 6 | 7 | export default i18n({ 8 | zh: { 9 | intro: `当前版本:${Addon.version}`, 10 | double_link: "双击打开链接", 11 | profile: { 12 | $option5: [ 13 | "配置 1", 14 | "配置 2", 15 | "配置 3", 16 | "配置 4", 17 | "初始化" 18 | ] as StringTuple<5>, 19 | label: "选择全局配置", 20 | help: "【仅当前笔记本】不同场景,不同配置。" 21 | } 22 | }, 23 | 24 | en: { 25 | intro: `Current Version: ${Addon.version}`, 26 | double_link: "Double Click to Open Link", 27 | profile: { 28 | $option5: [ 29 | "Profile 1", 30 | "Profile 2", 31 | "Profile 3", 32 | "Profile 4", 33 | "Initialize" 34 | ], 35 | label: "Select Global Profile", 36 | help: "[Only Current Notebook] Different Scenes, Different Profile." 37 | } 38 | }) 39 | 40 | ``` 41 | 42 | 需要做一些约定: 43 | 44 | OhMyMN 里菜单选项都是直接传入的字符串数组,虽然这样做非常简单,但是会直接影响到代码的逻辑,比如数组的长度不一样,所以我们需要使用 `StringTuple` 来约束数组长度。并且 key 必须以 `$` 开头,后面跟着数字,表示数组长度。 -------------------------------------------------------------------------------- /packages/docs/en/dev/store.md: -------------------------------------------------------------------------------- 1 | # 数据存储 2 | 3 | ```ts 4 | function getLocalDataByKey(key: string) { 5 | return NSUserDefaults.standardUserDefaults().objectForKey(key) 6 | } 7 | function setLocalDataByKey(data: any, key: string) { 8 | NSUserDefaults.standardUserDefaults().setObjectForKey(data, key) 9 | } 10 | ``` 11 | 12 | 持久化数据,也就是存到本地。但这并不是文件。可以直接存储 JSON 对象,不需要转换成字符串。但注意不要有 undefined,否则会报错。 13 | 14 | 可以直接导入使用 15 | ```ts 16 | import { getLocalDataByKey, setLocalDataByKey } from "marginnote" 17 | ``` -------------------------------------------------------------------------------- /packages/docs/en/dev/structure.md: -------------------------------------------------------------------------------- 1 | # 插件结构 2 | 3 | MN 插件文件以 `.mnaddon` 为后缀,本质上是一个 `.zip` 压缩包,里面包含了插件的所有文件。[mnaddon](./lite.md#cli) 工具提供了打包和解包的命令。 4 | 5 | ### `mnaddon.json` 6 | 插件的描述清单,包含了插件的基本信息,比如名称、版本、作者等。 7 | ```json 8 | { 9 | "addonid": "marginnote.extension.ohmymn", 10 | "author": "ourongxing", 11 | "title": "OhMyMN", 12 | "version": "4.2.0", 13 | "marginnote_version_min": "3.7.21", 14 | "cert_key": "" 15 | } 16 | ``` 17 | 18 | - `addonid` 是插件的唯一标识,不能重复,统一使用 `marginnote.extension.` 开头,后面跟上你的插件 id/key。 19 | - `marginnote_version_min` 是插件最低支持的版本,如果 MN 低于该版本,将无法安装。 20 | - `cert_key` 是插件的签名,需要向 MarginNote 官方申请,[申请方法](https://bbs.marginnote.cn/t/topic/8042)。没有签名的插件默认无法安装,需要打开 `允许加载未经认证的插件` 选项,但是仍然会有弹窗警告。每次插件更新均需要重新申请签名。 21 | 22 | ### `main.js` 23 | 插件代码 24 | ### `logo.png` 25 | 插件图标,尺寸必须是 44x44,否则会被缩放。文件名不限,需要在 `queryAddonCommandStatus` 中手动指定。 -------------------------------------------------------------------------------- /packages/docs/en/guide/modules/autocomment.md: -------------------------------------------------------------------------------- 1 | # AutoComment 2 | 3 | Automatically add specified comments if a regex is matched, or extract specific content from an excerpt as a comment. 4 | 5 | ## Custom 6 | 7 | ::: warning Input Format 8 | [Replace() Method Format —— Extract](../custom.md#replace-method) 9 | ::: 10 | 11 | **Example** 12 | 13 | - `(/./, "This is an example")` will add one comment as "This is an example" for each iteration. 14 | 15 | ## [MagicAction for Card](magicaction4card.md#add-comment) 16 | 17 | ### Add Comment 18 | 19 | ::: warning Input Format 20 | [Replace() Method Format —— Extract](../custom.md#replace-method) 21 | ::: 22 | 23 | Since in most cases it's just to add a comment without extracting it, so you can just type in the comment content and I will complete it as `(/./, "")`. -------------------------------------------------------------------------------- /packages/docs/en/guide/modules/autoreplace.md: -------------------------------------------------------------------------------- 1 | # AutoReplace 2 | 3 | Automatically replaces certain words or phrases in excerpts. This is the common use of the replace function, so there isn't much to say. 4 | 5 | ## Custom 6 | 7 | ::: warning Input Format 8 | [Replace() Method Format —— Replace](../custom.md#replace-method) 9 | ::: 10 | 11 | ## OCR Pro Common Mistakes (to be added) 12 | 13 | ## [MagicAction for Card](magicaction4card.md#replace-excerpt-text) 14 | 15 | ### Replace Excerpt Text 16 | 17 | ::: warning Input Format 18 | [Replace() Method Format —— Replace](../custom.md#replace-method) 19 | ::: -------------------------------------------------------------------------------- /packages/docs/en/guide/modules/autosimplify.md: -------------------------------------------------------------------------------- 1 | # AutoSimplify 2 | 3 | ::: tip Update 4 | v4.1.0 Added 5 | ::: 6 | 7 | **Powered by [OpenCC](https://github.com/BYVoid/OpenCC)** 8 | 9 | Automatic conversion of excerpts to Simplified Chinese. 10 | 11 | ## Custom 12 | 13 | ::: warning Input Format 14 | [Replace() Method Format —— Replace](../custom.md#replace-method) 15 | ::: 16 | 17 | ## Variant Conversion 18 | 19 | Taiwan and Hong Kong have different definitions of variant characters, so different variant characters may appear in Traditional Chinese in these two regions. 20 | -------------------------------------------------------------------------------- /packages/docs/en/guide/modules/autotag.md: -------------------------------------------------------------------------------- 1 | # AutoTag 2 | 3 | Specified tags are automatically added if a regex is matched, and specific content can also be extracted from the excerpt as tags. 4 | 5 | ## Custom 6 | 7 | ::: warning Input Format 8 | [Replace() Method Format —— Extract](../custom.md#replace-method) 9 | ::: 10 | 11 | **Example** 12 | 13 | - `(/^.+$/gs, "This is an example")` and could add four tags each time, such as "#This #is #an #example". 14 | - `(/@picture/gs, "This is a picture")` and could add a tag for "This is a picture" when you excerpt a picture。 15 | 16 | ## [MagicAction for Card](magicaction4card.md#add-tag) 17 | 18 | ### Add Tag 19 | 20 | ::: warning Input Format 21 | [Replace() Method Format —— Extract](../custom.md#replace-method) 22 | ::: 23 | 24 | Since in most cases it's just to add tags without extracting them, you can just type in the tag content. 25 | -------------------------------------------------------------------------------- /packages/docs/en/guide/split.md: -------------------------------------------------------------------------------- 1 | # Split() Method 2 | 3 | [Split() method](https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/String/split) is currently only used in [Another AutoDef](modules/anotherautodef) to split the excerpt text into two parts: the title and the excerpt. 4 | 5 | Just provide a [Regular Expression](regex) as the split point to split the string in two parts. 6 | 7 | if you use a capture group in your regular expression, it puts the captured content in the split result, resulting in a split into three parts. If you have to group, you can use a non-capture group. 8 | 9 | There is actually a benefit to capture groups, which is when you can't find a clear split, such as a multiple-choice question where you want to use the question as the title and the options as excerpts. That's when you have to use the capture group and the capture is all the options. 10 | 11 | [definiendum, definiens] ⇒ [definiendum, capture group] 12 | 13 | In addition, the capture group allows you to restrict the definiendum or definiens. 14 | -------------------------------------------------------------------------------- /packages/docs/en/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: home 3 | sidebar: false 4 | 5 | title: OhMyMN 6 | titleTemplate: MarginNote Addon Development Framework 7 | 8 | hero: 9 | name: OhMyMN 10 | text: MarginNote Addon Development Framework 11 | tagline: Also a toolbox that can process excerpts automatically 12 | image: 13 | src: /logo-shadow.svg 14 | alt: ohmymn 15 | actions: 16 | - theme: brand 17 | text: Guide 18 | link: /en/guide/ 19 | - theme: alt 20 | text: Development 21 | link: /en/dev/ 22 | - theme: alt 23 | text: API 24 | link: /en/api/ 25 | - theme: alt 26 | text: Download 27 | link: https://forum.marginnote.com/t/5883 28 | - theme: alt 29 | text: View on GitHub 30 | link: https://github.com/ourongxing/ohmymn 31 | --- 32 | 36 | 37 | -------------------------------------------------------------------------------- /packages/docs/guide/modules/anotherautotitle.md: -------------------------------------------------------------------------------- 1 | # Another AutoTitle 2 | 3 | 什么样的摘录该设置为标题? 4 | 5 | ## 预设 6 | 7 | ::: tip 8 | 预设只需要满足一个就会自动转为标题 9 | ::: 10 | 11 | 1. 字数:这是最容易想到的判断标准,当你某一次只摘录了两个字,必然想把这个摘录作为标题。只要不超过设置的字数,就会自动转为标题。如果中文句子中出现数字或者单词,并不会分开计算,一个单词或者数字也会占用一个类中文字数。 12 | 13 | - 类中文字数:不是由字母组成的都属于类中文。 14 | - 类英文字数:也就是单词数,这里我把数字也看作一个单词。 15 | 16 | 2. 不含有点号:所谓点号,标点标点,包含标号和点号,点号就是指表示停顿的一类标点符号,比如 `。.、??!!,,;;::`。没有表示停顿的符号,大概率是作为标题。 17 | 18 | ## 自定义 19 | 20 | 使用正则表达式来判断摘录的文字是否满足要求,满足就转为标题。 21 | 22 | ::: warning 输入格式 23 | [正则表达式——判断](../custom.md#正则表达式) 24 | ::: 25 | 26 | **示例** 27 | 28 | 比如你如果希望在全中文下,没有标点,字数不超过 10,就会自动转为标题,则可以写成 `/^[\u4e00-\u9fa5]{0,10}$/`。 29 | 30 | ## ~~标题摘录始终为标题~~ 31 | ::: tip 更新 32 | [v4.0.10](/update) 移除 33 | ::: 34 | -------------------------------------------------------------------------------- /packages/docs/guide/modules/autocomment.md: -------------------------------------------------------------------------------- 1 | # AutoComment 2 | 3 | 在匹配到正则的情况下自动添加指定评论,也可以从摘录中提取特定内容为评论。 4 | 5 | ## 自定义 6 | 7 | ::: warning 输入格式 8 | [Replace() 函数格式——提取](../custom.md#replace-函数) 9 | ::: 10 | 11 | **例** 12 | 13 | - `(/^.+$/gs, "这是一个例子")` 即可每次都添加一条评论为“这是一个例子”。 14 | 15 | ::: tip 更新 16 | [v4.0.11](/update) 支持图片摘录自动添加评论。 17 | ::: 18 | 19 | - `(/@picture/gs, "这是一张图片")` 摘录图片时自动添加评论。 20 | 21 | ## [MagicAction for Card](magicaction4card.md#添加评论) 22 | 23 | ### 添加评论 24 | 25 | ::: warning 输入格式 26 | [Replace() 函数格式——提取](../custom.md#replace-函数),传入卡片中的摘录。 27 | ::: 28 | 29 | 由于大部分情况下只是为了添加评论,而无须提取,所以你可以直接输入评论内容。 30 | -------------------------------------------------------------------------------- /packages/docs/guide/modules/autoreplace.md: -------------------------------------------------------------------------------- 1 | # AutoReplace 2 | 3 | 在摘录的时候自动替换某些字或词。就是常规 replace 函数的使用,不多说。 4 | 5 | ## 自定义 6 | 7 | ::: warning 输入格式 8 | [Replace() 函数格式——替换](../custom.md#replace-函数) 9 | ::: 10 | 11 | ## OCR Pro 常见错误(待补充) 12 | 13 | ## [MagicAction for Card](magicaction4card.md#替换摘录文字) 14 | 15 | ### 替换摘录文字 16 | 17 | ::: warning 自定义格式 18 | [Replace() 函数格式——替换](../custom.md#replace-函数) 19 | ::: 20 | -------------------------------------------------------------------------------- /packages/docs/guide/modules/autosimplify.md: -------------------------------------------------------------------------------- 1 | # AutoSimplify 2 | 3 | ::: tip 更新 4 | [v4.0.6](/update.md) 新增 5 | ::: 6 | 7 | **Powered by [OpenCC](https://github.com/BYVoid/OpenCC)** 8 | 9 | 自动将摘录转换为简体中文。 10 | 11 | ## 自定义 12 | 13 | ::: warning 输入格式 14 | [Replace() 函数格式——替换](../custom.md#replace-函数) 15 | ::: 16 | 17 | ## 异体字 18 | 19 | 中国台湾和中国香港对于异体字的定义有所不同,因此在这两个地区的繁体中文中,可能会出现不同的异体字。 20 | -------------------------------------------------------------------------------- /packages/docs/guide/modules/autotag.md: -------------------------------------------------------------------------------- 1 | # AutoTag 2 | 3 | 在匹配到正则的情况下自动添加指定标签,也可以从摘录中提取特定内容为标签。 4 | 5 | ::: tip 更新 6 | [v4.0.11](/update) 支持记录自动生成的标签,在修改摘录时自动删除之前生成的标签。 7 | ::: 8 | 9 | ## 自定义 10 | 11 | ::: warning 自定义格式 12 | [Replace() 函数格式——提取](../custom.md#replace-函数) 13 | ::: 14 | 15 | **例** 16 | 17 | - `(/^.+$/gs, "这是一个例子")` 即可每次都添加一个标签为“这是一个例子”。 18 | 19 | ::: tip 更新 20 | [v4.0.11](/update) 支持图片摘录自动添加标签。 21 | [v4.0.16](/update) 通过空格来添加多个标签。标点符号自动替换为 `_`。 22 | ::: 23 | 24 | - `(/@picture/gs, "这是一张图片")` 摘录图片时自动添加标签。 25 | 26 | ## [MagicAction for Card](magicaction4card.md#添加标签) 27 | 28 | ### 添加标签 29 | 30 | ::: warning 输入格式 31 | [Replace() 函数格式——提取](../custom.md#replace-函数),传入卡片中的摘录。 32 | ::: 33 | 34 | 由于大部分情况下只是为了添加标签,而无须提取,所以你可以直接输入标签内容。 -------------------------------------------------------------------------------- /packages/docs/guide/modules/shortcut.md: -------------------------------------------------------------------------------- 1 | 4 | # Shortcut 5 | 6 | ::: warning 注意 7 | 该功能完全由 OhMyMN 提供,与 MarginNote 无关。如果你使用的是 MN4,注意把所有 URL Scheme 中的 `marginnote3app` 替换为 `marginnote4app` 8 | ::: 9 | 10 | 通过 URL Scheme 来触发 MagicAction 中的动作,在 Mac 上可以设置快捷键打开 URL。 11 | 12 | 1. 打开 `marginnote3app://addon/ohmymn?type=card&shortcut=1` 就可以触发第一个卡片动作。 13 | 2. 打开 `marginnote3app://addon/ohmymn?type=text&shortcut=2` 就可以触发第二个文字动作。 14 | 15 | ## 自定义捷径 16 | 17 | 可以为每个动作以及任意输入值设置 URL,并将其设置成快捷键。甚至可以同时执行多个动作,通过选择的顺序来改变执行的顺序。 18 | 19 | ::: warning 捷径生成器 20 | 21 | ::: 22 | 23 | 24 | ## 使用快捷键打开 URL 25 | ### iPad 26 | 1. 点击安装快捷指令 https://www.icloud.com/shortcuts/d9027fc514f04fc4add78ae506baba8d 27 | 2. 设置-辅助功能-键盘-全键盘控制-命令-划到最下面就可以给快捷指令设置快捷键了。 28 | ### Mac 29 | 30 | Mac 上的工具就很多了,我通常是使用 Karabiner-Elements,这个还可以单独给 MarginNote 设置快捷键,免费。Raycast 也非常合适,甚至更加简单。 31 | 32 | ## 使用手势打开 URL 33 | 34 | iPad 上可以使用 [Gesture](gesture.md#自定义捷径) 模块来打开 URL,从而使用捷径的强大功能。 35 | 36 | ## 在工具栏上添加按钮打开 URL 37 | 38 | iPad 上同样可以使用 [Toolbar](toolbar.md) 模块的自定义捷径功能来打开 URL,从而使用捷径的强大功能。 -------------------------------------------------------------------------------- /packages/docs/guide/modules/toolbar.md: -------------------------------------------------------------------------------- 1 | # Toolbar 2 | 在点击卡片或者选择文字时添加动作工具栏。 3 | 4 | ![](https://testmnbbs.oss-cn-zhangjiakou.aliyuncs.com/pic/20230904120059.gif?x-oss-process=base_webp) 5 | 6 | ::: tip 更新 7 | [v4.3.1](/update.md) 新增。 8 | ::: -------------------------------------------------------------------------------- /packages/docs/guide/replace.md: -------------------------------------------------------------------------------- 1 | # Replace() 函数 2 | 3 | 为了使 OhMyMN 更加自由,更加强大,OhMyMN 中很多自定义都采用 [Replace()](https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/String/replace) 函数作为驱动。这使得你几乎可以对摘录进行任何处理,不过为了避免更多的导致插件崩溃的不确定因素,OhMyMN 限制了将函数作为参数,以及仅支持正则表达式。 4 | 5 | ## 替换 6 | 7 | [Replace()](https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/String/replace) 函数的作用其实就是将匹配到的内容替换为给的文字,然后返回替换后的所有内容。 8 | ::: tip 输入格式 9 | ```js 10 | (/regex/, "newSubStr") 11 | ``` 12 | ::: 13 | 14 | - `regex` 是 [正则表达式](regex),用来匹配需要替换的内容。 15 | - `newSubStr` 为普通字符串,需要使用双引号包裹,比如`"xxx"`,表示想要替换成的内容。 16 | 在 `newSubStr` 中,可以使用一些变量,来引用匹配到的内容: 17 | 18 | 1. `$&` 表示匹配的字符串。 19 | 2. `` $` `` 表示匹配的字符串前面的内容。 20 | 3. `$'` 表示匹配的字符串后面的内容。 21 | 4. `$n` 如果你在 `regex` 中使用了[捕获组](regex#分组),你就可以用 `$+数字` 来引用你捕获的内容。 22 | 5. 在 v4 版本中,某些情况下还可以使用模版变量,点击查看 [模版语法](mustache.md)。 23 | 24 | ## 提取 25 | 26 | OhMyMN 中所有的提取操作都是直接将 `newSubStr` 作为了返回值。相当于只要正则匹配到了就返回 `newSubStr`,而使用捕获组,还可以将其捕获并返回。能实现这个效果,其实还需要用到 [Match()](https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/String/match) 函数。当然,这个你不需要了解。只需要按照前面替换的语法一样使用即可,只是最后会返回 `newSubStr` 而不是整个字符串。 27 | -------------------------------------------------------------------------------- /packages/docs/guide/split.md: -------------------------------------------------------------------------------- 1 | # Split() 函数 2 | 3 | [Split()](https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/String/split) 函数目前只在 [Another AutoDef](modules/anotherautodef) 中使用,用于将摘录的内容分割成标题和摘录两部分。 4 | 5 | 只需要提供一个 [正则表达式](regex),作为分割点,将字符串分割成两部分。 6 | 7 | 这里要单独提一下是因为 split 有个特性,如果你正则表达式中使用了 [捕获组](regex#分组),就会把捕获的内容放在分割后的结果中,导致分成了三个部分。 如果你必须要分组,可以使用 [非捕获组](regex#分组)。 8 | 9 | 其实捕获组也有个好处,就是当你找不到一个明确的分割点,比如选择题,你想把题目作为标题,选项作为摘录。这时候就必须用到捕获组,并且捕获的内容就是所有选项。 10 | 11 | `[被定义项, 定义项]` ⇒ `[被定义项, 捕获组]` 12 | 13 | 另外,通过捕获组还可以对被定义项或者定义项进行限制。 14 | -------------------------------------------------------------------------------- /packages/docs/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: home 3 | sidebar: false 4 | 5 | title: OhMyMN 6 | titleTemplate: MarginNote 插件开发框架 7 | 8 | hero: 9 | name: OhMyMN 10 | text: MarginNote 插件开发框架 11 | tagline: 同时也是一个可以自动处理摘录的工具箱 12 | image: 13 | src: /logo-shadow.svg 14 | alt: ohmymn 15 | actions: 16 | - theme: brand 17 | text: 使用指南 18 | link: /guide/ 19 | - theme: alt 20 | text: 开发文档 21 | link: /dev/ 22 | - theme: alt 23 | text: API 文档 24 | link: /api/ 25 | - theme: alt 26 | text: 立即下载 27 | link: https://bbs.marginnote.cn/t/topic/20501 28 | - theme: alt 29 | text: 查看源码 30 | link: https://github.com/ourongxing/ohmymn 31 | --- 32 | 36 | 37 | -------------------------------------------------------------------------------- /packages/docs/modules.ts: -------------------------------------------------------------------------------- 1 | const modules = { 2 | required: [ 3 | ["OhMyMN", "ohmymn"], 4 | ["MagicAction for Card", "magicaction4card"], 5 | ["MagicAction for Text", "magicaction4text"] 6 | ], 7 | optional: [ 8 | ["Shortcut", "shortcut"], 9 | ["Gesture", "gesture"], 10 | ["Toolbar", "toolbar"], 11 | ["Another AutoTitle", "anotherautotitle"], 12 | ["Another AutoDef", "anotherautodef"], 13 | ["AutoFormat", "autoformat"], 14 | ["AutoComplete", "autocomplete"], 15 | ["AutoReplace", "autoreplace"], 16 | ["AutoList", "autolist"], 17 | ["AutoTag", "autotag"], 18 | ["AutoStyle", "autostyle"], 19 | ["CopySearch", "copysearch"], 20 | ["AutoTranslate", "autotranslate"], 21 | ["AutoOCR", "autoocr"], 22 | ["AutoComment", "autocomment"], 23 | ["AutoSimplify", "autosimplify"], 24 | ["AI", "ai"] 25 | ] 26 | } as { 27 | required: [string, string][] 28 | optional: [string, string][] 29 | } 30 | 31 | export default modules 32 | -------------------------------------------------------------------------------- /packages/docs/public/_headers: -------------------------------------------------------------------------------- 1 | / 2 | X-Frame-Options: DENY 3 | X-XSS-Protection: 1; mode=block 4 | 5 | /api/ 6 | X-Frame-Options: DENY 7 | X-XSS-Protection: 1; mode=block 8 | 9 | /config/ 10 | X-Frame-Options: DENY 11 | X-XSS-Protection: 1; mode=block 12 | 13 | /guide/ 14 | X-Frame-Options: DENY 15 | X-XSS-Protection: 1; mode=block 16 | 17 | /*.html 18 | X-Frame-Options: DENY 19 | X-XSS-Protection: 1; mode=block 20 | 21 | /* 22 | X-Content-Type-Options: nosniff 23 | Referrer-Policy: no-referrer 24 | Strict-Transport-Security: max-age=31536000; includeSubDomains 25 | 26 | /assets/* 27 | cache-control: max-age=31536000 28 | cache-control: immutable 29 | -------------------------------------------------------------------------------- /packages/docs/public/apple-touch-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ourongxing/ohmymn/b0bb5f16e20c9cb5e8d8d5c6d411eb39b8b10aac/packages/docs/public/apple-touch-icon.png -------------------------------------------------------------------------------- /packages/docs/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ourongxing/ohmymn/b0bb5f16e20c9cb5e8d8d5c6d411eb39b8b10aac/packages/docs/public/favicon.ico -------------------------------------------------------------------------------- /packages/docs/public/logo-shadow.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /packages/docs/public/logo.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /packages/docs/public/og-original.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ourongxing/ohmymn/b0bb5f16e20c9cb5e8d8d5c6d411eb39b8b10aac/packages/docs/public/og-original.jpg -------------------------------------------------------------------------------- /packages/docs/public/og.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ourongxing/ohmymn/b0bb5f16e20c9cb5e8d8d5c6d411eb39b8b10aac/packages/docs/public/og.jpg -------------------------------------------------------------------------------- /packages/docs/public/pwa-192x192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ourongxing/ohmymn/b0bb5f16e20c9cb5e8d8d5c6d411eb39b8b10aac/packages/docs/public/pwa-192x192.png -------------------------------------------------------------------------------- /packages/docs/public/pwa-512x512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ourongxing/ohmymn/b0bb5f16e20c9cb5e8d8d5c6d411eb39b8b10aac/packages/docs/public/pwa-512x512.png -------------------------------------------------------------------------------- /packages/docs/public/robots.txt: -------------------------------------------------------------------------------- 1 | User-agent: * 2 | Allow: / 3 | -------------------------------------------------------------------------------- /packages/docs/public/user-avatars/BryanHuang66.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ourongxing/ohmymn/b0bb5f16e20c9cb5e8d8d5c6d411eb39b8b10aac/packages/docs/public/user-avatars/BryanHuang66.png -------------------------------------------------------------------------------- /packages/docs/public/user-avatars/ourongxing.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ourongxing/ohmymn/b0bb5f16e20c9cb5e8d8d5c6d411eb39b8b10aac/packages/docs/public/user-avatars/ourongxing.png -------------------------------------------------------------------------------- /packages/docs/public/user-avatars/zzhirong.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ourongxing/ohmymn/b0bb5f16e20c9cb5e8d8d5c6d411eb39b8b10aac/packages/docs/public/user-avatars/zzhirong.png -------------------------------------------------------------------------------- /packages/docs/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "esnext", 4 | "target": "esnext", 5 | "lib": ["DOM", "ESNext"], 6 | "strict": true, 7 | "jsx": "preserve", 8 | "esModuleInterop": true, 9 | "skipLibCheck": true, 10 | "moduleResolution": "node", 11 | "resolveJsonModule": true, 12 | "noUnusedLocals": true, 13 | "strictNullChecks": true, 14 | "forceConsistentCasingInFileNames": true, 15 | "baseUrl": ".", 16 | "types": ["vite/client", "vite-plugin-pwa/client", "vitepress"], 17 | "paths": { 18 | "~/*": ["src/*"] 19 | } 20 | }, 21 | "include": ["./*.ts", "./.vitepress/**/*.ts", "./.vitepress/**/*.vue"], 22 | "exclude": ["dist", "node_modules"] 23 | } 24 | -------------------------------------------------------------------------------- /packages/export2anywhere/README.md: -------------------------------------------------------------------------------- 1 | ## Export To Anywhere —— a part of OhMyMN addon family 2 | 3 | ## Just waiting to update it to the latest version of ohmymn 4 | [old version](https://github.com/marginnoteapp/export2anywhere) 5 | ## License 6 | 7 | MIT 8 | -------------------------------------------------------------------------------- /packages/metadata/README.md: -------------------------------------------------------------------------------- 1 | ## Metadata —— a part of OhMyMN addon family 2 | 3 | ## Just waiting to update it to the latest version of ohmymn 4 | [old version](https://github.com/marginnoteapp/metadata) 5 | 6 | ## License 7 | 8 | MIT 9 | -------------------------------------------------------------------------------- /packages/ohmymn/assets/icon/QRCodeOCR.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ourongxing/ohmymn/b0bb5f16e20c9cb5e8d8d5c6d411eb39b8b10aac/packages/ohmymn/assets/icon/QRCodeOCR.png -------------------------------------------------------------------------------- /packages/ohmymn/assets/icon/addComment.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ourongxing/ohmymn/b0bb5f16e20c9cb5e8d8d5c6d411eb39b8b10aac/packages/ohmymn/assets/icon/addComment.png -------------------------------------------------------------------------------- /packages/ohmymn/assets/icon/addTag.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ourongxing/ohmymn/b0bb5f16e20c9cb5e8d8d5c6d411eb39b8b10aac/packages/ohmymn/assets/icon/addTag.png -------------------------------------------------------------------------------- /packages/ohmymn/assets/icon/aiActionPrompts.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ourongxing/ohmymn/b0bb5f16e20c9cb5e8d8d5c6d411eb39b8b10aac/packages/ohmymn/assets/icon/aiActionPrompts.png -------------------------------------------------------------------------------- /packages/ohmymn/assets/icon/aiActionPromptsText.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ourongxing/ohmymn/b0bb5f16e20c9cb5e8d8d5c6d411eb39b8b10aac/packages/ohmymn/assets/icon/aiActionPromptsText.png -------------------------------------------------------------------------------- /packages/ohmymn/assets/icon/answerWithCard.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ourongxing/ohmymn/b0bb5f16e20c9cb5e8d8d5c6d411eb39b8b10aac/packages/ohmymn/assets/icon/answerWithCard.png -------------------------------------------------------------------------------- /packages/ohmymn/assets/icon/changeColor.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ourongxing/ohmymn/b0bb5f16e20c9cb5e8d8d5c6d411eb39b8b10aac/packages/ohmymn/assets/icon/changeColor.png -------------------------------------------------------------------------------- /packages/ohmymn/assets/icon/changeStyle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ourongxing/ohmymn/b0bb5f16e20c9cb5e8d8d5c6d411eb39b8b10aac/packages/ohmymn/assets/icon/changeStyle.png -------------------------------------------------------------------------------- /packages/ohmymn/assets/icon/close.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ourongxing/ohmymn/b0bb5f16e20c9cb5e8d8d5c6d411eb39b8b10aac/packages/ohmymn/assets/icon/close.png -------------------------------------------------------------------------------- /packages/ohmymn/assets/icon/completeWord.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ourongxing/ohmymn/b0bb5f16e20c9cb5e8d8d5c6d411eb39b8b10aac/packages/ohmymn/assets/icon/completeWord.png -------------------------------------------------------------------------------- /packages/ohmymn/assets/icon/copyCardInfo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ourongxing/ohmymn/b0bb5f16e20c9cb5e8d8d5c6d411eb39b8b10aac/packages/ohmymn/assets/icon/copyCardInfo.png -------------------------------------------------------------------------------- /packages/ohmymn/assets/icon/copyText.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ourongxing/ohmymn/b0bb5f16e20c9cb5e8d8d5c6d411eb39b8b10aac/packages/ohmymn/assets/icon/copyText.png -------------------------------------------------------------------------------- /packages/ohmymn/assets/icon/customShortcut1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ourongxing/ohmymn/b0bb5f16e20c9cb5e8d8d5c6d411eb39b8b10aac/packages/ohmymn/assets/icon/customShortcut1.png -------------------------------------------------------------------------------- /packages/ohmymn/assets/icon/customShortcut2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ourongxing/ohmymn/b0bb5f16e20c9cb5e8d8d5c6d411eb39b8b10aac/packages/ohmymn/assets/icon/customShortcut2.png -------------------------------------------------------------------------------- /packages/ohmymn/assets/icon/customShortcut3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ourongxing/ohmymn/b0bb5f16e20c9cb5e8d8d5c6d411eb39b8b10aac/packages/ohmymn/assets/icon/customShortcut3.png -------------------------------------------------------------------------------- /packages/ohmymn/assets/icon/customShortcut4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ourongxing/ohmymn/b0bb5f16e20c9cb5e8d8d5c6d411eb39b8b10aac/packages/ohmymn/assets/icon/customShortcut4.png -------------------------------------------------------------------------------- /packages/ohmymn/assets/icon/customShortcut5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ourongxing/ohmymn/b0bb5f16e20c9cb5e8d8d5c6d411eb39b8b10aac/packages/ohmymn/assets/icon/customShortcut5.png -------------------------------------------------------------------------------- /packages/ohmymn/assets/icon/customShortcut6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ourongxing/ohmymn/b0bb5f16e20c9cb5e8d8d5c6d411eb39b8b10aac/packages/ohmymn/assets/icon/customShortcut6.png -------------------------------------------------------------------------------- /packages/ohmymn/assets/icon/customShortcut7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ourongxing/ohmymn/b0bb5f16e20c9cb5e8d8d5c6d411eb39b8b10aac/packages/ohmymn/assets/icon/customShortcut7.png -------------------------------------------------------------------------------- /packages/ohmymn/assets/icon/customShortcut8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ourongxing/ohmymn/b0bb5f16e20c9cb5e8d8d5c6d411eb39b8b10aac/packages/ohmymn/assets/icon/customShortcut8.png -------------------------------------------------------------------------------- /packages/ohmymn/assets/icon/extractTitle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ourongxing/ohmymn/b0bb5f16e20c9cb5e8d8d5c6d411eb39b8b10aac/packages/ohmymn/assets/icon/extractTitle.png -------------------------------------------------------------------------------- /packages/ohmymn/assets/icon/filterCard.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ourongxing/ohmymn/b0bb5f16e20c9cb5e8d8d5c6d411eb39b8b10aac/packages/ohmymn/assets/icon/filterCard.png -------------------------------------------------------------------------------- /packages/ohmymn/assets/icon/formatCard.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ourongxing/ohmymn/b0bb5f16e20c9cb5e8d8d5c6d411eb39b8b10aac/packages/ohmymn/assets/icon/formatCard.png -------------------------------------------------------------------------------- /packages/ohmymn/assets/icon/formulaOCR.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ourongxing/ohmymn/b0bb5f16e20c9cb5e8d8d5c6d411eb39b8b10aac/packages/ohmymn/assets/icon/formulaOCR.png -------------------------------------------------------------------------------- /packages/ohmymn/assets/icon/genWordCard.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ourongxing/ohmymn/b0bb5f16e20c9cb5e8d8d5c6d411eb39b8b10aac/packages/ohmymn/assets/icon/genWordCard.png -------------------------------------------------------------------------------- /packages/ohmymn/assets/icon/handWrittingOCR.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ourongxing/ohmymn/b0bb5f16e20c9cb5e8d8d5c6d411eb39b8b10aac/packages/ohmymn/assets/icon/handWrittingOCR.png -------------------------------------------------------------------------------- /packages/ohmymn/assets/icon/listCard.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ourongxing/ohmymn/b0bb5f16e20c9cb5e8d8d5c6d411eb39b8b10aac/packages/ohmymn/assets/icon/listCard.png -------------------------------------------------------------------------------- /packages/ohmymn/assets/icon/manageProfile.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ourongxing/ohmymn/b0bb5f16e20c9cb5e8d8d5c6d411eb39b8b10aac/packages/ohmymn/assets/icon/manageProfile.png -------------------------------------------------------------------------------- /packages/ohmymn/assets/icon/mergeCard.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ourongxing/ohmymn/b0bb5f16e20c9cb5e8d8d5c6d411eb39b8b10aac/packages/ohmymn/assets/icon/mergeCard.png -------------------------------------------------------------------------------- /packages/ohmymn/assets/icon/mergeText.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ourongxing/ohmymn/b0bb5f16e20c9cb5e8d8d5c6d411eb39b8b10aac/packages/ohmymn/assets/icon/mergeText.png -------------------------------------------------------------------------------- /packages/ohmymn/assets/icon/renameTitle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ourongxing/ohmymn/b0bb5f16e20c9cb5e8d8d5c6d411eb39b8b10aac/packages/ohmymn/assets/icon/renameTitle.png -------------------------------------------------------------------------------- /packages/ohmymn/assets/icon/replaceCard.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ourongxing/ohmymn/b0bb5f16e20c9cb5e8d8d5c6d411eb39b8b10aac/packages/ohmymn/assets/icon/replaceCard.png -------------------------------------------------------------------------------- /packages/ohmymn/assets/icon/searchCardInfo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ourongxing/ohmymn/b0bb5f16e20c9cb5e8d8d5c6d411eb39b8b10aac/packages/ohmymn/assets/icon/searchCardInfo.png -------------------------------------------------------------------------------- /packages/ohmymn/assets/icon/searchText.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ourongxing/ohmymn/b0bb5f16e20c9cb5e8d8d5c6d411eb39b8b10aac/packages/ohmymn/assets/icon/searchText.png -------------------------------------------------------------------------------- /packages/ohmymn/assets/icon/simplifyCard.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ourongxing/ohmymn/b0bb5f16e20c9cb5e8d8d5c6d411eb39b8b10aac/packages/ohmymn/assets/icon/simplifyCard.png -------------------------------------------------------------------------------- /packages/ohmymn/assets/icon/simplifyText.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ourongxing/ohmymn/b0bb5f16e20c9cb5e8d8d5c6d411eb39b8b10aac/packages/ohmymn/assets/icon/simplifyText.png -------------------------------------------------------------------------------- /packages/ohmymn/assets/icon/splitExcerpt.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ourongxing/ohmymn/b0bb5f16e20c9cb5e8d8d5c6d411eb39b8b10aac/packages/ohmymn/assets/icon/splitExcerpt.png -------------------------------------------------------------------------------- /packages/ohmymn/assets/icon/switchPanel.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ourongxing/ohmymn/b0bb5f16e20c9cb5e8d8d5c6d411eb39b8b10aac/packages/ohmymn/assets/icon/switchPanel.png -------------------------------------------------------------------------------- /packages/ohmymn/assets/icon/switchTitle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ourongxing/ohmymn/b0bb5f16e20c9cb5e8d8d5c6d411eb39b8b10aac/packages/ohmymn/assets/icon/switchTitle.png -------------------------------------------------------------------------------- /packages/ohmymn/assets/icon/textOCR.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ourongxing/ohmymn/b0bb5f16e20c9cb5e8d8d5c6d411eb39b8b10aac/packages/ohmymn/assets/icon/textOCR.png -------------------------------------------------------------------------------- /packages/ohmymn/assets/icon/translateCard.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ourongxing/ohmymn/b0bb5f16e20c9cb5e8d8d5c6d411eb39b8b10aac/packages/ohmymn/assets/icon/translateCard.png -------------------------------------------------------------------------------- /packages/ohmymn/assets/icon/translateText.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ourongxing/ohmymn/b0bb5f16e20c9cb5e8d8d5c6d411eb39b8b10aac/packages/ohmymn/assets/icon/translateText.png -------------------------------------------------------------------------------- /packages/ohmymn/assets/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ourongxing/ohmymn/b0bb5f16e20c9cb5e8d8d5c6d411eb39b8b10aac/packages/ohmymn/assets/logo.png -------------------------------------------------------------------------------- /packages/ohmymn/manifest.ts: -------------------------------------------------------------------------------- 1 | import { author, version } from "package.json" 2 | import { defineManifest } from "scripts/utils" 3 | 4 | export default defineManifest({ 5 | author, 6 | version, 7 | key: "ohmymn", 8 | title: "OhMyMN", 9 | minMarginNoteVersion: "3.7.21", 10 | profileKey: { 11 | global: "ohmymn_profile_global_v4", 12 | doc: "ohmymn_profile_doc_v4", 13 | notebook: "ohmymn_profile_notebook_v4" 14 | }, 15 | color: { 16 | border: "#8A95A2", 17 | button: "#8A95A2" 18 | }, 19 | github: "https://github.com/ourongxing/ohmymn", 20 | forumZH: "https://bbs.marginnote.cn/t/topic/20501", 21 | forum: "https://forum.marginnote.com/t/5883", 22 | docZH: "https://ohmymn.marginnote.cn", 23 | doc: "https://ohmymn.marginnote.cn/en", 24 | files: ["assets/logo.png", "assets/icon/", "assets/AutoSimplifyData.json"] 25 | }) 26 | -------------------------------------------------------------------------------- /packages/ohmymn/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ohmymn", 3 | "private": true, 4 | "author": "ourongxing", 5 | "version": "4.4.3", 6 | "license": "MIT", 7 | "description": "MarginNote toolbox that can process excerpts automatically", 8 | "scripts": { 9 | "dev": "tsx ./build.ts", 10 | "dev4": "MN=4 tsx ./build.ts", 11 | "build": "NODE_ENV=production pnpm dev", 12 | "build:iPad": "pnpm build && airdrop ./dist/*.mnaddon" 13 | }, 14 | "keywords": [ 15 | "marginote", 16 | "addon", 17 | "typescript" 18 | ], 19 | "dependencies": { 20 | "semver": "7.3.8", 21 | "marginnote": "workspace:^", 22 | "querystringify": "^2.2.0" 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /packages/ohmymn/scripts/updateVersion.ts: -------------------------------------------------------------------------------- 1 | import { existsSync } from "fs-extra" 2 | import { readFile, writeFile } from "fs-extra" 3 | import { version } from "../package.json" 4 | 5 | async function main() { 6 | if (existsSync("README.md")) { 7 | const content = await readFile("README.md", "utf8") 8 | await writeFile( 9 | "README.md", 10 | content.replace(/version-v.+?-yellow/, `version-v${version}-yellow`) 11 | ) 12 | } 13 | } 14 | 15 | main() 16 | -------------------------------------------------------------------------------- /packages/ohmymn/scripts/utils.ts: -------------------------------------------------------------------------------- 1 | export function defineManifest(manifest: Manifest) { 2 | return manifest 3 | } 4 | 5 | interface Manifest { 6 | /** 7 | * Unique identifier of the addon. Not need "marginnote.extension.". 8 | */ 9 | key: string 10 | author: string 11 | title: string 12 | version: string 13 | /** 14 | * Github repository url. 15 | */ 16 | github?: string 17 | /** 18 | * The minimum version of MarginNote that the addon supports. 19 | */ 20 | minMarginNoteVersion: string 21 | /** 22 | * Profile key, used to save addon settings. 23 | */ 24 | profileKey?: { 25 | global: string 26 | doc: string 27 | notebook: string 28 | } 29 | /** 30 | * Panel color 31 | */ 32 | color?: { 33 | border: string 34 | button: string 35 | } 36 | /** Chinese forum url */ 37 | forumZH?: string 38 | forum?: string 39 | docZH?: string 40 | doc?: string 41 | /** Files to be copied to the addon folder */ 42 | files?: string[] 43 | } 44 | -------------------------------------------------------------------------------- /packages/ohmymn/src/dataSource/lang.ts: -------------------------------------------------------------------------------- 1 | import { i18n } from "marginnote" 2 | 3 | export default i18n({ 4 | zh: { 5 | magicaction_from_which_module: (module: string) => 6 | `该动作来自于 ${module},与其使用相同的设置。`, 7 | open_panel: "切换控制面板", 8 | custom_shortcut: "自定义捷径", 9 | none: "无", 10 | expand: "▶ 点击展开所有选项", 11 | website: "官网及文档:ohmymn.marginnote.cn", 12 | intro: 13 | "OhMyMN 是一个可以自动处理摘录的工具箱,同时也是 MarginNote 插件开发框架。OhMyMN 完全开源,欢迎参与。" 14 | }, 15 | en: { 16 | magicaction_from_which_module: (module: string) => 17 | `This action comes from ${module} and uses the same settings. `, 18 | open_panel: "Switch Control Panel", 19 | none: "None", 20 | custom_shortcut: "Custom Shortcut", 21 | expand: "▶ Click to expand all options", 22 | website: "Website & Document: ohmymn.marginnote.cn/en", 23 | intro: 24 | "OhMyMN is a toolbox that can process excerpts automatically and also is MarginNote addon development framework. OhMyMN is completely open source, and welcome to join us." 25 | } 26 | }) 27 | -------------------------------------------------------------------------------- /packages/ohmymn/src/dataSource/more.ts: -------------------------------------------------------------------------------- 1 | import { Addon } from "~/addon" 2 | import { CellViewType, type ISection } from "~/typings" 3 | import lang from "./lang" 4 | 5 | export const more: ISection = { 6 | header: "More", 7 | key: "more", 8 | rows: [ 9 | { 10 | type: CellViewType.PlainText, 11 | label: lang.website, 12 | link: Addon.doc 13 | }, 14 | { 15 | type: CellViewType.PlainText, 16 | label: lang.intro, 17 | link: Addon.github 18 | }, 19 | { 20 | type: CellViewType.PlainText, 21 | label: "\n\n\n\n\n\n\n\n\n\n", 22 | link: "" 23 | } 24 | ] 25 | } 26 | -------------------------------------------------------------------------------- /packages/ohmymn/src/jsExtension/index.ts: -------------------------------------------------------------------------------- 1 | import { getObjCClassDeclar } from "marginnote" 2 | import { Addon } from "~/addon" 3 | import handleGestureEvent from "./handleGestureEvent" 4 | import handleReceivedEvent from "./handleReceivedEvent" 5 | import lifecycle from "./lifecycle" 6 | import switchPanel from "./switchPanel" 7 | import { onCloseButtonClick } from "./overlayView" 8 | import { onToolbarButtonClick } from "~/modules/toolbar/utils" 9 | 10 | export default JSB.defineClass( 11 | getObjCClassDeclar(Addon.title, "JSExtension"), 12 | { 13 | ...{ 14 | onCloseButtonClick, 15 | onToolbarButtonClick 16 | }, 17 | ...lifecycle.instanceMethods, 18 | ...switchPanel, 19 | ...handleGestureEvent, 20 | ...handleReceivedEvent 21 | }, 22 | lifecycle.classMethods 23 | ) 24 | -------------------------------------------------------------------------------- /packages/ohmymn/src/main.ts: -------------------------------------------------------------------------------- 1 | import { Addon } from "~/addon" 2 | import JSExtension from "./jsExtension" 3 | 4 | JSB.newAddon = path => { 5 | Addon.path = path 6 | return JSExtension 7 | } 8 | -------------------------------------------------------------------------------- /packages/ohmymn/src/modules/addon/typings.ts: -------------------------------------------------------------------------------- 1 | export const enum PanelPosition { 2 | "Document Inner Side", 3 | "Document MindMap Middle", 4 | "MindMap Inner Side", 5 | "Left", 6 | "Center", 7 | "Right", 8 | "Custom" 9 | } 10 | 11 | export const enum PanelHeight { 12 | Higher, 13 | Standard, 14 | Lower, 15 | Custom 16 | } 17 | 18 | export const enum PanelControl { 19 | DoubleClickOpen, 20 | DoubleClickClose, 21 | CompleteClose 22 | } 23 | 24 | export const enum DragMerge { 25 | NotGenTitle, 26 | Conditions, 27 | AlwaysTurnTitle 28 | } 29 | 30 | export const enum HasTitleThen { 31 | NotTurnTitle, 32 | MergeTitle, 33 | OverrideTitle 34 | } 35 | 36 | export const enum RemoveExcerpt { 37 | Now, 38 | Later 39 | } 40 | -------------------------------------------------------------------------------- /packages/ohmymn/src/modules/ai/typings.ts: -------------------------------------------------------------------------------- 1 | export interface ChatMessage { 2 | role: Role 3 | content: string 4 | } 5 | 6 | export interface Prompt { 7 | content: string 8 | desc: string 9 | options: { 10 | io?: AIActionIO[] 11 | temperature?: number 12 | model?: Model 13 | max_tokens?: number 14 | } 15 | } 16 | 17 | export type Role = "system" | "user" | "assistant" 18 | export type Model = "gpt-3.5-turbo" | "gpt-4o" 19 | 20 | export const enum AIActionIO { 21 | title2title, 22 | title2comment, 23 | excerpt2title, 24 | excerpt2comment, 25 | card2title, 26 | card2tag, 27 | card2comment, 28 | selected_text 29 | } 30 | -------------------------------------------------------------------------------- /packages/ohmymn/src/modules/anotherautodef/typings.ts: -------------------------------------------------------------------------------- 1 | export const enum AutoDefPreset { 2 | CustomExtract, 3 | CustomTitleSplit 4 | } 5 | 6 | export const enum TitleLinkSplit { 7 | Custom, 8 | Default, 9 | Punctuation 10 | } 11 | 12 | export const enum ExtractTitle { 13 | UseAutoDef 14 | } 15 | 16 | export const enum SplitExcerpt { 17 | UseAutoDef 18 | } 19 | -------------------------------------------------------------------------------- /packages/ohmymn/src/modules/anotherautotitle/typings.ts: -------------------------------------------------------------------------------- 1 | export const enum AutoTitlePreset { 2 | Custom, 3 | WordLimit, 4 | NoPunctuation 5 | } 6 | -------------------------------------------------------------------------------- /packages/ohmymn/src/modules/autocomment/lang.ts: -------------------------------------------------------------------------------- 1 | import { i18n } from "marginnote" 2 | import { doc } from "~/utils" 3 | 4 | export default i18n({ 5 | zh: { 6 | intro: "自动从摘录中提取评论或者在特定时候自动添加评论。", 7 | on: "摘录时自动执行", 8 | preset: { 9 | label: "选择需要的预设", 10 | $option: ["自定义"] as StringTuple<1> 11 | }, 12 | add_comment: { 13 | label: "添加评论", 14 | $option2: ["使用 AutoComment 的设置", "确定"] as StringTuple 15 | }, 16 | custom_comment: { 17 | help: "自定义,点击查看具体格式。", 18 | link: doc("autocomment") 19 | } 20 | }, 21 | en: { 22 | intro: 23 | "Automatically extract comments from excerpts or add comments at a specific time.", 24 | on: "Auto Run When Excerpting", 25 | preset: { 26 | label: "Select Presets", 27 | $option: ["Custom"] 28 | }, 29 | add_comment: { 30 | $option2: ["Use AutoComment Settings", "Confirm"], 31 | label: "Add Comment" 32 | }, 33 | custom_comment: { 34 | help: "Customize. Click for specific formats.", 35 | link: doc("autocomment") 36 | } 37 | } 38 | }) 39 | -------------------------------------------------------------------------------- /packages/ohmymn/src/modules/autocomment/typings.ts: -------------------------------------------------------------------------------- 1 | export const enum AutoCommentPreset { 2 | Custom, 3 | Time 4 | } 5 | 6 | export const enum AddComment { 7 | UseAutoComment 8 | } 9 | -------------------------------------------------------------------------------- /packages/ohmymn/src/modules/autocomplete/typings.ts: -------------------------------------------------------------------------------- 1 | export const enum FillWordInfo { 2 | None, 3 | Custom, 4 | Chinese 5 | } 6 | 7 | export interface Word { 8 | sw: string 9 | word: string 10 | translation?: string 11 | exchange?: string 12 | phonetic?: string 13 | definition?: string 14 | tag?: string 15 | // pos: "v:46/n:54" 16 | pos?: string 17 | collins?: number 18 | oxford?: number 19 | frq?: number 20 | bnc?: number 21 | } 22 | 23 | export interface Exchange { 24 | lemma?: string 25 | current?: string 26 | does?: string 27 | done?: string 28 | did?: string 29 | doing?: string 30 | s?: string 31 | er?: string 32 | est?: string 33 | } 34 | -------------------------------------------------------------------------------- /packages/ohmymn/src/modules/autoformat/typings.ts: -------------------------------------------------------------------------------- 1 | export const enum Format { 2 | TitlenExcerpt, 3 | Title, 4 | Excerpt 5 | } 6 | export const enum AutoFormatPreset { 7 | Custom, 8 | HalfToFull, 9 | AddSpace, 10 | RemoveCHSpace, 11 | RemoveRepeatSpace 12 | } 13 | -------------------------------------------------------------------------------- /packages/ohmymn/src/modules/autolist/typings.ts: -------------------------------------------------------------------------------- 1 | export const enum ListCard { 2 | UseAutoList 3 | } 4 | export const enum AutoListPreset { 5 | Custom, 6 | Letter 7 | } 8 | -------------------------------------------------------------------------------- /packages/ohmymn/src/modules/autoocr/typings.ts: -------------------------------------------------------------------------------- 1 | export interface BaiduOCRError { 2 | error_code: number 3 | error_msg: string 4 | } 5 | -------------------------------------------------------------------------------- /packages/ohmymn/src/modules/autoreplace/lang.ts: -------------------------------------------------------------------------------- 1 | import { i18n } from "marginnote" 2 | import { doc } from "~/utils" 3 | 4 | export default i18n({ 5 | zh: { 6 | intro: "自动替换摘录中的文字。", 7 | on: "摘录时自动执行", 8 | preset: { 9 | label: "选择需要的预设", 10 | $option1: ["自定义"] as StringTuple<1> 11 | }, 12 | replace_selected: { 13 | label: "替换摘录内容", 14 | $option2: ["使用 AutoReplace 的设置", "确定"] as StringTuple<2> 15 | }, 16 | custom_replace: { 17 | link: doc("autoreplace", "自定义"), 18 | help: "自定义,点击查看具体格式。" 19 | } 20 | }, 21 | en: { 22 | intro: "Automatically replace errors in excerpts. ", 23 | on: "Auto Run When Excerpting", 24 | preset: { 25 | label: "Select Presets", 26 | $option1: ["Custom"] 27 | }, 28 | replace_selected: { 29 | $option2: ["Use AutoReplace Settings", "Confirm"], 30 | label: "Replace Excerpt Text" 31 | }, 32 | custom_replace: { 33 | link: doc("autoreplace", "custom"), 34 | help: "Customize. Click for specific formats" 35 | } 36 | } 37 | }) 38 | -------------------------------------------------------------------------------- /packages/ohmymn/src/modules/autoreplace/typings.ts: -------------------------------------------------------------------------------- 1 | export const enum AutoReplacePreset { 2 | Custom 3 | } 4 | export const enum ReplaceCard { 5 | UseAutoReplace 6 | } 7 | -------------------------------------------------------------------------------- /packages/ohmymn/src/modules/autostyle/typings.ts: -------------------------------------------------------------------------------- 1 | export const enum AutoStylePreset { 2 | StyleByWordCountAndArea, 3 | ColorFollowCard, 4 | ColorFollowBrother, 5 | ColorFollowParents 6 | } 7 | export const enum ChangeStyle { 8 | UseAutoStyle 9 | } 10 | 11 | export const enum Style { 12 | "Wireframe+Fill", 13 | Fill, 14 | Wireframe 15 | } 16 | 17 | export enum ActionKey { 18 | changeColor, 19 | changeStyle 20 | } 21 | -------------------------------------------------------------------------------- /packages/ohmymn/src/modules/autotag/lang.ts: -------------------------------------------------------------------------------- 1 | import { i18n } from "marginnote" 2 | import { doc } from "~/utils" 3 | 4 | export default i18n({ 5 | zh: { 6 | intro: "自动从摘录中提取标签或者在特定时候自动添加标签。", 7 | link: doc("autotag"), 8 | on: "摘录时自动执行", 9 | preset: { 10 | label: "选择需要的预设", 11 | $option1: ["自定义"] as StringTuple<1> 12 | }, 13 | add_tag: { 14 | label: "添加标签", 15 | $option2: ["使用 AutoTag 的设置", "确定"] as StringTuple<2> 16 | }, 17 | custom_tag: { 18 | link: doc("autotag", "自定义"), 19 | help: "自定义,点击查看具体格式。" 20 | } 21 | }, 22 | en: { 23 | intro: 24 | "Extract tags from excerpts or add tags at specific times Automatically.", 25 | link: doc("autotag"), 26 | on: "Auto Run When Excerpting", 27 | preset: { 28 | label: "Select Presets", 29 | $option1: ["Custom"] 30 | }, 31 | add_tag: { 32 | label: "Add Tags", 33 | $option2: ["Use AutoTag Settings", "Confirm"] 34 | }, 35 | custom_tag: { 36 | link: doc("autotag", "custom"), 37 | help: "Customize. Click for specific formats" 38 | } 39 | } 40 | }) 41 | -------------------------------------------------------------------------------- /packages/ohmymn/src/modules/autotag/typings.ts: -------------------------------------------------------------------------------- 1 | export const enum AutoTagPreset { 2 | Custom 3 | } 4 | 5 | export const enum AddTag { 6 | UseAutoTag 7 | } 8 | -------------------------------------------------------------------------------- /packages/ohmymn/src/modules/autotranslate/typings.ts: -------------------------------------------------------------------------------- 1 | export const enum TranslateProviders { 2 | Baidu, 3 | Caiyun 4 | } 5 | -------------------------------------------------------------------------------- /packages/ohmymn/src/modules/copysearch/typings.ts: -------------------------------------------------------------------------------- 1 | export const enum MultipleTitlesExcerpt { 2 | Choose, 3 | All, 4 | First 5 | } 6 | 7 | export const enum CopySearchCardInfo { 8 | Title, 9 | Excerpt, 10 | Custom 11 | } 12 | 13 | export const enum WhichPartofCard { 14 | Choose, 15 | Title, 16 | Excerpt, 17 | Custom 18 | } 19 | 20 | export const enum SearchEngine { 21 | searchChineseText, 22 | searchEnglishText, 23 | searchWord, 24 | searchTranslation, 25 | searchAcademic, 26 | searchQuestion, 27 | searchOtherText 28 | } 29 | 30 | export enum ActionKey { 31 | searchCardInfo, 32 | copyCardInfo, 33 | searchText 34 | } 35 | -------------------------------------------------------------------------------- /packages/ohmymn/src/modules/magicaction4card/typings.ts: -------------------------------------------------------------------------------- 1 | export const enum FilterCards { 2 | All, 3 | Title, 4 | Excerpt, 5 | Comment, 6 | Tag 7 | } 8 | 9 | export const enum MergeCards { 10 | MergeTitle, 11 | NotMergeTitile 12 | } 13 | 14 | export const enum MergeText { 15 | ToExpertText, 16 | ToComment 17 | } 18 | 19 | export const enum SwitchTitle { 20 | ToNonexistent, 21 | Exchange 22 | } 23 | -------------------------------------------------------------------------------- /packages/ohmymn/src/modules/toolbar/lang.ts: -------------------------------------------------------------------------------- 1 | import { i18n } from "marginnote" 2 | 3 | export default i18n({ 4 | zh: { 5 | intro: "在点击卡片或者选中文字时显示动作工具栏。", 6 | card_toolbar: "卡片动作工具栏", 7 | action_not_work: "模块未启用,该动作无法执行", 8 | text_toolbar: "文字动作工具栏", 9 | only_mn: "仅支持 MarginNote 插件的 URL Scheme,但不限于 OhMyMN" 10 | }, 11 | en: { 12 | intro: "Show action toolbar when clicking card or selecting text.", 13 | card_toolbar: "Card Action Toolbar", 14 | text_toolbar: "Text Action Toolbar", 15 | only_mn: 16 | "Only support MarginNote addon's URL Scheme, but not limited to OhMyMN.", 17 | action_not_work: "Module is not enabled, the action cannot be executed" 18 | } 19 | }) 20 | -------------------------------------------------------------------------------- /packages/ohmymn/src/profile/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./utils" 2 | export * from "./updateDataSource" 3 | export * from "./default" 4 | export * from "./typings" 5 | export * from "./profileAction" 6 | export * from "./profileAuto" 7 | -------------------------------------------------------------------------------- /packages/ohmymn/src/settingViewController/index.ts: -------------------------------------------------------------------------------- 1 | import { getObjCClassDeclar } from "marginnote" 2 | import handleUserAction from "./handleUserAction" 3 | import lifecycle from "./lifecycle" 4 | import settingView from "./settingView" 5 | 6 | export default JSB.defineClass( 7 | getObjCClassDeclar("SettingViewController", "UITableViewController"), 8 | { 9 | ...lifecycle, 10 | ...settingView, 11 | ...handleUserAction 12 | } 13 | ) 14 | -------------------------------------------------------------------------------- /packages/ohmymn/src/settingViewController/lang.ts: -------------------------------------------------------------------------------- 1 | import { i18n } from "marginnote" 2 | 3 | export default i18n({ 4 | zh: { 5 | input_enter: "输入完按回车(Enter)保存", 6 | none: "无", 7 | expand: "▶ 点击展开所有选项", 8 | collapse: "▼ 点击收起所有选项", 9 | not_saved: "刚才的输入没有保存,请按回车(Enter)保存" 10 | }, 11 | en: { 12 | input_enter: "Press Enter to save", 13 | none: "None", 14 | not_saved: "The input just now was not saved, please press Enter to save", 15 | expand: "▶ Click to expand all options", 16 | collapse: "▼ Click to collapse all options" 17 | } 18 | }) 19 | -------------------------------------------------------------------------------- /packages/ohmymn/src/typings/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./Module" 2 | export * from "./DataSource" 3 | export * from "./AutoUtils" 4 | 5 | export const enum CellViewType { 6 | PlainText = 0, 7 | Switch = 1, 8 | Button = 2, 9 | ButtonWithInput = 3, 10 | Input = 4, 11 | InlineInput = 5, 12 | Select = 6, 13 | MuiltSelect = 7, 14 | Expland = 8 15 | } 16 | -------------------------------------------------------------------------------- /packages/ohmymn/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "noEmit": true, 4 | "module": "ESNext", 5 | "target": "ES2020", 6 | "allowJs": true, 7 | "sourceMap": false, 8 | "noImplicitAny": true, 9 | "downlevelIteration": true, 10 | "moduleResolution": "node", 11 | "allowSyntheticDefaultImports": true, 12 | "suppressImplicitAnyIndexErrors": true, 13 | "ignoreDeprecations": "5.0", 14 | "resolveJsonModule": true, 15 | "importHelpers": true, 16 | "strict": true, 17 | "baseUrl": ".", 18 | "paths": { 19 | "~/*": ["./src/*"] 20 | }, 21 | "lib": ["ES2020"] 22 | }, 23 | "include": ["src/**/*.ts", "src/utils/third party/*.js"] 24 | } 25 | -------------------------------------------------------------------------------- /packages/raycast/.gitignore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ourongxing/ohmymn/b0bb5f16e20c9cb5e8d8d5c6d411eb39b8b10aac/packages/raycast/.gitignore -------------------------------------------------------------------------------- /packages/raycast/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | ## [Initial Version] - 2022-11-11 -------------------------------------------------------------------------------- /packages/raycast/README-ZH.md: -------------------------------------------------------------------------------- 1 | # Raycast Extension of OhMyMN 2 | 3 | > [Quicklink 是什么](https://sspai.com/post/72951),其实就是一个 URL,OhMyMN 的 [捷径(Shortcuts)](https://ohmymn.marginnote.cn/guide/modules/shortcut.html)也是一个 URL。所以他们可以合作。 4 | 5 | 用于将 OhMyMN 的捷径(Shortcuts)设置为 Raycast 的 Quicklink,然后你就可以通过 Raycast 来管理和触发。 6 | 7 | [ [English](./README.md) ] 8 | ## Usage 9 | 10 | ### First of All 11 | 这里有两个选项 12 | 13 | 1. Action Name in Chinese:开启这个选项后,当你在 `Generate Custom Shortcuts` 里创建自定义捷径时,所有的动作都会显示为中文。并且在 `Find Custom Shortcuts` 时也只能找到其他人分享的中文自定义捷径。 14 | 2. User Name: 当你分享你的自定义捷径时,这个会用作你的用户名,别人也可以看到这个名称。 15 | 16 | ### Create Normal Shortcuts Quicklink 17 | 18 | 嗯,直接按 enter 就可以创建了。Quicklink 可以通过快捷键来触发。 19 | 20 | ### Generate Custom Shortcuts 21 | 22 | 用来创建自定义捷径,你可以选择最多 5 个动作,他们会在 OhMyMN 中按顺序执行,形成工作流。对于有输入的动作,你可以在创建时就输入,执行时就不会弹出输入框。建议为你输入的内容填写一个描述信息,这样当你分享出去的时候,可以方便别人理解。 23 | 24 | ### Find Custom Shortcuts 25 | ## License 26 | 27 | MIT -------------------------------------------------------------------------------- /packages/raycast/README.md: -------------------------------------------------------------------------------- 1 | # Raycast Extension of OhMyMN 2 | 3 | Used to create custom shortcuts of OhMyMN and set the shortcut to the quicklink of Raycast. 4 | 5 | [ [简体中文](./README-ZH.md) ] 6 | ## Usage 7 | ### First of All 8 | There are two options to set it up 9 | 10 | 1. Action Name in Chinese: All of actions of OhMyMN will be shown in Chinese when you generating the custom shortcuts. And you can only find Chinese custom shortcuts shared by others. 11 | 2. User Name: It will be used when you share custom shortcuts. 12 | ### Create Normal Shortcuts Quicklink 13 | 14 | Yeah, just click enter to create. 15 | 16 | ### Generate Custom Shortcuts 17 | ### Find Custom Shortcuts 18 | Restart MarginNote quickly. It's helpful when you develop mnaddon. 19 | ## License 20 | 21 | MIT -------------------------------------------------------------------------------- /packages/raycast/assets/icon/QRCodeOCR.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ourongxing/ohmymn/b0bb5f16e20c9cb5e8d8d5c6d411eb39b8b10aac/packages/raycast/assets/icon/QRCodeOCR.png -------------------------------------------------------------------------------- /packages/raycast/assets/icon/addComment.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ourongxing/ohmymn/b0bb5f16e20c9cb5e8d8d5c6d411eb39b8b10aac/packages/raycast/assets/icon/addComment.png -------------------------------------------------------------------------------- /packages/raycast/assets/icon/addTag.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ourongxing/ohmymn/b0bb5f16e20c9cb5e8d8d5c6d411eb39b8b10aac/packages/raycast/assets/icon/addTag.png -------------------------------------------------------------------------------- /packages/raycast/assets/icon/changeColor.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ourongxing/ohmymn/b0bb5f16e20c9cb5e8d8d5c6d411eb39b8b10aac/packages/raycast/assets/icon/changeColor.png -------------------------------------------------------------------------------- /packages/raycast/assets/icon/changeStyle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ourongxing/ohmymn/b0bb5f16e20c9cb5e8d8d5c6d411eb39b8b10aac/packages/raycast/assets/icon/changeStyle.png -------------------------------------------------------------------------------- /packages/raycast/assets/icon/completeWord.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ourongxing/ohmymn/b0bb5f16e20c9cb5e8d8d5c6d411eb39b8b10aac/packages/raycast/assets/icon/completeWord.png -------------------------------------------------------------------------------- /packages/raycast/assets/icon/copyCardInfo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ourongxing/ohmymn/b0bb5f16e20c9cb5e8d8d5c6d411eb39b8b10aac/packages/raycast/assets/icon/copyCardInfo.png -------------------------------------------------------------------------------- /packages/raycast/assets/icon/copyText.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ourongxing/ohmymn/b0bb5f16e20c9cb5e8d8d5c6d411eb39b8b10aac/packages/raycast/assets/icon/copyText.png -------------------------------------------------------------------------------- /packages/raycast/assets/icon/extractTitle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ourongxing/ohmymn/b0bb5f16e20c9cb5e8d8d5c6d411eb39b8b10aac/packages/raycast/assets/icon/extractTitle.png -------------------------------------------------------------------------------- /packages/raycast/assets/icon/filterCard.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ourongxing/ohmymn/b0bb5f16e20c9cb5e8d8d5c6d411eb39b8b10aac/packages/raycast/assets/icon/filterCard.png -------------------------------------------------------------------------------- /packages/raycast/assets/icon/formatCard.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ourongxing/ohmymn/b0bb5f16e20c9cb5e8d8d5c6d411eb39b8b10aac/packages/raycast/assets/icon/formatCard.png -------------------------------------------------------------------------------- /packages/raycast/assets/icon/formulaOCR.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ourongxing/ohmymn/b0bb5f16e20c9cb5e8d8d5c6d411eb39b8b10aac/packages/raycast/assets/icon/formulaOCR.png -------------------------------------------------------------------------------- /packages/raycast/assets/icon/handWrittingOCR.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ourongxing/ohmymn/b0bb5f16e20c9cb5e8d8d5c6d411eb39b8b10aac/packages/raycast/assets/icon/handWrittingOCR.png -------------------------------------------------------------------------------- /packages/raycast/assets/icon/listCard.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ourongxing/ohmymn/b0bb5f16e20c9cb5e8d8d5c6d411eb39b8b10aac/packages/raycast/assets/icon/listCard.png -------------------------------------------------------------------------------- /packages/raycast/assets/icon/manageProfile.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ourongxing/ohmymn/b0bb5f16e20c9cb5e8d8d5c6d411eb39b8b10aac/packages/raycast/assets/icon/manageProfile.png -------------------------------------------------------------------------------- /packages/raycast/assets/icon/mergeCard.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ourongxing/ohmymn/b0bb5f16e20c9cb5e8d8d5c6d411eb39b8b10aac/packages/raycast/assets/icon/mergeCard.png -------------------------------------------------------------------------------- /packages/raycast/assets/icon/mergeText.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ourongxing/ohmymn/b0bb5f16e20c9cb5e8d8d5c6d411eb39b8b10aac/packages/raycast/assets/icon/mergeText.png -------------------------------------------------------------------------------- /packages/raycast/assets/icon/renameTitle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ourongxing/ohmymn/b0bb5f16e20c9cb5e8d8d5c6d411eb39b8b10aac/packages/raycast/assets/icon/renameTitle.png -------------------------------------------------------------------------------- /packages/raycast/assets/icon/replaceCard.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ourongxing/ohmymn/b0bb5f16e20c9cb5e8d8d5c6d411eb39b8b10aac/packages/raycast/assets/icon/replaceCard.png -------------------------------------------------------------------------------- /packages/raycast/assets/icon/searchCardInfo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ourongxing/ohmymn/b0bb5f16e20c9cb5e8d8d5c6d411eb39b8b10aac/packages/raycast/assets/icon/searchCardInfo.png -------------------------------------------------------------------------------- /packages/raycast/assets/icon/searchText.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ourongxing/ohmymn/b0bb5f16e20c9cb5e8d8d5c6d411eb39b8b10aac/packages/raycast/assets/icon/searchText.png -------------------------------------------------------------------------------- /packages/raycast/assets/icon/simplifyCard.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ourongxing/ohmymn/b0bb5f16e20c9cb5e8d8d5c6d411eb39b8b10aac/packages/raycast/assets/icon/simplifyCard.png -------------------------------------------------------------------------------- /packages/raycast/assets/icon/simplifyText.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ourongxing/ohmymn/b0bb5f16e20c9cb5e8d8d5c6d411eb39b8b10aac/packages/raycast/assets/icon/simplifyText.png -------------------------------------------------------------------------------- /packages/raycast/assets/icon/splitExcerpt.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ourongxing/ohmymn/b0bb5f16e20c9cb5e8d8d5c6d411eb39b8b10aac/packages/raycast/assets/icon/splitExcerpt.png -------------------------------------------------------------------------------- /packages/raycast/assets/icon/switchTitle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ourongxing/ohmymn/b0bb5f16e20c9cb5e8d8d5c6d411eb39b8b10aac/packages/raycast/assets/icon/switchTitle.png -------------------------------------------------------------------------------- /packages/raycast/assets/icon/textOCR.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ourongxing/ohmymn/b0bb5f16e20c9cb5e8d8d5c6d411eb39b8b10aac/packages/raycast/assets/icon/textOCR.png -------------------------------------------------------------------------------- /packages/raycast/assets/icon/translateCard.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ourongxing/ohmymn/b0bb5f16e20c9cb5e8d8d5c6d411eb39b8b10aac/packages/raycast/assets/icon/translateCard.png -------------------------------------------------------------------------------- /packages/raycast/assets/icon/translateText.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ourongxing/ohmymn/b0bb5f16e20c9cb5e8d8d5c6d411eb39b8b10aac/packages/raycast/assets/icon/translateText.png -------------------------------------------------------------------------------- /packages/raycast/assets/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ourongxing/ohmymn/b0bb5f16e20c9cb5e8d8d5c6d411eb39b8b10aac/packages/raycast/assets/logo.png -------------------------------------------------------------------------------- /packages/raycast/metadata/marginnote-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ourongxing/ohmymn/b0bb5f16e20c9cb5e8d8d5c6d411eb39b8b10aac/packages/raycast/metadata/marginnote-1.png -------------------------------------------------------------------------------- /packages/raycast/metadata/marginnote-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ourongxing/ohmymn/b0bb5f16e20c9cb5e8d8d5c6d411eb39b8b10aac/packages/raycast/metadata/marginnote-2.png -------------------------------------------------------------------------------- /packages/raycast/src/hooks/index.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ourongxing/ohmymn/b0bb5f16e20c9cb5e8d8d5c6d411eb39b8b10aac/packages/raycast/src/hooks/index.ts -------------------------------------------------------------------------------- /packages/raycast/src/utils/applescript.ts: -------------------------------------------------------------------------------- 1 | import { open } from "@raycast/api" 2 | import { runAppleScript } from "run-applescript" 3 | 4 | export async function isRunning(appName: string) { 5 | try { 6 | const script = ` 7 | tell application "System Events" 8 | return (name of processes contains "${appName}") 9 | end tell 10 | ` 11 | return (await runAppleScript(script)) === "true" 12 | } catch (err) { 13 | console.log(err) 14 | return false 15 | } 16 | } 17 | 18 | export async function openShortCut(url: string) { 19 | open(url) 20 | } 21 | -------------------------------------------------------------------------------- /packages/raycast/src/utils/date.ts: -------------------------------------------------------------------------------- 1 | export function getRealUTCDate(num: number) { 2 | return new Date((num + 978307200) * 1000) 3 | } 4 | 5 | export function getLocalDate(date: Date) { 6 | return new Date(date.getTime() - new Date().getTimezoneOffset() * 60 * 1000) 7 | } 8 | 9 | export function getLocalDateFromDB(num: number) { 10 | return new Date( 11 | (num + 978307200) * 1000 - new Date().getTimezoneOffset() * 60 * 1000 12 | ) 13 | } 14 | 15 | export function dateFormat(date: Date, fmt = "YYYY-mm-dd HH:MM") { 16 | let ret 17 | const opt = { 18 | "Y+": date.getFullYear().toString(), 19 | "m+": (date.getMonth() + 1).toString(), 20 | "d+": date.getDate().toString(), 21 | "H+": date.getHours().toString(), 22 | "M+": date.getMinutes().toString(), 23 | "S+": date.getSeconds().toString() // second 24 | } 25 | Object.entries(opt).forEach(([k, v]) => { 26 | ret = new RegExp("(" + k + ")").exec(fmt) 27 | if (ret) { 28 | fmt = fmt.replace( 29 | ret[1], 30 | ret[1].length == 1 ? v : v.padStart(ret[1].length, "0") 31 | ) 32 | } 33 | }) 34 | return fmt 35 | } 36 | -------------------------------------------------------------------------------- /packages/raycast/src/utils/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./date" 2 | export * from "./applescript" 3 | export * from "./raycast" 4 | 5 | export function escape(str: string) { 6 | return str.replace(/[\\"]/g, "\\$&") 7 | } 8 | 9 | export const unique = (arr: T[]): T[] => Array.from(new Set(arr)) 10 | export const deepCopy = (value: T): T => JSON.parse(JSON.stringify(value)) 11 | -------------------------------------------------------------------------------- /packages/raycast/src/utils/raycast.ts: -------------------------------------------------------------------------------- 1 | import { trash, showToast } from "@raycast/api" 2 | import { PathLike } from "fs-extra" 3 | -------------------------------------------------------------------------------- /packages/raycast/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json.schemastore.org/tsconfig", 3 | "display": "Node 16", 4 | "include": [ 5 | "src/**/*" 6 | ], 7 | "compilerOptions": { 8 | "lib": [ 9 | "es2020" 10 | ], 11 | "module": "commonjs", 12 | "target": "es2020", 13 | "strict": true, 14 | "isolatedModules": false, 15 | "esModuleInterop": true, 16 | "skipLibCheck": true, 17 | "forceConsistentCasingInFileNames": true, 18 | "jsx": "react-jsx" 19 | } 20 | } -------------------------------------------------------------------------------- /pnpm-workspace.yaml: -------------------------------------------------------------------------------- 1 | packages: 2 | - "packages/**" 3 | --------------------------------------------------------------------------------