@pie-element/rubric 8.1.1-next.11 → 8.1.2-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 (105) hide show
  1. package/configure.js +2 -0
  2. package/controller.js +1 -0
  3. package/dist/author/defaults.d.ts +71 -0
  4. package/dist/author/defaults.js +53 -0
  5. package/dist/author/index.d.ts +21 -0
  6. package/dist/author/index.js +72 -0
  7. package/dist/author/main.d.ts +14 -0
  8. package/dist/author/main.js +51 -0
  9. package/dist/browser/author/index.js +45540 -0
  10. package/dist/browser/author/index.js.map +1 -0
  11. package/dist/browser/controller/index.js +41 -0
  12. package/dist/browser/controller/index.js.map +1 -0
  13. package/dist/browser/debounce-CwNJlAWB.js +120 -0
  14. package/dist/browser/debounce-CwNJlAWB.js.map +1 -0
  15. package/dist/browser/delivery/index.js +34 -0
  16. package/dist/browser/delivery/index.js.map +1 -0
  17. package/dist/browser/dist-DESt1KeY.js +9075 -0
  18. package/dist/browser/dist-DESt1KeY.js.map +1 -0
  19. package/dist/browser/main-wvVb2SYi.js +153 -0
  20. package/dist/browser/main-wvVb2SYi.js.map +1 -0
  21. package/dist/browser/print/index.js +34 -0
  22. package/dist/browser/print/index.js.map +1 -0
  23. package/dist/browser/rubric.css +2 -0
  24. package/dist/controller/defaults.d.ts +17 -0
  25. package/dist/controller/defaults.js +21 -0
  26. package/dist/controller/index.d.ts +10 -0
  27. package/dist/controller/index.js +23 -0
  28. package/dist/delivery/index.d.ts +16 -0
  29. package/dist/delivery/index.js +33 -0
  30. package/dist/delivery/main.d.ts +34 -0
  31. package/dist/delivery/main.js +156 -0
  32. package/dist/index.d.ts +1 -0
  33. package/dist/index.iife.d.ts +8 -0
  34. package/dist/index.iife.js +145 -0
  35. package/dist/index.js +2 -0
  36. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Symbol.js +5 -0
  37. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseGetTag.js +10 -0
  38. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseTrim.js +8 -0
  39. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_freeGlobal.js +4 -0
  40. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getRawTag.js +14 -0
  41. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_objectToString.js +7 -0
  42. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_root.js +5 -0
  43. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_trimmedEndIndex.js +8 -0
  44. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/debounce.js +50 -0
  45. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isObject.js +7 -0
  46. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isObjectLike.js +6 -0
  47. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isSymbol.js +9 -0
  48. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/now.js +7 -0
  49. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/toNumber.js +19 -0
  50. package/dist/print/index.d.ts +15 -0
  51. package/dist/print/index.js +34 -0
  52. package/package.json +84 -25
  53. package/CHANGELOG.json +0 -257
  54. package/CHANGELOG.md +0 -1715
  55. package/LICENSE.md +0 -5
  56. package/README.md +0 -3
  57. package/configure/CHANGELOG.json +0 -197
  58. package/configure/CHANGELOG.md +0 -1555
  59. package/configure/lib/defaults.js +0 -70
  60. package/configure/lib/defaults.js.map +0 -1
  61. package/configure/lib/index.js +0 -135
  62. package/configure/lib/index.js.map +0 -1
  63. package/configure/lib/main.js +0 -103
  64. package/configure/lib/main.js.map +0 -1
  65. package/configure/package.json +0 -23
  66. package/configure/src/__tests__/index.test.jsx +0 -192
  67. package/configure/src/defaults.js +0 -43
  68. package/configure/src/index.js +0 -139
  69. package/configure/src/main.jsx +0 -87
  70. package/controller/CHANGELOG.json +0 -17
  71. package/controller/CHANGELOG.md +0 -897
  72. package/controller/lib/defaults.js +0 -15
  73. package/controller/lib/defaults.js.map +0 -1
  74. package/controller/lib/index.js +0 -46
  75. package/controller/lib/index.js.map +0 -1
  76. package/controller/package.json +0 -12
  77. package/controller/src/__tests__/index.test.js +0 -33
  78. package/controller/src/defaults.js +0 -8
  79. package/controller/src/index.js +0 -41
  80. package/docs/config-schema.json +0 -712
  81. package/docs/config-schema.json.md +0 -532
  82. package/docs/demo/config.js +0 -8
  83. package/docs/demo/generate.js +0 -8
  84. package/docs/demo/index.html +0 -2
  85. package/docs/pie-schema.json +0 -391
  86. package/docs/pie-schema.json.md +0 -281
  87. package/lib/index.js +0 -52
  88. package/lib/index.js.map +0 -1
  89. package/lib/main.js +0 -208
  90. package/lib/main.js.map +0 -1
  91. package/lib/print.js +0 -71
  92. package/lib/print.js.map +0 -1
  93. package/module/configure.js +0 -1
  94. package/module/controller.js +0 -73
  95. package/module/demo.js +0 -33
  96. package/module/element.js +0 -1
  97. package/module/index.html +0 -21
  98. package/module/manifest.json +0 -14
  99. package/module/print-demo.js +0 -71
  100. package/module/print.html +0 -18
  101. package/module/print.js +0 -1
  102. package/src/__tests__/rubric-view.test.jsx +0 -37
  103. package/src/index.js +0 -48
  104. package/src/main.jsx +0 -226
  105. package/src/print.js +0 -74
@@ -1,139 +0,0 @@
1
- import { ModelUpdatedEvent, InsertImageEvent, DeleteImageEvent } from '@pie-framework/pie-configure-events';
2
- import React from 'react';
3
- import { createRoot } from 'react-dom/client';
4
- import debug from 'debug';
5
-
6
- import Main from './main';
7
- import defaults from './defaults';
8
-
9
- const modelWithDefaults = (m) => ({ ...defaults.model, ...m });
10
-
11
- const configurationWithDefaults = (c) => ({ ...defaults.configuration, ...c });
12
-
13
- export default class RubricElement extends HTMLElement {
14
- constructor() {
15
- super();
16
- this._root = null;
17
- debug.log('constructor called');
18
- this._model = modelWithDefaults();
19
- this._configuration = configurationWithDefaults();
20
- this.onModelChanged = this.onModelChanged.bind(this);
21
- this.onConfigurationChanged = this.onConfigurationChanged.bind(this);
22
- }
23
-
24
- updateModelAccordingToReceivedProps = (nextModel) => {
25
- const currentModel = { ...this._model };
26
-
27
- if (!nextModel) {
28
- return currentModel;
29
- }
30
-
31
- const validatedModel = { ...nextModel };
32
-
33
- // excludeZero should be false and disabled when maxPoints is 1
34
- if (validatedModel.maxPoints === 1) {
35
- validatedModel.excludeZero = false;
36
- }
37
-
38
- const { maxPoints, excludeZero } = validatedModel || {};
39
-
40
- validatedModel.points = validatedModel.points ? [...validatedModel.points] : [];
41
- validatedModel.sampleAnswers = validatedModel.sampleAnswers ? [...validatedModel.sampleAnswers] : [];
42
-
43
- const howManyPointsShouldHave = excludeZero ? maxPoints : maxPoints + 1;
44
- const howManyPointsDoesItHave = validatedModel.points.length;
45
-
46
- const excludeZeroChanged = currentModel?.excludeZero !== nextModel?.excludeZero;
47
- const maxPointsChanged = currentModel?.maxPoints !== nextModel?.maxPoints;
48
-
49
- if (howManyPointsDoesItHave < howManyPointsShouldHave) {
50
- if (excludeZeroChanged && !excludeZero) {
51
- validatedModel.points = ['', ...validatedModel.points];
52
- validatedModel.sampleAnswers = [null, ...validatedModel.sampleAnswers];
53
- }
54
-
55
- if (maxPointsChanged) {
56
- for (let i = 0; i < howManyPointsShouldHave - howManyPointsDoesItHave; i++) {
57
- validatedModel.points.push('');
58
- validatedModel.sampleAnswers.push(null);
59
- }
60
- }
61
- } else if (howManyPointsDoesItHave > howManyPointsShouldHave) {
62
- if (excludeZeroChanged && excludeZero) {
63
- validatedModel.points = validatedModel.points.slice(1);
64
- validatedModel.sampleAnswers = validatedModel.sampleAnswers.slice(1);
65
- }
66
-
67
- if (maxPointsChanged) {
68
- validatedModel.points = validatedModel.points.slice(0, howManyPointsShouldHave);
69
- validatedModel.sampleAnswers = validatedModel.sampleAnswers.slice(0, howManyPointsShouldHave);
70
- }
71
- }
72
-
73
- return validatedModel;
74
- };
75
-
76
- set model(m) {
77
- this._model = this.updateModelAccordingToReceivedProps(modelWithDefaults(m));
78
- this._render();
79
- }
80
-
81
- set configuration(c) {
82
- this._configuration = configurationWithDefaults(c);
83
- this._render();
84
- }
85
-
86
- onModelChanged(m) {
87
- this._model = this.updateModelAccordingToReceivedProps(m);
88
- this._render();
89
- this.dispatchEvent(new ModelUpdatedEvent(this._model, false));
90
- }
91
-
92
- onConfigurationChanged = (c) => {
93
- this._configuration = configurationWithDefaults(c);
94
-
95
- if (this._model) {
96
- this.onModelChanged(this._model);
97
- }
98
-
99
- this._render();
100
- };
101
-
102
- insertImage(handler) {
103
- this.dispatchEvent(new InsertImageEvent(handler));
104
- }
105
-
106
- onDeleteImage(src, done) {
107
- this.dispatchEvent(new DeleteImageEvent(src, done));
108
- }
109
-
110
- connectedCallback() {
111
- this._render();
112
- }
113
-
114
- _render() {
115
- if (this._model) {
116
- let element = React.createElement(Main, {
117
- model: this._model,
118
- configuration: this._configuration,
119
- onModelChanged: this.onModelChanged,
120
- onConfigurationChanged: this.onConfigurationChanged,
121
- imageSupport: {
122
- add: this.insertImage.bind(this),
123
- delete: this.onDeleteImage.bind(this),
124
- },
125
- });
126
-
127
- if (!this._root) {
128
- this._root = createRoot(this);
129
- }
130
- this._root.render(element);
131
- }
132
- }
133
-
134
- disconnectedCallback() {
135
- if (this._root) {
136
- this._root.unmount();
137
- }
138
- }
139
- }
@@ -1,87 +0,0 @@
1
- import React from 'react';
2
- import { Authoring } from '@pie-lib/rubric';
3
- import { styled } from '@mui/material/styles';
4
- import { layout, settings } from '@pie-lib/config-ui';
5
-
6
- const { Panel, toggle } = settings;
7
-
8
- const StyledDiv = styled('div')(({ theme, width }) => ({
9
- maxWidth: width,
10
- fontFamily: 'Cerebri Sans',
11
- fontSize: theme.typography.fontSize,
12
- }));
13
-
14
- class Main extends React.Component {
15
- verifyRubriclessModel = (m, config) => {
16
- const { rubricless = false } = config || {};
17
- return rubricless ? (({ points, sampleAnswers, ...rest }) => rest)(m) : m;
18
- };
19
-
20
- render() {
21
- const { model, configuration, onConfigurationChanged, onModelChanged, imageSupport } = this.props || {};
22
- const {
23
- baseInputConfiguration = {},
24
- contentDimensions = {},
25
- settingsPanelDisabled,
26
- showExcludeZero = {},
27
- showMaxPoint = {},
28
- mathMlOptions = {},
29
- rubricless = false,
30
- rubriclessInstruction,
31
- width,
32
- } = configuration || {};
33
-
34
- // ensure to eliminate points and sampleAnswers in case of rubricless
35
- const value = this.verifyRubriclessModel(model, configuration);
36
- const { extraCSSRules } = model;
37
-
38
- const panelProperties = {
39
- excludeZeroEnabled: showExcludeZero.settings && toggle(showExcludeZero.label),
40
- maxPointsEnabled: showMaxPoint.settings && toggle(showMaxPoint.label),
41
- rubriclessInstructionEnabled: rubricless && rubriclessInstruction.settings && toggle(rubriclessInstruction.label),
42
- };
43
-
44
- const getPluginProps = (props) => {
45
- return Object.assign(
46
- {
47
- ...baseInputConfiguration,
48
- },
49
- props || {},
50
- );
51
- };
52
-
53
- return (
54
- <layout.ConfigLayout
55
- extraCSSRules={extraCSSRules}
56
- dimensions={contentDimensions}
57
- hideSettings={settingsPanelDisabled}
58
- settings={
59
- <Panel
60
- model={model}
61
- onChangeModel={onModelChanged}
62
- configuration={configuration}
63
- onChangeConfiguration={onConfigurationChanged}
64
- pluginOpts={getPluginProps(rubriclessInstruction?.inputConfiguration)}
65
- groups={{
66
- Properties: panelProperties,
67
- }}
68
- imageSupport={imageSupport}
69
- />
70
- } >
71
- <StyledDiv width={width}>
72
- <Authoring
73
- value={value}
74
- config={configuration}
75
- onChange={onModelChanged}
76
- mathMlOptions={mathMlOptions}
77
- rubricless={rubricless}
78
- pluginOpts={baseInputConfiguration}
79
- imageSupport={imageSupport}
80
- />
81
- </StyledDiv>
82
- </layout.ConfigLayout>
83
- );
84
- }
85
- }
86
-
87
- export default Main;
@@ -1,17 +0,0 @@
1
- [
2
- {
3
- "type": "fix",
4
- "scope": null,
5
- "subject": "bump all packages to avoid tag conflict",
6
- "merge": null,
7
- "header": "fix: bump all packages to avoid tag conflict",
8
- "body": null,
9
- "footer": null,
10
- "notes": [],
11
- "hash": "d9ec9a8689f0a391594b5e2f4ea958c6dc9f6d7b",
12
- "gitTags": " (develop)",
13
- "committerDate": "2020-04-10 20:01:37 +0100",
14
- "isTagged": true,
15
- "tag": "@pie-element/rubric-controller@1.1.1"
16
- }
17
- ]