├── .github └── FUNDING.yml ├── .gitignore ├── LICENSE ├── README.md ├── google.png ├── icon.png ├── info.plist ├── livewire.php └── screenshot.png /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | github: [tillkruss, alexmartinfr] 2 | custom: ["https://www.paypal.me/tillkruss", "https://www.paypal.me/alexmartin"] 3 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /vendor 2 | .DS_Store 3 | composer.lock 4 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2016 Till Krüss 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. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Laravel Livewire docs search workflow for Alfred 2 | 3 | An ultra-fast Laravel Livewire docs search workflow for [Alfred](https://www.alfredapp.com). 4 | 5 | ![Screenshot](screenshot.png) 6 | 7 | 8 | ## Installation 9 | 10 | 1. [Download the latest version](https://github.com/AlexMartinFR/alfred-livewire-docs/releases/download/v0.1.2/livewire-docs.alfredworkflow) 11 | 2. Install the workflow by double-clicking the `.alfredworkflow` file 12 | 3. You can add the workflow to a category, then click "Import" to finish importing. You'll now see the workflow listed in the left sidebar of your Workflows preferences pane. 13 | 14 | 15 | ## Usage 16 | 17 | Just type `lw` followed by your search query: 18 | 19 | ``` 20 | lw 21 | lw component 22 | ``` 23 | 24 | Either press `⌘Y` to Quick Look the result, or press `` to open it in your web browser. 25 | 26 | 27 | ## Versions 28 | 29 | Edit the workflow environment variable to query the documentation for a different Livewire version. 30 | 31 | Currently available versions: 32 | 33 | - 1.x 34 | - 2.x 35 | 36 | 37 | ## Credits 38 | 39 | This workflow is based on Till Kruss' [Laravel Docs workflow](https://github.com/tillkruss/alfred-laravel-docs). 40 | -------------------------------------------------------------------------------- /google.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexmartinfr/alfred-livewire-docs/38ac90cf9328d5f4f3c7ee05f687b24a030e5d3e/google.png -------------------------------------------------------------------------------- /icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexmartinfr/alfred-livewire-docs/38ac90cf9328d5f4f3c7ee05f687b24a030e5d3e/icon.png -------------------------------------------------------------------------------- /info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | bundleid 6 | com.alexmartinfr.alfred-livewire-docs 7 | connections 8 | 9 | 1B63F30F-2C4C-42EB-87EE-0E39722DFCA6 10 | 11 | 12 | destinationuid 13 | 1B9170F0-DEE3-411E-9471-FA00A0A5098F 14 | modifiers 15 | 0 16 | modifiersubtext 17 | 18 | vitoclose 19 | 20 | 21 | 22 | 23 | createdby 24 | Alex Martin 25 | description 26 | An ultra-fast Livewire docs search workflow 27 | disabled 28 | 29 | name 30 | Livewire Docs 31 | objects 32 | 33 | 34 | config 35 | 36 | browser 37 | 38 | spaces 39 | 40 | url 41 | {query} 42 | utf8 43 | 44 | 45 | type 46 | alfred.workflow.action.openurl 47 | uid 48 | 1B9170F0-DEE3-411E-9471-FA00A0A5098F 49 | version 50 | 1 51 | 52 | 53 | config 54 | 55 | alfredfiltersresults 56 | 57 | alfredfiltersresultsmatchmode 58 | 0 59 | argumenttreatemptyqueryasnil 60 | 61 | argumenttrimmode 62 | 0 63 | argumenttype 64 | 0 65 | escaping 66 | 4 67 | keyword 68 | lw 69 | queuedelaycustom 70 | 3 71 | queuedelayimmediatelyinitially 72 | 73 | queuedelaymode 74 | 0 75 | queuemode 76 | 1 77 | runningsubtext 78 | Searching docs for "{query}"... 79 | script 80 | if [ -f "/opt/homebrew/bin/php" ]; then 81 | /opt/homebrew/bin/php livewire.php "{query}" 82 | elif [ -f "/usr/local/bin/php" ]; then 83 | /usr/local/bin/php livewire.php "{query}" 84 | elif [ -f "/usr/bin/php" ]; then 85 | /usr/bin/php livewire.php "{query}" 86 | fi 87 | scriptargtype 88 | 0 89 | scriptfile 90 | 91 | subtext 92 | Search the Livewire docs... 93 | title 94 | Livewire Docs 95 | type 96 | 0 97 | withspace 98 | 99 | 100 | type 101 | alfred.workflow.input.scriptfilter 102 | uid 103 | 1B63F30F-2C4C-42EB-87EE-0E39722DFCA6 104 | version 105 | 3 106 | 107 | 108 | readme 109 | # Laravel Livewire Docs Workflow for Alfred 110 | 111 | An ultra-fast Laravel Livewire docs search workflow for Alfred. 112 | 113 | 114 | ## Installation 115 | 116 | 1. Download the latest version of the workflow: 117 | https://github.com/AlexMartinFR/alfred-livewire-docs/releases/download/v0.1.2/livewire-docs.alfredworkflow 118 | 119 | 2. Install the workflow by double-clicking the `.alfredworkflow` file 120 | 121 | 3. You can add the workflow to a category, then click "Import" to finish importing. You'll now see the workflow listed in the left sidebar of your Workflows preferences pane. 122 | 123 | 124 | ## Usage 125 | 126 | Just type `lw` followed by your search query: 127 | 128 | ``` 129 | lw <query> 130 | lw component 131 | ``` 132 | 133 | Either press `⌘Y` to Quick Look the result, or press `<enter>` to open it in your web browser. 134 | 135 | 136 | ## Versions 137 | 138 | Edit the workflow environment variable to query the documentation for a different Livewire version. 139 | 140 | Currently available versions: 141 | 142 | 1.x 143 | 2.x 144 | 145 | 146 | ## Credits 147 | 148 | This workflow is based on Till Kruss' Laravel Docs workflow: 149 | https://github.com/tillkruss/alfred-laravel-docs 150 | uidata 151 | 152 | 1B63F30F-2C4C-42EB-87EE-0E39722DFCA6 153 | 154 | xpos 155 | 225 156 | ypos 157 | 150 158 | 159 | 1B9170F0-DEE3-411E-9471-FA00A0A5098F 160 | 161 | xpos 162 | 535 163 | ypos 164 | 150 165 | 166 | 167 | variables 168 | 169 | branch 170 | 2.x 171 | 172 | variablesdontexport 173 | 174 | version 175 | 0.1.3 176 | webaddress 177 | https://github.com/AlexMartinFR/alfred-livewire-docs/ 178 | 179 | 180 | -------------------------------------------------------------------------------- /livewire.php: -------------------------------------------------------------------------------- 1 | initIndex('livewire-framework'); 18 | $search = $index->search($query, ['facetFilters' => [ 19 | sprintf('version:%s', $branch ?: '2.x'), 20 | ]]); 21 | $results = $search['hits']; 22 | 23 | $subtextSupported = $subtext === '0' || $subtext === '2'; 24 | 25 | if (empty($results)) { 26 | $google = sprintf('https://www.google.com/search?q=%s', rawurlencode("laravel livewire {$query}")); 27 | 28 | $workflow->result() 29 | ->title($subtextSupported ? 'Search Google' : 'No match found. Search Google...') 30 | ->icon('google.png') 31 | ->subtitle(sprintf('No match found. Search Google for: "%s"', $query)) 32 | ->arg($google) 33 | ->quicklookurl($google) 34 | ->valid(true); 35 | 36 | $workflow->result() 37 | ->title($subtextSupported ? 'Open Docs' : 'No match found. Open docs...') 38 | ->icon('icon.png') 39 | ->subtitle('No match found. Open https://laravel-livewire.com/docs/...') 40 | ->arg('https://laravel-livewire.com/docs/') 41 | ->quicklookurl('https://laravel-livewire.com/docs/') 42 | ->valid(true); 43 | 44 | echo $workflow->output(); 45 | exit; 46 | } 47 | 48 | $urls = []; 49 | 50 | foreach ($results as $hit) { 51 | 52 | $highestLvl = $hit['hierarchy']['lvl6'] ? 6 : ($hit['hierarchy']['lvl5'] ? 5 : ($hit['hierarchy']['lvl4'] ? 4 : ($hit['hierarchy']['lvl3'] ? 3 : ($hit['hierarchy']['lvl2'] ? 2 : ($hit['hierarchy']['lvl1'] ? 1 : 0))))); 53 | 54 | $title = $hit['hierarchy']['lvl' . $highestLvl]; 55 | $currentLvl = 0; 56 | $subtitle = $hit['hierarchy']['lvl0']; 57 | while ($currentLvl < $highestLvl) { 58 | $currentLvl = $currentLvl + 1; 59 | $subtitle = $subtitle . ' » ' . $hit['hierarchy']['lvl' . $currentLvl]; 60 | } 61 | 62 | $workflow->result() 63 | ->uid($hit['objectID']) 64 | ->title($title) 65 | ->autocomplete($title) 66 | ->subtitle($subtitle) 67 | ->arg($hit['url']) 68 | ->quicklookurl($hit['url']) 69 | ->valid(true); 70 | } 71 | 72 | echo $workflow->output(); 73 | 74 | /* 75 | ############### 76 | ##########ENJOY!########### 77 | ################################### 78 | ################@@@@@@(################## 79 | ############(@@@@@@@@@@@@@@@@###############( 80 | ############@@@@ .@@@@@@@@@@@&#############(# 81 | ###########%@@@ .@@@@* @@@@@@@@@@@#############(( 82 | (###########@@@@# ,@@@@# @@@@@@@@@@@@#############((. 83 | ############@@@@@ @@@@@@@@@@@@@############((( 84 | ############@@@@@@@@ @@@@@@@@@@@@@@@(############((( 85 | #############@@@@@@@@@@@@@@@@@@@@@@@@@@@@@(############(((* 86 | ##############@@@@@@@@@@@@@@@@@@@@@@@@@@@@#############(((( 87 | ###############@@@@@@@@@@@@@@@@@@@@@@@@@@##############(((( 88 | ################@@@@@@@@@@@@@@@@@@@@@@@@###############(((( 89 | (#################@@@@@@@@@@@@@@@@@@@(################((((* 90 | #######################(#&&&%########################(((( 91 | ###################################################(((( 92 | .#########,,,,.##########,,,,*#########(,,,,/#####(((( 93 | ######,,*******######,,******#######,,******##((((( 94 | ,******** ,********. ,******* 95 | ********* *********. ******** 96 | ********* *********. ******** 97 | ******* *********. ******** 98 | *********. ******** 99 | *********. 100 | ********* 101 | ***** 102 | */ 103 | -------------------------------------------------------------------------------- /screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexmartinfr/alfred-livewire-docs/38ac90cf9328d5f4f3c7ee05f687b24a030e5d3e/screenshot.png --------------------------------------------------------------------------------