@pie-element/complex-rubric 0.0.2-next.4424

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 (121) hide show
  1. package/LICENSE.md +5 -0
  2. package/README.md +3 -0
  3. package/configure/lib/defaults.js +99 -0
  4. package/configure/lib/defaults.js.map +1 -0
  5. package/configure/lib/index.js +232 -0
  6. package/configure/lib/index.js.map +1 -0
  7. package/configure/lib/main.js +165 -0
  8. package/configure/lib/main.js.map +1 -0
  9. package/configure/node_modules/@pie-element/multi-trait-rubric/CHANGELOG.json +1 -0
  10. package/configure/node_modules/@pie-element/multi-trait-rubric/CHANGELOG.md +376 -0
  11. package/configure/node_modules/@pie-element/multi-trait-rubric/LICENSE.md +5 -0
  12. package/configure/node_modules/@pie-element/multi-trait-rubric/README.md +55 -0
  13. package/configure/node_modules/@pie-element/multi-trait-rubric/configure/CHANGELOG.json +1 -0
  14. package/configure/node_modules/@pie-element/multi-trait-rubric/configure/CHANGELOG.md +344 -0
  15. package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/common.js +455 -0
  16. package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/common.js.map +1 -0
  17. package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/defaults.js +82 -0
  18. package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/defaults.js.map +1 -0
  19. package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/index.js +112 -0
  20. package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/index.js.map +1 -0
  21. package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/main.js +438 -0
  22. package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/main.js.map +1 -0
  23. package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/modals.js +324 -0
  24. package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/modals.js.map +1 -0
  25. package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/scale.js +490 -0
  26. package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/scale.js.map +1 -0
  27. package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/trait.js +334 -0
  28. package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/trait.js.map +1 -0
  29. package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/traitsHeader.js +254 -0
  30. package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/traitsHeader.js.map +1 -0
  31. package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/utils.js +29 -0
  32. package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/utils.js.map +1 -0
  33. package/configure/node_modules/@pie-element/multi-trait-rubric/configure/package.json +22 -0
  34. package/configure/node_modules/@pie-element/multi-trait-rubric/controller/CHANGELOG.json +1 -0
  35. package/configure/node_modules/@pie-element/multi-trait-rubric/controller/CHANGELOG.md +66 -0
  36. package/configure/node_modules/@pie-element/multi-trait-rubric/controller/lib/defaults.js +9 -0
  37. package/configure/node_modules/@pie-element/multi-trait-rubric/controller/lib/defaults.js.map +1 -0
  38. package/configure/node_modules/@pie-element/multi-trait-rubric/controller/lib/index.js +122 -0
  39. package/configure/node_modules/@pie-element/multi-trait-rubric/controller/lib/index.js.map +1 -0
  40. package/configure/node_modules/@pie-element/multi-trait-rubric/controller/package.json +15 -0
  41. package/configure/node_modules/@pie-element/multi-trait-rubric/docs/config-schema.json +226 -0
  42. package/configure/node_modules/@pie-element/multi-trait-rubric/docs/config-schema.json.md +169 -0
  43. package/configure/node_modules/@pie-element/multi-trait-rubric/docs/demo/config.js +8 -0
  44. package/configure/node_modules/@pie-element/multi-trait-rubric/docs/demo/generate.js +108 -0
  45. package/configure/node_modules/@pie-element/multi-trait-rubric/docs/demo/index.html +1 -0
  46. package/configure/node_modules/@pie-element/multi-trait-rubric/docs/demo/session.js +6 -0
  47. package/configure/node_modules/@pie-element/multi-trait-rubric/docs/pie-schema.json +282 -0
  48. package/configure/node_modules/@pie-element/multi-trait-rubric/docs/pie-schema.json.md +189 -0
  49. package/configure/node_modules/@pie-element/multi-trait-rubric/lib/index.js +85 -0
  50. package/configure/node_modules/@pie-element/multi-trait-rubric/lib/index.js.map +1 -0
  51. package/configure/node_modules/@pie-element/multi-trait-rubric/lib/main.js +99 -0
  52. package/configure/node_modules/@pie-element/multi-trait-rubric/lib/main.js.map +1 -0
  53. package/configure/node_modules/@pie-element/multi-trait-rubric/lib/scale.js +209 -0
  54. package/configure/node_modules/@pie-element/multi-trait-rubric/lib/scale.js.map +1 -0
  55. package/configure/node_modules/@pie-element/multi-trait-rubric/lib/trait.js +103 -0
  56. package/configure/node_modules/@pie-element/multi-trait-rubric/lib/trait.js.map +1 -0
  57. package/configure/node_modules/@pie-element/multi-trait-rubric/package.json +24 -0
  58. package/configure/node_modules/@pie-element/rubric/CHANGELOG.json +257 -0
  59. package/configure/node_modules/@pie-element/rubric/CHANGELOG.md +731 -0
  60. package/configure/node_modules/@pie-element/rubric/LICENSE.md +5 -0
  61. package/configure/node_modules/@pie-element/rubric/README.md +3 -0
  62. package/configure/node_modules/@pie-element/rubric/configure/CHANGELOG.json +197 -0
  63. package/configure/node_modules/@pie-element/rubric/configure/CHANGELOG.md +615 -0
  64. package/configure/node_modules/@pie-element/rubric/configure/lib/index.js +93 -0
  65. package/configure/node_modules/@pie-element/rubric/configure/lib/index.js.map +1 -0
  66. package/configure/node_modules/@pie-element/rubric/configure/package.json +16 -0
  67. package/configure/node_modules/@pie-element/rubric/configure/src/index.js +38 -0
  68. package/configure/node_modules/@pie-element/rubric/controller/CHANGELOG.json +17 -0
  69. package/configure/node_modules/@pie-element/rubric/controller/CHANGELOG.md +105 -0
  70. package/configure/node_modules/@pie-element/rubric/controller/lib/index.js +14 -0
  71. package/configure/node_modules/@pie-element/rubric/controller/lib/index.js.map +1 -0
  72. package/configure/node_modules/@pie-element/rubric/controller/package.json +9 -0
  73. package/configure/node_modules/@pie-element/rubric/controller/src/__tests__/index.test.js +35 -0
  74. package/configure/node_modules/@pie-element/rubric/controller/src/index.js +6 -0
  75. package/configure/node_modules/@pie-element/rubric/docs/config-schema.json +24 -0
  76. package/configure/node_modules/@pie-element/rubric/docs/config-schema.json.md +19 -0
  77. package/configure/node_modules/@pie-element/rubric/docs/demo/config.js +8 -0
  78. package/configure/node_modules/@pie-element/rubric/docs/demo/generate.js +8 -0
  79. package/configure/node_modules/@pie-element/rubric/docs/demo/index.html +3 -0
  80. package/configure/node_modules/@pie-element/rubric/docs/pie-schema.json +62 -0
  81. package/configure/node_modules/@pie-element/rubric/docs/pie-schema.json.md +35 -0
  82. package/configure/node_modules/@pie-element/rubric/lib/index.js +88 -0
  83. package/configure/node_modules/@pie-element/rubric/lib/index.js.map +1 -0
  84. package/configure/node_modules/@pie-element/rubric/lib/main.js +171 -0
  85. package/configure/node_modules/@pie-element/rubric/lib/main.js.map +1 -0
  86. package/configure/node_modules/@pie-element/rubric/lib/print.js +114 -0
  87. package/configure/node_modules/@pie-element/rubric/lib/print.js.map +1 -0
  88. package/configure/node_modules/@pie-element/rubric/package.json +25 -0
  89. package/configure/node_modules/@pie-element/rubric/src/__tests__/__snapshots__/rubric-view.test.jsx.snap +22767 -0
  90. package/configure/node_modules/@pie-element/rubric/src/__tests__/rubric-view.test.jsx +48 -0
  91. package/configure/node_modules/@pie-element/rubric/src/index.js +38 -0
  92. package/configure/node_modules/@pie-element/rubric/src/main.jsx +117 -0
  93. package/configure/node_modules/@pie-element/rubric/src/print.js +63 -0
  94. package/configure/package.json +22 -0
  95. package/configure/src/__tests__/__snapshots__/main.test.jsx.snap +106 -0
  96. package/configure/src/__tests__/index.test.js +41 -0
  97. package/configure/src/__tests__/main.test.jsx +104 -0
  98. package/configure/src/defaults.js +122 -0
  99. package/configure/src/index.js +138 -0
  100. package/configure/src/main.jsx +117 -0
  101. package/controller/lib/defaults.js +99 -0
  102. package/controller/lib/defaults.js.map +1 -0
  103. package/controller/lib/index.js +147 -0
  104. package/controller/lib/index.js.map +1 -0
  105. package/controller/package.json +12 -0
  106. package/controller/src/__tests__/index.test.js +58 -0
  107. package/controller/src/defaults.js +121 -0
  108. package/controller/src/index.js +81 -0
  109. package/docs/config-schema.json +427 -0
  110. package/docs/config-schema.json.md +315 -0
  111. package/docs/demo/config.js +8 -0
  112. package/docs/demo/generate.js +119 -0
  113. package/docs/demo/index.html +1 -0
  114. package/docs/demo/session.js +6 -0
  115. package/docs/pie-schema.json +994 -0
  116. package/docs/pie-schema.json.md +660 -0
  117. package/lib/index.js +176 -0
  118. package/lib/index.js.map +1 -0
  119. package/package.json +25 -0
  120. package/src/__tests__/index.test.js +166 -0
  121. package/src/index.js +106 -0
package/lib/index.js ADDED
@@ -0,0 +1,176 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports["default"] = void 0;
9
+
10
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
11
+
12
+ var _wrapNativeSuper2 = _interopRequireDefault(require("@babel/runtime/helpers/wrapNativeSuper"));
13
+
14
+ var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
15
+
16
+ var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
17
+
18
+ var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
19
+
20
+ var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
21
+
22
+ var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
23
+
24
+ var _rubric = _interopRequireDefault(require("@pie-element/rubric"));
25
+
26
+ var _multiTraitRubric = _interopRequireDefault(require("@pie-element/multi-trait-rubric"));
27
+
28
+ var _rubric2 = require("@pie-lib/rubric");
29
+
30
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
31
+
32
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
33
+
34
+ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2["default"])(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2["default"])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2["default"])(this, result); }; }
35
+
36
+ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
37
+
38
+ var RUBRIC_TAG_NAME = 'complex-rubric-simple';
39
+ var MULTI_TRAIT_RUBRIC_TAG_NAME = 'complex-rubric-multi-trait';
40
+
41
+ var ComplexRubricSimple = /*#__PURE__*/function (_Rubric) {
42
+ (0, _inherits2["default"])(ComplexRubricSimple, _Rubric);
43
+
44
+ var _super = _createSuper(ComplexRubricSimple);
45
+
46
+ function ComplexRubricSimple() {
47
+ (0, _classCallCheck2["default"])(this, ComplexRubricSimple);
48
+ return _super.apply(this, arguments);
49
+ }
50
+
51
+ return (0, _createClass2["default"])(ComplexRubricSimple);
52
+ }(_rubric["default"]);
53
+
54
+ var ComplexRubricMultiTrait = /*#__PURE__*/function (_MultiTraitRubric) {
55
+ (0, _inherits2["default"])(ComplexRubricMultiTrait, _MultiTraitRubric);
56
+
57
+ var _super2 = _createSuper(ComplexRubricMultiTrait);
58
+
59
+ function ComplexRubricMultiTrait() {
60
+ (0, _classCallCheck2["default"])(this, ComplexRubricMultiTrait);
61
+ return _super2.apply(this, arguments);
62
+ }
63
+
64
+ return (0, _createClass2["default"])(ComplexRubricMultiTrait);
65
+ }(_multiTraitRubric["default"]);
66
+
67
+ var defineRubrics = function defineRubrics() {
68
+ if (!customElements.get(RUBRIC_TAG_NAME)) {
69
+ customElements.define(RUBRIC_TAG_NAME, ComplexRubricSimple);
70
+ }
71
+
72
+ if (!customElements.get(MULTI_TRAIT_RUBRIC_TAG_NAME)) {
73
+ customElements.define(MULTI_TRAIT_RUBRIC_TAG_NAME, ComplexRubricMultiTrait);
74
+ }
75
+ };
76
+
77
+ defineRubrics();
78
+
79
+ var ComplexRubric = /*#__PURE__*/function (_HTMLElement) {
80
+ (0, _inherits2["default"])(ComplexRubric, _HTMLElement);
81
+
82
+ var _super3 = _createSuper(ComplexRubric);
83
+
84
+ function ComplexRubric() {
85
+ var _this;
86
+
87
+ (0, _classCallCheck2["default"])(this, ComplexRubric);
88
+ _this = _super3.call(this);
89
+ _this._model = {};
90
+ _this._type = _rubric2.RUBRIC_TYPES.SIMPLE_RUBRIC;
91
+ return _this;
92
+ }
93
+
94
+ (0, _createClass2["default"])(ComplexRubric, [{
95
+ key: "type",
96
+ get: function get() {
97
+ return this._type;
98
+ },
99
+ set: function set(t) {
100
+ this._type = t;
101
+ }
102
+ }, {
103
+ key: "model",
104
+ set: function set(m) {
105
+ var _this2 = this;
106
+
107
+ this._model = m;
108
+ var oldType = this._type;
109
+ this.type = m.rubricType;
110
+
111
+ switch (this._type) {
112
+ case _rubric2.RUBRIC_TYPES.SIMPLE_RUBRIC:
113
+ default:
114
+ customElements.whenDefined(RUBRIC_TAG_NAME).then(function () {
115
+ _this2.setRubricModel(_this2.simpleRubric);
116
+ });
117
+ break;
118
+
119
+ case _rubric2.RUBRIC_TYPES.MULTI_TRAIT_RUBRIC:
120
+ customElements.whenDefined(MULTI_TRAIT_RUBRIC_TAG_NAME).then(function () {
121
+ _this2.setMultiTraitRubricModel(_this2.multiTraitRubric);
122
+ });
123
+ break;
124
+ }
125
+
126
+ if (oldType !== this.type) {
127
+ this._render();
128
+ }
129
+ }
130
+ }, {
131
+ key: "setRubricModel",
132
+ value: function setRubricModel(simpleRubric) {
133
+ if (this._model && this._model.rubrics && this._model.rubrics.simpleRubric) {
134
+ var mode = this._model.mode;
135
+ simpleRubric.model = _objectSpread(_objectSpread({}, this._model.rubrics.simpleRubric), {}, {
136
+ mode: mode
137
+ });
138
+ }
139
+ }
140
+ }, {
141
+ key: "setMultiTraitRubricModel",
142
+ value: function setMultiTraitRubricModel(multiTraitRubric) {
143
+ if (this._model && this._model.rubrics && this._model.rubrics.multiTraitRubric) {
144
+ var mode = this._model.mode;
145
+ multiTraitRubric.model = _objectSpread(_objectSpread({}, this._model.rubrics.multiTraitRubric), {}, {
146
+ mode: mode
147
+ });
148
+ }
149
+ }
150
+ }, {
151
+ key: "multiTraitRubric",
152
+ get: function get() {
153
+ return this.querySelector("".concat(MULTI_TRAIT_RUBRIC_TAG_NAME, "#multiTraitRubric"));
154
+ }
155
+ }, {
156
+ key: "simpleRubric",
157
+ get: function get() {
158
+ return this.querySelector("".concat(RUBRIC_TAG_NAME, "#simpleRubric"));
159
+ }
160
+ }, {
161
+ key: "connectedCallback",
162
+ value: function connectedCallback() {
163
+ this._render();
164
+ }
165
+ }, {
166
+ key: "_render",
167
+ value: function _render() {
168
+ this.innerHTML = "\n <div>\n <div style=\"".concat(this._type === _rubric2.RUBRIC_TYPES.SIMPLE_RUBRIC ? "visibility: visible" : "visibility: hidden", "\"><").concat(RUBRIC_TAG_NAME, " id=\"simpleRubric\"></").concat(RUBRIC_TAG_NAME, "></div>\n <div style=\"").concat(this._type !== _rubric2.RUBRIC_TYPES.SIMPLE_RUBRIC ? "visibility: visible" : "visibility: hidden", "\"> <").concat(MULTI_TRAIT_RUBRIC_TAG_NAME, " id=\"multiTraitRubric\"></").concat(MULTI_TRAIT_RUBRIC_TAG_NAME, "></div>\n </div>\n ");
169
+ }
170
+ }]);
171
+ return ComplexRubric;
172
+ }( /*#__PURE__*/(0, _wrapNativeSuper2["default"])(HTMLElement));
173
+
174
+ var _default = ComplexRubric;
175
+ exports["default"] = _default;
176
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.js"],"names":["RUBRIC_TAG_NAME","MULTI_TRAIT_RUBRIC_TAG_NAME","ComplexRubricSimple","Rubric","ComplexRubricMultiTrait","MultiTraitRubric","defineRubrics","customElements","get","define","ComplexRubric","_model","_type","RUBRIC_TYPES","SIMPLE_RUBRIC","t","m","oldType","type","rubricType","whenDefined","then","setRubricModel","simpleRubric","MULTI_TRAIT_RUBRIC","setMultiTraitRubricModel","multiTraitRubric","_render","rubrics","mode","model","querySelector","innerHTML","HTMLElement"],"mappings":"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","sourcesContent":["import Rubric from '@pie-element/rubric';\nimport MultiTraitRubric from '@pie-element/multi-trait-rubric';\nimport { RUBRIC_TYPES } from '@pie-lib/rubric';\n\nconst RUBRIC_TAG_NAME = 'complex-rubric-simple';\nconst MULTI_TRAIT_RUBRIC_TAG_NAME = 'complex-rubric-multi-trait';\n\nclass ComplexRubricSimple extends Rubric {}\nclass ComplexRubricMultiTrait extends MultiTraitRubric {}\n\nconst defineRubrics = () => {\n if (!customElements.get(RUBRIC_TAG_NAME)) {\n customElements.define(RUBRIC_TAG_NAME, ComplexRubricSimple);\n }\n\n if (!customElements.get(MULTI_TRAIT_RUBRIC_TAG_NAME)) {\n customElements.define(MULTI_TRAIT_RUBRIC_TAG_NAME, ComplexRubricMultiTrait);\n }\n};\n\ndefineRubrics();\n\nclass ComplexRubric extends HTMLElement {\n constructor() {\n super();\n this._model = {};\n this._type = RUBRIC_TYPES.SIMPLE_RUBRIC;\n }\n\n set type(t) {\n this._type = t;\n }\n\n get type() {\n return this._type;\n }\n\n set model(m) {\n this._model = m;\n const oldType = this._type;\n this.type = m.rubricType;\n\n switch (this._type) {\n case RUBRIC_TYPES.SIMPLE_RUBRIC:\n default:\n customElements.whenDefined(RUBRIC_TAG_NAME).then(() => {\n this.setRubricModel(this.simpleRubric);\n });\n break;\n case RUBRIC_TYPES.MULTI_TRAIT_RUBRIC:\n customElements.whenDefined(MULTI_TRAIT_RUBRIC_TAG_NAME).then(() =>{\n this.setMultiTraitRubricModel(this.multiTraitRubric);\n });\n break;\n }\n\n if (oldType !== this.type) {\n this._render();\n }\n }\n\n setRubricModel(simpleRubric) {\n if (this._model && this._model.rubrics && this._model.rubrics.simpleRubric) {\n const { mode } = this._model;\n\n simpleRubric.model = {\n ...this._model.rubrics.simpleRubric,\n mode\n };\n }\n }\n\n setMultiTraitRubricModel(multiTraitRubric) {\n if (this._model && this._model.rubrics && this._model.rubrics.multiTraitRubric) {\n const { mode } = this._model;\n\n multiTraitRubric.model = {\n ...this._model.rubrics.multiTraitRubric,\n mode\n };\n }\n }\n\n get multiTraitRubric() {\n return this.querySelector(`${MULTI_TRAIT_RUBRIC_TAG_NAME}#multiTraitRubric`);\n }\n\n get simpleRubric() {\n return this.querySelector(`${RUBRIC_TAG_NAME}#simpleRubric`);\n }\n\n connectedCallback() {\n this._render();\n }\n\n _render() {\n this.innerHTML = `\n <div>\n <div style=\"${this._type === RUBRIC_TYPES.SIMPLE_RUBRIC ? `visibility: visible` : `visibility: hidden`}\"><${RUBRIC_TAG_NAME} id=\"simpleRubric\"></${RUBRIC_TAG_NAME}></div>\n <div style=\"${this._type !== RUBRIC_TYPES.SIMPLE_RUBRIC ? `visibility: visible` : `visibility: hidden`}\"> <${MULTI_TRAIT_RUBRIC_TAG_NAME} id=\"multiTraitRubric\"></${MULTI_TRAIT_RUBRIC_TAG_NAME}></div>\n </div>\n `;\n }\n}\n\nexport default ComplexRubric;\n"],"file":"index.js"}
package/package.json ADDED
@@ -0,0 +1,25 @@
1
+ {
2
+ "name": "@pie-element/complex-rubric",
3
+ "version": "0.0.2-next.4424+ce6d4a4ed",
4
+ "main": "lib/index.js",
5
+ "module": "src/index.js",
6
+ "description": "Complex Rubric Scoring Interaction",
7
+ "repository": "pie-framework/pie-elements",
8
+ "publishConfig": {
9
+ "access": "public"
10
+ },
11
+ "dependencies": {
12
+ "@material-ui/core": "^3.9.2",
13
+ "@pie-lib/rubric": "^0.4.39",
14
+ "prop-types": "^15.7.2"
15
+ },
16
+ "author": "pie framework developers",
17
+ "license": "ISC",
18
+ "gitHead": "ce6d4a4edb0b355d57f7843d29a98bb620230c93",
19
+ "scripts": {
20
+ "postpublish": "../../scripts/postpublish"
21
+ },
22
+ "exports": {
23
+ ".": "./src/index.js"
24
+ }
25
+ }
@@ -0,0 +1,166 @@
1
+ jest.mock('@pie-element/rubric', () => jest.fn());
2
+ jest.mock('@pie-element/multi-trait-rubric', () => jest.fn());
3
+ jest.mock('@pie-lib/rubric', () => ({
4
+ RUBRIC_TYPES: {
5
+ SIMPLE_RUBRIC: 'simpleRubric',
6
+ MULTI_TRAIT_RUBRIC: 'multiTraitRubric'
7
+ }
8
+ }));
9
+
10
+ const defaultModel = {
11
+ rubricType: 'simpleRubric',
12
+ rubrics: {
13
+ simpleRubric: {
14
+ points: ['nothing right', 'a teeny bit right', 'mostly right', 'bingo'],
15
+ sampleAnswers: [null, 'just right', 'not left', null],
16
+ maxPoints: 4,
17
+ excludeZero: false
18
+ },
19
+ multiTraitRubric: {
20
+ visibleToStudent: true,
21
+ halfScoring: false,
22
+ excludeZero: true,
23
+ pointLabels: true,
24
+ description: false,
25
+ standards: false,
26
+ scales: [
27
+ {
28
+ maxPoints: 4,
29
+ scorePointsLabels: ['Non-Scorable', 'Developing', 'Progressing', 'Effective', 'Strong'],
30
+ traitLabel: 'Trait',
31
+ traits: [
32
+ {
33
+ name: 'Ideas',
34
+ standards: [],
35
+ description: 'the main message',
36
+ scorePointsDescriptors: [
37
+ 'Student’s response is blank, not in English, not legible, or does not respond to the prompt.',
38
+ 'Topic undefined and/or difficult to follow\n' + '\n' + 'Details are unclear',
39
+ 'Topic too broad\n' + '\n' + 'Details are limited',
40
+ 'Writing stays on topic\n' + '\n' + 'Complete details given',
41
+ 'Strong control of topic\n' + '\n' + 'Relevant, accurate, specific details that support topic',
42
+ ],
43
+ },
44
+ {
45
+ name: 'Organization',
46
+ standards: [],
47
+ description: 'the internal structure of the piece',
48
+ scorePointsDescriptors: [
49
+ 'Student’s response is blank, not in English, not legible, or does not respond to the prompt.',
50
+ 'Does not have a beginning, middle and/or end\n' + '\n' + 'Does not have a lead and/or conclusion\n' + '\n' + 'Transitions confusing and/or not present\n' + '\n' + 'Not written in logical order\n' + '\n' + 'No sign of paragraphing / incorrect paragraphing',
51
+ 'Weak beginning, middle and end\n' + '\n' + 'Has evidence of a lead and/or conclusion but missing elements\n' + '\n' + 'Transitions are used sometimes\n' + '\n' + 'Some logical order\n' + '\n' + 'Most paragraphing incorrect',
52
+ 'Has an acceptable beginning, middle and end\n' + '\n' + 'Includes a lead and conclusion\n' + '\n' + 'Transitions are used correctly\n' + '\n' + 'Mostly logical order\n' + '\n' + 'Mostly correct paragraphing',
53
+ 'Has an effective beginning, middle and end\n' + '\n' + 'Powerful introduction / lead and conclusion\n' + '\n' + 'Effective transitions\n' + '\n' + 'Logical order / sequencing\n' + '\n' + 'Uses appropriate paragraphing',
54
+ ],
55
+ },
56
+ {
57
+ name: 'Word Choice',
58
+ standards: [],
59
+ description: 'the vocabulary a writer chooses to convey meaning',
60
+ scorePointsDescriptors: [
61
+ 'Student’s response is blank, not in English, not legible, or does not respond to the prompt.',
62
+ 'Vocabulary is limited/used incorrectly\n' + '\n' + 'No figurative language; words do not convey meaning',
63
+ 'Generally correct words\n' + '\n' + 'Attempt at figurative language\n' + '\n' + 'and/or words convey general meaning',
64
+ 'Some active verbs and precise nouns\n' + '\n' + 'Effective use of figurative language and/or words that enhance meaning',
65
+ 'Powerful and engaging words\n' + '\n' + 'Artful use of figurative language and/or sensory detail',
66
+ ],
67
+ },
68
+ {
69
+ name: 'Sentence Fluency',
70
+ standards: [],
71
+ description: 'the rhythm and flow of the language',
72
+ scorePointsDescriptors: [
73
+ 'Student’s response is blank, not in English, not legible, or does not respond to the prompt.',
74
+ 'No sentences are clear\n' + '\n' + 'No variety in sentence structure\n' + '\n' + 'Frequent run-ons and/or fragments are present',
75
+ 'Some sentences are clear\n' + '\n' + 'Sentence variety used rarely\n' + '\n' + 'Some run-ons and/or fragments are present',
76
+ 'Most sentences are clear\n' + '\n' + 'Some sentence variety is used\n' + '\n' + 'Run-ons and/or fragments are rare',
77
+ 'All Sentences are clear\n' + '\n' + 'Variety of sentence structure is used\n' + '\n' + 'Run-ons and/or fragments are not present',
78
+ ],
79
+ },
80
+ {
81
+ name: 'Conventions',
82
+ standards: [],
83
+ description: 'the mechanical correctness',
84
+ scorePointsDescriptors: [
85
+ 'Student’s response is blank, not in English, not legible, or does not respond to the prompt.',
86
+ 'Many distracting errors are present in grammar, punctuation, capitalization and/or spelling',
87
+ 'Errors in grammar, punctuation, capitalization and/or spelling are present and some distract from meaning',
88
+ 'Errors in grammar, punctuation, capitalization and/or spelling are present but don’t distract from meaning',
89
+ 'Few errors in grammar, punctuation,\n' + '\n' + 'capitalization and/or spelling',
90
+ ],
91
+ },
92
+ {
93
+ name: 'Voice',
94
+ standards: [],
95
+ description: 'the personal tone and flavor of the author\'s message',
96
+ scorePointsDescriptors: [
97
+ 'Student’s response is blank, not in English, not legible, or does not respond to the prompt.',
98
+ 'Not concerned with audience or purpose\n' + '\n' + 'No viewpoint (perspective) used\n' + '\n' + 'Writing is mechanical and lifeless',
99
+ 'Shows beginning awareness of audience/purpose\n' + '\n' + 'Some viewpoint (perspective) used throughout the piece\n' + '\n' + 'Writing is distant, too formal or informal',
100
+ 'Awareness of audience; purpose is clear most of the time\n' + '\n' + 'Uses viewpoint (perspective) throughout most of the paper\n' + '\n' + 'Writing is pleasant, agreeable and satisfying',
101
+ 'Powerful connection with audience; purpose is clearly communicated\n' + '\n' + 'Maintains strong viewpoint (perspective) throughout entire piece\n' + '\n' + 'Writing is expressive, engaging and has lots of energy',
102
+ ],
103
+ }
104
+ ]
105
+ },
106
+ {
107
+ maxPoints: 5,
108
+ scorePointsLabels: ['Non-Scorable', 'Unsatisfactory', 'Satisfactory'],
109
+ traitLabel: 'Category',
110
+ traits: [
111
+ {
112
+ name: 'Presentation',
113
+ standards: [],
114
+ description: '',
115
+ scorePointsDescriptors: [
116
+ 'Handwriting is unreadable, or response is blank, not in English, or too brief to evaluate. ',
117
+ 'Handwriting poor\n' + '\n' + 'Overall appearance is distracting to unacceptable',
118
+ 'Handwriting is generally legible\n' + '\n' + 'Overall appearance is acceptable or better',
119
+ ],
120
+ },
121
+ ]
122
+ }
123
+ ]
124
+ }
125
+ }
126
+ };
127
+
128
+ describe('complex-rubric', () => {
129
+ let Def;
130
+ let el;
131
+ let complexRubric;
132
+
133
+ beforeAll(() => {
134
+ Def = require('../index').default;
135
+ });
136
+
137
+ beforeEach(() => {
138
+ el = new Def();
139
+ el.connectedCallback();
140
+ complexRubric = {
141
+ simpleRubric: new HTMLElement(),
142
+ multiTraitRubric: new HTMLElement(),
143
+ };
144
+ el.querySelector = jest.fn((s) => {
145
+ if (s === '#simpleRubric') {
146
+ return complexRubric.simpleRubric;
147
+ } else {
148
+ return complexRubric.multiTraitRubric;
149
+ }
150
+ });
151
+ el.tagName = 'complex-rubric-element';
152
+ el.model = defaultModel;
153
+ });
154
+
155
+ describe('model', () => {
156
+ it('should have set the model', () => {
157
+ expect(el._model).toEqual(defaultModel);
158
+ });
159
+
160
+ it('sets rubric type', () => {
161
+ expect(el._type).toEqual('simpleRubric');
162
+ el.model = { ...el._model, rubricType: 'multiTraitRubric' };
163
+ expect(el._type).toEqual('multiTraitRubric');
164
+ });
165
+ });
166
+ });
package/src/index.js ADDED
@@ -0,0 +1,106 @@
1
+ import Rubric from '@pie-element/rubric';
2
+ import MultiTraitRubric from '@pie-element/multi-trait-rubric';
3
+ import { RUBRIC_TYPES } from '@pie-lib/rubric';
4
+
5
+ const RUBRIC_TAG_NAME = 'complex-rubric-simple';
6
+ const MULTI_TRAIT_RUBRIC_TAG_NAME = 'complex-rubric-multi-trait';
7
+
8
+ class ComplexRubricSimple extends Rubric {}
9
+ class ComplexRubricMultiTrait extends MultiTraitRubric {}
10
+
11
+ const defineRubrics = () => {
12
+ if (!customElements.get(RUBRIC_TAG_NAME)) {
13
+ customElements.define(RUBRIC_TAG_NAME, ComplexRubricSimple);
14
+ }
15
+
16
+ if (!customElements.get(MULTI_TRAIT_RUBRIC_TAG_NAME)) {
17
+ customElements.define(MULTI_TRAIT_RUBRIC_TAG_NAME, ComplexRubricMultiTrait);
18
+ }
19
+ };
20
+
21
+ defineRubrics();
22
+
23
+ class ComplexRubric extends HTMLElement {
24
+ constructor() {
25
+ super();
26
+ this._model = {};
27
+ this._type = RUBRIC_TYPES.SIMPLE_RUBRIC;
28
+ }
29
+
30
+ set type(t) {
31
+ this._type = t;
32
+ }
33
+
34
+ get type() {
35
+ return this._type;
36
+ }
37
+
38
+ set model(m) {
39
+ this._model = m;
40
+ const oldType = this._type;
41
+ this.type = m.rubricType;
42
+
43
+ switch (this._type) {
44
+ case RUBRIC_TYPES.SIMPLE_RUBRIC:
45
+ default:
46
+ customElements.whenDefined(RUBRIC_TAG_NAME).then(() => {
47
+ this.setRubricModel(this.simpleRubric);
48
+ });
49
+ break;
50
+ case RUBRIC_TYPES.MULTI_TRAIT_RUBRIC:
51
+ customElements.whenDefined(MULTI_TRAIT_RUBRIC_TAG_NAME).then(() =>{
52
+ this.setMultiTraitRubricModel(this.multiTraitRubric);
53
+ });
54
+ break;
55
+ }
56
+
57
+ if (oldType !== this.type) {
58
+ this._render();
59
+ }
60
+ }
61
+
62
+ setRubricModel(simpleRubric) {
63
+ if (this._model && this._model.rubrics && this._model.rubrics.simpleRubric) {
64
+ const { mode } = this._model;
65
+
66
+ simpleRubric.model = {
67
+ ...this._model.rubrics.simpleRubric,
68
+ mode
69
+ };
70
+ }
71
+ }
72
+
73
+ setMultiTraitRubricModel(multiTraitRubric) {
74
+ if (this._model && this._model.rubrics && this._model.rubrics.multiTraitRubric) {
75
+ const { mode } = this._model;
76
+
77
+ multiTraitRubric.model = {
78
+ ...this._model.rubrics.multiTraitRubric,
79
+ mode
80
+ };
81
+ }
82
+ }
83
+
84
+ get multiTraitRubric() {
85
+ return this.querySelector(`${MULTI_TRAIT_RUBRIC_TAG_NAME}#multiTraitRubric`);
86
+ }
87
+
88
+ get simpleRubric() {
89
+ return this.querySelector(`${RUBRIC_TAG_NAME}#simpleRubric`);
90
+ }
91
+
92
+ connectedCallback() {
93
+ this._render();
94
+ }
95
+
96
+ _render() {
97
+ this.innerHTML = `
98
+ <div>
99
+ <div style="${this._type === RUBRIC_TYPES.SIMPLE_RUBRIC ? `visibility: visible` : `visibility: hidden`}"><${RUBRIC_TAG_NAME} id="simpleRubric"></${RUBRIC_TAG_NAME}></div>
100
+ <div style="${this._type !== RUBRIC_TYPES.SIMPLE_RUBRIC ? `visibility: visible` : `visibility: hidden`}"> <${MULTI_TRAIT_RUBRIC_TAG_NAME} id="multiTraitRubric"></${MULTI_TRAIT_RUBRIC_TAG_NAME}></div>
101
+ </div>
102
+ `;
103
+ }
104
+ }
105
+
106
+ export default ComplexRubric;