|
| 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, addLink, addMemo, openFolder, openInbox, openSmartFolder, openStarred, openTag, search } from 'protocol-launcher/cubox'; |
| 9 | +import { SelectInstallationMethod } from '../../.vitepress/components'; |
| 10 | +import { |
| 11 | + addLinkParams, |
| 12 | + addMemoParams, |
| 13 | + openFolderParams, |
| 14 | + openSmartFolderParams, |
| 15 | + openTagParams, |
| 16 | + searchParams, |
| 17 | +} from '../../.vitepress/constants/cubox'; |
| 18 | + |
| 19 | +const currentMethod = ref('On-Demand'); |
| 20 | +const importPath = computed(() => currentMethod.value === 'On-Demand' ? 'protocol-launcher/cubox' : 'protocol-launcher'); |
| 21 | +</script> |
| 22 | + |
| 23 | +# Cubox |
| 24 | + |
| 25 | +[Cubox](https://www.cubox.pro/) is a next-generation AI-powered read-it-later assistant that helps you save, organize, and truly understand what you read. **Protocol Launcher** allows you to generate deep links to add content and navigate within Cubox. |
| 26 | + |
| 27 | +## Usage |
| 28 | + |
| 29 | +There are two ways to use this library: |
| 30 | + |
| 31 | +- On-Demand import from subpaths enables tree-shaking and keeps bundles small. |
| 32 | +- Full Import from the root package is convenient but includes all app modules. |
| 33 | + |
| 34 | +Pick On-Demand for production builds; Full Import is fine for quick scripts or demos. |
| 35 | + |
| 36 | +<SelectInstallationMethod v-model="currentMethod" /> |
| 37 | + |
| 38 | +### Open App |
| 39 | + |
| 40 | +```ts-vue [{{currentMethod}}] |
| 41 | +import { {{ currentMethod === 'On-Demand' ? 'open' : 'cubox' }} } from '{{ importPath }}' |
| 42 | +
|
| 43 | +const url = {{currentMethod === 'On-Demand' ? '' : 'cubox.'}}open() |
| 44 | +``` |
| 45 | + |
| 46 | +<div class="flex justify-center"> |
| 47 | + <VPLink :href="open()" target="_self"> |
| 48 | + Open Cubox |
| 49 | + </VPLink> |
| 50 | +</div> |
| 51 | + |
| 52 | +### Add Link |
| 53 | + |
| 54 | +```ts-vue [{{currentMethod}}] |
| 55 | +import { {{ currentMethod === 'On-Demand' ? 'addLink' : 'cubox' }} } from '{{ importPath }}' |
| 56 | +
|
| 57 | +const url = {{currentMethod === 'On-Demand' ? '' : 'cubox.'}}addLink({ |
| 58 | + url: 'https://example.com/article', |
| 59 | +}) |
| 60 | +``` |
| 61 | + |
| 62 | +<div class="flex justify-center"> |
| 63 | + <VPLink :href="addLink(addLinkParams)" target="_self"> |
| 64 | + Add Link to Cubox |
| 65 | + </VPLink> |
| 66 | +</div> |
| 67 | + |
| 68 | +### Add Memo |
| 69 | + |
| 70 | +```ts-vue [{{currentMethod}}] |
| 71 | +import { {{ currentMethod === 'On-Demand' ? 'addMemo' : 'cubox' }} } from '{{ importPath }}' |
| 72 | +
|
| 73 | +const url = {{currentMethod === 'On-Demand' ? '' : 'cubox.'}}addMemo({ |
| 74 | + memo: 'Remember to buy groceries', |
| 75 | +}) |
| 76 | +``` |
| 77 | + |
| 78 | +<div class="flex justify-center"> |
| 79 | + <VPLink :href="addMemo(addMemoParams)" target="_self"> |
| 80 | + Add Memo to Cubox |
| 81 | + </VPLink> |
| 82 | +</div> |
| 83 | + |
| 84 | +### Open Folder |
| 85 | + |
| 86 | +```ts-vue [{{currentMethod}}] |
| 87 | +import { {{ currentMethod === 'On-Demand' ? 'openFolder' : 'cubox' }} } from '{{ importPath }}' |
| 88 | +
|
| 89 | +const url = {{currentMethod === 'On-Demand' ? '' : 'cubox.'}}openFolder({ |
| 90 | + name: 'Reading List', |
| 91 | +}) |
| 92 | +``` |
| 93 | + |
| 94 | +<div class="flex justify-center"> |
| 95 | + <VPLink :href="openFolder(openFolderParams)" target="_self"> |
| 96 | + Open Folder in Cubox |
| 97 | + </VPLink> |
| 98 | +</div> |
| 99 | + |
| 100 | +### Open Inbox |
| 101 | + |
| 102 | +```ts-vue [{{currentMethod}}] |
| 103 | +import { {{ currentMethod === 'On-Demand' ? 'openInbox' : 'cubox' }} } from '{{ importPath }}' |
| 104 | +
|
| 105 | +const url = {{currentMethod === 'On-Demand' ? '' : 'cubox.'}}openInbox() |
| 106 | +``` |
| 107 | + |
| 108 | +<div class="flex justify-center"> |
| 109 | + <VPLink :href="openInbox()" target="_self"> |
| 110 | + Open Inbox in Cubox |
| 111 | + </VPLink> |
| 112 | +</div> |
| 113 | + |
| 114 | +### Open Smart Folder |
| 115 | + |
| 116 | +```ts-vue [{{currentMethod}}] |
| 117 | +import { {{ currentMethod === 'On-Demand' ? 'openSmartFolder' : 'cubox' }} } from '{{ importPath }}' |
| 118 | +
|
| 119 | +const url = {{currentMethod === 'On-Demand' ? '' : 'cubox.'}}openSmartFolder({ |
| 120 | + name: 'Recent Articles', |
| 121 | +}) |
| 122 | +``` |
| 123 | + |
| 124 | +<div class="flex justify-center"> |
| 125 | + <VPLink :href="openSmartFolder(openSmartFolderParams)" target="_self"> |
| 126 | + Open Smart Folder in Cubox |
| 127 | + </VPLink> |
| 128 | +</div> |
| 129 | + |
| 130 | +### Open Starred |
| 131 | + |
| 132 | +```ts-vue [{{currentMethod}}] |
| 133 | +import { {{ currentMethod === 'On-Demand' ? 'openStarred' : 'cubox' }} } from '{{ importPath }}' |
| 134 | +
|
| 135 | +const url = {{currentMethod === 'On-Demand' ? '' : 'cubox.'}}openStarred() |
| 136 | +``` |
| 137 | + |
| 138 | +<div class="flex justify-center"> |
| 139 | + <VPLink :href="openStarred()" target="_self"> |
| 140 | + Open Starred in Cubox |
| 141 | + </VPLink> |
| 142 | +</div> |
| 143 | + |
| 144 | +### Open Tag |
| 145 | + |
| 146 | +```ts-vue [{{currentMethod}}] |
| 147 | +import { {{ currentMethod === 'On-Demand' ? 'openTag' : 'cubox' }} } from '{{ importPath }}' |
| 148 | +
|
| 149 | +const url = {{currentMethod === 'On-Demand' ? '' : 'cubox.'}}openTag({ |
| 150 | + name: 'important', |
| 151 | +}) |
| 152 | +``` |
| 153 | + |
| 154 | +<div class="flex justify-center"> |
| 155 | + <VPLink :href="openTag(openTagParams)" target="_self"> |
| 156 | + Open Tag in Cubox |
| 157 | + </VPLink> |
| 158 | +</div> |
| 159 | + |
| 160 | +### Search |
| 161 | + |
| 162 | +```ts-vue [{{currentMethod}}] |
| 163 | +import { {{ currentMethod === 'On-Demand' ? 'search' : 'cubox' }} } from '{{ importPath }}' |
| 164 | +
|
| 165 | +const url = {{currentMethod === 'On-Demand' ? '' : 'cubox.'}}search({ |
| 166 | + query: 'typescript', |
| 167 | + type: 'card', |
| 168 | +}) |
| 169 | +``` |
| 170 | + |
| 171 | +<div class="flex justify-center"> |
| 172 | + <VPLink :href="search(searchParams)" target="_self"> |
| 173 | + Search in Cubox |
| 174 | + </VPLink> |
| 175 | +</div> |
0 commit comments