@pie-element/complex-rubric 7.1.0-next.28 → 7.1.1-next.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.
Files changed (118) hide show
  1. package/dist/author/defaults.d.ts +231 -0
  2. package/dist/author/defaults.js +177 -0
  3. package/dist/author/index.d.ts +34 -0
  4. package/dist/author/index.js +87 -0
  5. package/dist/author/main.d.ts +23 -0
  6. package/dist/author/main.js +106 -0
  7. package/dist/controller/defaults.d.ts +39 -0
  8. package/dist/controller/defaults.js +42 -0
  9. package/dist/controller/index.d.ts +25 -0
  10. package/dist/controller/index.js +107 -0
  11. package/dist/controller/utils.d.ts +9 -0
  12. package/dist/controller/utils.js +4 -0
  13. package/dist/delivery/index.d.ts +23 -0
  14. package/dist/delivery/index.js +96 -0
  15. package/dist/index.d.ts +1 -0
  16. package/dist/index.iife.d.ts +8 -0
  17. package/dist/index.iife.js +145 -0
  18. package/dist/index.js +2 -0
  19. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Symbol.js +5 -0
  20. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_apply.js +12 -0
  21. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_arrayLikeKeys.js +15 -0
  22. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseGetTag.js +10 -0
  23. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsArguments.js +9 -0
  24. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsNative.js +11 -0
  25. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsTypedArray.js +11 -0
  26. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseKeysIn.js +13 -0
  27. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseRest.js +9 -0
  28. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseSetToString.js +14 -0
  29. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseTimes.js +7 -0
  30. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseUnary.js +8 -0
  31. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_coreJsData.js +5 -0
  32. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_defineProperty.js +10 -0
  33. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_freeGlobal.js +4 -0
  34. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getNative.js +9 -0
  35. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getRawTag.js +14 -0
  36. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getValue.js +6 -0
  37. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_isIndex.js +8 -0
  38. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_isIterateeCall.js +12 -0
  39. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_isMasked.js +11 -0
  40. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_isPrototype.js +8 -0
  41. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_nativeKeysIn.js +8 -0
  42. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_nodeUtil.js +9 -0
  43. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_objectToString.js +7 -0
  44. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_overRest.js +13 -0
  45. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_root.js +5 -0
  46. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_setToString.js +6 -0
  47. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_shortOut.js +14 -0
  48. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_toSource.js +15 -0
  49. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/constant.js +8 -0
  50. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/defaults.js +16 -0
  51. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/eq.js +6 -0
  52. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/identity.js +6 -0
  53. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isArguments.js +10 -0
  54. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isArray.js +4 -0
  55. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isArrayLike.js +8 -0
  56. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isBuffer.js +6 -0
  57. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isFunction.js +11 -0
  58. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isLength.js +7 -0
  59. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isObject.js +7 -0
  60. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isObjectLike.js +6 -0
  61. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isTypedArray.js +7 -0
  62. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/keysIn.js +9 -0
  63. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/stubFalse.js +6 -0
  64. package/dist/print/index.d.ts +24 -0
  65. package/dist/print/index.js +84 -0
  66. package/package.json +58 -21
  67. package/CHANGELOG.md +0 -1431
  68. package/LICENSE.md +0 -5
  69. package/README.md +0 -3
  70. package/configure/CHANGELOG.md +0 -1085
  71. package/configure/lib/defaults.js +0 -271
  72. package/configure/lib/defaults.js.map +0 -1
  73. package/configure/lib/index.js +0 -150
  74. package/configure/lib/index.js.map +0 -1
  75. package/configure/lib/main.js +0 -172
  76. package/configure/lib/main.js.map +0 -1
  77. package/configure/package.json +0 -27
  78. package/configure/src/__tests__/index.test.js +0 -94
  79. package/configure/src/__tests__/main.test.jsx +0 -140
  80. package/configure/src/defaults.js +0 -213
  81. package/configure/src/index.js +0 -169
  82. package/configure/src/main.jsx +0 -162
  83. package/controller/CHANGELOG.md +0 -928
  84. package/controller/lib/defaults.js +0 -42
  85. package/controller/lib/defaults.js.map +0 -1
  86. package/controller/lib/index.js +0 -239
  87. package/controller/lib/index.js.map +0 -1
  88. package/controller/lib/utils.js +0 -11
  89. package/controller/lib/utils.js.map +0 -1
  90. package/controller/package.json +0 -16
  91. package/controller/src/__tests__/index.test.js +0 -55
  92. package/controller/src/defaults.js +0 -39
  93. package/controller/src/index.js +0 -220
  94. package/controller/src/utils.js +0 -3
  95. package/docs/config-schema.json +0 -4255
  96. package/docs/config-schema.json.md +0 -3162
  97. package/docs/demo/config.js +0 -8
  98. package/docs/demo/generate.js +0 -196
  99. package/docs/demo/index.html +0 -1
  100. package/docs/demo/session.js +0 -6
  101. package/docs/pie-schema.json +0 -3302
  102. package/docs/pie-schema.json.md +0 -2364
  103. package/lib/index.js +0 -141
  104. package/lib/index.js.map +0 -1
  105. package/lib/print.js +0 -129
  106. package/lib/print.js.map +0 -1
  107. package/module/configure.js +0 -1
  108. package/module/controller.js +0 -262
  109. package/module/demo.js +0 -221
  110. package/module/element.js +0 -1
  111. package/module/index.html +0 -21
  112. package/module/manifest.json +0 -22
  113. package/module/print-demo.js +0 -259
  114. package/module/print.html +0 -18
  115. package/module/print.js +0 -1
  116. package/src/__tests__/index.test.js +0 -256
  117. package/src/index.js +0 -152
  118. package/src/print.js +0 -140
@@ -0,0 +1,42 @@
1
+ //#region src/controller/defaults.ts
2
+ var e = {
3
+ SIMPLE_RUBRIC: "simpleRubric",
4
+ MULTI_TRAIT_RUBRIC: "multiTraitRubric",
5
+ rubricless: "rubricless"
6
+ }, t = {
7
+ description: !1,
8
+ excludeZero: !1,
9
+ halfScoring: !1,
10
+ pointLabels: !0,
11
+ scales: [],
12
+ standards: !1,
13
+ visibleToStudent: !0
14
+ }, n = {
15
+ points: [
16
+ "",
17
+ "",
18
+ "",
19
+ ""
20
+ ],
21
+ sampleAnswers: [
22
+ null,
23
+ null,
24
+ null,
25
+ null
26
+ ],
27
+ maxPoints: 3,
28
+ excludeZero: !1
29
+ }, r = {
30
+ maxPoints: 100,
31
+ excludeZero: !1,
32
+ rubriclessInstructionEnabled: !0
33
+ }, i = {
34
+ rubricType: "simpleRubric",
35
+ rubrics: {
36
+ [e.SIMPLE_RUBRIC]: n,
37
+ [e.MULTI_TRAIT_RUBRIC]: t,
38
+ [e.RUBRICLESS]: r
39
+ }
40
+ };
41
+ //#endregion
42
+ export { i as default };
@@ -0,0 +1,25 @@
1
+ /**
2
+ * @synced-from pie-elements/packages/complex-rubric/controller/src/index.js
3
+ * @auto-generated
4
+ *
5
+ * This file is automatically synced from pie-elements and converted to TypeScript.
6
+ * Manual edits will be overwritten on next sync.
7
+ * To make changes, edit the upstream JavaScript file and run sync again.
8
+ */
9
+ export declare function createDefaultModel(model?: {}): Promise<unknown>;
10
+ export declare const normalize: (question: any) => any;
11
+ /**
12
+ * @param {*} question
13
+ * @param {*} session
14
+ * @param {*} env
15
+ */
16
+ export declare function model(question: any, session: any, env: any): Promise<any>;
17
+ export declare const getScore: () => number;
18
+ /**
19
+ * @param {Object} model - the main model
20
+ * @param {*} session
21
+ * @param {Object} env
22
+ */
23
+ export declare function outcome(): Promise<unknown>;
24
+ export declare const createCorrectResponseSession: (question: any, env: any) => Promise<unknown>;
25
+ export declare const validate: (model?: {}, config?: {}) => {};
@@ -0,0 +1,107 @@
1
+ import e from "./defaults.js";
2
+ import { markupToText as t } from "./utils.js";
3
+ //#region src/controller/index.ts
4
+ var n = {
5
+ SIMPLE_RUBRIC: "simpleRubric",
6
+ MULTI_TRAIT_RUBRIC: "multiTraitRubric",
7
+ rubricless: "rubricless"
8
+ };
9
+ function r(t = {}) {
10
+ return new Promise((n) => n({
11
+ ...e,
12
+ ...t
13
+ }));
14
+ }
15
+ var i = (t) => ({
16
+ ...e,
17
+ ...t
18
+ });
19
+ async function a(e, t, r) {
20
+ let a = i(e);
21
+ if (a.rubricType === n.SIMPLE_RUBRIC || a.rubricType === n.RUBRICLESS) return new Promise((e) => {
22
+ e(r && r.role && r.role === "instructor" ? {
23
+ ...a,
24
+ rubrics: {
25
+ ...a.rubrics,
26
+ multiTraitRubric: {
27
+ ...a.rubrics.multiTraitRubric,
28
+ visible: !1
29
+ }
30
+ }
31
+ } : {});
32
+ });
33
+ {
34
+ !r.role || r.role === "student" && a.rubrics && a.rubrics.multiTraitRubric ? a.rubrics.multiTraitRubric.visible = a.visibleToStudent : a.rubrics.multiTraitRubric.visible = !0;
35
+ let { scales: e, excludeZero: t } = a.rubrics.multiTraitRubric || {}, n = (e || []).map((e) => ({
36
+ ...e,
37
+ excludeZero: t
38
+ }));
39
+ return {
40
+ ...a,
41
+ rubrics: {
42
+ ...a.rubrics,
43
+ simpleRubric: {
44
+ ...a.rubrics.simpleRubric,
45
+ visible: !1
46
+ },
47
+ rubricless: {
48
+ ...a.rubrics.rubricless,
49
+ visible: !1
50
+ },
51
+ multiTraitRubric: {
52
+ ...a.rubrics.multiTraitRubric,
53
+ scales: n
54
+ }
55
+ }
56
+ };
57
+ }
58
+ }
59
+ var o = () => 0;
60
+ function s() {
61
+ return new Promise((e) => e({
62
+ score: 0,
63
+ empty: !0
64
+ }));
65
+ }
66
+ var c = (e, t) => new Promise((e) => {
67
+ t.mode !== "evaluate" && t.role === "instructor" ? e({ id: "1" }) : e(null);
68
+ }), l = (e) => {
69
+ let { points: n } = e, r = {}, i = {};
70
+ return (n || []).forEach((e, r) => {
71
+ !e || e === "<div></div>" ? i[r] = "Points descriptors cannot be empty." : n.slice(r + 1).some((n) => t(n) === t(e)) && (i[r] = "Points descriptors should be unique.");
72
+ }), Object.keys(i).length > 0 && (r.pointsDescriptorsErrors = i), r;
73
+ }, u = (e) => {
74
+ let { scales: n, description: r = !1, pointLabels: i = !1 } = e, a = {}, o = {}, s = {};
75
+ return (n || []).forEach((e, n) => {
76
+ let { traits: a = [] } = e, { scorePointsLabels: c = [] } = e, l = {}, u = {};
77
+ i && c.forEach((e, n) => {
78
+ !e || e === "<div></div>" ? u[n] = "Points labels should not be empty." : c.slice(n + 1).some((n) => t(n) === t(e)) && (u[n] = "Points labels should be unique.");
79
+ }), Object.keys(u).length > 0 && (s[n] = u), a.forEach((e, n) => {
80
+ if (!e.name || e.name === "<div></div>" ? l[n] = { name: "Trait names should not be empty." } : a.slice(n + 1).some((n) => t(n.name) === t(e.name)) && (l[n] = { name: "Trait names should be unique." }), r && (!e.description || e.description === "<div></div>")) l[n] = {
81
+ ...l[n],
82
+ description: "Trait description should not be empty"
83
+ };
84
+ else {
85
+ let i = a.slice(n + 1).some((n) => t(n.description) === t(e.description));
86
+ r && i && (l[n] = {
87
+ ...l[n],
88
+ description: "Trait descriptions should be unique."
89
+ });
90
+ }
91
+ }), Object.keys(l).length > 0 && (o[n] = l);
92
+ }), Object.keys(o).length > 0 && (a.traitsErrors = o), Object.keys(s).length > 0 && (a.scorePointsErrors = s), a;
93
+ }, d = (e = {}, t = {}) => {
94
+ let { rubrics: r = {}, rubricType: i } = e, { multiTraitRubric: a = {}, simpleRubric: o = {} } = r, s = {};
95
+ switch (i) {
96
+ case n.SIMPLE_RUBRIC:
97
+ default:
98
+ s = l(o);
99
+ break;
100
+ case n.MULTI_TRAIT_RUBRIC:
101
+ s = u(a);
102
+ break;
103
+ }
104
+ return s;
105
+ };
106
+ //#endregion
107
+ export { c as createCorrectResponseSession, r as createDefaultModel, o as getScore, a as model, i as normalize, s as outcome, d as validate };
@@ -0,0 +1,9 @@
1
+ /**
2
+ * @synced-from pie-elements/packages/complex-rubric/controller/src/utils.js
3
+ * @auto-generated
4
+ *
5
+ * This file is automatically synced from pie-elements and converted to TypeScript.
6
+ * Manual edits will be overwritten on next sync.
7
+ * To make changes, edit the upstream JavaScript file and run sync again.
8
+ */
9
+ export declare const markupToText: (s: any) => any;
@@ -0,0 +1,4 @@
1
+ //#region src/controller/utils.ts
2
+ var e = (e) => (e || "").replace(/(<([^>]+)>)/gi, "");
3
+ //#endregion
4
+ export { e as markupToText };
@@ -0,0 +1,23 @@
1
+ /**
2
+ * @synced-from pie-elements/packages/complex-rubric/src/index.js
3
+ * @auto-generated
4
+ *
5
+ * This file is automatically synced from pie-elements and converted to TypeScript.
6
+ * Manual edits will be overwritten on next sync.
7
+ * To make changes, edit the upstream JavaScript file and run sync again.
8
+ */
9
+ declare class ComplexRubric extends HTMLElement {
10
+ constructor();
11
+ set type(t: any);
12
+ get type(): any;
13
+ set model(m: any);
14
+ setRubricModel(simpleRubric: any): void;
15
+ setMultiTraitRubricModel(multiTraitRubric: any): void;
16
+ setRubriclessModel(rubricless: any): void;
17
+ get multiTraitRubric(): Element | null;
18
+ get simpleRubric(): Element | null;
19
+ get rubricless(): Element | null;
20
+ connectedCallback(): void;
21
+ _render(): void;
22
+ }
23
+ export default ComplexRubric;
@@ -0,0 +1,96 @@
1
+ import e from "@pie-element/rubric";
2
+ import t from "@pie-element/multi-trait-rubric";
3
+ import { RUBRIC_TYPES as n } from "@pie-lib/rubric";
4
+ //#region src/delivery/index.ts
5
+ var r = "complex-rubric-simple", i = "complex-rubric-multi-trait", a = class extends e {}, o = class extends t {};
6
+ customElements.get(r) || customElements.define(r, a), customElements.get(i) || customElements.define(i, o);
7
+ var s = class extends HTMLElement {
8
+ constructor() {
9
+ super(), this._model = {}, this._type = n.SIMPLE_RUBRIC;
10
+ }
11
+ set type(e) {
12
+ this._type = e;
13
+ }
14
+ get type() {
15
+ return this._type;
16
+ }
17
+ set model(e) {
18
+ this._model = e;
19
+ let t = this._type;
20
+ switch (this.type = e.rubricType, this._type) {
21
+ case n.SIMPLE_RUBRIC:
22
+ default:
23
+ customElements.whenDefined(r).then(() => {
24
+ this.setRubricModel(this.simpleRubric);
25
+ });
26
+ break;
27
+ case n.MULTI_TRAIT_RUBRIC:
28
+ customElements.whenDefined(i).then(() => {
29
+ this.setMultiTraitRubricModel(this.multiTraitRubric);
30
+ });
31
+ break;
32
+ case n.RUBRICLESS:
33
+ customElements.whenDefined(r).then(() => {
34
+ this.setRubriclessModel(this.rubricless);
35
+ });
36
+ break;
37
+ }
38
+ t !== this.type && this._render();
39
+ }
40
+ setRubricModel(e) {
41
+ if (this._model && this._model.rubrics && this._model.rubrics.simpleRubric) {
42
+ let { mode: t } = this._model;
43
+ e.model = {
44
+ ...this._model.rubrics.simpleRubric,
45
+ mode: t
46
+ };
47
+ }
48
+ }
49
+ setMultiTraitRubricModel(e) {
50
+ if (this._model && this._model.rubrics && this._model.rubrics.multiTraitRubric) {
51
+ let { mode: t } = this._model;
52
+ e.model = {
53
+ ...this._model.rubrics.multiTraitRubric,
54
+ mode: t
55
+ };
56
+ }
57
+ }
58
+ setRubriclessModel(e) {
59
+ if (this._model && this._model.rubrics && this._model.rubrics.rubricless) {
60
+ let { mode: t } = this._model;
61
+ e.model = {
62
+ ...this._model.rubrics.rubricless,
63
+ mode: t
64
+ };
65
+ }
66
+ }
67
+ get multiTraitRubric() {
68
+ return this.querySelector(`${i}#multiTraitRubric`);
69
+ }
70
+ get simpleRubric() {
71
+ return this.querySelector(`${r}#simpleRubric`);
72
+ }
73
+ get rubricless() {
74
+ return this.querySelector(`${r}#rubricless`);
75
+ }
76
+ connectedCallback() {
77
+ this._render();
78
+ }
79
+ _render() {
80
+ let e;
81
+ switch (e = this._type === n.SIMPLE_RUBRIC ? `<${r} id="simpleRubric" />` : this._type === n.RUBRICLESS ? `<${r} id="rubricless" />` : `<${i} id="multiTraitRubric" />`, this.innerHTML = e, this._type) {
82
+ case n.SIMPLE_RUBRIC:
83
+ default:
84
+ customElements.get(r) && this.setRubricModel(this.simpleRubric);
85
+ break;
86
+ case n.MULTI_TRAIT_RUBRIC:
87
+ customElements.get(i) && this.setMultiTraitRubricModel(this.multiTraitRubric);
88
+ break;
89
+ case n.RUBRICLESS:
90
+ customElements.get(r) && this.setRubriclessModel(this.rubricless);
91
+ break;
92
+ }
93
+ }
94
+ };
95
+ //#endregion
96
+ export { s as default };
@@ -0,0 +1 @@
1
+ export { default } from './delivery/index.js';
@@ -0,0 +1,8 @@
1
+ /**
2
+ * IIFE entry point for complex-rubric element
3
+ * This file is only used for IIFE builds and includes auto-registration
4
+ *
5
+ * @sync-generated - Auto-generated during sync from pie-elements
6
+ */
7
+ import Element from './index.js';
8
+ export default Element;