@nextsparkjs/theme-productivity 0.1.0-beta.1 → 0.1.0-beta.101

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/LICENSE +21 -0
  2. package/config/app.config.ts +4 -5
  3. package/config/dashboard.config.ts +13 -0
  4. package/config/permissions.config.ts +11 -0
  5. package/entities/boards/api/docs.md +131 -0
  6. package/entities/boards/api/presets.ts +113 -0
  7. package/entities/cards/api/docs.md +162 -0
  8. package/entities/cards/api/presets.ts +172 -0
  9. package/entities/lists/api/docs.md +143 -0
  10. package/entities/lists/api/presets.ts +81 -0
  11. package/lib/selectors.ts +2 -3
  12. package/package.json +8 -3
  13. package/styles/globals.css +37 -1
  14. package/tests/cypress/e2e/ui/boards/boards-owner.cy.ts +349 -0
  15. package/tests/cypress/e2e/ui/cards/cards-modal.cy.ts +369 -0
  16. package/tests/cypress/e2e/ui/kanban/kanban-cards.cy.ts +280 -0
  17. package/tests/cypress/e2e/ui/kanban/kanban-columns.cy.ts +243 -0
  18. package/tests/cypress/fixtures/blocks.json +9 -0
  19. package/tests/cypress/fixtures/entities.json +60 -0
  20. package/tests/cypress/src/components/BoardsPOM.ts +353 -0
  21. package/tests/cypress/src/components/CardsPOM.ts +383 -0
  22. package/tests/cypress/src/components/KanbanPOM.ts +399 -0
  23. package/tests/cypress/src/components/index.ts +9 -0
  24. package/tests/cypress/src/controllers/BoardsAPIController.js +302 -0
  25. package/tests/cypress/src/controllers/CardsAPIController.js +406 -0
  26. package/tests/cypress/src/controllers/ListsAPIController.js +299 -0
  27. package/tests/cypress/src/index.ts +25 -0
  28. package/tests/cypress/src/selectors.ts +50 -0
  29. package/tests/cypress/src/session-helpers.ts +176 -0
  30. package/tests/cypress/support/e2e.ts +90 -0
  31. package/tests/cypress.config.ts +154 -0
  32. package/tests/jest/__mocks__/jose.js +22 -0
  33. package/tests/jest/__mocks__/next-server.js +56 -0
  34. package/tests/jest/jest.config.cjs +131 -0
  35. package/tests/jest/setup.ts +170 -0
  36. package/tests/tsconfig.json +15 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 NextSpark
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.
@@ -58,11 +58,10 @@ export const APP_CONFIG_OVERRIDES = {
58
58
  // =============================================================================
59
59
  api: {
60
60
  cors: {
61
- allowedOrigins: {
62
- development: [
63
- 'http://localhost:3000',
64
- 'http://localhost:5173',
65
- ],
61
+ // Theme-specific CORS origins (extends core defaults, does not replace)
62
+ // No additional origins needed for productivity theme - uses core defaults
63
+ additionalOrigins: {
64
+ development: [],
66
65
  production: [],
67
66
  },
68
67
  },
@@ -53,6 +53,19 @@ export const DASHBOARD_CONFIG = {
53
53
  devtoolsAccess: {
54
54
  enabled: true,
55
55
  },
56
+ /**
57
+ * Settings menu dropdown (gear icon)
58
+ */
59
+ settingsMenu: {
60
+ enabled: true,
61
+ links: [
62
+ {
63
+ label: 'navigation.patterns',
64
+ href: '/dashboard/patterns',
65
+ icon: 'layers',
66
+ },
67
+ ],
68
+ },
56
69
  userMenu: {
57
70
  enabled: true,
58
71
  showAvatar: true,
@@ -82,6 +82,17 @@ export const PERMISSIONS_CONFIG_OVERRIDES: ThemePermissionsConfig = {
82
82
  { action: 'update', label: 'Edit cards', description: 'Can modify card information', roles: ['owner', 'admin', 'member'] },
83
83
  { action: 'delete', label: 'Delete cards', description: 'Can delete cards', roles: ['owner', 'admin'], dangerous: true },
84
84
  ],
85
+
86
+ // ------------------------------------------
87
+ // PATTERNS
88
+ // ------------------------------------------
89
+ patterns: [
90
+ { action: 'create', label: 'Create Patterns', description: 'Can create reusable patterns', roles: ['owner', 'admin'] },
91
+ { action: 'read', label: 'View Patterns', description: 'Can view pattern details', roles: ['owner', 'admin', 'member'] },
92
+ { action: 'list', label: 'List Patterns', description: 'Can see the patterns list', roles: ['owner', 'admin', 'member'] },
93
+ { action: 'update', label: 'Edit Patterns', description: 'Can modify patterns', roles: ['owner', 'admin'] },
94
+ { action: 'delete', label: 'Delete Patterns', description: 'Can delete patterns', roles: ['owner', 'admin'], dangerous: true },
95
+ ],
85
96
  },
86
97
 
87
98
  // ==========================================
@@ -0,0 +1,131 @@
1
+ # Boards API
2
+
3
+ Manage Trello-style boards for organizing lists and cards.
4
+
5
+ ## Overview
6
+
7
+ The Boards API allows you to create, read, update, and archive board records. Boards are the top-level containers for organizing lists and cards in a Kanban-style workflow.
8
+
9
+ ## Authentication
10
+
11
+ All endpoints require authentication via:
12
+ - **Session cookie** (for browser-based requests)
13
+ - **API Key** header (for server-to-server requests)
14
+
15
+ ## Endpoints
16
+
17
+ ### List Boards
18
+ `GET /api/v1/boards`
19
+
20
+ Returns a paginated list of boards.
21
+
22
+ **Query Parameters:**
23
+ - `limit` (number, optional): Maximum records to return. Default: 20
24
+ - `offset` (number, optional): Number of records to skip. Default: 0
25
+ - `archived` (boolean, optional): Filter by archived status
26
+ - `search` (string, optional): Search by name, description
27
+ - `sortBy` (string, optional): Field to sort by. Default: position
28
+ - `sortOrder` (string, optional): Sort direction (asc, desc)
29
+
30
+ **Example Response:**
31
+ ```json
32
+ {
33
+ "data": [
34
+ {
35
+ "id": "board_abc123",
36
+ "name": "Product Development",
37
+ "description": "Main product roadmap and feature tracking",
38
+ "color": "blue",
39
+ "archived": false,
40
+ "position": 1,
41
+ "createdAt": "2024-01-15T10:30:00Z",
42
+ "updatedAt": "2024-01-15T10:30:00Z"
43
+ }
44
+ ],
45
+ "pagination": {
46
+ "total": 5,
47
+ "limit": 20,
48
+ "offset": 0
49
+ }
50
+ }
51
+ ```
52
+
53
+ ### Get Single Board
54
+ `GET /api/v1/boards/[id]`
55
+
56
+ Returns a single board by ID.
57
+
58
+ ### Create Board
59
+ `POST /api/v1/boards`
60
+
61
+ Create a new board.
62
+
63
+ **Request Body:**
64
+ ```json
65
+ {
66
+ "name": "New Project",
67
+ "description": "Board for tracking new project tasks",
68
+ "color": "purple"
69
+ }
70
+ ```
71
+
72
+ ### Update Board
73
+ `PATCH /api/v1/boards/[id]`
74
+
75
+ Update an existing board. Supports partial updates.
76
+
77
+ ### Archive Board
78
+ `PATCH /api/v1/boards/[id]`
79
+
80
+ Archive a board (soft delete).
81
+
82
+ **Request Body:**
83
+ ```json
84
+ {
85
+ "archived": true
86
+ }
87
+ ```
88
+
89
+ ### Delete Board
90
+ `DELETE /api/v1/boards/[id]`
91
+
92
+ Permanently delete a board. This will also delete all associated lists and cards.
93
+
94
+ ## Fields
95
+
96
+ | Field | Type | Required | Default | Description |
97
+ |-------|------|----------|---------|-------------|
98
+ | name | text | Yes | - | Board name |
99
+ | description | textarea | No | - | Board description |
100
+ | color | select | No | blue | Background color (blue, green, purple, orange, red, pink, gray) |
101
+ | archived | boolean | No | false | Whether board is archived |
102
+ | position | number | No | 0 | Display order |
103
+ | createdAt | datetime | Auto | - | Creation timestamp |
104
+ | updatedAt | datetime | Auto | - | Last update timestamp |
105
+
106
+ ## Features
107
+
108
+ - **Searchable**: name, description
109
+ - **Sortable**: name, position, createdAt
110
+ - **Shared Access**: Boards are shared within the team
111
+ - **Soft Delete**: Use archive instead of permanent delete
112
+
113
+ ## Permissions
114
+
115
+ - **Create/Update**: Owner, Admin
116
+ - **Delete**: Owner only
117
+
118
+ ## Error Responses
119
+
120
+ | Status | Description |
121
+ |--------|-------------|
122
+ | 400 | Bad Request - Invalid parameters |
123
+ | 401 | Unauthorized - Missing or invalid auth |
124
+ | 403 | Forbidden - Insufficient permissions |
125
+ | 404 | Not Found - Board doesn't exist |
126
+ | 422 | Validation Error - Invalid data |
127
+
128
+ ## Related APIs
129
+
130
+ - **[Lists](/api/v1/lists)** - Lists within boards
131
+ - **[Cards](/api/v1/cards)** - Cards within lists
@@ -0,0 +1,113 @@
1
+ /**
2
+ * API Presets for Boards Entity
3
+ */
4
+
5
+ import { defineApiEndpoint } from '@nextsparkjs/core/types/api-presets'
6
+
7
+ export default defineApiEndpoint({
8
+ summary: 'Manage kanban boards for task organization',
9
+ presets: [
10
+ {
11
+ id: 'list-all',
12
+ title: 'List All Boards',
13
+ description: 'Get all boards with pagination',
14
+ method: 'GET',
15
+ params: {
16
+ limit: 20
17
+ },
18
+ tags: ['read', 'list']
19
+ },
20
+ {
21
+ id: 'list-active',
22
+ title: 'List Active Boards',
23
+ description: 'Get all non-archived boards',
24
+ method: 'GET',
25
+ params: {
26
+ archived: 'false'
27
+ },
28
+ tags: ['read', 'filter']
29
+ },
30
+ {
31
+ id: 'list-archived',
32
+ title: 'List Archived Boards',
33
+ description: 'Get all archived boards',
34
+ method: 'GET',
35
+ params: {
36
+ archived: 'true'
37
+ },
38
+ tags: ['read', 'filter']
39
+ },
40
+ {
41
+ id: 'search-by-name',
42
+ title: 'Search by Name',
43
+ description: 'Search boards by name',
44
+ method: 'GET',
45
+ params: {
46
+ search: '{{name}}'
47
+ },
48
+ tags: ['read', 'search']
49
+ },
50
+ {
51
+ id: 'create-board',
52
+ title: 'Create Board',
53
+ description: 'Create a new board',
54
+ method: 'POST',
55
+ payload: {
56
+ name: 'New Board',
57
+ description: 'Board description',
58
+ color: 'blue'
59
+ },
60
+ tags: ['write', 'create']
61
+ },
62
+ {
63
+ id: 'update-board',
64
+ title: 'Update Board',
65
+ description: 'Update an existing board',
66
+ method: 'PATCH',
67
+ pathParams: {
68
+ id: '{{id}}'
69
+ },
70
+ payload: {
71
+ name: '{{name}}',
72
+ description: '{{description}}'
73
+ },
74
+ tags: ['write', 'update']
75
+ },
76
+ {
77
+ id: 'archive-board',
78
+ title: 'Archive Board',
79
+ description: 'Archive a board',
80
+ method: 'PATCH',
81
+ pathParams: {
82
+ id: '{{id}}'
83
+ },
84
+ payload: {
85
+ archived: true
86
+ },
87
+ tags: ['write', 'update']
88
+ },
89
+ {
90
+ id: 'restore-board',
91
+ title: 'Restore Board',
92
+ description: 'Restore an archived board',
93
+ method: 'PATCH',
94
+ pathParams: {
95
+ id: '{{id}}'
96
+ },
97
+ payload: {
98
+ archived: false
99
+ },
100
+ tags: ['write', 'update']
101
+ },
102
+ {
103
+ id: 'delete-board',
104
+ title: 'Delete Board',
105
+ description: 'Permanently delete a board',
106
+ method: 'DELETE',
107
+ pathParams: {
108
+ id: '{{id}}'
109
+ },
110
+ tags: ['write', 'delete']
111
+ }
112
+ ]
113
+ })
@@ -0,0 +1,162 @@
1
+ # Cards API
2
+
3
+ Manage task cards within lists (the main work items).
4
+
5
+ ## Overview
6
+
7
+ The Cards API allows you to create, read, update, and delete card records. Cards are the individual task items that can be dragged between lists within a board.
8
+
9
+ ## Authentication
10
+
11
+ All endpoints require authentication via:
12
+ - **Session cookie** (for browser-based requests)
13
+ - **API Key** header (for server-to-server requests)
14
+
15
+ ## Endpoints
16
+
17
+ ### List Cards
18
+ `GET /api/v1/cards`
19
+
20
+ Returns a paginated list of cards.
21
+
22
+ **Query Parameters:**
23
+ - `limit` (number, optional): Maximum records to return. Default: 20
24
+ - `offset` (number, optional): Number of records to skip. Default: 0
25
+ - `listId` (string, optional): Filter by parent list
26
+ - `boardId` (string, optional): Filter by parent board
27
+ - `priority` (string, optional): Filter by priority (low, medium, high, urgent)
28
+ - `assigneeId` (string, optional): Filter by assigned user
29
+ - `search` (string, optional): Search by title, description
30
+ - `sortBy` (string, optional): Field to sort by. Default: position
31
+ - `sortOrder` (string, optional): Sort direction (asc, desc)
32
+
33
+ **Example Response:**
34
+ ```json
35
+ {
36
+ "data": [
37
+ {
38
+ "id": "card_abc123",
39
+ "title": "Implement user authentication",
40
+ "description": "Add login and registration functionality",
41
+ "position": 1,
42
+ "dueDate": "2024-02-01",
43
+ "priority": "high",
44
+ "labels": ["feature", "urgent"],
45
+ "assigneeId": "user_456",
46
+ "listId": "list_xyz",
47
+ "boardId": "board_abc",
48
+ "createdAt": "2024-01-15T10:30:00Z",
49
+ "updatedAt": "2024-01-15T10:30:00Z"
50
+ }
51
+ ],
52
+ "pagination": {
53
+ "total": 15,
54
+ "limit": 20,
55
+ "offset": 0
56
+ }
57
+ }
58
+ ```
59
+
60
+ ### Get Single Card
61
+ `GET /api/v1/cards/[id]`
62
+
63
+ Returns a single card by ID.
64
+
65
+ ### Create Card
66
+ `POST /api/v1/cards`
67
+
68
+ Create a new card.
69
+
70
+ **Request Body:**
71
+ ```json
72
+ {
73
+ "title": "New Feature Request",
74
+ "description": "Detailed description of the feature",
75
+ "listId": "list_xyz789",
76
+ "boardId": "board_abc123",
77
+ "priority": "medium",
78
+ "dueDate": "2024-02-15",
79
+ "assigneeId": "user_456"
80
+ }
81
+ ```
82
+
83
+ ### Update Card
84
+ `PATCH /api/v1/cards/[id]`
85
+
86
+ Update an existing card. Supports partial updates.
87
+
88
+ ### Move Card
89
+ `PATCH /api/v1/cards/[id]`
90
+
91
+ Move a card to a different list (drag & drop).
92
+
93
+ **Request Body:**
94
+ ```json
95
+ {
96
+ "listId": "list_newlist",
97
+ "position": 3
98
+ }
99
+ ```
100
+
101
+ ### Delete Card
102
+ `DELETE /api/v1/cards/[id]`
103
+
104
+ Delete a card.
105
+
106
+ ## Fields
107
+
108
+ | Field | Type | Required | Default | Description |
109
+ |-------|------|----------|---------|-------------|
110
+ | title | text | Yes | - | Card title |
111
+ | description | textarea | No | - | Detailed description |
112
+ | position | number | No | 0 | Display order within list |
113
+ | dueDate | date | No | - | Due date |
114
+ | priority | select | No | - | Priority: low, medium, high, urgent |
115
+ | labels | multiselect | No | - | Labels: urgent, important, bug, feature, enhancement, documentation |
116
+ | assigneeId | reference | No | - | Assigned user ID |
117
+ | listId | reference | Yes | - | Parent list ID |
118
+ | boardId | reference | Yes | - | Parent board ID |
119
+ | createdAt | datetime | Auto | - | Creation timestamp |
120
+ | updatedAt | datetime | Auto | - | Last update timestamp |
121
+
122
+ ## Labels
123
+
124
+ Cards can have multiple labels for categorization:
125
+
126
+ | Label | Description |
127
+ |-------|-------------|
128
+ | urgent | Needs immediate attention |
129
+ | important | High importance |
130
+ | bug | Bug fix needed |
131
+ | feature | New feature |
132
+ | enhancement | Improvement to existing feature |
133
+ | documentation | Documentation work |
134
+
135
+ ## Features
136
+
137
+ - **Searchable**: title, description
138
+ - **Sortable**: title, position, dueDate, priority, createdAt
139
+ - **Filterable**: priority, labels
140
+ - **Drag & Drop**: Move between lists
141
+ - **Bulk Operations**: Supported
142
+ - **Shared Access**: Cards are shared within the team
143
+
144
+ ## Permissions
145
+
146
+ - **Create/Update/Move**: Owner, Admin, Member
147
+ - **Delete**: Owner, Admin
148
+
149
+ ## Error Responses
150
+
151
+ | Status | Description |
152
+ |--------|-------------|
153
+ | 400 | Bad Request - Invalid parameters |
154
+ | 401 | Unauthorized - Missing or invalid auth |
155
+ | 403 | Forbidden - Insufficient permissions |
156
+ | 404 | Not Found - Card, List, or Board doesn't exist |
157
+ | 422 | Validation Error - Invalid data |
158
+
159
+ ## Related APIs
160
+
161
+ - **[Boards](/api/v1/boards)** - Parent boards
162
+ - **[Lists](/api/v1/lists)** - Parent lists
@@ -0,0 +1,172 @@
1
+ /**
2
+ * API Presets for Cards Entity
3
+ */
4
+
5
+ import { defineApiEndpoint } from '@nextsparkjs/core/types/api-presets'
6
+
7
+ export default defineApiEndpoint({
8
+ summary: 'Manage kanban cards (tasks) with priorities and assignments',
9
+ presets: [
10
+ {
11
+ id: 'list-all',
12
+ title: 'List All Cards',
13
+ description: 'Get all cards with pagination',
14
+ method: 'GET',
15
+ params: {
16
+ limit: 50
17
+ },
18
+ tags: ['read', 'list']
19
+ },
20
+ {
21
+ id: 'list-by-list',
22
+ title: 'List by List',
23
+ description: 'Get all cards for a specific list',
24
+ method: 'GET',
25
+ params: {
26
+ listId: '{{listId}}',
27
+ sortBy: 'position',
28
+ sortOrder: 'asc'
29
+ },
30
+ tags: ['read', 'filter']
31
+ },
32
+ {
33
+ id: 'list-by-board',
34
+ title: 'List by Board',
35
+ description: 'Get all cards for a specific board',
36
+ method: 'GET',
37
+ params: {
38
+ boardId: '{{boardId}}'
39
+ },
40
+ tags: ['read', 'filter']
41
+ },
42
+ {
43
+ id: 'list-my-cards',
44
+ title: 'List My Cards',
45
+ description: 'Get cards assigned to current user',
46
+ method: 'GET',
47
+ params: {
48
+ assigneeId: '{{userId}}'
49
+ },
50
+ tags: ['read', 'filter']
51
+ },
52
+ {
53
+ id: 'list-urgent',
54
+ title: 'List Urgent Cards',
55
+ description: 'Get all urgent priority cards',
56
+ method: 'GET',
57
+ params: {
58
+ priority: 'urgent'
59
+ },
60
+ tags: ['read', 'filter']
61
+ },
62
+ {
63
+ id: 'list-by-priority',
64
+ title: 'List by Priority',
65
+ description: 'Get cards filtered by priority level',
66
+ method: 'GET',
67
+ params: {
68
+ priority: '{{priority}}'
69
+ },
70
+ tags: ['read', 'filter']
71
+ },
72
+ {
73
+ id: 'search-by-title',
74
+ title: 'Search by Title',
75
+ description: 'Search cards by title',
76
+ method: 'GET',
77
+ params: {
78
+ search: '{{title}}'
79
+ },
80
+ tags: ['read', 'search']
81
+ },
82
+ {
83
+ id: 'create-card',
84
+ title: 'Create Card',
85
+ description: 'Create a new card in a list',
86
+ method: 'POST',
87
+ payload: {
88
+ title: 'New Card',
89
+ listId: '{{listId}}',
90
+ boardId: '{{boardId}}'
91
+ },
92
+ tags: ['write', 'create']
93
+ },
94
+ {
95
+ id: 'update-card',
96
+ title: 'Update Card',
97
+ description: 'Update card title and description',
98
+ method: 'PATCH',
99
+ pathParams: {
100
+ id: '{{id}}'
101
+ },
102
+ payload: {
103
+ title: '{{title}}',
104
+ description: '{{description}}'
105
+ },
106
+ tags: ['write', 'update']
107
+ },
108
+ {
109
+ id: 'move-card',
110
+ title: 'Move Card',
111
+ description: 'Move card to a different list',
112
+ method: 'PATCH',
113
+ pathParams: {
114
+ id: '{{id}}'
115
+ },
116
+ payload: {
117
+ listId: '{{newListId}}',
118
+ position: '{{position}}'
119
+ },
120
+ tags: ['write', 'update']
121
+ },
122
+ {
123
+ id: 'set-priority',
124
+ title: 'Set Priority',
125
+ description: 'Update card priority level',
126
+ method: 'PATCH',
127
+ pathParams: {
128
+ id: '{{id}}'
129
+ },
130
+ payload: {
131
+ priority: '{{priority}}'
132
+ },
133
+ tags: ['write', 'update']
134
+ },
135
+ {
136
+ id: 'assign-card',
137
+ title: 'Assign Card',
138
+ description: 'Assign card to a team member',
139
+ method: 'PATCH',
140
+ pathParams: {
141
+ id: '{{id}}'
142
+ },
143
+ payload: {
144
+ assigneeId: '{{userId}}'
145
+ },
146
+ tags: ['write', 'update']
147
+ },
148
+ {
149
+ id: 'set-due-date',
150
+ title: 'Set Due Date',
151
+ description: 'Set or update card due date',
152
+ method: 'PATCH',
153
+ pathParams: {
154
+ id: '{{id}}'
155
+ },
156
+ payload: {
157
+ dueDate: '{{dueDate}}'
158
+ },
159
+ tags: ['write', 'update']
160
+ },
161
+ {
162
+ id: 'delete-card',
163
+ title: 'Delete Card',
164
+ description: 'Delete a card',
165
+ method: 'DELETE',
166
+ pathParams: {
167
+ id: '{{id}}'
168
+ },
169
+ tags: ['write', 'delete']
170
+ }
171
+ ]
172
+ })