Skip to content

Sorted³

Sorted³ 是一款围绕统一时间线设计的任务管理与计划应用。Protocol Launcher 可以生成 Sorted³ URL scheme 链接。

使用

有两种方式使用此库:

  • On-Demand 从子路径导入,有利于 tree-shaking 并保持包体积较小。
  • Full Import 从根包导入,写起来更方便,但会包含所有应用模块。

生产构建建议使用 On-Demand;快速脚本或演示可以使用 Full Import。

选择安装方式

按需加载
推荐使用。生产环境优化。
全量导入
使用便捷。适合快速脚本。

说明

Sorted 官方指南为 Sorted³ v3.1 或更新版本记录了 sorted://x-callback-url/opensorted://x-callback-url/add。本模块只暴露这些官方 action 和参数对应的 helper。

官方列出的 item 值为 todayinboxnewsearch。打开日期支持 yyyy-MM-dd 日期、todaytomorrowyesterday 这类 casual date、带 offset 值的 date=offset,以及带 weekday 数字的 date=weekday;其中 Sunday 是 1,Monday 是 2

add action 的 type 默认是 task,因此 addTask() 不写入 typeaddEvent() 会序列化 type=eventtagsfilterByTags 这类逗号分隔值以字符串传入,并在生成 URL 时进行 percent encoding。

Sorted 将 lock 记录为 task-only 参数,但没有说明 true/false 的序列化取值,因此类型只接受调用方传入的字符串,示例中不自造取值。

打开 Item 视图

On-Demand
ts
import { open, openToday, openInbox, openNew, openSearch } from 'protocol-launcher/sorted'

const todayUrl = openToday()
const inboxUrl = openInbox()
const newUrl = openNew()
const searchViewUrl = openSearch()
const itemUrl = open({ item: 'today' })

打开日期

On-Demand
ts
import { openDate } from 'protocol-launcher/sorted'

const dateUrl = openDate({
  date: '2018-07-20',
})

const casualDateUrl = openDate({
  date: 'tomorrow',
})

按 Offset 打开

On-Demand
ts
import { openOffset } from 'protocol-launcher/sorted'

const url = openOffset({
  offset: 3,
})

按 Weekday 打开

On-Demand
ts
import { openWeekday } from 'protocol-launcher/sorted'

const url = openWeekday({
  weekday: 2,
})

打开列表或标签

On-Demand
ts
import { openList, openTag } from 'protocol-launcher/sorted'

const listUrl = openList({
  list: 'Work',
  filterByTags: 'urgent,office',
})

const tagUrl = openTag({
  tag: 'urgent',
  filterByTags: 'office,phone',
})

搜索

On-Demand
ts
import { search } from 'protocol-launcher/sorted'

const url = search({
  search: 'Meeting',
})

添加任务

On-Demand
ts
import { addTask } from 'protocol-launcher/sorted'

const url = addTask({
  title: 'Plan launch',
  date: '2026-06-01 09:00',
  duration: 45,
  earlyAlert: 'none',
  list: 'Work',
  tags: 'urgent,office',
})

添加事件

On-Demand
ts
import { addEvent } from 'protocol-launcher/sorted'

const url = addEvent({
  title: 'Planning meeting',
  date: '2026-06-01 10:00',
  duration: 60,
  earlyAlert: 15,
  calendar: 'Work',
  location: 'Conference Room',
})

生成的 URL

ts
openToday()
// => 'sorted://x-callback-url/open?item=today'

openInbox()
// => 'sorted://x-callback-url/open?item=inbox'

openNew()
// => 'sorted://x-callback-url/open?item=new'

openSearch()
// => 'sorted://x-callback-url/open?item=search'

openDate({ date: '2018-07-20' })
// => 'sorted://x-callback-url/open?date=2018-07-20'

openDate({ date: 'tomorrow' })
// => 'sorted://x-callback-url/open?date=tomorrow'

openOffset({ offset: 3 })
// => 'sorted://x-callback-url/open?date=offset&offset=3'

openWeekday({ weekday: 2 })
// => 'sorted://x-callback-url/open?date=weekday&weekday=2'

openList({ list: 'Work', filterByTags: 'urgent,office' })
// => 'sorted://x-callback-url/open?list=Work&filterByTags=urgent%2Coffice'

openTag({ tag: 'urgent', filterByTags: 'office,phone' })
// => 'sorted://x-callback-url/open?tag=urgent&filterByTags=office%2Cphone'

search({ search: 'Meeting' })
// => 'sorted://x-callback-url/open?search=Meeting'

addTask({
  title: 'Plan launch',
  date: '2026-06-01 09:00',
  duration: 45,
  earlyAlert: 'none',
  list: 'Work',
  tags: 'urgent,office',
})
// => 'sorted://x-callback-url/add?title=Plan%20launch&date=2026-06-01%2009%3A00&duration=45&earlyAlert=none&list=Work&tags=urgent%2Coffice'

addEvent({
  title: 'Planning meeting',
  date: '2026-06-01 10:00',
  duration: 60,
  earlyAlert: 15,
  calendar: 'Work',
  location: 'Conference Room',
})
// => 'sorted://x-callback-url/add?title=Planning%20meeting&date=2026-06-01%2010%3A00&duration=60&earlyAlert=15&type=event&calendar=Work&location=Conference%20Room'

官方文档