@critical-path/svelte 0.2.0 → 1.0.0
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.
- package/CHANGELOG.md +3 -3
- package/LICENSE +21 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +108 -0
- package/dist/index.test.d.ts +2 -0
- package/dist/index.test.d.ts.map +1 -0
- package/dist/project-state.svelte.d.ts +13 -0
- package/dist/project-state.svelte.d.ts.map +1 -0
- package/dist/task-state.svelte.d.ts +16 -0
- package/dist/task-state.svelte.d.ts.map +1 -0
- package/package.json +10 -10
package/CHANGELOG.md
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
# @critical-path/svelte
|
|
2
2
|
|
|
3
|
-
## 0.
|
|
3
|
+
## 1.0.0
|
|
4
4
|
|
|
5
|
-
###
|
|
5
|
+
### Major Changes
|
|
6
6
|
|
|
7
|
-
-
|
|
7
|
+
- 283e450: Modernize `@critical-path/svelte` for Svelte 5 Runes:
|
|
8
8
|
- Replaced Svelte 4 legacy stores (`createProjectStore`, `createTaskStore`) with Svelte 5 Runes state classes and factories (`ProjectState`, `createProjectState`, `TaskState`, `createTaskState`).
|
|
9
9
|
- Updated peer dependency requirement to `svelte: ^5.0.0`.
|
|
10
10
|
- Components now access reactive state properties directly (e.g. `taskState.data`, `projectState.loading`) without `$` store auto-subscriptions.
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Jack James
|
|
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.
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { CriticalPathClient, type ClientOptions } from '@critical-path/client';
|
|
2
|
+
export declare function createCriticalPathClient(options: ClientOptions): CriticalPathClient;
|
|
3
|
+
export * from './project-state.svelte.js';
|
|
4
|
+
export * from './task-state.svelte.js';
|
|
5
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,KAAK,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAE/E,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,aAAa,GAAG,kBAAkB,CAEnF;AAED,cAAc,2BAA2B,CAAC;AAC1C,cAAc,wBAAwB,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { CriticalPathClient as e } from "@critical-path/client";
|
|
2
|
+
import * as t from "svelte/internal/client";
|
|
3
|
+
//#region src/project-state.svelte.ts
|
|
4
|
+
var n = class {
|
|
5
|
+
client;
|
|
6
|
+
#e = t.state(t.proxy([]));
|
|
7
|
+
get data() {
|
|
8
|
+
return t.get(this.#e);
|
|
9
|
+
}
|
|
10
|
+
set data(e) {
|
|
11
|
+
t.set(this.#e, e, !0);
|
|
12
|
+
}
|
|
13
|
+
#t = t.state(!1);
|
|
14
|
+
get loading() {
|
|
15
|
+
return t.get(this.#t);
|
|
16
|
+
}
|
|
17
|
+
set loading(e) {
|
|
18
|
+
t.set(this.#t, e, !0);
|
|
19
|
+
}
|
|
20
|
+
#n = t.state(null);
|
|
21
|
+
get error() {
|
|
22
|
+
return t.get(this.#n);
|
|
23
|
+
}
|
|
24
|
+
set error(e) {
|
|
25
|
+
t.set(this.#n, e, !0);
|
|
26
|
+
}
|
|
27
|
+
constructor(e) {
|
|
28
|
+
this.client = e;
|
|
29
|
+
}
|
|
30
|
+
async fetch() {
|
|
31
|
+
this.loading = !0, this.error = null;
|
|
32
|
+
try {
|
|
33
|
+
this.data = await this.client.getProjects();
|
|
34
|
+
} catch (e) {
|
|
35
|
+
this.error = e instanceof Error ? e : Error(String(e));
|
|
36
|
+
} finally {
|
|
37
|
+
this.loading = !1;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
async createProject(e) {
|
|
41
|
+
let t = await this.client.createProject(e);
|
|
42
|
+
return this.data = [...this.data, t], t;
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
function r(e) {
|
|
46
|
+
return new n(e);
|
|
47
|
+
}
|
|
48
|
+
//#endregion
|
|
49
|
+
//#region src/task-state.svelte.ts
|
|
50
|
+
var i = class {
|
|
51
|
+
client;
|
|
52
|
+
projectId;
|
|
53
|
+
#e = t.state(t.proxy([]));
|
|
54
|
+
get data() {
|
|
55
|
+
return t.get(this.#e);
|
|
56
|
+
}
|
|
57
|
+
set data(e) {
|
|
58
|
+
t.set(this.#e, e, !0);
|
|
59
|
+
}
|
|
60
|
+
#t = t.state(!1);
|
|
61
|
+
get loading() {
|
|
62
|
+
return t.get(this.#t);
|
|
63
|
+
}
|
|
64
|
+
set loading(e) {
|
|
65
|
+
t.set(this.#t, e, !0);
|
|
66
|
+
}
|
|
67
|
+
#n = t.state(null);
|
|
68
|
+
get error() {
|
|
69
|
+
return t.get(this.#n);
|
|
70
|
+
}
|
|
71
|
+
set error(e) {
|
|
72
|
+
t.set(this.#n, e, !0);
|
|
73
|
+
}
|
|
74
|
+
constructor(e, t) {
|
|
75
|
+
this.client = e, this.projectId = t;
|
|
76
|
+
}
|
|
77
|
+
async fetch() {
|
|
78
|
+
this.loading = !0, this.error = null;
|
|
79
|
+
try {
|
|
80
|
+
this.data = await this.client.getTasks(this.projectId);
|
|
81
|
+
} catch (e) {
|
|
82
|
+
this.error = e instanceof Error ? e : Error(String(e));
|
|
83
|
+
} finally {
|
|
84
|
+
this.loading = !1;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
async createTask(e) {
|
|
88
|
+
let t = await this.client.createTask(e);
|
|
89
|
+
return this.data = [...this.data, t], t;
|
|
90
|
+
}
|
|
91
|
+
async updateTaskStatus(e, t) {
|
|
92
|
+
let n = await this.client.updateTask(e, { status: t }), r = this.data.findIndex((t) => t.id === e);
|
|
93
|
+
return r !== -1 && (this.data[r] = n), n;
|
|
94
|
+
}
|
|
95
|
+
async deleteTask(e) {
|
|
96
|
+
await this.client.deleteTask(e), this.data = this.data.filter((t) => t.id !== e);
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
function a(e, t) {
|
|
100
|
+
return new i(e, t);
|
|
101
|
+
}
|
|
102
|
+
//#endregion
|
|
103
|
+
//#region src/index.ts
|
|
104
|
+
function o(t) {
|
|
105
|
+
return new e(t);
|
|
106
|
+
}
|
|
107
|
+
//#endregion
|
|
108
|
+
export { n as ProjectState, i as TaskState, o as createCriticalPathClient, r as createProjectState, a as createTaskState };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.test.d.ts","sourceRoot":"","sources":["../src/index.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { CriticalPathClient } from '@critical-path/client';
|
|
2
|
+
import type { Project } from '@critical-path/core';
|
|
3
|
+
export declare class ProjectState {
|
|
4
|
+
private client;
|
|
5
|
+
data: Project[];
|
|
6
|
+
loading: boolean;
|
|
7
|
+
error: Error | null;
|
|
8
|
+
constructor(client: CriticalPathClient);
|
|
9
|
+
fetch(): Promise<void>;
|
|
10
|
+
createProject(input: Omit<Project, 'id' | 'createdAt' | 'updatedAt'>): Promise<Project>;
|
|
11
|
+
}
|
|
12
|
+
export declare function createProjectState(client: CriticalPathClient): ProjectState;
|
|
13
|
+
//# sourceMappingURL=project-state.svelte.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"project-state.svelte.d.ts","sourceRoot":"","sources":["../src/project-state.svelte.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAChE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAEnD,qBAAa,YAAY;IAKX,OAAO,CAAC,MAAM;IAJ1B,IAAI,YAAyB;IAC7B,OAAO,UAA0B;IACjC,KAAK,eAA8B;gBAEf,MAAM,EAAE,kBAAkB;IAExC,KAAK;IAYL,aAAa,CAAC,KAAK,EAAE,IAAI,CAAC,OAAO,EAAE,IAAI,GAAG,WAAW,GAAG,WAAW,CAAC;CAK3E;AAED,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,kBAAkB,GAAG,YAAY,CAE3E"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { CriticalPathClient } from '@critical-path/client';
|
|
2
|
+
import type { Task, TaskStatus } from '@critical-path/core';
|
|
3
|
+
export declare class TaskState {
|
|
4
|
+
private client;
|
|
5
|
+
projectId?: string | undefined;
|
|
6
|
+
data: Task[];
|
|
7
|
+
loading: boolean;
|
|
8
|
+
error: Error | null;
|
|
9
|
+
constructor(client: CriticalPathClient, projectId?: string | undefined);
|
|
10
|
+
fetch(): Promise<void>;
|
|
11
|
+
createTask(input: Omit<Task, 'id' | 'createdAt' | 'updatedAt'>): Promise<Task>;
|
|
12
|
+
updateTaskStatus(taskId: string, status: TaskStatus): Promise<Task>;
|
|
13
|
+
deleteTask(taskId: string): Promise<void>;
|
|
14
|
+
}
|
|
15
|
+
export declare function createTaskState(client: CriticalPathClient, projectId?: string): TaskState;
|
|
16
|
+
//# sourceMappingURL=task-state.svelte.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"task-state.svelte.d.ts","sourceRoot":"","sources":["../src/task-state.svelte.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAChE,OAAO,KAAK,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAE5D,qBAAa,SAAS;IAMlB,OAAO,CAAC,MAAM;IACP,SAAS,CAAC,EAAE,MAAM;IAN3B,IAAI,SAAsB;IAC1B,OAAO,UAA0B;IACjC,KAAK,eAA8B;gBAGzB,MAAM,EAAE,kBAAkB,EAC3B,SAAS,CAAC,EAAE,MAAM,YAAA;IAGrB,KAAK;IAYL,UAAU,CAAC,KAAK,EAAE,IAAI,CAAC,IAAI,EAAE,IAAI,GAAG,WAAW,GAAG,WAAW,CAAC;IAM9D,gBAAgB,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU;IASnD,UAAU,CAAC,MAAM,EAAE,MAAM;CAIhC;AAED,wBAAgB,eAAe,CAC7B,MAAM,EAAE,kBAAkB,EAC1B,SAAS,CAAC,EAAE,MAAM,GACjB,SAAS,CAEX"}
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@critical-path/svelte",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"description": "Svelte 5 Runes state and reactive integrations for Critical Path headless project management framework",
|
|
5
5
|
"author": "Jack James",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"repository": {
|
|
8
8
|
"type": "git",
|
|
9
|
-
"url": "git+https://github.com/Pixerate/
|
|
9
|
+
"url": "git+https://github.com/Pixerate/critical-path.git"
|
|
10
10
|
},
|
|
11
11
|
"type": "module",
|
|
12
12
|
"main": "./dist/index.js",
|
|
@@ -17,14 +17,9 @@
|
|
|
17
17
|
"types": "./dist/index.d.ts"
|
|
18
18
|
}
|
|
19
19
|
},
|
|
20
|
-
"scripts": {
|
|
21
|
-
"build": "vite build && tsc --emitDeclarationOnly",
|
|
22
|
-
"test": "vitest run",
|
|
23
|
-
"clean": "rm -rf dist *.tsbuildinfo"
|
|
24
|
-
},
|
|
25
20
|
"dependencies": {
|
|
26
|
-
"@critical-path/client": "
|
|
27
|
-
"@critical-path/core": "
|
|
21
|
+
"@critical-path/client": "0.1.3",
|
|
22
|
+
"@critical-path/core": "0.2.0"
|
|
28
23
|
},
|
|
29
24
|
"peerDependencies": {
|
|
30
25
|
"svelte": "^5.0.0"
|
|
@@ -39,5 +34,10 @@
|
|
|
39
34
|
},
|
|
40
35
|
"engines": {
|
|
41
36
|
"node": ">=24.0.0"
|
|
37
|
+
},
|
|
38
|
+
"scripts": {
|
|
39
|
+
"build": "vite build && tsc --emitDeclarationOnly",
|
|
40
|
+
"test": "vitest run",
|
|
41
|
+
"clean": "rm -rf dist *.tsbuildinfo"
|
|
42
42
|
}
|
|
43
|
-
}
|
|
43
|
+
}
|