@pie-element/complex-rubric 8.0.4-next.20261011174919 → 8.0.4

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 (37) hide show
  1. package/dist/author/defaults.d.ts +10 -10
  2. package/dist/author/defaults.js +14 -14
  3. package/dist/author/index.d.ts +20 -20
  4. package/dist/author/index.js +4 -0
  5. package/dist/author/main.d.ts +26 -13
  6. package/dist/author/main.js +20 -30
  7. package/dist/browser/author/index.js +54 -76
  8. package/dist/browser/author/index.js.map +1 -1
  9. package/dist/browser/controller/index.js.map +1 -1
  10. package/dist/browser/delivery/index.js +2 -2
  11. package/dist/browser/{delivery-Z7dq393G.js → delivery-pWFw_9mm.js} +2 -2
  12. package/dist/browser/{delivery-Z7dq393G.js.map → delivery-pWFw_9mm.js.map} +1 -1
  13. package/dist/browser/editor-runtime/author/index.js +54 -76
  14. package/dist/browser/editor-runtime/author/index.js.map +1 -1
  15. package/dist/browser/editor-runtime/controller/index.js.map +1 -1
  16. package/dist/browser/editor-runtime/delivery/index.js +2 -2
  17. package/dist/browser/editor-runtime/{delivery-BD3aCYuV.js → delivery-DHFx9jYx.js} +2 -2
  18. package/dist/browser/editor-runtime/{delivery-BD3aCYuV.js.map → delivery-DHFx9jYx.js.map} +1 -1
  19. package/dist/browser/editor-runtime/print/index.js +2 -2
  20. package/dist/browser/editor-runtime/{private-tags-Dq8udgmI.js → private-tags-BRKFxLqP.js} +2 -2
  21. package/dist/browser/editor-runtime/{private-tags-Dq8udgmI.js.map → private-tags-BRKFxLqP.js.map} +1 -1
  22. package/dist/browser/print/index.js +2 -2
  23. package/dist/browser/{private-tags-C5WL6_In.js → private-tags-CMwniYBP.js} +2 -2
  24. package/dist/browser/{private-tags-C5WL6_In.js.map → private-tags-CMwniYBP.js.map} +1 -1
  25. package/dist/controller/defaults.d.ts +13 -12
  26. package/dist/controller/index.d.ts +88 -5
  27. package/dist/controller/utils.d.ts +1 -1
  28. package/dist/index.d.ts +1 -0
  29. package/dist/index.iife.js +1 -1
  30. package/dist/private-tags.js +1 -1
  31. package/dist/schemas/configuration.schema.json +469 -0
  32. package/dist/schemas/model.schema.json +553 -0
  33. package/dist/schemas/session.schema.json +17 -0
  34. package/dist/types.d.ts +60 -0
  35. package/module/print.js +1 -1
  36. package/module/print.js.map +1 -1
  37. package/package.json +16 -12
@@ -1,24 +1,24 @@
1
- import { RUBRIC_TYPES } from '@pie-lib/rubric';
1
+ import type { Scale } from '@pie-element/multi-trait-rubric';
2
2
  declare const _default: {
3
3
  model: {
4
- rubricType: string;
4
+ rubricType: "simpleRubric";
5
5
  rubrics: {
6
- [RUBRIC_TYPES.SIMPLE_RUBRIC]: {
6
+ simpleRubric: {
7
7
  points: string[];
8
8
  sampleAnswers: null[];
9
9
  maxPoints: number;
10
10
  excludeZero: boolean;
11
11
  };
12
- [RUBRIC_TYPES.MULTI_TRAIT_RUBRIC]: {
12
+ multiTraitRubric: {
13
13
  description: boolean;
14
14
  excludeZero: boolean;
15
15
  halfScoring: boolean;
16
16
  pointLabels: boolean;
17
- scales: never[];
17
+ scales: Scale[];
18
18
  standards: boolean;
19
19
  visibleToStudent: boolean;
20
20
  };
21
- [RUBRIC_TYPES.RUBRICLESS]: {
21
+ rubricless: {
22
22
  maxPoints: number;
23
23
  excludeZero: boolean;
24
24
  rubriclessInstructionEnabled: boolean;
@@ -26,7 +26,8 @@ declare const _default: {
26
26
  };
27
27
  };
28
28
  configuration: {
29
- [RUBRIC_TYPES.MULTI_TRAIT_RUBRIC]: {
29
+ rubricOptions: ("simpleRubric" | "multiTraitRubric" | "rubricless")[];
30
+ multiTraitRubric: {
30
31
  baseInputConfiguration: {
31
32
  h3: {
32
33
  disabled: boolean;
@@ -137,7 +138,7 @@ declare const _default: {
137
138
  };
138
139
  maxMaxPoints: number;
139
140
  };
140
- [RUBRIC_TYPES.SIMPLE_RUBRIC]: {
141
+ simpleRubric: {
141
142
  baseInputConfiguration: {
142
143
  h3: {
143
144
  disabled: boolean;
@@ -169,7 +170,7 @@ declare const _default: {
169
170
  settingsPanelDisabled: boolean;
170
171
  maxMaxPoints: number;
171
172
  };
172
- [RUBRIC_TYPES.RUBRICLESS]: {
173
+ rubricless: {
173
174
  baseInputConfiguration: {
174
175
  h3: {
175
176
  disabled: boolean;
@@ -217,7 +218,6 @@ declare const _default: {
217
218
  };
218
219
  maxMaxPoints: number;
219
220
  };
220
- rubricOptions: string[];
221
221
  };
222
222
  };
223
223
  export default _default;
@@ -1,6 +1,6 @@
1
1
  import { RUBRIC_TYPES as e } from "@pie-lib/rubric";
2
2
  //#region src/author/defaults.tsx
3
- var t = {
3
+ var t = e, n = {
4
4
  description: !1,
5
5
  excludeZero: !1,
6
6
  halfScoring: !1,
@@ -8,7 +8,7 @@ var t = {
8
8
  scales: [],
9
9
  standards: !1,
10
10
  visibleToStudent: !0
11
- }, n = {
11
+ }, r = {
12
12
  points: [
13
13
  "",
14
14
  "",
@@ -23,11 +23,11 @@ var t = {
23
23
  ],
24
24
  maxPoints: 3,
25
25
  excludeZero: !1
26
- }, r = {
26
+ }, i = {
27
27
  maxPoints: 100,
28
28
  excludeZero: !1,
29
29
  rubriclessInstructionEnabled: !0
30
- }, i = {
30
+ }, a = {
31
31
  baseInputConfiguration: {
32
32
  h3: { disabled: !0 },
33
33
  audio: { disabled: !1 },
@@ -105,7 +105,7 @@ var t = {
105
105
  enabled: !1
106
106
  },
107
107
  maxMaxPoints: 9
108
- }, a = {
108
+ }, o = {
109
109
  baseInputConfiguration: {
110
110
  h3: { disabled: !0 },
111
111
  audio: { disabled: !1 },
@@ -124,7 +124,7 @@ var t = {
124
124
  },
125
125
  settingsPanelDisabled: !1,
126
126
  maxMaxPoints: 9
127
- }, o = {
127
+ }, s = {
128
128
  baseInputConfiguration: {
129
129
  h3: { disabled: !0 },
130
130
  audio: { disabled: !1 },
@@ -153,13 +153,13 @@ var t = {
153
153
  }
154
154
  },
155
155
  maxMaxPoints: 100
156
- }, s = {
156
+ }, c = {
157
157
  model: {
158
158
  rubricType: "simpleRubric",
159
159
  rubrics: {
160
- [e.SIMPLE_RUBRIC]: n,
161
- [e.MULTI_TRAIT_RUBRIC]: t,
162
- [e.RUBRICLESS]: r
160
+ [t.SIMPLE_RUBRIC]: r,
161
+ [t.MULTI_TRAIT_RUBRIC]: n,
162
+ [t.RUBRICLESS]: i
163
163
  }
164
164
  },
165
165
  configuration: {
@@ -168,10 +168,10 @@ var t = {
168
168
  "multiTraitRubric",
169
169
  "rubricless"
170
170
  ],
171
- [e.MULTI_TRAIT_RUBRIC]: i,
172
- [e.SIMPLE_RUBRIC]: a,
173
- [e.RUBRICLESS]: o
171
+ [t.MULTI_TRAIT_RUBRIC]: a,
172
+ [t.SIMPLE_RUBRIC]: o,
173
+ [t.RUBRICLESS]: s
174
174
  }
175
175
  };
176
176
  //#endregion
177
- export { s as default };
177
+ export { c as default };
@@ -1,26 +1,26 @@
1
- export default class ComplexRubricConfigureElement extends HTMLElement {
2
- static createDefaultModel: ({ rubrics: { simpleRubric, rubricless, multiTraitRubric }, ...model }?: {
3
- rubrics?: {
4
- simpleRubric?: {};
5
- rubricless?: {};
6
- multiTraitRubric?: {};
7
- } | undefined;
8
- }, currentModel?: {}) => {
9
- rubrics: {
10
- simpleRubric: any;
11
- multiTraitRubric: any;
12
- rubricless: any;
13
- };
14
- rubricType: string;
1
+ import { type AuthorModel } from './main.js';
2
+ import type { ComplexRubricConfiguration, ComplexRubricModel, RubricModels } from '../types.js';
3
+ /** What the author accepts: it fills in the rest of the model, and of each rubric, from the defaults. */
4
+ type ModelInput = Omit<Partial<ComplexRubricModel>, 'rubrics'> & {
5
+ rubrics?: {
6
+ [K in keyof RubricModels]?: Partial<NonNullable<RubricModels[K]>>;
15
7
  };
8
+ } & Pick<Partial<AuthorModel>, 'errors'>;
9
+ export default class ComplexRubricConfigureElement extends HTMLElement {
10
+ static createDefaultModel: ({ rubrics: { simpleRubric, rubricless, multiTraitRubric }, ...model }?: ModelInput, currentModel?: Partial<AuthorModel>) => AuthorModel;
11
+ private _root;
12
+ private _model;
13
+ private _configuration;
14
+ canUpdateModel: boolean;
16
15
  constructor();
17
- set model(m: any);
18
- dispatchModelUpdated(reset: any): void;
19
- onModelChanged: any;
20
- set configuration(c: any);
21
- onConfigurationChanged(c: any): void;
22
- onModelUpdated: any;
16
+ set model(m: ModelInput);
17
+ dispatchModelUpdated(reset?: boolean): void;
18
+ onModelChanged: (m: ModelInput, reset?: boolean) => void;
19
+ set configuration(c: ComplexRubricConfiguration);
20
+ onConfigurationChanged(c: ComplexRubricConfiguration): void;
21
+ onModelUpdated: (e: Event) => void;
23
22
  connectedCallback(): void;
24
23
  _render(): void;
25
24
  disconnectedCallback(): void;
26
25
  }
26
+ export {};
@@ -41,6 +41,10 @@ var g = (e, t) => ({
41
41
  }
42
42
  }
43
43
  });
44
+ _root;
45
+ _model;
46
+ _configuration;
47
+ canUpdateModel;
44
48
  constructor() {
45
49
  super(), this._root = null, this.canUpdateModel = !1, l.log("constructor called"), this._model = e.createDefaultModel(), this._configuration = r.configuration, this.onConfigurationChanged = this.onConfigurationChanged.bind(this);
46
50
  }
@@ -1,17 +1,30 @@
1
1
  import React from 'react';
2
- import PropTypes from 'prop-types';
3
- export declare class Main extends React.Component {
4
- static propTypes: {
5
- canUpdateModel: PropTypes.Requireable<boolean>;
6
- configuration: PropTypes.Requireable<object>;
7
- multiTraitRubricTagName: PropTypes.Requireable<string>;
8
- model: PropTypes.Requireable<object>;
9
- onModelChanged: PropTypes.Requireable<(...args: any[]) => any>;
10
- onConfigurationChanged: PropTypes.Requireable<(...args: any[]) => any>;
11
- simpleRubricTagName: PropTypes.Requireable<string>;
12
- };
13
- onModelChanged: any;
14
- onChangeRubricType: any;
2
+ import type MultiTraitRubricAuthorElement from '@pie-element/multi-trait-rubric/author';
3
+ import type RubricAuthorElement from '@pie-element/rubric/author';
4
+ import type { ComplexRubricValidationErrors } from '../controller/index.js';
5
+ import type { ComplexRubricConfiguration, ComplexRubricModel, RubricModels } from '../types.js';
6
+ /** The model the author edits: the defaults supply every rubric; a host sets `errors` from the controller's `validate()`. */
7
+ export type AuthorModel = Partial<ComplexRubricModel> & {
8
+ rubrics: Required<RubricModels>;
9
+ errors?: ComplexRubricValidationErrors;
10
+ };
11
+ /** The configuration the author renders: the defaults supply the rubric options and each rubric's configuration. */
12
+ export type AuthorConfiguration = ComplexRubricConfiguration & Required<Pick<ComplexRubricConfiguration, 'rubricOptions' | 'simpleRubric' | 'multiTraitRubric' | 'rubricless'>>;
13
+ export type MainProps = {
14
+ canUpdateModel?: boolean;
15
+ configuration: AuthorConfiguration;
16
+ multiTraitRubricTagName?: string;
17
+ model: AuthorModel;
18
+ onModelChanged: (model: AuthorModel) => void;
19
+ onConfigurationChanged: (configuration: ComplexRubricConfiguration) => void;
20
+ simpleRubricTagName?: string;
21
+ };
22
+ export declare class Main extends React.Component<MainProps> {
23
+ simpleRubric: RubricAuthorElement | undefined;
24
+ multiTraitRubric: MultiTraitRubricAuthorElement | undefined;
25
+ rubricless: RubricAuthorElement | undefined;
26
+ onModelChanged: (model: AuthorModel) => void;
27
+ onChangeRubricType: (e: React.ChangeEvent<HTMLInputElement>) => void;
15
28
  render(): React.JSX.Element;
16
29
  }
17
30
  export default Main;
@@ -2,33 +2,23 @@ import { COMPLEX_RUBRIC_MULTI_TRAIT_CONFIGURE_TAG as e, COMPLEX_RUBRIC_SIMPLE_CO
2
2
  import { RUBRIC_TYPES as n } from "@pie-lib/rubric";
3
3
  import { color as r } from "@pie-lib/render-ui";
4
4
  import i from "react";
5
- import a from "prop-types";
6
- import { layout as o } from "@pie-lib/config-ui";
7
- import s from "@mui/material/Radio";
8
- import c from "@mui/material/RadioGroup";
9
- import l from "@mui/material/FormControlLabel";
10
- import { styled as u } from "@mui/material/styles";
11
- import { jsx as d, jsxs as f } from "react/jsx-runtime";
5
+ import { layout as a } from "@pie-lib/config-ui";
6
+ import o from "@mui/material/Radio";
7
+ import s from "@mui/material/RadioGroup";
8
+ import c from "@mui/material/FormControlLabel";
9
+ import { styled as l } from "@mui/material/styles";
10
+ import { jsx as u, jsxs as d } from "react/jsx-runtime";
12
11
  //#region src/author/main.tsx
13
- var p = u(l)({ "&.MuiFormControlLabel-root": {
12
+ var f = l(c)({ "&.MuiFormControlLabel-root": {
14
13
  width: "fit-content",
15
14
  paddingRight: "24px",
16
15
  boxSizing: "border-box",
17
16
  "&:hover": { background: "var(--pie-secondary-background, rgba(241,241,241,1))" }
18
- } }), m = u(s)({ "&.MuiRadio-root": { color: `${r.tertiary()} !important` } }), h = {
17
+ } }), p = l(o)({ "&.MuiRadio-root": { color: `${r.tertiary()} !important` } }), m = {
19
18
  [n.MULTI_TRAIT_RUBRIC]: "Multi Trait Rubric",
20
19
  [n.SIMPLE_RUBRIC]: "Simple Rubric",
21
20
  [n.RUBRICLESS]: "Rubricless"
22
- }, g = class extends i.Component {
23
- static propTypes = {
24
- canUpdateModel: a.bool,
25
- configuration: a.object,
26
- multiTraitRubricTagName: a.string,
27
- model: a.object,
28
- onModelChanged: a.func,
29
- onConfigurationChanged: a.func,
30
- simpleRubricTagName: a.string
31
- };
21
+ }, h = class extends i.Component {
32
22
  onModelChanged = (e) => {
33
23
  let { onModelChanged: t } = this.props;
34
24
  return t(e);
@@ -41,13 +31,13 @@ var p = u(l)({ "&.MuiFormControlLabel-root": {
41
31
  });
42
32
  };
43
33
  render() {
44
- let { model: r, configuration: i, canUpdateModel: a, multiTraitRubricTagName: s = e, simpleRubricTagName: l = t } = this.props, u = s, g = l, { extraCSSRules: _, rubrics: v = {} } = r || {}, { rubricType: y } = r, { contentDimensions: b = {}, rubricOptions: x = [], multiTraitRubric: S, simpleRubric: C, rubricless: w, width: T } = i, E = "";
34
+ let { model: r, configuration: i, canUpdateModel: o, multiTraitRubricTagName: c = e, simpleRubricTagName: l = t } = this.props, h = c, g = l, { extraCSSRules: _, rubrics: v = {} } = r || {}, { rubricType: y } = r, { contentDimensions: b = {}, rubricOptions: x = [], multiTraitRubric: S, simpleRubric: C, rubricless: w, width: T } = i, E = "";
45
35
  y ||= n.SIMPLE_RUBRIC;
46
36
  let D = x.indexOf(y) > -1;
47
- if (a) switch (y) {
37
+ if (o) switch (y) {
48
38
  case n.SIMPLE_RUBRIC:
49
39
  default:
50
- E = /* @__PURE__ */ d(g, {
40
+ E = /* @__PURE__ */ u(g, {
51
41
  "data-rubric-type": "simpleRubric",
52
42
  ref: (e) => {
53
43
  e && (this.simpleRubric = e, this.simpleRubric.model = {
@@ -61,7 +51,7 @@ var p = u(l)({ "&.MuiFormControlLabel-root": {
61
51
  }, "simple-rubric");
62
52
  break;
63
53
  case n.MULTI_TRAIT_RUBRIC:
64
- E = /* @__PURE__ */ d(u, {
54
+ E = /* @__PURE__ */ u(h, {
65
55
  "data-rubric-type": "multiTraitRubric",
66
56
  ref: (e) => {
67
57
  e && (this.multiTraitRubric = e, this.multiTraitRubric.model = {
@@ -75,7 +65,7 @@ var p = u(l)({ "&.MuiFormControlLabel-root": {
75
65
  }, "multi-trait-rubric");
76
66
  break;
77
67
  case n.RUBRICLESS:
78
- E = /* @__PURE__ */ d(g, {
68
+ E = /* @__PURE__ */ u(g, {
79
69
  "data-rubric-type": "rubricless",
80
70
  ref: (e) => {
81
71
  e && (this.rubricless = e, this.rubricless.model = v.rubricless, this.rubricless.configuration = {
@@ -86,24 +76,24 @@ var p = u(l)({ "&.MuiFormControlLabel-root": {
86
76
  }, "rubricless");
87
77
  break;
88
78
  }
89
- return /* @__PURE__ */ f(o.ConfigLayout, {
79
+ return /* @__PURE__ */ d(a.ConfigLayout, {
90
80
  extraCSSRules: _,
91
81
  dimensions: b,
92
82
  hideSettings: !0,
93
83
  settings: null,
94
- children: [/* @__PURE__ */ d(c, {
84
+ children: [/* @__PURE__ */ u(s, {
95
85
  "aria-label": "rubric-type",
96
86
  name: "rubricType",
97
87
  value: r.rubricType,
98
88
  onChange: this.onChangeRubricType,
99
- children: x.length > 1 && x.map((e, t) => /* @__PURE__ */ d(p, {
89
+ children: x.length > 1 && x.map((e, t) => /* @__PURE__ */ u(f, {
100
90
  value: e,
101
- control: /* @__PURE__ */ d(m, { checked: y === e }),
102
- label: h[e]
91
+ control: /* @__PURE__ */ u(p, { checked: y === e }),
92
+ label: m[e]
103
93
  }, t))
104
94
  }), D && E]
105
95
  });
106
96
  }
107
97
  };
108
98
  //#endregion
109
- export { g as Main, g as default };
99
+ export { h as Main, h as default };