@citolab/tspci 2.5.1-alpha.0 → 2.5.2
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/package.json +2 -2
- package/preset/javascript/src/index.js +7 -1
- package/preset/preact/src/index.tsx +1 -0
- package/preset/typescript/src/index.ts +8 -3
- package/readme.md +1 -1
- package/src/cli.js +10 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@citolab/tspci",
|
|
3
|
-
"version": "2.5.
|
|
3
|
+
"version": "2.5.2",
|
|
4
4
|
"description": "an opiniated typescript ims-pci builder with tao integration",
|
|
5
5
|
"author": "patrick <patrick.deklein@cito.nl>",
|
|
6
6
|
"repository": "@citolab/tspci",
|
|
@@ -46,5 +46,5 @@
|
|
|
46
46
|
"rollup-plugin-watch-assets": "^1.0.1",
|
|
47
47
|
"tailwindcss": "^3.4.11"
|
|
48
48
|
},
|
|
49
|
-
"gitHead": "
|
|
49
|
+
"gitHead": "675cb6d40b418bac93a3e970d4d6dc4dc7c17bb5"
|
|
50
50
|
}
|
|
@@ -45,7 +45,7 @@ class Pci {
|
|
|
45
45
|
|
|
46
46
|
render = () => {
|
|
47
47
|
this.shadowdom.addEventListener("change", (e) => {
|
|
48
|
-
const value =
|
|
48
|
+
const value = e.target.value;
|
|
49
49
|
this.state = value;
|
|
50
50
|
});
|
|
51
51
|
this.shadowdom.innerHTML = `<div class="pci-container">
|
|
@@ -81,6 +81,12 @@ class Pci {
|
|
|
81
81
|
* @returns {string} - The current state of the PCI.
|
|
82
82
|
*/
|
|
83
83
|
getState = () => this.state.toString();
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* @method oncompleted
|
|
87
|
+
* @description called when the PCI is completed.
|
|
88
|
+
*/
|
|
89
|
+
oncompleted = () => {};
|
|
84
90
|
}
|
|
85
91
|
|
|
86
92
|
export default new Pci();
|
|
@@ -32,8 +32,8 @@ class Pci implements IMSpci<PropTypes> {
|
|
|
32
32
|
};
|
|
33
33
|
|
|
34
34
|
private render = () => {
|
|
35
|
-
this.shadowdom.addEventListener("change", (e) => {
|
|
36
|
-
const value = (e.target)
|
|
35
|
+
this.shadowdom.addEventListener("change", (e: Event) => {
|
|
36
|
+
const value = (e.target as HTMLInputElement)?.value || "";
|
|
37
37
|
this.state = value;
|
|
38
38
|
});
|
|
39
39
|
this.shadowdom.innerHTML = `<div class="pci-container">
|
|
@@ -52,11 +52,16 @@ class Pci implements IMSpci<PropTypes> {
|
|
|
52
52
|
};
|
|
53
53
|
|
|
54
54
|
getResponse = () => {
|
|
55
|
-
const response =
|
|
55
|
+
const response =
|
|
56
|
+
this.state === null || this.state === undefined
|
|
57
|
+
? undefined
|
|
58
|
+
: ({ base: { integer: this.state } } as QtiVariableJSON);
|
|
56
59
|
return response;
|
|
57
60
|
};
|
|
58
61
|
|
|
59
62
|
getState = () => this.state.toString();
|
|
63
|
+
|
|
64
|
+
oncompleted = () => {};
|
|
60
65
|
}
|
|
61
66
|
|
|
62
67
|
export default new Pci();
|
package/readme.md
CHANGED
|
@@ -38,7 +38,7 @@ Run: ```npx @citolab/tspci@latest init```
|
|
|
38
38
|
2. If agreed; tspci will be downloaded and started.
|
|
39
39
|
3. You should provide a name/identifier for your PCI.
|
|
40
40
|
4. You should provide a description.
|
|
41
|
-
5. Last option is to
|
|
41
|
+
5. Last option is to choose how you want to build your pci, using tailwind and preact, typescript or javascript
|
|
42
42
|
|
|
43
43
|
#### Tailwind
|
|
44
44
|
Tailwind is a popular css framework and can be used to give a nice look and feel of the PCI. The cli will make sure the css is added; and all build stuff that comes with tailwind is setup.
|
package/src/cli.js
CHANGED
|
@@ -349,7 +349,11 @@ const run = async () => {
|
|
|
349
349
|
}
|
|
350
350
|
|
|
351
351
|
if (options.values.includes("typescript")) {
|
|
352
|
-
|
|
352
|
+
copyDirAndReplaceInFiles(
|
|
353
|
+
path.resolve(cliPath, "./../preset/typescript/src"),
|
|
354
|
+
path.join(destinationFolder, "src"),
|
|
355
|
+
pciName
|
|
356
|
+
);
|
|
353
357
|
// point to the javascript file
|
|
354
358
|
const packageJson = path.join(destinationFolder, "package.json");
|
|
355
359
|
const packageJsonContent = fs.readFileSync(packageJson, "utf8");
|
|
@@ -360,7 +364,11 @@ const run = async () => {
|
|
|
360
364
|
}
|
|
361
365
|
|
|
362
366
|
if (options.values.includes("javascript")) {
|
|
363
|
-
|
|
367
|
+
copyDirAndReplaceInFiles(
|
|
368
|
+
path.resolve(cliPath, "./../preset/javascript/src"),
|
|
369
|
+
path.join(destinationFolder, "src"),
|
|
370
|
+
pciName
|
|
371
|
+
);
|
|
364
372
|
// point to the javascript file
|
|
365
373
|
const packageJson = path.join(destinationFolder, "package.json");
|
|
366
374
|
const packageJsonContent = fs.readFileSync(packageJson, "utf8");
|