|
| 1 | +--- |
| 2 | +layout: doc |
| 3 | +--- |
| 4 | + |
| 5 | +<script setup lang="ts"> |
| 6 | +import { ref, computed } from 'vue'; |
| 7 | +import VPLink from 'vitepress/dist/client/theme-default/components/VPLink.vue'; |
| 8 | +import { open, showAll, showToday, showStarred, showScheduled, showList, search, addNewTask, add, paste, getTaskID } from 'protocol-launcher/2do'; |
| 9 | +import { SelectInstallationMethod } from '../../.vitepress/components'; |
| 10 | +import { |
| 11 | + showListParams, |
| 12 | + searchParams, |
| 13 | + searchOverdueParams, |
| 14 | + addNewTaskParams, |
| 15 | + addTaskParams, |
| 16 | + addTaskWithPriorityParams, |
| 17 | + addTaskWithTagsParams, |
| 18 | + addTaskWithProjectParams, |
| 19 | + pasteParams, |
| 20 | + getTaskIDParams, |
| 21 | +} from '../../.vitepress/constants/2do'; |
| 22 | + |
| 23 | +const currentMethod = ref('On-Demand'); |
| 24 | +const importPath = computed(() => currentMethod.value === 'On-Demand' ? 'protocol-launcher/2do' : 'protocol-launcher'); |
| 25 | +</script> |
| 26 | + |
| 27 | +# 2Do |
| 28 | + |
| 29 | +[2Do](https://www.2doapp.com/) is a powerful personal task manager that supports GTD methodology and more. **Protocol Launcher** allows you to generate deep links to create tasks, search, and navigate lists in 2Do. |
| 30 | + |
| 31 | +## Usage |
| 32 | + |
| 33 | +There are two ways to use this library: |
| 34 | + |
| 35 | +- On-Demand import from subpaths enables tree-shaking and keeps bundles small. |
| 36 | +- Full Import from the root package is convenient but includes all app modules. |
| 37 | + |
| 38 | +Pick On-Demand for production builds; Full Import is fine for quick scripts or demos. |
| 39 | + |
| 40 | +<SelectInstallationMethod v-model="currentMethod" /> |
| 41 | + |
| 42 | +### Open App |
| 43 | + |
| 44 | +```ts-vue [{{currentMethod}}] |
| 45 | +import { {{ currentMethod === 'On-Demand' ? 'open' : 'twoDo' }} } from '{{ importPath }}' |
| 46 | +
|
| 47 | +const url = {{currentMethod === 'On-Demand' ? '' : 'twoDo.'}}open() |
| 48 | +``` |
| 49 | + |
| 50 | +<div class="flex justify-center"> |
| 51 | + <VPLink :href="open()" target="_self"> |
| 52 | + Open 2Do |
| 53 | + </VPLink> |
| 54 | +</div> |
| 55 | + |
| 56 | +### Show All Tasks |
| 57 | + |
| 58 | +```ts-vue [{{currentMethod}}] |
| 59 | +import { {{ currentMethod === 'On-Demand' ? 'showAll' : 'twoDo' }} } from '{{ importPath }}' |
| 60 | +
|
| 61 | +const url = {{currentMethod === 'On-Demand' ? '' : 'twoDo.'}}showAll() |
| 62 | +``` |
| 63 | + |
| 64 | +<div class="flex justify-center"> |
| 65 | + <VPLink :href="showAll()" target="_self"> |
| 66 | + Show All Tasks |
| 67 | + </VPLink> |
| 68 | +</div> |
| 69 | + |
| 70 | +### Show Today Tasks |
| 71 | + |
| 72 | +```ts-vue [{{currentMethod}}] |
| 73 | +import { {{ currentMethod === 'On-Demand' ? 'showToday' : 'twoDo' }} } from '{{ importPath }}' |
| 74 | +
|
| 75 | +const url = {{currentMethod === 'On-Demand' ? '' : 'twoDo.'}}showToday() |
| 76 | +``` |
| 77 | + |
| 78 | +<div class="flex justify-center"> |
| 79 | + <VPLink :href="showToday()" target="_self"> |
| 80 | + Show Today Tasks |
| 81 | + </VPLink> |
| 82 | +</div> |
| 83 | + |
| 84 | +### Show Starred Tasks |
| 85 | + |
| 86 | +```ts-vue [{{currentMethod}}] |
| 87 | +import { {{ currentMethod === 'On-Demand' ? 'showStarred' : 'twoDo' }} } from '{{ importPath }}' |
| 88 | +
|
| 89 | +const url = {{currentMethod === 'On-Demand' ? '' : 'twoDo.'}}showStarred() |
| 90 | +``` |
| 91 | + |
| 92 | +<div class="flex justify-center"> |
| 93 | + <VPLink :href="showStarred()" target="_self"> |
| 94 | + Show Starred Tasks |
| 95 | + </VPLink> |
| 96 | +</div> |
| 97 | + |
| 98 | +### Show Scheduled Tasks |
| 99 | + |
| 100 | +```ts-vue [{{currentMethod}}] |
| 101 | +import { {{ currentMethod === 'On-Demand' ? 'showScheduled' : 'twoDo' }} } from '{{ importPath }}' |
| 102 | +
|
| 103 | +const url = {{currentMethod === 'On-Demand' ? '' : 'twoDo.'}}showScheduled() |
| 104 | +``` |
| 105 | + |
| 106 | +<div class="flex justify-center"> |
| 107 | + <VPLink :href="showScheduled()" target="_self"> |
| 108 | + Show Scheduled Tasks |
| 109 | + </VPLink> |
| 110 | +</div> |
| 111 | + |
| 112 | +### Show List |
| 113 | + |
| 114 | +```ts-vue [{{currentMethod}}] |
| 115 | +import { {{ currentMethod === 'On-Demand' ? 'showList' : 'twoDo' }} } from '{{ importPath }}' |
| 116 | +
|
| 117 | +const url = {{currentMethod === 'On-Demand' ? '' : 'twoDo.'}}showList({ |
| 118 | + name: 'Work', |
| 119 | +}) |
| 120 | +``` |
| 121 | + |
| 122 | +<div class="flex justify-center"> |
| 123 | + <VPLink :href="showList(showListParams)" target="_self"> |
| 124 | + Show Work List |
| 125 | + </VPLink> |
| 126 | +</div> |
| 127 | + |
| 128 | +### Search Tasks |
| 129 | + |
| 130 | +```ts-vue [{{currentMethod}}] |
| 131 | +import { {{ currentMethod === 'On-Demand' ? 'search' : 'twoDo' }} } from '{{ importPath }}' |
| 132 | +
|
| 133 | +const url = {{currentMethod === 'On-Demand' ? '' : 'twoDo.'}}search({ |
| 134 | + text: 'John', |
| 135 | +}) |
| 136 | +``` |
| 137 | + |
| 138 | +<div class="flex justify-center"> |
| 139 | + <VPLink :href="search(searchParams)" target="_self"> |
| 140 | + Search for John |
| 141 | + </VPLink> |
| 142 | +</div> |
| 143 | + |
| 144 | +### Search Overdue Tasks |
| 145 | + |
| 146 | +```ts-vue [{{currentMethod}}] |
| 147 | +import { {{ currentMethod === 'On-Demand' ? 'search' : 'twoDo' }} } from '{{ importPath }}' |
| 148 | +
|
| 149 | +const url = {{currentMethod === 'On-Demand' ? '' : 'twoDo.'}}search({ |
| 150 | + text: 'type:overdue', |
| 151 | +}) |
| 152 | +``` |
| 153 | + |
| 154 | +<div class="flex justify-center"> |
| 155 | + <VPLink :href="search(searchOverdueParams)" target="_self"> |
| 156 | + Search Overdue Tasks |
| 157 | + </VPLink> |
| 158 | +</div> |
| 159 | + |
| 160 | +### Add New Task (Open Screen) |
| 161 | + |
| 162 | +```ts-vue [{{currentMethod}}] |
| 163 | +import { {{ currentMethod === 'On-Demand' ? 'addNewTask' : 'twoDo' }} } from '{{ importPath }}' |
| 164 | +
|
| 165 | +const url = {{currentMethod === 'On-Demand' ? '' : 'twoDo.'}}addNewTask({ |
| 166 | + ignoreDefaults: 1, |
| 167 | +}) |
| 168 | +``` |
| 169 | + |
| 170 | +<div class="flex justify-center"> |
| 171 | + <VPLink :href="addNewTask(addNewTaskParams)" target="_self"> |
| 172 | + Open New Task Screen |
| 173 | + </VPLink> |
| 174 | +</div> |
| 175 | + |
| 176 | +### Add Task |
| 177 | + |
| 178 | +```ts-vue [{{currentMethod}}] |
| 179 | +import { {{ currentMethod === 'On-Demand' ? 'add' : 'twoDo' }} } from '{{ importPath }}' |
| 180 | +
|
| 181 | +const url = {{currentMethod === 'On-Demand' ? '' : 'twoDo.'}}add({ |
| 182 | + task: 'Dinner at 8pm', |
| 183 | + due: '1', |
| 184 | +}) |
| 185 | +``` |
| 186 | + |
| 187 | +<div class="flex justify-center"> |
| 188 | + <VPLink :href="add(addTaskParams)" target="_self"> |
| 189 | + Add Task |
| 190 | + </VPLink> |
| 191 | +</div> |
| 192 | + |
| 193 | +### Add Task with Priority |
| 194 | + |
| 195 | +```ts-vue [{{currentMethod}}] |
| 196 | +import { {{ currentMethod === 'On-Demand' ? 'add' : 'twoDo' }} } from '{{ importPath }}' |
| 197 | +
|
| 198 | +const url = {{currentMethod === 'On-Demand' ? '' : 'twoDo.'}}add({ |
| 199 | + task: 'Important task', |
| 200 | + priority: 3, |
| 201 | +}) |
| 202 | +``` |
| 203 | + |
| 204 | +<div class="flex justify-center"> |
| 205 | + <VPLink :href="add(addTaskWithPriorityParams)" target="_self"> |
| 206 | + Add High Priority Task |
| 207 | + </VPLink> |
| 208 | +</div> |
| 209 | + |
| 210 | +### Add Task with Tags |
| 211 | + |
| 212 | +```ts-vue [{{currentMethod}}] |
| 213 | +import { {{ currentMethod === 'On-Demand' ? 'add' : 'twoDo' }} } from '{{ importPath }}' |
| 214 | +
|
| 215 | +const url = {{currentMethod === 'On-Demand' ? '' : 'twoDo.'}}add({ |
| 216 | + task: 'Monthly subscription', |
| 217 | + tags: 'bill,payment', |
| 218 | +}) |
| 219 | +``` |
| 220 | + |
| 221 | +<div class="flex justify-center"> |
| 222 | + <VPLink :href="add(addTaskWithTagsParams)" target="_self"> |
| 223 | + Add Task with Tags |
| 224 | + </VPLink> |
| 225 | +</div> |
| 226 | + |
| 227 | +### Add Task to Project |
| 228 | + |
| 229 | +```ts-vue [{{currentMethod}}] |
| 230 | +import { {{ currentMethod === 'On-Demand' ? 'add' : 'twoDo' }} } from '{{ importPath }}' |
| 231 | +
|
| 232 | +const url = {{currentMethod === 'On-Demand' ? '' : 'twoDo.'}}add({ |
| 233 | + task: 'Buy a new charger', |
| 234 | + forParentName: 'Shopping List', |
| 235 | + forList: 'Home', |
| 236 | +}) |
| 237 | +``` |
| 238 | + |
| 239 | +<div class="flex justify-center"> |
| 240 | + <VPLink :href="add(addTaskWithProjectParams)" target="_self"> |
| 241 | + Add Task to Project |
| 242 | + </VPLink> |
| 243 | +</div> |
| 244 | + |
| 245 | +### Paste Text as Tasks |
| 246 | + |
| 247 | +```ts-vue [{{currentMethod}}] |
| 248 | +import { {{ currentMethod === 'On-Demand' ? 'paste' : 'twoDo' }} } from '{{ importPath }}' |
| 249 | +
|
| 250 | +const url = {{currentMethod === 'On-Demand' ? '' : 'twoDo.'}}paste({ |
| 251 | + text: 'Task 1\nTask 2\nTask 3', |
| 252 | + forList: 'Shopping', |
| 253 | +}) |
| 254 | +``` |
| 255 | + |
| 256 | +<div class="flex justify-center"> |
| 257 | + <VPLink :href="paste(pasteParams)" target="_self"> |
| 258 | + Paste as Tasks |
| 259 | + </VPLink> |
| 260 | +</div> |
| 261 | + |
| 262 | +### Get Task ID |
| 263 | + |
| 264 | +```ts-vue [{{currentMethod}}] |
| 265 | +import { {{ currentMethod === 'On-Demand' ? 'getTaskID' : 'twoDo' }} } from '{{ importPath }}' |
| 266 | +
|
| 267 | +const url = {{currentMethod === 'On-Demand' ? '' : 'twoDo.'}}getTaskID({ |
| 268 | + task: 'My Task', |
| 269 | + forList: 'Work', |
| 270 | + saveInClipboard: 1, |
| 271 | +}) |
| 272 | +``` |
| 273 | + |
| 274 | +<div class="flex justify-center"> |
| 275 | + <VPLink :href="getTaskID(getTaskIDParams)" target="_self"> |
| 276 | + Get Task ID |
| 277 | + </VPLink> |
| 278 | +</div> |
0 commit comments