taleem-player 1.0.7 → 1.0.8

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.
@@ -4,8 +4,8 @@ var TitleAndSubtitleSlide = {
4
4
  fromJSON(raw) {
5
5
  const title = raw.data?.find((d) => d.name === "title")?.content;
6
6
  const subtitle = raw.data?.find((d) => d.name === "subtitle")?.content;
7
- if (!title || !subtitle) {
8
- throw new Error("titleAndSubtitle: requires title and subtitle");
7
+ if (!title) {
8
+ throw new Error("titleAndSubtitle: requires title");
9
9
  }
10
10
  return Object.freeze({
11
11
  type: "titleAndSubtitle",
@@ -13,7 +13,7 @@ var TitleAndSubtitleSlide = {
13
13
  return `
14
14
  <section class="slide titleAndSubtitle">
15
15
  <h1>${title}</h1>
16
- <h2>${subtitle}</h2>
16
+ ${subtitle ? `<h2>${subtitle}</h2>` : ``}
17
17
  </section>
18
18
  `;
19
19
  }
@@ -27,16 +27,16 @@ var TitleAndParaSlide = {
27
27
  fromJSON(raw) {
28
28
  const title = raw.data?.find((d) => d.name === "title")?.content;
29
29
  const para = raw.data?.find((d) => d.name === "para")?.content;
30
- if (!title || !para) {
31
- throw new Error("titleAndPara: requires title and para");
30
+ if (!title && !para) {
31
+ throw new Error("titleAndPara: requires at least title or para");
32
32
  }
33
33
  return Object.freeze({
34
34
  type: "titleAndPara",
35
35
  render() {
36
36
  return `
37
37
  <section class="slide titleAndPara">
38
- <h1>${title}</h1>
39
- <p>${para}</p>
38
+ ${title ? `<h1>${title}</h1>` : ``}
39
+ ${para ? `<p>${para}</p>` : ``}
40
40
  </section>
41
41
  `;
42
42
  }
@@ -35,8 +35,8 @@ var TaleemPlayer = (() => {
35
35
  fromJSON(raw) {
36
36
  const title = raw.data?.find((d) => d.name === "title")?.content;
37
37
  const subtitle = raw.data?.find((d) => d.name === "subtitle")?.content;
38
- if (!title || !subtitle) {
39
- throw new Error("titleAndSubtitle: requires title and subtitle");
38
+ if (!title) {
39
+ throw new Error("titleAndSubtitle: requires title");
40
40
  }
41
41
  return Object.freeze({
42
42
  type: "titleAndSubtitle",
@@ -44,7 +44,7 @@ var TaleemPlayer = (() => {
44
44
  return `
45
45
  <section class="slide titleAndSubtitle">
46
46
  <h1>${title}</h1>
47
- <h2>${subtitle}</h2>
47
+ ${subtitle ? `<h2>${subtitle}</h2>` : ``}
48
48
  </section>
49
49
  `;
50
50
  }
@@ -58,16 +58,16 @@ var TaleemPlayer = (() => {
58
58
  fromJSON(raw) {
59
59
  const title = raw.data?.find((d) => d.name === "title")?.content;
60
60
  const para = raw.data?.find((d) => d.name === "para")?.content;
61
- if (!title || !para) {
62
- throw new Error("titleAndPara: requires title and para");
61
+ if (!title && !para) {
62
+ throw new Error("titleAndPara: requires at least title or para");
63
63
  }
64
64
  return Object.freeze({
65
65
  type: "titleAndPara",
66
66
  render() {
67
67
  return `
68
68
  <section class="slide titleAndPara">
69
- <h1>${title}</h1>
70
- <p>${para}</p>
69
+ ${title ? `<h1>${title}</h1>` : ``}
70
+ ${para ? `<p>${para}</p>` : ``}
71
71
  </section>
72
72
  `;
73
73
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "taleem-player",
3
- "version": "1.0.7",
3
+ "version": "1.0.8",
4
4
  "type": "module",
5
5
  "main": "./dist/taleem-player.umd.js",
6
6
  "module": "./dist/taleem-player.esm.js",