@pie-element/passage 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.
@@ -1,6 +1,7 @@
1
+ import type { ConfigureLanguageOptionsProp } from '@pie-element/shared-types';
1
2
  declare const _default: {
2
3
  model: {
3
- authorEnabled: boolean;
4
+ authorEnabled: true;
4
5
  passages: {
5
6
  teacherInstructions: string;
6
7
  title: string;
@@ -8,133 +9,133 @@ declare const _default: {
8
9
  author: string;
9
10
  text: string;
10
11
  }[];
11
- subtitleEnabled: boolean;
12
- teacherInstructionsEnabled: boolean;
13
- textEnabled: boolean;
14
- titleEnabled: boolean;
12
+ subtitleEnabled: true;
13
+ teacherInstructionsEnabled: true;
14
+ textEnabled: true;
15
+ titleEnabled: true;
15
16
  };
16
17
  configuration: {
17
18
  baseInputConfiguration: {
18
19
  audio: {
19
- disabled: boolean;
20
+ disabled: false;
20
21
  };
21
22
  video: {
22
- disabled: boolean;
23
+ disabled: false;
23
24
  };
24
25
  image: {
25
- disabled: boolean;
26
+ disabled: false;
26
27
  };
27
28
  h3: {
28
- disabled: boolean;
29
+ disabled: true;
29
30
  };
30
31
  blockquote: {
31
- disabled: boolean;
32
+ disabled: true;
32
33
  };
33
34
  textAlign: {
34
- disabled: boolean;
35
+ disabled: true;
35
36
  };
36
37
  showParagraphs: {
37
- disabled: boolean;
38
+ disabled: false;
38
39
  };
39
40
  separateParagraphs: {
40
- disabled: boolean;
41
+ disabled: true;
41
42
  };
42
43
  };
43
- settingsPanelDisabled: boolean;
44
+ settingsPanelDisabled: false;
44
45
  title: {
45
- settings: boolean;
46
+ settings: true;
46
47
  label: string;
47
48
  inputConfiguration: {
48
49
  audio: {
49
- disabled: boolean;
50
+ disabled: true;
50
51
  };
51
52
  video: {
52
- disabled: boolean;
53
+ disabled: true;
53
54
  };
54
55
  image: {
55
- disabled: boolean;
56
+ disabled: true;
56
57
  };
57
58
  textAlign: {
58
- disabled: boolean;
59
+ disabled: false;
59
60
  };
60
61
  };
61
- required: boolean;
62
+ required: true;
62
63
  };
63
64
  subtitle: {
64
- settings: boolean;
65
+ settings: true;
65
66
  label: string;
66
67
  inputConfiguration: {
67
68
  audio: {
68
- disabled: boolean;
69
+ disabled: true;
69
70
  };
70
71
  video: {
71
- disabled: boolean;
72
+ disabled: true;
72
73
  };
73
74
  image: {
74
- disabled: boolean;
75
+ disabled: true;
75
76
  };
76
77
  textAlign: {
77
- disabled: boolean;
78
+ disabled: false;
78
79
  };
79
80
  };
80
- required: boolean;
81
+ required: false;
81
82
  };
82
83
  author: {
83
- settings: boolean;
84
+ settings: true;
84
85
  label: string;
85
86
  inputConfiguration: {
86
87
  audio: {
87
- disabled: boolean;
88
+ disabled: true;
88
89
  };
89
90
  video: {
90
- disabled: boolean;
91
+ disabled: true;
91
92
  };
92
93
  image: {
93
- disabled: boolean;
94
+ disabled: true;
94
95
  };
95
96
  };
96
- required: boolean;
97
+ required: false;
97
98
  };
98
99
  text: {
99
- settings: boolean;
100
+ settings: true;
100
101
  label: string;
101
102
  inputConfiguration: {
102
103
  audio: {
103
- disabled: boolean;
104
+ disabled: false;
104
105
  };
105
106
  video: {
106
- disabled: boolean;
107
+ disabled: false;
107
108
  };
108
109
  image: {
109
- disabled: boolean;
110
+ disabled: false;
110
111
  };
111
112
  h3: {
112
- disabled: boolean;
113
+ disabled: false;
113
114
  };
114
115
  blockquote: {
115
- disabled: boolean;
116
+ disabled: false;
116
117
  };
117
118
  textAlign: {
118
- disabled: boolean;
119
+ disabled: false;
119
120
  };
120
121
  };
121
- required: boolean;
122
+ required: true;
122
123
  };
123
124
  teacherInstructions: {
124
- settings: boolean;
125
+ settings: true;
125
126
  label: string;
126
127
  inputConfiguration: {
127
128
  audio: {
128
- disabled: boolean;
129
+ disabled: false;
129
130
  };
130
131
  video: {
131
- disabled: boolean;
132
+ disabled: false;
132
133
  };
133
134
  image: {
134
- disabled: boolean;
135
+ disabled: false;
135
136
  };
136
137
  };
137
- required: boolean;
138
+ required: false;
138
139
  };
139
140
  maxImageWidth: {
140
141
  teacherInstructions: number;
@@ -145,22 +146,22 @@ declare const _default: {
145
146
  text: number;
146
147
  };
147
148
  mathMlOptions: {
148
- mmlOutput: boolean;
149
- mmlEditing: boolean;
149
+ mmlOutput: false;
150
+ mmlEditing: false;
150
151
  };
151
152
  language: {
152
- settings: boolean;
153
+ settings: false;
153
154
  label: string;
154
- enabled: boolean;
155
+ enabled: false;
155
156
  };
156
157
  languageChoices: {
157
158
  label: string;
158
- options: never[];
159
+ options: ConfigureLanguageOptionsProp[];
159
160
  };
160
161
  additionalPassage: {
161
- settings: boolean;
162
+ settings: true;
162
163
  label: string;
163
- enabled: boolean;
164
+ enabled: false;
164
165
  };
165
166
  };
166
167
  };
@@ -1,20 +1,36 @@
1
1
  import React from 'react';
2
- import PropTypes from 'prop-types';
3
- export declare class Main extends React.Component {
4
- static propTypes: {
5
- onModelChanged: PropTypes.Validator<(...args: any[]) => any>;
6
- onConfigurationChanged: PropTypes.Requireable<(...args: any[]) => any>;
7
- model: PropTypes.Validator<object>;
8
- configuration: PropTypes.Validator<object>;
9
- imageSupport: PropTypes.Validator<object>;
10
- uploadSoundSupport: PropTypes.Validator<object>;
11
- classes: PropTypes.Validator<object>;
2
+ import type { DeleteDone, ImageHandler, SoundHandler } from '@pie-element/shared-configure-events';
3
+ import type { PassageValidationErrors } from '../controller/index.js';
4
+ import type { PassageConfiguration, PassageEntry, PassageModel } from '../types.js';
5
+ /** The model the author edits; the host sets `errors` from the controller's `validate()`. */
6
+ export type AuthorModel = Partial<PassageModel> & {
7
+ passages: PassageEntry[];
8
+ errors?: PassageValidationErrors;
9
+ };
10
+ export type MainProps = {
11
+ model: AuthorModel;
12
+ configuration: PassageConfiguration;
13
+ onModelChanged: (model: AuthorModel) => void;
14
+ onConfigurationChanged: (configuration: PassageConfiguration) => void;
15
+ imageSupport: {
16
+ add: (handler: ImageHandler) => void;
17
+ delete: (src: string, done: DeleteDone) => void;
12
18
  };
13
- constructor(props: any);
14
- getInnerText: (html: any) => any;
15
- onDelete: any;
16
- removeAdditionalPassage: any;
17
- addAdditionalPassage: any;
19
+ uploadSoundSupport: {
20
+ add: (handler: SoundHandler) => void;
21
+ delete: (src: string, done: DeleteDone) => void;
22
+ };
23
+ };
24
+ type MainState = {
25
+ showConfirmationDialog: boolean;
26
+ indexToRemove: number;
27
+ };
28
+ export declare class Main extends React.Component<MainProps, MainState> {
29
+ constructor(props: MainProps);
30
+ getInnerText: (html: string) => string;
31
+ onDelete: (model: AuthorModel, indexToRemove: number, onModelChanged: (model: AuthorModel) => void) => void;
32
+ removeAdditionalPassage: (indexToRemove: number) => void;
33
+ addAdditionalPassage: () => void;
18
34
  render(): React.JSX.Element;
19
35
  }
20
36
  export default Main;
@@ -1,25 +1,15 @@
1
1
  import { ConfirmationDialog as e, PassageButton as t } from "./common.js";
2
2
  import { PassageComponent as n } from "./passage.js";
3
3
  import r from "react";
4
- import i from "prop-types";
5
- import { styled as a } from "@mui/material/styles";
6
- import { jsx as o, jsxs as s } from "react/jsx-runtime";
7
- import { layout as c, settings as l } from "@pie-lib/config-ui";
8
- import u from "@mui/material/Typography";
4
+ import { styled as i } from "@mui/material/styles";
5
+ import { jsx as a, jsxs as o } from "react/jsx-runtime";
6
+ import { layout as s, settings as c } from "@pie-lib/config-ui";
7
+ import l from "@mui/material/Typography";
9
8
  //#region src/author/design.tsx
10
- var { Panel: d, toggle: f, dropdown: p } = l, m = a(u)(({ theme: e }) => ({
9
+ var { Panel: u, toggle: d, dropdown: f } = c, p = i(l)(({ theme: e }) => ({
11
10
  paddingTop: e.spacing(2),
12
11
  marginBottom: e.spacing(2)
13
- })), h = class extends r.Component {
14
- static propTypes = {
15
- onModelChanged: i.func.isRequired,
16
- onConfigurationChanged: i.func,
17
- model: i.object.isRequired,
18
- configuration: i.object.isRequired,
19
- imageSupport: i.object.isRequired,
20
- uploadSoundSupport: i.object.isRequired,
21
- classes: i.object.isRequired
22
- };
12
+ })), m = class extends r.Component {
23
13
  constructor(e) {
24
14
  super(e), this.state = {
25
15
  showConfirmationDialog: !1,
@@ -38,7 +28,7 @@ var { Panel: d, toggle: f, dropdown: p } = l, m = a(u)(({ theme: e }) => ({
38
28
  });
39
29
  };
40
30
  removeAdditionalPassage = (e) => {
41
- let { model: t = {}, onModelChanged: n } = this.props, { passages: r = [] } = t, { teacherInstructions: i = "", title: a = "", subtitle: o = "", author: s = "", text: c = "" } = r[e];
31
+ let { model: t, onModelChanged: n } = this.props, { passages: r = [] } = t, { teacherInstructions: i = "", title: a = "", subtitle: o = "", author: s = "", text: c = "" } = r[e];
42
32
  this.getInnerText(i).trim() || this.getInnerText(a).trim() || this.getInnerText(o).trim() || this.getInnerText(s).trim() || this.getInnerText(c).trim() ? this.setState({
43
33
  showConfirmationDialog: !0,
44
34
  indexToRemove: e
@@ -58,53 +48,53 @@ var { Panel: d, toggle: f, dropdown: p } = l, m = a(u)(({ theme: e }) => ({
58
48
  });
59
49
  };
60
50
  render() {
61
- let { model: i, configuration: a, imageSupport: l, onConfigurationChanged: u, onModelChanged: h, uploadSoundSupport: g } = this.props, { settingsPanelDisabled: _, language: v = {}, languageChoices: y = {}, teacherInstructions: b = {}, title: x = {}, subtitle: S = {}, text: C = {}, author: w = {}, additionalPassage: T = {} } = a || {}, { extraCSSRules: E, passages: D } = i || {}, O = {
62
- titleEnabled: x && x.settings && f(x.label),
63
- subtitleEnabled: S && S.settings && f(S.label),
64
- authorEnabled: w && w.settings && f(w.label),
65
- textEnabled: C && C.settings && f(C.label),
66
- "additionalPassage.enabled": T && T.settings && f(T.label, !0)
51
+ let { model: i, configuration: c, imageSupport: l, onConfigurationChanged: m, onModelChanged: h, uploadSoundSupport: g } = this.props, { settingsPanelDisabled: _, language: v = {}, languageChoices: y = {}, teacherInstructions: b = {}, title: x = {}, subtitle: S = {}, text: C = {}, author: w = {}, additionalPassage: T = {} } = c || {}, { extraCSSRules: E, passages: D } = i || {}, O = {
52
+ titleEnabled: x && x.settings && d(x.label),
53
+ subtitleEnabled: S && S.settings && d(S.label),
54
+ authorEnabled: w && w.settings && d(w.label),
55
+ textEnabled: C && C.settings && d(C.label),
56
+ "additionalPassage.enabled": T && T.settings && d(T.label, !0)
67
57
  }, k = {
68
- teacherInstructionsEnabled: b && b.settings && f(b.label),
69
- "language.enabled": v && v.settings && f(v.label, !0),
70
- language: v && v.settings && v.enabled && p(y.label, y.options)
58
+ teacherInstructionsEnabled: b && b.settings && d(b.label),
59
+ "language.enabled": v && v.settings && d(v.label, !0),
60
+ language: v && v.settings && v.enabled && f(y.label, y.options)
71
61
  }, A = `${T.label} will be deleted`, { indexToRemove: j, showConfirmationDialog: M } = this.state;
72
- return /* @__PURE__ */ s(c.ConfigLayout, {
62
+ return /* @__PURE__ */ o(s.ConfigLayout, {
73
63
  extraCSSRules: E,
74
64
  hideSettings: _,
75
- settings: /* @__PURE__ */ o(d, {
65
+ settings: /* @__PURE__ */ a(u, {
76
66
  model: i,
77
- configuration: a,
67
+ configuration: c,
78
68
  onChangeModel: (e) => h(e),
79
- onChangeConfiguration: (e) => u(e),
69
+ onChangeConfiguration: (e) => m(e),
80
70
  groups: {
81
71
  Settings: O,
82
72
  Properties: k
83
73
  }
84
74
  }),
85
- children: [D.map((e, c) => /* @__PURE__ */ s(r.Fragment, { children: [
86
- c > 0 && /* @__PURE__ */ o(m, {
75
+ children: [D.map((e, s) => /* @__PURE__ */ o(r.Fragment, { children: [
76
+ s > 0 && /* @__PURE__ */ a(p, {
87
77
  variant: "h5",
88
78
  children: T.label
89
79
  }),
90
- /* @__PURE__ */ o(n, {
80
+ /* @__PURE__ */ a(n, {
91
81
  imageSupport: l,
92
82
  uploadSoundSupport: g,
93
83
  model: i,
94
- configuration: a,
95
- passageIndex: c,
84
+ configuration: c,
85
+ passageIndex: s,
96
86
  onModelChanged: h
97
87
  }),
98
- c > 0 && T.enabled && /* @__PURE__ */ o(t, {
88
+ s > 0 && T.enabled && /* @__PURE__ */ a(t, {
99
89
  type: "remove",
100
90
  label: `Remove ${T.label}`,
101
- onClick: () => this.removeAdditionalPassage(c)
91
+ onClick: () => this.removeAdditionalPassage(s)
102
92
  }),
103
- c === 0 && T.enabled && D.length < 2 && /* @__PURE__ */ o(t, {
93
+ s === 0 && T.enabled && D.length < 2 && /* @__PURE__ */ a(t, {
104
94
  label: `Add ${T.label}`,
105
95
  onClick: this.addAdditionalPassage
106
96
  })
107
- ] }, c)), /* @__PURE__ */ o(e, {
97
+ ] }, s)), /* @__PURE__ */ a(e, {
108
98
  open: M,
109
99
  title: "Warning",
110
100
  content: A,
@@ -117,4 +107,4 @@ var { Panel: d, toggle: f, dropdown: p } = l, m = a(u)(({ theme: e }) => ({
117
107
  }
118
108
  };
119
109
  //#endregion
120
- export { h as Main, h as default };
110
+ export { m as Main, m as default };
@@ -1,28 +1,21 @@
1
+ import { type DeleteDone, type ImageHandler, type SoundHandler } from '@pie-element/shared-configure-events';
2
+ import { type AuthorModel } from './design.js';
3
+ import type { PassageConfiguration } from '../types.js';
1
4
  export default class PassageConfigure extends HTMLElement {
2
- static createDefaultModel: (model?: {}) => {
3
- authorEnabled: boolean;
4
- passages: {
5
- teacherInstructions: string;
6
- title: string;
7
- subtitle: string;
8
- author: string;
9
- text: string;
10
- }[];
11
- subtitleEnabled: boolean;
12
- teacherInstructionsEnabled: boolean;
13
- textEnabled: boolean;
14
- titleEnabled: boolean;
15
- };
5
+ private _root;
6
+ private _model;
7
+ private _configuration;
8
+ static createDefaultModel: (model?: Partial<AuthorModel>) => AuthorModel;
16
9
  constructor();
17
- set model(m: any);
18
- set configuration(c: any);
10
+ set model(m: Partial<AuthorModel>);
11
+ set configuration(c: PassageConfiguration);
19
12
  connectedCallback(): void;
20
- modelChanged(m: any): void;
21
- onConfigurationChanged(c: any): void;
22
- insertImage(handler: any): void;
23
- onDeleteImage(src: any, done: any): void;
24
- insertSound(handler: any): void;
25
- onDeleteSound(src: any, done: any): void;
13
+ modelChanged(m: AuthorModel): void;
14
+ onConfigurationChanged(c: PassageConfiguration): void;
15
+ insertImage(handler: ImageHandler): void;
16
+ onDeleteImage(src: string, done: DeleteDone): void;
17
+ insertSound(handler: SoundHandler): void;
18
+ onDeleteSound(src: string, done: DeleteDone): void;
26
19
  render(): void;
27
20
  disconnectedCallback(): void;
28
21
  }
@@ -5,6 +5,9 @@ import { createRoot as r } from "react-dom/client";
5
5
  import { DeleteImageEvent as i, DeleteSoundEvent as a, InsertImageEvent as o, InsertSoundEvent as s, ModelUpdatedEvent as c } from "@pie-element/shared-configure-events";
6
6
  //#region src/author/index.ts
7
7
  var l = class l extends HTMLElement {
8
+ _root;
9
+ _model;
10
+ _configuration;
8
11
  static createDefaultModel = (e = {}) => ({
9
12
  ...t.model,
10
13
  ...e
@@ -22,7 +25,7 @@ var l = class l extends HTMLElement {
22
25
  this.render();
23
26
  }
24
27
  modelChanged(e) {
25
- this._model = e, this.dispatchEvent(new c(this._model), !0), this.render();
28
+ this._model = e, this.dispatchEvent(new c(this._model)), this.render();
26
29
  }
27
30
  onConfigurationChanged(e) {
28
31
  this._configuration = e, this.render();
@@ -34340,15 +34340,12 @@ var zU = class extends st.Component {
34340
34340
  }), UU = (e) => typeof e == "string" ? {
34341
34341
  label: e,
34342
34342
  value: e
34343
- } : e, WU = function() {
34344
- let [e, t, n = !1] = Array.prototype.slice.call(arguments);
34345
- return {
34346
- type: "radio",
34347
- label: e,
34348
- choices: t && t.map((e) => UU(e)),
34349
- isConfigProperty: n
34350
- };
34351
- }, GU = (e, t, n = !1) => ({
34343
+ } : e, WU = (e, t, n = !1) => ({
34344
+ type: "radio",
34345
+ label: e,
34346
+ choices: t && t.map((e) => UU(e)),
34347
+ isConfigProperty: n
34348
+ }), GU = (e, t, n = !1) => ({
34352
34349
  type: "dropdown",
34353
34350
  label: e,
34354
34351
  choices: t,
@@ -34549,15 +34546,6 @@ var oW = A(tW)(({ theme: e }) => ({
34549
34546
  paddingTop: e.spacing(2),
34550
34547
  marginBottom: e.spacing(2)
34551
34548
  })), pW = class extends st.Component {
34552
- static propTypes = {
34553
- onModelChanged: P.default.func.isRequired,
34554
- onConfigurationChanged: P.default.func,
34555
- model: P.default.object.isRequired,
34556
- configuration: P.default.object.isRequired,
34557
- imageSupport: P.default.object.isRequired,
34558
- uploadSoundSupport: P.default.object.isRequired,
34559
- classes: P.default.object.isRequired
34560
- };
34561
34549
  constructor(e) {
34562
34550
  super(e), this.state = {
34563
34551
  showConfirmationDialog: !1,
@@ -34576,7 +34564,7 @@ var oW = A(tW)(({ theme: e }) => ({
34576
34564
  });
34577
34565
  };
34578
34566
  removeAdditionalPassage = (e) => {
34579
- let { model: t = {}, onModelChanged: n } = this.props, { passages: r = [] } = t, { teacherInstructions: i = "", title: a = "", subtitle: o = "", author: s = "", text: c = "" } = r[e];
34567
+ let { model: t, onModelChanged: n } = this.props, { passages: r = [] } = t, { teacherInstructions: i = "", title: a = "", subtitle: o = "", author: s = "", text: c = "" } = r[e];
34580
34568
  this.getInnerText(i).trim() || this.getInnerText(a).trim() || this.getInnerText(o).trim() || this.getInnerText(s).trim() || this.getInnerText(c).trim() ? this.setState({
34581
34569
  showConfirmationDialog: !0,
34582
34570
  indexToRemove: e
@@ -34763,6 +34751,9 @@ var oW = A(tW)(({ theme: e }) => ({
34763
34751
  }
34764
34752
  }
34765
34753
  }, hW = class e extends HTMLElement {
34754
+ _root;
34755
+ _model;
34756
+ _configuration;
34766
34757
  static createDefaultModel = (e = {}) => ({
34767
34758
  ...mW.model,
34768
34759
  ...e
@@ -34780,7 +34771,7 @@ var oW = A(tW)(({ theme: e }) => ({
34780
34771
  this.render();
34781
34772
  }
34782
34773
  modelChanged(e) {
34783
- this._model = e, this.dispatchEvent(new It(this._model), !0), this.render();
34774
+ this._model = e, this.dispatchEvent(new It(this._model)), this.render();
34784
34775
  }
34785
34776
  onConfigurationChanged(e) {
34786
34777
  this._configuration = e, this.render();