@pie-element/passage 7.1.1 → 7.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 (134) hide show
  1. package/configure.js +2 -0
  2. package/controller.js +1 -0
  3. package/dist/author/common.d.ts +36 -0
  4. package/dist/author/common.js +56 -0
  5. package/dist/author/defaults.d.ts +175 -0
  6. package/dist/author/defaults.js +113 -0
  7. package/dist/author/design.d.ts +28 -0
  8. package/dist/author/design.js +120 -0
  9. package/dist/author/index.d.ts +36 -0
  10. package/dist/author/index.js +66 -0
  11. package/dist/author/passage.d.ts +27 -0
  12. package/dist/author/passage.js +127 -0
  13. package/dist/browser/author/index.js +39774 -0
  14. package/dist/browser/author/index.js.map +1 -0
  15. package/dist/browser/controller/index.js +64 -0
  16. package/dist/browser/controller/index.js.map +1 -0
  17. package/dist/browser/debounce-CUPmq2t-.js +86 -0
  18. package/dist/browser/debounce-CUPmq2t-.js.map +1 -0
  19. package/dist/browser/delivery/index.js +117 -0
  20. package/dist/browser/delivery/index.js.map +1 -0
  21. package/dist/browser/dist-C_PfhNd9.js +9602 -0
  22. package/dist/browser/dist-C_PfhNd9.js.map +1 -0
  23. package/dist/browser/isEmpty-xEtDXvJL.js +143 -0
  24. package/dist/browser/isEmpty-xEtDXvJL.js.map +1 -0
  25. package/dist/browser/isObjectLike-qb18ZQkj.js +38 -0
  26. package/dist/browser/isObjectLike-qb18ZQkj.js.map +1 -0
  27. package/dist/browser/passage.css +2 -0
  28. package/dist/browser/print/index.js +48 -0
  29. package/dist/browser/print/index.js.map +1 -0
  30. package/dist/browser/stimulus-tabs-CMox8txJ.js +218 -0
  31. package/dist/browser/stimulus-tabs-CMox8txJ.js.map +1 -0
  32. package/dist/controller/defaults.d.ts +23 -0
  33. package/dist/controller/defaults.js +17 -0
  34. package/dist/controller/index.d.ts +18 -0
  35. package/dist/controller/index.js +50 -0
  36. package/dist/delivery/index.d.ts +22 -0
  37. package/dist/delivery/index.js +83 -0
  38. package/dist/delivery/stimulus-tabs.d.ts +21 -0
  39. package/dist/delivery/stimulus-tabs.js +220 -0
  40. package/dist/index.d.ts +1 -0
  41. package/dist/index.iife.d.ts +8 -0
  42. package/dist/index.iife.js +145 -0
  43. package/dist/index.js +2 -0
  44. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_DataView.js +6 -0
  45. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Map.js +6 -0
  46. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Promise.js +6 -0
  47. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Set.js +6 -0
  48. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Symbol.js +5 -0
  49. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_WeakMap.js +6 -0
  50. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseGetTag.js +10 -0
  51. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsArguments.js +9 -0
  52. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsNative.js +11 -0
  53. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsTypedArray.js +11 -0
  54. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseKeys.js +12 -0
  55. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseTrim.js +8 -0
  56. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseUnary.js +8 -0
  57. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_coreJsData.js +5 -0
  58. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_freeGlobal.js +4 -0
  59. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getNative.js +9 -0
  60. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getRawTag.js +14 -0
  61. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getTag.js +23 -0
  62. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getValue.js +6 -0
  63. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_isMasked.js +11 -0
  64. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_isPrototype.js +8 -0
  65. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_nativeKeys.js +5 -0
  66. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_nodeUtil.js +9 -0
  67. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_objectToString.js +7 -0
  68. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_overArg.js +8 -0
  69. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_root.js +5 -0
  70. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_toSource.js +15 -0
  71. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_trimmedEndIndex.js +8 -0
  72. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/debounce.js +50 -0
  73. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isArguments.js +10 -0
  74. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isArray.js +4 -0
  75. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isArrayLike.js +8 -0
  76. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isBuffer.js +6 -0
  77. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isEmpty.js +21 -0
  78. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isFunction.js +11 -0
  79. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isLength.js +7 -0
  80. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isObject.js +7 -0
  81. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isObjectLike.js +6 -0
  82. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isSymbol.js +9 -0
  83. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isTypedArray.js +7 -0
  84. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/now.js +7 -0
  85. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/stubFalse.js +6 -0
  86. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/toNumber.js +19 -0
  87. package/dist/print/index.d.ts +15 -0
  88. package/dist/print/index.js +47 -0
  89. package/package.json +82 -18
  90. package/CHANGELOG.json +0 -227
  91. package/CHANGELOG.md +0 -1456
  92. package/LICENSE.md +0 -5
  93. package/README.md +0 -3
  94. package/configure/CHANGELOG.md +0 -676
  95. package/configure/lib/common.js +0 -74
  96. package/configure/lib/common.js.map +0 -1
  97. package/configure/lib/defaults.js +0 -174
  98. package/configure/lib/defaults.js.map +0 -1
  99. package/configure/lib/design.js +0 -185
  100. package/configure/lib/design.js.map +0 -1
  101. package/configure/lib/index.js +0 -86
  102. package/configure/lib/index.js.map +0 -1
  103. package/configure/lib/passage.js +0 -194
  104. package/configure/lib/passage.js.map +0 -1
  105. package/configure/package.json +0 -23
  106. package/controller/CHANGELOG.json +0 -1
  107. package/controller/CHANGELOG.md +0 -113
  108. package/controller/lib/defaults.js +0 -23
  109. package/controller/lib/defaults.js.map +0 -1
  110. package/controller/lib/index.js +0 -80
  111. package/controller/lib/index.js.map +0 -1
  112. package/controller/package.json +0 -13
  113. package/docs/config-schema.json +0 -1325
  114. package/docs/config-schema.json.md +0 -974
  115. package/docs/demo/config.js +0 -8
  116. package/docs/demo/generate.js +0 -32
  117. package/docs/demo/index.html +0 -1
  118. package/docs/pie-schema.json +0 -775
  119. package/docs/pie-schema.json.md +0 -561
  120. package/lib/index.js +0 -143
  121. package/lib/index.js.map +0 -1
  122. package/lib/print.js +0 -78
  123. package/lib/print.js.map +0 -1
  124. package/lib/stimulus-tabs.js +0 -319
  125. package/lib/stimulus-tabs.js.map +0 -1
  126. package/module/configure.js +0 -1
  127. package/module/controller.js +0 -920
  128. package/module/demo.js +0 -57
  129. package/module/element.js +0 -1
  130. package/module/index.html +0 -21
  131. package/module/manifest.json +0 -10
  132. package/module/print-demo.js +0 -95
  133. package/module/print.html +0 -18
  134. package/module/print.js +0 -1
package/configure.js ADDED
@@ -0,0 +1,2 @@
1
+ export { default } from './dist/author/index.js';
2
+ export * from './dist/author/index.js';
package/controller.js ADDED
@@ -0,0 +1 @@
1
+ export * from './dist/controller/index.js';
@@ -0,0 +1,36 @@
1
+ /**
2
+ * @synced-from pie-elements/packages/passage/configure/src/common.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 const RemoveAddButton: ({ label, type, onClick }: {
12
+ label: any;
13
+ type?: string | undefined;
14
+ onClick: any;
15
+ }) => React.JSX.Element;
16
+ export declare const PassageButton: any;
17
+ export declare const ConfirmationDialog: {
18
+ ({ content, cancel, title, ok, open, onOk, onCancel }: {
19
+ content: any;
20
+ cancel: any;
21
+ title: any;
22
+ ok: any;
23
+ open: any;
24
+ onOk: any;
25
+ onCancel: any;
26
+ }): React.JSX.Element;
27
+ propTypes: {
28
+ content: PropTypes.Validator<string>;
29
+ title: PropTypes.Validator<string>;
30
+ cancel: PropTypes.Validator<string>;
31
+ ok: PropTypes.Validator<string>;
32
+ open: PropTypes.Validator<boolean>;
33
+ onCancel: PropTypes.Validator<(...args: any[]) => any>;
34
+ onOk: PropTypes.Validator<(...args: any[]) => any>;
35
+ };
36
+ };
@@ -0,0 +1,56 @@
1
+ import "react";
2
+ import e from "prop-types";
3
+ import { styled as t } from "@mui/material/styles";
4
+ import { jsx as n, jsxs as r } from "react/jsx-runtime";
5
+ import { Button as i } from "@mui/material";
6
+ import a from "@mui/icons-material/RemoveCircle";
7
+ import o from "@mui/icons-material/AddCircle";
8
+ import s from "@mui/material/Dialog";
9
+ import c from "@mui/material/DialogTitle";
10
+ import l from "@mui/material/DialogContent";
11
+ import u from "@mui/material/DialogContentText";
12
+ import d from "@mui/material/DialogActions";
13
+ var f = t(({ label: e, type: t = "add", onClick: s }) => /* @__PURE__ */ r(i, {
14
+ color: "primary",
15
+ size: "small",
16
+ onClick: s,
17
+ children: [/* @__PURE__ */ n(t === "add" ? o : a, {
18
+ fontSize: "small",
19
+ color: "primary",
20
+ style: { marginRight: 4 }
21
+ }), e]
22
+ }))({
23
+ textDecoration: "underline",
24
+ "&:hover": {
25
+ textDecoration: "underline",
26
+ backgroundColor: "transparent"
27
+ },
28
+ display: "flex",
29
+ alignItems: "center"
30
+ }), p = ({ content: e, cancel: t, title: a, ok: o, open: f, onOk: p, onCancel: m }) => /* @__PURE__ */ r(s, {
31
+ open: f,
32
+ children: [
33
+ /* @__PURE__ */ n(c, { children: a }),
34
+ /* @__PURE__ */ n(l, { children: /* @__PURE__ */ n(u, { children: e }) }),
35
+ /* @__PURE__ */ r(d, { children: [p && /* @__PURE__ */ n(i, {
36
+ onClick: p,
37
+ color: "primary",
38
+ children: o
39
+ }), m && /* @__PURE__ */ n(i, {
40
+ onClick: m,
41
+ color: "primary",
42
+ children: t
43
+ })] })
44
+ ]
45
+ });
46
+ p.propTypes = {
47
+ content: e.string.isRequired,
48
+ title: e.string.isRequired,
49
+ cancel: e.string.isRequired,
50
+ ok: e.string.isRequired,
51
+ open: e.bool.isRequired,
52
+ onCancel: e.func.isRequired,
53
+ onOk: e.func.isRequired
54
+ };
55
+ //#endregion
56
+ export { p as ConfirmationDialog, f as PassageButton };
@@ -0,0 +1,175 @@
1
+ /**
2
+ * @synced-from pie-elements/packages/passage/configure/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
+ 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
+ configuration: {
25
+ baseInputConfiguration: {
26
+ audio: {
27
+ disabled: boolean;
28
+ };
29
+ video: {
30
+ disabled: boolean;
31
+ };
32
+ image: {
33
+ disabled: boolean;
34
+ };
35
+ h3: {
36
+ disabled: boolean;
37
+ };
38
+ blockquote: {
39
+ disabled: boolean;
40
+ };
41
+ textAlign: {
42
+ disabled: boolean;
43
+ };
44
+ showParagraphs: {
45
+ disabled: boolean;
46
+ };
47
+ separateParagraphs: {
48
+ disabled: boolean;
49
+ };
50
+ };
51
+ settingsPanelDisabled: boolean;
52
+ title: {
53
+ settings: boolean;
54
+ label: string;
55
+ inputConfiguration: {
56
+ audio: {
57
+ disabled: boolean;
58
+ };
59
+ video: {
60
+ disabled: boolean;
61
+ };
62
+ image: {
63
+ disabled: boolean;
64
+ };
65
+ textAlign: {
66
+ disabled: boolean;
67
+ };
68
+ };
69
+ required: boolean;
70
+ };
71
+ subtitle: {
72
+ settings: boolean;
73
+ label: string;
74
+ inputConfiguration: {
75
+ audio: {
76
+ disabled: boolean;
77
+ };
78
+ video: {
79
+ disabled: boolean;
80
+ };
81
+ image: {
82
+ disabled: boolean;
83
+ };
84
+ textAlign: {
85
+ disabled: boolean;
86
+ };
87
+ };
88
+ required: boolean;
89
+ };
90
+ author: {
91
+ settings: boolean;
92
+ label: string;
93
+ inputConfiguration: {
94
+ audio: {
95
+ disabled: boolean;
96
+ };
97
+ video: {
98
+ disabled: boolean;
99
+ };
100
+ image: {
101
+ disabled: boolean;
102
+ };
103
+ };
104
+ required: boolean;
105
+ };
106
+ text: {
107
+ settings: boolean;
108
+ label: string;
109
+ inputConfiguration: {
110
+ audio: {
111
+ disabled: boolean;
112
+ };
113
+ video: {
114
+ disabled: boolean;
115
+ };
116
+ image: {
117
+ disabled: boolean;
118
+ };
119
+ h3: {
120
+ disabled: boolean;
121
+ };
122
+ blockquote: {
123
+ disabled: boolean;
124
+ };
125
+ textAlign: {
126
+ disabled: boolean;
127
+ };
128
+ };
129
+ required: boolean;
130
+ };
131
+ teacherInstructions: {
132
+ settings: boolean;
133
+ label: string;
134
+ inputConfiguration: {
135
+ audio: {
136
+ disabled: boolean;
137
+ };
138
+ video: {
139
+ disabled: boolean;
140
+ };
141
+ image: {
142
+ disabled: boolean;
143
+ };
144
+ };
145
+ required: boolean;
146
+ };
147
+ maxImageWidth: {
148
+ teacherInstructions: number;
149
+ text: number;
150
+ };
151
+ maxImageHeight: {
152
+ teacherInstructions: number;
153
+ text: number;
154
+ };
155
+ mathMlOptions: {
156
+ mmlOutput: boolean;
157
+ mmlEditing: boolean;
158
+ };
159
+ language: {
160
+ settings: boolean;
161
+ label: string;
162
+ enabled: boolean;
163
+ };
164
+ languageChoices: {
165
+ label: string;
166
+ options: never[];
167
+ };
168
+ additionalPassage: {
169
+ settings: boolean;
170
+ label: string;
171
+ enabled: boolean;
172
+ };
173
+ };
174
+ };
175
+ export default _default;
@@ -0,0 +1,113 @@
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 };
@@ -0,0 +1,28 @@
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;
@@ -0,0 +1,120 @@
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 };
@@ -0,0 +1,36 @@
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
+ }
@@ -0,0 +1,66 @@
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 };
@@ -0,0 +1,27 @@
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;