@pie-element/matrix 5.0.4-next.20261011174919 → 5.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.
@@ -1,19 +1,31 @@
1
1
  import React from 'react';
2
- import PropTypes from 'prop-types';
3
- export declare class Main extends React.Component {
4
- static propTypes: {
5
- model: PropTypes.Validator<object>;
6
- disableSidePanel: PropTypes.Requireable<boolean>;
7
- onModelChanged: PropTypes.Validator<(...args: any[]) => any>;
8
- onConfigurationChanged: PropTypes.Validator<(...args: any[]) => any>;
9
- imageSupport: PropTypes.Requireable<PropTypes.InferProps<{
10
- add: PropTypes.Validator<(...args: any[]) => any>;
11
- delete: PropTypes.Validator<(...args: any[]) => any>;
12
- }>>;
13
- };
14
- onPromptChanged: any;
15
- onChangeModel: any;
16
- onTeacherInstructionsChanged: any;
2
+ import type { DeleteDone, ImageHandler, SoundHandler } from '@pie-element/shared-configure-events';
3
+ import type { MatrixValidationErrors } from '../controller/index.js';
4
+ import type { MatrixConfiguration, MatrixModel } from '../types.js';
5
+ /** The model the author edits; the host sets `errors` from the controller's `validate()`. */
6
+ export type AuthorModel = Partial<MatrixModel> & {
7
+ columnLabels: string[];
8
+ rowLabels: string[];
9
+ matrixValues: Record<string, number>;
10
+ errors?: MatrixValidationErrors;
11
+ };
12
+ type MediaSupport<Handler> = {
13
+ add: (handler: Handler) => void;
14
+ delete: (src: string, done: DeleteDone) => void;
15
+ };
16
+ export type MainProps = {
17
+ model: AuthorModel;
18
+ configuration: MatrixConfiguration;
19
+ disableSidePanel?: boolean;
20
+ onModelChanged: (model: AuthorModel, reset?: boolean) => void;
21
+ onConfigurationChanged: (configuration: MatrixConfiguration) => void;
22
+ imageSupport?: MediaSupport<ImageHandler>;
23
+ uploadSoundSupport?: MediaSupport<SoundHandler>;
24
+ };
25
+ export declare class Main extends React.Component<MainProps> {
26
+ onPromptChanged: (prompt: string) => void;
27
+ onChangeModel: (data: Partial<AuthorModel>) => void;
28
+ onTeacherInstructionsChanged: (teacherInstructions: string) => void;
17
29
  render(): React.JSX.Element;
18
30
  }
19
31
  export default Main;
@@ -3,106 +3,95 @@ import t from "./MatrixRowsSizeHeaderInput.js";
3
3
  import n from "./MatrixLabelTypeHeaderInput.js";
4
4
  import r from "./MatrixValues.js";
5
5
  import i from "react";
6
- import a from "prop-types";
7
- import { jsx as o, jsxs as s } from "react/jsx-runtime";
8
- import { styled as c } from "@mui/material/styles";
9
- import l from "@pie-lib/editable-html-tip-tap";
10
- import { InputContainer as u, layout as d, settings as f } from "@pie-lib/config-ui";
6
+ import { jsx as a, jsxs as o } from "react/jsx-runtime";
7
+ import { styled as s } from "@mui/material/styles";
8
+ import c from "@pie-lib/editable-html-tip-tap";
9
+ import { InputContainer as l, layout as u, settings as d } from "@pie-lib/config-ui";
11
10
  //#region src/author/Main.tsx
12
- var { Panel: p, toggle: m, radio: h } = f, g = c(u)(({ theme: e }) => ({
11
+ var { Panel: f, toggle: p, radio: m } = d, h = s(l)(({ theme: e }) => ({
13
12
  width: "100%",
14
13
  paddingTop: e.spacing(1),
15
14
  marginTop: e.spacing(2),
16
15
  marginBottom: e.spacing(2)
17
- })), _ = c("div")(({ theme: e }) => ({
16
+ })), g = s("div")(({ theme: e }) => ({
18
17
  display: "flex",
19
18
  flexWrap: "wrap",
20
19
  width: "100%",
21
20
  paddingBottom: e.spacing(2.5),
22
21
  justifyContent: "space-around"
23
- })), v = c("div")(({ theme: e }) => ({
22
+ })), _ = s("div")(({ theme: e }) => ({
24
23
  fontSize: e.typography.fontSize - 2,
25
24
  color: e.palette.error.main,
26
25
  paddingTop: e.spacing(1)
27
- })), y = (i) => {
28
- let { model: a, configuration: c, onPromptChanged: u, imageSupport: f, uploadSoundSupport: y, onChangeModel: b, onConfigurationChanged: x, onTeacherInstructionsChanged: S } = i, { baseInputConfiguration: C = {}, contentDimensions: w = {}, prompt: T = {}, scoringType: E = {}, settingsPanelDisabled: D, spellCheck: O = {}, teacherInstructions: k = {} } = c || {}, { errors: A = {}, extraCSSRules: j, teacherInstructionsEnabled: M, spellCheckEnabled: N } = a || {}, { prompt: P, teacherInstructions: F } = A, I = {
29
- teacherInstructionsEnabled: k.settings && m(k.label),
30
- spellCheckEnabled: O.settings && m(O.label),
31
- scoringType: E.settings && h(E.label, ["auto", "rubric"])
26
+ })), v = (i) => {
27
+ let { model: s, configuration: l, onPromptChanged: d, imageSupport: v, uploadSoundSupport: y, onChangeModel: b, onConfigurationChanged: x, onTeacherInstructionsChanged: S } = i, { baseInputConfiguration: C = {}, contentDimensions: w = {}, prompt: T = {}, scoringType: E = {}, settingsPanelDisabled: D, spellCheck: O = {}, teacherInstructions: k = {} } = l || {}, { errors: A = {}, extraCSSRules: j, teacherInstructionsEnabled: M, spellCheckEnabled: N } = s || {}, { prompt: P, teacherInstructions: F } = A, I = {
28
+ teacherInstructionsEnabled: k.settings && p(k.label),
29
+ spellCheckEnabled: O.settings && p(O.label),
30
+ scoringType: E.settings && m(E.label, ["auto", "rubric"])
32
31
  }, L = (e = {}) => ({
33
32
  ...C,
34
33
  ...e
35
34
  });
36
- return /* @__PURE__ */ s(d.ConfigLayout, {
35
+ return /* @__PURE__ */ o(u.ConfigLayout, {
37
36
  extraCSSRules: j,
38
37
  dimensions: w,
39
38
  hideSettings: D,
40
- settings: /* @__PURE__ */ o(p, {
41
- model: a,
39
+ settings: /* @__PURE__ */ a(f, {
40
+ model: s,
42
41
  onChangeModel: b,
43
- configuration: c,
42
+ configuration: l,
44
43
  onChangeConfiguration: x,
45
44
  groups: { Properties: I }
46
45
  }),
47
46
  children: [
48
- M && /* @__PURE__ */ s(g, {
47
+ M && /* @__PURE__ */ o(h, {
49
48
  label: k.label,
50
- children: [/* @__PURE__ */ o(l, {
51
- markup: a.teacherInstructions || "",
49
+ children: [/* @__PURE__ */ a(c, {
50
+ markup: s.teacherInstructions || "",
52
51
  onChange: S,
53
- imageSupport: f,
52
+ imageSupport: v,
54
53
  error: F,
55
54
  pluginProps: L(k?.inputConfiguration),
56
55
  nonEmpty: !1,
57
56
  spellCheck: N,
58
57
  uploadSoundSupport: y
59
- }), F && /* @__PURE__ */ o(v, { children: F })]
58
+ }), F && /* @__PURE__ */ a(_, { children: F })]
60
59
  }),
61
- /* @__PURE__ */ s(g, {
60
+ /* @__PURE__ */ o(h, {
62
61
  label: T.label,
63
- children: [/* @__PURE__ */ o(l, {
64
- markup: a.prompt,
65
- onChange: u,
66
- imageSupport: f,
62
+ children: [/* @__PURE__ */ a(c, {
63
+ markup: s.prompt,
64
+ onChange: d,
65
+ imageSupport: v,
67
66
  error: P,
68
67
  pluginProps: L(T?.inputConfiguration),
69
68
  nonEmpty: !T.settings,
70
69
  spellCheck: N,
71
70
  uploadSoundSupport: y,
72
71
  disableUnderline: !0
73
- }), P && /* @__PURE__ */ o(v, { children: P })]
72
+ }), P && /* @__PURE__ */ a(_, { children: P })]
74
73
  }),
75
- /* @__PURE__ */ s(_, { children: [
76
- /* @__PURE__ */ o(t, {
77
- model: a,
74
+ /* @__PURE__ */ o(g, { children: [
75
+ /* @__PURE__ */ a(t, {
76
+ model: s,
78
77
  onChangeModel: b
79
78
  }),
80
- /* @__PURE__ */ o(e, {
81
- model: a,
79
+ /* @__PURE__ */ a(e, {
80
+ model: s,
82
81
  onChangeModel: b
83
82
  }),
84
- /* @__PURE__ */ o(n, {
85
- model: a,
83
+ /* @__PURE__ */ a(n, {
84
+ model: s,
86
85
  onChangeModel: b
87
86
  })
88
87
  ] }),
89
- /* @__PURE__ */ o(r, {
90
- model: a,
88
+ /* @__PURE__ */ a(r, {
89
+ model: s,
91
90
  onChangeModel: b
92
91
  })
93
92
  ]
94
93
  });
95
- }, b = class extends i.Component {
96
- static propTypes = {
97
- model: a.object.isRequired,
98
- disableSidePanel: a.bool,
99
- onModelChanged: a.func.isRequired,
100
- onConfigurationChanged: a.func.isRequired,
101
- imageSupport: a.shape({
102
- add: a.func.isRequired,
103
- delete: a.func.isRequired
104
- })
105
- };
94
+ }, y = class extends i.Component {
106
95
  onPromptChanged = (e) => {
107
96
  this.props.onModelChanged({
108
97
  ...this.props.model,
@@ -122,7 +111,7 @@ var { Panel: p, toggle: m, radio: h } = f, g = c(u)(({ theme: e }) => ({
122
111
  });
123
112
  };
124
113
  render() {
125
- return /* @__PURE__ */ o(y, {
114
+ return /* @__PURE__ */ a(v, {
126
115
  ...this.props,
127
116
  onChangeModel: this.props.onModelChanged,
128
117
  onPromptChanged: this.onPromptChanged,
@@ -131,4 +120,4 @@ var { Panel: p, toggle: m, radio: h } = f, g = c(u)(({ theme: e }) => ({
131
120
  }
132
121
  };
133
122
  //#endregion
134
- export { b as Main, b as default };
123
+ export { y as Main, y as default };
@@ -5,75 +5,75 @@
5
5
  declare const _default: {
6
6
  model: {
7
7
  columnLabels: string[];
8
- labelType: string;
9
- matrixValues: {};
8
+ labelType: "agreement";
9
+ matrixValues: Record<string, number>;
10
10
  prompt: string;
11
- promptEnabled: boolean;
11
+ promptEnabled: true;
12
12
  rowLabels: string[];
13
13
  teacherInstructions: string;
14
- teacherInstructionsEnabled: boolean;
14
+ teacherInstructionsEnabled: true;
15
15
  };
16
16
  configuration: {
17
17
  baseInputConfiguration: {
18
18
  h3: {
19
- disabled: boolean;
19
+ disabled: true;
20
20
  };
21
21
  audio: {
22
- disabled: boolean;
22
+ disabled: false;
23
23
  };
24
24
  video: {
25
- disabled: boolean;
25
+ disabled: false;
26
26
  };
27
27
  image: {
28
- disabled: boolean;
28
+ disabled: false;
29
29
  };
30
30
  textAlign: {
31
- disabled: boolean;
31
+ disabled: true;
32
32
  };
33
33
  showParagraphs: {
34
- disabled: boolean;
34
+ disabled: false;
35
35
  };
36
36
  separateParagraphs: {
37
- disabled: boolean;
37
+ disabled: true;
38
38
  };
39
39
  };
40
40
  prompt: {
41
- settings: boolean;
41
+ settings: true;
42
42
  label: string;
43
43
  inputConfiguration: {
44
44
  audio: {
45
- disabled: boolean;
45
+ disabled: false;
46
46
  };
47
47
  video: {
48
- disabled: boolean;
48
+ disabled: false;
49
49
  };
50
50
  image: {
51
- disabled: boolean;
51
+ disabled: false;
52
52
  };
53
53
  };
54
- required: boolean;
54
+ required: false;
55
55
  };
56
- settingsPanelDisabled: boolean;
56
+ settingsPanelDisabled: false;
57
57
  spellCheck: {
58
58
  label: string;
59
- settings: boolean;
60
- enabled: boolean;
59
+ settings: false;
60
+ enabled: true;
61
61
  };
62
62
  teacherInstructions: {
63
- settings: boolean;
63
+ settings: true;
64
64
  label: string;
65
65
  inputConfiguration: {
66
66
  audio: {
67
- disabled: boolean;
67
+ disabled: false;
68
68
  };
69
69
  video: {
70
- disabled: boolean;
70
+ disabled: false;
71
71
  };
72
72
  image: {
73
- disabled: boolean;
73
+ disabled: false;
74
74
  };
75
75
  };
76
- required: boolean;
76
+ required: false;
77
77
  };
78
78
  };
79
79
  };
@@ -1,23 +1,21 @@
1
+ import { type DeleteDone, type SoundHandler } from '@pie-element/shared-configure-events';
2
+ import { type AuthorModel } from './Main.js';
3
+ import type { MatrixConfiguration, MatrixModel } from '../types.js';
1
4
  export default class Matrix extends HTMLElement {
2
- static createDefaultModel: (model?: {}) => {
3
- columnLabels: string[];
4
- labelType: string;
5
- matrixValues: {};
6
- prompt: string;
7
- promptEnabled: boolean;
8
- rowLabels: string[];
9
- teacherInstructions: string;
10
- teacherInstructionsEnabled: boolean;
11
- };
5
+ private _root;
6
+ private _model;
7
+ private _configuration;
8
+ private _disableSidePanel?;
9
+ static createDefaultModel: (model?: Partial<MatrixModel>) => AuthorModel;
12
10
  constructor();
13
- set model(s: any);
14
- set configuration(c: any);
15
- set disableSidePanel(s: any);
16
- dispatchModelUpdated(reset: any): void;
17
- onModelChanged(m: any, reset: any): void;
18
- onConfigurationChanged(c: any): void;
19
- insertSound(handler: any): void;
20
- onDeleteSound(src: any, done: any): void;
11
+ set model(s: Partial<MatrixModel>);
12
+ set configuration(c: MatrixConfiguration);
13
+ set disableSidePanel(s: boolean);
14
+ dispatchModelUpdated(reset?: boolean): void;
15
+ onModelChanged(m: AuthorModel, reset?: boolean): void;
16
+ onConfigurationChanged(c: MatrixConfiguration): void;
17
+ insertSound(handler: SoundHandler): void;
18
+ onDeleteSound(src: string, done: DeleteDone): void;
21
19
  _render(): void;
22
20
  connectedCallback(): void;
23
21
  disconnectedCallback(): void;
@@ -10,6 +10,10 @@ var l = a("matrix:configure"), u = (e, n) => ({
10
10
  configuration: i(e, t.configuration),
11
11
  model: n
12
12
  }), d = class i extends HTMLElement {
13
+ _root;
14
+ _model;
15
+ _configuration;
16
+ _disableSidePanel;
13
17
  static createDefaultModel = (e = {}) => ({
14
18
  ...t.model,
15
19
  ...e
@@ -34890,15 +34890,12 @@ var rW = class extends mt.Component {
34890
34890
  }), sW = (e) => typeof e == "string" ? {
34891
34891
  label: e,
34892
34892
  value: e
34893
- } : e, cW = function() {
34894
- let [e, t, n = !1] = Array.prototype.slice.call(arguments);
34895
- return {
34896
- type: "radio",
34897
- label: e,
34898
- choices: t && t.map((e) => sW(e)),
34899
- isConfigProperty: n
34900
- };
34901
- }, lW = (e, t, n = !1) => ({
34893
+ } : e, cW = (e, t, n = !1) => ({
34894
+ type: "radio",
34895
+ label: e,
34896
+ choices: t && t.map((e) => sW(e)),
34897
+ isConfigProperty: n
34898
+ }), lW = (e, t, n = !1) => ({
34902
34899
  type: "dropdown",
34903
34900
  label: e,
34904
34901
  choices: t,
@@ -35670,16 +35667,6 @@ var { Panel: kG, toggle: AG, radio: jG } = iW, MG = A(yW)(({ theme: e }) => ({
35670
35667
  ]
35671
35668
  });
35672
35669
  }, IG = class extends mt.Component {
35673
- static propTypes = {
35674
- model: V.default.object.isRequired,
35675
- disableSidePanel: V.default.bool,
35676
- onModelChanged: V.default.func.isRequired,
35677
- onConfigurationChanged: V.default.func.isRequired,
35678
- imageSupport: V.default.shape({
35679
- add: V.default.func.isRequired,
35680
- delete: V.default.func.isRequired
35681
- })
35682
- };
35683
35670
  onPromptChanged = (e) => {
35684
35671
  this.props.onModelChanged({
35685
35672
  ...this.props.model,
@@ -35762,6 +35749,10 @@ var { Panel: kG, toggle: AG, radio: jG } = iW, MG = A(yW)(({ theme: e }) => ({
35762
35749
  configuration: dt(e, LG.configuration),
35763
35750
  model: t
35764
35751
  }), BG = class e extends HTMLElement {
35752
+ _root;
35753
+ _model;
35754
+ _configuration;
35755
+ _disableSidePanel;
35765
35756
  static createDefaultModel = (e = {}) => ({
35766
35757
  ...LG.model,
35767
35758
  ...e