@pie-element/passage 7.1.1-next.0 → 7.1.1-next.17

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 (113) hide show
  1. package/CHANGELOG.json +227 -0
  2. package/CHANGELOG.md +1452 -0
  3. package/LICENSE.md +5 -0
  4. package/README.md +3 -0
  5. package/configure/CHANGELOG.md +672 -0
  6. package/configure/lib/common.js +74 -0
  7. package/configure/lib/common.js.map +1 -0
  8. package/configure/lib/defaults.js +174 -0
  9. package/configure/lib/defaults.js.map +1 -0
  10. package/configure/lib/design.js +185 -0
  11. package/configure/lib/design.js.map +1 -0
  12. package/configure/lib/index.js +86 -0
  13. package/configure/lib/index.js.map +1 -0
  14. package/configure/lib/passage.js +194 -0
  15. package/configure/lib/passage.js.map +1 -0
  16. package/configure/package.json +23 -0
  17. package/controller/CHANGELOG.json +1 -0
  18. package/controller/CHANGELOG.md +109 -0
  19. package/controller/lib/defaults.js +23 -0
  20. package/controller/lib/defaults.js.map +1 -0
  21. package/controller/lib/index.js +80 -0
  22. package/controller/lib/index.js.map +1 -0
  23. package/controller/package.json +13 -0
  24. package/docs/config-schema.json +1325 -0
  25. package/docs/config-schema.json.md +974 -0
  26. package/docs/demo/config.js +8 -0
  27. package/docs/demo/generate.js +32 -0
  28. package/docs/demo/index.html +1 -0
  29. package/docs/pie-schema.json +775 -0
  30. package/docs/pie-schema.json.md +561 -0
  31. package/lib/index.js +143 -0
  32. package/lib/index.js.map +1 -0
  33. package/lib/print.js +78 -0
  34. package/lib/print.js.map +1 -0
  35. package/lib/stimulus-tabs.js +339 -0
  36. package/lib/stimulus-tabs.js.map +1 -0
  37. package/module/configure.js +1 -0
  38. package/module/controller.js +920 -0
  39. package/module/demo.js +57 -0
  40. package/module/element.js +1 -0
  41. package/module/index.html +21 -0
  42. package/module/manifest.json +10 -0
  43. package/module/print-demo.js +95 -0
  44. package/module/print.html +18 -0
  45. package/module/print.js +1 -0
  46. package/package.json +19 -56
  47. package/dist/author/common.d.ts +0 -36
  48. package/dist/author/common.js +0 -56
  49. package/dist/author/defaults.d.ts +0 -175
  50. package/dist/author/defaults.js +0 -113
  51. package/dist/author/design.d.ts +0 -28
  52. package/dist/author/design.js +0 -120
  53. package/dist/author/index.d.ts +0 -36
  54. package/dist/author/index.js +0 -66
  55. package/dist/author/passage.d.ts +0 -27
  56. package/dist/author/passage.js +0 -127
  57. package/dist/controller/defaults.d.ts +0 -23
  58. package/dist/controller/defaults.js +0 -17
  59. package/dist/controller/index.d.ts +0 -18
  60. package/dist/controller/index.js +0 -50
  61. package/dist/delivery/index.d.ts +0 -22
  62. package/dist/delivery/index.js +0 -83
  63. package/dist/delivery/stimulus-tabs.d.ts +0 -21
  64. package/dist/delivery/stimulus-tabs.js +0 -220
  65. package/dist/index.d.ts +0 -1
  66. package/dist/index.iife.d.ts +0 -8
  67. package/dist/index.iife.js +0 -145
  68. package/dist/index.js +0 -2
  69. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_DataView.js +0 -6
  70. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Map.js +0 -6
  71. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Promise.js +0 -6
  72. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Set.js +0 -6
  73. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Symbol.js +0 -5
  74. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_WeakMap.js +0 -6
  75. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseGetTag.js +0 -10
  76. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsArguments.js +0 -9
  77. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsNative.js +0 -11
  78. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsTypedArray.js +0 -11
  79. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseKeys.js +0 -12
  80. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseTrim.js +0 -8
  81. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseUnary.js +0 -8
  82. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_coreJsData.js +0 -5
  83. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_freeGlobal.js +0 -4
  84. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getNative.js +0 -9
  85. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getRawTag.js +0 -14
  86. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getTag.js +0 -23
  87. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getValue.js +0 -6
  88. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_isMasked.js +0 -11
  89. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_isPrototype.js +0 -8
  90. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_nativeKeys.js +0 -5
  91. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_nodeUtil.js +0 -9
  92. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_objectToString.js +0 -7
  93. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_overArg.js +0 -8
  94. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_root.js +0 -5
  95. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_toSource.js +0 -15
  96. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_trimmedEndIndex.js +0 -8
  97. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/debounce.js +0 -50
  98. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isArguments.js +0 -10
  99. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isArray.js +0 -4
  100. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isArrayLike.js +0 -8
  101. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isBuffer.js +0 -6
  102. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isEmpty.js +0 -21
  103. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isFunction.js +0 -11
  104. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isLength.js +0 -7
  105. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isObject.js +0 -7
  106. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isObjectLike.js +0 -6
  107. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isSymbol.js +0 -9
  108. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isTypedArray.js +0 -7
  109. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/now.js +0 -7
  110. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/stubFalse.js +0 -6
  111. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/toNumber.js +0 -19
  112. package/dist/print/index.d.ts +0 -15
  113. package/dist/print/index.js +0 -47
@@ -1,113 +0,0 @@
1
- //#region src/author/defaults.ts
2
- var e = {
3
- model: {
4
- authorEnabled: !0,
5
- passages: [{
6
- teacherInstructions: "",
7
- title: "",
8
- subtitle: "",
9
- author: "",
10
- text: ""
11
- }],
12
- subtitleEnabled: !0,
13
- teacherInstructionsEnabled: !0,
14
- textEnabled: !0,
15
- titleEnabled: !0
16
- },
17
- configuration: {
18
- baseInputConfiguration: {
19
- audio: { disabled: !1 },
20
- video: { disabled: !1 },
21
- image: { disabled: !1 },
22
- h3: { disabled: !0 },
23
- blockquote: { disabled: !0 },
24
- textAlign: { disabled: !0 },
25
- showParagraphs: { disabled: !1 },
26
- separateParagraphs: { disabled: !0 }
27
- },
28
- settingsPanelDisabled: !1,
29
- title: {
30
- settings: !0,
31
- label: "Title",
32
- inputConfiguration: {
33
- audio: { disabled: !0 },
34
- video: { disabled: !0 },
35
- image: { disabled: !0 },
36
- textAlign: { disabled: !1 }
37
- },
38
- required: !0
39
- },
40
- subtitle: {
41
- settings: !0,
42
- label: "Subtitle",
43
- inputConfiguration: {
44
- audio: { disabled: !0 },
45
- video: { disabled: !0 },
46
- image: { disabled: !0 },
47
- textAlign: { disabled: !1 }
48
- },
49
- required: !1
50
- },
51
- author: {
52
- settings: !0,
53
- label: "Author",
54
- inputConfiguration: {
55
- audio: { disabled: !0 },
56
- video: { disabled: !0 },
57
- image: { disabled: !0 }
58
- },
59
- required: !1
60
- },
61
- text: {
62
- settings: !0,
63
- label: "Text",
64
- inputConfiguration: {
65
- audio: { disabled: !1 },
66
- video: { disabled: !1 },
67
- image: { disabled: !1 },
68
- h3: { disabled: !1 },
69
- blockquote: { disabled: !1 },
70
- textAlign: { disabled: !1 }
71
- },
72
- required: !0
73
- },
74
- teacherInstructions: {
75
- settings: !0,
76
- label: "Teacher Instructions",
77
- inputConfiguration: {
78
- audio: { disabled: !1 },
79
- video: { disabled: !1 },
80
- image: { disabled: !1 }
81
- },
82
- required: !1
83
- },
84
- maxImageWidth: {
85
- teacherInstructions: 300,
86
- text: 300
87
- },
88
- maxImageHeight: {
89
- teacherInstructions: 300,
90
- text: 300
91
- },
92
- mathMlOptions: {
93
- mmlOutput: !1,
94
- mmlEditing: !1
95
- },
96
- language: {
97
- settings: !1,
98
- label: "Specify Language",
99
- enabled: !1
100
- },
101
- languageChoices: {
102
- label: "Language Choices",
103
- options: []
104
- },
105
- additionalPassage: {
106
- settings: !0,
107
- label: "Additional Passage",
108
- enabled: !1
109
- }
110
- }
111
- };
112
- //#endregion
113
- export { e as default };
@@ -1,28 +0,0 @@
1
- /**
2
- * @synced-from pie-elements/packages/passage/configure/src/design.jsx
3
- * @auto-generated
4
- *
5
- * This file is automatically synced from pie-elements and converted to TypeScript.
6
- * Manual edits will be overwritten on next sync.
7
- * To make changes, edit the upstream JavaScript file and run sync again.
8
- */
9
- import React from 'react';
10
- import PropTypes from 'prop-types';
11
- export declare class Main extends React.Component {
12
- static propTypes: {
13
- onModelChanged: PropTypes.Validator<(...args: any[]) => any>;
14
- onConfigurationChanged: PropTypes.Requireable<(...args: any[]) => any>;
15
- model: PropTypes.Validator<object>;
16
- configuration: PropTypes.Validator<object>;
17
- imageSupport: PropTypes.Validator<object>;
18
- uploadSoundSupport: PropTypes.Validator<object>;
19
- classes: PropTypes.Validator<object>;
20
- };
21
- constructor(props: any);
22
- getInnerText: (html: any) => any;
23
- onDelete: any;
24
- removeAdditionalPassage: any;
25
- addAdditionalPassage: any;
26
- render(): React.JSX.Element;
27
- }
28
- export default Main;
@@ -1,120 +0,0 @@
1
- import { ConfirmationDialog as e, PassageButton as t } from "./common.js";
2
- import n from "./passage.js";
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";
9
- //#region src/author/design.tsx
10
- var { Panel: d, toggle: f, dropdown: p } = l, m = a(u)(({ theme: e }) => ({
11
- paddingTop: e.spacing(2),
12
- 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
- };
23
- constructor(e) {
24
- super(e), this.state = {
25
- showConfirmationDialog: !1,
26
- indexToRemove: -1
27
- };
28
- }
29
- getInnerText = (e) => (e || "").replaceAll(/<[^>]*>/g, "");
30
- onDelete = (e, t, n) => {
31
- let r = e.passages;
32
- r.splice(t, 1), n({
33
- ...e,
34
- passages: r
35
- }), this.setState({
36
- showConfirmationDialog: !1,
37
- indexToRemove: -1
38
- });
39
- };
40
- 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];
42
- this.getInnerText(i).trim() || this.getInnerText(a).trim() || this.getInnerText(o).trim() || this.getInnerText(s).trim() || this.getInnerText(c).trim() ? this.setState({
43
- showConfirmationDialog: !0,
44
- indexToRemove: e
45
- }) : this.onDelete(t, e, n);
46
- };
47
- addAdditionalPassage = () => {
48
- let { model: e, onModelChanged: t } = this.props, n = [...e.passages, {
49
- teacherInstructions: "",
50
- title: "",
51
- subtitle: "",
52
- author: "",
53
- text: ""
54
- }];
55
- t({
56
- ...e,
57
- passages: n
58
- });
59
- };
60
- 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)
67
- }, 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)
71
- }, A = `${T.label} will be deleted`, { indexToRemove: j, showConfirmationDialog: M } = this.state;
72
- return /* @__PURE__ */ s(c.ConfigLayout, {
73
- extraCSSRules: E,
74
- hideSettings: _,
75
- settings: /* @__PURE__ */ o(d, {
76
- model: i,
77
- configuration: a,
78
- onChangeModel: (e) => h(e),
79
- onChangeConfiguration: (e) => u(e),
80
- groups: {
81
- Settings: O,
82
- Properties: k
83
- }
84
- }),
85
- children: [D.map((e, c) => /* @__PURE__ */ s(r.Fragment, { children: [
86
- c > 0 && /* @__PURE__ */ o(m, {
87
- variant: "h5",
88
- children: T.label
89
- }),
90
- /* @__PURE__ */ o(n, {
91
- imageSupport: l,
92
- uploadSoundSupport: g,
93
- model: i,
94
- configuration: a,
95
- passageIndex: c,
96
- onModelChanged: h
97
- }),
98
- c > 0 && T.enabled && /* @__PURE__ */ o(t, {
99
- type: "remove",
100
- label: `Remove ${T.label}`,
101
- onClick: () => this.removeAdditionalPassage(c)
102
- }),
103
- c === 0 && T.enabled && D.length < 2 && /* @__PURE__ */ o(t, {
104
- label: `Add ${T.label}`,
105
- onClick: this.addAdditionalPassage
106
- })
107
- ] }, c)), /* @__PURE__ */ o(e, {
108
- open: M,
109
- title: "Warning",
110
- content: A,
111
- cancel: "Cancel",
112
- ok: "Ok",
113
- onCancel: () => this.setState({ showConfirmationDialog: !1 }),
114
- onOk: () => this.onDelete(i, j, h)
115
- })]
116
- });
117
- }
118
- };
119
- //#endregion
120
- export { h as default };
@@ -1,36 +0,0 @@
1
- /**
2
- * @synced-from pie-elements/packages/passage/configure/src/index.js
3
- * @auto-generated
4
- *
5
- * This file is automatically synced from pie-elements and converted to TypeScript.
6
- * Manual edits will be overwritten on next sync.
7
- * To make changes, edit the upstream JavaScript file and run sync again.
8
- */
9
- export default class PassageConfigure extends HTMLElement {
10
- static createDefaultModel: (model?: {}) => {
11
- authorEnabled: boolean;
12
- passages: {
13
- teacherInstructions: string;
14
- title: string;
15
- subtitle: string;
16
- author: string;
17
- text: string;
18
- }[];
19
- subtitleEnabled: boolean;
20
- teacherInstructionsEnabled: boolean;
21
- textEnabled: boolean;
22
- titleEnabled: boolean;
23
- };
24
- constructor();
25
- set model(m: any);
26
- set configuration(c: any);
27
- connectedCallback(): void;
28
- modelChanged(m: any): void;
29
- onConfigurationChanged(c: any): void;
30
- insertImage(handler: any): void;
31
- onDeleteImage(src: any, done: any): void;
32
- insertSound(handler: any): void;
33
- onDeleteSound(src: any, done: any): void;
34
- render(): void;
35
- disconnectedCallback(): void;
36
- }
@@ -1,66 +0,0 @@
1
- import e from "./design.js";
2
- import t from "./defaults.js";
3
- import n from "react";
4
- import { createRoot as r } from "react-dom/client";
5
- import { DeleteImageEvent as i, DeleteSoundEvent as a, InsertImageEvent as o, InsertSoundEvent as s, ModelUpdatedEvent as c } from "@pie-element/shared-configure-events";
6
- //#region src/author/index.ts
7
- var l = class l extends HTMLElement {
8
- static createDefaultModel = (e = {}) => ({
9
- ...t.model,
10
- ...e
11
- });
12
- constructor() {
13
- super(), this._root = null, this._model = l.createDefaultModel(), this._configuration = t.configuration;
14
- }
15
- set model(e) {
16
- this._model = l.createDefaultModel(e), this.render();
17
- }
18
- set configuration(e) {
19
- this._configuration = e, this.render();
20
- }
21
- connectedCallback() {
22
- this.render();
23
- }
24
- modelChanged(e) {
25
- this._model = e, this.dispatchEvent(new c(this._model), !0), this.render();
26
- }
27
- onConfigurationChanged(e) {
28
- this._configuration = e, this.render();
29
- }
30
- insertImage(e) {
31
- this.dispatchEvent(new o(e));
32
- }
33
- onDeleteImage(e, t) {
34
- this.dispatchEvent(new i(e, t));
35
- }
36
- insertSound(e) {
37
- this.dispatchEvent(new s(e));
38
- }
39
- onDeleteSound(e, t) {
40
- this.dispatchEvent(new a(e, t));
41
- }
42
- render() {
43
- if (this._model) {
44
- let t = n.createElement(e, {
45
- model: this._model,
46
- configuration: this._configuration,
47
- onModelChanged: this.modelChanged.bind(this),
48
- onConfigurationChanged: this.onConfigurationChanged.bind(this),
49
- imageSupport: {
50
- add: this.insertImage.bind(this),
51
- delete: this.onDeleteImage.bind(this)
52
- },
53
- uploadSoundSupport: {
54
- add: this.insertSound.bind(this),
55
- delete: this.onDeleteSound.bind(this)
56
- }
57
- });
58
- this._root ||= r(this), this._root.render(t);
59
- }
60
- }
61
- disconnectedCallback() {
62
- this._root && this._root.unmount();
63
- }
64
- };
65
- //#endregion
66
- export { l as default };
@@ -1,27 +0,0 @@
1
- /**
2
- * @synced-from pie-elements/packages/passage/configure/src/passage.jsx
3
- * @auto-generated
4
- *
5
- * This file is automatically synced from pie-elements and converted to TypeScript.
6
- * Manual edits will be overwritten on next sync.
7
- * To make changes, edit the upstream JavaScript file and run sync again.
8
- */
9
- import React from 'react';
10
- import PropTypes from 'prop-types';
11
- export declare class PassageComponent extends React.Component {
12
- static propTypes: {
13
- onModelChanged: PropTypes.Validator<(...args: any[]) => any>;
14
- model: PropTypes.Validator<object>;
15
- configuration: PropTypes.Validator<object>;
16
- imageSupport: PropTypes.Validator<object>;
17
- passageIndex: PropTypes.Validator<number>;
18
- uploadSoundSupport: PropTypes.Validator<object>;
19
- };
20
- static defaultProps: {
21
- passageIndex: number;
22
- };
23
- constructor(props: any);
24
- handleChange: any;
25
- render(): React.JSX.Element;
26
- }
27
- export default PassageComponent;
@@ -1,127 +0,0 @@
1
- import e from "react";
2
- import t from "prop-types";
3
- import { styled as n } from "@mui/material/styles";
4
- import { jsx as r, jsxs as i } from "react/jsx-runtime";
5
- import { InputContainer as a } from "@pie-lib/config-ui";
6
- import o, { ALL_PLUGINS as s } from "@pie-lib/editable-html-tip-tap";
7
- //#region src/author/passage.tsx
8
- var c = n(a)(({ theme: e }) => ({
9
- paddingTop: e.spacing(2),
10
- marginBottom: e.spacing(2),
11
- width: "100%"
12
- })), l = n("div")(({ theme: e }) => ({
13
- fontSize: e.typography.fontSize - 2,
14
- color: e.palette.error.main,
15
- paddingTop: e.spacing(1)
16
- })), u = class extends e.Component {
17
- static propTypes = {
18
- onModelChanged: t.func.isRequired,
19
- model: t.object.isRequired,
20
- configuration: t.object.isRequired,
21
- imageSupport: t.object.isRequired,
22
- passageIndex: t.number.isRequired,
23
- uploadSoundSupport: t.object.isRequired
24
- };
25
- static defaultProps = { passageIndex: 0 };
26
- constructor(e) {
27
- super(e);
28
- }
29
- handleChange = (e, t) => {
30
- let { model: n, onModelChanged: r, passageIndex: i } = this.props;
31
- if (!n.passages || i < 0 || i >= n.passages.length) return;
32
- let a = [...n.passages];
33
- a[i] = {
34
- ...a[i],
35
- [e]: t
36
- }, r({
37
- ...n,
38
- passages: a
39
- });
40
- };
41
- render() {
42
- let { model: t, configuration: n, imageSupport: a, passageIndex: u, uploadSoundSupport: d } = this.props, { maxImageWidth: f = {}, maxImageHeight: p = {}, mathMlOptions: m = {}, baseInputConfiguration: h = {}, teacherInstructions: g = {}, title: _ = {}, subtitle: v = {}, text: y = {}, author: b = {} } = n || {}, { errors: x = {}, passages: S = [], teacherInstructionsEnabled: C, titleEnabled: w, subtitleEnabled: T, authorEnabled: E, textEnabled: D } = t || {}, { passages: O } = x || {}, { teacherInstructions: k, title: A, subtitle: j, author: M, text: N } = O && O[u] || {}, P = f && f.prompt, F = p && p.prompt, I = (e) => ({
43
- ...h,
44
- ...e
45
- }), L = (s || []).filter((e) => ![
46
- "math",
47
- "table",
48
- "bulleted-list",
49
- "numbered-list"
50
- ].includes(e));
51
- return /* @__PURE__ */ i(e.Fragment, { children: [
52
- C && /* @__PURE__ */ i(c, {
53
- label: g.label,
54
- children: [/* @__PURE__ */ r(o, {
55
- activePlugins: s,
56
- markup: S[u].teacherInstructions || "",
57
- onChange: (e) => this.handleChange("teacherInstructions", e),
58
- nonEmpty: !1,
59
- error: k,
60
- maxImageWidth: f && f.teacherInstructions || P,
61
- maxImageHeight: p && p.teacherInstructions || F,
62
- mathMlOptions: m,
63
- languageCharactersProps: [{ language: "spanish" }, { language: "special" }],
64
- pluginProps: I(g?.inputConfiguration)
65
- }), k && /* @__PURE__ */ r(l, { children: k })]
66
- }),
67
- w && /* @__PURE__ */ i(c, {
68
- label: _.label,
69
- children: [/* @__PURE__ */ r(o, {
70
- activePlugins: L,
71
- markup: S[u].title || "",
72
- onChange: (e) => this.handleChange("title", e),
73
- nonEmpty: !1,
74
- error: A,
75
- mathMlOptions: m,
76
- languageCharactersProps: [{ language: "spanish" }, { language: "special" }],
77
- pluginProps: I(_?.inputConfiguration)
78
- }), A && /* @__PURE__ */ r(l, { children: A })]
79
- }),
80
- T && /* @__PURE__ */ i(c, {
81
- label: v.label,
82
- children: [/* @__PURE__ */ r(o, {
83
- activePlugins: L,
84
- markup: S[u].subtitle || "",
85
- onChange: (e) => this.handleChange("subtitle", e),
86
- nonEmpty: !1,
87
- error: j,
88
- mathMlOptions: m,
89
- languageCharactersProps: [{ language: "spanish" }, { language: "special" }],
90
- pluginProps: I(v?.inputConfiguration)
91
- }), j && /* @__PURE__ */ r(l, { children: j })]
92
- }),
93
- E && /* @__PURE__ */ i(c, {
94
- label: b.label,
95
- children: [/* @__PURE__ */ r(o, {
96
- activePlugins: L,
97
- markup: S[u].author || "",
98
- onChange: (e) => this.handleChange("author", e),
99
- nonEmpty: !1,
100
- error: M,
101
- mathMlOptions: m,
102
- languageCharactersProps: [{ language: "spanish" }, { language: "special" }],
103
- pluginProps: I(b?.inputConfiguration)
104
- }), M && /* @__PURE__ */ r(l, { children: M })]
105
- }),
106
- D && /* @__PURE__ */ i(c, {
107
- label: y.label,
108
- children: [/* @__PURE__ */ r(o, {
109
- activePlugins: s,
110
- markup: S[u].text || "",
111
- onChange: (e) => this.handleChange("text", e),
112
- imageSupport: a,
113
- uploadSoundSupport: d,
114
- nonEmpty: !1,
115
- error: N,
116
- maxImageWidth: f && f.text || P,
117
- maxImageHeight: p && p.text || F,
118
- mathMlOptions: m,
119
- languageCharactersProps: [{ language: "spanish" }, { language: "special" }],
120
- pluginProps: I(y?.inputConfiguration)
121
- }), N && /* @__PURE__ */ r(l, { children: N })]
122
- })
123
- ] });
124
- }
125
- };
126
- //#endregion
127
- export { u as default };
@@ -1,23 +0,0 @@
1
- /**
2
- * @synced-from pie-elements/packages/passage/controller/src/defaults.js
3
- * @auto-generated
4
- *
5
- * This file is automatically synced from pie-elements and converted to TypeScript.
6
- * Manual edits will be overwritten on next sync.
7
- * To make changes, edit the upstream JavaScript file and run sync again.
8
- */
9
- declare const _default: {
10
- authorEnabled: boolean;
11
- passages: {
12
- teacherInstructions: string;
13
- title: string;
14
- subtitle: string;
15
- author: string;
16
- text: string;
17
- }[];
18
- subtitleEnabled: boolean;
19
- teacherInstructionsEnabled: boolean;
20
- textEnabled: boolean;
21
- titleEnabled: boolean;
22
- };
23
- export default _default;
@@ -1,17 +0,0 @@
1
- //#region src/controller/defaults.ts
2
- var e = {
3
- authorEnabled: !1,
4
- passages: [{
5
- teacherInstructions: "",
6
- title: "",
7
- subtitle: "",
8
- author: "",
9
- text: ""
10
- }],
11
- subtitleEnabled: !0,
12
- teacherInstructionsEnabled: !0,
13
- textEnabled: !0,
14
- titleEnabled: !0
15
- };
16
- //#endregion
17
- export { e as default };
@@ -1,18 +0,0 @@
1
- /**
2
- * @synced-from pie-elements/packages/passage/controller/src/index.js
3
- * @auto-generated
4
- *
5
- * This file is automatically synced from pie-elements and converted to TypeScript.
6
- * Manual edits will be overwritten on next sync.
7
- * To make changes, edit the upstream JavaScript file and run sync again.
8
- */
9
- export declare function createDefaultModel(model?: {}): Promise<unknown>;
10
- export declare const normalize: (question: any) => any;
11
- /**
12
- *
13
- * @param {*} question
14
- * @param {*} session
15
- * @param {*} env
16
- */
17
- export declare function model(question: any, session: any, env: any): Promise<any>;
18
- export declare const validate: (model?: {}, config?: {}) => {};
@@ -1,50 +0,0 @@
1
- import e from "../node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isEmpty.js";
2
- import t from "./defaults.js";
3
- //#region src/controller/index.ts
4
- var n = (e) => (e || "").replace(/(<(?!img|iframe|source)([^>]+)>)/gi, ""), r = (e) => e != null, i = (e, t) => r(e) ? e : t;
5
- function a(e = {}) {
6
- return new Promise((n) => {
7
- n({
8
- ...t,
9
- ...e
10
- });
11
- });
12
- }
13
- var o = (e) => ({
14
- ...t,
15
- ...e
16
- }), s = (e, t) => {
17
- let { role: n, mode: r } = t;
18
- return n === "instructor" && (r === "view" || r === "evaluate") && e || "";
19
- };
20
- async function c(e, t, r) {
21
- let a = o(e), c = a.passages.map((e, t) => ({
22
- teacherInstructions: i(e.teacherInstructionsEnabled, a.teacherInstructionsEnabled) ? s(e.teacherInstructions, r) : "",
23
- label: n(e.title) ? e.title : `Passage ${t + 1}`,
24
- title: i(e.titleEnabled, a.titleEnabled) && e.title || "",
25
- subtitle: i(e.subtitleEnabled, a.subtitleEnabled) && e.subtitle || "",
26
- author: i(e.authorEnabled, a.authorEnabled) && e.author || "",
27
- text: i(e.textEnabled, a.textEnabled) && e.text || ""
28
- }));
29
- return {
30
- ...a,
31
- passages: c
32
- };
33
- }
34
- var l = (t = {}, r = {}) => {
35
- let i = {}, a = {};
36
- return (t.passages || []).forEach((t, i) => {
37
- let o = {};
38
- [
39
- "teacherInstructions",
40
- "title",
41
- "subtitle",
42
- "author",
43
- "text"
44
- ].forEach((e) => {
45
- r[e]?.required && !n(t[e]) && (o[e] = "This field is required.");
46
- }), e(o) || (a[i] = o);
47
- }), e(a) || (i.passages = a), i;
48
- };
49
- //#endregion
50
- export { a as createDefaultModel, c as model, o as normalize, l as validate };
@@ -1,22 +0,0 @@
1
- /**
2
- * @synced-from pie-elements/packages/passage/src/index.js
3
- * @auto-generated
4
- *
5
- * This file is automatically synced from pie-elements and converted to TypeScript.
6
- * Manual edits will be overwritten on next sync.
7
- * To make changes, edit the upstream JavaScript file and run sync again.
8
- */
9
- export default class PiePassage extends HTMLElement {
10
- constructor();
11
- setLangAttribute(): void;
12
- _scheduleMathRender: any;
13
- _initMathObserver(): void;
14
- _disconnectMathObserver(): void;
15
- set model(s: any);
16
- set session(s: any);
17
- connectedCallback(): void;
18
- _render(): void;
19
- _initPlayerObserver(): void;
20
- _disconnectPlayerObserver(): void;
21
- disconnectedCallback(): void;
22
- }