Skip to content

Commit 702f0ed

Browse files
committed
feat: Add task lists (checklists) support v0.15.0
- Add task_list() and task_item() helper functions - Support for nested checklists (unlimited depth) - Add TaskListNode, TaskItemNode types - Add checked attribute for completion tracking - Add comprehensive documentation and examples - Add 8 unit tests and 4 integration tests - All tests passing
1 parent 9732be5 commit 702f0ed

10 files changed

Lines changed: 1054 additions & 8 deletions

File tree

CHANGELOG.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,45 @@
11
# Changelog
22

3+
## [0.15.0] - 2025-10-24
4+
5+
### Added
6+
7+
- **✅ Task Lists (Checklists)**: Interactive checklists with checked/unchecked states
8+
- `task_list(*items)` - Create a checklist container
9+
- `task_item(content, checked=False)` - Create individual checklist items
10+
- Support for nested checklists (unlimited depth)
11+
- Each task item can contain paragraphs and nested task lists
12+
- `checked` attribute tracks completion status (boolean)
13+
- Auto-generated UIDs for task lists
14+
- Full integration with document API (`replace_json_document`, `append_json_document`)
15+
16+
- **New Document Structure Types**:
17+
- `TaskListNode` - Type for task list container
18+
- `TaskItemNode` - Type for individual checklist items
19+
- `TaskListAttrs` - Attributes for task lists (uid)
20+
- `TaskItemAttrs` - Attributes for task items (checked status)
21+
22+
### Documentation
23+
24+
- Added comprehensive task list documentation in API reference
25+
- Added nested checklist examples and patterns
26+
- Updated document structure guide with task list blocks
27+
- Added task list to supported elements table
28+
29+
### Examples
30+
31+
- `examples/task_list_checklist.py` - Complete examples of task lists usage
32+
- Simple checklists
33+
- Nested checklists (multi-level)
34+
- Mixed content (text + checklists)
35+
- Complex nested structures (3+ levels)
36+
37+
### Tests
38+
39+
- Added 8 unit tests for task list functionality
40+
- Added 4 integration tests with real API
41+
- All tests passing
42+
343
## [0.14.0] - 2025-10-24
444

545
### Added

docs-site/docs/api-reference/document-structure.md

Lines changed: 166 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -350,6 +350,85 @@ Numbered list.
350350
**Attributes:**
351351
- `start` - Starting number (optional, default: 1)
352352

353+
### Task List Node (Checklist)
354+
355+
Interactive checklist with checkable items.
356+
357+
```json
358+
{
359+
"type": "taskList",
360+
"attrs": {
361+
"uid": "uniqueId123"
362+
},
363+
"content": [
364+
{
365+
"type": "taskItem",
366+
"attrs": {
367+
"checked": true
368+
},
369+
"content": [
370+
{
371+
"type": "paragraph",
372+
"content": [{"type": "text", "text": "Completed task"}]
373+
}
374+
]
375+
},
376+
{
377+
"type": "taskItem",
378+
"attrs": {
379+
"checked": false
380+
},
381+
"content": [
382+
{
383+
"type": "paragraph",
384+
"content": [{"type": "text", "text": "Todo task"}]
385+
}
386+
]
387+
}
388+
]
389+
}
390+
```
391+
392+
**Attributes:**
393+
- `uid` - Unique identifier (optional, auto-generated)
394+
395+
**Features:**
396+
- Interactive checkboxes
397+
- Can be nested for multi-level checklists
398+
- Supports checked/unchecked states
399+
- Can contain paragraphs and nested task lists
400+
401+
### Task Item Node
402+
403+
Individual item in a task list (checklist).
404+
405+
```json
406+
{
407+
"type": "taskItem",
408+
"attrs": {
409+
"checked": false
410+
},
411+
"content": [
412+
{
413+
"type": "paragraph",
414+
"content": [{"type": "text", "text": "Task description"}]
415+
},
416+
{
417+
"type": "taskList",
418+
"content": [...] // Nested checklist
419+
}
420+
]
421+
}
422+
```
423+
424+
**Attributes:**
425+
- `checked` - Whether the task is completed (required, boolean)
426+
427+
**Content:**
428+
- Can contain paragraphs
429+
- Can contain nested `taskList` nodes for sub-tasks
430+
- Supports multi-level nesting
431+
353432
### List Item Node
354433

355434
Individual item in a list. Can contain paragraphs and nested lists.
@@ -611,6 +690,8 @@ Table header cell (`<th>` in HTML). Use for semantic table headers.
611690

612691
## Nested Structures
613692

693+
### Nested Lists
694+
614695
Lists can be nested within list items:
615696

616697
```json
@@ -644,6 +725,83 @@ Lists can be nested within list items:
644725
}
645726
```
646727

728+
### Nested Checklists
729+
730+
Task lists support multi-level nesting:
731+
732+
```json
733+
{
734+
"type": "taskList",
735+
"attrs": {"uid": "mainList"},
736+
"content": [
737+
{
738+
"type": "taskItem",
739+
"attrs": {"checked": false},
740+
"content": [
741+
{
742+
"type": "paragraph",
743+
"content": [{"type": "text", "text": "Main task"}]
744+
},
745+
{
746+
"type": "taskList",
747+
"attrs": {"uid": "nestedList"},
748+
"content": [
749+
{
750+
"type": "taskItem",
751+
"attrs": {"checked": true},
752+
"content": [
753+
{
754+
"type": "paragraph",
755+
"content": [{"type": "text", "text": "Subtask 1"}]
756+
}
757+
]
758+
},
759+
{
760+
"type": "taskItem",
761+
"attrs": {"checked": false},
762+
"content": [
763+
{
764+
"type": "paragraph",
765+
"content": [{"type": "text", "text": "Subtask 2"}]
766+
}
767+
]
768+
}
769+
]
770+
}
771+
]
772+
}
773+
]
774+
}
775+
```
776+
777+
**Using helpers for nested checklists:**
778+
779+
```python
780+
from vaiz import task_list, task_item, paragraph
781+
782+
content = [
783+
task_list(
784+
task_item(
785+
paragraph("Phase 1: Planning"),
786+
task_list(
787+
task_item("Define requirements", checked=True),
788+
task_item("Create wireframes", checked=True),
789+
task_item("Review with stakeholders", checked=False)
790+
),
791+
checked=True
792+
),
793+
task_item(
794+
paragraph("Phase 2: Development"),
795+
task_list(
796+
task_item("Setup project", checked=False),
797+
task_item("Implement features", checked=False)
798+
),
799+
checked=False
800+
)
801+
)
802+
]
803+
```
804+
647805
## Complete Example
648806

649807
```json
@@ -722,7 +880,7 @@ Lists can be nested within list items:
722880
Instead of manually constructing JSON, use the built-in helper functions:
723881

724882
```python
725-
from vaiz import heading, paragraph, text, bullet_list, blockquote, link_text, table, table_row, table_header
883+
from vaiz import heading, paragraph, text, bullet_list, task_list, task_item, blockquote, link_text, table, table_row, table_header
726884

727885
content = [
728886
heading(1, "Project Documentation"),
@@ -738,6 +896,11 @@ content = [
738896
"Easy to use",
739897
"Type-safe"
740898
),
899+
heading(2, "Todo"),
900+
task_list(
901+
task_item("Review code", checked=True),
902+
task_item("Deploy to production", checked=False)
903+
),
741904
blockquote(
742905
paragraph(
743906
text("Important: ", bold=True),
@@ -1091,6 +1254,8 @@ client.replace_json_document(document_id, content)
10911254
| `bulletList` | Unordered list | `{"type": "bulletList", "content": [...]}` |
10921255
| `orderedList` | Numbered list | `{"type": "orderedList", "content": [...]}` |
10931256
| `listItem` | List item | `{"type": "listItem", "content": [...]}` |
1257+
| `taskList` | Checklist with checkable items | `{"type": "taskList", "attrs": {"uid": "..."}, "content": [...]}` |
1258+
| `taskItem` | Checklist item with checkbox | `{"type": "taskItem", "attrs": {"checked": false}, "content": [...]}` |
10941259
| `blockquote` | Blockquote for quotes/callouts | `{"type": "blockquote", "content": [...]}` |
10951260
| `details` | Collapsible section | `{"type": "details", "content": [...]}` |
10961261
| `extension-table` | Table with rows | `{"type": "extension-table", "attrs": {"uid": "..."}, "content": [...]}` |

docs-site/docusaurus.config.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -206,8 +206,8 @@ const config: Config = {
206206
},
207207
items: [
208208
{
209-
label: "v0.14.0",
210-
href: "https://pypi.org/project/vaiz-sdk/0.14.0/",
209+
label: "v0.15.0",
210+
href: "https://pypi.org/project/vaiz-sdk/0.15.0/",
211211
position: "left",
212212
},
213213
{

0 commit comments

Comments
 (0)